source: buchla-68k/include/stdio.h@ 0170798

Last change on this file since 0170798 was 5fa506d, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Include file cleanup.

  • Property mode set to 100644
File size: 1.8 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#pragma once
9
10#include "fspars.h" /* file system parameters */
11#include "stdint.h"
12
13#define EOF -1
14
15#define fgetc getc
16#define fputc putc
17
18#define _BUSY 0x01
19#define _ALLBUF 0x02
20#define _DIRTY 0x04
21#define _EOF 0x08
22#define _IOERR 0x10
23
24typedef struct {
25
26 int8_t *_bp; /* current position in buffer */
27 int8_t *_bend; /* last character in buffer + 1 */
28 int8_t *_buff; /* address of buffer */
29 int8_t _flags; /* {_BUSY, _ALLBUF, _DIRTY, _EOF, _IOERR} */
30 int8_t _unit; /* fd token returned by open */
31 int8_t _bytbuf; /* single byte buffer for unbuffered streams */
32 int8_t _pad; /* pad for alignment -- possibly use later */
33 int16_t _buflen; /* length of buffer */
34
35} FILE;
36
37#define stdin (&Cbuffs[0])
38#define stdout (&Cbuffs[1])
39#define stderr (&Cbuffs[2])
40
41#define getchar() getc(stdin)
42#define putchar(c) putc(c, stdout)
43#define feof(fp) (((fp)->_flags & _EOF) != 0)
44#define ferror(fp) (((fp)->_flags & _IOERR) != 0)
45#define clearerr(fp) ((fp)->_flags &= ~(_IOERR | _EOF))
46#define fileno(fp) ((fp)->_unit)
47
48#define O_RDONLY 0x0000 /* Read-only value */
49#define O_WRONLY 0x0001 /* Write-only value */
50#define O_RDWR 0x0002 /* Read-write value */
51
52#define O_NDELAY 0x0004 /* Non-blocking I/O flag */
53#define O_APPEND 0x0008 /* Append mode flag (write only at end) */
54
55#define O_CREAT 0x0100 /* File creation flag (uses 3rd argument) */
56#define O_TRUNC 0x0200 /* File truncation flag */
57#define O_EXCL 0x0400 /* Exclusive access flag */
58
59#define O_RAW 0x8000 /* Raw (binary) I/O flag for getc and putc */
Note: See TracBrowser for help on using the repository browser.