Subversion Repositories Kolibri OS

Rev

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