Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

452 lines
12 KiB

  1. /*
  2. ** Copyright 1992, Silicon Graphics, Inc.
  3. ** All Rights Reserved.
  4. **
  5. ** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6. ** the contents of this file may not be disclosed to third parties, copied or
  7. ** duplicated in any form, in whole or in part, without the prior written
  8. ** permission of Silicon Graphics, Inc.
  9. **
  10. ** RESTRICTED RIGHTS LEGEND:
  11. ** Use, duplication or disclosure by the Government is subject to restrictions
  12. ** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13. ** and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14. ** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15. ** rights reserved under the Copyright Laws of the United States.
  16. **
  17. */
  18. #include <stdlib.h>
  19. #include <math.h>
  20. #include <setjmp.h>
  21. struct JumpBuffer {
  22. jmp_buf buf;
  23. };
  24. #define mysetjmp(x) setjmp((x)->buf)
  25. #define mylongjmp(x,y) longjmp((x)->buf, y)
  26. /* <<AT&T USL C++ Language System <3.0.1> 02/03/92>> */
  27. /* < ../core/curve.c++ > */
  28. void *__vec_new (void *, int , int , void *);
  29. void __vec_ct (void *, int , int , void *);
  30. void __vec_dt (void *, int , int , void *);
  31. void __vec_delete (void *, int , int , void *, int , int );
  32. typedef int (*__vptp)(void);
  33. struct __mptr {short d; short i; __vptp f; };
  34. typedef unsigned int size_t ;
  35. // extern void *malloc (size_t );
  36. // extern void free (void *);
  37. typedef float REAL ;
  38. typedef void (*Pfvv )(void );
  39. typedef void (*Pfvf )(float *);
  40. typedef int (*cmpfunc )(void *, void *);
  41. typedef REAL Knot ;
  42. typedef REAL *Knot_ptr ;
  43. struct Mapdesc;
  44. struct Quilt;
  45. struct Curve;
  46. struct Curve {
  47. struct Curve *next__5Curve ;
  48. struct Mapdesc *mapdesc__5Curve ;
  49. int stride__5Curve ;
  50. int order__5Curve ;
  51. int cullval__5Curve ;
  52. int needsSampling__5Curve ;
  53. REAL cpts__5Curve [120];
  54. REAL spts__5Curve [120];
  55. REAL stepsize__5Curve ;
  56. REAL minstepsize__5Curve ;
  57. REAL range__5Curve [3];
  58. };
  59. struct Buffer;
  60. struct Buffer {
  61. struct Buffer *next__6Buffer ;
  62. };
  63. struct Pool;
  64. enum __Q2_4Pool5Magic { is_allocated__Q2_4Pool5Magic = 62369, is_free__Q2_4Pool5Magic = 61858} ;
  65. struct Pool {
  66. struct Buffer *freelist__4Pool ;
  67. char *blocklist__4Pool [32];
  68. int nextblock__4Pool ;
  69. char *curblock__4Pool ;
  70. int buffersize__4Pool ;
  71. int nextsize__4Pool ;
  72. int nextfree__4Pool ;
  73. int initsize__4Pool ;
  74. char *name__4Pool ;
  75. int magic__4Pool ;
  76. };
  77. void __glgrow__4PoolFv (struct Pool *);
  78. struct PooledObj;
  79. struct PooledObj {
  80. char __W3__9PooledObj ;
  81. };
  82. typedef REAL Maxmatrix [5][5];
  83. struct Backend;
  84. struct Mapdesc;
  85. struct Mapdesc {
  86. char __W3__9PooledObj ;
  87. REAL pixel_tolerance__7Mapdesc ;
  88. REAL clampfactor__7Mapdesc ;
  89. REAL minsavings__7Mapdesc ;
  90. REAL maxrate__7Mapdesc ;
  91. REAL maxsrate__7Mapdesc ;
  92. REAL maxtrate__7Mapdesc ;
  93. REAL bboxsize__7Mapdesc [5];
  94. long type__7Mapdesc ;
  95. int isrational__7Mapdesc ;
  96. int ncoords__7Mapdesc ;
  97. int hcoords__7Mapdesc ;
  98. int inhcoords__7Mapdesc ;
  99. int mask__7Mapdesc ;
  100. Maxmatrix bmat__7Mapdesc ;
  101. Maxmatrix cmat__7Mapdesc ;
  102. Maxmatrix smat__7Mapdesc ;
  103. REAL s_steps__7Mapdesc ;
  104. REAL t_steps__7Mapdesc ;
  105. REAL sampling_method__7Mapdesc ;
  106. REAL culling_method__7Mapdesc ;
  107. REAL bbox_subdividing__7Mapdesc ;
  108. struct Mapdesc *next__7Mapdesc ;
  109. struct Backend *backend__7Mapdesc ;
  110. };
  111. void __glcopy__7MapdescSFPA5_flPfN20 (REAL (*)[5], long , float *, long , long );
  112. void __glxformRational__7MapdescFPA0 (struct Mapdesc *, REAL (*)[5], REAL *, REAL *);
  113. void __glxformNonrational__7Mapdesc0 (struct Mapdesc *, REAL (*)[5], REAL *, REAL *);
  114. struct Backend;
  115. struct Flist;
  116. struct Knotvector;
  117. struct Quiltspec;
  118. struct Quiltspec {
  119. int stride__9Quiltspec ;
  120. int width__9Quiltspec ;
  121. int offset__9Quiltspec ;
  122. int order__9Quiltspec ;
  123. int index__9Quiltspec ;
  124. int bdry__9Quiltspec [2];
  125. REAL step_size__9Quiltspec ;
  126. Knot *breakpoints__9Quiltspec ;
  127. };
  128. typedef struct Quiltspec *Quiltspec_ptr ;
  129. struct Quilt;
  130. struct Quilt {
  131. char __W3__9PooledObj ;
  132. struct Mapdesc *mapdesc__5Quilt ;
  133. REAL *cpts__5Quilt ;
  134. struct Quiltspec qspec__5Quilt [2];
  135. Quiltspec_ptr eqspec__5Quilt ;
  136. struct Quilt *next__5Quilt ;
  137. };
  138. typedef struct Quilt *Quilt_ptr ;
  139. void __glxformSampling__7MapdescFPf0 (struct Mapdesc *, REAL *, int , int , REAL *, int );
  140. void __glxformCulling__7MapdescFPfi0 (struct Mapdesc *, REAL *, int , int , REAL *, int );
  141. struct Curve *__gl__ct__5CurveFR5CurvefP5Cur0 (struct Curve *, struct Curve *, REAL , struct Curve *);
  142. extern struct __mptr* __ptbl_vec_____core_curve_c_____ct_[];
  143. struct Curve *__gl__ct__5CurveFP5QuiltfT2P5C0 (struct Curve *__0this , Quilt_ptr __1geo , REAL __1pta , REAL __1ptb , struct Curve *__1c )
  144. {
  145. struct Mapdesc *__0__X5 ;
  146. void *__1__Xp00uzigaiaa ;
  147. if (__0this || (__0this = (struct Curve *)( (__1__Xp00uzigaiaa = malloc ( (sizeof (struct Curve))) ), (__1__Xp00uzigaiaa ?(((void *)__1__Xp00uzigaiaa )):(((void *)__1__Xp00uzigaiaa )))) )){
  148. __0this -> mapdesc__5Curve = __1geo -> mapdesc__5Quilt ;
  149. __0this -> next__5Curve = __1c ;
  150. __0this -> needsSampling__5Curve = (( (__0__X5 = (struct Mapdesc *)__0this -> mapdesc__5Curve ), ( ((( ((__0__X5 -> sampling_method__7Mapdesc == 5.0 )?1 :0 )) || (
  151. ((__0__X5 -> sampling_method__7Mapdesc == 6.0 )?1 :0 )) )|| ( ((__0__X5 -> sampling_method__7Mapdesc == 7.0 )?1 :0 )) )) ) ?1 :0 );
  152. __0this -> cullval__5Curve = (( ((((struct Mapdesc *)__0this -> mapdesc__5Curve )-> culling_method__7Mapdesc != 0.0 )?1 :0 )) ?2 :1 );
  153. __0this -> order__5Curve = (__1geo -> qspec__5Quilt [0 ]). order__9Quiltspec ;
  154. __0this -> stride__5Curve = 5 ;
  155. { REAL *__1ps ;
  156. Quiltspec_ptr __1qs ;
  157. __1ps = __1geo -> cpts__5Quilt ;
  158. __1qs = __1geo -> qspec__5Quilt ;
  159. __1ps += __1qs -> offset__9Quiltspec ;
  160. __1ps += ((__1qs -> index__9Quiltspec * __1qs -> order__9Quiltspec )* __1qs -> stride__9Quiltspec );
  161. { REAL *__1pend ;
  162. __1pend = (__1ps + (__1qs -> order__9Quiltspec * __1qs -> stride__9Quiltspec ));
  163. if (__0this -> needsSampling__5Curve )
  164. __glxformSampling__7MapdescFPf0 ( (struct Mapdesc *)__0this -> mapdesc__5Curve , __1ps , __1qs -> order__9Quiltspec , __1qs -> stride__9Quiltspec , (float *)__0this -> spts__5Curve ,
  165. __0this -> stride__5Curve ) ;
  166. if (__0this -> cullval__5Curve == 2 )
  167. __glxformCulling__7MapdescFPfi0 ( (struct Mapdesc *)__0this -> mapdesc__5Curve , __1ps , __1qs -> order__9Quiltspec , __1qs -> stride__9Quiltspec , (float *)__0this ->
  168. cpts__5Curve , __0this -> stride__5Curve ) ;
  169. (__0this -> range__5Curve [0 ])= (__1qs -> breakpoints__9Quiltspec [__1qs -> index__9Quiltspec ]);
  170. (__0this -> range__5Curve [1 ])= (__1qs -> breakpoints__9Quiltspec [(__1qs -> index__9Quiltspec + 1 )]);
  171. (__0this -> range__5Curve [2 ])= ((__0this -> range__5Curve [1 ])- (__0this -> range__5Curve [0 ]));
  172. if ((__0this -> range__5Curve [0 ])!= __1pta ){
  173. struct Curve __2lower ;
  174. __gl__ct__5CurveFR5CurvefP5Cur0 ( (struct Curve *)(& __2lower ), (struct Curve *)__0this , __1pta , (struct Curve *)0 ) ;
  175. __2lower . next__5Curve = __0this -> next__5Curve ;
  176. ((*__0this ))= __2lower ;
  177. }
  178. if ((__0this -> range__5Curve [1 ])!= __1ptb ){
  179. struct Curve __2lower ;
  180. __gl__ct__5CurveFR5CurvefP5Cur0 ( (struct Curve *)(& __2lower ), (struct Curve *)__0this , __1ptb , (struct Curve *)0 ) ;
  181. }
  182. }
  183. }
  184. } return __0this ;
  185. }
  186. void __glsubdivide__7MapdescFPfT1fi0 (struct Mapdesc *, REAL *, REAL *, REAL , int , int );
  187. struct Curve *__gl__ct__5CurveFR5CurvefP5Cur0 (struct Curve *__0this , struct Curve *__1upper , REAL __1value , struct Curve *__1c )
  188. {
  189. struct Curve *__1lower ;
  190. void *__1__Xp00uzigaiaa ;
  191. if (__0this || (__0this = (struct Curve *)( (__1__Xp00uzigaiaa = malloc ( (sizeof (struct Curve))) ), (__1__Xp00uzigaiaa ?(((void *)__1__Xp00uzigaiaa )):(((void *)__1__Xp00uzigaiaa )))) )){
  192. __1lower = (struct Curve *)__0this ;
  193. ((*__1lower )). next__5Curve = __1c ;
  194. ((*__1lower )). mapdesc__5Curve = ((*__1upper )). mapdesc__5Curve ;
  195. ((*__1lower )). needsSampling__5Curve = ((*__1upper )). needsSampling__5Curve ;
  196. ((*__1lower )). order__5Curve = ((*__1upper )). order__5Curve ;
  197. ((*__1lower )). stride__5Curve = ((*__1upper )). stride__5Curve ;
  198. ((*__1lower )). cullval__5Curve = ((*__1upper )). cullval__5Curve ;
  199. { REAL __1d ;
  200. __1d = ((__1value - (((*__1upper )). range__5Curve [0 ]))/ (((*__1upper )). range__5Curve [2 ]));
  201. if (__0this -> needsSampling__5Curve )
  202. __glsubdivide__7MapdescFPfT1fi0 ( (struct Mapdesc *)__0this -> mapdesc__5Curve , (float *)((*__1upper )). spts__5Curve , (float *)((*__1lower )). spts__5Curve , __1d , ((*__1upper )).
  203. stride__5Curve , ((*__1upper )). order__5Curve ) ;
  204. if (__0this -> cullval__5Curve == 2 )
  205. __glsubdivide__7MapdescFPfT1fi0 ( (struct Mapdesc *)__0this -> mapdesc__5Curve , (float *)((*__1upper )). cpts__5Curve , (float *)((*__1lower )). cpts__5Curve , __1d ,
  206. ((*__1upper )). stride__5Curve , ((*__1upper )). order__5Curve ) ;
  207. (((*__1lower )). range__5Curve [0 ])= (((*__1upper )). range__5Curve [0 ]);
  208. (((*__1lower )). range__5Curve [1 ])= __1value ;
  209. (((*__1lower )). range__5Curve [2 ])= (__1value - (((*__1upper )). range__5Curve [0 ]));
  210. (((*__1upper )). range__5Curve [0 ])= __1value ;
  211. (((*__1upper )). range__5Curve [2 ])= ((((*__1upper )). range__5Curve [1 ])- __1value );
  212. }
  213. } return __0this ;
  214. }
  215. void __glclamp__5CurveFv (struct Curve *__0this )
  216. {
  217. if (__0this -> stepsize__5Curve < __0this -> minstepsize__5Curve )
  218. __0this -> stepsize__5Curve = (__0this -> mapdesc__5Curve -> clampfactor__7Mapdesc * __0this -> minstepsize__5Curve );
  219. }
  220. void __glsetstepsize__5CurveFf (struct Curve *__0this , REAL __1max )
  221. {
  222. __0this -> stepsize__5Curve = ((__1max >= 1.0 )?((__0this -> range__5Curve [2 ])/ __1max ):(__0this -> range__5Curve [2 ]));
  223. __0this -> minstepsize__5Curve = __0this -> stepsize__5Curve ;
  224. }
  225. int __glproject__7MapdescFPfiT1N22 (struct Mapdesc *, REAL *, int , REAL *, int , int );
  226. REAL __glgetProperty__7MapdescFl (struct Mapdesc *, long );
  227. REAL __glcalcPartialVelocity__7Mapd0 (struct Mapdesc *, REAL *, int , int , int , REAL );
  228. // extern double sqrt (double );
  229. void __glgetstepsize__5CurveFv (struct Curve *__0this )
  230. {
  231. if (( ((((struct Mapdesc *)__0this -> mapdesc__5Curve )-> sampling_method__7Mapdesc == 3.0 )?1 :0 )) ){
  232. __glsetstepsize__5CurveFf ( __0this , __0this ->
  233. mapdesc__5Curve -> maxrate__7Mapdesc ) ;
  234. }
  235. else
  236. if (( ((((struct Mapdesc *)__0this -> mapdesc__5Curve )-> sampling_method__7Mapdesc == 2.0 )?1 :0 )) ){
  237. __glsetstepsize__5CurveFf ( __0this , __0this -> mapdesc__5Curve -> maxrate__7Mapdesc *
  238. (__0this -> range__5Curve [2 ])) ;
  239. }
  240. else
  241. {
  242. ((void )0 );
  243. { REAL __2tmp [24][5];
  244. int __2val ;
  245. __2val = __glproject__7MapdescFPfiT1N22 ( (struct Mapdesc *)__0this -> mapdesc__5Curve , (float *)__0this -> spts__5Curve , __0this -> stride__5Curve , & ((__2tmp [0 ])[0 ]), (int )5,
  246. __0this -> order__5Curve ) ;
  247. if (__2val == 0 ){
  248. __glsetstepsize__5CurveFf ( __0this , __0this -> mapdesc__5Curve -> maxrate__7Mapdesc ) ;
  249. }
  250. else
  251. {
  252. REAL __3t ;
  253. __3t = __glgetProperty__7MapdescFl ( (struct Mapdesc *)__0this -> mapdesc__5Curve , (long )1 ) ;
  254. if (( ((((struct Mapdesc *)__0this -> mapdesc__5Curve )-> sampling_method__7Mapdesc == 5.0 )?1 :0 )) ){
  255. REAL __4d ;
  256. __4d = __glcalcPartialVelocity__7Mapd0 ( (struct Mapdesc *)__0this -> mapdesc__5Curve , & ((__2tmp [0 ])[0 ]), (int )5, __0this -> order__5Curve , 2 , __0this -> range__5Curve [2 ])
  257. ;
  258. __0this -> stepsize__5Curve = ((__4d > 0.0 )?sqrt ( (8.0 * __3t )/ __4d ) :(((double )(__0this -> range__5Curve [2 ]))));
  259. __0this -> minstepsize__5Curve = ((__0this -> mapdesc__5Curve -> maxrate__7Mapdesc > 0.0 )?(((double )((__0this -> range__5Curve [2 ])/ __0this -> mapdesc__5Curve -> maxrate__7Mapdesc ))):0.0 );
  260. }
  261. else
  262. if (( ((((struct Mapdesc *)__0this -> mapdesc__5Curve )-> sampling_method__7Mapdesc == 6.0 )?1 :0 )) ){
  263. REAL __4d ;
  264. __4d = __glcalcPartialVelocity__7Mapd0 ( (struct Mapdesc *)__0this -> mapdesc__5Curve , & ((__2tmp [0 ])[0 ]), (int )5, __0this -> order__5Curve , 1 , __0this -> range__5Curve [2 ])
  265. ;
  266. __0this -> stepsize__5Curve = ((__4d > 0.0 )?(__3t / __4d ):(__0this -> range__5Curve [2 ]));
  267. __0this -> minstepsize__5Curve = ((__0this -> mapdesc__5Curve -> maxrate__7Mapdesc > 0.0 )?(((double )((__0this -> range__5Curve [2 ])/ __0this -> mapdesc__5Curve -> maxrate__7Mapdesc ))):0.0 );
  268. }
  269. else
  270. {
  271. __glsetstepsize__5CurveFf ( __0this , __0this -> mapdesc__5Curve -> maxrate__7Mapdesc ) ;
  272. }
  273. }
  274. }
  275. }
  276. }
  277. int __glneedsSamplingSubdivision__0 (struct Curve *__0this )
  278. {
  279. return ((__0this -> stepsize__5Curve < __0this -> minstepsize__5Curve )?1 :0 );
  280. }
  281. int __glcullCheck__7MapdescFPfiT2 (struct Mapdesc *, REAL *, int , int );
  282. int __glcullCheck__5CurveFv (struct Curve *__0this )
  283. {
  284. if (__0this -> cullval__5Curve == 2 )
  285. __0this -> cullval__5Curve = __glcullCheck__7MapdescFPfiT2 ( (struct Mapdesc *)__0this -> mapdesc__5Curve , (float *)__0this ->
  286. cpts__5Curve , __0this -> order__5Curve , __0this -> stride__5Curve ) ;
  287. return __0this -> cullval__5Curve ;
  288. }
  289. /* the end */