Added upstream from http://ftp.icm.edu.pl/pub/loglan/
[loglan.git] / sources / int / depend.h
1 /*     Loglan82 Compiler&Interpreter\r
2      Copyright (C) 1993 Institute of Informatics, University of Warsaw\r
3      Copyright (C)  1993, 1994 LITA, Pau\r
4      \r
5      This program is free software; you can redistribute it and/or modify\r
6      it under the terms of the GNU General Public License as published by\r
7      the Free Software Foundation; either version 2 of the License, or\r
8      (at your option) any later version.\r
9      \r
10      This program is distributed in the hope that it will be useful,\r
11      but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13      GNU General Public License for more details.\r
14      \r
15              You should have received a copy of the GNU General Public License\r
16              along with this program; if not, write to the Free Software\r
17              Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
18 \r
19  contacts:  Andrzej.Salwicki@univ-pau.fr\r
20 \r
21 or             Andrzej Salwicki\r
22                 LITA   Departement d'Informatique\r
23                 Universite de Pau\r
24                 Avenue de l'Universite\r
25                 64000 Pau   FRANCE\r
26                  tel.  ++33 59923154    fax. ++33 59841696\r
27 \r
28 =======================================================================\r
29 */\r
30 \r
31 #if MSDOS\r
32 #undef UNIX\r
33 #undef OS2\r
34 #elif UNIX\r
35 #undef OS2\r
36 #elif OS2\r
37 #undef UNIX\r
38 #else\r
39 #error Define one of MSDOS/OS2/UNIX\r
40 #endif\r
41 \r
42 #if WORD_16BIT\r
43 #undef DWORD_16BIT\r
44 #undef WORD_32BIT\r
45 #elif DWORD_16BIT\r
46 #undef WORD_32BIT\r
47 #elif WORD_32BIT\r
48 #undef DWORD_16BIT\r
49 #else\r
50 #error Define one of WORD_16BIT/DWORD_16BIT/WORD_32BIT\r
51 #endif\r
52 \r
53 \r
54 #include <stdio.h>\r
55 #include <malloc.h>\r
56 #include <setjmp.h>\r
57 #include <stdlib.h>\r
58 #include <string.h>\r
59 \r
60 \r
61 typedef struct {\r
62                 char opcode;\r
63                 char args[ 3 ];\r
64                } extopcode;\r
65 \r
66 typedef char *lword;    /* max(word, char *) but in every case was char* */\r
67 \r
68 #define BINARYREAD      "rb"\r
69 #define BINARYWRITE     "wb"\r
70 #define DIRECTOLD       "r+b"\r
71 #define DIRECTNEW       "w+b"\r
72 \r
73 \r
74 #if WORD_16BIT\r
75 \r
76 typedef int word;\r
77 typedef float real;\r
78 typedef word *memory;\r
79 \r
80 #if UNIX\r
81 extern char *calloc(int,int);\r
82 #endif\r
83 \r
84 #define mallocate(n)    ((memory) (char /*|||huge*/ *) calloc((n),sizeof(word)))\r
85 #define ballocate(n)    ((char /*|||huge*/ *) calloc((n),1))\r
86 \r
87 #define MAXINTEGER   0x7FFF\r
88 #define DEFMEMSIZE   0x7FF0             /* 32K words = 64K bytes */\r
89 #define MAXMEMSIZE   0x7FF0             /* 32K words = 64K bytes */\r
90 \r
91 #endif\r
92 \r
93 \r
94 \r
95 #if DWORD_16BIT\r
96 \r
97 typedef long word;\r
98 typedef double real;\r
99 typedef word huge *memory;\r
100 \r
101 #if UNIX\r
102 \r
103 extern char *calloc(int,int);\r
104 \r
105 #define mallocate(n)   (((n)<60000)?(memory) calloc((n),sizeof(word)):abort())\r
106 #define ballocate(n)   (calloc((n),1))\r
107 \r
108 #define MAXINTEGER   0x7FFFFFFFL\r
109 #define DEFMEMSIZE   0x13C00L   /* 79K words = 316K bytes */\r
110 #define MAXMEMSIZE   0x400000L  /*  4M words =  16M bytes */\r
111 \r
112 #elif OS2\r
113 \r
114 extern char huge *halloc();\r
115 \r
116 #define mallocate(n)    ((memory) halloc((long) (n), sizeof(word)))\r
117 #define ballocate(n)    (halloc((long) (n),1L))\r
118 \r
119 #define MAXINTEGER   0x7FFFFFFFL\r
120 #define DEFMEMSIZE   0x13C00L   /* 79K words = 316K bytes */\r
121 #define MAXMEMSIZE   0x400000L  /*  4M words =  16M bytes */\r
122 \r
123 #define INCL_DOSINFOSEG\r
124 \r
125 #include <os2.h>        \r
126 \r
127 #elif MSDOS && TURBOC\r
128 \r
129 extern char far *farcalloc();\r
130 \r
131 #define mallocate(n)    ((memory) farcalloc((long) (n), (long) sizeof(word)))\r
132 #define ballocate(n)    (farcalloc((long) (n),1L))\r
133 \r
134 #define MAXINTEGER   0x7FFFFFFFL\r
135 #define DEFMEMSIZE   0x14000L   /* 80K words = 320K bytes */\r
136 #define MAXMEMSIZE   0x28000L   /* 160K words = 640K bytes */\r
137 \r
138 #elif MSDOS\r
139 \r
140 extern void huge *halloc();\r
141 #define mallocate(n)   ((memory) halloc((long) (n), sizeof(word)))\r
142 #define ballocate(n)   (halloc((long) (n),1))\r
143 \r
144 #define MAXINTEGER   0x7FFFFFFFL\r
145 #define DEFMEMSIZE   0xF000L    /* 60K words = 120K bytes */\r
146 #define MAXMEMSIZE   0x28000L   /* 160K words = 640K bytes */\r
147 \r
148 #else\r
149 #error Allocation macros not defined.\r
150 #endif\r
151 \r
152 #endif\r
153 \r
154 \r
155 \r
156 #if WORD_32BIT\r
157 \r
158 typedef int word;\r
159 typedef float real;\r
160 typedef word *memory;\r
161 \r
162 #define mallocate(n)    ((memory) (char *) calloc((n),sizeof(word)))\r
163 #define ballocate(n)    ((char *) calloc((n),1))\r
164 \r
165 /* printf("|%d*4|",(n)),getchar(),\ */\r
166 \r
167 #define MAXINTEGER   0x7FFFFFFFL\r
168 #define DEFMEMSIZE   0x13C00L   /* 79K words = 316K bytes */\r
169 #define MAXMEMSIZE   0x400000L  /*  4M words =  16M bytes */\r
170 \r
171 #endif\r
172 \r
173 \r