diff --git a/trunk/Plugins/libcpascal.dll b/trunk/Plugins/libcpascal.dll index 63c887e..f7a6fc8 100755 Binary files a/trunk/Plugins/libcpascal.dll and b/trunk/Plugins/libcpascal.dll differ diff --git a/trunk/Plugins/libcpascal.so b/trunk/Plugins/libcpascal.so index 58ff3e3..7f6762b 100755 Binary files a/trunk/Plugins/libcpascal.so and b/trunk/Plugins/libcpascal.so differ diff --git a/trunk/Units/MMLAddon/PSInc/psexportedmethods.inc b/trunk/Units/MMLAddon/PSInc/psexportedmethods.inc index e33f0c6..09ba4e6 100644 --- a/trunk/Units/MMLAddon/PSInc/psexportedmethods.inc +++ b/trunk/Units/MMLAddon/PSInc/psexportedmethods.inc @@ -33,10 +33,10 @@ AddFunction(@tDTMTopDTM, 'Function tDTMTopDTM(DTM: TDTM): pDTM;'); AddFunction(@ps_SetDTMName, 'procedure SetDTMName(DTM : integer; name : string);'); AddFunction(@ps_DTMFromString, 'function DTMFromString(DTMString: String): Integer;'); AddFunction(@ps_FreeDTM, 'procedure FreeDTM(DTM: Integer);'); -AddFunction(@ps_FindDTM, 'function FindDTM(DTM: Integer; out x, y: Integer; x1, y1, x2, y2: Integer): Boolean;'); -AddFunction(@ps_FindDTMs, 'function FindDTMs(DTM: Integer; out p: TPointArray; x1, y1, x2, y2: Integer): Boolean;'); -AddFunction(@ps_FindDTMRotated, 'function FindDTMRotated(DTM: Integer; out x, y: Integer; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; out aFound: Extended): Boolean;'); -AddFunction(@ps_FindDTMsRotated, 'function FindDTMsRotated(DTM: Integer; out Points: TPointArray; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; out aFound: T2DExtendedArray) : Boolean;'); +AddFunction(@ps_FindDTM, 'function FindDTM(DTM: Integer; var x, y: Integer; x1, y1, x2, y2: Integer): Boolean;'); +AddFunction(@ps_FindDTMs, 'function FindDTMs(DTM: Integer; var p: TPointArray; x1, y1, x2, y2: Integer): Boolean;'); +AddFunction(@ps_FindDTMRotated, 'function FindDTMRotated(DTM: Integer; var x, y: Integer; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; out aFound: Extended): Boolean;'); +AddFunction(@ps_FindDTMsRotated, 'function FindDTMsRotated(DTM: Integer; var Points: TPointArray; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; var aFound: T2DExtendedArray) : Boolean;'); AddFunction(@ps_addDTM, 'function AddDTM(d: TDTM): Integer;'); AddFunction(@ps_addpDTM, 'function AddpDTM(d: pDTM): Integer;'); @@ -83,7 +83,7 @@ AddFunction(@GetKeyMouseTarget,'function GetKeyMouseTarget: integer;'); AddFunction(@ExportImageTarget,'function ExportImageTarget : TTarget_Exported;'); AddFunction(@ExportKeyMouseTarget,'function ExportKeyMouseTarget : TTarget_Exported;'); AddFunction(@FreeTarget,'procedure FreeTarget(idx: integer);'); -AddFunction(@SetDesktopAsClient,'procedure SetDesktopAsClient'); +AddFunction(@SetDesktopAsClient,'procedure SetDesktopAsClient;'); AddFunction(@ActivateClient, 'procedure ActivateClient;'); AddFunction(@IsTargetValid, 'function IsTargetValid: boolean;'); @@ -95,7 +95,7 @@ AddFunction(@ps_RewriteFile, 'function RewriteFile(Path: string; Shared: Boolean AddFunction(@ps_CloseFile, 'procedure CloseFile(FileNum: Integer);'); AddFunction(@ps_EndOfFile, 'function EndOfFile(FileNum: Integer): Boolean;'); AddFunction(@ps_FileSize, 'function FileSize(FileNum: Integer): LongInt;'); -AddFunction(@ps_ReadFileString, 'function ReadFileString(FileNum: Integer; out s: string; x: Integer): Boolean;'); +AddFunction(@ps_ReadFileString, 'function ReadFileString(FileNum: Integer; var s: string; x: Integer): Boolean;'); AddFunction(@ps_WriteFileString, 'function WriteFileString(FileNum: Integer; s: string): Boolean;'); AddFunction(@ps_SetFileCharPointer, 'Function SetFileCharPointer(FileNum, cChars, Origin: Integer): Integer;'); AddFunction(@ps_FilePointerPos, 'function FilePointerPos(FileNum: Integer): Integer;'); @@ -116,7 +116,7 @@ AddFunction(@ps_GetTickCount, 'function GetSystemTime: LongWord;'); AddFunction(@ps_GetTickCount, 'function GetTickCount: LongWord;'); AddFunction(@GetTimeRunning,'function GetTimeRunning: LongWord;'); AddFunction(@ps_DecodeTime,'procedure DecodeTime(DateTime : TDateTime; var Hour,Min,Sec,MSec : word);'); -AddFunction(@ps_DecodeDate,'procedure DecodeDate ( const SourceDate : TDateTime; out Year, Month, Day : Word );'); +AddFunction(@ps_DecodeDate,'procedure DecodeDate ( const SourceDate : TDateTime; var Year, Month, Day : Word );'); AddFunction(@ConvertTime,'procedure ConvertTime(Time: integer; var h, m, s: integer);'); AddFunction(@HakunaMatata,'procedure HakunaMatata;'); AddFunction(@TerminateScript,'procedure TerminateScript;'); @@ -154,45 +154,45 @@ AddFunction(@ps_GetPage,'function GetPage(url : string): string;'); { Color Conversions and Speed } SetCurrSection('Color Convert'); -AddFunction(@Colour_Conv.ColorToRGB, 'procedure ColorToRGB(Color: integer; out r, g, b: Byte);'); +AddFunction(@Colour_Conv.ColorToRGB, 'procedure ColorToRGB(Color: integer; var r, g, b: Byte);'); AddFunction(@Colour_conv.RGBToColor, 'function RGBtoColor(r, g, b: Byte): TColor;'); -AddFunction(@Colour_conv.ColorToHSL, 'procedure ColorToHSL(Color: Integer; out h, s, l: Extended);'); +AddFunction(@Colour_conv.ColorToHSL, 'procedure ColorToHSL(Color: Integer; var h, s, l: Extended);'); AddFunction(@Colour_conv.HSLToColor, 'function HSLToColor(H, S, L: Extended): TColor;'); -AddFunction(@Colour_conv.ColorToXYZ, 'procedure ColorToXYZ(Color: Integer; out x, y, z: Extended);'); +AddFunction(@Colour_conv.ColorToXYZ, 'procedure ColorToXYZ(Color: Integer; var x, y, z: Extended);'); AddFunction(@Colour_conv.XYZToColor, 'function XYZToColor(X, Y, Z: Extended): TColor;'); -AddFunction(@Colour_conv.RGBToHSL, 'procedure RGBToHSL(R, G, B: Byte; out h, s, l: Extended);'); -AddFunction(@Colour_conv.HSLToRGB, 'procedure HSLtoRGB(H, S, L: extended; out R, G ,B: Byte);'); -AddFunction(@Colour_conv.RGBToXYZ, 'procedure RGBToXYZ(R, G, B: Byte;out x, y ,z: Extended);'); -AddFunction(@Colour_conv.XYZToRGB, 'procedure XYZToRGB(X, Y, Z: Extended; out R, G, B: Byte);'); +AddFunction(@Colour_conv.RGBToHSL, 'procedure RGBToHSL(R, G, B: Byte; var h, s, l: Extended);'); +AddFunction(@Colour_conv.HSLToRGB, 'procedure HSLtoRGB(H, S, L: extended; var R, G ,B: Byte);'); +AddFunction(@Colour_conv.RGBToXYZ, 'procedure RGBToXYZ(R, G, B: Byte;var x, y ,z: Extended);'); +AddFunction(@Colour_conv.XYZToRGB, 'procedure XYZToRGB(X, Y, Z: Extended; var R, G, B: Byte);'); { Color Finding } SetCurrSection('Color'); AddFunction(@SetColorToleranceSpeed, 'procedure SetColorToleranceSpeed(cts: integer);'); AddFunction(@GetToleranceSpeed, 'function GetToleranceSpeed: Integer;'); AddFunction(@SetToleranceSpeed2Modifiers, 'procedure SetToleranceSpeed2Modifiers(nHue, nSat: Extended);'); -AddFunction(@GetToleranceSpeed2Modifiers, 'procedure GetToleranceSpeed2Modifiers(out hMod, sMod: Extended);'); +AddFunction(@GetToleranceSpeed2Modifiers, 'procedure GetToleranceSpeed2Modifiers(var hMod, sMod: Extended);'); AddFunction(@GetColor,'function GetColor(x, y: Integer): Integer;'); AddFunction(@GetColors,'function GetColors(Coords : TPointArray) : TIntegerArray;'); AddFunction(@GetColorsWrap,'procedure GetColorsWrap(Coords : TPointArray; var Colors :TIntegerArray);'); -AddFunction(@FindColor, 'function FindColor(out x, y: integer; color, x1, y1, x2, y2: integer): boolean;'); -AddFunction(@findcolortoleranceOptimised, 'function FindColorToleranceOptimised(out x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean;'); -AddFunction(@FindColorTolerance, 'function FindColorTolerance(out x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean;'); -AddFunction(@FindColors, 'function FindColors(out TPA: TPointArray; color, x1, y1, x2, y2: integer): boolean;'); +AddFunction(@FindColor, 'function FindColor(var x, y: integer; color, x1, y1, x2, y2: integer): boolean;'); +AddFunction(@findcolortoleranceOptimised, 'function FindColorToleranceOptimised(var x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean;'); +AddFunction(@FindColorTolerance, 'function FindColorTolerance(var x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean;'); +AddFunction(@FindColors, 'function FindColors(var TPA: TPointArray; color, x1, y1, x2, y2: integer): boolean;'); AddFunction(@SimilarColors,'function SimilarColors(Col1, Col2, Tolerance: integer): boolean'); AddFunction(@CountColor,'function CountColor(Color, xs, ys, xe, ye: Integer): Integer;'); AddFunction(@CountColorTolerance,'function CountColorTolerance(Color, xs, ys, xe, ye, Tolerance: Integer): Integer;'); -AddFunction(@FindColorsToleranceOptimised,'function FindColorsToleranceOptimised(out Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean;'); -AddFunction(@FindColorsTolerance,'function FindColorsTolerance(out Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean;'); +AddFunction(@FindColorsToleranceOptimised,'function FindColorsToleranceOptimised(var Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean;'); +AddFunction(@FindColorsTolerance,'function FindColorsTolerance(var Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean;'); AddFunction(@FindColorSpiral,'function FindColorSpiral(var x, y: Integer; color, xs, ys, xe, ye: Integer): Boolean;'); AddFunction(@FindColorSpiralTolerance,'function FindColorSpiralTolerance(var x, y: Integer; color, xs, ys, xe, ye,Tol: Integer): Boolean;'); -AddFunction(@FindColorsSpiralTolerance,'function FindColorsSpiralTolerance(x, y: Integer; out Points: TPointArray; color, xs, ys, xe, ye: Integer; Tolerance: Integer) : boolean;'); +AddFunction(@FindColorsSpiralTolerance,'function FindColorsSpiralTolerance(x, y: Integer; var Points: TPointArray; color, xs, ys, xe, ye: Integer; Tolerance: Integer) : boolean;'); AddFunction(@FindColoredArea, 'function FindColoredArea(var x, y: Integer; color, xs, ys, xe, ye, MinArea: Integer): Boolean'); AddFunction(@FindColoredAreaTolerance, 'function FindColoredAreaTolerance(var x, y : Integer; color, xs, ys, xe, ye, MinArea, Tolerance : Integer): Boolean'); {Mouse etc.} SetCurrSection('Mouse'); AddFunction(@MoveMouse, 'procedure MoveMouse(x, y: integer);'); -AddFunction(@GetMousePos, 'procedure GetMousePos(out x, y: integer);'); +AddFunction(@GetMousePos, 'procedure GetMousePos(var x, y: integer);'); AddFunction(@HoldMouse, 'procedure HoldMouse(x, y: integer; clickType: integer);'); AddFunction(@ReleaseMouse, 'procedure ReleaseMouse(x, y: integer; clickType: integer);'); AddFunction(@ClickMouse, 'procedure ClickMouse(x, y: integer; clickType: integer);'); @@ -212,8 +212,8 @@ SetCurrSection('OCR'); AddFunction(@rs_GetUpText, 'function rs_GetUpText: string;'); AddFunction(@rs_GetUpTextAt, 'function rs_GetUpTextAt(x, y : integer): string;'); AddFunction(@BitmapFromText, 'function BitmapFromText(text, font: String): integer;'); -AddFunction(@TPAFromText, 'function TPAFromText(text, font: String;out w,h : integer): TPointArray;'); -AddFunction(@TPAFromTextWrap,'procedure TPAFromTextWrap(text, font: String;out w,h : integer;out TPA : TPointArray)'); +AddFunction(@TPAFromText, 'function TPAFromText(text, font: String;var w,h : integer): TPointArray;'); +AddFunction(@TPAFromTextWrap,'procedure TPAFromTextWrap(text, font: String;var w,h : integer;var TPA : TPointArray);'); AddFunction(@MaskFromText, 'function MaskFromText(text, font: String): TMask;'); AddFunction(@GetTextAt,'function GetTextAt(atX, atY, minvspacing, maxvspacing, hspacing,color, tol, len: integer; font: string): string;'); @@ -227,7 +227,7 @@ AddFunction(@SaveBitmap,'procedure SaveBitmap(Bmp : integer; path : string);'); AddFunction(@BitmapFromString,'function BitmapFromString(Width,Height : integer; Data : string): integer;'); AddFunction(@LoadBitmap,'function LoadBitmap(Path : string) : integer;'); AddFunction(@SetBitmapSize,'procedure SetBitmapSize(Bmp,NewW,NewH : integer);'); -AddFunction(@GetBitmapSize,'procedure GetBitmapSize(Bmp : integer; out BmpW,BmpH : integer);'); +AddFunction(@GetBitmapSize,'procedure GetBitmapSize(Bmp : integer; var BmpW,BmpH : integer);'); AddFunction(@StretchBitmapResize,'procedure StretchBitmapResize(Bmp,NewW,NewH : integer);'); AddFunction(@CreateMirroredBitmap,'function CreateMirroredBitmap(Bmp : integer) : integer;'); AddFunction(@CreateMirroredBitmapEx,'function CreateMirroredBitmapEx(Bmp : integer; MirrorStyle : TBmpMirrorStyle) : integer;'); @@ -235,7 +235,7 @@ AddFunction(@FastSetPixel,'procedure FastSetPixel(bmp,x,y : integer; Color : TCo AddFunction(@FastSetPixels,'procedure FastSetPixels(bmp : integer; TPA : TPointArray; Colors : TIntegerArray);'); AddFunction(@FastGetPixel,'function FastGetPixel(bmp, x,y : integer) : TColor;'); AddFunction(@FastGetPixels,'function FastGetPixels(Bmp : integer; TPA : TPointArray) : TIntegerArray;'); -AddFunction(@FastDrawClear,'procedure FastDrawClear(bmp : integer; Color : TColor)'); +AddFunction(@FastDrawClear,'procedure FastDrawClear(bmp : integer; Color : TColor);'); AddFunction(@FastDrawTransparent,'procedure FastDrawTransparent(x, y: Integer; SourceBitmap, TargetBitmap: Integer);'); AddFunction(@SetTransparentColor,'procedure SetTransparentColor(bmp : integer; Color : TColor);'); AddFunction(@GetTransparentColor,'function GetTransparentColor(bmp: integer) : TColor;'); @@ -243,11 +243,11 @@ AddFunction(@FastReplaceColor,'procedure FastReplaceColor(Bmp : integer; OldColo AddFunction(@ps_CopyClientToBitmap, 'procedure CopyClientToBitmap(bmp, xs, ys, xe, ye: Integer);'); AddFunction(@BitmapFromClient,'function BitmapFromClient(const xs, ys, xe, ye: Integer): Integer;'); AddFunction(@SetBitmapName, 'procedure SetBitmapName(Bmp : integer; name : string);'); -AddFunction(@FindBitmap,'function FindBitmap(bitmap: integer; out x, y: Integer): Boolean;'); -AddFunction(@FindBitmapIn,'function FindBitmapIn(bitmap: integer; out x, y: Integer; xs, ys, xe, ye: Integer): Boolean;'); -AddFunction(@FindBitmapToleranceIn,'function FindBitmapToleranceIn(bitmap: integer; out x, y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer): Boolean;'); +AddFunction(@FindBitmap,'function FindBitmap(bitmap: integer; var x, y: Integer): Boolean;'); +AddFunction(@FindBitmapIn,'function FindBitmapIn(bitmap: integer; var x, y: Integer; xs, ys, xe, ye: Integer): Boolean;'); +AddFunction(@FindBitmapToleranceIn,'function FindBitmapToleranceIn(bitmap: integer; var x, y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer): Boolean;'); AddFunction(@FindBitmapSpiral,'function FindBitmapSpiral(bitmap: Integer; var x, y: Integer; xs, ys, xe, ye: Integer): Boolean;'); -AddFunction(@FindBitmapsSpiralTolerance,'function FindBitmapsSpiralTolerance(bitmap: integer; x, y: Integer; out Points : TPointArray; xs, ys, xe, ye,tolerance: Integer): Boolean;'); +AddFunction(@FindBitmapsSpiralTolerance,'function FindBitmapsSpiralTolerance(bitmap: integer; x, y: Integer; var Points : TPointArray; xs, ys, xe, ye,tolerance: Integer): Boolean;'); AddFunction(@FindBitmapSpiralTolerance,'function FindBitmapSpiralTolerance(bitmap: integer; var x, y: Integer; xs, ys, xe, ye,tolerance : integer): Boolean;'); AddFunction(@RotateBitmap,'function RotateBitmap(bitmap: Integer; angle: Extended): Integer;'); AddFunction(@Desaturate,'function DesaturateBitmap(Bitmap : integer) : integer;'); @@ -258,9 +258,9 @@ AddFunction(@BrightnessBitmap,'function BrightnessBitmap(Bitmap,br : integer) : AddFunction(@ContrastBitmap,'function ContrastBitmap(bitmap : integer; co : extended) : integer;'); AddFunction(@PosterizeBitmap,'function PosterizeBitmap(Bitmap : integer; po : integer) : integer;'); AddFunction(@CreateMaskFromBitmap,'function CreateMaskFromBitmap(Bitmap : integer) : TMask;'); -AddFunction(@FindMaskTolerance,'function FindMaskTolerance(mask: TMask; out x, y: Integer; xs,ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean;'); -AddFunction(@FindBitmapMaskTolerance,'function FindBitmapMaskTolerance(mask: Integer; out x, y: Integer; xs, ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean;'); -AddFunction(@FindDeformedBitmapToleranceIn,'function FindDeformedBitmapToleranceIn(bitmap: integer; out x,y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer; Range: Integer; AllowPartialAccuracy: Boolean; out accuracy: Extended): Boolean;'); +AddFunction(@FindMaskTolerance,'function FindMaskTolerance(mask: TMask; var x, y: Integer; xs,ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean;'); +AddFunction(@FindBitmapMaskTolerance,'function FindBitmapMaskTolerance(mask: Integer; var x, y: Integer; xs, ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean;'); +AddFunction(@FindDeformedBitmapToleranceIn,'function FindDeformedBitmapToleranceIn(bitmap: integer; var x,y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer; Range: Integer; AllowPartialAccuracy: Boolean; var accuracy: Extended): Boolean;'); AddFunction(@DrawTPABitmap,'procedure DrawTPABitmap(bitmap: integer; TPA: TPointArray; Color: integer);'); AddFunction(@DrawATPABitmap,'procedure DrawATPABitmap(bitmap: integer; ATPA: T2DPointArray);'); AddFunction(@DrawATPABitmapEx,'procedure DrawATPABitmapEx(bitmap: integer; ATPA: T2DPointArray; Colors: TIntegerArray);'); @@ -322,19 +322,19 @@ AddFunction(@InvertTIA,'procedure InvertTIA(var tI: TIntegerArray);'); AddFunction(@SumIntegerArray,'function SumIntegerArray(Ints : TIntegerArray): Integer;'); AddFunction(@AverageTIA,'function AverageTIA(tI: TIntegerArray): Integer;'); AddFunction(@AverageExtended,'function AverageExtended(tE: TExtendedArray): Extended;'); -AddFunction(@SplitTPAExWrap,'procedure SplitTPAExWrap(arr: TPointArray; w, h: Integer; out res : T2DPointArray);'); -AddFunction(@SplitTPAWrap,'procedure SplitTPAWrap(arr: TPointArray; Dist: Integer; out res: T2DPointArray);'); -AddFunction(@FindGapsTPAWrap,'procedure FindGapsTPAWrap(TPA: TPointArray; MinPixels: Integer; out Res : T2DPointArray);'); -AddFunction(@RemoveDistTPointArrayWrap,'procedure RemoveDistTPointArrayWrap(x, y, dist: Integer; ThePoints: TPointArray; RemoveHigher: Boolean; out Res : TPointArray);'); -AddFunction(@CombineTPAWrap,'procedure CombineTPAWrap(Ar1, Ar2: TPointArray; out Res : TPointArray);'); -AddFunction(@ReArrangeandShortenArrayExWrap,'procedure ReArrangeandShortenArrayExWrap(a: TPointArray; w, h: Integer; out Res : TPointArray);'); -AddFunction(@ReArrangeandShortenArrayWrap,'procedure ReArrangeandShortenArrayWrap(a: TPointArray; Dist: Integer; out Res : TPointArray);'); -AddFunction(@TPAtoATPAExWrap,'procedure TPAtoATPAExWrap(TPA: TPointArray; w, h: Integer; out Res : T2DPointArray);'); -AddFunction(@TPAtoATPAWrap,'procedure TPAtoATPAWrap(TPA: TPointArray; Dist: Integer; out Res : T2DPointArray);'); -AddFunction(@CombineIntArrayWrap, 'procedure CombineIntArrayWrap(Ar1, Ar2: TIntegerArray; out Res : TIntegerArray);'); -AddFunction(@ReturnPointsNotInTPAWrap,'procedure ReturnPointsNotInTPAWrap(Const TotalTPA: TPointArray; const Box: TBox; out Res : TPointArray);'); -AddFunction(@MergeATPAWrap,'procedure MergeATPAWrap(ATPA : T2DPointArray; out Res: TPointArray);'); -AddFunction(@TPAFromBoxWrap,'procedure TPAFromBoxWrap(const Box : TBox; out Res : TPointArray);'); -AddFunction(@RotatePointsWrap,'procedure RotatePointsWrap(Const P: TPointArray; A, cx, cy: Extended; out Res : TPointArray);'); -AddFunction(@FindTPAEdgesWrap,'procedure FindTPAEdgesWrap(p: TPointArray; out Res : TPointArray);'); -AddFunction(@ClearTPAFromTPAWrap,'procedure ClearTPAFromTPAWrap(arP, ClearPoints: TPointArray; out Res : TPointArray);'); +AddFunction(@SplitTPAExWrap,'procedure SplitTPAExWrap(arr: TPointArray; w, h: Integer; var res : T2DPointArray);'); +AddFunction(@SplitTPAWrap,'procedure SplitTPAWrap(arr: TPointArray; Dist: Integer; var res: T2DPointArray);'); +AddFunction(@FindGapsTPAWrap,'procedure FindGapsTPAWrap(TPA: TPointArray; MinPixels: Integer; var Res : T2DPointArray);'); +AddFunction(@RemoveDistTPointArrayWrap,'procedure RemoveDistTPointArrayWrap(x, y, dist: Integer; ThePoints: TPointArray; RemoveHigher: Boolean; var Res : TPointArray);'); +AddFunction(@CombineTPAWrap,'procedure CombineTPAWrap(Ar1, Ar2: TPointArray; var Res : TPointArray);'); +AddFunction(@ReArrangeandShortenArrayExWrap,'procedure ReArrangeandShortenArrayExWrap(a: TPointArray; w, h: Integer; var Res : TPointArray);'); +AddFunction(@ReArrangeandShortenArrayWrap,'procedure ReArrangeandShortenArrayWrap(a: TPointArray; Dist: Integer; var Res : TPointArray);'); +AddFunction(@TPAtoATPAExWrap,'procedure TPAtoATPAExWrap(TPA: TPointArray; w, h: Integer; var Res : T2DPointArray);'); +AddFunction(@TPAtoATPAWrap,'procedure TPAtoATPAWrap(TPA: TPointArray; Dist: Integer; var Res : T2DPointArray);'); +AddFunction(@CombineIntArrayWrap, 'procedure CombineIntArrayWrap(Ar1, Ar2: TIntegerArray; var Res : TIntegerArray);'); +AddFunction(@ReturnPointsNotInTPAWrap,'procedure ReturnPointsNotInTPAWrap(Const TotalTPA: TPointArray; const Box: TBox; var Res : TPointArray);'); +AddFunction(@MergeATPAWrap,'procedure MergeATPAWrap(ATPA : T2DPointArray; var Res: TPointArray);'); +AddFunction(@TPAFromBoxWrap,'procedure TPAFromBoxWrap(const Box : TBox; var Res : TPointArray);'); +AddFunction(@RotatePointsWrap,'procedure RotatePointsWrap(Const P: TPointArray; A, cx, cy: Extended; var Res : TPointArray);'); +AddFunction(@FindTPAEdgesWrap,'procedure FindTPAEdgesWrap(p: TPointArray; var Res : TPointArray);'); +AddFunction(@ClearTPAFromTPAWrap,'procedure ClearTPAFromTPAWrap(arP, ClearPoints: TPointArray; var Res : TPointArray);'); diff --git a/trunk/Units/MMLAddon/mmlpsthread.pas b/trunk/Units/MMLAddon/mmlpsthread.pas index 493f3b4..538fc38 100644 --- a/trunk/Units/MMLAddon/mmlpsthread.pas +++ b/trunk/Units/MMLAddon/mmlpsthread.pas @@ -77,8 +77,8 @@ type ScriptPath, AppPath, IncludePath, PluginPath, FontPath: string; DebugTo: TWritelnProc; DebugImg : TDbgImgInfo; - PluginsToload : array of integer; ExportedMethods : TExpMethodArr; + procedure LoadPlugin(plugidx: integer); virtual; abstract; public Client : TClient; @@ -121,6 +121,8 @@ type Parser: TPSPascalPreProcessorParser; const Active: Boolean; const DirectiveName, DirectiveParam: string; var Continue: Boolean); protected + PluginsToload : array of integer; + procedure LoadPlugin(plugidx: integer); override; procedure OnCompile(Sender: TPSScript); function RequireFile(Sender: TObject; const OriginFileName: String; var FileName, OutPut: string): Boolean; @@ -143,6 +145,7 @@ type protected instance: pointer; added_methods: array of TExpMethod; + procedure LoadPlugin(plugidx: integer); override; public constructor Create(CreateSuspended: Boolean; TheSyncInfo : PSyncInfo; plugin_dir: string); destructor Destroy; override; @@ -264,7 +267,6 @@ begin Client := TClient.Create(plugin_dir); SyncInfo:= TheSyncInfo; ExportedMethods:= GetExportedMethods; - SetLength(PluginsToLoad,0); FreeOnTerminate := True; CompileOnly := false; OnTerminate := @OnThreadTerminate; @@ -274,7 +276,6 @@ end; destructor TMThread.Destroy; begin - SetLength(PluginsToLoad,0); Client.Free; inherited Destroy; end; @@ -313,13 +314,7 @@ begin if plugin_idx < 0 then psWriteln(Format('Your DLL %s has not been found',[DirectiveArgs])) else - begin; - for i := High(PluginsToLoad) downto 0 do - if PluginsToLoad[i] = plugin_idx then - Exit; - SetLength(PluginsToLoad,Length(PluginsToLoad)+1); - PluginsToLoad[High(PluginsToLoad)]:= plugin_idx; - end; + LoadPlugin(plugin_idx); end; end; result:= True; @@ -510,6 +505,18 @@ begin end; end; + +procedure TPSThread.LoadPlugin(plugidx: integer); +var + i: integer; +begin + for i := High(PluginsToLoad) downto 0 do + if PluginsToLoad[i] = plugidx then + Exit; + SetLength(PluginsToLoad,Length(PluginsToLoad)+1); + PluginsToLoad[High(PluginsToLoad)]:= plugidx; +end; + procedure TPSThread.OnCompile(Sender: TPSScript); var i,ii : integer; @@ -754,6 +761,20 @@ begin interp_meth(instance,meth.FuncPtr,PChar(meth.FuncDecl)); end; +procedure TCPThread.LoadPlugin(plugidx: integer); +var + i: integer; +begin + with PluginsGlob.MPlugins[plugidx] do + for i := 0 to MethodLen - 1 do + with Methods[i] do + begin + pswriteln(FuncStr); + interp_meth(self.instance,FuncPtr,PChar(FuncStr)); + end; + pswriteln('done') +end; + procedure TCPThread.Execute; var i,ii: integer; @@ -761,16 +782,32 @@ begin CurrThread := Self; Starttime := GetTickCount; psWriteln('Invoking CPascal Interpreter'); + interp_type(self.instance,'type longword = integer;'); + interp_type(self.instance,'type word = integer;'); + interp_type(self.instance,'type longint = integer;'); + interp_type(self.instance,'type pointer = integer;'); + interp_type(self.instance,'type byte = integer;'); interp_type(self.instance,'type extended = real;'); - interp_type(self.instance,'type tdtm = integer;'); - interp_type(self.instance,'type pdtm = ^tdtm;'); - interp_type(self.instance,'type TEIOS_Exported = record int1,int2,int3,int4,int5,int6,int7,int8,int9,int10,int11,int12,int13,int14:integer; end;'); - //interp_type(self.instance,'type pointer = integer;'); + interp_type(self.instance,'type tcolor = integer;'); + + interp_type(self.instance,'type TExtendedArray = array of extended;'); + interp_type(self.instance,'type T2DExtendedArray = array of array of extended;'); + interp_type(self.instance,'type TIntegerArray = array of integer;'); + + interp_type(self.instance,'type TBox = record X1,Y1,X2,Y2: integer; end;'); + interp_type(self.instance,'type TPoint = record x,y: integer; end;'); + interp_type(self.instance,'type TPointArray = array of TPoint;'); ; + interp_type(self.instance,'type T2DPointArray = array of array of TPoint;'); ; + interp_type(self.instance,'type TPointArrayArray = T2DPointArray;'); + + interp_type(self.instance,'type TTarget_Exported = record int1,int2,int3,int4,int5,int6,int7,int8,int9,int10,int11,int12,int13,int14:integer; end;'); + interp_type(self.instance,'type TMask = record White, Black : TPointArray; WhiteHi,BlackHi : integer; W,H : integer;end;'); + interp_type(self.instance,'type TDTMPointDef = record x, y, Color, Tolerance, AreaSize, AreaShape: integer; end;'); + interp_type(self.instance,'type TDTMPointDefArray = Array Of TDTMPointDef;'); + interp_type(self.instance,'type TDTM = record MainPoint: TDTMPointDef; SubPoints: TDTMPointDefArray; end;'); + interp_type(self.instance,'type pDTM = record l: Integer;p: TPointArray;c, t, asz, ash: TIntegerArray; bp: Array Of Boolean; n: String; end;'); + - for i := high(PluginsToLoad) downto 0 do - for ii := 0 to PluginsGlob.MPlugins[PluginsToLoad[i]].MethodLen - 1 do - with PluginsGlob.MPlugins[PluginsToLoad[i]].Methods[ii] do - interp_meth(self.instance,FuncPtr,PChar(FuncStr)); for i := 0 to high(ExportedMethods) do if ExportedMethods[i].FuncPtr <> nil then with ExportedMethods[i] do