List all functions and classes in FWH library

Post Reply
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

List all functions and classes in FWH library

Post by nageswaragunupudi »

Many but not all functions provided by FWH are listed in the Wiki. Newly added functions from time to time are announced in whatsnew.txt.

This program lists all functions and classes included in the installed FWH library. In addition, the program name and source code of the function/class are also displayed, except in the case of internal functions.

Code: Select all

#include "fivewin.ch"

#define EM_LINESCROLL           182
#define EM_GETFIRSTVISIBLELINE  0x00CE


//----------------------------------------------------------------------------//

static cBccFolder  := "c:\bcc7\"   // your bcc folder here

//----------------------------------------------------------------------------//

function Main()

   local aFunc
   local oDlg, nWd, oFont, oFixed, oBrw, oSay, oGet
   local cModule, cFile, cText, cUpper

   SetMGetColorFocus()

   aFunc := ReadFuncs()
   if Empty( aFunc )
      return nil
   endif

   cModule  := aFunc[ 1, 1 ]
   cFile    := ModuleToFile( cModule )
   cText    := If( Empty( cFile ), "", MemoRead( cFile ) )

   DEFINE FONT oFont  NAME "TAHOMA" SIZE 0,-13
   DEFINE FONT oFixed NAME "LUCIDA CONSOLE" SIZE 0,-14

   nWd      := Int( ScreenWidth() * 0.9 )

   DEFINE DIALOG oDlg SIZE nWd,600 PIXEL TRUEPIXEL FONT oFont ;
      TITLE "FWH Functions"

   @ 20,20 XBROWSE oBrw SIZE 400,-20 PIXEL OF oDlg ;
      DATASOURCE aFunc COLUMNS 1,2 ;
      HEADERS "MODULE", "FUNCTION" ;
      COLSIZES "BBBBBBBBBB" ;
      CELL LINES NOBORDER FOOTERS AUTOSORT

   WITH OBJECT oBrw
      :bRecSelData   := { || oBrw:KeyNo }
      :nRecSelWidth  := "9999"
      :bRecSelHeader := { || "SlNo" }
      :bRecSelFooter := { || oBrw:nLen }

      :lHScroll      := .f.
      :lSeekBar      := .t.
      :bClrEdits     := { || { CLR_HRED, CLR_YELLOW } }
      :lSeekWild     := .t.
      :nStretchCol   := 2

      :bChange       := <||
         if !( cModule == oBrw:aRow[ 1 ] )
            cModule  := oBrw:aRow[ 1 ]
            cFile    := ModuleToFile( cModule )
            if Empty( cFile )
               cText := ""
            else
               cText := MemoRead( cFile )
            endif
            cUpper   := Upper( cText )
            oSay:Refresh()
            oGet:Refresh()
         endif
         LocateFunction( oBrw:aRow[ 2 ], cText, cUpper, oGet )
         return nil
         >

      :CreateFromCode()
   END

   @ 20,420 SAY oSay PROMPT { || cFile } SIZE nWd - 440, 26 PIXEL CENTER OF oDlg ;
      COLOR CLR_BLACK, oBrw:nRecSelColor

   @ 50,420 GET oGet VAR cText MEMO SIZE nWd - 440, 530 PIXEL OF oDlg FONT oFixed

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT LocateFunction( aFunc[ 1, 2 ], cText, cUpper, oGet )
   RELEASE FONT oFont, oFixed

return nil

//----------------------------------------------------------------------------//

