Documentação do HARBOUR

Projeto [x]Harbour - Compilador de código aberto compatível com o Clipper.

Moderador: Moderadores

wmanesco
Usuário Nível 3
Usuário Nível 3
Mensagens: 116
Registrado em: 09 Set 2016 13:18
Localização: ITAJAI - SC

Documentação do HARBOUR

Mensagem por wmanesco »

Boa tarde senhores,

Estou fazendo um autocomplete das funções nativas do harbour para o editor atom e preciso de uma lista das funções com/ou sem parametros, descrição, etc. Ou seja, preciso de uma documentação em formato JSON para utilizar no pacote que desenvolvi para auto completar as funções no editor.

No entanto, não consegui algum lugar para encontrar essas funções que esteja de uma maneira "facil" para eu transformar em JSON.

Estava tentando utilizar o harbour.hbd (hb/doc/harbour.hbd) porém a função

Código: Selecionar todos

__hbdoc_LoadHBD( cFileName )
não esta funcionando, esta retornando sempre NIL. Utilizando assim:

Código: Selecionar todos

__hbdoc_LoadHBD( "C:\hb32\doc\harbour.hbd" )
, verifiquei que a função hb_Deserialize() que é a responsavel por "descompilar" o arquivo esta retornando NIL.

A minha segunda opção é ler o HTML do site https://harbour.github.io/doc/harbour.html e gerar esse JSON, porém vai ser um pouco trabalhoso.

Alguém sabe o motivo de não conseguir ler o arquivo HBD? Ou sabe alguma outra possibilidade para eu conseguir essa lista de funções e descrições?

Desde já,

Obrigado
William Manesco
Harbour 3.x | Fivewin | BCC | MySQL (TDolphin) | HBQT | HBIDE | Atom
wmanesco
Usuário Nível 3
Usuário Nível 3
Mensagens: 116
Registrado em: 09 Set 2016 13:18
Localização: ITAJAI - SC

Documentação do HARBOUR

Mensagem por wmanesco »

Infelizmente não, precisava de uma pequena descrição da função, se fosse possível... Mas caso não seja, vou optar por essa opção, agora uma duvida, usando esse comando aqui não é retornada todas as funções, sabe o motivo?

Código: Selecionar todos

hbmk2 -find *
-lhbcplr (installed):
   hb_compileFromBuff()
   hb_compileBuf()
   hb_compile()
hbui.hbc (installed):
   HB_GCREFCOUNT()
   uiBOXAPPEND()
   uiBOXDELETE()
   uiBOXPADDED()
   uiBOXSETPADDED()
   UIBUTTONONCLICKED()
   uiBUTTONSETTEXT()
   uiBUTTONTEXT()
   uiCHECKBOXCHECKED()
   UICHECKBOXONTOGGLED()
   uiCHECKBOXSETCHECKED()
   uiCHECKBOXSETTEXT()
   uiCHECKBOXTEXT()
   uiCOLORBUTTONCOLOR()
   UICOLORBUTTONONCHANGED()
   uiCOLORBUTTONSETCOLOR()
   uiCOMBOBOXAPPEND()
   UICOMBOBOXONSELECTED()
   uiCOMBOBOXSELECTED()
   uiCOMBOBOXSETSELECTED()
   uiCONTROLDESTROY()
   uiCONTROLDISABLE()
   uiCONTROLENABLE()
   uiCONTROLENABLED()
   uiCONTROLENABLEDTOUSER()
   uiCONTROLHANDLE()
   uiCONTROLHIDE()
   uiCONTROLPARENT()
   uiCONTROLSETPARENT()
   uiCONTROLSHOW()
   uiCONTROLTOPLEVEL()
   uiCONTROLVERIFYSETPARENT()
   uiCONTROLVISIBLE()
   uiEDITABLECOMBOBOXAPPEND()
   UIEDITABLECOMBOBOXONCHANGED()
   uiEDITABLECOMBOBOXSETTEXT()
   uiEDITABLECOMBOBOXTEXT()
   UIENTRYONCHANGED()
   uiENTRYREADONLY()
   uiENTRYSETREADONLY()
   uiENTRYSETTEXT()
   uiENTRYTEXT()
   uiFONTBUTTONFONT()
   UIFONTBUTTONONCHANGED()
   uiFORMAPPEND()
   uiFORMDELETE()
   uiFORMPADDED()
   uiFORMSETPADDED()
   uiFREECONTROL()
   uiGRIDAPPEND()
   uiGRIDINSERTAT()
   uiGRIDPADDED()
   uiGRIDSETPADDED()
   uiGROUPMARGINED()
   uiGROUPSETCHILD()
   uiGROUPSETMARGINED()
   uiGROUPSETTITLE()
   uiGROUPTITLE()
   uiInit()
   uiLABELSETTEXT()
   uiLABELTEXT()
   uiMain()
   uiMENUAPPENDABOUTITEM()
   uiMENUAPPENDCHECKITEM()
   uiMENUAPPENDITEM()
   uiMENUAPPENDPREFERENCESITEM()
   uiMENUAPPENDQUITITEM()
   uiMENUAPPENDSEPARATOR()
   uiMENUITEMCHECKED()
   uiMENUITEMDISABLE()
   UIMENUITEMENABLE()
   UIMENUITEMONCLICKED()
   uiMENUITEMSETCHECKED()
   uiMSGBOX()
   uiMSGBOXERROR()
   uiMULTILINEENTRYAPPEND()
   UIMULTILINEENTRYONCHANGED()
   uiMULTILINEENTRYREADONLY()
   uiMULTILINEENTRYSETREADONLY()
   uiMULTILINEENTRYSETTEXT()
   uiMULTILINEENTRYTEXT()
   uiNEWBUTTON()
   uiNEWCHECKBOX()
   uiNEWCOLORBUTTON()
   uiNEWCOMBOBOX()
   uiNEWDATEPICKER()
   uiNEWDATETIMEPICKER()
   uiNEWEDITABLECOMBOBOX()
   uiNEWENTRY()
   uiNEWFONTBUTTON()
   uiNEWFORM()
   uiNEWGRID()
   uiNEWGROUP()
   uiNEWHORIZONTALBOX()
   uiNEWHORIZONTALSEPARATOR()
   uiNEWLABEL()
   uiNEWMENU()
   uiNEWMULTILINEENTRY()
   uiNEWNONWRAPPINGMULTILINEENTRY()
   uiNEWPASSWORDENTRY()
   uiNEWPROGRESSBAR()
   uiNEWRADIOBUTTONS()
   uiNEWSEARCHENTRY()
   uiNEWSLIDER()
   uiNEWSPINBOX()
   uiNEWTAB()
   uiNEWTIMEPICKER()
   uiNEWVERTICALBOX()
   uiNEWVERTICALSEPARATOR()
   uiNEWWINDOW()
   UIOPENFILE()
   uiPROGRESSBARSETVALUE()
   uiPROGRESSBARVALUE()
   uiRADIOBUTTONSAPPEND()
   UIRADIOBUTTONSONSELECTED()
   uiRADIOBUTTONSSELECTED()
   uiRADIOBUTTONSSETSELECTED()
   uiSAVEFILE()
   uiSLIDERONCHANGED()
   uiSLIDERSETVALUE()
   uiSLIDERVALUE()
   uiSPINBOXONCHANGED()
   uiSPINBOXSETVALUE()
   uiSPINBOXVALUE()
   uiTABAPPEND()
   uiTABDELETE()
   uiTABINSERTAT()
   uiTABMARGINED()
   uiTABNUMPAGES()
   uiTABSETMARGINED()
   uiUninit()
   uiWINDOWBORDERLESS()
   uiWINDOWCONTENTSIZE()
   uiWINDOWFULLSCREEN()
   uiWINDOWMARGINED()
   uiWINDOWSETBORDERLESS()
   uiWINDOWSETCHILD()
   uiWINDOWSETCONTENTSIZE()
   uiWINDOWSETFULLSCREEN()
   uiWINDOWSETMARGINED()
   uiWINDOWSETTITLE()
   uiWINDOWTITLE()
   __HBEXTERN__HBUI__()
William Manesco
Harbour 3.x | Fivewin | BCC | MySQL (TDolphin) | HBQT | HBIDE | Atom
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Documentação do HARBOUR

Mensagem por JoséQuintas »

É o Harbour oficial, ou é de algum pacote fechado?
Procure nos arquivos DOC
Ou:

hbmk2 -doc ascan

hbmk2 -doc ascan

AUTHOR
------
Copyright 1999 Luiz Rafael Culik <culik@sl.conex.net>

TEMPLATE
--------
Function

NAME
----
AScan()

CATEGORY
--------
API

SUBCATEGORY
-----------
Array

ONELINER
--------
Scan array elements for a specified condition

SYNTAX
------
AScan( <aArray>, <xSearch>, [<nStart>], [<nCount>] ) --> nStoppedAt

ARGUMENTS
---------
<aArray> Array to be scanned.

<xSearch> Expression to search for in <aTarget>

<nStart> Beginning subscript position at which to start the search.

<nCount> Number of elements to scan with <aTarget>.

RETURNS
-------
<nStoppedAt> A numeric value of subscript position where <xSearch>
was found, or 0 if <xSearch> is not found.

DESCRIPTION
-----------
This function scan the content of array named <aArray> for the
value of <xSearch>. The return value is the position in the array
<aArray> in which <xSearch> was found. If it was not found, the
return value will be 0.

<nStart> is the position from which to start scanning. The default
is 1. (1st element)
<nCount>, if specified, is the number of array elements to be scanned.
The default is all elements in the array <aArray>.

If <xSearch> is a code block, the operation of the function is
slightly different. Each array subscript pointer reference is
passed to the code block to be evaluated. The scanning routine
will continue until the value obtained from the code block is a
logical true (.T.) or until the end of the array has been reached.

EXAMPLES
--------
#include "directry.ch"
LOCAL aDir := hb_vfDirectory( "*.prg" )
? AScan( aDir,,, ;
{| aFile, nPos | HB_SYMBOL_UNUSED( nPos ), aFile[ F_NAME ] == "test.prg" } )

SEEALSO
-------
AEval()


AUTHOR
------
2016 Pete D. <pete_westg@yahoo.gr>

TEMPLATE
--------
Function

NAME
----
hb_AScan()

CATEGORY
--------
API

SUBCATEGORY
-----------
Array

ONELINER
--------
Scan array elements for a specified condition

SYNTAX
------
hb_AScan( <aArray>, <xSearch>, [<nStart>], [<nCount>], [<lExact>] ) --> nPosition

ARGUMENTS
---------
<aArray> Array to be scanned.

<xSearch> Expression to search for in <aArray>

<nStart> Beginning subscript position at which to start the search.
Default value: 1

<nCount> Number of elements to be scanned within <aArray>.
Default value: All elements.

<lExact> Boolean flag specifying if an "Exact" search will be
performed or not. Default value: .F.

RETURNS
-------
<nPosition> A numeric value > 0 indicating the array position
where <xSearch> was found, or 0 if nothing found.

DESCRIPTION
-----------
The function scans (left to right) for <xSearch> into <aArray>
and returns <nPosition> of <aArray> in which <xSearch>
was found or 0 (zero) if nothing found.

If <lExact> is .T., then an exact search will be performed.
When <xSearch> is a code block, the operation of the function
is slightly different. See AScan() for details.

EXAMPLES
--------
LOCAL a := { "there", "here" }
Set( _SET_EXACT, .F. )
? AScan( a, "he" ) // --> 2
? hb_AScan( a, "he",,, .F. ) // --> 2
? hb_AScan( a, "he",,, .T. ) // --> 0

SEEALSO
-------
AScan(), AEval()
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
Vlademiro
Usuário Nível 4
Usuário Nível 4
Mensagens: 752
Registrado em: 11 Jul 2005 02:46

Documentação do HARBOUR

Mensagem por Vlademiro »

Quintas, eu testei esse comando (hbmk2 -doc <funcao>) mas não sai nada. Vc saberia a causa ?

Meu harbour instalado aqui é o

Harbour 3.4.0dev (86f0132) (2017-10-24 11:40)
Copyright (c) 1999-2017, https://github.com/vszakats/harbour-core/
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Documentação do HARBOUR

Mensagem por JoséQuintas »

Talvez dependa dos fontes/docs instalados, talvez exista só no Harbour 3.4...
Só sei que mostrei a saída aqui na minha máquina.
Aliás... pode acessar os arquivos diretamente também.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
Itamar M. Lins Jr.
Administrador
Administrador
Mensagens: 7928
Registrado em: 30 Mai 2007 11:31
Localização: Ilheus Bahia
Curtiu: 1 vez

Documentação do HARBOUR

Mensagem por Itamar M. Lins Jr. »

Ola!

Código: Selecionar todos

2014-03-09 18:19 UTC+0100 Viktor Szakats (vszakats users.noreply.github.com)
  * utils/hbmk2/hbmk2.prg
    + added -doc and -docjson options. If followed by a string (or strings),
      hbmk2 will look it up and display (or output JSON) documentation
      for the given function[s]/command[s].
      E.g.:
         hbmk2 -doc acopy
      [EXPERIMENTAL] [TRANSLATION]
Saudações,
Itamar M. Lins Jr.
Saudações,
Itamar M. Lins Jr.
Avatar do usuário
Itamar M. Lins Jr.
Administrador
Administrador
Mensagens: 7928
Registrado em: 30 Mai 2007 11:31
Localização: Ilheus Bahia
Curtiu: 1 vez

Documentação do HARBOUR

Mensagem por Itamar M. Lins Jr. »

Ola!
Mas rapaz! basta olhar nos fontes do HBMK2 para ver se foi ou não removida e também entender como funciona.
Tem a pasta doc e a pastas docs. Não entendi direito aqui no Linux, mas parece questão de configurar para o parâmetro -doc achar onde estão os docs e os arquivos .HBD's

Código: Selecionar todos

...
     CASE cParamL == "-doc"

         __extra_initenv( hbmk, aArgs, cParam )
         ShowDoc( hbmk, aArgs, .F. )
         RETURN _EXIT_OK

...
STATIC FUNCTION GetListOfHBDFiles( hbmk )

   LOCAL aFiles := {}
   LOCAL aFile

   FOR EACH aFile IN hb_vfDirectory( hbmk[ _HBMK_cHB_INSTALL_DOC ] + hb_ps() + "*.hbd" )
      AAdd( aFiles, hbmk[ _HBMK_cHB_INSTALL_DOC ] + hb_ps() + aFile[ F_NAME ] )
   NEXT

   RETURN aFiles

STATIC PROCEDURE ShowDoc( hbmk, aFunction, lJSON )

   LOCAL cFile
   LOCAL hDoc
   LOCAL cName

   FOR EACH cFile IN GetListOfHBDFiles( hbmk )
      FOR EACH hDoc IN __hbdoc_LoadHBD( cFile )
         IF "NAME" $ hDoc
            cName := Upper( hDoc[ "NAME" ] )
            IF AScan( aFunction, {| tmp | Upper( tmp ) $ cName } ) > 0
               IF lJSON
                  OutStd( hb_jsonEncode( hDoc, .T. ) + hb_eol() )
               ELSE
                  OutStd( hbmk__hbdoc_ToSource( hDoc ) + hb_eol() )
               ENDIF
            ENDIF
Viva o open source!

Saudações,
Itamar M. Lins Jr.
Saudações,
Itamar M. Lins Jr.
wmanesco
Usuário Nível 3
Usuário Nível 3
Mensagens: 116
Registrado em: 09 Set 2016 13:18
Localização: ITAJAI - SC

Documentação do HARBOUR

Mensagem por wmanesco »

É o Harbour oficial, ou é de algum pacote fechado?
É um que baixei de algum lugar, rs, depois vou tentar compilar para ver se da certo.

Esse -doc já serviria pra mim, apesar de dar um pouco mais de trabalho do que tentar usar aquelas funções de manipulação dos arquivos .hbd, por que já traria uma hash com as funções e suas descrições..

Obrigado a todos.
William Manesco
Harbour 3.x | Fivewin | BCC | MySQL (TDolphin) | HBQT | HBIDE | Atom
Avatar do usuário
Itamar M. Lins Jr.
Administrador
Administrador
Mensagens: 7928
Registrado em: 30 Mai 2007 11:31
Localização: Ilheus Bahia
Curtiu: 1 vez

Documentação do HARBOUR

Mensagem por Itamar M. Lins Jr. »

Ola!
Estou fazendo um autocomplete das funções nativas do harbour para o editor atom e preciso de uma lista das funções com/ou sem parametros,
A HBIDE tem isso pronto, basta olhar lá como o Pritpal fez. E olhar os fontes do hbmk2.

Saudações,
Itamar M. Lins Jr.
Saudações,
Itamar M. Lins Jr.
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Documentação do HARBOUR

Mensagem por JoséQuintas »

Até esqueci... quando precisei, criei uma função pra buscar dos fontes PRG.
Veja se ajuda pelo menos numa parte.

https://github.com/JoseQuintas/pnharbou ... arbour.api
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Documentação do HARBOUR

Mensagem por JoséQuintas »

Tem também pra mostrar os nomes

hbmk2 -find *
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
wmanesco
Usuário Nível 3
Usuário Nível 3
Mensagens: 116
Registrado em: 09 Set 2016 13:18
Localização: ITAJAI - SC

Documentação do HARBOUR

Mensagem por wmanesco »

Olá,
Até esqueci... quando precisei, criei uma função pra buscar dos fontes PRG.
Veja se ajuda pelo menos numa parte.

https://github.com/JoseQuintas/pnharbou ... arbour.api
Quintas, ai estão contidas todas as funções? Parece bem completo, posso utilizar esse arquivo aqui vai me ajudar também...

Obrigado.
William Manesco
Harbour 3.x | Fivewin | BCC | MySQL (TDolphin) | HBQT | HBIDE | Atom
wmanesco
Usuário Nível 3
Usuário Nível 3
Mensagens: 116
Registrado em: 09 Set 2016 13:18
Localização: ITAJAI - SC

Documentação do HARBOUR

Mensagem por wmanesco »

Olá.

Compilei o harbour aqui, usei o hbdoc.exe p/ gerar a documentação em XML, fiz o parse em um site para json. Esta tudo resolvido.

Agradeço a todos.
William Manesco
Harbour 3.x | Fivewin | BCC | MySQL (TDolphin) | HBQT | HBIDE | Atom
Avatar do usuário
Vlademiro
Usuário Nível 4
Usuário Nível 4
Mensagens: 752
Registrado em: 11 Jul 2005 02:46

Documentação do HARBOUR

Mensagem por Vlademiro »

wmanesco, como você fez ?

Valeu
wmanesco
Usuário Nível 3
Usuário Nível 3
Mensagens: 116
Registrado em: 09 Set 2016 13:18
Localização: ITAJAI - SC

Documentação do HARBOUR

Mensagem por wmanesco »

Boa tarde,

esse arquivo em anexo é o json que eu gerei a partir do XML gerado pelo hbdoc.exe.

Depois rodei esse programa pra gerar o JSON que eu precisava para o auto complete do ATOM.

Código: Selecionar todos

procedure Main()

   local hJSON, hEntry, hCompletionsAtom

   HB_JSONDecode( MemoRead('funcoes_harbour.json'), @hJSON)

   //? hb_valtoexp(hJSON)

   hCompletionsAtom := hb_Hash()
   hCompletionsAtom["keywords"] := HB_Hash()
   for each hEntry in hJSON["HarbourReference", "Entry"]
      if hEntry["TEMPLATE"] == "Function"
         hCompletionsAtom["keywords"][ StrTran( StrTran( hEntry["NAME"], '(' ), ')' ) ] := HB_Hash()
         hCompletionsAtom["keywords"][ StrTran( StrTran( hEntry["NAME"], '(' ), ')' ) ][ "text"               ] := hEntry["NAME"]
         hCompletionsAtom["keywords"][ StrTran( StrTran( hEntry["NAME"], '(' ), ')' ) ][ "snippet"            ] := hEntry["NAME"]
         hCompletionsAtom["keywords"][ StrTran( StrTran( hEntry["NAME"], '(' ), ')' ) ][ "prefix "            ] := StrTran( StrTran( hEntry["NAME"], '(' ), ')' )
         hCompletionsAtom["keywords"][ StrTran( StrTran( hEntry["NAME"], '(' ), ')' ) ][ "type"               ] := "function"
         hCompletionsAtom["keywords"][ StrTran( StrTran( hEntry["NAME"], '(' ), ')' ) ][ "description"        ] := hEntry["ONELINER"] + "\n" + hEntry["SYNTAX"] + "\n\n" + hEntry["RETURNS"]
         hCompletionsAtom["keywords"][ StrTran( StrTran( hEntry["NAME"], '(' ), ')' ) ][ "descriptionMoreURL" ] := "https://harbour.github.io/doc/harbour.html#" + Lower( StrTran( StrTran( hEntry["NAME"], '(' ), ')' ) )
         hCompletionsAtom["keywords"][ StrTran( StrTran( hEntry["NAME"], '(' ), ')' ) ][ "rightLabel"         ] := hEntry["SUBCATEGORY"]
      endif
   next

   MemoWrit( "completions.json", StrTran( hb_jsonencode(hCompletionsAtom), '\\n', '\n' ) )

return
O resultado no editor atom é esse:

http://prntscr.com/lgcvii

OBS: Não consegui postar a foto aqui, olhe o link :(
Anexos
funcoes_harbour.txt
JSON gerado a partir do XML do hbdoc.exe
(616.97 KiB) Baixado 317 vezes
William Manesco
Harbour 3.x | Fivewin | BCC | MySQL (TDolphin) | HBQT | HBIDE | Atom
Responder