Mas limpieza de codigo y comentarizacion :)
This commit is contained in:
parent
8fa6611639
commit
a47dc64718
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* eDiv Compiler
|
* eDiv Compiler
|
||||||
* Copyleft (C) 2000-2002 Sion Entertainment
|
* Copyright (C) 2000-2002 Sion Entertainment
|
||||||
* http://www.sion-e.com
|
* http://www.sionhq.com
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -23,7 +23,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
//#include "config.h"
|
|
||||||
#include "compiler.h"
|
#include "compiler.h"
|
||||||
#include "lower.h"
|
#include "lower.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
|
@ -59,7 +58,8 @@ void lee_ediv_cfg(char* ediv_cfg)
|
||||||
|
|
||||||
strcpy(cfg,ediv_cfg);
|
strcpy(cfg,ediv_cfg);
|
||||||
|
|
||||||
max_process=0; // Valores de las opciones por defecto
|
/* Valores de las opciones por defecto */
|
||||||
|
max_process=0;
|
||||||
ignore_errors=0;
|
ignore_errors=0;
|
||||||
free_sintax=0;
|
free_sintax=0;
|
||||||
extended_conditions=0;
|
extended_conditions=0;
|
||||||
|
@ -91,9 +91,9 @@ void lee_ediv_cfg(char* ediv_cfg)
|
||||||
|
|
||||||
if(!strcmp(tag,"max_process")) {
|
if(!strcmp(tag,"max_process")) {
|
||||||
salta_spc();
|
salta_spc();
|
||||||
if(buffer[i]!='=') cfg_error(1); // se esperaba '='
|
if(buffer[i]!='=') cfg_error(1); /* se esperaba '=' */
|
||||||
salta_spc();
|
salta_spc();
|
||||||
if(buffer[i]<'0' || buffer[i]>'9') cfg_error(2); // se esperaba un dato numerico
|
if(buffer[i]<'0' || buffer[i]>'9') cfg_error(2); /* se esperaba un dato numerico */
|
||||||
c=0;
|
c=0;
|
||||||
while(buffer[i]>='0' && buffer[i]<='9' && i<tamano)
|
while(buffer[i]>='0' && buffer[i]<='9' && i<tamano)
|
||||||
tag[c++]=buffer[i++];
|
tag[c++]=buffer[i++];
|
||||||
|
@ -106,51 +106,51 @@ void lee_ediv_cfg(char* ediv_cfg)
|
||||||
printf("dbg: max_process=%d\n",max_process);
|
printf("dbg: max_process=%d\n",max_process);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 1: // _extended_conditions
|
case 1: /* _extended_conditions */
|
||||||
lexico();
|
lexico();
|
||||||
extended_conditions=1;
|
extended_conditions=1;
|
||||||
break;
|
break;
|
||||||
case 2: // _simple_conditions
|
case 2: /* _simple_conditions */
|
||||||
lexico();
|
lexico();
|
||||||
simple_conditions=1;
|
simple_conditions=1;
|
||||||
break;
|
break;
|
||||||
case 3: // _case_sensitive
|
case 3: /* _case_sensitive */
|
||||||
lexico();
|
lexico();
|
||||||
memcpy(lower+129,"üéâäàåçêëèïîìäåéææôöòûùÿöü¢£¥áíóú",35);
|
memcpy(lower+129,"üéâäàåçêëèïîìäåéææôöòûùÿöü¢£¥áíóú",35);
|
||||||
memcpy(lower+'A',"ABCDEFGHIJKLMNOPQRSTUVWXYZ",26);
|
memcpy(lower+'A',"ABCDEFGHIJKLMNOPQRSTUVWXYZ",26);
|
||||||
lower['Ñ']='Ñ';
|
lower['Ñ']='Ñ';
|
||||||
break;
|
break;
|
||||||
case 4: // _ignore_errors
|
case 4: /* _ignore_errors */
|
||||||
lexico();
|
lexico();
|
||||||
ignore_errors=1;
|
ignore_errors=1;
|
||||||
break;
|
break;
|
||||||
case 5: // _free_sintax
|
case 5: /* _free_sintax */
|
||||||
lexico();
|
lexico();
|
||||||
free_sintax=1;
|
free_sintax=1;
|
||||||
break;
|
break;
|
||||||
case 6: // _no_check
|
case 6: /* _no_check */
|
||||||
lexico();
|
lexico();
|
||||||
comprueba_rango=0;
|
comprueba_rango=0;
|
||||||
comprueba_id=0;
|
comprueba_id=0;
|
||||||
comprueba_null=0;
|
comprueba_null=0;
|
||||||
break;
|
break;
|
||||||
case 7: // _no_strfix
|
case 7: /* _no_strfix */
|
||||||
lexico();
|
lexico();
|
||||||
hacer_strfix=0;
|
hacer_strfix=0;
|
||||||
break;
|
break;
|
||||||
case 8: // _no_optimization
|
case 8: /* _no_optimization */
|
||||||
lexico();
|
lexico();
|
||||||
optimizar=0;
|
optimizar=0;
|
||||||
break;
|
break;
|
||||||
case 9: // _no_range_check
|
case 9: /* _no_range_check */
|
||||||
lexico();
|
lexico();
|
||||||
comprueba_rango=0;
|
comprueba_rango=0;
|
||||||
break;
|
break;
|
||||||
case 10: // _no_id_check
|
case 10: /* _no_id_check */
|
||||||
lexico();
|
lexico();
|
||||||
comprueba_id=0;
|
comprueba_id=0;
|
||||||
break;
|
break;
|
||||||
case 11: // _no_null_check
|
case 11: /* _no_null_check */
|
||||||
lexico();
|
lexico();
|
||||||
comprueba_null=0;
|
comprueba_null=0;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -49,19 +49,21 @@ typedef BOOL (WINAPI *DLLMAIN_T)(HMODULE hinstDLL, DWORD fdwReason, LPVOID lpvRe
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
|
||||||
// Process-global variables
|
/* Process-global variables */
|
||||||
|
|
||||||
IMAGE_PARAMETERS *g_pImageParamHead;
|
IMAGE_PARAMETERS *g_pImageParamHead;
|
||||||
CRITICAL_SECTION g_DLLCrit;
|
CRITICAL_SECTION g_DLLCrit;
|
||||||
|
|
||||||
// Function implementations
|
/* Function implementations */
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/*
|
||||||
// Detecta la version de windows //
|
* void CheckWindowsVersion(void);
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
* Detecta la version de windows
|
||||||
|
*
|
||||||
// Si es WinNT devuelve g_bIsWinNT=1
|
* Ajusta
|
||||||
// Si es Win'9x/Me devuelve g_bIsWinNT=0;
|
* g_bIsWinNT a 1 si estamos en un NT
|
||||||
|
* g_bIsWinNT a 0 si NO estamos en un NT
|
||||||
|
*/
|
||||||
void CheckWindowsVersion(void)
|
void CheckWindowsVersion(void)
|
||||||
{
|
{
|
||||||
OSVERSIONINFO osvi;
|
OSVERSIONINFO osvi;
|
||||||
|
@ -76,10 +78,9 @@ void CheckWindowsVersion(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/*
|
||||||
// Initialization Routines //
|
* Initialization Routines
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
*/
|
||||||
|
|
||||||
void InitializeDLLLoad(void)
|
void InitializeDLLLoad(void)
|
||||||
{
|
{
|
||||||
InitializeCriticalSection(&g_DLLCrit);
|
InitializeCriticalSection(&g_DLLCrit);
|
||||||
|
@ -100,10 +101,9 @@ void KillDLLLoad(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/*
|
||||||
// Internal DLL list management //
|
* Internal DLL list management
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
*/
|
||||||
|
|
||||||
// returns 0 if just ref count increment, 1 if this is a new addition, -1 on error
|
// returns 0 if just ref count increment, 1 if this is a new addition, -1 on error
|
||||||
static int AddDLLReference(void *pImageBase, char *svName, DWORD dwFlags)
|
static int AddDLLReference(void *pImageBase, char *svName, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* eDiv Compiler
|
* eDiv Compiler
|
||||||
* Copyleft (C) 2000-2002 Sion Entertainment
|
* Copyright (C) 2000-2002 Sion Entertainment
|
||||||
* http://www.sion-e.com
|
* http://www.sionhq.com
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -21,9 +21,7 @@
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
# include "dll_load.h"
|
# include "dll_load.h"
|
||||||
|
|
||||||
struct in_addr iahost;
|
struct in_addr iahost;
|
||||||
//struct sockaddr_in sin;
|
|
||||||
struct hostent *htent;
|
struct hostent *htent;
|
||||||
struct servent *svent;
|
struct servent *svent;
|
||||||
int status;
|
int status;
|
||||||
|
@ -36,9 +34,8 @@ void muestra_motd();
|
||||||
void conecta(char *servidor, char *archivo);
|
void conecta(char *servidor, char *archivo);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
# include <dlfcn.h> // ¿será igual en BeOS?
|
# include <dlfcn.h> /* ¿será igual en BeOS? */
|
||||||
# include <dirent.h>
|
# include <dirent.h>
|
||||||
//# include <sys/stat.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -58,9 +55,9 @@ void conecta(char *servidor, char *archivo);
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
FILE *fp; // stream del PRG
|
FILE *fp; /* stream del PRG /*
|
||||||
char *p;
|
char *p;
|
||||||
char libmagic[14]; // cabecera "magic" de EDIVRUN.LIB
|
char libmagic[14]; /* cabecera "magic" de EDIVRUN.LIB */
|
||||||
|
|
||||||
int i,j;
|
int i,j;
|
||||||
byte hayprog=0;
|
byte hayprog=0;
|
||||||
|
@ -73,8 +70,7 @@ int main(int argc, char *argv[])
|
||||||
listados=0;
|
listados=0;
|
||||||
noexe=0;
|
noexe=0;
|
||||||
|
|
||||||
// Sistemas
|
/* Sistemas */
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
strcpy(sistema,"win32");
|
strcpy(sistema,"win32");
|
||||||
#endif
|
#endif
|
||||||
|
@ -87,7 +83,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
idioma=detecta_idioma();
|
idioma=detecta_idioma();
|
||||||
|
|
||||||
// mensaje de cabecera
|
/* mensaje de cabecera */
|
||||||
printf(translate(0));
|
printf(translate(0));
|
||||||
printf(translate(1));
|
printf(translate(1));
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -99,7 +95,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
if(strcmp(argv[1],"--help")==0 || strcmp(argv[1],"-h")==0) {
|
if(strcmp(argv[1],"--help")==0 || strcmp(argv[1],"-h")==0) {
|
||||||
ayuda:
|
ayuda:
|
||||||
// pantalla de ayuda
|
/* pantalla de ayuda */
|
||||||
printf(translate(2));
|
printf(translate(2));
|
||||||
printf(translate(3),argv[0]);
|
printf(translate(3),argv[0]);
|
||||||
printf(translate(4));
|
printf(translate(4));
|
||||||
|
@ -129,7 +125,7 @@ int main(int argc, char *argv[])
|
||||||
if(++i<argc) {
|
if(++i<argc) {
|
||||||
strcpy(sistema,argv[i]);
|
strcpy(sistema,argv[i]);
|
||||||
} else {
|
} else {
|
||||||
printf(translate(12)); // se debe indicar un sistema para --system
|
printf(translate(12)); /* se debe indicar un sistema para --system */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -138,7 +134,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else {
|
else {
|
||||||
printf(translate(13),argv[i]); // parámetro erróneo
|
printf(translate(13),argv[i]); /* parámetro erróneo */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,7 +165,7 @@ int main(int argc, char *argv[])
|
||||||
j=strlen(argv[i])-1;
|
j=strlen(argv[i])-1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf(translate(14)); // se debe indicar un sistema para -s
|
printf(translate(14)); /* se debe indicar un sistema para -s */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -180,7 +176,7 @@ int main(int argc, char *argv[])
|
||||||
exit(0);
|
exit(0);
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
printf(translate(15),argv[i][j]); // parámetro erróneo
|
printf(translate(15),argv[i][j]); /* parámetro erróneo */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
j++;
|
j++;
|
||||||
|
@ -197,13 +193,13 @@ int main(int argc, char *argv[])
|
||||||
hayprog=2;
|
hayprog=2;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf(translate(13),argv[i]); // parámetro erróneo
|
printf(translate(13),argv[i]); /* parámetro erróneo */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hayprog==0) {
|
if(hayprog==0) {
|
||||||
printf(translate(16)); // no se ha especificado un archivo
|
printf(translate(16)); /* no se ha especificado un archivo */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,30 +218,28 @@ int main(int argc, char *argv[])
|
||||||
strcpy(fichero_prg,nombreprog);
|
strcpy(fichero_prg,nombreprog);
|
||||||
strcat(fichero_prg,".PRG");
|
strcat(fichero_prg,".PRG");
|
||||||
if(!(fp = fopen(fichero_prg, "rb"))) {
|
if(!(fp = fopen(fichero_prg, "rb"))) {
|
||||||
printf(translate(17),nombreprog); // error al abrir archivo
|
printf(translate(17),nombreprog); /* error al abrir archivo */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf(translate(17),argv[1]); // error al abrir archivo
|
printf(translate(17),argv[1]); /* error al abrir archivo */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Componemos el nombre del ejecutable
|
/* Componemos el nombre del ejecutable */
|
||||||
if(hayprog<2) {
|
if(hayprog<2) {
|
||||||
strcpy(outfilename,nombreprog);
|
strcpy(outfilename,nombreprog);
|
||||||
if(!strcmp(sistema,"win32"))
|
if(!strcmp(sistema,"win32"))
|
||||||
strcat(outfilename,".exe");
|
strcat(outfilename,".exe");
|
||||||
}
|
}
|
||||||
|
|
||||||
printf(translate(18),fichero_prg); // compilando...
|
printf(translate(18),fichero_prg); /* compilando... */
|
||||||
|
|
||||||
/*fichero_prg=(char*)e_malloc(strlen(argv[1])+1);
|
|
||||||
strcpy(fichero_prg,argv[1]); // fichero_prg="xxxxx.prg"*/
|
|
||||||
|
|
||||||
// mete el PRG en el buffer prog
|
/* mete el PRG en el buffer prog */
|
||||||
fseek(fp,0,SEEK_END);
|
fseek(fp,0,SEEK_END);
|
||||||
progsize=ftell(fp);
|
progsize=ftell(fp);
|
||||||
prog = (char *)e_malloc(progsize+1);
|
prog = (char *)e_malloc(progsize+1);
|
||||||
|
@ -257,7 +251,7 @@ int main(int argc, char *argv[])
|
||||||
} while(!feof(fp));
|
} while(!feof(fp));
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
// Comprueba si existe la edivrun.lib
|
/* Comprueba si existe la edivrun.lib */
|
||||||
if(!noexe) {
|
if(!noexe) {
|
||||||
strcpy(edivrun_lib,sistema);
|
strcpy(edivrun_lib,sistema);
|
||||||
if(debug)
|
if(debug)
|
||||||
|
@ -266,13 +260,13 @@ int main(int argc, char *argv[])
|
||||||
strcat(edivrun_lib,".rel");
|
strcat(edivrun_lib,".rel");
|
||||||
|
|
||||||
if((fp = fopen(edivrun_lib, "rb"))==NULL) {
|
if((fp = fopen(edivrun_lib, "rb"))==NULL) {
|
||||||
printf(translate(19),edivrun_lib); // no se encuentra el fichero
|
printf(translate(19),edivrun_lib); /* no se encuentra el fichero */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fread(libmagic,1,14,fp);
|
fread(libmagic,1,14,fp);
|
||||||
if(strcmp(libmagic,magic)) {
|
if(strcmp(libmagic,magic)) {
|
||||||
printf(translate(20),edivrun_lib); // formato incorrecto de edivrun.lib
|
printf(translate(20),edivrun_lib); /* formato incorrecto de edivrun.lib */
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -286,11 +280,9 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// El stream de salida para el seudocódigo
|
|
||||||
// fout=tmpfile();
|
|
||||||
|
|
||||||
if(!ini) {
|
if(!ini) {
|
||||||
max_process=0; // Valores de las opciones por defecto
|
/* Valores de las opciones por defecto */
|
||||||
|
max_process=0;
|
||||||
ignore_errors=0;
|
ignore_errors=0;
|
||||||
free_sintax=0;
|
free_sintax=0;
|
||||||
extended_conditions=0;
|
extended_conditions=0;
|
||||||
|
@ -322,13 +314,6 @@ int main(int argc, char *argv[])
|
||||||
prepara_compilacion();
|
prepara_compilacion();
|
||||||
dll_func();
|
dll_func();
|
||||||
|
|
||||||
//**************************
|
|
||||||
|
|
||||||
//###############//
|
|
||||||
// NO PONER NADA //
|
|
||||||
//loggea("prg: %s",argv[1]);
|
|
||||||
//@@@@@@@@@@@@@@@//
|
|
||||||
|
|
||||||
compila();
|
compila();
|
||||||
|
|
||||||
#ifdef MULTI_ERROR
|
#ifdef MULTI_ERROR
|
||||||
|
@ -350,7 +335,13 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// idéntico a malloc, pero con errormsg utomático
|
/*
|
||||||
|
* void *e_malloc(size_t size)
|
||||||
|
* Idéntico a malloc, pero con errormsg automático
|
||||||
|
*
|
||||||
|
* Retorna:
|
||||||
|
* El numero de bytes de memoria alojados o sale si no se puede reservar la memoria.
|
||||||
|
*/
|
||||||
void* e_malloc(size_t size)
|
void* e_malloc(size_t size)
|
||||||
{
|
{
|
||||||
void* ret;
|
void* ret;
|
||||||
|
@ -370,14 +361,13 @@ void errormem()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
/*
|
||||||
// Gestión de errores
|
* Gestión de errores
|
||||||
//-----------------------------------------------------------------------------
|
*/
|
||||||
|
|
||||||
int _le,_t;
|
int _le,_t;
|
||||||
byte *_ie;
|
byte *_ie;
|
||||||
|
|
||||||
void save_error(word tipo) { // Guarda una posicion de error (de 0 .. 3)
|
void save_error(word tipo) { /* Guarda una posicion de error (de 0 .. 3) */
|
||||||
switch(tipo) {
|
switch(tipo) {
|
||||||
case 0: _le=linea; _ie=ierror; break;
|
case 0: _le=linea; _ie=ierror; break;
|
||||||
case 1: _le=old_linea; _ie=old_ierror_end; break;
|
case 1: _le=old_linea; _ie=old_ierror_end; break;
|
||||||
|
@ -386,12 +376,13 @@ void save_error(word tipo) { // Guarda una posicion de error (de 0 .. 3)
|
||||||
} _t=tipo;
|
} _t=tipo;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0 - Inicio de la pieza actual
|
/*
|
||||||
// 1 - Final de la pieza anterior mas un espacio (si se puede)
|
* 0 - Inicio de la pieza actual
|
||||||
// 2 - Inicio de la pieza anterior
|
* 1 - Final de la pieza anterior mas un espacio (si se puede)
|
||||||
// 3 - Final de la pieza anterior
|
* 2 - Inicio de la pieza anterior
|
||||||
// 4 - Error guardado con save_error(0..3)
|
* 3 - Final de la pieza anterior
|
||||||
|
* 4 - Error guardado con save_error(0..3)
|
||||||
|
*/
|
||||||
void error(word tipo, word num, ...)
|
void error(word tipo, word num, ...)
|
||||||
{
|
{
|
||||||
int columna=0;
|
int columna=0;
|
||||||
|
@ -440,8 +431,6 @@ void error(word tipo, word num, ...)
|
||||||
#ifdef MULTI_ERROR
|
#ifdef MULTI_ERROR
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//lexico();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void warning(int num, ...)
|
void warning(int num, ...)
|
||||||
|
@ -455,7 +444,9 @@ void warning(int num, ...)
|
||||||
n_warnings++;
|
n_warnings++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#define DEBUG_HTTP
|
/* Descomentar la siguiente linea para activar el debug de las noticias: */
|
||||||
|
/* #define DEBUG_HTTP */
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
void muestra_motd()
|
void muestra_motd()
|
||||||
{
|
{
|
||||||
|
@ -466,14 +457,14 @@ void muestra_motd()
|
||||||
motdserver=iniparser_getstr(ini,"general:motd_host");
|
motdserver=iniparser_getstr(ini,"general:motd_host");
|
||||||
motdpath=iniparser_getstr(ini,"general:motd_path");
|
motdpath=iniparser_getstr(ini,"general:motd_path");
|
||||||
if(!motdserver) {
|
if(!motdserver) {
|
||||||
printf(translate(49)); // el servidor de motd debe estar en ediv.cfg
|
printf(translate(49)); /* el servidor de motd debe estar en ediv.cfg */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if(!motdpath) motdpath="/ediv/actual/motd.txt";
|
if(!motdpath) motdpath="/ediv/actual/motd.txt";
|
||||||
conecta(motdserver,motdpath);
|
conecta(motdserver,motdpath);
|
||||||
exit(0);
|
exit(0);
|
||||||
} else {
|
} else {
|
||||||
printf(translate(49)); // el servidor de motd debe estar en ediv.cfg
|
printf(translate(49)); /* el servidor de motd debe estar en ediv.cfg */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -522,7 +513,6 @@ void conecta(char *servidor, char *archivo)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//sprintf(buffer,"GET /%s\n",archivo);
|
|
||||||
sprintf(buffer,"GET %s HTTP/1.1\n"
|
sprintf(buffer,"GET %s HTTP/1.1\n"
|
||||||
"User-Agent: Mozilla/4.76 (Windows 2000; U) Opera 5.12 [es]\n"
|
"User-Agent: Mozilla/4.76 (Windows 2000; U) Opera 5.12 [es]\n"
|
||||||
"Host: %s\n"
|
"Host: %s\n"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* eDiv Compiler
|
* eDiv Compiler
|
||||||
* Copyleft (C) 2000-2002 Sion Entertainment
|
* Copyright (C) 2000-2002 Sion Entertainment
|
||||||
* http://www.sion-e.com
|
* http://www.sionhq.com
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -31,7 +31,6 @@
|
||||||
|
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
|
|
||||||
//int len,ret,cod;
|
|
||||||
int len;
|
int len;
|
||||||
struct objeto * ob;
|
struct objeto * ob;
|
||||||
struct objeto * ob2;
|
struct objeto * ob2;
|
||||||
|
@ -39,12 +38,11 @@ struct objeto * ob2;
|
||||||
int creaobj;
|
int creaobj;
|
||||||
int numparams;
|
int numparams;
|
||||||
|
|
||||||
byte decl_struct=0; // 1 si se está declarando un struct
|
byte decl_struct=0; /* 1 si se está declarando un struct */
|
||||||
byte struct_reserved=0; // 1 si se está declarando la estructura reserved
|
byte struct_reserved=0; /* 1 si se está declarando la estructura reserved */
|
||||||
|
|
||||||
|
|
||||||
// Errores específicos en la ejecución de una DLL
|
/* Errores específicos en la ejecución de una DLL */
|
||||||
|
|
||||||
void dll_error(int error, ...)
|
void dll_error(int error, ...)
|
||||||
{
|
{
|
||||||
va_list opparam;
|
va_list opparam;
|
||||||
|
@ -95,21 +93,6 @@ int EDIV_Export(char* cadena, int nparam, void* hfuncion)
|
||||||
(*ob).fext.codigo=n_externs;
|
(*ob).fext.codigo=n_externs;
|
||||||
(*ob).fext.num_par=nparam;
|
(*ob).fext.num_par=nparam;
|
||||||
|
|
||||||
/* for(i=0;i<numdlls;i++)
|
|
||||||
for(j=0;j<dlls[i].nfuncs;j++)
|
|
||||||
if(strcmp(cadena,dlls[i].ext_funcs[j].cadena)==0) {
|
|
||||||
dll_error(4,cadena);
|
|
||||||
return 0;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*#define actfunc dlls[numdlls-1].ext_funcs[dlls[numdlls-1].nfuncs]
|
|
||||||
|
|
||||||
actfunc.cadena=(char*)e_malloc(strlen(cadena)+1);
|
|
||||||
strcpy(actfunc.cadena,cadena);
|
|
||||||
actfunc.nparam = nparam;
|
|
||||||
actfunc.hfuncion = hfuncion;*/
|
|
||||||
|
|
||||||
// dlls[numdlls-1].nfuncs++;
|
|
||||||
n_externs++;
|
n_externs++;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -243,7 +226,7 @@ int EDIV_Export_Global_Tab(char* cadena, int numregs)
|
||||||
(*ob).tglo.len3=-1;
|
(*ob).tglo.len3=-1;
|
||||||
(*ob).tglo.totalen=len+1;
|
(*ob).tglo.totalen=len+1;
|
||||||
|
|
||||||
// Inicializamos la tabla a 0
|
/* Inicializamos la tabla a 0 */
|
||||||
do {
|
do {
|
||||||
mem[imem++]=0;
|
mem[imem++]=0;
|
||||||
} while (len--);
|
} while (len--);
|
||||||
|
@ -325,14 +308,14 @@ int EDIV_Export_Member_Int(char* cadena, int valor)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((*ob).tipo==tsglo) { // int miembro de struct global
|
if((*ob).tipo==tsglo) { /* int miembro de struct global */
|
||||||
(*ob2).tipo=tvglo;
|
(*ob2).tipo=tvglo;
|
||||||
(*ob2).vglo.offset=len++;
|
(*ob2).vglo.offset=len++;
|
||||||
mem[imem]=valor;
|
mem[imem]=valor;
|
||||||
(*ob).sglo.len_item++;
|
(*ob).sglo.len_item++;
|
||||||
return imem++;
|
return imem++;
|
||||||
}
|
}
|
||||||
else { // int miembro de struct local
|
else { /* int miembro de struct local */
|
||||||
if(struct_reserved)
|
if(struct_reserved)
|
||||||
indexa_variable(v_reserved,cadena,iloc);
|
indexa_variable(v_reserved,cadena,iloc);
|
||||||
(*ob2).tipo=tvloc;
|
(*ob2).tipo=tvloc;
|
||||||
|
@ -372,7 +355,7 @@ int EDIV_Export_Member_Str(char* cadena, int tamano)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((*ob).tipo==tsglo) { // string miembro de struct global
|
if((*ob).tipo==tsglo) { /* string miembro de struct global */
|
||||||
|
|
||||||
(*ob2).tipo=tcglo;
|
(*ob2).tipo=tcglo;
|
||||||
(*ob2).cglo.offset=len+1;
|
(*ob2).cglo.offset=len+1;
|
||||||
|
@ -394,7 +377,7 @@ int EDIV_Export_Member_Str(char* cadena, int tamano)
|
||||||
|
|
||||||
return (*ob2).cglo.offset;
|
return (*ob2).cglo.offset;
|
||||||
}
|
}
|
||||||
else { // string miembro de struct local
|
else { /* string miembro de struct local */
|
||||||
|
|
||||||
(*ob2).tipo=tcloc;
|
(*ob2).tipo=tcloc;
|
||||||
(*ob2).cloc.offset=len+1;
|
(*ob2).cloc.offset=len+1;
|
||||||
|
@ -447,7 +430,7 @@ int EDIV_Export_Member_Tab(char* cadena, int numregs)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((*ob).tipo==tsglo) { // array miembro de struct global
|
if((*ob).tipo==tsglo) { /* array miembro de struct global */
|
||||||
(*ob2).tipo=ttglo;
|
(*ob2).tipo=ttglo;
|
||||||
(*ob2).tglo.offset=len;
|
(*ob2).tglo.offset=len;
|
||||||
(*ob2).tglo.len1=numregs;
|
(*ob2).tglo.len1=numregs;
|
||||||
|
@ -461,7 +444,7 @@ int EDIV_Export_Member_Tab(char* cadena, int numregs)
|
||||||
|
|
||||||
return (*ob2).tglo.offset;
|
return (*ob2).tglo.offset;
|
||||||
}
|
}
|
||||||
else { // array miembro de struct local
|
else { /* array miembro de struct local */
|
||||||
if(struct_reserved)
|
if(struct_reserved)
|
||||||
indexa_variable(v_reserved,cadena,iloc);
|
indexa_variable(v_reserved,cadena,iloc);
|
||||||
(*ob2).tipo=ttloc;
|
(*ob2).tipo=ttloc;
|
||||||
|
@ -493,7 +476,7 @@ int EDIV_Export_EndStruct()
|
||||||
|
|
||||||
member=NULL;
|
member=NULL;
|
||||||
|
|
||||||
if((*ob).tipo==tsglo) { // cierra estructura global
|
if((*ob).tipo==tsglo) { /* cierra estructura global */
|
||||||
if ((*ob).sglo.len_item==0) {
|
if ((*ob).sglo.len_item==0) {
|
||||||
dll_error(10);
|
dll_error(10);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -506,7 +489,7 @@ int EDIV_Export_EndStruct()
|
||||||
} while (len--);
|
} while (len--);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { // cierra estructura local
|
else { /* cierra estructura local */
|
||||||
if ((*ob).sloc.len_item==0) {
|
if ((*ob).sloc.len_item==0) {
|
||||||
dll_error(10);
|
dll_error(10);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -518,7 +501,6 @@ int EDIV_Export_EndStruct()
|
||||||
iloc++;
|
iloc++;
|
||||||
} while (len--);
|
} while (len--);
|
||||||
}
|
}
|
||||||
// iloc+=(*ob).sloc.totalitems*(*ob).sloc.len_item;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
decl_struct=0;
|
decl_struct=0;
|
||||||
|
@ -603,7 +585,7 @@ int EDIV_Export_Local_Tab(char* cadena, int numregs)
|
||||||
(*ob).tloc.len3=-1;
|
(*ob).tloc.len3=-1;
|
||||||
(*ob).tloc.totalen=len+1;
|
(*ob).tloc.totalen=len+1;
|
||||||
|
|
||||||
// Inicializamos la tabla a 0
|
/* Inicializamos la tabla a 0 */
|
||||||
do {
|
do {
|
||||||
loc[iloc++]=0;
|
loc[iloc++]=0;
|
||||||
} while (len--);
|
} while (len--);
|
||||||
|
|
Loading…
Reference in a new issue