/* names.c -- implements names.h */ #include "names.h" /* Name to function binding table. * * This table gives the names of all the bindable functions and their C * function address. These are used for the bind-to-key function and macro * processing. */ #include #include "basic.h" #include "bind.h" #include "bindable.h" #include "buffer.h" #include "display.h" #include "eval.h" #include "exec.h" #include "file.h" #include "isearch.h" #include "line.h" #include "region.h" #include "random.h" #include "search.h" #include "spawn.h" #include "util.h" #include "window.h" #include "word.h" const name_bind names[] = { {" abort-command", ctrlg} , {" add-global-mode", setgmode} , {" add-mode", setemode} , #if APROP {" apropos", apro} , #endif {" backward-character", (fnp_t) backchar} , {" begin-macro", ctlxlp} , {" beginning-of-file", (fnp_t) gotobob} , {" beginning-of-line", (fnp_t) gotobol} , {" bind-to-key", bindtokey} , {" buffer-position", showcpos} , {"!case-region-lower", lowerregion} , {"!case-region-upper", upperregion} , {"!case-word-capitalize", capword} , {"!case-word-lower", lowerword} , {"!case-word-upper", upperword} , {" change-file-name", filename} , {" change-screen-size", newsize} , {" change-screen-width", newwidth} , {" clear-and-redraw", redraw} , {" clear-message-line", clrmes} , {" copy-region", copyregion} , #if WORDPRO {" count-words", wordcount} , #endif {" ctlx-prefix", cex} , {"!delete-blank-lines", deblank} , {" delete-buffer", killbuffer} , {" delete-global-mode", delgmode} , {" delete-mode", delmode} , {"!delete-next-character", forwdel} , {"!delete-next-word", delfword} , {" delete-other-windows", onlywind} , {"!delete-previous-character", backdel} , {"!delete-previous-word", delbword} , {" delete-window", delwind} , {" describe-bindings", desbind} , {" describe-key", deskey} , #if AEDIT {"!detab-line", detab} , #endif {" end-macro", ctlxrp} , {" end-of-file", (fnp_t) gotoeob} , {" end-of-line", (fnp_t) gotoeol} , #if AEDIT {"!entab-line", entab} , #endif {" exchange-point-and-mark", (fnp_t) swapmark} , {" execute-buffer", execbuf} , {" execute-command-line", execcmd} , {" execute-file", execfile} , {" execute-macro", ctlxe} , {" execute-macro-1", cbuf1} , {" execute-macro-10", cbuf10} , {" execute-macro-11", cbuf11} , {" execute-macro-12", cbuf12} , {" execute-macro-13", cbuf13} , {" execute-macro-14", cbuf14} , {" execute-macro-15", cbuf15} , {" execute-macro-16", cbuf16} , {" execute-macro-17", cbuf17} , {" execute-macro-18", cbuf18} , {" execute-macro-19", cbuf19} , {" execute-macro-2", cbuf2} , {" execute-macro-20", cbuf20} , {" execute-macro-21", cbuf21} , {" execute-macro-22", cbuf22} , {" execute-macro-23", cbuf23} , {" execute-macro-24", cbuf24} , {" execute-macro-25", cbuf25} , {" execute-macro-26", cbuf26} , {" execute-macro-27", cbuf27} , {" execute-macro-28", cbuf28} , {" execute-macro-29", cbuf29} , {" execute-macro-3", cbuf3} , {" execute-macro-30", cbuf30} , {" execute-macro-31", cbuf31} , {" execute-macro-32", cbuf32} , {" execute-macro-33", cbuf33} , {" execute-macro-34", cbuf34} , {" execute-macro-35", cbuf35} , {" execute-macro-36", cbuf36} , {" execute-macro-37", cbuf37} , {" execute-macro-38", cbuf38} , {" execute-macro-39", cbuf39} , {" execute-macro-4", cbuf4} , {" execute-macro-40", cbuf40} , {" execute-macro-5", cbuf5} , {" execute-macro-6", cbuf6} , {" execute-macro-7", cbuf7} , {" execute-macro-8", cbuf8} , {" execute-macro-9", cbuf9} , {" execute-named-command", namedcmd} , #if PROC {" execute-procedure", execproc} , #endif {" execute-program", execprg} , {" exit-emacs", quit} , #if WORDPRO {"!fill-paragraph", fillpara} , #endif {"!filter-buffer", filter_buffer} , {" find-file", filefind} , {" forward-character", (fnp_t) forwchar} , {" goto-line", gotoline} , #if CFENCE {" goto-matching-fence", getfence} , #endif {" grow-window", enlargewind} , {"!handle-tab", insert_tab} , {" help", help} , {" hunt-backward", backhunt} , {" hunt-forward", forwhunt} , {" i-shell", spawncli} , #if ISRCH {" incremental-search", fisearch} , #endif {"!insert-file", insfile} , {"!insert-space", insspace} , {"!insert-string", istring} , #if WORDPRO #if PKCODE {"!justify-paragraph", justpara} , #endif {"!kill-paragraph", killpara} , #endif {"!kill-region", killregion} , {"!kill-to-end-of-line", killtext} , {" list-buffers", listbuffers} , {" meta-prefix", metafn} , {" move-window-down", mvdnwind} , {" move-window-up", mvupwind} , {" name-buffer", namebuffer} , {"!newline", insert_newline} , {"!newline-and-indent", indent} , {" next-buffer", nextbuffer} , {" next-line", (fnp_t) forwline} , {" next-page", (fnp_t) forwpage} , #if WORDPRO {" next-paragraph", gotoeop} , #endif {" next-window", nextwind} , {" next-word", forwword} , {" nop", nullproc} , {"!open-line", openline} , {" overwrite-string", ovstring} , {" pipe-command", pipecmd} , {" previous-line", (fnp_t) backline} , {" previous-page", (fnp_t) backpage} , #if WORDPRO {" previous-paragraph", gotobop} , #endif {" previous-window", prevwind} , {" previous-word", backword} , {"!query-replace-string", qreplace} , {" quick-exit", quickexit} , {"!quote-character", quote} , {"!read-file", fileread} , {" redraw-display", reposition} , {"!replace-string", sreplace} , {" resize-window", resize} , {" restore-window", restwnd} , #if ISRCH {" reverse-incremental-search", risearch} , #endif #if PROC {" run", execproc} , #endif {"!save-file", filesave} , {" save-window", savewnd} , {" scroll-next-down", scrnextdw} , {" scroll-next-up", scrnextup} , {" search-forward", forwsearch} , {" search-reverse", backsearch} , {" select-buffer", usebuffer} , {" set", setvar} , {" set-fill-column", setfillcol} , {" set-mark", (fnp_t) setmark} , {" shell-command", spawn} , {" shrink-window", shrinkwind} , {" split-current-window", splitwind} , {" store-macro", storemac} , #if PROC {" store-procedure", storeproc} , #endif #if BSD | SVR4 {" suspend-emacs", bktoshell} , #endif {"!transpose-characters", (fnp_t) twiddle} , #if AEDIT {"!trim-line", trim} , #endif {" unbind-key", unbindkey} , {" universal-argument", unarg} , {" unmark-buffer", unmark} , {" update-screen", upscreen} , {" view-file", viewfile} , {" wrap-word", wrapword} , {" write-file", filewrite} , {" write-message", writemsg} , {"!yank", yank} , {" ", NULL} }; const name_bind *fncmatch( char *name) { int found = ARRAY_SIZE( names) - 1 ; /* index of last entry/ catch all */ int low = 0 ; int high = found - 1 ; do { int cur = (high + low) / 2 ; int s = strcmp( name, bind_name( &names[ cur])) ; if( s < 0) high = cur - 1 ; else if( s == 0) { found = cur ; break ; } else low = cur + 1 ; } while( low <= high) ; return &names[ found] ; } /* end of names.c */