/
thinCore.inc
2018 lines (1810 loc) · 121 KB
/
thinCore.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#If 0
'=============================================================================
'File Name : thinCore.inc
'Author : Eros Olmi
'Version : 1.11.3.x
'Description : thinBasic external library Interface definitions
'Web site : http://www.thinbasic.com
'=============================================================================
'COPYRIGHT And PERMISSION NOTICE
'=============================================================================
'Copyright (c) 2003 - 2016, Eros Olmi, <eros.olmi@thinbasic.com>
'
'All rights reserved.
'
'Permission To use this software Is granted Only For the purpose To develop
'thinBasic language modules both For commercial Or non commercial purpose.
'In Any Case the above copyright notice And this permission notice must appear
'In All Copies.
'
'THE SOFTWARE Is PROVIDED "AS IS", WITHOUT WARRANTY Of Any KIND, EXPRESS Or
'IMPLIED, INCLUDING BUT Not LIMITED To THE WARRANTIES Of MERCHANTABILITY,
'FITNESS For A PARTICULAR PURPOSE And NONINFRINGEMENT Of THIRD PARTY RIGHTS.
'In NO EVENT SHALL THE AUTHORS Or COPYRIGHT HOLDERS BE LIABLE For Any CLAIM,
'DAMAGES Or OTHER LIABILITY, WHETHER In AN ACTION Of CONTRACT, TORT Or
'OTHERWISE, ARISING From, Out Of Or In CONNECTION With THE SOFTWARE Or THE
'USE Or OTHER DEALINGS In THE SOFTWARE.
'
'=============================================================================
'Edit History [+]Add, [-]Fixed, [*]Changed, [N]Note
'_____________________________________________________________________________
'Date_______Type_Note_________________________________________________________
'
'2010/08/21 [+] thinBasic_Class_Add()
'=============================================================================
#EndIf
#IF NOT %DEF(%TRUE)
%TRUE = 1
#ENDIF
#IF NOT %DEF(%FALSE)
%FALSE = 0
#ENDIF
'------------------------------------------------------------------------------
'Global declares
'------------------------------------------------------------------------------
%thinBasic_ForceOverWrite = 1& 'Used in thinBasic_LoadSymbol to force symbol over writing
%VarMainType_IsNumber = 20&
%VarMainType_IsString = 30&
%VarMainType_IsAsciiZ = 25&
%VarMainType_IsVariant = 50&
%VarMainType_IsUDT = 60&
%VarMainType_IsPTR = 70&
%VarMainType_IsObject = 80&
%VarMainType_IsClass = 90&
%VarMainType_IsFunction = 95&
%VarMainType_IsDispatch = 100&
%VarSubType_Byte = 1&
%VarSubType_Integer = 2&
%VarSubType_Word = 3&
%VarSubType_DWord = 4&
%VarSubType_Long = 5&
%VarSubType_Quad = 6&
%VarSubType_Single = 7&
%VarSubType_Double = 8&
%VarSubType_Currency = 9&
%VarSubType_Ext = 10&
%VarSubType_Variant = 50&
'------------------------------------------------------------------------------
'Return Types from functions/Subs
'------------------------------------------------------------------------------
%thinBasic_ReturnNone = 0& 'Used in thinBasic_LoadSymbol to define a sub
%thinBasic_ReturnCodeNone = %thinBasic_ReturnNone
%thinBasic_ReturnNumber = 20& 'Used in thinBasic_LoadSymbol to define a function returning a EXT number
%thinBasic_ReturnCodeNumber = %thinBasic_ReturnNumber
%thinBasic_ReturnString = 30& 'Used in thinBasic_LoadSymbol to define a function returning a string
%thinBasic_ReturnCodeString = %thinBasic_ReturnString
%thinBasic_ReturnCodeByte = 1& : %thinBasic_ReturnByte = %thinBasic_ReturnCodeByte
%thinBasic_ReturnCodeInteger = 2& : %thinBasic_ReturnInteger = %thinBasic_ReturnCodeInteger
%thinBasic_ReturnCodeWord = 3& : %thinBasic_ReturnWord = %thinBasic_ReturnCodeWord
%thinBasic_ReturnCodeDWord = 4& : %thinBasic_ReturnDWord = %thinBasic_ReturnCodeDWord
%thinBasic_ReturnCodeLong = 5& : %thinBasic_ReturnLong = %thinBasic_ReturnCodeLong
%thinBasic_ReturnCodeQuad = 6& : %thinBasic_ReturnQuad = %thinBasic_ReturnCodeQuad
%thinBasic_ReturnCodeSingle = 7& : %thinBasic_ReturnSingle = %thinBasic_ReturnCodeSingle
%thinBasic_ReturnCodeDouble = 8& : %thinBasic_ReturnDouble = %thinBasic_ReturnCodeDouble
%thinBasic_ReturnCodeCurrency = 9& : %thinBasic_ReturnCurrency = %thinBasic_ReturnCodeCurrency
%thinBasic_ReturnCodeExt = 10& : %thinBasic_ReturnExt = %thinBasic_ReturnCodeExt
'------------------------------------------------------------------------------
%thinBasic_BufferType_IsFile = 0&
%thinBasic_BufferType_IsScript = 1&
%thinBasic_CallingProgram_GUI = 1&
%thinBasic_CallingProgram_Console = 2&
'----------------------------------------------------------------------------
'thinBasic_Init / thinBasic_Run / thinBasic_Release
'----------------------------------------------------------------------------
' Description
' the 3 functions to call in sequence in order to execute a script
' when using thinCore.dll (thinBasic engine) as embedded scripting language
'
'
'----------------------------------------------------------------------------
Declare Function thinBasic_Init _
Lib "thinCore.dll" _
Alias "thinBasic_Init" _
( _
ByVal hWnd As Long , _
ByVal cInstance As Long , _
ByVal sKey As String _
) As Long
'------------------------------------------------------------------------------
Declare Function thinBasic_Init_Isolated _
Lib "thinCore.dll" _
Alias "thinBasic_Init_Isolated" _
( _
ByVal hWnd As Long , _
ByVal cInstance As Long , _
ByVal sKey As String , _
ByVal IsolatedPath As String _
) As Long
'------------------------------------------------------------------------------
Declare Function thinBasic_Init_CheckScript _
Lib "thinCore.dll" _
Alias "thinBasic_Init_CheckScript" _
( _
ByVal hWnd As Long , _
ByVal cInstance As Long , _
ByVal sKey As String , _
ByVal IsolatedPath As String _
) As Long
'------------------------------------------------------------------------------
Declare Function thinBasic_Run _
Lib "thinCore.dll" _
Alias "thinBasic_Run" _
( _
ByVal hScript As Long , _
byval sBuffer As string , _
ByVal BufferType As Long , _
Optional ByVal Options As Long , _
ByVal DebugMode As Long , _
ByVal LogMode As Long , _
ByVal ObfuscateMode As Long , _
ByVal CallingProgram As Long , _
ByVal DependancyMode As Long _
) As Long
Declare Function thinBasic_Release _
Lib "thinCore.dll" _
Alias "thinBasic_Release" _
( _
ByVal hScript As Long _
) As Long
'----------------------------------------------------------------------------
'thinAir support functions
'----------------------------------------------------------------------------
Declare Function thinAir_Function_List _
Lib "thinCore.dll" _
Alias "thinAir_Function_List" _
( _
ByVal hTree As Long _
) As Long
'----------------------------------------------------------------------------
'thinBasic_AddIncludePath
'----------------------------------------------------------------------------
' Description
' when a file us specified in #INCLUDE withou a fully qualified path
' thinBasic will search for the file using script or executable path
' If not found, thinBasic will search in some directories specified by #INCLUDEDIR.
' This function is the equivalent of #INCLUDEDIR but executed from the aoutside
' of the script
'
' Parameters
' sNewIncludeDir : full path of the new include dir when thinBasic will serach fon files
' specified in #INCLUDE
'
' ReturnCode : None
'
' Call this function after thinBasic_Init but before thinBasic_Run
'----------------------------------------------------------------------------
Declare Function thinBasic_AddIncludePath _
Lib "thinCore.dll" _
Alias "thinBasic_AddIncludePath" _
( _
ByVal sNewIncludeDir As String _
) As Long
'----------------------------------------------------------------------------
'thinBasic_LoadSymbol
'----------------------------------------------------------------------------
' Description
' Creates e new keyword inside interpreter.
' You define your own Function or Sub inside your program. Then call
' thinBasic_LoadSymbol to add a new keyword connected to your new function/sub
'
' Parameters
' SymbolName : Name you want to give to your sub or function inside the
' interpreter. It is the new keyword name.
'
' ReturnCode : specify what kind of var your function returns
' Use predefined constants:
' %thinBasic_ReturnNumber
' %thinBasic_ReturnString
' %thinBasic_ReturnNone
' If SymbolName will end with "$" char, ReturnCode will
' be forced to %thinBasic_ReturnString
' Note: if you pass a pointer to a SUB routine and ReturnCode
' is different from %thinBasic_ReturnNone, a GPF will be
' fired by the Operating System.
' Note: if ReturnCode <= 0 then %thinBasic_ReturnNone will be
' assumed
'
' FunctionOrSubPointer:
' DWORD returned by CODEPTR function pointing to the function
' that will be called when SymbolName keyword will be encountered
' during script execution
'
' ForceOverWrite:
' If different from 0 it means that even if SymbolName
' already exists as a keyword, you want to overwrite it with
' a new one.
' For example, if you want to overwrite behave of MID$
' creating your own MID$ function, set this parameter to a value
' > 0 like in this example:
' thinBasic_LoadSymbol("MID$", %thinBasic_ReturnString, CODEPTR(MyMid), 1)
'
' Possible Return Code
' >0 = no error, return the associated SymbolName ID
' -1 = empty SymbolName
' -2 = duplicated SymbolName and no ForceOverWrite flag
' -3 = invalid sub/function pointer
' -4 = SymbolName contains invalid char(s)
'
' Example
' thinBasic_LoadSymbol "MyNewFunction", %thinBasic_ReturnNumber, CODEPTR(MyFunc)
'----------------------------------------------------------------------------
Declare Function thinBasic_LoadSymbol _
Lib "thinCore.DLL" _
Alias "thinBasic_LoadSymbol" _
( _
ByVal SymbolName As String , _
ByVal ReturnCode As Long , _
ByVal FunctionOrSubPointer As Dword , _
Optional _
ByVal ForceOverWrite As Long _
) As Long
'----------------------------------------------------------------------------
'thinBasic_LoadSymbolEX
'----------------------------------------------------------------------------
' Description
' Creates e new keyword inside interpreter.
' You define your own Function or Sub inside your program. Then call
' thinBasic_LoadSymbol to add a new keyword connected to your new function/sub
'
' Parameters
' SymbolName : Name you want to give to your sub or function inside the
' interpreter. It is the new keyword name.
'
' ReturnCode : specify what kind of var your function returns
' Use predefined constants:
' %thinBasic_ReturnNumber
' %thinBasic_ReturnString
' %thinBasic_ReturnNone
' If SymbolName will end with "$" char, ReturnCode will
' be forced to %thinBasic_ReturnString
' Note: if you pass a pointer to a SUB routine and ReturnCode
' is different from %thinBasic_ReturnNone, a GPF will be
' fired by the Operating System.
' Note: if ReturnCode <= 0 then %thinBasic_ReturnNone will be
' assumed
'
' FunctionOrSubPointer:
' DWORD returned by CODEPTR function pointing to the function
' that will be called when SymbolName keyword will be encountered
' during script execution
'
' ForceOverWrite:
' If different from 0 it means that even if SymbolName
' already exists as a keyword, you want to overwrite it with
' a new one.
' For example, if you want to overwrite behave of MID$
' creating your own MID$ function, set this parameter to a value
' > 0 like in this example:
' thinBasic_LoadSymbol("MID$", %thinBasic_ReturnString, CODEPTR(MyMid), 1)
' sSyntax:
' Syntax of the symbol name
' sHelp:
' help about the symbol name
'
' Possible Return Code
' >0 = no error, return the associated SymbolName ID
' -1 = empty SymbolName
' -2 = duplicated SymbolName and no ForceOverWrite flag
' -3 = invalid sub/function pointer
' -4 = SymbolName contains invalid char(s)
'
' Example
' thinBasic_LoadSymbol "MyNewFunction", %thinBasic_ReturnNumber, CODEPTR(MyFunc)
'----------------------------------------------------------------------------
Declare Function thinBasic_LoadSymbolEX _
Lib "thinCore.DLL" _
Alias "thinBasic_LoadSymbolEX" _
( _
ByVal SymbolName As String , _
ByVal ReturnCode As Long , _
ByVal FunctionOrSubPointer As Dword , _
Optional _
ByVal ForceOverWrite As Long , _
ByVal sSyntax As String , _
ByVal sHelp As String _
) As Long
'----------------------------------------------------------------------------
'thinBasic_VariableGetList
'----------------------------------------------------------------------------
' Returns a string with the list of all variables of a specific stack level
' If StackLevel is missing, current stack level will be returned
'----------------------------------------------------------------------------
Declare Function thinBasic_VariableGetList _
LIB "thinCore.DLL" _
Alias "thinBasic_VariableGetList" _
( _
Optional _
ByVal lStackLevel As Long , _
ByVal sSep As String _
) As String
'----------------------------------------------------------------------------
'----------------------------------------------------------------------------
'thinBasic_VariableExists
'----------------------------------------------------------------------------
' Returns true/false depending if the given name is a variable or not
'----------------------------------------------------------------------------
DECLARE FUNCTION thinBasic_VariableExists _
LIB "thinCore.DLL" _
ALIAS "thinBasic_VariableExists" _
( _
BYVAL vName AS STRING _
) AS LONG
'----------------------------------------------------------------------------
'thinBasic_VariableGetValueNum
'----------------------------------------------------------------------------
' Returns numeric value of a numeric variable given variable name and optionally array index
'----------------------------------------------------------------------------
Declare Function thinBasic_VariableGetValueNum _
LIB "thinCore.DLL" _
Alias "thinBasic_VariableGetValueNum" _
( _
ByVal SearchKey As String , _
Optional ByVal lIndex As Long _
) As Ext
'----------------------------------------------------------------------------
'----------------------------------------------------------------------------
'thinBasic_VariableGetInfo
'----------------------------------------------------------------------------
' Returns additional variable info giving variable name.
' ATTENTION: pass variable as reference. Function will populate
' with relevant information
' Function returns a pointer to internal thinBAsic variable structure data
' that can be used in other situations.
'----------------------------------------------------------------------------
DECLARE FUNCTION thinBasic_VariableGetInfo _
LIB "thinCore.DLL" _
ALIAS "thinBasic_VariableGetInfo" _
( _
BYVAL SearchKey AS STRING , _
BYREF MainType AS LONG , _ '---ATTENTION: parameter passed BYREF will return info
BYREF SubType AS LONG , _ '---ATTENTION: parameter passed BYREF will return info
BYREF IsArray AS LONG _ '---ATTENTION: parameter passed BYREF will return info
) AS LONG
Declare Function thinBasic_VariableGetInfoPtr _
Lib "thinCore.DLL" _
Alias "thinBasic_VariableGetInfoPtr" _
( _
ByVal pVariable As Long , _ '---A pointer to Variable
ByRef MainType As Long , _ '---ATTENTION: parameter passed BYREF will return info
ByRef SubType As Long , _ '---ATTENTION: parameter passed BYREF will return info
ByRef IsArray As Long _ '---ATTENTION: parameter passed BYREF will return info
) As Long
'----------------------------------------------------------------------------
'thinBasic_VariableGetInfoEX
'----------------------------------------------------------------------------
' Returns additional variable info giving variable name.
' ATTENTION: pass variable as reference. Function will populate
' with relevant information
' Function returns a pointer to internal thinBAsic variable structure data
' that can be used in other situations.
'----------------------------------------------------------------------------
declare function thinBasic_VariableGetInfoEX _
lib "thinCore.DLL" _
alias "thinBasic_VariableGetInfoEX" _
( _
ByVal SearchKey As String , _
byref MainType as long , _ '---ATTENTION: parameter passed BYREF will return info
byref SubType as long , _ '---ATTENTION: parameter passed BYREF will return info
byref IsArray as long , _ '---ATTENTION: parameter passed BYREF will return info
byref DataPtr as long , _ '---ATTENTION: parameter passed BYREF will return info
ByRef nElements As Long , _ '---ATTENTION: parameter passed BYREF will return info
Optional _
ByVal WhichLevel As Long _
) As Long
' '---Equates for variable Sub Type
' %SubType_Byte = 1?
' %SubType_Integer = 2?
' %SubType_Boolean = 2?
' %SubType_Word = 3?
' %SubType_DWord = 4?
' %SubType_Long = 5?
' %SubType_Quad = 6?
' %SubType_Single = 7?
' %SubType_Double = 8?
' %SubType_Currency = 9?
' %SubType_Ext = 10?
'
' %MainType_IsNumber = 15?
'
' %SubType_AsciiZ = 16?
' %SubType_String = 17?
'
' %MainType_GUID = 20? : %MainType_IsGUID = %MainType_GUID
' %MainType_String = %SubType_String : %MainType_IsString = %MainType_String
'
' %MainType_Variant = 23? : %MainType_IsVariant = %MainType_Variant
' %MainType_UDT = 24? : %MainType_IsUDT = %MainType_UDT
' %MainType_PTR = 25? : %MainType_IsPTR = %MainType_PTR
' %MainType_Object = 26? : %MainType_IsObject = %MainType_Object
' %MainType_Class = 27? : %MainType_IsClass = %MainType_Class
'---Equates for variable Sub Type
%SubType_Byte = 1?
%SubType_Integer = 2?
%SubType_Boolean = 2?
%SubType_Word = 3?
%SubType_DWord = 4?
%SubType_Long = 5?
%SubType_Quad = 6?
%SubType_Single = 7?
%SubType_Double = 8?
%SubType_Currency = 9?
%SubType_Ext = 10?
%MainType_IsNumber = 20?
%SubType_AsciiZ = 25?
%SubType_String = 30?
%MainType_GUID = 40? : %MainType_IsGUID = %MainType_GUID
%MainType_String = %SubType_String : %MainType_IsString = %MainType_String
%MainType_Variant = 50? : %MainType_IsVariant = %MainType_Variant
%MainType_UDT = 60? : %MainType_IsUDT = %MainType_UDT
%MainType_PTR = 70? : %MainType_IsPTR = %MainType_PTR
%MainType_Object = 80? : %MainType_IsObject = %MainType_Object
%MainType_Class = 90? : %MainType_IsClass = %MainType_Class
%MainType_Function = 95? : %MainType_IsFunction= %MainType_Function
%MainType_Dispatch = 100? : %MainType_IsDispatch= %MainType_Dispatch
'----------------------------------------------------------------------------
'thinBasic_VariableIsArray
'----------------------------------------------------------------------------
' Returns true/false depending if given name is an array
'----------------------------------------------------------------------------
DECLARE FUNCTION thinBasic_VariableIsArray _
LIB "thinCore.DLL" _
ALIAS "thinBasic_VariableIsArray" _
( _
BYVAL vName AS STRING _
) AS LONG
'----------------------------------------------------------------------------
'thinBasic_VariableRedim
'----------------------------------------------------------------------------
' Redim a variable giving variable ptr
'----------------------------------------------------------------------------
DECLARE FUNCTION thinBasic_VariableRedim _
LIB "thinCore.DLL" _
ALIAS "thinBasic_VariableRedim" _
( _
BYVAL pVar AS LONG, _
BYVAL lPreserve AS LONG, _
BYVAL VarDim1 AS LONG, _
ByVal VarDim2 As Long, _
BYVAL VarDim3 AS LONG _
) AS LONG
'----------------------------------------------------------------------------
'thinBasic_ArrayGetElements
'----------------------------------------------------------------------------
' Returns total number of elements inside an array giving the array name
' ATTENTION: this function works on single or multi dimensions arrays
'----------------------------------------------------------------------------
DECLARE FUNCTION thinBasic_ArrayGetElements _
LIB "thinCore.DLL" _
ALIAS "thinBasic_ArrayGetElements" _
( _
BYVAL vName AS STRING _
) AS LONG
'----------------------------------------------------------------------------
'thinBasic_ArrayGetPtr
'----------------------------------------------------------------------------
' Returns the data structure pointer of an array giving its name
'----------------------------------------------------------------------------
DECLARE FUNCTION thinBasic_ArrayGetPtr _
LIB "thinCore.DLL" _
ALIAS "thinBasic_ArrayGetPtr" _
( _
BYVAL vName AS STRING _
) AS LONG
'----------------------------------------------------------------------------
'thinBasic_ArrayGetInfo
'----------------------------------------------------------------------------
' Returns information on an array passing array pointer returned by thinBasic_ArrayGetPtr
'----------------------------------------------------------------------------
DECLARE FUNCTION thinBasic_ArrayGetInfo _
LIB "thinCore.DLL" _
ALIAS "thinBasic_ArrayGetInfo" _
( _
BYVAL ArrayPtr AS LONG, _
BYVAL InfoType AS LONG _
) AS LONG
'---Equates for InfoType
%Array_ElementsCount = 1& 'Total number of elements in the array
%Array_ElementSize = 2& 'The size of the single element (for example an array of LONGs will return 4)
%Array_Dimensions = 3& 'Number of dimensions (from 1 to 3)
%Array_Size = 4& 'Memory size allocated for the array. This will not compute the memory needed for strings
%Array_ElementsType = 10& 'Type of elements strored into the array. See equates for thinBasic_VariableGetInfo
%Array_ElementsAreFixed = 15& '%TRUE if elements are fixed size, like fixed strings or UDT
%Array_PtrToData = 30& 'Pointer to memory area holding data
%Array_UBoundDim_1 = 91& 'Returns the Upper Bound of dimension 1
%Array_UBoundDim_2 = 92& 'Returns the Upper Bound of dimension 2
%Array_UBoundDim_3 = 93& 'Returns the Upper Bound of dimension 3
'----------------------------------------------------------------------------
'thinBasic_AddEquate
'----------------------------------------------------------------------------
' Add a new equate (constant)
'----------------------------------------------------------------------------
DECLARE FUNCTION thinBasic_AddEquate _
LIB "thinCore.DLL" _
ALIAS "thinBasic_AddEquate" _
( _
BYVAL vName AS STRING, _
BYVAL lValString AS STRING, _
BYVAL lValNumber AS EXT , _
OPTIONAL _
BYVAL ForceType AS LONG _
) As Long
'---Used for thinBasic_AddEquate to force an equate type in case of missing first char $ or %
%EquateTypeNumber = 3
%EquateTypeString = 5
'----------------------------------------------------------------------------
'thinBasic_AddVariable
'----------------------------------------------------------------------------
' Add a new variable to current stack level
'----------------------------------------------------------------------------
DECLARE FUNCTION thinBasic_AddVariable _
LIB "thinCore.DLL" _
ALIAS "thinBasic_AddVariable" _
( _
BYVAL vName AS STRING, _
BYVAL lValString AS STRING, _
BYVAL lValNumber AS EXT , _
BYVAL ForceType AS LONG , _
Optional ByVal VarMemPtr As Long , _
ByVal Reserved1 As Long , _
ByVal Reserved2 As Long , _
ByVal Reserved3 As Long , _
ByVal Reserved4 As Long _
) As Long
'----------------------------------------------------------------------------
'thinBasic_AddUdt
'----------------------------------------------------------------------------
' Add a new UDT structure
'----------------------------------------------------------------------------
Declare Function thinBasic_AddUdt _
LIB "thinCore.DLL" _
Alias "thinBasic_AddUdt" _
( _
ByVal sUDT_Code As String _
) As Long
'----------------------------------------------------------------------------
'thinBasic_DeclareFunction
'----------------------------------------------------------------------------
' Add a new function using DECLARE statement and function pointer
'----------------------------------------------------------------------------
Declare Function thinBasic_DeclareFunction _
Lib "thinCore.DLL" _
Alias "thinBasic_DeclareFunction" _
( _
ByVal sDeclare As String , _
ByVal pFun As Dword _
) As Long
'----------------------------------------------------------------------------
'thinBasic_ChangeVariableNumber
'----------------------------------------------------------------------------
' Change the value of a numeric variable giving its name a the new value
'----------------------------------------------------------------------------
DECLARE FUNCTION thinBasic_ChangeVariableNumber _
LIB "thinCore.DLL" _
ALIAS "thinBasic_ChangeVariableNumber" _
( _
BYVAL vName AS STRING, _
BYVAL lValNumber AS EXT _
) AS LONG
'----------------------------------------------------------------------------
'thinBasic_ChangeVariableString
'----------------------------------------------------------------------------
' Change the value of a string variable giving its name a the new value
'----------------------------------------------------------------------------
DECLARE FUNCTION thinBasic_ChangeVariableString _
LIB "thinCore.DLL" _
ALIAS "thinBasic_ChangeVariableString" _
( _
BYVAL vName AS STRING, _
BYVAL lValNumber AS STRING _
) AS LONG
'----------------------------------------------------------------------------
'thinBasic_GetToken
'----------------------------------------------------------------------------
' Returns the next token as token ID.
'----------------------------------------------------------------------------
DECLARE FUNCTION thinBasic_GetToken _
LIB "thinCore.DLL" _
ALIAS "thinBasic_GetToken" _
( _
OPTIONAL BYVAL AutoPutBack AS LONG _
) AS LONG
'----------------------------------------------------------------------------
'thinBasic_GetToken
'----------------------------------------------------------------------------
' Returns the next token as string.
'----------------------------------------------------------------------------
DECLARE FUNCTION thinBasic_GetTokenName _
LIB "thinCore.DLL" _
ALIAS "thinBasic_GetTokenName" _
( _
OPTIONAL BYVAL AutoPutBack AS LONG _
) AS STRING
'----------------------------------------------------------------------------
'thinBasic_GetTokenID
'----------------------------------------------------------------------------
' Return internal engine unique ID giving the token name
'----------------------------------------------------------------------------
DECLARE FUNCTION thinBasic_GetTokenID _
LIB "thinCore.DLL" _
ALIAS "thinBasic_GetTokenID" _
( _
BYVAL TokenName AS String _
) AS LONG
'----------------------------------------------------------------------------
'thinBasic_TokenGetCurrentID
'----------------------------------------------------------------------------
' Return current token ID
'----------------------------------------------------------------------------
DECLARE FUNCTION thinBasic_TokenGetCurrentID _
LIB "thinCore.DLL" _
ALIAS "thinBasic_TokenGetCurrentID" _
() AS LONG
'----------------------------------------------------------------------------
'thinBasic_PutBack
'----------------------------------------------------------------------------
' Put back into parsing stack the last parsed token
'----------------------------------------------------------------------------
DECLARE FUNCTION thinBasic_Putback _
LIB "thinCore.DLL" _
ALIAS "thinBasic_PutBack" _
( _
OPTIONAL BYVAL lPtr AS LONG _
) AS LONG
'----------------------------------------------------------------------------
'thinBasic_FunctionExists
'----------------------------------------------------------------------------
'----------------------------------------------------------------------------
DECLARE FUNCTION thinBasic_FunctionExists _
LIB "thinCore.DLL" _
ALIAS "thinBasic_FunctionExists" _
( _
BYVAL fName AS STRING _
) AS LONG
'----------------------------------------------------------------------------
'thinBasic_FunctionGetPtr
'----------------------------------------------------------------------------
'----------------------------------------------------------------------------
Declare Function thinBasic_FunctionGetPtr _
Lib "thinCore.DLL" _
Alias "thinBasic_FunctionGetPtr" _
( _
ByVal fName As String _
) As Long
'------------------------------------------------------------------------------
'---Search function using _ or . as separator between a pre/post function name
' Useful to search for names like MyFun.MyEvent or MyFun_MyEvent
'------------------------------------------------------------------------------
Declare Function thinBasic_FunctionGetPtr_DottedOrUnderscored _
Lib "thinCore.DLL" _
Alias "thinBasic_FunctionGetPtr_DottedOrUnderscored" _
( _
ByVal sFunctionPre As String , _
ByVal sFunctionPost As String _
) As Long
'------------------------------------------------------------------------------
'----------------------------------------------------------------------------
'thinBasic_FunctionGetPtr
'----------------------------------------------------------------------------
'----------------------------------------------------------------------------
Declare Function thinBasic_FunctionGetName _
Lib "thinCore.DLL" _
Alias "thinBasic_FunctionGetName" _
( _
ByVal FunctionPtr As Long _ '---PTR to function returned by (for example) thinBasic_FunctionGetPtr
) As String
'----------------------------------------------------------------------------
'thinBasic_FunctionIsCallBack
'----------------------------------------------------------------------------
' Determine if fucntion passed as PTR has been defined as CALLBACK function in script
'----------------------------------------------------------------------------
Declare Function thinBasic_FunctionIsCallBack _
Lib "thinCore.DLL" _
Alias "thinBasic_FunctionIsCallBack" _
( _
ByVal FunctionPtr As Long _ '---PTR to function returned by thinBasic_FunctionGetPtr
) As Long
'----------------------------------------------------------------------------
'thinBasic_FunctionGetCBParam
'----------------------------------------------------------------------------
' Returns the value of a designated CallBack pseudo variable.
' ATTENTION: interface function valid only whileinside a callback function
'----------------------------------------------------------------------------
' Parameters:
' CBParamType: one of the following equates
'---Equates for CBParamType
%CBParam_CBHNDL = 100&
%CBParam_CBMSG = 110&
%CBParam_CBCTL = 120&
%CBParam_CBCTLMSG = 130&
%CBParam_CBLPARAM = 140&
%CBParam_CBWPARAM = 150&
%CBParam_CBNMCODE = 160&
%CBParam_CBNMHDR = 170&
%CBParam_CBNMHWND = 180&
%CBParam_CBNMID = 190&
' lError: a pointer to a long variable that will receive possible error variables
' Possible errors:
' -10: not inside at any function
' -20: inside a function but not a callback function
' -30: unsupported/invalid CBParamType
'----------------------------------------------------------------------------
Declare Function thinBasic_FunctionGetCBParam _
Lib "thinCore.DLL" _
Alias "thinBasic_FunctionGetCBParam" _
( _
ByVal CBParamType As Long , _
Optional ByVal lError As Long Ptr _
) As Long
'----------------------------------------------------------------------------
'thinBasic_FunctionGetNumberOfParams
'----------------------------------------------------------------------------
' Returns the number of parameters defined in a script function
'----------------------------------------------------------------------------
Declare Function thinBasic_FunctionGetNumberOfParams _
Lib "thinCore.DLL" _
Alias "thinBasic_FunctionGetNumberOfParams" _
( _
ByVal FunctionPtr As Long _ '---PTR to function returned by thinBasic_FunctionGetPtr
) As Long
'----------------------------------------------------------------------------
'thinBasic_FunctionGetReturnMainType
'----------------------------------------------------------------------------
' Gets the main data type returned by a script function. See %VarMainType* equates above
'----------------------------------------------------------------------------
Declare Function thinBasic_FunctionGetReturnMainType _
Lib "thinCore.DLL" _
Alias "thinBasic_FunctionGetReturnMainType" _
( _
ByVal FunctionPtr As Long _ '---PTR to function returned by thinBasic_FunctionGetPtr
) As Long
'----------------------------------------------------------------------------
'thinBasic_FunctionParseAndGetPtr
'----------------------------------------------------------------------------
' Parse the next token (or string expression). Check if it is a function name
' If yes, returns a PTR to internal data function
'----------------------------------------------------------------------------
Declare Function thinBasic_FunctionParseAndGetPtr _
Lib "thinCore.DLL" _
Alias "thinBasic_FunctionParseAndGetPtr" _
( _
Optional ByVal CheckIfCallBack As Long _
) As Long
'----------------------------------------------------------------------------
'thinBasic_FunctionSimpleCall
'----------------------------------------------------------------------------
' Call a script function and optionally returns it value (numeric or string)
'----------------------------------------------------------------------------
Declare Function thinBasic_FunctionSimpleCall _
Lib "thinCore.DLL" _
Alias "thinBasic_FunctionSimpleCall" _
( _
ByVal FunctionName As String, _ '---Name of the function
Optional _
ByVal ptrEXT As Ext Ptr, _ '---Used to get back from the called function a numeric value
ByVal ptrSTR As String Ptr _ '---Used to get back from the called function a string value
) As Long
'----------------------------------------------------------------------------
'thinBasic_FunctionSimpleCall_ByPtr
'----------------------------------------------------------------------------
' Call a script function and optionally returns it value (numeric or string)
' This function permits to call script callback functions passing automatic
' pseudo callbacks variables
' USE only when in need of a callback function from module
'----------------------------------------------------------------------------
Declare Function thinBasic_FunctionSimpleCall_ByPtr _
Lib "thinCore.DLL" _
Alias "thinBasic_FunctionSimpleCall_ByPtr" _
( _
ByVal FunctionPtr As Long , _ '---PTR to function returned by thinBasic_FunctionGetPtr or other way
Optional _
ByVal ptrEXT As Ext Ptr , _ '---Used to get back from the called function a numeric value
ByVal ptrSTR As String Ptr , _ '---Used to get back from the called function a string value
ByVal IsCallBack As Long , _
ByVal lCBHNDL As Long , _
ByVal lCBMSG As Long , _
ByVal lCBCTL As Long , _
ByVal lCBCTLMSG As Long , _
ByVal lCBLPARAM As Long , _
ByVal lCBWPARAM As Long , _
ByVal lCBNMCODE As Long , _
ByVal lCBNMHDR As Long , _
ByVal lCBNMHWND As Long , _
ByVal lCBNMID As Long _
) As Long
'----------------------------------------------------------------------------
'thinBasic_FunctionCall_ByPtr
'----------------------------------------------------------------------------
' Call a script function and optionally returns it value (numeric or string)
' This function permits to call script functions passing parameters
' Parameters are passed using a shared memory area made by a sequence of DOUBLEs
' (8 bytes) one for each parameter to be passed.
' The paramaters memory area will be interpreted by thinBasic core engine
' depending by parameters declaration made in script.
'
' So far the following type of parameters are supported:
' - numeric parameters passed BYVAL up to DOUBLE range
'
' Example: if programmer wants to pass 2 parameters, set lModParams = 2 and setup
' a 16 bytes memory area (2 params * 8 bytes each) where to store the 2 parameter
' values.
'----------------------------------------------------------------------------
Declare Function thinBasic_FunctionCall_ByPtr _
Lib "thinCore.DLL" _
Alias "thinBasic_FunctionCall_ByPtr" _
( _
ByVal FunctionPtr As Long , _ '---PTR to script function
ByVal lModParams As Long , _ '---MANDATORY: number of params module is passing
ByVal lModParamsPtr As Long , _ '---MANDATORY: pointer to a memory area where to find parameters (10 bytes for each parameter)
Optional _ '---If no need to get back script function result value, do not indicate the next 2 parameters
ByVal ptrDOUBLE As Double Ptr , _ '---Pointer to DOUBLE that will get back script function return value in case of numeric
ByVal ptrSTR As String Ptr _ '---Pointer to a OLE32 dynamic string handle that will get back script function return value in case of string
) As Long
'----------------------------------------------------------------------------
'thinBasic_GetKeywordSpeficic
'----------------------------------------------------------------------------
' Instruct parser to get next token, test if it a keyword and if yes,
' check if it is one of the possible keywords passed. If not, a RT-Error
' will be generated
'----------------------------------------------------------------------------
DECLARE FUNCTION thinBasic_GetKeywordSpeficic _
LIB "thinCore.DLL" _
ALIAS "thinBasic_GetKeywordSpeficic" _
( _
BYVAL HideError AS LONG , _
BYVAL AutoPutBack AS LONG , _
BYVAL lKey1 AS LONG , _
OPTIONAL BYVAL lKey2 AS LONG , _
BYVAL lKey3 AS LONG , _
BYVAL lKey4 AS LONG , _
BYVAL lKey5 AS LONG , _
BYVAL lKey6 AS LONG , _
BYVAL lKey7 AS LONG , _
BYVAL lKey8 AS LONG , _
BYVAL lKey9 AS LONG , _
BYVAL lKey10 AS LONG , _
BYVAL lKey11 AS LONG , _
BYVAL lKey12 AS LONG , _
BYVAL lKey13 AS LONG , _
BYVAL lKey14 AS LONG , _
BYVAL lKey15 AS LONG , _
BYVAL lKey16 AS LONG , _
BYVAL lKey17 AS LONG , _
BYVAL lKey18 AS LONG , _
BYVAL lKey19 AS LONG , _
ByVal lKey20 As Long , _
ByVal lKey21 As Long , _
ByVal lKey22 As Long , _
ByVal lKey23 As Long , _
ByVal lKey24 As Long , _
ByVal lKey25 As Long _
) As Long
'----------------------------------------------------------------------------
'thinBasic_GetKeywordSpeficic_Single
'----------------------------------------------------------------------------
' Instruct parser to get next token, test if it a keyword and if yes,
' check if it is the one requested keyword. If not, a RT-Error
' will be generated
'----------------------------------------------------------------------------
Declare Function thinBasic_GetKeywordSpeficic_Single _
Lib "thinCore.DLL" _
Alias "thinBasic_GetKeywordSpeficic_Single" _
( _
ByVal HideError As Long , _
ByVal AutoPutBack As Long , _
ByVal lKey1 As Long _
) As Long
'----------------------------------------------------------------------------
'thinBasic_VariableParse
'----------------------------------------------------------------------------
' Instruct parser to get next token, check if variable, check if array and
' return info needed to subsequent change variable value
'----------------------------------------------------------------------------
DECLARE FUNCTION thinBasic_VariableParse _
LIB "thinCore.DLL" _
ALIAS "thinBasic_VariableParse" _
( _
BYREF VariablePtr AS LONG , _ '---ATTENTION: parameter passed BYREF will return info
BYREF VariableAbsPos AS LONG _ '---ATTENTION: parameter passed BYREF will return info
) AS LONG
'----------------------------------------------------------------------------
'thinBasic_VariableParsePtr
'----------------------------------------------------------------------------
' Instruct parser to get next token, check if variable
' return its pointer
'----------------------------------------------------------------------------
DECLARE FUNCTION thinBasic_VariableParsePtr _
LIB "thinCore.DLL" _
ALIAS "thinBasic_VariableParsePtr" _
( _
BYREF VariablePtr AS LONG _ '---ATTENTION: parameter passed BYREF will return info
) AS LONG
'----------------------------------------------------------------------------
'thinBasic_ParsePtrToSomething