bool Selector::Select(const int i_letter, std::stack<int> & verifier)
{
	if (i_letter >= static_cast<int>(data_.size()))
	{
		return verifier.empty();
	}

	auto& memo = memo_[i_letter][data_[i_letter]];
	if (memo != -1)
	{
		return memo != 0;
	}

	if (data_[i_letter] == 1)
	{
		verifier.push(1);
		return Select(i_letter + 1, verifier);
	}
	if (data_[i_letter] == 0)
	{
		if (verifier.empty() || ((verifier.top() == 1) && (verifier.size() == 1)))
		{
			memo = 0;
			return false;
		}
		verifier.pop();
		return Select(i_letter + 1, verifier);
	}

	assert(data_[i_letter] == 2);
	verifier.push(1);
	if (Select(i_letter + 1, verifier))
	{
		memo = 1;
		return true;
	}


	return false;
}
예제 #2
0
int main(int argc, char** argv)
{
    glutInit(&argc,argv);
    glutInitWindowPosition(0,0);
    glutInitWindowSize(800,600);
    glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA);
    glutCreateWindow("PewPew");
    //glEnable(GL_LIGHTING);
    glEnable(GL_LINE_SMOOTH);
    glEnable(GL_BLEND);
    //glShadeModel(GL_SMOOTH);
    //glEnable(GL_LIGHT0);
    glMatrixMode(GL_PROJECTION);

    open_joystick();

    mn.add_option(std::string("INFO"),(&info_action));
    mn.add_option(std::string("PLAY"),(&run));
    mn.add_option(std::string("NEW GAME"),(&new_game));
    mn.add_option(std::string("OPTIONS"),(&option_action));
    mn.add_option(std::string("QUIT"),(&end_0));

    menu_pages.push(&mn);

    opt.add_option(std::string("BACK"),(&back));
    opt.add_option(std::string("SCORES"),(&scores_action));
    opt.add_option(std::string("SOUNDS ON"),(&sound_off),std::string("SOUNDS OFF"),(&sound_on));

    scores.add_option(std::string("BACK"), (&back));

    info.add_option(std::string("BACK"),(&back));

    //GLfloat filter[11] = {0.3,0.28,0.26,0.24,0.22,0.20,0.22,0.24,0.26,0.28,0.3};	//GOOD
    //glSeparableFilter2D(GL_SEPARABLE_2D, GL_LUMINANCE, 11, 11, GL_LUMINANCE, GL_FLOAT, filter,filter); //<< segfault !!!

    //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
    glutReshapeFunc(reshape);
    glutDisplayFunc(display);
    //glutIdleFunc(mytimer);
    glutTimerFunc(20,mytimer,1);

    glutIgnoreKeyRepeat(1);
    glutKeyboardUpFunc(kbRelF);
    glutSpecialFunc(skbF);
    glutKeyboardFunc(kbF);
    glutPassiveMotionFunc(mIdleF);
    glutMouseFunc(mF);
    glutMainLoop();

    return 0;
}
void PostfixExprEvaluator::processBinaryOp(const Token &token,
	                                       std::stack<Token> &operands)
{
	assert(token.type == TokenType::TOK_BINARYOP);

	// ensure stack contains two operands
	if (operands.size() < 2)
	{
		throw StackUnderflowException();
	}

	// fetch operand off the stack
	auto op2 = operands.top(); operands.pop();
	auto op1 = operands.top(); operands.pop();

	Token result;

	// if floating point calculation
	if (op1.type == TokenType::TOK_FLOAT
		|| op2.type == TokenType::TOK_FLOAT)
	{
		// convert int to float, if neccessary
		if (op1.type == TokenType::TOK_INT)
		{
			op1 = castIntToFloat(op1);
		}
		if (op2.type == TokenType::TOK_INT)
		{
			op2 = castIntToFloat(op2);
		}

		result.type = TokenType::TOK_FLOAT;
		result.value.valueFloat = evalBinaryOp<float>
		(
			op1.value.valueFloat,
			op2.value.valueFloat,
			token.value.vOpBinary
		);
	}
	else
	{
		result.type = TokenType::TOK_INT;
		result.value.valueInt = evalBinaryOp<int>
		(
			op1.value.valueInt,
			op2.value.valueInt,
			token.value.vOpBinary
		);
	}

	operands.push(result);
}
예제 #4
0
int dd_handlePop()
{
	if(dd_handles.empty())
	{
		for(int i=1;i<=4;i++)
			dd_handles.push(dd_handleCount+i);
		dd_handleCount += 4;
	}

	int handle = dd_handles.top();
	dd_handles.pop();
	return handle;
}
int second (std::stack<int> s)
{
	int tmp, second;
	tmp = s.top();
	s.pop();
	second = s.top();
	s.push(tmp);

	if (DEBUG == 1)
		cout << "the 2nd element is : " << second <<"\n";

	return second;
}
	void dump()
	{
		if (stckIn.empty() || !stckOut.empty())
			return;

		while (!stckIn.empty())
		{
			stckOut.push(stckIn.top());
			stckIn.pop();
		}

		assert(stckIn.empty());
	}
void MovingPlatform::render(std::stack<glm::mat4>& _Stack)
{

	//drawing the position of first moving platform
	glBindTexture(GL_TEXTURE_2D, textures[0]);
	_Stack.push(_Stack.top());
	_Stack.top() = glm::translate(_Stack.top(), currentPos);
	_Stack.top() = glm::scale(_Stack.top(), glm::vec3(5.0f, 0.1f, 5.0f));
	rt3d::setUniformMatrix4fv(shaderProgram, "modelview", glm::value_ptr(_Stack.top()));
	rt3d::setMaterial(shaderProgram, material0);
	rt3d::drawIndexedMesh(meshObjects[0], meshIndexCount, GL_TRIANGLES);
	_Stack.pop();
}
예제 #8
0
/* Open a dialog */
void SDLGui_Open(Dialog *new_dlg)
{
	if (new_dlg==NULL) {
		/* Open main as default */
		new_dlg = DlgMainOpen();
	}

	dlgStack.push(new_dlg);

	gui_dlg = dlgStack.top();
	gui_dlg->init();
	gui_dlg->idle();	
}
예제 #9
0
파일: StateManager.cpp 프로젝트: vsrz/VHH
void StateManager::Change(State* state)
{
	if(states.size() > 0)
	{
		delete states.top();
		states.pop();
	}

	states.push(state);

	state_changed = true;
	//states.top().Resume();
}
//Realiza el algoritmo de Graham de las 3 monedas para hallar el Convex Hull S de una lista de Puntos Q.
//Devuelve una Pila con el resultado clockwise.
void grahamScan(std::list<Point2D> & Q, std::stack<Point2D> & S){
  minimal = encontrarMinimal(Q);                            //Encuentra el minimal izquierda abajo
 // std::cout<<"Minimal: "; minimal.print();
  
  borrarMinimal(Q, minimal);                                //Borra el minimal de la cola 

  Q.sort(comparePoint2DPolar);                              //Ordena en forma polar
  std::cout<<"Lista ordenada\n"; printList(Q);
  
  eliminarColineales(Q);                                    //Hace limpieza de los puntos colineales, dejando el mas lejano
  std::cout<<"Lista ordenada\n"; printList(Q);
  
  
  //Ubica las 3 primeras monedas
  S.push(minimal);                                          //Agrega el primero que es el minimal
  
  //Agrega la segunda y tercera
  std::list<Point2D>::iterator it = Q.begin();              //Iterador para recorrer la Q
  for(unsigned int i = 0; i < 2 and it != Q.end(); i++, it++){
    S.push(*it);
  }
  
  //tamanio de Q
  unsigned int n = Q.size();

  //Loop de Graham Scan
  for(unsigned int i = 2; i < n and it != Q.end(); i++, it++){
    Point2D ntt = nextToTop(S);
    Point2D nt = top(S);
    Point2D p = *it;
    while(!leftTurn(ntt, nt, p) and (S.size() > 1)){        //Si no froman un giro a la izquierda y queda mas de un elemento en S
      // printStack(S);
      S.pop();                                              //Saco el tope de S
      ntt = nextToTop(S);                                   //Renuevo los valores y vuelvo a probar
      nt = top(S);
    }
    S.push(p);                                              //Agrego el elemento a S
  }
}
예제 #11
0
static Value DeserializeInternal(const std::string& _str, std::stack<StackDepthType>& depth_stack)
{
	Value v;
	
	std::string str = Trim(_str);
	if (str[0] == '{')
	{
		// Error: Began with a { but doesn't end with one
		if (str[str.length() - 1] != '}')
			return Value();
		
		depth_stack.push(InObject);
		v = DeserializeObj(str, depth_stack);
		if ((v.GetType() == NULLVal) || (depth_stack.top() != InObject))
			return v;
		
		depth_stack.pop();
	}
	else if (str[0] == '[')
	{
		// Error: Began with a [ but doesn't end with one
		if (str[str.length() - 1] != ']')
			return Value();
		
		depth_stack.push(InArray);
		v = DeserializeArray(str, depth_stack);
		if ((v.GetType() == NULLVal) || (depth_stack.top() != InArray))
			return v;
		
		depth_stack.pop();
	}
	else
	{
		// Will never get here unless _str is not valid JSON
		return Value();
	}
	
	return v;
}
 void getPath(std::stack<TreeNode*>& path,TreeNode* root, TreeNode* target){
     TreeNode* prev = nullptr;
     //actually postorder traversal//since I cannot just pop it out need to go back to parent the second time
     while(!path.empty() || root){
         if(root==target){
             path.push(root);
             return;
         }
         if(root){
             path.push(root);
             root = root->left;
         }else if((path.top()->right)==prev){
             prev = path.top();
             path.pop();
         }else{
             root = path.top();
             prev = root;
             root = root->right;
             prev = nullptr;
         }
     }
 }
