Varios cambios
This commit is contained in:
parent
e8aa4b485a
commit
0e7e401007
|
@ -1,3 +1,9 @@
|
||||||
|
18/12/2002
|
||||||
|
----------
|
||||||
|
* Mas comentarizacion siguiendo las normas del ANSI C (Daijo)
|
||||||
|
* Todas las cabeceras han de definirse: #define __EDIV_CABECERA_H_ (Daijo)
|
||||||
|
* Cambiado *edivcentral.com por ediv.divsite.net (Daijo)
|
||||||
|
|
||||||
13/12/2002
|
13/12/2002
|
||||||
----------
|
----------
|
||||||
* Nueva funcion en la graphics.dll: get_rgb(color,&r,&g,&b). obtiene las
|
* Nueva funcion en la graphics.dll: get_rgb(color,&r,&g,&b). obtiene las
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __COMPILER_H
|
#ifndef __EDIV_COMPILER_H_
|
||||||
#define __COMPILER_H
|
#define __EDIV_COMPILER_H_
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
|
@ -225,18 +225,16 @@ int case_sensitive;
|
||||||
#define lnul 126 /* Comprueba que un puntero no sea NULL */
|
#define lnul 126 /* Comprueba que un puntero no sea NULL */
|
||||||
|
|
||||||
|
|
||||||
struct { // Peephole, "mirilla" para el optimizador
|
struct { /* Peephole, "mirilla" para el optimizador */
|
||||||
int dir; // Dirección
|
int dir; /* Dirección */
|
||||||
int param; // Indica si ese opcode tiene parámetro
|
int param; /* Indica si ese opcode tiene parámetro */
|
||||||
int op; // Opcode
|
int op; /* Opcode */
|
||||||
} code[16]; // En code[15] debe quedar siempre la última instrucción generada
|
} code[16]; /* En code[15] debe quedar siempre la última instrucción generada */
|
||||||
|
|
||||||
/* Informacion para temporal de debug (posicion en mem y fuente de cada sentencia) */
|
/* Informacion para temporal de debug (posicion en mem y fuente de cada sentencia) */
|
||||||
FILE * linf; /* En este temporal guardamos la info y luego lo agregamos al exe */
|
FILE * linf; /* En este temporal guardamos la info y luego lo agregamos al exe */
|
||||||
|
|
||||||
int inicio,final; /* Direcciones inicial y final de mem[] de la sentencia */
|
int inicio,final; /* Direcciones inicial y final de mem[] de la sentencia */
|
||||||
//int linea1,columna1; /* Posicion en la que comienza la sentencia en el fuente */
|
|
||||||
//int linea2,columna2; /* Posicion en la que acaba la sentencia en el fuente */
|
|
||||||
int inicio_prg,final_prg; /* Direcciones inicial y final en el PRG de la sentencia */
|
int inicio_prg,final_prg; /* Direcciones inicial y final en el PRG de la sentencia */
|
||||||
int linsize;
|
int linsize;
|
||||||
|
|
||||||
|
@ -284,4 +282,4 @@ void sentencia();
|
||||||
void g1(int op);
|
void g1(int op);
|
||||||
void g2(int op, int pa);
|
void g2(int op, int pa);
|
||||||
|
|
||||||
#endif /* __COMPILER_H */
|
#endif /* __EDIV_COMPILER_H_ */
|
|
@ -347,7 +347,7 @@ void* e_malloc(size_t size)
|
||||||
void* ret;
|
void* ret;
|
||||||
|
|
||||||
if(!(ret = malloc(size))) {
|
if(!(ret = malloc(size))) {
|
||||||
printf(translate(24)); // memoria insuficiente
|
printf(translate(24)); /* memoria insuficiente */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __ENCRYPT_H
|
#ifndef __EDIV_ENCRYPT_H_
|
||||||
#define __ENCRYPT_H
|
#define __EDIV_ENCRYPT_H_
|
||||||
|
|
||||||
void _encriptar(int encode, char * fichero, char * clave);
|
void _encriptar(int encode, char * fichero, char * clave);
|
||||||
void _comprimir(int encode, char *fichero);
|
void _comprimir(int encode, char *fichero);
|
||||||
|
|
|
@ -18,18 +18,18 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __EXPRESION_H
|
#ifndef __EDIV_EXPRESION_H_
|
||||||
#define __EXPRESION_H
|
#define __EDIV_EXPRESION_H_
|
||||||
|
|
||||||
#define max_exp 512 //Máximo número de elementos en una expresión
|
#define max_exp 512 /* Máximo número de elementos en una expresión */
|
||||||
#define long_pila 2048 //Longitud de la pila en ejecución
|
#define long_pila 2048 /* Longitud de la pila en ejecución */
|
||||||
|
|
||||||
int pila[long_pila+max_exp+64]; // cálculo de expresiones (compilación y ejecución)
|
int pila[long_pila+max_exp+64]; /* cálculo de expresiones (compilación y ejecución) */
|
||||||
|
|
||||||
// Tabla de elementos en la evaluación de una expresión
|
/* Tabla de elementos en la evaluación de una expresión */
|
||||||
|
|
||||||
struct exp_ele {
|
struct exp_ele {
|
||||||
byte tipo; // econs, eoper, erango, ewhoami, ecall
|
byte tipo; /* econs, eoper, erango, ewhoami, ecall */
|
||||||
union {
|
union {
|
||||||
int valor;
|
int valor;
|
||||||
int token;
|
int token;
|
||||||
|
@ -37,19 +37,20 @@ struct exp_ele {
|
||||||
};
|
};
|
||||||
} tabexp[max_exp], *_exp;
|
} tabexp[max_exp], *_exp;
|
||||||
|
|
||||||
#define econs 0 // Constante // Tipos de elementos en tabexp[]
|
#define econs 0 /* Constante // Tipos de elementos en tabexp[] */
|
||||||
#define eoper 1 // Operador
|
#define eoper 1 /* Operador */
|
||||||
#define erango 2 // Comprobación de rango
|
#define erango 2 /* Comprobación de rango */
|
||||||
#define ewhoami 3 // Identificador de proceso
|
#define ewhoami 3 /* Identificador de proceso */
|
||||||
#define ecall 4 // Creación de un proceso
|
#define ecall 4 /* Creación de un proceso */
|
||||||
//#define efunc 5 // Llamada a una función interna
|
/*#define efunc 5*/ /* Llamada a una función interna */
|
||||||
#define efext 6 // Llamada a una función externa
|
#define efext 6 /* Llamada a una función externa */
|
||||||
#define echeck 7 // Comprobació¢n de validez de un identificador
|
#define echeck 7 /* Comprobació¢n de validez de un identificador */
|
||||||
#define estring 8 // Cadena de texto (su offset constante)
|
#define estring 8 /* Cadena de texto (su offset constante) */
|
||||||
#define enull 9 // Comprobaci¢n de NULL pointer
|
#define enull 9 /* Comprobaci¢n de NULL pointer */
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Prototipos
|
||||||
|
*/
|
||||||
void condicion(void);
|
void condicion(void);
|
||||||
void expresion(void);
|
void expresion(void);
|
||||||
void expresion_cpa(void);
|
void expresion_cpa(void);
|
||||||
|
|
|
@ -18,14 +18,14 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __KEYWORDS_H__
|
#ifndef __EDIV_KEYWORDS_H_
|
||||||
#define __KEYWORDS_H__
|
#define __EDIV_KEYWORDS_H_
|
||||||
|
|
||||||
// tabla de keywords
|
/* tabla de keywords */
|
||||||
extern struct keywords {
|
extern struct keywords {
|
||||||
char keyword[20]; // Max. 20 caracteres por keyword
|
char keyword[20]; /* Max. 20 caracteres por keyword */
|
||||||
char code; // Code del keyword
|
char code; /* Code del keyword */
|
||||||
void* hfuncion; // Puntero a la función correspondiente (para no usar SWITCH)
|
void* hfuncion; /* Puntero a la función correspondiente (para no usar SWITCH) */
|
||||||
} table[];
|
} table[];
|
||||||
|
|
||||||
extern struct prioridades {
|
extern struct prioridades {
|
||||||
|
@ -33,16 +33,16 @@ extern struct prioridades {
|
||||||
char prioridad;
|
char prioridad;
|
||||||
} prioridad[];
|
} prioridad[];
|
||||||
|
|
||||||
// Defines de los keywords con su code
|
/* Defines de los keywords con su code */
|
||||||
|
|
||||||
// CM = TIPO DE COMANDO
|
/* CM = TIPO DE COMANDO */
|
||||||
#define CM_SEPARATE 0 // Se pone entre linea y linea
|
#define CM_SEPARATE 0 /* Se pone entre linea y linea */
|
||||||
#define CM_STATEMENT 1 // Statement
|
#define CM_STATEMENT 1 /* Statement */
|
||||||
#define CM_CALL 2 // Llamada a una función o un proceso
|
#define CM_CALL 2 /* Llamada a una función o un proceso */
|
||||||
#define CM_SIGNO 3 // Asignación
|
#define CM_SIGNO 3 /* Asignación */
|
||||||
#define CM_DATA 4 // Cualquier dato
|
#define CM_DATA 4 /* Cualquier dato */
|
||||||
|
|
||||||
// ST = STATEMENTS
|
/* ST = STATEMENTS */
|
||||||
#define ST_COMPILER_OPT 1
|
#define ST_COMPILER_OPT 1
|
||||||
#define ST_PROGRAM 2
|
#define ST_PROGRAM 2
|
||||||
#define ST_CONST 3
|
#define ST_CONST 3
|
||||||
|
@ -50,7 +50,7 @@ extern struct prioridades {
|
||||||
#define ST_LOCAL 5
|
#define ST_LOCAL 5
|
||||||
#define ST_PRIVATE 6
|
#define ST_PRIVATE 6
|
||||||
#define ST_BEGIN 7
|
#define ST_BEGIN 7
|
||||||
#define ST_END 8 // Este end vale para todos los end
|
#define ST_END 8 /* Este end vale para todos los end */
|
||||||
#define ST_PROCESS 9
|
#define ST_PROCESS 9
|
||||||
#define ST_FUNCTION 10
|
#define ST_FUNCTION 10
|
||||||
|
|
||||||
|
@ -85,21 +85,21 @@ extern struct prioridades {
|
||||||
#define ST_CLONE 35
|
#define ST_CLONE 35
|
||||||
#define ST_DEBUG 36
|
#define ST_DEBUG 36
|
||||||
|
|
||||||
// DT = DATA TYPES
|
/* DT = DATA TYPES */
|
||||||
#define DT_BYTE 0
|
#define DT_BYTE 0
|
||||||
#define DT_WORD 1
|
#define DT_WORD 1
|
||||||
#define DT_INTEGER 2
|
#define DT_INTEGER 2
|
||||||
#define DT_STRING 3
|
#define DT_STRING 3
|
||||||
#define DT_POINTER 4
|
#define DT_POINTER 4
|
||||||
#define DT_STRUCT 5
|
#define DT_STRUCT 5
|
||||||
#define DT_FLOAT 7 // Tipo de dato FLOAT (nuevo)
|
#define DT_FLOAT 7 /* Tipo de dato FLOAT (nuevo) */
|
||||||
#define DT_UNDECLARED 8
|
#define DT_UNDECLARED 8
|
||||||
|
|
||||||
#define DT_GLOBAL 20 // Variable global
|
#define DT_GLOBAL 20 /* Variable global */
|
||||||
#define DT_LOCAL 21
|
#define DT_LOCAL 21
|
||||||
#define DT_PRIVATE 22
|
#define DT_PRIVATE 22
|
||||||
|
|
||||||
// SG = SIGNOS
|
/* SG = SIGNOS */
|
||||||
#define SG_CALL_OPEN 0
|
#define SG_CALL_OPEN 0
|
||||||
#define SG_COMA 1
|
#define SG_COMA 1
|
||||||
#define SG_PARENTESIS_OPEN 2
|
#define SG_PARENTESIS_OPEN 2
|
||||||
|
@ -125,13 +125,13 @@ extern struct prioridades {
|
||||||
#define SG_AND 20
|
#define SG_AND 20
|
||||||
#define SG_OR 21
|
#define SG_OR 21
|
||||||
#define SG_XOR 22
|
#define SG_XOR 22
|
||||||
#define SG_IGUALDAD 23 //Comparacion
|
#define SG_IGUALDAD 23 /* Comparacion */
|
||||||
#define SG_DISTINTO 24
|
#define SG_DISTINTO 24
|
||||||
#define SG_MAYOR 25
|
#define SG_MAYOR 25
|
||||||
#define SG_MAYOR_IGUAL 26
|
#define SG_MAYOR_IGUAL 26
|
||||||
#define SG_MENOR 27
|
#define SG_MENOR 27
|
||||||
#define SG_MENOR_IGUAL 28
|
#define SG_MENOR_IGUAL 28
|
||||||
#define SG_IGUAL 29 //Asignacion
|
#define SG_IGUAL 29 /* Asignacion */
|
||||||
|
|
||||||
#define SG_SUMA_IGUAL 30
|
#define SG_SUMA_IGUAL 30
|
||||||
#define SG_RESTA_IGUAL 31
|
#define SG_RESTA_IGUAL 31
|
||||||
|
@ -144,17 +144,18 @@ extern struct prioridades {
|
||||||
#define SG_DESP_DERECHA_IGUAL 38
|
#define SG_DESP_DERECHA_IGUAL 38
|
||||||
#define SG_DESP_IZQUIERDA_IGUAL 39
|
#define SG_DESP_IZQUIERDA_IGUAL 39
|
||||||
|
|
||||||
//CL = Tipos de call
|
/* CL = Tipos de call */
|
||||||
#define CL_USER 0
|
#define CL_USER 0
|
||||||
#define CL_DLL 1
|
#define CL_DLL 1
|
||||||
|
|
||||||
|
|
||||||
/* PROTOTIPOS DE FUNCIONES
|
/*
|
||||||
|
* PROTOTIPOS DE FUNCIONES
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef void (TYPEOF_hfuncion)();
|
typedef void (TYPEOF_hfuncion)();
|
||||||
|
|
||||||
// h = HANDLERS de los statements
|
/* h = HANDLERS de los statements */
|
||||||
void h_compiler_options();
|
void h_compiler_options();
|
||||||
void h_program();
|
void h_program();
|
||||||
void h_const();
|
void h_const();
|
||||||
|
|
|
@ -757,8 +757,8 @@ char* translate(int id_cadena)
|
||||||
case 0: /* español */
|
case 0: /* español */
|
||||||
{
|
{
|
||||||
static char* msg[] = {
|
static char* msg[] = {
|
||||||
/* 0 */ " **** Compilador eDIV " VERSION " ****\nCopyleft (c) 2000-2002 Sion, Ltd.\nhttp://www.edivcentral.com\n",
|
/* 0 */ " **** Compilador eDIV " VERSION " ****\nCopyleft (c) 2000-2002 Sion, Ltd.\nhttp://ediv.divsite.net\n",
|
||||||
/* 1 */ "ATENCION: Esta version de eDIV esta inacabada.\nPor favor informe de cualquier bug a: bugs@edivcentral.com\n",
|
/* 1 */ "ATENCION: Esta version de eDIV esta inacabada.\nPor favor informe de cualquier bug a: ediv@divsite.net\n",
|
||||||
/* 2 */ "Ayuda de opciones de comando:\n\n",
|
/* 2 */ "Ayuda de opciones de comando:\n\n",
|
||||||
/* 3 */ "%s [opciones] archivo.prg [ejecutable]\n\n",
|
/* 3 */ "%s [opciones] archivo.prg [ejecutable]\n\n",
|
||||||
/* 4 */ "Lista de opciones:\n",
|
/* 4 */ "Lista de opciones:\n",
|
||||||
|
@ -825,8 +825,8 @@ char* translate(int id_cadena)
|
||||||
case 1: /* italiano */
|
case 1: /* italiano */
|
||||||
{
|
{
|
||||||
static char* msg[] = {
|
static char* msg[] = {
|
||||||
/* 0 */ " **** Compilatore eDIV " VERSION " ****\nCopyleft (c) 2000-2002 Sion, Ltd.\nhttp://www.edivcentral.com\n",
|
/* 0 */ " **** Compilatore eDIV " VERSION " ****\nCopyleft (c) 2000-2002 Sion, Ltd.\nhttp://ediv.divsite.net\n",
|
||||||
/* 1 */ "ATTENZIONE: Questa versione di eDIV è incompleta.\nPer favore informa su qualunque bug a: bugs@edivcentral.com\n",
|
/* 1 */ "ATTENZIONE: Questa versione di eDIV è incompleta.\nPer favore informa su qualunque bug a: ediv@divsite.net\n",
|
||||||
/* 2 */ "Guida opzioni di comando:\n\n",
|
/* 2 */ "Guida opzioni di comando:\n\n",
|
||||||
/* 3 */ "%s [opzioni] archivio.prg [eseguibile]\n\n",
|
/* 3 */ "%s [opzioni] archivio.prg [eseguibile]\n\n",
|
||||||
/* 4 */ "Lista opzioni:\n",
|
/* 4 */ "Lista opzioni:\n",
|
||||||
|
@ -893,8 +893,8 @@ char* translate(int id_cadena)
|
||||||
case 2: /* portugués */
|
case 2: /* portugués */
|
||||||
{
|
{
|
||||||
static char* msg[] = {
|
static char* msg[] = {
|
||||||
/* 0 */ " **** Compilador eDIV " VERSION " ****\nCopyleft (c) 2000-2002 Sion, Ltd.\nhttp://www.edivcentral.com\n",
|
/* 0 */ " **** Compilador eDIV " VERSION " ****\nCopyleft (c) 2000-2002 Sion, Ltd.\nhttp://ediv.divsite.net\n",
|
||||||
/* 1 */ "ATENÇÃO: Esta versão de eDIV está inacabada.\nPor favor informe-nos de qualquer bug a: bugs@edivcentral.com\n",
|
/* 1 */ "ATENÇÃO: Esta versão de eDIV está inacabada.\nPor favor informe-nos de qualquer bug a: ediv@divsite.net\n",
|
||||||
/* 2 */ "Ajuda de opções de comando:\n\n",
|
/* 2 */ "Ajuda de opções de comando:\n\n",
|
||||||
/* 3 */ "%s [opções] arquivo.prg [executavel]\n\n",
|
/* 3 */ "%s [opções] arquivo.prg [executavel]\n\n",
|
||||||
/* 4 */ "Lista de opções:\n",
|
/* 4 */ "Lista de opções:\n",
|
||||||
|
@ -963,8 +963,8 @@ char* translate(int id_cadena)
|
||||||
case 3: /* inglés */
|
case 3: /* inglés */
|
||||||
{
|
{
|
||||||
static char* msg[] = {
|
static char* msg[] = {
|
||||||
/* 0 */ " **** eDIV Compiler " VERSION " ****\nCopyleft (c) 2000-2002Sion, Ltd.\nhttp://www.edivcentral.com\n",
|
/* 0 */ " **** eDIV Compiler " VERSION " ****\nCopyleft (c) 2000-2002Sion, Ltd.\nhttp://ediv.divsite.net\n",
|
||||||
/* 1 */ "WARNING: This version of eDIV is unfinished.\nPlease report any bug to: bugs@edivcentral.com\n",
|
/* 1 */ "WARNING: This version of eDIV is unfinished.\nPlease report any bug to: ediv@divsite.net\n",
|
||||||
/* 2 */ "Command line help:\n\n",
|
/* 2 */ "Command line help:\n\n",
|
||||||
/* 3 */ "%s [options] file.prg [executable]\n\n",
|
/* 3 */ "%s [options] file.prg [executable]\n\n",
|
||||||
/* 4 */ "Options list:\n",
|
/* 4 */ "Options list:\n",
|
||||||
|
@ -1031,8 +1031,8 @@ char* translate(int id_cadena)
|
||||||
case 4: /* catalán */
|
case 4: /* catalán */
|
||||||
{
|
{
|
||||||
static char* msg[] = {
|
static char* msg[] = {
|
||||||
/* 0 */ " **** Compilador eDIV " VERSION " ****\nCopyleft (c) 2000-2002 Sion, Ltd.\nhttp://www.edivcentral.com\n",
|
/* 0 */ " **** Compilador eDIV " VERSION " ****\nCopyleft (c) 2000-2002 Sion, Ltd.\nhttp://ediv.divsite.net\n",
|
||||||
/* 1 */ "ATENCIÓ: Aquesta versió d' eDIV està sense acabar.\nSi us plau, informi de qualsevol bug a: bugs@edivcentral.com\n",
|
/* 1 */ "ATENCIÓ: Aquesta versió d' eDIV està sense acabar.\nSi us plau, informi de qualsevol bug a: ediv@divsite.net\n",
|
||||||
/* 2 */ "Ajuda d' opcions de comand:\n\n",
|
/* 2 */ "Ajuda d' opcions de comand:\n\n",
|
||||||
/* 3 */ "%s [opcions] arxiu.prg [executable]\n\n",
|
/* 3 */ "%s [opcions] arxiu.prg [executable]\n\n",
|
||||||
/* 4 */ "Llista d' opcions:\n",
|
/* 4 */ "Llista d' opcions:\n",
|
||||||
|
@ -1098,8 +1098,8 @@ char* translate(int id_cadena)
|
||||||
case 5: /* euskera */
|
case 5: /* euskera */
|
||||||
{
|
{
|
||||||
static char* msg[] = {
|
static char* msg[] = {
|
||||||
/* 0 */ " **** eDIV konpiladorea " VERSION " ****\nCopyleft (c) 2000-2002 Sion, Ltd.\nhttp://www.edivcentral.com\n",
|
/* 0 */ " **** eDIV konpiladorea " VERSION " ****\nCopyleft (c) 2000-2002 Sion, Ltd.\nhttp://ediv.divsite.net\n",
|
||||||
/* 1 */ "KONTUZ: eDIV bertsio hau ez dago bukaturik.\nMesedez eman berri edozein akatzi buruz helbide honetan: bugs@edivcentral.com\n",
|
/* 1 */ "KONTUZ: eDIV bertsio hau ez dago bukaturik.\nMesedez eman berri edozein akatzi buruz helbide honetan: ediv@divsite.net\n",
|
||||||
/* 2 */ "Komandoei buruzko laguntza:\n\n",
|
/* 2 */ "Komandoei buruzko laguntza:\n\n",
|
||||||
/* 3 */ "%s [aukerak] archivo.prg [exekutagarria]\n\n",
|
/* 3 */ "%s [aukerak] archivo.prg [exekutagarria]\n\n",
|
||||||
/* 4 */ "Aukeren zerrenda:\n",
|
/* 4 */ "Aukeren zerrenda:\n",
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __LISTADOS_H
|
#ifndef __EDIV_LISTADOS_H_
|
||||||
#define __LISTADOS_H
|
#define __EDIV_LISTADOS_H_
|
||||||
|
|
||||||
void listado_objetos (void);
|
void listado_objetos (void);
|
||||||
void listado_ensamblador (void);
|
void listado_ensamblador (void);
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __LOWER_H
|
#ifndef __EDIV_LOWER_H_
|
||||||
#define __LOWER_H
|
#define __EDOV_LOWER_H_
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
|
|
|
@ -18,52 +18,55 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __MAIN_H
|
#ifndef __EDIV_MAIN_H_
|
||||||
#define __MAIN_H
|
#define __EDIV_MAIN_H_
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "edivcfg/iniparser.h"
|
#include "edivcfg/iniparser.h"
|
||||||
|
|
||||||
//#define MULTI_ERROR // para activar el sistema multi-error (bugs a mansalva)
|
/* Para activar el sistema multi-error (bugs a mansalva) descomentarizar lo siguiente: */
|
||||||
//#define DEBUG_DLL // para mostrar información al cargar las DLLs
|
/*#define MULTI_ERROR */
|
||||||
|
|
||||||
|
/* Para mostrar informacion al cargar las DLLs descomentarizar lo siguiente: */
|
||||||
|
/* #define DEBUG_DLL */
|
||||||
|
|
||||||
#define swap(a,b) {(a)^=(b);(b)^=(a);(a)^=(b);}
|
#define swap(a,b) {(a)^=(b);(b)^=(a);(a)^=(b);}
|
||||||
|
|
||||||
unsigned int stub_size; // tamaño del STUB.EXE (está almacenado en edivrun.lib)
|
unsigned int stub_size; /* tamaño del STUB.EXE (está almacenado en edivrun.lib) */
|
||||||
//FILE *fout; // stream del seudocodigo
|
|
||||||
|
|
||||||
byte *prog, *tprog; // buffer donde se almacena el PRG
|
byte *prog, *tprog; /* buffer donde se almacena el PRG */
|
||||||
size_t progsize; // tamaño del PRG
|
size_t progsize; /* tamaño del PRG */
|
||||||
char nombreprog[256]; // nombre del PRG sin extensión
|
char nombreprog[256]; /* nombre del PRG sin extensión */
|
||||||
char *fichero_prg; // nombre del archivo a compilar
|
char *fichero_prg; /* nombre del archivo a compilar */
|
||||||
char outfilename[256]; // archivo de salida
|
char outfilename[256]; /* archivo de salida */
|
||||||
char edivrun_lib[256]; // archivo stub (distinto para cada sistema)
|
char edivrun_lib[256]; /* archivo stub (distinto para cada sistema) */
|
||||||
|
|
||||||
byte listados; // +1 = genera listado EML; +2 = genera tabla de objetos
|
byte listados; /* +1 = genera listado EML; +2 = genera tabla de objetos */
|
||||||
byte debug; // 1 = Compilar en modo de depurado
|
byte debug; /* 1 = Compilar en modo de depurado */
|
||||||
byte noexe; // 1 = no crea un ejecutable
|
byte noexe; /* 1 = no crea un ejecutable */
|
||||||
|
|
||||||
int n_errors;
|
int n_errors;
|
||||||
int n_warnings;
|
int n_warnings;
|
||||||
int linea;
|
int linea;
|
||||||
|
|
||||||
// Información sobre los errores
|
/* Información sobre los errores */
|
||||||
|
|
||||||
/*int numero_error=-1;
|
/*
|
||||||
int linea_error;
|
* int numero_error=-1;
|
||||||
int columna_error;*/
|
* int linea_error;
|
||||||
|
* int columna_error;
|
||||||
|
*/
|
||||||
|
|
||||||
word error_25; // Para emitir "se esperaba una sentencia"
|
word error_25; /* Para emitir "se esperaba una sentencia" */
|
||||||
|
|
||||||
|
|
||||||
// Prototipos
|
/* Prototipos */
|
||||||
|
void *e_malloc(size_t size); /* un malloc con mensaje de error */
|
||||||
|
void e_free(void *puntero); /* un free que fija el puntero a NULL tras liberarlo */
|
||||||
|
void errormem(); /* mensaje "memoria insuficiente" */
|
||||||
|
void save_error(word tipo); /* guarda una posición de error */
|
||||||
|
void error(word tipo,word num, ...); /* error de compilación */
|
||||||
|
void warning(int num, ...); /* warning en el proceso */
|
||||||
|
|
||||||
void *e_malloc(size_t size); // un malloc con mensaje de error
|
#endif
|
||||||
void e_free(void *puntero);
|
|
||||||
void errormem(); // mensaje "memoria insuficiente"
|
|
||||||
void save_error(word tipo); // guarda una posición de error
|
|
||||||
void error(word tipo,word num, ...);// error de compilación
|
|
||||||
void warning(int num, ...); // warning en el proceso
|
|
||||||
|
|
||||||
#endif // __MAIN_H
|
|
|
@ -18,8 +18,8 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __MODULOS_H
|
#ifndef __EDIV_MODULOS_H_
|
||||||
#define __MODULOS_H
|
#define __EDIV_MODULOS_H_
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
|
|
@ -18,15 +18,16 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __PARSER_H
|
#ifndef __EDIV_PARSER_H_
|
||||||
#define __PARSER_H
|
#define __EDIV_PARSER_H_
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
|
|
||||||
byte* nombre_program; // nombre del programa, para guardarlo en el exe
|
byte* nombre_program; /* nombre del programa, para guardarlo en el exe */
|
||||||
|
|
||||||
/* A continuacion viene el asunto de los objetos. Para el que no se haya estudiado a fondo
|
/*
|
||||||
|
* A continuacion viene el asunto de los objetos. Para el que no se haya estudiado a fondo
|
||||||
* el DIVC.CPP (ejem) diré que un objeto es cada una de las variables, constantes, tipos
|
* el DIVC.CPP (ejem) diré que un objeto es cada una de las variables, constantes, tipos
|
||||||
* de proceso (declarados con PROCESS), tipos de funcion (declarados con FUNCTION), funciones
|
* de proceso (declarados con PROCESS), tipos de funcion (declarados con FUNCTION), funciones
|
||||||
* de DLL, estructuras, etc. etc. etc.
|
* de DLL, estructuras, etc. etc. etc.
|
||||||
|
@ -34,152 +35,144 @@ byte* nombre_program; // nombre del programa, para guardarlo en el exe
|
||||||
* y familiarizaros con las abreviaturas... ;)
|
* y familiarizaros con las abreviaturas... ;)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define max_obj 4096 //Limite maximo de objetos del compilador
|
#define max_obj 4096 /* Limite maximo de objetos del compilador */
|
||||||
#define long_med_id 16 //Longitud media de los identificadores (+4+4+1)
|
#define long_med_id 16 /* Longitud media de los identificadores (+4+4+1) */
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Tabla de objetos - - - - - - - - - - - - - - - - - *iobj primer objeto libre
|
/* Tabla de objetos - - - - - - - - - - - - - - - - - *iobj primer objeto libre */
|
||||||
|
|
||||||
struct objeto {
|
struct objeto {
|
||||||
byte tipo; // Tipo de objeto
|
byte tipo; /* Tipo de objeto */
|
||||||
byte usado; // Indica si el objeto ha sido usado antes de definirse
|
byte usado; /* Indica si el objeto ha sido usado antes de definirse */
|
||||||
byte * name; // Puntero al nombre, para algún listado
|
byte * name; /* Puntero al nombre, para algún listado */
|
||||||
byte * ierror;// Puntero al código para determinar la columna si es necesario
|
byte * ierror;/* Puntero al código para determinar la columna si es necesario */
|
||||||
int linea; // Línea de código fuente, para informar del error
|
int linea; /* Línea de código fuente, para informar del error */
|
||||||
int param; // Indica que es un objeto declarado en los parámetros
|
int param; /* Indica que es un objeto declarado en los parámetros */
|
||||||
int dll; // En qué dll se declara el objeto, -1 = pertenece al prg
|
int dll; /* En qué dll se declara el objeto, -1 = pertenece al prg */
|
||||||
struct objeto * anterior; // Anterior objeto de igual nombre
|
struct objeto * anterior; /* Anterior objeto de igual nombre */
|
||||||
struct objeto * bloque; // Bloque de este proceso (0-global/local N-private)
|
struct objeto * bloque; /* Bloque de este proceso (0-global/local N-private) */
|
||||||
struct objeto * member; // Indica a que struct pertenece (0-n/a)
|
struct objeto * member; /* Indica a que struct pertenece (0-n/a) */
|
||||||
union {
|
union {
|
||||||
struct { // Constante
|
struct { /* Constante */
|
||||||
int valor;
|
int valor;
|
||||||
int literal; // 0-no, 1-si
|
int literal; /* 0-no, 1-si */
|
||||||
} cons;
|
} cons;
|
||||||
struct { // Variable global
|
struct { /* Variable global */
|
||||||
int offset;
|
int offset;
|
||||||
} vglo;
|
} vglo;
|
||||||
struct { // Tabla global
|
struct { /* Tabla global */
|
||||||
int offset;
|
int offset;
|
||||||
int totalen; // numero total de elementos
|
int totalen; /* numero total de elementos */
|
||||||
int len1,len2,len3; // len2/3==-1 si n/a
|
int len1,len2,len3; /* len2/3==-1 si n/a */
|
||||||
} tglo,pigl;
|
} tglo,pigl;
|
||||||
struct { // Byte global
|
struct { /* Byte global */
|
||||||
int offset;
|
int offset;
|
||||||
int totalen; // numero total de elementos
|
int totalen; /* numero total de elementos */
|
||||||
int len1,len2,len3; // len2/3==-1 si n/a
|
int len1,len2,len3; /* len2/3==-1 si n/a */
|
||||||
} bglo,pbgl;
|
} bglo,pbgl;
|
||||||
struct { // Word global
|
struct { /* Word global */
|
||||||
int offset;
|
int offset;
|
||||||
int totalen; // numero total de elementos
|
int totalen; /* numero total de elementos */
|
||||||
int len1,len2,len3; // len2/3==-1 si n/a
|
int len1,len2,len3; /* len2/3==-1 si n/a */
|
||||||
} wglo,pwgl;
|
} wglo,pwgl;
|
||||||
struct { // Cadena (string) global
|
struct { /* Cadena (string) global */
|
||||||
int offset;
|
int offset;
|
||||||
int totalen; // numero total de elementos
|
int totalen; /* numero total de elementos */
|
||||||
} cglo,pcgl;
|
} cglo,pcgl;
|
||||||
struct { // Struct
|
struct { /* Struct */
|
||||||
int offset;
|
int offset;
|
||||||
int len_item; // Número de campos
|
int len_item; /* Número de campos */
|
||||||
int totalitems; // Numero total de registros
|
int totalitems; /* Numero total de registros */
|
||||||
int items1,items2,items3; // -1 si n/a
|
int items1,items2,items3; /* -1 si n/a */
|
||||||
} sglo,sloc;
|
} sglo,sloc;
|
||||||
struct { // Struct pointer
|
struct { /* Struct pointer */
|
||||||
int offset;
|
int offset;
|
||||||
struct objeto * ostruct; // Puntero al struct
|
struct objeto * ostruct; /* Puntero al struct */
|
||||||
int totalitems; // Número total de registros
|
int totalitems; /* Número total de registros */
|
||||||
int items1,items2,items3; // -1 si n/a
|
int items1,items2,items3; /* -1 si n/a */
|
||||||
} psgl,pslo;
|
} psgl,pslo;
|
||||||
struct { // Variable local
|
struct { /* Variable local */
|
||||||
int offset;
|
int offset;
|
||||||
} vloc;
|
} vloc;
|
||||||
struct { // Tabla local
|
struct { /* Tabla local */
|
||||||
int offset;
|
int offset;
|
||||||
int totalen;
|
int totalen;
|
||||||
int len1,len2,len3;
|
int len1,len2,len3;
|
||||||
} tloc,pilo;
|
} tloc,pilo;
|
||||||
struct { // Byte local
|
struct { /* Byte local */
|
||||||
int offset;
|
int offset;
|
||||||
int totalen; // numero total de elementos
|
int totalen; /* numero total de elementos */
|
||||||
int len1,len2,len3; // len2/3==-1 si n/a
|
int len1,len2,len3; /* len2/3==-1 si n/a */
|
||||||
} bloc,pblo;
|
} bloc,pblo;
|
||||||
struct { // Word local
|
struct { /* Word local */
|
||||||
int offset;
|
int offset;
|
||||||
int totalen; // numero total de elementos
|
int totalen; /* numero total de elementos */
|
||||||
int len1,len2,len3; // len2/3==-1 si n/a
|
int len1,len2,len3; /* len2/3==-1 si n/a */
|
||||||
} wloc,pwlo;
|
} wloc,pwlo;
|
||||||
struct { // Cadena (string) local
|
struct { /* Cadena (string) local */
|
||||||
int offset;
|
int offset;
|
||||||
int totalen; // numero total de elementos
|
int totalen; /* numero total de elementos */
|
||||||
} cloc,pclo;
|
} cloc,pclo;
|
||||||
struct { // Proceso
|
struct { /* Proceso */
|
||||||
struct objeto * bloque;
|
struct objeto * bloque;
|
||||||
int offset;
|
int offset;
|
||||||
int num_par; // Número de parámetros
|
int num_par; /* Número de parámetros */
|
||||||
} proc;
|
} proc;
|
||||||
|
|
||||||
// qsort requiere como parametros un nombre de estructura y un campo
|
/*
|
||||||
// Ya le buscaremos una solución (p.ej. una función complementaria a EDIV_Export)
|
* qsort requiere como parametros un nombre de estructura y un campo
|
||||||
|
* Ya le buscaremos una solución (p.ej. una función complementaria a EDIV_Export)
|
||||||
|
*/
|
||||||
|
|
||||||
struct { // Funcion externa (DLL)
|
struct { /* Funcion externa (DLL) */
|
||||||
int codigo;
|
int codigo;
|
||||||
int num_par;
|
int num_par;
|
||||||
} fext;
|
} fext;
|
||||||
};
|
};
|
||||||
} obj[max_obj], * iobj; // - - - - - - - - - - - - - - - - - - - - - - - - - -
|
} obj[max_obj], * iobj; // - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#define tnone 0 // Tipos de objetos en obj[]
|
#define tnone 0 /* Tipos de objetos en obj[] */
|
||||||
#define tcons 1 // Constantes
|
#define tcons 1 /* Constantes */
|
||||||
#define tvglo 2 // Int global
|
#define tvglo 2 /* Int global */
|
||||||
#define ttglo 3 // Tabla int global
|
#define ttglo 3 /* Tabla int global */
|
||||||
#define tcglo 4 // Cadena global
|
#define tcglo 4 /* Cadena global */
|
||||||
#define tvloc 5 // Locales
|
#define tvloc 5 /* Locales */
|
||||||
#define ttloc 6
|
#define ttloc 6
|
||||||
#define tcloc 7
|
#define tcloc 7
|
||||||
#define tproc 8 // Proceso
|
#define tproc 8 /* Proceso */
|
||||||
#define tfunc 9
|
#define tfunc 9
|
||||||
#define tsglo 10 // Structs
|
#define tsglo 10 /* Structs */
|
||||||
#define tsloc 11
|
#define tsloc 11
|
||||||
#define tfext 12 // Función de una librer¡a externa
|
#define tfext 12 /* Función de una librer¡a externa */
|
||||||
|
#define tbglo 13 /* Byte global */
|
||||||
#define tbglo 13 // Byte global
|
#define twglo 14 /* Word global */
|
||||||
#define twglo 14 // Word global
|
#define tbloc 15 /* Byte local */
|
||||||
#define tbloc 15 // Byte local
|
#define twloc 16 /* Word local */
|
||||||
#define twloc 16 // Word local
|
#define tpigl 17 /* Puntero a ints global (un ttglo direccionable) */
|
||||||
|
#define tpilo 18 /* Puntero a ints local (idem) */
|
||||||
#define tpigl 17 // Puntero a ints global (un ttglo direccionable)
|
#define tpwgl 19 /* Punteros a word */
|
||||||
#define tpilo 18 // Puntero a ints local (idem)
|
|
||||||
|
|
||||||
#define tpwgl 19 // Punteros a word
|
|
||||||
#define tpwlo 20
|
#define tpwlo 20
|
||||||
#define tpbgl 21 // Punteros a byte
|
#define tpbgl 21 /* Punteros a byte */
|
||||||
#define tpblo 22
|
#define tpblo 22
|
||||||
|
#define tpcgl 23 /* Punteros a string */
|
||||||
#define tpcgl 23 // Punteros a string
|
|
||||||
#define tpclo 24
|
#define tpclo 24
|
||||||
#define tpsgl 25 // Punteros a struct
|
#define tpsgl 25 /* Punteros a struct */
|
||||||
#define tpslo 26
|
#define tpslo 26
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
byte * vnom; /* Vector de nombres (cad_hash:int, pieza (o iobj):int, asciiz) */
|
||||||
|
|
||||||
byte * vnom; // Vector de nombres (cad_hash:int, pieza (o iobj):int, asciiz)
|
|
||||||
|
|
||||||
union {
|
union {
|
||||||
byte *b;
|
byte *b;
|
||||||
byte **p;
|
byte **p;
|
||||||
} ivnom;
|
} ivnom;
|
||||||
|
|
||||||
byte * inicio_objetos; // Para el crear listado de la tabla de objetos
|
byte * inicio_objetos; /* Para el crear listado de la tabla de objetos */
|
||||||
|
byte * vhash[256]; /* Punteros al vector de nombres; */
|
||||||
byte * vhash[256]; // Punteros al vector de nombres;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
/* Ahora viene todo lo referente al parser en si, es decir, al analizador léxico y sintáctico.
|
/*
|
||||||
|
* Ahora viene todo lo referente al parser en si, es decir, al analizador léxico y sintáctico.
|
||||||
* También se incluye aquí al evaluador de expresiones (por cierto, usa notación polaca xD)
|
* También se incluye aquí al evaluador de expresiones (por cierto, usa notación polaca xD)
|
||||||
* El parser de DIV es realmente bueno, y además muy personalizable. Que yo sepa, sólo existe
|
* El parser de DIV es realmente bueno, y además muy personalizable. Que yo sepa, sólo existe
|
||||||
* un bug en el evaluador de expresiones, al parecer los operadores lógicos no funcionan de
|
* un bug en el evaluador de expresiones, al parecer los operadores lógicos no funcionan de
|
||||||
|
@ -188,28 +181,26 @@ byte * vhash[256]; // Punteros al vector de nombres;
|
||||||
* al listado EML ;)
|
* al listado EML ;)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define max_nodos 128 //Máximo número de nodos del léxico para símbolos
|
#define max_nodos 128 /* Máximo número de nodos del léxico para símbolos */
|
||||||
|
|
||||||
#define cr 13 //Retorno de carro
|
#define cr 13 /* Retorno de carro */
|
||||||
#define lf 10 //Salto de linea
|
#define lf 10 /* Salto de linea */
|
||||||
#define tab 9 //Tabulación
|
#define tab 9 /* Tabulación */
|
||||||
|
|
||||||
//Valores de lex_case, si no son punteros a lex_simb
|
/* Valores de lex_case, si no son punteros a lex_simb */
|
||||||
#define l_err 0 //Caracter desconocido
|
#define l_err 0 /* Caracter desconocido */
|
||||||
#define l_cr 1 //Fin de linea (l_err Carácter no esperado)
|
#define l_cr 1 /* Fin de linea (l_err Carácter no esperado) */
|
||||||
#define l_id 2 //Identificador o palabra reservada
|
#define l_id 2 /* Identificador o palabra reservada */
|
||||||
#define l_spc 3 //Espacios y tabulaciones
|
#define l_spc 3 /* Espacios y tabulaciones */
|
||||||
#define l_lit 4 //Literal
|
#define l_lit 4 /* Literal */
|
||||||
#define l_num 5 //Constante numérica
|
#define l_num 5 /* Constante numérica */
|
||||||
#define l_eof 6 //Fin de fichero
|
#define l_eof 6 /* Fin de fichero */
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
/*
|
||||||
// Valores sintácticos o tokens (pieza)
|
* Valores sintácticos o tokens (pieza)
|
||||||
//-----------------------------------------------------------------------------
|
*/
|
||||||
|
#define p_ultima 0x00 /* Fin de fichero <EOF> */
|
||||||
#define p_ultima 0x00 //Fin de fichero <EOF>
|
|
||||||
|
|
||||||
#define p_program 0x01
|
#define p_program 0x01
|
||||||
#define p_const 0x02
|
#define p_const 0x02
|
||||||
#define p_global 0x03
|
#define p_global 0x03
|
||||||
|
@ -219,8 +210,8 @@ byte * vhash[256]; // Punteros al vector de nombres;
|
||||||
#define p_process 0x07
|
#define p_process 0x07
|
||||||
#define p_private 0x08
|
#define p_private 0x08
|
||||||
#define p_struct 0x09
|
#define p_struct 0x09
|
||||||
#define p_import 0x0A // sólo para mostrar el warning de que ya no se usa
|
#define p_import 0x0A /* sólo para mostrar el warning de que ya no se usa */
|
||||||
#define p_setup_program 0x0B // idem
|
#define p_setup_program 0x0B /* idem */
|
||||||
|
|
||||||
#define p_string 0x0C
|
#define p_string 0x0C
|
||||||
#define p_byte 0x0D
|
#define p_byte 0x0D
|
||||||
|
@ -230,9 +221,9 @@ byte * vhash[256]; // Punteros al vector de nombres;
|
||||||
#define p_compiler_options 0x10
|
#define p_compiler_options 0x10
|
||||||
#define p_function 0x11
|
#define p_function 0x11
|
||||||
|
|
||||||
#define p_until 0x15 // antes 0x16
|
#define p_until 0x15 /* antes 0x16 */
|
||||||
#define p_else 0x16 // antes 0x17
|
#define p_else 0x16 /* antes 0x17 */
|
||||||
#define p_elseif 0x17 // NUEVO!
|
#define p_elseif 0x17 /* NUEVO! */
|
||||||
|
|
||||||
#define p_return 0x18
|
#define p_return 0x18
|
||||||
|
|
||||||
|
@ -328,9 +319,9 @@ byte * vhash[256]; // Punteros al vector de nombres;
|
||||||
#define p_shr_asig 0x73
|
#define p_shr_asig 0x73
|
||||||
#define p_shl_asig 0x74
|
#define p_shl_asig 0x74
|
||||||
|
|
||||||
#define p_ini_rem 0x7d //Inicio comentario
|
#define p_ini_rem 0x7d /* Inicio comentario */
|
||||||
#define p_end_rem 0x7e //Fin comentario
|
#define p_end_rem 0x7e /* Fin comentario */
|
||||||
#define p_rem 0x7f //Comentario de una linea
|
#define p_rem 0x7f /* Comentario de una linea */
|
||||||
|
|
||||||
#define p_strigu 0xc0
|
#define p_strigu 0xc0
|
||||||
#define p_strdis 0xc1
|
#define p_strdis 0xc1
|
||||||
|
@ -383,70 +374,55 @@ byte * vhash[256]; // Punteros al vector de nombres;
|
||||||
|
|
||||||
#define p_pointerbyte 0xf7
|
#define p_pointerbyte 0xf7
|
||||||
|
|
||||||
#define p_lit 0xfc //Puntero al literal (txt) en pieza_num
|
#define p_lit 0xfc /* Puntero al literal (txt) en pieza_num */
|
||||||
#define p_id 0xfd //o es un ptr a vnom (a un ptr al objeto)
|
#define p_id 0xfd /* o es un ptr a vnom (a un ptr al objeto) */
|
||||||
#define p_num 0xfe //Número en pieza_num
|
#define p_num 0xfe /* Número en pieza_num */
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Tabla de elementos léxicos (distintos tipos de token)
|
|
||||||
|
|
||||||
|
/* Tabla de elementos léxicos (distintos tipos de token) */
|
||||||
struct lex_ele { byte caracter;
|
struct lex_ele { byte caracter;
|
||||||
byte token;
|
byte token;
|
||||||
struct lex_ele * alternativa;
|
struct lex_ele * alternativa;
|
||||||
struct lex_ele * siguiente; }
|
struct lex_ele * siguiente; }
|
||||||
lex_simb[max_nodos], * ilex_simb, * lex_case[256];
|
lex_simb[max_nodos], * ilex_simb, * lex_case[256];
|
||||||
|
|
||||||
// Pieza (token) que se está leyendo (ver constantes p_xxxx)
|
/* Pieza (token) que se está leyendo (ver constantes p_xxxx) */
|
||||||
int pieza, pieza_num;
|
int pieza, pieza_num;
|
||||||
|
|
||||||
struct objeto * o; // Cuando pieza=p_id, objeto de tipo (**o).tipo
|
struct objeto * o; /* Cuando pieza=p_id, objeto de tipo (**o).tipo */
|
||||||
struct objeto * bloque_actual; // Bloque que esta siendo analizado
|
struct objeto * bloque_actual; /* Bloque que esta siendo analizado */
|
||||||
struct objeto * bloque_lexico; // Es 0 hasta las privadas del program
|
struct objeto * bloque_lexico; /* Es 0 hasta las privadas del program */
|
||||||
|
struct objeto * member; /* !=0 al declarar/acceder un miembro de un struct */
|
||||||
|
|
||||||
struct objeto * member; // !=0 al declarar/acceder un miembro de un struct
|
/* número de nodos, número de objetos */
|
||||||
|
|
||||||
// número de nodos, número de objetos
|
|
||||||
int num_nodos, num_obj;
|
int num_nodos, num_obj;
|
||||||
|
|
||||||
int num_obj_predefinidos;
|
int num_obj_predefinidos;
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
/*
|
||||||
// Variables relacionadas con el listado formateado
|
* Variables relacionadas con el listado formateado
|
||||||
//-----------------------------------------------------------------------------
|
*/
|
||||||
|
int coment; /* 0-Código, 1-Dentro de comentario, 2-Anidado, ... */
|
||||||
int coment; // 0-Código, 1-Dentro de comentario, 2-Anidado, ...
|
|
||||||
//int convert; // Indica si se deben generar ya los token en ls
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
int old_linea; // Situación en el fichero del token anterior al último leido
|
int old_linea; /* Situación en el fichero del token anterior al último leido */
|
||||||
byte * old_ierror, * old_ierror_end;
|
byte * old_ierror, * old_ierror_end;
|
||||||
|
|
||||||
// El último token leido está en (linea,ierror,ierror_end)
|
/* El último token leido está en (linea,ierror,ierror_end) */
|
||||||
|
|
||||||
byte * ultima_linea,cero;
|
byte * ultima_linea,cero;
|
||||||
|
|
||||||
// Siguiente token -> next_lexico()
|
/* Siguiente token -> next_lexico() */
|
||||||
int next_pieza;
|
int next_pieza;
|
||||||
int next_linea;
|
int next_linea;
|
||||||
byte * next_source;
|
byte * next_source;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
int parametros;
|
int parametros;
|
||||||
|
int acceso_remoto; /* Para no permitir id.private */
|
||||||
int acceso_remoto; // Para no permitir id.private
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
/*
|
||||||
// PROTOTIPOS
|
* PROTOTIPOS
|
||||||
//-----------------------------------------------------------------------------
|
*/
|
||||||
|
|
||||||
int crea_objeto(byte * nombre, int nparam);
|
int crea_objeto(byte * nombre, int nparam);
|
||||||
void psintactico(void);
|
void psintactico(void);
|
||||||
|
@ -466,4 +442,4 @@ void tglo_init(int tipo);
|
||||||
void tloc_init(int tipo);
|
void tloc_init(int tipo);
|
||||||
void tglo_init2(int tipo);
|
void tglo_init2(int tipo);
|
||||||
|
|
||||||
#endif // __PARSER_H
|
#endif /* __EDIV_PARSER_H_ */
|
|
@ -18,7 +18,8 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* IDs de idioma:
|
/*
|
||||||
|
* IDs de idioma:
|
||||||
* 0 - ES - Español
|
* 0 - ES - Español
|
||||||
* 1 - IT - Italiano (CicTec)
|
* 1 - IT - Italiano (CicTec)
|
||||||
* 2 - PT - Portugués (tareco)
|
* 2 - PT - Portugués (tareco)
|
||||||
|
@ -27,8 +28,8 @@
|
||||||
* 5 - EU - Euskera (Jorge Urreta)
|
* 5 - EU - Euskera (Jorge Urreta)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __LANGUAGE_H
|
#ifndef __EDIV_LANGUAGE_H_
|
||||||
#define __LANGUAGE_H
|
#define __EDIV_LANGUAGE_H_
|
||||||
|
|
||||||
#define NUM_LANGUAGES 6
|
#define NUM_LANGUAGES 6
|
||||||
|
|
||||||
|
@ -36,18 +37,18 @@
|
||||||
|
|
||||||
int idioma;
|
int idioma;
|
||||||
|
|
||||||
// comunes
|
/* comunes */
|
||||||
int detecta_idioma();
|
int detecta_idioma();
|
||||||
char* translate(int id_cadena);
|
char* translate(int id_cadena);
|
||||||
char* translate_dll_error(int num);
|
char* translate_dll_error(int num);
|
||||||
|
|
||||||
// compilador
|
/* compilador */
|
||||||
char* translate_error(int num);
|
char* translate_error(int num);
|
||||||
char* translate_warning(int num);
|
char* translate_warning(int num);
|
||||||
char* translate_ltlex_error(int num);
|
char* translate_ltlex_error(int num);
|
||||||
|
|
||||||
// stub
|
/* stub */
|
||||||
char* translate_runtime_error(int num);
|
char* translate_runtime_error(int num);
|
||||||
char* translate_critical_error(int num);
|
char* translate_critical_error(int num);
|
||||||
|
|
||||||
#endif // __LANGUAGE_H
|
#endif /* __EDIV_LANGUAGE_H_ */
|
||||||
|
|
|
@ -22,11 +22,11 @@
|
||||||
* Definiciones compartidas de eDiv - Usar en eDiv, encrypt y stub :)
|
* Definiciones compartidas de eDiv - Usar en eDiv, encrypt y stub :)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __SHARED_H
|
#ifndef __EDIV_SHARED_H_
|
||||||
#define __SHARED_H
|
#define __EDIV_SHARED_H_
|
||||||
|
|
||||||
#define VERSION "0.1.1 (Orion)"
|
#define VERSION "0.1.1 (Orion)" /* Version y codename */
|
||||||
#define la_clave "Open_eDiv"
|
#define la_clave "Open_eDiv" /* Clave de cifrado */
|
||||||
|
|
||||||
#define uchar char
|
#define uchar char
|
||||||
#define byte unsigned char
|
#define byte unsigned char
|
||||||
|
@ -37,6 +37,6 @@
|
||||||
|
|
||||||
#define magic "eDIV Stub\x1a\x0d\x0a\xff"
|
#define magic "eDIV Stub\x1a\x0d\x0a\xff"
|
||||||
|
|
||||||
#define long_header 9 //Longitud de la cabecera al inicio de los programas
|
#define long_header 9 /* Longitud de la cabecera al inicio de los programas */
|
||||||
|
|
||||||
#endif // __SHARED_H
|
#endif /* __EDIV_SHARED_H_
|
Loading…
Reference in a new issue