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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [isoinfra/] [current/] [include/] [stdlib.h] - Blame information for rev 853

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

Line No. Rev Author Line
1 786 skrzyp
#ifndef CYGONCE_ISO_STDLIB_H
2
#define CYGONCE_ISO_STDLIB_H
3
/*========================================================================
4
//
5
//      stdlib.h
6
//
7
//      ISO standard library functions
8
//
9
//========================================================================
10
// ####ECOSGPLCOPYRIGHTBEGIN####
11
// -------------------------------------------
12
// This file is part of eCos, the Embedded Configurable Operating System.
13
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
14
//
15
// eCos is free software; you can redistribute it and/or modify it under
16
// the terms of the GNU General Public License as published by the Free
17
// Software Foundation; either version 2 or (at your option) any later
18
// version.
19
//
20
// eCos is distributed in the hope that it will be useful, but WITHOUT
21
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
23
// for more details.
24
//
25
// You should have received a copy of the GNU General Public License
26
// along with eCos; if not, write to the Free Software Foundation, Inc.,
27
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
28
//
29
// As a special exception, if other files instantiate templates or use
30
// macros or inline functions from this file, or you compile this file
31
// and link it with other works to produce a work based on this file,
32
// this file does not by itself cause the resulting work to be covered by
33
// the GNU General Public License. However the source code for this file
34
// must still be made available in accordance with section (3) of the GNU
35
// General Public License v2.
36
//
37
// This exception does not invalidate any other reasons why a work based
38
// on this file might be covered by the GNU General Public License.
39
// -------------------------------------------
40
// ####ECOSGPLCOPYRIGHTEND####
41
//========================================================================
42
//#####DESCRIPTIONBEGIN####
43
//
44
// Author(s):     jlarmour
45
// Contributors:
46
// Date:          2000-04-14
47
// Purpose:       This file provides the stdlib functions required by
48
//                ISO C and POSIX 1003.1.
49
// Description:   The real contents of this file get set from the
50
//                configuration (set by the implementation)
51
// Usage:         #include <stdlib.h>
52
//
53
//####DESCRIPTIONEND####
54
//
55
//======================================================================
56
*/
57
 
58
/* CONFIGURATION */
59
 
60
#include <pkgconf/isoinfra.h>          /* Configuration header */
61
 
62
/* INCLUDES */
63
 
64
/* This is the "standard" way to get NULL, wchar_t and size_t from stddef.h,
65
 * which is the canonical location of the definitions.
66
 */
67
#define __need_NULL
68
#define __need_size_t
69
#define __need_wchar_t
70
#include <stddef.h>
71
 
72
#include <cyg/infra/cyg_type.h>     /* For CYGBLD_ATTRIB_NORET etc. */
73
 
74
/*==========================================================================*/
75
 
76
#if CYGINT_ISO_STDLIB_STRCONV
77
# ifdef CYGBLD_ISO_STDLIB_STRCONV_HEADER
78
#  include CYGBLD_ISO_STDLIB_STRCONV_HEADER
79
# else
80
 
81
/* ISO C 7.10.1 - String conversion functions */
82
 
83
#ifdef __cplusplus
84
extern "C" {
85
#endif
86
 
87
extern int
88
atoi( const char * /* int_str */ );
89
 
90
extern long
91
atol( const char * /* long_str */ );
92
 
93
extern long
94
strtol( const char * /* long_str */, char ** /* endptr */,
95
        int /* base */ );
96
 
97
extern unsigned long
98
strtoul( const char * /* ulong_str */, char ** /* endptr */,
99
         int /* base */ );
100
 
101
#ifdef __cplusplus
102
} /* extern "C" */
103
#endif 
104
 
105
 
106
# endif
107
#endif
108
 
109
/*==========================================================================*/
110
 
111
#if CYGINT_ISO_STDLIB_STRCONV_FLOAT
112
# ifdef CYGBLD_ISO_STDLIB_STRCONV_FLOAT_HEADER
113
#  include CYGBLD_ISO_STDLIB_STRCONV_FLOAT_HEADER
114
# else
115
 
