Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/CMakeLists.txt b/CMakeLists.txt
- index 2045978..62c9dae 100644
- --- a/CMakeLists.txt
- +++ b/CMakeLists.txt
- @@ -1,17 +1,18 @@
- cmake_minimum_required(VERSION 3.13)
- option(USE_ICONV "Use iconv for converting Shift-JIS to UTF-8." ON)
- +project(run68 C)
- +
- #add_definitions(-DFNC_TRACE -DENV_FROM_INI)
- add_definitions(-DENV_FROM_INI)
- if(USE_ICONV)
- + find_package(Iconv REQUIRED)
- add_definitions(-DUSE_ICONV)
- else()
- endif()
- -project(run68 C)
- -
- if (EMSCRIPTEN)
- set(CMAKE_EXE_LINKER_FLAGS "--embed-file ./fs@ -sFORCE_FILESYSTEM")
- endif()
- @@ -58,10 +59,8 @@ add_executable(run68 ${SRC})
- set(LIBS m) # math lib
- if(USE_ICONV)
- -
- - if(APPLE)
- - set(LIBS ${LIBS} "iconv")
- - endif()
- + include_directories(${Iconv_INCLUDE_DIRS})
- + set(LIBS ${LIBS} ${Iconv_LIBRARIES})
- endif()
- target_link_libraries(run68 PUBLIC ${LIBS})
- diff --git a/src/doscall.c b/src/doscall.c
- index dc94f98..3c1c8e5 100644
- --- a/src/doscall.c
- +++ b/src/doscall.c
- @@ -70,9 +70,6 @@
- #include <dos.h>
- #include <direct.h>
- #include <io.h>
- -#elif defined(__APPLE__) || defined(__EMSCRIPTEN__)
- - #include <time.h>
- - #include <dirent.h>
- #else
- #include <time.h>
- #include <dirent.h>
- @@ -136,7 +133,7 @@ static Long gets2( char *, int );
- Long Getenv_common(const char *name_p, char *buf_p);
- -#if defined(__APPLE__) || defined(__linux__) || defined(__EMSCRIPTEN__)
- +#if defined(__APPLE__) || defined(__linux__) || defined(__EMSCRIPTEN__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
- void CloseHandle( FILE* fp ) {
- fclose( fp );
- }
- @@ -368,7 +365,7 @@ int dos_call( UChar code )
- #elif defined(DOSX)
- _dos_write( fileno(finfo[ 1 ].fh), data_ptr,
- (unsigned)len, &drv );
- -#elif defined(__APPLE__) || defined(__linux__) || defined(__EMSCRIPTEN__)
- +#elif defined(__APPLE__) || defined(__linux__) || defined(__EMSCRIPTEN__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
- // _dos_write( fileno(finfo[ 1 ].fh), data_ptr, (unsigned)len, &drv );
- #if defined (USE_ICONV)
- {
- @@ -1573,7 +1570,7 @@ static Long Create( char *p, short atr )
- int len;
- -#if defined(__APPLE__) || defined(__linux__) || defined(__EMSCRIPTEN__)
- +#if defined(__APPLE__) || defined(__linux__) || defined(__EMSCRIPTEN__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
- char* name = p;
- int namelen = strlen(name);
- for (int i=0;i<namelen;++i) {
- @@ -1719,7 +1716,7 @@ static Long Open( char *p, short mode )
- Long ret;
- Long i;
- -#if defined(__APPLE__) || defined(__linux__) || defined(__EMSCRIPTEN__)
- +#if defined(__APPLE__) || defined(__linux__) || defined(__EMSCRIPTEN__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
- char* name = p;
- int namelen = strlen(name);
- for (int i=0;i<namelen;++i) {
- @@ -1985,15 +1982,10 @@ static Long Write( short hdl, Long buf, Long len )
- }
- if (finfo [ hdl ].fh == stdout)
- fflush( stdout );
- -#elif defined(__APPLE__) || defined(__linux__) || defined(__EMSCRIPTEN__)
- - write_len = fwrite( write_buf, 1, len, finfo [ hdl ].fh );
- - if (finfo [ hdl ].fh == stdout)
- - fflush( stdout );
- #else
- write_len = fwrite( write_buf, 1, len, finfo [ hdl ].fh );
- if (finfo [ hdl ].fh == stdout)
- fflush( stdout );
- -// #error NOTIMPLEMENTED
- #endif
- return( write_len );
- @@ -2553,8 +2545,6 @@ static Long Nfiles( Long buf )
- strncpy(&buf_ptr[30], f_data.cFileName, 22);
- buf_ptr[30+22] = 0;
- -#elif defined(__APPLE__) || defined(__linux__) || defined(__EMSCRIPTEN__)
- - printf("DOSCALL NFILES:not defined yet %s %d\n", __FILE__, __LINE__ );
- #else
- printf("DOSCALL NFILES:not defined yet %s %d\n", __FILE__, __LINE__ );
- #endif
- @@ -2567,7 +2557,7 @@ static Long Nfiles( Long buf )
- */
- static Long Filedate( short hdl, Long dt )
- {
- -#if defined(__APPLE__) || defined(__linux__) || defined(__EMSCRIPTEN__)
- +#if defined(__APPLE__) || defined(__linux__) || defined(__EMSCRIPTEN__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
- printf("DOSCALL FILEDATE:not defined yet %s %d\n", __FILE__, __LINE__ );
- #else
- #if defined(WIN32)
- diff --git a/src/iocscall.c b/src/iocscall.c
- index 7da92b6..f296d42 100644
- --- a/src/iocscall.c
- +++ b/src/iocscall.c
- @@ -26,8 +26,7 @@
- #include <windows.h>
- #elif defined(DOSX)
- #include <dos.h>
- -#elif defined(__APPLE__)
- -#else
- +#elif defined(__linux__)
- #include <sys/sysinfo.h>
- #endif
- @@ -177,11 +176,11 @@ int iocs_call()
- ul = time( NULL );
- rd [ 0 ] = (ul % (60 * 60 * 24)) * 100;
- rd [ 1 ] = ((ul / (60 * 60 * 24)) & 0xFFFF);
- -#elif defined(__APPLE__) || defined(__EMSCRIPTEN__)
- +#elif !defined(__linux__)
- ul = time( NULL );
- rd [ 0 ] = (ul % (60 * 60 * 24)) * 100;
- rd [ 1 ] = ((ul / (60 * 60 * 24)) & 0xFFFF);
- -#else
- +#else //__linux__
- {
- struct sysinfo info;
- sysinfo(&info);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement