X-Git-Url: http://git.subgeniuskitty.com/pforth/.git/blobdiff_plain/4d9c915d183f67c0c066996816524e863343c1d6..8cf4db28224a2b074be90d2f94f16c97cc875f2b:/csrc/pf_io.h diff --git a/csrc/pf_io.h b/csrc/pf_io.h index 5217390..b87d739 100644 --- a/csrc/pf_io.h +++ b/csrc/pf_io.h @@ -24,6 +24,9 @@ #define PF_CHAR_XON (0x11) #define PF_CHAR_XOFF (0x13) +#ifdef __cplusplus +extern "C" { +#endif int sdTerminalOut( char c ); int sdTerminalEcho( char c ); int sdTerminalFlush( void ); @@ -31,6 +34,9 @@ int sdTerminalIn( void ); int sdQueryTerminal( void ); void sdTerminalInit( void ); void sdTerminalTerm( void ); +#ifdef __cplusplus +} +#endif void ioInit( void ); void ioTerm( void ); @@ -122,14 +128,18 @@ void ioTerm( void ); #define sdFlushFile fflush #define sdReadFile fread #define sdWriteFile fwrite - #if defined(WIN32) || defined(__NT__) || defined(AMIGA) - /* TODO To support 64-bit file offset we probably need fseeki64(). */ - #define sdSeekFile fseek - #define sdTellFile ftell - #else - #define sdSeekFile fseeko - #define sdTellFile ftello - #endif + + /* + * Note that fseek() and ftell() only support a long file offset. + * So 64-bit offsets may not be supported on some platforms. + * At one point we supported fseeko() and ftello() but they require + * the off_t data type, which is not very portable. + * So we decided to sacrifice vary large file support in + * favor of portability. + */ + #define sdSeekFile fseek + #define sdTellFile ftell + #define sdCloseFile fclose #define sdRenameFile rename #define sdInputChar fgetc @@ -141,6 +151,7 @@ void ioTerm( void ); #define PF_SEEK_CUR (SEEK_CUR) #define PF_SEEK_END (SEEK_END) + /* TODO review the Size data type. */ ThrowCode sdResizeFile( FileStream *, uint64_t Size); /*