116
/* ISO C 7.10.1 - String conversion functions */
117
 
118
#ifdef __cplusplus
119
extern "C" {
120
#endif
121
 
122
extern double
123
atof( const char * /* double_str */ );
124
 
125
extern double
126
strtod( const char * /* double_str */, char ** /* endptr */ );
127
 
128
#ifdef __cplusplus
129
} /* extern "C" */
130
#endif 
131
 
132
 
133
# endif
134
#endif
135
 
136
/*==========================================================================*/
137
 
138
#if CYGINT_ISO_RAND
139
# ifdef CYGBLD_ISO_RAND_HEADER
140
#  include CYGBLD_ISO_RAND_HEADER
141
# else
142
 
143
/* ISO C 7.10.2 - Pseudo-random sequence generation functions */
144
 
145
/* Maximum value returned by rand().  */
146
#define RAND_MAX  2147483647
147
 
148
#ifdef __cplusplus
149
extern "C" {
150
#endif
151
 
152
extern int
153
rand( void );
154
 
155
extern void
156
srand( unsigned int /* seed */ );
157
 
158
/* POSIX 1003.1 section 8.3.8 rand_r() */
159
extern int
160
rand_r( unsigned int * /* seed */ );
161
 
162
#ifdef __cplusplus
163
} /* extern "C" */
164
#endif 
165
 
166
# endif
167
#endif
168
 
169
/*==========================================================================*/
170
 
171
#if CYGINT_ISO_MALLOC
172
# ifdef CYGBLD_ISO_MALLOC_HEADER
173
#  include CYGBLD_ISO_MALLOC_HEADER
174
# else
175
 
176
/* ISO C 7.10.3 - Memory management functions */
177
 
178
#ifdef __cplusplus
179
extern "C" {
180
#endif
181
 
182
extern void *
183
calloc( size_t /* num_objects */, size_t /* object_size */ );
184
 
185
extern void
186
free( void * /* ptr */ );
187
 
188
extern void *
189
malloc( size_t /* size */ );
190
 
191
extern void *
192
realloc( void * /* ptr */, size_t /* size */ );
193
 
194
#ifdef __cplusplus
195
} /* extern "C" */
196
#endif 
197
 
198
# endif
199
#endif
200
 
201
/*==========================================================================*/
202
 
203
#if CYGINT_ISO_MALLINFO
204
# ifdef CYGBLD_ISO_MALLINFO_HEADER
205
#  include CYGBLD_ISO_MALLINFO_HEADER
206
# else
207
 
208
#ifdef __cplusplus
209
extern "C" {
210
#endif
211
 
212
/* SVID2/XPG mallinfo structure */
213
 
214
struct mallinfo {
215
    int arena;    /* total size of memory arena */
216
    int ordblks;  /* number of ordinary memory blocks */
217
    int smblks;   /* number of small memory blocks */
218
    int hblks;    /* number of mmapped regions */
219
    int hblkhd;   /* total space in mmapped regions */
220
    int usmblks;  /* space used by small memory blocks */
221
    int fsmblks;  /* space available for small memory blocks */
222
    int uordblks; /* space used by ordinary memory blocks */
223
    int fordblks; /* space free for ordinary blocks */
224
    int keepcost; /* top-most, releasable (via malloc_trim) space */
225
    int maxfree;  /* (NON-STANDARD EXTENSION) size of largest free block */
226
};
227
 
228
extern struct mallinfo
229
mallinfo( void );
230
 
231
#ifdef __cplusplus
232
} /* extern "C" */
233
#endif 
234
 
235
# endif
236
#endif
237
 
238
/*==========================================================================*/
239
 
240
#if CYGINT_ISO_EXIT
241
# ifdef CYGBLD_ISO_EXIT_HEADER
242
#  include CYGBLD_ISO_EXIT_HEADER
243
# else
244
 
245
/* ISO C 7.10.4 - Communication with the environment */
246
 
247
/* codes to pass to exit() */
248
 
