home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / c / zoo_src / z201src2 / zooio.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-25  |  2.0 KB  |  80 lines

  1. /* @(#) zooio.h 2.7 88/01/27 19:39:24 */
  2.  
  3. /*
  4. Declarations for portable I/O
  5.  
  6. The contents of this file are hereby placed in the public domain.
  7.  
  8.                                             -- Rahul Dhesi 1988/01/24
  9. */
  10. #ifndef    OK_STDIO
  11. #include <stdio.h>
  12. #define    OK_STDIO
  13. #endif
  14.  
  15. #ifndef PARMS
  16. #ifdef LINT_ARGS
  17. #define    PARMS(x)        x
  18. #else
  19. #define    PARMS(x)        ()
  20. #endif
  21. #endif
  22.  
  23. /*
  24. In theory, all I/O using buffered files could be replaced with unbuffered
  25. I/O simply by changing the following definitions.  This has not been tried
  26. out yet, and there may be some remaining holes in the scheme.  On systems
  27. with limited memory, it might prove necessary to use unbuffered I/O
  28. only.
  29. */
  30. typedef FILE *ZOOFILE;
  31. #define NOFILE        ((ZOOFILE) 0)
  32. #define NULLFILE    ((ZOOFILE) -1)        /* or any unique value */
  33. #define STDOUT        stdout
  34.  
  35. #ifdef FILTER
  36. #define STDIN        stdin
  37. #endif
  38.  
  39. #ifdef IO_MACROS
  40. #define zooread(file, buffer, count)        fread (buffer, 1, count, file)
  41. #define zoowrite(file, buffer, count) \
  42.     (file == NULLFILE ? count : fwrite (buffer, 1, count, file))
  43. #define zooseek(file, offset, whence)        fseek (file, offset, whence)
  44. #define zootell(file)                            ftell (file)
  45. #else
  46. int zooread PARMS((ZOOFILE, char *, int));
  47. int zoowrite PARMS((ZOOFILE, char *, int));
  48. long zooseek PARMS((ZOOFILE, long, int));
  49. long zootell PARMS((ZOOFILE));
  50. #endif /* IO_MACROS */
  51.  
  52. ZOOFILE zooopen PARMS((char *, char *));
  53. ZOOFILE zoocreate PARMS((char *));
  54. int zooclose PARMS((ZOOFILE));
  55. int zootrunc PARMS((ZOOFILE));
  56.  
  57. #ifdef LINT_ARGS
  58. char *choosefname (struct direntry *);
  59. char *fullpath (struct direntry *);
  60. int frd_zooh (struct zoo_header *, ZOOFILE);
  61. int frd_dir (struct direntry *, ZOOFILE);
  62. int fwr_dir (struct direntry *, ZOOFILE);
  63. int fwr_zooh (struct zoo_header *, ZOOFILE);
  64. int readdir (struct direntry *, ZOOFILE, int);
  65. void rwheader (struct zoo_header *, ZOOFILE, int);
  66. void newdir (struct direntry *);
  67. void writedir (struct direntry *, ZOOFILE);
  68. #else
  69. char *choosefname ();
  70. char *fullpath ();
  71. int frd_zooh ();
  72. int frd_dir ();
  73. int fwr_dir ();
  74. int fwr_zooh ();
  75. int readdir ();
  76. void rwheader ();
  77. void newdir ();
  78. void writedir ();
  79. #endif
  80.