exip  Alpha 0.5.4
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
grammars.c File Reference

Defines grammar related functions. More...

#include "grammars.h"
#include "stringManipulate.h"
#include "memManagement.h"
#include "sTables.h"
#include "ioUtil.h"

Go to the source code of this file.

Macros

#define DEF_DOC_GRAMMAR_RULE_NUMBER   2
 
#define DEF_FRAG_GRAMMAR_RULE_NUMBER   1
 
#define DEF_ELEMENT_GRAMMAR_RULE_NUMBER   2
 

Functions

errorCode createDocGrammar (EXIPSchema *schema, QNameID *elQnameArr, Index qnameCount)
 Creates an instance of the EXI Built-in Document Grammar or Schema-Informed Document Grammar. More...
 
errorCode pushGrammar (EXIGrammarStack **gStack, QNameID currQNameID, EXIGrammar *grammar)
 Push a grammar on top of the Grammar Stack. More...
 
void popGrammar (EXIGrammarStack **gStack)
 Pop a grammar off the top of the Grammar Stack. More...
 
errorCode createFragmentGrammar (EXIPSchema *schema, QNameID *elQnameArr, Index qnameCount)
 Creates an instance of the EXI Built-in Fragment Grammar or Schema-Informed Fragment Grammar. More...
 
unsigned int getBitsFirstPartCode (EXIStream *strm, Index prodCount, SmallIndex currentRuleIndx)
 For a given grammar and a rule from it, returns the number of bits needed to encode a production from that rule. More...
 
errorCode printGrammarRule (SmallIndex nonTermID, GrammarRule *rule, EXIPSchema *schema)
 Prints a grammar rule Note! This is only for debugging purposes! More...
 

Detailed Description

Date
Sep 13, 2010
Author
Rumen Kyusakov
Version
0.5
[Revision] $Id: grammars.c 335 2014-05-05 18:23:26Z kjussakov $

Definition in file grammars.c.

Macro Definition Documentation

#define DEF_DOC_GRAMMAR_RULE_NUMBER   2

Definition at line 23 of file grammars.c.

#define DEF_ELEMENT_GRAMMAR_RULE_NUMBER   2

Definition at line 25 of file grammars.c.

#define DEF_FRAG_GRAMMAR_RULE_NUMBER   1

Definition at line 24 of file grammars.c.

Function Documentation

errorCode createDocGrammar ( EXIPSchema schema,
QNameID elQnameArr,
Index  qnameCount 
)

If elQnameArr is NULL then it creates EXI Built-in Document Grammar, otherwise it creates Schema-Informed Document Grammar with global elements stored (sorted) in elQnameArr

Parameters
[in,out]schemathe schema describing the document
[in]elQnameArrarray of QNameIds of global element definitions if any; NULL otherwise (schema-less mode)
[in]qnameCountthe number of global element definitions if any; 0 otherwise
Returns
Error handling code

Definition at line 27 of file grammars.c.

errorCode createFragmentGrammar ( EXIPSchema schema,
QNameID elQnameArr,
Index  qnameCount 
)

If elQnameArr is NULL then it creates EXI Built-in Fragment Grammar, otherwise it creates Schema-Informed Fragment Grammar

Parameters
[in,out]schemathe schema describing the document
[in]elQnameArrarray of QNameIds of element definitions if any; NULL otherwise (schema-less mode)
[in]qnameCountthe number of global element definitions if any; 0 otherwise
Returns
Error handling code

Definition at line 240 of file grammars.c.

unsigned int getBitsFirstPartCode ( EXIStream strm,
Index  prodCount,
SmallIndex  currentRuleIndx 
)
Parameters
[in]strmEXI stream
[in]prodCountnumber of productions in the current grammar rule
[in]currentRuleIndxthe index of the concrete grammar rule
Returns
number of bits needed to encode a production

Definition at line 320 of file grammars.c.

void popGrammar ( EXIGrammarStack **  gStack)
Parameters
[in,out]gStackthe Grammar stack

Definition at line 228 of file grammars.c.

errorCode printGrammarRule ( SmallIndex  nonTermID,
GrammarRule rule,
EXIPSchema schema 
)
Parameters
[in]nonTermIDThe left hand side nonTerminal of the Rule
[in]rulea Grammar Rule to be printed
[in]schemafor string tables
Returns
Error handling code

Definition at line 426 of file grammars.c.

errorCode pushGrammar ( EXIGrammarStack **  gStack,
QNameID  currQNameID,
EXIGrammar grammar 
)
Parameters
[in,out]gStackthe Grammar Stack
[in]currQNameIDthe currently proccessed element QNameID that is having this grammar
[in]grammara EXI grammar
Returns
Error handling code

Definition at line 214 of file grammars.c.