diff options
author | Joel Bodenmann <joel@unormal.org> | 2013-04-03 15:34:48 +0200 |
---|---|---|
committer | Joel Bodenmann <joel@unormal.org> | 2013-04-03 15:34:48 +0200 |
commit | b386962981d7667cd0d14cc50969eb82d0d71dcc (patch) | |
tree | d75928a8b0dba43763b67cd505467f2a9309fe38 /tools/file2c/source | |
parent | 4871a420573d1a4986eb8a3cee18e4a8c58faee5 (diff) | |
parent | 8b15aab802024434bd8565aebb33368e66532a97 (diff) | |
download | uGFX-b386962981d7667cd0d14cc50969eb82d0d71dcc.tar.gz uGFX-b386962981d7667cd0d14cc50969eb82d0d71dcc.tar.bz2 uGFX-b386962981d7667cd0d14cc50969eb82d0d71dcc.zip |
merged inmarket
Diffstat (limited to 'tools/file2c/source')
-rw-r--r-- | tools/file2c/source/VS 2012 Project/file2c.v11.suo | bin | 25600 -> 25600 bytes | |||
-rw-r--r-- | tools/file2c/source/file2c.c | 29 |
2 files changed, 25 insertions, 4 deletions
diff --git a/tools/file2c/source/VS 2012 Project/file2c.v11.suo b/tools/file2c/source/VS 2012 Project/file2c.v11.suo Binary files differindex 586b2c04..38fa846c 100644 --- a/tools/file2c/source/VS 2012 Project/file2c.v11.suo +++ b/tools/file2c/source/VS 2012 Project/file2c.v11.suo diff --git a/tools/file2c/source/file2c.c b/tools/file2c/source/file2c.c index d58d6a58..29b9da2f 100644 --- a/tools/file2c/source/file2c.c +++ b/tools/file2c/source/file2c.c @@ -46,7 +46,7 @@ static char *filenameof(char *fname) { static char *clean4c(char *fname) { char *p; - while((p = strpbrk(fname, "-+ `~!@#$%^&*(){}[]|:;'\",<>?/|="))) *p = '_'; + while((p = strpbrk(fname, "-+ `~!@#$%^&*(){}[]|:;'\",<>?/|=.\\"))) *p = '_'; return fname; } @@ -66,7 +66,7 @@ size_t len; size_t i; /* Default values for our parameters */ - opt_progname = argv[0]; + opt_progname = filenameof(argv[0]); opt_inputfile = 0; opt_outputfile = 0; opt_arrayname = 0; @@ -79,6 +79,7 @@ size_t i; if (argv[0][0] == '-') { while (*++(argv[0])) { switch(argv[0][0]) { + case '?': case 'h': goto usage; case 'b': opt_breakblocks = 1; break; case 'c': opt_const = "const "; break; case 's': opt_static = "static "; break; @@ -97,6 +98,7 @@ size_t i; fprintf(stderr, "Usage:\n\t%s -?\n" "\t%s [-bs] [-n name] [inputfile] [outputfile]\n" "\t\t-?\tThis help\n" + "\t\t-h\tThis help\n" "\t\t-b\tBreak the arrays for compilers that won't handle large arrays\n" "\t\t-c\tDeclare the arrays as const (useful to ensure they end up in Flash)\n" "\t\t-s\tDeclare the arrays as static\n" @@ -136,14 +138,33 @@ size_t i; } else f_output = stdout; - /* Set the array name */ + /* Print the comment header */ + fprintf(f_output, "/**\n * This file was generated "); + if (opt_inputfile) fprintf(f_output, "from \"%s\" ", opt_inputfile); + fprintf(f_output, "using...\n *\n *\t%s", opt_progname); + if (opt_arrayname || opt_static[0] || opt_const[0] || opt_breakblocks) { + fprintf(f_output, " -"); + if (opt_breakblocks) fprintf(f_output, "b"); + if (opt_const[0]) fprintf(f_output, "c"); + if (opt_static[0]) fprintf(f_output, "s"); + if (opt_arrayname) fprintf(f_output, "n %s", opt_arrayname); + } + if (opt_inputfile) fprintf(f_output, " %s", opt_inputfile); + if (opt_outputfile) fprintf(f_output, " %s", opt_outputfile); + fprintf(f_output, "\n *\n */\n"); + + /* + * Set the array name. + * We do this after printing opt_inputfile for the last time as we + * modify opt_inputfile in place to generate opt_arrayname. + */ if (!opt_arrayname) { if (opt_inputfile) opt_arrayname = filenameof(opt_inputfile); if (!opt_arrayname || !opt_arrayname[0]) opt_arrayname = "filearray"; - opt_arrayname = clean4c(opt_arrayname); } + opt_arrayname = clean4c(opt_arrayname); /* Read the file processing 1K at a time */ blocknum = 0; |