Annotation of researchv9/cmd/emacs/emacs_main.h, revision 1.1.1.1

1.1       root        1: /* declarations for emacs editor */
                      2: /* EMACS_MODES: c !fill */
                      3: 
                      4: /* interpreter definitions */
                      5: 
                      6: /* There are 3 arrays that take part in the implementation of the
                      7:  * emacs command interpreter.  The "runit" array is a list of
                      8:  * pointers to C functions that implement emacs commands.  It is
                      9:  * ordered arbitrarily, not related to the command sequence.  The
                     10:  * "doit" array is an array of NCHARS byte codes.  Each byte code
                     11:  * specifies the function bound to the corresponding byte code
                     12:  * either as an internal interpreter function (codes < NIFUNC) or as
                     13:  * one of the functions in the runit array.  The codes in this
                     14:  * array are fixed, and implement the base level command bindings
                     15:  * for emacs.  The codes in this array are also used to locate the
                     16:  * help messages.  Each code maps to a corresponding help message. */
                     17: 
                     18: /* The third array is what allows the user to re-bind key
                     19:  * definitions and bind keys to macros.  It is the "map_it" array. 
                     20:  * This is initialized to the same as doit.  Each entry of this
                     21:  * array can either be a built in command (C function or interpreter
                     22:  * command), if less than NCHARS, or a macro pointer, if > NCHARS. */
                     23: 
                     24: /* dispatch table */
                     25: 
                     26:        extern upl();
                     27:        extern downl();
                     28:        extern gquit();
                     29:        extern qrep();
                     30:        extern eabort();
                     31:        extern mfwrd();
                     32:        extern kfwrd();
                     33:        extern mbwrd();
                     34:        extern kbwrd();
                     35:        extern top();
                     36:        extern bot();
                     37:        extern insertc();
                     38:        extern tabc();
                     39:        extern rquote();
                     40:        extern mquote();
                     41:        extern refresh();
                     42:        extern beep();
                     43:        extern fisrch();
                     44:        extern risrch();
                     45:        extern begin();
                     46:        extern endl();
                     47:        extern openl();
                     48:        extern nl();
                     49:        extern fdel();
                     50:        extern bdel();
                     51:        extern fred();
                     52:        extern fright();
                     53:        extern ekill();
                     54:        extern mark();
                     55:        extern nxtpage();
                     56:        extern lstpage();
                     57:        extern mkill();
                     58:        extern yank();
                     59:        extern reyank();
                     60:        extern bux();
                     61:        extern ux();
                     62:        extern forw();
                     63:        extern back();
                     64:        extern capnxt();
                     65:        extern lownxt();
                     66:        extern capwrd();
                     67:        extern afsep();
                     68:        extern xpose();
                     69:        extern mapch();
                     70:        extern help();
                     71:        extern ttype();
                     72:        extern undo();
                     73:        extern pickup();
                     74:        extern absgoto();
                     75:        extern go_xy();
                     76:        extern cment();
                     77:        extern cbrak();
                     78:        extern modisp();
                     79:        extern ssent();
                     80:        extern esent();
                     81:        extern stats();
                     82:        extern uline();
                     83:        extern mailit();
                     84:        extern toppage();
                     85:        extern rsrch();
                     86:        extern rqrep();
                     87:        extern numchar();
                     88:        extern wallc();
                     89:        extern filler();
                     90:        extern litchr();
                     91:        extern macex();
                     92:        extern unmod();
                     93:        extern mbegin();
                     94:        extern setvar();
                     95:        extern envget();
                     96:        extern stopjob();
                     97: #ifdef PC
                     98:        extern ctfile();
                     99:        extern mapk();
                    100: #else
                    101: #define ctfile beep
                    102: #define mapk beep
                    103: #endif
                    104: 
                    105: /* control -x commands */
                    106: 
                    107: extern fright();
                    108: extern fred();
                    109: extern fsave();
                    110: extern exch();
                    111: extern gquit();
                    112: extern quit();
                    113: extern chmode();
                    114: extern cwd();
                    115: extern edbuf();
                    116: extern cpbuf();
                    117: extern rmbuf();
                    118: extern twind();
                    119: extern onewind();
                    120: extern owind();
                    121: extern inpsh();
                    122: extern bfsend();
                    123: extern buflng();
                    124: extern macro();
                    125: extern bfchr();
                    126: extern compar();
                    127: extern cond();
                    128: extern mcase();
                    129: extern iter();
                    130: extern recurse();
                    131: extern pbfname();
                    132: extern pfnname();
                    133: extern gparam();
                    134: extern gkarm();
                    135: extern glob();
                    136: extern kdup();
                    137: extern kflush();
                    138: extern kexch();
                    139: extern ldmac();
                    140: extern cmpst();
                    141: extern wgrow();
                    142: extern didle();
                    143: extern kapp();
                    144: extern rnbuf();
                    145: extern pvname();
                    146: extern xqt();
                    147: extern getsharg();
                    148: extern strtkbd();
                    149: extern endkbd();
                    150: extern exkbd();
                    151: extern setkey();
                    152: extern trce();
                    153: extern brkproc();
                    154: #ifdef COMPRESS
                    155: extern loadtbl();
                    156: #else
                    157: #define loadtbl beep
                    158: #endif
                    159: 
                    160: #ifdef DIRED
                    161: extern dcdel();
                    162: extern ddel();
                    163: extern dundel();
                    164: extern dview();
                    165: #define DCDEL dcdel
                    166: #define DDEL ddel
                    167: #define DUNDEL dundel
                    168: #define DVIEW dview
                    169: #else
                    170: #define DCDEL beep
                    171: #define DDEL beep
                    172: #define DUNDEL beep
                    173: #define DVIEW beep
                    174: #endif
                    175: 
                    176: 
                    177: 
                    178: 
                    179: /* The run-it table */
                    180: 
                    181: 
                    182: 
                    183: int (*runit[]) () = {
                    184: /* 9 */        insertc,begin,  back,   capnxt, fdel,   endl,   forw,   beep,
                    185: /*17 */        tabc,   afsep,  nl,     ekill,  refresh,downl,  openl,  upl,
                    186: /*25 */        rquote, risrch, fisrch, xpose,  nxtpage,mkill,  yank,   mbwrd,
                    187: /*33 */        capwrd, kfwrd,  mfwrd,  qrep,   lstpage,eabort, kbwrd,  top,
                    188: /*41 */        bot,    gquit,  fred,   fsave,  fright, exch,   mark,   help,
                    189: /*49 */        ux,     bdel,   reyank, ttype,  bfsend, absgoto,cment,  modisp,
                    190: /*57 */        chmode, ssent,  esent,  cpbuf,  edbuf,  rmbuf,  onewind,owind,
                    191: /*65 */        twind,uline,    bux,    cwd,    inpsh,  mailit, toppage,rsrch,
                    192: /*73 */        rqrep,  mquote, numchar,pickup, wallc,  stats,  cbrak,  DDEL,
                    193: /*81 */        DCDEL,  DUNDEL, DVIEW,  filler, macro,  compar, cond,   litchr,
                    194: /*89 */        iter,   gparam, mbegin, pbfname,pfnname,recurse,kdup,   kflush,
                    195: /*97 */        kexch,  ldmac,  macex,  cmpst,  wgrow,  didle,  mcase,  unmod,
                    196: /*105*/        bfchr,  mapch,  setvar, kapp,   rnbuf,  buflng, pvname, xqt,
                    197: /*113*/        getsharg,gkarm, envget, strtkbd,endkbd, exkbd,  go_xy,  lownxt,
                    198: /*121*/        trce,   setkey, glob,   undo,   stopjob,brkproc,ctfile, mapk,
                    199: /*129*/        loadtbl,
                    200: };
                    201: 
                    202: 
                    203: /* Global interpreter bindings */
                    204: 
                    205: unsigned char doit[NCHARS] = {
                    206:        
                    207:        47,     10,     11,     12,     13,     14,     15,     16,
                    208:        50,     17,     19,     20,     21,     19,     22,     23,
                    209:        24,     25,     26,     27,     28,     CCTLU,  29,     30,
                    210:        CCTLX,  31,     CEXIT,  CMETA,  0,      CMARG,  CLRES,  0,
                    211:        18,     9,      9,      9,      9,      9,      9,      9,
                    212:        9,      9,      9,      9,      9,      CMNUS,  18,     9,
                    213:        CNUMB,  CNUMB,  CNUMB,  CNUMB,  CNUMB,  CNUMB,  CNUMB,  CNUMB,
                    214:        CNUMB,  CNUMB,  9,      9,      9,      9,      9,      9,
                    215: 
                    216:        9,      9,      9,      9,      9,      9,      9,      9,
                    217:        9,      9,      9,      9,      9,      9,      9,      9,
                    218:        9,      9,      9,      9,      9,      9,      9,      9,
                    219:        9,      9,      9,      9,      9,      9,      9,      9,
                    220:        9,      9,      9,      9,      9,      9,      9,      9,
                    221:        9,      9,      9,      9,      9,      9,      9,      9,
                    222:        9,      9,      9,      9,      9,      9,      9,      9,
                    223:        9,      9,      9,      9,      9,      79,     9,      50,
                    224:        
                    225: /* META characters */
                    226:        
                    227:        0,      0,      0,      0,      0,      0,      0,      0,
                    228:        39,     0,      0,      0,      71,     70,     0,      0,
                    229:        0,      88,     73,     72,     0,      0,      0,      0,
                    230:        112,    0,      125,    0,      0,      107,    0,      0,
                    231:        47,     49,     84,     0,      67,     0,      0,      0,
                    232:        0,      0,      0,      0,      0,      CMNUS,  0,      55,
                    233:        CNUMB,  CNUMB,  CNUMB,  CNUMB,  CNUMB,  CNUMB,  CNUMB,  CNUMB,
                    234:        CNUMB,  CNUMB,  106,    0,      40,     0,      41,     48,
                    235:        
                    236:        0,      0,      0,      0,      0,      115,    0,      0,
                    237:        0,      0,      0,      0,      0,      0,      0,      0,
                    238:        0,      0,      0,      0,      0,      0,      0,      0,
                    239:        0,      0,      0,      0,      75,     0,      0,      66,
                    240:        0,      58,     32,     33,     34,     59,     35,     54,
                    241:        0,      0,      0,      0,      120,    56,     0,      0,
                    242: #ifdef PC
                    243:        76,     74,     36,     78,     127,    124,    37,     77,
                    244: #else
                    245:        76,     74,     36,     78,     52,     124,    37,     77,
                    246: #endif
                    247:        99,     51,     38,     91,     0,      CEXIT,  104,    39,
                    248:        
                    249: /* Control - X characters */
                    250:        
                    251:        0,      113,    60,     42,     68,     94,     61,     126,
                    252:        0,      69,     0,      62,     98,     57,     109,    64,
                    253:        0,      105,    43,     44,     53,     102,    111,    45,
                    254:        46,     0,      0,      0,      0,      0,      101,    0,
                    255:        0,      103,    0,      123,    0,      97,     100,    0,
                    256:        116,    117,    0,      108,    0,      96,     0,      0,
                    257:        0,      63,     65,     0,      0,      0,      0,      0,
                    258: #ifdef PC
                    259:        0,      0,      128,    0,      90,     110,    95,     0,
                    260: #else
                    261:        0,      0,      0,      0,      90,     110,    95,     0,
                    262: #endif
                    263: 
                    264:        114,    0,      92,     0,      0,      118,    93,     0,
                    265:        0,      0,      0,      0,      129,    0,      0,      0,
                    266:        0,      0,      0,      0,      121,    0,      0,      0,
                    267:        0,      0,      0,      0,      0,      0,      89,     0,
                    268:        0,      0,      0,      0,      85,     0,      0,      119,
                    269:        0,      0,      0,      122,    0,      57,     0,      0,
                    270:        0,      0,      0,      0,      0,      0,      0,      0,      
                    271:        0,      0,      0,      0,      87,     0,      86,     0,
                    272: };
                    273: 
                    274: /* character help explanations */
                    275: 
                    276: /* note -- the text of the help instructions is kept in helpstrings
                    277:  * and helpfile in uncompiled and compiled format.  make_help is the
                    278:  * compiler for the helpstrings file. */
                    279: 
                    280: #define HINSERT 9              /* index of self inserting chars */
                    281: 
                    282: extern char hdate[];
                    283: int helfile = 0;
                    284: #define HELSIZE 128
                    285: 
                    286: /* ****** NOTE -- it is no longer necessary to change the pathnames. */
                    287: /* EMACS will put its error messages, help messages, and statistics in */
                    288: /* the directory where the sources are if you don't modify these definitions */
                    289: 
                    290: 
                    291: #ifdef PC
                    292: #define SDIR ""
                    293: #endif
                    294: char *emd_source = SDIR;
                    295: 
                    296: 
                    297: #ifdef CMON
                    298: 
                    299: int cmcnt[NCHARS] = {0};               /* command counters */
                    300: #endif
                    301: 
                    302: #ifdef DIRED
                    303: char dired_args[16] = {'-','a','l',0,0,0,0,0,0,0,0,0,0,0,0,0};
                    304: #endif
                    305:        long oclock = 0;
                    306: 
                    307: int numarg;                            /* numeric argument flag */
                    308: int etrace;                            /* Trace flag */
                    309: 
                    310: char *myname;
                    311: extern char version[];
                    312: 
                    313: char **sharg;                          /* shell argument list */
                    314: int nsharg;                            /* argument counter */
                    315: char *svname;                          /* saved myname for long return */
                    316: #ifdef PC
                    317: int retjmp[3];                         /* */
                    318: #else
                    319: jmp_buf retjmp;                                /* return environment for break */
                    320: extern char *ctime();
                    321: #endif
                    322: 
                    323: extern char *getenv();
                    324: extern int junked;
                    325: extern int timemd;
                    326: extern char *fname();
                    327: extern char casem[];
                    328: extern eabort();
                    329: extern crash();
                    330: extern char *mstrcpy();
                    331: extern char *nscan();
                    332: extern int NSCHAR;
                    333: extern int SAVEMD;
                    334: extern int SAVECHAR;
                    335: extern int VERBOSE;
                    336: extern int BUFEND;
                    337: extern int TABMD;
                    338: extern char *endput;
                    339: extern int curbf;
                    340: extern int READONLY;
                    341: #ifdef DIRED
                    342: #define diron dirbuf[curbf]
                    343: extern char dirbuf[];
                    344: extern dclean();
                    345: extern ddel();
                    346: extern dundel();
                    347: extern dview();
                    348: #endif
                    349: #ifdef CRYPTO
                    350: extern long bufkey;
                    351: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.