function ReadFuncs()

   local cText, aLines, cLine, cFunc, cFunc1, cFunc2, n, i
   local cModule  := ""
   local aFunc    := {}

   if !lIsDir( cBccFolder )
      MsgStop( cBccFolder + " not found" )
      return nil
   endif

   if !File( "fiveh.lst" )
     WaitRun( cBccFolder + "bin\tlib.exe ..\lib\fiveh.lib, fiveh.lst" )
     SysWait( .2 )
   endif
   cText    := MemoRead( "fiveh.lst" )
   aLines   := HB_ATokens( cText, CRLF )

   if !File( "fivehc.lst" )
      WaitRun( cBccFolder + "bin\tlib.exe ..\lib\fivehc.lib, fivehc.lst" )
      SysWait( .2 )
   endif
   cText    := MemoRead( "fivehc.lst" )
   aLines   := AMERGE( aLines, HB_ATokens( cText, CRLF ) )

   for n := 2 to Len( aLines )
      cLine    := aLines[ n ]
      if Empty( cLine )
         LOOP
      endif
      if Left( cLine, 1 ) == Chr( 9 )
         for i := 1 to 2
            cFunc    := TOKEN( cLine, , i )
            if cFunc = "_HB_FUN_"
               AAdd( aFunc, { cModule, AFTERATNUM( "_HB_FUN_", cFunc ) } )
            else
               EXIT
            endif
         next
      else
         cModule  := AllTrim( TOKEN( cLine,,1 ) )
      endif
   next

   ASort( aFunc, , , { |x,y| If( x[ 1 ] == y[ 1 ], x[ 2 ] < y[ 2 ], x[ 1 ] < y[ 1 ] ) } )

return aFunc

//----------------------------------------------------------------------------//

static function ModuleToFile( cModule )

   local cSpec := "..\source\" + cModule + ".*"
   local cFile := ""
   local aDir

   aDir     := DirectoryRecurse( TrueName( cSpec ) )
   if !Empty( aDir )
      cFile    := aDir[ 1, 1 ]
   endif

return cFile

//----------------------------------------------------------------------------//

static function LocateFunction( cFunc, cText, cUpper, oGet )

   local nRow     := 1
   local aSeek    := {}
   local nPos

   if !Empty( cText )

      DEFAULT cUpper  := Upper( cText )

      aSeek    := {  "FUNCTION " + cFunc + "(", ;
                     "FUNCTION " + cFunc + " ", ;
                     "CLASS " + cFunc, ;
                     "HB_FUNC( " + cFunc + " )", ;
                     "HB_FUNC (" + cFunc + ")" }

      nPos     := AAT( aSeek, cUpper )

      if nPos > 0
         nRow     := OCCURS( CRLF, LEFT( cText, nPos ) )
      endif

      GetSetTopRow( oGet, nRow )

   endif

return nRow

//----------------------------------------------------------------------------//

static function GetSetTopRow( oGet, nRow )

   local nTopRow     := oGet:SendMsg( EM_GETFIRSTVISIBLELINE )

   oGet:SendMsg( EM_LINESCROLL, 0, nRow - nTopRow )

return nil

//----------------------------------------------------------------------------//
Image

Building the program:
1. Copy the program to your \fwh\samples folder. This program runs from samples folder only.
2. By default, cBccFolder is set to "c:\bcc7\". If it is different in your case, please change the static variable cBccFolder
3. If you are using an older version of FWH that does not support lSeekBar of XBrowse, please comment out the line ":lSeekBar := .t."
4. Build with buildh.bat or buildx.bat.

Notes:
Some functions displayed by the program may be functions that are internally used and not intended to be used directly in the applications and they may change or be dropped in subsequent versions. Some functions may be obsolete and superseded by later versions.
Regards

G. N. Rao.
Hyderabad, India
hua
Posts: 861
Joined: Fri Oct 28, 2005 2:27 am

Re: List all functions and classes in FWH library

Post by hua »

Bravo! Thanks Rao
FWH 11.08/FWH 19.03
xHarbour 1.2.1 (Rev 6406) + BCC
Harbour 3.1 (Rev 17062) + BCC
Harbour 3.2.0dev (r1904111533) + BCC
User avatar
Marc Venken
Posts: 727
Joined: Tue Jun 14, 2016 7:51 am

Re: List all functions and classes in FWH library

Post by Marc Venken »

Thank you very much !
Marc Venken
Using: FWH 20.08 with Harbour
User avatar
Marc Venken
Posts: 727
Joined: Tue Jun 14, 2016 7:51 am

Re: List all functions and classes in FWH library

Post by Marc Venken »

Very helpfull indeed.

Before Mr. Rao also gave the foundation for a nice program to search the forum (enhanced by Mr. Uwe)

Imagen a button into this new program that when pressed, searches de forum for the occurence of that function. On the forum, many functions are used with real situations and variables.

This combination would give a very good alternative for updated functions.

