******************************************************************** * 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 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)) 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) *!* * 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)