Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

omnibus pull from bobhanson/java2Script#230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
BobHanson merged 13 commits intojava2script:masterfromBobHanson:master
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
13 commits
Select commitHold shift + click to select a range
e9f806e
Merge pull request #263 from java2script/master
BobHansonSep 4, 2023
87c72b8
Fix inequality tests for negative longs. Fix #268
warownia1Jan 30, 2024
c8c9cac
Merge pull request #269 from warownia1/hanson1
BobHansonJan 31, 2024
9aff277
Jmol-SwingJS fixes for Hashtable; efficiencies for DataInputStream
BobHansonFeb 1, 2024
f650053
removal of unicode characters from jmol/4.2 version Hashtable, HashSet,
BobHansonFeb 6, 2024
489e12f
Merge pull request #271 from BobHanson/hanson1
BobHansonFeb 22, 2024
ccf7265
fix for issue #270 -- Long.signum, Long.compareUnsigned fail
BobHansonFeb 25, 2024
318ed92
just rewriting odd j2sNative code
BobHansonFeb 25, 2024
dbde100
A4d should extend P3d
BobHansonFeb 25, 2024
8d78ad0
(4.2, only for legay Jmol) adding more efficient @j2sOverride and
BobHansonFeb 25, 2024
a826557
fixes MutableBigInteger (mostly for BigDecimal) not set to roll over
BobHansonFeb 25, 2024
068cea2
//BH 2024.02.22 -- 3.3.1-v7 fixes long extension issue causing
BobHansonFeb 25, 2024
76dc748
Transpiler and SwingJS library update.
BobHansonFeb 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modifiedsources/net.sf.j2s.core/dist/swingjs/SwingJS-site.zip
View file
Open in desktop
Binary file not shown.
Binary file modifiedsources/net.sf.j2s.core/dist/swingjs/j2s.core.jar
View file
Open in desktop
Binary file not shown.
2 changes: 1 addition & 1 deletionsources/net.sf.j2s.core/dist/swingjs/timestamp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
20240114215407
20240225103130
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
20240114215407
20240225103130
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,6 +31,7 @@
// TODO: superclass inheritance for JAXB XmlAccessorType
// TODO: Transpiler bug allows static String name, but JavaScript function().name is read-only and will be "clazz"

