struct.h

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C头文件 代码 · 共 614 行 · 第 1/2 页

H
614
字号
} command_rtn;

typedef struct {
    char        type:3;                 // type of event (list in const.h)
    char        keep_selection:1;       // keep selection after this event?
    char        is_number:1;            // is event a digit? (repeat count)
    char        fix_range:1;            // see comment in doMove (editmain.c)
    char        is_op_alias:1;          // event is an aliased operator
    char        keep_selection_maybe:1; // keep selection if already selecting
    char        modifies:1;             // does this event modify the file?
    char        spare:7;
} event_bits;

typedef struct {
    command_rtn alt_rtn;
    insert_rtn  ins;
    command_rtn rtn;
    event_bits  b;
    event_bits  alt_b;
} event;

/* used to cast a base event (as in keys.h) to a char */
#define EVENT_CHAR( e ) ( (char)e )

/*
 * structure to define all the goop needed to display text
 */
typedef struct {
    short       foreground;
    short       background;
    short       font;
} type_style;

/*
 * window init info
 */
typedef struct {
    bool        has_border;
    short       border_color1,border_color2;
    type_style  text;
    type_style  hilight;
    short       x1,y1,x2,y2;
} window_info;

/*
 * undo info
 */
typedef struct {
    linenum     start,end;
} undo_insert;

typedef struct {
    fcb *fcb_head,*fcb_tail;
} undo_delete;

typedef struct {
    linenum     line,top;
    short       col,depth;
    long        time_stamp;
} undo_start;

typedef union {
   undo_start   sdata;
   undo_insert  del_range;
   undo_delete  fcbs;
} undo_data;

typedef struct undo {
    struct undo *next;
    char        type;
    undo_data   data;
} undo;
#define UNDO_SIZE sizeof( undo )

typedef struct undo_stack {
    int         current;                // current depth of undo stack
    int         OpenUndo;               // number of "StartUndoGroups" open
                                        // on stack
    undo        **stack;                // stack data
    bool        rolled;                 // stack has been rolled (i.e., data
                                        // has rolled off the end)
} undo_stack;

typedef struct select_rgn {
    vi_ushort   selected:1;
    vi_ushort   lines:1;
    vi_ushort   dragging:1;
    vi_ushort   empty:13;
    linenum     start_line;
    linenum     end_line;
    int         start_col;
    int         end_col;
    int         start_col_v;
} select_rgn;

/*
 * all info for a file being edited
 */
typedef struct info {
    struct info *next,*prev;
    file        *CurrentFile;
    linenum     CurrentLineNumber,TopOfPage;
    int         CurrentColumn,LeftColumn;
    undo_stack  *UndoStack, *UndoUndoStack;
    int         CurrentUndoItem,CurrentUndoUndoItem;
    window_id   CurrNumWindow;
    mark        *MarkList;
    bool        linenumflag;
    window_id   CurrentWindow;
    int         ColumnDesired;
    bool        CMode;
    bool        WriteCRLF;
    select_rgn  SelRgn;
    bool        IsColumnRegion;
    vi_ushort   DuplicateID;
    void        *dc;
    int         dc_size;
    int         Language;
    bool     RealTabs;
    bool     ReadEntireFile;
    bool     ReadOnlyCheck;
    bool     EightBits;
    int      TabAmount;
    int      HardTab;
    int      ShiftWidth;
    int      AutoIndent;
#ifdef __WIN__
    long        VScrollBarScale;
    int         HScrollBarScale;
#endif
} info;
#define INFO_SIZE sizeof( info )

/*
 * save buffer (for yanking/moving text)
 */
typedef struct savebuf {
    char        type;
    union {
        char    *data;
        fcb     *fcb_head;
    } first;
    fcb         *fcb_tail;
} savebuf;
#define SAVEBUF_SIZE sizeof( savebuf )

/*
 * color settings
 */
typedef struct {
    char        red,green,blue;
} rgb;

/*
 * SelectItem data
 */
