home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume8 / jove / part03 / funcdefs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-02-02  |  15.6 KB  |  588 lines

  1. /************************************************************************
  2.  * This program is Copyright (C) 1986 by Jonathan Payne.  JOVE is       *
  3.  * provided to you without charge, and with no warranty.  You may give  *
  4.  * away copies of JOVE, including sources, provided that this notice is *
  5.  * included in all the files.                                           *
  6.  ************************************************************************/
  7.  
  8. #include "jove.h"
  9.  
  10. #ifndef TXT_TO_C
  11. extern int
  12.     EscPrefix(),
  13.     CtlxPrefix(),
  14.     MiscPrefix(),
  15.     UnbindC(),
  16.     ShowVersion(),
  17.     WVisSpace(),
  18. #ifdef ANSICODES
  19.     AnsiCodes(),
  20. #endif
  21.     AppReg(),
  22.     Apropos(),
  23.     BackChar(),
  24.     BList(),
  25.     FList(),
  26.     BUpList(),
  27.     FDownList(),
  28.     BSexpr(),
  29.     BackWord(),
  30.     Bof(),
  31.     Bol(),
  32.     Bos(),
  33.     Bow(),
  34.     BindAKey(),
  35.     BindMac(),
  36.     BufPos(),
  37.     CasRegLower(),
  38.     CasRegUpper(),
  39.     CapChar(),
  40.     CapWord(),
  41.     LowWord(),
  42.     UppWord(),
  43. #ifdef CHDIR
  44.     Chdir(),
  45.     prCWD(),
  46.     prDIRS(),
  47.     Pushd(),
  48.     Popd(),
  49. #endif
  50.     prCTIME(),
  51.     ChrToOct(),
  52.     ClAndRedraw(),
  53.     MakeErrors(),
  54.     CopyRegion(),
  55.     BufSelect(),
  56.     DelBlnkLines(),
  57.     DelNChar(),
  58.     DelNWord(),
  59.     OneWindow(),
  60.     DelPChar(),
  61.     DelPWord(),
  62.     DelReg(),
  63.     KillSome(),
  64.     DelWtSpace(),
  65.     DelCurWindow(),
  66.     KeyDesc(),
  67.     Digit(),
  68.     Digit0(),
  69.     Digit1(),
  70.     Digit2(),
  71.     Digit3(),
  72.     Digit4(),
  73.     Digit5(),
  74.     Digit6(),
  75.     Digit7(),
  76.     Digit8(),
  77.     Digit9(),
  78.     DescBindings(),
  79.     DescCom(),
  80.     Eof(),
  81.     Eol(),
  82.     Eos(),
  83.     Eow(),
  84.     ForPara(),
  85.     BackPara(),
  86.     BufErase(),
  87.     PtToMark(),
  88.     Extend(),
  89.     ExecMacro(),
  90.     RunMacro(),
  91.     Leave(),
  92.     FindFile(),
  93.     WindFind(),
  94.     FindTag(),
  95.     FDotTag(),
  96.     ToIndent(),
  97.     ForChar(),
  98.     FSexpr(),
  99.     ForWord(),
  100.     FourTime(),
  101.     GoLine(),
  102.     GrowWindow(),
  103.     IncFSearch(),
  104.     IncRSearch(),
  105.     InsFile(),
  106.     Justify(),
  107.     RegJustify(),
  108.     SetLMargin(),
  109.     SetRMargin(),
  110.     BufKill(),
  111.     KillBos(),
  112.     KillEos(),
  113.     KillEOL(),
  114.     KillExpr(),
  115.     BufList(),
  116.     NotModified(),
  117.     NameMac(),
  118.     DelMacro(),
  119.     Newline(),
  120.     OpenLine(),
  121.     LineAI(),
  122.     ShowErr(),
  123.     NextError(),
  124.     PrevError(),
  125.     NextLine(),
  126.     NextPage(),
  127.     NextWindow(),
  128.     Recur(),
  129.     PopMark(),
  130.     PageNWind(),
  131.     Tab(),
  132.     DoParen(),
  133.     ParseAll(),
  134.     XParse(),
  135. #ifdef SPELL
  136.     SpelWords(),
  137. #endif
  138. #ifdef JOB_CONTROL
  139.     PauseJove(),
  140. #endif
  141.     PrevLine(),
  142.     PrevPage(),
  143.     PrevWindow(),
  144.     Push(),
  145.     RegReplace(),
  146.     QRepSearch(),
  147.     QuotChar(),
  148.     ReadFile(),
  149.     ReadMacs(),
  150.     RedrawDisplay(),
  151.     ReNamBuf(),
  152.     RepSearch(),
  153.     DownScroll(),
  154.     UpScroll(),
  155.     ForSearch(),
  156.     FSrchND(),
  157.     RevSearch(),
  158.     RSrchND(),
  159.     SelfInsert(),
  160.     SetVar(),
  161.      SetMark(),
  162.     ShellCom(),
  163.     ShToBuf(),
  164.     ShrWindow(),
  165.     Source(),
  166. #ifdef SPELL
  167.     SpelBuffer(),
  168. #endif
  169.     SplitWind(),
  170.     Remember(),
  171.     Forget(),
  172.     StrLength(),
  173.     TransChar(),
  174.     TransLines(),
  175.     SaveFile(),
  176.     WtModBuf(),
  177.     WriteFile(),
  178.     WriteMacs(),
  179.     WrtReg(),
  180.     Yank(),
  181.     YankPop(),
  182.     PrVar(),
  183.     FilterRegion(),
  184.     WNumLines(),
  185.  
  186. #ifdef IPROCS
  187.     ShellProc(),
  188.     ProcInt(),
  189.     ProcQuit(),
  190.     ProcKill(),
  191. #  ifndef PIPEPROCS
  192.     ProcEof(),
  193.     ProcStop(),
  194.     ProcCont(),
  195.     ProcDStop(),
  196. #  endif
  197.     ProcSendData(),
  198.     ProcNewline(),
  199.     ProcList(),
  200.     ProcBind(),
  201.     Iprocess(),
  202. #endif
  203.  
  204. #ifdef LISP
  205.     GSexpr(),    /* Grind S Expression. */
  206.     AddSpecial(),    /* add lisp special form */
  207. #endif
  208.     CAutoExec(),
  209.     MAutoExec(),
  210.  
  211.     DefMAbbrev(),
  212.     DefGAbbrev(),
  213.     SaveAbbrevs(),
  214.     RestAbbrevs(),
  215.     EditAbbrevs(),
  216.     BindMtoW(),
  217.  
  218. #ifdef CMT_FMT
  219.     Comment(),
  220. #endif
  221.  
  222.     MacInter();        /* This is the last one. */
  223.  
  224.  
  225. #    define WIRED_CMD(c)    c
  226.  
  227. #else TXT_TO_C
  228.  
  229. #    define WIRED_CMD(c)    0
  230.  
  231. #endif TXT_TO_C
  232.  
  233. struct cmd    commands[] = {
  234. #ifdef LISP
  235.     FUNCTION, "add-lisp-special", WIRED_CMD(AddSpecial),
  236. #endif
  237. #ifdef ANSICODES
  238.     FUNCTION, "ansi-codes", WIRED_CMD(AnsiCodes),
  239. #endif
  240.     FUNCTION, "append-region", WIRED_CMD(AppReg),
  241.     FUNCTION, "apropos", WIRED_CMD(Apropos),
  242.     FUNCTION, "auto-execute-command", WIRED_CMD(CAutoExec),
  243.     FUNCTION, "auto-execute-macro", WIRED_CMD(MAutoExec),
  244.     DefMinor(Fill), "auto-fill-mode", 0,
  245.     DefMinor(Indent), "auto-indent-mode", 0,
  246.     FUNCTION, "backward-character", WIRED_CMD(BackChar),
  247.     FUNCTION, "backward-list", WIRED_CMD(BList),
  248.     FUNCTION, "backward-paragraph", WIRED_CMD(BackPara),
  249.     FUNCTION, "backward-s-expression", WIRED_CMD(BSexpr),
  250.     FUNCTION, "backward-sentence", WIRED_CMD(Bos),
  251.     FUNCTION, "backward-up-list", WIRED_CMD(BUpList),
  252.     FUNCTION, "backward-word", WIRED_CMD(BackWord),
  253.     FUNCTION, "beginning-of-file", WIRED_CMD(Bof),
  254.     FUNCTION, "beginning-of-line", WIRED_CMD(Bol),
  255.     FUNCTION, "beginning-of-window", WIRED_CMD(Bow),
  256.     FUNCTION, "bind-to-key", WIRED_CMD(BindAKey),
  257.     FUNCTION, "bind-macro-to-key", WIRED_CMD(BindMac),
  258. #ifdef ABBREV
  259.     FUNCTION, "bind-macro-to-word-abbrev", WIRED_CMD(BindMtoW),
  260. #endif
  261.     FUNCTION, "buffer-position", WIRED_CMD(BufPos),
  262.     DefMajor(CMODE), "c-mode", 0,
  263.     FUNCTION, "case-character-capitalize", WIRED_CMD(CapChar),
  264.     FUNCTION, "case-region-lower", WIRED_CMD(CasRegLower),
  265.     FUNCTION, "case-region-upper", WIRED_CMD(CasRegUpper),
  266.     FUNCTION, "case-word-capitalize", WIRED_CMD(CapWord),
  267.     FUNCTION, "case-word-lower", WIRED_CMD(LowWord),
  268.     FUNCTION, "case-word-upper", WIRED_CMD(UppWord),
  269.     FUNCTION, "character-to-octal-insert", WIRED_CMD(ChrToOct),
  270. #ifdef CHDIR
  271.     FUNCTION, "cd", WIRED_CMD(Chdir),
  272. #endif
  273.     FUNCTION, "clear-and-redraw", WIRED_CMD(ClAndRedraw),
  274.     FUNCTION, "compile-it", WIRED_CMD(MakeErrors),
  275. #ifdef IPROCS
  276. #  ifndef PIPEPROCS
  277. #    ifdef TIOCSLTC
  278.     FUNCTION, "continue-process", WIRED_CMD(ProcCont),
  279. #    endif
  280. #  endif
  281. #endif
  282.     FUNCTION, "copy-region", WIRED_CMD(CopyRegion),
  283.     FUNCTION, "current-error", WIRED_CMD(ShowErr),
  284.     FUNCTION, "date", WIRED_CMD(prCTIME),
  285. #ifdef ABBREV
  286.     FUNCTION, "define-mode-word-abbrev", WIRED_CMD(DefMAbbrev),
  287.     FUNCTION, "define-global-word-abbrev", WIRED_CMD(DefGAbbrev),
  288. #endif
  289.     FUNCTION, "delete-blank-lines", WIRED_CMD(DelBlnkLines),
  290.     FUNCTION, "delete-buffer", WIRED_CMD(BufKill),
  291.     FUNCTION, "delete-macro", WIRED_CMD(DelMacro),
  292.     FUNCTION, "delete-next-character", WIRED_CMD(DelNChar),
  293.     FUNCTION, "delete-other-windows", WIRED_CMD(OneWindow),
  294.     FUNCTION, "delete-previous-character", WIRED_CMD(DelPChar),
  295.     FUNCTION, "delete-white-space", WIRED_CMD(DelWtSpace),
  296.     FUNCTION, "delete-current-window", WIRED_CMD(DelCurWindow),
  297.     FUNCTION, "describe-bindings", WIRED_CMD(DescBindings),
  298.     FUNCTION, "describe-command", WIRED_CMD(DescCom),
  299.     FUNCTION, "describe-key", WIRED_CMD(KeyDesc),
  300.     FUNCTION, "describe-variable", WIRED_CMD(DescCom),
  301.     FUNCTION, "digit", WIRED_CMD(Digit),
  302.     FUNCTION, "digit-1", WIRED_CMD(Digit1),
  303.     FUNCTION, "digit-2", WIRED_CMD(Digit2),
  304.     FUNCTION, "digit-3", WIRED_CMD(Digit3),
  305.     FUNCTION, "digit-4", WIRED_CMD(Digit4),
  306.     FUNCTION, "digit-5", WIRED_CMD(Digit5),
  307.     FUNCTION, "digit-6", WIRED_CMD(Digit6),
  308.     FUNCTION, "digit-7", WIRED_CMD(Digit7),
  309.     FUNCTION, "digit-8", WIRED_CMD(Digit8),
  310.     FUNCTION, "digit-9", WIRED_CMD(Digit9),
  311.     FUNCTION, "digit-0", WIRED_CMD(Digit0),
  312. #ifdef CHDIR
  313.     FUNCTION, "dirs", WIRED_CMD(prDIRS),
  314. #endif
  315.     FUNCTION, "down-list", WIRED_CMD(FDownList),
  316. #ifdef IPROCS
  317. #  ifndef PIPEPROCS
  318. #    ifdef TIOCSLTC
  319.     FUNCTION, "dstop-process", WIRED_CMD(ProcDStop),
  320. #    endif
  321. #  endif
  322. #endif
  323. #ifdef ABBREV
  324.     FUNCTION, "edit-word-abbrevs", WIRED_CMD(EditAbbrevs),
  325. #endif
  326.     FUNCTION, "end-of-file", WIRED_CMD(Eof),
  327.     FUNCTION, "end-of-line", WIRED_CMD(Eol),
  328.     FUNCTION, "end-of-window", WIRED_CMD(Eow),
  329. #ifdef IPROCS
  330. #  ifndef PIPEPROCS
  331.     FUNCTION, "eof-process", WIRED_CMD(ProcEof),
  332. #  endif
  333. #endif
  334.     FUNCTION, "erase-buffer", WIRED_CMD(BufErase),
  335.     FUNCTION, "exchange-point-and-mark", WIRED_CMD(PtToMark),
  336.     FUNCTION, "execute-named-command", WIRED_CMD(Extend),
  337.     FUNCTION, "execute-keyboard-macro", WIRED_CMD(ExecMacro),
  338.     FUNCTION, "execute-macro", WIRED_CMD(RunMacro),
  339.     FUNCTION, "exit-jove", WIRED_CMD(Leave),
  340. #ifdef CMT_FMT
  341.      FUNCTION, "fill-comment", WIRED_CMD(Comment),
  342. #endif CMT_FMT
  343.     FUNCTION, "fill-paragraph", WIRED_CMD(Justify),
  344.     FUNCTION, "fill-region", WIRED_CMD(RegJustify),
  345.     FUNCTION, "filter-region", WIRED_CMD(FilterRegion),
  346.     FUNCTION, "find-file", WIRED_CMD(FindFile),
  347.     FUNCTION, "find-tag", WIRED_CMD(FindTag),
  348.     FUNCTION, "find-tag-at-point", WIRED_CMD(FDotTag),
  349.     FUNCTION, "first-non-blank", WIRED_CMD(ToIndent),
  350.     FUNCTION, "forward-character", WIRED_CMD(ForChar),
  351.     FUNCTION, "forward-list", WIRED_CMD(FList),
  352.     FUNCTION, "forward-paragraph", WIRED_CMD(ForPara),
  353.     FUNCTION, "forward-s-expression", WIRED_CMD(FSexpr),
  354.     FUNCTION, "forward-sentence", WIRED_CMD(Eos),
  355.     FUNCTION, "forward-word", WIRED_CMD(ForWord),
  356.     DefMajor(FUNDAMENTAL), "fundamental-mode", 0,
  357. #ifdef LISP
  358.     FUNCTION, "grind-s-expr", WIRED_CMD(GSexpr),
  359. #endif
  360.     FUNCTION, "goto-line", WIRED_CMD(GoLine),
  361.     FUNCTION, "grow-window", WIRED_CMD(GrowWindow),
  362.     FUNCTION, "handle-tab", WIRED_CMD(Tab),
  363.     FUNCTION, "i-search-forward", WIRED_CMD(IncFSearch),
  364.     FUNCTION, "i-search-reverse", WIRED_CMD(IncRSearch),
  365.     FUNCTION, "insert-file", WIRED_CMD(InsFile),
  366. #ifdef IPROCS
  367.     FUNCTION, "interrupt-process", WIRED_CMD(ProcInt),
  368.     FUNCTION, "i-shell-command", WIRED_CMD(Iprocess),
  369. #endif
  370.     FUNCTION, "kill-next-word", WIRED_CMD(DelNWord),
  371.     FUNCTION, "kill-previous-word", WIRED_CMD(DelPWord),
  372. #ifdef IPROCS
  373.     FUNCTION, "kill-process", WIRED_CMD(ProcKill),
  374. #endif
  375.     FUNCTION, "kill-region", WIRED_CMD(DelReg),
  376.     FUNCTION, "kill-s-expression", WIRED_CMD(KillExpr),
  377.     FUNCTION, "kill-some-buffers", WIRED_CMD(KillSome),
  378.     FUNCTION, "kill-to-beginning-of-sentence", WIRED_CMD(KillBos),
  379.     FUNCTION, "kill-to-end-of-line", WIRED_CMD(KillEOL),
  380.     FUNCTION, "kill-to-end-of-sentence", WIRED_CMD(KillEos),
  381.     FUNCTION, "left-margin-here", WIRED_CMD(SetLMargin),
  382. #ifdef LISP
  383.     DefMajor(LISPMODE), "lisp-mode", 0,
  384. #endif
  385.     FUNCTION, "list-buffers", WIRED_CMD(BufList),
  386. #ifdef IPROCS
  387.     FUNCTION, "list-processes", WIRED_CMD(ProcList),
  388. #endif
  389.     FUNCTION, "make-buffer-unmodified", WIRED_CMD(NotModified),
  390.     FUNCTION, "make-macro-interactive", WIRED_CMD(MacInter),
  391.     FUNCTION, "name-keyboard-macro", WIRED_CMD(NameMac),
  392.     FUNCTION, "newline", WIRED_CMD(Newline),
  393.     FUNCTION, "newline-and-backup", WIRED_CMD(OpenLine),
  394.     FUNCTION, "newline-and-indent", WIRED_CMD(LineAI),
  395.     FUNCTION, "next-error", WIRED_CMD(NextError),
  396.     FUNCTION, "next-line", WIRED_CMD(NextLine),
  397.     FUNCTION, "next-page", WIRED_CMD(NextPage),
  398.     FUNCTION, "next-window", WIRED_CMD(NextWindow),
  399.     FUNCTION, "number-lines-in-window", WIRED_CMD(WNumLines),
  400.     DefMinor(OverWrite), "over-write-mode", 0,
  401.     FUNCTION, "page-next-window", WIRED_CMD(PageNWind),
  402.     FUNCTION, "paren-flash", WIRED_CMD(DoParen),
  403.     FUNCTION, "parse-errors", WIRED_CMD(ParseAll),
  404.     FUNCTION, "parse-special-errors", WIRED_CMD(XParse),
  405. #ifdef SPELL
  406.     FUNCTION, "parse-spelling-errors-in-buffer", WIRED_CMD(SpelWords),
  407. #endif
  408. #ifdef JOB_CONTROL
  409.     FUNCTION, "pause-jove", WIRED_CMD(PauseJove),
  410. #else
  411.     FUNCTION, "pause-jove", WIRED_CMD(Push),
  412. #endif
  413.     FUNCTION, "pop-mark", WIRED_CMD(PopMark),
  414. #ifdef CHDIR
  415.     FUNCTION, "popd", WIRED_CMD(Popd),
  416. #endif
  417.     FUNCTION, "prefix-1", WIRED_CMD(EscPrefix),
  418.     FUNCTION, "prefix-2", WIRED_CMD(CtlxPrefix),
  419.     FUNCTION, "prefix-3", WIRED_CMD(MiscPrefix),
  420.     FUNCTION, "previous-error", WIRED_CMD(PrevError),
  421.     FUNCTION, "previous-line", WIRED_CMD(PrevLine),
  422.     FUNCTION, "previous-page", WIRED_CMD(PrevPage),
  423.     FUNCTION, "previous-window", WIRED_CMD(PrevWindow),
  424.     FUNCTION, "print", WIRED_CMD(PrVar),
  425. #ifdef IPROCS
  426.     FUNCTION, "process-bind-to-key", WIRED_CMD(ProcBind),
  427.     FUNCTION, "process-newline", WIRED_CMD(ProcNewline),
  428.     FUNCTION, "process-send-data-no-return", WIRED_CMD(ProcSendData),
  429. #endif
  430.     FUNCTION, "push-shell", WIRED_CMD(Push),
  431. #ifdef CHDIR
  432.     FUNCTION, "pushd", WIRED_CMD(Pushd),
  433.     FUNCTION, "pwd", WIRED_CMD(prCWD),
  434. #endif
  435.     FUNCTION, "quadruple-numeric-argument", WIRED_CMD(FourTime),
  436.     FUNCTION, "query-replace-string", WIRED_CMD(QRepSearch),
  437. #ifdef IPROCS
  438.     FUNCTION, "quit-process", WIRED_CMD(ProcQuit),
  439. #endif
  440.     FUNCTION, "quoted-insert", WIRED_CMD(QuotChar),
  441. #ifdef ABBREV
  442.     FUNCTION, "read-word-abbrev-file", WIRED_CMD(RestAbbrevs),
  443. #endif
  444.     FUNCTION, "read-macros-from-file", WIRED_CMD(ReadMacs),
  445.     FUNCTION, "redraw-display", WIRED_CMD(RedrawDisplay),
  446.     FUNCTION, "recursive-edit", WIRED_CMD(Recur),
  447.     FUNCTION, "rename-buffer", WIRED_CMD(ReNamBuf),
  448.     FUNCTION, "replace-in-region", WIRED_CMD(RegReplace),
  449.     FUNCTION, "replace-string", WIRED_CMD(RepSearch),
  450.     FUNCTION, "right-margin-here", WIRED_CMD(SetRMargin),
  451.     FUNCTION, "save-file", WIRED_CMD(SaveFile),
  452.     FUNCTION, "scroll-down", WIRED_CMD(DownScroll),
  453.     FUNCTION, "scroll-up", WIRED_CMD(UpScroll),
  454.     FUNCTION, "search-forward", WIRED_CMD(ForSearch),
  455.     FUNCTION, "search-forward-nd", WIRED_CMD(FSrchND),
  456.     FUNCTION, "search-reverse", WIRED_CMD(RevSearch),
  457.     FUNCTION, "search-reverse-nd", WIRED_CMD(RSrchND),
  458.     FUNCTION, "select-buffer", WIRED_CMD(BufSelect),
  459.     FUNCTION, "self-insert", WIRED_CMD(SelfInsert),
  460.     FUNCTION, "set", WIRED_CMD(SetVar),
  461.     FUNCTION, "set-mark", WIRED_CMD(SetMark),
  462. #ifdef IPROCS    /* for GNU compatibility */
  463.     FUNCTION, "shell", WIRED_CMD(ShellProc),
  464. #endif
  465.     FUNCTION, "shell-command", WIRED_CMD(ShellCom),
  466.     FUNCTION, "shell-command-to-buffer", WIRED_CMD(ShToBuf),
  467.     DefMinor(ShowMatch), "show-match-mode", 0,
  468.     FUNCTION, "shrink-window", WIRED_CMD(ShrWindow),
  469.     FUNCTION, "source", WIRED_CMD(Source),
  470. #ifdef SPELL
  471.     FUNCTION, "spell-buffer", WIRED_CMD(SpelBuffer),
  472. #endif
  473.     FUNCTION, "split-current-window", WIRED_CMD(SplitWind),
  474.     FUNCTION, "start-remembering", WIRED_CMD(Remember),
  475. #ifdef IPROCS
  476. #  ifndef PIPEPROCS
  477.     FUNCTION, "stop-process", WIRED_CMD(ProcStop),
  478. #  endif
  479. #endif
  480.     FUNCTION, "stop-remembering", WIRED_CMD(Forget),
  481.     FUNCTION, "string-length", WIRED_CMD(StrLength),
  482. #ifdef JOB_CONTROL
  483.     FUNCTION, "suspend-jove", WIRED_CMD(PauseJove),
  484. #endif
  485.     DefMajor(TEXT), "text-mode", 0,
  486.     FUNCTION, "transpose-characters", WIRED_CMD(TransChar),
  487.     FUNCTION, "transpose-lines", WIRED_CMD(TransLines),
  488.     FUNCTION, "unbind-key", WIRED_CMD(UnbindC),
  489.     FUNCTION, "version", WIRED_CMD(ShowVersion),
  490.     FUNCTION, "visible-spaces-in-window", WIRED_CMD(WVisSpace),
  491.     FUNCTION, "visit-file", WIRED_CMD(ReadFile),
  492.     FUNCTION, "window-find", WIRED_CMD(WindFind),
  493. #ifdef ABBREV
  494.     DefMinor(Abbrev), "word-abbrev-mode", 0,
  495.     FUNCTION, "write-word-abbrev-file", WIRED_CMD(SaveAbbrevs),
  496. #endif
  497.     FUNCTION, "write-file", WIRED_CMD(WriteFile),
  498.     FUNCTION, "write-macros-to-file", WIRED_CMD(WriteMacs),
  499.     FUNCTION, "write-modified-files", WIRED_CMD(WtModBuf),
  500.     FUNCTION, "write-region", WIRED_CMD(WrtReg),
  501.     FUNCTION, "yank", WIRED_CMD(Yank),
  502.     FUNCTION, "yank-pop", WIRED_CMD(YankPop),
  503.     FUNCTION, 0, 0
  504. };
  505.  
  506. #ifndef TXT_TO_C
  507. data_obj *
  508. findcom(prompt)
  509. char    *prompt;
  510. {
  511.     /* This is for faster startup.  This just reads until a space or a
  512.        tab or a newline character is reached, and then does a
  513.        semi-hashed lookup on that string.  This should be much faster
  514.        than initializing the minibuffer for each line. */
  515.     if (InJoverc) {
  516.         char    cmdbuf[128];
  517.         register struct cmd    *cmd;
  518.         register char    *cp = cmdbuf;
  519.         register int    c;
  520.         struct cmd    *which;
  521.         int    cmdlen,
  522.             found = 0;
  523.         static struct cmd    *cmdhash[1 + 26];
  524.         static int    beenhere = NO;
  525.  
  526. /* special case for prefix commands--only upper case ones */
  527. #define hash(c)    ((c == 'P') ? 0 : 1 + (c - 'a'))
  528.  
  529.         /* initialize the hash table */
  530.         if (beenhere == NO) {
  531.             int    lastc = 0;
  532.  
  533.             for (cmd = commands; cmd->Name != 0; cmd++)
  534.                 if (lastc != cmd->Name[0]) {
  535.                     lastc = cmd->Name[0];
  536.                     cmdhash[hash(lastc)] = cmd;
  537.                 }
  538.             beenhere = YES;
  539.         }
  540.  
  541.         /* gather the cmd name */
  542.         while (((c = getch()) != EOF) && !index(" \t\r\n", c))
  543.             *cp++ = c;
  544.         if (c == EOF)
  545.             return 0;
  546.         *cp = '\0';
  547.         cmdlen = cp - cmdbuf;
  548.         if (cmdlen == 0)
  549.             return 0;
  550.  
  551.         /* look it up (in the reduced search space) */
  552.         for (cmd = cmdhash[hash(cmdbuf[0])]; cmd->Name[0] == cmdbuf[0]; cmd++) {
  553.             if (strncmp(cmd->Name, cmdbuf, cmdlen) == 0) {
  554.                 if (strcmp(cmd->Name, cmdbuf) == 0)
  555.                     return (data_obj *) cmd;
  556.                 found++;
  557.                 which = cmd;
  558.             }
  559.         }
  560.         if (found > 1)
  561.             complain("[\"%s\" ambiguous]", cmdbuf);
  562.         else if (found == 0)
  563.             complain("[\"%s\" unknown]", cmdbuf);
  564.         else
  565.             return (data_obj *) which;
  566.     } else {
  567.         static char    *strings[(sizeof commands) / sizeof (commands[0])];
  568.         static int    beenhere = 0;
  569.         register int    com;
  570.  
  571.         if (beenhere == 0) {
  572.             register char    **strs = strings;
  573.             register struct cmd    *c = commands;
  574.  
  575.             beenhere = 1;
  576.             for (; c->Name; c++)
  577.                 *strs++ = c->Name;
  578.             *strs = 0;
  579.         }
  580.  
  581.         if ((com = complete(strings, prompt, CASEIND)) < 0)
  582.             return 0;
  583.         return (data_obj *) &commands[com];
  584.     }
  585.     /* NOTREACHED */
  586. }
  587. #endif
  588.