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