cdlc(1)

NAME
cdlc - compiler for CDL3 sources.

SYNOPSYS
cdlc [-s] [-t] [-g] [-d] [-f] [-r] [-W] [-L path] filename

WARNING
The information in the man page is an extract from the full documentation of the CDL3 compiler. As CDL3 tends to evolve over time, this man page might not always be up to date.

DESCRIPTION
cdlc compiles CDL3 source code into object files, which are linked to cdl's runtime system to create executables using gcc(1). The cdlc binary is likely to be found in /usr/pkg/bin on your installation. cdlc requires the file predef.k3 to be present on its library path. You specify the cdlc library path using the -L switch. On your installation, the library path is probably /usr/pkg/share/cdl3/include

A typical compile of a CDL3 file hello.k3 is as follows:
    cdlc -L /usr/pkg/share/cdl3/include/ hello.k3
    gcc -L /usr/pkg/lib hello.o -lcdlrts -lm -o hello
This results in the executable 'hello' in the current directory. (Mind the final slash on the cdlc library path, this is a small annoyance that'll bite you some day.) It is recommended to use make(1) to call cdlc. An example Makefile is included in the CDL3 distribution. It is probably installed in /usr/pkg/share/cdl3/examples

OPTIONS
Options must be separated: `-sg' is different from `-s -g'.

-d  Switch debugging mode 'ON'.

-s  No code, no optimizations.

-g  No optimizations.

-t  Switch tracing mode 'ON'.

-l  Produce statistics.

-_  External names do not start with underscore.

-W  Switch warning mode 'ON'.

-L path/to/include/files/
    Set library path to path/to/include/files/ Do not forget the last forward slash in this path. On your installation, this path is probably /usr/pkg/share/cdl3/include

-f  No gc, remove 'glue code' at all.

-r  Dump gc, remove 'glue code' optimization.

-n  No pull.

-funreachable
    Ignore unreachable code.

-no-inline
    Disable inlining.

-inline  name
    Inline name

-p  Switch profile mode 'ON'.

-c  Just compile and produce no object file, but produce C code in stead.

-h  Show usage message.
    someprompt$ cdlc -h
    CDL compiler V1.2 by Erik Verbruggen

    Usage: cdl [-s] [-t] [-g] [-d] [-f] [-r] [-L paths] filename

-DCOUNT
    Something with statistics (probably deprecated, seen in older versions as -D nr).

FILES
The CDL3 installation on your system was configured to install into the following locations:

/usr/pkg/bin/cdlc
    the cdl compiler

/usr/pkg/share/cdl3/include/cdl3rts.h

/usr/pkg/share/cdl3/include/predef.h

/usr/pkg/share/cdl3/include/predef.k3
    predefined calls in cdl3. See cdlrts(3) for more information.

/usr/pkg/lib/libcdlrts.a

/usr/pkg/lib/libcdlrts.la
    the CDL run time system, to be linked against your object files.

/usr/pkg/share/cdl3/doc/cdl3-manual-VERSION.ps
    a 100+ page language manual for CDL3.

/usr/pkg/share/cdl3/examples/Makefile.example

/usr/pkg/share/cdl3/examples/hello.k3
    a tiny "Hello World" example to get you started.

ENVIRONMENT
These are environment variables that can be set but are undocumented for the moment.

CDL3USAGE

DUMP_ALTERNATIVE

CDL_TRACE
    Dump intermediary code and generate a SIGSEGV. But that last action is not intended nor seen on all hardware.

CDLDEBUG

CDLLIB

CDL3CPP

INLINE

RECURSION

CDL_FANCY_ERRORS
    intentionally left undocumented to brighten up a dull day

ENVIRONMENT (obsolete)
These are evironment variables that can be set according to the cdl3 documentation but source code suggests that they might be obsolete:

CDL3CC
    get c compiler command (default: gcc)

CDL3CFLAGS
    get cc options (default: -xc -O -c)

MAKEFILE
It is customary to use makefiles for (small) project management. As an example a makefile for any CDL3 project can contain the following lines.
#
# example makefile
#
CC       = gcc
LIBS     =
CDLC     = /usr/pkg/bin/cdlc
CDLFLAGS = -L /usr/pkg/share/cdl3/include/ -W
LDFLAGS  = -L /usr/pkg/lib
LDLIBS   = -lcdlrts -lm
SRC=hello.k3
OBJ=hello.o
.SUFFIXES: .k3
all: hello
	$(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS) $(LDLIBS)
%.o: %.k3
	$(CDLC) $(CDLFLAGS) $<
hello.o: hello.k3

BUGS
Some bugs have been removed. And the -h option does not (yet) show all active options. But see cdlfubar(7) for some features partially documented.

SEE ALSO
The CDL3 syntax and semantics are explained in the CDL3 manual, included with the distribution.
cdlrts(3).

COPYING
Copyright (C) 2000 C.H.A. Koster
CDL3 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
CDL3 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License along with this version of CDL; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA