Example #1
0
void BomKeyNode::buildItem(const char *pId, KeyValNode *pKvn) {
    //char op[4096];
    BomItem *tmp;
    char args[10];
    KeyValNode *kvn;
    StringNode *svn;
    int c;
    tmp = (BomItem *)malloc(sizeof(BomItem));
    tmp->refChar = pKvn->key()[0];
    tmp->node = pKvn;
    if(tmp->refChar >= 'a' && tmp->refChar <= 'z') {
        tmp->refChar = (tmp->refChar - 'a') + 'A';
    }
    tmp->block = new TextBlock(gVxm.parts->getPart(pId));
    mCount++;
    tmp->idNum = refCount(tmp->refChar);
    if(tmp->block == NULL) {
        printf("block not found for %s\n", pId);
        return;
    }

    sprintf(args, "%c%d%02d", tmp->refChar, mMajor, tmp->idNum);
    tmp->block->setArg(args, 1);
    for(c = 2; c <= tmp->block->argCount(); c++) {
        sprintf(args,"*arg%d", c);
        kvn = (KeyValNode*)FindNode(pKvn, args);
        svn = (StringNode*) kvn->value();
        tmp->block->setArg(svn->value(), c);
    }
    tmp->next = mHead;
    mHead = tmp;
    //tmp->block->buildBlock(op);
    //printf("%s\n", op);
}
Example #2
0
void BomKeyNode::addComponent(MapNode *pNode) {
    MapNode *mn;
    KeyValNode *kvn;
    StringNode *svn;
    mn = FindNode(pNode, "pid");
    if(mn->nodeType() == 2) {
        kvn = (KeyValNode *) mn;
        svn = (StringNode*) kvn->value();
        //printf("Bom: %s\n", svn->value());
        buildItem(svn->value(),(KeyValNode*) pNode);
    }
    mList->append(pNode);
}
Example #3
0
/**
 * Transform a StringNode to a XML node.
 *
 * @param node		A settings tree node representing a string node.
 * @param parent	The parent node of the XML document.
 */
Void XmlSettingsTree::settingsTreeToXml( StringNode& node, TiXmlNode& parent ) {
	TiXmlElement* 	element	= new TiXmlElement( XMLSETTINGSTREE_STRING_ELEMENT );
	TiXmlText* 		text 	= new TiXmlText( node.getValue().c_str() );

	element->LinkEndChild( text );
	parent.LinkEndChild( element );
}
Example #4
0
void NodeVisitorXML::visit( StringNode &n ) const
{
	// FIXME FIXME FIXME turn certain characters into entities 
	// example: & -> &amp;
	startElement( n );
	output << n.get();
	endElement( n );
}
ExpressionParser::Node*
ExpressionFilter::Expr::Function( const std::string& inName, const NodeList& inArgs )
{
  using ExpressionParser::StringNode;
  if( Ci( inName ) == "random" )
  {
    if( inArgs.Size() != 1 )
      throw bciexception( "The random() function takes exactly one argument" );
    StringNode* pArg = dynamic_cast<StringNode*>( inArgs[0] );
    if( !pArg )
      return new RandomIntNode( mpRandom, inArgs[0] );
    else
    {
      static const struct { const char* name; RandomValueNode::Func func; }
      dists[] =
      {
        { "uniform01", &LCRandomGenerator::RandomValue<LCRandomGenerator::Uniform01> },
        { "normal", &LCRandomGenerator::RandomValue<LCRandomGenerator::Normal> },
      };
      string name = pArg->Evaluate();
      RandomValueNode::Func f = 0;
      for( size_t i = 0; !f && i < sizeof( dists ) / sizeof( *dists ); ++i )
        if( Ci( name ) == dists[i].name )
          f = dists[i].func;
      if( f )
        return new RandomValueNode( mpRandom, f );
      ostringstream oss;
      for( size_t i = 0; i < sizeof( dists ) / sizeof( *dists ); ++i )
        oss << ", " << dists[i].name;
      throw bciexception(
        "Unknown distribution name: " << name
        << ", known distributions are: " << oss.str().substr( 2 )
      );
      return 0;
    }
  }
  return Expression::Function( inName, inArgs );
}
Example #6
0
void
XmlRenderer::renderNode(const StringNode& node)
{
  displayTag("str", node.value());
}
void PrintEquelleASTVisitor::visit(StringNode& node)
{
    std::cout << node.content();
}
Example #8
0
void PrintASTVisitor::visit(StringNode& node)
{
    std::cout << indent() << "StringNode: " << node.content() << '\n';
}
Example #9
0
StringNode* handleString(const std::string& content)
{
    StringNode* node = new StringNode(content);
    node->setLocation(FileLocation(yylineno));
    return node;
}