| 1 | /* -*-c-*- |
| 2 | * |
| 3 | * $Id$ |
| 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 | #ifndef QUINE_H |
| 30 | #define QUINE_H |
| 31 | |
| 32 | #ifdef __cplusplus |
| 33 | extern "C" { |
| 34 | #endif |
| 35 | |
| 36 | /*----- Required headers --------------------------------------------------*/ |
| 37 | |
| 38 | #include <stdio.h> |
| 39 | |
| 40 | /*----- External tables ---------------------------------------------------*/ |
| 41 | |
| 42 | extern const char **qq_table[]; |
| 43 | extern const char *qq_qqlib[]; |
| 44 | |
| 45 | /*----- Functions provided ------------------------------------------------*/ |
| 46 | |
| 47 | /* --- @qq_xlate@ --- * |
| 48 | * |
| 49 | * Arguments: @FILE *fp@ = output file handle |
| 50 | * @const char *p@ = pointer to encoded text |
| 51 | * |
| 52 | * Returns: --- |
| 53 | * |
| 54 | * Use: Writes the decoded string to the given file handle. |
| 55 | */ |
| 56 | |
| 57 | extern void qq_xlate(FILE */*fp*/, const char */*p*/); |
| 58 | |
| 59 | /* --- @qq_file@ --- * |
| 60 | * |
| 61 | * Arguments: @FILE *fp@ = output file handle |
| 62 | * @const char **p@ = pointer to the output array |
| 63 | * |
| 64 | * Returns: --- |
| 65 | * |
| 66 | * Use: Writes the contents of a file to the output. |
| 67 | */ |
| 68 | |
| 69 | extern void qq_file(FILE */*fp*/, const char **/*p*/); |
| 70 | |
| 71 | /* --- @qq_head@ --- * |
| 72 | * |
| 73 | * Arguments: @FILE *fp@ = output file handle |
| 74 | * |
| 75 | * Returns: --- |
| 76 | * |
| 77 | * Use: Writes the head of a `qqout.c' file. |
| 78 | */ |
| 79 | |
| 80 | extern void qq_head(FILE */*fp*/); |
| 81 | |
| 82 | /* --- @qq_body@ --- * |
| 83 | * |
| 84 | * Arguments: @FILE *fp@ = output file handle |
| 85 | * @const char ***p@ = pointer to main table |
| 86 | * |
| 87 | * Returns: --- |
| 88 | * |
| 89 | * Use: Writes the body table of a `qqout.c' file. |
| 90 | */ |
| 91 | |
| 92 | extern void qq_body(FILE */*fp*/, const char ***/*p*/); |
| 93 | |
| 94 | /* --- @qq_tail@ --- * |
| 95 | * |
| 96 | * Arguments: @FILE *fp@ = output file handle |
| 97 | * @const char **qql@ = pointer to qqlib file array |
| 98 | * @size_t fno@ = number of files written |
| 99 | * @const char *fn@ = name of `qqout.c' file |
| 100 | * |
| 101 | * Returns: --- |
| 102 | * |
| 103 | * Use: Writes the head of a `qqout.c' file. |
| 104 | */ |
| 105 | |
| 106 | extern void qq_tail(FILE */*fp*/, const char **/*qql*/, |
| 107 | size_t /*fno*/, const char */*fn*/); |
| 108 | |
| 109 | /* --- @qq_mkfile@ --- * |
| 110 | * |
| 111 | * Arguments: @const char *fn@ = pointer to a filename |
| 112 | * @int mode@ = mode to create file with |
| 113 | * |
| 114 | * Returns: A handle for the created file. |
| 115 | * |
| 116 | * Use: Creates a file, and leading directories and stuff. |
| 117 | */ |
| 118 | |
| 119 | #ifdef QUINE_PORTABLE |
| 120 | extern FILE *qq_mkfile(const char */*fn*/); |
| 121 | #else |
| 122 | extern FILE *qq_mkfile(const char */*fn*/, int /*mode*/); |
| 123 | #endif |
| 124 | |
| 125 | /* --- @qq_dump@ --- * |
| 126 | * |
| 127 | * Arguments: @FILE *fp@ = stream to dump on |
| 128 | * |
| 129 | * Returns: --- |
| 130 | * |
| 131 | * Use: Writes the program's source code to the given file. |
| 132 | */ |
| 133 | |
| 134 | extern void qq_dump(FILE */*fp*/); |
| 135 | |
| 136 | /* --- @qq_create@ --- * |
| 137 | * |
| 138 | * Arguments: --- |
| 139 | * |
| 140 | * Returns: --- |
| 141 | * |
| 142 | * Use: Writes a source distribution to the current directory. |
| 143 | */ |
| 144 | |
| 145 | extern int qq_create(void); |
| 146 | |
| 147 | /*----- That's all, folks -------------------------------------------------*/ |
| 148 | |
| 149 | #ifdef __cplusplus |
| 150 | } |
| 151 | #endif |
| 152 | |
| 153 | #endif |