|
|
1.1 root 1: /*
2: Copyright (C) 1996-1997 Id Software, Inc.
3:
4: This program is free software; you can redistribute it and/or
5: modify it under the terms of the GNU General Public License
6: as published by the Free Software Foundation; either version 2
7: of the License, or (at your option) any later version.
8:
9: This program is distributed in the hope that it will be useful,
10: but WITHOUT ANY WARRANTY; without even the implied warranty of
11: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12:
13: See the 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18:
19: */
20:
21: // this file is shared by quake and qcc
22:
23: typedef int func_t;
24: typedef int string_t;
25:
26: typedef enum {ev_void, ev_string, ev_float, ev_vector, ev_entity, ev_field, ev_function, ev_pointer} etype_t;
27:
28:
29: #define OFS_NULL 0
30: #define OFS_RETURN 1
31: #define OFS_PARM0 4 // leave 3 ofs for each parm to hold vectors
32: #define OFS_PARM1 7
33: #define OFS_PARM2 10
34: #define OFS_PARM3 13
35: #define OFS_PARM4 16
36: #define OFS_PARM5 19
37: #define OFS_PARM6 22
38: #define OFS_PARM7 25
39: #define RESERVED_OFS 28
40:
41:
42: enum {
43: OP_DONE,
44: OP_MUL_F,
45: OP_MUL_V,
46: OP_MUL_FV,
47: OP_MUL_VF,
48: OP_DIV_F,
49: OP_ADD_F,
50: OP_ADD_V,
51: OP_SUB_F,
52: OP_SUB_V,
53:
54: OP_EQ_F,
55: OP_EQ_V,
56: OP_EQ_S,
57: OP_EQ_E,
58: OP_EQ_FNC,
59:
60: OP_NE_F,
61: OP_NE_V,
62: OP_NE_S,
63: OP_NE_E,
64: OP_NE_FNC,
65:
66: OP_LE,
67: OP_GE,
68: OP_LT,
69: OP_GT,
70:
71: OP_LOAD_F,
72: OP_LOAD_V,
73: OP_LOAD_S,
74: OP_LOAD_ENT,
75: OP_LOAD_FLD,
76: OP_LOAD_FNC,
77:
78: OP_ADDRESS,
79:
80: OP_STORE_F,
81: OP_STORE_V,
82: OP_STORE_S,
83: OP_STORE_ENT,
84: OP_STORE_FLD,
85: OP_STORE_FNC,
86:
87: OP_STOREP_F,
88: OP_STOREP_V,
89: OP_STOREP_S,
90: OP_STOREP_ENT,
91: OP_STOREP_FLD,
92: OP_STOREP_FNC,
93:
94: OP_RETURN,
95: OP_NOT_F,
96: OP_NOT_V,
97: OP_NOT_S,
98: OP_NOT_ENT,
99: OP_NOT_FNC,
100: OP_IF,
101: OP_IFNOT,
102: OP_CALL0,
103: OP_CALL1,
104: OP_CALL2,
105: OP_CALL3,
106: OP_CALL4,
107: OP_CALL5,
108: OP_CALL6,
109: OP_CALL7,
110: OP_CALL8,
111: OP_STATE,
112: OP_GOTO,
113: OP_AND,
114: OP_OR,
115:
116: OP_BITAND,
117: OP_BITOR
118: };
119:
120:
121: typedef struct statement_s
122: {
123: unsigned short op;
124: short a,b,c;
125: } dstatement_t;
126:
127: typedef struct
128: {
129: unsigned short type; // if DEF_SAVEGLOBGAL bit is set
130: // the variable needs to be saved in savegames
131: unsigned short ofs;
132: int s_name;
133: } ddef_t;
134: #define DEF_SAVEGLOBAL (1<<15)
135:
136: #define MAX_PARMS 8
137:
138: typedef struct
139: {
140: int first_statement; // negative numbers are builtins
141: int parm_start;
142: int locals; // total ints of parms + locals
143:
144: int profile; // runtime
145:
146: int s_name;
147: int s_file; // source file defined in
148:
149: int numparms;
150: byte parm_size[MAX_PARMS];
151: } dfunction_t;
152:
153:
154: #define PROG_VERSION 6
155: typedef struct
156: {
157: int version;
158: int crc; // check of header file
159:
160: int ofs_statements;
161: int numstatements; // statement 0 is an error
162:
163: int ofs_globaldefs;
164: int numglobaldefs;
165:
166: int ofs_fielddefs;
167: int numfielddefs;
168:
169: int ofs_functions;
170: int numfunctions; // function 0 is an empty
171:
172: int ofs_strings;
173: int numstrings; // first string is a null string
174:
175: int ofs_globals;
176: int numglobals;
177:
178: int entityfields;
179: } dprograms_t;
180:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.