Clean up and document API for hashes
[p5sagit/p5-mst-13.2.git] / perlsdio.h
index ff32cdd..f5c2921 100644 (file)
 #define PerlIO_close(f)                        fclose(f)
 #define PerlIO_puts(f,s)               fputs(s,f)
 #define PerlIO_putc(f,c)               fputc(c,f)
-#define PerlIO_ungetc(f,c)             ungetc(c,f)
-#define PerlIO_getc(f)                 getc(f)
+#if defined(VMS) && defined(__DECC)
+   /* Unusual definition of ungetc() here to accomodate fast_sv_gets()'
+    * belief that it can mix getc/ungetc with reads from stdio buffer */
+   int decc$ungetc(int __c, FILE *__stream);
+#  define PerlIO_ungetc(f,c) ((c) == EOF ? EOF : \
+          ((*(f) && !((*(f))->_flag & _IONBF) && \
+          ((*(f))->_ptr > (*(f))->_base)) ? \
+          ((*(f))->_cnt++, *(--(*(f))->_ptr) = (c)) : decc$ungetc(c,f)))
+   /* Work around bug in DECCRTL/AXP (DECC v5.x) which causes read
+    * from a pipe after EOF has been returned once to hang.
+    */
+#  define PerlIO_getc(f)               (feof(f) ? EOF : getc(f))
+#else
+#  define PerlIO_ungetc(f,c)           ungetc(c,f)
+#  define PerlIO_getc(f)               getc(f)
+#endif
 #define PerlIO_eof(f)                  feof(f)
 #define PerlIO_getname(f,b)            fgetname(f,b)
 #define PerlIO_error(f)                        ferror(f)
 #undef setvbuf
 #undef fscanf
 #undef fgets
+#undef getc_unlocked
+#undef putc_unlocked
 #define fprintf    _CANNOT _fprintf_
 #define stdin      _CANNOT _stdin_
 #define stdout     _CANNOT _stdout_