mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 15:36:17 +01:00
added new command-line option "--internal" that can be used to let
2006-08-23 Sven Neumann <sven@gimp.org> * gobject/glib-genmarshal.[c1]: added new command-line option "--internal" that can be used to let glib-genmarshal generate internal functions using the G_GNUC_INTERNAL attribute (bug #346647).
This commit is contained in:
parent
72c62ec2ac
commit
fa293c86c6
@ -1,3 +1,9 @@
|
|||||||
|
2006-08-23 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* gobject/glib-genmarshal.[c1]: added new command-line option
|
||||||
|
"--internal" that can be used to let glib-genmarshal generate
|
||||||
|
internal functions using the G_GNUC_INTERNAL attribute (bug #346647).
|
||||||
|
|
||||||
2006-08-22 Matthias Clasen <mclasen@redhat.com>
|
2006-08-22 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* Branch for 2.12
|
* Branch for 2.12
|
||||||
|
@ -36,8 +36,11 @@ Specify marshaller prefix. The default prefix is `\fIg_cclosure_marshal\fP'.
|
|||||||
Skip source location remarks in generated comments.
|
Skip source location remarks in generated comments.
|
||||||
.TP
|
.TP
|
||||||
\fI--nostdinc
|
\fI--nostdinc
|
||||||
Do not use the standard marshallers of the GObject library, and skip gmarshal.h include
|
Do not use the standard marshallers of the GObject library, and skip
|
||||||
directive in generated header files.
|
gmarshal.h include directive in generated header files.
|
||||||
|
.TP
|
||||||
|
\fI--internal
|
||||||
|
Mark generated function as internal by using the G_GNUC_INTERNAL macro.
|
||||||
.TP
|
.TP
|
||||||
\fI--g-fatal-warnings
|
\fI--g-fatal-warnings
|
||||||
Make warnings fatal, that is, exit immediately once a warning occurs.
|
Make warnings fatal, that is, exit immediately once a warning occurs.
|
||||||
|
@ -74,8 +74,7 @@ static void print_blurb (FILE *bout,
|
|||||||
|
|
||||||
|
|
||||||
/* --- variables --- */
|
/* --- variables --- */
|
||||||
static FILE *fout = NULL;
|
static const GScannerConfig scanner_config_template =
|
||||||
static GScannerConfig scanner_config_template =
|
|
||||||
{
|
{
|
||||||
(
|
(
|
||||||
" \t\r" /* "\n" is statement delimiter */
|
" \t\r" /* "\n" is statement delimiter */
|
||||||
@ -118,8 +117,10 @@ static GScannerConfig scanner_config_template =
|
|||||||
static gchar * const std_marshaller_prefix = "g_cclosure_marshal";
|
static gchar * const std_marshaller_prefix = "g_cclosure_marshal";
|
||||||
static gchar *marshaller_prefix = "g_cclosure_user_marshal";
|
static gchar *marshaller_prefix = "g_cclosure_user_marshal";
|
||||||
static GHashTable *marshallers = NULL;
|
static GHashTable *marshallers = NULL;
|
||||||
|
static FILE *fout = NULL;
|
||||||
static gboolean gen_cheader = FALSE;
|
static gboolean gen_cheader = FALSE;
|
||||||
static gboolean gen_cbody = FALSE;
|
static gboolean gen_cbody = FALSE;
|
||||||
|
static gboolean gen_internal = FALSE;
|
||||||
static gboolean skip_ploc = FALSE;
|
static gboolean skip_ploc = FALSE;
|
||||||
static gboolean std_includes = TRUE;
|
static gboolean std_includes = TRUE;
|
||||||
|
|
||||||
@ -203,12 +204,11 @@ complete_in_arg (InArgument *iarg)
|
|||||||
{ "NONE", "VOID", "void", NULL, },
|
{ "NONE", "VOID", "void", NULL, },
|
||||||
{ "BOOL", "BOOLEAN", "gboolean", "g_marshal_value_peek_boolean", },
|
{ "BOOL", "BOOLEAN", "gboolean", "g_marshal_value_peek_boolean", },
|
||||||
};
|
};
|
||||||
const guint n_args = sizeof (args) / sizeof (args[0]);
|
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
g_return_val_if_fail (iarg != NULL, FALSE);
|
g_return_val_if_fail (iarg != NULL, FALSE);
|
||||||
|
|
||||||
for (i = 0; i < n_args; i++)
|
for (i = 0; i < G_N_ELEMENTS (args); i++)
|
||||||
if (strcmp (args[i].keyword, iarg->keyword) == 0)
|
if (strcmp (args[i].keyword, iarg->keyword) == 0)
|
||||||
{
|
{
|
||||||
iarg->sig_name = args[i].sig_name;
|
iarg->sig_name = args[i].sig_name;
|
||||||
@ -248,12 +248,11 @@ complete_out_arg (OutArgument *oarg)
|
|||||||
{ "NONE", "VOID", "void", NULL, },
|
{ "NONE", "VOID", "void", NULL, },
|
||||||
{ "BOOL", "BOOLEAN", "gboolean", "g_value_set_boolean", },
|
{ "BOOL", "BOOLEAN", "gboolean", "g_value_set_boolean", },
|
||||||
};
|
};
|
||||||
const guint n_args = sizeof (args) / sizeof (args[0]);
|
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
g_return_val_if_fail (oarg != NULL, FALSE);
|
g_return_val_if_fail (oarg != NULL, FALSE);
|
||||||
|
|
||||||
for (i = 0; i < n_args; i++)
|
for (i = 0; i < G_N_ELEMENTS (args); i++)
|
||||||
if (strcmp (args[i].keyword, oarg->keyword) == 0)
|
if (strcmp (args[i].keyword, oarg->keyword) == 0)
|
||||||
{
|
{
|
||||||
oarg->sig_name = args[i].sig_name;
|
oarg->sig_name = args[i].sig_name;
|
||||||
@ -282,7 +281,8 @@ pad (const gchar *string)
|
|||||||
{
|
{
|
||||||
g_free (buffer);
|
g_free (buffer);
|
||||||
buffer = g_strdup_printf ("%s ", string);
|
buffer = g_strdup_printf ("%s ", string);
|
||||||
g_warning ("overfull string (%u bytes) for padspace", (guint) strlen (string));
|
g_warning ("overfull string (%u bytes) for padspace",
|
||||||
|
(guint) strlen (string));
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
@ -326,8 +326,8 @@ generate_marshal (const gchar *signame,
|
|||||||
gboolean have_std_marshaller = FALSE;
|
gboolean have_std_marshaller = FALSE;
|
||||||
|
|
||||||
/* here we have to make sure a marshaller named <marshaller_prefix>_<signame>
|
/* here we have to make sure a marshaller named <marshaller_prefix>_<signame>
|
||||||
* exists. we might have put it out already, can revert to a standard marshaller
|
* exists. we might have put it out already, can revert to a standard
|
||||||
* provided by glib, or need to generate one.
|
* marshaller provided by glib, or need to generate one.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (g_hash_table_lookup (marshallers, tmp))
|
if (g_hash_table_lookup (marshallers, tmp))
|
||||||
@ -356,18 +356,20 @@ generate_marshal (const gchar *signame,
|
|||||||
}
|
}
|
||||||
if (gen_cheader && !have_std_marshaller)
|
if (gen_cheader && !have_std_marshaller)
|
||||||
{
|
{
|
||||||
ind = g_fprintf (fout, "extern void ");
|
ind = g_fprintf (fout, gen_internal ? "G_GNUC_INTERNAL " : "extern ");
|
||||||
|
ind += g_fprintf (fout, "void ");
|
||||||
ind += g_fprintf (fout, "%s_%s (", marshaller_prefix, signame);
|
ind += g_fprintf (fout, "%s_%s (", marshaller_prefix, signame);
|
||||||
g_fprintf (fout, "GClosure *closure,\n");
|
g_fprintf (fout, "GClosure *closure,\n");
|
||||||
g_fprintf (fout, "%sGValue *return_value,\n", indent (ind));
|
g_fprintf (fout, "%sGValue *return_value,\n", indent (ind));
|
||||||
g_fprintf (fout, "%sguint n_param_values,\n", indent (ind));
|
g_fprintf (fout, "%sguint n_param_values,\n", indent (ind));
|
||||||
g_fprintf (fout, "%sconst GValue *param_values,\n", indent (ind));
|
g_fprintf (fout, "%sconst GValue *param_values,\n", indent (ind));
|
||||||
g_fprintf (fout, "%sgpointer invocation_hint,\n", indent (ind));
|
g_fprintf (fout, "%sgpointer invocation_hint,\n", indent (ind));
|
||||||
g_fprintf (fout, "%sgpointer marshal_data);\n", indent (ind));
|
g_fprintf (fout, "%sgpointer marshal_data);\n",
|
||||||
|
indent (ind));
|
||||||
}
|
}
|
||||||
if (gen_cbody && !have_std_marshaller)
|
if (gen_cbody && !have_std_marshaller)
|
||||||
{
|
{
|
||||||
/* cfile marhsal header */
|
/* cfile marshal header */
|
||||||
g_fprintf (fout, "void\n");
|
g_fprintf (fout, "void\n");
|
||||||
ind = g_fprintf (fout, "%s_%s (", marshaller_prefix, signame);
|
ind = g_fprintf (fout, "%s_%s (", marshaller_prefix, signame);
|
||||||
g_fprintf (fout, "GClosure *closure,\n");
|
g_fprintf (fout, "GClosure *closure,\n");
|
||||||
@ -573,11 +575,11 @@ parse_line (GScanner *scanner,
|
|||||||
return G_TOKEN_IDENTIFIER;
|
return G_TOKEN_IDENTIFIER;
|
||||||
sig->args = g_list_append (sig->args, new_in_arg (scanner->value.v_identifier));
|
sig->args = g_list_append (sig->args, new_in_arg (scanner->value.v_identifier));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* expect end of line, done */
|
/* expect end of line, done */
|
||||||
if (g_scanner_get_next_token (scanner) != '\n')
|
if (g_scanner_get_next_token (scanner) != '\n')
|
||||||
return '\n';
|
return '\n';
|
||||||
|
|
||||||
/* success */
|
/* success */
|
||||||
return G_TOKEN_NONE;
|
return G_TOKEN_NONE;
|
||||||
}
|
}
|
||||||
@ -625,7 +627,7 @@ main (int argc,
|
|||||||
for (i = 0; i < G_N_ELEMENTS (gobject_marshallers); i++)
|
for (i = 0; i < G_N_ELEMENTS (gobject_marshallers); i++)
|
||||||
{
|
{
|
||||||
gchar *tmp = g_strdup (gobject_marshallers[i]);
|
gchar *tmp = g_strdup (gobject_marshallers[i]);
|
||||||
|
|
||||||
g_hash_table_insert (marshallers, tmp, tmp);
|
g_hash_table_insert (marshallers, tmp, tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -666,7 +668,7 @@ main (int argc,
|
|||||||
|
|
||||||
/* parse & process file */
|
/* parse & process file */
|
||||||
g_scanner_input_file (scanner, fd);
|
g_scanner_input_file (scanner, fd);
|
||||||
|
|
||||||
/* scanning loop, we parse the input untill it's end is reached,
|
/* scanning loop, we parse the input untill it's end is reached,
|
||||||
* or our sub routine came across invalid syntax
|
* or our sub routine came across invalid syntax
|
||||||
*/
|
*/
|
||||||
@ -690,11 +692,11 @@ main (int argc,
|
|||||||
GList *node;
|
GList *node;
|
||||||
|
|
||||||
expected_token = parse_line (scanner, &signature);
|
expected_token = parse_line (scanner, &signature);
|
||||||
|
|
||||||
/* once we got a valid signature, process it */
|
/* once we got a valid signature, process it */
|
||||||
if (expected_token == G_TOKEN_NONE)
|
if (expected_token == G_TOKEN_NONE)
|
||||||
process_signature (&signature);
|
process_signature (&signature);
|
||||||
|
|
||||||
/* clean up signature contents */
|
/* clean up signature contents */
|
||||||
g_free (signature.ploc);
|
g_free (signature.ploc);
|
||||||
if (signature.rarg)
|
if (signature.rarg)
|
||||||
@ -703,7 +705,7 @@ main (int argc,
|
|||||||
for (node = signature.args; node; node = node->next)
|
for (node = signature.args; node; node = node->next)
|
||||||
{
|
{
|
||||||
InArgument *iarg = node->data;
|
InArgument *iarg = node->data;
|
||||||
|
|
||||||
g_free (iarg->keyword);
|
g_free (iarg->keyword);
|
||||||
g_free (iarg);
|
g_free (iarg);
|
||||||
}
|
}
|
||||||
@ -753,7 +755,7 @@ parse_args (gint *argc_p,
|
|||||||
guint argc = *argc_p;
|
guint argc = *argc_p;
|
||||||
gchar **argv = *argv_p;
|
gchar **argv = *argv_p;
|
||||||
guint i, e;
|
guint i, e;
|
||||||
|
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
if (strcmp ("--header", argv[i]) == 0)
|
if (strcmp ("--header", argv[i]) == 0)
|
||||||
@ -781,6 +783,11 @@ parse_args (gint *argc_p,
|
|||||||
std_includes = TRUE;
|
std_includes = TRUE;
|
||||||
argv[i] = NULL;
|
argv[i] = NULL;
|
||||||
}
|
}
|
||||||
|
else if (strcmp ("--internal", argv[i]) == 0)
|
||||||
|
{
|
||||||
|
gen_internal = TRUE;
|
||||||
|
argv[i] = NULL;
|
||||||
|
}
|
||||||
else if ((strcmp ("--prefix", argv[i]) == 0) ||
|
else if ((strcmp ("--prefix", argv[i]) == 0) ||
|
||||||
(strncmp ("--prefix=", argv[i], 9) == 0))
|
(strncmp ("--prefix=", argv[i], 9) == 0))
|
||||||
{
|
{
|
||||||
@ -813,15 +820,15 @@ parse_args (gint *argc_p,
|
|||||||
else if (strcmp (argv[i], "--g-fatal-warnings") == 0)
|
else if (strcmp (argv[i], "--g-fatal-warnings") == 0)
|
||||||
{
|
{
|
||||||
GLogLevelFlags fatal_mask;
|
GLogLevelFlags fatal_mask;
|
||||||
|
|
||||||
fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
|
fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
|
||||||
fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
|
fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
|
||||||
g_log_set_always_fatal (fatal_mask);
|
g_log_set_always_fatal (fatal_mask);
|
||||||
|
|
||||||
argv[i] = NULL;
|
argv[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
e = 0;
|
e = 0;
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
@ -863,6 +870,7 @@ print_blurb (FILE *bout,
|
|||||||
g_fprintf (bout, " --prefix=string specify marshaller prefix\n");
|
g_fprintf (bout, " --prefix=string specify marshaller prefix\n");
|
||||||
g_fprintf (bout, " --skip-source skip source location comments\n");
|
g_fprintf (bout, " --skip-source skip source location comments\n");
|
||||||
g_fprintf (bout, " --stdinc, --nostdinc include/use standard marshallers\n");
|
g_fprintf (bout, " --stdinc, --nostdinc include/use standard marshallers\n");
|
||||||
|
g_fprintf (bout, " --internal mark generated functions as internal\n");
|
||||||
g_fprintf (bout, " -h, --help show this help message\n");
|
g_fprintf (bout, " -h, --help show this help message\n");
|
||||||
g_fprintf (bout, " -v, --version print version informations\n");
|
g_fprintf (bout, " -v, --version print version informations\n");
|
||||||
g_fprintf (bout, " --g-fatal-warnings make warnings fatal (abort)\n");
|
g_fprintf (bout, " --g-fatal-warnings make warnings fatal (abort)\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user