Powerbasic Museum 2020-B

IT-Consultant: Patrice Terrier => Addon tools for PB => Topic started by: Patrice Terrier on August 14, 2009, 08:25:54 PM

Title: zXref (version 1.10)
Post by: Patrice Terrier on August 14, 2009, 08:25:54 PM
zXref is based on pbcodec from Borje Hagsten.
It has been reworked to work in plain SDK mode using the latest PB9 string goodies.

It combines the capabilities of pbcodec + inclean into one single small exe, and it is a good companion to the zTrace utility.

zXref, merges the main source code and the private include files into one single file, that is used to create an XREF report, and a new file ready to compile with all un-used SUB and FUNCTION removed from the resulting $xxxxxx.bas file.

Note: YOU must customize the zXref.cfg file with a text editor to match your own PATH environment!

History:
09-13-2009 Version 1.10: - ISFILE has been replaced with zExist to detect files and folders.
09-02-2009 Version 1.09: - Added new checkbox "Clean code", to produce either XREF only or XREF + cleaned code.
08-31-2009 Version 1.08: - Parsing #IF in include file to detect un-used sections (see BuildSingleFile).
                                   - Added zDoEvents() to process pending messages while doing the scan job
                                   - Added ProgressBar to show what the program is doing.
08-19-2009 Version 1.06: - Function detection has been enforced for compatibility with PB9 (the word Function being used in UDT).
                                   - Added METHOD detection.
                                   - No more need to use "EXCLUDE:" in the config file (detect un-used code in the standard includes).
                                   - Better parsing of keywords (UcaseCrunchSpace).
08-18-2009 Version 1.04: CALLBACK and EXPORTED sub/function are not removed from code.
08-18-2009 Version 1.03: combo of pbcodec and inclean.
08-18-2009 Merge the Main source + all Includes (except standard) into one single file.
08-17-2009 Support of José Roca's include files, while standard include files are EXCLUDE from the recursive scan.
08-16-2009 Added zXref.cfg, to resolve missing include path.
08-12-2009 First version

zXref is freeware.

... 
Title: Re: zXref (work in progress)
Post by: Bud Meyer on August 14, 2009, 09:58:58 PM
Tests ok for me, but I had to edit this line in IsFileMain because my COMPILE statements are tab indented:
      sBuffer = LTRIM$(zBufin((sFileName), nDone), ANY $SPC & $TAB)

Here's an example of what I mean:
#IF %DestFolder = 0  
   #COMPILE DLL "C:\Program Files\MyFolder\MyProg.exe"
#ELSE  
   #COMPILE DLL "C:\Program Files (x86)\MyFolder\MyProg.exe"
#ENDIF


Also, it generated and left behind a bunch of 0 byte inc files in my folder.

I look forward to future updates of this program. :)
Title: Re: zXref (work in progress)
Post by: Patrice Terrier on August 15, 2009, 09:06:46 AM
Bud,

I have updated the ZIP file, with a new version. i have done a lot of changes

Here is the result i got on my computer scanning zXref.bas

PBcodec version 1.14 (exe size: 91648 bytes)

¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
PBcodec report: ZXREF.BAS + include files. Generated 08-15-2009, 08:48:13
4154 lines scanned in 0.129 seconds (1925562 lines/minute)
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤


zXref version 1.00 (exe size: 87040 bytes)

================================================================================
XRef report: ZXREF.BAS + include files. Generated 08-15-2009, 08:47:09
4154 lines scanned in 0.062 seconds (4020000 lines/minute)
================================================================================


QuoteAlso, it generated and left behind a bunch of 0 byte inc files in my folder.
I don't understand what you mean, i do not create any inc files, could you please elaborate?

...
Title: Re: zXref (work in progress)
Post by: Bud Meyer on August 15, 2009, 04:25:55 PM
Quote from: Patrice Terrier on August 15, 2009, 09:06:46 AM
I don't understand what you mean, i do not create any inc files, could you please elaborate?
Many of the includes in my program are stored in a different folder than the main bas file. After running zXref, 0 bytes copies of those "external" includes appear in my program folder and I have to delete them manually.
Title: Re: zXref (work in progress)
Post by: Patrice Terrier on August 15, 2009, 04:44:43 PM
I am unable to reproduce this behavior, anyone else?
Title: Re: zXref (work in progress)
Post by: Trento Castricone on August 15, 2009, 04:57:47 PM
Everything worked as expected , except:
I declared the vaiable "ADlg" twice as a GLOBAL.
zXref noted the problem , but thought one was an array.

The zero length files have the names of the include files and RC file.

Thanks for your efforts
Title: Re: zXref (work in progress)
Post by: Patrice Terrier on August 15, 2009, 05:02:41 PM
I am on VISTA 64-bit and i can't see any file with zero byte matching the name of the include or rc file.

???
Title: Re: zXref (work in progress)
Post by: Trento Castricone on August 15, 2009, 05:11:35 PM
I am using Vista-32.
I LOVE zero lenght files - there can be no problems in them.  Easy to remove.
Title: Re: zXref (work in progress)
Post by: James C. Fuller on August 15, 2009, 05:13:11 PM
No extra files here with XP Home SP3

James
Title: Re: zXref (work in progress)
Post by: Patrice Terrier on August 15, 2009, 05:25:29 PM
Are you using long file name with space or accentuated characters?
Title: Re: zXref (work in progress)
Post by: Patrice Terrier on August 15, 2009, 05:52:02 PM
I am totaly lost on that one.

Try changing the open mode from "0, 1" to "0, 2" in zFopen
example :
IF zFOpen((sFileName), 0, 2, hFile) = 0 THEN
instead of
IF zFOpen((sFileName), 0, 1, hFile) = 0 THEN

...
Title: Re: zXref (work in progress)
Post by: Trento Castricone on August 15, 2009, 06:12:29 PM
Did not help - same zero length files.

Are line numbers going to be supported?
Title: Re: zXref (work in progress)
Post by: Paul Squires on August 15, 2009, 06:48:49 PM
Excellent work Patrice (as usual) :)

I use your zTrace everyday so I imagine that I'll be using zXref as well.

I noticed that when you're parsing for the Sub/Function that you are not taking into considering syntax such as "THREAD FUNCTION..." or "STATIC Sub...".  I think that the only place that STATIC is checked for is in IsFileMain.

