Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Procedure file
Message
From
15/11/2000 11:01:00
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00441834
Message ID:
00442116
Views:
13
>Is there some way to get the procedure names out of a procedure file ? or just check for existance of a procedure / function in a procedure file. ? ... ifexist= procedure("myprocedure","procdecurefile")

This shoudl work, I wrote it right off the top my head, but I tested it on something and it worked :-)
lparameters tcProcedureName, tcPRG

* Format the code to reduce as many exceptions as possible
lcPRG = upper(FileToStr(tcPRG))
lcPRG = StrTran(lcPRG, chr(9), space(1))
do while space(2) $ lcPRG
	lcPRG = StrTran(lcPRG, space(2), space(1))
enddo
lcPRG = StrTran(lcPRG, 'PROCEDURE', 'PROC')
lcPRG = StrTran(lcPRG, 'PROCEDUR', 'PROC')
lcPRG = StrTran(lcPRG, 'PROCEDU', 'PROC')
lcPRG = StrTran(lcPRG, 'PROCED', 'PROC')
lcPRG = StrTran(lcPRG, 'PROCE', 'PROC')
lcPRG = StrTran(lcPRG, 'FUNCTION', 'PROC')
lcPRG = StrTran(lcPRG, 'FUNCTIO', 'PROC')
lcPRG = StrTran(lcPRG, 'FUNCTI', 'PROC')
lcPRG = StrTran(lcPRG, 'FUNCT', 'PROC')
lcPRG = StrTran(lcPRG, 'FUNC', 'PROC')

STRTOFILE(lcPRG, 'c:\vfptest\temp1.prg')

* Because there are no tabs, a maximum of 1 consecutive space
* and only the keyword "PROC" is used
* We should be able to know what our PROC lines are.
lcProc = 'PROC ' + ALLTRIM(UPPER(tcProcedureName))
return ;
	chr(10) +            lcProc + SPACE(1)	$ lcPRG or ;
	chr(10) +            lcProc + chr(13)	$ lcPRG or ;
	chr(10) +            lcProc + '('	$ lcPRG or ;
	chr(10) + space(1) + lcProc + SPACE(1)	$ lcPRG or ;
	chr(10) + space(1) + lcProc + chr(13)	$ lcPRG or ;
	chr(10) + space(1) + lcProc + '('	$ lcPRG
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform