コード例 #1
0
void XSDParser::ParseEnumeration(DTDAttribute& att)
// enumeration
// http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/datatypes.html#rf-enumeration
// actual value
// http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/structures.html#key-vv
{
    TToken tok = GetRawAttributeSet();
    att.SetType(DTDAttribute::eEnum);
    int id = 0;
    if (GetAttribute("intvalue")) {
        id = NStr::StringToInt(m_Value);
        att.SetType(DTDAttribute::eIntEnum);
    }
    if (GetAttribute("value")) {
        string v(m_ValuePrefix);
        if (!v.empty()) {
            v += ':';
        }
        v += m_Value;
        NStr::TruncateSpacesInPlace(v);
        att.AddEnumValue(v, Lexer().CurrentLine(), id);
    }
    if (tok == K_CLOSING) {
        ParseContent(att);
    }
}
コード例 #2
0
void XSDParser::ParseSimpleContent(DTDElement& node)
{
    TToken tok = GetRawAttributeSet();
    if (tok == K_CLOSING) {
        ParseContent(node);
    }
}
コード例 #3
0
void XSDParser::ParseContent(DTDAttribute& att)
{
    TToken tok;
    for ( tok=GetNextToken(); tok != K_ENDOFTAG; tok=GetNextToken()) {
        switch (tok) {
        case T_EOF:
            return;
        case K_ENUMERATION:
            ParseEnumeration(att);
            break;
        case K_EXTENSION:
            ParseExtension(att);
            break;
        case K_RESTRICTION:
            ParseRestriction(att);
            break;
        case K_ANNOTATION:
            SetCommentsIfEmpty(&(att.Comments()));
            ParseAnnotation();
            break;
        case K_UNION:
            ParseUnion(att);
            break;
        case K_LIST:
            ParseList(att);
            break;
        default:
            tok = GetRawAttributeSet();
            if (tok == K_CLOSING) {
                ParseContent(att);
            }
            break;
        }
    }
}
コード例 #4
0
string XSDParser::ParseGroup(DTDElement* owner, int emb)
{
    string name;
    TToken tok = GetRawAttributeSet();
    if (GetAttribute("ref")) {

        string id = CreateEntityId(m_Value,DTDEntity::eGroup);
        name = CreateTmpEmbeddedName(owner->GetName(), emb);
        DTDElement& node = m_MapElement[name];
        node.SetEmbedded();
        node.SetName(m_Value);
        node.SetOccurrence( ParseMinOccurs( node.GetOccurrence()));
        node.SetOccurrence( ParseMaxOccurs( node.GetOccurrence()));
        node.SetQualified(owner->IsQualified());
        SetCommentsIfEmpty(&(node.Comments()));

        if (m_ResolveTypes) {
            if (m_MapEntity.find(id) != m_MapEntity.end()) {
                PushEntityLexer(id);
                ParseGroupRef(node);
            } else {
                ParseError("Unresolved entity", id.c_str());
            }
        } else {
            node.SetTypeName(node.GetName());
            node.SetType(DTDElement::eUnknownGroup);
            Lexer().FlushCommentsTo(node.Comments());
        }
    }
    if (tok == K_CLOSING) {
        ParseContent(m_MapElement[name]);
    }
    m_ExpectLastComment = true;
    return name;
}
コード例 #5
0
void XSDParser::ParseContainer(DTDElement& node)
{
    TToken tok = GetRawAttributeSet();
    m_ExpectLastComment = true;
    node.SetOccurrence( ParseMinOccurs( node.GetOccurrence()));
    node.SetOccurrence( ParseMaxOccurs( node.GetOccurrence()));
    if (tok == K_CLOSING) {
        ParseContent(node);
    }
}
コード例 #6
0
void XSDParser::ParseAttributeGroupRef(DTDElement& node)
{
    if (GetNextToken() != K_ATTRIBUTEGROUP) {
        ParseError("attributeGroup");
    }
    if (GetRawAttributeSet() == K_CLOSING) {
        ParseContent(node);
    }
    PopEntityLexer();
}
コード例 #7
0
void XSDParser::ParseGroupRef(DTDElement& node)
{
    if (GetNextToken() != K_GROUP) {
        ParseError("group");
    }
    TToken tok = GetRawAttributeSet();
    if (tok == K_CLOSING) {
        ParseContent(node);
    }
    PopEntityLexer();
}
コード例 #8
0
void XSDParser::ParseComplexType(DTDElement& node)
{
    TToken tok = GetRawAttributeSet();
    if (GetAttribute("mixed")) {
        if (IsValue("true")) {
            string name(s_SpecialName);
	        AddElementContent(node,name);
        }
    }
    if (tok == K_CLOSING) {
        ParseContent(node);
    }
}
コード例 #9
0
void XSDParser::ParseRestriction(DTDAttribute& att)
{
    TToken tok = GetRawAttributeSet();
    if (GetAttribute("base")) {
        if (!DefineAttributeType(att)) {
            if (m_ResolveTypes) {
                string id = CreateEntityId(m_Value,DTDEntity::eType);
                if (m_MapEntity.find(id) != m_MapEntity.end()) {
                    PushEntityLexer(id);
                    ParseContent(att);
                } else {
                    ParseError("Unresolved entity", id.c_str());
                }
            } else {
                att.SetTypeName(m_Value);
            }
        }
    }
    if (tok == K_CLOSING) {
        ParseContent(att);
    }
}
コード例 #10
0
void XSDParser::ParseRestriction(DTDElement& node)
{
    TToken tok = GetRawAttributeSet();
    bool extended=false;
    if (GetAttribute("base")) {
        if (!DefineElementType(node)) {
            string id = CreateEntityId(m_Value,DTDEntity::eType);
            if (m_ResolveTypes) {
                if (m_MapEntity.find(id) != m_MapEntity.end()) {
                    PushEntityLexer(id);
                    ParseContent(node);
                    extended=true;
                } else {
                    ParseError("Unresolved entity", id.c_str());
                }
            } else {
                node.SetTypeName(m_Value);
            }
        }
    }
    if (tok == K_CLOSING) {
        ParseContent(node,extended);
    }
}
コード例 #11
0
void XSDParser::ParseAttribute(DTDElement& node)
{
    DTDAttribute a;
    node.AddAttribute(a);
    DTDAttribute& att = node.GetNonconstAttributes().back();
    att.SetSourceLine(Lexer().CurrentLine());
    SetCommentsIfEmpty(&(att.Comments()));
    bool ref=false, named_type=false;
    bool qualified = m_AttributeFormDefault;

    TToken tok = GetRawAttributeSet();
    if (GetAttribute("ref")) {
        att.SetName(m_Value);
        ref=true;
    }
    if (GetAttribute("name")) {
        att.SetName(m_Value);
    }
    if (GetAttribute("type")) {
        if (!DefineAttributeType(att)) {
            att.SetTypeName(m_Value);
            named_type = true;
        }
    }
    if (GetAttribute("use")) {
        if (IsValue("required")) {
            att.SetValueType(DTDAttribute::eRequired);
        } else if (IsValue("optional")) {
            att.SetValueType(DTDAttribute::eImplied);
        } else if (IsValue("prohibited")) {
            att.SetValueType(DTDAttribute::eProhibited);
        }
    }
    if (GetAttribute("default")) {
        att.SetValue(m_Value);
    }
    if (GetAttribute("form")) {
        qualified = IsValue("qualified");
    }
    att.SetQualified(qualified);
    if (tok == K_CLOSING) {
        ParseContent(att);
    }
    if (!ref && !named_type) {
        att.SetTypeIfUnknown(DTDAttribute::eString);
    }
    m_ExpectLastComment = true;
}
コード例 #12
0
XDAS_Int32 readparamfile(FILE * fname , int baseParamsOnly)
{
  XDAS_Int8 *FileBuffer = NULL ;
  XDAS_Int32 retVal ; 

  //read the content in a buffer
  FileBuffer = GetConfigFileContent(fname);

  if(FileBuffer)
  {
   retVal  = ParseContent(FileBuffer,strlen(FileBuffer),baseParamsOnly);
    return retVal ;
  }
  else
    return -1;
}
コード例 #13
0
XDAS_Int32 readparamfile(FILE * fname)
{
  XDAS_Int8 *FileBuffer = NULL ;
  XDAS_Int32 retVal ; 

  /* Read entire content in a buffer */
  FileBuffer = GetConfigFileContent(fname);
 /* if the buffer address is NULL then return error */
  if(FileBuffer)
  {
    /* Parse every string into items and group them into triplets. 
     * Decode these ordered triplets into correspondign indices in the global
     * Token Map arrray provided by the user. 
     */
    retVal  = ParseContent(FileBuffer, strlen((xdc_Char *)FileBuffer));
    return retVal ;
  }
  else
    return -1;
}
コード例 #14
0
void XSDParser::ParseAny(DTDElement& node)
{
    TToken tok = GetRawAttributeSet();
#if 0
    if (GetAttribute("processContents")) {
        if (!IsValue("lax") && !IsValue("skip")) {
            ParseError("lax or skip");
        }
    }
#endif
    node.SetOccurrence( ParseMinOccurs( node.GetOccurrence()));
    node.SetOccurrence( ParseMaxOccurs( node.GetOccurrence()));
    if (GetAttribute("namespace")) {
        node.SetNamespaceName(m_Value);
    }
    SetCommentsIfEmpty(&(node.Comments()));
    if (tok == K_CLOSING) {
        ParseContent(node);
    }
    m_ExpectLastComment = true;
}
コード例 #15
0
void XSDParser::ParseAttributeGroup(DTDElement& node)
{
    TToken tok = GetRawAttributeSet();
    if (GetAttribute("ref")) {
        if (m_ResolveTypes) {
            string id = CreateEntityId(m_Value,DTDEntity::eAttGroup);
            if (m_MapEntity.find(id) != m_MapEntity.end()) {
                PushEntityLexer(id);
                ParseAttributeGroupRef(node);
            } else {
                ParseError("Unresolved entity", id.c_str());
            }
        } else {
            DTDAttribute a;
            a.SetType(DTDAttribute::eUnknownGroup);
            a.SetTypeName(m_Value);
            Lexer().FlushCommentsTo(node.AttribComments());
            node.AddAttribute(a);
        }
    }
    if (tok == K_CLOSING) {
        ParseContent(node);
    }
}
コード例 #16
0
string XSDParser::ParseAttributeContent()
{
    TToken tok = GetRawAttributeSet();
    string name;
    if (GetAttribute("ref")) {
        name = m_Value;
    }
    if (GetAttribute("name")) {
        name = m_Value;
        m_MapAttribute[name].SetName(name);
        SetCommentsIfEmpty(&(m_MapAttribute[name].Comments()));
    }
    if (GetAttribute("type")) {
        if (!DefineAttributeType(m_MapAttribute[name])) {
            m_MapAttribute[name].SetTypeName(m_Value);
        }
    }
    m_MapAttribute[name].SetQualified(true);
    if (tok == K_CLOSING) {
        ParseContent(m_MapAttribute[name]);
    }
    m_ExpectLastComment = true;
    return name;
}
コード例 #17
0
ファイル: configfile.c プロジェクト: YouZhang/JM
/*!
 ***********************************************************************
 * \brief
 *    Parse the command line parameters and read the config files.
 * \param ac
 *    number of command line parameters
 * \param av
 *    command line parameters
 ***********************************************************************
 */
