<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Barry,</p>
<p>The file
"${SWIG_INSTALL_PREFIX}/share/swig/{swig_version_here}/java/typemaps.i
seems to be the place where the default mappings from unsigned
long long to BigInteger are defined. I guess taking inspiration
from those typemaps and overriding them could be the way to go.</p>
<p>An alternative I'm thinking of would be to modify
MultiDimensional.i with something like the following (untested!
just to give the idea) added towards its top<br>
</p>
<p>#ifdef SWIGJAVA</p>
<p>// For practical reason we want Java long to be used instead of
default BigInteger. This approximation isn't much a problem since
there is no real use case to be able to address values in the
range [INT64_MAX, UINT64_MAX] for dimension sizes<br>
</p>
<p>typedef GInt64 MDimUInt64;</p>
<p>#else<br>
</p>
<p>typedef GUInt64 MDimUInt64;</p>
<p>#endif <br>
</p>
<p>and then replacing occurrences of GUInt64 (at least those dealing
with dimension sizes) with MDimUInt64</p>
<p>Not super pretty admitedly<br>
</p>
<p>Even<br>
</p>
<div class="moz-cite-prefix">Le 21/06/2023 à 19:34, Barry DeZonia a
écrit :<br>
</div>
<blockquote type="cite"
cite="mid:CAKcvfuTHfPfuOBH5FnOvy0S4kmOngJQ0_LvO7m7TM7-ZHGxFqA@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div dir="ltr">Thanks Even. I will try to throw that together
later. But I think my question is much more simple. I will
show a small blurb below from
swig/include/java/typemaps_java.i</div>
<div><br>
</div>
Code I have now follows right here. This code might conflict
with current code because I am wanting GUInt64s to go to longs
and not BigIntegers throughout the Java api. Note the code I
am at a loss as to how to write would be " Typemaps for GUInt64
* ". In other words a C array of GUInt64's which I'd like to
translate back and forth to long[]'s. Any example code would be
appreciated.
<div><br>
</div>
<div>/***************************************************<br>
* Typemaps for GUInt64<br>
***************************************************/<br>
<br>
%typemap(in) (GUInt64) "$1 = $input;"<br>
%typemap(out) (GUInt64) {<br>
/* %typemap(out) (GUInt64) */<br>
$result = result;<br>
}<br>
%typemap(jni) (GUInt64) "jlong"<br>
%typemap(jtype) (GUInt64) "long"<br>
%typemap(jstype) (GUInt64) "long"<br>
%typemap(javain) (GUInt64) "$javainput"<br>
%typemap(javaout) (GUInt64) {<br>
return $jnicall;<br>
}<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr"><br>
</div>
<div class="gmail_attr">I tried a similar template for
GUInt64* and made "jlong" into "jlongArray" and "long"
into "long[]" in those three places above but I have no
idea how to write the (javain) and (javaout) cases.</div>
</div>
</div>
</div>
</blockquote>
<p>For the direction Java Array -> C Array, I guess taking
inspiration from DEFINE_REGULAR_ARRAY_OUT(int64_t, jlong,
SetLongArrayRegion); should work</p>
<p><br>
</p>
<blockquote type="cite"
cite="mid:CAKcvfuTHfPfuOBH5FnOvy0S4kmOngJQ0_LvO7m7TM7-ZHGxFqA@mail.gmail.com">
<div dir="ltr">
<div>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr"><br>
</div>
<div dir="ltr" class="gmail_attr">On Wed, Jun 21, 2023 at
3:35 AM Even Rouault <<a
href="mailto:even.rouault@spatialys.com"
moz-do-not-send="true" class="moz-txt-link-freetext">even.rouault@spatialys.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">Barry,<br>
<br>
it could help if you could point to a public branch in
your github fork <br>
with your pending work<br>
<br>
Even<br>
<br>
Le 21/06/2023 à 07:58, Barry DeZonia a écrit :<br>
> Hello,<br>
><br>
> I am trying to work on the swig java api. I've made a
lot of progress <br>
> and am running into one last error before my code
completely compiles. <br>
> I am getting a swig complaint when passing a java
long[] to a C/C++ <br>
> call that is expecting GUInt64*.<br>
><br>
> Basically the error message is "long[] cannot be
converted to <br>
> SWIGTYPE_p_GUInt64". I've been reading and googling
and I can't figure <br>
> out how to modify typemaps_java.i to accomplish this.
I think it is a <br>
> simple thing but I am at a loss. Does anyone have any
tips?<br>
><br>
> _______________________________________________<br>
> gdal-dev mailing list<br>
> <a href="mailto:gdal-dev@lists.osgeo.org"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">gdal-dev@lists.osgeo.org</a><br>
> <a
href="https://lists.osgeo.org/mailman/listinfo/gdal-dev"
rel="noreferrer" target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
<br>
-- <br>
<a href="http://www.spatialys.com" rel="noreferrer"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">http://www.spatialys.com</a><br>
My software is free, but my time generally not.<br>
<br>
</blockquote>
</div>
</div>
</div>
</blockquote>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</body>
</html>