Files
harbour-core/harbour/tests/hbdoctst.prg
Viktor Szakats 608da306e9 2012-06-04 17:21 UTC+0200 Viktor Szakats (harbour syenar.net)
* src/debug/dbgbrwsr.prg
  * src/debug/dbgtarr.prg
  * src/debug/dbgthsh.prg
  * src/debug/dbgtinp.prg
  * src/debug/dbgtmenu.prg
  * src/debug/dbgtobj.prg
  * src/debug/dbgwa.prg
  * src/debug/debugger.prg
  * src/rdd/dbstruxu.prg
  * src/rdd/dbtotal.prg
  * src/rdd/hbsix/sxcompat.prg
  * src/rdd/hbsix/sxini.prg
  * src/rdd/hbsix/sxtrig.prg
  * src/rdd/rddord.prg
  * src/rdd/rddordu.prg
  * src/rdd/usrrdd/rdds/arrayrdd.prg
  * src/rdd/usrrdd/rdds/hscdx.prg
  * src/rdd/usrrdd/rdds/logrdd.prg
  * src/rdd/usrrdd/rdds/rlcdx.prg
  * src/rtl/achoice.prg
  * src/rtl/adir.prg
  * src/rtl/alert.prg
  * src/rtl/checkbox.prg
  * src/rtl/color53.prg
  * src/rtl/dbedit.prg
  * src/rtl/einstv52.prg
  * src/rtl/einstvar.prg
  * src/rtl/errsys.prg
  * src/rtl/fieldbl.prg
  * src/rtl/getsys.prg
  * src/rtl/getsys53.prg
  * src/rtl/gui.prg
  * src/rtl/hbdoc.prg
  * src/rtl/hbfilehi.prg
  * src/rtl/hbi18n2.prg
  * src/rtl/hbini.prg
  * src/rtl/libname.prg
  * src/rtl/listbox.prg
  * src/rtl/memoedit.prg
  * src/rtl/memvarbl.prg
  * src/rtl/memvarhb.prg
  * src/rtl/menusys.prg
  * src/rtl/menuto.prg
  * src/rtl/objfunc.prg
  * src/rtl/profiler.prg
  * src/rtl/pushbtn.prg
  * src/rtl/radiobtn.prg
  * src/rtl/radiogrp.prg
  * src/rtl/readvar.prg
  * src/rtl/scrollbr.prg
  * src/rtl/setfunc.prg
  * src/rtl/tbcolumn.prg
  * src/rtl/tbrowse.prg
  * src/rtl/tbrowsys.prg
  * src/rtl/tclass.prg
  * src/rtl/teditor.prg
  * src/rtl/tget.prg
  * src/rtl/tgetlist.prg
  * src/rtl/tmenuitm.prg
  * src/rtl/tmenusys.prg
  * src/rtl/tobject.prg
  * src/rtl/tpersist.prg
  * src/rtl/tpopup.prg
  * src/rtl/ttopbar.prg
  * src/rtl/typefile.prg
  * tests/hbdoctst.prg
  * utils/hbmk2/hbmk2.prg
    * IS*() macros converted to HB_IS*() function calls.
      (using full uppercase to make them stand out)
    % deleted '#include "common.ch"' where possible
2012-06-04 15:25:14 +00:00

94 lines
2.0 KiB
Plaintext

/*
* $Id$
*/
/*
* HBDOC reader test
*
* Copyright 2010 Viktor Szakats (harbour syenar.net)
* www - http://harbour-project.org
*
*/
#include "directry.ch"
PROCEDURE Main( cRoot )
LOCAL aEntry
LOCAL cName
LOCAL aDir
LOCAL cDir
LOCAL aFile
LOCAL aErrMsg
LOCAL tmp
IF ! HB_ISSTRING( cRoot )
/* Detect Harbour root */
cRoot := "." + hb_ps()
DO WHILE hb_DirExists( cRoot + ".." )
IF hb_FileExists( cRoot + "INSTALL" ) .AND. ;
hb_FileExists( cRoot + "COPYING" ) .AND. ;
hb_DirExists( cRoot + "config" )
EXIT
ENDIF
cRoot += ".." + hb_ps()
ENDDO
ELSE
cDir := hb_DirSepAdd( cDir )
ENDIF
OutStd( "Root: " + cRoot + hb_eol() )
aDir := { cRoot }
FOR EACH aFile IN Directory( cRoot + "contrib" + hb_ps() + hb_osFileMask(), "D" )
IF "D" $ aFile[ F_ATTR ] .AND. ;
!( aFile[ F_NAME ] == "." ) .AND. ;
!( aFile[ F_NAME ] == ".." )
AAdd( aDir, cRoot + "contrib" + hb_ps() + aFile[ F_NAME ] )
ENDIF
NEXT
FOR EACH cDir IN aDir
cName := DirGetName( cDir )
IF Empty( cName )
cName := "harbour"
ENDIF
aErrMsg := {}
aEntry := __hbdoc_LoadDir( cDir, cName, aErrMsg )
/* TODO: apply code formatting, HBDOC section and content validation here.
It's also possible to create output generators at this point.
These generators should simply parse the list of entry hashes
and spit out output in selected end-user format, like .html
or .pdf */
FOR EACH tmp IN aErrMsg
OutStd( tmp + hb_eol() )
NEXT
IF ! Empty( aEntry )
OutStd( __hbdoc_savehbd( cName, aEntry ), cName, Len( aEntry ), hb_eol() )
ENDIF
NEXT
RETURN
STATIC FUNCTION DirGetName( cDir )
LOCAL cName
cDir := hb_DirSepDel( cDir )
hb_FNameSplit( cDir,, @cName )
IF Empty( cName ) .OR. cName == "." .OR. cName == ".."
RETURN ""
ENDIF
RETURN cName