249
/* Successful exit status - must be zero (POSIX 1003.1 8.1) */
250
#define EXIT_SUCCESS  0
251
/* Failing exit status - must be non-zero (POSIX 1003.1 8.1) */
252
#define EXIT_FAILURE  1
253
 
254
#ifdef __cplusplus
255
extern "C" {
256
#endif
257
 
258
/* Type of function used by atexit() */
259
typedef void (*__atexit_fn_t)( void );
260
 
261
extern void
262
abort( void ) CYGBLD_ATTRIB_NORET;
263
 
264
extern int
265
atexit( __atexit_fn_t /* func_to_register */ );
266
 
267
extern void
268
exit( int /* status */ ) CYGBLD_ATTRIB_NORET;
269
 
270
/* POSIX 1003.1 section 3.2.2 "Terminate a process" */
271
 
272
//@@@ FIXME unistd.h
273
extern void
274
_exit( int /* status */ ) CYGBLD_ATTRIB_NORET;
275
 
276
#ifdef __cplusplus
277
} /* extern "C" */
278
#endif 
279
 
280
# endif
281
#endif
282
 
283
/*==========================================================================*/
284
 
285
#if CYGINT_ISO_STDLIB_ENVIRON
286
# ifdef CYGBLD_ISO_STDLIB_ENVIRON_HEADER
287
#  include CYGBLD_ISO_STDLIB_ENVIRON_HEADER
288
# else
289
 
290
/* ISO C 7.10.4 - Communication with the environment */
291
 
292
#ifdef __cplusplus
293
extern "C" {
294
#endif
295
 
296
#ifndef _POSIX_SOURCE
297
 
298
extern char **environ;   /* standard definition of environ */
299
 
300
#endif
301
 
302
extern char *
303
getenv( const char * /* name */ );
304
 
305
#ifdef __cplusplus
306
} /* extern "C" */
307
#endif 
308
 
309
# endif
310
#endif
311
 
312
/*==========================================================================*/
313
 
314
#if CYGINT_ISO_STDLIB_SYSTEM
315
# ifdef CYGBLD_ISO_STDLIB_SYSTEM_HEADER
316
#  include CYGBLD_ISO_STDLIB_SYSTEM_HEADER
317
# else
318
 
319
/* ISO C 7.10.4 - Communication with the environment */
320
 
321
#ifdef __cplusplus
322
extern "C" {
323
#endif
324
 
325
extern int
326
system( const char * /* command */ );
327
 
328
#ifdef __cplusplus
329
} /* extern "C" */
330
#endif 
331
 
332
# endif
333
#endif
334
 
335
/*==========================================================================*/
336
 
337
#if CYGINT_ISO_BSEARCH
338
# ifdef CYGBLD_ISO_BSEARCH_HEADER
339
#  include CYGBLD_ISO_BSEARCH_HEADER
340
# else
341
 
342
/* ISO C 7.10.5 - Searching and sorting utilities */
343
 
344
#ifdef __cplusplus
345
extern "C" {
346
#endif
347
 
348
typedef int (*__bsearch_comparison_fn_t)(const void * /* object1 */,
349
                                         const void * /* object2 */);
350
 
351
extern void *
352
bsearch( const void * /* search_key */, const void * /* first_object */,
353
         size_t /* num_objects */, size_t /* object_size */,
354
         __bsearch_comparison_fn_t /* comparison_fn */ );
355
 
356
#ifdef __cplusplus
357
} /* extern "C" */
358
#endif 
359
 
360
# endif
361
#endif
362
 
363
/*==========================================================================*/
364
 
365
#if CYGINT_ISO_QSORT
366
# ifdef CYGBLD_ISO_QSORT_HEADER
367
#  include CYGBLD_ISO_QSORT_HEADER
368
# else
369
 
370
/* ISO C 7.10.5 - Searching and sorting utilities */
371
 
372
#ifdef __cplusplus
373
extern "C" {
374
#endif
375
 
376
typedef int (*__qsort_comparison_fn_t)(const void * /* object1 */,
377
                                       const void * /* object2 */);
378
 
379
extern void
380
qsort( void * /* first_object */, size_t /* num_objects */,
381
       size_t /* object_size */, __qsort_comparison_fn_t /* comparison_fn */ );
382
 
383
#ifdef __cplusplus
384
} /* extern "C" */
385
#endif 
386
 
