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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [isoinfra/] [v2_0/] [include/] [stdlib.h] - Blame information for rev 174

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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