-
-
Notifications
You must be signed in to change notification settings - Fork 318
changes to fix Lazarus and FreePascal compilation issues. #413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2571,6 +2571,9 @@ function TPyDelphiObject.Dir_Wrapper(args: PPyObject): PPyObject; | |
|
||
var | ||
PyType: PPyTypeObject; | ||
{$IFDEF FPC} | ||
i: longint; | ||
{$ENDIF} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i: Integer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe I addressed all the comments. Thank you for those. You can take a look at another commit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I meant in the ELSE part of EXTENDED_RTTI! You don't need IFDEF FPC. And use Integer instead of longint. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, now I see. Thank you for comments and your patience. Now I did it, but PR contains 3 commits. Do you want me to figure the way to change it for 1 commit? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so, do you like the current state of it? |
||
{$IFDEF EXTENDED_RTTI} | ||
Context: TRttiContext; | ||
RttiType: TRTTIType; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,8 @@ | |
interface | ||
|
||
uses | ||
Classes, SysUtils, PythonEngine, WrapDelphi; | ||
Classes, SysUtils, PythonEngine, WrapDelphi | ||
{$IFDEF FPC}, bufstream{$ENDIF}; | ||
|
||
type | ||
{ | ||
|
@@ -367,6 +368,7 @@ implementation | |
uses | ||
TypInfo {$IFNDEF FPC}, System.Rtti{$ENDIF}; | ||
|
||
|
||
{$IFNDEF FPC} | ||
type | ||
TPyReader = class(TReader) | ||
|
@@ -2223,7 +2225,12 @@ TBufferedFileStreamClass = class of TBufferedFileStream; | |
DelphiObject := TBufferedFileStreamClass(DelphiObjectClass).Create(String(LFileName), LMode, LBufferSize); | ||
end else if (LArgCount = 3) then begin | ||
if (APythonType.Engine.PyArg_ParseTupleAndKeywords(args, kwds, 'sHI|i:Create', @LKwArgs2[0], @LFileName, @LMode, @LRights, @LBufferSize) <> 0) then | ||
DelphiObject := TBufferedFileStreamClass(DelphiObjectClass).Create(String(LFileName), LMode, LRights, LBufferSize); | ||
{$IFDEF FPC} | ||
DelphiObject := TBufferedFileStreamClass(DelphiObjectClass).Create(String(LFileName), LMode, LRights); | ||
DelphiObject.Size:= LBufferSize; | ||
{$ELSE} | ||
DelphiObject := TBufferedFileStreamClass(DelphiObjectClass).Create(String(LFileName), LMode, LRights, LBufferSize); | ||
{$ENDIF} | ||
end; | ||
|
||
//Maybe it was created on the next attempt... | ||
|
@@ -2385,14 +2392,22 @@ TResourceStreamClass = class of TResourceStream; | |
{$ELSE} | ||
if APythonType.Engine.PyArg_ParseTuple(args, 'Iss:Create', @LHandle, @LResName, @LResType) <> 0 then | ||
{$ENDIF} | ||
{$IFDEF FPC} | ||
DelphiObject := TResourceStreamClass(DelphiObjectClass).Create(LHandle, String(LResName), PChar(String(LResType))) | ||
{$ELSE} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DelphiObject := TResourceStreamClass(DelphiObjectClass).Create(LHandle, String(LResName), PChar(String(LResType))) Should work in both fpc and Delphi. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
DelphiObject := TResourceStreamClass(DelphiObjectClass).Create(LHandle, String(LResName), PWideChar(String(LResType))) | ||
{$ENDIF} | ||
else | ||
{$IFDEF CPUX64} | ||
if APythonType.Engine.PyArg_ParseTuple(args, 'Kis:Create', @LHandle, @LResId, @LResType) <> 0 then | ||
{$ELSE} | ||
if APythonType.Engine.PyArg_ParseTuple(args, 'Iis:Create', @LHandle, @LResId, @LResType) <> 0 then | ||
{$ENDIF} | ||
{$IFDEF FPC} | ||
DelphiObject := TResourceStreamClass(DelphiObjectClass).CreateFromID(LHandle, LResId, PChar(String(LResType))); | ||
{$ELSE} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
DelphiObject := TResourceStreamClass(DelphiObjectClass).CreateFromID(LHandle, LResId, PWideChar(String(LResType))); | ||
{$ENDIF} | ||
except | ||
on E: Exception do | ||
with GetPythonEngine do | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NewSize := Utf8ToUnicode(PWideChar(Result), Cardinal(Size + 1), Buffer, Cardinal(Size));
Would work both in Delphi and Fpc.
PUnicodeChar is an alias to PWideChar;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true!