}
return returnValue;
}
+
+ public static final int MIN_RADIX = 2;
+ public static final int MAX_RADIX = 36;
+
+ public static char forDigit(int digit, int radix) {
+ if ((digit >= radix) || (digit < 0)) {
+ return '\0';
+ }
+ if ((radix < Character.MIN_RADIX) || (radix > Character.MAX_RADIX)) {
+ return '\0';
+ }
+ if (digit < 10) {
+ return (char)('0' + digit);
+ }
+ return (char)('a' - 10 + digit);
+}
}
* as inserted after the first digit, the character 'E' is appended
* and adjExp is appended.
*/
- /*public String toString()
+ public String toString()
{
// bigStr is the String representation of the unscaled value. If
// scale is zero we simply return this.
boolean negative = (bigStr.charAt(0) == '-');
int point = bigStr.length() - scale - (negative ? 1 : 0);
- CPStringBuilder val = new CPStringBuilder();
+ /*CP*/StringBuilder val = new /*CP*/StringBuilder();
if (scale >= 0 && (point - 1) >= -6)
{
val.append( point - 1 );
}
return val.toString();
- }*/
+ }
/**
* Returns the String representation of this BigDecimal, using engineering
return shift(this, -n);
}
- /*private void format(int radix, CPStringBuilder buffer)
+ private void format(int radix, /*CP*/StringBuilder buffer)
{
if (words == null)
- buffer.append(Integer.toString(ival, radix));
+ buffer.append(Integer.toString(ival/*, radix*/));
else if (ival <= 2)
- buffer.append(Long.toString(longValue(), radix));
+ buffer.append(Long.toString(longValue()/*, radix*/));
else
{
boolean neg = isNegative();
}
}
}
- }*/
+ }
- /*public String toString()
+ public String toString()
{
return toString(10);
- }*/
+ }
- /*public String toString(int radix)
+ public String toString(int radix)
{
- if (USING_NATIVE)
- return mpz.toString(radix);
+ /*if (USING_NATIVE)
+ return mpz.toString(radix);*/
if (words == null)
- return Integer.toString(ival, radix);
+ return Integer.toString(ival/*, radix*/);
if (ival <= 2)
- return Long.toString(longValue(), radix);
+ return Long.toString(longValue()/*, radix*/);
int buf_size = ival * (MPN.chars_per_word(radix) + 1);
- CPStringBuilder buffer = new CPStringBuilder(buf_size);
+ /*CP*/StringBuilder buffer = new /*CP*/StringBuilder(buf_size);
format(radix, buffer);
return buffer.toString();
- }*/
+ }
public int intValue()
{
public static float parseFloat(String str)
{
//return VMFloat.parseFloat(str);
- System.println("Float.parseFloat(String) invoked");
- return 1.0f;
+ return (float)Double.parseDouble(str);
}
/**
{
return new String(this.value, 0, this.count);
}
+
+ /**
+ * Get the character at the specified index.
+ *
+ * @param index the index of the character to get, starting at 0
+ * @return the character at the specified index
+ * @throws IndexOutOfBoundsException if index is negative or >= length()
+ * (while unspecified, this is a StringIndexOutOfBoundsException)
+ */
+ public char charAt(int index)
+ {
+ if (index < 0 || index >= count)
+ throw new /*StringIndexOutOfBounds*/Exception("StringIndexOutOfBounds " + index);
+ return value[index];
+ }
+
+ /**
+ * Set the character at the specified index.
+ *
+ * @param index the index of the character to set starting at 0
+ * @param ch the value to set that character to
+ * @throws IndexOutOfBoundsException if index is negative or >= length()
+ * (while unspecified, this is a StringIndexOutOfBoundsException)
+ */
+ public void setCharAt(int index, char ch)
+ {
+ if (index < 0 || index >= count)
+ throw new /*StringIndexOutOfBounds*/Exception("StringIndexOutOfBounds " + index);
+ // Call ensureCapacity to enforce copy-on-write.
+ ensureCapacity_unsynchronized(count);
+ value[index] = ch;
+ }
+
+ /**
+ * Insert the <code>char</code> argument into this <code>StringBuffer</code>.
+ *
+ * @param offset the place to insert in this buffer
+ * @param ch the <code>char</code> to insert
+ * @return this <code>StringBuffer</code>
+ * @throws StringIndexOutOfBoundsException if offset is out of bounds
+ */
+ public StringBuffer insert(int offset, char ch)
+ {
+ if (offset < 0 || offset > count)
+ throw new /*StringIndexOutOfBounds*/Exception("StringIndexOutOfBounds " + offset);
+ ensureCapacity_unsynchronized(count + 1);
+ System.arraycopy(value, offset, value, offset + 1, count - offset);
+ value[offset] = ch;
+ count++;
+ return this;
+ }
}
if (isNaN(value))
return 0x7ff8000000000000L;
else
- return 0; //VMDouble.doubleToRawLongBits(value);
+ return /*VMDouble.*/doubleToRawLongBits(value);
}
/**
* @return the bits of the <code>double</code>
* @see #longBitsToDouble(long)
*/
- public static long doubleToRawLongBits(double value)
+ /*public static long doubleToRawLongBits(double value)
{
- return 0; //VMDouble.doubleToRawLongBits(value);
- }
+ return VMDouble.doubleToRawLongBits(value);
+ }*/
+ public static native long doubleToRawLongBits(double value);
/**
* Convert the argument in IEEE 754 floating-point "double format" bit
* @see #doubleToLongBits(double)
* @see #doubleToRawLongBits(double)
*/
- public static double longBitsToDouble(long bits)
+ /*public static double longBitsToDouble(long bits)
{
- return 0.0; //VMDouble.longBitsToDouble(bits);
- }
+ return VMDouble.longBitsToDouble(bits);
+ }*/
+ public static native double longBitsToDouble(long bits);
/**
* Compare two Doubles numerically by comparing their <code>double</code>
generateMethodParam(cn, md, output);
- if(md.isInvokedByStatic()) {
+ if(md.isInvokedByStatic() && !md.isStaticBlock() && !md.getModifiers().isNative()) {
// generate the staticinit version
String mdstring = md.getSafeMethodDescriptor() + "staticinit";
ClassDescriptor cn=md!=null ? md.getClassDesc() : null;
ParamsObject objectparams=(ParamsObject)paramstable.get(md!=null ? md : task);
- if((md != null) && md.isInvokedByStatic() && !md.isStaticBlock()) {
+ if((md != null) && md.isInvokedByStatic() && !md.isStaticBlock() && !md.getModifiers().isNative()) {
// generate a special static init version
mgcstaticinit = true;
String mdstring = md.getSafeMethodDescriptor() + "staticinit";
ParamsObject objectparams=(ParamsObject)paramstable.get(md);
ClassDescriptor cn=md.getClassDesc();
String mdstring = md.getSafeMethodDescriptor();
- if(mgcstaticinit && !md.getModifiers().isNative()) {
+ if(mgcstaticinit && !md.isStaticBlock() && !md.getModifiers().isNative()) {
mdstring += "staticinit";
}
if(fsfn.getField().isStatic()) {
// static field
- if((fm.getMethod().isStaticBlock()) || (fm.getMethod().isInvokedByStatic()/* && mgcstaticinit*/)) {
+ if((fm.getMethod().isStaticBlock()) || (fm.getMethod().isInvokedByStatic())) {
// is a static block or is invoked in some static block
ClassDescriptor cd = fm.getMethod().getClassDesc();
ClassDescriptor cn = fsfn.getDst().getType().getClassDesc();
//catch the constructor case
output.print("void ");
if (md!=null) {
- if(mgcstaticinit) {
+ if(mgcstaticinit && !md.isStaticBlock() && !md.getModifiers().isNative()) {
mdstring += "staticinit";
}
output.print(cn.getSafeSymbol()+md.getSafeSymbol()+"_"+mdstring+"(");
}
#endif
+typedef union jvalue
+{
+ bool z;
+ char c;
+ short s;
+ int i;
+ long long j;
+ float f;
+ double d;
+} jvalue;
+
+#ifdef D___Double______doubleToRawLongBits____D
+long long CALL11(___Double______doubleToRawLongBits____D, double dval, double dval) {
+ jvalue val;
+ val.d = dval;
+
+#if defined(__IEEE_BYTES_LITTLE_ENDIAN)
+ /* On little endian ARM processors when using FPA, word order of
+ doubles is still big endian. So take that into account here. When
+ using VFP, word order of doubles follows byte order. */
+
+#define SWAP_DOUBLE(a) (((a) << 32) | (((a) >> 32) & 0x00000000ffffffff))
+
+ val.j = SWAP_DOUBLE(val.j);
+#endif
+
+ return val.j;
+}
+#endif
+
+#ifdef D___Double______longBitsToDouble____J
+double CALL11(___Double______longBitsToDouble____J, long long lval, long long lval) {
+ jvalue val;
+ val.j = lval;
+
+#if defined(__IEEE_BYTES_LITTLE_ENDIAN)
+#ifndef SWAP_DOUBLE
+#define SWAP_DOUBLE(a) (((a) << 32) | (((a) >> 32) & 0x00000000ffffffff))
+#endif
+ val.j = SWAP_DOUBLE(val.j);
+#endif
+
+ return val.d;
+}
+#endif
+
#ifdef D___String______convertdoubletochar____D__AR_C
int CALL12(___String______convertdoubletochar____D__AR_C, double ___val___, double ___val___, struct ArrayObject * ___chararray___) {
int length=VAR(___chararray___)->___length___;
}
#endif
+#ifdef D___Double______doubleToRawLongBits____D
+typedef union jvalue
+{
+ bool z;
+ char c;
+ short s;
+ int i;
+ long long j;
+ float f;
+ double d;
+} jvalue;
+
+long long CALL11(___Double______doubleToRawLongBits____D, double dval, double dval) {
+ jvalue val;
+ val.d = dval;
+
+#if defined(__IEEE_BYTES_LITTLE_ENDIAN)
+ /* On little endian ARM processors when using FPA, word order of
+ doubles is still big endian. So take that into account here. When
+ using VFP, word order of doubles follows byte order. */
+
+#define SWAP_DOUBLE(a) (((a) << 32) | (((a) >> 32) & 0x00000000ffffffff))
+
+ val.j = SWAP_DOUBLE(val.j);
+#endif
+
+ return val.j;
+}
+#endif
+
+#ifdef D___Double______longBitsToDouble____J
+double CALL11(___Double______longBitsToDouble____J, long long lval, long long lval) {
+ jvalue val;
+ val.j = lval;
+
+#if defined(__IEEE_BYTES_LITTLE_ENDIAN)
+#ifndef SWAP_DOUBLE
+#define SWAP_DOUBLE(a) (((a) << 32) | (((a) >> 32) & 0x00000000ffffffff))
+#endif
+ val.j = SWAP_DOUBLE(val.j);
+#endif
+
+ return val.d;
+}
+#endif
+
#ifdef D___String______convertdoubletochar____D__AR_C
int CALL12(___String______convertdoubletochar____D__AR_C, double ___val___, double ___val___, struct ArrayObject ___chararray___) {
int length=VAR(___chararray___)->___length___;