summaryrefslogtreecommitdiff
path: root/girepository
diff options
context:
space:
mode:
Diffstat (limited to 'girepository')
-rw-r--r--girepository/cmph-bdz-test.c1
-rwxr-xr-xgirepository/cmph/bdz.c19
-rwxr-xr-xgirepository/cmph/bdz_ph.c12
-rw-r--r--girepository/cmph/bmz.c29
-rw-r--r--girepository/cmph/bmz8.c24
-rwxr-xr-xgirepository/cmph/brz.c173
-rw-r--r--girepository/cmph/chd.c8
-rw-r--r--girepository/cmph/chd_ph.c11
-rw-r--r--girepository/cmph/chm.c26
-rw-r--r--girepository/cmph/compressed_rank.c16
-rw-r--r--girepository/cmph/compressed_seq.c42
-rw-r--r--girepository/cmph/fch.c43
-rw-r--r--girepository/docs.c (renamed from girepository/glib-compat.h)18
-rw-r--r--girepository/gdump.c9
-rw-r--r--girepository/gi-dump-types.c2
-rw-r--r--girepository/giarginfo.c11
-rw-r--r--girepository/giarginfo.h6
-rw-r--r--girepository/gibaseinfo.c41
-rw-r--r--girepository/gibaseinfo.h5
-rw-r--r--girepository/gicallableinfo.c35
-rw-r--r--girepository/gicallableinfo.h6
-rw-r--r--girepository/giconstantinfo.c4
-rw-r--r--girepository/giconstantinfo.h6
-rw-r--r--girepository/gienuminfo.c35
-rw-r--r--girepository/gienuminfo.h12
-rw-r--r--girepository/gifieldinfo.c10
-rw-r--r--girepository/gifieldinfo.h7
-rw-r--r--girepository/gifunctioninfo.c11
-rw-r--r--girepository/gifunctioninfo.h11
-rw-r--r--girepository/giinterfaceinfo.c7
-rw-r--r--girepository/giinterfaceinfo.h6
-rw-r--r--girepository/ginvoke.c34
-rw-r--r--girepository/giobjectinfo.c8
-rw-r--r--girepository/giobjectinfo.h8
-rw-r--r--girepository/gipropertyinfo.c6
-rw-r--r--girepository/gipropertyinfo.h6
-rw-r--r--girepository/giregisteredtypeinfo.c4
-rw-r--r--girepository/giregisteredtypeinfo.h6
-rw-r--r--girepository/girepository-private.h9
-rw-r--r--girepository/girepository.c223
-rw-r--r--girepository/girepository.h32
-rw-r--r--girepository/girepository.symbols196
-rw-r--r--girepository/girffi.c33
-rw-r--r--girepository/girffi.h18
-rw-r--r--girepository/girmodule.c6
-rw-r--r--girepository/girnode.c24
-rw-r--r--girepository/girnode.h2
-rw-r--r--girepository/giroffsets.c6
-rw-r--r--girepository/girparser.c90
-rw-r--r--girepository/gisignalinfo.c4
-rw-r--r--girepository/gisignalinfo.h6
-rw-r--r--girepository/gistructinfo.c12
-rw-r--r--girepository/gistructinfo.h6
-rw-r--r--girepository/gitypeinfo.c5
-rw-r--r--girepository/gitypeinfo.h12
-rw-r--r--girepository/gitypelib-internal.h740
-rw-r--r--girepository/gitypelib.c334
-rw-r--r--girepository/gitypelib.h13
-rw-r--r--girepository/gitypes.h95
-rw-r--r--girepository/giunioninfo.c6
-rw-r--r--girepository/giunioninfo.h6
-rw-r--r--girepository/givfuncinfo.c40
-rw-r--r--girepository/givfuncinfo.h6
-rw-r--r--girepository/gthash-test.c1
-rw-r--r--girepository/gthash.c4
65 files changed, 1850 insertions, 797 deletions
diff --git a/girepository/cmph-bdz-test.c b/girepository/cmph-bdz-test.c
index fdff9d17..92c445f8 100644
--- a/girepository/cmph-bdz-test.c
+++ b/girepository/cmph-bdz-test.c
@@ -128,7 +128,6 @@ main(int argc, char **argv)
{
gint ret;
- g_type_init ();
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/cmph-bdz/search", test_search);
diff --git a/girepository/cmph/bdz.c b/girepository/cmph/bdz.c
index a385b152..81cd7151 100755
--- a/girepository/cmph/bdz.c
+++ b/girepository/cmph/bdz.c
@@ -489,6 +489,10 @@ int bdz_dump(cmph_t *mphf, FILE *fd)
cmph_uint32 buflen;
register size_t nbytes;
bdz_data_t *data = (bdz_data_t *)mphf->data;
+ cmph_uint32 sizeg;
+#ifdef DEBUG
+ cmph_uint32 i;
+#endif
__cmph_dump(mphf, fd);
hash_state_dump(data->hl, &buf, &buflen);
@@ -501,7 +505,7 @@ int bdz_dump(cmph_t *mphf, FILE *fd)
nbytes = fwrite(&(data->m), sizeof(cmph_uint32), (size_t)1, fd);
nbytes = fwrite(&(data->r), sizeof(cmph_uint32), (size_t)1, fd);
- cmph_uint32 sizeg = (cmph_uint32)ceil(data->n/4.0);
+ sizeg = (cmph_uint32)ceil(data->n/4.0);
nbytes = fwrite(data->g, sizeof(cmph_uint8)*sizeg, (size_t)1, fd);
nbytes = fwrite(&(data->k), sizeof(cmph_uint32), (size_t)1, fd);
@@ -509,12 +513,11 @@ int bdz_dump(cmph_t *mphf, FILE *fd)
nbytes = fwrite(&(data->ranktablesize), sizeof(cmph_uint32), (size_t)1, fd);
nbytes = fwrite(data->ranktable, sizeof(cmph_uint32)*(data->ranktablesize), (size_t)1, fd);
- if (nbytes == 0 && ferror(fd)) {
+ if (nbytes == 0 && ferror(fd)) {
fprintf(stderr, "ERROR: %s\n", strerror(errno));
return 0;
}
#ifdef DEBUG
- cmph_uint32 i;
fprintf(stderr, "G: ");
for (i = 0; i < data->n; ++i) fprintf(stderr, "%u ", GETVALUE(data->g, i));
fprintf(stderr, "\n");
@@ -528,6 +531,9 @@ void bdz_load(FILE *f, cmph_t *mphf)
cmph_uint32 buflen, sizeg;
register size_t nbytes;
bdz_data_t *bdz = (bdz_data_t *)malloc(sizeof(bdz_data_t));
+#ifdef DEBUG
+ cmph_uint32 i = 0;
+#endif
DEBUGP("Loading bdz mphf\n");
mphf->data = bdz;
@@ -554,13 +560,13 @@ void bdz_load(FILE *f, cmph_t *mphf)
bdz->ranktable = (cmph_uint32 *)calloc((size_t)bdz->ranktablesize, sizeof(cmph_uint32));
nbytes = fread(bdz->ranktable, sizeof(cmph_uint32)*(bdz->ranktablesize), (size_t)1, f);
- if (nbytes == 0 && ferror(f)) {
+ if (nbytes == 0 && ferror(f)) {
fprintf(stderr, "ERROR: %s\n", strerror(errno));
return;
}
#ifdef DEBUG
- cmph_uint32 i = 0;
+ i = 0;
fprintf(stderr, "G: ");
for (i = 0; i < bdz->n; ++i) fprintf(stderr, "%u ", GETVALUE(bdz->g,i));
fprintf(stderr, "\n");
@@ -639,6 +645,7 @@ void bdz_pack(cmph_t *mphf, void *packed_mphf)
{
bdz_data_t *data = (bdz_data_t *)mphf->data;
cmph_uint8 * ptr = packed_mphf;
+ cmph_uint32 sizeg;
// packing hl type
CMPH_HASH hl_type = hash_get_type(data->hl);
@@ -665,7 +672,7 @@ void bdz_pack(cmph_t *mphf, void *packed_mphf)
*ptr++ = data->b;
// packing g
- cmph_uint32 sizeg = (cmph_uint32)ceil(data->n/4.0);
+ sizeg = (cmph_uint32)ceil(data->n/4.0);
memcpy(ptr, data->g, sizeof(cmph_uint8)*sizeg);
}
diff --git a/girepository/cmph/bdz_ph.c b/girepository/cmph/bdz_ph.c
index 2e986071..2095f116 100755
--- a/girepository/cmph/bdz_ph.c
+++ b/girepository/cmph/bdz_ph.c
@@ -452,6 +452,10 @@ int bdz_ph_dump(cmph_t *mphf, FILE *fd)
cmph_uint32 sizeg = 0;
register size_t nbytes;
bdz_ph_data_t *data = (bdz_ph_data_t *)mphf->data;
+#ifdef DEBUG
+ cmph_uint32 i;
+#endif
+
__cmph_dump(mphf, fd);
hash_state_dump(data->hl, &buf, &buflen);
@@ -466,12 +470,11 @@ int bdz_ph_dump(cmph_t *mphf, FILE *fd)
sizeg = (cmph_uint32)ceil(data->n/5.0);
nbytes = fwrite(data->g, sizeof(cmph_uint8)*sizeg, (size_t)1, fd);
- if (nbytes == 0 && ferror(fd)) {
+ if (nbytes == 0 && ferror(fd)) {
fprintf(stderr, "ERROR: %s\n", strerror(errno));
return 0;
}
#ifdef DEBUG
- cmph_uint32 i;
fprintf(stderr, "G: ");
for (i = 0; i < data->n; ++i) fprintf(stderr, "%u ", GETVALUE(data->g, i));
fprintf(stderr, "\n");
@@ -506,7 +509,7 @@ void bdz_ph_load(FILE *f, cmph_t *mphf)
bdz_ph->g = (cmph_uint8 *)calloc((size_t)sizeg, sizeof(cmph_uint8));
nbytes = fread(bdz_ph->g, sizeg*sizeof(cmph_uint8), (size_t)1, f);
- if (nbytes == 0 && ferror(f)) {
+ if (nbytes == 0 && ferror(f)) {
fprintf(stderr, "ERROR: %s\n", strerror(errno));
}
return;
@@ -556,6 +559,7 @@ void bdz_ph_pack(cmph_t *mphf, void *packed_mphf)
{
bdz_ph_data_t *data = (bdz_ph_data_t *)mphf->data;
cmph_uint8 * ptr = packed_mphf;
+ cmph_uint32 sizeg;
// packing hl type
CMPH_HASH hl_type = hash_get_type(data->hl);
@@ -571,7 +575,7 @@ void bdz_ph_pack(cmph_t *mphf, void *packed_mphf)
ptr += sizeof(data->r);
// packing g
- cmph_uint32 sizeg = (cmph_uint32)ceil(data->n/5.0);
+ sizeg = (cmph_uint32)ceil(data->n/5.0);
memcpy(ptr, data->g, sizeof(cmph_uint8)*sizeg);
}
diff --git a/girepository/cmph/bmz.c b/girepository/cmph/bmz.c
index 9c6cea00..9573825a 100644
--- a/girepository/cmph/bmz.c
+++ b/girepository/cmph/bmz.c
@@ -450,6 +450,10 @@ int bmz_dump(cmph_t *mphf, FILE *fd)
cmph_uint32 two = 2; //number of hash functions
bmz_data_t *data = (bmz_data_t *)mphf->data;
register size_t nbytes;
+#ifdef DEBUG
+ cmph_uint32 i;
+#endif
+
__cmph_dump(mphf, fd);
nbytes = fwrite(&two, sizeof(cmph_uint32), (size_t)1, fd);
@@ -470,12 +474,11 @@ int bmz_dump(cmph_t *mphf, FILE *fd)
nbytes = fwrite(&(data->m), sizeof(cmph_uint32), (size_t)1, fd);
nbytes = fwrite(data->g, sizeof(cmph_uint32)*(data->n), (size_t)1, fd);
- if (nbytes == 0 && ferror(fd)) {
+ if (nbytes == 0 && ferror(fd)) {
fprintf(stderr, "ERROR: %s\n", strerror(errno));
return 0;
}
#ifdef DEBUG
- cmph_uint32 i;
fprintf(stderr, "G: ");
for (i = 0; i < data->n; ++i) fprintf(stderr, "%u ", data->g[i]);
fprintf(stderr, "\n");
@@ -515,10 +518,11 @@ void bmz_load(FILE *f, cmph_t *mphf)
bmz->g = (cmph_uint32 *)malloc(sizeof(cmph_uint32)*bmz->n);
nbytes = fread(bmz->g, bmz->n*sizeof(cmph_uint32), (size_t)1, f);
- if (nbytes == 0 && ferror(f)) {
+ if (nbytes == 0 && ferror(f)) {
fprintf(stderr, "ERROR: %s\n", strerror(errno));
return;
}
+
#ifdef DEBUG
fprintf(stderr, "G: ");
for (i = 0; i < bmz->n; ++i) fprintf(stderr, "%u ", bmz->g[i]);
@@ -559,6 +563,7 @@ void bmz_pack(cmph_t *mphf, void *packed_mphf)
bmz_data_t *data = (bmz_data_t *)mphf->data;
cmph_uint8 * ptr = packed_mphf;
+ CMPH_HASH h2_type;
// packing h1 type
CMPH_HASH h1_type = hash_get_type(data->hashes[0]);
@@ -570,7 +575,7 @@ void bmz_pack(cmph_t *mphf, void *packed_mphf)
ptr += hash_state_packed_size(h1_type);
// packing h2 type
- CMPH_HASH h2_type = hash_get_type(data->hashes[1]);
+ h2_type = hash_get_type(data->hashes[1]);
*((cmph_uint32 *) ptr) = h2_type;
ptr += sizeof(cmph_uint32);
@@ -612,18 +617,22 @@ cmph_uint32 bmz_search_packed(void *packed_mphf, const char *key, cmph_uint32 ke
{
register cmph_uint8 *h1_ptr = packed_mphf;
register CMPH_HASH h1_type = *((cmph_uint32 *)h1_ptr);
+ register cmph_uint8 *h2_ptr;
+ register CMPH_HASH h2_type;
+ register cmph_uint32 *g_ptr, n, h1, h2;
+
h1_ptr += 4;
- register cmph_uint8 *h2_ptr = h1_ptr + hash_state_packed_size(h1_type);
- register CMPH_HASH h2_type = *((cmph_uint32 *)h2_ptr);
+ h2_ptr = h1_ptr + hash_state_packed_size(h1_type);
+ h2_type = *((cmph_uint32 *)h2_ptr);
h2_ptr += 4;
- register cmph_uint32 *g_ptr = (cmph_uint32 *)(h2_ptr + hash_state_packed_size(h2_type));
+ g_ptr = (cmph_uint32 *)(h2_ptr + hash_state_packed_size(h2_type));
- register cmph_uint32 n = *g_ptr++;
+ n = *g_ptr++;
- register cmph_uint32 h1 = hash_packed(h1_ptr, h1_type, key, keylen) % n;
- register cmph_uint32 h2 = hash_packed(h2_ptr, h2_type, key, keylen) % n;
+ h1 = hash_packed(h1_ptr, h1_type, key, keylen) % n;
+ h2 = hash_packed(h2_ptr, h2_type, key, keylen) % n;
if (h1 == h2 && ++h2 > n) h2 = 0;
return (g_ptr[h1] + g_ptr[h2]);
}
diff --git a/girepository/cmph/bmz8.c b/girepository/cmph/bmz8.c
index 206c48c4..15853c00 100644
--- a/girepository/cmph/bmz8.c
+++ b/girepository/cmph/bmz8.c
@@ -483,7 +483,7 @@ int bmz8_dump(cmph_t *mphf, FILE *fd)
nbytes = fwrite(&(data->m), sizeof(cmph_uint8), (size_t)1, fd);
nbytes = fwrite(data->g, sizeof(cmph_uint8)*(data->n), (size_t)1, fd);
- if (nbytes == 0 && ferror(fd)) {
+ if (nbytes == 0 && ferror(fd)) {
fprintf(stderr, "ERROR: %s\n", strerror(errno));
return 0;
}
@@ -528,10 +528,11 @@ void bmz8_load(FILE *f, cmph_t *mphf)
bmz8->g = (cmph_uint8 *)malloc(sizeof(cmph_uint8)*bmz8->n);
nbytes = fread(bmz8->g, bmz8->n*sizeof(cmph_uint8), (size_t)1, f);
- if (nbytes == 0 && ferror(f)) {
+ if (nbytes == 0 && ferror(f)) {
fprintf(stderr, "ERROR: %s\n", strerror(errno));
return;
}
+
#ifdef DEBUG
fprintf(stderr, "G: ");
for (i = 0; i < bmz8->n; ++i) fprintf(stderr, "%u ", bmz8->g[i]);
@@ -571,6 +572,7 @@ void bmz8_pack(cmph_t *mphf, void *packed_mphf)
{
bmz8_data_t *data = (bmz8_data_t *)mphf->data;
cmph_uint8 * ptr = packed_mphf;
+ CMPH_HASH h2_type;
// packing h1 type
CMPH_HASH h1_type = hash_get_type(data->hashes[0]);
@@ -582,7 +584,7 @@ void bmz8_pack(cmph_t *mphf, void *packed_mphf)
ptr += hash_state_packed_size(h1_type);
// packing h2 type
- CMPH_HASH h2_type = hash_get_type(data->hashes[1]);
+ h2_type = hash_get_type(data->hashes[1]);
*((cmph_uint32 *) ptr) = h2_type;
ptr += sizeof(cmph_uint32);
@@ -623,18 +625,22 @@ cmph_uint8 bmz8_search_packed(void *packed_mphf, const char *key, cmph_uint32 ke
{
register cmph_uint8 *h1_ptr = packed_mphf;
register CMPH_HASH h1_type = *((cmph_uint32 *)h1_ptr);
+ register cmph_uint8 *h2_ptr;
+ register CMPH_HASH h2_type;
+ register cmph_uint8 *g_ptr, n, h1, h2;
+
h1_ptr += 4;
- register cmph_uint8 *h2_ptr = h1_ptr + hash_state_packed_size(h1_type);
- register CMPH_HASH h2_type = *((cmph_uint32 *)h2_ptr);
+ h2_ptr = h1_ptr + hash_state_packed_size(h1_type);
+ h2_type = *((cmph_uint32 *)h2_ptr);
h2_ptr += 4;
- register cmph_uint8 *g_ptr = h2_ptr + hash_state_packed_size(h2_type);
+ g_ptr = h2_ptr + hash_state_packed_size(h2_type);
- register cmph_uint8 n = *g_ptr++;
+ n = *g_ptr++;
- register cmph_uint8 h1 = (cmph_uint8)(hash_packed(h1_ptr, h1_type, key, keylen) % n);
- register cmph_uint8 h2 = (cmph_uint8)(hash_packed(h2_ptr, h2_type, key, keylen) % n);
+ h1 = (cmph_uint8)(hash_packed(h1_ptr, h1_type, key, keylen) % n);
+ h2 = (cmph_uint8)(hash_packed(h2_ptr, h2_type, key, keylen) % n);
DEBUGP("key: %s h1: %u h2: %u\n", key, h1, h2);
if (h1 == h2 && ++h2 > n) h2 = 0;
return (cmph_uint8)(g_ptr[h1] + g_ptr[h2]);
diff --git a/girepository/cmph/brz.c b/girepository/cmph/brz.c
index f0c91c4b..cd35c8d8 100755
--- a/girepository/cmph/brz.c
+++ b/girepository/cmph/brz.c
@@ -128,9 +128,10 @@ cmph_t *brz_new(cmph_config_t *mph, double c)
brz_data_t *brzf = NULL;
cmph_uint32 i;
cmph_uint32 iterations = 20;
+ brz_config_data_t *brz;
DEBUGP("c: %f\n", c);
- brz_config_data_t *brz = (brz_config_data_t *)mph->data;
+ brz = (brz_config_data_t *)mph->data;
switch(brz->algo) // validating restrictions over parameter c.
{
case CMPH_BMZ8:
@@ -252,13 +253,14 @@ static int brz_gen_mphf(cmph_config_t *mph)
/* Buffers management */
if (memory_usage + keylen + sizeof(keylen) > brz->memory_availability) // flush buffers
{
+ cmph_uint32 value, sum, keylen1;
if(mph->verbosity)
{
fprintf(stderr, "Flushing %u\n", nkeys_in_buffer);
}
- cmph_uint32 value = buckets_size[0];
- cmph_uint32 sum = 0;
- cmph_uint32 keylen1 = 0;
+ value = buckets_size[0];
+ sum = 0;
+ keylen1 = 0;
buckets_size[0] = 0;
for(i = 1; i < brz->k; i++)
{
@@ -312,14 +314,16 @@ static int brz_gen_mphf(cmph_config_t *mph)
mph->key_source->dispose(mph->key_source->data, key, keylen);
}
if (memory_usage != 0) // flush buffers
- {
+ {
+ cmph_uint32 value;
+ cmph_uint32 sum, keylen1;
if(mph->verbosity)
{
fprintf(stderr, "Flushing %u\n", nkeys_in_buffer);
}
- cmph_uint32 value = buckets_size[0];
- cmph_uint32 sum = 0;
- cmph_uint32 keylen1 = 0;
+ value = buckets_size[0];
+ sum = 0;
+ keylen1 = 0;
buckets_size[0] = 0;
for(i = 1; i < brz->k; i++)
{
@@ -371,7 +375,7 @@ static int brz_gen_mphf(cmph_config_t *mph)
nbytes = fwrite(&(brz->algo), sizeof(brz->algo), (size_t)1, brz->mphf_fd);
nbytes = fwrite(&(brz->k), sizeof(cmph_uint32), (size_t)1, brz->mphf_fd); // number of MPHFs
nbytes = fwrite(brz->size, sizeof(cmph_uint8)*(brz->k), (size_t)1, brz->mphf_fd);
- if (nbytes == 0 && ferror(brz->mphf_fd)) {
+ if (nbytes == 0 && ferror(brz->mphf_fd)) {
fprintf(stderr, "ERROR: %s\n", strerror(errno));
return 0;
}
@@ -579,7 +583,7 @@ int brz_dump(cmph_t *mphf, FILE *fd)
// Dumping m and the vector offset.
nbytes = fwrite(&(data->m), sizeof(cmph_uint32), (size_t)1, fd);
nbytes = fwrite(data->offset, sizeof(cmph_uint32)*(data->k), (size_t)1, fd);
- if (nbytes == 0 && ferror(fd)) {
+ if (nbytes == 0 && ferror(fd)) {
fprintf(stderr, "ERROR: %s\n", strerror(errno));
return 0;
}
@@ -648,24 +652,26 @@ void brz_load(FILE *f, cmph_t *mphf)
nbytes = fread(&(brz->m), sizeof(cmph_uint32), (size_t)1, f);
brz->offset = (cmph_uint32 *)malloc(sizeof(cmph_uint32)*brz->k);
nbytes = fread(brz->offset, sizeof(cmph_uint32)*(brz->k), (size_t)1, f);
- if (nbytes == 0 && ferror(f)) {
+ if (nbytes == 0 && ferror(f)) {
fprintf(stderr, "ERROR: %s\n", strerror(errno));
}
+
return;
}
static cmph_uint32 brz_bmz8_search(brz_data_t *brz, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint)
{
register cmph_uint32 h0;
+ register cmph_uint32 m, n, h1, h2;
+ register cmph_uint8 mphf_bucket;
hash_vector(brz->h0, key, keylen, fingerprint);
h0 = fingerprint[2] % brz->k;
- register cmph_uint32 m = brz->size[h0];
- register cmph_uint32 n = (cmph_uint32)ceil(brz->c * m);
- register cmph_uint32 h1 = hash(brz->h1[h0], key, keylen) % n;
- register cmph_uint32 h2 = hash(brz->h2[h0], key, keylen) % n;
- register cmph_uint8 mphf_bucket;
+ m = brz->size[h0];
+ n = (cmph_uint32)ceil(brz->c * m);
+ h1 = hash(brz->h1[h0], key, keylen) % n;
+ h2 = hash(brz->h2[h0], key, keylen) % n;
if (h1 == h2 && ++h2 >= n) h2 = 0;
mphf_bucket = (cmph_uint8)(brz->g[h0][h1] + brz->g[h0][h2]);
@@ -678,17 +684,20 @@ static cmph_uint32 brz_bmz8_search(brz_data_t *brz, const char *key, cmph_uint32
static cmph_uint32 brz_fch_search(brz_data_t *brz, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint)
{
register cmph_uint32 h0;
+ register cmph_uint32 m, b, h1, h2;
+ register double p1, p2;
+ register cmph_uint8 mphf_bucket;
hash_vector(brz->h0, key, keylen, fingerprint);
h0 = fingerprint[2] % brz->k;
- register cmph_uint32 m = brz->size[h0];
- register cmph_uint32 b = fch_calc_b(brz->c, m);
- register double p1 = fch_calc_p1(m);
- register double p2 = fch_calc_p2(b);
- register cmph_uint32 h1 = hash(brz->h1[h0], key, keylen) % m;
- register cmph_uint32 h2 = hash(brz->h2[h0], key, keylen) % m;
- register cmph_uint8 mphf_bucket = 0;
+ m = brz->size[h0];
+ b = fch_calc_b(brz->c, m);
+ p1 = fch_calc_p1(m);
+ p2 = fch_calc_p2(b);
+ h1 = hash(brz->h1[h0], key, keylen) % m;
+ h2 = hash(brz->h2[h0], key, keylen) % m;
+ mphf_bucket = 0;
h1 = mixh10h11h12(b, p1, p2, h1);
mphf_bucket = (cmph_uint8)((h2 + brz->g[h0][h1]) % m);
return (mphf_bucket + brz->offset[h0]);
@@ -741,13 +750,20 @@ void brz_pack(cmph_t *mphf, void *packed_mphf)
brz_data_t *data = (brz_data_t *)mphf->data;
cmph_uint8 * ptr = packed_mphf;
cmph_uint32 i,n;
+ CMPH_HASH h0_type, h1_type, h2_type;
+#if defined (__ia64) || defined (__x86_64__)
+ cmph_uint64 * g_is_ptr;
+#else
+ cmph_uint32 * g_is_ptr;
+#endif
+ cmph_uint8 * g_i;
// packing internal algo type
memcpy(ptr, &(data->algo), sizeof(data->algo));
ptr += sizeof(data->algo);
// packing h0 type
- CMPH_HASH h0_type = hash_get_type(data->h0);
+ h0_type = hash_get_type(data->h0);
memcpy(ptr, &h0_type, sizeof(h0_type));
ptr += sizeof(h0_type);
@@ -764,12 +780,12 @@ void brz_pack(cmph_t *mphf, void *packed_mphf)
ptr += sizeof(data->c);
// packing h1 type
- CMPH_HASH h1_type = hash_get_type(data->h1[0]);
+ h1_type = hash_get_type(data->h1[0]);
memcpy(ptr, &h1_type, sizeof(h1_type));
ptr += sizeof(h1_type);
// packing h2 type
- CMPH_HASH h2_type = hash_get_type(data->h2[0]);
+ h2_type = hash_get_type(data->h2[0]);
memcpy(ptr, &h2_type, sizeof(h2_type));
ptr += sizeof(h2_type);
@@ -782,12 +798,12 @@ void brz_pack(cmph_t *mphf, void *packed_mphf)
ptr += sizeof(cmph_uint32)*data->k;
#if defined (__ia64) || defined (__x86_64__)
- cmph_uint64 * g_is_ptr = (cmph_uint64 *)ptr;
+ g_is_ptr = (cmph_uint64 *)ptr;
#else
- cmph_uint32 * g_is_ptr = (cmph_uint32 *)ptr;
+ g_is_ptr = (cmph_uint32 *)ptr;
#endif
- cmph_uint8 * g_i = (cmph_uint8 *) (g_is_ptr + data->k);
+ g_i = (cmph_uint8 *) (g_is_ptr + data->k);
for(i = 0; i < data->k; i++)
{
@@ -835,6 +851,7 @@ cmph_uint32 brz_packed_size(cmph_t *mphf)
CMPH_HASH h0_type = hash_get_type(data->h0);
CMPH_HASH h1_type = hash_get_type(data->h1[0]);
CMPH_HASH h2_type = hash_get_type(data->h2[0]);
+ cmph_uint32 n;
size = (cmph_uint32)(2*sizeof(CMPH_ALGO) + 3*sizeof(CMPH_HASH) + hash_state_packed_size(h0_type) + sizeof(cmph_uint32) +
sizeof(double) + sizeof(cmph_uint8)*data->k + sizeof(cmph_uint32)*data->k);
// pointers to g_is
@@ -847,7 +864,7 @@ cmph_uint32 brz_packed_size(cmph_t *mphf)
size += hash_state_packed_size(h1_type) * data->k;
size += hash_state_packed_size(h2_type) * data->k;
- cmph_uint32 n = 0;
+ n = 0;
for(i = 0; i < data->k; i++)
{
switch(data->algo)
@@ -871,47 +888,57 @@ static cmph_uint32 brz_bmz8_search_packed(cmph_uint32 *packed_mphf, const char *
{
register CMPH_HASH h0_type = *packed_mphf++;
register cmph_uint32 *h0_ptr = packed_mphf;
+ register cmph_uint32 k, h0, m, n, h1, h2;
+ register cmph_uint32 *offset;
+ register double c;
+ register CMPH_HASH h1_type, h2_type;
+ register cmph_uint8 * size;
+#if defined (__ia64) || defined (__x86_64__)
+ register cmph_uint64 * g_is_ptr;
+#else
+ register cmph_uint32 * g_is_ptr;
+#endif
+ register cmph_uint8 *h1_ptr, *h2_ptr, *g;
+ register cmph_uint8 mphf_bucket;
+
packed_mphf = (cmph_uint32 *)(((cmph_uint8 *)packed_mphf) + hash_state_packed_size(h0_type));
- register cmph_uint32 k = *packed_mphf++;
+ k = *packed_mphf++;
- register double c = (double)(*((cmph_uint64*)packed_mphf));
+ c = (double)(*((cmph_uint64*)packed_mphf));
packed_mphf += 2;
- register CMPH_HASH h1_type = *packed_mphf++;
+ h1_type = *packed_mphf++;
- register CMPH_HASH h2_type = *packed_mphf++;
+ h2_type = *packed_mphf++;
- register cmph_uint8 * size = (cmph_uint8 *) packed_mphf;
+ size = (cmph_uint8 *) packed_mphf;
packed_mphf = (cmph_uint32 *)(size + k);
- register cmph_uint32 * offset = packed_mphf;
+ offset = packed_mphf;
packed_mphf += k;
- register cmph_uint32 h0;
hash_vector_packed(h0_ptr, h0_type, key, keylen, fingerprint);
h0 = fingerprint[2] % k;
- register cmph_uint32 m = size[h0];
- register cmph_uint32 n = (cmph_uint32)ceil(c * m);
+ m = size[h0];
+ n = (cmph_uint32)ceil(c * m);
#if defined (__ia64) || defined (__x86_64__)
- register cmph_uint64 * g_is_ptr = (cmph_uint64 *)packed_mphf;
+ g_is_ptr = (cmph_uint64 *)packed_mphf;
#else
- register cmph_uint32 * g_is_ptr = packed_mphf;
+ g_is_ptr = packed_mphf;
#endif
- register cmph_uint8 * h1_ptr = (cmph_uint8 *) g_is_ptr[h0];
+ h1_ptr = (cmph_uint8 *) g_is_ptr[h0];
- register cmph_uint8 * h2_ptr = h1_ptr + hash_state_packed_size(h1_type);
+ h2_ptr = h1_ptr + hash_state_packed_size(h1_type);
- register cmph_uint8 * g = h2_ptr + hash_state_packed_size(h2_type);
+ g = h2_ptr + hash_state_packed_size(h2_type);
- register cmph_uint32 h1 = hash_packed(h1_ptr, h1_type, key, keylen) % n;
- register cmph_uint32 h2 = hash_packed(h2_ptr, h2_type, key, keylen) % n;
-
- register cmph_uint8 mphf_bucket;
+ h1 = hash_packed(h1_ptr, h1_type, key, keylen) % n;
+ h2 = hash_packed(h2_ptr, h2_type, key, keylen) % n;
if (h1 == h2 && ++h2 >= n) h2 = 0;
mphf_bucket = (cmph_uint8)(g[h1] + g[h2]);
@@ -925,49 +952,59 @@ static cmph_uint32 brz_fch_search_packed(cmph_uint32 *packed_mphf, const char *k
register CMPH_HASH h0_type = *packed_mphf++;
register cmph_uint32 *h0_ptr = packed_mphf;
+ register cmph_uint32 k, h0, m, b, h1, h2;
+ register double c, p1, p2;
+ register CMPH_HASH h1_type, h2_type;
+ register cmph_uint8 *size, *h1_ptr, *h2_ptr, *g;
+ register cmph_uint32 *offset;
+#if defined (__ia64) || defined (__x86_64__)
+ register cmph_uint64 * g_is_ptr;
+#else
+ register cmph_uint32 * g_is_ptr;
+#endif
+ register cmph_uint8 mphf_bucket;
+
packed_mphf = (cmph_uint32 *)(((cmph_uint8 *)packed_mphf) + hash_state_packed_size(h0_type));
- register cmph_uint32 k = *packed_mphf++;
+ k = *packed_mphf++;
- register double c = (double)(*((cmph_uint64*)packed_mphf));
+ c = (double)(*((cmph_uint64*)packed_mphf));
packed_mphf += 2;
- register CMPH_HASH h1_type = *packed_mphf++;
+ h1_type = *packed_mphf++;
- register CMPH_HASH h2_type = *packed_mphf++;
+ h2_type = *packed_mphf++;
- register cmph_uint8 * size = (cmph_uint8 *) packed_mphf;
+ size = (cmph_uint8 *) packed_mphf;
packed_mphf = (cmph_uint32 *)(size + k);
- register cmph_uint32 * offset = packed_mphf;
+ offset = packed_mphf;
packed_mphf += k;
- register cmph_uint32 h0;
-
hash_vector_packed(h0_ptr, h0_type, key, keylen, fingerprint);
h0 = fingerprint[2] % k;
- register cmph_uint32 m = size[h0];
- register cmph_uint32 b = fch_calc_b(c, m);
- register double p1 = fch_calc_p1(m);
- register double p2 = fch_calc_p2(b);
+ m = size[h0];
+ b = fch_calc_b(c, m);
+ p1 = fch_calc_p1(m);
+ p2 = fch_calc_p2(b);
#if defined (__ia64) || defined (__x86_64__)
- register cmph_uint64 * g_is_ptr = (cmph_uint64 *)packed_mphf;
+ g_is_ptr = (cmph_uint64 *)packed_mphf;
#else
- register cmph_uint32 * g_is_ptr = packed_mphf;
+ g_is_ptr = packed_mphf;
#endif
- register cmph_uint8 * h1_ptr = (cmph_uint8 *) g_is_ptr[h0];
+ h1_ptr = (cmph_uint8 *) g_is_ptr[h0];
- register cmph_uint8 * h2_ptr = h1_ptr + hash_state_packed_size(h1_type);
+ h2_ptr = h1_ptr + hash_state_packed_size(h1_type);
- register cmph_uint8 * g = h2_ptr + hash_state_packed_size(h2_type);
+ g = h2_ptr + hash_state_packed_size(h2_type);
- register cmph_uint32 h1 = hash_packed(h1_ptr, h1_type, key, keylen) % m;
- register cmph_uint32 h2 = hash_packed(h2_ptr, h2_type, key, keylen) % m;
+ h1 = hash_packed(h1_ptr, h1_type, key, keylen) % m;
+ h2 = hash_packed(h2_ptr, h2_type, key, keylen) % m;
- register cmph_uint8 mphf_bucket = 0;
+ mphf_bucket = 0;
h1 = mixh10h11h12(b, p1, p2, h1);
mphf_bucket = (cmph_uint8)((h2 + g[h1]) % m);
return (mphf_bucket + offset[h0]);
diff --git a/girepository/cmph/chd.c b/girepository/cmph/chd.c
index 71579ee3..46aec52d 100644
--- a/girepository/cmph/chd.c
+++ b/girepository/cmph/chd.c
@@ -190,9 +190,10 @@ void chd_load(FILE *fd, cmph_t *mphf)
DEBUGP("Loading Compressed rank structure, which has %u bytes\n", chd->packed_cr_size);
chd->packed_cr = (cmph_uint8 *) calloc((size_t)chd->packed_cr_size, (size_t)1);
nbytes = fread(chd->packed_cr, chd->packed_cr_size, (size_t)1, fd);
- if (nbytes == 0 && ferror(fd)) {
+ if (nbytes == 0 && ferror(fd)) {
fprintf(stderr, "ERROR: %s\n", strerror(errno));
}
+
}
int chd_dump(cmph_t *mphf, FILE *fd)
@@ -207,13 +208,14 @@ int chd_dump(cmph_t *mphf, FILE *fd)
nbytes = fwrite(&data->packed_chd_phf_size, sizeof(cmph_uint32), (size_t)1, fd);
nbytes = fwrite(data->packed_chd_phf, data->packed_chd_phf_size, (size_t)1, fd);
- DEBUGP("Dumping compressed rank structure with %u bytes to disk\n", buflen);
+ DEBUGP("Dumping compressed rank structure with %u bytes to disk\n", data->packed_cr_size);
nbytes = fwrite(&data->packed_cr_size, sizeof(cmph_uint32), (size_t)1, fd);
nbytes = fwrite(data->packed_cr, data->packed_cr_size, (size_t)1, fd);
- if (nbytes == 0 && ferror(fd)) {
+ if (nbytes == 0 && ferror(fd)) {
fprintf(stderr, "ERROR: %s\n", strerror(errno));
return 0;
}
+
return 1;
}
diff --git a/girepository/cmph/chd_ph.c b/girepository/cmph/chd_ph.c
index 6cd9437a..8356bded 100644
--- a/girepository/cmph/chd_ph.c
+++ b/girepository/cmph/chd_ph.c
@@ -193,8 +193,9 @@ void chd_ph_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs)
void chd_ph_config_set_b(cmph_config_t *mph, cmph_uint32 keys_per_bucket)
{
+ chd_ph_config_data_t *chd_ph;
assert(mph);
- chd_ph_config_data_t *chd_ph = (chd_ph_config_data_t *)mph->data;
+ chd_ph = (chd_ph_config_data_t *)mph->data;
if(keys_per_bucket < 1 || keys_per_bucket >= 15)
{
keys_per_bucket = 4;
@@ -205,8 +206,9 @@ void chd_ph_config_set_b(cmph_config_t *mph, cmph_uint32 keys_per_bucket)
void chd_ph_config_set_keys_per_bin(cmph_config_t *mph, cmph_uint32 keys_per_bin)
{
+ chd_ph_config_data_t *chd_ph;
assert(mph);
- chd_ph_config_data_t *chd_ph = (chd_ph_config_data_t *)mph->data;
+ chd_ph = (chd_ph_config_data_t *)mph->data;
if(keys_per_bin <= 1 || keys_per_bin >= 128)
{
keys_per_bin = 1;
@@ -860,9 +862,10 @@ void chd_ph_load(FILE *fd, cmph_t *mphf)
DEBUGP("Reading n and nbuckets\n");
nbytes = fread(&(chd_ph->n), sizeof(cmph_uint32), (size_t)1, fd);
nbytes = fread(&(chd_ph->nbuckets), sizeof(cmph_uint32), (size_t)1, fd);
- if (nbytes == 0 && ferror(fd)) {
+ if (nbytes == 0 && ferror(fd)) {
fprintf(stderr, "ERROR: %s\n", strerror(errno));
}
+
}
int chd_ph_dump(cmph_t *mphf, FILE *fd)
@@ -889,7 +892,7 @@ int chd_ph_dump(cmph_t *mphf, FILE *fd)
// dumping n and nbuckets
nbytes = fwrite(&(data->n), sizeof(cmph_uint32), (size_t)1, fd);
nbytes = fwrite(&(data->nbuckets), sizeof(cmph_uint32), (size_t)1, fd);
- if (nbytes == 0 && ferror(fd)) {
+ if (nbytes == 0 && ferror(fd)) {
fprintf(stderr, "ERROR: %s\n", strerror(errno));
return 0;
}
diff --git a/girepository/cmph/chm.c b/girepository/cmph/chm.c
index 3af8c806..36a07a0d 100644
--- a/girepository/cmph/chm.c
+++ b/girepository/cmph/chm.c
@@ -226,7 +226,7 @@ int chm_dump(cmph_t *mphf, FILE *fd)
nbytes = fwrite(&(data->m), sizeof(cmph_uint32), (size_t)1, fd);
nbytes = fwrite(data->g, sizeof(cmph_uint32)*data->n, (size_t)1, fd);
- if (nbytes == 0 && ferror(fd)) {
+ if (nbytes == 0 && ferror(fd)) {
fprintf(stderr, "ERROR: %s\n", strerror(errno));
return 0;
}
@@ -270,7 +270,7 @@ void chm_load(FILE *f, cmph_t *mphf)
chm->g = (cmph_uint32 *)malloc(sizeof(cmph_uint32)*chm->n);
nbytes = fread(chm->g, chm->n*sizeof(cmph_uint32), (size_t)1, f);
- if (nbytes == 0 && ferror(f)) {
+ if (nbytes == 0 && ferror(f)) {
fprintf(stderr, "ERROR: %s\n", strerror(errno));
return;
}
@@ -313,6 +313,7 @@ void chm_pack(cmph_t *mphf, void *packed_mphf)
{
chm_data_t *data = (chm_data_t *)mphf->data;
cmph_uint8 * ptr = packed_mphf;
+ CMPH_HASH h2_type;
// packing h1 type
CMPH_HASH h1_type = hash_get_type(data->hashes[0]);
@@ -324,7 +325,7 @@ void chm_pack(cmph_t *mphf, void *packed_mphf)
ptr += hash_state_packed_size(h1_type);
// packing h2 type
- CMPH_HASH h2_type = hash_get_type(data->hashes[1]);
+ h2_type = hash_get_type(data->hashes[1]);
*((cmph_uint32 *) ptr) = h2_type;
ptr += sizeof(cmph_uint32);
@@ -370,19 +371,24 @@ cmph_uint32 chm_search_packed(void *packed_mphf, const char *key, cmph_uint32 ke
{
register cmph_uint8 *h1_ptr = packed_mphf;
register CMPH_HASH h1_type = *((cmph_uint32 *)h1_ptr);
+ register cmph_uint8 *h2_ptr;
+ register CMPH_HASH h2_type;
+ register cmph_uint32 *g_ptr;
+ register cmph_uint32 n, m, h1, h2;
+
h1_ptr += 4;
- register cmph_uint8 *h2_ptr = h1_ptr + hash_state_packed_size(h1_type);
- register CMPH_HASH h2_type = *((cmph_uint32 *)h2_ptr);
+ h2_ptr = h1_ptr + hash_state_packed_size(h1_type);
+ h2_type = *((cmph_uint32 *)h2_ptr);
h2_ptr += 4;
- register cmph_uint32 *g_ptr = (cmph_uint32 *)(h2_ptr + hash_state_packed_size(h2_type));
+ g_ptr = (cmph_uint32 *)(h2_ptr + hash_state_packed_size(h2_type));
- register cmph_uint32 n = *g_ptr++;
- register cmph_uint32 m = *g_ptr++;
+ n = *g_ptr++;
+ m = *g_ptr++;
- register cmph_uint32 h1 = hash_packed(h1_ptr, h1_type, key, keylen) % n;
- register cmph_uint32 h2 = hash_packed(h2_ptr, h2_type, key, keylen) % n;
+ h1 = hash_packed(h1_ptr, h1_type, key, keylen) % n;
+ h2 = hash_packed(h2_ptr, h2_type, key, keylen) % n;
DEBUGP("key: %s h1: %u h2: %u\n", key, h1, h2);
if (h1 == h2 && ++h2 >= n) h2 = 0;
DEBUGP("key: %s g[h1]: %u g[h2]: %u edges: %u\n", key, g_ptr[h1], g_ptr[h2], m);
diff --git a/girepository/cmph/compressed_rank.c b/girepository/cmph/compressed_rank.c
index 822b2e15..8019dbe5 100644
--- a/girepository/cmph/compressed_rank.c
+++ b/girepository/cmph/compressed_rank.c
@@ -83,9 +83,9 @@ cmph_uint32 compressed_rank_query(compressed_rank_t * cr, cmph_uint32 idx)
return cr->n;
}
- val_quot = idx >> cr->rem_r;
- rems_mask = (1U << cr->rem_r) - 1U;
- val_rem = idx & rems_mask;
+ val_quot = idx >> cr->rem_r;
+ rems_mask = (1U << cr->rem_r) - 1U;
+ val_rem = idx & rems_mask;
if(val_quot == 0)
{
rank = sel_res = 0;
@@ -128,6 +128,9 @@ void compressed_rank_dump(compressed_rank_t * cr, char **buf, cmph_uint32 *bufle
register cmph_uint32 pos = 0;
char * buf_sel = 0;
cmph_uint32 buflen_sel = 0;
+#ifdef DEBUG
+ cmph_uint32 i;
+#endif
*buflen = 4*(cmph_uint32)sizeof(cmph_uint32) + sel_size + vals_rems_size;
@@ -164,7 +167,7 @@ void compressed_rank_dump(compressed_rank_t * cr, char **buf, cmph_uint32 *bufle
memcpy(*buf + pos, buf_sel, buflen_sel);
#ifdef DEBUG
- cmph_uint32 i = 0;
+ i = 0;
for(i = 0; i < buflen_sel; i++)
{
DEBUGP("pos = %u -- buf_sel[%u] = %u\n", pos, i, *(*buf + pos + i));
@@ -192,6 +195,9 @@ void compressed_rank_load(compressed_rank_t * cr, const char *buf, cmph_uint32 b
register cmph_uint32 pos = 0;
cmph_uint32 buflen_sel = 0;
register cmph_uint32 vals_rems_size = 0;
+#ifdef DEBUG
+ cmph_uint32 i;
+#endif
// loading max_val, n, and rem_r
memcpy(&(cr->max_val), buf, sizeof(cmph_uint32));
@@ -213,7 +219,7 @@ void compressed_rank_load(compressed_rank_t * cr, const char *buf, cmph_uint32 b
select_load(&cr->sel, buf + pos, buflen_sel);
#ifdef DEBUG
- cmph_uint32 i = 0;
+ i = 0;
for(i = 0; i < buflen_sel; i++)
{
DEBUGP("pos = %u -- buf_sel[%u] = %u\n", pos, i, *(buf + pos + i));
diff --git a/girepository/cmph/compressed_seq.c b/girepository/cmph/compressed_seq.c
index e558196d..e5191fd5 100644
--- a/girepository/cmph/compressed_seq.c
+++ b/girepository/cmph/compressed_seq.c
@@ -167,6 +167,9 @@ void compressed_seq_dump(compressed_seq_t * cs, char ** buf, cmph_uint32 * bufle
register cmph_uint32 pos = 0;
char * buf_sel = 0;
cmph_uint32 buflen_sel = 0;
+#ifdef DEBUG
+ cmph_uint32 i;
+#endif
*buflen = 4*(cmph_uint32)sizeof(cmph_uint32) + sel_size + length_rems_size + store_table_size;
@@ -202,8 +205,8 @@ void compressed_seq_dump(compressed_seq_t * cs, char ** buf, cmph_uint32 * bufle
DEBUGP("buflen_sel = %u\n", buflen_sel);
memcpy(*buf + pos, buf_sel, buflen_sel);
- #ifdef DEBUG
- cmph_uint32 i = 0;
+ #ifdef DEBUG
+ i = 0;
for(i = 0; i < buflen_sel; i++)
{
DEBUGP("pos = %u -- buf_sel[%u] = %u\n", pos, i, *(*buf + pos + i));
@@ -215,7 +218,7 @@ void compressed_seq_dump(compressed_seq_t * cs, char ** buf, cmph_uint32 * bufle
// dumping length_rems
memcpy(*buf + pos, cs->length_rems, length_rems_size);
- #ifdef DEBUG
+ #ifdef DEBUG
for(i = 0; i < length_rems_size; i++)
{
DEBUGP("pos = %u -- length_rems_size = %u -- length_rems[%u] = %u\n", pos, length_rems_size, i, *(*buf + pos + i));
@@ -226,7 +229,7 @@ void compressed_seq_dump(compressed_seq_t * cs, char ** buf, cmph_uint32 * bufle
// dumping store_table
memcpy(*buf + pos, cs->store_table, store_table_size);
- #ifdef DEBUG
+ #ifdef DEBUG
for(i = 0; i < store_table_size; i++)
{
DEBUGP("pos = %u -- store_table_size = %u -- store_table[%u] = %u\n", pos, store_table_size, i, *(*buf + pos + i));
@@ -241,6 +244,9 @@ void compressed_seq_load(compressed_seq_t * cs, const char * buf, cmph_uint32 bu
cmph_uint32 buflen_sel = 0;
register cmph_uint32 length_rems_size = 0;
register cmph_uint32 store_table_size = 0;
+#ifdef DEBUG
+ cmph_uint32 i;
+#endif
// loading n, rem_r and total_length
memcpy(&(cs->n), buf, sizeof(cmph_uint32));
@@ -261,8 +267,8 @@ void compressed_seq_load(compressed_seq_t * cs, const char * buf, cmph_uint32 bu
DEBUGP("buflen_sel = %u\n", buflen_sel);
select_load(&cs->sel, buf + pos, buflen_sel);
- #ifdef DEBUG
- cmph_uint32 i = 0;
+ #ifdef DEBUG
+ i = 0;
for(i = 0; i < buflen_sel; i++)
{
DEBUGP("pos = %u -- buf_sel[%u] = %u\n", pos, i, *(buf + pos + i));
@@ -280,7 +286,7 @@ void compressed_seq_load(compressed_seq_t * cs, const char * buf, cmph_uint32 bu
length_rems_size *= 4;
memcpy(cs->length_rems, buf + pos, length_rems_size);
- #ifdef DEBUG
+ #ifdef DEBUG
for(i = 0; i < length_rems_size; i++)
{
DEBUGP("pos = %u -- length_rems_size = %u -- length_rems[%u] = %u\n", pos, length_rems_size, i, *(buf + pos + i));
@@ -298,7 +304,7 @@ void compressed_seq_load(compressed_seq_t * cs, const char * buf, cmph_uint32 bu
store_table_size *= 4;
memcpy(cs->store_table, buf + pos, store_table_size);
- #ifdef DEBUG
+ #ifdef DEBUG
for(i = 0; i < store_table_size; i++)
{
DEBUGP("pos = %u -- store_table_size = %u -- store_table[%u] = %u\n", pos, store_table_size, i, *(buf + pos + i));
@@ -336,19 +342,19 @@ cmph_uint32 compressed_seq_query_packed(void * cs_packed, cmph_uint32 idx)
register cmph_uint32 *ptr = (cmph_uint32 *)cs_packed;
register cmph_uint32 n = *ptr++;
register cmph_uint32 rem_r = *ptr++;
+ register cmph_uint32 buflen_sel, length_rems_size, enc_idx, enc_length;
+ // compressed sequence query computation
+ register cmph_uint32 rems_mask, stored_value, sel_res;
+ register cmph_uint32 *sel_packed, *length_rems, *store_table;
+
ptr++; // skipping total_length
// register cmph_uint32 total_length = *ptr++;
- register cmph_uint32 buflen_sel = *ptr++;
- register cmph_uint32 * sel_packed = ptr;
- register cmph_uint32 * length_rems = (ptr += (buflen_sel >> 2));
- register cmph_uint32 length_rems_size = BITS_TABLE_SIZE(n, rem_r);
- register cmph_uint32 * store_table = (ptr += length_rems_size);
+ buflen_sel = *ptr++;
+ sel_packed = ptr;
+ length_rems = (ptr += (buflen_sel >> 2));
+ length_rems_size = BITS_TABLE_SIZE(n, rem_r);
+ store_table = (ptr += length_rems_size);
- // compressed sequence query computation
- register cmph_uint32 enc_idx, enc_length;
- register cmph_uint32 rems_mask;
- register cmph_uint32 stored_value;
- register cmph_uint32 sel_res;
rems_mask = (1U << rem_r) - 1U;
diff --git a/girepository/cmph/fch.c b/girepository/cmph/fch.c
index f6e16e34..33b959e2 100644
--- a/girepository/cmph/fch.c
+++ b/girepository/cmph/fch.c
@@ -10,6 +10,7 @@
#include <assert.h>
#include <string.h>
#include <errno.h>
+
#define INDEX 0 /* alignment index within a bucket */
//#define DEBUG
#include "debug.h"
@@ -320,6 +321,10 @@ int fch_dump(cmph_t *mphf, FILE *fd)
register size_t nbytes;
fch_data_t *data = (fch_data_t *)mphf->data;
+
+#ifdef DEBUG
+ cmph_uint32 i;
+#endif
__cmph_dump(mphf, fd);
hash_state_dump(data->h1, &buf, &buflen);
@@ -340,12 +345,11 @@ int fch_dump(cmph_t *mphf, FILE *fd)
nbytes = fwrite(&(data->p1), sizeof(double), (size_t)1, fd);
nbytes = fwrite(&(data->p2), sizeof(double), (size_t)1, fd);
nbytes = fwrite(data->g, sizeof(cmph_uint32)*(data->b), (size_t)1, fd);
- if (nbytes == 0 && ferror(fd)) {
+ if (nbytes == 0 && ferror(fd)) {
fprintf(stderr, "ERROR: %s\n", strerror(errno));
return 0;
}
#ifdef DEBUG
- cmph_uint32 i;
fprintf(stderr, "G: ");
for (i = 0; i < data->b; ++i) fprintf(stderr, "%u ", data->g[i]);
fprintf(stderr, "\n");
@@ -359,6 +363,9 @@ void fch_load(FILE *f, cmph_t *mphf)
cmph_uint32 buflen;
register size_t nbytes;
fch_data_t *fch = (fch_data_t *)malloc(sizeof(fch_data_t));
+#ifdef DEBUG
+ cmph_uint32 i;
+#endif
//DEBUGP("Loading fch mphf\n");
mphf->data = fch;
@@ -392,12 +399,12 @@ void fch_load(FILE *f, cmph_t *mphf)
fch->g = (cmph_uint32 *)malloc(sizeof(cmph_uint32)*fch->b);
nbytes = fread(fch->g, fch->b*sizeof(cmph_uint32), (size_t)1, f);
- if (nbytes == 0 && ferror(f)) {
+ if (nbytes == 0 && ferror(f)) {
fprintf(stderr, "ERROR: %s\n", strerror(errno));
return;
}
+
#ifdef DEBUG
- cmph_uint32 i;
fprintf(stderr, "G: ");
for (i = 0; i < fch->b; ++i) fprintf(stderr, "%u ", fch->g[i]);
fprintf(stderr, "\n");
@@ -436,6 +443,7 @@ void fch_pack(cmph_t *mphf, void *packed_mphf)
// packing h1 type
CMPH_HASH h1_type = hash_get_type(data->h1);
+ CMPH_HASH h2_type;
*((cmph_uint32 *) ptr) = h1_type;
ptr += sizeof(cmph_uint32);
@@ -444,7 +452,7 @@ void fch_pack(cmph_t *mphf, void *packed_mphf)
ptr += hash_state_packed_size(h1_type);
// packing h2 type
- CMPH_HASH h2_type = hash_get_type(data->h2);
+ h2_type = hash_get_type(data->h2);
*((cmph_uint32 *) ptr) = h2_type;
ptr += sizeof(cmph_uint32);
@@ -499,27 +507,32 @@ cmph_uint32 fch_search_packed(void *packed_mphf, const char *key, cmph_uint32 ke
{
register cmph_uint8 *h1_ptr = packed_mphf;
register CMPH_HASH h1_type = *((cmph_uint32 *)h1_ptr);
+ register cmph_uint8 *h2_ptr;
+ register CMPH_HASH h2_type;
+ register cmph_uint32 *g_ptr;
+ register cmph_uint32 m, b, h1, h2;
+ register double p1, p2;
+
h1_ptr += 4;
- register cmph_uint8 *h2_ptr = h1_ptr + hash_state_packed_size(h1_type);
- register CMPH_HASH h2_type = *((cmph_uint32 *)h2_ptr);
+ h2_ptr = h1_ptr + hash_state_packed_size(h1_type);
+ h2_type = *((cmph_uint32 *)h2_ptr);
h2_ptr += 4;
- register cmph_uint32 *g_ptr = (cmph_uint32 *)(h2_ptr + hash_state_packed_size(h2_type));
+ g_ptr = (cmph_uint32 *)(h2_ptr + hash_state_packed_size(h2_type));
- register cmph_uint32 m = *g_ptr++;
+ m = *g_ptr++;
- register cmph_uint32 b = *g_ptr++;
+ b = *g_ptr++;
- register double p1 = (double)(*((cmph_uint64 *)g_ptr));
+ p1 = (double)(*((cmph_uint64 *)g_ptr));
g_ptr += 2;
- register double p2 = (double)(*((cmph_uint64 *)g_ptr));
+ p2 = (double)(*((cmph_uint64 *)g_ptr));
g_ptr += 2;
- register cmph_uint32 h1 = hash_packed(h1_ptr, h1_type, key, keylen) % m;
- register cmph_uint32 h2 = hash_packed(h2_ptr, h2_type, key, keylen) % m;
-
+ h1 = hash_packed(h1_ptr, h1_type, key, keylen) % m;
+ h2 = hash_packed(h2_ptr, h2_type, key, keylen) % m;
h1 = mixh10h11h12 (b, p1, p2, h1);
return (h2 + g_ptr[h1]) % m;
}
diff --git a/girepository/glib-compat.h b/girepository/docs.c
index 2518092c..a4798c41 100644
--- a/girepository/glib-compat.h
+++ b/girepository/docs.c
@@ -1,7 +1,7 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
- * GObject introspection: Compatibility definitions
+ * GObject introspection: Dump introspection data
*
- * Copyright (C) 2009 Javier Jardón
+ * Copyright (C) 2013 Dieter Verfaillie <dieterv@optionexplicit.be>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -19,7 +19,15 @@
* Boston, MA 02111-1307, USA.
*/
+/* This file collects documentation for macros, typedefs and
+ * the like, which have no good home in any of the 'real' source
+ * files.
+ */
-#if !GLIB_CHECK_VERSION(2,22,0)
-#define g_mapped_file_unref(x) g_mapped_file_free(x)
-#endif
+/**
+ * SECTION:gicommontypes
+ * @title: common types
+ * @short_description: TODO
+ *
+ * TODO
+ */
diff --git a/girepository/gdump.c b/girepository/gdump.c
index 7e02d391..a72841fe 100644
--- a/girepository/gdump.c
+++ b/girepository/gdump.c
@@ -38,6 +38,9 @@
#include <string.h>
static void
+escaped_printf (GOutputStream *out, const char *fmt, ...) G_GNUC_PRINTF (2, 3);
+
+static void
escaped_printf (GOutputStream *out, const char *fmt, ...)
{
char *str;
@@ -422,8 +425,10 @@ dump_error_quark (GQuark quark, const char *symbol, GOutputStream *out)
*
* Argument specified is a comma-separated pair of filenames; i.e. of
* the form "input.txt,output.xml". The input file should be a
- * UTF-8 Unix-line-ending text file, with each line containing the name
- * of a GType _get_type function.
+ * UTF-8 Unix-line-ending text file, with each line containing either
+ * "get-type:" followed by the name of a GType _get_type function, or
+ * "error-quark:" followed by the name of an error quark function. No
+ * extra whitespace is allowed.
*
* The output file should already exist, but be empty. This function will
* overwrite its contents.
diff --git a/girepository/gi-dump-types.c b/girepository/gi-dump-types.c
index 13e7ae68..69d8b12d 100644
--- a/girepository/gi-dump-types.c
+++ b/girepository/gi-dump-types.c
@@ -10,8 +10,6 @@ main (int argc,
GOutputStream *stdout;
GModule *self;
- g_type_init ();
-
stdout = g_unix_output_stream_new (1, FALSE);
self = g_module_open (NULL, 0);
diff --git a/girepository/giarginfo.c b/girepository/giarginfo.c
index d61f4be2..572839c3 100644
--- a/girepository/giarginfo.c
+++ b/girepository/giarginfo.c
@@ -26,12 +26,12 @@
#include "girepository-private.h"
-/* GIArgInfo function */
+/* GIArgInfo functions */
/**
* SECTION:giarginfo
- * @Short_description: Struct representing an argument
- * @Title: GIArgInfo
+ * @title: GIArgInfo
+ * @short_description: Struct representing an argument
*
* GIArgInfo represents an argument. An argument is always
* part of a #GICallableInfo.
@@ -293,8 +293,9 @@ g_arg_info_get_destroy (GIArgInfo *info)
*
* Obtain the type information for @info.
*
- * Returns: (transfer full): the #GIArgInfo, free it with
- * g_base_info_unref() when done.
+ * Returns: (transfer full): the #GITypeInfo holding the type
+ * information for @info, free it with g_base_info_unref()
+ * when done.
*/
GITypeInfo *
g_arg_info_get_type (GIArgInfo *info)
diff --git a/girepository/giarginfo.h b/girepository/giarginfo.h
index 3f4163e3..4045ab9c 100644
--- a/girepository/giarginfo.h
+++ b/girepository/giarginfo.h
@@ -31,6 +31,12 @@
G_BEGIN_DECLS
+/**
+ * GI_IS_ARG_INFO
+ * @info: an info structure
+ *
+ * Checks if @info is a GIArgInfo.
+ */
#define GI_IS_ARG_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_ARG)
diff --git a/girepository/gibaseinfo.c b/girepository/gibaseinfo.c
index ff9c9395..4bbe850a 100644
--- a/girepository/gibaseinfo.c
+++ b/girepository/gibaseinfo.c
@@ -71,6 +71,17 @@ _g_info_new_full (GIInfoType type,
return (GIBaseInfo*)info;
}
+/**
+ * g_info_new:
+ * @type: TODO
+ * @container: TODO
+ * @typelib: TODO
+ * @offset: TODO
+ *
+ * TODO
+ *
+ * Returns: TODO
+ */
GIBaseInfo *
g_info_new (GIInfoType type,
GIBaseInfo *container,
@@ -169,8 +180,8 @@ _g_type_info_init (GIBaseInfo *info,
/**
* SECTION:gibaseinfo
- * @Short_description: Base struct for all GITypelib structs
- * @Title: GIBaseInfo
+ * @title: GIBaseInfo
+ * @short_description: Base struct for all GITypelib structs
*
* GIBaseInfo is the common base struct of all other *Info structs
* accessible through the #GIRepository API.
@@ -209,7 +220,6 @@ _g_type_info_init (GIBaseInfo *info,
* +----<link linkend="gi-GITypeInfo">GITypeInfo</link>
* </synopsis>
* </refsect1>
- *
*/
/**
@@ -226,7 +236,7 @@ g_base_info_ref (GIBaseInfo *info)
GIRealInfo *rinfo = (GIRealInfo*)info;
g_assert (rinfo->ref_count != INVALID_REFCOUNT);
- ((GIRealInfo*)info)->ref_count++;
+ g_atomic_int_inc (&rinfo->ref_count);
return info;
}
@@ -244,21 +254,20 @@ g_base_info_unref (GIBaseInfo *info)
GIRealInfo *rinfo = (GIRealInfo*)info;
g_assert (rinfo->ref_count > 0 && rinfo->ref_count != INVALID_REFCOUNT);
- rinfo->ref_count--;
- if (!rinfo->ref_count)
- {
- if (rinfo->container && ((GIRealInfo *) rinfo->container)->ref_count != INVALID_REFCOUNT)
- g_base_info_unref (rinfo->container);
+ if (!g_atomic_int_dec_and_test (&rinfo->ref_count))
+ return;
- if (rinfo->repository)
- g_object_unref (rinfo->repository);
+ if (rinfo->container && ((GIRealInfo *) rinfo->container)->ref_count != INVALID_REFCOUNT)
+ g_base_info_unref (rinfo->container);
- if (rinfo->type == GI_INFO_TYPE_UNRESOLVED)
- g_slice_free (GIUnresolvedInfo, (GIUnresolvedInfo *) rinfo);
- else
- g_slice_free (GIRealInfo, rinfo);
- }
+ if (rinfo->repository)
+ g_object_unref (rinfo->repository);
+
+ if (rinfo->type == GI_INFO_TYPE_UNRESOLVED)
+ g_slice_free (GIUnresolvedInfo, (GIUnresolvedInfo *) rinfo);
+ else
+ g_slice_free (GIRealInfo, rinfo);
}
/**
diff --git a/girepository/gibaseinfo.h b/girepository/gibaseinfo.h
index 54c8ee4f..a49dd506 100644
--- a/girepository/gibaseinfo.h
+++ b/girepository/gibaseinfo.h
@@ -33,6 +33,11 @@
G_BEGIN_DECLS
+/**
+ * GIBaseInfoStub:
+ *
+ * TODO
+ */
struct _GIBaseInfoStub {
/* <private> */
gint32 dummy1;
diff --git a/girepository/gicallableinfo.c b/girepository/gicallableinfo.c
index 28c5950e..e69e3e9d 100644
--- a/girepository/gicallableinfo.c
+++ b/girepository/gicallableinfo.c
@@ -33,8 +33,8 @@
/**
* SECTION:gicallableinfo
- * @Short_description: Struct representing a callable
- * @Title: GICallableInfo
+ * @title: GICallableInfo
+ * @short_description: Struct representing a callable
*
* GICallableInfo represents an entity which is callable.
* Currently a function (#GIFunctionInfo), virtual function,
@@ -85,9 +85,10 @@ signature_offset (GICallableInfo *info)
* g_callable_info_can_throw_gerror:
* @info: a #GICallableInfo
*
- * Returns: %TRUE if this #GICallableInfo can throw a #GError
+ * TODO
*
* Since: 1.34
+ * Returns: %TRUE if this #GICallableInfo can throw a #GError
*/
gboolean
g_callable_info_can_throw_gerror (GICallableInfo *info)
@@ -128,6 +129,7 @@ g_callable_info_can_throw_gerror (GICallableInfo *info)
* is one more C argument than is exposed by introspection: the "self"
* or "this" object.
*
+ * Returns: %TRUE if @info is a method, %FALSE otherwise
* Since: 1.34
*/
gboolean
@@ -430,11 +432,17 @@ g_callable_info_iterate_return_attributes (GICallableInfo *info,
return TRUE;
}
-/* Extract the correct bits from an ffi_arg return value into
+/**
+ * gi_type_info_extract_ffi_return_value:
+ * @return_info: TODO
+ * @ffi_value: TODO
+ * @arg: (out caller-allocates): TODO
+ *
+ * Extract the correct bits from an ffi_arg return value into
* GIArgument: https://bugzilla.gnome.org/show_bug.cgi?id=665152
*
- * Also see the ffi_call man page - the storage requirements for return
- * values are "special".
+ * Also see <citerefentry><refentrytitle>ffi_call</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ * - the storage requirements for return values are "special".
*/
void
gi_type_info_extract_ffi_return_value (GITypeInfo *return_info,
@@ -501,6 +509,21 @@ gi_type_info_extract_ffi_return_value (GITypeInfo *return_info,
}
}
+/**
+ * g_callable_info_invoke:
+ * @info: TODO
+ * @function: TODO
+ * @in_args: TODO
+ * @n_in_args: TODO
+ * @out_args: TODO
+ * @n_out_args: TODO
+ * @return_value: TODO
+ * @is_method: TODO
+ * @throws: TODO
+ * @error: TODO
+ *
+ * TODO
+ */
gboolean
g_callable_info_invoke (GIFunctionInfo *info,
gpointer function,
diff --git a/girepository/gicallableinfo.h b/girepository/gicallableinfo.h
index a7d7079a..71f9d0c6 100644
--- a/girepository/gicallableinfo.h
+++ b/girepository/gicallableinfo.h
@@ -31,6 +31,12 @@
G_BEGIN_DECLS
+/**
+ * GI_IS_CALLABLE_INFO
+ * @info: an info structure
+ *
+ * Checks if @info is a #GICallableInfo or derived from it.
+ */
#define GI_IS_CALLABLE_INFO(info) \
((g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_FUNCTION) || \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_CALLBACK) || \
diff --git a/girepository/giconstantinfo.c b/girepository/giconstantinfo.c
index 88220b4e..7b2f716c 100644
--- a/girepository/giconstantinfo.c
+++ b/girepository/giconstantinfo.c
@@ -29,8 +29,8 @@
/**
* SECTION:giconstantinfo
- * @Short_description: Struct representing a constant
- * @Title: GIConstantInfo
+ * @title: GIConstantInfo
+ * @short_description: Struct representing a constant
*
* GIConstantInfo represents a constant. A constant has a type associated
* which can be obtained by calling g_constant_info_get_type() and a value,
diff --git a/girepository/giconstantinfo.h b/girepository/giconstantinfo.h
index 2bbf9569..2ce1dcad 100644
--- a/girepository/giconstantinfo.h
+++ b/girepository/giconstantinfo.h
@@ -31,6 +31,12 @@
G_BEGIN_DECLS
+/**
+ * GI_IS_CONSTANT_INFO
+ * @info: an info structure
+ *
+ * Checks if @info is a #GIConstantInfo.
+ */
#define GI_IS_CONSTANT_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_CONSTANT)
diff --git a/girepository/gienuminfo.c b/girepository/gienuminfo.c
index a9b7c1df..253ec684 100644
--- a/girepository/gienuminfo.c
+++ b/girepository/gienuminfo.c
@@ -28,8 +28,8 @@
/**
* SECTION:gienuminfo
- * @Short_description: Structs representing an enumeration and its values
- * @Title: GIEnumInfo
+ * @title: GIEnumInfo
+ * @short_description: Structs representing an enumeration and its values
*
* A GIEnumInfo represents an enumeration and a GIValueInfo struct represents a value
* of an enumeration. The GIEnumInfo contains a set of values and a type
@@ -46,13 +46,13 @@
*/
/**
-* g_enum_info_get_n_values:
-* @info: a #GIEnumInfo
-*
-* Obtain the number of values this enumeration contains.
-*
-* Returns: the number of enumeration values
-*/
+ * g_enum_info_get_n_values:
+ * @info: a #GIEnumInfo
+ *
+ * Obtain the number of values this enumeration contains.
+ *
+ * Returns: the number of enumeration values
+ */
gint
g_enum_info_get_n_values (GIEnumInfo *info)
{
@@ -67,6 +67,17 @@ g_enum_info_get_n_values (GIEnumInfo *info)
return blob->n_values;
}
+/**
+ * g_enum_info_get_error_domain:
+ * @info: a #GIEnumInfo
+ *
+ * Obtain the string form of the quark for the error domain associated with
+ * this enum, if any.
+ *
+ * Returns: (transfer none): the string form of the error domain associated
+ * with this enum, or %NULL.
+ * Since: 1.29.17
+ */
const gchar *
g_enum_info_get_error_domain (GIEnumInfo *info)
{
@@ -119,7 +130,6 @@ g_enum_info_get_value (GIEnumInfo *info,
* Obtain the number of methods that this enum type has.
*
* Returns: number of methods
- *
* Since: 1.29.17
*/
gint
@@ -145,7 +155,6 @@ g_enum_info_get_n_methods (GIEnumInfo *info)
*
* Returns: (transfer full): the #GIFunctionInfo. Free the struct by calling
* g_base_info_unref() when done.
- *
* Since: 1.29.17
*/
GIFunctionInfo *
@@ -177,12 +186,12 @@ g_enum_info_get_method (GIEnumInfo *info,
*
* Obtain the tag of the type used for the enum in the C ABI. This will
* will be a signed or unsigned integral type.
-
+ *
* Note that in the current implementation the width of the type is
* computed correctly, but the signed or unsigned nature of the type
* may not match the sign of the type used by the C compiler.
*
- * Return Value: the storage type for the enumeration
+ * Returns: the storage type for the enumeration
*/
GITypeTag
g_enum_info_get_storage_type (GIEnumInfo *info)
diff --git a/girepository/gienuminfo.h b/girepository/gienuminfo.h
index 0b9a9e1b..257e4c12 100644
--- a/girepository/gienuminfo.h
+++ b/girepository/gienuminfo.h
@@ -31,10 +31,22 @@
G_BEGIN_DECLS
+/**
+ * GI_IS_ENUM_INFO
+ * @info: an info structure
+ *
+ * Checks if @info is a #GIEnumInfo.
+ */
#define GI_IS_ENUM_INFO(info) \
((g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_ENUM) || \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_FLAGS))
+/**
+ * GI_IS_VALUE_INFO
+ * @info: an info structure
+ *
+ * Checks if @info is a #GIValueInfo.
+ */
#define GI_IS_VALUE_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_VALUE)
diff --git a/girepository/gifieldinfo.c b/girepository/gifieldinfo.c
index 1d9a20dd..2bbc0214 100644
--- a/girepository/gifieldinfo.c
+++ b/girepository/gifieldinfo.c
@@ -29,13 +29,13 @@
/**
* SECTION:gifieldinfo
- * @Short_description: Struct representing a struct or union field
- * @Title: GIFieldInfo
+ * @title: GIFieldInfo
+ * @short_description: Struct representing a struct or union field
*
* A GIFieldInfo struct represents a field of a struct (see #GIStructInfo),
* union (see #GIUnionInfo) or an object (see #GIObjectInfo). The GIFieldInfo
* is fetched by calling g_struct_info_get_field(), g_union_info_get_field()
- * or g_object_info_get_value().
+ * or g_object_info_get_field().
* A field has a size, type and a struct offset asssociated and a set of flags,
* which is currently #GI_FIELD_IS_READABLE or #GI_FIELD_IS_WRITABLE.
*
@@ -167,7 +167,7 @@ g_field_info_get_type (GIFieldInfo *info)
* @mem: pointer to a block of memory representing a C structure or union
* @value: a #GIArgument into which to store the value retrieved
*
- * Reads a field identified by a #GFieldInfo from a C structure or
+ * Reads a field identified by a #GIFieldInfo from a C structure or
* union. This only handles fields of simple C types. It will fail
* for a field of a composite type like a nested structure or union
* even if that is actually readable.
@@ -355,7 +355,7 @@ g_field_info_get_field (GIFieldInfo *field_info,
* @mem: pointer to a block of memory representing a C structure or union
* @value: a #GIArgument holding the value to store
*
- * Writes a field identified by a #GFieldInfo to a C structure or
+ * Writes a field identified by a #GIFieldInfo to a C structure or
* union. This only handles fields of simple C types. It will fail
* for a field of a composite type like a nested structure or union
* even if that is actually writable. Note also that that it will refuse
diff --git a/girepository/gifieldinfo.h b/girepository/gifieldinfo.h
index 4ca54093..56a2e22e 100644
--- a/girepository/gifieldinfo.h
+++ b/girepository/gifieldinfo.h
@@ -31,6 +31,13 @@
G_BEGIN_DECLS
+/**
+ * GI_IS_FIELD_INFO
+ * @info: an info structure
+ *
+ * Checks if @info is a #GIFieldInfo.
+ *
+ */
#define GI_IS_FIELD_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_FIELD)
diff --git a/girepository/gifunctioninfo.c b/girepository/gifunctioninfo.c
index a5858c76..ecd61275 100644
--- a/girepository/gifunctioninfo.c
+++ b/girepository/gifunctioninfo.c
@@ -30,8 +30,8 @@
/**
* SECTION:gifunctioninfo
- * @Short_description: Struct representing a function
- * @Title: GIFunctionInfo
+ * @title: GIFunctionInfo
+ * @short_description: Struct representing a function
*
* GIFunctionInfo represents a function, method or constructor.
* To find out what kind of entity a #GIFunctionInfo represents, call
@@ -205,6 +205,13 @@ g_function_info_get_vfunc (GIFunctionInfo *info)
return g_interface_info_get_vfunc (container, blob->index);
}
+/**
+ * g_invoke_error_quark:
+ *
+ * TODO
+ *
+ * Returns: TODO
+ */
GQuark
g_invoke_error_quark (void)
{
diff --git a/girepository/gifunctioninfo.h b/girepository/gifunctioninfo.h
index 7a9ecae0..7987c926 100644
--- a/girepository/gifunctioninfo.h
+++ b/girepository/gifunctioninfo.h
@@ -31,6 +31,12 @@
G_BEGIN_DECLS
+/**
+ * GI_IS_FUNCTION_INFO
+ * @info: an info structure
+ *
+ * Checks if @info is a #GIFunctionInfo.
+ */
#define GI_IS_FUNCTION_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_FUNCTION)
@@ -39,6 +45,11 @@ GIFunctionInfoFlags g_function_info_get_flags (GIFunctionInfo *info);
GIPropertyInfo * g_function_info_get_property (GIFunctionInfo *info);
GIVFuncInfo * g_function_info_get_vfunc (GIFunctionInfo *info);
+/**
+ * G_INVOKE_ERROR:
+ *
+ * TODO
+ */
#define G_INVOKE_ERROR (g_invoke_error_quark ())
GQuark g_invoke_error_quark (void);
diff --git a/girepository/giinterfaceinfo.c b/girepository/giinterfaceinfo.c
index f998da44..481fc54e 100644
--- a/girepository/giinterfaceinfo.c
+++ b/girepository/giinterfaceinfo.c
@@ -28,8 +28,8 @@
/**
* SECTION:giinterfaceinfo
- * @Short_description: Struct representing a GInterface
- * @Title: GIInterfaceInfo
+ * @title: GIInterfaceInfo
+ * @short_description: Struct representing a GInterface
*
* GIInterfaceInfo represents a #GInterface type.
*
@@ -297,9 +297,10 @@ g_interface_info_get_signal (GIInterfaceInfo *info,
* @info: a #GIInterfaceInfo
* @name: Name of signal
*
+ * TODO
+ *
* Returns: (transfer full): Info for the signal with name @name in @info, or
* %NULL on failure.
- *
* Since: 1.34
*/
GISignalInfo *
diff --git a/girepository/giinterfaceinfo.h b/girepository/giinterfaceinfo.h
index ce40cda7..ec33a630 100644
--- a/girepository/giinterfaceinfo.h
+++ b/girepository/giinterfaceinfo.h
@@ -31,6 +31,12 @@
G_BEGIN_DECLS
+/**
+ * GI_IS_INTERFACE_INFO
+ * @info: an info structure
+ *
+ * Checks if @info is a #GIInterfaceInfo.
+ */
#define GI_IS_INTERFACE_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_INTERFACE)
diff --git a/girepository/ginvoke.c b/girepository/ginvoke.c
index 5c0ace4c..6eba9fcc 100644
--- a/girepository/ginvoke.c
+++ b/girepository/ginvoke.c
@@ -28,6 +28,13 @@
#include "girffi.h"
#include "config.h"
+/**
+ * value_to_ffi_type:
+ * @gvalue: TODO
+ * @value: TODO
+ *
+ * TODO
+ */
static ffi_type *
value_to_ffi_type (const GValue *gvalue, gpointer *value)
{
@@ -89,7 +96,14 @@ value_to_ffi_type (const GValue *gvalue, gpointer *value)
return rettype;
}
-/* See comment aboe set_gargument_from_ffi_return_value() */
+/**
+ * g_value_to_ffi_return_type:
+ * @gvalue: TODO
+ * @ffi_value: TODO
+ * @value: TODO
+ *
+ * TODO
+ */
static ffi_type *
g_value_to_ffi_return_type (const GValue *gvalue,
const GIArgument *ffi_value,
@@ -153,6 +167,13 @@ g_value_to_ffi_return_type (const GValue *gvalue,
return rettype;
}
+/**
+ * g_value_from_ffi_value:
+ * @gvalue: TODO
+ * @value: TODO
+ *
+ * TODO
+ */
static void
g_value_from_ffi_value (GValue *gvalue,
const GIArgument *value)
@@ -210,6 +231,17 @@ g_value_from_ffi_value (GValue *gvalue,
}
+/**
+ * gi_cclosure_marshal_generic:
+ * @closure: TODO
+ * @return_gvalue: TODO
+ * @n_param_values: TODO
+ * @param_values: TODO
+ * @invocation_hint: TODO
+ * @marshal_data: TODO
+ *
+ * TODO
+ */
void
gi_cclosure_marshal_generic (GClosure *closure,
GValue *return_gvalue,
diff --git a/girepository/giobjectinfo.c b/girepository/giobjectinfo.c
index 7ba2a93b..3e3b312c 100644
--- a/girepository/giobjectinfo.c
+++ b/girepository/giobjectinfo.c
@@ -28,8 +28,8 @@
/**
* SECTION:giobjectinfo
- * @Short_description: Struct representing a GObject
- * @Title: GIObjectInfo
+ * @title: GIObjectInfo
+ * @short_description: Struct representing a GObject
*
* GIObjectInfo represents a #GObject. This doesn't represent a specific
* instance of a GObject, instead this represent the object type (eg class).
@@ -534,7 +534,9 @@ g_object_info_get_signal (GIObjectInfo *info,
* @info: a #GIObjectInfo
* @name: Name of signal
*
- * Returns: Info for the signal with name @name in @info, or %NULL on failure.
+ * TODO
+ *
+ * Returns: (transfer full): Info for the signal with name @name in @info, or %NULL on failure.
*/
GISignalInfo *
g_object_info_find_signal (GIObjectInfo *info,
diff --git a/girepository/giobjectinfo.h b/girepository/giobjectinfo.h
index ee4b8a82..06206776 100644
--- a/girepository/giobjectinfo.h
+++ b/girepository/giobjectinfo.h
@@ -46,7 +46,6 @@ typedef void * (*GIObjectInfoRefFunction) (void *object);
* @object: object instance pointer
*
* Decreases the reference count of an object instance.
- *
*/
typedef void (*GIObjectInfoUnrefFunction) (void *object);
@@ -56,7 +55,6 @@ typedef void (*GIObjectInfoUnrefFunction) (void *object);
* @object: object instance pointer
*
* Update @value and attach the object instance pointer @object to it.
- *
*/
typedef void (*GIObjectInfoSetValueFunction) (GValue *value, void *object);
@@ -70,6 +68,12 @@ typedef void (*GIObjectInfoSetValueFunction) (GValue *value, void *object);
*/
typedef void * (*GIObjectInfoGetValueFunction) (const GValue *value);
+/**
+ * GI_IS_OBJECT_INFO
+ * @info: an info structure
+ *
+ * Checks if @info is a #GIObjectInfo.
+ */
#define GI_IS_OBJECT_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_OBJECT)
diff --git a/girepository/gipropertyinfo.c b/girepository/gipropertyinfo.c
index 61316cb9..77a11cb8 100644
--- a/girepository/gipropertyinfo.c
+++ b/girepository/gipropertyinfo.c
@@ -28,8 +28,8 @@
/**
* SECTION:gipropertyinfo
- * @Short_description: Struct representing a property
- * @Title: GIPropertyInfo
+ * @title: GIPropertyInfo
+ * @short_description: Struct representing a property
*
* GIPropertyInfo represents a property. A property belongs to
* either a #GIObjectInfo or a #GIInterfaceInfo.
@@ -47,7 +47,7 @@
* g_property_info_get_flags:
* @info: a #GIPropertyInfo
*
- * Obtain the flags for this property info. See #GParamFags for
+ * Obtain the flags for this property info. See #GParamFlags for
* more information about possible flag values.
*
* Returns: the flags
diff --git a/girepository/gipropertyinfo.h b/girepository/gipropertyinfo.h
index 14b18b41..7644664b 100644
--- a/girepository/gipropertyinfo.h
+++ b/girepository/gipropertyinfo.h
@@ -31,6 +31,12 @@
G_BEGIN_DECLS
+/**
+ * GI_IS_PROPERTY_INFO
+ * @info: an info structure
+ *
+ * Checks if @info is a #GIPropertyInfo.
+ */
#define GI_IS_PROPERTY_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_PROPERTY)
diff --git a/girepository/giregisteredtypeinfo.c b/girepository/giregisteredtypeinfo.c
index 6e3d31e2..e45e0603 100644
--- a/girepository/giregisteredtypeinfo.c
+++ b/girepository/giregisteredtypeinfo.c
@@ -30,8 +30,8 @@
/**
* SECTION:giregisteredtypeinfo
- * @Short_description: Struct representing a struct with a GType
- * @Title: GIRegisteredTypeInfo
+ * @title: GIRegisteredTypeInfo
+ * @short_description: Struct representing a struct with a GType
*
* GIRegisteredTypeInfo represents an entity with a GType associated. Could
* be either a #GIEnumInfo, #GIInterfaceInfo, #GIObjectInfo, #GIStructInfo or a
diff --git a/girepository/giregisteredtypeinfo.h b/girepository/giregisteredtypeinfo.h
index d46d738b..e5db25b4 100644
--- a/girepository/giregisteredtypeinfo.h
+++ b/girepository/giregisteredtypeinfo.h
@@ -32,6 +32,12 @@
G_BEGIN_DECLS
+/**
+ * GI_IS_REGISTERED_TYPE_INFO
+ * @info: an info structure
+ *
+ * Checks if @info is a #GIRegisteredTypeInfo or derived from it.
+ */
#define GI_IS_REGISTERED_TYPE_INFO(info) \
((g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_BOXED) || \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_ENUM) || \
diff --git a/girepository/girepository-private.h b/girepository/girepository-private.h
index 275776d8..bbd34e3e 100644
--- a/girepository/girepository-private.h
+++ b/girepository/girepository-private.h
@@ -33,6 +33,11 @@
typedef struct _GIRealInfo GIRealInfo;
+/* We changed a gint32 -> gint in the structure below, which should be
+ * valid everywhere we care about.
+ */
+G_STATIC_ASSERT (sizeof (int) == sizeof (gint32));
+
/*
* We just use one structure for all of the info object
* types; in general, we should be reading data directly
@@ -43,7 +48,7 @@ struct _GIRealInfo
{
/* Keep this part in sync with GIUnresolvedInfo below */
gint32 type;
- gint32 ref_count;
+ volatile gint ref_count;
GIRepository *repository;
GIBaseInfo *container;
@@ -62,7 +67,7 @@ struct _GIUnresolvedInfo
{
/* Keep this part in sync with GIBaseInfo above */
gint32 type;
- gint32 ref_count;
+ volatile gint ref_count;
GIRepository *repository;
GIBaseInfo *container;
diff --git a/girepository/girepository.c b/girepository/girepository.c
index b5c30297..6fc7c77e 100644
--- a/girepository/girepository.c
+++ b/girepository/girepository.c
@@ -31,11 +31,20 @@
#include "girepository.h"
#include "gitypelib-internal.h"
#include "girepository-private.h"
-#include "glib-compat.h"
#include "config.h"
-static GStaticMutex globals_lock = G_STATIC_MUTEX_INIT;
+
+/**
+ * SECTION:girepository
+ * @short_description: GObject Introspection repository manager
+ * @include: girepository.h
+ *
+ * #GIRepository is used to manage repositories of namespaces. Namespaces
+ * are represented on disk by type libraries (.typelib files).
+ */
+
+
static GIRepository *default_repository = NULL;
static GSList *search_path = NULL;
static GSList *override_search_path = NULL;
@@ -134,12 +143,13 @@ g_irepository_class_init (GIRepositoryClass *class)
static void
init_globals (void)
{
- g_static_mutex_lock (&globals_lock);
+ static gsize initialized = 0;
+
+ if (!g_once_init_enter (&initialized))
+ return;
if (default_repository == NULL)
- {
- default_repository = g_object_new (G_TYPE_IREPOSITORY, NULL);
- }
+ default_repository = g_object_new (G_TYPE_IREPOSITORY, NULL);
if (search_path == NULL)
{
@@ -147,8 +157,9 @@ init_globals (void)
char *typelib_dir;
const gchar *type_lib_path_env;
- /* This variable is intended to take precedence over both the default
- * search path, as well as anything written into code with g_irepository_prepend_search_path.
+ /* This variable is intended to take precedence over both:
+ * - the default search path;
+ * - all g_irepository_prepend_search_path() calls.
*/
type_lib_path_env = g_getenv ("GI_TYPELIB_PATH");
@@ -184,9 +195,17 @@ init_globals (void)
search_path = g_slist_reverse (search_path);
}
- g_static_mutex_unlock (&globals_lock);
+ g_once_init_leave (&initialized, 1);
}
+/**
+ * g_irepository_prepend_search_path:
+ * @directory: (type filename): directory name to prepend to the typelib
+ * search path
+ *
+ * Prepends @directory to the typelib search path.
+ * See g_irepository_get_search_path().
+ */
void
g_irepository_prepend_search_path (const char *directory)
{
@@ -197,11 +216,11 @@ g_irepository_prepend_search_path (const char *directory)
/**
* g_irepository_get_search_path:
*
- * Returns the search path the GIRepository will use when looking for typelibs.
- * The string is internal to GIRespository and should not be freed, nor should
- * the elements.
+ * Returns the current search path #GIRepository will use when loading
+ * typelib files. The list is internal to #GIRespository and should not
+ * be freed, nor should its string elements.
*
- * Return value: (element-type filename) (transfer none): list of strings
+ * Returns: (element-type filename) (transfer none): #GSList of strings
*/
GSList *
g_irepository_get_search_path (void)
@@ -413,17 +432,19 @@ register_internal (GIRepository *repository,
/**
* g_irepository_get_dependencies:
- * @repository: (allow-none): A #GIRepository, may be %NULL for the default
+ * @repository: (allow-none): A #GIRepository or %NULL for the singleton
+ * process-global default #GIRepository
* @namespace_: Namespace of interest
*
- * Return an array of all (transitive) dependencies for namespace
- * @namespace_, including version. The returned strings are of the
- * form <code>namespace-version</code>.
+ * Return an array of all (transitive) versioned dependencies for
+ * @namespace_. Returned strings are of the form
+ * <code>namespace-version</code>.
*
- * Note: The namespace must have already been loaded using a function
+ * Note: @namespace_ must have already been loaded using a function
* such as g_irepository_require() before calling this function.
*
- * Returns: (transfer full): Zero-terminated string array of versioned dependencies
+ * Returns: (transfer full): Zero-terminated string array of versioned
+ * dependencies
*/
char **
g_irepository_get_dependencies (GIRepository *repository,
@@ -441,6 +462,16 @@ g_irepository_get_dependencies (GIRepository *repository,
return get_typelib_dependencies (typelib);
}
+/**
+ * g_irepository_load_typelib:
+ * @repository: (allow-none): A #GIRepository or %NULL for the singleton
+ * process-global default #GIRepository
+ * @typelib: TODO
+ * @flags: TODO
+ * @error: TODO
+ *
+ * TODO
+ */
const char *
g_irepository_load_typelib (GIRepository *repository,
GITypelib *typelib,
@@ -479,7 +510,8 @@ g_irepository_load_typelib (GIRepository *repository,
/**
* g_irepository_is_registered:
- * @repository: (allow-none): A #GIRepository, may be %NULL for the default
+ * @repository: (allow-none): A #GIRepository or %NULL for the singleton
+ * process-global default #GIRepository
* @namespace_: Namespace of interest
* @version: (allow-none): Required version, may be %NULL for latest
*
@@ -504,13 +536,13 @@ g_irepository_is_registered (GIRepository *repository,
/**
* g_irepository_get_default:
*
- * Returns the singleton process-global default #GIRepository. It is
+ * Returns the singleton process-global default #GIRepository. It is
* not currently supported to have multiple repositories in a
* particular process, but this function is provided in the unlikely
* eventuality that it would become possible, and as a convenience for
* higher level language bindings to conform to the GObject method
* call conventions.
-
+ *
* All methods on #GIRepository also accept %NULL as an instance
* parameter to mean this default repository, which is usually more
* convenient for C.
@@ -525,7 +557,8 @@ g_irepository_get_default (void)
/**
* g_irepository_get_n_infos:
- * @repository: (allow-none): A #GIRepository, may be %NULL for the default
+ * @repository: (allow-none): A #GIRepository or %NULL for the singleton
+ * process-global default #GIRepository
* @namespace_: Namespace to inspect
*
* This function returns the number of metadata entries in
@@ -556,7 +589,8 @@ g_irepository_get_n_infos (GIRepository *repository,
/**
* g_irepository_get_info:
- * @repository: (allow-none): A #GIRepository, may be %NULL for the default
+ * @repository: (allow-none): A #GIRepository or %NULL for the singleton
+ * process-global default #GIRepository
* @namespace_: Namespace to inspect
* @index: 0-based offset into namespace metadata for entry
*
@@ -593,33 +627,45 @@ g_irepository_get_info (GIRepository *repository,
}
typedef struct {
- GIRepository *repository;
- GType type;
-
- gboolean fastpass;
+ const gchar *gtype_name;
GITypelib *result_typelib;
- DirEntry *result;
+ gboolean found_prefix;
} FindByGTypeData;
-static void
-find_by_gtype_foreach (gpointer key,
- gpointer value,
- gpointer datap)
+static DirEntry *
+find_by_gtype (GHashTable *table, FindByGTypeData *data, gboolean check_prefix)
{
- GITypelib *typelib = (GITypelib*)value;
- FindByGTypeData *data = datap;
+ GHashTableIter iter;
+ gpointer key, value;
+ DirEntry *ret;
- if (data->result != NULL)
- return;
+ g_hash_table_iter_init (&iter, table);
+ while (g_hash_table_iter_next (&iter, &key, &value))
+ {
+ GITypelib *typelib = (GITypelib*)value;
+ if (check_prefix)
+ {
+ if (!g_typelib_matches_gtype_name_prefix (typelib, data->gtype_name))
+ continue;
- data->result = g_typelib_get_dir_entry_by_gtype (typelib, data->fastpass, data->type);
- if (data->result)
- data->result_typelib = typelib;
+ data->found_prefix = TRUE;
+ }
+
+ ret = g_typelib_get_dir_entry_by_gtype_name (typelib, data->gtype_name);
+ if (ret)
+ {
+ data->result_typelib = typelib;
+ return ret;
+ }
+ }
+
+ return NULL;
}
/**
* g_irepository_find_by_gtype:
- * @repository: (allow-none): A #GIRepository, may be %NULL for the default
+ * @repository: (allow-none): A #GIRepository or %NULL for the singleton
+ * process-global default #GIRepository
* @gtype: GType to search for
*
* Searches all loaded namespaces for a particular #GType. Note that
@@ -637,6 +683,7 @@ g_irepository_find_by_gtype (GIRepository *repository,
{
FindByGTypeData data;
GIBaseInfo *cached;
+ DirEntry *entry;
repository = get_repository (repository);
@@ -646,30 +693,55 @@ g_irepository_find_by_gtype (GIRepository *repository,
if (cached != NULL)
return g_base_info_ref (cached);
- data.repository = repository;
- data.fastpass = TRUE;
- data.type = gtype;
+ data.gtype_name = g_type_name (gtype);
data.result_typelib = NULL;
- data.result = NULL;
+ data.found_prefix = FALSE;
+
+ /* There is a corner case regarding GdkRectangle. GdkRectangle is a
+ * boxed type, but it is just an alias to boxed struct
+ * CairoRectangleInt. Scanner automatically converts all references
+ * to GdkRectangle to CairoRectangleInt, so GdkRectangle does not
+ * appear in the typelibs at all, although user code might query it.
+ * So if we get such query, we also change it to lookup of
+ * CairoRectangleInt.
+ * https://bugzilla.gnome.org/show_bug.cgi?id=655423
+ */
+ if (G_UNLIKELY (!strcmp (data.gtype_name, "GdkRectangle")))
+ data.gtype_name = "CairoRectangleInt";
+
+ /* Inside each typelib, we include the "C prefix" which acts as
+ * a namespace mechanism. For GtkTreeView, the C prefix is Gtk.
+ * Given the assumption that GTypes for a library also use the
+ * C prefix, we know we can skip examining a typelib if our
+ * target type does not have this typelib's C prefix. Use this
+ * assumption as our first attempt at locating the DirEntry.
+ */
+ entry = find_by_gtype (repository->priv->typelibs, &data, TRUE);
+ if (entry == NULL)
+ entry = find_by_gtype (repository->priv->lazy_typelibs, &data, TRUE);
- g_hash_table_foreach (repository->priv->typelibs, find_by_gtype_foreach, &data);
- if (data.result == NULL)
- g_hash_table_foreach (repository->priv->lazy_typelibs, find_by_gtype_foreach, &data);
+ /* If we have no result, but we did find a typelib claiming to
+ * offer bindings for such a prefix, bail out now on the assumption
+ * that a more exhaustive search would not produce any results.
+ */
+ if (entry == NULL && data.found_prefix)
+ return NULL;
- /* We do two passes; see comment in find_interface */
- if (data.result == NULL)
- {
- data.fastpass = FALSE;
- g_hash_table_foreach (repository->priv->typelibs, find_by_gtype_foreach, &data);
- }
- if (data.result == NULL)
- g_hash_table_foreach (repository->priv->lazy_typelibs, find_by_gtype_foreach, &data);
+ /* Not ever class library necessarily specifies a correct c_prefix,
+ * so take a second pass. This time we will try a global lookup,
+ * ignoring prefixes.
+ * See http://bugzilla.gnome.org/show_bug.cgi?id=564016
+ */
+ if (entry == NULL)
+ entry = find_by_gtype (repository->priv->typelibs, &data, FALSE);
+ if (entry == NULL)
+ entry = find_by_gtype (repository->priv->lazy_typelibs, &data, FALSE);
- if (data.result != NULL)
+ if (entry != NULL)
{
- cached = _g_info_new_full (data.result->blob_type,
+ cached = _g_info_new_full (entry->blob_type,
repository,
- NULL, data.result_typelib, data.result->offset);
+ NULL, data.result_typelib, entry->offset);
g_hash_table_insert (repository->priv->info_by_gtype,
(gpointer) gtype,
@@ -681,7 +753,8 @@ g_irepository_find_by_gtype (GIRepository *repository,
/**
* g_irepository_find_by_name:
- * @repository: (allow-none): A #GIRepository, may be %NULL for the default
+ * @repository: (allow-none): A #GIRepository or %NULL for the singleton
+ * process-global default #GIRepository
* @namespace_: Namespace which will be searched
* @name: Entry name to find
*
@@ -740,7 +813,8 @@ find_by_error_domain_foreach (gpointer key,
/**
* g_irepository_find_by_error_domain:
- * @repository: (allow-none): A #GIRepository, may be %NULL for the default
+ * @repository: (allow-none): A #GIRepository or %NULL for the singleton
+ * process-global default #GIRepository
* @domain: a #GError domain
*
* Searches for the enum type corresponding to the given #GError
@@ -750,7 +824,6 @@ find_by_error_domain_foreach (gpointer key,
*
* Returns: (transfer full): #GIEnumInfo representing metadata about @domain's
* enum type, or %NULL
- *
* Since: 1.29.17
*/
GIEnumInfo *
@@ -803,7 +876,8 @@ collect_namespaces (gpointer key,
/**
* g_irepository_get_loaded_namespaces:
- * @repository: (allow-none): A #GIRepository, may be %NULL for the default
+ * @repository: (allow-none): A #GIRepository or %NULL for the singleton
+ * process-global default #GIRepository
*
* Return the list of currently loaded namespaces.
*
@@ -832,7 +906,8 @@ g_irepository_get_loaded_namespaces (GIRepository *repository)
/**
* g_irepository_get_version:
- * @repository: (allow-none): A #GIRepository, may be %NULL for the default
+ * @repository: (allow-none): A #GIRepository or %NULL for the singleton
+ * process-global default #GIRepository
* @namespace_: Namespace to inspect
*
* This function returns the loaded version associated with the given
@@ -864,7 +939,8 @@ g_irepository_get_version (GIRepository *repository,
/**
* g_irepository_get_shared_library:
- * @repository: (allow-none): A #GIRepository, may be %NULL for the default
+ * @repository: (allow-none): A #GIRepository or %NULL for the singleton
+ * process-global default #GIRepository
* @namespace_: Namespace to inspect
*
* This function returns the full path to the shared C library
@@ -901,7 +977,8 @@ g_irepository_get_shared_library (GIRepository *repository,
/**
* g_irepository_get_c_prefix:
- * @repository: (allow-none): A #GIRepository, may be %NULL for the default
+ * @repository: (allow-none): A #GIRepository or %NULL for the singleton
+ * process-global default #GIRepository
* @namespace_: Namespace to inspect
*
* This function returns the "C prefix", or the C level namespace
@@ -937,13 +1014,14 @@ g_irepository_get_c_prefix (GIRepository *repository,
/**
* g_irepository_get_typelib_path:
- * @repository: (allow-none): Repository, may be %NULL for the default
+ * @repository: (allow-none): A #GIRepository or %NULL for the singleton
+ * process-global default #GIRepository
* @namespace_: GI namespace to use, e.g. "Gtk"
*
* If namespace @namespace_ is loaded, return the full path to the
* .typelib file it was loaded from. If the typelib for
* namespace @namespace_ was included in a shared library, return
- * the special string "$lt;builtin$gt;".
+ * the special string "&lt;builtin&gt;".
*
* Returns: Filesystem path (or $lt;builtin$gt;) if successful, %NULL if namespace is not loaded
*/
@@ -1212,7 +1290,8 @@ find_namespace_latest (const gchar *namespace,
/**
* g_irepository_enumerate_versions:
- * @repository: (allow-none): the repository
+ * @repository: (allow-none): A #GIRepository or %NULL for the singleton
+ * process-global default #GIRepository
* @namespace_: GI namespace, e.g. "Gtk"
*
* Obtain an unordered list of versions (either currently loaded or
@@ -1372,7 +1451,8 @@ require_internal (GIRepository *repository,
/**
* g_irepository_require:
- * @repository: (allow-none): Repository, may be %NULL for the default
+ * @repository: (allow-none): A #GIRepository or %NULL for the singleton
+ * process-global default #GIRepository
* @namespace_: GI namespace to use, e.g. "Gtk"
* @version: (allow-none): Version of namespace, may be %NULL for latest
* @flags: Set of %GIRepositoryLoadFlags, may be 0
@@ -1406,7 +1486,8 @@ g_irepository_require (GIRepository *repository,
/**
* g_irepository_require_private:
- * @repository: (allow-none): Repository, may be %NULL for the default
+ * @repository: (allow-none): A #GIRepository or %NULL for the singleton
+ * process-global default #GIRepository
* @typelib_dir: Private directory where to find the requested typelib
* @namespace_: GI namespace to use, e.g. "Gtk"
* @version: (allow-none): Version of namespace, may be %NULL for latest
diff --git a/girepository/girepository.h b/girepository/girepository.h
index eb990a27..dea250df 100644
--- a/girepository/girepository.h
+++ b/girepository/girepository.h
@@ -56,29 +56,34 @@ G_BEGIN_DECLS
#define G_IS_IREPOSITORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G_TYPE_IREPOSITORY))
#define G_IREPOSITORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_IREPOSITORY, GIRepositoryClass))
+/**
+ * GIRepository:
+ *
+ * The GIRepository structure contains private data and should only be
+ * accessed using the provided API.
+ */
typedef struct _GIRepository GIRepository;
typedef struct _GIRepositoryClass GIRepositoryClass;
typedef struct _GIRepositoryPrivate GIRepositoryPrivate;
struct _GIRepository
{
- GObject parent;
-
/*< private >*/
+ GObject parent;
GIRepositoryPrivate *priv;
};
struct _GIRepositoryClass
{
+ /*< private >*/
GObjectClass parent;
};
/**
* GIRepositoryLoadFlags:
- * @G_IREPOSITORY_LOAD_FLAG_LAZY: Load the types lazily.
+ * @G_IREPOSITORY_LOAD_FLAG_LAZY: Lazily load the typelib.
*
- * Flags that controlls how a typelib is loaded by
- * GIRepositry, used by g_irepository_load_typelib().
+ * Flags that control how a typelib is loaded.
*/
typedef enum
{
@@ -90,6 +95,7 @@ typedef enum
GType g_irepository_get_type (void) G_GNUC_CONST;
GIRepository *g_irepository_get_default (void);
void g_irepository_prepend_search_path (const char *directory);
+void g_irepository_prepend_library_path (const char *directory);
GSList * g_irepository_get_search_path (void);
const char * g_irepository_load_typelib (GIRepository *repository,
GITypelib *typelib,
@@ -143,11 +149,14 @@ gboolean g_irepository_dump (const char *arg, GError **error);
* GIRepositoryError:
* @G_IREPOSITORY_ERROR_TYPELIB_NOT_FOUND: the typelib could not be found.
* @G_IREPOSITORY_ERROR_NAMESPACE_MISMATCH: the namespace does not match the
- * requested namespace.
+ * requested namespace.
* @G_IREPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT: the version of the
- * typelib does not match the requested version.
+ * typelib does not match the requested version.
* @G_IREPOSITORY_ERROR_LIBRARY_NOT_FOUND: the library used by the typelib
- * could not be found.
+ * could not be found.
+ *
+ * An error code used with #G_IREPOSITORY_ERROR in a #GError returned
+ * from a #GIRepository routine.
*/
typedef enum
{
@@ -157,6 +166,13 @@ typedef enum
G_IREPOSITORY_ERROR_LIBRARY_NOT_FOUND
} GIRepositoryError;
+/**
+ * G_IREPOSITORY_ERROR:
+ *
+ * Error domain for #GIRepository. Errors in this domain will be from the
+ * #GIRepositoryError enumeration. See #GError for more information on
+ * error domains.
+ */
#define G_IREPOSITORY_ERROR (g_irepository_error_quark ())
GQuark g_irepository_error_quark (void);
diff --git a/girepository/girepository.symbols b/girepository/girepository.symbols
new file mode 100644
index 00000000..5f01adff
--- /dev/null
+++ b/girepository/girepository.symbols
@@ -0,0 +1,196 @@
+g_arg_info_get_closure
+g_arg_info_get_destroy
+g_arg_info_get_direction
+g_arg_info_get_ownership_transfer
+g_arg_info_get_scope
+g_arg_info_get_type
+g_arg_info_is_caller_allocates
+g_arg_info_is_optional
+g_arg_info_is_return_value
+g_arg_info_is_skip
+g_arg_info_load_type
+g_arg_info_may_be_null
+g_base_info_equal
+g_base_info_get_attribute
+g_base_info_get_container
+g_base_info_get_name
+g_base_info_get_namespace
+g_base_info_get_type
+g_base_info_get_typelib
+g_base_info_gtype_get_type
+g_base_info_is_deprecated
+g_base_info_iterate_attributes
+g_base_info_ref
+g_base_info_unref
+g_info_new
+g_callable_info_can_throw_gerror
+g_callable_info_get_arg
+g_callable_info_get_caller_owns
+g_callable_info_get_n_args
+g_callable_info_get_return_attribute
+g_callable_info_get_return_type
+g_callable_info_invoke
+g_callable_info_iterate_return_attributes
+g_callable_info_is_method
+g_callable_info_load_arg
+g_callable_info_load_return_type
+g_callable_info_may_return_null
+g_callable_info_skip_return
+g_constant_info_free_value
+g_constant_info_get_type
+g_constant_info_get_value
+g_enum_info_get_error_domain
+g_enum_info_get_method
+g_enum_info_get_n_methods
+g_enum_info_get_n_values
+g_enum_info_get_storage_type
+g_enum_info_get_value
+g_value_info_get_value
+g_field_info_get_field
+g_field_info_get_flags
+g_field_info_get_offset
+g_field_info_get_size
+g_field_info_get_type
+g_field_info_set_field
+g_function_info_get_flags
+g_function_info_get_property
+g_function_info_get_symbol
+g_function_info_get_vfunc
+g_function_info_invoke
+g_invoke_error_quark
+g_interface_info_find_method
+g_interface_info_find_signal
+g_interface_info_find_vfunc
+g_interface_info_get_constant
+g_interface_info_get_iface_struct
+g_interface_info_get_method
+g_interface_info_get_n_constants
+g_interface_info_get_n_methods
+g_interface_info_get_n_prerequisites
+g_interface_info_get_n_properties
+g_interface_info_get_prerequisite
+g_interface_info_get_n_signals
+g_interface_info_get_n_vfuncs
+g_interface_info_get_property
+g_interface_info_get_signal
+g_interface_info_get_vfunc
+g_object_info_find_method
+g_object_info_find_method_using_interfaces
+g_object_info_find_signal
+g_object_info_find_vfunc
+g_object_info_find_vfunc_using_interfaces
+g_object_info_get_abstract
+g_object_info_get_class_struct
+g_object_info_get_constant
+g_object_info_get_field
+g_object_info_get_fundamental
+g_object_info_get_get_value_function
+g_object_info_get_get_value_function_pointer
+g_object_info_get_interface
+g_object_info_get_method
+g_object_info_get_n_constants
+g_object_info_get_n_fields
+g_object_info_get_n_interfaces
+g_object_info_get_n_methods
+g_object_info_get_n_properties
+g_object_info_get_n_signals
+g_object_info_get_n_vfuncs
+g_object_info_get_parent
+g_object_info_get_property
+g_object_info_get_ref_function
+g_object_info_get_ref_function_pointer
+g_object_info_get_set_value_function
+g_object_info_get_set_value_function_pointer
+g_object_info_get_signal
+g_object_info_get_type_init
+g_object_info_get_type_name
+g_object_info_get_unref_function
+g_object_info_get_unref_function_pointer
+g_object_info_get_vfunc
+g_property_info_get_flags
+g_property_info_get_ownership_transfer
+g_property_info_get_type
+g_registered_type_info_get_g_type
+g_registered_type_info_get_type_init
+g_registered_type_info_get_type_name
+gi_cclosure_marshal_generic
+g_irepository_dump
+g_irepository_enumerate_versions
+g_irepository_error_quark
+g_irepository_find_by_error_domain
+g_irepository_find_by_gtype
+g_irepository_find_by_name
+g_irepository_get_c_prefix
+g_irepository_get_default
+g_irepository_get_dependencies
+g_irepository_get_info
+g_irepository_get_loaded_namespaces
+g_irepository_get_n_infos
+g_irepository_get_option_group
+g_irepository_get_search_path
+g_irepository_get_shared_library
+g_irepository_get_type
+g_irepository_get_typelib_path
+g_irepository_get_version
+g_irepository_is_registered
+g_irepository_load_typelib
+g_irepository_prepend_library_path
+g_irepository_prepend_search_path
+g_irepository_require
+g_irepository_require_private
+gi_type_info_extract_ffi_return_value
+gi_type_tag_get_ffi_type
+g_callable_info_free_closure
+g_callable_info_prepare_closure
+g_function_info_prep_invoker
+g_function_invoker_destroy
+g_function_invoker_new_for_address
+g_type_info_get_ffi_type
+g_signal_info_get_class_closure
+g_signal_info_get_flags
+g_signal_info_true_stops_emit
+g_struct_info_find_method
+g_struct_info_get_alignment
+g_struct_info_get_field
+g_struct_info_get_method
+g_struct_info_get_n_fields
+g_struct_info_get_n_methods
+g_struct_info_get_size
+g_struct_info_is_foreign
+g_struct_info_is_gtype_struct
+g_type_info_is_pointer
+g_type_info_is_zero_terminated
+g_type_info_get_array_fixed_size
+g_type_info_get_array_length
+g_type_info_get_array_type
+g_type_info_get_interface
+g_type_info_get_param_type
+g_type_info_get_tag
+g_type_tag_to_string
+g_info_type_to_string
+g_typelib_check_sanity
+g_typelib_error_quark
+g_typelib_free
+g_typelib_get_namespace
+g_typelib_new_from_const_memory
+g_typelib_new_from_mapped_file
+g_typelib_new_from_memory
+g_typelib_symbol
+g_typelib_validate
+g_union_info_find_method
+g_union_info_get_alignment
+g_union_info_get_discriminator
+g_union_info_get_discriminator_offset
+g_union_info_get_discriminator_type
+g_union_info_get_field
+g_union_info_get_method
+g_union_info_get_n_fields
+g_union_info_get_n_methods
+g_union_info_get_size
+g_union_info_is_discriminated
+g_vfunc_info_get_address
+g_vfunc_info_get_invoker
+g_vfunc_info_get_flags
+g_vfunc_info_get_offset
+g_vfunc_info_get_signal
+g_vfunc_info_invoke
diff --git a/girepository/girffi.c b/girepository/girffi.c
index ec710c37..30642fe1 100644
--- a/girepository/girffi.c
+++ b/girepository/girffi.c
@@ -26,11 +26,21 @@
#include <errno.h>
#include <string.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include "girffi.h"
#include "girepository.h"
#include "girepository-private.h"
+/**
+ * SECTION:girffi
+ * @short_description: TODO
+ * @title: girffi
+ *
+ * TODO
+ */
+
static ffi_type *
gi_type_tag_get_ffi_type_internal (GITypeTag tag,
gboolean is_pointer,
@@ -101,22 +111,26 @@ gi_type_tag_get_ffi_type_internal (GITypeTag tag,
/**
* gi_type_tag_get_ffi_type:
- * @tag: A #GITypeTag
+ * @type_tag: A #GITypeTag
* @is_pointer: Whether or not this is a pointer type
*
+ * TODO
+ *
* Returns: A #ffi_type corresponding to the platform default C ABI for @tag and @is_pointer.
*/
ffi_type *
-gi_type_tag_get_ffi_type (GITypeTag tag,
+gi_type_tag_get_ffi_type (GITypeTag type_tag,
gboolean is_pointer)
{
- return gi_type_tag_get_ffi_type_internal (tag, is_pointer, FALSE);
+ return gi_type_tag_get_ffi_type_internal (type_tag, is_pointer, FALSE);
}
/**
* g_type_info_get_ffi_type:
* @info: A #GITypeInfo
*
+ * TODO
+ *
* Returns: A #ffi_type corresponding to the platform default C ABI for @info.
*/
ffi_type *
@@ -148,7 +162,9 @@ g_type_info_get_ffi_type (GITypeInfo *info)
* @callable_info: a callable info from a typelib
* @n_args_p: (out): The number of arguments
*
- * Return value: an array of ffi_type*. The array itself
+ * TODO
+ *
+ * Returns: an array of ffi_type*. The array itself
* should be freed using g_free() after use.
*/
static ffi_type **
@@ -215,7 +231,8 @@ g_callable_info_get_ffi_arg_types (GICallableInfo *callable_info,
*
* Fetches the ffi_type for a corresponding return value of
* a #GICallableInfo
- * Return value: the ffi_type for the return value
+ *
+ * Returns: the ffi_type for the return value
*/
static ffi_type *
g_callable_info_get_ffi_return_type (GICallableInfo *callable_info)
@@ -314,7 +331,7 @@ g_function_invoker_new_for_address (gpointer addr,
}
/**
- * g_function_info_invoker_destroy:
+ * g_function_invoker_destroy:
* @invoker: A #GIFunctionInvoker
*
* Release all resources allocated for the internals of @invoker; callers
@@ -341,8 +358,8 @@ typedef struct {
*
* Prepares a callback for ffi invocation.
*
- * Return value: the ffi_closure or NULL on error.
- * The return value should be freed by calling g_callable_info_free_closure().
+ * Returns: the ffi_closure or NULL on error. The return value
+ * should be freed by calling g_callable_info_free_closure().
*/
ffi_closure *
g_callable_info_prepare_closure (GICallableInfo *callable_info,
diff --git a/girepository/girffi.h b/girepository/girffi.h
index 56caff73..50cabb17 100644
--- a/girepository/girffi.h
+++ b/girepository/girffi.h
@@ -27,6 +27,15 @@
G_BEGIN_DECLS
+/**
+ * GIFFIClosureCallback:
+ * @Param1: TODO
+ * @Param2: TODO
+ * @Param3: TODO
+ * @Param4: TODO
+ *
+ * TODO
+ */
typedef void (*GIFFIClosureCallback) (ffi_cif *,
void *,
void **,
@@ -35,7 +44,9 @@ typedef void (*GIFFIClosureCallback) (ffi_cif *,
/**
* GIFunctionInvoker:
* @cif: the cif
- * @native_address: the native adress
+ * @native_address: the native address
+ *
+ * TODO
*/
typedef struct _GIFunctionInvoker GIFunctionInvoker;
@@ -46,6 +57,11 @@ struct _GIFunctionInvoker {
gpointer padding[3];
};
+/**
+ * GIFFIReturnValue:
+ *
+ * TODO
+ */
typedef GIArgument GIFFIReturnValue;
ffi_type * gi_type_tag_get_ffi_type (GITypeTag type_tag, gboolean is_pointer);
diff --git a/girepository/girmodule.c b/girepository/girmodule.c
index af71f369..e3897c34 100644
--- a/girepository/girmodule.c
+++ b/girepository/girmodule.c
@@ -261,8 +261,9 @@ add_directory_index_section (guint8 *data, GIrModule *module, guint32 *offset2)
for (i = 0; i < n_interfaces; i++)
{
+ const char *str;
entry = (DirEntry *)&data[header->directory + (i * header->entry_blob_size)];
- const char *str = (const char *) (&data[entry->name]);
+ str = (const char *) (&data[entry->name]);
_gi_typelib_hash_builder_add_string (dirindex_builder, str, i);
}
@@ -278,8 +279,9 @@ add_directory_index_section (guint8 *data, GIrModule *module, guint32 *offset2)
alloc_section (data, GI_SECTION_DIRECTORY_INDEX, *offset2);
required_size = _gi_typelib_hash_builder_get_buffer_size (dirindex_builder);
+ required_size = ALIGN_VALUE (required_size, 4);
- new_offset = *offset2 + ALIGN_VALUE (required_size, 4);
+ new_offset = *offset2 + required_size;
data = g_realloc (data, new_offset);
diff --git a/girepository/girnode.c b/girepository/girnode.c
index 881aa9be..093a3783 100644
--- a/girepository/girnode.c
+++ b/girepository/girnode.c
@@ -28,6 +28,11 @@
#include "girnode.h"
#include "gitypelib-internal.h"
+#ifdef _MSC_VER
+#define strtoll _strtoi64
+#define strtoull _strtoui64
+#endif
+
static gulong string_count = 0;
static gulong unique_string_count = 0;
static gulong string_size = 0;
@@ -228,7 +233,7 @@ _g_ir_node_free (GIrNode *node)
_g_ir_node_free ((GIrNode *)type->parameter_type1);
_g_ir_node_free ((GIrNode *)type->parameter_type2);
- g_free (type->interface);
+ g_free (type->giinterface);
g_strfreev (type->errors);
}
@@ -1005,10 +1010,10 @@ parse_float_value (const gchar *str)
static gboolean
parse_boolean_value (const gchar *str)
{
- if (strcmp (str, "TRUE") == 0)
+ if (g_ascii_strcasecmp (str, "TRUE") == 0)
return TRUE;
- if (strcmp (str, "FALSE") == 0)
+ if (g_ascii_strcasecmp (str, "FALSE") == 0)
return FALSE;
return parse_int_value (str) ? TRUE : FALSE;
@@ -1146,6 +1151,10 @@ _g_ir_find_node (GIrTypelibBuild *build,
target_name = names[1];
}
+ /* find_namespace() may return NULL. */
+ if (target_module == NULL)
+ goto done;
+
for (l = target_module->entries; l; l = l->next)
{
GIrNode *node = (GIrNode *)l->data;
@@ -1157,6 +1166,7 @@ _g_ir_find_node (GIrTypelibBuild *build,
}
}
+done:
g_strfreev (names);
return return_node;
@@ -1244,7 +1254,7 @@ serialize_type (GIrTypelibBuild *build,
GIrNode *iface;
gchar *name;
- iface = find_entry_node (build, node->interface, NULL);
+ iface = find_entry_node (build, node->giinterface, NULL);
if (iface)
{
if (iface->type == G_IR_NODE_XREF)
@@ -1253,8 +1263,8 @@ serialize_type (GIrTypelibBuild *build,
}
else
{
- g_warning ("Interface for type reference %s not found", node->interface);
- name = node->interface;
+ g_warning ("Interface for type reference %s not found", node->giinterface);
+ name = node->giinterface;
}
g_string_append_printf (str, "%s%s", name,
@@ -1483,7 +1493,7 @@ _g_ir_node_build_typelib (GIrNode *node,
iface->reserved = 0;
iface->tag = type->tag;
iface->reserved2 = 0;
- iface->interface = find_entry (build, type->interface);
+ iface->interface = find_entry (build, type->giinterface);
}
break;
diff --git a/girepository/girnode.h b/girepository/girnode.h
index d89847ac..07b084c4 100644
--- a/girepository/girnode.h
+++ b/girepository/girnode.h
@@ -133,7 +133,7 @@ struct _GIrNodeType
GIrNodeType *parameter_type1;
GIrNodeType *parameter_type2;
- gchar *interface;
+ gchar *giinterface;
gchar **errors;
};
diff --git a/girepository/giroffsets.c b/girepository/giroffsets.c
index e3c9d7f5..84278b89 100644
--- a/girepository/giroffsets.c
+++ b/girepository/giroffsets.c
@@ -190,10 +190,10 @@ get_interface_size_alignment (GIrTypelibBuild *build,
{
GIrNode *iface;
- iface = _g_ir_find_node (build, ((GIrNode*)type)->module, type->interface);
+ iface = _g_ir_find_node (build, ((GIrNode*)type)->module, type->giinterface);
if (!iface)
{
- _g_ir_module_fatal (build, 0, "Can't resolve type '%s' for %s", type->interface, who);
+ _g_ir_module_fatal (build, 0, "Can't resolve type '%s' for %s", type->giinterface, who);
*size = -1;
*alignment = -1;
return FALSE;
@@ -497,7 +497,7 @@ check_needs_computation (GIrTypelibBuild *build,
return alignment == 0;
}
-/**
+/*
* _g_ir_node_compute_offsets:
* @build: Current typelib build
* @node: a #GIrNode
diff --git a/girepository/girparser.c b/girepository/girparser.c
index fa0de1f8..82005fc0 100644
--- a/girepository/girparser.c
+++ b/girepository/girparser.c
@@ -36,6 +36,24 @@
*/
#define SUPPORTED_GIR_VERSION "1.2"
+#ifdef G_OS_WIN32
+
+#include <windows.h>
+
+#ifdef GIR_DIR
+#undef GIR_DIR
+#endif
+
+/* GIR_DIR is used only in code called just once,
+ * so no problem leaking this
+ */
+#define GIR_DIR \
+ g_build_filename (g_win32_get_package_installation_directory_of_module(NULL), \
+ "share", \
+ GIR_SUFFIX, \
+ NULL)
+#endif
+
struct _GIrParser
{
gchar **includes;
@@ -77,7 +95,6 @@ typedef enum
STATE_ALIAS, /* 30 */
STATE_TYPE,
STATE_ATTRIBUTE,
- STATE_DOC,
STATE_PASSTHROUGH
} ParseState;
@@ -324,15 +341,20 @@ state_switch (ParseContext *ctx, ParseState newstate)
g_assert (ctx->state != newstate);
ctx->prev_state = ctx->state;
ctx->state = newstate;
+
+ if (ctx->state == STATE_PASSTHROUGH)
+ ctx->unknown_depth = 1;
}
static GIrNode *
pop_node (ParseContext *ctx)
{
+ GSList *top;
+ GIrNode *node;
g_assert (ctx->node_stack != 0);
- GSList *top = ctx->node_stack;
- GIrNode *node = top->data;
+ top = ctx->node_stack;
+ node = top->data;
g_debug ("popping node %d %s", node->type, node->name);
ctx->node_stack = top->next;
@@ -359,7 +381,8 @@ typedef struct {
} IntegerAliasInfo;
static IntegerAliasInfo integer_aliases[] = {
- { "gchar", SIZEOF_CHAR, 0 },
+ { "gchar", SIZEOF_CHAR, 1 },
+ { "guchar", SIZEOF_CHAR, 0 },
{ "gshort", SIZEOF_SHORT, 1 },
{ "gushort", SIZEOF_SHORT, 0 },
{ "gint", SIZEOF_INT, 1 },
@@ -552,8 +575,8 @@ parse_type_internal (GIrModule *module,
if (*str == '<')
{
- (str)++;
char *tmp, *end;
+ (str)++;
end = strchr (str, '>');
tmp = g_strndup (str, end - str);
@@ -565,9 +588,10 @@ parse_type_internal (GIrModule *module,
}
else
{
+ const char *start;
type->tag = GI_TYPE_TAG_INTERFACE;
type->is_interface = TRUE;
- const char *start = str;
+ start = str;
/* must be an interface type */
while (g_ascii_isalnum (*str) ||
@@ -577,7 +601,7 @@ parse_type_internal (GIrModule *module,
*str == ':')
(str)++;
- type->interface = g_strndup (start, str - start);
+ type->giinterface = g_strndup (start, str - start);
}
if (next)
@@ -703,10 +727,7 @@ introspectable_prelude (GMarkupParseContext *context,
if (introspectable)
state_switch (ctx, new_state);
else
- {
- state_switch (ctx, STATE_PASSTHROUGH);
- ctx->unknown_depth = 1;
- }
+ state_switch (ctx, STATE_PASSTHROUGH);
return introspectable;
}
@@ -1965,7 +1986,7 @@ start_type (GMarkupParseContext *context,
* doesn't look like a pointer, but is internally.
*/
if (typenode->tag == GI_TYPE_TAG_INTERFACE &&
- is_disguised_structure (ctx, typenode->interface))
+ is_disguised_structure (ctx, typenode->giinterface))
pointer_depth++;
if (pointer_depth > 0)
@@ -2095,22 +2116,6 @@ end_type (ParseContext *ctx)
}
static gboolean
-start_doc (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- GError **error)
-{
- if (strcmp (element_name, "doc") != 0)
- return FALSE;
-
- state_switch (ctx, STATE_DOC);
-
- return TRUE;
-}
-
-static gboolean
start_attribute (GMarkupParseContext *context,
const gchar *element_name,
const gchar **attribute_names,
@@ -2296,9 +2301,9 @@ start_glib_signal (GMarkupParseContext *context,
signal->run_first = FALSE;
signal->run_last = FALSE;
signal->run_cleanup = FALSE;
- if (when == NULL || strcmp (when, "LAST") == 0)
+ if (when == NULL || g_ascii_strcasecmp (when, "LAST") == 0)
signal->run_last = TRUE;
- else if (strcmp (when, "FIRST") == 0)
+ else if (g_ascii_strcasecmp (when, "FIRST") == 0)
signal->run_first = TRUE;
else
signal->run_cleanup = TRUE;
@@ -2743,9 +2748,12 @@ start_element_handler (GMarkupParseContext *context,
attribute_names, attribute_values,
ctx, error))
goto out;
- else if (start_doc (context, element_name, attribute_names,
- attribute_values, ctx, error))
- goto out;
+ if (strcmp ("doc", element_name) == 0 || strcmp ("doc-deprecated", element_name) == 0 ||
+ strcmp ("doc-stability", element_name) == 0 || strcmp ("doc-version", element_name) == 0)
+ {
+ state_switch (ctx, STATE_PASSTHROUGH);
+ goto out;
+ }
break;
case 'e':
@@ -2824,6 +2832,11 @@ start_element_handler (GMarkupParseContext *context,
attribute_names, attribute_values,
ctx, error))
goto out;
+ else if (strcmp (element_name, "instance-parameter") == 0)
+ {
+ state_switch (ctx, STATE_PASSTHROUGH);
+ goto out;
+ }
else if (strcmp (element_name, "c:include") == 0)
{
state_switch (ctx, STATE_C_INCLUDE);
@@ -2860,6 +2873,9 @@ start_element_handler (GMarkupParseContext *context,
version = find_attribute ("version", attribute_names, attribute_values);
shared_library = find_attribute ("shared-library", attribute_names, attribute_values);
cprefix = find_attribute ("c:identifier-prefixes", attribute_names, attribute_values);
+ /* Backwards compatibility; vala currently still generates this */
+ if (cprefix == NULL)
+ cprefix = find_attribute ("c:prefix", attribute_names, attribute_values);
if (name == NULL)
MISSING_ATTRIBUTE (context, error, element_name, "name");
@@ -3006,7 +3022,6 @@ start_element_handler (GMarkupParseContext *context,
ctx->file_path, line_number, char_number, element_name,
ctx->state);
state_switch (ctx, STATE_PASSTHROUGH);
- ctx->unknown_depth = 1;
}
out:
@@ -3391,13 +3406,6 @@ end_element_handler (GMarkupParseContext *context,
}
break;
- case STATE_DOC:
- if (strcmp ("doc", element_name) == 0)
- {
- state_switch (ctx, ctx->prev_state);
- }
- break;
-
case STATE_PASSTHROUGH:
ctx->unknown_depth -= 1;
g_assert (ctx->unknown_depth >= 0);
diff --git a/girepository/gisignalinfo.c b/girepository/gisignalinfo.c
index f4110c38..be75276e 100644
--- a/girepository/gisignalinfo.c
+++ b/girepository/gisignalinfo.c
@@ -28,8 +28,8 @@
/**
* SECTION:gisignalinfo
- * @Short_description: Struct representing a signal
- * @Title: GISignalInfo
+ * @title: GISignalInfo
+ * @short_description: Struct representing a signal
*
* GISignalInfo represents a signal. It's a sub-struct of #GICallableInfo
* and contains a set of flags and a class closure.
diff --git a/girepository/gisignalinfo.h b/girepository/gisignalinfo.h
index e3a1e4a4..8502610c 100644
--- a/girepository/gisignalinfo.h
+++ b/girepository/gisignalinfo.h
@@ -32,6 +32,12 @@
G_BEGIN_DECLS
+/**
+ * GI_IS_SIGNAL_INFO
+ * @info: an info structure
+ *
+ * Checks if @info is a #GISignalInfo.
+ */
#define GI_IS_SIGNAL_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_SIGNAL)
diff --git a/girepository/gistructinfo.c b/girepository/gistructinfo.c
index dc17e322..f205e7cf 100644
--- a/girepository/gistructinfo.c
+++ b/girepository/gistructinfo.c
@@ -28,8 +28,8 @@
/**
* SECTION:gistructinfo
- * @Short_description: Struct representing a C structure
- * @Title: GIStructInfo
+ * @title: GIStructInfo
+ * @short_description: Struct representing a C structure
*
* GIStructInfo represents a generic C structure type.
*
@@ -212,6 +212,14 @@ g_struct_info_get_alignment (GIStructInfo *info)
return blob->alignment;
}
+/**
+ * g_struct_info_is_foreign:
+ * @info: TODO
+ *
+ * TODO
+ *
+ * Returns: TODO
+ */
gboolean
g_struct_info_is_foreign (GIStructInfo *info)
{
diff --git a/girepository/gistructinfo.h b/girepository/gistructinfo.h
index 1d10708e..4300534d 100644
--- a/girepository/gistructinfo.h
+++ b/girepository/gistructinfo.h
@@ -31,6 +31,12 @@
G_BEGIN_DECLS
+/**
+ * GI_IS_STRUCT_INFO
+ * @info: an info structure
+ *
+ * Checks if @info is a #GIStructInfo.
+ */
#define GI_IS_STRUCT_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_STRUCT)
diff --git a/girepository/gitypeinfo.c b/girepository/gitypeinfo.c
index a43fbc1b..3c17f564 100644
--- a/girepository/gitypeinfo.c
+++ b/girepository/gitypeinfo.c
@@ -28,8 +28,8 @@
/**
* SECTION:gitypeinfo
- * @Short_description: Struct representing a type
- * @Title: GITypeInfo
+ * @title: GITypeInfo
+ * @short_description: Struct representing a type
*
* GITypeInfo represents a type. You can retrieve a type info from
* an argument (see #GIArgInfo), a functions return value (see #GIFunctionInfo),
@@ -48,7 +48,6 @@
* +----GITypeInfo
* </synopsis>
* </refsect1>
- *
*/
/**
diff --git a/girepository/gitypeinfo.h b/girepository/gitypeinfo.h
index ef834b12..7591799a 100644
--- a/girepository/gitypeinfo.h
+++ b/girepository/gitypeinfo.h
@@ -31,9 +31,21 @@
G_BEGIN_DECLS
+/**
+ * GI_IS_TYPE_INFO
+ * @info: an info structure
+ *
+ * Checks if @info is a #GITypeInfo.
+ */
#define GI_IS_TYPE_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_TYPE)
+/**
+ * G_TYPE_TAG_IS_BASIC
+ * @tag: a type tag
+ *
+ * Checks if @tag is a basic type.
+ */
#define G_TYPE_TAG_IS_BASIC(tag) (tag < GI_TYPE_TAG_ARRAY || tag == GI_TYPE_TAG_UNICHAR)
const gchar* g_type_tag_to_string (GITypeTag type);
diff --git a/girepository/gitypelib-internal.h b/girepository/gitypelib-internal.h
index 04662b4a..23f4d625 100644
--- a/girepository/gitypelib-internal.h
+++ b/girepository/gitypelib-internal.h
@@ -30,7 +30,8 @@
G_BEGIN_DECLS
/**
- * SECTION:gtypelib
+ * SECTION:gitypelib-internal
+ * @title: GITypelib
* @short_description: Layout and accessors for typelib
* @stability: Stable
*
@@ -42,32 +43,31 @@ G_BEGIN_DECLS
*
* Some of the differences to XPCOM include:
* - Type information is stored not quite as compactly (XPCOM stores it inline
- * in function descriptions in variable-sized blobs of 1 to n bytes. We store
- * 16 bits of type information for each parameter, which is enough to encode
- * simple types inline. Complex (e.g. recursive) types are stored out of line
- * in a separate list of types.
+ * in function descriptions in variable-sized blobs of 1 to n bytes. We store
+ * 16 bits of type information for each parameter, which is enough to encode
+ * simple types inline. Complex (e.g. recursive) types are stored out of line
+ * in a separate list of types.
* - String and complex type data is stored outside of typelib entry blobs,
- * references are stored as offsets relative to the start of the typelib.
- * One possibility is to store the strings and types in a pools at the end
- * of the typelib.
+ * references are stored as offsets relative to the start of the typelib.
+ * One possibility is to store the strings and types in a pools at the end
+ * of the typelib.
*
- * The typelib has the following general format.
+ * The typelib has the following general format:
*
- * typelib ::= header, section-index, directory, blobs, attributes, attributedata
+ * typelib ::= header, section-index, directory, blobs, attributes, attributedata
*
- * directory ::= list of entries
+ * directory ::= list of entries
*
- * entry ::= blob type, name, namespace, offset
- * blob ::= function|callback|struct|boxed|enum|flags|object|interface|constant|union
- * attributes ::= list of attributes, sorted by offset
- * attribute ::= offset, key, value
- * attributedata ::= string data for attributes
+ * entry ::= blob type, name, namespace, offset
+ * blob ::= function|callback|struct|boxed|enum|flags|object|interface|constant|union
+ * attribute ::= offset, key, value
+ * attributedata ::= string data for attributes
*
* Details
*
* We describe the fragments that make up the typelib in the form of C structs
- * (although some fall short of being valid C structs since they contain multiple
- * flexible arrays).
+ * (although some fall short of being valid C structs since they contain
+ * multiple flexible arrays).
*/
/*
@@ -157,10 +157,11 @@ Changes since 0.1:
* @BLOB_TYPE_OBJECT: An #ObjectBlob
* @BLOB_TYPE_INTERFACE: An #InterfaceBlob
* @BLOB_TYPE_CONSTANT: A #ConstantBlob
+ * @BLOB_TYPE_INVALID_0: Deleted, used to be ErrorDomain.
* @BLOB_TYPE_UNION: A #UnionBlob
*
- * The integral value of this enumeration appears in each "Blob"
- * component of a typelib to identify its type.
+ * The integral value of this enumeration appears in each "Blob" component of
+ * a typelib to identify its type.
*/
typedef enum {
BLOB_TYPE_INVALID,
@@ -173,7 +174,7 @@ typedef enum {
BLOB_TYPE_OBJECT,
BLOB_TYPE_INTERFACE,
BLOB_TYPE_CONSTANT,
- BLOB_TYPE_INVALID_0, /* DELETED - used to be ErrorDomain */
+ BLOB_TYPE_INVALID_0,
BLOB_TYPE_UNION
} GTypelibBlobType;
@@ -188,52 +189,54 @@ typedef enum {
/**
* Header:
* @magic: See #G_IR_MAGIC.
- * @major_version: The version of the typelib format. Minor version changes indicate
- * compatible changes and should still allow the typelib to be parsed
- * by a parser designed for the same major_version.
- * @minor_version: See major_version.
+ * @major_version: The major version number of the typelib format. Major version
+ * number changes indicate incompatible changes to the tyeplib format.
+ * @minor_version: The minor version number of the typelib format. Minor version
+ * number changes indicate compatible changes and should still allow the
+ * typelib to be parsed by a parser designed for the same @major_version.
+ * @reserved: Reserved for future use.
* @n_entries: The number of entries in the directory.
- * @n_local_entries: The number of entries referring to blobs in this typelib. The
- * local entries must occur before the unresolved entries.
+ * @n_local_entries: The number of entries referring to blobs in this typelib.
+ * The local entries must occur before the unresolved entries.
* @directory: Offset of the directory in the typelib.
* @n_attributes: Number of attribute blocks
* @attributes: Offset of the list of attributes in the typelib.
- * @dependencies: Offset of a single string, which is the list of
- * dependencies, separated by the '|' character. The
- * dependencies are required in order to avoid having programs
- * consuming a typelib check for an "Unresolved" type return
- * from every API call.
+ * @dependencies: Offset of a single string, which is the list of dependencies,
+ * separated by the '|' character. The dependencies are required in order
+ * to avoid having programs consuming a typelib check for an "Unresolved"
+ * type return from every API call.
* @size: The size in bytes of the typelib.
* @namespace: Offset of the namespace string in the typelib.
* @nsversion: Offset of the namespace version string in the typelib.
- * @shared_library: This field is the set of shared libraries associated
- * with the typelib. The entries are separated by the '|' (pipe) character.
+ * @shared_library: This field is the set of shared libraries associated with
+ * the typelib. The entries are separated by the '|' (pipe) character.
* @c_prefix: The prefix for the function names of the library
- * @entry_blob_size: The sizes of fixed-size blobs. Recording this information here
- * allows to write parser which continue to work if the format is
- * extended by adding new fields to the end of the fixed-size blobs.
- * @function_blob_size: See above.
- * @callback_blob_size: See above.
- * @signal_blob_size: See above.
- * @vfunc_blob_size: See above.
- * @arg_blob_size: See above.
- * @property_blob_size: See above.
- * @field_blob_size: See above.
- * @value_blob_size: See above.
- * @attribute_blob_size: See above.
- * @constant_blob_size: See above.
- * @object_blob_size: See above.
- * @union_blob_size: See above.
- * @signature_blob_size: See above.
- * @enum_blob_size: See above.
- * @struct_blob_size: See above.
- * @error_domain_blob_size: See above.
- * @interface_blob_size: For variable-size blobs, the size of the struct up to the first
- * flexible array member. Recording this information here allows to
- * write parser which continue to work if the format is extended by
- * adding new fields before the first flexible array member in
- * variable-size blobs.
+ * @entry_blob_size: The sizes of fixed-size blobs. Recording this information
+ * here allows to write parser which continue to work if the format is
+ * extended by adding new fields to the end of the fixed-size blobs.
+ * @function_blob_size: See @entry_blob_size.
+ * @callback_blob_size: See @entry_blob_size.
+ * @signal_blob_size: See @entry_blob_size.
+ * @vfunc_blob_size: See @entry_blob_size.
+ * @arg_blob_size: See @entry_blob_size.
+ * @property_blob_size: See @entry_blob_size.
+ * @field_blob_size: See @entry_blob_size.
+ * @value_blob_size: See @entry_blob_size.
+ * @attribute_blob_size: See @entry_blob_size.
+ * @constant_blob_size: See @entry_blob_size.
+ * @error_domain_blob_size: See @entry_blob_size.
+ * @signature_blob_size: See @entry_blob_size.
+ * @enum_blob_size: See @entry_blob_size.
+ * @struct_blob_size: See @entry_blob_size.
+ * @object_blob_size: See @entry_blob_size.
+ * @interface_blob_size: For variable-size blobs, the size of the struct up to
+ * the first flexible array member. Recording this information here allows
+ * to write parser which continue to work if the format is extended by
+ * adding new fields before the first flexible array member in
+ * variable-size blobs.
+ * @union_blob_size: See @entry_blob_size.
* @sections: Offset of section blob array
+ * @padding: TODO
*
* The header structure appears exactly once at the beginning of a typelib. It is a
* collection of meta-information, such as the number of entries and dependencies.
@@ -242,9 +245,7 @@ typedef struct {
gchar magic[16];
guint8 major_version;
guint8 minor_version;
- /* <private> */
guint16 reserved;
- /* <public> */
guint16 n_entries;
guint16 n_local_entries;
guint32 directory;
@@ -281,10 +282,16 @@ typedef struct {
guint32 sections;
- /* <private> */
guint16 padding[6];
} Header;
+/**
+ * SectionType:
+ * @GI_SECTION_END: TODO
+ * @GI_SECTION_DIRECTORY_INDEX: TODO
+ *
+ * TODO
+ */
typedef enum {
GI_SECTION_END = 0,
GI_SECTION_DIRECTORY_INDEX = 1
@@ -299,7 +306,6 @@ typedef enum {
* and may or may not be present in the typelib. Presently, just used
* for the directory index. This allows a form of dynamic extensibility
* with different tradeoffs from the format minor version.
- *
*/
typedef struct {
guint32 id;
@@ -311,10 +317,11 @@ typedef struct {
* DirEntry:
* @blob_type: A #GTypelibBlobType
* @local: Whether this entry refers to a blob in this typelib.
+ * @reserved: Reserved for future use.
* @name: The name of the entry.
- * @offset: If is_local is set, this is the offset of the blob in the typelib.
- * Otherwise, it is the offset of the namespace in which the blob has
- * to be looked up by name.
+ * @offset: If is_local is set, this is the offset of the blob in the typelib.
+ * Otherwise, it is the offset of the namespace in which the blob has to be
+ * looked up by name.
*
* References to directory entries are stored as 1-based 16-bit indexes.
*
@@ -325,91 +332,100 @@ typedef struct {
guint16 blob_type;
guint16 local : 1;
- /* <private> */
guint16 reserved :15;
- /* <public> */
guint32 name;
guint32 offset;
} DirEntry;
/**
- * SimpleTypeBlob:
- * @is_pointer: Indicates whether the type is passed by reference.
+ * SimpleTypeBlobFlags:
+ * @reserved: Reserved for future use.
+ * @reserved2: Reserved for future use.
+ * @pointer: TODO
+ * @reserved3: Reserved for future use.
* @tag: A #GITypeTag
- * @offset: Offset relative to header->types that points to a TypeBlob.
- * Unlike other offsets, this is in words (ie 32bit units) rather
- * than bytes.
- *
- * The SimpleTypeBlob is the general purpose "reference to a type" construct, used
- * in method parameters, returns, callback definitions, fields, constants, etc.
- * It's actually just a 32 bit integer which you can see from the union definition.
- * This is for efficiency reasons, since there are so many references to types.
- *
- * SimpleTypeBlob is divided into two cases; first, if "reserved" and "reserved2", the
- * type tag for a basic type is embedded in the "tag" bits. This allows e.g.
- * GI_TYPE_TAG_UTF8, GI_TYPE_TAG_INT and the like to be embedded directly without
- * taking up extra space.
*
- * References to "interfaces" (objects, interfaces) are more complicated; In this case,
- * the integer is actually an offset into the directory (see above). Because the header
- * is larger than 2^8=256 bits, all offsets will have one of the upper 24 bits set.
+ * TODO
*/
-typedef union
+typedef struct {
+ guint reserved : 8;
+ guint reserved2 :16;
+ guint pointer : 1;
+ guint reserved3 : 2;
+ guint tag : 5;
+} SimpleTypeBlobFlags;
+
+union _SimpleTypeBlob
{
- struct
- {
- /* <private> */
- guint reserved : 8;
- guint reserved2 :16;
- /* <public> */
- guint pointer : 1;
- /* <private> */
- guint reserved3 : 2;
- /* <public> */
- guint tag : 5;
- } flags;
+ SimpleTypeBlobFlags flags;
guint32 offset;
-} SimpleTypeBlob;
+};
+
+/**
+ * SimpleTypeBlob:
+ * @flags: TODO
+ * @offset: Offset relative to header->types that points to a TypeBlob.
+ * Unlike other offsets, this is in words (ie 32bit units) rather
+ * than bytes.
+ *
+ * The SimpleTypeBlob is the general purpose "reference to a type" construct,
+ * used in method parameters, returns, callback definitions, fields, constants,
+ * etc. It's actually just a 32 bit integer which you can see from the union
+ * definition. This is for efficiency reasons, since there are so many
+ * references to types.
+ *
+ * SimpleTypeBlob is divided into two cases; first, if "reserved" and
+ * "reserved2", the type tag for a basic type is embedded in the "tag" bits.
+ * This allows e.g. GI_TYPE_TAG_UTF8, GI_TYPE_TAG_INT and the like to be
+ * embedded directly without taking up extra space.
+ *
+ * References to "interfaces" (objects, interfaces) are more complicated;
+ * In this case, the integer is actually an offset into the directory (see
+ * above). Because the header is larger than 2^8=256 bits, all offsets will
+ * have one of the upper 24 bits set.
+ */
+typedef union _SimpleTypeBlob SimpleTypeBlob;
/**
* ArgBlob:
* @name: A suggested name for the parameter.
* @in: The parameter is an input to the function
- * @out: The parameter is used to return an output of the function.
- * Parameters can be both in and out. Out parameters implicitly
- * add another level of indirection to the parameter type. Ie if
- * the type is uint32 in an out parameter, the function actually
- * takes an uint32*.
- * @caller_allocates: The parameter is a pointer to a struct or object that will
- * receive an output of the function.
- * @allow_none: Only meaningful for types which are passed as pointers.
- * For an in parameter, indicates if it is ok to pass NULL in, for
- * an out parameter, whether it may return NULL. Note that NULL is a
- * valid GList and GSList value, thus allow_none will normally be set
- * for parameters of these types.
+ * @out: The parameter is used to return an output of the function. Parameters
+ * can be both in and out. Out parameters implicitly add another level of
+ * indirection to the parameter type. Ie if the type is uint32 in an out
+ * parameter, the function actually takes an uint32*.
+ * @caller_allocates: The parameter is a pointer to a struct or object that
+ * will receive an output of the function.
+ * @allow_none: Only meaningful for types which are passed as pointers. For an
+ * in parameter, indicates if it is ok to pass NULL in. Gor an out
+ * parameter, indicates whether it may return NULL. Note that NULL is a
+ * valid GList and GSList value, thus allow_none will normally be set
+ * for parameters of these types.
* @optional: For an out parameter, indicates that NULL may be passed in
- * if the value is not needed.
- * @transfer_ownership: For an in parameter, indicates that the function takes over
- * ownership of the parameter value. For an out parameter, it
- * indicates that the caller is responsible for freeing the return
- * value.
+ * if the value is not needed.
+ * @transfer_ownership: For an in parameter, indicates that the function takes
+ * over ownership of the parameter value. For an out parameter, it indicates
+ * that the caller is responsible for freeing the return value.
* @transfer_container_ownership: For container types, indicates that the
- * ownership of the container, but not of its contents is transferred. This is typically the case
- * for out parameters returning lists of statically allocated things.
- * @return_value: The parameter should be considered the return value of the function.
- * Only out parameters can be marked as return value, and there can be
- * at most one per function call. If an out parameter is marked as
- * return value, the actual return value of the function should be
- * either void or a boolean indicating the success of the call.
- * @scope: A #GIScopeType. If the parameter is of a callback type, this denotes the scope
- * of the user_data and the callback function pointer itself
- * (for languages that emit code at run-time).
- * @closure: Index of the closure (user_data) parameter associated with the callback,
- * or -1.
- * @destroy: Index of the destroy notfication callback parameter associated with
- * the callback, or -1.
- * @arg_type: Describes the type of the parameter. See details below.
+ * ownership of the container, but not of its contents is transferred.
+ * This is typically the case for out parameters returning lists of
+ * statically allocated things.
+ * @return_value: The parameter should be considered the return value of the
+ * function. Only out parameters can be marked as return value, and there
+ * can be at most one per function call. If an out parameter is marked as
+ * return value, the actual return value of the function should be either
+ * void or a boolean indicating the success of the call.
+ * @scope: A #GIScopeType. If the parameter is of a callback type, this denotes
+ * the scope of the user_data and the callback function pointer itself
+ * (for languages that emit code at run-time).
* @skip: Indicates that the parameter is only useful in C and should be skipped.
+ * @reserved: Reserved for future use.
+ * @closure: Index of the closure (user_data) parameter associated with the
+ * callback, or -1.
+ * @destroy: Index of the destroy notfication callback parameter associated
+ * with the callback, or -1.
+ * @padding: TODO
+ * @arg_type: Describes the type of the parameter. See details below.
*
* Types are specified by four bytes. If the three high bytes are zero,
* the low byte describes a basic type, otherwise the 32bit number is an
@@ -428,15 +444,11 @@ typedef struct {
guint return_value : 1;
guint scope : 3;
guint skip : 1;
- /* <private> */
guint reserved :20;
- /* <public> */
- gint8 closure;
- gint8 destroy;
+ gint8 closure;
+ gint8 destroy;
- /* <private> */
- guint16 padding;
- /* <public> */
+ guint16 padding;
SimpleTypeBlob arg_type;
} ArgBlob;
@@ -444,17 +456,21 @@ typedef struct {
/**
* SignatureBlob:
* @return_type: Describes the type of the return value. See details below.
- * @may_return_null: Only relevant for pointer types. Indicates whether the caller
- * must expect NULL as a return value.
- * @caller_owns_return_value: If set, the caller is responsible for freeing the return value
- * if it is no longer needed.
- * @caller_owns_return_container: This flag is only relevant if the return type is a container type.
- * If the flag is set, the caller is resonsible for freeing the
- * container, but not its contents.
- * @skip_return: Indicates that the return value is only useful in C and should be skipped.
- * @n_arguments: The number of arguments that this function expects, also the length
- * of the array of ArgBlobs.
+ * @may_return_null: Only relevant for pointer types. Indicates whether the
+ * caller must expect NULL as a return value.
+ * @caller_owns_return_value: If set, the caller is responsible for freeing
+ * the return value if it is no longer needed.
+ * @caller_owns_return_container: This flag is only relevant if the return type
+ * is a container type. If the flag is set, the caller is resonsible for
+ * freeing the container, but not its contents.
+ * @skip_return: Indicates that the return value is only useful in C and should
+ * be skipped.
+ * @reserved: Reserved for future use.
+ * @n_arguments: The number of arguments that this function expects, also the
+ * length of the array of ArgBlobs.
* @arguments: An array of ArgBlob for the arguments of the function.
+ *
+ * TODO
*/
typedef struct {
SimpleTypeBlob return_type;
@@ -474,43 +490,50 @@ typedef struct {
* CommonBlob:
* @blob_type: A #GTypelibBlobType
* @deprecated: Whether the blob is deprecated.
+ * @reserved: Reserved for future use.
* @name: The name of the blob.
*
* The #CommonBlob is shared between #FunctionBlob,
* #CallbackBlob, #SignalBlob.
+ *
+ * TODO
*/
typedef struct {
guint16 blob_type; /* 1 */
guint16 deprecated : 1;
- /* <private> */
guint16 reserved :15;
- /* <public> */
guint32 name;
} CommonBlob;
/**
* FunctionBlob:
- * @blob_Type: #BLOB_TYPE_FUNCTION
- * @symbol: The symbol which can be used to obtain the function pointer with
- * dlsym().
+ * @blob_type: #BLOB_TYPE_FUNCTION
* @deprecated: The function is deprecated.
* @setter: The function is a setter for a property. Language bindings may
- * prefer to not bind individual setters and rely on the generic
- * g_object_set().
+ * prefer to not bind individual setters and rely on the generic
+ * g_object_set().
* @getter: The function is a getter for a property. Language bindings may
- * prefer to not bind individual getters and rely on the generic
- * g_object_get().
- * @constructor:The function acts as a constructor for the object it is contained
- * in.
+ * prefer to not bind individual getters and rely on the generic
+ * g_object_get().
+ * @constructor: The function acts as a constructor for the object it is
+ * contained in.
* @wraps_vfunc: The function is a simple wrapper for a virtual function.
+ * @throws: TODO
* @index: Index of the property that this function is a setter or getter of
- * in the array of properties of the containing interface, or index
- * of the virtual function that this function wraps.
+ * in the array of properties of the containing interface, or index
+ * of the virtual function that this function wraps.
+ * @name: TODO
+ * @symbol: The symbol which can be used to obtain the function pointer with
+ * dlsym().
* @signature: Offset of the SignatureBlob describing the parameter types and the
- * return value type.
+ * return value type.
* @is_static: The function is a "static method"; in other words it's a pure
- * function whose name is conceptually scoped to the object.
+ * function whose name is conceptually scoped to the object.
+ * @reserved: Reserved for future use.
+ * @reserved2: Reserved for future use.
+ *
+ * TODO
*/
typedef struct {
guint16 blob_type; /* 1 */
@@ -537,16 +560,20 @@ typedef struct {
/**
* CallbackBlob:
- * @signature: Offset of the #SignatureBlob describing the parameter types and the
- * return value type.
+ * @blob_type: TODO
+ * @deprecated: TODO
+ * @reserved: Reserved for future use.
+ * @name: TODO
+ * @signature: Offset of the #SignatureBlob describing the parameter types and
+ * the return value type.
+ *
+ * TODO
*/
typedef struct {
guint16 blob_type; /* 2 */
guint16 deprecated : 1;
- /* <private> */
guint16 reserved :15;
- /* <public> */
guint32 name;
guint32 signature;
} CallbackBlob;
@@ -554,41 +581,52 @@ typedef struct {
/**
* InterfaceTypeBlob:
* @pointer: Whether this type represents an indirection
+ * @reserved: Reserved for future use.
* @tag: A #GITypeTag
+ * @reserved2: Reserved for future use.
* @interface: Index of the directory entry for the interface.
*
* If the interface is an enum of flags type, is_pointer is 0, otherwise it is 1.
*/
typedef struct {
guint8 pointer :1;
- /* <private> */
guint8 reserved :2;
- /* <public> */
guint8 tag :5;
- /* <private> */
guint8 reserved2;
- /* <public> */
guint16 interface;
} InterfaceTypeBlob;
/**
+ * ArrayTypeDimension:
+ * @length: TODO
+ * @size: TODO
+ *
+ * TODO
+ */
+typedef union {
+ guint16 length;
+ guint16 size;
+} ArrayTypeDimension;
+
+/**
* ArrayTypeBlob:
- * @zero_terminated: Indicates that the array must be terminated by a suitable #NULL
- * value.
- * @has_length: Indicates that length points to a parameter specifying the length
- * of the array. If both has_length and zero_terminated are set, the
- * convention is to pass -1 for the length if the array is
- * zero-terminated.
+ * @pointer: TODO
+ * @reserved: Reserved for future use.
+ * @tag: TODO
+ * @zero_terminated: Indicates that the array must be terminated by a suitable
+ * #NULL value.
+ * @has_length: Indicates that length points to a parameter specifying the
+ * length of the array. If both has_length and zero_terminated are set, the
+ * convention is to pass -1 for the length if the array is zero-terminated.
* @has_size: Indicates that size is the fixed size of the array.
* @array_type: Indicates whether this is a C array, GArray, GPtrArray, or
- * GByteArray. If something other than a C array, the length and element size
- * are implicit in the structure.
- * @length: The index of the parameter which is used to pass the length of the
- * array. The parameter must be an integer type and have the same
- * direction as this one.
- * @size: The fixed size of the array.
- * @type: The type of the array elements.
- * Arrays are passed by reference, thus is_pointer is always 1.
+ * GByteArray. If something other than a C array, the length and element
+ * size are implicit in the structure.
+ * @reserved2: Reserved for future use.
+ * @dimensions: TODO
+ * @type: TODO
+ *
+ * TODO
*/
typedef struct {
guint16 pointer :1;
@@ -601,19 +639,21 @@ typedef struct {
guint16 array_type :2;
guint16 reserved2 :3;
- union {
- guint16 length;
- guint16 size;
- } dimensions;
+ ArrayTypeDimension dimensions;
SimpleTypeBlob type;
} ArrayTypeBlob;
/**
* ParamTypeBlob:
+ * @pointer: TODO
+ * @reserved: Reserved for future use.
+ * @tag: TODO
+ * @reserved2: Reserved for future use.
* @n_types: The number of parameter types to follow.
* @type: Describes the type of the list elements.
*
+ * TODO
*/
typedef struct {
guint8 pointer :1;
@@ -628,6 +668,14 @@ typedef struct {
/**
* ErrorTypeBlob:
+ * @pointer: TODO
+ * @reserved: TODO
+ * @tag: TODO
+ * @reserved2: TODO
+ * @n_domains: TODO: must be 0
+ * @domains: TODO
+ *
+ * TODO
*/
typedef struct {
guint8 pointer :1;
@@ -644,17 +692,16 @@ typedef struct {
* ValueBlob:
* @deprecated: Whether this value is deprecated
* @unsigned_value: if set, value is a 32-bit unsigned integer cast to gint32
- * @value: The numerical value
+ * @reserved: Reserved for future use.
* @name: Name of blob
+ * @value: The numerical value
*
* Values commonly occur in enums and flags.
*/
typedef struct {
guint32 deprecated : 1;
guint32 unsigned_value : 1;
- /* <private> */
guint32 reserved :30;
- /* <public> */
guint32 name;
gint32 value;
} ValueBlob;
@@ -662,15 +709,18 @@ typedef struct {
/**
* FieldBlob:
* @name: The name of the field.
- * @readable:
+ * @readable: TODO
* @writable: How the field may be accessed.
* @has_embedded_type: An anonymous type follows the FieldBlob.
+ * @reserved: Reserved for future use.
* @bits: If this field is part of a bitfield, the number of bits which it
- * uses, otherwise 0.
- * @struct_offset:
- * The offset of the field in the struct. The value 0xFFFF indicates
- * that the struct offset is unknown.
+ * uses, otherwise 0.
+ * @struct_offset: The offset of the field in the struct. The value 0xFFFF
+ * indicates that the struct offset is unknown.
+ * @reserved2: Reserved for future use.
* @type: The type of the field.
+ *
+ * TODO
*/
typedef struct {
guint32 name;
@@ -690,8 +740,16 @@ typedef struct {
/**
* RegisteredTypeBlob:
+ * @blob_type: TODO
+ * @deprecated: TODO
+ * @unregistered: TODO
+ * @reserved: Reserved for future use.
+ * @name: TODO
* @gtype_name: The name under which the type is registered with GType.
- * @gtype_init: The symbol name of the get_type() function which registers the type.
+ * @gtype_init: The symbol name of the get_type<!-- -->() function which registers the
+ * type.
+ *
+ * TODO
*/
typedef struct {
guint16 blob_type;
@@ -709,16 +767,22 @@ typedef struct {
* @blob_type: #BLOB_TYPE_STRUCT
* @deprecated: Whether this structure is deprecated
* @unregistered: If this is set, the type is not registered with GType.
+ * @is_gtype_struct: Whether this structure is the class or interface layout
+ * for a GObject
* @alignment: The byte boundary that the struct is aligned to in memory
- * @is_gtype_struct: Whether this structure is the class or interface layout for a GObject
* @foreign: If the type is foreign, eg if it's expected to be overridden by
- * a native language binding instead of relying of introspected bindings.
- * @size: The size of the struct in bytes.
+ * a native language binding instead of relying of introspected bindings.
+ * @reserved: Reserved for future use.
+ * @name: TODO
* @gtype_name: String name of the associated #GType
* @gtype_init: String naming the symbol which gets the runtime #GType
- * @n_fields:
- * @fields: An array of n_fields FieldBlobs.
- * should be considered as methods of the struct.
+ * @size: The size of the struct in bytes.
+ * @n_fields: TODO
+ * @n_methods: TODO
+ * @reserved2: Reserved for future use.
+ * @reserved3: Reserved for future use.
+ *
+ * TODO
*/
typedef struct {
guint16 blob_type;
@@ -742,29 +806,30 @@ typedef struct {
guint32 reserved2;
guint32 reserved3;
-
-#if 0
- /* variable-length parts of the blob */
- FieldBlob fields[];
- FunctionBlob methods[];
-#endif
} StructBlob;
/**
* UnionBlob:
+ * @blob_type: TODO
+ * @deprecated: TODO
* @unregistered: If this is set, the type is not registered with GType.
* @discriminated: Is set if the union is discriminated
* @alignment: The byte boundary that the union is aligned to in memory
- * @size: The size of the union in bytes.
+ * @reserved: Reserved for future use.
+ * @name: TODO
* @gtype_name: String name of the associated #GType
* @gtype_init: String naming the symbol which gets the runtime #GType
+ * @size: TODO
* @n_fields: Length of the arrays
+ * @n_functions: TODO
+ * @reserved2: Reserved for future use.
+ * @reserved3: Reserved for future use.
* @discriminator_offset: Offset from the beginning of the union where the
- * discriminator of a discriminated union is located.
- * The value 0xFFFF indicates that the discriminator offset
- * is unknown.
+ * discriminator of a discriminated union is located. The value 0xFFFF
+ * indicates that the discriminator offset is unknown.
* @discriminator_type: Type of the discriminator
- * @fields: Array of FieldBlobs describing the alternative branches of the union
+ *
+ * TODO
*/
typedef struct {
guint16 blob_type;
@@ -788,27 +853,25 @@ typedef struct {
gint32 discriminator_offset;
SimpleTypeBlob discriminator_type;
-
-#if 0
- FieldBlob fields[];
- FunctionBlob functions[];
- ConstantBlob discriminator_values[]
-#endif
} UnionBlob;
/**
* EnumBlob:
+ * @blob_type: TODO
+ * @deprecated: TODO
* @unregistered: If this is set, the type is not registered with GType.
* @storage_type: The tag of the type used for the enum in the C ABI
- * (will be a signed or unsigned integral type)
+ * (will be a signed or unsigned integral type)
+ * @reserved: Reserved for future use.
+ * @name: TODO
* @gtype_name: String name of the associated #GType
* @gtype_init: String naming the symbol which gets the runtime #GType
- * @error_domain: String naming the #GError domain this enum is
- * associated with
* @n_values: The length of the values array.
* @n_methods: The length of the methods array.
- * @values: Describes the enum values.
- * @methods: Describes the enum methods.
+ * @error_domain: String naming the #GError domain this enum is associated with
+ * @values: TODO
+ *
+ * TODO
*/
typedef struct {
guint16 blob_type;
@@ -829,25 +892,28 @@ typedef struct {
guint32 error_domain;
ValueBlob values[];
-#if 0
- FunctionBlob methods[];
-#endif
} EnumBlob;
/**
* PropertyBlob:
- * @name: The name of the property.
- * @readable:
- * @writable:
- * @construct:
+ * @name: The name of the property.
+ * @deprecated: TODO
+ * @readable: TODO
+ * @writable: TODO
+ * @construct: TODO
* @construct_only: The ParamFlags used when registering the property.
* @transfer_ownership: When writing, the type containing the property takes
- * ownership of the value. When reading, the returned value needs to be released
- * by the caller.
+ * ownership of the value. When reading, the returned value needs to be
+ * released by the caller.
* @transfer_container_ownership: For container types indicates that the
- * ownership of the container, but not of its contents, is transferred. This is
- * typically the case when reading lists of statically allocated things.
+ * ownership of the container, but not of its contents, is transferred.
+ * This is typically the case when reading lists of statically allocated
+ * things.
+ * @reserved: Reserved for future use.
+ * @reserved2: Reserved for future use.
* @type: Describes the type of the property.
+ *
+ * TODO
*/
typedef struct {
guint32 name;
@@ -868,20 +934,25 @@ typedef struct {
/**
* SignalBlob:
- * @name: The name of the signal.
- * @run_first:
- * @run_last:
- * @run_cleanup:
- * @no_recurse:
- * @detailed:
- * @action:
+ * @deprecated: TODO
+ * @run_first: TODO
+ * @run_last: TODO
+ * @run_cleanup: TODO
+ * @no_recurse: TODO
+ * @detailed: TODO
+ * @action: TODO
* @no_hooks: The flags used when registering the signal.
* @has_class_closure: Set if the signal has a class closure.
* @true_stops_emit: Whether the signal has true-stops-emit semantics
- * @class_closure: The index of the class closure in the list of virtual functions
- * of the object or interface on which the signal is defined.
- * @signature: Offset of the SignatureBlob describing the parameter types and the
- * return value type.
+ * @reserved: Reserved for future use.
+ * @class_closure: The index of the class closure in the list of virtual
+ * functions of the object or interface on which the signal is defined.
+ * @name: The name of the signal.
+ * @reserved2: Reserved for future use.
+ * @signature: Offset of the SignatureBlob describing the parameter types
+ * and the return value type.
+ *
+ * TODO
*/
typedef struct {
guint16 deprecated : 1;
@@ -909,19 +980,28 @@ typedef struct {
* VFuncBlob:
* @name: The name of the virtual function.
* @must_chain_up: If set, every implementation of this virtual function must
- * chain up to the implementation of the parent class.
- * @must_be_implemented: If set, every derived class must override this virtual function.
- * @must_not_be_implemented: If set, derived class must not override this virtual function.
- * @class_closure: Set if this virtual function is the class closure of a signal.
+ * chain up to the implementation of the parent class.
+ * @must_be_implemented: If set, every derived class must override this virtual
+ * function.
+ * @must_not_be_implemented: If set, derived class must not override this
+ * virtual function.
+ * @class_closure: Set if this virtual function is the class closure of a
+ * signal.
+ * @throws: TODO
+ * @reserved: Reserved for future use.
* @signal: The index of the signal in the list of signals of the object or
- * interface to which this virtual function belongs.
- * @struct_offset: The offset of the function pointer in the class struct. The value
- * 0xFFFF indicates that the struct offset is unknown.
- * @invoker: If a method invoker for this virtual exists, this is the offset in the
- * class structure of the method. If no method is known, this value will be 0x3ff.
- * @signature:
- * Offset of the SignatureBlob describing the parameter types and the
- * return value type.
+ * interface to which this virtual function belongs.
+ * @struct_offset: The offset of the function pointer in the class struct.
+ * The value 0xFFFF indicates that the struct offset is unknown.
+ * @invoker: If a method invoker for this virtual exists, this is the offset
+ * in the class structure of the method. If no method is known, this value
+ * will be 0x3ff.
+ * @reserved2: Reserved for future use.
+ * @reserved3: Reserved for future use.
+ * @signature: Offset of the SignatureBlob describing the parameter types and
+ * the return value type.
+ *
+ * TODO
*/
typedef struct {
guint32 name;
@@ -945,36 +1025,41 @@ typedef struct {
/**
* ObjectBlob:
* @blob_type: #BLOB_TYPE_OBJECT
+ * @deprecated: TODO
+ * @abstract: TODO
* @fundamental: this object is not a GObject derived type, instead it's
- * an additional fundamental type.
+ * an additional fundamental type.
+ * @reserved: Reserved for future use.
+ * @name: TODO
* @gtype_name: String name of the associated #GType
* @gtype_init: String naming the symbol which gets the runtime #GType
* @parent: The directory index of the parent type. This is only set for
- * objects. If an object does not have a parent, it is zero.
- * @n_interfaces:
- * @n_fields:
- * @n_properties:
- * @n_methods:
- * @n_signals:
- * @n_vfuncs:
- * @n_constants: The lengths of the arrays.Up to 16bits of padding may be inserted
- * between the arrays to ensure that they start on a 32bit boundary.
- * @interfaces: An array of indices of directory entries for the implemented
- * interfaces.
- * @fields: Describes the fields.
- * @methods: Describes the methods, constructors, setters and getters.
- * @properties: Describes the properties.
- * @signals: Describes the signals.
- * @vfuncs: Describes the virtual functions.
- * @constants: Describes the constants.
+ * objects. If an object does not have a parent, it is zero.
+ * @gtype_struct: TODO
+ * @n_interfaces: TODO
+ * @n_fields: TODO
+ * @n_properties: TODO
+ * @n_methods: TODO
+ * @n_signals: TODO
+ * @n_vfuncs: TODO
+ * @n_constants: The lengths of the arrays.Up to 16bits of padding may be
+ * inserted between the arrays to ensure that they start on a 32bit
+ * boundary.
+ * @reserved2: Reserved for future use.
* @ref_func: String pointing to a function which can be called to increase
- * the reference count for an instance of this object type.
+ * the reference count for an instance of this object type.
* @unref_func: String pointing to a function which can be called to decrease
- * the reference count for an instance of this object type.
+ * the reference count for an instance of this object type.
* @set_value_func: String pointing to a function which can be called to
- * convert a pointer of this object to a GValue
+ * convert a pointer of this object to a GValue
* @get_value_func: String pointing to a function which can be called to
- * convert extract a pointer to this object from a GValue
+ * convert extract a pointer to this object from a GValue
+ * @reserved3: Reserved for future use.
+ * @reserved4: Reserved for future use.
+ * @interfaces: An array of indices of directory entries for the implemented
+ * interfaces.
+ *
+ * TODO
*/
typedef struct {
guint16 blob_type; /* 7 */
@@ -1008,35 +1093,32 @@ typedef struct {
guint32 reserved4;
guint16 interfaces[];
-
-#if 0
- /* variable-length parts of the blob */
- FieldBlob fields[];
- PropertyBlob properties[];
- FunctionBlob methods[];
- SignalBlob signals[];
- VFuncBlob vfuncs[];
- ConstantBlob constants[];
-#endif
} ObjectBlob;
/**
* InterfaceBlob:
+ * @blob_type: TODO
+ * @deprecated: TODO
+ * @reserved: Reserved for future use.
+ * @name: TODO
+ * @gtype_name: TODO
+ * @gtype_init: TODO
* @gtype_struct: Name of the interface "class" C structure
* @n_prerequisites: Number of prerequisites
* @n_properties: Number of properties
* @n_methods: Number of methods
* @n_signals: Number of signals
* @n_vfuncs: Number of virtual functions
- * @n_constants: The lengths of the arrays.
- * Up to 16bits of padding may be inserted between the arrays to ensure that they
- * start on a 32bit boundary.
- * @prerequisites: An array of indices of directory entries for required interfaces.
- * @methods: Describes the methods, constructors, setters and getters.
- * @properties: Describes the properties.
- * @signals: Describes the signals.
- * @vfuncs: Describes the virtual functions.
- * @constants: Describes the constants.
+ * @n_constants: The lengths of the arrays. Up to 16bits of padding may be
+ * inserted between the arrays to ensure that they start on a 32bit
+ * boundary.
+ * @padding: TODO
+ * @reserved2: Reserved for future use.
+ * @reserved3: Reserved for future use.
+ * @prerequisites: An array of indices of directory entries for required
+ * interfaces.
+ *
+ * TODO
*/
typedef struct {
guint16 blob_type;
@@ -1061,23 +1143,21 @@ typedef struct {
guint32 reserved3;
guint16 prerequisites[];
-
-#if 0
- /* variable-length parts of the blob */
- PropertyBlob properties[];
- FunctionBlob methods[];
- SignalBlob signals[];
- VFuncBlob vfuncs[];
- ConstantBlob constants[];
-#endif
} InterfaceBlob;
/**
* ConstantBlob:
- * @type: The type of the value. In most cases this should be a numeric
- * type or string.
+ * @blob_type: TODO
+ * @deprecated: TODO
+ * @reserved: Reserved for future use.
+ * @name: TODO
+ * @type: The type of the value. In most cases this should be a numeric type
+ * or string.
* @size: The size of the value in bytes.
* @offset: The offset of the value in the typelib.
+ * @reserved2: Reserved for future use.
+ *
+ * TODO
*/
typedef struct {
guint16 blob_type;
@@ -1096,10 +1176,12 @@ typedef struct {
/**
* AttributeBlob:
* @offset: The offset of the typelib entry to which this attribute refers.
- * Attributes are kept sorted by offset, so that the attributes
- * of an entry can be found by a binary search.
+ * Attributes are kept sorted by offset, so that the attributes of an
+ * entry can be found by a binary search.
* @name: The name of the attribute, a string.
* @value: The value of the attribute (also a string)
+ *
+ * TODO
*/
typedef struct {
guint32 offset;
@@ -1107,9 +1189,6 @@ typedef struct {
guint32 value;
} AttributeBlob;
-/**
- * GITypelib:
- */
struct _GITypelib {
/* <private> */
guchar *data;
@@ -1126,15 +1205,26 @@ DirEntry *g_typelib_get_dir_entry (GITypelib *typelib,
DirEntry *g_typelib_get_dir_entry_by_name (GITypelib *typelib,
const char *name);
-DirEntry *g_typelib_get_dir_entry_by_gtype (GITypelib *typelib,
- gboolean fastpass,
- GType gtype);
+DirEntry *g_typelib_get_dir_entry_by_gtype_name (GITypelib *typelib,
+ const gchar *gtype_name);
DirEntry *g_typelib_get_dir_entry_by_error_domain (GITypelib *typelib,
GQuark error_domain);
+gboolean g_typelib_matches_gtype_name_prefix (GITypelib *typelib,
+ const gchar *gtype_name);
+
void g_typelib_check_sanity (void);
+/**
+ * g_typelib_get_string:
+ * @typelib: TODO
+ * @offset: TODO
+ *
+ * TODO
+ *
+ * Returns: TODO
+ */
#define g_typelib_get_string(typelib,offset) ((const gchar*)&(typelib->data)[(offset)])
@@ -1157,6 +1247,11 @@ typedef enum
G_TYPELIB_ERROR_INVALID_BLOB
} GITypelibError;
+/**
+ * G_TYPELIB_ERROR:
+ *
+ * TODO
+ */
#define G_TYPELIB_ERROR (g_typelib_error_quark ())
GQuark g_typelib_error_quark (void);
@@ -1169,6 +1264,11 @@ gboolean g_typelib_validate (GITypelib *typelib,
AttributeBlob *_attribute_blob_find_first (GIBaseInfo *info,
guint32 blob_offset);
+/**
+ * GITypelibHashBuilder:
+ *
+ * TODO
+ */
typedef struct _GITypelibHashBuilder GITypelibHashBuilder;
GITypelibHashBuilder * _gi_typelib_hash_builder_new (void);
diff --git a/girepository/gitypelib.c b/girepository/gitypelib.c
index 2af17e96..8883496e 100644
--- a/girepository/gitypelib.c
+++ b/girepository/gitypelib.c
@@ -27,7 +27,6 @@
#include "config.h"
#include "gitypelib-internal.h"
-#include "glib-compat.h"
typedef struct {
GITypelib *typelib;
@@ -131,6 +130,15 @@ get_type_blob (GITypelib *typelib,
return (InterfaceTypeBlob*) get_blob (typelib, simple->offset, error);
}
+/**
+ * g_typelib_get_dir_entry:
+ * @typelib: TODO
+ * @index: TODO
+ *
+ * TODO
+ *
+ * Returns: TODO
+ */
DirEntry *
g_typelib_get_dir_entry (GITypelib *typelib,
guint16 index)
@@ -160,6 +168,15 @@ get_section_by_id (GITypelib *typelib,
return NULL;
}
+/**
+ * g_typelib_get_dir_entry_by_name:
+ * @typelib: TODO
+ * @name: TODO
+ *
+ * TODO
+ *
+ * Returns: TODO
+ */
DirEntry *
g_typelib_get_dir_entry_by_name (GITypelib *typelib,
const char *name)
@@ -197,56 +214,27 @@ g_typelib_get_dir_entry_by_name (GITypelib *typelib,
}
}
+/**
+ * g_typelib_get_dir_entry_by_gtype_name:
+ * @typelib: TODO
+ * @gtype_name: TODO
+ *
+ * TODO
+ *
+ * Returns: TODO
+ */
DirEntry *
-g_typelib_get_dir_entry_by_gtype (GITypelib *typelib,
- gboolean fastpass,
- GType gtype)
+g_typelib_get_dir_entry_by_gtype_name (GITypelib *typelib,
+ const gchar *gtype_name)
{
Header *header = (Header *)typelib->data;
- guint n_entries = header->n_local_entries;
- const char *gtype_name = g_type_name (gtype);
- DirEntry *entry;
guint i;
- const char *c_prefix;
- /* There is a corner case regarding GdkRectangle. GdkRectangle is a
- boxed type, but it is just an alias to boxed struct
- CairoRectangleInt. Scanner automatically converts all references
- to GdkRectangle to CairoRectangleInt, so GdkRectangle does not
- appear in the typelibs at all, although user code might query it.
- So if we get such query, we also change it to lookup of
- CairoRectangleInt.
- https://bugzilla.gnome.org/show_bug.cgi?id=655423 */
- if (!fastpass && !strcmp (gtype_name, "GdkRectangle"))
- gtype_name = "CairoRectangleInt";
-
- /* Inside each typelib, we include the "C prefix" which acts as
- * a namespace mechanism. For GtkTreeView, the C prefix is Gtk.
- * Given the assumption that GTypes for a library also use the
- * C prefix, we know we can skip examining a typelib if our
- * target type does not have this typelib's C prefix.
- *
- * However, not every class library necessarily conforms to this,
- * e.g. Clutter has Cogl inside it. So, we split this into two
- * passes. First we try a lookup, skipping things which don't
- * have the prefix. If that fails then we try a global lookup,
- * ignoring the prefix.
- *
- * See http://bugzilla.gnome.org/show_bug.cgi?id=564016
- */
- c_prefix = g_typelib_get_string (typelib, header->c_prefix);
- if (fastpass && c_prefix != NULL)
- {
- if (g_ascii_strncasecmp (c_prefix, gtype_name, strlen (c_prefix)) != 0)
- return NULL;
- }
-
- for (i = 1; i <= n_entries; i++)
+ for (i = 1; i <= header->n_local_entries; i++)
{
RegisteredTypeBlob *blob;
const char *type;
-
- entry = g_typelib_get_dir_entry (typelib, i);
+ DirEntry *entry = g_typelib_get_dir_entry (typelib, i);
if (!BLOB_IS_REGISTERED_TYPE (entry))
continue;
@@ -261,6 +249,128 @@ g_typelib_get_dir_entry_by_gtype (GITypelib *typelib,
return NULL;
}
+typedef struct {
+ const char *s;
+ const char *separator;
+ gsize sep_len;
+ GString buf;
+} StrSplitIter;
+
+static void
+strsplit_iter_init (StrSplitIter *iter,
+ const char *s,
+ const char *separator)
+{
+ iter->s = s;
+ iter->separator = separator;
+ iter->sep_len = strlen (separator);
+ iter->buf.str = NULL;
+ iter->buf.len = 0;
+ iter->buf.allocated_len = 0;
+}
+
+static gboolean
+strsplit_iter_next (StrSplitIter *iter,
+ char **out_val)
+{
+ const char *s = iter->s;
+ const char *next;
+ gsize len;
+
+ if (!s)
+ return FALSE;
+ next = strstr (s, iter->separator);
+ if (next)
+ {
+ iter->s = next + iter->sep_len;
+ len = next - s;
+ }
+ else
+ {
+ iter->s = NULL;
+ len = strlen (s);
+ }
+ if (len == 0)
+ {
+ *out_val = "";
+ }
+ else
+ {
+ g_string_overwrite_len (&iter->buf, 0, s, (gssize)len);
+ *out_val = iter->buf.str;
+ }
+ return TRUE;
+}
+
+static void
+strsplit_iter_clear (StrSplitIter *iter)
+{
+ g_free (iter->buf.str);
+}
+
+/**
+ * g_typelib_matches_gtype_name_prefix:
+ * @typelib: TODO
+ * @gtype_name: TODO
+ *
+ * TODO
+ *
+ * Returns: TODO
+ */
+gboolean
+g_typelib_matches_gtype_name_prefix (GITypelib *typelib,
+ const gchar *gtype_name)
+{
+ Header *header = (Header *)typelib->data;
+ const char *c_prefix;
+ gchar *prefix;
+ gboolean ret = FALSE;
+ StrSplitIter split_iter;
+ gsize gtype_name_len;
+
+ c_prefix = g_typelib_get_string (typelib, header->c_prefix);
+ if (c_prefix == NULL || strlen (c_prefix) == 0)
+ return FALSE;
+
+ gtype_name_len = strlen (gtype_name);
+
+ /* c_prefix is a comma separated string of supported prefixes
+ * in the typelib.
+ * We match the specified gtype_name if the gtype_name starts
+ * with the prefix, and is followed by a capital letter.
+ * For example, a typelib offering the 'Gdk' prefix does match
+ * GdkX11Cursor, however a typelib offering the 'G' prefix does not.
+ */
+ strsplit_iter_init (&split_iter, c_prefix, ",");
+ while (strsplit_iter_next (&split_iter, &prefix))
+ {
+ size_t len = strlen (prefix);
+
+ if (gtype_name_len < len)
+ continue;
+
+ if (strncmp (prefix, gtype_name, len) != 0)
+ continue;
+
+ if (g_ascii_isupper (gtype_name[len]))
+ {
+ ret = TRUE;
+ break;
+ }
+ }
+ strsplit_iter_clear (&split_iter);
+ return ret;
+}
+
+/**
+ * g_typelib_get_dir_entry_by_error_domain:
+ * @typelib: TODO
+ * @error_domain: TODO
+ *
+ * TODO
+ *
+ * Returns: TODO
+ */
DirEntry *
g_typelib_get_dir_entry_by_error_domain (GITypelib *typelib,
GQuark error_domain)
@@ -291,6 +401,11 @@ g_typelib_get_dir_entry_by_error_domain (GITypelib *typelib,
return NULL;
}
+/**
+ * g_typelib_check_sanity:
+ *
+ * TODO
+ */
void
g_typelib_check_sanity (void)
{
@@ -2024,6 +2139,15 @@ prefix_with_context (GError **error,
g_free (buf);
}
+/**
+ * g_typelib_validate:
+ * @typelib: TODO
+ * @error: TODO
+ *
+ * TODO
+ *
+ * Returns: TODO
+ */
gboolean
g_typelib_validate (GITypelib *typelib,
GError **error)
@@ -2053,6 +2177,13 @@ g_typelib_validate (GITypelib *typelib,
return TRUE;
}
+/**
+ * g_typelib_error_quark:
+ *
+ * TODO
+ *
+ * Returns: TODO
+ */
GQuark
g_typelib_error_quark (void)
{
@@ -2062,6 +2193,72 @@ g_typelib_error_quark (void)
return quark;
}
+static GSList *library_paths;
+
+/**
+ * g_irepository_prepend_library_path:
+ * @directory: (type filename): a single directory to scan for shared libraries
+ *
+ * Prepends @directory to the search path that is used to
+ * search shared libraries referenced by imported namespaces.
+ * Multiple calls to this function all contribute to the final
+ * list of paths.
+ * The list of paths is unique and shared for all #GIRepository
+ * instances across the process, but it doesn't affect namespaces
+ * imported before the call.
+ *
+ * If the library is not found in the directories configured
+ * in this way, loading will fall back to the system library
+ * path (ie. LD_LIBRARY_PATH and DT_RPATH in ELF systems).
+ * See the documentation of your dynamic linker for full details.
+ *
+ * Since: 1.35.8
+ */
+void
+g_irepository_prepend_library_path (const char *directory)
+{
+ library_paths = g_slist_prepend (library_paths,
+ g_strdup (directory));
+}
+
+/* Note on the GModule flags used by this function:
+
+ * Glade's autoconnect feature and OpenGL's extension mechanism
+ * as used by Clutter rely on g_module_open(NULL) to work as a means of
+ * accessing the app's symbols. This keeps us from using
+ * G_MODULE_BIND_LOCAL. BIND_LOCAL may have other issues as well;
+ * in general libraries are not expecting multiple copies of
+ * themselves and are not expecting to be unloaded. So we just
+ * load modules globally for now.
+ */
+static GModule *
+load_one_shared_library (const char *shlib)
+{
+ GSList *p;
+ GModule *m;
+
+ if (!g_path_is_absolute (shlib))
+ {
+ /* First try in configured library paths */
+ for (p = library_paths; p; p = p->next)
+ {
+ char *path = g_build_filename (p->data, shlib, NULL);
+
+ m = g_module_open (path, G_MODULE_BIND_LAZY);
+
+ g_free (path);
+ if (m != NULL)
+ return m;
+ }
+ }
+
+ /* Then try loading from standard paths */
+ /* Do not attempt to fix up shlib to replace .la with .so:
+ it's done by GModule anyway.
+ */
+ return g_module_open (shlib, G_MODULE_BIND_LAZY);
+}
+
static void
_g_typelib_do_dlopen (GITypelib *typelib)
{
@@ -2091,30 +2288,7 @@ _g_typelib_do_dlopen (GITypelib *typelib)
{
GModule *module;
- /* Glade's autoconnect feature and OpenGL's extension mechanism
- * as used by Clutter rely on g_module_open(NULL) to work as a means of
- * accessing the app's symbols. This keeps us from using
- * G_MODULE_BIND_LOCAL. BIND_LOCAL may have other issues as well;
- * in general libraries are not expecting multiple copies of
- * themselves and are not expecting to be unloaded. So we just
- * load modules globally for now.
- */
-
- module = g_module_open (shlibs[i], G_MODULE_BIND_LAZY);
-
- if (module == NULL)
- {
- GString *shlib_full = g_string_new (shlibs[i]);
-
- module = g_module_open (shlib_full->str, G_MODULE_BIND_LAZY);
- if (module == NULL)
- {
- g_string_overwrite (shlib_full, strlen (shlib_full->str)-2, SHLIB_SUFFIX);
- module = g_module_open (shlib_full->str, G_MODULE_BIND_LAZY);
- }
-
- g_string_free (shlib_full, TRUE);
- }
+ module = load_one_shared_library (shlibs[i]);
if (module == NULL)
{
@@ -2163,8 +2337,8 @@ _g_typelib_ensure_open (GITypelib *typelib)
* pointed to by @typelib will be automatically g_free()d when the
* repository is destroyed.
*
- * Return value: the new #GITypelib
- **/
+ * Returns: the new #GITypelib
+ */
GITypelib *
g_typelib_new_from_memory (guint8 *memory,
gsize len,
@@ -2192,8 +2366,8 @@ g_typelib_new_from_memory (guint8 *memory,
*
* Creates a new #GITypelib from a memory location.
*
- * Return value: the new #GITypelib
- **/
+ * Returns: the new #GITypelib
+ */
GITypelib *
g_typelib_new_from_const_memory (const guchar *memory,
gsize len,
@@ -2220,8 +2394,8 @@ g_typelib_new_from_const_memory (const guchar *memory,
*
* Creates a new #GITypelib from a #GMappedFile.
*
- * Return value: the new #GITypelib
- **/
+ * Returns: the new #GITypelib
+ */
GITypelib *
g_typelib_new_from_mapped_file (GMappedFile *mfile,
GError **error)
@@ -2247,7 +2421,7 @@ g_typelib_new_from_mapped_file (GMappedFile *mfile,
* @typelib: a #GITypelib
*
* Free a #GITypelib.
- **/
+ */
void
g_typelib_free (GITypelib *typelib)
{
@@ -2264,6 +2438,14 @@ g_typelib_free (GITypelib *typelib)
g_slice_free (GITypelib, typelib);
}
+/**
+ * g_typelib_get_namespace:
+ * @typelib: TODO
+ *
+ * TODO
+ *
+ * Returns: TODO
+ */
const gchar *
g_typelib_get_namespace (GITypelib *typelib)
{
@@ -2278,8 +2460,8 @@ g_typelib_get_namespace (GITypelib *typelib)
*
* Loads a symbol from #GITypelib.
*
- * Return value: #TRUE on success
- **/
+ * Returns: #TRUE on success
+ */
gboolean
g_typelib_symbol (GITypelib *typelib, const char *symbol_name, gpointer *symbol)
{
diff --git a/girepository/gitypelib.h b/girepository/gitypelib.h
index 52c5c400..0726bf19 100644
--- a/girepository/gitypelib.h
+++ b/girepository/gitypelib.h
@@ -31,6 +31,19 @@
G_BEGIN_DECLS
+/**
+ * SECTION:gitypelib
+ * @title: gitypelib
+ * @short_description: TODO
+ *
+ * TODO
+ */
+
+/**
+ * GITypelib:
+ *
+ * TODO
+ */
typedef struct _GITypelib GITypelib;
GITypelib * g_typelib_new_from_memory (guint8 *memory,
diff --git a/girepository/gitypes.h b/girepository/gitypes.h
index a90ed4c8..cb8cb344 100644
--- a/girepository/gitypes.h
+++ b/girepository/gitypes.h
@@ -29,7 +29,9 @@
G_BEGIN_DECLS
+#ifndef __GTK_DOC_IGNORE__
typedef struct _GIBaseInfoStub GIBaseInfo;
+#endif
/**
* GICallableInfo:
@@ -47,6 +49,25 @@ typedef GIBaseInfo GICallableInfo;
typedef GIBaseInfo GIFunctionInfo;
/**
+ * SECTION:gicallbackinfo
+ * @title: GICallbackInfo
+ * @short_description: Struct representing a callback
+ *
+ * GICallbackInfo represents a callback.
+ *
+ * <refsect1 id="gi-gicallbackinfo.struct-hierarchy" role="struct_hierarchy">
+ * <title role="struct_hierarchy.title">Struct hierarchy</title>
+ * <synopsis>
+ * <link linkend="gi-GIBaseInfo">GIBaseInfo</link>
+ * +----<link linkend="gi-GICallableInfo">GICallableInfo</link>
+ * +----GIFunctionInfo
+ * +----<link linkend="gi-GISignalInfo">GISignalInfo</link>
+ * +----<link linkend="gi-GIVFuncInfo">GIVFuncInfo</link>
+ * </synopsis>
+ * </refsect1>
+ */
+
+/**
* GICallbackInfo:
*
* Represents a callback, eg arguments and return value.
@@ -103,6 +124,22 @@ typedef GIBaseInfo GIInterfaceInfo;
typedef GIBaseInfo GIConstantInfo;
/**
+ * SECTION:givalueinfo
+ * @title: GIValueInfo
+ * @short_description: Struct representing a value
+ *
+ * GIValueInfo represents a value.
+ *
+ * <refsect1 id="gi-givalueinfo.struct-hierarchy" role="struct_hierarchy">
+ * <title role="struct_hierarchy.title">Struct hierarchy</title>
+ * <synopsis>
+ * <link linkend="gi-GIBaseInfo">GIBaseInfo</link>
+ * +----GIValueInfo
+ * </synopsis>
+ * </refsect1>
+ */
+
+/**
* GIValueInfo:
*
* Represents a enum value of a #GIEnumInfo.
@@ -158,12 +195,7 @@ typedef GIBaseInfo GITypeInfo;
*/
typedef struct _GIUnresolvedInfo GIUnresolvedInfo;
-/**
- * GIArgument:
- *
- * Stores an argument of varying type
- */
-typedef union
+union _GIArgument
{
gboolean v_boolean;
gint8 v_int8;
@@ -186,7 +218,35 @@ typedef union
gsize v_size;
gchar * v_string;
gpointer v_pointer;
-} GIArgument;
+};
+
+/**
+ * GIArgument:
+ * @v_boolean: TODO
+ * @v_int8: TODO
+ * @v_uint8: TODO
+ * @v_int16: TODO
+ * @v_uint16: TODO
+ * @v_int32: TODO
+ * @v_uint32: TODO
+ * @v_int64: TODO
+ * @v_uint64: TODO
+ * @v_float: TODO
+ * @v_double: TODO
+ * @v_short: TODO
+ * @v_ushort: TODO
+ * @v_int: TODO
+ * @v_uint: TODO
+ * @v_long: TODO
+ * @v_ulong: TODO
+ * @v_ssize: TODO
+ * @v_size: TODO
+ * @v_string: TODO
+ * @v_pointer: TODO
+ *
+ * Stores an argument of varying type
+ */
+typedef union _GIArgument GIArgument;
/**
* GIInfoType:
@@ -200,6 +260,7 @@ typedef union
* @GI_INFO_TYPE_OBJECT: object, see #GIObjectInfo
* @GI_INFO_TYPE_INTERFACE: interface, see #GIInterfaceInfo
* @GI_INFO_TYPE_CONSTANT: contant, see #GIConstantInfo
+ * @GI_INFO_TYPE_INVALID_0: deleted, used to be GI_INFO_TYPE_ERROR_DOMAIN.
* @GI_INFO_TYPE_UNION: union, see #GIUnionInfo
* @GI_INFO_TYPE_VALUE: enum value, see #GIValueInfo
* @GI_INFO_TYPE_SIGNAL: signal, see #GISignalInfo
@@ -209,7 +270,7 @@ typedef union
* @GI_INFO_TYPE_ARG: argument of a function or callback, see #GIArgInfo
* @GI_INFO_TYPE_TYPE: type information, see #GITypeInfo
* @GI_INFO_TYPE_UNRESOLVED: unresolved type, a type which is not present in
- * the typelib, or any of its dependencies.
+ * the typelib, or any of its dependencies.
*
* The type of a GIBaseInfo struct.
*/
@@ -225,7 +286,7 @@ typedef enum
GI_INFO_TYPE_OBJECT,
GI_INFO_TYPE_INTERFACE,
GI_INFO_TYPE_CONSTANT,
- GI_INFO_TYPE_INVALID_0, /* 10 */ /** DELETED - used to be ERROR_DOMAIN **/
+ GI_INFO_TYPE_INVALID_0, /* 10 */
GI_INFO_TYPE_UNION,
GI_INFO_TYPE_VALUE,
GI_INFO_TYPE_SIGNAL,
@@ -319,17 +380,17 @@ typedef enum {
* @GI_TYPE_TAG_UINT64: 64-bit unsigned integer
* @GI_TYPE_TAG_FLOAT: float
* @GI_TYPE_TAG_DOUBLE: double floating point
- * @GI_TYPE_TAG_UNICHAR: Unicode character
* @GI_TYPE_TAG_GTYPE: a #GType
* @GI_TYPE_TAG_UTF8: a UTF-8 encoded string
* @GI_TYPE_TAG_FILENAME: a filename, encoded in the same encoding
- * as the native filesystem is using.
+ * as the native filesystem is using.
* @GI_TYPE_TAG_ARRAY: an array
* @GI_TYPE_TAG_INTERFACE: an extended interface object
* @GI_TYPE_TAG_GLIST: a #GList
* @GI_TYPE_TAG_GSLIST: a #GSList
* @GI_TYPE_TAG_GHASH: a #GHashTable
* @GI_TYPE_TAG_ERROR: a #GError
+ * @GI_TYPE_TAG_UNICHAR: Unicode character
*
* The type tag of a #GITypeInfo.
*/
@@ -359,12 +420,17 @@ typedef enum {
GI_TYPE_TAG_ERROR = 20,
/* Another basic type */
GI_TYPE_TAG_UNICHAR = 21
- /* Note - there is only room currently for 32 tags.
- * See docs/typelib-format.txt SimpleTypeBlob definition */
+ /* Note - there is currently only room for 32 tags */
} GITypeTag;
+/**
+ * GI_TYPE_TAG_N_TYPES:
+ *
+ * TODO
+ */
#define GI_TYPE_TAG_N_TYPES (GI_TYPE_TAG_UNICHAR+1)
+#ifndef __GTK_DOC_IGNORE__
/* These were removed and no longer appear in the typelib;
* instead, the machine-specific versions like INT32 are
* always used.
@@ -372,6 +438,7 @@ typedef enum {
#define GI_TYPE_TAG_SHORT GI_TYPE_TAG_SHORT_WAS_REMOVED
#define GI_TYPE_TAG_INT GI_TYPE_TAG_INT_WAS_REMOVED
#define GI_TYPE_TAG_LONG GI_TYPE_TAG_LONG_WAS_REMOVED
+#endif
/**
* GIArrayType:
@@ -442,10 +509,12 @@ typedef enum
} GIFunctionInfoFlags;
#ifndef __GI_SCANNER__
+#ifndef __GTK_DOC_IGNORE__
/* backwards compatibility */
typedef GIArgument GArgument;
typedef struct _GITypelib GTypelib;
#endif
+#endif
G_END_DECLS
diff --git a/girepository/giunioninfo.c b/girepository/giunioninfo.c
index 95b71123..8ae1e915 100644
--- a/girepository/giunioninfo.c
+++ b/girepository/giunioninfo.c
@@ -28,8 +28,8 @@
/**
* SECTION:giunioninfo
- * @Short_description: Struct representing a union.
- * @Title: GIUnionInfo
+ * @title: GIUnionInfo
+ * @short_description: Struct representing a union.
*
* GIUnionInfo represents a union type.
*
@@ -147,7 +147,7 @@ g_union_info_is_discriminated (GIUnionInfo *info)
}
/**
- * g_union_info_get_discrimintor_offset:
+ * g_union_info_get_discriminator_offset:
* @info: a #GIUnionInfo
*
* Returns offset of the discriminator field in the structure.
diff --git a/girepository/giunioninfo.h b/girepository/giunioninfo.h
index 83696f76..5359346a 100644
--- a/girepository/giunioninfo.h
+++ b/girepository/giunioninfo.h
@@ -31,6 +31,12 @@
G_BEGIN_DECLS
+/**
+ * GI_IS_UNION_INFO
+ * @info: an info structure
+ *
+ * Checks if @info is a #GIUnionInfo.
+ */
#define GI_IS_UNION_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_UNION)
diff --git a/girepository/givfuncinfo.c b/girepository/givfuncinfo.c
index 9d6ea39d..8a5b71a1 100644
--- a/girepository/givfuncinfo.c
+++ b/girepository/givfuncinfo.c
@@ -30,8 +30,8 @@
/**
* SECTION:givfuncinfo
- * @Short_description: Struct representing a virtual function
- * @Title: GIVFuncInfo
+ * @title: GIVFuncInfo
+ * @short_description: Struct representing a virtual function
*
* GIVfuncInfo represents a virtual function. A property belongs to
* either a #GIObjectInfo or a #GIInterfaceInfo.
@@ -216,15 +216,28 @@ g_vfunc_info_get_address (GIVFuncInfo *vfunc_info,
GType implementor_gtype,
GError **error)
{
+ GIBaseInfo *container_info;
+ GIInterfaceInfo *interface_info;
GIObjectInfo *object_info;
GIStructInfo *struct_info;
GIFieldInfo *field_info = NULL;
int length, i, offset;
- gpointer implementor_vtable;
+ gpointer implementor_class, implementor_vtable;
gpointer func = NULL;
- object_info = (GIObjectInfo *) g_base_info_get_container (vfunc_info);
- struct_info = g_object_info_get_class_struct (object_info);
+ container_info = g_base_info_get_container (vfunc_info);
+ if (g_base_info_get_type (container_info) == GI_INFO_TYPE_OBJECT)
+ {
+ object_info = (GIObjectInfo*) container_info;
+ interface_info = NULL;
+ struct_info = g_object_info_get_class_struct (object_info);
+ }
+ else
+ {
+ interface_info = (GIInterfaceInfo*) container_info;
+ object_info = NULL;
+ struct_info = g_interface_info_get_iface_struct (interface_info);
+ }
length = g_struct_info_get_n_fields (struct_info);
for (i = 0; i < length; i++)
@@ -250,10 +263,23 @@ g_vfunc_info_get_address (GIVFuncInfo *vfunc_info,
goto out;
}
- implementor_vtable = g_type_class_ref (implementor_gtype);
+ implementor_class = g_type_class_ref (implementor_gtype);
+
+ if (object_info)
+ {
+ implementor_vtable = implementor_class;
+ }
+ else
+ {
+ GType interface_type;
+
+ interface_type = g_registered_type_info_get_g_type ((GIRegisteredTypeInfo*) interface_info);
+ implementor_vtable = g_type_interface_peek (implementor_class, interface_type);
+ }
+
offset = g_field_info_get_offset (field_info);
func = *(gpointer*) G_STRUCT_MEMBER_P (implementor_vtable, offset);
- g_type_class_unref (implementor_vtable);
+ g_type_class_unref (implementor_class);
g_base_info_unref (field_info);
if (func == NULL)
diff --git a/girepository/givfuncinfo.h b/girepository/givfuncinfo.h
index d8a8533b..f22517a6 100644
--- a/girepository/givfuncinfo.h
+++ b/girepository/givfuncinfo.h
@@ -31,6 +31,12 @@
G_BEGIN_DECLS
+/**
+ * GI_IS_VFUNC_INFO
+ * @info: an info structure
+ *
+ * Checks if @info is a #GIVfuncInfo.
+ */
#define GI_IS_VFUNC_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_VFUNC)
diff --git a/girepository/gthash-test.c b/girepository/gthash-test.c
index ea811e35..faeb2dc5 100644
--- a/girepository/gthash-test.c
+++ b/girepository/gthash-test.c
@@ -56,7 +56,6 @@ test_build_retrieve (void)
int
main(int argc, char **argv)
{
- g_type_init ();
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/gthash/build-retrieve", test_build_retrieve);
diff --git a/girepository/gthash.c b/girepository/gthash.c
index b50ea6f0..831c87e9 100644
--- a/girepository/gthash.c
+++ b/girepository/gthash.c
@@ -29,7 +29,7 @@
#define ALIGN_VALUE(this, boundary) \
(( ((unsigned long)(this)) + (((unsigned long)(boundary)) -1)) & (~(((unsigned long)(boundary))-1)))
-/**
+/*
* String hashing in the typelib. We have a set of static (fixed) strings,
* and given one, we need to find its index number. This problem is perfect
* hashing: http://en.wikipedia.org/wiki/Perfect_hashing
@@ -158,6 +158,8 @@ _gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, guint8* mem, guint
g_assert (len >= builder->packed_size);
g_assert ((((unsigned long)mem) & 0x3) == 0);
+ memset (mem, 0, len);
+
*((guint32*) mem) = builder->dirmap_offset;
packed_mem = (guint8*)(mem + sizeof(guint32));
cmph_pack (builder->c, packed_mem);