List all functions and classes in FWH library
Posted: Thu Jan 03, 2019 4:35 pm
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.
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.
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
//----------------------------------------------------------------------------//
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.