mirror of
https://github.com/ascii-boxes/boxes.git
synced 2025-06-18 15:56:39 +02:00
Evaluate new 'designer' keyword and show it in box design information output #22
This commit is contained in:
parent
9239b15ad5
commit
af85c0c255
26
src/boxes.c
26
src/boxes.c
@ -960,7 +960,9 @@ static int list_styles()
|
||||
fprintf (opt.outfile, "\n");
|
||||
|
||||
fprintf (opt.outfile, "Author: %s\n",
|
||||
d->author? d->author: "(unknown artist)");
|
||||
d->author? d->author: "(unknown author)");
|
||||
fprintf (opt.outfile, "Original Designer: %s\n",
|
||||
d->designer? d->designer: "(unknown artist)");
|
||||
fprintf (opt.outfile, "Creation Date: %s\n",
|
||||
d->created? d->created: "(unknown)");
|
||||
|
||||
@ -1135,11 +1137,23 @@ static int list_styles()
|
||||
for (i=strlen(yyfilename)+strlen(buf); i>0; --i)
|
||||
fprintf (opt.outfile, "-");
|
||||
fprintf (opt.outfile, "\n\n");
|
||||
for (i=0; i<anz_designs; ++i)
|
||||
fprintf (opt.outfile, "%s (%s):\n\n%s\n\n", list[i]->name,
|
||||
list[i]->author? list[i]->author: "unknown artist",
|
||||
list[i]->sample);
|
||||
|
||||
for (i=0; i<anz_designs; ++i) {
|
||||
if (list[i]->author && list[i]->designer && strcmp(list[i]->author, list[i]->designer) != 0) {
|
||||
fprintf(opt.outfile, "%s\n%s, coded by %s:\n\n%s\n\n", list[i]->name,
|
||||
list[i]->designer, list[i]->author, list[i]->sample);
|
||||
}
|
||||
else if (list[i]->designer) {
|
||||
fprintf(opt.outfile, "%s\n%s:\n\n%s\n\n", list[i]->name,
|
||||
list[i]->designer, list[i]->sample);
|
||||
}
|
||||
else if (list[i]->author) {
|
||||
fprintf(opt.outfile, "%s\nunknown artist, coded by %s:\n\n%s\n\n", list[i]->name,
|
||||
list[i]->author, list[i]->sample);
|
||||
}
|
||||
else {
|
||||
fprintf(opt.outfile, "%s:\n\n%s\n\n", list[i]->name, list[i]->sample);
|
||||
}
|
||||
}
|
||||
BFREE (list);
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,8 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
char *author;
|
||||
char *author; /* creator of the configuration file entry */
|
||||
char *designer; /* creator of the original ASCII artwork */
|
||||
char *created; /* date created, free format */
|
||||
char *revision; /* revision number of design */
|
||||
char *revdate; /* date of current revision */
|
||||
|
@ -76,7 +76,7 @@ static void inflate_inbuf();
|
||||
%s ELASTIC
|
||||
|
||||
|
||||
PWORD [a-zA-ZäöüÄÖÜ][a-zA-Z0-9\-_üäöÜÄÖß]*
|
||||
PWORD [a-zA-Z<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>][a-zA-Z0-9\-_<><5F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]*
|
||||
PWHITE [\n \r\t]
|
||||
PBOX Box
|
||||
SDELIM [\"~\'`!@\%\&\*=:;<>\?/|\.\\]
|
||||
@ -288,7 +288,7 @@ Once { yylval.c = 'o'; return YRXPFLAG; }
|
||||
}
|
||||
|
||||
|
||||
author|created|revision|revdate|indent {
|
||||
author|designer|created|revision|revdate|indent {
|
||||
/*
|
||||
* general key words
|
||||
*/
|
||||
|
@ -269,6 +269,7 @@ static void recover()
|
||||
*/
|
||||
BFREE (designs[design_idx].name);
|
||||
BFREE (designs[design_idx].author);
|
||||
BFREE (designs[design_idx].designer);
|
||||
BFREE (designs[design_idx].created);
|
||||
BFREE (designs[design_idx].revision);
|
||||
BFREE (designs[design_idx].revdate);
|
||||
@ -484,6 +485,13 @@ entry: KEYWORD STRING
|
||||
YYABORT;
|
||||
}
|
||||
}
|
||||
else if (strcasecmp ($1, "designer") == 0) {
|
||||
designs[design_idx].designer = (char *) strdup ($2);
|
||||
if (designs[design_idx].designer == NULL) {
|
||||
perror (PROJECT);
|
||||
YYABORT;
|
||||
}
|
||||
}
|
||||
else if (strcasecmp ($1, "revision") == 0) {
|
||||
designs[design_idx].revision = (char *) strdup ($2);
|
||||
if (designs[design_idx].revision == NULL) {
|
||||
|
@ -6,6 +6,7 @@
|
||||
Complete Design Information for "c":
|
||||
------------------------------------
|
||||
Author: Thomas Jensen <boxes(at)thomasjensen(dot)com>
|
||||
Original Designer: (public domain)
|
||||
Creation Date: March 18, 1999 (Thursday, 15:25h)
|
||||
Current Revision: 1.0 as of March 18, 1999 (Thursday, 15:25h)
|
||||
Indentation Mode: box (indent box)
|
||||
|
@ -5,7 +5,8 @@
|
||||
:EXPECTED
|
||||
Complete Design Information for "<Command Line Definition>":
|
||||
------------------------------------------------------------
|
||||
Author: (unknown artist)
|
||||
Author: (unknown author)
|
||||
Original Designer: (unknown artist)
|
||||
Creation Date: now
|
||||
Current Revision: 1.0
|
||||
Indentation Mode: box (indent box)
|
||||
|
Loading…
x
Reference in New Issue
Block a user