trc checkpoint
authorThomas Walker Lynch <thomas.lynch@reasoningtechnology.com>
Mon, 1 Apr 2019 18:32:50 +0000 (20:32 +0200)
committerThomas Walker Lynch <thomas.lynch@reasoningtechnology.com>
Mon, 1 Apr 2019 18:32:50 +0000 (20:32 +0200)
module/share/lib/libda.a
module/tranche/src/tranche.lib.c
module/tranche/test/try/test2.sh
module/tranche/test/try/test2stdout.dat [deleted file]
module/tranche/test/try/test2stdout.dat.expected [new file with mode: 0644]
module/tranche/test/try/test3.out.expected
module/tranche/test/try/test4.out.expected
module/tranche/test/try/test5.sh
tool/bin/tranche
tool/bin/tranche-make
tool/bin/tranche-target

index 7e790c4..67e5e14 100644 (file)
Binary files a/module/share/lib/libda.a and b/module/share/lib/libda.a differ
index 71f2e33..a039723 100644 (file)
@@ -41,23 +41,27 @@ static char *is_tranche_end(char *pt){
   return pt + tranche_end_tag_len;
 }
 
-static void parse_file_list(Da *file_names, char *pt0, char *tdir){
+static void parse_file_list(Da *file_names, char *pt, char *tdir){
   Da filename_arr;
   Da *fn_arrp = &filename_arr;
   da_alloc(fn_arrp,sizeof(char));
 
-  while( *pt0 && isspace(*pt0) ) pt0++;
-  if(tdir){
-    da_string_push(fn_arrp, tdir);
-    da_push(fn_arrp, &slash);
-  }
-  while( *pt0 && !isspace(*pt0) ){
-    da_push(fn_arrp, *pt0);
+  while( *pt && isspace(*pt) ) pt++;
+  while( *pt ){
+    if(tdir){
+      da_string_push(fn_arrp, tdir);
+      da_push(fn_arrp, &slash);
+    }
+    while( *pt && !isspace(*pt) ){
+      da_push(fn_arrp, pt);
+      pt += fn_arrp->element_size;
+    }
+    da_push(fn_arrp, &terminator);
+    char *file_name = strdup(fn_arrp->base);
+    da_rewind(fn_arrp);
+    da_push(file_names, &file_name);
+    while( *pt && isspace(*pt) ) pt++;
   }
-  da_push(fn_arrp, &terminator);
-
-  char *file_name = strdup(*(char **)fn_arrp->base);
-  da_push(file_names, &file_name);
 }
 
 //--------------------------------------------------------------------------------
@@ -148,7 +152,7 @@ int tranche_target(FILE *src, Da *target_arrp, char *tdir){
       parse_file_list(&file_name_arr, pt, tdir);
       da_strings_set_union(target_arrp, &file_name_arr, free);
       da_rewind(&file_name_arr);
-      tranche_target(src, target_arrp);
+      tranche_target(src, target_arrp, tdir);
     }
     da_rewind(&line);
   }
@@ -179,7 +183,7 @@ void tranche_make(FILE *src_file, char *src_name, int mfile_fd, char *tdir){
   Da ta;
   Da *tap=&ta; // target array pointer
   da_alloc(tap, sizeof(char *));
-  tranche_target(src_file, tap);
+  tranche_target(src_file, tap, tdir);
 
   // construct then output the dependency line ----------------------------------------
   Da dla;
@@ -187,10 +191,6 @@ void tranche_make(FILE *src_file, char *src_name, int mfile_fd, char *tdir){
   da_alloc(dlap, sizeof(char));
   char *pt = tap->base; // char * because it points to a byte in the array
   while( pt < tap->end ){
-    if(tdir){
-      da_string_push(dlap, tdir);
-      da_push(dlap, &slash);
-    }
     da_string_push(dlap, *(char **)pt);
     da_push(dlap, &sp);
   pt += tap->element_size;
index 5959bbc..c5617a8 100644 (file)
@@ -3,6 +3,6 @@
 diff -q test2.c test2.c.expected
 diff -q test2.h test2.h.expected
 diff -q test2stdout.dat test2stdout.dat.expected
-rm test2.c test2.h test2stdout.dat.expected
+rm test2.c test2.h test2stdout.dat
 
 
diff --git a/module/tranche/test/try/test2stdout.dat b/module/tranche/test/try/test2stdout.dat
deleted file mode 100644 (file)
index 139597f..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/module/tranche/test/try/test2stdout.dat.expected b/module/tranche/test/try/test2stdout.dat.expected
new file mode 100644 (file)
index 0000000..139597f
--- /dev/null
@@ -0,0 +1,2 @@
+
+
index 8294b86..8bb7f8f 100644 (file)
@@ -2,4 +2,4 @@ test11.dat
 test12.dat
 test13.dat
 test14.dat
-test15.dat
+test15.dat
\ No newline at end of file
index 284d01e..b949f72 100644 (file)
@@ -1,4 +1,4 @@
-./tranche test1.dat test2.trc.c
+./tranche test1.dat test2.trc.c > /dev/null
 
 diff -q test11.dat test11.dat.expected
 diff -q test12.dat test12.dat.expected
index 5489419..ad95624 100755 (executable)
Binary files a/tool/bin/tranche and b/tool/bin/tranche differ
index 6ec278f..79dd3aa 100755 (executable)
Binary files a/tool/bin/tranche-make and b/tool/bin/tranche-make differ
index e315a2c..a79e844 100755 (executable)
Binary files a/tool/bin/tranche-target and b/tool/bin/tranche-target differ