📄 tdestr.h
字号:
/* * New editor name: tde, the Thomson-Davis Editor. * Author: Frank Davis * Date: June 5, 1991 * * This modification of Douglas Thomson's code is released into the * public domain, Frank Davis. You may distribute it freely. * * This file contains define's and structure declarations common to all * editor modules. It should be included in every source code module. * * I'm so stupid, I can't keep up with which declarations are in which * file. I decided to put all typedefs, structs, and defines in one file. * If I don't, I end up defining a typedef one way in one file and a * completely different way in another file. */#include <stdio.h>#include <string.h>#include <stdlib.h>#include <time.h>#include <limits.h>#include <assert.h>#if defined( __DOS16__ ) #if defined( __MSC__ ) #include <malloc.h> /* for memory allocation */ #else #include <alloc.h> /* for memory allocation */ #endif#endif/* * in unix (POSIX?), getch( ) is in the curses package. in Linux, ncurses * seems to be the best of the worst curses. */#if defined( __UNIX__ ) #include <dirent.h> /* walking down directories */ #include <limits.h> /* NAME_MAX and PATH_MAX, POSIX stuff */ #include <malloc.h> /* for memory allocation */ #include <ncurses.h> #include <unistd.h> /* chdir, getcwd, etc... */ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> /* creat */ #define fattr_t mode_t /* attribute type for unix */ #define ftime_t time_t /* timestamp type for unix */ #ifndef stricmp # define stricmp strcasecmp #endif#else #include <io.h> /* isatty() (DOS16 - I hope MSC has it) */ /* setmode (_setmode for MSC) */ #include <fcntl.h> /* O_BINARY (_O_BINARY for MSC) */ #define fattr_t unsigned int /* attribute type for dos/djgpp/Win32 */# if defined( __WIN32__ ) #define ftime_t FILETIME /* timestamp type for Win32 */# else #define ftime_t unsigned long /* timestamp type for dos/djgpp */# endif#endif#if defined( __DJGPP__ ) #include <sys/farptr.h> #include <go32.h> #include <dpmi.h> #include <dir.h> #undef DIRECTORY /* this define interferes with the lister */ #include <unistd.h> /* for isatty() */ #include <limits.h> #undef NAME_MAX /* defined as 12, yet it should also handle */ #define NAME_MAX 255 /* LFN which can be this */#endif#if defined( __WIN32__ ) #include <windows.h> #ifdef PATH_MAX /* MinGW defines this in limits.h */ # undef PATH_MAX #endif #define PATH_MAX MAX_PATH #define NAME_MAX MAX_PATH #undef ERROR /* fix this!! */ #undef DELETE /* fix this!! */ #undef TEXT /* fix this!! */ #ifdef IGNORE # undef IGNORE /* MinGW32 */ #endif #ifdef SEARCH_ALL # undef SEARCH_ALL /* Visual Studio */ #endif #ifndef ENABLE_QUICK_EDIT /* undocumented console modes */ # define ENABLE_QUICK_EDIT 0x0040 #endif #ifndef ENABLE_EXTENDED_FLAGS # define ENABLE_EXTENDED_FLAGS 0x0080 #endif#endif#ifndef PATH_MAX# define PATH_MAX 100 /* maximum file size 66+1+12+1+just-in-case */#endif#ifndef NAME_MAX# define NAME_MAX 12#endif#include "bj_ctype.h"#include "letters.h"#include "filmatch.h"/* * defines for the inline assembler. */#if defined( __MSC__ ) #define ASSEMBLE _asm#else #define ASSEMBLE asm#endif#if defined( __UNIX__ ) #define my_stdprn stderr #define STDFILE "/dev/tty"#else# if defined( __WIN32__ ) #define my_stdprn stderr# else #define my_stdprn stdprn# endif #define STDFILE "CON"#endif/* * based on code contributed by "The Big Boss" <intruder@link.hacktic.nl> * let's look for a config file in the current directory or in the user's * home directory, or the executable's directory. */#if defined( __UNIX__ )# define CONFIGFILE ".tdecfg"# define HELPFILE ".tdehlp"# define SYNTAXFILE ".tdeshl"# define WORKSPACEFILE ".tdewsp"#else# define CONFIGFILE "tde.cfg"# define HELPFILE "tde.hlp"# define SYNTAXFILE "tde.shl"# define WORKSPACEFILE "tde.wsp"#endif/* * jmh 020817: If this is the first line of a file, then it is a valid * workspace file. */#define WORKSPACE_SIG "TDE Workspace File"/* * based on code by chen. * in both DOS and UNIX, let's assume the biggest screen is 132x60. * jmh - Browsing through Ralf Brown's Interrupt List, I see that the * widest screen is 160 and the longest is 75. * jmh 991019: 80 lines is now the biggest (6-line font, 480 scan lines). */#define MAX_COLS 160 /* widest screen ever used */#define MAX_LINES 80 /* highest screen ever used */#define BUFF_SIZE 1042 /* buffer size for lines */#define MAX_LINE_LENGTH 1040 /* longest line allowed in file */#define MAX_TAB_SIZE 80 /* largest tab size allowed (jmh 021105) */#define NO_MARKERS 4 /* maximum no. of markers (inc. previous) */#if defined( __DOS16__ )#define UNDO_STACK_LEN 200 /* number of lines in undo stack */#define MAX_UNDOS 200 /* number of undos to keep */#else#define UNDO_STACK_LEN 0#define MAX_UNDOS 0#endif/* * when we read in a file, lets try to match the size of the read buffer * with some multiple of a hardware or software cache that may be present. */#define READ_LENGTH 1024#define DEFAULT_BIN_LENGTH 64#define REGX_SIZE 200 /* maximum number of nodes in nfa *//* * general defines. */#ifndef ERROR# define ERROR (-1) /* abnormal termination */#endif#ifndef OK# define OK 0 /* normal termination */#endif#ifndef TRUE# define TRUE 1 /* logical true */#endif#ifndef FALSE# define FALSE 0 /* logical false */#endif#define MAX_KEYS 88 /* number of physical keys recognised by TDE */#define MODIFIERS 8 /* number of states of those keys */#define AVAIL_KEYS 117 /* number of config keys */#define STROKE_LIMIT 1024 /* number of key strokes in playback buffer */#define STACK_UNDERFLOW 1 /* code for underflowing macro stack */#define STACK_OVERFLOW 2 /* code for overflowing macro stack */#define SAS_P 20 /* number of sas pointers to tokens */#define NUM_FUNCS 239#define NUM_COLORS 28 /* number of color fields in TDE */#define SHL_NUM_COLORS 14 /* number of colors for syntax highlighting */#define SHL_NUM_FEATURES 27 /* number of customizable features *//* * Function flags (jmh 031129). These are used to indicate a function is * available in read-only mode and to help the menu determine invalid fns. */#define F_MODIFY 1 /* function modifies the file */#define F_BOX 2 /* function requires BOX block */#define F_LINE 4 /* function requires LINE block */#define F_STREAM 8 /* function requires STREAM block */#define F_BSAFE 16 /* block function does not modify its file */#define F_BLOCK (F_BOX | F_LINE | F_STREAM)/* * special cases for keyboard mapping - see define.h */#define RTURN _ENTER /* Return key */#define ESC _ESC /* Escape key *//* * The following defines are used by the "error" function to indicate * how serious the error is. */#define WARNING 1 /* user must acknowledge, editor continues */#define INFO 2 /* display message, acknowledge, continue *//* * define the type of block marked by user and block actions */#define NOTMARKED 0 /* block type undefined */#define BOX 1 /* block marked by row and column */#define LINE 2 /* block marked by begin and end lines */#define STREAM 3 /* block marked by begin and end characters */#define MOVE 1#define DELETE 2#define COPY 3#define KOPY 4#define FILL 5#define OVERLAY 6#define NUMBER 7#define SWAP 8#define BORDER 9 /* added by jmh 980731 */#define JUSTIFY 10 /* added by jmh 980810 */#define SUM 11 /* added by jmh 991112 */#define LEFT 1#define RIGHT 2#define ASCENDING 1#define DESCENDING 2/* * three types of ways to update windows * jmh 991124: added a RULER type, treat as a mask. */#define LOCAL 1#define NOT_LOCAL 2#define GLOBAL 3 /* LOCAL | NOT_LOCAL */#define RULER 4/* * Additional flags to indicate read-only status from command line. */#define O_READ_ONLY 4#define O_READ_WRITE 8#define CMDLINE 16 /* jmh 030303 */#define CURLINE 1#define NOTCURLINE 2/* * search/replace flags. */#define BOYER_MOORE 0#define REG_EXPRESSION 1#define CLR_SEARCH 0#define WRAPPED 1#define SEARCHING 2#define REPLACING 3#define NFA_GAVE_UP 4#define CHANGED 12#define SORTING 13#define IGNORE 1#define MATCH 2#define PROMPT 1#define NOPROMPT 2#define FORWARD 1#define BACKWARD 2#define BEGIN 1#define END 2#define BEGINNING 1#define CURRENT 2/* * jmh 991006: flags to indicate what type of search is being performed */#define SEARCH_REGX 1 /* TRUE = regx, FALSE = text */#define SEARCH_BACK 2 /* TRUE = backward, FALSE = forward */#define SEARCH_BLOCK 4 /* TRUE = block, FALSE = file */#define SEARCH_BEGIN 8 /* TRUE = beginning, FALSE = current */#define SEARCH_I 16 /* TRUE = isearch, FALSE = normal */#define SEARCH_ALL 32 /* search all loaded files */#define SEARCH_RESULTS 64 /* all matching lines go in a new window *//* * additional messages included with the search ones. */#define DIFFING 5#define NEXTKEY 6#define UNDO_GROUP 7 /* 7 is off, 8 is on */#define UNDO_MOVE 9 /* 9 is off, 10 is on */#define TALLYING 11/* * get_response flags */#define R_PROMPT 1 /* display responses */#define R_MACRO 2 /* accept response from a macro */#define R_DEFAULT 4 /* accept the first response as a default */#define R_ABORT 8 /* cancel query */#define R_NOMACRO (R_PROMPT | R_DEFAULT | R_ABORT)#define R_ALL (R_MACRO | R_NOMACRO)/* * word wrap flag. */#define NO_WRAP 0#define FIXED_WRAP 1#define DYNAMIC_WRAP 2/* * used in interrupt 0x21 function xx for checking file status */#define EXIST 0#define WRITE 2#define READ 4#define READ_WRITE 6#define NORMAL 0x00#define READ_ONLY 0x01#define HIDDEN 0x02#define SYSTEM 0x04#define VOLUME_LABEL 0x08#define SUBDIRECTORY 0x10#define ARCHIVE 0x20/* * critical error def's */#define RETRY 1#define ABORT 2#define FAIL 3/* * flags used for opening files to write either in binary or text mode. * crlf is for writing files in text mode - Operating System converts * lf to crlf automatically on output. in binary mode, lf is not translated. */#define CRLF 0#define LF 1#define BINARY 2#define TEXT 3#define NATIVE 4#define OVERWRITE 1#define APPEND 2/* * cursor sizes (modified by jmh 990404) */#define SMALL_CURSOR 0#define MEDIUM_CURSOR 1#define LARGE_CURSOR 2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -