next up previous

13.15.1 External Text File Format

Each external text file to be loaded into CLIPS must be described in a particular way. Each topic entry in each file must be in the format shown following.

Syntax

<level-num> <entry-type> BEGIN-ENTRY- <topic-name>
        .
        .
Topic information in form to be displayed when referenced.
        .
        .
END-ENTRY

The delimiter strings (lines with BEGIN_ENTRY or END_ENTRY info) must be the only things on their lines. Embedded white space between the fields of the delimiters is allowed.

The first parameter, <levelnum>, is the level of the hierarchical tree to which the entry belongs. The lower the number, the closer to the root level the topic is; i.e., the lowest level number indicates the root level. Subtopics are indicated by making the level number of the current topic larger than the previous entry (which is to be the parent). Thus, the tree must be entered in the file sequentially; i.e., a topic with all its subtopics must be described before going on to a topic at the same level. Entering a number less than that of the previous topic will cause the tree to be searched upwards until a level number is found which is less than the current one. The current topic then will be attached as a subtopic at that level. In this manner, multiple root trees may be created. Level number and order of entry in a file can indicate the order of precedence in which a list of subtopics that are all children of the same topic will be searched. Topics with the same level number will be searched in the order in which they appear in the file. Topics with lowerlevel numbers will be searched first.

Example

0MBEGIN-ENTRY-ROOT
 --  Text  --
END-ENTRY
2IBEGIN-ENTRY-SUBTOPIC1
 --  Text  --
END-ENTRY
1IBEGIN-ENTRY-SUBTOPIC2
 --  Text  --
END-ENTRY

In the above example, SUBTOPIC1 and SUBTOPIC2 are children of ROOT. However, in searching the children of ROOT, SUBTOPIC2 would be found first.

If the user wishes to access the information through the help facility (see section 13.14), the root node must be named MAIN. The contents of the MAIN menu may be changed.

The second parameter in the format defined above, the <entrytype>, must be a single capital letter, either M (for MENU) or I (for INFORMATION). Only MENU entries may have subtopics.

The third parameter defined above, the <topicname>, can be any alphanumeric string of up to 80 characters. No white space can be embedded in the name.

Beginning a line with the delimiter ì$$î forces the loader to treat the line as pure text, even if one of the key delimiters is in it. When the line is printed, the dollar signs are treated as blanks.

Example

0MBEGIN-ENTRY-ROOT1
 --  Root1 Text  --
END-ENTRY
1MBEGIN-ENTRY-SUBTOPIC1
 --  Subtopic1 Text  --
END-ENTRY
2IBEGIN-ENTRY-SUBTOPIC4
 --  Subtopic4 Text  --
END-ENTRY
1IBEGIN-ENTRY-SUBTOPIC2
 --  Subtopic2 Text  --
END-ENTRY
0IBEGIN-ENTRY-ROOT2
 --  Root2 Text  --
END-ENTRY
-1MBEGIN-ENTRY-ROOT3
 --  Root3 Text  --
END-ENTRY
0IBEGIN-ENTRY-SUBTOPIC3
 --  Subtopic3 Text  --
END-ENTRY
Tree Diagram of Above Example :

-> ROOT3 ---------> ROOT1 --------> ROOT2
     |               /   \
     |              /     \
     V             V       V
 SUBTOPIC3    SUBTOPIC1 SUBTOPIC2
                 |
                 |
                 V
             SUBTOPIC4

next up previous