void UniqueptrResetReleaseCheck::registerMatchers(MatchFinder *Finder) {
  // Only register the matchers for C++11; the functionality currently does not
  // provide any benefit to other languages, despite being benign.
  if (!getLangOpts().CPlusPlus11)
    return;

  Finder->addMatcher(
      cxxMemberCallExpr(
          on(expr().bind("left")), callee(memberExpr().bind("reset_member")),
          callee(
              cxxMethodDecl(hasName("reset"),
                            ofClass(cxxRecordDecl(hasName("::std::unique_ptr"),
                                                  decl().bind("left_class"))))),
          has(ignoringParenImpCasts(cxxMemberCallExpr(
              on(expr().bind("right")),
              callee(memberExpr().bind("release_member")),
              callee(cxxMethodDecl(
                  hasName("release"),
                  ofClass(cxxRecordDecl(hasName("::std::unique_ptr"),
                                        decl().bind("right_class")))))))))
          .bind("reset_call"),
      this);
}
Ejemplo n.º 2
0
void manage_declarators(enum declarator_actions action, char *identifier, char *declarator, char *input_buffer) {
	static declarator_types last, current;

	if (action == DECL)
		current = decl(identifer, declaractor, input_buffer);
	else if (action == DIR_DECL)
		current = dir_decl(identifer, declaractor, input_buffer);
	else
		error("manage_declarators", "bad action.");

	if (type_check_declarators(current, last))
		last = current;
	else
		error("manage_declarators", "attempting to declare an illegal type.");
}
Ejemplo n.º 3
0
void
TaskListPanel::OnDeclareClicked()
{
  if (!(*active_task)->CheckTask()) {
    const AbstractTaskFactory::TaskValidationErrorVector errors =
      (*active_task)->GetFactory().getValidationErrors();
    MessageBoxX(getTaskValidationErrors(errors), _("Declare task"),
                MB_ICONEXCLAMATION);
    return;
  }

  Declaration decl(*active_task);
  Profile::GetDeclarationConfig(decl, CommonInterface::GetComputerSettings().plane);
  ExternalLogger::Declare(decl, way_points.GetHome());
}
Ejemplo n.º 4
0
// Parse a module.
//
//    module -> decl-seq | <empty>
//
//    decl-seq -> decl | decl-seq
//
// TODO: Return an empty module.
Decl*
Parser::module()
{
  Decl_seq decls;
  while (!ts_.eof()) {
    try {
      Decl* d = decl();
      decls.push_back(d);
    } catch (Translation_error& err) {
      diagnose(err);
      consume_thru(term_);
    }
  }
  return on_module(decls);
}
Ejemplo n.º 5
0
inline void
TaskActionsPanel::OnDeclareClicked()
{
  if (!(*active_task)->CheckTask()) {
    const auto errors =
      (*active_task)->GetFactory().GetValidationErrors();
    ShowMessageBox(getTaskValidationErrors(errors), _("Declare task"),
                MB_ICONEXCLAMATION);
    return;
  }

  const ComputerSettings &settings = CommonInterface::GetComputerSettings();
  Declaration decl(settings.logger, settings.plane, *active_task);
  ExternalLogger::Declare(decl, way_points.GetHome());
}
Ejemplo n.º 6
0
Archivo: emit.c Proyecto: a8m/c
static void
stmt(Node *n)
{
	switch(n->t){
	case NDECL:
		decl(n);
		out(".text\n");
		break;
	case NRETURN:
		ereturn(n);
		break;
	case NIF:
		eif(n);
		break;
	case NWHILE:
		ewhile(n);
		break;
	case NFOR:
		efor(n);
		break;
	case NDOWHILE:
		dowhile(n);
		break;
	case NBLOCK:
		block(n);
		break;
	case NSWITCH:
		eswitch(n);
		break;
	case NGOTO:
		outi("jmp %s\n", n->Goto.l);
		break;
	case NCASE:
		out("%s:\n", n->Case.l);
		stmt(n->Case.stmt);
		break;
	case NLABELED:
		out("%s:\n", n->Labeled.l);
		stmt(n->Labeled.stmt);
		break;
	case NEXPRSTMT:
		if(n->ExprStmt.expr)
			expr(n->ExprStmt.expr);
		break;
	default:
		errorf("unimplemented emit stmt %d\n", n->t);
	}	
}
void StringReferenceMemberCheck::registerMatchers(
    ast_matchers::MatchFinder *Finder) {
  // Look for const references to std::string or ::string.
  auto String = anyOf(recordDecl(hasName("::std::basic_string")),
                      recordDecl(hasName("::string")));
  auto ConstString = qualType(isConstQualified(), hasDeclaration(String));

  // Ignore members in template instantiations.
  auto InTemplateInstantiation = hasAncestor(
      decl(anyOf(recordDecl(ast_matchers::isTemplateInstantiation()),
                 functionDecl(ast_matchers::isTemplateInstantiation()))));

  Finder->addMatcher(fieldDecl(hasType(references(ConstString)),
                               unless(InTemplateInstantiation)).bind("member"),
                     this);
}
Ejemplo n.º 8
0
static void icon_lib_freeze (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0, 0, 0, 0, 0,
		0, 0, 0, 0, 1, 7, 2, 7,13,12, 6,13, 7, 7, 6,14, 2, 6, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 6, 7, 7, 6,14, 6, 6,10, 6, 7, 2,14, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0,10, 6, 7, 5, 1, 2, 2, 2,10,14, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0,10,14, 6,14,10, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		-1 };

	decl( "icon_lib_freeze", IupImage( 23, 23, map ), 
			"ORIGIN", "EdPatt", 
			"0", "BGCOLOR", 
			"1", "153 150 158", 
			"2", "127 062 032", 
			"3", "255 239 239", 
			"4", "241 239 209", 
			"5", "129 139 079", 
			"6", "004 000 000", 
			"7", "187 164 039", 
			"8", "255 255 148", 
			"9", "253 244 188", 
			"10", "017 009 000", 
			"11", "255 255 214", 
			"12", "255 206 008", 
			"13", "255 189 008", 
			"14", "002 006 008", 
			"15", "255 255 222", NULL );
}
Ejemplo n.º 9
0
static void icon_lib_transfer (void)
{
	char map[] = {
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0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0, 0, 0, 1,13,13,13, 1,13,13, 1, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,14,13,13,13,13, 1, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,11, 1, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		-1 };

	decl( "icon_lib_transfer", IupImage( 23, 23, map ), 
			"ORIGIN", "EdPatt", 
			"0", "BGCOLOR", 
			"1", "000 000 000", 
			"2", "020 016 000", 
			"3", "000 000 008", 
			"4", "247 255 247", 
			"5", "204 204 204", 
			"6", "247 247 255", 
			"7", "239 239 247", 
			"8", "247 255 239", 
			"9", "000 000 123", 
			"10", "136 135 175", 
			"11", "000 008 008", 
			"12", "016 004 012", 
			"13", "255 255 000", 
			"14", "008 000 000", 
			"15", "239 247 243", NULL );
}
Ejemplo n.º 10
0
boost::optional<VariableDecl> Builder::buildVariableDecl(const cst::VariableDecl& vd, SharedScope scope)
{
    if (!vd.value)
    {
        logger_->log(error::Message::uninitializedVariable(vd.name.position, vd.name.value));
        return boost::none;
    }

    boost::optional<Expression> expr = buildExpression(*vd.value, scope);

    if (!expr) return boost::none;

    VariableDecl decl(variableFactory_->createVariable(vd.name, getExpressionType(*expr)), *expr);
    scope->addVariable(decl.var());

    return decl;
}
Ejemplo n.º 11
0
bool CScrobbler::SaveJournal()
{
    CSingleLock lock(m_queueLock);

    if (m_vecSubmissionQueue.size() == 0)
    {
        if (XFILE::CFile::Exists(GetJournalFileName()))
            XFILE::CFile::Delete(GetJournalFileName());
        return true;
    }
    CStdString        strJournalVersion;
    CXBMCTinyXML      xmlDoc;
    TiXmlDeclaration  decl("1.0", "utf-8", "yes");
    TiXmlElement      xmlRootElement("asjournal");
    xmlDoc.InsertEndChild(decl);
    strJournalVersion.Format("%d", SCROBBLER_JOURNAL_VERSION);
    xmlRootElement.SetAttribute("version", strJournalVersion.c_str());
    TiXmlNode *pRoot = xmlDoc.InsertEndChild(xmlRootElement);
    if (!pRoot)
        return false;

    int i = 0;
    SCROBBLERJOURNALITERATOR it = m_vecSubmissionQueue.begin();
    for (; it != m_vecSubmissionQueue.end(); it++, i++)
    {
        TiXmlElement entryNode("entry");
        TiXmlNode *pNode = pRoot->InsertEndChild(entryNode);
        if (!pNode)
            return false;
        XMLUtils::SetString(pNode, "artist", it->strArtist);
        XMLUtils::SetString(pNode, "album", it->strAlbum);
        XMLUtils::SetString(pNode, "title", it->strTitle);
        XMLUtils::SetString(pNode, "length", it->strLength);
        XMLUtils::SetString(pNode, "starttime", it->strStartTime);
        XMLUtils::SetString(pNode, "musicbrainzid", it->strMusicBrainzID);
        XMLUtils::SetString(pNode, "tracknum", it->strTrackNum);
        XMLUtils::SetString(pNode, "source", it->strSource);
        XMLUtils::SetString(pNode, "rating", it->strRating);
    }
    lock.Leave();

    CStdString FileName = GetJournalFileName();
    CLog::Log(LOGDEBUG, "%s: Journal with %d entries saved to %s",
              m_strLogPrefix.c_str(), i, FileName.c_str());
    return xmlDoc.SaveFile(FileName);
}
Ejemplo n.º 12
0
void
Logger::guiStartLogger(const NMEA_INFO& gps_info,
                    const SETTINGS_COMPUTER& settings,
                       const ProtectedTaskManager &protected_task_manager,
                    bool noAsk)
{
  if (isLoggerActive() || gps_info.gps.Replay)
    return;

  OrderedTask* task = protected_task_manager.task_clone();
  Declaration decl(task);
  Profile::GetDeclarationConfig(decl, settings.plane);

  if (task) {
    delete task;

    if (!noAsk) {
      TCHAR TaskMessage[1024];
      _tcscpy(TaskMessage, _T("Start Logger With Declaration\r\n"));
      
      if (decl.size()) {
        for (unsigned i = 0; i< decl.size(); ++i) {
          _tcscat(TaskMessage, decl.get_name(i));
          _tcscat(TaskMessage, _T("\r\n"));
        }
      } else {
        _tcscat(TaskMessage, _T("None"));
      }
      
      if (MessageBoxX(TaskMessage, _("Start Logger"),
                      MB_YESNO | MB_ICONQUESTION) != IDYES)
        return;
    }
  }

  if (!LoggerClearFreeSpace(gps_info)) {
    MessageBoxX(_("Logger inactive, insufficient storage!"),
                _("Logger Error"), MB_OK| MB_ICONERROR);
    LogStartUp(_T("Logger not started: Insufficient Storage"));
    return;
  }

  Poco::ScopedRWLock protect(lock, true);
  _logger.StartLogger(gps_info, settings, strAssetNumber, decl);
}
Ejemplo n.º 13
0
/*--------------------------------------------------------------------
  PARSING AND BUILDING PARSE TREE
---------------------------------------------------------------------*/
struct programNode* program()
{	
	struct programNode* prog;

	prog = make_programNode();
	ttype = getToken();
	if (ttype == VAR)
	{	
		ungetToken();  
		prog->decl = decl();
		prog->body = body();
		return prog;
	} 
	else
	{	
		return NULL;
	}
}
Ejemplo n.º 14
0
// primary: identifier
//          identifier '=' expr
//          identifier ':' expr
//          '\' identifier '.' expr
//          '(' expr ')'
//
// TODO: Factor definitions and declarations into a
// top-level parse. They should most definitely not
// be primaries.
Expr const*
Parser::primary()
{
    if (lookahead() == identifier_tok) {
        if (lookahead(1) == equal_tok)
            return def();
        else if (lookahead(1) == colon_tok)
            return decl();
        else
            return id();
    }
    if (lookahead() == backslash_tok)
        return abs();
    if (lookahead() == lparen_tok)
        return paren();
    error(ts_.location(), "expected primary-expression");
    throw Parse_error();
}
Ejemplo n.º 15
0
bool CGUIControlProfiler::SaveResults(void)
{
  if (m_strOutputFile.IsEmpty())
    return false;

  CXBMCTinyXML doc;
  TiXmlDeclaration decl("1.0", "", "yes");
  doc.InsertEndChild(decl);

  TiXmlElement *root = new TiXmlElement("guicontrolprofiler");
  CStdString str;
  str.Format("%d", m_iFrameCount);
  root->SetAttribute("framecount", str.c_str());
  root->SetAttribute("timeunit", "ms");
  doc.LinkEndChild(root);

  m_ItemHead.SaveToXML(root);
  return doc.SaveFile(m_strOutputFile);
}
Ejemplo n.º 16
0
void more_stmts(syn_state *ss) {


    switch (ss->cur_token) {
        case DBLTYPE: case INTTYPE:
            decl(ss);
            break;
        case IDENT: case LPAREN: case MINUS: case MINUSMINUS: 
        case NOT: case NUMLIT: case PLUS: case PLUSPLUS: case TILDA:
            stmt(ss);
            break;
        case EOFT:
            return;
        default:
            ss->error_count++;
            print_error(ss, "expected a statement or declaration");
            break;
    }

    if (ss->cur_token != SEMI) {
        ss->error_count++;
        print_error(ss, "expected a semicolon");
        while (ss->cur_token != SEMI) {
            next_token(ss);
            if (ss->cur_token == EOFT) return;
        }
    }

    next_token(ss);

    switch (ss->cur_token) {
        case DBLTYPE: case EOFT: case IDENT: case INTTYPE: case LPAREN: 
        case MINUS: case MINUSMINUS: case NOT: case NUMLIT: case PLUS: 
        case PLUSPLUS: case TILDA:
            more_stmts(ss);
            break;
        default:
            ss->error_count++;
            print_error(ss, "expected a statement or declaration");
            break;
    }
}
Ejemplo n.º 17
0
static INLINE std::string DeclAttributeVar( const std::string& name,
	const std::string& type, const int32_t location = -1 )
{
#ifdef G_USE_GL_CORE
	std::string decl( "in " + type + " " + name + ";" );

#	ifdef __linux__
	UNUSED( location );
#	else
	if ( location != -1 )
	{
		decl = "layout( location = " + std::to_string( location ) + " ) " + decl;
	}
#	endif // __linux__
	return decl;
#else
	UNUSED( location );
	return "attribute " + type + " " + name + ";";
#endif // G_USE_GL_COREf
}
double az(int d_,float h_,float lat_,float long_)    //azimuth of the sun in degree
{
	double x,y,t;
	x=tan(decl(d_,h_))*cos(lat_*pi/180)-sin(lat_*pi/180)*cos(hra(d_, h_, long_));	
	y=-sin(hra(d_,h_,long_));
	t=atan(y/x)*(180/pi);
	if (x<0&&y>0)          //位于第二象限
	{
		t=180+t;		
	}
	else if (x<0&&y<0)       //位于第三象限
	{
		t=180+t;
	}
	else if (x>0&&y<0)       //位于第四象限
	{
		t=360+t;		
	}
	return t;
}
Ejemplo n.º 19
0
void XmlParser::generateXmlFile( RadioRepresentation& radio, std::string filename)
{
    try{
        Document doc(filename);

        //Create a declaration and insert it
        Declaration decl("1.0", "utf-8", "yes");
        doc.InsertEndChild(decl);

        //Create the root softwareradio node and insert it
        Element softRad = writeSoftwareRadio(radio);
        doc.InsertEndChild(softRad);

        doc.SaveFile();
    }
    catch( Exception& ex )
    {
        LOG(LERROR) << ex.what();
    }
}
Ejemplo n.º 20
0
// }}}
// {{{ decls
std::unique_ptr<Unit> FlowParser::unit()
{
	auto unit = std::make_unique<Unit>();

	scoped (unit) {
        importRuntime();

		while (token() == FlowToken::Import) {
			if (!importDecl(unit.get())) {
				return nullptr;
            }
        }

		while (std::unique_ptr<Symbol> symbol = decl()) {
			scope()->appendSymbol(std::move(symbol));
        }
	}

	return unit;
}
Ejemplo n.º 21
0
static void icon_lib_connect (void)
{
	char map[] = {
		6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
		6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
		6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
		6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
		6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 7, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
		6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 7, 7, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6,
		6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 4, 4, 4, 3, 0, 6, 6, 6, 6, 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6, 0, 0, 0, 6,
		6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 4, 4, 4, 3, 0, 6, 6, 6, 6, 6, 6, 6,
		6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 3, 3, 3, 3, 0, 6, 6, 6, 6, 6, 6, 6,
		6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6,
		6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
		6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
		6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
		-1 };

	decl( "icon_lib_connect", IupImage( 26, 26, map ), 
			"0", "0 0 0", 
			"1", "0 0 255", 
			"2", "0 255 0", 
			"3", "128 128 128", 
			"4", "192 192 192", 
			"5", "255 0 0", 
			"7", "255 255 255", 
			"6", "BGCOLOR", NULL );
}
void UpgradeDurationConversionsCheck::check(
    const MatchFinder::MatchResult &Result) {
  const llvm::StringRef Message =
      "implicit conversion to 'int64_t' is deprecated in this context; use an "
      "explicit cast instead";

  const auto *ArgExpr = Result.Nodes.getNodeAs<Expr>("arg");
  SourceLocation Loc = ArgExpr->getBeginLoc();

  if (!match(isInTemplateInstantiation(), *ArgExpr, *Result.Context).empty()) {
    if (MatchedTemplateLocations.count(Loc.getRawEncoding()) == 0) {
      // For each location matched in a template instantiation, we check if the
      // location can also be found in `MatchedTemplateLocations`. If it is not
      // found, that means the expression did not create a match without the
      // instantiation and depends on template parameters. A manual fix is
      // probably required so we provide only a warning.
      diag(Loc, Message);
    }
    return;
  }

  // We gather source locations from template matches not in template
  // instantiations for future matches.
  internal::Matcher<Stmt> IsInsideTemplate =
      hasAncestor(decl(anyOf(classTemplateDecl(), functionTemplateDecl())));
  if (!match(IsInsideTemplate, *ArgExpr, *Result.Context).empty())
    MatchedTemplateLocations.insert(Loc.getRawEncoding());

  DiagnosticBuilder Diag = diag(Loc, Message);
  CharSourceRange SourceRange = Lexer::makeFileCharRange(
      CharSourceRange::getTokenRange(ArgExpr->getSourceRange()),
      *Result.SourceManager, Result.Context->getLangOpts());
  if (SourceRange.isInvalid())
    // An invalid source range likely means we are inside a macro body. A manual
    // fix is likely needed so we do not create a fix-it hint.
    return;

  Diag << FixItHint::CreateInsertion(SourceRange.getBegin(),
                                     "static_cast<int64_t>(")
       << FixItHint::CreateInsertion(SourceRange.getEnd(), ")");
}
Ejemplo n.º 23
0
//----------------------------------------------------------------------------------
static bool Initialise()
{
	if (!Device::Initialise()) { return false; }

	static const VertexAttribute attrs[] =
	{
		VertexAttribute("Position", GL_FLOAT, 3, offsetof(Vertex, position)),
		VertexAttribute("TexCoord0", GL_FLOAT, 2, offsetof(Vertex, textureCoord))
	};

	static const Vertex vertices[] =
	{
		{ glm::vec3(-0.75f,  0.75f, 0.0f), glm::vec2(0.0f, 1.0f) },
		{ glm::vec3(-0.75f, -0.75f, 0.0f), glm::vec2(0.0f, 0.0f) },
		{ glm::vec3( 0.75f, -0.75f, 0.0f), glm::vec2(1.0f, 0.0f) },
		{ glm::vec3( 0.75f,  0.75f, 0.0f), glm::vec2(1.0f, 1.0f) }
	};

	static const unsigned short indices[] = { 0, 1, 2, 2, 3, 0 };

	// Create a vertex array of 1 buffer of 3 vertices of 2 attributes...
	boost::shared_ptr<VertexBuffer> vb = CreateVertexBuffer(sizeof(vertices), GL_STATIC_DRAW);
	vb->Enable();
	vb->SetData(vertices, sizeof(vertices), 0);
	VertexBuffer::Disable();

	VertexDeclarationPtr decl(new VertexDeclaration(sizeof(Vertex), vb, attrs, 2));
	renderState.vertexArray = boost::make_shared<VertexArray>(&decl, 1);

	renderState.indexBuffer = CreateIndexBuffer(sizeof(indices), GL_UNSIGNED_SHORT, GL_STATIC_DRAW);
	renderState.indexBuffer->Enable();
	renderState.indexBuffer->SetData(indices, sizeof(indices), 0);
	renderState.indexBuffer->Disable();

	renderState.shader = boost::make_shared<Shader>("shaders/bricks");
	if (!renderState.shader->Build()) { return false; }

	oldKeyState = Keyboard::GetState();

	return true;
}
Ejemplo n.º 24
0
void program(syn_state *ss) {

    switch (ss->cur_token) {
        case DBLTYPE: case INTTYPE: 
            decl(ss);
            break;
        case IDENT: case LPAREN: case MINUS: case MINUSMINUS: case NOT: 
        case NUMLIT: case PLUS: case PLUSPLUS: case TILDA:
            stmt(ss);
            break;
        default:
            ss->error_count++;
            print_error(ss, "expected a statement or declaration");
            break;
    }

    if (ss->cur_token == SEMI) {
        next_token(ss);
    }
    else {
        ss->error_count++;
        print_error(ss, "expected a semicolon");
    }

    switch (ss->cur_token) {
        case DBLTYPE: case INTTYPE: case IDENT: case LPAREN: case MINUS: 
        case MINUSMINUS: case NOT: case NUMLIT: case PLUS: case PLUSPLUS: 
        case TILDA: case EOFT:
            more_stmts(ss);
            break;
        default:
            ss->error_count++;
            print_error(ss, "expected a statement or declaration");
            break;
    }

    if (ss->cur_token != EOFT) {
        ss->error_count++;
        print_error(ss, "expected end of file");
    }
}
Ejemplo n.º 25
0
Archivo: decl.c Proyecto: berkus/lang-e
void program() {
     int n;
	
     level = GLOBAL;
     for (n = 0; t != EOI; n++)
	  if (kind[t] == CHAR || kind[t] == STATIC
	      || t == ID || t == '*' || t == '(') {
	       decl(dclglobal,NULL);
	       deallocate(STMT);
	       if (!(glevel >= 3 || xref))
		    deallocate(FUNC);
	  } else if (t == ';') {
	       warning("empty declaration\n");
	       t = gettok();
	  } else {
	       error("unrecognized declaration\n");
	       t = gettok();
	  }
     if (n == 0 && !eval.tCompiling)
	  warning("empty input file\n");
}
Ejemplo n.º 26
0
Archivo: parse.c Proyecto: xtao/c
void 
parse()
{
	int i;
	Sym *sym;

	switchdepth = 0;
	brkdepth = 0;
	contdepth = 0;
	nscopes = 0;
	tentativesyms = vec();
	pushscope();
	next();
	next();
	while(tok->k != TOKEOF)
		decl();
	for(i = 0; i < tentativesyms->len; i++) {
		sym = vecget(tentativesyms, i);
		emitsym(sym);
	}
}
Ejemplo n.º 27
0
void XmlParser::generateXmlString( RadioRepresentation &radio, std::string &xml)
{
    try{
        Document doc;

        //Create a declaration and insert it
        Declaration decl("1.0", "utf-8", "yes");
        doc.InsertEndChild(decl);

        //Create the root softwareradio node and insert it
        Element softRad = writeSoftwareRadio(radio);
        doc.InsertEndChild(softRad);

        stringstream ss;
        ss << doc;
        xml = ss.str();
    }
    catch( Exception& ex )
    {
        LOG(LERROR) << ex.what();
    }
}
Ejemplo n.º 28
0
static void icon_lib_paste (void)
{
	char map[] = {
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 4, 4, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 1, 3, 2, 3, 1, 4, 1, 1, 4, 1, 2, 3, 2, 1, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 1, 2, 3, 1, 3, 3, 3, 3, 3, 3, 1, 2, 3, 1, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 1, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 3, 2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( 23, 23, map ), 
			"ORIGIN", "EdPatt", 
			"0", "BGCOLOR", 
			"1", "000 000 000", 
			"2", "132 132 000", 
			"3", "206 206 206", 
			"4", "255 255 000", 
			"5", "000 000 132", 
			"6", "255 255 255", NULL );
}
Ejemplo n.º 29
0
static void icon_lib_help (void)
{
	char map[] = {
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 1, 2, 2, 2, 4, 2, 2, 2, 4, 2, 2, 2, 1, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 1, 2, 4, 2, 2, 2, 4, 2, 2, 2, 4, 2, 1, 3, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 1, 2, 2, 2, 6, 5, 5, 5, 5, 6, 2, 2, 1, 3, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 1, 2, 4, 2, 5, 5, 4, 6, 5, 5, 4, 2, 1, 3, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 1, 2, 2, 2, 5, 3, 2, 2, 5, 5, 2, 2, 1, 3, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 1, 2, 4, 2, 2, 2, 4, 3, 5, 3, 4, 2, 1, 3, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 1, 2, 2, 2, 4, 2, 3, 5, 6, 2, 2, 2, 1, 3, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 1, 2, 4, 2, 2, 2, 5, 3, 2, 2, 4, 2, 1, 3, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 1, 2, 2, 2, 4, 2, 2, 2, 4, 2, 2, 2, 1, 3, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 1, 2, 4, 2, 2, 2, 5, 5, 2, 2, 4, 2, 1, 3, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 1, 2, 2, 2, 4, 2, 4, 2, 4, 2, 2, 2, 1, 3, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 3, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 1, 4, 1, 3, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		-1 };

	decl( "icon_lib_help", IupImage( 23, 23, map ), 
			"ORIGIN", "EdPatt", 
			"0", "BGCOLOR", 
			"1", "074 074 074", 
			"2", "255 255 255", 
			"3", "165 165 165", 
			"4", "255 255 074", 
			"5", "074 074 165", 
			"6", "214 214 214", NULL );
}
Ejemplo n.º 30
0
static void icon_lib_preview (void)
{
	char map[] = {
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0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0, 0, 0, 0,
		0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0, 1, 1, 1, 0, 0, 0,
		0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		-1 };

	decl( "icon_lib_preview", IupImage( 23, 23, map ), 
			"ORIGIN", "EdPatt", 
			"0", "BGCOLOR", 
			"1", "074 074 074", 
			"2", "255 255 255", 
			"3", "165 165 165", 
			"4", "214 214 214", 
			"5", "074 255 255", NULL );
}