home *** CD-ROM | disk | FTP | other *** search
-
- .he CB - "C" Source Formatter 'Pretty Printer' Page #
-
- DESCRIPTION:
- This program takes as input a "C" source program file and
- formats it with the proper indents for each statement. The
- original input file is renamed as a .BAK file, and the
- formatted output is placed in a file with the same name as
- the original input. A command line option allows the indent
- level to be specified as from 1 to 8 spaces. This program
- will only run under DOS 2.0 and later.
-
- INVOCATION:
- CB inputfil [indent]
-
- inputfil Input "C" source program. This file should
- be a file that has compiled error free, as
- the formatter is not smart enough to pick up
- syntax errors.
-
- indent This is a number from 1 to 8 to specify the
- number of spaces for each indent level. The
- default spacing is 4.
-
- HELP:
- Typing CB with no file name displays a short help reminder.
-
- EXAMPLE:
- Run CB on file test, take default indent of 4.
-
- CB TEST
-
- *** <Contents of TEST before run, renamed TEST.BAK by CB> ***
-
- #include "stdio.h"
- double ran()
- /* Generate a random number between 0.0 and 1.0 */
- {
- double r;
- static unsigned int seed = 0;
- struct regval {
- int ax,bx,cx,dx,si,di,ds,es;
- };
- struct regval regs;
-
- if (seed==0) {
- regs.ax = 0x2C00; /* Set up the function */
- sysint (0x21,®s,®s);
- seed = regs.dx;
- }
- r = seed / 65536.;
- seed = (25173 * seed + 13849) % 65536;
- return(r);
- }
- .pa
- *** <Contents of file TEST after the run> ***
-
- #include "stdio.h"
- double ran()
- /* Generate a random number between 0.0 and 1.0 */
- {
- double r;
- static unsigned int seed = 0;
- struct regval {
- int ax,bx,cx,dx,si,di,ds,es;
- };
- struct regval regs;
-
- if (seed==0) {
- regs.ax = 0x2C00; /* Set up the function */
- sysint (0x21,®s,®s);
- seed = regs.dx;
- }
- r = seed / 65536.;
- seed = (25173 * seed + 13849) % 6553
- END OF TRANSFER - PRESS ENTER TO RETURN TO MENU
-