diff --git a/src/ChangeLog b/src/ChangeLog index 44755cb2bfb29694c63b6c53cd0a16f3204fb0b4..e14319deab94c66f05bba387cb81472114a43523 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +Wed Mar 12 03:58:53 1997 Fredrik Hubinette <hubbe@cytocin.hubbe.net> + + * renamed clone() to clone_object(), threads works with linux now. + Wed Mar 12 00:53:13 1997 Henrik Grubbstr�m <grubba@infovav.se> * module_support.c (va_get_args): %f didn't work before. diff --git a/src/builtin_functions.c b/src/builtin_functions.c index c15c1d4994588376b6a3eeab8288ff7dd4212581..9eb14c622e86c9e0b0843ff258c9e4e200b6ff0c 100644 --- a/src/builtin_functions.c +++ b/src/builtin_functions.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: builtin_functions.c,v 1.32 1997/03/11 03:58:58 hubbe Exp $"); +RCSID("$Id: builtin_functions.c,v 1.33 1997/03/12 12:15:26 hubbe Exp $"); #include "interpret.h" #include "svalue.h" #include "macros.h" @@ -395,7 +395,7 @@ static char *combine_path(char *cwd,char *file) fatal("No cwd in combine_path!\n"); #endif - if(cwd[strlen(cwd)-1]=='/') + if(!*cwd || cwd[strlen(cwd)-1]=='/') { ret=(char *)xalloc(strlen(cwd)+strlen(file)+1); strcpy(ret,cwd); @@ -622,6 +622,8 @@ void f_exit(INT32 args) if(sp[-args].type != T_INT) error("Bad argument 1 to exit.\n"); + i=sp[-args].u.integer; + #ifdef _REENTRANT if(num_threads) exit(i); #endif @@ -631,7 +633,6 @@ void f_exit(INT32 args) call_callback(&exit_callbacks, (void *)0); free_callback(&exit_callbacks); - i=sp[-args].u.integer; exit_modules(); UNSET_ONERROR(tmp); diff --git a/src/interpret.c b/src/interpret.c index 02b91b4e0646cf806f2f8a343500bf8731312fe7..937dd84105dc5caff5ffdb9b8b6d6c83ef5d1e6d 100644 --- a/src/interpret.c +++ b/src/interpret.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: interpret.c,v 1.34 1997/03/11 04:00:38 hubbe Exp $"); +RCSID("$Id: interpret.c,v 1.35 1997/03/12 12:15:27 hubbe Exp $"); #include "interpret.h" #include "object.h" #include "program.h" @@ -1551,7 +1551,7 @@ void strict_apply_svalue(struct svalue *s, INT32 args) case T_PROGRAM: { - struct object *o=clone(s->u.program,args); + struct object *o=clone_object(s->u.program,args); push_object(o); } break; diff --git a/src/modules/Gmp/mpz_glue.c b/src/modules/Gmp/mpz_glue.c index ddeb3475bebd2c71b473fac444430e679cac26d2..73bcc3ee288c64112a47af456cb5155d17ca828e 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.5 1997/03/11 04:00:25 nisse Exp $"); +RCSID("$Id: mpz_glue.c,v 1.6 1997/03/12 12:18:25 hubbe Exp $"); #include "gmp_machine.h" #include "types.h" @@ -303,7 +303,7 @@ static MP_INT *get_mpz(struct svalue *s) case T_STRING: case T_ARRAY: #endif - o=clone(mpzmod_program,0); + o=clone_object(mpzmod_program,0); get_new_mpz(OBTOMPZ(o), s); free_svalue(s); s->u.object=o; @@ -328,7 +328,7 @@ static struct object *temporary; MP_INT *get_tmp() { if(!temporary) - temporary=clone(mpzmod_program,0); + temporary=clone_object(mpzmod_program,0); return (MP_INT *)temporary->storage; } @@ -348,7 +348,7 @@ static void name(INT32 args) \ struct object *res; \ for(e=0; e<args; e++) \ get_mpz(sp+e-args); \ - res = clone(mpzmod_program, 0); \ + res = clone_object(mpzmod_program, 0); \ mpz_set(OBTOMPZ(res), THIS); \ for(e=0;e<args;e++) \ fun(OBTOMPZ(res), OBTOMPZ(res), \ @@ -370,7 +370,7 @@ static void mpzmod_sub(INT32 args) for (e = 0; e<args; e++) get_mpz(sp + e - args); - res = clone(mpzmod_program, 0); + res = clone_object(mpzmod_program, 0); mpz_set(OBTOMPZ(res), THIS); if(args) @@ -393,7 +393,7 @@ static void mpzmod_div(INT32 args) if (!mpz_sgn(get_mpz(sp+e-args))) error("Division by zero.\n"); - res = clone(mpzmod_program, 0); + res = clone_object(mpzmod_program, 0); mpz_set(OBTOMPZ(res), THIS); for(e=0;e<args;e++) mpz_tdiv_q(OBTOMPZ(res), OBTOMPZ(res), OBTOMPZ(sp[e-args].u.object)); @@ -411,7 +411,7 @@ static void mpzmod_mod(INT32 args) if (!mpz_sgn(get_mpz(sp+e-args))) error("Division by zero.\n"); - res = clone(mpzmod_program, 0); + res = clone_object(mpzmod_program, 0); mpz_set(OBTOMPZ(res), THIS); for(e=0;e<args;e++) mpz_tdiv_r(OBTOMPZ(res), OBTOMPZ(res), OBTOMPZ(sp[e-args].u.object)); @@ -430,9 +430,9 @@ static void mpzmod_gcdext(INT32 args) a = get_mpz(sp-1); - g = clone(mpzmod_program, 0); - s = clone(mpzmod_program, 0); - t = clone(mpzmod_program, 0); + g = clone_object(mpzmod_program, 0); + s = clone_object(mpzmod_program, 0); + t = clone_object(mpzmod_program, 0); mpz_gcdext(OBTOMPZ(g), OBTOMPZ(s), OBTOMPZ(t), THIS, a); pop_n_elems(args); @@ -450,8 +450,8 @@ static void mpzmod_gcdext2(INT32 args) a = get_mpz(sp-args); - g = clone(mpzmod_program, 0); - s = clone(mpzmod_program, 0); + g = clone_object(mpzmod_program, 0); + s = clone_object(mpzmod_program, 0); mpz_gcdext(OBTOMPZ(g), OBTOMPZ(s), NULL, THIS, a); pop_n_elems(args); @@ -469,7 +469,7 @@ static void mpzmod_invert(INT32 args) modulo = get_mpz(sp-args); if (!mpz_sgn(modulo)) error("divide by zero"); - res = clone(mpzmod_program, 0); + res = clone_object(mpzmod_program, 0); if (mpz_invert(OBTOMPZ(res), THIS, modulo) == 0) { really_free_object(res); @@ -486,7 +486,7 @@ static void mpzmod_compl(INT32 args) { struct object *o; pop_n_elems(args); - o=clone(mpzmod_program,0); + o=clone_object(mpzmod_program,0); push_object(o); mpz_com(OBTOMPZ(o), THIS); } @@ -529,7 +529,7 @@ static void mpzmod_sqrt(INT32 args) if(mpz_sgn(THIS)<0) error("mpz->sqrt() on negative number.\n"); - o=clone(mpzmod_program,0); + o=clone_object(mpzmod_program,0); push_object(o); mpz_sqrt(OBTOMPZ(o), THIS); } @@ -542,8 +542,8 @@ static void mpzmod_sqrtrem(INT32 args) if(mpz_sgn(THIS)<0) error("mpz->sqrtrem() on negative number.\n"); - root = clone(mpzmod_program,0); - rem = clone(mpzmod_program,0); + root = clone_object(mpzmod_program,0); + rem = clone_object(mpzmod_program,0); mpz_sqrtrem(OBTOMPZ(root), OBTOMPZ(rem), THIS); push_object(root); push_object(rem); f_aggregate(2); @@ -559,7 +559,7 @@ static void mpzmod_lsh(INT32 args) f_cast(2); if(sp[-1].u.integer < 0) error("mpz->lsh on negative number.\n"); - res = clone(mpzmod_program, 0); + res = clone_object(mpzmod_program, 0); mpz_mul_2exp(OBTOMPZ(res), THIS, sp[-1].u.integer); pop_n_elems(args); push_object(res); @@ -575,7 +575,7 @@ static void mpzmod_rsh(INT32 args) f_cast(2); if (sp[-1].u.integer < 0) error("Gmp.mpz->rsh: Shift count must be positive.\n"); - res = clone(mpzmod_program, 0); + res = clone_object(mpzmod_program, 0); mpz_tdiv_q_2exp(OBTOMPZ(res), THIS, sp[-1].u.integer); pop_n_elems(args); push_object(res); @@ -592,7 +592,7 @@ static void mpzmod_powm(INT32 args) n = get_mpz(sp - 1); if (!mpz_sgn(n)) error("Gmp.mpz->powm: Divide by zero\n"); - res = clone(mpzmod_program, 0); + res = clone_object(mpzmod_program, 0); mpz_powm(OBTOMPZ(res), THIS, get_mpz(sp - 2), n); pop_n_elems(args); push_object(res); @@ -608,7 +608,7 @@ static void mpzmod_pow(INT32 args) error("Gmp.mpz->pow: Non int exponent.\n"); if (sp[-1].u.integer < 0) error("Gmp.mpz->pow: Negative exponent.\n"); - res = clone(mpzmod_program, 0); + res = clone_object(mpzmod_program, 0); mpz_pow_ui(OBTOMPZ(res), THIS, sp[-1].u.integer); pop_n_elems(args); push_object(res); @@ -628,7 +628,7 @@ static void gmp_pow(INT32 args) if ( (sp[-2].type != T_INT) || (sp[-2].u.integer < 0) || (sp[-1].type != T_INT) || (sp[-1].u.integer < 0)) error("Gmp.pow: Negative arguments"); - res = clone(mpzmod_program, 0); + res = clone_object(mpzmod_program, 0); mpz_ui_pow_ui(OBTOMPZ(res), sp[-2].u.integer, sp[-1].u.integer); pop_n_elems(args); push_object(res); @@ -643,7 +643,7 @@ static void gmp_fac(INT32 args) error("Gmp.fac: Non int argument.\n"); if (sp[-1].u.integer < 0) error("Gmp.mpz->pow: Negative exponent.\n"); - res = clone(mpzmod_program, 0); + res = clone_object(mpzmod_program, 0); mpz_fac_ui(OBTOMPZ(res), sp[-1].u.integer); pop_n_elems(args); push_object(res); diff --git a/src/modules/Image/dct.c b/src/modules/Image/dct.c index fa275363335dafb949d4a22196af9b459acdc09d..7c8f35628f9b23b606d73f9f70b0293dce8f8bad 100644 --- a/src/modules/Image/dct.c +++ b/src/modules/Image/dct.c @@ -1,4 +1,4 @@ -/* $Id: dct.c,v 1.2 1997/03/10 21:33:36 grubba Exp $ */ +/* $Id: dct.c,v 1.3 1997/03/12 12:19:25 hubbe Exp $ */ #include "global.h" @@ -54,7 +54,7 @@ void image_dct(INT32 args) error("Out of memory\n"); } - o=clone(image_program,0); + o=clone_object(image_program,0); img=(struct image*)(o->storage); *img=*THIS; diff --git a/src/modules/Image/font.c b/src/modules/Image/font.c index 0e431e5388925d2b24bfb161f12d54160e056297..d019c3e4047cceeb3147672103e05284bb5c2c58 100644 --- a/src/modules/Image/font.c +++ b/src/modules/Image/font.c @@ -1,6 +1,6 @@ #include <config.h> -/* $Id: font.c,v 1.2 1997/03/09 13:45:55 grubba Exp $ */ +/* $Id: font.c,v 1.3 1997/03/12 12:19:25 hubbe Exp $ */ #include "global.h" @@ -367,7 +367,7 @@ void font_write(INT32 args) if (maxwidth>maxwidth2) maxwidth2=maxwidth; } - o = clone(image_program,0); + o = clone_object(image_program,0); img = ((struct image*)o->storage); img->xsize = maxwidth2; if(args>1) diff --git a/src/modules/Image/image.c b/src/modules/Image/image.c index c166b705dc9e868c7ad3c5a2a83a923563b23d4b..2bf3057ebf3647b2109ec399224da8d89b4424b0 100644 --- a/src/modules/Image/image.c +++ b/src/modules/Image/image.c @@ -1,4 +1,4 @@ -/* $Id: image.c,v 1.2 1997/03/09 13:45:56 grubba Exp $ */ +/* $Id: image.c,v 1.3 1997/03/12 12:19:26 hubbe Exp $ */ #include "global.h" @@ -7,7 +7,7 @@ #include "stralloc.h" #include "global.h" -RCSID("$Id: image.c,v 1.2 1997/03/09 13:45:56 grubba Exp $"); +RCSID("$Id: image.c,v 1.3 1997/03/12 12:19:26 hubbe Exp $"); #include "types.h" #include "macros.h" #include "object.h" @@ -385,7 +385,7 @@ void image_clone(INT32 args) sp[1-args].type!=T_INT) error("Illegal arguments to image->clone()\n"); - o=clone(image_program,0); + o=clone_object(image_program,0); img=(struct image*)(o->storage); *img=*THIS; @@ -431,7 +431,7 @@ void image_clear(INT32 args) struct object *o; struct image *img; - o=clone(image_program,0); + o=clone_object(image_program,0); img=(struct image*)(o->storage); *img=*THIS; @@ -457,7 +457,7 @@ void image_copy(INT32 args) if (!args) { - o=clone(image_program,0); + o=clone_object(image_program,0); if (THIS->img) img_clone((struct image*)o->storage,THIS); pop_n_elems(args); push_object(o); @@ -474,7 +474,7 @@ void image_copy(INT32 args) getrgb(THIS,2,args,"image->crop()"); - o=clone(image_program,0); + o=clone_object(image_program,0); img=(struct image*)(o->storage); img_crop(img,THIS, @@ -511,7 +511,7 @@ static void image_change_color(INT32 args) to=THIS->rgb; } - o=clone(image_program,0); + o=clone_object(image_program,0); img=(struct image*)(o->storage); *img=*THIS; @@ -610,7 +610,7 @@ void image_autocrop(INT32 args) if (!done) break; } - o=clone(image_program,0); + o=clone_object(image_program,0); img=(struct image*)(o->storage); img_crop(img,THIS,x1-border,y1-border,x2+border,y2+border); @@ -910,7 +910,7 @@ void image_gray(INT32 args) getrgbl(&rgb,0,args,"image->gray()"); div=rgb.r+rgb.g+rgb.b; - o=clone(image_program,0); + o=clone_object(image_program,0); img=(struct image*)o->storage; *img=*THIS; if (!(img->img=malloc(sizeof(rgb_group)*THIS->xsize*THIS->ysize+1))) @@ -958,7 +958,7 @@ void image_color(INT32 args) else getrgbl(&rgb,0,args,"image->color()"); - o=clone(image_program,0); + o=clone_object(image_program,0); img=(struct image*)o->storage; *img=*THIS; if (!(img->img=malloc(sizeof(rgb_group)*THIS->xsize*THIS->ysize+1))) @@ -996,7 +996,7 @@ void image_invert(INT32 args) if (!THIS->img) error("no image\n"); - o=clone(image_program,0); + o=clone_object(image_program,0); img=(struct image*)o->storage; *img=*THIS; if (!(img->img=malloc(sizeof(rgb_group)*THIS->xsize*THIS->ysize+1))) @@ -1035,7 +1035,7 @@ void image_threshold(INT32 args) getrgb(THIS,0,args,"image->threshold()"); - o=clone(image_program,0); + o=clone_object(image_program,0); img=(struct image*)o->storage; *img=*THIS; if (!(img->img=malloc(sizeof(rgb_group)*THIS->xsize*THIS->ysize+1))) @@ -1079,7 +1079,7 @@ void image_distancesq(INT32 args) getrgb(THIS,0,args,"image->threshold()"); - o=clone(image_program,0); + o=clone_object(image_program,0); img=(struct image*)o->storage; *img=*THIS; if (!(img->img=malloc(sizeof(rgb_group)*THIS->xsize*THIS->ysize+1))) @@ -1234,7 +1234,7 @@ void image_select_from(INT32 args) low_limit=30; low_limit=low_limit*low_limit; - o=clone(image_program,0); + o=clone_object(image_program,0); img=(struct image*)o->storage; *img=*THIS; if (!(img->img=malloc(sizeof(rgb_group)*THIS->xsize*THIS->ysize+1))) @@ -1363,7 +1363,7 @@ CHRONO("apply_matrix"); free_svalue(&s2); } - o=clone(image_program,0); + o=clone_object(image_program,0); CHRONO("apply_matrix, begin"); @@ -1444,7 +1444,7 @@ void image_modify_by_intensity(INT32 args) list[255]=s[x]; free(s); - o=clone(image_program,0); + o=clone_object(image_program,0); img=(struct image*)o->storage; *img=*THIS; if (!(img->img=malloc(sizeof(rgb_group)*THIS->xsize*THIS->ysize+1))) @@ -1490,7 +1490,7 @@ static void image_map_closest(INT32 args) push_int(THIS->xsize); push_int(THIS->ysize); - o=clone(image_program,2); + o=clone_object(image_program,2); ct=colortable_from_array(sp[-args].u.array,"image->map_closest()\n"); pop_n_elems(args); @@ -1524,7 +1524,7 @@ static void image_map_fast(INT32 args) push_int(THIS->xsize); push_int(THIS->ysize); - o=clone(image_program,2); + o=clone_object(image_program,2); ct=colortable_from_array(sp[-args].u.array,"image->map_closest()\n"); pop_n_elems(args); @@ -1560,7 +1560,7 @@ static void image_map_fs(INT32 args) push_int(THIS->xsize); push_int(THIS->ysize); - o=clone(image_program,2); + o=clone_object(image_program,2); res=(int*)xalloc(sizeof(int)*THIS->xsize); errb=(rgbl_group*)xalloc(sizeof(rgbl_group)*THIS->xsize); diff --git a/src/modules/Image/matrix.c b/src/modules/Image/matrix.c index 4b207261b4d50b854f9c7e178b57b89f5528eec5..e17819f3395293f8a1e7aa20f8b2b67c9cc9160a 100644 --- a/src/modules/Image/matrix.c +++ b/src/modules/Image/matrix.c @@ -1,4 +1,4 @@ -/* $Id: matrix.c,v 1.1 1997/02/11 08:35:44 hubbe Exp $ */ +/* $Id: matrix.c,v 1.2 1997/03/12 12:19:26 hubbe Exp $ */ #include "global.h" @@ -265,7 +265,7 @@ void image_scale(INT32 args) struct object *o; struct image *newimg; - o=clone(image_program,0); + o=clone_object(image_program,0); newimg=(struct image*)(o->storage); if (args==1 && sp[-args].type==T_FLOAT) { @@ -326,7 +326,7 @@ void image_ccw(INT32 args) if (!THIS->img) error("no image\n"); - o=clone(image_program,0); + o=clone_object(image_program,0); img=(struct image*)o->storage; *img=*THIS; if (!(img->img=malloc(sizeof(rgb_group)*THIS->xsize*THIS->ysize+1))) @@ -417,7 +417,7 @@ void image_cw(INT32 args) if (!THIS->img) error("no image\n"); - o=clone(image_program,0); + o=clone_object(image_program,0); img=(struct image*)o->storage; *img=*THIS; if (!(img->img=malloc(sizeof(rgb_group)*THIS->xsize*THIS->ysize+1))) @@ -454,7 +454,7 @@ void image_mirrorx(INT32 args) if (!THIS->img) error("no image\n"); - o=clone(image_program,0); + o=clone_object(image_program,0); img=(struct image*)o->storage; *img=*THIS; if (!(img->img=malloc(sizeof(rgb_group)*THIS->xsize*THIS->ysize+1))) @@ -490,7 +490,7 @@ void image_mirrory(INT32 args) if (!THIS->img) error("no image\n"); - o=clone(image_program,0); + o=clone_object(image_program,0); img=(struct image*)o->storage; *img=*THIS; if (!(img->img=malloc(sizeof(rgb_group)*THIS->xsize*THIS->ysize+1))) @@ -690,7 +690,7 @@ void image_skewx(INT32 args) if (!THIS->img) error("no image\n"); - o=clone(image_program,0); + o=clone_object(image_program,0); if (!getrgb((struct image*)(o->storage),1,args,"image->skewx()")) ((struct image*)(o->storage))->rgb=THIS->rgb; @@ -717,7 +717,7 @@ void image_skewy(INT32 args) if (!THIS->img) error("no image\n"); - o=clone(image_program,0); + o=clone_object(image_program,0); if (!getrgb((struct image*)(o->storage),1,args,"image->skewy()")) ((struct image*)(o->storage))->rgb=THIS->rgb; @@ -744,7 +744,7 @@ void image_skewx_expand(INT32 args) if (!THIS->img) error("no image\n"); - o=clone(image_program,0); + o=clone_object(image_program,0); if (!getrgb((struct image*)(o->storage),1,args,"image->skewx()")) ((struct image*)(o->storage))->rgb=THIS->rgb; @@ -771,7 +771,7 @@ void image_skewy_expand(INT32 args) if (!THIS->img) error("no image\n"); - o=clone(image_program,0); + o=clone_object(image_program,0); if (!getrgb((struct image*)(o->storage),1,args,"image->skewy()")) ((struct image*)(o->storage))->rgb=THIS->rgb; @@ -825,7 +825,7 @@ void img_rotate(INT32 args,int xpn) angle=(angle/180.0)*3.141592653589793; - o=clone(image_program,0); + o=clone_object(image_program,0); dest=(struct image*)(o->storage); if (!getrgb(dest,1,args,"image->rotate()")) @@ -876,7 +876,7 @@ void img_translate(INT32 args,int expand) xt-=floor(xt); yt-=floor(yt); - o=clone(image_program,0); + o=clone_object(image_program,0); img=(struct image*)o->storage; img->xsize=THIS->xsize+(xt!=0); diff --git a/src/modules/Image/operator.c b/src/modules/Image/operator.c index d411eb6474c15c75c55b2f5ccebd38d0100e1abf..57ea00083fbeb69757a313d79e4c5fc23e1d7cd1 100644 --- a/src/modules/Image/operator.c +++ b/src/modules/Image/operator.c @@ -1,4 +1,4 @@ -/* $Id: operator.c,v 1.1 1997/02/11 08:35:45 hubbe Exp $ */ +/* $Id: operator.c,v 1.2 1997/03/12 12:19:26 hubbe Exp $ */ #include "global.h" #include <math.h> @@ -61,7 +61,7 @@ extern struct program *image_program; \ push_int(THIS->xsize); \ push_int(THIS->ysize); \ - o=clone(image_program,2); \ + o=clone_object(image_program,2); \ img=(struct image*)o->storage; \ if (!img->img) { free_object(o); error("out of memory\n"); } \ \ diff --git a/src/modules/Image/pattern.c b/src/modules/Image/pattern.c index f96e2dd5fe5a7568ea7000b24ddb4642d61cc581..b7ce956c09f34d26021b884317397e24fe5829f6 100644 --- a/src/modules/Image/pattern.c +++ b/src/modules/Image/pattern.c @@ -1,4 +1,4 @@ -/* $Id: pattern.c,v 1.1 1997/02/11 08:35:45 hubbe Exp $ */ +/* $Id: pattern.c,v 1.2 1997/03/12 12:19:27 hubbe Exp $ */ #include "global.h" @@ -208,7 +208,7 @@ void image_noise(INT32 args) init_colorrange(cr,sp-args,"image->noise()"); - o=clone(image_program,0); + o=clone_object(image_program,0); img=(struct image*)o->storage; *img=*THIS; if (!(img->img=malloc(sizeof(rgb_group)*THIS->xsize*THIS->ysize+1))) @@ -263,7 +263,7 @@ void image_turbulence(INT32 args) init_colorrange(cr,sp-args,"image->turbulence()"); - o=clone(image_program,0); + o=clone_object(image_program,0); img=(struct image*)o->storage; *img=*THIS; if (!(img->img=malloc(sizeof(rgb_group)*THIS->xsize*THIS->ysize+1))) diff --git a/src/modules/Mysql/mysql.c b/src/modules/Mysql/mysql.c index 6fd31beff6ff63957f140422c44b8046929a2688..1117314ae76c5377ab56e864495f0009c2b54ff9 100644 --- a/src/modules/Mysql/mysql.c +++ b/src/modules/Mysql/mysql.c @@ -1,5 +1,5 @@ /* - * $Id: mysql.c,v 1.2 1997/03/09 13:46:51 grubba Exp $ + * $Id: mysql.c,v 1.3 1997/03/12 12:20:02 hubbe Exp $ * * SQL database functionality for Pike * @@ -71,7 +71,7 @@ typedef struct dynamic_buffer_s dynamic_buffer; * Globals */ -RCSID("$Id: mysql.c,v 1.2 1997/03/09 13:46:51 grubba Exp $"); +RCSID("$Id: mysql.c,v 1.3 1997/03/12 12:20:02 hubbe Exp $"); struct program *mysql_program = NULL; @@ -304,7 +304,7 @@ static void f_big_query(INT32 args) push_object(fp->current_object); fp->current_object->refs++; - push_object(clone(mysql_result_program, 1)); + push_object(clone_object(mysql_result_program, 1)); } } @@ -499,7 +499,7 @@ static void f_list_dbs(INT32 args) push_object(fp->current_object); fp->current_object->refs++; - push_object(clone(mysql_result_program, 1)); + push_object(clone_object(mysql_result_program, 1)); } /* object(mysql_res) list_tables(void|string wild) */ @@ -536,7 +536,7 @@ static void f_list_tables(INT32 args) push_object(fp->current_object); fp->current_object->refs++; - push_object(clone(mysql_result_program, 1)); + push_object(clone_object(mysql_result_program, 1)); } /* array(int|mapping(string:mixed)) list_fields(string table, void|string wild) */ @@ -615,7 +615,7 @@ static void f_list_processes(INT32 args) push_object(fp->current_object); fp->current_object->refs++; - push_object(clone(mysql_result_program, 1)); + push_object(clone_object(mysql_result_program, 1)); } /* diff --git a/src/modules/Pipe/pipe.c b/src/modules/Pipe/pipe.c index 863384713ee093ac3f94bfc912f35ca08a342a57..1e2799196baaa5bb0bcd203533b743b0c399179b 100644 --- a/src/modules/Pipe/pipe.c +++ b/src/modules/Pipe/pipe.c @@ -20,7 +20,7 @@ #include <fcntl.h> #include "global.h" -RCSID("$Id: pipe.c,v 1.2 1997/02/20 01:35:52 grubba Exp $"); +RCSID("$Id: pipe.c,v 1.3 1997/03/12 12:20:30 hubbe Exp $"); #include "stralloc.h" #include "types.h" @@ -733,7 +733,7 @@ static void pipe_output(INT32 args) THISOBJ->refs++; /* Weird */ /* Allocate a new struct output */ - obj=clone(output_program,0); + obj=clone_object(output_program,0); o=(struct output *)(obj->storage); o->next=THIS->firstoutput; THIS->firstoutput=obj; diff --git a/src/modules/Ssleay/ssleay.c b/src/modules/Ssleay/ssleay.c index 5497eefe4df4ef32d2903b4e3f63dbec69f65259..ee8028afc22aa6b2840d7f1c5b3a17b91c182a2f 100644 --- a/src/modules/Ssleay/ssleay.c +++ b/src/modules/Ssleay/ssleay.c @@ -5,7 +5,7 @@ \*/ #include "global.h" -RCSID("$Id: ssleay.c,v 1.1 1997/02/11 08:39:19 hubbe Exp $"); +RCSID("$Id: ssleay.c,v 1.2 1997/03/12 12:20:48 hubbe Exp $"); #include "types.h" #include "interpret.h" #include "svalue.h" @@ -203,7 +203,7 @@ static void ssleay_new(INT32 args) pop_n_elems(args); THISOBJ->refs++; push_object(THISOBJ); - push_object(clone(ssleay_connection_program, 1)); + push_object(clone_object(ssleay_connection_program, 1)); } diff --git a/src/modules/_Crypto/cbc.c b/src/modules/_Crypto/cbc.c index 23d9172bc6c4091d652dffe2842748add3f720d4..4c3944675f9bd5adb69f215dfead2fde900662fb 100644 --- a/src/modules/_Crypto/cbc.c +++ b/src/modules/_Crypto/cbc.c @@ -1,5 +1,5 @@ /* - * $Id: cbc.c,v 1.5 1997/03/11 03:12:59 nisse Exp $ + * $Id: cbc.c,v 1.6 1997/03/12 12:21:13 hubbe Exp $ * * CBC (Cipher Block Chaining Mode) crypto module for Pike. * @@ -128,7 +128,7 @@ static void f_create(INT32 args) error("Bad argument 1 to cbc->create()\n"); } if (sp[-args].type == T_PROGRAM) { - THIS->object = clone(sp[-args].u.program, args-1); + THIS->object = clone_object(sp[-args].u.program, args-1); } else { if (args != 1) { error("Too many arguments to cbc->create()\n"); diff --git a/src/modules/_Crypto/crypto.c b/src/modules/_Crypto/crypto.c index fc59410511e54fae021b5ccb026602a288209437..4741db00fa33880098438ca120b99eeaab502985 100644 --- a/src/modules/_Crypto/crypto.c +++ b/src/modules/_Crypto/crypto.c @@ -1,5 +1,5 @@ /* - * $Id: crypto.c,v 1.16 1997/03/11 03:13:51 nisse Exp $ + * $Id: crypto.c,v 1.17 1997/03/12 12:21:14 hubbe Exp $ * * A pike module for getting access to some common cryptos. * @@ -231,7 +231,7 @@ static void f_create(INT32 args) error("Bad argument 1 to crypto->create()\n"); } if (sp[-args].type == T_PROGRAM) { - THIS->object = clone(sp[-args].u.program, args-1); + THIS->object = clone_object(sp[-args].u.program, args-1); } else { if (args != 1) { error("Too many arguments to crypto->create()\n"); diff --git a/src/modules/_Crypto/pipe.c b/src/modules/_Crypto/pipe.c index 04dc56acae435ef179342472ee814ebe6865b079..23405e51d07b9914f3a1f37fc63718bd16201303 100644 --- a/src/modules/_Crypto/pipe.c +++ b/src/modules/_Crypto/pipe.c @@ -1,5 +1,5 @@ /* - * $Id: pipe.c,v 1.5 1997/03/11 03:17:40 nisse Exp $ + * $Id: pipe.c,v 1.6 1997/03/12 12:21:14 hubbe Exp $ * * PIPE crypto module for Pike. * @@ -84,7 +84,7 @@ static void f_create(INT32 args) THIS->objects[args + i] = sp[i].u.object; THIS->objects[i]->refs++; } else if (sp[i].type == T_PROGRAM) { - THIS->objects[i] = clone(sp[i].u.program, 0); + THIS->objects[i] = clone_object(sp[i].u.program, 0); } else if (sp[i].type == T_ARRAY) { struct program *prog; INT32 n_args; @@ -100,7 +100,7 @@ static void f_create(INT32 args) n_args = sp[i].u.array->size - 1; push_array_items(sp[i].u.array); /* Pushes one arg too many */ - THIS->objects[i] = clone(prog, n_args); + THIS->objects[i] = clone_object(prog, n_args); pop_stack(); /* Pop the program */ diff --git a/src/modules/files/file.c b/src/modules/files/file.c index d77addf546305cdb017fa1d48038bca7d0b6109a..7ea1159fea4d511f920a9900437baee5eb2d9ca2 100644 --- a/src/modules/files/file.c +++ b/src/modules/files/file.c @@ -6,7 +6,7 @@ #define READ_BUFFER 8192 #include "global.h" -RCSID("$Id: file.c,v 1.28 1997/02/07 01:40:16 hubbe Exp $"); +RCSID("$Id: file.c,v 1.29 1997/03/12 12:21:50 hubbe Exp $"); #include "types.h" #include "interpret.h" #include "svalue.h" @@ -888,7 +888,7 @@ struct object *file_make_object_from_fd(int fd, int mode) struct object *o; init_fd(fd, mode); - o=clone(file_program,0); + o=clone_object(file_program,0); ((struct file_struct *)(o->storage))->fd=fd; ((struct file_struct *)(o->storage))->my_errno=0; return o; @@ -1090,7 +1090,7 @@ static void file_dup(INT32 args) pop_n_elems(args); - o=clone(file_program,0); + o=clone_object(file_program,0); ((struct file_struct *)o->storage)->fd=FD; ((struct file_struct *)o->storage)->my_errno=0; ERRNO=0; @@ -1114,7 +1114,7 @@ static void file_assign(INT32 args) * /precompiled/file */ if(!o->prog || o->prog->inherits[0].prog != file_program) - error("Argument 1 to file->assign() must be a clone of /precompiled/file\n"); + error("Argument 1 to file->assign() must be a clone of Stdio.File\n"); do_close(FD, FILE_READ | FILE_WRITE); FD=((struct file_struct *)(o->storage))->fd; @@ -1145,7 +1145,7 @@ static void file_dup2(INT32 args) * /precompiled/file */ if(!o->prog || o->prog->inherits[0].prog != file_program) - error("Argument 1 to file->assign() must be a clone of /precompiled/file\n"); + error("Argument 1 to file->assign() must be a clone of Stdio.File\n"); fd=((struct file_struct *)(o->storage))->fd; diff --git a/src/object.c b/src/object.c index 7d8ee011dd40d1f4053ee2d47efaa6c279011c89..3cc7868bcfe845e385fab6a8409154f83df55596 100644 --- a/src/object.c +++ b/src/object.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: object.c,v 1.14 1997/03/11 23:32:29 grubba Exp $"); +RCSID("$Id: object.c,v 1.15 1997/03/12 12:15:28 hubbe Exp $"); #include "object.h" #include "dynamic_buffer.h" #include "interpret.h" @@ -111,7 +111,7 @@ static void init_object(struct object *o, int args) pop_stack(); } -struct object *clone(struct program *p, int args) +struct object *clone_object(struct program *p, int args) { struct object *o=low_clone(p); init_object(o,args); @@ -144,7 +144,7 @@ struct object *get_master() free_string(master_name); if(!master_program) return 0; } - master_object=clone(master_program,0); + master_object=clone_object(master_program,0); apply_lfun(master_object,LFUN___INIT,0); pop_stack(); diff --git a/src/object.h b/src/object.h index 18c3c55038c22506d4022f1e491b607e975b719d..28f4d91878d3b76152f5425300398fa3ac88317a 100644 --- a/src/object.h +++ b/src/object.h @@ -39,7 +39,7 @@ extern struct program *master_program; /* Prototypes begin here */ void setup_fake_object(); struct object *low_clone(struct program *p); -struct object *clone(struct program *p, int args); +struct object *clone_object(struct program *p, int args); struct object *get_master(); struct object *master(); void destruct(struct object *o); diff --git a/src/testsuite.in b/src/testsuite.in index b860ea9a346e4f34ada0f07deef9db39e331ea1f..5afde4940b2a074eaea8c18399a783165340a052 100644 --- a/src/testsuite.in +++ b/src/testsuite.in @@ -1,4 +1,4 @@ -test_true([["$Id: testsuite.in,v 1.35 1997/03/11 03:36:42 hubbe Exp $"]]) +test_true([["$Id: testsuite.in,v 1.36 1997/03/12 12:15:28 hubbe Exp $"]]) test_any([[class foo { constant x=17; }; class bar { inherit foo; constant x=18; }; return bar()->x;]],18) test_program([[inline string foo(string s){ while(s[0] == ' ' || s[0] == '\t') s = s[1..]; return(s); } string a() { return foo(" bar"); }]]) test_true([[lambda(function f) {return 1;}(object_program(this_object()));]]) @@ -359,12 +359,12 @@ test_eq(signame(2),"SIGINT") // kill, signal, getpid test_true(intp(getpid())) -test_do(signal(signum("SIGUSR1"),lambda() { add_constant("AFJLLAF",17); })) -test_do(kill(getpid(),signum("SIGUSR1"))) +test_do(signal(signum("SIGFPE"),lambda() { add_constant("AFJLLAF",17); })) +test_do(kill(getpid(),signum("SIGFPE"))) test_eq(AFJLLAF,17) test_do(add_constant("AFJLLAF")) -test_do(signal(signum("SIGUSR1",0))) -test_do(signal(signum("SIGUSR1"))) +test_do(signal(signum("SIGFPE",0))) +test_do(signal(signum("SIGFPE"))) // typeof test_eq(typeof(1),"int") diff --git a/src/threads.c b/src/threads.c index 74cfba495bbce370c8daf1e6abbcc816c0ee6b33..7991c916b98bdf92b2bd7300439bef24ba69766e 100644 --- a/src/threads.c +++ b/src/threads.c @@ -1,5 +1,5 @@ #include "global.h" -RCSID("$Id: threads.c,v 1.18 1997/03/01 01:41:06 hubbe Exp $"); +RCSID("$Id: threads.c,v 1.19 1997/03/12 12:15:29 hubbe Exp $"); int num_threads = 1; int threads_disabled = 0; @@ -99,7 +99,7 @@ void f_thread_create(INT32 args) int tmp; arg=ALLOC_STRUCT(thread_starter); arg->args=aggregate_array(args); - arg->id=clone(thread_id_prog,0); + arg->id=clone_object(thread_id_prog,0); tmp=th_create(&dummy,new_thread_func,arg); @@ -175,7 +175,7 @@ void f_mutex_lock(INT32 args) pop_n_elems(args); m=THIS_MUTEX; - o=clone(mutex_key,0); + o=clone_object(mutex_key,0); mt_lock(& mutex_kluge); THREADS_ALLOW(); while(m->key) co_wait(& m->condition, & mutex_kluge); @@ -193,7 +193,7 @@ void f_mutex_trylock(INT32 args) int i=0; pop_n_elems(args); - o=clone(mutex_key,0); + o=clone_object(mutex_key,0); m=THIS_MUTEX; mt_lock(& mutex_kluge); THREADS_ALLOW(); @@ -365,7 +365,7 @@ void th_init() if(!mutex_key) fatal("Failed to initialize thread program!\n"); - thread_id=clone(thread_id_prog,0); + thread_id=clone_object(thread_id_prog,0); } void th_cleanup()