LIBs em geral, incluindo sefazclass

Aqui você poderá oferecer suas Contribuições, Dicas e Tutoriais (Texto ou Vídeo) que sejam de interesse de todos.

Moderador: Moderadores

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

LIBs em geral, incluindo sefazclass

Mensagem por JoséQuintas »

Adotei um esquema de trabalho que estou achando legal.
Talvez seja necessário pra Sefazclass, não sei se o Harbour 3.2 está seguindo o mesmo esquema.

Vale a pena entender, porque vale pra qualquer lib.

Postar por parte.
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

LIBs em geral, incluindo sefazclass

Mensagem por JoséQuintas »

Criei \harbour\bin\hbmk.hbc

Este arquivo é usado pra qualquer compilação.
compr=yes
strip=yes
prgflags= -m -n -ge1 -w3 -es2
libpaths=d:/cdrom/fontes/integra/sefazclass d:/cdrom/fontes/integra/josequintas d:\cvsfiles\allgui\allgui
mt=yes
compr=yes

Sempre compacta

strip=yes

Remove informações de debug de C, o que deixa o EXE menor

prgflags= -m -n -ge1 -w3 -es2

O que era default do Harbour antes que é compilar -m -n
Desse jeito cada fonte é compilado separado, e o nome do fonte não importa pra compilação

-ge1

Isso altera o formato de mensagens de erro

-w3 -es2

Compilação tolerância zero. Reclama de cada coisa errada.

libpaths=d:/cdrom/fontes/integra/sefazclass d:/cdrom/fontes/integra/josequintas d:\cvsfiles\allgui\allgui

pasta da sefazclass
pasta da lib josequintas
pasta da allgui que agrupa hmg3, hmgextended, hwgui, oohg,
Apenas indica a pasta dos respectivos arquivos HBC e nada mais.
Isso não inclui nenhuma LIB, apenas deixa as pastas "acessíveis", algo como deixar no PATH do Harbour pra pesquisa automática
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

LIBs em geral, incluindo sefazclass

Mensagem por JoséQuintas »

Na pasta sefazclass, o sefazclass.hbc
Description=any
libs=hbhpdf.hbc hbzebra.hbc hbwin.hbc hbct.hbc sefazclass
libpaths=lib\${hb_plat}\${hb_comp}
Apenas indica as dependências da sefazclass e a pasta da lib sefazclass

a partir deste momento, se eu quiser compilar um programa test.prg

hbmk2 test

se eu quiser compilar juntando a sefazclass

hbmk2 test sefazclass.hbc
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

LIBs em geral, incluindo sefazclass

Mensagem por JoséQuintas »

Na pasta da lib josequintas, o josequintas.hbc
Description=any
libs=josequintas sefazclass.hbc
libs=sefazclass.hbc hbhpdf.hbc hbwin.hbc hbzebra.hbc gtwvg.hbc hbct.hbc hbtip.hbc
libpaths=lib\${hb_plat}\${hb_comp}
incpaths=include
incpaths=..\..\build
Igual anterior: libs de dependência, pasta da lib, também uma pasta de include usada por esta lib.
A pasta build é um utilitário meu, que vai numerando versão automaticamente, entra como #include em alguns fontes
Aqui também já "puxa" a sefazclass.hbc, porque aqui usa funções da outra lib
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

LIBs em geral, incluindo sefazclass

Mensagem por JoséQuintas »

Na pasta allgui tem vários HBC, uma pra cada lib gráfica.
Cada um indica suas pastas de LIB e include.
Aqui cada GUI usa apenas uma LIB, então só tem um nome de lib.
Description=hmge.hbc
incpaths=..\hmge\include
libs=allgui.hbc hmge
No geral todas são assim. só define pasta de arquivos ch, e nome das libs
Como todas ficam no mesmo lugar, usei allgui.hbc que indica a pasta pra todas, assim não precisei repetir a mesma coisa em cada uma.

Pronto.

