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

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

Added more functions to header files.

  • Property mode set to 100644
File size: 2.7 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 int8_t *_bp; /* current position in buffer */
25 int8_t *_bend; /* last character in buffer + 1 */
26 int8_t *_buff; /* address of buffer */
27 int8_t _flags; /* {_BUSY, _ALLBUF, _DIRTY, _EOF, _IOERR} */
28 int8_t _unit; /* fd token returned by open */
29 int8_t _bytbuf; /* single byte buffer for unbuffered streams */
30 int8_t _pad; /* pad for alignment -- possibly use later */
31 int16_t _buflen; /* length of buffer */
32
33} FILE;
34
35#ifndef _FS_DEF_
36
37extern FILE Cbuffs[NSTREAMS]; /* table of FILE structures */
38extern int8_t *Stdbufs; /* free list of buffers */
39extern int32_t Stdbuf[MAXDFILE][BUFSIZL]; /* buffers */
40
41#endif
42
43extern int32_t ftell(FILE *fp);
44extern int8_t *gets(int8_t *line);
45extern int8_t *fgets(int8_t *s, int16_t n, FILE *fp);
46extern FILE *fopen(int8_t *name, int8_t *mode);
47extern FILE *fopena(int8_t *name, int8_t *mode);
48extern FILE *fopenb(int8_t *name, int8_t *mode);
49extern int16_t fread(int8_t *buffer, uint16_t size, int16_t number, FILE *stream);
50extern int16_t fwrite(int8_t *buffer, int16_t size, int16_t number, FILE *stream);
51extern int16_t fseek(FILE *fp, int32_t pos, int16_t mode);
52extern int16_t fflush(FILE *ptr);
53extern int16_t fclose(FILE *ptr);
54
55extern int32_t printf(int8_t *fmt, ...);
56extern int32_t sprintf(int8_t *str, int8_t *fmt, ...);
57
58extern int16_t getc(FILE *ptr);
59extern int16_t putc(int16_t c, FILE *ptr);
60extern int16_t ungetc(int16_t c, FILE *ptr);
61
62#define stdin (&Cbuffs[0])
63#define stdout (&Cbuffs[1])
64#define stderr (&Cbuffs[2])
65
66#define getchar() getc(stdin)
67#define putchar(c) putc(c, stdout)
68#define feof(fp) (((fp)->_flags & _EOF) != 0)
69#define ferror(fp) (((fp)->_flags & _IOERR) != 0)
70#define clearerr(fp) ((fp)->_flags &= ~(_IOERR | _EOF))
71#define fileno(fp) ((fp)->_unit)
72
73#ifndef O_RDONLY /* only define these once */
74
75#define O_RDONLY 0x0000 /* Read-only value */
76#define O_WRONLY 0x0001 /* Write-only value */
77#define O_RDWR 0x0002 /* Read-write value */
78
79#define O_NDELAY 0x0004 /* Non-blocking I/O flag */
80#define O_APPEND 0x0008 /* Append mode flag (write only at end) */
81
82#define O_CREAT 0x0100 /* File creation flag (uses 3rd argument) */
83#define O_TRUNC 0x0200 /* File truncation flag */
84#define O_EXCL 0x0400 /* Exclusive access flag */
85
86#define O_RAW 0x8000 /* Raw (binary) I/O flag for getc and putc */
87
88#endif
Note: See TracBrowser for help on using the repository browser.