예제 #1
0
void ColladaParser::ReadGeometry(XmlElement* e)
{
	Geometry g;
	g.id = e->Attribute("id");
	g.name = e->Attribute("name");

	{
		auto v = e->Child("mesh")->Childs("source");
		for (int ia = 0; ia < v.size(); ia++)
			g.ReadSource(v[ia]);
	}

	{
		auto v = e->Child("mesh")->Childs("vertices");
		for (int ia = 0; ia < v.size(); ia++)
		{
			Geometry::Vertices vert;
			vert.id = v[ia]->Attribute("id");
			vert.positionSourceId = ReadId(v[ia]->Child("input", "semantic", "POSITION")->Attribute("source"));
			vert.normalSourceId = ReadId(v[ia]->Child("input", "semantic", "NORMAL")->Attribute("source"));
			vert.texcoordSourceId = ReadId(v[ia]->Child("input", "semantic", "TEXCOORD")->Attribute("source"));
			g.vertices.emplace(vert.id, vert);
		}
	}

	auto t = e->Child("mesh")->Child("triangles");
	auto count = ReadInt(t->Attribute("count"));
	g.triangleVerticesId = ReadId(t->Child("input")->Attribute("source"));
	g.triangleIndices = ReadInts(t->Child("p")->content, count * 3);
	geometries.emplace(g.id, g);
}
예제 #2
0
Archive::Child Archive::Child::getNext(bool& error) const {
  uint32_t nextOffset = len + (len & 1); // Members are aligned to even byte boundaries.
  if ((size_t)(data - (const uint8_t*)parent->data.data() + nextOffset) >= parent->data.size()) {  // End of the archive.
    return Child();
  }
  return Child(parent, data + nextOffset, &error);
}
예제 #3
0
파일: testlist.cpp 프로젝트: ivandzen/HSDB
Void testlist::Parent::reset() const  {
    setExists(true);
    setFirstChild(Child());
    setLastChild(Child());
    setNextParentFreeParent(Parent());
    setNumChilds(0);
}
예제 #4
0
파일: testlist.cpp 프로젝트: ivandzen/HSDB
Void testlist::Child::reset() const  {
    setExists(true);
    setNextChildFreeChild(Child());
    setNextParentChild(Child());
    setParent(Parent());
    setPrevParentChild(Child());
}
예제 #5
0
void makeThread(nodeptr start, nodeptr stop)
{
	int ndesc, i;
	nodeptr desc[NCHILD + 1];
	/* Set link to the next node */
	Next(start) = stop;
	/* If could descendent to thread */
	if (Type(start) == CELL) {
		/* Start counting */
		ndesc = 0;
		/* Loop over all child cells  */
		for (i = 0; i < NCHILD; i++)
			/* If this one is occupied */
			if (Child(start)[i] != NULL)
				/* Store it in the table */
				desc[ndesc++] = Child(start)[i];
		/* Set link to the first one */
		More(start) = desc[0];
		/* Thread last one to next */
		desc[ndesc] = stop;
		/* Loop over descendents */
		for (i = 0; i < ndesc; i++)
			/* Thread them together */
			makeThread(desc[i], desc[i + 1]);
	}
}
예제 #6
0
파일: z47.c 프로젝트: thektulu/lout
BOOLEAN EnvWriteRetrieve(OBJECT env, FILE_NUM fnum, int *offset, int *lnum)
{ unsigned int pos;  OBJECT link, y, z;
  debug2(DET, DD, "EnvWriteRetrieve(env %d, %s)", (int) env, FileName(fnum));
  debug1(DET, DDD, "  %s", EchoObject(env));
  stat_writes++;
  hash1(pos, env, fnum);
  if( tab[pos] != nilobj )
  {
    for( link = Down(tab[pos]);  link != tab[pos];  link = NextDown(link) )
    { Child(y, link);
      Child(z, Down(y));
      if( env_fnum(y) == fnum && z == env && !env_read(y) )
      { MoveLink(LastUp(y), env_cache, PARENT);
	*offset = env_offset(y);
	*lnum   = env_lnum(y);
	stat_write_hits++;
	debug2(DET, DD, "EnvWriteRetrieve returning TRUE (offset %d, lnum %d)",
	  *offset, *lnum);
	return TRUE;
      }
    }
  }
  debug0(DET, DD, "EnvWriteRetrieve returning FALSE");
  return FALSE;
} /* end EnvWriteRetrieve */
예제 #7
0
파일: testhash.cpp 프로젝트: ivandzen/HSDB
Void testhash::Child::reset() const  {
    setExists(true);
    setNextChildFreeChild(Child());
    setNextParentTableListChild(Child());
    setParent(Parent());
    setParentKey(0);
    setPrevParentTableListChild(Child());
}
예제 #8
0
TEST_F(ConfigNodeTest, Value)
{
	const auto node = config.LoadFromStringAndGetFirstChild(ConfigNodeData_1);
	EXPECT_EQ(10, node.Child("a").Value<int>());
	EXPECT_TRUE(ExpectNear(Math::Float(1.5), node.Child("b").Value<Math::Float>()));
	EXPECT_EQ("world", node.Child("c").Value());
	EXPECT_EQ("world", node.Child("c").Value<std::string>());
}
bool GGenericQuestionWindow::OnCreate()
{
	__super::OnCreate();

   m_pObjOkBtn = (GUI::GButton*)Child(L"btnOk");
   m_pObjCancelBtn = (GUI::GButton*)Child(L"btnCancel");
   m_pObjTextLbl = (GUI::GLabel*)Child(L"lblMessage");

	return true;
}
bool GSaveConfirmationWindow::OnCreate()
{
	__super::OnCreate();
   BringToFront();

   m_pObjApplyBtn       = (GUI::GButton*)Child(L"btnApply");
   m_pObjDontApplyBtn   = (GUI::GButton*)Child(L"btnDont");
   m_pObjRememberTog    = (GUI::GToggle*)Child(L"togRemember");

	return true;
}
예제 #11
0
TEST_F(ConfigNodeTest, Value_2_Failed)
{
	const auto node = config.LoadFromStringAndGetFirstChild(ConfigNodeData_2_Failed);

	// For Vec3 or Mat4 types,
	// 0 is returned if type conversion is failed.
	EXPECT_TRUE(ExpectVec3Near(Math::Vec3(), node.Child("v1").Value<Math::Vec3>()));
	EXPECT_TRUE(ExpectVec3Near(Math::Vec3(), node.Child("v2").Value<Math::Vec3>()));
	EXPECT_TRUE(ExpectMat4Near(Math::Mat4(), node.Child("m1").Value<Math::Mat4>()));
	EXPECT_TRUE(ExpectMat4Near(Math::Mat4(), node.Child("m2").Value<Math::Mat4>()));
}
예제 #12
0
파일: XMLEntity.cpp 프로젝트: devaspot/chat
XMLEntity*
XMLEntity::Child(const char *name)
{
	if (name)
	{
		for (int i=0; i<CountChildren(); ++i)
			if (!strcasecmp(Child(i)->Name(), name))
				return Child(i);
	}
	return NULL;
}
예제 #13
0
파일: XMLEntity.cpp 프로젝트: devaspot/chat
XMLEntity*
XMLEntity::Child(const char *name, char *attribute, char *value)
{
	if (name)
	{
		for (int i=0; i<CountChildren(); ++i)
			if (!strcasecmp(Child(i)->Name(), name) && 
			!strcasecmp(Child(i)->Attribute(attribute), value))
				return Child(i);
	}
	return NULL;
}
예제 #14
0
TEST_F(ConfigNodeTest, Value_Failed)
{
	const auto node = config.LoadFromStringAndGetFirstChild(ConfigNodeData_1);

	// When the type conversion fails,
	// ConfigNode::Value returns 0 for int or Math::Float types.
	EXPECT_EQ(0, node.Child("c").Value<int>());
	EXPECT_EQ(Math::Float(0), node.Child("c").Value<Math::Float>());

	// Calling Value function for empty node returns empty string
	EXPECT_TRUE(ConfigNode().Value().empty());
}
예제 #15
0
Archive::child_iterator Archive::child_begin(bool SkipInternal) const {
  if (data.size() == 0) return child_end();

  if (SkipInternal) {
    child_iterator it;
    it.child = Child(this, firstRegularData, &it.error);
    return it;
  }

  auto* loc = (const uint8_t*)data.data() + strlen(magic);
  child_iterator it;
  it.child = Child(this, loc, &it.error);
  return it;
}
예제 #16
0
파일: z22.c 프로젝트: thektulu/lout
void FlushInners(OBJECT inners, OBJECT hd)
{ OBJECT y, z, tmp, dest_index;

  ifdebug(DGF, D,
    OBJECT link;
    fprintf(stderr, "dgf: [ FlushInners(");
    for( link = Down(inners);  link != inners;  link = NextDown(link) )
    {
      Child(y, link);
      fprintf(stderr, " %s", Image(type(y)));
      switch( type(y) )
      {

        case DEAD:
      
	  break;


        case RECEIVING:
        case UNATTACHED:
      
	  if( Down(y) != y )	/* bug fix (was assert before) */
	  { assert( Down(y) != y, "FlushInners: UNATTACHED!");
	    Child(z, Down(y));
	    fprintf(stderr, " %s", SymName(actual(z)));
	  }
	  break;


        case PRECEDES:
      
	  break;


        case GALL_PREC:

	  break;


        default:
      
	  break;
      }
    }
    fprintf(stderr, ")");
    debug0(DGF, D, "");
  )

  /* check for root galley case */
  if( hd != nilobj )
예제 #17
0
void treeFree(cellptr * cell)
{
	int i;

	nodeptr q;
	for (i = 0; i < NCHILD; i++) {
		if (Child(*cell)[i] != NULL)
			if (Type(Child(*cell)[i]) == CELL) {
				cellptr a = (cellptr) Child(*cell)[i];
				treeFree(&a);
			}
	}
	free(*cell);
}
예제 #18
0
파일: z29.c 프로젝트: thektulu/lout
OBJECT SearchSym(FULL_CHAR *str, int len)
{ register int rlen, sum;
  register FULL_CHAR *x, *y;
  OBJECT p, q, link, plink, entry;
  int s;

  debug2(DST, DDD, "SearchSym( %c..., %d )", str[0], len);

  hash(str, len, sum);
  rlen = len;
  entry = (OBJECT) &symtab[sum];
  for( plink = Down(entry);  plink != entry;  plink = NextDown(plink) )
  { Child(p, plink);
    if( rlen == length(p) )
    { x = str;  y = string(p);
      do; while( *x++ == *y++ && --rlen );
      if( rlen == 0 )
      {
	debug1(DST, DDD, "  found %s", string(p));
	s = scope_top;
	do
	{ s--;
	  for( link = Down(p);  link != p;  link = NextDown(link) )
	  { Child(q, link);
	    { debugcond4(DST, DDD, enclosing(q) == scope[s],
	       "  !npars_only[s] = %s, !vis_only[s] = %s, body_ok[s] = %s, !ss = %s",
	       bool(!npars_only[s]), bool(!vis_only[s]), bool(body_ok[s]),
	       bool(!suppress_scope));
	    }
	    if( enclosing(q) == scope[s]
	      && (!npars_only[s] || type(q) == NPAR)
	      && (!vis_only[s] || visible(q) || suppress_visible )
	      && (body_ok[s] || type(q)!=RPAR || !has_body(enclosing(q))
		  || suppress_visible )
	      && (!suppress_scope || StringEqual(string(p), KW_INCLUDE) ||
				     StringEqual(string(p), KW_SYSINCLUDE))
	    )
	    {	debug3(DST, DD, "SearchSym returning %s %s%%%s",
		  Image(type(q)), SymName(q), SymName(enclosing(q)));
		return q;
	    }
	  }
	} while( scope[s] != StartSym );
      }
    }
    rlen = len;
  }
  debug0(DST, DDD, "SearchSym returning <nilobj>");
  return nilobj;
} /* end SearchSym */
예제 #19
0
파일: testhash.cpp 프로젝트: ivandzen/HSDB
Bool testhash::Parent::removeChild(const Child & child) const  {
    if(!child.isExists() || child.getParent() != *this )
        return false;
    StdUInt hash_value = getChildHash(child.getParentKey());
    Child next = child.getNextParentTableListChild();
    Child prev = child.getPrevParentTableListChild();
    if (prev.isValid()) //! Previous exists
    {
        if (getChildHash(prev.getParentKey()) != hash_value) //! Previous has different hash
        {
            if (next.isValid()) //! And next exists
            {
                if (getChildHash(next.getParentKey()) != hash_value) //! But next has different hash
                    setiChildTable(hash_value, Child());
                else  //! Next has the same hash
                    setiChildTable(hash_value, next);
            }
            else  //! Next is absent
            {
                setiChildTable(hash_value, Child());
                setChildTableMax(getChildHash(prev.getParentKey()));
            }
        }
    }
    else  //! Previous absent
    {
        if (next.isValid()) //! Next exists
        {
            if (getChildHash(next.getParentKey()) != hash_value) //! Next has different hash
            {
                setiChildTable(hash_value, Child());
                setChildTableMin(getChildHash(next.getParentKey()));
            }
            else //! Next has the same hash
                setiChildTable(hash_value, next);
        }
        else //! Next is absent
        {
            setiChildTable(hash_value, Child());
            setChildTableMax(0);
            setChildTableMin(0);
        }
    }
    removeTableListChild(child);
    child.setParent(Parent());
    child.removeParentHandler();
    setNumChilds(getNumChilds() - 1);
    return true;
}
예제 #20
0
파일: testlist.cpp 프로젝트: ivandzen/HSDB
testlist::Child testlist::Child::create()  {
    if(instanceCount() == 0)
        return Child();
    Child result = popFreeChild();
    if(!result.isValid())
    {
        if(getUsed() >= instanceCount())
            reallocInstances(instanceCount() << 1);
        result = Child(getUsed());
        setUsed(getUsed() + 1);
    }
    result.reset();
    result.onCreate();
    return result;
}
예제 #21
0
Stack wrap(Stack *s, short opv)
{
    Re_node r;

    if (s == NULL || *s == NULL) return NULL;
    r = (Re_node) new_node(r);
    if (r == NULL) return NULL;
    Op(r) = opv;
    Child(r) = Pop(s);
    if (Push(s, r) == NULL) return NULL;
    Nullable(r) = TRUE;
    Firstpos(r) = Firstpos(Child(r));
    Lastpos(r)  = Lastpos(Child(r));
    return *s;
}
예제 #22
0
TEST_F(ConfigNodeTest, Value_2)
{
	typedef Math::Float F;
	const auto node = config.LoadFromStringAndGetFirstChild(ConfigNodeData_2);

	Math::Vec3 expect_v(F(1), F(2), F(3));
	EXPECT_TRUE(ExpectVec3Near(expect_v, node.Child("v").Value<Math::Vec3>()));

	Math::Mat4 expect_m(
		F(1), F(2), F(3), F(4),
		F(5), F(6), F(7), F(8),
		F(9), F(10), F(11), F(12),
		F(13), F(14), F(15), F(16));
	EXPECT_TRUE(ExpectMat4Near(expect_m, node.Child("m").Value<Math::Mat4>()));
}
예제 #23
0
파일: testhash.cpp 프로젝트: ivandzen/HSDB
Void testhash::Parent::reset() const  {
    setChildTableIndex(Null);
    setChildTableLen(0);
    setChildTableMax(0);
    setChildTableMin(0);
    setChildTableSize(DEFAULT_HASH_TABLE_SIZE);
    setExists(true);
    setFirstTableListChild(Child());
    setLastTableListChild(Child());
    setNextParentFreeParent(Parent());
    setNextParent__ChildTableBlock__Parent(Parent());
    setNumChilds(0);
    setNumTableListChilds(0);
    setPrevParent__ChildTableBlock__Parent(Parent());
}
예제 #24
0
파일: z19.c 프로젝트: thektulu/lout
OBJECT SearchGalley(OBJECT start, OBJECT sym, BOOLEAN forwards,
BOOLEAN subgalleys, BOOLEAN closures, BOOLEAN input)
{ OBJECT y, res, z, zlink, link;
  debug5(DGA, DD, "[ SearchGalley(start, %s, %s, %s, %s, %s)", SymName(sym),
	forwards ? "fwd" : "back", subgalleys ? "subgalleys" : "nosubgalleys",
	closures ? "closures" : "noclosures", input ? "input" : "noinput");
  assert( type(start) == LINK || type(start) == HEAD, "SearchGalley: start!" );

  link = forwards ? NextDown(start) : PrevDown(start);
  res = nilobj;
  while( res == nilobj && type(link) != HEAD )
  { Child(y, link);
    switch( type(y) )
    {
      case UNATTACHED:
      case RECEIVING:
	
        debug1(DGA, DD, "  examining %s", EchoIndex(y));
	if( subgalleys )
	for( zlink = Down(y); zlink!=y && res==nilobj; zlink=NextDown(zlink) )
	{ Child(z, zlink);
	  res = SearchGalley(z, sym, TRUE, TRUE, TRUE, input);
	}
	if( res == nilobj && input && type(y) == RECEIVING &&
	    actual(actual(y)) == InputSym )
	  res = y;
	break;


      case RECEPTIVE:
	
        debug1(DGA, DD, "  examining %s", EchoIndex(y));
	if( closures && type(actual(y)) == CLOSURE
		     && SearchUses(actual(actual(y)), sym) )  res = y;
	else if( input && actual(actual(y)) == InputSym )  res = y;
	break;


      default:
	
	break;

    }
    link = forwards ? NextDown(link) : PrevDown(link);
  }
  debug1(DGA, DD, "] SearchGalley returning %s", EchoIndex(res));
  return res;
} /* end SearchGalley */
예제 #25
0
bool GServerInfoWindow::OnCreate()
{
	__super::OnCreate();

   m_pObjInnerFrm = (GUI::GFrame*)Child(L"frmInner");

   m_pObjServerNameTxt  = (GUI::GLabel*)m_pObjInnerFrm->Child(L"frmInfo")->Child(L"txtName");
   m_pObjIpAddressTxt   = (GUI::GLabel*)m_pObjInnerFrm->Child(L"frmInfo")->Child(L"txtIpAddress");
   m_pObjPlayersTxt     = (GUI::GLabel*)m_pObjInnerFrm->Child(L"frmInfo")->Child(L"txtPlayers");

   m_pObjJoinGameBtn    = (GUI::GButton*)m_pObjInnerFrm->Child(L"btnJoinGame");

   m_pObjModsTxt        = (GUI::GLabel*)m_pObjInnerFrm->Child(L"frmInfo")->Child(L"txtMods");
   m_pObjScenarioTxt    = (GUI::GLabel*)m_pObjInnerFrm->Child(L"frmInfo")->Child(L"txtScenario");

   m_pObjPasswordCbo    = (GUI::GToggle*)m_pObjInnerFrm->Child(L"frmInfo")->Child(L"togPassword");

   m_pObjPasswordCbo->Enabled(false);

   CGFX_Renderer_Init_Mode mode;
   g_Joshua.Renderer()->Get_Current_Mode(&mode);

   Position(((INT16)mode.m_Resolution.x / 2) - (Width() / 2),((INT16)mode.m_Resolution.y / 2) - (Height() / 2));

	return true;
}
bool GCovertActionsNewMissionWindow::OnCreate()
{
	__super::OnCreate();

   m_pObjInnerFrm       = (GUI::GFrame*)Child(L"frmInner");

   m_pObjTypeCbo        = (GUI::GComboBox*)m_pObjInnerFrm->Child(L"frmMission")->Child(L"cboMissionType");
   m_pObjSectorCbo      = (GUI::GComboBox*)m_pObjInnerFrm->Child(L"frmMission")->Child(L"cboSector");
   m_pObjComplexityCbo  = (GUI::GComboBox*)m_pObjInnerFrm->Child(L"frmMission")->Child(L"cboComplexity");
   m_pObjResourceCbo    = (GUI::GComboBox*)m_pObjInnerFrm->Child(L"frmMission")->Child(L"cboResourceUnit");
   m_pObjTargetLbl      = (GUI::GLabel*)   m_pObjInnerFrm->Child(L"frmMission")->Child(L"txtCountry");
   m_pObjFramedCbo      = (GUI::GComboBox*)m_pObjInnerFrm->Child(L"frmMission")->Child(L"cboCountry");

   m_pObjResourceLbl    = (GUI::GLabel*)m_pObjInnerFrm->Child(L"frmMission")->Child(L"lblResourceUnit");
   m_pObjSectorLbl      = (GUI::GLabel*)m_pObjInnerFrm->Child(L"frmMission")->Child(L"lblTargetSector");


   m_pObjConfirm        = (GUI::GButton*)m_pObjInnerFrm->Child(L"btnConfirm");
   m_pObjCancel         = (GUI::GButton*)m_pObjInnerFrm->Child(L"btnCancel");

   m_pObjTypeCbo->Add_Item( g_ClientDAL.GetString(EStrId::MissionTypeEspionage) );
   m_pObjTypeCbo->Add_Item( g_ClientDAL.GetString(EStrId::MissionTypeSabotage) );
   m_pObjTypeCbo->Add_Item( g_ClientDAL.GetString(EStrId::MissionTypeAssassination) );
   m_pObjTypeCbo->Add_Item( g_ClientDAL.GetString(EStrId::MissionTypeTerrorism) );
   m_pRowCoupDetat = m_pObjTypeCbo->Add_Item( g_ClientDAL.GetString(EStrId::MissionTypeCoupEtat) );

   m_pObjSectorCbo->Add_Item( g_ClientDAL.GetString(EStrId::MissionTargetCivilian) );
   m_pObjSectorCbo->Add_Item( g_ClientDAL.GetString(EStrId::MissionTargetMilitary) );

   if(m_pObjApplyBtn)
      m_pObjApplyBtn->Hide();

	return true;
}
예제 #27
0
void Archive::dump() const {
  printf("Archive data %p len %zu, firstRegularData %p\n", data.data(),
         data.size(), firstRegularData);
  printf("Symbol table %p, len %u\n", symbolTable.data, symbolTable.len);
  printf("string table %p, len %u\n", stringTable.data, stringTable.len);
  const uint8_t* buf = symbolTable.data;
  if (!buf) {
    for (auto c = child_begin(), e = child_end(); c != e; ++c) {
      printf("Child %p, len %u, name %s, size %u\n", c->data, c->len,
             c->getName().c_str(), c->getSize());
    }
    return;
  }
  uint32_t symbolCount = read32be(buf);
  printf("Symbol count %u\n", symbolCount);
  buf += sizeof(uint32_t) + (symbolCount * sizeof(uint32_t));
  uint32_t string_start_offset = buf - symbolTable.data;
  Symbol sym = {0, string_start_offset};
  while (sym.symbolIndex != symbolCount) {
    printf("Symbol %u, offset %u\n", sym.symbolIndex, sym.stringIndex);
    // get the member
    uint32_t offset = read32be(symbolTable.data + sym.symbolIndex * 4);
    auto* loc = (const uint8_t*)&data[offset];
    child_iterator it;
    it.child = Child(this, loc, &it.error);
    printf("Child %p, len %u\n", it.child.data, it.child.len);
  }
}
예제 #28
0
Box *Box::PackStart(Widget *widget)
{
	assert(widget);
	AddWidget(widget);
	m_children.push_front(Child(widget));
	return this;
}
예제 #29
0
void calculateCenterOfMass(cellptr cell)
{
	/* Center of mass position */
	vector cmPos;
	vector tempV;
	nodeptr q;
	int i;
	/* Init the cell's total mass */
	Mass(cell) = 0.0;
	/* Init the cell's center of mass position */
	CLRV(cmPos);
	/* Loop over the subnodes */
	for (i = 0; i < NCHILD; i++) {
		/* Skipping empty child nodes */
		if ((q = Child(cell)[i]) != NULL) {
			/* If node is a cell */
			if (Type(q) == CELL)
				/* Recursively do the same */
				calculateCenterOfMass((cellptr) q);
			/* Accumulate total mass */
			Mass(cell) = Mass(q);
			/* Accumulate center of mass */
			ADDMULVS(cmPos, Pos(q), Mass(q));
		}
	}
	/* Usually, cell has mass */
	if (Mass(cell) > 0.0) {
		/* Find center of mass position */
		DIVVS(cmPos, cmPos, Mass(cell));
	} else { /* If no mass inside */
		SETV(cmPos, Pos(cell));
	}
	SETV(Pos(cell), cmPos);
}
예제 #30
0
Box *Box::PackEnd(Widget *widget)
{
	assert(widget);
	AddWidget(widget);
	m_children.push_back(Child(widget));
	return this;
}