home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 001-099 / ff093.lzh / MicroEmacs / source / src.arc / exec.c < prev    next >
C/C++ Source or Header  |  1987-08-16  |  18KB  |  976 lines

  1. /*    This file is for functions dealing with execution of
  2.     commands, command lines, buffers, files and startup files
  3.  
  4.     written 1986 by Daniel Lawrence                */
  5.  
  6. #include    <stdio.h>
  7. #include    "estruct.h"
  8. #include    "edef.h"
  9.  
  10. #if    MEGAMAX & ST520
  11. overlay    "exec"
  12. #endif
  13.  
  14. #if    DEBUGM
  15. char outline[NSTRING];        /* global string to hold debug line text */
  16. #endif
  17.  
  18. /* namedcmd:    execute a named command even if it is not bound */
  19.  
  20. namedcmd(f, n)
  21.  
  22. int f, n;    /* command arguments [passed through to command executed] */
  23.  
  24. {
  25.     register (*kfunc)();    /* ptr to the requexted function to bind to */
  26.     int (*getname())();
  27.  
  28.     /* prompt the user to type a named command */
  29.     mlwrite(": ");
  30.  
  31.     /* and now get the function name to execute */
  32.     kfunc = getname();
  33.     if (kfunc == NULL) {
  34.         mlwrite("[No such function]");
  35.         return(FALSE);
  36.     }
  37.  
  38.     /* and then execute the command */
  39.     return((*kfunc)(f, n));
  40. }
  41.  
  42. /*    execcmd:    Execute a command line command to be typed in
  43.             by the user                    */
  44.  
  45. execcmd(f, n)
  46.  
  47. int f, n;    /* default Flag and Numeric argument */
  48.  
  49. {
  50.     register int status;        /* status return */
  51.     char cmdstr[NSTRING];        /* string holding command to execute */
  52.  
  53.     /* get the line wanted */
  54.     if ((status = mlreply(": ", cmdstr, NSTRING)) != TRUE)
  55.         return(status);
  56.  
  57.     execlevel = 0;
  58.     return(docmd(cmdstr));
  59. }
  60.  
  61. /*    docmd:    take a passed string as a command line and translate
  62.         it to be executed as a command. This function will be
  63.         used by execute-command-line and by all source and
  64.         startup files. Lastflag/thisflag is also updated.
  65.  
  66.     format of the command line is:
  67.  
  68.         {# arg} <command-name> {<argument string(s)>}
  69.  
  70.     Directives start with a "!" and include:
  71.  
  72.     !endm        End a macro
  73.     !if (cond)    conditional execution
  74.     !else
  75.     !endif
  76.     !return        Return (terminating current macro)
  77.     !goto <label>    Jump to a label in the current macro
  78.  
  79.     Line Labels begin with a "*" in column 1, like:
  80.  
  81.     *LBL01
  82. */
  83.  
  84. docmd(cline)
  85.  
  86. char *cline;    /* command line to execute */
  87.  
  88. {
  89.     register int f;        /* default argument flag */
  90.     register int n;        /* numeric repeat value */
  91.     register int i;
  92.     int (*fnc)();        /* function to execute */
  93.     int status;        /* return status of function */
  94.     int oldcle;        /* old contents of clexec flag */
  95.     int llen;        /* length of cline */
  96.     int force;        /* force TRUE result? */
  97.     char *tmp;        /* tmp pointer into cline */
  98.     struct LINE *lp;    /* a line pointer */
  99.     char *oldestr;        /* original exec string */
  100.     char token[NSTRING];    /* next token off of command line */
  101.     int (*fncmatch())();
  102. #if    DEBUGM
  103.     /* if $debug == TRUE, every line to execute
  104.        gets echoed and a key needs to be pressed to continue
  105.        ^G will abort the command */
  106.     register char *sp;    /* pointer into buf to expand %s */
  107.  
  108.     if (macbug) {
  109.         strcpy(outline, "<<<");
  110. #if    1    /* debug if levels */
  111.         strcat(outline, itoa(execlevel));
  112.         strcat(outline, ":");
  113. #endif
  114.         strcat(outline, cline);
  115.         strcat(outline, ">>>");
  116.  
  117.         /* change all '%' to ':' so mlwrite won't expect arguments */
  118.         sp = outline;
  119.         while (*sp) {
  120.             if (*sp++ == '%')
  121.                 *(sp-1) = ':';
  122.         }
  123.  
  124.         /* write out the debug line */
  125.         mlwrite(outline);
  126.         update(TRUE);
  127.  
  128.         /* and get the keystroke */
  129.         if (tgetc() == 7) {
  130.             mlwrite("[Macro aborted]");
  131.             return(FALSE);
  132.         }
  133.     }
  134. #endif
  135.         
  136.     /* dump comments here */
  137.     if (*cline == ';')
  138.         return(TRUE);
  139.  
  140.     /* eat leading spaces */
  141.     while (*cline == ' ' || *cline == '\t')
  142.         ++cline;
  143.  
  144.     /* check to see if this line turns macro storage off */
  145.     if (cline[0] == '!' && strncmp(&cline[1], "endm", 4) == 0) {
  146.         mstore = FALSE;
  147.         bstore = NULL;
  148.         return(TRUE);
  149.     }
  150.  
  151.     /* if macro store is on, just salt this away */
  152.     if (mstore) {
  153.         /* allocate the space for the line */
  154.         llen = strlen(cline);
  155.         if ((lp=lalloc(llen)) == NULL) {
  156.             mlwrite("Out of memory while storing macro");
  157.             return (FALSE);
  158.         }
  159.  
  160.         /* copy the text into the new line */
  161.         for (i=0; i<llen; ++i)
  162.             lputc(lp, i, cline[i]);
  163.  
  164.         /* attach the line to the end of the buffer */
  165.                bstore->b_linep->l_bp->l_fp = lp;
  166.         lp->l_bp = bstore->b_linep->l_bp;
  167.         bstore->b_linep->l_bp = lp;
  168.         lp->l_fp = bstore->b_linep;
  169.         return (TRUE);
  170.     }
  171.     
  172.     /* dump labels here */
  173.     if (*cline == '*')
  174.         return(TRUE);
  175.  
  176.     force = FALSE;
  177.     oldestr = execstr;    /* save last ptr to string to execute */
  178.     execstr = cline;    /* and set this one as current */
  179.  
  180.     /* process directives */
  181.     if (*cline == '!') {
  182.         /* save directive location and skip it */
  183.         tmp = cline;
  184.         while (*execstr && *execstr != ' ' && *execstr != '\t')
  185.             ++execstr;
  186.  
  187.         if (tmp[1] == 'f' && tmp[2] == 'o') {
  188.             force = TRUE;
  189.             goto do001;
  190.  
  191.         } else if (tmp[1] == 'i' && tmp[2] == 'f') {
  192.  
  193.             /* IF directive */
  194.             /* grab the value of the logical exp */
  195.             if (execlevel == 0) {
  196.                 if ((status = macarg(token)) != TRUE) {
  197.                     execstr = oldestr;
  198.                     return(status);
  199.                 }
  200.                 status = stol(token);
  201.             } else
  202.                 status = TRUE;
  203.  
  204.             if (status) {
  205.  
  206.                 /* IF (TRUE) */
  207.                 if (execlevel != 0)
  208.                     ++execlevel;
  209.             } else {
  210.  
  211.                 /* IF (FALSE) */
  212.                 ++execlevel;
  213.             }
  214.  
  215.         } else if (tmp[1] == 'e' && tmp[2] == 'l') {
  216.  
  217.             /* ELSE directive */
  218.             if (execlevel == 1)
  219.                 --execlevel;
  220.             else if (execlevel == 0 )
  221.                 ++execlevel;
  222.  
  223.         } else if (tmp[1] == 'e' && tmp[2] == 'n') {
  224.  
  225.             /* ENDIF directive */
  226.             if (execlevel)
  227.                 --execlevel;
  228.  
  229.         } else if (tmp[1] == 'r' && tmp[2] == 'e') {
  230.  
  231.             /* RETURN directive */
  232.             execstr = oldestr;
  233.             if (execlevel)
  234.                 return(TRUE);
  235.             else
  236.                 return(RET);
  237.  
  238.         } else if (tmp[1] == 'g' && tmp[2] == 'o') {
  239.  
  240.             /* GOTO directive */
  241.             /* .....only if we are currently executing */
  242.             if (execlevel) {
  243.                 execstr = oldestr;
  244.                 return(TRUE);
  245.             }
  246.  
  247.             while (*execstr == ' ' || *execstr == '\t')
  248.                 ++execstr;
  249.             strncpy(golabel, execstr, NPAT - 1);
  250.             return(GOLINE);
  251.  
  252.         } else {
  253.             mlwrite("%%Unknown Directive");
  254.             return(FALSE);
  255.         }
  256.  
  257.         /* restore execstr and exit */
  258.         execstr = oldestr;
  259.         return(TRUE);
  260.     }
  261.  
  262. do001:    /* if we are scanning and not executing..go back here */
  263.     if (execlevel) {
  264.         execstr = oldestr;
  265.         return(TRUE);
  266.     }
  267.  
  268.     /* first set up the default command values */
  269.     f = FALSE;
  270.     n = 1;
  271.     lastflag = thisflag;
  272.     thisflag = 0;
  273.  
  274.     if ((status = macarg(token)) != TRUE) {    /* and grab the first token */
  275.         execstr = oldestr;
  276.         return(status);
  277.     }
  278.  
  279.     /* process leadin argument */
  280.     if (gettyp(token) != TKCMD) {
  281.         f = TRUE;
  282.         strcpy(token, getval(token));
  283.         n = atoi(token);
  284.  
  285.         /* and now get the command to execute */
  286.         if ((status = macarg(token)) != TRUE) {
  287.             execstr = oldestr;
  288.             return(status);    
  289.         }    
  290.     }
  291.  
  292.     /* and match the token to see if it exists */
  293.     if ((fnc = fncmatch(token)) == NULL) {
  294.         mlwrite("[No such Function]");
  295.         execstr = oldestr;
  296.         return(FALSE);
  297.     }
  298.     
  299.     /* save the arguments and go execute the command */
  300.     oldcle = clexec;        /* save old clexec flag */
  301.     clexec = TRUE;            /* in cline execution */
  302.     status = (*fnc)(f, n);        /* call the function */
  303.     cmdstatus = status;        /* save the status */
  304.     if (force)            /* force the status */
  305.         status = TRUE;
  306.     clexec = oldcle;        /* restore clexec flag */
  307.     execstr = oldestr;
  308.     return(status);
  309. }
  310.  
  311. /* token:    chop a token off a string
  312.         return a pointer past the token
  313. */
  314.  
  315. char *token(src, tok)
  316.  
  317. char *src, *tok;    /* source string, destination token string */
  318.  
  319. {
  320.     register int quotef;    /* is the current string quoted? */
  321.  
  322.     /* first scan past any whitespace in the source string */
  323.     while (*src == ' ' || *src == '\t')
  324.         ++src;
  325.  
  326.     /* scan through the source string */
  327.     quotef = FALSE;
  328.     while (*src) {
  329.         /* process special characters */
  330.         if (*src == '~') {
  331.             ++src;
  332.             if (*src == 0)
  333.                 break;
  334.             switch (*src++) {
  335.                 case 'r':    *tok++ = 13; break;
  336.                 case 'n':    *tok++ = 10; break;
  337.                 case 't':    *tok++ = 9;  break;
  338.                 case 'b':    *tok++ = 8;  break;
  339.                 case 'f':    *tok++ = 12; break;
  340.                 default:    *tok++ = *(src-1);
  341.             }
  342.         } else {
  343.             /* check for the end of the token */
  344.             if (quotef) {
  345.                 if (*src == '"')
  346.                     break;
  347.             } else {
  348.                 if (*src == ' ' || *src == '\t')
  349.                     break;
  350.             }
  351.  
  352.             /* set quote mode if qoute found */
  353.             if (*src == '"')
  354.                 quotef = TRUE;
  355.  
  356.             /* record the character */
  357.             *tok++ = *src++;
  358.         }
  359.     }
  360.  
  361.     /* terminate the token and exit */
  362.     if (*src)
  363.         ++src;
  364.     *tok = 0;
  365.     return(src);
  366. }
  367.  
  368. macarg(tok)    /* get a macro line argument */
  369.  
  370. char *tok;    /* buffer to place argument */
  371.  
  372. {
  373.     int savcle;    /* buffer to store original clexec */
  374.     int status;
  375.  
  376.     savcle = clexec;    /* save execution mode */
  377.     clexec = TRUE;        /* get the argument */
  378.     status = nextarg("", tok, NSTRING, ctoec('\n'));
  379.     clexec = savcle;    /* restore execution mode */
  380.     return(status);
  381. }
  382.  
  383. /*    nextarg:    get the next argument    */
  384.  
  385. nextarg(prompt, buffer, size, terminator)
  386.  
  387. char *prompt;        /* prompt to use if we must be interactive */
  388. char *buffer;        /* buffer to put token into */
  389. char *size;        /* size of the buffer */
  390. int terminator;        /* terminating char to be used on interactive fetch */
  391.  
  392. {
  393.     /* if we are interactive, go get it! */
  394.     if (clexec == FALSE)
  395.         return(getstring(prompt, buffer, size, terminator));
  396.  
  397.     /* grab token and advance past */
  398.     execstr = token(execstr, buffer);
  399.  
  400.     /* evaluate it */
  401.     strcpy(buffer, getval(buffer));
  402.     return(TRUE);
  403. }
  404.  
  405. /*    storemac:    Set up a macro buffer and flag to store all
  406.             executed command lines there            */
  407.  
  408. storemac(f, n)
  409.  
  410. int f;        /* default flag */
  411. int n;        /* macro number to use */
  412.  
  413. {
  414.     register struct BUFFER *bp;    /* pointer to macro buffer */
  415.     char bname[NBUFN];        /* name of buffer to use */
  416.  
  417.     /* must have a numeric argument to this function */
  418.     if (f == FALSE) {
  419.         mlwrite("No macro specified");
  420.         return(FALSE);
  421.     }
  422.  
  423.     /* range check the macro number */
  424.     if (n < 1 || n > 40) {
  425.         mlwrite("Macro number out of range");
  426.         return(FALSE);
  427.     }
  428.  
  429.     /* construct the macro buffer name */
  430.     strcpy(bname, "[Macro xx]");
  431.     bname[7] = '0' + (n / 10);
  432.     bname[8] = '0' + (n % 10);
  433.  
  434.     /* set up the new macro buffer */
  435.     if ((bp = bfind(bname, TRUE, BFINVS)) == NULL) {
  436.         mlwrite("Can not create macro");
  437.         return(FALSE);
  438.     }
  439.  
  440.     /* and make sure it is empty */
  441.     bclear(bp);
  442.  
  443.     /* and set the macro store pointers to it */
  444.     mstore = TRUE;
  445.     bstore = bp;
  446.     return(TRUE);
  447. }
  448.  
  449. #if    PROC
  450. /*    storeproc:    Set up a procedure buffer and flag to store all
  451.             executed command lines there            */
  452.  
  453. storeproc(f, n)
  454.  
  455. int f;        /* default flag */
  456. int n;        /* macro number to use */
  457.  
  458. {
  459.     register struct BUFFER *bp;    /* pointer to macro buffer */
  460.     register int status;        /* return status */
  461.     char bname[NBUFN];        /* name of buffer to use */
  462.  
  463.     /* a numeric argument means its a numbered macro */
  464.     if (f == TRUE)
  465.         return(storemac(f, n));
  466.  
  467.     /* get the name of the procedure */
  468.         if ((status = mlreply("Procedure name: ", &bname[1], NBUFN-2)) != TRUE)
  469.                 return(status);
  470.  
  471.     /* construct the macro buffer name */
  472.     bname[0] = '[';
  473.     strcat(bname, "]");
  474.  
  475.     /* set up the new macro buffer */
  476.     if ((bp = bfind(bname, TRUE, BFINVS)) == NULL) {
  477.         mlwrite("Can not create macro");
  478.         return(FALSE);
  479.     }
  480.  
  481.     /* and make sure it is empty */
  482.     bclear(bp);
  483.  
  484.     /* and set the macro store pointers to it */
  485.     mstore = TRUE;
  486.     bstore = bp;
  487.     return(TRUE);
  488. }
  489.  
  490. /*    execproc:    Execute a procedure                */
  491.  
  492. execproc(f, n)
  493.  
  494. int f, n;    /* default flag and numeric arg */
  495.  
  496. {
  497.         register BUFFER *bp;        /* ptr to buffer to execute */
  498.         register int status;        /* status return */
  499.         char bufn[NBUFN+2];        /* name of buffer to execute */
  500.  
  501.     /* find out what buffer the user wants to execute */
  502.         if ((status = mlreply("Execute procedure: ", &bufn[1], NBUFN)) != TRUE)
  503.                 return(status);
  504.  
  505.     /* construct the buffer name */
  506.     bufn[0] = '[';
  507.     strcat(bufn, "]");
  508.  
  509.     /* find the pointer to that buffer */
  510.         if ((bp=bfind(bufn, FALSE, 0)) == NULL) {
  511.         mlwrite("No such procedure");
  512.                 return(FALSE);
  513.         }
  514.  
  515.     /* and now execute it as asked */
  516.     while (n-- > 0)
  517.         if ((status = dobuf(bp)) != TRUE)
  518.             return(status);
  519.     return(TRUE);
  520. }
  521. #endif
  522.  
  523. /*    execbuf:    Execute the contents of a buffer of commands    */
  524.  
  525. execbuf(f, n)
  526.  
  527. int f, n;    /* default flag and numeric arg */
  528.  
  529. {
  530.         register BUFFER *bp;        /* ptr to buffer to execute */
  531.         register int status;        /* status return */
  532.         char bufn[NBUFN];        /* name of buffer to execute */
  533.  
  534.     /* find out what buffer the user wants to execute */
  535.         if ((status = mlreply("Execute buffer: ", bufn, NBUFN)) != TRUE)
  536.                 return(status);
  537.  
  538.     /* find the pointer to that buffer */
  539.         if ((bp=bfind(bufn, FALSE, 0)) == NULL) {
  540.         mlwrite("No such buffer");
  541.                 return(FALSE);
  542.         }
  543.  
  544.     /* and now execute it as asked */
  545.     while (n-- > 0)
  546.         if ((status = dobuf(bp)) != TRUE)
  547.             return(status);
  548.     return(TRUE);
  549. }
  550.  
  551. /*    dobuf:    execute the contents of the buffer pointed to
  552.         by the passed BP                */
  553.  
  554. dobuf(bp)
  555.  
  556. BUFFER *bp;    /* buffer to execute */
  557.  
  558. {
  559.         register int status;        /* status return */
  560.     register LINE *lp;        /* pointer to line to execute */
  561.     register LINE *hlp;        /* pointer to line header */
  562.     register LINE *glp;        /* line to goto */
  563.     register int linlen;        /* length of line to execute */
  564.     register WINDOW *wp;        /* ptr to windows to scan */
  565.     char *eline;            /* text of line to execute */
  566.  
  567.     /* clear IF level flags */
  568.     execlevel = 0;
  569.  
  570.     /* starting at the beginning of the buffer */
  571.     hlp = bp->b_linep;
  572.     lp = hlp->l_fp;
  573.     while (lp != hlp) {
  574.         /* allocate eline and copy macro line to it */
  575.         linlen = lp->l_used;
  576.         if ((eline = malloc(linlen+1)) == NULL) {
  577.             mlwrite("%%Out of Memory during macro execution");
  578.             return(FALSE);
  579.         }
  580.         strncpy(eline, lp->l_text, linlen);
  581.         eline[linlen] = 0;    /* make sure it ends */
  582.  
  583.         /* trim leading whitespace */
  584.         while (eline[0] == ' ' || eline[0] == '\t')
  585.             strcpy(eline, &eline[1]);
  586.  
  587.         /* if it is not a comment, execute it */
  588.         if (eline[0] != 0 && eline[0] != ';') {
  589.             status = docmd(eline);
  590.  
  591.             /* if it is a !GOTO directive, deal with it */
  592.             if (status == GOLINE) {
  593.                 linlen = strlen(golabel);
  594.                 glp = hlp->l_fp;
  595.                 while (glp != hlp) {
  596.                     if (*glp->l_text == '*' &&
  597.                         (strncmp(&glp->l_text[1], golabel,
  598.                                 linlen) == 0)) {
  599.                         lp = glp;
  600.                         status = TRUE;
  601.                     }
  602.                 glp = glp->l_fp;
  603.                 }
  604.             }
  605.  
  606.             if (status == GOLINE) {
  607.                 mlwrite("%%No such label");
  608.                 return(FALSE);
  609.             }
  610.  
  611.             /* if it is a !RETURN directive...do so */
  612.             if (status == RET) {
  613.                 free(eline);
  614.                 break;
  615.             }
  616.  
  617.             /* check for a command error */
  618.             if (status != TRUE) {
  619.                 /* look if buffer is showing */
  620.                 wp = wheadp;
  621.                 while (wp != NULL) {
  622.                     if (wp->w_bufp == bp) {
  623.                         /* and point it */
  624.                         wp->w_dotp = lp;
  625.                         wp->w_doto = 0;
  626.                         wp->w_flag |= WFHARD;
  627.                     }
  628.                     wp = wp->w_wndp;
  629.                 }
  630.                 /* in any case set the buffer . */
  631.                 bp->b_dotp = lp;
  632.                 bp->b_doto = 0;
  633.                 free(eline);
  634.                 execlevel = 0;
  635.                 return(status);
  636.             }
  637.         }
  638.  
  639.         /* on to the next line */
  640.         free(eline);
  641.         lp = lp->l_fp;
  642.     }
  643.  
  644.     /* exit the current function */
  645.     execlevel = 0;
  646.         return(TRUE);
  647. }
  648.  
  649. execfile(f, n)    /* execute a series of commands in a file
  650. */
  651.  
  652. int f, n;    /* default flag and numeric arg to pass on to file */
  653.  
  654. {
  655.     register int status;    /* return status of name query */
  656.     char fname[NSTRING];    /* name of file to execute */
  657.  
  658.     if ((status = mlreply("File to execute: ", fname, NSTRING -1)) != TRUE)
  659.         return(status);
  660.  
  661.     /* otherwise, execute it */
  662.     while (n-- > 0)
  663.         if ((status=dofile(fname)) != TRUE)
  664.             return(status);
  665.  
  666.     return(TRUE);
  667. }
  668.  
  669. /*    dofile:    yank a file into a buffer and execute it
  670.         if there are no errors, delete the buffer on exit */
  671.  
  672. dofile(fname)
  673.  
  674. char *fname;    /* file name to execute */
  675.  
  676. {
  677.     register BUFFER *bp;    /* buffer to place file to exeute */
  678.     register BUFFER *cb;    /* temp to hold current buf while we read */
  679.     register int status;    /* results of various calls */
  680.     char bname[NBUFN];    /* name of buffer */
  681.  
  682.     makename(bname, fname);        /* derive the name of the buffer */
  683.     if ((bp = bfind(bname, TRUE, 0)) == NULL) /* get the needed buffer */
  684.         return(FALSE);
  685.  
  686.     bp->b_mode = MDVIEW;    /* mark the buffer as read only */
  687.     cb = curbp;        /* save the old buffer */
  688.     curbp = bp;        /* make this one current */
  689.     /* and try to read in the file to execute */
  690.     if ((status = readin(fname, FALSE)) != TRUE) {
  691.         curbp = cb;    /* restore the current buffer */
  692.         return(status);
  693.     }
  694.  
  695.     /* go execute it! */
  696.     curbp = cb;        /* restore the current buffer */
  697.     if ((status = dobuf(bp)) != TRUE)
  698.         return(status);
  699.  
  700.     /* if not displayed, remove the now unneeded buffer and exit */
  701.     if (bp->b_nwnd == 0)
  702.         zotbuf(bp);
  703.     return(TRUE);
  704. }
  705.  
  706. /*    cbuf:    Execute the contents of a numbered buffer    */
  707.  
  708. cbuf(f, n, bufnum)
  709.  
  710. int f, n;    /* default flag and numeric arg */
  711. int bufnum;    /* number of buffer to execute */
  712.  
  713. {
  714.         register BUFFER *bp;        /* ptr to buffer to execute */
  715.         register int status;        /* status return */
  716.     static char bufname[] = "[Macro xx]";
  717.  
  718.     /* make the buffer name */
  719.     bufname[7] = '0' + (bufnum / 10);
  720.     bufname[8] = '0' + (bufnum % 10);
  721.  
  722.     /* find the pointer to that buffer */
  723.         if ((bp=bfind(bufname, FALSE, 0)) == NULL) {
  724.             mlwrite("Macro not defined");
  725.                 return(FALSE);
  726.         }
  727.  
  728.     /* and now execute it as asked */
  729.     while (n-- > 0)
  730.         if ((status = dobuf(bp)) != TRUE)
  731.             return(status);
  732.     return(TRUE);
  733. }
  734.  
  735. cbuf1(f, n)
  736.  
  737. {
  738.     cbuf(f, n, 1);
  739. }
  740.  
  741. cbuf2(f, n)
  742.  
  743. {
  744.     cbuf(f, n, 2);
  745. }
  746.  
  747. cbuf3(f, n)
  748.  
  749. {
  750.     cbuf(f, n, 3);
  751. }
  752.  
  753. cbuf4(f, n)
  754.  
  755. {
  756.     cbuf(f, n, 4);
  757. }
  758.  
  759. cbuf5(f, n)
  760.  
  761. {
  762.     cbuf(f, n, 5);
  763. }
  764.  
  765. cbuf6(f, n)
  766.  
  767. {
  768.     cbuf(f, n, 6);
  769. }
  770.  
  771. cbuf7(f, n)
  772.  
  773. {
  774.     cbuf(f, n, 7);
  775. }
  776.  
  777. cbuf8(f, n)
  778.  
  779. {
  780.     cbuf(f, n, 8);
  781. }
  782.  
  783. cbuf9(f, n)
  784.  
  785. {
  786.     cbuf(f, n, 9);
  787. }
  788.  
  789. cbuf10(f, n)
  790.  
  791. {
  792.     cbuf(f, n, 10);
  793. }
  794.  
  795. cbuf11(f, n)
  796.  
  797. {
  798.     cbuf(f, n, 11);
  799. }
  800.  
  801. cbuf12(f, n)
  802.  
  803. {
  804.     cbuf(f, n, 12);
  805. }
  806.  
  807. cbuf13(f, n)
  808.  
  809. {
  810.     cbuf(f, n, 13);
  811. }
  812.  
  813. cbuf14(f, n)
  814.  
  815. {
  816.     cbuf(f, n, 14);
  817. }
  818.  
  819. cbuf15(f, n)
  820.  
  821. {
  822.     cbuf(f, n, 15);
  823. }
  824.  
  825. cbuf16(f, n)
  826.  
  827. {
  828.     cbuf(f, n, 16);
  829. }
  830.  
  831. cbuf17(f, n)
  832.  
  833. {
  834.     cbuf(f, n, 17);
  835. }
  836.  
  837. cbuf18(f, n)
  838.  
  839. {
  840.     cbuf(f, n, 18);
  841. }
  842.  
  843. cbuf19(f, n)
  844.  
  845. {
  846.     cbuf(f, n, 19);
  847. }
  848.  
  849. cbuf20(f, n)
  850.  
  851. {
  852.     cbuf(f, n, 20);
  853. }
  854.  
  855. cbuf21(f, n)
  856.  
  857. {
  858.     cbuf(f, n, 21);
  859. }
  860.  
  861. cbuf22(f, n)
  862.  
  863. {
  864.     cbuf(f, n, 22);
  865. }
  866.  
  867. cbuf23(f, n)
  868.  
  869. {
  870.     cbuf(f, n, 23);
  871. }
  872.  
  873. cbuf24(f, n)
  874.  
  875. {
  876.     cbuf(f, n, 24);
  877. }
  878.  
  879. cbuf25(f, n)
  880.  
  881. {
  882.     cbuf(f, n, 25);
  883. }
  884.  
  885. cbuf26(f, n)
  886.  
  887. {
  888.     cbuf(f, n, 26);
  889. }
  890.  
  891. cbuf27(f, n)
  892.  
  893. {
  894.     cbuf(f, n, 27);
  895. }
  896.  
  897. cbuf28(f, n)
  898.  
  899. {
  900.     cbuf(f, n, 28);
  901. }
  902.  
  903. cbuf29(f, n)
  904.  
  905. {
  906.     cbuf(f, n, 29);
  907. }
  908.  
  909. cbuf30(f, n)
  910.  
  911. {
  912.     cbuf(f, n, 30);
  913. }
  914.  
  915. cbuf31(f, n)
  916.  
  917. {
  918.     cbuf(f, n, 31);
  919. }
  920.  
  921. cbuf32(f, n)
  922.  
  923. {
  924.     cbuf(f, n, 32);
  925. }
  926.  
  927. cbuf33(f, n)
  928.  
  929. {
  930.     cbuf(f, n, 33);
  931. }
  932.  
  933. cbuf34(f, n)
  934.  
  935. {
  936.     cbuf(f, n, 34);
  937. }
  938.  
  939. cbuf35(f, n)
  940.  
  941. {
  942.     cbuf(f, n, 35);
  943. }
  944.  
  945. cbuf36(f, n)
  946.  
  947. {
  948.     cbuf(f, n, 36);
  949. }
  950.  
  951. cbuf37(f, n)
  952.  
  953. {
  954.     cbuf(f, n, 37);
  955. }
  956.  
  957. cbuf38(f, n)
  958.  
  959. {
  960.     cbuf(f, n, 38);
  961. }
  962.  
  963. cbuf39(f, n)
  964.  
  965. {
  966.     cbuf(f, n, 39);
  967. }
  968.  
  969. cbuf40(f, n)
  970.  
  971. {
  972.     cbuf(f, n, 40);
  973. }
  974.  
  975.  
  976.