quine.c: Fix double-close bug.
[quine] / quine.h
CommitLineData
267c6003 1/* -*-c-*-
2 *
267c6003 3 * Definitions for building quines
4 *
5 * (c) 1999 Mark Wooding
6 */
7
8/*----- Licensing notice --------------------------------------------------*
9 *
10 * This file is part of Quine
11 *
12 * Quine is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * Quine is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with Quine; if not, write to the Free Software Foundation,
24 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 */
26
267c6003 27#ifndef QUINE_H
28#define QUINE_H
29
30#ifdef __cplusplus
31 extern "C" {
32#endif
33
34/*----- Required headers --------------------------------------------------*/
35
36#include <stdio.h>
37
38/*----- External tables ---------------------------------------------------*/
39
40extern const char **qq_table[];
41extern const char *qq_qqlib[];
42
43/*----- Functions provided ------------------------------------------------*/
44
45/* --- @qq_xlate@ --- *
46 *
47 * Arguments: @FILE *fp@ = output file handle
48 * @const char *p@ = pointer to encoded text
49 *
50 * Returns: ---
51 *
52 * Use: Writes the decoded string to the given file handle.
53 */
54
55extern void qq_xlate(FILE */*fp*/, const char */*p*/);
56
57/* --- @qq_file@ --- *
58 *
59 * Arguments: @FILE *fp@ = output file handle
60 * @const char **p@ = pointer to the output array
61 *
62 * Returns: ---
63 *
64 * Use: Writes the contents of a file to the output.
65 */
66
67extern void qq_file(FILE */*fp*/, const char **/*p*/);
68
69/* --- @qq_head@ --- *
70 *
71 * Arguments: @FILE *fp@ = output file handle
72 *
73 * Returns: ---
74 *
75 * Use: Writes the head of a `qqout.c' file.
76 */
77
78extern void qq_head(FILE */*fp*/);
79
80/* --- @qq_body@ --- *
81 *
82 * Arguments: @FILE *fp@ = output file handle
83 * @const char ***p@ = pointer to main table
84 *
85 * Returns: ---
86 *
87 * Use: Writes the body table of a `qqout.c' file.
88 */
89
90extern void qq_body(FILE */*fp*/, const char ***/*p*/);
91
92/* --- @qq_tail@ --- *
93 *
94 * Arguments: @FILE *fp@ = output file handle
95 * @const char **qql@ = pointer to qqlib file array
96 * @size_t fno@ = number of files written
97 * @const char *fn@ = name of `qqout.c' file
98 *
99 * Returns: ---
100 *
101 * Use: Writes the head of a `qqout.c' file.
102 */
103
104extern void qq_tail(FILE */*fp*/, const char **/*qql*/,
105 size_t /*fno*/, const char */*fn*/);
106
107/* --- @qq_mkfile@ --- *
108 *
109 * Arguments: @const char *fn@ = pointer to a filename
110 * @int mode@ = mode to create file with
111 *
112 * Returns: A handle for the created file.
113 *
114 * Use: Creates a file, and leading directories and stuff.
115 */
116
117#ifdef QUINE_PORTABLE
118extern FILE *qq_mkfile(const char */*fn*/);
119#else
120extern FILE *qq_mkfile(const char */*fn*/, int /*mode*/);
121#endif
122
123/* --- @qq_dump@ --- *
124 *
125 * Arguments: @FILE *fp@ = stream to dump on
126 *
127 * Returns: ---
128 *
129 * Use: Writes the program's source code to the given file.
130 */
131
132extern void qq_dump(FILE */*fp*/);
133
134/* --- @qq_create@ --- *
135 *
136 * Arguments: ---
137 *
138 * Returns: ---
139 *
140 * Use: Writes a source distribution to the current directory.
141 */
142
143extern int qq_create(void);
144
145/*----- That's all, folks -------------------------------------------------*/
146
147#ifdef __cplusplus
148 }
149#endif
150
151#endif