Go to the source code of this file.
Defines | |
| #define | _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) ) |
| #define | CHAR_BIT 8 |
| #define | INT_MAX 2147483647 |
| #define | INT_MIN (-2147483647 - 1) |
| #define | LONG_MAX 2147483647L |
| #define | LONG_MIN (-2147483647L - 1) |
| #define | SCHAR_MAX 127 |
| #define | SCHAR_MIN (-128) |
| #define | SHRT_MAX 32767 |
| #define | SHRT_MIN (-32768) |
| #define | UCHAR_MAX 0xff |
| #define | UINT_MAX 0xffffffff |
| #define | ULONG_MAX 0xffffffffUL |
| #define | USHRT_MAX 0xffff |
| #define | va_arg(ap, t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) ) |
| #define | va_end(ap) ( ap = (va_list)0 ) |
| #define | va_start(ap, v) ( ap = (va_list)&v + _INTSIZEOF(v) ) |
Typedefs | |
| typedef int | cmp_t (const void *, const void *) |
| typedef int | size_t |
| typedef char * | va_list |
Functions | |
| double | _atof (const char **stringPtr) |
| int | _atoi (const char **stringPtr) |
| int | abs (int n) |
| double | acos (double x) |
| double | atan2 (double y, double x) |
| double | atof (const char *string) |
| int | atoi (const char *string) |
| double | ceil (double x) |
| double | cos (double x) |
| double | fabs (double x) |
| double | floor (double x) |
| void * | memcpy (void *dest, const void *src, size_t count) |
| void * | memmove (void *dest, const void *src, size_t count) |
| void * | memset (void *dest, int c, size_t count) |
| void | qsort (void *a, size_t n, size_t es, cmp_t *cmp) |
| int | rand (void) |
| double | sin (double x) |
| double | sqrt (double x) |
| void | srand (unsigned seed) |
| int | sscanf (const char *buffer, const char *fmt,...) |
| char * | strcat (char *strDestination, const char *strSource) |
| char * | strchr (const char *string, int c) |
| int | strcmp (const char *string1, const char *string2) |
| char * | strcpy (char *strDestination, const char *strSource) |
| size_t | strlen (const char *string) |
| char * | strncpy (char *strDest, const char *strSource, size_t count) |
| char * | strstr (const char *string, const char *strCharSet) |
| double | tan (double x) |
| int | tolower (int c) |
| int | toupper (int c) |
| int | vsprintf (char *buffer, const char *fmt, va_list argptr) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 47 of file bg_lib.h. Referenced by emitcode(), main(), and stringd(). |
|
|
Definition at line 46 of file bg_lib.h. Referenced by main(). |
|
|
Definition at line 37 of file bg_lib.h. Referenced by main(). |
|
|
Definition at line 36 of file bg_lib.h. Referenced by main(). |
|
|
Definition at line 41 of file bg_lib.h. Referenced by main(). |
|
|
Definition at line 40 of file bg_lib.h. Referenced by main(). |
|
|
Definition at line 38 of file bg_lib.h. Referenced by main(). |
|
|
Definition at line 45 of file bg_lib.h. Referenced by main(). |
|
|
|
|
|
Definition at line 42 of file bg_lib.h. Referenced by main(). |
|
|
Definition at line 32 of file bg_lib.h. Referenced by BotAI_BotInitialChat(), error(), print(), vfprint(), VM_Call(), and VM_DllSyscall(). |
|
|
|
|
|
|
|
Definition at line 27 of file bg_lib.h. Referenced by access_virt_barray(), access_virt_sarray(), alloc_barray(), alloc_large(), alloc_sarray(), alloc_small(), compress_first_pass(), decompress_onepass(), free_pool(), jcopy_sample_rows(), jinit_memory_mgr(), jpeg_fill_bit_buffer(), jzero_far(), MakeNewTerrain(), Q_stristr(), idList::Sort(), stabinit(), CCharBuffer::StringLength(), Sys_ProcessorCount(), and term_destination(). |
|
|
|
Definition at line 848 of file bg_lib.c. References c, sign, string(), and value. 00848 {
00849 const char *string;
00850 float sign;
00851 float value;
00852 int c = '0'; // bk001211 - uninitialized use possible
00853
00854 string = *stringPtr;
00855
00856 // skip whitespace
00857 while ( *string <= ' ' ) {
00858 if ( !*string ) {
00859 *stringPtr = string;
00860 return 0;
00861 }
00862 string++;
00863 }
00864
00865 // check sign
00866 switch ( *string ) {
00867 case '+':
00868 string++;
00869 sign = 1;
00870 break;
00871 case '-':
00872 string++;
00873 sign = -1;
00874 break;
00875 default:
00876 sign = 1;
00877 break;
00878 }
00879
00880 // read digits
00881 value = 0;
00882 if ( string[0] != '.' ) {
00883 do {
00884 c = *string++;
00885 if ( c < '0' || c > '9' ) {
00886 break;
00887 }
00888 c -= '0';
00889 value = value * 10 + c;
00890 } while ( 1 );
00891 }
00892
00893 // check for decimal point
00894 if ( c == '.' ) {
00895 double fraction;
00896
00897 fraction = 0.1;
00898 do {
00899 c = *string++;
00900 if ( c < '0' || c > '9' ) {
00901 break;
00902 }
00903 c -= '0';
00904 value += c * fraction;
00905 fraction *= 0.1;
00906 } while ( 1 );
00907
00908 }
00909
00910 // not handling 10e10 notation...
00911 *stringPtr = string;
00912
00913 return value * sign;
00914 }
|
Here is the call graph for this function:

