diff --git a/src/bignum.c b/src/bignum.c index 03bc62583b52f8260e4bb150e6e9d0fc14fdc60e..2be5d67b016fefd7427731d5bc8a80c9770e8bc5 100644 --- a/src/bignum.c +++ b/src/bignum.c @@ -11,11 +11,13 @@ struct svalue auto_bignum_program = { T_INT }; int gmp_library_loaded=0; +int gmp_library_resolving=0; static void resolve_auto_bignum_program(void) { if(auto_bignum_program.type == T_INT) { + gmp_library_resolving=1; push_text("Gmp.bignum"); SAFE_APPLY_MASTER("resolv", 1); @@ -25,6 +27,7 @@ static void resolve_auto_bignum_program(void) auto_bignum_program=sp[-1]; sp--; dmalloc_touch_svalue(sp); + gmp_library_resolving=0; } } @@ -36,7 +39,7 @@ struct program *get_auto_bignum_program(void) struct program *get_auto_bignum_program_or_zero(void) { - if(!gmp_library_loaded) return 0; + if(!gmp_library_loaded || gmp_library_resolving) return 0; resolve_auto_bignum_program(); return program_from_function(&auto_bignum_program); } @@ -73,7 +76,8 @@ int is_bignum_object(struct object *o) * /Hubbe */ - if(!gmp_library_loaded) return 0; /* not possible */ + if(!gmp_library_loaded || gmp_library_resolving) + return 0; /* not possible */ resolve_auto_bignum_program(); return o->prog == program_from_function(&auto_bignum_program); diff --git a/src/builtin_functions.c b/src/builtin_functions.c index d90f36c345929b977db082805136a9f28a6301ed..72534daeb447f9392f5c50795af0e496de618423 100644 --- a/src/builtin_functions.c +++ b/src/builtin_functions.c @@ -5,7 +5,7 @@ \*/ /**/ #include "global.h" -RCSID("$Id: builtin_functions.c,v 1.204 1999/11/08 20:50:48 grubba Exp $"); +RCSID("$Id: builtin_functions.c,v 1.205 1999/11/12 07:33:36 hubbe Exp $"); #include "interpret.h" #include "svalue.h" #include "pike_macros.h" @@ -1962,7 +1962,11 @@ void f_objectp(INT32 args) { if(args<1) SIMPLE_TOO_FEW_ARGS_ERROR("objectp", 1); - if(sp[-args].type != T_OBJECT || !sp[-args].u.object->prog) + if(sp[-args].type != T_OBJECT || !sp[-args].u.object->prog +#ifdef AUTO_BIGNUM + || is_bignum_object(sp[-args].u.object) +#endif + ) { pop_n_elems(args); push_int(0); diff --git a/src/modules/Gmp/mpz_glue.c b/src/modules/Gmp/mpz_glue.c index b898f4d91688f1115a54e6aed545cb3d7d48228f..8ca4d7d5d6760391d4ef190b69af4594f8f0bc9a 100644 --- a/src/modules/Gmp/mpz_glue.c +++ b/src/modules/Gmp/mpz_glue.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: mpz_glue.c,v 1.65 1999/11/01 16:53:37 mirar Exp $"); +RCSID("$Id: mpz_glue.c,v 1.66 1999/11/12 07:33:45 hubbe Exp $"); #include "gmp_machine.h" #if defined(HAVE_GMP2_GMP_H) && defined(HAVE_LIBGMP2) @@ -370,6 +370,15 @@ static void mpzmod__sprintf(INT32 args) switch(sp[-args].u.integer) { +#ifdef AUTO_BIGNUM + case 't': + pop_n_elems(args); + if(THIS_PROGRAM == bignum_program) + push_constant_text("int"); + else + push_constant_text("object"); + return; +#endif case 'O': case 'u': /* Note: 'u' is not really supported. */ case 'd':