I am just skimming down through the source. Borje sure liked to use a lot of "magic numbers" in the code. I did notice that there is a lot of things like INSTR(UCASE$(sBuffer)... especially in the DoProcess routine. I think it would make sense to create a separate variable once representing the UCASE of a line and use that variable rather than constantly having to UCASE it???

Just thinking out loud... I see that the program uses global arrays to store all of the functions, variables, etc, and then uses ARRAY SCAN to determine if the variables are present in the arrays prior to adding new ones. I used to do something similar but changed my code to use a Hash table and the results were dramatic (at least for me). On large program source code I could see it cutting down the processing time even further (at the expense of a little bit more complexity). You could store a InfoStruct at each found location in the Hash tables.

Thanks Patrice.

Title: Re: zXref (work in progress)
Post by: Patrice Terrier on August 15, 2009, 07:34:54 PM
Trento,

Do you have another application (like SED) that could be using the same include files at the time you are zXref the source code?

Paul,

I did a major rewrite of Börje's code, because it is the only way for me to understand what is going on, and twisting the code to my programming style helps me to progress with it.

For example, this pbcodec code:

              sWork = PARSE$(LineStr, CHR$(34), 2)     'get filename

              IF LEFT$(sWork, 2) = ".\" THEN  'resolve eventual relative paths
                 sWork = FilePathStr + MID$(sWork, 2)
              ELSEIF LEFT$(sWork, 3) = "..\" THEN
                 sWork = LEFT$(FilePathStr, INSTR(-2, FilePathStr, "\")) + MID$(sWork, 4)
              ELSEIF LEFT$(sWork, 4) = "...\" THEN
                 sTemp2 = LEFT$(FilePathStr, INSTR(-2, FilePathStr, "\"))
                 sWork = LEFT$(sTemp2, INSTR(-2, sTemp2, "\")) + MID$(sWork, 5)
              ELSEIF LEFT$(sWork, 5) = "....\" THEN
                 sTemp2 = LEFT$(FilePathStr, INSTR(-2, FilePathStr, "\"))
                 sTemp2 = LEFT$(sTemp2, INSTR(-2, sTemp2, "\"))
                 sWork = LEFT$(sTemp2, INSTR(-2, sTemp2, "\")) + MID$(sWork, 6)
              ELSEIF LEFT$(sWork, 6) = ".....\" THEN
                 sTemp2 = LEFT$(FilePathStr, INSTR(-2, FilePathStr, "\"))
                 sTemp2 = LEFT$(sTemp2, INSTR(-2, sTemp2, "\"))
                 sTemp2 = LEFT$(sTemp2, INSTR(-2, sTemp2, "\"))
                 sWork = LEFT$(sTemp2, INSTR(-2, sTemp2, "\")) + MID$(sWork, 7)
              ELSEIF LEFT$(sWork, 7) = "......\" THEN
                 sTemp2 = LEFT$(FilePathStr, INSTR(-2, FilePathStr, "\"))
                 sTemp2 = LEFT$(sTemp2, INSTR(-2, sTemp2, "\"))
                 sTemp2 = LEFT$(sTemp2, INSTR(-2, sTemp2, "\"))
                 sTemp2 = LEFT$(sTemp2, INSTR(-2, sTemp2, "\"))
                 sWork = LEFT$(sTemp2, INSTR(-2, sTemp2, "\")) + MID$(sWork, 8)
              END IF

              IF INSTR(-1, sWork, ".") = 0 THEN          'if no file extension is given,
                 sWork = sWork + ".BAS"                  'compiler assumes .BAS file
              END IF


became in zXref:

                sWork = PARSE$(sLineStr, CHR$(34), 2)     'get filename
'               // Patrice
'               // Check if it starts with a dot ".\", "..\", "...\", "....\", ".....\", "......\"
                IF ASC(sWork) = 46 THEN
                   sTemp2 = FilePathStr
                   K = 1: One = 0
                   WHILE ASC(sWork, K) = 46
                       K += 1
                       IF ASC(sWork, K) = 92 THEN
                          sWork = sTemp2 + MID$(sWork, K + One)
                       ELSE
                          sTemp2 = SplitPath(sTemp2): One = 1
                       END IF
                   WEND
                END IF

                IF INSTR(-1, sWork, ".") = 0 THEN           'if no file extension is given,
                   sWork = sWork + ".BAS"                   'compiler assumes .BAS file
                END IF


About  "STATIC Sub" i never used it, i know it only as STATEMENT to define static variable inside SUB or FUNCTION.

...
Title: Re: zXref (work in progress)
Post by: Donnie Ewald on August 15, 2009, 08:14:13 PM
I ended up with zero-length files too.  Specifically, these are files that are INCLUDEd in the source file but are not found in the local directory.
Title: Re: zXref (work in progress)
Post by: Patrice Terrier on August 15, 2009, 08:42:04 PM
For your include

Do you specify a full path, a relative path, or do you rely to the comspec path in your source code?

What about a small "non-working" example?

...
Title: Re: zXref (work in progress)
Post by: Donnie Ewald on August 15, 2009, 08:58:08 PM
Greetings Patrice!

I'm not sure what would be the best way to post an example...

Let me throw some more text at what I found.  In SED, I have my PBWIN INCLUDE path set to "C:\PBWin90\WinAPI".  I've several INCLUDE files that I like to use often and I keep those in the same directory that I mentioned before.  I may be coding in "E:\Code\POFFS" and if I want to use one of those well-used files I write:

#INCLUDE "Poffs2.inc"

...and when SED sends it to be compiled it's automatically pulled from "C:\PBWin90\WinAPI".  I think that zXref is creating a zero-byte file when it doesn't find the INCLUDE file in the selected source's directory.  I suspect that if I added the full path to the INCLUDE files, that this wouldn't happen.

Also, I didn't mention this in my other post; but, this is a darn nice program.  I've used the one that was built-in to SED for quite some time.  Also, because I came to this post, I'm giving zTrace a go too.
Title: Re: zXref (work in progress)
Post by: Patrice Terrier on August 15, 2009, 09:16:18 PM
Ok, this is the problem!

I have no idea where you would store your include file, if the full path or relative path is not specified.

I am not looking at the settings your are using in your editor of choice SED or wathever text editor you are using.

What i could do, is to check the path, or perhaps look in the registry for the PBWin settings...

...
Title: Re: zXref (work in progress)
Post by: Trento Castricone on August 15, 2009, 09:23:49 PM
Went to my WinXP SP3 machine.
Same result.
Nothing running, but zXref.exe
Title: Re: zXref (work in progress)
Post by: Trento Castricone on August 15, 2009, 09:35:26 PM
Added full path to the .BAS file and NO zero lenght files.
Title: Re: zXref (include path problem)
Post by: Patrice Terrier on August 15, 2009, 09:35:59 PM
Trento, and others

I know what the problem is.

You are not specifying the full include path, that's the problem.

I take this opportunity to tell you, that zXref final version will use the José Roca's include files, then we probably need to create a zXref ini file, or something similar, to specify the default include directory.

So far what i could do is just to check at startup for a zXref.ini text file that would let you specify the default include folder you are using.

I shall add also a message to let you know, in case i don't find the include file.

...
Title: Re: zXref (work in progress)
Post by: Bud Meyer on August 15, 2009, 11:26:03 PM
I have more than one include path specified in the PB editor. Going through and hard-coding all the #INCLUDE statements in all of my programs would be a big headache for me. I think unless zXref checks for the custom paths, it probably won't be as useful for me.
Title: Re: zXref (work in progress)
Post by: Patrice Terrier on August 16, 2009, 12:06:42 AM
I could do it with something like that:

zXref.ini
"C:\PBWin90\WinAPI;D:\Jose_WinAPI\WinAPI;C:\MyInclude\"

but this comes at a price, it slows down the data-processing because i have first to check if the include file exist in the .BAS directory, if not, then i have to parse the ini file and try each path until i find a valid one.

:-\
Title: Re: zXref (work in progress)
Post by: Trento Castricone on August 16, 2009, 02:37:39 AM
Patrice

Hard coded include paths seems like a small price to pay for a quality piece of software.
I for one, think your time could be better spent continuing on with the development.

Why would anyone have more than one place for include files??

Jose's includes (900+) seems like a good place.
Title: Re: zXref (work in progress)
Post by: José Roca on August 16, 2009, 03:56:03 AM
 
I don't agree. I bet that most PBer's, including myself, will keep his own include files in a separate folder, if they are for general purpose use, and in the application's folder if they are to be used just in that application.

Quote
but this comes at a price, it slows down the data-processing because i have first to check if the include file exist in the .BAS directory, if not, then i have to parse the ini file and try each path until i find a valid one.

It is the only way.
Title: zXref (missing include path solved)
Post by: Patrice Terrier on August 16, 2009, 03:29:59 PM
To resolve missing include path, i have added a new zXref.cfg file where you can store the path envrionment to be used with zXref.

zXref.cfg is a standard sequential TEXT file, created with a plain any ascii text editor, it must be saved into the same folder than the zXref.exe.

Example of zXref.cfg

'+--------------------------------------------------------------------------+
'|                                                                          |
'|                             zXref config file                            |
'|                                                                          |
'+--------------------------------------------------------------------------+
'|                  Project started on : 08-12-2009 (MM-DD-YYYY)            |
'|                        Last revised : 08-16-2009 (MM-DD-YYYY)            |
'+--------------------------------------------------------------------------+
'
' Note: zXref always try to resolve include path using the ENVIRON$("PATH")
'
' Put the path list to scan for your include files there:
 
"SCANPATH:   D:\Jose_WinAPIC\WinAPI;C:\PBWin90\WinAPI" ' Use ; as delimiter




Note: That zXref will always parse the ENVIRON$("PATH") even if there is no zXref.cfg file.

Here are the new API added to zXref.inc to handle both the config file and the parsing of the PATH:

SUB ReadConfig()
    LOCAL S1, S2, S3, nItem, nDone, nMic AS LONG, sCfg, sBF AS STRING
    LOCAL zConfigFile AS ASCIIZ * %MAX_PATH
    zConfigFile = EXE.Path$ + EXE.Name$ + ".cfg"
    IF ISFILE(zConfigFile) THEN
       nItem = 0
       DO WHILE nDone = 0
          sCfg = LTRIM$(zBufin(zConfigFile, nDone))
          IF LEN(sCfg) THEN
             IF LEFT$(sCfg, 2) = "//" OR ASC(sCfg) = 39 THEN sCfg = ""
             IF LEN(sCfg) THEN
                S1 = INSTR(sCfg, CHR$(96)) ' "`"
                S2 = INSTR(-1, sCfg, CHR$(34))
                IF S1 = 0 THEN
                   S3 = INSTR(-1, sCfg, "'"): IF S3 > S2 THEN S1 = S3
                END IF
                IF S1 THEN sCfg = RTRIM$(LEFT$(sCfg, S1 - 1))
                S1 = INSTR(sCfg, CHR$(34))
                IF S1 AND S1 < S2 THEN
                   nMiC = ASC(sCfg, LEN(sCfg))
                   sCfg = MID$(sCfg, S1 + 1, S2 - S1 - 1)
     
                   sBF = sBF + sCfg
                   IF nMiC <> 95 THEN ' "_" continuation character
                      INCR nItem
                      ON nItem GOSUB SCANPATH
                      sBF = ""
                   END IF
                END IF
             END IF
          END IF
       LOOP
    END IF
    EXIT SUB

SCANPATH:
    CALL zSCANPATH(TRIM$(REMAIN$(sBF, ":"), ANY CHR$(32,34)), 1)
    RETURN
END SUB

FUNCTION zSCANPATH(BYVAL sText AS STRING, BYVAL RW AS LONG) AS STRING
    STATIC sWasText AS STRING
    LOCAL sS AS STRING
    sS = ";"
    IF RW THEN sWasText = sText
    FUNCTION = LTRIM$(RTRIM$(sWasText, sS) + sS + ENVIRON$("PATH"), sS)
END FUNCTION
FUNCTION ZX_SCANPATH() AS STRING
    FUNCTION = zSCANPATH("", 0)
END FUNCTION

FUNCTION zMainWindow(BYVAL hMain AS LONG) AS LONG
    STATIC WasMain AS LONG
    IF hMain THEN
       WasMain = hMain
    END IF
    FUNCTION = WasMain
END FUNCTION

FUNCTION zFindFile(BYVAL sFileName AS STRING) AS STRING
    LOCAL sPath, sDir, sFullName AS STRING, K, nCount AS LONG
    IF LEN(sFileName) THEN
       sFileName = PATHNAME$(NAMEX, sFileName)
       sPath = ZX_SCANPATH()
       nCount = PARSECOUNT(sPath, ";")
       FOR K = 1 TO nCount
           sDir = RTRIM$(PARSE$(sPath, ";", K), $Anti) + $Anti
           sFullName = sDir + sFileName
           IF ISFILE(sFullName) THEN EXIT FOR
           sFullName = ""
       NEXT
       FUNCTION = sFullName
    END IF
END FUNCTION


And here is the code being used to resolve missing include path:

'               // Patrice resolve missing include path
                IF ISFILE(sWork) = 0 THEN sWork = zFindFile(sWork)
                IF ISFILE(sWork) THEN                       'safety check - if we can find what we got..
                   tmpFiles(fc) = sWork                     'store path + name in temporary array
                   fc += 1: REDIM PRESERVE tmpFiles(fc)     'incr counter and redim temporary array
                END IF



Please let me know if it works with your configuration, and if it solves the problems that were reported.

The new ZIP file is attached to the first post of this thread.
Title: Re: zXref (work in progress)
Post by: Bud Meyer on August 16, 2009, 06:12:31 PM
Using the unedited cfg file... it hangs at "Collecting include files", consumes 100% CPU for a minute while it climbs to 300MB+ memory, and then Windows says it stopped working. Editing the SCANPATH to my own settings also caused the same problem. I don't have time to debug right now, but deleting the cfg file fixes it.
Title: Re: zXref (work in progress)
Post by: Patrice Terrier on August 16, 2009, 07:19:57 PM
I thought i was clear enough.

YOU have to edit the zXref.cfg to match your specific case!
Title: Re: zXref (work in progress)
Post by: Bud Meyer on August 16, 2009, 08:54:30 PM
It made no difference when I edited the SCANPATH, as I said in my last post.
Title: Re: zXref (work in progress)
Post by: Patrice Terrier on August 16, 2009, 10:07:46 PM
Anyone else having the same problem than Bud?

I succeed to create the single combined resulting file, using recursivity.
I hope you don't have too many levels of encapsulation, or i will have to enlarge the STACK.

...
Title: Re: zXref (work in progress)
Post by: Patrice Terrier on August 17, 2009, 09:16:27 AM
Bud,

The problem you encounter is related to the use of recursivity in DoGetIncludeFiles.

I shall work on it, to deal with José's include file and detect that a specific INC file is include only once (#INCLUDE ONCE), this parameter was not available at the time the original pbcodec code was written.

...
Title: zXref version 1.02 (support for José Rocas's include files)
Post by: Patrice Terrier on August 17, 2009, 01:15:16 PM
The new ZIP file is attached to the first post of this thread.

Version 1.02, should solved the problem of recursive search, while "standard" include files are excluded from the scan.

The zXref.cfg config file has been extended to specify the list of "standard" include files that exclude from scan


'+--------------------------------------------------------------------------+
'|                                                                          |
'|                             zXref config file                            |
'|                                                                          |
'+--------------------------------------------------------------------------+
'|                  Project started on : 08-12-2009 (MM-DD-YYYY)            |
'|                        Last revised : 08-16-2009 (MM-DD-YYYY)            |
'+--------------------------------------------------------------------------+
'
' Note: zXref always try to resolve include path using the ENVIRON$("PATH")
'
' Put the path list to scan for your include files there:
 
"SCANPATH:   D:\Jose_WinAPI\WinAPI;C:\PBWin90\WinAPI" ' Use ; as delimiter

"EXCLUDE: " _ ' List of standard include files, that must not be scanned
"ACCCTRL.INC,ACLAPI.INC,ACLUI.INC,ACTIVECF.INC,ACTIVEDS.INC,ACTIVSCP.INC,ADHOC.INC,ADO.INC,ADOCTINT.INC,ADODEF.INC,ADOINT.INC," _
"ADOJET.INC,ADOMD.INC,ADSDB.INC,ADSERR.INC,ADSHLP.INC,ADSIID.INC,ADSNMS.INC,ADSPROP.INC,ADSSTS.INC,ADTGEN.INC,ADVPUB.INC," _
"AGTCTL.INC,AGTERR.INC,AGTSVR.INC,AL.INC,ALC.INC,ALUT.INC,AMAUDIO.INC,AMOVIE.INC,AMPARSE.INC,AMSTREAM.INC,AMVA.INC,AMVIDEO.INC," _
"ANIMATECTRL.INC,APPAVCAP.INC,APPCOMPATAPI.INC,APPMGMT.INC,ASFERR.INC,ASPTLB.INC,ATACCT.INC,ATL.INC,ATSCPSIPPARSER.INC," _
"AUDEVCOD.INC,AUDIOCLIENT.INC,AUDIOENGINEBASEAPO.INC,AUDIOENGINEENDPOINT.INC,AUDIOMEDIATYPE.INC,AUDIOPOLICY.INC," _
"AUDIOSESSIONTYPES.INC,AUSTREAM.INC,AUTHEN.INC,AUTHZ.INC,AVIFMT.INC,AVIRIFF.INC,AVRT.INC,AZROLES.INC,BASETSD.INC,BCRYPT.INC," _
"BDAIFACE.INC,BDATIF.INC,BDATYPES.INC,BIDISPL.INC,BITS.INC,BITS1_5.INC,BITS2_0.INC,BITS2_5.INC,BITS3_0.INC,BITSCFG.INC,BITSMSG.INC," _
"BLBERR.INC,BLUETOOTHAPIS.INC,BTHDEF.INC,BTHSDPDEF.INC,BUTTONCTRL.INC,CALLOBJ.INC,CAPICOM.INC,CDERR.INC,CDOEX.INC,CDOEXERR.INC," _
"CDOEXM.INC,CDOEXSTR.INC,CDOSYS.INC,CDOSYSERR.INC,CDOSYSSTR.INC,CERTADM.INC,CERTCLI.INC,CERTENC.INC,CERTENROLL.INC,CERTIF.INC," _
"CERTVIEW.INC,CFG.INC,CFGMGR32.INC,CGUID.INC,CMDTREE.INC,CMNQUERY.INC,CODECAPI.INC,COMADMIN.INC,COMBOBOXCTRL.INC,COMBOBOXEXCTRL.INC," _
"COMBOCTRL.INC,COMCAT.INC,COMDLG32.INC,COMMCTRL.INC,COMMDLG.INC,COMMONCONTROLS.INC,COMSVCS.INC,CONFPRIV.INC,CONIO.INC,CONTROL.INC," _
"CORERROR.INC,CPL.INC,CPLEXT.INC,CTXCALL.INC,CTYPE.INC,CWINDOW.INC,D3D10.INC,D3D10EFFECT.INC,D3D10MISC.INC,D3D10SDKLAYERS.INC," _
"D3D10SHADER.INC,D3D10_1.INC,D3D10_1SHADER.INC,D3D9.INC,D3D9CAPS.INC,D3D9TYPES.INC,D3DX10.INC,D3DX10ASYNC.INC,D3DX10CORE.INC," _
"D3DX10MATH.INC,D3DX10MESH.INC,D3DX10TEX.INC,D3DX9.INC,D3DX9ANIM.INC,D3DX9CORE.INC,D3DX9EFFECT.INC,D3DX9MATH.INC,D3DX9MESH.INC," _
"D3DX9SHADER.INC,D3DX9SHAPE.INC,D3DX9TEX.INC,D3DX9XOF.INC,D3DXERR.INC,DAO.INC,DATACONTAINER.INC,DATACONTAINERVERSION.INC," _
"DATETIMECTRL.INC,DAVCLNT.INC,DBDAOERR.INC,DBDAOINT.INC,DBGHELP.INC,DDE.INC,DDEML.INC,DDRAW.INC,DDSTREAM.INC,DEVICETOPOLOGY.INC," _
"DEVPKEY.INC,DEVPROPDEF.INC,DHCPCSDK.INC,DHCPSAPI.INC,DHCPSSDK.INC,DHCPV6CSDK.INC,DHTMLDID.INC,DHTMLED.INC,DHTMLIID.INC," _
"DIGITALV.INC,DIMM.INC,DINPUT.INC,DIRECT.INC,DISPEX.INC,DLGS.INC,DMODSHOW.INC,DOCOBJ.INC,DOMDID.INC,DOT1X.INC,DRMEXTERNALS.INC," _
"DSADMIN.INC,DSCLIENT.INC,DSGETDC.INC,DSHOW.INC,DSHOWASF.INC,DSKQUOTA.INC,DSOUND.INC,DSQUERY.INC,DSROLE.INC,DSSEC.INC,DTS.INC," _
"DTSMSG.INC,DTSPIPELINE.INC,DV.INC,DVDEVCOD.INC,DVDMEDIA.INC,DVP.INC,DWMAPI.INC,DX7VB.INC,DX8VB.INC,DXGI.INC,DXGITYPE.INC," _
"DXTRANS.INC,DXVA2API.INC,DXVA2SWDEV.INC,EAPTYPES.INC,EDEVDEFS.INC,EDITCTRL.INC,EFFECTS.INC,EMOSTORE.INC,EMPTYVC.INC," _
"ENDPOINTVOLUME.INC,ERRNO.INC,ERRORS.INC,ESENT.INC,EVCODE.INC,EVENT.INC,EVENTSINK.INC,EVENTSINKEX.INC,EVENTSSINK.INC," _
"EVENTSYS.INC,EVNTCONS.INC,EVNTPROV.INC,EVNTRACE.INC,EVR.INC,EVR9.INC,EXDISP.INC,EXDISPID.INC,FAXCOM.INC,FAXCOMEX.INC,FCI.INC," _
"FCNTL.INC,FDI.INC,FILTER.INC,FLASH9.INC,FLOAT.INC,FLTDEFS.INC,FONTSUB.INC,FUNCTIONDISCOVERY.INC,FUNCTIONDISCOVERYAPI.INC," _
"FUNCTIONDISCOVERYCATEGORIES.INC,FUNCTIONDISCOVERYCONSTRAINTS.INC,FUNCTIONDISCOVERYKEYS.INC,FUNCTIONDISCOVERYKEYS_DEVPKEY.INC," _
"FUNCTIONDISCOVERYNOTIFICATION.INC,FUNCTIONDISCOVERYPROVIDER.INC,FUNCTIONDISCOVERYSERVICEIDS.INC,FUSION.INC,FXSUTILITY.INC," _
"GAMEUX.INC,GCHOST.INC,GDIPLUS.INC,GDIPLUSCOLOR.INC,GDIPLUSCOLORMATRIX.INC,GDIPLUSEFFECTS.INC,GDIPLUSENUMS.INC,GDIPLUSFLAT.INC," _
"GDIPLUSIMAGING.INC,GDIPLUSINIT.INC,GDIPLUSMEM.INC,GDIPLUSMETAHEADER.INC,GDIPLUSPIXELFORMATS.INC,GDIPLUSTYPES.INC,GDIPUTILS.INC," _
"GL.INC,GLAUX.INC,GLEXT.INC,GLFW.INC,GLU.INC,GPEDIT.INC,GPMGMT.INC,GUIDDEF.INC,HEADERCTRL.INC,HIGHLEVELMONITORCONFIGURATIONAPI.INC," _
"HLGUIDS.INC,HLIFACE.INC,HLINK.INC,HOTKEYCTRL.INC,HTIFACE.INC,HTIFRAME.INC,HTMLGUID.INC,HTMLHELP.INC,HTTP.INC,HTTPEXT.INC," _
"HTTPFILT.INC,HTTPREQUEST.INC,HTTPREQUESTID.INC,HTTPTRACE.INC,HXDS.INC,HXVZ.INC,IACCESS.INC,IADS.INC,ICFTYPES.INC,ICM.INC," _
"ICMPAPI.INC,ICONTACT.INC,ICONTACTPROPERTIES.INC,IDISPIDS.INC,IEDIAL.INC,IEPMAPI.INC,IEXTAG.INC,IFDEF.INC,IFMIB.INC,IIIS.INC," _
"IIISEXT.INC,IIMGCTX.INC,IISCNFG.INC,IISRSTA.INC,IL21DEC.INC,IMAGEHLP.INC,IMAGETRANSCODE.INC,IMAPI.INC,IMAPI2.INC,IMAPI2ERROR.INC," _
"MAPI2FS.INC,IMAPI2FSERROR.INC,IMAPIERROR.INC,IME.INC,IMESSAGE.INC,IMM.INC,IN6ADDR.INC,INADDR.INC,INETREG.INC,INETSDK.INC," _
"INITCTRL.INC,INITGUID.INC,INPUTSCOPE.INC,INTSAFE.INC,INTSHCUT.INC,IO.INC,IOEVENT.INC,IPADDRESSCTRL.INC,IPEXPORT.INC,IPHLPAPI.INC," _
"IPIFCONS.INC,IPINFOID.INC,IPMIB.INC,IPMSP.INC,IPRTRMIB.INC,IPTYPES.INC,ISGUIDS.INC,ISOLATION.INC,ISYSMON.INC,IVALIDATOR.INC," _
"IVEHANDLER.INC,IWSTDEC.INC,JETOLEDB.INC,KNOWNFOLDERS.INC,KSUUIDS.INC,KTMTYPES.INC,L2CMN.INC,LAUXLIB.INC,LIMITS.INC,LISTBOXCTRL.INC," _
"LISTVIEWCTRL.INC,LM.INC,LMACCESS.INC,LMALERT.INC,LMAPIBUF.INC,LMAT.INC,LMAUDIT.INC,LMCONFIG.INC,LMCONS.INC,LMDFS.INC,LMERR.INC," _
"LMERRLOG.INC,LMJOIN.INC,LMMSG.INC,LMREMUTL.INC,LMREPL.INC,LMSERVER.INC,LMSHARE.INC,LMSNAME.INC,LMSTATS.INC,LMSVC.INC,LMUSE.INC," _
"LMUSEFLG.INC,LMWKSTA.INC,LOADPERF.INC,LOCALE.INC,LOCKING.INC,LOGPARSER.INC,LOWLEVELMONITORCONFIGURATIONAPI.IN,LUA.INC,LUA51.INC," _
"LUACONF.INC,LUALIB.INC,LZEXPAND.INC,MAGNIFICATION.INC,MALLOC.INC,MAPI.INC,MAPICODE.INC,MAPIDEFS.INC,MAPIFORM.INC,MAPIGUID.INC," _
"MAPIHOOK.INC,MAPISPI.INC,MAPITAGS.INC,MAPIUTIL.INC,MAPIVAL.INC,MAPIWZ.INC,MAPIX.INC,MATH.INC,MBCTYPE.INC,MBSTRING.INC,MCI32.INC," _
"MCIAVI.INC,MCIAVI32.INC,MCX.INC,MDHCP.INC,MDI32.INC,MEDIAOBJ.INC,MEMORY.INC,MERGEMOD.INC,MFAPI.INC,MFERROR.INC,MFIDL.INC,MFOBJECTS.INC," _
"MFTRANSFORM.INC,MGMTAPI.INC,MILEFFECTS.INC,MIMEDISP.INC,MIMEINFO.INC,MIMEOLE.INC,MIXEROCX.INC,MLANG.INC,MMC.INC,MMCOBJ.INC," _
"MMDEVICEAPI.INC,MMREG.INC,MMSTREAM.INC,MMSYSTEM.INC,MONTHCALCTRL.INC,MPCONFIG.INC,MPEG2BITS.INC,MPEG2DATA.INC,MPEG2ERROR.INC," _
"MPEG2PSIPARSER.INC,MPEG2STRUCTS.INC,MPEGTYPE.INC,MPRAPI.INC,MPRERROR.INC,MQ.INC,MQOAI.INC,MSAATEXT.INC,MSACM.INC,MSACMDLG.INC,MSADCF.INC," _
"MSADCO.INC,MSADODC.INC,MSBIND.INC,MSCAL.INC,MSCAT.INC,MSCHAPP.INC,MSCHART.INC,MSCLUS.INC,MSCOMCT2.INC,MSCOMCTL.INC,MSCOMDLG.INC," _
"MSCOMM32.INC,MSCOREE.INC,MSCORLIB20.INC,MSDADC.INC,MSDAGUID.INC,MSDASC.INC,MSDASQL.INC,MSDATGRD.INC,MSDATLST.INC,MSDATSRC.INC," _
"MSDELTA.INC,MSFEEDS.INC,MSFEEDSID.INC,MSFLXGRD.INC,MSHFLXGD.INC,MSHTMCID.INC,MSHTMHST.INC,MSHTML.INC,MSHTMLC.INC,MSIDEFS.INC," _
"MSIEFTP.INC,MSINET.INC,MSJETOLEDB.INC,MSMAPI32.INC,MSMASK.INC,MSMD.INC,MSO10.INC,MSO11.INC,MSOEAPI.INC,MSOSOAP30.INC,MSRDC.INC," _
"MSRDC20.INC,MSRDO20.INC,MSSCRIPT.INC,MSSIP.INC,MSSOAP1.INC,MSSOAP30.INC,MSSTDFMT.INC,MSTASK.INC,MSTCPIP.INC,MSTIME.INC,MSTIMEID.INC," _
"MSVIDCTL.INC,MSWEBDVD.INC,MSWINSCK.INC,MSWMDM.INC,MSWSOCK.INC,MSWSOCKDEF.INC,MSXML.INC,MSXML2DID.INC,MSXMLDID.INC,MTSADMIN.INC," _
"MULTINFO.INC,MXDC.INC,NATUPNP.INC,NB30.INC,NCRYPT.INC,NETCON.INC,NETERR.INC,NETFW.INC,NETIOAPI.INC,NETLISTMGR.INC,NLDEF.INC," _
"NSERROR.INC,NSPLAY.INC,NSSCORE.INC,NTDDNDIS.INC,NTSECAPI.INC,NTSTATUS.INC,OAIDL.INC,OBJBASE.INC,OBJIDL.INC,OBJSAFE.INC,OBJSEL.INC," _
"OCIDL.INC,OCMM.INC,ODBC.INC,ODBCINST.INC,ODBCSS.INC,OLE2.INC,OLE2UTILS.INC,OLEACC.INC,OLEAUTO.INC,OLECON.INC,OLECONEX.INC," _
"OLECTL.INC,OLEDB.INC,OLEDB32.INC,OLEDBDEP.INC,OLEDBDM.INC,OLEDBERR.INC,OLEDBGUID.INC,OLEDLG.INC,OLEIDL.INC,OPENAL32.INC,OPENGL.INC," _
"OPENGL32.INC,OUTLCTL.INC,OWC10.INC,OWC11.INC,PAGERCTRL.INC,PATCHAPI.INC,PATCHWIZ.INC,PBFORMS.INC,PCIPROP.INC,PDH.INC,PDHMSG.INC," _
"PERFLIB.INC,PERHIST.INC,PERSIST.INC,PHYSICALMONITORENUMERATIONAPI.INC,PICCLIP.INC,PLA.INC,PORTABLEDEVICE.INC,PORTABLEDEVICEAPI.INC," _
"PORTABLEDEVICETYPES.INC,POWRPROF.INC,PRNASNOT.INC,PRNTVPT.INC,PROFINFO.INC,PROGRESSBARCTRL.INC,PROPAPI.INC,PROPIDL.INC,PROPKEY.INC," _
"PROPKEYDEF.INC,PROPSYS.INC,PROPVARUTIL.INC,PRSHT.INC,PSAPI.INC,PSTORE.INC,QEDIT.INC,QNETWORK.INC,QOS.INC,QOS2.INC,QOSPOL.INC," _
"QOSSP.INC,RAS.INC,RASDLG.INC,RASERROR.INC,RATINGS.INC,RDPENCOMAPI.INC,REASON.INC,REBARCTRL.INC,RECGUIDS.INC,RECONCIL.INC,REGBAG.INC," _
"REGEXP.INC,REGSTR.INC,REND.INC,RENDEZVOUSSESSION.INC,RESTARTMANAGER.INC,RICHEDIT.INC,RICHEDITCTRL.INC,RICHOLE.INC,RICHTX32.INC," _
"RNDERR.INC,ROUTPROT.INC,RPC.INC,RPCASYNC.INC,RPCDCE.INC,RPCDCEP.INC,RPCNSI.INC,RPCNSIP.INC,RTCCORE.INC,RTCERR.INC,SAPI.INC,SAPI51.INC," _
"SAPIUTILS.INC,SBE.INC,SCANPROFILEUI.INC,SCARDERR.INC,SCARDSSP.INC,SCESVC.INC,SCHANNEL.INC,SCHEDULE.INC,SCHNLSP.INC,SCILEXER.INC," _
"SCINTILLA.INC,SCROLLBARCTRL.INC,SCRRUN.INC,SDDL.INC,SDKDDKVER.INC,SDOIAS.INC,SDPBLB.INC,SDPERR.INC,SEARCH.INC,SEARCHAPI.INC,SECEXT.INC," _
"SECURITY.INC,SEGMENT.INC,SENS.INC,SENSAPI.INC,SENSEVTS.INC,SERVPROV.INC,SETUPAPI.INC,SFC.INC,SHAPPMGR.INC,SHDISPID.INC,SHELLAPI.INC," _
"SHERRORS.INC,SHFOLDER.INC,SHIMGDATA.INC,SHLDISP.INC,SHLGUID.INC,SHLOBJ.INC,SHLWAPI.INC,SHOBJIDL.INC,SHTYPES.INC,SIMPDATA.INC," _
"SIMPDC.INC,SIPBASE.INC,SISBKUP.INC,SLERROR.INC,SLIDDEFS.INC,SLPUBLIC.INC,SNMP.INC,SOFTPUB.INC,SPAPIDEF.INC,SPERROR.INC,SPORDER.INC," _
"SQL.INC,SQLDMO.INC,SQLEXT.INC,SQLNCLI.INC,SQLOLEDB.INC,SQLTYPES.INC,SQLUCODE.INC,SRRESTOREPTAPI.INC,SRV.INC,SSPI.INC,STAT.INC," _
"STATICCTRL.INC,STATUSBARCTRL.INC,STDIO.INC,STDLIB.INC,STI.INC,STIERR.INC,STIREG.INC,STM.INC,STORPROP.INC,STREAMCACHE.INC," _
"STREAMDESCRIPTION.INC,STRING.INC,STRMIF.INC,STRONGNAME.INC,STRSAFE.INC,STRUCTUREDQUERY.INC,SUBAUTH.INC,SYNCMGR.INC,SYSINFO.INC," _
"SYSLINKCTRL.INC,SYSTEM20.INC,TABCTL32.INC,TABCTRL.INC,TAPI.INC,TAPI3.INC,TAPI3ERR.INC,TAPI3IF.INC,TASKDIALOGCTRL.INC,TASKSCHD.INC," _
"TBS.INC,TCERROR.INC,TCGUID.INC,TCPESTATS.INC,TCPIOCTL.INC,TCPMIB.INC,TDH.INC,TERMMGR.INC,TEXTSERV.INC,TEXTSTOR.INC,THUMBCACHE.INC," _
"TIME.INC,TIMEB.INC,TLBINF32.INC,TLHELP32.INC,TLOGSTG.INC,TNEF.INC,TOM.INC,TOOLBARCTRL.INC,TOOLTIPCTRL.INC,TRACKBARCTRL.INC,TRAFFIC.INC," _
"TRANSACT.INC,TREEVIEWCTRL.INC,TRIEDCID.INC,TRIEDIID.INC,TRIEDIT.INC,TSATTRS.INC,TSUSEREX.INC,TUNER.INC,TVOUT.INC,TVRATINGS.INC," _
"TXCOORD.INC,TXDTC.INC,TXLOGPUB.INC,UDPMIB.INC,UIAUTOMATIONCORE.INC,UIAUTOMATIONCOREAPI.INC,UNKNWN.INC,UPDOWNCTRL.INC,UPNP.INC," _
"UPNPHOST.INC,URLHIST.INC,URLMON.INC,USERENV.INC,USP10.INC,UTIME.INC,UUIDS.INC,UXTHEME.INC,VARUTILS.INC,VBINTERF.INC,VCR.INC,VDSLUN.INC," _
"VERERROR.INC,VFW.INC,VFWMSGS.INC,VIDEOACC.INC,VMR9.INC,VPTYPE.INC,VSADMIN.INC,VSHELP.INC,VSHELP80.INC,VSMGMT.INC,VSPROV.INC,VSS.INC," _
"VSSERROR.INC,VSSTYLE.INC,VSSYM32.INC,WAB.INC,WABAPI.INC,WBEMADS.INC,WBEMCLI.INC,WBEMDISP.INC,WBEMPROV.INC,WCMCONFIG.INC,WCMERRORS.INC," _
"WCT.INC,WERAPI.INC,WFEXT.INC,WGLEXT.INC,WIA.INC,WIAAUT.INC,WIADEF.INC,WIADEVD.INC,WIASCANPROFILES.INC,WIASCR.INC,WIAVIDEO.INC," _
"WIAWSDSC.INC,WIN32API.INC,WINBASE.INC,WINBER.INC,WINCODEC.INC,WINCON.INC,WINCRED.INC,WINCRYPT.INC,WINCTRL.INC,WINDEF.INC,WINDNS.INC," _
"WINDOT11.INC,WINDOWS.INC,WINDOWSDEFENDER.INC,WINDOWSSIDESHOW.INC,WINDOWSSIDESHOWAPI.INC,WINDOWSX.INC,WINEFS.INC,WINERROR.INC," _
"WINEVT.INC,WINFAX.INC,WINGDI.INC,WINHTTP.INC,WININET.INC,WININETI.INC,WINIOCTL.INC,WINLDAP.INC,WINMETA.INC,WINNETWK.INC," _
"WINNLS.INC,WINNLS32.INC,WINNT.INC,WINPERF.INC,WINREG.INC,WINSAFER.INC,WINSATCOMINTERFACEI.INC,WINSCARD.INC,WINSMCRD.INC," _
"WINSNMP.INC,WINSOCK.INC,WINSOCK2.INC,WINSPOOL.INC,WINSVC.INC,WINSXS.INC,WINTRUST.INC,WINUSER.INC,WINUTILS.INC,WINVER.INC," _
"WINWLX.INC,WLANAPI.INC,WLANIHVTYPES.INC,WLANTYPES.INC,WLCLIENT.INC,WMCONTAINER.INC,WMDRMSDK.INC,WMDXVA.INC,WMI.INC,WMIAPI.INC," _
"WMISTR.INC,WMIUTILS.INC,WMNETSOURCECREATOR.INC,WMP.INC,WMPDEVICES.INC,WMPIDS.INC,WMPPLUG.INC,WMPREALESTATE.INC,WMPSERVICES.INC," _
"WMSBASICPLUGIN.INC,WMSBUFFER.INC,WMSCATID.INC,WMSCONTEXT.INC,WMSCONTEXTNAMES.INC,WMSDATAPATH.INC,WMSDEFS.INC,WMSDK.INC,WMSDKIDL.INC," _
"WMSEVENT.INC,WMSEVENTLOG.INC,WMSHEADERLINE.INC,WMSINCOMINGCOUNTERS.INC,WMSINTERNALADMINNETSOURCE.INC,WMSNAMEDVALUES.INC,WMSPACKET.INC," _
"WMSPLAYLISTPARSER.INC,WMSPLUGIN.INC,WMSPROXY.INC,WMSSERVER.INC,WMSSERVERTYPELIB.INC,WMSXMLDOMEXTENSIONS.INC,WPAPI.INC,WPAPIMSG.INC," _
"WPCRSMSG.INC,WPFTPMSG.INC,WPPSTMSG.INC,WPTYPES.INC,WPWIZMSG.INC,WS2BTH.INC,WS2DEF.INC,WS2IPDEF.INC,WS2TCPIP.INC,WSCAPI.INC,WSHCON.INC," _
"WSHEXT.INC,WSHOM.INC,WSHREMOTE.INC,WSRM.INC,WTSAPI32.INC,WTYPES.INC,WUAPI.INC,XBLKLD4.INC,XCMC.INC,XCMCEXT.INC,XCMCMSX2.INC,XCMCMSXT.INC," _
"XENROLL.INC,XINPUT.INC,XLCALL.INC,XMLLITE.INC,XOLEHLP.INC,"
Title: zXref (combo version)
Post by: Patrice Terrier on August 17, 2009, 04:07:36 PM
Here is the combo version that would create one single combined source code file, embedding all the include files that are not "standard".

Please check it, and let me know if it works fine by you.

If everything work as expected, the next step would be to strip out unused code from the combo version.

Note: The resulting combined file is prefixed with an "@"


'   // Build "combined source code" using recursivity
   CALL zSetCTLText(GetDlgItem(hWnd, %IDC_HELPER), "Creating single combined source code file")
   FileNameStr = "@" + FileNameStr
   CALL zUseWriteName(FilePathStr + FileNameStr, 1)
   CALL BuildSingleFile(gsFiles(0))
   zWrite("")


...
Title: Re: zXref (work in progress)
Post by: Trento Castricone on August 17, 2009, 04:19:03 PM
Patrice

The following is wrong:
   ghListView is defined as a Global
   ghListView1 is defined as a Local
   Pid is defined as a Global
   Pid1 is defined as a Local
================================================================================
GLOBAL/LOCAL MIX - WARNING!
Following global variable name(s) exist in both global and local
form. While the compiler allows this, special care must be taken
to avoid hard-to-find errors. Please check them out carefully.
--------------------------------------------------------------------------------
ghListView                                         [Find-It Pro.bas] : 301
   local in Find-It Pro.bas : 4949
Pid                                                [Find-It Pro.bas] : 346
   local in Find-It Pro.bas : 1816

================================================================================

All else seems to be correct.
Title: Re: zXref (work in progress)
Post by: Patrice Terrier on August 17, 2009, 04:23:37 PM
Trento,

So far i have not changed this part of Börje's code, the report is wrong because the local and global variables are using the same radical.
The name detection must be enforced.

...
Title: Re: zXref (work in progress)
Post by: Trento Castricone on August 17, 2009, 04:38:37 PM
Patrice

The Combo version works.

@Find-it.exe    381 Kb
  Find-it.exe     381 kb

@Find-it.bas     511 kb
   Find-it.bas     223 kb

I was surprised that the exe's came out the same size.
'
In the previous post.
I am not sure what you mean by:  'The name detection must be enforced."
Title: Re: zXref (work in progress)
Post by: Bud Meyer on August 17, 2009, 06:10:47 PM
The build in the first post seems to work ok with no problems. :)

The 'combo' build tells me lots of include files are missing and makes the 0 bytes files again.
Title: Re: zXref (work in progress)
Post by: Patrice Terrier on August 17, 2009, 06:16:23 PM
Trento,

The actual combo version should produce exactly the same EXE size, because the code as not been yet cleaned up.

However the main source and the include are tied together inside the same file, except for "standard" includes.

The important thing is to make sure that they are copied together, in the good order (thanks to recursivity), or they won't compile.
This is, what must be checked, and if this works fine, then i could start to remove the unused code to produce smaller EXE.

The "name detection must be enforced", because both Pid and Pid1 begins with the same radical, and same for ghListView and ghListView1.
"aaa" and "aaab" would also produce the same result, etc.
This will be solved in the next build, thanks for the feedback.

...

Title: Re: zXref (work in progress)
Post by: Patrice Terrier on August 17, 2009, 07:01:31 PM
Bud,

If it makes the 0 byte again, this because it was unable to resolve the path of the sFileName in the recursive DoGetIncFiles.

Thus: IF zFOpen((sFileName), 0, 2, hFile) = 0 THEN
try to open a file that doesn't exist in the EXE folder, causing the creation of the 0 byte file.

Try to edit the zXref.cfg file.

Added:
Or add this into DoGetIncFiles

'// Get all included files into array
SUB DoGetIncFiles(BYVAL sFileName AS STRING)
    LOCAL K, One, hFile, ci, p, fc, nFound, nASC AS LONG
    LOCAL pbLetter AS BYTE PTR, sWork, sTemp, sTemp2, sLineStr AS STRING

'   // Include only once!
    sTemp = PATHNAME$(NAMEX, sFileName)
    ARRAY SCAN gsIncludes(), FROM 1 TO LEN(sTemp), COLLATE UCASE, = PATHNAME$(NAMEX, sFileName), TO nFound
    IF nFound THEN EXIT SUB

    IF ISFILE(sFileName) THEN
       IF zFOpen((sFileName), 0, 2, hFile) = 0 THEN
          sTemp = SPACE$(zFLof(hFile))
          CALL zFGet(hFile, sTemp)
          CALL zFClose(hFile)
       END IF
    END IF
    IF LEN(sTemp) < 2 THEN
       MSGBOX sFileName + $cr + $cr + "Selected file could not be found!",,"Error!"
       EXIT SUB
    END IF

...

Title: Re: zXref (work in progress)
Post by: Bud Meyer on August 17, 2009, 07:51:29 PM
I tried adding the ISFILE block, but still get the msgs/0 byte files.

This is my SCANPATH:
"SCANPATH:   C:\PBWin90\WinAPI;C:\Program Files (x86)\ProgramName\SubFolder\!AnotherSubFolder" ' Use ; as delimiter

FYI: the main source file is one folder further..
C:\Program Files (x86)\ProgramName\SubFolder\!AnotherSubFolder\MainCodeFolder
Title: Re: zXref (work in progress)
Post by: Patrice Terrier on August 17, 2009, 08:51:36 PM
Ok, I shall try using the same folders, but you like playing with the VISTA UAC don't you? ;D
Title: Re: zXref (work in progress)
Post by: Patrice Terrier on August 17, 2009, 09:11:51 PM
Because on my computer the UAC is being turned on, i can't create or copy a file in these folders from zXref.

I shall make a try using a standard folder, like this:
C:\My personnal program folder\ProgramName\SubFolder\!AnotherSubFolder
Title: Re: zXref (work in progress)
Post by: Bud Meyer on August 17, 2009, 09:49:32 PM
Quote from: Patrice Terrier on August 17, 2009, 08:51:36 PM
Ok, I shall try using the same folders, but you like playing with the VISTA UAC don't you? ;D
;D
I still have it enabled, but long ago I gave my user account write permission to that folder, so it never nags me.
Title: Re: zXref (work in progress)
Post by: Bud Meyer on August 17, 2009, 10:41:05 PM
Yes, that fixed the errors and 0 byte files, but the @ file does not compile due to errors. The first error was because of a missing "DO" line from a DO...LOOP block (very strange that it went missing), so I put it back, and then the next errors were due to missing ")" at the end of a sub param list:

I got this:
SUB WindowResizeAdjustControls ( _
    BYVAL lParam AS DWORD, _
    BYREF CtrlInfo() AS ADJUSTCONTROLINFO _


instead of this:
SUB WindowResizeAdjustControls ( _
    BYVAL lParam AS DWORD, _
    BYREF CtrlInfo() AS ADJUSTCONTROLINFO _
    )


Maybe I'm strange for putting it on a separate line by itself, but that's no reason to delete it!  :P

Anyway I put them back and it compiled.  8)
Title: Re: zXref (work in progress)
Post by: Patrice Terrier on August 17, 2009, 11:17:56 PM
Bud,

What text editor are you using, does there is always a CRLF at the end of each line, or sometimes just a CR, like in linux file?

...
Title: Re: zXref (work in progress)
Post by: Bud Meyer on August 17, 2009, 11:28:52 PM
I edited zXref.cfg with Notepad, and afaik all of my bas and inc files were edited with PBEdit.

If you think there might be a line break issue, perhaps you could replace them internally?
1. Replace all $CRLFs with "ENDOFLINE" (or some unique "end of line" code)
2. Replace all $CRs with "ENDOFLINE"
3. Replace all $LFs with "ENDOFLINE"
4. Replace all "ENDOFLINE" with $CRLFs
That way it wouldn't matter what the line breaks start off as, they will all end up the same.
Title: Re: zXref (new combo version)
Post by: Patrice Terrier on August 18, 2009, 12:44:47 PM
I have posted a new version (ZIP is attached to the first post of this thread), that uses another algo to merge the main source and the include files altogether.

I hope this one will work for everybody, then i could create the final cleaned source code that would decrease the size of the EXE, removing all unused SUB(s) and FUNCTION(s).

...
Title: Re: zXref (work in progress)
Post by: Trento Castricone on August 18, 2009, 02:01:52 PM
Works here.
Title: Re: zXref (work in progress)
Post by: Patrice Terrier on August 18, 2009, 02:31:42 PM
Trento-- Ok, thanks!

What about the ohers?
Title: Re: zXref ( I Did It ! )
Post by: Patrice Terrier on August 18, 2009, 05:20:36 PM
I have been able to compile my first Cleaned file, produced by zXref.

I took my Gallery example and i cut the EXE size from 127488 bytes down to 117248 bytes  ;D

...
Title: Re: zXref (work in progress)
Post by: Bud Meyer on August 18, 2009, 05:35:00 PM
No problems here.  8)

Good work! I look forward to being able to trim out unneeded things. A smaller size is nice, and it would be great if it let me compile super-quick like incLean did.   :D
Title: Re: zXref (work in progress)
Post by: Patrice Terrier on August 18, 2009, 05:40:33 PM
Here is the little magic, that creates the final cleaned code


SUB BuildCleanVersion(bArray() AS LONG)
   LOCAL zFileName AS ASCIIZ * %MAX_PATH, sBuf AS STRING
   LOCAL nDone, nLine, nRemoved AS LONG
   nDone = 0: nLine = 0: nRemoved = 0
   zFileName = gsFilePath + gsFileName
   CALL zUseBuildName(gsFilePath + "$" + MID$(gsFileName, 2, LEN(gsFileName) - 1), 1)
   DO WHILE nDone = 0
      sBuf = zBufin(zFileName, nDone)
      IF nDone = 0 THEN
         nLine += 1
         IF BIT(bArray(0), nLine) = 0 THEN
            zBuild(sBuf + $CRLF, 1)
         ELSE
            nRemoved +=1 ' Removed line counter
         END IF
      END IF
   LOOP
   zBuild("", 0)
END SUB


Short isn't it?

...
Title: Done!
Post by: Patrice Terrier on August 18, 2009, 07:35:16 PM
Done!

See the first post of this thread.

...
Title: Re: zXref (version 1.03)
Post by: Trento Castricone on August 18, 2009, 08:08:52 PM
Patrice

Works !

I included the lists below for your reference only.
Savings on this project was:
From: 382K
To:    379k

Thanks much for all your work . . .


================================================================================
My CFG file:
"SCANPATH:   C:\PBWin90\WinAPI_114\private" ' Use ; as delimiter
================================================================================

================================================================================
XRef report: @FIND-IT PRO.BAS + include files. Generated 08-18-2009, 13:44:15
22236 lines scanned in 0.827 seconds (1613253 lines/minute)
================================================================================
MAIN + INCLUDE FILES
--------------------------------------------------------------------------------
C:\PDSU\NEW VERSION\@Find-It Pro.bas                      [Main source file]
C:\PBWin90\WinAPI\COMMCTRL.INC (not scanned)              [@Find-It Pro.bas]
C:\PBWin90\WinAPI\GDIPLUSMEM.INC (not scanned)            [@Find-It Pro.bas]
C:\PBWin90\WinAPI\GDIPLUSENUMS.INC (not scanned)          [@Find-It Pro.bas]
C:\PBWin90\WinAPI\GDIPLUSTYPES.INC (not scanned)          [@Find-It Pro.bas]
C:\PBWin90\WinAPI\GDIPLUSINIT.INC (not scanned)           [@Find-It Pro.bas]
C:\PBWin90\WinAPI\GDIPLUSPIXELFORMATS.INC (not scanned)   [@Find-It Pro.bas]
C:\PBWin90\WinAPI\GDIPLUSCOLOR.INC (not scanned)          [@Find-It Pro.bas]
C:\PBWin90\WinAPI\GDIPLUSMETAHEADER.INC (not scanned)     [@Find-It Pro.bas]
C:\PBWin90\WinAPI\GDIPLUSIMAGING.INC (not scanned)        [@Find-It Pro.bas]
C:\PBWin90\WinAPI\GDIPLUSCOLORMATRIX.INC (not scanned)    [@Find-It Pro.bas]
C:\PBWin90\WinAPI\GDIPLUSEFFECTS.INC (not scanned)        [@Find-It Pro.bas]
C:\PBWin90\WinAPI\GDIPLUSFLAT.INC (not scanned)           [@Find-It Pro.bas]
C:\PBWin90\WinAPI\COMMCTRL.INC (not scanned)              [@Find-It Pro.bas]
================================================================================

================================================================================
PowerBASIC for Windows
PB/Win  Version 9.01
Copyright (c) 1996-2009 PowerBasic Inc.
Venice, Florida USA
All Rights Reserved

Primary source:  C:\PDSU\NEWVER~1\Find-It Pro.bas   {151430 total lines}
Target compilation:  Find-It Pro.exe
Compile time:  3.9 seconds, at 2329692 lines/minute

118604 bytes compiled code, 67774 bytes RTLibrary,
9156 bytes string literals, and 17492 bytes dgroup.
Executable stack size:  1048576 bytes.
Disk image: 390656 bytes   Memory image: 94422 bytes.

Component Files:
----------------
C:\PDSU\NEWVER~1\Find-It Pro.bas
C:\PBWIN90\WINAPI\INITCTRL.INC
C:\PBWIN90\WINAPI~3\COMMCTRL.INC
C:\PBWIN90\WINAPI~3\WINDOWS.INC
C:\PBWIN90\WINAPI~3\WINDEF.INC
C:\PBWIN90\WINAPI~3\WINNT.INC
C:\PBWIN90\WINAPI~3\CTYPE.INC
C:\PBWIN90\WINAPI~3\BASETSD.INC
C:\PBWIN90\WINAPI~3\GUIDDEF.INC
C:\PBWIN90\WINAPI~3\KTMTYPES.INC
C:\PBWIN90\WINAPI~3\WINERROR.INC
C:\PBWIN90\WINAPI~3\WINBASE.INC
C:\PBWIN90\WINAPI~3\WINGDI.INC
C:\PBWIN90\WINAPI~3\WINUSER.INC
C:\PBWIN90\WINAPI~3\TVOUT.INC
C:\PBWIN90\WINAPI~3\WINNLS.INC
C:\PBWIN90\WINAPI~3\WINCON.INC
C:\PBWIN90\WINAPI~3\WINVER.INC
C:\PBWIN90\WINAPI~3\WINREG.INC
C:\PBWIN90\WINAPI~3\WTYPES.INC
C:\PBWIN90\WINAPI~3\REASON.INC
C:\PBWIN90\WINAPI~3\WINNETWK.INC
C:\PBWIN90\WINAPI~3\CDERR.INC
C:\PBWIN90\WINAPI~3\DDE.INC
C:\PBWIN90\WINAPI~3\DDEML.INC
C:\PBWIN90\WINAPI~3\DLGS.INC
C:\PBWIN90\WINAPI~3\LZEXPAND.INC
C:\PBWIN90\WINAPI~3\MMSYSTEM.INC
C:\PBWIN90\WINAPI~3\NB30.INC
C:\PBWIN90\WINAPI~3\RPC.INC
C:\PBWIN90\WINAPI~3\RPCDCE.INC
C:\PBWIN90\WINAPI~3\RPCDCEP.INC
C:\PBWIN90\WINAPI~3\RPCNSI.INC
C:\PBWIN90\WINAPI~3\RPCASYNC.INC
C:\PBWIN90\WINAPI~3\SHELLAPI.INC
C:\PBWIN90\WINAPI~3\WINPERF.INC
C:\PBWIN90\WINAPI~3\WINSPOOL.INC
C:\PBWIN90\WINAPI~3\WINDOWSX.INC
C:\PBWIN90\WINAPI~3\OBJIDL.INC
C:\PBWIN90\WINAPI~3\OLE2.INC
C:\PBWIN90\WINAPI~3\OBJBASE.INC
C:\PBWIN90\WINAPI~3\UNKNWN.INC
C:\PBWIN90\WINAPI~3\OAIDL.INC
C:\PBWIN90\WINAPI~3\CGUID.INC
C:\PBWIN90\WINAPI~3\URLMON.INC
C:\PBWIN90\WINAPI~3\OLEIDL.INC
C:\PBWIN90\WINAPI~3\SERVPROV.INC
C:\PBWIN90\WINAPI~3\MSXML.INC
C:\PBWIN90\WINAPI~3\PROPIDL.INC
C:\PBWIN90\WINAPI~3\OLEAUTO.INC
C:\PBWIN90\WINAPI_114\PRIVATE\DATE ROUTINES.INC
C:\PBWIN90\WINAPI_114\GDIPLUS.INC
C:\PBWIN90\WINAPI~3\GDIPLUSMEM.INC
C:\PBWIN90\WINAPI~3\GDIPLUSENUMS.INC
C:\PBWIN90\WINAPI~3\GDIPLUSTYPES.INC
C:\PBWIN90\WINAPI~3\GDIPLUSINIT.INC
C:\PBWIN90\WINAPI~3\GDIPLUSPIXELFORMATS.INC
C:\PBWIN90\WINAPI~3\GDIPLUSCOLOR.INC
C:\PBWIN90\WINAPI~3\GDIPLUSMETAHEADER.INC
C:\PBWIN90\WINAPI~3\GDIPLUSIMAGING.INC
C:\PBWIN90\WINAPI~3\GDIPLUSCOLORMATRIX.INC
C:\PBWIN90\WINAPI~3\GDIPLUSFLAT.INC
C:\PBWIN90\WINAPI_114\LISTVIEWCTRL.INC
C:\PBWIN90\WINAPI_114\WININET.INC
================================================================================
Title: Re: zXref (version 1.03)
Post by: Bud Meyer on August 18, 2009, 08:25:53 PM
Almost there..

This block of code went missing from $CleanedSourceFile:  (Odd that a single, entire function would go missing.)
CALLBACK FUNCTION BrowseForFolderProc () AS LONG
   IF CBMSG = %BFFM_INITIALIZED THEN
       DIALOG SEND CBHNDL, %BFFM_SETSELECTION, %TRUE, CBLPARAM
   ELSEIF CBMSG = %BFFM_SELCHANGED THEN
       DIM zBuffer AS ASCIIZ * %MAX_PATH
       CALL SHGetPathFromIDList(BYVAL CBWPARAM, zBuffer)
       'IF ISFALSE CBWPARAM OR ISFALSE LEN(zBuffer) OR ISFALSE (GETATTR(zBuffer) AND %SUBDIR) OR MID$(zBuffer,2,1) <> ":" THEN  ' Not a local or mapped drive
       '    DIALOG SEND CBHNDL, %BFFM_ENABLEOK, %FALSE, %FALSE
       'ELSEIF (GETATTR(zBuffer) AND %SYSTEM) AND RIGHT$(zBuffer,2) <> ":\" THEN ' exclude system folders, allow root directories
       '    DIALOG SEND CBHNDL, %BFFM_ENABLEOK, %FALSE, %FALSE
       'END IF
   END IF
END FUNCTION  


So I pasted it manually, and it compiled, but my program immediately crashes when I try to run it.   :(

The @ComboSourceFile still compiles and runs correctly.
Title: Re: zXref (version 1.03)
Post by: Patrice Terrier on August 18, 2009, 09:34:08 PM
I do not have DDT code myself, thus i have checked only with plain SDK.

CALLBACK FUNCTION is typical DDT ...

You will have to give me an example, or look yourself into the code.

...
Title: Re: zXref (version 1.03)
Post by: Bud Meyer on August 18, 2009, 09:48:07 PM
now that you point it out, I realized maybe it shouldn't have been a CALLBACK anyway, so I changed it to this:
FUNCTION BrowseForFolderProc (BYVAL hWnd AS LONG, BYVAL wMsg AS LONG, BYVAL wParam AS LONG, BYVAL lpData AS LONG) AS LONG
    IF wMsg = %BFFM_INITIALIZED THEN
        DIALOG SEND hWnd, %BFFM_SETSELECTION, %TRUE, lpData
    ELSEIF wMsg = %BFFM_SELCHANGED THEN
        DIM zBuffer AS ASCIIZ * %MAX_PATH
        CALL SHGetPathFromIDList(BYVAL wParam, zBuffer)
        'IF ISFALSE CBWPARAM OR ISFALSE LEN(zBuffer) OR ISFALSE (GETATTR(zBuffer) AND %SUBDIR) OR MID$(zBuffer,2,1) <> ":" THEN  ' Not a local or mapped drive
        '    DIALOG SEND CBHNDL, %BFFM_ENABLEOK, %FALSE, %FALSE
        'ELSEIF (GETATTR(zBuffer) AND %SYSTEM) AND RIGHT$(zBuffer,2) <> ":\" THEN ' exclude system folders, allow root directories
        '    DIALOG SEND CBHNDL, %BFFM_ENABLEOK, %FALSE, %FALSE
        'END IF
    END IF
END FUNCTION


However, it's still missing from the $SourceFile.

And looking into the crashing problem, it turns out that many of my (non-DDT) functions have been omitted as well. It appears that most/all of them are EXPORTed (it's a DLL), so maybe zXref doesn't take those into account..
Title: Re: zXref (version 1.03)
Post by: Paul Squires on August 18, 2009, 09:51:09 PM
Hi Patrice,

For fun, I ran zXref on the FireFly3 source code (241094 lines) and it created a 4.8 meg main file in about 38 seconds. There was not much to clean in the source code so the resulting FireFly3.exe only went from 2397 bytes to 2393 bytes. The best thing was that the source compiled without any modifications or errors. Pretty cool.
Title: Re: zXref (version 1.03)
Post by: Patrice Terrier on August 18, 2009, 09:53:01 PM
METHOD and OOP have not been done either.

Indeed EXPORTED SUB or FUNCTION should not be removed it is a mistake of my own.

...
Title: Re: zXref (version 1.03)
Post by: José Roca on August 18, 2009, 10:01:39 PM
 
Patrice,

The exclusion of the function BrowseForFolderProc must be because, being a callback function, it is not directly called from code. You must also take into account that functions pointed using CODEPTR must be included.
Title: Re: zXref (version 1.03)
Post by: Patrice Terrier on August 18, 2009, 10:04:18 PM
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.
Title: Re: zXref (version 1.03)
Post by: Bud Meyer on August 18, 2009, 10:19:33 PM
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..

Title: Re: zXref (version 1.04)
Post by: Patrice Terrier on August 18, 2009, 10:23:26 PM
Yes, editing the CFG file, could help to reduce furthermore un-used code.

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

...
Title: zXref (updated to version 1.04)
Post by: Patrice Terrier on August 18, 2009, 10:25:04 PM
zXref has been updated to version 1.04

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

...
Title: zXref (contributors?)
Post by: Patrice Terrier on August 19, 2009, 10:21:25 AM
The original pbcodec code was the result of a cooperative work.

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

Thank you!

...


Title: zXref (updated to version 1.06)
Post by: Patrice Terrier on August 19, 2009, 09:59:03 PM
zXref version 1.06, has been attached to the first post of this thread.

See History, for further details.

...
Title: Re: zXref (version 1.06)
Post by: Bud Meyer on August 19, 2009, 10:18:15 PM
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.
Title: Re: zXref (version 1.06)
Post by: Patrice Terrier on August 19, 2009, 10:55:07 PM
What about SED or UltraEdit32.

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


Looks like PBEdit is still 16-bit  ;D

...
Title: Re: zXref (version 1.06)
Post by: José Roca on August 19, 2009, 11:00:13 PM
 
It is 32-bit, but uses a custom control, "PBEDIT32".
Title: Re: zXref (inclean)
Post by: Patrice Terrier on August 24, 2009, 10:44:09 AM
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.

...
Title: Re: zXref (PB9 only)
Post by: Patrice Terrier on August 24, 2009, 07:55:22 PM
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?


Title: Re: zXref (version 1.06)
Post by: Paul Squires on August 24, 2009, 10:14:40 PM
I vote for 9+ only. No need living in the past.
Title: Re: zXref (version 1.06)
Post by: Patrice Terrier on August 28, 2009, 10:05:31 AM
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  :-\

...
Title: Re: zXref (version 1.07)
Post by: Patrice Terrier on August 30, 2009, 08:48:07 PM
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.

...

Title: Re: zXref (version 1.06)
Post by: Bud Meyer on August 30, 2009, 10:45:13 PM
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.
Title: Re: zXref (version 1.06)
Post by: Patrice Terrier on August 30, 2009, 11:06:03 PM
PBFORMS.INC

I do not have any code using that one, thus i didn't even think of it.

I have removed the call to zTrace that was used to track down what was going on.

...
Title: Re: zXref (version 1.06)
Post by: Bud Meyer on August 30, 2009, 11:10:13 PM
v1.06 still works fine* for me by the way, and it reduces the compiled size about 4.5KB. :)

*it still omits this function, which I must manually paste in each time:
FUNCTION BrowseForFolderProc (BYVAL hWnd AS LONG, BYVAL wMsg AS LONG, BYVAL wParam AS LONG, BYVAL lpData AS LONG) AS LONG
   IF wMsg = %BFFM_INITIALIZED THEN
       DIALOG SEND hWnd, %BFFM_SETSELECTION, %TRUE, lpData
   ELSEIF wMsg = %BFFM_SELCHANGED THEN
       DIM zBuffer AS ASCIIZ * %MAX_PATH
       CALL SHGetPathFromIDList(BYVAL wParam, zBuffer)
       'IF ISFALSE CBWPARAM OR ISFALSE LEN(zBuffer) OR ISFALSE (GETATTR(zBuffer) AND %SUBDIR) OR MID$(zBuffer,2,1) <> ":" THEN  ' Not a local or mapped drive
       '    DIALOG SEND CBHNDL, %BFFM_ENABLEOK, %FALSE, %FALSE
       'ELSEIF (GETATTR(zBuffer) AND %SYSTEM) AND RIGHT$(zBuffer,2) <> ":\" THEN ' exclude system folders, allow root directories
       '    DIALOG SEND CBHNDL, %BFFM_ENABLEOK, %FALSE, %FALSE
       'END IF
   END IF
END FUNCTION
Title: Re: zXref (version 1.06)
Post by: Patrice Terrier on August 30, 2009, 11:21:55 PM
Bud,

I am sorry, but so far i am only considering the SDK syntax, because i am checking with my own code.

...
Title: zXref (updated to version 1.08)
Post by: Patrice Terrier on August 31, 2009, 06:03:38 PM
The first post of this thread has been updated with the latest version.

It is provided with full source code, for those wanting to let it work with DDT or missing CALLBACK.

It is time now for new contributors to jump in, because my holiday's time left over  :D

The main section that should be enhanced/customized is in BuildSingleFile.

If you make some changes, please post them here with complete source code, for the benefit of the other members of this forum, thank you!

...


Title: zXref (updated to version 1.09)
Post by: Patrice Terrier on September 02, 2009, 07:35:27 PM
Updated to version 1.09.

I have added a new checkbox: "Clean code", to produce either XREF only, or XREF + cleaned code.

The new version is attached to first post of this thread.

...
Title: Re: zXref (version 1.09)
Post by: Jürgen Huhn on September 03, 2009, 11:16:53 AM
Hey Bud!
I just downloaded " zXref " the first Time for me and read about your Problem`s with the SDK-Style.
I will translate your callback "FUNCTION BrowseForFolderProc" from DDT to SDK, so you be able to use it without a Problem...

See ya-- 8)
Title: Re: zXref (version 1.09)
Post by: Jürgen Huhn on September 03, 2009, 01:16:13 PM
Bud!

Already done!

I changed only a few lines and leave the old DDT-Syntax in the Code for you to see the Difference!
you better remove these unused Lines when you`re ready to paste these Functions into your Codes.
Also added two Helper Functions and a new FUNCTION -JH_GetFolder- to fill the BROWSEINFO - Structure
and call your - BrowseForFolderProc - with it.

I think this resolve the Problem! - I didn`t test it with zXref, because i'm short in Time today.

Insert the next Lines on the rght Place into your - DlgProc - for PBMain DDT-Style or
into your - WndProc - FUNCTION for the use wth the WinMain SDK-Style.

I`m personally prefer the SDK and the Win-Api,  It`s hard work sometimes, but when it`s done, i have the
the Possibllty to translate the code easy into any other programming Language.
Because the flat Win-Api is always the same Syntax with minimal differences.

I hope you understand all - my English isn`t the Best but i work on it.
......

Paste this into WndProc or DlgProc:

    STATIC SzGetpath AS ASCIIZ * %MAX_PATH '// if %MAX_PATH not defined, use - ASCIIZ * 255 -
    LOCAL  SGetpath  AS STRING

         IF LEN(SzGetpath) = 0 THEN SzGetpath = JH_AppDir()  '// For "hWnd" use "CBHNDL" in DDT-Style
         CALL JH_GetFolder(hWnd,SzGetpath) TO SGetpath     '// <-- SGetpath = JH_GetFolder(hWnd,SzGetpath)
         IF LEN(SGetpath) and SGetpath <> SzGetpath THEN
            SzGetpath = SGetpath
         ELSE
            CALL ErrorMsg(("You don`t select a new Folderlocation!" + $CR + "The Current used FolderPath is:" + $CR + SzGetpath))
         END IF                                                                                                                 
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
FUNCTION ErrorMsg(BYVAL lpszMessage AS STRING)AS LONG
   MessageBox(0&,(lpszMessage), "Error", %MB_OK OR %MB_ICONERROR OR %MB_TOPMOST)
   FUNCTION = 0
END FUNCTION
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
' Get Applicaton's Folderpath - returned as String
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
FUNCTION JH_AppDir() AS STRING
   LOCAL sAppPath AS STRING
   LOCAL APPLIDir AS ASCIIZ * %MAX_PATH
   Call GetModuleFileName(BYVAL 0, APPLIDir, %MAX_PATH)            ' get path to program
   sAppPath = LEFT$(APPLIDir, INSTR(-1, APPLIDir, ANY "\/:"))      ' ExePath with "\"
   '//sAppPath = Left$(APPLIDir, InStr(-1, APPLIDir, Any "\/:")-1) ' ExePath without "\"
    FUNCTION = sAppPath
END FUNCTION
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
' Browse for folder
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
FUNCTION JH_GetFolder(BYVAL hwnd AS DWORD,BYVAL sPath AS STRING) AS STRING

    STATIC szPath AS ASCIIZ * %MAX_PATH
    STATIC idl AS DWORD
    LOCAL PathID AS DWORD
    LOCAL bInf AS BROWSEINFO

    ' Fill the BROWSEINFO - Structure and
    ' set some properties for the BFF_Dialog
    ' Store sPath in STATIC - Memory and set it as Staustext
    IF LEN(sPath) THEN szPath = sPath
    CALL SHGetSpecialFolderLocation(hwnd, %CSIDL_DESKTOP, idl)

    bInf.hWndOwner = hwnd
    bInf.ulFlags   = %BIF_USENEWUI  '//OR %BIF_RETURNONLYFSDIRS
    bInf.pidlRoot  = idl    '/ %CSIDL_DRIVES
    ' //bInf.pszDisplayName = VARPTR(szPath)  '//Staustext
    bInf.lpszTitle = VARPTR(szPath)           '//Staustext
    bInf.lpfnCallback = CODEPTR(BrowseForFolderProc)
    bInf.lparam = STRPTR(sPath)               '// lparam is the lpData

    PathID = SHBrowseForFolder(bInf) ' open the Browse-For-Folder Dialogbox

    IF PathID THEN                   ' returned id of Path
        IF SHGetPathFromIDList(BYVAL PathID, szPath) THEN
            szPath = EXTRACT$(szPath, CHR$(0))
           '//IF ASC(szPath, -1) <>  92 THEN sPath = szPath + "\"  '//  Asciicode 92 = \
            IF RIGHT$(szPath, 1) <> "\" THEN sPath = szPath + "\"  '//  Two ways.. Try out!!
            FUNCTION  = sPath
        END IF
      CoTaskMemFree PathID 'clear allocated memory from PathID
      CALL CoTaskMemFree(BYVAL idl)
    END IF

END FUNCTION
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
' Translated BrowseForFolder Callback - For the use in both Styles, SDK and also DDT-Applications
' need the - FUNCTION JH_GetFolder -
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
FUNCTION BrowseForFolderProc(BYVAL hWnd AS LONG, BYVAL wMsg AS LONG, BYVAL wParam AS LONG, BYVAL lpData AS LONG) AS LONG
   LOCAL zBuffer AS ASCIIZ * %MAX_PATH
   LOCAL Translevel AS DWORD

    Translevel= 226

    SELECT CASE wMsg

      '// IF wMsg = %BFFM_INITIALIZED THEN

      CASE  %BFFM_INITIALIZED
          '// A little ADDON.. remove next three Lines and the local Translevel Definition, if you don`t want this!
         CALL SetWindowLong(hWnd, (-20), GetWindowLong(hWnd, (-20)) OR &H80000)
         CALL SetLayeredWindowAttributes(hWnd, 0, Translevel, &H2)  '// %LWA_ALPHA = &H2
         CALL RedrawWindow(hWnd, BYVAL 0&, BYVAL 0&, %RDW_ERASE OR %RDW_INVALIDATE OR %RDW_FRAME OR %RDW_UPDATENOW OR %RDW_ALLCHILDREN)

        '// DIALOG SEND hWnd, %BFFM_SETSELECTION, %TRUE, lpData
         CALL Sendmessage(hWnd, %BFFM_SETSELECTION, %TRUE, BYVAL lpData)
        FUNCTION = 1

      '// ELSEIF wMsg = %BFFM_SELCHANGED THEN

      CASE %BFFM_SELCHANGED
         CALL SHGetPathFromIDList(BYVAL wParam, zBuffer)
         IF LEN(zBuffer) THEN
           zBuffer = EXTRACT$(zBuffer, CHR$(0))
           '//IF ASC(zBuffer, -1) <> 92 THEN zBuffer = zBuffer + "\"  '//  Asciicode 92 = \
           IF RIGHT$(zBuffer, 1) <> "\" THEN zBuffer = zBuffer + "\"  '//  Two ways.. Try out!!

           CALL Sendmessage(hWnd, %BFFM_SETSTATUSTEXT, 0, BYREF zBuffer)

          'IF ISFALSE CBWPARAM OR ISFALSE LEN(zBuffer) OR ISFALSE (GETATTR(zBuffer) AND %SUBDIR) OR MID$(zBuffer,2,1) <> ":" THEN  ' Not a local or mapped drive
          '    DIALOG SEND CBHNDL, %BFFM_ENABLEOK, %FALSE, %FALSE
          'ELSEIF (GETATTR(zBuffer) AND %SYSTEM) AND RIGHT$(zBuffer,2) <> ":\" THEN ' exclude system folders, allow root directories
          '    DIALOG SEND CBHNDL, %BFFM_ENABLEOK, %FALSE, %FALSE
          'END IF
        END IF
     END SELECT
FUNCTION = 0
END FUNCTION
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤



..
Title: zXref (updated to version 1.10)
Post by: Patrice Terrier on September 13, 2009, 03:53:49 PM
PB9 ISFILE has been replaced with zExist to detect either files or folders.

The new zip file is attached to the first post of this thread.

...
Title: Re: zXref (version 1.10)
Post by: Jürgen Huhn on September 23, 2009, 11:23:04 PM
Patrice,

for you Information...

I tested zXref (version 1.09) on "WinXP SP3" with a few SourceCodes!

It work`s good on my Sytem and i must say: "Thank you for this great Work!"
For me it's a really usefull Tool that i've missed sometimes.

Until now i used old Tools like "inClean or CheckIt" and so on, but with "zXref" and
the included SourceCode, i have much more Possibility`s!

E.g.: to stay up to Date by customizing the Code..

I will post any changes on the Code to you, if any changes need to do...

But in the moment zXref work`s well! Very Usefull!

Thank you...

:)
Ps.: I updated the "Browse for Folder Functions"...
I added three Lines, because i forgot to insert them the last Time.
But no Problem, the Function work also without them.

    CALL SHGetSpecialFolderLocation(hwnd, %CSIDL_DESKTOP, idl)
    bInf.pidlRoot  = idl    '/ %CSIDL_DRIVES


    CALL CoTaskMemFree(BYVAL idl)

Title: Re: zXref (version 1.10)
Post by: James Klutho on November 24, 2009, 09:25:16 PM
Bob

I believe the xRef comes with the source code so people can tweak it to meet their needs.  Your request should not be that hard to do.


Jim
Title: Re: zXref (version 1.10)
Post by: Paul Breen on December 15, 2009, 11:50:51 PM
Maybe this does not happen often but If I use a file like main.bas that has the "compile" statement in an include file, zXref refuses to scan the file.
Example, my main.bas has:
#include "directives.inc"

directives.inc
has this:
#COMPILE EXE '"C:\TSE\ff.exe"
#DIM ALL
'etc
Sometimes I use a main.bas that has only comments and includes.
thanks,
Paul Breen
Title: Re: zXref (version 1.10)
Post by: Theo Gottwald on September 07, 2010, 05:48:17 PM
Interesting developement. We should continue to work on it.
Besides that, the sollution HOW PB and the COmponents look for "Include Files" is not yet perfect.
In the best case, ´the compiler and all Utilities would use the same pathes and the same Order to find include files.
No Need for config files.

If the compiler doesn't need them, why should another tool?
Title: Re: zXref (version 1.10)
Post by: Patrice Terrier on August 09, 2011, 06:47:32 PM
The first post of this thread has been updated, to fix the ZIP file corruption caused by the "Server Collapse".

...
Title: Re: zXref (version 1.10)
Post by: Larry Charlton on April 03, 2012, 12:22:01 AM
It appears that this will read header files multiple times even if they have the Once directive.  Not a huge deal, but some of my projects are taking over a minute due to scanning the winapi headers multiple times.
Title: Re: zXref (version 1.10)
Post by: Paul Elliott on April 03, 2012, 02:24:03 AM
Do PB's compilers search anywhere other than the specified directory on the #Include ( whether a
direcotry is relative to the current source directory is coded ) or the current source directory or
the directories specified in the PB IDE options?

Can anyone explain to me why an INC file should be included multiple times? Unless it is to include
parts of the code based on having other INC files defining equates at different times ( which doesn't
seem right if it is one of the PB or Jose supplied INC files ).

Seeing as zXref keeps track of which INC files it has read, it should be easy to force them to all be
Include Once.

Will we see a version to handle the newer code ( such as Macros with parameters or Class
coding ) ? I'm seeing an odd occurence on DIM x(100, 2) as string  with it showing 100 as the
variable and ignoring the x().



Title: Re: zXref (version 1.10)
Post by: Paul Elliott on April 03, 2012, 01:39:13 PM
I see at least part of the problem of files included multiple times.

gsIncludes() only has the main file name ( sometime multiple entries ).
gsFiles() has the whole path & file name.

The DoGetIncFiles is only searching for the INC file name ( no path ) in gsIncludes().

There may be other places that it gets searched but this routine seems the right place to weed
out duplicates.

Title: Re: zXref (version 1.10)
Post by: Paul Elliott on April 03, 2012, 03:26:34 PM
something along the lines of


'                // Patrice resolve missing include path
                 IF zExist(sWork) = 0 THEN sWork = zFindFile(sWork)
                 IF zExist(sWork) THEN                       'safety check - if we can find what we got..
         ' I added the following
                    ARRAY SCAN tmpFiles(), COLLATE UCASE, = sWork, TO xx
                    IF xx = 0 THEN
                       ARRAY SCAN gsFiles(), COLLATE UCASE, = sWork, TO xx
                       IF xx = 0 THEN
         '  checks to see if file already in tables               
                          tmpFiles(fc) = sWork                               'store path + name in temporary array
                          fc += 1: REDIM PRESERVE tmpFiles(fc)     'incr counter and redim temporary array
         ' and the 2 End Ifs
                       END IF
                    END IF
                 END IF   


should work. Had to add another variable  ( Local xx as Long ) to keep from changing something
I shouldn't.

This checks to see if the file is already in the tmpFiles() or in gsFiles() in DoGetIncFiles().

Patrice will probably have a better method.

Title: Re: zXref (version 1.10)
Post by: Larry Charlton on April 04, 2012, 02:53:54 AM
That worked really well.  Scan time dropped from 95 seconds to 29 seconds.

Turns out there's another option also, in zXRef.cfg all the exclude files are commented out.  I updated it to point to the PBWin10 includes and built an updated list of all the include files and dropped them in uncommented.  Skips right over them and reduces scan time to 1.7 seconds.  8)

Title: Re: zXref (version 1.10)
Post by: Paul Elliott on April 04, 2012, 01:32:25 PM
Larry,

It also works if you point it to .\ so that it only looks at the current directory. Then you can work on
programs dealing with either PB's or Jose's INC files and different versions of them without any
change to the cfg file.
Another choice would be to point it to the directory where you have your INC files ( in case they are
not specified on the #Include lines ).


Title: Re: zXref (version 1.10)
Post by: Paul Elliott on April 05, 2012, 11:43:39 PM
Patrice,

Have not heard your opinion yet.

I was confused about which array had what file name at first. Then I ran a few files and dumped
out what was in them. I think I got it right.

Is what I wrote in reply #101 correct? Or did I miss something? 

Title: Re: zXref (version 1.10)
Post by: Theo Gottwald on April 06, 2012, 07:47:55 AM
QuoteCan anyone explain to me why an INC file should be included multiple times?

Paul, the WinAPI not, I guess.

BUT, an Included file is technically same like MACRO.
You see that, if you intermix MACROS and Include files, they even share the same "NESTING DEPT".

The reason for including a file twice is the same, why you should use a MACRO twice.
Include files are not solely for using WinAPI, or reading definitions,
but you can also use them to include your personal code-stuff "as often as you want" without always typing it again.
Title: Re: zXref (version 1.10)
Post by: Paul Elliott on April 06, 2012, 12:49:35 PM
Theo,

Ok, thanks for pointing that out.

I was just trying to figure out how to handle the #Include Once & #Include This Once. For the latter,
I'm just going to leave in the code already read up to that point ( it gets messy having to undo
anything already input if that is not the first real line of code ).

I was just running all the PB or Jose WinAPI files into 1 main file to get a big list of equates and
check out if I was handling #IF...#ENDIF blocks correctly. And to check how to store equate values
for comparison or use in building other equates.

I guess it's time to track down my problem with multiple copies of the same file open at once.
Something to do this weekend.

Title: Re: zXref (version 1.10)
Post by: Larry Charlton on April 12, 2012, 02:22:32 AM
Quote from: Theo Gottwald on April 06, 2012, 07:47:55 AM
...BUT, an Included file is technically same like MACRO.
You see that, if you intermix MACROS and Include files, they even share the same "NESTING DEPT".

The reason for including a file twice is the same, why you should use a MACRO twice.
Include files are not solely for using WinAPI, or reading definitions,
but you can also use them to include your personal code-stuff "as often as you want" without always typing it again.

Theo,

Thanks for that!  I read that and it percolated in the back of my mind for a bit.  Puts a whole new light on #include :)  I'm not sure I'll use it, but it occurs to me it could be used to include common methods (or interfaces) in several classes.  Going further with a bit of naming convention it could be used as a sort of templating.  Here's a simple example

Name_Create.inc
  vName = "Theo!"

Name_Definition.inc
    Property Get Name() As String
      Property = vName
    End Property
    Property Set Name( value As String )
      vName = value
    End Property


Name_Instance.inc
  Instance vName As String

Test.bas
#Compile Exe
#Dim All

Function PBMain () As Long
  Local v1 As i1
  Local v2 As i2

  v1 = Class "C1"
  ? v1.Name + ", " + v1.Phone

  v2 = Class "C2"
  ? v2.Name + ", " + Format$( v2.Age, "0" )
End Function


Class C1
  #Include "Name_Instance.inc"
  Instance vPhone As String

  Class Method Create()
    vPhone = "704-555-1212"
    #Include "Name_Create.inc"
  End Method

  Interface i1
    Inherit IUnknown

    #Include "Name_Definition.inc"
    Property Get Phone() As String
      Property = vPhone
    End Property
    Property Set Phone( value As String )
      vPhone = value
    End Property
  End Interface
End Class


Class C2
  #Include "Name_Instance.inc"
  Instance vAge As Long

  Class Method Create()
    vAge = 140
    #Include "Name_Create.inc"
  End Method

  Interface i2
    Inherit IUnknown

    #Include "Name_Definition.inc"
    Property Get Age() As Long
      Property = vAge
    End Property
    Property Set Age( value As Long )
      vAge = value
    End Property
  End Interface
End Class