Rev 300 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
300 | serge | 1 | |
2 | |||
3 | |||
4 | #ifdef __cplusplus |
||
5 | |||
6 | { |
||
7 | #endif |
||
8 | |||
9 | typedef unsigned char byte; |
||
10 | |||
11 | typedef unsigned int dword; |
||
12 | |||
13 | typedef unsigned int fpos_t; |
||
14 | |||
15 | |||
16 | #//define NULL (void*)0 |
||
17 | |||
324 | serge | 18 | #define SEEK_SET 0 |
300 | serge | 19 | |
324 | serge | 20 | #define SEEK_END 2 |
21 | |||
22 | #define FILE_OPEN_READ 0x01 |
||
300 | serge | 23 | |
24 | #define FILE_OPEN_APPEND 0x04 |
||
25 | #define FILE_OPEN_TEXT 0x08 |
||
26 | #define FILE_OPEN_PLUS 0x10 |
||
27 | #define EOF -1 |
||
28 | |||
29 | typedef struct |
||
30 | |||
31 | char *buffer; |
||
32 | char *stream; |
||
33 | size_t strpos; |
||
34 | size_t remain; |
||
35 | |||
36 | size_t filepos; |
||
37 | |||
38 | size_t buffersize; |
||
39 | |||
40 | char* filename; |
||
41 | int mode; |
||
42 | } FILE; |
||
43 | |||
44 | extern FILE* fopen(const char* filename, const char *mode); |
||
45 | |||
46 | extern int feof(FILE* file); |
||
47 | extern int fflush(FILE* file); |
||
48 | extern int fgetc(FILE* file); |
||
49 | extern int fgetpos(FILE* file,fpos_t* pos); |
||
50 | extern int fsetpos(FILE* file,const fpos_t* pos); |
||
51 | extern int fputc(int c,FILE* file); |
||
52 | extern int fread(void* buffer,size_t size,size_t count,FILE* file); |
||
53 | extern int fwrite(const void* buffer,size_t size,size_t count,FILE* file); |
||
54 | extern long ftell(FILE* file); |
||
55 | extern int fseek(FILE* file,long offset,int origin); |
||
56 | extern void rewind(FILE* file); |
||
57 | extern int fprintf(FILE* file, const char* format, ...); |
||
58 | extern int fscanf(FILE* file,const char* format, ...); |
||
59 | extern int ungetc(int c,FILE* file); |
||
60 | |||
61 | extern int sprintf(char *dest, const char *format,...); |
||
62 | |||
63 | |||
64 | typedef char *va_list; |
||
65 | |||
66 | #define va_start(ap,v) (ap = (va_list)&v+_roundsize(v)) |
||
67 | #define va_arg(ap,t) ( *(t *)((ap += _roundsize(t)) - _roundsize(t)) ) |
||
68 | #define va_end(ap) (ap = (va_list)0) |
||
69 | |||
70 | /* |
||
71 | |||
72 | ** Integer argument (c) must be in ASCII range (0-127) for |
||
73 | ** dependable answers. |
||
74 | */ |
||
75 | |||
76 | #define ALNUM 1 |
||
77 | |||
78 | #define CNTRL 4 |
||
79 | #define DIGIT 8 |
||
80 | #define GRAPH 16 |
||
81 | #define LOWER 32 |
||
82 | #define PRINT 64 |
||
83 | #define PUNCT 128 |
||
84 | #define BLANK 256 |
||
85 | #define UPPER 512 |
||
86 | #define XDIGIT 1024 |
||
87 | |||
88 | extern short int _is[128]; |
||
89 | |||
90 | #define isalnum(c)(_is[c] & ALNUM ) /* 'a'-'z', 'A'-'Z', '0'-'9' */ |
||
91 | |||
92 | #define iscntrl(c)(_is[c] & CNTRL ) /* 0-31, 127 */ |
||
93 | #define isdigit(c)(_is[c] & DIGIT ) /* '0'-'9' */ |
||
94 | #define isgraph(c)(_is[c] & GRAPH ) /* '!'-'~' */ |
||
95 | #define islower(c)(_is[c] & LOWER ) /* 'a'-'z' */ |
||
96 | #define isprint(c)(_is[c] & PRINT ) /* ' '-'~' */ |
||
97 | #define ispunct(c)(_is[c] & PUNCT ) /* !alnum && !cntrl && !space */ |
||
98 | #define isspace(c)(_is[c] & BLANK ) /* HT, LF, VT, FF, CR, ' ' */ |
||
99 | #define isupper(c)(_is[c] & UPPER ) /* 'A'-'Z' */ |
||
100 | #define isxdigit(c)(_is[c] & XDIGIT) /* '0'-'9', 'a'-'f', 'A'-'F' */ |
||
101 | |||
102 | |||
103 | |||
104 | |||
105 | #define _DIGIT 0x20 |
||
106 | #define _XDIGT 0x10 |
||
107 | #define _PRINT 0x08 |
||
108 | #define _PUNCT 0x04 |
||
109 | #define _SPACE 0x02 |
||
110 | #define _CNTRL 0x01 |
||
111 | |||
112 | #define abs(i) (((i)<0)?(-(i)):(i)) |
||
113 | |||
114 | #if 0 |
||
115 | |||
324 | serge | 116 | extern int atoi(char *s); |
300 | serge | 117 | extern char tolower(char c); |
118 | extern char toupper(char c); |
||
119 | extern void itoab(int n,char* s,int b); |
||
120 | extern void itoa(int n,char* s); |
||
121 | |||
122 | extern char* strcat(char*,const char*); |
||
123 | |||
124 | extern int strcmp(const char*,const char*); |
||
125 | extern int strcoll(const char*,const char*); |
||
126 | extern char* strcpy(char*,const char*); |
||
127 | extern int strcspn(const char*,const char*); |
||
128 | extern size_t strlen(const char*); |
||
129 | extern char* strncat(char*,const char*,int); |
||
130 | extern int strncmp(const char*,const char*,int); |
||
131 | extern char* strncpy(char*,const char*,int); |
||
132 | extern char* strpbrk(const char*,const char*); |
||
133 | extern char* strrchr(const char*,int); |
||
134 | extern int strspn(const char*,const char*); |
||
135 | extern char* strstr(const char*,const char*); |
||
136 | extern char* strtok(char*,const char*); |
||
137 | extern int strxfrm(char*,const char*,int); |
||
138 | extern char* strdup(const char*); |
||
139 | extern char toupper(char c); |
||
140 | #define isascii(char) ( (unsigned)char < 0x80 ) |
||
141 | |||
142 | extern void* memchr(const void*,int,int); |
||
143 | |||
144 | extern int memcmp(const void*,const void*,int); |
||
324 | serge | 145 | extern void* memcpy(void*,const void*,size_t); |
300 | serge | 146 | void kmemset (void *dst, int val, size_t count); |
324 | serge | 147 | |
148 | extern void* memmove(void*,const void*,int); |
||
149 | |||
300 | serge | 150 | int memcmp(const void*,const void*,int); |
151 | extern void* memcpy(void*,const void*,size_t); |
||
324 | serge | 152 | void kmemset (void *dst, int val, size_t count); |
153 | |||
154 | extern void* memmove(void*,const void*,int); |
||
300 | serge | 155 | |
324 | serge | 156 | |
157 | #endif |
||
300 | serge | 158 | |
324 | serge | 159 | void debug_out_str(char* str); |
300 | serge | 160 | |
324 | serge | 161 | void* _cdecl dlmalloc(size_t size); |
162 | |||
163 | void _cdecl dlfree(void *mem); |
||
164 | |||
165 | //double pow_test(x,y); |
||
166 | |||
167 | |||
168 | |||
169 | |||
300 | serge | 170 | } |
171 | #endif |
||
172 | |||
173 | #endif //kolibc_h>0)?(-(i)):(i)) |
||
174 | |||
324 | serge | 175 | #if> |
176 |