home *** CD-ROM | disk | FTP | other *** search
- *******************************************************************************
- * Written by Essor Maso. *
- * Modified to include ToolkiT Windowing Logic
- * by Stephen Straley
- * A diagnostic tool to view memory variables easily. *
- * It is assumed that F7 is set to DISP_MEM. *
- *******************************************************************************
-
- PROCEDURE Disp_mem
-
- PARAMETERS _tdum, _tdum1, _tdum2
-
- _tdum = IF((TYPE("_tdum") != "C"), "", UPPER(LTRIM(TRIM(_tdum))))
-
- IF PCOUNT() = 3 && This came from the SET KEY TO
- _tdum = ""
- ENDIF
-
- && Save memory variables
- SAVE TO S_______ ALL EXCEPT _tdum*
-
- PRIVATE _1vn,_1vt,_1vr,_1mc,_1sc,_1fh,_1fl
-
- IF TYPE("scrcursor") = "U"
- scrcursor = .T.
- ENDIF
- SET CURSOR OFF
- Windowpush(2,2,20,65,"WHITE","BLACK","WHITE","BLACK")
- _1fh=FOPEN('S_______.MEM')
- _1fl=FSEEK(_1fh,0,2)
- FSEEK(_1fh,0)
- Clear_area()
- IF _1fl<2
- Wsayget(1,1,"There are no memory variables present.") && File contains EOF marker.
- ELSE
- _count = 1
- _vars = 0
- _bytes = 0
- DO WHILE FSEEK(_1fh,0,1)+1<_1fl
- * Variable specific information is contained in the first 18 bytes of the
- * variable packet. The value of the variable is contained from positon 33 on.
- _1mw=SPACE(18)
- FREAD(_1fh,@_1mw,18) && Get the variable specific information.
- * The variable name is in the first 10 position with a CHR(0) terminator.
- _1vn=LEFT(_1mw,AT(CHR(0),_1mw)-1)
- * The variable type is in position 12 of the packet.
- * C3h is character or memo, CCh is logical, CEh is numeric, C4h is date.
- _1vt=SUBSTR(_1mw,12,1)
- * For character and logical variables, position 17 and 18 contain the hex
- * value for the range of the data. For numeric and date variables, the
- * range is 8. This points to the end of the variable packet.
- _1vr=BIN2W(RIGHT(_1mw,2))
- IF _1vt$[├╠] && C3=CHR(195)=├, CC=chr(204)=╠.
- _1mc=14+_1vr
- ELSE
- _1mc=22
- ENDIF
- FSEEK(_1fh,_1mc,1) && Go to next packet.
- IF _1vr>51.AND._1vt$[├╠]
- _1r=STRTRAN(LEFT(&_1vn,50),'','')
- _ttemp = LEFT(_1vn+SPACE(10),10) + " TYPE " + TYPE(_1vn) + ["] + _1r + ["]
- ELSE
- _1r=STRTRAN(&_1vn,'','')
- _ttemp = LEFT(_1vn+SPACE(10),10) + " TYPE " + TYPE(_1vn) + " " + IF(TYPE(_1vn) = "C", ["]+_1r+["], STRVALUE(&_1vn))
- ENDIF
- IF TYPE(_1vn) = "C"
- _bytes = _bytes + LEN(&_1vn.)
- _a = LEN(&_1vn.)
- ELSEIF TYPE(_1vn) = "N"
- _bytes = _bytes + 9
- _a = 9
- ELSEIF TYPE(_1vn) = "L"
- _bytes = _bytes + 2
- _a = 2
- ELSEIF TYPE(_1vn) = "D"
- _bytes = _bytes + 9
- _a = 9
- ENDIF
-
- IF EMPTY(_tdum)
- Wsayget(_count, 1, IF( LEN(_ttemp) > 51, SUBSTR(_ttemp, 1, 50), _ttemp) )
- Wsayget(_count, 49, TRIM(TRANSFORM(_a, "9999999"))+" bytes")
- _count = _count + 1
- _vars = _vars + 1
- ELSE
- IF _tdum $ _1vn
- Wsayget(_count, 1, IF( LEN(_ttemp) > 51, SUBSTR(_ttemp, 1, 50), _ttemp) )
- Wsayget(_count, 49, TRIM(TRANSFORM(_a, "9999999"))+" bytes")
- _vars = _vars + 1
- _count = _count + 1
- ENDIF
- ENDIF
-
- IF ROW() > 14
- Wsayget(_count+2,1,'Press Q TO Quit, anything else to continue')
- INKEY(0)
- IF CHR(LASTKEY())$"Qq"
- End_disp()
- RETURN
- ELSE
- Clear_area()
- _count = 1
- ENDIF
- ENDIF
- ENDDO
- ENDIF
- End_disp()
-
- *******************
-
- PROCEDURE End_disp
-
- ERASE S_______.MEM
- IF _count > 0
- Wsayget(_count+1,1,SPACE(50))
- Wsayget(_count+2,1,SPACE(50))
- Wsayget(_count+2,1,"Memory Variables Displayed " + LTRIM(STR(_vars)) + " with " + LTRIM(STR(_bytes)) + " bytes used ")
- Wsayget(_count+3,1,"Any Key to Continue....")
- INKEY(0)
- ENDIF
- Windowpop()
- FCLOSE(_1fh)
- SET CURSOR (scrcursor)
-
- * End of File