Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
3.3 KiB

  1. /*** stdio20.h - linker I/O package
  2. *
  3. * Copyright <C> 1985, Microsoft Corporation
  4. *
  5. * Purpose:
  6. * This is optimized stdio package for linker. Advantages over standard
  7. * C run-time stdio are:
  8. * - smaller size
  9. * - greater speed
  10. * This package is not general nature and is tailored to linker
  11. * requrements.
  12. *
  13. *************************************************************************/
  14. #define NULL 0
  15. #define EOF (-1)
  16. #define _IOREAD 0x01
  17. #define _IOWRT 0x02
  18. #define _IOPEN 0x03
  19. #define _IONBF 0x04
  20. #define _IOEOF 0x10
  21. #define _IOERR 0x20
  22. #define _IOFBF 0x0
  23. #define CTRL_Z 0x1a
  24. typedef struct file
  25. {
  26. char *_ptr;
  27. int _cnt;
  28. char *_base;
  29. char _flag;
  30. char _file;
  31. int _bsize; /* buffer size */
  32. }
  33. FILE;
  34. extern FILE _iob[];
  35. extern int cdecl _filbuf(struct file *f);
  36. extern void cdecl _xfilbuf(struct file *f);
  37. extern int cdecl _flsbuf(unsigned int c,struct file *f);
  38. extern int cdecl fflush(struct file *f);
  39. extern int cdecl fclose(struct file *f);
  40. extern long cdecl ftell(struct file *f);
  41. extern int cdecl fseek(struct file *f,long lfa,int mode);
  42. extern int cdecl fgetc(struct file *f);
  43. extern int cdecl fputc(unsigned int c,struct file *f);
  44. extern int cdecl fputs(char *s,struct file *f);
  45. extern int cdecl fread(void *pobj,
  46. unsigned int cbobj,
  47. unsigned int nobj,
  48. struct file *f);
  49. extern int cdecl fwrite(char *pobj,int cbobj,int nobj,struct file *f);
  50. extern int cdecl ungetc(int c,struct file *f);
  51. extern void cdecl FlsStdio(void);
  52. extern struct file * cdecl fopen(char *name,char *mode);
  53. extern struct file * cdecl fdopen(int fh,char *mode);
  54. extern int cdecl setvbuf(struct file *fh,char *buf,int type,int size);
  55. #define stdin (&_iob[0])
  56. #define stdout (&_iob[1])
  57. #define stderr (&_iob[2])
  58. #define getc(p) (--(p)->_cnt>=0? *(p)->_ptr++&0377:_filbuf(p))
  59. #define putc(x,p) (--(p)->_cnt>=0? ((int)(*(p)->_ptr++=(char)(unsigned)(x))):_flsbuf((unsigned)(x),p))
  60. #define feof(p) (((p)->_flag&_IOEOF)!=0)
  61. #define ferror(p) (((p)->_flag&_IOERR)!=0)
  62. #define fileno(p) ((p)->_file)
  63. // The following functions are comming from standard C run-time library
  64. #if defined( _WIN32 )
  65. #ifndef _VA_LIST_DEFINED
  66. #ifdef _M_ALPHA
  67. typedef struct {
  68. char *a0; /* pointer to first homed integer argument */
  69. int offset; /* byte offset of next parameter */
  70. } va_list;
  71. #else
  72. typedef char * va_list;
  73. #endif
  74. #define _VA_LIST_DEFINED
  75. #endif
  76. #endif
  77. extern int cdecl sprintf(char *buf, const char *fmt, ...);
  78. extern int cdecl vsprintf(char *buf, const char *fmt, va_list pArgs);
  79. //
  80. // DLH Can't use fprintf or vfprintf from MSVCRT.DLL, since the FILE structure
  81. // is too different. Implemented in stdio20.c instead.
  82. //
  83. extern int cdecl fprintf(struct file *f, const char *fmt, ...);
  84. extern int cdecl vfprintf(struct file *f, const char *fmt, va_list pArgs);