예제 #13
0
bool Deserializer::StartObject()
{
    // not a root object
    if (!_state.empty())
    {
        if (_state.top()->cpp_type() != google::protobuf::FieldDescriptor::CPPTYPE_MESSAGE)
        {
            _errors.push_back(Trinity::StringFormat("Expected field %s to be a message but got %s instead.", _state.top()->cpp_type_name()));
            return false;
        }

        google::protobuf::Message* containingMessage = _objectState.top();
        if (!_state.top()->is_repeated())
            _objectState.push(containingMessage->GetReflection()->MutableMessage(containingMessage, _state.top()));
        else
            _objectState.push(containingMessage->GetReflection()->AddMessage(containingMessage, _state.top()));
    }
    else if (_objectState.size() != 1)
        return false;

    return true;
}
예제 #14
0
 virtual void operator++() override{
     while (!st.empty()){
         auto i = st.top(); st.pop();
         if (i.second == 1){
             ++i.second; st.push(i);
             if (i.first->left != nullptr){
                 st.push({i.first->left, 1});
             }
         }
         else if (i.second == 2){
             ++i.second; st.push(i);
             if (i.first->right != nullptr){
                 st.push({i.first->right, 1});
             }
         }
         else {
             ptr = i.first;
             return;
         }
     }
    ptr = nullptr;
 }
예제 #15
0
int MyQueue::dequeue(int& val)
{
  if (stackFirst.empty())
    return -1;

  while(!stackFirst.empty())
  {
    stackSecond.push(stackFirst.top());
    stackFirst.pop();
  }
  
  val = stackSecond.top();
  stackSecond.pop();

  while(!stackSecond.empty())
  {
    stackFirst.push(stackSecond.top());
    stackSecond.pop();
  }
  
  return 0;
}
예제 #16
0
void GpuShortestPath::Compute(DX11Engine* engine,
    std::stack<std::pair<int, int>>& path)
{
    // Execute the shaders.
    engine->Execute(mInitializeDiagToRow->GetCShader(), 1, 1, 1);
    for (int i = 0; i < mLogSize; ++i)
    {
        engine->Execute(mPartialSumDiagToRow[i]->GetCShader(), 1, 1, 1);
    }

    engine->Execute(mInitializeDiagToCol->GetCShader(), 1, 1, 1);
    for (int i = 0; i < mLogSize; ++i)
    {
        engine->Execute(mPartialSumDiagToCol[i]->GetCShader(), 1, 1, 1);
    }

    int* segment = mSegment->Get<int>();
    for (int z = 2, numPixels = z - 1; z < mSize; ++z, ++numPixels)
    {
        segment[0] = 1;
        segment[1] = z - 1;
        segment[2] = numPixels;
        engine->Update(mSegment);
        engine->Execute(mUpdate->GetCShader(), 1, 1, 1);
    }

    int const zmax = 2 * (mSize - 1);
    for (int z = mSize, numPixels = zmax - z + 1; z <= zmax; ++z, --numPixels)
    {
        segment[0] = z - (mSize - 1);
        segment[1] = mSize - 1;
        segment[2] = numPixels;
        engine->Update(mSegment);
        engine->Execute(mUpdate->GetCShader(), 1, 1, 1);
    }

    // Read back the path from GPU memory.
    engine->CopyGpuToCpu(mPrevious);
    std::array<int, 2>* location = mPrevious->Get<std::array<int, 2>>();

    // Create the path by starting at (mXSize-1,mYSize-1) and following the
    // previous links.
    int x = mSize - 1, y = mSize - 1;
    while (x != -1 && y != -1)
    {
        path.push(std::make_pair(x, y));
        std::array<int, 2> prev = location[x + mSize*y];
        x = prev[0];
        y = prev[1];
    }
}
예제 #17
0
	void Road(std::stack<Node<T> *> &s, Node<T> *pNode)
	{
		if (NULL != pRoot && NULL != pNode)
			s.push(pRoot);
		
		if (pRoot == pNode)
			return;

		Node<T> *pCur;
		Node<T> *pPreLeft = NULL;
		Node<T> *pPreRight = NULL;
		while (!s.empty())
		{
			pCur = s.top();
			
			while (NULL != pCur->pLeft && pCur->pLeft != pPreLeft)
			{
				s.push(pCur->pLeft);
				pCur = pCur->pLeft;
				if (pCur == pNode)
					return;
			}
			
			if (NULL != pCur->pRight && pCur->pRight != pPreRight)
			{
				s.push(pCur->pRight);
				pPreRight = pCur->pRight;
				if (pPreRight == pNode)
					return;
			}
			else
			{
				if (s.top() != pPreRight)
					pPreLeft = pCur;
				s.pop();
			}
		}
	}
