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