I have found in xharbour ng this sample for creating a function list
.will be a starting point for doc?


#include "common.ch"
#include 'Inkey.ch'
#include 'fileio.ch'
#include 'hbeol.ch'
static aFuncsName:={}
static cRegExHbFunc
static cRegExFunc
static cRegExClass
static cRegExClassTran
static cRegExFunctionTran
static cRegExFuncTran
static cRegExHb_FuncTran
init procedure RegexCompiEgb
  default cRegExHbFunc          to Hb_RegExComp('(?i)^\s*HB_FUNC\s*\
(')
  default cRegExFunc            to Hb_RegExComp('(?i)^\s*(FUNCTION|
FUNC)')
  default cRegExClass           to Hb_RegExComp('(?i)^\s*CLASS\s{1,}')
  default cRegExClassTran       to Hb_RegExComp('(?i)^CLASS')
  default cRegExFunctionTran    to Hb_RegExComp('(?i)^FUNCTION')
  default cRegExFuncTran        to Hb_RegExComp('(?i)^FUNC')
  default cRegExHb_FuncTran     to Hb_RegExComp('(?i)^HB_FUNC\(')
return
func Main
  GetFromPatch({'c:\hbb\source\'},'std')
  GetFromPatch({'c:\hbb\contrib\firebird\',;
                'c:\hbb\contrib\mysql\',;
                'c:\hbb\contrib\pgsql\',;
                'c:\hbb\contrib\rddads\';
                },'Dbases')
  GetFromPatch({'c:\hbb\contrib\cgilib\',;
                'c:\hbb\contrib\freeimage\',;
                'c:\hbb\contrib\gd\',;
                'c:\hbb\contrib\gtwvw\',;
                'c:\hbb\contrib\hbcurl\',;
                'c:\hbb\contrib\hbzlib\',;
                'c:\hbb\contrib\libnf\',;
                'c:\hbb\contrib\pdflib\',;
                'c:\hbb\contrib\tp_\',;
                'c:\hbb\contrib\unicode\',;
                'c:\hbb\contrib\what32\',;
                'c:\hbb\contrib\wvtgiu\',;
                'c:\hbb\contrib\xwt\',;
                'c:\hbb\contrib\xwt2\';
                },'contrib')
return 0
procedure GetFromPatch(acPatch,cFileName,lClearFile)
  local aDirs
  local i
  local FHandleRead
  local FHandleWrite
  local FHandleWriteF
  local nMode
  aFuncsName:={}
  default lClearFile to TRUE
  if lClearFile
    nMode:=FO_CREAT | FO_READWRITE | FO_TRUNC
  else
    nMode:=FO_CREAT | FO_READWRITE
  endif
  aDirs:={}
  for i:=1 to Len(acPatch)
    aDirs:AddAll(DirectoryRecurse(acPatch[i]+'*.c','D'))
    aDirs:AddAll(DirectoryRecurse(acPatch[i]+'*.prg','D'))
  next
  for i:=1 to Len(aDirs)
    AAdd(aDirs[i],HB_REGEXSPLIT('\\',aDirs[i,1]))
    AAdd(aDirs[i],Len(aDirs[i,6]))
  next
  aDirs:=ASort(aDirs,,,<|x,y|
                              local i
                              local nRetVal
                              nRetVal:=FALSE
                              for i:=1 to Min(x[7],y[7])
                                if     x[6,i] < y[6,i]
                                  return TRUE
                                elseif x[6,i] > y[6,i]
                                  return FALSE
                                endif
                              next
                              return TRUE
                       >)
  FHandleWrite:=FOPEN(cFileName+'ws.funcs',nMode)
  FSeek(FHandleWrite,0,FS_END)
  FHandleWriteF:=FOPEN(cFileName+'.funcs',nMode)
  FSeek(FHandleWriteF,0,FS_END)
  for i:=1 to Len(aDirs)
    FHandleRead:=FOpen(aDirs[i,1])
    GenFuncs(FHandleRead,FHandleWrite,aDirs[i,1])
    FClose(FHandleRead)
  next
  FClose(FHandleWrite)
  stdFuncs(aFuncsName)
  aFuncsName:=ASort(aFuncsName)
  for i:=1 to Len(aFuncsName)
    FWrite(FHandleWriteF,aFuncsName[i]+EOL_WINDOWS)
  next
  FClose(FHandleWriteF)
return
procedure stdFuncs(aFuncsName)
  local i
  for i:=1 to Len(aFuncsName)
    aFuncsName[i]:=StrTran(aFuncsName[i]," ",'')
    if     aFuncsName[i] HAS cRegExClassTran
           aFuncsName[i]:="CLASS "+SubStr(aFuncsName[i],6)
    elseif aFuncsName[i] HAS cRegExFunctionTran
           aFuncsName[i]:="FUNCTION "+SubStr(aFuncsName[i],9)
    elseif aFuncsName[i] HAS cRegExFuncTran
           aFuncsName[i]:="FUNCTION "+SubStr(aFuncsName[i],5)
    elseif aFuncsName[i] HAS cRegExHb_FuncTran
           aFuncsName[i]:="FUNCTION "+SubStr(aFuncsName[i],9)
    endif
  next
return
proc GenFuncs(FHandleRead,FHandleWrite,cFileNameOpened)
  local aMaches
  local cBuffer
  local lAddLine
  local lFileSaved:=FALSE
  do while HB_FREADLINE( FHandleRead, @cBuffer)=0
    lAddLine:=FALSE
    if cBuffer HAS cRegExHbFunc
      lAddLine:=TRUE
    elseif cBuffer HAS cRegExFunc
      lAddLine:=TRUE
    elseif cBuffer HAS cRegExClass
      lAddLine:=TRUE
    endif
    if lAddLine
      AAdd(aFuncsName,cBuffer)
      if !lFileSaved
        FWrite(FHandleWrite,Space(70)+cFileNameOpened+EOL_WINDOWS)
        lFileSaved:=TRUE
      endif
      FWrite(FHandleWrite,cBuffeR+EOL_WINDOWS)
    endif
  enddo
return

2009/1/14 Mindaugas Kavaliauskas <dbto...@dbtopas.lt>:
> Hi,
>
>
>>          http://sphinx.pocoo.org/
>>            - Documentation format
>
> Viktor, can you add some comment about this documentation system. Does
> Sphinx parses source files? Can it parse .prg code?
>
> I'm used to see to sources, but sometimes it would be more quick to look to
> docs for function parameters, etc. I've looked to utils/hbdoc, but could not
> make anything, because hbdoc.exe requires some Norton Guide link file, I was
> not able to find one in SVN.
>
>
> I've also tried to look at a few documentation systems:
> 1) Robodoc creates manual using ugly "section/subsection" headings.
> 2) Doxygen is oriented to object oriented programming style. It tries to
> document classes, methods, etc., but no documentation for functions. Though,
> I was able to manage documentation of functions by including it into
> modules.
> Doxygen analyses code itself (not only documentation inside comments), so,
> it is unable to parse unsupported programming language (i.e. PRG code).
>
>
> Writing a simple source parser (parses documentation tags inside comments),
> it's a few hours job. I think we need one for function documentation.
>
>
>
> Best regards,
> Mindaugas
> _______________________________________________
> Harbour mailing list
> Harbour@harbour-project.org
> http://lists.harbour-project.org/mailman/listinfo/harbour
>



-- 
Massimo Belgrano
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to