Пример #1
0
	void InterfacesBase::add(int index, String name) {
		if (get(index).index() != -1) {
			assert(false); // Note: For debugging purposes, to be removed later
			return;
		}

		Interface _if(index, name);
		interfaces.push(_if);
	}
Пример #2
0
    void readWkt(const PATH& _path, PRIMITIVES& _primitives)
    {
      std::ifstream _if(_path);
      std::string _line;
      typedef typename PRIMITIVES::value_type primitive_type;
      while(std::getline(_if, _line))
      {
        primitive_type _prim;

        boost::geometry::read_wkt(_line,_prim);
        _primitives.push_back(_prim);
      }
    }
Пример #3
0
	void Imm2asm::_translateLine( TokenList& tokenList )
	{
		std::string code;

		SetRegBaseNum(tokenList);		

		if ( tokenList[ 0 ] == "if" )
		{
			code = _if(tokenList);
		}
		else if ( tokenList[ 0 ] == "iffalse" )
		{
			code = _iffalse(tokenList );
		}
		else if ( tokenList[ 0 ] == "goto" )
		{
			code = _goto( tokenList );
		}
		else if ( tokenList[ 0 ] == "Lineno" )
		{
			code = "mov d0, " + tokenList[ 1 ];
			m_bNewStmt = true;
		}
		else if ( tokenList[ 0 ] == "Label" )
		{
			m_label = combinationToInt( tokenList[ 1 ] );
		}
		else if ( tokenList[ 0 ] == "entry" )
		{
			//code = tokenList[ 0 ] + " " + tokenList[ 1 ];
			m_pCurTable = m_pTables->GetTable( tokenList[ 1 ] );
		}
		else if ( tokenList[ 0 ] == "arg" )
		{
			code = tokenList[ 0 ] + " " + temp2reg( tokenList[ 1 ] );
		}
		else if ( tokenList[ 0 ] == "call" )
		{
			code = tokenList[ 0 ] + " " + itoa( m_entryMap[ tokenList[ 1 ] ] );
		}
		else if ( tokenList[ 0 ] == "halt" )
		{
			code = tokenList[ 0 ];
		}
		else if ( tokenList[ 0 ] == "push" )
		{
			code = tokenList[ 0 ] + " " + tokenList[ 1 ];
		}
		else if ( tokenList[ 0 ] == "pop" )
		{
			code = tokenList[ 0 ] + " " + temp2reg( tokenList[ 1 ] );
		}
		else if ( tokenList[ 0 ] == "mov") 
		{
			code = tokenList[ 0 ] + " " + tokenList[ 1 ] + ", " + tokenList[ 2 ];
		}
		else if ( tokenList[ 0 ] == "read" )
		{
			code = "in " + temp2reg( tokenList[ 1 ] );
		}
		else if ( tokenList[ 0 ] == "write" )
		{
			code = "out " + temp2reg( tokenList[ 1 ] );
		}
		else if ( tokenList.size() >= 3 && tokenList[ 1 ] == "=" )
		{
			code = GenAssign( tokenList );
		}
		else
		{
			//std::cout << "error!!!!!!!!!\n";
			for ( auto iter = tokenList.begin(); iter != tokenList.end(); iter++ )
			{
				code += *iter + " ";
			}
		}

		if ( code != "" )	
		{
			AddToASM(code);
		}
	}