FileDocCategorySizeDatePackage
HeaderDump.javaAPI DocphoneME MR2 API (J2ME)3327Wed May 02 17:59:48 BST 2007runtime

HeaderDump

public abstract class HeaderDump extends Object

Fields Summary
char
CDelim
static final char
DIR_DELIM
static final char
INNER_DELIM
PrintStream
o
String
className
Constructors Summary
public HeaderDump(char cdelim)


        
	CDelim = cdelim;
    
Methods Summary
public abstract booleandumpExternals(ClassInfo c, java.io.PrintStream outfile)

public abstract booleandumpHeader(ClassInfo c, java.io.PrintStream outfile)

public java.lang.Stringfilename(java.lang.String classname)

	return Util.convertToClassName( classname );
    
protected booleangenerateConsts(java.lang.String classname, FieldInfo[] fields)

	if ( fields == null ) return false;
	boolean didWork = false;
	for ( int i = 0; i < fields.length; i++ ){
	    FieldInfo f = fields[i];
	    if ( f.value == null ) continue; // not a constant.
	    String constName = classname+CDelim+f.name.string;
	    o.println("#undef "+constName );
	    ConstantObject v = f.value;
	    DoubleValueConstant dvc;
	    switch ( v.tag ){
	    case Const.CONSTANT_FLOAT:
		float fval = Float.intBitsToFloat( ((SingleValueConstant)v).value );
		o.println("#define "+constName+" "+fval+"f");
		break;
	    case Const.CONSTANT_DOUBLE:
		dvc = (DoubleValueConstant)v;
		double dval = Double.longBitsToDouble((((long)(dvc.highVal))<<32) | ((long)dvc.lowVal&0xffffffffL));
		o.println("#define "+constName+" "+dval+"D");
		break;
		
	    case Const.CONSTANT_LONG:
		dvc = (DoubleValueConstant)v;
		long lval = (((long)(dvc.highVal))<<32) | ((long)dvc.lowVal&0xffffffffL);
		o.println("#define "+constName+" "+lval+"LL");
		break;
	    case Const.CONSTANT_INTEGER:
		int ival = ((SingleValueConstant)v).value;
		o.println("#define "+constName+" "+ival+"L");
		break;
	    default:
	    }
	    didWork = true;
	}
	return didWork;
    
static java.lang.Stringstrsub(java.lang.String src, char substitute)

	return src.replace( DIR_DELIM, substitute).replace(INNER_DELIM, substitute );