1.23
2.0
acw/focus-triggers
main
test-branch
| Line | |
|---|
| 1 | /* stdio.h: The CIVL representation of standard C library stdio.
|
|---|
| 2 | * Based on C11 Standard.
|
|---|
| 3 | */
|
|---|
| 4 | #ifdef __STDIO__
|
|---|
| 5 | #else
|
|---|
| 6 | #define __STDIO__
|
|---|
| 7 |
|
|---|
| 8 | /* Needed from stdarg.h: */
|
|---|
| 9 |
|
|---|
| 10 | typedef struct _ABC_va_list {
|
|---|
| 11 | int x;
|
|---|
| 12 | } va_list;
|
|---|
| 13 |
|
|---|
| 14 | /* Types */
|
|---|
| 15 |
|
|---|
| 16 | typedef unsigned long int size_t;
|
|---|
| 17 |
|
|---|
| 18 | /* Represents an actual file: something with a name and contents.
|
|---|
| 19 | * The name is a string (array of char). The contents is an
|
|---|
| 20 | * array of strings: each entry is a "chunk" of the file; the
|
|---|
| 21 | * file may be viewed as a concatenation of those chunks.
|
|---|
| 22 | */
|
|---|
| 23 | typedef struct CIVL_file_t {
|
|---|
| 24 | char name[];
|
|---|
| 25 | char contents[][];
|
|---|
| 26 | } CIVL_file_t;
|
|---|
| 27 |
|
|---|
| 28 | /* Implements the C notion of a FILE, which is really a reference
|
|---|
| 29 | * into a particular point of an actual file. Even if you are just
|
|---|
| 30 | * reading the file, this FILE object changes since it contains a reference
|
|---|
| 31 | * to the point of file you just read.
|
|---|
| 32 | *
|
|---|
| 33 | */
|
|---|
| 34 | typedef struct FILE {
|
|---|
| 35 | CIVL_file_t *file; // the actual file to which this refers
|
|---|
| 36 | int pos1; // the chunk index (first index) in the contents
|
|---|
| 37 | int pos2; // the character index (second index) in the contents
|
|---|
| 38 | int mode; // Stream mode: r/w/a
|
|---|
| 39 | _Bool isOpen; // is this FILE open?
|
|---|
| 40 | } FILE;
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 | typedef int fpos_t;
|
|---|
| 45 |
|
|---|
| 46 | /* Macros */
|
|---|
| 47 |
|
|---|
| 48 | #define NULL ((void*)0)
|
|---|
| 49 | #define _IOFBF 1
|
|---|
| 50 | #define _IOLBF 2
|
|---|
| 51 | #define _IONBF 3
|
|---|
| 52 | #define BUFSIZ 100
|
|---|
| 53 | #define EOF (-100)
|
|---|
| 54 | #define FOPEN_MAX 100
|
|---|
| 55 | #define FILENAME_MAX 500
|
|---|
| 56 | #define L_tmpnam 500
|
|---|
| 57 | #define SEEK_CUR 1
|
|---|
| 58 | #define SEEK_END 2
|
|---|
| 59 | #define SEEK_SET 3
|
|---|
| 60 | #define TMP_MAX 100
|
|---|
| 61 | #define stdin (FILE*)0
|
|---|
| 62 | #define stdout (FILE*)1
|
|---|
| 63 | #define stderr (FILE*)2
|
|---|
| 64 |
|
|---|
| 65 | /* Function Prototypes */
|
|---|
| 66 |
|
|---|
| 67 | #include<stdio-common.h>
|
|---|
| 68 |
|
|---|
| 69 | #endif
|
|---|
| 70 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.