w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

obcommon.h
Go to the documentation of this file.
1 /*
2  * obcommon.h
3  *
4  * This file is part of the Oxford Oberon-2 compiler
5  * Copyright (c) 2006--2016 J. M. Spivey
6  * All rights reserved
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright notice,
12  * this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright notice,
14  * this list of conditions and the following disclaimer in the documentation
15  * and/or other materials provided with the distribution.
16  * 3. The name of the author may not be used to endorse or promote products
17  * derived from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef EXTERN
32 #define EXTERN extern
33 #endif
34 
35 typedef unsigned char uchar;
36 
37 typedef int mybool;
38 #define TRUE 1
39 #define FALSE 0
40 
41 #ifndef min
42 #define min(x, y) ((x) <= (y) ? (x) : (y))
43 #endif
44 
45 #ifndef max
46 #define max(x, y) ((x) <= (y) ? (y) : (x))
47 #endif
48 
49 #define align(x, k) (((x)+((k)-1)) & ~((k)-1))
50 
51 #ifdef WORDS_BIGENDIAN
52 #define align_byte(x) (((unsigned) (x))>>24)
53 #define align_short(x) ((x)>>16)
54 #else
55 #define align_byte(x) (x)
56 #define align_short(x) (x)
57 #endif
58 
59 #include <stdint.h>
60 
61 typedef int64_t longint;
62 
63 typedef union {
64 #ifdef WORDS_BIGENDIAN
65  struct { int hi, lo; } n;
66 #else
67  struct { int lo, hi; } n;
68 #endif
69  double d;
71 } dblbuf;
72 
73 /* Stack frame layout */
74 #define BP 0 /* Saved base pointer */
75 #define PC 1 /* Saved program counter */
76 #define CP 2 /* Saved context pointer */
77 #define SL -1 /* Static link */
78 #define HEAD 3
79 #define FRAME_SHIFT 16 /* Shift for pointer map of stack frame */
80 
81 /* Constant pool layout */
82 #define CP_PRIM 0 /* Primitive address (64 bits) */
83 #define CP_CODE 1 /* Bytecode address */
84 #define CP_SIZE 2 /* Size of bytecode */
85 #define CP_FRAME 3 /* Frame size */
86 #define CP_STACK 4 /* Stack size */
87 #define CP_MAP 5 /* Frame map */
88 #define CP_STKMAP 6 /* Stack map table */
89 #define CP_CONST 7 /* First constant */
90 
91 /* Descriptor layout */
92 #define DESC_MAP 0 /* Pointer map */
93 #define DESC_DEPTH 1 /* Inheritance depth of record */
94 #define DESC_ANCES 2 /* Ancestor list of record */
95 #define DESC_BOUND 1 /* First bound for flex array */
96 
97 /* Tokens used in pointer maps: all must be congruent to 2 modulo 4 */
98 #define GC_BASE 2
99 #define GC_REPEAT 6
100 #define GC_END 10
101 #define GC_MAP 14
102 #define GC_FLEX 18
103 #define GC_BLOCK 22
104 #define GC_MARK 26
105 #define GC_POINTER 30
106 
107 /* Error codes */
108 #define E_CAST 1
109 #define E_ASSIGN 2
110 #define E_CASE 3
111 #define E_WITH 4
112 #define E_ASSERT 5
113 #define E_RETURN 6
114 #define E_BOUND 7
115 #define E_NULL 8
116 #define E_DIV 9
117 #define E_FDIV 10
118 #define E_STACK 11
119 #define E_GLOB 12
#define n
Definition: t4ht.c:1290
signed __int64 int64_t
Definition: stdint.h:89
unsigned char uchar
Definition: obcommon.h:35
int64_t longint
Definition: obcommon.h:61
int mybool
Definition: obcommon.h:37
double d
Definition: obcommon.h:69
longint q
Definition: obcommon.h:70
int hi
Definition: obcommon.h:67