Exemplo n.º 1
0
void SParts::dumpODEInfo(int level)
{
	printIndent(level);
	printf("*** %s ***\n", m_name.c_str());

	printIndent(level+1);
	printf("m_odeobj=(0x%0p)\n", m_odeobj);
	if (!m_odeobj) printf("+++++ ERROR! m_odeobj=NULL! +++++\n");

	const dReal *pos = getPosition();
	printIndent(level+1);
	printf("pos=(%f, %f, %f)\n", pos[0], pos[1], pos[2]);

	const dReal *q = getQuaternion();
	printIndent(level+1);
	printf("q=(%f, %f, %f, %f)\n", q[0], q[1], q[2], q[3]);

	ChildC::iterator i;
	for (i=m_children.begin(); i!=m_children.end(); i++) {
		Child *c = *i;
		if (c) {
			SParts *childP = c->nextp;
			if (childP) childP->dumpODEInfo(level+2);
		}
	}
}
Exemplo n.º 2
0
	virtual void serialize(std::stringstream& ss, size_t indentLevel) const
	{	
		ss << "[";
		if (indentLevel > 0)
		{
			ss << "\n";
		}
		else
		{
			printIndent(ss, indentLevel);
		}

		for (size_t i=1; i < data.size(); ++i)
		{
			printIndent(ss, indentLevel+1);
			data[i-1]->serialize(ss, indentLevel+1);
			ss << ",\n";
		}
		if (data.size() > 0)
		{
			printIndent(ss, indentLevel+1);
			data[size() - 1]->serialize(ss, indentLevel+1);
		}

		ss << "\n";
		printIndent(ss, indentLevel);
		ss << "]";
	}
Exemplo n.º 3
0
bool ASTPrintVisitor::visit_while(AST_While* node) {
    stream << "while ";
    node->test->accept(this);
    stream << "\n";

    indent += 4;
    for (int i = 0; i < node->body.size(); i++) {
        printIndent();
        node->body[i]->accept(this);
        stream << "\n";
    }
    indent -= 4;

    if (node->orelse.size()) {
        printIndent();
        stream << "else\n";
        indent += 4;
        for (int i = 0; i < node->orelse.size(); i++) {
            printIndent();
            node->orelse[i]->accept(this);
            stream << "\n";
        }
        indent -= 4;
    }
    return true;
}
Exemplo n.º 4
0
	virtual void serialize(std::stringstream& ss, size_t indentLevel) const
	{
		if (indentLevel > 0)
		{
			ss << "\n";
		}
		printIndent(ss, indentLevel);
		ss << "{\n";
		for (auto i = data.begin(); i < data.end() - 1; ++i)
		{
			printIndent(ss, indentLevel + 1);
			ss << '"' << i->first.asSTLString() << "\" : ";
			i->second->serialize(ss, indentLevel + 1);
			ss << ",\n";
		}
		if (data.size() > 0)
		{
			auto last = data.end() - 1;
			printIndent(ss, indentLevel + 1);
			ss << '"' << last->first.asSTLString() << "\" : ";
			last->second->serialize(ss, indentLevel + 1);
		}
		ss << "\n";
		printIndent(ss, indentLevel);
		ss << "}";
	}
