Branch: Tag:

1999-10-08

1999-10-08 16:35:20 by Fredrik Noring <noring@nocrew.org>

A small step towards truly built-in bignums.

Rev: src/Makefile.in:1.157
Rev: src/acconfig.h:1.49
Rev: src/bignum.c:1.1
Rev: src/bignum.h:1.1
Rev: src/configure.in:1.322
Rev: src/modules/Gmp/mpz_glue.c:1.44
Rev: src/operators.c:1.61

1: + #include "global.h"    -  + #ifdef AUTO_BIGNUM +  + #include "interpret.h" + #include "program.h" + #include "object.h" + #include "svalue.h" + #include "error.h" +  + /* FIXME: Cache the mpz-function? */ + struct object *make_bignum_object(void) + { +  struct object *o; +  +  push_text("Gmp.mpz"); +  SAFE_APPLY_MASTER("resolv", 1); +  +  if(sp[-1].type != T_FUNCTION) +  error("Failed to resolv Gmp.mpz!\n"); +  +  stack_swap(); +  f_call_function(2); +  +  o = sp[-1].u.object; +  sp--; +  +  return o; + } +  + #if 0 /* Hubbe's example. */ +  + struct program *auto_bignum_program=0; +  + void exit_auto_bignum(void) + { +  if(auto_bignum_program) +  { +  free_program(auto_bignum_program); +  auto_bignum_program=0; +  } + } +  + struct program *get_auto_bignum_program() + { +  if(auto_bignum_program) +  return auto_bignum_program; +  +  push_text("Gmp.mpz"); +  APPLY_MASTER("resolv",1); +  if(sp[-1].type != T_PROGRAM) +  error("Failed to resolv Gmp.mpz!\n"); +  auto_bignum_program=sp[-1].u.program; +  sp--; + } + #endif +  + #endif /* AUTO_BIGNUM */   Newline at end of file added.