home *** CD-ROM | disk | FTP | other *** search
/ Boston 2 / boston-2.iso / DOS / PROGRAM / C / CB / CB.DOC next >
Text File  |  1993-12-01  |  2KB  |  77 lines

  1.  
  2. .he CB - "C" Source Formatter   'Pretty Printer'      Page #
  3.  
  4. DESCRIPTION:
  5.      This program takes as input a "C" source program file and 
  6.      formats it with the proper indents for each statement.  The 
  7.      original input file is renamed as a .BAK file, and the 
  8.      formatted output is placed in a file with the same name as 
  9.      the original input.  A command line option allows the indent 
  10.      level to be specified as from 1 to 8 spaces.  This program 
  11.      will only run under DOS 2.0 and later.
  12.  
  13. INVOCATION:
  14.                CB inputfil [indent]
  15.  
  16.      inputfil       Input  "C" source program.   This file should 
  17.                     be  a file that has compiled error  free,  as 
  18.                     the formatter is not smart enough to pick  up 
  19.                     syntax errors.
  20.  
  21.      indent         This  is a number from 1 to 8 to specify  the 
  22.                     number of spaces for each indent level.   The 
  23.                     default spacing is 4.
  24.  
  25. HELP:
  26.      Typing CB with no file name displays a short help reminder.
  27.  
  28. EXAMPLE:
  29.      Run CB on file test, take default indent of 4.
  30.  
  31.                CB TEST
  32.  
  33.      *** <Contents of TEST before run, renamed TEST.BAK by CB> ***
  34.  
  35.      #include "stdio.h"
  36.      double ran()
  37.      /*        Generate a random number between 0.0 and 1.0    */
  38.      {
  39.      double r;
  40.      static unsigned int seed = 0;
  41.      struct regval { 
  42.      int ax,bx,cx,dx,si,di,ds,es; 
  43.      };
  44.      struct regval regs;
  45.  
  46.      if (seed==0) {
  47.      regs.ax = 0x2C00;        /* Set up the function */
  48.      sysint (0x21,®s,®s);
  49.      seed = regs.dx;
  50.      }
  51.      r = seed / 65536.;
  52.      seed = (25173 * seed + 13849) % 65536; 
  53.      return(r);
  54.      }
  55. .pa
  56.      *** <Contents of file TEST after the run> ***
  57.  
  58.      #include "stdio.h"
  59.      double ran()
  60.      /*        Generate a random number between 0.0 and 1.0    */
  61.      {
  62.          double r;
  63.          static unsigned int seed = 0;
  64.          struct regval { 
  65.               int ax,bx,cx,dx,si,di,ds,es; 
  66.          };
  67.          struct regval regs;
  68.  
  69.          if (seed==0) {
  70.               regs.ax = 0x2C00;    /* Set up the function */
  71.               sysint (0x21,®s,®s);
  72.               seed = regs.dx;
  73.          }
  74.          r = seed / 65536.;
  75.          seed = (25173 * seed + 13849) % 6553
  76. END OF TRANSFER - PRESS ENTER TO RETURN TO MENU
  77.