Project

General

Profile

1
/*
2
        SCOLPLUGIN.H . 1996-99 . Sylvain HUET
3

    
4
         definitions pour les plugins Scol
5
*/
6

    
7

    
8
#ifndef SCOLPLUGIN_H
9
#define SCOLPLUGIN_H
10

    
11

    
12

    
13
#include <stdio.h>
14
#include <stdlib.h>
15

    
16
/* DEFINITIONS DE TYPES ET DE CONSTANTES
17
  ---------------------------------------*/
18
/* $iri  -> */
19
#define SizeWord 4
20
#define SizeHeader 3
21
/* <- $iri */
22

    
23
#define NIL -1
24

    
25
/* machine virtuelle Scol */
26
struct Mmachine
27
{
28
  int *tape;     /* pointeur vers la bande       */
29
  int sizetape;  /* taille de la bande (en mots) */
30
  int pp;        /* pointeur de pile             */
31
  int maxpp;     /* valeur max de pp             */
32
  int topheap;   /* sommet du tas                */
33
  int sigGC;     /* distance declenchant le GC   */
34
  int h;         /* position header courant      */
35
  int err;
36
  int *top;		 /* top of tape */ /* add by  $iri */
37
};
38
typedef struct Mmachine *mmachine;
39

    
40
extern mmachine mm;
41

    
42
/* masque pour MMmalloc : tableau d'objets ou buffer quelconque */
43
#define TYPETAB 1
44
#define TYPEBUF 0
45

    
46
/* definitions des erreurs */
47
#define MERREND     1
48
#define MERROK      0
49
#define MERRMEM    -1
50
#define MERRTYP    -2
51
#define MERRRET    -3
52
#define MERRNUL    -4
53
#define MERRNF     -5
54
#define MERRLINK   -6
55
#define MERRFULL   -7
56
#define MERRUNKNOWN -8
57
#define MERRTOOLARGE -9
58

    
59
/* definition des offsets objets */
60
#define OFFOBJMAG   0
61
#define OFFOBJCHN   1
62
#define OFFOBJTYP   2
63
#define OFFOBJHAND  3
64
#define OFFOBJTPERE 4
65
#define OFFOBJHPERE 5
66
#define OFFOBJREF0  6
67
#define OFFOBJUSER0 7
68

    
69
/* definitions des masques de message console */
70
#define MSKFOO     1
71
#define MSKRUNTIME 2
72
#define MSKWARNING 4
73
#define MSKTRACE   8
74
#define MSKDEBUG   16
75

    
76

    
77
/* types Scol predefinis */
78
#define TYPVAR    -1
79
#define TYPCONS   -2
80
#define TYPTYPE   -3
81
#define TYPFIELD  -4
82
#define TYPSTRUC  -5
83
#define TYPCONS0  -6
84
#define TYPCOM    -7
85
#define TYPCOMV   -8
86

    
87

    
88
/* GESTION DES FICHIERS EN SCOL
89
  ------------------------------*/
90

    
91
#define SIZESIGN 1024
92

    
93
struct Packdir
94
{
95
  char path[SIZESIGN];  /* se termine par '/' */
96
  int quota;   /* -1: read only, 0: unlimited */
97
  struct Packdir *next;
98
};
99
typedef struct Packdir *packdir;
100

    
101
#define TYPESNONE  0
102
#define TYPESLOGIC 1
103

    
104

    
105
/* FONCTIONS DU KERNEL EXPORTEES VERS LE PLUGIN
106
  ----------------------------------------------*/
