GNU TeXmacsUser manualReferenceAboutEnglish
The data relation descriptor (DRD)

1.Introduction

A TeXmacs document is a tree whose nodes carry arbitrary labels. Only a fixed set of labels is known to the C++ kernel (the primitives concat, frac, with, …); all other labels are macros defined by style files or by the user. Generic tree-manipulating code, however, constantly needs to know things about a label which are not visible in the tree itself:

This information is collected in the data relation descriptor, or DRD. The general idea, and the user-level view, are explained in data relation descriptions; the primitive drd-props, by which style files declare properties, is documented in macro primitives. This chapter is the developer reference for the whole subsystem, on the C++ side and on the Scheme side.

2.Overview

On the C++ side, a DRD is an object of class drd_info (

Data/Drd/drd_info.hpp

) which maps tree labels to tag_info records (

Data/Drd/tag_info.hpp

). There are several DRDs at any time:

The typesetting environment edit_env holds a reference to the DRD of its editor, which is how drd-props declarations executed during typesetting end up in the right DRD.

On the Scheme side, there are two different layers:

The two layers are independent: tag groups are not stored in the C++ DRD, and C++ properties are not visible to the logic engine.

3.Source files

Data/Drd/tag_info.hpp
,
tag_info.cpp

The records parent_info, child_info and tag_info, the type constants TYPE_*, the compact environment table (drd_encode, drd_decode) and the conversion of type names (drd_encode_type, drd_decode_type).

Data/Drd/drd_info.hpp
,
drd_info.cpp

The class drd_info: getters, setters and freezing of all properties, the high-level queries (is_accessible_child, get_env_child, …) and the heuristic inference from macros.

Data/Drd/drd_std.hpp
,
drd_std.cpp

The standard DRD std_drd, the current DRD the_drd, the table STD_CODE of built-in tag names and the helper with_drd.

Data/Drd/drd_mode.hpp
,
drd_mode.cpp

The global access mode and writability mode.

Data/Drd/vars.hpp
,
vars.cpp

String constants for the names of the built-in environment variables (MODE, FONT_SIZE, …), several hundred of which get a type in std_drd.

Data/Document/new_style.cpp

Computation and caching of style DRDs (compute_env_and_drd, get_style_drd, get_document_drd, style_get_cache, style_set_cache).

Edit/Editor/edit_typeset.cpp

Initialization and update of the DRD of an editor (typeset_style_use_cache, typeset_preamble, drd_update).

Typeset/Env/env_exec.cpp

The evaluation of drd-props (edit_env_rep::exec_drd_props).

Data/Tree/tree_traverse.cpp

Free functions wrapping the_drd (is_accessible_child, minimal_arity, get_child_type, …), most of which are exported to Scheme.

Scheme/Glue/build-glue-basic.scm

The declarations of the Scheme glue.

utils/edit/variants.scm

The Scheme macro define-group and the standard tag groups.

*/*-drd.scm

Tag groups and tables of the various editing modes and converters (

text/text-drd.scm

,

math/math-drd.scm

,

dynamic/dynamic-drd.scm

, …).

kernel/logic/logic-*.scm

The logic programming engine.

4.Contents of this chapter

The page the data relation descriptor of the chapter on macro expansion describes the heuristic inference of properties from macro definitions in more detail; it is summarized, not repeated, here.

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".