⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tdestr.h

📁 一个开源著名的TDE编辑器源代码
💻 H
📖 第 1 页 / 共 3 页
字号:
#define CURSES_INVISBL  0#define CURSES_SMALL    1#define CURSES_LARGE    2/* * possible answers to various questions - see get_yn, get_ynaq and get_oa */#define A_YES           1#define A_NO            2#define A_ALWAYS        3#define A_QUIT          4#define A_ABORT         5#define A_OVERWRITE     6#define A_APPEND        7#define VIDEO_INT    0x10#define COLOR_80        3#define MONO_80         7#define VGA             3#define EGA             2#define CGA             1#define MDA             0#define  MAJOR          10      /* number of pull-down main menu options */#define  MAJOR_MAX      20      /* maximum number of menu options */#define SAS_DELIMITERS  " \n"/* * values for directory sorting (jmh 980805) */#define SORT_NAME       0#define SORT_EXT        1/* * cursor direction (jmh 981129) */#define CUR_RIGHT       0#define CUR_LEFT        1#define CUR_DOWN        2#define CUR_UP          3/* * directory matching (jmh 990425) */#define NO_DIRS         0#define MATCH_DIRS      1#define ALL_DIRS        2/* * number of graphic sets available (jmh 991019) */#define GRAPHIC_SETS    6/* * flags for reduce string (jmh 021105) *//* BEGIN & END are defined from the search */#define MIDDLE          3/* * macro flag bitmasks (jmh 050709) */#define WRAP            0x01    /* searches should wrap */#define NOWRAP          0x02    /* searches should stop at EOF */#define NOWARN          0x04    /* don't display warning messages */#define NEEDBOX         0x08    /* box block required */#define NEEDLINE        0x10    /* line block required */#define NEEDSTREAM      0x20    /* stream block required */#define USESBLOCK       0x40    /* preserve current block */#define USESDIALOG      0x80    /* preserve dialog settings */#define NEEDBLOCK       (NEEDBOX | NEEDLINE | NEEDSTREAM)/* * let's explicitly treat characters as unsigned. */typedef unsigned char text_t;typedef unsigned char *text_ptr;/* * I'm sick of all the tests for the character type, so let's define it - jmh */#if defined( __UNIX__ )# define Char chtype#elif defined( __WIN32__ )# define Char CHAR_INFO#else# define Char unsigned short#endif#define DISPLAY_BUFF Char display_buff[MAX_COLS]#define SAVE_LINE( line )       save_screen_line( 0, line, display_buff )#define RESTORE_LINE( line ) restore_screen_line( 0, line, display_buff )/* * Create a few key macros. * KEY_IDX is used by key_func and macro arrays: key_func[KEY_IDX(key)] */#define SHIFT(key) ((int)key >> 9)#define KEY(key)   ((int)key & 255)#define KEY_IDX(key) SHIFT(key)][KEY(key)#define CREATE_TWOKEY(parent, child) (((long)(parent) << 16) | (child))#define PARENT_KEY(key) (int)((key) >> 16)#define CHILD_KEY(key)  (int)((key) & 0xffff)/* * "mem_info" contains struct defs for a block of memory. */typedef struct {   char *base;                  /* pointer to the actual memory of the block */   unsigned size;               /* size of the block */   unsigned space;              /* largest free space */   char *free;                  /* pointer to current or first free space */} mem_info;#define MEM_GROUP 10            /* allocate this many at a time *//* * The initial size of the block. I've added 12 because Borland uses paragraph * allocation, with a four-byte overhead. I hope MSC doesn't use more. */#define MEM_CHUNK 64012u#define MEM_MIN_CHUNK 2000      /* don't create a block less than this *//* * "s_line_list" contains struct defs for a node of text. */typedef struct s_line_list {   text_ptr line;                       /* pointer to line */   int      len;                        /* length of line */   long     type;                       /* bit mask - see below */   struct s_line_list *next;            /* next line in doubly linked list */   struct s_line_list *prev;            /* prev line in doubly linked list */} line_list_struc;typedef line_list_struc *line_list_ptr;/* * Bit masks for the type of a line. Syntax highlighting flags are in syntax.h. */#define DIRTY             1     /* the line has been modified              */#define EQUAL    0x80000000L    /* the line sorts the same as the previous */typedef struct {   char *minor_name;   long minor_func;   struct s_menu_str *pop_out;  /* added by jmh 010624 */   int  disabled;               /* added by jmh 031129 */   char *line;                  /* the line that is displayed (jmh 031130) */} MINOR_STR;typedef struct s_menu_str {   MINOR_STR *minor;   int  minor_cnt;   int  width;                  /* the width of the menu     | these four  */   int  first;                  /* the first valid selection |  added by   */   int  last;                   /* the last valid selection  |  jmh 980809 */   int  current;                /* the current selection */   int  checked;                /* added by jmh 031129 */} MENU_STR;typedef struct {   char *major_name;   MENU_STR menu;} MENU[MAJOR_MAX];typedef struct s_menu_list {    /* jmh 050722: use a linked list to maintain */   struct s_menu_list *next;    /*             the popout menus              */   MENU_STR popout;} MENU_LIST;struct vcfg {   int color;   unsigned cols;   unsigned rows;};/* one array for mono and another for color */typedef int TDE_COLORS[2][NUM_COLORS];typedef unsigned char KEY_FUNC[MODIFIERS][MAX_KEYS];/* * structure used in directory list. */typedef struct {   char   *fname;               /* file name (jmh 020924: pointer not array) */   long    fsize;               /* file size in bytes */   fattr_t fattr;               /* file attribute */   ftime_t ftime;               /* file time (jmh 031202) */} FTYPE;/* * structure used in language list. */typedef struct {   char *parent;                /* parent language */   char *pattern;               /* file pattern */   int   icase;                 /* case sensitivity */} LTYPE;/* * structure for an item in a list dialog (jmh 060913). */typedef struct {   char *name;                  /* text to display */   int   color;                 /* color to use */   void *data;                  /* associated data */} LIST;/* * stuff we need to know about how to display a directory listing. */typedef struct {   int  row;                    /* absolute row to display dir box */   int  col;                    /* absolute column to display dir box */   int  wid;                    /* absolute number of columns in dir box */   int  hgt;                    /* absolute number of rows in dir box */   int  max_cols;               /* number of columns of files in box */   int  max_lines;              /* number of lines of files in box */   int  len;                    /* length of highlight bar */   int  cnt;                    /* file count */   int  cols;                   /* logical number of columns in list */   int  lines;                  /* logical number of rows in list */   int  prow;                   /* logical number of rows in partial row */   int  vcols;                  /* number of virtual columns, if any */   int  nfiles;                 /* number of files on screen */   int  avail;                  /* number of available slots for files */   int  select;                 /* current file under cursor */   int  flist_col[5];           /* offset from col to display each column */} DIRECTORY;typedef struct {   int  pattern_length;                 /* number of chars in pattern */   int  search_defined;                 /* search pattern defined? */   text_t pattern[MAX_COLS];            /* search pattern */   int  forward_md2;                    /* forward mini-delta2 */   int  backward_md2;                   /* backward mini-delta2 */   char skip_forward[256];              /* boyer array for forward searches */   char skip_backward[256];             /* boyer array for back searches */} boyer_moore_type;/* * "mode_infos" contain the editor mode variables.  The configuration *  utility modifies this structure to customize the start-up tde *  configuration */typedef struct {   int  color_scheme;           /* color to start out with */   int  sync;                   /* sync the cursor movement command? */   int  sync_sem;               /* sync the cursor movement command? */   int  record;                 /* are we recording keystrokes? */   int  insert;                 /* in insert mode? */   int  indent;                 /* in auto-indent mode? */   int  ptab_size;              /* physical tab stops */   int  ltab_size;              /* logical tab stops */   int  smart_tab;              /* smart tab mode on or off? */   int  inflate_tabs;           /* inflate tabs?  T or F or Real */   int  search_case;            /* consider case? IGNORE or MATCH */   int  enh_kbd;                /* type of keyboard */   int  cursor_size;            /* insert cursor big or small? */   int  control_z;              /* write ^Z - t or f */   int  crlf;                   /* <cr><lf> toggle CRLF or LF */   int  trailing;               /* remove trailing space? T or F */   int  show_eol;               /* show lf at eol? T or F or Extend */   int  word_wrap;              /* in word wrap mode? */   int  left_margin;            /* left margin */   int  parg_margin;            /* column for 1st word in paragraph */   int  right_margin;           /* right margin */   int  right_justify;          /* boolean, justify right margin?  T or F */   int  format_sem;             /* format semaphore */   int  undo_max_lines;         /* max number of lines in undo stack */   int  undo_max;               /* max number of undos to keep */   int  undo_group;             /* group or individual undo?  T or F */   int  undo_move;              /* undo movement? T or F */   int  do_backups;             /* create backup or ".bak" files? T or F */   int  ruler;                  /* show ruler at top of window? T or F */   char stamp[MAX_COLS];        /* format for date and time stamp */   int  cursor_cross;           /* is the cursor cross on? T or F */   int  dir_sort;               /* sort directories by name or extension? */   int  graphics;               /* numbers translated to graphics? +ve yes */   int  cur_dir;                /* cursor update direction */   int  draw;                   /* draw mode? - jmh 991018 */   int  line_numbers;           /* display line numbers? - jmh 991108 */   int  auto_save_wksp;         /* auto. save workspace? - jmh 020911 */   int  track_path;             /* set cwd to current file? - jmh 021021 */   int  display_cwd;            /* display the cwd? - jmh 030226 */   char helpfile[PATH_MAX];     /* name of help file - jmh 050711 */   char helptopic[MAX_COLS];    /* regx pattern to search above */} mode_infos;/* * "displays" contain all the status information about what attributes are *  used for what purposes, which attribute is currently set, and so on. * The editor only knows about one physical screen. * * jmh 991023: even though nlines says it is lines on display device, it is *              used as the bottom line of the window. It's annoyed me once *              too often, so now it is what it says it is and end_line is *              the last available line. To be specific: *                  nlines    = height of display *                  mode_line = nlines - 1 *                  end_line  = mode_line - 1 * * jmh 031028: removed the individual colors, using a pointer into the *              colours array instead (also see define.h). * */typedef struct {   int nlines;                  /* lines on display device */   int ncols;                   /* columns on display device */   int mode_line;               /* line to display editor modes - fmd */   int end_line;                /* last line available to windows - jmh */   int *color;                  /* pointer to mono or color settings */   int old_overscan;            /* color of old overscan   */   int adapter;                 /* VGA, EGA, CGA, or MDA? */   int curses_cursor;           /* what state is CURSES cursor? */                                /* original cursor size for DOS */   int cursor[3];               /* cursor sizes (jmh 990404) */   int overw_cursor;            /* hi part = top scan line, lo part = bottom */   int insert_cursor;           /* hi part = top scan line, lo part = bottom */   int frame_style;             /* style to draw frames (jmh 991022) */   int frame_space;             /* draw a space around frame? (jmh 991022) */   int output_space;            /* flag for s_output() */   int shadow;                  /* give dialogs a shadow? (jmh 991023) */   int shadow_width;            /* width of right edge of shadow (jmh 991023) */} displays;/* * "TDE_WIN" contains all the information that is unique to a given *  window. */typedef struct s_tdewin {   struct s_file_infos *file_info;       /* file in window */   line_list_ptr ll;            /* pointer to current node in linked list */   int  ccol;                   /* column cursor logically in */   int  rcol;                   /* column cursor actually in */   int  bcol;                   /* base column to start display */   int  cline;                  /* line cursor logically in */   long rline;                  /* real line cursor in */   long bin_offset;             /* offset, in bytes from beg of bin file */   int  top;                    /* top line of window    - jmh 991109 */   int  left;                   /* left column of window - jmh 991109 */   int  top_line;               /* top line in window */   int  bottom_line;            /* bottom line in window */   int  start_col;              /* starting column on physical screen */   int  end_col;                /* ending column on physical screen */   int  vertical;               /* boolean. is window split vertically? */   int  page;                   /* no. of lines to scroll for one page */   int  visible;                /* window hidden or visible */   int  letter;                 /* window letter */   int  ruler;                  /* show ruler in this window? */   int  syntax;                 /* is syntax highlighting enabled? */   int  cur_count;              /* number of "current" lines to display */   char *title;                 /* title to display instead of filename */   struct s_tdewin *next;       /* next window in doubly linked list */   struct s_tdewin *prev;       /* previous window in doubly linked list */} TDE_WIN;#if defined( __DOS16__ )/* * struct for find first and find next functions.  see DOS technical ref * manuals for more info on DTA structures. */typedef struct {   char          reserved[21];   unsigned char attrib;   ftime_t       time;   long          size;   char          name[13];} DTA;#endiftypedef struct {#if defined( __UNIX__ )   DIR  *find_info;#elif defined( __DJGPP__ )   struct ffblk find_info;#elif defined( __WIN32__ )   HANDLE find_info;#else   DTA  find_info;#endif   char stem[PATH_MAX];                 /* Path to search */   char pattern[NAME_MAX];              /* Wildcard pattern to search */   int  dirs;                           /* TRUE to find directories/sizes */} FFIND;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -