From 31df8c695ac8e7e330ca8374b6a933cb4e7620a7 Mon Sep 17 00:00:00 2001 From: Merlijn Wajer Date: Tue, 26 Jul 2011 19:30:41 +0200 Subject: [PATCH 01/10] Extensions/paster: Fix bug introduced by StrToInt. It now raises an exception, so use StrToIntDef instead. --- Extensions/paster.sex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Extensions/paster.sex b/Extensions/paster.sex index 8410032..54057dd 100644 --- a/Extensions/paster.sex +++ b/Extensions/paster.sex @@ -87,7 +87,7 @@ begin HOST := HOSTDef; if (InputQuery(GetName + ' ' + GetVersion + ' Extension', 'Which ID would you like to grab?', Data)) then begin - if IntToStr(StrToInt(Data)) = Data then + if IntToStr(StrToIntDef(Data, -1)) = Data then Data := '{"paste_id": ' + Data + '}' else Data := '{"paste_id": "' + Data + '"}'; From 303253aeed2f07bde7ff8a13ee3339fad279584d Mon Sep 17 00:00:00 2001 From: Merlijn Wajer Date: Tue, 26 Jul 2011 21:44:01 +0200 Subject: [PATCH 02/10] Simba: Attempt to fix include_once behaviour. --- Projects/Simba/Simba.inc | 2 ++ Units/MMLAddon/mmlpsthread.pas | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Projects/Simba/Simba.inc b/Projects/Simba/Simba.inc index d8ec62b..ee530c9 100644 --- a/Projects/Simba/Simba.inc +++ b/Projects/Simba/Simba.inc @@ -26,6 +26,8 @@ // See Units/Linux/keybinder.pas {$ENDIF} +//{$DEFINE SIMBA_VERBOSE} // For more verbosity. + //{$DEFINE USE_RUTIS} //{$DEFINE USE_CPASCAL} // TODO diff --git a/Units/MMLAddon/mmlpsthread.pas b/Units/MMLAddon/mmlpsthread.pas index 0079dbd..292444c 100644 --- a/Units/MMLAddon/mmlpsthread.pas +++ b/Units/MMLAddon/mmlpsthread.pas @@ -746,11 +746,15 @@ begin if (path <> '') then if Includes.Find(path,i) then begin - psWriteln('Include_Once file already included'); - Result := False; + {$IFDEF SIMBA_VERBOSE} + psWriteln('Include_Once file already included:' + Path); + {$ENDIF} + Result := True; + Exit; end; + Includes.Add(path); - Result := True; + Result := False; end; procedure SIRegister_Mufasa(cl: TPSPascalCompiler); From 1fd51ff6b1fbb5ec73340e25195b47f57da277f3 Mon Sep 17 00:00:00 2001 From: Merlijn Wajer Date: Tue, 26 Jul 2011 22:04:48 +0200 Subject: [PATCH 03/10] Simba: Define USE_EXTENSIONS by default. --- Projects/Simba/Simba.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projects/Simba/Simba.inc b/Projects/Simba/Simba.inc index ee530c9..9273f5c 100644 --- a/Projects/Simba/Simba.inc +++ b/Projects/Simba/Simba.inc @@ -32,7 +32,7 @@ //{$DEFINE USE_CPASCAL} // TODO //{$DEFINE USE_LAPE} // TODO -//{$DEFINE USE_EXTENSIONS} +{$DEFINE USE_EXTENSIONS} //{$DEFINE USE_CODECOMPLETION} // TODO //{$DEFINE TERMINALWRITELN} // Only used once. Remove from SimbaUnit? From d199d11e68aa54afdf405c229220c8e7f8c2f84e Mon Sep 17 00:00:00 2001 From: Merlijn Wajer Date: Fri, 29 Jul 2011 12:36:39 +0200 Subject: [PATCH 04/10] Documentation: Small additions. --- Doc/sphinx/features/exten.rst | 12 ++++++++++-- Doc/sphinx/features/scriptmanager.rst | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Doc/sphinx/features/exten.rst b/Doc/sphinx/features/exten.rst index 861594f..8b2b18a 100644 --- a/Doc/sphinx/features/exten.rst +++ b/Doc/sphinx/features/exten.rst @@ -14,9 +14,17 @@ Recommended Simba Extensions ---------------------------- Recommended: - * SRL Updater (and Downloader) - * DTM Editor + + * Extension Updater (highly recommended) + * SRL Updater (and Installer/Download) * Associate Files + * Security extension. (Implements a File and Fire wall) + +For developers: + + * DTM Editor + * Paster Extension + * CRov, Crash Recovery. .. note:: You can also use the Reflection Updater (and Downloader) for updating diff --git a/Doc/sphinx/features/scriptmanager.rst b/Doc/sphinx/features/scriptmanager.rst index 774bacb..e574b01 100644 --- a/Doc/sphinx/features/scriptmanager.rst +++ b/Doc/sphinx/features/scriptmanager.rst @@ -1,5 +1,5 @@ Simba Script Manager ==================== -Community-created scripts will be available for download from the +Community-created scripts will be available for download from the Script Manager. The script manager will appear in release 1.0. From 73b2b9635d579605b59739f81dcdb54743d4f50c Mon Sep 17 00:00:00 2001 From: Merlijn Wajer Date: Thu, 28 Jul 2011 20:52:13 +0200 Subject: [PATCH 05/10] Lape: Update head. --- Units/lape | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Units/lape b/Units/lape index 1b8211d..940053e 160000 --- a/Units/lape +++ b/Units/lape @@ -1 +1 @@ -Subproject commit 1b8211db373428cd2916905980ad51be8fab1f83 +Subproject commit 940053e16d79c3d76b6b70d6a1bf56507ad0e627 From b7c8fa9fb684ef42d819fd2a954aef196a4673d1 Mon Sep 17 00:00:00 2001 From: Merlijn Wajer Date: Fri, 29 Jul 2011 20:38:04 +0200 Subject: [PATCH 06/10] Simba: Try to fix dependency hell. --- Projects/Simba/Simba.lpi | 1 - 1 file changed, 1 deletion(-) diff --git a/Projects/Simba/Simba.lpi b/Projects/Simba/Simba.lpi index 44c4dc8..9b88949 100644 --- a/Projects/Simba/Simba.lpi +++ b/Projects/Simba/Simba.lpi @@ -38,7 +38,6 @@ - From 32a6db47c6518f0c7e0a770a27780ad22a5a8da4 Mon Sep 17 00:00:00 2001 From: Merlijn Wajer Date: Fri, 29 Jul 2011 20:41:36 +0200 Subject: [PATCH 07/10] Simba: Fix LCLBase requirement. --- Projects/Simba/Simba.lpi | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Projects/Simba/Simba.lpi b/Projects/Simba/Simba.lpi index 9b88949..af46d9c 100644 --- a/Projects/Simba/Simba.lpi +++ b/Projects/Simba/Simba.lpi @@ -35,17 +35,14 @@ - + - - - - - + + - + @@ -310,7 +307,7 @@ - + From c4215bc2e51c1f8f03fec5f50fe9d0bf1e562fb0 Mon Sep 17 00:00:00 2001 From: Cohen Adair Date: Fri, 29 Jul 2011 14:45:30 -0400 Subject: [PATCH 08/10] MML: Added FilterTPACustom, FilterTPADistEx, and FilterTPADist --- Units/MMLAddon/PSInc/Wrappers/tpa.inc | 15 +++++ Units/MMLAddon/PSInc/psexportedmethods.inc | 3 + Units/MMLCore/tpa.pas | 75 ++++++++++++++++++++++ 3 files changed, 93 insertions(+) diff --git a/Units/MMLAddon/PSInc/Wrappers/tpa.inc b/Units/MMLAddon/PSInc/Wrappers/tpa.inc index 0c7c547..f8ef974 100644 --- a/Units/MMLAddon/PSInc/Wrappers/tpa.inc +++ b/Units/MMLAddon/PSInc/Wrappers/tpa.inc @@ -143,6 +143,21 @@ begin FilterPointsLine(points,radial,radius,mx,my); end; +procedure ps_FilterTPACustom(TPA: TPointArray; compare: function(a, b: integer): boolean); +begin + FilterTPACustom(TPA, @compare); +end; + +procedure ps_FilterTPADistEx(var TPA: TPointArray; maxL, maxW: integer); +begin + FilterTPADistEx(TPA, maxL, maxW); +end; + +procedure ps_FilterTPADist(var TPA: TPointArray; maxDist: integer); +begin + FilterTPADist(TPA, maxDist); +end; + function ps_GetATPABounds(const ATPA: T2DPointArray): TBox;extdecl; begin result := GetATPABounds(ATPA); diff --git a/Units/MMLAddon/PSInc/psexportedmethods.inc b/Units/MMLAddon/PSInc/psexportedmethods.inc index 4dad21c..3c82ba0 100644 --- a/Units/MMLAddon/PSInc/psexportedmethods.inc +++ b/Units/MMLAddon/PSInc/psexportedmethods.inc @@ -458,6 +458,9 @@ AddFunction(@ps_FloodFillTPA,'function FloodFillTPA(const TPA : TPointArray) : T AddFunction(@ps_FilterPointsPie,'procedure FilterPointsPie(var Points: TPointArray; const SD, ED, MinR, MaxR: Extended; Mx, My: Integer);'); AddFunction(@ps_FilterPointsLine,'procedure FilterPointsLine(var Points: TPointArray; Radial: Extended; Radius, MX, MY: Integer);'); AddFunction(@ps_filterpointsdist,'procedure FilterPointsDist(var Points: TPointArray; const MinDist, MaxDist: Extended; Mx, My: Integer);'); +AddFunction(@ps_filterTPACustom, 'procedure FilterTPACustom(var TPA: TPointArray; compare: function(a, b: integer): boolean);'); +AddFunction(@ps_filterTPADistEx, 'procedure FilterTPADistEx(var TPA: TPointArray; maxL, maxW: integer);'); +AddFunction(@ps_filterTPADist, 'procedure FilterTPADist(var TPA: TPointArray; maxDist: integer);'); AddFunction(@ps_GetATPABounds,'function GetATPABounds(const ATPA: T2DPointArray): TBox;'); AddFunction(@ps_GetTPABounds,'function GetTPABounds(const TPA: TPointArray): TBox;'); AddFunction(@ps_FindTPAinTPA,'function FindTPAinTPA(const SearchTPA, TotalTPA: TPointArray; var Matches: TPointArray): Boolean;'); diff --git a/Units/MMLCore/tpa.pas b/Units/MMLCore/tpa.pas index 9c0abae..bded283 100644 --- a/Units/MMLCore/tpa.pas +++ b/Units/MMLCore/tpa.pas @@ -67,6 +67,9 @@ function FloodFillTPA(const TPA : TPointArray) : T2DPointArray; procedure FilterPointsPie(var Points: TPointArray; const SD, ED, MinR, MaxR: Extended; Mx, My: Integer); procedure FilterPointsDist(var Points: TPointArray; const MinDist,MaxDist: Extended; Mx, My: Integer); procedure FilterPointsLine(var Points: TPointArray; Radial: Extended; Radius, MX, MY: Integer); +procedure FilterTPACustom(var TPA: TPointArray; compare: function(a, b: integer): boolean); +procedure FilterTPADistEx(var TPA: TPointArray; maxL, maxW: integer); +procedure FilterTPADist(var TPA: TPointArray; maxDist: integer); function RemoveDistTPointArray(x, y, dist: Integer;const ThePoints: TPointArray; RemoveHigher: Boolean): TPointArray; function GetATPABounds(const ATPA: T2DPointArray): TBox; function GetTPABounds(const TPA: TPointArray): TBox; @@ -1168,6 +1171,78 @@ begin Points:= P; end; +{/\ + Removes points in the TPA using the funciton 'compare'. If 'compare' returns + true, point b is removed from the TPA. +/\} +procedure FilterTPACustom(TPA: TPointArray; compare: function(a, b: integer): boolean); +var + c, i, j, l, h: integer; + newTPA: TPointArray; + inBadElements: TBooleanArray; +begin + h := high(TPA); + l := (h + 1); // i.e. length(TPA); + + setLength(inBadElements, l); + setLength(newTPA, l); + + for i := 0 to h do + inBadElements[i] := false; // just in case.. + + for i := 0 to (h - 1) do + begin + if (inBadElements[i]) then // increases speed significantly + continue; + + for j := (i + 1) to h do + begin + if (inBadElements[j]) then // increases speed significantly + continue; + + if (compare(TPA[i], TPA[j])) then + inBadElements[j] := true; + end; + end; + + c := 0; + + // set the new TPA + for i := 0 to h do + if (not inBadElements[i]) then + begin + newTPA[c] := TPA[i]; + inc(c); + end; + + setLength(newTPA, c); + TPA := newTPA; +end; + +{/\ + Removes points in the TPA that are within maxL or maxW of each other. +/\} +procedure FilterTPADistEx(var TPA: TPointArray; maxL, maxW: integer); +function lwComp(a,b: TPoint): Boolean; +begin + result := (abs(a.x-b.x) <= maxW) or (abs(a.y-b.y) <= maxL); // lambda would be nice.. +end; +begin + FilterTPACustom(TPA, @lwComp); +end; + +{/\ + Removes points in the TPA that are within 'maxDist' of each other. +/\} +procedure FilterTPADist(var TPA: TPointArray; maxDist: integer); +function distComp(a, b: TPoint): boolean; +begin + result := (((a.x-b.x)*(a.x-b.x)) + ((a.y-b.y)*(a.y-b.y)) <= (maxDist*maxDist)); +end; +begin + FilterTPACustom(TPA, @distComp); +end; + {/\ Removes the points that are inside or outside the distance Dist from the point (x, y) from the TPointArray ThePoints. /\} From c58268335abc23af51507db1e0e8c77f03feff4a Mon Sep 17 00:00:00 2001 From: Cohen Adair Date: Fri, 29 Jul 2011 16:32:13 -0400 Subject: [PATCH 09/10] TPA: Removed FilterTPACustom and FilterTPADistEx --- Units/MMLAddon/PSInc/Wrappers/tpa.inc | 10 ----- Units/MMLAddon/PSInc/psexportedmethods.inc | 2 - Units/MMLCore/tpa.pas | 47 +++++----------------- 3 files changed, 11 insertions(+), 48 deletions(-) diff --git a/Units/MMLAddon/PSInc/Wrappers/tpa.inc b/Units/MMLAddon/PSInc/Wrappers/tpa.inc index f8ef974..c35a0a3 100644 --- a/Units/MMLAddon/PSInc/Wrappers/tpa.inc +++ b/Units/MMLAddon/PSInc/Wrappers/tpa.inc @@ -143,16 +143,6 @@ begin FilterPointsLine(points,radial,radius,mx,my); end; -procedure ps_FilterTPACustom(TPA: TPointArray; compare: function(a, b: integer): boolean); -begin - FilterTPACustom(TPA, @compare); -end; - -procedure ps_FilterTPADistEx(var TPA: TPointArray; maxL, maxW: integer); -begin - FilterTPADistEx(TPA, maxL, maxW); -end; - procedure ps_FilterTPADist(var TPA: TPointArray; maxDist: integer); begin FilterTPADist(TPA, maxDist); diff --git a/Units/MMLAddon/PSInc/psexportedmethods.inc b/Units/MMLAddon/PSInc/psexportedmethods.inc index 3c82ba0..42b7b3c 100644 --- a/Units/MMLAddon/PSInc/psexportedmethods.inc +++ b/Units/MMLAddon/PSInc/psexportedmethods.inc @@ -458,8 +458,6 @@ AddFunction(@ps_FloodFillTPA,'function FloodFillTPA(const TPA : TPointArray) : T AddFunction(@ps_FilterPointsPie,'procedure FilterPointsPie(var Points: TPointArray; const SD, ED, MinR, MaxR: Extended; Mx, My: Integer);'); AddFunction(@ps_FilterPointsLine,'procedure FilterPointsLine(var Points: TPointArray; Radial: Extended; Radius, MX, MY: Integer);'); AddFunction(@ps_filterpointsdist,'procedure FilterPointsDist(var Points: TPointArray; const MinDist, MaxDist: Extended; Mx, My: Integer);'); -AddFunction(@ps_filterTPACustom, 'procedure FilterTPACustom(var TPA: TPointArray; compare: function(a, b: integer): boolean);'); -AddFunction(@ps_filterTPADistEx, 'procedure FilterTPADistEx(var TPA: TPointArray; maxL, maxW: integer);'); AddFunction(@ps_filterTPADist, 'procedure FilterTPADist(var TPA: TPointArray; maxDist: integer);'); AddFunction(@ps_GetATPABounds,'function GetATPABounds(const ATPA: T2DPointArray): TBox;'); AddFunction(@ps_GetTPABounds,'function GetTPABounds(const TPA: TPointArray): TBox;'); diff --git a/Units/MMLCore/tpa.pas b/Units/MMLCore/tpa.pas index bded283..ea6b6c9 100644 --- a/Units/MMLCore/tpa.pas +++ b/Units/MMLCore/tpa.pas @@ -67,8 +67,6 @@ function FloodFillTPA(const TPA : TPointArray) : T2DPointArray; procedure FilterPointsPie(var Points: TPointArray; const SD, ED, MinR, MaxR: Extended; Mx, My: Integer); procedure FilterPointsDist(var Points: TPointArray; const MinDist,MaxDist: Extended; Mx, My: Integer); procedure FilterPointsLine(var Points: TPointArray; Radial: Extended; Radius, MX, MY: Integer); -procedure FilterTPACustom(var TPA: TPointArray; compare: function(a, b: integer): boolean); -procedure FilterTPADistEx(var TPA: TPointArray; maxL, maxW: integer); procedure FilterTPADist(var TPA: TPointArray; maxDist: integer); function RemoveDistTPointArray(x, y, dist: Integer;const ThePoints: TPointArray; RemoveHigher: Boolean): TPointArray; function GetATPABounds(const ATPA: T2DPointArray): TBox; @@ -1172,36 +1170,37 @@ begin end; {/\ - Removes points in the TPA using the funciton 'compare'. If 'compare' returns - true, point b is removed from the TPA. + Removes points in the TPA that are within maxDist of each other. /\} -procedure FilterTPACustom(TPA: TPointArray; compare: function(a, b: integer): boolean); +procedure FilterTPADist(var TPA: TPointArray; maxDist: integer); var - c, i, j, l, h: integer; + c, i, j, l, h, maxDistSq: integer; newTPA: TPointArray; inBadElements: TBooleanArray; begin h := high(TPA); - l := (h + 1); // i.e. length(TPA); + l := (h + 1); + maxDistSq := (maxDist * maxDist); setLength(inBadElements, l); setLength(newTPA, l); for i := 0 to h do - inBadElements[i] := false; // just in case.. + inBadElements[i] := false; for i := 0 to (h - 1) do begin - if (inBadElements[i]) then // increases speed significantly + if (inBadElements[i]) then continue; for j := (i + 1) to h do begin - if (inBadElements[j]) then // increases speed significantly + if (inBadElements[j]) then continue; - if (compare(TPA[i], TPA[j])) then - inBadElements[j] := true; + // simplified -> a^2 + b^2 <= c^2 + if (((TPA[i].x - TPA[j].x) * (TPA[i].x - TPA[j].x)) + ((TPA[i].y - TPA[j].y) * (TPA[i].y - TPA[j].y)) <= maxDistSq) then + inBadElements[j] := true; end; end; @@ -1219,30 +1218,6 @@ begin TPA := newTPA; end; -{/\ - Removes points in the TPA that are within maxL or maxW of each other. -/\} -procedure FilterTPADistEx(var TPA: TPointArray; maxL, maxW: integer); -function lwComp(a,b: TPoint): Boolean; -begin - result := (abs(a.x-b.x) <= maxW) or (abs(a.y-b.y) <= maxL); // lambda would be nice.. -end; -begin - FilterTPACustom(TPA, @lwComp); -end; - -{/\ - Removes points in the TPA that are within 'maxDist' of each other. -/\} -procedure FilterTPADist(var TPA: TPointArray; maxDist: integer); -function distComp(a, b: TPoint): boolean; -begin - result := (((a.x-b.x)*(a.x-b.x)) + ((a.y-b.y)*(a.y-b.y)) <= (maxDist*maxDist)); -end; -begin - FilterTPACustom(TPA, @distComp); -end; - {/\ Removes the points that are inside or outside the distance Dist from the point (x, y) from the TPointArray ThePoints. /\} From bae2e027e29c66205e29cf100251db73e7764553 Mon Sep 17 00:00:00 2001 From: Cohen Adair Date: Fri, 29 Jul 2011 16:38:20 -0400 Subject: [PATCH 10/10] Laz: tpa.pas and psexportedmethods.inc added to project inspector --- Projects/Simba/Simba.lpi | 11 ++++++++++- Projects/Simba/Simba.lpr | 2 +- Projects/Simba/Simba.res | Bin 19212 -> 19864 bytes 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Projects/Simba/Simba.lpi b/Projects/Simba/Simba.lpi index af46d9c..889e59c 100644 --- a/Projects/Simba/Simba.lpi +++ b/Projects/Simba/Simba.lpi @@ -44,7 +44,7 @@ - + @@ -304,6 +304,15 @@ + + + + + + + + + diff --git a/Projects/Simba/Simba.lpr b/Projects/Simba/Simba.lpr index ac13155..26c37db 100644 --- a/Projects/Simba/Simba.lpr +++ b/Projects/Simba/Simba.lpr @@ -33,7 +33,7 @@ uses {$ENDIF}{$ENDIF} Interfaces, Forms, SimbaUnit, colourhistory, About, internets, debugimage, framefunctionlist, simpleanalyzer, updater, updateform, Simbasettings, - libloader, mufasabase, v_ideCodeInsight, + libloader, mufasabase, tpa, v_ideCodeInsight, PSDump, v_ideCodeParser, v_AutoCompleteForm, CastaliaPasLex, CastaliaPasLexTypes, CastaliaSimplePasPar, CastaliaSimplePasParTypes, dcpbase64, mPasLex, v_Constants, v_MiscFunctions, diff --git a/Projects/Simba/Simba.res b/Projects/Simba/Simba.res index 42c7633aefc517e477597f5189923c1d3ac6b5ad..0087bd7e4fbde483fac5db843263e4a80c76aec2 100644 GIT binary patch delta 672 zcmZXRO-=$q5QX2!XvDa{8?bO`fCW(@CMJp+He$pOb~+*g$uJOp{M*b0TpJTF;F3hQ z-oU$f1M%zTKhC79tGZsjdR_he;=H~&gK{MFm!!C);V{N>@T6GGZr1oqY4(zey2Kvo z951hePKoo_V|?>{xj(;>qbnOp-gw_1@2*_3i{H1Ski(*S>ZqYWHRu}hRfRgxtyi{d_be~6Xt+-Ng4rd zgfxH!mY|5=)HMWIO6uf#AhJsG-;;ad?{ku%qJ#7#Jd=tf40~FmQNc3T$OJI?)5a!3 zY6x)FD1n#@`5(3fOUDWtT_=UijCSnB(uz(e5LS8B zMW`V(;BBn&%&?_RN*wzvJ&PaRW?qt%1Lwf!(RwoA*+Uu*7sLfw^ITn~;cYC8Ji0n? JKgyBMlRuG=Wn};W delta 14 WcmbO+o3Upa