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.

285 lines
8.4 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. /******************************************************************************
  18. __GLSreadStream
  19. ******************************************************************************/
  20. typedef struct {
  21. FILE *channel;
  22. __GLSstring name;
  23. GLboolean opened;
  24. GLSreadFunc readFunc;
  25. GLSwriteFunc unreadFunc;
  26. } __GLSreadStream;
  27. extern __GLSreadStream* __glsReadStream_create(const GLubyte *inName);
  28. extern __GLSreadStream* __glsReadStream_destroy(__GLSreadStream *inStream);
  29. extern GLbitfield __glsReadStream_getAttrib(const __GLSreadStream *inStream);
  30. extern size_t __glsReadStream_getByteCount(const __GLSreadStream *inStream);
  31. extern GLuint __glsReadStream_getCRC32(const __GLSreadStream *inStream);
  32. extern GLSenum __glsReadStream_getType(const __GLSreadStream *inStream);
  33. /******************************************************************************
  34. __GLSreader
  35. ******************************************************************************/
  36. #define __GLS_GET_SPACE(inoutReader) { \
  37. GLboolean __comment = GL_FALSE; \
  38. GLubyte __spaceChar; \
  39. do { \
  40. __GLS_READ_CHAR(inoutReader, __spaceChar); \
  41. switch (__spaceChar) { \
  42. case '#': \
  43. __comment = GL_TRUE; \
  44. break; \
  45. case '\n': \
  46. case '\r': \
  47. __comment = GL_FALSE; \
  48. break; \
  49. } \
  50. } while (__GLS_CHAR_IS_SPACE(__spaceChar) || __comment); \
  51. __GLS_UNREAD_CHAR(inoutReader); \
  52. }
  53. #define __GLS_READ_CHAR(inoutReader, outChar) \
  54. if ( \
  55. inoutReader->readPtr >= inoutReader->readTail && \
  56. !__glsReader_fillBuf(inoutReader, 1, GL_FALSE) \
  57. ) { \
  58. outChar = 0; \
  59. } else { \
  60. outChar = *inoutReader->readPtr++; \
  61. }
  62. #define __GLS_UNREAD_CHAR(inoutReader) \
  63. if (inoutReader->readPtr > inoutReader->buf) --inoutReader->readPtr;
  64. typedef struct __GLSreader {
  65. GLubyte *buf;
  66. size_t bufSize;
  67. GLSenum error;
  68. GLint paramCount;
  69. GLubyte *readHead;
  70. GLubyte *readPtr;
  71. GLubyte *readTail;
  72. const __GLSreadStream *stream;
  73. GLSenum type;
  74. __GLSversion version;
  75. } __GLSreader;
  76. extern GLvoid* __glsReader_allocCallBuf(
  77. __GLSreader *inoutReader, size_t inByteCount
  78. );
  79. extern GLvoid* __glsReader_allocFeedbackBuf(
  80. __GLSreader *inoutReader, size_t inByteCount
  81. );
  82. extern GLvoid* __glsReader_allocSelectBuf(
  83. __GLSreader *inoutReader, size_t inByteCount
  84. );
  85. #if __GL_EXT_vertex_array
  86. extern GLvoid* __glsReader_allocVertexArrayBuf(
  87. __GLSreader *inoutReader, GLSopcode inOpcode, size_t inByteCount
  88. );
  89. #endif /* __GL_EXT_vertex_array */
  90. extern void __glsReader_call(__GLSreader *inoutReader);
  91. extern __GLSreader* __glsReader_final(__GLSreader *inoutReader);
  92. extern GLboolean __glsReader_fillBuf(
  93. __GLSreader *inoutReader, size_t inMinBytes, GLboolean inRealign
  94. );
  95. extern __GLSreader* __glsReader_init_array(
  96. __GLSreader *outReader, const GLubyte *inArray, size_t inCount
  97. );
  98. extern __GLSreader* __glsReader_init_stream(
  99. __GLSreader *outReader, const __GLSreadStream *inStream, size_t inBufSize
  100. );
  101. extern void __glsReader_raiseError(__GLSreader *inoutReader, GLSenum inError);
  102. /******************************************************************************
  103. __GLSreader binary
  104. ******************************************************************************/
  105. extern GLboolean __glsReader_call_bin(__GLSreader *inoutReader);
  106. extern GLboolean __glsReader_call_bin_swap(__GLSreader *inoutReader);
  107. extern GLSenum __glsReader_readBeginGLS_bin(
  108. __GLSreader *inoutReader, __GLSversion *outVersion
  109. );
  110. /******************************************************************************
  111. __GLSreader text
  112. ******************************************************************************/
  113. extern GLboolean __glsReader_abortCommand_text(__GLSreader *inoutReader);
  114. extern GLboolean __glsReader_beginCommand_text(
  115. __GLSreader *inoutReader, __GLSstring *outCommand
  116. );
  117. extern GLboolean __glsReader_call_text(__GLSreader *inoutReader);
  118. extern GLboolean __glsReader_endCommand_text(__GLSreader *inoutReader);
  119. extern GLboolean __glsReader_getGLSenum_text(
  120. __GLSreader *inoutReader, GLSenum *outVal
  121. );
  122. extern GLboolean __glsReader_getGLSimageFlags_text(
  123. __GLSreader *inoutReader, GLbitfield *outVal
  124. );
  125. extern GLboolean __glsReader_getGLSopcode_text(
  126. __GLSreader *inoutReader, GLSopcode *outVal
  127. );
  128. extern GLboolean __glsReader_getGLattribMask_text(
  129. __GLSreader *inoutReader, GLbitfield *outVal
  130. );
  131. extern GLboolean __glsReader_getGLblendingFactor_text(
  132. __GLSreader *inoutReader, GLenum *outVal
  133. );
  134. extern GLboolean __glsReader_getGLboolean_text(
  135. __GLSreader *inoutReader, GLboolean *outVal
  136. );
  137. extern GLboolean __glsReader_getGLbooleanv_text(
  138. __GLSreader *inoutReader, GLuint inCount, GLboolean *outVec
  139. );
  140. extern GLboolean __glsReader_getGLbyte_text(
  141. __GLSreader *inoutReader, GLbyte *outVal
  142. );
  143. extern GLboolean __glsReader_getGLbytev_text(
  144. __GLSreader *inoutReader, GLuint inCount, GLbyte *outVec
  145. );
  146. extern GLboolean __glsReader_getGLcharv_text(
  147. __GLSreader *inoutReader, __GLSstring *outString
  148. );
  149. extern GLboolean __glsReader_getGLclearBufferMask_text(
  150. __GLSreader *inoutReader, GLbitfield *outVal
  151. );
  152. extern GLboolean __glsReader_getGLcompv_text(
  153. __GLSreader *inoutReader, GLenum inType, GLuint inBytes, GLvoid *outVec
  154. );
  155. extern GLboolean __glsReader_getGLdouble_text(
  156. __GLSreader *inoutReader, GLdouble *outVal
  157. );
  158. extern GLboolean __glsReader_getGLdoublev_text(
  159. __GLSreader *inoutReader, GLuint inCount, GLdouble *outVec
  160. );
  161. extern GLboolean __glsReader_getGLdrawBufferMode_text(
  162. __GLSreader *inoutReader, GLenum *outVal
  163. );
  164. extern GLboolean __glsReader_getGLenum_text(
  165. __GLSreader *inoutReader, GLenum *outVal
  166. );
  167. extern GLboolean __glsReader_getGLfloat_text(
  168. __GLSreader *inoutReader, GLfloat *outVal
  169. );
  170. extern GLboolean __glsReader_getGLfloatv_text(
  171. __GLSreader *inoutReader, GLuint inCount, GLfloat *outVec
  172. );
  173. extern GLboolean __glsReader_getGLint_text(
  174. __GLSreader *inoutReader, GLint *outVal
  175. );
  176. extern GLboolean __glsReader_getGLintv_text(
  177. __GLSreader *inoutReader, GLuint inCount, GLint *outVec
  178. );
  179. extern GLboolean __glsReader_getGLlong_text(
  180. __GLSreader *inoutReader, GLlong *outVal
  181. );
  182. extern GLboolean __glsReader_getGLlongv_text(
  183. __GLSreader *inoutReader, GLuint inCount, GLlong *outVec
  184. );
  185. extern GLboolean __glsReader_getGLshort_text(
  186. __GLSreader *inoutReader, GLshort *outVal
  187. );
  188. extern GLboolean __glsReader_getGLshortv_text(
  189. __GLSreader *inoutReader, GLuint inCount, GLshort *outVec
  190. );
  191. extern GLboolean __glsReader_getGLstencilOp_text(
  192. __GLSreader *inoutReader, GLenum *outVal
  193. );
  194. extern GLboolean __glsReader_getGLtextureComponentCount_text(
  195. __GLSreader *inoutReader, GLint *outVal
  196. );
  197. extern GLboolean __glsReader_getGLubyte_text(
  198. __GLSreader *inoutReader, GLubyte *outVal
  199. );
  200. extern GLboolean __glsReader_getGLubytev_text(
  201. __GLSreader *inoutReader, GLuint inCount, GLubyte *outVec
  202. );
  203. extern GLboolean __glsReader_getGLuint_text(
  204. __GLSreader *inoutReader, GLuint *outVal
  205. );
  206. extern GLboolean __glsReader_getGLuintv_text(
  207. __GLSreader *inoutReader, GLuint inCount, GLuint *outVec
  208. );
  209. extern GLboolean __glsReader_getGLulong_text(
  210. __GLSreader *inoutReader, GLulong *outVal
  211. );
  212. extern GLboolean __glsReader_getGLulongv_text(
  213. __GLSreader *inoutReader, GLuint inCount, GLulong *outVec
  214. );
  215. extern GLboolean __glsReader_getGLushort_text(
  216. __GLSreader *inoutReader, GLushort *outVal
  217. );
  218. extern GLboolean __glsReader_getGLushortv_text(
  219. __GLSreader *inoutReader, GLuint inCount, GLushort *outVec
  220. );
  221. extern GLboolean __glsReader_nextList_text(__GLSreader *inoutReader);
  222. extern GLSenum __glsReader_readBeginGLS_text(
  223. __GLSreader *inoutReader, __GLSversion *outVersion
  224. );