From 5923b1c17f233fce16db651ef236b488e52d0fed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net> Date: Thu, 6 Jul 2000 17:50:10 -0700 Subject: [PATCH] jumbopatch! Rev: bin/precompile.pike:1.12 Rev: src/error.h:1.45 Rev: src/interpret.h:1.45 Rev: src/modules/HTTPLoop/cache.c:1.11 Rev: src/modules/HTTPLoop/timeout.c:1.5 Rev: src/modules/Image/encodings/tga.c:1.15 Rev: src/modules/Image/encodings/xbm.c:1.9 Rev: src/modules/Image/layers.c:1.44 Rev: src/modules/Oracle/oracle.c:1.43 Rev: src/modules/files/file.c:1.177 Rev: src/threads.h:1.95 --- bin/precompile.pike | 8 +- src/error.h | 55 +++++----- src/interpret.h | 59 ++++------- src/modules/HTTPLoop/cache.c | 2 +- src/modules/HTTPLoop/timeout.c | 2 +- src/modules/Image/encodings/tga.c | 47 ++++----- src/modules/Image/encodings/xbm.c | 74 +++++++------- src/modules/Image/layers.c | 100 +++++++++--------- src/modules/Oracle/oracle.c | 82 +++++++-------- src/modules/files/file.c | 162 +++++++++++++++--------------- src/threads.h | 94 +++++++---------- 11 files changed, 326 insertions(+), 359 deletions(-) diff --git a/bin/precompile.pike b/bin/precompile.pike index 9e3f069c7b..7d7781e545 100644 --- a/bin/precompile.pike +++ b/bin/precompile.pike @@ -504,7 +504,7 @@ array convert(array x, string base) { default: ret+=({ - PC.Token(sprintf("if(Pike_interpreter.stack_pointer[%d].type != PIKE_T_%s)", + PC.Token(sprintf("if(Pike_sp[%d].type != PIKE_T_%s)", sp,upper_case(arg->basetype->text)),arg->line) }); break; @@ -536,13 +536,13 @@ array convert(array x, string base) { case "int": ret+=({ - sprintf("%s=Pike_interpreter.stack_pointer[%d].u.integer;\n",arg->name,sp) + sprintf("%s=Pike_sp[%d].u.integer;\n",arg->name,sp) }); break; case "float": ret+=({ - sprintf("%s=Pike_interpreter.stack_pointer[%d].u.float_number;\n", + sprintf("%s=Pike_sp[%d].u.float_number;\n", arg->name, sp) }); @@ -559,7 +559,7 @@ array convert(array x, string base) default: ret+=({ - PC.Token(sprintf("debug_malloc_pass(%s=Pike_interpreter.stack_pointer[%d].u.%s);\n", + PC.Token(sprintf("debug_malloc_pass(%s=Pike_sp[%d].u.%s);\n", arg->name, sp, arg->basetype),arg->line) diff --git a/src/error.h b/src/error.h index 273439cc4a..e4cc9060b1 100644 --- a/src/error.h +++ b/src/error.h @@ -5,7 +5,7 @@ \*/ /* - * $Id: error.h,v 1.44 2000/06/05 14:29:11 grubba Exp $ + * $Id: error.h,v 1.45 2000/07/07 00:21:48 hubbe Exp $ */ #ifndef ERROR_H #define ERROR_H @@ -58,9 +58,9 @@ typedef struct JMP_BUF { struct JMP_BUF *previous; jmp_buf recovery; - struct pike_frame *Pike_fp; - INT32 Pike_sp; - INT32 Pike_mark_sp; + struct pike_frame *frame_pointer; + INT32 stack_pointer; + INT32 mark_sp; INT32 severity; ONERROR *onerror; #ifdef PIKE_DEBUG @@ -69,7 +69,6 @@ typedef struct JMP_BUF #endif } JMP_BUF; -extern JMP_BUF *recoveries; extern struct svalue throw_value; extern int throw_severity; @@ -78,13 +77,13 @@ extern int throw_severity; check_recovery_context(); \ OED_FPRINTF((stderr, "unsetjmp(%p) %s:%d\n", \ &(X), __FILE__, __LINE__)); \ - if(recoveries != &X) { \ - if(recoveries) \ - fatal("UNSETJMP out of sync! (last SETJMP at %s:%d)!\n",recoveries->file,recoveries->line); \ + if(Pike_interpreter.recoveries != &X) { \ + if(Pike_interpreter.recoveries) \ + fatal("UNSETJMP out of sync! (last SETJMP at %s:%d)!\n",Pike_interpreter.recoveries->file,Pike_interpreter.recoveries->line); \ else \ - fatal("UNSETJMP out of sync! (recoveries = 0)\n"); \ + fatal("UNSETJMP out of sync! (Pike_interpreter.recoveries = 0)\n"); \ } \ - recoveries=X.previous; \ + Pike_interpreter.recoveries=X.previous; \ check_recovery_context(); \ }while (0) #define DEBUG_LINE_ARGS ,int line, char *file @@ -92,7 +91,7 @@ extern int throw_severity; #else #define DEBUG_LINE_ARGS #define SETJMP(X) setjmp((init_recovery(&X)->recovery)) -#define UNSETJMP(X) recoveries=X.previous +#define UNSETJMP(X) Pike_interpreter.recoveries=X.previous #endif @@ -105,36 +104,36 @@ extern int throw_severity; X.func=(error_call)(Y); \ DO_IF_DMALLOC( if( X.func == free ) X.func=dmalloc_free;) \ X.arg=(void *)(Z); \ - if(!recoveries) break; \ - X.previous=recoveries->onerror; \ + if(!Pike_interpreter.recoveries) break; \ + X.previous=Pike_interpreter.recoveries->onerror; \ X.file = __FILE__; \ X.line = __LINE__; \ - recoveries->onerror=&X; \ + Pike_interpreter.recoveries->onerror=&X; \ }while(0) #define UNSET_ONERROR(X) do {\ check_recovery_context(); \ OED_FPRINTF((stderr, "UNSET_ONERROR(%p) %s:%d\n", \ &(X), __FILE__, __LINE__)); \ - if(!recoveries) break; \ - if(recoveries->onerror != &(X)) { \ - fprintf(stderr,"LAST SETJMP: %s:%d\n",recoveries->file,recoveries->line); \ - if (recoveries->onerror) { \ + if(!Pike_interpreter.recoveries) break; \ + if(Pike_interpreter.recoveries->onerror != &(X)) { \ + fprintf(stderr,"LAST SETJMP: %s:%d\n",Pike_interpreter.recoveries->file,Pike_interpreter.recoveries->line); \ + if (Pike_interpreter.recoveries->onerror) { \ fatal("UNSET_ONERROR out of sync (%p != %p).\n" \ "Last SET_ONERROR is from %s:%d\n",\ - recoveries->onerror, &(X), \ - recoveries->onerror->file, recoveries->onerror->line ); \ + Pike_interpreter.recoveries->onerror, &(X), \ + Pike_interpreter.recoveries->onerror->file, Pike_interpreter.recoveries->onerror->line ); \ } else { \ - fatal("UNSET_ONERROR out of sync. No recoveries left.\n"); \ + fatal("UNSET_ONERROR out of sync. No Pike_interpreter.recoveries left.\n"); \ } \ } \ - recoveries->onerror=(X).previous; \ + Pike_interpreter.recoveries->onerror=(X).previous; \ } while(0) #define ASSERT_ONERROR(X) \ do{ \ - if (!recoveries) break; \ - if (recoveries->onerror != &X) { \ + if (!Pike_interpreter.recoveries) break; \ + if (Pike_interpreter.recoveries->onerror != &X) { \ fatal("%s:%d ASSERT_ONERROR(%p) failed\n", \ __FILE__, __LINE__, &(X)); \ } \ @@ -144,12 +143,12 @@ extern int throw_severity; do{ \ X.func=(error_call)(Y); \ X.arg=(void *)(Z); \ - if(!recoveries) break; \ - X.previous=recoveries->onerror; \ - recoveries->onerror=&X; \ + if(!Pike_interpreter.recoveries) break; \ + X.previous=Pike_interpreter.recoveries->onerror; \ + Pike_interpreter.recoveries->onerror=&X; \ }while(0) -#define UNSET_ONERROR(X) recoveries && (recoveries->onerror=X.previous) +#define UNSET_ONERROR(X) Pike_interpreter.recoveries && (Pike_interpreter.recoveries->onerror=X.previous) #define ASSERT_ONERROR(X) #endif /* PIKE_DEBUG */ diff --git a/src/interpret.h b/src/interpret.h index 7f924165c8..81a0e33f67 100644 --- a/src/interpret.h +++ b/src/interpret.h @@ -5,35 +5,27 @@ \*/ /* - * $Id: interpret.h,v 1.44 2000/06/24 07:20:27 hubbe Exp $ + * $Id: interpret.h,v 1.45 2000/07/07 00:21:48 hubbe Exp $ */ #ifndef INTERPRET_H #define INTERPRET_H #include "global.h" #include "program.h" -#include "threads.h" - +#include "error.h" struct Pike_interpreter { - char swapped; - char status; -#ifdef PIKE_THREADS - COND_T status_change; - THREAD_T id; -#endif - struct Pike_interpreter *hashlink, **backlink; - struct mapping *thread_local; - /* Swapped variables */ - struct svalue *Pike_sp,*Pike_evaluator_stack; - struct svalue **Pike_mark_sp,**Pike_mark_stack; - struct pike_frame *Pike_fp; + struct svalue *stack_pointer; + struct svalue *evaluator_stack; + struct svalue **mark_sp; + struct svalue **mark_stack; + struct pike_frame *frame_pointer; int evaluator_stack_malloced; int mark_stack_malloced; JMP_BUF *recoveries; struct object * thread_id; - char *Pike_stack_top; + char *stack_top; DO_IF_SECURITY(struct object *current_creds;) #ifdef PROFILING @@ -70,7 +62,7 @@ struct pike_frame }; #ifdef PIKE_DEBUG -#define debug_check_stack() do{if(Pike_sp<Pike_evaluator_stack)fatal("Stack error.\n");}while(0) +#define debug_check_stack() do{if(Pike_sp<Pike_interpreter.evaluator_stack)fatal("Stack error.\n");}while(0) #define check__positive(X,Y) if((X)<0) fatal Y #include "error.h" #else @@ -79,19 +71,19 @@ struct pike_frame #endif #define check_stack(X) do { \ - if(Pike_sp - Pike_evaluator_stack + (X) >= Pike_stack_size) \ + if(Pike_sp - Pike_interpreter.evaluator_stack + (X) >= Pike_stack_size) \ error("Svalue stack overflow. " \ "(%d of %d entries on stack, needed %d more entries)\n", \ - Pike_sp-Pike_evaluator_stack,Pike_stack_size,(X)); \ + Pike_sp-Pike_interpreter.evaluator_stack,Pike_stack_size,(X)); \ }while(0) #define check_mark_stack(X) do { \ - if(Pike_mark_sp - Pike_mark_stack + (X) >= Pike_stack_size) \ + if(Pike_interpreter.mark_sp - Pike_interpreter.mark_stack + (X) >= Pike_stack_size) \ error("Mark stack overflow.\n"); \ }while(0) #define check_c_stack(X) do { \ - long x_= ((char *)&x_) + STACK_DIRECTION * (X) - Pike_stack_top ; \ + long x_= ((char *)&x_) + STACK_DIRECTION * (X) - Pike_interpreter.stack_top ; \ x_*=STACK_DIRECTION; \ if(x_>0) \ low_error("C stack overflow.\n"); \ @@ -245,34 +237,23 @@ void cleanup_interpret(void); void really_clean_up_interpret(void); /* Prototypes end here */ -extern struct svalue *Pike_sp; -extern struct svalue **Pike_mark_sp; -extern struct svalue *Pike_evaluator_stack; -extern struct svalue **Pike_mark_stack; -extern struct pike_frame *Pike_fp; /* pike_frame pointer */ -extern char *Pike_stack_top; extern int Pike_stack_size; -extern int evaluator_stack_malloced, mark_stack_malloced; struct callback; extern struct callback_list evaluator_callbacks; extern void call_callback(struct callback_list *, void *); -#ifdef PROFILING -#ifdef HAVE_GETHRTIME -extern long long accounted_time; -extern long long time_base; -#endif -#endif +extern struct Pike_interpreter Pike_interpreter; + +#define Pike_sp Pike_interpreter.stack_pointer +#define Pike_fp Pike_interpreter.frame_pointer + #ifndef NO_PIKE_SHORTHAND +/* Shouldn't this be in Pike_interpreter? - Hubbe */ +#define stack_size Pike_stack_size #define sp Pike_sp #define fp Pike_fp -#define evaluator_stack Pike_evaluator_stack -#define stack_top Pike_stack_top -#define mark_sp Pike_mark_sp -#define mark_stack Pike_mark_stack -#define stack_size Pike_stack_size #endif /* !NO_PIKE_SHORTHAND */ diff --git a/src/modules/HTTPLoop/cache.c b/src/modules/HTTPLoop/cache.c index 2ba32ebc2e..cfe12688d1 100644 --- a/src/modules/HTTPLoop/cache.c +++ b/src/modules/HTTPLoop/cache.c @@ -77,7 +77,7 @@ static void really_free_from_queue() static int ensure_interpreter_lock( ) { - struct Pike_interpreter *thi; + struct thread_state *thi; int free=0; if( (thi = thread_state_for_id( th_self() )) ) { diff --git a/src/modules/HTTPLoop/timeout.c b/src/modules/HTTPLoop/timeout.c index 261e40001f..039802c02d 100644 --- a/src/modules/HTTPLoop/timeout.c +++ b/src/modules/HTTPLoop/timeout.c @@ -209,7 +209,7 @@ void aap_exit_timeouts(void) fprintf(stderr, "AAP: aap_exit_timeouts.\n"); #endif /* AAP_DEBUG */ aap_time_to_die = 1; - if (thread_id) { + if (Pike_interpreter.thread_id) { THREADS_ALLOW(); th_join(aap_timeout_thread, &res); THREADS_DISALLOW(); diff --git a/src/modules/Image/encodings/tga.c b/src/modules/Image/encodings/tga.c index 7242f18fc4..4d83c541b1 100644 --- a/src/modules/Image/encodings/tga.c +++ b/src/modules/Image/encodings/tga.c @@ -1,6 +1,6 @@ /* - * $Id: tga.c,v 1.14 2000/05/10 02:13:22 mast Exp $ + * $Id: tga.c,v 1.15 2000/07/07 00:41:46 hubbe Exp $ * * Targa codec for pike. Based on the tga plugin for gimp. * @@ -32,6 +32,7 @@ **! submodule TGA **! */ +#define NO_PIKE_SHORTHAND #include "global.h" @@ -76,7 +77,7 @@ #include "image.h" #include "colortable.h" -RCSID("$Id: tga.c,v 1.14 2000/05/10 02:13:22 mast Exp $"); +RCSID("$Id: tga.c,v 1.15 2000/07/07 00:41:46 hubbe Exp $"); #ifndef MIN # define MIN(X,Y) ((X)<(Y)?(X):(Y)) @@ -707,23 +708,23 @@ static struct image_alpha ReadImage(struct buffer *fp, struct tga_header *hdr) { apply( i.io, "mirrorx", 0 ); free_object(i.io); - i.io = sp[-1].u.object; - sp--; + i.io = Pike_sp[-1].u.object; + Pike_sp--; apply( i.ao, "mirrorx", 0 ); free_object(i.ao); - i.ao = sp[-1].u.object; - sp--; + i.ao = Pike_sp[-1].u.object; + Pike_sp--; } if(vertrev) { apply( i.io, "mirrory", 0 ); free_object(i.io); - i.io = sp[-1].u.object; - sp--; + i.io = Pike_sp[-1].u.object; + Pike_sp--; apply( i.ao, "mirrory", 0 ); free_object(i.ao); - i.ao = sp[-1].u.object; - sp--; + i.ao = Pike_sp[-1].u.object; + Pike_sp--; } return i; } @@ -957,9 +958,9 @@ void image_tga_encode( INT32 args ) if (!args) error("Image.TGA.encode: too few arguments\n"); - if (sp[-args].type!=T_OBJECT || + if (Pike_sp[-args].type!=PIKE_T_OBJECT || !(img=(struct image*) - get_storage(sp[-args].u.object,image_program))) + get_storage(Pike_sp[-args].u.object,image_program))) error("Image.TGA.encode: illegal argument 1\n"); if (!img->img) @@ -967,17 +968,17 @@ void image_tga_encode( INT32 args ) if (args>1) { - if (sp[1-args].type!=T_MAPPING) + if (Pike_sp[1-args].type!=PIKE_T_MAPPING) error("Image.TGA.encode: illegal argument 2\n"); - push_svalue(sp+1-args); + push_svalue(Pike_sp+1-args); ref_push_string(param_alpha); f_index(2); - if (!(sp[-1].type==T_INT - && sp[-1].subtype==NUMBER_UNDEFINED)) - if (sp[-1].type!=T_OBJECT || + if (!(Pike_sp[-1].type==PIKE_T_INT + && Pike_sp[-1].subtype==NUMBER_UNDEFINED)) + if (Pike_sp[-1].type!=PIKE_T_OBJECT || !(alpha=(struct image*) - get_storage(sp[-1].u.object,image_program))) + get_storage(Pike_sp[-1].u.object,image_program))) error("Image.TGA.encode: option (arg 2) \"alpha\" has illegal type\n"); pop_stack(); @@ -988,10 +989,10 @@ void image_tga_encode( INT32 args ) if (alpha && !alpha->img) error("Image.TGA.encode option (arg 2) \"alpha\"; no image\n"); - push_svalue(sp+1-args); + push_svalue(Pike_sp+1-args); ref_push_string(param_raw); f_index(2); - rle = !sp[-1].u.integer; + rle = !Pike_sp[-1].u.integer; pop_stack(); } @@ -1005,11 +1006,11 @@ void image_tga_encode( INT32 args ) static struct program *image_encoding_tga_program=NULL; void init_image_tga( ) { - add_function( "_decode", image_tga__decode, + pike_add_function( "_decode", image_tga__decode, "function(string:mapping(string:object))", 0); - add_function( "decode", image_tga_decode, + pike_add_function( "decode", image_tga_decode, "function(string:object)", 0); - add_function( "encode", image_tga_encode, + pike_add_function( "encode", image_tga_encode, "function(object,mapping|void:string)", 0); param_alpha=make_shared_string("alpha"); diff --git a/src/modules/Image/encodings/xbm.c b/src/modules/Image/encodings/xbm.c index e4d3e8ac9d..0c71940a0d 100644 --- a/src/modules/Image/encodings/xbm.c +++ b/src/modules/Image/encodings/xbm.c @@ -1,5 +1,7 @@ #include "global.h" -RCSID("$Id: xbm.c,v 1.8 2000/06/09 22:06:05 mast Exp $"); +RCSID("$Id: xbm.c,v 1.9 2000/07/07 00:42:24 hubbe Exp $"); + +#define NO_PIKE_SHORTHAND #include "image_machine.h" @@ -259,50 +261,50 @@ static void image_xbm__decode( INT32 args ) if (args>1) { - if (sp[1-args].type!=T_MAPPING) + if (Pike_sp[1-args].type!=PIKE_T_MAPPING) error("Image.XBM._decode: illegal argument 2\n"); - push_svalue(sp+1-args); + push_svalue(Pike_sp+1-args); ref_push_string(param_fg); f_index(2); - if(!IS_ZERO(sp-1)) + if(!IS_ZERO(Pike_sp-1)) { - if(sp[-1].type != T_ARRAY || sp[-1].u.array->size != 3) + if(Pike_sp[-1].type != PIKE_T_ARRAY || Pike_sp[-1].u.array->size != 3) error("Wrong type for foreground. Should be array(int(0..255))" " with 3 elements\n"); for(ele=0; ele<3; ele++) - if(sp[-1].u.array->item[ele].type != T_INT - ||sp[-1].u.array->item[ele].u.integer < 0 - ||sp[-1].u.array->item[ele].u.integer > 255) + if(Pike_sp[-1].u.array->item[ele].type != PIKE_T_INT + ||Pike_sp[-1].u.array->item[ele].u.integer < 0 + ||Pike_sp[-1].u.array->item[ele].u.integer > 255) error("Wrong type for foreground. Should be array(int(0..255))" " with 3 elements\n"); - fg = sp[-1].u.array; + fg = Pike_sp[-1].u.array; } - sp--; + Pike_sp--; - push_svalue(sp+1-args); + push_svalue(Pike_sp+1-args); ref_push_string(param_bg); f_index(2); - if(!IS_ZERO(sp-1)) + if(!IS_ZERO(Pike_sp-1)) { - if(sp[-1].type != T_ARRAY || sp[-1].u.array->size != 3) + if(Pike_sp[-1].type != PIKE_T_ARRAY || Pike_sp[-1].u.array->size != 3) error("Wrong type for background. Should be array(int(0..255))" " with 3 elements\n"); for(ele=0; ele<3; ele++) - if(sp[-1].u.array->item[ele].type != T_INT - ||sp[-1].u.array->item[ele].u.integer < 0 - ||sp[-1].u.array->item[ele].u.integer > 255) + if(Pike_sp[-1].u.array->item[ele].type != PIKE_T_INT + ||Pike_sp[-1].u.array->item[ele].u.integer < 0 + ||Pike_sp[-1].u.array->item[ele].u.integer > 255) error("Wrong type for background. Should be array(int(0..255))" " with 3 elements\n"); - bg = sp[-1].u.array; + bg = Pike_sp[-1].u.array; } - sp--; + Pike_sp--; - push_svalue(sp+1-args); + push_svalue(Pike_sp+1-args); ref_push_string(param_invert); f_index(2); - invert = !IS_ZERO(sp-1); - sp--; + invert = !IS_ZERO(Pike_sp-1); + Pike_sp--; } a = load_xbm( data ); @@ -312,8 +314,8 @@ static void image_xbm__decode( INT32 args ) if(invert) { apply(a, "invert", 0); - i = (struct object *)debug_malloc_pass(sp[-1].u.object); - sp--; + i = (struct object *)debug_malloc_pass(Pike_sp[-1].u.object); + Pike_sp--; } else { @@ -327,8 +329,8 @@ static void image_xbm__decode( INT32 args ) push_int(255); push_int(255); f_aggregate(3); - bg = (struct array *)debug_malloc_pass(sp[-1].u.array); - sp--; + bg = (struct array *)debug_malloc_pass(Pike_sp[-1].u.array); + Pike_sp--; } if(invert) { @@ -387,9 +389,9 @@ void image_xbm_encode( INT32 args ) if (!args) error("Image.XBM.encode: too few arguments\n"); - if (sp[-args].type!=T_OBJECT || + if (Pike_sp[-args].type!=PIKE_T_OBJECT || !(img=(struct image*) - get_storage(sp[-args].u.object,image_program))) + get_storage(Pike_sp[-args].u.object,image_program))) error("Image.XBM.encode: illegal argument 1\n"); if (!img->img) @@ -397,17 +399,17 @@ void image_xbm_encode( INT32 args ) if (args>1) { - if (sp[1-args].type!=T_MAPPING) + if (Pike_sp[1-args].type!=PIKE_T_MAPPING) error("Image.XBM.encode: illegal argument 2\n"); - push_svalue(sp+1-args); + push_svalue(Pike_sp+1-args); ref_push_string(param_name); f_index(2); - if(sp[-1].type == T_STRING) + if(Pike_sp[-1].type == PIKE_T_STRING) { - if(sp[-1].u.string->size_shift) + if(Pike_sp[-1].u.string->size_shift) error("The name of the image must be a normal non-wide string (sorry, not my fault)\n"); - name = sp[-1].u.string; + name = Pike_sp[-1].u.string; } pop_stack(); } @@ -419,13 +421,13 @@ void image_xbm_encode( INT32 args ) static struct program *image_encoding_xbm_program=NULL; -void init_image_xbm( ) +void init_image_xbm(void) { - add_function( "_decode", image_xbm__decode, + pike_add_function( "_decode", image_xbm__decode, "function(string,mapping|void:mapping(string:object))", 0); - add_function( "decode", image_xbm_decode, + pike_add_function( "decode", image_xbm_decode, "function(string:object)", 0); - add_function( "encode", image_xbm_encode, + pike_add_function( "encode", image_xbm_encode, "function(object,mapping|void:string)", 0); param_name=make_shared_string("name"); param_fg=make_shared_string("fg"); diff --git a/src/modules/Image/layers.c b/src/modules/Image/layers.c index 63d8ab4099..69e55b00d9 100644 --- a/src/modules/Image/layers.c +++ b/src/modules/Image/layers.c @@ -1,7 +1,7 @@ /* **! module Image **! note -**! $Id: layers.c,v 1.43 2000/02/22 03:41:27 per Exp $ +**! $Id: layers.c,v 1.44 2000/07/07 00:40:19 hubbe Exp $ **! class Layer **! see also: layers **! @@ -215,7 +215,7 @@ #include <math.h> /* floor */ -RCSID("$Id: layers.c,v 1.43 2000/02/22 03:41:27 per Exp $"); +RCSID("$Id: layers.c,v 1.44 2000/07/07 00:40:19 hubbe Exp $"); #include "image_machine.h" @@ -296,8 +296,8 @@ struct layer }; #undef THIS -#define THIS ((struct layer *)(fp->current_storage)) -#define THISOBJ (fp->current_object) +#define THIS ((struct layer *)(Pike_fp->current_storage)) +#define THISOBJ (Pike_fp->current_object) #define LMFUNC(X) \ static void X(rgb_group *s,rgb_group *l,rgb_group *d, \ @@ -586,14 +586,18 @@ static INLINE void smear_color(rgb_group *d,rgb_group s,int len) #define MAX3(X,Y,Z) MAXIMUM(MAXIMUM(X,Y),Z) #define MIN3(X,Y,Z) MINIMUM(MINIMUM(X,Y),Z) -static INLINE void rgb_to_hsv(rgb_group color,double *hp,double *sp,double *vp) +/* Pike_sp was renamed to not_sp by hubbe */ +static INLINE void rgb_to_hsv(rgb_group color, + double *hp, + double *not_sp, + double *vp) { double max,min,delta; double r,g,b; if (color.r==color.g && color.g==color.b) { - *hp=*sp=0.0; + *hp=*not_sp=0.0; *vp=C2F(color.r); return; } @@ -607,7 +611,7 @@ static INLINE void rgb_to_hsv(rgb_group color,double *hp,double *sp,double *vp) *vp = max; - *sp = (max - min)/max; + *not_sp = (max - min)/max; delta = max-min; @@ -733,17 +737,17 @@ static void image_layer_set_image(INT32 args) THIS->alp=NULL; if (args>=1) - if ( sp[-args].type!=T_OBJECT ) + if ( Pike_sp[-args].type!=T_OBJECT ) { - if (sp[-args].type!=T_INT || - sp[-args].u.integer!=0) + if (Pike_sp[-args].type!=T_INT || + Pike_sp[-args].u.integer!=0) SIMPLE_BAD_ARG_ERROR("Image.Layer->set_image",1, "object(Image)|int(0)"); } else if ((img=(struct image*) - get_storage(sp[-args].u.object,image_program))) + get_storage(Pike_sp[-args].u.object,image_program))) { - THIS->image=sp[-args].u.object; + THIS->image=Pike_sp[-args].u.object; add_ref(THIS->image); THIS->img=img; THIS->xsize=img->xsize; @@ -754,15 +758,15 @@ static void image_layer_set_image(INT32 args) "object(Image)|int(0)"); if (args>=2) - if ( sp[1-args].type!=T_OBJECT ) + if ( Pike_sp[1-args].type!=T_OBJECT ) { - if (sp[1-args].type!=T_INT || - sp[1-args].u.integer!=0) + if (Pike_sp[1-args].type!=T_INT || + Pike_sp[1-args].u.integer!=0) SIMPLE_BAD_ARG_ERROR("Image.Layer->set_image",2, "object(Image)|int(0)"); } else if ((img=(struct image*) - get_storage(sp[1-args].u.object,image_program))) + get_storage(Pike_sp[1-args].u.object,image_program))) { if (THIS->img && (img->xsize!=THIS->xsize || @@ -774,7 +778,7 @@ static void image_layer_set_image(INT32 args) THIS->xsize=img->xsize; THIS->ysize=img->ysize; } - THIS->alpha=sp[1-args].u.object; + THIS->alpha=Pike_sp[1-args].u.object; add_ref(THIS->alpha); THIS->alp=img; } @@ -816,7 +820,7 @@ static void image_layer_set_misc_value( INT32 args ) if( !THIS->misc ) THIS->misc = allocate_mapping( 4 ); - mapping_insert( THIS->misc, sp-2, sp-1 ); + mapping_insert( THIS->misc, Pike_sp-2, Pike_sp-1 ); stack_swap(); pop_stack(); } @@ -918,11 +922,11 @@ static void image_layer_set_mode(INT32 args) int i; if (args!=1) SIMPLE_TOO_FEW_ARGS_ERROR("Image.Layer->set_mode",1); - if (sp[-args].type!=T_STRING) + if (Pike_sp[-args].type!=T_STRING) SIMPLE_BAD_ARG_ERROR("Image.Layer->set_mode",1,"string"); for (i=0; i<LAYER_MODES; i++) - if (sp[-args].u.string==layer_mode[i].ps) + if (Pike_sp[-args].u.string==layer_mode[i].ps) { THIS->row_func=layer_mode[i].func; THIS->optimize_alpha=layer_mode[i].optimize_alpha; @@ -988,7 +992,7 @@ static void image_layer_set_fill(INT32 args) if (!args) SIMPLE_TOO_FEW_ARGS_ERROR("Image.Layer->set_fill",1); - if (sp[-args].type==T_INT && !sp[-args].u.integer) + if (Pike_sp[-args].type==T_INT && !Pike_sp[-args].u.integer) THIS->fill=black; else if (!image_color_arg(-args,&(THIS->fill))) @@ -998,7 +1002,7 @@ static void image_layer_set_fill(INT32 args) THIS->fill_alpha=white; if (args>1) - if (sp[1-args].type==T_INT && !sp[1-args].u.integer) + if (Pike_sp[1-args].type==T_INT && !Pike_sp[1-args].u.integer) ; /* white is good */ else if (!image_color_arg(1-args,&(THIS->fill_alpha))) @@ -1169,7 +1173,7 @@ static INLINE void try_parameter(char *a,void (*f)(INT32)) push_text(a); f_index(2); - if (!IS_UNDEFINED(sp-1)) + if (!IS_UNDEFINED(Pike_sp-1)) f(1); pop_stack(); } @@ -1184,8 +1188,8 @@ static INLINE void try_parameter_pair(char *a,char *b,void (*f)(INT32)) push_text(b); /* map map[a] map b */ f_index(2); /* map map[a] map[b] */ - if (!IS_UNDEFINED(sp-2) || - !IS_UNDEFINED(sp-1)) + if (!IS_UNDEFINED(Pike_sp-2) || + !IS_UNDEFINED(Pike_sp-1)) { f(2); pop_stack(); @@ -1198,7 +1202,7 @@ static void image_layer_create(INT32 args) { if (!args) return; - if (sp[-args].type==T_MAPPING) + if (Pike_sp[-args].type==T_MAPPING) { pop_n_elems(args-1); try_parameter_pair("image","alpha",image_layer_set_image); @@ -1212,8 +1216,8 @@ static void image_layer_create(INT32 args) pop_stack(); return; } - else if (sp[-args].type==T_INT && args>1 - && sp[1-args].type==T_INT) + else if (Pike_sp[-args].type==T_INT && args>1 + && Pike_sp[1-args].type==T_INT) { rgb_group col=black,alpha=white; @@ -1244,7 +1248,7 @@ static void image_layer_create(INT32 args) pop_n_elems(args); } - else if (sp[-args].type==T_OBJECT || args>1) + else if (Pike_sp[-args].type==T_OBJECT || args>1) { if (args>2) { @@ -1265,9 +1269,9 @@ static void image_layer_cast(INT32 args) { if (!args) SIMPLE_TOO_FEW_ARGS_ERROR("Image.Layer->cast",1); - if (sp[-args].type==T_STRING||sp[-args].u.string->size_shift) + if (Pike_sp[-args].type==T_STRING||Pike_sp[-args].u.string->size_shift) { - if (strncmp(sp[-args].u.string->str,"mapping",7)==0) + if (strncmp(Pike_sp[-args].u.string->str,"mapping",7)==0) { int n=0; pop_n_elems(args); @@ -2526,7 +2530,7 @@ void image_lay(INT32 args) if (!args) SIMPLE_TOO_FEW_ARGS_ERROR("Image.lay",1); - if (sp[-args].type!=T_ARRAY) + if (Pike_sp[-args].type!=T_ARRAY) SIMPLE_BAD_ARG_ERROR("Image.lay",1, "array(Image.Layer|mapping)"); @@ -2540,7 +2544,7 @@ void image_lay(INT32 args) SIMPLE_BAD_ARG_ERROR("Image.lay",5,"int(1..)"); } - layers=(a=sp[-args].u.array)->size; + layers=(a=Pike_sp[-args].u.array)->size; if (!layers) /* dummy return empty layer */ { @@ -2620,7 +2624,7 @@ void image_lay(INT32 args) free(l); - sp--; + Pike_sp--; pop_n_elems(args); push_object(o); } @@ -2630,7 +2634,7 @@ void image_lay(INT32 args) static INLINE struct layer *push_new_layer() { push_object(clone_object(image_layer_program,0)); - return (struct layer*)get_storage(sp[-1].u.object,image_layer_program); + return (struct layer*)get_storage(Pike_sp[-1].u.object,image_layer_program); } static INLINE struct layer *clone_this_layer() @@ -2722,8 +2726,8 @@ static void image_layer_crop(INT32 args) push_int(THIS->fill.g); push_int(THIS->fill.b); f_call_function(8); - if (sp[-1].type!=T_OBJECT || - !(img=(struct image*)get_storage(sp[-1].u.object,image_program))) + if (Pike_sp[-1].type!=T_OBJECT || + !(img=(struct image*)get_storage(Pike_sp[-1].u.object,image_program))) error("No image returned from image->copy\n"); if (img->xsize!=xz || img->ysize!=yz) error("Image returned from image->copy had " @@ -2731,9 +2735,9 @@ static void image_layer_crop(INT32 args) img->xsize,img->ysize,xz,yz); free_object(l->image); - l->image=sp[-1].u.object; - sp--; - dmalloc_touch_svalue(sp); + l->image=Pike_sp[-1].u.object; + Pike_sp--; + dmalloc_touch_svalue(Pike_sp); l->img=img; } @@ -2750,17 +2754,17 @@ static void image_layer_crop(INT32 args) push_int(THIS->fill_alpha.g); push_int(THIS->fill_alpha.b); f_call_function(8); - if (sp[-1].type!=T_OBJECT || - !(img=(struct image*)get_storage(sp[-1].u.object,image_program))) + if (Pike_sp[-1].type!=T_OBJECT || + !(img=(struct image*)get_storage(Pike_sp[-1].u.object,image_program))) error("No image returned from alpha->copy\n"); if (img->xsize!=xz || img->ysize!=yz) error("Image returned from alpha->copy had " "unexpected size (%d,%d, expected %d,%d)\n", img->xsize,img->ysize,xz,yz); free_object(l->alpha); - l->alpha=sp[-1].u.object; - sp--; - dmalloc_touch_svalue(sp); + l->alpha=Pike_sp[-1].u.object; + Pike_sp--; + dmalloc_touch_svalue(Pike_sp); l->alp=img; } @@ -2842,9 +2846,9 @@ static void image_layer_find_autocrop(INT32 args) void image_layer_autocrop(INT32 args) { image_layer_find_autocrop(args); - sp--; - dmalloc_touch_svalue(sp); - push_array_items(sp->u.array); /* frees */ + Pike_sp--; + dmalloc_touch_svalue(Pike_sp); + push_array_items(Pike_sp->u.array); /* frees */ image_layer_crop(4); } diff --git a/src/modules/Oracle/oracle.c b/src/modules/Oracle/oracle.c index 132c5e7e2d..96bc4eac72 100644 --- a/src/modules/Oracle/oracle.c +++ b/src/modules/Oracle/oracle.c @@ -1,5 +1,5 @@ /* - * $Id: oracle.c,v 1.42 2000/06/09 21:55:56 mast Exp $ + * $Id: oracle.c,v 1.43 2000/07/07 00:50:10 hubbe Exp $ * * Pike interface to Oracle databases. * @@ -41,7 +41,7 @@ #include <oci.h> #include <math.h> -RCSID("$Id: oracle.c,v 1.42 2000/06/09 21:55:56 mast Exp $"); +RCSID("$Id: oracle.c,v 1.43 2000/07/07 00:50:10 hubbe Exp $"); #define BLOB_FETCH_CHUNK 16384 @@ -146,13 +146,13 @@ DEFINE_MUTEX(oracle_serialization_mutex); #ifndef CURRENT_STORAGE -#define CURRENT_STORAGE (fp->current_storage) +#define CURRENT_STORAGE (Pike_fp->current_storage) #endif #ifdef DEBUG_MALLOC -#define THISOBJ dmalloc_touch(struct pike_frame *,fp)->current_object +#define THISOBJ dmalloc_touch(struct pike_frame *,Pike_fp)->current_object #else -#define THISOBJ (fp->current_object) +#define THISOBJ (Pike_fp->current_object) #endif @@ -171,8 +171,8 @@ void *parent_storage(int depth) struct object *o; INT32 i; - inherit=&fp->context; - o=fp->current_object; + inherit=&Pike_fp->context; + o=Pike_fp->current_object; if(!o) error("Current object is destructed\n"); @@ -337,7 +337,7 @@ static void init_dbcon_struct(struct object *o) fprintf(stderr,"%s\n",__FUNCTION__); #endif #ifdef PIKE_DEBUG - ((unsigned long *)(fp->current_storage))[0]=0xdbc04711UL; + ((unsigned long *)(Pike_fp->current_storage))[0]=0xdbc04711UL; #endif THIS_DBCON->error_handle=0; THIS_DBCON->context=0; @@ -377,7 +377,7 @@ void init_dbquery_struct(struct object *o) fprintf(stderr,"%s\n",__FUNCTION__); #endif #ifdef PIKE_DEBUG - ((unsigned long *)(fp->current_storage))[0]=0xdb994711UL; + ((unsigned long *)(Pike_fp->current_storage))[0]=0xdb994711UL; #endif THIS_QUERY->cols=-2; THIS_QUERY->statement=0; @@ -412,7 +412,7 @@ static void init_dbresult_struct(struct object *o) fprintf(stderr,"%s\n",__FUNCTION__); #endif #ifdef PIKE_DEBUG - ((unsigned long *)(fp->current_storage))[0]=0xdbe04711UL; + ((unsigned long *)(Pike_fp->current_storage))[0]=0xdbe04711UL; #endif THIS_RESULT->dbcon_lock=0; THIS_RESULT->dbquery_lock=0; @@ -469,7 +469,7 @@ static void init_dbresultinfo_struct(struct object *o) fprintf(stderr,"%s\n",__FUNCTION__); #endif #ifdef PIKE_DEBUG - ((unsigned long *)(fp->current_storage))[0]=0xdbe14711UL; + ((unsigned long *)(Pike_fp->current_storage))[0]=0xdbe14711UL; #endif THIS_RESULTINFO->define_handle=0; init_inout(& THIS_RESULTINFO->data); @@ -509,7 +509,7 @@ struct dbdate static void init_dbdate_struct(struct object *o) { #ifdef PIKE_DEBUG - ((unsigned long *)(fp->current_storage))[0]=0xdbda4711UL; + ((unsigned long *)(Pike_fp->current_storage))[0]=0xdbda4711UL; #endif } static void exit_dbdate_struct(struct object *o) {} @@ -527,7 +527,7 @@ struct dbnull static void init_dbnull_struct(struct object *o) { #ifdef PIKE_DEBUG - ((unsigned long *)(fp->current_storage))[0]=0xdb004711UL; + ((unsigned long *)(Pike_fp->current_storage))[0]=0xdb004711UL; #endif } static void exit_dbnull_struct(struct object *o) {} @@ -927,7 +927,7 @@ static void f_fetch_fields(INT32 args) } f_aggregate(dbquery->cols); - add_ref( dbquery->field_info=sp[-1].u.array ); + add_ref( dbquery->field_info=Pike_sp[-1].u.array ); }else{ ref_push_array( dbquery->field_info); } @@ -957,8 +957,8 @@ static void push_inout_value(struct inout *inout) case SQLT_DAT: ref_push_object(nulldate_object); push_object(low_clone(Date_program)); - call_c_initializers(sp[-1].u.object); - ((struct dbdate *)STORAGE(sp[-1].u.object))->date = inout->u.date; + call_c_initializers(Pike_sp[-1].u.object); + ((struct dbdate *)STORAGE(Pike_sp[-1].u.object))->date = inout->u.date; break; case SQLT_NUM: @@ -1005,8 +1005,8 @@ static void push_inout_value(struct inout *inout) case SQLT_ODT: case SQLT_DAT: push_object(low_clone(Date_program)); - call_c_initializers(sp[-1].u.object); - ((struct dbdate *)STORAGE(sp[-1].u.object))->date = inout->u.date; + call_c_initializers(Pike_sp[-1].u.object); + ((struct dbdate *)STORAGE(Pike_sp[-1].u.object))->date = inout->u.date; break; case SQLT_INT: @@ -1114,11 +1114,11 @@ static void f_oracle_create(INT32 args) BIT_STRING|BIT_INT, BIT_STRING|BIT_INT, BIT_STRING, BIT_STRING|BIT_VOID|BIT_INT, 0); - host = (sp[-args].type == T_STRING? sp[-args].u.string : NULL); - database = (sp[1-args].type == T_STRING? sp[1-args].u.string : NULL); - uid = (sp[2-args].type == T_STRING? sp[2-args].u.string : NULL); + host = (Pike_sp[-args].type == T_STRING? Pike_sp[-args].u.string : NULL); + database = (Pike_sp[1-args].type == T_STRING? Pike_sp[1-args].u.string : NULL); + uid = (Pike_sp[2-args].type == T_STRING? Pike_sp[2-args].u.string : NULL); if(args >= 4) - passwd = (sp[3-args].type == T_STRING? sp[3-args].u.string : NULL); + passwd = (Pike_sp[3-args].type == T_STRING? Pike_sp[3-args].u.string : NULL); else passwd = NULL; @@ -1369,22 +1369,22 @@ static void f_big_query_create(INT32 args) if(d_flag) { CHECK_INTERPRETER_LOCK(); - if(d_flag>1 && thread_for_id(th_self()) != thread_id) - fatal("thread_for_id() (or thread_id) failed in interpreter.h! %p != %p\n",thread_for_id(th_self()),thread_id); + if(d_flag>1 && thread_for_id(th_self()) != Pike_thread_id) + fatal("thread_for_id() (or Pike_thread_id) failed in interpreter.h! %p != %p\n",thread_for_id(th_self()),Pike_thread_id); } #endif switch(args) { default: - new_parent=sp[2-args].u.object; + new_parent=Pike_sp[2-args].u.object; case 2: - autocommit=sp[1-args].u.integer; + autocommit=Pike_sp[1-args].u.integer; case 1: - if(sp[-args].type == T_MAPPING) - bnds=sp[-args].u.mapping; + if(Pike_sp[-args].type == T_MAPPING) + bnds=Pike_sp[-args].u.mapping; case 0: break; } @@ -1418,8 +1418,8 @@ static void f_big_query_create(INT32 args) if(d_flag) { CHECK_INTERPRETER_LOCK(); - if(d_flag>1 && thread_for_id(th_self()) != thread_id) - fatal("thread_for_id() (or thread_id) failed in interpreter.h! %p != %p\n",thread_for_id(th_self()),thread_id); + if(d_flag>1 && thread_for_id(th_self()) != Pike_thread_id) + fatal("thread_for_id() (or Pike_thread_id) failed in interpreter.h! %p != %p\n",thread_for_id(th_self()),Pike_thread_id); } #endif @@ -1606,8 +1606,8 @@ static void f_big_query_create(INT32 args) if(d_flag) { CHECK_INTERPRETER_LOCK(); - if(d_flag>1 && thread_for_id(th_self()) != thread_id) - fatal("thread_for_id() (or thread_id) failed in interpreter.h! %p != %p\n",thread_for_id(th_self()),thread_id); + if(d_flag>1 && thread_for_id(th_self()) != Pike_thread_id) + fatal("thread_for_id() (or Pike_thread_id) failed in interpreter.h! %p != %p\n",thread_for_id(th_self()),Pike_thread_id); } #endif @@ -1638,7 +1638,7 @@ static void f_big_query_create(INT32 args) if(bind.bind[i].data.has_output) { push_inout_value(& bind.bind[i].data); - mapping_insert(dbquery->output_variables, & bind.bind[i].ind, sp-1); + mapping_insert(dbquery->output_variables, & bind.bind[i].ind, Pike_sp-1); pop_stack(); } } @@ -1651,8 +1651,8 @@ static void f_big_query_create(INT32 args) if(d_flag) { CHECK_INTERPRETER_LOCK(); - if(d_flag>1 && thread_for_id(th_self()) != thread_id) - fatal("thread_for_id() (or thread_id) failed in interpreter.h! %p != %p\n",thread_for_id(th_self()),thread_id); + if(d_flag>1 && thread_for_id(th_self()) != Pike_thread_id) + fatal("thread_for_id() (or Pike_thread_id) failed in interpreter.h! %p != %p\n",thread_for_id(th_self()),Pike_thread_id); } #endif @@ -1665,12 +1665,12 @@ static void dbdate_create(INT32 args) sword rc; check_all_args("Oracle.Date",args,BIT_INT|BIT_STRING,0); - switch(sp[-args].type) + switch(Pike_sp[-args].type) { case T_STRING: rc=OCIDateFromText(get_global_error_handle(), - sp[-args].u.string->str, - sp[-args].u.string->len, + Pike_sp[-args].u.string->str, + Pike_sp[-args].u.string->len, 0, 0, 0, @@ -1681,7 +1681,7 @@ static void dbdate_create(INT32 args) break; case T_INT: - t=sp[-1].u.integer; + t=Pike_sp[-1].u.integer; tm=localtime(&t); OCIDateSetDate(&THIS_DBDATE->date, tm->tm_year, tm->tm_mon, tm->tm_mday); OCIDateSetTime(&THIS_DBDATE->date, tm->tm_hour, tm->tm_min, tm->tm_sec); @@ -1746,7 +1746,7 @@ static void dbdate_cast(INT32 args) static void dbnull_create(INT32 args) { if(args<1) error("Too few arguments to Oracle.NULL->create\n"); - assign_svalue(& THIS_DBNULL->type, sp-args); + assign_svalue(& THIS_DBNULL->type, Pike_sp-args); } static void dbnull_sprintf(INT32 args) @@ -1891,7 +1891,7 @@ void pike_module_init(void) add_object_constant("NULLfloat",nullfloat_object=clone_object(NULL_program,1),0); push_object(low_clone(Date_program)); - call_c_initializers(sp[-1].u.object); + call_c_initializers(Pike_sp[-1].u.object); add_object_constant("NULLdate",nulldate_object=clone_object(NULL_program,1),0); } diff --git a/src/modules/files/file.c b/src/modules/files/file.c index 29c8ddd50f..6e6f7a1af5 100644 --- a/src/modules/files/file.c +++ b/src/modules/files/file.c @@ -5,7 +5,7 @@ \*/ /**/ #include "global.h" -RCSID("$Id: file.c,v 1.176 2000/06/09 21:55:17 mast Exp $"); +RCSID("$Id: file.c,v 1.177 2000/07/07 00:33:09 hubbe Exp $"); #include "fdlib.h" #include "interpret.h" #include "svalue.h" @@ -100,7 +100,7 @@ RCSID("$Id: file.c,v 1.176 2000/06/09 21:55:17 mast Exp $"); #include "dmalloc.h" #undef THIS -#define THIS ((struct my_file *)(fp->current_storage)) +#define THIS ((struct my_file *)(Pike_fp->current_storage)) #define FD (THIS->fd) #define ERRNO (THIS->my_errno) @@ -643,14 +643,14 @@ static void file_read(INT32 args) } else { - if(sp[-args].type != T_INT) + if(Pike_sp[-args].type != T_INT) error("Bad argument 1 to file->read().\n"); - len=sp[-args].u.integer; + len=Pike_sp[-args].u.integer; if(len<0) error("Cannot read negative number of characters.\n"); } - if(args > 1 && !IS_ZERO(sp+1-args)) + if(args > 1 && !IS_ZERO(Pike_sp+1-args)) { all=0; }else{ @@ -747,14 +747,14 @@ static void file_read_oob(INT32 args) } else { - if(sp[-args].type != T_INT) + if(Pike_sp[-args].type != T_INT) error("Bad argument 1 to file->read_oob().\n"); - len=sp[-args].u.integer; + len=Pike_sp[-args].u.integer; if(len<0) error("Cannot read negative number of characters.\n"); } - if(args > 1 && !IS_ZERO(sp+1-args)) + if(args > 1 && !IS_ZERO(Pike_sp+1-args)) { all=0; }else{ @@ -790,8 +790,8 @@ static void PIKE_CONCAT(file_set_,X) (INT32 args) \ error("File is not open.\n"); \ if(!args) \ error("Too few arguments to file_set_%s\n",#X); \ - assign_svalue(& THIS->X, sp-args); \ - if(IS_ZERO(sp-args)) \ + assign_svalue(& THIS->X, Pike_sp-args); \ + if(IS_ZERO(Pike_sp-args)) \ { \ PIKE_CONCAT(set_,X)(FD, 0, 0); \ check_internal_reference(THIS); \ @@ -866,16 +866,16 @@ static void file_write(INT32 args) INT32 written,i; struct pike_string *str; - if(args<1 || ((sp[-args].type != T_STRING) && (sp[-args].type != T_ARRAY))) + if(args<1 || ((Pike_sp[-args].type != T_STRING) && (Pike_sp[-args].type != T_ARRAY))) error("Bad argument 1 to file->write().\n" "Type is %s. Expected string or array(string)\n", - get_name_of_type(sp[-args].type)); + get_name_of_type(Pike_sp[-args].type)); if(FD < 0) error("File not open for write.\n"); - if (sp[-args].type == T_ARRAY) { - struct array *a = sp[-args].u.array; + if (Pike_sp[-args].type == T_ARRAY) { + struct array *a = Pike_sp[-args].u.array; i = a->size; while(i--) { if (a->item[i].type != T_STRING) { @@ -895,12 +895,12 @@ static void file_write(INT32 args) ref_push_array(a); push_constant_text(""); o_multiply(); - sp--; - dmalloc_touch_svalue(sp); - assign_svalue(sp-args, sp); + Pike_sp--; + dmalloc_touch_svalue(Pike_sp); + assign_svalue(Pike_sp-args, Pike_sp); #ifdef PIKE_DEBUG - if (sp[-args].type != T_STRING) { + if (Pike_sp[-args].type != T_STRING) { error("Bad return value from string multiplication."); } #endif /* PIKE_DEBUG */ @@ -1009,7 +1009,7 @@ static void file_write(INT32 args) #endif /* HAVE_WRITEV */ } - /* At this point sp[-args].type is T_STRING */ + /* At this point Pike_sp[-args].type is T_STRING */ if(args > 1) { @@ -1018,7 +1018,7 @@ static void file_write(INT32 args) args=1; } - str=sp[-args].u.string; + str=Pike_sp[-args].u.string; for(written=0;written < str->len;check_signals(0,0,0)) { @@ -1079,7 +1079,7 @@ static void file_write_oob(INT32 args) INT32 written,i; struct pike_string *str; - if(args<1 || sp[-args].type != T_STRING) + if(args<1 || Pike_sp[-args].type != T_STRING) error("Bad argument 1 to file->write().\n"); if(args > 1) @@ -1093,7 +1093,7 @@ static void file_write_oob(INT32 args) error("File not open for write_oob.\n"); written=0; - str=sp[-args].u.string; + str=Pike_sp[-args].u.string; while(written < str->len) { @@ -1208,9 +1208,9 @@ static void file_close(INT32 args) int flags; if(args) { - if(sp[-args].type != T_STRING) + if(Pike_sp[-args].type != T_STRING) error("Bad argument 1 to file->close()\n"); - flags=parse(sp[-args].u.string->str); + flags=parse(Pike_sp[-args].u.string->str); }else{ flags=FILE_READ | FILE_WRITE; } @@ -1242,26 +1242,26 @@ static void file_open(INT32 args) if(args < 2) error("Too few arguments to file->open()\n"); - if(sp[-args].type != T_STRING && - sp[-args].type != T_INT) + if(Pike_sp[-args].type != T_STRING && + Pike_sp[-args].type != T_INT) error("Bad argument 1 to file->open()\n"); - if(sp[1-args].type != T_STRING) + if(Pike_sp[1-args].type != T_STRING) error("Bad argument 2 to file->open()\n"); if (args > 2) { - if (sp[2-args].type != T_INT) + if (Pike_sp[2-args].type != T_INT) error("Bad argument 3 to file->open()\n"); - access = sp[2-args].u.integer; + access = Pike_sp[2-args].u.integer; } else access = 00666; - flags = parse((flag_str = sp[1-args].u.string)->str); + flags = parse((flag_str = Pike_sp[1-args].u.string)->str); - if (sp[-args].type==T_STRING) + if (Pike_sp[-args].type==T_STRING) { - str=sp[-args].u.string; + str=Pike_sp[-args].u.string; #ifdef PIKE_SECURITY if(!CHECK_SECURITY(SECURITY_BIT_SECURITY)) @@ -1276,16 +1276,16 @@ static void file_open(INT32 args) push_text("read"); } - ref_push_object(fp->current_object); + ref_push_object(Pike_fp->current_object); ref_push_string(str); ref_push_string(flag_str); push_int(access); - safe_apply(OBJ2CREDS(current_creds)->user,"valid_open",5); - switch(sp[-1].type) + safe_apply(OBJ2CREDS(Pike_interpreter.current_creds)->user,"valid_open",5); + switch(Pike_sp[-1].type) { case T_INT: - switch(sp[-1].u.integer) + switch(Pike_sp[-1].u.integer) { case 0: /* return 0 */ ERRNO=EPERM; @@ -1314,7 +1314,7 @@ static void file_open(INT32 args) error("Error in user->valid_open, wrong return type.\n"); case T_STRING: - str=sp[-1].u.string; + str=Pike_sp[-1].u.string; args++; } } @@ -1331,7 +1331,7 @@ static void file_open(INT32 args) check_threads_etc(); } while(fd < 0 && errno == EINTR); - if(!fp->current_object->prog) + if(!Pike_fp->current_object->prog) { #ifdef DEBUG_MALLOC extern int d_flag; @@ -1339,7 +1339,7 @@ static void file_open(INT32 args) if(d_flag) { fprintf(stderr,"Possible gc() failure detected in open()\n"); - describe(fp->current_object); + describe(Pike_fp->current_object); } #endif if (fd >= 0) @@ -1368,7 +1368,7 @@ static void file_open(INT32 args) /* FIXME!! Insert better security here */ } #endif - fd=sp[-args].u.integer; + fd=Pike_sp[-args].u.integer; if (fd<0) error("Not a valid FD.\n"); @@ -1391,30 +1391,30 @@ static void file_seek(INT32 args) #ifdef HAVE_LSEEK64 #ifdef AUTO_BIGNUM - if(1 <= args && is_bignum_object_in_svalue(&sp[-args])) - int64_from_bignum(&to, sp[-args].u.object); + if(1 <= args && is_bignum_object_in_svalue(&Pike_sp[-args])) + int64_from_bignum(&to, Pike_sp[-args].u.object); else #endif /* AUTO_BIGNUM */ #endif - if(args<1 || sp[-args].type != T_INT) + if(args<1 || Pike_sp[-args].type != T_INT) error("Bad argument 1 to file->seek(int to).\n"); else - to=sp[-args].u.integer; + to=Pike_sp[-args].u.integer; if(FD < 0) error("File not open.\n"); if(args>1) { - if(sp[-args+1].type != T_INT) + if(Pike_sp[-args+1].type != T_INT) error("Bad argument 2 to file->seek(int unit,int mult).\n"); - to *= sp[-args+1].u.integer; + to *= Pike_sp[-args+1].u.integer; } if(args>2) { - if(sp[-args+2].type != T_INT) + if(Pike_sp[-args+2].type != T_INT) error("Bad argument 3 to file->seek(int unit,int mult,int add).\n"); - to += sp[-args+2].u.integer; + to += Pike_sp[-args+2].u.integer; } ERRNO=0; @@ -1463,13 +1463,13 @@ static void file_truncate(INT32 args) #endif int res; - if(args<1 || sp[-args].type != T_INT) + if(args<1 || Pike_sp[-args].type != T_INT) error("Bad argument 1 to file->truncate(int length).\n"); if(FD < 0) error("File not open.\n"); - len = sp[-args].u.integer; + len = Pike_sp[-args].u.integer; ERRNO=0; res=fd_ftruncate(FD, len); @@ -1562,7 +1562,7 @@ static void file_set_close_on_exec(INT32 args) if(FD <0) error("File not open.\n"); - if(IS_ZERO(sp-args)) + if(IS_ZERO(Pike_sp-args)) { my_set_close_on_exec(FD,0); }else{ @@ -1598,18 +1598,18 @@ static void file_set_buffer(INT32 args) error("file->set_buffer() on closed file.\n"); if(!args) error("Too few arguments to file->set_buffer()\n"); - if(sp[-args].type!=T_INT) + if(Pike_sp[-args].type!=T_INT) error("Bad argument 1 to file->set_buffer()\n"); - bufsize=sp[-args].u.integer; + bufsize=Pike_sp[-args].u.integer; if(bufsize < 0) error("Bufsize must be larger than zero.\n"); if(args>1) { - if(sp[1-args].type != T_STRING) + if(Pike_sp[1-args].type != T_STRING) error("Bad argument 2 to file->set_buffer()\n"); - flags=parse(sp[1-args].u.string->str); + flags=parse(Pike_sp[1-args].u.string->str); }else{ flags=FILE_READ | FILE_WRITE; } @@ -1836,7 +1836,7 @@ static void file_pipe(INT32 args) int type=fd_CAN_NONBLOCK | fd_BIDIRECTIONAL; check_all_args("file->pipe",args, BIT_INT | BIT_VOID, 0); - if(args) type = sp[-args].u.integer; + if(args) type = Pike_sp[-args].u.integer; close_fd(); pop_n_elems(args); @@ -2003,10 +2003,10 @@ static void file_dup2(INT32 args) if(FD < 0) error("File not open.\n"); - if(sp[-args].type != T_OBJECT) + if(Pike_sp[-args].type != T_OBJECT) error("Bad argument 1 to file->dup2()\n"); - o=sp[-args].u.object; + o=Pike_sp[-args].u.object; fd=get_file_storage(o); @@ -2081,21 +2081,21 @@ static void file_open_socket(INT32 args) struct sockaddr_in addr; int o; - if (sp[-args].type != T_INT) { + if (Pike_sp[-args].type != T_INT) { fd_close(fd); error("Bad argument 1 to open_socket(), expected int\n"); } if (args > 1) { - if (sp[1-args].type != T_STRING) { + if (Pike_sp[1-args].type != T_STRING) { close(fd); error("Bad argument 2 to open_socket(), expected string\n"); } - get_inet_addr(&addr, sp[1-args].u.string->str); + get_inet_addr(&addr, Pike_sp[1-args].u.string->str); } else { addr.sin_addr.s_addr = htonl(INADDR_ANY); addr.sin_family = AF_INET; } - addr.sin_port = htons( ((u_short)sp[-args].u.integer) ); + addr.sin_port = htons( ((u_short)Pike_sp[-args].u.integer) ); o=1; if(fd_setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&o, sizeof(int)) < 0) { @@ -2182,7 +2182,7 @@ static void file_connect(INT32 args) ref_push_string(src_addr); file_open_socket(2); } - if(IS_ZERO(sp-1) || FD < 0) + if(IS_ZERO(Pike_sp-1) || FD < 0) error("file->connect(): Failed to open socket.\n"); pop_stack(); } @@ -2248,7 +2248,7 @@ static void file_query_address(INT32 args) error("file->query_address(): Connection not open.\n"); len=sizeof(addr); - if(args > 0 && !IS_ZERO(sp-args)) + if(args > 0 && !IS_ZERO(Pike_sp-args)) { i=fd_getsockname(FD,(struct sockaddr *)&addr,&len); }else{ @@ -2276,16 +2276,16 @@ static void file_lsh(INT32 args) if(args != 1) error("Too few/many args to file->`<<\n"); - if(sp[-1].type != T_STRING) + if(Pike_sp[-1].type != T_STRING) { ref_push_string(string_type_string); stack_swap(); f_cast(); } - len=sp[-1].u.string->len; + len=Pike_sp[-1].u.string->len; file_write(1); - if(len != sp[-1].u.integer) error("File << failed.\n"); + if(len != Pike_sp[-1].u.integer) error("File << failed.\n"); pop_stack(); push_object(this_object()); @@ -2294,8 +2294,8 @@ static void file_lsh(INT32 args) static void file_create(INT32 args) { if(!args) return; - if(sp[-args].type != T_STRING && - sp[-args].type != T_INT) + if(Pike_sp[-args].type != T_STRING && + Pike_sp[-args].type != T_INT) error("Bad argument 1 to file->create()\n"); close_fd(); @@ -2360,7 +2360,7 @@ void file_proxy(INT32 args) THREAD_T id; check_all_args("Stdio.File->proxy",args, BIT_OBJECT,0); - f=get_file_storage(sp[-args].u.object); + f=get_file_storage(Pike_sp[-args].u.object); if(!f) error("Bad argument 1 to Stdio.File->proxy, not a Stdio.File object.\n"); @@ -2400,9 +2400,9 @@ void create_proxy_pipe(struct object *o, int for_reading) push_object(n=clone_object(file_program,0)); push_int(fd_INTERPROCESSABLE); apply(n,"pipe",1); - if(sp[-1].type!=T_OBJECT) + if(Pike_sp[-1].type!=T_OBJECT) error("Failed to create proxy pipe (errno=%d)!\n",get_file_storage(n)->my_errno); - n2=sp[-1].u.object; + n2=Pike_sp[-1].u.object; /* Stack is now: pipe(read), pipe(write) */ if(for_reading) { @@ -2411,8 +2411,8 @@ void create_proxy_pipe(struct object *o, int for_reading) pop_n_elems(2); }else{ /* Swap */ - sp[-2].u.object=n2; - sp[-1].u.object=n; + Pike_sp[-2].u.object=n2; + Pike_sp[-1].u.object=n; apply(o,"proxy",1); pop_stack(); } @@ -2443,11 +2443,11 @@ static void low_file_lock(INT32 args, int flags) if(FD==-1) error("File->lock(): File is not open.\n"); - if(!args || IS_ZERO(sp-args)) + if(!args || IS_ZERO(Pike_sp-args)) { if(THIS->key #ifdef _REENTRANT - && OB2KEY(THIS->key)->owner == thread_id + && OB2KEY(THIS->key)->owner == Pike_interpreter.thread_id #endif ) { @@ -2499,13 +2499,13 @@ static void file_trylock(INT32 args) } #endif -#define THIS_KEY ((struct file_lock_key_storage *)(fp->current_storage)) +#define THIS_KEY ((struct file_lock_key_storage *)(Pike_fp->current_storage)) static void init_file_lock_key(struct object *o) { THIS_KEY->f=0; #ifdef _REENTRANT - THIS_KEY->owner=thread_id; - add_ref(thread_id); + THIS_KEY->owner=Pike_interpreter.thread_id; + add_ref(Pike_interpreter.thread_id); #endif } @@ -2602,7 +2602,7 @@ void pike_module_exit(void) void init_files_efuns(void); -#define REF (*((struct object **)(fp->current_storage))) +#define REF (*((struct object **)(Pike_fp->current_storage))) #define FILE_FUNC(X,Y,Z) \ static int PIKE_CONCAT(Y,_function_number); @@ -2621,7 +2621,7 @@ void PIKE_CONCAT(Y,_ref) (INT32 args) { \ if(d_flag) \ { \ fprintf(stderr,"Possible gc() failiure detected\n"); \ - describe(fp->current_object); \ + describe(Pike_fp->current_object); \ if(o) describe(o); \ } \ ); \ diff --git a/src/threads.h b/src/threads.h index b09032eeec..85725ce484 100644 --- a/src/threads.h +++ b/src/threads.h @@ -1,5 +1,5 @@ /* - * $Id: threads.h,v 1.94 2000/06/24 07:20:27 hubbe Exp $ + * $Id: threads.h,v 1.95 2000/07/07 00:21:48 hubbe Exp $ */ #ifndef THREADS_H #define THREADS_H @@ -7,6 +7,7 @@ #include "machine.h" #include "object.h" #include "error.h" +#include "interpret.h" struct Pike_interpreter; @@ -56,7 +57,6 @@ extern int num_threads; extern int live_threads; struct object; extern size_t thread_stack_size; -extern struct object *thread_id; #define DEFINE_MUTEX(X) PIKE_MUTEX_T X @@ -333,9 +333,15 @@ struct interleave_mutex #define THREAD_RUNNING 0 #define THREAD_EXITED 1 -#ifdef PIKE_SECURITY -extern struct object *current_creds; -#endif +struct thread_state { + struct Pike_interpreter state; + char swapped; + char status; + COND_T status_change; + THREAD_T id; + struct mapping *thread_local; + struct thread_state *hashlink, **backlink; +}; #ifndef TH_RETURN_TYPE @@ -375,8 +381,8 @@ extern struct object *current_creds; #endif /* VERBOSE_THREADS_DEBUG */ #ifdef THREAD_TRACE -#define SWAP_OUT_TRACE(_tmp) do { extern int t_flag; (_tmp)->t_flag = t_flag; } while(0) -#define SWAP_IN_TRACE(_tmp) do { extern int t_flag; t_flag = (_tmp)->t_flag; } while(0) +#define SWAP_OUT_TRACE(_tmp) do { extern int t_flag; (_tmp)->status.t_flag = t_flag; } while(0) +#define SWAP_IN_TRACE(_tmp) do { extern int t_flag; t_flag = (_tmp)->status.t_flag; } while(0) #else /* !THREAD_TRACE */ #define SWAP_OUT_TRACE(_tmp) #define SWAP_IN_TRACE(_tmp) @@ -388,45 +394,21 @@ extern struct object *current_creds; #define DO_IF_PROFILING(X) #endif -#define SWAP_OUT_THREAD(_tmp) do { \ - (_tmp)->swapped=1; \ - (_tmp)->Pike_evaluator_stack=Pike_evaluator_stack;\ - (_tmp)->evaluator_stack_malloced=evaluator_stack_malloced;\ - debug_malloc_pass( (_tmp)->Pike_fp=Pike_fp );\ - (_tmp)->Pike_mark_sp=Pike_mark_sp;\ - (_tmp)->Pike_mark_stack=Pike_mark_stack;\ - (_tmp)->mark_stack_malloced=mark_stack_malloced;\ - (_tmp)->recoveries=recoveries;\ - (_tmp)->Pike_sp=Pike_sp; \ - (_tmp)->Pike_stack_top=Pike_stack_top; \ - (_tmp)->thread_id=thread_id;\ - DO_IF_PROFILING( (_tmp)->accounted_time=accounted_time; ) \ - DO_IF_PROFILING( (_tmp)->time_base = gethrtime() - time_base; ) \ - DO_IF_SECURITY( (_tmp)->current_creds = current_creds ;) \ - SWAP_OUT_TRACE(_tmp); \ +#define SWAP_OUT_THREAD(_tmp) do { \ + (_tmp)->state=Pike_interpreter; \ + (_tmp)->swapped=1; \ + DO_IF_PROFILING( (_tmp)->time_base += gethrtime() ; ) \ } while(0) -#define SWAP_IN_THREAD(_tmp) do {\ - (_tmp)->swapped=0; \ - Pike_evaluator_stack=(_tmp)->Pike_evaluator_stack;\ - evaluator_stack_malloced=(_tmp)->evaluator_stack_malloced;\ - debug_malloc_pass( Pike_fp=(_tmp)->Pike_fp );\ - Pike_mark_sp=(_tmp)->Pike_mark_sp;\ - Pike_mark_stack=(_tmp)->Pike_mark_stack;\ - mark_stack_malloced=(_tmp)->mark_stack_malloced;\ - recoveries=(_tmp)->recoveries;\ - Pike_sp=(_tmp)->Pike_sp;\ - Pike_stack_top=(_tmp)->Pike_stack_top;\ - thread_id=(_tmp)->thread_id;\ - DO_IF_PROFILING( accounted_time=(_tmp)->accounted_time; ) \ - DO_IF_PROFILING( time_base = gethrtime() - (_tmp)->time_base; ) \ - DO_IF_SECURITY( current_creds = (_tmp)->current_creds ;) \ - SWAP_IN_TRACE(_tmp); \ +#define SWAP_IN_THREAD(_tmp) do { \ + (_tmp)->swapped=0; \ + Pike_interpreter=(_tmp)->state; \ + DO_IF_PROFILING( Pike_interpreter.time_base -= gethrtime();) \ } while(0) #define SWAP_OUT_CURRENT_THREAD() \ do {\ - struct Pike_interpreter *_tmp=OBJ2THREAD(thread_id); \ + struct thread_state *_tmp=OBJ2THREAD(Pike_interpreter.thread_id); \ SWAP_OUT_THREAD(_tmp); \ THREADS_FPRINTF(1, (stderr, "SWAP_OUT_CURRENT_THREAD() %s:%d t:%08x\n", \ __FILE__, __LINE__, (unsigned int)_tmp->thread_id)) \ @@ -444,9 +426,7 @@ extern struct object *current_creds; * environment. */ #define HIDE_GLOBAL_VARIABLES() do { \ - int Pike_sp = 0, Pike_evaluator_stack = 0, Pike_mark_sp = 0, Pike_mark_stack = 0, Pike_fp = 0; \ - void *evaluator_stack_malloced = NULL, *mark_stack_malloced = NULL; \ - int recoveries = 0, thread_id = 0; \ + int Pike_interpreter =0; \ int pop_n_elems = 0; \ int push_sp_mark = 0, pop_sp_mark = 0, threads_disabled = 1 @@ -460,16 +440,16 @@ extern struct object *current_creds; #endif /* PIKE_DEBUG */ #define OBJ2THREAD(X) \ - ((struct Pike_interpreter *)((X)->storage+thread_storage_offset)) + ((struct thread_state *)((X)->storage+thread_storage_offset)) -#define THREADSTATE2OBJ(X) ((X)->thread_id) +#define THREADSTATE2OBJ(X) ((X)->state.thread_id) #define THREADS_ALLOW() do { \ - struct Pike_interpreter *_tmp=OBJ2THREAD(thread_id); \ + struct thread_state *_tmp=OBJ2THREAD(Pike_interpreter.thread_id); \ DO_IF_DEBUG({ \ extern int Pike_in_gc; \ - if(thread_for_id(th_self()) != thread_id) \ - fatal("thread_for_id() (or thread_id) failed! %p != %p\n",thread_for_id(th_self()),thread_id); \ + if(thread_for_id(th_self()) != Pike_interpreter.thread_id) \ + fatal("thread_for_id() (or Pike_interpreter.thread_id) failed! %p != %p\n",thread_for_id(th_self()),Pike_interpreter.thread_id); \ if (Pike_in_gc > 50 && Pike_in_gc < 300) \ fatal("Threads allowed during garbage collection.\n"); \ }) \ @@ -496,16 +476,16 @@ extern struct object *current_creds; } \ SWAP_IN_THREAD(_tmp);\ } \ - DO_IF_DEBUG( if(thread_for_id(th_self()) != thread_id) \ - fatal("thread_for_id() (or thread_id) failed! %p != %p\n",thread_for_id(th_self()),thread_id) ; ) \ + DO_IF_DEBUG( if(thread_for_id(th_self()) != Pike_interpreter.thread_id) \ + fatal("thread_for_id() (or Pike_interpreter.thread_id) failed! %p != %p\n",thread_for_id(th_self()),Pike_interpreter.thread_id) ; ) \ } while(0) #define THREADS_ALLOW_UID() do { \ - struct Pike_interpreter *_tmp_uid=OBJ2THREAD(thread_id); \ + struct thread_state *_tmp_uid=OBJ2THREAD(Pike_interpreter.thread_id); \ DO_IF_DEBUG({ \ extern int Pike_in_gc; \ - if(thread_for_id(th_self()) != thread_id) \ - fatal("thread_for_id() (or thread_id) failed! %p != %p\n",thread_for_id(th_self()),thread_id); \ + if(thread_for_id(th_self()) != Pike_interpreter.thread_id) \ + fatal("thread_for_id() (or Pike_interpreter.thread_id) failed! %p != %p\n",thread_for_id(th_self()),Pike_interpreter.thread_id); \ if (Pike_in_gc > 50 && Pike_in_gc < 300) \ fatal("Threads allowed during garbage collection.\n"); \ }) \ @@ -538,13 +518,13 @@ extern struct object *current_creds; } while(0) #define SWAP_IN_THREAD_IF_REQUIRED() do { \ - struct Pike_interpreter *_tmp=thread_state_for_id(th_self()); \ + struct thread_state *_tmp=thread_state_for_id(th_self()); \ HIDE_GLOBAL_VARIABLES(); \ THREADS_DISALLOW() #ifdef PIKE_DEBUG #define ASSERT_THREAD_SWAPPED_IN() do { \ - struct Pike_interpreter *_tmp=thread_state_for_id(th_self()); \ + struct thread_state *_tmp=thread_state_for_id(th_self()); \ if(_tmp->swapped) fatal("Thread is not swapped in!\n"); \ }while(0) @@ -568,7 +548,7 @@ void thread_table_init(void); unsigned INT32 thread_table_hash(THREAD_T *tid); void thread_table_insert(struct object *o); void thread_table_delete(struct object *o); -struct Pike_interpreter *thread_state_for_id(THREAD_T tid); +struct thread_state *thread_state_for_id(THREAD_T tid); struct object *thread_for_id(THREAD_T tid); void f_all_threads(INT32 args); int count_pike_threads(void); @@ -621,7 +601,7 @@ void th_farm(void (*fun)(void *), void *here); #define mt_lock(X) #define mt_unlock(X) #define mt_destroy(X) -#define THREADS_ALLOW() +#define THREAS_ALLOW() #define THREADS_DISALLOW() #define THREADS_ALLOW_UID() #define THREADS_DISALLOW_UID() -- GitLab