From: ceriel Date: Wed, 25 Feb 1987 16:41:09 +0000 (+0000) Subject: my version (CJ) X-Git-Tag: release-5-5~4601 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=362378a94aac5d1270d3df42569811b6a384d7b8;p=ack.git my version (CJ) --- diff --git a/lang/occam/lib/LIST b/lang/occam/lib/LIST new file mode 100644 index 000000000..b12567661 --- /dev/null +++ b/lang/occam/lib/LIST @@ -0,0 +1,11 @@ +tail_ocm.a +builtin.c +chan_struct.c +channel.c +co.c +now.c +par.c +parco.c +misc.e +ocrt.c +par_misc.e diff --git a/lang/occam/lib/builtin.c b/lang/occam/lib/builtin.c index 37ed2e895..71c77efb0 100644 --- a/lang/occam/lib/builtin.c +++ b/lang/occam/lib/builtin.c @@ -1,5 +1,5 @@ /* builtin.c - built in named processes */ -#include "channel.h" +#include "ocm_chan.h" #ifndef nil #define nil 0 #endif diff --git a/lang/occam/lib/channel.c b/lang/occam/lib/channel.c index 630f932f8..1c4ce966c 100644 --- a/lang/occam/lib/channel.c +++ b/lang/occam/lib/channel.c @@ -2,7 +2,7 @@ #include #include #include -#include "channel.h" +#include "ocm_chan.h" static void disaster(); @@ -53,16 +53,16 @@ void chan_out(v, c) long v; register chan *c; putc( (int) v, fp); else if (v==C_F_TEXT) { - ioctl(fileno(fp), TIOCGETP, &tty); + gtty(fileno(fp), &tty); tty.sg_flags&= ~CBREAK; tty.sg_flags|= ECHO|CRMOD; - ioctl(fileno(fp), TIOCSETN, &tty); + stty(fileno(fp), &tty); } else if (v==C_F_RAW) { - ioctl(fileno(fp), TIOCGETP, &tty); + gtty(fileno(fp), &tty); tty.sg_flags|= CBREAK; tty.sg_flags&= ~(ECHO|CRMOD); - ioctl(fileno(fp), TIOCSETN, &tty); + stty(fileno(fp), &tty); } } break; case C_T_CHAN: diff --git a/lang/occam/lib/co.c b/lang/occam/lib/co.c index 88d3d72b2..ff8038879 100644 --- a/lang/occam/lib/co.c +++ b/lang/occam/lib/co.c @@ -1,5 +1,5 @@ /* co.c - Routines to handle coroutines */ -#include "process.h" +#include "ocm_proc.h" static void search(), RESUMERR(); diff --git a/lang/occam/lib/misc.e b/lang/occam/lib/misc.e new file mode 100644 index 000000000..abfc7b62a --- /dev/null +++ b/lang/occam/lib/misc.e @@ -0,0 +1,49 @@ +# + mes 2,EM_WSIZE,EM_PSIZE + +oldtrp + bss EM_PSIZE, 0, 0 + + exp $init + pro $init, 0 + loc -321-1 + sim + lpi $catch1 + sig + lae oldtrp + sti EM_PSIZE + cal $initfile + ret 0 + end 0 + + pro $catch1, 0 + lae oldtrp + loi EM_PSIZE + sig + asp EM_PSIZE + loe 0 + lae 4 + loi EM_PSIZE + lol 0 + cal $catch + asp 2*EM_WSIZE+EM_PSIZE + lol 0 + trp + rtt + end 0 + + exp $block_move + pro $block_move, 0 + lal 4 + loi EM_PSIZE + lal 8 + loi EM_PSIZE + + lal 0 + loi EM_LSIZE + loc EM_LSIZE + loc EM_WSIZE + cuu + bls EM_WSIZE + ret 0 + end 0 diff --git a/lang/occam/lib/now.c b/lang/occam/lib/now.c new file mode 100644 index 000000000..9ce234d03 --- /dev/null +++ b/lang/occam/lib/now.c @@ -0,0 +1,8 @@ +long now() +{ + extern int deadlock; + long time(); + + deadlock = 0; + return time((long *) 0); +} diff --git a/lang/occam/lib/ocrt.c b/lang/occam/lib/ocrt.c index c39eff3cf..e3061d93e 100644 --- a/lang/occam/lib/ocrt.c +++ b/lang/occam/lib/ocrt.c @@ -1,5 +1,5 @@ /* ocrt.c - Occam runtime support */ -#include "channel.h" +#include "ocm_chan.h" int chandes[]= { 0, 0, sizeof(int)+sizeof(long) }; int worddes[]= { 0, 0, sizeof(long) }; @@ -28,15 +28,15 @@ void catch(sig, file, line) int sig; char *file; int line; abort(); } -chan file[_NFILE]; -FILE *unix_file[_NFILE]; +chan file[20]; +FILE *unix_file[20]; void initfile() { register i; register chan *c=file; - for (i=0; i<_NFILE; i++) { + for (i=0; i<20; i++) { c->type=C_T_FILE; c->f.flgs=0; (c++)->f.index=i; diff --git a/lang/occam/lib/par.c b/lang/occam/lib/par.c index ef3c45981..9830ec433 100644 --- a/lang/occam/lib/par.c +++ b/lang/occam/lib/par.c @@ -1,5 +1,5 @@ /* par.c - Routines to simulate parallelism */ -#include "process.h" +#include "ocm_proc.h" static void search_next(), DEADLOCK(); diff --git a/lang/occam/lib/par_misc.e b/lang/occam/lib/par_misc.e new file mode 100644 index 000000000..3d181adee --- /dev/null +++ b/lang/occam/lib/par_misc.e @@ -0,0 +1,62 @@ +# + mes 2,EM_WSIZE,EM_PSIZE + exp $top_size + pro $top_size, 3*EM_WSIZE+3*EM_PSIZE + mes 11 + lal 0 + loi EM_PSIZE ; s_brk + lor 1 ; s_brk SP + sbs EM_PSIZE ; s_brk-SP + ret EM_PSIZE ; return size of block to be saved + end 3*EM_WSIZE+3*EM_PSIZE + + exp $top_save + pro $top_save, 0 + loe 0 + lae 4 ; load line number and file name + loi EM_PSIZE + lim ; ignore mask + lor 0 ; LB + lal 0 + loi EM_PSIZE ; size of block + loc EM_PSIZE + loc EM_WSIZE + cuu + dup EM_WSIZE + stl 0 ; push & store size in 2 bytes + lor 1 ; SP (the SP BEFORE pushing) + lor 1 ; SP (address of stack top to save) + lal EM_PSIZE ; area + loi EM_PSIZE + lol 0 ; size + bls EM_WSIZE ; move whole block + asp 3*EM_PSIZE+3*EM_WSIZE ; remove the lot from the stack + loc 1 + ret EM_WSIZE ; return 1 + end 0 + + exp $top_load + pro $top_load, 0 + lal 0 + loi EM_PSIZE + dup EM_PSIZE + loi EM_PSIZE + sti EM_PSIZE ; copy pointer from argument 0 to new frame + loi EM_PSIZE ; load indirect to + str 1 ; restore SP + dup EM_PSIZE ; givesargument 0 again + lor 1 ; SP (the SP AFTER, see above) + lor 1 + adp EM_PSIZE + loi EM_PSIZE + lof EM_PSIZE ; size of block + bls EM_WSIZE ; move block back (SP becomes the SP BEFORE again!) + asp EM_WSIZE ; drop size + str 0 ; LB + sim ; ignore mask + lae EM_PSIZE + sti EM_PSIZE + ste 0 ; line and file + loc 0 + ret EM_WSIZE ; return 0 + end 0 diff --git a/lang/occam/lib/parco.c b/lang/occam/lib/parco.c index 55d7979b9..26c114e1f 100644 --- a/lang/occam/lib/parco.c +++ b/lang/occam/lib/parco.c @@ -1,7 +1,7 @@ /* parco.c - Common routines for simulating parallelism or coroutines on * machines with downward growing stacks */ -#include "process.h" +#include "ocm_proc.h" struct procgroup *group=nil, *highest_group;