Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
  2. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  3.  
  4. #ifndef __dj_include_stdio_h_
  5. #define __dj_include_stdio_h_
  6.  
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10.  
  11. #include<menuet/os.h>
  12.  
  13. #include<stdarg.h>
  14.  
  15. typedef struct __FILE FILE;
  16.  
  17. #ifndef __dj_ENFORCE_ANSI_FREESTANDING
  18.  
  19.  
  20. #include <sys/version.h>
  21. #include <sys/djtypes.h>
  22. #include <dos.h>
  23.  
  24. #define _IOFBF          00001
  25. #define _IONBF          00002
  26. #define _IOLBF          00004
  27.  
  28. /* Some programs think they know better... */
  29. #undef NULL
  30.  
  31. #define BUFSIZ          16384
  32. #define EOF             (-1)
  33. #define FILENAME_MAX    260
  34. #define FOPEN_MAX       20
  35. #define L_tmpnam        260
  36. #define NULL            0
  37. #define TMP_MAX         999999
  38.  
  39. #define SEEK_SET        0
  40. #define SEEK_CUR        1
  41. #define SEEK_END        2
  42.  
  43. __DJ_va_list
  44. #undef __DJ_va_list
  45. #define __DJ_va_list
  46. __DJ_size_t
  47. #undef __DJ_size_t
  48. #define __DJ_size_t
  49.  
  50. /* Note that the definitions of these fields are NOT guaranteed!  They
  51.    may change with any release without notice!  The fact that they
  52.    are here at all is to comply with ANSI specifictions. */
  53.  
  54. #include<bits/stdio.h>
  55.    
  56. struct __FILE {
  57.   int   _cnt;
  58.   char *_ptr;
  59.   char *_base;
  60.   int   _bufsiz;
  61.   int   _flag;
  62.   int   _file;
  63.   char *_name_to_remove;
  64.   int   _fillsize;
  65.   struct file_stream_ops * std_ops;
  66. };
  67.  
  68. typedef unsigned long           fpos_t;
  69.  
  70. extern FILE __dj_stdin, __dj_stdout, __dj_stderr;
  71. #define stdin   (&__dj_stdin)
  72. #define stdout  (&__dj_stdout)
  73. #define stderr  (&__dj_stderr)
  74.  
  75. void    clearerr(FILE *_stream);
  76. int     fclose(FILE *_stream);
  77. int     feof(FILE *_stream);
  78. int     ferror(FILE *_stream);
  79. int     fflush(FILE *_stream);
  80. int     fgetc(FILE *_stream);
  81. int     fgetpos(FILE *_stream, fpos_t *_pos);
  82. char *  fgets(char *_s, int _n, FILE *_stream);
  83. FILE *  fopen(const char *_filename, const char *_mode);
  84. int     fprintf(FILE *_stream, const char *_format, ...);
  85. int     fputc(int _c, FILE *_stream);
  86. int     fputs(const char *_s, FILE *_stream);
  87. size_t  fread(void *_ptr, size_t _size, size_t _nelem, FILE *_stream);
  88. FILE *  freopen(const char *_filename, const char *_mode, FILE *_stream);
  89. int     fscanf(FILE *_stream, const char *_format, ...);
  90. int     fseek(FILE *_stream, long _offset, int _mode);
  91. int     fsetpos(FILE *_stream, const fpos_t *_pos);
  92. long    ftell(FILE *_stream);
  93. size_t  fwrite(const void *_ptr, size_t _size, size_t _nelem, FILE *_stream);
  94. int     getc(FILE *_stream);
  95. int     getchar(void);
  96. //char *        gets(char *_s);
  97. void    perror(const char *_s);
  98. //int   printf(const char *_format, ...);
  99. int     putc(int _c, FILE *_stream);
  100. int     putchar(int _c);
  101. int     puts(const char *_s);
  102. int     remove(const char *_filename);
  103. int     rename(const char *_old, const char *_new);
  104. void    rewind(FILE *_stream);
  105. int     scanf(const char *_format, ...);
  106. void    setbuf(FILE *_stream, char *_buf);
  107. int     setvbuf(FILE *_stream, char *_buf, int _mode, size_t _size);
  108. int     sprintf(char *_s, const char *_format, ...);
  109. int     sscanf(const char *_s, const char *_format, ...);
  110. FILE *  tmpfile(void);
  111. char *  tmpnam(char *_s);
  112. int     ungetc(int _c, FILE *_stream);
  113. int     vfprintf(FILE *_stream, const char *_format, va_list _ap);
  114. int     vprintf(const char *_format, va_list _ap);
  115. int     vsprintf(char *_s, const char *_format, va_list _ap);
  116.  
  117. #ifndef __STRICT_ANSI__
  118.  
  119. #define L_ctermid
  120. #define L_cusrid
  121. /* #define STREAM_MAX   20 - DOS can change this */
  122.  
  123. int     fileno(FILE *_stream);
  124. FILE *  fdopen(int _fildes, const char *_type);
  125. int     pclose(FILE *_pf);
  126. FILE *  popen(const char *_command, const char *_mode);
  127.  
  128. #ifndef _POSIX_SOURCE
  129.  
  130. extern FILE __dj_stdprn, __dj_stdaux;
  131. #define stdprn  (&__dj_stdprn)
  132. #define stdaux  (&__dj_stdaux)
  133.  
  134. #define P_tmpdir "c:/"
  135.  
  136. void    _djstat_describe_lossage(FILE *_to_where);
  137. int     _doprnt(const char *_fmt, va_list _args, FILE *_f);
  138. int     _doscan(FILE *_f, const char *_fmt, va_list _argp);
  139. int     _doscan_low(FILE *, int (*)(FILE *_get), int (*_unget)(int, FILE *), const char *_fmt, va_list _argp);
  140. int     fpurge(FILE *_f);
  141. int     getw(FILE *_f);
  142. int     mkstemp(char *_template);
  143. char *  mktemp(char *_template);
  144. int     putw(int _v, FILE *_f);
  145. void    setbuffer(FILE *_f, void *_buf, int _size);
  146. void    setlinebuf(FILE *_f);
  147. char *  tempnam(const char *_dir, const char *_prefix);
  148. int     _rename(const char *_old, const char *_new);    /* Simple (no directory) */
  149. int     vfscanf(FILE *_stream, const char *_format, va_list _ap);
  150. int     vscanf(const char *_format, va_list _ap);
  151. int     vsscanf(const char *_s, const char *_format, va_list _ap);
  152.  
  153. #endif /* !_POSIX_SOURCE */
  154. #endif /* !__STRICT_ANSI__ */
  155. #endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
  156.  
  157. #ifndef __dj_ENFORCE_FUNCTION_CALLS
  158. #endif /* !__dj_ENFORCE_FUNCTION_CALLS */
  159.  
  160. #ifdef __cplusplus
  161. }
  162. #endif
  163.  
  164. #endif /* !__dj_include_stdio_h_ */
  165.