The C[] Compiler Users Guide



Overview

The C[] compiler distribution provides two utilities for processing C[] source files, namely, cbc and cbcc. The cbc command line compiler is aimed at translating C[] source files into ANSI C files. Thus, building a C[] application with cbc requires two steps: obtaining the C file from the corresponding C[] source and compiling the C file. The cbcc C[] compiler driver combines the two steps, allowing to obtain executable and object files from the C[] source file at one step.


The cbc Compiler

cbc translates a C[] source file to the output C file. C[] source files use suffixe .cb  .

SYNOPSIS:


    cbc [options] file.cb

where options are arbitrary standard C preprocessor options and file.cb is the name of the C[] source file. cbc uses a standard C preprocessor and all options specified in the command line are passed to the preprocessor. The compiler output will be stored in file.c   .

For example, to compile test.cb, the following command line should be used:


    cbc test.cb

If compilation succeeds, file test.c will be placed in the current directory.

After cbc finished its job, the produced C file should be compiled. In the considered example, the corresponding command line looks as follows:

      gcc -I/home/johnsmith/CBC/h test.c 
where /home/johnsmith/CBC is the C[] compiler root installation directory. You should always compile C files produced by cbc with the -I<YOUR CBC ROOT INSTALLATION DIRECTORY>/h option, because a C[] compiler output contains #include directives including headers located in the <YOUR CBC ROOT INSTALLATION DIRECTORY>/h directory.


The cbcc Compiler Driver

cbcc first proceeds each of the specified C[] source files with cbc and then runs the C compiler to proceed obtained C files.

SYNOPSIS:


     cbcc [options|file]

where options are any valid native C compiler options, and file is any C[] source, C source, library or object file.

-I and -D options are passed to the cbc compiler. Other options are passed to the native C compiler.

Here is a sample cbcc session:

    bash-2.01$  cbcc -o f -DSOME_MACRO=1 -I/usr/include -O2 f.cb f1.cb f2.c 
    cbc  -DSOME_MACRO=1 -I/usr/include f.cb
    cbc  -DSOME_MACRO=1 -I/usr/include f1.cb
    gcc -I/home/posypkin/TMP/CBC/h  -DSOME_MACRO=1 -I/usr/include  -o f f.c f1.c -O2 f2.c 
    bash-2.01$