Exemplo n.º 5
0
bool ASTPrintVisitor::visit_tryexcept(AST_TryExcept* node) {
    stream << "try:\n";
    indent += 4;
    for (AST* subnode : node->body) {
        printIndent();
        subnode->accept(this);
        stream << "\n";
    }
    indent -= 4;
    for (AST_ExceptHandler* handler : node->handlers) {
        printIndent();
        handler->accept(this);
    }

    if (node->orelse.size()) {
        printIndent();
        stream << "else:\n";
        indent += 4;
        for (AST* subnode : node->orelse) {
            printIndent();
            subnode->accept(this);
            stream << "\n";
        }
        indent -= 4;
    }
    return true;
}
Exemplo n.º 6
0
bool ASTPrintVisitor::visit_tryfinally(AST_TryFinally* node) {
    if (node->body.size() == 1 && node->body[0]->type == AST_TYPE::TryExcept) {
        node->body[0]->accept(this);
        printIndent();
        stream << "finally:\n";

        indent += 4;
        for (AST* subnode : node->finalbody) {
            printIndent();
            subnode->accept(this);
            stream << "\n";
        }
        indent -= 4;
    } else {
        stream << "try:\n";
        indent += 4;
        for (AST* subnode : node->body) {
            printIndent();
            subnode->accept(this);
            stream << "\n";
        }
        indent -= 4;

        printIndent();
        stream << "finally:\n";
        indent += 4;
        for (AST* subnode : node->finalbody) {
            printIndent();
            subnode->accept(this);
            stream << "\n";
        }
        indent -= 4;
    }
    return true;
}
Exemplo n.º 7
0
bool ASTPrintVisitor::visit_functiondef(AST_FunctionDef* node) {
    for (auto d : node->decorator_list) {
        stream << "@";
        d->accept(this);
        stream << "\n";
        printIndent();
    }

    stream << "def ";
    if (node->name != InternedString())
        stream << node->name.s();
    else
        stream << "<lambda>";
    stream << "(";
    node->args->accept(this);
    stream << ")";

    indent += 4;
    for (int i = 0; i < node->body.size(); i++) {
        stream << "\n";
        printIndent();
        node->body[i]->accept(this);
    }
    indent -= 4;
    return true;
}
Exemplo n.º 8
0
/** Print the alternatives of a @a Term
	@param term The @a Term to print
*/
static void printTerm(Term *term) {
	int i;
	Alternative *alternative;
	for (i = 0; i < listSize(term->rule); i++) {
		alternative = (Alternative *) listIndex(term->rule, i);
		if (listSize(term->rule) != 1)
			printSet("Alternative on", alternative->first);
		if (alternative->flags & ALTERNATIVE_PREFER) {
			printIndent();
			fputs("%prefer\n", printRuleOutput);
		}
		if (alternative->flags & ALTERNATIVE_AVOID) {
			printIndent();
			fputs("%avoid\n", printRuleOutput);
		}
		if (alternative->flags & ALTERNATIVE_IF) {
			printIndent();
			fprintf(printRuleOutput, "%%if %s\n", alternative->expression->text);
		}
		if (alternative->flags & ALTERNATIVE_DEFAULT && listSize(term->rule) != 1) {
			printIndent();
			fputs("%default\n", printRuleOutput);
		}
	
		printAlternative(alternative);
		if (i < listSize(term->rule) - 1) {
			indent--;
			printIndent();
			fputs("|\n", printRuleOutput);
			indent++;
		}
	}
}
Exemplo n.º 9
0
bool ASTPrintVisitor::visit_classdef(AST_ClassDef* node) {
    for (int i = 0, n = node->decorator_list.size(); i < n; i++) {
        stream << "@";
        node->decorator_list[i]->accept(this);
        stream << "\n";
        printIndent();
    }
    stream << "class " << node->name.s() << "(";
    for (int i = 0, n = node->bases.size(); i < n; i++) {
        if (i)
            stream << ", ";
        node->bases[i]->accept(this);
    }
    stream << ")";

    indent += 4;
    for (int i = 0, n = node->body.size(); i < n; i++) {
        stream << "\n";
        printIndent();
        node->body[i]->accept(this);
    }
    indent -= 4;

    return true;
}
Exemplo n.º 10
0
static void printOutAlias(FILE *out,  UConverter *converter, UResourceBundle *parent, Resource r, const char *key, int32_t indent, const char *pname, UErrorCode *status) {
    static const UChar cr[] = { '\n' };
    int32_t len = 0;
    const UChar* thestr = derb_getString(&(parent->fResData), r, &len);
    UChar *string = quotedString(thestr);
    if(trunc && len > truncsize) {
        char msg[128];
        printIndent(out, converter, indent);
        sprintf(msg, "// WARNING: this resource, size %li is truncated to %li\n",
            (long)len, (long)truncsize/2);
        printCString(out, converter, msg, -1);
        len = truncsize;
    }
    if(U_SUCCESS(*status)) {
        static const UChar openStr[] = { 0x003A, 0x0061, 0x006C, 0x0069, 0x0061, 0x0073, 0x0020, 0x007B, 0x0020, 0x0022 }; /* ":alias { \"" */
        static const UChar closeStr[] = { 0x0022, 0x0020, 0x007D, 0x0020 }; /* "\" } " */
        printIndent(out, converter, indent);
        if(key != NULL) {
            printCString(out, converter, key, -1);
        }
        printString(out, converter, openStr, (int32_t)(sizeof(openStr) / sizeof(*openStr)));
        printString(out, converter, string, len);
        printString(out, converter, closeStr, (int32_t)(sizeof(closeStr) / sizeof(*closeStr)));
        if(verbose) {
            printCString(out, converter, " // ALIAS", -1);
        }
        printString(out, converter, cr, (int32_t)(sizeof(cr) / sizeof(*cr)));
    } else {
        reportError(pname, status, "getting binary value");
    }
    uprv_free(string);
}
Exemplo n.º 11
0
OBJ
builtin_include(int numArgs){

	if( numArgs != 1){
		js_error("(include): expects 1 argument", js_nil);
	}
	OBJ arg1 = POP();
	char *fileName;
	FILE *theFile;

	if( !ISSTRING(arg1) ){
		js_error("(include): string arg expected:", arg1);
	}
	fileName = STRINGVAL(arg1);
	theFile = fopen(fileName, "r");
	if( theFile == NULL){
		js_error("(include): cannot open file:", arg1); 	
	}

	OBJ inputStream = newFileStream(theFile);

#ifdef DEBUG
	if( PRINT_INCLUDE->state){
		printIndent(indentLevelForInclude);
	       	fprintf(stdout, "<include file:" YEL " %s" RESET" >\n", fileName);
		indentLevelForInclude++;
	}
	if( CONTINUATION_PASSING->state){
		enterTrampoline1(inputStream);
	} 
	else{
		OBJ expr = js_read(inputStream);
		OBJ result;

		while( expr != js_eof){	
			result = js_eval(globalEnvironment, expr);
			if(PRINT_INCLUDE->state){
				printIndent(indentLevelForInclude);
				js_print(stdout, result,1);
				printf("\n");
			}
			expr = js_read(inputStream);
		}
	}
	if( PRINT_INCLUDE->state){
		indentLevelForInclude--;
		printIndent(indentLevelForInclude);
	       	fprintf(stdout, "<EOF:" YEL " %s" RESET" >\n", fileName);
	}
#else
	enterTrampoline1(inputStream);
#endif
	fclose( inputStream->u.fileStream.file );
	free( inputStream);
	
	return js_void;
}
Exemplo n.º 12
0
void Script_v6::o6_assign(FuncParams &params) {
	uint8 type = peekUint8();
	uint16 var_0, var_4;
	std::string varIndex = readVarIndex(&var_0, &var_4);

	if (var_0 != 0) {
		std::string varIndex2;
		uint16 var_6;

		uint32 savedPos = getPos();

		varIndex2 = readVarIndex(&var_6, 0);

		printIndent();
		print("memcpy(%s, %s, %d);\n", varIndex.c_str(), varIndex2.c_str(), var_6 * 4);

		seek(savedPos);
		skipExpr(99);

		return;
	}

	if (peekUint8() == 98) {
		skip(1);
		uint8 loopCount = readUint8();

		uint32 off = 0;
		for (uint16 i = 0; i < loopCount; i++) {
			uint8 c = readUint8();
			uint16 n = readUint16();

			printIndent();
			print("memset(%s + %d, %d, %d);\n", varIndex.c_str(), off, c, n);

			off += n;
		}
	} else if (peekUint8() == 99) {
		skip(1);
		uint8 loopCount = readUint8();

		for (uint16 i = 0; i < loopCount; i++) {
			std::string expr = readExpr();
			printIndent();
			print("%s[%d] = %s;\n", varIndex.c_str(), (type == 24) ? (i * 2) : i, expr.c_str());
		}
	} else {
		std::string expr = readExpr();

		printIndent();
		print("%s = %s;\n", varIndex.c_str(), expr.c_str());
	}
}
Exemplo n.º 13
0
void space::print() {
  printIndent();
  lprintf("%4s: oops: 0x%-6lx -> 0x%-6lx; used: %ld bytes\n",
         name, objs_bottom, objs_top,
         (char*) objs_top - (char*) objs_bottom);
  printIndent();
  lprintf("     bytes: 0x%-6lx -> 0x%-6lx; used: %ld bytes\n",
         bytes_bottom, bytes_top,
         (char*) bytes_top - (char*) bytes_bottom);
  printIndent();
  lprintf("     total: used: %ld bytes; free: %ld bytes\n",
         used(), bytes_free());
}
Exemplo n.º 14
0
static void printFrames(const WebCore::Frame& frame, const WebCore::Frame* targetFrame, int indent)
{
    if (&frame == targetFrame) {
        printf("--> ");
        printIndent(indent - 1);
    } else
        printIndent(indent);

    WebCore::FrameView* view = frame.view();
    printf("Frame %p %dx%d\n", &frame, view ? view->width() : 0, view ? view->height() : 0);
    printIndent(indent);
    printf("  ownerElement=%p\n", frame.ownerElement());
    printIndent(indent);
    printf("  frameView=%p (needs layout %d)\n", view, view ? view->needsLayout() : false);
    printIndent(indent);
    printf("  renderView=%p\n", view ? view->renderView() : nullptr);
    printIndent(indent);
    printf("  ownerRenderer=%p\n", frame.ownerRenderer());
    printIndent(indent);
    printf("  document=%p (needs style recalc %d)\n", frame.document(), frame.document() ? frame.document()->childNeedsStyleRecalc() : false);
    printIndent(indent);
    printf("  uri=%s\n", frame.document()->documentURI().utf8().data());

    for (WebCore::Frame* child = frame.tree().firstChild(); child; child = child->tree().nextSibling())
        printFrames(*child, targetFrame, indent + 1);
}
Exemplo n.º 15
0
/** Print the parts of an @a Alternative
	@param alternative The @a Alternative to print

	Note: actions are printed only as {...}
*/
static void printAlternative(Alternative *alternative) {
	GrammarPart *grammarPart;
	int i;
	
	for (i = 0; i < listSize(alternative->parts); i++) {
		grammarPart = (GrammarPart *) listIndex(alternative->parts, i);
		printIndent();
		switch (grammarPart->subtype) {
			case PART_ACTION:
				fputs("{...}", printRuleOutput);
				break;
			case PART_TERMINAL:
			case PART_LITERAL:
				fputs(grammarPart->token->text, printRuleOutput);
				break;
			case PART_NONTERMINAL:
			case PART_UNDETERMINED:
				fputs(grammarPart->token->text, printRuleOutput);
				break;
			case PART_TERM:
				fputs("[\n", printRuleOutput);
				/* Only print the sets for repeating terms */
				if (!(grammarPart->uTerm.repeats.subtype == FIXED && grammarPart->uTerm.repeats.number == 1)) {
					printSet("First-set", grammarPart->uTerm.first);
					printSet("Contains-set", grammarPart->uTerm.contains);
					printSet("Follow-set", grammarPart->uTerm.follow);
				}
				indent++;
				if (grammarPart->uTerm.flags & TERM_WHILE) {
					printIndent();
					fprintf(printRuleOutput, "%%while %s\n", grammarPart->uTerm.expression->text);
				}
				if (grammarPart->uTerm.flags & TERM_PERSISTENT) {
					printIndent();
					fputs("%persistent\n", printRuleOutput);
				}
				printTerm(&grammarPart->uTerm);
				indent--;
				printIndent();
				fputc(']', printRuleOutput);
				printRepeats(grammarPart->uTerm.repeats);
				break;
			default:
				PANIC();
		}
		fputc('\n', printRuleOutput);
	}
}
Exemplo n.º 16
0
void ExprFromBool::PrintDebug(int level) {
   printIndent(level);
   if(m_value)
      std::cout << "True";
   else
      std::cout << "False";
}
Exemplo n.º 17
0
void realSlotRef::print() {
  holder->print();
  printIndent();
  lprintf("desc: 0x%lx (", desc);
  desc->name->string_print();
  lprintf(")\n");
}
Exemplo n.º 18
0
void ScopedLogger::indent()
{
    if (m_parent) {
        m_parent->indent();
        printIndent();
    }
}
Exemplo n.º 19
0
void PrintingContext::print (const char *name, dReal x)
{
    printIndent();
    fprintf (file,"%s = ",name);
    printReal (x);
    fprintf (file,",\n");
}
Exemplo n.º 20
0
void
ConfigItem::dump(
	StringBuffer &				buf,
	const char *				name,
	bool						wantExpandedUidNames,
	int							indentLevel) const
{
	int							i;
	int							len;
	char *						escStr;
	StringBuffer				nameBuf;
	UidIdentifierProcessor		uidIdProc;

	if (!wantExpandedUidNames) {
		name = uidIdProc.unexpand(name, nameBuf);
	}
	printIndent(buf, indentLevel);
	switch (m_type) {
	case Configuration::CFG_STRING:
		escStr = escapeString(m_stringVal);
		buf << name << " = \"" << escStr << "\";\n";
		delete [] escStr;
		break;
	case Configuration::CFG_LIST:
		buf << name << " = [";
		len = m_listVal->length();
		for (i = 0; i < len; i++) {
			escStr = escapeString((*m_listVal)[i]);
			buf << "\"" << escStr << "\"";
			delete [] escStr;
			if (i < len-1) {
				buf << ", ";
			}
		}
		buf << "];\n";
		break;
	case Configuration::CFG_SCOPE:
		buf << name << " {\n";
		m_scope->dump(buf, wantExpandedUidNames, indentLevel + 1);
		printIndent(buf, indentLevel);
		buf << "}\n";
		break;
	default:
		assert(0);	// Bug
		break;
	};
}
Exemplo n.º 21
0
void Script_v2::o2_popVars(FuncParams &params) {
	uint8 count = readUint8();

	for (uint16 i = 0; i < count; i++) {
		printIndent();
		print("pop(%s);\n", readVarIndex().c_str());
	}
}
Exemplo n.º 22
0
void nmethod::printPcs() {
  ResourceMark m;       // in case methods get printed from gdb
  printIndent();
  lprintf("pc-bytecode offsets:\n");
  Indent ++;
  for (PcDesc* p = pcs(); p < pcsEnd(); p ++) p->print(this);
  Indent --;
}
Exemplo n.º 23
0
void nmethod::printLocs() {
  ResourceMark m;       // in case methods get printed from gdb
  printIndent();
  lprintf("locations:\n");
  Indent ++;
  for (addrDesc* l = locs(); l < locsEnd(); l ++) l->print(this);
  Indent --;
}
Exemplo n.º 24
0
bool ASTPrintVisitor::visit_suite(AST_Suite* node) {
    for (int i = 0; i < node->body.size(); i++) {
        printIndent();
        node->body[i]->accept(this);
        stream << "\n";
    }
    return true;
}
Exemplo n.º 25
0
Arquivo: vmt.c Projeto: halfdan/ninjac
void showVMT(VMT* src, int indent) {
    printIndent(indent);
    if ( src->isEmpty ) {
        printf("===== END =====\n");
        return;
    }
    printf("%d:\t%s_%s\n", src->offset, src->className, symToString(src->name));
    showVMT(src->next, indent);
}
Exemplo n.º 26
0
void vframeLookupTarget::print() {
  printIndent();
  lprintf("vframeLookupTarget 0x%lx: ", this);
  receiver->print_real_oop();
  lprintf(" (map: 0x%lx)\n", map());
  Indent ++;
  vf->print_frame(0);
  Indent --;
}
Exemplo n.º 27
0
void assignableSlotLink::print() {
  printIndent();
  lprintf("{ ");
  bool first = true;
  Indent ++;
  for (assignableSlotLink* l = this; l; l = l->next) {
    if (first) {
      first = false;
    } else {
      lprintf(",\n");
      printIndent();
    }
    lprintf("desc 0x%lx (", (l->slot));
    l->slot->name->string_print();
    lprintf(") -> 0x%lx", (unsigned long)(l->target));
  }
  Indent --;
  lprintf(" }\n");
}
Exemplo n.º 28
0
void PrintingContext::print (const char *name, const dReal *x, int n)
{
    printIndent();
    fprintf (file,"%s = {",name);
    for (int i=0; i<n; i++) {
        printReal (x[i]);
        if (i < n-1) fputc (',',file);
    }
    fprintf (file,"},\n");
}
Exemplo n.º 29
0
void PrintingContext::print (const char *name, const char *x)
{
    printIndent();
    if (x) {
        fprintf (file,"%s = \"%s\",\n",name,x);
    }
    else {
        fprintf (file,"%s\n",name);
    }
}
Exemplo n.º 30
0
void Print::PrintDebug(int level) {
   printIndent(level);
   std::cout << "Print : ";
   for(int iPrintable = 0; iPrintable < GetNbPrintables(); iPrintable++) {
      GetPrintable(iPrintable)->PrintDebug();
      std::cout << " ";
   }	 
   if(WithEndline())
      std::cout << "endline";
}