1 eÿabi.c
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0R
\ 2/* $Id: abi.c,v 2.2 1994/06/24 12:30:48 ceriel Exp $ */
3 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
5 * This product is part of the Amsterdam Compiler Kit.
7 * Permission to use, sell, duplicate or disclose this software must be
8 * obtained in writing. Requests for such permissions may be sent to
10 * Dr. Andrew S. Tanenbaum
11 * Wiskundig Seminarium
19 /* Author: J.W. Stevenson */
22 return(i>=0 ? i : -i);
24 abl.c
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0T
\ 2/* $Id: abl.c,v 2.2 1994/06/24 12:30:52 ceriel Exp $ */
26 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
28 * This product is part of the Amsterdam Compiler Kit.
30 * Permission to use, sell, duplicate or disclose this software must be
31 * obtained in writing. Requests for such permissions may be sent to
33 * Dr. Andrew S. Tanenbaum
34 * Wiskundig Seminarium
42 /* Author: J.W. Stevenson */
44 long _abl(i) long i; {
45 return(i>=0 ? i : -i);
47 abr.c
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0X
\ 2/* $Id: abr.c,v 2.2 1994/06/24 12:30:55 ceriel Exp $ */
49 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
51 * This product is part of the Amsterdam Compiler Kit.
53 * Permission to use, sell, duplicate or disclose this software must be
54 * obtained in writing. Requests for such permissions may be sent to
56 * Dr. Andrew S. Tanenbaum
57 * Wiskundig Seminarium
65 /* Author: J.W. Stevenson */
67 double _abr(r) double r; {
68 return(r>=0 ? r : -r);
70 arg.c
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0+
\ 4/* $Id: arg.c,v 2.3 1994/06/24 12:30:59 ceriel Exp $ */
72 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
74 * This product is part of the Amsterdam Compiler Kit.
76 * Permission to use, sell, duplicate or disclose this software must be
77 * obtained in writing. Requests for such permissions may be sent to
79 * Dr. Andrew S. Tanenbaum
80 * Wiskundig Seminarium
88 /* Author: J.W. Stevenson */
90 /* function argc:integer; extern; */
91 /* function argv(i:integer):string; extern; */
92 /* procedure argshift; extern; */
93 /* function environ(i:integer):string; extern; */
126 \0ass.c
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0Ç
\ 2/* $Id: ass.c,v 2.2 1994/06/24 12:31:02 ceriel Exp $ */
128 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
130 * This product is part of the Amsterdam Compiler Kit.
132 * Permission to use, sell, duplicate or disclose this software must be
133 * obtained in writing. Requests for such permissions may be sent to
135 * Dr. Andrew S. Tanenbaum
136 * Wiskundig Seminarium
144 /* Author: J.W. Stevenson */
149 extern char *_hol0();
152 _ass(line,bool) int line,bool; {
159 asz.c
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\9d\ 2/* $Id: asz.c,v 2.2 1994/06/24 12:31:05 ceriel Exp $ */
161 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
163 * This product is part of the Amsterdam Compiler Kit.
165 * Permission to use, sell, duplicate or disclose this software must be
166 * obtained in writing. Requests for such permissions may be sent to
168 * Dr. Andrew S. Tanenbaum
169 * Wiskundig Seminarium
177 /* Author: J.W. Stevenson */
185 int _asz(dp) struct descr *dp; {
186 return(dp->size * (dp->diff + 1));
188 latn.c
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0T
\ 5/*
189 * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
190 * See the copyright notice in the ACK home directory, in the file "Copyright".
192 * Author: Ceriel J.H. Jacobs
195 /* $Id: atn.c,v 2.7 1994/06/24 12:31:09 ceriel Exp $ */
208 /* Algorithm and coefficients from:
209 "Software manual for the elementary functions"
210 by W.J. Cody and W. Waite, Prentice-Hall, 1980
213 static double p[] = {
214 -0.13688768894191926929e+2,
215 -0.20505855195861651981e+2,
216 -0.84946240351320683534e+1,
217 -0.83758299368150059274e+0
219 static double q[] = {
220 0.41066306682575781263e+2,
221 0.86157349597130242515e+2,
222 0.59578436142597344465e+2,
223 0.15024001160028576121e+2,
226 static double a[] = {
228 0.52359877559829887307710723554658381, /* pi/6 */
230 1.04719755119659774615421446109316763 /* pi/3 */
246 if (x > 0.26794919243112270647) { /* 2-sqtr(3) */
248 x = (((0.73205080756887729353*x-0.5)-0.5)+x)/
249 (1.73205080756887729353+x);
252 /* ??? avoid underflow ??? */
255 x += x * g * POLYNOM3(g, p) / POLYNOM4(g, q);
260 bcp.c
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0¹
\ 2/* $Id: bcp.c,v 2.3 1994/06/24 12:31:12 ceriel Exp $ */
262 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
264 * This product is part of the Amsterdam Compiler Kit.
266 * Permission to use, sell, duplicate or disclose this software must be
267 * obtained in writing. Requests for such permissions may be sent to
269 * Dr. Andrew S. Tanenbaum
270 * Wiskundig Seminarium
278 /* Author: J.W. Stevenson */
280 int _bcp(sz,y,x) int sz; unsigned char *y,*x; {
290 3bts.e
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0¼
\ 4#
291 ; $Id: bts.e,v 2.2 1994/06/24 12:31:15 ceriel Exp $
293 ; (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
295 ; This product is part of the Amsterdam Compiler Kit.
297 ; Permission to use, sell, duplicate or disclose this software must be
298 ; obtained in writing. Requests for such permissions may be sent to
300 ; Dr. Andrew S. Tanenbaum
301 ; Wiskundig Seminarium
309 ; Author: J.W. Stevenson */
311 mes 2,EM_WSIZE,EM_PSIZE
314 #define HIGH EM_WSIZE
315 #define LOWB 2*EM_WSIZE
316 #define BASE 3*EM_WSIZE
318 ; _bts is called with four parameters:
319 ; - the initial set (BASE)
320 ; - low bound of range of bits (LOWB)
321 ; - high bound of range of bits (HIGH)
322 ; - set size in bytes (SIZE)
326 lal BASE ; address of initial set
328 los EM_WSIZE ; load initial set
331 lol HIGH ; high bound
332 bgt *2 ; while low <= high
337 ior ? ; merge with initial set
338 inl LOWB ; increment low bound
343 sts EM_WSIZE ; store result over initial set
346 buff.c
\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\07
\ 3/* $Id: buff.c,v 2.3 1994/06/24 12:31:18 ceriel Exp $ */
348 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
350 * This product is part of the Amsterdam Compiler Kit.
352 * Permission to use, sell, duplicate or disclose this software must be
353 * obtained in writing. Requests for such permissions may be sent to
355 * Dr. Andrew S. Tanenbaum
356 * Wiskundig Seminarium
364 /* Author: J.W. Stevenson */
370 /* procedure buff(var f:file of ?); */
372 buff(f) struct file *f; {
375 if ((f->flags & (0377|WRBIT)) != (MAGIC|WRBIT))
379 f->count = f->buflen = (sz>PC_BUFLEN ? sz : PC_BUFLEN-PC_BUFLEN%sz);
382 clock.c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0h
\ 3/* $Id: clock.c,v 2.5 1994/06/24 12:31:24 ceriel Exp $ */
384 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
386 * This product is part of the Amsterdam Compiler Kit.
388 * Permission to use, sell, duplicate or disclose this software must be
389 * obtained in writing. Requests for such permissions may be sent to
391 * Dr. Andrew S. Tanenbaum
392 * Wiskundig Seminarium
400 /* Author: J.W. Stevenson */
402 /* function clock:integer; extern; */
414 #define EM_WSIZE _EM_WSIZE
421 return( (int)(t.utime + t.stime) &
429 diag.c
\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\v\ 3/* $Id: diag.c,v 2.2 1994/06/24 12:31:33 ceriel Exp $ */
431 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
433 * This product is part of the Amsterdam Compiler Kit.
435 * Permission to use, sell, duplicate or disclose this software must be
436 * obtained in writing. Requests for such permissions may be sent to
438 * Dr. Andrew S. Tanenbaum
439 * Wiskundig Seminarium
447 /* Author: J.W. Stevenson */
451 /* procedure diag(var f:text); */
453 diag(f) struct file *f; {
456 f->flags = WRBIT|EOFBIT|ELNBIT|TXTBIT|MAGIC;
463 rdis.c
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0»
\a/* $Id: dis.c,v 2.2 1994/06/24 12:31:36 ceriel Exp $ */
465 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
467 * This product is part of the Amsterdam Compiler Kit.
469 * Permission to use, sell, duplicate or disclose this software must be
470 * obtained in writing. Requests for such permissions may be sent to
472 * Dr. Andrew S. Tanenbaum
473 * Wiskundig Seminarium
481 /* Author: J.W. Stevenson */
485 #define assert() /* nothing */
488 * use circular list of free blocks from low to high addresses
489 * _highp points to free block with highest address
496 extern struct adm *_lastp;
497 extern struct adm *_highp;
500 static int merge(p1,p2) struct adm *p1,*p2; {
503 p = (struct adm *)((char *)p1 + p1->size);
508 p1->size += p2->size;
513 _dis(n,pp) int n; struct adm **pp; {
517 * NOTE: dispose only objects whose size is a multiple of sizeof(*pp).
518 * this is always true for objects allocated by _new()
520 n = ((n+sizeof(*p1)-1) / sizeof(*p1)) * sizeof(*p1);
523 if ((p1= *pp) == (struct adm *) 0)
526 if ((p2 = _highp) == 0) /*p1 is the only free block*/
530 /*search for the preceding free block*/
531 if (_lastp < p1) /*reduce search*/
533 while (p2->next < p1)
536 /* if p2 preceeds p1 in the circular list,
537 * try to merge them */
538 p1->next = p2->next; p2->next = p1;
539 if (p2 <= p1 && merge(p2,p1))
542 /* p1 preceeds p2 in the circular list */
543 if (p2 > p1) merge(p1,p2);
548 *pp = (struct adm *) 0;
550 \0efl.c
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0L
\ 3/* $Id: efl.c,v 2.2 1994/06/24 12:31:39 ceriel Exp $ */
552 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
554 * This product is part of the Amsterdam Compiler Kit.
556 * Permission to use, sell, duplicate or disclose this software must be
557 * obtained in writing. Requests for such permissions may be sent to
559 * Dr. Andrew S. Tanenbaum
560 * Wiskundig Seminarium
568 /* Author: J.W. Stevenson */
573 extern struct file *_curfil;
577 int _efl(f) struct file *f; {
580 if ((f->flags & 0377) != MAGIC)
582 if ((f->flags & (WINDOW|WRBIT|EOFBIT)) == 0)
584 return((f->flags & EOFBIT) != 0);
586 eln.c
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0à
\ 2/* $Id: eln.c,v 2.2 1994/06/24 12:31:42 ceriel Exp $ */
588 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
590 * This product is part of the Amsterdam Compiler Kit.
592 * Permission to use, sell, duplicate or disclose this software must be
593 * obtained in writing. Requests for such permissions may be sent to
595 * Dr. Andrew S. Tanenbaum
596 * Wiskundig Seminarium
604 /* Author: J.W. Stevenson */
612 int _eln(f) struct file *f; {
615 if (f->flags & EOFBIT)
617 return((f->flags & ELNBIT) != 0);
619 encaps.e
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0[
\v#
622 ; $Id: encaps.e,v 2.2 1994/06/24 12:31:44 ceriel Exp $
623 ; (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
625 ; This product is part of the Amsterdam Compiler Kit.
627 ; Permission to use, sell, duplicate or disclose this software must be
628 ; obtained in writing. Requests for such permissions may be sent to
630 ; Dr. Andrew S. Tanenbaum
631 ; Wiskundig Seminarium
638 mes 2,EM_WSIZE,EM_PSIZE
640 ; procedure encaps(procedure p; procedure(q(n:integer));
641 ; {call q if a trap occurs during the execution of p}
642 ; {if q returns, continue execution of p}
647 #define PIISZ 2*EM_PSIZE
651 #define E_ELB -EM_PSIZE
652 #define E_EHA -2*EM_PSIZE
654 ; encaps is called with two parameters:
655 ; - procedure instance identifier of q (QARG)
656 ; - procedure instance identifier of p (PARG)
657 ; and two local variables:
658 ; - the lb of the previous encaps (E_ELB)
659 ; - the procedure identifier of the previous handler (E_EHA)
661 ; One static variable:
662 ; - the lb of the currently active encaps (enc_lb)
669 ; save lb of previous encaps
678 ; save old handler id while setting up the new handler
683 ; handler is ready, p can be called
684 ; p doesn't expect parameters except possibly the static link
685 ; always passing the link won't hurt
690 ; reinstate old handler
703 #define H_ELB -EM_PSIZE
705 ; handler is called with one parameter:
706 ; - trap number (TRAP)
708 ; - the current LB of the enclosing encaps (H_ELB)
711 pro $handler,EM_PSIZE
712 ; save LB of nearest encaps
717 ; fetch setting for previous encaps via LB of nearest
721 loi EM_PSIZE ; LB of previous encaps
727 loi EM_PSIZE ; previous handler
730 ; previous handler is re-instated, time to call Q
731 lol TRAP ; the one and only real parameter
734 lpb ; argument base of enclosing encaps
738 dup EM_PSIZE ; The static link is now on top
745 asp EM_WSIZE+EM_PSIZE
753 ; now reinstate handler for continued execution of p
763 \0exp.c
\0.e
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0`
\b/*
764 * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
765 * See the copyright notice in the ACK home directory, in the file "Copyright".
767 * Author: Ceriel J.H. Jacobs
770 /* $Id: exp.c,v 2.11 1994/06/24 12:31:48 ceriel Exp $ */
779 #define M_MIN_D DBL_MIN
780 #define M_MAX_D DBL_MAX
781 #define M_DMINEXP DBL_MIN_EXP
791 extern double _fef();
799 fl = _fef(fl,&currexp);
803 fl *= (double) (1L << 30);
806 fl *= (double) (1L << exp);
810 fl /= (double) (1L << 30);
813 fl /= (double) (1L << -exp);
822 /* Algorithm and coefficients from:
823 "Software manual for the elementary functions"
824 by W.J. Cody and W. Waite, Prentice-Hall, 1980
827 static double p[] = {
828 0.25000000000000000000e+0,
829 0.75753180159422776666e-2,
830 0.31555192765684646356e-4
833 static double q[] = {
834 0.50000000000000000000e+0,
835 0.56817302698551221787e-1,
836 0.63121894374398503557e-3,
837 0.75104028399870046114e-6
841 int negative = x < 0;
843 if (x <= M_LN_MIN_D) {
847 /* unnormalized numbers apparently exist */
848 if (x < (M_LN2 * (M_DMINEXP - 53))) return 0.0;
851 if (x < M_LN_MIN_D) return 0.0;
855 if (x >= M_LN_MAX_D) {
856 if (x > M_LN_MAX_D) {
862 if (negative) x = -x;
864 n = x * M_LOG2E + 0.5; /* 1/ln(2) = log2(e), 0.5 added for rounding */
867 double x1 = (long) x;
870 g = ((x1-xn*0.693359375)+x2) - xn*(-2.1219444005469058277e-4);
877 x = g * POLYNOM2(xn, p);
879 return (Ldexp(0.5 + x/(POLYNOM3(xn, q) - x), n));
881 get.c
\0.e
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0¯
\ 2/* $Id: get.c,v 2.3 1994/06/24 12:31:56 ceriel Exp $ */
883 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
885 * This product is part of the Amsterdam Compiler Kit.
887 * Permission to use, sell, duplicate or disclose this software must be
888 * obtained in writing. Requests for such permissions may be sent to
890 * Dr. Andrew S. Tanenbaum
891 * Wiskundig Seminarium
905 _get(f) struct file *f; {
912 igto.e
\0.e
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0í
\ 6#
913 ; $Id: gto.e,v 2.2 1994/06/24 12:31:59 ceriel Exp $
914 ; (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
916 ; This product is part of the Amsterdam Compiler Kit.
918 ; Permission to use, sell, duplicate or disclose this software must be
919 ; obtained in writing. Requests for such permissions may be sent to
921 ; Dr. Andrew S. Tanenbaum
922 ; Wiskundig Seminarium
929 /* Author: J.W. Stevenson */
932 mes 2,EM_WSIZE,EM_PSIZE
935 #define DESCR EM_PSIZE
938 #define SAVSP EM_PSIZE
941 #define D_SP EM_PSIZE
942 #define D_LB EM_PSIZE+EM_PSIZE
944 #define LOCLB -EM_PSIZE
946 ; _gto is called with two arguments:
947 ; - pointer to the label descriptor (DESCR)
948 ; - local base (LB) of target procedure (TARLB)
949 ; the label descriptor contains two items:
950 ; - label address i.e. new PC (NEWPC)
951 ; - offset in target procedure frame (SAVSP)
952 ; using this offset and the LB of the target procedure, the address of
953 ; of local variable of the target procedure is constructed.
954 ; the target procedure must have stored the correct target SP there.
986 loi EM_WSIZE ; or EM_PSIZE ?
987 ads EM_WSIZE ; or EM_PSIZE ?
997 _hlt.c
\0.e
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\e\ 3/* $Id: hlt.c,v 2.4 1994/06/24 12:32:06 ceriel Exp $ */
999 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
1001 * This product is part of the Amsterdam Compiler Kit.
1003 * Permission to use, sell, duplicate or disclose this software must be
1004 * obtained in writing. Requests for such permissions may be sent to
1006 * Dr. Andrew S. Tanenbaum
1007 * Wiskundig Seminarium
1008 * Vrije Universiteit
1015 /* Author: J.W. Stevenson */
1017 #include <pc_file.h>
1019 extern struct file **_extfl;
1024 _hlt(ecode) int ecode; {
1027 for (i = 0; i < _extflc; i++)
1028 if (_extfl[i] != (struct file *) 0)
1032 ;ini.c
\0.e
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0%
\a/* $Id: ini.c,v 2.6 1994/06/24 12:32:15 ceriel Exp $ */
1034 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
1036 * This product is part of the Amsterdam Compiler Kit.
1038 * Permission to use, sell, duplicate or disclose this software must be
1039 * obtained in writing. Requests for such permissions may be sent to
1041 * Dr. Andrew S. Tanenbaum
1042 * Wiskundig Seminarium
1043 * Vrije Universiteit
1050 /* Author: J.W. Stevenson */
1052 #include <pc_file.h>
1061 struct file **_extfl;
1062 int _extflc; /* number of external files */
1063 char *_m_lb; /* LB of _m_a_i_n */
1064 struct file *_curfil; /* points to file struct in case of errors */
1068 int _fp_hook = 1; /* This is for Minix, but does not harm others */
1070 _ini(args,c,p,mainlb) char *args,*mainlb; int c; struct file **p; {
1074 _pargc= *(int *)args; args += sizeof (int);
1075 _pargv= *(char ***)args; args += sizeof (char **);
1076 _penvp= *(char ***)args;
1082 if ( (f = _extfl[0]) != (struct file *) 0) {
1084 f->flags = MAGIC|TXTBIT;
1089 f->buflen = PC_BUFLEN;
1091 if ( (f = _extfl[1]) != (struct file *) 0) {
1093 f->flags = MAGIC|TXTBIT|WRBIT|EOFBIT|ELNBIT;
1094 f->fname = "OUTPUT";
1100 f->count = (_gtty(1,buf) >= 0 ? 1 : PC_BUFLEN);
1102 f->buflen = f->count;
1105 *catch.c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0D
\r/* $Id: catch.c,v 2.10 1994/11/14 11:46:58 ceriel Exp $ */
1107 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
1109 * This product is part of the Amsterdam Compiler Kit.
1111 * Permission to use, sell, duplicate or disclose this software must be
1112 * obtained in writing. Requests for such permissions may be sent to
1114 * Dr. Andrew S. Tanenbaum
1115 * Wiskundig Seminarium
1116 * Vrije Universiteit
1125 #include <pc_file.h>
1127 /* to make it easier to patch ... */
1128 extern struct file *_curfil;
1130 static struct errm {
1134 { EARRAY, "array bound error"},
1135 { ERANGE, "range bound error"},
1136 { ESET, "set bound error"},
1137 { EIOVFL, "integer overflow"},
1138 { EFOVFL, "real overflow"},
1139 { EFUNFL, "real underflow"},
1140 { EIDIVZ, "divide by 0"},
1141 { EFDIVZ, "divide by 0.0"},
1142 { EIUND, "undefined integer"},
1143 { EFUND, "undefined real"},
1144 { ECONV, "conversion error"},
1146 { ESTACK, "stack overflow"},
1147 { EHEAP, "heap overflow"},
1148 { EILLINS, "illegal instruction"},
1149 { EODDZ, "illegal size argument"},
1150 { ECASE, "case error"},
1151 { EMEMFLT, "addressing non existent memory"},
1152 { EBADPTR, "bad pointer used"},
1153 { EBADPC, "program counter out of range"},
1154 { EBADLAE, "bad argument of lae"},
1155 { EBADMON, "bad monitor call"},
1156 { EBADLIN, "argument if LIN too high"},
1157 { EBADGTO, "GTO descriptor error"},
1159 { EARGC, "more args expected" },
1160 { EEXP, "error in exp" },
1161 { ELOG, "error in ln" },
1162 { ESQT, "error in sqrt" },
1163 { EASS, "assertion failed" },
1164 { EPACK, "array bound error in pack" },
1165 { EUNPACK, "array bound error in unpack" },
1166 { EMOD, "only positive j in 'i mod j'" },
1167 { EBADF, "file not yet open" },
1168 { EFREE, "dispose error" },
1169 { EFUNASS, "function not assigned" },
1170 { EWIDTH, "illegal field width" },
1172 { EWRITEF, "not writable" },
1173 { EREADF, "not readable" },
1174 { EEOF, "end of file" },
1175 { EFTRUNC, "truncated" },
1176 { ERESET, "reset error" },
1177 { EREWR, "rewrite error" },
1178 { ECLOSE, "close error" },
1179 { EREAD, "read error" },
1180 { EWRITE, "write error" },
1181 { EDIGIT, "digit expected" },
1182 { EASCII, "non-ASCII char read" },
1187 extern char **_pargv;
1188 extern char **_penvp;
1190 extern char *_hol0();
1193 extern int _write();
1195 _catch(erno) unsigned erno; {
1196 register struct errm *ep = &errors[0];
1210 while (ep->errno != erno && ep->errmes != 0) ep++;
1216 *p++ = i % 10 + '0';
1218 while (p > buf) *s++ = *--p;
1224 if ((erno & ~037) == 0140 && (_curfil->flags&0377)==MAGIC) {
1227 *qq++ = _curfil->fname;
1230 if (ep->errmes) *qq++ = ep->errmes;
1232 *qq++ = "error number ";
1240 *p++ = j % 10 + '0';
1242 while (p > buf) *s++ = *--p;
1252 if (_write(2,q,(int)(p-q)) < 0)
1259 log.c
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0ç
\ 4/*
1260 * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
1261 * See the copyright notice in the ACK home directory, in the file "Copyright".
1263 * Author: Ceriel J.H. Jacobs
1266 /* $Id: log.c,v 2.8 1994/06/24 12:32:18 ceriel Exp $ */
1273 #include <pc_math.h>
1283 /* Algorithm and coefficients from:
1284 "Software manual for the elementary functions"
1285 by W.J. Cody and W. Waite, Prentice-Hall, 1980
1287 static double a[] = {
1288 -0.64124943423745581147e2,
1289 0.16383943563021534222e2,
1290 -0.78956112887491257267e0
1292 static double b[] = {
1293 -0.76949932108494879777e3,
1294 0.31203222091924532844e3,
1295 -0.35667977739034646171e2,
1299 extern double _fef();
1300 double znum, zden, z, w;
1308 x = _fef(x, &exponent);
1309 if (x > M_1_SQRT2) {
1310 znum = (x - 0.5) - 0.5;
1311 zden = x * 0.5 + 0.5;
1315 zden = znum * 0.5 + 0.5;
1318 z = znum/zden; w = z * z;
1319 x = z + z * w * (POLYNOM2(w,a)/POLYNOM3(w,b));
1321 x += z * (-2.121944400546905827679e-4);
1322 return x + z * 0.693359375;
1324 Amdi.c
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0á
\ 4/* $Id: mdi.c,v 2.4 1994/06/24 12:32:22 ceriel Exp $ */
1326 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
1328 * This product is part of the Amsterdam Compiler Kit.
1330 * Permission to use, sell, duplicate or disclose this software must be
1331 * obtained in writing. Requests for such permissions may be sent to
1333 * Dr. Andrew S. Tanenbaum
1334 * Wiskundig Seminarium
1335 * Vrije Universiteit
1342 /* Author: J.W. Stevenson */
1348 int _mdi(j,i) int j,i; {
1358 long _mdil(j,i) long j,i; {
1368 int _dvi(j, i) unsigned int j,i; {
1372 j = -(int)j; neg = 1;
1375 i = -(int)i; neg = !neg;
1378 if (neg) return -(int)i;
1382 long _dvil(j, i) unsigned long j,i; {
1386 j = -(long)j; neg = 1;
1389 i = -(long)i; neg = !neg;
1392 if (neg) return -(long)i;
1395 7mdl.c
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0°
\ 2/* $Id: mdl.c,v 2.2 1994/06/24 12:32:24 ceriel Exp $ */
1397 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
1399 * This product is part of the Amsterdam Compiler Kit.
1401 * Permission to use, sell, duplicate or disclose this software must be
1402 * obtained in writing. Requests for such permissions may be sent to
1404 * Dr. Andrew S. Tanenbaum
1405 * Wiskundig Seminarium
1406 * Vrije Universiteit
1413 /* Author: J.W. Stevenson */
1419 long _mdl(j,i) long j,i; {
1428 new.c
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\9d\ 5/* $Id: new.c,v 2.4 1994/06/24 12:32:28 ceriel Exp $ */
1430 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
1432 * This product is part of the Amsterdam Compiler Kit.
1434 * Permission to use, sell, duplicate or disclose this software must be
1435 * obtained in writing. Requests for such permissions may be sent to
1437 * Dr. Andrew S. Tanenbaum
1438 * Wiskundig Seminarium
1439 * Vrije Universiteit
1446 /* Author: J.W. Stevenson */
1451 #define assert(x) /* nothing */
1452 #define UNDEF 0x8000
1459 struct adm *_lastp = 0;
1460 struct adm *_highp = 0;
1462 _new(n,pp) int n; struct adm **pp; {
1466 n = ((n+sizeof(*p)-1) / sizeof(*p)) * sizeof(*p);
1467 if ((p = _lastp) != 0)
1471 assert(q->size%sizeof(adm) == 0);
1472 if ((q->size -= n) == 0) {
1481 p = (struct adm *)((char *)q + q->size);
1482 q = (struct adm *)((char *)p + n);
1486 } while (p != _lastp);
1487 /*no free block big enough*/
1489 q = (struct adm *)((char *)p + n);
1494 while (ptmp < (int *)q)
1497 nobuff.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\0\ 3/* $Id: nobuff.c,v 2.2 1994/06/24 12:32:34 ceriel Exp $ */
1499 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
1501 * This product is part of the Amsterdam Compiler Kit.
1503 * Permission to use, sell, duplicate or disclose this software must be
1504 * obtained in writing. Requests for such permissions may be sent to
1506 * Dr. Andrew S. Tanenbaum
1507 * Wiskundig Seminarium
1508 * Vrije Universiteit
1515 /* Author: J.W. Stevenson */
1517 #include <pc_file.h>
1521 /* procedure nobuff(var f:file of ?); */
1523 nobuff(f) struct file *f; {
1525 if ((f->flags & (0377|WRBIT)) != (MAGIC|WRBIT))
1528 f->count = f->buflen = f->size;
1530 notext.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0R
\ 2/* $Id: notext.c,v 2.3 1994/06/24 12:32:37 ceriel Exp $ */
1532 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
1534 * This product is part of the Amsterdam Compiler Kit.
1536 * Permission to use, sell, duplicate or disclose this software must be
1537 * obtained in writing. Requests for such permissions may be sent to
1539 * Dr. Andrew S. Tanenbaum
1540 * Wiskundig Seminarium
1541 * Vrije Universiteit
1548 #include <pc_file.h>
1550 notext(f) struct file *f; {
1551 f->flags &= ~TXTBIT;
1553 opn.c
\0.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0x /* $Id: opn.c,v 2.6 1994/06/24 12:32:40 ceriel Exp $ */
1555 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
1557 * This product is part of the Amsterdam Compiler Kit.
1559 * Permission to use, sell, duplicate or disclose this software must be
1560 * obtained in writing. Requests for such permissions may be sent to
1562 * Dr. Andrew S. Tanenbaum
1563 * Wiskundig Seminarium
1564 * Vrije Universiteit
1571 /* Author: J.W. Stevenson */
1573 #include <pc_file.h>
1576 extern struct file **_extfl;
1578 extern struct file *_curfil;
1580 extern char **_pargv;
1581 extern char **_penvp;
1586 extern int _getpid();
1587 extern int _creat();
1589 extern int _close();
1590 extern int _unlink();
1591 extern long _lseek();
1593 static int tmpfil() {
1594 static char namebuf[] = "/usr/tmp/plf.xxxxx";
1601 *q++ = (i & 07) + '0';
1604 if ((i = _creat(p,0644)) < 0)
1605 if ((i = _creat(p += 4,0644)) < 0)
1606 if ((i = _creat(p += 5,0644)) < 0)
1610 if ((i = _open(p,2)) < 0)
1612 if (_unlink(p) != 0)
1617 static int initfl(descr,sz,f) int descr; int sz; struct file *f; {
1625 for (i=0; i<_extflc; i++)
1628 if (i >= _extflc) { /* local file */
1630 if ((descr & WRBIT) == 0 && (f->flags & 0377) == MAGIC) {
1632 if (_lseek(f->ufd,(long)0,0) == -1)
1638 } else { /* external file */
1643 f->fname = _pargv[i];
1645 if ((descr & WRBIT) == 0) {
1646 if ((f->ufd = _open(f->fname,0)) < 0)
1649 if ((f->ufd = _creat(f->fname,0644)) < 0)
1653 f->buflen = (sz>PC_BUFLEN ? sz : PC_BUFLEN-PC_BUFLEN%sz);
1660 _opn(sz,f) int sz; struct file *f; {
1662 if (initfl(MAGIC,sz,f))
1666 _cre(sz,f) int sz; struct file *f; {
1668 if (initfl(WRBIT|EOFBIT|ELNBIT|MAGIC,sz,f))
1669 f->count = f->buflen;
1671 hol0.e
\0c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0x
\ 2#
1673 ; $Id: hol0.e,v 2.3 1994/06/24 12:32:09 ceriel Exp $
1675 ; (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
1677 ; This product is part of the Amsterdam Compiler Kit.
1679 ; Permission to use, sell, duplicate or disclose this software must be
1680 ; obtained in writing. Requests for such permissions may be sent to
1682 ; Dr. Andrew S. Tanenbaum
1683 ; Wiskundig Seminarium
1684 ; Vrije Universiteit
1691 mes 2,EM_WSIZE,EM_PSIZE
1693 ; _hol0 return the address of the ABS block (hol0)
1700 pac.c
\0\0c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0/
\ 5/* $Id: pac.c,v 2.6 1994/06/24 12:32:49 ceriel Exp $ */
1702 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
1704 * This product is part of the Amsterdam Compiler Kit.
1706 * Permission to use, sell, duplicate or disclose this software must be
1707 * obtained in writing. Requests for such permissions may be sent to
1709 * Dr. Andrew S. Tanenbaum
1710 * Wiskundig Seminarium
1711 * Vrije Universiteit
1718 /* Author: J.W. Stevenson */
1724 #define assert(x) /* nothing */
1727 #define EM_WSIZE _EM_WSIZE
1736 _pac(ad,zd,zp,i,ap) int i; struct descr *ad,*zd; char *zp,*ap; {
1738 if (zd->diff > ad->diff ||
1739 (i -= ad->low) < 0 ||
1740 (i+zd->diff) > ad->diff)
1742 ap += (i * ad->size);
1743 i = (zd->diff + 1) * zd->size;
1744 if (zd->size == 1) {
1745 int *aptmp = (int *)ap;
1746 assert(ad->size == EM_WSIZE);
1750 } else if (zd->size == 2) {
1751 int *aptmp = (int *)ap;
1752 short *zptmp = (short *) zp;
1753 assert(ad->size == EM_WSIZE);
1755 *zptmp++ = *aptmp++;
1758 assert(ad->size == zd->size);
1763 pclose.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\82\ 2/* $Id: pclose.c,v 2.3 1994/06/24 12:32:54 ceriel Exp $ */
1765 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
1767 * This product is part of the Amsterdam Compiler Kit.
1769 * Permission to use, sell, duplicate or disclose this software must be
1770 * obtained in writing. Requests for such permissions may be sent to
1772 * Dr. Andrew S. Tanenbaum
1773 * Wiskundig Seminarium
1774 * Vrije Universiteit
1781 #include <pc_file.h>
1785 /* procedure pclose(var f:file of ??); */
1787 pclose(f) struct file *f; {
1790 pcreat.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0Å
\ 3/* $Id: pcreat.c,v 2.4 1994/06/24 12:32:59 ceriel Exp $ */
1792 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
1794 * This product is part of the Amsterdam Compiler Kit.
1796 * Permission to use, sell, duplicate or disclose this software must be
1797 * obtained in writing. Requests for such permissions may be sent to
1799 * Dr. Andrew S. Tanenbaum
1800 * Wiskundig Seminarium
1801 * Vrije Universiteit
1808 /* Author: J.W. Stevenson */
1810 #include <pc_file.h>
1815 extern int _creat();
1817 /* procedure pcreat(var f:text; s:string); */
1819 pcreat(f,s) struct file *f; char *s; {
1821 _cls(f); /* initializes _curfil */
1823 f->flags = WRBIT|EOFBIT|ELNBIT|TXTBIT|MAGIC;
1826 f->count = PC_BUFLEN;
1827 f->buflen = PC_BUFLEN;
1828 if ((f->ufd = _creat(s,0644)) < 0)
1831 pentry.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0ü
\ 2/* $Id: pentry.c,v 2.3 1994/06/24 12:33:03 ceriel Exp $ */
1833 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
1835 * This product is part of the Amsterdam Compiler Kit.
1837 * Permission to use, sell, duplicate or disclose this software must be
1838 * obtained in writing. Requests for such permissions may be sent to
1840 * Dr. Andrew S. Tanenbaum
1841 * Wiskundig Seminarium
1842 * Vrije Universiteit
1849 /* Author: J.W. Stevenson */
1851 #include <pc_file.h>
1853 extern struct file **_extfl;
1858 procentry(name) char *name; {
1866 perrno.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0d
\ 2/* $Id: perrno.c,v 2.3 1994/06/24 12:33:08 ceriel Exp $ */
1868 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
1870 * This product is part of the Amsterdam Compiler Kit.
1872 * Permission to use, sell, duplicate or disclose this software must be
1873 * obtained in writing. Requests for such permissions may be sent to
1875 * Dr. Andrew S. Tanenbaum
1876 * Wiskundig Seminarium
1877 * Vrije Universiteit
1884 /* function perrno:integer; extern; */
1891 pexit.c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0Ü
\ 2/* $Id: pexit.c,v 2.4 1994/06/24 12:33:14 ceriel Exp $ */
1893 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
1895 * This product is part of the Amsterdam Compiler Kit.
1897 * Permission to use, sell, duplicate or disclose this software must be
1898 * obtained in writing. Requests for such permissions may be sent to
1900 * Dr. Andrew S. Tanenbaum
1901 * Wiskundig Seminarium
1902 * Vrije Universiteit
1909 #include <pc_file.h>
1911 extern struct file **_extfl;
1916 procexit(name) char *name; {
1924 popen.c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0¢
\ 3/* $Id: popen.c,v 2.4 1994/06/24 12:33:18 ceriel Exp $ */
1926 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
1928 * This product is part of the Amsterdam Compiler Kit.
1930 * Permission to use, sell, duplicate or disclose this software must be
1931 * obtained in writing. Requests for such permissions may be sent to
1933 * Dr. Andrew S. Tanenbaum
1934 * Wiskundig Seminarium
1935 * Vrije Universiteit
1942 /* Author: J.W. Stevenson */
1944 #include <pc_file.h>
1951 /* procedure popen(var f:text; s:string); */
1953 popen(f,s) struct file *f; char *s; {
1955 _cls(f); /* initializes _curfil */
1957 f->flags = TXTBIT|MAGIC;
1961 f->buflen = PC_BUFLEN;
1962 if ((f->ufd = _open(s,0)) < 0)
1965 cls.c
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0Ñ
\ 4/* $Id: cls.c,v 2.3 1994/06/24 12:31:27 ceriel Exp $ */
1967 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
1969 * This product is part of the Amsterdam Compiler Kit.
1971 * Permission to use, sell, duplicate or disclose this software must be
1972 * obtained in writing. Requests for such permissions may be sent to
1974 * Dr. Andrew S. Tanenbaum
1975 * Wiskundig Seminarium
1976 * Vrije Universiteit
1983 /* Author: J.W. Stevenson */
1985 #include <pc_file.h>
1988 extern struct file *_curfil;
1992 extern int _close();
1994 _xcls(f) struct file *f; {
1996 if ((f->flags & WRBIT) == 0)
1998 if ((f->flags & (TXTBIT|ELNBIT)) == TXTBIT) {
2009 _cls(f) struct file *f; {
2015 if ((f->flags&0377) != MAGIC)
2028 if (_close(f->ufd) != 0)
2032 +put.c
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0p
\ 2/* $Id: put.c,v 2.3 1994/06/24 12:33:24 ceriel Exp $ */
2034 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
2036 * This product is part of the Amsterdam Compiler Kit.
2038 * Permission to use, sell, duplicate or disclose this software must be
2039 * obtained in writing. Requests for such permissions may be sent to
2041 * Dr. Andrew S. Tanenbaum
2042 * Wiskundig Seminarium
2043 * Vrije Universiteit
2050 #include <pc_file.h>
2055 _put(f) struct file *f; {
2059 rdc.c
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\95\ 2/* $Id: rdc.c,v 2.3 1994/06/24 12:33:33 ceriel Exp $ */
2061 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
2063 * This product is part of the Amsterdam Compiler Kit.
2065 * Permission to use, sell, duplicate or disclose this software must be
2066 * obtained in writing. Requests for such permissions may be sent to
2068 * Dr. Andrew S. Tanenbaum
2069 * Wiskundig Seminarium
2070 * Vrije Universiteit
2077 #include <pc_file.h>
2082 int _rdc(f) struct file *f; {
2090 rdl.c
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0w
\ 3/* $Id: rdl.c,v 2.3 1994/06/24 12:33:42 ceriel Exp $ */
2092 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
2094 * This product is part of the Amsterdam Compiler Kit.
2096 * Permission to use, sell, duplicate or disclose this software must be
2097 * obtained in writing. Requests for such permissions may be sent to
2099 * Dr. Andrew S. Tanenbaum
2100 * Wiskundig Seminarium
2101 * Vrije Universiteit
2108 /* Author: J.W. Stevenson */
2110 #include <pc_file.h>
2114 extern int _getsig();
2115 extern int _fstdig();
2116 extern int _nxtdig();
2118 long _rdl(f) struct file *f; {
2119 int is_signed,ch; long l;
2123 is_signed = _getsig(f);
2128 while ((ch = _nxtdig(f)) >= 0);
2129 return(is_signed ? l : -l);
2131 prdr.c
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0v
\ 5/* $Id: rdr.c,v 2.3 1994/06/24 12:33:48 ceriel Exp $ */
2133 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
2135 * This product is part of the Amsterdam Compiler Kit.
2137 * Permission to use, sell, duplicate or disclose this software must be
2138 * obtained in writing. Requests for such permissions may be sent to
2140 * Dr. Andrew S. Tanenbaum
2141 * Wiskundig Seminarium
2142 * Vrije Universiteit
2149 /* Author: J.W. Stevenson */
2151 #include <pc_file.h>
2158 extern int _getsig();
2159 extern int _getint();
2160 extern int _fstdig();
2161 extern int _nxtdig();
2166 static dig(ch) int ch; {
2174 double _rdr(f) struct file *f; {
2175 int i; double e; int is_signed,ch;
2181 is_signed = _getsig(f);
2185 while ((ch = _nxtdig(f)) >= 0);
2186 if (*f->ptr == '.') {
2192 } while ((ch = _nxtdig(f)) >= 0);
2194 if ((*f->ptr == 'e') || (*f->ptr == 'E')) {
2196 pow10 += _getint(f);
2198 if ((i = pow10) < 0)
2207 return(is_signed? -r : r);
2209 rdi.c
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0m
\ 5/* $Id: rdi.c,v 2.3 1994/06/24 12:33:38 ceriel Exp $ */
2211 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
2213 * This product is part of the Amsterdam Compiler Kit.
2215 * Permission to use, sell, duplicate or disclose this software must be
2216 * obtained in writing. Requests for such permissions may be sent to
2218 * Dr. Andrew S. Tanenbaum
2219 * Wiskundig Seminarium
2220 * Vrije Universiteit
2227 /* Author: J.W. Stevenson */
2229 #include <pc_file.h>
2236 _skipsp(f) struct file *f; {
2237 while ((*f->ptr == ' ') || (*f->ptr == '\t'))
2241 int _getsig(f) struct file *f; {
2244 if ((sign = (*f->ptr == '-')) || *f->ptr == '+')
2249 int _fstdig(f) struct file *f; {
2253 if ((unsigned) ch > 9) {
2260 int _nxtdig(f) struct file *f; {
2265 if ((unsigned) ch > 9)
2270 int _getint(f) struct file *f; {
2273 is_signed = _getsig(f);
2278 while ((ch = _nxtdig(f)) >= 0);
2279 return(is_signed ? i : -i);
2282 int _rdi(f) struct file *f; {
2287 rln.c
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0¨
\ 2/* $Id: rln.c,v 2.3 1994/06/24 12:33:55 ceriel Exp $ */
2289 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
2291 * This product is part of the Amsterdam Compiler Kit.
2293 * Permission to use, sell, duplicate or disclose this software must be
2294 * obtained in writing. Requests for such permissions may be sent to
2296 * Dr. Andrew S. Tanenbaum
2297 * Wiskundig Seminarium
2298 * Vrije Universiteit
2305 #include <pc_file.h>
2310 _rln(f) struct file *f; {
2313 while ((f->flags & ELNBIT) == 0)
2315 f->flags &= ~WINDOW;
2317 rf.c
\0\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\e\ 3/* $Id: rf.c,v 2.3 1994/06/24 12:33:52 ceriel Exp $ */
2319 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
2321 * This product is part of the Amsterdam Compiler Kit.
2323 * Permission to use, sell, duplicate or disclose this software must be
2324 * obtained in writing. Requests for such permissions may be sent to
2326 * Dr. Andrew S. Tanenbaum
2327 * Wiskundig Seminarium
2328 * Vrije Universiteit
2335 #include <pc_file.h>
2338 extern struct file *_curfil;
2342 _rf(f) struct file *f; {
2345 if ((f->flags&0377) != MAGIC)
2347 if (f->flags & WRBIT)
2349 if ((f->flags & WINDOW) == 0)
2352 trnd.c
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0C
\ 2/* $Id: rnd.c,v 2.3 1994/06/24 12:33:58 ceriel Exp $ */
2354 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
2356 * This product is part of the Amsterdam Compiler Kit.
2358 * Permission to use, sell, duplicate or disclose this software must be
2359 * obtained in writing. Requests for such permissions may be sent to
2361 * Dr. Andrew S. Tanenbaum
2362 * Wiskundig Seminarium
2363 * Vrije Universiteit
2370 double _rnd(r) double r; {
2371 return(r + (r<0 ? -0.5 : 0.5));
2373 csav.e
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\98\ 3#
2374 ; $Id: sav.e,v 2.2 1994/06/24 12:34:01 ceriel Exp $
2375 ; (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
2377 ; This product is part of the Amsterdam Compiler Kit.
2379 ; Permission to use, sell, duplicate or disclose this software must be
2380 ; obtained in writing. Requests for such permissions may be sent to
2382 ; Dr. Andrew S. Tanenbaum
2383 ; Wiskundig Seminarium
2384 ; Vrije Universiteit
2390 /* Author: J.W. Stevenson */
2393 mes 2,EM_WSIZE,EM_PSIZE
2399 ; _sav called with one parameter:
2400 ; - address of pointer variable (PTRAD)
2411 ; _rst is called with one parameter:
2412 ; - address of pointer variable (PTRAD)
2422 sig.e
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0?
\ 3#define PROC 0
2424 ; $Id: sig.e,v 2.4 1994/06/24 12:34:04 ceriel Exp $
2426 ; (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
2428 ; This product is part of the Amsterdam Compiler Kit.
2430 ; Permission to use, sell, duplicate or disclose this software must be
2431 ; obtained in writing. Requests for such permissions may be sent to
2433 ; Dr. Andrew S. Tanenbaum
2434 ; Wiskundig Seminarium
2435 ; Vrije Universiteit
2442 mes 2,EM_WSIZE,EM_PSIZE
2444 ; _sig is called with one parameter:
2445 ; - procedure instance identifier (PROC)
2446 ; and returns nothing.
2447 ; only the procedure identifier inside the PROC is used.
2455 ret 0 ; ignore the result of sig
2457 Dsin.c
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0Í
\ 6/*
2458 * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
2459 * See the copyright notice in the ACK home directory, in the file "Copyright".
2461 * Author: Ceriel J.H. Jacobs
2464 /* $Id: sin.c,v 2.7 1994/06/24 12:34:07 ceriel Exp $ */
2470 #include <pc_math.h>
2477 /* Algorithm and coefficients from:
2478 "Software manual for the elementary functions"
2479 by W.J. Cody and W. Waite, Prentice-Hall, 1980
2482 static double r[] = {
2483 -0.16666666666666665052e+0,
2484 0.83333333333331650314e-2,
2485 -0.19841269841201840457e-3,
2486 0.27557319210152756119e-5,
2487 -0.25052106798274584544e-7,
2488 0.16058936490371589114e-9,
2489 -0.76429178068910467734e-12,
2490 0.27204790957888846175e-14
2507 /* ??? avoid loss of significance, if y is too large, error ??? */
2509 y = y * M_1_PI + 0.5;
2511 /* Use extended precision to calculate reduced argument.
2512 Here we used 12 bits of the mantissa for a1.
2513 Also split x in integer part x1 and fraction part x2.
2515 #define A1 3.1416015625
2516 #define A2 -8.908910206761537356617e-6
2519 extern double _fif();
2522 if (_fif(y, 0.5, &x1)) neg = !neg;
2523 if (cos_flag) y -= 0.5;
2524 x2 = _fif(x, 1.0, &x1);
2537 /* ??? avoid underflow ??? */
2540 x += x * y * POLYNOM7(y, r);
2541 return neg ? -x : x;
2558 sqt.c
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0´
\ 4/*
2559 * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
2560 * See the copyright notice in the ACK home directory, in the file "Copyright".
2562 * Author: Ceriel J.H. Jacobs
2565 /* $Id: sqt.c,v 2.6 1994/06/24 12:34:10 ceriel Exp $ */
2578 extern double _fef();
2586 fl = _fef(fl,&currexp);
2590 fl *= (double) (1L << 30);
2593 fl *= (double) (1L << exp);
2597 fl /= (double) (1L << 30);
2600 fl /= (double) (1L << -exp);
2609 extern double _fef();
2614 if (x < 0) _trp(ESQT);
2618 val = _fef(x, &exponent);
2623 val = Ldexp(val + 1.0, exponent/2 - 1);
2624 /* was: val = (val + 1.0)/2.0; val = Ldexp(val, exponent/2); */
2625 for (exponent = NITER - 1; exponent >= 0; exponent--) {
2626 val = (val + x / val) / 2.0;
2630 fef.e
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0l
\ 3#
2631 ; $Id: fef.e,v 2.3 1994/06/24 12:31:51 ceriel Exp $
2633 ; (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
2635 ; This product is part of the Amsterdam Compiler Kit.
2637 ; Permission to use, sell, duplicate or disclose this software must be
2638 ; obtained in writing. Requests for such permissions may be sent to
2640 ; Dr. Andrew S. Tanenbaum
2641 ; Wiskundig Seminarium
2642 ; Vrije Universiteit
2649 mes 2,EM_WSIZE,EM_PSIZE
2652 #define ERES EM_DSIZE
2654 ; _fef is called with two parameters:
2655 ; - address of exponent result (ERES)
2656 ; - floating point number to be split (FARG)
2657 ; and returns an EM_DSIZE-byte floating point number
2669 string.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0j
\ 4/* $Id: string.c,v 2.3 1994/06/24 12:34:13 ceriel Exp $ */
2671 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
2673 * This product is part of the Amsterdam Compiler Kit.
2675 * Permission to use, sell, duplicate or disclose this software must be
2676 * obtained in writing. Requests for such permissions may be sent to
2678 * Dr. Andrew S. Tanenbaum
2679 * Wiskundig Seminarium
2680 * Vrije Universiteit
2687 /* function strbuf(var b:charbuf):string; */
2689 char *strbuf(s) char *s; {
2693 /* function strtobuf(s:string; var b:charbuf; blen:integer):integer; */
2695 int strtobuf(s,b,l) char *s,*b; {
2700 if ((*b++ = *s++) == 0)
2707 /* function strlen(s:string):integer; */
2709 int strlen(s) char *s; {
2718 /* function strfetch(s:string; i:integer):char; */
2720 int strfetch(s,i) char *s; {
2724 /* procedure strstore(s:string; i:integer; c:char); */
2726 strstore(s,i,c) char *s; {
2729 trap.e
\0c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\90\ 2#
2731 ; $Id: trap.e,v 2.3 1994/06/24 12:34:16 ceriel Exp $
2733 ; (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
2735 ; This product is part of the Amsterdam Compiler Kit.
2737 ; Permission to use, sell, duplicate or disclose this software must be
2738 ; obtained in writing. Requests for such permissions may be sent to
2740 ; Dr. Andrew S. Tanenbaum
2741 ; Wiskundig Seminarium
2742 ; Vrije Universiteit
2749 mes 2,EM_WSIZE,EM_PSIZE
2753 ; trap is called with one parameter:
2754 ; - trap number (TRAP)
2762 unp.c
\0\0c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0¢
\ 5/* $Id: unp.c,v 2.6 1994/06/24 12:34:23 ceriel Exp $ */
2764 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
2766 * This product is part of the Amsterdam Compiler Kit.
2768 * Permission to use, sell, duplicate or disclose this software must be
2769 * obtained in writing. Requests for such permissions may be sent to
2771 * Dr. Andrew S. Tanenbaum
2772 * Wiskundig Seminarium
2773 * Vrije Universiteit
2780 /* Author: J.W. Stevenson */
2786 #define assert(x) /* nothing */
2789 #define EM_WSIZE _EM_WSIZE
2798 _unp(ad,zd,i,ap,zp,noext) int i; struct descr *ad,*zd; char *ap,*zp; int noext; {
2800 if (zd->diff > ad->diff ||
2801 (i -= ad->low) < 0 ||
2802 (i+zd->diff) > ad->diff)
2804 ap += (i * ad->size);
2805 i = (zd->diff + 1) * zd->size;
2806 if (zd->size == 1) {
2807 int *aptmp = (int *) ap;
2808 assert(ad->size == EM_WSIZE);
2810 if (noext) *aptmp++ = *zp++ & 0377;
2811 else *aptmp++ = *zp++;
2813 } else if (zd->size == 2) {
2814 int *aptmp = (int *) ap;
2815 short *zptmp = (short *) zp;
2816 assert(ad->size == EM_WSIZE);
2818 if (noext) *aptmp++ = *zptmp++ & 0177777;
2819 else *aptmp++ = *zptmp++;
2822 assert(ad->size == zd->size);
2827 uread.c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\9e\ 2/* $Id: uread.c,v 2.4 1994/06/24 12:34:25 ceriel Exp $ */
2829 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
2831 * This product is part of the Amsterdam Compiler Kit.
2833 * Permission to use, sell, duplicate or disclose this software must be
2834 * obtained in writing. Requests for such permissions may be sent to
2836 * Dr. Andrew S. Tanenbaum
2837 * Wiskundig Seminarium
2838 * Vrije Universiteit
2845 /* function uread(fd:integer; var b:buf; n:integer):integer; */
2849 int uread(fd,b,n) char *b; int fd,n; {
2850 return(_read(fd,b,n));
2852 uwrite.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0£
\ 2/* $Id: uwrite.c,v 2.4 1994/06/24 12:34:28 ceriel Exp $ */
2854 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
2856 * This product is part of the Amsterdam Compiler Kit.
2858 * Permission to use, sell, duplicate or disclose this software must be
2859 * obtained in writing. Requests for such permissions may be sent to
2861 * Dr. Andrew S. Tanenbaum
2862 * Wiskundig Seminarium
2863 * Vrije Universiteit
2870 /* function uwrite(fd:integer; var b:buf; n:integer):integer; */
2872 extern int _write();
2874 int uwrite(fd,b,n) char *b; int fd,n; {
2875 return(_write(fd,b,n));
2877 twdw.c
\0.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0Ë
\ 2/* $Id: wdw.c,v 2.3 1994/06/24 12:34:31 ceriel Exp $ */
2879 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
2881 * This product is part of the Amsterdam Compiler Kit.
2883 * Permission to use, sell, duplicate or disclose this software must be
2884 * obtained in writing. Requests for such permissions may be sent to
2886 * Dr. Andrew S. Tanenbaum
2887 * Wiskundig Seminarium
2888 * Vrije Universiteit
2895 #include <pc_file.h>
2897 extern struct file *_curfil;
2900 char *_wdw(f) struct file *f; {
2903 if ((f->flags & (WINDOW|WRBIT|0377)) == MAGIC)
2907 ;incpt.c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\9f\ 5/* $Id: incpt.c,v 2.3 1994/06/24 12:32:12 ceriel Exp $ */
2909 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
2911 * This product is part of the Amsterdam Compiler Kit.
2913 * Permission to use, sell, duplicate or disclose this software must be
2914 * obtained in writing. Requests for such permissions may be sent to
2916 * Dr. Andrew S. Tanenbaum
2917 * Wiskundig Seminarium
2918 * Vrije Universiteit
2925 /* Author: J.W. Stevenson */
2927 #include <pc_file.h>
2936 _incpt(f) struct file *f; {
2938 if (f->flags & EOFBIT)
2941 f->flags &= ~ELNBIT;
2946 if (f->count == 0) {
2949 f->count=_read(f->ufd,f->bufadr,f->buflen);
2951 if (errno != EINTR) _trp(EREAD) ;
2956 if (f->count == 0) {
2962 if ((f->count -= f->size) < 0)
2965 } while ((f->flags&TXTBIT) && *f->ptr == '\r');
2967 if (f->flags & TXTBIT) {
2970 if (*f->ptr == '\n') {
2975 if (*f->ptr == 26) {
2983 wrc.c
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0,
\ 3/* $Id: wrc.c,v 2.3 1994/06/24 12:34:39 ceriel Exp $ */
2985 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
2987 * This product is part of the Amsterdam Compiler Kit.
2989 * Permission to use, sell, duplicate or disclose this software must be
2990 * obtained in writing. Requests for such permissions may be sent to
2992 * Dr. Andrew S. Tanenbaum
2993 * Wiskundig Seminarium
2994 * Vrije Universiteit
3001 #include <pc_file.h>
3006 _wrc(c,f) int c; struct file *f; {
3012 _wln(f) struct file *f; {
3020 _pag(f) struct file *f; {
3024 wrf.c
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0ð
\ 5/* $Id: wrf.c,v 2.6 1994/06/24 12:34:42 ceriel Exp $ */
3026 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
3028 * This product is part of the Amsterdam Compiler Kit.
3030 * Permission to use, sell, duplicate or disclose this software must be
3031 * obtained in writing. Requests for such permissions may be sent to
3033 * Dr. Andrew S. Tanenbaum
3034 * Wiskundig Seminarium
3035 * Vrije Universiteit
3042 /* Author: J.W. Stevenson */
3045 #include <pc_file.h>
3048 extern char *_fcvt();
3050 #define assert(x) /* nothing */
3054 #define HUGE_DIG DBL_MAX_10_EXP /* log10(maxreal) */
3056 #define HUGE_DIG 400 /* log10(maxreal) */
3058 #define PREC_DIG 80 /* the maximum digits returned by _fcvt() */
3059 #define FILL_CHAR '0' /* char printed if all of _fcvt() used */
3060 #define BUFSIZE HUGE_DIG + PREC_DIG + 3
3062 _wrf(n,w,r,f) int n,w; double r; struct file *f; {
3063 char *p,*b; int s,d; char buf[BUFSIZE];
3065 if ( n < 0 || w < 0) _trp(EWIDTH);
3069 b = _fcvt(r,n,&d,&s);
3070 assert(abs(d) <= HUGE_DIG);
3077 *p++ = (*b ? *b++ : FILL_CHAR);
3087 *p++ = (*b ? *b++ : FILL_CHAR);
3088 assert(p <= buf+BUFSIZE);
3090 _wstrin(w,(int)(p-buf),buf,f);
3092 wri.c
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\04
\ 5/* $Id: wri.c,v 2.7 1994/06/24 12:34:45 ceriel Exp $ */
3094 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
3096 * This product is part of the Amsterdam Compiler Kit.
3098 * Permission to use, sell, duplicate or disclose this software must be
3099 * obtained in writing. Requests for such permissions may be sent to
3101 * Dr. Andrew S. Tanenbaum
3102 * Wiskundig Seminarium
3103 * Vrije Universiteit
3111 #include <pc_file.h>
3117 #define EM_WSIZE _EM_WSIZE
3123 #define MININT -2147483648
3124 #define STRMININT "-2147483648"
3128 #define MININT -32768
3129 #define STRMININT "-32768"
3134 #define STRMININT "-128"
3138 Something wrong here!
3141 _wsi(w,i,f) int w,i; struct file *f; {
3142 char *p; int j; char buf[SZ];
3144 if (w < 0) _trp(EWIDTH);
3148 _wstrin(w,SZ,STRMININT,f);
3158 _wstrin(w,(int)(&buf[SZ]-p),p,f);
3161 _wri(i,f) int i; struct file *f; {
3164 wrl.c
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\ e\ 4/* $Id: wrl.c,v 2.4 1994/06/24 12:34:49 ceriel Exp $ */
3166 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
3168 * This product is part of the Amsterdam Compiler Kit.
3170 * Permission to use, sell, duplicate or disclose this software must be
3171 * obtained in writing. Requests for such permissions may be sent to
3173 * Dr. Andrew S. Tanenbaum
3174 * Wiskundig Seminarium
3175 * Vrije Universiteit
3182 /* Author: J.W. Stevenson */
3185 #include <pc_file.h>
3189 #define MAXNEGLONG -2147483648
3191 _wsl(w,l,f) int w; long l; struct file *f; {
3192 char *p,c; long j; char buf[11];
3194 if (w < 0) _trp(EWIDTH);
3197 if (l == MAXNEGLONG) {
3198 _wstrin(w,11,"-2147483648",f);
3209 _wstrin(w,(int)(&buf[11]-p),p,f);
3212 _wrl(l,f) long l; struct file *f; {
3215 wrr.c
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\ e\ 5/* $Id: wrr.c,v 2.4 1994/06/24 12:34:52 ceriel Exp $ */
3217 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
3219 * This product is part of the Amsterdam Compiler Kit.
3221 * Permission to use, sell, duplicate or disclose this software must be
3222 * obtained in writing. Requests for such permissions may be sent to
3224 * Dr. Andrew S. Tanenbaum
3225 * Wiskundig Seminarium
3226 * Vrije Universiteit
3233 /* Author: J.W. Stevenson */
3236 #include <pc_file.h>
3239 extern char *_ecvt();
3241 #define PREC_DIG 80 /* maximum digits produced by _ecvt() */
3243 _wsr(w,r,f) int w; double r; struct file *f; {
3244 char *p,*b; int s,d,i; char buf[PREC_DIG+7];
3246 if (w < 0) _trp(EWIDTH);
3250 b = _ecvt(r,i,&d,&s);
3251 *p++ = s? '-' : ' ';
3273 *p++ = '0' + (d/10) % 10;
3276 _wstrin(w,(int)(p-buf),buf,f);
3279 _wrr(r,f) double r; struct file *f; {
3282 cvt.c
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0H
\b/* $Id: cvt.c,v 2.6 1994/06/24 12:31:29 ceriel Exp $ */
3289 #define DBL_MAX M_MAX_D
3296 _ecvt(value, ndigit, decpt, sign)
3298 int ndigit, *decpt, *sign;
3300 return cvt(value, ndigit, decpt, sign, 1);
3304 _fcvt(value, ndigit, decpt, sign)
3306 int ndigit, *decpt, *sign;
3308 return cvt(value, ndigit, decpt, sign, 0);
3311 static struct powers_of_10 {
3316 1.0e32, 1.0e-32, 32,
3317 1.0e16, 1.0e-16, 16,
3326 cvt(value, ndigit, decpt, sign, ecvtflag)
3328 int ndigit, *decpt, *sign;
3330 static char buf[NDIGITS+1];
3331 register char *p = buf;
3334 if (ndigit < 0) ndigit = 0;
3335 if (ndigit > NDIGITS) ndigit = NDIGITS;
3346 if (value >= DBL_MAX) {
3350 register struct powers_of_10 *pp = &p10[0];
3352 if (value >= 10.0) do {
3353 while (value >= pp->pval) {
3357 } while ((++pp)->exp > 0);
3360 if (value < 1.0) do {
3361 while (value * pp->pval < 10.0) {
3365 } while ((++pp)->exp > 0);
3367 (*decpt)++; /* because now value in [1.0, 10.0) */
3370 /* for fcvt() we need ndigit digits behind the dot */
3372 if (pe > &buf[NDIGITS]) pe = &buf[NDIGITS];
3375 *p++ = (int)value + '0';
3376 value = 10.0 * (value - (int)value);
3380 *p += 5; /* round of at the end */
3383 if (p > buf) ++*--p;
3388 /* maybe add another digit at the end,
3389 because the point was shifted right
3391 if (pe > buf) *pe = '0';
3401 fif.e
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\8f\ 3#
3402 ; $Id: fif.e,v 2.3 1994/06/24 12:31:54 ceriel Exp $
3404 ; (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
3406 ; This product is part of the Amsterdam Compiler Kit.
3408 ; Permission to use, sell, duplicate or disclose this software must be
3409 ; obtained in writing. Requests for such permissions may be sent to
3411 ; Dr. Andrew S. Tanenbaum
3412 ; Wiskundig Seminarium
3413 ; Vrije Universiteit
3420 mes 2,EM_WSIZE,EM_PSIZE
3423 #define ARG2 EM_DSIZE
3424 #define IRES 2*EM_DSIZE
3426 ; _fif is called with three parameters:
3427 ; - address of integer part result (IRES)
3428 ; - float two (ARG2)
3429 ; - float one (ARG1)
3430 ; and returns an EM_DSIZE-byte floating point number
3442 Gwrz.c
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\02
\ 3/* $Id: wrz.c,v 2.5 1994/06/24 12:34:58 ceriel Exp $ */
3444 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
3446 * This product is part of the Amsterdam Compiler Kit.
3448 * Permission to use, sell, duplicate or disclose this software must be
3449 * obtained in writing. Requests for such permissions may be sent to
3451 * Dr. Andrew S. Tanenbaum
3452 * Wiskundig Seminarium
3453 * Vrije Universiteit
3461 #include <pc_file.h>
3466 _wsz(w,s,f) int w; char *s; struct file *f; {
3469 if (w < 0) _trp(EWIDTH);
3471 _wss(w,(int)(p-s),s,f);
3474 _wrz(s,f) char *s; struct file *f; {
3478 _wrs((int)(p-s),s,f);
3480 wrs.c
\0c
\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0-
\ 5/* $Id: wrs.c,v 2.3 1994/06/24 12:34:55 ceriel Exp $ */
3482 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
3484 * This product is part of the Amsterdam Compiler Kit.
3486 * Permission to use, sell, duplicate or disclose this software must be
3487 * obtained in writing. Requests for such permissions may be sent to
3489 * Dr. Andrew S. Tanenbaum
3490 * Wiskundig Seminarium
3491 * Vrije Universiteit
3498 /* Author: J.W. Stevenson */
3501 #include <pc_file.h>
3506 _wstrin(width,len,buf,f) int width,len; char *buf; struct file *f; {
3509 for (width -= len; width>0; width--) {
3513 while (--len >= 0) {
3519 _wsc(w,c,f) int w; char c; struct file *f; {
3521 if (w < 0) _trp(EWIDTH);
3525 _wss(w,len,s,f) int w,len; char *s; struct file *f; {
3527 if (w < 0 || len < 0) _trp(EWIDTH);
3533 _wrs(len,s,f) int len; char *s; struct file *f; {
3534 if (len < 0) _trp(EWIDTH);
3538 _wsb(w,b,f) int w,b; struct file *f; {
3542 _wss(w,5,"false",f);
3545 _wrb(b,f) int b; struct file *f; {
3548 (outcpt.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0ý
\ 3/* $Id: outcpt.c,v 2.3 1994/06/24 12:32:44 ceriel Exp $ */
3550 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
3552 * This product is part of the Amsterdam Compiler Kit.
3554 * Permission to use, sell, duplicate or disclose this software must be
3555 * obtained in writing. Requests for such permissions may be sent to
3557 * Dr. Andrew S. Tanenbaum
3558 * Wiskundig Seminarium
3559 * Vrije Universiteit
3566 /* Author: J.W. Stevenson */
3568 #include <pc_file.h>
3575 extern int _write();
3577 _flush(f) struct file *f; {
3581 n = f->buflen - f->count;
3584 f->count = f->buflen;
3585 if ((i = _write(f->ufd,f->bufadr,n)) < 0 && errno == EINTR)
3591 _outcpt(f) struct file *f; {
3593 f->flags &= ~ELNBIT;
3595 if ((f->count -= f->size) <= 0)
3598 ;wf.c
\0t.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0ä
\ 2/* $Id: wf.c,v 2.3 1994/06/24 12:34:34 ceriel Exp $ */
3600 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
3602 * This product is part of the Amsterdam Compiler Kit.
3604 * Permission to use, sell, duplicate or disclose this software must be
3605 * obtained in writing. Requests for such permissions may be sent to
3607 * Dr. Andrew S. Tanenbaum
3608 * Wiskundig Seminarium
3609 * Vrije Universiteit
3616 #include <pc_file.h>
3619 extern struct file *_curfil;
3622 _wf(f) struct file *f; {
3625 if ((f->flags&0377) != MAGIC)
3627 if ((f->flags & WRBIT) == 0)
3630 nfa.c
\0.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0I
\ 1/* $Id: nfa.c,v 2.3 1994/06/24 12:32:31 ceriel Exp $ */
3632 * (c) copyright 1990 by the Vrije Universiteit, Amsterdam, The Netherlands.
3633 * See the copyright notice in the ACK home directory, in the file "Copyright".
3636 /* Author: Hans van Eck */
3644 if (! bool) _trp(EFUNASS);
3646 srcka.c
\0c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\01
\ 2/* $Id: rcka.c,v 2.4 1994/06/24 12:33:29 ceriel Exp $ */
3648 * (c) copyright 1990 by the Vrije Universiteit, Amsterdam, The Netherlands.
3649 * See the copyright notice in the ACK home directory, in the file "Copyright".
3652 /* Author: Hans van Eck */
3658 struct array_descr {
3660 unsigned n_elts_min_one;
3661 unsigned size; /* doesn't really matter */
3665 struct array_descr *descr;
3667 if( index < descr->lbound ||
3668 index > (int) descr->n_elts_min_one + descr->lbound )
3671 etrp.e
\0\0c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\8e\ 3#
3673 ; $Id: trp.e,v 2.3 1994/06/24 12:34:20 ceriel Exp $
3675 ; (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
3677 ; This product is part of the Amsterdam Compiler Kit.
3679 ; Permission to use, sell, duplicate or disclose this software must be
3680 ; obtained in writing. Requests for such permissions may be sent to
3682 ; Dr. Andrew S. Tanenbaum
3683 ; Wiskundig Seminarium
3684 ; Vrije Universiteit
3691 mes 2,EM_WSIZE,EM_PSIZE
3695 ; _trp() and trap() perform the same function,
3696 ; but have to be separate. trap exists to facilitate the user.
3697 ; _trp is there for the system, trap cannot be used for that purpose
3698 ; because a user might define its own Pascal routine called trap.
3700 ; _trp is called with one parameter:
3701 ; - trap number (TRAP)