本文整理汇总了C++中Dynamic::Next方法的典型用法代码示例。如果您正苦于以下问题:C++ Dynamic::Next方法的具体用法?C++ Dynamic::Next怎么用?C++ Dynamic::Next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dynamic
的用法示例。
在下文中一共展示了Dynamic::Next方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddDynamic
bool Lex::AddDynamic(Param *p, const char *name, const char *func)
{
Dynamic *d;
d = f_dynamics;
while(d != f_start_dynamics && d != 0) {
if(strcmp(name, d->GetName()) == 0) {
fprintf(stderr, "%s:%ld: error: the dynamic function named \"%s\" is defined twice (first defined at line %ld)\n", f_filename, f_line, name, d->Line());
g_errcnt++;
return false;
}
d = d->Next();
}
d = f_dynamics;
while(d != 0) {
if(strcmp(name, d->GetName()) == 0) {
if(!d->CheckParams(p)) {
fprintf(stderr, "%s:%ld: error: the parameters of the dynamic functions defined on line %ld and the one on line %ld are not compatible\n", f_filename, f_line, f_line, d->Line());
g_errcnt++;
}
else {
d->AddFunc(func);
}
return false;
}
d = d->Next();
}
f_dynamics = new Dynamic(f_dynamics, f_line, p, name);
f_dynamics->AddFunc(func);
return true;
}
示例2: TimedDynamic
void Lex::TimedDynamic(void)
{
Dynamic *d;
d = f_dynamics;
while(d != f_start_dynamics) {
d->SetTimed();
d = d->Next();
}
}
示例3: parse_class
void parse_class(Lex& lex, FILE *h, FILE *cpp)
{
int t, l, brackets;
const char *s, *e;
do {
t = lex.GetToken();
lex.Write(h);
} while(isspace(t) || t == '\n');
if(t != Lex::IDENTIFIER) {
// is it possible that we don't have an identifier after the keyword class?!
fprintf(stderr, "%s:%ld: error: expected an identifier after the 'class' keyword\n", lex.Filename(), lex.Line());
g_errcnt++;
return;
}
// we got the class name!
s = lex.GetStart();
e = lex.GetEnd();
l = static_cast<int>(e - s);
char* class_name = new char[l + 1];
str_keeper sk(class_name);
memcpy(class_name, s, l);
class_name[l] = '\0';
brackets = 0;
for(;;) {
t = lex.GetToken();
if(t == '\0') {
// that's a big problem in the source file!
return;
}
if(t == ';') {
if(brackets == 0) {
// in this special case, we don't have a full declaration
// i.e.: class Stuff;
lex.Write(h);
return;
}
}
else if(t == '{') {
brackets++;
}
else if(t == '}') {
if(brackets == 0) {
fprintf(stderr, "%s:%ld: error: could not find { in a class definition\n", lex.Filename(), lex.Line());
g_errcnt++;
}
else {
brackets--;
}
if(brackets == 0) {
break;
}
}
else if(t == Lex::IDENTIFIER) {
s = lex.GetStart();
e = lex.GetEnd();
if(e - s == 5 && memcmp(s, "class", 5) == 0) {
// warning: this is a recursive call...
lex.Write(h);
parse_class(lex, h, cpp);
}
else if(e - s == 5 && memcmp(s, "async", 5) == 0) {
// we found an asynchroneous function
convert_async(lex, class_name, h, cpp);
continue;
}
}
lex.Write(h);
}
// once a class is being closed, we need to put the dynamic
// functions if any were defined
Dynamic *d = lex.GetDynamic();
if(d != 0) {
fprintf(h, "public:\n");
while(d != 0) {
d->Output(lex, h, cpp, class_name);
d = d->Next();
}
}
lex.ClearDynamic();
// we don't expect the lexical input to be messed up by
// the Dynamic::Output() calls...
lex.Write(h);
}