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

📄 tdestr.h

📁 一个开源著名的TDE编辑器源代码
💻 H
📖 第 1 页 / 共 3 页
字号:
/* * marker structure used to save file positions. */typedef struct {   long rline;                  /* real line of marker */   int  cline;                  /* screen line of marker */   int  rcol;                   /* real column of marker */   int  ccol;                   /* logical column of marker */   int  bcol;                   /* base column of marker */   int  marked;                 /* boolean:  has this marker been set? */} MARKER;/* * structure for recording and playing back keystrokes. */typedef struct {  int mode[3];                  /* insert, tab and indent modes */  int flag;                     /* wrap, warning, block and dialog flags */  int len;                      /* number of keys in the macro */  union {     long key;                  /* one key, which may be text or function */     long *keys;                /* an array of keys */  } key;} MACRO;/* * tree structure for pseudo-macros and two-key functions and macros. * jmh 990430: did away with the union. */typedef struct s_tree {   long key;                    /* combination or two-key code */                                /* > 0x10000 is a two-key */   MACRO *macro;                /* pointer to the macro */   int   func;                  /* function assigned to two-key */   struct s_tree *left;         /* pointer to the one less than this */   struct s_tree *right;        /* pointer to the one greater than this */} TREE;/* * structure for macro block information. */typedef struct {   struct s_file_infos *file;   int  marked;   int  type;   int  bc;   long br;   int  ec;   long er;} BLOCK;/* * structure for the local macro stack in macro processor. */typedef struct s_macro_stack {   MACRO *macro;                /* macro we were executing */   int    pos;                  /* position to begin execution in macro */   MARKER mark;                 /* macro marker */   BLOCK  block;                /* block prior to macro */   struct s_macro_stack *prev;  /* previous macro on the stack */} MACRO_STACK;/* * structure for the undo. */typedef struct s_undo {   long line;                   /* line number (rline) */   int  col;                    /* column position (rcol) */   int  op;                     /* operation or function */   int  len;                    /* length or count */   text_ptr text;               /* characters or line */   int  dirty;                  /* line dirty flag before change */   int  mod;                    /* modified file flag before change */   int  group;                  /* number of undos within the group */   struct s_undo *prev;   struct s_undo *next;} UNDO;#define U_UNDO  1024            /* distinguish between op. and function */#define U_INS    (1 | U_UNDO)#define U_OVR    (2 | U_UNDO)#define U_DEL    (4 | U_UNDO)#define U_CHAR   (8 | U_UNDO)#define U_STR   (16 | U_UNDO)#define U_LINE  (32 | U_UNDO)#define U_SPACE (64 | U_UNDO)/* * "option_infos" contains all the command line options that may *  apply to more than one file (jmh 030730). */typedef struct {   char *language;              /* syntax highlighting language to use */   int  read_only;              /* read-only file */   int  scratch;                /* load file as scratch - jmh 030730 */   int  tab_size;               /* size of tabs - jmh 010528 */   int  file_mode;              /* mode to open files, TEXT or BINARY */   int  file_chunk;             /* if opened BINARY, bytes per line */   int  macro;                  /* key to use for the startup macro */   int  all;                    /* load all files immediately - jmh 040715 */} option_infos;/* * "status_infos" contains all the editor status information that is *  global to the entire editor (i.e. not dependent on the file or *  window) */typedef struct {   mem_info *memory;            /* array of memory blocks (sorted by base) */   int  *mem_size;              /* array of memory blocks (sorted by size) */   int  mem_avail;              /* count of above */   int  mem_num;                /* actual blocks allocated */   int  mem_cur;                /* current block to allocate from */   TDE_WIN *current_window;     /* current active window */   struct s_file_infos *current_file; /* current active file */   struct s_file_infos *file_list; /* all active files */   TDE_WIN *window_list;        /* all active windows */   struct s_language *language_list; /* all loaded languages */   int  window_count;           /* number of windows - displayed and hidden */   int  file_count;             /* number of files currently open */   int  scratch_count;          /* number of scratch files */   int  arg;                    /* current argument pointer */   int  argc;                   /* argument count */   char **argv;                 /* argument variables - same as *argv[] */   long jump_to;                /* line to jump to */   int  jump_col;               /* column to jump to - jmh 990921 */   long jump_off;               /* offset to jump to - jmh 990921 */   int  viewer_mode;            /* start in viewer mode */   int  sas_defined;            /* has search and seize been defined */   int  sas_search_type;        /* if defined, Boyer-Moore or reg expression? */   int  sas_arg;                /* current argument pointer */   int  sas_argc;               /* argument count */   char **sas_argv;             /* argument variables - same as *argv[] */   char sas_tokens[PATH_MAX];   /* storage for file tokens */   char *sas_arg_pointers[SAS_P]; /* array of tokens in sas_tokens */   long sas_rline;              /* line number of sas find */   int  sas_rcol;               /* column number of sas find */   line_list_ptr sas_ll;        /* linked list node pointing to line */   int  marked;                 /* has block been marked? */   struct s_file_infos *marked_file;  /* pointer to file w/ marked block */   char rw_name[PATH_MAX];      /* name of last file read or written */   FileList *dta;               /* finding files to be edited */   FileList *sas_dta;           /* finding files to be searched */   char *sas_path;              /* path of files being searched */   text_t subst[MAX_COLS];      /* last substitute text */   int  replace_flag;           /* prompt or noprompt b4 replacing */   int  replace_defined;        /* replace defined ? */   int  overlap;                /* overlap between pages for page up etc */   line_list_ptr buff_node;     /* address of node in line_buff */   int  copied;                 /* has line been copied to file? */   text_t line_buff[BUFF_SIZE*2+8]; /* for currently edited line */   text_t tabout_buff[BUFF_SIZE+8]; /* for expanding tabs */   int  line_buff_len;          /* length of line in the line_buff */   int  tabout_buff_len;        /* length of line in the tabout_buff */   int  viewer_key;             /* are viewer keys in effect? (jmh 990430) */   int  command;                /* function of key just entered */   long key_pressed;            /* key pressed by user */   MACRO *key_macro;            /* macro assigned to key */   int  last_command;           /* previous function (jmh 990507) */   int  command_count;          /* consecutive function count (jmh 990507) */   int  wrapped;                /* is the wrapped message on mode line? */   int  stop;                   /* stop indicator */   volatile int control_break;  /* control break pressed? (volatile by jmh) */   int  macro_executing;        /* flag set if macro is executing */   long recording_key;          /* key we are assigning keystrokes to */   int  stroke_count;           /* free keys in stroke buffer */   MACRO *current_macro;        /* macro currently executing */   MACRO *rec_macro;            /* macro currently recording */   int  macro_next;             /* pointer to next key in macro */   MARKER macro_mark;           /* special marker for macros */   MACRO_STACK *mstack;         /* pointer to stacked macros */   int  screen_display;         /* screen display off or on? */   int  input_redir;            /* has stdin been redirected? */   int  output_redir;           /* has stdout been redirected? */   int  cur_line;               /* displaying the current line? */   int  search;                 /* various search flags - jmh 991006 */   const char *errmsg;          /* error message on exit - jmh 010528 */} status_infos;/* * "file_infos" contain all the information unique to a given file */typedef struct s_file_infos {   line_list_ptr line_list;     /* pointer to first node in linked list */   line_list_ptr line_list_end; /* pointer to last node in linked list */   line_list_ptr undo_top;      /* pointer to top node in undo stack */   line_list_ptr undo_bot;      /* pointer to last node in undo stack */   int  undo_lines;             /* number of lines in undo stack */   UNDO *undo;                  /* pointer to first item to undo */   UNDO *redo;                  /* pointer to first item to redo */   UNDO *undo_last;             /* undo to remove when full */   int  undo_count;             /* number of items in undo */   MARKER marker[NO_MARKERS];   /* number of file markers */   long length;                 /* number of lines in file */   int  len_len;                /* character length of above - jmh 991108 */   int  modified;               /* file has been modified since save? */   int  dirty;                  /* file in window modified? */   int  new_file;               /* is current file new? */   int  backed_up;              /* has ".bak" file been created? */   int  crlf;                   /* when read, did lines end CRLF or LF? */   int  binary_len;             /* if BINARY, length of lines (jmh 020724) */   int  read_only;              /* can the file be modified? (jmh 990428) */   int  scratch;                /* don't prompt to save (jmh 030226) */   char file_name[PATH_MAX];    /* name of current file being edited */   char backup_fname[PATH_MAX]; /* name of backup of current file */   char *fname;                 /* the name within file_name (jmh 021021) */   fattr_t file_attrib;         /* file attributes */   ftime_t ftime;               /* file (modified) timestamp */   int  block_type;             /* block type - line or box */   line_list_ptr block_start;   /* beginning block position */   line_list_ptr block_end;     /* ending block position */   int  block_bc;               /* beginning column */   long block_br;               /* beginning row */   int  block_ec;               /* ending column */   long block_er;               /* ending row */   long break_point;            /* line number of break point */   int  ptab_size;              /* physical tab stops */   int  ltab_size;              /* logical tab stops */   int  inflate_tabs;           /* inflate tabs?  T or F or Real */   int  file_no;                /* file number */   int  ref_count;              /* no. of windows referring to file */   int  next_letter;            /* next window letter */   struct s_language *syntax;   /* syntax highlighting information */   struct s_file_infos *next;   /* next file in doubly linked list */   struct s_file_infos *prev;   /* previous file in doubly linked list */} file_infos;/* * structure for languages/files that have syntax highlighting. */typedef struct s_language {   text_ptr *keyword[128];      /* hash table of keywords/identifiers */   TREE     key_tree;           /* pseudo-macros and two-keys */   MENU_STR menu;               /* User > Language pop-out menu */   int    inflate_tabs;         /* language-specific tab settings */   int    ptab_size;   int    ltab_size;   struct s_syntax_info *info;  /* syntax information */   struct s_language *parent;   /* parent language */   struct s_language *next;     /* next language in the list */   char   name[1];              /* the name of the language (must */                                /*  be last! allocated dynamically) */} LANGUAGE;/* * structure for syntax highlighting features. */typedef struct s_syntax_info {   text_t comment[2][5];                /* one line comment */   text_t comstart[2][5];               /* start of multi-line comment */   text_t comend[2][5];                 /* end of multi-line comment */   text_t function;                     /* character for function calls */   text_t strstart;                     /* start of string */   text_t strend;                       /* end of string */   int    strnewl;                      /* can string contain newlines? */   text_t strspan;                      /* character for string line-spanning */   text_t charstart;                    /* start of character */   text_t charend;                      /* end of character */   int    charnewl;                     /* can char. contain newlines? */   text_t charspan;                     /* character for char. line-spanning */   int    charnum;                      /* number of characters allowed */   text_t escape;                       /* escaped character indicator */   text_t binary[3];                    /* binary prefix or suffix */   text_t octal[3];                     /* octal prefix or suffix */   text_t hex[3];                       /* hexadecimal prefix or suffix */   text_t prepro[2];                    /* preprocessor indicator */   text_t prepspan;                     /* character for prep. line-spanning */   int    icase;                        /* ignore case? */   unsigned char identifier[256];       /* identifier flags */} syntax_info;#if defined( __DOS16__ )/* * structure for critical error handler.  check the flag for errors on * each I/O call. * jmh 021103: limited to DOS16 only. */typedef struct {   int  flag;                   /* 0 = no error, -1 = error */   int  code;                   /* error code from di */   int  rw;                     /* read or write operation? */   int  drive;                  /* drive number of error */   int  extended;               /* extended error code, func 0x59 */   int  class;                  /* error class */   int  action;                 /* suggested action from DOS */   int  locus;                  /* locus of error: drive, network, etc... */   int  dattr;                  /* device attribute, 0 = drive, 1 = serial */   char dname[10];              /* device name */} CEH;#define CEH_OK    ceh.flag = OK#define CEH_ERROR (ceh.flag == ERROR)#else#define CEH_OK    (void)0#define CEH_ERROR (0)#endif/* * structure for sort strings */typedef struct {   text_ptr order_array;   text_ptr pivot_ptr;   int  direction;   int  block_len;   int  pivot_len;   int  bc;   int  ec;} SORT;typedef struct {   text_t ignore[256];   text_t match[256];} SORT_ORDER;/* * structure for diff.  let's only diff two windows at a time. */typedef struct {   int       defined;           /* initially FALSE */   int       leading;           /* skip leading spaces t/f */   int       all_space;         /* skip all space t/f */   int       blank_lines;       /* skip blank lines t/f */   int       ignore_eol;        /* skip end of line t/f */   TDE_WIN   *w1;               /* pointer to first diff window */   TDE_WIN   *w2;               /* pointer to second diff window */   line_list_ptr  d1;           /* pointer to text in window 1 */   line_list_ptr  d2;           /* pointer to text in window 2 */   long      rline1;            /* line number in window 1 */   long      rline2;            /* line number in window 2 */   long      bin_offset1;       /* binary offset in window 1 */   long      bin_offset2;       /* binary offset in window 2 */} DIFF;/* * structures for regular expression searches. */typedef struct {   int  pattern_length;                 /* number of chars in pattern */   int  search_defined;                 /* search pattern defined? */   int  node_count;                     /* number of nodes in the nfa */   text_t pattern[MAX_COLS];            /* search pattern */} REGX_INFO;typedef struct {   int  node_type[REGX_SIZE];   int  term_type[REGX_SIZE];   int  c[REGX_SIZE];   char *class[REGX_SIZE];   int  next1[REGX_SIZE];   int  next2[REGX_SIZE];} NFA_TYPE;/* * jmh 030331: a remnant from a previous regx parser? *//*typedef struct parse_tree {   int  node_type;   int  leaf_char;   char *leaf_string;   struct parse_tree *r_pt;   struct parse_tree *l_pt;} PARSE_TREE;*//* * Configuration and syntax highlighting file parsing structure. */typedef struct {   const char * const key;           /* key name */   int  key_index;                   /* key value */} CONFIG_DEFS;/* * History structure (jmh 990424). */typedef struct s_history {   int  len;                    /* length of string */   struct s_history *prev;      /* previous string in history list */   struct s_history *next;      /* next string in history list */   char str[1];                 /* must be last! allocated dynamically */} HISTORY;/* * Dialog structure (jmh 031115). */typedef struct {   int  x, y;                   /* position of item or size of dialog */   char *text;                  /* label or edit field text */   int  n;                      /* checkbox value or edit field width */   HISTORY *hist;               /* history for edit, enabled state of cb */} DIALOG;typedef int (*DLG_PROC)( int, char * );

⌨️ 快捷键说明

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