1
|
/*! \file scol_plugin_linux.h
|
2
|
* \brief Scol plugin definition API (GNU / Linux)
|
3
|
* \author Sylvain HUET
|
4
|
*/
|
5
|
/*
|
6
|
SCOLPLUGIN.H . 1996-99 . Sylvain HUET
|
7
|
|
8
|
definitions pour les plugins Scol
|
9
|
*/
|
10
|
|
11
|
|
12
|
#ifndef SCOLPLUGIN_H
|
13
|
#define SCOLPLUGIN_H
|
14
|
|
15
|
|
16
|
|
17
|
#include <stdio.h>
|
18
|
#include <stdlib.h>
|
19
|
|
20
|
/* DEFINITIONS DE TYPES ET DE CONSTANTES
|
21
|
---------------------------------------*/
|
22
|
/* $iri -> */
|
23
|
#define SizeWord 4
|
24
|
#define SizeHeader 3
|
25
|
/* <- $iri */
|
26
|
|
27
|
#define NIL -1
|
28
|
|
29
|
/* machine virtuelle Scol */
|
30
|
struct Mmachine
|
31
|
{
|
32
|
int *tape; /* pointeur vers la bande */
|
33
|
int sizetape; /* taille de la bande (en mots) */
|
34
|
int pp; /* pointeur de pile */
|
35
|
int maxpp; /* valeur max de pp */
|
36
|
int topheap; /* sommet du tas */
|
37
|
int sigGC; /* distance declenchant le GC */
|
38
|
int h; /* position header courant */
|
39
|
int err;
|
40
|
int *top; /* top of tape */ /* add by $iri */
|
41
|
};
|
42
|
typedef struct Mmachine *mmachine;
|
43
|
|
44
|
extern mmachine mm;
|
45
|
|
46
|
/* masque pour MMmalloc : tableau d'objets ou buffer quelconque */
|
47
|
#define TYPETAB 1
|
48
|
#define TYPEBUF 0
|
49
|
|
50
|
/* definitions des erreurs */
|
51
|
#define MERREND 1
|
52
|
#define MERROK 0
|
53
|
#define MERRMEM -1
|
54
|
#define MERRTYP -2
|
55
|
#define MERRRET -3
|
56
|
#define MERRNUL -4
|
57
|
#define MERRNF -5
|
58
|
#define MERRLINK -6
|
59
|
#define MERRFULL -7
|
60
|
#define MERRUNKNOWN -8
|
61
|
#define MERRTOOLARGE -9
|
62
|
|
63
|
/* definition des offsets objets */
|
64
|
#define OFFOBJMAG 0
|
65
|
#define OFFOBJCHN 1
|
66
|
#define OFFOBJTYP 2
|
67
|
#define OFFOBJHAND 3
|
68
|
#define OFFOBJTPERE 4
|
69
|
#define OFFOBJHPERE 5
|
70
|
#define OFFOBJREF0 6
|
71
|
#define OFFOBJUSER0 7
|
72
|
|
73
|
/* definitions des masques de message console */
|
74
|
#define MSKFOO 1
|
75
|
#define MSKRUNTIME 2
|
76
|
#define MSKWARNING 4
|
77
|
#define MSKTRACE 8
|
78
|
#define MSKDEBUG 16
|
79
|
|
80
|
|
81
|
/* types Scol predefinis */
|
82
|
#define TYPVAR -1
|
83
|
#define TYPCONS -2
|
84
|
#define TYPTYPE -3
|
85
|
#define TYPFIELD -4
|
86
|
#define TYPSTRUC -5
|
87
|
#define TYPCONS0 -6
|
88
|
#define TYPCOM -7
|
89
|
#define TYPCOMV -8
|
90
|
|
91
|
|
92
|
/* GESTION DES FICHIERS EN SCOL
|
93
|
------------------------------*/
|
94
|
|
95
|
#define SIZESIGN 1024
|
96
|
|
97
|
struct Packdir
|
98
|
{
|
99
|
char path[SIZESIGN]; /* se termine par '/' */
|
100
|
int quota; /* -1: read only, 0: unlimited */
|
101
|
struct Packdir *next;
|
102
|
};
|
103
|
typedef struct Packdir *packdir;
|
104
|
|
105
|
#define TYPESNONE 0
|
106
|
#define TYPESLOGIC 1
|
107
|
|
108
|
|
109
|
/* FONCTIONS DU KERNEL EXPORTEES VERS LE PLUGIN
|
110
|
----------------------------------------------*/
|
111
|
#ifdef __cplusplus
|
112
|
extern "C" {
|
113
|
#endif
|
114
|
int MMpush (mmachine m, int val);
|
115
|
int MMpushNoGC (mmachine m, int val);
|
116
|
int MMpull(mmachine m);
|
117
|
int MMgetPP(mmachine m);
|
118
|
void MMsetPP(mmachine m,int i);
|
119
|
int MMget(mmachine m,int i);
|
120
|
void MMset(mmachine m,int i,int v);
|
121
|
int MMgetglobal(mmachine m,int i);
|
122
|
void MMsetglobal(mmachine m,int i,int v);
|
123
|
int MMgetbase(mmachine m,int b,int i);
|
124
|
void MMsetbase(mmachine m,int b,int i,int v);
|
125
|
int MMfetch(mmachine m,int s,int i);
|
126
|
void MMstore(mmachine m,int s,int i,int v);
|
127
|
int* MMstart(mmachine m,int s);
|
128
|
int MMsize(mmachine m,int s);
|
129
|
int MMtype(mmachine m,int s);
|
130
|
char* MMstartstr(mmachine m,int s);
|
131
|
int MMsizestr(mmachine m,int s);
|
132
|
void MMsetsizestr(mmachine m,int s,int size);
|
133
|
int MMmalloc(mmachine m, int size, int type);
|
134
|
int MMmallocCLR(mmachine m, int size, int type);
|
135
|
int Mpushstrbloc(mmachine m,char *buf);
|
136
|
int MBdeftab(mmachine m);
|
137
|
int MBstrcat(mmachine m);
|
138
|
void MMechostr(int i,char *buf,...);
|
139
|
int SPfindfile(packdir p,char *sign,int *size,char *path);
|
140
|
int SPaddfile(packdir p,char *sign,int size,char *path);
|
141
|
int SCgetsocket(mmachine m, int channel);
|
142
|
int SCgetsrvsocket(mmachine m, int server);
|
143
|
int MBstrcatn(mmachine m);
|
144
|
int Minterpreter(mmachine m);
|
145
|
int PKhardpak(mmachine m, char *name,
|
146
|
int n, char **namefun, int (**fun)(mmachine z),
|
147
|
int *nargfun, char **typfun);
|
148
|
int PKloader(mmachine m,char *name,char *simplename);
|
149
|
|
150
|
size_t fread(void* buf,size_t i,size_t j,FILE *f);
|
151
|
|
152
|
int MMneedMemory(mmachine m,int size,int realsize); /* $Iri */
|
153
|
#ifdef __cplusplus
|
154
|
}
|
155
|
#endif
|
156
|
|
157
|
|
158
|
|
159
|
int Mcutting(char *comm, char **argv);
|
160
|
|
161
|
#ifdef __cplusplus
|
162
|
extern "C" {
|
163
|
#endif
|
164
|
int OBJcreate(mmachine m,int typ,int handsys,int typpere,int handsyspere);
|
165
|
int OBJaddreflex(mmachine m,int typ, int num);
|
166
|
int OBJbeginreflex(mmachine m,int typ,int handsys,int num);
|
167
|
int OBJdel(mmachine m,int p,int flag);
|
168
|
int OBJdestroy(mmachine m, int typ,int handsys,int objm,int flag);
|
169
|
int OBJdelTH(mmachine m,int typ,int handsys);
|
170
|
int OBJcallreflex(mmachine m,int nbarg);
|
171
|
int OBJregister(int nbrefl,int recrefl,int (*destroy)(mmachine m,int handsys,int objm),char *name);
|
172
|
int OBJtypebyname(char *name);
|
173
|
int OBJdefEvent(int event,int (*cbevent)(mmachine m,int hwnd, unsigned msg,
|
174
|
int wParam,int lParam,int *ret));
|
175
|
int OBJgetUserEvent();
|
176
|
|
177
|
|
178
|
int OBJdelTM(mmachine m,int typ,int q);
|
179
|
int OBJfindTH(mmachine m,int typ,int handsys);
|
180
|
int OBJfindTM(mmachine m,int typ,int objm);
|
181
|
|
182
|
|
183
|
|
184
|
extern int (*mt_start)(int per,int param,int (*fun)(int i,int param));
|
185
|
extern int (*mt_del)(int i);
|
186
|
#ifdef __cplusplus
|
187
|
}
|
188
|
#endif
|
189
|
char* stdloadJpg(char *name,int *w,int *h);
|
190
|
int Mpushstrblocn(mmachine m,char *buf, int n);
|
191
|
|
192
|
int Msearchinsyspak(mmachine m, char *name);
|
193
|
|
194
|
int Buffer2texture(mmachine m, char *buffer, int width, int height);
|
195
|
|
196
|
|
197
|
|
198
|
void* objdd_get_buffer (mmachine m, int mobj);
|
199
|
int _CRbitmap (mmachine m);
|
200
|
|
201
|
/* old ones
|
202
|
int (*MMpush)(mmachine m, int val);
|
203
|
int (*MMpushNoGC)(mmachine m, int val);
|
204
|
int (*MMpull)(mmachine m);
|
205
|
int (*MMgetPP)(mmachine m);
|
206
|
void (*MMsetPP)(mmachine m,int i);
|
207
|
int (*MMget)(mmachine m,int i);
|
208
|
void (*MMset)(mmachine m,int i,int v);
|
209
|
int (*MMgetglobal)(mmachine m,int i);
|
210
|
void (*MMsetglobal)(mmachine m,int i,int v);
|
211
|
int (*MMgetbase)(mmachine m,int b,int i);
|
212
|
void (*MMsetbase)(mmachine m,int b,int i,int v);
|
213
|
int (*MMfetch)(mmachine m,int s,int i);
|
214
|
void (*MMstore)(mmachine m,int s,int i,int v);
|
215
|
int* (*MMstart)(mmachine m,int s);
|
216
|
int (*MMsize)(mmachine m,int s);
|
217
|
int (*MMtype)(mmachine m,int s);
|
218
|
char* (*MMstartstr)(mmachine m,int s);
|
219
|
int (*MMsizestr)(mmachine m,int s);
|
220
|
void (*MMsetsizestr)(mmachine m,int s,int size);
|
221
|
int (*MMmalloc)(mmachine m, int size, int type);
|
222
|
int (*MMmallocCLR)(mmachine m, int size, int type);
|
223
|
int (*Mpushstrbloc)(mmachine m,char *buf);
|
224
|
int (*MBdeftab)(mmachine m);
|
225
|
int (*MBstrcat)(mmachine m);
|
226
|
int (*PKhardpak)(mmachine m, char *name,
|
227
|
int n, char **namefun, int (**fun)(mmachine z)
|
228
|
, int *nargfun, char **typfun);
|
229
|
int (*PKloader)(mmachine m,char *name,char *simplename);
|
230
|
int (*SPfindfile)(packdir p,char *sign,int *size,char *path);
|
231
|
int (*SPaddfile)(packdir p,char *sign,int size,char *path);
|
232
|
int (*SCgetsrvsocket)(mmachine m, int server);
|
233
|
int (*SCgetsocket)(mmachine m, int channel);
|
234
|
int (*Mcutting)(char *comm, char **argv);
|
235
|
void (*MMechostr)(int i,char *buf,...);
|
236
|
int (*fread)(char* buf,int i,int j,FILE *f);
|
237
|
packdir Firstpack;
|
238
|
int (*OBJcreate)(mmachine m,int typ,int handsys,int typpere,int handsyspere);
|
239
|
int (*OBJaddreflex)(mmachine m,int typ, int num);
|
240
|
int (*OBJbeginreflex)(mmachine m,int typ,int handsys,int num);
|
241
|
int (*OBJdel)(mmachine m,int p,int flag);
|
242
|
int (*OBJdestroy)(mmachine m, int typ,int handsys,int objm,int flag);
|
243
|
int (*OBJdelTH)(mmachine m,int typ,int handsys);
|
244
|
int (*OBJcallreflex)(mmachine m,int nbarg);
|
245
|
int (*OBJregister)(int nbrefl,int recrefl,int (*destroy)(mmachine m,int handsys,int objm),char *name);
|
246
|
int (*OBJtypebyname)(char *name);
|
247
|
int (*OBJdefEvent)(int event,int (*cbevent)(mmachine m,HWND hwnd, unsigned msg,
|
248
|
UINT wParam,LONG lParam,int *ret));
|
249
|
int (*OBJgetUserEvent)();
|
250
|
void* (*SCgetExtra)(char *funcname);
|
251
|
char* (*stdloadJpg)(char *name,int *w,int *h);
|
252
|
int (*OBJdelTM)(mmachine m,int typ,int q);
|
253
|
int (*OBJfindTH)(mmachine m,int typ,int handsys);
|
254
|
int (*OBJfindTM)(mmachine m,int typ,int objm);
|
255
|
int (*Mpushstrblocn)(mmachine m,char *buf, int n);
|
256
|
int (*Minterpreter)(mmachine m);
|
257
|
int (*Msearchinsyspak)(mmachine m, char *name);
|
258
|
int (*MBstrcatn)(mmachine m);
|
259
|
*/
|
260
|
|
261
|
|
262
|
|
263
|
|
264
|
|
265
|
#endif
|
266
|
|