OpenCores
URL https://opencores.org/ocsvn/thor/thor/trunk

Subversion Repositories thor

[/] [thor/] [trunk/] [software/] [c64libc/] [source/] [stdio.h] - Blame information for rev 27

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 22 robfinch
#ifndef STDIO_H
2
#define STDIO_H
3
 
4
#ifndef YVALS_H
5
#include <yvals.h>
6
#endif
7
 
8
#define NULL    _NULL
9
#define _IOFBF  0
10
#define _IOLBF  1
11
#define _IONBF  2
12
#define BUFSIZ  512
13
#define EOF             -1
14
#define FILENAME_MAX    _FNAMAX
15
#define FOPEN_MAX               _FOPMAX
16
#define L_tmpnam                _TNAMX
17
#define TMP_MAX         32
18
#define SEEK_SET        0
19
#define SEEK_CUR        1
20
#define SEEK_END        2
21
#define stdin   _Files[0]
22
#define stdout  _Files[1]
23
#define stderr  _Files[2]
24
// type definitions
25
#ifndef _SIZET
26
#define _SIZET
27
typedef _Sizet size_t;
28
#endif
29
typedef struct {
30
        unsigned long _Off;
31
} fpos_t;
32
typedef struct {
33
        unsigned short _Mode;
34
        short _Handle;
35
        unsigned byte *_Buf, *_Bend, *_Next;
36
        unsigned byte *_Rend, *_Rsave, *_Wend;
37
        unsigned char _Back[2], _Cbuf, _Nback;
38
        char *_Tmpnam;
39
} FILE;
40
// declarations
41
void clearerr(FILE *f);
42
int fclose(FILE *f);
43
int feof(FILE *f);
44
int ferror(FILE *f);
45
int fflush(FILE *f);
46
int fgetc(FILE *f);
47
int fgetpos(FILE *f, fpos_t *p);
48
char *fgets(char *p, int n, FILE *f);
49
FILE *fopen(char *p, char *q);
50
int fprintf(FILE *f, char *);
51
int fputc(int n, FILE *f);
52
int fputs(char *p, FILE *f);
53
size_t fread(void *p, size_t n, size_t m, FILE *f);
54
FILE *freopen(char *p, char *q, FILE *f);
55
int fscanf(FILE *f, char *);
56
int fseek(FILE *f, long p, int n);
57
int fsetpos(FILE *f, fpos_t *p);
58
long ftell(FILE *f);
59
size_t fwrite(void *v, size_t n, size_t m, FILE *f);
60
int getc(FILE *f);
61
int getchar(void);
62
char *gets(char *p);
63
void perror(char *p);
64
int printf(char *p);
65
int putc(int n, FILE *f);
66
int putchar(int ch);
67
int puts(char *p);
68
int remove(char *n);
69
int rename(char *n);
70
void rewind(FILE *f);
71
int scanf(char *);
72
void setbuf(FILE *f, char *p);
73
int setvbuf(FILE *, char *, int, size_t);
74
int sprintf(char *p, char *q);
75
int sscanf(char *p, char *q);
76
FILE *tmpfile(void);
77
char *tmpnam(char *p);
78
int ungetc(int n, FILE *f);
79
int vfprintf(FILE *f, char *p, char *q);
80
int vprintf(char *p, char *q);
81
long _Fgpos(FILE *f, fpos_t *p);
82
int _Fspos(FILE *f, fpos_t *p, long n, int m);
83
extern FILE *_Files[FOPEN_MAX];
84
 
85
// Macro overrides
86
#define fgetpos(str, ptr)       (int)_Fgpos(str,ptr)
87
#define fseek(str,off,way)      _Fspos(str, _NULL, off, way)
88
#define fsetpos(str, ptr)       _Fspos(str, ptr, 0L, 0)
89
#define ftell(str)                      _Fgpos(str, _NULL)
90
#define getc(str)                       ((str)->_Next < (str)->_Rend ? *(str)->_Next++ : (getc)(str))
91
//#define getchar()                     (_Files[0]->_Next < _Files[0]->_Rend ? *_Files[0]->_Next++ : (getchar)())
92
#define putc(c,str)                     ((str)->_Next < (str)->_Wend ? (*(str)->_Next++ = c) : (putc)(c,str))
93
#define putchar(c)                      (_Files[1]->_Next < _Files[1]->_Wend ? (*_Files[1]->_Next++ = c) : (putchar)(c))
94
 
95
 
96
pascal void putch(char ch);
97
pascal void putnum(int num, int wid, char sep);
98
pascal void puthexnum(int num, int wid);
99
pascal int putstr(char *p, int max);
100
int getchar2( );
101
 
102
//int getchar( );
103
int printf(char *, ...);
104
 
105
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.