summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/files.cc312
-rw-r--r--src/files.h1
-rw-r--r--src/main.c21
3 files changed, 0 insertions, 334 deletions
diff --git a/src/files.cc b/src/files.cc
index 558cfcab..64112efa 100644
--- a/src/files.cc
+++ b/src/files.cc
@@ -3501,318 +3501,6 @@ bool_ show_file(cptr name, cptr what, int line, int mode)
return (TRUE);
}
-bool_ txt_to_html(cptr head, cptr foot, cptr base, cptr ext, bool_ force, bool_ recur)
-{
- int i, x;
-
- /* Number of "real" lines passed by */
- int next = 0;
-
- char buf_name[80];
-
- /* Color of the next line */
- byte color = TERM_WHITE;
-
- /* Current help file */
- FILE *fff = NULL;
-
- /* Current aux file */
- FILE *aux = NULL;
-
- /* Current html file */
- FILE *htm = NULL;
-
- cptr file_ext = "html";
- cptr link_prefix = "";
- cptr link_suffix = "";
-
- /* Pointer to general buffer in the above */
- char *buf;
-
- /* Allocate hyperlink data */
- std::unique_ptr<hyperlink_type> h_ptr(new hyperlink_type);
- memset(h_ptr.get(), 0, sizeof(hyperlink_type));
-
- /* Setup buffer pointer */
- buf = h_ptr->rbuf;
-
- /* Wipe the links */
- for (i = 0; i < MAX_LINKS; i++)
- {
- h_ptr->link_x[i] = -1;
- }
-
- sprintf(buf_name, "%s.%s", base, file_ext);
-
- if ((!force) && file_exist(buf_name)) return FALSE;
-
- /* Build the filename */
- path_build(h_ptr->path, 1024, ANGBAND_DIR_HELP, buf_name);
-
- /* Open the file */
- htm = my_fopen(h_ptr->path, "w");
-
- sprintf(buf_name, "%s.%s", base, ext);
-
- /* h_ptr->caption */
- sprintf(h_ptr->caption, "Help file '%s'", buf_name);
-
- /* Build the filename */
- path_build(h_ptr->path, 1024, ANGBAND_DIR_HELP, buf_name);
-
- /* Open the file */
- fff = my_fopen(h_ptr->path, "r");
-
- /* Oops */
- if (!fff || !htm)
- {
- my_fclose(fff);
- my_fclose(htm);
-
- /* Oops */
- return (TRUE);
- }
-
- /* Build the filename */
- path_build(h_ptr->path, 1024, ANGBAND_DIR_HELP, head);
-
- /* Open the file */
- aux = my_fopen(h_ptr->path, "r");
-
- /* Copy the header */
- if (aux)
- {
- while (TRUE)
- {
- char *find;
-
- if (my_fgets(aux, h_ptr->rbuf, 1024)) break;
- find = strstr(h_ptr->rbuf, "%t");
- if (find != NULL)
- {
- *find = '\0';
- find += 2;
- fprintf(htm, "%s", h_ptr->rbuf);
- fprintf(htm, "%s", base);
- fprintf(htm, "%s\n", find);
- }
- else
- fprintf(htm, "%s\n", h_ptr->rbuf);
- }
- my_fclose(aux);
- }
-
- /* Display the file */
- while (TRUE)
- {
- bool_ do_color = FALSE;
-
- /* Skip a line */
- if (my_fgets(fff, h_ptr->rbuf, 1024)) break;
-
- color = TERM_WHITE;
-
- {
- int print_x;
-
- /* Get a color */
- if (prefix(h_ptr->rbuf, "#####"))
- {
- color = color_char_to_attr(h_ptr->rbuf[5]);
- do_color = TRUE;
- fprintf(htm, "<FONT COLOR=\"#%02X%02X%02X\">",
- angband_color_table[color][1],
- angband_color_table[color][2],
- angband_color_table[color][3]);
- buf = &h_ptr->rbuf[6];
- }
- else buf = h_ptr->rbuf;
-
- /* Count the "real" lines */
- next++;
-
- /* Skip link colors */
- if (prefix(buf, "|||||")) continue;
-
- /* Skip tags */
- if (prefix(buf, "~~~~~"))
- {
- int i;
-
- for (i = 5; (buf[i] >= '0') && (buf[i] <= '9'); i++)
- ;
- buf[i] = '\0';
- fprintf(htm, "<A NAME=\"%s\"></A>", buf + 5);
- continue;
- }
-
- /* Dump the line */
- print_x = 0;
- if (!prefix(buf, "&&&&&"))
- {
- x = 0;
- while (buf[x])
- {
- /* Hyperlink ? */
- if (prefix(buf + x, "*****"))
- {
- int xx = x + 5, z = 0;
- char buff[80];
- char link_line[80], *s;
-
- if (buf[xx] == '/') xx += 2;
-
- /* Zap the link info */
- while (buf[xx] != '*')
- {
- buff[z++] = buf[xx];
- xx++;
- }
- xx++;
- buff[z] = '\0';
-
- /* Zap the link info */
- z = 0;
- while (buf[xx] != '[')
- {
- link_line[z++] = buf[xx];
- xx++;
- }
- xx++;
- link_line[z] = '\0';
-
- /* parse it */
- s = buff;
- while (*s != '.') s++;
- *s = '\0';
- s++;
- if (recur) txt_to_html(head, foot, buff, s, FALSE, recur);
-
- if (atoi(link_line)) fprintf(htm, "<A HREF=\"%s%s.%s%s#%d\">", link_prefix, buff, file_ext, link_suffix, atoi(link_line));
- else fprintf(htm, "<A HREF=\"%s%s.%s%s\">", link_prefix, buff, file_ext, link_suffix);
-
- /* Ok print the link name */
- while (buf[xx] != ']')
- {
- /* Now we treat the next char as printable */
- if (buf[xx] == '\\')
- xx++;
- fprintf(htm, "%c", buf[xx]);
- xx++;
- print_x++;
- }
- x = xx;
-
- fprintf(htm, "</A>");
- }
- /* Color ? */
- else if (prefix(buf + x, "[[[[["))
- {
- int xx = x + 6;
-
- color = color_char_to_attr(buf[x + 5]);
- fprintf(htm, "<FONT COLOR=\"#%02X%02X%02X\">",
- angband_color_table[color][1],
- angband_color_table[color][2],
- angband_color_table[color][3]);
-
- /* Ok print the link name */
- while (buf[xx] != ']')
- {
- /* Now we treat the next char as printable */
- if (buf[xx] == '\\')
- xx++;
- fprintf(htm, "%c", buf[xx]);
- xx++;
- print_x++;
- }
- x++;
- x = xx;
-
- fprintf(htm, "</FONT>");
- }
- /* Hidden HTML tag? */
- else if (prefix(buf + x, "{{{{{"))
- {
- int xx = x + 5;
-
- /* Ok output the tag inside */
- while (buf[xx] != '}')
- {
- fprintf(htm, "%c", buf[xx]);
- xx++;
- }
- x++;
- x = xx;
- }
- else
- {
- fprintf(htm, "%c", buf[x]);
- print_x++;
- }
-
- x++;
- }
- }
- /* Verbatim mode: i.e: acacacac */
- else
- {
- byte old_color;
-
- x = 5;
- old_color = color_char_to_attr(buf[x]);
- fprintf(htm, "<FONT COLOR=\"#%02X%02X%02X\">",
- angband_color_table[color][1],
- angband_color_table[color][2],
- angband_color_table[color][3]);
- while (buf[x])
- {
- color = color_char_to_attr(buf[x]);
- if (color != old_color)
- fprintf(htm, "</FONT><FONT COLOR=\"#%02X%02X%02X\">",
- angband_color_table[color][1],
- angband_color_table[color][2],
- angband_color_table[color][3]);
-
- fprintf(htm, "%c", buf[x + 1]);
- print_x++;
- x += 2;
- }
- fprintf(htm, "</FONT>");
- }
- }
- if (do_color)
- {
- fprintf(htm, "</FONT>");
- }
- fprintf(htm, "\n");
- }
-
- /* Build the filename */
- path_build(h_ptr->path, 1024, ANGBAND_DIR_HELP, foot);
-
- /* Open the file */
- aux = my_fopen(h_ptr->path, "r");
-
- /* Copy the footer */
- if (aux)
- {
- while (TRUE)
- {
- if (my_fgets(aux, h_ptr->rbuf, 1024)) break;
- fprintf(htm, "%s\n", h_ptr->rbuf);
- }
- my_fclose(aux);
- }
-
- /* Close the file */
- my_fclose(htm);
- my_fclose(fff);
-
- /* Normal return */
- return (TRUE);
-}
-
static void cmovie_clean_line(int y, char *abuf, char *cbuf)
{
const byte *ap = Term->scr->a[y];
diff --git a/src/files.h b/src/files.h
index e3df5636..0eb99f15 100644
--- a/src/files.h
+++ b/src/files.h
@@ -7,7 +7,6 @@
extern "C" {
#endif
-extern bool_ txt_to_html(cptr head, cptr food, cptr base, cptr ext, bool_ force, bool_ recur);
extern void process_player_name(bool_ sf);
extern void do_cmd_save_game(void);
extern void predict_score_gui(bool_ *initialized, bool_ *game_in_progress);
diff --git a/src/main.c b/src/main.c
index f6379624..15b2966e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -183,26 +183,6 @@ int main(int argc, char *argv[])
break;
}
- case 'H':
- {
- char *s;
- int j;
-
- init_lua_init();
-
- for (j = i + 1; j < argc; j++)
- {
- s = argv[j];
-
- while (*s != '.') s++;
- *s = '\0';
- s++;
- txt_to_html("head.aux", "foot.aux", argv[j], s, FALSE, FALSE);
- }
-
- return 0;
- }
-
case '-':
{
if (argv[i][2] == 'h' && !strcmp((argv[i] + 2), "help"))
@@ -230,7 +210,6 @@ usage:
puts(" -w Request wizard mode");
puts(" -o Request original keyset");
puts(" -r Request rogue-like keyset");
- puts(" -H <list of files> Convert helpfile to html");
puts(" -u<who> Use your <who> savefile");
puts(" -M<which> Use the <which> module");
puts(" -m<sys> Force 'main-<sys>.c' usage");