[gcompris-devel] Need help with working on Bug 696869 (digraphs)

Fòram na Gàidhlig fios at foramnagaidhlig.net
Wed Apr 3 09:37:37 UTC 2013


Hi all,

I managed to compile gcompris on Linux with no problems, so I have 
started working on the patch. However, I don't speak C, so I have hit my 
first wall while working on src\click_on_letter-activity\click_on_letter.c

If I understand correctly, * is a pointer, but what is **? A pointer to 
a list of pointers? How do I navigate the thing? Specifically:

========================================
Problem 1: find out how long gchar ** is
========================================

My new code:

gchar **alphabet = 
g_strsplit(gettext(_("a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z") 
), "|", 42);
/* 42 is a boundary I chose at random, is it big enough? */
guint i = 0;

Now I need to iterate. How do I tell the "while" control that the end of 
alphabet has been reached? I will need soe sort of length or count 
function. I also need this here:

/*todo rework this function for new alphabet data type*/
static void create_level_from_alphabet(gchar **alphabet)
{
   /* todo how do I get length of gchar new type? */
   guint alphabet_len = g_utf8_strlen (alphabet, -1);


=============================================
Problem 2: getting an element out of gchar **
=============================================

The old code:

alphabet = get_alphabet();
gchar *letter = g_new0(gchar, 8);
g_unichar_to_utf8(g_utf8_get_char(alphabet), letter);

The data type of "alphabet" has changed from gchar * to gchar **
How do I reference the letter now?




More information about the Gcompris-devel mailing list