// Standard BCPL header

MANIFEST $(
  B2Wsh=2  // for a 32 bit implementation
//B2Wsh=3  // for a 64 bit implementation
$)

GLOBAL $(
globsize:0     // the size of the global vector
start:1        //        start()
stop:2         //        stop(code)
sys:3          // res := sys(op,...)
clihook:4      //        clihook()
changeco:6     //        changeco(arg, cptr)
currco:7       // the current coroutine
colist:8       // the list of all coroutines
rootnode:9     // the rootnode
result2:10     // the second result of functions
intflag:11     // res := intflag()
sardch:12      // ch  := sardch()
sawrch:13      //        sawrch(ch)
level:17       // p   := level()
longjump:18    //        longjump(p, l)
muldiv:19      // res := muldiv(a, b, c)

createco:21    // co  := createco(fn, stsize)
deleteco:22    //        deleteco(co)
callco:23      // arg := callco(co, arg)
cowait:24      // arg := cowait(arg)
resumeco:25    // arg := resumeco(co, arg)
initco:26      // co  := initco(fn, stsize, a,...)
globin:28      // res := globin(segl)
getvec:29      // v   := getvec(upb)
freevec:30     //        freevec(v)
abort:31       //        abort(code, arg)
packstring:32  // res := packstring(v, s)
unpackstring:33//        unpackstring(s, v)
mkobj:34       // obj := mkobj(upb, fns)
cis:40         // the currently selected input stream
cos:41         // the currently selected output stream
rdch:42        // ch  := rdch()
unrdch:43      // res := unrdch()
wrch:44        //        wrch(ch)
findinput:45   // scb := findinput(name)
findoutput:46  // scb := findoutput(name)
selectinput:47 //        selectinput(scb)
selectoutput:48//        selectoutput(scb)
endread:49     //        endread()
endwrite:50    //        endwrite()
input:51       // scb := input()
output:52      // scb := output()
flush:53       // res := flush()
readn:60       // n   := readn()
newline:61     //        newline()
newpage:62     //        newpage()
writed:63      //        writed(n, d)
writeu:64      //        writeu(n, d)
writen:65      //        writen(n)
writeoct:66    //        writeoct(n, d)
writehex:67    //        writehex(n, d)
writes:68      //        writes(str)
writet:69      //        writet(str, d)
writef:70      //        writef(format, a,...)
writebin:71    //        writebin(n, d)

capitalch:75   // ch  := capitalch(ch)
compch:76      // res := compch(ch1, ch2)
compstring:77  // res := compstring(s1, s2)
rdargs:78      // res := rdargs(keys, v, upb)
rditem:79      // res := rditem(v, upb)
findarg:80     // res := findarg(keys, item)
loadseg:81     // seg := loadseg(name)
unloadseg:82   //        unloadseg(segl)
callseg:83     // res := callseg(name,  ... args)
deletefile:85  // res := deletefile(name)
renamefile:86  // res := renamefile(name1, name2)
randno:87      // n   := randno(upb)
str2numb:88    // n   := str2numb(string)
pathfindinput:89  // scb := pathfindinput(name, path)
setseed:90     // oldseed := setseed(newseed)
instrcount:91  // count := instrcount(fn,a,b,c,d,e,f,g,h,i,j,k)

// Globals 133-149 are defined in CLIHDR
$)

MANIFEST $(
endstreamch    = -1

bytesperword   = 1<<B2Wsh 
mcaddrinc      = bytesperword

bitsperbyte    = 8
bitsperword    = bytesperword*bitsperbyte

minint         = 1<<(bitsperword-1)  // = #x80....0
maxint         = minint - 1          // = #x7F....F

ug             = 200  // First user global

t_hunk         = 1000 // Object module types
t_bhunk        = 3000
t_end          = 1002

co_pptr        = 0
co_parent      = 1
co_list        = 2
co_fn          = 3
co_size        = 4

// rootnode offsets
rtn_membase    =     0
rtn_memsize    =     1
rtn_blklist    =     2
rtn_tallyv     =     3
rtn_syslib     =     4
rtn_blib       =     5
rtn_boot       =     6
rtn_cli        =     7
rtn_keyboard   =     8
rtn_screen     =     9
rtn_upb        =    20

InitObj  = 0  // Initialisation and closing methods for objects
CloseObj = 1
$)
