unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* gw:wcp types in Guile-Gnome
@ 2017-08-17 16:06 Tommi Höynälänmaa
  2017-08-27  4:01 ` David Pirotte
  0 siblings, 1 reply; 4+ messages in thread
From: Tommi Höynälänmaa @ 2017-08-17 16:06 UTC (permalink / raw)
  To: guile-user


Pango attributes are instances of class <gw:wcp> in Guile-Gnome but they 
are not GOOPS instances (i.e. (instance? x) returns false). Class name 
<pango-attribute> is not defined at all. How can I test if an arbitrary 
object belongs to some specific <gw:wcp> class, e.g. if an object is a 
Pango attribute?

      - Tommi Höynälänmaa



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gw:wcp types in Guile-Gnome
  2017-08-17 16:06 gw:wcp types in Guile-Gnome Tommi Höynälänmaa
@ 2017-08-27  4:01 ` David Pirotte
  2017-09-06 12:20   ` Tommi Höynälänmaa
  0 siblings, 1 reply; 4+ messages in thread
From: David Pirotte @ 2017-08-27  4:01 UTC (permalink / raw)
  To: Tommi Höynälänmaa; +Cc: guile-user

[-- Attachment #1: Type: text/plain, Size: 2676 bytes --]

Hello,

	Sorry for the late response, I was hoping someone else would answer before I
	could, we are not that many but there are still a few very good guile-gnome
	users out there ... :)

> Pango attributes are instances of class <gw:wcp> in Guile-Gnome but they 
> are not GOOPS instances (i.e. (instance? x) returns false). Class name 
> <pango-attribute> is not defined at all.

Indeed, pango attributes are opaque pointers, in the manual you see:

	Class: <pango-attribute>
	
	Opaque pointer.

	This class defines no direct slots.

Note that the manual is automatically generated, which is why you read 'Class:
<pango-attrobute>, but on the next entry you can also read 'Opaque pointer', which
is an indication for users that the class has not been 'optimally' wrapped:

	they are not goops classes - subclass of <gobject>, such as <gtk-window>,
	they are (G-Wrap) opaque pointers.

In the manual, references to <pango-attribute> means it wish to receive an opaque
pointer of the corresponding attribute  ... and these are returned by the interface
creating pango attributes:

	pango-attr-size-new, pango-attr-font-desc-new ...

Opaque pointers are low level G-Wrap beats, so you don't want to involve yourself
there :). Their printing representation miss leaded you to believe they are
instances of ... which is not the case. When you create an attribute:

	scheme@(guile-user)> (pango-attr-size-new 10)
	$3 = #<gw:wcp <pango-attribute> 0x562572ca8c40>

	in the above, gw:wcp stands for 'g-wrap:wrap C type', and what you read is
	just an opaque pointer printing representation for  (pango-attr-size-new 10)

Just for info, below is a copy ot the automatically G-Wrap generated definition for
pango-attr-size-new [1]

> How can I test if an arbitrary  object belongs to some specific <gw:wcp> class,
> e.g. if an object is a Pango attribute?

You can't, you have to use their creator interfaces and attribute list operators ...

	scheme@(guile-user)> (pango-attr-list-new)
	$2 = #<<pango-attr-list> 562572e2f260 [native]>
	scheme@(guile-user)> (pango-attr-size-new 10)
	$3 = #<gw:wcp <pango-attribute> 0x562572ca8c40>
	scheme@(guile-user)> (pango-attr-list-insert $2 $3)
	scheme@(guile-user)> 

HTH,
David

[1]

{
  const char *gw__tmp1217_arg_types[1];
  static GWTypeSpec gw__tmp1218_arg_typespecs[] = { GW_TYPESPEC_CALLER_OWNED,  };
  gw__tmp1217_arg_types[0] = "int";
   gw_wrapset_add_function(gw__tmp0_c_info, pango_attr_size_new, 1, 0, "<pango-attribute>", GW_TYPESPEC_CALLER_OWNED, gw__tmp1217_arg_types, gw__tmp1218_arg_typespecs, "pango-attr-size-new", NULL, GW_FUNCTION_FLAG_LEAVE_RUNTIME);
}

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gw:wcp types in Guile-Gnome
  2017-08-27  4:01 ` David Pirotte
@ 2017-09-06 12:20   ` Tommi Höynälänmaa
  2017-09-06 22:45     ` David Pirotte
  0 siblings, 1 reply; 4+ messages in thread
From: Tommi Höynälänmaa @ 2017-09-06 12:20 UTC (permalink / raw)
  To: David Pirotte; +Cc: guile-user

Hi

IMHO it would not violate opaqueness if you could find out (runtime) 
which wct class a wcp value belongs to.

      - Tommi Höynälänmaa




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gw:wcp types in Guile-Gnome
  2017-09-06 12:20   ` Tommi Höynälänmaa
@ 2017-09-06 22:45     ` David Pirotte
  0 siblings, 0 replies; 4+ messages in thread
From: David Pirotte @ 2017-09-06 22:45 UTC (permalink / raw)
  To: Tommi Höynälänmaa; +Cc: guile-user

[-- Attachment #1: Type: text/plain, Size: 758 bytes --]

Hello,

> IMHO it would not violate opaqueness if you could find out (runtime) 
> which wct class a wcp value belongs to.

'opaque' is just a name, there is no 'properties' such that one could 'violate' (or
not) an opaque type: these are just 'opaque' pointers, g-wrap pointers to a C
values, and these values, in the case of pango attributes, must be created using
their corresponding interface, as I wrote in my previus answer...

What you want to achieve wrt (gnome pango), in the current situation, is simply
impossible. To achieve that, you would need to 'manually' wrap pango attribute class
and subclasses ... something I'm not going to work on, sorry (and and I really would
not spend any time on this if I were you ... my 2c)

David

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-09-06 22:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-17 16:06 gw:wcp types in Guile-Gnome Tommi Höynälänmaa
2017-08-27  4:01 ` David Pirotte
2017-09-06 12:20   ` Tommi Höynälänmaa
2017-09-06 22:45     ` David Pirotte

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).