Announcement

Collapse
No announcement yet.

Un-Used Variables Part 5 1/4 - VarDumpah

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Lance Edmonds
    replied
    Ok, I've posted my latest attempt in the Source Code forum.

    This is a heavily modified version of the original CHECKIT code.

    I've mentioned some of the changes, and added a lot of comments to
    help folks work out what I've done.

    The biggest additions are as follows:

    1. Optional parsing of WINAPI files
    2. Parsing of nested parameters in DIM statements
    3. Reporting of #INCLUDE files not located
    4. Refinements in the report format

    To do:

    1. UDT <types> are not parsed, such as in "DIM <variable> AS <type>" to identify unused TYPES (although the variables are obviously parsed.
    2. Better handling of the /I compiler path needs to be implemented. Currently this uses the PB/DLL 6.0 IDE setting, and this code does not handle multiple paths (separated by semicolons).
    3. Reporting of USED API Subs/Functions.
    4. ? Bound to be something else wrong or to be added.


    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Lance Edmonds
    replied
    Michael, there is one immediate problem with the code - it rejects ALL file types. The line of code:
    Code:
        IF  TempStr <> ".BAS" OR TempStr <> ".INC" THEN ' add your flavors here ...
    should actually read:
    Code:
        IF  TempStr <> ".BAS" [b]AND[/b] TempStr <> ".INC" THEN ' add your flavors here ...

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Mike Trader
    replied
    Full Code - In the source code forum now ...



    [This message has been edited by Mike Trader (edited July 28, 2001).]

    Leave a comment:


  • Mike Trader
    started a topic Un-Used Variables Part 5 1/4 - VarDumpah

    Un-Used Variables Part 5 1/4 - VarDumpah

    I have finished my app I thought I would share it.

    It searches source code for unused GLOBALs, LOCALs and DIMs and deletes them!
    You can step through the un-used variables one by one looking at
    your source code in a window and then choosing to dump them or keep
    them.

    I have tested on a project with 10 includes (some in the WinApi folder)
    it does not dump variables out of the INCLUDES it only checks them
    to verify that a GLOBAL is used.

    Teh concept is that you only need to process an Included file once
    after that its the main project file that needs processing.

    However, if you launch the app first and then drag and drop a bunch
    of files onto it, they will all be processed automatically (no user
    options tho) If you want to see whats going on and go step by step
    and create a report, drag a single file onto the icon to launch it.

    It will work for split line declarations of any kind and arrays
    declared as anything (MyType, WIN32_FIND_DATA etc etc)

    It will allow TYPEs declared anyway I know how.

    After it has deleted the un-used variables it does a little cleanup
    and you can immediatly compile your code.

    It will also create a report of the unused variables,
    if they were deleted or not, if there are local and Global vars with
    the same name, the function and line number and filename.

    I have tested it with 15 examples that between them cover all the
    permutations I could come up with. THey are below.

    The program assumes the code will compile befor you process it.

    The method I have used is a little different form the first app
    posted, but it seems robust.

    If you find any code it has trouble with pls post a short (40lines or less)
    example that illustrates the problem and Ill work on it, or you
    are welcome to develop it yourself

    Its not fast. I must admit i took the direct approach and did not
    take alot of trouble to consider the speed. Im sure it could be
    imporved upon by all you great programmers.

    Finally ater a week of this, I have two things to say to the PB guys...
    Im not worthy .... Im not worthy ....


    Examples in Source Code forum ...

    ------------------
    Kind Regards
    Mike



    [This message has been edited by Mike Trader (edited July 28, 2001).]
Working...
X