Supondo que eu tenha test.prg e vá compilar.

Só escolher:

hwgui: hbmk2 test hwgui.hbc
hmgextended: hbmk2 test hmge.hbc
com sefazclass: hbmk2 test sefazclass.hbc
com hwgui + sefazclass: hbmk2 test sefazclass.hbc hwgui.hbc

E por aí vai.

Opcionalmente, poderia deixar a saída do HBX das LIBs para \harbour\addons, pra já entrar na pesquisa automática do hbmk2 -find. ou pras dicas que são mostradas na compilação.
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

LIBs em geral, incluindo sefazclass

Mensagem por JoséQuintas »

De quebra, criei o build.exe pra automatizar algumas coisas.

Código: Selecionar todos


REQUEST errorsys

#include "directry.ch"

FUNCTION Main( ... )

   LOCAL cDateTime, cTxt, nBuildNum, cFileName, cLastPath, aParams

   SetMode( 38, 132 )

   aParams    := hb_AParams()
   cFileName  := hb_FNameDir( hb_ProgName() ) + hb_FNameName( hb_ProgName() )
   cDateTime  := Dtos( Date() ) + Substr( Time(), 1, 2 ) + Substr( Time(), 4, 2 )

   cTxt       := MemoRead( cFileName + ".xml" )

   nBuildNum  := Val( XmlNode( cTxt, "BuildNum" ) ) + 1
   cLastPath  := XmlNode( cTxt, "LastPath" )

   IF ! Upper( cLastPath ) == Upper( hb_cwd() )
      DeleteContent( "c:\temp", .F. )
   ENDIF

   cTxt := "#define JOSEQUINTAS_VERSAO    " + ["]  + Transform( cDateTime, "@R 9999.99.99.9999" ) + ["] + hb_Eol()
   cTxt += "#define JOSEQUINTAS_VERSAO_RC  " + Transform( cDateTime, "@R 9999,99,99,9999" ) + hb_Eol()
   hb_MemoWrit( cFileName + ".ch", cTxt )

   cTxt := XmlTag( "BuildNum", Ltrim( Str( nBuildNum ) ) ) + hb_Eol()
   cTxt += XmlTag( "LastPath", hb_cwd() ) + hb_Eol()
   cTxt += XmlTag( "BuildDate", Dtos( Date() ) ) + hb_Eol()
   cTxt += XmlTag( "BuildTime", Time() ) + hb_Eol()

   hb_MemoWrit( cFileName + ".xml", cTxt )
   Compile( aParams )

   RETURN NIL

