EnglishРусский  

   ..

   common.c

   common.h

   gefile.h

   geload.c

   gesave.c

   types.h

   vm.c

   vm.h

The project is closed! You can look at a new scripting language. It is available on GitHub.
Also, try our open source cross-platform automation software.

Ads

Installer and installation software
Commercial and Freeware installers.

  1 
  2 #ifndef _TYPES_
  3 #define _TYPES_
  4 
  5    #ifdef __cplusplus
  6       extern "C" {
  7    #endif // __cplusplus
  8 
  9 #define STDCALL   __stdcall 
 10 #define FASTCALL  __fastcall
 11 #define CDECLCALL __cdecl
 12 
 13 
 14 typedef unsigned char     ubyte;
 15 typedef unsigned long     uint;
 16 typedef unsigned short    ushort;
 17 typedef unsigned __int64  ulong64;
 18 typedef          __int64  long64;
 19 
 20 typedef  ubyte*    pubyte;
 21 typedef  char *    pchar;
 22 typedef  uint*     puint;
 23 typedef  int*      pint;
 24 typedef  void*     pvoid;
 25 typedef  ushort*   pushort;
 26 typedef  short*    pshort;
 27 typedef  ulong64*  pulong64;
 28 typedef  long64*   plong64;
 29 
 30 #define  ABC_COUNT    256
 31 #define  FALSE        0
 32 #define  TRUE         1
 33 #define  MAX_BYTE     0xFF
 34 #define  MAX_USHORT   0xFFFF
 35 #define  MAX_UINT     0xFFFFFFFF
 36 #define  MAX_MSR      8                   // Max array dimension
 37 
 38 
 39 // File operation flags os_fileopen
 40 #define FOP_READONLY   0x0001   // open as readonly
 41 #define FOP_EXCLUSIVE  0x0002   // open exclusively
 42 #define FOP_CREATE     0x0004   // create file
 43 #define FOP_IFCREATE   0x0008   // create file if it doesn't exist
 44 
 45 
 46 typedef struct
 47 {
 48     pubyte    data;      // Pointer to the allocated memory
 49     uint      use;       // Using size
 50     uint      size;      // All available size
 51     uint      step;      // The minimum step of the increasing
 52 } buf, * pbuf;
 53 
 54 
 55 typedef struct
 56 {
 57     buf     data;   
 58     uint    isize;  // The size of the item
 59     ubyte   isobj;  // Each item is a memory block
 60 } arr, * parr;
 61 
 62 
 63 typedef struct
 64 {
 65     buf     data;   
 66     uint    itype;  // The type of items
 67     uint    isize;  // The size of the item
 68     uint    dim[ MAX_MSR ];  // Dimensions
 69 } garr, * pgarr;
 70 
 71 typedef arr arrdata;
 72 typedef arrdata * parrdata;
 73 
 74 typedef buf str;
 75 typedef str * pstr;
 76 
 77 typedef struct
 78 {
 79    uint    type;     // The type of the number  T****
 80    union {
 81       uint     vint;
 82       ulong64  vlong;
 83       float    vfloat;
 84       double   vdouble;
 85    };
 86 } number, * pnumber;
 87 
 88 
 89 typedef struct _heap
 90 {
 91     pvoid   ptr;          // Pointer to the heap memory
 92     puint   chain;        // Array of ABC_COUNT free chains
 93     uint    size;         // The summary memory size
 94     uint    remain;       // The remain size of the heap
 95     uint    free;         // The size of free blocks
 96 } heap, * pheap;
 97 
 98 typedef struct memory
 99 {
100     pheap   heaps;        // Array of ABC_COUNT heaps
101     uint    last;         // The number of the latest active heap
102     puint   sid;          // Array of ABC_COUNT limits of block sizes
103 } memory;
104 
105 
106 // Описание имени
107 typedef struct 
108 {
109     ushort len;       // длина имени
110     uint   id;        // Identifier. The number in the array
111     pvoid  next;      // The next hashitem 
112 } hashitem, * phashitem; 
113 // Additional size hash.isize
114 // name with zero at the end
115 
116 // После этого идет строка имени
117 typedef struct
118 {
119     arr     values;   // Hash-values hash table pointer to the first hashitem
120     arr     names;    // Array of hash names = pointers to hashitem objects
121     uint    isize;    // Additional size
122     ubyte   ignore;   // If 1 then ignore case
123 } hash, * phash;
124 
125 
126 typedef struct
127 {
128     buf       data;       
129     uint      count;   // The number of items
130     uint      flag;    // Флаги
131 } collect, * pcollect;
132 
133 
134 #include <windows.h>
135 #include <setjmp.h>
136 
137 #define OS_CRL        CRITICAL_SECTION  // type
138 
139 
140 /*-----------------------------------------------------------------------------
141 * Summary: The structure type of the virtual machine.
142 -----------------------------------------------------------------------------*/
143 
144 typedef struct
145 {
146    pvoid   ptr;     // The memory pointer
147    pubyte  top;     // The free pointer
148    pubyte  end;     // The end pointer
149    pvoid   next;    // The next vmmanager
150 } vmmanager, * pvmmanager;
151 
152 
153 
154 typedef struct
155 {
156     arr   objtbl;    // The table of the objects of the current VM.
157     hash  objname;   // The table of the names of objects of the current VM.
158     uint  count;     // The count of the objects
159     pvmmanager   pmng;  // The current vmmanager
160     collect  resource;  // Resources
161     
162     uint  ipack;      // 1 if the current loading object is packed
163     uint  isize;      // The input size of the current loading object
164     uint  icnv;       // converting shift;
165     uint  loadmode;   // 0 - if loading from GE otherwise loading from G
166     uint  countinit;  // The count of the initialized id
167     uint  pos;        // Pos for run-time error compiling
168     uint  irescnv;    // shift for converting resources CResload
169 } vm, * pvm;
170 
171 
172 /*-----------------------------------------------------------------------------
173 * Summary: The main structure of gentee engine
174 -----------------------------------------------------------------------------*/
175 
176 
177 typedef struct
178 {
179     uint   flags;      // G_... flags
180     pbuf  gesave;
181     uint  gesaveoff;
182     uint  _crctbl[ 256 ];
183     vm     _vm;
184     memory _memory;
185     jmp_buf stack_state;
186     BOOL isDelName;
187     unsigned int popravka;
188     OS_CRL _crlmem;               // Critical section for multi-thread calling
189 }vmEngine, *pvmEngine;
190 
191    #ifdef __cplusplus
192       }
193    #endif // __cplusplus
194 
195 #endif // _TYPES_