perl-Glib r1075 - trunk
- From: tsch svn gnome org
- To: svn-commits-list gnome org
- Subject: perl-Glib r1075 - trunk
- Date: Thu, 5 Feb 2009 14:22:53 +0000 (UTC)
Author: tsch
Date: Thu Feb 5 14:22:53 2009
New Revision: 1075
URL: http://svn.gnome.org/viewvc/perl-Glib?rev=1075&view=rev
Log:
Fix indentation whitespace.
Modified:
trunk/GType.xs
Modified: trunk/GType.xs
==============================================================================
--- trunk/GType.xs (original)
+++ trunk/GType.xs Thu Feb 5 14:22:53 2009
@@ -425,13 +425,13 @@
while (vals && vals->value_nick && vals->value_name) {
if (gperl_str_eq (val_p, vals->value_name) ||
gperl_str_eq (val_p, vals->value_nick)) {
- *val = vals->value;
- return TRUE;
+ *val = vals->value;
+ return TRUE;
}
vals++;
}
- return FALSE;
+ return FALSE;
}
=item gint gperl_convert_flag_one (GType type, const char * val)
@@ -479,7 +479,7 @@
SV * val)
{
if (SvROK (val) && sv_derived_from (val, "Glib::Flags"))
- return SvIV (SvRV (val));
+ return SvIV (SvRV (val));
if (gperl_sv_is_array_ref (val)) {
AV* vals = (AV*) SvRV(val);
gint value = 0;
@@ -505,9 +505,9 @@
AV * flags = newAV ();
while (vals && vals->value_nick && vals->value_name) {
if ((val & vals->value) == vals->value) {
- val -= vals->value;
+ val -= vals->value;
av_push (flags, newSVpv (vals->value_nick, 0));
- }
+ }
vals++;
}
return newRV_noinc ((SV*) flags);
@@ -527,13 +527,13 @@
if (package) {
return sv_bless (newRV_noinc (newSViv (val)), gv_stashpv (package, TRUE));
- } else {
- /* return as non-blessed array, and warn. */
- warn ("GFlags %s has no registered perl package, returning as array",
- g_type_name (type));
+ } else {
+ /* return as non-blessed array, and warn. */
+ warn ("GFlags %s has no registered perl package, returning as array",
+ g_type_name (type));
return flags_as_arrayref (type, val);
- }
+ }
}
=back
@@ -944,8 +944,8 @@
gchar * tmp;
SV * method_name;
STRLEN i;
- HV *stash;
- SV **slot;
+ HV *stash;
+ SV **slot;
/* see GClosure.xs and gperl_marshal.h for an explanation. we can't
* use that code because this is a different style of closure, but we
* need to emulate it very closely. */
@@ -973,12 +973,12 @@
if (*tmp == '-') *tmp = '_';
stash = gperl_object_stash_from_type (query.itype);
- assert (stash);
+ assert (stash);
tmp = SvPV (method_name, i);
- slot = hv_fetch (stash, tmp, i, 0);
+ slot = hv_fetch (stash, tmp, i, 0);
- /* does the function exist? then call it. */
- if (slot && GvCV (*slot)) {
+ /* does the function exist? then call it. */
+ if (slot && GvCV (*slot)) {
SV * save_errsv;
int flags;
dSP;
@@ -1427,11 +1427,11 @@
add_properties (GType instance_type, AV * properties)
{
GObjectClass *oclass;
- int propid;
+ int propid;
oclass = g_type_class_ref (instance_type);
- for (propid = 0; propid <= av_len (properties); propid++) {
+ for (propid = 0; propid <= av_len (properties); propid++) {
SV * sv = *av_fetch (properties, propid, 1);
GParamSpec * pspec = NULL;
if (sv_derived_from (sv, "Glib::ParamSpec"))
@@ -1498,19 +1498,19 @@
slot = hv_fetch (stash, "_INSTALL_OVERRIDES",
sizeof ("_INSTALL_OVERRIDES") - 1,
FALSE);
- if (slot && GvCV (*slot)) {
- dSP;
- ENTER;
- SAVETMPS;
- PUSHMARK (SP);
+ if (slot && GvCV (*slot)) {
+ dSP;
+ ENTER;
+ SAVETMPS;
+ PUSHMARK (SP);
if (!name)
name = gperl_object_package_from_type (type);
- XPUSHs (sv_2mortal (newSVpv (name, PL_na)));
- PUTBACK;
- call_sv ((SV *)GvCV (*slot), G_VOID|G_DISCARD);
- FREETMPS;
- LEAVE;
- }
+ XPUSHs (sv_2mortal (newSVpv (name, PL_na)));
+ PUTBACK;
+ call_sv ((SV *)GvCV (*slot), G_VOID|G_DISCARD);
+ FREETMPS;
+ LEAVE;
+ }
}
g_slist_free (types);
@@ -1519,11 +1519,11 @@
static void
add_interfaces (GType instance_type, AV * interfaces)
{
- int i;
+ int i;
SV * class_name =
newSVpv (gperl_object_package_from_type (instance_type), 0);
- for (i = 0; i <= av_len (interfaces); i++) {
+ for (i = 0; i <= av_len (interfaces); i++) {
GType interface_type;
SV ** svp = av_fetch (interfaces, i, FALSE);
@@ -1623,8 +1623,8 @@
GValue * value,
GParamSpec * pspec)
{
- HV *stash;
- SV **slot;
+ HV *stash;
+ SV **slot;
SV * getter;
prop_handler_lookup (G_OBJECT_TYPE (object), property_id, NULL, &getter);
@@ -1644,34 +1644,34 @@
return;
}
- stash = gperl_object_stash_from_type (pspec->owner_type);
- assert (stash);
- slot = hv_fetch (stash, "GET_PROPERTY", sizeof ("GET_PROPERTY") - 1, 0);
+ stash = gperl_object_stash_from_type (pspec->owner_type);
+ assert (stash);
+ slot = hv_fetch (stash, "GET_PROPERTY", sizeof ("GET_PROPERTY") - 1, 0);
- /* does the function exist? then call it. */
- if (slot && GvCV (*slot)) {
- dSP;
+ /* does the function exist? then call it. */
+ if (slot && GvCV (*slot)) {
+ dSP;
- ENTER;
- SAVETMPS;
+ ENTER;
+ SAVETMPS;
- PUSHMARK (SP);
- XPUSHs (sv_2mortal (gperl_new_object (object, FALSE)));
- XPUSHs (sv_2mortal (newSVGParamSpec (pspec)));
- PUTBACK;
+ PUSHMARK (SP);
+ XPUSHs (sv_2mortal (gperl_new_object (object, FALSE)));
+ XPUSHs (sv_2mortal (newSVGParamSpec (pspec)));
+ PUTBACK;
- if (1 != call_sv ((SV *)GvCV (*slot), G_SCALAR))
- croak ("%s->GET_PROPERTY didn't return exactly one value", HvNAME (stash));
+ if (1 != call_sv ((SV *)GvCV (*slot), G_SCALAR))
+ croak ("%s->GET_PROPERTY didn't return exactly one value", HvNAME (stash));
- SPAGAIN;
+ SPAGAIN;
- gperl_value_from_sv (value, POPs);
+ gperl_value_from_sv (value, POPs);
- PUTBACK;
- FREETMPS;
- LEAVE;
+ PUTBACK;
+ FREETMPS;
+ LEAVE;
- } else {
+ } else {
/* no GET_PROPERTY; look in the wrapper hash. */
SV * val = _gperl_fetch_wrapper_key
(object, g_param_spec_get_name (pspec), FALSE);
@@ -1691,8 +1691,8 @@
const GValue * value,
GParamSpec * pspec)
{
- HV * stash;
- SV ** slot;
+ HV * stash;
+ SV ** slot;
SV * setter;
prop_handler_lookup (G_OBJECT_TYPE (object), property_id, &setter, NULL);
@@ -1711,29 +1711,29 @@
return;
}
- stash = gperl_object_stash_from_type (pspec->owner_type);
- assert (stash);
- slot = hv_fetch (stash, "SET_PROPERTY", sizeof ("SET_PROPERTY") - 1, 0);
+ stash = gperl_object_stash_from_type (pspec->owner_type);
+ assert (stash);
+ slot = hv_fetch (stash, "SET_PROPERTY", sizeof ("SET_PROPERTY") - 1, 0);
- /* does the function exist? then call it. */
- if (slot && GvCV (*slot)) {
- dSP;
+ /* does the function exist? then call it. */
+ if (slot && GvCV (*slot)) {
+ dSP;
- ENTER;
- SAVETMPS;
+ ENTER;
+ SAVETMPS;
- PUSHMARK (SP);
- XPUSHs (sv_2mortal (gperl_new_object (object, FALSE)));
- XPUSHs (sv_2mortal (newSVGParamSpec (pspec)));
- XPUSHs (sv_2mortal (gperl_sv_from_value (value)));
- PUTBACK;
+ PUSHMARK (SP);
+ XPUSHs (sv_2mortal (gperl_new_object (object, FALSE)));
+ XPUSHs (sv_2mortal (newSVGParamSpec (pspec)));
+ XPUSHs (sv_2mortal (gperl_sv_from_value (value)));
+ PUTBACK;
- call_sv ((SV *)GvCV (*slot), G_VOID|G_DISCARD);
+ call_sv ((SV *)GvCV (*slot), G_VOID|G_DISCARD);
- FREETMPS;
- LEAVE;
+ FREETMPS;
+ LEAVE;
- } else {
+ } else {
/* no SET_PROPERTY. fall back to setting the value into
* a key with the pspec's name in the wrapper hash. */
SV * val = _gperl_fetch_wrapper_key
@@ -1753,53 +1753,53 @@
int do_nonperl = 1;
GObjectClass *class;
- /* BIG BUG:
- * we walk down the class hierarchy and call all
- * FINALIZE_INSTANCE functions for perl.
- * We also call the first non-perl finalize function.
- * This does NOT work when we have gobject -> perl -> non-perl -> perl.
- * In this case we should probably remove the perl SV so that later
- * invocations will not try to call into perl.
- (i.e. check wrapper_sv, steal wrapper_sv, finalize)
- */
+ /* BIG BUG:
+ * we walk down the class hierarchy and call all
+ * FINALIZE_INSTANCE functions for perl.
+ * We also call the first non-perl finalize function.
+ * This does NOT work when we have gobject -> perl -> non-perl -> perl.
+ * In this case we should probably remove the perl SV so that later
+ * invocations will not try to call into perl.
+ (i.e. check wrapper_sv, steal wrapper_sv, finalize)
+ */
class = G_OBJECT_GET_CLASS (instance);
- do {
- /* call finalize for each perl class and the topmost non-perl class */
- if (class->finalize == gperl_type_finalize) {
- if (!PL_in_clean_objs) {
- HV *stash = gperl_object_stash_from_type (G_TYPE_FROM_CLASS (class));
- SV **slot = hv_fetch (stash, "FINALIZE_INSTANCE", sizeof ("FINALIZE_INSTANCE") - 1, 0);
-
- instance->ref_count += 2; /* HACK: temporarily revive the object. */
-
- /* does the function exist? then call it. */
- if (slot && GvCV (*slot)) {
- dSP;
-
- ENTER;
- SAVETMPS;
-
- PUSHMARK (SP);
- XPUSHs (sv_2mortal (gperl_new_object (instance, FALSE)));
- PUTBACK;
-
- call_sv ((SV *)GvCV (*slot), G_VOID|G_DISCARD);
-
- FREETMPS;
- LEAVE;
- }
-
- instance->ref_count -= 2; /* HACK END */
- }
- } else if (do_nonperl) {
- class->finalize (instance);
- do_nonperl = 0;
- }
+ do {
+ /* call finalize for each perl class and the topmost non-perl class */
+ if (class->finalize == gperl_type_finalize) {
+ if (!PL_in_clean_objs) {
+ HV *stash = gperl_object_stash_from_type (G_TYPE_FROM_CLASS (class));
+ SV **slot = hv_fetch (stash, "FINALIZE_INSTANCE", sizeof ("FINALIZE_INSTANCE") - 1, 0);
+
+ instance->ref_count += 2; /* HACK: temporarily revive the object. */
+
+ /* does the function exist? then call it. */
+ if (slot && GvCV (*slot)) {
+ dSP;
- class = g_type_class_peek_parent (class);
- } while (class);
+ ENTER;
+ SAVETMPS;
+
+ PUSHMARK (SP);
+ XPUSHs (sv_2mortal (gperl_new_object (instance, FALSE)));
+ PUTBACK;
+
+ call_sv ((SV *)GvCV (*slot), G_VOID|G_DISCARD);
+
+ FREETMPS;
+ LEAVE;
+ }
+
+ instance->ref_count -= 2; /* HACK END */
+ }
+ } else if (do_nonperl) {
+ class->finalize (instance);
+ do_nonperl = 0;
+ }
+
+ class = g_type_class_peek_parent (class);
+ } while (class);
}
static void
@@ -1812,36 +1812,36 @@
* inside out, we will need to worry about making sure we get
* blessed into the right class!
*/
- SV *obj;
- HV *stash = gperl_object_stash_from_type (G_OBJECT_TYPE (instance));
- SV **slot;
+ SV *obj;
+ HV *stash = gperl_object_stash_from_type (G_OBJECT_TYPE (instance));
+ SV **slot;
g_assert (stash != NULL);
obj = sv_2mortal (gperl_new_object (instance, FALSE));
- /* we need to re-bless the wrapper because classes change
- * during construction of an object. */
+ /* we need to re-bless the wrapper because classes change
+ * during construction of an object. */
sv_bless (obj, stash);
/* get the INIT_INSTANCE sub from this package. */
- slot = hv_fetch (stash, "INIT_INSTANCE", sizeof ("INIT_INSTANCE") - 1, 0);
+ slot = hv_fetch (stash, "INIT_INSTANCE", sizeof ("INIT_INSTANCE") - 1, 0);
#ifdef NOISY
- warn ("gperl_type_instance_init %s (%p) => %s\n",
+ warn ("gperl_type_instance_init %s (%p) => %s\n",
G_OBJECT_TYPE_NAME (instance), instance, SvPV_nolen (obj));
#endif
- /* does the function exist? then call it. */
- if (slot && GvCV (*slot)) {
- dSP;
- ENTER;
- SAVETMPS;
- PUSHMARK (SP);
- XPUSHs (obj);
- PUTBACK;
- call_sv ((SV *)GvCV (*slot), G_VOID|G_DISCARD);
- FREETMPS;
- LEAVE;
- }
+ /* does the function exist? then call it. */
+ if (slot && GvCV (*slot)) {
+ dSP;
+ ENTER;
+ SAVETMPS;
+ PUSHMARK (SP);
+ XPUSHs (obj);
+ PUTBACK;
+ call_sv ((SV *)GvCV (*slot), G_VOID|G_DISCARD);
+ FREETMPS;
+ LEAVE;
+ }
}
static GQuark gperl_type_reg_quark (void) G_GNUC_CONST;
@@ -1948,21 +1948,21 @@
stash = gv_stashpv (package, FALSE);
g_assert (stash != NULL);
- slot = hv_fetch (stash, "INIT_BASE", sizeof ("INIT_BASE")-1, 0);
+ slot = hv_fetch (stash, "INIT_BASE", sizeof ("INIT_BASE")-1, 0);
if (slot && GvCV (*slot)) {
- dSP;
- ENTER;
- SAVETMPS;
- PUSHMARK (SP);
+ dSP;
+ ENTER;
+ SAVETMPS;
+ PUSHMARK (SP);
/* remember, use the bottommost package name! */
- XPUSHs (sv_2mortal (newSVpv
+ XPUSHs (sv_2mortal (newSVpv
(g_type_name (G_TYPE_FROM_CLASS (class)), 0)));
- PUTBACK;
- call_sv ((SV*) GvCV (*slot), G_VOID|G_DISCARD);
- FREETMPS;
- LEAVE;
- }
+ PUTBACK;
+ call_sv ((SV*) GvCV (*slot), G_VOID|G_DISCARD);
+ FREETMPS;
+ LEAVE;
+ }
}
g_static_rec_mutex_unlock (&base_init_lock);
@@ -2274,16 +2274,16 @@
for (i = 3 ; i < items ; i += 2) {
char * key = SvPV_nolen (ST (i));
if (strEQ (key, "signals")) {
- if (gperl_sv_is_hash_ref (ST (i+1)))
- add_signals (new_type, (HV*)SvRV (ST (i+1)));
- else
- croak ("signals must be a hash of signalname => signalspec pairs");
- } else if (strEQ (key, "properties")) {
- if (gperl_sv_is_array_ref (ST (i+1)))
- add_properties (new_type, (AV*)SvRV (ST (i+1)));
- else
- croak ("properties must be an array of GParamSpecs");
- } else if (strEQ (key, "interfaces")) {
+ if (gperl_sv_is_hash_ref (ST (i+1)))
+ add_signals (new_type, (HV*)SvRV (ST (i+1)));
+ else
+ croak ("signals must be a hash of signalname => signalspec pairs");
+ } else if (strEQ (key, "properties")) {
+ if (gperl_sv_is_array_ref (ST (i+1)))
+ add_properties (new_type, (AV*)SvRV (ST (i+1)));
+ else
+ croak ("properties must be an array of GParamSpecs");
+ } else if (strEQ (key, "interfaces")) {
if (gperl_sv_is_array_ref (ST (i+1)))
add_interfaces (new_type, (AV*)SvRV (ST (i+1)));
else
@@ -2785,12 +2785,12 @@
bool (SV *a, b, swap)
PROTOTYPE: $;@
CODE:
- RETVAL = !!gperl_convert_flags (
- gperl_fundamental_type_from_obj (a),
- a
- );
+ RETVAL = !!gperl_convert_flags (
+ gperl_fundamental_type_from_obj (a),
+ a
+ );
OUTPUT:
- RETVAL
+ RETVAL
=for apidoc
=for signature ref = $a->as_arrayref
@@ -2806,66 +2806,66 @@
* users call method-style with no args "$f->as_arrayref" too.
*/
GType gtype;
- gint a_;
+ gint a_;
gtype = gperl_fundamental_type_from_obj (a);
- a_ = gperl_convert_flags (gtype, a);
+ a_ = gperl_convert_flags (gtype, a);
- RETVAL = flags_as_arrayref (gtype, a_);
+ RETVAL = flags_as_arrayref (gtype, a_);
}
OUTPUT:
- RETVAL
+ RETVAL
int
eq (SV *a, SV *b, int swap)
ALIAS:
- ne = 1
- ge = 2
+ ne = 1
+ ge = 2
CODE:
{
GType gtype;
- gint a_, b_;
+ gint a_, b_;
gtype = gperl_fundamental_type_from_obj (a);
- a_ = gperl_convert_flags (gtype, swap ? b : a);
- b_ = gperl_convert_flags (gtype, swap ? a : b);
+ a_ = gperl_convert_flags (gtype, swap ? b : a);
+ b_ = gperl_convert_flags (gtype, swap ? a : b);
RETVAL = FALSE;
- switch (ix) {
- case 0: RETVAL = a_ == b_; break;
- case 1: RETVAL = a_ != b_; break;
- case 2: RETVAL = (a_ & b_) == b_; break;
- }
+ switch (ix) {
+ case 0: RETVAL = a_ == b_; break;
+ case 1: RETVAL = a_ != b_; break;
+ case 2: RETVAL = (a_ & b_) == b_; break;
+ }
}
OUTPUT:
- RETVAL
+ RETVAL
SV *
union (SV *a, SV *b, SV *swap)
ALIAS:
- sub = 1
- intersect = 2
- xor = 3
- all = 4
+ sub = 1
+ intersect = 2
+ xor = 3
+ all = 4
CODE:
{
GType gtype;
- gint a_, b_;
+ gint a_, b_;
gtype = gperl_fundamental_type_from_obj (a);
- a_ = gperl_convert_flags (gtype, SvTRUE (swap) ? b : a);
- b_ = gperl_convert_flags (gtype, SvTRUE (swap) ? a : b);
+ a_ = gperl_convert_flags (gtype, SvTRUE (swap) ? b : a);
+ b_ = gperl_convert_flags (gtype, SvTRUE (swap) ? a : b);
- switch (ix) {
- case 0: a_ |= b_; break;
- case 1: a_ &=~b_; break;
- case 2: a_ &= b_; break;
- case 3: a_ ^= b_; break;
- }
+ switch (ix) {
+ case 0: a_ |= b_; break;
+ case 1: a_ &=~b_; break;
+ case 2: a_ &= b_; break;
+ case 3: a_ ^= b_; break;
+ }
- RETVAL = gperl_convert_back_flags (gtype, a_);
+ RETVAL = gperl_convert_back_flags (gtype, a_);
}
OUTPUT:
- RETVAL
+ RETVAL
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]