This file contains a very brief description of the source,  CGLE was
my first project in C so my 'style' changed rather drastically
from module to module.

The files that are most likely to need changing for porting purposes 
are:
	unixscr.c
		This deals with output to the screen, it doesn't 
		use multiple windows, just positioning and scrolling.
	unixinkey.c
		This has to interpret key strokes into the keyboard
		commands defined in edt.h
	d_*.c
		This is the device driver, (assuming one of the 
		standard ones won't do)  I'd suggest you start with
		the nearest and then modify it.


First a brief overview of the main modules (this list was compiled
before gle was ported to UNIX so some files names are different
for the unix version, e.g. unixscr.c instead of cursesscr.c:

GLE.C		The MAIN() program which calls edt or drawit.
		depending on weather or not it is an interactive
		or output driver.

EDT.C		EDT like editor which the user is normally in.
		When you press F10 it calls DRAWIT
MENU.C		The routines for dealing with the GRAPH form.

DRAWIT.C	Main routine for drawing the current GLE file, this calls
		TOKEN.C to tokenize each line, then PASS.C to compile the 
		gle commands into PCODE then finally it runs thru the 
		PCODE calling RUN.C for each line of pcode.
POLISH.C	Passes expression, produces reverse polish pcode exp.
EVAL.C		Evaluates pcode expression.
GLOBAL.H	Structures and data for PASSing gle source
PASS.C		For passing each line of gle file, produces pcode.
RUN.C		Executes one line of pcode. (draws it)


-----------------------------------------------------------------------------
The basic format of the pcode is a list of LONG integers, the first 
one is the command (amove, if, text, box, etc) then come
any requred parameters, followed by optional parameters in 
a pre-defined sequence, if the paramter is present then it is 
either a constant integer value (0 if not present) or an expression
in which case the value is a pointer to the end of this line of pcode
where the expression pcode will be found.
e.g.

3,1,3,2,999,999,1,3,2,999,999,1,1,1,3,2,999,999

Would read as:	
	3 = box, expecting two expressions, color pointer, justify flag
	1 = Start of expression
	3 = Length of expression in long words
	2 = floating point number follows
	999,999 = double precision floating point number 
	1 = Start of expression
	3 = Length of expression in long words
	2 = floating point number follows
	999,999 = double precision floating point number 
	1 = justify left
	1 = There is a fill color,  and it starts  the next number along
	1 = Start of expression (which is a color)
	3 = Length of expression in long words
	2 = floating point number follows
	999,999 = double precision floating point number 

Complicated eh?, I'm sure I had a good reason for it!!!.

It's actually fairly easy to use, there are routines to deal 
with all the messy bits.
-----------------------------------------------------------------------------
To define a new command you would do the following:
	1) Add the keyword to KEYWORD.C (in alphabetical order)
	2) EDT GLOBAL.H and define the syntax of any optional
	   parameters, (heres that done for BOX)

struct op_key op_box[] = {
		 "JUSTIFY", 	typ_justify, 	1, 0
		,"JUST", 	typ_justify, 	1, 0
		,"NOSTROKE", 	typ_switch, 	2, 1
		,"NOBORDER", 	typ_switch, 	2, 1
		,"FILL", 	typ_fill, 	3, 0
		,"NAME", 	typ_str, 	4, 0
		,"END", 	typ_end, 	0, 0  };

	3) Add a few lines in PASS.C to compile the command, e.g.

case 7 :	/* box x y  [left | center | right]  [fill xxx] name*/
	get_xy();
	get_optional(op_box);
	break;

	4) Add a few lines to RUN.C to execute the command. e.g.
case 1:  /* ALINE x y ARROW both | start | end */
	readval(x);
	readval(y);
	marrow = *(pcode + (cp++));
	if (marrow>0) g_get_xy(&ox,&oy);
	if (marrow & 1)  g_arrow(x-ox,y-oy);
	g_line(x,y);
	if (marrow & 2)  g_arrow(ox-x,oy-y);
	break;

-----------------------------------------------------------------------------
Adding a command to the graph module is much easier, as it doesn't
compile first.  For example when I added the GRID command to the 
xaxis and yaxis I only had to add the lines:
--
static int xxgrid[5];
--
		   else kw("GRID") xxgrid[t] = true;
--
	for (i=1;i<=4;i++) {
		if (xxgrid[i]) {
			if ((i & 1) == 1) {
				xx[i].ticks_length = ylength;
			} else {
				xx[i].ticks_length = xlength;
			}
			xx[i].subticks_length = .0000001;
		}
	}
--
to GRAPH.C.  The array xx[] contains the structures which define the 
four axis'es.
	
-----------------------------------------------------------------------------
This version of CGLE gives a very BAD emulation of TEX, it is 
really only TEX-Like in appearance, there are bugs and gaps in 
the TEX-primitives which result in most of the power not being available. 