typedef struct {
    window_info *wi;            // info describing window to create
    char        *title;         // title of window
    char        **list;         // lines to display
    int         maxlist;        // number of lines in list
    char        *result;        // where to copy the data for the picked line
    int         num;            // number of the picked line
    int         *allowrl;       // allow cursor right/left (for menu bar)
    char        **hilite;       // chars to highlight
    int         *retevents;     // events that simulate pressing enter
    int         event;          // event that caused a return
    bool        show_lineno;    // show lines in top-right corner
    linenum     cln;            // current line to display
    window_id   eiw;            // alternate window to accept events in (like
                                // the options window after fgrep...)
    bool        is_menu:1;      // is a menu we are showing
    bool        spare:7;
} selectitem;

/*
 * SelectLineInFile data structure
 */
typedef struct {
    file        *f;             // file with data for lines
    char        **vals;         // values associated with each line
    int         valoff;         // offset to display values beside line data
    window_info *wi;            // info describing window to create
    linenum     sl;             // selected line
    char        *title;         // title of window
    int         (*checkres)(char *, char *, int * ); // check if selected
                                // change is valid
    int         *allow_rl;      // allow cursor right/left (for menu bar)
    char        **hilite;       // chars to highlight
    bool        show_lineno;    // show lines in top-right corner
    int         *retevents;     // events that simulate pressing enter
    int         event;          // event that caused a return
    linenum     cln;            // current line to display
    window_id   eiw;            // alternate window to accept events in (like
                                // the options window after fgrep...)
    bool        is_menu:1;      // select list is a menu
    bool        has_scroll_gadgets:1; // list has scroll gadgets
    bool        spare:6;
} selflinedata;

/*
 * special file (used to process bound data)
 */
typedef struct {
    int length;
    int maxlines,currline;
} gfa;

typedef struct {
    struct line *cline;
    struct fcb  *cfcb;
} gfb;
typedef struct {
    union {
        FILE            *f;
        int             handle;
        char            *pos;
        struct file     *cfile;
    } data;
    union {
        gfa             a;
        gfb             b;
    } gf;
    gftype type;
} GENERIC_FILE;

typedef struct {
/*
 * set booleans are here
 */
    #define PICK( a,b,c,d,e ) bool c;
    #include "setb.h"

/*
 * internal booleans are here
 */
    bool DisplayHold;
    bool Starting;
    bool DotMode;
    bool Dotable;
    bool KeyMapMode;
    bool ClockActive;
    bool KeyOverride;
    bool ViewOnly;
    bool NewFile;
    bool SourceScriptActive;
    bool InputKeyMapMode;
    bool LineWrap;
    bool Monocolor;
    bool BlackAndWhite;
    bool Color;
    bool KeyMapInProgress;
    bool ResetDisplayLine;
    bool GlobalInProgress;
    bool ExtendedKeyboard;
    bool BreakPressed;
    bool AllowRegSubNewline;
    bool BoundData;
    bool SpinningOurWheels;
    bool ReadOnlyError;
    bool WindowsStarted;
    bool CompileScript;
    bool ScriptIsCompiled;
    bool CompileAssignments;
    bool OpeningFileToCompile;
    bool InsertModeActive;
    bool WatchForBreak;
    bool EchoOn;
    bool LoadResidentScript;
    bool CompileAssignmentsDammit;
    bool ExMode;
    bool Appending;
    bool LineDisplay;
    bool NoSetCursor;
    bool NoInputWindow;
    bool ResizeableWindow;
    bool BndMemoryLocked;
    bool MemorizeMode;
    bool DuplicateFile;
    bool NoReplaceSearchString;
    bool LastSearchWasForward;
    bool UndoLost;
    bool NoAddToDotBuffer;
    bool Dragging;
    bool NoCapsLock;
    bool RecoverLostFiles;
    bool IgnoreLostFiles;
    bool UseIDE;
    bool HasSystemMouse;
    bool UndoInProg;
    bool StdIOMode;
    bool NoInitialFileLoad;
    bool WasOverstrike;
    bool ReturnToInsertMode;
    bool AltMemorizeMode;
    bool AltDotMode;
    bool EscapedInsertChar;
    bool HoldEverything;
    bool IsWindowedConsole;
    bool ModeInStatusLine;
    bool IsChangeWord;
    bool OperatorWantsMove;
    bool ScrollCommand;
    bool FileTypeSource;
} eflags;               // don't forget to give default in globals.c
#endif

⌨️ 快捷键说明

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