annotate IM_AF Encoder/IM_AM Encoder/stdlib.h @ 8:c51c0b844461 tip

Ok
author Eugenio Oñate Hospital <eo301@eecs.qmul.ac.uk>
date Tue, 28 Aug 2012 12:20:04 +0100
parents 138a3cea9792
children
rev   line source
eo301@0 1 /*
eo301@0 2 * stdlib.h
eo301@0 3 *
eo301@0 4 * Definitions for common types, variables, and functions.
eo301@0 5 *
eo301@0 6 * This file is part of the Mingw32 package.
eo301@0 7 *
eo301@0 8 * Contributors:
eo301@0 9 * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
eo301@0 10 *
eo301@0 11 * THIS SOFTWARE IS NOT COPYRIGHTED
eo301@0 12 *
eo301@0 13 * This source code is offered for use in the public domain. You may
eo301@0 14 * use, modify or distribute it freely.
eo301@0 15 *
eo301@0 16 * This code is distributed in the hope that it will be useful but
eo301@0 17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
eo301@0 18 * DISCLAMED. This includes but is not limited to warranties of
eo301@0 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
eo301@0 20 *
eo301@0 21 * $Revision: 1.1.1.1 $
eo301@0 22 * $Author: brandon6684 $
eo301@0 23 * $Date: 2001/12/18 22:54:00 $
eo301@0 24 *
eo301@0 25 */
eo301@0 26 /* Appropriated for Reactos Crtdll by Ariadne */
eo301@0 27 /* added splitpath */
eo301@0 28 /* changed definition of environ and argc */
eo301@0 29 /* moved prototype for swab from string.h to stdlib.h */
eo301@0 30 #ifndef _STDLIB_H_
eo301@0 31 #define _STDLIB_H_
eo301@0 32
eo301@0 33 #ifdef __cplusplus
eo301@0 34 extern "C" {
eo301@0 35 #endif
eo301@0 36
eo301@0 37 /*
eo301@0 38 * This seems like a convenient place to declare these variables, which
eo301@0 39 * give programs using WinMain (or main for that matter) access to main-ish
eo301@0 40 * argc and argv. environ is a pointer to a table of environment variables.
eo301@0 41 * NOTE: Strings in _argv and environ are ANSI strings.
eo301@0 42 */
eo301@0 43 extern int* __argc_dll;
eo301@0 44 extern char*** __argv_dll;
eo301@0 45 extern char*** _environ_dll;
eo301@0 46 #define __argc (*__argc_dll)
eo301@0 47 #define __argv (*__argv_dll)
eo301@0 48 #define _environ (*_environ_dll)
eo301@0 49
eo301@0 50
eo301@0 51 #define __need_size_t
eo301@0 52 #define __need_wchar_t
eo301@0 53 #define __need_NULL
eo301@0 54 #include <crtdll/stddef.h>
eo301@0 55
eo301@0 56 #include <crtdll/mbstring.h>
eo301@0 57
eo301@0 58 #ifndef __ATTRIB_NORETURN
eo301@0 59 #ifdef __GNUC__
eo301@0 60 #define _ATTRIB_NORETURN __attribute__ ((noreturn))
eo301@0 61 #else /* Not __GNUC__ */
eo301@0 62 #define _ATTRIB_NORETURN
eo301@0 63 #endif /* __GNUC__ */
eo301@0 64 #endif
eo301@0 65
eo301@0 66 double atof (const char* szNumber);
eo301@0 67 int atoi (const char* szNumber);
eo301@0 68 long atol (const char* szNumber);
eo301@0 69
eo301@0 70
eo301@0 71 double strtod (const char* szNumber, char** pszAfterNumber);
eo301@0 72 double wcstod (const wchar_t* wsNumber, wchar_t** pwsAfterNumber);
eo301@0 73 long strtol (const char* szNumber, char** pszAfterNumber, int nBase);
eo301@0 74 long wcstol (const wchar_t* wsNumber, wchar_t** pwsAfterNumber, int nBase);
eo301@0 75
eo301@0 76 unsigned long strtoul (const char* szNumber, char** pszAfterNumber,
eo301@0 77 int nBase);
eo301@0 78 unsigned long wcstoul (const wchar_t* wsNumber, wchar_t** pwsAfterNumber,
eo301@0 79 int nBase);
eo301@0 80
eo301@0 81 size_t wcstombs (char* mbsDest, const wchar_t* wsConvert, size_t size);
eo301@0 82 int wctomb (char* mbDest, wchar_t wc);
eo301@0 83
eo301@0 84 int mblen (const char* mbs, size_t sizeString);
eo301@0 85 size_t mbstowcs (wchar_t* wcaDest, const char* mbsConvert,
eo301@0 86 size_t size);
eo301@0 87 int mbtowc (wchar_t* wcDest, const char* mbConvert, size_t size);
eo301@0 88
eo301@0 89
eo301@0 90 /*
eo301@0 91 * RAND_MAX is the maximum value that may be returned by rand.
eo301@0 92 * The minimum is zero.
eo301@0 93 */
eo301@0 94 #define RAND_MAX 0x7FFF
eo301@0 95
eo301@0 96 int rand (void);
eo301@0 97 void srand (unsigned int nSeed);
eo301@0 98
eo301@0 99
eo301@0 100 void* calloc (size_t sizeObjCnt, size_t sizeObject);
eo301@0 101 void* malloc (size_t sizeObject);
eo301@0 102 void* realloc (void* pObject, size_t sizeNew);
eo301@0 103 void free (void* pObject);
eo301@0 104
eo301@0 105 /* These values may be used as exit status codes. */
eo301@0 106 #define EXIT_SUCCESS 0
eo301@0 107 #define EXIT_FAILURE -1
eo301@0 108
eo301@0 109 void abort (void) _ATTRIB_NORETURN;
eo301@0 110 void exit (int nStatus) _ATTRIB_NORETURN;
eo301@0 111 int atexit (void (*pfuncExitProcessing)(void));
eo301@0 112
eo301@0 113 int system (const char* szCommand); // impl in process
eo301@0 114 char* getenv (const char* szVarName); // impl in stdio
eo301@0 115
eo301@0 116 typedef int (*_pfunccmp_t)(const void*, const void*);
eo301@0 117
eo301@0 118 void* bsearch (const void* pKey, const void* pBase, size_t cntObjects,
eo301@0 119 size_t sizeObject, _pfunccmp_t pfuncCmp);
eo301@0 120 void qsort (const void* pBase, size_t cntObjects, size_t sizeObject,
eo301@0 121 _pfunccmp_t pfuncCmp);
eo301@0 122
eo301@0 123 int abs (int n);
eo301@0 124 long labs (long n);
eo301@0 125
eo301@0 126 /*
eo301@0 127 * div_t and ldiv_t are structures used to return the results of div and
eo301@0 128 * ldiv.
eo301@0 129 *
eo301@0 130 * NOTE: div and ldiv appear not to work correctly unless
eo301@0 131 * -fno-pcc-struct-return is specified. This is included in the
eo301@0 132 * mingw32 specs file.
eo301@0 133 */
eo301@0 134 typedef struct { int quot, rem; } div_t;
eo301@0 135 typedef struct { long quot, rem; } ldiv_t;
eo301@0 136 typedef struct { long long quot, rem; } lldiv_t;
eo301@0 137
eo301@0 138 div_t div (int nNumerator, int nDenominator);
eo301@0 139 ldiv_t ldiv (long lNumerator, long lDenominator);
eo301@0 140 lldiv_t lldiv (long long lNumerator, long long lDenominator);
eo301@0 141
eo301@0 142
eo301@0 143 #ifndef __STRICT_ANSI__
eo301@0 144
eo301@0 145 /*
eo301@0 146 * NOTE: Officially the three following functions are obsolete. The Win32 API
eo301@0 147 * functions SetErrorMode, Beep and Sleep are their replacements.
eo301@0 148 */
eo301@0 149 void _beep (unsigned int, unsigned int);
eo301@0 150 void _seterrormode (int nMode);
eo301@0 151 void _sleep (unsigned long ulTime);
eo301@0 152
eo301@0 153 void _exit (int nStatus) _ATTRIB_NORETURN;
eo301@0 154
eo301@0 155 int _putenv (const char* szNameEqValue);
eo301@0 156 void _searchenv (const char* szFileName, const char* szVar,
eo301@0 157 char* szFullPathBuf);
eo301@0 158
eo301@0 159 void _splitpath( const char *path, char *drive, char *dir,
eo301@0 160 char *fname, char *ext );
eo301@0 161
eo301@0 162 char* _itoa (int nValue, char* sz, int nRadix);
eo301@0 163 char* _ltoa (long lnValue, char* sz, int nRadix);
eo301@0 164
eo301@0 165 char* _ecvt (double dValue, int nDig, int* pnDec, int* pnSign);
eo301@0 166 char* _fcvt (double dValue, int nDig, int* pnDec, int* pnSign);
eo301@0 167 char* _gcvt (double dValue, int nDec, char* caBuf);
eo301@0 168
eo301@0 169 char* _fullpath (char* caBuf, const char* szPath, size_t sizeMax);
eo301@0 170
eo301@0 171 void _swab (const char* caFrom, char* caTo, size_t sizeToCopy);
eo301@0 172
eo301@0 173 unsigned int _rotl( unsigned int value, int shift );
eo301@0 174 unsigned int _rotr( unsigned int value, int shift );
eo301@0 175 unsigned long _lrotl( unsigned long value, int shift );
eo301@0 176 unsigned long _lrotr( unsigned long value, int shift );
eo301@0 177
eo301@0 178
eo301@0 179
eo301@0 180
eo301@0 181 #ifndef _NO_OLDNAMES
eo301@0 182 #define beep _beep
eo301@0 183 #define seterrormode _seterrormode
eo301@0 184 #define sleep _sleep
eo301@0 185 #define putenv _putenv
eo301@0 186 #define searchenv _searchenv
eo301@0 187 #define splitpath _splitpath
eo301@0 188
eo301@0 189 #define itoa _itoa
eo301@0 190 #define ltoa _ltoa
eo301@0 191
eo301@0 192 #define ecvt _ecvt
eo301@0 193 #define fcvt _fcvt
eo301@0 194 #define gcvt _gcvt
eo301@0 195
eo301@0 196 #define swab _swab
eo301@0 197 #endif /* Not _NO_OLDNAMES */
eo301@0 198
eo301@0 199 #endif /* Not __STRICT_ANSI__ */
eo301@0 200
eo301@0 201 /*
eo301@0 202 * Undefine the no return attribute used in some function definitions
eo301@0 203 */
eo301@0 204 #undef _ATTRIB_NORETURN
eo301@0 205
eo301@0 206 #ifdef __cplusplus
eo301@0 207 }
eo301@0 208 #endif
eo301@0 209
eo301@0 210 #endif /* _STDLIB_H_ */