Skip to content

Instantly share code, notes, and snippets.

@paulfryzel
Last active August 29, 2015 14:00
Show Gist options
  • Save paulfryzel/11236972 to your computer and use it in GitHub Desktop.
Save paulfryzel/11236972 to your computer and use it in GitHub Desktop.
c.cdef(`
typedef int size_t;
typedef struct _IO_FILE FILE;
FILE *fopen( const char *filename, const char *mode );
FILE *fdopen( int fildes, const char *mode );
int fflush( FILE *stream );
int fclose( FILE *stream );
int fgetc( FILE *stream );
int ungetc( int ch, FILE *stream );
char *fgets( char *str, int count, FILE *stream );
size_t fread( void *buffer, size_t size, size_t count, FILE *stream );
long ftell( FILE *stream );
int fseek( FILE *stream, long offset, int origin );
void rewind( FILE *stream );
int feof( FILE *stream );
size_t fwrite( const void *buffer, size_t size, size_t count, FILE *stream );
int fputc( int ch, FILE *stream );
int remove( const char *fname );
int rename( const char *old_filename, const char *new_filename );
char *tmpnam( char *filename );
FILE *tmpfile();
`);
if (ffi.os === "OSX") {
c.cdef(`
FILE *__stdoutp;
FILE *__stdinp;
FILE *__stderrp;
`);
} else if (ffi.os === "BSD") {
c.cdef(`
FILE *__stdoutp;
FILE *__stdinp;
FILE *__stderrp;
`);
} else {
c.cdef(`
FILE *stdout;
FILE *stdin;
FILE *stderr;
`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment