msext token with different type between windows and linux

Issue #58 resolved
Benoit Regrain created an issue

The tokens found with getTokens don't correctly manage microsoft specific tokens, like __stdcall.

For the same token value (tokenValue) __stdcall, on windows, the type (tokenType) is 'msext_stdcall', but is identifier on linux.

With the following code:

set tokenSearch {
  msext_int8
  msext_int16
  msext_int32
  msext_int64
  msext_based
  msext_declspec
  msext_cdecl
  msext_fastcall
  msext_stdcall
  msext_try
  msext_except
  msext_finally
  msext_leave
  msext_inline
  msext_asm
  msext_region
  msext_endregion
}

proc processFile {f} {
  set tokens [getTokens $f 1 0 -1 -1 $tokenSearch]
  set index 0
  set end [llength $tokens]
  # Parse the file's tokens
  while {$index < $end} {
    set token [lindex $tokens $index]

    set tokenValue [lindex $token 0]
    set tokenType [lindex $token 3]

And the parsed code is the following:

#if owSystemWin32
int __stdcall WinMain(HINSTANCE _hInstance, HINSTANCE _hPrevInstance, LPSTR _lpCmdLine, int _nCmdShow)
{
   return 0;
}
#else
int main(int _argc, char const **_argv)
{
   return 0;
}
#endif

Comments (4)

  1. Log in to comment