beta-0.89.2
[luatex.git] / source / texk / web2c / luatexdir / luafontloader / src / ffdummies.c
blob1ac523b56eb51be01ab014cedb01fc0c68c3ca70
1 /* ffdummies.c
3 Copyright 2006-2009 Taco Hoekwater <taco@luatex.org>
5 This file is part of LuaTeX.
7 LuaTeX is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2 of the License, or (at your
10 option) any later version.
12 LuaTeX is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 License for more details.
17 You should have received a copy of the GNU General Public License along
18 with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
20 /* some dummy functions and variables so that a few ff source files can be ignored */
22 #include "ffdummies.h"
24 #include <stdarg.h>
26 char **gww_errors = NULL;
27 int gww_error_count = 0;
29 void gwwv_errors_free(void)
31 int i;
32 if (gww_error_count > 0) {
33 for (i = 0; i < gww_error_count; i++) {
34 free(gww_errors[i]);
36 free(gww_errors);
37 gww_error_count = 0;
38 gww_errors = NULL;
42 __attribute__ ((format(printf, 1, 0)))
43 static void LUAUI_IError(const char *format, ...)
45 va_list ap;
46 size_t l;
47 char buffer[400], *str;
48 l = strlen("Internal Error: ");
49 snprintf(buffer, sizeof(buffer), "Internal Error: ");
50 va_start(ap, format);
51 vsnprintf(buffer + l, sizeof(buffer) - l, format, ap);
52 va_end(ap);
53 str = xstrdup((char *) buffer);
54 gww_errors = realloc(gww_errors, (gww_error_count + 2) * sizeof(char *));
55 if (gww_errors == NULL) {
56 perror("memory allocation failed");
57 exit(EXIT_FAILURE);
59 gww_errors[gww_error_count] = str;
60 gww_error_count++;
61 gww_errors[gww_error_count] = NULL;
64 __attribute__ ((format(printf, 1, 0)))
65 static void LUAUI__LogError(const char *format, va_list ap)
67 char buffer[400], *str;
68 vsnprintf(buffer, sizeof(buffer), format, ap);
69 str = xstrdup((char *) buffer);
70 gww_errors = realloc(gww_errors, (gww_error_count + 2) * sizeof(char *));
71 if (gww_errors == NULL) {
72 perror("memory allocation failed");
73 exit(EXIT_FAILURE);
75 gww_errors[gww_error_count] = str;
76 gww_error_count++;
77 gww_errors[gww_error_count] = NULL;
80 /* this is not static because it is used by gwwiconv.c */
82 __attribute__ ((format(printf, 1, 2)))
83 static void LUAUI_LogError(const char *format, ...)
85 va_list ap;
86 va_start(ap, format);
87 LUAUI__LogError(format, ap);
88 va_end(ap);
91 __attribute__ ((format(printf, 2, 3)))
92 static void LUAUI_post_notice(const char *title, const char *statement, ...)
94 va_list ap;
95 (void) title;
96 va_start(ap, statement);
97 LUAUI__LogError(statement, ap);
98 va_end(ap);
101 __attribute__ ((format(printf, 2, 3)))
102 static void LUAUI_post_error(const char *title, const char *statement, ...)
104 va_list ap;
105 (void) title;
106 va_start(ap, statement);
107 LUAUI__LogError(statement, ap);
108 va_end(ap);
111 static int LUAUI_ask(const char *title, const char **answers,
112 int def, int cancel, const char *question, ...)
114 (void) title;
115 (void) answers;
116 (void) cancel;
117 (void) question;
118 return (def);
121 static int LUAUI_choose(const char *title, const char **choices, int cnt,
122 int def, const char *question, ...)
124 (void) title;
125 (void) choices;
126 (void) cnt;
127 (void) question;
128 return (def);
131 static int LUAUI_choose_multiple(char *title, const char **choices, char *sel,
132 int cnt, char *buts[2], const char *question,
133 ...)
135 (void) title;
136 (void) choices;
137 (void) sel;
138 (void) cnt;
139 (void) buts;
140 (void) question;
141 return (-1);
144 static char *LUAUI_ask_string(const char *title, const char *def,
145 const char *question, ...)
147 (void) title;
148 (void) def;
149 (void) question;
150 return def ? strdup(def) : NULL;
153 static char *LUAUI_open_file(const char *title, const char *defaultfile,
154 const char *initial_filter)
156 (void) title;
157 (void) initial_filter;
158 (void) defaultfile;
159 return (NULL);
162 static char *LUAUI_saveas_file(const char *title, const char *defaultfile,
163 const char *initial_filter)
165 (void) title;
166 (void) initial_filter;
167 return (copy(defaultfile));
170 static void LUAUI_progress_start(int delay, const char *title,
171 const char *line1, const char *line2, int tot,
172 int stages)
174 (void) delay;
175 (void) title;
176 (void) line1;
177 (void) line2;
178 (void) tot;
179 (void) stages;
182 static void LUAUI_void_void_noop(void)
186 static void LUAUI_void_int_noop(int useless)
188 (void) useless;
191 static int LUAUI_int_int_noop(int useless)
193 (void) useless;
194 return (true);
197 static void LUAUI_void_str_noop(const char *useless)
199 (void) useless;
202 static int LUAUI_alwaystrue(void)
204 return (true);
207 static int LUAUI_DefaultStrokeFlags(void)
209 return (sf_correctdir);
212 struct ui_interface luaui_interface = {
213 LUAUI_IError,
214 LUAUI_post_error,
215 LUAUI_LogError,
216 LUAUI_post_notice,
217 LUAUI_ask,
218 LUAUI_choose,
219 LUAUI_choose_multiple,
220 LUAUI_ask_string,
221 LUAUI_ask_string, /* password */
222 LUAUI_open_file,
223 LUAUI_saveas_file,
225 LUAUI_progress_start,
226 LUAUI_void_void_noop,
227 LUAUI_void_void_noop,
228 LUAUI_void_int_noop,
229 LUAUI_alwaystrue,
230 LUAUI_alwaystrue,
231 LUAUI_int_int_noop,
232 LUAUI_void_str_noop,
233 LUAUI_void_str_noop,
234 LUAUI_void_void_noop,
235 LUAUI_void_void_noop,
236 LUAUI_void_int_noop,
237 LUAUI_void_int_noop,
238 LUAUI_alwaystrue,
240 LUAUI_void_void_noop,
242 NOUI_TTFNameIds,
243 NOUI_MSLangString,
245 LUAUI_DefaultStrokeFlags
248 /* some bits and pieces */
250 int URLFromFile(char *url, FILE * from)
252 (void) url;
253 (void) from;
254 return false;
257 /* print.c */
258 int pagewidth = 0, pageheight = 0; /* In points */
259 char *printlazyprinter = NULL;
260 char *printcommand = NULL;
261 int printtype = 0;
263 void ScriptPrint(FontViewBase * fv, int type, int32 * pointsizes,
264 char *samplefile, unichar_t * sample, char *outputfile)
266 (void) fv;
267 (void) type;
268 (void) pointsizes;
269 (void) samplefile;
270 (void) sample;
271 (void) outputfile;
274 #if 0 /* unused */
275 static int PdfDumpGlyphResources(void *pi, SplineChar * sc)
277 (void) pi;
278 (void) sc;
279 return 0;
281 #endif
283 /* autotrace.c */
284 int autotrace_ask = 0, mf_ask = 0, mf_clearbackgrounds = 0, mf_showerrors = 0;
285 char *mf_args = NULL;
286 int preferpotrace = 0;
288 void *GetAutoTraceArgs(void)
290 return NULL;
293 void SetAutoTraceArgs(void *a)
295 (void) a;
298 void FVAutoTrace(FontViewBase * fv, int ask)
300 (void) fv;
301 (void) ask;
304 SplineFont *SFFromMF(char *filename)
306 (void) filename;
307 return NULL;
310 /* http.c */
312 FILE *URLToTempFile(char *url, void *_lock)
314 (void) _lock;
315 (void) url;
316 ff_post_error(_("Could not parse URL"),
317 _("FontForge only handles ftp and http URLs at the moment"));
318 return (NULL);