#1 2014-09-26 17:53:03

RalfS
Member
Registered: 2011-07-11
Posts: 57

SynCommon.pas

Please would you split up SynCommon.pas into at least 10 units? 1.5MB is very hard to handle. Half an hour for scrolling bothers...
Thank you!

Offline

#2 2014-09-26 18:10:03

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,666
Website

Re: SynCommon.pas

Why are you scrolling it?
Just use the search function.
We spend hours in this unit without problems.

Most classes are coupled, so we can't easily divide the unit, I'm afraid.

Offline

#3 2014-09-26 19:41:47

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

Re: SynCommon.pas

I vote not to split it. Even more - I merge many of my modules in one. Just a sample huw I use SynCommons: consider I want do something with JSON. I press Ctrl+G, type JSON. And vuala:-)

Offline

#4 2014-09-26 23:07:02

RalfS
Member
Registered: 2011-07-11
Posts: 57

Re: SynCommon.pas

This unit does not work with D6 very well.

I get not reproducible Debugger crash (Delphi 6) here:

InitSynCommonConversionTables;
or
RetrieveSystemInfo;

Last edited by RalfS (2014-09-27 14:18:18)

Offline

#5 2014-09-27 14:20:06

RalfS
Member
Registered: 2011-07-11
Posts: 57

Re: SynCommon.pas

This unit does not work with D6 very well.

I get not reproducible Debugger crash (Delphi 6) here:

InitSynCommonConversionTables;
or
RetrieveSystemInfo;

Offline

#6 2014-09-27 20:29:08

RalfS
Member
Registered: 2011-07-11
Posts: 57

Re: SynCommon.pas

bugfix1:

  {$ifdef DOPATCHTRTL}
  if DebugHook=0 then // patch VCL/RTL only outside debugging
    InitRedirectCode;
  {$endif}

bugfix2:

{$define PUREPASCAL}

Last edited by RalfS (2014-09-27 21:07:34)

Offline

#7 2014-09-27 21:02:53

RalfS
Member
Registered: 2011-07-11
Posts: 57

Re: SynCommon.pas

bugfix3:


Following procedures don't respect the PurePascal define:

function SystemFillCharAddress: Pointer;
procedure CopyArray(dest, source, typeInfo: Pointer; cnt: PtrUInt);
procedure _Finalize(Data: Pointer; TypeInfo: Pointer);
procedure RecordCopy(var Dest; const Source; TypeInfo: pointer);
procedure RecordClear(var Dest; TypeInfo: pointer);
function VariantsDispInvokeAddress: pointer;
procedure _DynArrayClear(var a: Pointer; typeInfo: Pointer);
procedure _FinalizeArray(p: Pointer; typeInfo: Pointer; elemCount: PtrUInt);
procedure SynRtlUnwind(TargetFrame, TargetIp: pointer; ExceptionRecord: PExceptionRecord; ReturnValue: Pointer); stdcall;
function TSynLog._Release: Integer;
class function TSynLog.Enter(aInstance: TObject; aMethodName: PUTF8Char; aMethodNameLocal: boolean): ISynLog;
procedure TSynLog.Log(Level: TSynLogInfo);
procedure AddStackManual(Stack: PPtrUInt);

64bit:
function StrInt32(P: PAnsiChar; val: PtrInt): PAnsiChar;
function StrUInt32(P: PAnsiChar; val: PtrUInt): PAnsiChar;
function bswap32(a: cardinal): cardinal; {$ifdef FPC}nostackframe; assembler;{$endif}
function StrLen(S: pointer): PtrInt;

Offline

#8 2014-09-28 10:32:14

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: SynCommon.pas

While in a perfect world I wish this huge SynCommon.pas unit will be split into smaller modules (for a lot of good reasons), but I can easily live with its current statues. Aside from Ctrl+G MVP mentioned, you can also utilize the GREP search function of GExperts.


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#9 2014-09-28 18:48:23

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,666
Website

Re: SynCommon.pas

@Ralf
I used the unit with Delphi 6 daily for almost 4 years, at my previous work, when maintaining huge application.

Defining PUREPASCAL for Delphi 6 is dubious. This is not the solution. It is like using a nuclear bomb to catch a fly.
The asm version of PUREPASCAL are in fact needed, when patching the low-level RTL, or to use the optimized x86/x64 version.
Outside Win32/Win64, PUREPASCAL will in fact be pure pascal - and work with ARM (we are currently making all our units compatible with FPC and also ARM, so I know what I say a little).
I suspect you are changing the default options of Synopse.inc, e.g. adding range checking or such for our units.

We run the automated tests with Delphi 6 here without any issue.
And use SynCommons in production worldwide with Delphi 6 compiled applications.
Could you say more about your problem?
Perhaps un-defining DOPATCHTRTL conditional may help you.

Offline

#10 2014-09-28 21:00:00

RalfS
Member
Registered: 2011-07-11
Posts: 57

Re: SynCommon.pas

I had several crashes of program and debugger in D6. Undefing DOPATCHTRTL and using PurePascal solve 2 of them. See post above. I prefer not having manipulations on my RTL/VCL. This is the cause for most problems I had so far.

Offline

#11 2014-09-29 08:29:14

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,666
Website

Re: SynCommon.pas

Where does it crash? Are you using SynCommons in packages? Did you change Synopse.inc?

DOPATCHTRTL and PUREPASCAL have a wide code scope - we need to identify what is wrong in your case.
Disabling them is not a viable solution.

Offline

#12 2014-09-30 14:44:30

RalfS
Member
Registered: 2011-07-11
Posts: 57

Re: SynCommon.pas

You should apply bugfix1 first. Second question: What is PurePascal for when its not a solution?

Offline

#13 2014-10-01 10:12:18

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,666
Website

Re: SynCommon.pas

I have applied bugfix 1.
See http://synopse.info/fossil/info/0a1175cf9b
Thanks for the report.

PUREPASCAL is to be used when compiled e.g. on ARM CPU (for future FPC / Linux).

Offline

#14 2014-10-02 18:46:08

RalfS
Member
Registered: 2011-07-11
Posts: 57

Re: SynCommon.pas

Thanks!

Offline

#15 2014-10-03 15:50:40

RalfS
Member
Registered: 2011-07-11
Posts: 57

Re: SynCommon.pas

RedirtectCode is being called in SynRegisterCustomVariantType when  DoPatchRTL is off.

Offline

#16 2014-10-04 10:11:39

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,666
Website

Re: SynCommon.pas

Could you please create a ticket, with a link to this forum thread?
Thanks!

Offline

Board footer

Powered by FluxBB