You've already forked lazarus-ccr
chelper: added library name for external functions
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1299 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -48,6 +48,7 @@ begin
|
|||||||
cfg.RefTypeNamePrefix:=ini.ReadString('Main','RefTypeNamePrefix',cfg.RefTypeNamePrefix);
|
cfg.RefTypeNamePrefix:=ini.ReadString('Main','RefTypeNamePrefix',cfg.RefTypeNamePrefix);
|
||||||
cfg.FuncConv:=ini.ReadString('Main','FuncConv',cfg.FuncConv);
|
cfg.FuncConv:=ini.ReadString('Main','FuncConv',cfg.FuncConv);
|
||||||
cfg.FuncDeclPostfix:=ini.ReadString('Main','FuncDeclPostfix',cfg.FuncDeclPostfix);
|
cfg.FuncDeclPostfix:=ini.ReadString('Main','FuncDeclPostfix',cfg.FuncDeclPostfix);
|
||||||
|
cfg.ExtLibName:=ini.ReadString('Main','ExtLibName',cfg.ExtLibName);
|
||||||
cfg.ParamPrefix:=ini.ReadString('Main','ParamPrefix',cfg.ParamPrefix);
|
cfg.ParamPrefix:=ini.ReadString('Main','ParamPrefix',cfg.ParamPrefix);
|
||||||
finally
|
finally
|
||||||
ini.Free;
|
ini.Free;
|
||||||
@ -78,6 +79,7 @@ begin
|
|||||||
ini.WriteString('Main','FuncConv',cfg.FuncConv);
|
ini.WriteString('Main','FuncConv',cfg.FuncConv);
|
||||||
ini.WriteString('Main','FuncDeclPostfix',cfg.FuncDeclPostfix);
|
ini.WriteString('Main','FuncDeclPostfix',cfg.FuncDeclPostfix);
|
||||||
ini.WriteString('Main','ParamPrefix',cfg.ParamPrefix);
|
ini.WriteString('Main','ParamPrefix',cfg.ParamPrefix);
|
||||||
|
ini.WriteString('Main','ExtLibName',cfg.ExtLibName);
|
||||||
finally
|
finally
|
||||||
ini.Free;
|
ini.Free;
|
||||||
end;
|
end;
|
||||||
|
@ -22,7 +22,7 @@ program cconvert;
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
SysUtils,Classes,
|
SysUtils,Classes,
|
||||||
ctopasconvert,cparsertypes, cparserutils,cconvconfig, objcparsing;
|
ctopasconvert,cparsertypes, cparserutils, cconvconfig, objcparsing;
|
||||||
|
|
||||||
var
|
var
|
||||||
ConfigFile : AnsiString = '';
|
ConfigFile : AnsiString = '';
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
</Item2>
|
</Item2>
|
||||||
<Item3>
|
<Item3>
|
||||||
<Filename Value="extconvdialog.pas"/>
|
<Filename Value="extconvdialog.pas"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
<UnitName Value="extconvdialog"/>
|
<UnitName Value="extconvdialog"/>
|
||||||
</Item3>
|
</Item3>
|
||||||
<Item4>
|
<Item4>
|
||||||
|
@ -45,6 +45,7 @@ type
|
|||||||
TypeNamePrefix : AnsiString;
|
TypeNamePrefix : AnsiString;
|
||||||
RefTypeNamePrefix : AnsiString;
|
RefTypeNamePrefix : AnsiString;
|
||||||
FuncConv : AnsiString;
|
FuncConv : AnsiString;
|
||||||
|
ExtLibName : AnsiString;
|
||||||
FuncDeclPostfix : AnsiString;
|
FuncDeclPostfix : AnsiString;
|
||||||
ParamPrefix : AnsiString;
|
ParamPrefix : AnsiString;
|
||||||
|
|
||||||
@ -1117,7 +1118,9 @@ begin
|
|||||||
wr.W(GetPasTypeName(cent.RetType, n.owner));
|
wr.W(GetPasTypeName(cent.RetType, n.owner));
|
||||||
end;
|
end;
|
||||||
wr.W(';');
|
wr.W(';');
|
||||||
if isDeclExternal(cfg, cent.RetType, isfunc) then wr.W(' external;');
|
if isDeclExternal(cfg, cent.RetType, isfunc) then wr.W(' external');
|
||||||
|
if cfg.ExtLibName<>'' then wr.W(' '+cfg.ExtLibName);
|
||||||
|
wr.W(';');
|
||||||
if WriteComment then WriteLnCommentForOffset(cent.Offset);
|
if WriteComment then WriteLnCommentForOffset(cent.Offset);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -1,39 +1,39 @@
|
|||||||
object CtoPasConfig: TCtoPasConfig
|
object CtoPasConfig: TCtoPasConfig
|
||||||
Left = 336
|
Left = 406
|
||||||
Height = 446
|
Height = 584
|
||||||
Top = 231
|
Top = 128
|
||||||
Width = 655
|
Width = 668
|
||||||
Caption = 'C to Pascal settings'
|
Caption = 'C to Pascal settings'
|
||||||
ClientHeight = 446
|
ClientHeight = 584
|
||||||
ClientWidth = 655
|
ClientWidth = 668
|
||||||
OnClose = FormClose
|
OnClose = FormClose
|
||||||
OnResize = FormResize
|
OnResize = FormResize
|
||||||
LCLVersion = '0.9.29'
|
LCLVersion = '0.9.29'
|
||||||
object Notebook1: TNotebook
|
object Notebook1: TNotebook
|
||||||
Left = 16
|
Left = 16
|
||||||
Height = 421
|
Height = 559
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 622
|
Width = 635
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
PageIndex = 1
|
PageIndex = 0
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object pageMain: TPage
|
object pageMain: TPage
|
||||||
Caption = 'Main'
|
Caption = 'Main'
|
||||||
ClientWidth = 616
|
ClientWidth = 629
|
||||||
ClientHeight = 382
|
ClientHeight = 520
|
||||||
object Panel1: TPanel
|
object Panel1: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 172
|
Height = 228
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 616
|
Width = 629
|
||||||
Align = alTop
|
Align = alTop
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 172
|
ClientHeight = 228
|
||||||
ClientWidth = 616
|
ClientWidth = 629
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object Label1: TLabel
|
object Label1: TLabel
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 18
|
Height = 17
|
||||||
Top = 5
|
Top = 5
|
||||||
Width = 150
|
Width = 150
|
||||||
Caption = 'Pascal code generation:'
|
Caption = 'Pascal code generation:'
|
||||||
@ -58,27 +58,34 @@ object CtoPasConfig: TCtoPasConfig
|
|||||||
object chkEnums: TCheckBox
|
object chkEnums: TCheckBox
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 18
|
Height = 18
|
||||||
Top = 107
|
Top = 132
|
||||||
Width = 244
|
Width = 244
|
||||||
Caption = 'Enumerations are Integer constants'
|
Caption = 'Enumerations are Integer constants'
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
end
|
end
|
||||||
object Label3: TLabel
|
object lblCallConv: TLabel
|
||||||
Left = 197
|
AnchorSideLeft.Control = chkFuncAreExt
|
||||||
Height = 18
|
AnchorSideLeft.Side = asrBottom
|
||||||
Top = 70
|
Left = 187
|
||||||
Width = 115
|
Height = 17
|
||||||
|
Top = 71
|
||||||
|
Width = 118
|
||||||
|
BorderSpacing.Left = 20
|
||||||
Caption = 'Calling convention'
|
Caption = 'Calling convention'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object cmbCallConv: TComboBox
|
object cmbCallConv: TComboBox
|
||||||
|
AnchorSideLeft.Control = lblCallConv
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
Left = 325
|
Left = 325
|
||||||
Height = 21
|
Height = 21
|
||||||
Top = 67
|
Top = 70
|
||||||
Width = 160
|
Width = 160
|
||||||
|
BorderSpacing.Left = 20
|
||||||
ItemHeight = 0
|
ItemHeight = 0
|
||||||
ItemIndex = 0
|
ItemIndex = 1
|
||||||
Items.Strings = (
|
Items.Strings = (
|
||||||
|
'(empty)'
|
||||||
'cdecl'
|
'cdecl'
|
||||||
'stdcall'
|
'stdcall'
|
||||||
'mwpascal'
|
'mwpascal'
|
||||||
@ -88,10 +95,10 @@ object CtoPasConfig: TCtoPasConfig
|
|||||||
Text = 'cdecl'
|
Text = 'cdecl'
|
||||||
end
|
end
|
||||||
object lblDefines: TLabel
|
object lblDefines: TLabel
|
||||||
Left = 11
|
Left = 6
|
||||||
Height = 18
|
Height = 17
|
||||||
Top = 136
|
Top = 172
|
||||||
Width = 51
|
Width = 52
|
||||||
Caption = 'Defines:'
|
Caption = 'Defines:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
@ -99,10 +106,10 @@ object CtoPasConfig: TCtoPasConfig
|
|||||||
AnchorSideLeft.Control = lblDefines
|
AnchorSideLeft.Control = lblDefines
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideRight.Control = btnSelect
|
AnchorSideRight.Control = btnSelect
|
||||||
Left = 68
|
Left = 64
|
||||||
Height = 22
|
Height = 21
|
||||||
Top = 136
|
Top = 172
|
||||||
Width = 376
|
Width = 388
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.Right = 6
|
BorderSpacing.Right = 6
|
||||||
@ -110,9 +117,9 @@ object CtoPasConfig: TCtoPasConfig
|
|||||||
end
|
end
|
||||||
object btnSelect: TButton
|
object btnSelect: TButton
|
||||||
AnchorSideRight.Control = btnEdit
|
AnchorSideRight.Control = btnEdit
|
||||||
Left = 450
|
Left = 458
|
||||||
Height = 20
|
Height = 20
|
||||||
Top = 136
|
Top = 172
|
||||||
Width = 70
|
Width = 70
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
@ -122,49 +129,69 @@ object CtoPasConfig: TCtoPasConfig
|
|||||||
TabOrder = 5
|
TabOrder = 5
|
||||||
end
|
end
|
||||||
object btnEdit: TButton
|
object btnEdit: TButton
|
||||||
Left = 540
|
Left = 548
|
||||||
Height = 20
|
Height = 20
|
||||||
Top = 136
|
Top = 172
|
||||||
Width = 70
|
Width = 70
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
Caption = 'Edit'
|
Caption = 'Edit'
|
||||||
OnClick = btnEditClick
|
OnClick = btnEditClick
|
||||||
TabOrder = 6
|
TabOrder = 6
|
||||||
end
|
end
|
||||||
|
object txtLibName: TEdit
|
||||||
|
AnchorSideLeft.Control = cmbCallConv
|
||||||
|
Left = 325
|
||||||
|
Height = 22
|
||||||
|
Top = 100
|
||||||
|
Width = 293
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
TabOrder = 7
|
||||||
|
end
|
||||||
|
object lblExtLibName: TLabel
|
||||||
|
AnchorSideLeft.Control = chkFuncAreExt
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
Left = 187
|
||||||
|
Height = 17
|
||||||
|
Top = 103
|
||||||
|
Width = 83
|
||||||
|
BorderSpacing.Left = 20
|
||||||
|
Caption = 'Library name'
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object Panel2: TPanel
|
object Panel2: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 210
|
Height = 292
|
||||||
Top = 172
|
Top = 228
|
||||||
Width = 616
|
Width = 629
|
||||||
Align = alClient
|
Align = alClient
|
||||||
Alignment = taLeftJustify
|
Alignment = taLeftJustify
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 210
|
ClientHeight = 292
|
||||||
ClientWidth = 616
|
ClientWidth = 629
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object Splitter1: TSplitter
|
object Splitter1: TSplitter
|
||||||
Cursor = crVSplit
|
Cursor = crVSplit
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 5
|
Height = 5
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 616
|
Width = 629
|
||||||
Align = alTop
|
Align = alTop
|
||||||
ResizeAnchor = akTop
|
ResizeAnchor = akTop
|
||||||
end
|
end
|
||||||
object Label2: TLabel
|
object Label2: TLabel
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 18
|
Height = 17
|
||||||
Top = 14
|
Top = 14
|
||||||
Width = 181
|
Width = 178
|
||||||
Caption = 'C to Pascal types convertion'
|
Caption = 'C to Pascal types convertion'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Memo1: TMemo
|
object Memo1: TMemo
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 160
|
Height = 242
|
||||||
Top = 44
|
Top = 44
|
||||||
Width = 604
|
Width = 617
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
@ -177,7 +204,7 @@ object CtoPasConfig: TCtoPasConfig
|
|||||||
Left = 476
|
Left = 476
|
||||||
Height = 20
|
Height = 20
|
||||||
Top = 14
|
Top = 14
|
||||||
Width = 134
|
Width = 147
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Caption = 'Reset to defaults'
|
Caption = 'Reset to defaults'
|
||||||
@ -194,7 +221,7 @@ object CtoPasConfig: TCtoPasConfig
|
|||||||
AnchorSideTop.Control = chkUseExternal
|
AnchorSideTop.Control = chkUseExternal
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 13
|
Left = 13
|
||||||
Height = 22
|
Height = 21
|
||||||
Top = 32
|
Top = 32
|
||||||
Width = 511
|
Width = 511
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
@ -22,11 +22,13 @@ type
|
|||||||
chkFuncAreExt:TCheckBox;
|
chkFuncAreExt:TCheckBox;
|
||||||
chkEnums:TCheckBox;
|
chkEnums:TCheckBox;
|
||||||
cmbCallConv:TComboBox;
|
cmbCallConv:TComboBox;
|
||||||
|
txtLibName:TEdit;
|
||||||
edtDefines:TEdit;
|
edtDefines:TEdit;
|
||||||
edtExtTool: TEdit;
|
edtExtTool: TEdit;
|
||||||
Label1:TLabel;
|
Label1:TLabel;
|
||||||
Label2:TLabel;
|
Label2:TLabel;
|
||||||
Label3:TLabel;
|
lblCallConv:TLabel;
|
||||||
|
lblExtLibName:TLabel;
|
||||||
lblDefines:TLabel;
|
lblDefines:TLabel;
|
||||||
Memo1:TMemo;
|
Memo1:TMemo;
|
||||||
Notebook1:TNotebook;
|
Notebook1:TNotebook;
|
||||||
@ -131,6 +133,7 @@ begin
|
|||||||
chkRecordsPacked.Checked:=ConvSettings.RecordsArePacked;
|
chkRecordsPacked.Checked:=ConvSettings.RecordsArePacked;
|
||||||
chkFuncAreExt.Checked:=ConvSettings.FuncsAreExternal;
|
chkFuncAreExt.Checked:=ConvSettings.FuncsAreExternal;
|
||||||
chkEnums.Checked:=ConvSettings.EnumsAsConst;
|
chkEnums.Checked:=ConvSettings.EnumsAsConst;
|
||||||
|
txtLibName.Text:=ConvSettings.ExtLibName;
|
||||||
cmbCallConv.Text:=ConvSettings.FuncConv;
|
cmbCallConv.Text:=ConvSettings.FuncConv;
|
||||||
Memo1.Lines.Assign(ConvSettings.CtoPasTypes);
|
Memo1.Lines.Assign(ConvSettings.CtoPasTypes);
|
||||||
edtDefines.Text:=DefineFile;
|
edtDefines.Text:=DefineFile;
|
||||||
@ -143,7 +146,11 @@ begin
|
|||||||
ConvSettings.RecordsArePacked:=chkRecordsPacked.Checked;
|
ConvSettings.RecordsArePacked:=chkRecordsPacked.Checked;
|
||||||
ConvSettings.FuncsAreExternal:=chkFuncAreExt.Checked;
|
ConvSettings.FuncsAreExternal:=chkFuncAreExt.Checked;
|
||||||
ConvSettings.EnumsAsConst:=chkEnums.Checked;
|
ConvSettings.EnumsAsConst:=chkEnums.Checked;
|
||||||
ConvSettings.FuncConv:=cmbCallConv.Text;
|
ConvSettings.ExtLibName:=Trim(txtLibName.Text);
|
||||||
|
if (cmbCallConv.ItemIndex=0) and (cmbCallConv.Text=cmbCallConv.Items[0]) then
|
||||||
|
ConvSettings.FuncConv:=''
|
||||||
|
else
|
||||||
|
ConvSettings.FuncConv:=cmbCallConv.Text;
|
||||||
ConvSettings.CtoPasTypes.Assign(Memo1.Lines);
|
ConvSettings.CtoPasTypes.Assign(Memo1.Lines);
|
||||||
DefineFile:=edtDefines.Text;
|
DefineFile:=edtDefines.Text;
|
||||||
ExtTool:=edtExtTool.Text;
|
ExtTool:=edtExtTool.Text;
|
||||||
|
Reference in New Issue
Block a user