[Gambas-devel] Add-ins

John Leake jleake at ...741...
Fri Sep 5 14:23:57 CEST 2014


Hi Benoît,

Syslog - Example from a vb6 source file called "frmAppLauncherMain.frm"
------
Private Sub Form_Load()
  'Code for Form_Load
  '...

  Call SysLog(LogLevel.Info, "frmAppLauncherMain->Sub Form_Load()", "")

  'Code for Form_Load
  '...

End Sub

When the syslog tool is clicked the call to syslog would automatically
be generated and inserted into the source at the current line and
showing the correct source file name and event info.

ErrorTrap Example from a vb6 source file called "frmAppLauncherMain.frm"
---------
Private Sub Form_Load()

'// Begin Error Handler
On Error GoTo Err_Form_Load
  'Code for Form_Load
  '...

'// End Error Handler
Exit_Form_Load:
  On Error Resume Next
  Exit Sub

Err_Form_Load:
  Process_Error LogLevel.Error, "frmAppLauncherMain->Sub Form_Load()",
err.Number, err.Description, err.Source, err.LastDllError
  GoTo Exit_Form_Load

End Sub

Gambas Example
------
SUB PrintFile(FileName AS STRING)
  'Existing code
  '...
FINALLY ' Always executed, even if a error is raised
  RETURN
CATCH ' Executed only if there is an error
  Process_Error LogLevel.Error, "SourceFileName->SUB PrintFile()",
Error.Code, Error.Text, Error.Where, ...

END

With a single click this code is automatically /inserted/removed from
the current sub/func/class/module or all sub/func/class/modules in the
current source file.

CallChart
---------
This is used to aid comprehension of when and where code is executed in
real-time. The output stream is like a customisable trace. The graphvis
output is useful when determining code structure and object hierarchies
so that the extent of proposed changes to code can be easily seen and
assessed before embarking on any mods.

Overall
-------
The above are just a few examples that we found useful in our business
when developing large applications.  The syslog calls worked alongside a
syslog ActiveX control that could be dropped on any form to show the
current peak syslog level and which showed where in the source that peak
error was activated and the ability to reset the peak and set the
recording level at any time.

On fairly significant advantage of "add-ins" is that they allow new
functions and tools to be added/removed to/from the IDE when needed,
preventing the IDE GUI from being bloated and over complex.  For example
a hobbyist is not likely to be writing headless apps where syslog is a
must.  They are also not likely to use SMTP for example or want to get
involved with source code control issues.

I hope this helps to explain the mindset behind this approach.

Best regards,
John Leake

On 05/09/14 12:02, Benoît Minisini wrote:
> Le 05/09/2014 12:52, John Leake a écrit :
>> Hi Tobi,
>> Thank you for your response.
>>
>> By "add-in" I mean an IDE toolbar that can load/remove modules when the
>> IDE starts. This code would have a reference to the whole project (or a
>> group of projects) source tree and would allow iteration of
>> sub/func/class/module names and their contents. As an example the kind
>> of productivity functions I implemented for M$ VB6 were;
>>
>> Syslog - When clicked this automatically inserted/removed syslog code
>> into either the currently displayed sub/function/class/module or all
>> sub/func/class/mods of the source file open in the editor.
> 
> Can you show me an example of what you mean?
> 
>>
>> Copyright - This inserted/removed customisable comments at the head of
>> the current source file.
> 
> OK. Maybe code snippets can already do that?
> 
>>
>> ErrorTrap - As syslog but error trap code using FINALLY and CATCH.
>>
> 
> An example?
> 
>> CallChart - As above but call chart code with graphvis output.
> 
> An example?
> 
>>
>> I would not envisage the functions of the "add-in" code to be part of
>> the source tree but the interface that facilitated "add-ins" would have
>> to be.
>>
>> Best regards,
>>
>> John Leake
>>
> 
> Technically there is no need of having "add-ins". I mean, there is no 
> problem in putting everything in the IDE source code, as Gambas only 
> loads the classes when they are first executed. The IDE executable being 
> 1 Mb or 1 Gb won't change its startup nor its execution time.
> 
> Moreover, I prefer that you put your code directly inside the IDE source 
> code (carefully of course!), without me having to develop an add-in 
> interface.
> 




More information about the Devel mailing list