• 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

#15
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?

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

Donnie Ewald

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.

Patrice Terrier

#17
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...

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

Trento Castricone

Went to my WinXP SP3 machine.
Same result.
Nothing running, but zXref.exe

Trento Castricone

Added full path to the .BAS file and NO zero lenght files.

Patrice Terrier

#20
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.

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

Bud Meyer

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.

Patrice Terrier

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.

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

Trento Castricone

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.

José Roca

#24
 
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.

Patrice Terrier

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.
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Bud Meyer

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.

Patrice Terrier

#27
I thought i was clear enough.

YOU have to edit the zXref.cfg to match your specific case!
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Bud Meyer

It made no difference when I edited the SCANPATH, as I said in my last post.

Patrice Terrier

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.

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