Skip to content

Commit

Permalink
Clean up importing and dumping
Browse files Browse the repository at this point in the history
  • Loading branch information
ollydev committed Nov 20, 2024
1 parent 52d187a commit cb29146
Show file tree
Hide file tree
Showing 49 changed files with 853 additions and 1,134 deletions.
11 changes: 8 additions & 3 deletions Source/Simba.lpr
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
simba.form_functionlist, simba.form_output, simba.form_colorpickhistory, simba.form_filebrowser,
simba.form_notes, simba.form_settings, simba.form_openexample, simba.form_shapebox,
simba.form_backups, simba.form_findinfiles, simba.form_downloadsimba, simba.form_package,
simba.compiler_dump, simba.plugin_dump, simba.script_runner,
simba.ide_initialization, simba.ide_analytics;
simba.plugin_dump, simba.script_runner,
simba.ide_initialization, simba.ide_analytics, simba.script;

begin
{$IF DECLARED(SetHeapTraceOutput)}
Expand Down Expand Up @@ -53,7 +53,12 @@

if Application.HasOption('dumpcompiler') then
begin
DumpCompiler(Application.Params[Application.ParamCount]);
with TSimbaScript.Create() do
try
Dump(Application.Params[Application.ParamCount]);
finally
Free();
end;

Halt();
end;
Expand Down
8 changes: 4 additions & 4 deletions Source/script/imports/lcl/simba.import_lcl_comctrls.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ interface

uses
Classes, SysUtils,
simba.base, simba.script_compiler;
simba.base, simba.script;

procedure ImportLCLComCtrls(Compiler: TSimbaScript_Compiler);
procedure ImportLCLComCtrls(Script: TSimbaScript);

implementation