|
|
|
|
|
Referenced by PC_Directive_eval(), PC_DollarDirective_evalint(), and TH_AASFaceVertex(). |
|
|
|
|
||||||||||||
|
|
|
|
Definition at line 781 of file bg_lib.c. 00781 {
00782 float sign;
00783 float value;
00784 int c;
00785
00786
00787 // skip whitespace
00788 while ( *string <= ' ' ) {
00789 if ( !*string ) {
00790 return 0;
00791 }
00792 string++;
00793 }
00794
00795 // check sign
00796 switch ( *string ) {
00797 case '+':
00798 string++;
00799 sign = 1;
00800 break;
00801 case '-':
00802 string++;
00803 sign = -1;
00804 break;
00805 default:
00806 sign = 1;
00807 break;
00808 }
00809
00810 // read digits
00811 value = 0;
00812 c = string[0];
00813 if ( c != '.' ) {
00814 do {
00815 c = *string++;
00816 if ( c < '0' || c > '9' ) {
00817 break;
00818 }
00819 c -= '0';
00820 value = value * 10 + c;
00821 } while ( 1 );
00822 } else {
00823 string++;
00824 }
00825
00826 // check for decimal point
00827 if ( c == '.' ) {
00828 double fraction;
00829
00830 fraction = 0.1;
00831 do {
00832 c = *string++;
00833 if ( c < '0' || c > '9' ) {
00834 break;
00835 }
00836 c -= '0';
00837 value += c * fraction;
00838 fraction *= 0.1;
00839 } while ( 1 );
00840
00841 }
00842
00843 // not handling 10e10 notation...
00844
00845 return value * sign;
00846 }
|
|
|
|
|
|
|
|
|
|
|
|
Referenced by PC_Directive_evalfloat(), PC_DollarDirective_evalfloat(), and Q3_FindVisibleBrushSides(). |
|
|
Referenced by Brush_MakeSided(), Brush_MakeSidedCone(), and CXYWnd::XY_ToGridPoint(). |
|
||||||||||||||||
|
|
|
||||||||||||||||
|
Definition at line 294 of file bg_lib.c. 00294 {
00295 int i;
00296
00297 if ( dest > src ) {
00298 for ( i = count-1 ; i >= 0 ; i-- ) {
00299 ((char *)dest)[i] = ((char *)src)[i];
00300 }
00301 } else {
00302 for ( i = 0 ; i < count ; i++ ) {
00303 ((char *)dest)[i] = ((char *)src)[i];
00304 }
00305 }
00306 return dest;
00307 }
|
|
||||||||||||||||
|
|
|
||||||||||||||||||||
|
Definition at line 109 of file bg_lib.c. References a, cmp(), d, med3(), min, n, pm, qsort(), r, swap, SWAPINIT, and vecswap. 00113 {
00114 char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
00115 int d, r, swaptype, swap_cnt;
00116
00117 loop: SWAPINIT(a, es);
00118 swap_cnt = 0;
00119 if (n < 7) {
00120 for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
00121 for (pl = pm; pl > (char *)a && cmp(pl - es, pl) > 0;
00122 pl -= es)
00123 swap(pl, pl - es);
00124 return;
00125 }
00126 pm = (char *)a + (n / 2) * es;
00127 if (n > 7) {
00128 pl = a;
00129 pn = (char *)a + (n - 1) * es;
00130 if (n > 40) {
00131 d = (n / 8) * es;
00132 pl = med3(pl, pl + d, pl + 2 * d, cmp);
00133 pm = med3(pm - d, pm, pm + d, cmp);
00134 pn = med3(pn - 2 * d, pn - d, pn, cmp);
00135 }
00136 pm = med3(pl, pm, pn, cmp);
00137 }
00138 swap(a, pm);
00139 pa = pb = (char *)a + es;
00140
00141 pc = pd = (char *)a + (n - 1) * es;
00142 for (;;) {
00143 while (pb <= pc && (r = cmp(pb, a)) <= 0) {
00144 if (r == 0) {
00145 swap_cnt = 1;
00146 swap(pa, pb);
00147 pa += es;
00148 }
00149 pb += es;
00150 }
00151 while (pb <= pc && (r = cmp(pc, a)) >= 0) {
00152 if (r == 0) {
00153 swap_cnt = 1;
00154 swap(pc, pd);
00155 pd -= es;
00156 }
00157 pc -= es;
00158 }
00159 if (pb > pc)
00160 break;
00161 swap(pb, pc);
00162 swap_cnt = 1;
00163 pb += es;
00164 pc -= es;
00165 }
00166 if (swap_cnt == 0) { /* Switch to insertion sort */
00167 for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
00168 for (pl = pm; pl > (char *)a && cmp(pl - es, pl) > 0;
00169 pl -= es)
00170 swap(pl, pl - es);
00171 return;
00172 }
00173
00174 pn = (char *)a + n * es;
00175 r = min(pa - (char *)a, pb - pa);
00176 vecswap(a, pb - r, r);
00177 r = min(pd - pc, pn - pd - es);
00178 vecswap(pb, pn - r, r);
00179 if ((r = pb - pa) > es)
00180 qsort(a, r / es, es, cmp);
00181 if ((r = pd - pc) > es) {
00182 /* Iterate rather than recurse to save stack space */
00183 a = pn - r;
00184 n = r / es;
00185 goto loop;
00186 }
00187 /* qsort(pn - r, r / es, es, cmp);*/
00188 }
|
Here is the call graph for this function:

|
|
Definition at line 776 of file bg_lib.c.
|
|
|
Referenced by Item_Bind_Paint(), Item_Multi_Paint(), Item_OwnerDraw_Paint(), Item_Slider_Paint(), Item_TextColor(), Item_TextField_Paint(), and Item_YesNo_Paint(). |
|
|
|
|
|
Definition at line 772 of file bg_lib.c. 00772 {
00773 randSeed = seed;
00774 }
|
|
||||||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
|
||||||||||||||||
|
|
|
||||||||||||
|
Referenced by ASE_KeyMAP_DIFFUSE(). |
|
|
|
|
|
|
|
|
|
|
||||||||||||||||
|
|
1.3.9.1