head     1.1;
access   ;
symbols  ;
locks    kodiak:1.1; strict;
comment  @# @;


1.1
date     86.07.11.12.11.18;  author tim;  state Exp;
branches ;
next     ;


desc
@Main header file for BCPL compiler.
@



1.1
log
@Initial revision
@
text
@/****************************************************************************/
/*                                                                          */
/*       #######     #####   #######   ##    ##  ######    #######          */
/*       ########   #######  ########  ##    ##  #######   ########         */
/*       ##    ##  ##        ##    ##  ##    ##  ##    ##  ##    ##         */
/*       #######   ##        #######   ########  ##    ##  ########         */
/*       ##    ##  ##        ##        ##    ##  ##    ##  #######          */
/*       ##    ##  ##        ##        ##    ##  ##    ##  ##  ##           */
/*       ########   #######  ##        ##    ##  #######   ##   ##          */
/*       #######     #####   ##        ##    ##  ######    ##    ##         */
/*                                                                          */
/****************************************************************************/

// (C) Copyright 1979 Tripos Research Group
//     University of Cambridge
//     Computer Laboratory
// (C) Copyright 1985 All Rights Reserved METACOMCO plc
//     26 Portland Square
//     Bristol

/****************************************************************************/
/*                                                                          */
/* These sources must be compiled with an operating system flag set TRUE.   */
/*                                                                          */
/* Options available for opearating systems are:                            */
/*                                                                          */
/*     TRIPOS     (in house for Sage/DarkStar MC68000)                      */
/*     MTRIPOS    (in house for MetaTRIPOS on any MC68000)                  */
/*     UNIX4      (for compiler to run on SUN MC68010)                      */
/*     UNIX5      (for compiler to run on BLEASEDALE MC68010)               */
/*     AMIDOS     (for compiler to run on AMIGA PC)                         */
/*     TOS        (for compiler to run on ATARI ST)                         */
/*                                                                          */
/* They must also have a 'customer' flag set TRUE which will restrict       */
/* options available to the user of the compiler                            */
/*                                                                          */
/* Customer options available are                                           */
/*                                                                          */
/*     MCC        (in house compiler - all options available)               */
/*     AMIGA      (compiler released on Commodore-Amiga PC)                 */
/*     IMPERIAL   (compiler released to Imperial Software)                  */
/*     ATARI      (compiler released on Atari ST)                           */
/*     RELEASE    (standard compiler sold with tripos)                      */
/*                                                                          */
/* Other optional flags available are:-                                     */
/*                                                                          */
/*     MACRO      (To allow front end to process macros)                    */
/*     JUMPS      (To make back end optimise jumps)                         */
/*     EXT        (Include code to allow EXTERNAL declarations)             */
/*     WORD       (Include code to allow word pling operator %%)            */
/*     OVLAID     (To make an overlayed compiler - Root+syn/trn+cg          */
/*     OVLOAD     (Loader can cope with overlays)                           */
/*                                                                          */
/****************************************************************************/

$<UNIX5
$$UNIX := TRUE
$>UNIX5
$<UNIX4
$$UNIX := TRUE
$>UNIX4

$<OVLAID
$$OVLOAD := $$TRIPOS || $$AMIDOS
$>OVLAID

MANIFEST
$(
   glob.callargs  = ug + 25
   glob.formtree  = ug + 27
   glob.compileae = ug + 28
   glob.callcg    = ug + 29

$<OVLAID
   pg          = ug + 110    // global base for overlay private globals
   sg          = pg          // base of globals in synhdr
   tg          = sg + 52     // base of globals in trnhdr
   cg          = pg          // base of globals in cghdr
$>OVLAID
$<OVLAID'
   sg          = ug + 110    // base of globals in synhdr
   tg          = sg + 52     // base of globals used in trnhdr
   cg          = tg + 77     // base of globals used in cghdr
$>OVLAID'

   topglob     = cg + 175    // highest global used in program (in cg)
   minstack    = 1500        // minimum stack size needed to run

   // Object module types
   o.tripos    = 1
   o.unix4.2   = 2
   o.unix5.0   = 3
   o.amigados  = 4
   o.gst       = 5
   o.tos       = 6
   o.mtripos   = 7

   // Global number of fpsim for systems other than tripos
   unixfpsim   = 32
   amigafpsim  = 122
   atarifpsim  = 119

   // chip types
   c.m68000    = 1
   c.m68010    = 2   // important for generating FP code
   c.m68020    = 3
$)

