> > I've been working on implementing plgfci and plsfci in the fortran > bindings, starting with f95. Unfortunately fortran does not support > unsigned integers so PLUNICODE has to be cast to an 64 bit integer in > fortran. I've created a plunicode type, similar to plflt, to make this > transparent in fortran 95. The conversion is done in the C code and > current works if C long is 64 bit (ok on most platforms, but not > guaranteed). Ideally I would use int64_t but this is none standard. > > Does anyone have a neater solution to this problem? If not I'll try and > do the same for the f77 bindings. My implementation works fine with > gfortran but I'd be keen to know it is ok with other compilers. Example > 23 tests these functions out. > > I've been banging my head against the wall with these unsigned issues > for several languages. With hindsight it maybe wasn't the best design > decision given the number of languages we support and the number of > those which don't have unsigned integers. It would even be ok if we > didn't use the highest bit since we could just ignore the sign then. > It's a bit late to change things now though. >
For Fortran 95 a solution might be to create a user-defined type like: type UNSIGNED integer :: value end type and define appropriate operations for it. That way you can hide the complications in the PLplot library. But it will not solve the problems for FORTRAN 77 (or for other languages that do not support unsigned integers). Could a workaround be to use double precision reals instead? The precision is large enough to hold any 32-bits unsigned integer exactly. Regards, Arjen ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel