Recompiling Old Summer87 Program

Fórum sobre a linguagem CA-Clipper.

Moderador: Moderadores

marge0512
Usuário Nível 3
Usuário Nível 3
Mensagens: 121
Registrado em: 20 Mai 2011 12:42
Localização: United States

Recompiling Old Summer87 Program

Mensagem por marge0512 »

I have a feeling I may know what it is.....when I compile letter.prg without -l, I get this:

C:\LET_1902>clipper letter
Clipper (R) 5.2e
Copyright (c) 1985-1995, Computer Associates Internationa
Microsoft C Floating Point Support Routines
Copyright (c) Microsoft Corp 1984-1987. All Rights Reser
311K available
Compiling LETTER.PRG
Compiling STD_INIT.PRG
Compiling BORDERS.PRG
Compiling VAR_INIT.PRG
Compiling U_SCROLL.PRG
Compiling SAV_SCRN.PRG
Cannot open, assumed external
Compiling SCRL_RET.PRG
Compiling RST_SCRN.PRG
Cannot open, assumed external
Compiling READ_REC.PRG
Compiling WRIT_REC.PRG
Compiling SCRL_TOS.PRG
Compiling LJ_SETUP.PRG
Compiling STD_SETS.PRG
Compiling STD_CLRS.PRG
Compiling STD_MSGS.PRG
Compiling U_SKIP.PRG
Compiling U_SKIP_B.PRG
Code size 13173, Symbols 4592, Constants 4283

I have SAV_SCRN and RST_SCRN located in my EXTRA.PRG (which is what I renamed my Functions.prg). I compiled EXTRA.PRG first (clipper Extra) and then my LETTER.PRG (clipper Letter) and then reran my .BAT file and still get the above error. I don't understand why it will not recognize SAV_SCRN and RST_SCRN even when I made sure I compiled them under 5.2. I think once these are recognized, my system may be better??
Avatar do usuário
Pablo César
Usuário Nível 7
Usuário Nível 7
Mensagens: 5312
Registrado em: 31 Mai 2006 10:22
Localização: Curitiba - Paraná

Recompiling Old Summer87 Program

Mensagem por Pablo César »

Ohhh one light !
I have SAV_SCRN and RST_SCRN located in my EXTRA.PRG (which is what I renamed my Functions.prg).
So, in this case could split EXTRA.PRG into SAV_SCRN.prg and RST_SCRN.prg ? Otherwise you will need to find "DO SAV_SCRN" and "DO RST_SCRN" in which Clipper call these modules for compiling and execute too (this is a old way for development) and replace for their functions names.

Let-me ask: in those in EXTRA.PRG is there these functions names SAV_SCRN or RST_SCRN ?
I don't understand why it will not recognize SAV_SCRN and RST_SCRN even when I made sure I compiled them under 5.2. I think once these are recognized, my system may be better??
It is by the reason it is not called as function names (in EXTRA.PRG) or modules names which should it be separated (two prgs).
I have a feeling I may know what it is.....when I compile letter.prg without -l, I get this:

C:\LET_1902>clipper letter
Clipper (R) 5.2e
Copyright (c) 1985-1995, Computer Associates Internationa
Microsoft C Floating Point Support Routines
Copyright (c) Microsoft Corp 1984-1987. All Rights Reser
311K available
Compiling LETTER.PRG
Compiling STD_INIT.PRG
Compiling BORDERS.PRG
Compiling VAR_INIT.PRG
Compiling U_SCROLL.PRG
Compiling SAV_SCRN.PRG
Cannot open, assumed external
Compiling SCRL_RET.PRG
Compiling RST_SCRN.PRG
Cannot open, assumed external
Compiling READ_REC.PRG
Compiling WRIT_REC.PRG
Compiling SCRL_TOS.PRG
Compiling LJ_SETUP.PRG
Compiling STD_SETS.PRG
Compiling STD_CLRS.PRG
Compiling STD_MSGS.PRG
Compiling U_SKIP.PRG
Compiling U_SKIP_B.PRG
Code size 13173, Symbols 4592, Constants 4283
IMHO, you should compile like this but need to split EXTRA.PRG in SAV_SCRN.PRG and RST_SCRN.PRG !!
Um clip-abraço !

Pablo César Arrascaeta
Compartilhe suas dúvidas e soluções com todos os colegas aqui do fórum.
Evite enviar as dúvidas técnicas por MPs ou eMails, assim todos iremos beneficiar-nos.
marge0512
Usuário Nível 3
Usuário Nível 3
Mensagens: 121
Registrado em: 20 Mai 2011 12:42
Localização: United States

Recompiling Old Summer87 Program

