You've already forked lazarus-ccr
*mainunit and ingoreinclude keys are implemented *added additional lines to make generated code more readable *unparsed lines are added as a line comments
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@408 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -750,6 +750,7 @@ begin
|
|||||||
Result := false;
|
Result := false;
|
||||||
AParser.FindNextToken(s, tt);
|
AParser.FindNextToken(s, tt);
|
||||||
if s <> '@interface' then begin
|
if s <> '@interface' then begin
|
||||||
|
AParser.SetError(ErrExpectStr('@interface', s));
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -763,7 +764,7 @@ begin
|
|||||||
AParser.FindNextToken(_Category, tt);
|
AParser.FindNextToken(_Category, tt);
|
||||||
AParser.FindNextToken(s, tt);
|
AParser.FindNextToken(s, tt);
|
||||||
end else
|
end else
|
||||||
Exit;
|
AParser.Index := AParser.TokenPos;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
AParser.FindNextToken(s, tt); // parsing protocols
|
AParser.FindNextToken(s, tt); // parsing protocols
|
||||||
@ -781,6 +782,7 @@ begin
|
|||||||
repeat
|
repeat
|
||||||
if not AParser.FindNextToken(s, tt) then begin
|
if not AParser.FindNextToken(s, tt) then begin
|
||||||
s := '';
|
s := '';
|
||||||
|
AParser.SetError('error while parsing class declaration');
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -45,6 +45,8 @@ type
|
|||||||
IgnoreIncludes : TStringList;
|
IgnoreIncludes : TStringList;
|
||||||
DefineReplace : TReplaceList;
|
DefineReplace : TReplaceList;
|
||||||
TypeDefReplace : TReplaceList; // replaces for C types
|
TypeDefReplace : TReplaceList; // replaces for C types
|
||||||
|
|
||||||
|
ConvertPrefix : TStringList;
|
||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
end;
|
end;
|
||||||
@ -425,6 +427,7 @@ end;
|
|||||||
|
|
||||||
procedure BeginSection(const SectionName: AnsiString; st: TStrings);
|
procedure BeginSection(const SectionName: AnsiString; st: TStrings);
|
||||||
begin
|
begin
|
||||||
|
st.Add('');
|
||||||
st.Add('{$ifdef '+SectionName+'}');
|
st.Add('{$ifdef '+SectionName+'}');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -432,6 +435,7 @@ procedure BeginExcludeSection(const DefineName: AnsiString; st: TStrings);
|
|||||||
begin
|
begin
|
||||||
st.Add('{$ifndef '+DefineName+'}');
|
st.Add('{$ifndef '+DefineName+'}');
|
||||||
st.Add('{$define '+DefineName+'}');
|
st.Add('{$define '+DefineName+'}');
|
||||||
|
st.Add('');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure EndSection(st: TStrings);
|
procedure EndSection(st: TStrings);
|
||||||
@ -452,6 +456,11 @@ begin
|
|||||||
if isend then ClearEmptyPrecompile(subs);
|
if isend then ClearEmptyPrecompile(subs);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function GetClassConst(const ClassName, ConstName: AnsiString): AnsiString;
|
||||||
|
begin
|
||||||
|
Result := Format('Str%s_%s', [ClassName, ConstName]);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure WriteOutClassToHeader(cl : TClassDef; subs: TStrings; conststr: TStrings);
|
procedure WriteOutClassToHeader(cl : TClassDef; subs: TStrings; conststr: TStrings);
|
||||||
var
|
var
|
||||||
i : Integer;
|
i : Integer;
|
||||||
@ -460,21 +469,26 @@ var
|
|||||||
ss : AnsiString;
|
ss : AnsiString;
|
||||||
mtd : TClassMethodDef;
|
mtd : TClassMethodDef;
|
||||||
obj : TObject;
|
obj : TObject;
|
||||||
|
cs : AnsiString;
|
||||||
begin
|
begin
|
||||||
// if conststr.IndexOf(cl._ClassName) < 0 then begin
|
cs := GetClassConst(cl._ClassName, cl._ClassName);
|
||||||
// conststr.Add(cl._ClassName);
|
if conststr.IndexOf(cs) < 0 then begin
|
||||||
s := Format(' Str%s_%s = '#39'%s'#39';', [cl._ClassName, cl._ClassName, cl._ClassName]);
|
conststr.Add(cs);
|
||||||
|
s := Format(' %s = ''%s'';', [cs, cl._ClassName]);
|
||||||
subs.Add(s);
|
subs.Add(s);
|
||||||
// end;
|
end;
|
||||||
|
|
||||||
for i := 0 to cl.Items.Count - 1 do begin
|
for i := 0 to cl.Items.Count - 1 do begin
|
||||||
obj := TObject(cl.Items[i]);
|
obj := TObject(cl.Items[i]);
|
||||||
if obj is TClassMethodDef then begin
|
if obj is TClassMethodDef then begin
|
||||||
mtd := TClassMethodDef(cl.Items[i]);
|
mtd := TClassMethodDef(cl.Items[i]);
|
||||||
// if conststr.IndexOf(mtd._Name) < 0 then begin
|
|
||||||
// conststr.Add(mtd._Name);
|
cs := GetClassConst(cl._ClassName, mtd._Name);
|
||||||
ss := Format(' Str%s_%s = '#39'%s'#39';', [cl._ClassName, mtd._Name, mtd._Name]);
|
if conststr.IndexOf(cs) < 0 then begin
|
||||||
|
conststr.Add(cs);
|
||||||
|
ss := Format(' %s = ''%s'';', [cs, mtd._Name]);
|
||||||
subs.add(ss);
|
subs.add(ss);
|
||||||
// end;
|
end;
|
||||||
end else if obj is TPrecompiler then begin
|
end else if obj is TPrecompiler then begin
|
||||||
WriteOutIfDefPrecompiler(TPrecompiler(obj), ' ', subs);
|
WriteOutIfDefPrecompiler(TPrecompiler(obj), ' ', subs);
|
||||||
end;
|
end;
|
||||||
@ -749,6 +763,7 @@ begin
|
|||||||
finally
|
finally
|
||||||
EndSection(st);
|
EndSection(st);
|
||||||
EndSection(st);
|
EndSection(st);
|
||||||
|
subs.Add('');
|
||||||
subs.Free;
|
subs.Free;
|
||||||
consts.Free;
|
consts.Free;
|
||||||
end;
|
end;
|
||||||
@ -767,6 +782,7 @@ var
|
|||||||
const
|
const
|
||||||
SpacePrefix = ' ';
|
SpacePrefix = ' ';
|
||||||
begin
|
begin
|
||||||
|
subs.Add('');
|
||||||
subs.Add(' { '+cl._ClassName +' }');
|
subs.Add(' { '+cl._ClassName +' }');
|
||||||
subs.Add('');
|
subs.Add('');
|
||||||
s := ' ' + cl._ClassName + ' = class';
|
s := ' ' + cl._ClassName + ' = class';
|
||||||
@ -1079,7 +1095,7 @@ begin
|
|||||||
for i := 0 to Items.Count - 1 do
|
for i := 0 to Items.Count - 1 do
|
||||||
if TObject(Items[i]) is TClassDef then begin
|
if TObject(Items[i]) is TClassDef then begin
|
||||||
cl := TClassDef(Items[i]);
|
cl := TClassDef(Items[i]);
|
||||||
if cl._SuperClass <> '' then
|
if (cl._SuperClass <> '') and (cl._Category <> '') then
|
||||||
for j := 0 to category.Items.Count - 1 do begin
|
for j := 0 to category.Items.Count - 1 do begin
|
||||||
cl.Items.Add(category.Items[j]);
|
cl.Items.Add(category.Items[j]);
|
||||||
TEntity(category.Items[j]).owner := cl;
|
TEntity(category.Items[j]).owner := cl;
|
||||||
@ -1099,10 +1115,13 @@ begin
|
|||||||
if (obj is TTypeNameDef) and (AppleEnumType(ent.Items, i)) then begin
|
if (obj is TTypeNameDef) and (AppleEnumType(ent.Items, i)) then begin
|
||||||
ent.Items[i] := nil;
|
ent.Items[i] := nil;
|
||||||
obj.Free;
|
obj.Free;
|
||||||
end else if (obj is TClassDef) and (TClassDef(obj)._SuperClass = '') then begin
|
end else if (obj is TClassDef) and ((TClassDef(obj)._SuperClass = '') and (TClassDef(obj)._Category <> ''))then begin
|
||||||
FixAppleCategories(ent.Items, TClassDef(obj));
|
FixAppleCategories(ent.Items, TClassDef(obj));
|
||||||
ent.Items[i] := nil;
|
ent.Items[i] := nil;
|
||||||
obj.Free;
|
obj.Free;
|
||||||
|
end else if (obj is TClassDef) and ((TClassDef(obj)._Category = '') and (TClassDef(obj)._ClassName = 'NSObject')) then begin
|
||||||
|
if TClassDef(obj)._SuperClass = '' then
|
||||||
|
TClassDef(obj)._SuperClass := 'TObject'
|
||||||
end else if (obj is TParamDescr) then begin
|
end else if (obj is TParamDescr) then begin
|
||||||
if IsPascalReserved(TParamDescr(obj)._Descr) then
|
if IsPascalReserved(TParamDescr(obj)._Descr) then
|
||||||
TParamDescr(obj)._Descr := '_'+TParamDescr(obj)._Descr;
|
TParamDescr(obj)._Descr := '_'+TParamDescr(obj)._Descr;
|
||||||
@ -1122,6 +1141,7 @@ begin
|
|||||||
|
|
||||||
for i := 0 to ent.Items.Count - 1 do
|
for i := 0 to ent.Items.Count - 1 do
|
||||||
AppleHeaderFix( TEntity(ent.Items[i]));
|
AppleHeaderFix( TEntity(ent.Items[i]));
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure WriteOutIncludeFile(hdr: TObjCHeader; st: TStrings);
|
procedure WriteOutIncludeFile(hdr: TObjCHeader; st: TStrings);
|
||||||
@ -1130,6 +1150,8 @@ var
|
|||||||
cmt : TComment;
|
cmt : TComment;
|
||||||
begin
|
begin
|
||||||
try
|
try
|
||||||
|
st.AddStrings(ConvertSettings.ConvertPrefix);
|
||||||
|
|
||||||
if hdr.Items.Count <= 0 then Exit;
|
if hdr.Items.Count <= 0 then Exit;
|
||||||
AppleHeaderFix(hdr);
|
AppleHeaderFix(hdr);
|
||||||
|
|
||||||
@ -1163,6 +1185,7 @@ begin
|
|||||||
IgnoreIncludes.CaseSensitive := false;
|
IgnoreIncludes.CaseSensitive := false;
|
||||||
DefineReplace := TReplaceList.Create;
|
DefineReplace := TReplaceList.Create;
|
||||||
TypeDefReplace := TReplaceList.Create; // replaces for default types
|
TypeDefReplace := TReplaceList.Create; // replaces for default types
|
||||||
|
ConvertPrefix := TStringList.Create;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TConvertSettings.Destroy;
|
destructor TConvertSettings.Destroy;
|
||||||
@ -1170,6 +1193,7 @@ begin
|
|||||||
IgnoreIncludes.Free;
|
IgnoreIncludes.Free;
|
||||||
TypeDefReplace.Free;
|
TypeDefReplace.Free;
|
||||||
DefineReplace.Free;
|
DefineReplace.Free;
|
||||||
|
ConvertPrefix.Free;
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1181,7 +1205,7 @@ begin
|
|||||||
Add('NSObject.inc');
|
Add('NSObject.inc');
|
||||||
Add('Foundation.inc');
|
Add('Foundation.inc');
|
||||||
|
|
||||||
Add('NSZone.inc');
|
(* Add('NSZone.inc');
|
||||||
Add('NSAppleEventDescriptor.inc');
|
Add('NSAppleEventDescriptor.inc');
|
||||||
Add('NSAppleEventManager.inc');
|
Add('NSAppleEventManager.inc');
|
||||||
Add('NSAppleScript.inc');
|
Add('NSAppleScript.inc');
|
||||||
@ -1315,6 +1339,7 @@ begin
|
|||||||
Add('CoreFoundation.inc');
|
Add('CoreFoundation.inc');
|
||||||
Add('NSFetchRequest.inc');
|
Add('NSFetchRequest.inc');
|
||||||
Add('NSAttributeDescription.inc');
|
Add('NSAttributeDescription.inc');
|
||||||
|
*)
|
||||||
end;
|
end;
|
||||||
with ConvertSettings do begin
|
with ConvertSettings do begin
|
||||||
DefineReplace['MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2'] := 'MAC_OS_X_VERSION_10_2';
|
DefineReplace['MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2'] := 'MAC_OS_X_VERSION_10_2';
|
||||||
@ -1325,6 +1350,7 @@ begin
|
|||||||
TypeDefReplace['uint32_t'] := 'LongWord';
|
TypeDefReplace['uint32_t'] := 'LongWord';
|
||||||
TypeDefReplace['uint8_t'] := 'byte';
|
TypeDefReplace['uint8_t'] := 'byte';
|
||||||
TypeDefReplace['NSUInteger'] := 'LongWord';
|
TypeDefReplace['NSUInteger'] := 'LongWord';
|
||||||
|
TypeDefReplace['NSInteger'] := 'Integer';
|
||||||
end;
|
end;
|
||||||
//????
|
//????
|
||||||
// Values['MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2'] := 'MAC_OS_X_VERSION_10_2';
|
// Values['MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2'] := 'MAC_OS_X_VERSION_10_2';
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<IconPath Value="./"/>
|
<IconPath Value="./"/>
|
||||||
<TargetFileExt Value=".exe"/>
|
<TargetFileExt Value=".exe"/>
|
||||||
<UseAppBundle Value="False"/>
|
<UseAppBundle Value="False"/>
|
||||||
<ActiveEditorIndexAtStart Value="3"/>
|
<ActiveEditorIndexAtStart Value="0"/>
|
||||||
</General>
|
</General>
|
||||||
<VersionInfo>
|
<VersionInfo>
|
||||||
<ProjectVersion Value=""/>
|
<ProjectVersion Value=""/>
|
||||||
@ -35,32 +35,28 @@
|
|||||||
<Filename Value="objcparser.pas"/>
|
<Filename Value="objcparser.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="Project1"/>
|
<UnitName Value="Project1"/>
|
||||||
<CursorPos X="18" Y="20"/>
|
<CursorPos X="21" Y="281"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="269"/>
|
||||||
<EditorIndex Value="0"/>
|
<EditorIndex Value="0"/>
|
||||||
<UsageCount Value="69"/>
|
<UsageCount Value="70"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit0>
|
</Unit0>
|
||||||
<Unit1>
|
<Unit1>
|
||||||
<Filename Value="ObjCParserUtils.pas"/>
|
<Filename Value="ObjCParserUtils.pas"/>
|
||||||
<UnitName Value="ObjCParserUtils"/>
|
<UnitName Value="ObjCParserUtils"/>
|
||||||
<CursorPos X="1" Y="10"/>
|
<CursorPos X="22" Y="13"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="1"/>
|
||||||
<EditorIndex Value="4"/>
|
|
||||||
<UsageCount Value="33"/>
|
<UsageCount Value="33"/>
|
||||||
<Loaded Value="True"/>
|
|
||||||
</Unit1>
|
</Unit1>
|
||||||
<Unit2>
|
<Unit2>
|
||||||
<Filename Value="ObjCParserTypes.pas"/>
|
<Filename Value="ObjCParserTypes.pas"/>
|
||||||
<UnitName Value="ObjCParserTypes"/>
|
<UnitName Value="ObjCParserTypes"/>
|
||||||
<CursorPos X="1" Y="266"/>
|
<CursorPos X="31" Y="261"/>
|
||||||
<TopLine Value="253"/>
|
<TopLine Value="253"/>
|
||||||
<EditorIndex Value="3"/>
|
|
||||||
<UsageCount Value="33"/>
|
<UsageCount Value="33"/>
|
||||||
<Bookmarks Count="1">
|
<Bookmarks Count="1">
|
||||||
<Item0 X="1" Y="589" ID="0"/>
|
<Item0 X="1" Y="589" ID="0"/>
|
||||||
</Bookmarks>
|
</Bookmarks>
|
||||||
<Loaded Value="True"/>
|
|
||||||
</Unit2>
|
</Unit2>
|
||||||
<Unit3>
|
<Unit3>
|
||||||
<Filename Value="../foundation/foundation.pas"/>
|
<Filename Value="../foundation/foundation.pas"/>
|
||||||
@ -119,7 +115,7 @@
|
|||||||
<UnitName Value="pascodeutils"/>
|
<UnitName Value="pascodeutils"/>
|
||||||
<CursorPos X="1" Y="13"/>
|
<CursorPos X="1" Y="13"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="1"/>
|
||||||
<UsageCount Value="66"/>
|
<UsageCount Value="67"/>
|
||||||
</Unit11>
|
</Unit11>
|
||||||
<Unit12>
|
<Unit12>
|
||||||
<Filename Value="../appkit/NSWindow.inc"/>
|
<Filename Value="../appkit/NSWindow.inc"/>
|
||||||
@ -190,7 +186,7 @@
|
|||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<CursorPos X="44" Y="16"/>
|
<CursorPos X="44" Y="16"/>
|
||||||
<TopLine Value="11"/>
|
<TopLine Value="11"/>
|
||||||
<UsageCount Value="47"/>
|
<UsageCount Value="48"/>
|
||||||
<SyntaxHighlighter Value="C++"/>
|
<SyntaxHighlighter Value="C++"/>
|
||||||
</Unit22>
|
</Unit22>
|
||||||
<Unit23>
|
<Unit23>
|
||||||
@ -236,42 +232,17 @@
|
|||||||
<UnitName Value="NSFontPanelUnit"/>
|
<UnitName Value="NSFontPanelUnit"/>
|
||||||
<CursorPos X="25" Y="93"/>
|
<CursorPos X="25" Y="93"/>
|
||||||
<TopLine Value="79"/>
|
<TopLine Value="79"/>
|
||||||
<EditorIndex Value="1"/>
|
|
||||||
<UsageCount Value="10"/>
|
<UsageCount Value="10"/>
|
||||||
<Loaded Value="True"/>
|
|
||||||
</Unit29>
|
</Unit29>
|
||||||
<Unit30>
|
<Unit30>
|
||||||
<Filename Value="objc.pas"/>
|
<Filename Value="objc.pas"/>
|
||||||
<UnitName Value="objc"/>
|
<UnitName Value="objc"/>
|
||||||
<CursorPos X="10" Y="19"/>
|
<CursorPos X="1" Y="1"/>
|
||||||
<TopLine Value="5"/>
|
<TopLine Value="1"/>
|
||||||
<EditorIndex Value="2"/>
|
|
||||||
<UsageCount Value="10"/>
|
<UsageCount Value="10"/>
|
||||||
<Loaded Value="True"/>
|
|
||||||
</Unit30>
|
</Unit30>
|
||||||
</Units>
|
</Units>
|
||||||
<JumpHistory Count="5" HistoryIndex="4">
|
<JumpHistory Count="0" HistoryIndex="-1"/>
|
||||||
<Position1>
|
|
||||||
<Filename Value="NSFontPanelUnit.pas"/>
|
|
||||||
<Caret Line="1" Column="1" TopLine="1"/>
|
|
||||||
</Position1>
|
|
||||||
<Position2>
|
|
||||||
<Filename Value="NSFontPanelUnit.pas"/>
|
|
||||||
<Caret Line="92" Column="75" TopLine="79"/>
|
|
||||||
</Position2>
|
|
||||||
<Position3>
|
|
||||||
<Filename Value="NSFontPanelUnit.pas"/>
|
|
||||||
<Caret Line="1" Column="1" TopLine="1"/>
|
|
||||||
</Position3>
|
|
||||||
<Position4>
|
|
||||||
<Filename Value="NSFontPanelUnit.pas"/>
|
|
||||||
<Caret Line="93" Column="25" TopLine="79"/>
|
|
||||||
</Position4>
|
|
||||||
<Position5>
|
|
||||||
<Filename Value="objcparser.pas"/>
|
|
||||||
<Caret Line="199" Column="34" TopLine="193"/>
|
|
||||||
</Position5>
|
|
||||||
</JumpHistory>
|
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="5"/>
|
<Version Value="5"/>
|
||||||
|
@ -185,6 +185,7 @@ begin
|
|||||||
writeln(' converted!');
|
writeln(' converted!');
|
||||||
end else begin
|
end else begin
|
||||||
writeln('Error: ', err);
|
writeln('Error: ', err);
|
||||||
|
readln;
|
||||||
end;
|
end;
|
||||||
until FindNext(srch) <> 0;
|
until FindNext(srch) <> 0;
|
||||||
|
|
||||||
@ -195,6 +196,77 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
const
|
||||||
|
ParamKey = '-';
|
||||||
|
|
||||||
|
function isParamValue(const s: AnsiString; var ParName, ParValue: AnsiString): Boolean;
|
||||||
|
var
|
||||||
|
i : Integer;
|
||||||
|
begin
|
||||||
|
Result := false;
|
||||||
|
if s = '' then Exit;
|
||||||
|
Result := (s[1] = ParamKey);
|
||||||
|
if not Result then Exit;
|
||||||
|
i := 1;
|
||||||
|
ScanWhile(s, i, [ParamKey]);
|
||||||
|
ParName := ScanTo(s, i, [#32, #9, '=']);
|
||||||
|
ScanWhile(s, i, [#32, #9, '=']);
|
||||||
|
ParValue := Copy(s, i, length(s) - i + 1);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure AddSpaceSeparated(const s: AnsiString; Strings: TStringList);
|
||||||
|
var
|
||||||
|
i : Integer;
|
||||||
|
ns : AnsiString;
|
||||||
|
begin
|
||||||
|
i := 1;
|
||||||
|
while i <= length(s) do begin
|
||||||
|
ScanTo(s, i, ['A'..'Z', 'a'..'z']);
|
||||||
|
ns := ScanTo(s, i, [#32, #9, '"']);
|
||||||
|
if ns <> '' then Strings.Add(ns);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetConvertSettings(Settings : TConvertSettings; var FileName: AnsiString): Boolean;
|
||||||
|
var
|
||||||
|
i : integer;
|
||||||
|
prm : AnsiString;
|
||||||
|
vlm : AnsiString;
|
||||||
|
Params : TStringList;
|
||||||
|
begin
|
||||||
|
Params := TStringList.Create;
|
||||||
|
Params.CaseSensitive := false;
|
||||||
|
try
|
||||||
|
for i := 1 to ParamCount do begin
|
||||||
|
if isParamValue(ParamStr(i), prm, vlm) then begin
|
||||||
|
prm := AnsiLowerCase(prm);
|
||||||
|
if prm = 'mu' then prm := 'mainunit'
|
||||||
|
else if prm = 'ii' then prm := 'ignoreinclude';
|
||||||
|
Params.Values[prm] := vlm;
|
||||||
|
end else
|
||||||
|
FileName := ParamStr(i);
|
||||||
|
end;
|
||||||
|
|
||||||
|
vlm := Params.Values['mainunit'];
|
||||||
|
if vlm <> '' then
|
||||||
|
Settings.ConvertPrefix.Add ('{%mainunit '+vlm+'}');
|
||||||
|
|
||||||
|
vlm := Params.Values['ignoreinclude'];
|
||||||
|
if vlm <> '' then begin
|
||||||
|
AddSpaceSeparated(vlm, Settings.IgnoreIncludes);
|
||||||
|
for i := 0 to Settings.IgnoreIncludes.Count - 1 do begin
|
||||||
|
vlm := Settings.IgnoreIncludes[i];
|
||||||
|
vlm := Copy(vlm, 1, length(vlm) - length(ExtractFileExt(vlm)));
|
||||||
|
vlm := vlm + '.inc';
|
||||||
|
Settings.IgnoreIncludes[i] := vlm;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
finally
|
||||||
|
Params.Free;
|
||||||
|
end;
|
||||||
|
Result := true;
|
||||||
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
inpf : AnsiString;
|
inpf : AnsiString;
|
||||||
@ -203,7 +275,7 @@ var
|
|||||||
err : AnsiString;
|
err : AnsiString;
|
||||||
begin
|
begin
|
||||||
try
|
try
|
||||||
inpf := ParamStr(1);
|
GetConvertSettings(ConvertSettings, inpf);
|
||||||
if not FileExists(inpf) then begin
|
if not FileExists(inpf) then begin
|
||||||
//ParseAll;
|
//ParseAll;
|
||||||
Exit;
|
Exit;
|
||||||
|
Reference in New Issue
Block a user