コード例 #1
0
/* should we create the node here or let it be created by caller as now? */
void
note_register_note(const unsigned char *tag, struct node *node)
{
  struct note *np = NULL;

  if (tag)
    {
      np = note_find_in_line(tag);
      if (np)
	{
	  if (np->status == NOTE_REGISTERED)
	    {
	      const char *nid = note_create_id();
	      setAttr(node, a_xml_id, (const unsigned char *)nid);
	      setAttr(np->node, a_note_ref, (const unsigned char *)nid);
	      setAttr(node, a_note_auto, (const unsigned char *)np->mark);
	      np->status = NOTE_REFERENCED;
	    }
	  else
	    {
	      vwarning("note tag %s has multiple notes attached to it", tag);
	    }
	}
      else
	{
	  vwarning("note tag %s was not used in the preceding line", tag);
	}
    }
  else
    {
      warning("note_register_note passed NULL tag");
    }
}
コード例 #2
0
ファイル: utils.c プロジェクト: Goettsch/game-editor
/* clustNode:
 * Generate a special cluster node representing the end node
 * of an edge to the cluster cg. n is a node whose name is the same
 * as the cluster cg. clg is the subgraph of all of
 * the original nodes, which will be deleted later.
 */
static node_t *clustNode(node_t * n, graph_t * cg, agxbuf * xb,
			 graph_t * clg)
{
    node_t *cn;
    static int idx = 0;
    char num[100];

    agxbput(xb, "__");
    sprintf(num, "%d", idx++);
    agxbput(xb, num);
    agxbputc(xb, ':');
    agxbput(xb, cg->name);

    cn = agnode(cg->root, agxbuse(xb));
    SET_CLUST_NODE(cn);
    aginsert(cg, cn);
    aginsert(clg, n);

    /* set attributes */
    N_label = setAttr(cn->graph, cn, "label", "", N_label);
    N_style = setAttr(cn->graph, cn, "style", "invis", N_style);
    N_shape = setAttr(cn->graph, cn, "shape", "box", N_shape);
    /* N_width = setAttr (cn->graph, cn, "width", "0.0001", N_width); */

    return cn;
}
コード例 #3
0
/****************** Print the Schema **********************/
void print(Schema *s1,Record *r1,Value *v1,Record *r2,Schema *s2)
{
	int k;
	// Traverse the schema 
	for(k=0;k<s1->numAttr;k++)
        {
  	             	//printf("\n %d",);
	  	             	//printf("\n Ok very nice");
		getAttr(r1,s1,k,&v1);
		// Setting the attributes according to the datatypes
	  	switch (s1->dataTypes[k])
	  	{
            		case DT_STRING:
                		printf(" %s ",v1->v.stringV);
                		setAttr(r2,s2,k,v1);
                		break;
                		
            		case DT_INT:
               			 printf(" %d ",v1->v.intV);
               			 setAttr(r2,s2,k,v1);
                		break;
                			
            		case DT_FLOAT:
                		printf(" %f ",v1->v.floatV);
                		setAttr(r2,s2,k,v1);
                		break;
            			
            		case DT_BOOL:
                		//printf(" %f ",v1->v.floatV);
                		setAttr(r2,s2,k,v1);
                		break;
         	}
         }
}
コード例 #4
0
ファイル: utils.c プロジェクト: jho1965us/graphviz
/* clustNode:
 * Generate a special cluster node representing the end node
 * of an edge to the cluster cg. n is a node whose name is the same
 * as the cluster cg. clg is the subgraph of all of
 * the original nodes, which will be deleted later.
 */
