コード例 #1
0
ファイル: dump-fig.c プロジェクト: pan0007/libsmi
static void printClasses(int *x, int *y, SmiModule *smiModule)
{
    SmiNode *smiNode;

    for(smiNode = smiGetFirstNode(smiModule, SMI_NODEKIND_ANY);
	smiNode;
	smiNode = smiGetNextNode(smiNode, SMI_NODEKIND_ANY)) {
	if (isGroup(smiNode)) {
	    printClass(x, y, smiNode);
	}
	if (smiNode->nodekind == SMI_NODEKIND_ROW) {
	    printClass(x, y, smiNode);
	}
    }
}
コード例 #2
0
ファイル: wb_print_wbl.cpp プロジェクト: Strongc/proview
//
// printAttribute
//
void wb_print_wbl::printAttribute(wb_volume& v, 
                                  wb_attribute& attr, 
                                  wb_attribute& tattr, ///< template 
                                  wb_adef& adef, 
				  int force)
{
  if ( !force &&
       (adef.flags() & PWR_MASK_POINTER || 
	adef.flags() & PWR_MASK_NOWBL))
    return;

  if (attr.isClass() && adef.cid() == pwr_eClass_Buffer)
    printBuffer(v, attr, tattr, adef);
  else if (attr.isClass())
    printClass(v, attr, tattr, adef);
  else {
    switch (adef.cid()) {
    case pwr_eClass_Param:
    case pwr_eClass_Input:
    case pwr_eClass_Intern:
    case pwr_eClass_Output:
    case pwr_eClass_ObjXRef:
      printParameter(v, attr, tattr, adef);
      break;
    default:
      m_os << "! %%WBDUMP-E-Error Unknown attribute class: " 
           << adef.name() << ", cid: " << adef.cid() << endl;
      m_errCnt++;
      break;
    }
  }
  
}
コード例 #3
0
ファイル: Controller.c プロジェクト: bernardo-macedo/JVM
/*
void mainInit(char* className, Interpretador* interpretador, int paramsNumber, char** cmdLineParams) {
    char* methodName = "main", methodDescriptor = "([Ljava/lang/String;)V";
    ClassFile* cFile = loadClass(interpretador, className);
    pushFrame(&(interpretador->topStackFrame));
    frameInit(interpretador->initClass, *cFile, interpretador->topStackFrame, methodName, methodDescriptor);

}
*/
void methodInit(char* className, char* methodName, char* methodDescriptor, Interpretador* interpretador, int paramsNumber, int print) {
    int i;
    ClassFile* cFile = loadClass(interpretador, className);
    printf("FEZ LOAD\n");
    if (print)
        printClass(cFile, className);

    pushFrame(&(interpretador->topStackFrame));
    printf("\n\nPUSHOUFRAME\n");
    frameInit(interpretador->initClass, *cFile, interpretador->topStackFrame, methodName, methodDescriptor);

    printf("\n\nINITIOUFRAME\n");
    if (interpretador->topStackFrame->nextFrame != NULL) {

    /*if (interpretador->topStackFrame->nextFrame != NULL) {*/

        for (i = countSlots(interpretador->topStackFrame->nextFrame->frame->topOperand, paramsNumber) - 1; i >= 0; i--) {
            if (interpretador->topStackFrame->nextFrame->frame->topOperand->operand.type32_64 == CAT2)
                i--;
            interpretador->topStackFrame->frame->localVarArray[i] = (int)&(interpretador->topStackFrame->nextFrame->frame->topOperand);
        }

    }
    printf("\n\nSAIU DA METHOD INIT\n");

    /*}*/

}
コード例 #4
0
ファイル: print.c プロジェクト: bowhan/kent
void _pf_prin(FILE *f, _pf_Stack *stack, boolean formal)
/* Print out single variable where type is determined at run time. */
{
struct _pf_type *type = _pf_type_table[stack->Var.typeId];
struct _pf_base *base = type->base;
union _pf_varless val = stack->Var.val;
struct hash *idHash = NULL;
switch (base->singleType)
    {
    case pf_stBit:
        fprintf(f, "%d", val.Bit);
	break;
    case pf_stByte:
	fprintf(f, "%d", val.Byte);
	break;
    case pf_stChar:
	fprintf(f, "%c", val.Char);
	break;
    case pf_stShort:
        fprintf(f, "%d", val.Short);
	break;
    case pf_stInt:
        fprintf(f, "%d", val.Int);
	break;
    case pf_stLong:
        fprintf(f, "%lld", val.Long);
	break;
    case pf_stFloat:
	if (formal)
	    fprintf(f, "%f", val.Float);
	else
	    fprintf(f, "%0.2f", val.Float);
	break;
    case pf_stDouble:
	if (formal)
	    fprintf(f, "%f", val.Double);
	else
	    fprintf(f, "%0.2f", val.Double);
	break;
    case pf_stString:
	if (formal || val.String == NULL)
	    printString(f, val.String);
	else
	    fprintf(f, "%s", val.String->s);
	break;
    case pf_stClass:
	idHash = newHash(18);
	printClass(f, val.Obj, base, idHash);
	break;
    case pf_stArray:
	idHash = newHash(18);
	printArray(f, val.Array, base, idHash);
	break;
    case pf_stDir:
	idHash = newHash(18);
        printDir(f, val.Dir, base, idHash);
	break;
    case pf_stToPt:
	fprintf(f, "<toPt %p>\n", val.FunctionPt);
        break;
    case pf_stFlowPt:
	fprintf(f, "<flowPt %p>\n", val.FunctionPt);
        break;
    default:
        fprintf(f, "<type %d>\n", base->singleType);
	internalErr();
	break;
    }
if (base->needsCleanup)
    {
    if (val.Obj != NULL && val.Obj->_pf_cleanup != NULL &&
    	--val.Obj->_pf_refCount <= 0)
	val.Obj->_pf_cleanup(val.Obj, stack->Var.typeId);
    }
freeHash(&idHash);
}
コード例 #5
0
ファイル: print.c プロジェクト: bowhan/kent
void _pf_printField(FILE *f, void *data, struct _pf_base *base, 
	struct hash *idHash)
