diff --git a/Bin/Chet.exe b/Bin/Chet.exe index ccb4d43..2b7ca88 100644 Binary files a/Bin/Chet.exe and b/Bin/Chet.exe differ diff --git a/Chet.dproj b/Chet.dproj index b902420..81dce36 100644 --- a/Chet.dproj +++ b/Chet.dproj @@ -57,6 +57,7 @@ Chet "Onyx Blue|VCLSTYLE|$(BDSCOMMONDIR)\Styles\OnyxBlue.vsf" .\$(Platform)\$(Config) + EXPERIMENTAL;$(DCC_Define) .\$(Platform)\$(Config) System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) ..\Neslib.Clang;classes;externals;$(DCC_UnitSearchPath) @@ -103,11 +104,10 @@ ..\Sample\Sample.chet true - 82 + 85 true - CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.4.1.82;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.4.1;Comments= + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.4.1.85;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.4.1;Comments= 4 - Chet_Icon.ico 1 @@ -156,863 +156,12 @@ Chet.dpr - - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components - + False True - - - - Chet.exe - true - - - - - Chet.exe - true - - - - - .\ - true - - - - - .\ - true - - - - - 1 - - - Contents\MacOS - 1 - - - 0 - - - - - classes - 64 - - - classes - 64 - - - - - res\xml - 1 - - - res\xml - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\armeabi - 1 - - - library\lib\armeabi - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\mips - 1 - - - library\lib\mips - 1 - - - - - library\lib\armeabi-v7a - 1 - - - library\lib\arm64-v8a - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - res\drawable - 1 - - - res\drawable - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - res\values-v21 - 1 - - - res\values-v21 - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - res\drawable - 1 - - - res\drawable - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-xxxhdpi - 1 - - - res\drawable-xxxhdpi - 1 - - - - - res\drawable-ldpi - 1 - - - res\drawable-ldpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-xxxhdpi - 1 - - - res\drawable-xxxhdpi - 1 - - - - - res\drawable-small - 1 - - - res\drawable-small - 1 - - - - - res\drawable-normal - 1 - - - res\drawable-normal - 1 - - - - - res\drawable-large - 1 - - - res\drawable-large - 1 - - - - - res\drawable-xlarge - 1 - - - res\drawable-xlarge - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - 1 - - - Contents\MacOS - 1 - - - 0 - - - - - Contents\MacOS - 1 - .framework - - - Contents\MacOS - 1 - .framework - - - Contents\MacOS - 1 - .framework - - - 0 - - - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - Contents\MacOS - 1 - .dylib - - - Contents\MacOS - 1 - .dylib - - - Contents\MacOS - 1 - .dylib - - - 0 - .dll;.bpl - - - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - Contents\MacOS - 1 - .dylib - - - Contents\MacOS - 1 - .dylib - - - Contents\MacOS - 1 - .dylib - - - 0 - .bpl - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - Contents\Resources\StartUp\ - 0 - - - Contents\Resources\StartUp\ - 0 - - - Contents\Resources\StartUp\ - 0 - - - 0 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - - - ..\ - 1 - - - ..\ - 1 - - - ..\ - 1 - - - - - 1 - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).launchscreen - 64 - - - ..\$(PROJECTNAME).launchscreen - 64 - - - - - 1 - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - - - ..\ - 1 - - - ..\ - 1 - - - ..\ - 1 - - - - - Contents - 1 - - - Contents - 1 - - - Contents - 1 - - - - - Contents\Resources - 1 - - - Contents\Resources - 1 - - - Contents\Resources - 1 - - - - - library\lib\armeabi-v7a - 1 - - - library\lib\arm64-v8a - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - Contents\MacOS - 1 - - - Contents\MacOS - 1 - - - Contents\MacOS - 1 - - - 0 - - - - - library\lib\armeabi-v7a - 1 - - - - - 1 - - - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - - - - - - - - - - 12 diff --git a/Chet.res b/Chet.res index 80b553b..7b5acb4 100644 Binary files a/Chet.res and b/Chet.res differ diff --git a/Classes/Chet.CommentWriter.pas b/Classes/Chet.CommentWriter.pas index 308fb82..b228202 100644 --- a/Classes/Chet.CommentWriter.pas +++ b/Classes/Chet.CommentWriter.pas @@ -4,7 +4,7 @@ interface uses System.Classes, - System.SysUtils, + System.SysUtils,System.StrUtils,System.Character, {$IFDEF DEBUG} System.Generics.Collections, {$ENDIF} @@ -105,6 +105,7 @@ TParsedCommentWriter = class abstract(TCommentWriter) constructor Create(const ASourceWriter: TSourceWriter); destructor Destroy; override; procedure WriteComment(const ACursor: TCursor); override; + class function DropExtraWhitespaces(const AText: string): string; inline; end; type @@ -253,10 +254,9 @@ procedure TParsedCommentWriter.Append(const AText: String); var S: String; begin - if (AText = '') then - Exit; + S := DropExtraWhitespaces(AText.Trim.Replace('*)', '* )')); + if S.IsEmpty then Exit; - S := AText.Replace('*)', '* )'); if (FLastLineEmpty) then FBuilder.Append(FPrefix).Append(S.TrimLeft) else if (FNeedToTrimLeft) then @@ -319,6 +319,29 @@ destructor TParsedCommentWriter.Destroy; inherited; end; +class function TParsedCommentWriter.DropExtraWhitespaces(const AText: string): string; +var + I,J,J1: Integer; +begin + SetLength(Result, Length(AText)); + J := 0; + J1 := 0; + for I := 1 to Length(AText) do + begin + if AText[I].IsWhiteSpace then + Inc(J1) + else + J1 := 0; + + if J1 < 2 then + Result[I-J] := AText[I] + else + Inc(J); + end; + if J > 0 then + SetLength(Result,Length(AText) - J); +end; + procedure TParsedCommentWriter.EndSummaryOrRemarks; begin case FState of @@ -439,6 +462,11 @@ procedure TParsedCommentWriter.WriteNode(const AComment, APrevSibling: TComment; end; end; + function SkipTag(const ATagName: string): Boolean; + begin + Result := IndexText(ATagName,['li','ul','table']) > -1; + end; + var Kind: TCommentKind; S, Args: String; @@ -469,10 +497,34 @@ procedure TParsedCommentWriter.WriteNode(const AComment, APrevSibling: TComment; end; TCommentKind.HtmlStartTag: - Assert(False); + begin + S := AComment.HtmlTagName; + {$IFDEF DEBUG} + OutputDebugString(PChar(S)); + {$ENDIF} + if not SkipTag(S) then begin + if not AComment.HtmlTagIsSelfClosing then + Append(Format('<%s>',[S])) + else + Append(Format('<%s ',[S])) + end; + // do nothing; + end; TCommentKind.HtmlEndTag: - Assert(False); + begin + S := AComment.HtmlTagName; + {$IFDEF DEBUG} + OutputDebugString(PChar(S)); + {$ENDIF} + if not SkipTag(S) then begin + if not AComment.HtmlTagIsSelfClosing then + Append(Format(' ',[AComment.HtmlTagName])) + else + Append('/> '); + end; + // do nothing; + end; TCommentKind.Paragraph, TCommentKind.VerbatimLine: @@ -502,7 +554,7 @@ procedure TParsedCommentWriter.WriteNode(const AComment, APrevSibling: TComment; AppendLine; end; end; - if (Kind = TCommentKind.VerbatimLine) then + if (Kind = TCommentKind.VerbatimLine) and (AComment.ChildCount > 0) then Append(AComment.VerbatimLineText) else WriteChildren(AComment); @@ -602,8 +654,12 @@ procedure TParsedCommentWriter.WriteNode(const AComment, APrevSibling: TComment; AppendLine; end; else - S := AComment.Text.Replace('//', '', []); - Append(S); + S := AComment.Text.Replace('//', '', []).Replace('* ','',[rfReplaceAll]); + if S = '*' then + AppendLine + else + Append(S); + if (AComment.HasTrailingNewline) then AppendLine; end; diff --git a/Classes/Chet.HeaderTranslator.pas b/Classes/Chet.HeaderTranslator.pas index 27dcfaf..bd8019a 100644 --- a/Classes/Chet.HeaderTranslator.pas +++ b/Classes/Chet.HeaderTranslator.pas @@ -319,7 +319,7 @@ constructor THeaderTranslator.Create(const AProject: TProject); FSymbolPrefix := '_'; {$ENDIF} FCombinedHeaderFilename := TPath.Combine(TPath.GetTempPath, '_chet_.h'); - FIndex := TIndex.Create(False, False); + FIndex := TIndex.Create(False, FProject.ShowParserWarnings); FTypes := TList.Create; FDeclaredTypes := TList.Create; FVisitedTypes := TDictionary.Create( @@ -707,7 +707,7 @@ function THeaderTranslator.MakePointerType(const ATypeName: String; function THeaderTranslator.ParseCombinedHeaderFile: Boolean; var - Args: TArray; + Args,WinSdkIncludePaths : TArray; Options: TTranslationUnitFlags; DiagOpts: TDiagnosticDisplayOptions; Diag: IDiagnostic; @@ -739,9 +739,18 @@ function THeaderTranslator.ParseCombinedHeaderFile: Boolean; end; Args := Args + ['-I' + FProject.HeaderFileDirectory]; + WinSdkIncludePaths := FProject.WinSDKIncludePaths; + + for I := 0 to High(WinSdkIncludePaths) do + Args := Args + ['-I'+WinSdkIncludePaths[I]]; + + FTranslationUnit := FIndex.ParseTranslationUnit( + FCombinedHeaderFilename, + Args, + [], + Options + ); - FTranslationUnit := FIndex.ParseTranslationUnit(FCombinedHeaderFilename, - Args, [], Options); if (FTranslationUnit = nil) then raise EHeaderTranslatorError.Create('Cannot parse header files.'); @@ -754,7 +763,10 @@ function THeaderTranslator.ParseCombinedHeaderFile: Boolean; begin DoMessage(Diag.Format(DiagOpts)); Inc(ErrorCount); - end; + end + else + if FProject.ShowParserWarnings and (Diag.Severity = TDiagnosticSeverity.Warning) then + DoMessage(Diag.Format(DiagOpts)); end; if (ErrorCount = 0) then @@ -771,12 +783,12 @@ function THeaderTranslator.ParseCombinedHeaderFile: Boolean; function THeaderTranslator.RemoveQualifiers(const ACTypeName: String): String; var - HasPrefix: Boolean; + HasPrefix,StartsWithUnderscore: Boolean; begin Result := ACTypeName; {$IFDEF EXPERIMENTAL} - var StartsWithUnderscore := False; + StartsWithUnderscore := False; if (FProject.PrefixSymbolsWithUnderscore) then begin StartsWithUnderscore := Result.StartsWith('_'); @@ -904,7 +916,7 @@ procedure THeaderTranslator.SetupBuiltinTypes; FBuiltinTypes[TTypeKind.Char32] := 'UCS4Char'; FBuiltinTypes[TTypeKind.UShort] := 'Word'; FBuiltinTypes[TTypeKind.UInt] := 'Cardinal'; - FBuiltinTypes[TTypeKind.ULong] := 'Cardinal'; + FBuiltinTypes[TTypeKind.ULong] := 'Longword'; FBuiltinTypes[TTypeKind.ULongLong] := 'UInt64'; case FProject.CharConvert of @@ -926,7 +938,7 @@ procedure THeaderTranslator.SetupBuiltinTypes; FBuiltinTypes[TTypeKind.WChar] := 'WideChar'; FBuiltinTypes[TTypeKind.Short] := 'Smallint'; FBuiltinTypes[TTypeKind.Int] := 'Integer'; - FBuiltinTypes[TTypeKind.Long] := 'Integer'; + FBuiltinTypes[TTypeKind.Long] := 'Longint'; FBuiltinTypes[TTypeKind.LongLong] := 'Int64'; FBuiltinTypes[TTypeKind.Float] := 'Single'; FBuiltinTypes[TTypeKind.Double] := 'Double'; @@ -1343,12 +1355,10 @@ procedure THeaderTranslator.WriteConstantsRhs(Tokens: TArray; StartIndex StringConcatPlusInserted : Boolean; begin StringConcatPlusInserted := False; - for I := StartIndex to Count - 1 do begin S := Tokens[I]; IsString := False; - { Issue #4 (https://github.com/neslib/Chet/issues/4) Convert wide character string constant (L"..."). These are the supported prefixes: @@ -1779,13 +1789,18 @@ procedure THeaderTranslator.WriteEnumTypeConst(const ACursor: TCursor); IsUnsigned := True; end; - TTypeKind.UInt, - TTypeKind.ULong: + TTypeKind.UInt: begin FWriter.WriteLn('Cardinal;'); IsUnsigned := True; end; + TTypeKind.ULong: + begin + FWriter.WriteLn('Longword;'); + IsUnsigned := True; + end; + TTypeKind.ULongLong: begin FWriter.WriteLn('UInt64;'); @@ -1799,10 +1814,12 @@ procedure THeaderTranslator.WriteEnumTypeConst(const ACursor: TCursor); TTypeKind.Short: FWriter.WriteLn('Smallint;'); - TTypeKind.Int, - TTypeKind.Long: + TTypeKind.Int: FWriter.WriteLn('Integer;'); + TTypeKind.Long: + FWriter.WriteLn('Longint;'); + TTypeKind.LongLong: FWriter.WriteLn('Int64;'); else @@ -1982,8 +1999,10 @@ procedure THeaderTranslator.WriteForwardTypeDeclarations; CheckIndirection(['short', 'short int'], 'Smallint'); CheckIndirection(['unsigned short int'], 'Word'); - CheckIndirection(['long', 'int', 'long int'], 'Integer'); - CheckIndirection(['unsigned int', 'unsigned long int'], 'Cardinal'); + CheckIndirection(['int'], 'Integer'); + CheckIndirection(['long', 'long int'], 'Longint'); + CheckIndirection(['unsigned int'], 'Cardinal'); + CheckIndirection(['unsigned long', 'unsigned long int'], 'Longword'); CheckIndirection(['long long int'], 'Int64'); CheckIndirection(['unsigned long long int'], 'UInt64'); CheckIndirection(['float'], 'Single'); @@ -2115,6 +2134,9 @@ procedure THeaderTranslator.WriteFunctionProto(const ACursor: TCursor; ResType, ProtoType: TType; ArgIndex, ArgCount: Integer; HasResult: Boolean; +{$IFnDEF OldHandleCallConv} + CallConv: string; +{$ENDIF} begin { AType is the function proto type (of kind FunctionProto or FunctionNoProto). Use its ResultType and ArgTypes properties for parameter type information. @@ -2204,15 +2226,41 @@ procedure THeaderTranslator.WriteFunctionProto(const ACursor: TCursor; else FWriter.Write(')'); +{$IFnDEF OldHandleCallConv} + CallConv := ';'; + // https://clang.llvm.org/docs/AttributeReference.html#calling-conventions + // this needs explicitly specify the target platform by specifying the command line options + // --target=i686-pc-win32 --target=i686-pc-windows-msvc + case AType.FunctionCallingConv of + + TCallingConv.C: CallConv := CallConv + ' cdecl'; + TCallingConv.X86StdCall, + TCallingConv.Win64{X86_64Win64}: CallConv := CallConv + ' stdcall'; + TCallingConv.X86FastCall: CallConv := CallConv + ' fastcall'; + TCallingConv.X86Pascal: CallConv := CallConv + ' pascal'; + TCallingConv.X86RegCall: CallConv := CallConv + ' register'; + else + begin + if FProject.CallConv = TCallConv.StdCall then + CallConv := CallConv + ' stdcall' + else + CallConv := CallConv + ' cdecl'; + if AType.FunctionCallingConv <> TCallingConv.Default then + CallConv := CallConv + ' { TODO -cFIXME: Calling conversion may be wrong! }'; + end; + end; if (AType.Kind = TTypeKind.FunctionProto) and (AType.IsFunctionVariadic) then - FWriter.Write(' varargs'); + CallConv := CallConv + ' varargs'; - FWriter.Write(';'); - - if (FProject.CallConv = TCallConv.StdCall) then + FWriter.Write(CallConv); +{$ELSE} + if FProject.CallConv = TCallConv.StdCall then FWriter.Write(' stdcall') else FWriter.Write(' cdecl'); + if (AType.Kind = TTypeKind.FunctionProto) and (AType.IsFunctionVariadic) then + FWriter.Write(' varargs'); +{$ENDIF} end; procedure THeaderTranslator.WriteFunctions; diff --git a/Classes/Chet.Project.pas b/Classes/Chet.Project.pas index 317c055..a35f3ec 100644 --- a/Classes/Chet.Project.pas +++ b/Classes/Chet.Project.pas @@ -8,6 +8,12 @@ interface System.IniFiles, System.TypInfo; +const + { MS Windows SDK Root folder environment variable name} + cWindowsSDKRoot = 'WindowsSDK_Root'; + { MS Windows SDK include folders environment variable name } + cWindowsSDK_IncludePaths = 'WindowsSDK_IncludePaths'; + {$SCOPEDENUMS ON} type @@ -178,6 +184,7 @@ TProject = class FPlatforms: array [TPlatformType] of TPlatform; FIgnoreParseErrors: Boolean; + FShowParserWarnings: Boolean; FCmdLineArgs: TStringList; FCallConv: TCallConv; @@ -202,6 +209,7 @@ TProject = class procedure SetHeaderFileDirectory(const Value: String); procedure SetIncludeSubdirectories(const Value: Boolean); procedure SetIgnoreParseErrors(const Value: Boolean); + procedure SetShowParserWarnings(const AValue: Boolean); function GetDelimitedCmdLineArgs: String; function GetCmdLineArgs: TArray; procedure SetTargetPasFile(const Value: String); @@ -273,6 +281,8 @@ TProject = class AIndex: index of the command line argument to delete. } procedure DeleteCmdLineArg(const AIndex: Integer); + function WinSDKIncludePaths: TArray; + { Name of the project file containing the configuration settings for this project. } property ProjectFilename: String read FProjectFilename; @@ -323,6 +333,8 @@ TProject = class { Whether to ignore parse errors and try to convert header files anyway. } property IgnoreParseErrors: Boolean read FIgnoreParseErrors write SetIgnoreParseErrors; + { Whether parser warnings and diagnostic messages should be displayed (might be useful to look for possible conversion errors). } + property ShowParserWarnings: Boolean read FShowParserWarnings write SetShowParserWarnings; { The calling convention to use for translated function. } property CallConv: TCallConv read FCallConv write SetCallConv; @@ -407,6 +419,7 @@ implementation ID_USE_UNITS = 'UseUnits'; ID_TARGET_PAS_FILE = 'TargetPasFile'; ID_IGNORE_PARSE_ERRORS = 'IgnoreParseErrors'; + ID_SHOW_PARSE_WARN = 'ShowParserWarnings'; ID_CMD_LINE_ARGS = 'CmdLineArgs'; ID_CALL_CONV = 'CallConv'; ID_CHAR_CONVERT = 'CharConvert'; @@ -605,6 +618,7 @@ procedure TProject.Load(const AFilename: String); FPlatforms[P].Load(IniFile); FIgnoreParseErrors := IniFile.ReadBool(IS_PARSE_OPTIONS, ID_IGNORE_PARSE_ERRORS, False); + FShowParserWarnings := IniFile.ReadBool(IS_PARSE_OPTIONS, ID_SHOW_PARSE_WARN, False); FCmdLineArgs.DelimitedText := IniFile.ReadString(IS_PARSE_OPTIONS, ID_CMD_LINE_ARGS, ''); FCallConv := IniFile.ReadEnum(IS_CONVERT_OPTIONS, ID_CALL_CONV, TCallConv.Cdecl); @@ -649,6 +663,9 @@ procedure TProject.New(const AProjectName: String); FPlatforms[TPlatformType.iOS].LibraryName := 'lib' + AProjectName + '_ios.a'; FPlatforms[TPlatformType.Android32].LibraryName := 'lib' + AProjectName + '_android32.a'; FPlatforms[TPlatformType.Android64].LibraryName := 'lib' + AProjectName + '_android64.a'; + // default target win32/msvc + FCmdLineArgs.Add('--target=i686-pc-win32'); + FCmdLineArgs.Add('--target=i686-pc-windows-msvc'); end; procedure TProject.Reset; @@ -668,6 +685,7 @@ procedure TProject.Reset; FPlatforms[P].Reset; FIgnoreParseErrors := False; + FShowParserWarnings := False; FCmdLineArgs.Clear; FCallConv := TCallConv.Cdecl; @@ -706,6 +724,7 @@ procedure TProject.Save(const AFilename: String); FPlatforms[P].Save(IniFile); IniFile.WriteBool(IS_PARSE_OPTIONS, ID_IGNORE_PARSE_ERRORS, FIgnoreParseErrors); + IniFile.WriteBool(IS_PARSE_OPTIONS, ID_SHOW_PARSE_WARN, FShowParserWarnings); IniFile.WriteString(IS_PARSE_OPTIONS, ID_CMD_LINE_ARGS, FCmdLineArgs.DelimitedText); IniFile.WriteEnum(IS_CONVERT_OPTIONS, ID_CALL_CONV, FCallConv); @@ -892,6 +911,15 @@ procedure TProject.SetScript(const AValue: String); end; end; +procedure TProject.SetShowParserWarnings(const AValue: Boolean); +begin + if (AValue <> FShowParserWarnings) then + begin + FShowParserWarnings := AValue; + FModified := True; + end; +end; + procedure TProject.SetSymbolsToIgnore(const Value: TStrings); begin FSymbolsToIgnore.Assign(Value); @@ -940,6 +968,11 @@ procedure TProject.SymbolsToIgnoreChange(Sender: TObject); FModified := True; end; +function TProject.WinSDKIncludePaths: TArray; +begin + Result := GetEnvironmentVariable(cWindowsSDK_IncludePaths).Split([';'],'"','"',TStringSplitOptions.ExcludeEmpty); +end; + { TPlatform } constructor TPlatform.Create(const AProject: TProject; diff --git a/Externals/ScriptStringList.pas b/Externals/ScriptStringList.pas index 024b9e2..5f961b5 100644 --- a/Externals/ScriptStringList.pas +++ b/Externals/ScriptStringList.pas @@ -8,7 +8,7 @@ Can be used to "clean" up and create compilable Delphi unit generated by Chet (https://github.com/neslib/Chet) -Copyright © 2022 tinyBigGAMES™ LLC +Copyright ? 2022 tinyBigGAMES? LLC All Rights Reserved. Website: https://tinybiggames.com @@ -74,12 +74,14 @@ TScriptStringList = class(TStringList) destructor Destroy; override; function GetLineIndex(aOccurence: Cardinal; const aLine: string): Integer; function ReplaceLine(aOccurence: Cardinal; const aOldLine: string; const aNewLine: string; aOffset: Integer): Boolean; + function ReplaceAllText(const AOldText: string; const ANewText: string; aOffset: Integer; const AReplaceAll: Boolean; const AIngoreCase: Boolean): Boolean; function RemoveLines(aOccurence: Cardinal; const aReferenceLine: string; aOffset: Integer; aCount: Cardinal): Boolean; function RemoveLineRange(aOccurence: Cardinal; const aStartLine: string; const aEndLine: string): Boolean; function RemoveLineRangeAll(const aStartLine: string; const aEndLine: string): Boolean; function InsertLine(aOccurence: Cardinal; const aReferenceLine: string; aOffset: Integer; const aNewLine: string): Boolean; function InsertTextFile(aOccurence: Cardinal; const aReferenceLine: string; aOffset: Integer; const aTextFilename: string): Boolean; function RemoveAllLines(const aStartText: string; aCount: Integer): Boolean; + function RemoveAllLinesThatHas(const aText: string; aCount: Integer): Boolean; function RegEx(const aPattern: string; const aValue: string; const aOperation: string): Boolean; function SaveToFileEx(const aFilename: string): Boolean; function LoadFromFileEx(const aFilename: string): Boolean; @@ -193,6 +195,11 @@ function TScriptStringList.ReplaceLine(aOccurence: Cardinal; const aOldLine: str Result := True; end; +function TScriptStringList.ReplaceAllText(const AOldText: string; const ANewText: string; aOffset: Integer; const AReplaceAll: Boolean; const AIngoreCase: Boolean): Boolean; +begin + Result := False; +end; + function TScriptStringList.RemoveLines(aOccurence: Cardinal; const aReferenceLine: string; aOffset: Integer; aCount: Cardinal): Boolean; var LIndex: Integer; @@ -299,6 +306,27 @@ function TScriptStringList.RemoveAllLines(const aStartText: string; aCount: Inte Result := True; end; +function TScriptStringList.RemoveAllLinesThatHas(const aText: string; aCount: Integer): Boolean; +var + LIndex: Integer; + LText: string; + LCount: Integer; +begin + Result := False; + if aText.IsEmpty then Exit; + + for LIndex := Self.Count-1 downto 0 do + begin + LText := Self[LIndex].Trim; + if LText.Contains(aText) then + begin + for LCount := 0 to aCount-1 do + Self.Delete(LIndex); + end; + end; + + Result := True; +end; function TScriptStringList.RegEx(const aPattern: string; const aValue: string; const aOperation: string): Boolean; var @@ -365,15 +393,10 @@ function TScriptStringList.CreateDynamicImport(aType: Integer): Boolean; LIndex: Integer; LIndexStart: Integer; LImportList: TStringList; + LRoutineList: TStringList; - (* - procedure InsertLine(const aLine: string); - begin - Self.InsertLine(1, 'implementation', 1, aLine); - end; - *) - procedure InsertLine(const aLine: string); + procedure InsLine(const aLine: string); overload; begin Self.Insert(LIndexStart+1, aLine); end; @@ -385,6 +408,7 @@ function TScriptStringList.CreateDynamicImport(aType: Integer): Boolean; if LIndexStart = -1 then Exit; LImportList := TStringList.Create(dupIgnore, True, False); + LRoutineList := TStringList.Create; for LIndex := 0 to Self.Count-1 do begin @@ -394,10 +418,10 @@ function TScriptStringList.CreateDynamicImport(aType: Integer): Boolean; LLine := LLine.Replace('procedure ', '').Trim; LLine := LLine.Replace('(', ': procedure('); LLine := ' ' + LLine; - Self[LIndex] := LLine; + Self[LIndex] := '{REMOVELINE}'; LName := LLine.Substring(0, LLine.IndexOf(':')).Trim; - //WriteLn(LName); LImportList.Add(LName); + LRoutineList.Add(LLine); end else if LLine.StartsWith('function ', True) then @@ -405,16 +429,31 @@ function TScriptStringList.CreateDynamicImport(aType: Integer): Boolean; LLine := LLine.Replace('function ', '').Trim; LLine := LLine.Replace('(', ': function('); LLine := ' ' + LLine; - Self[LIndex] := LLine; + Self[LIndex] := '{REMOVELINE}'; LName := LLine.Substring(0, LLine.IndexOf(':')).Trim; - //WriteLn(LName); LImportList.Add(LName); + LRoutineList.Add(LLine); end end; + RemoveAllLines('{REMOVELINE}', 1); + RemoveAllLines('external ', 2); - InsertLine('end;'); - InsertLIne('{$ENDREGION}'); + LIndexStart := Self.GetLineIndex(1, 'implementation'); + if LIndexStart = -1 then Exit; + + for LIndex := LRoutineList.Count-1 downto 0 do + begin + Self.Insert(LIndexStart, LRoutineList[LIndex]); + end; + + if LRoutineList.Count > 0 then + Self.Insert(LIndexStart, 'var'); + + LIndexStart := Self.GetLineIndex(1, 'implementation'); + if LIndexStart = -1 then Exit; + + InsLine('end;'); for LIndex := LImportList.Count-1 downto 0 do begin LName := LImportList[LIndex]; @@ -425,41 +464,50 @@ function TScriptStringList.CreateDynamicImport(aType: Integer): Boolean; else if atype = 1 then LLine := Format(' %s := MemoryGetProcAddress(aDLLHandle, ''%s'');', [LImportList[LIndex], LName]); - InsertLine(LLine); + InsLine(LLine); end; if aType = 0 then - InsertLine(' if aDllHandle = 0 then Exit;') + InsLine(' if aDllHandle = 0 then Exit;') else if aType = 1 then - InsertLine(' if not Assigned(aDllHandle) then Exit;'); + InsLine(' if not Assigned(aDllHandle) then Exit;'); - InsertLIne('{$REGION ''Exports''}'); - InsertLine('begin'); + InsLine('begin'); if aType = 0 then - InsertLine('procedure GetExports(const aDLLHandle: THandle);') + InsLine('procedure GetExports(const aDLLHandle: THandle);') else if aType = 1 then - InsertLine('procedure GetExports(const aDLLHandle: Pointer);'); - InsertLine(''); + InsLine('procedure GetExports(const aDLLHandle: Pointer);'); + InsLine(''); + if aType = 0 then begin - InsertLine(' WinApi.Windows;'); - InsertLine(' System.Classes,'); + InsertLine(1, 'interface', 1, ' WinApi.Windows;'); + InsertLine(1, 'interface', 1, ' System.Classes,'); + InsertLine(1, 'interface', 1, ' System.SysUtils,'); end else if aType = 1 then begin - InsertLine(' MemoryModule;'); - InsertLine(' WinApi.Windows,'); - InsertLine(' System.Classes,'); + InsertLine(1, 'interface', 1, ' MemoryModule;'); + InsertLine(1, 'interface', 1, ' WinApi.Windows,'); + InsertLine(1, 'interface', 1, ' System.Classes,'); + InsertLine(1, 'interface', 1, ' System.SysUtils,'); end; - InsertLine('uses'); - InsertLine(''); + InsertLine(1, 'interface', 1, 'uses'); + InsertLine(1, 'interface', 1, ''); + + FreeAndNil(LRoutineList); FreeAndNil(LImportList); - RemoveAllLines('external', 2); + RemoveAllLines('external ', 2); + InsertLine(1, 'implementation', 0, ''); + InsertLine(1, 'implementation', 0, 'procedure GetExports(const aDLLHandle: THandle);'); + InsertLine(1, 'implementation', 0, ''); + + RemoveLines(1, 'const', 0, 8); end; function TScriptStringList.Evaluate(const aScript: string): Boolean; @@ -472,6 +520,8 @@ function TScriptStringList.Evaluate(const aScript: string): Boolean; LText3: string; LOffset: Integer; LCount: Cardinal; + LBool1: Boolean; + LBool2: Boolean; function RemoveDoubleQuotes(const aString: string): string; begin @@ -495,6 +545,19 @@ function TScriptStringList.Evaluate(const aScript: string): Boolean; Result := Self.ReplaceLine(LOccurence, LText1, LText2, LOffset); end else + // ReplaceAllText(const AOldText: string; const ANewText: string; aOffset: Integer; const AReplaceAll: Boolean; const AIngoreCase: Boolean): Boolean; + // ReplaceAllText("(Sint8)", "", 0) + if GetScriptParams(LScript, 'ReplaceAllText', 5, LParams) then + begin + // + LText1 := RemoveDoubleQuotes(LParams[0]).Trim; + LText2 := RemoveDoubleQuotes(LParams[1]); + LOffset := LParams[2].ToInteger; + LBool1 := LParams[3].ToBoolean; + LBool2 := LParams[4].ToBoolean; + Result := Self.ReplaceAllText(LText1, LText2, LOffset, LBool1, LBool2); + end + else // RemoveLines(aOccurence: Cardinal; const aReferenceLine: string; aOffset: Integer; aCount: Cardinal) // RemoveLines(1, "refline", 1, 1) if GetScriptParams(LScript, 'RemoveLines', 4, LParams) then @@ -537,7 +600,15 @@ function TScriptStringList.Evaluate(const aScript: string): Boolean; Result := Self.RemoveAllLines(LText1, LCount); end else - //RemoveLineRangeAll(const aStartLine: string; const aEndLine: string): Boolean; + //RemoveAllLinesThasHas(const aText: string; aCount: Integer): Boolean + //RemoveAllLinesThatHs("_text_", 1) + if GetScriptParams(LScript, 'RemoveAllLinesThatHas', 2, LParams) then + begin + LText1 := RemoveDoubleQuotes(LParams[0]).Trim; + LCount := LParams[1].ToInteger; + Result := Self.RemoveAllLinesThatHas(LText1, LCount); + end + else //RemoveLineRangeAll(const aStartLine: string; const aEndLine: string): Boolean; //RemoveLineRangeAll("startline", "endline") if GetScriptParams(LScript, 'RemoveLineRangeAll', 2, LParams) then begin @@ -623,4 +694,4 @@ function TScriptStringList.RunScript: Boolean; Result := True; end; -end. +end. \ No newline at end of file diff --git a/Forms/Form.Main.dfm b/Forms/Form.Main.dfm index 7afb62f..47f90ba 100644 --- a/Forms/Form.Main.dfm +++ b/Forms/Form.Main.dfm @@ -2,14 +2,15 @@ object FormMain: TFormMain Left = 0 Top = 0 Caption = 'Chet - C header translator' - ClientHeight = 899 - ClientWidth = 1308 - Color = clBtnFace - Constraints.MinHeight = 760 - Constraints.MinWidth = 1160 + ClientHeight = 294 + ClientWidth = 558 + Color = clWindow + Constraints.MinHeight = 380 + Constraints.MinWidth = 580 + Ctl3D = False Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText - Font.Height = -22 + Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] Menu = MainMenu @@ -18,32 +19,31 @@ object FormMain: TFormMain OnCloseQuery = FormCloseQuery OnCreate = FormCreate OnDestroy = FormDestroy - PixelsPerInch = 192 - TextHeight = 27 + TextHeight = 13 object StatusBar: TStatusBar Left = 0 - Top = 860 - Width = 1308 - Height = 39 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Top = 274 + Width = 558 + Height = 20 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Panels = <> + ExplicitLeft = -9 + ExplicitTop = 251 end object ButtonGroupCategories: TButtonGroup Left = 0 Top = 0 - Width = 251 - Height = 860 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Width = 126 + Height = 274 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Align = alLeft BorderStyle = bsNone - ButtonHeight = 48 - ButtonWidth = 48 ButtonOptions = [gboFullSize, gboGroupStyle, gboShowCaptions] Items = < item @@ -72,910 +72,973 @@ object FormMain: TFormMain OnButtonClicked = ButtonGroupCategoriesButtonClicked end object CardPanel: TCardPanel - Left = 251 + Left = 126 Top = 0 - Width = 1057 - Height = 860 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Width = 432 + Height = 274 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Align = alClient - ActiveCard = PostProcess + ActiveCard = CardConversionOptions BevelOuter = bvNone - Padding.Left = 8 - Padding.Top = 8 + Padding.Left = 4 + Padding.Top = 4 TabOrder = 2 object CardProject: TCard - Left = 8 - Top = 8 - Width = 1049 - Height = 852 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 4 + Top = 4 + Width = 428 + Height = 270 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Project' CardIndex = 0 TabOrder = 0 DesignSize = ( - 1049 - 852) + 428 + 270) object LabelHeaderFileDirectory: TLabel - Left = 4 + Left = 2 Top = 0 - Width = 287 - Height = 27 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Width = 141 + Height = 13 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Directory with C Header files:' end object LabelPasFile: TLabel - Left = 4 - Top = 219 - Width = 176 - Height = 27 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 2 + Top = 110 + Width = 86 + Height = 13 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Target Pascal file:' end object LabelUses: TLabel - Left = 4 - Top = 307 - Width = 384 - Height = 27 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 2 + Top = 154 + Width = 188 + Height = 13 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Comma-separated list of units to "use":' end object LabelIgnoredHeaders: TLabel - Left = 4 - Top = 135 - Width = 608 - Height = 27 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 2 + Top = 68 + Width = 297 + Height = 13 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Comma-separated list of files to "ignore" in headers Directory:' end object EditHeaderFileDirectory: TEdit - Left = 4 - Top = 31 - Width = 925 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 2 + Top = 16 + Width = 367 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Anchors = [akLeft, akTop, akRight] TabOrder = 0 OnChange = EditHeaderFileDirectoryChange end object ButtonBrowseHeaderFileDirectory: TButton - Left = 933 - Top = 28 - Width = 67 - Height = 47 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 370 + Top = 14 + Width = 33 + Height = 24 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Anchors = [akTop, akRight] Caption = '...' TabOrder = 1 OnClick = ButtonBrowseHeaderFileDirectoryClick end object CheckBoxIncludeSubdiretories: TCheckBox - Left = 4 - Top = 91 - Width = 335 - Height = 33 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 2 + Top = 46 + Width = 168 + Height = 16 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Include subdirectories' TabOrder = 2 OnClick = CheckBoxIncludeSubdiretoriesClick end object EditPasFile: TEdit - Left = 4 - Top = 248 - Width = 925 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 2 + Top = 124 + Width = 367 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Anchors = [akLeft, akTop, akRight] TabOrder = 4 OnChange = EditPasFileChange end object ButtonBrowsePasFile: TButton - Left = 933 - Top = 247 - Width = 67 - Height = 45 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 370 + Top = 124 + Width = 33 + Height = 22 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Anchors = [akTop, akRight] Caption = '...' TabOrder = 5 OnClick = ButtonBrowsePasFileClick end object EditUseUnits: TEdit - Left = 4 - Top = 336 - Width = 993 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 2 + Top = 168 + Width = 401 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Anchors = [akLeft, akTop, akRight] TabOrder = 6 OnChange = EditUseUnitsChange end object EditIgnoredHeaders: TEdit - Left = 4 - Top = 164 - Width = 993 - Height = 35 + Left = 2 + Top = 82 + Width = 401 + Height = 19 Hint = 'eq. ".\subdir1\header1.h,subdir2\header2.h" or "header1.h,.\head' + 'er2.h"' - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Anchors = [akLeft, akTop, akRight] TabOrder = 3 OnChange = EditIgnoredHeadersChange end end object CardPlatforms: TCard - Left = 8 - Top = 8 - Width = 1049 - Height = 852 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 4 + Top = 4 + Width = 428 + Height = 270 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Platforms' CardIndex = 1 TabOrder = 4 object LabelPlatform: TLabel - Left = 12 - Top = 136 - Width = 89 - Height = 27 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 6 + Top = 68 + Width = 44 + Height = 13 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Platform:' end object LabelLibrary: TLabel - Left = 236 - Top = 136 - Width = 136 - Height = 27 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 118 + Top = 68 + Width = 66 + Height = 13 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Library name:' end object LabelPrefix: TLabel - Left = 760 - Top = 136 - Width = 124 - Height = 27 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 380 + Top = 68 + Width = 62 + Height = 13 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Prefix (_PU):' end object LabelLibConstant: TLabel - Left = 12 - Top = 15 - Width = 164 - Height = 27 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 6 + Top = 8 + Width = 82 + Height = 13 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Library constant:' end object LabelDebugDefine: TLabel - Left = 12 - Top = 68 - Width = 138 - Height = 27 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 6 + Top = 34 + Width = 68 + Height = 13 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Debug define:' end object LabelDebugLibraryName: TLabel - Left = 503 - Top = 132 - Width = 200 - Height = 27 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 252 + Top = 66 + Width = 97 + Height = 13 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Debug lib (optional):' end object EditLibWin32: TEdit - Left = 236 - Top = 167 - Width = 251 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 118 + Top = 84 + Width = 126 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 3 OnChange = EditLibraryNameChange end object CheckBoxWin32: TCheckBox - Left = 12 - Top = 171 - Width = 220 - Height = 33 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 6 + Top = 86 + Width = 110 + Height = 16 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = '32-bit Windows' TabOrder = 2 OnClick = CheckBoxPlatformClick end object EditLibWin64: TEdit Tag = 1 - Left = 236 - Top = 220 - Width = 251 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 118 + Top = 110 + Width = 126 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 7 OnChange = EditLibraryNameChange end object CheckBoxWin64: TCheckBox Tag = 1 - Left = 12 - Top = 224 - Width = 220 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 6 + Top = 112 + Width = 110 + Height = 18 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = '64-bit Windows' TabOrder = 6 OnClick = CheckBoxPlatformClick end object CheckBoxMacARM: TCheckBox Tag = 2 - Left = 12 - Top = 279 - Width = 220 - Height = 33 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 6 + Top = 140 + Width = 110 + Height = 16 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'ARM macOS' TabOrder = 10 OnClick = CheckBoxPlatformClick end object EditLibMacARM: TEdit Tag = 2 - Left = 236 - Top = 275 - Width = 251 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 118 + Top = 138 + Width = 126 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 11 OnChange = EditLibraryNameChange end object CheckBoxLinux64: TCheckBox Tag = 4 - Left = 12 - Top = 387 - Width = 220 - Height = 33 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 6 + Top = 194 + Width = 110 + Height = 16 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = '64-bit Linux' TabOrder = 18 OnClick = CheckBoxPlatformClick end object EditLibLinux64: TEdit Tag = 4 - Left = 236 - Top = 383 - Width = 251 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 118 + Top = 192 + Width = 126 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 19 OnChange = EditLibraryNameChange end object CheckBoxIOS: TCheckBox Tag = 5 - Left = 12 - Top = 440 - Width = 220 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 6 + Top = 220 + Width = 110 + Height = 18 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'iOS' TabOrder = 22 OnClick = CheckBoxPlatformClick end object EditLibIOS: TEdit Tag = 5 - Left = 236 - Top = 436 - Width = 251 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 118 + Top = 218 + Width = 126 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 23 OnChange = EditLibraryNameChange end object CheckBoxAndroid32: TCheckBox Tag = 6 - Left = 12 - Top = 495 - Width = 220 - Height = 33 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 6 + Top = 248 + Width = 110 + Height = 16 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = '32-bit Android' TabOrder = 26 OnClick = CheckBoxPlatformClick end object EditLibAndroid32: TEdit Tag = 6 - Left = 236 - Top = 491 - Width = 251 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 118 + Top = 246 + Width = 126 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 27 OnChange = EditLibraryNameChange end object EditPrefixWin32: TEdit - Left = 760 - Top = 167 - Width = 60 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 380 + Top = 84 + Width = 30 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 5 OnChange = EditPrefixChange end object EditPrefixWin64: TEdit Tag = 1 - Left = 760 - Top = 220 - Width = 60 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 380 + Top = 110 + Width = 30 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 9 OnChange = EditPrefixChange end object EditPrefixMacARM: TEdit Tag = 2 - Left = 760 - Top = 275 - Width = 60 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 380 + Top = 138 + Width = 30 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 13 OnChange = EditPrefixChange end object EditPrefixLinux64: TEdit Tag = 4 - Left = 760 - Top = 383 - Width = 60 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 380 + Top = 192 + Width = 30 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 21 OnChange = EditPrefixChange end object EditPrefixIOS: TEdit Tag = 5 - Left = 760 - Top = 436 - Width = 60 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 380 + Top = 218 + Width = 30 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 25 OnChange = EditPrefixChange end object EditPrefixAndroid32: TEdit Tag = 6 - Left = 760 - Top = 491 - Width = 60 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 380 + Top = 246 + Width = 30 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 29 OnChange = EditPrefixChange end object EditLibConstant: TEdit - Left = 236 - Top = 8 - Width = 351 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 118 + Top = 4 + Width = 176 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 0 OnChange = EditLibConstantChange end object CheckBoxMacIntel: TCheckBox Tag = 3 - Left = 12 - Top = 332 - Width = 220 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 6 + Top = 166 + Width = 110 + Height = 18 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Intel macOS' TabOrder = 14 OnClick = CheckBoxPlatformClick end object EditLibMacIntel: TEdit Tag = 3 - Left = 236 - Top = 328 - Width = 251 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 118 + Top = 164 + Width = 126 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 15 OnChange = EditLibraryNameChange end object EditPrefixMacIntel: TEdit Tag = 3 - Left = 760 - Top = 328 - Width = 60 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 380 + Top = 164 + Width = 30 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 17 OnChange = EditPrefixChange end object CheckBoxAndroid64: TCheckBox Tag = 7 - Left = 12 - Top = 548 - Width = 220 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 6 + Top = 274 + Width = 110 + Height = 18 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = '64-bit Android' TabOrder = 30 OnClick = CheckBoxPlatformClick end object EditLibAndroid64: TEdit Tag = 7 - Left = 236 - Top = 544 - Width = 251 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 118 + Top = 272 + Width = 126 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 31 OnChange = EditLibraryNameChange end object EditPrefixAndroid64: TEdit Tag = 7 - Left = 760 - Top = 544 - Width = 60 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 380 + Top = 272 + Width = 30 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 33 OnChange = EditPrefixChange end object EditDebugDefine: TEdit - Left = 236 - Top = 63 - Width = 351 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 118 + Top = 32 + Width = 176 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 1 OnChange = EditDebugDefineChange end object EditLibDbgAndroid64: TEdit Tag = 7 - Left = 499 - Top = 544 - Width = 249 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 250 + Top = 272 + Width = 124 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 32 OnChange = EditDebugLibraryNameChange end object EditLibDbgAndroid32: TEdit Tag = 6 - Left = 499 - Top = 491 - Width = 249 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 250 + Top = 246 + Width = 124 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 28 OnChange = EditDebugLibraryNameChange end object EditLibDbgIOS: TEdit Tag = 5 - Left = 499 - Top = 436 - Width = 249 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 250 + Top = 218 + Width = 124 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 24 OnChange = EditDebugLibraryNameChange end object EditLibDbgLinux64: TEdit Tag = 4 - Left = 499 - Top = 383 - Width = 249 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 250 + Top = 192 + Width = 124 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 20 OnChange = EditDebugLibraryNameChange end object EditLibDbgMacIntel: TEdit Tag = 3 - Left = 499 - Top = 328 - Width = 249 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 250 + Top = 164 + Width = 124 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 16 OnChange = EditDebugLibraryNameChange end object EditLibDbgMacARM: TEdit Tag = 2 - Left = 499 - Top = 275 - Width = 249 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 250 + Top = 138 + Width = 124 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 12 OnChange = EditDebugLibraryNameChange end object EditLibDbgWin64: TEdit Tag = 1 - Left = 499 - Top = 220 - Width = 249 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 250 + Top = 110 + Width = 124 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 8 OnChange = EditDebugLibraryNameChange end object EditLibDbgWin32: TEdit - Left = 499 - Top = 167 - Width = 249 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 250 + Top = 84 + Width = 124 + Height = 19 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 TabOrder = 4 OnChange = EditDebugLibraryNameChange end end object CardParseOptions: TCard - Left = 8 - Top = 8 - Width = 1049 - Height = 852 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 4 + Top = 4 + Width = 428 + Height = 270 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Parse Options' CardIndex = 2 TabOrder = 1 - object LabelCmdLineArgs: TLabel - Left = 4 - Top = 47 - Width = 420 - Height = 27 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 - Caption = 'Command line arguments to pass to Clang:' - end - object CheckBoxIgnoreParseErrors: TCheckBox - Left = 4 - Top = 0 - Width = 299 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 - Caption = 'Ignore parse errors' + object PanelWinSDKControls: TPanel + Left = 0 + Top = 229 + Width = 428 + Height = 41 + Align = alBottom + BevelOuter = bvNone TabOrder = 0 - OnClick = CheckBoxIgnoreParseErrorsClick - end - object ListBoxCmdLineArgs: TListBox - Left = 4 - Top = 76 - Width = 807 - Height = 228 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 - ItemHeight = 27 + Visible = False + object LabelWinSDKVersion: TLabel + Left = 4 + Top = 9 + Width = 79 + Height = 13 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 + Caption = 'WinSDK version:' + end + object ComboBoxWinSDKVersion: TComboBox + Left = 101 + Top = 6 + Width = 324 + Height = 21 + Style = csDropDownList + TabOrder = 0 + TextHint = 'not selected' + OnChange = ComboBoxWinSDKVersionChange + end + end + object PanelDiagMessagesOpts: TPanel + Left = 0 + Top = 0 + Width = 428 + Height = 28 + Align = alTop + BevelOuter = bvNone TabOrder = 1 - OnClick = ListBoxCmdLineArgsClick - end - object ButtonAddCmdLineArg: TButton - Left = 4 - Top = 316 - Width = 200 - Height = 51 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 - Action = ActionAddCmdLineArg + object CheckBoxIgnoreParseErrors: TCheckBox + Left = 4 + Top = 7 + Width = 151 + Height = 16 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 + Caption = 'Ignore parse errors' + TabOrder = 0 + OnClick = CheckBoxIgnoreParseErrorsClick + end + object CheckBoxShowWarnings: TCheckBox + Left = 135 + Top = 7 + Width = 130 + Height = 16 + Hint = 'Display warnings and diagnostic messages' + Margins.Left = 1 + Margins.Top = 1 + Margins.Right = 1 + Margins.Bottom = 1 + Caption = 'Show warnings' + TabOrder = 1 + OnClick = CheckBoxShowWarningsClick + end + end + object PanelCMDLineArgs: TPanel + Left = 0 + Top = 28 + Width = 428 + Height = 201 + Align = alClient + BevelOuter = bvNone TabOrder = 2 - end - object ButtonDeleteArgument: TButton - Left = 608 - Top = 316 - Width = 200 - Height = 51 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 - Action = ActionDeleteCmdLineArg - TabOrder = 5 - end - object ButtonAddDefine: TButton - Left = 207 - Top = 316 - Width = 200 - Height = 51 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 - Action = ActionAddDefine - TabOrder = 3 - end - object ButtonAddIncludePath: TButton - Left = 408 - Top = 316 - Width = 200 - Height = 51 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 - Action = ActionAddIncludePath - TabOrder = 4 + object LabelCmdLineArgs: TLabel + Left = 0 + Top = 0 + Width = 428 + Height = 13 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 + Align = alTop + Caption = 'Command line arguments to pass to Clang:' + ExplicitWidth = 205 + end + object ListBoxCmdLineArgs: TListBox + Left = 0 + Top = 13 + Width = 428 + Height = 147 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 + Align = alClient + ItemHeight = 13 + TabOrder = 0 + OnClick = ListBoxCmdLineArgsClick + end + object PanelCMDLineArgsControls: TPanel + Left = 0 + Top = 160 + Width = 428 + Height = 41 + Align = alBottom + BevelOuter = bvNone + TabOrder = 1 + object ButtonAddCmdLineArg: TButton + Left = 4 + Top = 8 + Width = 100 + Height = 26 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 + Action = ActionAddCmdLineArg + TabOrder = 0 + end + object ButtonAddDefine: TButton + Left = 111 + Top = 8 + Width = 100 + Height = 26 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 + Action = ActionAddDefine + TabOrder = 1 + end + object ButtonAddIncludePath: TButton + Left = 219 + Top = 8 + Width = 100 + Height = 26 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 + Action = ActionAddIncludePath + TabOrder = 2 + end + object ButtonDeleteArgument: TButton + Left = 328 + Top = 8 + Width = 100 + Height = 26 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 + Action = ActionDeleteCmdLineArg + TabOrder = 3 + end + end end end object CardConversionOptions: TCard - Left = 8 - Top = 8 - Width = 1049 - Height = 852 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 4 + Top = 4 + Width = 428 + Height = 270 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Conversion Options' CardIndex = 3 TabOrder = 3 DesignSize = ( - 1049 - 852) + 428 + 270) object LabelConvertChar: TLabel - Left = 12 - Top = 123 - Width = 176 - Height = 27 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 6 + Top = 62 + Width = 88 + Height = 13 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Convert "char" to:' end object LabelConvertComments: TLabel - Left = 12 - Top = 68 - Width = 189 - Height = 27 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 6 + Top = 34 + Width = 92 + Height = 13 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Comment handling:' end object LabelCallConv: TLabel - Left = 12 - Top = 15 - Width = 184 - Height = 27 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 6 + Top = 8 + Width = 91 + Height = 13 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Calling convention:' end object LabelReservedWordHandling: TLabel - Left = 12 - Top = 231 - Width = 243 - Height = 27 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 6 + Top = 116 + Width = 120 + Height = 13 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Reserved word handling:' end object LabelUnconvertibleHandling: TLabel - Left = 12 - Top = 385 - Width = 264 - Height = 27 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 6 + Top = 193 + Width = 131 + Height = 13 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Unconvertible declarations:' end object LabelEnumHandling: TLabel - Left = 12 - Top = 331 - Width = 151 - Height = 27 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 6 + Top = 166 + Width = 73 + Height = 13 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Enum handling:' end object LabelConvertUnsignedChar: TLabel - Left = 15 - Top = 176 - Width = 270 - Height = 27 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 8 + Top = 88 + Width = 134 + Height = 13 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Convert "unsigned char" to:' end - object LabelCustomTypes: TLabel - Left = 15 - Top = 525 - Width = 188 - Height = 27 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 - Caption = 'Custom types map:' - FocusControl = MemoCustomTypesMap - end object ComboBoxConvertChar: TComboBox - Left = 296 - Top = 116 - Width = 560 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 148 + Top = 58 + Width = 280 + Height = 21 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Style = csDropDownList ItemIndex = 0 TabOrder = 2 @@ -988,14 +1051,14 @@ object FormMain: TFormMain 'AnsiString') end object ComboBoxConvertComments: TComboBox - Left = 296 - Top = 63 - Width = 560 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 148 + Top = 32 + Width = 280 + Height = 21 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Style = csDropDownList ItemIndex = 0 TabOrder = 1 @@ -1008,14 +1071,14 @@ object FormMain: TFormMain 'Convert comments to PasDoc style (experimental)') end object ComboBoxCallConv: TComboBox - Left = 296 - Top = 8 - Width = 560 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 148 + Top = 4 + Width = 280 + Height = 21 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Style = csDropDownList ItemIndex = 0 TabOrder = 0 @@ -1026,14 +1089,14 @@ object FormMain: TFormMain 'stdcall') end object ComboBoxReservedWordHandling: TComboBox - Left = 296 - Top = 225 - Width = 560 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 148 + Top = 113 + Width = 280 + Height = 21 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Style = csDropDownList ItemIndex = 0 TabOrder = 4 @@ -1045,14 +1108,14 @@ object FormMain: TFormMain 'Add trailing '#39'_'#39) end object CheckBoxDirectivesAsReservedWords: TCheckBox - Left = 12 - Top = 279 - Width = 383 - Height = 34 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 6 + Top = 140 + Width = 192 + Height = 17 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Treat directives as reserved words' Checked = True State = cbChecked @@ -1060,14 +1123,14 @@ object FormMain: TFormMain OnClick = CheckBoxDirectivesAsReservedWordsClick end object ComboBoxUnconvertibleHandling: TComboBox - Left = 296 - Top = 379 - Width = 560 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 148 + Top = 190 + Width = 280 + Height = 21 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Style = csDropDownList ItemIndex = 0 TabOrder = 7 @@ -1079,14 +1142,14 @@ object FormMain: TFormMain 'Ignore declaration') end object ComboBoxEnumHandling: TComboBox - Left = 296 - Top = 325 - Width = 560 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 148 + Top = 163 + Width = 280 + Height = 21 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Style = csDropDownList ItemIndex = 0 TabOrder = 6 @@ -1097,14 +1160,14 @@ object FormMain: TFormMain 'Convert to integer type and constants') end object ComboBoxConvertUnsignedChar: TComboBox - Left = 296 - Top = 171 - Width = 560 - Height = 35 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 148 + Top = 86 + Width = 280 + Height = 21 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Style = csDropDownList ItemIndex = 2 TabOrder = 3 @@ -1117,89 +1180,108 @@ object FormMain: TFormMain 'AnsiString') end object CheckBoxDelayedLoading: TCheckBox - Left = 12 - Top = 433 - Width = 663 - Height = 34 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 6 + Top = 223 + Width = 332 + Height = 17 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Add "delayed" directive to imported routines (Windows only)' TabOrder = 8 OnClick = CheckBoxDelayedLoadingClick end object CheckBoxPrefixSymbolsWithUnderscore: TCheckBox - Left = 15 - Top = 479 - Width = 661 - Height = 34 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 6 + Top = 248 + Width = 330 + Height = 17 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Prefix all symbols with an underscore (experimental)' TabOrder = 9 Visible = False OnClick = CheckBoxPrefixSymbolsWithUnderscoreClick end - object MemoCustomTypesMap: TMemo - Left = 4 - Top = 563 - Width = 1008 - Height = 268 - Hint = - 'Input format: CTypeName=DelphiTypeName. Use CTRL + ENTER to inse' + - 'rt new line.' - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + object GroupBoxCustomTypes: TGroupBox + Left = 3 + Top = 272 + Width = 419 + Height = 11 Anchors = [akLeft, akTop, akRight, akBottom] + Caption = 'Custom types map:' TabOrder = 10 - WantReturns = False - WordWrap = False + ExplicitWidth = 461 + ExplicitHeight = 92 + object MemoCustomTypesMap: TMemo + AlignWithMargins = True + Left = 5 + Top = 18 + Width = 409 + Height = 10 + Hint = + 'Input format: CTypeName=DelphiTypeName. Use CTRL + ENTER to inse' + + 'rt new line.' + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 + Align = alClient + BevelOuter = bvRaised + BorderStyle = bsNone + TabOrder = 0 + WantReturns = False + WordWrap = False + ExplicitLeft = 1 + ExplicitTop = 14 + ExplicitWidth = 423 + ExplicitHeight = 146 + end end end object CardIgnore: TCard - Left = 8 - Top = 8 - Width = 1049 - Height = 852 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 4 + Top = 4 + Width = 428 + Height = 270 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Ignore' CardIndex = 4 TabOrder = 5 object LabelIgnore: TLabel AlignWithMargins = True - Left = 12 - Top = 8 - Width = 1017 - Height = 54 - Margins.Left = 12 - Margins.Top = 8 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 6 + Top = 4 + Width = 418 + Height = 26 + Margins.Left = 6 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Align = alTop Caption = 'Symbols (constants, types, functions) to ignore. These will not ' + 'be translated. Enter one symbol per line. Symbols are case-sensi' + 'tive.' WordWrap = True + ExplicitWidth = 403 end object MemoIgnore: TMemo AlignWithMargins = True - Left = 8 - Top = 69 - Width = 1033 - Height = 775 - Margins.Left = 8 + Left = 4 + Top = 34 + Width = 420 + Height = 232 + Margins.Left = 4 Margins.Top = 0 - Margins.Right = 8 - Margins.Bottom = 8 + Margins.Right = 4 + Margins.Bottom = 4 Align = alClient ScrollBars = ssVertical TabOrder = 0 @@ -1208,33 +1290,33 @@ object FormMain: TFormMain end end object PostProcess: TCard - Left = 8 - Top = 8 - Width = 1049 - Height = 852 - Margins.Left = 11 - Margins.Top = 11 - Margins.Right = 11 - Margins.Bottom = 11 + Left = 4 + Top = 4 + Width = 428 + Height = 270 + Margins.Left = 6 + Margins.Top = 6 + Margins.Right = 6 + Margins.Bottom = 6 Caption = 'PostProcess' CardIndex = 5 TabOrder = 6 DesignSize = ( - 1049 - 852) + 428 + 270) object ScriptMemo: TMemo - Left = 9 - Top = 97 - Width = 1016 - Height = 738 - Margins.Left = 11 - Margins.Top = 11 - Margins.Right = 11 - Margins.Bottom = 11 + Left = 5 + Top = 49 + Width = 411 + Height = 213 + Margins.Left = 6 + Margins.Top = 6 + Margins.Right = 6 + Margins.Bottom = 6 Anchors = [akLeft, akTop, akRight, akBottom] Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText - Font.Height = -24 + Font.Height = -12 Font.Name = 'Consolas' Font.Style = [] Lines.Strings = ( @@ -1245,81 +1327,81 @@ object FormMain: TFormMain OnChange = ScriptMemoChange end object ButtonClearScript: TButton - Left = 9 - Top = 11 - Width = 227 - Height = 65 - Margins.Left = 11 - Margins.Top = 11 - Margins.Right = 11 - Margins.Bottom = 11 + Left = 5 + Top = 6 + Width = 113 + Height = 32 + Margins.Left = 6 + Margins.Top = 6 + Margins.Right = 6 + Margins.Bottom = 6 Caption = 'Clear Script' TabOrder = 1 OnClick = ButtonClearScriptClick end object ButtonScriptHelp: TButton - Left = 255 - Top = 11 - Width = 225 - Height = 65 - Margins.Left = 11 - Margins.Top = 11 - Margins.Right = 11 - Margins.Bottom = 11 + Left = 128 + Top = 6 + Width = 112 + Height = 32 + Margins.Left = 6 + Margins.Top = 6 + Margins.Right = 6 + Margins.Bottom = 6 Caption = 'Script Help' TabOrder = 2 OnClick = ButtonScriptHelpClick end object ButtonTranslate: TButton - Left = 497 - Top = 11 - Width = 227 - Height = 65 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 249 + Top = 6 + Width = 113 + Height = 32 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Translate' TabOrder = 3 OnClick = ButtonTranslateClick end end object CardTranslate: TCard - Left = 8 - Top = 8 - Width = 1049 - Height = 852 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Left = 4 + Top = 4 + Width = 428 + Height = 270 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Caption = 'Translate' CardIndex = 6 TabOrder = 2 object ButtonRunTranslator: TButton - Left = 4 + Left = 0 Top = 0 - Width = 303 - Height = 51 - Margins.Left = 7 - Margins.Top = 7 - Margins.Right = 7 - Margins.Bottom = 7 + Width = 428 + Height = 26 + Margins.Left = 4 + Margins.Top = 4 + Margins.Right = 4 + Margins.Bottom = 4 Action = ActionRunTranslator + Align = alTop TabOrder = 0 end object MemoMessages: TMemo AlignWithMargins = True - Left = 4 - Top = 56 - Width = 1045 - Height = 796 - Margins.Left = 4 + Left = 2 + Top = 26 + Width = 426 + Height = 244 + Margins.Left = 2 Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - Align = alBottom - Anchors = [akLeft, akTop, akRight, akBottom] + Align = alClient ScrollBars = ssVertical TabOrder = 1 end @@ -1359,6 +1441,7 @@ object FormMain: TFormMain end object ActionList: TActionList Images = ImageList + OnUpdate = ActionListUpdate Left = 48 Top = 188 object ActionAddCmdLineArg: TAction @@ -1385,6 +1468,7 @@ object FormMain: TFormMain object ActionRunTranslator: TAction Category = 'Translate' Caption = 'Run Header Translator' + Enabled = False ImageIndex = 4 ShortCut = 120 OnExecute = ActionRunTranslatorExecute diff --git a/Forms/Form.Main.pas b/Forms/Form.Main.pas index db3d61a..da13075 100644 --- a/Forms/Form.Main.pas +++ b/Forms/Form.Main.pas @@ -10,6 +10,8 @@ interface System.SysUtils, System.Variants, System.Classes, + Generics.Defaults, + Generics.Collections, System.Actions, System.UITypes, System.IOUtils, @@ -42,7 +44,6 @@ TFormMain = class(TForm) ActionList: TActionList; OpenDirectoryDialog: TFileOpenDialog; SaveDialogProject: TFileSaveDialog; - CheckBoxIgnoreParseErrors: TCheckBox; ActionAddCmdLineArg: TAction; ActionAddIncludePath: TAction; ActionAddDefine: TAction; @@ -51,12 +52,6 @@ TFormMain = class(TForm) EditHeaderFileDirectory: TEdit; ButtonBrowseHeaderFileDirectory: TButton; CheckBoxIncludeSubdiretories: TCheckBox; - ListBoxCmdLineArgs: TListBox; - LabelCmdLineArgs: TLabel; - ButtonAddCmdLineArg: TButton; - ButtonDeleteArgument: TButton; - ButtonAddDefine: TButton; - ButtonAddIncludePath: TButton; CardTranslate: TCard; ButtonRunTranslator: TButton; ActionRunTranslator: TAction; @@ -139,8 +134,6 @@ TFormMain = class(TForm) ButtonScriptHelp: TButton; LabelIgnoredHeaders: TLabel; EditIgnoredHeaders: TEdit; - LabelCustomTypes: TLabel; - MemoCustomTypesMap: TMemo; EditDebugDefine: TEdit; LabelDebugDefine: TLabel; EditLibDbgAndroid64: TEdit; @@ -153,6 +146,22 @@ TFormMain = class(TForm) EditLibDbgWin32: TEdit; LabelDebugLibraryName: TLabel; ButtonTranslate: TButton; + PanelWinSDKControls: TPanel; + LabelWinSDKVersion: TLabel; + ComboBoxWinSDKVersion: TComboBox; + PanelDiagMessagesOpts: TPanel; + CheckBoxIgnoreParseErrors: TCheckBox; + CheckBoxShowWarnings: TCheckBox; + PanelCMDLineArgs: TPanel; + LabelCmdLineArgs: TLabel; + ListBoxCmdLineArgs: TListBox; + PanelCMDLineArgsControls: TPanel; + ButtonAddCmdLineArg: TButton; + ButtonAddDefine: TButton; + ButtonAddIncludePath: TButton; + ButtonDeleteArgument: TButton; + GroupBoxCustomTypes: TGroupBox; + MemoCustomTypesMap: TMemo; procedure ButtonGroupCategoriesButtonClicked(Sender: TObject; Index: Integer); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure ActionAddCmdLineArgExecute(Sender: TObject); @@ -181,6 +190,7 @@ TFormMain = class(TForm) procedure ActionSaveExecute(Sender: TObject); procedure ActionSaveAsExecute(Sender: TObject); procedure ActionExitExecute(Sender: TObject); + procedure ActionListUpdate(Action: TBasicAction; var Handled: Boolean); procedure ActionNewExecute(Sender: TObject); procedure ComboBoxEnumHandlingChange(Sender: TObject); procedure EditUseUnitsChange(Sender: TObject); @@ -189,7 +199,8 @@ TFormMain = class(TForm) procedure CheckBoxDelayedLoadingClick(Sender: TObject); procedure CheckBoxPrefixSymbolsWithUnderscoreClick(Sender: TObject); procedure ButtonClearScriptClick(Sender: TObject); - procedure ButtonScriptHelpClick(Sender: TObject); + procedure ButtonScriptHelpClick(Sender: TObject); + procedure CheckBoxShowWarningsClick(Sender: TObject); procedure EditIgnoredHeadersChange(Sender: TObject); procedure MemoCustomTypesMapChange(Sender: TObject); procedure EditDebugDefineChange(Sender: TObject); @@ -197,6 +208,7 @@ TFormMain = class(TForm) procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure ButtonTranslateClick(Sender: TObject); + procedure ComboBoxWinSDKVersionChange(Sender: TObject); procedure ScriptMemoChange(Sender: TObject); private { Private declarations } @@ -207,6 +219,7 @@ TFormMain = class(TForm) FPlatformPrefix: array [TPlatformType] of TEdit; FFormScriptHelp: TFormScriptHelp; FScriptChanged: Boolean; + FWinSdkRoot: string; procedure NewProject(const AProjectName: String); procedure CheckScriptChanged; function CheckSave: Boolean; @@ -219,10 +232,12 @@ TFormMain = class(TForm) procedure UpdateControls; procedure UpdatePlatformControls; overload; procedure UpdatePlatformControls(const APlatform: TPlatformType); overload; + procedure UpdateSDKControlCombo; procedure AddCommandLineArgument(const AArgument: String); procedure ConfigError(const AMessage: String; const AControlToFocus: TWinControl = nil); procedure HandleTranslatorMessage(const AMessage: String); + procedure ReadWinSDKRoot; public { Public declarations } constructor Create(AOwner: TComponent); override; @@ -237,7 +252,8 @@ implementation {$R *.dfm} uses - Chet.Postprocessor; + Chet.Postprocessor, + Win.Registry; procedure TFormMain.ActionAddCmdLineArgExecute(Sender: TObject); begin @@ -358,7 +374,12 @@ procedure TFormMain.ActionRunTranslatorExecute(Sender: TObject); try Translator.OnMessage := HandleTranslatorMessage; Translator.Run; - TFilePostProcessor.Execute(FProject, ScriptMemo.Lines); + if ScriptMemo.Lines.Count > 0 then + begin + MemoMessages.Lines.Add('Running postprocessing scripts...'); + TFilePostProcessor.Execute(FProject, ScriptMemo.Lines); + MemoMessages.Lines.Add('Postprocessing done!'); + end; finally Translator.Free; end; @@ -591,6 +612,8 @@ constructor TFormMain.Create(AOwner: TComponent); FPlatformPrefix[TPlatformType.Android32] := EditPrefixAndroid32; FPlatformPrefix[TPlatformType.Android64] := EditPrefixAndroid64; + ReadWinSDKRoot; + if (ParamCount > 0) then Load(ParamStr(1)); @@ -604,6 +627,37 @@ destructor TFormMain.Destroy; inherited; end; +procedure TFormMain.ActionListUpdate(Action: TBasicAction; var Handled: Boolean); +begin + ActionRunTranslator.Enabled := not FProject.HeaderFileDirectory.IsEmpty and TDirectory.Exists(FProject.HeaderFileDirectory); +end; + +procedure TFormMain.CheckBoxShowWarningsClick(Sender: TObject); +begin + FProject.ShowParserWarnings := CheckBoxShowWarnings.Checked; +end; + +procedure TFormMain.ComboBoxWinSDKVersionChange(Sender: TObject); +var + IncludeRoot,EnvVarValue: string; +begin + if (ComboBoxWinSDKVersion.ItemIndex < 0) or FWinSdkRoot.IsEmpty then Exit; + + EnvVarValue := ComboBoxWinSDKVersion.Items[ComboBoxWinSDKVersion.ItemIndex]; + IncludeRoot := Format(FWinSdkRoot+'Include'+PathDelim+'%s',[EnvVarValue]); + if TDirectory.Exists(IncludeRoot) then + begin + envVarValue := + IncludeTrailingPathDelimiter(IncludeRoot)+'ucrt;' + + IncludeTrailingPathDelimiter(IncludeRoot)+'um;'+ + IncludeTrailingPathDelimiter(IncludeRoot)+'shared'; + end + else + envVarValue := ''; + + SetEnvironmentVariable(PChar(cWindowsSDK_IncludePaths),PChar(EnvVarValue)); +end; + procedure TFormMain.EditDebugDefineChange(Sender: TObject); begin FProject.DebugDefine := EditDebugDefine.Text; @@ -645,8 +699,12 @@ procedure TFormMain.EditLibraryNameChange(Sender: TObject); end; procedure TFormMain.EditPasFileChange(Sender: TObject); +var s: string; begin - FProject.TargetPasFile := EditPasFile.Text; + s := EditPasFile.Text; + if ExtractFileExt(s).IsEmpty then + s := ChangeFileExt(s,'.pas'); + FProject.TargetPasFile := s; end; procedure TFormMain.EditPrefixChange(Sender: TObject); @@ -723,6 +781,30 @@ procedure TFormMain.NewProject(const AProjectName: String); SetControls; end; +procedure TFormMain.ReadWinSDKRoot; +var + R: TRegistry; +begin + FWinSdkRoot := ''; + R := TRegistry.Create(KEY_READ OR KEY_WOW64_32KEY); + try + R.RootKey := HKEY_LOCAL_MACHINE; + if R.KeyExists('\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0') and + R.OpenKeyReadOnly('\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0') then //!!! that about not win10sdks? + begin + FWinSdkRoot := R.ReadString('InstallationFolder'); + end; + finally + R.Free; + end; + + if not FWinSdkRoot.IsEmpty and not TDirectory.Exists(FWinSdkRoot) then + FWinSdkRoot := ''; + + if not FWinSdkRoot.IsEmpty and not SetEnvironmentVariable(PChar(cWindowsSDKRoot),PChar(FWinSdkRoot)) then + FWinSdkRoot := ''; +end; + function TFormMain.Save: Boolean; begin if (FProject.ProjectFilename = '') then @@ -758,6 +840,7 @@ procedure TFormMain.SetControls; EditUseUnits.Text := FProject.UseUnits; CheckBoxIgnoreParseErrors.Checked := FProject.IgnoreParseErrors; + CheckBoxShowWarnings.Checked := FProject.ShowParserWarnings; ListBoxCmdLineArgs.Items.DelimitedText := FProject.DelimitedCmdLineArgs; ComboBoxCallConv.ItemIndex := Ord(FProject.CallConv); @@ -788,6 +871,8 @@ procedure TFormMain.SetControls; CardPanel.ActiveCard := CardProject; ButtonGroupCategories.ItemIndex := 0; + + UpdateSDKControlCombo; end; procedure TFormMain.SetPlatformControls; @@ -839,4 +924,82 @@ procedure TFormMain.UpdatePlatformControls(const APlatform: TPlatformType); FPlatformPrefix[APlatform].Enabled := B; end; + +procedure TFormMain.UpdateSDKControlCombo; +var + S: string; + I: Integer; + Versions: TArray; +begin + ComboBoxWinSDKVersion.Items.BeginUpdate; + try + ComboBoxWinSDKVersion.Clear; + + if not FWinSdkRoot.IsEmpty then + + Versions := TDirectory.GetDirectories(IncludeTrailingPathDelimiter(FWinSdkRoot)+'Include'); + + for I := 0 to High(Versions) do + Versions[I] := ExtractFileName(Versions[I]); + + if Length(Versions) > 1 then + begin + TArray.Sort(Versions,TComparer.Construct( + function(const Left, Right: string): Integer + var + StrCmpResult, I, J, II,JJ, LeftNum, RightNum: Integer; + begin + StrCmpResult := TComparer.Default.Compare(Left, Right); + if (StrCmpResult = 0) or ((Left.IndexOf('.') < 0) and (Right.IndexOf('.') < 0)) then + Exit(StrCmpResult); + + J := 1; + I := 1; + + while (I < Left.Length) or (J < Right.Length) do + begin + II := I; + while (II < Left.Length) and (Left [II] <> '.') do + Inc(II); + + LeftNum := StrToIntDef(Copy(Left,I,II-I), 0); + + JJ := J; + while (JJ < Right.Length) and (Right[JJ] <> '.') do + Inc(JJ); + + RightNum := StrToIntDef(Copy(Right,J,JJ-J), 0); + + Result := TComparer.Default.Compare(LeftNum, RightNum); + + if Result <> 0 then + Exit(-Result); // descending sort order + + I := II; + J := JJ; + + Inc(I); + Inc(J); + end; + + Result := StrCmpResult; + end + )); + end; + + for S in Versions do + ComboBoxWinSDKVersion.Items.Add(S); + + PanelWinSDKControls.Visible := ComboBoxWinSDKVersion.Items.Count > 0; + if PanelWinSDKControls.Visible then + begin + ComboBoxWinSDKVersion.ItemIndex := 0; + ComboBoxWinSDKVersionChange(ComboBoxWinSDKVersion); + end; + + finally + ComboBoxWinSDKVersion.Items.EndUpdate; + end; +end; + end. diff --git a/Sample/constants.h b/Sample/constants.h index b946c7f..d1617a4 100644 --- a/Sample/constants.h +++ b/Sample/constants.h @@ -7,4 +7,6 @@ #define HEX_CONSTANT2 0X4321 #define SHL_CONSTANT INT_CONSTANT<<2 #define SHR_CONSTANT 5>>2 -#define COMPLEX_CONSTANT ((((INT_CONSTANT<<2)+INT_CONSTANT) | 0xFE) & 255) \ No newline at end of file +#define COMPLEX_CONSTANT ((((INT_CONSTANT<<2)+INT_CONSTANT) | 0xFE) & 255) +/// todo: a.t - this definition translates incorectly and needs postprocessing +#define BUTTONS_OKA (LPSTR)1 \ No newline at end of file diff --git a/Sample/funcs.h b/Sample/funcs.h index be16a3e..7c08a37 100644 --- a/Sample/funcs.h +++ b/Sample/funcs.h @@ -1,3 +1,4 @@ +#include /// Func without parameters or result void SimpleFunc(); @@ -20,4 +21,7 @@ int FuncOtherUnnamedParam(int, float SomeParam); int FuncVariableParams(int SomeParam, ...); /// Func with param of procedural type -int FuncProcTypeParam(void (*fn)(float), void *Data); \ No newline at end of file +int FuncProcTypeParam(void (*fn)(float), void *Data); + +/// Func with param of procedural type +int WINAPI FuncProcTypeParam2(void CALLBACK (*fn)(float), void *Data); \ No newline at end of file diff --git a/Sample/proctypes.h b/Sample/proctypes.h index 3df617b..41d8ea2 100644 --- a/Sample/proctypes.h +++ b/Sample/proctypes.h @@ -1,3 +1,10 @@ +#include + +typedef int (CALLBACK *PFNCHECKINPUTA)(HWND hWnd,LPARAM lParamCheckInput,LPCSTR lpszOrigString,LPCSTR lpszString,LPSTR pszErrorBuf,int cchErrorMax); +typedef int (CALLBACK *PFNCHECKINPUTW)(HWND hWnd,LPARAM lParamCheckInput,LPCWSTR lpszOrigString,LPCWSTR lpszString,LPWSTR pszErrorBuf,int cchErrorMax); +typedef BOOL (CALLBACK *PFNOKINPUTA)(HWND hWnd,LPARAM lParamCheckInput,LPCSTR lpszOrigString,LPCSTR lpszString); +typedef BOOL (CALLBACK *PFNOKINPUTW)(HWND hWnd,LPARAM lParamCheckInput,LPCWSTR lpszOrigString,LPCWSTR lpszString); + /// Procedural type without parameters or result typedef void (*SimpleProc)(); @@ -20,4 +27,4 @@ typedef int (*ProcOtherUnnamedParam)(int, float SomeParam); typedef int (*ProcVariableParams)(int SomeParam, ...); /// Procedural type without star -typedef int (ProcNoStar)(int SomeParam); \ No newline at end of file +typedef int CALLBACK (ProcNoStar)(int SomeParam); diff --git a/Sample/sample.chet b/Sample/sample.chet index dfcd6cc..daa6ce9 100644 --- a/Sample/sample.chet +++ b/Sample/sample.chet @@ -2,11 +2,11 @@ HeaderFileDirectory=.\ IncludeSubdirs=1 TargetPasFile=.\sample.pas -UseUnits= +UseUnits=windows LibraryConstant=LIB_SAMPLE DebugDefine= ExcludedHeaders=usp10.h -CTypesToDelphiMap=WORD=UInt16,DWORD=UInt32,LONG=Int32,ULONG=UInt32,"BYTE=Byte " +CTypesToDelphiMap= [Platform.Win32] Enabled=1 @@ -33,7 +33,7 @@ DebugLibraryName= Prefix= [Platform.Linux64] -Enabled=1 +Enabled=0 LibraryName=sample.so DebugLibraryName= Prefix= @@ -58,7 +58,8 @@ Prefix= [ParseOptions] IgnoreParseErrors=1 -CmdLineArgs= +ShowParserWarnings=1 +CmdLineArgs=--target=i686-pc-win32,--target=i686-pc-windows-msvc [ConvertOptions] CallConv=Cdecl @@ -67,6 +68,7 @@ UnsignedCharConvert=Byte CommentConvert=KeepAsIs ReservedWordHandling=PrefixAmpersand TreatDirectivesAsReservedWords=1 +PrefixSymbolsWithUnderscore=0 DelayedLoading=0 EnumHandling=ConvertToEnum UnconvertibleHandling=WriteToDo @@ -75,5 +77,5 @@ UnconvertibleHandling=WriteToDo Count=0 [PostProcess] -Script=D40000005200650070006C006100630065004C0069006E006500280031002C002000220049004E0054005F0043004F004E005300540041004E00540020003D002000340032003B0022002C00200022002000200049004E0054005F0043004F004E005300540041004E00540020003D002000340033003B0022002C002000300029000D000A000D000A0049006E0073006500720074004C0069006E006500280031002C00200022004D00790049006E0074003A002000540049006E00740020003D002000310032003300340020006400690076002000330033003B0022002C00200030002C0020002200200020004D00790046006C006F00610074003A002000530069006E0067006C00650020003D00200031002E00320035003B00220029000D000A000D000A00520065006D006F00760065004C0069006E0065007300280031002C002000220054005500430068006100720020003D00200042007900740065003B0022002C00200030002C002000310029000D000A000D000A00530061007600650054006F00460069006C00650028002200730061006D0070006C0065002E0070006100730022002900 +Script=1F0100005200650070006C006100630065004C0069006E006500280031002C002000220049004E0054005F0043004F004E005300540041004E00540020003D002000340032003B0022002C00200022002000200049004E0054005F0043004F004E005300540041004E00540020003D002000340033003B0022002C002000300029000D000A005200650070006C006100630065004C0069006E006500280031002C002000220042005500540054004F004E0053005F004F004B00410020003D00200028004C005000530054005200290031003B0022002C00200022002000200042005500540054004F004E0053005F004F004B00410020003D0020004C0050005300540052002800310029003B0022002C002000300029000D000A000D000A0049006E0073006500720074004C0069006E006500280031002C00200022004D00790049006E0074003A002000540049006E00740020003D002000310032003300340020006400690076002000330033003B0022002C00200030002C0020002200200020004D00790046006C006F00610074003A002000530069006E0067006C00650020003D00200031002E00320035003B00220029000D000A000D000A00520065006D006F00760065004C0069006E0065007300280031002C002000220054005500430068006100720020003D00200042007900740065003B0022002C00200030002C002000310029000D000A000D000A00530061007600650054006F00460069006C00650028002200730061006D0070006C0065002E0070006100730022002900