static int verbose = 2;
static int override_outputname = 0;
-static struct options_t options[] =
-{
- {"o","output"},
- {"v","verbose"},
- {"V","version"},
- {0,0}
+static struct options_t options[] = {
+{"h", "help"},
+{"V", "version"},
+{"v", "verbose"},
+{"o", "output"},
+{0,0}
};
int args_callback_option(char*name,char*val)
{
return args_long2shortoption(options, name, val);
}
-void args_callback_usage(char*name)
+void args_callback_usage(char *name)
{
- printf("Usage: %s [-o filename] file.sc\n", name);
- printf("\t-v , --verbose\t\t\t Be more verbose\n");
- printf("\t-o , --output filename\t\t set output filename (default: output.swf)\n");
- printf("\t-V , --version\t\t\t Print program version and exit\n");
+ printf("\n");
+ printf("Usage: %s [-o file.swf] file.sc\n", name);
+ printf("\n");
+ printf("-h , --help Print short help message and exit\n");
+ printf("-V , --version Print version info and exit\n");
+ printf("-v , --verbose Increase verbosity. \n");
+ printf("-o , --output <filename> Set output file to <filename>.\n");
+ printf("\n");
}
int args_callback_command(char*name,char*val)
{
va_end(arglist);
printf("\"%s\", line %d column %d: warning- %s\n", filename, line, column, buf);
}
-
+
static void readToken()
{
type = file[pos].type;
void s_font(char*name, char*filename)
{
- int f;
- SWF swf;
SWFFONT* font;
font = swf_LoadFont(filename);
-
- /*f = open(filename,O_RDONLY|O_BINARY);
- if (f<0) {
- warning("Couldn't open file \"%s\": %s", filename, strerror(errno));
+
+ if(font == 0) {
+ warning("Couldn't open font file \"%s\"", filename);
font = (SWFFONT*)malloc(sizeof(SWFFONT));
memset(font, 0, sizeof(SWFFONT));
dictionary_put2(&fonts, name, font);
return;
}
- font = 0;
- if (swf_ReadSWF(f,&swf)>=0) {
- swf_FontExtract(&swf, 0x4e46, &font);
- swf_FreeTags(&swf);
- }
- close(f);
- if (font==0) {
- syntaxerror("File \"%s\" isn't a valid rfxswf font file", filename);
- }*/
if(0)
{
memset(&gradient, 0, sizeof(GRADIENT));
while(*p) {
char*posstr,*colorstr;
+ float pos;
+ RGBA color;
posstr = gradient_getToken(&p);
if(!*posstr)
break;
- float pos = parsePercent(posstr);
+ pos = parsePercent(posstr);
if(!*p) syntaxerror("Error in shape data: Color expected after %s", posstr);
colorstr = gradient_getToken(&p);
- RGBA color = parseColor(colorstr);
+ color = parseColor(colorstr);
if(gradient.num == sizeof(gradient.ratios)/sizeof(gradient.ratios[0])) {
warning("gradient record too big- max size is 8, rest ignored");
break;
int type=0;
char* font;
char* text;
- char* outline;
+ char* outline=0;
RGBA fill;
if(!strcmp(command, "circle"))
type = 1;
static int c_egon(map_t*args) {return fakechar(args);}
static int c_button(map_t*args) {
+ char*action = "";
readToken();
- if(type != RAWDATA)
- syntaxerror("colon (:) expected");
+ if(type == RAWDATA)
+ action = text;
+ else
+ pushBack();
return fakechar(args);
}
int t;
map_t args;
int nr = -1;
+ msg("<verbose> parse Command: %s (line %d)", command, line);
for(t=0;t<sizeof(arguments)/sizeof(arguments[0]);t++) {
if(!strcmp(arguments[t].command, command)) {
args_callback_usage(argv[0]);
exit(1);
}
+
file = generateTokens(filename);
if(!file) {
printf("parser returned error.\n");