(I have idea's, but not the skills to make what I ask here, sorry... :oops:
Marc Venken
Using: FWH 20.08 with Harbour
User avatar
byte-one
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria
Contact:

Re: List all functions and classes in FWH library

Post by byte-one »

Mr. Rao, the static "c:\bcc7\" should be able to override with a parameter for the ??.exe. And please provide the compiled ??.exe!
Regards,
Günther
---------------------------------
office@byte-one.com
shri_fwh
Posts: 301
Joined: Mon Dec 07, 2009 2:49 pm

Re: List all functions and classes in FWH library

Post by shri_fwh »

Dear Rao Sir ,

I have tried to modify the program to run for FWH64 but I could not get success.


as given below

Code: Select all


   if !File( "fiveh.lst" )
     WaitRun( cBccFolder + "bin\tdump64.exe ..\lib\Five64.a, fiveh.lst" )
     SysWait( .2 )
   endif
   cText    := MemoRead( "fiveh.lst" )
   aLines   := HB_ATokens( cText, CRLF )

   if !File( "fivehc.lst" )
      WaitRun( cBccFolder + "bin\tdump64.exe ..\lib\FiveC64.a, fivehc.lst" )
      SysWait( .2 )
   endif

 
Thanks
Shridhar
Thanks
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
User avatar
Marc Venken
Posts: 727
Joined: Tue Jun 14, 2016 7:51 am

Re: List all functions and classes in FWH library

Post by Marc Venken »

nageswaragunupudi wrote:Many but not all functions provided by FWH are listed in the Wiki. Newly added functions from time to time are announced in whatsnew.txt.

This program lists all functions and classes included in the installed FWH library. In addition, the program name and source code of the function/class are also displayed, except in the case of internal functions.

Code: Select all

#include "fivewin.ch"

#define EM_LINESCROLL           182
#define EM_GETFIRSTVISIBLELINE  0x00CE


//----------------------------------------------------------------------------//

static cBccFolder  := "c:\bcc7\"   // your bcc folder here

//----------------------------------------------------------------------------//

function Main()

   local aFunc
   local oDlg, nWd, oFont, oFixed, oBrw, oSay, oGet
   local cModule, cFile, cText, cUpper

   SetMGetColorFocus()

   aFunc := ReadFuncs()
   if Empty( aFunc )
      return nil
   endif

   cModule  := aFunc[ 1, 1 ]
   cFile    := ModuleToFile( cModule )
   cText    := If( Empty( cFile ), "", MemoRead( cFile ) )

   DEFINE FONT oFont  NAME "TAHOMA" SIZE 0,-13
   DEFINE FONT oFixed NAME "LUCIDA CONSOLE" SIZE 0,-14

   nWd      := Int( ScreenWidth() * 0.9 )

   DEFINE DIALOG oDlg SIZE nWd,600 PIXEL TRUEPIXEL FONT oFont ;
      TITLE "FWH Functions"

   @ 20,20 XBROWSE oBrw SIZE 400,-20 PIXEL OF oDlg ;
      DATASOURCE aFunc COLUMNS 1,2 ;
      HEADERS "MODULE", "FUNCTION" ;
      COLSIZES "BBBBBBBBBB" ;
      CELL LINES NOBORDER FOOTERS AUTOSORT

   WITH OBJECT oBrw
      :bRecSelData   := { || oBrw:KeyNo }
      :nRecSelWidth  := "9999"
      :bRecSelHeader := { || "SlNo" }
      :bRecSelFooter := { || oBrw:nLen }

      :lHScroll      := .f.
      :lSeekBar      := .t.
      :bClrEdits     := { || { CLR_HRED, CLR_YELLOW } }
      :lSeekWild     := .t.
      :nStretchCol   := 2

      :bChange       := <||
         if !( cModule == oBrw:aRow[ 1 ] )
            cModule  := oBrw:aRow[ 1 ]
            cFile    := ModuleToFile( cModule )
            if Empty( cFile )
               cText := ""
            else
               cText := MemoRead( cFile )
            endif
            cUpper   := Upper( cText )
            oSay:Refresh()
            oGet:Refresh()
         endif
         LocateFunction( oBrw:aRow[ 2 ], cText, cUpper, oGet )
         return nil
         >

      :CreateFromCode()
   END

   @ 20,420 SAY oSay PROMPT { || cFile } SIZE nWd - 440, 26 PIXEL CENTER OF oDlg ;
      COLOR CLR_BLACK, oBrw:nRecSelColor

   @ 50,420 GET oGet VAR cText MEMO SIZE nWd - 440, 530 PIXEL OF oDlg FONT oFixed

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT LocateFunction( aFunc[ 1, 2 ], cText, cUpper, oGet )
   RELEASE FONT oFont, oFixed

return nil

//----------------------------------------------------------------------------//

function ReadFuncs()

   local cText, aLines, cLine, cFunc, cFunc1, cFunc2, n, i
   local cModule  := ""
   local aFunc    := {}

   if !lIsDir( cBccFolder )
      MsgStop( cBccFolder + " not found" )
      return nil
   endif

   if !File( "fiveh.lst" )
     WaitRun( cBccFolder + "bin\tlib.exe ..\lib\fiveh.lib, fiveh.lst" )
     SysWait( .2 )
   endif
   cText    := MemoRead( "fiveh.lst" )
   aLines   := HB_ATokens( cText, CRLF )

   if !File( "fivehc.lst" )
      WaitRun( cBccFolder + "bin\tlib.exe ..\lib\fivehc.lib, fivehc.lst" )
      SysWait( .2 )
   endif
   cText    := MemoRead( "fivehc.lst" )
   aLines   := AMERGE( aLines, HB_ATokens( cText, CRLF ) )

   for n := 2 to Len( aLines )
      cLine    := aLines[ n ]
      if Empty( cLine )
         LOOP
      endif
      if Left( cLine, 1 ) == Chr( 9 )
         for i := 1 to 2
            cFunc    := TOKEN( cLine, , i )
            if cFunc = "_HB_FUN_"
               AAdd( aFunc, { cModule, AFTERATNUM( "_HB_FUN_", cFunc ) } )
            else
               EXIT
            endif
         next
      else
         cModule  := AllTrim( TOKEN( cLine,,1 ) )
      endif
   next

   ASort( aFunc, , , { |x,y| If( x[ 1 ] == y[ 1 ], x[ 2 ] < y[ 2 ], x[ 1 ] < y[ 1 ] ) } )

return aFunc

//----------------------------------------------------------------------------//

static function ModuleToFile( cModule )

   local cSpec := "..\source\" + cModule + ".*"
   local cFile := ""
   local aDir

   aDir     := DirectoryRecurse( TrueName( cSpec ) )
   if !Empty( aDir )
      cFile    := aDir[ 1, 1 ]
   endif

return cFile

//----------------------------------------------------------------------------//

static function LocateFunction( cFunc, cText, cUpper, oGet )

   local nRow     := 1
   local aSeek    := {}
   local nPos

   if !Empty( cText )

      DEFAULT cUpper  := Upper( cText )

      aSeek    := {  "FUNCTION " + cFunc + "(", ;
                     "FUNCTION " + cFunc + " ", ;
                     "CLASS " + cFunc, ;
                     "HB_FUNC( " + cFunc + " )", ;
                     "HB_FUNC (" + cFunc + ")" }

      nPos     := AAT( aSeek, cUpper )

      if nPos > 0
         nRow     := OCCURS( CRLF, LEFT( cText, nPos ) )
      endif

      GetSetTopRow( oGet, nRow )

   endif

return nRow

//----------------------------------------------------------------------------//

static function GetSetTopRow( oGet, nRow )

   local nTopRow     := oGet:SendMsg( EM_GETFIRSTVISIBLELINE )

   oGet:SendMsg( EM_LINESCROLL, 0, nRow - nTopRow )

return nil

//----------------------------------------------------------------------------//
Image

Building the program:
1. Copy the program to your \fwh\samples folder. This program runs from samples folder only.
2. By default, cBccFolder is set to "c:\bcc7\". If it is different in your case, please change the static variable cBccFolder
3. If you are using an older version of FWH that does not support lSeekBar of XBrowse, please comment out the line ":lSeekBar := .t."
4. Build with buildh.bat or buildx.bat.

Notes:
Some functions displayed by the program may be functions that are internally used and not intended to be used directly in the applications and they may change or be dropped in subsequent versions. Some functions may be obsolete and superseded by later versions.
I can't convert this small program just to read my personel program directory (c:\marc\) and scan for the prg file and take all functions out of it like this program does.
Can we addapt it for this functionality ?
So we can have a privat collection of private functions that we have made during time.
Maybe the file location can be added.
Marc Venken
Using: FWH 20.08 with Harbour
Enrrique Vertiz
Posts: 440
Joined: Fri Oct 07, 2005 2:17 pm
Location: Lima - Peru
Contact:

Re: List all functions and classes in FWH library

Post by Enrrique Vertiz »

Hello Mr. Rao

I already created the EXE but it doesn't show the contents of the functions / classes, only when I run the EXE it shows the function ATT (), when I go down to the next line it doesn't show anything anymore

Image
Enrrique Vertiz Pitta
Lima-Peru
xHb 1.23, Fwh 20.04, MySQL 5.7 - 8.0, SQLLIB 1.9m, SQLRDD
Enrrique Vertiz
Posts: 440
Joined: Fri Oct 07, 2005 2:17 pm
Location: Lima - Peru
Contact:

Re: List all functions and classes in FWH library

Post by Enrrique Vertiz »

Hello Mr. Rao,

Any ideas ??

Thanks
Enrrique Vertiz Pitta
Lima-Peru
xHb 1.23, Fwh 20.04, MySQL 5.7 - 8.0, SQLLIB 1.9m, SQLRDD
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: List all functions and classes in FWH library

Post by Antonio Linares »

Enrique,

Please run the EXE from FWH\samples

If not, then adjust this line:
local cSpec := "..\source\" + cModule + ".*"
regards, saludos

Antonio Linares
www.fivetechsoft.com
Enrrique Vertiz
Posts: 440
Joined: Fri Oct 07, 2005 2:17 pm
Location: Lima - Peru
Contact:

Re: List all functions and classes in FWH library

Post by Enrrique Vertiz »

Gracias Antonio

Lo compile con xHb y nada ..., y recorde que ustedes recomiendan Hb, lo compile y funciono !!

Esta linea es la que da resultados distintos en xHb y Hb (al parecer)

aDir := DirectoryRecurse( TrueName( cSpec ) )
Enrrique Vertiz Pitta
Lima-Peru
xHb 1.23, Fwh 20.04, MySQL 5.7 - 8.0, SQLLIB 1.9m, SQLRDD
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: List all functions and classes in FWH library

Post by Antonio Linares »

muy bien! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Willi Quintana
Posts: 859
Joined: Sun Oct 09, 2005 10:41 pm
Location: Cusco - Perú
Contact:

Re: List all functions and classes in FWH library

Post by Willi Quintana »

Hola,,, me sale este error:
Error: Unresolved external '_hb_vmPushSize' referenced from D:\SOFT\FWXH1906\FWH\LIB\FIVEHC.LIB|FFDLGPRC
Error: Unresolved external '_hb_partdt' referenced from D:\SOFT\FWXH1906\FWH\LIB\FIVEHX.LIB|VALTOSTT
User avatar
Willi Quintana
Posts: 859
Joined: Sun Oct 09, 2005 10:41 pm
Location: Cusco - Perú
Contact:

Re: List all functions and classes in FWH library

Post by Willi Quintana »

Error en Ejecución FW1507
Application
===========
Path and name: D:\SOFT\FWXH1507\FWH\samples\func.exe (32 bits)
Size: 2,827,776 bytes
Compiler version: xHarbour build 1.2.1 Intl. (SimpLex) (Rev. 9445)
FiveWin Version: FWHX 15.07
Windows version: 6.2, Build 9200

Time from start: 0 hours 0 mins 0 secs
Error occurred at: 03/26/20, 18:42:36
Error description: Error BASE/1073 Argument error: <
Args:
[ 1] = C BBBBBBBBBB
[ 2] = N 0

Stack Calls
===========
Called from: .\source\classes\XBROWSE.PRG => XBROWSENEW( 13196 )
Called from: func.prg => MAIN( 42 )
Post Reply