/* Print out a data from a single field of given type. */
{
switch (base->singleType)
    {
    case pf_stBit:
	{
	_pf_Bit *p = data;
        fprintf(f, "%d", *p);
	break;
	}
    case pf_stChar:
	{
        _pf_Char *p = data;
	_pf_Char b = *p;
	fprintf(f, "%c", b);
	break;
	}
    case pf_stByte:
	{
        _pf_Byte *p = data;
	_pf_Byte b = *p;
	fprintf(f, "%d", b);
	break;
	}
    case pf_stShort:
	{
        _pf_Short *p = data;
	fprintf(f, "%d", *p);
	break;
	}
    case pf_stInt:
	{
        _pf_Int *p = data;
	fprintf(f, "%d", *p);
	break;
	}
    case pf_stLong:
	{
        _pf_Long *p = data;
	fprintf(f, "%lld", *p);
	break;
	}
    case pf_stFloat:
	{
        _pf_Float *p = data;
	fprintf(f, "%f", *p);
	break;
	}
    case pf_stDouble:
	{
        _pf_Double *p = data;
	fprintf(f, "%f", *p);
	break;
	}
    case pf_stString:
	{
        _pf_String *p = data;
	printString(f, *p);
	break;
	}
    case pf_stClass:
	{
	struct _pf_object **p = data;
        printClass(f, *p, base, idHash);
	break;
	}
    case pf_stArray:
        {
	struct _pf_array **p = data;
	printArray(f, *p, base, idHash);
	break;
	}
    case pf_stDir:
        {
	struct _pf_dir **p = data;
        printDir(f, *p, base, idHash);
	break;
	}
    case pf_stToPt:
	{
	_pf_FunctionPt **p = data;
	fprintf(f, "<toPt %p>", *p);
        break;
	}
    case pf_stFlowPt:
	{
	_pf_FunctionPt **p = data;
	fprintf(f, "<flowPt %p>", *p);
        break;
	}
    case pf_stVar:
        {
	struct _pf_var *var = data;
	struct _pf_type *type = _pf_type_table[var->typeId];
	_pf_printField(f, &var->val, type->base, idHash);
	break;
	}
    default:
	internalErr();
	break;
    }
}
コード例 #6
0
ファイル: b3disasm.c プロジェクト: ChrisAubuchon/bard
/*
 * oprintf()
 *
 * Opcode printf
 */
static void oprintf(disasm_t *d, const char *format)
{
    uint32_t	i	= 0;
    const char 	*fstart, *fend;

    if (format == NULL)
        return;

    fstart	= fend	= format;

    while (*fend) {
        if (*fend != '%') {
            i++;
            fend++;
        } else {
            if (i)
                fprintf(d->fp, "%.*s", i, fstart);

            /* Skip past % */
            fend++;

            switch (*fend) {
            case 'b':
                fprintf(d->fp, "%d", d->code->buf[d->offset++]);
                break;
            case 'B':	/* Bigpic image */
                printBigpic(d->fp, d->code->buf[d->offset++]);
                break;
            case 'c':	/* Class */
                printClass(d);
                break;
            case 'C':	/* Spell */
                printSpell(d->fp, d->code->buf[d->offset++]);
                break;
            case 'D':	/* Direction */
            {
                uint8_t		dir;

                dir = d->code->buf[d->offset++];

                if (dir == 0) {
                    fprintf(d->fp, "north");
                } else if (dir == 1) {
                    fprintf(d->fp, "east");
                } else if (dir == 2) {
                    fprintf(d->fp, "south");
                } else if (dir == 3) {
                    fprintf(d->fp, "west");
                } else {
                    fprintf(d->fp, "unknown");
                }
                break;
            }
            case 'f':	/* Flag */
            {
                uint8_t		flag;
                uint8_t		mask;

                flag	= d->code->buf[d->offset] >> 3;
                mask	= d->code->buf[d->offset] & 7;
                fprintf(d->fp, "%d", (flag * 8) + mask);
                d->offset++;
                break;
            }
            case 'I':	/* Item */
                printItem(d->fp, d->code->buf[d->offset++]);
                break;
            case 'L':
                printLiquid(d->fp, d->code->buf[d->offset++]);
                break;
            case 'M':	/* Monster */
                printMonster(d->fp, d->code->buf[d->offset++]);
                break;
            case 'O':	/* String at offset */
            {
                uint16_t	savedOffset;
                range_t		*r;

                r = (range_t *)xzalloc(sizeof(range_t));

                savedOffset = d->offset + 2;

                d->offset = str_read16le(&d->code->buf[d->offset]) - currentLevel.dataStartOffset;
                r->start	= d->offset;
                printPackedString(d);
                r->end		= d->offset;
                gl_list_add_last(rangeSkipList, r);
                d->offset	= savedOffset;
                break;
            }
            case 'o':	/* offset */
                fprintf(d->fp, "%04x",
                        str_read16le(&d->code->buf[d->offset])
                       );
                d->offset += 2;
                break;
            case 'S':	/* Masked String */
                fprintf(d->fp, "\"");
                fflush(d->fp);
                printMaskedString(d);
                fprintf(d->fp, "\"");
                break;
            case 's':	/* Packed String */
                fprintf(d->fp, "\"");
                printPackedString(d);
                fprintf(d->fp, "\"");
                break;
            case 'w':	/* Word */
                fprintf(d->fp, "%d",
                        str_read16le(&d->code->buf[d->offset])
                       );
                d->offset	+= 2;
                break;
            case 'x':	/* Hex byte */
                fprintf(d->fp, "0x%02x", d->code->buf[d->offset++]);
                break;
            }

            fend++;
            fstart	= fend;
            i	= 0;
        }
    }

    if (i)
        fprintf(d->fp, "%.*s", i, fstart);
}
コード例 #7
0
ファイル: ast.c プロジェクト: BackupTheBerlios/elastic
void ASTPrint( int lev, ASTNode node )
{
	if (! node)
	{
		indent( lev ); ec_stderr_printf( "NULL" );
		return;
	}

	/* Simplify our lives ... */
	if (currentScope)
	{
		if (currentScope->type == PackageScope)
		{
			currentPackage  = currentScope->target;
			currentBytecode = EC_PACKAGECODE(currentScope->target);
		} else
		{
			currentBytecode = currentScope->target;
		}
		currentLiteral  = EC_COMPILEDLFRAME(currentBytecode);
	}

	switch ( node->type )
	{
	case nullType:
		indent( lev ); ec_stderr_printf( "<nullType>" );
		break;

	case symbolType:
		printSymbol( lev, node );
		break;

	case qualifiedSymbolType:
		printQualifiedSymbol( lev, node );
		break;

	case constExprType:
		printConstant( lev, node );
		break;

	case variableExprType:
		printVariable( lev, node );
		break;

	case arrayConstructionExprType:
		printArrayCons( lev, node );
		break;

	case hashConstructionExprType:
		printHashCons( lev, node );
		break;

	case unaryExprType:
		printUnary( lev, node );
		break;

	case binaryExprType:
		printBinary( lev, node );
		break;

	case conditionalExprType:
		printConditional( lev, node );
		break;

	case orExprType:
		printOr( lev, node );
		break;

	case andExprType:
		printAnd( lev, node );
		break;

	case assignExprType:
		printAssign( lev, node );
		break;

	case simAssignExprType:
		printSimAssign( lev, node );
		break;

	case arrayRefExprType:
		printArrayRef( lev, node );
		break;

	case declNodeType:
		printDecl( lev, node );
		break;

	case declAtomNodeType:
		printDeclAtom( lev, node );
		break;

	case statementType:
		printStatement( lev, node );
		break;

	case labeledStmtType:
		printLabeledStmt( lev, node );
		break;

	case exprStmtType:
		printExprStmt( lev, node );
		break;

	case ifStmtType:
		printIf( lev, node );
		break;

	case whileStmtType:
		printWhile( lev, node );
		break;

	case doStmtType:
		printDo( lev, node );
		break;

	case forStmtType:
		printFor( lev, node );
		break;

	case forInStmtType:
		printForIn( lev, node );
		break;

	case breakStmtType:
		printBreak( lev, node );
		break;

	case continueStmtType:
		printContinue( lev, node );
		break;

	case gotoStmtType:
		printGoto( lev, node );
		break;

	case tryStmtType:
		printTry( lev, node );
		break;

	case catchStmtType:
		printCatch( lev, node );
		break;

	case throwStmtType:
		printThrow( lev, node );
		break;

	case importStmtType:
		printImport( lev, node );
		break;

	case paramNodeType:
		printParam( lev, node );
		break;

	case paramListType:
		printParamList( lev, node );
		break;

	case callNodeType:
		printCall( lev, node );
		break;

	case methodCallNodeType:
		printMethodCall( lev, node );
		break;

	case stmtListType:
		printStmtList( lev, node );
		break;

	case funcNodeType:
		printFunction( lev, node );
		break;

	case returnNodeType:
		printReturn( lev, node );
		break;

	case classNodeType:
		printClass( lev, node );
		break;

	case methodNodeType:
		printMethod( lev, node );
		break;

	case packageNodeType:
		printPackage( lev, node );
		break;
	}
}