Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Max length of Set Procedure Additive?
Message
From
28/04/2012 03:04:25
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
27/04/2012 09:59:24
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01542766
Message ID:
01542837
Views:
42
>I have a folder wich contains many .prg files, and each file is a separate class definition that is used throught my app.
>
>I have a procedure which scans over each filename in that folder and calls SET PRODURE TO [Filename] ADDITIVE on each file.
>
>So now the length of my Set Procedure To list s getting pretty long, and I'm wondering if there is a limit to what VFP can handle when calling "Set Procedure Additive" so many times??

Haven't found one, and this works for years. I think the oldest version of this was in 2004:
***
***	gen_setproc.prg
***

* 	13.05.04 11:27:59
* 	Visual FoxPro 08.00.0000.3117 for Windows

***
*** ----------------------------------
***
#DEFINE hLF CHR(10)
#DEFINE hCR CHR(13)
#DEFINE hCRLF CHR(13)+CHR(10)
#DEFINE hTab	CHR(9)

LOCAL a[1], i, lcComma, lctext

TEXT TO lctext NOSHOW TEXTMERGE

***
***	setproc.prg
***

* 	<<datetime()>>
* 	<<version()>>
* Generated by <<program()>>

***
*** ----------------------------------
***

	Set Procedure To
	Set Classlib To
ENDTEXT
cTab=hTab
lcSemi=";"
*[2009/03/25 18:48] ndragan - AND NOT exclude is now excluded because
*-- some dummy calls may be there just for the sake of completeness.
SELECT NAME FROM your.pjx INTO ARRAY a WHERE TYPE="P" 
ASORT(a)
lctext = lctext + hCR+"Set Procedure To	"
lcComma=""

FOR i=1 TO ALEN(a)
	lcName=CHRTRAN(a[i], CHR(0), "")
	IF NOT FILE(lcName)
		LOOP
	ENDIF
	*[2007/09/28 22:59:16] dragan - check for weirder names
	IF " "$lcName OR OCCURS(".", lcName)>1
		lcName=CHR(34)+lcName+CHR(34)
	ENDIF
	lctext = lctext + lcComma+lcSemi+hCRLF+cTab+lcName
	lcComma=","
ENDFOR
lctext = lctext + hCR + hCR+"Set Classlib To	"
SELECT NAME FROM ids.pjx INTO ARRAY a ;
	WHERE TYPE="V" AND NOT exclude
ASORT(a)
lcComma=""
FOR i=1 TO ALEN(a)
	lcName=CHRTRAN(a[i], CHR(0), "")
	IF NOT FILE(lcName)
		LOOP
	ENDIF
	*[2007/09/28 22:59:16] dragan - check for weirder names
	IF " "$lcName OR OCCURS(".", lcName)>1
		lcName=CHR(34)+lcName+CHR(34)
	ENDIF
	lctext = lctext + lcComma+lcSemi+hCRLF+cTab+lcName
	lcComma=","
ENDFOR
USE IN your
lctext = lctext + hCR+ hCR
STRTOFILE(lctext, "prgs\setproc.prg")
Then it's just a "do setproc" somewhere in your startup.

I stole the idea from VFE. There they do pretty much the same, except that the two long statements are built on the fly, from metadata derived from the pjx during the build, which meant that the app had to carry that meta table with it. My preference is that, if anything needs to be built and carried as a file, it better be a .prg. A file is a file is a file, and .prg is much simpler and shorter than most other formats.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform