Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Search for text in .prg to see if specific procedure exi
Message
De
13/12/2001 13:09:16
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
À
13/12/2001 10:34:42
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00593857
Message ID:
00593952
Vues:
24
This message has been marked as a message which has helped to the initial question of the thread.
>Is there an easy way to search for text in a .prg? I need to know if a specific procedure exists in a .prg before I try to run it.
>
>For instance, I need to know if 'procedure ix_insured' is in tblstruc.prg. The tblstruc.prg is included in the project.

Brief tool which would do that:
lparameters cPrg, cProcName
local cText, nAt
cText=lower(filetostr(cPrg))
lFound=.f.
for i=1 to occurs("proc", cText)
   nLine=atcline("proc", cText)
   cLine=mline(cText,nLine)
   lFound=atc(cProcName, cLine)
   if lFound
      exit
   else
      cText=subs(cText, _mline)
   endif
endfor
return lFound
Now this needs some more checking (i.e. does the cPrg exist etc). It should also be repeated for the Func keyword, and should keep a copy of cText for the second run, because this way cText is being chopped. After a little tweaking this would be stable enough.

I figure you need this at runtime - because in the editor you can always pull up the procedure list (v3,5,6) or document view (vfp7), sort it alphabetically and look for your routine.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform