Mapping C long unsigned integer with swig for ruby

Hi everyone

I want to now how can I indicate to swig to consider a n unsigned long long
function input/output parameter as a ruby BigNum object.

with python, we use the typemap to do the conversion.: for example

/* Convert from Python --> C */
%typemap(in) int {
    $1 = PyInt_AsLong($input);
}

/* Convert from C --> Python */
%typemap(out) int {
    $result = PyInt_FromLong($1);

is there something equivalent with ruby

thank you

···

--

> Lyes Amazouz
> USTHB, Algiers

Hi,

At Fri, 14 Nov 2008 01:10:37 +0900,
Lyes Amazouz wrote in [ruby-talk:320166]:

I want to now how can I indicate to swig to consider a n unsigned long long
function input/output parameter as a ruby BigNum object.

Maybe:

/* Convert from Python --> C */
%typemap(in) int {

      $1 = ULL2NUM($input);

}

/* Convert from C --> Python */
%typemap(out) int {

      $result = NUM2ULL($1);

···

--
Nobu Nakada

Ok thank you, I will try that

···

On 11/13/08, Nobuyoshi Nakada <nobu@ruby-lang.org> wrote:

Hi,

At Fri, 14 Nov 2008 01:10:37 +0900,
Lyes Amazouz wrote in [ruby-talk:320166]:
> I want to now how can I indicate to swig to consider a n unsigned long
long
> function input/output parameter as a ruby BigNum object.

Maybe:

> /* Convert from Python --> C */
> %typemap(in) int {
     $1 = ULL2NUM($input);
> }
>
> /* Convert from C --> Python */
> %typemap(out) int {
     $result = NUM2ULL($1);

--
Nobu Nakada

--

  > Lyes Amazouz
  > USTHB, Algiers