source: buchla-68k/orig/lib/INCLUDE/STDIO.H@ f40d52b

Last change on this file since f40d52b was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Imported original source code.

  • Property mode set to 100755
File size: 2.1 KB
Line 
1/*
2 =============================================================================
3 stdio.h -- Standard I/O Package header for the Buchla 700
4 Version 6 -- 1987-10-20 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "fspars.h" /* file system parameters */
9
10#define NULL 0
11#define EOF -1
12
13#define fgetc getc
14#define fputc putc
15
16#define _BUSY 0x01
17#define _ALLBUF 0x02
18#define _DIRTY 0x04
19#define _EOF 0x08
20#define _IOERR 0x10
21
22typedef struct {
23
24 char *_bp; /* current position in buffer */
25 char *_bend; /* last character in buffer + 1 */
26 char *_buff; /* address of buffer */
27 char _flags; /* {_BUSY, _ALLBUF, _DIRTY, _EOF, _IOERR} */
28 char _unit; /* fd token returned by open */
29 char _bytbuf; /* single byte buffer for unbuffered streams */
30 char _pad; /* pad for alignment -- possibly use later */
31 int _buflen; /* length of buffer */
32
33} FILE;
34
35#ifndef _FS_DEF_
36
37extern FILE Cbuffs[NSTREAMS]; /* table of FILE structures */
38extern char *Stdbufs; /* free list of buffers */
39extern long Stdbuf[MAXDFILE][BUFSIZL]; /* buffers */
40
41#endif
42
43extern long ftell();
44extern char *gets(), *fgets();
45extern FILE *fopen(), *fopena(), *fopenb();
46
47#define stdin (&Cbuffs[0])
48#define stdout (&Cbuffs[1])
49#define stderr (&Cbuffs[2])
50
51#define getchar() getc(stdin)
52#define putchar(c) putc(c, stdout)
53#define feof(fp) (((fp)->_flags & _EOF) != 0)
54#define ferror(fp) (((fp)->_flags & _IOERR) != 0)
55#define clearerr(fp) ((fp)->_flags &= ~(_IOERR | _EOF))
56#define fileno(fp) ((fp)->_unit)
57
58#ifndef O_RDONLY /* only define these once */
59
60#define O_RDONLY 0x0000 /* Read-only value */
61#define O_WRONLY 0x0001 /* Write-only value */
62#define O_RDWR 0x0002 /* Read-write value */
63
64#define O_NDELAY 0x0004 /* Non-blocking I/O flag */
65#define O_APPEND 0x0008 /* Append mode flag (write only at end) */
66
67#define O_CREAT 0x0100 /* File creation flag (uses 3rd argument) */
68#define O_TRUNC 0x0200 /* File truncation flag */
69#define O_EXCL 0x0400 /* Exclusive access flag */
70
71#define O_RAW 0x8000 /* Raw (binary) I/O flag for getc and putc */
72
73#endif
Note: See TracBrowser for help on using the repository browser.