girepository: Consistently prefix internal functions with _

This should better avoid them being exported.  Rename
girepository-parser.la to girepository-internals.la for clarity.
This commit is contained in:
Colin Walters 2010-11-16 15:08:33 -05:00
parent 61e5bdb7ba
commit ff33cc0791
7 changed files with 299 additions and 299 deletions

View File

@ -30,10 +30,10 @@
GIrModule *
g_ir_module_new (const gchar *name,
const gchar *version,
const gchar *shared_library,
const gchar *c_prefix)
_g_ir_module_new (const gchar *name,
const gchar *version,
const gchar *shared_library,
const gchar *c_prefix)
{
GIrModule *module;
@ -56,14 +56,14 @@ g_ir_module_new (const gchar *name,
}
void
g_ir_module_free (GIrModule *module)
_g_ir_module_free (GIrModule *module)
{
GList *e;
g_free (module->name);
for (e = module->entries; e; e = e->next)
g_ir_node_free ((GIrNode *)e->data);
_g_ir_node_free ((GIrNode *)e->data);
g_list_free (module->entries);
/* Don't free dependencies, we inherit that from the parser */
@ -77,7 +77,7 @@ g_ir_module_free (GIrModule *module)
}
/**
* g_ir_module_fatal:
* _g_ir_module_fatal:
* @build: Current build
* @line: Origin line number, or 0 if unknown
* @msg: printf-format string
@ -86,10 +86,10 @@ g_ir_module_free (GIrModule *module)
* Report a fatal error, then exit.
*/
void
g_ir_module_fatal (GIrTypelibBuild *build,
guint line,
const char *msg,
...)
_g_ir_module_fatal (GIrTypelibBuild *build,
guint line,
const char *msg,
...)
{
GString *context;
char *formatted;
@ -149,8 +149,8 @@ add_disguised_structure_foreach (gpointer key,
}
void
g_ir_module_add_include_module (GIrModule *module,
GIrModule *include_module)
_g_ir_module_add_include_module (GIrModule *module,
GIrModule *include_module)
{
module->include_modules = g_list_prepend (module->include_modules,
include_module);
@ -184,8 +184,8 @@ write_attribute (gpointer key, gpointer value, gpointer datap)
*(data->offset) += sizeof (AttributeBlob);
blob->offset = data->node->offset;
blob->name = write_string ((const char*) key, data->strings, data->databuf, data->offset2);
blob->value = write_string ((const char*) value, data->strings, data->databuf, data->offset2);
blob->name = _g_ir_write_string ((const char*) key, data->strings, data->databuf, data->offset2);
blob->value = _g_ir_write_string ((const char*) value, data->strings, data->databuf, data->offset2);
data->count++;
}
@ -222,7 +222,7 @@ node_cmp_offset_func (gconstpointer a,
GITypelib *
g_ir_module_build_typelib (GIrModule *module)
_g_ir_module_build_typelib (GIrModule *module)
{
GError *error = NULL;
GITypelib *typelib;
@ -286,7 +286,7 @@ g_ir_module_build_typelib (GIrModule *module)
{
GIrNode *node = e->data;
size += g_ir_node_get_full_size (node);
size += _g_ir_node_get_full_size (node);
/* Also reset the offset here */
node->offset = 0;
@ -320,17 +320,17 @@ g_ir_module_build_typelib (GIrModule *module)
* the size calculations above.
*/
if (dependencies != NULL)
header->dependencies = write_string (dependencies, strings, data, &header_size);
header->dependencies = _g_ir_write_string (dependencies, strings, data, &header_size);
else
header->dependencies = 0;
header->size = 0; /* filled in later */
header->namespace = write_string (module->name, strings, data, &header_size);
header->nsversion = write_string (module->version, strings, data, &header_size);
header->namespace = _g_ir_write_string (module->name, strings, data, &header_size);
header->nsversion = _g_ir_write_string (module->version, strings, data, &header_size);
header->shared_library = (module->shared_library?
write_string (module->shared_library, strings, data, &header_size)
_g_ir_write_string (module->shared_library, strings, data, &header_size)
: 0);
if (module->c_prefix != NULL)
header->c_prefix = write_string (module->c_prefix, strings, data, &header_size);
header->c_prefix = _g_ir_write_string (module->c_prefix, strings, data, &header_size);
else
header->c_prefix = 0;
header->directory = ALIGN_VALUE (header_size, 4);
@ -398,18 +398,18 @@ g_ir_module_build_typelib (GIrModule *module)
entry->blob_type = 0;
entry->local = FALSE;
entry->offset = write_string (namespace, strings, data, &offset2);
entry->name = write_string (node->name, strings, data, &offset2);
entry->offset = _g_ir_write_string (namespace, strings, data, &offset2);
entry->name = _g_ir_write_string (node->name, strings, data, &offset2);
}
else
{
old_offset = offset;
offset2 = offset + g_ir_node_get_size (node);
offset2 = offset + _g_ir_node_get_size (node);
entry->blob_type = node->type;
entry->local = TRUE;
entry->offset = offset;
entry->name = write_string (node->name, strings, data, &offset2);
entry->name = _g_ir_write_string (node->name, strings, data, &offset2);
memset (&build, 0, sizeof (build));
build.module = module;
@ -418,13 +418,13 @@ g_ir_module_build_typelib (GIrModule *module)
build.nodes_with_attributes = nodes_with_attributes;
build.n_attributes = header->n_attributes;
build.data = data;
g_ir_node_build_typelib (node, NULL, &build, &offset, &offset2);
_g_ir_node_build_typelib (node, NULL, &build, &offset, &offset2);
nodes_with_attributes = build.nodes_with_attributes;
header->n_attributes = build.n_attributes;
if (offset2 > old_offset + g_ir_node_get_full_size (node))
g_error ("left a hole of %d bytes\n", offset2 - old_offset - g_ir_node_get_full_size (node));
if (offset2 > old_offset + _g_ir_node_get_full_size (node))
g_error ("left a hole of %d bytes\n", offset2 - old_offset - _g_ir_node_get_full_size (node));
}
entry++;

View File

@ -59,18 +59,18 @@ struct _GIrModule
GHashTable *disguised_structures;
};
GIrModule *g_ir_module_new (const gchar *name,
const gchar *nsversion,
const gchar *module_filename,
const gchar *c_prefix);
void g_ir_module_free (GIrModule *module);
GIrModule *_g_ir_module_new (const gchar *name,
const gchar *nsversion,
const gchar *module_filename,
const gchar *c_prefix);
void _g_ir_module_free (GIrModule *module);
void g_ir_module_add_include_module (GIrModule *module,
void _g_ir_module_add_include_module (GIrModule *module,
GIrModule *include_module);
GITypelib * g_ir_module_build_typelib (GIrModule *module);
GITypelib * _g_ir_module_build_typelib (GIrModule *module);
void g_ir_module_fatal (GIrTypelibBuild *build, guint line, const char *msg, ...) G_GNUC_PRINTF (3, 4) G_GNUC_NORETURN;
void _g_ir_module_fatal (GIrTypelibBuild *build, guint line, const char *msg, ...) G_GNUC_PRINTF (3, 4) G_GNUC_NORETURN;
void _g_irnode_init_stats (void);
void _g_irnode_dump_stats (void);

346
girnode.c

File diff suppressed because it is too large Load Diff

View File

@ -354,36 +354,36 @@ struct _GIrNodeErrorDomain
};
GIrNode * g_ir_node_new (GIrNodeTypeId type,
GIrNode * _g_ir_node_new (GIrNodeTypeId type,
GIrModule *module);
void g_ir_node_free (GIrNode *node);
guint32 g_ir_node_get_size (GIrNode *node);
guint32 g_ir_node_get_full_size (GIrNode *node);
void g_ir_node_build_typelib (GIrNode *node,
GIrNode *parent,
GIrTypelibBuild *build,
guint32 *offset,
guint32 *offset2);
int g_ir_node_cmp (GIrNode *node,
void _g_ir_node_free (GIrNode *node);
guint32 _g_ir_node_get_size (GIrNode *node);
guint32 _g_ir_node_get_full_size (GIrNode *node);
void _g_ir_node_build_typelib (GIrNode *node,
GIrNode *parent,
GIrTypelibBuild *build,
guint32 *offset,
guint32 *offset2);
int _g_ir_node_cmp (GIrNode *node,
GIrNode *other);
gboolean g_ir_node_can_have_member (GIrNode *node);
void g_ir_node_add_member (GIrNode *node,
GIrNodeFunction *member);
guint32 write_string (const gchar *str,
GHashTable *strings,
guchar *data,
guint32 *offset);
gboolean _g_ir_node_can_have_member (GIrNode *node);
void _g_ir_node_add_member (GIrNode *node,
GIrNodeFunction *member);
guint32 _g_ir_write_string (const gchar *str,
GHashTable *strings,
guchar *data,
guint32 *offset);
const gchar * g_ir_node_param_direction_string (GIrNodeParam * node);
const gchar * g_ir_node_type_to_string (GIrNodeTypeId type);
const gchar * _g_ir_node_param_direction_string (GIrNodeParam * node);
const gchar * _g_ir_node_type_to_string (GIrNodeTypeId type);
GIrNode *g_ir_find_node (GIrTypelibBuild *build,
GIrNode *_g_ir_find_node (GIrTypelibBuild *build,
GIrModule *module,
const char *name);
/* In giroffsets.c */
void g_ir_node_compute_offsets (GIrTypelibBuild *build,
void _g_ir_node_compute_offsets (GIrTypelibBuild *build,
GIrNode *node);

View File

@ -189,16 +189,16 @@ 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->interface);
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->interface, who);
*size = -1;
*alignment = -1;
return FALSE;
}
g_ir_node_compute_offsets (build, iface);
_g_ir_node_compute_offsets (build, iface);
switch (iface->type)
{
@ -247,7 +247,7 @@ get_interface_size_alignment (GIrTypelibBuild *build,
{
g_warning ("%s has is not a pointer and is of type %s",
who,
g_ir_node_type_to_string (iface->type));
_g_ir_node_type_to_string (iface->type));
*size = -1;
*alignment = -1;
break;
@ -497,7 +497,7 @@ check_needs_computation (GIrTypelibBuild *build,
}
/**
* g_ir_node_compute_offsets:
* _g_ir_node_compute_offsets:
* @build: Current typelib build
* @node: a #GIrNode
*
@ -506,8 +506,8 @@ check_needs_computation (GIrTypelibBuild *build,
* alignment for the type.
*/
void
g_ir_node_compute_offsets (GIrTypelibBuild *build,
GIrNode *node)
_g_ir_node_compute_offsets (GIrTypelibBuild *build,
GIrNode *node)
{
gboolean appended_stack;

View File

@ -161,7 +161,7 @@ static const gchar *find_attribute (const gchar *name,
GIrParser *
g_ir_parser_new (void)
_g_ir_parser_new (void)
{
GIrParser *parser = g_slice_new0 (GIrParser);
@ -169,7 +169,7 @@ g_ir_parser_new (void)
}
void
g_ir_parser_free (GIrParser *parser)
_g_ir_parser_free (GIrParser *parser)
{
GList *l;
@ -177,14 +177,14 @@ g_ir_parser_free (GIrParser *parser)
g_strfreev (parser->includes);
for (l = parser->parsed_modules; l; l = l->next)
g_ir_module_free (l->data);
_g_ir_module_free (l->data);
g_slice_free (GIrParser, parser);
}
void
g_ir_parser_set_includes (GIrParser *parser,
const gchar *const *includes)
_g_ir_parser_set_includes (GIrParser *parser,
const gchar *const *includes)
{
if (parser->includes)
g_strfreev (parser->includes);
@ -457,7 +457,7 @@ parse_type_internal (GIrModule *module,
GIrNodeType *type;
char *temporary_type = NULL;
type = (GIrNodeType *)g_ir_node_new (G_IR_NODE_TYPE, module);
type = (GIrNodeType *)_g_ir_node_new (G_IR_NODE_TYPE, module);
type->unparsed = g_strdup (str);
@ -585,7 +585,7 @@ parse_type_internal (GIrModule *module,
return type;
/* error: */
g_ir_node_free ((GIrNode *)type);
_g_ir_node_free ((GIrNode *)type);
g_free (temporary_type);
return NULL;
}
@ -748,7 +748,7 @@ start_glib_boxed (GMarkupParseContext *context,
return FALSE;
}
boxed = (GIrNodeBoxed *) g_ir_node_new (G_IR_NODE_BOXED,
boxed = (GIrNodeBoxed *) _g_ir_node_new (G_IR_NODE_BOXED,
ctx->current_module);
((GIrNode *)boxed)->name = g_strdup (name);
@ -838,7 +838,7 @@ start_function (GMarkupParseContext *context,
if (shadows)
name = shadows;
function = (GIrNodeFunction *) g_ir_node_new (G_IR_NODE_FUNCTION,
function = (GIrNodeFunction *) _g_ir_node_new (G_IR_NODE_FUNCTION,
ctx->current_module);
((GIrNode *)function)->name = g_strdup (name);
@ -1045,8 +1045,8 @@ start_parameter (GMarkupParseContext *context,
if (name == NULL)
name = "unknown";
param = (GIrNodeParam *)g_ir_node_new (G_IR_NODE_PARAM,
ctx->current_module);
param = (GIrNodeParam *)_g_ir_node_new (G_IR_NODE_PARAM,
ctx->current_module);
ctx->current_typed = (GIrNode*) param;
ctx->current_typed->name = g_strdup (name);
@ -1201,8 +1201,8 @@ start_field (GMarkupParseContext *context,
return FALSE;
}
field = (GIrNodeField *)g_ir_node_new (G_IR_NODE_FIELD,
ctx->current_module);
field = (GIrNodeField *)_g_ir_node_new (G_IR_NODE_FIELD,
ctx->current_module);
if (introspectable)
{
ctx->current_typed = (GIrNode*) field;
@ -1268,7 +1268,7 @@ start_field (GMarkupParseContext *context,
{
GIrNodeConstant *constant;
constant = (GIrNodeConstant *) g_ir_node_new (G_IR_NODE_CONSTANT,
constant = (GIrNodeConstant *) _g_ir_node_new (G_IR_NODE_CONSTANT,
ctx->current_module);
((GIrNode *)constant)->name = g_strdup (name);
constant->value = g_strdup (branch);
@ -1342,10 +1342,10 @@ start_enum (GMarkupParseContext *context,
}
if (strcmp (element_name, "enumeration") == 0)
enum_ = (GIrNodeEnum *) g_ir_node_new (G_IR_NODE_ENUM,
enum_ = (GIrNodeEnum *) _g_ir_node_new (G_IR_NODE_ENUM,
ctx->current_module);
else
enum_ = (GIrNodeEnum *) g_ir_node_new (G_IR_NODE_FLAGS,
enum_ = (GIrNodeEnum *) _g_ir_node_new (G_IR_NODE_FLAGS,
ctx->current_module);
((GIrNode *)enum_)->name = g_strdup (name);
enum_->gtype_name = g_strdup (typename);
@ -1409,7 +1409,7 @@ start_property (GMarkupParseContext *context,
return FALSE;
}
property = (GIrNodeProperty *) g_ir_node_new (G_IR_NODE_PROPERTY,
property = (GIrNodeProperty *) _g_ir_node_new (G_IR_NODE_PROPERTY,
ctx->current_module);
ctx->current_typed = (GIrNode*) property;
@ -1492,7 +1492,7 @@ start_member (GMarkupParseContext *context,
return FALSE;
}
value_ = (GIrNodeValue *) g_ir_node_new (G_IR_NODE_VALUE,
value_ = (GIrNodeValue *) _g_ir_node_new (G_IR_NODE_VALUE,
ctx->current_module);
((GIrNode *)value_)->name = g_strdup (name);
@ -1566,7 +1566,7 @@ start_constant (GMarkupParseContext *context,
return FALSE;
}
constant = (GIrNodeConstant *) g_ir_node_new (G_IR_NODE_CONSTANT,
constant = (GIrNodeConstant *) _g_ir_node_new (G_IR_NODE_CONSTANT,
ctx->current_module);
((GIrNode *)constant)->name = g_strdup (name);
@ -1639,7 +1639,7 @@ start_errordomain (GMarkupParseContext *context,
return FALSE;
}
domain = (GIrNodeErrorDomain *) g_ir_node_new (G_IR_NODE_ERROR_DOMAIN,
domain = (GIrNodeErrorDomain *) _g_ir_node_new (G_IR_NODE_ERROR_DOMAIN,
ctx->current_module);
((GIrNode *)domain)->name = g_strdup (name);
@ -1702,7 +1702,7 @@ start_interface (GMarkupParseContext *context,
return FALSE;
}
iface = (GIrNodeInterface *) g_ir_node_new (G_IR_NODE_INTERFACE,
iface = (GIrNodeInterface *) _g_ir_node_new (G_IR_NODE_INTERFACE,
ctx->current_module);
((GIrNode *)iface)->name = g_strdup (name);
iface->gtype_name = g_strdup (typename);
@ -1778,7 +1778,7 @@ start_class (GMarkupParseContext *context,
return FALSE;
}
iface = (GIrNodeInterface *) g_ir_node_new (G_IR_NODE_OBJECT,
iface = (GIrNodeInterface *) _g_ir_node_new (G_IR_NODE_OBJECT,
ctx->current_module);
((GIrNode *)iface)->name = g_strdup (name);
iface->gtype_name = g_strdup (typename);
@ -1915,8 +1915,8 @@ start_type (GMarkupParseContext *context,
const char *len;
const char *size;
typenode = (GIrNodeType *)g_ir_node_new (G_IR_NODE_TYPE,
ctx->current_module);
typenode = (GIrNodeType *)_g_ir_node_new (G_IR_NODE_TYPE,
ctx->current_module);
typenode->tag = GI_TYPE_TAG_ARRAY;
typenode->is_pointer = TRUE;
@ -2194,8 +2194,8 @@ start_return_value (GMarkupParseContext *context,
ctx->state == STATE_FUNCTION))
return FALSE;
param = (GIrNodeParam *)g_ir_node_new (G_IR_NODE_PARAM,
ctx->current_module);
param = (GIrNodeParam *)_g_ir_node_new (G_IR_NODE_PARAM,
ctx->current_module);
param->in = FALSE;
param->out = FALSE;
param->retval = TRUE;
@ -2305,8 +2305,8 @@ start_glib_signal (GMarkupParseContext *context,
MISSING_ATTRIBUTE (context, error, element_name, "name");
return FALSE;
}
signal = (GIrNodeSignal *)g_ir_node_new (G_IR_NODE_SIGNAL,
ctx->current_module);
signal = (GIrNodeSignal *)_g_ir_node_new (G_IR_NODE_SIGNAL,
ctx->current_module);
((GIrNode *)signal)->name = g_strdup (name);
@ -2387,8 +2387,8 @@ start_vfunc (GMarkupParseContext *context,
return FALSE;
}
vfunc = (GIrNodeVFunc *)g_ir_node_new (G_IR_NODE_VFUNC,
ctx->current_module);
vfunc = (GIrNodeVFunc *)_g_ir_node_new (G_IR_NODE_VFUNC,
ctx->current_module);
((GIrNode *)vfunc)->name = g_strdup (name);
@ -2484,7 +2484,7 @@ start_struct (GMarkupParseContext *context,
return FALSE;
}
struct_ = (GIrNodeStruct *) g_ir_node_new (G_IR_NODE_STRUCT,
struct_ = (GIrNodeStruct *) _g_ir_node_new (G_IR_NODE_STRUCT,
ctx->current_module);
((GIrNode *)struct_)->name = g_strdup (name ? name : "");
@ -2545,7 +2545,7 @@ start_union (GMarkupParseContext *context,
return FALSE;
}
union_ = (GIrNodeUnion *) g_ir_node_new (G_IR_NODE_UNION,
union_ = (GIrNodeUnion *) _g_ir_node_new (G_IR_NODE_UNION,
ctx->current_module);
((GIrNode *)union_)->name = g_strdup (name ? name : "");
@ -2654,7 +2654,7 @@ parse_include (GMarkupParseContext *context,
return FALSE;
}
module = g_ir_parser_parse_string (ctx->parser, name, girpath, buffer, length, &error);
module = _g_ir_parser_parse_string (ctx->parser, name, girpath, buffer, length, &error);
g_free (buffer);
if (error != NULL)
{
@ -2890,7 +2890,7 @@ start_element_handler (GMarkupParseContext *context,
"<namespace/> name element '%s' doesn't match file name '%s'",
name, ctx->namespace);
ctx->current_module = g_ir_module_new (name, version, shared_library, cprefix);
ctx->current_module = _g_ir_module_new (name, version, shared_library, cprefix);
ctx->current_module->aliases = ctx->aliases;
ctx->aliases = NULL;
@ -2898,7 +2898,7 @@ start_element_handler (GMarkupParseContext *context,
ctx->disguised_structures = NULL;
for (l = ctx->include_modules; l; l = l->next)
g_ir_module_add_include_module (ctx->current_module, l->data);
_g_ir_module_add_include_module (ctx->current_module, l->data);
g_list_free (ctx->include_modules);
ctx->include_modules = NULL;
@ -3445,7 +3445,7 @@ cleanup (GMarkupParseContext *context,
GList *m;
for (m = ctx->modules; m; m = m->next)
g_ir_module_free (m->data);
_g_ir_module_free (m->data);
g_list_free (ctx->modules);
ctx->modules = NULL;
@ -3453,7 +3453,7 @@ cleanup (GMarkupParseContext *context,
}
/**
* g_ir_parser_parse_string:
* _g_ir_parser_parse_string:
* @parser: a #GIrParser
* @namespace: the namespace of the string
* @filename: (allow-none): Path to parsed file, or %NULL
@ -3467,12 +3467,12 @@ cleanup (GMarkupParseContext *context,
* Returns: (transfer none): a new #GirModule
*/
GIrModule *
g_ir_parser_parse_string (GIrParser *parser,
const gchar *namespace,
const gchar *filename,
const gchar *buffer,
gssize length,
GError **error)
_g_ir_parser_parse_string (GIrParser *parser,
const gchar *namespace,
const gchar *filename,
const gchar *buffer,
gssize length,
GError **error)
{
ParseContext ctx = { 0 };
GMarkupParseContext *context;
@ -3531,7 +3531,7 @@ g_ir_parser_parse_string (GIrParser *parser,
}
/**
* g_ir_parser_parse_file:
* _g_ir_parser_parse_file:
* @parser: a #GIrParser
* @filename: filename to parse
* @error: return location for a #GError, or %NULL
@ -3543,9 +3543,9 @@ g_ir_parser_parse_string (GIrParser *parser,
* are owned by the #GIrParser and will be freed along with the parser.
*/
GIrModule *
g_ir_parser_parse_file (GIrParser *parser,
const gchar *filename,
GError **error)
_g_ir_parser_parse_file (GIrParser *parser,
const gchar *filename,
GError **error)
{
gchar *buffer;
gsize length;
@ -3580,7 +3580,7 @@ g_ir_parser_parse_file (GIrParser *parser,
if (!g_file_get_contents (filename, &buffer, &length, error))
return NULL;
module = g_ir_parser_parse_string (parser, namespace, filename, buffer, length, error);
module = _g_ir_parser_parse_string (parser, namespace, filename, buffer, length, error);
g_free (namespace);

View File

@ -29,20 +29,20 @@ G_BEGIN_DECLS
typedef struct _GIrParser GIrParser;
GIrParser *g_ir_parser_new (void);
void g_ir_parser_free (GIrParser *parser);
void g_ir_parser_set_includes (GIrParser *parser,
const gchar *const *includes);
GIrParser *_g_ir_parser_new (void);
void _g_ir_parser_free (GIrParser *parser);
void _g_ir_parser_set_includes (GIrParser *parser,
const gchar *const *includes);
GIrModule *g_ir_parser_parse_string (GIrParser *parser,
const gchar *namespace,
const gchar *filename,
const gchar *buffer,
gssize length,
GError **error);
GIrModule *g_ir_parser_parse_file (GIrParser *parser,
const gchar *filename,
GError **error);
GIrModule *_g_ir_parser_parse_string (GIrParser *parser,
const gchar *namespace,
const gchar *filename,
const gchar *buffer,
gssize length,
GError **error);
GIrModule *_g_ir_parser_parse_file (GIrParser *parser,
const gchar *filename,
GError **error);
G_END_DECLS