View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0022677||Lazarus||Converter||public||2012-08-19 15:43||2012-09-30 22:04|
|Reporter||Bart Broersma||Assigned To||Juha Manninen|
|Product Version||1.1 (SVN)|
|Fixed in Version||1.1 (SVN)|
|Summary||0022677: Converter does not handle (alias) Wintypes and Winproc units in old Delphi projects|
|Description||Very old Delphi units may still use the (no longer existing) Wintypes and Winproc units.|
Delphi silently ignores these and uses Windows unit as an alias.
The converter leaves them in place.
If the user selects multi-platform, the converter should probably drop these units in the uses clause, if the user wants delphi compatibility only, then they should be replaced by Windows unit.
|Tags||No tags attached.|
|Fixed in Revision||r38903|
There are settings to remove those units.
Does it not work? Please upload a test project.
pasparser_bron.zip (9,345 bytes)
See attached pasparser_bron.zip.
This was my test project for testing the converter issue 0022630
The unit nldlg32.pas has wintypes and winprocs in it's uses clause.
If I convert the project (Tools -> Convert Delphi Project to Lazarus Project), using default settings in the dialog, it will leave the wintypes and windproc in place.
A snippet after conversion:
uses SysUtils, WinTypes, WinProcs, Messages, Classes,
Graphics, Controls, Forms, Dialogs, StdCtrls,
The odd thing is that, if I only convert this unit (Tools -> Convert Delphi Unit to Lazarus Unit), again using default settings in the dialog, now the wintypes and windproc units are removed from the uses clause.
Now it looks like this:
uses SysUtils, Messages, Classes,
Graphics, Controls, Forms, Dialogs, StdCtrls,
Now I understand what is happening.
My assumption was that when converting a project, it would also convert all units the project uses.
However it only seems to convert the units that are in the uses section of the .dpr file.
So when converting my attached test project, it actually does _not_ try to convert the nldlg32.pas unit at all (used in the main form: pasparser.pas).
Is this by design (which is confusing to me, from the perspective of the end user), or is this an oversight?
Yes it should be converted.
The problem IMO is that those Windows specific units are not reported as missing when you work on Windows. When a unit is not missing, the converter doesn't do anything for it.
There is a hack to deal with those units, I already improved it but didn't commit yet. I will do it later tonight with other commits...
Your uses section does not have Winodws unit at all. How come?
Please test with r38343.
See the new function IsWinSpecificUnit and how it is used.
If the Windows unit is missing completely, maybe we need to replace those other units with 'LCLIntf, LCLType, LMessages'
> Your uses section does not have Winodws unit at all. How come?
IIRC Delphi silently replaces Wintypes and Winprocs with Windows.
It's a very old unit...
> If the Windows unit is missing completely, maybe we need to replace those
> other units with 'LCLIntf, LCLType, LMessages'
I'll re-test soon and report back to you.
Tetsed with r38343, converting the pasparser.dpr project.
It still does not convert the nldlg32.pas (nor the misc.pas) unit (at least TUsedUnitsTool.Prepare is never called for any of these units), it only converts pasparser.dpr and upasparser.pas units.
> It still does not convert the nldlg32.pas ...
I finally fixed this is r38903. Please test again.
The reason was that units in project directory which are not part of the project were not reported as missing and thus not converted.
r38904 also replaces "WinTypes" and "WinProcs" the same way as "Windows" is replaced.
See if it is correct.
It now converts both misc.pas and nldlg32.pas
As a side note: I saw it replaces any call to Shellexecute with a call to OpenDocument, which is wrong in this particular unit (misc.pas).
Can this be controlled by the user somehow?
Anyhow. You can resolve this issue as fixed.
You can edit Function Replacements in the converter settings dialog.
Disabling the WindowsAPI category is one handy way.
You cannot disable it for one unit only, the setting affects all units.
We can continue discussing it on mailing list if needed.
|2012-08-19 15:43||Bart Broersma||New Issue|
|2012-08-19 15:43||Bart Broersma||Status||new => assigned|
|2012-08-19 15:43||Bart Broersma||Assigned To||=> Juha Manninen|
|2012-08-19 15:43||Bart Broersma||LazTarget||=> -|
|2012-08-19 22:21||Juha Manninen||Note Added: 0061728|
|2012-08-19 22:21||Juha Manninen||Status||assigned => feedback|
|2012-08-19 23:46||Bart Broersma||File Added: pasparser_bron.zip|
|2012-08-19 23:54||Bart Broersma||Note Added: 0061731|
|2012-08-20 00:05||Bart Broersma||Note Edited: 0061731|
|2012-08-21 21:32||Juha Manninen||Relationship added||related to 0022630|
|2012-08-22 14:19||Bart Broersma||Note Added: 0061808|
|2012-08-22 19:53||Juha Manninen||Note Added: 0061813|
|2012-08-23 08:25||Juha Manninen||Note Added: 0061821|
|2012-08-23 23:48||Bart Broersma||Note Added: 0061845|
|2012-08-26 11:34||Bart Broersma||Note Added: 0061907|
|2012-09-29 16:56||Juha Manninen||Note Added: 0062736|
|2012-09-29 22:56||Bart Broersma||Note Added: 0062745|
|2012-09-30 00:45||Juha Manninen||Fixed in Revision||=> r38903|
|2012-09-30 00:45||Juha Manninen||Status||feedback => resolved|
|2012-09-30 00:45||Juha Manninen||Resolution||open => fixed|
|2012-09-30 00:45||Juha Manninen||Note Added: 0062751|
|2012-09-30 22:04||Bart Broersma||Status||resolved => closed|
|2012-09-30 22:04||Bart Broersma||Note Added: 0062783|
|2012-09-30 22:04||Bart Broersma||Fixed in Version||=> 1.1 (SVN)|