void Configure (int ac, char *av[])
{
  char *content;
  int CLcount, ContentLen, NumberParams;
  char *filename=DEFAULTCONFIGFILENAME;

  memset (&configinput, 0, sizeof (InputParameters));
  //Set default parameters.
  printf ("Setting Default Parameters...\n");
  InitEncoderParams();

  // Process default config file
  CLcount = 1;

  if (ac==2)
  {
    if (0 == strncmp (av[1], "-h", 2))
    {
      JMHelpExit();
    }
  }

  if (ac>=3)
  {
    if (0 == strncmp (av[1], "-d", 2))
    {
      filename=av[2];
      CLcount = 3;
    }
    if (0 == strncmp (av[1], "-h", 2))
    {
      JMHelpExit();
    }
  }
  printf ("Parsing Configfile %s", filename);
  content = GetConfigFileContent (filename);
  if (NULL==content)
    error (errortext, 300);
  ParseContent (content, strlen(content));
  printf ("\n");
  free (content);

  // Parse the command line

  while (CLcount < ac)
  {
    if (0 == strncmp (av[CLcount], "-h", 2))
    {
      JMHelpExit();
    }
    
    if (0 == strncmp (av[CLcount], "-f", 2))  // A file parameter?
    {
      content = GetConfigFileContent (av[CLcount+1]);
      if (NULL==content)
        error (errortext, 300);
      printf ("Parsing Configfile %s", av[CLcount+1]);
      ParseContent (content, strlen (content));
      printf ("\n");
      free (content);
      CLcount += 2;
    } else
    {
      if (0 == strncmp (av[CLcount], "-p", 2))  // A config change?
      {
        // Collect all data until next parameter (starting with -<x> (x is any character)),
        // put it into content, and parse content.

        CLcount++;
        ContentLen = 0;
        NumberParams = CLcount;

        // determine the necessary size for content
        while (NumberParams < ac && av[NumberParams][0] != '-')
          ContentLen += strlen (av[NumberParams++]);        // Space for all the strings
        ContentLen += 1000;                     // Additional 1000 bytes for spaces and \0s


        if ((content = malloc (ContentLen))==NULL) no_mem_exit("Configure: content");;
        content[0] = '\0';

        // concatenate all parameters identified before

        while (CLcount < NumberParams)
        {
          char *source = &av[CLcount][0];
          char *destin = &content[strlen (content)];

          while (*source != '\0')
          {
            if (*source == '=')  // The Parser expects whitespace before and after '='
            {
              *destin++=' '; *destin++='='; *destin++=' ';  // Hence make sure we add it
            } else
              *destin++=*source;
            source++;
          }
          *destin = '\0';
          CLcount++;
        }
        printf ("Parsing command line string '%s'", content);
        ParseContent (content, strlen(content));
        free (content);
        printf ("\n");
      }
      else
      {
        snprintf (errortext, ET_SIZE, "Error in command line, ac %d, around string '%s', missing -f or -p parameters?", CLcount, av[CLcount]);
        error (errortext, 300);
      }
    }
  }
  printf ("\n");
  PatchInp();
  if (input->DisplayEncParams)
    DisplayEncoderParams();
}
コード例 #18
0
void XSDParser::ProcessNamedTypes(void)
{
    m_ResolveTypes = true;
    set<string> processed;
    bool found;
    do {
        found = false;
        map<string,DTDElement>::iterator i;
        for (i = m_MapElement.begin(); i != m_MapElement.end(); ++i) {

            DTDElement& node = i->second;
            if (!node.GetTypeName().empty()) {
                if ( node.GetType() == DTDElement::eUnknown) {
                    found = true;
// in rare cases of recursive type definition this node type can already be defined
                    map<string,DTDElement>::iterator j;
                    for (j = m_MapElement.begin(); j != m_MapElement.end(); ++j) {
                        if (j->second.GetName() == node.GetName() &&
                            j->second.GetTypeName() == node.GetTypeName() &&
                            j->second.GetType() != DTDElement::eUnknown) {
                            m_MapElement[i->first] = j->second;
                            break;
                        }
                    }
                    if (j != m_MapElement.end()) {
                        break;
                    }
                    PushEntityLexer(CreateEntityId(node.GetTypeName(),DTDEntity::eType));
                    bool elementForm = m_ElementFormDefault;
                    ParseContent(node);
                    node.SetTypeIfUnknown(DTDElement::eEmpty);

// Make local elements defined by means of global types global.
// In fact, this is incorrect; also, in case of unqualified form default we must keep
// such elements embedded, otherwise they will be treated as ns-qualified.

// for us, this trick solves the problem of recursive type definitions:
// local element A contains local element B, which contains local element A, etc.
// the way it is now, code generator will simply crash.
// The better solution would be to modify C++ code generation, of course.

// as of 24may11, the code generator is modified.
// BUT, the mistake is already made; we want to provide backward compatibility now.
                    if (node.IsNamed() && node.IsEmbedded() && elementForm) {

                        map<string,DTDElement>::iterator k;
                        for (k = m_MapElement.begin(); k != m_MapElement.end(); ++k) {
                            if (!k->second.IsEmbedded() && k->second.IsNamed() &&
                                k->second.GetName() == node.GetName() && 
                                k->second.GetTypeName() != node.GetTypeName()) {
                                break;
                            }
                        }
                        if (k == m_MapElement.end()) {
                            node.SetEmbedded(false);
                        }
                    }
                } else if ( node.GetType() == DTDElement::eUnknownGroup) {
                    found = true;
                    PushEntityLexer(CreateEntityId(node.GetTypeName(),DTDEntity::eGroup));
                    ParseGroupRef(node);
                    if (node.GetType() == DTDElement::eUnknownGroup) {
                        node.SetType(DTDElement::eEmpty);
                    }
                }
                else if (processed.find(i->second.GetName()) == processed.end()) {
                    if (node.GetType() < DTDElement::eWsdlService) {
                        PushEntityLexer(CreateEntityId(node.GetTypeName(),DTDEntity::eType));
                        ParseContent(node);
                    }
                }
                processed.insert(i->second.GetName());
            }
        }
    } while (found);

    do {
        found = false;
        map<string,DTDElement>::iterator i;
        for (i = m_MapElement.begin(); i != m_MapElement.end(); ++i) {

            DTDElement& node = i->second;
            if (node.HasAttributes()) {
                list<DTDAttribute>& atts = node.GetNonconstAttributes();
                list<DTDAttribute>::iterator a;
                for (a = atts.begin(); a != atts.end(); ++a) {
                    if (a->GetType() == DTDAttribute::eUnknown &&
                        a->GetTypeName().empty() &&
                        m_MapAttribute.find(a->GetName()) != m_MapAttribute.end()) {
                        found = true;
                        a->Merge(m_MapAttribute[a->GetName()]);
                    }
                }
            }
        }
    } while (found);

    do {
        found = false;
        map<string,DTDElement>::iterator i;
        for (i = m_MapElement.begin(); i != m_MapElement.end(); ++i) {

            DTDElement& node = i->second;
            if (node.HasAttributes()) {
                list<DTDAttribute>& atts = node.GetNonconstAttributes();
                list<DTDAttribute>::iterator a;
                for (a = atts.begin(); a != atts.end(); ++a) {

                    if (!a->GetTypeName().empty()) { 
                        if ( a->GetType() == DTDAttribute::eUnknown) {
                            found = true;
                            PushEntityLexer(CreateEntityId(a->GetTypeName(),DTDEntity::eType));
                            ParseContent(*a);
                            if (a->GetType() == DTDAttribute::eUnknown) {
                                a->SetType(DTDAttribute::eString);
                            }
                        } else if ( a->GetType() == DTDAttribute::eUnknownGroup) {
                            found = true;
                            PushEntityLexer(CreateEntityId(a->GetTypeName(),DTDEntity::eAttGroup));
                            atts.erase(a);
                            ParseAttributeGroupRef(node);
                            break;
                        }
                    }
                }
            }
        }
    } while (found);
    {
        map<string,DTDElement>::iterator i;
        for (i = m_MapElement.begin(); i != m_MapElement.end(); ++i) {
            i->second.MergeAttributes();
        }
    }
    m_ResolveTypes = false;
}
コード例 #19
0
string XSDParser::ParseElementContent(DTDElement* owner, int emb)
{
    TToken tok;
    string name, value;
    bool ref=false, named_type=false;
    bool qualified = m_ElementFormDefault;
    int line = Lexer().CurrentLine();

    tok = GetRawAttributeSet();

    if (GetAttribute("ref")) {
        if (IsValue("schema") &&
            GetElementNamespace(m_ValuePrefix) == eSchemaNamespace) {
            name = CreateTmpEmbeddedName(owner->GetName(), emb);
            DTDElement& elem = m_MapElement[name];
            elem.SetName(m_Value);
            elem.SetSourceLine(Lexer().CurrentLine());
            elem.SetEmbedded();
            elem.SetType(DTDElement::eAny);
            ref=false;
        } else {
            name = m_Value;
            ref=true;
        }
    }
    if (GetAttribute("name")) {
        ref=false;
        name = m_Value;
        if (owner) {
            name = CreateTmpEmbeddedName(owner->GetName(), emb);
            m_MapElement[name].SetEmbedded();
            m_MapElement[name].SetNamed();
        }
        m_MapElement[name].SetName(m_Value);
        m_MapElement[name].SetSourceLine(line);
        SetCommentsIfEmpty(&(m_MapElement[name].Comments()));
    }
    if (GetAttribute("type")) {
        if (!DefineElementType(m_MapElement[name])) {
            m_MapElement[name].SetTypeName(m_Value);
            named_type = true;
        }
    }
    if (owner && GetAttribute("form")) {
        qualified = IsValue("qualified");
    }
    if (GetAttribute("default")) {
        m_MapElement[name].SetDefault(m_Value);
    }
    if (owner && !name.empty()) {
        owner->SetOccurrence(name, ParseMinOccurs( owner->GetOccurrence(name)));
        owner->SetOccurrence(name, ParseMaxOccurs( owner->GetOccurrence(name)));
    }
    if (tok != K_CLOSING && tok != K_ENDOFTAG) {
        ParseError("endoftag");
    }
    m_MapElement[name].SetNamespaceName(m_TargetNamespace);
    m_MapElement[name].SetQualified(qualified);
    bool hasContents = false;
    if (tok == K_CLOSING) {
        hasContents = ParseContent(m_MapElement[name]);
    }
    m_ExpectLastComment = true;
    if (!ref && !named_type) {
        m_MapElement[name].SetTypeIfUnknown(
            hasContents ? DTDElement::eEmpty : DTDElement::eString);
    }
    return name;
}
コード例 #20
0
/*
*************************************************************************
* Function:Parse the command line parameters and read the config files.
* Input: ac
         number of command line parameters
      av
        command line parameters
* Output:
* Return: 
* Attention:
*************************************************************************
*/
void c_avs_enc::Configure (char *av)
{
  char *content;  
  Map[0].TokenName  =    "GOPLength";                
  Map[1].TokenName  =    "FramesToBeEncoded";        
  Map[2].TokenName  =    "QPFirstFrame";             
  Map[3].TokenName  =    "QPRemainingFrame";         
  Map[4].TokenName  =    "UseHadamard";              
  Map[5].TokenName  =    "SearchRange";              
  Map[6].TokenName  =    "NumberReferenceFrames";    
  Map[7].TokenName  =    "SourceWidth";              
  Map[8].TokenName  =    "SourceHeight";             
  Map[9].TokenName  =    "InputFile";                
  Map[10].TokenName =    "InputHeaderLength";        
  Map[11].TokenName =    "OutputFile";               
  Map[12].TokenName =    "ReconFile";                
  Map[13].TokenName =    "TraceFile";                
  Map[14].TokenName =    "NumberBFrames";            
  Map[15].TokenName =    "QPBPicture";               
  Map[16].TokenName =    "InterSearch16x16";         
  Map[17].TokenName =    "InterSearch16x8";          
  Map[18].TokenName =    "InterSearch8x16";          
  Map[19].TokenName =    "InterSearch8x8";           
  Map[20].TokenName =    "RDOptimization";           
  Map[21].TokenName =    "InterlaceCodingOption";    
  Map[22].TokenName =    "LoopFilterDisable";        
  Map[23].TokenName =    "LoopFilterParameter";      
  Map[24].TokenName =    "LoopFilterAlphaOffset";    
  Map[25].TokenName =    "LoopFilterBetaOffset";     
  Map[26].TokenName =    "Progressive_frame";        
  Map[27].TokenName =    "Dct_Adaptive_Flag";        
  Map[28].TokenName =    "NumberOfRowsInSlice";      
  Map[29].TokenName =    "SliceParameter";           
  Map[30].TokenName =    "WeightEnable";             
  Map[31].TokenName =    "FrameRate";                
  Map[32].TokenName =    "ChromaFormat";             
  Map[33].TokenName =    "RateControlEnable";        
  Map[34].TokenName =    "Bitrate";                  
  Map[35].TokenName =    "InitialQP";                
  Map[36].TokenName =    "BasicUnit";                
  Map[37].TokenName =    "ChannelType";              
  Map[38].TokenName =    NULL;                       
  Map[0].Place  = &configinput.GopLength;                 
  Map[1].Place  = &configinput.no_frames;                 
  Map[2].Place  = &configinput.qp0;                       
  Map[3].Place  = &configinput.qpN;                       
  Map[4].Place  = &configinput.hadamard;                  
  Map[5].Place  = &configinput.search_range;              
  Map[6].Place  = &configinput.no_multpred;               
  Map[7].Place  = &configinput.img_width;                 
  Map[8].Place  = &configinput.img_height;                
  Map[9].Place  = &configinput.infile;                    
  Map[10].Place = &configinput.infile_header;             
  Map[11].Place = &configinput.outfile;                   
  Map[12].Place = &configinput.ReconFile;                 
  Map[13].Place = &configinput.TraceFile;                 
  Map[14].Place = &configinput.successive_Bframe;         
  Map[15].Place = &configinput.qpB;                       
  Map[16].Place = &configinput.InterSearch16x16;          
  Map[17].Place = &configinput.InterSearch16x8 ;          
  Map[18].Place = &configinput.InterSearch8x16;           
  Map[19].Place = &configinput.InterSearch8x8 ;           
  Map[20].Place = &configinput.rdopt;                     
  Map[21].Place = &configinput.InterlaceCodingOption;     
  Map[22].Place = &configinput.loop_filter_disable;       
  Map[23].Place = &configinput.loop_filter_parameter_flag;
  Map[24].Place = &configinput.alpha_c_offset;            
  Map[25].Place = &configinput.beta_offset;               
  Map[26].Place = &configinput.progressive_frame;         
  Map[27].Place = &configinput.dct_adaptive_flag;         
  Map[28].Place = &configinput.slice_row_nr;              
  Map[29].Place = &configinput.slice_parameter;           
  Map[30].Place = &configinput.picture_weighting_flag;    
  Map[31].Place = &configinput.frame_rate_code;           
  Map[32].Place = &configinput.chroma_format;             
  Map[33].Place = &configinput.RCEnable;                  
  Map[34].Place = &configinput.bit_rate;                  
  Map[35].Place = &configinput.SeinitialQP;               
  Map[36].Place = &configinput.basicunit;                 
  Map[37].Place = &configinput.channel_type;              
  Map[38].Place = NULL;
  Map[0].Type  =  0;
  Map[1].Type  =  0;
  Map[2].Type  =  0;
  Map[3].Type  =  0;
  Map[4].Type  =  0;
  Map[5].Type  =  0;
  Map[6].Type  =  0;
  Map[7].Type  =  0;
  Map[8].Type  =  0;
  Map[9].Type  =  1;
  Map[10].Type =  0;
  Map[11].Type =  1;
  Map[12].Type =  1;
  Map[13].Type =  1;
  Map[14].Type =  0;
  Map[15].Type =  0;
  Map[16].Type =  0;
  Map[17].Type =  0;
  Map[18].Type =  0;
  Map[19].Type =  0;
  Map[20].Type =  0;
  Map[21].Type =  0;
  Map[22].Type =  0;
  Map[23].Type =  0;
  Map[24].Type =  0;
  Map[25].Type =  0;
  Map[26].Type =  0;
  Map[27].Type =  0;
  Map[28].Type =  0;
  Map[29].Type =  0;
  Map[30].Type =  0;
  Map[31].Type =  0;
  Map[32].Type =  0;
  Map[33].Type =  0;
  Map[34].Type =  0;
  Map[35].Type =  0;
  Map[36].Type =  0;
  Map[37].Type =  0;
  Map[38].Type = -1;
  
  memset (&configinput, 0, sizeof (InputParameters));
  
  // Process default config file
  // Parse the command line
  
      content = GetConfigFileContent (av);
      printf ("Parsing Configfile %s", av);
      ParseContent (content, (int_32_t)strlen (content));
      printf ("\n");
      free (content);  
  printf ("\n");
}
コード例 #21
0
bool XSDParser::ParseContent(DTDElement& node, bool extended /*=false*/)
{
    DTDElement::EType curr_type;
    int emb=0;
    bool eatEOT= false;
    bool hasContents= false;
    TToken tok;
    for ( tok=GetNextToken(); ; tok=GetNextToken()) {
        emb= node.GetContent().size();
        if (tok != T_EOF &&
            tok != K_ENDOFTAG &&
            tok != K_ANNOTATION) {
            hasContents= true;
        }
        switch (tok) {
        case T_EOF:
            return hasContents;
        case K_ENDOFTAG:
            if (eatEOT) {
                eatEOT= false;
                break;
            }
            FixEmbeddedNames(node);
            return hasContents;
        case K_COMPLEXTYPE:
            ParseComplexType(node);
            break;
        case K_SIMPLECONTENT:
            ParseSimpleContent(node);
            break;
        case K_EXTENSION:
            ParseExtension(node);
            break;
        case K_RESTRICTION:
            ParseRestriction(node);
            break;
        case K_ATTRIBUTE:
            ParseAttribute(node);
            break;
        case K_ATTRIBUTEGROUP:
            ParseAttributeGroup(node);
            break;
        case K_ANY:
            node.SetTypeIfUnknown(DTDElement::eSequence);
            {
                string name = CreateTmpEmbeddedName(node.GetName(), emb);
                DTDElement& elem = m_MapElement[name];
                elem.SetName(name);
                elem.SetSourceLine(Lexer().CurrentLine());
                elem.SetEmbedded();
                elem.SetType(DTDElement::eAny);
                elem.SetQualified(node.IsQualified());
                ParseAny(elem);
                AddElementContent(node,name);
            }
            break;
        case K_SEQUENCE:
            emb= node.GetContent().size();
            if (emb != 0 && extended) {
                node.SetTypeIfUnknown(DTDElement::eSequence);
                if (node.GetType() != DTDElement::eSequence) {
                    ParseError("sequence");
                }
                tok = GetRawAttributeSet();
                eatEOT = true;
                break;
            }
            curr_type = node.GetType();
            if (curr_type == DTDElement::eUnknown ||
                curr_type == DTDElement::eUnknownGroup ||
                (m_ResolveTypes && curr_type == DTDElement::eEmpty)) {
                node.SetType(DTDElement::eSequence);
                ParseContainer(node);
                if (node.GetContent().empty()) {
                    node.ResetType(curr_type);
                }
            } else {
                string name = CreateTmpEmbeddedName(node.GetName(), emb);
                DTDElement& elem = m_MapElement[name];
                elem.SetName(name);
                elem.SetSourceLine(Lexer().CurrentLine());
                elem.SetEmbedded();
                elem.SetType(DTDElement::eSequence);
                elem.SetQualified(node.IsQualified());
                ParseContainer(elem);
                AddElementContent(node,name);
            }
            break;
        case K_CHOICE:
            curr_type = node.GetType();
            if (curr_type == DTDElement::eUnknown ||
                curr_type == DTDElement::eUnknownGroup ||
                (m_ResolveTypes && curr_type == DTDElement::eEmpty)) {
                node.SetType(DTDElement::eChoice);
                ParseContainer(node);
                if (node.GetContent().empty()) {
                    node.ResetType(curr_type);
                }
            } else {
                string name = CreateTmpEmbeddedName(node.GetName(), emb);
                DTDElement& elem = m_MapElement[name];
                elem.SetName(name);
                elem.SetSourceLine(Lexer().CurrentLine());
                elem.SetEmbedded();
                elem.SetType(DTDElement::eChoice);
                elem.SetQualified(node.IsQualified());
                ParseContainer(elem);
                AddElementContent(node,name);
            }
            break;
        case K_SET:
            curr_type = node.GetType();
            if (curr_type == DTDElement::eUnknown ||
                curr_type == DTDElement::eUnknownGroup ||
                (m_ResolveTypes && curr_type == DTDElement::eEmpty)) {
                node.SetType(DTDElement::eSet);
                ParseContainer(node);
                if (node.GetContent().empty()) {
                    node.ResetType(curr_type);
                }
            } else {
                string name = CreateTmpEmbeddedName(node.GetName(), emb);
                DTDElement& elem = m_MapElement[name];
                elem.SetName(name);
                elem.SetSourceLine(Lexer().CurrentLine());
                elem.SetEmbedded();
                elem.SetType(DTDElement::eSet);
                elem.SetQualified(node.IsQualified());
                ParseContainer(elem);
                AddElementContent(node,name);
            }
            break;
        case K_ELEMENT:
            {
	            string name = ParseElementContent(&node,emb);
	            AddElementContent(node,name);
            }
            break;
        case K_GROUP:
            {
	            string name = ParseGroup(&node,emb);
	            AddElementContent(node,name);
            }
            break;
        case K_ANNOTATION:
            SetCommentsIfEmpty(&(node.Comments()));
            ParseAnnotation();
            break;
        case K_UNION:
            ParseUnion(node);
            break;
        case K_LIST:
            ParseList(node);
            break;
        default:
            for ( tok = GetNextToken(); tok == K_ATTPAIR || tok == K_XMLNS; tok = GetNextToken())
                ;
            if (tok == K_CLOSING) {
                ParseContent(node);
            }
            break;
        }
    }
    FixEmbeddedNames(node);
    return hasContents;
}