Files
harbour-core/harbour/bin/find.hb
Viktor Szakats 0e9ca7db45 2012-08-03 15:31 UTC+0200 Viktor Szakats (harbour syenar.net)
+ bin/commit.hb
  + bin/find.hb
  - bin/hbcommit.hb
  - bin/hbfind.hb
  * ChangeLog
    % deleted 'hb' prefix
    * updated examples
2012-08-03 13:34:26 +00:00

81 lines
2.3 KiB
Plaintext

/*
* $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
STATIC 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
STATIC 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