107
#ifdef __cplusplus
108
extern "C" {
109
#endif
110
int  MMpush (mmachine m, int val);
111
int  MMpushNoGC (mmachine m, int val);
112
int  MMpull(mmachine m);
113
int  MMgetPP(mmachine m);
114
void MMsetPP(mmachine m,int i);
115
int  MMget(mmachine m,int i);
116
void MMset(mmachine m,int i,int v);
117
int  MMgetglobal(mmachine m,int i);
118
void MMsetglobal(mmachine m,int i,int v);
119
int  MMgetbase(mmachine m,int b,int i);
120
void MMsetbase(mmachine m,int b,int i,int v);
121
int  MMfetch(mmachine m,int s,int i);
122
void MMstore(mmachine m,int s,int i,int v);
123
int* MMstart(mmachine m,int s);
124
int  MMsize(mmachine m,int s);
125
int  MMtype(mmachine m,int s);
126
char* MMstartstr(mmachine m,int s);
127
int  MMsizestr(mmachine m,int s);
128
void MMsetsizestr(mmachine m,int s,int size);
129
int  MMmalloc(mmachine m, int size, int type);
130
int  MMmallocCLR(mmachine m, int size, int type);
131
int  Mpushstrbloc(mmachine m,char *buf);
132
int  MBdeftab(mmachine m);
133
int  MBstrcat(mmachine m);
134
void MMechostr(int i,char *buf,...);
135
int  SPfindfile(packdir p,char *sign,int *size,char *path);
136
int  SPaddfile(packdir p,char *sign,int size,char *path);
137
int  SCgetsocket(mmachine m, int channel);
138
int  SCgetsrvsocket(mmachine m, int server);
139
int  MBstrcatn(mmachine m);
140
int  Minterpreter(mmachine m);
141
int  PKhardpak(mmachine m, char *name,
142
                 int n, char **namefun, int (**fun)(mmachine z),
143
                 int *nargfun, char **typfun);
144
int  PKloader(mmachine m,char *name,char *simplename);
145

    
146
size_t fread(void* buf,size_t i,size_t j,FILE *f);
147

    
148
int MMneedMemory(mmachine m,int size,int realsize); /* $Iri */
149
#ifdef __cplusplus
150
}
151
#endif
152

    
153

    
154

    
155
int  Mcutting(char *comm, char **argv);
156

    
157
#ifdef __cplusplus
158
extern "C" {
159
#endif
160
int  OBJcreate(mmachine m,int typ,int handsys,int typpere,int handsyspere);
161
int  OBJaddreflex(mmachine m,int typ, int num);
162
int  OBJbeginreflex(mmachine m,int typ,int handsys,int num);
163
int  OBJdel(mmachine m,int p,int flag);
164
int  OBJdestroy(mmachine m, int typ,int handsys,int objm,int flag);
165
int  OBJdelTH(mmachine m,int typ,int handsys);
166
int  OBJcallreflex(mmachine m,int nbarg);
167
int  OBJregister(int nbrefl,int recrefl,int (*destroy)(mmachine m,int handsys,int objm),char *name);
168
int  OBJtypebyname(char *name);
169
int  OBJdefEvent(int event,int (*cbevent)(mmachine m,int hwnd, unsigned msg,
170
				            int wParam,int lParam,int *ret));
171
int  OBJgetUserEvent();
172

    
173

    
174
int  OBJdelTM(mmachine m,int typ,int q);
175
int  OBJfindTH(mmachine m,int typ,int handsys);
176
int  OBJfindTM(mmachine m,int typ,int objm);
177

    
178

    
179

    
180
extern int (*mt_start)(int per,int param,int (*fun)(int i,int param));
181
extern int (*mt_del)(int i);
182
#ifdef __cplusplus
183
}
184
#endif
185
char* stdloadJpg(char *name,int *w,int *h);
186
int  Mpushstrblocn(mmachine m,char *buf, int n);
187

    
188
int  Msearchinsyspak(mmachine m, char *name);
189

    
190
int  Buffer2texture(mmachine m, char *buffer, int width, int height);
191

    
192

    
193

    
194
void* objdd_get_buffer (mmachine m, int mobj);
195
int _CRbitmap (mmachine m);
196

    
197
/* old ones
198
int (*MMpush)(mmachine m, int val);
199
int (*MMpushNoGC)(mmachine m, int val);
200
int (*MMpull)(mmachine m);
201
int (*MMgetPP)(mmachine m);
202
void (*MMsetPP)(mmachine m,int i);
203
int (*MMget)(mmachine m,int i);
204
void (*MMset)(mmachine m,int i,int v);
205
int (*MMgetglobal)(mmachine m,int i);
206
void (*MMsetglobal)(mmachine m,int i,int v);
207
int (*MMgetbase)(mmachine m,int b,int i);
208
void (*MMsetbase)(mmachine m,int b,int i,int v);
209
int (*MMfetch)(mmachine m,int s,int i);
210
void (*MMstore)(mmachine m,int s,int i,int v);
211
int* (*MMstart)(mmachine m,int s);
212
int (*MMsize)(mmachine m,int s);
213
int (*MMtype)(mmachine m,int s);
214
char* (*MMstartstr)(mmachine m,int s);
215
int (*MMsizestr)(mmachine m,int s);
216
void (*MMsetsizestr)(mmachine m,int s,int size);
217
int (*MMmalloc)(mmachine m, int size, int type);
218
int (*MMmallocCLR)(mmachine m, int size, int type);
219
int (*Mpushstrbloc)(mmachine m,char *buf);
220
int (*MBdeftab)(mmachine m);
221
int (*MBstrcat)(mmachine m);
222
int (*PKhardpak)(mmachine m, char *name,
223
              int n, char **namefun, int (**fun)(mmachine z)
224
              , int *nargfun, char **typfun);
225
int (*PKloader)(mmachine m,char *name,char *simplename);
226
int (*SPfindfile)(packdir p,char *sign,int *size,char *path);
227
int (*SPaddfile)(packdir p,char *sign,int size,char *path);
228
int (*SCgetsrvsocket)(mmachine m, int server);
229
int (*SCgetsocket)(mmachine m, int channel);
230
int (*Mcutting)(char *comm, char **argv);
231
void (*MMechostr)(int i,char *buf,...);
232
int (*fread)(char* buf,int i,int j,FILE *f);
233
packdir Firstpack;
234
int (*OBJcreate)(mmachine m,int typ,int handsys,int typpere,int handsyspere);
235
int (*OBJaddreflex)(mmachine m,int typ, int num);
236
int (*OBJbeginreflex)(mmachine m,int typ,int handsys,int num);
237
int (*OBJdel)(mmachine m,int p,int flag);
238
int (*OBJdestroy)(mmachine m, int typ,int handsys,int objm,int flag);
239
int (*OBJdelTH)(mmachine m,int typ,int handsys);
240
int (*OBJcallreflex)(mmachine m,int nbarg);
241
int (*OBJregister)(int nbrefl,int recrefl,int (*destroy)(mmachine m,int handsys,int objm),char *name);
242
int (*OBJtypebyname)(char *name);
243
int (*OBJdefEvent)(int event,int (*cbevent)(mmachine m,HWND hwnd, unsigned msg,
244
				UINT wParam,LONG lParam,int *ret));
245
int (*OBJgetUserEvent)();
246
void* (*SCgetExtra)(char *funcname);
247
char* (*stdloadJpg)(char *name,int *w,int *h);
248
int (*OBJdelTM)(mmachine m,int typ,int q);
249
int (*OBJfindTH)(mmachine m,int typ,int handsys);
250
int (*OBJfindTM)(mmachine m,int typ,int objm);
251
int (*Mpushstrblocn)(mmachine m,char *buf, int n);
252
int (*Minterpreter)(mmachine m);
253
int (*Msearchinsyspak)(mmachine m, char *name);
254
int (*MBstrcatn)(mmachine m);
255
*/
256

    
257

    
258

    
259

    
260

    
261
#endif
262

    
(5-5/6)