restructures independent src-da etc. src-da has a couple of tests, they pass
authorThomas Walker Lynch <thomas.lynch@reasoningtechnology.com>
Wed, 20 Mar 2019 22:46:24 +0000 (23:46 +0100)
committerThomas Walker Lynch <thomas.lynch@reasoningtechnology.com>
Wed, 20 Mar 2019 22:46:24 +0000 (23:46 +0100)
23 files changed:
src-da/0_makefile [new file with mode: 0644]
src-da/0_makefile-flags [new file with mode: 0644]
src-da/1_include/da.h [new file with mode: 0644]
src-da/1_tests/0_makefile [new file with mode: 0644]
src-da/1_tests/0_makefile-flags [new file with mode: 0644]
src-da/1_tests/1_tmp/da.lib.c [new file with mode: 0644]
src-da/1_tests/results [new file with mode: 0644]
src-da/1_tests/test_da.cli.c [new file with mode: 0644]
src-da/1_tests/test_da.lib.c [new file with mode: 0644]
src-da/1_tests/test_da.lib.h [new file with mode: 0644]
src-da/da.lib.c
src-da/da.lib.h [new file with mode: 0644]
src-db/0_makefile [new file with mode: 0644]
src-db/0_makefile-flags [new file with mode: 0644]
src-db/1_tmp/makefile_deps [new file with mode: 0644]
src-db/dbprintf.lib.h [new file with mode: 0644]
src-tranche/0_makefile [new file with mode: 0644]
src-tranche/0_makefile-flags [new file with mode: 0644]
src-tranche/tranche.c [new file with mode: 0644]
stage/include/da.h [new file with mode: 0644]
stage/lib/libda.a [new file with mode: 0644]
tools/lib/makefile_cc
tools/src/tranche.c [deleted file]

