Move modules to ccan/ tools to tools/
authorRusty Russell <rusty@vivaldi>
Mon, 2 Jun 2008 02:39:51 +0000 (12:39 +1000)
committerRusty Russell <rusty@vivaldi>
Mon, 2 Jun 2008 02:39:51 +0000 (12:39 +1000)
Requires minor fixups.  "depends" now prefixes ccan/ (allows for
non-ccan deps later).

75 files changed:
Makefile
README
ccan/alignof/_info.c [moved from alignof/_info.c with 96% similarity]
ccan/alignof/alignof.h [moved from alignof/alignof.h with 100% similarity]
ccan/alignof/test/run.c [moved from alignof/test/run.c with 100% similarity]
ccan/alloc/_info.c [moved from alloc/_info.c with 98% similarity]
ccan/alloc/alloc.c [moved from alloc/alloc.c with 100% similarity]
ccan/alloc/alloc.h [moved from alloc/alloc.h with 100% similarity]
ccan/alloc/test/run.c [moved from alloc/test/run.c with 100% similarity]
ccan/build_assert/_info.c [moved from build_assert/_info.c with 100% similarity]
ccan/build_assert/build_assert.h [moved from build_assert/build_assert.h with 100% similarity]
ccan/build_assert/test/compile_fail-expr.c [moved from build_assert/test/compile_fail-expr.c with 100% similarity]
ccan/build_assert/test/compile_fail.c [moved from build_assert/test/compile_fail.c with 100% similarity]
ccan/build_assert/test/compile_ok.c [moved from build_assert/test/compile_ok.c with 100% similarity]
ccan/build_assert/test/run-EXPR_BUILD_ASSERT.c [moved from build_assert/test/run-EXPR_BUILD_ASSERT.c with 100% similarity]
ccan/check_type/_info.c [moved from check_type/_info.c with 95% similarity]
ccan/check_type/check_type.h [moved from check_type/check_type.h with 100% similarity]
ccan/check_type/test/compile_fail-check_type.c [moved from check_type/test/compile_fail-check_type.c with 100% similarity]
ccan/check_type/test/compile_fail-check_type_unsigned.c [moved from check_type/test/compile_fail-check_type_unsigned.c with 100% similarity]
ccan/check_type/test/compile_fail-check_types_match.c [moved from check_type/test/compile_fail-check_types_match.c with 100% similarity]
ccan/check_type/test/run.c [moved from check_type/test/run.c with 100% similarity]
ccan/container_of/_info.c [moved from container_of/_info.c with 97% similarity]
ccan/container_of/container_of.h [moved from container_of/container_of.h with 100% similarity]
ccan/container_of/test/compile_fail-bad-type.c [moved from container_of/test/compile_fail-bad-type.c with 100% similarity]
ccan/container_of/test/compile_fail-types.c [moved from container_of/test/compile_fail-types.c with 100% similarity]
ccan/container_of/test/compile_fail-var-types.c [moved from container_of/test/compile_fail-var-types.c with 100% similarity]
ccan/container_of/test/run.c [moved from container_of/test/run.c with 100% similarity]
ccan/list/_info.c [moved from list/_info.c with 97% similarity]
ccan/list/list.c [moved from list/list.c with 100% similarity]
ccan/list/list.h [moved from list/list.h with 100% similarity]
ccan/list/test/run.c [moved from list/test/run.c with 100% similarity]
ccan/noerr/_info.c [moved from noerr/_info.c with 100% similarity]
ccan/noerr/noerr.c [moved from noerr/noerr.c with 100% similarity]
ccan/noerr/noerr.h [moved from noerr/noerr.h with 100% similarity]
ccan/noerr/test/run.c [moved from noerr/test/run.c with 100% similarity]
ccan/string/_info.c [moved from string/_info.c with 95% similarity]
ccan/string/string.h [moved from string/string.h with 100% similarity]
ccan/string/test/run.c [moved from string/test/run.c with 100% similarity]
ccan/talloc/TODO [moved from talloc/TODO with 100% similarity]
ccan/talloc/_info.c [moved from talloc/_info.c with 98% similarity]
ccan/talloc/talloc.3.xml [moved from talloc/talloc.3.xml with 100% similarity]
ccan/talloc/talloc.c [moved from talloc/talloc.c with 100% similarity]
ccan/talloc/talloc.h [moved from talloc/talloc.h with 99% similarity]
ccan/talloc/test/run.c [moved from talloc/test/run.c with 100% similarity]
ccan/tap/_info.c [moved from tap/_info.c with 96% similarity]
ccan/tap/tap.3 [moved from tap/tap.3 with 100% similarity]
ccan/tap/tap.c [moved from tap/tap.c with 100% similarity]
ccan/tap/tap.h [moved from tap/tap.h with 100% similarity]
ccan/tap/test/run.c [moved from tap/test/run.c with 80% similarity]
ccan/typesafe_cb/_info.c [moved from typesafe_cb/_info.c with 100% similarity]
ccan/typesafe_cb/test/compile_fail-cast_if_type.c [moved from typesafe_cb/test/compile_fail-cast_if_type.c with 100% similarity]
ccan/typesafe_cb/test/compile_fail-typesafe_cb-int.c [moved from typesafe_cb/test/compile_fail-typesafe_cb-int.c with 100% similarity]
ccan/typesafe_cb/test/compile_fail-typesafe_cb.c [moved from typesafe_cb/test/compile_fail-typesafe_cb.c with 100% similarity]
ccan/typesafe_cb/test/compile_fail-typesafe_cb_postargs.c [moved from typesafe_cb/test/compile_fail-typesafe_cb_postargs.c with 100% similarity]
ccan/typesafe_cb/test/compile_fail-typesafe_cb_preargs.c [moved from typesafe_cb/test/compile_fail-typesafe_cb_preargs.c with 100% similarity]
ccan/typesafe_cb/test/run.c [moved from typesafe_cb/test/run.c with 100% similarity]
ccan/typesafe_cb/typesafe_cb.h [moved from typesafe_cb/typesafe_cb.h with 100% similarity]
ccan_tools/Makefile [deleted file]
ccan_tools/ccanlint/Makefile [deleted file]
tools/Makefile [new file with mode: 0644]
tools/ccanlint/Makefile [new file with mode: 0644]
tools/ccanlint/ccanlint.c [moved from ccan_tools/ccanlint/ccanlint.c with 100% similarity]
tools/ccanlint/ccanlint.h [moved from ccan_tools/ccanlint/ccanlint.h with 100% similarity]
tools/ccanlint/file_analysis.c [moved from ccan_tools/ccanlint/file_analysis.c with 100% similarity]
tools/ccanlint/get_file_lines.c [moved from ccan_tools/ccanlint/get_file_lines.c with 100% similarity]
tools/ccanlint/get_file_lines.h [moved from ccan_tools/ccanlint/get_file_lines.h with 100% similarity]
tools/ccanlint/has_main_header.c [moved from ccan_tools/ccanlint/has_main_header.c with 100% similarity]
tools/ccanlint/has_tests.c [moved from ccan_tools/ccanlint/has_tests.c with 100% similarity]
tools/ccanlint/idempotent.c [moved from ccan_tools/ccanlint/idempotent.c with 100% similarity]
tools/ccanlint/no_info.c [moved from ccan_tools/ccanlint/no_info.c with 100% similarity]
tools/ccanlint/trailing_whitespace.c [moved from ccan_tools/ccanlint/trailing_whitespace.c with 100% similarity]
tools/doc_extract.c [moved from ccan_tools/doc_extract.c with 100% similarity]
tools/namespacize.c [moved from ccan_tools/namespacize.c with 100% similarity]
tools/run_tests.c [moved from ccan_tools/run_tests.c with 96% similarity]
tools/test_all.sh [moved from ccan_tools/test_all.sh with 100% similarity]

