int main() { auto a = A("Ben"); a.printID(); return 0; }
vector<string> CodeGenerator::statement(vector<Node>::iterator& it) { vector<string> stmtCode; vector<Node>::iterator temp = ++it; if (temp->symbol == "print") { // print id; temp = temp + 2; appendVectors(stmtCode, printID(temp)); it += 3; } else if (temp->symbol == "Expr") { // Expr; appendVectors(stmtCode, expr(it)); ++it; } else if (temp->symbol == "if") { // if ( Expr ) Stmt else Stmt appendVectors(stmtCode, ifElse(it)); } else if (temp->symbol == "while") { // while ( Expr ) Stmt appendVectors(stmtCode, whileStatement(it)); } else if (temp->symbol == "return") { // TODO: return string ret = "ret i32 0\n"; stmtCode.push_back(ret); } else if (temp->symbol == "Block") { appendVectors(stmtCode, block(it)); } return stmtCode; }
int main(int argc, char *argv[]) { struct rlimit thread_limits; int child_pid = fork(); if (child_pid == -1) { // child err(1, "Fork isn't working\n"); } if (child_pid != 0) { // parent int st; waitpid(child_pid, &st, 0); printf ("child has finised with status %d\n", st); } printID(); getrlimit(RLIMIT_NPROC, &thread_limits); printf("Thread limits %lu %lu\n", thread_limits.rlim_cur, thread_limits.rlim_max); return 0; }
void printmethod(methodinfo *m) { char *utf_ptr; u2 paramnum = 1; /* search for return-type in descriptor */ utf_ptr = m->descriptor->text; while (utf_nextu2(&utf_ptr) != ')'); /* create remarks */ fprintf(file, "\n/*\n * Class: "); utf_fprint_printable_ascii(file, m->class->name); fprintf(file, "\n * Method: "); utf_fprint_printable_ascii(file, m->name); fprintf(file, "\n * Signature: "); utf_fprint_printable_ascii(file, m->descriptor); fprintf(file, "\n */\n"); /* create prototype */ fprintf(file, "JNIEXPORT "); printtype(utf_ptr); fprintf(file, " JNICALL Java_"); printID(m->class->name); chain_addlast(ident_chain, m->name); fprintf(file, "_"); printID(m->name); /* ATTENTION: We use a dummy flag here. */ if (m->flags & ACC_NATIVELY_OVERLOADED) printOverloadPart(m->descriptor); fprintf(file, "(JNIEnv *env"); utf_ptr = m->descriptor->text + 1; if (!(m->flags & ACC_STATIC)) { fprintf(file, ", struct "); printID(m->class->name); fprintf(file, "* this"); } else {