PPrrooggrraammmmiinngg CCOOHHEERREENNTT -- 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 _T_h_e _C _L_a_n_g_u_a_g_e in the first part of this manual.

The following  Lexicon entries  give you information  you need to  write or
port C programs under COHERENT:

CC kkeeyywwoorrddss
     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.

CC llaanngguuaaggee
     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.

CC pprreepprroocceessssoorr
     This   describes   the  processing   directives   that  the   COHERENT
     preprocessor recognizes.   Each directive is described  in full in its
     own Lexicon entry

hheeaaddeerr ffiilleess
     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.

lliibbrraarriieess
     This  describes the  libraries included  with COHERENT.   Almost every
     library  function  and system  call  has its  own  Lexicon entry;  the
     exceptions are the routines kept in lliibbmmiisscc.aa and lliibbccuurrsseess.aa.

If you are  an experienced C programmer who is  new to COHERENT, we suggest
you look  first at the  article for CC  llaanngguuaaggee, 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:

aarr   The archiver.  This turns a group of object modules into a library.

aass   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.

cccc   The C  compiler.  This describes the compiler  itself, and its options
     and switches.

ccpppp  The C  preprocessor.  The preprocessor  itself has its  own options to
     help you control the building of your programs.

ddbb   The symbolic debugger.   With ddbb, you can set breakpoints, single-step
     through code,  hot-patch binaries, and otherwise  debug your programs.
     It requires knowledge of 80386 assembly language.

lldd   The linker.  This links object modules into an executable binary.  The
     Lexicon entry describes its switches and features.

mmaakkee The programming discipline.  mmaakkee  helps you to manage the building of
     a  complex program.   It  is indespensible  for managing  all but  the
     simplest programming projects.

nnmm   This utility prints the contents of a program's symbol table.

sshh   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.

ssttrriipp
     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.

_D_e_f_i_n_i_t_i_o_n_s
The  following Lexicon  entries give technical  definitions of  interest to
programmers:

aaddddrreessss
     What an ``address'' is.

aalliiggnnmmeenntt
     What byte  alignment is, and how it applies  under the various machine
     on which COHERENT has been implemented

AANNSSII A brief introduction to the ANSI Standard for Programming Language C.

aarreennaa
     What an arena is, and how it applies to COHERENT programs.

aarrrraayy
     What an array is, and elementary information on how to code it.

AASSCCIIII
     The ASCII table.

bbiitt  What a bit is.

bbiitt mmaapp
     What a bit map is, and how to code it under C.

bbuuffffeerr
     What a buffer is, and how buffering affects your languages.

bbyyttee What a byte is.

bbyyttee oorrddeerriinngg
     This describes how bytes and words are ordered on the various machines
     on which COHERENT has been implemented.

ccaalllliinngg ccoonnvveennttiioonnss
     The calling conventions  for COHERENT functions.  This is particularly
     important if you are writing modules in assembly language.

ccaasstt How to ``coerce'' one data type into another.

cccc00  The COHERENT C parser.

cccc11  The COHERENT C code generator.

cccc22  The COHERENT C optimizer.

cccc33  The COHERENT  de-compiler.  It generates  a file of  assembly language
     for your examination.

ddaattaa ffoorrmmaattss
     This gives the  size of the common data types  on the various machines
     on which COHERENT has been implemented.

ddaattaa ttyyppeess
     The data types that COHERENT C recognizes.

eennvviirroonn
     This article introduces the  argument eennvviirroonn, which by default is the
     third  argument passed  to the  function  mmaaiinn() in  a C  program.  It
     points to image of the process's environment.

eerrrrnnoo
     This global  variable holds  the error  status returned by  a COHERENT
     system call.  The article eerrrrnnoo.hh interprets the codes that can appear
     in this variable.

eexxeeccuuttiioonn
     This  describes how  each form  of the system  call eexxeecc()  executes a
     program.

ffiieelldd
     Description of what a field is, and how to address it.

FFIILLEE Description of the FFIILLEE structure used by STDIO routines.

ffiillee What a file is.  It also goes into the ``black art'' of permissions.

ffiillee ddeessccrriippttoorr
     Description of the file descriptor used by COHERENT system calls.

ffuunnccttiioonn
     What a function is.

GGMMTT  A brief  introduction to  Greenwich Mean  Time, which is  the internal
     time for every COHERENT system.

iinniittiiaalliizzaattiioonn
     This describes the rules of initialization for C.

iinntteerrrruupptt
     What an interrupt is.

llvvaalluuee
     Definition of the ``left value'' in a C expression.

mmaaccrroo
     What a C macro is, and how COHERENT C processes them.

mmaanniiffeesstt ccoonnssttaanntt
     This  introduces  manifest constants,  and  lists  the constants  that
     COHERENT defines automatically.

mmoodduulluuss
     A definition of the modulus arithmetic operation.

NNUULL  Definition of the NUL character.

nnyybbbbllee
     What a ``nybble'' is.

oobbjjeecctt ffoorrmmaatt
     Definition of an object format.

ooppeerraattoorr
     A  list of  the  C operators.   This  article also  gives  a table  of
     precedence for the operators.

ppaatttteerrnn
     What a pattern is.

ppooiinntteerr
     What a pointer is, and tips for using pointers with COHERENT C.

ppoorrttaabbiilliittyy
     This gives some tips on how to write portable programs.

PPOOSSIIXX SSttaannddaarrdd
     A brief introduction to the POSIX Standard

rraannddoomm aacccceessss
     A definition of random access.

rreeaadd-oonnllyy mmeemmoorryy
     A definition of ROM, or ``read-only memory''.

rrvvaalluuee
     Definition of the ``right value'' in a C expression.

ssiiggnnaammee
     This  global array  holds a  string that describes  the signal  that a
     program has received.

ssttaacckk
     A  definition of  the program  stack, and how  to manipulate  it under
     COHERENT C.

ssttaannddaarrdd eerrrroorr
     Definition of the standard-error device.

ssttaannddaarrdd iinnppuutt
     Definition of the standard-input device.

ssttaannddaarrdd oouuttppuutt
     Definition of the standard-output device.

ssttddeerrrr
     The file descriptor of the standard-error device.

ssttddiinn
     The file descriptor of the standard-input device.

SSTTDDIIOO
     Definition of STDIO -- i.e., ``standard input and output''.

ssttddoouutt
     The file descriptor of the standard-output device.

ssttoorraaggee ccllaassss
     This entry  briefly summarizes the classes of  storage that COHERENT C
     recognizes

ssttrreeaamm
     Definition of a file stream.

SSTTRREEAAMMSS
     This article summarizes the COHERENT implemenation of STREAMS.

ssttrruuccttuurree
     Definition of a structure, and basic information on how to code it.

ssttrruuccttuurree aassssiiggnnmmeenntt
     This details structure assigment under COHERENT C.

ttyyppee cchheecckkiinngg
     This details type checking under COHERENT C.

ttyyppee pprroommoottiioonn
     This details type promotion under COHERENT C.

_O_t_h_e_r _L_a_n_g_u_a_g_e_s
COHERENT includes the following programming languages:

aawwkk  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.

bbcc   bbcc 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.

lleexx  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.

yyaacccc 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 lleexx 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.

_S_e_e _A_l_s_o
AAddmmiinniisstteerriinngg CCOOHHEERREENNTT, CCOOHHEERREENNTT, ccoommmmaannddss, UUssiinngg CCOOHHEERREENNTT
