..to add: in attachment my patch so far to the P4D files
diff -u _orig\Definition.Inc .\Definition.Inc
--- _orig\Definition.Inc Fri May 29 16:00:37 2009
+++ .\Definition.Inc Sun May 31 11:25:52 2009
@@ -33,7 +33,7 @@
//{$DEFINE PYTHON23}
//{$DEFINE PYTHON24}
//{$DEFINE PYTHON25}
-//{$DEFINE PYTHON26}
+{$DEFINE PYTHON26}
//{$DEFINE PYTHON30}
//{$DEFINE PYTHON31}
@@ -54,7 +54,7 @@
{$ENDIF}
/////////////////////////////////////////////////////////////////////////////
-// Delphi, C++ Builder and Kylix versions
+// Delphi, C++ Builder and Kylix and FreePascal/Lazarus versions
/////////////////////////////////////////////////////////////////////////////
{$IFDEF VER90} // Delphi 2.0
@@ -142,6 +142,14 @@
{$DEFINE DELPHI2007_OR_HIGHER}
{$ENDIF}
{$ENDIF}
+{$IFDEF FPC}
+ {$MODE DELPHI}{$H+}
+ {$DEFINE DELPHI4_OR_HIGHER}
+ {$DEFINE DELPHI5_OR_HIGHER}
+ {$DEFINE DELPHI6_OR_HIGHER}
+ {$DEFINE DELPHI7_OR_HIGHER}
+{$ENDIF}
+
/////////////////////////////////////////////////////////////////////////////
diff -u _orig\PythonAtom.pas .\PythonAtom.pas
--- _orig\PythonAtom.pas Fri May 29 16:00:37 2009
+++ .\PythonAtom.pas Sun May 31 21:32:31 2009
@@ -155,7 +155,7 @@
{** This helper function converts a python object into a python atom. Look at
the trivial implementation of this function for more informations.}
- function GetAtom(pObject : PPyObject) : OleVariant; {$IFDEF
DELPHI6_OR_HIGHER}deprecated{$ENDIF}
+ function GetAtom(pObject : PPyObject) : OleVariant; {$IFDEF
DELPHI6_OR_HIGHER}deprecated;{$ENDIF}
{$IFDEF DEBUG}
{** If this variable is set, (and DEBUG directive is defined) the strings is
diff -u _orig\PythonD6Decs.pas .\PythonD6Decs.pas
--- _orig\PythonD6Decs.pas Fri May 29 16:59:23 2009
+++ .\PythonD6Decs.pas Fri May 29 17:04:36 2009
@@ -949,7 +949,7 @@
result:= 1;
if(fLabel=nil) then exit;
result:= 0;
- fLabel.Caption:= PyObjectAsVariant(Value);
+ fLabel.Caption:= String(PyObjectAsVariant(Value));
end; end;
function TPyLabel.DoSetLayout(Value: PPyObject; Context: Pointer): integer;
@@ -966,7 +966,7 @@
result:= 1;
if(fLabel=nil) then exit;
result:= 0;
- fLabel.Transparent:= PyObjectAsVariant(Value);
+ fLabel.Transparent:= Boolean(PyObjectAsVariant(Value));
end; end;
function TPyLabel.DoSetWordWrap(Value: PPyObject;
@@ -1012,7 +1012,7 @@
result:= 1;
if(fForm=nil) then exit;
result:= 0;
- fForm.Caption:= PyObjectAsVariant(Value);
+ fForm.Caption:= String(PyObjectAsVariant(Value));
end; end;
class procedure TPyForm.RegisterGetSets(PythonType: TPythonType);
diff -u _orig\TinyWideStrings.pas .\TinyWideStrings.pas
--- _orig\TinyWideStrings.pas Fri May 29 16:00:37 2009
+++ .\TinyWideStrings.pas Fri May 29 19:57:09 2009
@@ -66,10 +66,11 @@
procedure TWideStringList.Error(const Msg: WideString; Data: Integer);
function ReturnAddr: Pointer;
+ {$IFDEF FPC} begin {$ENDIF}
asm
MOV EAX,[EBP+4]
end;
-
+ {$IFDEF FPC} end; {$ENDIF}
begin
raise EStringListError.CreateFmt(Msg, [Data]) at ReturnAddr;
end;
diff -u _orig\VarPyth.pas .\VarPyth.pas
--- _orig\VarPyth.pas Fri May 29 16:00:37 2009
+++ .\VarPyth.pas Sun May 31 20:43:47 2009
@@ -262,7 +262,9 @@
//------------------------------------------------------------------------------
{ Helper functions for porting VarPyth to FPC (Free Pascal Compiler) }
+
{$IFDEF FPC}
+{
procedure VarClear(var V : Variant);
begin
V := Unassigned;
@@ -275,6 +277,7 @@
else
Dest := Source;
end;
+ }
{$ENDIF}
//------------------------------------------------------------------------------
@@ -1051,10 +1054,10 @@
end
else
begin
- {$IFDEF FPC}
- {$HINT CVarTypeToElementInfo not yet implemented}
- RaiseDispError;
- {$ELSE}
+ //{$IFDEF FPC}
+ // {$HINT CVarTypeToElementInfo not yet implemented}
+ // RaiseDispError;
+ //{$ELSE}
LArguments[I].VType := LArgType;
case CVarTypeToElementInfo[LArgType].Size of
1, 2, 4:
@@ -1070,7 +1073,7 @@
else
RaiseDispError;
end;
- {$ENDIF}
+ //{$ENDIF}
end;
Inc(Integer(LParamPtr), SizeOf(Pointer));
end;
@@ -1394,6 +1397,7 @@
var
i : Integer;
+ flag:Boolean;
_container : PPyObject;
_obj : PPyObject;
_Arg : PPyObject;
@@ -1460,7 +1464,9 @@
// there's a special case: if we call a Python method without any
argument (like myList.sort()),
// the arguments list contains a single error variant.
- if (Length(Arguments) = 1) and VarDataIsEmptyParam(Arguments[0]) then
+
+ //if (Length(Arguments) = 1) and VarDataIsEmptyParam(Arguments[0])
then
+ if (Length(Arguments) = 1) and
VarIsEmptyParam(Variant((Arguments[0]))) then
_ArgLen := 0
else
_ArgLen := Length(Arguments);
@@ -1475,7 +1481,11 @@
_Args := PyTuple_New(_ArgLen);
try
for i := 0 to _ArgLen-1 do
+ {$IFDEF FPC}
+ PyTuple_SetItem( _Args, i, ArgAsPythonObject(_ArgLen-1 - i) );
+ {$ELSE}
PyTuple_SetItem( _Args, i, ArgAsPythonObject(i) );
+ {$ENDIF}
for i := 0 to Length(fNamedParams)-1 do
PyDict_SetItemString(_KW, PChar(fNamedParams[i].Name),
ArgAsPythonObject(fNamedParams[i].Index));
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus