Página 2 de 2

Antonio Linares não conhece Harbour

Enviado: 30 Jan 2020 21:31
por JoséQuintas
Vai eliminar algumas variáveis, e trechos de fonte, agora que ele aprendeu a instalar o Harbour kkkkk

Por esse fonte, deu pra entender que era exatamente o que eu pensava.
Exatamente o que tem dentro do HBMK2, compilando em run-time, usando DLLs, acrescentando ch, etc.

Se a parte mais usada vai ser html/css/etc., pra quem só usa Harbour não vai ajudar muito.

Mas nada impede de criarem rotinas padrão, que possam ficar disponíveis...

Antonio Linares não conhece Harbour

Enviado: 30 Jan 2020 21:37
por JoséQuintas
Segue meu protótipo de 2003, de gerar HTML/ASP
Quase 20 anos atrás, e sem dar sequência, então é fraco.

Código: Selecionar todos

/*
GE_HTCA - GERA FONTES DE HTML
2003.11 José Quintas
*/

#include "gera.ch"

MEMVAR mEsteDbf, mNumDbf, LblIndex, m_NumPrg, mQtFrame, mNomeFrm, mIniFrame
MEMVAR mNumFrame, m_Dbf

PROCEDURE ge_html

   LOCAL oElement, mLimite, cNome, cLen, cDec, cType, nTop

   PARAMETERS m_Dbf, mNumDbf

   mEsteDbf := CarregaConfig()[ mNumDbf, 2 ]

   lblIndex := 1 // Numero inicial de label

   mNomeFrm := "P" + StrZero( m_NumPrg, 4 )

   mLimite   := 17  // Limite de campos por pagina
   mQtFrame  := Int( ( Len( mEsteDbf ) / mLimite ) + 0.99 ) // Qtde.de paginas que vai ter
   SET PRINTER TO ( mNomeFrm + ".HTM" )
   SET PRINT   ON
   SET CONSOLE OFF
   ?[ < body > ]
   ?[ < FORM action = "nothing.asp" method = "post" name = "]+mNomeFrm+[" > ]
   ?[ < table witdh = "100%" > ]

   // Definicao do formulario

   nTop := 360
   mNumFrame := 1
   mIniFrame := .T.
   // mNumInd := 12
   FOR EACH oElement IN mEsteDbf
      cNome    := oElement[ SY_NAME ]
      cLen     := oElement[ SY_LEN ]
      cDec     := oElement[ SY_DEC ]
      cType    := oElement[ SY_TYPE ]
      cLen     := cLen + iif( cDec > 0, cDec + 1, 0 ) + 1
      ?[ < tr > ]
      ?[ < td width = "20%" > ]
      // "txt"+cNome
      HtmTextBox( ;
         Trim( oElement[ SY_TXT ] ), nTop, 1440, cLen * 150, ; // Name, Top, Left, Width
         iif( cType == "D", 10, cLen ), ; // MaxLength
         iif( cType == "N", 1, 0 ), ; // Alignment
         iif( cType == "N", "Numero Valido", ;       // Tooltip
         iif( cType == "D", "Data Valida", ;         // conforme
         "Texto Valido" ) ) + " para " + Trim( cNome ) ) // Tipo
      ?[ < / td > ]
      ?[ < td width = "80%" > ]
      HtmLabel( "txt" + Trim( oElement[ SY_TXT ] ), Trim( oElement[ SY_TXT ] ) + ":", nTop, 120, 1335 )
      ?[ < / td > ]
      ?[ < / tr > ]
      // IF ! Empty(mEsteDbf[nCont,SY_SFILE])
      // HtmLabel("lblValid"+Ltrim(Str(nCont)),"",nTop,1440+150+cLen*150,30*150)
      // endif

      nTop += 320
   NEXT
   ?[ < / table > ]
   ?[ < table > ]
   ?[ < tr > ]
   HtmButtom( "CmdConsulta", "Consulta", 1000, 120, 5, "Visualizar Lista Com Cadastros" )
   HtmButtom( "CmdAnterior", "Anterior", 1000, 1200, 0, "Cadastro Anterior" )
   HtmButtom( "CmdUltimo", "Ultimo", 1000, 4440, 0, "Ultimo Cadastro" )
   HtmButtom( "CmdPrimeiro", "Primeiro", 1000, 3360, 0, "Primeiro Cadastro" )
   HtmButtom( "CmdSeguinte", "Seguinte", 1000, 2280, 0, "Cadastro Seguinte" )
   HtmButtom( "CmdSair", "Sair", 1480, 6600, 8, "Sair Deste Modulo" )
   HtmButtom( "CmdCancela", "Cancela", 1480, 5520, 7, "Abandonar Dados Digitados Sem Salvar" )
   ?[ < / tr > ]
   ?[ < tr > ]
   HtmButtom( "CmdConfirma", "Confirma", 1480, 4440, 6, "Confirmar e Salvar Dados Digitados" )
   HtmButtom( "CmdLocaliza", "Localiza", 1480, 3360, 9, "Localizar Codigo Especifico" )
   HtmButtom( "CmdExclui", "Exclui", 1480, 2280, 4, "Excluir Cadastro Existente" )
   HtmButtom( "CmdAltera", "Altera", 1480, 1200, 3, "Alterar Cadastro Existente" )
   HtmButtom( "CmdInclui", "Inclui", 1480, 120, 2, "Incluir um Novo Cadastro" )
   HtmButtom( "CmdPagAnt", "Pag.Ant", 1480, 5520, 10, "Pagina Anterior de Informacoes" )
   HtmButtom( "CmdPagSeg", "Pag.Seg", 1480, 6600, 11, "Proxima Pagina de Informacoes" )
   ?[ < / tr > ]
   ?[ < / table > ]

   ?[ < / form > ]
   ?[ < / body > ]
   HtCaCodigo()
   SET PRINT   OFF
   SET PRINTER TO
   SET CONSOLE ON

   RETURN

STATIC FUNCTION HtmButtom( mName, mCaption, mTop, mLeft, mTabIndex, mToolTipText )

   ?[ < td > ]
   mTop := Int( mTop / 10 )
   mLeft := Int( mLeft / 10 )
   // ? [<OBJECT ID="] + mName + ["]
   // ? [   CLASSID="CLSID:D7053240-CE69-11CD-A777-00DD01143C57" ]+ ;
   // [STYLE="TOP:]+Ltrim(Str(mTop))+[pt;]+ ;
   // [LEFT:]+Ltrim(Str(mLeft))+[pt;]+ ;
   // [WIDTH:80pt;HEIGHT:20pt;TABINDEX:]+Ltrim(Str(mTabIndex))+[;ZINDEX:]+Ltrim(Str(mTabIndex))+[;">]
   // ? [      <PARAM NAME="Caption" VALUE="]+mCaption+[">]
   // ? [      <PARAM NAME="Size" VALUE="2911;873">]
   // ? [      <PARAM NAME="FontCharSet" VALUE="0">]
   // ? [      <PARAM NAME="FontPitchAndFamily" VALUE="2">]
   // ? [      <PARAM NAME="ParagraphAlign" VALUE="3">]
   // ? [      <PARAM NAME="FontWeight" VALUE="0">]
   // ? [</OBJECT>]
   ?[ < INPUT type = "button" name = "]+mName+[" value = "]+mCaption+[" onclick = "]+mName+[()" > ]
   ?[ < / td > ]
   HB_SYMBOL_UNUSED( mTabIndex + mTooltipText )

   RETURN NIL

STATIC FUNCTION HtmTextBox( txtNome, txtTop, txtLeft, txtWidth, txtMaxLen, txtAlign, txtToolTip )

   txtTop := Int( txtTop / 10 )
   txtLeft := Int( txtLeft / 10 )
   txtMaxLen := Int( txtMaxLen / 10 )
   IF txtWidth > 7200
      txtWidth := 7200
   ENDIF
   ? txtNome
   // ? txtNome
   // ? [<OBJECT ID="]+txtNome+["]
   // ? [CLASSID="CLSID:8BD21D10-EC42-11CE-9E0D-00AA006002F3" STYLE="TOP:]+Ltrim(Str(txtTop))+[pt;LEFT:]+Ltrim(Str(txtLeft))+[pt;WIDTH:]+Ltrim(Str(txtWidth))+[pt;HEIGHT:20pt;] // TABINDEX:]+Ltrim(Str(mTabIndex))+[;ZINDEX:]+Ltrim(Str(mTabIndex))+[;">]
   // ? [   <PARAM NAME="VariousPropertyBits" VALUE="746604571">]
   // ? [   <PARAM NAME="Size" VALUE="3783;873">]
   // ? [   <PARAM NAME="FontCharSet" VALUE="0">]
   // ? [   <PARAM NAME="FontPitchAndFamily" VALUE="2">]
   // ? [   <PARAM NAME="FontWeight" VALUE="0">]
   // ? [</OBJECT>]
   // mTabIndex += 1
   HB_SYMBOL_UNUSED( txtAlign + txtTooltip )

   RETURN NIL

STATIC FUNCTION HtmLabel( lblNome, lblCaption, lblTop, lblLeft, lblWidth )

   lblTop := Int( lblTop / 10 )
   lblLeft := Int( lblLeft / 10 )
   lblWidth := Int( lblWidth / 10 )
   IF Type( "lblIndex" ) != "N"
      lblIndex = 0
   ENDIF
   ?[ < INPUT type = "text" name = "]+lblNome+[" > ]
   // ? [<OBJECT ID="]+lblNome+["]
   // ? [CLASSID="CLSID:978C9E23-D4B0-11CE-BF2D-00AA003F40D0" STYLE="TOP:]+Ltrim(Str(lblTop))+ ;
   // [pt;LEFT:]+Ltrim(Str(lblLeft))+[pt;WIDTH:]+Ltrim(Str(lblWidth))+[pt;HEIGHT:20pt;]+ ;
   // [ZINDEX:]+Ltrim(Str(lblIndex))+[;">]
   // ? [   <PARAM NAME="Caption" VALUE="Label2">]
   // ? [   <PARAM NAME="Size" VALUE="2328;873">]
   // ? [   <PARAM NAME="FontCharSet" VALUE="0">]
   // ? [   <PARAM NAME="FontPitchAndFamily" VALUE="2">]
   // ? [   <PARAM NAME="FontWeight" VALUE="0">]
   // ? [</OBJECT>]
   lblIndex += 1
   HB_SYMBOL_UNUSED( lblCaption )

   RETURN NIL

STATIC FUNCTION HtCaCodigo()

   LOCAL oElement

   ?[ < Script Language = "VBScript" > ]
   ?[ PRIVATE Sub CmdPrimeiro_Click() ]
   ?[ Dim cNovoCodigo As String ]
   ?[ cNovoCodigo = RecFirst( "] + m_Dbf + [", "] + mEsteDbf[1,SY_NAME] + [" ) ]
   ?[ IF Len( Trim( cNovoCodigo ) ) <> 0 Then ]
   ?[   IF txt ] + mEsteDbf[ 1, SY_NAME ] + [.Text <> cNovoCodigo Then]
   ?[      txt ] + mEsteDbf[ 1, SY_NAME ] + [.Text = cNovoCodigo]
   ?[         PegaDados txt ] + mEsteDbf[ 1, SY_NAME ] + [.Text]
   ?[   END IF ]
   ?[ END IF ]
   ?[ END Sub ]
   ?

   ?[ PRIVATE Sub CmdUltimo_Click() ]
   ?[ Dim cNovoCodigo As String ]
   ?[ cNovoCodigo = RecLast( "] + m_Dbf + [", "] + mEsteDbf[1,SY_NAME] + [" ) ]
   ?[ IF Len( Trim( cNovoCodigo ) ) <> 0 Then ]
   ?[   IF txt ] + mEsteDbf[ 1, SY_NAME ] + [.Text <> cNovoCodigo Then]
   ?[      txt ] + mEsteDbf[ 1, SY_NAME ] + [.Text = cNovoCodigo]
   ?[      PegaDados txt ] + mEsteDbf[ 1, SY_NAME ] + [.Text]
   ?[   END IF ]
   ?[ END IF ]
   ?[ END Sub ]
   ?

   ?[ PRIVATE Sub CmdSeguinte_Click() ]
   ?[ Dim cNovoCodigo As String ]
   ?[ cNovoCodigo = RecNext( "] + m_Dbf + [", "] + mEsteDbf[1,SY_NAME] + [", txt ] + mEsteDbf[ 1, SY_NAME ] + [.Text)]
   ?[ IF Len( Trim( cNovoCodigo ) ) <> 0 Then ]
   ?[   IF txt ] + mEsteDbf[ 1, SY_NAME ] + [.Text <> cNovoCodigo Then]
   ?[      txt ] + mEsteDbf[ 1, SY_NAME ] + [.Text = cNovoCodigo]
   ?[      PegaDados txt ] + mEsteDbf[ 1, SY_NAME ] + [.Text]
   ?[   END IF ]
   ?[ END IF ]
   ?[ END Sub ]
   ?

   ?[ PRIVATE Sub CmdAnterior_Click() ]
   ?[ Dim cNovoCodigo As String ]
   ?[ cNovoCodigo = RecPrevious( "] + m_Dbf + [", "] + mEsteDbf[1,SY_NAME] + [", txt ] + mEsteDbf[ 1, SY_NAME ] + [.Text)]
   ?[ IF Len( Trim( cNovoCodigo ) ) <> 0 Then ]
   ?[   IF txt ] + mEsteDbf[ 1, SY_NAME ] + [.Text <> cNovoCodigo Then]
   ?[      txt ] + mEsteDbf[ 1, SY_NAME ] + [.Text = cNovoCodigo]
   ?[      PegaDados txt ] + mEsteDbf[ 1, SY_NAME ] + [.Text]
   ?[   END IF ]
   ?[ END IF ]
   ?[ END Sub ]
   ?

   ?[ PRIVATE Sub CmdSair_Click() ]
   ?[   Unload Me ]
   ?[ END Sub ]
   ?
   ?[ PRIVATE Sub PegaDados( mChave ) ]
   ?[ Dim Rs As NEW ADODB.Recordset ]
   ?[ Dim cSql As String ]
   ?[ cSql = "SELECT * FROM ] + m_Dbf + [ WHERE ] + mEsteDbf[1,SY_NAME] + ;
      [ = '" & mChave & "'"]
   ?[ Rs.Open cSql, cnBanco, adOpenStatic, adLockReadOnly ]
   FOR EACH oElement IN mEsteDbf
      ?[ txt ] + Pad( oElement[ SY_NAME ] + [.Text], 15 ) + [ = LerCampo] + ;
         iif( oElement[ SY_TYPE ] == "M", "C", oElement[ SY_TYPE ] ) + ;
         [(Rs,] + Quoted( oElement[ SY_NAME ] ) + [)]
   NEXT
   ?[ SET Rs = Nothing ]
   // for nCont = 1 to Len(mEsteDbf)
   // IF ! Empty(mEsteDbf[nCont,SY_SFILE])
   // ? [txt] + mEsteDbf[nCont,SY_NAME] + [_Validate]
   // Endif
   // next

   ?[ END Sub ]
   ?[ [ / Script > ]
   ?

   RETURN NIL

Antonio Linares não conhece Harbour

Enviado: 30 Jan 2020 21:52
por Itamar M. Lins Jr.
Ola!
As chamadas do apache, estão bem explicadas no próprio site do apache, segundo ele explica.
São essas "ap_" tipo HB_FUNC( AP_RPUTS ), HB_FUNC( AP_FILENAME ), HB_FUNC( AP_ARGS ), HB_FUNC( AP_METHOD )...
Ele só colocou dentro do harbour para poder conversar com o apache.
O resto ele foi montando. HB_CompileFromBuf() e outras que tem até no site do Kresin(Hwgui), exemplos.
Até onde entendo.
Mas se ele não fizesse esse movimento não teria chamado a atenção das pessoas.

Saudações,
Itamar M. Lins Jr.

Antonio Linares não conhece Harbour

Enviado: 30 Jan 2020 22:07
por Itamar M. Lins Jr.
Ola!
Quase 20 anos atrás, e sem dar sequência, então é fraco.
Não importa.
O importante é que esse conhecimento não foi perdido. Não acabaram com HTML continua ai a linguagem de marcação.
Pior se fosse desenhos de telas com linguagem(particular) quem nem iria existir nesses tempos. Algum form do VFP por exemplo.
A lógica é a mesma, tudo igual, não mudou nada.

Saudações,
Itamar M. Lins Jr.