2012-07-31 15:00 UTC+0200 Viktor Szakats (harbour syenar.net)

+ bin/hbfind.hb
    + added script to list and/or find public symbols in
      Harbour core and contribs (and some extras).
      To list all symbols (functions, classes):
         $ hbrun bin/hbfind.hb
      To find string in symbols (case-insensitive):
         $ hbrun bin/hbfind.hb vol
This commit is contained in:
Viktor Szakats
2012-07-31 13:04:38 +00:00
parent 9acad78dc2
commit bfc1039c14
2 changed files with 89 additions and 0 deletions

View File

@@ -16,6 +16,15 @@
The license applies to all entries newer than 2009-04-28.
*/
2012-07-31 15:00 UTC+0200 Viktor Szakats (harbour syenar.net)
+ bin/hbfind.hb
+ added script to list and/or find public symbols in
Harbour core and contribs (and some extras).
To list all symbols (functions, classes):
$ hbrun bin/hbfind.hb
To find string in symbols (case-insensitive):
$ hbrun bin/hbfind.hb vol
2012-07-31 14:50 UTC+0200 Viktor Szakats (harbour syenar.net)
* contrib/hbide/projectwizard.prg
! '.hbptmplt' extension renamed to '.tpl'. First it doesn't

80
harbour/bin/hbfind.hb Normal file
View File

@@ -0,0 +1,80 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Lists selected functions and their location
*
* Copyright 2012 Viktor Szakats (harbour syenar.net)
* www - http://harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
* their web site at http://www.gnu.org/).
*
*/
#include "directry.ch"
PROCEDURE Main( cContains )
WalkDir( hb_DirBase() + ".." + hb_ps(), cContains )
RETURN
PROCEDURE WalkDir( cDir, cContains )
LOCAL aFile
FOR EACH aFile IN Directory( cDir + hb_osFileMask(), "D" )
IF aFile[ F_NAME ] == "." .OR. aFile[ F_NAME ] == ".."
ELSEIF "D" $ aFile[ F_ATTR ]
WalkDir( cDir + aFile[ F_NAME ] + hb_ps(), cContains )
ELSEIF hb_FNameExt( aFile[ F_NAME ] ) == ".hbx"
ProcessFile( cDir + aFile[ F_NAME ], cContains )
ENDIF
NEXT
RETURN
PROCEDURE ProcessFile( cFileName, cContains )
LOCAL cDynamic
LOCAL lFirst := .T.
FOR EACH cDynamic IN __hb_extern_get_exception_list( cFileName )
IF cContains == NIL .OR. Upper( cContains ) $ Upper( cDynamic )
IF lFirst
lFirst := .F.
OutStd( cFileName + hb_eol() )
ENDIF
OutStd( " " + cDynamic + "()" + hb_eol() )
ENDIF
NEXT
RETURN
STATIC FUNCTION __hb_extern_get_exception_list( cInputName )
LOCAL cFile
LOCAL pRegex
LOCAL tmp
LOCAL aDynamic := {}
IF ! Empty( cFile := MemoRead( cInputName ) ) .AND. ;
! Empty( pRegex := hb_regexComp( "^DYNAMIC ([a-zA-Z0-9_]*)$", .T., .T. ) )
FOR EACH tmp IN hb_regexAll( pRegex, StrTran( cFile, Chr( 13 ) ),,,,, .T. )
AAdd( aDynamic, tmp[ 2 ] )
NEXT
ENDIF
RETURN aDynamic