A PCODE mechanism is used by the TEX module to process text.
First any macro's in the paragraph are executed, giving a larger
paragraph with only text and TEX-primitives, then this is run 
thru a routine which converts it into pcode. e.g.
	1 = font,character
	2 = move, x, y
	3 = glue,stretch,shrink
	etc.
This is then wrapped and filled at the correct width, the glue is 'set'
and then as a last step the text is drawn.
-----------------------------------------------------------------------------

AXIS.C
	The routines for drawing an axis (x,y,x2,y2) is passed a 
	structure defined in AXIS.H which describes the axis.

BEGIN.C
	Some utility routines for dealing with the begin...end structures.

	begin_token(long **pcode,int *cp,int *pln,char *srclin,char *tk,int *ntk,char *outbuff)
	begin_init()
	begin_next_line(long *pcode, int *cp)

B_TAB.C
	The BEGIN TABLE routines.

B_TEXT.C
	The BEGIN TEXT routines, (calls TEX.C for most of the guts)

CORE.C
	Core graphics routines, g_*(),  this is the only file which 
	makes calls to the driver routines d_*()

CURVE.C
	A routine to convert CURVE X Y  X Y  X Y   etc into a sequence
	of bezier curves.

DRAWIT.C
	Main routine for drawing the current GLE file, this calls
	PASS.C to compile the gle commands into PCODE and then 
	calls DO_PCODE (RUN.C) to execute each line of cgle.

DVIBIT.C
	Common part of the pc bitmap drivers.
	
DVIEP24.C
	Epson 24pin driver.

DVIEPSON.C
	Epson 8pin driver.

DVILJ.C
	Laser Jet driver.

DVILJ300.C
	300dpi laserjet driver.

DVISCR.C
	Test bitmap driver which outputs to the screen

D_DVI.C
	Generic DVI driver, create OUT.DVI files read by bitmap drivers.
	the OUT.DVI file contains vector and fill commands.

D_HPGL.C 	HPGL plotter driver.
D_P79.C		P79 driver 
D_PC.C		PC driver
D_PS.C		PostScript driver
D_REGIS.C	Regis (vt125, vt240) driver
D_TEK.C		Tek4010 Driver
D_UIS.C		vax vws/uis Driver
D_VT100.C	VT100 driver
D_X.C		DEC_Xwindow driver
EASYDEV.C	Some routines to emulate clever things for dumb devices
EDT.C		EDT like editor which the user is normally in.
EVAL.C		Evaluates pcode expression.
EXITCMD.C	
FBUILD.C	For building font .FVE files from .GLE files.
FITBEZ.C	Fits smooth curve to a dataset.
FITCF.C		Actual routine for doing the smooth fit.
FN.C		Used by PASS to find functions/subroutine names
FONT.C		Routines for loading font files .fmt, .fve
GENERAL.C	A couple of odd utility routines
GLE.C		The MAIN() program which calls edt or drawit.
GPRINT.C	Error messages are done thru GPRINT instead of PRINTF
GRAPH.C		Main GRAPH compile routine
GRAPH2.C	Graph draw routines
KEY.C		Deals with BEGIN KEY ... 
KEYWORD.C	Key words (binary search) and TEX key words.
MAKEFMT.C	Makes font .FMT files from adobe  .AFM files.
MEMORY.C	Handles memory allocating and freeing.
MENU.C		Graph menu, and file selection menu.
MOUSE.C		BIOS routines to use mouse.
MYCHAR.C	For drawing characters using lines (instead of built in fonts)
NAME.C		For finding/defining NAME'd objects
PARSEAFM.C	Part of MAKEFMT
POLISH.C	Passes expression, produces reverse polish pcode exp.
PRINTBIT.C	Part of bitmap drivers.
RUN.C		Executes one line of pcode. (draws it)
SUB.C		Finds/defines subroutines
TEX.C		LATEX text emulation stuff.
TOKEN.C		Tokenizes one line, based on spaces, or special characters
TURBO.C		Some vax equivalents to turboc routines
TURBOSCR.C	TurboC windowing calls 
VAR.C		Varialbe define/find
VAXINKEY.C	Vax routine for retrieving one character.
VAXSCR.C	Vax routines for emulating some turbo-c screen calls

ALL.H		Header file use by everything to load in standard .h files
AXIS.H		Defines AXIS structures
BEGIN.H		Define BEGIN... structures
BITMAP.H	For BITMAP drivers
COLOR.H		Defines some GLE format color macros.
CORE.H		Prototypes for CORE routines, and data structures.
EDT.H		EDT keypad definitions
GLEPRO.H	Prototypes for most routines.
GLOBAL.H	Structures and data for PASSing gle source
GRAPH.H		Graph strutures and data 
MYDEV.H		Device driver structures and data
