Qsr Nrwn

Website


C Programming Language, Nice C Tool

NiceC

Version 4

Copyright 1997 Roger Moser, Switzerland


What is it

NiceC is a fast, learning and easy to use C source formatter. It completely formats C or C++ source codes according to your style which it has learned from a sample of your source code.

Installation

Copy NICEC.EXE to a subdirectory that is listed in the DOS PATH and then let NiceC learn your style by running "nicec -l sample.c". That's all.

If you are upgrading from version 1, you should run "nicec -l nicec.cfg" and then check in nicec.cfg if the style of "x::x():a() {}" is your style.

NICEC.EXE contains both versions, 16-bit and 32-bit. If you start it under Windows 95 or NT, the 32-bit version runs which can process long file names.

Otherwise the 16-bit version runs.

Usage, Command line options

Usage:
NICEC [options] filenames
NICEC [options] <input >output
Options:
-l                learn
-tn[,n]           tab spacing in input andd output file
-tn,0             no tabs in output file
-b                if, else, for, while andd do always with {}
-cfilename[.cfg]  configuration file
>
Default:
-t8,8
-cNICEC.CFG

You can specify more than one filename and wildcards are allowed.

Configuration file

NiceC saves your style in a configuration file. The default name is NICEC.CFG (in the same subdirectory as NICE.EXE). If you detect errors, you may modify the configuration file with an ASCII editor.

The meaning of the configuration file should be clear except following:

Configuration fileExplanation
char *t[] = {0, 1, 2}; //
If there is a tab before '2' then NiceC preserves the tabs within a initialization list.
If there is a tab before '//' then NiceC preserves the tabs before comments.
void calculate(int a,
                            int b);
The indentation of the continuation of the function declaration defines whether the continuation has a fixed indentation or is aligned to '('.
a	b;
If there is a tab between 'a' and 'b' then NiceC preserves the tabs within statements.
stat1;
stat2;
If 'stat1;' and 'stat2;' are on separate lines then NiceC will put every statement on a separate line.
  if (ok && i == k & 2
      || x > 0)
          while (ok
              && i > 0)
The indentation of the continuation of the 'if' and the 'while' statement defines whether the continuation has a fixed indentation or is aligned to '('.
calculate(v1,
                  v2);
The indentation of the continuation of the function call defines whether the continuation has a fixed indentation or is aligned to '('.
lab:
If 'lab:' is at the first column then NiceC will put all labels at the beginning of the line. Otherwise it will outdent the labels according to the relative position of 'lab:'.

Miscellaneous

NiceC always creates backup files with the extension .BAK (or .BK0, .BK1 etc. if there would be a name conflict).

NiceC is a copyright reserved free software. That means, you may use and distribute it freely but you may not pretend that you have written it.

Known problems

History

Version 4 (22-Jul-97):

Bug fix:
	struct {
		void (*f)();
	};

Version 3 (08-Feb-97):

Bug fix:

Version 2 (06-Feb-97):

New features:
Bug fixes:

Version 1 (17-Sep-95):

Feedback

If NiceC cannot learn your style or if it changes your source in an undesired way then please send me a E-mail with a small example of your source code and the configuration file.

Roger Moser
CompuServe 100111,762 ([email protected])

[Home]|[Start]|[C Source Code Index] 1