blitz.bmx 28 KB

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