• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

zXref (version 1.10)

Started by Patrice Terrier, August 14, 2009, 08:25:54 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Patrice Terrier

#60
The problem of EXPORTED sub/function, is easy to solve

add the code shown in red below to solve it:

'   //------------------------------------------------------------------------------
   zWrite $SPC
   zWrite sWork
   zWrite " UN-USED FUNCTIONS  (exported, or in incl. files, may be used by other programs)"
   zWrite sLine
   IF gnFunctions THEN
      FOR I = 0 TO gnFunctions - 1
          IF gaFunctions(I).IsUsed = 1 AND gaFunctions(I).iType > 1 THEN
             IF CheckMain(gaFunctions(I).zName) = 0 THEN ' ignore these
                sFileName = gsFiles(gaFunctions(I).FileNum)
                sStr = " FUNCTION " : sStr2 = ""
                IF gaFunctions(I).iType = 3 THEN sStr = " CALLBACK "
                IF gaFunctions(I).Exported THEN sStr2 = " <EXPORT>"
                s1 = LEFT$(sStr + gaFunctions(i).zName + sStr2 + SPACE$(52), 52)
                s2 = PATHNAME$(NAMEX, sFileName)
                s3 = STR$(gaFunctions(I).LineNum)
                s4 = STR$(gaFunctions(I).SubEnd)
                zWrite BUILD$(s1, "  [", s2, "] :", s3, " -", s4)

'                // Flag the bit array for un-used functions
                IF gaFunctions(I).Exported = 0 THEN
                   FOR nBa = gaFunctions(I).LineNum TO gaFunctions(I).SubEnd: BIT SET bArray(0), nBa: NEXT
                END IF

             END IF
         END IF
      NEXT
   END IF
'   //------------------------------------------------------------------------------
   zWrite $SPC
   zWrite sWork
   zWrite " UN-USED SUBS  (exported, or in incl. files, may be used by other programs)"
   zWrite sLine
   IF gnFunctions THEN
      FOR I = 0 TO gnFunctions - 1
          IF gaFunctions(I).IsUsed = 1 AND gaFunctions(I).iType = 1 THEN
             sFileName = gsFiles(gaFunctions(I).FileNum)
             sStr2 = ""
             IF gaFunctions(I).Exported THEN sStr2 = " <EXPORT>"
             s1 = LEFT$(" SUB " + gaFunctions(i).zName + sStr2 + SPACE$(50), 50)
             S2 = PATHNAME$(NAMEX, sFileName)
             s3 = STR$(gaFunctions(I).LineNum)
             s4 = STR$(gaFunctions(I).SubEnd)
             zWrite BUILD$(s1, "    [", s2, "] :", s3, " -", s4)

'             // Flag the bit array for un-used sub
             IF gaFunctions(I).Exported = 0 THEN
                FOR nBa = gaFunctions(I).LineNum TO gaFunctions(I).SubEnd: BIT SET bArray(0), nBa: NEXT
             END IF

          END IF
      NEXT
   END IF
'   //------------------------------------------------------------------------------


Added:
Perhaps we could do it for CALLBACK as well.
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Bud Meyer

Thanks, Patrice. That seems to have fixed the exports.

I have quite a few CODEPTRs and they all seem to have been recognized ok, except for BrowseForFolderProc. Strange.

Anyway, the compiled DLL went from 517,632 to 513,536. So there was some savings. :) However, it's not nearly as much as incLean usually saved, plus it's still taking over 8 seconds to compile, whereas incLean let me compile in 0.1 second (pretty much instant). Perhaps it would be possible to also scan win32api? I guess I can edit the cfg file to do that..


Patrice Terrier

#62
Yes, editing the CFG file, could help to reduce furthermore un-used code.

This is still a work in progress, thus room for enhancements.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Patrice Terrier

zXref has been updated to version 1.04

To keep CALLBACK and EXPORTED sub/function in the code.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Patrice Terrier

The original pbcodec code was the result of a cooperative work.

Thus feel free to submit code enhancements and suggestions for zXref.

Thank you!

...


Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Patrice Terrier

zXref version 1.06, has been attached to the first post of this thread.

See History, for further details.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Bud Meyer

Having some trouble loading into PBEdit...
QuoteLine 28930 is over 256 characters. Splitting into shorter lines.
Line 28940 is over 256 characters. Splitting into shorter lines.
Line 42433 is over 256 characters. Splitting into shorter lines.
Line 51079 is over 256 characters. Splitting into shorter lines.
Line 51152 is over 256 characters. Splitting into shorter lines.
Cannot load file $Source.bas
Maximum lines allowed: 65,520

I opened $Source.bas in Notepad++ and it has 150,934 lines. :o  In reality, I think my entire program is somewhere between 15,000 and 35,000 lines (I'm not exactly sure due to the includes that it uses).

Looks like I still need to EXCLUDE inc files after all. I'm still hopeful that this will eventually turn into the successor to incLean.

Patrice Terrier

#67
What about SED or UltraEdit32.

I did Xref SED's source code: 229552 lines!


Looks like PBEdit is still 16-bit  ;D

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

José Roca

 
It is 32-bit, but uses a custom control, "PBEDIT32".

Patrice Terrier

I did try to get the inclean source code, without success, to speed-up the work i am doing for the community.

Thus i started a new project named zClean, where i am re-inventing the wheel...

So far i am detecting:
- CM = CONSTANT in MAIN prefixed with either $ or %.
- TM = TYPE in MAIN.
- UM = UNION in MAIN.
- CU = CONSTANT USED in main.
- TU = TYPE USED in main.
- UU = UNION USED in main.

Now i will parse the include files to detect the matching occurences with the above.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Patrice Terrier

I am realy thinking of supporting only PB9+ compiler in zClean, this would let me use the new built-in CONSTANT instead of embedding them from include.

Your thought?


Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Paul Squires

I vote for 9+ only. No need living in the past.
Paul Squires
FireFly Visual Designer SQLitening Database System JellyFish Pro Editor
http://www.planetsquires.com

Patrice Terrier

I am still fighting with it.

I have to solve an unresolved constant error with the compiler, for a constant using a constant that is already define sooner in the code  ???

I have been working on that for several days without success  :-\

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Patrice Terrier

#73
That one should be able to produce further code reduction.

I did try it on SED and got a saving of 12 285 bytes on the original EXE file.

Added:
Check further post for the zip file.

...

Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Bud Meyer

#74
Quote---------------------------
zXref.exe - Unable To Locate Component
---------------------------
This application has failed to start because ZTRACE.DLL was not found. Re-installing the application may fix this problem.
---------------------------
OK  
---------------------------

ok, I downloaded ztrace and the app runs now. But I can't compile the $Source.bas because of issues with PBForm statements.. Not sure how to fix yet. Adding the line #INCLUDE "PBForms.INC" doesn't help.


QuoteSyntax error
Line 8807:     CONTROL ADD PBFormsRichEdit(), hDlg, %IDC_Textbox, "", 0, 14, 533, 244, %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %WS_HSCROLL OR %WS_VSCROLL OR %ES_LEFT OR %ES_MULTILINE OR %ES_AUTOHSCROLL OR %ES_AUTOVSCROLL OR %ES_NOHIDESEL OR _
(the next line does appear to correctly contain the reset of the statement)


I added #INCLUDE "RICHEDIT.INC" and solved that problem. But then I get duplicate errors with MACROs. I thought there might be a problem with my custom include file (hand-made a few days ago, to give me the results that incLean used to provide), but I commented out that line and now I get other errors suchs a %MAX_PATH is not defined.

I'm going to give up for now. It's not worth sorting out at the moment.