Skip to content

Commit 1698e46

Browse files
committed
Tweak dumping
1 parent bd473a9 commit 1698e46

File tree

5 files changed

+132
-242
lines changed

5 files changed

+132
-242
lines changed

Source/ide/simba.ide_theme.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function TSimbaTheme.GetScrollBarArrowSize: Integer;
6363

6464
function TSimbaTheme.GetScrollBarSize: Integer;
6565
begin
66-
Result := MulDiv(ATScrollbarTheme.InitialSize + 4, Screen.PixelsPerInch, 96);
66+
Result := MulDiv(ATScrollbarTheme.InitialSize, Screen.PixelsPerInch, 96);
6767
end;
6868

6969
procedure TSimbaTheme.SetScrollBarArrowSize(Value: Integer);

Source/script/imports/simba.import_base.pas

Lines changed: 0 additions & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -381,156 +381,7 @@ function DumpCallStack(Start: Integer = 0): String;
381381
```
382382
*)
383383

384-
(*
385-
Variant.VarType
386-
---------------
387-
```
388-
function Variant.VarType: EVariantVarType;
389-
```
390-
391-
Returns the variants var type.
392-
393-
Example:
394-
395-
```
396-
if (v.VarType = EVariantVarType.Int32) then
397-
WriteLn('Variant contains a Int32');
398-
```
399-
*)
400-
procedure _LapeVariantVarType(const Params: PParamArray; const Result: Pointer); LAPE_WRAPPER_CALLING_CONV
401-
begin
402-
PVariantType(Result)^ := PVariant(Params^[0])^.VarType;
403-
end;
404-
405-
(*
406-
Variant.IsNumeric
407-
-----------------
408-
```
409-
function Variant.IsNumeric: Boolean;
410-
```
411-
412-
Is integer or float?
413-
*)
414-
procedure _LapeVariantIsNumeric(const Params: PParamArray; const Result: Pointer); LAPE_WRAPPER_CALLING_CONV
415-
begin
416-
PBoolean(Result)^ := VarIsNumeric(PVariant(Params^[0])^);
417-
end;
418-
419-
(*
420-
Variant.IsString
421-
----------------
422-
```
423-
function Variant.IsString: Boolean;
424-
```
425-
*)
426-
procedure _LapeVariantIsString(const Params: PParamArray; const Result: Pointer); LAPE_WRAPPER_CALLING_CONV
427-
begin
428-
PBoolean(Result)^ := VarIsStr(PVariant(Params^[0])^);
429-
end;
430-
431-
(*
432-
Variant.IsInteger
433-
-----------------
434-
```
435-
function Variant.IsInteger: Boolean;
436-
```
437-
*)
438-
procedure _LapeVariantIsInteger(const Params: PParamArray; const Result: Pointer); LAPE_WRAPPER_CALLING_CONV
439-
begin
440-
PBoolean(Result)^ := VarIsOrdinal(PVariant(Params^[0])^);
441-
end;
442-
443-
(*
444-
Variant.IsFloat
445-
---------------
446-
```
447-
function Variant.IsFloat: Boolean;
448-
```
449-
*)
450-
procedure _LapeVariantIsFloat(const Params: PParamArray; const Result: Pointer); LAPE_WRAPPER_CALLING_CONV
451-
begin
452-
PBoolean(Result)^ := VarIsFloat(PVariant(Params^[0])^);
453-
end;
454-
455-
(*
456-
Variant.IsBoolean
457-
-----------------
458-
```
459-
function Variant.IsBoolean: Boolean;
460-
```
461-
*)
462-
procedure _LapeVariantIsBoolean(const Params: PParamArray; const Result: Pointer); LAPE_WRAPPER_CALLING_CONV
463-
begin
464-
PBoolean(Result)^ := VarIsBool(PVariant(Params^[0])^);
465-
end;
466384

467-
(*
468-
Variant.IsVariant
469-
-----------------
470-
```
471-
function Variant.IsVariant: Boolean;
472-
```
473-
474-
The variant holds another variant!
475-
*)
476-
procedure _LapeVariantIsVariant(const Params: PParamArray; const Result: Pointer); LAPE_WRAPPER_CALLING_CONV
477-
begin
478-
PBoolean(Result)^ := VarIsType(PVariant(Params^[0])^, varVariant);
479-
end;
480-
481-
(*
482-
Variant.IsAssigned
483-
------------------
484-
```
485-
function Variant.IsAssigned: Boolean;
486-
```
487-
488-
Example:
489-
490-
```
491-
if v.IsAssigned() then
492-
WriteLn('Variant HAS been assigned to')
493-
else
494-
WriteLn('The variant has NOT been assigned to');
495-
```
496-
*)
497-
procedure _LapeVariantIsAssigned(const Params: PParamArray; const Result: Pointer); LAPE_WRAPPER_CALLING_CONV
498-
begin
499-
PBoolean(Result)^ := not VarIsClear(PVariant(Params^[0])^);
500-
end;
501-
502-
(*
503-
Variant.IsNull
504-
--------------
505-
```
506-
function Variant.IsNull: Boolean;
507-
```
508-
*)
509-
procedure _LapeVariantIsNull(const Params: PParamArray; const Result: Pointer); LAPE_WRAPPER_CALLING_CONV
510-
begin
511-
PBoolean(Result)^ := VarIsNull(PVariant(Params^[0])^);
512-
end;
513-
514-
(*
515-
Variant.NULL
516-
------------
517-
```
518-
function Variant.NULL: Variant; static;
519-
```
520-
521-
Static method that returns a null variant variable.
522-
523-
Example:
524-
525-
```
526-
v := Variant.NULL;
527-
WriteLn(v.IsNull());
528-
```
529-
*)
530-
procedure _LapeVariantNULL(const Params: PParamArray; const Result: Pointer); LAPE_WRAPPER_CALLING_CONV
531-
begin
532-
PVariant(Result)^ := Null;
533-
end;
534385

535386
procedure _LapeInt32_IN_Int32Array(const Params: PParamArray; const Result: Pointer); LAPE_WRAPPER_CALLING_CONV
536387
type Int32Array = array of Int32;
@@ -834,7 +685,6 @@ procedure ImportBase(Script: TSimbaScript);
834685
addGlobalType('array of TIntegerArray', 'T2DIntegerArray');
835686
addGlobalType('array of Int64', 'TInt64Array');
836687
addGlobalType('array of Byte', 'TByteArray');
837-
addGlobalType('array of Variant', 'TVariantArray');
838688
addGlobalType('array of Pointer', 'TPointerArray');
839689

840690
addGlobalType('record X, Y: Integer; end', 'TPoint');
@@ -860,18 +710,6 @@ procedure ImportBase(Script: TSimbaScript);
860710

861711
addGlobalType('(__LT__, __GT__, __EQ__, __LE__, __GE__, __NE__)', 'EComparator');
862712

863-
addGlobalType('enum(Unknown, Unassigned, Null, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Single, Double, DateTime, Currency, Boolean, Variant, AString, UString, WString)', 'EVariantVarType');
864-
addGlobalFunc('function Variant.VarType: EVariantVarType;', @_LapeVariantVarType);
865-
addGlobalFunc('function Variant.IsNumeric: Boolean;', @_LapeVariantIsNumeric);
866-
addGlobalFunc('function Variant.IsInteger: Boolean;', @_LapeVariantIsInteger);
867-
addGlobalFunc('function Variant.IsFloat: Boolean;', @_LapeVariantIsFloat);
868-
addGlobalFunc('function Variant.IsString: Boolean;', @_LapeVariantIsString);
869-
addGlobalFunc('function Variant.IsBoolean: Boolean;', @_LapeVariantIsBoolean);
870-
addGlobalFunc('function Variant.IsVariant: Boolean;', @_LapeVariantIsVariant);
871-
addGlobalFunc('function Variant.IsAssigned: Boolean;', @_LapeVariantIsAssigned);
872-
addGlobalFunc('function Variant.IsNull: Boolean;', @_LapeVariantIsNull);
873-
addGlobalFunc('function Variant.NULL: Variant; static;', @_LapeVariantNULL);
874-
875713
addGlobalFunc('operator in(Left: Int32; Right: array of Int32): Boolean', @_LapeInt32_IN_Int32Array);
876714
addGlobalFunc('operator in(Left: Int32; Right: array of Int64): Boolean', @_LapeInt32_IN_Int64Array);
877715
addGlobalFunc('operator in(Left: Int64; Right: array of Int32): Boolean', @_LapeInt64_IN_Int32Array);

Source/script/imports/simba.import_variant.pas

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface
1313

1414
uses
1515
Classes, SysUtils,
16-
simba.base, simba.script_compiler;
16+
simba.base, simba.script;
1717

1818
procedure ImportVariant(Script: TSimbaScript);
1919

@@ -65,14 +65,18 @@ InternalVariantData = record
6565
(*
6666
Variant.VarType
6767
---------------
68-
> function Variant.VarType: EVariantVarType;
68+
```
69+
function Variant.VarType: EVariantVarType;
70+
```
6971
7072
Returns the variants var type.
7173
72-
Example::
74+
Example:
7375
76+
```
7477
if (v.VarType = EVariantVarType.Int32) then
7578
WriteLn('Variant contains a Int32');
79+
```
7680
*)
7781
procedure _LapeVariantVarType(const Params: PParamArray; const Result: Pointer); LAPE_WRAPPER_CALLING_CONV
7882
begin
@@ -82,9 +86,11 @@ procedure _LapeVariantVarType(const Params: PParamArray; const Result: Pointer);
8286
(*
8387
Variant.IsNumeric
8488
-----------------
85-
> function Variant.IsNumeric: Boolean;
89+
```
90+
function Variant.IsNumeric: Boolean;
91+
```
8692
87-
Is integer or float?
93+
Is Integer or Float?
8894
*)
8995
procedure _LapeVariantIsNumeric(const Params: PParamArray; const Result: Pointer); LAPE_WRAPPER_CALLING_CONV
9096
begin
@@ -94,7 +100,9 @@ procedure _LapeVariantIsNumeric(const Params: PParamArray; const Result: Pointer
94100
(*
95101
Variant.IsString
96102
----------------
97-
> function Variant.IsString: Boolean;
103+
```
104+
function Variant.IsString: Boolean;
105+
```
98106
*)
99107
procedure _LapeVariantIsString(const Params: PParamArray; const Result: Pointer); LAPE_WRAPPER_CALLING_CONV
100108
begin
@@ -104,7 +112,9 @@ procedure _LapeVariantIsString(const Params: PParamArray; const Result: Pointer)
104112
(*
105113
Variant.IsInteger
106114
-----------------
107-
> function Variant.IsInteger: Boolean;
115+
```
116+
function Variant.IsInteger: Boolean;
117+
```
108118
*)
109119
procedure _LapeVariantIsInteger(const Params: PParamArray; const Result: Pointer); LAPE_WRAPPER_CALLING_CONV
110120
begin
@@ -114,7 +124,9 @@ procedure _LapeVariantIsInteger(const Params: PParamArray; const Result: Pointer
114124
(*
115125
Variant.IsFloat
116126
---------------
117-
> function Variant.IsFloat: Boolean;
127+
```
128+
function Variant.IsFloat: Boolean;
129+
```
118130
*)
119131
procedure _LapeVariantIsFloat(const Params: PParamArray; const Result: Pointer); LAPE_WRAPPER_CALLING_CONV
120132
begin
@@ -124,7 +136,9 @@ procedure _LapeVariantIsFloat(const Params: PParamArray; const Result: Pointer);
124136
(*
125137
Variant.IsBoolean
126138
-----------------
127-
> function Variant.IsBoolean: Boolean;
139+
```
140+
function Variant.IsBoolean: Boolean;
141+
```
128142
*)
129143
procedure _LapeVariantIsBoolean(const Params: PParamArray; const Result: Pointer); LAPE_WRAPPER_CALLING_CONV
130144
begin
@@ -134,7 +148,9 @@ procedure _LapeVariantIsBoolean(const Params: PParamArray; const Result: Pointer
134148
(*
135149
Variant.IsVariant
136150
-----------------
137-
> function Variant.IsVariant: Boolean;
151+
```
152+
function Variant.IsVariant: Boolean;
153+
```
138154
139155
The variant holds another variant!
140156
*)
@@ -146,7 +162,9 @@ procedure _LapeVariantIsVariant(const Params: PParamArray; const Result: Pointer
146162
(*
147163
Variant.IsAssigned
148164
------------------
149-
> function Variant.IsAssigned: Boolean;
165+
```
166+
function Variant.IsAssigned: Boolean;
167+
```
150168
151169
Example:
152170
@@ -165,7 +183,9 @@ procedure _LapeVariantIsAssigned(const Params: PParamArray; const Result: Pointe
165183
(*
166184
Variant.IsNull
167185
--------------
168-
> function Variant.IsNull: Boolean;
186+
```
187+
function Variant.IsNull: Boolean;
188+
```
169189
*)
170190
procedure _LapeVariantIsNull(const Params: PParamArray; const Result: Pointer); LAPE_WRAPPER_CALLING_CONV
171191
begin
@@ -175,14 +195,17 @@ procedure _LapeVariantIsNull(const Params: PParamArray; const Result: Pointer);
175195
(*
176196
Variant.NULL
177197
------------
178-
> function Variant.NULL: Variant; static;
198+
```
199+
function Variant.NULL: Variant; static;
200+
```
179201
180202
Static method that returns a null variant variable.
181203
182204
Example:
183205
184206
```
185-
v := Variant.NULL;
207+
v := Variant.NULL;
208+
WriteLn(v.IsNull());
186209
```
187210
*)
188211
procedure _LapeVariantNULL(const Params: PParamArray; const Result: Pointer); LAPE_WRAPPER_CALLING_CONV
@@ -196,10 +219,9 @@ procedure ImportVariant(Script: TSimbaScript);
196219
begin
197220
DumpSection := 'Variant';
198221

222+
addGlobalType('array of Variant', 'TVariantArray');
199223
addGlobalType('enum(Unknown, Unassigned, Null, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Single, Double, DateTime, Currency, Boolean, Variant, AString, UString, WString)', 'EVariantVarType');
200-
201224
addGlobalFunc('function Variant.VarType: EVariantVarType;', @_LapeVariantVarType);
202-
203225
addGlobalFunc('function Variant.IsNumeric: Boolean;', @_LapeVariantIsNumeric);
204226
addGlobalFunc('function Variant.IsInteger: Boolean;', @_LapeVariantIsInteger);
205227
addGlobalFunc('function Variant.IsFloat: Boolean;', @_LapeVariantIsFloat);
@@ -208,7 +230,6 @@ procedure ImportVariant(Script: TSimbaScript);
208230
addGlobalFunc('function Variant.IsVariant: Boolean;', @_LapeVariantIsVariant);
209231
addGlobalFunc('function Variant.IsAssigned: Boolean;', @_LapeVariantIsAssigned);
210232
addGlobalFunc('function Variant.IsNull: Boolean;', @_LapeVariantIsNull);
211-
212233
addGlobalFunc('function Variant.NULL: Variant; static;', @_LapeVariantNULL);
213234

214235
DumpSection := '';

0 commit comments

Comments
 (0)