Changeset 4540
- Timestamp:
- 02/08/07 18:58:20 (2 years ago)
- Files:
-
- libwired/trunk/Makefile.in (modified) (6 diffs)
- libwired/trunk/libwired/base/wi-assert.c (added)
- libwired/trunk/libwired/base/wi-assert.h (modified) (1 diff)
- libwired/trunk/libwired/base/wi-base.c (modified) (2 diffs)
- libwired/trunk/libwired/base/wi-base.h (modified) (1 diff)
- libwired/trunk/libwired/base/wi-byteorder.h (modified) (1 diff)
- libwired/trunk/libwired/base/wi-private.h (modified) (2 diffs)
- libwired/trunk/libwired/base/wi-tests.c (added)
- libwired/trunk/libwired/base/wi-tests.h (added)
- libwired/trunk/libwired/data/wi-string.c (modified) (4 diffs)
- libwired/trunk/libwired/data/wi-string.h (modified) (1 diff)
- libwired/trunk/libwired/system/wi-log.c (modified) (2 diffs)
- libwired/trunk/libwired/system/wi-log.h (modified) (1 diff)
- libwired/trunk/libwired/wired.h (modified) (1 diff)
- libwired/trunk/test (added)
- libwired/trunk/test/test.c (added)
- libwired/trunk/test/tests (added)
- libwired/trunk/test/tests/wi-test-string.c (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
libwired/trunk/Makefile.in
r4535 r4540 11 11 12 12 DISTFILES = LICENSE Makefile Makefile.in config.guess config.h.in \ 13 config.status config.sub configure configure.in install-sh \ 14 libwired 15 SOURCEDIRS = $(top_srcdir)/libwired 13 config.status config.sub configure configure.in install-sh libwired 14 SOURCEDIRS = $(top_srcdir)/libwired $(top_srcdir)/test 16 15 17 16 VPATH = $(subst $(empty) $(empty),:,$(shell find $(SOURCEDIRS) -name ".*" -prune -o -type d -print)) 18 LIBWIREDOBJECTS = $(addprefix $(objdir)/libwired/,$(notdir $(patsubst %.c,%.o,$(shell find $(top_srcdir)/libwired -name "*.c")))) 19 HEADERS = $(addprefix $(headerdir)/,$(notdir $(shell find $(top_srcdir)/libwired -name "*.h"))) 17 LIBWIREDOBJECTS = $(addprefix $(objdir)/libwired/,$(sort $(notdir $(patsubst %.c,%.o,$(shell find libwired -name "*.c"))))) 18 TESTOBJECTS = $(addprefix $(objdir)/libwired/,$(notdir $(patsubst %.c,%.o,$(shell find test -name "*.c")))) 19 TESTSOBJECTS = $(addprefix $(objdir)/libwired/,$(notdir $(patsubst %.c,%.o,$(shell find test/tests -name "*.c")))) 20 HEADERS = $(addprefix $(headerdir)/,$(notdir $(shell find libwired -name "*.h"))) 20 21 21 22 DEFS = @DEFS@ … … 33 34 ARCHIVE = ar rcs $@ 34 35 35 .PHONY: all dist clean distclean scmclean 36 .PHONY: all test dist clean distclean scmclean 37 38 all: $(rundir)/lib/libwired.a 36 39 37 40 ifeq ($(WI_MAINTAINER), 1) 38 all: Makefile configure config.h.in $(rundir)/lib/libwired.a 39 else 40 all: $(rundir)/lib/libwired.a 41 endif 41 all: Makefile configure config.h.in $(rundir)/test 42 42 43 ifeq ($(WI_MAINTAINER), 1)44 43 Makefile: Makefile.in config.status 45 ./config.status44 $(top_srcdir)/config.status 46 45 47 46 configure: configure.in … … 57 56 @test -d $(@D) || mkdir -p $(@D) 58 57 $(ARCHIVE) $(LIBWIREDOBJECTS) 59 58 60 59 $(objdir)/libwired/%.o: %.c 61 60 @test -d $(@D) || mkdir -p $(@D) … … 70 69 cp $< $@ 71 70 71 test: $(rundir)/test 72 73 $(rundir)/test: $(rundir)/lib/libwired.a test/testlist.h test/testlist.inc $(TESTOBJECTS) 74 @test -d $(@D) || mkdir -p $(@D) 75 $(LINK) $(TESTOBJECTS) $(LIBS) 76 @$(rundir)/test 77 78 test/testlist.h: $(TESTSOBJECTS) 79 -grep WI_TEST_EXPORT $(wildcard test/tests/*.c) > $@ 80 81 test/testlist.inc: test/testlist.h 82 perl -ne '$$s=(split(/\s+/))[2]; $$s=~ s/(\w+).*/$$1/; print "wi_tests_run_test(\"$$s\", $$s);";' $< > $@ 83 72 84 dist: 73 85 rm -rf libwired-$(WI_VERSION) … … 91 103 rm -f $(headerdir)/*.h 92 104 rm -f $(rundir)/lib/libwired.a 105 rm -f $(rundir)/test 93 106 rm -rf autom4te.cache 94 107 … … 105 118 ifeq ($(WI_MAINTAINER), 1) 106 119 -include $(LIBWIREDOBJECTS:.o=.d) 120 -include $(TESTOBJECTS:.o=.d) 107 121 endif libwired/trunk/libwired/base/wi-assert.h
r4437 r4540 34 34 #include <wired/wi-log.h> 35 35 36 #define WI_ASSERT(exp, fmt, ...) \ 37 WI_STMT_START \ 38 if(!(exp)) { \ 39 wi_log_warn(WI_STR("Assertion failed at %s:%u: " fmt), \ 40 __FILE__, __LINE__, ## __VA_ARGS__); \ 41 wi_crash(); \ 42 } \ 36 #define WI_ASSERT(exp, fmt, ...) \ 37 WI_STMT_START \ 38 if(!(exp)) { \ 39 (*wi_assert_handler)(WI_STR(__FILE__), __LINE__, \ 40 WI_STR(fmt), ## __VA_ARGS__); \ 41 } \ 43 42 WI_STMT_END 44 43 44 45 typedef void wi_assert_handler_func_t(wi_string_t *, wi_uinteger_t, wi_string_t *, ...); 46 47 48 WI_EXPORT wi_assert_handler_func_t *wi_assert_handler; 49 45 50 #endif /* WI_ASSERT_H */ libwired/trunk/libwired/base/wi-base.c
r4511 r4540 73 73 wi_socket_register(); 74 74 wi_string_register(); 75 wi_test_register(); 75 76 76 77 #ifdef WI_TERMCAP … … 111 112 wi_settings_initialize(); 112 113 wi_socket_initialize(); 114 wi_test_initialize(); 113 115 114 116 #ifdef WI_TERMCAP libwired/trunk/libwired/base/wi-base.h
r4494 r4540 60 60 #endif 61 61 62 #define _WI_STRINGIFY(s) #s 63 #define WI_STRINGIFY(s) _WI_STRINGIFY(s) 64 62 65 #if __LP64__ 63 66 #define WI_32 0 libwired/trunk/libwired/base/wi-byteorder.h
r4437 r4540 41 41 42 42 43 #define WI_SWAP_INT16(n) \44 ((uint16_t) ((((uint16_t) (n) & 0xFF00) >> 8) | \43 #define WI_SWAP_INT16(n) \ 44 ((uint16_t) ((((uint16_t) (n) & 0xFF00) >> 8) | \ 45 45 (((uint16_t) (n) & 0x00FF) << 8))) 46 46 47 #define WI_SWAP_INT32(n) \48 ((uint32_t) ((((uint32_t) (n) & 0xFF000000) >> 24) | \49 (((uint32_t) (n) & 0x00FF0000) >> 8) | \50 (((uint32_t) (n) & 0x0000FF00) << 8) | \47 #define WI_SWAP_INT32(n) \ 48 ((uint32_t) ((((uint32_t) (n) & 0xFF000000) >> 24) | \ 49 (((uint32_t) (n) & 0x00FF0000) >> 8) | \ 50 (((uint32_t) (n) & 0x0000FF00) << 8) | \ 51 51 (((uint32_t) (n) & 0x000000FF) << 24))) 52 52 53 #define WI_SWAP_INT64(n) \54 ((uint64_t) ((((uint64_t) (n) & 0xFF00000000000000ULL) >> 56) | \55 (((uint64_t) (n) & 0x00FF000000000000ULL) >> 40) | \56 (((uint64_t) (n) & 0x0000FF0000000000ULL) >> 24) | \57 (((uint64_t) (n) & 0x000000FF00000000ULL) >> 8) | \58 (((uint64_t) (n) & 0x00000000FF000000ULL) << 8) | \59 (((uint64_t) (n) & 0x0000000000FF0000ULL) << 24) | \60 (((uint64_t) (n) & 0x000000000000FF00ULL) << 40) | \53 #define WI_SWAP_INT64(n) \ 54 ((uint64_t) ((((uint64_t) (n) & 0xFF00000000000000ULL) >> 56) | \ 55 (((uint64_t) (n) & 0x00FF000000000000ULL) >> 40) | \ 56 (((uint64_t) (n) & 0x0000FF0000000000ULL) >> 24) | \ 57 (((uint64_t) (n) & 0x000000FF00000000ULL) >> 8) | \ 58 (((uint64_t) (n) & 0x00000000FF000000ULL) << 8) | \ 59 (((uint64_t) (n) & 0x0000000000FF0000ULL) << 24) | \ 60 (((uint64_t) (n) & 0x000000000000FF00ULL) << 40) | \ 61 61 (((uint64_t) (n) & 0x00000000000000FFULL) << 56))) 62 62 libwired/trunk/libwired/base/wi-private.h
r4511 r4540 63 63 WI_EXPORT void wi_string_register(void); 64 64 WI_EXPORT void wi_terminal_register(void); 65 WI_EXPORT void wi_test_register(void); 65 66 WI_EXPORT void wi_timer_register(void); 66 67 WI_EXPORT void wi_thread_register(void); … … 90 91 WI_EXPORT void wi_string_initialize(void); 91 92 WI_EXPORT void wi_terminal_initialize(void); 93 WI_EXPORT void wi_test_initialize(void); 92 94 WI_EXPORT void wi_timer_initialize(void); 93 95 WI_EXPORT void wi_thread_initialize(void); libwired/trunk/libwired/data/wi-string.c
r4511 r4540 1124 1124 1125 1125 for(i = 0; i < newstring->length; i++) 1126 newstring->string[i] = to upper((unsigned int) newstring->string[i]);1126 newstring->string[i] = tolower((unsigned int) newstring->string[i]); 1127 1127 1128 1128 return wi_autorelease(newstring); … … 1138 1138 1139 1139 for(i = 0; i < newstring->length; i++) 1140 newstring->string[i] = to lower((unsigned int) newstring->string[i]);1140 newstring->string[i] = toupper((unsigned int) newstring->string[i]); 1141 1141 1142 1142 return wi_autorelease(newstring); … … 1161 1161 if(wi_string_length(component) > 0) 1162 1162 wi_array_add_data(array, component); 1163 else if(i == 0 || i == count - 1)1163 else if(i == 0) 1164 1164 wi_array_add_data(array, WI_STR("/")); 1165 1165 } … … 1406 1406 1407 1407 1408 wi_string_t * wi_string_path_extension(wi_string_t *path) { 1409 wi_uinteger_t index; 1410 1411 index = wi_string_index_of_char(path, '.', WI_STRING_BACKWARDS); 1412 1413 if(index != WI_NOT_FOUND && index + 1 < path->length) 1414 return wi_string_by_deleting_characters_to_index(path, index + 1); 1415 1416 return WI_STR(""); 1417 } 1418 1419 1420 1408 1421 void wi_string_delete_path_extension(wi_string_t *path) { 1409 1422 wi_uinteger_t index; libwired/trunk/libwired/data/wi-string.h
r4437 r4540 131 131 WI_EXPORT void wi_string_delete_last_path_component(wi_string_t *); 132 132 WI_EXPORT wi_string_t * wi_string_by_deleting_last_path_component(wi_string_t *); 133 WI_EXPORT wi_string_t * wi_string_path_extension(wi_string_t *); 133 134 WI_EXPORT void wi_string_delete_path_extension(wi_string_t *); 134 135 WI_EXPORT wi_string_t * wi_string_by_deleting_path_extension(wi_string_t *); libwired/trunk/libwired/system/wi-log.c
r4511 r4540 65 65 wi_boolean_t wi_log_startup = false; 66 66 wi_boolean_t wi_log_tool = false; 67 wi_boolean_t wi_log_plain = false; 67 68 wi_boolean_t wi_log_syslog = false; 68 69 wi_boolean_t wi_log_file = false; … … 166 167 else if(wi_log_tool) 167 168 fprintf((priority < LOG_INFO) ? stderr : stdout, "%s: %s\n", name, cstring); 169 else if(wi_log_plain) 170 fprintf((priority < LOG_INFO) ? stderr : stdout, "%s\n", cstring); 168 171 169 172 if(wi_log_syslog) libwired/trunk/libwired/system/wi-log.h
r4437 r4540 62 62 WI_EXPORT wi_boolean_t wi_log_startup; 63 63 WI_EXPORT wi_boolean_t wi_log_tool; 64 WI_EXPORT wi_boolean_t wi_log_plain; 64 65 WI_EXPORT wi_boolean_t wi_log_syslog; 65 66 WI_EXPORT wi_boolean_t wi_log_file; libwired/trunk/libwired/wired.h
r4437 r4540 59 59 #include <wired/wi-system.h> 60 60 #include <wired/wi-terminal.h> 61 #include <wired/wi-tests.h> 61 62 #include <wired/wi-timer.h> 62 63 #include <wired/wi-thread.h>
