; --------------------------------------------------------------------------------------------; Copyright (c) Fantaisie Software. All rights reserved.; Dual licensed under the GPL and Fantaisie Software licenses.; See LICENSE and LICENSE-FANTAISIE in the project root for license information.; --------------------------------------------------------------------------------------------CompilerIf #SpiderBasic; There is many info displayed in SpiderBasic#CompilerWindow_ListHeight = 250CompilerElseIf #CompileLinux; On Linux (gtk2) the font is usually much bigger, so make this larger there#CompilerWindow_ListHeight = 250CompilerElse#CompilerWindow_ListHeight = 100CompilerEndIfGlobal Options_IsProjectModeGlobal Options_CurrentBasePath$Global *Options_CurrentTarget.CompileTargetProcedure GetActiveCompileTarget()If *ActiveSourceIf *ActiveSource = *ProjectInfo Or *ActiveSource\ProjectFile ; active source is part of a projectProcedureReturn *DefaultTargetElseIf *ActiveSource\IsCodeProcedureReturn *ActiveSource ; the SourceFile structure extends the CompileTarget oneElseProcedureReturn 0 ; active source is a non-pb fileEndIfElseIf IsProjectProcedureReturn *DefaultTargetElseProcedureReturn 0EndIfEndProcedure; Find a CompileTarget structure from its unique ID;Procedure FindTargetFromID(ID)*Target.CompileTarget = 0If ID ; 0 is considered invalid, so do no search; Note: This function can be called inside another that loops on FileList(),; so do not use *ActiveSource to restore the position!Current = ListIndex(FileList())ForEach FileList()If @FileList() <> *ProjectInfo And FileList()\ID = ID*Target = @FileList()BreakEndIfNext FileList()SelectElement(FileList(), Current)If *Target = 0Current = ListIndex(ProjectTargets())ForEach ProjectTargets()If ProjectTargets()\ID = ID*Target = @ProjectTargets()BreakEndIfNext ProjectTargets()SelectElement(ProjectTargets(), Current)EndIfEndIfProcedureReturn *TargetEndProcedureProcedure SetCompileTargetDefaults(*Target.CompileTarget)*Target\Debugger = OptionDebugger*Target\Optimizer = OptionOptimizer*Target\EnableASM = OptionInlineASM*Target\EnableThread = OptionThread*Target\EnableXP = OptionXPSkin*Target\EnableAdmin = OptionVistaAdmin*Target\EnableUser = OptionVistaUser*Target\EnableWayland = OptionEnableWayland*Target\DPIAware = OptionDPIAware*Target\DllProtection = OptionDllProtection*Target\SharedUCRT = OptionSharedUCRT*Target\EnableOnError = OptionOnError*Target\ExecutableFormat = OptionExeFormat*Target\CPU = OptionCPU*Target\SubSystem$ = OptionSubSystem$*Target\UseCompileCount = OptionUseCompileCount*Target\UseBuildCount = OptionUseBuildCount*Target\UseCreateExe = OptionUseCreateExe*Target\TemporaryExePlace= OptionTemporaryExe*Target\CustomCompiler = OptionCustomCompiler*Target\CompilerVersion$ = OptionCompilerVersion$*Target\CurrentDirectory$= ""*Target\EnablePurifier = OptionPurifier*Target\PurifierGranularity$ = ""EndProcedureProcedure CompilerReady()DisableMenuItem(#MENU, #MENU_StructureViewer, 0)DisableMenuItem(#MENU, #MENU_CreateExecutable, 0)DisableMenuAndToolbarItem(#MENU_CompileRun, 0)DisableMenuAndToolbarItem(#MENU_SyntaxCheck, 0)CompilerReady = 1If *CurrentCompiler = @DefaultCompilerHistoryCompilerLoaded()InitSyntaxHighlighting(); Set up the os specific color values;SetUpHighlightingColors(); do this before scanning, as it affects saved data (known constants etc)InitStructureViewer(); Init the AutoComplete context sensitive constants (must be after InitStructureViewer() as it uses the ConstantList)AutoComplete_InitContextConstants()EndIf; Ok, everything is loaded, now highlight any already open files.;If EnableColoringIf ListSize(FileList()) > 0 ; on Linux, this happens before any source is open*CurrentFile = *ActiveSourceForEach FileList()If @FileList() <> *ProjectInfo*ActiveSource = @FileList()FullSourceScan(@FileList()) ; re-scan autocomplete + procedurebrowserSortParserData(@FileList()\Parser, @FileList()) ; update sorted data in case its not the active sourceUpdateFolding(@FileList(), 0, -1) ; redo all foldingSetBackgroundColor()UpdateHighlighting()EndIfNext FileList()ChangeCurrentElement(FileList(), *CurrentFile)*ActiveSource = *CurrentFileEndIfEndIf; Re-scan all non-loaded project files for changed options;If IsProjectForEach ProjectFiles()If ProjectFiles()\Source = 0 And ProjectFiles()\AutoScan ; not currently loaded, but scanningScanFile(ProjectFiles()\FileName,ドル @ProjectFiles()\Parser)EndIfNext ProjectFiles()EndIfIf IsWindow(#WINDOW_StructureViewer)DisplayStructureRootList()EndIf; reflect any source scan changesUpdateProcedureList()UpdateVariableViewer()EndProcedureGlobal CompilerWindowSmall, CompilerWindowBigProcedure AddCompilerWindowItem(Text$)AddGadgetItem(#GADGET_Compiler_List, -1, Text$)ScrollEditorGadgetToEnd(#GADGET_Compiler_List)EndProcedureProcedure DisplayCompilerWindow(); hide the warning window (if any), and clear the warning list (important)HideCompilerWarnings()If IsWindow(#WINDOW_MacroError)MacroErrorWindowEvents(#PB_Event_CloseWindow)EndIfIf OpenWindow(#WINDOW_Compiler, 0, 0, 400, 50, #ProductName,ドル #PB_Window_TitleBar | #PB_Window_Invisible, WindowID(#WINDOW_Main))Container = ContainerGadget(#PB_Any, 5, 5, 190, 40, #PB_Container_Single); add a dummy text for size calculationTextGadget(#GADGET_Compiler_Text, 15, 15, 120, 20, Language("Compiler","Compiling") + " (999999 "+Language("Compiler","Lines")+")")ButtonGadget(#GADGET_Compiler_Details, 240, 15, 50, 20, Language("Compiler", "Details"), #PB_Button_Toggle)CloseGadgetList()EditorGadget(#GADGET_Compiler_List, 5, 55, 190, 100, #PB_Editor_ReadOnly)ProgressBarGadget(#GADGET_Compiler_Progress, 5, 160, 190, 20, 0, 1000)ButtonGadget(#GADGET_Compiler_Abort, 145, 160, 50, 20, Language("Misc", "Abort")); calculate needed sizesGetRequiredSize(#GADGET_Compiler_Text, @TextWidth, @TextHeight)GetRequiredSize(#GADGET_Compiler_Details, @ButtonWidth, @ButtonHeight)GetRequiredSize(#GADGET_Compiler_Abort, @AbortWidth, @ButtonHeight); special handling is needed for OSX CocoaCompilerIf #CompileMacCocoa; border is large and not part of the client areaContainerBorderWidth = 16ContainerBorderHeight = 16ContainerOffsetX = 0ContainerOffsetY = 0MinButtonHeight = 40CompilerElse; add some distance to the borders in the client area on other osContainerBorderWidth = 20ContainerBorderHeight = 20ContainerOffsetX = 10ContainerOffsetY = 10MinButtonHeight = 20CompilerEndIfButtonWidth = Max(ButtonWidth, 60)AbortWidth = Max(AbortWidth, 60)ButtonHeight= Max(ButtonHeight, MinButtonHeight)Width = Max(20+ContainerBorderWidth+TextWidth+ButtonWidth, WindowWidth(#WINDOW_Compiler))Height = 10+ContainerBorderHeight+Max(TextHeight, ButtonHeight); for later resizingCompilerWindowSmall = HeightCompilerWindowBig = Height + 15 + ButtonHeight + #CompilerWindow_ListHeightResizeGadget(Container, 5, 5, Width-10, Height-10)ResizeGadget(#GADGET_Compiler_Text, ContainerOffsetX, ContainerOffsetY+(Height-30-TextHeight)/2, TextWidth, TextHeight)ResizeGadget(#GADGET_Compiler_Details, Width-20-ContainerBorderWidth-ButtonWidth+20, ContainerOffsetY, ButtonWidth, Height-30)ResizeGadget(#GADGET_Compiler_List, 5, Height+5, Width-10, #CompilerWindow_ListHeight)ResizeGadget(#GADGET_Compiler_Progress, 5, Height+10+#CompilerWindow_ListHeight, Width-15-AbortWidth, ButtonHeight)ResizeGadget(#GADGET_Compiler_Abort, Width-5-AbortWidth, Height+10+#CompilerWindow_ListHeight, AbortWidth, ButtonHeight); resize the window and re-center it as wellIf ShowCompilerProgressNewHeight = CompilerWindowBigSetGadgetState(#GADGET_Compiler_Details, 1)ElseNewHeight = CompilerWindowSmallEndIfResizeWindow(#WINDOW_Compiler, #PB_Ignore, #PB_Ignore, Width, NewHeight); set the real text to the textgadgetSetGadgetText(#GADGET_Compiler_Text, Language("Compiler","Compiling"))AddCompilerWindowItem(Language("Compiler","Compiling"))HideWindow(#WINDOW_Compiler, #False, #PB_Window_WindowCentered); StickyWindow(#WINDOW_Compiler, 1) ; Why sticky ? If we put the IDE to background it will stay above our browser for example, which is very annoyingEndIfDisableMenuItem(#MENU, #MENU_CreateExecutable, 1)DisableMenuAndToolbarItem(#MENU_CompileRun, 1)DisableMenuAndToolbarItem(#MENU_SyntaxCheck, 1); important so the active source cannot be closed/switched during compilingDisableWindow(#WINDOW_Main, 1)FlushEvents() ; allow the window to be drawn for linux compilingCompilerBusy = 1EndProcedureProcedure HideCompilerWindow(); In build window mode, ignore the hide call on errorsIf UseProjectBuildWindow = 0If IsWindow(#WINDOW_Compiler)CloseWindow(#WINDOW_Compiler)DisableMenuItem(#MENU, #MENU_CreateExecutable, 0)DisableMenuAndToolbarItem(#MENU_CompileRun, 0)DisableMenuAndToolbarItem(#MENU_SyntaxCheck, 0)EndIf; re-enable the main windowDisableWindow(#WINDOW_Main, 0)FlushEvents()EndIfCompilerBusy = 0EndProcedureProcedure StopCompilerWindow(); In build window mode, ignore the hide call on errorsIf UseProjectBuildWindow = 0If IsWindow(#WINDOW_Compiler)CloseWindow(#WINDOW_Compiler)DisableMenuItem(#MENU, #MENU_CreateExecutable, 0)DisableMenuAndToolbarItem(#MENU_CompileRun, 0)DisableMenuAndToolbarItem(#MENU_SyntaxCheck, 0)EndIf; re-enable the main windowDisableWindow(#WINDOW_Main, 0)FlushEvents()EndIfCompilerBusy = 0EndProcedureProcedure CompilerWindowEvents(EventID)If EventID = #PB_Event_GadgetIf EventGadget() = #GADGET_Compiler_DetailsShowCompilerProgress = GetGadgetState(#GADGET_Compiler_Details)If ShowCompilerProgressResizeWindow(#WINDOW_Compiler, #PB_Ignore, #PB_Ignore, #PB_Ignore, CompilerWindowBig)ElseResizeWindow(#WINDOW_Compiler, #PB_Ignore, #PB_Ignore, #PB_Ignore, CompilerWindowSmall)EndIfElseIf EventGadget() = #GADGET_Compiler_Abort; set the flag, the rest is done from the Compiler_HandleCompilerResponse() (CompilerInterface.pb)CompilationAborted = #TrueCompilerIf #SpiderBasicIf CompilerBusy = 0HideCompilerWindow()EndIfCompilerEndIfEndIfEndIfEndProcedure;- ------------------------------------------------Procedure BuildLogEntry(Message,ドル InfoIndex = -1)If UseProjectBuildWindow And BuildWindowDialogIndex = CountGadgetItems(#GADGET_Build_Log)AddGadgetItem(#GADGET_Build_Log, Index, Message$)SetGadgetItemData(#GADGET_Build_Log, Index, InfoIndex)SetGadgetState(#GADGET_Build_Log, Index)EndIfEndProcedure; Mode = 0: build target to OutputFile$; Mode = 1: open requester to ask for output file (on SpiderBasic, the same as Mode 0); Mode = 2: build target to temporary exe;; Returns: success/failure;Procedure.s BuildProjectTarget(*Target.CompileTarget, Mode, CreateExe, CheckSyntax)Protected OutputFile$Protected Success = #False; check if there is an input file for this targetIf *Target\MainFile$ = ""If CommandlineBuildPrintN(LanguagePattern("Compiler", "NoInputFile", "%target%", *Target\Name$))ElseIf UseProjectBuildWindowBuildLogEntry(LanguagePattern("Compiler", "NoInputFile", "%target%", *Target\Name$))ElseMessageRequester(#ProductName,ドル LanguagePattern("Compiler", "NoInputFile", "%target%", *Target\Name$), #FLAG_Error)EndIfProcedureReturn ""EndIf*Target\FileName$ = ResolveRelativePath(GetPathPart(ProjectFile$), *Target\MainFile$)If AutoSave And CommandlineBuild = 0AutoSave()EndIfCompilerIf #SpiderBasicIf Mode = 1 : Mode = 0 : EndIf ; Mode 1 doesn't exists in SpiderBasicCompilerEndIfIf Mode = 0 ; use fixed fileCompilerIf #SpiderBasicIf *Target\AppFormat = #AppFormatiOSTargetOutputFile$ = *Target\iOSAppOutput$ElseIf *Target\AppFormat = #AppFormatAndroidTargetOutputFile$ = *Target\AndroidAppOutput$ElseTargetOutputFile$ = *Target\HtmlFilename$EndIfCompilerElseTargetOutputFile$ = *Target\OutputFile$CompilerEndIfIf TargetOutputFile$ = ""If CommandlineBuildPrintN(LanguagePattern("Compiler", "NoOutputFile", "%target%", *Target\Name$))ElseIf UseProjectBuildWindowBuildLogEntry(LanguagePattern("Compiler", "NoOutputFile", "%target%", *Target\Name$))ElseMessageRequester(#ProductName,ドル LanguagePattern("Compiler", "NoOutputFile", "%target%", *Target\Name$), #FLAG_Error)EndIfProcedureReturn ""ElseOutputFile$ = ResolveRelativePath(GetPathPart(ProjectFile$), TargetOutputFile$) ; this is relativeEndIf; set this for later use and tools*Target\ExecutableName$ = OutputFile$ElseIf Mode = 1 ; ask for fileIf *Target\OutputFile$Path$ = ResolveRelativePath(GetPathPart(ProjectFile$), *Target\OutputFile$) ; this is relativeElseIf *Target\ExecutableName$ ; last compiled exePath$ = *Target\ExecutableName$ ; this is full pathElsePath$ = GetPathPart(ProjectFile$)EndIfIf *Target\ExecutableFormat = 2 ; shared dllCompilerIf #CompileWindowsPattern$ = Language("Compiler","DllPattern")Extension$ = ".dll"CompilerElseIf #CompileMacPattern$ = "Shared Library (*.dylib)|*.dylib|All Files (*.*)|*.*"Extension$ = ".dylib"CompilerElse ; LinuxPattern$ = "Shared Library (*.so)|*.so|All Files (*.*)|*.*"Extension$ = ".so"CompilerEndIfElseCompilerIf #CompileWindowsPattern$ = Language("Compiler","ExePattern")Extension$ = ".exe"CompilerElseIf #CompileMacPattern$ = ""If *Target\ExecutableFormat <> 1 ; consoleExtension$ = ".app"ElseExtension$ = ""EndIfCompilerElse ; LinuxPattern$ = ""Extension$ = ""CompilerEndIfEndIfOutputFile$ = SaveFileRequester(Language("Compiler","CreateExe"), Path,ドル Pattern,ドル 0)If OutputFile$ = ""ProcedureReturn ""EndIfIf LCase(Right(OutputFile,ドル Len(Extension$))) <> Extension$ And SelectedFilePattern() <> 1OutputFile$+Extension$EndIf; set this for later use and tools*Target\ExecutableName$ = OutputFile$Else ; use temp fileOutputFile$ = Compiler_TemporaryFilename(*Target)EndIfCompilerIf #DemoIf *Target\ExecutableFormat = 2 ; shared dllCompilerIf #CompileWindowsMessage$ = "DLL creation is not available in the demo version."CompilerElseMessage$ = "SO Library creation is not available in the demo version."CompilerEndIfIf CommandlineBuildPrintN(Message$)ElseIf UseProjectBuildWindowBuildLogEntry(Message$)ElseMessageRequester("Information", Message,ドル #FLAG_Info)EndIfElseCompilerEndIf; for the addtools, we need a temporary file, so they can modify it...If CopyFile(*Target\FileName,ドル TempPath$ + "PB_EditorOutput.pb")CompilerIf #CompileWindows; If the source file was readonly, so will be the temp file, so remove that!SetFileAttributes(TempPath$ + "PB_EditorOutput.pb", GetFileAttributes(TempPath$ + "PB_EditorOutput.pb") & ~#PB_FileSystem_ReadOnly)CompilerEndIf; append the procects settings for the tools if neededIf SaveProjectSettings <> #SAVESETTINGS_EndOfFile And OpenFile(#FILE_SaveSource, TempPath$+"PB_EditorOutput.pb")FileSeek(#FILE_SaveSource, Lof(#FILE_SaveSource)) ; to to the end of the fileSaveProjectSettings(*Target, #True, 1, 0)CloseFile(#FILE_SaveSource)EndIfAddTools_CompiledFile$ = TempPath$ + "PB_EditorOutput.pb"; save for AddToolsIf CreateExeAddTools_Execute(#TRIGGER_BeforeCreateExe, *Target)ElseAddTools_Execute(#TRIGGER_BeforeCompile, *Target)EndIfIf UseProjectBuildWindow = 0 And CommandlineBuild = 0DisplayCompilerWindow() ; hiding this window is done by the compiler functions if there is no errorEndIfSuccess = Compiler_BuildTarget(TempPath$ + "PB_EditorOutput.pb", OutputFile,ドル *Target, CreateExe, CheckSyntax)Else; copy failed, just fallback and use the original file; the most probable cause for this is that the source did not exist. this will raise a compiler error later;AddTools_CompiledFile$ = ""; no temporary file availableIf CreateExeAddTools_Execute(#TRIGGER_BeforeCreateExe, *Target)ElseAddTools_Execute(#TRIGGER_BeforeCompile, *Target)EndIfIf UseProjectBuildWindow = 0 And CommandlineBuild = 0DisplayCompilerWindow() ; hiding this window is done by the compiler functions if there is no errorEndIfSuccess = Compiler_BuildTarget(*Target\Filename,ドル OutputFile,ドル *Target, CreateExe, CheckSyntax)EndIfCompilerIf #Demo : EndIf : CompilerEndIfIf SuccessProcedureReturn OutputFile$ElseProcedureReturn ""EndIfEndProcedureProcedure BuildWindowEvents(EventID)Quit = 0If EventID = #PB_Event_Menu ; Little wrapper to map the shortcut events (identified as menu)EventID = #PB_Event_Gadget ; to normal gadget events...GadgetID = EventMenu()ElseGadgetID = EventGadget()EndIfIf EventID = #PB_Event_GadgetSelect EventGadget()Case #GADGET_Build_TargetsCase #GADGET_Build_LogIf EventType() = #PB_EventType_LeftDoubleClickIndex = GetGadgetState(#GADGET_Build_Log)If Index <> -1InfoIndex = GetGadgetItemData(#GADGET_Build_Log, Index)If InfoIndex <> -1 And SelectElement(BuildInfo(), InfoIndex); will simply switch if the file is open alreadyIf LoadSourceFile(BuildInfo()\File$)ChangeActiveLine(BuildInfo()\Line, -5)SetSelection(BuildInfo()\Line, 1, BuildInfo()\Line, -1)EndIfEndIfEndIfEndIfCase #GADGET_Build_Abort; set the flag, the rest is done from the Compiler_HandleCompilerResponse()CompilationAborted = #TrueCase #GADGET_Build_CopyContent$ = ""Count = CountGadgetItems(#GADGET_Build_Log)For i = 0 To Count-1Content$ + GetGadgetItemText(#GADGET_Build_Log, i, 0) + #NewLineNext iSetClipboardText(Content$)Case #GADGET_Build_SaveFileName$ = GetPathPart(ProjectFile$)Pattern = 0RepeatFileName$ = SaveFileRequester(Language("Debugger","SaveFileTitle"), FileName,ドル Language("Debugger","SaveFilePattern"), Pattern)Pattern = SelectedFilePattern()If FileName$ = ""BreakElseIf Pattern = 0 And GetExtensionPart(FileName$) = ""FileName$ + ".txt"EndIfIf FileSize(FileName$) <> -1result = MessageRequester(#ProductName,ドルLanguage("FileStuff","FileExists")+#NewLine+Language("FileStuff","OverWrite"), #FLAG_Warning|#PB_MessageRequester_YesNoCancel)If result = #PB_MessageRequester_CancelBreak ; abortElseIf result = #PB_MessageRequester_NoContinue ; ask againEndIfEndIfFile = CreateFile(#PB_Any, FileName$)If FileCount = CountGadgetItems(#GADGET_Build_Log)For i = 0 To Count-1WriteStringN(File, GetGadgetItemText(#GADGET_Build_Log, i, 0))Next iCloseFile(File)ElseMessageRequester(#ProductName,ドルLanguagePattern("Debugger","SaveError", "%filename%", FileName$), #FLAG_Error)EndIfBreak ; if we got here, then do not try againForEverCase #GADGET_Build_Close; CompilerBusy goes to 0 after each target; UseProjectBuildWindow goes to 0 when all are doneIf (Not CompilerBusy) And (Not UseProjectBuildWindow)Quit = 1EndIfEndSelectElseIf EventID = #PB_Event_SizeWindowBuildWindowDialog\SizeUpdate()ElseIf EventID = #PB_Event_CloseWindow; we have no systemmenu, but this can be sent by code to close the windowQuit = 1EndIfIf QuitAutoCloseBuildWindow = GetGadgetState(#GADGET_Build_CloseWhenDone)If MemorizeWindowBuildWindowDialog\Close(@BuildWindowPosition)ElseBuildWindowDialog\Close()EndIfBuildWindowDialog = 0EndIfEndProcedureProcedure UpdateBuildWindow(); theme updateCount = CountGadgetItems(#GADGET_Build_Targets)For i = 0 To Count-1Select GetGadgetItemData(#GADGET_Build_Targets, i)Case 0: SetGadgetItemImage(#GADGET_Build_Targets, i, ImageID(#IMAGE_Build_TargetNotDone))Case 1: SetGadgetItemImage(#GADGET_Build_Targets, i, ImageID(#IMAGE_Build_TargetError))Case 2: SetGadgetItemImage(#GADGET_Build_Targets, i, ImageID(#IMAGE_Build_TargetWarning))Case 3: SetGadgetItemImage(#GADGET_Build_Targets, i, ImageID(#IMAGE_Build_TargetOK))EndSelectNext iBuildWindowDialog\LanguageUpdate()BuildWindowDialog\GuiUpdate()EndProcedureProcedure OpenBuildWindow(List *Targets.CompileTarget()); hide the windows from the normal mode compiling;HideCompilerWarnings()If IsWindow(#WINDOW_MacroError)MacroErrorWindowEvents(#PB_Event_CloseWindow)EndIfIf IsWindow(#WINDOW_Option)OptionWindowEvents(#PB_Event_CloseWindow)EndIfIf IsWindow(#WINDOW_Build) = 0BuildWindowDialog = OpenDialog(?Dialog_Build, WindowID(#WINDOW_Main), @BuildWindowPosition)SetGadgetState(#GADGET_Build_CloseWhenDone, AutoCloseBuildWindow)CompilerIf #CompileWindowsStatic MonoFontIf MonoFont = 0MonoFont = LoadFont(#PB_Any, "Courier New", 10)EndIfIf MonoFont; it looks just much better this waySetGadgetFont(#GADGET_Build_Log, FontID(MonoFont))EndIfCompilerEndIfElseClearGadgetItems(#GADGET_Build_Targets)ClearGadgetItems(#GADGET_Build_Log)HideGadget(#GADGET_Build_DoneContainer, 1)HideGadget(#GADGET_Build_WorkContainer, 0)SetWindowForeground(#WINDOW_Build)EndIfEnsureWindowOnDesktop(#WINDOW_Build)ForEach *Targets()AddGadgetItem(#GADGET_Build_Targets, -1, *Targets()\Name$+Chr(10)+"-", ImageID(#IMAGE_Build_TargetNotDone))Next *Targets(); During the build process, disable the main window so the user cannot initiate another compile etc;DisableWindow(#WINDOW_Main, #True); This causes the compile functions to output to our build window;UseProjectBuildWindow = #TrueCompilerBusy = 1ClearList(BuildInfo())OldWarningCount = 0SuccessCount = 0FailCount = 0ForEach *Targets()BuildLogEntry(RSet("", 80, "-"))BuildLogEntry(" " + LanguagePattern("Compiler","BuildStart", "%target%", *Targets()\Name$))BuildLogEntry(RSet("", 80, "-"))SetGadgetState(#GADGET_Build_Targets, ListIndex(*Targets()))Result$ = BuildProjectTarget(*Targets(), 0, #True, #False); count the emitted warnings during this compileWarningCount = 0ForEach BuildInfo()If BuildInfo()\IsWarningWarningCount + 1EndIfNext BuildInfo()If Result$ <> "" And WarningCount = OldWarningCount; Failures are logged as errors and warnings give a "success with warnings" line, so add a line for success here too; do this before executing the tools for a consistent log outputBuildLogEntry(Language("Compiler","BuildSuccess"))EndIf; Update the target's build counts and execute any toolsIf Result$ <> ""If *Targets()\UseCompileCount ; this increases both compile+build count*Targets()\CompileCount + 1EndIfIf *Targets()\UseBuildCount*Targets()\BuildCount + 1EndIfAddTools_ExecutableName$ = Result$AddTools_Execute(#TRIGGER_AfterCreateExe, *Targets())EndIfIndex = ListIndex(*Targets())If Result$ = ""SetGadgetItemText(#GADGET_Build_Targets, Index, Language("Compiler","StatusError"), 1)SetGadgetItemImage(#GADGET_Build_Targets, Index, ImageID(#IMAGE_Build_TargetError))SetGadgetItemData(#GADGET_Build_Targets, Index, 1) ; for UpdateBuildWindow()FailCount + 1ElseIf WarningCount > OldWarningCountSetGadgetItemText(#GADGET_Build_Targets, Index, LanguagePattern("Compiler","StatusWarning", "%count%", Str(WarningCount - OldWarningCount)), 1)SetGadgetItemImage(#GADGET_Build_Targets, Index, ImageID(#IMAGE_Build_TargetWarning))SetGadgetItemData(#GADGET_Build_Targets, Index, 2)SuccessCount + 1 ; this is a success tooElseSetGadgetItemText(#GADGET_Build_Targets, Index, Language("Compiler","StatusOk"), 1)SetGadgetItemImage(#GADGET_Build_Targets, Index, ImageID(#IMAGE_Build_TargetOK))SetGadgetItemData(#GADGET_Build_Targets, Index, 3)SuccessCount + 1EndIfOldWarningCount = WarningCountBuildLogEntry("")If CompilationAbortedBreakEndIfNext *Targets(); Display some stats;BuildLogEntry(RSet("", 80, "-"))BuildLogEntry("")If SuccessCount > 0BuildLogEntry(" " + LanguagePattern("Compiler", "BuildStatsNoError", "%count%", Str(SuccessCount)))EndIfIf FailCount > 0BuildLogEntry(" " + LanguagePattern("Compiler", "BuildStatsError", "%count%", Str(FailCount)))EndIfIf WarningCount > 0BuildLogEntry(" " + LanguagePattern("Compiler", "BuildStatsWarning", "%count%", Str(WarningCount)))EndIfIf CompilationAbortedBuildLogEntry(" " + Language("Compiler","BuildStatsAborted"))EndIfBuildLogEntry(""); Compiling is done, enable the main window again;DisableWindow(#WINDOW_Main, #False)CompilerBusy = 0UseProjectBuildWindow = #FalseUpdateProjectInfo() ; reflect build count change in project infoIf GetGadgetState(#GADGET_Build_CloseWhenDone) And FailCount = 0BuildWindowEvents(#PB_Event_CloseWindow)Else; Go to "finished mode"HideGadget(#GADGET_Build_WorkContainer, 1)HideGadget(#GADGET_Build_DoneContainer, 0)SetGadgetState(#GADGET_Build_Targets, -1)SetGadgetState(#GADGET_Build_Log, -1)EndIfEndProcedure;- ------------------------------------------------Procedure CompileRun(CheckSyntax)UseProjectBuildWindow = #FalseIf *ActiveSource\IsCode = 0ProcedureReturnEndIfIf CompilerReady And CompilerBusy = 0If AutoClearLogClearGadgetItems(#GADGET_ErrorLog)*ActiveSource\LogSize = 0SetDebuggerMenuStates()EndIfClearList(CompileSource\UnknownIDEOptionsList$())If AutoSaveAutoSave() ; do the autosave stuffEndIfIf *ActiveSource\UseMainFile; make sure the compile source is clean and does not have settings from a previous compileClearStructure(@CompileSource, SourceFile)InitializeStructure (@CompileSource, SourceFile) ; We use complex type in this structure like 'List' so we need to reinit again; create a new SourceFile structure to represent the MainFile settings; the CompileSource structure is global for the Windows compiler to access it too;CompileSource\FileName$ = ResolveRelativePath(GetPathPart(*ActiveSource\FileName$), *ActiveSource\MainFile$)If ReadFile(#FILE_Compile, CompileSource\FileName$)If Lof(#FILE_Compile) < 5000Length = Lof(#FILE_Compile)ElseLength = 5000FileSeek(#FILE_Compile, Lof(#FILE_Compile)-5000)EndIf*Buffer = AllocateMemory(Length+10) ; we only need the project settings.. (+10 to avoid error on empty files for 0-size alloc!)If *BufferReadData(#FILE_Compile, *Buffer, Length)CloseFile(#FILE_Compile)AnalyzeProjectSettings(@CompileSource, *Buffer, Length, 0)FreeMemory(*Buffer)CompileSource\Debugger = *ActiveSource\Debugger ; these are set by the current fileCompileSource\CommandLine$ = *ActiveSource\CommandLine$CompileSource\FileName$ = ResolveRelativePath(GetPathPart(*ActiveSource\FileName$), *ActiveSource\MainFile$) ; this is important to compile from the right directorySuccess = #False; for the addtools, we need a temporary file, so they can modify it...If CopyFile(CompileSource\FileName,ドル TempPath$ + "PB_EditorOutput.pb")CompilerIf #CompileWindows; If the source file was readonly, so will be the temp file, so remove that!SetFileAttributes(TempPath$ + "PB_EditorOutput.pb", GetFileAttributes(TempPath$ + "PB_EditorOutput.pb") & ~#PB_FileSystem_ReadOnly)CompilerEndIf; append the procects settings for the tools if neededIf SaveProjectSettings <> #SAVESETTINGS_EndOfFile And OpenFile(#FILE_SaveSource, TempPath$+"PB_EditorOutput.pb")FileSeek(#FILE_SaveSource, Lof(#FILE_SaveSource)) ; to to the end of the fileSaveProjectSettings(@CompileSource, #True, 1, 0)CloseFile(#FILE_SaveSource)EndIf; call the compiler function with this new structure and main source nameAddTools_CompiledFile$ = TempPath$ + "PB_EditorOutput.pb"; save for AddToolsAddTools_Execute(#TRIGGER_BeforeCompile, *ActiveSource)DisplayCompilerWindow() ; hiding this window is done by the compiler functions if there is no errorSuccess = Compiler_CompileRun(TempPath$ + "PB_EditorOutput.pb", @CompileSource, CheckSyntax)Else; call the compiler function with this new structure and main source nameAddTools_CompiledFile$ = ""; no temporary file availableAddTools_Execute(#TRIGGER_BeforeCompile, *ActiveSource)DisplayCompilerWindow() ; hiding this window is done by the compiler functions if there is no errorSuccess = Compiler_CompileRun(CompileSource\FileName,ドル @CompileSource, CheckSyntax)EndIf; update the build counter for this main file.; This can be tricky as the file may not be loaded in the IDE at this time.;If Success And CompileSource\UseCompileCount And CheckSyntax = #False; first check if this source is loaded in the IDEIsLoaded = 0*RealActiveSource = *ActiveSource ; *ActiveSource is modified below as well!ForEach FileList()If @FileList() <> *ProjectInfo And IsEqualFile(FileList()\FileName,ドル CompileSource\FileName$)IsLoaded = 1FileList()\CompileCount + 1If AutoSave And AutoSaveAll ; as it is not the active source, only save With "autosave all" on*ActiveSource = @FileList() ; must be done for the SaveSourceFile() !SaveSourceFile(*ActiveSource\FileName$)HistoryEvent(*ActiveSource, #HISTORY_Save)Else; mark as modified (do manually as the function is only for *ActiveSourceFileList()\ScintillaModified = 1FileList()\DisplayModified = 1SetTabBarGadgetItemText(#GADGET_FilesPanel, ListIndex(FileList()), GetFilePart(CompileSource\FileName$)+"*")EndIfBreakEndIfNext FileList()ChangeCurrentElement(FileList(), *RealActiveSource)*ActiveSource = *RealActiveSource; ok, we have to update the file on disk; Note: SaveProjectSettings() actually works if we do not append the options to the source,; but some settings are lost (folding, currentline etc) as the source is not shown,; so we do not use it as it may be annoying to lose this data often.;; Note: do not report errors, as the media could be readonly and we do not want to annoy the user then on each compile;If IsLoaded = 0NewCount = CompileSource\CompileCount + 1Select SaveProjectSettingsCase #SAVESETTINGS_EndOfFile*Buffer = 0If ReadFile(#FILE_ReadConfig, CompileSource\FileName$)Length = Lof(#FILE_ReadConfig)*Buffer = AllocateMemory(Length+10) ; avoid the 0size-buffer problemIf *BufferReadData(#FILE_ReadConfig, *Buffer, Length)EndIfCloseFile(#FILE_ReadConfig)EndIfIf *BufferSelect DetectNewLineType(*Buffer, Length)Case 0: NewLine$ = Chr(13)+Chr(10)Case 1: NewLine$ = Chr(10)Case 2: NewLine$ = Chr(13)EndSelect*Cursor.BYTE = *BufferIsCorrectSection = 0Lookup$ = NewLine$ + "; IDE Options"LookupLength = Len(Lookup$)While *Cursor < *Buffer + LengthIf CompareMemoryString(*Cursor, ToAscii(Lookup$), 0, LookupLength) = 0 ; this is case sensitive!IsCorrectSection = 1ElseIf IsCorrectSection And CompareMemoryString(*Cursor, ToAscii("EnableCompileCount"), 1, 18) = 0*Start = *CursorWhile *Cursor < *Buffer + Length And *Cursor\b <> 10 And *Cursor\b <> 13*Cursor + 1Wend; now we can directly write the new fileIf CreateFile(#FILE_SaveConfig, CompileSource\FileName$)WriteData(#FILE_SaveConfig, *Buffer, *Start-*Buffer)WriteString(#FILE_SaveConfig, "EnableCompileCount = " + Str(NewCount)); no newline as we write it with the last block!WriteData(#FILE_SaveConfig, *Cursor, Length - (*Cursor-*Buffer))CloseFile(#FILE_SaveConfig)EndIfEndIf*Cursor + 1WendFreeMemory(*Buffer)EndIfCase #SAVESETTINGS_PerFileCfg ; filename.pb.cfgSuccess = 0If ReadFile(#FILE_ReadConfig, CompileSource\FileName$+".cfg")If CreateFile(#FILE_SaveConfig, CompileSource\FileName$+".cfg.new")While Not Eof(#FILE_ReadConfig)Line$ = ReadString(#FILE_ReadConfig)If FindString(UCase(Line$), "ENABLECOMPILECOUNT", 1) <> 0Line$ = "EnableCompileCount = " + Str(NewCount)Success = 1EndIfIf Eof(#FILE_ReadConfig)WriteString(#FILE_SaveConfig, Line$) ; no newline at the endElseWriteStringN(#FILE_SaveConfig, Line$)EndIfWendCloseFile(#FILE_SaveConfig)EndIfCloseFile(#FILE_ReadConfig)EndIfIf Success And DeleteFile(CompileSource\FileName$+".cfg")RenameFile(CompileSource\FileName$+".cfg.new", CompileSource\FileName$+".cfg")ElseDeleteFile(CompileSource\FileName$+".cfg.new")EndIfCase #SAVESETTINGS_PerFolderCfg ; project.cfgSuccess = 0IsCorrectSection = 0If ReadFile(#FILE_ReadConfig, GetPathPart(CompileSource\FileName$)+"project.cfg")If CreateFile(#FILE_SaveConfig, GetPathPart(CompileSource\FileName$)+"project.cfg.new")While Not Eof(#FILE_ReadConfig)Line$ = ReadString(#FILE_ReadConfig)If UCase(Trim(Line$)) = "["+UCase(GetFilePart(CompileSource\FileName$))+"]"IsCorrectSection = 1ElseIf Left(Trim(Line$), 1) = "["IsCorrectSection = 0ElseIf IsCorrectSection And FindString(UCase(Line$), "ENABLECOMPILECOUNT", 1) <> 0Line$ = " EnableCompileCount = " + Str(NewCount)Success = 1EndIfIf Eof(#FILE_ReadConfig)WriteString(#FILE_SaveConfig, Line$) ; no newline at the endElseWriteStringN(#FILE_SaveConfig, Line$)EndIfWendCloseFile(#FILE_SaveConfig)EndIfCloseFile(#FILE_ReadConfig)EndIfIf Success And DeleteFile(GetPathPart(CompileSource\FileName$)+"project.cfg")RenameFile(GetPathPart(CompileSource\FileName$)+"project.cfg.new", GetPathPart(CompileSource\FileName$)+"project.cfg")ElseDeleteFile(GetPathPart(CompileSource\FileName$)+"project.cfg.new")EndIf; case #SAVESETTINGS_DoNotSave - no savingEndSelectEndIfEndIfElseMessageRequester(#ProductName,ドル "Critical Error! Out of Memory!", #FLAG_ERROR)ActivateMainWindow()EndIfElseMessageRequester(#ProductName,ドル Language("Compiler", "ReadMainError")+#NewLine+*ActiveSource\MainFile,ドル #FLAG_ERROR)ActivateMainWindow()EndIfElse ; No MainFile option... way simpler :); the source must be saved to the temp path;If SaveTempFile(TempPath$ + "PB_EditorOutput.pb")AddTools_CompiledFile$ = TempPath$ + "PB_EditorOutput.pb" ; save for AddToolsAddTools_Execute(#TRIGGER_BeforeCompile, *ActiveSource)DisplayCompilerWindow() ; hiding this window is done by the compiler functions if there is no error; call the os compiler function, with the current source settingsIf Compiler_CompileRun(TempPath$ + "PB_EditorOutput.pb", *ActiveSource, CheckSyntax); update the compile countIf *ActiveSource\UseCompileCount And CheckSyntax = #False*ActiveSource\CompileCount + 1If AutoSave And *ActiveSource\FileName$ <> "" ; no autosave if file was never saved yet!; with autosave, save directly so the * does not appearSaveSourceFile(*ActiveSource\FileName$)HistoryEvent(*ActiveSource, #HISTORY_Save)Else; mark the source as changed so this is saved when the source is actually closed!UpdateSourceStatus(1)EndIfEndIfEndIfElseMessageRequester(#ProductName,ドル Language("Compiler","SaveTempError")+#NewLine+TempPath$+"PB_EditorOutput.pb", #FLAG_ERROR)HideCompilerWindow()EndIfEndIfElseMessageRequester(#ProductName,ドル Language("Compiler","NotReady"))ActivateMainWindow()EndIfEndProcedureProcedure StartInternalBuild(SourceFile,ドル File$)AddTools_CompiledFile$ = SourceFile$AddTools_Execute(#TRIGGER_BeforeCreateExe, *ActiveSource)DisplayCompilerWindow() ; hiding this window is done by the compiler functions if there is no errorIf Compiler_BuildTarget(SourceFile,ドル File,ドル *ActiveSource, #True, #False); do the compilation counts (both, as the CompileCount includes the BuildCount)If *ActiveSource\UseCompileCount Or *ActiveSource\UseBuildCountIf *ActiveSource\UseCompileCount*ActiveSource\CompileCount + 1EndIfIf *ActiveSource\UseBuildCount*ActiveSource\BuildCount + 1EndIfIf AutoSave; with AutoSave, we directly save again, as else the * reappears which is weirdSaveSourceFile(*ActiveSource\FileName$)HistoryEvent(*ActiveSource, #HISTORY_Save)Else; mark the source as changed so this is saved when the source is actually closed!UpdateSourceStatus(1)EndIfEndIfProcedureReturn #True ; SuccessEndIfProcedureReturn #FalseEndProcedureProcedure CreateExecutable()Protected *MainSource.SourceFileIf *ActiveSource\IsCode = 0ProcedureReturnEndIfUseProjectBuildWindow = #FalseIf CompilerReady And CompilerBusy = 0*InitialActiveSource = *ActiveSourceIf *ActiveSource\FileName$ = ""If SaveSourceAs() = -1ProcedureReturn ; abort the whole thing if the user does not save the sourcecodeEndIfElseIf AutoSaveAutoSave()EndIf; Handle the special case when creating an executable from a file which has a main file.; Here, we just load the file in the IDE if not open, or use the opened file infos;If *ActiveSource\UseMainFileMainFileName$ = ResolveRelativePath(GetPathPart(*ActiveSource\FileName$), *ActiveSource\MainFile$)If LoadSourceFile(MainFileName,ドル 0) ; Ensure it's loaded in the IDE, to have all the correct prefs and such; Look for our newly opened file;*MainSource = FindSourceFile(MainFileName$)EndIfIf *MainSource = 0MessageRequester("Error", "Can't load the main file to create the executable: "+MainFileName$)ProcedureReturnEndIf*ActiveSource = *MainSourceEndIfCompilerIf #SpiderBasicOpenCreateAppWindow(*ActiveSource, #False)*ActiveSource = *InitialActiveSource ; Restore the active sourceCompilerElseIf *ActiveSource\ExecutableName$Path$ = *ActiveSource\ExecutableName$ElsePath$ = GetPathPart(*ActiveSource\FileName$) ; Get the path of the source file (or main file if specified) if no executable has been specifiedEndIf; the source must be saved to the temp path;If SaveTempFile(TempPath$ + "PB_EditorOutput.pb") = 0MessageRequester(#ProductName,ドル Language("Compiler","SaveTempError")+#NewLine+TempPath$+"PB_EditorOutput.pb", #FLAG_ERROR)*InitialActiveSource = *ActiveSourceProcedureReturnEndIfCompilerIf #DemoIf *ActiveSource\ExecutableFormat = 2 ; shared dllCompilerIf #CompileWindowsMessageRequester("Information", "DLL creation is not available in the demo version.")CompilerElseMessageRequester("Information", "SO Library creation is not available in the demo version.")CompilerEndIfElseCompilerEndIfIf *ActiveSource\ExecutableFormat = 2 ; shared dllCompilerIf #CompileWindowsPattern$ = Language("Compiler","DllPattern")Extension$ = ".dll"CompilerElseIf #CompileMacPattern$ = "Shared Library (*.dylib)|*.dylib|All Files (*.*)|*.*"Extension$ = ".dylib"CompilerElse ; LinuxPattern$ = "Shared Library (*.so)|*.so|All Files (*.*)|*.*"Extension$ = ".so"CompilerEndIfElseCompilerIf #CompileWindowsPattern$ = Language("Compiler","ExePattern")Extension$ = ".exe"CompilerElseIf #CompileMacPattern$ = ""If *ActiveSource\ExecutableFormat = 1Extension$ = "" ; console, do not append .app automatically hereElseExtension$ = ".app" ; automatically append ".app" for gui programsEndIfCompilerElse ; LinuxPattern$ = ""Extension$ = ""CompilerEndIfEndIfFile$ = SaveFileRequester(Language("Compiler","CreateExe"), Path,ドル Pattern,ドル 0)If File$If LCase(Right(File,ドル Len(Extension$))) <> Extension$ And SelectedFilePattern() <> 1File$+Extension$EndIf; If the name of the exe has changed, we need to re-save the file (https://www.purebasic.fr/english/viewtopic.php?f=4&t=59806);If *ActiveSource\ExecutableName$ <> File$*ActiveSource\ExecutableName$ = File$If AutoSaveSaveSourceFile(*ActiveSource\FileName$)ElseUpdateSourceStatus(1) ; mark the source as changed so this is saved when the source is actually closed!EndIfEndIfIf StartInternalBuild(TempPath$ + "PB_EditorOutput.pb", File$)*ActiveSource = *InitialActiveSource ; Restore the active source only if the compilation has succeededEndIfElse*ActiveSource = *InitialActiveSource ; Restore the active source as the CreateExecutable has been abortedHideCompilerWindow()EndIfCompilerIf #Demo : EndIf : CompilerEndIfCompilerEndIfElseMessageRequester(#ProductName,ドル Language("Compiler","NotReady"))EndIfEndProcedureProcedure Run()UseProjectBuildWindow = #FalseIf *ActiveSource\IsCode = 0ProcedureReturnEndIfIf CompilerReady And CompilerBusy = 0If AutoClearLogClearGadgetItems(#GADGET_ErrorLog)*ActiveSource\LogSize = 0SetDebuggerMenuStates()EndIfAddTools_Execute(#TRIGGER_ProgramRun, *ActiveSource)Compiler_Run(*ActiveSource, #False) ; not the first time this is runElseMessageRequester(#ProductName,ドル Language("Compiler","NotReady"))EndIfEndProcedureProcedure CompileRunProject(CheckSyntax); Use the normal CompilerWindow for thisUseProjectBuildWindow = #FalseIf CompilerReady And CompilerBusy = 0If AutoClearLogClearList(ProjectLog())ErrorLog_Refresh()SetDebuggerMenuStates()EndIfIf AutoSaveAutoSave()EndIf; Delete the previous output filename (if possible);If *DefaultTarget\RunExecutable$CompilerIf #CompileMacDeleteDirectory(*DefaultTarget\RunExecutable,ドル "*", #PB_FileSystem_Recursive) ; a .app is a directory!CompilerElseDeleteFile(*DefaultTarget\RunExecutable$)CompilerEndIf*DefaultTarget\RunExecutable$ = ""EndIf; compile to temporary exe (always with Compile/Run, so multiple instances can run etc);OutputFile$ = BuildProjectTarget(*DefaultTarget, 2, #False, CheckSyntax)If OutputFile$ <> ""; Register the output file for deletion in case the user re-compiles while the first instance; of the exe still runs (and cannot be deleted);RegisterDeleteFile(OutputFile$)If *DefaultTarget\UseCompileCount And CheckSyntax = #False ; only increase the build count here*DefaultTarget\CompileCount + 1UpdateProjectInfo() ; reflect count change in project infoEndIf; set the run information, then simply call the run command from here to reduce code*DefaultTarget\RunExecutable$ = OutputFile$*DefaultTarget\RunExeFormat = *DefaultTarget\ExecutableFormat*DefaultTarget\RunDebuggerMode = (*DefaultTarget\Debugger|ForceDebugger)&~ForceNoDebugger*DefaultTarget\RunEnableAdmin = *DefaultTarget\EnableAdmin*DefaultTarget\RunSourceFileName$ = *DefaultTarget\FileName$ ; updated before compiling, so this is the full file*DefaultTarget\RunMainFileUsed = 0 ; no mainfile option here*DefaultTarget\RunCompilerPath$ = GetPathPart(*CurrentCompiler\Executable$)*DefaultTarget\RunCompilerVersion = *CurrentCompiler\VersionNumber; execute any external toolsAddTools_ExecutableName$ = OutputFile$AddTools_Execute(#TRIGGER_AfterCompile, *DefaultTarget)If CheckSyntax = #FalseAddTools_Execute(#TRIGGER_ProgramRun, *DefaultTarget)Compiler_Run(*DefaultTarget, #True) ; run (for the first time)EndIfEndIfElseMessageRequester(#ProductName,ドル Language("Compiler","NotReady"))ActivateMainWindow()EndIfEndProcedureProcedure RunProject(); Use the normal CompilerWindow for thisUseProjectBuildWindow = #FalseIf CompilerReady And CompilerBusy = 0If AutoClearLogClearList(ProjectLog())ErrorLog_Refresh()SetDebuggerMenuStates()EndIfAddTools_ExecutableName$ = *DefaultTarget\RunExecutable$AddTools_Execute(#TRIGGER_ProgramRun, *DefaultTarget)Compiler_Run(*DefaultTarget, #False) ; run (not for the first time)ElseMessageRequester(#ProductName,ドル Language("Compiler","NotReady"))EndIfEndProcedureProcedure CreateExecutableProject(); Use the normal CompilerWindow for thisUseProjectBuildWindow = #FalseIf CompilerReady And CompilerBusy = 0OutputFile$ = BuildProjectTarget(*DefaultTarget, 1, #True, #False) ; ask for output fileIf OutputFile$ <> ""If *DefaultTarget\UseCompileCount ; this increases both compile+build count*DefaultTarget\CompileCount + 1EndIfIf *DefaultTarget\UseBuildCount*DefaultTarget\BuildCount + 1EndIfIf *DefaultTarget\UseCompileCount Or *DefaultTarget\UseBuildCountUpdateProjectInfo() ; reflect count change in project infoEndIfAddTools_ExecutableName$ = OutputFile$AddTools_Execute(#TRIGGER_AfterCreateExe, *DefaultTarget)ProcedureReturn 1EndIfElseMessageRequester(#ProductName,ドル Language("Compiler","NotReady"))EndIfEndProcedureProcedure BuildTarget(*Target.CompileTarget)Protected NewList *Targets.CompileTarget(); Just create a list with this one target and let the common function do the heavy work;AddElement(*Targets())*Targets() = *TargetIf CompilerReady And CompilerBusy = 0OpenBuildWindow(*Targets())ElseMessageRequester(#ProductName,ドル Language("Compiler","NotReady"))EndIfEndProcedureProcedure BuildAll()Protected NewList *Targets.CompileTarget()If CompilerReady And CompilerBusy = 0; Add all targets that are set for "build all" to our list; in the same order as they appear in compiler options (no dependency resolving yet);ForEach ProjectTargets()If ProjectTargets()\IsEnabledAddElement(*Targets())*Targets() = @ProjectTargets()EndIfNext ProjectTargets()If ListSize(*Targets()) <> 0OpenBuildWindow(*Targets()) ; this function does all the workElseMessageRequester(#ProductName,ドル Language("Compiler","NoBuildTargets"))EndIfElseMessageRequester(#ProductName,ドル Language("Compiler","NotReady"))EndIfEndProcedureCompilerIf #CompileWindowsDataSectionResource_Strings:Data.l 6 ; countData$ "VOS_UNKNOWN"Data$ "VOS_DOS"Data$ "VOS_DOS_WINDOWS16"Data$ "VOS_DOS_WINDOWS32"Data$ "VOS_NT_WINDOWS32"Data$ "VOS_NT"Data.l 7 ; countData$ "VFT_UNKNOWN"Data$ "VFT_APP"Data$ "VFT_DLL"Data$ "VFT_DRV"Data$ "VFT_FONT"Data$ "VFT_VXD"Data$ "VFT_STATIC_LIB"Data.l 168Data$ "0000 Language Neutral"Data$ "007f Invariant locale"Data$ "0400 Process Or User Default Language"Data$ "0800 System Default Language"Data$ "0436 Afrikaans"Data$ "041c Albanian"Data$ "0401 Arabic (Saudi Arabia)"Data$ "0801 Arabic (Iraq)"Data$ "0c01 Arabic (Egypt)"Data$ "1001 Arabic (Libya)"Data$ "1401 Arabic (Algeria)"Data$ "1801 Arabic (Morocco)"Data$ "1c01 Arabic (Tunisia)"Data$ "2001 Arabic (Oman)"Data$ "2401 Arabic (Yemen)"Data$ "2801 Arabic (Syria)"Data$ "2c01 Arabic (Jordan)"Data$ "3001 Arabic (Lebanon)"Data$ "3401 Arabic (Kuwait)"Data$ "3801 Arabic (U.A.E.)"Data$ "3c01 Arabic (Bahrain)"Data$ "4001 Arabic (Qatar)"Data$ "042b Armenian"Data$ "042c Azeri (Latin)"Data$ "082c Azeri (Cyrillic)"Data$ "042d Basque"Data$ "0423 Belarusian"Data$ "0445 Bengali (India)"Data$ "141a Bosnian (Bosnia And Herzegovina)"Data$ "0402 Bulgarian"Data$ "0455 Burmese"Data$ "0403 Catalan"Data$ "0404 Chinese (Taiwan)"Data$ "0804 Chinese (PRC)"Data$ "0c04 Chinese (Hong Kong SAR, PRC)"Data$ "1004 Chinese (Singapore)"Data$ "1404 Chinese (Macao SAR)"Data$ "041a Croatian"Data$ "101a Croatian (Bosnia And Herzegovina)"Data$ "0405 Czech"Data$ "0406 Danish"Data$ "0465 Divehi"Data$ "0413 Dutch (Netherlands)"Data$ "0813 Dutch (Belgium)"Data$ "0409 English (United States)"Data$ "0809 English (United Kingdom)"Data$ "0c09 English (Australian)"Data$ "1009 English (Canadian)"Data$ "1409 English (New Zealand)"Data$ "1809 English (Ireland)"Data$ "1c09 English (South Africa)"Data$ "2009 English (Jamaica)"Data$ "2409 English (Caribbean)"Data$ "2809 English (Belize)"Data$ "2c09 English (Trinidad)"Data$ "3009 English (Zimbabwe)"Data$ "3409 English (Philippines)"Data$ "0425 Estonian"Data$ "0438 Faeroese"Data$ "0429 Farsi"Data$ "040b Finnish"Data$ "040c French (Standard)"Data$ "080c French (Belgian)"Data$ "0c0c French (Canadian)"Data$ "100c French (Switzerland)"Data$ "140c French (Luxembourg)"Data$ "180c French (Monaco)"Data$ "0456 Galician"Data$ "0437 Georgian"Data$ "0407 German (Standard)"Data$ "0807 German (Switzerland)"Data$ "0c07 German (Austria)"Data$ "1007 German (Luxembourg)"Data$ "1407 German (Liechtenstein)"Data$ "0408 Greek"Data$ "0447 Gujarati"Data$ "040d Hebrew"Data$ "0439 Hindi"Data$ "040e Hungarian"Data$ "040f Icelandic"Data$ "0421 Indonesian"Data$ "0434 isiXhosa/Xhosa (South Africa)"Data$ "0435 isiZulu/Zulu (South Africa)"Data$ "0410 Italian (Standard)"Data$ "0810 Italian (Switzerland)"Data$ "0411 Japanese"Data$ "044b Kannada"Data$ "0457 Konkani"Data$ "0412 Korean"Data$ "0812 Korean (Johab)"Data$ "0440 Kyrgyz"Data$ "0426 Latvian"Data$ "0427 Lithuanian"Data$ "0827 Lithuanian (Classic)"Data$ "042f Macedonian (FYROM)"Data$ "043e Malay (Malaysian)"Data$ "083e Malay (Brunei Darussalam)"Data$ "044c Malayalam (India)"Data$ "0481 Maori (New Zealand)"Data$ "043a Maltese (Malta)"Data$ "044e Marathi"Data$ "0450 Mongolian"Data$ "0414 Norwegian (Bokmal)"Data$ "0814 Norwegian (Nynorsk)"Data$ "0415 Polish"Data$ "0416 Portuguese (Brazil)"Data$ "0816 Portuguese (Portugal)"Data$ "0446 Punjabi"Data$ "046b Quechua (Bolivia)"Data$ "086b Quechua (Ecuador)"Data$ "0c6b Quechua (Peru)"Data$ "0418 Romanian"Data$ "0419 Russian"Data$ "044f Sanskrit"Data$ "043b Sami, Northern (Norway)"Data$ "083b Sami, Northern (Sweden)"Data$ "0c3b Sami, Northern (Finland)"Data$ "103b Sami, Lule (Norway)"Data$ "143b Sami, Lule (Sweden)"Data$ "183b Sami, Southern (Norway)"Data$ "1c3b Sami, Southern (Sweden)"Data$ "203b Sami, Skolt (Finland)"Data$ "243b Sami, Inari (Finland)"Data$ "0c1a Serbian (Cyrillic)"Data$ "1c1a Serbian (Cyrillic, Bosnia, And Herzegovina)"Data$ "081a Serbian (Latin)"Data$ "181a Serbian (Latin, Bosnia, And Herzegovina)"Data$ "046c Sesotho sa Leboa/Northern Sotho (South Africa)"Data$ "0432 Setswana/Tswana (South Africa)"Data$ "041b Slovak"Data$ "0424 Slovenian"Data$ "040a Spanish (Spain, Traditional Sort)"Data$ "080a Spanish (Mexican)"Data$ "0c0a Spanish (Spain, Modern Sort)"Data$ "100a Spanish (Guatemala)"Data$ "140a Spanish (Costa Rica)"Data$ "180a Spanish (Panama)"Data$ "1c0a Spanish (Dominican Republic)"Data$ "200a Spanish (Venezuela)"Data$ "240a Spanish (Colombia)"Data$ "280a Spanish (Peru)"Data$ "2c0a Spanish (Argentina)"Data$ "300a Spanish (Ecuador)"Data$ "340a Spanish (Chile)"Data$ "380a Spanish (Uruguay)"Data$ "3c0a Spanish (Paraguay)"Data$ "400a Spanish (Bolivia)"Data$ "440a Spanish (El Salvador)"Data$ "480a Spanish (Honduras)"Data$ "4c0a Spanish (Nicaragua)"Data$ "500a Spanish (Puerto Rico)"Data$ "0430 Sutu"Data$ "0441 Swahili (Kenya)"Data$ "041d Swedish"Data$ "081d Swedish (Finland)"Data$ "045a Syriac"Data$ "0449 Tamil"Data$ "0444 Tatar (Tatarstan)"Data$ "044a Telugu"Data$ "041e Thai"Data$ "041f Turkish"Data$ "0422 Ukrainian"Data$ "0420 Urdu (Pakistan)"Data$ "0820 Urdu (India)"Data$ "0443 Uzbek (Latin)"Data$ "0843 Uzbek (Cyrillic)"Data$ "042a Vietnamese"Data$ "0452 Welsh (United Kingdom)"EndDataSectionCompilerEndIf
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。