~ubuntu-branches/ubuntu/natty/luatex/natty

« back to all changes in this revision

Viewing changes to source/texk/web2c/luatexdir/luafontloader/src/ffdummies.c

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Preining
  • Date: 2009-12-25 09:47:05 UTC
  • mfrom: (1.1.9 upstream) (4.2.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091225094705-y33rpflo8t4u9nag
Tags: 0.50.0-1
* new upstream release
* disable fix-hurd-ftbfs patch, included upstream
* disable upstram-fixes, included upstream
* disable ubuntu_libpoppler-0.11, not needed anymore

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ffdummies.c
 
2
   
 
3
   Copyright 2006-2009 Taco Hoekwater <taco@luatex.org>
 
4
 
 
5
   This file is part of LuaTeX.
 
6
 
 
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.
 
11
 
 
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.
 
16
 
 
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/>. */
1
19
 
2
20
/* some dummy functions and variables so that a few ff source files can be ignored */
3
21
 
9
27
#include <basics.h>
10
28
#include <ustring.h>
11
29
 
 
30
static const char __svn_version[] =
 
31
    "$Id: ffdummies.c 3278 2009-12-21 11:26:19Z taco $ "
 
32
    "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.50.0/source/texk/web2c/luatexdir/luafontloader/src/ffdummies.c $";
 
33
 
12
34
 
13
35
char **gww_errors = NULL;
14
36
int gww_error_count = 0;
15
37
 
16
 
void gwwv_errors_free (void) { 
17
 
  int i;
18
 
  if (gww_error_count>0) {
19
 
        for (i=0;i<gww_error_count;i++) {
20
 
          free(gww_errors[i]);
21
 
        }
22
 
        free(gww_errors);
23
 
        gww_error_count = 0;
24
 
        gww_errors = NULL;
25
 
  }
 
38
void gwwv_errors_free(void)
 
39
{
 
40
    int i;
 
41
    if (gww_error_count > 0) {
 
42
        for (i = 0; i < gww_error_count; i++) {
 
43
            free(gww_errors[i]);
 
44
        }
 
45
        free(gww_errors);
 
46
        gww_error_count = 0;
 
47
        gww_errors = NULL;
 
48
    }
26
49
}
27
50
 
28
 
 
29
 
static void LUAUI_IError(const char *format,...) {
 
51
__attribute__ ((format(printf, 1, 0)))
 
52
static void LUAUI_IError(const char *format, ...)
 
53
{
30
54
    va_list ap;
31
 
    va_start(ap,format);
32
 
    fprintf(stderr, "Internal Error: " );
33
 
    vfprintf(stderr,format,ap);
 
55
    size_t l;
 
56
    char buffer[400], *str;
 
57
    l = strlen("Internal Error: ");
 
58
    snprintf(buffer, sizeof(buffer), "Internal Error: ");
 
59
    va_start(ap, format);
 
60
    vsnprintf(buffer+l, sizeof(buffer)-l, format, ap);
34
61
    va_end(ap);
 
62
    str = xstrdup((char *) buffer);
 
63
    gww_errors = realloc(gww_errors, (gww_error_count + 2) * sizeof(char *));
 
64
    if (gww_errors == NULL) {
 
65
        perror("memory allocation failed");
 
66
        exit(EXIT_FAILURE);
 
67
    }
 
68
    gww_errors[gww_error_count] = str;
 
69
    gww_error_count++;
 
70
    gww_errors[gww_error_count] = NULL;
35
71
}
36
72
 
37
 
static void LUAUI__LogError(const char *format,va_list ap) {
 
73
__attribute__ ((format(printf, 1, 0)))
 
74
static void LUAUI__LogError(const char *format, va_list ap)
 
75
{
38
76
    char buffer[400], *str;
39
 
    vsnprintf(buffer,sizeof(buffer),format,ap);
40
 
    str = utf82def_copy(buffer);
41
 
    gww_errors = realloc(gww_errors, (gww_error_count+2)*sizeof(char *));
42
 
    if (gww_errors==NULL) {
43
 
          perror("memory allocation failed");
44
 
      exit(EXIT_FAILURE);
 
77
    vsnprintf(buffer, sizeof(buffer), format, ap);
 
78
    str = xstrdup((char *) buffer);
 
79
    gww_errors = realloc(gww_errors, (gww_error_count + 2) * sizeof(char *));
 
80
    if (gww_errors == NULL) {
 
81
        perror("memory allocation failed");
 
82
        exit(EXIT_FAILURE);
45
83
    }
46
 
    gww_errors[gww_error_count ] = str ;
47
 
    gww_error_count ++;
48
 
    gww_errors[gww_error_count ] = NULL;
 
84
    gww_errors[gww_error_count] = str;
 
85
    gww_error_count++;
 
86
    gww_errors[gww_error_count] = NULL;
49
87
}
50
88
 
51
89
/* this is not static because it is used by gwwiconv.c */
52
90
 
53
 
void LUAUI_LogError(const char *format,...) {
54
 
    va_list ap;
55
 
    va_start(ap,format);
56
 
    LUAUI__LogError(format,ap);
57
 
    va_end(ap);
58
 
}
59
 
 
60
 
static void LUAUI_post_notice(const char *title,const char *statement,...) {
61
 
    va_list ap;
62
 
    (void)title;
63
 
    va_start(ap,statement);
64
 
    LUAUI__LogError(statement,ap);
65
 
    va_end(ap);
66
 
}
67
 
 
68
 
static void LUAUI_post_error(const char *title,const char *statement,...) {
69
 
    va_list ap;
70
 
    (void)title;
71
 
    va_start(ap,statement);
72
 
    LUAUI__LogError(statement,ap);
 
91
__attribute__ ((format(printf, 1, 2)))
 
92
void LUAUI_LogError(const char *format, ...)
 
93
{
 
94
    va_list ap;
 
95
    va_start(ap, format);
 
96
    LUAUI__LogError(format, ap);
 
97
    va_end(ap);
 
98
}
 
99
 
 
100
__attribute__ ((format(printf, 2, 3)))
 
101
static void LUAUI_post_notice(const char *title, const char *statement, ...)
 
102
{
 
103
    va_list ap;
 
104
    (void) title;
 
105
    va_start(ap, statement);
 
106
    LUAUI__LogError(statement, ap);
 
107
    va_end(ap);
 
108
}
 
109
 
 
110
__attribute__ ((format(printf, 2, 3)))
 
111
static void LUAUI_post_error(const char *title, const char *statement, ...)
 
112
{
 
113
    va_list ap;
 
114
    (void) title;
 
115
    va_start(ap, statement);
 
116
    LUAUI__LogError(statement, ap);
73
117
    va_end(ap);
74
118
}
75
119
 
76
120
static int LUAUI_ask(const char *title, const char **answers,
77
 
        int def, int cancel,const char *question,...) {
78
 
  (void)title;
79
 
  (void)answers;
80
 
  (void)cancel;
81
 
  (void)question;
82
 
return( def );
83
 
}
84
 
 
85
 
static int LUAUI_choose(const char *title, const char **choices,int cnt, int def,
86
 
        const char *question,...) {
87
 
  (void)title;
88
 
  (void)choices;
89
 
  (void)cnt;
90
 
  (void)question;
91
 
return( def );
92
 
}
93
 
 
94
 
static int LUAUI_choose_multiple(char *title, const char **choices,char *sel,
95
 
        int cnt, char *buts[2], const char *question,...) {
96
 
  (void)title;
97
 
  (void)choices;
98
 
  (void)sel;
99
 
  (void)cnt;
100
 
  (void)buts;
101
 
  (void)question;
102
 
return( -1 );
 
121
                     int def, int cancel, const char *question, ...)
 
122
{
 
123
    (void) title;
 
124
    (void) answers;
 
125
    (void) cancel;
 
126
    (void) question;
 
127
    return (def);
 
128
}
 
129
 
 
130
static int LUAUI_choose(const char *title, const char **choices, int cnt,
 
131
                        int def, const char *question, ...)
 
132
{
 
133
    (void) title;
 
134
    (void) choices;
 
135
    (void) cnt;
 
136
    (void) question;
 
137
    return (def);
 
138
}
 
139
 
 
140
static int LUAUI_choose_multiple(char *title, const char **choices, char *sel,
 
141
                                 int cnt, char *buts[2], const char *question,
 
142
                                 ...)
 
143
{
 
144
    (void) title;
 
145
    (void) choices;
 
146
    (void) sel;
 
147
    (void) cnt;
 
148
    (void) buts;
 
149
    (void) question;
 
150
    return (-1);
103
151
}
104
152
 
105
153
static char *LUAUI_ask_string(const char *title, const char *def,
106
 
        const char *question,...) {
107
 
  (void)title;
108
 
  (void)def;
109
 
  (void)question;
110
 
return( (char *) def );
 
154
                              const char *question, ...)
 
155
{
 
156
    (void) title;
 
157
    (void) def;
 
158
    (void) question;
 
159
    return ((char *) def);
111
160
}
112
161
 
113
162
static char *LUAUI_open_file(const char *title, const char *defaultfile,
114
 
        const char *initial_filter) {
115
 
  (void)title;
116
 
  (void)initial_filter;
117
 
  (void)defaultfile;
118
 
return( NULL );
 
163
                             const char *initial_filter)
 
164
{
 
165
    (void) title;
 
166
    (void) initial_filter;
 
167
    (void) defaultfile;
 
168
    return (NULL);
119
169
}
120
170
 
121
171
static char *LUAUI_saveas_file(const char *title, const char *defaultfile,
122
 
        const char *initial_filter) {
123
 
  (void)title;
124
 
  (void)initial_filter;
125
 
return( copy(defaultfile) );
126
 
}
127
 
 
128
 
static void LUAUI_progress_start(int delay, const char *title, const char *line1,
129
 
        const char *line2, int tot, int stages) {
130
 
  (void)delay;
131
 
  (void)title;
132
 
  (void)line1;
133
 
  (void)line2;
134
 
  (void)tot;
135
 
  (void)stages;
136
 
}
137
 
 
138
 
static void LUAUI_void_void_noop(void) {
139
 
}
140
 
 
141
 
static void LUAUI_void_int_noop(int useless) {
142
 
  (void)useless;
143
 
}
144
 
 
145
 
static int LUAUI_int_int_noop(int useless) {
146
 
  (void)useless;
147
 
return( true );
148
 
}
149
 
 
150
 
static void LUAUI_void_str_noop(const char * useless) {
151
 
  (void)useless;
152
 
}
153
 
 
154
 
static int LUAUI_alwaystrue(void) {
155
 
return( true );
156
 
}
157
 
 
158
 
static int LUAUI_DefaultStrokeFlags(void) {
159
 
return( sf_correctdir );
 
172
                               const char *initial_filter)
 
173
{
 
174
    (void) title;
 
175
    (void) initial_filter;
 
176
    return (copy(defaultfile));
 
177
}
 
178
 
 
179
static void LUAUI_progress_start(int delay, const char *title,
 
180
                                 const char *line1, const char *line2, int tot,
 
181
                                 int stages)
 
182
{
 
183
    (void) delay;
 
184
    (void) title;
 
185
    (void) line1;
 
186
    (void) line2;
 
187
    (void) tot;
 
188
    (void) stages;
 
189
}
 
190
 
 
191
static void LUAUI_void_void_noop(void)
 
192
{
 
193
}
 
194
 
 
195
static void LUAUI_void_int_noop(int useless)
 
196
{
 
197
    (void) useless;
 
198
}
 
199
 
 
200
static int LUAUI_int_int_noop(int useless)
 
201
{
 
202
    (void) useless;
 
203
    return (true);
 
204
}
 
205
 
 
206
static void LUAUI_void_str_noop(const char *useless)
 
207
{
 
208
    (void) useless;
 
209
}
 
210
 
 
211
static int LUAUI_alwaystrue(void)
 
212
{
 
213
    return (true);
 
214
}
 
215
 
 
216
static int LUAUI_DefaultStrokeFlags(void)
 
217
{
 
218
    return (sf_correctdir);
160
219
}
161
220
 
162
221
struct ui_interface luaui_interface = {
168
227
    LUAUI_choose,
169
228
    LUAUI_choose_multiple,
170
229
    LUAUI_ask_string,
171
 
    LUAUI_ask_string,                   /* password */
 
230
    LUAUI_ask_string,           /* password */
172
231
    LUAUI_open_file,
173
232
    LUAUI_saveas_file,
174
233
 
197
256
 
198
257
/* some bits and pieces */
199
258
 
200
 
int URLFromFile(char *url,FILE *from) { 
201
 
  (void)url;
202
 
  (void)from;
203
 
  return false; 
 
259
int URLFromFile(char *url, FILE * from)
 
260
{
 
261
    (void) url;
 
262
    (void) from;
 
263
    return false;
204
264
}
205
265
 
206
266
/* print.c */
207
 
int pagewidth = 0, pageheight=0;        /* In points */
208
 
char *printlazyprinter=NULL;
209
 
char *printcommand=NULL;
 
267
int pagewidth = 0, pageheight = 0;      /* In points */
 
268
char *printlazyprinter = NULL;
 
269
char *printcommand = NULL;
210
270
int printtype = 0;
211
271
 
212
 
void ScriptPrint(FontViewBase *fv,int type,int32 *pointsizes,char *samplefile,
213
 
        unichar_t *sample, char *outputfile) {
214
 
  (void)fv;
215
 
  (void)type;
216
 
  (void)pointsizes;
217
 
  (void)samplefile;
218
 
  (void)sample;
219
 
  (void)outputfile;
 
272
void ScriptPrint(FontViewBase * fv, int type, int32 * pointsizes,
 
273
                 char *samplefile, unichar_t * sample, char *outputfile)
 
274
{
 
275
    (void) fv;
 
276
    (void) type;
 
277
    (void) pointsizes;
 
278
    (void) samplefile;
 
279
    (void) sample;
 
280
    (void) outputfile;
220
281
}
221
282
 
222
 
int PdfDumpGlyphResources(void *pi, SplineChar *sc) {
223
 
  (void)pi;
224
 
  (void)sc;
225
 
  return 0;
 
283
int PdfDumpGlyphResources(void *pi, SplineChar * sc)
 
284
{
 
285
    (void) pi;
 
286
    (void) sc;
 
287
    return 0;
226
288
}
227
289
 
228
290
/* autotrace.c */
229
 
int autotrace_ask=0, mf_ask=0, mf_clearbackgrounds=0, mf_showerrors=0;
 
291
int autotrace_ask = 0, mf_ask = 0, mf_clearbackgrounds = 0, mf_showerrors = 0;
230
292
char *mf_args = NULL;
231
 
int preferpotrace=0;
232
 
 
233
 
void *GetAutoTraceArgs(void) {
234
 
return NULL;
235
 
}
236
 
 
237
 
void SetAutoTraceArgs(void *a) {
238
 
  (void)a;
239
 
}
240
 
 
241
 
void FVAutoTrace(FontViewBase *fv,int ask) {
242
 
  (void)fv; (void)ask;
243
 
}
244
 
 
245
 
SplineFont *SFFromMF(char *filename) {
246
 
  (void)filename;
247
 
return NULL;
 
293
int preferpotrace = 0;
 
294
 
 
295
void *GetAutoTraceArgs(void)
 
296
{
 
297
    return NULL;
 
298
}
 
299
 
 
300
void SetAutoTraceArgs(void *a)
 
301
{
 
302
    (void) a;
 
303
}
 
304
 
 
305
void FVAutoTrace(FontViewBase * fv, int ask)
 
306
{
 
307
    (void) fv;
 
308
    (void) ask;
 
309
}
 
310
 
 
311
SplineFont *SFFromMF(char *filename)
 
312
{
 
313
    (void) filename;
 
314
    return NULL;
248
315
}
249
316
 
250
317
/* http.c */
251
318
 
252
 
FILE *URLToTempFile(char *url,void *_lock) {
253
 
  (void)_lock; (void)url;
254
 
   ff_post_error(_("Could not parse URL"),_("FontForge only handles ftp and http URLs at the moment"));
255
 
return( NULL );
 
319
FILE *URLToTempFile(char *url, void *_lock)
 
320
{
 
321
    (void) _lock;
 
322
    (void) url;
 
323
    ff_post_error(_("Could not parse URL"),
 
324
                  _("FontForge only handles ftp and http URLs at the moment"));
 
325
    return (NULL);
256
326
}