File Mode Coldef Extensions

In very old versions of A-Shell, the coldef parameter was ignored in file mode when the XTF_FCOLDEF flag was set. Now the coldef parameter may be used in that situation to add to or replace the column definition in the file, and optionally to cause the first several lines of the data file to be skipped (i.e. so that header or other meta-data can be included in the file without being interpreted as data by XTREE). In order for the coldef parameter to be treated as significant (when XTF_FCOLDEF is set), it must begin with "+", "-", or "=". Syntax:

{-skipval}+<COLDEF string>

{-skipval}=<COLDEF string>

The optional {-skipval} clause, which must be first if present at all, is used to force lines of the data file to be skipped. If skipval is a number (e.g. "-5"), then XTREE ignores that number of lines at the top of the file (not counting the first line, which is interpreted as a column definition string due to the XTF_FCOLDEF flag). If skipval starts with a character other than 1-9, it is interpreted as a string label (31 chars max); data interpretation will start with the line in the file following the line that starts with the label string. (Warning: the label string should not include "+", "-", or "=".) For example, consider this file:

1~5~Zip~#~7~30~City Name~S~~

bla bla bla

bla bla bla

xtreedata:

06104 Belmont

00922 Puerto Nuevo

<etc>

 

The file contains a column definition string in the first line, followed by three non-data lines, followed by N data lines. To tell XTREE to skip over those non-data lines, you could set the coldef parameter to one of the following:

COLDEF = "-xtreedata:"   ! skip until after "xtreedata:" label

COLDEF = "-3"            ! skip 3 lines

 

Instead of, or in addition to skipping lines, you can also use the coldef parameter to append to, or replace, the column definition string in the file. To append, use "+" followed by a legal coldef definition string. Appending is useful when you want to add something non-data specific, such as a popup menu, which may depend on runtime application logic. To replace, use "=" followed by a legal coldef definition string. Replacement is probably most useful when you didn't really want to put the column definition in the file at all, but needed to in order to use the -skipval feature (since all of these special coldef parameter features discussed here require the XTF_FCOLDEF flag). Some legal examples:

! use column definition from the file, as is.

COLDEF = ""

 

! skip 3 lines (plus column def line), append popupmenu to col. def.

COLDEF = "-3+0~0~x~H~PopupMenu=Eat,VK_xF100;Drink,VK_xF101~~

 

! skip to "data:" label, replace col. def entirely

COLDEF = "-data:=1~5~Zip~#~RGBbg=50,100,200~~7~30~City~S~~

 

Note that column definition string following the "+" or "=" in the examples above must meet all of the normal coldef syntax rules, including ending with ~~.