1 
2 
3 /* This version of microEmacs is based on the public domain C
4  * version written by Dave G. Conroy.
5  * The D programming language version is written by Walter Bright.
6  * http://www.digitalmars.com/d/
7  * This program is in the public domain.
8  */
9 
10 
11 /*
12  * This file is the general header file for all parts of the MicroEMACS
13  * display editor. It contains definitions used by everyone, and it contains
14  * the stuff you have to edit to create a version of the editor for a specific
15  * operating system and terminal.
16  */
17 
18 module ed;
19 
20 alias ubyte attr_t;
21 
22 struct attchar_t
23 {
24     dchar  chr;
25     attr_t attr;
26 }
27 
28 enum
29 {
30     CVMVAS  = 1,                       /* C-V, M-V arg. in screens.    */
31 
32     HUGE    = 1000,                    /* Huge number                  */
33 
34     AGRAVE  = 0x60,                    /* M- prefix,   Grave (LK201)   */
35     METACH  = 0x1B,                    /* M- prefix,   Control-[, ESC  */
36     CTMECH  = 0x1C,                    /* C-M- prefix, Control-\       */
37     EXITCH  = 0x1D,                    /* Exit level,  Control-]       */
38     CTRLCH  = 0x1E,                    /* C- prefix,   Control-^       */
39     HELPCH  = 0x1F,                    /* Help key,    Control-_       */
40 }
41 
42 enum MOUSEKEY = 0x12345678;
43 
44 
45 enum
46 {
47     UPKEY           = 0x4800,          /* Up arrow key                 */
48     DNKEY           = 0x5000,          /* Down arrow key               */
49     RTKEY           = 0x4D00,          /* Right arrow key              */
50     LTKEY           = 0x4B00,          /* Left arrow key               */
51     F1KEY           = 0x3B00,
52     F2KEY           = 0x3C00,
53     F3KEY           = 0x3D00,
54     F4KEY           = 0x3E00,
55     F5KEY           = 0x3F00,
56     F6KEY           = 0x4000,
57     F7KEY           = 0x4100,
58     F8KEY           = 0x4200,
59     F9KEY           = 0x4300,
60     F10KEY          = 0x4400,
61     F11KEY          = 0x5700,
62     F12KEY          = 0x5800,
63     AltF1KEY        = 0x6800,
64     AltF2KEY        = 0x6900,
65     AltF3KEY        = 0x6A00,
66     AltF4KEY        = 0x6B00,
67     AltF5KEY        = 0x6C00,
68     AltF6KEY        = 0x6D00,
69     AltF7KEY        = 0x6E00,
70     AltF8KEY        = 0x6F00,
71     AltF9KEY        = 0x7000,
72     AltF10KEY       = 0x7100,
73     ALTB            = 0x3000,
74     ALTC            = 0x2E00,
75     ALTD            = 0x2000,
76     ALTE            = 0x1200,
77     ALTF            = 0x2100,
78     ALTH            = 0x2300,
79     ALTM            = 0x3200,
80     ALTX            = 0x2D00,
81     ALTZ            = 0x2C00,
82     InsKEY          = 0x5200,
83     CtrlHome        = 0x7700,
84     CtrlEnd         = 0x7500,
85     DelKEY          = 0x5300,
86     CtrlRTKEY       = 0x7400,
87     CtrlLFKEY       = 0x7300,
88     HOMEKEY         = 0x4700,
89     ENDKEY          = 0x4F00,
90     PgUpKEY         = 0x4900,
91     PgDnKEY         = 0x5100,
92 
93     GOLDKEY         = ALTF,
94     MENU_BUTTON     = ALTH,
95 }
96 
97 
98 char CTRL(char c) { return c & 0x1F; }  /* Control flag, or'ed in       */
99 
100 enum
101 {
102     META    = METACH,                  /* Meta flag, or'ed in          */
103     CTLX    = CTRL('X'),               /* ^X flag, or'ed in            */
104     GOLD    = GOLDKEY,                 /* Another Meta flag, or'ed in  */
105 }
106 
107 enum
108 {
109     FALSE   = 0,                       /* False, no, bad, etc.         */
110     TRUE    = 1,                       /* True, yes, good, etc.        */
111     ABORT   = 2,                       /* Death, ^G, abort, etc.       */
112 }
113 
114 enum
115 {
116     CFCPCN  = 0x0001,                  /* Last command was C-P, C-N    */
117     CFKILL  = 0x0002,                  /* Last command was a kill      */
118 }
119 
120 /*
121  * Seperate kbufp[] buffers for cut, word, line and char deletes...
122  */
123 enum
124 {   DCUTBUF,
125     DLINEBUF,
126     DWORDBUF,
127     DCHARBUF,
128     DSPECBUF,      /* maximum number of temp buffers */
129 }
130 
131 /*
132  * State of the syntax highlighting
133  */
134 enum Syntax
135 {
136     normal,
137     keyword,
138     string,
139     comment,
140     singleString,
141     backtickString,
142 }
143 
144 struct SyntaxState
145 {
146     Syntax syntax = Syntax.normal;
147     int nest;		// nest level for nested comments like /+ /+ +/ +/
148 }
149 
150 /********************************
151  * All configuration parameters are stored in this struct.
152  */
153 
154 struct CONFIG
155 {
156     attr_t modeattr;          /* for mode line                */
157     attr_t normattr;          /* for normal text              */
158     attr_t eolattr;           /* for end of line              */
159     attr_t markattr;          /* for selected text            */
160     char tabchar;             /* char to use for tab display  */
161     attr_t urlattr;	      // for URLs
162     attr_t searchattr;	      // for search matches
163 
164     // for syntax highlighting
165     attr_t keyword;
166     attr_t string;
167     attr_t comment;
168 }
169 
170 enum Color : attr_t
171 {
172     // text colors
173     black         = 0,
174     red           = 1,
175     green         = 2,
176     yellow        = red | green,
177     blue          = 4,
178     magenta       = red | blue,		// purple
179     cyan          = green | blue,
180     lightGray     = red | green | blue,
181 
182     darkGray      = bold | black,
183     lightRed      = bold | red,
184     lightGreen    = bold | green,
185     lightBlue     = bold | blue,
186     lightYellow   = bold | yellow,
187     lightMagenta  = bold | magenta,
188     lightCyan     = bold | cyan,
189     white         = bold | lightGray,
190 
191     // background text colors
192     bgBlack       = black     << 4,
193     bgRed         = red       << 4,
194     bgGreen       = green     << 4,
195     bgYellow      = yellow    << 4,
196     bgBlue        = blue      << 4,
197     bgMagenta     = magenta   << 4,
198     bgCyan        = cyan      << 4,
199     bgGray        = lightGray << 4,
200 
201     bgMask        = 0x70,
202 
203     bold          = 8,  // bold only modifies text color by lightening it
204     underline     = 0x80,
205     reverse       = white,
206 }
207 
208 
209 /**************
210  * George M. Jones      {cbosgd,ihnp4}!osu-eddie!george
211  * Work Phone:          george@ohio-state.csnet
212  * (614) 457-8600       CompuServe: 70003,2443
213  */
214