Working on Keyword Sections of a Memory File

All memory file functions that display or operate on the memory file will, by default, operate on the whole memory file. You can work with one section of the memory file by (1) marking the section of the memory file with a keyword and (2) setting the system to only use the section headed by a specific keyword.

Once the system is set to use a keyword section, all memory file viewing and editing functions work within the section instead of the entire memory file.

If a keyword section is in use, memory file functions expect the row number of the memory file row to be relative to the beginning of the keyworded section. When a memory file is set to work on one keyworded section, for example, mf_rowq() returns the number of filled rows in this keyworded section, instead of the number of filled rows in the memory file.

Follow the steps below for setting the system to work on only one section of a memory file.

Step 1: Mark the memory file with keywords.

A line containing a keyword is used to mark each section of the memory file. A keyword must:

The keyword can be more that one word in length. Only those lines containing keywords can have the keyword character in the first column.

You can either (1) edit your ASCII disk file to include lines for each keyword or (2) insert keyword lines in an existing memory file.

Below is an example of lines in an ASCII text file that has two sections marked by keywords.

*MF FUNCTIONS

mf_clr()

mf_sort()

mf_search()

mf_def()

mf_free()

mf_rd()

mf_wr()

*MF MEMORY MGMT

Memory management of memory files is completely automatic.  Memory for the structures and arrays created in building memory files is allocated automatically from the free memory "heap" by system functions.  Other system functions permit you to free (return to the heap) all of the memory allocated in building a memory file.

Caution: The keyword character that marks the keyword must be in the first column of the line.

Step 2: Set the system to use one section with mf_kwdset().

To set the system to use a section of the memory file, use the memory file keyword set function, mf_kwdset():

int mf_kwdset(kwdp, mfp)
 
UCHAR *kwdp;    
/* Keyword of section to use
*/
MFILEPTR mfp;
/* Memory file to set
*/

If you specify NULLP for the keyword, then the whole memory file is used.

Once the system is set to use the specified keyword section for this memory, all functions operating on this memory file will operate only on the section with the specified keyword.

When operating only on a keyword section of the memory file, functions accept the row number relative to the keyword (not the entire memory file).

When displaying a memory file set to use a keyword section, only the section of the file marked by the keyword is displayed in the window. The keyword itself will not be displayed.


Home Contents Previous Next