//BH 2024.02.22 -- 3.3.1-v7 fixes long extension issue causing MutableBitInteger to miscalculate subtraction(no change in version #)
//BH 2023.03.29 -- 3.3.1-v7 fixes outer static method call from within lambda expression.
//BH 2023.02.09 -- 3.3.1.v6 fixes j2s.excluded.paths needing /src/xxxx
//BH 2022.06.27 -- 3.3.1-v5 fixes missing method annotations
Expand DownExpand Up@@ -4313,11 +4314,10 @@ && boxType(exp) == NO_BOX) {
private void addExtendedOperands(List<?> extendedOperands, String op, char pre, char post, boolean isToString,
boolean isLongCall) {
buffer.append(' ');
if (isLongCall)
op = ",";
for (Iterator<?> iter = extendedOperands.iterator(); iter.hasNext();) {
Expression exp = (Expression) iter.next();
// op may be int for a while, but after that it changes to long
if (isLongCall && exp.resolveTypeBinding().getName().equals("long"))
op = ",";
buffer.append(op);
buffer.append(pre);
addOperand(exp, isToString);
Expand Down
Binary file modifiedsources/net.sf.j2s.java.core/dist/SwingJS-site.zip
View file
Open in desktop
Binary file not shown.
Binary file modifiedsources/net.sf.j2s.java.core/dist_to_jsmol/Jmol-j2s-site.zip
View file
Open in desktop
Binary file not shown.
2 changes: 0 additions & 2 deletionssources/net.sf.j2s.java.core/site-resources/test-raf.txt
View file
Open in desktop

This file was deleted.

View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -894,7 +894,7 @@ Clazz.defineMethod = function (clazzThis, funName, funBody, funParams) {
if (!f$.stacks || f$.claxxReference !== clazzThis) {
//Generate a new delegating method for the class
var id = ++SAEMid;
console.log("SAEM " + clazzThis.__CLASS_NAME__ + "." + funName);
//console.log("SAEM " + clazzThis.__CLASS_NAME__ + "." + funName);
var delegate = function () {
return searchAndExecuteMethod(id, this, arguments.callee.claxxReference, arguments.callee.methodName, arguments);
};
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
/*
* 2024.02.21 BH modified for SwingJS with a few (more!) (x + 0x80000000)|0 adjustments
*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand All@@ -25,7 +27,7 @@

package java.math;

/**
/**
* A class used to represent multiprecision integers that makes efficient
* use of allocated space by allowing a number to occupy only part of
* an array so that the arrays do not have to be reallocated as often.
Expand DownExpand Up@@ -294,8 +296,8 @@ private int compareShifted(MutableBigInteger b, int ints) {
// comparison.
int[] bval = b.value;
for (int i = offset, j = b.offset; i < alen + offset; i++, j++) {
int b1 = value[i] + 0x80000000;
int b2 = bval[j] + 0x80000000;
int b1 =(value[i] + 0x80000000)| 0;
int b2 =(bval[j] + 0x80000000)| 0;
if (b1 < b2)
return -1;
if (b1 > b2)
Expand DownExpand Up@@ -339,7 +341,7 @@ final int compareHalf(MutableBigInteger b) {
long v = val[i++] & LONG_MASK;
if (v != hb)
return v < hb ? -1 : 1;
carry = (bv & 1) << 31; // carray will be either 0x80000000 or 0
carry = ((bv & 1) << 31)|0; // carray will be either 0x80000000 or 0
}
return carry == 0 ? 0 : -1;
}
Expand DownExpand Up@@ -1131,7 +1133,6 @@ int divideOneWord(int divisor, MutableBigInteger quotient) {
quotient.value[intLen - xlen] = q;
remLong = rem & LONG_MASK;
}

quotient.normalize();
// Unnormalize
if (shift > 0)
Expand DownExpand Up@@ -1362,8 +1363,7 @@ private MutableBigInteger divide3n2n(MutableBigInteger b, MutableBigInteger quot
if (compareShifted(b, n) < 0) {
// step 3a: if a1<b1, let quotient=a12/b1 and r=a12%b1
r = a12.divide2n1n(b1, quotient);

// step 4: d=quotient*b2
// step 4: d=quotient*b2
d = new MutableBigInteger(quotient.toBigInteger().multiply(b2));
} else {
// step 3b: if a1>=b1, let quotient=beta^n-1 and r=a12-b1*2^n+b1
Expand All@@ -1378,7 +1378,7 @@ private MutableBigInteger divide3n2n(MutableBigInteger b, MutableBigInteger quot
d.leftShift(32 * n);
d.subtract(new MutableBigInteger(b2));
}

// step 5: r = r*beta^n + a3 - d (paper says a4)
// However, don't subtract d until after the while loop so r doesn't become negative
r.leftShift(32 * n);
Expand DownExpand Up@@ -1548,13 +1548,13 @@ private MutableBigInteger divideMagnitude(MutableBigInteger div,
int qrem = 0;
boolean skipCorrection = false;
int nh = rem.value[j+rem.offset];
int nh2 = nh + 0x80000000;
int nh2 =(nh + 0x80000000)| 0;
int nm = rem.value[j+1+rem.offset];

if (nh == dh) {
qhat = ~0;
qrem = nh + nm;
skipCorrection = qrem + 0x80000000 < nh2;
skipCorrection =((qrem + 0x80000000)| 0) < nh2;
} else {
long nChunk = (((long)nh) << 32) | (nm & LONG_MASK);
if (nChunk >= 0) {
Expand DownExpand Up@@ -1607,13 +1607,13 @@ private MutableBigInteger divideMagnitude(MutableBigInteger div,
int qrem = 0;
boolean skipCorrection = false;
int nh = rem.value[limit - 1 + rem.offset];
int nh2 = nh + 0x80000000;
int nh2 =(nh + 0x80000000)|0;
int nm = rem.value[limit + rem.offset];

if (nh == dh) {
qhat = ~0;
qrem = nh + nm;
skipCorrection = qrem + 0x80000000 < nh2;
skipCorrection =((qrem + 0x80000000)|0) < nh2;
} else {
long nChunk = (((long) nh) << 32) | (nm & LONG_MASK);
if (nChunk >= 0) {
Expand DownExpand Up@@ -1653,7 +1653,7 @@ private MutableBigInteger divideMagnitude(MutableBigInteger div,
borrow = mulsubBorrow(rem.value, divisor, qhat, dlen, limit - 1 + rem.offset);

// D5 Test remainder
if (borrow + 0x80000000 > nh2) {
if (((borrow + 0x80000000)|0) > nh2) {
// D6 Add back
if(needRemainder)
divadd(divisor, rem.value, limit - 1 + 1 + rem.offset);
Expand DownExpand Up@@ -1723,13 +1723,13 @@ private MutableBigInteger divideLongMagnitude(long ldivisor, MutableBigInteger q
int qrem = 0;
boolean skipCorrection = false;
int nh = rem.value[j + rem.offset];
int nh2 = nh + 0x80000000;
int nh2 =(nh + 0x80000000)|0;
int nm = rem.value[j + 1 + rem.offset];

if (nh == dh) {
qhat = ~0;
qrem = nh + nm;
skipCorrection = qrem + 0x80000000 < nh2;
skipCorrection =((qrem + 0x80000000)|0) < nh2;
} else {
long nChunk = (((long) nh) << 32) | (nm & LONG_MASK);
if (nChunk >= 0) {
Expand DownExpand Up@@ -1767,7 +1767,7 @@ private MutableBigInteger divideLongMagnitude(long ldivisor, MutableBigInteger q
int borrow = mulsubLong(rem.value, dh, dl, qhat, j + rem.offset);

// D5 Test remainder
if (borrow + 0x80000000 > nh2) {
if (((borrow + 0x80000000)|0) > nh2) {
// D6 Add back
divaddLong(dh,dl, rem.value, j + 1 + rem.offset);
qhat--;
Expand DownExpand Up@@ -1963,7 +1963,7 @@ static int binaryGcd(int a, int b) {
int t = (aZeros < bZeros ? aZeros : bZeros);

while (a != b) {
if ((a+0x80000000) > (b+0x80000000)) { // a > b as unsigned
if (((a +0x80000000)|0) > ((b +0x80000000)|0)) { // a > b as unsigned
a -= b;
a >>>= Integer.numberOfTrailingZeros(a);
} else {
Expand DownExpand Up@@ -2246,4 +2246,20 @@ MutableBigInteger euclidModInverse(int k) {
mod.subtract(t1);
return mod;
}

// static {
// int a = 100;
// int b = a + 0x80000000;
// System.out.println(b);
// System.out.println((a + 0x80000000) | 0);
// System.out.println(a + 0x80000000L); // NOT in Java
// System.out.println((int) (a + 0x80000000L));
// a = -100;
// b = a + 0x80000000;
// System.out.println("?");
// System.out.println(b); //NOT in JS
// System.out.println((a + 0x80000000) | 0);
// System.out.println(a + 0x80000000L);
// System.out.println((int) (a + 0x80000000L));
// }
}
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1893,7 +1893,10 @@ public T nextElement() {

@Override
public V setValue(V value) {
return Hashtable.this.put(getKey(), value);
int m = modCount;
V v = put(getKey(), value);
modCount = m;
return v;
}
};
}
Expand Down
21 changes: 1 addition & 20 deletionssources/net.sf.j2s.java.core/src/javajs/util/A4d.java
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,26 +35,7 @@ conforming to the Java(TM) 3D API specification by Sun Microsystems.
* for unique constructor and method names
* for the optimization of compiled JavaScript using Java2Script
*/
public class A4d implements JSONEncodable, Serializable {

/*
* I assumed that the length of the axis vector is not significant.
*/

/**
* The x coordinate.
*/
public double x;

/**
* The y coordinate.
*/
public double y;

/**
* The z coordinate.
*/
public double z;
public class A4d extends P3d {

/**
* The angle.
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -181,9 +181,9 @@ public Object getNext(Object array, int pt) throws Exception {
if (array == null) {
switch (b) {
case FLOAT32:
returnFloat.valueOf(doc.readFloat());
returnDouble.valueOf(doc.readFloat());
case FLOAT64:
returnFloat.valueOf((float)doc.readDouble());
returnDouble.valueOf(doc.readDouble());
case UINT8:
return Integer.valueOf(doc.readUInt8());
case UINT16:
Expand All@@ -203,17 +203,17 @@ public Object getNext(Object array, int pt) throws Exception {
case STR8:
return doc.readString(doc.readUInt8());
case STR16:
return doc.readString(doc.readShort());
return doc.readString(doc.readUnsignedShort());
case STR32:
return doc.readString(doc.readInt());
}
} else {
switch (b) {
case FLOAT32:
((float[]) array)[pt] = doc.readFloat();
((double[]) array)[pt] = doc.readFloat();
break;
case FLOAT64:
((float[]) array)[pt] = (float) doc.readDouble();
((double[]) array)[pt] = doc.readDouble();
break;
case UINT8:
((int[]) array)[pt] = doc.readUInt8();
Expand DownExpand Up@@ -243,10 +243,10 @@ public Object getNext(Object array, int pt) throws Exception {
((String[]) array)[pt] = doc.readString(doc.readUInt8());
break;
case STR16:
((String[]) array)[pt] = doc.readString(doc.readShort());
((String[]) array)[pt] = doc.readString(doc.readUnsignedShort());
break;
case STR32:
((String[]) array)[pt] = doc.readString(doc.readInt());
((String[]) array)[pt] = doc.readString(doc.readInt()); // technically shoild be unsigned int
break;
}
}
Expand All@@ -267,9 +267,9 @@ private Object getArray(int n) throws Exception {
int[] a = new int[n];
a[0] = ((Integer) v).intValue();
v = a;
} else if (v instanceofFloat) {
float[] a = newfloat[n];
a[0] = ((Float) v).floatValue();
} else if (v instanceofNumber) {
double[] a = newdouble[n];
a[0] = ((Number) v).doubleValue();
v = a;
} else if (v instanceof String) {
String[] a = new String[n];
Expand All@@ -296,8 +296,6 @@ private Object getMap(int n) throws Exception {
Map<String, Object> map = new Hashtable<String, Object>();
for (int i = 0; i < n; i++) {
String key = getNext(null, 0).toString();
//Logger.info(key);

Object value = getNext(null, 0);
if (value == null) {
//Logger.info("null value for " + key);
Expand DownExpand Up@@ -366,10 +364,10 @@ public static Object decode(byte[] b) {
* @param divisor
* @return array of floats
*/
public staticfloat[] getFloats(byte[] b, int n, float divisor) {
public staticdouble[] getFloats(byte[] b, int n, float divisor) {
if (b == null)
return null;
float[] a = newfloat[n];
double[] a = newdouble[n];
try {
switch ((b.length - 12) / n) {
case 2:
Expand DownExpand Up@@ -522,10 +520,10 @@ public static int[] rldecode32Delta(byte[] b, int n) {
* @param divisor
* @return array of floats
*/
public staticfloat[] rldecodef(byte[] b, int n, float divisor) {
public staticdouble[] rldecodef(byte[] b, int n, float divisor) {
if (b == null)
return null;
float[] ret = newfloat[n];
double[] ret = newdouble[n];
for (int i = 0, pt = 3; i < n;) {
int val = BC.bytesToInt(b, (pt++) << 2, true);
for (int j = BC.bytesToInt(b, (pt++) << 2, true); --j >= 0;)
Expand All@@ -545,10 +543,10 @@ public static float[] rldecodef(byte[] b, int n, float divisor) {
* @param divisor
* @return array of floats
*/
public staticfloat[] unpack16Deltaf(byte[] b, int n, float divisor) {
public staticdouble[] unpack16Deltaf(byte[] b, int n, float divisor) {
if (b == null)
return null;
float[] ret = newfloat[n];
double[] ret = newdouble[n];
for (int i = 0, pt = 6, val = 0, buf = 0; i < n;) {
int diff = BC.bytesToShort(b, (pt++) << 1, true);
if (diff == Short.MAX_VALUE || diff == Short.MIN_VALUE) {
Expand All@@ -575,10 +573,10 @@ public static float[] unpack16Deltaf(byte[] b, int n, float divisor) {
* @param divisor
* @return array of floats
*/
public staticfloat[] unpackf(byte[] b, int nBytes, int n, float divisor) {
public staticdouble[] unpackf(byte[] b, int nBytes, int n, float divisor) {
if (b == null)
return null;
float[] ret = newfloat[n];
double[] ret = newdouble[n];
switch (nBytes) {
case 1:
for (int i = 0, pt = 12, offset = 0; i < n;) {
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp