problem with integer in extension (still)

From: Sarah Officer <officers_at_nemesis.tucson.saic.com>
Date: Thu, 9 Nov 1995 13:27:52 -0700 (MST)

> In an earlier message, I wrote:
>
> I am running STk-2.2.0 on LINUX & SUN4 platforms, and I have written an
> extension that takes an integer for an argument.
>
> PRIMITIVE seek(SCM val)
> {
> long cval;
> cval = STk_integer_value(val); /* get the integer out */
> if (cval == LONG_MIN) { /* offset not an int */
> sprintf(buff, "val argument must be an integer");
> STk_err(buff, val);
> }
>
> ...
> }
>
> The routine works fine as long as val is less than 8388608. If it
> is equal or greater than this value, I get the "val argument must be
> an integer" error, even though (integer? 8388608) returns true. I
> looked at STk_integer_value in number.c, and it seems like the correct
> value should be returned for a number in this range regardless of whether
> it is an integer or a bignum. I looked for the values of LONG_MIN on
> both of my machines, and the value I am using doesn't begin to approach
> it.

Since I was somehow blind, it was pointed out to me that 8388608 is
0x800000, so the problem I am having is related to the largest size of
an STk integer. If I want to extract a long from an SCM object in C,
what is the best routine to use rather than STk_integer_value? What
does STk do internally which makes INTEGERP succeed on a number that
gets this large? Is there a quick fix?


Thanks,

Sarah Officer
officers_at_aries.tucson.saic.com
Received on Thu Nov 09 1995 - 21:24:34 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST