Annotation of Amaya/amaya/trans.h, revision 1.7

1.3       cvs         1: /*
                      2:  *
                      3:  *  (c) COPYRIGHT MIT and INRIA, 1996.
                      4:  *  Please first read the full copyright statement in file COPYRIGHT.
                      5:  *
                      6:  */
                      7: 
1.2       cvs         8: #ifndef _TRANS_H__
                      9: #define _TRANS_H__
1.4       cvs        10: /*----------------------------------------------------------------------
                     11:      Definitions of types and variables used in type transformation (trans.c and transparse.c)
                     12:      Stephane Bonhomme Apr 96   
                     13:   ----------------------------------------------------------------------*/
                     14: #define MAX_STACK 100       /* size of html generation and pattern matching stacks */
1.7     ! cvs        15: #define BUFFER_LEN 10000     /* size of html buffer */
1.1       cvs        16: 
                     17: #ifndef PPSTANDALONE
                     18: 
1.4       cvs        19: /*----------------------------------------------------------------------
                     20:     structure definitions
                     21:   ----------------------------------------------------------------------*/
                     22: /*relation between pattern nodes (also called Symbols) and source structure tree nodes*/
                     23: typedef struct _MatchChildren
                     24:   {
                     25:      struct _SymbDesc   *MatchSymb;    /* pattern symbol */
                     26:      struct _Node       *MatchNode;    /* source tree node */
                     27:      struct _MatchChildren *Next;
                     28:   }
                     29: strMatchChildren;
                     30: 
                     31: typedef struct _Match
                     32:   {
                     33:      struct _SymbDesc   *MatchSymb;    /* pattern symbol */
                     34:      struct _Node       *MatchNode;    /* source tree node */
                     35:      strMatchChildren   *MatchChildren;        /* relation between chidren in both pattern and source tree */
                     36:      struct _Match   *Next;
                     37:   }
                     38: strMatch;
                     39: 
                     40: 
                     41: /* Source structure tree nodes definition */
                     42: typedef struct _Node
                     43:   {
                     44:      char               *Tag;          /* HTML tag */
                     45:      Element             Elem;         /* element instance */
                     46:      struct _Node       *Parent;       
                     47:      struct _Node       *Child;
                     48:      struct _Node       *Next;
                     49:      struct _Node       *Previous;
                     50:      int                 NodeDepth;
                     51:      boolean             IsTrans;
                     52:      struct _SymbDesc   *MatchSymb;    /* symbol matched (transformation phase) */
                     53:      strMatch           *Matches;      /* Symbols Matched (pattern matching) */
                     54:      struct _ListSymb   *Candidates;   /* list of symbols potientally matched */
                     55:     }
                     56: strNode;
1.1       cvs        57: 
1.4       cvs        58: typedef strNode   *StructureTree;
1.1       cvs        59: 
1.4       cvs        60: #endif
1.1       cvs        61: 
1.4       cvs        62: /* internal reprensentation of transformation rules */
1.1       cvs        63: 
1.4       cvs        64: /* Attribute descriptor */
1.1       cvs        65: typedef struct _AttrDesc
1.2       cvs        66:   {
                     67:      char               *NameAttr;
                     68:      int                 ThotAttr;
                     69:      boolean             IsInt;
                     70:      boolean             IsTransf;
                     71:      union
                     72:        {
                     73:          char               *_TextVal;
                     74:          int                 _IntVal;
                     75:          struct _s0
                     76:            {
                     77:               char               *_Tag;
                     78:               char               *_Attr;
                     79:            }
                     80:          s0;
                     81:        }
                     82:      u;
1.4       cvs        83:      struct _AttrDesc   *Next;
1.2       cvs        84:   }
1.4       cvs        85: strAttrDesc;
1.1       cvs        86: 
                     87: #define TextVal u._TextVal
                     88: #define IntVal u._IntVal
                     89: #define AttrTag u.s0._Tag
                     90: #define AttrAttr u.s0._Attr
                     91: 
1.4       cvs        92: /* node generated */
1.1       cvs        93: typedef struct _NodeDesc
1.2       cvs        94:   {
                     95:      char               *Tag;
1.5       cvs        96:      strAttrDesc        *Attributes;
1.4       cvs        97:      struct _NodeDesc   *Next;
1.2       cvs        98:   }
1.4       cvs        99: strNodeDesc;
1.1       cvs       100: 
                    101: typedef struct _RuleDesc
1.2       cvs       102:   {
1.4       cvs       103:      char               *RuleName;
                    104:      strNodeDesc        *OptionNodes;
                    105:      strNodeDesc        *NewNodes;
1.5       cvs       106:      struct _RuleDesc   *NextRule;
1.4       cvs       107:      struct _RuleDesc   *Next;
1.2       cvs       108:   }
1.4       cvs       109: strRuleDesc;
1.1       cvs       110: 
                    111: #ifndef PPSTANDALONE
                    112: typedef struct _ListElem
1.2       cvs       113:   {
1.4       cvs       114:      Element             Elem;
                    115:      int                 Id;
                    116:      int                 Rank;
                    117:      struct _ListElem   *Next;
1.2       cvs       118:   }
1.4       cvs       119: strListElem;
1.2       cvs       120: 
1.1       cvs       121: #endif
                    122: 
                    123: typedef struct _ListSymb
1.2       cvs       124:   {
1.4       cvs       125:      struct _SymbDesc   *Symbol;
                    126:      struct _ListSymb   *Next;
1.2       cvs       127:   }
1.4       cvs       128: strListSymb;
1.1       cvs       129: 
1.4       cvs       130: /* pattern node (symbol) */
1.1       cvs       131: typedef struct _SymbDesc
1.2       cvs       132:   {
1.4       cvs       133:      char               *SymbolName;
1.2       cvs       134:      char               *Tag;
1.4       cvs       135:      strRuleDesc        *Rule;
                    136:      boolean             IsOptional;
                    137:      boolean             IsActiveSymb;
                    138:      boolean             IsOptChild;
                    139:      int                 Depth;
                    140:      strAttrDesc        *Attributes;
                    141:      strListSymb        *Children;
                    142:      strListSymb        *Followings;
                    143:      struct _SymbDesc   *Next;
1.2       cvs       144:   }
1.4       cvs       145: strSymbDesc;
1.1       cvs       146: 
1.4       cvs       147: /* transformation descriptor */
1.1       cvs       148: typedef struct _TransDesc
1.2       cvs       149:   {
                    150:      char               *NameTrans;
1.4       cvs       151:      int                 NbPatSymb;
                    152:      int                 NbRules;
                    153:      int                 PatDepth;
                    154:      strListSymb        *First;
                    155:      strSymbDesc        *RootDesc;
                    156:      strSymbDesc        *Symbols;
                    157:      strRuleDesc        *Rules;
                    158:      boolean             IsActiveTrans;
                    159:      char               *DestinationTag;
                    160:      struct _TransDesc  *Next;
1.2       cvs       161:   }
1.4       cvs       162: strTransDesc;
1.1       cvs       163: 
1.6       cvs       164: typedef struct _TransSet
                    165: {
                    166:   /* name of the transformation set (eg, name of file without suffix .trans) */
                    167:   char               TransFileName [20];
                    168:   time_t             timeLastWrite;
                    169:   /* number of transformations */
                    170:   int                 NbTrans;
                    171:   /* patterns max depth */
                    172:   int                 MaxDepth;
                    173:   /* transformation descriptor list */
                    174:   strTransDesc       *Transformations;
                    175:   /* next set */
                    176:   struct _TransSet   *Next;
                    177: }
                    178: strTransSet;
                    179: 
1.4       cvs       180: /* transformation environement */
                    181: struct _strMatchEnv
1.6       cvs       182: {
1.1       cvs       183: #ifndef PPSTANDALONE
1.6       cvs       184:   StructureTree       SourceTree;
                    185:   strListElem        *ListSubTrees;
1.1       cvs       186: #endif
1.6       cvs       187:   strTransSet       *TransSets; 
                    188: }
1.4       cvs       189: strMatchEnv;
1.1       cvs       190: 
                    191: 
                    192: 
1.6       cvs       193: 
1.1       cvs       194: #ifndef PPSTANDALONE
1.4       cvs       195: /* document to wich a transformation is to be applied */
1.2       cvs       196: Document            TransDoc;
                    197: 
1.4       cvs       198: /* dialog and messages */
1.2       cvs       199: int                 TransBaseDialog;
                    200: int                 TRANSDIAL;
                    201: 
1.1       cvs       202: #define TR_TRANSFORM 0
                    203: #define TRANS_MSG_MAX 1
                    204: #define TransMenu 1
                    205: #define MAX_TRANS_DLG 2
1.2       cvs       206: 
1.1       cvs       207: #endif
1.2       cvs       208: #endif /* _TRANS_H__ */

Webmaster