Allows file.so to te built on non-windows. Dirty way.

This commit is contained in:
Víctor Román Archidona 2014-07-24 13:16:26 +02:00
parent 59a8f5c6b9
commit 14ffb4c73b
2 changed files with 43 additions and 11 deletions

16
dlls/src/file/build.sh Executable file
View file

@ -0,0 +1,16 @@
#!/bin/bash
NAME="file"
CCOPTS="-I. -I/usr/local/include -I../include"
FILES="file"
OBJECTS=""
for FILE in $FILES; do
gcc -c $FILE.c $CCOPTS -o $FILE.o
OBJECTS+="$FILE.o "
done
gcc $OBJECTS -shared -o ../../bin/${NAME}.so -L/usr/local/lib -lSDL
rm $OBJECTS

View file

@ -2,9 +2,29 @@
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include <export.h> #include "export.h"
#include "file.h" #include "file.h"
FILE *fichero[0xFF] ;
int existe[0xFF] ;
static void _cierratodo()
{
int i = 0;
for (; i < 0xFF ; i++ )
if ( existe[i] == 0 )
fclose(fichero[i]);
}
static void _limpiatodo()
{
int i = 0;
for (; i < 0xFF ; i++ )
if ( existe[i] == 0 )
fflush(fichero[i]);
}
int ExportaFuncs(EXPORTAFUNCS_PARAMS) int ExportaFuncs(EXPORTAFUNCS_PARAMS)
{ {
@ -30,9 +50,6 @@ int ExportaFuncs(EXPORTAFUNCS_PARAMS)
} }
FILE *fichero[0xFF] ;
int existe[0xFF] ;
/* /*
* POR HACER: * POR HACER:
* Los handles deben ser IMPARES * Los handles deben ser IMPARES
@ -148,19 +165,18 @@ int eDiv_Fseek(FUNCTION_PARAMS)
int eDiv_Flush(FUNCTION_PARAMS) int eDiv_Flush(FUNCTION_PARAMS)
{ {
return flushall() ; /* flushall()-numfiles */ _limpiatodo();
return TRUE;
} }
int eDiv_Fclose(FUNCTION_PARAMS) int eDiv_Fclose(FUNCTION_PARAMS)
{ {
int handle=getparm(), num ; int handle=getparm(), num ;
if ( handle == 0 ) if ( handle == 0 ) {
if ( ( num = fcloseall() ) == EOF ) _cierratodo();
return 0; return 0;
else } else
return num ;
else
if ( !existe[handle] ) { if ( !existe[handle] ) {
fp->Runtime_Error(170); fp->Runtime_Error(170);
return 0 ; return 0 ;