Function with spaces arround * left to C function name not listed

Function with spaces arround * left to C function name not listed

1
NewbieNewbie
1

    Oct 18, 2012#1

    Hi this function is not shown in the function list.

    Code: Select all

    static const char * _Tst (U8 Unit) {
      return ("tst");
    }
    Here my wordfile

    /TGBegin "Function"
    /TGFindStr = "%^([a-z_][a-z_0-9^[^]*]++^)[ ^t^p^r^n]++([~)]++)[~;{()]+[^p^r^n ^t]++[~/]++{[~}]"
    /TGFindStr = "%[ ^t]++^([a-z_][a-z_0-9]++::[a-z_^~][a-z_0-9]++^)[ ^t^p]++([^p*&:, ^t^[^]/*^-'=:&a-z_0-9./(!]++)[~;{]++{"
    /TGFindStr = "%[ ^t]++[a-z_][:a-z_0-9^[^]*&]++[ ^t]+^([a-z_][a-z_0-9]++::[a-z_^~][a-z_0-9]++^)[ ^t^p]++([^p*&:, ^t^[^]/*^-'=:&a-z_0-9./(!]++)[~;]"
    /TGFindStr = "%[a-z_][a-z_0-9^[^]:&]++[ ^t*]+[*&]++^([a-z_][a-z_0-9]++^)[ ^t]++([^p*&:, ^t^[^]a-z_0-9\+-./(!]++)[~;]++$"
    /TGFindStr = "%[a-z_][:a-z_0-9*&$^[^]/*:m]
    [*]++[ ^t]+[a-z_][:a-z_0-9*&$^[^]]++[ ^t*]+[*&]++^([a-z_][a-z_0-9]++^)[ ^t]++([^p*&:, ^t^[^]a-z_0-9./(!]++)+[~;]"
    /TGFindStr = "%[a-z_][:a-z_0-9^[^]*&]++[ ^t]+[a-z_][:a-z_0-9*&^[^]]++[ ^t]+[a-z_][:a-z_0-9*&^[^]]++[ ^t]+[*&]++^([a-z_][a-z_0-9]++^)[ ^t]++([^p*&:, ^t^[^]a-z_0-9./(!]++)[~;]"
    /TGFindStr = "%[a-z_][:a-z_0-9^[^]*&]++[ ^t]+[a-z_][:a-z_0-9*&^[^]]++[ ^t]+[a-z_][:a-z_0-9*&^[^]]++[ ^t]+[a-z_][:a-z_0-9*&^[^]]++[ ^t]+[*&]++^([a-z_][a-z_0-9]++^)[ ^t]++([^p*&:, ^t^[^]a-z_0-9./(!]++)[~;]"[/size]

    6,681583
    Grand MasterGrand Master
    6,681583

      Oct 18, 2012#2

      I have explained once at Newlines in C function definition between function name and round bracket how the regular expressions work to find function names in C/C++ files.

      The last but one (6th) function string is for matching function names with 3 words left to function name. This regular expression does not work for your function string because of the spaces characters on both sides of the asterisk. That is very uncommon. Typical is writing the asterisk immediately after type

      Code: Select all

      static const char* _Tst (U8 Unit) {
        return ("tst");
      }
      or writing the asterisk at beginning of the function name

      Code: Select all

      static const char *_Tst (U8 Unit) {
        return ("tst");
      }
      You can modify the last but one function string to

      /TGFindStr = "%[a-z_][:a-z_0-9^[^]*&]++[ ^t]+[a-z_][:a-z_0-9*&^[^]]++[ ^t]+[a-z_][:a-z_0-9*&^[^]]++[ ^t]+[*& ]++^([a-z_][a-z_0-9]++^)[ ^t]++([^p*&:, ^t^[^]a-z_0-9./(!]++)[~;]"

      The function name is also found and listed with this additional space character in the optional square bracket before function name. But be aware that this modification might result in listing other strings as functions which are not functions.

      So perhaps it is better to use the common variants of type* or *name. The latest C standard ISO/IEC 9899:2011 uses always second variant with *name.