This class provides a text editor specialized for editing
C files.
It is invoked automatically when opening any file with the
.c
extension
in its name.
The EditC class is derived from the
EditProgram class, and
therefore inherits all of its features.
Compile
and Compile and Load
.
The Compile
choice brings up the Monitor widget which
will run make
and compile the current file.
The Compile and Load
menu choice
will compile the current file and load it back
into Tycho by using the Tcl load
command. The Compile and Load
menu choice can be used
to create new Tcl commands that are written in C.
Note that it is risky to test C code within Tycho, since failure
of the C code could cause Tycho to crash.
When a C file is compiled and loaded, the following steps occur.
load
command is to work on a particular
file, then there must be a Tcl initialization procedure in the C file
(see below for details). The Add Tcl Initialization
choice under the Special
menu will add an initialization
procedure.
Since Tycho can't know what commands you want to register, the initialization procedure will have a body that must be modified by the user.
makefile
Makefile
.mk
extension. For example, if the file being
is named myTclCommands.c
, then we look for
myTclCommands.mk
make
command is executed with the makefile
determined from the step above. Continuing our example above, the
command would be make -f myTclCommand.mk
.
load
command is called. The
load
command is passed the architecture dependent shared
object filename.
.mk
extension.
The template that is used is located at $TYCHO/editors/textedit/templates/Cmakefile.mk
.
The template includes two makefiles: $TYCHO/obj.$PTARCH/java.mk
and $TYCHO/obj.$PTARCH/tcl.mk
These two makefiles are generated by running configure
.
The Tcl extensions use these file as well, see
$TYCHO/doc/coding/buildtclexts.html
for details.
If these two makefiles are not present, then make
config_tclexts
is called while in the $TYCHO
directory.
load
command invokes an initialization procedure
after loading the shared object. The name of the initialization
procedure depends on the file name of the shared object, or on the Tcl
package name. See the
load
command for the details, but if the shared object is named myTclCommand.so
, then the initialization procedure would be
int Mytclcommand_InitProc(Tcl_Interp *interp)Usually the initialization procedure registers commands, for example
int Mytclcommand_InitProc(Tcl_Interp *interp) { Tcl_CreateCommand (interp, "mytclcommand", Tcl_MyTclCommandCmd, (ClientData) infoPtr, (Tcl_CmdDeleteProc*) NULL); return TCL_OK; }