pike.git / src / post_modules / GTK2 / source / support.c

version» Context lines:

pike.git/src/post_modules/GTK2/source/support.c:63:      void pgtk2_get_image_module() {    push_constant_text("Image");    SAFE_APPLY_MASTER("resolv_or_error",1);   }      void pgtk2_index_stack(char *what) {    push_text(what);    f_index(2);   #ifdef PIKE_DEBUG -  if (Pike_sp[-1].type==PIKE_T_INT) +  if (TYPEOF(Pike_sp[-1]) == PIKE_T_INT)    Pike_error("Internal indexing error.\n");   #endif   }      int get_color_from_pikecolor(struct object *o, INT_TYPE *r, INT_TYPE *g, INT_TYPE *b) {    struct color_struct *col;    col=(struct color_struct *)get_storage(o,image_color_program);    if (!col)    return 0;    *r=col->rgbl.r/(COLORLMAX/65535);
pike.git/src/post_modules/GTK2/source/support.c:236:    }    push_int(pad); /* extra padding.. */    }    push_int(i->depth);    add_ref(pike_cmap);    push_object(pike_cmap);    /* on stack: function img bpp linepad depth cmap*/    /* 6 5 4 3 2 1 */    PFTIME("Dithering image");    apply_svalue(Pike_sp-6,5); -  if (Pike_sp[-1].type!=PIKE_T_STRING) { +  if (TYPEOF(Pike_sp[-1]) != PIKE_T_STRING) {    gdk_image_destroy((void *)i);    Pike_error("Failed to convert image\n");    }    PFTIME("Converting image");    MEMCPY(i->mem,Pike_sp[-1].u.string->str,Pike_sp[-1].u.string->len);    pop_stack(); /* string */    pop_stack(); /* function */    }    }    TIMER_END();
pike.git/src/post_modules/GTK2/source/support.c:336:    o->refs++;   /* gtk_object_set_data_full(go,"pike_object",(void*)o, (void*)pgtk2_destruct); */    g_object_set_data_full(G_OBJECT(go),"pike_object",(void *)o,(void *)pgtk2_destruct);   }      void pgtk2_get_mapping_arg(struct mapping *map,    char *name, int type, int madd,    void *dest, long *mask, int len) {    struct svalue *s;    if ((s=simple_mapping_string_lookup(map,name))) { -  if (s->type==type) { +  if (TYPEOF(*s) == type) {    switch(type) {    case PIKE_T_STRING:   #ifdef PIKE_DEBUG    if (len!=sizeof(char *))    Pike_fatal("oddities detected\n");   #endif    MEMCPY(((char **)dest),&s->u.string->str,sizeof(char *));    break;    case PIKE_T_INT:    if (len==2) {
pike.git/src/post_modules/GTK2/source/support.c:814:      void pgtk2_free_str(gchar *s) {    g_free(s);   }      void pgtk2_get_string_arg_with_sprintf( INT32 args )   {    if( args < 1 )    Pike_error("Too few arguments, %d required, got %d\n", 1, args);    -  if( Pike_sp[-args].type != PIKE_T_STRING ) +  if( TYPEOF(Pike_sp[-args]) != PIKE_T_STRING )    Pike_error("Illegal argument %d, expected string\n", 0);       if( args > 1 )    f_sprintf(args);       f_string_to_utf8(1);   }      void pgtk2_default__sprintf(int args, int offset, int len) {    int mode = 0; -  if (args>0 && Pike_sp[-args].type==PIKE_T_INT) +  if (args>0 && TYPEOF(Pike_sp[-args]) == PIKE_T_INT)    mode=Pike_sp[-args].u.integer;    pgtk2_pop_n_elems(args);    if (mode!='O') {    push_undefined();    return;    }    push_string(make_shared_binary_string(__pgtk2_string_data+offset,len));   }      void pgtk2_clear_obj_struct(struct object *o) {
pike.git/src/post_modules/GTK2/source/support.c:848:      void pgtk2_setup_mixin(struct object *o, struct program *p) {    ptrdiff_t offset;    offset = low_get_storage(o->prog, p);    if(offset == -1)    Pike_error("This class can not be instantiated on its own.\n");    ((struct mixin_wrapper *)Pike_fp->current_storage)->offset = offset;   }      LONGEST pgtk2_get_int(struct svalue *s) { -  if (s->type==PIKE_T_INT) +  if (TYPEOF(*s) == PIKE_T_INT)    return s->u.integer;   #ifdef AUTO_BIGNUM    if (is_bignum_object_in_svalue(s)) {    LONGEST res;    int64_from_bignum(&res,s->u.object);    return res;    }   #endif -  if (s->type==PIKE_T_FLOAT) +  if (TYPEOF(*s) == PIKE_T_FLOAT)    return (LONGEST)s->u.float_number;    return 0;   }      int pgtk2_is_int(struct svalue *s) { -  return ((s->type==PIKE_T_INT) || -  (s->type==PIKE_T_FLOAT) +  return ((TYPEOF(*s) == PIKE_T_INT) || +  (TYPEOF(*s) == PIKE_T_FLOAT)   #ifdef AUTO_BIGNUM    || is_bignum_object_in_svalue(s)   #endif    );   }      /* double should be enough */   double pgtk2_get_float(struct svalue *s) { -  if (s->type==PIKE_T_FLOAT) +  if (TYPEOF(*s) == PIKE_T_FLOAT)    return s->u.float_number; -  if (s->type==PIKE_T_INT) +  if (TYPEOF(*s) == PIKE_T_INT)    return (double)s->u.integer;   #ifdef AUTO_BIGNUM    if (is_bignum_object_in_svalue(s)) {    FLOAT_TYPE f;    push_text("float");    apply(s->u.object,"cast",1);    f=Pike_sp[-1].u.float_number;    pop_stack();    return (double)f;    }   #endif    return 0.0;   }      void pgtk2_free_object(struct object *o) {    free_object(o);   }      int pgtk2_is_float(struct svalue *s) { -  return ((s->type==PIKE_T_FLOAT) || -  (s->type==PIKE_T_INT) +  return ((TYPEOF(*s) == PIKE_T_FLOAT) || +  (TYPEOF(*s) == PIKE_T_INT)   #ifdef AUTO_BIGNUM    || is_bignum_object_in_svalue(s)   #endif    );   }      void pgtk2_set_property(GObject *g, char *prop, struct svalue *sv) {    GParamSpec *gps;    GType v;    gps=g_object_class_find_property(G_OBJECT_GET_CLASS(g),prop);
pike.git/src/post_modules/GTK2/source/support.c:921:   /*    if (gps->value_type==PANGO_TYPE_STYLE ||    gps->value_type==GTK_TYPE_WRAP_MODE ||    gps->value_type==GTK_TYPE_JUSTIFICATION ||    gps->value_type==PANGO_TYPE_UNDERLINE ||    gps->value_type==GTK_TYPE_TEXT_DIRECTION) {    g_object_set(g,prop,PGTK_GETINT(sv),NULL);    return;    }   */ -  if (sv->type==PIKE_T_OBJECT) { +  if (TYPEOF(*sv) == PIKE_T_OBJECT) {    GObject *go=get_gobject(sv->u.object);    if (go && G_IS_OBJECT(go)) {    if (gps->value_type==GDK_TYPE_PIXMAP || gps->value_type==GTK_TYPE_WIDGET)    g_object_set(g,prop,go,NULL);    return;    }    }   #define do_type(X) do { X i=PGTK_GETINT(sv); g_object_set(g,prop,i,NULL); } while(0)    switch (gps->value_type) {    case G_TYPE_INT:
pike.git/src/post_modules/GTK2/source/support.c:1169:    return;    }   /* if (G_TYPE_IS_OBJECT(gt)) { */    if (G_TYPE_IS_OBJECT(gt) ||   #ifdef HAVE_GTK22    gt==GDK_TYPE_DISPLAY || gt==GDK_TYPE_SCREEN ||   #endif    gt==GDK_TYPE_PIXBUF || gt==GDK_TYPE_PIXMAP || gt==GDK_TYPE_IMAGE ||    gt==GDK_TYPE_WINDOW || gt==GDK_TYPE_VISUAL ||    gt==GDK_TYPE_DRAWABLE || gt==GDK_TYPE_GC) { -  if (sv->type==PIKE_T_OBJECT) { +  if (TYPEOF(*sv) == PIKE_T_OBJECT) {    GObject *go;    go=get_gobject(sv->u.object);    if (go && G_IS_OBJECT(go))    g_value_set_object(gv,go);    return;    }    }    if (gt==GDK_TYPE_COLOR) { -  if (sv->type==PIKE_T_OBJECT && get_gdkobject(sv->u.object,color)) +  if (TYPEOF(*sv) == PIKE_T_OBJECT && get_gdkobject(sv->u.object,color))    g_value_set_boxed(gv,get_gdkobject(sv->u.object,color));    return;    }    if (gt==GDK_TYPE_RECTANGLE) { -  if (sv->type==PIKE_T_OBJECT && get_gdkobject(sv->u.object,rectangle)) +  if (TYPEOF(*sv) == PIKE_T_OBJECT && get_gdkobject(sv->u.object,rectangle))    g_value_set_boxed(gv,get_gdkobject(sv->u.object,rectangle));    return;    }    switch (gt) {    case G_TYPE_INT:    g_value_set_int(gv,(gint)PGTK_GETINT(sv));    break;    case G_TYPE_UINT:    g_value_set_uint(gv,(guint)PGTK_GETINT(sv));    break;
pike.git/src/post_modules/GTK2/source/support.c:1228:    case G_TYPE_BOOLEAN:    g_value_set_boolean(gv,(gboolean)PGTK_GETINT(sv));    break;    case G_TYPE_FLOAT:    g_value_set_float(gv,(gfloat)pgtk2_get_float(sv));    break;    case G_TYPE_DOUBLE:    g_value_set_double(gv,(gdouble)pgtk2_get_float(sv));    break;    case G_TYPE_STRING: -  if (sv->type==PIKE_T_STRING) +  if (TYPEOF(*sv) == PIKE_T_STRING)    {    push_svalue( sv );    f_string_to_utf8(1);    g_value_set_string(gv,CGSTR0(Pike_sp[-1].u.string));    pop_stack();    } else    g_value_set_string(gv,"");    break;    case G_TYPE_OBJECT: -  if (sv->type==PIKE_T_OBJECT) { +  if (TYPEOF(*sv) == PIKE_T_OBJECT) {    GObject *go=get_gobject(sv->u.object);    if (go && G_IS_OBJECT(go))    g_value_set_object(gv,go);    else    g_value_set_object(gv,NULL);    } else    g_value_set_object(gv,NULL);    break;    case G_TYPE_POINTER: -  if (sv->type==PIKE_T_OBJECT) { +  if (TYPEOF(*sv) == PIKE_T_OBJECT) {    g_value_set_pointer(gv,sv->u.object);    add_ref(sv->u.object);    } else    g_value_set_pointer(gv,NULL);    break;    case 0: // void    break;    default:    Pike_error("Unable to handle type %d - %s.\n",gt,g_type_name(gt) ?g_type_name(gt): "unnamed" );    }
pike.git/src/post_modules/GTK2/source/support.c:1289:    GParameter *params;    struct keypair *k;    int e;    int i=0,j;       class=g_type_class_ref(type);    if (class==NULL)    Pike_error("Could not get a reference to type %s.\n",g_type_name(type));    params=g_new0(GParameter,m_sizeof(m));    NEW_MAPPING_LOOP(m->data) { -  if (k->ind.type==PIKE_T_STRING) { +  if (TYPEOF(k->ind) == PIKE_T_STRING) {    gchar *s=PGTK_GETSTR(&k->ind);    pspec=g_object_class_find_property(class,s);    if (!pspec) {    PGTK_FREESTR(s);    continue;    }   /* g_value_init(&params[i].value,G_PARAM_SPEC_VALUE_TYPE(pspec)); */    pgtk2_set_gvalue(&params[i].value,G_PARAM_SPEC_VALUE_TYPE(pspec),&k->val);    params[i++].name=s;    }