Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2875 dpurdie 1
#pragma force_top_level
2
#pragma include_only_once
3
 
4
/* stdlib.h: ANSI draft (X3J11 May 88) library header, section 4.10 */
5
/* Copyright (C) Codemist Ltd., 1988-1993.                          */
6
/* Copyright: 1991-1998 Advanced RISC Machines Limited. All rights reserved. */
7
/*
8
 * RCS $Revision: 1.6 $
9
 * Checkin $Date: 1998/06/15 10:49:36 $
10
 * Revising $Author: wdijkstr $
11
 */
12
 
13
/*
14
 * stdlib.h declares four types, several general purpose functions,
15
 * and defines several macros.
16
 */
17
 
18
#ifndef __stdlib_h
19
#define __stdlib_h
20
 
21
#ifdef __cplusplus
22
extern "C" {
23
#endif
24
 
25
#ifndef __size_t
26
#  define __size_t 1
27
   typedef unsigned int size_t;   /* from <stddef.h> */
28
#endif
29
 
30
#ifndef __wchar_t
31
   typedef int wchar_t;           /* from <stddef.h> */
32
#  define __wchar_t 1
33
#endif
34
 
35
#ifndef NULL
36
#  define NULL 0                  /* from <stddef.h> */
37
#endif
38
 
39
typedef struct div_t { int quot, rem; } div_t;
40
   /* type of the value returned by the div function. */
41
typedef struct ldiv_t { long int quot, rem; } ldiv_t;
42
   /* type of the value returned by the ldiv function. */
43
 
44
#ifdef __EXIT_FAILURE
45
#  define EXIT_FAILURE __EXIT_FAILURE
46
   /*
47
    * an integral expression which may be used as an argument to the exit
48
    * function to return unsuccessful termination status to the host
49
    * environment.
50
    */
51
#else
52
#  define EXIT_FAILURE 1  /* unixoid */
53
#endif
54
#define EXIT_SUCCESS 0
55
   /*
56
    * an integral expression which may be used as an argument to the exit
57
    * function to return successful termination status to the host
58
    * environment.
59
    */
60
 
61
#define RAND_MAX 0x7fffffff
62
   /*
63
    * an integral constant expression, the value of which is the maximum value
64
    * returned by the rand function.
65
    */
66
#define _ANSI_RAND_MAX 0x7fff /* for the so-called portable version rand() */
67
   /*
68
    * an integral constant expression, the value of which is the maximum value
69
    * returned by the _ANSI_rand function.
70
    */
71
#define MB_CUR_MAX 1
72
   /*
73
    * a positive integer expression whose value is the maximum number of bytes
74
    * in a multibyte character for the extended character set specified by the
75
    * current locale (category LC_CTYPE), and whose value is never greater
76
    * than MB_LEN_MAX.
77
    */
78
 
79
extern double atof(const char * /*nptr*/);
80
   /*
81
    * converts the initial part of the string pointed to by nptr to double
82
    * representation.
83
    * Returns: the converted value.
84
    */
85
extern int atoi(const char * /*nptr*/);
86
   /*
87
    * converts the initial part of the string pointed to by nptr to int
88
    * representation.
89
    * Returns: the converted value.
90
    */
91
extern long int atol(const char * /*nptr*/);
92
   /*
93
    * converts the initial part of the string pointed to by nptr to long int
94
    * representation.
95
    * Returns: the converted value.
96
    */
97
 
98
extern double strtod(const char * /*nptr*/, char ** /*endptr*/);
99
   /*
100
    * converts the initial part of the string pointed to by nptr to double
101
    * representation. First it decomposes the input string into three parts:
102
    * an initial, possibly empty, sequence of white-space characters (as
103
    * specified by the isspace function), a subject sequence resembling a
104
    * floating point constant; and a final string of one or more unrecognised
105
    * characters, including the terminating null character of the input string.
106
    * Then it attempts to convert the subject sequence to a floating point
107
    * number, and returns the result. A pointer to the final string is stored
108
    * in the object pointed to by endptr, provided that endptr is not a null
109
    * pointer.
110
    * Returns: the converted value if any. If no conversion could be performed,
111
    *          zero is returned. If the correct value is outside the range of
112
    *          representable values, plus or minus HUGE_VAL is returned
113
    *          (according to the sign of the value), and the value of the macro
114
    *          ERANGE is stored in errno. If the correct value would cause
115
    *          underflow, zero is returned and the value of the macro ERANGE is
116
    *          stored in errno.
117
    */
118
extern long int strtol(const char * /*nptr*/, char **/*endptr*/, int /*base*/);
119
   /*
120
    * converts the initial part of the string pointed to by nptr to long int
121
    * representation. First it decomposes the input string into three parts:
122
    * an initial, possibly empty, sequence of white-space characters (as
123
    * specified by the isspace function), a subject sequence resembling an
124
    * integer represented in some radix determined by the value of base, and a
125
    * final string of one or more unrecognised characters, including the
126
    * terminating null character of the input string. Then it attempts to
127
    * convert the subject sequence to an integer, and returns the result.
128
    * If the value of base is 0, the expected form of the subject sequence is
129
    * that of an integer constant (described in ANSI Draft, section 3.1.3.2),
130
    * optionally preceeded by a '+' or '-' sign, but not including an integer
131
    * suffix. If the value of base is between 2 and 36, the expected form of
132
    * the subject sequence is a sequence of letters and digits representing an
133
    * integer with the radix specified by base, optionally preceeded by a plus
134
    * or minus sign, but not including an integer suffix. The letters from a
135
    * (or A) through z (or Z) are ascribed the values 10 to 35; only letters
136
    * whose ascribed values are less than that of the base are permitted. If
137
    * the value of base is 16, the characters 0x or 0X may optionally precede
138
    * the sequence of letters and digits following the sign if present.
139
    * A pointer to the final string is stored in the object
140
    * pointed to by endptr, provided that endptr is not a null pointer.
141
    * Returns: the converted value if any. If no conversion could be performed,
142
    *          zero is returned. If the correct value is outside the range of
143
    *          representable values, LONG_MAX or LONG_MIN is returned
144
    *          (according to the sign of the value), and the value of the
145
    *          macro ERANGE is stored in errno.
146
    */
147
extern unsigned long int strtoul(const char * /*nptr*/,
148
                                       char ** /*endptr*/, int /*base*/);
149
   /*
150
    * converts the initial part of the string pointed to by nptr to unsigned
151
    * long int representation. First it decomposes the input string into three
152
    * parts: an initial, possibly empty, sequence of white-space characters (as
153
    * determined by the isspace function), a subject sequence resembling an
154
    * unsigned integer represented in some radix determined by the value of
155
    * base, and a final string of one or more unrecognised characters,
156
    * including the terminating null character of the input string. Then it
157
    * attempts to convert the subject sequence to an unsigned integer, and
158
    * returns the result. If the value of base is zero, the expected form of
159
    * the subject sequence is that of an integer constant (described in ANSI
160
    * Draft, section 3.1.3.2), optionally preceeded by a '+' or '-' sign, but
161
    * not including an integer suffix. If the value of base is between 2 and
162
    * 36, the expected form of the subject sequence is a sequence of letters
163
    * and digits representing an integer with the radix specified by base,
164
    * optionally preceeded by a '+' or '-' sign, but not including an integer
165
    * suffix. The letters from a (or A) through z (or Z) stand for the values
166
    * 10 to 35; only letters whose ascribed values are less than that of the
167
    * base are permitted. If the value of base is 16, the characters 0x or 0X
168
    * may optionally precede the sequence of letters and digits following the
169
    * sign, if present. A pointer to the final string is stored in the object
170
    * pointed to by endptr, provided that endptr is not a null pointer.
171
    * Returns: the converted value if any. If no conversion could be performed,
172
    *          zero is returned. If the correct value is outside the range of
173
    *          representable values, ULONG_MAX is returned, and the value of
174
    *          the macro ERANGE is stored in errno.
175
    */
176
 
177
extern int rand(void);
178
   /*
179
    * Computes a sequence of pseudo-random integers in the range 0 to RAND_MAX.
180
    * Uses an additive generator (Mitchell & Moore) of the form:
181
    *   Xn = (X[n-24] + X[n-55]) MOD 2^31
182
    * This is described in section 3.2.2 of Knuth, vol 2. It's period is
183
    * in excess of 2^55 and its randomness properties, though unproven, are
184
    * conjectured to be good. Empirical testing since 1958 has shown no flaws.
185
    * Returns: a pseudo-random integer.
186
    */
187
extern void srand(unsigned int /*seed*/);
188
   /*
189
    * uses its argument as a seed for a new sequence of pseudo-random numbers
190
    * to be returned by subsequent calls to rand. If srand is then called with
191
    * the same seed value, the sequence of pseudo-random numbers is repeated.
192
    * If rand is called before any calls to srand have been made, the same
193
    * sequence is generated as when srand is first called with a seed value
194
    * of 1.
195
    */
196
extern int _ANSI_rand(void);
197
   /*
198
    * The ANSI-defined 16-bit random number generator which computes
199
    * a sequence of pseudo-random integers in the range 0 to _ANSI_RAND_MAX.
200
    * Its properties are poor, though it IS very portable.
201
    * *** NOT AVAILABLE IN THE SHARED C LIBRARY ***
202
    * Returns: a pseudo-random integer.
203
    */
204
extern void _ANSI_srand(unsigned int /*seed*/);
205
   /*
206
    * Uses its argument as a seed for a new sequence of pseudo-random numbers
207
    * to be returned by subsequent calls to _ANSI_rand. If _ANSI_srand is then
208
    * called with the same seed value, the sequence of pseudo-random numbers
209
    * is repeated. If _ANSI_rand is called before any calls to _ANSI_srand have
210
    * been made, the same sequence is generated as when _ANSI_srand is first
211
    * called with a seed value of 1.
212
    * *** NOT AVAILABLE IN THE SHARED C LIBRARY ***
213
    */
214
 
215
extern void *calloc(size_t /*nmemb*/, size_t /*size*/);
216
   /*
217
    * allocates space for an array of nmemb objects, each of whose size is
218
    * 'size'. The space is initialised to all bits zero.
219
    * Returns: either a null pointer or a pointer to the allocated space.
220
    */
221
extern void free(void * /*ptr*/);
222
   /*
223
    * causes the space pointed to by ptr to be deallocated (i.e., made
224
    * available for further allocation). If ptr is a null pointer, no action
225
    * occurs. Otherwise, if ptr does not match a pointer earlier returned by
226
    * calloc, malloc or realloc or if the space has been deallocated by a call
227
    * to free or realloc, the behaviour is undefined.
228
    */
229
extern void *malloc(size_t /*size*/);
230
   /*
231
    * allocates space for an object whose size is specified by 'size' and whose
232
    * value is indeterminate.
233
    * Returns: either a null pointer or a pointer to the allocated space.
234
    */
235
extern void *realloc(void * /*ptr*/, size_t /*size*/);
236
   /*
237
    * changes the size of the object pointed to by ptr to the size specified by
238
    * size. The contents of the object shall be unchanged up to the lesser of
239
    * the new and old sizes. If the new size is larger, the value of the newly
240
    * allocated portion of the object is indeterminate. If ptr is a null
241
    * pointer, the realloc function behaves like a call to malloc for the
242
    * specified size. Otherwise, if ptr does not match a pointer earlier
243
    * returned by calloc, malloc or realloc, or if the space has been
244
    * deallocated by a call to free or realloc, the behaviour is undefined.
245
    * If the space cannot be allocated, the object pointed to by ptr is
246
    * unchanged. If size is zero and ptr is not a null pointer, the object it
247
    * points to is freed.
248
    * Returns: either a null pointer or a pointer to the possibly moved
249
    *          allocated space.
250
    */
251
extern void __heapstats(int (*dprint)(char const *format, ...));
252
   /*
253
    * reports current heap statistics (eg. number of free blocks in the free-list). 
254
    * A printf-style function dprint is used to format the output. The actual 
255
    * output is implementation defined. 
256
    */
257
extern void abort(void);
258
   /*
259
    * causes abnormal program termination to occur, unless the signal SIGABRT
260
    * is being caught and the signal handler does not return. Whether open
261
    * output streams are flushed or open streams are closed or temporary files
262
    * removed is implementation-defined (under Arthur/Brazil all these occur).
263
    * An implementation-defined form of the status 'unsuccessful termination'
264
    * (1 under Arthur/Brazil) is returned to the host environment by means
265
    * of a call to raise(SIGABRT).
266
    */
267
extern int atexit(void (* /*func*/)(void));
268
   /*
269
    * registers the function pointed to by func, to be called without its
270
    * arguments at normal program termination. It is possible to register at
271
    * least 32 functions.
272
    * Returns: zero if the registration succeeds, nonzero if it fails.
273
    */
274
extern void exit(int /*status*/);
275
   /*
276
    * causes normal program termination to occur. If more than one call to the
277
    * exit function is executed by a program, the behaviour is undefined.
278
    * First, all functions registered by the atexit function are called, in the
279
    * reverse order of their registration.
280
    * Next, all open output streams are flushed, all open streams are closed,
281
    * and all files created by the tmpfile function are removed.
282
    * Finally, control is returned to the host environment. If the value of
283
    * status is zero or EXIT_SUCCESS, an implementation-defined form of the
284
    * status 'successful termination' (0 under Arthur/Brazil) is returned. If
285
    * the value of status is EXIT_FAILURE, an implementation-defined form of
286
    * the status 'unsuccessful termination' (1 under Arthur/Brazil) is
287
    * returned. Otherwise the status returned is implementation-defined (the
288
    * value of status is returned under Arthur/Brazil).
289
    */
290
 
291
extern char *getenv(const char * /*name*/);
292
   /*
293
    * searches the environment list, provided by the host environment, for a
294
    * string that matches the string pointed to by name. The set of environment
295
    * names and the method for altering the environment list are
296
    * implementation-defined.
297
    * Returns: a pointer to a string associated with the matched list member.
298
    *          The array pointed to shall not be modified by the program, but
299
    *          may be overwritten by a subsequent call to the getenv function.
300
    *          If the specified name cannot be found, a null pointer is
301
    *          returned.
302
    */
303
extern int  system(const char * /*string*/);
304
   /*
305
    * passes the string pointed to by string to the host environment to be
306
    * executed by a command processor in an implementation-defined manner.
307
    * A null pointer may be used for string, to inquire whether a command
308
    * processor exists.
309
    *
310
    * Under Arthur/Brazil care must be taken when executing a command, that the
311
    * command does not overwrite the calling program. The string 'chain:' or
312
    * 'call:' may immediately precede the actual command. The effect of 'call:'
313
    * is the same as if 'call:' were not present, which is to attempt to return
314
    * to the calling program. The effect of 'chain:' is to make no attempt to
315
    * return to the calling program, but an attempt is made to call exit.
316
    *
317
    * Returns: If the argument is a null pointer, the system function returns
318
    *          non-zero only if a command processor is available. If the
319
    *          argument is not a null pointer, the system function returns an
320
    *          implementation-defined value (under Arthur/Brazil 0 is returned
321
    *          for success, -2 for failure to invoke the command and any other
322
    *          value is the return code from the executed command).
323
    */
324
 
325
extern void *bsearch(const void *key, const void * /*base*/,
326
              size_t /*nmemb*/, size_t /*size*/,
327
              int (* /*compar*/)(const void *, const void *));
328
   /*
329
    * searches an array of nmemb objects, the initial member of which is
330
    * pointed to by base, for a member that matches the object pointed to by
331
    * key. The size of each member of the array is specified by size.
332
    * The contents of the array shall be in ascending sorted order according to
333
    * a comparison function pointed to by compar, which is called with two
334
    * arguments that point to the key object and to an array member, in that
335
    * order. The function shall return an integer less than, equal to, or
336
    * greater than zero if the key object is considered, respectively, to be
337
    * less than, to match, or to be greater than the array member.
338
    * Returns: a pointer to a matching member of the array, or a null pointer
339
    *          if no match is found. If two members compare as equal, which
340
    *          member is matched is unspecified.
341
    */
342
extern void qsort(void * /*base*/, size_t /*nmemb*/, size_t /*size*/,
343
           int (* /*compar*/)(const void *, const void *));
344
   /*
345
    * sorts an array of nmemb objects, the initial member of which is pointed
346
    * to by base. The size of each object is specified by size.
347
    * The contents of the array shall be in ascending order according to a
348
    * comparison function pointed to by compar, which is called with two
349
    * arguments that point to the objects being compared. The function shall
350
    * return an integer less than, equal to, or greater than zero if the first
351
    * argument is considered to be respectively less than, equal to, or greater
352
    * than the second. If two members compare as equal, their order in the
353
    * sorted array is unspecified.
354
    */
355
 
356
extern int abs(int /*j*/);
357
   /*
358
    * computes the absolute value of an integer j. If the result cannot be
359
    * represented, the behaviour is undefined.
360
    * Returns: the absolute value.
361
    */
362
extern div_t div(int /*numer*/, int /*denom*/);
363
   /*
364
    * computes the quotient and remainder of the division of the numerator
365
    * numer by the denominator denom. If the division is inexact, the resulting
366
    * quotient is the integer of lesser magnitude that is the nearest to the
367
    * algebraic quotient. If the result cannot be represented, the behaviour is
368
    * undefined; otherwise, quot * demon + rem shall equal numer.
369
    * Returns: a structure of type div_t, comprising both the quotient and the
370
    *          remainder. the structure shall contain the following members,
371
    *          in either order.
372
    *          int quot; int rem;
373
    */
374
extern long int labs(long int /*j*/);
375
   /*
376
    * computes the absolute value of an long integer j. If the result cannot be
377
    * represented, the behaviour is undefined.
378
    * Returns: the absolute value.
379
    */
380
extern ldiv_t ldiv(long int /*numer*/, long int /*denom*/);
381
   /*
382
    * computes the quotient and remainder of the division of the numerator
383
    * numer by the denominator denom. If the division is inexact, the sign of
384
    * the resulting quotient is that of the algebraic quotient, and the
385
    * magnitude of the resulting quotient is the largest integer less than the
386
    * magnitude of the algebraic quotient. If the result cannot be represented,
387
    * the behaviour is undefined; otherwise, quot * demon + rem shall equal
388
    * numer.
389
    * Returns: a structure of type ldiv_t, comprising both the quotient and the
390
    *          remainder. the structure shall contain the following members,
391
    *          in either order.
392
    *          long int quot; long int rem;
393
    */
394
 
395
/*
396
 * ARM real-time divide functions for guaranteed performance
397
 */
398
typedef struct __sdiv32by16 { int quot, rem; } __sdiv32by16;
399
typedef struct __udiv32by16 { unsigned int quot, rem; } __udiv32by16;
400
   /* used int so that values return in separate regs, although 16-bit */
401
typedef struct __sdiv64by32 { int rem, quot; } __sdiv64by32;
402
 
403
__value_in_regs extern __sdiv32by16 __rt_sdiv32by16(
404
     int /*numer*/,
405
     short int /*denom*/);
406
   /*
407
    * Signed divide: (16-bit quot), (16-bit rem) = (32-bit) / (16-bit)
408
    */
409
__value_in_regs extern __udiv32by16 __rt_udiv32by16(
410
     unsigned int /*numer*/,
411
     unsigned short /*denom*/);
412
   /*
413
    * Unsigned divide: (16-bit quot), (16-bit rem) = (32-bit) / (16-bit)
414
    */
415
__value_in_regs extern __sdiv64by32 __rt_sdiv64by32(
416
     int /*numer_h*/, unsigned int /*numer_l*/,
417
     int /*denom*/);
418
   /*
419
    * Signed divide: (32-bit quot), (32-bit rem) = (64-bit) / (32-bit)
420
    */
421
 
422
/*
423
 * ARM floating-point mask/status function (for both hardfp and softfp)
424
 */
425
extern unsigned int __fp_status(unsigned int /*mask*/, unsigned int /*flags*/);
426
   /*
427
    * mask and flags are bit-fields which correspond directly to the
428
    * floating point status register in the FPE/FPA and fplib.  
429
    * __fp_status returns the current value of the status register,
430
    * and also sets the writable bits of the word
431
    * (the exception control and flag bytes) to:
432
    *
433
    *     new = (old & ~mask) ^ flags;
434
    */
435
#define __fpsr_IXE  0x100000
436
#define __fpsr_UFE  0x80000
437
#define __fpsr_OFE  0x40000
438
#define __fpsr_DZE  0x20000
439
#define __fpsr_IOE  0x10000
440
 
441
#define __fpsr_IXC  0x10
442
#define __fpsr_UFC  0x8
443
#define __fpsr_OFC  0x4
444
#define __fpsr_DZC  0x2
445
#define __fpsr_IOC  0x1
446
 
447
/*
448
 * Multibyte Character Functions.
449
 * The behaviour of the multibyte character functions is affected by the
450
 * LC_CTYPE category of the current locale. For a state-dependent encoding,
451
 * each function is placed into its initial state by a call for which its
452
 * character pointer argument, s, is a null pointer. Subsequent calls with s
453
 * as other than a null pointer cause the internal state of the function to be
454
 * altered as necessary. A call with s as a null pointer causes these functions
455
 * to return a nonzero value if encodings have state dependency, and a zero
456
 * otherwise. After the LC_CTYPE category is changed, the shift state of these
457
 * functions is indeterminate.
458
 */
459
extern int mblen(const char * /*s*/, size_t /*n*/);
460
   /*
461
    * If s is not a null pointer, the mblen function determines the number of
462
    * bytes compromising the multibyte character pointed to by s. Except that
463
    * the shift state of the mbtowc function is not affected, it is equivalent
464
    * to   mbtowc((wchar_t *)0, s, n);
465
    * Returns: If s is a null pointer, the mblen function returns a nonzero or
466
    *          zero value, if multibyte character encodings, resepectively, do
467
    *          or do not have state-dependent encodings. If s is not a null
468
    *          pointer, the mblen function either returns a 0 (if s points to a
469
    *          null character), or returns the number of bytes that compromise
470
    *          the multibyte character (if the next n of fewer bytes form a
471
    *          valid multibyte character), or returns -1 (they do not form a
472
    *          valid multibyte character).
473
    */
474
extern int mbtowc(wchar_t * /*pwc*/, const char * /*s*/, size_t /*n*/);
475
   /*
476
    * If s is not a null pointer, the mbtowc function determines the number of
477
    * bytes that compromise the multibyte character pointed to by s. It then
478
    * determines the code for value of type wchar_t that corresponds to that
479
    * multibyte character. (The value of the code corresponding to the null
480
    * character is zero). If the multibyte character is valid and pwc is not a
481
    * null pointer, the mbtowc function stores the code in the object pointed
482
    * to by pwc. At most n bytes of the array pointed to by s will be examined.
483
    * Returns: If s is a null pointer, the mbtowc function returns a nonzero or
484
    *          zero value, if multibyte character encodings, resepectively, do
485
    *          or do not have state-dependent encodings. If s is not a null
486
    *          pointer, the mbtowc function either returns a 0 (if s points to
487
    *          a null character), or returns the number of bytes that
488
    *          compromise the converted multibyte character (if the next n of
489
    *          fewer bytes form a valid multibyte character), or returns -1
490
    *          (they do not form a valid multibyte character).
491
    */
492
extern int wctomb(char * /*s*/, wchar_t /*wchar*/);
493
   /*
494
    * determines the number of bytes need to represent the multibyte character
495
    * corresponding to the code whose value is wchar (including any change in
496
    * shift state). It stores the multibyte character representation in the
497
    * array object pointed to by s (if s is not a null pointer). At most
498
    * MB_CUR_MAX characters are stored. If the value of wchar is zero, the
499
    * wctomb function is left in the initial shift state).
500
    * Returns: If s is a null pointer, the wctomb function returns a nonzero or
501
    *          zero value, if multibyte character encodings, resepectively, do
502
    *          or do not have state-dependent encodings. If s is not a null
503
    *          pointer, the wctomb function returns a -1 if the value of wchar
504
    *          does not correspond to a valid multibyte character, or returns
505
    *          the number of bytes that compromise the multibyte character
506
    *          corresponding to the value of wchar.
507
    */
508
 
509
/*
510
 * Multibyte String Functions.
511
 * The behaviour of the multibyte string functions is affected by the LC_CTYPE
512
 * category of the current locale.
513
 */
514
extern size_t mbstowcs(wchar_t * /*pwcs*/, const char * /*s*/, size_t /*n*/);
515
   /*
516
    * converts a sequence of multibyte character that begins in the initial
517
    * shift state from the array pointed to by s into a sequence of
518
    * corresponding codes and stores not more than n codes into the array
519
    * pointed to by pwcs. No multibyte character that follow a null character
520
    * (which is converted into a code with value zero) will be examined or
521
    * converted. Each multibyte character is converted as if by a call to
522
    * mbtowc function, except that the shift state of the mbtowc function is
523
    * not affected. No more than n elements will be modified in the array
524
    * pointed to by pwcs. If copying takes place between objects that overlap,
525
    * the behaviour is undefined.
526
    * Returns: If an invalid multibyte character is encountered, the mbstowcs
527
    *          function returns (size_t)-1. Otherwise, the mbstowcs function
528
    *          returns the number of array elements modified, not including
529
    *          a terminating zero code, if any.
530
    */
531
extern size_t wcstombs(char * /*s*/, const wchar_t * /*pwcs*/, size_t /*n*/);
532
   /*
533
    * converts a sequence of codes that correspond to multibyte characters
534
    * from the array pointed to by pwcs into a sequence of multibyte
535
    * characters that begins in the initial shift state and stores these
536
    * multibyte characters into the array pointed to by s, stopping if a
537
    * multibyte character would exceed the limit of n total bytes or if a
538
    * null character is stored. Each code is converted as if by a call to the
539
    * wctomb function, except that the shift state of the wctomb function is
540
    * not affected. No more than n elements will be modified in the array
541
    * pointed to by s. If copying takes place between objects that overlap,
542
    * the behaviour is undefined.
543
    * Returns: If a code is encountered that does not correspond to a valid
544
    *          multibyte character, the wcstombs function returns (size_t)-1.
545
    *          Otherwise, the wcstombs function returns the number of bytes
546
    *          modified, not including a terminating null character, if any.
547
    */
548
 
549
#ifdef __cplusplus
550
}
551
#endif
552
 
553
#endif
554
 
555
/* end of stdlib.h */