beta-0.89.2
[luatex.git] / source / texk / web2c / luatexdir / luafontloader / fontforge / fontforge / nouiutil.c
blobc2298dcf43fd94c267748897f14e56ba752d3892
1 /* Copyright (C) 2000-2008 by George Williams */
2 /*
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are met:
6 * Redistributions of source code must retain the above copyright notice, this
7 * list of conditions and the following disclaimer.
9 * Redistributions in binary form must reproduce the above copyright notice,
10 * this list of conditions and the following disclaimer in the documentation
11 * and/or other materials provided with the distribution.
13 * The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 #include "uiinterface.h"
28 #include "splinefont.h"
29 #include <stdarg.h>
30 #include <stdio.h>
31 #include <basics.h>
32 #include <ustring.h>
34 static void NOUI_IError(const char *format,...) {
35 va_list ap;
36 va_start(ap,format);
37 fprintf(stderr, "Internal Error: " );
38 vfprintf(stderr,format,ap);
39 va_end(ap);
42 static void NOUI__LogError(const char *format,va_list ap) {
43 char buffer[400], *str;
44 vsnprintf(buffer,sizeof(buffer),format,ap);
45 str = (char *)buffer;
46 fprintf(stderr,"%s",str);
47 if ( str[strlen(str)-1]!='\n' )
48 putc('\n',stderr);
49 /* free(str);*/
52 static void NOUI_LogError(const char *format,...) {
53 va_list ap;
55 va_start(ap,format);
56 NOUI__LogError(format,ap);
57 va_end(ap);
60 static void NOUI_post_notice(const char *title,const char *statement,...) {
61 va_list ap;
62 (void)title;
63 va_start(ap,statement);
64 NOUI__LogError(statement,ap);
65 va_end(ap);
68 static void NOUI_post_error(const char *title,const char *statement,...) {
69 va_list ap;
70 (void)title;
71 va_start(ap,statement);
72 NOUI__LogError(statement,ap);
73 va_end(ap);
76 static int NOUI_ask(const char *title, const char **answers,
77 int def, int cancel,const char *question,...) {
78 (void)title;
79 (void)answers;
80 (void)def;
81 (void)cancel;
82 (void)question;
83 return( def );
86 static int NOUI_choose(const char *title, const char **choices,int cnt, int def,
87 const char *question,...) {
88 (void)title;
89 (void)choices;
90 (void)def;
91 (void)cnt;
92 (void)question;
93 return( def );
96 static int NOUI_choose_multiple(char *title, const char **choices,char *sel,
97 int cnt, char *buts[2], const char *question,...) {
98 (void)title;
99 (void)choices;
100 (void)sel;
101 (void)cnt;
102 (void)buts;
103 (void)question;
104 return( -1 );
107 static char *NOUI_ask_string(const char *title, const char *def,
108 const char *question,...) {
109 (void)title;
110 (void)def;
111 (void)question;
112 return( (char *) def );
115 static char *NOUI_open_file(const char *title, const char *defaultfile,
116 const char *initial_filter) {
117 (void)title;
118 (void)defaultfile;
119 (void)initial_filter;
120 return( NULL );
123 static char *NOUI_saveas_file(const char *title, const char *defaultfile,
124 const char *initial_filter) {
125 (void)title;
126 (void)initial_filter;
127 return( copy(defaultfile) );
130 static void NOUI_progress_start(int delay, const char *title, const char *line1,
131 const char *line2, int tot, int stages) {
132 (void)delay;
133 (void)title;
134 (void)line1;
135 (void)line2;
136 (void)tot;
137 (void)stages;
140 static void NOUI_void_void_noop(void) {
143 static void NOUI_void_int_noop(int useless) {
144 (void)useless;
147 static int NOUI_int_int_noop(int useless) {
148 (void)useless;
149 return( true );
152 static void NOUI_void_str_noop(const char * useless) {
153 (void)useless;
156 static int NOUI_alwaystrue(void) {
157 return( true );
160 static int NOUI_DefaultStrokeFlags(void) {
161 return( sf_correctdir );
164 static struct ui_interface noui_interface = {
165 NOUI_IError,
166 NOUI_post_error,
167 NOUI_LogError,
168 NOUI_post_notice,
169 NOUI_ask,
170 NOUI_choose,
171 NOUI_choose_multiple,
172 NOUI_ask_string,
173 NOUI_ask_string, /* password */
174 NOUI_open_file,
175 NOUI_saveas_file,
177 NOUI_progress_start,
178 NOUI_void_void_noop,
179 NOUI_void_void_noop,
180 NOUI_void_int_noop,
181 NOUI_alwaystrue,
182 NOUI_alwaystrue,
183 NOUI_int_int_noop,
184 NOUI_void_str_noop,
185 NOUI_void_str_noop,
186 NOUI_void_void_noop,
187 NOUI_void_void_noop,
188 NOUI_void_int_noop,
189 NOUI_void_int_noop,
190 NOUI_alwaystrue,
192 NOUI_void_void_noop,
194 NOUI_TTFNameIds,
195 NOUI_MSLangString,
197 NOUI_DefaultStrokeFlags
199 struct ui_interface *ui_interface = &noui_interface;
201 void FF_SetUiInterface(struct ui_interface *uii) {
202 ui_interface = uii;