Mensagem por marge0512 »

Yes, EXTRA.PRG has many functions stored in it. RST_SCRN and SAV_SCRN are stored there also. I will divide them into two separate programs and try it. Thanks!
Avatar do usuário
Pablo César
Usuário Nível 7
Usuário Nível 7
Mensagens: 5312
Registrado em: 31 Mai 2006 10:22
Localização: Curitiba - Paraná

Recompiling Old Summer87 Program

Mensagem por Pablo César »

Good !
Um clip-abraço !

Pablo César Arrascaeta
Compartilhe suas dúvidas e soluções com todos os colegas aqui do fórum.
Evite enviar as dúvidas técnicas por MPs ou eMails, assim todos iremos beneficiar-nos.
marge0512
Usuário Nível 3
Usuário Nível 3
Mensagens: 121
Registrado em: 20 Mai 2011 12:42
Localização: United States

Recompiling Old Summer87 Program

Mensagem por marge0512 »

Hi! Ok, I tried that. Now I am getting:

Error C2021 Redefinition of procedure or function: 'RST_SCRN'.

I don't understand why the compiler doesn't recognize that function but gives this error when it does. I am researching and found that this function is in the clipper lib but it doesn't have the same name. It is named _SAVESCR in the clipper lib.
alxsts
Colaborador
Colaborador
Mensagens: 3092
Registrado em: 12 Ago 2008 15:50
Localização: São Paulo-SP-Brasil

Recompiling Old Summer87 Program

Mensagem por alxsts »

Hi!

This happens when the .PRG fine name is the same of the program main procedure or function. RST_SCRN.PRG has a procedure or function named RST_SCRN inside it. Clipper automatically generates a function with the same name of the .PRG file.

To avoid this, add the /N command line switch: Clipper RST_SCRN /L /N
[]´s
Alexandre Santos (AlxSts)
marge0512
Usuário Nível 3
Usuário Nível 3
Mensagens: 121
Registrado em: 20 Mai 2011 12:42
Localização: United States

Recompiling Old Summer87 Program

Mensagem por marge0512 »

Thank you! That compiled fine but how do i stop this error from showing when I do: Clipper LETTER ?
marge0512
Usuário Nível 3
Usuário Nível 3
Mensagens: 121
Registrado em: 20 Mai 2011 12:42
Localização: United States

Recompiling Old Summer87 Program

Mensagem por marge0512 »

Ok, sorry. That was a stupid question but I compiled LETTER with /n and got rid of that error but i get a BUNCH of these errors:

U_SKIP.PRG(28) Error C2006 Statement not allowed outside procedure or function
alxsts
Colaborador
Colaborador
Mensagens: 3092
Registrado em: 12 Ago 2008 15:50
Localização: São Paulo-SP-Brasil

Recompiling Old Summer87 Program

Mensagem por alxsts »

Hi!

You must add /N to all Clipper calls where the .PRG file name matches it's main function.

This may look strange. It's due to Clipper compatibility with dBase. In dBase and Clipper, a main procedure or function name is not mandatory but Clipper always generates it internally. So, you must tell Clipper not to create it's own procedure name when you have yours.
[]´s
Alexandre Santos (AlxSts)
Avatar do usuário
Pablo César
Usuário Nível 7
Usuário Nível 7
Mensagens: 5312
Registrado em: 31 Mai 2006 10:22
Localização: Curitiba - Paraná

Recompiling Old Summer87 Program

Mensagem por Pablo César »

RST_SCRN is function or PRG name ?
When you split EXTRA.PRG in SAV_SCRN.prg and RST_SCRN.prg inside of each SAV_SCRN.prg and RST_SCRN.prg, are mentioning:

Function SAV_SCRN or Procedure SAV_SCRN ?
Function RST_SCRN or Procedure RST_SCRN ?

Other questions:

1. In EXTRA.PRG remain anything extra code not being from SAV_SCRN.prg and RST_SCRN.prg ?
2. In case there is nothing alse than SAV_SCRN.prg and RST_SCRN.prg. In your linking with BLINKER, do you took out EXTRA ?
Um clip-abraço !

Pablo César Arrascaeta
Compartilhe suas dúvidas e soluções com todos os colegas aqui do fórum.
Evite enviar as dúvidas técnicas por MPs ou eMails, assim todos iremos beneficiar-nos.
marge0512
Usuário Nível 3
Usuário Nível 3
Mensagens: 121
Registrado em: 20 Mai 2011 12:42
Localização: United States

Recompiling Old Summer87 Program

Mensagem por marge0512 »

