Tutorials & ManualsHow-tosLessons MiscellaneousKnowing Which Stacks Are In Memory

Knowing Which Stacks Are In Memory

In Revolution a stack file that is stored on disk contains a single main stack. If the stack file is accessed in your program then the main stack and it's substacks are loaded into memory. There are various ways to access a stack file. The following examples will load all stacks (the main stack and substacks) of a stack file into memory:

put the uVersion of stack "/path/to/stack.rev" into theVersion

go stack "/path/to/stack.rev"

put there is a stack "/path/to/stack.rev" into theStackExists

Below you will find a function that will the name of all stacks that are currently loaded in memory.

Listing Stacks in Memory

function StacksInMemory
   local theStack,theStacksInMemory,theSubstack 
   repeat for each line theStack in the mainstacks 
      put theStack & cr after theStacksInMemory 
      repeat for each line theSubstack in the substacks of stack theStack 
         put theSubstack & cr after theStacksInMemory 
      end repeat 
   end repeat 
   delete the last char of theStacksInMemory 
   return theStacksinMemory 
end StacksInMemory


Add your comment

E-Mail me when someone replies to this comment