Enlightenment CVS committal Author : dj2 Project : e17 Module : proto
Dir : e17/proto/edje_cc Modified Files: etcher_out.c main.c Log Message: add eet file output =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/edje_cc/etcher_out.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- etcher_out.c 12 Sep 2004 13:40:43 -0000 1.6 +++ etcher_out.c 14 Sep 2004 20:35:47 -0000 1.7 @@ -1,3 +1,4 @@ +#include <errno.h> #include <stdio.h> #include <stdarg.h> #include "Etcher.h" @@ -107,6 +108,39 @@ free(buf); } +int +etcher_eet_output(Etcher_File *etcher_file, char *path) +{ + static char tmpn[1024]; + int len = 0, fd = 0, ret = 0; + char *cmd = NULL; + + strcpy(tmpn, "/tmp/etcher_cc.edc-tmp-XXXXXX"); + fd = mkstemp(tmpn); + if (fd < 0) { + fprintf(stderr, "Unable to create tmp file: %s\n", strerror(errno)); + return 0; + } + close(fd); + + etcher_file_output(etcher_file, tmpn); + /* FIXME images and fonts ??? */ + + len = strlen(tmpn) + strlen(path) + 13; + cmd = (char *)calloc(len, sizeof(char)); + snprintf(cmd, len, "edje_cc -v %s %s", tmpn, path); + ret = system(cmd); + + if (ret < 0) { + fprintf(stderr, "Unable to execute edje_cc on tmp file: %s\n", + strerror(errno)); + return 0; + } + + unlink(tmpn); + return 1; +} + void etcher_file_output(Etcher_File *etcher_file, char *path) { =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/edje_cc/main.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- main.c 12 Sep 2004 06:02:35 -0000 1.8 +++ main.c 14 Sep 2004 20:35:47 -0000 1.9 @@ -13,6 +13,7 @@ int main(int argc, char ** argv) { + int output_type = 0; int c = 0, fd = 0; char *file = NULL; extern FILE *yyin; @@ -25,16 +26,21 @@ static struct option long_opts[] = { {"yydebug", no_argument, NULL, 'y'}, + {"eet", no_argument, NULL, 'e'}, {0, 0, 0, 0} }; yydebug = 0; - while((c = getopt_long(argc, argv, "y", long_opts, NULL)) != -1) { + while((c = getopt_long(argc, argv, "ey", long_opts, NULL)) != -1) { switch(c) { case 'y': yydebug = 1; break; + case 'e': + output_type = 1; + break; + default: printf("Unknown option\n"); break; @@ -167,14 +173,15 @@ return 0; } - free(file); - etcher_parse_init(); yyparse(); fclose(yyin); - etcher_file_output(etcher_file, "test.out"); + if (output_type) + etcher_eet_output(etcher_file, "test.eet"); + else + etcher_file_output(etcher_file, "test.out"); /* FIXME: make this a complete test suite */ #if 0 ------------------------------------------------------- This SF.Net email is sponsored by: thawte's Crypto Challenge Vl Crack the code and win a Sony DCRHC40 MiniDV Digital Handycam Camcorder. More prizes in the weekly Lunch Hour Challenge. Sign up NOW http://ad.doubleclick.net/clk;10740251;10262165;m _______________________________________________ enlightenment-cvs mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs