1 /* Help-related definitions for Xconq.
2    Copyright (C) 1991-1994, 1996, 1998, 1999 Stanley T. Shebs.
3 
4 Xconq is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.  See the file COPYING.  */
8 
9 /* \file kernel/help.h
10  * \brief Help-related definitions for Xconq.
11  */
12 
13 /* \brief Node types. */
14 enum nodeclass {
15     miscnode,   	/*!< Miscellaneous node. */
16     utypenode,  	/*!< Unit node. */
17     mtypenode,  	/*!< Material node. */
18     ttypenode,  	/*!< Terrain node. */
19     atypenode   	/*!< Advance node. */
20 };
21 
22 /* Help output carbon copies. */
23 #define HELP_OUTPUT_CC_NONE	0
24 #define HELP_OUTPUT_CC_FILES	1
25 
26 /* \brief Help output mode. */
27 /* Postscript and PDF can be gotten from TexInfo or LaTeX. */
28 /* The idea behind magic text is to allow an UI to give a better presentation
29    of the help output. An alternative would be for the UI to parse /a subset
30    of?\ HTML directly /see doc/PROJECTS: I58\ */
31 typedef enum help_output_mode {
32     HELP_OUTPUT_PLAIN_TEXT = 0,	    /*!< Plain Text */
33     HELP_OUTPUT_HTML,		    /*!< Hypertext Markup Language */
34     HELP_OUTPUT_TEXI,		    /*!< GNU TexInfo */
35     HELP_OUTPUT_XML,		    /*!< Extensible Markup Language */
36     HELP_OUTPUT_LATEX,		    /*!< LaTeX */
37     HELP_OUTPUT_MAGIC_TEXT	    /*!< Text with UI-Parseable Format Codes */
38 } HelpOutputMode;
39 
40 /* \brief Help page enumeration. */
41 typedef enum help_page {
42     HELP_PAGE_NONE = 0,
43     HELP_PAGE_MASTER_INDEX,
44     HELP_PAGE_TOC,
45     HELP_PAGE_COPYRIGHT,
46     HELP_PAGE_WARRANTY,
47     HELP_PAGE_NEWS,
48     HELP_PAGE_INSTRUCTIONS,
49     HELP_PAGE_GAME_OVERVIEW,
50     HELP_PAGE_SCORING,
51     HELP_PAGE_MODULES,
52     HELP_PAGE_GAME_SETUP,
53     HELP_PAGE_WORLD,
54     HELP_PAGE_UTYPE,
55     HELP_PAGE_TTYPE,
56     HELP_PAGE_MTYPE,
57     HELP_PAGE_ATYPE,
58     HELP_PAGE_CONCEPTS
59 } HelpPage;
60 
61 /* \brief Help page description struct. */
62 typedef struct help_page_defn {
63     char *filebname;
64     char *name;
65     HelpPage tocpage;
66     HelpPage prevpage;
67     HelpPage nextpage;
68 } HelpPageDefn;
69 
70 #include "obstack.h"
71 
72 /*! \brief TextBuffer. */
73 typedef struct a_textbuffer {
74     char *text;             	/*!< text string. */
75     int bufmax;             	/*!< Maximum buffer size. */
76     struct obstack ostack;  	/*!< Object stack control data */
77 } TextBuffer;
78 
79 /*! \brief Help Node. */
80 typedef struct a_helpnode {
81     char *key;			/*!< key. */
82     /*!< Pointer to function. (hash???) */
83     void (*fn)(int arg, char *key, TextBuffer *buf);
84     enum nodeclass nclass;	/*!< Node type. */
85     int arg;			/*!< Argument. ??? */
86     char *text;			/*!< text string. */
87     int textend;		/*!< text length. ??? */
88     struct a_helpnode *prev; 	/*!< Previous help node. */
89     struct a_helpnode *next;   	/*!< Next help node. */
90 } HelpNode;
91 
92 /*! \brief First Help Node. */
93 extern HelpNode *first_help_node;
94 
95 /*! Pointer to "Copying" help node. */
96 extern HelpNode *copying_help_node;
97 /*! Pointer to "Warranty" help node. */
98 extern HelpNode *warranty_help_node;
99 
100 extern void tbprintf(TextBuffer *buf, char *str, ...);
101 extern void tbcat(TextBuffer *buf, char *str);
102 extern void tbcat_si(TextBuffer *buf, char *str);
103 extern void tbcatline(TextBuffer *buf, char *str);
104 extern void tbcatline_si(TextBuffer *buf, char *str);
105 
106 extern void init_help(void);
107 extern HelpNode *create_help_node(void);
108 extern HelpNode *add_help_node(char *key,
109 			       void (*fn)(int, char *, TextBuffer *),
110 			       int arg, HelpNode *prevnode);
111 extern HelpNode *find_help_node(HelpNode *node, char *str);
112 extern void create_game_help_nodes(void);
113 extern char *get_help_text(HelpNode *node);
114 
115 extern void describe_topics(int arg, char *key, TextBuffer *buf);
116 extern void describe_command(int ch, char *name, char *help, int onechar,
117 			     TextBuffer *buf);
118 extern void append_blurb_strings(char *buf, Obj *notes);
119 extern void notify_instructions(void);
120 
121 extern void print_any_news(void);
122 extern void print_game_description_to_file(FILE *fp);
123 
124 extern void describe_copyright(int arg, char *key, TextBuffer *buf);
125 extern void describe_warranty(int arg, char *key, TextBuffer *buf);
126 
127 extern void set_help_output_cc(int cctarget);
128 extern void set_help_output_mode(HelpOutputMode houtmode);
129 extern void set_help_output_dir(char *);
130 extern void set_help_toc_filep(FILE *htocfilep);
131 
132 extern FILE *prep_help_file(char *hfilename);
133 extern void finish_help_file(FILE *hfilep);
134 extern void write_help_file_header(FILE *hfile, char *headerdata);
135 extern void write_help_file_footer(FILE *hfile, char *footerdata);
136 extern void write_help_toc_entry(char *hfilebname, char *sectionname,
137 				 int indentlvl);
138 extern char *help_file_brand(void);
139 extern char *get_help_file_extension(void);
140