diff --git a/src/builtin.cmod b/src/builtin.cmod index 680f7407b8be918f9ed1dbc541a62308f84529fb..fa753b545bea8b179249c8986c3acbc5fad1516e 100644 --- a/src/builtin.cmod +++ b/src/builtin.cmod @@ -711,7 +711,7 @@ PIKEFUN string basetype(mixed x) return; } else if (UNSAFE_IS_ZERO(Pike_sp-1)) { pop_n_elems(2); - push_constant_text("object"); + ref_push_string(literal_object_string); return; } else { Pike_error("Non-string returned from _sprintf()\n"); @@ -721,16 +721,16 @@ PIKEFUN string basetype(mixed x) pop_stack(); switch(t) { - case T_ARRAY: push_constant_text("array"); break; - case T_FLOAT: push_constant_text("float"); break; - case T_FUNCTION: push_constant_text("function"); break; - case T_INT: push_constant_text("int"); break; - case T_MAPPING: push_constant_text("mapping"); break; - case T_MULTISET: push_constant_text("multiset"); break; - case T_OBJECT: push_constant_text("object"); break; - case T_PROGRAM: push_constant_text("program"); break; - case T_STRING: push_constant_text("string"); break; - case T_TYPE: push_constant_text("type"); break; + case T_ARRAY: ref_push_string(literal_array_string); break; + case T_FLOAT: ref_push_string(literal_float_string); break; + case T_FUNCTION: ref_push_string(literal_function_string); break; + case T_INT: ref_push_string(literal_int_string); break; + case T_MAPPING: ref_push_string(literal_mapping_string); break; + case T_MULTISET: ref_push_string(literal_multiset_string); break; + case T_OBJECT: ref_push_string(literal_object_string); break; + case T_PROGRAM: ref_push_string(literal_program_string); break; + case T_STRING: ref_push_string(literal_string_string); break; + case T_TYPE: ref_push_string(literal_type_string); break; case T_ZERO: push_constant_text("zero"); break; case T_VOID: push_constant_text("void"); break; /* The following are internal and shouldn't be applicable in normal use. */ diff --git a/src/builtin_functions.c b/src/builtin_functions.c index 9953bf6ff91834785c076eb8d0cda17dfe8c0aa9..6caed4640cd0b96ee04a27d11e5f64cd971e738c 100644 --- a/src/builtin_functions.c +++ b/src/builtin_functions.c @@ -5020,7 +5020,7 @@ void f_gc(INT32 args) { \ int id_level = \ p->inherits[SUBTYPEOF(Pike_sp[-args])].identifier_level; \ - push_constant_text(TYPE_NAME); \ + ref_push_string(literal_##TYPE_NAME##_string); \ apply_low(Pike_sp[-args-1].u.object, fun + id_level, 1); \ stack_unlink(args); \ return; \ @@ -5150,12 +5150,12 @@ PMOD_EXPORT void f_programp(INT32 args) */ -TYPEP(f_intp, "intp", T_INT, "int") -TYPEP(f_mappingp, "mappingp", T_MAPPING, "mapping") -TYPEP(f_arrayp, "arrayp", T_ARRAY, "array") -TYPEP(f_multisetp, "multisetp", T_MULTISET, "multiset") -TYPEP(f_stringp, "stringp", T_STRING, "string") -TYPEP(f_floatp, "floatp", T_FLOAT, "float") +TYPEP(f_intp, "intp", T_INT, int) +TYPEP(f_mappingp, "mappingp", T_MAPPING, mapping) +TYPEP(f_arrayp, "arrayp", T_ARRAY, array) +TYPEP(f_multisetp, "multisetp", T_MULTISET, multiset) +TYPEP(f_stringp, "stringp", T_STRING, string) +TYPEP(f_floatp, "floatp", T_FLOAT, float) /*! @decl array sort(array(mixed) index, array(mixed) ... data) *! @@ -8781,7 +8781,7 @@ PMOD_EXPORT void f_map(INT32 args) { pop_stack(); - push_constant_text("array"); + ref_push_string(literal_array_string); /* FIXME: Object subtype! */ safe_apply(mysp[-3].u.object,"cast",1); if (TYPEOF(Pike_sp[-1]) == T_ARRAY) @@ -8794,7 +8794,7 @@ PMOD_EXPORT void f_map(INT32 args) } pop_stack(); - push_constant_text("mapping"); + ref_push_string(literal_mapping_string); /* FIXME: Object subtype! */ safe_apply(mysp[-3].u.object,"cast",1); if (TYPEOF(Pike_sp[-1]) == T_MAPPING) @@ -8807,7 +8807,7 @@ PMOD_EXPORT void f_map(INT32 args) } pop_stack(); - push_constant_text("multiset"); + ref_push_string(literal_multiset_string); /* FIXME: Object subtype! */ safe_apply(mysp[-3].u.object,"cast",1); if (TYPEOF(Pike_sp[-1]) == T_MULTISET) @@ -9212,7 +9212,7 @@ PMOD_EXPORT void f_filter(INT32 args) { pop_stack(); - push_constant_text("array"); + ref_push_string(literal_array_string); /* FIXME: Object subtype! */ safe_apply(mysp[-3].u.object,"cast",1); if (TYPEOF(Pike_sp[-1]) == T_ARRAY) @@ -9225,7 +9225,7 @@ PMOD_EXPORT void f_filter(INT32 args) } pop_stack(); - push_constant_text("mapping"); + ref_push_string(literal_mapping_string); /* FIXME: Object subtype! */ safe_apply(mysp[-3].u.object,"cast",1); if (TYPEOF(Pike_sp[-1]) == T_MAPPING) @@ -9238,7 +9238,7 @@ PMOD_EXPORT void f_filter(INT32 args) } pop_stack(); - push_constant_text("multiset"); + ref_push_string(literal_multiset_string); /* FIXME: Object subtype! */ safe_apply(mysp[-3].u.object,"cast",1); if (TYPEOF(Pike_sp[-1]) == T_MULTISET) diff --git a/src/modules/DVB/dvb.c b/src/modules/DVB/dvb.c index 03c4181cadd1c8cb512ffb7085d7a47bd8c8d983..2bd43be04e6d5d8ccb4cf388060bed3bb7bcf7d9 100644 --- a/src/modules/DVB/dvb.c +++ b/src/modules/DVB/dvb.c @@ -77,6 +77,7 @@ #include "module_support.h" #include "builtin_functions.h" #include "operators.h" +#include "pike_types.h" #include "dvb.h" @@ -401,7 +402,7 @@ static void f_fe_info(INT32 args) { push_int(info.maxSymbolRate); f_aggregate_mapping(2 * 2); push_text("hardware"); - push_text("type"); + ref_push_string(literal_type_string); push_int(info.hwType); #if HAVE_DVB < 30 push_text("version"); @@ -1061,20 +1062,20 @@ static void f_parse_pmt(INT32 args) switch(buffer[index]) { case 2: - push_text("type"); push_int(DMX_PES_VIDEO); cnt++; + ref_push_string(literal_type_string); push_int(DMX_PES_VIDEO); cnt++; push_text("desc"); push_text("video"); cnt++; break; case 3: case 4: - push_text("type"); push_int(DMX_PES_AUDIO); cnt++; + ref_push_string(literal_type_string); push_int(DMX_PES_AUDIO); cnt++; push_text("desc"); push_text("audio"); cnt++; break; case 6: - push_text("type"); push_int(DMX_PES_TELETEXT); cnt++; + ref_push_string(literal_type_string); push_int(DMX_PES_TELETEXT); cnt++; push_text("desc"); push_text("teletext"); cnt++; break; case 129: - push_text("type"); push_int(_DMX_PES_RDS); cnt++; + ref_push_string(literal_type_string); push_int(_DMX_PES_RDS); cnt++; push_text("desc"); push_text("_rds"); cnt++; break; default: diff --git a/src/modules/Fuse/fuse.c b/src/modules/Fuse/fuse.c index 9ac5ec31ebbc6894f1bd8f799356b5bfbf08cb23..d20c0f9db61c9deff890f1e8e989bb381d837441 100644 --- a/src/modules/Fuse/fuse.c +++ b/src/modules/Fuse/fuse.c @@ -428,7 +428,7 @@ static int pf_lock( const char *path, struct fuse_file_info *fi, int cmd, struct push_int( cmd ); push_text("owner"); push_int( fi->lock_owner ); - push_text("type"); push_int( lck->l_type ); + ref_push_string(literal_type_string); push_int( lck->l_type ); push_text("whence");push_int( lck->l_whence ); push_text("start"); push_int( lck->l_start ); push_text("len"); push_int( lck->l_len ); diff --git a/src/modules/Gmp/mpf.cmod b/src/modules/Gmp/mpf.cmod index 5e813020f6837bf39004efb961d5baef961fe343..ee30b5ebe991e56d9653061f62664beac2c80c73 100644 --- a/src/modules/Gmp/mpf.cmod +++ b/src/modules/Gmp/mpf.cmod @@ -342,9 +342,7 @@ PIKECLASS mpf PIKEFUN int(0..1) _is_type(string str) flags ID_PROTECTED; { - struct pike_string *float_t; - MAKE_CONST_STRING(float_t,"float"); - if( str == float_t ) + if( str == literal_float_string ) RETURN 1; RETURN 0; } diff --git a/src/modules/Gmp/mpq.cmod b/src/modules/Gmp/mpq.cmod index 835b30c76ab374a2476f98073546d6c682cbe662..d930e586ca2ed10913227c56f9bc77691eb9f62a 100644 --- a/src/modules/Gmp/mpq.cmod +++ b/src/modules/Gmp/mpq.cmod @@ -614,9 +614,7 @@ PIKECLASS mpq PIKEFUN int(0..1) _is_type(string str) flags ID_PROTECTED; { - struct pike_string *float_t; - MAKE_CONST_STRING(float_t,"float"); - if( str == float_t ) + if( str == literal_float_string ) RETURN 1; RETURN 0; } diff --git a/src/modules/Gmp/mpz_glue.c b/src/modules/Gmp/mpz_glue.c index 9f54f1c42b34e54e77f89d7e647769a098c5046c..e7cf680b73a37b152eda3b7d791e692c3e8ba7e8 100644 --- a/src/modules/Gmp/mpz_glue.c +++ b/src/modules/Gmp/mpz_glue.c @@ -1033,10 +1033,8 @@ static void mpzmod__sprintf(INT32 args) */ static void mpzmod__is_type(INT32 UNUSED(args)) { - struct pike_string *int_t; int is_int; - MAKE_CONST_STRING(int_t,"int"); - is_int = Pike_sp[-1].u.string == int_t ? 1 : 0; + is_int = Pike_sp[-1].u.string == literal_int_string ? 1 : 0; pop_stack(); push_int( is_int ); } diff --git a/src/modules/Image/colortable.c b/src/modules/Image/colortable.c index 8b26d649fa57f86c6fa08ac90951220951d046a0..a499336d5697f6659db00ca9603406db6a20e1d4 100644 --- a/src/modules/Image/colortable.c +++ b/src/modules/Image/colortable.c @@ -83,10 +83,6 @@ static INLINE int sq_int(int x) { return x*x; } #define THIS ((struct neo_colortable *)(Pike_fp->current_storage)) #define THISOBJ (Pike_fp->current_object) -static struct pike_string *s_array; -static struct pike_string *s_string; -static struct pike_string *s_mapping; - /***************** init & exit *********************************/ @@ -4473,10 +4469,6 @@ static void image_colortable__sprintf( INT32 args ) void init_image_colortable(void) { - s_array=make_shared_string("array"); - s_string=make_shared_string("string"); - s_mapping=make_shared_string("mapping"); - ADD_STORAGE(struct neo_colortable); set_init_callback(init_colortable_struct); @@ -4560,7 +4552,4 @@ void init_image_colortable(void) void exit_image_colortable(void) { - free_string(s_array); - free_string(s_mapping); - free_string(s_string); } diff --git a/src/modules/Image/encodings/_xpm.c b/src/modules/Image/encodings/_xpm.c index f78d2482cc85fe4e5140d19819372a99097c7d6a..300cdcd1b42ff152dddef4ca6e7506c56a104bb0 100644 --- a/src/modules/Image/encodings/_xpm.c +++ b/src/modules/Image/encodings/_xpm.c @@ -15,6 +15,7 @@ #include "operators.h" #include "threads.h" #include "module_support.h" +#include "pike_types.h" #include "image.h" #include "colortable.h" @@ -101,7 +102,7 @@ static rgba_group decode_color( struct buffer *s ) push_int(0); stack_swap(); } else { - push_constant_text( "array" ); + ref_push_string( literal_array_string ); apply( sp[-2].u.object, "cast", 1 ); } if(TYPEOF(sp[-1]) == T_ARRAY && sp[-1].u.array->size == 3) diff --git a/src/modules/Image/encodings/any.c b/src/modules/Image/encodings/any.c index b058075bf8f4560a2c31d569ebd86650963d8467..ce348214e9da78f0f583056ba796bc09670983d6 100644 --- a/src/modules/Image/encodings/any.c +++ b/src/modules/Image/encodings/any.c @@ -15,6 +15,7 @@ #include "svalue.h" #include "mapping.h" #include "pike_error.h" +#include "pike_types.h" #include "image.h" @@ -41,12 +42,12 @@ static void fix_png_mapping(void) { struct svalue *s; if(TYPEOF(sp[-1]) != T_MAPPING) return; - if((s = simple_mapping_string_lookup(sp[-1].u.mapping, "type"))) { + if((s = low_mapping_string_lookup(sp[-1].u.mapping, literal_type_string))) { push_text("_type"); mapping_insert(sp[-2].u.mapping, &sp[-1], s); pop_stack(); } - push_text("type"); + ref_push_string(literal_type_string); push_text("image/png"); mapping_insert(sp[-3].u.mapping, &sp[-2], &sp[-1]); pop_n_elems(2); @@ -207,7 +208,7 @@ simple_image: /* on stack: object image,string type */ f_aggregate(2); push_text("image"); - push_text("type"); + ref_push_string(literal_type_string); f_aggregate(2); stack_swap(); f_mkmapping(2); diff --git a/src/modules/Image/encodings/bmp.c b/src/modules/Image/encodings/bmp.c index 6c365f1de3dd24d7efc1d6858caaf048b445cdb3..2e781a6682882ef481d504548c4d220302093d47 100644 --- a/src/modules/Image/encodings/bmp.c +++ b/src/modules/Image/encodings/bmp.c @@ -31,6 +31,7 @@ #include "mapping.h" #include "pike_error.h" #include "operators.h" +#include "pike_types.h" #include "image.h" #include "colortable.h" @@ -684,7 +685,7 @@ void i_img_bmp__decode(INT32 args,int header_only) int_from_32bit(s+14)); } - push_text("type"); + ref_push_string(literal_type_string); push_text("image/x-MS-bmp"); n++; diff --git a/src/modules/Image/encodings/png.c b/src/modules/Image/encodings/png.c index e26257ff89c273e9f8642c269b7a45ce69b2b03b..7921c13a77bd9c885bc5b22e7480a796cd594626 100644 --- a/src/modules/Image/encodings/png.c +++ b/src/modules/Image/encodings/png.c @@ -17,6 +17,7 @@ #include "builtin_functions.h" #include "operators.h" #include "module_support.h" +#include "pike_types.h" #include "image.h" #include "colortable.h" @@ -52,7 +53,6 @@ static struct pike_string *param_palette; static struct pike_string *param_spalette; static struct pike_string *param_image; static struct pike_string *param_alpha; -static struct pike_string *param_type; static struct pike_string *param_bpp; static struct pike_string *param_background; static struct pike_string *param_zlevel; @@ -1501,7 +1501,7 @@ static void img_png_decode(INT32 args, int mode) if ( mode != MODE_IMAGE_ONLY ) { push_int(ihdr.type); - mapping_string_insert(m, param_type, sp-1); + mapping_string_insert(m, literal_type_string, sp-1); pop_stack(); push_int(ihdr.bpp); @@ -1886,7 +1886,6 @@ void exit_image_png(void) free_string(param_alpha); free_string(param_bpp); free_string(param_background); - free_string(param_type); free_string(param_zlevel); free_string(param_zstrategy); } @@ -1937,7 +1936,6 @@ void init_image_png(void) param_image=make_shared_string("image"); param_alpha=make_shared_string("alpha"); param_bpp=make_shared_string("bpp"); - param_type=make_shared_string("type"); param_background=make_shared_string("background"); param_zlevel=make_shared_string("zlevel"); param_zstrategy=make_shared_string("zstrategy"); diff --git a/src/modules/Image/encodings/pvr.c b/src/modules/Image/encodings/pvr.c index 5ef2683e5f4adf054f5513ba17c483e1111472ac..ceb84969b3e9edfbd0a2a16f278e47db441629cc 100644 --- a/src/modules/Image/encodings/pvr.c +++ b/src/modules/Image/encodings/pvr.c @@ -20,6 +20,7 @@ #include "stralloc.h" #include "builtin_functions.h" #include "module_support.h" +#include "pike_types.h" #include "image.h" @@ -1063,7 +1064,7 @@ void img_pvr_decode(INT32 args,int header_only) len = l+8; } - push_text("type"); + ref_push_string(literal_type_string); push_text("image/x-pvr"); n++; diff --git a/src/modules/Image/encodings/tga.c b/src/modules/Image/encodings/tga.c index c149ad3455b716e45792ebb288b5991b81456f0f..2933e557688d4312998ccda72c09c502ce057747 100644 --- a/src/modules/Image/encodings/tga.c +++ b/src/modules/Image/encodings/tga.c @@ -64,6 +64,7 @@ #include "threads.h" #include "module_support.h" #include "builtin_functions.h" +#include "pike_types.h" #include "image.h" @@ -846,7 +847,7 @@ void image_tga__decode( INT32 args ) push_text( "image" ); push_object( i.io ); - push_text( "type" ); + ref_push_string( literal_type_string ); push_text( "image/x-targa" ); push_text( "xsize" ); diff --git a/src/modules/Image/encodings/tim.c b/src/modules/Image/encodings/tim.c index 961e7da0ebd6c5b1e99dd4075b31697f1a46f496..bc4332440bb7426c350581b42ef0a752d1ebdf2b 100644 --- a/src/modules/Image/encodings/tim.c +++ b/src/modules/Image/encodings/tim.c @@ -17,6 +17,7 @@ #include "operators.h" #include "builtin_functions.h" #include "module_support.h" +#include "pike_types.h" #include "image.h" @@ -186,7 +187,7 @@ void img_tim_decode(INT32 args, int header_only) s += 4; len -= 4; - push_text("type"); + ref_push_string(literal_type_string); push_text("image/x-tim"); n++; diff --git a/src/modules/Image/encodings/xcf.c b/src/modules/Image/encodings/xcf.c index 5f5af2b4b13ce1b60f20847d57b629810f17d8dd..5e6b28d05549da80c901a08c5b94b1b56dae5ec7 100644 --- a/src/modules/Image/encodings/xcf.c +++ b/src/modules/Image/encodings/xcf.c @@ -114,7 +114,7 @@ static void f_substring__sprintf( INT32 args ) return; case 'O': push_text("SubString( %O /* [+%d .. %d] */ )" ); - push_text("string"); f_substring_cast( 1 ); + ref_push_string(literal_string_string); f_substring_cast( 1 ); push_int64( s->len ); push_int64( s->offset ); diff --git a/src/modules/Image/encodings/xwd.c b/src/modules/Image/encodings/xwd.c index 56850dabdd5ee4e3b59010cdd864a5fcdbe82f5e..d3e2992a1375eafe6309ae72a176e9e8b5ff4f9e 100644 --- a/src/modules/Image/encodings/xwd.c +++ b/src/modules/Image/encodings/xwd.c @@ -37,7 +37,7 @@ #include "builtin_functions.h" #include "operators.h" #include "encodings.h" - +#include "pike_types.h" #define sp Pike_sp @@ -233,7 +233,7 @@ void img_xwd__decode(INT32 args,int header_only,int skipcmap) n+=25; - push_text("type"); + ref_push_string(literal_type_string); push_text("image/x-xwd"); n++; diff --git a/src/modules/Math/math_matrix.c b/src/modules/Math/math_matrix.c index 9821300a7e9e4c341aa1341aeb45854fc1381933..723f156e6ae07ea4046dee012cf04439b3260cd3 100644 --- a/src/modules/Math/math_matrix.c +++ b/src/modules/Math/math_matrix.c @@ -29,7 +29,6 @@ *! Matrix representation with double precision floating point values. */ -static struct pike_string *s_array; static struct pike_string *s__clr; static struct pike_string *s_identity; static struct pike_string *s_rotate; diff --git a/src/modules/Math/matrix_code.h b/src/modules/Math/matrix_code.h index ebde77ac83ca08c37c4fc5e123364fdd125f4929..e9f77e05f7d34289edd8305009450b30ff7e3fe0 100644 --- a/src/modules/Math/matrix_code.h +++ b/src/modules/Math/matrix_code.h @@ -957,8 +957,6 @@ static void matrixX(_ysize)(INT32 args) void Xmatrix(init_math_)(void) { #define MKSTR(X) make_shared_binary_string(X,CONSTANT_STRLEN(X)) - if( !s_array ) - s_array=MKSTR("array"); if( !s_rotate ) s_rotate=MKSTR("rotate"); if( !s__clr ) @@ -1021,10 +1019,6 @@ void Xmatrix(init_math_)(void) void Xmatrix(exit_math_)(void) { - if (s_array) { - free_string(s_array); - s_array = NULL; - } if (s_rotate) { free_string(s_rotate); s_rotate = NULL; diff --git a/src/modules/Msql/msqlmod.c b/src/modules/Msql/msqlmod.c index d8c2f7c8b20b2ae986107476c12ffcb8f9c2edac..1eda21d4baaf5e59734438ecd59a201bfeec8c2a 100644 --- a/src/modules/Msql/msqlmod.c +++ b/src/modules/Msql/msqlmod.c @@ -834,7 +834,7 @@ static void do_list_fields (INT32 args) push_text("name"); push_text(field->name); - push_text("type"); + ref_push_string(literal_type_string); push_text(decode_msql_type(field->type)); push_text("length"); push_int(field->length); diff --git a/src/modules/Odbc/odbc_result.c b/src/modules/Odbc/odbc_result.c index 54bbac41eeae23a4dab294e204282da6422c8be0..f8a6cb6ffd3b24b7e767426fdc152f4c81afdd05 100644 --- a/src/modules/Odbc/odbc_result.c +++ b/src/modules/Odbc/odbc_result.c @@ -222,7 +222,7 @@ static void odbc_fix_fields(void) #else push_string(make_shared_binary_string((char *)buf, name_len)); #endif - push_text("type"); + ref_push_string(literal_type_string); #ifdef SQL_WCHAR #ifdef ODBC_DEBUG fprintf(stderr, "SQL_C_WCHAR\n"); @@ -240,7 +240,7 @@ static void odbc_fix_fields(void) #ifdef SQL_WCHAR case SQL_WCHAR: #endif - push_text("string"); + ref_push_string(literal_string_string); break; case SQL_NUMERIC: push_text("numeric"); @@ -259,7 +259,7 @@ static void odbc_fix_fields(void) odbc_field_types[i] = SQL_C_CHAR; break; case SQL_FLOAT: - push_text("float"); + ref_push_string(literal_float_string); odbc_field_types[i] = SQL_C_CHAR; break; case SQL_REAL: diff --git a/src/modules/Oracle/oracle.c b/src/modules/Oracle/oracle.c index 60a7edae73370774fd965926373f9071999a9e99..ed59f8c983680df537754d3254af78ca1fc4e13d 100644 --- a/src/modules/Oracle/oracle.c +++ b/src/modules/Oracle/oracle.c @@ -2621,7 +2621,7 @@ static void dbnull_eq(INT32 args) } pop_stack(); /* Yes - are the types the same? */ - push_constant_text("type"); + ref_push_string(literal_type_string); o_index(); push_svalue(&THIS_DBNULL->type); f_eq(2); diff --git a/src/modules/Postgres/pgresult.c b/src/modules/Postgres/pgresult.c index b955d9285c326ea16a5b1cccabe148e75a22f0e8..558541ed4650c056eb1f48fb6fdc3b78cf5efa19 100644 --- a/src/modules/Postgres/pgresult.c +++ b/src/modules/Postgres/pgresult.c @@ -262,7 +262,7 @@ static void f_fetch_fields (INT32 args) push_text(PQfname(res,j)); /* no table information is available */ /* no default value information is available */ - push_text("type"); + ref_push_string(literal_type_string); push_int(PQftype(res,j)); /* ARGH! I'd kill 'em! How am I supposed to know how types are * coded internally!?!?!?!? diff --git a/src/modules/SANE/sane.c b/src/modules/SANE/sane.c index dba1ccc7c10a90ec42b5b6f00022da9da09bb703..5fe880b98bd0858987932dde40f9448387e57407 100644 --- a/src/modules/SANE/sane.c +++ b/src/modules/SANE/sane.c @@ -61,7 +61,7 @@ static void push_device( SANE_Device *d ) push_text( "name" ); push_text( d->name ); push_text( "vendor" ); push_text( d->vendor ); push_text( "model" ); push_text( d->model ); - push_text( "type" ); push_text( d->type ); + ref_push_string( literal_type_string ); push_text( d->type ); f_aggregate_mapping( 8 ); } @@ -126,13 +126,13 @@ static void push_option_descriptor( const SANE_Option_Descriptor *o ) push_text( o->desc ); else push_int( 0 ); - push_text( "type" ); + ref_push_string( literal_type_string ); switch( o->type ) { case SANE_TYPE_BOOL: push_text( "boolean" ); break; - case SANE_TYPE_INT: push_text( "int" ); break; - case SANE_TYPE_FIXED: push_text( "float" ); break; - case SANE_TYPE_STRING: push_text( "string" ); break; + case SANE_TYPE_INT: ref_push_string( literal_int_string ); break; + case SANE_TYPE_FIXED: ref_push_string( literal_float_string ); break; + case SANE_TYPE_STRING: ref_push_string( literal_string_string ); break; case SANE_TYPE_BUTTON: push_text( "button" ); break; case SANE_TYPE_GROUP: push_text( "group" ); break; } @@ -169,14 +169,14 @@ static void push_option_descriptor( const SANE_Option_Descriptor *o ) { case SANE_CONSTRAINT_NONE: push_int( 0 ); break; case SANE_CONSTRAINT_RANGE: - push_text( "type" ); push_text( "range" ); + ref_push_string( literal_type_string ); push_text( "range" ); push_text( "min" ); push_int( o->constraint.range->min ); push_text( "max" ); push_int( o->constraint.range->max ); push_text( "quant" ); push_int( o->constraint.range->quant ); f_aggregate_mapping( 8 ); break; case SANE_CONSTRAINT_WORD_LIST: - push_text( "type" ); + ref_push_string( literal_type_string ); push_text( "list" ); push_text( "list" ); for( i = 0; i<o->constraint.word_list[0]; i++ ) @@ -188,7 +188,7 @@ static void push_option_descriptor( const SANE_Option_Descriptor *o ) f_aggregate_mapping( 4 ); break; case SANE_CONSTRAINT_STRING_LIST: - push_text( "type" ); + ref_push_string( literal_type_string ); push_text( "list" ); push_text( "list" ); for( i = 0; o->constraint.string_list[i]; i++ ) diff --git a/src/modules/_Ffmpeg/ffmpeg.c b/src/modules/_Ffmpeg/ffmpeg.c index e2400ee31ae1b5a5777dc07c3967f641c6d5f57c..64a010baa85bcf98e78dd69160eb96a7fabc5bcc 100644 --- a/src/modules/_Ffmpeg/ffmpeg.c +++ b/src/modules/_Ffmpeg/ffmpeg.c @@ -229,7 +229,7 @@ static void f_codec_info(INT32 args) { pop_n_elems(args); if(THIS->codec) { push_text("name"); push_text( THIS->codec->name ); - push_text("type"); push_int( THIS->codec->type ); + ref_push_string(literal_type_string); push_int( THIS->codec->type ); push_text("id"); push_int( THIS->codec->id ); push_text("encoder_flg"); push_int( encoder_flg(THIS->codec) ); f_aggregate_mapping( 2*4 ); @@ -314,7 +314,7 @@ static void f_get_codec_status(INT32 args) { } push_text("name"); push_text( THIS->codec->name ); - push_text("type"); push_int( THIS->codec->type ); + ref_push_string(literal_type_string); push_int( THIS->codec->type ); push_text("id"); push_int( THIS->codec->id ); push_text("encoder_flg"); push_int( encoder_flg(THIS->codec) ); push_text("flags"); push_int( THIS->codec_context.flags ); @@ -491,7 +491,7 @@ static void f_list_codecs(INT32 args) { while ((codec = av_codec_next(codec))) { cnt++; push_text("name"); push_text( codec->name ); - push_text("type"); push_int( codec->type ); + ref_push_string(literal_type_string); push_int( codec->type ); push_text("id"); push_int( codec->id ); push_text("encoder_flg"); push_int( encoder_flg(codec) ); f_aggregate_mapping( 2*4 ); @@ -506,7 +506,7 @@ static void f_list_codecs(INT32 args) { while(codec != NULL) { cnt++; push_text("name"); push_text( codec->name ); - push_text("type"); push_int( codec->type ); + ref_push_string(literal_type_string); push_int( codec->type ); push_text("id"); push_int( codec->id ); push_text("encoder_flg"); push_int( encoder_flg(codec) ); codec = codec->next; diff --git a/src/modules/_Image_GIF/image_gif.c b/src/modules/_Image_GIF/image_gif.c index 69cb54ef8e526295fd34ebcb26f3533947f6c352..de7dfe8d0a664d82cbed7e2b46994b859b8bbb25 100644 --- a/src/modules/_Image_GIF/image_gif.c +++ b/src/modules/_Image_GIF/image_gif.c @@ -47,6 +47,7 @@ #include "array.h" #include "pike_error.h" #include "threads.h" +#include "pike_types.h" #include "../Image/image.h" #include "../Image/colortable.h" @@ -2257,7 +2258,7 @@ void image_gif_decode_map(INT32 args) f_rows(2); f_call_function(1); f_mkmapping(2); - push_text("type"); + ref_push_string(literal_type_string); push_text("image/gif"); f_aggregate_mapping(2); f_add(2); diff --git a/src/modules/_Image_JPEG/image_jpeg.c b/src/modules/_Image_JPEG/image_jpeg.c index ffeb10e4a31cc218006af036f07c4f8b4f4bd4da..9e64c883f20f806dae3d0d8aa5e9af05e3b7af8b 100644 --- a/src/modules/_Image_JPEG/image_jpeg.c +++ b/src/modules/_Image_JPEG/image_jpeg.c @@ -25,6 +25,7 @@ #include "builtin_functions.h" #include "module_support.h" #include "operators.h" +#include "pike_types.h" #include <stdio.h> @@ -1056,7 +1057,7 @@ static void img_jpeg_decode(INT32 args,int mode) { /* standard header info */ - push_text("type"); n++; + ref_push_string(literal_type_string); n++; push_text("image/jpeg"); push_text("xsize"); n++; diff --git a/src/modules/_Image_XFace/image_xface.c b/src/modules/_Image_XFace/image_xface.c index 015ff447ead1939d113cc3320415bef5ee274f3c..48bc861f68afe370566e554df180fd6c66f1c8d5 100644 --- a/src/modules/_Image_XFace/image_xface.c +++ b/src/modules/_Image_XFace/image_xface.c @@ -30,6 +30,7 @@ #include "dynamic_buffer.h" #include "operators.h" #include "builtin_functions.h" +#include "pike_types.h" #if defined(USE_GMP) || defined(USE_GMP2) @@ -486,7 +487,7 @@ static void image_xface_decode_header(INT32 args) pop_n_elems(args); - push_text("type"); + ref_push_string(literal_type_string); push_text("image/x-xface"); push_text("xsize"); diff --git a/src/modules/sybase/sybase.c b/src/modules/sybase/sybase.c index e10cb4af2fe01fae4a296e53ef7a7910e12f11e3..d26f2937c35109109613a8d6a8a454cec3a62e21 100644 --- a/src/modules/sybase/sybase.c +++ b/src/modules/sybase/sybase.c @@ -1082,7 +1082,7 @@ static void f_fetch_fields(INT32 args) { push_text("name"); push_text(desc->name); sybdebug((stderr,"name is %s\n",desc->name)); - push_text("type"); + ref_push_string(literal_type_string); switch(desc->datatype) { desc_type(CS_ILLEGAL_TYPE,illegal); desc_type(CS_CHAR_TYPE,char); diff --git a/src/modules/system/nt.c b/src/modules/system/nt.c index e08726d8e5127425a9275f58cb861658096ae7c7..aec59c3f2d6d9b9b10e065b28744b98476b2444e 100644 --- a/src/modules/system/nt.c +++ b/src/modules/system/nt.c @@ -3169,7 +3169,7 @@ static void f_SetNamedSecurityInfo(INT32 args) ASSERT_SECURITY_ROOT("SetNamedSecurity"); get_all_args("SetNamedSecurityInfo",args,"%s%m",&name,&m); - if((sval=simple_mapping_string_lookup(m, "type"))) + if((sval=low_mapping_string_lookup(m, literal_type_string))) { if(TYPEOF(*sval) != T_INT) Pike_error("Bad 'type' in SetNamedSecurityInfo.\n"); diff --git a/src/operators.c b/src/operators.c index b2b8ed41ff24a17d0d7fd2d9cb2aedcb9cbacec5..ab50c2c6c97a456b62a4c950d94de9168c5c8c78 100644 --- a/src/operators.c +++ b/src/operators.c @@ -229,13 +229,11 @@ PMOD_EXPORT void o_cast_to_int(void) else { { struct object *o = sp[-1].u.object; - struct pike_string *s; struct program *p = o->prog->inherits[SUBTYPEOF(sp[-1])].prog; int f = FIND_LFUN(p, LFUN_CAST); if(f == -1) Pike_error("No cast method in object.\n"); - REF_MAKE_CONST_STRING(s, "int"); - push_string(s); + ref_push_string(literal_int_string); apply_low(o, f, 1); stack_pop_keep_top(); } @@ -249,9 +247,7 @@ PMOD_EXPORT void o_cast_to_int(void) LFUN__IS_TYPE); if( f != -1) { - struct pike_string *s; - REF_MAKE_CONST_STRING(s, "int"); - push_string(s); + ref_push_string(literal_int_string); apply_low(o, f, 1); f=!UNSAFE_IS_ZERO(sp-1); pop_stack(); @@ -337,7 +333,7 @@ PMOD_EXPORT void o_cast_to_string(void) int f = FIND_LFUN(o->prog->inherits[SUBTYPEOF(sp[-1])].prog, LFUN_CAST); if(f == -1) Pike_error("No cast method in object.\n"); - push_constant_text("string"); + ref_push_string(literal_string_string); apply_low(o, f, 1); stack_pop_keep_top(); } @@ -353,8 +349,7 @@ PMOD_EXPORT void o_cast_to_string(void) LFUN__IS_TYPE); if( f != -1) { - REF_MAKE_CONST_STRING(s, "string"); - push_string(s); + ref_push_string(literal_string_string); apply_low(o, f, 1); f=!UNSAFE_IS_ZERO(sp-1); pop_stack(); diff --git a/src/post_modules/GTK1/source/gdkevent.pre b/src/post_modules/GTK1/source/gdkevent.pre index 592a48eaee0e446dbed24a6aef3c7209c57669d5..3249c69759ebbe50f28c26315f5f169653c0f05c 100644 --- a/src/post_modules/GTK1/source/gdkevent.pre +++ b/src/post_modules/GTK1/source/gdkevent.pre @@ -237,7 +237,7 @@ string _sprintf(int flag) return; } push_text( "GDK1.Event(" ); - push_text( "type" ); pgdk_event__index( 1 ); + ref_push_string( literal_type_string ); pgdk_event__index( 1 ); push_text( ")" ); f_add( 3 ); } diff --git a/src/post_modules/GTK1/source/gdkgc.pre b/src/post_modules/GTK1/source/gdkgc.pre index 78789e7253fc4757eae2a7fb7ba9e8e5a039868e..c62e8040415f6eca6b944d764dd633990e63d61f 100644 --- a/src/post_modules/GTK1/source/gdkgc.pre +++ b/src/post_modules/GTK1/source/gdkgc.pre @@ -113,7 +113,7 @@ mapping(string:mixed) get_values() if( v.clip_mask ) gdk_pixmap_ref( v.clip_mask ); push_text( "fill" ); push_int( v.fill ); - push_text( "function" ); push_int( v.function ); + ref_push_string( literal_function_string ); push_int( v.function ); { GdkColor *f = g_malloc( sizeof( GdkColor ) ); GdkColor *b = g_malloc( sizeof( GdkColor ) ); diff --git a/src/post_modules/GTK1/source/gdkrectangle.pre b/src/post_modules/GTK1/source/gdkrectangle.pre index e1ced2d91187db060ef4623c9f54b54383ca1a12..e24c6065c861ba4118bb013d53ad8ec397cee099 100644 --- a/src/post_modules/GTK1/source/gdkrectangle.pre +++ b/src/post_modules/GTK1/source/gdkrectangle.pre @@ -34,13 +34,17 @@ void set(int x, int y, int width, int height ) mixed cast(string type) //! Normally used like (mapping)rectangle or (array)rectangle. { - char *type; + struct pike_string *type; GdkRectangle *r = (GdkRectangle *)THIS->obj; - get_all_args( "cast", args, "%s", &type ); - if(!strcmp(type, "mapping")) + if (args!=1) + SIMPLE_TOO_FEW_ARGS_ERROR("cast",1); + + type = Pike_sp[-args].u.string; + my_pop_n_elems(args); + + if(type == literal_mapping_string) { - my_pop_n_elems(args); push_text( "x" ); push_int( r->x ); push_text( "y" ); @@ -50,15 +54,14 @@ mixed cast(string type) push_text( "height" ); push_int( r->height ); f_aggregate_mapping( 8 ); - } else if(!strcmp(type, "array")) { - my_pop_n_elems(args); + } else if(type == literal_array_string) { push_int( r->x ); push_int( r->y ); push_int( r->width ); push_int( r->height ); f_aggregate( 4 ); } else { - Pike_error("Cannot cast to %s.\n", type ); + push_undefined(); } } diff --git a/src/post_modules/GTK1/source/gdkwindow.pre b/src/post_modules/GTK1/source/gdkwindow.pre index 9defa621687ebae7bfbb60d2e4e40f57d02f6ff5..5f85f235f0277de1071593ed1aa710aad94fa284 100644 --- a/src/post_modules/GTK1/source/gdkwindow.pre +++ b/src/post_modules/GTK1/source/gdkwindow.pre @@ -435,7 +435,7 @@ mapping get_property(GDK1.Atom atom, int|void offset, int|void delete_when_done) { struct object *o; my_pop_n_elems(args); - push_text( "type" ); + ref_push_string( literal_type_string ); push_text( gdk_atom_name( actual_property_type ) ); push_text( "width" ); push_int( actual_format_type ); diff --git a/src/post_modules/GTK1/source/gtkbox.pre b/src/post_modules/GTK1/source/gtkbox.pre index abee5c73fd03cc390a6d80d743cfbc51dfc868ce..00864c26e673da4e0a4c16a95151535327997fb7 100644 --- a/src/post_modules/GTK1/source/gtkbox.pre +++ b/src/post_modules/GTK1/source/gtkbox.pre @@ -52,7 +52,7 @@ mapping(string:int) query_child_packing(GTK1.Widget child) push_int( fi ); push_text( "padding" ); push_int( pa ); - push_text( "type" ); + ref_push_string( literal_type_string ); push_int( ty ); f_aggregate_mapping( 8 ); } diff --git a/src/post_modules/GTK1/source/support.c b/src/post_modules/GTK1/source/support.c index 7f7b25f5e57666bc683569c64911deb7f36c4b32..dd4b6df55931cb7a39c84266733d04c09e054560 100644 --- a/src/post_modules/GTK1/source/support.c +++ b/src/post_modules/GTK1/source/support.c @@ -870,7 +870,7 @@ double pgtk_get_float( struct svalue *s ) if( is_bignum_object_in_svalue( s ) ) { FLOAT_TYPE f; - push_text( "float" ); + ref_push_string( literal_float_string ); apply( s->u.object, "cast", 1 ); f = Pike_sp[-1].u.float_number; pop_stack(); diff --git a/src/post_modules/GTK2/source/gdkevent.pre b/src/post_modules/GTK2/source/gdkevent.pre index 23708c32d630914eeb8306f7a8291080f372f716..7d1f7496494cf52f189ca8106b8ca2f85783d7e3 100644 --- a/src/post_modules/GTK2/source/gdkevent.pre +++ b/src/post_modules/GTK2/source/gdkevent.pre @@ -41,17 +41,17 @@ mixed _index(string ind) switch( e->type ) { case GDK_NOTHING: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("nothing")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("nothing")); break; case GDK_DELETE: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("delete")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("delete")); break; case GDK_DESTROY: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("destroy")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("destroy")); break; case GDK_EXPOSE: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("expose")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("expose")); if( is_same_string(index,_STR("count")) ) RETURN_INT( e->expose.count ); if( is_same_string(index,_STR("x")) ) RETURN_INT( e->expose.area.x ); if( is_same_string(index,_STR("y")) ) RETURN_INT( e->expose.area.y ); @@ -60,7 +60,7 @@ mixed _index(string ind) break; case GDK_MOTION_NOTIFY: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("motion")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("motion")); if( is_same_string(index,_STR("x")) ) RETURN_FLOAT( e->motion.x ); if( is_same_string(index,_STR("y")) ) RETURN_FLOAT( e->motion.y ); if( is_same_string(index,_STR("x_root")) ) RETURN_FLOAT( e->motion.x_root ); @@ -73,13 +73,13 @@ mixed _index(string ind) break; case GDK_BUTTON_PRESS: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("button_press")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("button_press")); case GDK_BUTTON_RELEASE: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("button_release")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("button_release")); case GDK_2BUTTON_PRESS: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("2button_press")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("2button_press")); case GDK_3BUTTON_PRESS: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("3button_press")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("3button_press")); if( is_same_string(index,_STR("x")) ) RETURN_FLOAT(e->button.x); if( is_same_string(index,_STR("y")) ) RETURN_FLOAT(e->button.y); /* if( index == s_pressure ) RETURN_FLOAT(e->button.pressure); */ @@ -93,9 +93,9 @@ mixed _index(string ind) break; case GDK_KEY_PRESS: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("key_press")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("key_press")); case GDK_KEY_RELEASE: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("key_release")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("key_release")); if( is_same_string(index,_STR("state")) ) RETURN_INT(e->key.state); if( is_same_string(index,_STR("keyval")) ) RETURN_INT(e->key.keyval); if(e->key.string) @@ -104,9 +104,9 @@ mixed _index(string ind) break; case GDK_ENTER_NOTIFY: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("enter_notify")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("enter_notify")); case GDK_LEAVE_NOTIFY: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("leave_notify")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("leave_notify")); if( is_same_string(index,_STR("detail")) ) RETURN_INT(e->crossing.detail); if( is_same_string(index,_STR("mode")) ) RETURN_INT(e->crossing.mode ); if( is_same_string(index,_STR("focus")) ) RETURN_INT(e->crossing.focus ); @@ -118,16 +118,16 @@ mixed _index(string ind) break; case GDK_FOCUS_CHANGE: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("focus")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("focus")); if( is_same_string(index,_STR("in")) ) RETURN_INT( e->focus_change.in ); break; case GDK_CONFIGURE: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("configure")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("configure")); case GDK_MAP: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("map")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("map")); case GDK_UNMAP: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("unmap")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("unmap")); if( is_same_string(index,_STR("x")) ) RETURN_INT(e->configure.x); if( is_same_string(index,_STR("y")) ) RETURN_INT(e->configure.y); if( is_same_string(index,_STR("width")) ) RETURN_INT(e->configure.width); @@ -135,17 +135,17 @@ mixed _index(string ind) break; case GDK_PROPERTY_NOTIFY: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("property")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("property")); if( is_same_string(index,_STR("atom")) ) RETURN_ATOM( e->property.atom ); if( is_same_string(index,_STR("state")) ) RETURN_INT( e->property.state ); break; case GDK_SELECTION_CLEAR: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("selection_clear")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("selection_clear")); case GDK_SELECTION_REQUEST: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("selection_request")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("selection_request")); case GDK_SELECTION_NOTIFY: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("selection_notify")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("selection_notify")); if( is_same_string(index,_STR("selection")) ) RETURN_ATOM( e->selection.selection ); if( is_same_string(index,_STR("target")) ) RETURN_ATOM( e->selection.target ); if( is_same_string(index,_STR("property")) ) RETURN_ATOM( e->selection.property ); @@ -153,17 +153,17 @@ mixed _index(string ind) break; case GDK_PROXIMITY_IN: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("proximity_in")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("proximity_in")); /* if( index == s_deviceid ) RETURN_INT( e->proximity.deviceid ); */ break; case GDK_PROXIMITY_OUT: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("proximity_out")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("proximity_out")); /* if( index == s_deviceid ) RETURN_INT( e->proximity.deviceid ); */ break; case GDK_CLIENT_EVENT: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("client")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("client")); if( is_same_string(index,_STR("message_type")) ) RETURN_ATOM( e->client.message_type ); if( is_same_string(index,_STR("data_format")) ) RETURN_INT(e->client.data_format); if( is_same_string(index,_STR("data")) ) @@ -186,26 +186,26 @@ mixed _index(string ind) break; case GDK_VISIBILITY_NOTIFY: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("visibility")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("visibility")); if( is_same_string(index,_STR("state")) ) RETURN_INT( e->visibility.state ); break; case GDK_NO_EXPOSE: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("noexpose")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("noexpose")); break; case GDK_DRAG_ENTER: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("drag_enter")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("drag_enter")); case GDK_DRAG_LEAVE: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("drag_leave")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("drag_leave")); case GDK_DRAG_MOTION: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("drag_motion")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("drag_motion")); case GDK_DRAG_STATUS: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("drag_status")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("drag_status")); case GDK_DROP_START: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("drop_start")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("drop_start")); case GDK_DROP_FINISHED: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("drop_finished")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("drop_finished")); if( is_same_string(index,_STR("send_event")) ) RETURN_INT( e->dnd.send_event ); if( is_same_string(index,_STR("x_root")) ) RETURN_INT( e->dnd.x_root ); if( is_same_string(index,_STR("y_root")) ) RETURN_INT( e->dnd.y_root ); @@ -217,7 +217,7 @@ mixed _index(string ind) } break; case GDK_SCROLL: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("scroll")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("scroll")); if (is_same_string(index,_STR("x"))) RETURN_INT(e->scroll.x); if (is_same_string(index,_STR("y"))) RETURN_INT(e->scroll.y); if (is_same_string(index,_STR("direction"))) RETURN_INT(e->scroll.direction); @@ -226,25 +226,25 @@ mixed _index(string ind) break; case GDK_WINDOW_STATE: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("window_state")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("window_state")); if( is_same_string(index,_STR("changed")) ) RETURN_INT(e->window_state.changed_mask); if( is_same_string(index,_STR("new_state")) ) RETURN_INT(e->window_state.new_window_state); break; case GDK_SETTING: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("setting")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("setting")); if( is_same_string(index,_STR("action")) ) RETURN_INT(e->setting.action); if( is_same_string(index,_STR("name")) ) RETURN_STRING(make_shared_binary_string(e->setting.name,strlen(e->setting.name))); break; #ifdef HAVE_GTK26 case GDK_OWNER_CHANGE: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("owner_change")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("owner_change")); if( is_same_string(index,_STR("selection")) ) RETURN_ATOM(e->owner_change.selection); break; #endif #ifdef HAVE_GTK28 case GDK_GRAB_BROKEN: - if( is_same_string(index,_STR("type")) ) REF_RETURN_STRING(_STR("setting")); + if( index == literal_type_string ) REF_RETURN_STRING(_STR("setting")); if( is_same_string(index,_STR("keyboard")) ) RETURN_INT(e->grab_broken.keyboard); if( is_same_string(index,_STR("implicit")) ) RETURN_INT(e->grab_broken.implicit); break; @@ -265,7 +265,7 @@ string _sprintf(int flag) return; } ref_push_string( _STR("GDK2.Event(") ); - ref_push_string( _STR("type") ); pgdk2_event__index( 1 ); + ref_push_string( literal_type_string ); pgdk2_event__index( 1 ); ref_push_string( _STR(")") ); f_add( 3 ); } @@ -289,16 +289,16 @@ mixed cast(string to) switch(e->type) { case GDK_NOTHING: - ref_push_string(_STR("type")); ref_push_string(_STR("nothing")); + ref_push_string(literal_type_string); ref_push_string(_STR("nothing")); break; case GDK_DELETE: - ref_push_string(_STR("type")); ref_push_string(_STR("delete")); + ref_push_string(literal_type_string); ref_push_string(_STR("delete")); break; case GDK_DESTROY: - ref_push_string(_STR("type")); ref_push_string(_STR("destroy")); + ref_push_string(literal_type_string); ref_push_string(_STR("destroy")); break; case GDK_EXPOSE: - ref_push_string(_STR("type")); ref_push_string(_STR("expose")); + ref_push_string(literal_type_string); ref_push_string(_STR("expose")); ref_push_string(_STR("count")); push_int(e->expose.count); ref_push_string(_STR("x")); push_int(e->expose.area.x); ref_push_string(_STR("y")); push_int(e->expose.area.y); @@ -307,7 +307,7 @@ mixed cast(string to) break; case GDK_MOTION_NOTIFY: - ref_push_string(_STR("type")); ref_push_string(_STR("motion")); + ref_push_string(literal_type_string); ref_push_string(_STR("motion")); ref_push_string(_STR("x")); push_float(e->motion.x); ref_push_string(_STR("y")); push_float(e->motion.y); /* ref_push_string(s_pressure);push_float(e->motion.pressure); */ @@ -321,16 +321,16 @@ mixed cast(string to) break; case GDK_BUTTON_PRESS: - ref_push_string(_STR("type")); ref_push_string(_STR("button_press")); + ref_push_string(literal_type_string); ref_push_string(_STR("button_press")); goto press_event; case GDK_2BUTTON_PRESS: - ref_push_string(_STR("type")); ref_push_string(_STR("2button_press")); + ref_push_string(literal_type_string); ref_push_string(_STR("2button_press")); goto press_event; case GDK_3BUTTON_PRESS: - ref_push_string(_STR("type")); ref_push_string(_STR("3button_press")); + ref_push_string(literal_type_string); ref_push_string(_STR("3button_press")); goto press_event; case GDK_BUTTON_RELEASE: - ref_push_string(_STR("type")); ref_push_string(_STR("button_release")); + ref_push_string(literal_type_string); ref_push_string(_STR("button_release")); press_event: ref_push_string(_STR("time")); push_int(e->button.time); @@ -347,11 +347,11 @@ mixed cast(string to) break; case GDK_KEY_PRESS: - ref_push_string(_STR("type")); ref_push_string(_STR("key_press")); + ref_push_string(literal_type_string); ref_push_string(_STR("key_press")); goto key_event; case GDK_KEY_RELEASE: - ref_push_string(_STR("type")); ref_push_string(_STR("key_release")); + ref_push_string(literal_type_string); ref_push_string(_STR("key_release")); key_event: ref_push_string(_STR("time")); push_int(e->key.time); ref_push_string(_STR("state")); push_int(e->key.state); @@ -364,11 +364,11 @@ mixed cast(string to) break; case GDK_ENTER_NOTIFY: - ref_push_string(_STR("type")); ref_push_string(_STR("enter_notify")); + ref_push_string(literal_type_string); ref_push_string(_STR("enter_notify")); goto enter_event; case GDK_LEAVE_NOTIFY: - ref_push_string(_STR("type")); ref_push_string(_STR("leave_notify")); + ref_push_string(literal_type_string); ref_push_string(_STR("leave_notify")); enter_event: ref_push_string(_STR("detail")); push_int(e->crossing.detail); ref_push_string(_STR("mode")); push_int(e->crossing.mode ); @@ -381,20 +381,20 @@ mixed cast(string to) break; case GDK_FOCUS_CHANGE: - ref_push_string(_STR("type")); ref_push_string(_STR("focus")); + ref_push_string(literal_type_string); ref_push_string(_STR("focus")); ref_push_string(_STR("in")); push_int( e->focus_change.in ); break; case GDK_CONFIGURE: - ref_push_string(_STR("type")); ref_push_string(_STR("configure")); + ref_push_string(literal_type_string); ref_push_string(_STR("configure")); goto configure_event; case GDK_MAP: - ref_push_string(_STR("type")); ref_push_string(_STR("map")); + ref_push_string(literal_type_string); ref_push_string(_STR("map")); goto configure_event; case GDK_UNMAP: - ref_push_string(_STR("type")); ref_push_string(_STR("unmap")); + ref_push_string(literal_type_string); ref_push_string(_STR("unmap")); configure_event: ref_push_string(_STR("x")); push_int(e->configure.x); ref_push_string(_STR("y")); push_int(e->configure.x); @@ -403,21 +403,21 @@ mixed cast(string to) break; case GDK_PROPERTY_NOTIFY: - ref_push_string(_STR("type")); ref_push_string(_STR("property")); + ref_push_string(literal_type_string); ref_push_string(_STR("property")); ref_push_string(_STR("atom")); push_atom( e->property.atom ); ref_push_string(_STR("state")); push_int( e->property.state ); break; case GDK_SELECTION_CLEAR: - ref_push_string(_STR("type")); ref_push_string(_STR("selection_clear")); + ref_push_string(literal_type_string); ref_push_string(_STR("selection_clear")); goto selection_event; case GDK_SELECTION_REQUEST: - ref_push_string(_STR("type")); ref_push_string(_STR("selection_request")); + ref_push_string(literal_type_string); ref_push_string(_STR("selection_request")); goto selection_event; case GDK_SELECTION_NOTIFY: - ref_push_string(_STR("type")); ref_push_string(_STR("selection_notify")); + ref_push_string(literal_type_string); ref_push_string(_STR("selection_notify")); selection_event: ref_push_string(_STR("selection")); push_atom( e->selection.selection ); ref_push_string(_STR("target")); push_atom( e->selection.target ); @@ -426,16 +426,16 @@ mixed cast(string to) break; case GDK_PROXIMITY_IN: - ref_push_string(_STR("type")); ref_push_string(_STR("proximity_in")); + ref_push_string(literal_type_string); ref_push_string(_STR("proximity_in")); /* ref_push_string(s_deviceid ); push_int( e->proximity.deviceid ); */ break; case GDK_PROXIMITY_OUT: - ref_push_string(_STR("type")); ref_push_string(_STR("proximity_out")); + ref_push_string(literal_type_string); ref_push_string(_STR("proximity_out")); /* ref_push_string(s_deviceid ); push_int( e->proximity.deviceid ); */ break; case GDK_CLIENT_EVENT: - ref_push_string(_STR("type")); ref_push_string(_STR("client")); + ref_push_string(literal_type_string); ref_push_string(_STR("client")); ref_push_string(_STR("message_type")); push_atom( e->client.message_type ); ref_push_string(_STR("data_format")); push_int(e->client.data_format); @@ -455,32 +455,32 @@ mixed cast(string to) break; case GDK_VISIBILITY_NOTIFY: - ref_push_string(_STR("type")); ref_push_string(_STR("visibility")); + ref_push_string(literal_type_string); ref_push_string(_STR("visibility")); ref_push_string(_STR("state")); push_int( e->visibility.state ); break; case GDK_NO_EXPOSE: - ref_push_string(_STR("type")); ref_push_string(_STR("noexpose")); + ref_push_string(literal_type_string); ref_push_string(_STR("noexpose")); break; case GDK_DRAG_ENTER: - ref_push_string(_STR("type")); ref_push_string(_STR("drag_enter")); + ref_push_string(literal_type_string); ref_push_string(_STR("drag_enter")); goto dnd_event; case GDK_DRAG_LEAVE: - ref_push_string(_STR("type")); ref_push_string(_STR("drag_leave")); + ref_push_string(literal_type_string); ref_push_string(_STR("drag_leave")); goto dnd_event; case GDK_DRAG_MOTION: - ref_push_string(_STR("type")); ref_push_string(_STR("drag_motion")); + ref_push_string(literal_type_string); ref_push_string(_STR("drag_motion")); goto dnd_event; case GDK_DRAG_STATUS: - ref_push_string(_STR("type")); ref_push_string(_STR("drag_status")); + ref_push_string(literal_type_string); ref_push_string(_STR("drag_status")); goto dnd_event; case GDK_DROP_START: - ref_push_string(_STR("type")); ref_push_string(_STR("drop_start")); + ref_push_string(literal_type_string); ref_push_string(_STR("drop_start")); goto dnd_event; case GDK_DROP_FINISHED: - ref_push_string(_STR("type")); ref_push_string(_STR("drop_finished")); + ref_push_string(literal_type_string); ref_push_string(_STR("drop_finished")); dnd_event: ref_push_string(_STR("send_event")); push_int( e->dnd.send_event ); ref_push_string(_STR("x_root")); push_int( e->dnd.x_root ); diff --git a/src/post_modules/GTK2/source/gdkgc.pre b/src/post_modules/GTK2/source/gdkgc.pre index 33e439b7683e0ece41e8366538454b62ea78cfd2..6d65cd831cffe1ffb5818c6ff8451203c794f201 100644 --- a/src/post_modules/GTK2/source/gdkgc.pre +++ b/src/post_modules/GTK2/source/gdkgc.pre @@ -104,7 +104,7 @@ mapping(string:mixed) get_values() g_object_ref(v.clip_mask); ref_push_string(_STR("fill")); push_int(v.fill); - ref_push_string(_STR("function")); push_int(v.function); + ref_push_string(literal_function_string); push_int(v.function); { GdkColor *f,*b; f=g_malloc(sizeof(GdkColor)); diff --git a/src/post_modules/GTK2/source/gobject.pre b/src/post_modules/GTK2/source/gobject.pre index dd869e612eb50d048196940800da3b7a70554d85..8d17548112991685f30e47ce0009edc41d2ff6b2 100644 --- a/src/post_modules/GTK2/source/gobject.pre +++ b/src/post_modules/GTK2/source/gobject.pre @@ -212,13 +212,13 @@ int new_signal(string name, array types, string return_type) } if (is_same_string(ret_type_name,_STR("void"))) { return_type=G_TYPE_NONE; - } else if (is_same_string(ret_type_name,_STR("int"))) { + } else if (ret_type_name == literal_int_string) { return_type=G_TYPE_INT; - } else if (is_same_string(ret_type_name,_STR("float"))) { + } else if (ret_type_name == literal_float_string) { return_type=G_TYPE_DOUBLE; - } else if (is_same_string(ret_type_name,_STR("string"))) { + } else if (ret_type_name == literal_string_string) { return_type=G_TYPE_STRING; - } else if (is_same_string(ret_type_name,_STR("object"))) { + } else if (ret_type_name == literal_object_string) { return_type=G_TYPE_OBJECT; } else { return_type=G_TYPE_POINTER; @@ -233,16 +233,16 @@ int new_signal(string name, array types, string return_type) for (i=n_params=0; i<a->size; i++) { if (TYPEOF(ITEM(a)[i]) != PIKE_T_STRING) continue; - if (is_same_string(ITEM(a)[i].u.string,_STR("int"))) { + if (ITEM(a)[i].u.string == literal_int_string) { param_types[n_params]=G_TYPE_INT; n_params++; - } else if (is_same_string(ITEM(a)[i].u.string,_STR("float"))) { + } else if (ITEM(a)[i].u.string == literal_float_string) { param_types[n_params]=G_TYPE_DOUBLE; n_params++; - } else if (is_same_string(ITEM(a)[i].u.string,_STR("string"))) { + } else if (ITEM(a)[i].u.string == literal_string_string) { param_types[n_params]=G_TYPE_STRING; n_params++; - } else if (is_same_string(ITEM(a)[i].u.string,_STR("object"))) { + } else if (ITEM(a)[i].u.string == literal_object_string) { param_types[n_params]=G_TYPE_OBJECT; n_params++; } else { diff --git a/src/post_modules/GTK2/source/gtkliststore.pre b/src/post_modules/GTK2/source/gtkliststore.pre index 11a4a674c2003308c0e079d0c14a88d06212114d..90d7b32375a6ab83ce4532a08d5ab8aba22303f2 100644 --- a/src/post_modules/GTK2/source/gtkliststore.pre +++ b/src/post_modules/GTK2/source/gtkliststore.pre @@ -38,11 +38,11 @@ void create(array(mixed) types) for (i=sd->n_cols=0; i<a->size; i++) { if (TYPEOF(ITEM(a)[i]) == PIKE_T_STRING) { const struct pike_string *str = (ITEM(a)+i)->u.string; - if (is_same_string(_STR("int"),str)) + if (str == literal_int_string) sd->types[sd->n_cols++]=G_TYPE_INT; else if (is_same_string(_STR("uint"),str)) sd->types[sd->n_cols++]=G_TYPE_UINT; - else if (is_same_string(_STR("float"),str)) + else if (str == literal_float_string) sd->types[sd->n_cols++]=G_TYPE_FLOAT; else if (is_same_string(_STR("double"),str)) sd->types[sd->n_cols++]=G_TYPE_DOUBLE; @@ -52,13 +52,13 @@ void create(array(mixed) types) sd->types[sd->n_cols++]=G_TYPE_LONG; else if (is_same_string(_STR("ulong"),str)) sd->types[sd->n_cols++]=G_TYPE_ULONG; - else if (is_same_string(_STR("string"),str)) + else if (str == literal_string_string) sd->types[sd->n_cols++]=G_TYPE_STRING; else if (is_same_string(_STR("char"),str)) sd->types[sd->n_cols++]=G_TYPE_CHAR; else if (is_same_string(_STR("uchar"),str)) sd->types[sd->n_cols++]=G_TYPE_UCHAR; - else if (is_same_string(_STR("object"),str)) { + else if (str == literal_object_string) { sd->types[sd->n_cols++]=G_TYPE_POINTER; } else { sd->types[sd->n_cols]=g_type_from_name(CGSTR0((ITEM(a)+i)->u.string)); diff --git a/src/post_modules/GTK2/source/gtktreestore.pre b/src/post_modules/GTK2/source/gtktreestore.pre index 3919e5e8b66affc188c3e327f1484247716162e1..2a97652be0bc48232d912f230eb0585a455d0f96 100644 --- a/src/post_modules/GTK2/source/gtktreestore.pre +++ b/src/post_modules/GTK2/source/gtktreestore.pre @@ -39,11 +39,11 @@ void create(array(mixed) types) for (i=sd->n_cols=0; i<a->size; i++) { if (TYPEOF(ITEM(a)[i]) == PIKE_T_STRING) { const struct pike_string *str = (ITEM(a)+i)->u.string; - if (is_same_string(_STR("int"),str)) { + if (str == literal_int_string) { sd->types[sd->n_cols++]=G_TYPE_INT; } else if (is_same_string(_STR("uint"),str)) { sd->types[sd->n_cols++]=G_TYPE_UINT; - } else if (is_same_string(_STR("float"),str)) { + } else if (str == literal_float_string) { sd->types[sd->n_cols++]=G_TYPE_FLOAT; } else if (is_same_string(_STR("double"),str)) { sd->types[sd->n_cols++]=G_TYPE_DOUBLE; @@ -53,13 +53,13 @@ void create(array(mixed) types) sd->types[sd->n_cols++]=G_TYPE_LONG; } else if (is_same_string(_STR("ulong"),str)) { sd->types[sd->n_cols++]=G_TYPE_ULONG; - } else if (is_same_string(_STR("string"),str)) { + } else if (str == literal_string_string) { sd->types[sd->n_cols++]=G_TYPE_STRING; } else if (is_same_string(_STR("char"),str)) { sd->types[sd->n_cols++]=G_TYPE_CHAR; } else if (is_same_string(_STR("uchar"),str)) { sd->types[sd->n_cols++]=G_TYPE_UCHAR; - } else if (is_same_string(_STR("object"),str)) { + } else if (str == literal_object_string) { sd->types[sd->n_cols++]=G_TYPE_POINTER; } else { sd->types[sd->n_cols]=g_type_from_name(CGSTR0((ITEM(a)+i)->u.string)); diff --git a/src/post_modules/GTK2/source/support.c b/src/post_modules/GTK2/source/support.c index 35ac6e34d9bdd33296afbb821946175ec517ac66..be7659c925b6e1c92d14d70e820e584d548f5413 100644 --- a/src/post_modules/GTK2/source/support.c +++ b/src/post_modules/GTK2/source/support.c @@ -889,7 +889,7 @@ double pgtk2_get_float(struct svalue *s) { #ifdef AUTO_BIGNUM if (is_bignum_object_in_svalue(s)) { FLOAT_TYPE f; - push_text("float"); + ref_push_string(literal_float_string); apply(s->u.object,"cast",1); f=Pike_sp[-1].u.float_number; pop_stack(); diff --git a/src/post_modules/SQLite/sqlite.cmod b/src/post_modules/SQLite/sqlite.cmod index 551dd0574d53e2e78d601d20d34c0f51d04f4fb2..4c82ef606304a7d113d2fc89d45834a90db94190 100644 --- a/src/post_modules/SQLite/sqlite.cmod +++ b/src/post_modules/SQLite/sqlite.cmod @@ -214,7 +214,7 @@ PIKECLASS ResObj push_constant_text("name"); push_text(sqlite3_column_name(THIS->stmt, i)); f_utf8_to_string(1); - push_constant_text("type"); + ref_push_string(literal_type_string); t = sqlite3_column_type(THIS->stmt, i); switch(t) { @@ -222,7 +222,7 @@ PIKECLASS ResObj push_constant_text("integer"); break; case SQLITE_FLOAT: - push_constant_text("float"); + ref_push_string(literal_float_string); break; case SQLITE_BLOB: push_constant_text("blob"); diff --git a/src/post_modules/_Image_SVG/svg.c b/src/post_modules/_Image_SVG/svg.c index a776d966e4edcb98dcbd548641621ee6b1b1db6c..502eab51866521ead20f546104c6bbae07583f88 100644 --- a/src/post_modules/_Image_SVG/svg.c +++ b/src/post_modules/_Image_SVG/svg.c @@ -163,7 +163,7 @@ static void low__decode( INT32 args, int header_only ) push_text( "xsize" ); push_int( xs ); push_text( "ysize" ); push_int( ys ); - push_text( "type" ); push_text( "image/svg"); + ref_push_string( literal_type_string ); push_text( "image/svg"); if( !header_only ) { push_text( "Image.Image" ); diff --git a/src/post_modules/_PGsql/PGsql.cmod b/src/post_modules/_PGsql/PGsql.cmod index f568f32eca1d9b0cac9e22d9d9217c607f9f2314..7c6cd8b1ff4250c7c54da3316036a916161e0e02 100644 --- a/src/post_modules/_PGsql/PGsql.cmod +++ b/src/post_modules/_PGsql/PGsql.cmod @@ -17,6 +17,7 @@ #include "fdlib.h" #include "dmalloc.h" #include "bignum.h" +#include "pike_types.h" #include <stdio.h> #include <stdlib.h> @@ -376,7 +377,7 @@ outofmem: Pike_fatal("Out of memory\n"); msglen-=collen; array_index_no_free(&drd,datarowdesc,i); typ = low_mapping_string_lookup(drd.u.mapping, - MK_STRING("type"))->u.integer; + literal_type_string)->u.integer; free_svalue(&drd); switch(typ) { case FLOAT4OID: