how to get sub/function name and parameters
Posted
#1
(In Topic #568)
Enthusiast

and i like to know the name of the function and the given parameters and their values …
tried a lot but no glue … so can anybody push me in the right direction?
Posted
Guru

Posted
Enthusiast

what im thinking of is something like:
Code (gambas)
hope this is more understandable
Posted
Guru

The IDE runs through the code very quickly and lists all symbols, function names, values etc in an enumerable collection.
How exactly it happens i do not know but code using it is in the TextHighlighter_Gambas.class file.
comp/src/gb.eval.highlight/.src/TextHighlighter_Gambas.class · master · Gambas / gambas · GitLab
something like…
Posted
Enthusiast

BruceSteers said
The IDE runs through the code very quickly and lists all symbols, function names, values etc in an enumerable collection.
thats what im looking for …
your example did not work because:
1. in
Code (gambas)
2.
Code (gambas)
- Highlight.Symbols
thank for trying
Posted
Regular

Exemplum simplex:
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Expert

The following example shows a toolbox routine to get the id field from any table by providing 'a' name.
All my tables have an id field and the names are unique.
The AE ( Application Error management) module has a collection that is used like a stack.
Procedure calls are loaded as they are accessed and removed as the procedure closes.
The Finally statement removes the next procedure listed in the stack and as all procedures close,
the stack empties.
The AE module generates an error form from scratch and then provides valuable data to error tracking.
I've found over the years that the extra effort in coding is worth the benefits of being able to quickly identify the error
and to be able to see the values of the parameters passed.
It also lists the backtrace in reverse order so that it's easier to follow.
Note # The return statement HAS to be after the stack remove call as once you call a RETURN statement in
any procedure, it terminates and no other statements are processed
Code (gambas)
- AE.ErrorWhere = "Public Function GetIdFromName(InTable As String, InField As String, InName As String) As Integer" & Gb.NewLine
- AE.ErrorWhere &= "Par1: " & InTable & Gb.NewLine
- AE.ErrorWhere &= "Par2: " & InField & Gb.NewLine
- AE.ErrorWhere &= "Par3: " & InName
- AE.LocationAdd(AE.ErrorWhere)
- AE.LocationRemove
- Return TmpId
This is an example of the output of a typical error.
AE Module.
Cheers - Quin.
I code therefore I am
I code therefore I am
Posted
Guru

PJBlack said
BruceSteers said
The IDE runs through the code very quickly and lists all symbols, function names, values etc in an enumerable collection.
thats what im looking for …
your example did not work because:
1. ini have to manually give the name, andCode (gambas)
2.gives back a string[] with one entry and that is "form1" … i think i knew that allready …Code (gambas)
Highlight.Symbols
thank for trying
you have to analize the whole file text , you have essentially only analized only the word "form1" there, you'd load in the class file like…
then iterate through the results somehow.
Like i say i do not know how.
Vuotts method looked pretty simple
Posted
Regular

BruceSteers said
Vuotts method looked pretty simple
…but more complexly and for more generic elements, by accessing the "CLASS_DESC_SYMBOL *table " member of " _CLASS " Structure (in the header file "gbx_class.h "):
Code (gambas)
- Functio(p)
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
1 guest and 0 members have just viewed this.