RST_SCR and SAV_SCR are actually procedures. I named them as .prgs when I took them out of EXTRA.PRG. There are many functions stored in EXTRA.PRG and some of those functions call for SAV_SCR and RST_SCR but no, I do not have EXTRA listed in my linking with Blinker. I took it out.
Avatar do usuário
Pablo César
Usuário Nível 7
Usuário Nível 7
Mensagens: 5312
Registrado em: 31 Mai 2006 10:22
Localização: Curitiba - Paraná

Recompiling Old Summer87 Program

Mensagem por Pablo César »

RST_SCR and SAV_SCR are actually procedures.
May you show 5 first line of each RST_SCR and SAV_SCR prgs ?
Um clip-abraço !

Pablo César Arrascaeta
Compartilhe suas dúvidas e soluções com todos os colegas aqui do fórum.
Evite enviar as dúvidas técnicas por MPs ou eMails, assim todos iremos beneficiar-nos.
marge0512
Usuário Nível 3
Usuário Nível 3
Mensagens: 121
Registrado em: 20 Mai 2011 12:42
Localização: United States

Recompiling Old Summer87 Program

Mensagem por marge0512 »

Sure! I will show the complete procedures:

SAV_SCRN.prg

Código: Selecionar todos

*----------------------------------------------------------------------
*  SAV_SCRN	Save the current screen to a mem var
*----------------------------------------------------------------------
procedure SAV_SCREEN

parameters SCRN_NUM
if pcount() < 1
	SCRN_NUM = LAST_SCRN() + 1
endif

private SCR_VAR
SCR_VAR = "_SCR_" + ltrim( str( SCRN_NUM))

public &SCR_VAR
save screen to &SCR_VAR

return
RST_SCRN.prg

Código: Selecionar todos

*----------------------------------------------------------------------
* RST_SCRN	Restore a screen from a mem var
*----------------------------------------------------------------------
procedure RST_SCRN
parameters SCRN_NUM, KEEP_SCR

if pcount() < 1
	private SCRN_NUM
	SCRN_NUM = LAST_SCRN()
endif
if pcount() < 2
	private KEEP_SCR
	KEEP_SCR = 0
endif

private SCR_VAR
SCR_VAR = "_SCR_" + ltrim( str( SCRN_NUM))

restore screen from &SCR_VAR 

if KEEP_SCR = 0
	release &SCR_VAR
endif

return
Editado pela última vez por Pablo César em 17 Mai 2012 11:59, em um total de 4 vezes.
Razão: Mensagem editada para colocar a tag [ code ]<br>Veja como utilizar esta tag: http://www.pctoledo.com.br/forum/faq.php?mode=bbcode#f2r1
Avatar do usuário
Pablo César
Usuário Nível 7
Usuário Nível 7
Mensagens: 5312
Registrado em: 31 Mai 2006 10:22
Localização: Curitiba - Paraná

Recompiling Old Summer87 Program

Mensagem por Pablo César »

You see in RST_SCRN.prg there is same file name and same function name. Do you know how it is calling RST_SCRN in another modules ? May you show in one line ? We have to be sure that all calling RST_SCRN, must be same way in all modules which is calling.

It could be:

1.Option: RST_SCRN(<numeric>,<numeric>)

or

2.Option: DO RST_SCRN WITH <numeric>,<numeric>

Tell if is only one way or both. In case of both, remake as 2nd option. Then you can take out "procedure RST_SCRN" (4th line in RST_SCRN.prg).
Um clip-abraço !

Pablo César Arrascaeta
Compartilhe suas dúvidas e soluções com todos os colegas aqui do fórum.
Evite enviar as dúvidas técnicas por MPs ou eMails, assim todos iremos beneficiar-nos.
marge0512
Usuário Nível 3
Usuário Nível 3
Mensagens: 121
Registrado em: 20 Mai 2011 12:42
Localização: United States

Recompiling Old Summer87 Program

Mensagem por marge0512 »

RST_SCRN gets called from the LETTER.PRG several times. A couple of examples are:

Código: Selecionar todos

* Act on menu selection
	*----------------------
	Do case
		Case SCRLMNUKEY = 0
			* Just return to U_SCROLL

		Case SCRLMNUKEY = K_ESC
			Do SCRL_RET
			Do Rst_Scrn
			m->Spin = "N"
			Return
Another would be:

Código: Selecionar todos

Do Case
		Case Action = 0
			* Return and do nothing
			Do Rst_Scrn
			Return

		Case Action = 1
			 * Name to find
			 Do Fnd_Na
			 Do Rst_Scrn
			 Return

		Case Action = 2
			* Number to find
			Do Fnd_SS
			Do Rst_Scrn
			Return
	EndCase
All examples are about the same. I hope this helps.
Responder