pike.git / src / post_modules / GI / gi.cmod

version» Context lines:

pike.git/src/post_modules/GI/gi.cmod:29:   static void throw_gerror(GError *error)   {    Pike_error("%s\n", error->message);   }      static void free_glist_full_free(void *p)   {    g_list_free_full(p, free);   }    - struct GBoxed_struct; + struct GI_GBoxed_struct;   static void push_gi_info(GIBaseInfo *info);   static GObject *make_gobject_from_props(struct object *info, struct mapping *props); - static void make_gboxed(struct GBoxed_struct *this, struct object *info, gboolean allocate); + static void make_gboxed(struct GI_GBoxed_struct *this, struct object *info, gboolean allocate);   static void push_gvalue(const GValue *v);   static void set_gvalue_from_svalue(GValue *v, const struct svalue *s);      struct signal_data {    struct svalue cb;    struct svalue extra_args;   };      static void free_signal_data(struct signal_data *s, GClosure *gcl)   {
pike.git/src/post_modules/GI/gi.cmod:343:    Pike_error("Received an object of an unregistered type!\n");    APPLY_MASTER ("resolv", 1);    if (TYPEOF(Pike_sp[-1]) != T_OBJECT)    Pike_error("Failed to resolve GI object class.\n");    ref_push_mapping(magic_mapping);    apply(Pike_sp[-2].u.object, "Instance", 1);    stack_pop_keep_top();    if (TYPEOF(Pike_sp[-1]) != T_OBJECT)    Pike_error("Failed to instantiate GI object class.\n");    { -  struct GObject_struct *that = -  (struct GObject_struct *)get_storage ((obj = Pike_sp[-1].u.object), -  GObject_program); +  struct GI_GObject_struct *that = +  (struct GI_GObject_struct *)get_storage ((obj = Pike_sp[-1].u.object), +  GI_GObject_program);    if (that == NULL)    Pike_error("No storage for GObject!\n");    if (that->obj != NULL)    Pike_error("GObject already initialized!\n");    g_object_ref ((that->obj = gobj));    g_object_set_qdata(that->obj, object_quark, obj);    }    } else    ref_push_object(obj);    }
pike.git/src/post_modules/GI/gi.cmod:381:    Pike_error("Received a box of an unregistered type!\n");    }    APPLY_MASTER ("resolv", 1);    if (TYPEOF(Pike_sp[-1]) != T_OBJECT)    Pike_error("Failed to resolve GI box class.\n");    ref_push_mapping(magic_mapping);    apply(Pike_sp[-2].u.object, "Instance", 1);    if (TYPEOF(Pike_sp[-1]) != T_OBJECT)    Pike_error("Failed to instantiate GI box class.\n");    { -  struct GBoxed_struct *that = -  (struct GBoxed_struct *)get_storage (Pike_sp[-1].u.object, -  GBoxed_program); +  struct GI_GBoxed_struct *that = +  (struct GI_GBoxed_struct *)get_storage (Pike_sp[-1].u.object, +  GI_GBoxed_program);    if (that == NULL)    Pike_error("No storage for GBoxed!\n");    if (that->box != NULL)    Pike_error("GBoxed already initialized!\n");    that->box = gbox;    }    }   }      static void push_gi_argument_interface(GIArgument *arg, GIBaseInfo *info)
pike.git/src/post_modules/GI/gi.cmod:521:    break;       case GI_INFO_TYPE_OBJECT:    if (UNSAFE_IS_ZERO(s)) {    arg->v_pointer = NULL;    break;    }    if (TYPEOF(*s) != T_OBJECT)    Pike_error("object expected\n");    else { -  struct GObject_struct *that = -  (struct GObject_struct *)get_storage (s->u.object, GObject_program); +  struct GI_GObject_struct *that = +  (struct GI_GObject_struct *)get_storage (s->u.object, GI_GObject_program);    if (that == NULL)    Pike_error("argument is not a GObject\n");    if (that->obj == NULL ||    !g_type_is_a(G_OBJECT_TYPE(that->obj),    g_registered_type_info_get_g_type(info)))    Pike_error("Object is not a %s\n",    g_base_info_get_name(info));    arg->v_pointer = that->obj;    }    break;       case GI_INFO_TYPE_STRUCT:    if (UNSAFE_IS_ZERO(s)) {    arg->v_pointer = NULL;    break;    }    if (TYPEOF(*s) != T_OBJECT)    Pike_error("object expected\n");    else { -  struct GBoxed_struct *that = -  (struct GBoxed_struct *)get_storage (s->u.object, GBoxed_program); +  struct GI_GBoxed_struct *that = +  (struct GI_GBoxed_struct *)get_storage (s->u.object, GI_GBoxed_program);    if (that == NULL)    Pike_error("argument is not a GBoxed\n");    if (that->box == NULL ||    !g_type_is_a(that->type,    g_registered_type_info_get_g_type(info)))    Pike_error("Object is not a %s\n",    g_base_info_get_name(info));    arg->v_pointer = that->box;    }    break;
pike.git/src/post_modules/GI/gi.cmod:829:    NULL);    GIArgument out_arg_0, *out_args = (num_args? in_args+num_args+1 : NULL);    SET_ONERROR(onerror, free, in_args);    if (flags & GI_FUNCTION_IS_METHOD) {    if (args < 1 || TYPEOF(*mark) != T_OBJECT)    Pike_error("Missing object for method call\n");    else {    GIBaseInfo *cont = g_base_info_get_container(THIS->info);    if (g_base_info_get_type(cont) == GI_INFO_TYPE_OBJECT ||    g_base_info_get_type(cont) == GI_INFO_TYPE_INTERFACE) { -  struct GObject_struct *that = -  (struct GObject_struct *)get_storage (mark->u.object, -  GObject_program); +  struct GI_GObject_struct *that = +  (struct GI_GObject_struct *)get_storage (mark->u.object, +  GI_GObject_program);    if (that == NULL)    Pike_error("Instance argument is not a GObject\n");    if (that->obj == NULL ||    !g_type_is_a(G_OBJECT_TYPE(that->obj),    g_registered_type_info_get_g_type(cont)))    Pike_error("Object is not a %s\n",    g_base_info_get_name(cont));    in_args[0].v_pointer = that->obj;    } else { -  struct GBoxed_struct *that = -  (struct GBoxed_struct *)get_storage (mark->u.object, -  GBoxed_program); +  struct GI_GBoxed_struct *that = +  (struct GI_GBoxed_struct *)get_storage (mark->u.object, +  GI_GBoxed_program);    if (that == NULL)    Pike_error("Instance argument is not a GBoxed\n");    if (that->box == NULL ||    !g_type_is_a(that->type,    g_registered_type_info_get_g_type(cont)))    Pike_error("Boxed is not a %s\n",    g_base_info_get_name(cont));    in_args[0].v_pointer = that->box;    }    i++;
pike.git/src/post_modules/GI/gi.cmod:943:    INHERIT BaseInfo;       /*! @decl mixed get_field(GBoxed box)    */    PIKEFUN mixed get_field(GBoxed box)    {    ONERROR onerror;    GIArgument value;    GITypeInfo *ti;    GIBaseInfo *sinfo = g_base_info_get_container(THIS->info); -  struct GBoxed_struct *that = -  (struct GBoxed_struct *)get_storage (box, GBoxed_program); +  struct GI_GBoxed_struct *that = +  (struct GI_GBoxed_struct *)get_storage (box, GI_GBoxed_program);    if (that == NULL)    Pike_error("argument is not a GBoxed\n");    if (that->box == NULL ||    !g_type_is_a(that->type,    g_registered_type_info_get_g_type(sinfo)))    Pike_error("Boxed is not a %s\n",    g_base_info_get_name(sinfo));    ti = g_field_info_get_type((GIFieldInfo *)THIS->info);    SET_ONERROR(onerror, g_base_info_unref, ti);    if (!g_field_info_get_field((GIFieldInfo *)THIS->info, that->box, &value))
pike.git/src/post_modules/GI/gi.cmod:970:    }       /*! @decl void set_field(GBoxed box, mixed value)    */    PIKEFUN void set_field(GBoxed box, mixed value)    {    ONERROR onerror;    GIArgument val;    GITypeInfo *ti;    GIBaseInfo *sinfo = g_base_info_get_container(THIS->info); -  struct GBoxed_struct *that = -  (struct GBoxed_struct *)get_storage (box, GBoxed_program); +  struct GI_GBoxed_struct *that = +  (struct GI_GBoxed_struct *)get_storage (box, GI_GBoxed_program);    if (that == NULL)    Pike_error("argument is not a GBoxed\n");    if (that->box == NULL ||    !g_type_is_a(that->type,    g_registered_type_info_get_g_type(sinfo)))    Pike_error("Boxed is not a %s\n",    g_base_info_get_name(sinfo));    ti = g_field_info_get_type((GIFieldInfo *)THIS->info);    SET_ONERROR(onerror, g_base_info_unref, ti);    get_gi_argument_type(value, &val, ti);
pike.git/src/post_modules/GI/gi.cmod:1261:   }         static void push_gi_info(GIBaseInfo *info)   {    struct program *p;    if (info == NULL)    Pike_error("Missing info\n");    switch(g_base_info_get_type(info)) {    case GI_INFO_TYPE_FUNCTION: -  p = FunctionInfo_program; break; +  p = GI_FunctionInfo_program; break;    case GI_INFO_TYPE_CALLBACK: -  p = CallbackInfo_program; break; +  p = GI_CallbackInfo_program; break;    case GI_INFO_TYPE_STRUCT: -  p = StructInfo_program; break; +  p = GI_StructInfo_program; break;    case GI_INFO_TYPE_ENUM:    case GI_INFO_TYPE_FLAGS: -  p = EnumInfo_program; break; +  p = GI_EnumInfo_program; break;    case GI_INFO_TYPE_OBJECT: -  p = ObjectInfo_program; break; +  p = GI_ObjectInfo_program; break;    case GI_INFO_TYPE_INTERFACE: -  p = InterfaceInfo_program; break; +  p = GI_InterfaceInfo_program; break;    case GI_INFO_TYPE_CONSTANT: -  p = ConstantInfo_program; break; +  p = GI_ConstantInfo_program; break;    case GI_INFO_TYPE_UNION: -  p = UnionInfo_program; break; +  p = GI_UnionInfo_program; break;    case GI_INFO_TYPE_VALUE: -  p = ValueInfo_program; break; +  p = GI_ValueInfo_program; break;    case GI_INFO_TYPE_FIELD: -  p = FieldInfo_program; break; +  p = GI_FieldInfo_program; break;    default:    Pike_error("No class for %d\n", g_base_info_get_type(info));    }    {    struct object *o = clone_object(p, 0); -  struct BaseInfo_struct *that = -  (struct BaseInfo_struct *)get_storage (o, BaseInfo_program); +  struct GI_BaseInfo_struct *that = +  (struct GI_BaseInfo_struct *)get_storage (o, GI_BaseInfo_program);    that->info = g_base_info_ref(info);    push_object(o);    }   }      static void push_gvalue(const GValue *v)   {    GType gt = G_VALUE_TYPE(v);    switch(G_TYPE_FUNDAMENTAL(gt)) {   
pike.git/src/post_modules/GI/gi.cmod:1472:    break;       case G_TYPE_OBJECT:    if (UNSAFE_IS_ZERO(s)) {    g_value_set_object(v, NULL);    break;    }    if (TYPEOF(*s) != T_OBJECT)    Pike_error("object expected\n");    else { -  struct GObject_struct *that = -  (struct GObject_struct *)get_storage (s->u.object, GObject_program); +  struct GI_GObject_struct *that = +  (struct GI_GObject_struct *)get_storage (s->u.object, GI_GObject_program);    if (that == NULL)    Pike_error("argument is not a GObject\n");    if (that->obj == NULL ||    !g_type_is_a(G_OBJECT_TYPE(that->obj), gt)) {    const gchar *tn = g_type_name(gt);    if (tn)    Pike_error("Object is not a %s\n", tn);    else    Pike_error("Object is not of the correct type\n");    }
pike.git/src/post_modules/GI/gi.cmod:1563:    }    g_free(params);    gpl->params = NULL;    }   }      static GObject *make_gobject_from_props(struct object *info, struct mapping *props)   {    ONERROR onerror;    GIObjectInfo *ginfo; -  struct BaseInfo_struct *that; +  struct GI_BaseInfo_struct *that;    GType gt;    GObject *obj;    struct gparams_list params = { 0, NULL };    if (info == NULL ||    (that = -  (struct BaseInfo_struct *)get_storage (info, BaseInfo_program)) +  (struct GI_BaseInfo_struct *)get_storage (info, GI_BaseInfo_program))    == NULL || that->info == NULL)    Pike_error("ObjectInfo missing\n");    ginfo = (GIObjectInfo *)that->info;    gt = g_registered_type_info_get_g_type((GIRegisteredTypeInfo *)ginfo);    if (gt == G_TYPE_NONE)    Pike_error("Failed to get GType\n");    if (props != NULL && m_sizeof(props) > 0) {    params.nparam = m_sizeof(props);    params.params = g_new0(GParameter, params.nparam);    SET_ONERROR(onerror, low_free_gparams, &params);
pike.git/src/post_modules/GI/gi.cmod:1595:    Pike_error("Failed to create GObject\n");    if (params.params != NULL) {    UNSET_ONERROR(onerror);    low_free_gparams(&params);    }    if (G_IS_INITIALLY_UNOWNED(obj))    g_object_ref_sink(obj);    return obj;   }    - static void make_gboxed(struct GBoxed_struct *this, struct object *info, gboolean allocate) + static void make_gboxed(struct GI_GBoxed_struct *this, struct object *info, gboolean allocate)   { -  struct BaseInfo_struct *that; +  struct GI_BaseInfo_struct *that;    if (info == NULL ||    (that = -  (struct BaseInfo_struct *)get_storage (info, BaseInfo_program)) +  (struct GI_BaseInfo_struct *)get_storage (info, GI_BaseInfo_program))    == NULL || that->info == NULL)    Pike_error("StructInfo missing\n");    this->type = g_registered_type_info_get_g_type(that->info);    if (allocate) {    if ((this->allocated_size = get_interface_size(that->info)))    this->box = g_slice_alloc0(this->allocated_size);    }   }      
pike.git/src/post_modules/GI/gi.cmod:1730:   /*! @endclass    */      /*! @decl Repository get_default_repository()    */      PIKEFUN Repository get_default_repository()   {    static struct object *default_repository = NULL;    if (default_repository == NULL) { -  struct object *o = clone_object(Repository_program, 0); -  struct Repository_struct *that = -  (struct Repository_struct *)get_storage (o, Repository_program); +  struct object *o = clone_object(GI_Repository_program, 0); +  struct GI_Repository_struct *that = +  (struct GI_Repository_struct *)get_storage (o, GI_Repository_program);    that->repository = g_irepository_get_default();    default_repository = o;    }    ref_push_object(default_repository);   }      /*! @endmodule    */      #endif