static node_t *clustNode(node_t * n, graph_t * cg, agxbuf * xb,
			 graph_t * clg)
{
    node_t *cn;
    static int idx = 0;
    char num[100];

    agxbput(xb, "__");
    sprintf(num, "%d", idx++);
    agxbput(xb, num);
    agxbputc(xb, ':');
    agxbput(xb, agnameof(cg));

    cn = agnode(agroot(cg), agxbuse(xb), 1);
    agbindrec(cn, "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE);

    SET_CLUST_NODE(cn);
	agsubnode(cg,cn,1);
	//aginsert(cg, cn);
	agsubnode(clg,n,1);
	//aginsert(clg, n);

    /* set attributes */
    N_label = setAttr(agraphof(cn), cn, "label", "", N_label);
    N_style = setAttr(agraphof(cn), cn, "style", "invis", N_style);
    N_shape = setAttr(agraphof(cn), cn, "shape", "box", N_shape);
    /* N_width = setAttr (cn->graph, cn, "width", "0.0001", N_width); */

    return cn;
}
コード例 #5
0
ParticleSystem::ParticleSystem(JetCOW *cow, Sint32 id, const char *type) : SceneNode(cow,id,type) {
  particles = NULL;
  size = 0;

  if (id<0) {
    /* Defaults for new objects */
    setAttr("size", 0);
    setAttr("BillboardMethod", "Spherical");
  }
}
コード例 #6
0
PerlinDisplacement::PerlinDisplacement(JetCOW *cow, Sint32 id,  const char *type) : 
  SurfaceModifier(cow,id,type) {
  if (id<0) {
    /* Defaults */
    setAttr("Fundamental", 1.0f);
    setAttr("Amplitude", 1.0f);
    setAttr("Persistence", 1.0f);
    setAttr("Octaves", 1);
    setAttr("Seed", (int)SDL_GetTicks());
  }
}
コード例 #7
0
ファイル: xmlproc.cpp プロジェクト: sergey4475/SProject
xmlItem XMLProc::insert(xmlItem context, const QString &otype, const QString &name, long id)
{
    xmlItem i;

    if ( id==0 ) id = nextID();
    i = xml.createElement( otype );
    if ( id >= 100 ) setAttr(i, mda_id, id );
    if ( !name.isNull()) setAttr(i, mda_name, name );
    context.appendChild(i);
    if ( id > 0 ) idcache.insert(id, new ItemContaner(id,i) );
    SetModify(true);
    return i;
}
コード例 #8
0
ファイル: PropertyFS.cpp プロジェクト: Prabhnith/nix
void PropertyFS::unit(const std::string &unit) {
    if (unit.empty()) {
        throw EmptyString("unit");
    }
    setAttr("unit", unit);
    forceUpdatedAt();
}
コード例 #9
0
ファイル: PropertyFS.cpp プロジェクト: Prabhnith/nix
void PropertyFS::mapping(const std::string &mapping) {
    if (mapping.empty()) {
        throw EmptyString("mapping");
    }
    setAttr("mapping", mapping);
    forceUpdatedAt();
}
コード例 #10
0
SerialPort::SerialPort(const string device)
	: m_fd(0), m_baudRate(0), m_wordSize(0), m_asyncTimeout(DEFAULT_ASYNC_TIMEOUT)
{
	if((m_fd = ::open(device.c_str(), O_RDWR | O_NOCTTY)) < 0)
		throw SysException();

	::bzero(&m_term, sizeof(m_term));

	::tcgetattr(m_fd, &m_termOld);

	setBaudRate(DEFAULT_BAUD_RATE);
	setWordSize(DEFAULT_WORD_SIZE);
	setParity(DEFAULT_PARITY);

	m_term.c_cflag |= CLOCAL | CREAD;
	m_term.c_iflag = IGNPAR;
	m_term.c_oflag = OPOST;
	m_term.c_lflag = 0;

	m_term.c_cc[VTIME] = 0;
	m_term.c_cc[VMIN] = 1;

	setAttr();

	if(::fcntl(m_fd, F_SETOWN, getpid()) == -1)
		throw SysException();
}
コード例 #11
0
ファイル: EnemySprite.cpp プロジェクト: quanguogedi/Plane
bool CEnemySprite::init(int iType, int startType, int moveType)
{
	bool bRet = false;

	do{
		CC_BREAK_IF(! CCLayer::init());	

		m_iType = iType;
        mStartType = startType;
        m_iMoveType = moveType;
		m_bDestroy = false;
		m_iDirection = STRAIGHT;
		memset(&m_szName, 0, sizeof(m_szName));
//		m_pSprite = CCSprite::createWithSpriteFrameName("Plane1_0.png");
//        m_pSprite = CCSprite::createWithSpriteFrameName("plane_small_01_a.png");
//        m_pSprite = CCSprite::create("new/plane_02.png");
//        m_pSprite->setFlipY(true);
		setAttr();
//		setFlyAnimation(m_iDirection);
		/**	ÉèÖõÐÈËÒƶ¯¹ì¼£	*/
		setRun(0);
		this->scheduleUpdate();
		this->schedule(schedule_selector(CEnemySprite::shoot), m_fShootSpace);
		this->schedule(schedule_selector(CEnemySprite::changeFlyAnimation), 0.1f);

		bRet = true;
	}
	while(0);

	return bRet;
}
コード例 #12
0
ファイル: DetachedEntity.cpp プロジェクト: Arsakes/ember
void DetachedEntity::setFromMessage(const Atlas::Message::MapType& attrs)
{
	beginUpdate();

	Atlas::Message::MapType::const_iterator A;

	/*
	 attrs.erase("loc");
	 attrs.erase("id");
	 attrs.erase("contains");

	 if (!allowMove) filterMoveAttrs(attrs);
	 */

	for (A = attrs.begin(); A != attrs.end(); ++A) {
		if (A->first == "loc" || A->first == "id" || A->first == "contains")
			continue;

		// see if the value in the sight matches the exsiting value
		Eris::Entity::AttrMap::iterator I = m_attrs.find(A->first);
		if ((I != m_attrs.end()) && (I->second == A->second))
			continue;

		setAttr(A->first, A->second);
	}

	endUpdate();
}
コード例 #13
0
ファイル: esidl.cpp プロジェクト: Constellation/esidl
void Attribute::processExtendedAttributes()
{
    NodeList* list = getExtendedAttributes();
    if (!list)
    {
        return;
    }
    uint32_t attr = getAttr();
    for (NodeList::iterator i = list->begin(); i != list->end(); ++i)
    {
        ExtendedAttribute* ext = dynamic_cast<ExtendedAttribute*>(*i);
        assert(ext);
        if (ext->getName() == "Replaceable")
        {
            attr |= Replaceable;
        }
        else if (ext->getName() == "TreatNullAs")
        {
            if (ScopedName* name = dynamic_cast<ScopedName*>(ext->getDetails()))
            {
                if (name->getName() == "EmptyString")
                {
                    attr |= NullIsEmpty;
                }
            }
        }
        else if (ext->getName() == "TreatUndefinedAs")
        {
            if (ScopedName* name = dynamic_cast<ScopedName*>(ext->getDetails()))
            {
                if (name->getName() == "EmptyString")
                {
                    attr |= UndefinedIsEmpty;
                }
                else if (name->getName() == "Null")
                {
                    attr |= UndefinedIsNull;
                }
            }
        }
        else if (ext->getName() == "PutForwards")
        {
            if (ScopedName* name = dynamic_cast<ScopedName*>(ext->getDetails()))
            {
                putForwards = name->getName();
            }
        }
        else if (ext->getName() == "Null" ||
                 ext->getName() == "Undefined")
        {
            ext->report("Warning: '%s' has been deprecated.", ext->getName().c_str());
        }
        else
        {
            ext->report("Warning: unknown extended attribute '%s'.", ext->getName().c_str());
        }
    }
    setAttr(attr);
}
コード例 #14
0
ファイル: PropertyFS.cpp プロジェクト: Prabhnith/nix
void PropertyFS::definition(const std::string &definition) {
    if (definition.empty()) {
        throw EmptyString("definition");
    } else {
        setAttr("definition", definition);
        forceUpdatedAt();
    }
}
コード例 #15
0
SurfaceModifier::SurfaceModifier(JetCOW *cow, Sint32 id,  const char *type)
  : SurfaceGenerator(cow,id,type) {
  parent = NULL;
  if (id<0) {
    /* Defaults */
    setAttr("Parent",0);
  }
}
コード例 #16
0
ファイル: PropertyFS.cpp プロジェクト: Prabhnith/nix
PropertyFS::PropertyFS(const std::shared_ptr<base::IFile> &file, const bfs::path &loc, const std::string &id,
                       const std::string &name, const DataType &dataType)
    : DirectoryWithAttributes(loc / bfs::path(name), file->fileMode())
{
    if (name.empty()) {
        throw EmptyString("name");
    } else {
        setAttr("name", name);
        forceUpdatedAt();
    }

    setAttr("entity_id", id);
    setAttr("data_type", nix::data_type_to_string(dataType));
    time_t t = util::getTime();
    setUpdatedAt();
    forceCreatedAt(t);
}
コード例 #17
0
TriangleGenerator::TriangleGenerator(JetCOW *cow, Sint32 id,  const char *type) : SurfaceGenerator(cow,id,type) {
  if (id<0) {
    /* Defaults */
    setAttr("ax",0.0f);
    setAttr("ay",0.0f);
    setAttr("az",0.0f);
    setAttr("bx",0.0f);
    setAttr("by",0.0f);
    setAttr("bz",0.0f);
    setAttr("cx",0.0f);
    setAttr("cy",0.0f);
    setAttr("cz",0.0f);
  }
}
コード例 #18
0
ファイル: msg_define.cpp プロジェクト: jice1001/struct_tool
int Msg_Define::readAttr(Xml &xml, TiXmlNode *node){
	std::string key;
	XML_LOOP_BEGIN(node)
		key = xml.get_key(node);
		if(is_struct_member(key))
			setAttr(xml, node);
	XML_LOOP_END(node)
	return 0;
}
コード例 #19
0
void SerialPort::setWordSize(const int size)
{
	m_term.c_cflag &= ~CSIZE;
	m_term.c_cflag |= sizeIntToConst(size);

	setAttr();

	m_wordSize = size;
}
コード例 #20
0
void SerialPort::setBaudRate(const int rate)
{
	::cfsetispeed(&m_term, baudIntToConst(rate));
	::cfsetospeed(&m_term, baudIntToConst(rate));

	setAttr();

	m_baudRate = rate;
}
コード例 #21
0
ファイル: Pager.cpp プロジェクト: paulparadiso/editors
PagerItem::PagerItem(string _path){
    string name = _path;
    XMLLoader loader(name);
    setAttr("path",_path);
    setAttr("name",name);
    setAttr("type",loader.getValue("type"));
    setAttr("sfx","button11");
    itemType = attrs["type"];
    duration = loader.getValue("duration");
    setAttr("preview", loader.getValue("preview"));
    if(itemType == "audio"){
        itemType = "audio";
        itemIndex = loader.getValue("position");
    }
    makePreview();
    SubObMediator::Instance()->addObserver("time-remaining", this);
    bReloader = false;
}
コード例 #22
0
// on "init" you need to initialize your instance
bool BedRoomMall::init()
{
	//////////////////////////////
	// 1. super init first
	if (!Layer::init())
	{
		return false;
	}

	Size visibleSize = Director::getInstance()->getVisibleSize();
	Vec2 origin = Director::getInstance()->getVisibleOrigin();

	auto wall = minius::Wall::create();
	auto floor = minius::Floor::create();
	auto carpet = minius::Carpet::create();
	auto weather = minius::BedRoomWeather::create();
	auto window = minius::BedRoomWindow::create();

	wall->setName("wallpaper");
	floor->setName("floor");
	carpet->setName("carpet");
	weather->setName("weather");
	window->setName("window");

	this->addChild(wall);
	this->addChild(floor);
	this->addChild(carpet);
	this->addChild(weather);
	this->addChild(window);


	auto bed = minius::Bed::create();
	auto quilt = minius::Quilt::create();
	auto bedsideTable = minius::BedsideTable::create();

	bed->setName("bed");
	quilt->setName("quilt");
	bedsideTable->setName("bedsideTable");

	this->addChild(bed);
	this->addChild(quilt);
	this->addChild(bedsideTable);


#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
	wall->setAttr("backgroundPicture", std::string());
	floor->setAttr("backgroundPicture", std::string());
	carpet->setAttr("backgroundPicture", std::string());
	//weather->setAttr("backgroundPicture", std::string());
	window->setAttr("backgroundPicture", std::string());

	bed->setAttr("backgroundPicture", std::string());
	quilt->setAttr("backgroundPicture", std::string());
	bedsideTable->setAttr("backgroundPicture", std::string());
#endif

	return true;
}
コード例 #23
0
ファイル: Sprite.cpp プロジェクト: Yahor10/oxygine-framework
    void Sprite::serialize(serializedata* data)
    {
        inherited::serialize(data);

        pugi::xml_node node = data->node;

        const ResAnim* rs = getResAnim();
        if (rs)
        {
            node.remove_attribute("size");

            Resource* r = rs->getParent();
            const char* hint = "";
            if (r)
            {
                r = r->getParent();
                if (r)
                    hint = r->getName().c_str();
            }

            if (rs->getName().find(':') == std::string::npos)
            {
                char name[255];
                safe_sprintf(name, "%s:%s", hint, rs->getName().c_str());
                node.append_attribute("resanim").set_value(name);
            }
            else
            {
                node.append_attribute("resanim").set_value(rs->getName().c_str());
            }

            if (_frame.getColumn() != 0)
                node.append_attribute("column").set_value(_frame.getColumn());
            if (_frame.getRow() != 0)
                node.append_attribute("row").set_value(_frame.getRow());
        }

        setAttr(node, "flipX", isFlippedX(), false);
        setAttr(node, "flipY", isFlippedY(), false);

        node.set_name("Sprite");
    }
コード例 #24
0
ファイル: test_assign3_2.c プロジェクト: anand700/Database
Record *
testRecord(Schema *schema, int a, char *b, int c)
{
	Record *result;
	Value *value;

	TEST_CHECK(createRecord(&result, schema));

	MAKE_VALUE(value, DT_INT, a);
	TEST_CHECK(setAttr(result, schema, 0, value));
	freeVal(value);

	MAKE_STRING_VALUE(value, b);
	TEST_CHECK(setAttr(result, schema, 1, value));
	freeVal(value);

	MAKE_VALUE(value, DT_INT, c);
	TEST_CHECK(setAttr(result, schema, 2, value));
	freeVal(value);

	return result;
}
コード例 #25
0
ファイル: thread_test.c プロジェクト: mmikulicic/mikucos
void thread_runner(void* _arg) {
  struct thread_runner_args *arg = (struct thread_runner_args*)_arg;
  int row, col, attr;
  
  while(1) {
    irql_t saved_irql = hal_irql_set(IRQL_DISPATCH);
   
    row = getRow();
    col = getCol();
    attr = getAttr();
    
    setPos(arg->row, arg->col);
    setAttr(arg->attr[arg->state++ % 2]);
    printf("%s", arg->string);
    
    setAttr(attr);
    setPos(row, col);
    
    hal_irql_restore(saved_irql);

    delay(1000/arg->freq);
  }
}
コード例 #26
0
void print2(Schema *s1,Record *r1,Value *v1,Record *r2,Schema *s2,int x,int a2)
{
	int k;
	for(k=0;k<s1->numAttr;k++)
	{
		getAttr(r1,s1,k,&v1);
	  	if(k!=a2)
	  	{
	  	    	switch (s1->dataTypes[k])
	  	       	{
            			case DT_STRING:
                			printf(" %s ",v1->v.stringV);
                			setAttr(r2,s2,x,v1);
                			x++;
                			break;
                		
            			case DT_INT:
               			 	printf(" %d ",v1->v.intV);
               			 	setAttr(r2,s2,x,v1);
               			 	x++;
                			break;
                			
            			case DT_FLOAT:
                			printf(" %f ",v1->v.floatV);
                			setAttr(r2,s2,x,v1);
                			x++;
                			break;
                		
                		case DT_BOOL:
                			//printf(" %f ",v1->v.floatV);
                			setAttr(r2,s2,x,v1);
                			x++;
                			break;
         		}
         	  }
         }
}
コード例 #27
0
ファイル: FileFS.cpp プロジェクト: cgars/nix
bool FileFS::checkHeader() {
    bool check = true;
    std::vector<int> version;
    std::string str;
    // check format
    if (hasAttr("format")) {
        getAttr("format", str);
        if (str != FILE_FORMAT) {
            check = false;
        }
    } else {
        setAttr("format", FILE_FORMAT);
    }
    // check version
    if (hasAttr("version")) {
        getAttr("version", version);
        if (version != FILE_VERSION) {
            check = false;
        }
    } else {
        setAttr("version", FILE_VERSION);
    }
    return check;
}
コード例 #28
0
Record *
testRecord(Schema *schema, int a, char *b, int c)
{
	//printf("\n in here test");
  Record *result;
  Value *value;

  TEST_CHECK(createRecord(&result, schema));
	printf("\n created record");
  MAKE_VALUE(value, DT_INT, a);
  TEST_CHECK(setAttr(result, schema, 0, value));
  freeVal(value);

  MAKE_STRING_VALUE(value, b);
  TEST_CHECK(setAttr(result, schema, 1, value));
  freeVal(value);

  MAKE_VALUE(value, DT_INT, c);
  TEST_CHECK(setAttr(result, schema, 2, value));
 // printf("\n outta here %s",result->data);
  freeVal(value);

  return result;
}
コード例 #29
0
ファイル: xml.c プロジェクト: cloudlinuxadmin/mysql-governor
/*
 * set node value for nodeName (and node should has name attr with attrValue)for existing node(or NULL for docroot)
 * or create new. If value is NULL will be
 * created empty node
 * return pointer to the new element and NULL if not created
 */
void *setNodeWithAttr(xml_data *data, void *node, const char *nodeName,
		const char *value, const char *attrName, const char *attrValue) {
	xmlNodePtr parent = node ? (xmlNodePtr) node : (xmlNodePtr) data->root;
	if (!nodeName)
		return (void *) NULL;
	xmlNodePtr fNode = (xmlNodePtr) FindElementWithNameAndAttr(data, parent, nodeName, attrName, attrValue);
	xmlNodePtr addressNode = NULL;
	if (fNode) {
		xmlNodeSetContent(addressNode, (const xmlChar *) value);
	} else {
		addressNode = xmlNewChild(parent, NULL, (const xmlChar *) nodeName,
				(const xmlChar *) value);
		setAttr(addressNode, attrName, attrValue);
	}
	return (void *) addressNode;
}
コード例 #30
0
/* Initialise console mode */
int initConsoleMode(int bin)
{
    /* TODO: Check more term */
    if (tgetent(NULL, getenv("TERM")) == ERR && tgetent(NULL, "xterm") == ERR)
    {
        fprintf(stderr, "Cannot initialise termcaps.\nPlease check your variable TERM in your environment.\n");
        return -1;
    }

    if (!isatty(fileno(stdin)))
    {
        /* We are in a pipe, no need to init the console */
        return 0;
    }

    return setAttr(bin);
}