Wiki Home

See Your Procedures And Functions


Namespace: People
HUH? I don't get it. Anyone know how to actually make this work?

(Move to IntelliSense Custom Scripts ?)

The script generate a Dynamic Intellisense with your procedures and functions returned in your SET PROCEDURE.
To test, types “ZPROC” in any place of your Fox.

TYPE = F
ABBREV = ZPROC
EXPANDED = ZPROC
CMD = {}
CASE = C
SAVE = F
DATA

LPARAMETER oFoxCode
*ESTE SCRIPT RETORNA TODAS AS FUNÇÕES
*DOS PRGs QUE ESTÃO ASSOCIADOS AO SET PROCEDURE
*CRIADO POR PAULO HENRIQUE DE ALMEIDA (CASÃO), FOXBRASIL

LOCAL oFoxScript
IF NOT FILE(_CODESENSE)
	RETURN ""
ENDIF
SET PROCEDURE TO (_CODESENSE) ADDITIVE
oFoxScript= CREATEOBJECT("FoxCodeScript")
=oFoxScript.START(m.oFoxCode)

IF ATC(_CODESENSE,SET("PROC"))#0
	RELEASE PROCEDURE (_CODESENSE)
ENDIF

LOCAL lcfxtoollib, lnWinHdl, laEnv, lcStr, lnLines, i, lcLine, lcDefDesc, laLines, lcLastWord, lcSaveStr
lcfxtoollib = SYS(2004)+"FOXTOOLS.FLL"
IF NOT FILE(lcfxtoollib)
	RETURN .F.
ENDIF
SET LIBRARY TO (m.lcfxtoollib) ADDITIVE

lnWinHdl = _WONTOP()
_wselect(lnWinHdl)

DIMENSION laEnv[25]
_EdGetEnv(lnWinHdl ,@laEnv)
lcStr = _EDGETSTR(lnWinHdl , 0, laEnv[17])
lcSaveStr = lcStr
GetIncludeDefs(lcStr, oFoxScript.oFoxCode)

IF NOT EMPTY(oFoxScript.oFoxCode.Items[1])
	DIMENSION laLines[1]
	lnLines = ALINES(laLines,lcSaveStr )
	lcLastWord = ALLTRIM(GETWORDNUM( laLines[ALEN(laLines)] , GETWORDCOUNT(laLines[ALEN(laLines)] )))
	lcLastWord=LEFT(lcLastWord, LEN(lcLastWord) - LEN('ZPROC '))
	oFoxScript.ReplaceWord(lcLastWord)

	* POSICIONANDO NO ESPAÇO EXTRA
	IF ASC(RIGHT(oFoxScript.oFoxCode.FullLine,1))=32
		_EDSETPOS(lnWinHdl, _EDGETPOS(lnWinHdl) - 1)
	ENDIF
	oFoxScript.oFoxCode.ValueType = "L"
ENDIF

RETURN ""

PROCEDURE GetIncludeDefs(tcStr, toFoxCode)
	LOCAL lcStr1, lnLines, i, lcLine, lcDefDesc, laLines, lnALen, lcDefWord, lcIncludeFile, lcStr2, lnLINATU, llTRAVADO, lcSETPROC,lcFILE

	llTRAVADO=.F.
	lnLINATU=0
	IF EMPTY(tcStr)
		RETURN
	ENDIF

	IF EMPTY(SET("Procedure"))
		RETURN
	ENDIF

	lcStr1=''
	lcSETPROC = ','+ALLTRIM(UPPER(SET("Procedure")))+','
	lcSETPROC = STRTRAN(lcSETPROC,'.FXP','.PRG')
	FOR i=1 TO OCCURS(',',lcSETPROC)
		lcFILE = STREXTRACT(lcSETPROC,',',',' , i)
		IF NOT FILE(lcFILE)
			LOOP
		ENDIF
		lcStr1=lcStr1+FILETOSTR(lcFILE)+CHR(13)+CHR(10)
	ENDFOR

	IF EMPTY(lcStr1)
		RETURN
	ENDIF

	DIMENSION laLines[1]
	lnLines = ALINES(laLines,lcStr1)

	FOR i = 1 TO lnLines
		lcLine = laLines[m.i]
		lcLine = STRTRAN(lcLine,CHR(9),' ')
		lcLine = ALLTRIM(lcLine)
		IF UPPER(LEFT(lcLine,4))='DEFI'
			llTRAVADO=.T.
		ENDIF
		IF UPPER(LEFT(lcLine,4))='ENDD'
			llTRAVADO=.F.
		ENDIF

		IF llTRAVADO
			LOOP
		ENDIF

		IF NOT ( UPPER(LEFT(lcLine,4)) $ "PROC,FUNC,PARA,LPAR" )
			LOOP
		ENDIF

		IF UPPER(LEFT(lcLine,4)) $ "PROC,FUNC"
			lnALen = ALEN(toFoxCode.Items,1)
			IF NOT EMPTY(toFoxCode.Items[1])
				DIMENSION toFoxCode.Items[lnALen+1,2]
				lnALen = ALEN(toFoxCode.Items,1)
			ENDIF
			lcDefWord = GETWORDNUM(lcLine, 2)
			toFoxCode.Items[lnALen, 1] = lcDefWord
			lnLINATU=lnALen
		ENDIF

		IF UPPER(LEFT(lcLine,4)) $ "PARA,LPAR" AND lnLINATU>0
			lcDefWord = STREXTRACT(lcLine,' ','')
			toFoxCode.Items[lnLINATU, 2] = lcDefWord
			IF EMPTY(toFoxCode.Items[lnLINATU, 1])
				toFoxCode.Items[lnLINATU, 1]='(VAZIO)'
			ENDIF
		ENDIF
	ENDFOR
ENDPROC

( Topic last updated: 2007.10.10 08:44:35 AM )