--- /dev/null
+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
/* builtin.c - built in named processes */
-#include "channel.h"
+#include "ocm_chan.h"
#ifndef nil
#define nil 0
#endif
#include <errno.h>
#include <signal.h>
#include <sgtty.h>
-#include "channel.h"
+#include "ocm_chan.h"
static void disaster();
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:
/* co.c - Routines to handle coroutines */
-#include "process.h"
+#include "ocm_proc.h"
static void search(), RESUMERR();
--- /dev/null
+#
+ 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
--- /dev/null
+long now()
+{
+ extern int deadlock;
+ long time();
+
+ deadlock = 0;
+ return time((long *) 0);
+}
/* 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) };
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;
/* par.c - Routines to simulate parallelism */
-#include "process.h"
+#include "ocm_proc.h"
static void search_next(), DEADLOCK();
--- /dev/null
+#
+ 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
/* 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;