Expand Down Expand Up @@ -633,9 +633,9 @@ procedure _LapeStatusBar_Create(const Params: PParamArray; const Result: Pointer
PStatusBar(Result)^ := TStatusBar.Create(PComponent(Params^[0])^);
end;

procedure ImportLCLComCtrls(Compiler: TSimbaScript_Compiler);
procedure ImportLCLComCtrls(Script: TSimbaScript);
begin
with Compiler do
with Script.Compiler do
begin
addGlobalType('enum(BottomRight, TopLeft, Both)', 'ELazTickMark');
addGlobalType('enum(None, Auto, Manual)', 'ELazStickStyle');
Expand Down
8 changes: 4 additions & 4 deletions Source/script/imports/lcl/simba.import_lcl_controls.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ interface

uses
Classes, SysUtils,
simba.base, simba.script_compiler;
simba.base, simba.script;

procedure ImportLCLControls(Compiler: TSimbaScript_Compiler);
procedure ImportLCLControls(Script: TSimbaScript);

implementation

Expand Down Expand Up @@ -788,9 +788,9 @@ procedure _LapeGraphicControl_Update(const Params: PParamArray); LAPE_WRAPPER_CA
PGraphicControl(Params^[0])^.Update();
end;

procedure ImportLCLControls(Compiler: TSimbaScript_Compiler);
procedure ImportLCLControls(Script: TSimbaScript);
begin
with Compiler do
with Script.Compiler do
begin
addGlobalType('set of enum(Shift, Alt, Ctrl, Left, Right, Middle, Double, Meta, Super, Hyper, AltGr, Caps, Num, Scroll, Triple, Quad, Extra1, Extra2)', 'ELazShiftStates');
addGlobalType('enum(Left, Right, Middle, Extra1, Extra2)', 'ELazMouseButton');
Expand Down
8 changes: 4 additions & 4 deletions Source/script/imports/lcl/simba.import_lcl_extctrls.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ interface

uses
Classes, SysUtils,
simba.base, simba.script_compiler;
simba.base, simba.script;

procedure ImportLCLExtCtrls(Compiler: TSimbaScript_Compiler);
procedure ImportLCLExtCtrls(Script: TSimbaScript);

implementation

Expand Down Expand Up @@ -245,9 +245,9 @@ procedure _LapePanel_Create(const Params: PParamArray; const Result: Pointer); L
PPanel(Result)^ := TPanel.Create(PComponent(Params^[0])^);
end;

procedure ImportLCLExtCtrls(Compiler: TSimbaScript_Compiler);
procedure ImportLCLExtCtrls(Script: TSimbaScript);
begin
with Compiler do
with Script.Compiler do
begin
addGlobalType('enum(None, Lowered, Raised, Space)', 'ELazPanelBevel');

Expand Down
8 changes: 4 additions & 4 deletions Source/script/imports/lcl/simba.import_lcl_form.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ interface

uses
Classes, SysUtils,
simba.base, simba.threading, simba.script_compiler;
simba.base, simba.threading, simba.script;

procedure ImportLCLForm(Compiler: TSimbaScript_Compiler);
procedure ImportLCLForm(Script: TSimbaScript);

implementation

Expand Down Expand Up @@ -955,9 +955,9 @@ procedure _LapeColorDialog_Create(const Params: PParamArray; const Result: Point
PColorDialog(Result)^ := TColorDialog.Create(PComponent(Params^[0])^);
end;

procedure ImportLCLForm(Compiler: TSimbaScript_Compiler);
procedure ImportLCLForm(Script: TSimbaScript);
begin
with Compiler do
with Script.Compiler do
begin
addGlobalType('enum(Default, Always, Never)', 'ELazFormShowInTaskbar');
addGlobalType('enum(None, Single, Sizeable, Dialog, ToolWindow, SizeToolWin)', 'ELazFormBorderStyle');
Expand Down
8 changes: 4 additions & 4 deletions Source/script/imports/lcl/simba.import_lcl_graphics.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ interface

uses
Classes, SysUtils,
simba.base, simba.script_compiler;
simba.base, simba.script;

procedure ImportLCLGraphics(Compiler: TSimbaScript_Compiler);
procedure ImportLCLGraphics(Script: TSimbaScript);

implementation

Expand Down Expand Up @@ -758,9 +758,9 @@ procedure _LapePicture_OnChange_Write(const Params: PParamArray); LAPE_WRAPPER_C
PPicture(Params^[0])^.OnChange := PNotifyEvent(Params^[1])^;
end;

procedure ImportLCLGraphics(Compiler: TSimbaScript_Compiler);
procedure ImportLCLGraphics(Script: TSimbaScript);
begin
with Compiler do
with Script.Compiler do
begin
addGlobalType('record Left, Top ,Right, Bottom: Integer; end', 'TLazRect');
addGlobalType('enum(fqDefault, fqDraft, fqProof, fqNonAntialiased, fqAntialiased, fqCleartype, fqCleartypeNatural)', 'ELazFontQuality');
Expand Down
8 changes: 4 additions & 4 deletions Source/script/imports/lcl/simba.import_lcl_misc.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ interface

uses
Classes, SysUtils,
simba.base, simba.script_compiler;
simba.base, simba.script;

procedure ImportLCLMisc(Compiler: TSimbaScript_Compiler);
procedure ImportLCLMisc(Script: TSimbaScript);

implementation

Expand Down Expand Up @@ -541,9 +541,9 @@ procedure _LapeButtonPanel_ShowGlyphs_Write(const Params: PParamArray); LAPE_WRA
PButtonPanel(Params^[0])^.ShowGlyphs := PPanelButtons(Params^[1])^;
end;

procedure ImportLCLMisc(Compiler: TSimbaScript_Compiler);
procedure ImportLCLMisc(Script: TSimbaScript);
begin
with Compiler do
with Script.Compiler do
begin
addClass('TLazCustomFloatSpinEdit', 'TLazCustomEdit');
addProperty('TLazCustomFloatSpinEdit', 'DecimalPlaces', 'Integer', @_LapeCustomFloatSpinEdit_DecimalPlaces_Read, @_LapeCustomFloatSpinEdit_DecimalPlaces_Write);
Expand Down
8 changes: 4 additions & 4 deletions Source/script/imports/lcl/simba.import_lcl_stdctrls.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ interface

uses
Classes, SysUtils,
simba.base, simba.script_compiler;
simba.base, simba.script;

procedure ImportLCLStdCtrls(Compiler: TSimbaScript_Compiler);
procedure ImportLCLStdCtrls(Script: TSimbaScript);

implementation

Expand Down Expand Up @@ -1082,9 +1082,9 @@ procedure _LapeRadioButton_Create(const Params: PParamArray; const Result: Point
PRadioButton(Result)^ := TRadioButton.Create(PComponent(Params^[0])^);
end;

procedure ImportLCLStdCtrls(Compiler: TSimbaScript_Compiler);
procedure ImportLCLStdCtrls(Script: TSimbaScript);
begin
with Compiler do
with Script.Compiler do
begin
addGlobalType('enum(ssNone, ssHorizontal, ssVertical, ssBoth, ssAutoHorizontal, ssAutoVertical, ssAutoBoth)', 'ELazScrollStyle');
addGlobalType('set of enum(odSelected, odGrayed, odDisabled, odChecked, odFocused, odDefault, odHotLight, odInactive, odNoAccel, odNoFocusRect, odReserved1, odReserved2, odComboBoxEdit, odBackgroundPainted)', 'ELazOwnerDrawStates');
Expand Down
8 changes: 4 additions & 4 deletions Source/script/imports/lcl/simba.import_lcl_system.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ interface

uses
Classes, SysUtils,
simba.base, simba.script_compiler;
simba.base, simba.script;

procedure ImportLCLSystem(Compiler: TSimbaScript_Compiler);
procedure ImportLCLSystem(Script: TSimbaScript);

implementation

Expand Down Expand Up @@ -593,9 +593,9 @@ procedure _LapeComponent_Tag_Write(const Params: PParamArray); LAPE_WRAPPER_CALL
PComponent(Params^[0])^.Tag := PPtrInt(Params^[1])^;
end;

procedure ImportLCLSystem(Compiler: TSimbaScript_Compiler);
procedure ImportLCLSystem(Script: TSimbaScript);
begin
with Compiler do
with Script.Compiler do
begin
addClass('TObject', 'Pointer');

Expand Down
12 changes: 6 additions & 6 deletions Source/script/imports/simba.import_async.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ interface

uses
Classes, SysUtils,
simba.base, simba.script_compiler;
simba.base, simba.script;

procedure ImportASync(Compiler: TSimbaScript_Compiler);
procedure ImportASync(Script: TSimbaScript);

implementation

Expand Down Expand Up @@ -202,11 +202,11 @@ procedure ASync.ScheduleStop(Name: String); static;
Stop a scheduled method.
*)

procedure ImportASync(Compiler: TSimbaScript_Compiler);
procedure ImportASync(Script: TSimbaScript);
begin
with Compiler do
with Script.Compiler do
begin
ImportingSection := 'ASync';
DumpSection := 'ASync';

// namespace
addGlobalType('record end;', 'ASync');
Expand Down Expand Up @@ -283,7 +283,7 @@ procedure ImportASync(Compiler: TSimbaScript_Compiler);
'end;'
]);

