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

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

Started to rework include files.

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