GLOBAL
$(
// Highest.global

highest.global   : topglob

rc               : ug + 0
fromfile         : ug + 1
verstream        : ug + 2
sysopt           : ug + 2     // synonym for compiler
ocodestream      : ug + 3
codestream       : ug + 4
datvec           : ug + 5
err.p            : ug + 6
err.l            : ug + 7
ocodefile        : ug + 8
ocode            : ug + 9

// CG options
cgworksize       : ug + 10
cglisting        : ug + 11
naming           : ug + 12
callcounting     : ug + 13
profcounting     : ug + 14
stkchking        : ug + 15
restricted       : ug + 16
altobj           : ug + 17
cg.a             : ug + 18
cg.b             : ug + 19
workspace        : ug + 20
plisttree        : ug + 21

$<TOS
userexit         : ug + 22
sysin            : ug + 23
ovhome           : ug + 24
cont.errs        : ug + 26
$>TOS
$<UNIX
tidyup           : ug + 22
$>UNIX

call.args        : glob.callargs    // [ug+25]
formtree         : glob.formtree    // [ug+27]
compileae        : glob.compileae   // [ug+28]
call.cg          : glob.callcg      // [ug+29]

// SYN - TRN globals
treesize         : ug + 30
declsize         : ug + 31
printtree        : ug + 32
charcode         : ug + 33
transchars       : ug + 34
savespacesize    : ug + 35
sourcestream     : ug + 36
ch               : ug + 37
linecount        : ug + 38
reportcount      : ug + 39
errcount         : ug + 40
errvec           : ug + 41
treep            : ug + 42
treeq            : ug + 43
treevec          : ug + 44
zeronode         : ug + 45
libraryname      : ug + 46
sysout           : ug + 47
name.codestream  : ug + 48
workbase         : ug + 50
prsource         : ug + 51
warnmax          : ug + 52
warncount        : ug + 53
reportmax        : ug + 54
informmax        : ug + 55
errormax         : ug + 56
sectionname      : ug + 57
condtaglist      : ug + 58
errors           : ug + 59
uppercase        : ug + 60
uppercasestring  : ug + 61
tagchartable     : ug + 62
forceuppercase   : ug + 63
workspacesize    : ug + 64
codegen          : ug + 65
chbuf            : ug + 66
obufp            : ug + 67
obufb            : ug + 68
curp             : ug + 69
curb             : ug + 70
worktop          : ug + 71
quiet            : ug + 72
ptree            : ug + 73
rdn              : ug + 74
numocode         : ug + 75
trnoptimise      : ug + 76
pptrace          : ug + 77
findget          : ug + 78
getchain         : ug + 79
ngets            : ug + 80
dvecs            : ug + 81
dvec             : ug + 82
trnunused        : ug + 83
cgnaming         : ug + 84
workvec          : ug + 85
insyn            : ug + 86
getp             : ug + 87
jumpopt          : ug + 88
newvec           : ug + 89
objectmodule     : ug + 90
$<MACRO
macmax           : ug + 91
$>MACRO
inlinemult       : ug + 92
maxglobals       : ug + 93
lispopt          : ug + 94
globexternals    : ug + 95
extlowbound      : ug + 96
triposfp         : ug + 97
fpsimglob        : ug + 98
chip             : ug + 99
dumpsymbols      : ug + 100
$)

