my version (CJ)
authorceriel <none@none>
Wed, 25 Feb 1987 16:41:09 +0000 (16:41 +0000)
committerceriel <none@none>
Wed, 25 Feb 1987 16:41:09 +0000 (16:41 +0000)
lang/occam/lib/LIST [new file with mode: 0644]
lang/occam/lib/builtin.c
lang/occam/lib/channel.c
lang/occam/lib/co.c
lang/occam/lib/misc.e [new file with mode: 0644]
lang/occam/lib/now.c [new file with mode: 0644]
lang/occam/lib/ocrt.c
lang/occam/lib/par.c
lang/occam/lib/par_misc.e [new file with mode: 0644]
lang/occam/lib/parco.c

diff --git a/lang/occam/lib/LIST b/lang/occam/lib/LIST
new file mode 100644 (file)
index 0000000..b125676
--- /dev/null
@@ -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
index 37ed2e8..71c77ef 100644 (file)
@@ -1,5 +1,5 @@
 /*     builtin.c - built in named processes */
-#include "channel.h"
+#include "ocm_chan.h"
 #ifndef nil
 #define nil 0
 #endif
index 630f932..1c4ce96 100644 (file)
@@ -2,7 +2,7 @@
 #include <errno.h>
 #include <signal.h>
 #include <sgtty.h>
-#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:
index 88d3d72..ff80388 100644 (file)
@@ -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 (file)
index 0000000..abfc7b6
--- /dev/null
@@ -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 (file)
index 0000000..9ce234d
--- /dev/null
@@ -0,0 +1,8 @@
+long now()
+{
+       extern int deadlock;
+       long time();
+
+       deadlock = 0;
+       return time((long *) 0);
+}
index c39eff3..e3061d9 100644 (file)
@@ -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;
index ef3c459..9830ec4 100644 (file)
@@ -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 (file)
index 0000000..3d181ad
--- /dev/null
@@ -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
index 55d7979..26c114e 100644 (file)
@@ -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;