_slang.h 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406
  1. #ifndef PRIVATE_SLANG_H_
  2. #define PRIVATE_SLANG_H_
  3. /* header file for S-Lang internal structures that users do not (should not)
  4. need. Use slang.h for that purpose. */
  5. /*
  6. Copyright (C) 2004, 2005, 2006 John E. Davis
  7. This file is part of the S-Lang Library.
  8. The S-Lang Library is free software; you can redistribute it and/or
  9. modify it under the terms of the GNU General Public License as
  10. published by the Free Software Foundation; either version 2 of the
  11. License, or (at your option) any later version.
  12. The S-Lang Library is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. General Public License for more details.
  16. You should have received a copy of the GNU General Public License
  17. along with this library; if not, write to the Free Software
  18. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  19. USA.
  20. */
  21. /* #include "config.h" */
  22. #include "jdmacros.h"
  23. #include "sllimits.h"
  24. #ifdef VMS
  25. # define SLANG_SYSTEM_NAME "_VMS"
  26. #else
  27. # if defined (IBMPC_SYSTEM)
  28. # define SLANG_SYSTEM_NAME "_IBMPC"
  29. # else
  30. # define SLANG_SYSTEM_NAME "_UNIX"
  31. # endif
  32. #endif /* VMS */
  33. /* These quantities are main_types for byte-compiled code. They are used
  34. * by the inner_interp routine. The _BC_ means byte-code.
  35. */
  36. /* Nametype byte-codes --- these must correspond to those in slang.h */
  37. typedef enum
  38. {
  39. SLANG_BC_LAST_BLOCK = 0,
  40. SLANG_BC_LVARIABLE = SLANG_LVARIABLE, /* 0x01 */
  41. SLANG_BC_GVARIABLE = SLANG_GVARIABLE, /* 0x02 */
  42. SLANG_BC_IVARIABLE = SLANG_IVARIABLE, /* 0x03 */
  43. SLANG_BC_RVARIABLE = SLANG_RVARIABLE, /* 0x04 */
  44. SLANG_BC_INTRINSIC = SLANG_INTRINSIC, /* 0x05 */
  45. SLANG_BC_FUNCTION = SLANG_FUNCTION, /* 0x06 */
  46. SLANG_BC_MATH_UNARY = SLANG_MATH_UNARY, /* 0x07 */
  47. SLANG_BC_APP_UNARY = SLANG_APP_UNARY, /* 0x08 */
  48. SLANG_BC_ARITH_UNARY = SLANG_ARITH_UNARY, /* 0x09 */
  49. SLANG_BC_ARITH_BINARY = SLANG_ARITH_BINARY, /* 0x0A */
  50. SLANG_BC_ICONST = SLANG_ICONSTANT, /* 0x0B */
  51. SLANG_BC_DCONST = SLANG_DCONSTANT, /* 0x0C */
  52. SLANG_BC_FCONST = SLANG_FCONSTANT, /* 0x0D */
  53. SLANG_BC_LLCONST = SLANG_LLCONSTANT, /* 0x0E */
  54. SLANG_BC_PVARIABLE = SLANG_PVARIABLE, /* 0x0F */
  55. SLANG_BC_PFUNCTION = SLANG_PFUNCTION, /* 0x10 */
  56. SLANG_BC_HCONST = SLANG_HCONSTANT, /* 0x11 */
  57. SLANG_BC_LCONST = SLANG_LCONSTANT, /* 0x12 */
  58. SLANG_BC_UNUSED_0x12 = 0x12,
  59. SLANG_BC_UNUSED_0x13 = 0x13,
  60. SLANG_BC_UNUSED_0x14 = 0x14,
  61. SLANG_BC_UNUSED_0x15 = 0x15,
  62. SLANG_BC_UNUSED_0x16 = 0x16,
  63. SLANG_BC_UNUSED_0x17 = 0x17,
  64. SLANG_BC_UNUSED_0x18 = 0x18,
  65. SLANG_BC_UNUSED_0x19 = 0x19,
  66. SLANG_BC_UNUSED_0x1A = 0x1A,
  67. SLANG_BC_UNUSED_0x1B = 0x1B,
  68. SLANG_BC_UNUSED_0x1C = 0x1C,
  69. SLANG_BC_UNUSED_0x1D = 0x1D,
  70. SLANG_BC_UNUSED_0x1E = 0x1E,
  71. SLANG_BC_UNUSED_0x1F = 0x1F,
  72. /* bytes codes for setting/assigning variables/arrays/structures/refs */
  73. SLANG_BC_SET_LOCAL_LVALUE = 0x20,
  74. SLANG_BC_SET_GLOBAL_LVALUE = 0x21,
  75. SLANG_BC_SET_INTRIN_LVALUE = 0x22,
  76. SLANG_BC_SET_STRUCT_LVALUE = 0x23,
  77. SLANG_BC_SET_ARRAY_LVALUE = 0x24,
  78. SLANG_BC_SET_DEREF_LVALUE = 0x25,
  79. SLANG_BC_FIELD = 0x26,
  80. SLANG_BC_METHOD = 0x27,
  81. SLANG_BC_LVARIABLE_AGET = 0x28,
  82. SLANG_BC_LVARIABLE_APUT = 0x29,
  83. SLANG_BC_LOBJPTR = 0x2A,
  84. SLANG_BC_GOBJPTR = 0x2B,
  85. SLANG_BC_UNUSED_0x2C = 0x2C,
  86. SLANG_BC_UNUSED_0x2D = 0x2D,
  87. SLANG_BC_UNUSED_0x2E = 0x2E,
  88. SLANG_BC_UNUSED_0x2F = 0x2F,
  89. SLANG_BC_UNUSED_0x30 = 0x30,
  90. SLANG_BC_UNUSED_0x31 = 0x31,
  91. SLANG_BC_UNUSED_0x32 = 0x32,
  92. SLANG_BC_UNUSED_0x33 = 0x33,
  93. SLANG_BC_UNUSED_0x34 = 0x34,
  94. SLANG_BC_UNUSED_0x35 = 0x35,
  95. SLANG_BC_UNUSED_0x36 = 0x36,
  96. SLANG_BC_UNUSED_0x37 = 0x37,
  97. SLANG_BC_UNUSED_0x38 = 0x38,
  98. SLANG_BC_UNUSED_0x39 = 0x39,
  99. SLANG_BC_UNUSED_0x3A = 0x3A,
  100. SLANG_BC_UNUSED_0x3B = 0x3B,
  101. SLANG_BC_UNUSED_0x3C = 0x3C,
  102. SLANG_BC_UNUSED_0x3D = 0x3D,
  103. SLANG_BC_UNUSED_0x3E = 0x3E,
  104. SLANG_BC_UNUSED_0x3F = 0x3F,
  105. /* byte codes for literals */
  106. SLANG_BC_LITERAL = 0x40, /* constant objects */
  107. SLANG_BC_LITERAL_INT = 0x41,
  108. SLANG_BC_LITERAL_DBL = 0x42,
  109. SLANG_BC_LITERAL_STR = 0x43,
  110. SLANG_BC_DOLLAR_STR = 0x44,
  111. SLANG_BC_LITERAL_SHORT = 0x45,
  112. SLANG_BC_LITERAL_LONG = 0x46,
  113. SLANG_BC_UNUSED_0x45 = 0x45,
  114. SLANG_BC_UNUSED_0x46 = 0x46,
  115. SLANG_BC_UNUSED_0x47 = 0x47,
  116. SLANG_BC_UNUSED_0x48 = 0x48,
  117. SLANG_BC_UNUSED_0x49 = 0x49,
  118. SLANG_BC_UNUSED_0x4A = 0x4A,
  119. SLANG_BC_UNUSED_0x4B = 0x4B,
  120. SLANG_BC_UNUSED_0x4C = 0x4C,
  121. SLANG_BC_UNUSED_0x4D = 0x4D,
  122. SLANG_BC_UNUSED_0x4E = 0x4E,
  123. SLANG_BC_UNUSED_0x4F = 0x4F,
  124. /* Unary/Binary operation codes */
  125. SLANG_BC_UNARY = 0x50,
  126. SLANG_BC_BINARY = 0x51,
  127. SLANG_BC_INTEGER_PLUS = 0x52,
  128. SLANG_BC_INTEGER_MINUS = 0x53,
  129. SLANG_BC_UNUSED_0x54 = 0x54,
  130. SLANG_BC_UNUSED_0x55 = 0x55,
  131. SLANG_BC_UNUSED_0x56 = 0x56,
  132. SLANG_BC_UNUSED_0x57 = 0x57,
  133. SLANG_BC_UNUSED_0x58 = 0x58,
  134. SLANG_BC_UNUSED_0x59 = 0x59,
  135. SLANG_BC_UNUSED_0x5A = 0x5A,
  136. SLANG_BC_UNUSED_0x5B = 0x5B,
  137. SLANG_BC_UNUSED_0x5C = 0x5C,
  138. SLANG_BC_UNUSED_0x5D = 0x5D,
  139. SLANG_BC_UNUSED_0x5E = 0x5E,
  140. SLANG_BC_UNUSED_0x5F = 0x5F,
  141. /* byte codes associated with keywords and blocks */
  142. SLANG_BC_TMP = 0x60,
  143. SLANG_BC_EXCH = 0x61,
  144. SLANG_BC_LABEL = 0x62,
  145. SLANG_BC_BLOCK = 0x63,
  146. SLANG_BC_RETURN = 0x64,
  147. SLANG_BC_BREAK = 0x65,
  148. SLANG_BC_CONTINUE = 0x66,
  149. SLANG_BC_IF_BLOCK = 0x67, /* optimized code */
  150. SLANG_BC_UNUSED_0x68 = 0x68,
  151. SLANG_BC_UNUSED_0x69 = 0x69,
  152. SLANG_BC_X_ERROR = 0x6A,
  153. SLANG_BC_X_USER0 = 0x6B,
  154. SLANG_BC_X_USER1 = 0x6C,
  155. SLANG_BC_X_USER2 = 0x6D,
  156. SLANG_BC_X_USER3 = 0x6E,
  157. SLANG_BC_X_USER4 = 0x6F,
  158. /* byte codes for dealing with the frame pointer and arg list */
  159. SLANG_BC_CALL_DIRECT = 0x70,
  160. SLANG_BC_CALL_DIRECT_FRAME = 0x71,
  161. /* SLANG_BC_ARG_LVARIABLE = 0x72, */
  162. SLANG_BC_UNUSED_0x72 = 0x72,
  163. SLANG_BC_EARG_LVARIABLE = 0x73,
  164. SLANG_BC_LINE_NUM = 0x74,
  165. SLANG_BC_BOS = 0x75,
  166. SLANG_BC_EOS = 0x76,
  167. SLANG_BC_UNUSED_0x77 = 0x77,
  168. SLANG_BC_UNUSED_0x78 = 0x78,
  169. SLANG_BC_UNUSED_0x79 = 0x79,
  170. SLANG_BC_UNUSED_0x7A = 0x7A,
  171. SLANG_BC_UNUSED_0x7B = 0x7B,
  172. SLANG_BC_UNUSED_0x7C = 0x7C,
  173. SLANG_BC_UNUSED_0x7D = 0x7D,
  174. SLANG_BC_UNUSED_0x7E = 0x7E,
  175. SLANG_BC_UNUSED_0x7F = 0x7F,
  176. /* These are used only when compiled with USE_COMBINED_BYTECODES */
  177. SLANG_BC_CALL_DIRECT_INTRINSIC= 0x80,
  178. SLANG_BC_INTRINSIC_CALL_DIRECT= 0x81,
  179. SLANG_BC_CALL_DIRECT_LSTR = 0x82,
  180. SLANG_BC_CALL_DIRECT_SLFUN = 0x83,
  181. SLANG_BC_CALL_DIRECT_RETINTR = 0x84,
  182. SLANG_BC_RET_INTRINSIC = 0x85,
  183. SLANG_BC_CALL_DIRECT_EARG_LVAR= 0x86,
  184. SLANG_BC_CALL_DIRECT_LINT = 0x87,
  185. SLANG_BC_CALL_DIRECT_LVAR = 0x88,
  186. SLANG_BC_LLVARIABLE_BINARY = 0x89,
  187. SLANG_BC_LGVARIABLE_BINARY = 0x8A,
  188. SLANG_BC_GLVARIABLE_BINARY = 0x8B,
  189. SLANG_BC_GGVARIABLE_BINARY = 0x8C,
  190. SLANG_BC_LIVARIABLE_BINARY = 0x8D,
  191. SLANG_BC_LDVARIABLE_BINARY = 0x8E,
  192. SLANG_BC_ILVARIABLE_BINARY = 0x8F,
  193. SLANG_BC_DLVARIABLE_BINARY = 0x90,
  194. SLANG_BC_LVARIABLE_BINARY = 0x91,
  195. SLANG_BC_GVARIABLE_BINARY = 0x92,
  196. SLANG_BC_LITERAL_INT_BINARY = 0x93,
  197. SLANG_BC_LITERAL_DBL_BINARY = 0x94,
  198. SLANG_BC_LASSIGN_LLBINARY = 0x95,
  199. SLANG_BC_LASSIGN_LIBINARY = 0x96,
  200. SLANG_BC_LASSIGN_ILBINARY = 0x97,
  201. SLANG_BC_LASSIGN_LDBINARY = 0x98,
  202. SLANG_BC_LASSIGN_DLBINARY = 0x99,
  203. SLANG_BC_RET_LVARIABLE = 0x9A,
  204. SLANG_BC_RET_LITERAL_INT = 0x9B,
  205. SLANG_BC_MANY_LVARIABLE = 0x9C,
  206. SLANG_BC_MANY_LVARIABLE_DIR = 0x9D,
  207. SLANG_BC_LVARIABLE_AGET1 = 0x9E,
  208. SLANG_BC_LITERAL_AGET1 = 0x9F,
  209. SLANG_BC_LVARIABLE_APUT1 = 0xA0,
  210. SLANG_BC_LITERAL_APUT1 = 0xA1,
  211. SLANG_BC_UNUSED_0xA2 = 0xA2,
  212. SLANG_BC_UNUSED_0xA3 = 0xA3,
  213. SLANG_BC_UNUSED_0xA4 = 0xA4,
  214. SLANG_BC_UNUSED_0xA5 = 0xA5,
  215. SLANG_BC_UNUSED_0xA6 = 0xA6,
  216. SLANG_BC_UNUSED_0xA7 = 0xA7,
  217. SLANG_BC_UNUSED_0xA8 = 0xA8,
  218. SLANG_BC_UNUSED_0xA9 = 0xA9,
  219. SLANG_BC_UNUSED_0xAA = 0xAA,
  220. SLANG_BC_UNUSED_0xAB = 0xAB,
  221. SLANG_BC_UNUSED_0xAC = 0xAC,
  222. SLANG_BC_UNUSED_0xAD = 0xAD,
  223. SLANG_BC_UNUSED_0xAE = 0xAE,
  224. SLANG_BC_UNUSED_0xAF = 0xAF,
  225. /* The following do not actually occur in inner_interp. They used
  226. * to signify the bytecode has been combined with another.
  227. */
  228. SLANG_BC_LVARIABLE_COMBINED = 0xB0,
  229. SLANG_BC_GVARIABLE_COMBINED = 0xB1,
  230. SLANG_BC_LITERAL_COMBINED = 0xB2,
  231. SLANG_BC_CALL_DIRECT_COMB = 0xB3,
  232. SLANG_BC_COMBINED = 0xB4,
  233. SLANG_BC_UNUSED_0xB5 = 0xB5,
  234. SLANG_BC_UNUSED_0xB6 = 0xB6,
  235. SLANG_BC_UNUSED_0xB7 = 0xB7,
  236. SLANG_BC_UNUSED_0xB8 = 0xB8,
  237. SLANG_BC_UNUSED_0xB9 = 0xB9,
  238. SLANG_BC_UNUSED_0xBA = 0xBA,
  239. SLANG_BC_UNUSED_0xBB = 0xBB,
  240. SLANG_BC_UNUSED_0xBC = 0xBC,
  241. SLANG_BC_UNUSED_0xBD = 0xBD,
  242. SLANG_BC_UNUSED_0xBE = 0xBE,
  243. SLANG_BC_UNUSED_0xBF = 0xBF,
  244. SLANG_BC_UNUSED_0xC0 = 0xC0,
  245. SLANG_BC_UNUSED_0xC1 = 0xC1,
  246. SLANG_BC_UNUSED_0xC2 = 0xC2,
  247. SLANG_BC_UNUSED_0xC3 = 0xC3,
  248. SLANG_BC_UNUSED_0xC4 = 0xC4,
  249. SLANG_BC_UNUSED_0xC5 = 0xC5,
  250. SLANG_BC_UNUSED_0xC6 = 0xC6,
  251. SLANG_BC_UNUSED_0xC7 = 0xC7,
  252. SLANG_BC_UNUSED_0xC8 = 0xC8,
  253. SLANG_BC_UNUSED_0xC9 = 0xC9,
  254. SLANG_BC_UNUSED_0xCA = 0xCA,
  255. SLANG_BC_UNUSED_0xCB = 0xCB,
  256. SLANG_BC_UNUSED_0xCC = 0xCC,
  257. SLANG_BC_UNUSED_0xCD = 0xCD,
  258. SLANG_BC_UNUSED_0xCE = 0xCE,
  259. SLANG_BC_UNUSED_0xCF = 0xCF,
  260. SLANG_BC_UNUSED_0xD0 = 0xD0,
  261. SLANG_BC_UNUSED_0xD1 = 0xD1,
  262. SLANG_BC_UNUSED_0xD2 = 0xD2,
  263. SLANG_BC_UNUSED_0xD3 = 0xD3,
  264. SLANG_BC_UNUSED_0xD4 = 0xD4,
  265. SLANG_BC_UNUSED_0xD5 = 0xD5,
  266. SLANG_BC_UNUSED_0xD6 = 0xD6,
  267. SLANG_BC_UNUSED_0xD7 = 0xD7,
  268. SLANG_BC_UNUSED_0xD8 = 0xD8,
  269. SLANG_BC_UNUSED_0xD9 = 0xD9,
  270. SLANG_BC_UNUSED_0xDA = 0xDA,
  271. SLANG_BC_UNUSED_0xDB = 0xDB,
  272. SLANG_BC_UNUSED_0xDC = 0xDC,
  273. SLANG_BC_UNUSED_0xDD = 0xDD,
  274. SLANG_BC_UNUSED_0xDE = 0xDE,
  275. SLANG_BC_UNUSED_0xDF = 0xDF,
  276. SLANG_BC_UNUSED_0xE0 = 0xE0,
  277. SLANG_BC_UNUSED_0xE1 = 0xE1,
  278. SLANG_BC_UNUSED_0xE2 = 0xE2,
  279. SLANG_BC_UNUSED_0xE3 = 0xE3,
  280. SLANG_BC_UNUSED_0xE4 = 0xE4,
  281. SLANG_BC_UNUSED_0xE5 = 0xE5,
  282. SLANG_BC_UNUSED_0xE6 = 0xE6,
  283. SLANG_BC_UNUSED_0xE7 = 0xE7,
  284. SLANG_BC_UNUSED_0xE8 = 0xE8,
  285. SLANG_BC_UNUSED_0xE9 = 0xE9,
  286. SLANG_BC_UNUSED_0xEA = 0xEA,
  287. SLANG_BC_UNUSED_0xEB = 0xEB,
  288. SLANG_BC_UNUSED_0xEC = 0xEC,
  289. SLANG_BC_UNUSED_0xED = 0xED,
  290. SLANG_BC_UNUSED_0xEE = 0xEE,
  291. SLANG_BC_UNUSED_0xEF = 0xEF,
  292. SLANG_BC_UNUSED_0xF0 = 0xF0,
  293. SLANG_BC_UNUSED_0xF1 = 0xF1,
  294. SLANG_BC_UNUSED_0xF2 = 0xF2,
  295. SLANG_BC_UNUSED_0xF3 = 0xF3,
  296. SLANG_BC_UNUSED_0xF4 = 0xF4,
  297. SLANG_BC_UNUSED_0xF5 = 0xF5,
  298. SLANG_BC_UNUSED_0xF6 = 0xF6,
  299. SLANG_BC_UNUSED_0xF7 = 0xF7,
  300. SLANG_BC_UNUSED_0xF8 = 0xF8,
  301. SLANG_BC_UNUSED_0xF9 = 0xF9,
  302. SLANG_BC_UNUSED_0xFA = 0xFA,
  303. SLANG_BC_UNUSED_0xFB = 0xFB,
  304. SLANG_BC_UNUSED_0xFC = 0xFC,
  305. SLANG_BC_UNUSED_0xFD = 0xFD,
  306. SLANG_BC_UNUSED_0xFE = 0xFE,
  307. SLANG_BC_UNUSED_0xFF = 0xFF
  308. }
  309. _pSLang_BC_Type;
  310. /* Byte-Code Sub Types (_BCST_) */
  311. /* These are sub_types of SLANG_BC_BLOCK */
  312. #define SLANG_BCST_ERROR_BLOCK 0x01
  313. #define SLANG_BCST_EXIT_BLOCK 0x02
  314. #define SLANG_BCST_USER_BLOCK0 0x03
  315. #define SLANG_BCST_USER_BLOCK1 0x04
  316. #define SLANG_BCST_USER_BLOCK2 0x05
  317. #define SLANG_BCST_USER_BLOCK3 0x06
  318. #define SLANG_BCST_USER_BLOCK4 0x07
  319. /* The user blocks MUST be in the above order */
  320. #define SLANG_BCST_LOOP 0x10
  321. #define SLANG_BCST_WHILE 0x11
  322. #define SLANG_BCST_FOR 0x12
  323. #define SLANG_BCST_FOREVER 0x13
  324. #define SLANG_BCST_CFOR 0x14
  325. #define SLANG_BCST_DOWHILE 0x15
  326. #define SLANG_BCST_FOREACH 0x16
  327. #define SLANG_BCST_TRY 0x17
  328. #define SLANG_BCST_IF 0x20
  329. #define SLANG_BCST_IFNOT 0x21
  330. #define SLANG_BCST_ELSE 0x22
  331. #define SLANG_BCST_ANDELSE 0x23
  332. #define SLANG_BCST_ORELSE 0x24
  333. #define SLANG_BCST_SWITCH 0x25
  334. #define SLANG_BCST_NOTELSE 0x26
  335. /* assignment (SLANG_BC_SET_*_LVALUE) subtypes. The order MUST correspond
  336. * to the assignment token order with the ASSIGN_TOKEN as the first!
  337. */
  338. #define SLANG_BCST_ASSIGN 0x01
  339. #define SLANG_BCST_PLUSEQS 0x02
  340. #define SLANG_BCST_MINUSEQS 0x03
  341. #define SLANG_BCST_TIMESEQS 0x04
  342. #define SLANG_BCST_DIVEQS 0x05
  343. #define SLANG_BCST_BOREQS 0x06
  344. #define SLANG_BCST_BANDEQS 0x07
  345. #define SLANG_BCST_PLUSPLUS 0x08
  346. #define SLANG_BCST_POST_PLUSPLUS 0x09
  347. #define SLANG_BCST_MINUSMINUS 0x0A
  348. #define SLANG_BCST_POST_MINUSMINUS 0x0B
  349. /* These use SLANG_PLUS, SLANG_MINUS, SLANG_PLUSPLUS, etc... */
  350. #define LONG_IS_INT (SIZEOF_INT == SIZEOF_LONG)
  351. #define LONG_IS_NOT_INT (SIZEOF_INT != SIZEOF_LONG)
  352. #define SHORT_IS_INT (SIZEOF_INT == SIZEOF_SHORT)
  353. #define SHORT_IS_NOT_INT (SIZEOF_INT != SIZEOF_SHORT)
  354. #define LLONG_IS_LONG (SIZEOF_LONG == SIZEOF_LONG_LONG)
  355. #define LLONG_IS_NOT_LONG (SIZEOF_LONG != SIZEOF_LONG_LONG)
  356. /* If long or short are ints, then map the slang types to ints. This is
  357. * done because slang has some optimizations for ints.
  358. */
  359. #if LONG_IS_INT
  360. # define _pSLANG_LONG_TYPE SLANG_INT_TYPE
  361. # define _pSLANG_ULONG_TYPE SLANG_UINT_TYPE
  362. #else
  363. # define _pSLANG_LONG_TYPE SLANG_LONG_TYPE
  364. # define _pSLANG_ULONG_TYPE SLANG_ULONG_TYPE
  365. #endif
  366. #if SHORT_IS_INT
  367. # define _pSLANG_SHORT_TYPE SLANG_INT_TYPE
  368. # define _pSLANG_USHORT_TYPE SLANG_UINT_TYPE
  369. #else
  370. # define _pSLANG_SHORT_TYPE SLANG_SHORT_TYPE
  371. # define _pSLANG_USHORT_TYPE SLANG_USHORT_TYPE
  372. #endif
  373. #if LLONG_IS_LONG
  374. # define _pSLANG_LLONG_TYPE _pSLANG_LONG_TYPE
  375. # define _pSLANG_ULLONG_TYPE _pSLANG_ULONG_TYPE
  376. #else
  377. # define _pSLANG_LLONG_TYPE SLANG_LLONG_TYPE
  378. # define _pSLANG_ULLONG_TYPE SLANG_ULLONG_TYPE
  379. #endif
  380. /* Map off_t to a slang type */
  381. #if defined(HAVE_LONG_LONG) && (SIZEOF_OFF_T == SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG > SIZEOF_LONG)
  382. # define SLANG_C_OFF_T_TYPE _pSLANG_LLONG_TYPE
  383. typedef long long _pSLc_off_t_Type;
  384. # define SLANG_PUSH_OFF_T SLang_push_long_long
  385. #else
  386. # if (SIZEOF_OFF_T == SIZEOF_INT)
  387. # define SLANG_C_OFF_T_TYPE SLANG_INT_TYPE
  388. # define SLANG_PUSH_OFF_T SLang_push_int
  389. typedef int _pSLc_off_t_Type;
  390. # else
  391. # define SLANG_C_OFF_T_TYPE _pSLANG_LONG_TYPE
  392. # define SLANG_PUSH_OFF_T SLang_push_long
  393. typedef long _pSLc_off_t_Type;
  394. # endif
  395. #endif
  396. #if SIZEOF_INT == 2
  397. # define _pSLANG_INT16_TYPE SLANG_INT_TYPE
  398. # define _pSLANG_UINT16_TYPE SLANG_UINT_TYPE
  399. #else
  400. # if SIZEOF_SHORT == 2
  401. # define _pSLANG_INT16_TYPE SLANG_SHORT_TYPE
  402. # define _pSLANG_UINT16_TYPE SLANG_USHORT_TYPE
  403. # else
  404. # if SIZEOF_LONG == 2
  405. # define _pSLANG_INT16_TYPE SLANG_LONG_TYPE
  406. # define _pSLANG_UINT16_TYPE SLANG_ULONG_TYPE
  407. # else
  408. # define _pSLANG_INT16_TYPE 0
  409. # define _pSLANG_UINT16_TYPE 0
  410. # endif
  411. # endif
  412. #endif
  413. #if SIZEOF_INT == 4
  414. # define _pSLANG_INT32_TYPE SLANG_INT_TYPE
  415. # define _pSLANG_UINT32_TYPE SLANG_UINT_TYPE
  416. #else
  417. # if SIZEOF_SHORT == 4
  418. # define _pSLANG_INT32_TYPE SLANG_SHORT_TYPE
  419. # define _pSLANG_UINT32_TYPE SLANG_USHORT_TYPE
  420. # else
  421. # if SIZEOF_LONG == 4
  422. # define _pSLANG_INT32_TYPE SLANG_LONG_TYPE
  423. # define _pSLANG_UINT32_TYPE SLANG_ULONG_TYPE
  424. # else
  425. # define _pSLANG_INT32_TYPE 0
  426. # define _pSLANG_UINT32_TYPE 0
  427. # endif
  428. # endif
  429. #endif
  430. #if SIZEOF_INT == 8
  431. # define _pSLANG_INT64_TYPE SLANG_INT_TYPE
  432. # define _pSLANG_UINT64_TYPE SLANG_UINT_TYPE
  433. #else
  434. # if SIZEOF_SHORT == 8
  435. # define _pSLANG_INT64_TYPE SLANG_SHORT_TYPE
  436. # define _pSLANG_UINT64_TYPE SLANG_USHORT_TYPE
  437. # else
  438. # if SIZEOF_LONG == 8
  439. # define _pSLANG_INT64_TYPE SLANG_LONG_TYPE
  440. # define _pSLANG_UINT64_TYPE SLANG_ULONG_TYPE
  441. # else
  442. # if SIZEOF_LONG_LONG == 8
  443. # define _pSLANG_INT64_TYPE SLANG_LLONG_TYPE
  444. # define _pSLANG_UINT64_TYPE SLANG_ULLONG_TYPE
  445. # else
  446. # define _pSLANG_INT64_TYPE 0
  447. # define _pSLANG_UINT64_TYPE 0
  448. # endif
  449. # endif
  450. # endif
  451. #endif
  452. typedef union
  453. {
  454. #if SLANG_HAS_FLOAT
  455. double double_val;
  456. float float_val;
  457. #endif
  458. #ifdef HAVE_LONG_LONG
  459. long long llong_val;
  460. unsigned long long ullong_val;
  461. #endif
  462. long long_val;
  463. unsigned long ulong_val;
  464. VOID_STAR ptr_val;
  465. char *s_val;
  466. int int_val;
  467. unsigned int uint_val;
  468. SLang_MMT_Type *ref;
  469. SLang_Name_Type *n_val;
  470. struct _pSLang_Struct_Type *struct_val;
  471. struct _pSLang_Array_Type *array_val;
  472. short short_val;
  473. unsigned short ushort_val;
  474. char char_val;
  475. unsigned char uchar_val;
  476. SLindex_Type index_val;
  477. }
  478. _pSL_Object_Union_Type;
  479. typedef struct _pSLang_Object_Type
  480. {
  481. SLtype data_type; /* SLANG_INT_TYPE, ... */
  482. _pSL_Object_Union_Type v;
  483. }
  484. SLang_Object_Type;
  485. struct _pSLang_MMT_Type
  486. {
  487. SLtype data_type; /* int, string, etc... */
  488. VOID_STAR user_data; /* address of user structure */
  489. unsigned int count; /* number of references */
  490. };
  491. extern int _pSLang_pop_object_of_type (SLtype, SLang_Object_Type *, int);
  492. typedef struct
  493. {
  494. char *name; /* slstring */
  495. SLang_Object_Type obj;
  496. }
  497. _pSLstruct_Field_Type;
  498. typedef struct _pSLang_Struct_Type
  499. {
  500. _pSLstruct_Field_Type *fields;
  501. unsigned int nfields; /* number used */
  502. unsigned int num_refs;
  503. /* user-defined methods */
  504. SLang_Name_Type *destroy_method;
  505. }
  506. _pSLang_Struct_Type;
  507. extern void _pSLstruct_delete_struct (_pSLang_Struct_Type *);
  508. extern int _pSLang_push_struct (_pSLang_Struct_Type *);
  509. extern int _pSLang_pop_struct (_pSLang_Struct_Type **);
  510. extern int _pSLstruct_init (void);
  511. /* extern int _pSLstruct_get_field (char *); */
  512. extern int _pSLstruct_define_struct (void);
  513. extern int _pSLstruct_define_typedef (void);
  514. struct _pSLang_Ref_Type
  515. {
  516. int is_global;
  517. union
  518. {
  519. SLang_Name_Type *nt;
  520. SLang_Object_Type *local_obj;
  521. }
  522. v;
  523. };
  524. extern int _pSLang_dereference_ref (SLang_Ref_Type *);
  525. extern int _pSLang_deref_assign (SLang_Ref_Type *);
  526. extern int _pSLang_push_ref (int, VOID_STAR);
  527. extern int _pSL_increment_frame_pointer (void);
  528. extern int _pSL_decrement_frame_pointer (void);
  529. extern int SLang_pop(SLang_Object_Type *);
  530. extern void SLang_free_object (SLang_Object_Type *);
  531. extern int _pSLanytype_typecast (SLtype, VOID_STAR, unsigned int,
  532. SLtype, VOID_STAR);
  533. extern void _pSLstring_intrinsic (void);
  534. #if 0
  535. /* NULL not allowed here */
  536. extern char *_pSLmalloced_to_slstring (char *, unsigned int);
  537. /* But here it is ok */
  538. extern int _pSLpush_malloced_string (char *, unsigned int);
  539. #endif
  540. /* These functions are used to create slstrings of a fixed length. Be
  541. * very careful how they are used. In particular, if len bytes are allocated,
  542. * then the string must be len characters long, no more and no less.
  543. */
  544. extern char *_pSLallocate_slstring (unsigned int);
  545. extern char *_pSLcreate_via_alloced_slstring (char *, unsigned int);
  546. extern void _pSLunallocate_slstring (char *, unsigned int);
  547. extern int _pSLpush_alloced_slstring (char *, unsigned int);
  548. extern unsigned int _pSLstring_bytelen (SLstr_Type *);
  549. extern void _pSLang_free_slstring (SLstr_Type *); /* slstring required and assumed */
  550. extern unsigned long _pSLstring_get_hash (SLstr_Type *s); /* slstring required */
  551. typedef struct
  552. {
  553. char **buf;
  554. unsigned int max_num;
  555. unsigned int num;
  556. unsigned int delta_num;
  557. int is_malloced; /* non-zero if object was malloced */
  558. }
  559. _pSLString_List_Type;
  560. /* Note that _pSLstring_list_append makes no copy of the object-- it steals it.
  561. * For a copy, use _pSLstring_list_append_copy */
  562. extern int _pSLstring_list_append (_pSLString_List_Type *, char *);
  563. extern int _pSLstring_list_append_copy (_pSLString_List_Type *, char *);
  564. extern int _pSLstring_list_init (_pSLString_List_Type *, unsigned int, unsigned int);
  565. extern _pSLString_List_Type *_pSLstring_list_new (unsigned int, unsigned int);
  566. extern void _pSLstring_list_delete (_pSLString_List_Type *);
  567. extern int _pSLstring_list_push (_pSLString_List_Type *, int);
  568. extern SLang_Array_Type *_pSLstrings_to_array (char **strs, unsigned int n);
  569. /* This function assumes that s is an slstring. */
  570. extern char *_pSLstring_dup_slstring (char *);
  571. extern int _pSLang_dup_and_push_slstring (char *);
  572. extern int _pSLang_init_import (void);
  573. extern int _pSLinit_exceptions (void);
  574. /* This function checks to see if the referenced object is initialized */
  575. extern int _pSLang_is_ref_initialized (SLang_Ref_Type *);
  576. extern int _pSLcheck_identifier_syntax (char *);
  577. extern int _pSLang_uninitialize_ref (SLang_Ref_Type *);
  578. extern int _pSLpush_slang_obj (SLang_Object_Type *);
  579. extern char *_pSLexpand_escaped_char(char *, SLwchar_Type *, int *);
  580. extern void _pSLexpand_escaped_string (char *, char *, char *);
  581. /* returns a pointer to an SLstring string-- use SLang_free_slstring */
  582. extern char *_pSLstringize_object (SLang_Object_Type *);
  583. extern int _pSLdump_objects (char *, SLang_Object_Type *, unsigned int, int);
  584. extern SLang_Object_Type *_pSLang_get_run_stack_pointer (void);
  585. extern SLang_Object_Type *_pSLang_get_run_stack_base (void);
  586. extern int _pSLang_dump_stack (void);
  587. extern int _pSLang_peek_at_stack2 (SLtype *);
  588. struct _pSLang_NameSpace_Type
  589. {
  590. struct _pSLang_NameSpace_Type *next;
  591. char *name; /* this is the load_type name */
  592. char *namespace_name; /* this name is assigned by implements */
  593. char *private_name;
  594. unsigned int table_size;
  595. SLang_Name_Type **table;
  596. };
  597. extern SLang_NameSpace_Type *_pSLns_new_namespace (char *, unsigned int);
  598. extern SLang_NameSpace_Type *_pSLns_allocate_namespace (char *, unsigned int);
  599. extern void _pSLns_deallocate_namespace (SLang_NameSpace_Type *);
  600. extern SLang_NameSpace_Type *_pSLns_find_namespace (char *);
  601. extern int _pSLns_set_namespace_name (SLang_NameSpace_Type *, char *);
  602. extern SLang_Array_Type *_pSLnspace_apropos (SLang_NameSpace_Type *, char *, unsigned int);
  603. extern void _pSLang_use_namespace_intrinsic (char *name);
  604. extern char *_pSLang_cur_namespace_intrinsic (void);
  605. extern SLang_Array_Type *_pSLang_apropos (char *, char *, unsigned int);
  606. extern void _pSLang_implements_intrinsic (char *);
  607. extern SLang_Array_Type *_pSLns_list_namespaces (void);
  608. extern SLang_Name_Type *_pSLns_locate_hashed_name (SLang_NameSpace_Type *, char *, unsigned long);
  609. extern int _pSLns_add_hashed_name (SLang_NameSpace_Type *, SLang_Name_Type *, unsigned long);
  610. extern SLang_NameSpace_Type *_pSLns_find_object_namespace (SLang_Name_Type *nt);
  611. extern SLang_Name_Type *_pSLns_locate_name (SLang_NameSpace_Type *, char *);
  612. extern SLang_NameSpace_Type *_pSLns_get_private_namespace (char *name, char *nsname);
  613. extern SLang_NameSpace_Type *_pSLns_create_namespace2 (char *name, char *nsname);
  614. extern int _pSLang_Trace;
  615. extern char *_pSLang_current_function_name (void);
  616. extern int _pSLang_trace_fun(char *);
  617. /* This is a bitmapped variable */
  618. extern int _pSLang_Compile_Line_Num_Info;
  619. #if SLANG_HAS_BOSEOS
  620. extern int _pSLang_Compile_BOSEOS;
  621. extern int _pSLang_init_boseos (void);
  622. extern int _pSLcall_bos_handler (char *, int);
  623. extern int _pSLcall_eos_handler (void);
  624. extern int _pSLcall_debug_hook (char *file, int linenum);
  625. /* extern int _pSLcall_debug_hook (char *file, int linenum, char *funct); */
  626. #endif
  627. extern char *_pSLstring_dup_hashed_string (char *, unsigned long);
  628. extern unsigned long _pSLcompute_string_hash (char *);
  629. extern char *_pSLstring_make_hashed_string (char *, unsigned int, unsigned long *);
  630. extern void _pSLfree_hashed_string (char *, unsigned int, unsigned long);
  631. unsigned long _pSLstring_hash (unsigned char *, unsigned char *);
  632. extern int _pSLinit_slcomplex (void);
  633. extern int _pSLang_init_slstrops (void);
  634. extern int _pSLstrops_do_sprintf_n (int);
  635. extern int _pSLang_sscanf (void);
  636. extern double _pSLang_atof (char *);
  637. extern int _pSLang_init_bstring (void);
  638. extern int _pSLang_init_sltime (void);
  639. extern void _pSLpack (void);
  640. extern void _pSLunpack (char *, SLang_BString_Type *);
  641. extern void _pSLpack_pad_format (char *);
  642. extern unsigned int _pSLpack_compute_size (char *);
  643. extern int _pSLusleep (unsigned long);
  644. /* frees upon error. NULL __NOT__ ok. */
  645. extern int _pSLang_push_slstring (char *);
  646. extern SLtype _pSLarith_promote_type (SLtype);
  647. extern int _pSLarith_get_precedence (SLtype);
  648. extern int _pSLarith_typecast (SLtype, VOID_STAR, unsigned int,
  649. SLtype, VOID_STAR);
  650. extern int SLang_push(SLang_Object_Type *);
  651. extern int SLadd_global_variable (char *);
  652. extern int _pSLdo_pop (void);
  653. extern unsigned int _pSLsys_getkey (void);
  654. extern int _pSLsys_input_pending (int);
  655. #ifdef IBMPC_SYSTEM
  656. extern unsigned int _pSLpc_convert_scancode (unsigned int, unsigned int, int);
  657. #define _pSLTT_KEY_SHIFT 1
  658. #define _pSLTT_KEY_CTRL 2
  659. #define _pSLTT_KEY_ALT 4
  660. #endif
  661. typedef struct _pSLterminfo_Type SLterminfo_Type;
  662. extern SLterminfo_Type *_pSLtt_tigetent (char *);
  663. extern char *_pSLtt_tigetstr (SLterminfo_Type *, char *);
  664. extern int _pSLtt_tigetnum (SLterminfo_Type *, char *);
  665. extern int _pSLtt_tigetflag (SLterminfo_Type *, char *);
  666. #if SLTT_HAS_NON_BCE_SUPPORT
  667. extern int _pSLtt_get_bce_color_offset (void);
  668. #endif
  669. extern void (*_pSLtt_color_changed_hook)(void);
  670. extern unsigned char SLang_Input_Buffer [SL_MAX_INPUT_BUFFER_LEN];
  671. typedef struct SL_OOBinary_Type
  672. {
  673. SLtype data_type; /* partner type for binary op */
  674. int (*binary_function)_PROTO((int,
  675. SLtype, VOID_STAR, unsigned int,
  676. SLtype, VOID_STAR, unsigned int,
  677. VOID_STAR));
  678. int (*binary_result) _PROTO((int, SLtype, SLtype, SLtype *));
  679. struct SL_OOBinary_Type *next;
  680. }
  681. SL_OOBinary_Type;
  682. typedef struct _pSL_Typecast_Type
  683. {
  684. SLtype data_type; /* to_type */
  685. int allow_implicit;
  686. int (*typecast)_PROTO((SLtype, VOID_STAR, unsigned int,
  687. SLtype, VOID_STAR));
  688. struct _pSL_Typecast_Type *next;
  689. }
  690. SL_Typecast_Type;
  691. struct _pSLang_Class_Type
  692. {
  693. SLclass_Type cl_class_type; /* vector, scalar, mmt, pointer */
  694. unsigned int cl_data_type; /* SLANG_INTEGER_TYPE, etc... */
  695. char *cl_name; /* slstring type */
  696. size_t cl_sizeof_type;
  697. VOID_STAR cl_transfer_buf; /* cl_sizeof_type bytes*/
  698. /* Methods */
  699. /* Most of the method functions are prototyped:
  700. * int method (SLtype type, VOID_STAR addr);
  701. * Here, @type@ represents the type of object that the method is asked
  702. * to deal with. The second parameter @addr@ will contain the ADDRESS of
  703. * the object. For example, if type is SLANG_INT_TYPE, then @addr@ will
  704. * actually be int *. Similary, if type is SLANG_STRING_TYPE,
  705. * then @addr@ will contain the address of the string, i.e., char **.
  706. */
  707. void (*cl_destroy)_PROTO((SLtype, VOID_STAR));
  708. /* Prototype: void destroy(unsigned type, VOID_STAR val)
  709. * Called to delete/free the object */
  710. char *(*cl_string)_PROTO((SLtype, VOID_STAR));
  711. /* Prototype: char *to_string (SLtype t, VOID_STAR p);
  712. * Here p is a pointer to the object for which a string representation
  713. * is to be returned. The returned pointer is to be a MALLOCED string.
  714. */
  715. /* Prototype: void push(SLtype type, VOID_STAR v);
  716. * Push a copy of the object of type @type@ at address @v@ onto the
  717. * stack.
  718. */
  719. int (*cl_push)_PROTO((SLtype, VOID_STAR));
  720. /* Prototype: int pop(SLtype type, VOID_STAR v);
  721. * Pops value from stack and assign it to object, whose address is @v@.
  722. */
  723. int (*cl_pop)_PROTO((SLtype, VOID_STAR));
  724. /* mul2, sign, etc... */
  725. int (*cl_unary_op_result_type)_PROTO((int, SLtype, SLtype *));
  726. int (*cl_unary_op)_PROTO((int, SLtype, VOID_STAR, unsigned int, VOID_STAR));
  727. #if 0
  728. int (*cl_arith_unary_op_result_type)_PROTO((int, SLtype, SLtype *));
  729. int (*cl_arith_unary_op)_PROTO((int, SLtype, VOID_STAR, unsigned int, VOID_STAR));
  730. #endif
  731. int (*cl_app_unary_op_result_type)_PROTO((int, SLtype, SLtype *));
  732. int (*cl_app_unary_op)_PROTO((int, SLtype, VOID_STAR, unsigned int, VOID_STAR));
  733. /* If this function is non-NULL, it will be called for sin, cos, etc... */
  734. int (*cl_math_op)_PROTO((int, SLtype, VOID_STAR, unsigned int, VOID_STAR));
  735. int (*cl_math_op_result_type)_PROTO((int, SLtype, SLtype *));
  736. SL_OOBinary_Type *cl_binary_ops;
  737. SL_Typecast_Type *cl_typecast_funs;
  738. void (*cl_byte_code_destroy)_PROTO((SLtype, VOID_STAR));
  739. void (*cl_user_destroy_fun)_PROTO((SLtype, VOID_STAR));
  740. int (*cl_init_array_object)_PROTO((SLtype, VOID_STAR));
  741. int (*cl_datatype_deref)_PROTO((SLtype));
  742. SLang_Struct_Type *cl_struct_def;
  743. int (*cl_dereference) _PROTO((SLtype, VOID_STAR));
  744. int (*cl_acopy) (SLtype, VOID_STAR, VOID_STAR);
  745. int (*cl_apop) _PROTO((SLtype, VOID_STAR));
  746. int (*cl_apush) _PROTO((SLtype, VOID_STAR));
  747. int (*cl_push_literal) _PROTO((SLtype, VOID_STAR));
  748. void (*cl_adestroy)_PROTO((SLtype, VOID_STAR));
  749. int (*cl_push_intrinsic)_PROTO((SLtype, VOID_STAR));
  750. int (*cl_void_typecast)_PROTO((SLtype, VOID_STAR, unsigned int, SLtype, VOID_STAR));
  751. int (*cl_anytype_typecast)_PROTO((SLtype, VOID_STAR, unsigned int, SLtype, VOID_STAR));
  752. /* Array access functions */
  753. int (*cl_aput) (SLtype, unsigned int);
  754. int (*cl_aget) (SLtype, unsigned int);
  755. int (*cl_anew) (SLtype, unsigned int);
  756. /* length method */
  757. int (*cl_length) (SLtype, VOID_STAR, unsigned int *);
  758. /* foreach */
  759. SLang_Foreach_Context_Type *(*cl_foreach_open) (SLtype, unsigned int);
  760. void (*cl_foreach_close) (SLtype, SLang_Foreach_Context_Type *);
  761. int (*cl_foreach) (SLtype, SLang_Foreach_Context_Type *);
  762. /* Structure access: get and put (assign to) fields */
  763. int (*cl_sput) (SLtype, char *);
  764. int (*cl_sget) (SLtype, char *);
  765. /* File I/O */
  766. int (*cl_fread) (SLtype, FILE *, VOID_STAR, unsigned int, unsigned int *);
  767. int (*cl_fwrite) (SLtype, FILE *, VOID_STAR, unsigned int, unsigned int *);
  768. int (*cl_fdread) (SLtype, int, VOID_STAR, unsigned int, unsigned int *);
  769. int (*cl_fdwrite) (SLtype, int, VOID_STAR, unsigned int, unsigned int *);
  770. int (*cl_to_bool) (SLtype, int *);
  771. int (*cl_cmp)(SLtype, VOID_STAR, VOID_STAR, int *);
  772. int (*cl_eqs)(SLtype, VOID_STAR, SLtype, VOID_STAR);
  773. SL_OOBinary_Type *cl_void_binary_this;
  774. SL_OOBinary_Type *cl_this_binary_void;
  775. int is_container;
  776. };
  777. extern int _pSLregister_types (void);
  778. extern SLang_Class_Type *_pSLclass_get_class (SLtype);
  779. extern VOID_STAR _pSLclass_get_ptr_to_value (SLang_Class_Type *, SLang_Object_Type *);
  780. extern void _pSLclass_type_mismatch_error (SLtype, SLtype);
  781. extern int _pSLclass_init (void);
  782. extern int _pSLclass_copy_class (SLtype, SLtype);
  783. extern int (*_pSLclass_get_typecast (SLtype, SLtype, int))
  784. (SLtype, VOID_STAR, unsigned int,
  785. SLtype, VOID_STAR);
  786. extern int (*_pSLclass_get_binary_fun (int, SLang_Class_Type *, SLang_Class_Type *, SLang_Class_Type **, int))
  787. (int,
  788. SLtype, VOID_STAR, unsigned int,
  789. SLtype, VOID_STAR, unsigned int,
  790. VOID_STAR);
  791. extern int (*_pSLclass_get_unary_fun (int, SLang_Class_Type *, SLang_Class_Type **, int))
  792. (int, SLtype, VOID_STAR, unsigned int, VOID_STAR);
  793. #if 0
  794. extern int _pSLclass_add_arith_unary_op (SLtype type,
  795. int (*f)(int,
  796. SLtype, VOID_STAR, unsigned int,
  797. VOID_STAR),
  798. int (*r)(int, SLtype, SLtype *));
  799. #endif
  800. extern int _pSLclass_get_unary_opcode (char *name);
  801. extern int _pSLclass_get_binary_opcode (char *name);
  802. extern int _pSLclass_is_same_obj (SLang_Object_Type *a, SLang_Object_Type *b);
  803. extern int _pSLclass_obj_eqs (SLang_Object_Type *a, SLang_Object_Type *b);
  804. extern int _pSLarith_register_types (void);
  805. extern SLtype _pSLarith_Arith_Types [];
  806. extern int _pSLang_ref_is_callable (SLang_Ref_Type *);
  807. extern int _pSLang_is_arith_type (SLtype);
  808. extern void _pSLang_set_arith_type (SLtype, unsigned char);
  809. #if SLANG_OPTIMIZE_FOR_SPEED
  810. extern SLclass_Type _pSLang_get_class_type (SLtype);
  811. extern void _pSLang_set_class_info (SLtype, SLang_Class_Type *);
  812. #endif
  813. extern int _pSLarith_bin_op (SLang_Object_Type *, SLang_Object_Type *, int);
  814. extern int _pSLarray_add_bin_op (SLtype);
  815. typedef struct
  816. {
  817. char *name;
  818. SLang_Name_Type *next;
  819. char name_type;
  820. int unary_op;
  821. }
  822. SLang_Arith_Unary_Type;
  823. extern int _pSLadd_arith_unary_table (SLang_Arith_Unary_Type *tbl, char *);
  824. typedef struct
  825. {
  826. char *name;
  827. SLang_Name_Type *next;
  828. char name_type;
  829. int binary_op;
  830. }
  831. SLang_Arith_Binary_Type;
  832. extern int _pSLadd_arith_binary_table (SLang_Arith_Binary_Type *tbl, char *);
  833. extern int _pSLang_call_funptr (SLang_Name_Type *);
  834. extern void _pSLset_double_format (char *);
  835. extern SLang_Name_Type *_pSLlocate_global_name (char *);
  836. extern SLang_Name_Type *_pSLlocate_name (char *);
  837. extern char *_pSLdefines[];
  838. #define SL_ERRNO_NOT_IMPLEMENTED 0x7FFF
  839. extern int _pSLerrno_errno;
  840. extern int _pSLerrno_init (void);
  841. extern int _pSLstdio_fdopen (char *, int, char *);
  842. extern void _pSLstruct_pop_args (int *);
  843. extern void _pSLstruct_push_args (SLang_Array_Type *);
  844. extern int _pSLang_init_sllist (void);
  845. extern int _pSLlist_inline_list (void);
  846. extern int _pSLarray_aput1 (unsigned int);
  847. extern int _pSLarray_aput (void);
  848. extern int _pSLarray_aget (void);
  849. extern int _pSLarray_aget1 (unsigned int);
  850. extern int _pSLarray_inline_implicit_array (void);
  851. extern int _pSLarray_inline_array (void);
  852. extern int _pSLarray_wildcard_array (void);
  853. extern int
  854. _pSLarray_typecast (SLtype, VOID_STAR, unsigned int,
  855. SLtype, VOID_STAR, int);
  856. extern int _pSLarray_aput_transfer_elem (SLang_Array_Type *, SLindex_Type *,
  857. VOID_STAR, size_t, int);
  858. extern int _pSLarray_aget_transfer_elem (SLang_Array_Type *, SLindex_Type *,
  859. VOID_STAR, size_t, int);
  860. extern void _pSLarray_free_array_elements (SLang_Class_Type *, VOID_STAR, SLuindex_Type);
  861. extern SLang_Foreach_Context_Type *
  862. _pSLarray_cl_foreach_open (SLtype, unsigned int);
  863. extern void _pSLarray_cl_foreach_close (SLtype, SLang_Foreach_Context_Type *);
  864. extern int _pSLarray_cl_foreach (SLtype, SLang_Foreach_Context_Type *);
  865. extern int _pSLarray_matrix_multiply (void);
  866. extern void (*_pSLang_Matrix_Multiply)(void);
  867. extern int _pSLarray_next_index (SLindex_Type *, SLindex_Type *, unsigned int);
  868. extern int _pSLarray_init_slarray (void);
  869. extern SLang_Array_Type *
  870. SLang_create_array1 (SLtype, int, VOID_STAR, SLindex_Type *, unsigned int, int);
  871. extern int _pSLassoc_aput (SLtype, unsigned int);
  872. extern int _pSLassoc_aget (SLtype, unsigned int);
  873. extern int _pSLcompile_push_context (SLang_Load_Type *);
  874. extern int _pSLcompile_pop_context (void);
  875. extern int _pSLang_Auto_Declare_Globals;
  876. typedef struct _pSLang_Token_Type
  877. {
  878. union
  879. {
  880. long long_val;
  881. unsigned long ulong_val;
  882. #if HAVE_LONG_LONG
  883. long long llong_val;
  884. unsigned long long ullong_val;
  885. #endif
  886. /* Note that it is not wise to put a double field in the union because
  887. * when reading a preparsed file, I want to keep the user-specified
  888. * form to preserve the precision. Using a union member would mean
  889. * converting the double to a string when creating a preparsed file.
  890. * We can avoid the issues associated with this by just storing
  891. * floating point values as strings.
  892. */
  893. char *s_val; /* Used for IDENT_TOKEN, DOUBLE_TOKEN, etc... */
  894. SLang_BString_Type *b_val;
  895. } v;
  896. int free_sval_flag;
  897. unsigned int num_refs;
  898. unsigned long hash;
  899. #if SLANG_HAS_DEBUG_CODE
  900. int line_number;
  901. #endif
  902. struct _pSLang_Token_Type *next; /* used for token lists */
  903. SLtype type;
  904. }
  905. _pSLang_Token_Type;
  906. extern void _pSLcompile (_pSLang_Token_Type *);
  907. extern void (*_pSLcompile_ptr)(_pSLang_Token_Type *);
  908. /* slmisc.c */
  909. extern char *_pSLskip_whitespace (char *s);
  910. /* slospath.c */
  911. extern char *_pSLpath_find_file (char *); /* slstring returned */
  912. /* Read but do not set this variable. */
  913. extern volatile int _pSLang_Error;
  914. extern int _pSLutf8_mode;
  915. extern int _pSLinterp_UTF8_Mode; /* non-zero for interpreter */
  916. extern int _pSLtt_UTF8_Mode;
  917. extern SLuchar_Type *_pSLinterp_decode_wchar (SLuchar_Type *u,
  918. SLuchar_Type *umax,
  919. SLwchar_Type *chp);
  920. extern SLuchar_Type *_pSLinterp_encode_wchar (SLwchar_Type wch,
  921. SLuchar_Type *buf,
  922. unsigned int *encoded_lenp);
  923. /* *** TOKENS *** */
  924. /* Note that that tokens corresponding to ^J, ^M, and ^Z should not be used.
  925. * This is because a file that contains any of these characters will
  926. * have an OS dependent interpretation, e.g., ^Z is EOF on MSDOS.
  927. */
  928. /* Special tokens */
  929. #define ILLEGAL_TOKEN 0x00 /* no token has this value */
  930. #define EOF_TOKEN 0x01
  931. #define RPN_TOKEN 0x02
  932. #define NL_TOKEN 0x03
  933. #define NOP_TOKEN 0x05
  934. #define FARG_TOKEN 0x06
  935. #define TMP_TOKEN 0x07
  936. #define RESERVED1_TOKEN 0x0A /* \n */
  937. #define RESERVED2_TOKEN 0x0D /* \r */
  938. /* Literal tokens */
  939. #define CHAR_TOKEN 0x10
  940. #define UCHAR_TOKEN 0x11
  941. #define SHORT_TOKEN 0x12
  942. #define USHORT_TOKEN 0x13
  943. #define INT_TOKEN 0x14
  944. #define UINT_TOKEN 0x15
  945. #define LONG_TOKEN 0x16
  946. #define ULONG_TOKEN 0x17
  947. #define IS_INTEGER_TOKEN(x) ((x >= CHAR_TOKEN) && (x <= ULONG_TOKEN))
  948. #define FLOAT_TOKEN 0x18
  949. #define DOUBLE_TOKEN 0x19
  950. #define RESERVED3_TOKEN 0x1A /* ^Z */
  951. #define COMPLEX_TOKEN 0x1B
  952. #define STRING_TOKEN 0x1C
  953. #define BSTRING_TOKEN 0x1D
  954. #define _BSTRING_TOKEN 0x1E /* byte-compiled BSTRING */
  955. #define STRING_DOLLAR_TOKEN 0x1F
  956. /* Tokens that can be LVALUES */
  957. #define IDENT_TOKEN 0x20
  958. #define ARRAY_TOKEN 0x21
  959. #define DOT_TOKEN 0x22
  960. #define IS_LVALUE_TOKEN (((t) <= DOT_TOKEN) && ((t) >= IDENT_TOKEN))
  961. #define DOT_METHOD_CALL_TOKEN 0x23
  962. #define ESC_STRING_TOKEN 0x24
  963. #define ESC_BSTRING_TOKEN 0x25
  964. /* Flags for struct fields */
  965. #define STATIC_TOKEN 0x26
  966. #define READONLY_TOKEN 0x27
  967. #define PRIVATE_TOKEN 0x28
  968. #define PUBLIC_TOKEN 0x29
  969. /* Punctuation tokens */
  970. #define OBRACKET_TOKEN 0x2a
  971. #define CBRACKET_TOKEN 0x2b
  972. #define OPAREN_TOKEN 0x2c
  973. #define CPAREN_TOKEN 0x2d
  974. #define OBRACE_TOKEN 0x2e
  975. #define CBRACE_TOKEN 0x2f
  976. #define COMMA_TOKEN 0x31
  977. #define SEMICOLON_TOKEN 0x32
  978. #define COLON_TOKEN 0x33
  979. #define NAMESPACE_TOKEN 0x34
  980. /* Operators */
  981. #define POW_TOKEN 0x38
  982. /* The order here must match the order in the Binop_Level table in slparse.c */
  983. #define FIRST_BINARY_OP 0x39
  984. #define ADD_TOKEN 0x39
  985. #define SUB_TOKEN 0x3a
  986. #define TIMES_TOKEN 0x3b
  987. #define DIV_TOKEN 0x3c
  988. #define LT_TOKEN 0x3d
  989. #define LE_TOKEN 0x3e
  990. #define GT_TOKEN 0x3f
  991. #define GE_TOKEN 0x40
  992. #define EQ_TOKEN 0x41
  993. #define NE_TOKEN 0x42
  994. #define AND_TOKEN 0x43
  995. #define OR_TOKEN 0x44
  996. #define MOD_TOKEN 0x45
  997. #define BAND_TOKEN 0x46
  998. #define SHL_TOKEN 0x47
  999. #define SHR_TOKEN 0x48
  1000. #define BXOR_TOKEN 0x49
  1001. #define BOR_TOKEN 0x4a
  1002. #define POUND_TOKEN 0x4b /* matrix multiplication */
  1003. #define LAST_BINARY_OP 0x4b
  1004. #define IS_BINARY_OP(t) ((t >= FIRST_BINARY_OP) && (t <= LAST_BINARY_OP))
  1005. /* unary tokens -- but not all of them (see grammar) */
  1006. #define DEREF_TOKEN 0x4d
  1007. #define NOT_TOKEN 0x4e
  1008. #define BNOT_TOKEN 0x4f
  1009. #define IS_INTERNAL_FUNC(t) ((t >= 0x50) && (t <= 0x52))
  1010. #define POP_TOKEN 0x50
  1011. #define CHS_TOKEN 0x51
  1012. #define EXCH_TOKEN 0x52
  1013. #define LLONG_TOKEN 0x53
  1014. #define ULLONG_TOKEN 0x54
  1015. #define LDOUBLE_TOKEN 0x55
  1016. /* Assignment tokens. Note: these must appear with sequential values.
  1017. * The order here must match the specific lvalue assignments below.
  1018. * These tokens are used by rpn routines in slang.c. slparse.c maps them
  1019. * onto the specific lvalue tokens while parsing infix.
  1020. * Also the assignment SLANG_BCST_ assumes this order
  1021. */
  1022. #define ASSIGN_TOKEN 0x57
  1023. #define PLUSEQS_TOKEN 0x58
  1024. #define MINUSEQS_TOKEN 0x59
  1025. #define TIMESEQS_TOKEN 0x5A
  1026. #define DIVEQS_TOKEN 0x5B
  1027. #define BOREQS_TOKEN 0x5C
  1028. #define BANDEQS_TOKEN 0x5D
  1029. #define PLUSPLUS_TOKEN 0x5E
  1030. #define POST_PLUSPLUS_TOKEN 0x5F
  1031. #define MINUSMINUS_TOKEN 0x60
  1032. #define POST_MINUSMINUS_TOKEN 0x61
  1033. /* Directives */
  1034. #define FIRST_DIRECTIVE_TOKEN 0x62
  1035. #define IFNOT_TOKEN 0x62
  1036. #define IF_TOKEN 0x63
  1037. #define ELSE_TOKEN 0x64
  1038. #define FOREVER_TOKEN 0x65
  1039. #define WHILE_TOKEN 0x66
  1040. #define FOR_TOKEN 0x67
  1041. #define _FOR_TOKEN 0x68
  1042. #define LOOP_TOKEN 0x69
  1043. #define SWITCH_TOKEN 0x6A
  1044. #define DOWHILE_TOKEN 0x6B
  1045. #define ANDELSE_TOKEN 0x6C
  1046. #define ORELSE_TOKEN 0x6D
  1047. #define ERRBLK_TOKEN 0x6E
  1048. #define EXITBLK_TOKEN 0x6F
  1049. /* These must be sequential */
  1050. #define USRBLK0_TOKEN 0x70
  1051. #define USRBLK1_TOKEN 0x71
  1052. #define USRBLK2_TOKEN 0x72
  1053. #define USRBLK3_TOKEN 0x73
  1054. #define USRBLK4_TOKEN 0x74
  1055. #define CONT_TOKEN 0x75
  1056. #define BREAK_TOKEN 0x76
  1057. #define RETURN_TOKEN 0x77
  1058. #define CASE_TOKEN 0x78
  1059. #define DEFINE_TOKEN 0x79
  1060. #define DO_TOKEN 0x7a
  1061. #define VARIABLE_TOKEN 0x7b
  1062. #define GVARIABLE_TOKEN 0x7c
  1063. #define _REF_TOKEN 0x7d
  1064. #define PUSH_TOKEN 0x7e
  1065. #define STRUCT_TOKEN 0x7f
  1066. #define TYPEDEF_TOKEN 0x80
  1067. #define NOTELSE_TOKEN 0x81
  1068. #define DEFINE_STATIC_TOKEN 0x82
  1069. #define FOREACH_TOKEN 0x83
  1070. #define USING_TOKEN 0x84
  1071. #define DEFINE_PRIVATE_TOKEN 0x85
  1072. #define DEFINE_PUBLIC_TOKEN 0x86
  1073. #define TRY_TOKEN 0x87
  1074. #define CATCH_TOKEN 0x88
  1075. #define THROW_TOKEN 0x89
  1076. #define FINALLY_TOKEN 0x8a
  1077. /* Note: the order here must match the order of the generic assignment tokens.
  1078. * Also, the first token of each group must be the ?_ASSIGN_TOKEN.
  1079. * slparse.c exploits this order, as well as slang.h.
  1080. */
  1081. #define FIRST_ASSIGN_TOKEN 0x90
  1082. #define _STRUCT_ASSIGN_TOKEN 0x90
  1083. #define _STRUCT_PLUSEQS_TOKEN 0x91
  1084. #define _STRUCT_MINUSEQS_TOKEN 0x92
  1085. #define _STRUCT_TIMESEQS_TOKEN 0x93
  1086. #define _STRUCT_DIVEQS_TOKEN 0x94
  1087. #define _STRUCT_BOREQS_TOKEN 0x95
  1088. #define _STRUCT_BANDEQS_TOKEN 0x96
  1089. #define _STRUCT_PLUSPLUS_TOKEN 0x97
  1090. #define _STRUCT_POST_PLUSPLUS_TOKEN 0x98
  1091. #define _STRUCT_MINUSMINUS_TOKEN 0x99
  1092. #define _STRUCT_POST_MINUSMINUS_TOKEN 0x9A
  1093. #define _ARRAY_ASSIGN_TOKEN 0xA0
  1094. #define _ARRAY_PLUSEQS_TOKEN 0xA1
  1095. #define _ARRAY_MINUSEQS_TOKEN 0xA2
  1096. #define _ARRAY_TIMESEQS_TOKEN 0xA3
  1097. #define _ARRAY_DIVEQS_TOKEN 0xA4
  1098. #define _ARRAY_BOREQS_TOKEN 0xA5
  1099. #define _ARRAY_BANDEQS_TOKEN 0xA6
  1100. #define _ARRAY_PLUSPLUS_TOKEN 0xA7
  1101. #define _ARRAY_POST_PLUSPLUS_TOKEN 0xA8
  1102. #define _ARRAY_MINUSMINUS_TOKEN 0xA9
  1103. #define _ARRAY_POST_MINUSMINUS_TOKEN 0xAA
  1104. #define _SCALAR_ASSIGN_TOKEN 0xB0
  1105. #define _SCALAR_PLUSEQS_TOKEN 0xB1
  1106. #define _SCALAR_MINUSEQS_TOKEN 0xB2
  1107. #define _SCALAR_TIMESEQS_TOKEN 0xB3
  1108. #define _SCALAR_DIVEQS_TOKEN 0xB4
  1109. #define _SCALAR_BOREQS_TOKEN 0xB5
  1110. #define _SCALAR_BANDEQS_TOKEN 0xB6
  1111. #define _SCALAR_PLUSPLUS_TOKEN 0xB7
  1112. #define _SCALAR_POST_PLUSPLUS_TOKEN 0xB8
  1113. #define _SCALAR_MINUSMINUS_TOKEN 0xB9
  1114. #define _SCALAR_POST_MINUSMINUS_TOKEN 0xBA
  1115. #define _DEREF_ASSIGN_TOKEN 0xC0
  1116. #define _DEREF_PLUSEQS_TOKEN 0xC1
  1117. #define _DEREF_MINUSEQS_TOKEN 0xC2
  1118. #define _DEREF_TIMESEQS_TOKEN 0xC3
  1119. #define _DEREF_DIVEQS_TOKEN 0xC4
  1120. #define _DEREF_BOREQS_TOKEN 0xC5
  1121. #define _DEREF_BANDEQS_TOKEN 0xC6
  1122. #define _DEREF_PLUSPLUS_TOKEN 0xC7
  1123. #define _DEREF_POST_PLUSPLUS_TOKEN 0xC8
  1124. #define _DEREF_MINUSMINUS_TOKEN 0xC9
  1125. #define _DEREF_POST_MINUSMINUS_TOKEN 0xCA
  1126. #define LAST_ASSIGN_TOKEN 0xCA
  1127. #define IS_ASSIGN_TOKEN(t) (((t)>=FIRST_ASSIGN_TOKEN)&&((t)<=LAST_ASSIGN_TOKEN))
  1128. #define _INLINE_ARRAY_TOKEN 0xE0
  1129. #define _INLINE_IMPLICIT_ARRAY_TOKEN 0xE1
  1130. #define _NULL_TOKEN 0xE2
  1131. #define _INLINE_WILDCARD_ARRAY_TOKEN 0xE3
  1132. #define _INLINE_LIST_TOKEN 0xE4
  1133. #define BOS_TOKEN 0xFA
  1134. #define EOS_TOKEN 0xFB
  1135. #define LINE_NUM_TOKEN 0xFC
  1136. #define ARG_TOKEN 0xFD
  1137. #define EARG_TOKEN 0xFE
  1138. #define NO_OP_LITERAL 0xFF
  1139. typedef struct
  1140. {
  1141. /* sltoken.c */
  1142. /* SLang_eval_object */
  1143. SLang_Load_Type *llt;
  1144. SLprep_Type *this_slpp;
  1145. /* prep_get_char() */
  1146. char *input_line;
  1147. char cchar;
  1148. /* get_token() */
  1149. int want_nl_token;
  1150. /* slparse.c */
  1151. _pSLang_Token_Type ctok;
  1152. int block_depth;
  1153. int assignment_expression;
  1154. /* slang.c : SLcompile() */
  1155. _pSLang_Token_Type save_token;
  1156. _pSLang_Token_Type next_token;
  1157. void (*slcompile_ptr)(_pSLang_Token_Type *);
  1158. }
  1159. _pSLEval_Context;
  1160. extern int _pSLget_token (_pSLang_Token_Type *);
  1161. extern void _pSLparse_error (int, char *, _pSLang_Token_Type *, int);
  1162. extern void _pSLparse_start (SLang_Load_Type *);
  1163. extern int _pSLget_rpn_token (_pSLang_Token_Type *);
  1164. extern void _pSLcompile_byte_compiled (void);
  1165. extern int (*_pSLprep_eval_hook) (char *);
  1166. extern int _pSLsecure_issetugid (void);
  1167. extern char *_pSLsecure_getenv (char *);
  1168. /* Error Handling */
  1169. extern int _pSLang_init_exceptions (void);
  1170. extern int _pSLerr_init (void);
  1171. extern void _pSLerr_deinit (void);
  1172. extern int _pSLerr_suspend_messages (void);
  1173. extern int _pSLerr_resume_messages (void);
  1174. extern int _pSLerr_traceback_msg (char *, ...) SLATTRIBUTE_PRINTF(1,2);
  1175. extern void _pSLerr_dump_msg (char *, ...) SLATTRIBUTE_PRINTF(1,2);
  1176. extern void _pSLerr_clear_error (void);
  1177. extern void _pSLerr_print_message_queue (void);
  1178. extern int _pSLerr_set_line_info (char *, int, char *);
  1179. extern int _pSLang_pop_error_context (void);
  1180. extern int _pSLang_push_error_context (void);
  1181. extern void (*_pSLinterpreter_Error_Hook)(int);
  1182. extern int _pSLerr_init_interp_exceptions (void);
  1183. extern int _pSLerr_get_last_error (void);
  1184. extern int _pSLerr_pop_exception (int *);
  1185. extern void _pSLerr_free_queued_messages (void);
  1186. extern char *_pSLerr_get_error_from_queue (void);
  1187. extern int _pSLerr_throw (void);
  1188. extern int (*_pSLerr_New_Exception_Hook)(char *name, char *desc, int error_code);
  1189. #if SLANG_HAS_DEBUGGER_SUPPORT
  1190. typedef struct
  1191. {
  1192. char **locals;
  1193. unsigned int nlocals;
  1194. char *file;
  1195. unsigned int line;
  1196. char *function;
  1197. char *ns;
  1198. }
  1199. _pSLang_Frame_Info_Type;
  1200. extern int _pSLang_get_frame_fun_info (int depth, _pSLang_Frame_Info_Type *info);
  1201. extern int _pSLang_set_frame_variable (int depth, char *name);
  1202. extern int _pSLang_get_frame_variable (int depth, char *name);
  1203. extern void _pSLang_use_frame_namespace (int depth);
  1204. extern int _pSLang_get_frame_depth (void);
  1205. #endif
  1206. #if SLANG_HAS_FLOAT
  1207. extern int _pSLmath_isnan (double x);
  1208. #endif
  1209. #if SLANG_HAS_SIGNALS
  1210. extern void _pSLang_signal_interrupt (void);
  1211. extern int _pSLsig_block_and_call (int (*)(VOID_STAR), VOID_STAR);
  1212. extern int _pSLsig_handle_signals (void);
  1213. extern int _pSLang_check_signals_hook (VOID_STAR);
  1214. #else
  1215. #define _pSLsig_block_and_call(f,v) f(v)
  1216. #endif
  1217. #undef _INLINE_
  1218. #if defined(__GNUC__) && SLANG_USE_INLINE_CODE
  1219. # define _INLINE_ __inline__
  1220. #else
  1221. # define _INLINE_
  1222. #endif
  1223. /* This is a macro that permits:
  1224. *
  1225. * extern fun (void **addr);
  1226. * double x;
  1227. * fun ((void **) &x); <--- warning
  1228. * fun (VOID_STAR_STAR(&x));
  1229. *
  1230. * Otherwise a type-punning warning could result due to strict-aliasing.
  1231. */
  1232. #define VOID_STAR_STAR(addr) (VOID_STAR *)(VOID_STAR)(addr)
  1233. #endif /* PRIVATE_SLANG_H_ */