Menu

Functionlist lists too many functions!

2010-01-14
2013-05-21
  • Bo Berglund

    Bo Berglund - 2010-01-14

    I have finally gotten FL to work with my NP++ Unicode 5.6.3 by finding the 200911 beta release. :)

    But now when I open a c file and enable the function list pane it lists stuff that definitely are not functions! :(
    It looks like the parser is looking inside comment blocks as well as in active code, why is this so?
    Examples of lines listed as functions:

    #include "defines3R.h"  => Shows up in the list as "defines3R.h"
    * Input          : Port as struct and bit to change (0..7)  => Shows up as function change (this is inside a comment block
    * Input          : -AHBPerip: AHB peripherals(__USB, __DMA,...)  => Shows up as function peripherals, but is part of comment
    

    Generally our comments that are placed right before the start of a function look like this example:

    /*******************************************************************************
    * Function Name  : SCU_AHBPeriphClockConfig
    * Description    : Enable the clock for an AHB peripheral
    * Input          : -AHBPerip: AHB peripherals(__USB, __DMA,...)
    *                  -NewState : ENABLE or DISABLE
    * Output         : None
    * Return         : None
    *******************************************************************************/
    

    I think that FunctionList should skip everything inside a comment block when parsing for functions, don't you?

    Is there some kind of setting I am missing here?

     
  • Bo Berglund

    Bo Berglund - 2010-01-14

    From another forum entry I found where the author also is getting too many hits I found the reply to add ^ in front of the regexp for function begin. This reduces the number of extra functions but not completely!
    The begin regexp is now like this:

    ^\s*\w+[\s\*]+
    

    But I am still getting hits from the file header comment block, which looks like this:

    /*********************************************************************
    *
    *   System 3R International AB
    *
    *   (c) Copyright System 3R International AB 2009.  All rights reserved.
    *
    **********************************************************************
    ----------------------------------------------------------------------
    File    : InitWMC4MI.c
    Purpose : Board support for WMC4 Machine Interface board
    Author  : Bo Berglund
    Date    : 2009-12-04
    Rev     : 1.1
    --------  END-OF-HEADER  ---------------------------------------------*/
    

    From this FunctionList extracts the following bogus functions:
    File
    Purpose
    Author
    Date
    Rev

    Additionally it gets a function from this code line:

    //#define SCU                ((SCU_TypeDef *)SCU_BASE)
    

    The function is named ((SCU_TypeDef *)SCU_BASE), which obviously is totally wrong. This line should not even be part of parsing since it is commented out!

    I have used the FunctionListRules.xml file that is contained within the zipfile for FunctionList 20091109 and I have no real clue as to how one modifies the rules that are present in regexp form. Simply looks like a foreign language to me. But I thought that at least for the C language the rules would be working….
    But not, I found that for comments rules were set up for comment delimiters such as " and ' whereas i only know of // and the /* */ pair as comment delimiters for C. So it seems like the xml file is wrong.
    How to get a correctly working xml file defining the rules? Surely not everyone is expected to be creating his own???

     

Log in to post a comment.