Enlightenment CVS committal Author : davemds Project : e17 Module : proto
Dir : e17/proto/edje_editor/src/bin Modified Files: main.c parse.c Log Message: Run the input file through the C pre-processor. =================================================================== RCS file: /cvs/e/e17/proto/edje_editor/src/bin/main.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- main.c 30 Dec 2006 09:59:09 -0000 1.2 +++ main.c 31 Dec 2006 20:25:37 -0000 1.3 @@ -333,10 +333,46 @@ gchar* EDCClear; GList* p; gint i=0,j=0; - if (!g_file_get_contents (EDCfile,&EDC,&lenght, NULL)){ + char buf[4096]; + char tmpn[4096]; + int fd,ret; + + /* + * Run the input through the C pre-processor. + * + * On some BSD based systems (MacOS, OpenBSD), the default cpp + * in the path is a wrapper script that chokes on the -o option. + * If the preprocessor is invoked via gcc -E, it will treat + * file_in as a linker file. The safest route seems to be to + * run cpp with the output as the second non-option argument. + * + * Redirecting the output is required for MacOS 10.3, and works fine + * on other systems. + */ + //create tmp file + strcpy(tmpn, "/tmp/edje_editor-tmp-XXXXXX"); + fd = mkstemp(tmpn); + if (!fd) return 0; + close(fd); + printf("tmp file: %s\n",tmpn); + + //Run the input through the C pre-processor. + snprintf(buf, sizeof(buf), "cat %s | cpp -I/home/dave/test/default > %s",EDCfile, tmpn); + ret = system(buf); + if (ret < 0){ + snprintf(buf, sizeof(buf), "gcc -E -o %s %s", tmpn, EDCfile); + ret = system(buf); + } + if (ret != EXIT_SUCCESS) return 0; + printf("Preprocess Complete\n"); + + + //Read preprocessed file + if (!g_file_get_contents (tmpn,&EDC,&lenght, NULL)){ printf("Error reading edc file: %s\n",EDCfile); return FALSE; } + unlink(tmpn); /* Remove all comments and blanks*/ EDCClear = malloc((int)lenght); while (i<=(int)lenght){ @@ -370,6 +406,7 @@ //printf("%s\n+++\n",EDCClear); //ParseImages(EDCClear); GetGroupsTag(EDCClear); + p=EDC_Group_list; while (p){ ParsePartsFromGroup(p->data); =================================================================== RCS file: /cvs/e/e17/proto/edje_editor/src/bin/parse.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- parse.c 30 Dec 2006 09:59:09 -0000 1.2 +++ parse.c 31 Dec 2006 20:25:37 -0000 1.3 @@ -139,8 +139,8 @@ gchar* start=NULL; gchar* end=NULL; GString* tmp; - - //printf("Get Parts:\n%s",edc); + // int i=0; + //printf("Get Parts:%s\n",edc); //Search collections section and check brackets integrity if (!(start = strstr(edc,"collections{"))){ @@ -155,6 +155,7 @@ start = start+5; //Skip group word end = SearchMatchingBra(start); tmp = g_string_new_len(start+1,(end-start)-2); + //printf("NEW_GROUP %d\n",i++); group = EDC_Group_new("new",0,0,0,0); g_string_printf(group->complete_tag,"%s",tmp->str); ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs