=*converting keys improved (mainunit ignoreinclude)
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@409 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
472b178afe
commit
9eff426166
@ -269,8 +269,36 @@ end;
|
|||||||
function GetIncludeFile(const s: AnsiString): AnsiString;
|
function GetIncludeFile(const s: AnsiString): AnsiString;
|
||||||
var
|
var
|
||||||
i : Integer;
|
i : Integer;
|
||||||
|
vs : AnsiString;
|
||||||
|
pth : AnsiString;
|
||||||
begin
|
begin
|
||||||
//todo: don't like it...
|
//todo: still, i don't like it...
|
||||||
|
Result :='';
|
||||||
|
i := 1;
|
||||||
|
ScanWhile(s, i, [#32, #9]);
|
||||||
|
vs := Copy(s, i, length(s) - i + 1);
|
||||||
|
if vs = '' then Exit;
|
||||||
|
|
||||||
|
|
||||||
|
if (vs[1] = '<') or (vs[1] = '"') then vs := Copy(vs, 2, length(vs) - 1);
|
||||||
|
if vs = '' then Exit;
|
||||||
|
|
||||||
|
i := length(vs);
|
||||||
|
if (vs[i] = '>') or (vs[i] = '"') then vs := Copy(vs, 1, length(vs) - 1);
|
||||||
|
if vs = '' then Exit;
|
||||||
|
|
||||||
|
|
||||||
|
pth := vs;
|
||||||
|
while (pth <> '') and (length(pth)>1) do begin
|
||||||
|
if ConvertSettings.IgnoreIncludes.IndexOf(pth) >= 0 then
|
||||||
|
Exit; // file must be excluded;
|
||||||
|
pth := ExtractFilePath(ExcludeTrailingPathDelimiter(pth));
|
||||||
|
end;
|
||||||
|
|
||||||
|
Result := ExtractFileName(vs);
|
||||||
|
Result := Copy(Result, 1, length(Result) - length(ExtractFileExt(vs))) + '.inc';
|
||||||
|
|
||||||
|
(*
|
||||||
Result := '';
|
Result := '';
|
||||||
if s = '' then Exit;
|
if s = '' then Exit;
|
||||||
// i := length(s);
|
// i := length(s);
|
||||||
@ -280,12 +308,7 @@ begin
|
|||||||
// dummy, but it works =)
|
// dummy, but it works =)
|
||||||
while (i > 0) and (s[i] in ['.', 'A'..'Z', 'a'..'z', '0'..'9']) do dec(i);
|
while (i > 0) and (s[i] in ['.', 'A'..'Z', 'a'..'z', '0'..'9']) do dec(i);
|
||||||
|
|
||||||
Result := Copy(s, i + 1, length(s) - i);
|
Result := Copy(s, i + 1, length(s) - i);*)
|
||||||
if Result <> '' then begin
|
|
||||||
if Result[length(Result)] in ['"', '>'] then Result :=
|
|
||||||
Copy(Result, 1, length(Result) - 1);
|
|
||||||
Result := Copy(Result, 1, length(Result) - length(ExtractFileExt(Result))) + '.inc';
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// returns pascal style of precomiler "if defined" section
|
// returns pascal style of precomiler "if defined" section
|
||||||
@ -341,7 +364,7 @@ begin
|
|||||||
if (dir = '#import') or (dir = '#include') then begin
|
if (dir = '#import') or (dir = '#include') then begin
|
||||||
|
|
||||||
prm := GetIncludeFile(Prec._Params);
|
prm := GetIncludeFile(Prec._Params);
|
||||||
if (prm <> ' .inc') and (ConvertSettings.IgnoreIncludes.IndexOf(prm) < 0) then
|
if (prm <> '') and (prm <> ' .inc') and (ConvertSettings.IgnoreIncludes.IndexOf(prm) < 0) then
|
||||||
Result := Format('{$include %s}', [prm]);
|
Result := Format('{$include %s}', [prm]);
|
||||||
|
|
||||||
end else if (dir = '#if') then begin
|
end else if (dir = '#if') then begin
|
||||||
@ -1201,146 +1224,13 @@ procedure InitConvertSettings;
|
|||||||
begin
|
begin
|
||||||
with ConvertSettings.IgnoreIncludes do begin
|
with ConvertSettings.IgnoreIncludes do begin
|
||||||
// must not be $included, because they are used
|
// must not be $included, because they are used
|
||||||
Add('NSObjCRuntime.inc');
|
// Add('Foundation/');
|
||||||
Add('NSObject.inc');
|
// Add('Foundation/NSObject.h');
|
||||||
Add('Foundation.inc');
|
// Add('NSObjCRuntime.h');
|
||||||
|
// Add('Foundation/NSObject.h');
|
||||||
(* Add('NSZone.inc');
|
// Add('Foundation/Foundation.h');
|
||||||
Add('NSAppleEventDescriptor.inc');
|
|
||||||
Add('NSAppleEventManager.inc');
|
|
||||||
Add('NSAppleScript.inc');
|
|
||||||
Add('NSArchiver.inc');
|
|
||||||
Add('NSArray.inc');
|
|
||||||
Add('NSAttributedString.inc');
|
|
||||||
Add('NSAutoreleasePool.inc');
|
|
||||||
Add('NSBundle.inc');
|
|
||||||
Add('NSByteOrder.inc');
|
|
||||||
Add('NSCalendar.inc');
|
|
||||||
Add('NSCalendarDate.inc');
|
|
||||||
Add('NSCharacterSet.inc');
|
|
||||||
Add('NSClassDescription.inc');
|
|
||||||
Add('NSCoder.inc');
|
|
||||||
Add('NSComparisonPredicate.inc');
|
|
||||||
Add('NSCompoundPredicate.inc');
|
|
||||||
Add('NSConnection.inc');
|
|
||||||
Add('NSData.inc');
|
|
||||||
Add('NSDate.inc');
|
|
||||||
Add('NSDateFormatter.inc');
|
|
||||||
Add('NSDebug.inc');
|
|
||||||
Add('NSDecimal.inc');
|
|
||||||
Add('NSDecimalNumber.inc');
|
|
||||||
Add('NSDictionary.inc');
|
|
||||||
Add('NSDistantObject.inc');
|
|
||||||
Add('NSDistributedLock.inc');
|
|
||||||
Add('NSDistributedNotificationCenter.inc');
|
|
||||||
Add('NSEnumerator.inc');
|
|
||||||
Add('NSError.inc');
|
|
||||||
Add('NSException.inc');
|
|
||||||
Add('NSExpression.inc');
|
|
||||||
Add('NSFileHandle.inc');
|
|
||||||
Add('NSFileManager.inc');
|
|
||||||
Add('NSFormatter.hinc');
|
|
||||||
Add('NSGarbageCollector.inc');
|
|
||||||
Add('NSGeometry.inc');
|
|
||||||
Add('NSHashTable.inc');
|
|
||||||
Add('NSHFSFileTypes.inc');
|
|
||||||
Add('NSHost.inc');
|
|
||||||
Add('NSHTTPCookie.inc');
|
|
||||||
Add('NSHTTPCookieStorage.inc');
|
|
||||||
Add('NSIndexPath.inc');
|
|
||||||
Add('NSIndexSet.inc');
|
|
||||||
Add('NSInvocation.inc');
|
|
||||||
Add('NSJavaSetup.inc');
|
|
||||||
Add('NSKeyedArchiver.inc');
|
|
||||||
Add('NSKeyValueCoding.inc');
|
|
||||||
Add('NSKeyValueObserving.inc');
|
|
||||||
Add('NSLocale.inc');
|
|
||||||
Add('NSLock.inc');
|
|
||||||
Add('NSMapTable.inc');
|
|
||||||
Add('NSMetadata.inc');
|
|
||||||
Add('NSMethodSignature.inc');
|
|
||||||
Add('NSNetServices.inc');
|
|
||||||
Add('NSNotification.inc');
|
|
||||||
Add('NSNotificationQueue.inc');
|
|
||||||
Add('NSNull.inc');
|
|
||||||
Add('NSNumberFormatter.inc');
|
|
||||||
Add('NSObjectScripting.inc');
|
|
||||||
Add('NSOperation.inc');
|
|
||||||
Add('NSPathUtilities.inc');
|
|
||||||
Add('NSPointerArray.inc');
|
|
||||||
Add('NSPointerFunctions.inc');
|
|
||||||
Add('NSPort.inc');
|
|
||||||
Add('NSPortCoder.inc');
|
|
||||||
Add('NSPortMessage.inc');
|
|
||||||
Add('NSPortNameServer.inc');
|
|
||||||
Add('NSPredicate.inc');
|
|
||||||
Add('NSProcessInfo.inc');
|
|
||||||
Add('NSPropertyList.inc');
|
|
||||||
Add('NSProtocolChecker.inc');
|
|
||||||
Add('NSProxy.inc');
|
|
||||||
Add('NSRange.inc');
|
|
||||||
Add('NSRunLoop.inc');
|
|
||||||
Add('NSScanner.inc');
|
|
||||||
Add('NSScriptClassDescription.inc');
|
|
||||||
Add('NSScriptCoercionHandler.inc');
|
|
||||||
Add('NSScriptCommand.inc');
|
|
||||||
Add('NSScriptCommandDescription.inc');
|
|
||||||
Add('NSScriptExecutionContext.inc');
|
|
||||||
Add('NSScriptKeyValueCoding.inc');
|
|
||||||
Add('NSScriptObjectSpecifiers.inc');
|
|
||||||
Add('NSScriptStandardSuiteCommands.inc');
|
|
||||||
Add('NSScriptSuiteRegistry.inc');
|
|
||||||
Add('NSScriptWhoseTests.inc');
|
|
||||||
Add('NSSet.inc');
|
|
||||||
Add('NSSortDescriptor.inc');
|
|
||||||
Add('NSSpellServer.inc');
|
|
||||||
Add('NSStream.inc');
|
|
||||||
Add('NSString.inc');
|
|
||||||
Add('NSTask.inc');
|
|
||||||
Add('NSThread.inc');
|
|
||||||
Add('NSTimer.inc');
|
|
||||||
Add('NSTimeZone.inc');
|
|
||||||
Add('NSUndoManager.inc');
|
|
||||||
Add('NSURL.inc');
|
|
||||||
Add('NSURLAuthenticationChallenge.inc');
|
|
||||||
Add('NSURLCache.inc');
|
|
||||||
Add('NSURLConnection.inc');
|
|
||||||
Add('NSURLCredential.inc');
|
|
||||||
Add('NSURLCredentialStorage.inc');
|
|
||||||
Add('NSURLDownload.inc');
|
|
||||||
Add('NSURLError.inc');
|
|
||||||
Add('NSURLHandle.inc');
|
|
||||||
Add('NSURLProtectionSpace.inc');
|
|
||||||
Add('NSURLProtocol.inc');
|
|
||||||
Add('NSURLRequest.inc');
|
|
||||||
Add('NSURLResponse.inc');
|
|
||||||
Add('NSUserDefaults.inc');
|
|
||||||
Add('NSValue.inc');
|
|
||||||
Add('NSValueTransformer.inc');
|
|
||||||
Add('NSXMLDocument.inc');
|
|
||||||
Add('NSXMLDTD.inc');
|
|
||||||
Add('NSXMLDTDNode.inc');
|
|
||||||
Add('NSXMLElement.inc');
|
|
||||||
Add('NSXMLNode.inc');
|
|
||||||
Add('NSXMLNodeOptions.inc');
|
|
||||||
Add('NSXMLParser.inc');
|
|
||||||
// temporary
|
|
||||||
Add('ApplicationServices.inc');
|
|
||||||
Add('IOLLEvent.inc');
|
|
||||||
Add('Limits.inc');
|
|
||||||
Add('AvailabilityMacros.inc');
|
|
||||||
Add('CCImage.inc');
|
|
||||||
Add('NSStringEncoding.inc');
|
|
||||||
Add('NSGlyph.inc');
|
|
||||||
Add('CFDate.inc');
|
|
||||||
Add('CFRunLoop.inc');
|
|
||||||
Add('gl.inc');
|
|
||||||
Add('UTF32Char.inc');
|
|
||||||
Add('CoreFoundation.inc');
|
|
||||||
Add('NSFetchRequest.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';
|
||||||
DefineReplace['MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3'] := 'MAC_OS_X_VERSION_10_3';
|
DefineReplace['MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3'] := 'MAC_OS_X_VERSION_10_3';
|
||||||
@ -1352,11 +1242,6 @@ begin
|
|||||||
TypeDefReplace['NSUInteger'] := 'LongWord';
|
TypeDefReplace['NSUInteger'] := 'LongWord';
|
||||||
TypeDefReplace['NSInteger'] := 'Integer';
|
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_3'] := 'MAC_OS_X_VERSION_10_3';
|
|
||||||
// Values['MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4'] := 'MAC_OS_X_VERSION_10_4';
|
|
||||||
// Values['MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5'] := 'MAC_OS_X_VERSION_10_5';
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TReplaceList }
|
{ TReplaceList }
|
||||||
|
@ -30,33 +30,37 @@
|
|||||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||||
</local>
|
</local>
|
||||||
</RunParams>
|
</RunParams>
|
||||||
<Units Count="31">
|
<Units Count="34">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="objcparser.pas"/>
|
<Filename Value="objcparser.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="Project1"/>
|
<UnitName Value="Project1"/>
|
||||||
<CursorPos X="21" Y="281"/>
|
<CursorPos X="35" Y="10"/>
|
||||||
<TopLine Value="269"/>
|
<TopLine Value="1"/>
|
||||||
<EditorIndex Value="0"/>
|
<EditorIndex Value="0"/>
|
||||||
<UsageCount Value="70"/>
|
<UsageCount Value="71"/>
|
||||||
<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="22" Y="13"/>
|
<CursorPos X="19" Y="1218"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="1210"/>
|
||||||
|
<EditorIndex Value="2"/>
|
||||||
<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="31" Y="261"/>
|
<CursorPos X="5" Y="1396"/>
|
||||||
<TopLine Value="253"/>
|
<TopLine Value="1396"/>
|
||||||
|
<EditorIndex Value="1"/>
|
||||||
<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"/>
|
||||||
@ -115,7 +119,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="67"/>
|
<UsageCount Value="68"/>
|
||||||
</Unit11>
|
</Unit11>
|
||||||
<Unit12>
|
<Unit12>
|
||||||
<Filename Value="../appkit/NSWindow.inc"/>
|
<Filename Value="../appkit/NSWindow.inc"/>
|
||||||
@ -186,7 +190,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="48"/>
|
<UsageCount Value="49"/>
|
||||||
<SyntaxHighlighter Value="C++"/>
|
<SyntaxHighlighter Value="C++"/>
|
||||||
</Unit22>
|
</Unit22>
|
||||||
<Unit23>
|
<Unit23>
|
||||||
@ -241,6 +245,28 @@
|
|||||||
<TopLine Value="1"/>
|
<TopLine Value="1"/>
|
||||||
<UsageCount Value="10"/>
|
<UsageCount Value="10"/>
|
||||||
</Unit30>
|
</Unit30>
|
||||||
|
<Unit31>
|
||||||
|
<Filename Value="/usr/local/share/fpcsrc/rtl/objpas/sysutils/finah.inc"/>
|
||||||
|
<CursorPos X="10" Y="28"/>
|
||||||
|
<TopLine Value="18"/>
|
||||||
|
<EditorIndex Value="3"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
</Unit31>
|
||||||
|
<Unit32>
|
||||||
|
<Filename Value="/usr/local/share/fpcsrc/rtl/objpas/sysutils/fina.inc"/>
|
||||||
|
<CursorPos X="1" Y="41"/>
|
||||||
|
<TopLine Value="34"/>
|
||||||
|
<EditorIndex Value="4"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
</Unit32>
|
||||||
|
<Unit33>
|
||||||
|
<Filename Value="NSAlert.inc"/>
|
||||||
|
<CursorPos X="1" Y="1"/>
|
||||||
|
<TopLine Value="1"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
</Unit33>
|
||||||
</Units>
|
</Units>
|
||||||
<JumpHistory Count="0" HistoryIndex="-1"/>
|
<JumpHistory Count="0" HistoryIndex="-1"/>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
Project1.pas
|
Project1.pas
|
||||||
|
|
||||||
Copyright (C) 2008 Dmitry 'Skalogryz' Boyarintsev
|
Copyright (C) 2008 Dmitry 'Skalogryz' Boyarintsev
|
||||||
|
|
||||||
main parser unit
|
main parser unit
|
||||||
}
|
}
|
||||||
program Project1;
|
program Project1;
|
||||||
@ -12,7 +12,6 @@ program Project1;
|
|||||||
{$else}
|
{$else}
|
||||||
{$APPTYPE CONSOLE}
|
{$APPTYPE CONSOLE}
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes,
|
Classes,
|
||||||
SysUtils,
|
SysUtils,
|
||||||
@ -254,12 +253,12 @@ begin
|
|||||||
vlm := Params.Values['ignoreinclude'];
|
vlm := Params.Values['ignoreinclude'];
|
||||||
if vlm <> '' then begin
|
if vlm <> '' then begin
|
||||||
AddSpaceSeparated(vlm, Settings.IgnoreIncludes);
|
AddSpaceSeparated(vlm, Settings.IgnoreIncludes);
|
||||||
for i := 0 to Settings.IgnoreIncludes.Count - 1 do begin
|
{for i := 0 to Settings.IgnoreIncludes.Count - 1 do begin
|
||||||
vlm := Settings.IgnoreIncludes[i];
|
vlm := Settings.IgnoreIncludes[i];
|
||||||
vlm := Copy(vlm, 1, length(vlm) - length(ExtractFileExt(vlm)));
|
vlm := Copy(vlm, 1, length(vlm) - length(ExtractFileExt(vlm)));
|
||||||
vlm := vlm + '.inc';
|
vlm := vlm + '.inc';
|
||||||
Settings.IgnoreIncludes[i] := vlm;
|
Settings.IgnoreIncludes[i] := vlm;
|
||||||
end;
|
end;}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
finally
|
finally
|
||||||
|
Loading…
Reference in New Issue
Block a user