Página 1 de 1
Equivalente a TEXT
Enviado: 27 Set 2013 20:33
por JoséQuintas
Fui pegar meu gerador de programas Clipper/VB pra converter pra Harbour e descobri que o Harbour não tem a função TEXT
Existe algum equivalente?
Queria só evitar mexer em muito fonte.
Equivalente a TEXT
Enviado: 27 Set 2013 21:22
por Toledo
Amigo José, o que a função TEXT faz e quais os parâmetros que são passados para ela?
Abraços,
Equivalente a TEXT
Enviado: 28 Set 2013 00:11
por alxsts
Olá!
Bela desenterrada Quintas!
TEXT*
Display a literal block of text
------------------------------------------------------------------------------
Syntax
TEXT [TO PRINTER] [TO FILE <xcFile>]
<text>...
ENDTEXT
Arguments
<text> is the block of literal characters to display to the screen.
Text is displayed exactly as formatted.
TO PRINTER echoes the display to the printer.
TO FILE <xcFile> echoes the display to the specified file. <xcFile>
may be specified as a literal filename or as a character expression
enclosed in parentheses. If no extension is specified, (.txt) is
assumed.
Description
TEXT...ENDTEXT is a console command construct that displays a block of
text to the screen, optionally echoing output to the printer and/or a
text file. To suppress output to the screen while printing or echoing
output to a file, SET CONSOLE OFF before the TEXT command line.
Text within the TEXT construct displays exactly as formatted, including
any indentation. Hard carriage returns are output as new lines, soft
carriage returns as the character CHR(141). Macro variables found
within TEXT...ENDTEXT are expanded. However, macro expressions are not.
TEXT...ENDTEXT is a compatibility command and not recommended.
CA-Clipper has other facilities for text processing and output. For
example, MEMOLINE() in combination with MLCOUNT() can word wrap long
strings according to a specified line length. ? or @...SAY can display
formatted text extracted from a long string with MEMOLINE().
Examples
. This example demonstrates how to use TEXT...ENDTEXT to print a
form letter:
USE Sales NEW
DO WHILE !EOF()
FormLetter()
SKIP
ENDDO
RETURN
FUNCTION FormLetter
LOCAL dDate := DTOC(DATE()), cSalesman := ;
RTRIM(Salesman)
TEXT TO PRINTER
&dDate.
Dear &cSalesman.,
How are you!
ENDTEXT
EJECT
RETURN NIL
Files: Library is CLIPPER.LIB.
TEXT... END TEXT é um comando e não função, ultra obsoleto. Talvez por isso não tenha no Harbour. Creio que dá para trocar por ?,??,QOut() QQOut().
Equivalente a TEXT
Enviado: 28 Set 2013 02:59
por Pablo César
O Harbour é o Harbour !!! quer melhor que isso para migração do Clipper ?? Só o Harbour, mesmo !
Resposta aos colegas: SIM, ele possui o mesmo comando que no Clipper. Dois dias atrás tinha compilado e visto que isso funciona e é muito útil para inserir textos e gravá-los em arquivo ou diretamente a impressora.
Código: Selecionar todos
Function Main()
TEXT TO FILE ("file.txt")
TESTE 1
TESTE 2
TESTE 3
ENDTEXT
Return Nil
Equivalente a TEXT
Enviado: 28 Set 2013 09:39
por JoséQuintas
Aqui está desconsiderando o text.
Imaginem um gerador de fontes, com algo assim:
Código: Selecionar todos
text
procedure Teste()
do while .not. eof()
? &ccampo
skip
enddo
endtext
na hora de compilar, o Harbour está considerando inclusive as funções dentro de text, e não deveria, já que isso vai pra o fonte sendo gerado.
É que é muita coisa pra alterar pra outra forma que não seja text.
Isso sem falar em aspas ou colchetes que vão atrapalhar mudar pra ?
Usando Harbour 3.2, não sei se precisa algum include diferente.
Equivalente a TEXT
Enviado: 28 Set 2013 10:23
por Euclides
Olá pessoal.
Isso realmente merece o prêmio de "Pá de Ouro". Há mais de vinte anos que não utilizo TEXT e ENDTEXT.
O problema apresentado existe por causa do macro-substituição. (o Clipper 5.3 se comporta exatamente como o Harbour)
Pode ser contornado assim:
? &(ccampo) (em vez de ? &ccampo e tem que declarar ccampo)
Deu para matar a saudade, um abraço a todos.
Euclides
Equivalente a TEXT
Enviado: 01 Out 2013 13:34
por JoséQuintas
Desculpem, foi orelhada mesmo.
um espaço em branco no hbp, após -o, fez carregar duas vezes o módulo principal.
Como Main() só tinha no principal e no TEXT, fui logo supondo que era o text.
Equivalente a TEXT
Enviado: 07 Out 2013 21:57
por Netavin
... "Amigo José" , o que ...
Foi inevitável pensar no Louro José agora....
Abraço !