Connecting Tech Pros Worldwide Forums | Help | Site Map

C++ Function Signature string Parser

krbyxtrm
Guest
 
Posts: n/a
#1: Apr 6 '06
Any knows of a Function Signature string Parser?


typically one that can parse string:
"unsigned int const * __cdecl MyFunction(int,void const *)"

into:
0 : 'unsigned int const *'
1 : '__cdecl'
2 : 'MyFunction'
3 : 'int'
4 : 'void const *'


Pavel Vozenilek
Guest
 
Posts: n/a
#2: Apr 6 '06

re: C++ Function Signature string Parser



"krbyxtrm" wrote:
[color=blue]
> Any knows of a Function Signature string Parser?
>
>
> typically one that can parse string:
> "unsigned int const * __cdecl MyFunction(int,void const *)"
>
> into:
> 0 : 'unsigned int const *'
> 1 : '__cdecl'
> 2 : 'MyFunction'
> 3 : 'int'
> 4 : 'void const *'
>[/color]

If such tool exists it is compiler dependent.

For VC++ you may try Win32 API function UnDecorateSymbolName().

/Pavel


Ira Baxter
Guest
 
Posts: n/a
#3: Apr 8 '06

re: C++ Function Signature string Parser


"krbyxtrm" <krbyxtrm@gmail.com> wrote in message
news:1144297936.509383.9740@v46g2000cwv.googlegrou ps.com...[color=blue]
> Any knows of a Function Signature string Parser?
>
> typically one that can parse string:
> "unsigned int const * __cdecl MyFunction(int,void const *)"
>
> into:
> 0 : 'unsigned int const *'
> 1 : '__cdecl'
> 2 : 'MyFunction'
> 3 : 'int'
> 4 : 'void const *'[/color]

You essentially have to parse the entire C++ language to do this.
(Consider a function signature involving a template defined in terms of
typedefs using macros ....)

The DMS Software Reengineering Toolkit has a full C++ parser
that can be used to extract function signatures.
See http://www.semanticdesigns.com/Produ...pFrontEnd.html


--
Ira Baxter, CTO
www.semanticdesigns.com


Sven Heyll
Guest
 
Posts: n/a
#4: Apr 9 '06

re: C++ Function Signature string Parser


Ira Baxter wrote:[color=blue]
> "krbyxtrm" <krbyxtrm@gmail.com> wrote in message
> news:1144297936.509383.9740@v46g2000cwv.googlegrou ps.com...
>[color=green]
>>Any knows of a Function Signature string Parser?
>>
>>typically one that can parse string:
>>"unsigned int const * __cdecl MyFunction(int,void const *)"
>>
>>into:
>>0 : 'unsigned int const *'
>>1 : '__cdecl'
>>2 : 'MyFunction'
>>3 : 'int'
>>4 : 'void const *'[/color]
>
>
> You essentially have to parse the entire C++ language to do this.
> (Consider a function signature involving a template defined in terms of
> typedefs using macros ....)
>
> The DMS Software Reengineering Toolkit has a full C++ parser
> that can be used to extract function signatures.
> See http://www.semanticdesigns.com/Produ...pFrontEnd.html
>
>[/color]
Hi,
You could also use ANTLR, I think a pretty good C++
grammar exists for antlr.

WBR,
Sven Heyll
Ira Baxter
Guest
 
Posts: n/a
#5: Apr 10 '06

re: C++ Function Signature string Parser



"Sven Heyll" <sven.heyll@web.de> wrote in message
news:e1bgom$45p$1@news2.rz.uni-karlsruhe.de...[color=blue]
> Ira Baxter wrote:[color=green]
> > "krbyxtrm" <krbyxtrm@gmail.com> wrote in message
> > news:1144297936.509383.9740@v46g2000cwv.googlegrou ps.com...
> >[color=darkred]
> >>Any knows of a Function Signature string Parser?
> >>
> >>typically one that can parse string:
> >>"unsigned int const * __cdecl MyFunction(int,void const *)"
> >>
> >>into:
> >>0 : 'unsigned int const *'
> >>1 : '__cdecl'
> >>2 : 'MyFunction'
> >>3 : 'int'
> >>4 : 'void const *'[/color]
> >
> > You essentially have to parse the entire C++ language to do this.
> > (Consider a function signature involving a template defined in terms of
> > typedefs using macros ....)
> >
> > The DMS Software Reengineering Toolkit has a full C++ parser
> > that can be used to extract function signatures.
> > See http://www.semanticdesigns.com/Produ...pFrontEnd.html
> >
> >[/color]
> Hi,
> You could also use ANTLR, I think a pretty good C++
> grammar exists for antlr.
>
> WBR,
> Sven Heyll[/color]

To understand a function signature in detail, you need type information.
I don't beleive that the ANTLR implementation provides any of this.
DMS provides complete type information.

-- IDB


krbyxtrm
Guest
 
Posts: n/a
#6: Apr 11 '06

re: C++ Function Signature string Parser


Hi,
what i'm trying to build is some sort of storage of the involved
'types' ; as to the types in the function signature string.

--krby

Ayon kay Ira Baxter:[color=blue]
> "Sven Heyll" <sven.heyll@web.de> wrote in message
> news:e1bgom$45p$1@news2.rz.uni-karlsruhe.de...[color=green]
> > Ira Baxter wrote:[color=darkred]
> > > "krbyxtrm" <krbyxtrm@gmail.com> wrote in message
> > > news:1144297936.509383.9740@v46g2000cwv.googlegrou ps.com...
> > >
> > >>Any knows of a Function Signature string Parser?
> > >>
> > >>typically one that can parse string:
> > >>"unsigned int const * __cdecl MyFunction(int,void const *)"
> > >>
> > >>into:
> > >>0 : 'unsigned int const *'
> > >>1 : '__cdecl'
> > >>2 : 'MyFunction'
> > >>3 : 'int'
> > >>4 : 'void const *'
> > >
> > > You essentially have to parse the entire C++ language to do this.
> > > (Consider a function signature involving a template defined in terms of
> > > typedefs using macros ....)
> > >
> > > The DMS Software Reengineering Toolkit has a full C++ parser
> > > that can be used to extract function signatures.
> > > See http://www.semanticdesigns.com/Produ...pFrontEnd.html
> > >
> > >[/color]
> > Hi,
> > You could also use ANTLR, I think a pretty good C++
> > grammar exists for antlr.
> >
> > WBR,
> > Sven Heyll[/color]
>
> To understand a function signature in detail, you need type information.
> I don't beleive that the ANTLR implementation provides any of this.
> DMS provides complete type information.
>
> -- IDB[/color]

Closed Thread