fixed bug in jpeg2000 decoding
[swftools.git] / lib / as3 / common.c
1 /* common.c
2
3    Routines for handling Flash2 AVM2 ABC Actionscript
4
5    Extension module for the rfxswf library.
6    Part of the swftools package.
7
8    Copyright (c) 2008,2009 Matthias Kramm <kramm@quiss.org>
9  
10    This program is free software; you can redistribute it and/or modify
11    it under the terms of the GNU General Public License as published by
12    the Free Software Foundation; either version 2 of the License, or
13    (at your option) any later version.
14
15    This program is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18    GNU General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
23
24 #include <stdlib.h>
25 #include <stdio.h>
26 #include <stdarg.h>
27 #include "files.h"
28 #include "common.h"
29
30 int as3_pass = 0;
31 int as3_verbosity = 1;
32
33 void as3_error(const char*format, ...)
34 {
35     char buf[1024];
36     int l;
37     va_list arglist;
38     if(as3_verbosity<0)
39         exit(1);
40     va_start(arglist, format);
41     vsnprintf(buf, sizeof(buf)-1, format, arglist);
42     va_end(arglist);
43     fprintf(stderr, "%s:%d:%d: error: %s\n", current_filename, current_line, current_column, buf);
44     fprintf(stderr, "%s\n", current_filename_long);
45     fflush(stderr);
46     exit(1);
47 }
48 void as3_warning(const char*format, ...)
49 {
50     char buf[1024];
51     int l;
52     va_list arglist;
53     if(as3_verbosity<1)
54         return;
55     va_start(arglist, format);
56     vsnprintf(buf, sizeof(buf)-1, format, arglist);
57     va_end(arglist);
58     fprintf(stdout, "%s:%d:%d: warning: %s\n", current_filename, current_line, current_column, buf);
59     fflush(stdout);
60 }
61 void as3_softwarning(const char*format, ...)
62 {
63     char buf[1024];
64     int l;
65     va_list arglist;
66     if(as3_verbosity<2)
67         return;
68     va_start(arglist, format);
69     vsnprintf(buf, sizeof(buf)-1, format, arglist);
70     va_end(arglist);
71     fprintf(stderr, "%s:%d:%d: warning: %s\n", current_filename, current_line, current_column, buf);
72     fflush(stderr);
73 }