You've already forked lazarus-ccr
* Updated the gui-project for the new type-mappings
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2356 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -161,6 +161,7 @@ var
|
|||||||
IDLString: string;
|
IDLString: string;
|
||||||
pCurrent: pchar;
|
pCurrent: pchar;
|
||||||
AWord: string;
|
AWord: string;
|
||||||
|
LineNr: integer;
|
||||||
pWordStart: pchar;
|
pWordStart: pchar;
|
||||||
wordchars: set of char;
|
wordchars: set of char;
|
||||||
UUIDAttribute: string;
|
UUIDAttribute: string;
|
||||||
|
15
applications/idlparser/idltypemap.cfg
Normal file
15
applications/idlparser/idltypemap.cfg
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
wstring=PWideChar
|
||||||
|
string=PAnsiChar
|
||||||
|
boolean=longbool
|
||||||
|
FILE=PFILE
|
||||||
|
nsQIResult,out=
|
||||||
|
nsCIDRef,in=TGuid,constref
|
||||||
|
nsIIDRef,in=TGuid,constref
|
||||||
|
long=idllong
|
||||||
|
short=idlshort
|
||||||
|
float=idlfloat
|
||||||
|
long,unsigned=idlulong
|
||||||
|
short,unsigned=idlushort
|
||||||
|
float,unsigned=idlufloat
|
||||||
|
AUTF8String,f=AUTF8String,
|
||||||
|
DOMString,f=DOMString,
|
@@ -96,7 +96,7 @@ begin
|
|||||||
try
|
try
|
||||||
IDLList.OwnsObjects:=true;
|
IDLList.OwnsObjects:=true;
|
||||||
ParseFile(IDLList, memoIDLFile.Lines);
|
ParseFile(IDLList, memoIDLFile.Lines);
|
||||||
GeneratePascalSource(IDLList,memoPascalfile.Lines,TypeSettings.ValueListEditor1.Strings,TypeSettings.cTypes.Lines, cbParamPrefix.Checked);
|
GeneratePascalSource(IDLList,memoPascalfile.Lines,TypeSettings.ValueListEditor1.Strings, cbParamPrefix.Checked);
|
||||||
finally
|
finally
|
||||||
IDLList.Free;
|
IDLList.Free;
|
||||||
end;
|
end;
|
||||||
|
@@ -26,10 +26,10 @@ object TypeSettings: TTypeSettings
|
|||||||
AutoFillColumns = True
|
AutoFillColumns = True
|
||||||
FixedCols = 0
|
FixedCols = 0
|
||||||
FixedRows = 0
|
FixedRows = 0
|
||||||
RowCount = 3
|
RowCount = 4
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
Strings.Strings = (
|
Strings.Strings = (
|
||||||
'--=see lazarus bug 21480 '
|
'IDL-Type=Pascal-Type'
|
||||||
'wstring=PWideChar'
|
'wstring=PWideChar'
|
||||||
'boolean=longbool'
|
'boolean=longbool'
|
||||||
''
|
''
|
||||||
@@ -123,28 +123,6 @@ object TypeSettings: TTypeSettings
|
|||||||
ClientHeight = 277
|
ClientHeight = 277
|
||||||
ClientWidth = 253
|
ClientWidth = 253
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
object cTypes: TMemo
|
|
||||||
Left = 0
|
|
||||||
Height = 225
|
|
||||||
Top = 22
|
|
||||||
Width = 253
|
|
||||||
Align = alClient
|
|
||||||
Lines.Strings = (
|
|
||||||
'long'
|
|
||||||
'short'
|
|
||||||
'float'
|
|
||||||
)
|
|
||||||
TabOrder = 0
|
|
||||||
end
|
|
||||||
object Label3: TLabel
|
|
||||||
Left = 0
|
|
||||||
Height = 22
|
|
||||||
Top = 0
|
|
||||||
Width = 253
|
|
||||||
Align = alTop
|
|
||||||
Caption = 'List of c-types'
|
|
||||||
ParentColor = False
|
|
||||||
end
|
|
||||||
object pCListBottom: TPanel
|
object pCListBottom: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 30
|
Height = 30
|
||||||
@@ -152,31 +130,18 @@ object TypeSettings: TTypeSettings
|
|||||||
Width = 253
|
Width = 253
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 30
|
TabOrder = 0
|
||||||
ClientWidth = 253
|
end
|
||||||
TabOrder = 1
|
object Label1: TLabel
|
||||||
object bSaveClist: TButton
|
Left = 3
|
||||||
Left = 151
|
Height = 241
|
||||||
Height = 26
|
Top = 3
|
||||||
Top = 2
|
Width = 247
|
||||||
Width = 100
|
Align = alClient
|
||||||
Align = alRight
|
BorderSpacing.Around = 3
|
||||||
BorderSpacing.Around = 2
|
Caption = 'Each IDL-Type is transated into it''s corresponding Pascal-Type. '#10#10'There are some special cases. It could be that an idl-type has the flag ''unsigned''. You can specify how to handle this flag by adding '',unsigned'' to the IDL-typename. For example:'#10'long,unsigned=culong'#10'translated unsigned long types to the culong type from fpc''s ctypes unit.'#10#10'It is possible to specify to add ''var'',''constref'',''out'' or ''const'' when a type is passed as a variable, by adding '',var'', '',const'' etc to the Pascal-typename. For example'#10'pchar=char,var'#10'will adapt idl-type pchar parameters to ''var paramname: char''.'#10#10'In IDL it is possible to set a function parameter to ''in'',''out'' or ''inout''. To specify how to handle these you have to add '',in'','',out'' or '',inout'' to the IDL-typename. For example:'#10'nsCIDRef,in=TGuid,constref'#10'will translate nsCIDRef parameters which are marked with the ''in'' keyword to ''constref AParamName: TGuid''.'#10#10'When the Pascal-type is left empty, A parameter is translated to ''out ParamName'' with further no additions.'#10#10'When the IDL-parses has to do something special when a given IDL-type is a function result, add the '',f'' suffix to the IDL-typename. When the Pascal-typename of such a rule contains a comma (,) the parameter will be forced to be passed as a parameter, and not as a function result.'
|
||||||
Caption = 'Save to file'
|
ParentColor = False
|
||||||
OnClick = bSaveClistClick
|
WordWrap = True
|
||||||
TabOrder = 0
|
|
||||||
end
|
|
||||||
object bLoadCList: TButton
|
|
||||||
Left = 2
|
|
||||||
Height = 26
|
|
||||||
Top = 2
|
|
||||||
Width = 100
|
|
||||||
Align = alLeft
|
|
||||||
BorderSpacing.Around = 2
|
|
||||||
Caption = 'Load from file'
|
|
||||||
OnClick = bLoadCListClick
|
|
||||||
TabOrder = 1
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object OpenDialog: TOpenDialog
|
object OpenDialog: TOpenDialog
|
||||||
|
@@ -43,13 +43,10 @@ type
|
|||||||
{ TTypeSettings }
|
{ TTypeSettings }
|
||||||
|
|
||||||
TTypeSettings = class(TForm)
|
TTypeSettings = class(TForm)
|
||||||
bLoadCList: TButton;
|
|
||||||
bSaveMap: TButton;
|
bSaveMap: TButton;
|
||||||
bLoadMap: TButton;
|
bLoadMap: TButton;
|
||||||
bSaveClist: TButton;
|
Label1: TLabel;
|
||||||
cTypes: TMemo;
|
|
||||||
Label2: TLabel;
|
Label2: TLabel;
|
||||||
Label3: TLabel;
|
|
||||||
OpenDialog: TOpenDialog;
|
OpenDialog: TOpenDialog;
|
||||||
pMapBottom: TPanel;
|
pMapBottom: TPanel;
|
||||||
pCListBottom: TPanel;
|
pCListBottom: TPanel;
|
||||||
@@ -58,9 +55,7 @@ type
|
|||||||
SaveDialog: TSaveDialog;
|
SaveDialog: TSaveDialog;
|
||||||
Splitter1: TSplitter;
|
Splitter1: TSplitter;
|
||||||
ValueListEditor1: TValueListEditor;
|
ValueListEditor1: TValueListEditor;
|
||||||
procedure bLoadCListClick(Sender: TObject);
|
|
||||||
procedure bLoadMapClick(Sender: TObject);
|
procedure bLoadMapClick(Sender: TObject);
|
||||||
procedure bSaveClistClick(Sender: TObject);
|
|
||||||
procedure bSaveMapClick(Sender: TObject);
|
procedure bSaveMapClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
{ private declarations }
|
{ private declarations }
|
||||||
@@ -83,18 +78,6 @@ begin
|
|||||||
ValueListEditor1.Strings.LoadFromFile(OpenDialog.FileName);
|
ValueListEditor1.Strings.LoadFromFile(OpenDialog.FileName);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTypeSettings.bSaveClistClick(Sender: TObject);
|
|
||||||
begin
|
|
||||||
if SaveDialog.Execute then
|
|
||||||
cTypes.Lines.SaveToFile(SaveDialog.FileName);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TTypeSettings.bLoadCListClick(Sender: TObject);
|
|
||||||
begin
|
|
||||||
if OpenDialog.Execute then
|
|
||||||
cTypes.Lines.LoadFromFile(OpenDialog.FileName);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TTypeSettings.bSaveMapClick(Sender: TObject);
|
procedure TTypeSettings.bSaveMapClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if SaveDialog.Execute then
|
if SaveDialog.Execute then
|
||||||
|
@@ -6,11 +6,11 @@ It could be that it can be used or extended to parse idl-files from other
|
|||||||
projects, but I never tested that.
|
projects, but I never tested that.
|
||||||
|
|
||||||
The generated Pascal-sources are as close as possible to the original idl
|
The generated Pascal-sources are as close as possible to the original idl
|
||||||
files. C-types are converted to their corresponding types in fpc's ctypes
|
files.
|
||||||
unit.
|
|
||||||
|
|
||||||
It is possible to map some types from their idl to Pascal name. You can also
|
It is possible to specify what to do with each idl-type and how to
|
||||||
specify which types have to be converted to their ctypes-unit equivalent.
|
translate them into Pascal code. These settings are passed in a separate
|
||||||
|
configuration file. An example of such a file is idltypemap.cfg.
|
||||||
|
|
||||||
All files are licensed by the modified LGPL, as used in the Lazarus LCL.
|
All files are licensed by the modified LGPL, as used in the Lazarus LCL.
|
||||||
|
|
||||||
@@ -18,4 +18,4 @@ I hope this is useful for someone,
|
|||||||
|
|
||||||
Joost van der Sluis, CNOC
|
Joost van der Sluis, CNOC
|
||||||
|
|
||||||
March 14, 2012
|
March 19, 2012
|
||||||
|
Reference in New Issue
Block a user