Re: [BLACKBOX] GdkGC *fg_gc[5] in CP?

From: [at]} <Wojtek>
Date: Sun, 27 Mar 2011 22:38:31 -0400

----boundary-LibPST-iamunique-1766726419_-_-
Content-type: text/plain

> 'GdkColor fg[5];':
> As this C construct is a pointer to the first array element, I thought it
> should be translated to
> 'fg*: POINTER TO ARRAY [untagged] 5 OF Gdk.Color'
> and got a 'NIL reference' trap when trying to print out the color of fg[0].
> When I omitted 'POINTER TO' I got the correct values (0,0,0) for (R,G,B).

The array "GdkColor fg[5]" is an array. In C it should be accessed as
fg[0] through fg[4]. No need to use pointers in C, and therefore in CP
either.

A POINTER TO a five-element array would be declared in C like this:

GdkColor * fg[5];

If it crashed on:

> Gdk.draw_arc (
> widget.window, widget.style.fg_gc[ORD(widget.state)],
> G.TRUE, 0, 0, widget.allocation.width, widget.allocation.height,
> 0, 64 * 360);

perhaps it is a NIL pointer? Can you examine it with SYSTEM?

> I guess you
> all have the .h files of the corresponding C source on your computers, but I
> can post those too if wanted.

I do not. It makes little sense to post questions to this list
without providing necessary info. It is hard to guess what you are doing
without seeing the .h file and then your translation.


> I simply have no idea how to continue.

Perhaps the last few slides of my very long presentation can be of some
help? Start with slide 77.

http://www.pas.rochester.edu/~skulski/Presentations/BB_Class.pdf

Hope it helps,

Wojtek


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-1766726419_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRib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b2NoZXN0ZXIuZWR1L35za3Vsc2tp
L1ByZXNlbnRhdGlvbnMvQkJfQ2xhc3MucGRmXHBhcg0KXHBhcg0KSG9wZSBpdCBoZWxwcyxccGFy
DQpccGFyDQpXb2p0ZWtccGFyDQpccGFyDQpccGFyDQotLS0tXHBhcg0KVG8gdW5zdWJzY3JpYmUs
IHNlbmQgYSBtZXNzYWdlIHdpdGggYm9keSAiU0lHTk9GRiBCTEFDS0JPWCIgdG8gTElTVFNFUlZA
TElTVFMuT0JFUk9OLkNIXHBhcg0KfQ==
----boundary-LibPST-iamunique-1766726419_-_---
Received on Mon Mar 28 2011 - 04:38:31 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:16 UTC