Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : RRSTUFF.ZIP
Filename : MEMOPS.PRG

 
Output of file : MEMOPS.PRG contained in archive : RRSTUFF.ZIP

*-------------------- Mem2Disk, Disk2Mem Function Library -------------------*
* *
* Author: Darren J. Forcier *
* System: Clipper Source Code Library *
* *
* Descr : This set of routines can be used to simulate the DBXL and Quick *
* Silver Automem types of command addons for Clipper. They will *
* create memory variables on the fly that correspond with the *
* currently opened database area, and also do initialization, and *
* automatic replacement of fields. *
* *
*----------------------------------------------------------------------------*


*-----------------------------------------------------------------------------

*------------------------------------------------*
*--- Create Memvar Initializations on the fly ---*
*------------------------------------------------*

function initmem

private names[fcount()],types[fcount()],lens[fcount()],decs[fcount()]
private eye, i, creat

eye = afields(names,types,lens,decs)

for i = 1 to eye
store names[i] to creat
public &creat
do case
case types[i] = 'C'
&creat = space( lens[i] )
case types[i] = 'D'
&creat = ctod(space(8))
case types[i] = 'N'
&creat = 0.00
case types[i] = 'L'
&creat = .f.
endcase
next i

return eye


*-----------------------------------------------------------------------------

*-----------------------------------------------------*
*--- Assign Database Variables to Memory Variables ---*
*-----------------------------------------------------*


function stormem

private names[fcount()],types[fcount()],lens[fcount()],decs[fcount()]
private eye, i, creat, alias_it

eye = afields(names,types,lens,decs)

store alias() to alias_it

for i = 1 to eye
creat = names[i]
public &creat
&creat = &alias_it.->&creat
next i

return eye

*-----------------------------------------------------------------------------

*------------------------------------------------------------*
*--- Automatically Replace Database Vars with Memory Vars ---*
*------------------------------------------------------------*

function autorep

private names[fcount()],types[fcount()],lens[fcount()],decs[fcount()]
private eye, i, creat

eye = afields(names,types,lens,decs)


for i = 1 to eye
creat = names[i]
if type('m->&creat') # 'U'
replace &creat with m->&creat
endif
next i

return eye

*----------------------------------------------------------*
*--- Release Memory Variables used by Automem Functions ---*
*----------------------------------------------------------*

function autorel

private names[fcount()],types[fcount()],lens[fcount()],decs[fcount()]
private eye, i, creat

eye = afields(names,types,lens,decs)


for i = 1 to eye
creat = names[i]
release m->&creat
next i

return eye


  3 Responses to “Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : RRSTUFF.ZIP
Filename : MEMOPS.PRG

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/