OS "Glue" functions lib: Remove OS specific functions from lib & software.

git-svn-id: svn://svn.code.sf.net/p/hxcfloppyemu/code/HxCFloppyEmulator/libhxcadaptor/trunk@447 63fa2f70-6a9b-4bc4-b855-9c6a949b1d69
This commit is contained in:
Jean-François DEL NERO
2012-07-17 10:15:06 +00:00
parent 63dd034c3e
commit fd636826d4
6 changed files with 72 additions and 44 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ CC=gcc
AR=ar
BASEDIR=../sources
INCLUDES = -I$(BASEDIR)/ -I ../../../libhxcfe/trunk/sources
INCLUDES = -I$(BASEDIR)/ -I ../../../libhxcfe/trunk/sources -I ../../../libusbhxcfe/trunk/sources
CFLAGS=-O3 $(INCLUDES)
+7 -5
View File
@@ -1,4 +1,4 @@
# Microsoft Developer Studio Project File - Name="sssss" - Package Owner=<4>
# Microsoft Developer Studio Project File - Name="libhxcadaptor" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
@@ -41,7 +41,8 @@ RSC=rc.exe
# PROP Intermediate_Dir "..\..\..\build\Release_libhxcadaptor"
# PROP Target_Dir "..\..\..\build\"
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c /I "..\..\..\libusbhxcfe\trunk\sources" /I "..\..\..\libhxcfe\trunk\sources"
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\libusbhxcfe\trunk\sources" /I "..\..\..\libhxcfe\trunk\sources" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x40c /d "NDEBUG"
# ADD RSC /l 0x40c /d "NDEBUG"
BSC32=bscmake.exe
@@ -63,8 +64,9 @@ LIB32=link.exe -lib
# PROP Output_Dir "..\..\..\build\"
# PROP Intermediate_Dir "..\..\..\build\Debug_libhxcadaptor"
# PROP Target_Dir "..\..\..\build\"
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c /I "..\..\..\libusbhxcfe\trunk\sources" /I "..\..\..\libhxcfe\trunk\sources"
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\libusbhxcfe\trunk\sources" /I "..\..\..\libhxcfe\trunk\sources" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x40c /d "_DEBUG"
# ADD RSC /l 0x40c /d "_DEBUG"
BSC32=bscmake.exe
@@ -74,7 +76,7 @@ LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
!ENDIF
# Begin Target
+18 -18
View File
@@ -1,27 +1,27 @@
/*
//
// Copyright (C) 2006 - 2012 Jean-François DEL NERO
// Copyright (C) 2006 - 2012 Jean-François DEL NERO
//
// This file is part of the HxCFloppyEmulator library
// This file is part of the HxCFloppyEmulator library
//
// HxCFloppyEmulator may be used and distributed without restriction provided
// that this copyright statement is not removed from the file and that any
// derivative work contains the original copyright notice and the associated
// disclaimer.
// HxCFloppyEmulator may be used and distributed without restriction provided
// that this copyright statement is not removed from the file and that any
// derivative work contains the original copyright notice and the associated
// disclaimer.
//
// HxCFloppyEmulator 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.
// HxCFloppyEmulator 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.
//
// HxCFloppyEmulator 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.
// HxCFloppyEmulator 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 HxCFloppyEmulator; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// You should have received a copy of the GNU General Public License
// along with HxCFloppyEmulator; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
*/
///////////////////////////////////////////////////////////////////////////////////
@@ -33,7 +33,7 @@
//--------H----H----X--X----C----------2-------0----0---0----0-----1-------------//
//-------H----H---X-----X---CCCCC-----222222----0000-----0000----1111------------//
//-------------------------------------------------------------------------------//
//----------------------------------------------------- http://hxc2001.free.fr --//
//----------------------------------------------------- http://hxc2001.free.fr --//
///////////////////////////////////////////////////////////////////////////////////
// File : fs.c
// Contains: UTF-8 / Ascii path file system functions
-10
View File
@@ -1,10 +0,0 @@
int hxc_open (const char *filename, int flags, ...);
FILE *hxc_fopen (const char *filename, const char *mode);
int hxc_fclose(FILE * f);
int hxc_stat( const char *filename, struct stat *buf);
long find_first_file(char *folder,char *file,filefoundinfo* fileinfo);
long find_next_file(long handleff,char *folder,char *file,filefoundinfo* fileinfo);
long find_close(long handle);
+15 -10
View File
@@ -48,9 +48,15 @@
#include <sys/stat.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#ifdef WIN32
#include <windows.h>
#else
#include <sys/time.h>
#include <pthread.h>
#include <sched.h>
#endif
@@ -64,11 +70,15 @@
#ifdef WIN32
HANDLE eventtab[256];
#else
typedef struct _EVENT_HANDLE{
pthread_cond_t eCondVar;
pthread_mutex_t eMutex;
int iVar;
} EVENT_HANDLE;
EVENT_HANDLE * eventtab[256];
#endif
#ifdef WIN32
DWORD WINAPI ThreadProc( LPVOID lpParameter)
@@ -94,7 +104,7 @@ void * ThreadProc( void *lpParameter)
threadinit *threadinitptr;
THREADFUNCTION thread;
HXCFLOPPYEMULATOR* floppycontext;
HWINTERFACE* hw_context;
USBHXCFE * hw_context;
threadinitptr=(threadinit*)lpParameter;
thread=threadinitptr->thread;
@@ -106,8 +116,6 @@ void * ThreadProc( void *lpParameter)
}
#endif
int hxc_setevent(HXCFLOPPYEMULATOR* floppycontext,unsigned char id)
{
#ifdef WIN32
@@ -120,7 +128,6 @@ int hxc_setevent(HXCFLOPPYEMULATOR* floppycontext,unsigned char id)
unsigned long hxc_createevent(HXCFLOPPYEMULATOR* floppycontext,unsigned char id)
{
#ifdef WIN32
eventtab[id]=CreateEvent(NULL,FALSE,FALSE,NULL);
@@ -230,7 +237,7 @@ int hxc_createthread(HXCFLOPPYEMULATOR* floppycontext,void* hwcontext,THREADFUNC
}
#ifndef WIN32
void strlwr(char *string)
/*void strlwr(char *string)
{
int i;
@@ -240,7 +247,7 @@ void strlwr(char *string)
string[i] = tolower(string[i]);
i++;
}
}
}*/
#endif
char * strupper(char * str)
@@ -261,7 +268,6 @@ char * strupper(char * str)
return str;
}
char * strlower(char * str)
{
int i;
@@ -279,4 +285,3 @@ char * strlower(char * str)
return str;
}
+31
View File
@@ -1,3 +1,4 @@
/////////////// Thread functions ////////////////
typedef int (*THREADFUNCTION) (void* floppyemulator,void* hwemulator);
@@ -14,3 +15,33 @@ typedef struct filefoundinfo_
char filename[256];
int size;
}filefoundinfo;
int hxc_setevent(HXCFLOPPYEMULATOR* floppycontext,unsigned char id);
unsigned long hxc_createevent(HXCFLOPPYEMULATOR* floppycontext,unsigned char id);
int hxc_waitevent(HXCFLOPPYEMULATOR* floppycontext,int id,int timeout);
void hxc_pause(int ms);
int hxc_createthread(HXCFLOPPYEMULATOR* floppycontext,void* hwcontext,THREADFUNCTION thread,int priority);
/////////////// String functions ///////////////
#ifndef WIN32
//void strlwr(char *string)
#endif
char * strupper(char * str);
char * strlower(char * str);
/////////////// File functions ////////////////
int hxc_open (const char *filename, int flags, ...);
FILE *hxc_fopen (const char *filename, const char *mode);
int hxc_fclose(FILE * f);
#ifndef stat
#include <sys/stat.h>
#endif
int hxc_stat( const char *filename, struct stat *buf);
long find_first_file(char *folder,char *file,filefoundinfo* fileinfo);
long find_next_file(long handleff,char *folder,char *file,filefoundinfo* fileinfo);
long find_close(long handle);