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:
Sven Neumann 2006-08-23 06:45:55 +00:00 committed by Sven Neumann
parent 72c62ec2ac
commit fa293c86c6
3 changed files with 42 additions and 25 deletions

View File

@ -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>
* Branch for 2.12

View File

@ -36,8 +36,11 @@ Specify marshaller prefix. The default prefix is `\fIg_cclosure_marshal\fP'.
Skip source location remarks in generated comments.
.TP
\fI--nostdinc
Do not use the standard marshallers of the GObject library, and skip gmarshal.h include
directive in generated header files.
Do not use the standard marshallers of the GObject library, and skip
gmarshal.h include directive in generated header files.
.TP
\fI--internal
Mark generated function as internal by using the G_GNUC_INTERNAL macro.
.TP
\fI--g-fatal-warnings
Make warnings fatal, that is, exit immediately once a warning occurs.

View File

@ -74,8 +74,7 @@ static void print_blurb (FILE *bout,
/* --- variables --- */
static FILE *fout = NULL;
static GScannerConfig scanner_config_template =
static const GScannerConfig scanner_config_template =
{
(
" \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 *marshaller_prefix = "g_cclosure_user_marshal";
static GHashTable *marshallers = NULL;
static FILE *fout = NULL;
static gboolean gen_cheader = FALSE;
static gboolean gen_cbody = FALSE;
static gboolean gen_internal = FALSE;
static gboolean skip_ploc = FALSE;
static gboolean std_includes = TRUE;
@ -203,12 +204,11 @@ complete_in_arg (InArgument *iarg)
{ "NONE", "VOID", "void", NULL, },
{ "BOOL", "BOOLEAN", "gboolean", "g_marshal_value_peek_boolean", },
};
const guint n_args = sizeof (args) / sizeof (args[0]);
guint i;
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)
{
iarg->sig_name = args[i].sig_name;
@ -248,12 +248,11 @@ complete_out_arg (OutArgument *oarg)
{ "NONE", "VOID", "void", NULL, },
{ "BOOL", "BOOLEAN", "gboolean", "g_value_set_boolean", },
};
const guint n_args = sizeof (args) / sizeof (args[0]);
guint i;
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)
{
oarg->sig_name = args[i].sig_name;
@ -282,7 +281,8 @@ pad (const gchar *string)
{
g_free (buffer);
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;
}
@ -326,8 +326,8 @@ generate_marshal (const gchar *signame,
gboolean have_std_marshaller = FALSE;
/* 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
* provided by glib, or need to generate one.
* exists. we might have put it out already, can revert to a standard
* marshaller provided by glib, or need to generate one.
*/
if (g_hash_table_lookup (marshallers, tmp))
@ -356,18 +356,20 @@ generate_marshal (const gchar *signame,
}
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);
g_fprintf (fout, "GClosure *closure,\n");
g_fprintf (fout, "%sGValue *return_value,\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, "%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)
{
/* cfile marhsal header */
/* cfile marshal header */
g_fprintf (fout, "void\n");
ind = g_fprintf (fout, "%s_%s (", marshaller_prefix, signame);
g_fprintf (fout, "GClosure *closure,\n");
@ -781,6 +783,11 @@ parse_args (gint *argc_p,
std_includes = TRUE;
argv[i] = NULL;
}
else if (strcmp ("--internal", argv[i]) == 0)
{
gen_internal = TRUE;
argv[i] = NULL;
}
else if ((strcmp ("--prefix", argv[i]) == 0) ||
(strncmp ("--prefix=", argv[i], 9) == 0))
{
@ -863,6 +870,7 @@ print_blurb (FILE *bout,
g_fprintf (bout, " --prefix=string specify marshaller prefix\n");
g_fprintf (bout, " --skip-source skip source location comments\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, " -v, --version print version informations\n");
g_fprintf (bout, " --g-fatal-warnings make warnings fatal (abort)\n");