blitz.bmx 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212
  1. SuperStrict
  2. NoDebug
  3. Rem
  4. bbdoc: BASIC/BlitzMax runtime
  5. End Rem
  6. Module BRL.Blitz
  7. ModuleInfo "Version: 1.23"
  8. ModuleInfo "Author: Mark Sibly"
  9. ModuleInfo "License: zlib/libpng"
  10. ModuleInfo "Copyright: Blitz Research Ltd"
  11. ModuleInfo "Modserver: BRL"
  12. '
  13. ModuleInfo "History: 1.23"
  14. ModuleInfo "History: Update to bdwgc 8.2.0.ea9845c"
  15. ModuleInfo "History: 1.22"
  16. ModuleInfo "History: Update to bdwgc 8.1.0.fbcdf44"
  17. ModuleInfo "History: 1.21"
  18. ModuleInfo "History: Update to bdwgc 7.7.0.d76816e"
  19. ModuleInfo "History: 1.20"
  20. ModuleInfo "History: Update to bdwgc 7.7.0."
  21. ModuleInfo "History: 1.19"
  22. ModuleInfo "History: Added interfaces."
  23. ModuleInfo "History: Added Interface and EndInterface keyword docs"
  24. ModuleInfo "History: 1.18"
  25. ModuleInfo "History: WriteStdout and WriteStderr now write UTF-8"
  26. ModuleInfo "History: 1.17 Release"
  27. ModuleInfo "History: Added kludges for Lion llvm"
  28. ModuleInfo "History: Removed Nan/Inf"
  29. ModuleInfo "History: 1.16 Release"
  30. ModuleInfo "History: String.Find now converts start index <0 to 0"
  31. ModuleInfo "History: 1.15 Release"
  32. ModuleInfo "History: Changed ReadStdin so it can handle any length input"
  33. ModuleInfo "History: 1.14 Release"
  34. ModuleInfo "History: Fixed leak in WriteStdout and WriteStderr"
  35. ModuleInfo "History: 1.13 Release"
  36. ModuleInfo "History: Added LibStartUp stub"
  37. ModuleInfo "History: 1.12 Release"
  38. ModuleInfo "History: Added GCSuspend and GCResume"
  39. ModuleInfo "History: 1.11 Release"
  40. ModuleInfo "History: Added experimental dll support"
  41. ModuleInfo "History: 1.10 Release"
  42. ModuleInfo "History: Added Nan and Inf keyword docs"
  43. ModuleInfo "History: 1.09 Release"
  44. ModuleInfo "History: BCC extern CString fix"
  45. ModuleInfo "History: 1.08 Release"
  46. ModuleInfo "History: Removed printf from 'Throw'"
  47. ModuleInfo "History: 1.07 Release"
  48. ModuleInfo "History: Added AppTitle$ global var"
  49. ModuleInfo "History: 1.06 Release"
  50. ModuleInfo "History: Restored ReadData"
  51. ModuleInfo "History: 1.05 Release"
  52. ModuleInfo "History: Lotsa little tidyups"
  53. ModuleInfo "History: 1.04 Release"
  54. ModuleInfo "History: Fixed C Compiler warnings"
  55. ?win32
  56. ModuleInfo "CC_OPTS: -DGC_THREADS -DPARALLEL_MARK -DATOMIC_UNCOLLECTABLE -DLARGE_CONFIG -DUSE_MMAP -DUSE_MUNMAP -DGC_UNMAP_THRESHOLD=3"
  57. ?osx
  58. ModuleInfo "CC_OPTS: -DGC_THREADS -DPARALLEL_MARK -DATOMIC_UNCOLLECTABLE -DLARGE_CONFIG -DUSE_MMAP -DUSE_MUNMAP -DGC_UNMAP_THRESHOLD=3"
  59. ?linuxx86
  60. ModuleInfo "CC_OPTS: -DGC_THREADS -D_REENTRANT -DPARALLEL_MARK -DATOMIC_UNCOLLECTABLE -DLARGE_CONFIG -DUSE_MMAP -DUSE_MUNMAP -DGC_UNMAP_THRESHOLD=3"
  61. ?linuxx64
  62. ModuleInfo "CC_OPTS: -DGC_THREADS -D_REENTRANT -DPARALLEL_MARK -DATOMIC_UNCOLLECTABLE -DLARGE_CONFIG -DUSE_MMAP -DUSE_MUNMAP -DGC_UNMAP_THRESHOLD=3"
  63. ?linuxarm64 and not raspberrypi
  64. ModuleInfo "CC_OPTS: -DGC_THREADS -D_REENTRANT -DPARALLEL_MARK -DATOMIC_UNCOLLECTABLE -DLARGE_CONFIG -DUSE_MMAP -DUSE_MUNMAP -DGC_UNMAP_THRESHOLD=3"
  65. ?raspberrypi
  66. ModuleInfo "CC_OPTS: -DGC_THREADS -D_REENTRANT -DPARALLEL_MARK -DATOMIC_UNCOLLECTABLE -DUSE_MMAP -DUSE_MUNMAP -DGC_UNMAP_THRESHOLD=3"
  67. ?android
  68. ModuleInfo "CC_OPTS: -DGC_THREADS -D_REENTRANT -DATOMIC_UNCOLLECTABLE"
  69. ?emscripten
  70. ModuleInfo "CC_OPTS: -DATOMIC_UNCOLLECTABLE"
  71. ?ios
  72. ModuleInfo "CC_OPTS: -DGC_THREADS -DATOMIC_UNCOLLECTABLE"
  73. ?musl
  74. ModuleInfo "CC_OPTS: -DNO_GETCONTEXT"
  75. ?nx
  76. ModuleInfo "CC_OPTS: -DATOMIC_UNCOLLECTABLE -DNN_BUILD_TARGET_PLATFORM_NX"
  77. ?haiku
  78. ModuleInfo "CC_OPTS: -DGC_THREADS -DPARALLEL_MARK -DATOMIC_UNCOLLECTABLE -DLARGE_CONFIG -DUSE_MMAP -DUSE_MUNMAP -DGC_UNMAP_THRESHOLD=3"
  79. ?
  80. ModuleInfo "CC_OPTS: -DJAVA_FINALIZATION -DNO_EXECUTE_PERMISSION"
  81. ?debug
  82. ModuleInfo "CC_OPTS: -DBMX_DEBUG"
  83. ?
  84. ' uncomment to enable allocation counting
  85. 'ModuleInfo "CC_OPTS: -DBBCC_ALLOCCOUNT"
  86. Import "blitz_app.c"
  87. Import "blitz_types.c"
  88. Import "blitz_cclib.c"
  89. Import "blitz_memory.c"
  90. Import "blitz_module.c"
  91. Import "blitz_object.c"
  92. Import "blitz_string.c"
  93. Import "blitz_array.c"
  94. Import "blitz_handle.c"
  95. Import "blitz_debug.c"
  96. Import "blitz_incbin.c"
  97. Import "blitz_thread.c"
  98. Import "blitz_ex.c"
  99. Import "blitz_gc.c"
  100. Import "blitz_unicode.c"
  101. Import "blitz_enum.c"
  102. '?Threaded
  103. 'Import "blitz_gc_ms.c"
  104. '?Not Threaded
  105. 'Import "blitz_gc_rc.c"
  106. '?
  107. '?Win32X86
  108. 'Import "blitz_ex.win32.x86.s"
  109. 'Import "blitz_gc.win32.x86.s"
  110. 'Import "blitz_ftoi.win32.x86.s"
  111. '?LinuxX86
  112. 'Import "blitz_ex.linux.x86.s"
  113. 'Import "blitz_gc.linux.x86.s"
  114. 'Import "blitz_ftoi.linux.x86.s"
  115. '?MacosX86
  116. 'Import "blitz_ex.macos.x86.s"
  117. 'Import "blitz_gc.macos.x86.s"
  118. 'Import "blitz_ftoi.macos.x86.s"
  119. '?MacosPPC
  120. 'Import "blitz_ex.macos.ppc.s"
  121. 'Import "blitz_gc.macos.ppc.s"
  122. '?
  123. Import "bdwgc/include/*.h"
  124. Import "bdwgc/libatomic_ops/src/*.h"
  125. Import "bdwgc/reclaim.c"
  126. Import "bdwgc/allchblk.c"
  127. Import "bdwgc/misc.c"
  128. Import "bdwgc/alloc.c"
  129. Import "bdwgc/mach_dep.c"
  130. Import "bdwgc/os_dep.c"
  131. Import "bdwgc/mark_rts.c"
  132. Import "bdwgc/headers.c"
  133. Import "bdwgc/mark.c"
  134. Import "bdwgc/obj_map.c"
  135. Import "bdwgc/blacklst.c"
  136. Import "bdwgc/finalize.c"
  137. Import "bdwgc/new_hblk.c"
  138. Import "bdwgc/dyn_load.c"
  139. Import "bdwgc/dbg_mlc.c"
  140. Import "bdwgc/malloc.c"
  141. Import "bdwgc/checksums.c"
  142. Import "bdwgc/pthread_start.c"
  143. Import "bdwgc/pthread_support.c"
  144. Import "bdwgc/pthread_stop_world.c"
  145. Import "bdwgc/darwin_stop_world.c"
  146. Import "bdwgc/typd_mlc.c"
  147. Import "bdwgc/ptr_chck.c"
  148. Import "bdwgc/mallocx.c"
  149. Import "bdwgc/gcj_mlc.c"
  150. Import "bdwgc/specific.c"
  151. Import "bdwgc/gc_dlopen.c"
  152. Import "bdwgc/backgraph.c"
  153. Import "bdwgc/win32_threads.c"
  154. Import "bdwgc/thread_local_alloc.c" 'bdwgc only? not gc6.7
  155. ?nx
  156. Import "blitz_nx.c"
  157. ?
  158. Import "tree/tree.c"
  159. Include "builtin.bmx"
  160. Include "iterator.bmx"
  161. Include "comparator.bmx"
  162. Extern
  163. Global OnDebugStop()="bbOnDebugStop"
  164. Global OnDebugLog( message$ )="bbOnDebugLog"
  165. End Extern
  166. Rem
  167. bbdoc: Exception
  168. about: Common base class of the built-in exceptions of the language.
  169. End Rem
  170. Type TBlitzException
  171. End Type
  172. Rem
  173. bbdoc: Null object exception
  174. about: Thrown when a field or method of a Null object is accessed. (only in debug mode)
  175. End Rem
  176. Type TNullObjectException Extends TBlitzException
  177. Method ToString$() Override
  178. Return "Attempt to access field or method of Null object"
  179. End Method
  180. End Type
  181. Rem
  182. bbdoc: Null method exception
  183. about: Thrown when an abstract method is called.
  184. End Rem
  185. Type TNullMethodException Extends TBlitzException
  186. Method ToString$() Override
  187. Return "Attempt to call abstract method"
  188. End Method
  189. End Type
  190. Rem
  191. bbdoc: Null function exception
  192. about: Thrown when an uninitialized function pointer is called.
  193. End Rem
  194. Type TNullFunctionException Extends TBlitzException
  195. Method ToString$() Override
  196. Return "Attempt to call uninitialized function pointer"
  197. End Method
  198. End Type
  199. Rem
  200. bbdoc: Array bounds exception
  201. about: Thrown when an array element with an index outside the valid range of the array (0 to array.length-1) is accessed. (only in debug mode)
  202. End Rem
  203. Type TArrayBoundsException Extends TBlitzException
  204. Method ToString$() Override
  205. Return "Attempt to index array element beyond array length"
  206. End Method
  207. End Type
  208. Rem
  209. bbdoc: Out of data exception
  210. about: Thrown when #ReadData is used but not enough data is left to read. (only in debug mode)
  211. End Rem
  212. Type TOutOfDataException Extends TBlitzException
  213. Method ToString$() Override
  214. Return "Attempt to read beyond end of data"
  215. End Method
  216. End Type
  217. Rem
  218. bbdoc: Runtime exception
  219. about: Thrown by #RuntimeError.
  220. End Rem
  221. Type TRuntimeException Extends TBlitzException
  222. Field error$
  223. Method ToString$() Override
  224. Return error
  225. End Method
  226. Function Create:TRuntimeException( error$ )
  227. Local t:TRuntimeException=New TRuntimeException
  228. t.error=error
  229. Return t
  230. End Function
  231. End Type
  232. Rem
  233. bbdoc: Invalid enum exception
  234. about: Thrown when attempting to cast an invalid value to an #Enum. (only in debug mode)
  235. End Rem
  236. Type TInvalidEnumException Extends TBlitzException
  237. Method ToString$() Override
  238. Return "Attempt to cast invalid value to Enum"
  239. End Method
  240. End Type
  241. Function NullObjectError()
  242. Throw New TNullObjectException
  243. End Function
  244. Function NullMethodError()
  245. Throw New TNullMethodException
  246. End Function
  247. Function NullFunctionError()
  248. Throw New TNullFunctionException
  249. End Function
  250. Function ArrayBoundsError()
  251. Throw New TArrayBoundsException
  252. End Function
  253. Function OutOfDataError()
  254. Throw New TOutOfDataException
  255. End Function
  256. Function InvalidEnumError()
  257. Throw New TInvalidEnumException
  258. End Function
  259. Rem
  260. bbdoc: Generate a runtime error
  261. about: Throws a #TRuntimeException.
  262. End Rem
  263. Function RuntimeError( message$ )
  264. Throw TRuntimeException.Create( message )
  265. End Function
  266. Rem
  267. bbdoc: Stop program execution and enter debugger
  268. about: If there is no debugger present, this command is ignored.
  269. end rem
  270. Function DebugStop()
  271. OnDebugStop
  272. End Function
  273. Rem
  274. bbdoc: Write a string to debug log
  275. about: If there is no debugger present, this command is ignored.
  276. end rem
  277. Function DebugLog( message$ )
  278. OnDebugLog message
  279. End Function
  280. Extern
  281. Rem
  282. bbdoc: Application directory
  283. about: The #AppDir global variable contains the fully qualified directory of the currently
  284. executing application. An application's initial current directory is also set to #AppDir
  285. when an application starts.
  286. In a compiled DLL, the #AppDir global variable will instead contain the fully qualified
  287. directory of the DLL.
  288. End Rem
  289. Global AppDir$="bbAppDir"
  290. Rem
  291. bbdoc: Application file name
  292. about: The #AppFile global variable contains the fully qualified file name of the currently
  293. executing application.
  294. In a compiled DLL, the #AppFile global variable will instead contain the fully qualified
  295. file name of the DLL.
  296. End Rem
  297. Global AppFile$="bbAppFile"
  298. Rem
  299. bbdoc: Application title
  300. about: The #AppTitle global variable is used by various commands when a
  301. default application title is required - for example, when opening simple
  302. windows or requesters.<br/>
  303. <br/>
  304. Initially, #AppTitle is set to the value "BlitzMax Application". However, you may change
  305. #AppTitle at any time with a simple assignment.
  306. End Rem
  307. Global AppTitle$="bbAppTitle"
  308. Rem
  309. bbdoc: Arguments passed to the application at startup
  310. about: The #AppArgs global array contains the command line parameters sent to an application
  311. when it was started. The first element of #AppArgs always contains the name of the
  312. application. However, the format of the name may change depending on how the application
  313. was launched. Use #AppDir or #AppFile for consistent information about the applications name
  314. or directory.
  315. End Rem
  316. Global AppArgs$[]="bbAppArgs"
  317. Rem
  318. bbdoc: Directory from which application was launched
  319. about: The #LaunchDir global variable contains the current directory at the time the
  320. application was launched. This is mostly of use to command line tools which may need to
  321. access the 'shell' current directory as opposed to the application directory.
  322. End Rem
  323. Global LaunchDir$="bbLaunchDir"
  324. Rem
  325. bbdoc: Add a function to be called when the program ends
  326. about: #OnEnd allows you to specify a function to be called when the program ends. OnEnd functions are called
  327. in the reverse order to that in which they were added.
  328. end rem
  329. Function OnEnd( fun() )="bbOnEnd"
  330. Rem
  331. bbdoc: Read a string from stdin
  332. returns: A string read from stdin. The newline terminator, if any, is included in the returned string.
  333. end rem
  334. Function ReadStdin$()="bbReadStdin"
  335. Rem
  336. bbdoc: Write a string to stdout
  337. about: Writes @str to stdout and flushes stdout.
  338. end rem
  339. Function WriteStdout( str$ )="bbWriteStdout"
  340. Rem
  341. bbdoc: Write a string to stderr
  342. about: Writes @str to stderr and flushes stderr.
  343. end rem
  344. Function WriteStderr( str$ )="bbWriteStderr"
  345. Rem
  346. bbdoc: Wait for a given number of milliseconds
  347. about:
  348. #Delay suspends program execution for at least @millis milliseconds.<br/>
  349. <br/>
  350. A millisecond is one thousandth of a second.
  351. End Rem
  352. Function Delay( millis:Int )="bbDelay"
  353. Rem
  354. bbdoc: Wait for a given number of microseconds
  355. about:
  356. #UDelay suspends program execution for at least @microcseconds.<br/>
  357. <br/>
  358. A microsecond is one millionth of a second.
  359. End Rem
  360. Function UDelay( microseconds:Int )="void bbUDelay(int)!"
  361. Rem
  362. bbdoc: Get millisecond counter
  363. returns: Milliseconds since computer turned on.
  364. about:
  365. #MilliSecs returns the number of milliseconds elapsed since the computer
  366. was turned on.<br/>
  367. <br/>
  368. A millisecond is one thousandth of a second.
  369. End Rem
  370. Function MilliSecs:Int()="bbMilliSecs"
  371. Rem
  372. bbdoc: Allocate memory
  373. returns: A new block of memory @size bytes long
  374. End Rem
  375. Function MemAlloc:Byte Ptr( size:Size_T )="void* bbMemAlloc( size_t )"
  376. Rem
  377. bbdoc: Free allocated memory
  378. about: The memory specified by @mem must have been previously allocated by #MemAlloc or #MemExtend.
  379. End Rem
  380. Function MemFree( mem:Byte Ptr )="void bbMemFree( void * )"
  381. Rem
  382. bbdoc: Extend a block of memory
  383. returns: A new block of memory @new_size bytes long
  384. about: An existing block of memory specified by @mem and @size is copied into a new block
  385. of memory @new_size bytes long. The existing block is released and the new block is returned.
  386. End Rem
  387. Function MemExtend:Byte Ptr( mem:Byte Ptr,size:Size_T,new_size:Size_T )="void* bbMemExtend( void *,size_t ,size_t )"
  388. Rem
  389. bbdoc: Clear a block of memory to 0
  390. End Rem
  391. Function MemClear( mem:Byte Ptr,size:Size_T )="void bbMemClear( void *,size_t )"
  392. Rem
  393. bbdoc: Copy a non-overlapping block of memory
  394. End Rem
  395. Function MemCopy( dst:Byte Ptr,src:Byte Ptr,size:Size_T )="void bbMemCopy( void *,const void *,size_t )"
  396. Rem
  397. bbdoc: Copy a potentially overlapping block of memory
  398. End Rem
  399. Function MemMove( dst:Byte Ptr,src:Byte Ptr,size:Size_T )="void bbMemMove( void *,const void *,size_t )"
  400. Rem
  401. bbdoc: Set garbage collector mode
  402. about:
  403. @mode can be one of the following:<br/>
  404. 1 : automatic GC - memory will be automatically garbage collected<br/>
  405. 2 : manual GC - no memory will be collected until a call to GCCollect is made<br/>
  406. <br/>
  407. The default GC mode is automatic GC.
  408. End Rem
  409. Function GCSetMode( Mode:Int )="bbGCSetMode"
  410. Rem
  411. bbdoc: Suspend garbage collector
  412. about:
  413. #GCSuspend temporarily suspends the garbage collector. No garbage
  414. collection will be performed following a call to #GCSuspend.<br/>
  415. <br/>
  416. Use #GCResume to resume the garbage collector. Note that #GCSuspend
  417. and #GCResume 'nest', meaning that each call to #GCSuspend must be
  418. matched by a call to #GCResume.
  419. End Rem
  420. Function GCSuspend()="bbGCSuspend"
  421. Rem
  422. bbdoc: Resume garbage collector
  423. about:
  424. #GCResume resumes garbage collection following a call to #GCSuspend.<br/>
  425. <br/>
  426. See #GCSuspend for more details.
  427. End Rem
  428. Function GCResume()="bbGCResume"
  429. Rem
  430. bbdoc: Run garbage collector
  431. returns: The amount of memory, in bytes, collected.
  432. about:
  433. This function will have no effect if the garbage collector has been
  434. suspended due to #GCSuspend.
  435. End Rem
  436. Function GCCollect:Size_T()="bbGCCollect"
  437. Rem
  438. bbdoc: Run garbage collector, collecting a little
  439. returns: Returns 0 if there is no more to collect.
  440. about:
  441. This function will have no effect if the garbage collector has been
  442. suspended due to #GCSuspend.
  443. End Rem
  444. Function GCCollectALittle:Int()="bbGCCollectALittle"
  445. Rem
  446. bbdoc: Memory allocated by application
  447. returns: The amount of memory, in bytes, currently allocated by the application
  448. about:
  449. This function only returns 'managed memory'. This includes all objects, strings and
  450. arrays in use by the application.
  451. End Rem
  452. Function GCMemAlloced:Size_T()="bbGCMemAlloced"
  453. Rem
  454. bbdoc: Private: do not use
  455. End Rem
  456. Function GCEnter()="bbGCEnter"
  457. Rem
  458. bbdoc: Private: do not use
  459. End Rem
  460. Function GCLeave()="bbGCLeave"
  461. Rem
  462. bbdoc: Retains a reference to the specified #Object, preventing it from being collected.
  463. End Rem
  464. Function GCRetain(obj:Object)="bbGCRetain"
  465. Rem
  466. bbdoc: Releases a reference from the specified #Object.
  467. End Rem
  468. Function GCRelease(obj:Object)="void bbGCRelease(BBObject*)!"
  469. Rem
  470. bbdoc: Returns #True if the current thread is registered with the garbage collector.
  471. End Rem
  472. Function GCThreadIsRegistered:Int()="bbGCThreadIsRegistered"
  473. Rem
  474. bbdoc: Registers the current thread with the garbage collector.
  475. returns: 0 on success, 1 if the thread was already registered, or -1 if threads are not supported.
  476. End Rem
  477. Function GCRegisterMyThread:Int()="bbGCRegisterMyThread"
  478. Rem
  479. bbdoc: Unregisters the previously registered current thread.
  480. about: Note, that any memory allocated by the garbage collector from the current thread will no longer be
  481. accessible after the thread is unregistered.
  482. End Rem
  483. Function GCUnregisterMyThread:Int()="bbGCUnregisterMyThread"
  484. Rem
  485. bbdoc: Convert object to integer handle
  486. returns: An integer object handle
  487. about:
  488. After converting an object to an integer handle, you must later
  489. release it using the #Release command.
  490. End Rem
  491. Function HandleFromObject:Size_T( obj:Object )="bbHandleFromObject"
  492. Rem
  493. bbdoc: Convert integer handle to object
  494. returns: The object associated with the integer handle
  495. End Rem
  496. Function HandleToObject:Object( handle:Size_T )="bbHandleToObject"
  497. Rem
  498. bbdoc: Copies an array from the specified @src array, starting at the position @srcPos, to the position @dstPos of the destination array.
  499. End Rem
  500. Function ArrayCopy(src:Object, srcPos:Int, dst:Object, dstPos:Int, length:Int)="void bbArrayCopy(BBARRAY, int, BBARRAY, int, int)!"
  501. Rem
  502. bbdoc: Determines whether the #Object @obj is an empty array.
  503. returns: #True if @obj is an empty array, or #False otherwise.
  504. End Rem
  505. Function IsEmptyArray:Int(obj:Object)="int bbObjectIsEmptyArray(BBOBJECT)!"
  506. Rem
  507. bbdoc: Determines whether the #Object @obj is an empty #String.
  508. returns: #True if @obj is an empty #String, or #False otherwise.
  509. End Rem
  510. Function IsEmptyString:Int(obj:Object)="int bbObjectIsEmptyString(BBOBJECT)!"
  511. Rem
  512. bbdoc: Determines whether the #Object @obj is a #String.
  513. returns: #True if @obj is a #String, or #False otherwise.
  514. End Rem
  515. Function ObjectIsString:Int(obj:Object)="int bbObjectIsString(BBOBJECT)!"
  516. Function DumpObjectCounts(buffer:Byte Ptr, size:Int, includeZeros:Int)="bbObjectDumpInstanceCounts"
  517. Global CountObjectInstances:Int="bbCountInstances"
  518. End Extern
  519. Rem
  520. bbdoc: Provides a mechanism for releasing resources.
  521. End Rem
  522. Interface IDisposable
  523. Rem
  524. bbdoc: Performs application-defined tasks associated with freeing, releasing, or resetting resources.
  525. End Rem
  526. Method Dispose()
  527. End Interface
  528. 'BlitzMax keyword definitions
  529. Rem
  530. bbdoc: Set strict mode
  531. about:
  532. See the <a href="../../../../doc/bmxlang/compatibility.html">BlitzMax Language Reference</a> for more information on Strict mode programming.
  533. keyword: "Strict"
  534. End Rem
  535. Rem
  536. bbdoc: Set SuperStrict mode
  537. keyword: "SuperStrict"
  538. End Rem
  539. Rem
  540. bbdoc: End program execution
  541. keyword: "End"
  542. End Rem
  543. Rem
  544. bbdoc: Begin a remark block
  545. keyword: "Rem"
  546. End Rem
  547. Rem
  548. bbdoc: End a remark block
  549. keyword: "EndRem"
  550. End Rem
  551. Rem
  552. bbdoc: Constant integer of value 1
  553. keyword: "True"
  554. End Rem
  555. Rem
  556. bbdoc: Constant integer of value 0
  557. keyword: "False"
  558. End Rem
  559. Rem
  560. bbdoc: Constant pi value: 3.1415926535897932384626433832795
  561. keyword: "Pi"
  562. End Rem
  563. Rem
  564. bbdoc: Get Null value (default value for types)
  565. keyword: "Null"
  566. End Rem
  567. Rem
  568. bbdoc: Unsigned 8 bit integer type
  569. keyword: "Byte"
  570. End Rem
  571. Rem
  572. bbdoc: Unsigned 16 bit integer type
  573. keyword: "Short"
  574. End Rem
  575. Rem
  576. bbdoc: Signed 32 bit integer type
  577. keyword: "Int"
  578. End Rem
  579. Rem
  580. bbdoc: Unsigned 32 bit integer type
  581. keyword: "UInt"
  582. End Rem
  583. Rem
  584. bbdoc: Signed 64 bit integer type
  585. keyword: "Long"
  586. End Rem
  587. Rem
  588. bbdoc: Unsigned 64 bit integer type
  589. keyword: "ULong"
  590. End Rem
  591. Rem
  592. bbdoc: Unsigned 32/64 bit integer type
  593. keyword: "Size_T"
  594. End Rem
  595. Rem
  596. bbdoc: Signed 32/64 bit LPARAM WinAPI type
  597. keyword: "LParam"
  598. about: Only available on Windows.
  599. End Rem
  600. Rem
  601. bbdoc: Unsigned 32/64 bit WPARAM WinAPI type
  602. keyword: "WParam"
  603. about: Only available on Windows.
  604. End Rem
  605. Rem
  606. bbdoc: 32 bit floating point type
  607. keyword: "Float"
  608. End Rem
  609. Rem
  610. bbdoc: 64 bit floating point type
  611. keyword: "Double"
  612. End Rem
  613. Rem
  614. bbdoc: 128 bit integer intrinsic type
  615. about: Only available on x64.
  616. keyword: "Int128"
  617. End Rem
  618. Rem
  619. bbdoc: 64 bit floating point intrinsic type
  620. about: Only available on x64.
  621. keyword: "Float64"
  622. End Rem
  623. Rem
  624. bbdoc: 128 bit floating point intrinsic type
  625. about: Only available on x64.
  626. keyword: "Float128"
  627. End Rem
  628. Rem
  629. bbdoc: 128 bit floating point intrinsic type
  630. about: Only available on x64.
  631. keyword: "Double128"
  632. End Rem
  633. Rem
  634. bbdoc: String type
  635. keyword: "String"
  636. End Rem
  637. Rem
  638. bbdoc: Object type
  639. keyword: "Object"
  640. End Rem
  641. Rem
  642. bbdoc: Composite type specifier for 'by reference' types
  643. keyword: "Var"
  644. End Rem
  645. Rem
  646. bbdoc: Composite type specifier for pointer types
  647. keyword: "Ptr"
  648. End Rem
  649. Rem
  650. bbdoc: Begin a conditional block.
  651. keyword: "If"
  652. End Rem
  653. Rem
  654. bbdoc: Optional separator between the condition and associated code in an If statement.
  655. keyword: "Then"
  656. End Rem
  657. Rem
  658. bbdoc: Else provides the ability for an If-Then construct to execute a second block of code when the If condition is false.
  659. keyword: "Else"
  660. End Rem
  661. Rem
  662. bbdoc: ElseIf provides the ability to test and execute a section of code if the initial condition failed.
  663. keyword: "ElseIf"
  664. End Rem
  665. Rem
  666. bbdoc: Marks the End of an If-Then construct.
  667. keyword: "EndIf"
  668. End Rem
  669. Rem
  670. bbdoc: Marks the start of a loop that uses an iterator to execute a section of code repeatedly.
  671. keyword: "For"
  672. End Rem
  673. Rem
  674. bbdoc: Followed by a constant which is used to calculate when to exit a For..Next loop.
  675. keyword: "To"
  676. End Rem
  677. Rem
  678. bbdoc: Specifies an optional constant that is used to increment the For iterator.
  679. keyword: "Step"
  680. End Rem
  681. Rem
  682. bbdoc: End a For block
  683. keyword: "Next"
  684. End Rem
  685. Rem
  686. bbdoc: Iterate through an array or collection
  687. keyword: "EachIn"
  688. End Rem
  689. Rem
  690. bbdoc: Execute a block of code while a condition is true
  691. keyword: "While"
  692. End Rem
  693. Rem
  694. bbdoc: End a While block
  695. keyword: "Wend"
  696. End Rem
  697. Rem
  698. bbdoc: End a While block
  699. keyword: "EndWhile"
  700. End Rem
  701. Rem
  702. bbdoc: Execute a block of code until a termination condition is met, or forever
  703. keyword: "Repeat"
  704. End Rem
  705. Rem
  706. bbdoc: Conditionally continue a Repeat block
  707. keyword: "Until"
  708. End Rem
  709. Rem
  710. bbdoc: Continue a Repeat block forever
  711. keyword: "Forever"
  712. End Rem
  713. Rem
  714. bbdoc: Begin a Select block
  715. keyword: "Select"
  716. End Rem
  717. Rem
  718. bbdoc: End a Select block
  719. keyword: "EndSelect"
  720. End Rem
  721. Rem
  722. bbdoc: Conditional code inside a Select block
  723. keyword: "Case"
  724. End Rem
  725. Rem
  726. bbdoc: Default code inside a Select block
  727. keyword: "Default"
  728. End Rem
  729. Rem
  730. bbdoc: Exit enclosing loop
  731. keyword: "Exit"
  732. End Rem
  733. Rem
  734. bbdoc: Continue execution of enclosing loop
  735. keyword: "Continue"
  736. End Rem
  737. Rem
  738. bbdoc: Declare a constant
  739. keyword: "Const"
  740. End Rem
  741. Rem
  742. bbdoc: Declare a local variable
  743. keyword: "Local"
  744. End Rem
  745. Rem
  746. bbdoc: Declare a global variable
  747. keyword: "Global"
  748. End Rem
  749. Rem
  750. bbdoc: Declare a threaded global variable
  751. about: Each thread will have its own copy of the variable - any changes to the variable will be visible only within the thread the change was made.
  752. keyword: "ThreadedGlobal"
  753. End Rem
  754. Rem
  755. bbdoc: Declare a field variable
  756. keyword: "Field"
  757. End Rem
  758. Rem
  759. bbdoc: Begin a function declaration
  760. keyword: "Function"
  761. End Rem
  762. Rem
  763. bbdoc: End a function declaration
  764. keyword: "EndFunction"
  765. End Rem
  766. Rem
  767. bbdoc: Begin a method declaration
  768. keyword: "Method"
  769. End Rem
  770. Rem
  771. bbdoc: End a method declaration
  772. keyword: "EndMethod"
  773. End Rem
  774. Rem
  775. bbdoc: Return from a method or function
  776. keyword: "Return"
  777. End Rem
  778. Rem
  779. bbdoc: Begin a user defined class declaration
  780. keyword: "Type"
  781. End Rem
  782. Rem
  783. bbdoc: End a user defined class declaration
  784. keyword: "EndType"
  785. End Rem
  786. Rem
  787. bbdoc: Begin a user defined interface declaration
  788. keyword: "Interface"
  789. End Rem
  790. Rem
  791. bbdoc: End a user defined interface declaration
  792. keyword: "EndInterface"
  793. End Rem
  794. Rem
  795. bbdoc: Begin a user defined structure declaration
  796. keyword: "Struct"
  797. End Rem
  798. Rem
  799. bbdoc: End a user defined structure declaration
  800. keyword: "EndStruct"
  801. End Rem
  802. Rem
  803. bbdoc: Begin an enumeration declaration
  804. keyword: "Enum"
  805. End Rem
  806. Rem
  807. bbdoc: End an enumeration declaration
  808. keyword: "EndEnum"
  809. End Rem
  810. Rem
  811. bbdoc: Specify supertype(s) of a user defined type
  812. keyword: "Extends"
  813. End Rem
  814. Rem
  815. bbdoc: Specify implemented interface(s) of a user defined type
  816. keyword: "Implements"
  817. End Rem
  818. Rem
  819. bbdoc: Denote a class, function or method as abstract
  820. keyword: "Abstract"
  821. End Rem
  822. Rem
  823. bbdoc: Denote a class, function or method as final
  824. keyword: "Final"
  825. End Rem
  826. Rem
  827. bbdoc: Denote a field as read only, where the value may only be set in its declaration or in the type constructor
  828. keyword: "ReadOnly"
  829. End Rem
  830. Rem
  831. bbdoc: Denote a function for export to a shared library. The generated function name will not be mangled.
  832. keyword: "Export"
  833. End Rem
  834. Rem
  835. bbdoc: Indicates that a method declaration is intended to override a method declaration in a supertype.
  836. about: Use of #Override on a method that does not override a method will result in a compilation error.
  837. keyword: "Override"
  838. End Rem
  839. Rem
  840. bbdoc: Specify constraints on the types that can be used as arguments for a type parameter defined in a generic declaration
  841. keyword: "Where"
  842. End Rem
  843. Rem
  844. bbdoc: Create an instance of a user defined type, or specify a custom constructor
  845. keyword: "New"
  846. End Rem
  847. Rem
  848. bbdoc: Specify a custom finalizer
  849. keyword: "Delete"
  850. End Rem
  851. Rem
  852. bbdoc: Reference to this method's type instance
  853. keyword: "Self"
  854. End Rem
  855. Rem
  856. bbdoc: Reference to the super type instance
  857. keyword: "Super"
  858. End Rem
  859. Rem
  860. bbdoc: Release an integer object handle
  861. keyword: "Release"
  862. End Rem
  863. Rem
  864. bbdoc: Make types, constants, global variables, functions or type members accessible from outside the current source file (default)
  865. keyword: "Public"
  866. End Rem
  867. Rem
  868. bbdoc: Make types, constants, global variables, functions or type members only accessible from within the current source file.
  869. keyword: "Private"
  870. End Rem
  871. Rem
  872. bbdoc: Make type members only accessible from within the current source file and within subtypes.
  873. keyword: "Protected"
  874. End Rem
  875. Rem
  876. bbdoc: Begin an Extern section (a list of imported external declarations)
  877. keyword: "Extern"
  878. End Rem
  879. Rem
  880. bbdoc: End an Extern section
  881. keyword: "EndExtern"
  882. End Rem
  883. Rem
  884. bbdoc: Declare module scope and identifier
  885. about:
  886. See the <a href="../../../../doc/bmxlang/modules.html">BlitzMax Language Reference</a> for more information on BlitzMax Modules.
  887. keyword: "Module"
  888. End Rem
  889. Rem
  890. bbdoc: Define module properties
  891. keyword: "ModuleInfo"
  892. End Rem
  893. Rem
  894. bbdoc: Embed a data file
  895. keyword: "Incbin"
  896. End Rem
  897. Rem
  898. bbdoc: Get start address of embedded data file
  899. keyword: "IncbinPtr"
  900. End Rem
  901. Rem
  902. bbdoc: Get length of embedded data file
  903. keyword: "IncbinLen"
  904. End Rem
  905. Rem
  906. bbdoc: Include effectively 'inserts' the specified file into the file being compiled.
  907. keyword: "Include"
  908. End Rem
  909. Rem
  910. bbdoc: Framework builds the BlitzMax application with only the module(s) specified rather than the standard set of modules.
  911. keyword: "Framework"
  912. End Rem
  913. Rem
  914. bbdoc: Import declarations from a module or source file
  915. keyword: "Import"
  916. End Rem
  917. Rem
  918. bbdoc: Throw a RuntimeError if a condition is false
  919. keyword: "Assert"
  920. End Rem
  921. Rem
  922. bbdoc: Transfer program flow to specified label
  923. keyword: "Goto"
  924. End Rem
  925. Rem
  926. bbdoc: Begin declaration of a Try block
  927. keyword: "Try"
  928. End Rem
  929. Rem
  930. bbdoc: Catch an exception object in a Try block
  931. keyword: "Catch"
  932. End Rem
  933. Rem
  934. bbdoc: Execute a block of code upon exiting a Try or Catch block
  935. keyword: "Finally"
  936. End Rem
  937. Rem
  938. bbdoc: End declaration of a Try block
  939. keyword: "EndTry"
  940. End Rem
  941. Rem
  942. bbdoc: Throw an exception object to the enclosing Try block
  943. keyword: "Throw"
  944. End Rem
  945. Rem
  946. bbdoc: Define classic BASIC style data
  947. keyword: "DefData"
  948. End Rem
  949. Rem
  950. bbdoc: Read classic BASIC style data
  951. keyword: "ReadData"
  952. End Rem
  953. Rem
  954. bbdoc: Restore classic BASIC style data
  955. keyword: "RestoreData"
  956. End Rem
  957. Rem
  958. bbdoc: Conditional 'And' binary operator
  959. keyword: "And"
  960. End Rem
  961. Rem
  962. bbdoc: Conditional 'Or' binary operator
  963. keyword: "Or"
  964. End Rem
  965. Rem
  966. bbdoc: Conditional 'Not' binary operator
  967. keyword: "Not"
  968. End Rem
  969. Rem
  970. bbdoc: Bitwise 'Shift left' binary operator
  971. keyword: "Shl"
  972. End Rem
  973. Rem
  974. bbdoc: Bitwise 'Shift right' binary operator
  975. keyword: "Shr"
  976. End Rem
  977. Rem
  978. bbdoc: Bitwise 'Shift arithmetic right' binary operator
  979. keyword: "Sar"
  980. End Rem
  981. Rem
  982. bbdoc: Number of characters in a string or elements in an array
  983. keyword: "Len"
  984. End Rem
  985. Rem
  986. bbdoc: Numeric 'modulus' or 'remainder' binary operator
  987. keyword: "Mod"
  988. End Rem
  989. Rem
  990. bbdoc: Find the address of a variable
  991. keyword: "Varptr"
  992. End Rem
  993. Rem
  994. bbdoc: Size, in bytes, occupied by a variable, string, array or object
  995. keyword: "SizeOf"
  996. End Rem
  997. Rem
  998. bbdoc: Get character value of the first character of a string
  999. keyword: "Asc"
  1000. End Rem
  1001. Rem
  1002. bbdoc: Create a string of length 1 with a character code
  1003. keyword: "Chr"
  1004. End Rem
  1005. Rem
  1006. bbdoc: Allocates memory from the stack.
  1007. keyword: "StackAlloc"
  1008. about: This memory is automatically freed on leaving the function where it was created.
  1009. It should not be freed, or returned from the function.
  1010. End Rem
  1011. Rem
  1012. bbdoc: Returns the offset in bytes for a field of the specified #Type or #Struct.
  1013. keyword: "FieldOffset"
  1014. End Rem
  1015. Rem
  1016. bbdoc: Denotes an array as a static array, with its content allocated on the stack.
  1017. keyword: "StaticArray"
  1018. End Rem