extern GHashTable *gtk_doc_hash;
char *filebase;
+char *fullfilebase;
static char *funcbase;
static char *pfuncbase;
static char *macrobase;
static char *typebase;
static char *ptypebase;
+char *output_dir = NULL;
+
static int signals = 0; /* number of signals */
static int set_properties = 0; /* number of named (set) properties */
static int get_properties = 0; /* number of named (get) properties */
filebase = replace_sep (((Class *)class)->otype, '-');
gob_strdown (filebase);
+ if (output_dir != NULL &&
+ output_dir[0] != '\0') {
+ fullfilebase = g_build_filename (output_dir, filebase, NULL);
+ } else {
+ fullfilebase = g_strdup (filebase);
+ }
+
funcbase = replace_sep (((Class *)class)->otype, '_');
gob_strdown (funcbase);
#define value_for_print(str, alt) (str != NULL ? str : alt)
-static char *
-make_me_type (const char *type, const char *alt)
-{
- if (type == NULL)
- return g_strdup (alt);
- /* HACK! just in case someone made this
- * work with 2.0.0 by using the TYPE
- * macro directly */
- if ((strstr (type, "_TYPE_") != NULL ||
- strstr (type, "TYPE_") == type) &&
- strchr (type, ':') == NULL)
- return g_strdup (type);
- return make_pre_macro (type, "TYPE");
-}
-
static void
make_property (Property *p)
{
char *outfile, *outfileh, *outfileph;
if ( ! for_cpp)
- outfile = g_strconcat (filebase, ".c", NULL);
+ outfile = g_strconcat (fullfilebase, ".c", NULL);
else
- outfile = g_strconcat (filebase, ".cc", NULL);
+ outfile = g_strconcat (fullfilebase, ".cc", NULL);
if (no_touch_headers)
- outfileh = g_strconcat ("#gob#", filebase, ".h#gob#", NULL);
+ outfileh = g_strconcat (fullfilebase, ".h#gob#", NULL);
else
- outfileh = g_strconcat (filebase, ".h", NULL);
+ outfileh = g_strconcat (fullfilebase, ".h", NULL);
if ((privates > 0 || protecteds > 0 ||
private_header == PRIVATE_HEADER_ALWAYS) &&
private_header != PRIVATE_HEADER_NEVER)
- outfileph = g_strconcat (filebase, "-private.h", NULL);
+ outfileph = g_strconcat (fullfilebase, "-private.h", NULL);
else
outfileph = NULL;
"really changed\n"
"\t--always-private-header Always create a private header "
"file,\n"
- "\t even if it would be empty "
- "[default]\n"
+ "\t even if it would be empty\n"
"\t--ondemand-private-header Create private header only when "
"needed\n"
+ "\t [default]\n"
"\t--no-private-header Don't create a private header, "
"put private\n"
"\t structure and protected "
"\t--no-lines Don't print '#line' to output\n"
"\t--no-self-alias Don't create self type and macro "
"aliases\n"
- "\t--no-kill-underscores Ignored for compatibility\n");
+ "\t--no-kill-underscores Ignored for compatibility\n"
+ "\t-o,--output-dir The directory where output "
+ "should be placed\n");
}
static void
use_m4_clean=TRUE;
m4_opts = TRUE;
m4_commandline=g_strdup(M4_COMMANDLINE);
+ } else if (strcmp (argv[i], "-o") == 0 ||
+ strcmp (argv[i], "--output-dir") == 0) {
+ if (i+1 < argc) {
+ output_dir = g_strdup (argv[i+1]);
+ i++;
+ } else {
+ output_dir = NULL;
+ }
+ } else if (strncmp (argv[i], "-o=", strlen ("-o=")) == 0 ||
+ strncmp (argv[i],
+ "--output-dir=",
+ strlen ("--output-dir=")) == 0) {
+ char *p = strchr (argv[i], '=');
+ g_assert (p != NULL);
+ output_dir = g_strdup (p+1);
} else if(strcmp(argv[i], "--")==0) {
/*further arguments are files*/
no_opts = TRUE;
static void
compare_and_move_header(void)
{
- char *hfnew = g_strconcat("#gob#", filebase, ".h#gob#", NULL);
- char *hf = g_strconcat(filebase, ".h", NULL);
+ char *hfnew = g_strconcat(fullfilebase, ".h#gob#", NULL);
+ char *hf = g_strconcat(fullfilebase, ".h", NULL);
struct stat s;
if(stat(hf, &s) == 0) {
char *s;