Ctalk has two parts: a preprocessor and interpreter that translates Ctalk code into C, which a compiler can use to create an executable program, and a run-time library, which the compiler links with the executable.
Ctalk has its own C99 compatible preprocessor, ctpp,
which is described in its Texinfo manual, ctpp.info.
To use ctalk, you must provide at least the name of the
input file. Normally, you also provide the name of the output file
with the ‘-o’ option. If you use the conventions followed by GNU
C, the output file is normally the base name of the input file with
the extension ‘.i’, as in this example.
$ ctalk myprog.c -o myprog.i
The ctalk program preprocesses myprog.c and
translates it into standard C. After ctalk has finished,
you can compile and link the output of ctalk to produce an
executable program.
$ gcc myprog.i -o myprog -lctalk
More conveniently, the ctcc command combines these
operations, with the appropriate command line options, to build an
executable program.
$ ctcc myprog.c -o myprog
If you need to build a program for debugging, the ctdb command
builds executables that you can debug with gdb. See Debugging.
For more information, refer to the ctalk(1), ctcc(1), ctdb(1), gcc(1), and gdb(1) manual pages.
--clearpreloadClear preloaded methods so they can be rewritten.
-EPreprocess the input and exit.
-h, --helpPrint a help message and exit.
-I dirAdd dir to the ctalk include search path.
--keeppragmasWrite pragmas untranslated to the output.
--nolibincDo not include Ctalk’s system headers in the output.
--nopreloadDo not use preloaded methods.
-o fileWrite the ctalk output to file.
--printlibdirsPrint the library directories and exit.
--printtemplatesPrint the templates that Ctalk loads and caches (but does not necessarily send to the output).
--progressPrint dots to indicate Ctalk’s progress.
-PDo not output line number information.
-s dirAdd dir to the compiler system include search path.
-VPrint the Ctalk version number and exit.
-v--verbosePrint verbose warnings. This option also sets the
--warnextension, --warnduplicatenames
and --warnunresolvedselexpr options.
--warnclasslibsPrint the names of class libraries as they are loaded.
--warnduplicatenamesPrint a warning when an object duplicates a C variable name. Because of the way Ctalk’s just-in-time interpreter works, the front end prints warnings of any duplicate names. The variables and objects need not be in the same scope. Usually, though, Ctalk can make an intelligent decision about how to process objects and variables with duplicate names. This option does not affect errors caused by duplicate symbols or shadowing.
--warnextensionPrint warnings for some compiler extensions.
--warnunresolvedselfexprPrints warnings if self appears in an argument block
with either an instance variable label or an unresolvable method
label following it. In expressions like these, the class of each
element of a collection, when represented by self within
the argument block, often can’t be determined until run time.
You can specify a class for self by placing a class cast
expression (described in the section Class casting) before
the self keyword. See Class casting.
For example, if a program contains an expression like this:
List new textLines;
...The program adds items to textLines...
textLines map {
if (self length > 0) {
...do something...
}
}
Then the expression, self length would generate a warning due to the
label, length, because the class membership of, self, which
represents each successive element of the, textLines, list,
normally isn’t determined until run time, and so the receiver class of
length is also undetermined.
However, if you know that textLines contains only String
objects, then you can add a class cast expression in the argument
block.
textLines map {
if ((String *)self length > 0) {
...do something...
}
}
This tells the program to treat length's receiver, self,
as a String object, so it’s possible to determine, before the program
is actually executed, whether, self length, is a valid
expression.