VirtualBox

Changeset 31711 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Aug 16, 2010 4:32:16 PM (14 years ago)
Author:
vboxsync
Message:

Java glue: update, MSCOM compiles again

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/glue/glue-java.xsl

    r31708 r31711  
    295295    <xsl:when test="($G_vboxGlueStyle='xpcom')">
    296296      <xsl:choose>
    297         <xsl:when test="$type='unsigned long long'">
    298           <!-- stupid, rewrite the bridge -->
    299           <xsl:value-of select="'double'" />
    300         </xsl:when>
    301 
    302297        <xsl:when test="$type='long long'">
    303298          <xsl:value-of select="'long'" />
     
    391386        <xsl:when test="//enum[@name=$type]">
    392387          <xsl:value-of select="concat($G_virtualBoxPackageCom, '.', $type)" />
    393         </xsl:when>
    394 
    395         <xsl:when test="$type='unsigned long long'">
    396           <xsl:value-of select="'BigInteger'" />
    397388        </xsl:when>
    398389
     
    553544        </xsl:call-template>
    554545      </xsl:variable>
    555       <xsl:value-of select="concat('Helper.wrap(', $elemgluetype, '.class, ', $value,'.toSafeArray())')"/>
     546      <xsl:choose>
     547        <xsl:when test="($idltype='octet')">
     548          <xsl:value-of select="concat('Helper.wrapBytes(', $value, '.toSafeArray())')"/>
     549        </xsl:when>
     550        <xsl:otherwise>
     551          <xsl:value-of select="concat('Helper.wrap(', $elemgluetype, '.class, ', $value,'.toSafeArray())')"/>
     552        </xsl:otherwise>
     553      </xsl:choose>
    556554    </xsl:when>
    557555
     
    599597    <xsl:when test="$idltype='long long'">
    600598      <xsl:value-of select="concat($value,'.getLong()')"/>
    601     </xsl:when>
    602 
    603     <xsl:when test="$idltype='unsigned long long'">
    604       <xsl:value-of select="concat('Helper.longToBigInteger(',$value,'.getLong())')"/>
    605599    </xsl:when>
    606600
     
    817811        </xsl:otherwise>
    818812      </xsl:choose>
    819     </xsl:when>
    820 
    821     <xsl:when test="$idltype='unsigned long long'">
    822       <xsl:value-of select="concat('Helper.bigIntegerToDouble(', $value,')')"/>
    823813    </xsl:when>
    824814
     
    19571947  </xsl:call-template>
    19581948
    1959    <xsl:text>import java.math.BigInteger;&#10;</xsl:text>
    19601949   <xsl:text>import java.util.List;&#10;</xsl:text>
    19611950
     
    20081997  </xsl:call-template>
    20091998
    2010   <xsl:text>import java.math.BigInteger;&#10;</xsl:text>
    20111999  <xsl:text>import java.util.List;&#10;</xsl:text>
    20122000
     
    20322020  </xsl:call-template>
    20332021
    2034   <xsl:text>import java.math.BigInteger;&#10;</xsl:text>
    20352022  <xsl:text>import java.util.List;&#10;</xsl:text>
    20362023
     
    22022189import java.lang.reflect.Constructor;
    22032190import java.lang.reflect.InvocationTargetException;
    2204 import java.math.BigInteger;
    22052191
    22062192public class Helper {
     
    22802266    }
    22812267
    2282     public static List<BigInteger> wrapUnsignedLongLong(double vals[]) {
    2283         List<BigInteger> ret = new ArrayList<BigInteger>(vals.length);
    2284         for (double v : vals) {
    2285                 ret.add(doubleToBigInteger(v));
    2286         }
    2287         return ret;
    2288     }
    2289 
    2290 
    22912268    public static short[] unwrap(List<Short> vals) {
    22922269        if (vals==null)
     
    24332410        return ret;
    24342411    }
    2435 
    2436     /* We do loose precision here */
    2437     public static BigInteger doubleToBigInteger(double val) {
    2438         return new BigInteger(Long.toString((long)val));
    2439     }
    2440     public static double bigIntegerToDouble(BigInteger val) {
    2441         return val.doubleValue();
    2442     }
    24432412}
    24442413]]></xsl:text>
     
    27022671import java.lang.reflect.Constructor;
    27032672import java.lang.reflect.InvocationTargetException;
    2704 import java.math.BigInteger;
    27052673import com.jacob.com.*;
    27062674
     
    27982766    }
    27992767
     2768    public static byte[] wrapBytes(SafeArray sa) {
     2769        if (sa==null)  return null;
     2770
     2771        int saLen = sa.getUBound() - sa.getLBound() + 1;
     2772
     2773        byte[] ret = new byte[saLen];
     2774        int j = 0;
     2775        for (int i = sa.getLBound(); i <= sa.getUBound(); i++)
     2776        {
     2777           Variant v = sa.getVariant(i);
     2778           // come upo with more effective approach!!!
     2779           ret[j++] = v.getByte();
     2780        }
     2781        return ret;
     2782    }
     2783
    28002784    @SuppressWarnings("unchecked")
    28012785    public static <T> List<T> wrap(Class<T> wrapperClass, SafeArray sa) {
     
    29432927        return ret;
    29442928    }
    2945 
    2946     public static BigInteger longToBigInteger(long value) {
    2947          return BigInteger.valueOf(value);
    2948     }
    2949 
     2929   
    29502930    /* We have very long invoke lists sometimes */
    29512931    public static Variant invoke(Dispatch d, String method, Object ... args)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette