本文整理汇总了C++中rule函数的典型用法代码示例。如果您正苦于以下问题:C++ rule函数的具体用法?C++ rule怎么用?C++ rule使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rule函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TRACER
// 17/04/2003, flight Barcelona-Manchester
// 03/05/2003 Manchester changed
void Inference::Data::destroy ()
{
TRACER ("Inference::Data::destroy");
ASS (this);
ASS (_counter == 0);
switch (rule())
{
case FORALL_AND_MINISCOPE:
case SWAP:
delete static_cast<Type1*>(this);
return;
case FORALL_OR_MINISCOPE:
delete static_cast<ForallOrMiniscope*>(this);
return;
case DUMMY_QUANTIFIER_REMOVAL:
delete static_cast<DummyQuantifierRemoval*>(this);
return;
case FLATTEN:
delete static_cast<Flatten*>(this);
return;
default:
ASS (false);
}
} // Inference::Data::destroy ()
示例2: rule
//=========================================================
bool Parser::Statement () {
PrintRule rule("Statement");
return rule.Accept(
FreeStatement() ||
(DelimitedStatement() && Expect(TokenType::Semicolon))
);
}
示例3: operator
node operator()(token_stream *ts) {
if( ts->end_of_input() ) {
return node();
}
ts_trans tr( ts );
std::vector<node> nodes;
for( rule_t rule : ml_ ) {
node n = rule(ts);
if( n.is_null() ) {
return node();
}
nodes.push_back( n );
}
tr.commit();
return node(nodes, "list");
}
示例4: productionRule
void productionRule(){
if(lookahead==OR){
//printf(" %s", val);
arraylist_add(stringArray,val);
arraylist_add(intArray,lookahead);
//strcpy(list[count],str);
match(OR);
if(lookahead==EOLN){
//printf(" ep");
arraylist_add(stringArray,"Epsilon");
arraylist_add(intArray,7);
//strcpy(list[count],"epsilon");
}
rule(); productionRule();
}
else if(lookahead==SEMI){
arraylist_add(finalString, stringArray);
arraylist_add(finalInt,intArray);
counter++;
stringArray = arraylist_create(objEquals);
intArray = arraylist_create(objEquals);
return;}
else if(lookahead==EOLN) {
return;}
else printf("\nPR");
}
示例5: copyFields
void copyFields(const DeviceArray<PointXYZRGBL>& src, DeviceArray<PointXYZ>& dst)
{
//PointXYZRGBL.x (0) -> PointXYZ.x (0)
//PointXYZRGBL.y (1) -> PointXYZ.y (1)
//PointXYZRGBL.z (2) -> PointXYZ.z (2)
copyFieldsEx(src, dst, rule(cp(0, 0), cp(1, 1), cp(2, 2)));
};
示例6: if
value::Value* Agent::observation(
const devs::ObservationEvent& event) const
{
const std::string port = event.getPortName();
if (port == "KnowledgeBase") {
std::stringstream out;
out << *this;
return new value::String(out.str());
} else if (port == "Activities") {
std::stringstream out;
out << activities();
return new value::String(out.str());
} else if ((port.compare(0, 9, "Activity_") == 0) and port.size() > 9) {
std::string activity(port, 9, std::string::npos);
const Activity& act(activities().get(activity)->second);
std::stringstream out;
out << act.state();
return new value::String(out.str());
} else if ((port.compare(0, 6, "Rules_") == 0) and port.size() > 6) {
std::string rule(port, 6, std::string::npos);
const Rule& ru(rules().get(rule));
return new value::Boolean(ru.isAvailable());
}
return 0;
}
示例7: main
int main(int argc, char *argv[])
{
extern const char* resstr[];
bool res;
if (argc == 2)
{
pushStream(argv[1]);
saveContext();
s_ctx oLocalCtx = {{NULL, 0}, NULL};
/*res = rule(csv, csv);*/
/*res = rule(ini, ini, &oLocalCtx) && readEOF();*/
// res = rule(debug, debug, &oLocalCtx);
printf("%d\n", getPos());
/*res = rule(lisp, s_expression, &oLocalCtx);*/
/*double i = 1;
while (i < 10000000)
{
*/
res = rule(expression, expression, &oLocalCtx);
/*i = i + 1;
}*/
printf("[%s]\n", resstr[getPos() == (int)strlen(argv[1])]);
/*
popStream();
pushStream(argv[2]);
res = rule(debug, debug);
printf("[%s]\n", resstr[getPos() == (int)strlen(argv[2])]);
*/
}
return 0;
}
示例8: rules
static
void
rules(T_PTR_tree entry) {
size_t i, j, k, nbr_rules;
if (entry) {
/* We allocate memory for the transitions */
nbr_rules = tree_nbrsubtrees(entry);
sys->limits.nbr_rules = nbr_rules;
sys->transition = (transition_t *)xmalloc(nbr_rules*sizeof(transition_t));
for (i = 0; i < nbr_rules; i++) {
/* We allocate memory for each gd_cmd of each transition */
sys->transition[i].cmd_for_place = (gd_command_t *)xmalloc(nbr_var*sizeof(gd_command_t));
/* Default, guard = 0,\infty and delta = 0 */
for (j = 0; j < nbr_var; j++) {
ist_assign_values_to_interval(&sys->transition[i].cmd_for_place[j].guard, 0L, INFINITY);
sys->transition[i].cmd_for_place[j].delta = 0L;
/* In the case of places merged the genuine system is the abstraction of itself */
sys->transition[i].cmd_for_place[j].places_abstracted=1;
}
for (k = 0; k < MAXNBTRANS; ++k){
/* We allocate memory for each transfert */
sys->transition[i].transfers[k].origin = (integer16 *)xmalloc(nbr_var*sizeof(integer16));
/* We initialize the origin vector */
for (j = 0; j < nbr_var; j++)
sys->transition[i].transfers[k].origin[j] = 0;
}
}
for (nbrcmd = 0 ; nbrcmd < nbr_rules ; nbrcmd++) {
rule(tree_subtree(entry,nbrcmd));
}
}
}
示例9: rule
void AdBlockIcon::popupBlocked(const QString &ruleString, const QUrl &url)
{
int index = ruleString.lastIndexOf(QLatin1String(" ("));
const QString subscriptionName = ruleString.left(index);
const QString filter = ruleString.mid(index + 2, ruleString.size() - index - 3);
AdBlockSubscription* subscription = AdBlockManager::instance()->subscriptionByName(subscriptionName);
if (filter.isEmpty() || !subscription) {
return;
}
AdBlockRule rule(filter, subscription);
QPair<AdBlockRule, QUrl> pair;
pair.first = rule;
pair.second = url;
m_blockedPopups.append(pair);
//!** FIXME
// mApp->desktopNotifications()->showNotification(QPixmap(":images/images/adblock_big.png"), tr("Blocked popup window"), tr("AdBlock blocked unwanted popup window."));
if (!m_flashTimer) {
m_flashTimer = new QTimer(this);
}
if (m_flashTimer->isActive()) {
stopAnimation();
}
m_flashTimer->setInterval(500);
m_flashTimer->start();
connect(m_flashTimer, SIGNAL(timeout()), this, SLOT(animateIcon()));
}
示例10: Match
int Match(Player p,FONT *font3)
{
BITMAP *end_=0;
FILE *fp=fopen("ending.txt", "r");
if(fp==0)
{
printf("The file didn't open.\n");
return 0;
}
while(!feof(fp))
{
int de=0;
char ch=' ',com=' ',rules[30]=" ",attribute[18]="",condition[18]="";
fscanf(fp,"%s",rules);
if(feof(fp))break;
while(ch!='\n')
{
if(feof(fp))break;
if(ch=='(' && de==0)
{
if(feof(fp))break;
fscanf(fp,"%s %c %s",attribute,&com,condition);
condition[strlen(condition)-1]='\0';
if(Rematch(p,attribute,com,condition)==0)
{
de=1;
}
}
fscanf(fp,"%c",&ch);
}
if(de==0)
{
rule(&end_,rules);
textprintf_ex(screen, font3, 50, 25,makecol(0,0,0), makecol(255,255,255),"You become a %s",rules);
rest(10000);
Write_Story(rules,p.name);
destroy_bitmap(end_);
return 1;
}
}
rule(&end_,"nobody");
textprintf_ex(screen, font3, 50, 25,makecol(0,0,0), makecol(255,255,255),"You become nobody");
Write_Story("nobody",p.name);
rest(10000);
return 1;
}
示例11: copyFields
void copyFields(const DeviceArray<Normal>& src, DeviceArray<PointNormal>& dst)
{
//PointXYZ.normal_x (0) -> PointNormal.normal_x (4)
//PointXYZ.normal_y (1) -> PointNormal.normal_y (5)
//PointXYZ.normal_z (2) -> PointNormal.normal_z (6)
//PointXYZ.curvature (4) -> PointNormal.curvature (8)
copyFieldsEx(src, dst, rule(cp(0, 4), cp(1, 5), cp(2, 6), cp(4,8)));
};
示例12: main
int main() {
while(1) {
system("cls");
MAP();
rule();
}
return 0;
}
示例13: rule
void LabelWidget::setExpandsToFitLines(bool expand)
{
d->vertExpand = expand;
if(expand)
{
rule().setInput(Rule::Height, *d->height);
}
redraw();
}
示例14: qCDebug
void RuleNode::removeOldInputArtifact(Artifact *artifact)
{
if (m_oldInputArtifacts.remove(artifact)) {
qCDebug(lcBuildGraph) << "remove old input" << artifact->filePath()
<< "from rule" << rule()->toString();
m_oldInputArtifacts.insert(nullptr);
}
if (m_oldExplicitlyDependsOn.remove(artifact)) {
qCDebug(lcBuildGraph) << "remove old explicitlyDependsOn" << artifact->filePath()
<< "from rule" << rule()->toString();
m_oldExplicitlyDependsOn.insert(nullptr);
}
if (m_oldAuxiliaryInputs.remove(artifact)) {
qCDebug(lcBuildGraph) << "remove old auxiliaryInput" << artifact->filePath()
<< "from rule" << rule()->toString();
m_oldAuxiliaryInputs.insert(nullptr);
}
}
示例15: rule_list
rule_list()
#endif
{
zzRULE;
zzBLOCK(zztasp1);
zzMake0;
{
if ( (setwd1[LA(1)]&0x8) ) {
rule();
zzaRet.l=zzaArg(zztasp1,1 ).l; zzaRet.r=zzaArg(zztasp1,1 ).r;
{
zzBLOCK(zztasp2);
zzMake0;
{
while ( (setwd1[LA(1)]&0x10) ) {
rule();
{nfa_node *t1;
t1 = new_nfa_node();
(t1)->trans[0]=zzaRet.l;
(t1)->trans[1]=zzaArg(zztasp2,1 ).l;
/* all accept nodes "dead ends" */
zzaRet.l=t1; zzaRet.r=NULL;
}
zzLOOP(zztasp2);
}
zzEXIT(zztasp2);
}
}
}
else {
if ( (setwd1[LA(1)]&0x20) ) {
zzaRet.l = new_nfa_node(); zzaRet.r = NULL;
warning("no regular expressions", zzline);
}
else {zzFAIL(1,zzerr2,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
}
zzEXIT(zztasp1);
return;
fail:
zzEXIT(zztasp1);
zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
zzresynch(setwd1, 0x40);
}
}