예제 #18
0
inline void readNextMessageFromFile( std::ifstream& p_ifMessages, const std::string& p_strImageFolder )
{
    //ds line buffer
    std::string strLineBuffer;

    //ds read one line
    std::getline( p_ifMessages, strLineBuffer );

    if( strLineBuffer.empty( ) ){ throw CExceptionEndOfFile( "received empty string - file end reached" ); }

    //ds get it to a stringstream
    std::istringstream issLine( strLineBuffer );

    //ds information fields
    double dTimeSeconds;
    std::string strToken;
    std::string strMessageType;

    //ds fetch first part of the message
    issLine >> strToken >> strToken >> dTimeSeconds >> strMessageType;

    //ds get time to seconds
    dTimeSeconds /= 1000000;

    //ds set message information depending on type
    if( "IMU" == strMessageType )
    {
        //ds IMU message
        txt_io::CIMUMessage msgIMU( "/imu", "imu", g_uFrameIDIMU, dTimeSeconds );

        //ds fields
        Eigen::Vector3d vecAngularVelocity;
        CLinearAccelerationIMU vecLinearAcceleration;

        //ds parse the values (order x/z/y) TODO align coordinate systems
        issLine >> strToken >> vecLinearAcceleration[0] >> vecLinearAcceleration[1] >> vecLinearAcceleration[2] >> vecAngularVelocity[0] >> vecAngularVelocity[1] >> vecAngularVelocity[2];

        //ds rotate around X axis by 180 degrees
        vecLinearAcceleration.y( ) = -vecLinearAcceleration.y( );
        vecLinearAcceleration.z( ) = -vecLinearAcceleration.z( );
        vecAngularVelocity.y( )    = -vecAngularVelocity.y( );
        vecAngularVelocity.z( )    = -vecAngularVelocity.z( );

        //ds set message fields
        msgIMU.setAngularVelocity( vecAngularVelocity );
        msgIMU.setLinearAcceleration( vecLinearAcceleration );

        //ds pump it into the synchronizer
        g_vecMessagesIMU.push( msgIMU );
    }
예제 #19
0
/*
  - enter into a directory
  - This is more analogous to following a link than to cd'ing into a directory
    since you're able to leave the directory later (literally return the previous directory).
    Internally a stack is used to implement this.
*/
bool EnterDirectory (const char* directory)
{
    string current_directory;

    if (!GetDirectory(current_directory))
        return false;

    if (chdir(directory) < 0)
        return false;

    directory_stack.push(current_directory);

    return true;
}
예제 #20
0
    void add_new_model()
    {
        printf("add_new_model starts\n");
        std::string name(
            (boost::format("MyBeep_%1%") % m_stacknames.size()).str());

        std::vector<std::string> outputs{"out"}, inputs{};

        createModel(name, inputs, outputs, "gensMyBeep");
        addConnection(name, "out", "counter", "in");

        m_stacknames.push(name);
        printf("add_new_model finished: %s\n", name.c_str());
    }
예제 #21
0
void XHTMLTagHyperlinkAction::doAtStart(XHTMLReader &reader, const char **xmlattributes) {
	const char *href = reader.attributeValue(xmlattributes, "href");
	if (href != 0 && href[0] != '\0') {
		const FBTextKind hyperlinkType = MiscUtil::referenceType(href);
		std::string link = MiscUtil::decodeHtmlURL(href);
		if (hyperlinkType == INTERNAL_HYPERLINK) {
			link = (link[0] == '#') ?
				reader.myReferenceName + link :
				reader.myReferenceDirName + link;
			link = ZLFileUtil::normalizeUnixPath(link);
		}
		myHyperlinkStack.push(hyperlinkType);
		bookReader(reader).addHyperlinkControl(hyperlinkType, link);
	} else {
		myHyperlinkStack.push(REGULAR);
	}
	const char *name = reader.attributeValue(xmlattributes, "name");
	if (name != 0) {
		bookReader(reader).addHyperlinkLabel(
			reader.myReferenceName + "#" + MiscUtil::decodeHtmlURL(name)
		);
	}
}
예제 #22
0
void SumRootToLeafHelper (Node* node, int& TotalSum, std::stack<int>& SubSum)
{
  //keep track of the current sum
  SubSum.push (SubSum.top() + node->val);
  //sum the left first
  if (node->left != 0)
    SumRootToLeaf (node->left);
  if (node->right != 0)
    SumRootToLeaf (node->right);
  //if it is a leaf, sum it up
  if (node->left == 0 && node->right == 0)
    TotalSum += SubSum.top();
  SubSum.pop();
}
예제 #23
0
void BoundaryFillNode::SearchLineNewSeed(std::stack<Point>& stk, const int &xLeft, const int &xRight,const int &y, const Color4B &new_color, const Color4B &boundary_color){
    int xt = xLeft;
    bool findNewSeed = false;
    
    while(xt <= xRight){
        findNewSeed = false;
        while(IsPixelValid(xt, y, new_color, boundary_color) && (xt < xRight)){
            findNewSeed = true;
            xt++;
        }
        if(findNewSeed){
            if(IsPixelValid(xt, y, new_color, boundary_color) && (xt == xRight))
                stk.push(Point(xt, y));
            else
                stk.push(Point(xt - 1, y));
        }
        
        /*向右跳过内部的无效点(处理区间右端有障碍点的情况)*/
        int xspan = SkipInvalidInLine(xt, y, xRight, new_color, boundary_color);
        xt += (xspan == 0) ? 1 : xspan;
        /*处理特殊情况,以退出while(x<=xright)循环*/
    }
}
예제 #24
0
파일: graph.cpp 프로젝트: nukich74/Project
	void dfs(const Vertex &v) {
		TransformEdge trans;
		st.push(v);
		pred_val = true;
		while (!st.empty()) {
			Vertex tvert = st.top();
			
			if (used.find(tvert) != used.end()) {
				out_sort.push_back(tvert);
				st.pop();
			} else {
				in_sort.push_back(tvert);
				used.insert(tvert);  
								
				std::for_each(vset_base.first, vset_base.second, [=, &used, &elist_base, &st, this, &trans] (const Vertex &q){
					if ((used.find(q) ==  used.end()) && std::binary_search(elist_base.first, elist_base.second, trans(tvert, q))) {
						st.push(q); 
					}
				});
								
			}
		}
	}
예제 #25
0
//------------------------------------------------------------------------------
/// Entry point for transformation.  Called by idle.
void transform_hierarchy( void ) {

    articulatedbody.root_link->pose = articulatedbody.pose;
    articulatedbody.root_link->pose.transform = articulatedbody.pose.transform;

    // push the root link's transform
    MatrixStack.push( articulatedbody.root_link->pose.transform );

    // descend the heirarchy and update the poses of all children
    transform_link( articulatedbody.root_link );

    // pop the root link's transform
    MatrixStack.pop();
}
예제 #26
0
/*----------------------------------------------------------------------------------------------------------------------
|	
*/
inline void effective_postorder_edge_iterator::BuildStackFromNodeAndSiblings(TreeNode * curr, const TreeNode * nodeToSkip)
	{
	// Handle case in which curr equals nodeToSkip
	if (nodeToSkip != NULL && curr == nodeToSkip)
		curr = curr->GetRightSib();
	if (curr == NULL)
		return;

	// Create a temporary stack of nodes to remember
	std::stack<TreeNode *> ndStack;

	// Visit all nodes in the subtree extending up from curr's parent (with the exception 
	// of the subtree whose root is nodeToSkip)
	for (;;)
		{
		TreeNode * par = curr->GetParent();
		if ((!isValidChecker.empty()) && isValidChecker(curr, par))
			{
			// edge was valid:
			//   - let curr be curr's next sibling
			curr = curr->GetRightSib();
			if (nodeToSkip != NULL && curr == nodeToSkip)
				curr = curr->GetRightSib();
			}
		else
			{
			// edge was not valid:
			//   - push edge onto edge stack
			//   - if curr has a sibling, push that sibling onto ndStack (i.e. remember it so we can deal with it later)
			//   - let curr be curr's left child
			edgeStack.push(EdgeEndpoints(curr, par));
			TreeNode * r = curr->GetRightSib();
			if (r != NULL && r == nodeToSkip)
				r = r->GetRightSib();
			if (r != NULL)
				ndStack.push(r);
			curr = curr->GetLeftChild();
			}

		if (curr == NULL)
			{
			// we've come to the end of the road for this subtree
			// let curr be node on top of ndStack
			if (ndStack.empty())
				break;
			curr = ndStack.top();
			ndStack.pop();
			}
		}
	}
예제 #27
0
bool adjacent (std::vector<int>& edges, std::stack<int>& stacky, std::stack<int>& history, std::stack<int>& previouses,  int current, int previous){
    //std::cout<<"adjacent"<<std::endl;
    //std::cout<<"current: "<<current<<" previous: "<<previous<<std::endl;
    std::vector<int>::iterator ed_it;
    bool flag = false;
    for (int i=0; i<(int)edges.size(); i++){
        if (edges[i]==current){
            if (i%2==0 and edges[i+1]!=previous){
                //std::cout<<i<<": ";
                //std::cout<<edges[i-1]<<" "<<edges[i]<<" '"<<edges[i+1]<<"'"<<std::endl;
                if (flag){
                    history.push(-1);
                    previouses.push(current);
                } 
                stacky.push(edges[i+1]);
                history.push(edges[i+1]);
                previouses.push(current);
                flag = true;
            }
            else if (i%2==1 and edges[i-1]!=previous){
                //std::cout<<i<<": ";
                //std::cout<<"'"<<edges[i-1]<<"' "<<edges[i]<<" "<<edges[i+1]<<std::endl;
                if (flag){
                    history.push(-1);
                    previouses.push(current);
                } 
                stacky.push(edges[i-1]);
                history.push(edges[i-1]);
                previouses.push(current);
                flag = true;
                //std::cout<<edges[i-1]<<" ";
            }
        }
    }
    //std::cout<<std::endl;
    return flag;
}
예제 #28
0
 virtual void operator++() override{
     while (p != nullptr){
         st.push(p);
         p = p->left;
     }
     if (st.empty()){
         ptr = nullptr;
         return;
     }
     else {
         p = st.top(); st.pop();
         ptr = p;
         p = p->right;
     }
 }
static void ImageStackMakeBranch(std::stack<NonogramImage> & imageStack) {
    if (imageStack.empty()) {
        return;
    }
    NonogramImage image = imageStack.top();
    int firstUndetermined = FindFirstUndetermined(image);
    
    if (firstUndetermined == -1) {
        // no branch, remove
        imageStack.pop();
        return;
    }
    
    // make two new branch
    NonogramImage image2 = image;
    image.array[firstUndetermined] = NONOGRAM_IMAGE_CONST_SELECTED;
    image2.array[firstUndetermined] = NONOGRAM_IMAGE_CONST_UNSELECTED;
    
    imageStack.pop(); // remove old
    imageStack.push(image2);
    imageStack.push(image);
    
    return;
}
예제 #30
0
파일: parser.c 프로젝트: suborb/reelvdr
static void XMLCALL StartHandler(void *data, const char *el, const char **attr)
{
  XmlNode node;

  strn0cpy(node.nodename, el, sizeof(node.nodename));
  node.depth = depth;
  nodestack.push(node);

  if (!strncmp(el, "item", 4)) {
     cItem *tmpitem = new cItem;
     item = tmpitem;
     item->Clear();
     }
  depth++;
}