| 1 | /* |
| 2 | * Copyright © 2001 Novell, Inc. All Rights Reserved. |
| 3 | * |
| 4 | * You may distribute under the terms of either the GNU General Public |
| 5 | * License or the Artistic License, as specified in the README file. |
| 6 | * |
| 7 | */ |
| 8 | |
| 9 | /* |
| 10 | * FILENAME : nwstdio.h |
| 11 | * DESCRIPTION : Making stdio calls go thro' the |
| 12 | * NetWare specific implementation. |
| 13 | * This gets included if PERLIO_IS_STDIO. Instead |
| 14 | * of directly calling stdio functions this goes |
| 15 | * thro' IPerlStdIO, this ensures that cgi2perl |
| 16 | * can call CGI functions and send the o/p to |
| 17 | * browser or console. |
| 18 | * Author : SGP |
| 19 | * Date Created : June 29th 2001. |
| 20 | * Date Modified: June 30th 2001. |
| 21 | */ |
| 22 | |
| 23 | #ifndef ___NWStdio_H___ |
| 24 | #define ___NWStdio_H___ |
| 25 | |
| 26 | #define PerlIO FILE |
| 27 | |
| 28 | #define PerlIO_putc(f,c) (*PL_StdIO->pPutc)(PL_StdIO, (f),(c)) |
| 29 | #define PerlIO_fileno(f) (*PL_StdIO->pFileno)(PL_StdIO, (f)) |
| 30 | #define PerlIO_close(f) (*PL_StdIO->pClose)(PL_StdIO, (f)) |
| 31 | #define PerlIO_stderr() (*PL_StdIO->pStderr)(PL_StdIO) |
| 32 | #define PerlIO_printf Perl_fprintf_nocontext |
| 33 | #define PerlIO_vprintf(f,fmt,a) (*PL_StdIO->pVprintf)(PL_StdIO, (f),(fmt),a) |
| 34 | #define PerlIO_flush(f) (*PL_StdIO->pFlush)(PL_StdIO, (f)) |
| 35 | #define PerlIO_stdout() (*PL_StdIO->pStdout)(PL_StdIO) |
| 36 | #define PerlIO_stdin() (*PL_StdIO->pStdin)(PL_StdIO) |
| 37 | #define PerlIO_clearerr(f) (*PL_StdIO->pClearerr)(PL_StdIO, (f)) |
| 38 | #define PerlIO_fdopen(f,s) (*PL_StdIO->pFdopen)(PL_StdIO, (f),(s)) |
| 39 | #define PerlIO_getc(f) (*PL_StdIO->pGetc)(PL_StdIO, (f)) |
| 40 | #define PerlIO_ungetc(f,c) (*PL_StdIO->pUngetc)(PL_StdIO, (c),(f)) |
| 41 | #define PerlIO_tell(f) (*PL_StdIO->pTell)(PL_StdIO, (f)) |
| 42 | #define PerlIO_seek(f,o,w) (*PL_StdIO->pSeek)(PL_StdIO, (f),(o),(w)) |
| 43 | #define PerlIO_error(f) (*PL_StdIO->pError)(PL_StdIO, (f)) |
| 44 | #define PerlIO_write(f,buf,size) (*PL_StdIO->pWrite)(PL_StdIO, (buf), (size),1, (f)) |
| 45 | #define PerlIO_puts(f,s) (*PL_StdIO->pPuts)(PL_StdIO, (f),(s)) |
| 46 | #define PerlIO_read(f,buf,size) (*PL_StdIO->pRead)(PL_StdIO, (buf), (size), 1, (f)) |
| 47 | #define PerlIO_eof(f) (*PL_StdIO->pEof)(PL_StdIO, (f)) |
| 48 | //#define PerlIO_fdupopen(f) (*PL_StdIO->pFdupopen)(PL_StdIO, (f)) |
| 49 | #define PerlIO_reopen(p,m,f) (*PL_StdIO->pReopen)(PL_StdIO, (p), (m), (f)) |
| 50 | #define PerlIO_open(x,y) (*PL_StdIO->pOpen)(PL_StdIO, (x),(y)) |
| 51 | |
| 52 | #ifdef HAS_SETLINEBUF |
| 53 | #define PerlIO_setlinebuf(f) (*PL_StdIO->pSetlinebuf)(PL_StdIO, (f)) |
| 54 | #else |
| 55 | #define PerlIO_setlinebuf(f) setvbuf(f, NULL, _IOLBF, 0) |
| 56 | #endif |
| 57 | |
| 58 | #define PerlIO_isutf8(f) 0 |
| 59 | |
| 60 | #ifdef USE_STDIO_PTR |
| 61 | #define PerlIO_has_cntptr(f) 1 |
| 62 | #define PerlIO_get_ptr(f) FILE_ptr(f) |
| 63 | #define PerlIO_get_cnt(f) FILE_cnt(f) |
| 64 | |
| 65 | #ifdef STDIO_CNT_LVALUE |
| 66 | #define PerlIO_canset_cnt(f) 1 |
| 67 | #define PerlIO_set_cnt(f,c) (FILE_cnt(f) = (c)) |
| 68 | #ifdef STDIO_PTR_LVALUE |
| 69 | #ifdef STDIO_PTR_LVAL_NOCHANGE_CNT |
| 70 | #define PerlIO_fast_gets(f) 1 |
| 71 | #endif |
| 72 | #endif /* STDIO_PTR_LVALUE */ |
| 73 | #else /* STDIO_CNT_LVALUE */ |
| 74 | #define PerlIO_canset_cnt(f) 0 |
| 75 | #define PerlIO_set_cnt(f,c) abort() |
| 76 | #endif |
| 77 | |
| 78 | #ifdef STDIO_PTR_LVALUE |
| 79 | #ifdef STDIO_PTR_LVAL_NOCHANGE_CNT |
| 80 | #define PerlIO_set_ptrcnt(f,p,c) STMT_START {FILE_ptr(f) = (p), PerlIO_set_cnt(f,c);} STMT_END |
| 81 | #else |
| 82 | #ifdef STDIO_PTR_LVAL_SETS_CNT |
| 83 | /* assert() may pre-process to ""; potential syntax error (FILE_ptr(), ) */ |
| 84 | #define PerlIO_set_ptrcnt(f,p,c) STMT_START {FILE_ptr(f) = (p); assert(FILE_cnt(f) == (c));} STMT_END |
| 85 | #define PerlIO_fast_gets(f) 1 |
| 86 | #else |
| 87 | #define PerlIO_set_ptrcnt(f,p,c) abort() |
| 88 | #endif |
| 89 | #endif |
| 90 | #endif |
| 91 | |
| 92 | #else /* USE_STDIO_PTR */ |
| 93 | |
| 94 | #define PerlIO_has_cntptr(f) 0 |
| 95 | #define PerlIO_canset_cnt(f) 0 |
| 96 | #define PerlIO_get_cnt(f) (abort(),0) |
| 97 | #define PerlIO_get_ptr(f) (abort(),(void *)0) |
| 98 | #define PerlIO_set_cnt(f,c) abort() |
| 99 | #define PerlIO_set_ptrcnt(f,p,c) abort() |
| 100 | |
| 101 | #endif /* USE_STDIO_PTR */ |
| 102 | |
| 103 | #ifndef PerlIO_fast_gets |
| 104 | #define PerlIO_fast_gets(f) 0 |
| 105 | #endif |
| 106 | |
| 107 | #ifdef FILE_base |
| 108 | #define PerlIO_has_base(f) 1 |
| 109 | #define PerlIO_get_bufsiz(f) (*PL_StdIO->pGetBufsiz)(PL_StdIO, (f)) |
| 110 | #define PerlIO_get_base(f) (*PL_StdIO->pGetBase)(PL_StdIO, (f)) |
| 111 | #else |
| 112 | #define PerlIO_has_base(f) 0 |
| 113 | #define PerlIO_get_base(f) (abort(),(void *)0) |
| 114 | #define PerlIO_get_bufsiz(f) (abort(),0) |
| 115 | #endif |
| 116 | |
| 117 | #define PerlIO_importFILE(f,fl) (f) |
| 118 | #define PerlIO_exportFILE(f,fl) (f) |
| 119 | #define PerlIO_findFILE(f) (f) |
| 120 | #define PerlIO_releaseFILE(p,f) ((void) 0) |
| 121 | |
| 122 | #endif /* ___NWStdio_H___ */ |