home *** CD-ROM | disk | FTP | other *** search
/ Chestnut's Multimedia Mania / MM_MANIA.ISO / graphics / povsrc20 / parse.h < prev    next >
Text File  |  1993-09-20  |  10KB  |  251 lines

  1. /****************************************************************************
  2. *                   parse.h
  3. *
  4. *  This header file is included by all all language parsing C modules in 
  5. *  POV-Ray. 
  6. *
  7. *  from Persistence of Vision Raytracer
  8. *  Copyright 1993 Persistence of Vision Team
  9. *---------------------------------------------------------------------------
  10. *  NOTICE: This source code file is provided so that users may experiment
  11. *  with enhancements to POV-Ray and to port the software to platforms other 
  12. *  than those supported by the POV-Ray Team.  There are strict rules under
  13. *  which you are permitted to use this file.  The rules are in the file
  14. *  named POVLEGAL.DOC which should be distributed with this file. If 
  15. *  POVLEGAL.DOC is not available or for more info please contact the POV-Ray
  16. *  Team Coordinator by leaving a message in CompuServe's Graphics Developer's
  17. *  Forum.  The latest version of POV-Ray may be found there as well.
  18. *
  19. * This program is based on the popular DKB raytracer version 2.12.
  20. * DKBTrace was originally written by David K. Buck.
  21. * DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
  22. *
  23. *****************************************************************************/
  24.  
  25. /* Here we create our own little language for doing the parsing.  It
  26. makes the code easier to read. */
  27.  
  28. #define EXPECT { int Exit_Flag; Exit_Flag = FALSE; \
  29.  while (!Exit_Flag) {Get_Token();  switch (Token.Token_Id) {
  30. #define CASE(x) case x:
  31. #define CASE2(x, y) case x: case y:
  32. #define CASE3(x, y, z) case x: case y: case z:
  33. #define CASE4(w, x, y, z) case w: case x: case y: case z:
  34. #define CASE5(v, w, x, y, z) case v: case w: case x: case y: case z:
  35. #define CASE6(u, v, w, x, y, z) case u: case v: case w: case x: case y: case z:
  36. #define END_CASE break;
  37. #define EXIT Exit_Flag = TRUE;
  38. #define OTHERWISE default:
  39. #define END_EXPECT } } }
  40. #define GET(x) Get_Token(); if (Token.Token_Id != x) Parse_Error (x);
  41. #define UNGET Unget_Token();
  42. #define CASE_VECTOR CASE3 (LEFT_PAREN_TOKEN, VECTOR_ID_TOKEN, FLOAT_ID_TOKEN)\
  43.  CASE5 (CLOCK_TOKEN, LEFT_ANGLE_TOKEN, PLUS_TOKEN, DASH_TOKEN, FLOAT_TOKEN)\
  44.  CASE4 (X_TOKEN, Y_TOKEN, Z_TOKEN, VERSION_TOKEN) UNGET
  45. #define CASE_FLOAT CASE3 (LEFT_PAREN_TOKEN, FLOAT_ID_TOKEN, CLOCK_TOKEN)\
  46.  CASE4 (PLUS_TOKEN, DASH_TOKEN, FLOAT_TOKEN, VERSION_TOKEN) UNGET
  47.  
  48. #define MAX_BRACES 200
  49.  
  50. #define CASEID(x,y) case x:Token.Token_Id=y;break;
  51.  
  52. /* Token Definitions for Parser */
  53.                                
  54. #define ADAPTIVE_TOKEN            0
  55. #define AGATE_TOKEN               1
  56. #define ALL_TOKEN                 2
  57. #define ALPHA_TOKEN               3
  58. #define AMBIENT_TOKEN             4
  59. #define AMPERSAND_TOKEN           5
  60. #define AREA_LIGHT_TOKEN          6
  61. #define AT_TOKEN                  7
  62. #define BACK_QUOTE_TOKEN          8
  63. #define BACK_SLASH_TOKEN          9
  64. #define BAR_TOKEN                10
  65. #define BICUBIC_PATCH_TOKEN      11
  66. #define BLOB_TOKEN               12
  67. #define BLUE_TOKEN               13
  68. #define BOUNDED_BY_TOKEN         14
  69. #define BOX_TOKEN                15
  70. #define BOZO_TOKEN               16
  71. #define BRICK_TOKEN              17
  72. #define BRILLIANCE_TOKEN         18
  73. #define BUMPS_TOKEN              19
  74. #define BUMPY1_TOKEN             20
  75. #define BUMPY2_TOKEN             21
  76. #define BUMPY3_TOKEN             22
  77. #define BUMP_MAP_TOKEN           23
  78. #define BUMP_SIZE_TOKEN          24
  79. #define CAMERA_ID_TOKEN          25
  80. #define CAMERA_TOKEN             26
  81. #define CHECKER_TOKEN            27
  82. #define CLIPPED_BY_TOKEN         28
  83. #define CLOCK_TOKEN              29
  84. #define COLON_TOKEN              30
  85. #define COLOR_MAP_TOKEN          31
  86. #define COLOR_TOKEN              32
  87. #define COLOUR_ID_TOKEN          33
  88. #define COLOUR_MAP_ID_TOKEN      34
  89. #define COLOUR_MAP_TOKEN         35
  90. #define COLOUR_TOKEN             36
  91. #define COMMA_TOKEN              37
  92. #define COMPONENT_TOKEN          38
  93. #define COMPOSITE_TOKEN          39
  94. #define CONE_TOKEN               40
  95. #define CRAND_TOKEN              41
  96. #define CUBIC_TOKEN              42
  97. #define CYLINDER_TOKEN           43
  98. #define DASH_TOKEN               44
  99. #define DECLARE_TOKEN            45
  100. #define DEFAULT_TOKEN            46
  101. #define DENTS_TOKEN              47
  102. #define DIFFERENCE_TOKEN         48
  103. #define DIFFUSE_TOKEN            49
  104. #define DIRECTION_TOKEN          50
  105. #define DISC_TOKEN               51
  106. #define DISTANCE_TOKEN           52
  107. #define DOLLAR_TOKEN             53
  108. #define DUMP_TOKEN               54
  109. #define END_OF_FILE_TOKEN        55
  110. #define EQUALS_TOKEN             56
  111. #define EXCLAMATION_TOKEN        57
  112. #define FALLOFF_TOKEN            58
  113. #define FINISH_ID_TOKEN          59
  114. #define FINISH_TOKEN             60
  115. #define FLATNESS_TOKEN           61
  116. #define FLOAT_ID_TOKEN           62
  117. #define FLOAT_TOKEN              63
  118. #define FOG_TOKEN                64
  119. #define FREQUENCY_TOKEN          65
  120. #define GIF_TOKEN                66
  121. #define GRADIENT_TOKEN           67
  122. #define GRANITE_TOKEN            68
  123. #define GREEN_TOKEN              69
  124. #define HASH_TOKEN               70
  125. #define HAT_TOKEN                71
  126. #define HEIGHT_FIELD_TOKEN       72
  127. #define HEXAGON_TOKEN            73
  128. #define IDENTIFIER_TOKEN         74
  129. #define IFF_TOKEN                75
  130. #define IMAGE_MAP_TOKEN          76
  131. #define INCLUDE_TOKEN            77
  132. #define INTERPOLATE_TOKEN        78
  133. #define INTERSECTION_TOKEN       79
  134. #define INVERSE_TOKEN            80
  135. #define IOR_TOKEN                81
  136. #define JITTER_TOKEN             82
  137. #define LAMBDA_TOKEN             83
  138. #define LEFT_ANGLE_TOKEN         84
  139. #define LEFT_CURLY_TOKEN         85
  140. #define LEFT_PAREN_TOKEN         86
  141. #define LEFT_SQUARE_TOKEN        87
  142. #define LEOPARD_TOKEN            88
  143. #define LIGHT_SOURCE_TOKEN       89
  144. #define LOCATION_TOKEN           90
  145. #define LOOKS_LIKE_TOKEN         91
  146. #define LOOK_AT_TOKEN            92
  147. #define MANDEL_TOKEN             93 
  148. #define MAP_TYPE_TOKEN           94
  149. #define MARBLE_TOKEN             95
  150. #define MATERIAL_MAP_TOKEN       96
  151. #define MAX_INTERSECTIONS        97
  152. #define MAX_TRACE_LEVEL_TOKEN    98
  153. #define MERGE_TOKEN              99
  154. #define METALLIC_TOKEN          100
  155. #define MORTAR_TOKEN            101
  156. #define NO_SHADOW_TOKEN         102
  157. #define OBJECT_ID_TOKEN         103
  158. #define OBJECT_TOKEN            104
  159. #define OCTAVES_TOKEN           105 
  160. #define OMEGA_TOKEN             106
  161. #define ONCE_TOKEN              107
  162. #define ONION_TOKEN             108
  163. #define PAINTED1_TOKEN          109
  164. #define PAINTED2_TOKEN          110
  165. #define PAINTED3_TOKEN          111
  166. #define PERCENT_TOKEN           112
  167. #define PHASE_TOKEN             113
  168. #define PHONG_SIZE_TOKEN        114
  169. #define PHONG_TOKEN             115
  170. #define PIGMENT_ID_TOKEN        116
  171. #define PIGMENT_TOKEN           117
  172. #define PLANE_TOKEN             118
  173. #define PLUS_TOKEN              119
  174. #define POINT_AT_TOKEN          120
  175. #define POLY_TOKEN              121
  176. #define POT_TOKEN               122
  177. #define QUADRIC_TOKEN           123
  178. #define QUARTIC_TOKEN           124
  179. #define QUESTION_TOKEN          125
  180. #define QUICK_COLOR_TOKEN       126
  181. #define QUICK_COLOUR_TOKEN      127
  182. #define RADIAL_TOKEN            128
  183. #define RADIUS_TOKEN            129
  184. #define RAW_TOKEN               130
  185. #define RED_TOKEN               131
  186. #define REFLECTION_TOKEN        132
  187. #define REFRACTION_TOKEN        133
  188. #define RGBF_TOKEN              134
  189. #define RGB_TOKEN               135
  190. #define RIGHT_ANGLE_TOKEN       136
  191. #define RIGHT_CURLY_TOKEN       137
  192. #define RIGHT_PAREN_TOKEN       138
  193. #define RIGHT_SQUARE_TOKEN      139
  194. #define RIGHT_TOKEN             140
  195. #define RIPPLES_TOKEN           141
  196. #define ROTATE_TOKEN            142
  197. #define ROUGHNESS_TOKEN         143
  198. #define SCALE_TOKEN             144
  199. #define SEMI_COLON_TOKEN        145
  200. #define SINGLE_QUOTE_TOKEN      146
  201. #define SKY_TOKEN               147
  202. #define SLASH_TOKEN             148
  203. #define SMOOTH_TOKEN            149
  204. #define SMOOTH_TRIANGLE_TOKEN   150
  205. #define SPECULAR_TOKEN          151
  206. #define SPHERE_TOKEN            152
  207. #define SPOTLIGHT_TOKEN         153
  208. #define SPOTTED_TOKEN           154
  209. #define STAR_TOKEN              155
  210. #define STRING_TOKEN            156
  211. #define STURM_TOKEN             157
  212. #define TEXTURE_ID_TOKEN        158
  213. #define TEXTURE_TOKEN           159
  214. #define TGA_TOKEN               160
  215. #define THRESHOLD_TOKEN         161
  216. #define TIGHTNESS_TOKEN         162
  217. #define TILDE_TOKEN             163
  218. #define TILE2_TOKEN             164
  219. #define TILES_TOKEN             165
  220. #define TNORMAL_ID_TOKEN        166
  221. #define TNORMAL_TOKEN           167
  222. #define TORUS_TOKEN             168
  223. #define TRACK_TOKEN             169
  224. #define TRANSFORM_ID_TOKEN      170
  225. #define TRANSFORM_TOKEN         171
  226. #define TRANSLATE_TOKEN         172
  227. #define TRIANGLE_TOKEN          173
  228. #define TURBULENCE_TOKEN        174
  229. #define TYPE_TOKEN              175
  230. #define UNION_TOKEN             176
  231. #define UP_TOKEN                177
  232. #define USE_COLOR_TOKEN         178
  233. #define USE_COLOUR_TOKEN        179
  234. #define USE_INDEX_TOKEN         180
  235. #define U_STEPS_TOKEN           181
  236. #define VECTOR_ID_TOKEN         182
  237. #define VERSION_TOKEN           183
  238. #define V_STEPS_TOKEN           184
  239. #define WATER_LEVEL_TOKEN       185
  240. #define WAVES_TOKEN             186
  241. #define WOOD_TOKEN              187
  242. #define WRINKLES_TOKEN          188
  243. #define X_TOKEN                 189
  244. #define Y_TOKEN                 190
  245. #define Z_TOKEN                 191
  246. #define BACKGROUND_TOKEN        192
  247. #define OPEN_TOKEN              193
  248. #define FILTER_TOKEN            194
  249. #define AGATE_TURB_TOKEN        195
  250. #define LAST_TOKEN              196
  251.