diff --git a/src-da/0_makefile b/src-da/0_makefile
new file mode 100644 (file)
index 0000000..4a9fffa
--- /dev/null
@@ -0,0 +1,20 @@
+# src-da/0_makefile
+
+SHELL=/bin/bash
+
+-include 0_makefile-flags
+
+MAKE=/usr/bin/make -f $(PROJECT_SUBU)/tools/lib/makefile_cc
+
+all: version deps lib execs
+
+lib:
+       $(MAKE) $@
+       cp da.lib.h 1_include/da.h
+
+%::
+       $(MAKE) $@
+
+
+
+
diff --git a/src-da/0_makefile-flags b/src-da/0_makefile-flags
new file mode 100644 (file)
index 0000000..89d12f1
--- /dev/null
@@ -0,0 +1,31 @@
+
+# some versions of Linux need a -e option others complain if there is a -e .. and it isn't the binary for echo ..
+ECHO= echo
+#ECHO= echo -e
+
+# directories used by this makefile, these could all be set to dot for
+# the simplest source directory structure
+
+#LIDBIR, EXECSDIR, HDIR hold the make results that might later be staged
+#$(PWD) is the directory that make was called from, this is already build in
+#set to dot to use the same directory as the source code
+#leave blank to ommit
+DEPRDIR=1_deprecated
+DOCDIR=1_doc
+EXECSDIR=1_execs
+INCDIR=1_include
+LIBDIR=1_lib
+TESTDIR=1_tests
+TMPDIR=1_tmp
+TOOLSDIR=$(realpath $(PROJECT_SUBU)/tools)
+TRYDIR=1_try
+
+
+# compiler and flags
+CC=gcc
+CFLAGS=-std=gnu11 -fPIC -I. -ggdb -Werror -DDEBUG -DDEBUGDB 
+#CFLAGS=-std=gnu11 -fPIC -I. -Werror
+LINKFLAGS=-L1_lib -lda 
+
+LIB_FILE=libda.a
+INC_FILE=da.h
diff --git a/src-da/1_include/da.h b/src-da/1_include/da.h
new file mode 100644 (file)
index 0000000..e6a3af2
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef DA_LIB_H
+#define DA_LIB_H
+#include <stdlib.h>
+#include <stdbool.h>
+#include <stdio.h>
+
+typedef struct Da{
+  char *base;
+  char *end; // one byte/one item off the end of the array
+  size_t size; // size >= (end - base) + 1;
+  size_t item_size;
+} Da;
+
+#define RETURN(dap, r)                      \
+  { da_map(dap, da_free, NULL); return r; }
+
+void da_alloc(Da *dap, size_t item_size);
+char *da_expand(Da *dap);
+void da_rebase(Da *dap, char *old_base, void *pta);
+bool da_endq(Da *dap, void *pt);
+bool da_boundq(Da *dap);
+void da_push(Da *dap, void *item);
+void da_map(Da *dap, void f(void *, void *), void *closure);
+void da_free(void *pt, void *closure);
+
+#endif
+
diff --git a/src-da/1_tests/0_makefile b/src-da/1_tests/0_makefile
new file mode 100644 (file)
index 0000000..18e886d
--- /dev/null
@@ -0,0 +1,16 @@
+# src-da/1_tests/0_makefile
+
+SHELL=/bin/bash
+
+-include 0_makefile-flags
+
+MAKE=/usr/bin/make -f $(PROJECT_SUBU)/tools/lib/makefile_cc
+
+all: version deps lib execs
+
+%::
+       $(MAKE) $@
+
+
+
+
diff --git a/src-da/1_tests/0_makefile-flags b/src-da/1_tests/0_makefile-flags
new file mode 100644 (file)
index 0000000..b00890c
--- /dev/null
@@ -0,0 +1,31 @@
+
+# some versions of Linux need a -e option others complain if there is a -e .. and it isn't the binary for echo ..
+ECHO= echo
+#ECHO= echo -e
+
+# directories used by this makefile, these could all be set to dot for
+# the simplest source directory structure
+
+#LIDBIR, EXECSDIR, HDIR hold the make results that might later be staged
+#$(PWD) is the directory that make was called from, this is already build in
+#set to dot to use the same directory as the source code
+#leave blank to ommit
+DEPRDIR=
+DOCDIR=
+EXECSDIR=.
+INCDIR=.
+LIBDIR=.
+TESTDIR=.
+TMPDIR=1_tmp
+TOOLSDIR=$(realpath $(PROJECT_SUBU)/tools)
+TRYDIR=
+
+
+# compiler and flags
+CC=gcc
+CFLAGS=-std=gnu11 -fPIC -I. -I../1_include -ggdb -Werror -DDEBUG -DDEBUGDB 
+#CFLAGS=-std=gnu11 -fPIC -I. -I../1_include -Werror
+LINKFLAGS=-L. -L../1_lib -ltests -lda
+
+LIB_FILE=libtests.a
+
diff --git a/src-da/1_tests/1_tmp/da.lib.c b/src-da/1_tests/1_tmp/da.lib.c
new file mode 100644 (file)
index 0000000..8704262
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+Tests for da.
+
+*/
+
+#include "da.h"
+#include "test_da.lib.h"
+#include <stdbool.h>
+
+int test_da_0(){
+  da da0;
+  da_alloc(&da0, sizeof(int)); // leaves room for 4 ints
+  int i = 0;
+  int *pt = da0->base;
+  // will double, 4 -> 8, then double 8 -> 16
+  while( i < 10 ){
+    if(da_boundq(&da0, pt)){
+      char *old_base = da_expand(&da);
+      da_rebase(&da, old_base, pt);
+    }
+    *pt = i;
+  i++;
+  pt++;
+  }
+
+  bool f0 = da.size == sizof(int) * 16;
+  bool f1 = 10 == (da.end - da.base) / sizeof(int);
+  bool f2 = true;
+  pt = da0->base;
+  while( i < 10 ){
+    f2 = f2 && *pt == i && !da_endq(&da, pt);
+  i++;
+  pt++;
+  }
+  bool f3 = da_endq(&da, pt);
+
+  return f0 && f1 && f2 && f3;
+}
+
+
diff --git a/src-da/1_tests/results b/src-da/1_tests/results
new file mode 100644 (file)
index 0000000..313ae95
--- /dev/null
@@ -0,0 +1 @@
+passed all 2 tests
diff --git a/src-da/1_tests/test_da.cli.c b/src-da/1_tests/test_da.cli.c
new file mode 100644 (file)
index 0000000..e69a73a
--- /dev/null
@@ -0,0 +1,35 @@
+
+#include <stdio.h>
+#include <stdbool.h>
+#include "test_da.lib.h"
+
+int main(){
+  bool da_0_passed = test_da_0();
+
+  unsigned int passed = 0;
+  unsigned int failed = 0;
+
+  if( !test_da_0() ){
+    failed++;
+    printf("test_da_0 failed\n");
+  }else
+    passed++;
+
+  if( !test_da_1() ){
+    failed++;
+    printf("test_da_1 failed\n");
+  }else
+    passed++;
+
+  if( passed == 0 && failed == 0)
+    printf("no tests ran\n");
+  else if( passed == 0 )
+    printf("failed all %u tests\n", failed);
+  else if( failed == 0 )
+    printf("passed all %u tests\n", passed);
+  else
+    printf("failed %u of %u tests\n", failed, passed + failed);
+
+  if( passed == 0 || failed != 0 ) return 1;
+  return 0;
+}
diff --git a/src-da/1_tests/test_da.lib.c b/src-da/1_tests/test_da.lib.c
new file mode 100644 (file)
index 0000000..490d6dd
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+Tests for Da.
+
+*/
+
+#include <stdbool.h>
+#include <da.h>
+
+#include "test_da.lib.h"
+
+
+int test_da_0(){
+  Da da;
+  da_alloc(&da, sizeof(int)); // leaves room for 4 ints
+  int i = 0;
+  int *pt = (int *)da.base;
+  // will double, 4 -> 8, then double 8 -> 16
+  while( i < 10 ){
+    da_push(&da, &i);
+  i++;
+  pt++;
+  }
+
+  bool f0 = da.size == sizeof(int) * 16;
+  bool f1 = 10 == (da.end - da.base) / sizeof(int);
+  bool f2 = true;
+  pt = (int *)da.base;
+  i = 0;
+  while( i < 10 ){
+    f2 = f2 && *pt == i && !da_endq(&da, pt);
+  i++;
+  pt++;
+  }
+  bool f3 = da_endq(&da, pt);
+
+  return f0 && f1 && f2 && f3;
+}
+
+int test_da_1(){
+  Da da;
+  da_alloc(&da, sizeof(int)); // leaves room for 4 ints
+  int i = 0;
+  int *pt = (int *)da.base;
+  // will double, 4 -> 8, then double 8 -> 16
+  while( i < 10 ){
+    da.end += da.item_size;
+    if( da_boundq(&da) ){
+      char *old_base = da_expand(&da);
+      da_rebase(&da, old_base, &pt);
+    }
+    *pt = i;
+  i++;
+  pt++;
+  }
+
+  bool f0 = da.size == sizeof(int) * 16;
+  bool f1 = 10 == (da.end - da.base) / sizeof(int);
+  bool f2 = true;
+  pt = (int *)da.base;
+  i = 0;
+  while( i < 10 ){
+    f2 = f2 && *pt == i && !da_endq(&da, pt);
+  i++;
+  pt++;
+  }
+  bool f3 = da_endq(&da, pt);
+
+  return f0 && f1 && f2 && f3;
+}
+
+
diff --git a/src-da/1_tests/test_da.lib.h b/src-da/1_tests/test_da.lib.h
new file mode 100644 (file)
index 0000000..3b8975e
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef DA_LIB_H
+#define DA_LIB_H
+
+int test_da_0();
+int test_da_1();
+
+#endif
index a6f163b..7ac3935 100644 (file)
@@ -5,10 +5,8 @@ Dynamic Array
 
 #include "da.lib.h"
 