ImportingSection := '';
DumpSection := '';
end;
end;

Expand Down
12 changes: 6 additions & 6 deletions Source/script/imports/simba.import_atpa.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ interface

uses
Classes, SysUtils,
simba.base, simba.script_compiler;
simba.base, simba.script;

procedure ImportATPA(Compiler: TSimbaScript_Compiler);
procedure ImportATPA(Script: TSimbaScript);

implementation

Expand Down Expand Up @@ -396,11 +396,11 @@ procedure _LapeATPA_Intersection(const Params: PParamArray; const Result: Pointe
PPointArray(Result)^ := P2DPointArray(Params^[0])^.Intersection();
end;

procedure ImportATPA(Compiler: TSimbaScript_Compiler);
procedure ImportATPA(Script: TSimbaScript);
begin
with Compiler do
with Script.Compiler do
begin
ImportingSection := 'T2DPointArray';
DumpSection := 'T2DPointArray';

addGlobalFunc('function T2DPointArray.Offset(P: TPoint): T2DPointArray', @_LapeATPA_Offset1);

Expand Down Expand Up @@ -444,7 +444,7 @@ procedure ImportATPA(Compiler: TSimbaScript_Compiler);
addGlobalFunc('function T2DPointArray.Merge: TPointArray;', @_LapeATPA_Merge);
addGlobalFunc('function T2DPointArray.Intersection: TPointArray; overload;', @_LapeATPA_Intersection);

ImportingSection := '';
DumpSection := '';
end;
end;

Expand Down
12 changes: 6 additions & 6 deletions Source/script/imports/simba.import_base.pas
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ interface
uses
Classes, SysUtils,
lptypes, lpvartypes, lpparser, ffi,
simba.base, simba.script_compiler;
simba.base, simba.script;

procedure ImportBase(Compiler: TSimbaScript_Compiler);
procedure ImportBase(Script: TSimbaScript);

implementation

Expand Down Expand Up @@ -729,11 +729,11 @@ procedure _LapeArraySymDifference_PointArray(const Params: PParamArray; const Re
PPointArray(Result)^ := PPointArray(Params^[0])^.SymmetricDifference(PPointArray(Params^[1])^);
end;

procedure ImportBase(Compiler: TSimbaScript_Compiler);
procedure ImportBase(Script: TSimbaScript);
begin
with Compiler do
with Script.Compiler do
begin
ImportingSection := 'Base';
DumpSection := 'Base';

addBaseDefine('SIMBA' + Format('%d', [SIMBA_VERSION]));
addBaseDefine('SIMBAMAJOR' + Format('%d', [SIMBA_MAJOR]));
Expand Down Expand Up @@ -795,7 +795,7 @@ procedure ImportBase(Compiler: TSimbaScript_Compiler);
addGlobalFunc('function TByteArray.ToString: String;', @_LapeByteArray_ToString);
addGlobalFunc('procedure TByteArray.FromString(Str: String);', @_LapeByteArray_FromString);

ImportingSection := '';
DumpSection := '';

addClass('TBaseClass', 'Pointer');
addProperty('TBaseClass', 'Name', 'String', @_LapeBaseClass_Name_Read, @_LapeBaseClass_Name_Write);
Expand Down
12 changes: 6 additions & 6 deletions Source/script/imports/simba.import_box.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ interface

uses
Classes, SysUtils,
simba.base, simba.script_compiler;
simba.base, simba.script;

procedure ImportBox(Compiler: TSimbaScript_Compiler);
procedure ImportBox(Script: TSimbaScript);

implementation

Expand Down Expand Up @@ -445,11 +445,11 @@ procedure _LapeBox_BottomRight(const Params: PParamArray; const Result: Pointer)
PPoint(Result)^ := PBox(Params^[0])^.BottomRight;
end;

procedure ImportBox(Compiler: TSimbaScript_Compiler);
procedure ImportBox(Script: TSimbaScript);
begin
with Compiler do
with Script.Compiler do
begin
ImportingSection := 'TBox';
DumpSection := 'TBox';

addGlobalFunc('function Box(X1, Y1, X2, Y2: Integer): TBox; overload', @_LapeBox1);
addGlobalFunc('function Box(Mid: TPoint; XRad, YRad: Integer): TBox; overload', @_LapeBox2);
Expand Down Expand Up @@ -493,7 +493,7 @@ procedure ImportBox(Compiler: TSimbaScript_Compiler);
addGlobalFunc('property TBox.BottomLeft: TPoint;', @_LapeBox_BottomLeft);
addGlobalFunc('property TBox.BottomRight: TPoint;', @_LapeBox_BottomRight);

ImportingSection := '';
DumpSection := '';
end;
end;

Expand Down
12 changes: 6 additions & 6 deletions Source/script/imports/simba.import_boxarray.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ interface

uses
Classes, SysUtils,
simba.base, simba.script_compiler;
simba.base, simba.script;

procedure ImportBoxArray(Compiler: TSimbaScript_Compiler);
procedure ImportBoxArray(Script: TSimbaScript);

implementation

Expand Down Expand Up @@ -226,11 +226,11 @@ procedure _LapeBoxArray_Sort2(const Params: PParamArray; const Result: Pointer);
PBoxArray(Result)^ := PBoxArray(Params^[0])^.Sort(PDoubleArray(Params^[1])^, PBoolean(Params^[2])^);
end;

procedure ImportBoxArray(Compiler: TSimbaScript_Compiler);
procedure ImportBoxArray(Script: TSimbaScript);
begin
with Compiler do
with Script.Compiler do
begin
ImportingSection := 'TBoxArray';
DumpSection := 'TBoxArray';

addGlobalFunc('function TBoxArray.Create(Start: TPoint; Columns, Rows, Width, Height: Integer; Spacing: TPoint): TBoxArray; static;', @_LapeBoxArray_Create);
addGlobalFunc('function TBoxArray.Pack: TBoxArray;', @_LapeBoxArray_Pack);
Expand All @@ -255,7 +255,7 @@ procedure ImportBoxArray(Compiler: TSimbaScript_Compiler);
addGlobalFunc('function TBoxArray.ContainsPoint(P: TPoint; out Index: Integer): Boolean; overload;', @_LapeBoxArray_ContainsPoint1);
addGlobalFunc('function TBoxArray.ContainsPoint(P: TPoint): Boolean; overload;', @_LapeBoxArray_ContainsPoint2);

ImportingSection := '';
DumpSection := '';
end;
end;

Expand Down
Loading

0 comments on commit cb29146

Please sign in to comment.