GNU TeXmacsUser manualReferenceAboutEnglish
General architecture of the Scheme API

When programming Scheme extensions of TeXmacs, it may be useful to be conscious of the internal architecture of the Scheme modules inside TeXmacs (see figure ?).

Figure 1. Schematic organization of the Scheme API.

Built-in Scheme commands

On the very basic level, one has the standard Scheme language, as provided by S7 or by Guile 1.8, depending on the build (the extensions of these implementations are used as least as possible). The differences between the two are hidden by the modules

boot-s7.scm

and

compat-s7.scm

for S7, resp.

boot.scm

and

compat.scm

for Guile. At startup, TeXmacs loads

init-s7.scm

resp.

init-guile.scm

, which set up the interpreter and its module system, and then the files

init-kernel.scm

(the kernel modules) and

init-texmacs.scm

(the rest of the editor), which are common to both. The standard Scheme language is enriched by some routines implemented in the C++ part of TeXmacs and exported to Scheme via the glue. If you unpacked the source code of TeXmacs in source-dir, then you can find a full list of the routines exported by the glue in the files

    source-dir/src/Scheme/Glue/build-glue-basic.scm
source-dir/src/Scheme/Glue/build-glue-editor.scm
source-dir/src/Scheme/Glue/build-glue-server.scm

(from which the C++ files

glue_basic.cpp

,

glue_editor.cpp

and

glue_server.cpp

in the same directory are generated).

Extensions to Scheme and further utilities

Above the standard Scheme language and the extra routines from the glue, TeXmacs comes with a second level of language extensions, utilities and libraries. The corresponding Scheme files can be found in the directories

    $TEXMACS_PATH/progs/kernel
$TEXMACS_PATH/progs/utils

Roughly speaking, the functionality provided by this second level is the following:

Whereas the modules in $TEXMACS_PATH/progs/kernel are automatically loaded, all modules in $TEXMACS_PATH/progs/utils have to be explicitly included.

Internal modules and plug-ins

The remaining Scheme extensions of TeXmacs are regrouped into internal modules which usually correspond to a particular type of content. For instance, the directories

    $TEXMACS_PATH/progs/source
$TEXMACS_PATH/progs/math
$TEXMACS_PATH/progs/table

respectively contain routines for editing source code, mathematics and tables. Exceptions are internal modules like fonts, convert or security, which rather correspond to a particular type of functionality. Each internal module corresponds to a group of files, each of which corresponds to an individual TeXmacs module. The internal modules are designed to be as independent as possible.

From the Scheme point of view, the structure of a plug-in is very similar to that of an internal module. Each plug-in defines a collection of Scheme programs in its progs subdirectory. Although distinct plug-ins may in principle depend on each other, they are usually designed in a way which makes them as independent as possible.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".