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.

273 lines
7.7 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 <setjmp.h>
  20. struct JumpBuffer {
  21. jmp_buf buf;
  22. };
  23. #define mysetjmp(x) setjmp((x)->buf)
  24. #define mylongjmp(x,y) longjmp((x)->buf, y)
  25. /* <<AT&T USL C++ Language System <3.0.1> 02/03/92>> */
  26. /* < ../core/trimvertpool.c++ > */
  27. void *__vec_new (void *, int , int , void *);
  28. void __vec_ct (void *, int , int , void *);
  29. void __vec_dt (void *, int , int , void *);
  30. void __vec_delete (void *, int , int , void *, int , int );
  31. typedef int (*__vptp)(void);
  32. struct __mptr {short d; short i; __vptp f; };
  33. typedef unsigned int size_t ;
  34. // extern void *malloc (size_t );
  35. // extern void free (void *);
  36. typedef float REAL ;
  37. typedef void (*Pfvv )(void );
  38. typedef void (*Pfvf )(float *);
  39. typedef int (*cmpfunc )(void *, void *);
  40. typedef REAL Knot ;
  41. typedef REAL *Knot_ptr ;
  42. struct TrimVertex;
  43. struct TrimVertex {
  44. REAL param__10TrimVertex [2];
  45. long nuid__10TrimVertex ;
  46. };
  47. typedef struct TrimVertex *TrimVertex_p ;
  48. struct Buffer;
  49. struct Buffer {
  50. struct Buffer *next__6Buffer ;
  51. };
  52. struct Pool;
  53. enum __Q2_4Pool5Magic { is_allocated__Q2_4Pool5Magic = 62369, is_free__Q2_4Pool5Magic = 61858} ;
  54. struct Pool {
  55. struct Buffer *freelist__4Pool ;
  56. char *blocklist__4Pool [32];
  57. int nextblock__4Pool ;
  58. char *curblock__4Pool ;
  59. int buffersize__4Pool ;
  60. int nextsize__4Pool ;
  61. int nextfree__4Pool ;
  62. int initsize__4Pool ;
  63. char *name__4Pool ;
  64. int magic__4Pool ;
  65. };
  66. void __glgrow__4PoolFv (struct Pool *);
  67. struct PooledObj;
  68. struct PooledObj {
  69. char __W3__9PooledObj ;
  70. };
  71. struct TrimVertexPool;
  72. struct TrimVertexPool {
  73. struct Pool pool__14TrimVertexPool ;
  74. struct TrimVertex **vlist__14TrimVertexPool ;
  75. int nextvlistslot__14TrimVertexPool ;
  76. int vlistsize__14TrimVertexPool ;
  77. };
  78. struct Pool *__gl__ct__4PoolFiT1Pc (struct Pool *, int , int , char *);
  79. extern struct __mptr* __ptbl_vec_____core_trimvertpool_c_____ct_[];
  80. static void *__nw__FUi (size_t );
  81. struct TrimVertexPool *__gl__ct__14TrimVertexPoolFv (struct TrimVertexPool *__0this )
  82. {
  83. void *__1__Xp00uzigaiaa ;
  84. if (__0this || (__0this = (struct TrimVertexPool *)__nw__FUi ( sizeof (struct TrimVertexPool)) )){ __gl__ct__4PoolFiT1Pc ( (struct Pool *)(& __0this -> pool__14TrimVertexPool ), (int
  85. )((sizeof (struct TrimVertex ))* 3 ), 32 , (char *)"Threevertspool") ;
  86. __0this -> nextvlistslot__14TrimVertexPool = 0 ;
  87. __0this -> vlistsize__14TrimVertexPool = 200 ;
  88. __0this -> vlist__14TrimVertexPool = (struct TrimVertex **)(((struct TrimVertex **)( (__1__Xp00uzigaiaa = malloc ( ((sizeof (struct TrimVertex *))* __0this -> vlistsize__14TrimVertexPool )) ), (__1__Xp00uzigaiaa ?(((void
  89. *)__1__Xp00uzigaiaa )):(((void *)__1__Xp00uzigaiaa )))) ));
  90. } return __0this ;
  91. }
  92. void __gl__dt__4PoolFv (struct Pool *, int );
  93. void __gl__dt__14TrimVertexPoolFv (struct TrimVertexPool *__0this ,
  94. int __0__free )
  95. {
  96. void *__1__X6 ;
  97. if (__0this ){
  98. while (__0this -> nextvlistslot__14TrimVertexPool ){
  99. void *__1__X5 ;
  100. ( (__1__X5 = (void *)(__0this -> vlist__14TrimVertexPool [(-- __0this -> nextvlistslot__14TrimVertexPool )])), ( (__1__X5 ?( free ( __1__X5 ) , 0 ) :(
  101. 0 ) )) ) ;
  102. }
  103. if (__0this -> vlist__14TrimVertexPool )( (__1__X6 = (void *)__0this -> vlist__14TrimVertexPool ), ( (__1__X6 ?( free ( __1__X6 ) , 0 ) :(
  104. 0 ) )) ) ;
  105. if (__0this ){ __gl__dt__4PoolFv ( (struct Pool *)(& __0this -> pool__14TrimVertexPool ), 2) ;
  106. if (__0__free & 1)( (((void *)__0this )?( free ( ((void *)__0this )) , 0 ) :( 0 ) )) ;
  107. } } }
  108. void __glclear__4PoolFv (struct Pool *);
  109. void __glclear__14TrimVertexPoolFv (struct TrimVertexPool *__0this )
  110. {
  111. void *__1__X8 ;
  112. void *__1__Xp00uzigaiaa ;
  113. __glclear__4PoolFv ( (struct Pool *)(& __0this -> pool__14TrimVertexPool )) ;
  114. while (__0this -> nextvlistslot__14TrimVertexPool ){
  115. void *__1__X7 ;
  116. ( (__1__X7 = (void *)(__0this -> vlist__14TrimVertexPool [(-- __0this -> nextvlistslot__14TrimVertexPool )])), ( (__1__X7 ?( free ( __1__X7 ) , 0 ) :(
  117. 0 ) )) ) ;
  118. (__0this -> vlist__14TrimVertexPool [__0this -> nextvlistslot__14TrimVertexPool ])= 0 ;
  119. }
  120. if (__0this -> vlist__14TrimVertexPool )( (__1__X8 = (void *)__0this -> vlist__14TrimVertexPool ), ( (__1__X8 ?( free ( __1__X8 ) , 0 ) :(
  121. 0 ) )) ) ;
  122. __0this -> vlist__14TrimVertexPool = (struct TrimVertex **)(((struct TrimVertex **)( (__1__Xp00uzigaiaa = malloc ( ((sizeof (struct TrimVertex *))* __0this -> vlistsize__14TrimVertexPool )) ), (__1__Xp00uzigaiaa ?(((void
  123. *)__1__Xp00uzigaiaa )):(((void *)__1__Xp00uzigaiaa )))) ));
  124. }
  125. // extern void *memcpy (void *, void *, size_t );
  126. struct TrimVertex *__glget__14TrimVertexPoolFi (struct TrimVertexPool *__0this , int __1n )
  127. {
  128. struct TrimVertex *__1v ;
  129. if (__1n == 3 ){
  130. void *__1__Xbuffer00idhgaiaa ;
  131. __1v = (((struct TrimVertex *)(((struct TrimVertex *)( (((void )0 )), ( (((struct Pool *)(& __0this -> pool__14TrimVertexPool ))-> freelist__4Pool ?( ( (__1__Xbuffer00idhgaiaa =
  132. (((void *)((struct Pool *)(& __0this -> pool__14TrimVertexPool ))-> freelist__4Pool ))), (((struct Pool *)(& __0this -> pool__14TrimVertexPool ))-> freelist__4Pool = ((struct Pool *)(& __0this ->
  133. pool__14TrimVertexPool ))-> freelist__4Pool -> next__6Buffer )) , 0 ) :( ( ((! ((struct Pool *)(& __0this -> pool__14TrimVertexPool ))-> nextfree__4Pool )?( __glgrow__4PoolFv (
  134. ((struct Pool *)(& __0this -> pool__14TrimVertexPool ))) , 0 ) :( 0 ) ), ( (((struct Pool *)(& __0this -> pool__14TrimVertexPool ))->
  135. nextfree__4Pool -= ((struct Pool *)(& __0this -> pool__14TrimVertexPool ))-> buffersize__4Pool ), ( (__1__Xbuffer00idhgaiaa = (((void *)(((struct Pool *)(& __0this -> pool__14TrimVertexPool ))-> curblock__4Pool +
  136. ((struct Pool *)(& __0this -> pool__14TrimVertexPool ))-> nextfree__4Pool ))))) ) ) , 0 ) ), (((void *)__1__Xbuffer00idhgaiaa ))) ) ))));
  137. }
  138. else
  139. {
  140. unsigned int __0__X10 ;
  141. struct TrimVertex *__0__X11 ;
  142. unsigned int __1__X12 ;
  143. void *__1__Xp00uzigaiaa ;
  144. if (__0this -> nextvlistslot__14TrimVertexPool == __0this -> vlistsize__14TrimVertexPool ){
  145. __0this -> vlistsize__14TrimVertexPool *= 2 ;
  146. { TrimVertex_p *__3nvlist ;
  147. void *__1__X9 ;
  148. void *__1__Xp00uzigaiaa ;
  149. __3nvlist = (((struct TrimVertex **)( (__1__Xp00uzigaiaa = malloc ( ((sizeof (struct TrimVertex *))* __0this -> vlistsize__14TrimVertexPool )) ), (__1__Xp00uzigaiaa ?(((void *)__1__Xp00uzigaiaa )):(((void *)__1__Xp00uzigaiaa ))))
  150. ));
  151. memcpy ( (void *)__3nvlist , (void *)__0this -> vlist__14TrimVertexPool , __0this -> nextvlistslot__14TrimVertexPool * (sizeof (TrimVertex_p ))) ;
  152. if (__0this -> vlist__14TrimVertexPool )( (__1__X9 = (void *)__0this -> vlist__14TrimVertexPool ), ( (__1__X9 ?( free ( __1__X9 ) , 0 ) :(
  153. 0 ) )) ) ;
  154. __0this -> vlist__14TrimVertexPool = __3nvlist ;
  155. }
  156. }
  157. __1v = ((__0this -> vlist__14TrimVertexPool [(__0this -> nextvlistslot__14TrimVertexPool ++ )])= ( (__0__X11 = (struct TrimVertex *)( (__1__X12 = ((sizeof (struct TrimVertex ))* (__0__X10 =
  158. __1n ))), ( (__1__Xp00uzigaiaa = malloc ( __1__X12 ) ), (__1__Xp00uzigaiaa ?(((void *)__1__Xp00uzigaiaa )):(((void *)__1__Xp00uzigaiaa )))) ) ), __0__X11 ) );
  159. }
  160. return __1v ;
  161. }
  162. static void *__nw__FUi (
  163. size_t __1s )
  164. {
  165. void *__1__Xp00uzigaiaa ;
  166. __1__Xp00uzigaiaa = malloc ( __1s ) ;
  167. if (__1__Xp00uzigaiaa ){
  168. return __1__Xp00uzigaiaa ;
  169. }
  170. else
  171. {
  172. return __1__Xp00uzigaiaa ;
  173. }
  174. }
  175. /* the end */