index 76b79e3..b60874d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,9 @@
 # Hacky makefile to compile everything and run the tests in some kind of sane order.
 # V=--verbose for verbose tests.
 
-CFLAGS=-O3 -Wall -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Werror -I.
+CFLAGS=-O3 -Wall -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Werror -Iccan -I.
 
-ALL=$(patsubst %/test, %, $(wildcard */test))
+ALL=$(patsubst ccan/%/test, ccan/%, $(wildcard ccan/*/test))
 ALL_DEPENDS=$(patsubst %, %/.depends, $(ALL))
 
 test-all: $(ALL_DEPENDS)
@@ -16,13 +16,13 @@ distclean: clean
 $(ALL_DEPENDS): %/.depends: %/_info
        @$< depends > $@ || ( rm -f $@; exit 1 )
 
-test-%: ccan_tools/run_tests
+test-ccan/%: tools/run_tests
        @echo Testing $*...
-       @if ccan_tools/run_tests $(V) $* | grep ^'not ok'; then exit 1; else exit 0; fi
+       @if tools/run_tests $(V) ccan/$* | grep ^'not ok'; then exit 1; else exit 0; fi
 
-ccanlint: ccan_tools/ccanlint/ccanlint
+ccanlint: tools/ccanlint/ccanlint
 
-clean: ccan_tools-clean
-       rm -f `find . -name '*.o'`
+clean: tools-clean
+       rm -f `find . -name '*.o'` `find . -name '.depends'`
 
-include ccan_tools/Makefile
+include tools/Makefile
diff --git a/README b/README
index 65bb853..9019fbb 100644 (file)
--- a/README
+++ b/README
@@ -1,8 +1,8 @@
-ccan_tools:
+tools:
        This is currently a bootstrap junkyard for ccan tools.
 
        It is expected that some of this code, being generally useful, will be
        shuffled out to their own modules over time.
 
-other:
+ccan:
        The beginnings of a ccan repository.
similarity index 96%
rename from alignof/_info.c
rename to ccan/alignof/_info.c
index b5afa02..4cccba3 100644 (file)
@@ -37,7 +37,7 @@ int main(int argc, char *argv[])
                return 1;
 
        if (strcmp(argv[1], "depends") == 0) {
-               printf("build_assert\n");
+               printf("ccan/build_assert\n");
                return 0;
        }
 
similarity index 100%
rename from alignof/alignof.h
rename to ccan/alignof/alignof.h
similarity index 100%
rename from alignof/test/run.c
rename to ccan/alignof/test/run.c
similarity index 98%
rename from alloc/_info.c
rename to ccan/alloc/_info.c
index 59a6638..03e20af 100644 (file)
@@ -95,7 +95,7 @@ int main(int argc, char *argv[])
                return 1;
 
        if (strcmp(argv[1], "depends") == 0) {
-               printf("build_assert\n");
+               printf("ccan/build_assert\n");
                return 0;
        }
 
similarity index 100%
rename from alloc/alloc.c
rename to ccan/alloc/alloc.c
similarity index 100%
rename from alloc/alloc.h
rename to ccan/alloc/alloc.h
similarity index 100%
rename from alloc/test/run.c
rename to ccan/alloc/test/run.c
similarity index 95%
rename from check_type/_info.c
rename to ccan/check_type/_info.c
index 06e90eb..176e445 100644 (file)
@@ -21,7 +21,7 @@ int main(int argc, char *argv[])
 
        if (strcmp(argv[1], "depends") == 0) {
 #if !HAVE_TYPEOF
-               printf("build_assert\n");
+               printf("ccan/build_assert\n");
 #endif
                return 0;
        }
similarity index 97%
rename from container_of/_info.c
rename to ccan/container_of/_info.c
index 7705e38..96c12d8 100644 (file)
@@ -39,7 +39,7 @@ int main(int argc, char *argv[])
                return 1;
 
        if (strcmp(argv[1], "depends") == 0) {
-               printf("check_type\n");
+               printf("ccan/check_type\n");
                return 0;
        }
 
similarity index 97%
rename from list/_info.c
rename to ccan/list/_info.c
index 0402b49..dc3c3e6 100644 (file)
@@ -55,7 +55,7 @@ int main(int argc, char *argv[])
                return 1;
 
        if (strcmp(argv[1], "depends") == 0) {
-               printf("container_of\n");
+               printf("ccan/container_of\n");
                return 0;
        }
 
similarity index 100%
rename from list/list.c
rename to ccan/list/list.c
similarity index 100%
rename from list/list.h
rename to ccan/list/list.h
similarity index 100%
rename from list/test/run.c
rename to ccan/list/test/run.c
similarity index 100%
rename from noerr/_info.c
rename to ccan/noerr/_info.c
similarity index 100%
rename from noerr/noerr.c
rename to ccan/noerr/noerr.c
similarity index 100%
rename from noerr/noerr.h
rename to ccan/noerr/noerr.h
similarity index 100%
rename from noerr/test/run.c
rename to ccan/noerr/test/run.c
similarity index 95%
rename from string/_info.c
rename to ccan/string/_info.c
index 2d1709f..9cb691c 100644 (file)
@@ -9,7 +9,7 @@
  * the standard string.h.
  *
  * Example:
- *     #include "ccan/string.h"
+ *     #include "string/string.h"
  *
  *     int main(int argc, char *argv[])
  *     {
similarity index 100%
rename from string/string.h
rename to ccan/string/string.h
similarity index 100%
rename from string/test/run.c
rename to ccan/string/test/run.c
similarity index 100%
rename from talloc/TODO
rename to ccan/talloc/TODO
similarity index 98%
rename from talloc/_info.c
rename to ccan/talloc/_info.c
index 18da417..bc48736 100644 (file)
@@ -95,7 +95,7 @@ int main(int argc, char *argv[])
                return 1;
 
        if (strcmp(argv[1], "depends") == 0) {
-               printf("typesafe_cb\n");
+               printf("ccan/typesafe_cb\n");
                return 0;
        }
 
similarity index 100%
rename from talloc/talloc.3.xml
rename to ccan/talloc/talloc.3.xml
similarity index 100%
rename from talloc/talloc.c
rename to ccan/talloc/talloc.c
similarity index 99%
rename from talloc/talloc.h
rename to ccan/talloc/talloc.h
index 5566a04..7da8d97 100644 (file)
@@ -27,7 +27,7 @@
 #include <stdio.h>
 #include <stdarg.h>
 #include "config.h"
-#include "typesafe_cb/typesafe_cb.h"
+#include "ccan/typesafe_cb/typesafe_cb.h"
 
 /*
   this uses a little trick to allow __LINE__ to be stringified
similarity index 100%
rename from talloc/test/run.c
rename to ccan/talloc/test/run.c
similarity index 96%
rename from tap/_info.c
rename to ccan/tap/_info.c
index 7f415a2..2e62891 100644 (file)
@@ -51,8 +51,5 @@ int main(int argc, char *argv[])
        if (strcmp(argv[1], "depends") == 0)
                return 0;
 
-       if (strcmp(argv[1], "license") == 0)
-               return "BSD";
-
        return 1;
 }
similarity index 100%
rename from tap/tap.3
rename to ccan/tap/tap.3
similarity index 100%
rename from tap/tap.c
rename to ccan/tap/tap.c
similarity index 100%
rename from tap/tap.h
rename to ccan/tap/tap.h
similarity index 80%
rename from tap/test/run.c
rename to ccan/tap/test/run.c
index 97af45c..2f718cc 100644 (file)
@@ -11,6 +11,7 @@
 #include <stdlib.h>
 #include <limits.h>
 #include <stdbool.h>
+#include <fnmatch.h>
 
 /* We dup stderr to here. */
 static int stderrfd;
@@ -32,18 +33,18 @@ static void failmsg(const char *fmt, ...)
        _exit(1);
 }
 
-static void expect(int fd, const char *str)
+static void expect(int fd, const char *pattern)
 {
-       char buffer[PIPE_BUF];
+       char buffer[PIPE_BUF+1];
        int r;
 
-       r = read(fd, buffer, sizeof(buffer));
+       r = read(fd, buffer, sizeof(buffer)-1);
        if (r < 0)
                failmsg("reading from pipe");
+       buffer[r] = '\0';
 
-       if (strlen(str) != r || strncmp(str, buffer, r) != 0)
-               failmsg("Expected '%s' got '%.*s'",
-                       str, r, buffer);
+       if (fnmatch(pattern, buffer, 0) != 0)
+               failmsg("Expected '%s' got '%s'", pattern, buffer);
 }
 
 int main(int argc, char *argv[])
@@ -75,21 +76,21 @@ int main(int argc, char *argv[])
 
        ok(0, "msg2");
        expect(p[0], "not ok 2 - msg2\n"
-              "#     Failed test (tap/test/run.c:main() at line 76)\n");
+              "#     Failed test (*tap/test/run.c:main() at line 77)\n");
 
        ok1(true);
        expect(p[0], "ok 3 - true\n");
 
        ok1(false);
        expect(p[0], "not ok 4 - false\n"
-              "#     Failed test (tap/test/run.c:main() at line 83)\n");
+              "#     Failed test (*tap/test/run.c:main() at line 84)\n");
 
        pass("passed");
        expect(p[0], "ok 5 - passed\n");
 
        fail("failed");
        expect(p[0], "not ok 6 - failed\n"
-              "#     Failed test (tap/test/run.c:main() at line 90)\n");
+              "#     Failed test (*tap/test/run.c:main() at line 91)\n");
 
        skip(2, "skipping %s", "test");
        expect(p[0], "ok 7 # skip skipping test\n"
@@ -98,7 +99,7 @@ int main(int argc, char *argv[])
        todo_start("todo");
        ok1(false);
        expect(p[0], "not ok 9 - false # TODO todo\n"
-              "#     Failed (TODO) test (tap/test/run.c:main() at line 99)\n");
+              "#     Failed (TODO) test (*tap/test/run.c:main() at line 100)\n");
        ok1(true);
        expect(p[0], "ok 10 - true # TODO todo\n");
        todo_end();
