Back to index

texmacs  1.0.7.15
drd_std.cpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : drd_std.cpp
00004 * DESCRIPTION: standard drd for TeXmacs; most other drd's inherit from it
00005 * COPYRIGHT  : (C) 2003  Joris van der Hoeven
00006 *******************************************************************************
00007 * This software falls under the GNU general public license version 3 or later.
00008 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
00009 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
00010 ******************************************************************************/
00011 
00012 #include "drd_std.hpp"
00013 
00014 drd_info std_drd ("tm");
00015 drd_info the_drd= std_drd;
00016 hashmap<string,int> STD_CODE (UNKNOWN);
00017 
00018 #define BIFORM   CHILD_BIFORM
00019 #define DETAILED CHILD_DETAILED
00020 
00021 #define regular(i) type (i, TYPE_REGULAR)
00022 #define raw(i) type (i, TYPE_RAW)
00023 #define macro(i) type (i, TYPE_MACRO)
00024 #define argument(i) type (i, TYPE_ARGUMENT)
00025 #define variable(i) type (i, TYPE_VARIABLE)
00026 #define binding(i) type (i, TYPE_BINDING)
00027 #define boolean(i) type (i, TYPE_BOOLEAN)
00028 #define integer(i) type (i, TYPE_INTEGER)
00029 #define string_type(i) type (i, TYPE_STRING)
00030 #define numeric(i) type (i, TYPE_NUMERIC)
00031 #define length(i) type (i, TYPE_LENGTH)
00032 #define code(i) type (i, TYPE_CODE)
00033 #define url_type(i) type (i, TYPE_URL)
00034 #define identifier(i) type (i, TYPE_IDENTIFIER)
00035 #define graphical(i) type (i, TYPE_GRAPHICAL)
00036 #define constraint(i) type (i, TYPE_CONSTRAINT)
00037 #define graphical_id(i) type (i, TYPE_GRAPHICAL_ID)
00038 #define point_type(i) type (i, TYPE_POINT)
00039 #define animation(i) type (i, TYPE_ANIMATION)
00040 #define duration(i) type (i, TYPE_DURATION)
00041 
00042 #define returns_adhoc() type (TYPE_ADHOC)
00043 #define returns_boolean() type (TYPE_BOOLEAN)
00044 #define returns_integer() type (TYPE_INTEGER)
00045 #define returns_string() type (TYPE_STRING)
00046 #define returns_numeric() type (TYPE_NUMERIC)
00047 #define returns_length() type (TYPE_LENGTH)
00048 #define returns_url() type (TYPE_URL)
00049 #define returns_identifier() type (TYPE_IDENTIFIER)
00050 #define returns_animation() type (TYPE_ANIMATION)
00051 #define returns_graphical() type (TYPE_GRAPHICAL)
00052 #define returns_constraint() type (TYPE_CONSTRAINT)
00053 
00054 static tag_info
00055 fixed (int arity, int extra=0, int child_mode= CHILD_UNIFORM) {
00056   return tag_info (arity, extra, ARITY_NORMAL, child_mode, true);
00057 }
00058 
00059 static tag_info
00060 options (int arity, int extra, int child_mode= CHILD_UNIFORM) {
00061   return tag_info (arity, extra, ARITY_OPTIONS, child_mode, true);
00062 }
00063 
00064 static tag_info
00065 repeat (int arity, int extra, int child_mode= CHILD_UNIFORM) {
00066   return tag_info (arity, extra, ARITY_REPEAT, child_mode, true);
00067 }
00068 
00069 static tag_info
00070 var_repeat (int arity, int extra, int child_mode= CHILD_UNIFORM) {
00071   return tag_info (extra, arity, ARITY_VAR_REPEAT, child_mode, true);
00072 }
00073 
00074 static void
00075 init (tree_label l, string name, tag_info ti) {
00076   STD_CODE(name)= (int) l;
00077   make_tree_label (l, name);
00078   std_drd->info (l)= ti;
00079   std_drd->freeze_arity (l);
00080   std_drd->freeze_border (l);
00081   // std_drd->freeze_block (l);
00082   // FIXME: freeze children properties
00083 }
00084 
00085 static bool std_drd_initialized= false;
00086 
00087 void
00088 init_std_drd () {
00089   if (std_drd_initialized) return;
00090   std_drd_initialized=true;
00091 
00092   init (STRING, "string", fixed (0) -> returns_string ());
00093   init (UNKNOWN, "unknown", fixed (0));
00094   init (UNINIT, "uninit", fixed (0));
00095   init (ERROR, "error", fixed (1));
00096   init (RAW_DATA, "raw-data", fixed (1) -> raw (0));
00097 
00098   init (DOCUMENT, "document",
00099        repeat (1, 1) -> inner_border () -> accessible (0));
00100   init (PARA, "para",
00101        repeat (1, 1) -> inner_border () -> accessible (0) ->
00102        name ("paragraph"));
00103   init (SURROUND, "surround", fixed (3) -> accessible (0));
00104   init (CONCAT, "concat", repeat (1, 1) -> inner_border () -> accessible (0));
00105   init (RIGID, "rigid", fixed (1) -> accessible (0));
00106   init (HIDDEN, "hidden", fixed (1) -> inner_border () -> hidden (0));
00107   init (FREEZE, "freeze",
00108        fixed (1) -> inner_border () -> regular (0));
00109   init (UNFREEZE, "unfreeze", fixed (1) -> accessible (0) -> inner_border ());
00110   init (HSPACE, "hspace",
00111        options (1, 2) -> length (0) ->    name ("horizontal space"));
00112   init (VAR_VSPACE, "vspace*",
00113        options (1, 2) -> length (0) ->    name ("vertical space before"));
00114   init (VSPACE, "vspace",
00115        options (1, 2) -> length (0) ->    name ("vertical space"));
00116   init (SPACE, "space",
00117        options (1, 2) -> length (0));
00118   // space markup has arity 1 or 3
00119   init (HTAB, "htab",
00120        options (1, 1, BIFORM) -> length (0) -> name ("tab"));
00121   init (MOVE, "move",
00122         fixed (3, 0, DETAILED) ->
00123         accessible (0) ->
00124         length (1) -> name (1, "x-offset") ->
00125         length (2) -> name (2, "y-offset"));
00126   init (SHIFT, "shift",
00127         fixed (3, 0, DETAILED) ->
00128         accessible (0) ->
00129         length (1) -> name (1, "x-offset") ->
00130         length (2) -> name (2, "y-offset"));
00131   init (RESIZE, "resize",
00132         fixed (5, 0, DETAILED) ->
00133         accessible (0) ->
00134         length (1) -> name (1, "left") ->
00135         length (2) -> name (2, "bottom") ->
00136         length (3) -> name (3, "right") ->
00137         length (4) -> name (4, "top"));
00138   init (CLIPPED, "clipped",
00139         fixed (5, 0, DETAILED) ->
00140         accessible (0) ->
00141         length (1) -> name (1, "left") ->
00142         length (2) -> name (2, "bottom") ->
00143         length (3) -> name (3, "right") ->
00144         length (4) -> name (4, "top"));
00145   init (REPEAT, "repeat", fixed (1, 1, BIFORM) -> accessible (0));
00146   init (_FLOAT, "float", fixed (2, 1, BIFORM) -> accessible (1));
00147   init (DATOMS, "datoms",
00148        var_repeat (1, 1, BIFORM) -> accessible (1) ->
00149        name ("decorate atoms"));
00150   // arbitrary number of macros and decorated content
00151   init (DLINES, "dlines",
00152        var_repeat (1, 1, BIFORM) -> accessible (1) ->
00153        name ("decorate lines"));
00154   init (DPAGES, "dpages",
00155        var_repeat (1, 1, BIFORM) -> accessible (1) ->
00156        name ("decorate pages"));
00157   init (DBOX, "dbox", fixed (0) -> name ("decorated box"));
00158 
00159   init (WITH_LIMITS, "with-limits", fixed (0) -> name ("with limits"));
00160   init (LINE_BREAK, "line-break", fixed (0) -> name ("line break"));
00161   init (NEW_LINE, "new-line", fixed (0) -> name ("new line"));
00162   init (NEXT_LINE, "next-line", fixed (0) -> name ("next line"));
00163   init (NO_BREAK, "no-break", fixed (0) -> name ("no line break"));
00164   init (NO_INDENT, "no-indent", fixed (0) -> name ("don't indent"));
00165   init (YES_INDENT, "yes-indent", fixed (0) -> name ("do indent"));
00166   init (VAR_NO_INDENT, "no-indent*", fixed (0) -> name ("don't indent after"));
00167   init (VAR_YES_INDENT, "yes-indent*", fixed (0) -> name ("do indent after"));
00168   init (VAR_PAGE_BREAK, "page-break*",
00169        fixed (0) -> name ("page break before"));
00170   init (PAGE_BREAK, "page-break", fixed (0) -> name ("page break"));
00171   init (VAR_NO_PAGE_BREAK, "no-page-break*",
00172        fixed (0) -> name ("no page break before"));
00173   init (NO_PAGE_BREAK, "no-page-break", fixed (0) -> name ("no page break"));
00174   init (VAR_NEW_PAGE, "new-page*", fixed (0) -> name ("new page before"));
00175   init (NEW_PAGE, "new-page", fixed (0) -> name ("new page"));
00176   init (VAR_NEW_DPAGE, "new-dpage*",
00177        fixed (0) -> name ("new double page before"));
00178   init (NEW_DPAGE, "new-dpage", fixed (0) -> name ("new double page"));
00179 
00180   init (AROUND, "around", fixed (3, 0, DETAILED) ->
00181         name (0, "left bracket") ->
00182         accessible (1) ->
00183         name (2, "right bracket"));
00184   init (VAR_AROUND, "around*", fixed (3, 0, DETAILED) ->
00185         name (0, "left bracket") ->
00186         accessible (1) ->
00187         name (2, "right bracket"));
00188   init (BIG_AROUND, "big-around", fixed (2, 0, DETAILED) ->
00189         name (0, "big operator") ->
00190         accessible (1));
00191   init (LEFT, "left", options (1, 2));
00192   init (MID, "mid", options (1, 2));
00193   init (RIGHT, "right", options (1, 2));
00194   init (BIG, "big", fixed (1));
00195   init (LONG_ARROW, "long-arrow",
00196         options (2, 1, DETAILED) -> name ("long arrow") ->
00197         accessible (1) -> name (1, "superscript") ->
00198         accessible (2) -> name (2, "subscript"));
00199   init (LPRIME, "lprime", fixed (1) -> name ("left prime"));
00200   init (RPRIME, "rprime", fixed (1) -> name ("right prime"));
00201   init (BELOW, "below", fixed (2) -> accessible (0));
00202   init (ABOVE, "above", fixed (2) -> accessible (0));
00203   init (LSUB, "lsub",
00204        fixed (1) -> name ("left subscript") ->
00205         accessible (0) -> locals (0, "math-display", "false"));
00206   init (LSUP, "lsup",
00207        fixed (1) -> name ("left superscript") ->
00208         accessible (0) -> locals (0, "math-display", "false"));
00209   init (RSUB, "rsub",
00210        fixed (1) -> name ("subscript") ->
00211         accessible (0) -> locals (0, "math-display", "false"));
00212   init (RSUP, "rsup",
00213        fixed (1) -> name ("superscript") ->
00214         accessible (0) -> locals (0, "math-display", "false"));
00215   init (FRAC, "frac",
00216         fixed (2) -> name ("fraction") ->
00217         accessible (0) -> locals (0, "math-display", "false"));
00218   init (SQRT, "sqrt", options (1, 1) -> accessible (0) -> name ("root"));
00219   init (WIDE, "wide", fixed (1, 1, BIFORM) ->
00220         accessible (0) ->
00221         name (1, "accent"));
00222   init (VAR_WIDE, "wide*", fixed (1, 1, BIFORM) ->
00223         accessible (0) -> name ("wide under") ->
00224         name (1, "accent"));
00225   init (NEG, "neg", fixed (1) -> accessible (0) -> name ("negation"));
00226   init (TREE, "tree", repeat (2, 1) -> accessible (0));
00227   init (SYNTAX, "syntax", fixed (1, 1, BIFORM) ->        
00228         accessible (0) -> name (0, "body") ->
00229         regular (1) -> name (1, "syntax"));
00230 
00231   init (TFORMAT, "tformat",
00232        var_repeat (1, 1, BIFORM) -> inner_border () ->
00233        accessible (1) ->
00234        name ("table format"));
00235   init (TWITH, "twith",
00236        fixed (2) -> returns_adhoc () ->
00237        accessible (0) -> binding (0) ->
00238        name ("table property"));
00239   init (CWITH, "cwith",
00240        fixed (4, 2, BIFORM) -> returns_adhoc () ->
00241        accessible (0) -> integer (0) ->
00242        accessible (1) -> binding (1) ->
00243        name ("cell property"));
00244   init (TMARKER, "tmarker", fixed (0) -> name ("table marker"));
00245   init (TABLE, "table", repeat (1, 1) -> inner_border () -> accessible (0));
00246   init (ROW, "row", repeat (1, 1) -> inner_border () -> accessible (0));
00247   init (CELL, "cell", fixed (1) -> inner_border () -> accessible (0));
00248   init (SUBTABLE, "subtable", fixed (1) -> inner_border () -> accessible (0));
00249 
00250   init (ASSIGN, "assign",
00251        fixed (1, 1, BIFORM) -> variable (0) -> regular (1));
00252   init (WITH, "with",
00253        var_repeat (2, 1, BIFORM) -> with_like () ->
00254        binding (0) -> accessible (1));
00255   init (PROVIDES, "provides",
00256        fixed (1) -> returns_boolean () -> string_type (0));
00257   init (VALUE, "value", fixed (1) -> variable (0));
00258   init (QUOTE_VALUE, "quote-value",
00259        fixed (1) -> variable (0) -> name ("quoted value"));
00260   init (MACRO, "macro",
00261        var_repeat (1, 1, BIFORM) -> argument (0) -> regular (1));
00262   init (DRD_PROPS, "drd-props",
00263        repeat (3, 2) -> name ("drd properties"));
00264   init (QUOTE_ARG, "quote-arg",
00265        repeat (1, 1, BIFORM) -> argument (0) -> name ("quoted argument"));
00266   init (ARG, "arg",
00267        repeat (1, 1, BIFORM) -> argument (0) -> name ("argument"));
00268   init (COMPOUND, "compound",
00269        repeat (1, 1, BIFORM) -> variable (0) -> accessible (1));
00270   // FIXME: should be refined. The current setting is f.i. needed for "theorem"
00271   init (XMACRO, "xmacro",
00272        fixed (1, 1, BIFORM) -> argument (0) -> regular (1));
00273   init (GET_LABEL, "get-label", fixed (1) -> returns_string ());
00274   init (GET_ARITY, "get-arity", fixed (1) -> returns_integer ());
00275   init (MAP_ARGS, "map-args",
00276        options (3, 2, DETAILED) ->
00277        variable (0) -> name (0, "macro") ->
00278        variable (1) -> name (1, "return tag") ->
00279        argument (2) -> name (2, "argument") ->
00280        integer (3) -> name (3, "start index") ->
00281        integer (4) -> name (4, "end index") ->
00282        name ("map arguments"));
00283   init (EVAL_ARGS, "eval-args",
00284        fixed (1) -> argument (0) -> name ("evaluate arguments"));
00285   init (MARK, "mark", fixed (2));
00286   init (EXPAND_AS, "expand-as", fixed (2));
00287   init (EVAL, "eval", fixed (1) -> name ("evaluate"));
00288   init (QUOTE, "quote", fixed (1) -> regular (0));
00289   init (QUASI, "quasi", fixed (1) -> regular (0));
00290   init (QUASIQUOTE, "quasiquote", fixed (1) -> regular (0));
00291   init (UNQUOTE, "unquote", fixed (1) -> regular (0));
00292   init (VAR_UNQUOTE, "unquote*", fixed (1) -> regular (0));
00293   init (COPY, "copy", fixed (1) -> regular (0));
00294   init (IF, "if",
00295        options (2, 1, DETAILED) ->
00296        boolean (0) -> name (0, "condition") ->
00297         regular (1) -> regular (2));
00298   init (VAR_IF, "if*",
00299        fixed (1, 1, BIFORM) ->
00300        boolean (0) -> name (0, "condition") ->
00301         regular (1));
00302   init (CASE, "case",
00303        repeat (2, 1));
00304   init (WHILE, "while",
00305        fixed (1, 1, BIFORM) -> boolean (0) -> regular (1));
00306   init (FOR_EACH, "for-each",
00307        fixed (1, 1, BIFORM) -> variable (0) -> regular (1));
00308   init (EXTERN, "extern",
00309        repeat (1, 1, BIFORM) -> code (0) -> regular (1)); // func and args
00310   init (INCLUDE, "include", fixed (1) -> url_type (0));
00311   init (USE_PACKAGE, "use-package", repeat (1, 1) -> string_type (0));
00312   init (USE_MODULE, "use-module", repeat (1, 1) -> code (0));
00313 
00314   init (OR, "or", repeat (2, 1) -> returns_boolean () -> boolean (0));
00315   init (XOR, "xor", fixed (2) -> returns_boolean () -> boolean (0));
00316   init (AND, "and", repeat (2, 1) -> returns_boolean () -> boolean (0));
00317   init (NOT, "not", fixed (1) -> returns_boolean () -> boolean (0));
00318   init (PLUS, "plus", repeat (2, 1) -> returns_numeric () -> numeric (0));
00319   init (MINUS, "minus", repeat (1, 1) -> returns_numeric () -> numeric (0));
00320   init (TIMES, "times", repeat (2, 1) -> returns_numeric () -> numeric (0));
00321   init (OVER, "over", repeat (1, 1) -> returns_numeric () -> numeric (0));
00322   init (DIV, "div",
00323        fixed (2) -> returns_numeric () -> numeric (0) -> name ("divide"));
00324   init (MOD, "mod",
00325        fixed (2) -> returns_numeric () -> numeric (0) -> name ("modulo"));
00326   init (MINIMUM, "minimum",
00327        repeat (2, 1) -> returns_numeric () -> numeric (0));
00328   init (MAXIMUM, "maximum",
00329        repeat (1, 1) -> returns_numeric () -> numeric (0));
00330   init (MATH_SQRT, "math-sqrt",
00331        fixed (1) -> returns_numeric () -> numeric (0) ->
00332        name ("square root"));
00333   init (EXP, "exp", fixed (1) -> returns_numeric () -> numeric (0));
00334   init (LOG, "log", fixed (1) -> returns_numeric () -> numeric (0));
00335   init (POW, "pow", fixed (2) -> returns_numeric () -> numeric (0));
00336   init (COS, "cos", fixed (1) -> returns_numeric () -> numeric (0));
00337   init (SIN, "sin", fixed (1) -> returns_numeric () -> numeric (0));
00338   init (TAN, "tan", fixed (1) -> returns_numeric () -> numeric (0));
00339   init (MERGE, "merge", repeat (2, 1) -> returns_adhoc ());
00340   init (LENGTH, "length", fixed (1) -> returns_integer ());
00341   init (RANGE, "range",
00342        fixed (1, 2, BIFORM) -> returns_adhoc () -> accessible (0));
00343   init (NUMBER, "number",
00344        fixed (2) -> returns_string () -> string_type (0));
00345   init (_DATE, "date",
00346        options (0, 2) -> returns_string () -> string_type (0));
00347   init (TRANSLATE, "translate",
00348        fixed (3) -> returns_string () -> string_type (0));
00349   init (CHANGE_CASE, "change-case",
00350        fixed (1, 1, BIFORM) -> accessible (0) -> string_type (1));
00351   init (FIND_FILE, "find-file",
00352        var_repeat (1, 1) -> returns_url () -> url_type (0)); // dirs and file
00353   init (IS_TUPLE, "is-tuple",
00354        fixed (1) -> returns_boolean () -> regular (0) -> name ("tuple?"));
00355   init (LOOK_UP, "look-up",
00356        fixed (1, 1, BIFORM) -> regular (0) -> integer (1));
00357   init (EQUAL, "equal",
00358        fixed (2) -> returns_boolean () -> regular (0));
00359   init (UNEQUAL, "unequal",
00360        fixed (2) -> returns_boolean () -> regular (0) ->
00361        name ("not equal"));
00362   init (LESS, "less",
00363        fixed (2) -> returns_boolean () -> regular (0));
00364   init (LESSEQ, "lesseq",
00365        fixed (2) -> returns_boolean () -> regular (0) ->
00366        name ("less or equal"));
00367   init (GREATER, "greater",
00368        fixed (2) -> returns_boolean () -> regular (0));
00369   init (GREATEREQ, "greatereq",
00370        fixed (2) -> returns_boolean () -> regular (0) ->
00371        name ("greater or equal"));
00372 
00373   init (CM_LENGTH, "cm-length", fixed (0) -> returns_length ());
00374   init (MM_LENGTH, "mm-length", fixed (0) -> returns_length ());
00375   init (IN_LENGTH, "in-length", fixed (0) -> returns_length ());
00376   init (PT_LENGTH, "pt-length", fixed (0) -> returns_length ());
00377   init (BP_LENGTH, "bp-length", fixed (0) -> returns_length ());
00378   init (DD_LENGTH, "dd-length", fixed (0) -> returns_length ());
00379   init (PC_LENGTH, "pc-length", fixed (0) -> returns_length ());
00380   init (CC_LENGTH, "cc-length", fixed (0) -> returns_length ());
00381   init (FS_LENGTH, "fs-length", fixed (0) -> returns_length ());
00382   init (FBS_LENGTH, "fbs-length", fixed (0) -> returns_length ());
00383   init (EM_LENGTH, "em-length", fixed (0) -> returns_length ());
00384   init (LN_LENGTH, "ln-length", fixed (0) -> returns_length ());
00385   init (SEP_LENGTH, "sep-length", fixed (0) -> returns_length ());
00386   init (YFRAC_LENGTH, "yfrac-length", fixed (0) -> returns_length ());
00387   init (EX_LENGTH, "ex-length", fixed (0) -> returns_length ());
00388   init (FN_LENGTH, "fn-length", fixed (0) -> returns_length ());
00389   init (FNS_LENGTH, "fns-length", fixed (0) -> returns_length ());
00390   init (BLS_LENGTH, "bls-length", fixed (0) -> returns_length ());
00391   init (FNBOT_LENGTH, "fnbot-length", fixed (0) -> returns_length ());
00392   init (FNTOP_LENGTH, "fntop-length", fixed (0) -> returns_length ());
00393   init (SPC_LENGTH, "spc-length", fixed (0) -> returns_length ());
00394   init (XSPC_LENGTH, "xspc-length", fixed (0) -> returns_length ());
00395   init (PAR_LENGTH, "par-length", fixed (0) -> returns_length ());
00396   init (PAG_LENGTH, "pag-length", fixed (0) -> returns_length ());
00397   init (GW_LENGTH, "gw-length", fixed (0) -> returns_length ());
00398   init (GH_LENGTH, "gh-length", fixed (0) -> returns_length ());
00399   init (TMPT_LENGTH, "tmpt-length", fixed (0) -> returns_length ());
00400   init (PX_LENGTH, "px-length", fixed (0) -> returns_length ());
00401   init (MSEC_LENGTH, "msec-length", fixed (0) -> returns_length ());
00402   init (SEC_LENGTH, "sec-length", fixed (0) -> returns_length ());
00403   init (MIN_LENGTH, "min-length", fixed (0) -> returns_length ());
00404   init (HR_LENGTH, "hr-length", fixed (0) -> returns_length ());
00405 
00406   init (STYLE_WITH, "style-with",
00407        var_repeat (2, 1, BIFORM) -> binding (0) -> accessible (1));
00408   init (VAR_STYLE_WITH, "style-with*",
00409        var_repeat (2, 1, BIFORM) -> binding (0) -> accessible (1));
00410   init (STYLE_ONLY, "style-only", fixed (1) -> accessible (0));
00411   init (VAR_STYLE_ONLY, "style-only*", fixed (1) -> accessible (0));
00412   init (ACTIVE, "active", fixed (1) -> accessible (0));
00413   init (VAR_ACTIVE, "active*", fixed (1) -> accessible (0));
00414   init (INACTIVE, "inactive", fixed (1) -> accessible (0));
00415   init (VAR_INACTIVE, "inactive*", fixed (1) -> accessible (0));
00416   init (REWRITE_INACTIVE, "rewrite-inactive", fixed (2));
00417   init (INLINE_TAG, "inline-tag",
00418        repeat (1, 1, BIFORM) ->
00419        accessible (0) -> variable (0) -> name (0, "macro") ->
00420         accessible (1));
00421   init (OPEN_TAG, "open-tag",
00422        repeat (1, 1, BIFORM) ->
00423        accessible (0) -> variable (0) -> name (0, "macro") ->
00424         accessible (1));
00425   init (MIDDLE_TAG, "middle-tag",
00426        repeat (1, 1, BIFORM) ->
00427        variable (0) -> name (0, "macro") ->
00428         accessible (1));
00429   init (CLOSE_TAG, "close-tag",
00430        repeat (1, 1, BIFORM) ->
00431        variable (0) -> name (0, "macro") ->
00432         accessible (1));
00433   init (SYMBOL, "symbol",
00434         fixed (1) ->
00435         code (0) -> name (0, "name") -> locals (0, "mode", "src"));
00436   init (LATEX, "latex",
00437        fixed (1) ->
00438         code (0) -> name (0, "command") -> locals (0, "mode", "src"));
00439   init (HYBRID, "hybrid",
00440        options (1, 1, BIFORM) ->
00441        variable (0) -> name (0, "command") -> locals (0, "mode", "src") ->
00442        accessible (1));
00443 
00444   init (LOCUS, "locus",
00445        var_repeat (1, 1, BIFORM) ->
00446        accessible (1));
00447   init (ID, "id",
00448        repeat (1, 1) -> returns_adhoc () ->
00449        accessible (0) -> identifier (0));
00450   init (HARD_ID, "hard-id",
00451        options (0, 1) -> returns_identifier () ->
00452        regular (0));
00453   init (LINK, "link",
00454        repeat (1, 1, BIFORM) -> returns_adhoc () ->
00455        accessible (0) -> string_type (0) -> name (0, "link type") ->
00456        accessible (1) -> name (1, "participants"));
00457   init (URL, "url",
00458        options (1, 1, BIFORM) -> returns_adhoc () ->
00459        accessible (0) -> url_type (0) ->
00460        accessible (1) -> regular (1));       // FIXME: location?
00461   init (SCRIPT, "script",
00462        options (1, 1, BIFORM) -> returns_adhoc () ->
00463        accessible (0) -> code (0) -> name (0, "script") ->
00464        accessible (1) -> regular (1) -> name (0, "where"));
00465   init (HLINK, "hlink",
00466        fixed (1, 1, BIFORM) ->
00467        accessible (0) -> name (0, "text") ->
00468        url_type (1) -> name (1, "destination") ->
00469        name ("hyperlink"));
00470   init (ACTION, "action",
00471        options (2, 1, DETAILED) ->
00472        accessible (0) -> name (0, "text") ->
00473        code (1) -> name (1, "script") ->
00474        regular (2) -> name (2, "where"));
00475   init (SET_BINDING, "set-binding",
00476        options (1, 2));                      // see env_exec.cpp
00477   init (GET_BINDING, "get-binding",
00478        options (1, 1, BIFORM) ->
00479        identifier (0) -> name (0, "key") ->
00480        integer (1) -> name (0, "kind"));
00481   init (LABEL, "label",
00482        fixed (1) ->
00483         identifier (0) -> name (0, "id") -> long_name (0, "identifier"));
00484   init (REFERENCE, "reference",
00485        fixed (1) ->
00486         identifier (0) -> name (0, "id") -> long_name (0, "identifier"));
00487   init (PAGEREF, "pageref",
00488        fixed (1) -> name ("page reference") ->
00489         identifier (0) -> name (0, "id") -> long_name (0, "identifier"));
00490   init (WRITE, "write",
00491        fixed (1, 1, BIFORM) ->
00492        string_type (0) -> name (0, "channel") ->
00493        regular (1) -> name (1, "content"));
00494 
00495   init (TUPLE, "tuple",
00496        repeat (0, 1) -> accessible (0));
00497   init (ATTR, "attr",
00498        repeat (2, 2) -> accessible (0) -> binding (0) ->
00499        name ("attributes"));
00500   init (TMLEN, "tmlen",
00501        options (1, 2) -> returns_length () ->
00502        length (0) -> name ("TeXmacs length"));
00503   init (COLLECTION, "collection",
00504        repeat (1, 1) -> regular (0));
00505   init (ASSOCIATE, "associate",
00506        fixed (2) -> binding (0));
00507   init (BACKUP, "backup",
00508        fixed (2) -> regular (0));
00509   init (PATTERN, "pattern",
00510        options (3, 1, DETAILED) -> url_type (0));
00511   init (GRADIENT, "gradient",
00512        fixed (3));                           // not yet implemented
00513   init (SPECIFIC, "specific",
00514        fixed (1, 1, BIFORM) ->
00515        string_type (0) -> name (0, "medium") ->
00516        regular (1) -> name (1, "content"));
00517   init (FLAG, "flag",
00518        options (2, 1, DETAILED) ->
00519        regular (0) -> name (0, "flag text") ->
00520        string_type (1) -> name (1, "color") ->
00521        argument (2) -> name (2, "source"));
00522 
00523   init (ANIM_COMPOSE, "anim-compose",
00524        repeat (1, 1) -> returns_animation () ->
00525        animation (0));
00526   init (ANIM_REPEAT, "anim-repeat",
00527        fixed (1) -> returns_animation () ->
00528        accessible (0) -> animation (0));
00529   init (ANIM_CONSTANT, "anim-constant",
00530        fixed (1, 1, BIFORM) -> returns_animation () ->
00531        accessible (0) -> duration (1));
00532   init (ANIM_TRANSLATE, "anim-translate",
00533        fixed (1, 3, DETAILED) -> returns_animation () ->
00534        accessible (0) -> animation (0) ->
00535        duration (1));
00536   init (ANIM_PROGRESSIVE, "anim-progressive",
00537        fixed (1, 3, DETAILED) -> returns_animation () ->
00538        accessible (0) -> animation (0) ->
00539        duration (1));
00540   init (VIDEO, "video",
00541        fixed (1, 4, BIFORM) -> url_type (0));
00542   init (SOUND, "sound",
00543        fixed (1) -> url_type (0));
00544 
00545   init (GRAPHICS, "graphics",
00546        repeat (1, 1) -> accessible (0) -> graphical (0));
00547   init (SUPERPOSE, "superpose",
00548        repeat (1, 1) -> accessible (0));
00549   init (GR_GROUP, "gr-group",
00550        repeat (1, 1) -> returns_graphical () -> graphical (0));
00551   init (GR_LINEAR_TRANSFORM, "gr-linear-transform",
00552        fixed (1, 1, BIFORM) -> returns_graphical () ->
00553        graphical (0));
00554   init (TEXT_AT, "text-at",
00555        fixed (1, 1, BIFORM) -> returns_graphical () ->
00556        accessible (0) -> point_type (1));
00557   init (MATH_AT, "math-at",
00558        fixed (1, 1, BIFORM) -> returns_graphical () ->
00559        accessible (0) -> point_type (1) ->
00560         locals (0, "mode", "math"));
00561   init (_POINT, "point",
00562        repeat (1, 1) -> returns_graphical () -> point_type (0));
00563   init (LINE, "line",
00564        repeat (2, 1) -> returns_graphical () -> point_type (0));
00565   init (CLINE, "cline",
00566        repeat (3, 1) -> returns_graphical () -> point_type (0));
00567   init (ARC, "arc",
00568        repeat (3, 1) -> returns_graphical () -> point_type (0));
00569   init (CARC, "carc",
00570        repeat (3, 1) -> returns_graphical () -> point_type (0));
00571   init (SPLINE, "spline",
00572        repeat (2, 1) -> returns_graphical () -> point_type (0));
00573   init (VAR_SPLINE, "spline*",
00574        repeat (2, 1) -> returns_graphical () -> point_type (0));
00575   init (CSPLINE, "cspline",
00576        repeat (2, 1) -> returns_graphical () -> point_type (0));
00577   init (FILL, "fill",
00578        repeat (1, 1));                       // Not yet implemented
00579   init (IMAGE, "image",
00580        fixed (1, 4, DETAILED) ->
00581        url_type (0) -> name (0, "url") ->
00582        length (1) -> name (1, "width") ->
00583        length (2) -> name (2, "height") ->
00584         length (3) -> name (3, "x") -> long_name (3, "x-offset") ->
00585         length (4) -> name (4, "y") -> long_name (4, "y-offset"));
00586 
00587   init (BOX_INFO, "box-info",
00588        fixed (1, 1, BIFORM) ->
00589        regular (0) ->                        // content leading to box
00590        string_type (1));                     // query
00591   init (FRAME_DIRECT, "frame-direct",
00592        fixed (1) -> point_type (0));
00593   init (FRAME_INVERSE, "frame-inverse",
00594        fixed (1) -> point_type (0));
00595 
00596   init (IS_EQUAL, "is-equal",
00597         fixed (2) -> returns_constraint () -> graphical_id (0));
00598   init (IS_INTERSECTION, "is-intersection",
00599         fixed (3) -> returns_constraint () -> graphical_id (0));
00600   init (ON_CURVE, "on-curve",
00601         options (2, 1, BIFORM) -> returns_constraint () ->
00602         graphical_id (0) -> numeric (1));
00603   init (ON_TEXT_BORDER, "on-text-border",
00604         fixed (2) -> returns_constraint () -> graphical_id (0));
00605   init (ON_GRID, "on-grid",
00606         fixed (2) -> returns_constraint () -> graphical_id (0));
00607 
00608   init (CANVAS, "canvas", fixed (6, 1, BIFORM) -> accessible (1));
00609   init (ORNAMENT, "ornament", fixed (1) -> accessible (0));
00610 
00611   init (FORMAT, "format",
00612        repeat (1, 1));
00613   init (LINE_SEP, "line-sep",
00614        fixed (0) -> name ("line separator"));
00615   init (SPLIT, "split",
00616        repeat (1, 1));
00617   init (DELAY, "delay",
00618        fixed (1) -> regular (0));
00619   init (HOLD, "hold",
00620        fixed (1) -> regular (0));
00621   init (RELEASE, "release",
00622        fixed (1) -> regular (0));
00623   init (OLD_MATRIX, "old-matrix",
00624        var_repeat (1, 2, BIFORM) -> accessible (0));
00625   init (OLD_TABLE, "old-table",
00626        var_repeat (1, 2, BIFORM) -> accessible (0));
00627   init (OLD_MOSAIC, "old-mosaic",
00628        var_repeat (1, 2, BIFORM) -> accessible (0));
00629   init (OLD_MOSAIC_ITEM, "old-mosaic-item",
00630        repeat (1, 1) -> accessible (0));
00631   init (SET, "set",
00632        fixed (1, 1, BIFORM) -> variable (0) -> regular (0));
00633   init (RESET, "reset",
00634        fixed (1) -> variable (0));
00635   init (EXPAND, "expand",
00636        repeat (1, 1, BIFORM) ->
00637        variable (0) -> accessible (1));
00638   init (VAR_EXPAND, "expand*",
00639        repeat (1, 1, BIFORM) -> inner_border () ->
00640        variable (0) -> accessible (1));
00641   init (HIDE_EXPAND, "hide-expand",
00642        repeat (2, 1, DETAILED) ->
00643        accessible (1));
00644   init (APPLY, "apply",
00645        repeat (1, 1, BIFORM) -> variable (0));
00646   init (BEGIN, "begin",
00647        repeat (1, 1, BIFORM) -> variable (0));
00648   init (END, "end",
00649        fixed (1) -> variable (0));
00650   init (FUNC, "func",
00651        var_repeat (1, 1, BIFORM) ->
00652        argument (0) -> regular (1));
00653   init (ENV, "env",
00654        var_repeat (1, 2, BIFORM) ->
00655        argument (0));
00656   init (AUTHORIZE, "authorize",
00657        fixed (2));
00658   init (POSTSCRIPT, "postscript",
00659        fixed (1, 6, BIFORM) -> url_type (0));
00660 
00661   init (make_tree_label ("shown"), "shown",
00662        fixed (1) -> accessible (0) -> inner_border ());
00663   init (make_tree_label ("ignore"), "ignore",
00664        fixed (1) -> regular (0) -> inner_border ());
00665 }