-#if INTERFACE
 #include<stdlib.h>
 #include<stdbool.h>
-#endif
 #include<string.h>
 
 //--------------------------------------------------------------------------------
@@ -16,30 +14,21 @@ Dynamic Array
 // We manipulate pointers to a smallest addressable unit. The sizeof operator
 // returns counts in these addressable units. Sizeof(char) is defined to be 1.
 
-#if INTERFACE
-struct da{
-  char *base;
-  char *end; // one byte/one item off the end of the array
-  size_t size; // size >= (end - base) + 1;
-  size_t item_size;
-};
-#endif
-
-void da_alloc(da *dap, size_t item_size){
-  dap->size = 4 * item_size;
+void da_alloc(Da *dap, size_t item_size){
   dap->item_size = item_size;
-  dap->end = 0;
+  dap->size = 4 * item_size;
   dap->base = malloc(dap->size);
+  dap->end = dap->base;
 }
 
 // Doubles size of of da.  Returns old base, so that existing pointers into the
 // array can be moved to the new array
-char *da_expand(da *dap){
+char *da_expand(Da *dap){
   size_t end_offset = ((char *)dap->end - (char *)dap->base);
-  size_t new_size = dap->size << 1;
   char *old_base = dap->base;
+  size_t new_size = dap->size << 1;
   char *new_base = malloc( new_size );
-  memcpy( new_base, dap->base, end_offset + 1);
+  memcpy( new_base, old_base, end_offset + dap->item_size);
   free(old_base);
   dap->base = new_base;
   dap->end = new_base + end_offset;
@@ -47,24 +36,24 @@ char *da_expand(da *dap){
   return old_base;
 }
 
-void da_rebase(da *dap, char *old_base, void *pta){
+void da_rebase(Da *dap, char *old_base, void *pta){
   char **pt = (char **)pta;
   size_t offset = *pt - old_base;
   *pt = dap->base + offset;
 }
 
 // true when pt has run off the end of the area currently allocated for the array
-bool da_endq(da *dap, void *pt){
+bool da_endq(Da *dap, void *pt){
   return (char *)pt >= dap->end;
 }
 
 // true when pt has run off the end of the area allocated for the array
-bool da_boundq(da *dap, void *pt){
-  return (char *)pt >= dap->base + dap->size;
+bool da_boundq(Da *dap){
+  return dap->end >= dap->base + dap->size;
 }
 
-void da_push(da *dap, void *item){
-  if( dap->end + dap->item_size >= dap->base + dap->size ) da_expand(dap);
+void da_push(Da *dap, void *item){
+  if( dap->end >= dap->base + dap->size ) da_expand(dap);
   memcpy(dap->end, item, dap->item_size);
   dap->end += dap->item_size;
 }
@@ -72,7 +61,7 @@ void da_push(da *dap, void *item){
 // passed in f(item_pt, arg_pt)
 // We have no language support closures, so we pass in an argument for it.
 // The closure may be set to NULL if it is not needed.
-void da_map(da *dap, void f(void *, void *), void *closure){
+void da_map(Da *dap, void f(void *, void *), void *closure){
   char *pt = dap->base;
   while( pt != dap->end ){
     f(pt, closure);
@@ -85,8 +74,17 @@ void da_free(void *pt, void *closure){
   free(pt);
 }
 
-#if INTERFACE
-#define RETURN(dap, r)                      \
-  { da_map(dap, da_free, NULL); return r; }
-#endif
-  
+// Puts text from a line into buffer *dap. Does not push EOF or '\n' into the
+// buffer.  Returns the line terminator, which will either be EOF or '\n'.  This
+// will not work very well if the line gets very long, as da doubles in size at
+// buffer overrun. items_size for dap must be sizeof(char).
+int da_fgets(Da *dap, FILE *fd){
+  int c = fgetc(fd);
+  while( c != EOF && c != '\n' ){
+    da_push(dap, &c);
+  c = fgetc(fd);
+  }
+  int terminator = 0;
+  da_push(dap, &terminator);
+  return c;
+}
diff --git a/src-da/da.lib.h b/src-da/da.lib.h
new file mode 100644 (file)
index 0000000..e6a3af2
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef DA_LIB_H
+#define DA_LIB_H
+#include <stdlib.h>
+#include <stdbool.h>
+#include <stdio.h>
+
+typedef struct Da{
+  char *base;
+  char *end; // one byte/one item off the end of the array
+  size_t size; // size >= (end - base) + 1;
+  size_t item_size;
+} Da;
+
+#define RETURN(dap, r)                      \
+  { da_map(dap, da_free, NULL); return r; }
+
+void da_alloc(Da *dap, size_t item_size);
+char *da_expand(Da *dap);
+void da_rebase(Da *dap, char *old_base, void *pta);
+bool da_endq(Da *dap, void *pt);
+bool da_boundq(Da *dap);
+void da_push(Da *dap, void *item);
+void da_map(Da *dap, void f(void *, void *), void *closure);
+void da_free(void *pt, void *closure);
+
+#endif
+
diff --git a/src-db/0_makefile b/src-db/0_makefile
new file mode 100644 (file)
index 0000000..b8c7b9d
--- /dev/null
@@ -0,0 +1,40 @@
+# src/0_makefile
+
+SHELL=/bin/bash
+
+-include 0_makefile_flags
+
+SUID_TOOL=$(TOOLSDIR)/bin/setuid_root.sh
+MAKE=/usr/bin/make -f $(PROJECT_SUBU)/tools/lib/makefile_cc
+
+SOURCES=$(wildcard *.c)
+HFILES=$(wildcard *.h)
+
+all: version deps lib execs
+
+version:
+       $(MAKE) $@
+       @echo "SUID_TOOL: " $(SUID_TOOL)
+
+deps:
+       makeheaders $(SOURCES) $(HFILES)
+       sed -i '/^ *int *main *(.*)/d' *.h
+       $(MAKE) $@
+
+execs:
+       $(MAKE) $@
+       @echo "-> $(SUID_TOOL) $(EXECSDIR)/subu-mk-0 $(EXECSDIR)/subu-rm-0 $(EXECSDIR)/subu-bind-all"
+       cat $(SUID_TOOL)
+       @echo -n "Are you sure? [y/N] " && read ans && [ $${ans:-N} == y ]
+       sudo $(SUID_TOOL) $(EXECSDIR)/subu-mk-0 $(EXECSDIR)/subu-rm-0 $(EXECSDIR)/subu-bind-all
+
+clean:
+       $(MAKE) $@
+       for i in $(HFILES); do rm $$i; done
+
+%::
+       $(MAKE) $@
+
+
+
+
diff --git a/src-db/0_makefile-flags b/src-db/0_makefile-flags
new file mode 100644 (file)
index 0000000..c523d61
--- /dev/null
@@ -0,0 +1,31 @@
+
+# some versions of Linux need a -e option others complain if there is a -e .. and it isn't the binary for echo ..
+ECHO= echo
+#ECHO= echo -e
+
+# directories used by this makefile, these could all be set to dot for
+# the simplest source directory structure
+
+#LIDBIR, EXECSDIR, HDIR hold the make results that might later be staged
+#$(PWD) is the directory that make was called from, this is already build in
+#set to dot to use the same directory as the source code
+#leave blank to ommit
+DEPRDIR=1_deprecated
+DOCDIR=1_doc
+EXECSDIR=1_execs
+HDIR=1_headers
+LIBDIR=1_lib
+TESTDIR=1_tests
+TMPDIR=1_tmp
+TOOLSDIR=$(realpath $(PROJECT_SUBU)/tools)
+TRYDIR=1_try
+
+
+# compiler and flags
+CC=gcc
+CFLAGS=-std=gnu11 -fPIC -I. -ggdb -Werror -DDEBUG -DDEBUGDB 
+#CFLAGS=-std=gnu11 -fPIC -I. -Werror
+LINKFLAGS=-L1_lib -lsubu -lsqlite3
+
+LIB_FILE=$(LIBDIR)/libsubu.a
+
diff --git a/src-db/1_tmp/makefile_deps b/src-db/1_tmp/makefile_deps
new file mode 100644 (file)
index 0000000..8fa09cf
--- /dev/null
@@ -0,0 +1 @@
+dbprintf.lib.o: dbprintf.lib.c dbprintf.lib.h
diff --git a/src-db/dbprintf.lib.h b/src-db/dbprintf.lib.h
new file mode 100644 (file)
index 0000000..3056cf6
--- /dev/null
@@ -0,0 +1,3 @@
+/* \aThis file was automatically generated.  Do not edit! */
+#undef INTERFACE
+int dbprintf(const char *format,...);
diff --git a/src-tranche/0_makefile b/src-tranche/0_makefile
new file mode 100644 (file)
index 0000000..b8c7b9d
--- /dev/null
@@ -0,0 +1,40 @@
+# src/0_makefile
+
+SHELL=/bin/bash
+
+-include 0_makefile_flags
+
+SUID_TOOL=$(TOOLSDIR)/bin/setuid_root.sh
+MAKE=/usr/bin/make -f $(PROJECT_SUBU)/tools/lib/makefile_cc
+
+SOURCES=$(wildcard *.c)
+HFILES=$(wildcard *.h)
+
+all: version deps lib execs
+
+version:
+       $(MAKE) $@
+       @echo "SUID_TOOL: " $(SUID_TOOL)
+
+deps:
+       makeheaders $(SOURCES) $(HFILES)
+       sed -i '/^ *int *main *(.*)/d' *.h
+       $(MAKE) $@
+
+execs:
+       $(MAKE) $@
+       @echo "-> $(SUID_TOOL) $(EXECSDIR)/subu-mk-0 $(EXECSDIR)/subu-rm-0 $(EXECSDIR)/subu-bind-all"
+       cat $(SUID_TOOL)
+       @echo -n "Are you sure? [y/N] " && read ans && [ $${ans:-N} == y ]
+       sudo $(SUID_TOOL) $(EXECSDIR)/subu-mk-0 $(EXECSDIR)/subu-rm-0 $(EXECSDIR)/subu-bind-all
+
+clean:
+       $(MAKE) $@
+       for i in $(HFILES); do rm $$i; done
+
+%::
+       $(MAKE) $@
+
+
+
+
diff --git a/src-tranche/0_makefile-flags b/src-tranche/0_makefile-flags
new file mode 100644 (file)
index 0000000..c523d61
--- /dev/null
@@ -0,0 +1,31 @@
+
+# some versions of Linux need a -e option others complain if there is a -e .. and it isn't the binary for echo ..
+ECHO= echo
+#ECHO= echo -e
+
+# directories used by this makefile, these could all be set to dot for
+# the simplest source directory structure
+
+#LIDBIR, EXECSDIR, HDIR hold the make results that might later be staged
+#$(PWD) is the directory that make was called from, this is already build in
+#set to dot to use the same directory as the source code
+#leave blank to ommit
+DEPRDIR=1_deprecated
+DOCDIR=1_doc
+EXECSDIR=1_execs
+HDIR=1_headers
+LIBDIR=1_lib
+TESTDIR=1_tests
+TMPDIR=1_tmp
+TOOLSDIR=$(realpath $(PROJECT_SUBU)/tools)
+TRYDIR=1_try
+
+
+# compiler and flags
+CC=gcc
+CFLAGS=-std=gnu11 -fPIC -I. -ggdb -Werror -DDEBUG -DDEBUGDB 
+#CFLAGS=-std=gnu11 -fPIC -I. -Werror
+LINKFLAGS=-L1_lib -lsubu -lsqlite3
+
+LIB_FILE=$(LIBDIR)/libsubu.a
+
diff --git a/src-tranche/tranche.c b/src-tranche/tranche.c
new file mode 100644 (file)
index 0000000..b61cf26
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+The purpose of this tools is to facilitate putting prototypes (declarations) next
+to implementations (definitions) in a single source file of a C/C++ programs. 
+
+Splits a single source file into multiple files.  Scans through the single
+source file looking for lines of the form:
+
+  #tranche filename ...
+
+With the # mandatory at column 1 (like the old C preprocessor).  Upon finding
+such a line, copies all following lines into the listed files, until reaching the
+end marker:
+
+  #endtranche
+
+A next improvement of this file would be to support variables to be passed in,
+as per a make file.
+
+*/
+
+
+void tranche(FILE *file){
+
+
+
+}
diff --git a/stage/include/da.h b/stage/include/da.h
new file mode 100644 (file)
index 0000000..e6a3af2
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef DA_LIB_H
+#define DA_LIB_H
+#include <stdlib.h>
+#include <stdbool.h>
+#include <stdio.h>
+
+typedef struct Da{
+  char *base;
+  char *end; // one byte/one item off the end of the array
+  size_t size; // size >= (end - base) + 1;
+  size_t item_size;
+} Da;
+
+#define RETURN(dap, r)                      \
+  { da_map(dap, da_free, NULL); return r; }
+
+void da_alloc(Da *dap, size_t item_size);
+char *da_expand(Da *dap);
+void da_rebase(Da *dap, char *old_base, void *pta);
+bool da_endq(Da *dap, void *pt);
+bool da_boundq(Da *dap);
+void da_push(Da *dap, void *item);
+void da_map(Da *dap, void f(void *, void *), void *closure);
+void da_free(void *pt, void *closure);
+
+#endif
+
diff --git a/stage/lib/libda.a b/stage/lib/libda.a
new file mode 100644 (file)
index 0000000..2b84557
Binary files /dev/null and b/stage/lib/libda.a differ
index b4c26f7..a52f36b 100755 (executable)
@@ -1,7 +1,7 @@
 
 SHELL=/bin/bash
 
--include 0_makefile_flags
+-include 0_makefile-flags
 
 DEPS_FILE=$(TMPDIR)/makefile_deps
 
@@ -41,7 +41,7 @@ info:
        @echo "DEPDIR: " $(DEPDIR)
        @echo "DOCDIR: " $(DOCDIR)
        @echo "EXECSDIR: " $(EXECSDIR)
-       @echo "HDIR: " $(HDIR)
+       @echo "INCDIR: " $(INCDIR)
        @echo "LIBDIR: " $(LIBDIR)
        @echo "TESTDIR: " $(TESTDIR)
        @echo "TMPDIR: " $(TMPDIR)
@@ -66,7 +66,7 @@ setup:
        if [ ! -e $(DEPRDIR) ]; then mkdir $(DEPRDIR); fi
        if [ ! -e $(DOCDIR) ]; then mkdir $(DOCDIR); fi
        if [ ! -e $(EXECSDIR) ]; then mkdir $(EXECSDIR); fi
-       if [ ! -e $(HDIR) ]; then mkdir $(HDIR); fi
+       if [ ! -e $(INCDIR) ]; then mkdir $(INCDIR); fi
        if [ ! -e $(LIBDIR) ]; then mkdir $(LIBDIR); fi
        if [ ! -e $(TESTDIR) ]; then mkdir $(TESTDIR); fi
        if [ ! -e $(TMPDIR) ]; then mkdir $(TMPDIR); fi
@@ -79,7 +79,7 @@ deps:
        $(CC) $(CFLAGS) -MM $(SOURCES) 1> $(DEPS_FILE)
        for i in $(EXECS) ; do\
            $(ECHO) >> $(DEPS_FILE);\
-           $(ECHO) "$(EXECSDIR)/$$i : $$i.cli.o $(LIB_FILE)" >> $(DEPS_FILE);\
+           $(ECHO) "$(EXECSDIR)/$$i : $$i.cli.o $(LIBDIR)/$(LIB_FILE)" >> $(DEPS_FILE);\
            $(ECHO) "   $(CC) -o $(EXECSDIR)/$$i $$i.cli.o $(LINKFLAGS)" >> $(DEPS_FILE);\
         done
        @echo '______end make $@_____'
@@ -91,10 +91,10 @@ lib:
        make sub_lib
        @echo '______end make $@_____'
 
-sub_lib: $(LIB_FILE)
+sub_lib: $(LIBDIR)/$(LIB_FILE)
 
 
-execs: $(LIB_FILE)
+execs: $(LIBDIR)/$(LIB_FILE)
        @echo '---- make $@:------------------------------------------------------------'
        @echo `pwd`'>' 
        if [ ! -e $(DEPS_FILE) ]; then make deps; fi
@@ -103,13 +103,17 @@ execs: $(LIB_FILE)
 
 sub_execs: $(patsubst %,  $(EXECSDIR)/%, $(EXECS))
 
+stage:
+       if [ -f $(LBIDIR)/$(LIBFILE) ]; then cp $(LIBDIR)/$(LIBFILE) $(PROJECT_SUBU)/stage/lib; fi
+       if [ -f $(INCDIR)/$(INC_FILE) ]; then cp $(INCDIR)/$(INC_FILE) $(PROJECT_SUBU)/stage/include; fi
+
 clean:
        @echo '---- make $@:------------------------------------------------------------'
        @echo `pwd`'>' 
        for i in $(wildcard *~); do mv $$i $(TMPDIR); done
        for i in $(wildcard *.lib.o) $(wildcard *.cli.o); do rm $$i; done 
        for i in $(EXECS); do if [ -e $(EXECSDIR)/$$i ]; then rm $(EXECSDIR)/$$i; fi; done 
-       if [ -f $(LIB_FILE) ]; then rm $(LIB_FILE); fi
+       if [ -f $(LIBDIR)/$(LIB_FILE) ]; then rm $(LIBDIR)/$(LIB_FILE); fi
        if [ -f $(DEPS_FILE) ]; then rm $(DEPS_FILE); fi
        @echo '______end make $@_____'
 
@@ -122,8 +126,8 @@ dist-clean:
        @echo '______end make $@_____'
 
 #
-$(LIB_FILE) : $(OBJECTS_LIB)
-       ar rcs $(LIB_FILE) $(OBJECTS_LIB)
+$(LIBDIR)/$(LIB_FILE) : $(OBJECTS_LIB)
+       ar rcs $(LIBDIR)/$(LIB_FILE) $(OBJECTS_LIB)
 
 -include $(DEPS_FILE)
 
diff --git a/tools/src/tranche.c b/tools/src/tranche.c
deleted file mode 100644 (file)
index 3241584..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
-looks for 
-
-#tranche filename ...
-
-Starting at column 1 of each line.  Upon finding that, it copies all following lines
-into filename, until reaching a line that has:
-
-#endtranche
-
-
-*/