similarity index 100%
rename from typesafe_cb/_info.c
rename to ccan/typesafe_cb/_info.c
diff --git a/ccan_tools/Makefile b/ccan_tools/Makefile
deleted file mode 100644 (file)
index 7cf228e..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-ccan_tools/run_tests: ccan_tools/run_tests.o tap/tap.o talloc/talloc.o 
-
-ccan_tools/doc_extract: ccan_tools/doc_extract.c talloc/talloc.o
-
-ccan_tools/namespacize: ccan_tools/namespacize.c talloc/talloc.o
-
-ccan_tools-clean: ccanlint-clean
-       rm -f run_tests doc_extract
-
-include ccan_tools/ccanlint/Makefile
diff --git a/ccan_tools/ccanlint/Makefile b/ccan_tools/ccanlint/Makefile
deleted file mode 100644 (file)
index ddc5534..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-OBJS := ccan_tools/ccanlint/no_info.o \
-       ccan_tools/ccanlint/has_main_header.o \
-       ccan_tools/ccanlint/has_tests.o \
-       ccan_tools/ccanlint/trailing_whitespace.o \
-       ccan_tools/ccanlint/idempotent.o \
-
-FUTURE:=ccan_tools/ccanlint/if_have_not_ifdef.o \
-       ccan_tools/ccanlint/needs_depends.o \
-       ccan_tools/ccanlint/has_info_documentation.o \
-       ccan_tools/ccanlint/has_header_documentation.o \
-       ccan_tools/ccanlint/has_tests.o \
-       ccan_tools/ccanlint/builds_ok.o \
-       ccan_tools/ccanlint/builds_ok_all_have_variants.o \
-       ccan_tools/ccanlint/run_tests.o \
-       ccan_tools/ccanlint/test_coverage.o \
-
-ccan_tools/ccanlint/generated-init-tests: $(OBJS)
-       cat $(OBJS:.o=.c) | sed -n 's/^struct ccanlint \([A-Za-z0-9_]*\) = {/{ extern struct ccanlint \1; list_add(\&tests, \&\1.list); }/p' >$@
-
-ccan_tools/ccanlint/ccanlint.o: ccan_tools/ccanlint/generated-init-tests
-
-ccan_tools/ccanlint/ccanlint: \
-       $(OBJS)                 \
-       ccan_tools/ccanlint/ccanlint.o \
-       ccan_tools/ccanlint/get_file_lines.o \
-       ccan_tools/ccanlint/file_analysis.o \
-       talloc/talloc.o noerr/noerr.o
-
-ccanlint-clean:
-       $(RM) ccan_tools/ccanlint/generated-init-tests
-
diff --git a/tools/Makefile b/tools/Makefile
new file mode 100644 (file)
index 0000000..a9ed7fd
--- /dev/null
@@ -0,0 +1,10 @@
+tools/run_tests: tools/run_tests.o ccan/tap/tap.o ccan/talloc/talloc.o 
+
+tools/doc_extract: tools/doc_extract.c ccan/talloc/talloc.o
+
+tools/namespacize: tools/namespacize.c ccan/talloc/talloc.o
+
+tools-clean: ccanlint-clean
+       rm -f run_tests doc_extract namespacize
+
+include tools/ccanlint/Makefile
diff --git a/tools/ccanlint/Makefile b/tools/ccanlint/Makefile
new file mode 100644 (file)
index 0000000..f3f00a6
--- /dev/null
@@ -0,0 +1,32 @@
+OBJS := tools/ccanlint/no_info.o \
+       tools/ccanlint/has_main_header.o \
+       tools/ccanlint/has_tests.o \
+       tools/ccanlint/trailing_whitespace.o \
+       tools/ccanlint/idempotent.o \
+
+FUTURE:=tools/ccanlint/if_have_not_ifdef.o \
+       tools/ccanlint/needs_depends.o \
+       tools/ccanlint/has_info_documentation.o \
+       tools/ccanlint/has_header_documentation.o \
+       tools/ccanlint/has_tests.o \
+       tools/ccanlint/builds_ok.o \
+       tools/ccanlint/builds_ok_all_have_variants.o \
+       tools/ccanlint/run_tests.o \
+       tools/ccanlint/test_coverage.o \
+
+tools/ccanlint/generated-init-tests: $(OBJS)
+       cat $(OBJS:.o=.c) | sed -n 's/^struct ccanlint \([A-Za-z0-9_]*\) = {/{ extern struct ccanlint \1; list_add(\&tests, \&\1.list); }/p' >$@
+
+tools/ccanlint/ccanlint.o: tools/ccanlint/generated-init-tests
+
+tools/ccanlint/ccanlint: \
+       $(OBJS)                 \
+       tools/ccanlint/ccanlint.o \
+       tools/ccanlint/get_file_lines.o \
+       tools/ccanlint/file_analysis.o \
+       talloc/talloc.o noerr/noerr.o
+
+ccanlint-clean:
+       $(RM) tools/ccanlint/generated-init-tests
+       $(RM) tools/ccanlint/ccanlint
+
similarity index 100%
rename from ccan_tools/doc_extract.c
rename to tools/doc_extract.c
similarity index 100%
rename from ccan_tools/namespacize.c
rename to tools/namespacize.c
similarity index 96%
rename from ccan_tools/run_tests.c
rename to tools/run_tests.c
index c752644..1a8d75e 100644 (file)
@@ -4,11 +4,11 @@
 #include <dirent.h>
 #include <assert.h>
 #include <unistd.h>
-#include "tap/tap.h"
-#include "talloc/talloc.h"
-#include "../string/string.h"
+#include "ccan/tap/tap.h"
+#include "ccan/talloc/talloc.h"
+#include "ccan/string/string.h"
 
-#define CFLAGS "-O3 -Wall -Wundef -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Werror -I."
+#define CFLAGS "-O3 -Wall -Wundef -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Werror -Iccan -I."
 
 /* FIXME: Use build bug later. */
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
@@ -56,7 +56,7 @@ static char *obj_list(void)
                list = talloc_asprintf_append(list, "%s ", i->name);
 
        /* FIXME */
-       list = talloc_asprintf_append(list, "tap/tap.o");
+       list = talloc_asprintf_append(list, "ccan/tap/tap.o");
        return list;
 }
 
similarity index 100%
rename from ccan_tools/test_all.sh
rename to tools/test_all.sh