Next: , Previous: Resource file, Up: Resource file


5.1.1 Structure of resource file

First of all, a Gcal resource file is a plain ascii text file. This text file may be created by any text editor or by redirecting the standard output channel to a file, e.g.:

     

$ echo '19930217 Text'>> resource-file <RET>

A special —but simple— line structure is required so Gcal is able to interpret its contents. Each fixed date entry in a resource file must be split into two parts, namely a date part and an optional text part which must be separated by one whitespace1 character minimum. It is unnecessary to give a whitespace separator character if no text part is specified.

A line must always end with a ‘\n’ (newline) character, except it is the last line of a resource file. The maximum length of a line is limited to INT_MAX2 characters. A newline character is automatically appended to the line if the standard output channel is directed to a file. A newline character is appended to the typed line in a text editor window if it is completed by pressing the <RET> key. In case the used text editor does not generate the newline character in this way, it should be set to this mode of operation, otherwise this text editor is useless for creating Gcal resource files.

The line structure of fixed date entries is:

     date part [ whitespace text part ] newline

or more concrete, e.g.:

     yyyy[mm[dd|wwwn]] [ whitespace text ] newline

or much more concrete, e.g.:

     19940217 Hi, I'm the text!

Besides fixed date entries, a resource file may contain further entries like:

Comments...

     ; A remarked line
     ;     A formatted and multi-line \
           remark

Include directives...

     #include <file name>
     #include "file name"

Date variable assignments respectively operations...

     dvar=NOTHING
     dvar=mmdd
     dvar=mmwwwn
     dvar=*dn[www]
     dvar=*wn[www]
     dvar=dvar[[+|-]n[www]]
     dvar++
     dvar--
     dvar+=[+|-]n
     dvar-=[+|-]n
     dvar+=nwww
     dvar-=nwww

Text variable assignments respectively operations...

     tvar=[text]
     tvar?[command]
     tvar:[command]
     tvar++
     tvar--
     tvar+=[+|-]n
     tvar-=[+|-]n

Text variable references...

     tvar

Text variable references at the beginning of a Gcal resource file line may only be used if it is ensured that they are expanded to a valid Gcal resource file line.


Footnotes

[1] For example Tab, Space, Form-feed and similar characters.

[2] Normally, this is for example equivalent to a value of 32,767 == (2^15)-1 on a 16-Bit machine architecture; to a value of 2,147,483,648 == (2^31)-1 on a 32-Bit machine architecture etc.