Pristine Ack-5.5
[Ack-5.5.git] / lang / cem / libcc.ansi / head_ac.e
1 #
2 #include "em_abs.h"
3 /*
4  * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
5  *
6  *          This product is part of the Amsterdam Compiler Kit.
7  *
8  * Permission to use, sell, duplicate or disclose this software must be
9  * obtained in writing. Requests for such permissions may be sent to
10  *
11  *      Dr. Andrew S. Tanenbaum
12  *      Wiskundig Seminarium
13  *      Vrije Universiteit
14  *      Postbox 7161
15  *      1007 MC Amsterdam
16  *      The Netherlands
17  *
18  */
19
20  mes 2,_EM_WSIZE,_EM_PSIZE
21
22  exa environ
23  exa _end
24  exa _penvp
25 _penvp
26  bss _EM_PSIZE,0,0
27
28  exp $_m_a_i_n
29  pro $_m_a_i_n,0
30  loc 1336       ; EIOVFL | EIUND | ECONV | EFOVFL | EFUNFL
31  sim            ; ignored
32  lal _EM_WSIZE+_EM_PSIZE
33  loi _EM_PSIZE
34  lae _penvp
35  sti _EM_PSIZE
36 /* Now test if environ is our own environ, or some user defined environ.
37  * First test if environ < _end.  This is done for separate I&D systems.
38  */
39  lae environ
40  lae _end
41  cmp
42  zge *1
43 /* Now environ < end, which means that we can derefence it without trouble
44  * on separate I&D systems.
45  */
46  lae environ
47  loi 2
48  loc 2
49  loc _EM_WSIZE
50  cii
51  loc 21331      /*  == 0x5353 */
52  bne *1
53 /* environ contains the magic value. Assume it's our own environ */
54  lae _penvp
55  loi _EM_PSIZE
56  lae environ
57  sti _EM_PSIZE
58 1
59 #if __unix && ! (__em22 || __em24 || __em44)
60  lpi $_ctch_
61  sig
62  asp _EM_PSIZE
63 #endif
64  lal _EM_WSIZE+_EM_PSIZE
65  loi _EM_PSIZE
66  lal _EM_WSIZE
67  loi _EM_PSIZE
68  lal 0
69  loi _EM_WSIZE
70  cal $main
71  asp _EM_WSIZE+_EM_PSIZE+_EM_PSIZE
72  lfr _EM_WSIZE
73  cal $exit
74  end
75
76 #if __unix && ! (__em22 || __em24 || __em44)
77  exp $_ctch_
78  pro $_ctch_,0
79  lol 0
80  loc EIDIVZ
81  beq *1
82  lol 0
83  loc EFDIVZ
84  beq *1
85  lol 0
86  trp
87  bra *3
88 1
89  loc 8
90  cal $_getpid
91  lfr _EM_WSIZE
92  cal $_kill
93  asp 2*_EM_WSIZE
94 3
95  lpi $_ctch_
96  sig
97  asp _EM_PSIZE
98  rtt
99  end 0
100 #endif