Page 1 of 1

[IDE Tools] Implement better Tool support.

Posted: Mon Dec 12, 2011 12:39 pm
by Env
Hello again,

At risk of sounding very demanding, I would like to ask for another couple of features to be considered please... :)

Feature 1: Enable a tool to post messages to the IDE output through the stdout (console)..

It would also be nice if said tool can print a message through the stdout (console) that is formatted for the IDE to identify it as an error/warning, thus giving better feedback for the programmer.
i.e. "[Error][file][line number] This is the error message".

Feature 2: Halt compilation (for tools triggered on a Before Compile/Run event) if the tool returns any value that isn't 0.

For instance, if a code pre-parser was developed that adjusted the compilation code (such as adding OOP functionality through custom keywords), if that tool detects an error, rather than spitting out unsafe/unintended code, it could just return -1 for an error for instance... but if everything happened as it should, it could just exit will a null error code.

Thanks :)

Re: [IDE Tools] Implement better Tool support.

Posted: Mon Dec 12, 2011 8:05 pm
by Danilo
Env wrote:Feature 1: Enable a tool to post messages to the IDE output through the stdout (console)..

It would also be nice if said tool can print a message through the stdout (console) that is formatted for the IDE to identify it as an error/warning, thus giving better feedback for the programmer.
i.e. "[Error][file][line number] This is the error message".
I would like that too.

Here is what i do now:

Code: Select all

Global listBox.i=0

Procedure EnumChildProc(hwnd,lParam)
    result = #True
    classname.s = Space(1024)
    windowname.s= Space(1024)
    GetClassName_(hwnd,@classname,1024)
    If FindString(classname,"ListBox")=0
        windowname=""
    Else
        SendMessage_(hwnd,#WM_GETTEXT,1024,@windowname)
        windowname=PeekS(@windowname,-1,#PB_UTF8)
        classname2.s = Space(1024)
        GetClassName_(GetParent_(hwnd),@classname2,1024)
        If FindString(classname2,"Window")
            listBox = hwnd
            msg.s="running myTool..."
            SendMessage_(hWnd,#LB_ADDSTRING,0,@msg)
            SendMessage_(hWnd,#LB_SETTOPINDEX,SendMessage_(hwnd,#LB_GETCOUNT,0,0)-1,0)
            result=#False
        EndIf
    EndIf
    ProcedureReturn result
EndProcedure

Compiler$ =      GetEnvironmentVariable("PB_TOOL_Compiler"  )
Exe$      =      GetEnvironmentVariable("PB_TOOL_Executable")
Subsystem$=      GetEnvironmentVariable("PB_TOOL_SubSystem" )
IDE.i     = Val( GetEnvironmentVariable("PB_TOOL_MainWindow") )
Debugger  = Val( GetEnvironmentVariable("PB_TOOL_Debugger"  ) )
InlineASM = Val( GetEnvironmentVariable("PB_TOOL_InlineASM" ) )
Unicode   = Val( GetEnvironmentVariable("PB_TOOL_Unicode"   ) )
Thread    = Val( GetEnvironmentVariable("PB_TOOL_Thread"    ) )
XPskin    = Val( GetEnvironmentVariable("PB_TOOL_XPSkin"    ) )
OnError   = Val( GetEnvironmentVariable("PB_TOOL_OnError"   ) )

If IDE
    EnumChildWindows_(IDE,@EnumChildProc(),0)
EndIf

;[...]

If listBox
    msg.s="myTool results: ... "
    SendMessage_(listBox,#LB_ADDSTRING,0,@msg)
    SendMessage_(listBox,#LB_SETTOPINDEX,SendMessage_(listBox,#LB_GETCOUNT,0,0)-1,0)
EndIf
This outputs to the current output message window (after switching tabs the text is gone,
but at least i can see messages/errors/warnings from my tools).
Env wrote:Feature 2: Halt compilation (for tools triggered on a Before Compile/Run event) if the tool returns any value that isn't 0.
Yep.


I would like to add a 3rd point:
Environement Variables for all file setting. To get some compile settings i have to search
the file every time. Would be easier if everything could be accessed from Environment variables.
For example:

Code: Select all

; ExecutableFormat = Console
; CPU = 5
Of course it is easy to check all lines for "; ExecutableFormat" and "; CPU", i just think
it would be nice if the environment variables would be complete for all settings.