ack/lang/occam/lib/ocrt.c

54 lines
893 B
C
Raw Permalink Normal View History

1994-06-24 14:02:31 +00:00
/* $Id$ */
1987-02-24 18:36:02 +00:00
/* ocrt.c - Occam runtime support */
1987-02-25 16:41:09 +00:00
#include "ocm_chan.h"
1987-02-24 18:36:02 +00:00
int chandes[]= { 0, 0, sizeof(int)+sizeof(long) };
int worddes[]= { 0, 0, sizeof(long) };
int bytedes[]= { 0, 0, 1 };
long any;
void catch(sig, file, line) int sig; char *file; int line;
/* Catches traps in the occam program */
{
register char *mes;
switch (sig) {
case 0:
mes="array bound error";
break;
case 6:
mes="division by zero";
break;
case 8:
mes="undefined variable";
break;
default:
return;
}
fprintf(stderr, "%s (%d) F: %s\n", file, line, mes);
abort();
}
1987-02-25 16:41:09 +00:00
chan file[20];
FILE *unix_file[20];
1987-02-24 18:36:02 +00:00
void initfile()
{
register i;
register chan *c=file;
1987-02-25 16:41:09 +00:00
for (i=0; i<20; i++) {
1987-02-24 18:36:02 +00:00
c->type=C_T_FILE;
c->f.flgs=0;
(c++)->f.index=i;
}
file[0].f.flgs|=C_F_INUSE;
unix_file[0]=stdin;
file[1].f.flgs|=C_F_INUSE;
unix_file[1]=stdout;
file[2].f.flgs|=C_F_INUSE;
unix_file[2]=stderr;
}