Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Give me a list of all functions/procedures in a long pro
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01007186
Message ID:
01007237
Vues:
21
Why you're checking for the , and not the ";" Also it doesn't seem to work 100% correctly. In the meantime that's the version I'm using:
********************************************************************
*  Description.......: Functions2NewPrg
*  Calling Samples...:
*  Parameter List....: tcPrgfile, tcNewFile, tcPrefix
*  Created by........: Dragan Nedeljkovich  #012046
*  Modified by.......: Nadya Nosonovsky 12/20/2000 09:39:15 AM
********************************************************************
* parameter checking left to users (if any)
lparameters tcPrgFile, tcNewFile, tcPrefix
if vartype(m.tcPrgFile)<>"C"
	tcPrgFile = getfile("prg","Get Utiity file")
endif
if vartype(m.tcNewFile)<>"C"
	tcNewFile = inputbox("Enter new file name","Functions in the procedure","FunctionsInUtility.prg")
endif

IF VARTYPE(m.tcPrefix) <> "C"
   tcPrefix = ""
ENDIF
   
close databases all
create cursor newprg (cLine c(127))
create cursor prg (cLine c(127))
SET EXACT off
append from (tcPrgFile) sdf
scan
	lcLine=lower(alltrim(cLine))
	lcFirstWord=getwordnum(lcLine, 1)
	do case
	case inlist(lcFirstWord, '#', 'lparam','param','enddef','endp','endfu','proc','func','protect','hidden')
		insert into newprg (cLine) value (trim(prg.cLine))
	case lcFirstWord='define' and getwordnum(lcLine,2)='class'
		lcOldClass=getwordnum(lcLine, 3)
		lcOldParent=getwordnum(substr(lcLine, at('as ',lcLine)+3),1)
		lcNewClass=stuff(lcOldClass,1, len(tcPrefix), tcPrefix)
		lcNewLine=strtran(lcLine, lcOldClass,lcNewClass)
*!*	*			lcNewLine=STRTRAN(lcNewLine, lcOldParent, lcOldClass)
		lcComment="* Definition of "+lcOldClass+" of "+lcOldParent
		insert into newprg(cLine) value (lcComment)
		insert into newprg(cLine) value (lcNewLine)
	endcase
endscan
local cNewText
select newprg
local lcHeader
lcHeader="* Functions Definitions in "+tcPrgFile
=strtofile(lcHeader,tcNewFile)
set textmerge on
set textmerge to (tcNewFile) noshow additive && memvar cNewText
set textmerge delimiters to "{{","}}"
scan
	\{{TRIM(cLine)}}
	\
endscan
set textmerge to
set textmerge off show
*=STRTOFILE(cNewText, tcNewFile)
>What about:
>
>
>********************************************************************
>*  Description.......: Functions2NewPrg
>*  Calling Samples...:
>*  Parameter List....: tcPrgfile, tcNewFile, tcPrefix
>*  Created by........: Dragan Nedeljkovich  #012046
>*  Modified by.......: Nadya Nosonovsky 12/20/2000 09:39:15 AM
>********************************************************************
>* parameter checking left to users (if any)
>LPARAMETERS tcPrgfile, tcNewFile, tcPrefix
>LOCAL flag_comma
>CLOSE DATABASES all
>CREATE CURSOR newprg (cLine c(127))
>CREATE CURSOR prg (cLine c(127))
>
>APPEND FROM (tcPrgFile) sdf
>SCAN
>   lcLine=LOWER(ALLTRIM(cLine))
>   lcFirstWord=WORDNUM(lcLine, 1)
>   DO CASE
>      CASE INLIST(lcFirstWord, '#', 'lparam','param','enddef','endp','endfu','proc','func','protect','hidden')
>           INSERT into newprg (cLine) value (TRIM(prg.cline))
>           flag_comma  = (RIGHT(ALLTRIM(prg.cline),1) == ",")
>
>      CASE lcFirstWord ='define' and WORDNUM(lcLine,2)='class'
>	   lcOldClass  = WORDNUM(lcLine, 3)
>	   lcOldParent = WORDNUM(SUBSTR(lcLine, AT('as ',lcline)+3),1)
>           lcNewClass  = STUFF(lcOldClass,1, LEN(tcPrefix), tcPrefix)
>           lcNewLine   = STRTRAN(lcLine, lcOldClass,lcNewClass)
>           lcComment   = "* Definition of "+lcOldClass+" of "+lcOldParent
>           INSERT into newprg(cLine) value (lcComment)
>           INSERT into newprg(cLine) value (lcNewLine)
>      CASE flag_comma
>           INSERT into newprg (cLine) value (TRIM(prg.cline))
>           flag_comma  = (RIGHT(ALLTRIM(prg.cline),1) == ",")
>   ENDCASE
>ENDSCAN
>local cNewText
>SELECT newprg
>local lcHeader
>lcHeader="* Functions Definitions in "+tcPrgFile
>=strtofile(lcHeader,tcNewFile)
>set textmerge on
>SET TEXTMERGE to (tcNewFile) noshow additive && memvar cNewText
>SET TEXTMERGE DELIMITERS TO "{{","}}"
>SCAN
>	\{{TRIM(cLine)}}
>	\
>ENDSCAN
>SET TEXTMERGE to
>SET TEXTMERGE off show
>*=STRTOFILE(cNewText, tcNewFile)
>
>
>(not tested)
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform