• 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

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

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

Bud Meyer

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

Patrice Terrier

Bud,

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

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

Patrice Terrier

#78
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!

...


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

Patrice Terrier

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.

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

Jürgen Huhn

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)
.¸.•'´¯)¸.•'´¯)¸.•'´¯)¸.•'´¯)
¤ª"˜¨¨¯¯¨¨˜"ª¤....¤ ª"˜¨

Jürgen Huhn

#81
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
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤



..
.¸.•'´¯)¸.•'´¯)¸.•'´¯)¸.•'´¯)
¤ª"˜¨¨¯¯¨¨˜"ª¤....¤ ª"˜¨

Patrice Terrier

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.

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

Jürgen Huhn

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)

.¸.•'´¯)¸.•'´¯)¸.•'´¯)¸.•'´¯)
¤ª"˜¨¨¯¯¨¨˜"ª¤....¤ ª"˜¨

James Klutho

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

Paul Breen

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

Theo Gottwald

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?

Patrice Terrier

The first post of this thread has been updated, to fix the ZIP file corruption caused by the "Server Collapse".

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

Larry Charlton

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.

Paul Elliott

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().