exip
Alpha 0.5.4
|
Implementation of utility functions for generating Schema-informed Grammar definitions. More...
#include "genUtils.h"
#include "memManagement.h"
#include "stringManipulate.h"
#include "grammars.h"
#include "ioUtil.h"
#include "initSchemaInstance.h"
Go to the source code of this file.
Functions | |
errorCode | concatenateGrammars (ProtoGrammar *left, ProtoGrammar *right) |
Grammar Concatenation Operator - extends the rules and productions in the left ProtoGrammar The grammar concatenation operator ⊕ is a binary, associative operator that creates a new grammar from its left and right grammar operands. More... | |
errorCode | createSimpleTypeGrammar (Index typeId, ProtoGrammar *simpleGrammar) |
Creates Simple Type Grammar from XML Schema simple type definition. More... | |
errorCode | createComplexTypeGrammar (ProtoGrammarArray *attrUseArray, ProtoGrammar *contentTypeGrammar, boolean isMixedContent, ProtoGrammar *complexGrammar) |
Creates Complex Type Proto-Grammar from XML Schema complex type definition Sort the attribute use grammars first by qname local-name, then by qname uri. More... | |
errorCode | createComplexUrTypeGrammar (ProtoGrammar *result) |
Creates Complex Ur-Type Grammar from XML Schema complex ur-type. More... | |
errorCode | createAttributeUseGrammar (boolean required, Index typeId, ProtoGrammar *attrGrammar, QNameID qnameID) |
Creates Attribute Use Grammar from XML Schema Attribute Use. More... | |
errorCode | createParticleGrammar (int minOccurs, int maxOccurs, ProtoGrammar *termGrammar, ProtoGrammar *particleGrammar) |
Creates Particle Proto-Grammar from XML Schema particle. More... | |
errorCode | createElementTermGrammar (ProtoGrammar *elemGrammar, QNameIDGrIndx *qnameGrArr, Index count) |
Creates Element Term Proto-Grammar from Particle term that is XML Schema element declaration. More... | |
errorCode | createWildcardTermGrammar (String *wildcardArray, Index wildcardArraySize, UriTable *uriT, ProtoGrammar *wildcardGrammar) |
Creates Wildcard Term Proto-Grammar from Particle term that is XML Schema wildcard. More... | |
errorCode | createSequenceModelGroupsGrammar (ProtoGrammar **grArray, unsigned int arrSize, ProtoGrammar *seqGrammar) |
Creates Sequence Model Group Proto-Grammar from Particle term that is XML Schema Model Group with {compositor} equal to "sequence". More... | |
errorCode | createChoiceModelGroupsGrammar (ProtoGrammarArray *pgArray, ProtoGrammar *modGrpGrammar) |
Creates Choice Model Group Proto-Grammar from Particle term that is XML Schema Model Group with {compositor} equal to "choice". More... | |
errorCode | createAllModelGroupsGrammar (ProtoGrammar *pTermArray, unsigned int pTermArraySize, ProtoGrammar *modGrpGrammar) |
Creates All Model Group Proto-Grammar from Particle term that is XML Schema Model Group with {compositor} equal to "all". More... | |
errorCode | addEEProduction (ProtoRuleEntry *rule) |
Adds a EE production to a proto grammar rule. More... | |
int | compareQNameID (const void *qnameID1, const void *qnameID2, UriTable *uriTbl) |
Compare lexicographically two qnames: first by qname local-name, then by qname uri NOTE: Relies on the fact that the sting tables are sorted beforehand! More... | |
Definition in file genUtils.c.
errorCode addEEProduction | ( | ProtoRuleEntry * | rule) |
[in] | rule | proto grammar rule |
Definition at line 651 of file genUtils.c.
int compareQNameID | ( | const void * | qnameID1, |
const void * | qnameID2, | ||
UriTable * | uriTbl | ||
) |
[in] | qnameID1 | qnameId of the first qname |
[in] | qnameID2 | qnameId of the second qname |
[in] | uriTbl | string table reference |
The strings in the string tables are sorted beforehand so simple comparison of the indexes is enough.
Definition at line 668 of file genUtils.c.
errorCode concatenateGrammars | ( | ProtoGrammar * | left, |
ProtoGrammar * | right | ||
) |
The new grammar accepts any set of symbols accepted by its left operand followed by any set of symbols accepted by its right operand. As opposed to the operator in the specification, the implementation here automatically normalize the resulting grammar
[in,out] | left | left operand - grammar |
[in] | right | right operand - grammar |
Definition at line 32 of file genUtils.c.
errorCode createAllModelGroupsGrammar | ( | ProtoGrammar * | pTermArray, |
unsigned int | pTermArraySize, | ||
ProtoGrammar * | modGrpGrammar | ||
) |
[in] | pTermArray | an array of ParticleTerm grammars included in the All Model Group |
[in] | pTermArraySize | the size of the ParticleTerm grammar array |
[out] | modGrpGrammar | the resulted proto-grammar |
Definition at line 646 of file genUtils.c.
errorCode createAttributeUseGrammar | ( | boolean | required, |
Index | typeId, | ||
ProtoGrammar * | attrGrammar, | ||
QNameID | qnameID | ||
) |
[in] | required | 0 - false; otherwise true |
[in] | typeId | the id of the attribute type in the simpleTypeTable |
[out] | attrGrammar | the resulted proto-grammar |
[in] | qnameID | uri/ln indices in the unsorted string tables |
Definition at line 364 of file genUtils.c.
errorCode createChoiceModelGroupsGrammar | ( | ProtoGrammarArray * | pgArray, |
ProtoGrammar * | modGrpGrammar | ||
) |
[in,out] | pgArray | array of ParticleTerm grammars included in the Choice Model Group |
[out] | modGrpGrammar | the resulted proto-grammar |
Definition at line 567 of file genUtils.c.
errorCode createComplexTypeGrammar | ( | ProtoGrammarArray * | attrUseArray, |
ProtoGrammar * | contentTypeGrammar, | ||
boolean | isMixedContent, | ||
ProtoGrammar * | complexGrammar | ||
) |
If {content type} is type definition T-j , generate a grammar Content-i as grammar Type-j Then create a copy H-i of each attribute use grammar Result: Type-i = H-0 ⊕ H-1 ⊕ … ⊕ H-n−1 ⊕ Content-i
[in] | attrUseArray | array of attribute uses grammars included in this complex type It should be lexicographically sorted |
[in] | contentTypeGrammar | the proto-grammar of the complex type content: either Simple Type Grammar, or Particle grammar or empty |
[in] | isMixedContent | if the complex types has mixed content type (TRUE) or not (FALSE) |
[in,out] | complexGrammar | the resulted proto-grammar |
Definition at line 308 of file genUtils.c.
errorCode createComplexUrTypeGrammar | ( | ProtoGrammar * | result) |
[out] | result | the resulted proto-grammar |
Definition at line 359 of file genUtils.c.
errorCode createElementTermGrammar | ( | ProtoGrammar * | elemGrammar, |
QNameIDGrIndx * | qnameGrArr, | ||
Index | count | ||
) |
[out] | elemGrammar | the resulted proto-grammar |
[in] | qnameGrArr | array of uri/ln indices of the element in the string tables and the associated grammar indices to be used for processing this SE(qnameID) element |
[in] | count |
Definition at line 479 of file genUtils.c.
errorCode createParticleGrammar | ( | int | minOccurs, |
int | maxOccurs, | ||
ProtoGrammar * | termGrammar, | ||
ProtoGrammar * | particleGrammar | ||
) |
[in] | minOccurs | particle's {min Occurs} |
[in] | maxOccurs | particle's {max Occurs}. If less than 0 then the value is {unbounded} |
[in] | termGrammar | the grammar created from the particle's term: Element Term, Wildcard Term or Model Group Term |
[out] | particleGrammar | the resulted proto-grammar |
Definition at line 386 of file genUtils.c.
errorCode createSequenceModelGroupsGrammar | ( | ProtoGrammar ** | grArray, |
unsigned int | arrSize, | ||
ProtoGrammar * | sequenceGrammar | ||
) |
[in] | grArray | array of proto ParticleTerm grammars included in the sequence Model Group |
[in] | arrSize | the size of the array of proto ParticleTerm grammars |
[out] | sequenceGrammar | the resulted proto-grammar |
Definition at line 540 of file genUtils.c.
errorCode createSimpleTypeGrammar | ( | Index | typeId, |
ProtoGrammar * | simpleGrammar | ||
) |
[in] | typeId | index of the type in the simple type table |
[in,out] | simpleGrammar | The simple proto-grammar |
Definition at line 292 of file genUtils.c.
errorCode createWildcardTermGrammar | ( | String * | wildcardArray, |
Index | wildcardArraySize, | ||
UriTable * | uriT, | ||
ProtoGrammar * | wildcardGrammar | ||
) |
[in] | wildcardArray | array of strings. Possible values: "any" or a set of namespace names and "absent" or 'not' and a namespace name or "not" and "absent" |
[in] | wildcardArraySize | the size of the wildcard array |
[in] | uriT | the URI string table |
[out] | wildcardGrammar | the resulted proto-grammar |
Definition at line 500 of file genUtils.c.