No announcement yet.

Poor Man's PB Lint (PBCodec 1.25)

  • Filter
  • Time
  • Show
Clear All
new posts

  • Poor Man's PB Lint (PBCodec 1.25)

    I have entered in the Source Code Forum a self updated version of Borje Hagsten's PBCodec.

    PBCodec has several useful features:
    1. List of included but not used Functions
    2. List of included but not used Subs
    3. Un-Used Global Variables
    4. Un-Used Local Variables
    5. Warns when GLOBAL and LOCAL have the same name

    I have updated it to recognize (most) conditional compilations:
    • #IF %ABC
    • #IF NOT %ABC
    • #IF %DEF(%ABC)
    • #IF NOT %DEF(%ABC)
    • #ELSE
    • #ENDIF

    Added support for #INCLUDE ONCE (without fix it duplicated items in the reports)

    Added a checkbox to the main Dialog to be able to Suppress "Included but Not Declared Sub()'s and Functions()'s" since PB 9.0 seems to have eliminated the need for this.

    See what you think.
    Nathan Maddox

  • #2
    Hi Nathan,

    I just recently had a need to use PBCodec and decided to try out your new version. I'll give you some feedback later.

    I also have a question. I'm interested in finding unused equates that have been defined at the start of an application but which are not called anywhere within the app. Will your version do that, or can it be readily modified to add those to the reporting?

    Thank you very much for your efforts!


    • #3

      It can be modified to do that, but it will require some clarification on the requirements.

      What (for your purposes) constitutes usage?

      For example, once an equate is created, would either (or both) of these constitute usage:
      1)used in a conditional compile statement ...#if %Def(%ABC) or
      2)used in an execuatable statement ... A1=FDST(%ABC).Total
      Nathan Maddox


      • #4
        If the equate is used anywhere else in the program - for any purpose (other than in a comment).

        Basically, will the program run as intended if I remove the equate.

        Occasionally I decide to rewrite a larger program which contains a few hundred equates. I want to be able to identify any equates which are not required by the newer, modified program. Manual inspection is the way I do it now.

        I can picture how to write a stand alone program to do this, but thought your PBCodec revision might more easily modified than writing a new utility from scratch.


        • #5
          I'm not sure... but I believe that there is a program floating around the forums called inclean that will do that for you already.
          Nathan Maddox


          • #6
            Just checking... you want to remove unused equates for....what, documentary purposes?

            That's the only reason I can think of other than a couple of nanoseconds at compile time and a couple hundred bytes of disk in your source code storage.

            If so you should probably think about "Exclude equate removes from selected files" (eg WIN32API.INC) unless you enjoy adding them back when you go to add a new feature or two.....

            Michael Mattias
            Tal Systems (retired)
            Port Washington WI USA
            [email protected]


            • #7
              Ok, as I re-read your post, it appears you may only want to do this in your (your= you wrote 'em) "main" program source code module(s) and include file(s) ... which I guess qualifies as "documentary" purposes.

              I think inclean (which I do not use, although I do use pbcodec) will handle that for you, as pointed out by Mr. Maddox.
              Last edited by Michael Mattias; 11 Aug 2010, 09:48 AM.
              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]


              • #8
                Hi Nathan,

                Unfortunately, as written, INClean only extracts equates from specific includes.

                I had thought to use INClean by extracting all equates and place them in a second file (*.inc). I thought INClean would then tell me which of the equates are required.

                But INClean doesn't detect all include dependency files, so that didn't work for me.

                Putting that capability into PBCodec would be somewhat ideal, since I already use it on my code.

                I'll go look at your released source code and see what I can come up with.