DirectoryPath TMEX Type Group

typedef struct  
{
unsigned char NumEntries; /* number of entries in structure */
char Ref; /* directory reference character */
char Entries[10][4]; /* entry items */
} DirectoryPath;

(This is a packed structure on 1 byte boundaries)

The DirectoryPath structure is modeled after the way in which working directory paths are written and read using the 'CD' DOS command. For example when typing 'CD' in a sub-directory in DOS you may get this:

           CD<ENTER>
           C:\WORK\C\NEW

The string that was given by 'CD' has a depth of 3 sub-directories referenced from the root. If this information was to be returned in the DirectoryPath structure then:

           NumEntries = 3            (there are 3 entries, one for each sub-directory)
           Ref = \                   (reference character is from the root \ )
           Entries[0] = "WORK"       (first sub-directory from root)
           Entries[1] = "C "         (second sub-directory from root)
           Entries[2] = "NEW "       (third sub-directory from root)

This analogy continues to work for setting the working directory with the DOS 'CD' command. For example:

           CD \MAIL\WK3\TUES\MORN <ENTER>

This command would set the current directory to '\MAIL\WK3\TUES\MORN' as referenced from the root. To do this with the DirectoryPath structure, first set the 'Operation' flag to 0 to set the current directory and fill out the value as:

           NumEntries = 4
           Ref = \
           Entries[0] = "MAIL"
           Entries[1] = "WK3 "
           Entries[2] = "TUES"
           Entries[3] = "MORN"

If the current directory is '\MAIL\WK3\TUES\MORN' and the desired directory is '\MAIL\WK3\WED' there is a short cut using the 'CD':

           CD .\..\WED <ENTER>

This syntax of this command says that from the current directory '.' go to the previous directory '..' and then go to the sub-directory 'WED'. This short cut can also be done with the DirectoryPath structure:

           NumEntries = 2       (there are 2 entries)
           Ref = .              (reference character is from the current directory)
           Entries[0] = ".. "   (special case entry that goes to previous directory)
           Entries[1] = "WED "  (sub-directory entry from current)

Note that the 'Entries' are left justified and padded with spaces to 4 characters. The sub-directory depth is limited to 10 deep. If the 'NumEntries' is set to or is read to be 0 then the current directory is at the ROOT. Here are the allowable values for all of the components of the DirectoryPath structure:

           NumEntries: 0-10

           Ref:        \ (reference from ROOT directory (set or read))
                       . (reference from current directory (set only))

           Entries:    (left justified padded with spaces with 4 characters)
           
              (special case Entries)
                 ". "  (reference entry to the current directory)
                 ".. " (back reference entry to the previous directory)

              (valid characters)
                 ABCDEFGHIJKLMNOPQRSTUVWXYZ
                 0123456789
                 !#$%&'-@^_`{}~