unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: David Pirotte <david@altosw.be>
To: "Tommi Höynälänmaa" <tommi.hoynalanmaa@gmail.com>
Cc: guile-user@gnu.org
Subject: Re: gw:wcp types in Guile-Gnome
Date: Sun, 27 Aug 2017 01:01:28 -0300	[thread overview]
Message-ID: <20170827010128.1b27b900@capac> (raw)
In-Reply-To: <51dae00f-08ae-be10-7589-94f3c01d9dfd@gmail.com>

[-- 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 --]

  reply	other threads:[~2017-08-27  4:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-17 16:06 gw:wcp types in Guile-Gnome Tommi Höynälänmaa
2017-08-27  4:01 ` David Pirotte [this message]
2017-09-06 12:20   ` Tommi Höynälänmaa
2017-09-06 22:45     ` David Pirotte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170827010128.1b27b900@capac \
    --to=david@altosw.be \
    --cc=guile-user@gnu.org \
    --cc=tommi.hoynalanmaa@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).