Leaked source code of windows server 2003
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.

308 lines
12 KiB

  1. /*
  2. ** Copyright 1995-2095, 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. #include "glslib.h"
  18. const GLubyte __glsCharType[256] = {
  19. /* nul 0x00 */ 0,
  20. /* soh 0x01 */ 0,
  21. /* stx 0x02 */ 0,
  22. /* etx 0x03 */ 0,
  23. /* eot 0x04 */ 0,
  24. /* enq 0x05 */ 0,
  25. /* ack 0x06 */ 0,
  26. /* bel 0x07 */ 0,
  27. /* bs 0x08 */ 0,
  28. /* ht 0x09 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_SPACE_BIT,
  29. /* nl 0x0A */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_SPACE_BIT,
  30. /* vt 0x0B */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_SPACE_BIT,
  31. /* np 0x0C */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_SPACE_BIT,
  32. /* cr 0x0D */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_SPACE_BIT,
  33. /* so 0x0E */ 0,
  34. /* si 0x0F */ 0,
  35. /* dle 0x10 */ 0,
  36. /* dc1 0x11 */ 0,
  37. /* dc2 0x12 */ 0,
  38. /* dc3 0x13 */ 0,
  39. /* dc4 0x14 */ 0,
  40. /* nak 0x15 */ 0,
  41. /* syn 0x16 */ 0,
  42. /* etb 0x17 */ 0,
  43. /* can 0x18 */ 0,
  44. /* em 0x19 */ 0,
  45. /* sub 0x1A */ 0,
  46. /* esc 0x1B */ 0,
  47. /* fs 0x1C */ 0,
  48. /* gs 0x1D */ 0,
  49. /* rs 0x1E */ 0,
  50. /* us 0x1F */ 0,
  51. /* sp 0x20 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_SPACE_BIT,
  52. /* ! 0x21 */ __GLS_CHAR_GRAPHIC_BIT,
  53. /* " 0x22 */ __GLS_CHAR_GRAPHIC_BIT,
  54. /* # 0x23 */ __GLS_CHAR_GRAPHIC_BIT,
  55. /* $ 0x24 */ __GLS_CHAR_GRAPHIC_BIT,
  56. /* % 0x25 */ __GLS_CHAR_GRAPHIC_BIT,
  57. /* & 0x26 */ __GLS_CHAR_GRAPHIC_BIT,
  58. /* ' 0x27 */ __GLS_CHAR_GRAPHIC_BIT,
  59. /* ( 0x28 */ __GLS_CHAR_GRAPHIC_BIT,
  60. /* ) 0x29 */ __GLS_CHAR_GRAPHIC_BIT,
  61. /* * 0x2A */ __GLS_CHAR_GRAPHIC_BIT,
  62. /* + 0x2B */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  63. /* , 0x2C */ __GLS_CHAR_GRAPHIC_BIT,
  64. /* - 0x2D */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  65. /* . 0x2E */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  66. /* / 0x2F */ __GLS_CHAR_GRAPHIC_BIT,
  67. /* 0 0x30 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  68. /* 1 0x31 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  69. /* 2 0x32 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  70. /* 3 0x33 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  71. /* 4 0x34 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  72. /* 5 0x35 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  73. /* 6 0x36 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  74. /* 7 0x37 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  75. /* 8 0x38 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  76. /* 9 0x39 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  77. /* : 0x3A */ __GLS_CHAR_GRAPHIC_BIT,
  78. /* ; 0x3B */ __GLS_CHAR_GRAPHIC_BIT,
  79. /* < 0x3C */ __GLS_CHAR_GRAPHIC_BIT,
  80. /* = 0x3D */ __GLS_CHAR_GRAPHIC_BIT,
  81. /* > 0x3E */ __GLS_CHAR_GRAPHIC_BIT,
  82. /* ? 0x3F */ __GLS_CHAR_GRAPHIC_BIT,
  83. /* @ 0x40 */ __GLS_CHAR_GRAPHIC_BIT,
  84. /* A 0x41 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  85. /* B 0x42 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  86. /* C 0x43 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  87. /* D 0x44 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  88. /* E 0x45 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  89. /* F 0x46 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  90. /* G 0x47 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  91. /* H 0x48 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  92. /* I 0x49 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  93. /* J 0x4A */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  94. /* K 0x4B */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  95. /* L 0x4C */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  96. /* M 0x4D */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  97. /* N 0x4E */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  98. /* O 0x4F */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  99. /* P 0x50 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  100. /* Q 0x51 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  101. /* R 0x52 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  102. /* S 0x53 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  103. /* T 0x54 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  104. /* U 0x55 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  105. /* V 0x56 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  106. /* W 0x57 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  107. /* X 0x58 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  108. /* Y 0x59 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  109. /* Z 0x5A */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  110. /* [ 0x5B */ __GLS_CHAR_GRAPHIC_BIT,
  111. /* \ 0x5C */ __GLS_CHAR_GRAPHIC_BIT,
  112. /* ] 0x5D */ __GLS_CHAR_GRAPHIC_BIT,
  113. /* ^ 0x5E */ __GLS_CHAR_GRAPHIC_BIT,
  114. /* _ 0x5F */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  115. /* ` 0x60 */ __GLS_CHAR_GRAPHIC_BIT,
  116. /* a 0x61 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  117. /* b 0x62 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  118. /* c 0x63 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  119. /* d 0x64 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  120. /* e 0x65 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  121. /* f 0x66 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  122. /* g 0x67 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  123. /* h 0x68 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  124. /* i 0x69 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  125. /* j 0x6A */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  126. /* k 0x6B */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  127. /* l 0x6C */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  128. /* m 0x6D */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  129. /* n 0x6E */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  130. /* o 0x6F */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  131. /* p 0x70 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  132. /* q 0x71 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  133. /* r 0x72 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  134. /* s 0x73 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  135. /* t 0x74 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  136. /* u 0x75 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  137. /* v 0x76 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  138. /* w 0x77 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  139. /* x 0x78 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  140. /* y 0x79 */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  141. /* z 0x7A */ __GLS_CHAR_GRAPHIC_BIT | __GLS_CHAR_TOKEN_BIT,
  142. /* { 0x7B */ __GLS_CHAR_GRAPHIC_BIT,
  143. /* | 0x7C */ __GLS_CHAR_GRAPHIC_BIT,
  144. /* } 0x7D */ __GLS_CHAR_GRAPHIC_BIT,
  145. /* ~ 0x7E */ __GLS_CHAR_GRAPHIC_BIT,
  146. /* del 0x7F */ 0,
  147. /* 0x80 */ 0,
  148. /* 0x81 */ 0,
  149. /* 0x82 */ 0,
  150. /* 0x83 */ 0,
  151. /* 0x84 */ 0,
  152. /* 0x85 */ 0,
  153. /* 0x86 */ 0,
  154. /* 0x87 */ 0,
  155. /* 0x88 */ 0,
  156. /* 0x89 */ 0,
  157. /* 0x8A */ 0,
  158. /* 0x8B */ 0,
  159. /* 0x8C */ 0,
  160. /* 0x8D */ 0,
  161. /* 0x8E */ 0,
  162. /* 0x8F */ 0,
  163. /* 0x90 */ 0,
  164. /* 0x91 */ 0,
  165. /* 0x92 */ 0,
  166. /* 0x93 */ 0,
  167. /* 0x94 */ 0,
  168. /* 0x95 */ 0,
  169. /* 0x96 */ 0,
  170. /* 0x97 */ 0,
  171. /* 0x98 */ 0,
  172. /* 0x99 */ 0,
  173. /* 0x9A */ 0,
  174. /* 0x9B */ 0,
  175. /* 0x9C */ 0,
  176. /* 0x9D */ 0,
  177. /* 0x9E */ 0,
  178. /* 0x9F */ 0,
  179. /* 0xA0 */ 0,
  180. /* 0xA1 */ 0,
  181. /* 0xA2 */ 0,
  182. /* 0xA3 */ 0,
  183. /* 0xA4 */ 0,
  184. /* 0xA5 */ 0,
  185. /* 0xA6 */ 0,
  186. /* 0xA7 */ 0,
  187. /* 0xA8 */ 0,
  188. /* 0xA9 */ 0,
  189. /* 0xAA */ 0,
  190. /* 0xAB */ 0,
  191. /* 0xAC */ 0,
  192. /* 0xAD */ 0,
  193. /* 0xAE */ 0,
  194. /* 0xAF */ 0,
  195. /* 0xB0 */ 0,
  196. /* 0xB1 */ 0,
  197. /* 0xB2 */ 0,
  198. /* 0xB3 */ 0,
  199. /* 0xB4 */ 0,
  200. /* 0xB5 */ 0,
  201. /* 0xB6 */ 0,
  202. /* 0xB7 */ 0,
  203. /* 0xB8 */ 0,
  204. /* 0xB9 */ 0,
  205. /* 0xBA */ 0,
  206. /* 0xBB */ 0,
  207. /* 0xBC */ 0,
  208. /* 0xBD */ 0,
  209. /* 0xBE */ 0,
  210. /* 0xBF */ 0,
  211. /* 0xC0 */ 0,
  212. /* 0xC1 */ 0,
  213. /* 0xC2 */ 0,
  214. /* 0xC3 */ 0,
  215. /* 0xC4 */ 0,
  216. /* 0xC5 */ 0,
  217. /* 0xC6 */ 0,
  218. /* 0xC7 */ 0,
  219. /* 0xC8 */ 0,
  220. /* 0xC9 */ 0,
  221. /* 0xCA */ 0,
  222. /* 0xCB */ 0,
  223. /* 0xCC */ 0,
  224. /* 0xCD */ 0,
  225. /* 0xCE */ 0,
  226. /* 0xCF */ 0,
  227. /* 0xD0 */ 0,
  228. /* 0xD1 */ 0,
  229. /* 0xD2 */ 0,
  230. /* 0xD3 */ 0,
  231. /* 0xD4 */ 0,
  232. /* 0xD5 */ 0,
  233. /* 0xD6 */ 0,
  234. /* 0xD7 */ 0,
  235. /* 0xD8 */ 0,
  236. /* 0xD9 */ 0,
  237. /* 0xDA */ 0,
  238. /* 0xDB */ 0,
  239. /* 0xDC */ 0,
  240. /* 0xDD */ 0,
  241. /* 0xDE */ 0,
  242. /* 0xDF */ 0,
  243. /* 0xE0 */ 0,
  244. /* 0xE1 */ 0,
  245. /* 0xE2 */ 0,
  246. /* 0xE3 */ 0,
  247. /* 0xE4 */ 0,
  248. /* 0xE5 */ 0,
  249. /* 0xE6 */ 0,
  250. /* 0xE7 */ 0,
  251. /* 0xE8 */ 0,
  252. /* 0xE9 */ 0,
  253. /* 0xEA */ 0,
  254. /* 0xEB */ 0,
  255. /* 0xEC */ 0,
  256. /* 0xED */ 0,
  257. /* 0xEE */ 0,
  258. /* 0xEF */ 0,
  259. /* 0xF0 */ 0,
  260. /* 0xF1 */ 0,
  261. /* 0xF2 */ 0,
  262. /* 0xF3 */ 0,
  263. /* 0xF4 */ 0,
  264. /* 0xF5 */ 0,
  265. /* 0xF6 */ 0,
  266. /* 0xF7 */ 0,
  267. /* 0xF8 */ 0,
  268. /* 0xF9 */ 0,
  269. /* 0xFA */ 0,
  270. /* 0xFB */ 0,
  271. /* 0xFC */ 0,
  272. /* 0xFD */ 0,
  273. /* 0xFE */ 0,
  274. /* 0xFF */ 0,
  275. };
  276. GLSenum __glsBinCommand_BeginGLS_getType(
  277. __GLSbinCommand_BeginGLS *inCommand, __GLSversion *outVersion
  278. ) {
  279. GLuint countLarge = inCommand->head.countLarge;
  280. GLuint opLarge = inCommand->head.opLarge;
  281. __GLSversion version = inCommand->version;
  282. if (inCommand->head.opSmall || inCommand->head.countSmall) return GLS_NONE;
  283. if (
  284. opLarge == GLS_OP_glsBeginGLS &&
  285. countLarge == sizeof(*inCommand) / 4 &&
  286. (!version.major || version.major == __GLS_VERSION_MAJOR)
  287. ) {
  288. *outVersion = version;
  289. return __GLS_BINARY_SWAP0;
  290. }
  291. __glsSwap4(&opLarge);
  292. __glsSwap4(&countLarge);
  293. __glsSwap4(&version.major);
  294. __glsSwap4(&version.minor);
  295. if (
  296. opLarge == GLS_OP_glsBeginGLS &&
  297. countLarge == sizeof(*inCommand) / 4 &&
  298. (!version.major || version.major == __GLS_VERSION_MAJOR)
  299. ) {
  300. *outVersion = version;
  301. return __GLS_BINARY_SWAP1;
  302. }
  303. return GLS_NONE;
  304. }