add parameter options

This commit is contained in:
Asbjørn Pettersen 1999-10-01 15:16:15 +00:00
parent 8c76fd7052
commit cdf43f81f5
2 changed files with 56 additions and 56 deletions

View File

@ -1,3 +1,7 @@
Fri Oct 1 17:14:51 1999 ape@gandalf.spacetec.no (Asbjorn Pettersen)
* app/unittest/parse_gimprc.c: Add parameters options.
1999-09-30 Zach Beane <xach@mint.net> 1999-09-30 Zach Beane <xach@mint.net>
* plug-ins/script-fu/scripts/coolmetal-logo.scm: Reverted the * plug-ins/script-fu/scripts/coolmetal-logo.scm: Reverted the

View File

@ -20,7 +20,6 @@
#include "globals.c" #include "globals.c"
#include "../gimprc.c" #include "../gimprc.c"
static void static void
parse_show_tokens (GList *list) parse_show_tokens (GList *list)
{ {
@ -34,7 +33,6 @@ parse_show_tokens (GList *list)
} }
} }
static void global_parse_init(int showit) static void global_parse_init(int showit)
{ {
GList *list; GList *list;
@ -82,46 +80,28 @@ static void parse_get_alt_personal_gimprc(char *alternate, char *filename)
parse_get_absolute_gimprc_file(filename); parse_get_absolute_gimprc_file(filename);
} }
#if 0 static gboolean p_asb_show_result(char *filename)
gboolean
parse_absolute_gimprc_file (char *filename)
{ {
int status; gboolean status;
parse_info.fp = fopen (filename, "rt"); status = parse_absolute_gimprc_file (filename);
if (!parse_info.fp) printf("----- Parse Result:%d,filename=%s\n", status,filename);
return FALSE; if (status)
parse_show_tokens (unknown_tokens);
if ((be_verbose == TRUE) || (no_splash == TRUE)) return (status);
g_print (_("parsing \"%s\"\n"), filename); }
cur_token = -1; static void p_show_default_files ()
next_token = -1; {
char libfilename[MAXPATHLEN];
parse_info.position = -1; char filename[MAXPATHLEN];
parse_info.linenum = 1;
parse_info.charnum = 1; parse_get_system_file (alternate_system_gimprc, libfilename);
parse_info.inc_linenum = FALSE; parse_get_alt_personal_gimprc (alternate_gimprc, filename);
parse_info.inc_charnum = FALSE; printf("\n----- Parse files: \n");
printf("libfilename= %s\n", libfilename);
done = FALSE; printf("filename= %s\n\n", filename);
while ((status = parse_statement ()) == OK)
;
fclose (parse_info.fp);
if (status == ERROR)
{
g_print (_("error parsing: \"%s\"\n"), filename);
g_print (_(" at line %d column %d\n"), parse_info.linenum, parse_info.charnum);
g_print (_(" unexpected token: %s\n"), token_sym);
return FALSE;
}
return TRUE;
} }
#endif
int int
main (int argc, char **argv) main (int argc, char **argv)
@ -131,30 +111,46 @@ main (int argc, char **argv)
gboolean status; gboolean status;
int showit = 1; int showit = 1;
if (argc > 1) if (argc < 2)
{
printf("%s [option] \n\n",argv[0]);
printf("ex: %s -a # call alternative gimprc parsing\n",argv[0]);
printf("ex: %s -p # call parse_gimprc ()\n",argv[0]);
printf("ex: %s -h # show default files\n",argv[0]);
parse_get_system_file (alternate_system_gimprc, libfilename);
printf("ex: %s -f%s # parse a files\n",argv[0], libfilename);
exit (1);
}
if (strcmp (argv[1], "-h") == 0)
{
p_show_default_files ();
exit (0);
}
if (strcmp (argv[1], "-p") == 0)
showit = 0; showit = 0;
global_parse_init(showit); global_parse_init(showit);
if (argc == 1) if (strcmp (argv[1], "-a") == 0)
{ {
p_show_default_files ();
parse_get_system_file (alternate_system_gimprc, libfilename); parse_get_system_file (alternate_system_gimprc, libfilename);
parse_get_alt_personal_gimprc(alternate_gimprc, filename); parse_get_alt_personal_gimprc(alternate_gimprc, filename);
printf("\n----- Parse files: \n");
printf("libfilename= %s\n", libfilename); status = p_asb_show_result(libfilename);
printf("filename= %s\n\n", filename); status = p_asb_show_result(filename);
status = parse_absolute_gimprc_file (libfilename);
printf("----- Parse Result:%d,filename=%s\n", status,libfilename);
if (status)
parse_show_tokens (unknown_tokens);
status = parse_absolute_gimprc_file (filename);
printf("----- Parse Result:%d,filename=%s\n", status,filename);
if (status)
parse_show_tokens (unknown_tokens);
} }
else else if (strncmp (argv[1], "-f",2) == 0)
{
strcpy (filename, argv[1] + 2);
status = p_asb_show_result(filename);
}
else if (strcmp (argv[1], "-p") == 0)
{ {
parse_gimprc (); parse_gimprc ();
parse_show_tokens (unknown_tokens); parse_show_tokens (unknown_tokens);