Cambios de free/malloc por e_free/e_malloc, comentarizacion, sigue la compilacion aunque no haya librerias.
This commit is contained in:
parent
21f8a2c6d8
commit
ed64cc6c89
|
@ -1,3 +1,12 @@
|
|||
20/10/2002
|
||||
----------
|
||||
* Ahora si no hay archivos .dll o .so solo muestra el mensaje de error, pero NO
|
||||
sale de la compilacion (Daijo)
|
||||
* Cambio todos los free/malloc de dll_load.c por e_free y e_malloc (Daijo)
|
||||
* Cambio todos los free de los archivos que quedaban por e_free (Daijo)
|
||||
* Mas comentarizacion (Daijo)
|
||||
|
||||
|
||||
19/10/2002
|
||||
----------
|
||||
* Añado la rutina e_free() en ediv.c. Se encarga de comprobar si hay un puntero
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* eDiv Compiler
|
||||
* Copyright (C) 2000-2002 Sion Entertainment
|
||||
* Copyright (C) 2000-2002 Sion, Ltd.
|
||||
* http://www.sionhq.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* eDiv Compiler
|
||||
* Copyright (C) 2000-2002 Sion Entertainment
|
||||
* Copyright (C) 2000-2002 Sion, Ltd.
|
||||
* http://www.sionhq.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
|
@ -93,7 +93,7 @@ void KillDLLLoad(void)
|
|||
cur=g_pImageParamHead;
|
||||
while(cur!=NULL) {
|
||||
next=cur->next;
|
||||
free(cur);
|
||||
e_free(cur);
|
||||
cur=next;
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ static int AddDLLReference(void *pImageBase, char *svName, DWORD dwFlags)
|
|||
}
|
||||
|
||||
// Add new dll to list
|
||||
cur=(IMAGE_PARAMETERS *)malloc(sizeof(IMAGE_PARAMETERS));
|
||||
cur=(IMAGE_PARAMETERS *)e_malloc(sizeof(IMAGE_PARAMETERS));
|
||||
if(cur==NULL) {
|
||||
LeaveCriticalSection(&g_DLLCrit);
|
||||
return -1;
|
||||
|
@ -171,10 +171,10 @@ static int RemoveDLLReference(void *pImageBase, char *svName, DWORD *pdwFlags)
|
|||
if(cur->nLockCount==0) {
|
||||
if(prev==NULL) {
|
||||
g_pImageParamHead=g_pImageParamHead->next;
|
||||
free(cur);
|
||||
e_free(cur);
|
||||
} else {
|
||||
prev->next=cur->next;
|
||||
free(cur);
|
||||
e_free(cur);
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&g_DLLCrit);
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
The author of this program may be contacted at dildog@l0pht.com. */
|
||||
The author of this program may be contacted at dildog@l0pht.com.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* eDiv Compiler
|
||||
* Copyright (C) 2000-2002 Sion Entertainment
|
||||
* Copyright (C) 2000-2002 Sion, Ltd.
|
||||
* http://www.sionhq.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* eDiv Compiler
|
||||
* Copyright (C) 2000-2002 Sion Entertainment
|
||||
* Copyright (C) 2000-2002 Sion, Ltd.
|
||||
* http://www.sionhq.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* eDiv Compiler
|
||||
* Copyright (C) 2000-2002 Sion Entertainment
|
||||
* Copyright (C) 2000-2002 Sion, Ltd.
|
||||
* http://www.sionhq.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -115,7 +115,7 @@ void _encriptar(int encode, char * fichero, char * clave)
|
|||
fclose(f);
|
||||
} else {
|
||||
fclose(f);
|
||||
free(ptr);
|
||||
e_free(ptr);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
@ -147,7 +147,7 @@ void _encriptar(int encode, char * fichero, char * clave)
|
|||
|
||||
|
||||
if ((f=fopen("temp.dj!","wb"))==NULL) {
|
||||
free(ptr);
|
||||
e_free(ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -155,18 +155,18 @@ void _encriptar(int encode, char * fichero, char * clave)
|
|||
if(fwrite(magic,1,14,f)!=14) {
|
||||
fclose(f);
|
||||
remove(fichero);
|
||||
rename("temp.dj!",fichero); free(ptr); return;
|
||||
rename("temp.dj!",fichero); e_free(ptr); return;
|
||||
}
|
||||
}
|
||||
|
||||
if(fwrite(p,1,size,f)!=(unsigned int)size) {
|
||||
fclose(f);
|
||||
free(ptr); return;
|
||||
e_free(ptr); return;
|
||||
}
|
||||
|
||||
/* Si todo ha ido bien ... */
|
||||
fclose(f);
|
||||
free(ptr);
|
||||
e_free(ptr);
|
||||
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ void _comprimir(int encode, char *fichero) {
|
|||
fclose(f);
|
||||
} else {
|
||||
fclose(f);
|
||||
free(ptr);
|
||||
e_free(ptr);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
@ -203,20 +203,20 @@ void _comprimir(int encode, char *fichero) {
|
|||
size2=size+size/100+256;
|
||||
|
||||
if ((ptr_dest=(byte *)malloc(size2))==NULL) {
|
||||
free(ptr);
|
||||
e_free(ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (compress(ptr_dest, &size2, ptr, size)) {
|
||||
free(ptr_dest);
|
||||
free(ptr);
|
||||
e_free(ptr_dest);
|
||||
e_free(ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Si no se gana espacio, se deja el fichero sin comprimir */
|
||||
if (size2>=size-12) {
|
||||
free(ptr_dest);
|
||||
free(ptr);
|
||||
e_free(ptr_dest);
|
||||
e_free(ptr);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
@ -226,29 +226,29 @@ void _comprimir(int encode, char *fichero) {
|
|||
size2=*(int*)(ptr+8);
|
||||
|
||||
if ((ptr_dest=(byte *)malloc(size2))==NULL) {
|
||||
free(ptr);
|
||||
e_free(ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (uncompress(ptr_dest, &size2, ptr+12, size-12)) {
|
||||
free(ptr_dest);
|
||||
free(ptr);
|
||||
e_free(ptr_dest);
|
||||
e_free(ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
size2=*(int*)(ptr+8);
|
||||
}
|
||||
|
||||
free(ptr);
|
||||
e_free(ptr);
|
||||
|
||||
if (rename(fichero,"temp.ZX!")) {
|
||||
free(ptr_dest);
|
||||
e_free(ptr_dest);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((f=fopen(fichero,"wb"))==NULL) {
|
||||
rename("temp.ZX!",fichero);
|
||||
free(ptr_dest);
|
||||
e_free(ptr_dest);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,7 @@ void _comprimir(int encode, char *fichero) {
|
|||
fclose(f);
|
||||
remove(fichero);
|
||||
rename("temp.ZX!",fichero);
|
||||
free(ptr_dest);
|
||||
e_free(ptr_dest);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -266,7 +266,7 @@ void _comprimir(int encode, char *fichero) {
|
|||
fclose(f);
|
||||
remove(fichero);
|
||||
rename("temp.ZX!",fichero);
|
||||
free(ptr_dest);
|
||||
e_free(ptr_dest);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -275,12 +275,12 @@ void _comprimir(int encode, char *fichero) {
|
|||
fclose(f);
|
||||
remove(fichero);
|
||||
rename("temp.ZX!",fichero);
|
||||
free(ptr_dest);
|
||||
e_free(ptr_dest);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Si todo ha ido bien ... */
|
||||
fclose(f);
|
||||
free(ptr_dest);
|
||||
e_free(ptr_dest);
|
||||
remove("temp.ZX!");
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* eDiv Compiler
|
||||
* Copyleft (C) 2000-2002 Sion Entertainment
|
||||
* http://www.sion-e.com
|
||||
* Copyright (C) 2000-2002 Sion, Ltd.
|
||||
* http://www.sionhq.com
|
||||
*
|
||||
* 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
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
/*
|
||||
* eDiv Compiler
|
||||
* Copyright (C) 2000-2002 Sion, Ltd.
|
||||
* http://www.sionhq.com
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __EXPRESION_H
|
||||
#define __EXPRESION_H
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* eDiv Compiler
|
||||
* Copyleft (C) 2000-2002 Sion Entertainment
|
||||
* http://www.sion-e.com
|
||||
* Copyright (C) 2000-2002 Sion, Ltd.
|
||||
* http://www.sionhq.com
|
||||
*
|
||||
* 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
|
||||
|
@ -38,12 +38,12 @@ int detecta_idioma_iso(char* lang)
|
|||
{
|
||||
int i;
|
||||
static char getid[NUM_LANGUAGES][3] = {
|
||||
"es", // español
|
||||
"it", // italiano
|
||||
"pt", // portugués
|
||||
"en", // inglés
|
||||
"ca", // catalán
|
||||
"eu" // euskera
|
||||
"es", /* español */
|
||||
"it", /* italiano */
|
||||
"pt", /* portugués */
|
||||
"en", /* inglés */
|
||||
"ca", /* catalán */
|
||||
"eu" /* euskera */
|
||||
};
|
||||
if(lang==NULL) return DEFAULT_LANGUAGE;
|
||||
if(strlen(lang)>2) lang[2]=0;
|
||||
|
@ -65,12 +65,12 @@ int detecta_idioma()
|
|||
#ifdef _WIN32
|
||||
int i;
|
||||
static int getid[NUM_LANGUAGES] = {
|
||||
0x0a, // español
|
||||
0x10, // italiano
|
||||
0x16, // portugués
|
||||
0x09, // inglés
|
||||
0x03, // catalán
|
||||
0x2d // euskera
|
||||
0x0a, /* español */
|
||||
0x10, /* italiano */
|
||||
0x16, /* portugués */
|
||||
0x09, /* inglés */
|
||||
0x03, /* catalán */
|
||||
0x2d /* euskera */
|
||||
};
|
||||
LANGID lang;
|
||||
|
||||
|
@ -155,9 +155,9 @@ char* translate_error(int num)
|
|||
/* 56 */ "Esperando BEGIN",
|
||||
/* 57 */ "Esperando END",
|
||||
/* 58 */ "Esperando UNTIL",
|
||||
/* 59 */ "Esperando una variable", // (para el FROM)
|
||||
/* 59 */ "Esperando una variable", /* (para el FROM) */
|
||||
/* 60 */ "Esperando TO",
|
||||
/* 61 */ "Sentencia FROM incorrecta", // (from==to)
|
||||
/* 61 */ "Sentencia FROM incorrecta", /* (from==to) */
|
||||
/* 62 */ "El valor STEP no es válido",
|
||||
/* 63 */ "Esperando CASE, DEFAULT o END",
|
||||
/* 64 */ "Esperando ':'",
|
||||
|
@ -232,9 +232,9 @@ char* translate_error(int num)
|
|||
/* 56 */ "Aspettando BEGIN",
|
||||
/* 57 */ "Aspettando END",
|
||||
/* 58 */ "Aspettando UNTIL",
|
||||
/* 59 */ "Aspettando una variabile", // (para el FROM)
|
||||
/* 59 */ "Aspettando una variabile",
|
||||
/* 60 */ "Aspettando TO",
|
||||
/* 61 */ "Sentenza FROM incorretta", // (from==to)
|
||||
/* 61 */ "Sentenza FROM incorretta",
|
||||
/* 62 */ "Il valore STEP non è valido",
|
||||
/* 63 */ "Aspettando CASE, DEFAULT o END",
|
||||
/* 64 */ "Aspettando ':'",
|
||||
|
@ -309,9 +309,9 @@ char* translate_error(int num)
|
|||
/* 56 */ "Esperando BEGIN",
|
||||
/* 57 */ "Esperando END",
|
||||
/* 58 */ "Esperando UNTIL",
|
||||
/* 59 */ "Esperando uma variable", // (para el FROM)
|
||||
/* 59 */ "Esperando uma variable",
|
||||
/* 60 */ "Esperando TO",
|
||||
/* 61 */ "Sentença FROM incorrecta", // (from==to)
|
||||
/* 61 */ "Sentença FROM incorrecta",
|
||||
/* 62 */ "O valor STEP não é válido",
|
||||
/* 63 */ "Esperando CASE, DEFAULT ou END",
|
||||
/* 64 */ "Esperando ':'",
|
||||
|
@ -386,9 +386,9 @@ char* translate_error(int num)
|
|||
/* 56 */ "Expecting BEGIN",
|
||||
/* 57 */ "Expecting END",
|
||||
/* 58 */ "Expecting UNTIL",
|
||||
/* 59 */ "Expecting variable", // (para el FROM)
|
||||
/* 59 */ "Expecting variable",
|
||||
/* 60 */ "Expecting TO",
|
||||
/* 61 */ "Incorrect FROM statement", // (from==to)
|
||||
/* 61 */ "Incorrect FROM statement",
|
||||
/* 62 */ "Incorrect STEP value",
|
||||
/* 63 */ "Expecting CASE, DEFAULT or END",
|
||||
/* 64 */ "Expecting ':'",
|
||||
|
@ -463,9 +463,9 @@ char* translate_error(int num)
|
|||
/* 56 */ "Esperant BEGIN",
|
||||
/* 57 */ "Esperant END",
|
||||
/* 58 */ "Esperant UNTIL",
|
||||
/* 59 */ "Esperant una variable", // (per al FROM)
|
||||
/* 59 */ "Esperant una variable",
|
||||
/* 60 */ "Esperant TO",
|
||||
/* 61 */ "Sentència FROM incorrecta", // (from==to)
|
||||
/* 61 */ "Sentència FROM incorrecta",
|
||||
/* 62 */ "El valor STEP no es vàlid",
|
||||
/* 63 */ "Esperant CASE, DEFAULT o END",
|
||||
/* 64 */ "Esperant ':'",
|
||||
|
@ -540,9 +540,9 @@ char* translate_error(int num)
|
|||
/* 56 */ "BEGIN-en zai...",
|
||||
/* 57 */ "END-en zai...",
|
||||
/* 58 */ "UNTIL-en zai..",
|
||||
/* 59 */ "Aldagai baten zai...", // (para el FROM)
|
||||
/* 59 */ "Aldagai baten zai...",
|
||||
/* 60 */ "TO-ren zai...",
|
||||
/* 61 */ "Okerreko FROM Sententzia", // (from==to)
|
||||
/* 61 */ "Okerreko FROM Sententzia",
|
||||
/* 62 */ "Okerreko STEP balioa",
|
||||
/* 63 */ "CASE, DEFAULT edo END-en zai...",
|
||||
/* 64 */ "':'-ren zai...",
|
||||
|
@ -754,7 +754,7 @@ char* translate(int id_cadena)
|
|||
{
|
||||
switch(idioma) {
|
||||
|
||||
case 0: // español
|
||||
case 0: /* español */
|
||||
{
|
||||
static char* msg[] = {
|
||||
/* 0 */ " **** Compilador eDIV " VERSION " ****\nCopyleft (c) 2000-2002 Sion, Ltd.\nhttp://www.edivcentral.com\n",
|
||||
|
@ -822,7 +822,7 @@ char* translate(int id_cadena)
|
|||
return msg[id_cadena];
|
||||
}
|
||||
|
||||
case 1: // italiano
|
||||
case 1: /* italiano */
|
||||
{
|
||||
static char* msg[] = {
|
||||
/* 0 */ " **** Compilatore eDIV " VERSION " ****\nCopyleft (c) 2000-2002 Sion, Ltd.\nhttp://www.edivcentral.com\n",
|
||||
|
@ -890,7 +890,7 @@ char* translate(int id_cadena)
|
|||
return msg[id_cadena];
|
||||
}
|
||||
|
||||
case 2: // portugués
|
||||
case 2: /* portugués */
|
||||
{
|
||||
static char* msg[] = {
|
||||
/* 0 */ " **** Compilador eDIV " VERSION " ****\nCopyleft (c) 2000-2002 Sion, Ltd.\nhttp://www.edivcentral.com\n",
|
||||
|
@ -952,7 +952,7 @@ char* translate(int id_cadena)
|
|||
/* 47 */ "Não se encontra ExportaFuncs em %s - Biblioteca invalida (%s)\n",
|
||||
#endif
|
||||
|
||||
// FIXME: revisar/traducir esto
|
||||
/* FIXME: revisar/traducir esto */
|
||||
/* 48 */ " -n, --news Mostra a última notícia de eDivCentral.com e sai\n",
|
||||
/* 49 */ "Error: no se ha configurado un servidor de noticias en ediv.cfg\n",
|
||||
/* 50 */ "Error: el fichero recibido no es del tipo esperado\n"
|
||||
|
@ -960,7 +960,7 @@ char* translate(int id_cadena)
|
|||
return msg[id_cadena];
|
||||
}
|
||||
|
||||
case 3: // inglés
|
||||
case 3: /* inglés */
|
||||
{
|
||||
static char* msg[] = {
|
||||
/* 0 */ " **** eDIV Compiler " VERSION " ****\nCopyleft (c) 2000-2002Sion, Ltd.\nhttp://www.edivcentral.com\n",
|
||||
|
@ -1028,7 +1028,7 @@ char* translate(int id_cadena)
|
|||
return msg[id_cadena];
|
||||
}
|
||||
|
||||
case 4: // catalán
|
||||
case 4: /* catalán */
|
||||
{
|
||||
static char* msg[] = {
|
||||
/* 0 */ " **** Compilador eDIV " VERSION " ****\nCopyleft (c) 2000-2002 Sion, Ltd.\nhttp://www.edivcentral.com\n",
|
||||
|
@ -1095,7 +1095,7 @@ char* translate(int id_cadena)
|
|||
};
|
||||
return msg[id_cadena];
|
||||
}
|
||||
case 5: // euskera
|
||||
case 5: /* euskera */
|
||||
{
|
||||
static char* msg[] = {
|
||||
/* 0 */ " **** eDIV konpiladorea " VERSION " ****\nCopyleft (c) 2000-2002 Sion, Ltd.\nhttp://www.edivcentral.com\n",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* eDiv Compiler
|
||||
* Copyleft (C) 2000-2002 Sion Entertainment
|
||||
* http://www.sion-e.com
|
||||
* Copyright (C) 2000-2002 Sion, Ltd.
|
||||
* http://www.sionhq.com
|
||||
*
|
||||
* 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
|
||||
|
@ -27,9 +27,9 @@
|
|||
|
||||
#include "language.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Graba el fichero de la tabla de objetos
|
||||
//-----------------------------------------------------------------------------
|
||||
/*
|
||||
* Graba el fichero de la tabla de objetos
|
||||
*/
|
||||
|
||||
void listado_objetos (void)
|
||||
{
|
||||
|
@ -154,11 +154,6 @@ void listado_objetos (void)
|
|||
fprintf(sta,"\toffset=%u\n",obj[n].proc.offset);
|
||||
fprintf(sta,"\tnum_par=%u\n",obj[n].proc.num_par);
|
||||
break;
|
||||
/* case tfunc: fprintf(sta,"%5u\ttfunc: %s",n,obj[n].name);
|
||||
if (obj[n].usado) fprintf(sta," (*) usado\n"); else fprintf(sta,"\n");
|
||||
fprintf(sta,"\tcodigo=%u\n",obj[n].func.codigo);
|
||||
fprintf(sta,"\tnum_par=%u\n",obj[n].func.num_par);
|
||||
break;*/
|
||||
case tfext: fprintf(sta,"%5u\ttfext: %s",n,obj[n].name);
|
||||
if (obj[n].usado) fprintf(sta," (*) usado\n"); else fprintf(sta,"\n");
|
||||
fprintf(sta,"\tcodigo=%u\n",obj[n].fext.codigo);
|
||||
|
@ -209,10 +204,9 @@ void listado_objetos (void)
|
|||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Graba el fichero ensamblador
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Graba el fichero ensamblador
|
||||
*/
|
||||
void listado_ensamblador (void)
|
||||
{
|
||||
FILE * sta;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* eDiv Compiler
|
||||
* Copyleft (C) 2000-2002 Sion Entertainment
|
||||
* http://www.sion-e.com
|
||||
* Copyright (C) 2000-2002 Sion, Ltd.
|
||||
* http://www.sionhq.com
|
||||
*
|
||||
* 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
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
/* Fenix - Compilador/intérprete de videojuegos
|
||||
* Copyright (C) 1999 José Luis Cebrián Pagüe
|
||||
*
|
||||
* Adaptado a eDiv por Sion Entertainment
|
||||
/* Copyright (C) 1999 José Luis Cebrián Pagüe
|
||||
* Copyright (C) 2000-2002 Sion, Ltd
|
||||
*
|
||||
* 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
|
||||
|
@ -86,12 +84,7 @@ void set_c_lower (const byte * from, const byte * to)
|
|||
|
||||
void inicializa_lower()
|
||||
{
|
||||
|
||||
/* ¡Esto hay que revisarlo bastante!
|
||||
*/
|
||||
|
||||
memset (lower, 0, 256); // es necesario
|
||||
|
||||
memset (lower, 0, 256);
|
||||
set_c_lower ("ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||
"abcdefghijklmnopqrstuvwxyz");
|
||||
set_c_lower ("abcdefghijklmnopqrstuvwxyz",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* eDiv Compiler
|
||||
* Copyleft (C) 2000-2002 Sion Entertainment
|
||||
* http://www.sion-e.com
|
||||
* Copyright (C) 2000-2002 Sion, Ltd.
|
||||
* http://www.sionhq.com
|
||||
*
|
||||
* 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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* eDiv Compiler
|
||||
* Copyleft (C) 2000-2002 Sion Entertainment
|
||||
* http://www.sion-e.com
|
||||
* Copyright (C) 2000-2002 Sion, Ltd.
|
||||
* http://www.sionhq.com
|
||||
*
|
||||
* 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
|
||||
|
@ -18,9 +18,9 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Precarga de las estructuras léxicas, analiza el fichero ltlex.def
|
||||
//-----------------------------------------------------------------------------
|
||||
/*
|
||||
* Precarga de las estructuras léxicas, analiza el fichero ltlex.def
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -43,30 +43,30 @@ void ltlex_error(int error)
|
|||
|
||||
void analiza_ltlex(void){
|
||||
|
||||
byte *_buf, * buf; // Buffer del texto y puntero al carácter actual
|
||||
byte cont=1; // 0 indica final del archivo
|
||||
int len; // Tamaño del archivo
|
||||
struct lex_ele * e; // Puntero al lex_case correspondiente
|
||||
FILE * def; // Stream del fichero
|
||||
byte *_buf, * buf; /* Buffer del texto y puntero al carácter actual */
|
||||
byte cont=1; /* 0 indica final del archivo */
|
||||
int len; /* Tamaño del archivo */
|
||||
struct lex_ele * e; /* Puntero al lex_case correspondiente */
|
||||
FILE * def; /* Stream del fichero */
|
||||
|
||||
int t; //token (pieza)
|
||||
byte h; //hash (para id)
|
||||
int t; /* token (pieza) */
|
||||
byte h; /* hash (para id) */
|
||||
byte * _ivnom;
|
||||
byte * * ptr;
|
||||
|
||||
// Busca el archivo ltlex.def
|
||||
/* Busca el archivo ltlex.def */
|
||||
if ((def=fopen("system/ltlex.def","rb"))==NULL)
|
||||
ltlex_error(1);
|
||||
|
||||
// Lo lee
|
||||
/* Lo lee */
|
||||
fseek(def,0,SEEK_END);
|
||||
len=ftell(def);
|
||||
_buf=buf=(byte *) e_malloc(len+1);
|
||||
fseek(def,0,SEEK_SET);
|
||||
len=fread(buf,1,len,def);
|
||||
|
||||
// El carácter ASCII 0 indica final del fichero
|
||||
*(buf+len)=0;// *(buf+len+1)=cr;
|
||||
/* El carácter ASCII 0 indica final del fichero */
|
||||
*(buf+len)=0;
|
||||
|
||||
#ifdef _DEBUG
|
||||
printf("dbg: tamano ltlex: %d\n",len);
|
||||
|
@ -75,82 +75,72 @@ void analiza_ltlex(void){
|
|||
linea=1;
|
||||
|
||||
do {
|
||||
/* printf("- %d\n",linea);
|
||||
if(linea==45)
|
||||
printf("heyp\n");*/
|
||||
|
||||
switch (*buf++) {
|
||||
|
||||
// Fin de fichero
|
||||
case 0:
|
||||
cont=0; break;
|
||||
|
||||
// Ignoramos los espacios
|
||||
case ' ': case tab:
|
||||
break;
|
||||
|
||||
// Salta de linea
|
||||
case cr:
|
||||
if(*buf==lf) buf++;
|
||||
|
||||
case lf:
|
||||
linea++;
|
||||
break;
|
||||
|
||||
// Los ; indican línea de comentario
|
||||
case ';':
|
||||
while (*buf!=cr && *buf!=lf) buf++; break;
|
||||
|
||||
// El símbolo & indica definición de token
|
||||
case '&':
|
||||
*buf=lower[*buf];
|
||||
if (*buf>='0' && *buf<='9')
|
||||
t=(*buf++-'0')<<4;
|
||||
else
|
||||
if (*buf>='a' && *buf<='f')
|
||||
t=(*buf++-'a'+10)<<4;
|
||||
else
|
||||
ltlex_error(2);
|
||||
*buf=lower[*buf];
|
||||
if (*buf>='0' && *buf<='9')
|
||||
t+=(*buf++-'0');
|
||||
else
|
||||
if (*buf>='a' && *buf<='f')
|
||||
t+=(*buf++-'a'+10);
|
||||
else
|
||||
ltlex_error(2);
|
||||
if (*buf==cr || *buf==lf || *buf==' ' || *buf==tab) break;
|
||||
else if (lower[*buf]) { //Analiza una palabra reservada
|
||||
_ivnom=ivnom.b; *ivnom.p++=0; *ivnom.p++=(unsigned char*)t; h=0;
|
||||
while ((*ivnom.b=lower[*buf++])) h=((byte)(h<<1)+(h>>7))^(*ivnom.b++);
|
||||
ptr=&vhash[h]; while (*ptr) ptr=(unsigned char * *)*ptr; *ptr=_ivnom;
|
||||
buf--; ivnom.b++;
|
||||
} else if (t>=0x78 && t<=0x7b) { //Analiza un delimitador de literal
|
||||
lex_case[*buf]=(struct lex_ele*)l_lit;
|
||||
} else { //Analiza un nuevo símbolo
|
||||
if ((e=lex_case[*buf])==0) {
|
||||
if (num_nodos++==max_nodos) ltlex_error(3);
|
||||
e=lex_case[*buf]=ilex_simb++; (*e).caracter=*buf++;
|
||||
} else buf++;
|
||||
while (*buf!=' ' && *buf!=tab && *buf!=cr) {
|
||||
if (lower[*buf]) ltlex_error(4);
|
||||
if ((*e).siguiente==0)
|
||||
if (num_nodos++==max_nodos) ltlex_error(3);
|
||||
else e=(*e).siguiente=ilex_simb++;
|
||||
else {
|
||||
e=(*e).siguiente;
|
||||
while ((*e).caracter!=*buf && (*e).alternativa)
|
||||
e=(*e).alternativa;
|
||||
if ((*e).caracter!=*buf) {
|
||||
switch (*buf++) {
|
||||
/* Fin de fichero */
|
||||
case 0:
|
||||
cont=0; break;
|
||||
/* Ignoramos los espacios */
|
||||
case ' ':
|
||||
case tab:
|
||||
break;
|
||||
/* Salta de linea */
|
||||
case cr:
|
||||
if(*buf==lf) buf++;
|
||||
case lf:
|
||||
linea++;
|
||||
break;
|
||||
/* Los ; indican línea de comentario */
|
||||
case ';':
|
||||
while (*buf!=cr && *buf!=lf) buf++; break;
|
||||
/* El símbolo & indica definición de token */
|
||||
case '&':
|
||||
*buf=lower[*buf];
|
||||
if (*buf>='0' && *buf<='9')
|
||||
t=(*buf++-'0')<<4;
|
||||
else
|
||||
if (*buf>='a' && *buf<='f')
|
||||
t=(*buf++-'a'+10)<<4;
|
||||
else
|
||||
ltlex_error(2);
|
||||
*buf=lower[*buf];
|
||||
if (*buf>='0' && *buf<='9')
|
||||
t+=(*buf++-'0');
|
||||
else
|
||||
if (*buf>='a' && *buf<='f')
|
||||
t+=(*buf++-'a'+10);
|
||||
else
|
||||
ltlex_error(2);
|
||||
if (*buf==cr || *buf==lf || *buf==' ' || *buf==tab) break;
|
||||
else if (lower[*buf]) { /* Analiza una palabra reservada */
|
||||
_ivnom=ivnom.b; *ivnom.p++=0; *ivnom.p++=(unsigned char*)t; h=0;
|
||||
while ((*ivnom.b=lower[*buf++])) h=((byte)(h<<1)+(h>>7))^(*ivnom.b++);
|
||||
ptr=&vhash[h]; while (*ptr) ptr=(unsigned char * *)*ptr; *ptr=_ivnom;
|
||||
buf--; ivnom.b++;
|
||||
} else if (t>=0x78 && t<=0x7b) { /* Analiza un delimitador de literal */
|
||||
lex_case[*buf]=(struct lex_ele*)l_lit;
|
||||
} else { /* Analiza un nuevo símbolo */
|
||||
if ((e=lex_case[*buf])==0) {
|
||||
if (num_nodos++==max_nodos) ltlex_error(3);
|
||||
e=lex_case[*buf]=ilex_simb++; (*e).caracter=*buf++;
|
||||
} else buf++;
|
||||
while (*buf!=' ' && *buf!=tab && *buf!=cr) {
|
||||
if (lower[*buf]) ltlex_error(4);
|
||||
if ((*e).siguiente==0)
|
||||
if (num_nodos++==max_nodos) ltlex_error(3);
|
||||
else e=(*e).alternativa=ilex_simb++;
|
||||
}
|
||||
} (*e).caracter=*buf++;
|
||||
} (*e).token=t;
|
||||
} break;
|
||||
}} while (cont);
|
||||
|
||||
free(_buf); _buf=NULL;
|
||||
fclose(def); def=NULL;
|
||||
else e=(*e).siguiente=ilex_simb++;
|
||||
else {
|
||||
e=(*e).siguiente;
|
||||
while ((*e).caracter!=*buf && (*e).alternativa)
|
||||
e=(*e).alternativa;
|
||||
if ((*e).caracter!=*buf) {
|
||||
if (num_nodos++==max_nodos) ltlex_error(3);
|
||||
else e=(*e).alternativa=ilex_simb++;
|
||||
}
|
||||
} (*e).caracter=*buf++;
|
||||
} (*e).token=t;
|
||||
} break;
|
||||
}} while (cont);
|
||||
|
||||
e_free(_buf); _buf=NULL;
|
||||
fclose(def); def=NULL;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* eDiv Compiler
|
||||
* Copyleft (C) 2000-2002 Sion Entertainment
|
||||
* http://www.sion-e.com
|
||||
* Copyright (C) 2000-2002 Sion, Ltd.
|
||||
* http://www.sionhq.com
|
||||
*
|
||||
* 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
|
||||
|
@ -59,11 +59,11 @@ word error_25; // Para emitir "se esperaba una sentencia"
|
|||
|
||||
// Prototipos
|
||||
|
||||
void * e_malloc(size_t size); // un malloc con mensaje de error
|
||||
void *e_malloc(size_t size); // un malloc con mensaje de error
|
||||
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
|
||||
//void c_error(int num);
|
||||
|
||||
#endif // __MAIN_H
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* eDiv Compiler
|
||||
* Copyleft (C) 2000-2002 Sion Entertainment
|
||||
* http://www.sion-e.com
|
||||
* Copyright (C) 2000-2002 Sion, Ltd.
|
||||
* http://www.sionhq.com
|
||||
*
|
||||
* 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
|
||||
|
@ -38,103 +38,7 @@
|
|||
int imem_temp;
|
||||
int iloc_temp;
|
||||
|
||||
#ifdef MODULOS2
|
||||
_listamodulos *Buscar (char *nombre)
|
||||
{
|
||||
if (ListaModulos) {
|
||||
_listamodulos *tmp = ListaModulos;
|
||||
while (tmp->anterior)
|
||||
tmp = tmp->anterior;
|
||||
while (tmp) {
|
||||
if (tmp->modulo)
|
||||
if (!_strcmpi(tmp->modulo->NombreModulo, nombre))
|
||||
return tmp;
|
||||
if (tmp->siguiente)
|
||||
tmp = tmp->siguiente;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
int Cargar (char *NombreArchivo)
|
||||
{
|
||||
dlHandler Manejador;
|
||||
char *NombreModulo;
|
||||
Log.Log ("Cargando %s:", NombreArchivo);
|
||||
Manejador = dlopen (NombreArchivo, RTLD_GLOBAL | RTLD_NOW);
|
||||
if (!Manejador)
|
||||
{
|
||||
Log.Log ("%s", UltimoErrorDL = dlerror ());
|
||||
return CMOD_ERROR_DLOPEN;
|
||||
}
|
||||
else if (!(NombreModulo = (char *) dlsym (Manejador, "NombreModulo")))
|
||||
{
|
||||
Log.Log ("No se pudo encontrar el símbolo \"NombreModulo\"");
|
||||
UltimoErrorDL = dlerror ();
|
||||
dlclose (Manejador);
|
||||
return CMOD_NO_NOMBRE_MODULO;
|
||||
}
|
||||
else
|
||||
Log.Log ("NombreModulo para %s es [%s]", NombreArchivo, NombreModulo);
|
||||
if (Buscar (NombreModulo))
|
||||
{
|
||||
Log.Log ("El módulo %s[%s] ya está cargado", NombreArchivo,
|
||||
NombreModulo);
|
||||
dlclose (Manejador);
|
||||
return CMOD_YA_CARGADO;
|
||||
}
|
||||
if (ListaModulos)
|
||||
{
|
||||
while (ListaModulos->Siguiente)
|
||||
ListaModulos = ListaModulos->Siguiente;
|
||||
ListaModulos->Siguiente =
|
||||
(_ListaModulos *) gnew (sizeof (_ListaModulos));
|
||||
bzero (ListaModulos->Siguiente, sizeof (_ListaModulos));
|
||||
ListaModulos->Siguiente->Anterior = ListaModulos;
|
||||
ListaModulos = ListaModulos->Siguiente;
|
||||
}
|
||||
else
|
||||
{
|
||||
ListaModulos = (_ListaModulos *) gnew (sizeof (_ListaModulos));
|
||||
bzero (ListaModulos, sizeof (_ListaModulos));
|
||||
}
|
||||
|
||||
ListaModulos->Modulo = (c_Modulo *) gnew (sizeof (c_Modulo));
|
||||
bzero (ListaModulos->Modulo, sizeof (c_Modulo));
|
||||
ListaModulos->Modulo->Manejador = Manejador;
|
||||
ListaModulos->Modulo->NombreArchivo =
|
||||
(char *) gnew (strlen (NombreArchivo) + 1);
|
||||
strcpy (ListaModulos->Modulo->NombreArchivo, NombreArchivo);
|
||||
ListaModulos->Modulo->NombreModulo = NombreModulo;
|
||||
|
||||
ListaModulos->Modulo->Autor = (char *) dlsym (Manejador, "Autor");
|
||||
ListaModulos->Modulo->Version = (char *) dlsym (Manejador, "Version");
|
||||
ListaModulos->Modulo->Descripcion =
|
||||
(char *) dlsym (Manejador, "Descripcion");
|
||||
|
||||
if (!(dlCast_1 ListaModulos->Modulo->Iniciar =
|
||||
dlCast_2 dlsym (Manejador, "Iniciar")))
|
||||
Log.Log ("No se puede resolver el símbolo Iniciar");
|
||||
|
||||
if (!(dlCast_1 ListaModulos->Modulo->Detener =
|
||||
dlCast_2 dlsym (Manejador, "Detener")))
|
||||
Log.Log ("No se puede resolver el símbolo Detener");
|
||||
|
||||
if (ListaModulos->Modulo->Iniciar)
|
||||
if (ListaModulos->Modulo->Iniciar () == INICIAR_FALLADO)
|
||||
{
|
||||
Descargar (NombreModulo, DMOD_DESCARGAR_DEP, DMOD_IGNORAR_DETENER);
|
||||
return CMOD_ERROR_INICIAR;
|
||||
}
|
||||
return CMOD_OK;
|
||||
}
|
||||
*/
|
||||
#endif /* MODULOS2 */
|
||||
// obtiene el nombre esencial de la libreria (sin extension ni path)
|
||||
|
||||
/* obtiene el nombre esencial de la libreria (sin extension ni path) */
|
||||
void get_rawname(char* completo, char* rawname)
|
||||
{
|
||||
char* p=completo;
|
||||
|
@ -165,8 +69,7 @@ void get_rawname(char* completo, char* rawname)
|
|||
}
|
||||
|
||||
|
||||
// compara prioridades de dos dlls, para el qsort descendente
|
||||
|
||||
/* compara prioridades de dos dlls, para el qsort descendente */
|
||||
int compara(const void* _a, const void* _b)
|
||||
{
|
||||
struct _dlls a=*(struct _dlls*)_a;
|
||||
|
@ -182,7 +85,7 @@ int compara2(const void* _a, const void* _b)
|
|||
}
|
||||
|
||||
|
||||
void dll_func() // ke original, no? XD
|
||||
void dll_func()
|
||||
{
|
||||
char dllkey[256]="dll_priority:";
|
||||
char rawname[256];
|
||||
|
@ -192,7 +95,7 @@ void dll_func() // ke original, no? XD
|
|||
|
||||
#ifdef _WIN32
|
||||
int buscafich;
|
||||
struct _finddata_t fichero_dll; // busqueda de DLLs
|
||||
struct _finddata_t fichero_dll; /* busqueda de DLLs */
|
||||
char mask[256];
|
||||
#else
|
||||
DIR *directorio;
|
||||
|
@ -203,7 +106,7 @@ void dll_func() // ke original, no? XD
|
|||
n_externs=0;
|
||||
|
||||
#ifdef _WIN32
|
||||
// Inicializa la carga de DLLs
|
||||
/* Inicializa la carga de DLLs */
|
||||
CheckWindowsVersion();
|
||||
InitializeDLLLoad();
|
||||
#endif
|
||||
|
@ -218,12 +121,11 @@ void dll_func() // ke original, no? XD
|
|||
strcpy(mask,dir);
|
||||
strcat(mask,"\\*.dll");
|
||||
|
||||
// Busca las DLLs que hay en el directorio
|
||||
/* Busca las DLLs que hay en el directorio */
|
||||
buscafich = _findfirst(mask, &fichero_dll);
|
||||
if (buscafich==-1) {
|
||||
printf(translate(43)); // no hay dlls
|
||||
exit(1);
|
||||
}
|
||||
if (buscafich==-1)
|
||||
printf(translate(43)); /* no hay dlls */
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
printf("dbg: DLL encontrada: %s\n",fichero_dll.name);
|
||||
|
@ -241,18 +143,18 @@ void dll_func() // ke original, no? XD
|
|||
if (carga)
|
||||
if(!leedll()) {
|
||||
dlls[numdlls].prioridad=0;
|
||||
// guarda el nombre de fichero en la tabla de DLLs
|
||||
/* guarda el nombre de fichero en la tabla de DLLs */
|
||||
dlls[0].nombre=(char*)e_malloc(strlen(rawname)+1);
|
||||
strcpy(dlls[0].nombre,rawname);
|
||||
|
||||
// importa las funciones de la DLL
|
||||
/* importa las funciones de la DLL */
|
||||
if (ini)
|
||||
dlls[numdlls].prioridad=iniparser_getint(ini,dllkey,dlls[numdlls].prioridad);
|
||||
|
||||
numdlls=1;
|
||||
}
|
||||
|
||||
// hace lo mismo con el resto
|
||||
/* hace lo mismo con el resto */
|
||||
while(1) {
|
||||
if(_findnext(buscafich,&fichero_dll)==0) {
|
||||
#ifdef _DEBUG
|
||||
|
@ -260,7 +162,6 @@ void dll_func() // ke original, no? XD
|
|||
#endif
|
||||
carga=1;
|
||||
sprintf(fichdll,"%s\\%s",dir,fichero_dll.name);
|
||||
// dlls[numdlls].nfuncs=0;
|
||||
dlls[numdlls].prioridad=0;
|
||||
get_rawname(fichero_dll.name,rawname);
|
||||
strcpy(dllkey,"dll_priority:");
|
||||
|
@ -278,25 +179,23 @@ void dll_func() // ke original, no? XD
|
|||
break;
|
||||
}
|
||||
|
||||
#else // si estamos en Linux
|
||||
#else /* si estamos en Linux */
|
||||
|
||||
if(ini) dir=iniparser_getstr(ini,"dll:nixdll"));
|
||||
if(!dir) dir="so";
|
||||
|
||||
directorio=opendir(dir);
|
||||
if(!directorio) {
|
||||
printf(translate(44),dir); // no hay directorio so/
|
||||
printf(translate(44),dir); /* no hay directorio so/ */
|
||||
exit(1);
|
||||
}
|
||||
// Nos saltamos las dos primeras entradas "./" y "../"
|
||||
/* Nos saltamos las dos primeras entradas "./" y "../" */
|
||||
for(i=0;i<2;i++) {
|
||||
fichero_dll=readdir(directorio);
|
||||
if(fichero_dll==0) {
|
||||
printf(translate(43)); // no hay so's
|
||||
exit(1);
|
||||
}
|
||||
if(fichero_dll==0)
|
||||
printf(translate(43)); /* no hay so's */
|
||||
}
|
||||
// Busca las .so
|
||||
/* Busca las .so */
|
||||
while (1) {
|
||||
fichero_dll=readdir(directorio);
|
||||
if(fichero_dll==0)
|
||||
|
@ -308,7 +207,6 @@ void dll_func() // ke original, no? XD
|
|||
#endif
|
||||
carga=1;
|
||||
sprintf(fichdll,"%s/%s",dir,fichero_dll->d_name);
|
||||
// dlls[numdlls].nfuncs=0;
|
||||
dlls[numdlls].prioridad=0;
|
||||
get_rawname(fichero_dll->d_name,rawname);
|
||||
strcpy(dllkey,"dll_priority:");
|
||||
|
@ -326,10 +224,8 @@ void dll_func() // ke original, no? XD
|
|||
|
||||
#endif
|
||||
|
||||
if(numdlls==0) {
|
||||
printf(translate(43)); // no hay librerias
|
||||
exit(1);
|
||||
}
|
||||
if(numdlls==0)
|
||||
printf(translate(43)); /* no hay librerias */
|
||||
|
||||
nuevo_orden=e_malloc(numdlls*4);
|
||||
for(i=0;i<numdlls;i++)
|
||||
|
@ -357,7 +253,6 @@ void dll_func2()
|
|||
nuevo_orden[i]=i;
|
||||
|
||||
for(numdlls=0;numdlls<i;numdlls++) {
|
||||
//printf("#### (%d) %s - prioridad: %d\n",i,dlls[i].nombre,dlls[i].prioridad);
|
||||
if((dlls[numdlls].prioridad>P_NUNCA) && (dlls[numdlls].usado || dlls[numdlls].prioridad>=P_SIEMPRE)) {
|
||||
#ifdef _DEBUG
|
||||
printf("dbg: Se requiere %s (id=%d)\n",dlls[numdlls].nombre,numdlls);
|
||||
|
@ -371,7 +266,7 @@ void dll_func2()
|
|||
#endif
|
||||
sprintf(fichdll,"%s\\%s.dll",dir,dlls[numdlls].nombre);
|
||||
if(leedll()) {
|
||||
printf(translate(45),dlls[numdlls].nombre); // error al cargar libreria
|
||||
printf(translate(45),dlls[numdlls].nombre); /* error al cargar libreria */
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
@ -384,24 +279,21 @@ int leedll()
|
|||
#ifdef _WIN32
|
||||
TYPEOF_ExportaFuncs *ExportaFuncs;
|
||||
HINSTANCE hDLL;
|
||||
// TYPEOF_extfunc *extfunc; // *** PRUEBA ***
|
||||
|
||||
// Carga la DLL
|
||||
/* Carga la DLL */
|
||||
hDLL=LoadDLL(fichdll);
|
||||
|
||||
if(hDLL==NULL) {
|
||||
printf(translate(46),fichdll); // no puedo cargar libreria
|
||||
printf(translate(46),fichdll); /* no puedo cargar libreria */
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Inicializa y ejecuta la funcion ExportaFuncs de la DLL
|
||||
|
||||
/* Inicializa y ejecuta la funcion ExportaFuncs de la DLL */
|
||||
ExportaFuncs=NULL;
|
||||
|
||||
ExportaFuncs=(TYPEOF_ExportaFuncs *)GetDLLProcAddress(hDLL,"ExportaFuncs");
|
||||
|
||||
if(ExportaFuncs==NULL) {
|
||||
printf(translate(47),fichdll); // exportafuncs no encontrado
|
||||
printf(translate(47),fichdll); /* exportafuncs no encontrado */
|
||||
FreeDLL(hDLL);
|
||||
return 1;
|
||||
}
|
||||
|
@ -412,39 +304,30 @@ int leedll()
|
|||
|
||||
ExportaFuncs(EXPORTAFUNCS_PARAMS);
|
||||
|
||||
/***** PRUEBA ****** PRUEBA ***** PRUEBA ***** PRUEBA *****
|
||||
if(n_externs==5) {
|
||||
extfunc=ext_funcs[4].hfuncion;
|
||||
putparm("hola");
|
||||
extfunc(params,sp);
|
||||
}
|
||||
***** PRUEBA ****** PRUEBA ***** PRUEBA ***** PRUEBA *****/
|
||||
|
||||
FreeDLL(hDLL);
|
||||
|
||||
#else // linux
|
||||
#else /* Linux */
|
||||
|
||||
TYPEOF_ExportaFuncs *ExportaFuncs;
|
||||
void *hDLL;
|
||||
char *errordll;
|
||||
// TYPEOF_extfunc *extfunc; // *** PRUEBA ***
|
||||
|
||||
// Carga la DLL
|
||||
/* Carga la DLL */
|
||||
hDLL=dlopen(fichdll,RTLD_NOW);
|
||||
|
||||
if(!hDLL) {
|
||||
printf(translate(46),fichdll,dlerror()); // no puedo cargar libreria
|
||||
printf(translate(46),fichdll,dlerror()); /* no puedo cargar libreria */
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Inicializa y ejecuta la funcion ExportaFuncs de la DLL
|
||||
/* Inicializa y ejecuta la funcion ExportaFuncs de la DLL */
|
||||
|
||||
ExportaFuncs=NULL;
|
||||
|
||||
ExportaFuncs=(TYPEOF_ExportaFuncs *) dlsym(hDLL,"ExportaFuncs");
|
||||
|
||||
if((errordll=dlerror())!=NULL) {
|
||||
printf(translate(47),fichdll,errordll); // exportafuncs no encontrado
|
||||
printf(translate(47),fichdll,errordll); /* exportafuncs no encontrado */
|
||||
dlclose(hDLL);
|
||||
return 1;
|
||||
}
|
||||
|
@ -454,18 +337,6 @@ int leedll()
|
|||
#endif
|
||||
|
||||
ExportaFuncs(EXPORTAFUNCS_PARAMS);
|
||||
|
||||
/***** PRUEBA ****** PRUEBA ***** PRUEBA ***** PRUEBA *****
|
||||
//if(n_externs==3) {
|
||||
extfunc=ext_funcs[1].hfuncion;
|
||||
putparm(63);
|
||||
putparm(30);
|
||||
putparm(24);
|
||||
putparm(6);
|
||||
extfunc(params,sp);
|
||||
//}
|
||||
***** PRUEBA ****** PRUEBA ***** PRUEBA ***** PRUEBA *****/
|
||||
|
||||
dlclose(hDLL);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,94 +1,28 @@
|
|||
/***************************************************************************
|
||||
modulos.h - description
|
||||
-------------------
|
||||
begin : Sat Jun 23 2001
|
||||
copyright : (C) 2001 by Sion Entertainment
|
||||
email : bugs@edivcentral.com
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* 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 *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
/*
|
||||
* eDiv Compiler
|
||||
* Copyright (C) 2000-2002 Sion, Ltd.
|
||||
* http://www.sionhq.com
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __MODULOS_H
|
||||
#define __MODULOS_H
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#define MODULOS2
|
||||
|
||||
#ifdef MODULOS2
|
||||
|
||||
#define dlHandler void*
|
||||
#define dlCast_1 (void*)
|
||||
#define dlCast_2
|
||||
|
||||
struct Modulo {
|
||||
dlHandler Manejador; /* Manejador del módulo */
|
||||
char *NombreArchivo; /* Nombre del Archivo */
|
||||
char *NombreModulo; /* Nombre del Módulo */
|
||||
char *Descripcion; /* Descripcion del Módulo */
|
||||
char *Version; /* Versión del Módulo */
|
||||
char *Autor; /* Autor del Módulo */
|
||||
time_t FechaCarga; /* Fecha de Carga del Módulo */
|
||||
time_t UltimoUso; /* Fecha del último uso del Módulo */
|
||||
int (*Iniciar) (void); /* Función llamada al inicio del Módulo */
|
||||
int (*Detener) (void); /* Función llamada en la descarga del Módulo */
|
||||
};
|
||||
|
||||
typedef struct _listamodulos
|
||||
{
|
||||
/* Puntero al siguiente elemento de la lista.
|
||||
* Si no hay siguiente elemento, este es NULL.
|
||||
*/
|
||||
struct _listamodulos *siguiente;
|
||||
|
||||
/*! \brief Puntero al elemento anterior de la
|
||||
* lista.
|
||||
* \note Si no hay elemento anterior, este es NULL.
|
||||
*/
|
||||
struct _listamodulos *anterior;
|
||||
|
||||
/*! \brief Puntero a la información del Módulo */
|
||||
struct Modulo *modulo;
|
||||
|
||||
/*! \brief Lista de Dependencias del módulo
|
||||
* \note Si no hay ninguna dependencia, este es NULL
|
||||
*/
|
||||
struct _listadependencias
|
||||
{
|
||||
/*! \brief Puntero al siguiente elemento de la
|
||||
* lista.
|
||||
* \note Si no hay siguiente elemento, este es NULL.
|
||||
*/
|
||||
struct _listadependencias *siguiente;
|
||||
/*! \brief Puntero al elemento anterior de la
|
||||
* lista.
|
||||
* \note Si no hay elemento anterior, este es NULL.
|
||||
*/
|
||||
struct _listadependencias *anterior;
|
||||
/*! \brief Puntero a la dependencia */
|
||||
struct _listamodulos *dependencia;
|
||||
} *listadependencias;
|
||||
|
||||
} _listamodulos;
|
||||
|
||||
char *UltimoErrorDL;
|
||||
struct _listamodulos *ListaModulos;
|
||||
int Cargar (char *);
|
||||
int Descargar (char *, unsigned short, unsigned short);
|
||||
int NuevaDependencia (char *, char *);
|
||||
int BorrarDependencia (char *, char *);
|
||||
struct _listamodulos *Buscar (char *);
|
||||
char *ObtenerUltimoErrorDL (void);
|
||||
|
||||
#endif /* MODULOS2 */
|
||||
|
||||
int* nuevo_orden;
|
||||
|
||||
int leedll();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* eDiv Compiler
|
||||
* Copyleft (C) 2000-2002 Sion Entertainment
|
||||
* http://www.sion-e.com
|
||||
* Copyright (C) 2000-2002 Sion, Ltd.
|
||||
* http://www.sionhq.com
|
||||
*
|
||||
* 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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* eDiv Compiler
|
||||
* Copyleft (C) 2000-2002 Sion Entertainment
|
||||
* http://www.sion-e.com
|
||||
* Copyright (C) 2000-2002 Sion, Ltd.
|
||||
* http://www.sionhq.com
|
||||
*
|
||||
* 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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* eDiv Compiler
|
||||
* Copyleft (C) 2000-2002 Sion Entertainment
|
||||
* http://www.sion-e.com
|
||||
* Copyright (C) 2000-2002 Sion, Ltd.
|
||||
* http://www.sionhq.com
|
||||
*
|
||||
* 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* eDiv Compiler
|
||||
* Copyright (C) 2000-2002 Sion Entertainment
|
||||
* Copyright (C) 2000-2002 Sion, Ltd.
|
||||
* http://www.sionhq.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
|
@ -1,6 +1,26 @@
|
|||
/*
|
||||
Definiciones compartidas de eDiv - Usar en eDiv, encrypt y stub :)
|
||||
*/
|
||||
* eDiv Compiler
|
||||
* Copyright (C) 2000-2002 Sion, Ltd.
|
||||
* http://www.sionhq.com
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* Definiciones compartidas de eDiv - Usar en eDiv, encrypt y stub :)
|
||||
*/
|
||||
|
||||
#ifndef __SHARED_H
|
||||
#define __SHARED_H
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* eDiv Compiler
|
||||
* Copyleft (C) 2000-2002 Sion Entertainment
|
||||
* http://www.sion-e.com
|
||||
* Copyright (C) 2000-2002 Sion, Ltd.
|
||||
* http://www.sionhq.com
|
||||
*
|
||||
* 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
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue