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

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 */
        !            15: #define BUFFER_LEN 5000     /* 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.4     ! cvs        96:      strAttrDesc           *Attributes;
        !            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;
        !           106:      struct _RuleDesc   *Next;
1.2       cvs       107:   }
1.4     ! cvs       108: strRuleDesc;
1.1       cvs       109: 
                    110: #ifndef PPSTANDALONE
                    111: typedef struct _ListElem
1.2       cvs       112:   {
1.4     ! cvs       113:      Element             Elem;
        !           114:      int                 Id;
        !           115:      int                 Rank;
        !           116:      struct _ListElem   *Next;
1.2       cvs       117:   }
1.4     ! cvs       118: strListElem;
1.2       cvs       119: 
1.1       cvs       120: #endif
                    121: 
                    122: typedef struct _ListSymb
1.2       cvs       123:   {
1.4     ! cvs       124:      struct _SymbDesc   *Symbol;
        !           125:      struct _ListSymb   *Next;
1.2       cvs       126:   }
1.4     ! cvs       127: strListSymb;
1.1       cvs       128: 
1.4     ! cvs       129: /* pattern node (symbol) */
1.1       cvs       130: typedef struct _SymbDesc
1.2       cvs       131:   {
1.4     ! cvs       132:      char               *SymbolName;
1.2       cvs       133:      char               *Tag;
1.4     ! cvs       134:      strRuleDesc        *Rule;
        !           135:      boolean             IsOptional;
        !           136:      boolean             IsActiveSymb;
        !           137:      boolean             IsOptChild;
        !           138:      int                 Depth;
        !           139:      strAttrDesc        *Attributes;
        !           140:      strListSymb        *Children;
        !           141:      strListSymb        *Followings;
        !           142:      struct _SymbDesc   *Next;
1.2       cvs       143:   }
1.4     ! cvs       144: strSymbDesc;
1.1       cvs       145: 
1.4     ! cvs       146: /* transformation descriptor */
1.1       cvs       147: typedef struct _TransDesc
1.2       cvs       148:   {
                    149:      char               *NameTrans;
1.4     ! cvs       150:      int                 NbPatSymb;
        !           151:      int                 NbRules;
        !           152:      int                 PatDepth;
        !           153:      strListSymb        *First;
        !           154:      strSymbDesc        *RootDesc;
        !           155:      strSymbDesc        *Symbols;
        !           156:      strRuleDesc        *Rules;
        !           157:      boolean             IsActiveTrans;
        !           158:      char               *DestinationTag;
        !           159:      struct _TransDesc  *Next;
1.2       cvs       160:   }
1.4     ! cvs       161: strTransDesc;
1.1       cvs       162: 
1.4     ! cvs       163: /* transformation environement */
        !           164: struct _strMatchEnv
1.2       cvs       165:   {
1.1       cvs       166: #ifndef PPSTANDALONE
1.4     ! cvs       167:      StructureTree       SourceTree;
        !           168:      strListElem        *ListSubTrees;
1.1       cvs       169: #endif
1.4     ! cvs       170:      /* number of transformations */
        !           171:      int                 NbTrans;
        !           172:      /* patterns max depth*/
        !           173:      int                 MaxDepth;
        !           174:      strTransDesc       *Transformations;
1.2       cvs       175:   }
1.4     ! cvs       176: strMatchEnv;
1.1       cvs       177: 
                    178: 
                    179: 
                    180: #ifndef PPSTANDALONE
1.4     ! cvs       181: /* document to wich a transformation is to be applied */
1.2       cvs       182: Document            TransDoc;
                    183: 
1.4     ! cvs       184: /* dialog and messages */
1.2       cvs       185: int                 TransBaseDialog;
                    186: int                 TRANSDIAL;
                    187: 
1.1       cvs       188: #define TR_TRANSFORM 0
                    189: #define TRANS_MSG_MAX 1
                    190: #define TransMenu 1
                    191: #define MAX_TRANS_DLG 2
                    192: 
1.4     ! cvs       193: /*last modification date of transformation resource file */
1.2       cvs       194: time_t              timeLastWrite;
                    195: 
1.1       cvs       196: #endif
1.2       cvs       197: #endif /* _TRANS_H__ */

Webmaster