Programming COHERENT" -- Overview" "
The C language is the ``native language'' of
COHERENT. Most COHERENT programs are written in C.
If you are a beginner and are interested in learning
something about C, look at the tutorial The C
Language in the first part of this manual.
The following Lexicon entries give you information you need
to write or port C programs under COHERENT:
- CC kkeeyywwoorrddss
- This lists the C keywords recognized by the COHERENT
implementation of C. Each keyword, in turn, is described in
full in its own Lexicon entry.
- CC llaanngguuaaggee
- This summarizes the COHERENT implementation of C. It
gives the size of each data type, formatting of floating-
point data, static limits, and other information.
- CC pprreepprroocceessssoorr
- This describes the processing directives that the
COHERENT preprocessor recognizes. Each directive is
described in full in its own Lexicon entry
- hheeaaddeerr ffiilleess
- This entry names the header files included as part of
COHERENT. Each header file is described in its own Lexicon
entry. Some of the header-file articles are of particular
interest.
- lliibbrraarriieess
- This describes the libraries included with COHERENT.
Almost every library function and system call has its own
Lexicon entry; the only exceptions are the routines kept in
libmisc.a and libcurses.a.
Each library has its own summary entry; of particular
interest are the entries libc,
libm, libgdbm, and
libsocket.
If you are an experienced C programmer who is new to
COHERENT, we suggest you look first at the article for C
language, to get an overview of the dialect of C
that COHERENT supports. Look at the entry for libraries, to
see what libraries are available; then look at the entry for
each library to see what functions are available.
The following Lexicon entries describe the commands with
which you can compile and manage your programs:
- aarr
- The archiver. This turns a group of object modules
into a library.
- aass
- The COHERENT macro-assembler. This assembles modules
written in assembly language, and builds object modules that
you can link with modules written in C or other languages.
- cccc
- The C compiler. This describes the compiler itself,
and its options and switches.
- ccpppp
- The C preprocessor. The preprocessor itself has its
own options to help you control the building of your
programs.
- ddbb
- The symbolic debugger. With db, you can
set breakpoints, single-step through code, hot-patch
binaries, and otherwise debug your programs. It requires
knowledge of 80386 assembly language.
- lldd
- The linker. This links object modules into an
executable binary. The Lexicon entry describes its switches
and features.
- mmaakkee
- The programming discipline. make
helps you to manage the building of a complex program. It
is indespensible for managing all but the simplest
programming projects.
- nnmm
- This utility prints the contents of a program's symbol
table.
- sshh
- The Bourne shell. This is of the COHERENT command
interpreter. You can write large, complex programs in the
shell. These can functions, and draw on a library of
prewritten functions. The shell is one of the most powerful
tools available to a COHERENT programmer -- and one of the
most neglected.
- ssttrriipp
- Strip the symbol table from a program. This makes most
programs significantly smaller, with no loss in
functionality.
Each command is described in its own Lexicon entry.
Definitions
The following Lexicon entries give technical definitions of
interest to programmers:
- aaddddrreessss
- What an ``address'' is.
- aalliiggnnmmeenntt
- What byte alignment is, and how it applies under the
various machine on which COHERENT has been implemented
- AANNSSII
- A brief introduction to the ANSI Standard for
Programming Language C.
- aarreennaa
- What an arena is, and how it applies to COHERENT
programs.
- aarrrraayy
- What an array is, and elementary information on how to
code it.
- AASSCCIIII
- The ASCII table.
- bbiitt
- What a bit is.
- bbiitt mmaapp
- What a bit map is, and how to code it under C.
- bbuuffffeerr
- What a buffer is, and how buffering affects your
languages.
- bbyyttee
- What a byte is.
- bbyyttee oorrddeerriinngg
- This describes how bytes and words are ordered on the
various machines on which COHERENT has been implemented.
- ccaalllliinngg ccoonnvveennttiioonnss
- The calling conventions for COHERENT functions. This
is particularly important if you are writing modules in
assembly language.
- ccaasstt
- How to ``coerce'' one data type into another.
- cccc00
- The COHERENT C parser.
- cccc11
- The COHERENT C code generator.
- cccc22
- The COHERENT C optimizer.
- cccc33
- The COHERENT de-compiler. It generates a file of
assembly language for your examination.
- ddaattaa ffoorrmmaattss
- This gives the size of the common data types on the
various machines on which COHERENT has been implemented.
- ddaattaa ttyyppeess
- The data types that COHERENT C recognizes.
- eennvviirroonn
- This article introduces the argument
environ, which by default is the third
argument passed to the function main() in a C
program. It points to image of the process's environment.
- eerrrrnnoo
- This global variable holds the error status returned by
a COHERENT system call. The article
errno.h interprets the codes that can
appear in this variable.
- eexxeeccuuttiioonn
- This describes how each form of the system call
exec() executes a program.
- ffiieelldd
- Description of what a field is, and how to address it.
- FFIILLEE
- Description of the FILE structure used
by STDIO routines.
- ffiillee
- What a file is. It also goes into the ``black art'' of
permissions.
- ffiillee ddeessccrriippttoorr
- Description of the file descriptor used by COHERENT
system calls.
- ffuunnccttiioonn
- What a function is.
- GGMMTT
- A brief introduction to Greenwich Mean Time, which is
the internal time for every COHERENT system.
- iinniittiiaalliizzaattiioonn
- This describes the rules of initialization for C.
- iinntteerrrruupptt
- What an interrupt is.
- LLaattiinn 11
- The table ISO Latin 1 (ISO 8859.1).
- llvvaalluuee
- Definition of the ``left value'' in a C expression.
- mmaaccrroo
- What a C macro is, and how COHERENT C processes them.
- mmaanniiffeesstt ccoonnssttaanntt
- This introduces manifest constants, and lists the
constants that COHERENT defines automatically.
- mmoodduulluuss
- A definition of the modulus arithmetic operation.
- NNUULL
- Definition of the NUL character.
- nnyybbbbllee
- What a ``nybble'' is.
- oobbjjeecctt ffoorrmmaatt
- Definition of an object format.
- ooppeerraattoorr
- A list of the C operators. This article also gives a
table of precedence for the operators.
- ppaatttteerrnn
- What a pattern is.
- ppooiinntteerr
- What a pointer is, and tips for using pointers with
COHERENT C.
- ppoorrttaabbiilliittyy
- This gives some tips on how to write portable programs.
- PPOOSSIIXX SSttaannddaarrdd
- A brief introduction to the POSIX Standard
- rraannddoomm aacccceessss
- A definition of random access.
- rreeaadd--oonnllyy mmeemmoorryy
- A definition of ROM, or ``read-only memory''.
- rreeccuurrssiioonn
- A definition of this programming technique.
- rrvvaalluuee
- Definition of the ``right value'' in a C expression.
- ssiiggnnaammee
- This global array holds a string that describes the
signal that a program has received.
- ssttaacckk
- A definition of the program stack, and how to
manipulate it under COHERENT C.
- ssttaannddaarrdd eerrrroorr
- Definition of the standard-error device.
- ssttaannddaarrdd iinnppuutt
- Definition of the standard-input device.
- ssttaannddaarrdd oouuttppuutt
- Definition of the standard-output device.
- ssttddeerrrr
- The file descriptor of the standard-error device.
- ssttddiinn
- The file descriptor of the standard-input device.
- SSTTDDIIOO
- Definition of STDIO -- i.e., ``standard input and
output''.
- ssttddoouutt
- The file descriptor of the standard-output device.
- ssttoorraaggee ccllaassss
- This entry summarizes the classes of storage that
COHERENT C recognizes.
- ssttrreeaamm
- Definition of a file stream.
- SSTTRREEAAMMSS
- This article summarizes the COHERENT implemenation of
STREAMS.
- ssttrruuccttuurree
- Definition of a structure, and basic information on how
to code it.
- ssttrruuccttuurree aassssiiggnnmmeenntt
- This details structure assigment under COHERENT C.
- ssttttyy
- Summary of the stty interface to
terminals.
- tteerrmmiioo
- Introduction to the termio terminal
interface.
- tteerrmmiiooss
- This summarizes the POSIX Standard" extensions to the
termio terminal interface.
- ttyyppee cchheecckkiinngg
- This details type checking under COHERENT C.
- ttyyppee pprroommoottiioonn
- This details type promotion under COHERENT C.
Other Languages
COHERENT includes the following programming languages:
- aawwkk
- This interpreted language lets you write programs for
text processing. It is especially good at processing
tabular information, thus letting you quickly write simple
data-base programs.
- bbcc
- bc is a calculator program that offers
infinite magnitude and infinite precision. This is an
interpreted langauge that you can program on the fly to
perform simple tasks, such as computing interest payments on
the national debt. You can also write programs that you can
run repeatedly. These can also take advantage of a library
of routines already written for you.
- lleexx
- This program reads a set of lexical analysis rules that
you write in a standard form, and generates a C program that
you can compile and run.
- yyaacccc
- This program reads a set of parsing rules that you
write in Backus-Naur Form, and generates a C program that
you can compile and run. You can use with code generated by
lex to write complex programs, such as
compilers.
Each of these languages is described in a Lexicon article.
The front of the manual has a tutorial for each.
See Also