handle filesystems where lowercase(file)==file more gracefully
[swftools.git] / lib / as3 / common.c
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <stdarg.h>
4 #include "files.h"
5 #include "common.h"
6
7 int as3_pass = 0;
8 int as3_verbosity = 1;
9
10 void as3_error(const char*format, ...)
11 {
12     char buf[1024];
13     int l;
14     va_list arglist;
15     if(as3_verbosity<0)
16         exit(1);
17     va_start(arglist, format);
18     vsnprintf(buf, sizeof(buf)-1, format, arglist);
19     va_end(arglist);
20     fprintf(stderr, "%s:%d:%d: error: %s\n", current_filename, current_line, current_column, buf);
21     fprintf(stderr, "%s\n", current_filename_long);
22     fflush(stderr);
23     exit(1);
24 }
25 void as3_warning(const char*format, ...)
26 {
27     char buf[1024];
28     int l;
29     va_list arglist;
30     if(as3_verbosity<1)
31         return;
32     va_start(arglist, format);
33     vsnprintf(buf, sizeof(buf)-1, format, arglist);
34     va_end(arglist);
35     fprintf(stdout, "%s:%d:%d: warning: %s\n", current_filename, current_line, current_column, buf);
36     fflush(stdout);
37 }
38 void as3_softwarning(const char*format, ...)
39 {
40     char buf[1024];
41     int l;
42     va_list arglist;
43     if(as3_verbosity<2)
44         return;
45     va_start(arglist, format);
46     vsnprintf(buf, sizeof(buf)-1, format, arglist);
47     va_end(arglist);
48     fprintf(stderr, "%s:%d:%d: warning: %s\n", current_filename, current_line, current_column, buf);
49     fflush(stderr);
50 }