387
# endif
388
#endif
389
 
390
/*======================================================================*/
391
 
392
#if CYGINT_ISO_ABS
393
# ifdef CYGBLD_ISO_STDLIB_ABS_HEADER
394
#  include CYGBLD_ISO_STDLIB_ABS_HEADER
395
# else
396
 
397
/* TYPE DEFINITIONS */
398
 
399
/* ISO C 7.10 and 7.10.6 - Integer Arithmetic Functions */
400
 
401
#ifdef __cplusplus
402
extern "C" {
403
#endif
404
 
405
extern int
406
abs( int /* val */ ) __attribute__((__const__));
407
 
408
extern long
409
labs( long /* val */ ) __attribute__((__const__));
410
 
411
#ifdef __cplusplus
412
} /* extern "C" */
413
#endif 
414
 
415
# endif
416
#endif
417
 
418
/*======================================================================*/
419
 
420
#if CYGINT_ISO_DIV
421
# ifdef CYGBLD_ISO_STDLIB_DIV_HEADER
422
#  include CYGBLD_ISO_STDLIB_DIV_HEADER
423
# else
424
 
425
/* ISO C 7.10 and 7.10.6 - Integer Arithmetic Functions */
426
 
427
/* return type of the div() function */
428
 
429
typedef struct {
430
    int quot;      /* quotient  */
431
    int rem;       /* remainder */
432
} div_t;
433
 
434
 
435
/* return type of the ldiv() function */
436
 
437
typedef struct {
438
    long quot;     /* quotient  */
439
    long rem;      /* remainder */
440
} ldiv_t;
441
 
442
#ifdef __cplusplus
443
extern "C" {
444
#endif
445
 
446
extern div_t
447
div( int /* numerator */, int /* denominator */ ) __attribute__((__const__));
448
 
449
extern ldiv_t
450
ldiv( long /* numerator */, long /* denominator */ ) __attribute__((__const__));
451
 
452
#ifdef __cplusplus
453
} /* extern "C" */
454
#endif 
455
 
456
# endif
457
#endif
458
 
459
/*==========================================================================*/
460
 
461
/* Maximum number of bytes in a multibyte character for the current locale */
462
 
463
#ifdef CYGBLD_ISO_STDLIB_MB_CUR_MAX_HEADER
464
# include CYGBLD_ISO_STDLIB_MB_CUR_MAX_HEADER
465
#else
466
# define MB_CUR_MAX 1
467
#endif
468
 
469
#if CYGINT_ISO_STDLIB_MULTIBYTE
470
# ifdef CYGBLD_ISO_STDLIB_MULTIBYTE_HEADER
471
#  include CYGBLD_ISO_STDLIB_MULTIBYTE_HEADER
472
# else
473
 
474
/* ISO C 7.10.7 - Multibyte character functions */
475
 
476
 
477
#ifdef __cplusplus
478
extern "C" {
479
#endif
480
 
481
extern int
482
mblen( const char * /* s */, size_t /* n */ );
483
 
484
extern int
485
mbtowc( wchar_t * /* pwc */, const char * /* s */, size_t /* n */ );
486
 
487
extern int
488
wctomb( char * /* s */, wchar_t /* wchar */ );
489
 
490
extern size_t
491
mbstowcs( wchar_t * /* pwcs */, const char * /* s */, size_t /* n */ );
492
 
493
extern size_t
494
wcstombs( char * /* s */, const wchar_t * /* pwcs */, size_t /* n */ );
495
 
496
#ifdef __cplusplus
497
} /* extern "C" */
498
#endif 
499
 
500
# endif
501
#endif
502
 
503
/*==========================================================================*/
504
 
505
#endif /* CYGONCE_ISO_STDLIB_H multiple inclusion protection */
506
 
507
/* EOF stdlib.h */

powered by: WebSVN 2.1.0

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