next up previous contents index
Next: \include Up: Miscellaneous operators Previous: Miscellaneous operators   Contents   Index

Subsections

\define

Description 

\define allows to define new operators. It is inspired by the well-known #define of the C/C++ preprocessor. The aim of this operator is to create a new operator based on other ones. It can also be used to change name of operators. This way, we can imagine to translate all Doodle operators in other foreign languages. But in fact, this usage is certainly not the most interesting. Indeed, this operator make the Doodle language open and extensible. We can also imagine macro operators definition compounding several operators in one.

\define take two global parameters :

  1. the entire new operator name and arguments,
  2. the block by which the new operator will replaced.

\define replaces all occurrences of its first parameter (new operator name) by the second one (block of Doodle source code). New operator parameters are substituted and used inside the Doodle code. The replacement is purely lexical.

This operator can only be found outside of a block (step or header).

Usage

  \define \def {\define} % for lazy people ...
  \define \titre(t) {\title(t)} % french operator translation

Formal structure

  \define OPERATOR (PARAMETERS) { DOODLE_CODE }

Parameters

  OPERATOR
  Description    : Indicates the new operator name. 
  Type           : Operator name.
  Allowed values : Any valid operator name : starting with a backslash
                   character (\).

  PARAMETERS (optional)
  Description    : Indicates the list of parameters taken by the new
                   operator. 
  Type           : List of identifier.
  Allowed values : Any sequence of identifiers separated by a coma (,).
  Note           : If no parameter are required, parenthesis are removed.

  DOODLE_CODE
  Description    : Indicates the Doodle code by which an occurrence of
                   the new operator should be replaced.
  Type           : Piece of Doodle code.
  Allowed values : Any valid Doodle source code.


next up previous contents index
Next: \include Up: Miscellaneous operators Previous: Miscellaneous operators   Contents   Index
Doodle reference manual HTML version generated using LaTeX2HTML by Jérôme Gout, 2001-10-29
Doodle is hosted by Sourceforge, go to SourceForge Logo for more information
©2000-2001 Doodle