MANIFEST
$(
   s.number=1;   s.name=2;    s.string=3;    s.true=4
   s.false=5;    s.valof=6;   s.lv=7;        s.rv=8
   s.vecap=9;    s.fnap=10;   s.mult=11;     s.div=12
   s.rem=13;     s.plus=14;   s.minus=15;    s.query=16
   s.neg=17
   s.fix=18;     s.abs=19;    s.eq=20;       s.ne=21
   s.ls=22;      s.gr=23;     s.le=24;       s.ge=25
   s.byteap=28
$<WORD
   s.wordap=29
$>WORD
   s.not=30;    s.lshift=31;   s.rshift=32
   s.logand=33;  s.logor=34;  s.eqv=35;      s.neqv=36
   s.cond=37;    s.comma=38;  s.table=39;    s.and=40
   s.valdef=41;  s.vecdef=42; s.constdef=43; s.fndef=44
   s.rtdef=45
$<MACRO
   s.macro=46;   s.mpar=47
$>MACRO
   s.needs:48; s.section=49;  s.ass=50;      s.rtap=51
   s.goto=52;  s.resultis=53; s.colon=54;    s.test=55
   s.for=56;   s.if=57;       s.unless=58;   s.while=59
   s.until=60; s.repeat=61
   s.repeatwhile=62; s.repeatuntil=63
   s.loop=65;    s.break=66;    s.return=67;   s.finish=68
   s.endcase=69; s.switchon=70; s.case=71;     s.default=72
   s.seq=73;     s.let=74;      s.manifest=75; s.global=76
   s.local=77;   s.label=78;    s.static=79;
   s.cont=81

   s.be=89;      s.end=90;       s.lsect=91;    s.rsect=92
   s.get=93;     s.semicolon=97; s.into=98;     s.to=99
   s.by=100;     s.do=101;       s.or=102;      s.vec=103
   s.lparen=105; s.rparen=106;   s.lcond=111;   s.rcond=112

   s.condname=113;  s.commawithline=114

   s.lcode=120;   s.rcode=121;    s.code=122
$)

// ACN specials for Lisp
MANIFEST
$( 
   s.car=128;  s.cdr=129;  s.lle=130;  s.lge=131;
   s.lls=132;  s.lgr=133;  s.nil=134;  s.stindb=135;
   s.stnil=136
 
   nilglobalnumber=150
$)

// Floating point
MANIFEST
$(
   s.fmult=267;   s.fdiv=268;   s.fplus=270;    s.fminus=271
   s.fneg=273;    s.float=274;  s.fabs=275;     s.feq=276
   s.fne=277;     s.fls=278;    s.fgr=279;      s.fle=280
   s.fge=281

   flbit=256; becomesbit=512
$)

// Selectors
MANIFEST
$(
   h1=0; h2=1; h3=2; h4=3; h5=4; h6=5

   constbit=1024
$<MACRO
   disbit=#X80000000
$>MACRO
$)


MANIFEST
$(
   s.lp=40;   s.lg=41;   s.ln=42;   s.lstr=43;   s.ll=44
   s.llp=45;  s.llg=46;  s.lll=47

   s.sp=80; s.sg=81; s.sl=82; s.stind=83
   s.jump=85; s.jt=86; s.jf=87; s.endfor=88; s.blab=89
   s.lab=90; s.stack=91; s.store=92; s.rstack=93; s.entry=94
   s.save=95; s.fnrn=96; s.rtrn=97; s.res=98; s.reslab=99
   s.datalab=100; s.iteml=101; s.itemn=102
   s.endproc=103
   s.startblock=105; s.endblock=106
   s.debug=109
   s.mod=110
   s.none=111

   s.commawithline=114

   s.getbyte=120; s.putbyte=121

$<WORD
   s.getword=143; s.putword=144
$>WORD
$<EXT
   s.external=125
   s.lext=140; s.llext=141; s.sext=142
$>EXT
$)

/***************************************************************************/
/*                      END    OF    BCPHDR                                */
/***************************************************************************/

@
