24 Creating new document and element types

Thot allows the user to define new document and element types (natures) such as tables, mathematical formulae or structured graphics. A structure schema and at least one presentation schema are associated with each new document or element type. Several presentation schemas should be written to provide the user with different presentations. To export documents, one translation schema should be written for each exporting format.

To ease the use of new document or element types, the .conf and .language files must be created (see section 23.2 and 23.3).

24.1 Structure schemas

Structure schemas are expressed in the S language (see The Languages of Thot). They can be written with any text editor (vi, emacs, etc.). They must be compiled to be used in the editor.

The name of a file containing a structure schema written in the S language must be the same as the document or element type being defined but with the .S suffix. The compiler produces a file with the same name but with the .STR suffix; this file is then used by Thot.

The compiler employs the C preprocessor, thus allowing the use of all the facilities of this preprocessor for writing structure schemas (#define, #include, #ifdef, etc.).

The compiling command must be run from the structure schema directory. The compiler is started by using the following command:

str F1 F2 ...

where F1, F2, etc. are the names of the files to be compiled, with or without the .S suffix.

24.2 Presentation schemas

Presentation schemas are expressed in the P language (see The Languages of Thot). They can be written with any text editor (vi, emacs, etc.). They should be compiled in order to be used in the editor.

The name of a file containing a presentation schema written in the P language can be freely chosen but it must be followed by the.P suffix. The compiler produces an object file with the same name but with the .PRS suffix; this object file is then used by the Thot editor.

The compiler uses the C preprocessor, thus allowing the user to use all facilities of this preprocessor to write presentation schemas (#define, #include, #ifdef, etc.).

Compilation must take place in the directory of the presentation schema. If the corresponding structure schema is not present in the same directory, the THOTSCH parameter must contain the directory in which the structure schema is stored. The compiler is started by using the following command:

prs [-Doption] source[.P] [object[.PRS]]

where option is a variable passed to the preprocessor (several variables may be passed that way, each one following the characters -D), source is the name of the source file to be compiled, with or without the suffix .P, object is the name of the object file to be generated, with or without the suffix .PRS. If object is missing, the object file receives the same name as the source file.

24.3 Translation schemas

Translation schemas are expressed in the T language (see The Languages of Thot). They can be written with any text editor (vi, emacs, etc.). They must be compiled in order to be used in the editor.

The name of a file containing a translation schema written in the T language can be freely chosen but it must be followed by the .T suffix. The compiler produces an object file with the same name but with the .TRA suffix; this object file is then used by the Thot editor.

The compiler uses the C preprocessor, thus allowing the use of all the facilities of this preprocessor to write translation schemas (#define, #include, #ifdef, etc.).

Compilation must take place in the directory of the translation schema. If the corresponding structure schema is not present in the same directory, the THOTSCH configuration parameter must contain the directory in which this structure schema is stored. The compiler is launched by using the following command:

tra [-Doption] source[.T] [object[TRA]]

where option is a variable passed to the preprocessor (several variables may be passed that way, each one following the characters -D), source is the name of the source file to be compiled, with or without the suffix .T, object is the name of the object file to be generated, with or without the suffix .TRA. If object is missing, the object file receives the same name as the source file.


[Section 25] [Table of contents]