Sha256: 993e25d32d622023366b86599e60a60a3da94f9b24e176ab6868f164039bdd02

Contents?: true

Size: 875 Bytes

Versions: 2

Compression:

Stored size: 875 Bytes

Contents

#include "rshim.h"

#include <ruby.h>
#include <stdio.h>

/* void Init_rshim() { */
/*   printf("loaded, bitches\n"); */
/* } */

// did this really have to be a macro? BAD MATZ
unsigned int rtype(VALUE obj) {
  return TYPE(obj);
}

VALUE int2fix(long x) {
  // printf("long2fix called\n");
  return LONG2FIX(x);
}

long fix2int(VALUE x) {
  // printf("fix2long called\n");
  // return rb_num2int(x);
  return FIX2LONG(x);
  //return FIX2INT(x);
}

double num2dbl(VALUE x) {
  //  printf("num2dbl called\n");
  return NUM2DBL(x);
}

unsigned int rb_ary_len(VALUE x) {
  return RARRAY_LEN(x);
}

VALUE keys(VALUE hash) {
  rb_funcall(hash, rb_intern("keys"), 0);
}

VALUE buildException(char * message) {
  VALUE errclass = rb_eval_string("HaskellError");
  VALUE errobj = rb_exc_new2(errclass, message);
  return errobj;
}

char * str2cstr(VALUE v) {
  StringValuePtr(v);
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hubris-0.0.6 Haskell/cbits/rshim.c
hubris-0.0.5 Haskell/cbits/rshim.c