Define as long for compatibility with stdio.h
**
***************************************************************/
**
***************************************************************/
-#ifndef AMIGA
-#include <sys/types.h>
-#else
-typedef long off_t;
-#endif
-
#include "pf_all.h"
#if defined(WIN32) && !defined(__MINGW32__)
#include "pf_all.h"
#if defined(WIN32) && !defined(__MINGW32__)
/* Determine file size by seeking to end and returning position. */
FileID = (FileStream *) TOS;
{
/* Determine file size by seeking to end and returning position. */
FileID = (FileStream *) TOS;
{
- off_t endposition, offsetHi;
- off_t original = sdTellFile( FileID );
+ file_offset_t endposition, offsetHi;
+ file_offset_t original = sdTellFile( FileID );
sdSeekFile( FileID, 0, PF_SEEK_END );
endposition = sdTellFile( FileID );
M_PUSH(endposition);
/* Just use a 0 if they are the same size. */
sdSeekFile( FileID, 0, PF_SEEK_END );
endposition = sdTellFile( FileID );
M_PUSH(endposition);
/* Just use a 0 if they are the same size. */
- offsetHi = (sizeof(off_t) > sizeof(cell_t)) ? (endposition >> (8*sizeof(cell_t))) : 0 ;
+ offsetHi = (sizeof(file_offset_t) > sizeof(cell_t))
+ ? (endposition >> (8*sizeof(cell_t))) : 0 ;
M_PUSH(offsetHi);
sdSeekFile( FileID, original, PF_SEEK_SET );
TOS = (original < 0) ? -4 : 0 ; /* !!! err num */
M_PUSH(offsetHi);
sdSeekFile( FileID, original, PF_SEEK_SET );
TOS = (original < 0) ? -4 : 0 ; /* !!! err num */
case ID_FILE_REPOSITION: /* ( ud fid -- ior ) */
{
case ID_FILE_REPOSITION: /* ( ud fid -- ior ) */
{
FileID = (FileStream *) TOS;
offset = M_POP;
/* Avoid compiler warnings on Mac. */
FileID = (FileStream *) TOS;
offset = M_POP;
/* Avoid compiler warnings on Mac. */
- offset = (sizeof(off_t) > sizeof(cell_t)) ? (offset << 8*sizeof(cell_t)) : 0 ;
+ offset = (sizeof(file_offset_t) > sizeof(cell_t))
+ ? (offset << 8*sizeof(cell_t)) : 0 ;
offset += M_POP;
TOS = sdSeekFile( FileID, offset, PF_SEEK_SET );
}
offset += M_POP;
TOS = sdSeekFile( FileID, offset, PF_SEEK_SET );
}
case ID_FILE_POSITION: /* ( fid -- ud ior ) */
{
case ID_FILE_POSITION: /* ( fid -- ud ior ) */
{
- off_t position;
- off_t offsetHi;
+ file_offset_t position;
+ file_offset_t offsetHi;
FileID = (FileStream *) TOS;
position = sdTellFile( FileID );
M_PUSH(position);
/* Just use a 0 if they are the same size. */
FileID = (FileStream *) TOS;
position = sdTellFile( FileID );
M_PUSH(position);
/* Just use a 0 if they are the same size. */
- offsetHi = (sizeof(off_t) > sizeof(cell_t)) ? (position >> (8*sizeof(cell_t))) : 0 ;
+ offsetHi = (sizeof(file_offset_t) > sizeof(cell_t))
+ ? (position >> (8*sizeof(cell_t))) : 0 ;
M_PUSH(offsetHi);
TOS = (position < 0) ? -4 : 0 ; /* !!! err num */
}
M_PUSH(offsetHi);
TOS = (position < 0) ? -4 : 0 ; /* !!! err num */
}
**
***************************************************************/
**
***************************************************************/
#define PF_CHAR_XON (0x11)
#define PF_CHAR_XOFF (0x13)
#define PF_CHAR_XON (0x11)
#define PF_CHAR_XOFF (0x13)
void ioInit( void );
void ioTerm( void );
void ioInit( void );
void ioTerm( void );
#ifdef PF_NO_CHARIO
void sdEnableInput( void );
void sdDisableInput( void );
#ifdef PF_NO_CHARIO
void sdEnableInput( void );
void sdDisableInput( void );
cell_t sdFlushFile( FileStream * Stream );
cell_t sdReadFile( void *ptr, cell_t Size, int32_t nItems, FileStream * Stream );
cell_t sdWriteFile( void *ptr, cell_t Size, int32_t nItems, FileStream * Stream );
cell_t sdFlushFile( FileStream * Stream );
cell_t sdReadFile( void *ptr, cell_t Size, int32_t nItems, FileStream * Stream );
cell_t sdWriteFile( void *ptr, cell_t Size, int32_t nItems, FileStream * Stream );
- cell_t sdSeekFile( FileStream * Stream, off_t Position, int32_t Mode );
+ cell_t sdSeekFile( FileStream * Stream, file_offset_t Position, int32_t Mode );
cell_t sdRenameFile( const char *OldName, const char *NewName );
cell_t sdDeleteFile( const char *FileName );
ThrowCode sdResizeFile( FileStream *, uint64_t Size);
cell_t sdRenameFile( const char *OldName, const char *NewName );
cell_t sdDeleteFile( const char *FileName );
ThrowCode sdResizeFile( FileStream *, uint64_t Size);
- off_t sdTellFile( FileStream * Stream );
+ file_offset_t sdTellFile( FileStream * Stream );
cell_t sdCloseFile( FileStream * Stream );
cell_t sdInputChar( FileStream *stream );
cell_t sdCloseFile( FileStream * Stream );
cell_t sdInputChar( FileStream *stream );
** Type Declarations
***************************************************************/
** Type Declarations
***************************************************************/
+#ifndef AMIGA
+#include <sys/types.h>
+#endif
+
+/* file_offset_t is used in place of off_t */
+typedef long file_offset_t;
+
#ifndef Err
typedef long Err;
#endif
#ifndef Err
typedef long Err;
#endif