diff --git a/src/builtin_functions.h b/src/builtin_functions.h index a3c0970a1ba55c82b36e9e51cc4fb31628f31da3..54053a326345415c74a24c0bc76f7ceb8caf2a27 100644 --- a/src/builtin_functions.h +++ b/src/builtin_functions.h @@ -5,7 +5,7 @@ \*/ /* - * $Id: builtin_functions.h,v 1.9 1999/05/11 18:56:34 mirar Exp $ + * $Id: builtin_functions.h,v 1.10 1999/11/18 04:14:44 hubbe Exp $ */ #ifndef BUILTIN_EFUNS_H #define BUILTIN_EFUNS_H @@ -67,12 +67,12 @@ void f_functionp(INT32 args); void f_sleep(INT32 args); void f_gc(INT32 args); void f_programp(INT32 args); -TYPEP(f_intp, "intpp", T_INT) -TYPEP(f_mappingp, "mappingp", T_MAPPING) -TYPEP(f_arrayp, "arrayp", T_ARRAY) -TYPEP(f_multisetp, "multisetp", T_MULTISET) -TYPEP(f_stringp, "stringp", T_STRING) -TYPEP(f_floatp, "floatp", T_FLOAT) +TYPEP(f_intp, "intpp", PIKE_T_INT) +TYPEP(f_mappingp, "mappingp", PIKE_T_MAPPING) +TYPEP(f_arrayp, "arrayp", PIKE_T_ARRAY) +TYPEP(f_multisetp, "multisetp", PIKE_T_MULTISET) +TYPEP(f_stringp, "stringp", PIKE_T_STRING) +TYPEP(f_floatp, "floatp", PIKE_T_FLOAT) void f_sort(INT32 args); void f_rows(INT32 args); void f_column(INT32 args); diff --git a/src/errors.h b/src/errors.h index b08408173b582e48c281acb958ff377d04a3b220..0d20e8c5105678f3bdfec5a26053010f850febc4 100644 --- a/src/errors.h +++ b/src/errors.h @@ -60,8 +60,8 @@ struct PIKE_CONCAT(NAME,_error_struct) { \ #endif DECLARE_ERROR(generic, EMPTY , - ERR_VAR(struct pike_string *,string,T_STRING,desc) - ERR_VAR(struct array *,array,T_ARRAY,backtrace) + ERR_VAR(struct pike_string *,string,PIKE_T_STRING,desc) + ERR_VAR(struct array *,array,PIKE_T_ARRAY,backtrace) ERR_FUNC("cast",f_error_cast,tFunc(tString,tMixed),0) ERR_FUNC("`[]",f_error_index,tFunc(tString,tMixed),0) ERR_FUNC("describe",f_error_describe,tFunc(tVoid,tString),0) @@ -78,8 +78,8 @@ DECLARE_ERROR(index, DECLARE_ERROR(bad_arg, ERR_INHERIT(generic), - ERR_VAR(INT_TYPE, int, T_INT, which_arg) - ERR_VAR(struct pike_string *,string,T_STRING,expected_type) + ERR_VAR(INT_TYPE, int, PIKE_T_INT, which_arg) + ERR_VAR(struct pike_string *,string,PIKE_T_STRING,expected_type) ERR_VAR(struct svalue, mixed, T_MIXED, got) ) @@ -90,13 +90,13 @@ DECLARE_ERROR(math, DECLARE_ERROR(resource, ERR_INHERIT(generic), - ERR_VAR(struct pike_string *,string,T_STRING,resource_type) - ERR_VAR(INT_TYPE, int, T_INT, howmuch) + ERR_VAR(struct pike_string *,string,PIKE_T_STRING,resource_type) + ERR_VAR(INT_TYPE, int, PIKE_T_INT, howmuch) ) DECLARE_ERROR(permission, ERR_INHERIT(generic), - ERR_VAR(struct pike_string *,string,T_STRING,permission_type) + ERR_VAR(struct pike_string *,string,PIKE_T_STRING,permission_type) ) #undef DECLARE_ERROR #undef ERR_INHERIT diff --git a/src/interpret.h b/src/interpret.h index 4d4b77ffdc6bc2863e0d4d87504bcc4822ad49f9..ef4dfdb28bbc615e24d4749810c82d5b57e77b27 100644 --- a/src/interpret.h +++ b/src/interpret.h @@ -5,7 +5,7 @@ \*/ /* - * $Id: interpret.h,v 1.34 1999/10/21 21:34:32 hubbe Exp $ + * $Id: interpret.h,v 1.35 1999/11/18 04:14:46 hubbe Exp $ */ #ifndef INTERPRET_H #define INTERPRET_H @@ -76,23 +76,23 @@ struct pike_frame do { struct svalue s=sp[-1]; sp[-1]=sp[-1-(X)]; sp[-1-(X)]=s; \ pop_n_elems(X); } while (0) -#define push_program(P) do{ struct program *_=(P); debug_malloc_touch(_); sp->u.program=_; sp++->type=T_PROGRAM; }while(0) -#define push_int(I) do{ INT32 _=(I); sp->u.integer=_;sp->type=T_INT;sp++->subtype=NUMBER_NUMBER; }while(0) -#define push_mapping(M) do{ struct mapping *_=(M); debug_malloc_touch(_); sp->u.mapping=_; sp++->type=T_MAPPING; }while(0) -#define push_array(A) do{ struct array *_=(A); debug_malloc_touch(_); sp->u.array=_ ;sp++->type=T_ARRAY; }while(0) -#define push_multiset(L) do{ struct multiset *_=(L); debug_malloc_touch(_); sp->u.multiset=_; sp++->type=T_MULTISET; }while(0) -#define push_string(S) do{ struct pike_string *_=(S); debug_malloc_touch(_); sp->subtype=0; sp->u.string=_; sp++->type=T_STRING; }while(0) -#define push_object(O) do{ struct object *_=(O); debug_malloc_touch(_); sp->u.object=_; sp++->type=T_OBJECT; }while(0) -#define push_float(F) do{ float _=(F); sp->u.float_number=_; sp++->type=T_FLOAT; }while(0) +#define push_program(P) do{ struct program *_=(P); debug_malloc_touch(_); sp->u.program=_; sp++->type=PIKE_T_PROGRAM; }while(0) +#define push_int(I) do{ INT32 _=(I); sp->u.integer=_;sp->type=PIKE_T_INT;sp++->subtype=NUMBER_NUMBER; }while(0) +#define push_mapping(M) do{ struct mapping *_=(M); debug_malloc_touch(_); sp->u.mapping=_; sp++->type=PIKE_T_MAPPING; }while(0) +#define push_array(A) do{ struct array *_=(A); debug_malloc_touch(_); sp->u.array=_ ;sp++->type=PIKE_T_ARRAY; }while(0) +#define push_multiset(L) do{ struct multiset *_=(L); debug_malloc_touch(_); sp->u.multiset=_; sp++->type=PIKE_T_MULTISET; }while(0) +#define push_string(S) do{ struct pike_string *_=(S); debug_malloc_touch(_); sp->subtype=0; sp->u.string=_; sp++->type=PIKE_T_STRING; }while(0) +#define push_object(O) do{ struct object *_=(O); debug_malloc_touch(_); sp->u.object=_; sp++->type=PIKE_T_OBJECT; }while(0) +#define push_float(F) do{ float _=(F); sp->u.float_number=_; sp++->type=PIKE_T_FLOAT; }while(0) #define push_text(T) push_string(make_shared_string((T))) -#define push_constant_text(T) do{ sp->subtype=0; MAKE_CONSTANT_SHARED_STRING(sp->u.string,T); sp++->type=T_STRING; }while(0) - -#define ref_push_program(P) do{ struct program *_=(P); debug_malloc_touch(_); _->refs++; sp->u.program=_; sp++->type=T_PROGRAM; }while(0) -#define ref_push_mapping(M) do{ struct mapping *_=(M); debug_malloc_touch(_); _->refs++; sp->u.mapping=_; sp++->type=T_MAPPING; }while(0) -#define ref_push_array(A) do{ struct array *_=(A); debug_malloc_touch(_); _->refs++; sp->u.array=_ ;sp++->type=T_ARRAY; }while(0) -#define ref_push_multiset(L) do{ struct multiset *_=(L); debug_malloc_touch(_); _->refs++; sp->u.multiset=_; sp++->type=T_MULTISET; }while(0) -#define ref_push_string(S) do{ struct pike_string *_=(S); debug_malloc_touch(_); _->refs++; sp->subtype=0; sp->u.string=_; sp++->type=T_STRING; }while(0) -#define ref_push_object(O) do{ struct object *_=(O); debug_malloc_touch(_); _->refs++; sp->u.object=_; sp++->type=T_OBJECT; }while(0) +#define push_constant_text(T) do{ sp->subtype=0; MAKE_CONSTANT_SHARED_STRING(sp->u.string,T); sp++->type=PIKE_T_STRING; }while(0) + +#define ref_push_program(P) do{ struct program *_=(P); debug_malloc_touch(_); _->refs++; sp->u.program=_; sp++->type=PIKE_T_PROGRAM; }while(0) +#define ref_push_mapping(M) do{ struct mapping *_=(M); debug_malloc_touch(_); _->refs++; sp->u.mapping=_; sp++->type=PIKE_T_MAPPING; }while(0) +#define ref_push_array(A) do{ struct array *_=(A); debug_malloc_touch(_); _->refs++; sp->u.array=_ ;sp++->type=PIKE_T_ARRAY; }while(0) +#define ref_push_multiset(L) do{ struct multiset *_=(L); debug_malloc_touch(_); _->refs++; sp->u.multiset=_; sp++->type=PIKE_T_MULTISET; }while(0) +#define ref_push_string(S) do{ struct pike_string *_=(S); debug_malloc_touch(_); _->refs++; sp->subtype=0; sp->u.string=_; sp++->type=PIKE_T_STRING; }while(0) +#define ref_push_object(O) do{ struct object *_=(O); debug_malloc_touch(_); _->refs++; sp->u.object=_; sp++->type=PIKE_T_OBJECT; }while(0) #define push_svalue(S) do { struct svalue *_=(S); assign_svalue_no_free(sp,_); sp++; }while(0) diff --git a/src/interpreter.h b/src/interpreter.h index f856c8ecec9231b3607e2a3c1895cceb080c3c3e..9f26933c71ddadf19a3d966f19a74b4135268b13 100644 --- a/src/interpreter.h +++ b/src/interpreter.h @@ -143,7 +143,7 @@ static int eval_instruction(unsigned char *pc) CASE(F_MARK_AND_STRING); *(mark_sp++)=sp; CASE(F_STRING); copy_shared_string(sp->u.string,fp->context.prog->strings[GET_ARG()]); - sp->type=T_STRING; + sp->type=PIKE_T_STRING; sp->subtype=0; sp++; print_return_value(); @@ -151,7 +151,7 @@ static int eval_instruction(unsigned char *pc) CASE(F_ARROW_STRING); copy_shared_string(sp->u.string,fp->context.prog->strings[GET_ARG()]); - sp->type=T_STRING; + sp->type=PIKE_T_STRING; sp->subtype=1; /* Magic */ sp++; print_return_value(); @@ -163,7 +163,7 @@ static int eval_instruction(unsigned char *pc) break; CASE(F_FLOAT); - sp->type=T_FLOAT; + sp->type=PIKE_T_FLOAT; MEMCPY((void *)&sp->u.float_number, pc, sizeof(FLOAT_TYPE)); pc+=sizeof(FLOAT_TYPE); sp++; @@ -173,7 +173,7 @@ static int eval_instruction(unsigned char *pc) sp->u.object=fp->current_object; add_ref(fp->current_object); sp->subtype=GET_ARG()+fp->context.identifier_level; - sp->type=T_FUNCTION; + sp->type=PIKE_T_FUNCTION; sp++; print_return_value(); break; @@ -404,10 +404,10 @@ static int eval_instruction(unsigned char *pc) CASE(F_CLEAR_2_LOCAL); instr=GET_ARG(); free_svalues(fp->locals + instr, 2, -1); - fp->locals[instr].type=T_INT; + fp->locals[instr].type=PIKE_T_INT; fp->locals[instr].subtype=0; fp->locals[instr].u.integer=0; - fp->locals[instr+1].type=T_INT; + fp->locals[instr+1].type=PIKE_T_INT; fp->locals[instr+1].subtype=0; fp->locals[instr+1].u.integer=0; break; @@ -419,7 +419,7 @@ static int eval_instruction(unsigned char *pc) free_svalues(fp->locals + instr, 4, -1); for(e=0;e<4;e++) { - fp->locals[instr+e].type=T_INT; + fp->locals[instr+e].type=PIKE_T_INT; fp->locals[instr+e].subtype=0; fp->locals[instr+e].u.integer=0; } @@ -429,7 +429,7 @@ static int eval_instruction(unsigned char *pc) CASE(F_CLEAR_LOCAL); instr=GET_ARG(); free_svalue(fp->locals + instr); - fp->locals[instr].type=T_INT; + fp->locals[instr].type=PIKE_T_INT; fp->locals[instr].subtype=0; fp->locals[instr].u.integer=0; break; @@ -437,10 +437,10 @@ static int eval_instruction(unsigned char *pc) CASE(F_INC_LOCAL); instr=GET_ARG(); #ifdef AUTO_BIGNUM - if(fp->locals[instr].type == T_INT && + if(fp->locals[instr].type == PIKE_T_INT && !INT_TYPE_ADD_OVERFLOW(fp->locals[instr].u.integer, 1)) #else - if(fp->locals[instr].type == T_INT) + if(fp->locals[instr].type == PIKE_T_INT) #endif /* AUTO_BIGNUM */ { fp->locals[instr].u.integer++; @@ -464,10 +464,10 @@ static int eval_instruction(unsigned char *pc) instr=GET_ARG(); inc_local_and_pop: #ifdef AUTO_BIGNUM - if(fp->locals[instr].type == T_INT && + if(fp->locals[instr].type == PIKE_T_INT && !INT_TYPE_ADD_OVERFLOW(fp->locals[instr].u.integer, 1)) #else - if(fp->locals[instr].type == T_INT) + if(fp->locals[instr].type == PIKE_T_INT) #endif /* AUTO_BIGNUM */ { fp->locals[instr].u.integer++; @@ -483,10 +483,10 @@ static int eval_instruction(unsigned char *pc) CASE(F_DEC_LOCAL); instr=GET_ARG(); #ifdef AUTO_BIGNUM - if(fp->locals[instr].type == T_INT && + if(fp->locals[instr].type == PIKE_T_INT && !INT_TYPE_SUB_OVERFLOW(fp->locals[instr].u.integer, 1)) #else - if(fp->locals[instr].type == T_INT) + if(fp->locals[instr].type == PIKE_T_INT) #endif /* AUTO_BIGNUM */ { fp->locals[instr].u.integer--; @@ -510,10 +510,10 @@ static int eval_instruction(unsigned char *pc) instr=GET_ARG(); dec_local_and_pop: #ifdef AUTO_BIGNUM - if(fp->locals[instr].type == T_INT && + if(fp->locals[instr].type == PIKE_T_INT && !INT_TYPE_SUB_OVERFLOW(fp->locals[instr].u.integer, 1)) #else - if(fp->locals[instr].type == T_INT) + if(fp->locals[instr].type == PIKE_T_INT) #endif /* AUTO_BIGNUM */ { fp->locals[instr].u.integer--; @@ -533,7 +533,7 @@ static int eval_instruction(unsigned char *pc) CASE(F_LTOSVAL2); sp[0]=sp[-1]; - sp[-1].type=T_INT; + sp[-1].type=PIKE_T_INT; sp++; lvalue_to_svalue_no_free(sp-2,sp-4); @@ -546,7 +546,7 @@ static int eval_instruction(unsigned char *pc) if( (1 << sp[-2].type) & ( BIT_ARRAY | BIT_MULTISET | BIT_MAPPING | BIT_STRING )) { struct svalue s; - s.type=T_INT; + s.type=PIKE_T_INT; s.subtype=0; s.u.integer=0; assign_lvalue(sp-4,&s); @@ -556,7 +556,7 @@ static int eval_instruction(unsigned char *pc) CASE(F_ADD_TO_AND_POP); sp[0]=sp[-1]; - sp[-1].type=T_INT; + sp[-1].type=PIKE_T_INT; sp++; lvalue_to_svalue_no_free(sp-2,sp-4); @@ -569,7 +569,7 @@ static int eval_instruction(unsigned char *pc) if( (1 << sp[-2].type) & ( BIT_ARRAY | BIT_MULTISET | BIT_MAPPING | BIT_STRING )) { struct svalue s; - s.type=T_INT; + s.type=PIKE_T_INT; s.subtype=0; s.u.integer=0; assign_lvalue(sp-4,&s); @@ -608,7 +608,7 @@ static int eval_instruction(unsigned char *pc) CASE(F_INC); { - union anything *u=get_pointer_if_this_type(sp-2, T_INT); + union anything *u=get_pointer_if_this_type(sp-2, PIKE_T_INT); if(u #ifdef AUTO_BIGNUM && !INT_TYPE_ADD_OVERFLOW(u->integer, 1) @@ -631,7 +631,7 @@ static int eval_instruction(unsigned char *pc) CASE(F_DEC); { - union anything *u=get_pointer_if_this_type(sp-2, T_INT); + union anything *u=get_pointer_if_this_type(sp-2, PIKE_T_INT); if(u #ifdef AUTO_BIGNUM && !INT_TYPE_SUB_OVERFLOW(u->integer, 1) @@ -654,7 +654,7 @@ static int eval_instruction(unsigned char *pc) CASE(F_DEC_AND_POP); { - union anything *u=get_pointer_if_this_type(sp-2, T_INT); + union anything *u=get_pointer_if_this_type(sp-2, PIKE_T_INT); if(u #ifdef AUTO_BIGNUM && !INT_TYPE_SUB_OVERFLOW(u->integer, 1) @@ -675,7 +675,7 @@ static int eval_instruction(unsigned char *pc) CASE(F_INC_AND_POP); { - union anything *u=get_pointer_if_this_type(sp-2, T_INT); + union anything *u=get_pointer_if_this_type(sp-2, PIKE_T_INT); if(u #ifdef AUTO_BIGNUM && !INT_TYPE_ADD_OVERFLOW(u->integer, 1) @@ -696,7 +696,7 @@ static int eval_instruction(unsigned char *pc) CASE(F_POST_INC); { - union anything *u=get_pointer_if_this_type(sp-2, T_INT); + union anything *u=get_pointer_if_this_type(sp-2, PIKE_T_INT); if(u #ifdef AUTO_BIGNUM && !INT_TYPE_ADD_OVERFLOW(u->integer, 1) @@ -720,7 +720,7 @@ static int eval_instruction(unsigned char *pc) CASE(F_POST_DEC); { - union anything *u=get_pointer_if_this_type(sp-2, T_INT); + union anything *u=get_pointer_if_this_type(sp-2, PIKE_T_INT); if(u #ifdef AUTO_BIGNUM && !INT_TYPE_SUB_OVERFLOW(u->integer, 1) @@ -830,7 +830,7 @@ static int eval_instruction(unsigned char *pc) CASE(F_POP_MARK); --mark_sp; break; CASE(F_CLEAR_STRING_SUBTYPE); - if(sp[-1].type==T_STRING) sp[-1].subtype=0; + if(sp[-1].type==PIKE_T_STRING) sp[-1].subtype=0; break; /* Jumps */ @@ -841,10 +841,10 @@ static int eval_instruction(unsigned char *pc) CASE(F_BRANCH_IF_NOT_LOCAL_ARROW); { struct svalue tmp; - tmp.type=T_STRING; + tmp.type=PIKE_T_STRING; tmp.u.string=fp->context.prog->strings[GET_ARG()]; tmp.subtype=1; - sp->type=T_INT; + sp->type=PIKE_T_INT; sp++; index_no_free(sp-1,fp->locals+GET_ARG2() , &tmp); print_return_value(); @@ -996,7 +996,7 @@ static int eval_instruction(unsigned char *pc) CASE(F_FOREACH) /* array, lvalue, X, i */ { - if(sp[-4].type != T_ARRAY) + if(sp[-4].type != PIKE_T_ARRAY) PIKE_ERROR("foreach", "Bad argument 1.\n", sp-3, 1); if(sp[-1].u.integer < sp[-4].u.array->size) { @@ -1023,7 +1023,7 @@ static int eval_instruction(unsigned char *pc) /* fprintf(stderr,"NOT EXPENDIBLE!\n"); */ MEMMOVE(sp-args+1,sp-args,args*sizeof(struct svalue)); sp++; - sp[-args-1].type=T_INT; + sp[-args-1].type=PIKE_T_INT; } /* We sabotage the stack here */ assign_svalue(sp-args-1,&fp->context.prog->constants[GET_ARG()].sval); @@ -1037,7 +1037,7 @@ static int eval_instruction(unsigned char *pc) { MEMMOVE(sp-args+1,sp-args,args*sizeof(struct svalue)); sp++; - sp[-args-1].type=T_INT; + sp[-args-1].type=PIKE_T_INT; }else{ free_svalue(sp-args-1); } @@ -1048,7 +1048,7 @@ static int eval_instruction(unsigned char *pc) if(t_flag > 9) fprintf(stderr,"- IDENTIFIER_LEVEL: %d\n",fp->context.identifier_level); #endif - sp[-args-1].type=T_FUNCTION; + sp[-args-1].type=PIKE_T_FUNCTION; add_ref(fp->current_object); return args+1; @@ -1087,7 +1087,7 @@ static int eval_instruction(unsigned char *pc) return -1; CASE(F_NEGATE); - if(sp[-1].type == T_INT) + if(sp[-1].type == PIKE_T_INT) { #ifdef AUTO_BIGNUM if(INT_TYPE_NEG_OVERFLOW(sp[-1].u.integer)) @@ -1099,7 +1099,7 @@ static int eval_instruction(unsigned char *pc) #endif /* AUTO_BIGNUM */ sp[-1].u.integer =- sp[-1].u.integer; } - else if(sp[-1].type == T_FLOAT) + else if(sp[-1].type == PIKE_T_FLOAT) { sp[-1].u.float_number =- sp[-1].u.float_number; }else{ @@ -1112,12 +1112,12 @@ static int eval_instruction(unsigned char *pc) CASE(F_NOT); switch(sp[-1].type) { - case T_INT: + case PIKE_T_INT: sp[-1].u.integer =! sp[-1].u.integer; break; - case T_FUNCTION: - case T_OBJECT: + case PIKE_T_FUNCTION: + case PIKE_T_OBJECT: if(IS_ZERO(sp-1)) { pop_stack(); @@ -1130,7 +1130,7 @@ static int eval_instruction(unsigned char *pc) default: free_svalue(sp-1); - sp[-1].type=T_INT; + sp[-1].type=PIKE_T_INT; sp[-1].u.integer=0; } break; @@ -1163,19 +1163,19 @@ static int eval_instruction(unsigned char *pc) default: PIKE_ERROR("@", "Bad argument.\n", sp, 1); - case T_OBJECT: + case PIKE_T_OBJECT: if(!sp[-1].u.object->prog || FIND_LFUN(sp[-1].u.object->prog,LFUN__VALUES) == -1) PIKE_ERROR("@", "Bad argument.\n", sp, 1); apply_lfun(sp[-1].u.object, LFUN__VALUES, 0); - if(sp[-1].type != T_ARRAY) + if(sp[-1].type != PIKE_T_ARRAY) error("Bad return type from o->_values() in @\n"); free_svalue(sp-2); sp[-2]=sp[-1]; sp--; break; - case T_ARRAY: break; + case PIKE_T_ARRAY: break; } sp--; push_array_items(sp->u.array); @@ -1184,8 +1184,8 @@ static int eval_instruction(unsigned char *pc) CASE(F_LOCAL_LOCAL_INDEX); { struct svalue *s=fp->locals+GET_ARG(); - if(s->type == T_STRING) s->subtype=0; - sp++->type=T_INT; + if(s->type == PIKE_T_STRING) s->subtype=0; + sp++->type=PIKE_T_INT; index_no_free(sp-1,fp->locals+GET_ARG2(),s); break; } @@ -1193,7 +1193,7 @@ static int eval_instruction(unsigned char *pc) CASE(F_LOCAL_INDEX); { struct svalue tmp,*s=fp->locals+GET_ARG(); - if(s->type == T_STRING) s->subtype=0; + if(s->type == PIKE_T_STRING) s->subtype=0; index_no_free(&tmp,sp-1,s); free_svalue(sp-1); sp[-1]=tmp; @@ -1208,7 +1208,7 @@ static int eval_instruction(unsigned char *pc) GET_ARG() + fp->context.identifier_level); sp++; s=fp->locals+GET_ARG2(); - if(s->type == T_STRING) s->subtype=0; + if(s->type == PIKE_T_STRING) s->subtype=0; index_no_free(&tmp,sp-1,s); free_svalue(sp-1); sp[-1]=tmp; @@ -1218,10 +1218,10 @@ static int eval_instruction(unsigned char *pc) CASE(F_LOCAL_ARROW); { struct svalue tmp; - tmp.type=T_STRING; + tmp.type=PIKE_T_STRING; tmp.u.string=fp->context.prog->strings[GET_ARG()]; tmp.subtype=1; - sp->type=T_INT; + sp->type=PIKE_T_INT; sp++; index_no_free(sp-1,fp->locals+GET_ARG2() , &tmp); print_return_value(); @@ -1231,7 +1231,7 @@ static int eval_instruction(unsigned char *pc) CASE(F_ARROW); { struct svalue tmp,tmp2; - tmp.type=T_STRING; + tmp.type=PIKE_T_STRING; tmp.u.string=fp->context.prog->strings[GET_ARG()]; tmp.subtype=1; index_no_free(&tmp2, sp-1, &tmp); @@ -1244,7 +1244,7 @@ static int eval_instruction(unsigned char *pc) CASE(F_STRING_INDEX); { struct svalue tmp,tmp2; - tmp.type=T_STRING; + tmp.type=PIKE_T_STRING; tmp.u.string=fp->context.prog->strings[GET_ARG()]; tmp.subtype=0; index_no_free(&tmp2, sp-1, &tmp); @@ -1299,7 +1299,7 @@ static int eval_instruction(unsigned char *pc) { struct svalue s; lvalue_to_svalue_no_free(&s,sp-2); - if(s.type != T_STRING) + if(s.type != PIKE_T_STRING) { pop_n_elems(2); *sp=s; @@ -1372,14 +1372,14 @@ static int eval_instruction(unsigned char *pc) PIKE_ERROR("`()", "Too few arguments.\n", sp, 0); switch(sp[-args].type) { - case T_INT: + case PIKE_T_INT: if (!sp[-args].u.integer) { PIKE_ERROR("`()", "Attempt to call the NULL-value\n", sp, args); } - case T_STRING: - case T_FLOAT: - case T_MAPPING: - case T_MULTISET: + case PIKE_T_STRING: + case PIKE_T_FLOAT: + case PIKE_T_MAPPING: + case PIKE_T_MULTISET: PIKE_ERROR("`()", "Attempt to call a non-function value.\n", sp, args); } return args; diff --git a/src/lexer.h b/src/lexer.h index 8dababc2c5d6ccfc664484871083382281afb062..ea4e21beb35b65bec0d4b251690bf5618aa486cb 100644 --- a/src/lexer.h +++ b/src/lexer.h @@ -1,5 +1,5 @@ /* - * $Id: lexer.h,v 1.10 1999/11/11 18:27:12 grubba Exp $ + * $Id: lexer.h,v 1.11 1999/11/18 04:14:48 hubbe Exp $ * * Lexical analyzer template. * Based on lex.c 1.62 @@ -426,7 +426,7 @@ static int low_yylex(YYSTYPE *yylval) struct svalue sval; base = 16; read_based_number: - sval.type = T_INT; + sval.type = PIKE_T_INT; sval.subtype = NUMBER_NUMBER; sval.u.integer = 0; wide_string_to_svalue_inumber(&sval, @@ -459,7 +459,7 @@ static int low_yylex(YYSTYPE *yylval) f=lex_strtod(lex.pos, &p1); - sval.type = T_INT; + sval.type = PIKE_T_INT; sval.subtype = NUMBER_NUMBER; sval.u.integer = 0; diff --git a/src/preprocessor.h b/src/preprocessor.h index 1ae62d1c33b0e0f283fb58d30bea20f0aa799e3f..231ea7a48caffda4e5e95dc903518f4f06132732 100644 --- a/src/preprocessor.h +++ b/src/preprocessor.h @@ -1,5 +1,5 @@ /* - * $Id: preprocessor.h,v 1.14 1999/11/16 03:30:53 mast Exp $ + * $Id: preprocessor.h,v 1.15 1999/11/18 04:14:49 hubbe Exp $ * * Preprocessor template. * Based on cpp.c 1.45 @@ -733,10 +733,10 @@ static int calc(struct cpp *this, WCHAR *data, INT32 len, INT32 tmp) if (SETJMP(recovery)) { pos=tmp; - if(throw_value.type == T_ARRAY && throw_value.u.array->size) + if(throw_value.type == PIKE_T_ARRAY && throw_value.u.array->size) { union anything *a; - a=low_array_get_item_ptr(throw_value.u.array, 0, T_STRING); + a=low_array_get_item_ptr(throw_value.u.array, 0, PIKE_T_STRING); if(a) { cpp_error(this, a->string->str); @@ -1256,7 +1256,7 @@ static INT32 lower_cpp(struct cpp *this, SAFE_APPLY_MASTER("handle_include",3); - if(sp[-1].type != T_STRING) + if(sp[-1].type != PIKE_T_STRING) { cpp_error(this, "Couldn't include file."); pop_n_elems(sp-save_sp); @@ -1271,7 +1271,7 @@ static INT32 lower_cpp(struct cpp *this, SAFE_APPLY_MASTER("read_include",1); - if(sp[-1].type != T_STRING) + if(sp[-1].type != PIKE_T_STRING) { cpp_error(this, "Couldn't read include file."); pop_n_elems(sp-save_sp); @@ -1307,7 +1307,7 @@ static INT32 lower_cpp(struct cpp *this, } else if (charset) { ref_push_string(charset); SAFE_APPLY_MASTER("decode_charset", 2); - if (sp[-1].type != T_STRING) { + if (sp[-1].type != PIKE_T_STRING) { cpp_error(this, "Charset decoding failed for included file."); pop_n_elems(sp - save_sp); @@ -1687,7 +1687,7 @@ static INT32 lower_cpp(struct cpp *this, if(!str.s->len && sp-partbase>1) { #ifdef PIKE_DEBUG - if(sp[-1].type != T_INT) + if(sp[-1].type != PIKE_T_INT) fatal("Internal error in CPP\n"); #endif sp[-1].u.integer|=DEF_ARG_NOPOSTSPACE; @@ -1788,10 +1788,10 @@ static INT32 lower_cpp(struct cpp *this, for(e=0;e<def->num_parts;e++) { #if 1 - if(partbase[e*2+1].type != T_INT) + if(partbase[e*2+1].type != PIKE_T_INT) fatal("Cpp internal error, expected integer!\n"); - if(partbase[e*2+2].type != T_STRING) + if(partbase[e*2+2].type != PIKE_T_STRING) fatal("Cpp internal error, expected string!\n"); #endif def->parts[e].argument=partbase[e*2+1].u.integer; @@ -1890,7 +1890,7 @@ static INT32 lower_cpp(struct cpp *this, SAFE_APPLY_MASTER("decode_charset", 2); - if (sp[-1].type != T_STRING) { + if (sp[-1].type != PIKE_T_STRING) { pop_stack(); cpp_error(this, "Unknown charset."); } diff --git a/src/program.c b/src/program.c index 70b858d2349c1395e97a0df2c59d76577bd8d6db..3b07b219ddb0184d4a441ae3c647fbcb757ff00a 100644 --- a/src/program.c +++ b/src/program.c @@ -5,7 +5,7 @@ \*/ /**/ #include "global.h" -RCSID("$Id: program.c,v 1.173 1999/11/18 02:46:04 mast Exp $"); +RCSID("$Id: program.c,v 1.174 1999/11/18 04:14:50 hubbe Exp $"); #include "program.h" #include "object.h" #include "dynamic_buffer.h" @@ -2875,7 +2875,7 @@ struct program *compile(struct pike_string *prog, struct object *handler) return p; } -int add_function(char *name,void (*cfun)(INT32),char *type,INT16 flags) +int pike_add_function(char *name,void (*cfun)(INT32),char *type,INT16 flags) { int ret; struct pike_string *name_tmp,*type_tmp; diff --git a/src/program.h b/src/program.h index acd0e31d9b1b25cb627c39721c73aae4832e9c81..ca513a44c7addbbfac41f38fa4644009d1ce5c38 100644 --- a/src/program.h +++ b/src/program.h @@ -5,7 +5,7 @@ \*/ /* - * $Id: program.h,v 1.65 1999/11/04 02:35:27 grubba Exp $ + * $Id: program.h,v 1.66 1999/11/18 04:14:52 hubbe Exp $ */ #ifndef PROGRAM_H #define PROGRAM_H @@ -423,7 +423,7 @@ void store_linenumber(INT32 current_line, struct pike_string *current_file); char *get_line(unsigned char *pc,struct program *prog,INT32 *linep); void my_yyerror(char *fmt,...) ATTRIBUTE((format(printf,1,2))); struct program *compile(struct pike_string *prog, struct object *handler); -int add_function(char *name,void (*cfun)(INT32),char *type,INT16 flags); +int pike_add_function(char *name,void (*cfun)(INT32),char *type,INT16 flags); int quick_add_function(char *name, int name_length, void (*cfun)(INT32), @@ -461,8 +461,12 @@ int implements(struct program *a, struct program *b); #define ADD_INT_CONSTANT(NAME,CONST,FLAGS) \ quick_add_integer_constant(NAME,CONSTANT_STRLEN(NAME),CONST,FLAGS) +#ifndef NO_PIKE_SHORTHAND +#define add_function pike_add_function #endif +#endif /* PROGRAM_H */ + #ifdef DEBUG_MALLOC #define end_program() ((struct program *)debug_malloc_pass(debug_end_program())) #define end_class(NAME, FLAGS) do { debug_malloc_touch(new_program); debug_end_class(NAME, CONSTANT_STRLEN(NAME), FLAGS); }while(0) diff --git a/src/security.h b/src/security.h index a6edb12959e39d2f81b0af60b9c19ff080d929cc..35e999a706c9466dcced26717f379651ee817ee1 100644 --- a/src/security.h +++ b/src/security.h @@ -77,14 +77,14 @@ struct pike_creds \ switch(sp[-1].type) \ { \ - case T_ARRAY: \ - case T_OBJECT: \ - case T_MAPPING: \ + case PIKE_T_ARRAY: \ + case PIKE_T_OBJECT: \ + case PIKE_T_MAPPING: \ assign_svalue(sp-args-1,sp-1); \ pop_n_elems(args); \ return; \ \ - case T_INT: \ + case PIKE_T_INT: \ switch(sp[-1].u.integer) \ { \ case 0: /* return 0 */ \ @@ -113,7 +113,7 @@ struct pike_creds default: \ error("Error in user->valid_io, wrong return type.\n"); \ \ - case T_STRING: \ + case PIKE_T_STRING: \ assign_svalue(sp-args-1,sp-1); \ pop_stack(); \ } \ diff --git a/src/svalue.h b/src/svalue.h index 0748df11e5135785c759029eb35b3ea1a7c94048..7abc939d93bf823aa490c08d00da3bf252390633 100644 --- a/src/svalue.h +++ b/src/svalue.h @@ -5,7 +5,7 @@ \*/ /* - * $Id: svalue.h,v 1.37 1999/11/16 00:51:56 mast Exp $ + * $Id: svalue.h,v 1.38 1999/11/18 04:14:54 hubbe Exp $ */ #ifndef SVALUE_H #define SVALUE_H @@ -79,15 +79,15 @@ struct svalue union anything u; }; -#define T_ARRAY 0 -#define T_MAPPING 1 -#define T_MULTISET 2 -#define T_OBJECT 3 -#define T_FUNCTION 4 -#define T_PROGRAM 5 -#define T_STRING 6 -#define T_FLOAT 7 -#define T_INT 8 +#define PIKE_T_ARRAY 0 +#define PIKE_T_MAPPING 1 +#define PIKE_T_MULTISET 2 +#define PIKE_T_OBJECT 3 +#define PIKE_T_FUNCTION 4 +#define PIKE_T_PROGRAM 5 +#define PIKE_T_STRING 6 +#define PIKE_T_FLOAT 7 +#define PIKE_T_INT 8 #define T_VOID 16 #define T_MANY 17 @@ -154,15 +154,15 @@ struct svalue #define tRef tOr(tString,tComplex) #define tIfnot(X,Y) tAnd(tNot(X),Y) -#define BIT_ARRAY (1<<T_ARRAY) -#define BIT_MAPPING (1<<T_MAPPING) -#define BIT_MULTISET (1<<T_MULTISET) -#define BIT_OBJECT (1<<T_OBJECT) -#define BIT_FUNCTION (1<<T_FUNCTION) -#define BIT_PROGRAM (1<<T_PROGRAM) -#define BIT_STRING (1<<T_STRING) -#define BIT_INT (1<<T_INT) -#define BIT_FLOAT (1<<T_FLOAT) +#define BIT_ARRAY (1<<PIKE_T_ARRAY) +#define BIT_MAPPING (1<<PIKE_T_MAPPING) +#define BIT_MULTISET (1<<PIKE_T_MULTISET) +#define BIT_OBJECT (1<<PIKE_T_OBJECT) +#define BIT_FUNCTION (1<<PIKE_T_FUNCTION) +#define BIT_PROGRAM (1<<PIKE_T_PROGRAM) +#define BIT_STRING (1<<PIKE_T_STRING) +#define BIT_INT (1<<PIKE_T_INT) +#define BIT_FLOAT (1<<PIKE_T_FLOAT) /* Used to signify that this array might not be finished yet */ /* garbage collect uses this */ @@ -185,11 +185,11 @@ struct svalue #define BIT_CALLABLE (BIT_FUNCTION|BIT_PROGRAM|BIT_ARRAY|BIT_OBJECT) /* Max type which contains svalues */ -#define MAX_COMPLEX T_PROGRAM +#define MAX_COMPLEX PIKE_T_PROGRAM /* Max type with ref count */ -#define MAX_REF_TYPE T_STRING +#define MAX_REF_TYPE PIKE_T_STRING /* Max type handled by svalue primitives */ -#define MAX_TYPE T_INT +#define MAX_TYPE PIKE_T_INT #define NUMBER_NUMBER 0 #define NUMBER_UNDEFINED 1 @@ -198,16 +198,16 @@ struct svalue #define FUNCTION_BUILTIN USHRT_MAX #define is_gt(a,b) is_lt(b,a) -#define IS_ZERO(X) ((X)->type==T_INT?(X)->u.integer==0:(1<<(X)->type)&(BIT_OBJECT|BIT_FUNCTION)?!svalue_is_true(X):0) +#define IS_ZERO(X) ((X)->type==PIKE_T_INT?(X)->u.integer==0:(1<<(X)->type)&(BIT_OBJECT|BIT_FUNCTION)?!svalue_is_true(X):0) -#define IS_UNDEFINED(X) ((X)->type==T_INT&&!(X)->u.integer&&(X)->subtype==1) +#define IS_UNDEFINED(X) ((X)->type==PIKE_T_INT&&!(X)->u.integer&&(X)->subtype==1) #define check_destructed(S) \ do{ \ struct svalue *_s=(S); \ - if((_s->type == T_OBJECT || _s->type==T_FUNCTION) && !_s->u.object->prog) { \ + if((_s->type == PIKE_T_OBJECT || _s->type==PIKE_T_FUNCTION) && !_s->u.object->prog) { \ free_object(_s->u.object); \ - _s->type = T_INT; \ + _s->type = PIKE_T_INT; \ _s->subtype = NUMBER_DESTRUCTED ; \ _s->u.integer = 0; \ } \ @@ -215,7 +215,7 @@ do{ \ /* var MUST be a variable!!! */ #define safe_check_destructed(var) do{ \ - if((var->type == T_OBJECT || var->type==T_FUNCTION) && !var->u.object->prog) \ + if((var->type == PIKE_T_OBJECT || var->type==PIKE_T_FUNCTION) && !var->u.object->prog) \ var=&dest_ob_zero; \ }while(0) @@ -324,4 +324,19 @@ void gc_mark_short_svalue(union anything *u, TYPE_T type); INT32 pike_sizeof(struct svalue *s); /* Prototypes end here */ +#ifndef NO_PIKE_SHORTHAND + +#define T_ARRAY PIKE_T_ARRAY +#define T_MAPPING PIKE_T_MAPPING +#define T_MULTISET PIKE_T_MULTISET +#define T_OBJECT PIKE_T_OBJECT +#define T_FUNCTION PIKE_T_FUNCTION +#define T_PROGRAM PIKE_T_PROGRAM +#define T_STRING PIKE_T_STRING +#define T_FLOAT PIKE_T_FLOAT +#define T_INT PIKE_T_INT + +#endif + + #endif diff --git a/src/threads.h b/src/threads.h index 0115b47a57ed1bc1de4b93de904fd4037d3ea128..f7a6aebb9400ddd8278418d27f6e4cdc7d1a0399 100644 --- a/src/threads.h +++ b/src/threads.h @@ -1,5 +1,5 @@ /* - * $Id: threads.h,v 1.70 1999/09/06 11:13:23 hubbe Exp $ + * $Id: threads.h,v 1.71 1999/11/18 04:14:55 hubbe Exp $ */ #ifndef THREADS_H #define THREADS_H @@ -53,7 +53,7 @@ struct object; extern size_t thread_stack_size; extern struct object *thread_id; -#define DEFINE_MUTEX(X) MUTEX_T X +#define DEFINE_MUTEX(X) PIKE_MUTEX_T X #ifdef POSIX_THREADS @@ -71,7 +71,7 @@ void th_atfork_child(void); #endif #define THREAD_T pthread_t -#define MUTEX_T pthread_mutex_t +#define PIKE_MUTEX_T pthread_mutex_t #define mt_init(X) pthread_mutex_init((X),0) #define mt_lock(X) pthread_mutex_lock(X) #define mt_trylock(X) pthread_mutex_trylock(X) @@ -129,7 +129,7 @@ extern pthread_attr_t small_pattr; #ifdef UNIX_THREADS #define THREAD_T thread_t #define PTHREAD_MUTEX_INITIALIZER DEFAULTMUTEX -#define MUTEX_T mutex_t +#define PIKE_MUTEX_T mutex_t #define mt_init(X) mutex_init((X),USYNC_THREAD,0) #define mt_lock(X) mutex_lock(X) #define mt_trylock(X) mutex_trylock(X) @@ -163,7 +163,7 @@ extern pthread_attr_t small_pattr; */ #define THREAD_T int -#define MUTEX_T ulock_t +#define PIKE_MUTEX_T ulock_t #define mt_init(X) (usinitlock(((*X) = usnewlock(/*********/)))) #define mt_lock(X) ussetlock(*X) #define mt_unlock(X) usunsetlock(*X) @@ -206,7 +206,7 @@ extern pthread_attr_t small_pattr; #define th_equal(X,Y) ((X)==(Y)) #define th_hash(X) (X) -#define MUTEX_T HANDLE +#define PIKE_MUTEX_T HANDLE #define mt_init(X) CheckValidHandle((*(X)=CreateMutex(NULL, 0, NULL))) #define mt_lock(X) WaitForSingleObject(CheckValidHandle(*(X)), INFINITE) #define mt_trylock(X) WaitForSingleObject(CheckValidHandle(*(X)), 0) @@ -222,7 +222,7 @@ extern pthread_attr_t small_pattr; #endif -#if !defined(COND_T) && defined(EVENT_T) && defined(MUTEX_T) +#if !defined(COND_T) && defined(EVENT_T) && defined(PIKE_MUTEX_T) #define SIMULATE_COND_WITH_EVENT @@ -234,7 +234,7 @@ struct cond_t_queue typedef struct cond_t_s { - MUTEX_T lock; + PIKE_MUTEX_T lock; struct cond_t_queue *head, *tail; } COND_T; @@ -242,7 +242,7 @@ typedef struct cond_t_s #define co_init(X) do { mt_init(& (X)->lock), (X)->head=(X)->tail=0; }while(0) -int co_wait(COND_T *c, MUTEX_T *m); +int co_wait(COND_T *c, PIKE_MUTEX_T *m); int co_signal(COND_T *c); int co_broadcast(COND_T *c); int co_destroy(COND_T *c); @@ -250,7 +250,7 @@ int co_destroy(COND_T *c); #endif -extern MUTEX_T interpreter_lock; +extern PIKE_MUTEX_T interpreter_lock; extern COND_T live_threads_change; /* Used by _disable_threads */ extern COND_T threads_disabled_change; /* Used by _disable_threads */ @@ -258,13 +258,13 @@ extern COND_T threads_disabled_change; /* Used by _disable_threads */ struct svalue; struct pike_frame; -extern MUTEX_T interleave_lock; +extern PIKE_MUTEX_T interleave_lock; struct interleave_mutex { struct interleave_mutex *next; struct interleave_mutex *prev; - MUTEX_T lock; + PIKE_MUTEX_T lock; }; #define IMUTEX_T struct interleave_mutex @@ -635,4 +635,8 @@ HANDLE CheckValidHandle(HANDLE h); extern int threads_disabled; extern int thread_storage_offset; +#ifndef NO_PIKE_SHORTHAND +#define MUTEX_T PIKE_MUTEX_T +#endif + #endif /* THREADS_H */