Annotation of 43BSD/contrib/jove/funcdefs.c, revision 1.1

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

unix.superglobalmegacorp.com

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