EnglishРусский  

   ..

   alias.c

   alias.h

   bcodes.c

   bcodes.h

   body.c

   compile.c

   compile.h

   define.c

   define.h

   desc.c

   expr.c

   extern.c

   for.c

   foreach.c

   func.c

   func.h

   global.c

   global.h

   goto.c

   if.c

   ifdef.c

   ifdef.h

   import.c

   import.h

   include.c

   include.h

   jump.c

   lexem.c

   lexem.h

   macro.c

   macro.h

   operlist.txt

   out.c

   out.h

   subfunc.c

   switch.c

   type.c

   type.h

   vars.c

   while.c

   with.c

Ads

Perfect Automation tool
All-In-One: Script editor, Launcher, Scheduler, Keyboard & Mouse Recorder. Try now!

CreateInstall
Freeware and commercial installers.

Cell Phone Batteries
Batteries Plus offers batteries for laptop, camcorder, cell phone, camera.

Gentee needs your help!
How to advertise with us
 
laptop battery

  1 /******************************************************************************
  2 *
  3 * Copyright (C) 2006, The Gentee Group. All rights reserved.
  4 * This file is part of the Gentee open source project - http://www.gentee.com.
  5 *
  6 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE GENTEE LICENSE ("AGREEMENT").
  7 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS
  8 * ACCEPTANCE OF THE AGREEMENT.
  9 *
 10 * ID: func 02.11.06 0.0.A.
 11 *
 12 * Author: Alexander Krivonogov ( algen )
 13 *
 14 * Summary: Описания функций, структур, констант необходимых для компиляции
 15 *
 16 ******************************************************************************/
 17 
 18 #ifndef _FUNC_
 19 #define _FUNC_
 20 
 21    #ifdef __cplusplus
 22       extern "C" {
 23    #endif // __cplusplus
 24 
 25 #include "../os/user/defines.h"
 26 #include "../lex/lex.h"
 27 #include "../lex/lexgentee.h"
 28 #include "../common/arrdata.h"
 29 #include "../common/msglist.h"
 30 #include "../genteeapi/gentee.h"
 31 #include "../vm/vmload.h"
 32 #include "../bytecode/cmdlist.h"
 33 #include "lexem.h"
 34 #include "operlist.h"
 35 #include "type.h"
 36 #include "out.h"
 37 
 38 /*-----------------------------------------------------------------------------
 39 *
 40 * ID: funcdata 02.11.06 0.0.A.
 41 *
 42 * Summary: funcdata structure.
 43 *
 44 -----------------------------------------------------------------------------*/
 45 
 46 typedef struct
 47 {
 48    //Не менять порядок расположения buf, в случае необходимости добавлять в конец
 49    buf  bhead;    //Заголовок функции
 50    buf  bvardef;  //Блок для описания локальных переменных
 51    buf  bfuncout; //Байт-код
 52    buf  bsubout;  //Байт-код для подфункций
 53    buf  bblinit;  //Текущий стэк для команд инициализации блоков
 54    buf  bvars;    //Стэк локальных переменных, заполнен fvar
 55    buf  blabels;  //Стэк меток, заполнен flabel
 56    buf  bwith;    //Стэк сокращений with, заполнен fwith
 57    buf  bvarsas;  //Стэк переменных, заполнен fvaras
 58 
 59    pbuf bout;     //Текущий буфер вывода байткода
 60 
 61    hash nvars;    //Хэш таблица локальных переменных
 62    hash nlabels;  //Хэш таблица меток
 63 
 64    uint blcount;      //Общее количество блоков
 65    uint varcount;     //Общее количество локальных переменных
 66    uint curcount;     //Текущее количество локальных переменных
 67    uint lastcurcount; //Количество локальных переменных в верхнем блоке
 68 
 69    uint oldoffbvar;   //Размер таблицы локальных переменных на начало текущего блока
 70    uint functype;     //Тип функции
 71    uint funcoftype;   //Подтип функции
 72    uint bllevel;      //Уровень вложенности текущего блока
 73    uint offlcbreak;   //Смещение в таблице меток указывающие на break для цикла
 74    uint offlccontinue;//Смещение в таблице меток указывающие на continue для цикла
 75    uint blcycle;      //Вложенность циклов
 76    uint flgfunc;      //Флаг функции
 77    uint idresult;     //Идентификатор параметра result
 78    uint offsubgoto;   //Смещение перехода через подфунции
 79 } s_funcdata, * ps_funcdata;
 80 
 81 //Структура для хранения исходных типов переменных as
 82 typedef struct
 83 {
 84    uint offbvar;  //Значение смещения в таблице bvars
 85    uint type;     //Исходный тип
 86    uint oftype;   //Тип элемента
 87 } fvaras, *pfvaras;
 88 
 89 //Структура для хранения with
 90 typedef struct
 91 {
 92    uint num;      //Номер локальной переменной
 93    uint type;     //Тип объекта
 94    uint oftype;   //Тип элемента объекта   
 95 } fwith, *pfwith;
 96 
 97 //Структура для хранения значения в хэше
 98 typedef struct
 99 {
100    hashitem item;
101    uint     val;
102 } hashiuint, *phashiuint;
103 
104 
105 #define FVAR_SUBFUNC 0x01
106 #define FVAR_UINTAS  0x02
107 //Структура локальной переменной
108 typedef struct
109 {
110    phashiuint hidn; //Идентификатор в таблице имён
111    uint flg;        //Если 1 значит идентификатор тип
112    uint type;       //Тип переменной
113    uint num;        //Номер переменной в таблице локальных переменных
114    uint msr;        //Размерность для массива
115    uint oftype;     //Тип элемента массива
116    uint oldoffbvar; //Значение старого смещение переменной в bvars + 1, для переопределения переменных
117 
118    uint addr;       //Адрес для подфункции
119    uint pars;       //Количество параметров у подфункции
120    uint offbvardef; //Смещение в буфере описания переменных функции
121 
122 } fvar, *pfvar;
123 
124 // Структура для таблицы меток
125 typedef struct
126 {
127    uint type; //Тип LABT_*
128 union {
129    uint link; //Связь, идентификатор в хэш таблице меток, идентификатор в таблице
130    phashiuint hitem;
131 };
132    uint offbout;//Смещение в байткоде
133    plexem lex;  //Указатель на лексему с меткой для LABT_LABEL
134 } flabel, *pflabel;
135 
136 
137 //Структура описания типа
138 typedef struct
139 {
140    uint idtype;//Идентификатор типа
141    uint oftype;//Тип элемента
142    byte msr;   //Размерность
143 } s_desctype, *ps_desctype;
144 
145 
146 //--------------------------------------------------------------------------
147 //body.c
148 plexem STDCALL f_body( plexem plex );
149 
150 //----------------------------------------------------------------------------
151 //desc.c
152 plexem STDCALL desc_nextidvar( plexem curlex, ps_descid pdescid );
153 plexem STDCALL desc_idtype( plexem curlex, ps_desctype pdesctype );
154 
155 //----------------------------------------------------------------------------
156 //expr.c
157 extern uint artypes[];
158 #define EXPR_ORD    0x01   //Значение flg, при обработке обычного выражения
159 #define EXPR_MACROS 0x02   //Выражение для макросов
160 #define EXPR_VAR    0x04   //Обработка в определении локальных переменных
161 #define EXPR_COMMA  0x08   //Выражение обрабатывать до запятой
162 #define EXPR_BOOL   0x10   //Выражение истины
163 #define EXPR_NONULL 0x20   //Тип выражения должен быть не ноль
164 #define EXPR_ARR    0x40   //Размерность массива
165 //Флаги состояния функции для проверки ошибок синтаксиса в выражении
166 #define L_OPERAND    0x01  //Операнд
167 #define L_POST_CLOSE 0x02  //Унарный пост оператор, закрывающая скобка
168 #define L_BINARY     0x04  //Бинарный оператор
169 #define L_UNARY_OPEN 0x08  //Унарный пре оператор, открывающая скобка
170 #define L_FUNC       0x10  //Последнее было имя функции ожидается (
171 
172 plexem STDCALL f_expr( plexem curlex, uint flg, puint rettype, puint retoftype );
173 
174 //----------------------------------------------------------------------------
175 //extern.c
176 plexem STDCALL m_extern( plexem curlex );
177 
178 //----------------------------------------------------------------------------
179 //for.c
180 plexem STDCALL c_for( plexem curlex );
181 plexem STDCALL c_fornum( plexem curlex );
182 
183 //----------------------------------------------------------------------------
184 //foreach.c
185 plexem STDCALL c_foreach( plexem curlex );
186 
187 //----------------------------------------------------------------------------
188 //func.c
189 extern s_funcdata fd;
190 
191 plexem STDCALL m_func( plexem curlex, uint flgextern );
192 
193 //----------------------------------------------------------------------------
194 //if.c
195 plexem STDCALL c_if( plexem curlex );
196 
197 //----------------------------------------------------------------------------
198 //goto.c
199 plexem STDCALL c_goto( plexem curlex );
200 plexem STDCALL c_label( plexem curlex );
201 
202 //----------------------------------------------------------------------------
203 //jump.c
204 #define LABT_VIRT       0x0100
205 #define LABT_GT         0x0200
206 #define LABT_GTUNDEF    ( LABT_GT | 0x0001 )  //Неразрешенный переход, в link идентификатор в хэш таблице
207 #define LABT_GTDEF      ( LABT_GT | 0x0002 )  //Разрешенная переход или переход на виртуальную метку, в link идентификатор в таблице меток
208 #define LABT_LABEL      0x0004  //Метка, в link идентификатор в хэш таблице
209 #define LABT_LABELUNDEF 0x0008  //Отработавшая метка
210 #define LABT_GTVIRT     ( LABT_VIRT | LABT_GT )
211 #define LABT_LABELVIRT  ( LABT_VIRT ) //Виртуальная метка
212 #define LABT_SUBFUNC    0x1000   //Метка находится внутри подфункции
213 #define LABT_RETURN     0x2000 //На данную метку был переход
214 #define LABT_LABELWORK  0x4000
215 
216 void STDCALL j_correct( uint curoff, uint link );
217 uint STDCALL j_jump( uint cmd, uint flag, uint link );
218 uint STDCALL j_label( uint flag, uint link );
219 
220 //----------------------------------------------------------------------------
221 //subfunc.c
222 plexem STDCALL f_subfunc( plexem curlex );
223 
224 //----------------------------------------------------------------------------
225 //switch.c
226 plexem STDCALL c_switch( plexem curlex );
227 
228 //----------------------------------------------------------------------------
229 //vars.c
230 #define DESCID_GLOBTYPE   0x010 //Описание глобальная переменная, описание структуры - arr a[10,20] of str
231 #define DESCID_GLOBAL     0x010
232 #define DESCID_TYPE	     0x011
233 #define DESCID_SUBFUNC    0x021//Описание подфункции
234 #define DESCID_PAR        0x040 //Описание параметра функции - arr a of str
235 #define DESCID_PARFUNC    0x040
236 #define DESCID_PARSUBFUNC 0x041
237 #define DESCID_VAR        0x080 //Описание локальной переменной - arr a[x+10,y+20] of str
238 
239 plexem STDCALL var_def( plexem curlex, uint flgdesc );
240 uint STDCALL var_checkadd( ps_descid descvar );
241 STDCALL create_varmode( pbuf out, ps_desctype desctype, ps_descid descid );
242 plexem STDCALL var_def( plexem curlex, uint flgdesc );
243 uint STDCALL var_add( phashiuint hidn, ps_descid descvar );
244 uint STDCALL var_addtmp( uint type, uint oftype );
245 
246 //----------------------------------------------------------------------------
247 //while.c
248 plexem STDCALL c_while( plexem curlex );
249 plexem STDCALL c_dowhile( plexem curlex );
250 
251 //----------------------------------------------------------------------------
252 //with.c
253 plexem STDCALL c_with( plexem curlex );
254 
255 #ifdef DOUT
256 #define D printf
257 #else
258 #define D /**////##/
259 #endif
260    #ifdef __cplusplus
261       }
262    #endif // __cplusplus
263 
264 #endif // _FUNC_
Edit