Ejemplo n.º 1
0
HTMLImportChild* HTMLImportsController::load(HTMLImport* parent, HTMLImportChildClient* client, FetchRequest request)
{
    ASSERT(!request.url().isEmpty() && request.url().isValid());
    ASSERT(parent == root() || toHTMLImportChild(parent)->loader()->isFirstImport(toHTMLImportChild(parent)));

    if (HTMLImportChild* childToShareWith = root()->find(request.url())) {
        HTMLImportLoader* loader = childToShareWith->loader();
        ASSERT(loader);
        HTMLImportChild* child = createChild(request.url(), loader, parent, client);
        child->didShareLoader();
        return child;
    }

    bool sameOriginRequest = master()->securityOrigin()->canRequest(request.url());
    request.setCrossOriginAccessControl(
        master()->securityOrigin(), sameOriginRequest ? AllowStoredCredentials : DoNotAllowStoredCredentials,
        ClientDidNotRequestCredentials);
    ResourcePtr<RawResource> resource = parent->document()->fetcher()->fetchImport(request);
    if (!resource)
        return 0;

    HTMLImportLoader* loader = createLoader();
    HTMLImportChild* child = createChild(request.url(), loader, parent, client);
    // We set resource after the import tree is built since
    // Resource::addClient() immediately calls back to feed the bytes when the resource is cached.
    loader->startLoading(resource);
    child->didStartLoading();
    return child;
}
Ejemplo n.º 2
0
void ActiveSpellsGui::update(const Rectf & parent) {
	
	float intensity = 1.f - PULSATE * 0.5f;
	intensity = glm::clamp(intensity, 0.f, 1.f);
	
	m_flickTime += g_platformTime.lastFrameDuration();
	
	if(m_flickTime >= m_flickInterval) {
		m_flickNow = !m_flickNow;
		while(m_flickTime >= m_flickInterval) {
			m_flickTime -= m_flickInterval;
		}
	}
	
	m_slots.clear();
	
	spellsByPlayerUpdate(intensity);
	spellsOnPlayerUpdate(intensity);
	
	Rectf spacer = createChild(parent, Anchor_TopRight, m_spacerSize * m_scale, Anchor_TopRight);
	Rectf siblingRect = spacer;
	
	BOOST_FOREACH(ActiveSpellIconSlot & slot, m_slots) {
		
		Rectf slotRect = createChild(siblingRect, Anchor_BottomLeft, m_slotSize * m_scale, Anchor_TopLeft);
		Rectf slotSpacer = createChild(slotRect, Anchor_BottomLeft, m_slotSpacerSize * m_scale, Anchor_TopLeft);
		siblingRect = slotSpacer;
		
		slot.m_rect = slotRect;
	}
Ejemplo n.º 3
0
 Model::Model()
 {
   setValue((OSPModel)nullptr);
   createChild("dynamicScene", "bool", true);
   createChild("compactMode", "bool", false);
   createChild("robustMode", "bool", false);
 }
Ejemplo n.º 4
0
    Frame::Frame()
    {
      createChild("frameBuffer", "FrameBuffer");
      createChild("camera", "PerspectiveCamera");
      createChild("renderer", "Renderer");

      createChild("frameAccumulationLimit", "int", -1);
    }
Ejemplo n.º 5
0
    Geometry::Geometry(const std::string &type)
    {
      auto matList =
        createChild("materialList", "MaterialList").nodeAs<MaterialList>();
      matList->push_back(createNode("default", "Material")->nodeAs<Material>());

      createChild("type", "string", type);
      setValue((OSPGeometry)nullptr);
    }
Ejemplo n.º 6
0
Archivo: main.c Proyecto: 1587/ltp
test_ll_t *run()
{
	test_ll_t *newTest = NULL, *lastTest = NULL;

	if (cleanArgs.flags & CLD_FLG_FSLIST) {
		char *filespec = cleanArgs.device;
		char *aFilespec = NULL;
		FILE *file = NULL;

		if ((aFilespec = (char *)ALLOC(80)) == NULL) {
			pMsg(ERR, &cleanArgs,
			     "Could not allocate memory to read file");
			return newTest;
		}

		file = fopen(filespec, "r");
		if (file == NULL) {
			pMsg(ERR,
			     &cleanArgs,
			     "%s is not a regular file, could not be opened for reading, or was not found.",
			     filespec);
			FREE(aFilespec);

			return newTest;
		}

		while (!feof(file)) {
			memset(aFilespec, 0, 80);
			fscanf(file, "%79s", aFilespec);
			if (aFilespec[0] != 0) {	/* if we read something useful */
				lastTest = newTest;
				newTest = getNewTest(lastTest);
				if (newTest != lastTest) {
					memset(newTest->args->device, 0,
					       DEV_NAME_LEN);
					strncpy(newTest->args->device,
						aFilespec, strlen(aFilespec));
					createChild(threadedMain, newTest);
				} else {
					newTest = lastTest;
					break;
				}
			}
		}

		fclose(file);
		FREE(aFilespec);
	} else {
		newTest = getNewTest(newTest);
		if (newTest != NULL) {
			createChild(threadedMain, newTest);
		}
	}

	return newTest;
}
Ejemplo n.º 7
0
/* STreeNode::addChild
 * Creates a new child node matching [name] and adds it to the node's
 * children. Also works recursively if a path is given
 *******************************************************************/
STreeNode* STreeNode::addChild(string name)
{
	// Check name was given
	if (name.IsEmpty())
		return NULL;

	// If name ends with /, remove it
	if (name.EndsWith("/"))
		name.RemoveLast(1);

	// Convert name to path for processing
	wxFileName fn(name);

	// If no directories were given
	if (fn.GetDirCount() == 0)
	{
		// If child name duplication is disallowed,
		// check if a child with this name exists
		STreeNode* child = NULL;
		if (!allow_dup_child)
			child = getChild(name);

		// If it doesn't exist, create it
		if (!child)
		{
			child = createChild(name);
			addChild(child);
		}

		// Return the created child
		return child;

	}
	else
	{
		// Directories were given, get the first directory
		string dir = fn.GetDirs()[0];

		// If child name duplication is disallowed,
		// check if a child with this name exists
		STreeNode* child = NULL;
		if (!allow_dup_child)
			child = getChild(dir);

		// If it doesn't exist, create it
		if (!child)
		{
			child = createChild(dir);
			addChild(child);
		}

		// Continue adding child nodes
		fn.RemoveDir(0);
		return child->addChild(fn.GetFullPath(wxPATH_UNIX));
	}
}
Ejemplo n.º 8
0
/**
 * Splits this tree into two sub-trees.
 *
 * @return true if we split, false if we have reaced the max depth
 */
bool MxCifQuadTree::MxCifBinTree::split(void)
{
	if (m_maxDepth <= 1)
		return false;

	int newDepth = m_maxDepth - 1;

	m_left  = createChild(   m_min, m_center, newDepth);
	m_right = createChild(m_center,    m_max, newDepth);
	return true;
}	// MxCifBinTree::split
Ejemplo n.º 9
0
Archivo: digenv.c Proyecto: pHag/ID2200
/* Main creates pipes and then creates children that will run commands "printEnvp | sort | less" when there is no arguments
pipes printEnvp -> pipe_fileDesc -> sort -> pipe_fileDesc2 -> less -> STDOUT
If we have more than 1 arguments we will instead run "printEnvp | grep argument | sort | less"
pipes printEnvp -> pipe_fileDesc3 -> grep -> pipe_fileDesc -> sort -> pipe_fileDesc2 -> less -> STDOUT
At the end main will wait for each child status to handle them with signal if they die normaly or terminate by error.
@ Param int argc - number of arguments we have started our program with 
@ Param char **argv - all the arguments we have is in a vector 
*/
int main(int argc, char **argv)
{	
	char *pagerEnv; /* char pointer for the inviorment varible for the pager*/
	pagerEnv = getenv("PAGER"); /* Get the page variable if it is set*/
	printf("DEBUG: Selected pager: %s\n", pagerEnv);
	if (NULL == pagerEnv) { /* Page enviorment isn't set*/
		pagerEnv = "less"; /* Set it to less*/ 
	}

	fprintf( stderr, "Parent (Parent, pid %ld) started\n",
	(long int) getpid() ); /* printing parents id for easier debuggning*/

	int pipe_fileDesc[2]; /* File descriptiors for pipe, printEnvp to sort -> grep  */
	int pipe_fileDesc2[2];  /* File descriptiors for pipe, printEnvp or grep -> sort -> less*/
	int pipe_fileDesc3[2]; /* File descriptiors for pipe, printEnvp -> grep -> sort */

	
	returnValue = pipe( pipe_fileDesc); /* Create a pipe */
	if ( -1 == returnValue) { perror("Cannot create pipe");	exit(1); } /* check return value for errors*/

	if (argc == 1){ /* no extra arguments then create a child printenv that pipes printenv -> sort */
		createChild( pipe_fileDesc, pipe_fileDesc,  "printenv", NO_READ, READWRITE_CLOSE, argv);
	}

	else if (argc >= 2)/* extra arguments then create a child printenv that pipes printenv -> grep */
	{
		returnValue = pipe(pipe_fileDesc3);/* create pipe for printenv -> grep -> sort*/
		if ( -1 == returnValue) { perror("Cannot create pipe");	exit(1); }/* check return value for errors*/
		
		/* execute printenv and pipe STDIN -> printenv -> grep */
		createChild(pipe_fileDesc, pipe_fileDesc3, "printenv", NO_READ, READWRITE_CLOSE, argv); 
		/* execute grep pipe printenv -> grep -> sort */
		createChild(pipe_fileDesc3, pipe_fileDesc, "grep", READWRITE_NO_CLOSE, READWRITE_NO_CLOSE, argv); 
	}

	returnValue = pipe( pipe_fileDesc2); /* Create a pipe printenv/grep -> sort -> less*/
	if ( -1 == returnValue) { perror("Cannot create pipe");	exit(1); }/* check return value*/

	/* execute grep pipe printenv/grep -> sort -> less */
	createChild( pipe_fileDesc, pipe_fileDesc2, "sort", READWRITE_CLOSE, READWRITE_NO_CLOSE, argv); 
	/* execute  pipe sort -> less -> STDOUT */
	createChild( pipe_fileDesc2, pipe_fileDesc2, pagerEnv , READWRITE_NO_CLOSE, NO_READ, argv);

	/* Run one childhandler for each child that is being created */
	childHandler();
	if (argc >= 2) {
		childHandlerGrep();
	}
	childHandler();
	childHandler();

	exit(0); // Normal terminate
}
Ejemplo n.º 10
0
    ToneMapper::ToneMapper()
    {
      setValue(ospNewPixelOp("tonemapper"));

      createChild("enabled", "bool", true);

      createChild("exposure", "float", 0.0f,
                    NodeFlags::required |
                    NodeFlags::gui_slider).setMinMax(-8.f, 8.f);

      createChild("contrast", "float", 1.6773f,
                    NodeFlags::required |
                    NodeFlags::gui_slider).setMinMax(1.f, 5.f);

      createChild("shoulder", "float", 0.9714f,
                    NodeFlags::required |
                    NodeFlags::gui_slider).setMinMax(0.9f, 1.f);

      createChild("midIn", "float", 0.18f,
                    NodeFlags::required |
                    NodeFlags::gui_slider).setMinMax(0.f, 1.f);

      createChild("midOut", "float", 0.18f,
                    NodeFlags::required |
                    NodeFlags::gui_slider).setMinMax(0.f, 1.f);

      createChild("hdrMax", "float", 11.0785f,
                    NodeFlags::required |
                    NodeFlags::gui_slider).setMinMax(1.f, 64.f);

      createChild("acesColor", "bool", true);
    }
Ejemplo n.º 11
0
void			WinWindow::makeContext()
{
  if (!inactiveDueToDeactivate && !inactiveDueToDeactivateAll)
    if (hDCChild == NULL)
      createChild();
  makeCurrent();
}
Ejemplo n.º 12
0
void HealthGauge::updateRect(const Rectf & parent) {
	m_rect = createChild(parent, Anchor_BottomLeft, m_size * m_scale, Anchor_BottomLeft);
	
	// Red gauge texures have a 2 pixel gap at the bottom,
	// tweak the position to hide it
	m_rect.move(0, 2.f * m_scale);
}
Ejemplo n.º 13
0
DataSourceSetItem::DataSourceSetItem(unsigned flags, MemoryBuffer & in) : DataSourceMetaItem(flags, in)
{
    createChild();
    splitXmlTagNamesFromXPath(xpath.get(), record.tagname, &tagname);
    if (!record.tagname.length())
        record.tagname.set("Item");
}
Ejemplo n.º 14
0
bool CComponentLibrary::fromXml(const CXmlElement &xmlElement,
                                CXmlSerializingContext &serializingContext)
{
    CXmlElement childElement;

    CXmlElement::CChildIterator it(xmlElement);

    // XML populate all component libraries
    while (it.next(childElement)) {

        // Filter component library/type set elements
        if (childElement.getType() == "ComponentLibrary" ||
            childElement.getType() == "ComponentTypeSet") {

            if (!fromXml(childElement, serializingContext)) {

                return false;
            }
        } else {
            // Regular child creation and populating
            CElement *pChild = createChild(childElement, serializingContext);

            if (!pChild || !pChild->fromXml(childElement, serializingContext)) {

                return false;
            }
        }
    }

    return true;
}
Ejemplo n.º 15
0
void OctTree::rebase(int whichChildAmI) {
    UTIL_ASSERT(parent == NULL);
    UTIL_ASSERT(whichChildAmI >= 0 && whichChildAmI < kNumNodes);
    UTIL_ASSERT(GUtils::norm(boundingBox.getDimensions()) < 100000);
    
    OctTree * copy = createChild(boundingBox);
    copy->enclosedObjects = enclosedObjects;
    enclosedObjects.clear();
    
    for (int i = 0; i < kNumNodes; i++) {
        copy->children[i] = children[i];
        if (children[i] != NULL)
            copy->children[i]->parent = copy;
        children[i] = NULL;
    }
    
    copy->address = whichChildAmI;
    copy->activeChildren = activeChildren;
    activeChildren = 0;

    setChildActive(whichChildAmI, copy->isActive());
    children[whichChildAmI] = copy;
    boundingBox = boundingBoxForParent(whichChildAmI);
    updateActiveStates(copy);
}
Ejemplo n.º 16
0
    void Importer::importDefaultExtensions(const std::shared_ptr<Node> &world,
                                           const FileName &fileNamen)
    {
      std::cout << "importDefaultExtensions \"" << fileNamen.str() << "\"" << std::endl;
      std::vector<FileName> files;
      //check for multiple files
      if (fileNamen.str().find(",") != std::string::npos) {
        std::cout << "parsing import file series" << std::endl;
        // file series
        std::string filestr = fileNamen.str();
        std::replace(filestr.begin(),filestr.end(),',',' ');
        std::stringstream ss(filestr);
        std::string file;
        while (ss >> file)
          files.push_back(FileName(file));

        if (files.size() > 0) {
          auto ext = files[0].ext(); //TODO: check that they are all homogeneous
#ifdef OSPRAY_APPS_SG_VTK
          auto& selector = createChild("selector", "Selector");
          if (ext == "vti") {
            sg::importVTIs(selector.shared_from_this(), files);
            return;
          }
#endif
        }
      } else {
Ejemplo n.º 17
0
void ChangeLevelIconGui::update(const Rectf & parent) {
	m_rect = createChild(parent, Anchor_TopRight, m_size * m_scale, Anchor_TopRight);
	
	float wave = timeWaveSin(g_gameTime.now(), GameDurationMsf(314.159f));
	m_intensity = 0.9f - wave * 0.5f + Random::getf(0.f, 0.1f);
	m_intensity = glm::clamp(m_intensity, 0.f, 1.f);
}
Ejemplo n.º 18
0
//------------------------------------------------------------------------------
Entity * Entity::requireChild(const ObjectType & type)
{
    Entity * e = getChildByType(type);
    if (e == nullptr)
        e = createChild(type);
    return e;
}
Ejemplo n.º 19
0
 void ColorOcTreeNode::expandNode() {
   assert(!hasChildren());
   for (unsigned int k=0; k<8; k++) {
     createChild(k);
     children[k]->setValue(value);
     getChild(k)->setColor(color);
   }
 }
Ejemplo n.º 20
0
void CurrentTorchIconGui::updateRect(const Rectf & parent) {
	
	m_rect = createChild(parent, Anchor_TopLeft, m_size * m_scale, Anchor_BottomLeft);
	
	if(g_secondaryInventoryHud.rect().overlaps(m_rect)) {
		m_rect.move(g_secondaryInventoryHud.rect().right, 0.f);
	}
}
Ejemplo n.º 21
0
/**
	 * @pre 
	 * 			 	for all i ws[i][0]>ws[i+1][0] and ws[i][0]>0 ws[i][1]>0 
	 * @param ws:  
	 * 				ws[i][0] = weight i
	 *  			ws[i][1] = number of weight i in constraint
	 * @return	SearchMetaData*  
*/
SearchMetaData* bnb_oddEven_Cost_search(unsigned int weights[][2],int length,std::vector<unsigned int>& primes,unsigned int cutoff,bool nonPrimePossible,bool abstraction){
		SearchMetaData*  md = new SearchMetaData(lg2(weights[0][0]),cutoff,weights[0][0],length,"BNB_oddEven_comp");  //preperations
		THeap que;
		std::map<unsigned int,bss> homomorphism;
		unsigned int sum[length+1];
		sum[0] = 0;
		unsigned long long temp=0;
		for(int i=0;i<length;i++) {
			sum[i+1]=sum[i]+weights[i][1];	
			temp+=weights[i][0]*weights[i][1];
		}
		temp = oddEvenCount(temp);
		BaseSearchState* startState=new BaseSearchState(0,length,1,0,0,0);
		BaseSearchState* bestStateFound(0);
		que.offer(startState);
		unsigned long long bestFound = oddEvenCountEval(weights, md->base,length);
		if (bestFound>temp) { // relaxs betwin The empty base and the Binary base
			bestFound =temp;
			bestStateFound = startState;
		}
		std::vector<bss> old;
		while(!que.isEmpty() && que.peek()->hCost < bestFound ) { //main A star loop;
			md->nodesExpended++;
			bss father = que.poll();
			old.push_back(father);
			for(unsigned int i=0;i<primes.size() && father->baseMul*primes[i]<=weights[0][0];i++){
				createChild(father,primes[i],weights,sum,&bestFound,&bestStateFound,que,*md,old,homomorphism,abstraction); //create regular chiled
				if (nonPrimePossible && father->parent!=0)  //create compresion chiled
					createChild(father->parent,(father->baseMul / father->parent->baseMul)*primes[i],weights,sum,&bestFound,&bestStateFound,que,*md,old,homomorphism,abstraction);
			}
		}
		if (bestStateFound!=0) {
			std::vector<int> &base =  md->base;
			base.clear(); 
			BaseSearchState* temp = bestStateFound;
			while (temp->parent!=0){
				base.insert(base.begin(),temp->baseMul / temp->parent->baseMul);
				temp = temp->parent;
			} 
		}
		md->finalize(bestFound);
		for(unsigned int i=0;i<old.size();i++)
			delete old[i];
		return md;
}
Ejemplo n.º 22
0
DataSourceSetItem::DataSourceSetItem(const char * _name, const char * _xpath, ITypeInfo * _type) : DataSourceMetaItem(FVFFset, _name, NULL, _type)
{
    createChild();
    xpath.set(_xpath);
    StringBuffer attr;
    splitXmlTagNamesFromXPath(_xpath, record.tagname, &tagname);
    if (!record.tagname.length())
        record.tagname.set("Item");
}
Ejemplo n.º 23
0
Node::SPtr createChild(Node::SPtr& node, const std::string& name, const std::map<std::string, std::string>& params)
{
    BaseObjectDescription desc(name.c_str(), "Node");
    for(auto& kv : params)
    {
        desc.setAttribute(kv.first.c_str(), kv.second);
    }
    return createChild(node, desc);
}
Ejemplo n.º 24
0
GraphPtr LazyGraph::loadSubgraph(long int offset, AreaId id)
{
    assert(fileReader != NULL);
    long int oldOffset = fileReader->tellg();
    fileReader->seekg(offset, ios::beg);
    GraphPtr g = createChild();
    g->load(fileReader, true);
    fileReader->seekg(oldOffset, ios::beg);
    return g;
}
Ejemplo n.º 25
0
void PurseIconGui::update(const Rectf & parent) {
	m_rect = createChild(parent, Anchor_TopRight, m_size * m_scale, Anchor_BottomRight);
	
	if(m_haloActive) {
		m_haloTime += g_platformTime.lastFrameDuration();
		if(m_haloTime >= PlatformDurationMs(1000)) {
			m_haloActive = false;
		}
	}
}
Ejemplo n.º 26
0
void PrecastSpellsGui::updateRect(const Rectf & parent) {
	
	Vec2f size = m_iconSize * Vec2f(Precast.size(), 1);
	
	m_rect = createChild(parent, Anchor_BottomRight, size * m_scale, Anchor_BottomLeft);
	
	if(g_playerInventoryHud.rect().overlaps(m_rect + Vec2f(0.0f, indicatorVertSpacing))) {
		m_rect.move(0.0f, g_playerInventoryHud.rect().top - parent.bottom - indicatorVertSpacing);
	}
}
Ejemplo n.º 27
0
void srs_env_model::EModelTreeNode::expandNode() {
	assert(!hasChildren());

	// expand node, set children color same as node color
	for (unsigned int k = 0; k < 8; k++) {
		createChild(k);
		itsChildren[k]->setValue(value);
		getChild(k)->setColor(r(), g(), b(), a());
	}
}
Ejemplo n.º 28
0
  void CountingOcTreeNode::expandNode(){
    assert(!hasChildren());

    // divide "counts" evenly to children
    unsigned int childCount = (unsigned int)(value/ 8.0 +0.5);
    for (unsigned int k=0; k<8; k++) {
      createChild(k);
      children[k]->setValue(childCount);
    }
  }
Ejemplo n.º 29
0
void ScreenArrows::update() {
	
	if(!config.input.borderTurning) {
		return;
	}
	
	fArrowMove += .5f * toMs(g_platformTime.lastFrameDuration());
	if(fArrowMove > 180.f) {
		fArrowMove = 0.f;
	}
	
	float fMove = glm::abs(glm::sin(glm::radians(fArrowMove))) * m_horizontalArrowSize.x * m_scale * .5f;
	
	const Rectf parent = createChild(Rectf(g_size), Anchor_Center, Vec2f(g_size.size()) - Vec2f(fMove), Anchor_Center);
	m_left   = createChild(parent, Anchor_LeftCenter,   m_horizontalArrowSize * m_scale, Anchor_LeftCenter);
	m_right  = createChild(parent, Anchor_RightCenter,  m_horizontalArrowSize * m_scale, Anchor_RightCenter);
	m_top    = createChild(parent, Anchor_TopCenter,    m_verticalArrowSize * m_scale,   Anchor_TopCenter);
	m_bottom = createChild(parent, Anchor_BottomCenter, m_verticalArrowSize * m_scale,   Anchor_BottomCenter);
	
}
Ejemplo n.º 30
0
HTMLImportChild* HTMLImportsController::load(HTMLImport* parent, HTMLImportChildClient* client, FetchRequest request)
{
    ASSERT(!request.url().isEmpty() && request.url().isValid());
    ASSERT(parent == root() || toHTMLImportChild(parent)->loader()->isFirstImport(toHTMLImportChild(parent)));

    if (HTMLImportChild* childToShareWith = root()->find(request.url())) {
        HTMLImportLoader* loader = childToShareWith->loader();
        ASSERT(loader);
        HTMLImportChild* child = createChild(request.url(), loader, parent, client);
        child->didShareLoader();
        return child;
    }

    HTMLImportLoader* loader = createLoader();
    HTMLImportChild* child = createChild(request.url(), loader, parent, client);
    // We set resource after the import tree is built since
    // Resource::addClient() immediately calls back to feed the bytes when the resource is cached.
    loader->startLoading(request.url());
    child->didStartLoading();
    return child;
}