STATIC FUNCTION DeleteContent( cFolder, lDeleteFolder )

   LOCAL oFiles, oFile

   hb_Default( lDeleteFolder, .F. )

   ? "Delete " + cFolder
   oFiles := Directory( "c:\temp\*.*" )
   FOR EACH oFile IN oFiles
      IF oFile[ F_ATTR ] == "D"
         IF oFile[ F_NAME ] != "." .AND. oFile[ F_NAME ] != ".."
            DeleteContent( cFolder + "\" + oFile[ F_NAME ], .T. )
         ENDIF
      ELSE
         ? "Deleting " + cFolder + "\" + oFile[ F_NAME ]
         fErase( cFolder + "\" + oFile[ F_NAME ] )
      ENDIF
   NEXT
   IF lDeleteFolder
      DirRemove( cFolder )
   ENDIF

   RETURN NIL

FUNCTION HB_GT_SYS()

   REQUEST HB_GT_WVG_DEFAULT

   RETURN NIL

STATIC FUNCTION Compile( aParams )

   LOCAL oElement, cPath, cCmd

   cPath := Upper( hb_cwd() )

   AAdd( aParams, "-m" )
   AAdd( aParams, "-n" )
   AAdd( aParams, "-w3" )
   AAdd( aParams, "-es2" )
   AAdd( aParams, "-workdir=c:\temp" )
   AAdd( aParams, "-compr" )
   AAdd( aParams, "-strip" )
   AAdd( aParams, "-mt" )
   AAdd( aParams, "-quiet" )
   AAdd( aParams, "-ge1" )
   AAdd( aParams, "-I" + hb_FNameDir( hb_ProgName() ) )
   DO CASE
   CASE "\HMGE\"  $ cPath ; AAdd( aParams, "hmge.hbc" )
   CASE "\HMG3\"  $ cPath ; AAdd( aParams, "hmg3.hbc" )
   CASE "\OOHG"   $ cPath ; AAdd( aParams, "oohg.hbc" )
   CASE "\HWGUI\" $ cPath ; AAdd( aParams, "hwgui.hbc" )
   ENDCASE
   cCmd := "hbmk2"
   IF Len( Directory( "*.hbp" ) ) != 0
      cCmd += " *.hbp"
   ELSEIF Len( Directory( "*.prg" ) ) != 0
     cCmd += " *.prg *.rc"
   ELSEIF Upper( hb_cwd() ) == "D:\CDROM\FONTES\INTEGRA\JOSEQUINTAS\"
     LIBJosequintas()
     cCmd += " *.hbp"
   ELSE
      ? hb_cwd()
      Inkey(0)
   ENDIF
   FOR EACH oElement IN aParams
      cCmd += " " + oElement
   NEXT
   cCmd := ;
      hb_ProgName() + " %*" + hb_Eol() + ;
      cCmd + hb_Eol()
   DO CASE
   CASE "\INTEGRA\"  $ cPath .AND. File( "jpa.exe" );   cCmd += "if not errorlevel 1 assina jpa.exe" + hb_Eol()
   CASE "\HAROLDO\"  $ cPath .AND. File( "hl.exe" );    cCmd += "if not errorlevel 1 assina hl.exe" + hb_Eol()
   CASE "\LABOROIL\" $ cPath .AND. File( "nfe.exe" );   cCmd += "if not errorlevel 1 assina nfe.exe" + hb_Eol()
   CASE "\SJPA\"     $ cPath .AND. File( "..\sjpa.exe" );  cCmd += "if not errorlevel 1 assina ..\sjpa.exe" + hb_Eol()
   CASE "\BUILD\"    $ cPath .AND. File( "build.exe" ); cCmd += "if not errorlevel 1 assina build.exe" + hb_Eol()
   ENDCASE
   hb_MemoWrit( "d:\tools\util\c.bat", cCmd )

   RETURN NIL

STATIC FUNCTION LIBJoseQuintas()

   LOCAL aDir, oElement, cTxt

   ? "LIB JOSEQUINTAS"
  cTxt := ;
     "Description=any" + hb_Eol() + ;
     "libs=josequintas sefazclass.hbc" + hb_Eol() + ;
     "libs=sefazclass.hbc hbhpdf.hbc hbwin.hbc hbzebra.hbc gtwvg.hbc hbct.hbc hbtip.hbc" + hb_Eol() + ;
     "libpaths=lib\${hb_plat}\${hb_comp}" + hb_Eol() + ;
     "incpaths=include" + hb_Eol() + ;
     "incpaths=..\..\build" + hb_Eol()
  hb_MemoWrit( "josequintas.hbc", cTxt )

   cTxt := ""
   aDir := Directory( "source\*.*", "D" )
   FOR EACH oElement IN aDir
      IF "D" $ oElement[ F_ATTR ] .AND. ! oElement[ F_NAME ] $ ".,.."
         cTxt += "source\" + Lower( oElement[ 1 ] ) + "\*.prg" + hb_Eol()
      ENDIF
  NEXT

  FOR EACH oElement IN { ;
      "-workdir=c:\temp", ;
      "-hblib", ;
      "-olib\${hb_plat}\${hb_comp}\${hb_name}", ;
      "-hbx=${hb_name}", ;
      "-w3", ;
      "-es2", ;
      "-m", ;
      "-n" }
      cTxt += oElement + hb_Eol()
   NEXT
   hb_MemoWrit( "josequintas.hbp", cTxt )

  RETURN NIL

Se funciona?
<BuildNum>6710</BuildNum>
<LastPath>d:\cdrom\FONTES\INTEGRA\</LastPath>
<BuildDate>20170731</BuildDate>
<BuildTime>18:49:09</BuildTime>
já foram 6.710 compilações desde a criação disso.
Se não fosse esse controle, nem imaginaria que compilo tanto.
isso sem contar o "por fora", aonde digito hbmk2 e não uso o automático.

Haja compilação.... rs
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

LIBs em geral, incluindo sefazclass

Mensagem por JoséQuintas »

<BuildNum>7094</BuildNum>
<LastPath>d:\cdrom\FONTES\LABOROIL\</LastPath>
<BuildDate>20170805</BuildDate>
<BuildTime>11:58:29</BuildTime>
Quem mandou olhar....
Com essa história de renomear fontes, organizar lib...
384 compilações desde o outro post.
Considerando 5 dias, são quase 80 por dia, ou muitas por hora.... aff
Por acaso já tinham feito um cálculo disso?

Coloquei por curiosidade nesse build.prg, nem tinha idéia de que era tanto.
Isso conta as com e sem sucesso, mas não conta as feitas diretamente com o hbmk2.
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

LIBs em geral, incluindo sefazclass

Mensagem por JoséQuintas »

Isso sempre vai ter diferença.
Olhando agora, "talvez" melhor juntar código e descrição.

de:
FOR EACH oElement IN ::FormatMemoAsArray( ::aItem[ nContx, 2 ], 45 )

para:
FOR EACH oElement IN ::FormatMemoAsArray( ::aItem[ nContx, 1 ] + " " + ::aItem[ nContx, 2 ], 45 )

e aproveitando a rotina de NFE que divide pelo tamanho de impressão, e não pela quantidade de colunas.

Pelo menos acabaria com qualquer necessidade de ajuste adicional, não importando o tamanho do código.
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

LIBs em geral, incluindo sefazclass

Mensagem por JoséQuintas »

hazael escreveu:Outra coisa, não sei se conhece, mas se o seus projetos tiverem o arquivo: proj.hbp então só precirará compilar assim: hbmk2 proj sem precisar adicionar nada, eu uso para todos projetos e é muito prático
Sim, mas de vez em quando queremos testar fontes isolados.
hazael escreveu:é isso que o hbmk2 faz em muitos caso
É que o HBMK2 ao ser chamado já sabe aonde ele está no harbour/bin, e com isso sabe o path do harbour.
se tiver algum parâmetro no hbp que indique o path do hbmk2/harbour, seria uma opção.
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

LIBs em geral, incluindo sefazclass

Mensagem por JoséQuintas »

Criei tempos atrás pra facilitar

Tá em ze_sefazdaDfe.prg
DA=Documento Auxiliar, DFE = tudo que é documento fiscal eletrônico

::FormataMemo( cMemo, nLarguraPDF )

É o mesmo que ::FormatMemoAsArray() mas.....
divide pelo tamanho "impresso" do texto, e não pela quantidade de colunas.

Por herança, está disponível em todas as rotinas de PDF.

Se não me engano, usa o fonte atual pra cálculo, então, dependendo do fonte, primeiro setar no PDF antes de usar a função.
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

LIBs em geral, incluindo sefazclass

Mensagem por JoséQuintas »

Deixei passar a mensagem.
hazael escreveu:Bem, notei outra coisa, se for adicionar imagem (logo), vai perceber que em cada documento tem um formato diferente... o ideal seria manter tudo igual sem achatar, ou esticar, senão fica distorcido.
A impressão usa um tamanho fixo, pra não atrapalhar o texto.
Pra deixar tamanho variável, só se deixar o logotipo no topo.
Mesmo assim, isso vai obrigar que o logotipo seja dimensionado fora da classe, pode ser problema pra quem tem vários clientes.
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/
Responder