From 2cee56c20e1ab7088495c05a2dd49fedd34ccb74 Mon Sep 17 00:00:00 2001 From: Raymond Date: Fri, 5 Feb 2010 16:30:42 +0000 Subject: [PATCH] Made wrapper for Random(). git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@523 3f818213-9676-44b0-a9b4-5e4c4e03d09d --- trunk/Units/MMLAddon/PSInc/Wrappers/other.inc | 5 +++++ trunk/Units/MMLAddon/PSInc/psexportedmethods.inc | 4 ++-- trunk/Units/MMLAddon/mmlpsthread.pas | 12 ++++++++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/trunk/Units/MMLAddon/PSInc/Wrappers/other.inc b/trunk/Units/MMLAddon/PSInc/Wrappers/other.inc index c2bea6b..4acbc26 100644 --- a/trunk/Units/MMLAddon/PSInc/Wrappers/other.inc +++ b/trunk/Units/MMLAddon/PSInc/Wrappers/other.inc @@ -125,3 +125,8 @@ procedure HakunaMatata; extdecl; begin; OpenWebPage('http://www.youtube.com/v/ejEVczA8PLU&hl=en&fs=1&autoplay=1'); end; + +function ps_Random(Int: integer): integer; extdecl; +begin + result := Random(int); +end; diff --git a/trunk/Units/MMLAddon/PSInc/psexportedmethods.inc b/trunk/Units/MMLAddon/PSInc/psexportedmethods.inc index a4ce04d..591d96c 100644 --- a/trunk/Units/MMLAddon/PSInc/psexportedmethods.inc +++ b/trunk/Units/MMLAddon/PSInc/psexportedmethods.inc @@ -122,7 +122,7 @@ AddFunction(@TerminateScript,'procedure TerminateScript;'); AddFunction(@DisplayDebugImgWindow,'procedure DisplayDebugImgWindow(w, h: integer);'); AddFunction(@DrawBitmapDebugImg,'procedure DrawBitmapDebugImg(bmp: integer);'); AddFunction(@GetDebugBitmap,'function GetDebugBitmap: integer;'); -AddFunction(@Random,'function Random(Int: integer): integer;'); +AddFunction(@ps_Random,'function Random(Int: integer): integer;'); AddFunction(@ClearDebug,'procedure ClearDebug;'); @@ -307,7 +307,7 @@ AddFunction(@LinearSort,'procedure LinearSort(var tpa: TPointArray; cx, cy, sd: AddFunction(@MergeATPA,'Function MergeATPA(ATPA : T2DPointArray) : TPointArray;'); AddFunction(@TPAFromBox,'function TPAFromBox(const Box : TBox) : TPointArray;'); AddFunction(@RotatePoints,'Function RotatePoints(Const P: TPointArray; A, cx, cy: Extended): TPointArray ;'); -AddFunction(@RotatePoint,'Function RotatePoint(Const p: TPoint; angle, mx, my: Extended): TPoint; inline;'); +AddFunction(@RotatePoint,'Function RotatePoint(Const p: TPoint; angle, mx, my: Extended): TPoint;'); AddFunction(@FindTPAEdges,'function FindTPAEdges(p: TPointArray): TPointArray;'); AddFunction(@PointInTPA,'function PointInTPA(p: TPoint; arP: TPointArray): Boolean;'); AddFunction(@ClearTPAFromTPA,'function ClearTPAFromTPA(arP, ClearPoints: TPointArray): TPointArray;'); diff --git a/trunk/Units/MMLAddon/mmlpsthread.pas b/trunk/Units/MMLAddon/mmlpsthread.pas index 685e588..258b1ca 100644 --- a/trunk/Units/MMLAddon/mmlpsthread.pas +++ b/trunk/Units/MMLAddon/mmlpsthread.pas @@ -389,18 +389,14 @@ end; {$I PSInc/Wrappers/other.inc} {$I PSInc/Wrappers/bitmap.inc} {$I PSInc/Wrappers/window.inc} - {$I PSInc/Wrappers/strings.inc} - {$I PSInc/Wrappers/colour.inc} {$I PSInc/Wrappers/math.inc} {$I PSInc/Wrappers/mouse.inc} {$I PSInc/Wrappers/file.inc} - {$I PSInc/Wrappers/keyboard.inc} {$I PSInc/Wrappers/dtm.inc} {$I PSInc/Wrappers/ocr.inc} - {$I PSInc/Wrappers/internets.inc} class function TMThread.GetExportedMethods: TExpMethodArr; @@ -453,6 +449,8 @@ end; } constructor TPSThread.Create(CreateSuspended : boolean; TheSyncInfo : PSyncInfo; plugin_dir: string); +var + I : integer; begin PSScript := TPSScript.Create(nil); PSScript.UsePreProcessor:= True; @@ -466,6 +464,12 @@ begin // Set some defines {$I PSInc/psdefines.inc} inherited Create(CreateSuspended, TheSyncInfo, plugin_dir); + for i := 0 to high(ExportedMethods) do + if pos('Writeln',exportedmethods[i].FuncDecl) > 0 then + begin + ExportedMethods[i].FuncPtr := nil; + break; + end; end;