Putting versions of RRLP, CommonLibs and sqlite3 into the public release branch.
git-svn-id: http://wush.net/svn/range/software/public/CommonLibs/trunk@2254 19bc5d8c-e614-43d4-8b26-e1612bc8e597
This commit is contained in:
commit
c2c51d9107
|
@ -0,0 +1,371 @@
|
|||
BitVector.lo .libs/BitVector.o: BitVector.cpp BitVector.h Vector.h \
|
||||
/usr/include/string.h /usr/include/_types.h /usr/include/sys/_types.h \
|
||||
/usr/include/sys/cdefs.h /usr/include/machine/_types.h \
|
||||
/usr/include/i386/_types.h /usr/include/c++/4.2.1/iostream \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++config.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/os_defines.h \
|
||||
/usr/include/unistd.h /usr/include/sys/unistd.h \
|
||||
/usr/include/sys/select.h /usr/include/sys/appleapiopts.h \
|
||||
/usr/include/sys/_structs.h /usr/include/sys/_select.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/cpu_defines.h \
|
||||
/usr/include/c++/4.2.1/ostream /usr/include/c++/4.2.1/ios \
|
||||
/usr/include/c++/4.2.1/iosfwd \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++locale.h \
|
||||
/usr/include/c++/4.2.1/clocale /usr/include/locale.h \
|
||||
/usr/include/_locale.h /usr/include/c++/4.2.1/cstring \
|
||||
/usr/include/c++/4.2.1/cstddef \
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stddef.h \
|
||||
/usr/include/c++/4.2.1/cstdio /usr/include/stdio.h \
|
||||
/usr/include/c++/4.2.1/cstdarg \
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stdarg.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++io.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/gthr.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/gthr-default.h \
|
||||
/usr/include/pthread.h /usr/include/pthread_impl.h /usr/include/sched.h \
|
||||
/usr/include/time.h /usr/include/_structs.h \
|
||||
/usr/include/c++/4.2.1/cctype /usr/include/ctype.h \
|
||||
/usr/include/runetype.h /usr/include/c++/4.2.1/bits/stringfwd.h \
|
||||
/usr/include/c++/4.2.1/bits/postypes.h /usr/include/c++/4.2.1/cwchar \
|
||||
/usr/include/c++/4.2.1/ctime /usr/include/wchar.h \
|
||||
/usr/include/_wctype.h \
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stdint.h \
|
||||
/usr/include/c++/4.2.1/bits/functexcept.h \
|
||||
/usr/include/c++/4.2.1/exception_defines.h \
|
||||
/usr/include/c++/4.2.1/exception \
|
||||
/usr/include/c++/4.2.1/bits/char_traits.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_algobase.h \
|
||||
/usr/include/c++/4.2.1/climits \
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/limits.h \
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/syslimits.h \
|
||||
/usr/include/limits.h /usr/include/machine/limits.h \
|
||||
/usr/include/i386/limits.h /usr/include/i386/_limits.h \
|
||||
/usr/include/sys/syslimits.h /usr/include/c++/4.2.1/cstdlib \
|
||||
/usr/include/stdlib.h /usr/include/Availability.h \
|
||||
/usr/include/AvailabilityInternal.h /usr/include/sys/wait.h \
|
||||
/usr/include/sys/signal.h /usr/include/machine/signal.h \
|
||||
/usr/include/i386/signal.h /usr/include/i386/_structs.h \
|
||||
/usr/include/machine/_structs.h /usr/include/mach/i386/_structs.h \
|
||||
/usr/include/sys/resource.h /usr/include/machine/endian.h \
|
||||
/usr/include/i386/endian.h /usr/include/sys/_endian.h \
|
||||
/usr/include/libkern/_OSByteOrder.h \
|
||||
/usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \
|
||||
/usr/include/machine/types.h /usr/include/i386/types.h \
|
||||
/usr/include/i386/_types.h /usr/include/c++/4.2.1/bits/stl_pair.h \
|
||||
/usr/include/c++/4.2.1/bits/cpp_type_traits.h \
|
||||
/usr/include/c++/4.2.1/ext/type_traits.h /usr/include/c++/4.2.1/utility \
|
||||
/usr/include/c++/4.2.1/bits/stl_relops.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_iterator_base_types.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_iterator_base_funcs.h \
|
||||
/usr/include/c++/4.2.1/bits/concept_check.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_iterator.h \
|
||||
/usr/include/c++/4.2.1/debug/debug.h \
|
||||
/usr/include/c++/4.2.1/bits/localefwd.h \
|
||||
/usr/include/c++/4.2.1/bits/ios_base.h \
|
||||
/usr/include/c++/4.2.1/ext/atomicity.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/atomic_word.h \
|
||||
/usr/include/c++/4.2.1/bits/locale_classes.h \
|
||||
/usr/include/c++/4.2.1/string /usr/include/c++/4.2.1/memory \
|
||||
/usr/include/c++/4.2.1/bits/allocator.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++allocator.h \
|
||||
/usr/include/c++/4.2.1/ext/new_allocator.h /usr/include/c++/4.2.1/new \
|
||||
/usr/include/c++/4.2.1/bits/stl_construct.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_uninitialized.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_raw_storage_iter.h \
|
||||
/usr/include/c++/4.2.1/limits \
|
||||
/usr/include/c++/4.2.1/bits/ostream_insert.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_function.h \
|
||||
/usr/include/c++/4.2.1/bits/basic_string.h \
|
||||
/usr/include/c++/4.2.1/algorithm /usr/include/c++/4.2.1/bits/stl_algo.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_heap.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_tempbuf.h \
|
||||
/usr/include/c++/4.2.1/bits/basic_string.tcc \
|
||||
/usr/include/c++/4.2.1/streambuf \
|
||||
/usr/include/c++/4.2.1/bits/streambuf.tcc \
|
||||
/usr/include/c++/4.2.1/bits/basic_ios.h \
|
||||
/usr/include/c++/4.2.1/bits/streambuf_iterator.h \
|
||||
/usr/include/c++/4.2.1/bits/locale_facets.h \
|
||||
/usr/include/c++/4.2.1/cwctype /usr/include/wctype.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/ctype_base.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/ctype_inline.h \
|
||||
/usr/include/c++/4.2.1/bits/codecvt.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/time_members.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/messages_members.h \
|
||||
/usr/include/c++/4.2.1/bits/basic_ios.tcc \
|
||||
/usr/include/c++/4.2.1/bits/ostream.tcc /usr/include/c++/4.2.1/locale \
|
||||
/usr/include/c++/4.2.1/bits/locale_facets.tcc \
|
||||
/usr/include/c++/4.2.1/typeinfo /usr/include/c++/4.2.1/istream \
|
||||
/usr/include/c++/4.2.1/bits/istream.tcc /usr/include/assert.h
|
||||
|
||||
BitVector.h:
|
||||
|
||||
Vector.h:
|
||||
|
||||
/usr/include/string.h:
|
||||
|
||||
/usr/include/_types.h:
|
||||
|
||||
/usr/include/sys/_types.h:
|
||||
|
||||
/usr/include/sys/cdefs.h:
|
||||
|
||||
/usr/include/machine/_types.h:
|
||||
|
||||
/usr/include/i386/_types.h:
|
||||
|
||||
/usr/include/c++/4.2.1/iostream:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++config.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/os_defines.h:
|
||||
|
||||
/usr/include/unistd.h:
|
||||
|
||||
/usr/include/sys/unistd.h:
|
||||
|
||||
/usr/include/sys/select.h:
|
||||
|
||||
/usr/include/sys/appleapiopts.h:
|
||||
|
||||
/usr/include/sys/_structs.h:
|
||||
|
||||
/usr/include/sys/_select.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/cpu_defines.h:
|
||||
|
||||
/usr/include/c++/4.2.1/ostream:
|
||||
|
||||
/usr/include/c++/4.2.1/ios:
|
||||
|
||||
/usr/include/c++/4.2.1/iosfwd:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++locale.h:
|
||||
|
||||
/usr/include/c++/4.2.1/clocale:
|
||||
|
||||
/usr/include/locale.h:
|
||||
|
||||
/usr/include/_locale.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cstring:
|
||||
|
||||
/usr/include/c++/4.2.1/cstddef:
|
||||
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stddef.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cstdio:
|
||||
|
||||
/usr/include/stdio.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cstdarg:
|
||||
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stdarg.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++io.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/gthr.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/gthr-default.h:
|
||||
|
||||
/usr/include/pthread.h:
|
||||
|
||||
/usr/include/pthread_impl.h:
|
||||
|
||||
/usr/include/sched.h:
|
||||
|
||||
/usr/include/time.h:
|
||||
|
||||
/usr/include/_structs.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cctype:
|
||||
|
||||
/usr/include/ctype.h:
|
||||
|
||||
/usr/include/runetype.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stringfwd.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/postypes.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cwchar:
|
||||
|
||||
/usr/include/c++/4.2.1/ctime:
|
||||
|
||||
/usr/include/wchar.h:
|
||||
|
||||
/usr/include/_wctype.h:
|
||||
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stdint.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/functexcept.h:
|
||||
|
||||
/usr/include/c++/4.2.1/exception_defines.h:
|
||||
|
||||
/usr/include/c++/4.2.1/exception:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/char_traits.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_algobase.h:
|
||||
|
||||
/usr/include/c++/4.2.1/climits:
|
||||
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/limits.h:
|
||||
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/syslimits.h:
|
||||
|
||||
/usr/include/limits.h:
|
||||
|
||||
/usr/include/machine/limits.h:
|
||||
|
||||
/usr/include/i386/limits.h:
|
||||
|
||||
/usr/include/i386/_limits.h:
|
||||
|
||||
/usr/include/sys/syslimits.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cstdlib:
|
||||
|
||||
/usr/include/stdlib.h:
|
||||
|
||||
/usr/include/Availability.h:
|
||||
|
||||
/usr/include/AvailabilityInternal.h:
|
||||
|
||||
/usr/include/sys/wait.h:
|
||||
|
||||
/usr/include/sys/signal.h:
|
||||
|
||||
/usr/include/machine/signal.h:
|
||||
|
||||
/usr/include/i386/signal.h:
|
||||
|
||||
/usr/include/i386/_structs.h:
|
||||
|
||||
/usr/include/machine/_structs.h:
|
||||
|
||||
/usr/include/mach/i386/_structs.h:
|
||||
|
||||
/usr/include/sys/resource.h:
|
||||
|
||||
/usr/include/machine/endian.h:
|
||||
|
||||
/usr/include/i386/endian.h:
|
||||
|
||||
/usr/include/sys/_endian.h:
|
||||
|
||||
/usr/include/libkern/_OSByteOrder.h:
|
||||
|
||||
/usr/include/libkern/i386/_OSByteOrder.h:
|
||||
|
||||
/usr/include/alloca.h:
|
||||
|
||||
/usr/include/machine/types.h:
|
||||
|
||||
/usr/include/i386/types.h:
|
||||
|
||||
/usr/include/i386/_types.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_pair.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/cpp_type_traits.h:
|
||||
|
||||
/usr/include/c++/4.2.1/ext/type_traits.h:
|
||||
|
||||
/usr/include/c++/4.2.1/utility:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_relops.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_iterator_base_types.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_iterator_base_funcs.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/concept_check.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_iterator.h:
|
||||
|
||||
/usr/include/c++/4.2.1/debug/debug.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/localefwd.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/ios_base.h:
|
||||
|
||||
/usr/include/c++/4.2.1/ext/atomicity.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/atomic_word.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/locale_classes.h:
|
||||
|
||||
/usr/include/c++/4.2.1/string:
|
||||
|
||||
/usr/include/c++/4.2.1/memory:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/allocator.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++allocator.h:
|
||||
|
||||
/usr/include/c++/4.2.1/ext/new_allocator.h:
|
||||
|
||||
/usr/include/c++/4.2.1/new:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_construct.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_uninitialized.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_raw_storage_iter.h:
|
||||
|
||||
/usr/include/c++/4.2.1/limits:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/ostream_insert.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_function.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/basic_string.h:
|
||||
|
||||
/usr/include/c++/4.2.1/algorithm:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_algo.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_heap.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_tempbuf.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/basic_string.tcc:
|
||||
|
||||
/usr/include/c++/4.2.1/streambuf:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/streambuf.tcc:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/basic_ios.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/streambuf_iterator.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/locale_facets.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cwctype:
|
||||
|
||||
/usr/include/wctype.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/ctype_base.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/ctype_inline.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/codecvt.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/time_members.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/messages_members.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/basic_ios.tcc:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/ostream.tcc:
|
||||
|
||||
/usr/include/c++/4.2.1/locale:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/locale_facets.tcc:
|
||||
|
||||
/usr/include/c++/4.2.1/typeinfo:
|
||||
|
||||
/usr/include/c++/4.2.1/istream:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/istream.tcc:
|
||||
|
||||
/usr/include/assert.h:
|
|
@ -0,0 +1 @@
|
|||
# dummy
|
|
@ -0,0 +1 @@
|
|||
# dummy
|
|
@ -0,0 +1 @@
|
|||
# dummy
|
|
@ -0,0 +1 @@
|
|||
# dummy
|
|
@ -0,0 +1 @@
|
|||
# dummy
|
|
@ -0,0 +1,71 @@
|
|||
LinkedLists.lo .libs/LinkedLists.o: LinkedLists.cpp LinkedLists.h \
|
||||
/usr/include/stdlib.h /usr/include/Availability.h \
|
||||
/usr/include/AvailabilityInternal.h /usr/include/_types.h \
|
||||
/usr/include/sys/_types.h /usr/include/sys/cdefs.h \
|
||||
/usr/include/machine/_types.h /usr/include/i386/_types.h \
|
||||
/usr/include/sys/wait.h /usr/include/sys/signal.h \
|
||||
/usr/include/sys/appleapiopts.h /usr/include/machine/signal.h \
|
||||
/usr/include/i386/signal.h /usr/include/i386/_structs.h \
|
||||
/usr/include/sys/_structs.h /usr/include/machine/_structs.h \
|
||||
/usr/include/mach/i386/_structs.h /usr/include/sys/resource.h \
|
||||
/usr/include/machine/endian.h /usr/include/i386/endian.h \
|
||||
/usr/include/sys/_endian.h /usr/include/libkern/_OSByteOrder.h \
|
||||
/usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \
|
||||
/usr/include/machine/types.h /usr/include/i386/types.h \
|
||||
/usr/include/i386/_types.h
|
||||
|
||||
LinkedLists.h:
|
||||
|
||||
/usr/include/stdlib.h:
|
||||
|
||||
/usr/include/Availability.h:
|
||||
|
||||
/usr/include/AvailabilityInternal.h:
|
||||
|
||||
/usr/include/_types.h:
|
||||
|
||||
/usr/include/sys/_types.h:
|
||||
|
||||
/usr/include/sys/cdefs.h:
|
||||
|
||||
/usr/include/machine/_types.h:
|
||||
|
||||
/usr/include/i386/_types.h:
|
||||
|
||||
/usr/include/sys/wait.h:
|
||||
|
||||
/usr/include/sys/signal.h:
|
||||
|
||||
/usr/include/sys/appleapiopts.h:
|
||||
|
||||
/usr/include/machine/signal.h:
|
||||
|
||||
/usr/include/i386/signal.h:
|
||||
|
||||
/usr/include/i386/_structs.h:
|
||||
|
||||
/usr/include/sys/_structs.h:
|
||||
|
||||
/usr/include/machine/_structs.h:
|
||||
|
||||
/usr/include/mach/i386/_structs.h:
|
||||
|
||||
/usr/include/sys/resource.h:
|
||||
|
||||
/usr/include/machine/endian.h:
|
||||
|
||||
/usr/include/i386/endian.h:
|
||||
|
||||
/usr/include/sys/_endian.h:
|
||||
|
||||
/usr/include/libkern/_OSByteOrder.h:
|
||||
|
||||
/usr/include/libkern/i386/_OSByteOrder.h:
|
||||
|
||||
/usr/include/alloca.h:
|
||||
|
||||
/usr/include/machine/types.h:
|
||||
|
||||
/usr/include/i386/types.h:
|
||||
|
||||
/usr/include/i386/_types.h:
|
|
@ -0,0 +1 @@
|
|||
# dummy
|
|
@ -0,0 +1 @@
|
|||
# dummy
|
|
@ -0,0 +1 @@
|
|||
# dummy
|
|
@ -0,0 +1,411 @@
|
|||
Sockets.lo .libs/Sockets.o: Sockets.cpp /usr/include/unistd.h \
|
||||
/usr/include/_types.h /usr/include/sys/_types.h \
|
||||
/usr/include/sys/cdefs.h /usr/include/machine/_types.h \
|
||||
/usr/include/i386/_types.h /usr/include/sys/unistd.h \
|
||||
/usr/include/sys/select.h /usr/include/sys/appleapiopts.h \
|
||||
/usr/include/sys/_structs.h /usr/include/sys/_select.h \
|
||||
/usr/include/fcntl.h /usr/include/sys/fcntl.h \
|
||||
/usr/include/c++/4.2.1/cstdio \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++config.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/os_defines.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/cpu_defines.h \
|
||||
/usr/include/c++/4.2.1/cstddef \
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stddef.h \
|
||||
/usr/include/stdio.h Threads.h /usr/include/pthread.h \
|
||||
/usr/include/pthread_impl.h /usr/include/sched.h /usr/include/time.h \
|
||||
/usr/include/_structs.h /usr/include/c++/4.2.1/iostream \
|
||||
/usr/include/c++/4.2.1/ostream /usr/include/c++/4.2.1/ios \
|
||||
/usr/include/c++/4.2.1/iosfwd \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++locale.h \
|
||||
/usr/include/c++/4.2.1/clocale /usr/include/locale.h \
|
||||
/usr/include/_locale.h /usr/include/c++/4.2.1/cstring \
|
||||
/usr/include/string.h /usr/include/c++/4.2.1/cstdarg \
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stdarg.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++io.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/gthr.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/gthr-default.h \
|
||||
/usr/include/c++/4.2.1/cctype /usr/include/ctype.h \
|
||||
/usr/include/runetype.h /usr/include/c++/4.2.1/bits/stringfwd.h \
|
||||
/usr/include/c++/4.2.1/bits/postypes.h /usr/include/c++/4.2.1/cwchar \
|
||||
/usr/include/c++/4.2.1/ctime /usr/include/wchar.h \
|
||||
/usr/include/_wctype.h \
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stdint.h \
|
||||
/usr/include/c++/4.2.1/bits/functexcept.h \
|
||||
/usr/include/c++/4.2.1/exception_defines.h \
|
||||
/usr/include/c++/4.2.1/exception \
|
||||
/usr/include/c++/4.2.1/bits/char_traits.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_algobase.h \
|
||||
/usr/include/c++/4.2.1/climits \
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/limits.h \
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/syslimits.h \
|
||||
/usr/include/limits.h /usr/include/machine/limits.h \
|
||||
/usr/include/i386/limits.h /usr/include/i386/_limits.h \
|
||||
/usr/include/sys/syslimits.h /usr/include/c++/4.2.1/cstdlib \
|
||||
/usr/include/stdlib.h /usr/include/Availability.h \
|
||||
/usr/include/AvailabilityInternal.h /usr/include/sys/wait.h \
|
||||
/usr/include/sys/signal.h /usr/include/machine/signal.h \
|
||||
/usr/include/i386/signal.h /usr/include/i386/_structs.h \
|
||||
/usr/include/machine/_structs.h /usr/include/mach/i386/_structs.h \
|
||||
/usr/include/sys/resource.h /usr/include/machine/endian.h \
|
||||
/usr/include/i386/endian.h /usr/include/sys/_endian.h \
|
||||
/usr/include/libkern/_OSByteOrder.h \
|
||||
/usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \
|
||||
/usr/include/machine/types.h /usr/include/i386/types.h \
|
||||
/usr/include/i386/_types.h /usr/include/c++/4.2.1/bits/stl_pair.h \
|
||||
/usr/include/c++/4.2.1/bits/cpp_type_traits.h \
|
||||
/usr/include/c++/4.2.1/ext/type_traits.h /usr/include/c++/4.2.1/utility \
|
||||
/usr/include/c++/4.2.1/bits/stl_relops.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_iterator_base_types.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_iterator_base_funcs.h \
|
||||
/usr/include/c++/4.2.1/bits/concept_check.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_iterator.h \
|
||||
/usr/include/c++/4.2.1/debug/debug.h \
|
||||
/usr/include/c++/4.2.1/bits/localefwd.h \
|
||||
/usr/include/c++/4.2.1/bits/ios_base.h \
|
||||
/usr/include/c++/4.2.1/ext/atomicity.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/atomic_word.h \
|
||||
/usr/include/c++/4.2.1/bits/locale_classes.h \
|
||||
/usr/include/c++/4.2.1/string /usr/include/c++/4.2.1/memory \
|
||||
/usr/include/c++/4.2.1/bits/allocator.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++allocator.h \
|
||||
/usr/include/c++/4.2.1/ext/new_allocator.h /usr/include/c++/4.2.1/new \
|
||||
/usr/include/c++/4.2.1/bits/stl_construct.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_uninitialized.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_raw_storage_iter.h \
|
||||
/usr/include/c++/4.2.1/limits \
|
||||
/usr/include/c++/4.2.1/bits/ostream_insert.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_function.h \
|
||||
/usr/include/c++/4.2.1/bits/basic_string.h \
|
||||
/usr/include/c++/4.2.1/algorithm /usr/include/c++/4.2.1/bits/stl_algo.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_heap.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_tempbuf.h \
|
||||
/usr/include/c++/4.2.1/bits/basic_string.tcc \
|
||||
/usr/include/c++/4.2.1/streambuf \
|
||||
/usr/include/c++/4.2.1/bits/streambuf.tcc \
|
||||
/usr/include/c++/4.2.1/bits/basic_ios.h \
|
||||
/usr/include/c++/4.2.1/bits/streambuf_iterator.h \
|
||||
/usr/include/c++/4.2.1/bits/locale_facets.h \
|
||||
/usr/include/c++/4.2.1/cwctype /usr/include/wctype.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/ctype_base.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/ctype_inline.h \
|
||||
/usr/include/c++/4.2.1/bits/codecvt.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/time_members.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/messages_members.h \
|
||||
/usr/include/c++/4.2.1/bits/basic_ios.tcc \
|
||||
/usr/include/c++/4.2.1/bits/ostream.tcc /usr/include/c++/4.2.1/locale \
|
||||
/usr/include/c++/4.2.1/bits/locale_facets.tcc \
|
||||
/usr/include/c++/4.2.1/typeinfo /usr/include/c++/4.2.1/istream \
|
||||
/usr/include/c++/4.2.1/bits/istream.tcc /usr/include/assert.h Sockets.h \
|
||||
/usr/include/arpa/inet.h /usr/include/netinet/in.h \
|
||||
/usr/include/sys/socket.h /usr/include/sys/types.h \
|
||||
/usr/include/machine/_param.h /usr/include/i386/_param.h \
|
||||
/usr/include/netinet6/in6.h /usr/include/netdb.h /usr/include/sys/un.h \
|
||||
/usr/include/errno.h /usr/include/sys/errno.h \
|
||||
/usr/include/c++/4.2.1/list /usr/include/c++/4.2.1/bits/stl_list.h \
|
||||
/usr/include/c++/4.2.1/bits/list.tcc
|
||||
|
||||
/usr/include/unistd.h:
|
||||
|
||||
/usr/include/_types.h:
|
||||
|
||||
/usr/include/sys/_types.h:
|
||||
|
||||
/usr/include/sys/cdefs.h:
|
||||
|
||||
/usr/include/machine/_types.h:
|
||||
|
||||
/usr/include/i386/_types.h:
|
||||
|
||||
/usr/include/sys/unistd.h:
|
||||
|
||||
/usr/include/sys/select.h:
|
||||
|
||||
/usr/include/sys/appleapiopts.h:
|
||||
|
||||
/usr/include/sys/_structs.h:
|
||||
|
||||
/usr/include/sys/_select.h:
|
||||
|
||||
/usr/include/fcntl.h:
|
||||
|
||||
/usr/include/sys/fcntl.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cstdio:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++config.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/os_defines.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/cpu_defines.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cstddef:
|
||||
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stddef.h:
|
||||
|
||||
/usr/include/stdio.h:
|
||||
|
||||
Threads.h:
|
||||
|
||||
/usr/include/pthread.h:
|
||||
|
||||
/usr/include/pthread_impl.h:
|
||||
|
||||
/usr/include/sched.h:
|
||||
|
||||
/usr/include/time.h:
|
||||
|
||||
/usr/include/_structs.h:
|
||||
|
||||
/usr/include/c++/4.2.1/iostream:
|
||||
|
||||
/usr/include/c++/4.2.1/ostream:
|
||||
|
||||
/usr/include/c++/4.2.1/ios:
|
||||
|
||||
/usr/include/c++/4.2.1/iosfwd:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++locale.h:
|
||||
|
||||
/usr/include/c++/4.2.1/clocale:
|
||||
|
||||
/usr/include/locale.h:
|
||||
|
||||
/usr/include/_locale.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cstring:
|
||||
|
||||
/usr/include/string.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cstdarg:
|
||||
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stdarg.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++io.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/gthr.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/gthr-default.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cctype:
|
||||
|
||||
/usr/include/ctype.h:
|
||||
|
||||
/usr/include/runetype.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stringfwd.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/postypes.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cwchar:
|
||||
|
||||
/usr/include/c++/4.2.1/ctime:
|
||||
|
||||
/usr/include/wchar.h:
|
||||
|
||||
/usr/include/_wctype.h:
|
||||
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stdint.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/functexcept.h:
|
||||
|
||||
/usr/include/c++/4.2.1/exception_defines.h:
|
||||
|
||||
/usr/include/c++/4.2.1/exception:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/char_traits.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_algobase.h:
|
||||
|
||||
/usr/include/c++/4.2.1/climits:
|
||||
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/limits.h:
|
||||
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/syslimits.h:
|
||||
|
||||
/usr/include/limits.h:
|
||||
|
||||
/usr/include/machine/limits.h:
|
||||
|
||||
/usr/include/i386/limits.h:
|
||||
|
||||
/usr/include/i386/_limits.h:
|
||||
|
||||
/usr/include/sys/syslimits.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cstdlib:
|
||||
|
||||
/usr/include/stdlib.h:
|
||||
|
||||
/usr/include/Availability.h:
|
||||
|
||||
/usr/include/AvailabilityInternal.h:
|
||||
|
||||
/usr/include/sys/wait.h:
|
||||
|
||||
/usr/include/sys/signal.h:
|
||||
|
||||
/usr/include/machine/signal.h:
|
||||
|
||||
/usr/include/i386/signal.h:
|
||||
|
||||
/usr/include/i386/_structs.h:
|
||||
|
||||
/usr/include/machine/_structs.h:
|
||||
|
||||
/usr/include/mach/i386/_structs.h:
|
||||
|
||||
/usr/include/sys/resource.h:
|
||||
|
||||
/usr/include/machine/endian.h:
|
||||
|
||||
/usr/include/i386/endian.h:
|
||||
|
||||
/usr/include/sys/_endian.h:
|
||||
|
||||
/usr/include/libkern/_OSByteOrder.h:
|
||||
|
||||
/usr/include/libkern/i386/_OSByteOrder.h:
|
||||
|
||||
/usr/include/alloca.h:
|
||||
|
||||
/usr/include/machine/types.h:
|
||||
|
||||
/usr/include/i386/types.h:
|
||||
|
||||
/usr/include/i386/_types.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_pair.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/cpp_type_traits.h:
|
||||
|
||||
/usr/include/c++/4.2.1/ext/type_traits.h:
|
||||
|
||||
/usr/include/c++/4.2.1/utility:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_relops.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_iterator_base_types.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_iterator_base_funcs.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/concept_check.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_iterator.h:
|
||||
|
||||
/usr/include/c++/4.2.1/debug/debug.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/localefwd.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/ios_base.h:
|
||||
|
||||
/usr/include/c++/4.2.1/ext/atomicity.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/atomic_word.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/locale_classes.h:
|
||||
|
||||
/usr/include/c++/4.2.1/string:
|
||||
|
||||
/usr/include/c++/4.2.1/memory:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/allocator.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++allocator.h:
|
||||
|
||||
/usr/include/c++/4.2.1/ext/new_allocator.h:
|
||||
|
||||
/usr/include/c++/4.2.1/new:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_construct.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_uninitialized.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_raw_storage_iter.h:
|
||||
|
||||
/usr/include/c++/4.2.1/limits:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/ostream_insert.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_function.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/basic_string.h:
|
||||
|
||||
/usr/include/c++/4.2.1/algorithm:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_algo.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_heap.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_tempbuf.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/basic_string.tcc:
|
||||
|
||||
/usr/include/c++/4.2.1/streambuf:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/streambuf.tcc:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/basic_ios.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/streambuf_iterator.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/locale_facets.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cwctype:
|
||||
|
||||
/usr/include/wctype.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/ctype_base.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/ctype_inline.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/codecvt.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/time_members.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/messages_members.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/basic_ios.tcc:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/ostream.tcc:
|
||||
|
||||
/usr/include/c++/4.2.1/locale:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/locale_facets.tcc:
|
||||
|
||||
/usr/include/c++/4.2.1/typeinfo:
|
||||
|
||||
/usr/include/c++/4.2.1/istream:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/istream.tcc:
|
||||
|
||||
/usr/include/assert.h:
|
||||
|
||||
Sockets.h:
|
||||
|
||||
/usr/include/arpa/inet.h:
|
||||
|
||||
/usr/include/netinet/in.h:
|
||||
|
||||
/usr/include/sys/socket.h:
|
||||
|
||||
/usr/include/sys/types.h:
|
||||
|
||||
/usr/include/machine/_param.h:
|
||||
|
||||
/usr/include/i386/_param.h:
|
||||
|
||||
/usr/include/netinet6/in6.h:
|
||||
|
||||
/usr/include/netdb.h:
|
||||
|
||||
/usr/include/sys/un.h:
|
||||
|
||||
/usr/include/errno.h:
|
||||
|
||||
/usr/include/sys/errno.h:
|
||||
|
||||
/usr/include/c++/4.2.1/list:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_list.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/list.tcc:
|
|
@ -0,0 +1 @@
|
|||
# dummy
|
|
@ -0,0 +1,374 @@
|
|||
Threads.lo .libs/Threads.o: Threads.cpp Threads.h /usr/include/pthread.h \
|
||||
/usr/include/_types.h /usr/include/sys/_types.h \
|
||||
/usr/include/sys/cdefs.h /usr/include/machine/_types.h \
|
||||
/usr/include/i386/_types.h /usr/include/pthread_impl.h \
|
||||
/usr/include/sched.h /usr/include/time.h /usr/include/_structs.h \
|
||||
/usr/include/sys/_structs.h /usr/include/c++/4.2.1/iostream \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++config.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/os_defines.h \
|
||||
/usr/include/unistd.h /usr/include/sys/unistd.h \
|
||||
/usr/include/sys/select.h /usr/include/sys/appleapiopts.h \
|
||||
/usr/include/sys/_select.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/cpu_defines.h \
|
||||
/usr/include/c++/4.2.1/ostream /usr/include/c++/4.2.1/ios \
|
||||
/usr/include/c++/4.2.1/iosfwd \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++locale.h \
|
||||
/usr/include/c++/4.2.1/clocale /usr/include/locale.h \
|
||||
/usr/include/_locale.h /usr/include/c++/4.2.1/cstring \
|
||||
/usr/include/c++/4.2.1/cstddef \
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stddef.h \
|
||||
/usr/include/string.h /usr/include/c++/4.2.1/cstdio \
|
||||
/usr/include/stdio.h /usr/include/c++/4.2.1/cstdarg \
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stdarg.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++io.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/gthr.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/gthr-default.h \
|
||||
/usr/include/c++/4.2.1/cctype /usr/include/ctype.h \
|
||||
/usr/include/runetype.h /usr/include/c++/4.2.1/bits/stringfwd.h \
|
||||
/usr/include/c++/4.2.1/bits/postypes.h /usr/include/c++/4.2.1/cwchar \
|
||||
/usr/include/c++/4.2.1/ctime /usr/include/wchar.h \
|
||||
/usr/include/_wctype.h \
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stdint.h \
|
||||
/usr/include/c++/4.2.1/bits/functexcept.h \
|
||||
/usr/include/c++/4.2.1/exception_defines.h \
|
||||
/usr/include/c++/4.2.1/exception \
|
||||
/usr/include/c++/4.2.1/bits/char_traits.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_algobase.h \
|
||||
/usr/include/c++/4.2.1/climits \
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/limits.h \
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/syslimits.h \
|
||||
/usr/include/limits.h /usr/include/machine/limits.h \
|
||||
/usr/include/i386/limits.h /usr/include/i386/_limits.h \
|
||||
/usr/include/sys/syslimits.h /usr/include/c++/4.2.1/cstdlib \
|
||||
/usr/include/stdlib.h /usr/include/Availability.h \
|
||||
/usr/include/AvailabilityInternal.h /usr/include/sys/wait.h \
|
||||
/usr/include/sys/signal.h /usr/include/machine/signal.h \
|
||||
/usr/include/i386/signal.h /usr/include/i386/_structs.h \
|
||||
/usr/include/machine/_structs.h /usr/include/mach/i386/_structs.h \
|
||||
/usr/include/sys/resource.h /usr/include/machine/endian.h \
|
||||
/usr/include/i386/endian.h /usr/include/sys/_endian.h \
|
||||
/usr/include/libkern/_OSByteOrder.h \
|
||||
/usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \
|
||||
/usr/include/machine/types.h /usr/include/i386/types.h \
|
||||
/usr/include/i386/_types.h /usr/include/c++/4.2.1/bits/stl_pair.h \
|
||||
/usr/include/c++/4.2.1/bits/cpp_type_traits.h \
|
||||
/usr/include/c++/4.2.1/ext/type_traits.h /usr/include/c++/4.2.1/utility \
|
||||
/usr/include/c++/4.2.1/bits/stl_relops.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_iterator_base_types.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_iterator_base_funcs.h \
|
||||
/usr/include/c++/4.2.1/bits/concept_check.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_iterator.h \
|
||||
/usr/include/c++/4.2.1/debug/debug.h \
|
||||
/usr/include/c++/4.2.1/bits/localefwd.h \
|
||||
/usr/include/c++/4.2.1/bits/ios_base.h \
|
||||
/usr/include/c++/4.2.1/ext/atomicity.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/atomic_word.h \
|
||||
/usr/include/c++/4.2.1/bits/locale_classes.h \
|
||||
/usr/include/c++/4.2.1/string /usr/include/c++/4.2.1/memory \
|
||||
/usr/include/c++/4.2.1/bits/allocator.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++allocator.h \
|
||||
/usr/include/c++/4.2.1/ext/new_allocator.h /usr/include/c++/4.2.1/new \
|
||||
/usr/include/c++/4.2.1/bits/stl_construct.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_uninitialized.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_raw_storage_iter.h \
|
||||
/usr/include/c++/4.2.1/limits \
|
||||
/usr/include/c++/4.2.1/bits/ostream_insert.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_function.h \
|
||||
/usr/include/c++/4.2.1/bits/basic_string.h \
|
||||
/usr/include/c++/4.2.1/algorithm /usr/include/c++/4.2.1/bits/stl_algo.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_heap.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_tempbuf.h \
|
||||
/usr/include/c++/4.2.1/bits/basic_string.tcc \
|
||||
/usr/include/c++/4.2.1/streambuf \
|
||||
/usr/include/c++/4.2.1/bits/streambuf.tcc \
|
||||
/usr/include/c++/4.2.1/bits/basic_ios.h \
|
||||
/usr/include/c++/4.2.1/bits/streambuf_iterator.h \
|
||||
/usr/include/c++/4.2.1/bits/locale_facets.h \
|
||||
/usr/include/c++/4.2.1/cwctype /usr/include/wctype.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/ctype_base.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/ctype_inline.h \
|
||||
/usr/include/c++/4.2.1/bits/codecvt.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/time_members.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/messages_members.h \
|
||||
/usr/include/c++/4.2.1/bits/basic_ios.tcc \
|
||||
/usr/include/c++/4.2.1/bits/ostream.tcc /usr/include/c++/4.2.1/locale \
|
||||
/usr/include/c++/4.2.1/bits/locale_facets.tcc \
|
||||
/usr/include/c++/4.2.1/typeinfo /usr/include/c++/4.2.1/istream \
|
||||
/usr/include/c++/4.2.1/bits/istream.tcc /usr/include/assert.h Timeval.h \
|
||||
/usr/include/sys/time.h
|
||||
|
||||
Threads.h:
|
||||
|
||||
/usr/include/pthread.h:
|
||||
|
||||
/usr/include/_types.h:
|
||||
|
||||
/usr/include/sys/_types.h:
|
||||
|
||||
/usr/include/sys/cdefs.h:
|
||||
|
||||
/usr/include/machine/_types.h:
|
||||
|
||||
/usr/include/i386/_types.h:
|
||||
|
||||
/usr/include/pthread_impl.h:
|
||||
|
||||
/usr/include/sched.h:
|
||||
|
||||
/usr/include/time.h:
|
||||
|
||||
/usr/include/_structs.h:
|
||||
|
||||
/usr/include/sys/_structs.h:
|
||||
|
||||
/usr/include/c++/4.2.1/iostream:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++config.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/os_defines.h:
|
||||
|
||||
/usr/include/unistd.h:
|
||||
|
||||
/usr/include/sys/unistd.h:
|
||||
|
||||
/usr/include/sys/select.h:
|
||||
|
||||
/usr/include/sys/appleapiopts.h:
|
||||
|
||||
/usr/include/sys/_select.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/cpu_defines.h:
|
||||
|
||||
/usr/include/c++/4.2.1/ostream:
|
||||
|
||||
/usr/include/c++/4.2.1/ios:
|
||||
|
||||
/usr/include/c++/4.2.1/iosfwd:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++locale.h:
|
||||
|
||||
/usr/include/c++/4.2.1/clocale:
|
||||
|
||||
/usr/include/locale.h:
|
||||
|
||||
/usr/include/_locale.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cstring:
|
||||
|
||||
/usr/include/c++/4.2.1/cstddef:
|
||||
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stddef.h:
|
||||
|
||||
/usr/include/string.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cstdio:
|
||||
|
||||
/usr/include/stdio.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cstdarg:
|
||||
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stdarg.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++io.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/gthr.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/gthr-default.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cctype:
|
||||
|
||||
/usr/include/ctype.h:
|
||||
|
||||
/usr/include/runetype.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stringfwd.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/postypes.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cwchar:
|
||||
|
||||
/usr/include/c++/4.2.1/ctime:
|
||||
|
||||
/usr/include/wchar.h:
|
||||
|
||||
/usr/include/_wctype.h:
|
||||
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stdint.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/functexcept.h:
|
||||
|
||||
/usr/include/c++/4.2.1/exception_defines.h:
|
||||
|
||||
/usr/include/c++/4.2.1/exception:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/char_traits.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_algobase.h:
|
||||
|
||||
/usr/include/c++/4.2.1/climits:
|
||||
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/limits.h:
|
||||
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/syslimits.h:
|
||||
|
||||
/usr/include/limits.h:
|
||||
|
||||
/usr/include/machine/limits.h:
|
||||
|
||||
/usr/include/i386/limits.h:
|
||||
|
||||
/usr/include/i386/_limits.h:
|
||||
|
||||
/usr/include/sys/syslimits.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cstdlib:
|
||||
|
||||
/usr/include/stdlib.h:
|
||||
|
||||
/usr/include/Availability.h:
|
||||
|
||||
/usr/include/AvailabilityInternal.h:
|
||||
|
||||
/usr/include/sys/wait.h:
|
||||
|
||||
/usr/include/sys/signal.h:
|
||||
|
||||
/usr/include/machine/signal.h:
|
||||
|
||||
/usr/include/i386/signal.h:
|
||||
|
||||
/usr/include/i386/_structs.h:
|
||||
|
||||
/usr/include/machine/_structs.h:
|
||||
|
||||
/usr/include/mach/i386/_structs.h:
|
||||
|
||||
/usr/include/sys/resource.h:
|
||||
|
||||
/usr/include/machine/endian.h:
|
||||
|
||||
/usr/include/i386/endian.h:
|
||||
|
||||
/usr/include/sys/_endian.h:
|
||||
|
||||
/usr/include/libkern/_OSByteOrder.h:
|
||||
|
||||
/usr/include/libkern/i386/_OSByteOrder.h:
|
||||
|
||||
/usr/include/alloca.h:
|
||||
|
||||
/usr/include/machine/types.h:
|
||||
|
||||
/usr/include/i386/types.h:
|
||||
|
||||
/usr/include/i386/_types.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_pair.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/cpp_type_traits.h:
|
||||
|
||||
/usr/include/c++/4.2.1/ext/type_traits.h:
|
||||
|
||||
/usr/include/c++/4.2.1/utility:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_relops.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_iterator_base_types.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_iterator_base_funcs.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/concept_check.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_iterator.h:
|
||||
|
||||
/usr/include/c++/4.2.1/debug/debug.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/localefwd.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/ios_base.h:
|
||||
|
||||
/usr/include/c++/4.2.1/ext/atomicity.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/atomic_word.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/locale_classes.h:
|
||||
|
||||
/usr/include/c++/4.2.1/string:
|
||||
|
||||
/usr/include/c++/4.2.1/memory:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/allocator.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++allocator.h:
|
||||
|
||||
/usr/include/c++/4.2.1/ext/new_allocator.h:
|
||||
|
||||
/usr/include/c++/4.2.1/new:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_construct.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_uninitialized.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_raw_storage_iter.h:
|
||||
|
||||
/usr/include/c++/4.2.1/limits:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/ostream_insert.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_function.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/basic_string.h:
|
||||
|
||||
/usr/include/c++/4.2.1/algorithm:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_algo.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_heap.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_tempbuf.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/basic_string.tcc:
|
||||
|
||||
/usr/include/c++/4.2.1/streambuf:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/streambuf.tcc:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/basic_ios.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/streambuf_iterator.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/locale_facets.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cwctype:
|
||||
|
||||
/usr/include/wctype.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/ctype_base.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/ctype_inline.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/codecvt.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/time_members.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/messages_members.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/basic_ios.tcc:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/ostream.tcc:
|
||||
|
||||
/usr/include/c++/4.2.1/locale:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/locale_facets.tcc:
|
||||
|
||||
/usr/include/c++/4.2.1/typeinfo:
|
||||
|
||||
/usr/include/c++/4.2.1/istream:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/istream.tcc:
|
||||
|
||||
/usr/include/assert.h:
|
||||
|
||||
Timeval.h:
|
||||
|
||||
/usr/include/sys/time.h:
|
|
@ -0,0 +1,368 @@
|
|||
Timeval.lo .libs/Timeval.o: Timeval.cpp Timeval.h \
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stdint.h \
|
||||
/usr/include/sys/time.h /usr/include/sys/cdefs.h \
|
||||
/usr/include/sys/_types.h /usr/include/machine/_types.h \
|
||||
/usr/include/i386/_types.h /usr/include/sys/_structs.h \
|
||||
/usr/include/time.h /usr/include/_types.h /usr/include/_structs.h \
|
||||
/usr/include/sys/_select.h /usr/include/c++/4.2.1/iostream \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++config.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/os_defines.h \
|
||||
/usr/include/unistd.h /usr/include/sys/unistd.h \
|
||||
/usr/include/sys/select.h /usr/include/sys/appleapiopts.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/cpu_defines.h \
|
||||
/usr/include/c++/4.2.1/ostream /usr/include/c++/4.2.1/ios \
|
||||
/usr/include/c++/4.2.1/iosfwd \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++locale.h \
|
||||
/usr/include/c++/4.2.1/clocale /usr/include/locale.h \
|
||||
/usr/include/_locale.h /usr/include/c++/4.2.1/cstring \
|
||||
/usr/include/c++/4.2.1/cstddef \
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stddef.h \
|
||||
/usr/include/string.h /usr/include/c++/4.2.1/cstdio \
|
||||
/usr/include/stdio.h /usr/include/c++/4.2.1/cstdarg \
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stdarg.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++io.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/gthr.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/gthr-default.h \
|
||||
/usr/include/pthread.h /usr/include/pthread_impl.h /usr/include/sched.h \
|
||||
/usr/include/c++/4.2.1/cctype /usr/include/ctype.h \
|
||||
/usr/include/runetype.h /usr/include/c++/4.2.1/bits/stringfwd.h \
|
||||
/usr/include/c++/4.2.1/bits/postypes.h /usr/include/c++/4.2.1/cwchar \
|
||||
/usr/include/c++/4.2.1/ctime /usr/include/wchar.h \
|
||||
/usr/include/_wctype.h /usr/include/c++/4.2.1/bits/functexcept.h \
|
||||
/usr/include/c++/4.2.1/exception_defines.h \
|
||||
/usr/include/c++/4.2.1/exception \
|
||||
/usr/include/c++/4.2.1/bits/char_traits.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_algobase.h \
|
||||
/usr/include/c++/4.2.1/climits \
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/limits.h \
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/syslimits.h \
|
||||
/usr/include/limits.h /usr/include/machine/limits.h \
|
||||
/usr/include/i386/limits.h /usr/include/i386/_limits.h \
|
||||
/usr/include/sys/syslimits.h /usr/include/c++/4.2.1/cstdlib \
|
||||
/usr/include/stdlib.h /usr/include/Availability.h \
|
||||
/usr/include/AvailabilityInternal.h /usr/include/sys/wait.h \
|
||||
/usr/include/sys/signal.h /usr/include/machine/signal.h \
|
||||
/usr/include/i386/signal.h /usr/include/i386/_structs.h \
|
||||
/usr/include/machine/_structs.h /usr/include/mach/i386/_structs.h \
|
||||
/usr/include/sys/resource.h /usr/include/machine/endian.h \
|
||||
/usr/include/i386/endian.h /usr/include/sys/_endian.h \
|
||||
/usr/include/libkern/_OSByteOrder.h \
|
||||
/usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \
|
||||
/usr/include/machine/types.h /usr/include/i386/types.h \
|
||||
/usr/include/i386/_types.h /usr/include/c++/4.2.1/bits/stl_pair.h \
|
||||
/usr/include/c++/4.2.1/bits/cpp_type_traits.h \
|
||||
/usr/include/c++/4.2.1/ext/type_traits.h /usr/include/c++/4.2.1/utility \
|
||||
/usr/include/c++/4.2.1/bits/stl_relops.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_iterator_base_types.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_iterator_base_funcs.h \
|
||||
/usr/include/c++/4.2.1/bits/concept_check.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_iterator.h \
|
||||
/usr/include/c++/4.2.1/debug/debug.h \
|
||||
/usr/include/c++/4.2.1/bits/localefwd.h \
|
||||
/usr/include/c++/4.2.1/bits/ios_base.h \
|
||||
/usr/include/c++/4.2.1/ext/atomicity.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/atomic_word.h \
|
||||
/usr/include/c++/4.2.1/bits/locale_classes.h \
|
||||
/usr/include/c++/4.2.1/string /usr/include/c++/4.2.1/memory \
|
||||
/usr/include/c++/4.2.1/bits/allocator.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++allocator.h \
|
||||
/usr/include/c++/4.2.1/ext/new_allocator.h /usr/include/c++/4.2.1/new \
|
||||
/usr/include/c++/4.2.1/bits/stl_construct.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_uninitialized.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_raw_storage_iter.h \
|
||||
/usr/include/c++/4.2.1/limits \
|
||||
/usr/include/c++/4.2.1/bits/ostream_insert.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_function.h \
|
||||
/usr/include/c++/4.2.1/bits/basic_string.h \
|
||||
/usr/include/c++/4.2.1/algorithm /usr/include/c++/4.2.1/bits/stl_algo.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_heap.h \
|
||||
/usr/include/c++/4.2.1/bits/stl_tempbuf.h \
|
||||
/usr/include/c++/4.2.1/bits/basic_string.tcc \
|
||||
/usr/include/c++/4.2.1/streambuf \
|
||||
/usr/include/c++/4.2.1/bits/streambuf.tcc \
|
||||
/usr/include/c++/4.2.1/bits/basic_ios.h \
|
||||
/usr/include/c++/4.2.1/bits/streambuf_iterator.h \
|
||||
/usr/include/c++/4.2.1/bits/locale_facets.h \
|
||||
/usr/include/c++/4.2.1/cwctype /usr/include/wctype.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/ctype_base.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/ctype_inline.h \
|
||||
/usr/include/c++/4.2.1/bits/codecvt.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/time_members.h \
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/messages_members.h \
|
||||
/usr/include/c++/4.2.1/bits/basic_ios.tcc \
|
||||
/usr/include/c++/4.2.1/bits/ostream.tcc /usr/include/c++/4.2.1/locale \
|
||||
/usr/include/c++/4.2.1/bits/locale_facets.tcc \
|
||||
/usr/include/c++/4.2.1/typeinfo /usr/include/c++/4.2.1/istream \
|
||||
/usr/include/c++/4.2.1/bits/istream.tcc
|
||||
|
||||
Timeval.h:
|
||||
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stdint.h:
|
||||
|
||||
/usr/include/sys/time.h:
|
||||
|
||||
/usr/include/sys/cdefs.h:
|
||||
|
||||
/usr/include/sys/_types.h:
|
||||
|
||||
/usr/include/machine/_types.h:
|
||||
|
||||
/usr/include/i386/_types.h:
|
||||
|
||||
/usr/include/sys/_structs.h:
|
||||
|
||||
/usr/include/time.h:
|
||||
|
||||
/usr/include/_types.h:
|
||||
|
||||
/usr/include/_structs.h:
|
||||
|
||||
/usr/include/sys/_select.h:
|
||||
|
||||
/usr/include/c++/4.2.1/iostream:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++config.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/os_defines.h:
|
||||
|
||||
/usr/include/unistd.h:
|
||||
|
||||
/usr/include/sys/unistd.h:
|
||||
|
||||
/usr/include/sys/select.h:
|
||||
|
||||
/usr/include/sys/appleapiopts.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/cpu_defines.h:
|
||||
|
||||
/usr/include/c++/4.2.1/ostream:
|
||||
|
||||
/usr/include/c++/4.2.1/ios:
|
||||
|
||||
/usr/include/c++/4.2.1/iosfwd:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++locale.h:
|
||||
|
||||
/usr/include/c++/4.2.1/clocale:
|
||||
|
||||
/usr/include/locale.h:
|
||||
|
||||
/usr/include/_locale.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cstring:
|
||||
|
||||
/usr/include/c++/4.2.1/cstddef:
|
||||
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stddef.h:
|
||||
|
||||
/usr/include/string.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cstdio:
|
||||
|
||||
/usr/include/stdio.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cstdarg:
|
||||
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stdarg.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++io.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/gthr.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/gthr-default.h:
|
||||
|
||||
/usr/include/pthread.h:
|
||||
|
||||
/usr/include/pthread_impl.h:
|
||||
|
||||
/usr/include/sched.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cctype:
|
||||
|
||||
/usr/include/ctype.h:
|
||||
|
||||
/usr/include/runetype.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stringfwd.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/postypes.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cwchar:
|
||||
|
||||
/usr/include/c++/4.2.1/ctime:
|
||||
|
||||
/usr/include/wchar.h:
|
||||
|
||||
/usr/include/_wctype.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/functexcept.h:
|
||||
|
||||
/usr/include/c++/4.2.1/exception_defines.h:
|
||||
|
||||
/usr/include/c++/4.2.1/exception:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/char_traits.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_algobase.h:
|
||||
|
||||
/usr/include/c++/4.2.1/climits:
|
||||
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/limits.h:
|
||||
|
||||
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/syslimits.h:
|
||||
|
||||
/usr/include/limits.h:
|
||||
|
||||
/usr/include/machine/limits.h:
|
||||
|
||||
/usr/include/i386/limits.h:
|
||||
|
||||
/usr/include/i386/_limits.h:
|
||||
|
||||
/usr/include/sys/syslimits.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cstdlib:
|
||||
|
||||
/usr/include/stdlib.h:
|
||||
|
||||
/usr/include/Availability.h:
|
||||
|
||||
/usr/include/AvailabilityInternal.h:
|
||||
|
||||
/usr/include/sys/wait.h:
|
||||
|
||||
/usr/include/sys/signal.h:
|
||||
|
||||
/usr/include/machine/signal.h:
|
||||
|
||||
/usr/include/i386/signal.h:
|
||||
|
||||
/usr/include/i386/_structs.h:
|
||||
|
||||
/usr/include/machine/_structs.h:
|
||||
|
||||
/usr/include/mach/i386/_structs.h:
|
||||
|
||||
/usr/include/sys/resource.h:
|
||||
|
||||
/usr/include/machine/endian.h:
|
||||
|
||||
/usr/include/i386/endian.h:
|
||||
|
||||
/usr/include/sys/_endian.h:
|
||||
|
||||
/usr/include/libkern/_OSByteOrder.h:
|
||||
|
||||
/usr/include/libkern/i386/_OSByteOrder.h:
|
||||
|
||||
/usr/include/alloca.h:
|
||||
|
||||
/usr/include/machine/types.h:
|
||||
|
||||
/usr/include/i386/types.h:
|
||||
|
||||
/usr/include/i386/_types.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_pair.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/cpp_type_traits.h:
|
||||
|
||||
/usr/include/c++/4.2.1/ext/type_traits.h:
|
||||
|
||||
/usr/include/c++/4.2.1/utility:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_relops.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_iterator_base_types.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_iterator_base_funcs.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/concept_check.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_iterator.h:
|
||||
|
||||
/usr/include/c++/4.2.1/debug/debug.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/localefwd.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/ios_base.h:
|
||||
|
||||
/usr/include/c++/4.2.1/ext/atomicity.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/atomic_word.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/locale_classes.h:
|
||||
|
||||
/usr/include/c++/4.2.1/string:
|
||||
|
||||
/usr/include/c++/4.2.1/memory:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/allocator.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++allocator.h:
|
||||
|
||||
/usr/include/c++/4.2.1/ext/new_allocator.h:
|
||||
|
||||
/usr/include/c++/4.2.1/new:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_construct.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_uninitialized.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_raw_storage_iter.h:
|
||||
|
||||
/usr/include/c++/4.2.1/limits:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/ostream_insert.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_function.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/basic_string.h:
|
||||
|
||||
/usr/include/c++/4.2.1/algorithm:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_algo.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_heap.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/stl_tempbuf.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/basic_string.tcc:
|
||||
|
||||
/usr/include/c++/4.2.1/streambuf:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/streambuf.tcc:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/basic_ios.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/streambuf_iterator.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/locale_facets.h:
|
||||
|
||||
/usr/include/c++/4.2.1/cwctype:
|
||||
|
||||
/usr/include/wctype.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/ctype_base.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/ctype_inline.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/codecvt.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/time_members.h:
|
||||
|
||||
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/messages_members.h:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/basic_ios.tcc:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/ostream.tcc:
|
||||
|
||||
/usr/include/c++/4.2.1/locale:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/locale_facets.tcc:
|
||||
|
||||
/usr/include/c++/4.2.1/typeinfo:
|
||||
|
||||
/usr/include/c++/4.2.1/istream:
|
||||
|
||||
/usr/include/c++/4.2.1/bits/istream.tcc:
|
|
@ -0,0 +1 @@
|
|||
# dummy
|
|
@ -0,0 +1 @@
|
|||
# dummy
|
|
@ -0,0 +1,603 @@
|
|||
/*
|
||||
* Copyright 2008, 2009 Free Software Foundation, Inc.
|
||||
*
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "BitVector.h"
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
/**
|
||||
Apply a Galois polymonial to a binary seqeunce.
|
||||
@param val The input sequence.
|
||||
@param poly The polynomial.
|
||||
@param order The order of the polynomial.
|
||||
@return Single-bit result.
|
||||
*/
|
||||
unsigned applyPoly(uint64_t val, uint64_t poly, unsigned order)
|
||||
{
|
||||
uint64_t prod = val & poly;
|
||||
unsigned sum = prod;
|
||||
for (unsigned i=1; i<order; i++) sum ^= prod>>i;
|
||||
return sum & 0x01;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BitVector::BitVector(const char *valString)
|
||||
:Vector<char>(strlen(valString))
|
||||
{
|
||||
uint32_t accum = 0;
|
||||
for (size_t i=0; i<size(); i++) {
|
||||
accum <<= 1;
|
||||
if (valString[i]=='1') accum |= 0x01;
|
||||
mStart[i] = accum;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
uint64_t BitVector::peekField(size_t readIndex, unsigned length) const
|
||||
{
|
||||
uint64_t accum = 0;
|
||||
char *dp = mStart + readIndex;
|
||||
assert(dp+length <= mEnd);
|
||||
for (unsigned i=0; i<length; i++) {
|
||||
accum = (accum<<1) | ((*dp++) & 0x01);
|
||||
}
|
||||
return accum;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
uint64_t BitVector::peekFieldReversed(size_t readIndex, unsigned length) const
|
||||
{
|
||||
uint64_t accum = 0;
|
||||
char *dp = mStart + readIndex + length - 1;
|
||||
assert(dp<mEnd);
|
||||
for (int i=(length-1); i>=0; i--) {
|
||||
accum = (accum<<1) | ((*dp--) & 0x01);
|
||||
}
|
||||
return accum;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
uint64_t BitVector::readField(size_t& readIndex, unsigned length) const
|
||||
{
|
||||
const uint64_t retVal = peekField(readIndex,length);
|
||||
readIndex += length;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
uint64_t BitVector::readFieldReversed(size_t& readIndex, unsigned length) const
|
||||
{
|
||||
const uint64_t retVal = peekFieldReversed(readIndex,length);
|
||||
readIndex += length;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void BitVector::fillField(size_t writeIndex, uint64_t value, unsigned length)
|
||||
{
|
||||
char *dpBase = mStart + writeIndex;
|
||||
char *dp = dpBase + length - 1;
|
||||
assert(dp < mEnd);
|
||||
while (dp>=dpBase) {
|
||||
*dp-- = value & 0x01;
|
||||
value >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BitVector::fillFieldReversed(size_t writeIndex, uint64_t value, unsigned length)
|
||||
{
|
||||
char *dp = mStart + writeIndex;
|
||||
char *dpEnd = dp + length - 1;
|
||||
assert(dpEnd < mEnd);
|
||||
while (dp<=dpEnd) {
|
||||
*dp++ = value & 0x01;
|
||||
value >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void BitVector::writeField(size_t& writeIndex, uint64_t value, unsigned length)
|
||||
{
|
||||
fillField(writeIndex,value,length);
|
||||
writeIndex += length;
|
||||
}
|
||||
|
||||
|
||||
void BitVector::writeFieldReversed(size_t& writeIndex, uint64_t value, unsigned length)
|
||||
{
|
||||
fillFieldReversed(writeIndex,value,length);
|
||||
writeIndex += length;
|
||||
}
|
||||
|
||||
|
||||
void BitVector::invert()
|
||||
{
|
||||
for (size_t i=0; i<size(); i++) {
|
||||
mStart[i] = ~mStart[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void BitVector::reverse8()
|
||||
{
|
||||
assert(size()>=8);
|
||||
|
||||
char tmp0 = mStart[0];
|
||||
mStart[0] = mStart[7];
|
||||
mStart[7] = tmp0;
|
||||
|
||||
char tmp1 = mStart[1];
|
||||
mStart[1] = mStart[6];
|
||||
mStart[6] = tmp1;
|
||||
|
||||
char tmp2 = mStart[2];
|
||||
mStart[2] = mStart[5];
|
||||
mStart[5] = tmp2;
|
||||
|
||||
char tmp3 = mStart[3];
|
||||
mStart[3] = mStart[4];
|
||||
mStart[4] = tmp3;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BitVector::LSB8MSB()
|
||||
{
|
||||
if (size()<8) return;
|
||||
size_t size8 = 8*(size()/8);
|
||||
size_t iTop = size8 - 8;
|
||||
for (size_t i=0; i<=iTop; i+=8) segment(i,8).reverse8();
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint64_t BitVector::syndrome(Generator& gen) const
|
||||
{
|
||||
gen.clear();
|
||||
const char *dp = mStart;
|
||||
while (dp<mEnd) gen.syndromeShift(*dp++);
|
||||
return gen.state();
|
||||
}
|
||||
|
||||
|
||||
uint64_t BitVector::parity(Generator& gen) const
|
||||
{
|
||||
gen.clear();
|
||||
const char *dp = mStart;
|
||||
while (dp<mEnd) gen.encoderShift(*dp++);
|
||||
return gen.state();
|
||||
}
|
||||
|
||||
|
||||
void BitVector::encode(const ViterbiR2O4& coder, BitVector& target)
|
||||
{
|
||||
size_t sz = size();
|
||||
assert(sz*coder.iRate() == target.size());
|
||||
|
||||
// Build a "history" array where each element contains the full history.
|
||||
uint32_t history[sz];
|
||||
uint32_t accum = 0;
|
||||
for (size_t i=0; i<sz; i++) {
|
||||
accum = (accum<<1) | bit(i);
|
||||
history[i] = accum;
|
||||
}
|
||||
|
||||
// Look up histories in the pre-generated state table.
|
||||
char *op = target.begin();
|
||||
for (size_t i=0; i<sz; i++) {
|
||||
unsigned index = coder.cMask() & history[i];
|
||||
for (unsigned g=0; g<coder.iRate(); g++) {
|
||||
*op++ = coder.stateTable(g,index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned BitVector::sum() const
|
||||
{
|
||||
unsigned sum = 0;
|
||||
for (size_t i=0; i<size(); i++) sum += mStart[i] & 0x01;
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void BitVector::map(const unsigned *map, size_t mapSize, BitVector& dest) const
|
||||
{
|
||||
for (unsigned i=0; i<mapSize; i++) {
|
||||
dest.mStart[i] = mStart[map[i]];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void BitVector::unmap(const unsigned *map, size_t mapSize, BitVector& dest) const
|
||||
{
|
||||
for (unsigned i=0; i<mapSize; i++) {
|
||||
dest.mStart[map[i]] = mStart[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ostream& operator<<(ostream& os, const BitVector& hv)
|
||||
{
|
||||
for (size_t i=0; i<hv.size(); i++) {
|
||||
if (hv.bit(i)) os << '1';
|
||||
else os << '0';
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ViterbiR2O4::ViterbiR2O4()
|
||||
{
|
||||
assert(mDeferral < 32);
|
||||
mCoeffs[0] = 0x019;
|
||||
mCoeffs[1] = 0x01b;
|
||||
computeStateTables(0);
|
||||
computeStateTables(1);
|
||||
computeGeneratorTable();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ViterbiR2O4::initializeStates()
|
||||
{
|
||||
for (unsigned i=0; i<mIStates; i++) clear(mSurvivors[i]);
|
||||
for (unsigned i=0; i<mNumCands; i++) clear(mCandidates[i]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ViterbiR2O4::computeStateTables(unsigned g)
|
||||
{
|
||||
assert(g<mIRate);
|
||||
for (unsigned state=0; state<mIStates; state++) {
|
||||
// 0 input
|
||||
uint32_t inputVal = state<<1;
|
||||
mStateTable[g][inputVal] = applyPoly(inputVal, mCoeffs[g], mOrder+1);
|
||||
// 1 input
|
||||
inputVal |= 1;
|
||||
mStateTable[g][inputVal] = applyPoly(inputVal, mCoeffs[g], mOrder+1);
|
||||
}
|
||||
}
|
||||
|
||||
void ViterbiR2O4::computeGeneratorTable()
|
||||
{
|
||||
for (unsigned index=0; index<mIStates*2; index++) {
|
||||
mGeneratorTable[index] = (mStateTable[0][index]<<1) | mStateTable[1][index];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ViterbiR2O4::branchCandidates()
|
||||
{
|
||||
// Branch to generate new input states.
|
||||
const vCand *sp = mSurvivors;
|
||||
for (unsigned i=0; i<mNumCands; i+=2) {
|
||||
// extend and suffix
|
||||
const uint32_t iState0 = (sp->iState) << 1; // input state for 0
|
||||
const uint32_t iState1 = iState0 | 0x01; // input state for 1
|
||||
const uint32_t oStateShifted = (sp->oState) << mIRate; // shifted output
|
||||
const float cost = sp->cost;
|
||||
sp++;
|
||||
// 0 input extension
|
||||
mCandidates[i].cost = cost;
|
||||
mCandidates[i].oState = oStateShifted | mGeneratorTable[iState0 & mCMask];
|
||||
mCandidates[i].iState = iState0;
|
||||
// 1 input extension
|
||||
mCandidates[i+1].cost = cost;
|
||||
mCandidates[i+1].oState = oStateShifted | mGeneratorTable[iState1 & mCMask];
|
||||
mCandidates[i+1].iState = iState1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ViterbiR2O4::getSoftCostMetrics(const uint32_t inSample, const float *matchCost, const float *mismatchCost)
|
||||
{
|
||||
const float *cTab[2] = {matchCost,mismatchCost};
|
||||
for (unsigned i=0; i<mNumCands; i++) {
|
||||
vCand& thisCand = mCandidates[i];
|
||||
// We examine input bits 2 at a time for a rate 1/2 coder.
|
||||
const unsigned mismatched = inSample ^ (thisCand.oState);
|
||||
thisCand.cost += cTab[mismatched&0x01][1] + cTab[(mismatched>>1)&0x01][0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ViterbiR2O4::pruneCandidates()
|
||||
{
|
||||
const vCand* c1 = mCandidates; // 0-prefix
|
||||
const vCand* c2 = mCandidates + mIStates; // 1-prefix
|
||||
for (unsigned i=0; i<mIStates; i++) {
|
||||
if (c1[i].cost < c2[i].cost) mSurvivors[i] = c1[i];
|
||||
else mSurvivors[i] = c2[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const ViterbiR2O4::vCand& ViterbiR2O4::minCost() const
|
||||
{
|
||||
int minIndex = 0;
|
||||
float minCost = mSurvivors[0].cost;
|
||||
for (unsigned i=1; i<mIStates; i++) {
|
||||
const float thisCost = mSurvivors[i].cost;
|
||||
if (thisCost>=minCost) continue;
|
||||
minCost = thisCost;
|
||||
minIndex=i;
|
||||
}
|
||||
return mSurvivors[minIndex];
|
||||
}
|
||||
|
||||
|
||||
const ViterbiR2O4::vCand& ViterbiR2O4::step(uint32_t inSample, const float *probs, const float *iprobs)
|
||||
{
|
||||
branchCandidates();
|
||||
getSoftCostMetrics(inSample,probs,iprobs);
|
||||
pruneCandidates();
|
||||
return minCost();
|
||||
}
|
||||
|
||||
|
||||
uint64_t Parity::syndrome(const BitVector& receivedCodeword)
|
||||
{
|
||||
return receivedCodeword.syndrome(*this);
|
||||
}
|
||||
|
||||
|
||||
void Parity::writeParityWord(const BitVector& data, BitVector& parityTarget, bool invert)
|
||||
{
|
||||
uint64_t pWord = data.parity(*this);
|
||||
if (invert) pWord = ~pWord;
|
||||
parityTarget.fillField(0,pWord,size());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
SoftVector::SoftVector(const BitVector& source)
|
||||
{
|
||||
resize(source.size());
|
||||
for (size_t i=0; i<size(); i++) {
|
||||
if (source.bit(i)) mStart[i]=1.0F;
|
||||
else mStart[i]=0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BitVector SoftVector::sliced() const
|
||||
{
|
||||
size_t sz = size();
|
||||
BitVector newSig(sz);
|
||||
for (size_t i=0; i<sz; i++) {
|
||||
if (mStart[i]>0.5F) newSig[i]=1;
|
||||
else newSig[i] = 0;
|
||||
}
|
||||
return newSig;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SoftVector::decode(ViterbiR2O4 &decoder, BitVector& target) const
|
||||
{
|
||||
const size_t sz = size();
|
||||
const unsigned deferral = decoder.deferral();
|
||||
const size_t ctsz = sz + deferral*decoder.iRate();
|
||||
assert(sz <= decoder.iRate()*target.size());
|
||||
|
||||
// Build a "history" array where each element contains the full history.
|
||||
uint32_t history[ctsz];
|
||||
{
|
||||
BitVector bits = sliced();
|
||||
uint32_t accum = 0;
|
||||
for (size_t i=0; i<sz; i++) {
|
||||
accum = (accum<<1) | bits.bit(i);
|
||||
history[i] = accum;
|
||||
}
|
||||
// Repeat last bit at the end.
|
||||
for (size_t i=sz; i<ctsz; i++) {
|
||||
accum = (accum<<1) | (accum & 0x01);
|
||||
history[i] = accum;
|
||||
}
|
||||
}
|
||||
|
||||
// Precompute metric tables.
|
||||
float matchCostTable[ctsz];
|
||||
float mismatchCostTable[ctsz];
|
||||
{
|
||||
const float *dp = mStart;
|
||||
for (size_t i=0; i<sz; i++) {
|
||||
// pVal is the probability that a bit is correct.
|
||||
// ipVal is the probability that a bit is incorrect.
|
||||
float pVal = dp[i];
|
||||
if (pVal>0.5F) pVal = 1.0F-pVal;
|
||||
float ipVal = 1.0F-pVal;
|
||||
// This is a cheap approximation to an ideal cost function.
|
||||
if (pVal<0.01F) pVal = 0.01;
|
||||
if (ipVal<0.01F) ipVal = 0.01;
|
||||
matchCostTable[i] = 0.25F/ipVal;
|
||||
mismatchCostTable[i] = 0.25F/pVal;
|
||||
}
|
||||
|
||||
// pad end of table with unknowns
|
||||
for (size_t i=sz; i<ctsz; i++) {
|
||||
matchCostTable[i] = 0.5F;
|
||||
mismatchCostTable[i] = 0.5F;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
decoder.initializeStates();
|
||||
// Each sample of history[] carries its history.
|
||||
// So we only have to process every iRate-th sample.
|
||||
const unsigned step = decoder.iRate();
|
||||
// input pointer
|
||||
const uint32_t *ip = history + step - 1;
|
||||
// output pointers
|
||||
char *op = target.begin();
|
||||
const char *const opt = target.end();
|
||||
// table pointers
|
||||
const float* match = matchCostTable;
|
||||
const float* mismatch = mismatchCostTable;
|
||||
size_t oCount = 0;
|
||||
while (op<opt) {
|
||||
// Viterbi algorithm
|
||||
assert(match-matchCostTable<sizeof(matchCostTable)/sizeof(matchCostTable[0])-1);
|
||||
assert(mismatch-mismatchCostTable<sizeof(mismatchCostTable)/sizeof(mismatchCostTable[0])-1);
|
||||
const ViterbiR2O4::vCand &minCost = decoder.step(*ip, match, mismatch);
|
||||
ip += step;
|
||||
match += step;
|
||||
mismatch += step;
|
||||
// output
|
||||
if (oCount>=deferral) *op++ = (minCost.iState >> deferral)&0x01;
|
||||
oCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ostream& operator<<(ostream& os, const SoftVector& sv)
|
||||
{
|
||||
for (size_t i=0; i<sv.size(); i++) {
|
||||
if (sv[i]<0.25) os << "0";
|
||||
else if (sv[i]>0.75) os << "1";
|
||||
else os << "-";
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BitVector::pack(unsigned char* targ) const
|
||||
{
|
||||
// Assumes MSB-first packing.
|
||||
unsigned bytes = size()/8;
|
||||
for (unsigned i=0; i<bytes; i++) {
|
||||
targ[i] = peekField(i*8,8);
|
||||
}
|
||||
unsigned whole = bytes*8;
|
||||
unsigned rem = size() - whole;
|
||||
if (rem==0) return;
|
||||
targ[bytes] = peekField(whole,rem) << (8-rem);
|
||||
}
|
||||
|
||||
|
||||
void BitVector::unpack(const unsigned char* src)
|
||||
{
|
||||
// Assumes MSB-first packing.
|
||||
unsigned bytes = size()/8;
|
||||
for (unsigned i=0; i<bytes; i++) {
|
||||
fillField(i*8,src[i],8);
|
||||
}
|
||||
unsigned whole = bytes*8;
|
||||
unsigned rem = size() - whole;
|
||||
if (rem==0) return;
|
||||
fillField(whole,src[bytes],rem);
|
||||
}
|
||||
|
||||
void BitVector::hex(ostream& os) const
|
||||
{
|
||||
os << std::hex;
|
||||
unsigned digits = size()/4;
|
||||
size_t wp=0;
|
||||
for (unsigned i=0; i<digits; i++) {
|
||||
os << readField(wp,4);
|
||||
}
|
||||
os << std::dec;
|
||||
}
|
||||
|
||||
bool BitVector::unhex(const char* src)
|
||||
{
|
||||
// Assumes MSB-first packing.
|
||||
unsigned int val;
|
||||
unsigned digits = size()/4;
|
||||
for (unsigned i=0; i<digits; i++) {
|
||||
if (sscanf(src+i, "%1x", &val) < 1) {
|
||||
return false;
|
||||
}
|
||||
fillField(i*4,val,4);
|
||||
}
|
||||
unsigned whole = digits*4;
|
||||
unsigned rem = size() - whole;
|
||||
if (rem>0) {
|
||||
if (sscanf(src+digits, "%1x", &val) < 1) {
|
||||
return false;
|
||||
}
|
||||
fillField(whole,val,rem);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// vim: ts=4 sw=4
|
|
@ -0,0 +1,441 @@
|
|||
/*
|
||||
* Copyright 2008, 2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FECVECTORS_H
|
||||
#define FECVECTORS_H
|
||||
|
||||
#include "Vector.h"
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
class BitVector;
|
||||
class SoftVector;
|
||||
|
||||
|
||||
|
||||
/** Shift-register (LFSR) generator. */
|
||||
class Generator {
|
||||
|
||||
private:
|
||||
|
||||
uint64_t mCoeff; ///< polynomial coefficients. LSB is zero exponent.
|
||||
uint64_t mState; ///< shift register state. LSB is most recent.
|
||||
uint64_t mMask; ///< mask for reading state
|
||||
unsigned mLen; ///< number of bits used in shift register
|
||||
unsigned mLen_1; ///< mLen - 1
|
||||
|
||||
public:
|
||||
|
||||
Generator(uint64_t wCoeff, unsigned wLen)
|
||||
:mCoeff(wCoeff),mState(0),
|
||||
mMask((1ULL<<wLen)-1),
|
||||
mLen(wLen),mLen_1(wLen-1)
|
||||
{ assert(wLen<64); }
|
||||
|
||||
void clear() { mState=0; }
|
||||
|
||||
/**@name Accessors */
|
||||
//@{
|
||||
uint64_t state() const { return mState & mMask; }
|
||||
unsigned size() const { return mLen; }
|
||||
//@}
|
||||
|
||||
/**
|
||||
Calculate one bit of a syndrome.
|
||||
This is in the .h for inlining.
|
||||
*/
|
||||
void syndromeShift(unsigned inBit)
|
||||
{
|
||||
const unsigned fb = (mState>>(mLen_1)) & 0x01;
|
||||
mState = (mState<<1) ^ (inBit & 0x01);
|
||||
if (fb) mState ^= mCoeff;
|
||||
}
|
||||
|
||||
/**
|
||||
Update the generator state by one cycle.
|
||||
This is in the .h for inlining.
|
||||
*/
|
||||
void encoderShift(unsigned inBit)
|
||||
{
|
||||
const unsigned fb = ((mState>>(mLen_1)) ^ inBit) & 0x01;
|
||||
mState <<= 1;
|
||||
if (fb) mState ^= mCoeff;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/** Parity (CRC-type) generator and checker based on a Generator. */
|
||||
class Parity : public Generator {
|
||||
|
||||
protected:
|
||||
|
||||
unsigned mCodewordSize;
|
||||
|
||||
public:
|
||||
|
||||
Parity(uint64_t wCoefficients, unsigned wParitySize, unsigned wCodewordSize)
|
||||
:Generator(wCoefficients, wParitySize),
|
||||
mCodewordSize(wCodewordSize)
|
||||
{ }
|
||||
|
||||
/** Compute the parity word and write it into the target segment. */
|
||||
void writeParityWord(const BitVector& data, BitVector& parityWordTarget, bool invert=true);
|
||||
|
||||
/** Compute the syndrome of a received sequence. */
|
||||
uint64_t syndrome(const BitVector& receivedCodeword);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Class to represent convolutional coders/decoders of rate 1/2, memory length 4.
|
||||
This is the "workhorse" coder for most GSM channels.
|
||||
*/
|
||||
class ViterbiR2O4 {
|
||||
|
||||
private:
|
||||
/**name Lots of precomputed elements so the compiler can optimize like hell. */
|
||||
//@{
|
||||
/**@name Core values. */
|
||||
//@{
|
||||
static const unsigned mIRate = 2; ///< reciprocal of rate
|
||||
static const unsigned mOrder = 4; ///< memory length of generators
|
||||
//@}
|
||||
/**@name Derived values. */
|
||||
//@{
|
||||
static const unsigned mIStates = 0x01 << mOrder; ///< number of states, number of survivors
|
||||
static const uint32_t mSMask = mIStates-1; ///< survivor mask
|
||||
static const uint32_t mCMask = (mSMask<<1) | 0x01; ///< candidate mask
|
||||
static const uint32_t mOMask = (0x01<<mIRate)-1; ///< ouput mask, all iRate low bits set
|
||||
static const unsigned mNumCands = mIStates*2; ///< number of candidates to generate during branching
|
||||
static const unsigned mDeferral = 6*mOrder; ///< deferral to be used
|
||||
//@}
|
||||
//@}
|
||||
|
||||
/** Precomputed tables. */
|
||||
//@{
|
||||
uint32_t mCoeffs[mIRate]; ///< polynomial for each generator
|
||||
uint32_t mStateTable[mIRate][2*mIStates]; ///< precomputed generator output tables
|
||||
uint32_t mGeneratorTable[2*mIStates]; ///< precomputed coder output table
|
||||
//@}
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
A candidate sequence in a Viterbi decoder.
|
||||
The 32-bit state register can support a deferral of 6 with a 4th-order coder.
|
||||
*/
|
||||
typedef struct candStruct {
|
||||
uint32_t iState; ///< encoder input associated with this candidate
|
||||
uint32_t oState; ///< encoder output associated with this candidate
|
||||
float cost; ///< cost (metric value), float to support soft inputs
|
||||
} vCand;
|
||||
|
||||
/** Clear a structure. */
|
||||
void clear(vCand& v)
|
||||
{
|
||||
v.iState=0;
|
||||
v.oState=0;
|
||||
v.cost=0;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/**@name Survivors and candidates. */
|
||||
//@{
|
||||
vCand mSurvivors[mIStates]; ///< current survivor pool
|
||||
vCand mCandidates[2*mIStates]; ///< current candidate pool
|
||||
//@}
|
||||
|
||||
public:
|
||||
|
||||
unsigned iRate() const { return mIRate; }
|
||||
uint32_t cMask() const { return mCMask; }
|
||||
uint32_t stateTable(unsigned g, unsigned i) const { return mStateTable[g][i]; }
|
||||
unsigned deferral() const { return mDeferral; }
|
||||
|
||||
|
||||
ViterbiR2O4();
|
||||
|
||||
/** Set all cost metrics to zero. */
|
||||
void initializeStates();
|
||||
|
||||
/**
|
||||
Full cycle of the Viterbi algorithm: branch, metrics, prune, select.
|
||||
@return reference to minimum-cost candidate.
|
||||
*/
|
||||
const vCand& step(uint32_t inSample, const float *probs, const float *iprobs);
|
||||
|
||||
private:
|
||||
|
||||
/** Branch survivors into new candidates. */
|
||||
void branchCandidates();
|
||||
|
||||
/** Compute cost metrics for soft-inputs. */
|
||||
void getSoftCostMetrics(uint32_t inSample, const float *probs, const float *iprobs);
|
||||
|
||||
/** Select survivors from the candidate set. */
|
||||
void pruneCandidates();
|
||||
|
||||
/** Find the minimum cost survivor. */
|
||||
const vCand& minCost() const;
|
||||
|
||||
/**
|
||||
Precompute the state tables.
|
||||
@param g Generator index 0..((1/rate)-1)
|
||||
*/
|
||||
void computeStateTables(unsigned g);
|
||||
|
||||
/**
|
||||
Precompute the generator outputs.
|
||||
mCoeffs must be defined first.
|
||||
*/
|
||||
void computeGeneratorTable();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class BitVector : public Vector<char> {
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/**@name Constructors. */
|
||||
//@{
|
||||
|
||||
/**@name Casts of Vector constructors. */
|
||||
//@{
|
||||
BitVector(char* wData, char* wStart, char* wEnd)
|
||||
:Vector<char>(wData,wStart,wEnd)
|
||||
{ }
|
||||
BitVector(size_t len=0):Vector<char>(len) {}
|
||||
BitVector(const Vector<char>& source):Vector<char>(source) {}
|
||||
BitVector(Vector<char>& source):Vector<char>(source) {}
|
||||
BitVector(const Vector<char>& source1, const Vector<char> source2):Vector<char>(source1,source2) {}
|
||||
//@}
|
||||
|
||||
/** Construct from a string of "0" and "1". */
|
||||
BitVector(const char* valString);
|
||||
//@}
|
||||
|
||||
/** Index a single bit. */
|
||||
bool bit(size_t index) const
|
||||
{
|
||||
// We put this code in .h for fast inlining.
|
||||
const char *dp = mStart+index;
|
||||
assert(dp<mEnd);
|
||||
return (*dp) & 0x01;
|
||||
}
|
||||
|
||||
/**@name Casts and overrides of Vector operators. */
|
||||
//@{
|
||||
BitVector segment(size_t start, size_t span)
|
||||
{
|
||||
char* wStart = mStart + start;
|
||||
char* wEnd = wStart + span;
|
||||
assert(wEnd<=mEnd);
|
||||
return BitVector(NULL,wStart,wEnd);
|
||||
}
|
||||
|
||||
BitVector alias()
|
||||
{ return segment(0,size()); }
|
||||
|
||||
const BitVector segment(size_t start, size_t span) const
|
||||
{ return (BitVector)(Vector<char>::segment(start,span)); }
|
||||
|
||||
BitVector head(size_t span) { return segment(0,span); }
|
||||
const BitVector head(size_t span) const { return segment(0,span); }
|
||||
BitVector tail(size_t start) { return segment(start,size()-start); }
|
||||
const BitVector tail(size_t start) const { return segment(start,size()-start); }
|
||||
//@}
|
||||
|
||||
|
||||
void zero() { fill(0); }
|
||||
|
||||
/**@name FEC operations. */
|
||||
//@{
|
||||
/** Calculate the syndrome of the vector with the given Generator. */
|
||||
uint64_t syndrome(Generator& gen) const;
|
||||
/** Calculate the parity word for the vector with the given Generator. */
|
||||
uint64_t parity(Generator& gen) const;
|
||||
/** Encode the signal with the GSM rate 1/2 convolutional encoder. */
|
||||
void encode(const ViterbiR2O4& encoder, BitVector& target);
|
||||
//@}
|
||||
|
||||
|
||||
/** Invert 0<->1. */
|
||||
void invert();
|
||||
|
||||
/**@name Byte-wise operations. */
|
||||
//@{
|
||||
/** Reverse an 8-bit vector. */
|
||||
void reverse8();
|
||||
/** Reverse groups of 8 within the vector (byte reversal). */
|
||||
void LSB8MSB();
|
||||
//@}
|
||||
|
||||
/**@name Serialization and deserialization. */
|
||||
//@{
|
||||
uint64_t peekField(size_t readIndex, unsigned length) const;
|
||||
uint64_t peekFieldReversed(size_t readIndex, unsigned length) const;
|
||||
uint64_t readField(size_t& readIndex, unsigned length) const;
|
||||
uint64_t readFieldReversed(size_t& readIndex, unsigned length) const;
|
||||
void fillField(size_t writeIndex, uint64_t value, unsigned length);
|
||||
void fillFieldReversed(size_t writeIndex, uint64_t value, unsigned length);
|
||||
void writeField(size_t& writeIndex, uint64_t value, unsigned length);
|
||||
void writeFieldReversed(size_t& writeIndex, uint64_t value, unsigned length);
|
||||
//@}
|
||||
|
||||
/** Sum of bits. */
|
||||
unsigned sum() const;
|
||||
|
||||
/** Reorder bits, dest[i] = this[map[i]]. */
|
||||
void map(const unsigned *map, size_t mapSize, BitVector& dest) const;
|
||||
|
||||
/** Reorder bits, dest[map[i]] = this[i]. */
|
||||
void unmap(const unsigned *map, size_t mapSize, BitVector& dest) const;
|
||||
|
||||
/** Pack into a char array. */
|
||||
void pack(unsigned char*) const;
|
||||
|
||||
/** Unpack from a char array. */
|
||||
void unpack(const unsigned char*);
|
||||
|
||||
/** Make a hexdump string. */
|
||||
void hex(std::ostream&) const;
|
||||
|
||||
/** Unpack from a hexdump string.
|
||||
* @returns true on success, false on error. */
|
||||
bool unhex(const char*);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
std::ostream& operator<<(std::ostream&, const BitVector&);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
The SoftVector class is used to represent a soft-decision signal.
|
||||
Values 0..1 represent probabilities that a bit is "true".
|
||||
*/
|
||||
class SoftVector: public Vector<float> {
|
||||
|
||||
public:
|
||||
|
||||
/** Build a SoftVector of a given length. */
|
||||
SoftVector(size_t wSize=0):Vector<float>(wSize) {}
|
||||
|
||||
/** Construct a SoftVector from a C string of "0", "1", and "X". */
|
||||
SoftVector(const char* valString);
|
||||
|
||||
/** Construct a SoftVector from a BitVector. */
|
||||
SoftVector(const BitVector& source);
|
||||
|
||||
/**
|
||||
Wrap a SoftVector around a block of floats.
|
||||
The block will be delete[]ed upon desctuction.
|
||||
*/
|
||||
SoftVector(float *wData, unsigned length)
|
||||
:Vector<float>(wData,length)
|
||||
{}
|
||||
|
||||
SoftVector(float* wData, float* wStart, float* wEnd)
|
||||
:Vector<float>(wData,wStart,wEnd)
|
||||
{ }
|
||||
|
||||
/**
|
||||
Casting from a Vector<float>.
|
||||
Note that this is NOT pass-by-reference.
|
||||
*/
|
||||
SoftVector(Vector<float> source)
|
||||
:Vector<float>(source)
|
||||
{}
|
||||
|
||||
|
||||
/**@name Casts and overrides of Vector operators. */
|
||||
//@{
|
||||
SoftVector segment(size_t start, size_t span)
|
||||
{
|
||||
float* wStart = mStart + start;
|
||||
float* wEnd = wStart + span;
|
||||
assert(wEnd<=mEnd);
|
||||
return SoftVector(NULL,wStart,wEnd);
|
||||
}
|
||||
|
||||
SoftVector alias()
|
||||
{ return segment(0,size()); }
|
||||
|
||||
const SoftVector segment(size_t start, size_t span) const
|
||||
{ return (SoftVector)(Vector<float>::segment(start,span)); }
|
||||
|
||||
SoftVector head(size_t span) { return segment(0,span); }
|
||||
const SoftVector head(size_t span) const { return segment(0,span); }
|
||||
SoftVector tail(size_t start) { return segment(start,size()-start); }
|
||||
const SoftVector tail(size_t start) const { return segment(start,size()-start); }
|
||||
//@}
|
||||
|
||||
/** Decode soft symbols with the GSM rate-1/2 Viterbi decoder. */
|
||||
void decode(ViterbiR2O4 &decoder, BitVector& target) const;
|
||||
|
||||
/** Fill with "unknown" values. */
|
||||
void unknown() { fill(0.5F); }
|
||||
|
||||
/** Return a hard bit value from a given index by slicing. */
|
||||
bool bit(size_t index) const
|
||||
{
|
||||
const float *dp = mStart+index;
|
||||
assert(dp<mEnd);
|
||||
return (*dp)>0.5F;
|
||||
}
|
||||
|
||||
/** Slice the whole signal into bits. */
|
||||
BitVector sliced() const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
std::ostream& operator<<(std::ostream&, const SoftVector&);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
// vim: ts=4 sw=4
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* Copyright 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "BitVector.h"
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
BitVector v1("0000111100111100101011110000");
|
||||
cout << v1 << endl;
|
||||
v1.LSB8MSB();
|
||||
cout << v1 << endl;
|
||||
ViterbiR2O4 vCoder;
|
||||
BitVector v2(v1.size()*2);
|
||||
v1.encode(vCoder,v2);
|
||||
cout << v2 << endl;
|
||||
SoftVector sv2(v2);
|
||||
cout << sv2 << endl;
|
||||
for (unsigned i=0; i<sv2.size()/4; i++) sv2[random()%sv2.size()]=0.5;
|
||||
cout << sv2 << endl;
|
||||
BitVector v3(v1.size());
|
||||
sv2.decode(vCoder,v3);
|
||||
cout << v3 << endl;
|
||||
|
||||
cout << v3.segment(3,4) << endl;
|
||||
|
||||
BitVector v4(v3.segment(0,4),v3.segment(8,4));
|
||||
cout << v4 << endl;
|
||||
|
||||
BitVector v5("000011110000");
|
||||
int r1 = v5.peekField(0,8);
|
||||
int r2 = v5.peekField(4,4);
|
||||
int r3 = v5.peekField(4,8);
|
||||
cout << r1 << ' ' << r2 << ' ' << r3 << endl;
|
||||
cout << v5 << endl;
|
||||
v5.fillField(0,0xa,4);
|
||||
int r4 = v5.peekField(0,8);
|
||||
cout << v5 << endl;
|
||||
cout << r4 << endl;
|
||||
|
||||
v5.reverse8();
|
||||
cout << v5 << endl;
|
||||
|
||||
BitVector mC = "000000000000111100000000000001110000011100001101000011000000000000000111000011110000100100001010000010100000101000001010000010100000010000000000000000000000000000000000000000000000001100001111000000000000000000000000000000000000000000000000000010010000101000001010000010100000101000001010000001000000000000000000000000110000111100000000000001110000101000001100000001000000000000";
|
||||
SoftVector mCS(mC);
|
||||
BitVector mU(mC.size()/2);
|
||||
mCS.decode(vCoder,mU);
|
||||
cout << "c=" << mCS << endl;
|
||||
cout << "u=" << mU << endl;
|
||||
|
||||
|
||||
unsigned char ts[9] = "abcdefgh";
|
||||
BitVector tp(70);
|
||||
cout << "ts=" << ts << endl;
|
||||
tp.unpack(ts);
|
||||
cout << "tp=" << tp << endl;
|
||||
tp.pack(ts);
|
||||
cout << "ts=" << ts << endl;
|
||||
}
|
|
@ -0,0 +1,724 @@
|
|||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
|
||||
=========================================================================
|
||||
|
||||
This marks the end of the AGPLv3 text. The following text is appended to the
|
||||
same file for convience but constituting a distinct document, not part of the
|
||||
actual AGPL text and not part of an attempt to create a deriviative work based
|
||||
on the AGPLv3 text.
|
||||
|
||||
=========================================================================
|
||||
|
||||
|
||||
ADDITIONAL TERMS TO THE AGPLv3 LICENSE FOR OPENBTS
|
||||
|
||||
|
||||
Permissive Terms Supplementing the License
|
||||
|
||||
1. Remote Interaction Through IP Networks.
|
||||
|
||||
OpenBTS includes an implementation of the GSM network cellular air interface,
|
||||
as well as other interfaces to IP networks. The interaction of cellular
|
||||
handsets with the OpenBTS software is considered "remote network interaction"
|
||||
for the purposes of the Affero General Public License and cellular users are
|
||||
subject to the source code access requirements of Section 13 of AGPLv3 ("Remote
|
||||
Network Interaction; Use with the GNU General Public License").
|
||||
|
||||
Remote interactions through interfaces other than the GSM air interface are, at
|
||||
your option, exempted from the requirements of Section 13 ("Remote Network
|
||||
Interaction; Use with the GNU General Public License"). This exemption of
|
||||
interfaces other than the GSM air interface from the requirements of Section 13
|
||||
is an additional permission granted to you.
|
||||
|
||||
|
||||
Non-Permissive Terms Supplementing The License
|
||||
|
||||
1. Trademarks.
|
||||
|
||||
"OpenBTS" is a trademark of Kestrel Signal Processing, Inc., registered with
|
||||
the US Patent and Trademark Office. Your use of OpenBTS software under a GPL
|
||||
license does not include the right to use the OpenBTS trademark in commerce.
|
||||
This additional non-permissive term is consistent with Section 7 of the AGPLv3
|
||||
license.
|
||||
|
||||
|
||||
END OF ADDITIONAL TERMS
|
||||
|
||||
|
||||
|
||||
How to comply with Section 13 of the AGPLv3 license.
|
||||
|
||||
The recommended method for compliance with Section 13 of the AGPLv3 license is
|
||||
to deliver a text message to each handset that attaches to the OpenBTS cellular
|
||||
network. At a minimum, that text message should include the string "OpenBTS
|
||||
AGPLv3" and a URL that can be used to access the OpenBTS source code. This
|
||||
message need not be delivered to handsets that are denied registration with the
|
||||
network, since those handsets have been denied service.
|
||||
|
||||
In OpenBTS 2.6, such text messages can be delivered with the "Welcome Message"
|
||||
feature. See the OpenBTS.config.example file for more information on the use of
|
||||
this feature for AGPLv3 compliance.
|
||||
|
|
@ -0,0 +1,339 @@
|
|||
/*
|
||||
* Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
* Copyright 2010 Kestrel Signal Processing, Inc.
|
||||
*
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "Configuration.h"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
static const char* createConfigTable = {
|
||||
"CREATE TABLE IF NOT EXISTS CONFIG ("
|
||||
"KEYSTRING TEXT UNIQUE NOT NULL, "
|
||||
"VALUESTRING TEXT, "
|
||||
"STATIC INTEGER DEFAULT 0, "
|
||||
"OPTIONAL INTEGER DEFAULT 0, "
|
||||
"COMMENTS TEXT DEFAULT ''"
|
||||
")"
|
||||
};
|
||||
|
||||
|
||||
ConfigurationTable::ConfigurationTable(const char* filename)
|
||||
{
|
||||
// Connect to the database.
|
||||
int rc = sqlite3_open(filename,&mDB);
|
||||
if (rc) {
|
||||
cerr << "Cannot open configuration database: " << sqlite3_errmsg(mDB);
|
||||
sqlite3_close(mDB);
|
||||
mDB = NULL;
|
||||
return;
|
||||
}
|
||||
// Create the table, if needed.
|
||||
if (!sqlite3_command(mDB,createConfigTable)) {
|
||||
cerr << "Cannot create configuration table:" << sqlite3_errmsg(mDB);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool ConfigurationTable::defines(const string& key)
|
||||
{
|
||||
assert(mDB);
|
||||
ScopedLock lock(mLock);
|
||||
|
||||
// Check the cache.
|
||||
checkCacheAge();
|
||||
ConfigurationMap::const_iterator where = mCache.find(key);
|
||||
if (where!=mCache.end()) return where->second.defined();
|
||||
|
||||
// Check the database.
|
||||
char *value = NULL;
|
||||
sqlite3_single_lookup(mDB,"CONFIG","KEYSTRING",key.c_str(),"VALUESTRING",value);
|
||||
|
||||
// Cache the result.
|
||||
if (value) {
|
||||
mCache[key] = ConfigurationRecord(value);
|
||||
free(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
mCache[key] = ConfigurationRecord(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const ConfigurationRecord& ConfigurationTable::lookup(const string& key)
|
||||
{
|
||||
assert(mDB);
|
||||
checkCacheAge();
|
||||
// We assume the caller holds mLock.
|
||||
// So it is OK to return a reference into the cache.
|
||||
|
||||
// Check the cache.
|
||||
// This is cheap.
|
||||
ConfigurationMap::const_iterator where = mCache.find(key);
|
||||
if (where!=mCache.end()) {
|
||||
if (where->second.defined()) return where->second;
|
||||
// Unlock the mutex before throwing the exception.
|
||||
mLock.unlock();
|
||||
syslog(LOG_ALERT, "configuration key %s not found", key.c_str());
|
||||
throw ConfigurationTableKeyNotFound(key);
|
||||
}
|
||||
|
||||
// Check the database.
|
||||
// This is more expensive.
|
||||
char *value = NULL;
|
||||
sqlite3_single_lookup(mDB,"CONFIG",
|
||||
"KEYSTRING",key.c_str(),"VALUESTRING",value);
|
||||
|
||||
// Nothing defined?
|
||||
if (!value) {
|
||||
// Cache the failure.
|
||||
mCache[key] = ConfigurationRecord(false);
|
||||
// Unlock the mutex before throwing the exception.
|
||||
mLock.unlock();
|
||||
throw ConfigurationTableKeyNotFound(key);
|
||||
}
|
||||
|
||||
// Cache the result.
|
||||
mCache[key] = ConfigurationRecord(value);
|
||||
free(value);
|
||||
|
||||
// Leave mLock locked. The caller holds it still.
|
||||
return mCache[key];
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool ConfigurationTable::isStatic(const string& key) const
|
||||
{
|
||||
assert(mDB);
|
||||
unsigned stat;
|
||||
bool success = sqlite3_single_lookup(mDB,"CONFIG","KEYSTRING",key.c_str(),"STATIC",stat);
|
||||
if (success) return (bool)stat;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ConfigurationTable::isRequired(const string& key) const
|
||||
{
|
||||
assert(mDB);
|
||||
unsigned optional;
|
||||
bool success = sqlite3_single_lookup(mDB,"CONFIG","KEYSTRING",key.c_str(),"OPTIONAL",optional);
|
||||
if (success) return !((bool)optional);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
string ConfigurationTable::getStr(const string& key)
|
||||
{
|
||||
// We need the lock because rec is a reference into the cache.
|
||||
ScopedLock lock(mLock);
|
||||
return lookup(key).value();
|
||||
}
|
||||
|
||||
string ConfigurationTable::getStr(const string& key, const char* defaultValue)
|
||||
{
|
||||
try {
|
||||
return getStr(key);
|
||||
} catch (ConfigurationTableKeyNotFound) {
|
||||
set(key,defaultValue);
|
||||
return string(defaultValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
long ConfigurationTable::getNum(const string& key)
|
||||
{
|
||||
// We need the lock because rec is a reference into the cache.
|
||||
ScopedLock lock(mLock);
|
||||
return lookup(key).number();
|
||||
}
|
||||
|
||||
|
||||
long ConfigurationTable::getNum(const string& key, long defaultValue)
|
||||
{
|
||||
try {
|
||||
return getNum(key);
|
||||
} catch (ConfigurationTableKeyNotFound) {
|
||||
set(key,defaultValue);
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::vector<unsigned> ConfigurationTable::getVector(const string& key)
|
||||
{
|
||||
// Look up the string.
|
||||
mLock.lock();
|
||||
const ConfigurationRecord& rec = lookup(key);
|
||||
char* line = strdup(rec.value().c_str());
|
||||
mLock.unlock();
|
||||
// Parse the string.
|
||||
std::vector<unsigned> retVal;
|
||||
char *lp=line;
|
||||
while (lp) {
|
||||
// Watch for multiple or trailing spaces.
|
||||
while (*lp==' ') lp++;
|
||||
if (*lp=='\0') break;
|
||||
retVal.push_back(strtol(lp,NULL,0));
|
||||
strsep(&lp," ");
|
||||
}
|
||||
free(line);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
bool ConfigurationTable::unset(const string& key)
|
||||
{
|
||||
assert(mDB);
|
||||
if (!defines(key)) return true;
|
||||
if (isRequired(key)) return false;
|
||||
|
||||
ScopedLock lock(mLock);
|
||||
// Clear the cache entry and the database.
|
||||
ConfigurationMap::iterator where = mCache.find(key);
|
||||
if (where!=mCache.end()) mCache.erase(where);
|
||||
// Don't delete it; just set VALUESTRING to NULL.
|
||||
string cmd = "UPDATE CONFIG SET VALUESTRING=NULL WHERE KEYSTRING=='"+key+"'";
|
||||
return sqlite3_command(mDB,cmd.c_str());
|
||||
}
|
||||
|
||||
|
||||
void ConfigurationTable::find(const string& pat, ostream& os) const
|
||||
{
|
||||
// Prepare the statement.
|
||||
string cmd = "SELECT KEYSTRING,VALUESTRING FROM CONFIG WHERE KEYSTRING LIKE \"%" + pat + "%\"";
|
||||
sqlite3_stmt *stmt;
|
||||
if (sqlite3_prepare_statement(mDB,&stmt,cmd.c_str())) return;
|
||||
// Read the result.
|
||||
int src = sqlite3_run_query(mDB,stmt);
|
||||
while (src==SQLITE_ROW) {
|
||||
const char* value = (const char*)sqlite3_column_text(stmt,1);
|
||||
os << sqlite3_column_text(stmt,0) << " ";
|
||||
if (value) os << value << endl;
|
||||
else os << "(null)" << endl;
|
||||
src = sqlite3_run_query(mDB,stmt);
|
||||
}
|
||||
sqlite3_finalize(stmt);
|
||||
}
|
||||
|
||||
|
||||
bool ConfigurationTable::set(const string& key, const string& value)
|
||||
{
|
||||
assert(mDB);
|
||||
ScopedLock lock(mLock);
|
||||
// Is it there already?
|
||||
char * oldValue = NULL;
|
||||
bool exists = sqlite3_single_lookup(mDB,"CONFIG","KEYSTRING",key.c_str(),"VALUESTRING",oldValue);
|
||||
// Update or insert as appropriate.
|
||||
string cmd;
|
||||
if (exists) cmd = "UPDATE CONFIG SET VALUESTRING=\""+value+"\" WHERE KEYSTRING==\""+key+"\"";
|
||||
else cmd = "INSERT INTO CONFIG (KEYSTRING,VALUESTRING,OPTIONAL) VALUES (\"" + key + "\",\"" + value + "\",1)";
|
||||
bool success = sqlite3_command(mDB,cmd.c_str());
|
||||
// Cache the result.
|
||||
if (success) mCache[key] = ConfigurationRecord(value);
|
||||
return success;
|
||||
}
|
||||
|
||||
bool ConfigurationTable::set(const string& key, long value)
|
||||
{
|
||||
char buffer[30];
|
||||
sprintf(buffer,"%ld",value);
|
||||
return set(key,buffer);
|
||||
}
|
||||
|
||||
|
||||
bool ConfigurationTable::set(const string& key)
|
||||
{
|
||||
assert(mDB);
|
||||
ScopedLock lock(mLock);
|
||||
string cmd = "INSERT INTO CONFIG (KEYSTRING) VALUES (\"" + key + "\")";
|
||||
bool success = sqlite3_command(mDB,cmd.c_str());
|
||||
if (success) mCache[key] = ConfigurationRecord(true);
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
void ConfigurationTable::checkCacheAge()
|
||||
{
|
||||
// mLock is set by caller
|
||||
static time_t timeOfLastPurge = 0;
|
||||
time_t now = time(NULL);
|
||||
// purge every 3 seconds
|
||||
// purge period cannot be configuration parameter
|
||||
if (now - timeOfLastPurge < 3) return;
|
||||
timeOfLastPurge = now;
|
||||
// this is purge() without the lock
|
||||
ConfigurationMap::iterator mp = mCache.begin();
|
||||
while (mp != mCache.end()) {
|
||||
ConfigurationMap::iterator prev = mp;
|
||||
mp++;
|
||||
mCache.erase(prev);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ConfigurationTable::purge()
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
ConfigurationMap::iterator mp = mCache.begin();
|
||||
while (mp != mCache.end()) {
|
||||
ConfigurationMap::iterator prev = mp;
|
||||
mp++;
|
||||
mCache.erase(prev);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ConfigurationTable::setUpdateHook(void(*func)(void *,int ,char const *,char const *,sqlite3_int64))
|
||||
{
|
||||
assert(mDB);
|
||||
sqlite3_update_hook(mDB,func,NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void HashString::computeHash()
|
||||
{
|
||||
// FIXME -- Someone needs to review this hash function.
|
||||
const char* cstr = c_str();
|
||||
mHash = 0;
|
||||
for (unsigned i=0; i<size(); i++) {
|
||||
mHash = mHash ^ (mHash >> 32);
|
||||
mHash = mHash*127 + cstr[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// vim: ts=4 sw=4
|
|
@ -0,0 +1,275 @@
|
|||
/*
|
||||
* Copyright 2009, 2010 Free Software Foundation, Inc.
|
||||
* Copyright 2010 Kestrel Signal Processing, Inc.
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CONFIGURATION_H
|
||||
#define CONFIGURATION_H
|
||||
|
||||
|
||||
#include "sqlite3util.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include <Threads.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
/** A class for configuration file errors. */
|
||||
class ConfigurationTableError {};
|
||||
|
||||
/** An exception thrown when a given config key isn't found. */
|
||||
class ConfigurationTableKeyNotFound : public ConfigurationTableError {
|
||||
|
||||
private:
|
||||
|
||||
std::string mKey;
|
||||
|
||||
public:
|
||||
|
||||
ConfigurationTableKeyNotFound(const std::string& wKey)
|
||||
:mKey(wKey)
|
||||
{ std::cerr << "cannot find configuration value " << mKey << std::endl; }
|
||||
|
||||
const std::string& key() const { return mKey; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
class ConfigurationRecord {
|
||||
|
||||
private:
|
||||
|
||||
std::string mValue;
|
||||
long mNumber;
|
||||
bool mDefined;
|
||||
|
||||
public:
|
||||
|
||||
ConfigurationRecord(bool wDefined=true):
|
||||
mDefined(wDefined)
|
||||
{ }
|
||||
|
||||
ConfigurationRecord(const std::string& wValue):
|
||||
mValue(wValue),
|
||||
mNumber(strtol(wValue.c_str(),NULL,0)),
|
||||
mDefined(true)
|
||||
{ }
|
||||
|
||||
ConfigurationRecord(const char* wValue):
|
||||
mValue(std::string(wValue)),
|
||||
mNumber(strtol(wValue,NULL,0)),
|
||||
mDefined(true)
|
||||
{ }
|
||||
|
||||
|
||||
const std::string& value() const { return mValue; }
|
||||
long number() const { return mNumber; }
|
||||
bool defined() const { return mDefined; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
/** A string class that uses a hash function for comparison. */
|
||||
class HashString : public std::string {
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
uint64_t mHash;
|
||||
|
||||
void computeHash();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
HashString(const char* src)
|
||||
:std::string(src)
|
||||
{
|
||||
computeHash();
|
||||
}
|
||||
|
||||
HashString(const std::string& src)
|
||||
:std::string(src)
|
||||
{
|
||||
computeHash();
|
||||
}
|
||||
|
||||
HashString()
|
||||
{
|
||||
mHash=0;
|
||||
}
|
||||
|
||||
HashString& operator=(std::string& src)
|
||||
{
|
||||
std::string::operator=(src);
|
||||
computeHash();
|
||||
return *this;
|
||||
}
|
||||
|
||||
HashString& operator=(const char* src)
|
||||
{
|
||||
std::string::operator=(src);
|
||||
computeHash();
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator==(const HashString& other)
|
||||
{
|
||||
return mHash==other.mHash;
|
||||
}
|
||||
|
||||
bool operator<(const HashString& other)
|
||||
{
|
||||
return mHash<other.mHash;
|
||||
}
|
||||
|
||||
bool operator>(const HashString& other)
|
||||
{
|
||||
return mHash<other.mHash;
|
||||
}
|
||||
|
||||
uint64_t hash() const { return mHash; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
typedef std::map<HashString, ConfigurationRecord> ConfigurationMap;
|
||||
|
||||
|
||||
/**
|
||||
A class for maintaining a configuration key-value table,
|
||||
based on sqlite3 and a local map-based cache.
|
||||
Thread-safe, too.
|
||||
*/
|
||||
class ConfigurationTable {
|
||||
|
||||
private:
|
||||
|
||||
sqlite3* mDB; ///< database connection
|
||||
ConfigurationMap mCache; ///< cache of recently access configuration values
|
||||
mutable Mutex mLock; ///< control for multithreaded access to the cache
|
||||
|
||||
public:
|
||||
|
||||
|
||||
ConfigurationTable(const char* filename = ":memory:");
|
||||
|
||||
/** Return true if the key is used in the table. */
|
||||
bool defines(const std::string& key);
|
||||
|
||||
/** Return true if this key is identified as static. */
|
||||
bool isStatic(const std::string& key) const;
|
||||
|
||||
/** Return true if this key is identified as required (!optional). */
|
||||
bool isRequired(const std::string& key) const;
|
||||
|
||||
/**
|
||||
Get a string parameter from the table.
|
||||
Throw ConfigurationTableKeyNotFound if not found.
|
||||
*/
|
||||
std::string getStr(const std::string& key);
|
||||
|
||||
|
||||
/**
|
||||
Get a string parameter from the table.
|
||||
Define the parameter to the default value if not found.
|
||||
*/
|
||||
std::string getStr(const std::string& key, const char* defaultValue);
|
||||
|
||||
|
||||
/**
|
||||
Get a numeric parameter from the table.
|
||||
Throw ConfigurationTableKeyNotFound if not found.
|
||||
*/
|
||||
long getNum(const std::string& key);
|
||||
|
||||
/**
|
||||
Get a numeric parameter from the table.
|
||||
Define the parameter to the default value if not found.
|
||||
*/
|
||||
long getNum(const std::string& key, long defaultValue);
|
||||
|
||||
/**
|
||||
Get a numeric vector from the table.
|
||||
*/
|
||||
std::vector<unsigned> getVector(const std::string& key);
|
||||
|
||||
/** Get length of a vector */
|
||||
unsigned getVectorLength(const std::string &key)
|
||||
{ return getVector(key).size(); }
|
||||
|
||||
/** Set or change a value in the table. */
|
||||
bool set(const std::string& key, const std::string& value);
|
||||
|
||||
/** Set or change a value in the table. */
|
||||
bool set(const std::string& key, long value);
|
||||
|
||||
/** Create an entry in the table, no value though. */
|
||||
bool set(const std::string& key);
|
||||
|
||||
/**
|
||||
Remove a key from the table.
|
||||
Will not remove static or required values.
|
||||
@param key The key of the item to be deleted.
|
||||
@return true if anything was actually removed.
|
||||
*/
|
||||
bool unset(const std::string& key);
|
||||
|
||||
/** Search the table, dumping to a stream. */
|
||||
void find(const std::string& pattern, std::ostream&) const;
|
||||
|
||||
/** Define the callback to purge the cache whenever the database changes. */
|
||||
void setUpdateHook(void(*)(void *,int ,char const *,char const *,sqlite3_int64));
|
||||
|
||||
/** purege cache if it exceeds a certain age */
|
||||
void checkCacheAge();
|
||||
|
||||
/** Delete all records from the cache. */
|
||||
void purge();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
Attempt to lookup a record, cache if needed.
|
||||
Throw ConfigurationTableKeyNotFound if not found.
|
||||
Caller should hold mLock because the returned reference points into the cache.
|
||||
*/
|
||||
const ConfigurationRecord& lookup(const std::string& key);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// vim: ts=4 sw=4
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright 2009, 2010 Free Software Foundation, Inc.
|
||||
* Copyright 2010 Kestrel Signal Processing, Inc.
|
||||
*
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "Configuration.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
ConfigurationTable gConfig("exampleconfig.db");
|
||||
|
||||
void purgeConfig(void*,int,char const*, char const*, sqlite3_int64)
|
||||
{
|
||||
//cout << "update hook" << endl;
|
||||
gConfig.purge();
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
gConfig.setUpdateHook(purgeConfig);
|
||||
|
||||
char *keys[5] = {"key1", "key2", "key3", "key4", "key5"};
|
||||
|
||||
for (int i=0; i<5; i++) {
|
||||
gConfig.set(keys[i],i);
|
||||
}
|
||||
|
||||
for (int i=0; i<5; i++) {
|
||||
cout << "table[" << keys[i] << "]=" << gConfig.getStr(keys[i]) << endl;
|
||||
cout << "table[" << keys[i] << "]=" << gConfig.getNum(keys[i]) << endl;
|
||||
}
|
||||
|
||||
gConfig.unset("key1");
|
||||
for (int i=0; i<5; i++) {
|
||||
cout << "defined table[" << keys[i] << "]=" << gConfig.defines(keys[i]) << endl;
|
||||
}
|
||||
|
||||
gConfig.set("key5","100 200 300 400");
|
||||
std::vector<unsigned> vect = gConfig.getVector("key5");
|
||||
cout << "vect length " << vect.size() << ": ";
|
||||
for (unsigned i=0; i<vect.size(); i++) cout << " " << vect[i];
|
||||
cout << endl;
|
||||
}
|
|
@ -0,0 +1,210 @@
|
|||
/*
|
||||
* Copyright 2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef F16_H
|
||||
#define F16_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <ostream>
|
||||
|
||||
|
||||
|
||||
/** Round a float to the appropriate F16 value. */
|
||||
inline int32_t _f16_round(float f)
|
||||
{
|
||||
if (f>0.0F) return (int32_t)(f+0.5F);
|
||||
if (f<0.0F) return (int32_t)(f-0.5F);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** A class for F15.16 fixed point arithmetic with saturation. */
|
||||
class F16 {
|
||||
|
||||
|
||||
private:
|
||||
|
||||
int32_t mV;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
F16() {}
|
||||
|
||||
F16(int i) { mV = i<<16; }
|
||||
F16(float f) { mV = _f16_round(f*65536.0F); }
|
||||
F16(double f) { mV = _f16_round((float)f*65536.0F); }
|
||||
|
||||
int32_t& raw() { return mV; }
|
||||
const int32_t& raw() const { return mV; }
|
||||
|
||||
float f() const { return mV/65536.0F; }
|
||||
|
||||
//operator float() const { return mV/65536.0F; }
|
||||
//operator int() const { return mV>>16; }
|
||||
|
||||
F16 operator=(float f)
|
||||
{
|
||||
mV = _f16_round(f*65536.0F);
|
||||
return *this;
|
||||
}
|
||||
|
||||
F16 operator=(int i)
|
||||
{
|
||||
mV = i<<16;
|
||||
return *this;
|
||||
}
|
||||
|
||||
F16 operator=(const F16& other)
|
||||
{
|
||||
mV = other.mV;
|
||||
return mV;
|
||||
}
|
||||
|
||||
F16 operator+(const F16& other) const
|
||||
{
|
||||
F16 retVal;
|
||||
retVal.mV = mV + other.mV;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
F16& operator+=(const F16& other)
|
||||
{
|
||||
mV += other.mV;
|
||||
return *this;
|
||||
}
|
||||
|
||||
F16 operator-(const F16& other) const
|
||||
{
|
||||
F16 retVal;
|
||||
retVal.mV = mV - other.mV;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
F16& operator-=(const F16& other)
|
||||
{
|
||||
mV -= other.mV;
|
||||
return *this;
|
||||
}
|
||||
|
||||
F16 operator*(const F16& other) const
|
||||
{
|
||||
F16 retVal;
|
||||
int64_t p = (int64_t)mV * (int64_t)other.mV;
|
||||
retVal.mV = p>>16;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
F16& operator*=(const F16& other)
|
||||
{
|
||||
int64_t p = (int64_t)mV * (int64_t)other.mV;
|
||||
mV = p>>16;
|
||||
return *this;
|
||||
}
|
||||
|
||||
F16 operator*(float f) const
|
||||
{
|
||||
F16 retVal;
|
||||
retVal.mV = mV * f;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
F16& operator*=(float f)
|
||||
{
|
||||
mV *= f;
|
||||
return *this;
|
||||
}
|
||||
|
||||
F16 operator/(const F16& other) const
|
||||
{
|
||||
F16 retVal;
|
||||
int64_t pV = (int64_t)mV << 16;
|
||||
retVal.mV = pV / other.mV;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
F16& operator/=(const F16& other)
|
||||
{
|
||||
int64_t pV = (int64_t)mV << 16;
|
||||
mV = pV / other.mV;
|
||||
return *this;
|
||||
}
|
||||
|
||||
F16 operator/(float f) const
|
||||
{
|
||||
F16 retVal;
|
||||
retVal.mV = mV / f;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
F16& operator/=(float f)
|
||||
{
|
||||
mV /= f;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator>(const F16& other) const
|
||||
{
|
||||
return mV>other.mV;
|
||||
}
|
||||
|
||||
bool operator<(const F16& other) const
|
||||
{
|
||||
return mV<other.mV;
|
||||
}
|
||||
|
||||
bool operator==(const F16& other) const
|
||||
{
|
||||
return mV==other.mV;
|
||||
}
|
||||
|
||||
bool operator>(float f) const
|
||||
{
|
||||
return (mV/65536.0F) > f;
|
||||
}
|
||||
|
||||
bool operator<(float f) const
|
||||
{
|
||||
return (mV/65536.0F) < f;
|
||||
}
|
||||
|
||||
bool operator==(float f) const
|
||||
{
|
||||
return (mV/65536.0F) == f;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& os, const F16& v)
|
||||
{
|
||||
os << v.f();
|
||||
return os;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright 2009 Free Software Foundation, Inc.
|
||||
*
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "F16.h"
|
||||
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
F16 a = 2.5;
|
||||
F16 b = 1.5;
|
||||
F16 c = 2.5 * 1.5;
|
||||
F16 d = c + a;
|
||||
F16 e = 10;
|
||||
cout << a << ' ' << b << ' ' << c << ' ' << d << ' ' << e << endl;
|
||||
|
||||
a *= 3;
|
||||
b *= 0.3;
|
||||
c *= e;
|
||||
cout << a << ' ' << b << ' ' << c << ' ' << d << endl;
|
||||
|
||||
a /= 3;
|
||||
b /= 0.3;
|
||||
c = d * 0.05;
|
||||
cout << a << ' ' << b << ' ' << c << ' ' << d << endl;
|
||||
|
||||
F16 f = a/d;
|
||||
cout << f << ' ' << f+0.5 << endl;
|
||||
}
|
|
@ -0,0 +1,546 @@
|
|||
/*
|
||||
* Copyright 2008, 2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INTERTHREAD_H
|
||||
#define INTERTHREAD_H
|
||||
|
||||
#include "Timeval.h"
|
||||
#include "Threads.h"
|
||||
#include "LinkedLists.h"
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <queue>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**@defgroup Templates for interthread mechanisms. */
|
||||
//@{
|
||||
|
||||
|
||||
/** Pointer FIFO for interthread operations. */
|
||||
template <class T> class InterthreadQueue {
|
||||
|
||||
protected:
|
||||
|
||||
PointerFIFO mQ;
|
||||
mutable Mutex mLock;
|
||||
mutable Signal mWriteSignal;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/** Delete contents. */
|
||||
void clear()
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
while (mQ.size()>0) delete (T*)mQ.get();
|
||||
}
|
||||
|
||||
/** Empty the queue, but don't delete. */
|
||||
void flushNoDelete()
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
while (mQ.size()>0) mQ.get();
|
||||
}
|
||||
|
||||
|
||||
~InterthreadQueue()
|
||||
{ clear(); }
|
||||
|
||||
|
||||
size_t size() const
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
return mQ.size();
|
||||
}
|
||||
|
||||
/**
|
||||
Blocking read.
|
||||
@return Pointer to object (will not be NULL).
|
||||
*/
|
||||
T* read()
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
T* retVal = (T*)mQ.get();
|
||||
while (retVal==NULL) {
|
||||
mWriteSignal.wait(mLock);
|
||||
retVal = (T*)mQ.get();
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
Blocking read with a timeout.
|
||||
@param timeout The read timeout in ms.
|
||||
@return Pointer to object or NULL on timeout.
|
||||
*/
|
||||
T* read(unsigned timeout)
|
||||
{
|
||||
if (timeout==0) return readNoBlock();
|
||||
Timeval waitTime(timeout);
|
||||
ScopedLock lock(mLock);
|
||||
while ((mQ.size()==0) && (!waitTime.passed()))
|
||||
mWriteSignal.wait(mLock,waitTime.remaining());
|
||||
T* retVal = (T*)mQ.get();
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
Non-blocking read.
|
||||
@return Pointer to object or NULL if FIFO is empty.
|
||||
*/
|
||||
T* readNoBlock()
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
return (T*)mQ.get();
|
||||
}
|
||||
|
||||
/** Non-blocking write. */
|
||||
void write(T* val)
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
mQ.put(val);
|
||||
mWriteSignal.signal();
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** Pointer FIFO for interthread operations. */
|
||||
template <class T> class InterthreadQueueWithWait {
|
||||
|
||||
protected:
|
||||
|
||||
PointerFIFO mQ;
|
||||
mutable Mutex mLock;
|
||||
mutable Signal mWriteSignal;
|
||||
mutable Signal mReadSignal;
|
||||
|
||||
virtual void freeElement(T* element) const { delete element; };
|
||||
|
||||
public:
|
||||
|
||||
/** Delete contents. */
|
||||
void clear()
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
while (mQ.size()>0) freeElement((T*)mQ.get());
|
||||
mReadSignal.signal();
|
||||
}
|
||||
|
||||
|
||||
|
||||
virtual ~InterthreadQueueWithWait()
|
||||
{ clear(); }
|
||||
|
||||
|
||||
size_t size() const
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
return mQ.size();
|
||||
}
|
||||
|
||||
/**
|
||||
Blocking read.
|
||||
@return Pointer to object (will not be NULL).
|
||||
*/
|
||||
T* read()
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
T* retVal = (T*)mQ.get();
|
||||
while (retVal==NULL) {
|
||||
mWriteSignal.wait(mLock);
|
||||
retVal = (T*)mQ.get();
|
||||
}
|
||||
mReadSignal.signal();
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
Blocking read with a timeout.
|
||||
@param timeout The read timeout in ms.
|
||||
@return Pointer to object or NULL on timeout.
|
||||
*/
|
||||
T* read(unsigned timeout)
|
||||
{
|
||||
if (timeout==0) return readNoBlock();
|
||||
Timeval waitTime(timeout);
|
||||
ScopedLock lock(mLock);
|
||||
while ((mQ.size()==0) && (!waitTime.passed()))
|
||||
mWriteSignal.wait(mLock,waitTime.remaining());
|
||||
T* retVal = (T*)mQ.get();
|
||||
if (retVal!=NULL) mReadSignal.signal();
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
Non-blocking read.
|
||||
@return Pointer to object or NULL if FIFO is empty.
|
||||
*/
|
||||
T* readNoBlock()
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
T* retVal = (T*)mQ.get();
|
||||
if (retVal!=NULL) mReadSignal.signal();
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/** Non-blocking write. */
|
||||
void write(T* val)
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
mQ.put(val);
|
||||
mWriteSignal.signal();
|
||||
}
|
||||
|
||||
/** Wait until the queue falls below a low water mark. */
|
||||
void wait(size_t sz=0)
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
while (mQ.size()>sz) mReadSignal.wait(mLock);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** Thread-safe map of pointers to class D, keyed by class K. */
|
||||
template <class K, class D > class InterthreadMap {
|
||||
|
||||
protected:
|
||||
|
||||
typedef std::map<K,D*> Map;
|
||||
Map mMap;
|
||||
mutable Mutex mLock;
|
||||
Signal mWriteSignal;
|
||||
|
||||
public:
|
||||
|
||||
void clear()
|
||||
{
|
||||
// Delete everything in the map.
|
||||
ScopedLock lock(mLock);
|
||||
typename Map::iterator iter = mMap.begin();
|
||||
while (iter != mMap.end()) {
|
||||
delete iter->second;
|
||||
++iter;
|
||||
}
|
||||
mMap.clear();
|
||||
}
|
||||
|
||||
~InterthreadMap() { clear(); }
|
||||
|
||||
/**
|
||||
Non-blocking write.
|
||||
@param key The index to write to.
|
||||
@param wData Pointer to data, not to be deleted until removed from the map.
|
||||
*/
|
||||
void write(const K &key, D * wData)
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
typename Map::iterator iter = mMap.find(key);
|
||||
if (iter!=mMap.end()) {
|
||||
delete iter->second;
|
||||
iter->second = wData;
|
||||
} else {
|
||||
mMap[key] = wData;
|
||||
}
|
||||
mWriteSignal.broadcast();
|
||||
}
|
||||
|
||||
/**
|
||||
Non-blocking read with element removal.
|
||||
@param key Key to read from.
|
||||
@return Pointer at key or NULL if key not found, to be deleted by caller.
|
||||
*/
|
||||
D* getNoBlock(const K& key)
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
typename Map::iterator iter = mMap.find(key);
|
||||
if (iter==mMap.end()) return NULL;
|
||||
D* retVal = iter->second;
|
||||
mMap.erase(iter);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
Blocking read with a timeout and element removal.
|
||||
@param key The key to read from.
|
||||
@param timeout The blocking timeout in ms.
|
||||
@return Pointer at key or NULL on timeout, to be deleted by caller.
|
||||
*/
|
||||
D* get(const K &key, unsigned timeout)
|
||||
{
|
||||
if (timeout==0) return getNoBlock(key);
|
||||
Timeval waitTime(timeout);
|
||||
ScopedLock lock(mLock);
|
||||
typename Map::iterator iter = mMap.find(key);
|
||||
while ((iter==mMap.end()) && (!waitTime.passed())) {
|
||||
mWriteSignal.wait(mLock,waitTime.remaining());
|
||||
iter = mMap.find(key);
|
||||
}
|
||||
if (iter==mMap.end()) return NULL;
|
||||
D* retVal = iter->second;
|
||||
mMap.erase(iter);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
Blocking read with and element removal.
|
||||
@param key The key to read from.
|
||||
@return Pointer at key, to be deleted by caller.
|
||||
*/
|
||||
D* get(const K &key)
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
typename Map::iterator iter = mMap.find(key);
|
||||
while (iter==mMap.end()) {
|
||||
mWriteSignal.wait(mLock);
|
||||
iter = mMap.find(key);
|
||||
}
|
||||
D* retVal = iter->second;
|
||||
mMap.erase(iter);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Remove an entry and delete it.
|
||||
@param key The key of the entry to delete.
|
||||
@return True if it was actually found and deleted.
|
||||
*/
|
||||
bool remove(const K &key )
|
||||
{
|
||||
D* val = getNoBlock(key);
|
||||
if (!val) return false;
|
||||
delete val;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Non-blocking read.
|
||||
@param key Key to read from.
|
||||
@return Pointer at key or NULL if key not found.
|
||||
*/
|
||||
D* readNoBlock(const K& key) const
|
||||
{
|
||||
D* retVal=NULL;
|
||||
ScopedLock lock(mLock);
|
||||
typename Map::const_iterator iter = mMap.find(key);
|
||||
if (iter!=mMap.end()) retVal = iter->second;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
Blocking read with a timeout.
|
||||
@param key The key to read from.
|
||||
@param timeout The blocking timeout in ms.
|
||||
@return Pointer at key or NULL on timeout.
|
||||
*/
|
||||
D* read(const K &key, unsigned timeout) const
|
||||
{
|
||||
if (timeout==0) return readNoBlock(key);
|
||||
ScopedLock lock(mLock);
|
||||
Timeval waitTime(timeout);
|
||||
typename Map::const_iterator iter = mMap.find(key);
|
||||
while ((iter==mMap.end()) && (!waitTime.passed())) {
|
||||
mWriteSignal.wait(mLock,waitTime.remaining());
|
||||
iter = mMap.find(key);
|
||||
}
|
||||
if (iter==mMap.end()) return NULL;
|
||||
D* retVal = iter->second;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
Blocking read.
|
||||
@param key The key to read from.
|
||||
@return Pointer at key.
|
||||
*/
|
||||
D* read(const K &key) const
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
typename Map::const_iterator iter = mMap.find(key);
|
||||
while (iter==mMap.end()) {
|
||||
mWriteSignal.wait(mLock);
|
||||
iter = mMap.find(key);
|
||||
}
|
||||
D* retVal = iter->second;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** This class is used to provide pointer-based comparison in priority_queues. */
|
||||
template <class T> class PointerCompare {
|
||||
|
||||
public:
|
||||
|
||||
/** Compare the objects pointed to, not the pointers themselves. */
|
||||
bool operator()(const T *v1, const T *v2)
|
||||
{ return (*v1)>(*v2); }
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Priority queue for interthread operations.
|
||||
Passes pointers to objects.
|
||||
*/
|
||||
template <class T, class C = std::vector<T*>, class Cmp = PointerCompare<T> > class InterthreadPriorityQueue {
|
||||
|
||||
protected:
|
||||
|
||||
std::priority_queue<T*,C,Cmp> mQ;
|
||||
mutable Mutex mLock;
|
||||
mutable Signal mWriteSignal;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
/** Clear the FIFO. */
|
||||
void clear()
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
while (mQ.size()>0) {
|
||||
T* ptr = mQ.top();
|
||||
mQ.pop();
|
||||
delete ptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
~InterthreadPriorityQueue()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
size_t size() const
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
return mQ.size();
|
||||
}
|
||||
|
||||
|
||||
/** Non-blocking read. */
|
||||
T* readNoBlock()
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
T* retVal = NULL;
|
||||
if (mQ.size()!=0) {
|
||||
retVal = mQ.top();
|
||||
mQ.pop();
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/** Blocking read. */
|
||||
T* read()
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
T* retVal;
|
||||
while (mQ.size()==0) mWriteSignal.wait(mLock);
|
||||
retVal = mQ.top();
|
||||
mQ.pop();
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/** Non-blocking write. */
|
||||
void write(T* val)
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
mQ.push(val);
|
||||
mWriteSignal.signal();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class Semaphore {
|
||||
|
||||
private:
|
||||
|
||||
bool mFlag;
|
||||
Signal mSignal;
|
||||
mutable Mutex mLock;
|
||||
|
||||
public:
|
||||
|
||||
Semaphore()
|
||||
:mFlag(false)
|
||||
{ }
|
||||
|
||||
void post()
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
mFlag=true;
|
||||
mSignal.signal();
|
||||
}
|
||||
|
||||
void get()
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
while (!mFlag) mSignal.wait(mLock);
|
||||
mFlag=false;
|
||||
}
|
||||
|
||||
bool semtry()
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
bool retVal = mFlag;
|
||||
mFlag = false;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
// vim: ts=4 sw=4
|
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
* Copyright 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "Threads.h"
|
||||
#include "Interthread.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
InterthreadQueue<int> gQ;
|
||||
InterthreadMap<int,int> gMap;
|
||||
|
||||
void* qWriter(void*)
|
||||
{
|
||||
int *p;
|
||||
for (int i=0; i<20; i++) {
|
||||
p = new int;
|
||||
*p = i;
|
||||
COUT("queue write " << *p);
|
||||
gQ.write(p);
|
||||
if (random()%2) sleep(1);
|
||||
}
|
||||
p = new int;
|
||||
*p = -1;
|
||||
gQ.write(p);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* qReader(void*)
|
||||
{
|
||||
bool done = false;
|
||||
while (!done) {
|
||||
int *p = gQ.read();
|
||||
COUT("queue read " << *p);
|
||||
if (*p<0) done=true;
|
||||
delete p;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void* mapWriter(void*)
|
||||
{
|
||||
int *p;
|
||||
for (int i=0; i<20; i++) {
|
||||
p = new int;
|
||||
*p = i;
|
||||
COUT("map write " << *p);
|
||||
gMap.write(i,p);
|
||||
if (random()%2) sleep(1);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* mapReader(void*)
|
||||
{
|
||||
for (int i=0; i<20; i++) {
|
||||
int *p = gMap.read(i);
|
||||
COUT("map read " << *p);
|
||||
delete p;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Thread qReaderThread;
|
||||
qReaderThread.start(qReader,NULL);
|
||||
Thread mapReaderThread;
|
||||
mapReaderThread.start(mapReader,NULL);
|
||||
|
||||
Thread qWriterThread;
|
||||
qWriterThread.start(qWriter,NULL);
|
||||
Thread mapWriterThread;
|
||||
mapWriterThread.start(mapWriter,NULL);
|
||||
|
||||
qReaderThread.join();
|
||||
qWriterThread.join();
|
||||
mapReaderThread.join();
|
||||
mapWriterThread.join();
|
||||
}
|
||||
|
||||
|
||||
// vim: ts=4 sw=4
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Copyright 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "LinkedLists.h"
|
||||
|
||||
|
||||
|
||||
|
||||
void PointerFIFO::put(void* val)
|
||||
{
|
||||
ListNode *node = allocate();
|
||||
node->data(val);
|
||||
node->next(NULL);
|
||||
if (mTail!=NULL) mTail->next(node);
|
||||
mTail=node;
|
||||
if (mHead==NULL) mHead=node;
|
||||
mSize++;
|
||||
}
|
||||
|
||||
/** Take an item from the FIFO. */
|
||||
void* PointerFIFO::get()
|
||||
{
|
||||
// empty list?
|
||||
if (mHead==NULL) return NULL;
|
||||
// normal case
|
||||
ListNode* next = mHead->next();
|
||||
void* retVal = mHead->data();
|
||||
release(mHead);
|
||||
mHead = next;
|
||||
if (next==NULL) mTail=NULL;
|
||||
mSize--;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ListNode *PointerFIFO::allocate()
|
||||
{
|
||||
if (mFreeList==NULL) return new ListNode;
|
||||
ListNode* retVal = mFreeList;
|
||||
mFreeList = mFreeList->next();
|
||||
return retVal;
|
||||
}
|
||||
|
||||
void PointerFIFO::release(ListNode* wNode)
|
||||
{
|
||||
wNode->next(mFreeList);
|
||||
mFreeList = wNode;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* Copyright 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* This software is distributed under multiple licenses; see the COPYING file in the main directory for licensing information for this specific distribuion.
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef LINKEDLISTS_H
|
||||
#define LINKEDLISTS_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
|
||||
/** This node class is used to build singly-linked lists. */
|
||||
class ListNode {
|
||||
|
||||
private:
|
||||
|
||||
ListNode* mNext;
|
||||
void* mData;
|
||||
|
||||
public:
|
||||
|
||||
ListNode* next() { return mNext; }
|
||||
void next(ListNode* wNext) { mNext=wNext; }
|
||||
|
||||
void* data() { return mData; }
|
||||
void data(void* wData) { mData=wData; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/** A fast FIFO for pointer-based storage. */
|
||||
class PointerFIFO {
|
||||
|
||||
private:
|
||||
|
||||
ListNode* mHead; ///< points to next item out
|
||||
ListNode* mTail; ///< points to last item in
|
||||
ListNode* mFreeList; ///< pool of previously-allocated nodes
|
||||
unsigned mSize; ///< number of items in the FIFO
|
||||
|
||||
public:
|
||||
|
||||
PointerFIFO()
|
||||
:mHead(NULL),mTail(NULL),mFreeList(NULL),
|
||||
mSize(0)
|
||||
{}
|
||||
|
||||
unsigned size() const { return mSize; }
|
||||
|
||||
/** Put an item into the FIFO. */
|
||||
void put(void* val);
|
||||
|
||||
/**
|
||||
Take an item from the FIFO.
|
||||
Returns NULL for empty list.
|
||||
*/
|
||||
void* get();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/** Allocate a new node to extend the FIFO. */
|
||||
ListNode *allocate();
|
||||
|
||||
/** Release a node to the free pool after removal from the FIFO. */
|
||||
void release(ListNode* wNode);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
// vim: ts=4 sw=4
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright 2009 Free Software Foundation, Inc.
|
||||
* Copyright 2010 Kestrel Signal Processing, Inc.
|
||||
*
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
|
||||
#include "Logger.h"
|
||||
#include "Configuration.h"
|
||||
|
||||
ConfigurationTable gConfig;
|
||||
//ConfigurationTable gConfig("example.config");
|
||||
|
||||
void printAlarms()
|
||||
{
|
||||
std::ostream_iterator<std::string> output( std::cout, "\n" );
|
||||
std::list<std::string> alarms = gGetLoggerAlarms();
|
||||
std::cout << "#alarms = " << alarms.size() << std::endl;
|
||||
std::copy( alarms.begin(), alarms.end(), output );
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
gLogInit("LogTest","NOTICE",LOG_LOCAL7);
|
||||
|
||||
LOG(EMERG) << " testing the logger.";
|
||||
LOG(ALERT) << " testing the logger.";
|
||||
LOG(CRIT) << " testing the logger.";
|
||||
LOG(ERR) << " testing the logger.";
|
||||
LOG(WARNING) << " testing the logger.";
|
||||
LOG(NOTICE) << " testing the logger.";
|
||||
LOG(INFO) << " testing the logger.";
|
||||
LOG(DEBUG) << " testing the logger.";
|
||||
std::cout << "\n\n\n";
|
||||
std::cout << "testing Alarms\n";
|
||||
LOG(ALERT) << " testing the logger alarm.";
|
||||
std::cout << "you should see three lines:" << std::endl;
|
||||
printAlarms();
|
||||
std::cout << "----------- generating 20 alarms ----------" << std::endl;
|
||||
for (int i = 0 ; i < 20 ; ++i) {
|
||||
LOG(ALERT) << i;
|
||||
}
|
||||
std::cout << "you should see ten lines with the numbers 10..19:" << std::endl;
|
||||
printAlarms();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,197 @@
|
|||
/*
|
||||
* Copyright 2009, 2010 Free Software Foundation, Inc.
|
||||
* Copyright 2010 Kestrel Signal Processing, Inc.
|
||||
*
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <cstdio>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
#include "Configuration.h"
|
||||
#include "Logger.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
// Reference to a global config table, used all over the system.
|
||||
extern ConfigurationTable gConfig;
|
||||
|
||||
|
||||
/**@ The global alarms table. */
|
||||
//@{
|
||||
Mutex alarmsLock;
|
||||
list<string> alarmsList;
|
||||
void addAlarm(const string&);
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
|
||||
/** Names of the logging levels. */
|
||||
const char *levelNames[] = {
|
||||
"EMERG", "ALERT", "CRIT", "ERR", "WARNING", "NOTICE", "INFO", "DEBUG"
|
||||
};
|
||||
int numLevels = 8;
|
||||
|
||||
|
||||
/** Given a string, return the corresponding level name. */
|
||||
int lookupLevel(const string& name)
|
||||
{
|
||||
// Reverse search, since the numerically larger levels are more common.
|
||||
for (int i=numLevels-1; i>=0; i--) {
|
||||
if (name == levelNames[i]) return i;
|
||||
}
|
||||
// This should never be called with a bogus name.
|
||||
LOG(ERR) << "undefined logging level " << name << "defaulting to ERR";
|
||||
return LOG_ERR;
|
||||
}
|
||||
|
||||
|
||||
int getLoggingLevel(const char* filename)
|
||||
{
|
||||
// Default level?
|
||||
if (!filename) return lookupLevel(gConfig.getStr("Log.Level"));
|
||||
|
||||
// This can afford to be inefficient since it is not called that often.
|
||||
const string keyName = string("Log.Level.") + string(filename);
|
||||
if (gConfig.defines(keyName)) return lookupLevel(gConfig.getStr(keyName));
|
||||
return lookupLevel(gConfig.getStr("Log.Level"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
int gGetLoggingLevel(const char* filename)
|
||||
{
|
||||
// This is called a lot and needs to be efficient.
|
||||
|
||||
static Mutex sLogCacheLock;
|
||||
static map<uint64_t,int> sLogCache;
|
||||
static unsigned sCacheCount;
|
||||
static const unsigned sCacheRefreshCount = 1000;
|
||||
|
||||
if (filename==NULL) return gGetLoggingLevel("");
|
||||
|
||||
HashString hs(filename);
|
||||
uint64_t key = hs.hash();
|
||||
|
||||
sLogCacheLock.lock();
|
||||
// Time for a cache flush?
|
||||
if (sCacheCount>sCacheRefreshCount) {
|
||||
sLogCache.clear();
|
||||
sCacheCount=0;
|
||||
}
|
||||
// Is it cached already?
|
||||
map<uint64_t,int>::const_iterator where = sLogCache.find(key);
|
||||
sCacheCount++;
|
||||
if (where!=sLogCache.end()) {
|
||||
int retVal = where->second;
|
||||
sLogCacheLock.unlock();
|
||||
return retVal;
|
||||
}
|
||||
// Look it up in the config table and cache it.
|
||||
// FIXME: Figure out why unlock and lock below fix the config table deadlock.
|
||||
sLogCacheLock.unlock();
|
||||
int level = getLoggingLevel(filename);
|
||||
sLogCacheLock.lock();
|
||||
sLogCache.insert(pair<uint64_t,int>(key,level));
|
||||
sLogCacheLock.unlock();
|
||||
return level;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// copies the alarm list and returns it. list supposed to be small.
|
||||
list<string> gGetLoggerAlarms()
|
||||
{
|
||||
alarmsLock.lock();
|
||||
list<string> ret;
|
||||
// excuse the "complexity", but to use std::copy with a list you need
|
||||
// an insert_iterator - copy technically overwrites, doesn't insert.
|
||||
insert_iterator< list<string> > ii(ret, ret.begin());
|
||||
copy(alarmsList.begin(), alarmsList.end(), ii);
|
||||
alarmsLock.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/** Add an alarm to the alarm list. */
|
||||
void addAlarm(const string& s)
|
||||
{
|
||||
alarmsLock.lock();
|
||||
alarmsList.push_back(s);
|
||||
unsigned maxAlarms = gConfig.getNum("Log.Alarms.Max");
|
||||
while (alarmsList.size() > maxAlarms) alarmsList.pop_front();
|
||||
alarmsLock.unlock();
|
||||
}
|
||||
|
||||
|
||||
Log::~Log()
|
||||
{
|
||||
// Anything at or above LOG_CRIT is an "alarm".
|
||||
// Save alarms in the local list and echo them to stderr.
|
||||
if (mPriority <= LOG_CRIT) {
|
||||
addAlarm(mStream.str().c_str());
|
||||
cerr << mStream.str() << endl;
|
||||
}
|
||||
// Current logging level was already checked by the macro.
|
||||
// So just log.
|
||||
syslog(mPriority, "%s", mStream.str().c_str());
|
||||
}
|
||||
|
||||
|
||||
ostringstream& Log::get()
|
||||
{
|
||||
assert(mPriority<numLevels);
|
||||
mStream << levelNames[mPriority] << ' ';
|
||||
return mStream;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void gLogInit(const char* name, const char* level, int facility)
|
||||
{
|
||||
// Set the level.
|
||||
if (level) {
|
||||
gConfig.set("Log.Level",level);
|
||||
} else {
|
||||
if (!gConfig.defines("Log.Level")) {
|
||||
gConfig.set("Log.Level","WARNING");
|
||||
}
|
||||
}
|
||||
|
||||
// Define other logging parameters in the global config.
|
||||
if (!gConfig.defines("Log.Alarms.Max")) {
|
||||
gConfig.set("Log.Alarms.Max",DEFAULT_MAX_ALARMS);
|
||||
}
|
||||
|
||||
// Open the log connection.
|
||||
openlog(name,0,facility);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// vim: ts=4 sw=4
|
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* Copyright 2009, 2010 Free Software Foundation, Inc.
|
||||
* Copyright 2010 Kestrel Signal Processing, Inc.
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef LOGGER_H
|
||||
#define LOGGER_H
|
||||
|
||||
#include <syslog.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <sstream>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "Threads.h"
|
||||
|
||||
|
||||
#define _LOG(level) \
|
||||
Log(LOG_##level).get() << pthread_self() \
|
||||
<< " " __FILE__ ":" << __LINE__ << ":" << __FUNCTION__ << ": "
|
||||
#define LOG(wLevel) \
|
||||
if (gGetLoggingLevel(__FILE__)>=LOG_##wLevel) _LOG(wLevel)
|
||||
#define OBJLOG(wLevel) \
|
||||
if (gGetLoggingLevel(__FILE__)>=LOG_##wLevel) _LOG(wLevel) << "obj: " << this << ' '
|
||||
|
||||
#define LOG_ASSERT(x) { if (!(x)) LOG(EMERG) << "assertion " #x " failed"; } assert(x);
|
||||
|
||||
|
||||
#define DEFAULT_MAX_ALARMS 10
|
||||
|
||||
|
||||
/**
|
||||
A C++ stream-based thread-safe logger.
|
||||
Derived from Dr. Dobb's Sept. 2007 issue.
|
||||
Updated to use syslog.
|
||||
This object is NOT the global logger;
|
||||
every log record is an object of this class.
|
||||
*/
|
||||
class Log {
|
||||
|
||||
public:
|
||||
|
||||
protected:
|
||||
|
||||
std::ostringstream mStream; ///< This is where we buffer up the log entry.
|
||||
int mPriority; ///< Priority of current repot.
|
||||
|
||||
public:
|
||||
|
||||
Log(int wPriority)
|
||||
:mPriority(wPriority)
|
||||
{ }
|
||||
|
||||
// Most of the work is in the desctructor.
|
||||
/** The destructor actually generates the log entry. */
|
||||
~Log();
|
||||
|
||||
std::ostringstream& get();
|
||||
};
|
||||
|
||||
|
||||
|
||||
std::list<std::string> gGetLoggerAlarms(); ///< Get a copy of the recent alarm list.
|
||||
|
||||
|
||||
/**@ Global control and initialization of the logging system. */
|
||||
//@{
|
||||
/** Initialize the global logging system. */
|
||||
void gLogInit(const char* name, const char* level=NULL, int facility=LOG_USER);
|
||||
/** Get the logging level associated with a given file. */
|
||||
int gGetLoggingLevel(const char *filename=NULL);
|
||||
//@}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
// vim: ts=4 sw=4
|
|
@ -0,0 +1,659 @@
|
|||
# Makefile.in generated by automake 1.9.4 from Makefile.am.
|
||||
# CommonLibs/Makefile. Generated from Makefile.in by configure.
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Copyright 2008, 2009 Free Software Foundation, Inc.
|
||||
#
|
||||
# This software is distributed under the terms of the GNU Public License.
|
||||
# See the COPYING file in the main directory for details.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2008 Free Software Foundation, Inc.
|
||||
#
|
||||
# This software is distributed under the terms of the GNU Public License.
|
||||
# See the COPYING file in the main directory for details.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
|
||||
SOURCES = $(libcommon_la_SOURCES) $(BitVectorTest_SOURCES) $(ConfigurationTest_SOURCES) $(F16Test_SOURCES) $(InterthreadTest_SOURCES) $(LogTest_SOURCES) $(RegexpTest_SOURCES) $(SocketsTest_SOURCES) $(TimevalTest_SOURCES) $(VectorTest_SOURCES)
|
||||
|
||||
srcdir = .
|
||||
top_srcdir = ..
|
||||
|
||||
pkgdatadir = $(datadir)/openbts
|
||||
pkglibdir = $(libdir)/openbts
|
||||
pkgincludedir = $(includedir)/openbts
|
||||
top_builddir = ..
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = /opt/local/bin/ginstall -c
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = i686-apple-darwin10.8.0
|
||||
host_triplet = i686-apple-darwin10.8.0
|
||||
target_triplet = i686-apple-darwin10.8.0
|
||||
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in $(top_srcdir)/Makefile.common
|
||||
noinst_PROGRAMS = BitVectorTest$(EXEEXT) InterthreadTest$(EXEEXT) \
|
||||
SocketsTest$(EXEEXT) TimevalTest$(EXEEXT) RegexpTest$(EXEEXT) \
|
||||
VectorTest$(EXEEXT) ConfigurationTest$(EXEEXT) \
|
||||
LogTest$(EXEEXT) F16Test$(EXEEXT)
|
||||
subdir = CommonLibs
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
libcommon_la_LIBADD =
|
||||
am_libcommon_la_OBJECTS = BitVector.lo LinkedLists.lo Sockets.lo \
|
||||
Threads.lo Timeval.lo Logger.lo Configuration.lo
|
||||
libcommon_la_OBJECTS = $(am_libcommon_la_OBJECTS)
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
am_BitVectorTest_OBJECTS = BitVectorTest.$(OBJEXT)
|
||||
BitVectorTest_OBJECTS = $(am_BitVectorTest_OBJECTS)
|
||||
BitVectorTest_DEPENDENCIES = libcommon.la
|
||||
am_ConfigurationTest_OBJECTS = ConfigurationTest.$(OBJEXT)
|
||||
ConfigurationTest_OBJECTS = $(am_ConfigurationTest_OBJECTS)
|
||||
am__DEPENDENCIES_1 = $(top_builddir)/sqlite/libsqlite.la
|
||||
ConfigurationTest_DEPENDENCIES = libcommon.la $(am__DEPENDENCIES_1)
|
||||
am_F16Test_OBJECTS = F16Test.$(OBJEXT)
|
||||
F16Test_OBJECTS = $(am_F16Test_OBJECTS)
|
||||
F16Test_LDADD = $(LDADD)
|
||||
am_InterthreadTest_OBJECTS = InterthreadTest.$(OBJEXT)
|
||||
InterthreadTest_OBJECTS = $(am_InterthreadTest_OBJECTS)
|
||||
InterthreadTest_DEPENDENCIES = libcommon.la
|
||||
am_LogTest_OBJECTS = LogTest.$(OBJEXT)
|
||||
LogTest_OBJECTS = $(am_LogTest_OBJECTS)
|
||||
LogTest_DEPENDENCIES = libcommon.la $(am__DEPENDENCIES_1)
|
||||
am_RegexpTest_OBJECTS = RegexpTest.$(OBJEXT)
|
||||
RegexpTest_OBJECTS = $(am_RegexpTest_OBJECTS)
|
||||
RegexpTest_DEPENDENCIES = libcommon.la
|
||||
am_SocketsTest_OBJECTS = SocketsTest.$(OBJEXT)
|
||||
SocketsTest_OBJECTS = $(am_SocketsTest_OBJECTS)
|
||||
SocketsTest_DEPENDENCIES = libcommon.la
|
||||
am_TimevalTest_OBJECTS = TimevalTest.$(OBJEXT)
|
||||
TimevalTest_OBJECTS = $(am_TimevalTest_OBJECTS)
|
||||
TimevalTest_DEPENDENCIES = libcommon.la
|
||||
am_VectorTest_OBJECTS = VectorTest.$(OBJEXT)
|
||||
VectorTest_OBJECTS = $(am_VectorTest_OBJECTS)
|
||||
VectorTest_DEPENDENCIES = libcommon.la
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
||||
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
||||
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CXXFLAGS) $(CXXFLAGS)
|
||||
CXXLD = $(CXX)
|
||||
CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
|
||||
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = $(libcommon_la_SOURCES) $(BitVectorTest_SOURCES) \
|
||||
$(ConfigurationTest_SOURCES) $(F16Test_SOURCES) \
|
||||
$(InterthreadTest_SOURCES) $(LogTest_SOURCES) \
|
||||
$(RegexpTest_SOURCES) $(SocketsTest_SOURCES) \
|
||||
$(TimevalTest_SOURCES) $(VectorTest_SOURCES)
|
||||
DIST_SOURCES = $(libcommon_la_SOURCES) $(BitVectorTest_SOURCES) \
|
||||
$(ConfigurationTest_SOURCES) $(F16Test_SOURCES) \
|
||||
$(InterthreadTest_SOURCES) $(LogTest_SOURCES) \
|
||||
$(RegexpTest_SOURCES) $(SocketsTest_SOURCES) \
|
||||
$(TimevalTest_SOURCES) $(VectorTest_SOURCES)
|
||||
HEADERS = $(noinst_HEADERS)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = ${SHELL} /Users/dburgess/OpenBTSProject/range/software/private/openbts/trunk-public-staging/missing --run aclocal-1.9
|
||||
AMDEP_FALSE = #
|
||||
AMDEP_TRUE =
|
||||
AMTAR = ${SHELL} /Users/dburgess/OpenBTSProject/range/software/private/openbts/trunk-public-staging/missing --run tar
|
||||
AR = ar
|
||||
AS = as
|
||||
AUTOCONF = ${SHELL} /Users/dburgess/OpenBTSProject/range/software/private/openbts/trunk-public-staging/missing --run autoconf
|
||||
AUTOHEADER = ${SHELL} /Users/dburgess/OpenBTSProject/range/software/private/openbts/trunk-public-staging/missing --run autoheader
|
||||
AUTOMAKE = ${SHELL} /Users/dburgess/OpenBTSProject/range/software/private/openbts/trunk-public-staging/missing --run automake-1.9
|
||||
AWK = gawk
|
||||
CC = gcc
|
||||
CCAS = gcc
|
||||
CCASFLAGS = -g -O2
|
||||
CCDEPMODE = depmode=gcc3
|
||||
CFLAGS = -g -O2
|
||||
CPP = gcc -E
|
||||
CPPFLAGS =
|
||||
CXX = g++
|
||||
CXXCPP = g++ -E
|
||||
CXXDEPMODE = depmode=gcc3
|
||||
CXXFLAGS = -g -O2
|
||||
CYGPATH_W = echo
|
||||
DEFS = -DHAVE_CONFIG_H
|
||||
DEPDIR = .deps
|
||||
DLLTOOL = dlltool
|
||||
ECHO = /bin/echo
|
||||
ECHO_C = \c
|
||||
ECHO_N =
|
||||
ECHO_T =
|
||||
EGREP = /usr/bin/grep -E
|
||||
EXEEXT =
|
||||
F77 = gfortran
|
||||
FFLAGS = -g -O2
|
||||
GREP = /usr/bin/grep
|
||||
INSTALL_DATA = ${INSTALL} -m 644
|
||||
INSTALL_PROGRAM = ${INSTALL}
|
||||
INSTALL_SCRIPT = ${INSTALL}
|
||||
INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
|
||||
LDFLAGS =
|
||||
LIBOBJS =
|
||||
LIBS =
|
||||
LIBTOOL = $(SHELL) $(top_builddir)/libtool
|
||||
LN_S = ln -s
|
||||
LTLIBOBJS =
|
||||
MAKEINFO = ${SHELL} /Users/dburgess/OpenBTSProject/range/software/private/openbts/trunk-public-staging/missing --run makeinfo
|
||||
OBJDUMP = objdump
|
||||
OBJEXT = o
|
||||
ORTP_CFLAGS = -D_REENTRANT -DORTP_INET6 -I/usr/local/include
|
||||
ORTP_LIBS = -L/usr/local/lib -lortp -lpthread -lssl -lcrypto
|
||||
OSIP_CFLAGS = -DOSIP_MT -I/usr/local/include
|
||||
OSIP_LIBS = -L/usr/local/lib -losipparser2 -losip2
|
||||
PACKAGE = openbts
|
||||
PACKAGE_BUGREPORT =
|
||||
PACKAGE_NAME = openbts
|
||||
PACKAGE_STRING = openbts P2.8TRUNK
|
||||
PACKAGE_TARNAME = openbts
|
||||
PACKAGE_VERSION = P2.8TRUNK
|
||||
PATH_SEPARATOR = :
|
||||
PKG_CONFIG = /sw/bin/pkg-config
|
||||
RANLIB = ranlib
|
||||
RM_PROG = /bin/rm
|
||||
SET_MAKE =
|
||||
SHELL = /bin/sh
|
||||
STRIP = strip
|
||||
USRP_CFLAGS = @USRP_CFLAGS@
|
||||
USRP_LIBS = @USRP_LIBS@
|
||||
VERSION = P2.8TRUNK
|
||||
ac_ct_CC = gcc
|
||||
ac_ct_CXX = g++
|
||||
ac_ct_F77 = gfortran
|
||||
am__fastdepCC_FALSE = #
|
||||
am__fastdepCC_TRUE =
|
||||
am__fastdepCXX_FALSE = #
|
||||
am__fastdepCXX_TRUE =
|
||||
am__include = include
|
||||
am__leading_dot = .
|
||||
am__quote =
|
||||
am__tar = ${AMTAR} chof - "$$tardir"
|
||||
am__untar = ${AMTAR} xf -
|
||||
bindir = ${exec_prefix}/bin
|
||||
build = i686-apple-darwin10.8.0
|
||||
build_alias =
|
||||
build_cpu = i686
|
||||
build_os = darwin10.8.0
|
||||
build_vendor = apple
|
||||
datadir = ${datarootdir}
|
||||
datarootdir = ${prefix}/share
|
||||
docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
|
||||
dvidir = ${docdir}
|
||||
exec_prefix = ${prefix}
|
||||
host = i686-apple-darwin10.8.0
|
||||
host_alias =
|
||||
host_cpu = i686
|
||||
host_os = darwin10.8.0
|
||||
host_vendor = apple
|
||||
htmldir = ${docdir}
|
||||
includedir = ${prefix}/include
|
||||
infodir = ${datarootdir}/info
|
||||
install_sh = /Users/dburgess/OpenBTSProject/range/software/private/openbts/trunk-public-staging/install-sh
|
||||
libdir = ${exec_prefix}/lib
|
||||
libexecdir = ${exec_prefix}/libexec
|
||||
localedir = ${datarootdir}/locale
|
||||
localstatedir = ${prefix}/var
|
||||
mandir = ${datarootdir}/man
|
||||
mkdir_p = $(install_sh) -d
|
||||
oldincludedir = /usr/include
|
||||
pdfdir = ${docdir}
|
||||
prefix = /usr/local
|
||||
program_transform_name = s,x,x,
|
||||
psdir = ${docdir}
|
||||
sbindir = ${exec_prefix}/sbin
|
||||
sharedstatedir = ${prefix}/com
|
||||
sysconfdir = ${prefix}/etc
|
||||
target = i686-apple-darwin10.8.0
|
||||
target_alias =
|
||||
target_cpu = i686
|
||||
target_os = darwin10.8.0
|
||||
target_vendor = apple
|
||||
COMMON_INCLUDEDIR = $(top_srcdir)/CommonLibs
|
||||
CONTROL_INCLUDEDIR = $(top_srcdir)/Control
|
||||
GSM_INCLUDEDIR = $(top_srcdir)/GSM
|
||||
SIP_INCLUDEDIR = $(top_srcdir)/SIP
|
||||
SMS_INCLUDEDIR = $(top_srcdir)/SMS
|
||||
TRX_INCLUDEDIR = $(top_srcdir)/TRXManager
|
||||
GLOBALS_INCLUDEDIR = $(top_srcdir)/Globals
|
||||
CLI_INCLUDEDIR = $(top_srcdir)/CLI
|
||||
SQLITE_INCLUDEDIR = $(top_srcdir)/sqlite
|
||||
HLR_INCLUDEDIR = $(top_srcdir)/HLR
|
||||
STD_DEFINES_AND_INCLUDES = \
|
||||
-I$(COMMON_INCLUDEDIR) \
|
||||
-I$(CONTROL_INCLUDEDIR) \
|
||||
-I$(GSM_INCLUDEDIR) \
|
||||
-I$(SIP_INCLUDEDIR) \
|
||||
-I$(SMS_INCLUDEDIR) \
|
||||
-I$(TRX_INCLUDEDIR) \
|
||||
-I$(GLOBALS_INCLUDEDIR) \
|
||||
-I$(CLI_INCLUDEDIR) \
|
||||
-I$(HLR_INCLUDEDIR) \
|
||||
-I$(SQLITE_INCLUDEDIR)
|
||||
|
||||
COMMON_LA = $(top_builddir)/CommonLibs/libcommon.la
|
||||
GSM_LA = $(top_builddir)/GSM/libGSM.la
|
||||
SIP_LA = $(top_builddir)/SIP/libSIP.la
|
||||
SMS_LA = $(top_builddir)/SMS/libSMS.la
|
||||
TRX_LA = $(top_builddir)/TRXManager/libtrxmanager.la
|
||||
CONTROL_LA = $(top_builddir)/Control/libcontrol.la
|
||||
GLOBALS_LA = $(top_builddir)/Globals/libglobals.la
|
||||
CLI_LA = $(top_builddir)/CLI/libcli.la
|
||||
HLR_LA = $(top_builddir)/HLR/libHLR.la
|
||||
SQLITE_LA = $(top_builddir)/sqlite/libsqlite.la
|
||||
MOSTLYCLEANFILES = *~ testSource testDestination
|
||||
AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES)
|
||||
AM_CXXFLAGS = -Wall -O3 -g -lpthread
|
||||
EXTRA_DIST = \
|
||||
example.config \
|
||||
README.common
|
||||
|
||||
noinst_LTLIBRARIES = libcommon.la
|
||||
libcommon_la_SOURCES = \
|
||||
BitVector.cpp \
|
||||
LinkedLists.cpp \
|
||||
Sockets.cpp \
|
||||
Threads.cpp \
|
||||
Timeval.cpp \
|
||||
Logger.cpp \
|
||||
Configuration.cpp
|
||||
|
||||
noinst_HEADERS = \
|
||||
BitVector.h \
|
||||
Interthread.h \
|
||||
LinkedLists.h \
|
||||
Sockets.h \
|
||||
Threads.h \
|
||||
Timeval.h \
|
||||
Regexp.h \
|
||||
Vector.h \
|
||||
Configuration.h \
|
||||
F16.h \
|
||||
Logger.h
|
||||
|
||||
BitVectorTest_SOURCES = BitVectorTest.cpp
|
||||
BitVectorTest_LDADD = libcommon.la
|
||||
InterthreadTest_SOURCES = InterthreadTest.cpp
|
||||
InterthreadTest_LDADD = libcommon.la
|
||||
InterthreadTest_LDFLAGS = -lpthread
|
||||
SocketsTest_SOURCES = SocketsTest.cpp
|
||||
SocketsTest_LDADD = libcommon.la
|
||||
SocketsTest_LDFLAGS = -lpthread
|
||||
TimevalTest_SOURCES = TimevalTest.cpp
|
||||
TimevalTest_LDADD = libcommon.la
|
||||
VectorTest_SOURCES = VectorTest.cpp
|
||||
VectorTest_LDADD = libcommon.la
|
||||
RegexpTest_SOURCES = RegexpTest.cpp
|
||||
RegexpTest_LDADD = libcommon.la
|
||||
ConfigurationTest_SOURCES = ConfigurationTest.cpp
|
||||
ConfigurationTest_LDADD = libcommon.la $(SQLITE_LA)
|
||||
LogTest_SOURCES = LogTest.cpp
|
||||
LogTest_LDADD = libcommon.la $(SQLITE_LA)
|
||||
F16Test_SOURCES = F16Test.cpp
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .cpp .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu CommonLibs/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu CommonLibs/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
clean-noinstLTLIBRARIES:
|
||||
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
|
||||
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
|
||||
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
|
||||
test "$$dir" != "$$p" || dir=.; \
|
||||
echo "rm -f \"$${dir}/so_locations\""; \
|
||||
rm -f "$${dir}/so_locations"; \
|
||||
done
|
||||
libcommon.la: $(libcommon_la_OBJECTS) $(libcommon_la_DEPENDENCIES)
|
||||
$(CXXLINK) $(libcommon_la_LDFLAGS) $(libcommon_la_OBJECTS) $(libcommon_la_LIBADD) $(LIBS)
|
||||
|
||||
clean-noinstPROGRAMS:
|
||||
@list='$(noinst_PROGRAMS)'; for p in $$list; do \
|
||||
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f $$p $$f"; \
|
||||
rm -f $$p $$f ; \
|
||||
done
|
||||
BitVectorTest$(EXEEXT): $(BitVectorTest_OBJECTS) $(BitVectorTest_DEPENDENCIES)
|
||||
@rm -f BitVectorTest$(EXEEXT)
|
||||
$(CXXLINK) $(BitVectorTest_LDFLAGS) $(BitVectorTest_OBJECTS) $(BitVectorTest_LDADD) $(LIBS)
|
||||
ConfigurationTest$(EXEEXT): $(ConfigurationTest_OBJECTS) $(ConfigurationTest_DEPENDENCIES)
|
||||
@rm -f ConfigurationTest$(EXEEXT)
|
||||
$(CXXLINK) $(ConfigurationTest_LDFLAGS) $(ConfigurationTest_OBJECTS) $(ConfigurationTest_LDADD) $(LIBS)
|
||||
F16Test$(EXEEXT): $(F16Test_OBJECTS) $(F16Test_DEPENDENCIES)
|
||||
@rm -f F16Test$(EXEEXT)
|
||||
$(CXXLINK) $(F16Test_LDFLAGS) $(F16Test_OBJECTS) $(F16Test_LDADD) $(LIBS)
|
||||
InterthreadTest$(EXEEXT): $(InterthreadTest_OBJECTS) $(InterthreadTest_DEPENDENCIES)
|
||||
@rm -f InterthreadTest$(EXEEXT)
|
||||
$(CXXLINK) $(InterthreadTest_LDFLAGS) $(InterthreadTest_OBJECTS) $(InterthreadTest_LDADD) $(LIBS)
|
||||
LogTest$(EXEEXT): $(LogTest_OBJECTS) $(LogTest_DEPENDENCIES)
|
||||
@rm -f LogTest$(EXEEXT)
|
||||
$(CXXLINK) $(LogTest_LDFLAGS) $(LogTest_OBJECTS) $(LogTest_LDADD) $(LIBS)
|
||||
RegexpTest$(EXEEXT): $(RegexpTest_OBJECTS) $(RegexpTest_DEPENDENCIES)
|
||||
@rm -f RegexpTest$(EXEEXT)
|
||||
$(CXXLINK) $(RegexpTest_LDFLAGS) $(RegexpTest_OBJECTS) $(RegexpTest_LDADD) $(LIBS)
|
||||
SocketsTest$(EXEEXT): $(SocketsTest_OBJECTS) $(SocketsTest_DEPENDENCIES)
|
||||
@rm -f SocketsTest$(EXEEXT)
|
||||
$(CXXLINK) $(SocketsTest_LDFLAGS) $(SocketsTest_OBJECTS) $(SocketsTest_LDADD) $(LIBS)
|
||||
TimevalTest$(EXEEXT): $(TimevalTest_OBJECTS) $(TimevalTest_DEPENDENCIES)
|
||||
@rm -f TimevalTest$(EXEEXT)
|
||||
$(CXXLINK) $(TimevalTest_LDFLAGS) $(TimevalTest_OBJECTS) $(TimevalTest_LDADD) $(LIBS)
|
||||
VectorTest$(EXEEXT): $(VectorTest_OBJECTS) $(VectorTest_DEPENDENCIES)
|
||||
@rm -f VectorTest$(EXEEXT)
|
||||
$(CXXLINK) $(VectorTest_LDFLAGS) $(VectorTest_OBJECTS) $(VectorTest_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
include ./$(DEPDIR)/BitVector.Plo
|
||||
include ./$(DEPDIR)/BitVectorTest.Po
|
||||
include ./$(DEPDIR)/Configuration.Plo
|
||||
include ./$(DEPDIR)/ConfigurationTest.Po
|
||||
include ./$(DEPDIR)/F16Test.Po
|
||||
include ./$(DEPDIR)/InterthreadTest.Po
|
||||
include ./$(DEPDIR)/LinkedLists.Plo
|
||||
include ./$(DEPDIR)/LogTest.Po
|
||||
include ./$(DEPDIR)/Logger.Plo
|
||||
include ./$(DEPDIR)/RegexpTest.Po
|
||||
include ./$(DEPDIR)/Sockets.Plo
|
||||
include ./$(DEPDIR)/SocketsTest.Po
|
||||
include ./$(DEPDIR)/Threads.Plo
|
||||
include ./$(DEPDIR)/Timeval.Plo
|
||||
include ./$(DEPDIR)/TimevalTest.Po
|
||||
include ./$(DEPDIR)/VectorTest.Po
|
||||
|
||||
.cpp.o:
|
||||
if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
# source='$<' object='$@' libtool=no \
|
||||
# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
|
||||
# $(CXXCOMPILE) -c -o $@ $<
|
||||
|
||||
.cpp.obj:
|
||||
if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
|
||||
then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
# source='$<' object='$@' libtool=no \
|
||||
# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
|
||||
# $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
|
||||
.cpp.lo:
|
||||
if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
# source='$<' object='$@' libtool=yes \
|
||||
# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
|
||||
# $(LTCXXCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool
|
||||
uninstall-info-am:
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
$(mkdir_p) $(distdir)/..
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkdir_p) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
|
||||
clean-noinstPROGRAMS mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libtool clean-noinstLTLIBRARIES clean-noinstPROGRAMS \
|
||||
ctags distclean distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-exec install-exec-am install-info \
|
||||
install-info-am install-man install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags uninstall uninstall-am uninstall-info-am
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
|
@ -0,0 +1,95 @@
|
|||
#
|
||||
# Copyright 2008, 2009 Free Software Foundation, Inc.
|
||||
#
|
||||
# This software is distributed under the terms of the GNU Public License.
|
||||
# See the COPYING file in the main directory for details.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
include $(top_srcdir)/Makefile.common
|
||||
|
||||
AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES)
|
||||
AM_CXXFLAGS = -Wall -O3 -g -lpthread
|
||||
|
||||
EXTRA_DIST = \
|
||||
example.config \
|
||||
README.common
|
||||
|
||||
noinst_LTLIBRARIES = libcommon.la
|
||||
|
||||
libcommon_la_SOURCES = \
|
||||
BitVector.cpp \
|
||||
LinkedLists.cpp \
|
||||
Sockets.cpp \
|
||||
Threads.cpp \
|
||||
Timeval.cpp \
|
||||
Logger.cpp \
|
||||
Configuration.cpp
|
||||
|
||||
noinst_PROGRAMS = \
|
||||
BitVectorTest \
|
||||
InterthreadTest \
|
||||
SocketsTest \
|
||||
TimevalTest \
|
||||
RegexpTest \
|
||||
VectorTest \
|
||||
ConfigurationTest \
|
||||
LogTest \
|
||||
F16Test
|
||||
|
||||
noinst_HEADERS = \
|
||||
BitVector.h \
|
||||
Interthread.h \
|
||||
LinkedLists.h \
|
||||
Sockets.h \
|
||||
Threads.h \
|
||||
Timeval.h \
|
||||
Regexp.h \
|
||||
Vector.h \
|
||||
Configuration.h \
|
||||
F16.h \
|
||||
Logger.h
|
||||
|
||||
BitVectorTest_SOURCES = BitVectorTest.cpp
|
||||
BitVectorTest_LDADD = libcommon.la
|
||||
|
||||
InterthreadTest_SOURCES = InterthreadTest.cpp
|
||||
InterthreadTest_LDADD = libcommon.la
|
||||
InterthreadTest_LDFLAGS = -lpthread
|
||||
|
||||
SocketsTest_SOURCES = SocketsTest.cpp
|
||||
SocketsTest_LDADD = libcommon.la
|
||||
SocketsTest_LDFLAGS = -lpthread
|
||||
|
||||
TimevalTest_SOURCES = TimevalTest.cpp
|
||||
TimevalTest_LDADD = libcommon.la
|
||||
|
||||
VectorTest_SOURCES = VectorTest.cpp
|
||||
VectorTest_LDADD = libcommon.la
|
||||
|
||||
RegexpTest_SOURCES = RegexpTest.cpp
|
||||
RegexpTest_LDADD = libcommon.la
|
||||
|
||||
ConfigurationTest_SOURCES = ConfigurationTest.cpp
|
||||
ConfigurationTest_LDADD = libcommon.la $(SQLITE_LA)
|
||||
|
||||
LogTest_SOURCES = LogTest.cpp
|
||||
LogTest_LDADD = libcommon.la $(SQLITE_LA)
|
||||
|
||||
F16Test_SOURCES = F16Test.cpp
|
||||
|
||||
MOSTLYCLEANFILES += testSource testDestination
|
||||
|
||||
|
|
@ -0,0 +1,659 @@
|
|||
# Makefile.in generated by automake 1.9.4 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
#
|
||||
# Copyright 2008, 2009 Free Software Foundation, Inc.
|
||||
#
|
||||
# This software is distributed under the terms of the GNU Public License.
|
||||
# See the COPYING file in the main directory for details.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2008 Free Software Foundation, Inc.
|
||||
#
|
||||
# This software is distributed under the terms of the GNU Public License.
|
||||
# See the COPYING file in the main directory for details.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
|
||||
SOURCES = $(libcommon_la_SOURCES) $(BitVectorTest_SOURCES) $(ConfigurationTest_SOURCES) $(F16Test_SOURCES) $(InterthreadTest_SOURCES) $(LogTest_SOURCES) $(RegexpTest_SOURCES) $(SocketsTest_SOURCES) $(TimevalTest_SOURCES) $(VectorTest_SOURCES)
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ..
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in $(top_srcdir)/Makefile.common
|
||||
noinst_PROGRAMS = BitVectorTest$(EXEEXT) InterthreadTest$(EXEEXT) \
|
||||
SocketsTest$(EXEEXT) TimevalTest$(EXEEXT) RegexpTest$(EXEEXT) \
|
||||
VectorTest$(EXEEXT) ConfigurationTest$(EXEEXT) \
|
||||
LogTest$(EXEEXT) F16Test$(EXEEXT)
|
||||
subdir = CommonLibs
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
libcommon_la_LIBADD =
|
||||
am_libcommon_la_OBJECTS = BitVector.lo LinkedLists.lo Sockets.lo \
|
||||
Threads.lo Timeval.lo Logger.lo Configuration.lo
|
||||
libcommon_la_OBJECTS = $(am_libcommon_la_OBJECTS)
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
am_BitVectorTest_OBJECTS = BitVectorTest.$(OBJEXT)
|
||||
BitVectorTest_OBJECTS = $(am_BitVectorTest_OBJECTS)
|
||||
BitVectorTest_DEPENDENCIES = libcommon.la
|
||||
am_ConfigurationTest_OBJECTS = ConfigurationTest.$(OBJEXT)
|
||||
ConfigurationTest_OBJECTS = $(am_ConfigurationTest_OBJECTS)
|
||||
am__DEPENDENCIES_1 = $(top_builddir)/sqlite/libsqlite.la
|
||||
ConfigurationTest_DEPENDENCIES = libcommon.la $(am__DEPENDENCIES_1)
|
||||
am_F16Test_OBJECTS = F16Test.$(OBJEXT)
|
||||
F16Test_OBJECTS = $(am_F16Test_OBJECTS)
|
||||
F16Test_LDADD = $(LDADD)
|
||||
am_InterthreadTest_OBJECTS = InterthreadTest.$(OBJEXT)
|
||||
InterthreadTest_OBJECTS = $(am_InterthreadTest_OBJECTS)
|
||||
InterthreadTest_DEPENDENCIES = libcommon.la
|
||||
am_LogTest_OBJECTS = LogTest.$(OBJEXT)
|
||||
LogTest_OBJECTS = $(am_LogTest_OBJECTS)
|
||||
LogTest_DEPENDENCIES = libcommon.la $(am__DEPENDENCIES_1)
|
||||
am_RegexpTest_OBJECTS = RegexpTest.$(OBJEXT)
|
||||
RegexpTest_OBJECTS = $(am_RegexpTest_OBJECTS)
|
||||
RegexpTest_DEPENDENCIES = libcommon.la
|
||||
am_SocketsTest_OBJECTS = SocketsTest.$(OBJEXT)
|
||||
SocketsTest_OBJECTS = $(am_SocketsTest_OBJECTS)
|
||||
SocketsTest_DEPENDENCIES = libcommon.la
|
||||
am_TimevalTest_OBJECTS = TimevalTest.$(OBJEXT)
|
||||
TimevalTest_OBJECTS = $(am_TimevalTest_OBJECTS)
|
||||
TimevalTest_DEPENDENCIES = libcommon.la
|
||||
am_VectorTest_OBJECTS = VectorTest.$(OBJEXT)
|
||||
VectorTest_OBJECTS = $(am_VectorTest_OBJECTS)
|
||||
VectorTest_DEPENDENCIES = libcommon.la
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
||||
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
||||
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CXXFLAGS) $(CXXFLAGS)
|
||||
CXXLD = $(CXX)
|
||||
CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
|
||||
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = $(libcommon_la_SOURCES) $(BitVectorTest_SOURCES) \
|
||||
$(ConfigurationTest_SOURCES) $(F16Test_SOURCES) \
|
||||
$(InterthreadTest_SOURCES) $(LogTest_SOURCES) \
|
||||
$(RegexpTest_SOURCES) $(SocketsTest_SOURCES) \
|
||||
$(TimevalTest_SOURCES) $(VectorTest_SOURCES)
|
||||
DIST_SOURCES = $(libcommon_la_SOURCES) $(BitVectorTest_SOURCES) \
|
||||
$(ConfigurationTest_SOURCES) $(F16Test_SOURCES) \
|
||||
$(InterthreadTest_SOURCES) $(LogTest_SOURCES) \
|
||||
$(RegexpTest_SOURCES) $(SocketsTest_SOURCES) \
|
||||
$(TimevalTest_SOURCES) $(VectorTest_SOURCES)
|
||||
HEADERS = $(noinst_HEADERS)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCAS = @CCAS@
|
||||
CCASFLAGS = @CCASFLAGS@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
FFLAGS = @FFLAGS@
|
||||
GREP = @GREP@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
ORTP_CFLAGS = @ORTP_CFLAGS@
|
||||
ORTP_LIBS = @ORTP_LIBS@
|
||||
OSIP_CFLAGS = @OSIP_CFLAGS@
|
||||
OSIP_LIBS = @OSIP_LIBS@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
RANLIB = @RANLIB@
|
||||
RM_PROG = @RM_PROG@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
USRP_CFLAGS = @USRP_CFLAGS@
|
||||
USRP_LIBS = @USRP_LIBS@
|
||||
VERSION = @VERSION@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_F77 = @ac_ct_F77@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target = @target@
|
||||
target_alias = @target_alias@
|
||||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
COMMON_INCLUDEDIR = $(top_srcdir)/CommonLibs
|
||||
CONTROL_INCLUDEDIR = $(top_srcdir)/Control
|
||||
GSM_INCLUDEDIR = $(top_srcdir)/GSM
|
||||
SIP_INCLUDEDIR = $(top_srcdir)/SIP
|
||||
SMS_INCLUDEDIR = $(top_srcdir)/SMS
|
||||
TRX_INCLUDEDIR = $(top_srcdir)/TRXManager
|
||||
GLOBALS_INCLUDEDIR = $(top_srcdir)/Globals
|
||||
CLI_INCLUDEDIR = $(top_srcdir)/CLI
|
||||
SQLITE_INCLUDEDIR = $(top_srcdir)/sqlite
|
||||
HLR_INCLUDEDIR = $(top_srcdir)/HLR
|
||||
STD_DEFINES_AND_INCLUDES = \
|
||||
-I$(COMMON_INCLUDEDIR) \
|
||||
-I$(CONTROL_INCLUDEDIR) \
|
||||
-I$(GSM_INCLUDEDIR) \
|
||||
-I$(SIP_INCLUDEDIR) \
|
||||
-I$(SMS_INCLUDEDIR) \
|
||||
-I$(TRX_INCLUDEDIR) \
|
||||
-I$(GLOBALS_INCLUDEDIR) \
|
||||
-I$(CLI_INCLUDEDIR) \
|
||||
-I$(HLR_INCLUDEDIR) \
|
||||
-I$(SQLITE_INCLUDEDIR)
|
||||
|
||||
COMMON_LA = $(top_builddir)/CommonLibs/libcommon.la
|
||||
GSM_LA = $(top_builddir)/GSM/libGSM.la
|
||||
SIP_LA = $(top_builddir)/SIP/libSIP.la
|
||||
SMS_LA = $(top_builddir)/SMS/libSMS.la
|
||||
TRX_LA = $(top_builddir)/TRXManager/libtrxmanager.la
|
||||
CONTROL_LA = $(top_builddir)/Control/libcontrol.la
|
||||
GLOBALS_LA = $(top_builddir)/Globals/libglobals.la
|
||||
CLI_LA = $(top_builddir)/CLI/libcli.la
|
||||
HLR_LA = $(top_builddir)/HLR/libHLR.la
|
||||
SQLITE_LA = $(top_builddir)/sqlite/libsqlite.la
|
||||
MOSTLYCLEANFILES = *~ testSource testDestination
|
||||
AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES)
|
||||
AM_CXXFLAGS = -Wall -O3 -g -lpthread
|
||||
EXTRA_DIST = \
|
||||
example.config \
|
||||
README.common
|
||||
|
||||
noinst_LTLIBRARIES = libcommon.la
|
||||
libcommon_la_SOURCES = \
|
||||
BitVector.cpp \
|
||||
LinkedLists.cpp \
|
||||
Sockets.cpp \
|
||||
Threads.cpp \
|
||||
Timeval.cpp \
|
||||
Logger.cpp \
|
||||
Configuration.cpp
|
||||
|
||||
noinst_HEADERS = \
|
||||
BitVector.h \
|
||||
Interthread.h \
|
||||
LinkedLists.h \
|
||||
Sockets.h \
|
||||
Threads.h \
|
||||
Timeval.h \
|
||||
Regexp.h \
|
||||
Vector.h \
|
||||
Configuration.h \
|
||||
F16.h \
|
||||
Logger.h
|
||||
|
||||
BitVectorTest_SOURCES = BitVectorTest.cpp
|
||||
BitVectorTest_LDADD = libcommon.la
|
||||
InterthreadTest_SOURCES = InterthreadTest.cpp
|
||||
InterthreadTest_LDADD = libcommon.la
|
||||
InterthreadTest_LDFLAGS = -lpthread
|
||||
SocketsTest_SOURCES = SocketsTest.cpp
|
||||
SocketsTest_LDADD = libcommon.la
|
||||
SocketsTest_LDFLAGS = -lpthread
|
||||
TimevalTest_SOURCES = TimevalTest.cpp
|
||||
TimevalTest_LDADD = libcommon.la
|
||||
VectorTest_SOURCES = VectorTest.cpp
|
||||
VectorTest_LDADD = libcommon.la
|
||||
RegexpTest_SOURCES = RegexpTest.cpp
|
||||
RegexpTest_LDADD = libcommon.la
|
||||
ConfigurationTest_SOURCES = ConfigurationTest.cpp
|
||||
ConfigurationTest_LDADD = libcommon.la $(SQLITE_LA)
|
||||
LogTest_SOURCES = LogTest.cpp
|
||||
LogTest_LDADD = libcommon.la $(SQLITE_LA)
|
||||
F16Test_SOURCES = F16Test.cpp
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .cpp .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu CommonLibs/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu CommonLibs/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
clean-noinstLTLIBRARIES:
|
||||
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
|
||||
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
|
||||
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
|
||||
test "$$dir" != "$$p" || dir=.; \
|
||||
echo "rm -f \"$${dir}/so_locations\""; \
|
||||
rm -f "$${dir}/so_locations"; \
|
||||
done
|
||||
libcommon.la: $(libcommon_la_OBJECTS) $(libcommon_la_DEPENDENCIES)
|
||||
$(CXXLINK) $(libcommon_la_LDFLAGS) $(libcommon_la_OBJECTS) $(libcommon_la_LIBADD) $(LIBS)
|
||||
|
||||
clean-noinstPROGRAMS:
|
||||
@list='$(noinst_PROGRAMS)'; for p in $$list; do \
|
||||
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f $$p $$f"; \
|
||||
rm -f $$p $$f ; \
|
||||
done
|
||||
BitVectorTest$(EXEEXT): $(BitVectorTest_OBJECTS) $(BitVectorTest_DEPENDENCIES)
|
||||
@rm -f BitVectorTest$(EXEEXT)
|
||||
$(CXXLINK) $(BitVectorTest_LDFLAGS) $(BitVectorTest_OBJECTS) $(BitVectorTest_LDADD) $(LIBS)
|
||||
ConfigurationTest$(EXEEXT): $(ConfigurationTest_OBJECTS) $(ConfigurationTest_DEPENDENCIES)
|
||||
@rm -f ConfigurationTest$(EXEEXT)
|
||||
$(CXXLINK) $(ConfigurationTest_LDFLAGS) $(ConfigurationTest_OBJECTS) $(ConfigurationTest_LDADD) $(LIBS)
|
||||
F16Test$(EXEEXT): $(F16Test_OBJECTS) $(F16Test_DEPENDENCIES)
|
||||
@rm -f F16Test$(EXEEXT)
|
||||
$(CXXLINK) $(F16Test_LDFLAGS) $(F16Test_OBJECTS) $(F16Test_LDADD) $(LIBS)
|
||||
InterthreadTest$(EXEEXT): $(InterthreadTest_OBJECTS) $(InterthreadTest_DEPENDENCIES)
|
||||
@rm -f InterthreadTest$(EXEEXT)
|
||||
$(CXXLINK) $(InterthreadTest_LDFLAGS) $(InterthreadTest_OBJECTS) $(InterthreadTest_LDADD) $(LIBS)
|
||||
LogTest$(EXEEXT): $(LogTest_OBJECTS) $(LogTest_DEPENDENCIES)
|
||||
@rm -f LogTest$(EXEEXT)
|
||||
$(CXXLINK) $(LogTest_LDFLAGS) $(LogTest_OBJECTS) $(LogTest_LDADD) $(LIBS)
|
||||
RegexpTest$(EXEEXT): $(RegexpTest_OBJECTS) $(RegexpTest_DEPENDENCIES)
|
||||
@rm -f RegexpTest$(EXEEXT)
|
||||
$(CXXLINK) $(RegexpTest_LDFLAGS) $(RegexpTest_OBJECTS) $(RegexpTest_LDADD) $(LIBS)
|
||||
SocketsTest$(EXEEXT): $(SocketsTest_OBJECTS) $(SocketsTest_DEPENDENCIES)
|
||||
@rm -f SocketsTest$(EXEEXT)
|
||||
$(CXXLINK) $(SocketsTest_LDFLAGS) $(SocketsTest_OBJECTS) $(SocketsTest_LDADD) $(LIBS)
|
||||
TimevalTest$(EXEEXT): $(TimevalTest_OBJECTS) $(TimevalTest_DEPENDENCIES)
|
||||
@rm -f TimevalTest$(EXEEXT)
|
||||
$(CXXLINK) $(TimevalTest_LDFLAGS) $(TimevalTest_OBJECTS) $(TimevalTest_LDADD) $(LIBS)
|
||||
VectorTest$(EXEEXT): $(VectorTest_OBJECTS) $(VectorTest_DEPENDENCIES)
|
||||
@rm -f VectorTest$(EXEEXT)
|
||||
$(CXXLINK) $(VectorTest_LDFLAGS) $(VectorTest_OBJECTS) $(VectorTest_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BitVector.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BitVectorTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Configuration.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ConfigurationTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/F16Test.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InterthreadTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LinkedLists.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LogTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Logger.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RegexpTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Sockets.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SocketsTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Threads.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Timeval.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TimevalTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VectorTest.Po@am__quote@
|
||||
|
||||
.cpp.o:
|
||||
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
|
||||
|
||||
.cpp.obj:
|
||||
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
|
||||
.cpp.lo:
|
||||
@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool
|
||||
uninstall-info-am:
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
$(mkdir_p) $(distdir)/..
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkdir_p) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
|
||||
clean-noinstPROGRAMS mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libtool clean-noinstLTLIBRARIES clean-noinstPROGRAMS \
|
||||
ctags distclean distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-exec install-exec-am install-info \
|
||||
install-info-am install-man install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags uninstall uninstall-am uninstall-info-am
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
|
@ -0,0 +1,15 @@
|
|||
This directory contains common-use classes, most of which are not specific to GSM.
|
||||
|
||||
Vector A vector class (NOT std::vector<>) that supports
|
||||
aliased subvectors. Not resizable.
|
||||
BitVector Bit-indexable vectors based on Vector.
|
||||
Interthread A set of C++ wrappers for pthread facilities.
|
||||
Sockets A set of C++ wrappers for Unix sockets.
|
||||
Timeval A C++ wraper for struct timeval.
|
||||
LinkLists Classes for simple linked lists of pointers.
|
||||
Logger A logging interface based on syslogd.
|
||||
Configuration A key-value configuration table.
|
||||
Regexp A C++ wrapper on stdlib regular expressions.
|
||||
|
||||
Do "make tests" to build a series of unit tests for these classes.
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef REGEXPW_H
|
||||
#define REGEXPW_H
|
||||
|
||||
#include <regex.h>
|
||||
#include <iostream>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
|
||||
class Regexp {
|
||||
|
||||
private:
|
||||
|
||||
regex_t mRegex;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
Regexp(const char* regexp, int flags=REG_EXTENDED)
|
||||
{
|
||||
int result = regcomp(&mRegex, regexp, flags);
|
||||
if (result) {
|
||||
char msg[256];
|
||||
regerror(result,&mRegex,msg,255);
|
||||
std::cerr << "Regexp compilation of " << regexp << " failed: " << msg << std::endl;
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
~Regexp()
|
||||
{ regfree(&mRegex); }
|
||||
|
||||
bool match(const char *text, int flags=0) const
|
||||
{ return regexec(&mRegex, text, 0, NULL, flags)==0; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "Regexp.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
Regexp email("^[[:graph:]]+@[[:graph:]]+ ");
|
||||
Regexp simple("^dburgess@");
|
||||
|
||||
const char text1[] = "dburgess@jcis.net test message";
|
||||
const char text2[] = "no address text message";
|
||||
|
||||
cout << email.match(text1) << " " << text1 << endl;
|
||||
cout << email.match(text2) << " " << text2 << endl;
|
||||
|
||||
cout << simple.match(text1) << " " << text1 << endl;
|
||||
cout << simple.match(text2) << " " << text2 << endl;
|
||||
}
|
|
@ -0,0 +1,302 @@
|
|||
/*
|
||||
* Copyright 2008, 2010 Free Software Foundation, Inc.
|
||||
*
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <cstdio>
|
||||
#include <sys/select.h>
|
||||
|
||||
#include "Threads.h"
|
||||
#include "Sockets.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool resolveAddress(struct sockaddr_in *address, const char *hostAndPort)
|
||||
{
|
||||
assert(address);
|
||||
assert(hostAndPort);
|
||||
char *copy = strdup(hostAndPort);
|
||||
char *colon = strchr(copy,':');
|
||||
if (!colon) return false;
|
||||
*colon = '\0';
|
||||
char *host = copy;
|
||||
unsigned port = strtol(colon+1,NULL,10);
|
||||
bool retVal = resolveAddress(address,host,port);
|
||||
free(copy);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
bool resolveAddress(struct sockaddr_in *address, const char *host, unsigned short port)
|
||||
{
|
||||
assert(address);
|
||||
assert(host);
|
||||
// FIXME -- Need to ignore leading/trailing spaces in hostname.
|
||||
struct hostent *hp = gethostbyname(host);
|
||||
if (hp==NULL) {
|
||||
CERR("WARNING -- gethostbyname() failed for " << host << ", " << hstrerror(h_errno));
|
||||
return false;
|
||||
}
|
||||
address->sin_family = AF_INET;
|
||||
bcopy(hp->h_addr, &(address->sin_addr), hp->h_length);
|
||||
address->sin_port = htons(port);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
DatagramSocket::DatagramSocket()
|
||||
{
|
||||
bzero(mDestination,sizeof(mDestination));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void DatagramSocket::nonblocking()
|
||||
{
|
||||
fcntl(mSocketFD,F_SETFL,O_NONBLOCK);
|
||||
}
|
||||
|
||||
void DatagramSocket::blocking()
|
||||
{
|
||||
fcntl(mSocketFD,F_SETFL,0);
|
||||
}
|
||||
|
||||
void DatagramSocket::close()
|
||||
{
|
||||
::close(mSocketFD);
|
||||
}
|
||||
|
||||
|
||||
DatagramSocket::~DatagramSocket()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int DatagramSocket::write( const char * message, size_t length )
|
||||
{
|
||||
assert(length<=MAX_UDP_LENGTH);
|
||||
int retVal = sendto(mSocketFD, message, length, 0,
|
||||
(struct sockaddr *)mDestination, addressSize());
|
||||
if (retVal == -1 ) perror("DatagramSocket::write() failed");
|
||||
return retVal;
|
||||
}
|
||||
|
||||
int DatagramSocket::writeBack( const char * message, size_t length )
|
||||
{
|
||||
assert(length<=MAX_UDP_LENGTH);
|
||||
int retVal = sendto(mSocketFD, message, length, 0,
|
||||
(struct sockaddr *)mSource, addressSize());
|
||||
if (retVal == -1 ) perror("DatagramSocket::write() failed");
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int DatagramSocket::write( const char * message)
|
||||
{
|
||||
size_t length=strlen(message)+1;
|
||||
return write(message,length);
|
||||
}
|
||||
|
||||
int DatagramSocket::writeBack( const char * message)
|
||||
{
|
||||
size_t length=strlen(message)+1;
|
||||
return writeBack(message,length);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int DatagramSocket::send(const struct sockaddr* dest, const char * message, size_t length )
|
||||
{
|
||||
assert(length<=MAX_UDP_LENGTH);
|
||||
int retVal = sendto(mSocketFD, message, length, 0, dest, addressSize());
|
||||
if (retVal == -1 ) perror("DatagramSocket::send() failed");
|
||||
return retVal;
|
||||
}
|
||||
|
||||
int DatagramSocket::send(const struct sockaddr* dest, const char * message)
|
||||
{
|
||||
size_t length=strlen(message)+1;
|
||||
return send(dest,message,length);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int DatagramSocket::read(char* buffer)
|
||||
{
|
||||
socklen_t temp_len = sizeof(mSource);
|
||||
int length = recvfrom(mSocketFD, (void*)buffer, MAX_UDP_LENGTH, 0,
|
||||
(struct sockaddr*)&mSource,&temp_len);
|
||||
if ((length==-1) && (errno!=EAGAIN)) {
|
||||
perror("DatagramSocket::read() failed");
|
||||
throw SocketError();
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
int DatagramSocket::read(char* buffer, unsigned timeout)
|
||||
{
|
||||
fd_set fds;
|
||||
FD_SET(mSocketFD,&fds);
|
||||
struct timeval tv;
|
||||
tv.tv_sec = timeout/1000;
|
||||
tv.tv_usec = (timeout%1000)*1000;
|
||||
int sel = select(mSocketFD+1,&fds,NULL,NULL,&tv);
|
||||
if (sel<0) {
|
||||
perror("DatagramSocket::read() select() failed");
|
||||
throw SocketError();
|
||||
}
|
||||
if (sel==0) return -1;
|
||||
return read(buffer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
UDPSocket::UDPSocket(unsigned short wSrcPort)
|
||||
:DatagramSocket()
|
||||
{
|
||||
open(wSrcPort);
|
||||
}
|
||||
|
||||
|
||||
UDPSocket::UDPSocket(unsigned short wSrcPort,
|
||||
const char * wDestIP, unsigned short wDestPort )
|
||||
:DatagramSocket()
|
||||
{
|
||||
open(wSrcPort);
|
||||
destination(wDestPort, wDestIP);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void UDPSocket::destination( unsigned short wDestPort, const char * wDestIP )
|
||||
{
|
||||
resolveAddress((sockaddr_in*)mDestination, wDestIP, wDestPort );
|
||||
}
|
||||
|
||||
|
||||
void UDPSocket::open(unsigned short localPort)
|
||||
{
|
||||
// create
|
||||
mSocketFD = socket(AF_INET,SOCK_DGRAM,0);
|
||||
if (mSocketFD<0) {
|
||||
perror("socket() failed");
|
||||
throw SocketError();
|
||||
}
|
||||
|
||||
// bind
|
||||
struct sockaddr_in address;
|
||||
size_t length = sizeof(address);
|
||||
bzero(&address,length);
|
||||
address.sin_family = AF_INET;
|
||||
address.sin_addr.s_addr = INADDR_ANY;
|
||||
address.sin_port = htons(localPort);
|
||||
if (bind(mSocketFD,(struct sockaddr*)&address,length)<0) {
|
||||
perror("bind() failed");
|
||||
throw SocketError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned short UDPSocket::port() const
|
||||
{
|
||||
struct sockaddr_in name;
|
||||
socklen_t nameSize = sizeof(name);
|
||||
int retVal = getsockname(mSocketFD, (struct sockaddr*)&name, &nameSize);
|
||||
if (retVal==-1) throw SocketError();
|
||||
return ntohs(name.sin_port);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
UDDSocket::UDDSocket(const char* localPath, const char* remotePath)
|
||||
:DatagramSocket()
|
||||
{
|
||||
if (localPath!=NULL) open(localPath);
|
||||
if (remotePath!=NULL) destination(remotePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void UDDSocket::open(const char* localPath)
|
||||
{
|
||||
// create
|
||||
mSocketFD = socket(AF_UNIX,SOCK_DGRAM,0);
|
||||
if (mSocketFD<0) {
|
||||
perror("socket() failed");
|
||||
throw SocketError();
|
||||
}
|
||||
|
||||
// bind
|
||||
struct sockaddr_un address;
|
||||
size_t length = sizeof(address);
|
||||
bzero(&address,length);
|
||||
address.sun_family = AF_UNIX;
|
||||
strcpy(address.sun_path,localPath);
|
||||
unlink(localPath);
|
||||
if (bind(mSocketFD,(struct sockaddr*)&address,length)<0) {
|
||||
perror("bind() failed");
|
||||
throw SocketError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void UDDSocket::destination(const char* remotePath)
|
||||
{
|
||||
struct sockaddr_un* unAddr = (struct sockaddr_un*)mDestination;
|
||||
strcpy(unAddr->sun_path,remotePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// vim:ts=4:sw=4
|
|
@ -0,0 +1,193 @@
|
|||
/*
|
||||
* Copyright 2008, 2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SOCKETS_H
|
||||
#define SOCKETS_H
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/un.h>
|
||||
#include <errno.h>
|
||||
#include <list>
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define MAX_UDP_LENGTH 1500
|
||||
|
||||
/** A function to resolve IP host names. */
|
||||
bool resolveAddress(struct sockaddr_in *address, const char *host, unsigned short port);
|
||||
|
||||
/** Resolve an address of the form "<host>:<port>". */
|
||||
bool resolveAddress(struct sockaddr_in *address, const char *hostAndPort);
|
||||
|
||||
/** An exception to throw when a critical socket operation fails. */
|
||||
class SocketError {};
|
||||
#define SOCKET_ERROR {throw SocketError(); }
|
||||
|
||||
/** Abstract class for connectionless sockets. */
|
||||
class DatagramSocket {
|
||||
|
||||
protected:
|
||||
|
||||
int mSocketFD; ///< underlying file descriptor
|
||||
char mDestination[256]; ///< address to which packets are sent
|
||||
char mSource[256]; ///< return address of most recent received packet
|
||||
|
||||
public:
|
||||
|
||||
/** An almost-does-nothing constructor. */
|
||||
DatagramSocket();
|
||||
|
||||
virtual ~DatagramSocket();
|
||||
|
||||
/** Return the address structure size for this socket type. */
|
||||
virtual size_t addressSize() const = 0;
|
||||
|
||||
/**
|
||||
Send a binary packet.
|
||||
@param buffer The data bytes to send to mDestination.
|
||||
@param length Number of bytes to send, or strlen(buffer) if defaulted to -1.
|
||||
@return number of bytes written, or -1 on error.
|
||||
*/
|
||||
int write( const char * buffer, size_t length);
|
||||
|
||||
/**
|
||||
Send a C-style string packet.
|
||||
@param buffer The data bytes to send to mDestination.
|
||||
@return number of bytes written, or -1 on error.
|
||||
*/
|
||||
int write( const char * buffer);
|
||||
|
||||
/**
|
||||
Send a binary packet.
|
||||
@param buffer The data bytes to send to mSource.
|
||||
@param length Number of bytes to send, or strlen(buffer) if defaulted to -1.
|
||||
@return number of bytes written, or -1 on error.
|
||||
*/
|
||||
int writeBack(const char * buffer, size_t length);
|
||||
|
||||
/**
|
||||
Send a C-style string packet.
|
||||
@param buffer The data bytes to send to mSource.
|
||||
@return number of bytes written, or -1 on error.
|
||||
*/
|
||||
int writeBack(const char * buffer);
|
||||
|
||||
|
||||
/**
|
||||
Receive a packet.
|
||||
@param buffer A char[MAX_UDP_LENGTH] procured by the caller.
|
||||
@return The number of bytes received or -1 on non-blocking pass.
|
||||
*/
|
||||
int read(char* buffer);
|
||||
|
||||
/**
|
||||
Receive a packet with a timeout.
|
||||
@param buffer A char[MAX_UDP_LENGTH] procured by the caller.
|
||||
@param maximum wait time in milliseconds
|
||||
@return The number of bytes received or -1 on timeout.
|
||||
*/
|
||||
int read(char* buffer, unsigned timeout);
|
||||
|
||||
|
||||
/** Send a packet to a given destination, other than the default. */
|
||||
int send(const struct sockaddr *dest, const char * buffer, size_t length);
|
||||
|
||||
/** Send a C-style string to a given destination, other than the default. */
|
||||
int send(const struct sockaddr *dest, const char * buffer);
|
||||
|
||||
/** Make the socket non-blocking. */
|
||||
void nonblocking();
|
||||
|
||||
/** Make the socket blocking (the default). */
|
||||
void blocking();
|
||||
|
||||
/** Close the socket. */
|
||||
void close();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** UDP/IP User Datagram Socket */
|
||||
class UDPSocket : public DatagramSocket {
|
||||
|
||||
public:
|
||||
|
||||
/** Open a USP socket with an OS-assigned port and no default destination. */
|
||||
UDPSocket( unsigned short localPort=0);
|
||||
|
||||
/** Given a full specification, open the socket and set the dest address. */
|
||||
UDPSocket( unsigned short localPort,
|
||||
const char * remoteIP, unsigned short remotePort);
|
||||
|
||||
/** Set the destination port. */
|
||||
void destination( unsigned short wDestPort, const char * wDestIP );
|
||||
|
||||
/** Return the actual port number in use. */
|
||||
unsigned short port() const;
|
||||
|
||||
/** Open and bind the UDP socket to a local port. */
|
||||
void open(unsigned short localPort=0);
|
||||
|
||||
/** Give the return address of the most recently received packet. */
|
||||
const struct sockaddr_in* source() const { return (const struct sockaddr_in*)mSource; }
|
||||
|
||||
size_t addressSize() const { return sizeof(struct sockaddr_in); }
|
||||
|
||||
};
|
||||
|
||||
|
||||
/** Unix Domain Datagram Socket */
|
||||
class UDDSocket : public DatagramSocket {
|
||||
|
||||
public:
|
||||
|
||||
UDDSocket(const char* localPath=NULL, const char* remotePath=NULL);
|
||||
|
||||
void destination(const char* remotePath);
|
||||
|
||||
void open(const char* localPath);
|
||||
|
||||
/** Give the return address of the most recently received packet. */
|
||||
const struct sockaddr_un* source() const { return (const struct sockaddr_un*)mSource; }
|
||||
|
||||
size_t addressSize() const { return sizeof(struct sockaddr_un); }
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// vim:ts=4:sw=4
|
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* Copyright 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "Sockets.h"
|
||||
#include "Threads.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
static const int gNumToSend = 10;
|
||||
|
||||
|
||||
void *testReaderIP(void *)
|
||||
{
|
||||
UDPSocket readSocket(5934, "localhost", 5061);
|
||||
readSocket.nonblocking();
|
||||
int rc = 0;
|
||||
while (rc<gNumToSend) {
|
||||
char buf[MAX_UDP_LENGTH];
|
||||
int count = readSocket.read(buf);
|
||||
if (count>0) {
|
||||
COUT("read: " << buf);
|
||||
rc++;
|
||||
} else {
|
||||
sleep(2);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void *testReaderUnix(void *)
|
||||
{
|
||||
UDDSocket readSocket("testDestination");
|
||||
readSocket.nonblocking();
|
||||
int rc = 0;
|
||||
while (rc<gNumToSend) {
|
||||
char buf[MAX_UDP_LENGTH];
|
||||
int count = readSocket.read(buf);
|
||||
if (count>0) {
|
||||
COUT("read: " << buf);
|
||||
rc++;
|
||||
} else {
|
||||
sleep(2);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char * argv[] )
|
||||
{
|
||||
|
||||
Thread readerThreadIP;
|
||||
readerThreadIP.start(testReaderIP,NULL);
|
||||
Thread readerThreadUnix;
|
||||
readerThreadUnix.start(testReaderUnix,NULL);
|
||||
|
||||
UDPSocket socket1(5061, "127.0.0.1",5934);
|
||||
UDDSocket socket1U("testSource","testDestination");
|
||||
|
||||
COUT("socket1: " << socket1.port());
|
||||
|
||||
// give the readers time to open
|
||||
sleep(1);
|
||||
|
||||
for (int i=0; i<gNumToSend; i++) {
|
||||
socket1.write("Hello IP land");
|
||||
socket1U.write("Hello Unix domain");
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
readerThreadIP.join();
|
||||
readerThreadUnix.join();
|
||||
}
|
||||
|
||||
// vim: ts=4 sw=4
|
|
@ -0,0 +1,120 @@
|
|||
/*
|
||||
* Copyright 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "Threads.h"
|
||||
#include "Timeval.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
|
||||
Mutex gStreamLock; ///< Global lock to control access to cout and cerr.
|
||||
|
||||
void lockCout()
|
||||
{
|
||||
gStreamLock.lock();
|
||||
Timeval entryTime;
|
||||
cout << entryTime << " " << pthread_self() << ": ";
|
||||
}
|
||||
|
||||
|
||||
void unlockCout()
|
||||
{
|
||||
cout << dec << endl << flush;
|
||||
gStreamLock.unlock();
|
||||
}
|
||||
|
||||
|
||||
void lockCerr()
|
||||
{
|
||||
gStreamLock.lock();
|
||||
Timeval entryTime;
|
||||
cerr << entryTime << " " << pthread_self() << ": ";
|
||||
}
|
||||
|
||||
void unlockCerr()
|
||||
{
|
||||
cerr << dec << endl << flush;
|
||||
gStreamLock.unlock();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Mutex::Mutex()
|
||||
{
|
||||
bool res;
|
||||
res = pthread_mutexattr_init(&mAttribs);
|
||||
assert(!res);
|
||||
res = pthread_mutexattr_settype(&mAttribs,PTHREAD_MUTEX_RECURSIVE);
|
||||
assert(!res);
|
||||
res = pthread_mutex_init(&mMutex,&mAttribs);
|
||||
assert(!res);
|
||||
}
|
||||
|
||||
|
||||
Mutex::~Mutex()
|
||||
{
|
||||
pthread_mutex_destroy(&mMutex);
|
||||
bool res = pthread_mutexattr_destroy(&mAttribs);
|
||||
assert(!res);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/** Block for the signal up to the cancellation timeout. */
|
||||
void Signal::wait(Mutex& wMutex, unsigned timeout) const
|
||||
{
|
||||
Timeval then(timeout);
|
||||
struct timespec waitTime = then.timespec();
|
||||
pthread_cond_timedwait(&mSignal,&wMutex.mMutex,&waitTime);
|
||||
}
|
||||
|
||||
|
||||
void Thread::start(void *(*task)(void*), void *arg)
|
||||
{
|
||||
assert(mThread==((pthread_t)0));
|
||||
bool res;
|
||||
res = pthread_attr_init(&mAttrib);
|
||||
assert(!res);
|
||||
res = pthread_attr_setstacksize(&mAttrib, mStackSize);
|
||||
assert(!res);
|
||||
res = pthread_create(&mThread, &mAttrib, task, arg);
|
||||
assert(!res);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// vim: ts=4 sw=4
|
|
@ -0,0 +1,176 @@
|
|||
/*
|
||||
* Copyright 2008, 2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef THREADS_H
|
||||
#define THREADS_H
|
||||
|
||||
#include <pthread.h>
|
||||
#include <iostream>
|
||||
#include <assert.h>
|
||||
|
||||
class Mutex;
|
||||
|
||||
|
||||
/**@name Multithreaded access for standard streams. */
|
||||
//@{
|
||||
|
||||
/**@name Functions for gStreamLock. */
|
||||
//@{
|
||||
extern Mutex gStreamLock; ///< global lock for cout and cerr
|
||||
void lockCerr(); ///< call prior to writing cerr
|
||||
void unlockCerr(); ///< call after writing cerr
|
||||
void lockCout(); ///< call prior to writing cout
|
||||
void unlockCout(); ///< call after writing cout
|
||||
//@}
|
||||
|
||||
/**@name Macros for standard messages. */
|
||||
//@{
|
||||
#define COUT(text) { lockCout(); std::cout << text; unlockCout(); }
|
||||
#define CERR(text) { lockCerr(); std::cerr << __FILE__ << ":" << __LINE__ << ": " << text; unlockCerr(); }
|
||||
#ifdef NDEBUG
|
||||
#define DCOUT(text) {}
|
||||
#define OBJDCOUT(text) {}
|
||||
#else
|
||||
#define DCOUT(text) { COUT(__FILE__ << ":" << __LINE__ << " " << text); }
|
||||
#define OBJDCOUT(text) { DCOUT(this << " " << text); }
|
||||
#endif
|
||||
//@}
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
/**@defgroup C++ wrappers for pthread mechanisms. */
|
||||
//@{
|
||||
|
||||
/** A class for recursive mutexes based on pthread_mutex. */
|
||||
class Mutex {
|
||||
|
||||
private:
|
||||
|
||||
pthread_mutex_t mMutex;
|
||||
pthread_mutexattr_t mAttribs;
|
||||
|
||||
public:
|
||||
|
||||
Mutex();
|
||||
|
||||
~Mutex();
|
||||
|
||||
void lock() { pthread_mutex_lock(&mMutex); }
|
||||
|
||||
void unlock() { pthread_mutex_unlock(&mMutex); }
|
||||
|
||||
friend class Signal;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class ScopedLock {
|
||||
|
||||
private:
|
||||
Mutex& mMutex;
|
||||
|
||||
public:
|
||||
ScopedLock(Mutex& wMutex) :mMutex(wMutex) { mMutex.lock(); }
|
||||
~ScopedLock() { mMutex.unlock(); }
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/** A C++ interthread signal based on pthread condition variables. */
|
||||
class Signal {
|
||||
|
||||
private:
|
||||
|
||||
mutable pthread_cond_t mSignal;
|
||||
|
||||
public:
|
||||
|
||||
Signal() { int s = pthread_cond_init(&mSignal,NULL); assert(!s); }
|
||||
|
||||
~Signal() { pthread_cond_destroy(&mSignal); }
|
||||
|
||||
/**
|
||||
Block for the signal up to the cancellation timeout.
|
||||
Under Linux, spurious returns are possible.
|
||||
*/
|
||||
void wait(Mutex& wMutex, unsigned timeout) const;
|
||||
|
||||
/**
|
||||
Block for the signal.
|
||||
Under Linux, spurious returns are possible.
|
||||
*/
|
||||
void wait(Mutex& wMutex) const
|
||||
{ pthread_cond_wait(&mSignal,&wMutex.mMutex); }
|
||||
|
||||
void signal() { pthread_cond_signal(&mSignal); }
|
||||
|
||||
void broadcast() { pthread_cond_broadcast(&mSignal); }
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define START_THREAD(thread,function,argument) \
|
||||
thread.start((void *(*)(void*))function, (void*)argument);
|
||||
|
||||
/** A C++ wrapper for pthread threads. */
|
||||
class Thread {
|
||||
|
||||
private:
|
||||
|
||||
pthread_t mThread;
|
||||
pthread_attr_t mAttrib;
|
||||
// FIXME -- Can this be reduced now?
|
||||
size_t mStackSize;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/** Create a thread in a non-running state. */
|
||||
Thread(size_t wStackSize = (65536*4)):mThread((pthread_t)0) { mStackSize=wStackSize;}
|
||||
|
||||
/**
|
||||
Destroy the Thread.
|
||||
It should be stopped and joined.
|
||||
*/
|
||||
~Thread() { pthread_attr_destroy(&mAttrib); }
|
||||
|
||||
|
||||
/** Start the thread on a task. */
|
||||
void start(void *(*task)(void*), void *arg);
|
||||
|
||||
/** Join a thread that will stop on its own. */
|
||||
void join() { int s = pthread_join(mThread,NULL); assert(!s); }
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
// vim: ts=4 sw=4
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* Copyright 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "Timeval.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
void Timeval::future(unsigned offset)
|
||||
{
|
||||
now();
|
||||
unsigned sec = offset/1000;
|
||||
unsigned msec = offset%1000;
|
||||
mTimeval.tv_usec += msec*1000;
|
||||
mTimeval.tv_sec += sec;
|
||||
if (mTimeval.tv_usec>1000000) {
|
||||
mTimeval.tv_usec -= 1000000;
|
||||
mTimeval.tv_sec += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct timespec Timeval::timespec() const
|
||||
{
|
||||
struct timespec retVal;
|
||||
retVal.tv_sec = mTimeval.tv_sec;
|
||||
retVal.tv_nsec = 1000 * (long)mTimeval.tv_usec;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
bool Timeval::passed() const
|
||||
{
|
||||
Timeval nowTime;
|
||||
if (nowTime.mTimeval.tv_sec < mTimeval.tv_sec) return false;
|
||||
if (nowTime.mTimeval.tv_sec > mTimeval.tv_sec) return true;
|
||||
if (nowTime.mTimeval.tv_usec > mTimeval.tv_usec) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
double Timeval::seconds() const
|
||||
{
|
||||
return ((double)mTimeval.tv_sec) + 1e-6*((double)mTimeval.tv_usec);
|
||||
}
|
||||
|
||||
|
||||
|
||||
long Timeval::delta(const Timeval& other) const
|
||||
{
|
||||
// 2^31 milliseconds is just over 4 years.
|
||||
long deltaS = other.sec() - sec();
|
||||
long deltaUs = other.usec() - usec();
|
||||
return 1000*deltaS + deltaUs/1000;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ostream& operator<<(ostream& os, const Timeval& tv)
|
||||
{
|
||||
os.setf( ios::fixed, ios::floatfield );
|
||||
os << tv.seconds();
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
ostream& operator<<(ostream& os, const struct timespec& ts)
|
||||
{
|
||||
os << ts.tv_sec << "," << ts.tv_nsec;
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// vim: ts=4 sw=4
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* Copyright 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TIMEVAL_H
|
||||
#define TIMEVAL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "sys/time.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
|
||||
/** A wrapper on usleep to sleep for milliseconds. */
|
||||
inline void msleep(long v) { usleep(v*1000); }
|
||||
|
||||
|
||||
/** A C++ wrapper for struct timeval. */
|
||||
class Timeval {
|
||||
|
||||
private:
|
||||
|
||||
struct timeval mTimeval;
|
||||
|
||||
public:
|
||||
|
||||
/** Set the value to gettimeofday. */
|
||||
void now() { gettimeofday(&mTimeval,NULL); }
|
||||
|
||||
/** Set the value to gettimeofday plus an offset. */
|
||||
void future(unsigned ms);
|
||||
|
||||
//@{
|
||||
Timeval(unsigned sec, unsigned usec)
|
||||
{
|
||||
mTimeval.tv_sec = sec;
|
||||
mTimeval.tv_usec = usec;
|
||||
}
|
||||
|
||||
Timeval(const struct timeval& wTimeval)
|
||||
:mTimeval(wTimeval)
|
||||
{}
|
||||
|
||||
/**
|
||||
Create a Timeval offset into the future.
|
||||
@param offset milliseconds
|
||||
*/
|
||||
Timeval(unsigned offset=0) { future(offset); }
|
||||
//@}
|
||||
|
||||
/** Convert to a struct timespec. */
|
||||
struct timespec timespec() const;
|
||||
|
||||
/** Return total seconds. */
|
||||
double seconds() const;
|
||||
|
||||
uint32_t sec() const { return mTimeval.tv_sec; }
|
||||
uint32_t usec() const { return mTimeval.tv_usec; }
|
||||
|
||||
/** Return differnce from other (other-self), in ms. */
|
||||
long delta(const Timeval& other) const;
|
||||
|
||||
/** Elapsed time in ms. */
|
||||
long elapsed() const { return delta(Timeval()); }
|
||||
|
||||
/** Remaining time in ms. */
|
||||
long remaining() const { return -elapsed(); }
|
||||
|
||||
/** Return true if the time has passed, as per gettimeofday. */
|
||||
bool passed() const;
|
||||
|
||||
/** Add a given number of minutes to the time. */
|
||||
void addMinutes(unsigned minutes) { mTimeval.tv_sec += minutes*60; }
|
||||
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const Timeval&);
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const struct timespec&);
|
||||
|
||||
|
||||
#endif
|
||||
// vim: ts=4 sw=4
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "Timeval.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
Timeval then(10000);
|
||||
cout << then.elapsed() << endl;
|
||||
|
||||
while (!then.passed()) {
|
||||
cout << "now: " << Timeval() << " then: " << then << " remaining: " << then.remaining() << endl;
|
||||
usleep(500000);
|
||||
}
|
||||
cout << "now: " << Timeval() << " then: " << then << " remaining: " << then.remaining() << endl;
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright 2011 Free Software Foundation, Inc.
|
||||
*
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include <URLEncode.h>
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
//based on javascript encodeURIComponent()
|
||||
string URLEncode(const string &c)
|
||||
{
|
||||
static const char *digits = "01234567890ABCDEF";
|
||||
string retVal="";
|
||||
for (int i=0; i<c.length(); i++)
|
||||
{
|
||||
const char ch = c[i];
|
||||
if (isalnum(ch) || strchr("-_.!~'()",ch)) {
|
||||
retVal += ch;
|
||||
} else {
|
||||
retVal += '%';
|
||||
retVal += digits[(ch>>4) & 0x0f];
|
||||
retVal += digits[ch & 0x0f];
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright 2011 Free Software Foundation, Inc.
|
||||
*
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
# include <string>
|
||||
|
||||
std::string URLEncode(const std::string&);
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright 2011 Free Software Foundation, Inc.
|
||||
*
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "URLEncode.h"
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
string test = string("Testing: !@#$%^&*() " __DATE__ " " __TIME__);
|
||||
cout << test << endl;
|
||||
cout << URLEncode(test) << endl;
|
||||
}
|
||||
|
|
@ -0,0 +1,268 @@
|
|||
/**@file Simplified Vector template with aliases. */
|
||||
/*
|
||||
* Copyright 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef VECTOR_H
|
||||
#define VECTOR_H
|
||||
|
||||
#include <string.h>
|
||||
#include <iostream>
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
/**
|
||||
A simplified Vector template with aliases.
|
||||
Unlike std::vector, this class does not support dynamic resizing.
|
||||
Unlike std::vector, this class does support "aliases" and subvectors.
|
||||
*/
|
||||
template <class T> class Vector {
|
||||
|
||||
// TODO -- Replace memcpy calls with for-loops.
|
||||
|
||||
public:
|
||||
|
||||
/**@name Iterator types. */
|
||||
//@{
|
||||
typedef T* iterator;
|
||||
typedef const T* const_iterator;
|
||||
//@}
|
||||
|
||||
protected:
|
||||
|
||||
T* mData; ///< allocated data block, if any
|
||||
T* mStart; ///< start of useful data
|
||||
T* mEnd; ///< end of useful data + 1
|
||||
|
||||
public:
|
||||
|
||||
/** Return the size of the Vector. */
|
||||
size_t size() const
|
||||
{
|
||||
assert(mStart>=mData);
|
||||
assert(mEnd>=mStart);
|
||||
return mEnd - mStart;
|
||||
}
|
||||
|
||||
/** Return size in bytes. */
|
||||
size_t bytes() const { return size()*sizeof(T); }
|
||||
|
||||
/** Change the size of the Vector, discarding content. */
|
||||
void resize(size_t newSize)
|
||||
{
|
||||
if (mData!=NULL) delete[] mData;
|
||||
if (newSize==0) mData=NULL;
|
||||
else mData = new T[newSize];
|
||||
mStart = mData;
|
||||
mEnd = mStart + newSize;
|
||||
}
|
||||
|
||||
/** Release memory and clear pointers. */
|
||||
void clear() { resize(0); }
|
||||
|
||||
|
||||
/** Copy data from another vector. */
|
||||
void clone(const Vector<T>& other)
|
||||
{
|
||||
resize(other.size());
|
||||
memcpy(mData,other.mStart,other.bytes());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//@{
|
||||
|
||||
/** Build an empty Vector of a given size. */
|
||||
Vector(size_t wSize=0):mData(NULL) { resize(wSize); }
|
||||
|
||||
/** Build a Vector by shifting the data block. */
|
||||
Vector(Vector<T>& other)
|
||||
:mData(other.mData),mStart(other.mStart),mEnd(other.mEnd)
|
||||
{ other.mData=NULL; }
|
||||
|
||||
/** Build a Vector by copying another. */
|
||||
Vector(const Vector<T>& other):mData(NULL) { clone(other); }
|
||||
|
||||
/** Build a Vector with explicit values. */
|
||||
Vector(T* wData, T* wStart, T* wEnd)
|
||||
:mData(wData),mStart(wStart),mEnd(wEnd)
|
||||
{ }
|
||||
|
||||
/** Build a vector from an existing block, NOT to be deleted upon destruction. */
|
||||
Vector(T* wStart, size_t span)
|
||||
:mData(NULL),mStart(wStart),mEnd(wStart+span)
|
||||
{ }
|
||||
|
||||
/** Build a Vector by concatenation. */
|
||||
Vector(const Vector<T>& other1, const Vector<T>& other2)
|
||||
:mData(NULL)
|
||||
{
|
||||
resize(other1.size()+other2.size());
|
||||
memcpy(mStart, other1.mStart, other1.bytes());
|
||||
memcpy(mStart+other1.size(), other2.mStart, other2.bytes());
|
||||
}
|
||||
|
||||
//@}
|
||||
|
||||
/** Destroy a Vector, deleting held memory. */
|
||||
~Vector() { clear(); }
|
||||
|
||||
|
||||
|
||||
|
||||
//@{
|
||||
|
||||
/** Assign from another Vector, shifting ownership. */
|
||||
void operator=(Vector<T>& other)
|
||||
{
|
||||
clear();
|
||||
mData=other.mData;
|
||||
mStart=other.mStart;
|
||||
mEnd=other.mEnd;
|
||||
other.mData=NULL;
|
||||
}
|
||||
|
||||
/** Assign from another Vector, copying. */
|
||||
void operator=(const Vector<T>& other) { clone(other); }
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
//@{
|
||||
|
||||
/** Return an alias to a segment of this Vector. */
|
||||
Vector<T> segment(size_t start, size_t span)
|
||||
{
|
||||
T* wStart = mStart + start;
|
||||
T* wEnd = wStart + span;
|
||||
assert(wEnd<=mEnd);
|
||||
return Vector<T>(NULL,wStart,wEnd);
|
||||
}
|
||||
|
||||
/** Return an alias to a segment of this Vector. */
|
||||
const Vector<T> segment(size_t start, size_t span) const
|
||||
{
|
||||
T* wStart = mStart + start;
|
||||
T* wEnd = wStart + span;
|
||||
assert(wEnd<=mEnd);
|
||||
return Vector<T>(NULL,wStart,wEnd);
|
||||
}
|
||||
|
||||
Vector<T> head(size_t span) { return segment(0,span); }
|
||||
const Vector<T> head(size_t span) const { return segment(0,span); }
|
||||
Vector<T> tail(size_t start) { return segment(start,size()-start); }
|
||||
const Vector<T> tail(size_t start) const { return segment(start,size()-start); }
|
||||
|
||||
/**
|
||||
Copy part of this Vector to a segment of another Vector.
|
||||
@param other The other vector.
|
||||
@param start The start point in the other vector.
|
||||
@param span The number of elements to copy.
|
||||
*/
|
||||
void copyToSegment(Vector<T>& other, size_t start, size_t span) const
|
||||
{
|
||||
T* base = other.mStart + start;
|
||||
assert(base+span<=other.mEnd);
|
||||
assert(mStart+span<=mEnd);
|
||||
memcpy(base,mStart,span*sizeof(T));
|
||||
}
|
||||
|
||||
/** Copy all of this Vector to a segment of another Vector. */
|
||||
void copyToSegment(Vector<T>& other, size_t start=0) const { copyToSegment(other,start,size()); }
|
||||
|
||||
void copyTo(Vector<T>& other) const { copyToSegment(other,0,size()); }
|
||||
|
||||
/**
|
||||
Copy a segment of this vector into another.
|
||||
@param other The other vector (to copt into starting at 0.)
|
||||
@param start The start point in this vector.
|
||||
@param span The number of elements to copy.
|
||||
*/
|
||||
void segmentCopyTo(Vector<T>& other, size_t start, size_t span) const
|
||||
{
|
||||
const T* base = mStart + start;
|
||||
assert(base+span<=mEnd);
|
||||
assert(other.mStart+span<=other.mEnd);
|
||||
memcpy(other.mStart,base,span*sizeof(T));
|
||||
}
|
||||
|
||||
void fill(const T& val)
|
||||
{
|
||||
T* dp=mStart;
|
||||
while (dp<mEnd) *dp++=val;
|
||||
}
|
||||
|
||||
void fill(const T& val, unsigned start, unsigned length)
|
||||
{
|
||||
T* dp=mStart+start;
|
||||
T* end=dp+length;
|
||||
assert(end<=mEnd);
|
||||
while (dp<end) *dp++=val;
|
||||
}
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
//@{
|
||||
|
||||
T& operator[](size_t index)
|
||||
{
|
||||
assert(mStart+index<mEnd);
|
||||
return mStart[index];
|
||||
}
|
||||
|
||||
const T& operator[](size_t index) const
|
||||
{
|
||||
assert(mStart+index<mEnd);
|
||||
return mStart[index];
|
||||
}
|
||||
|
||||
const T* begin() const { return mStart; }
|
||||
T* begin() { return mStart; }
|
||||
const T* end() const { return mEnd; }
|
||||
T* end() { return mEnd; }
|
||||
//@}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/** Basic print operator for Vector objects. */
|
||||
template <class T>
|
||||
std::ostream& operator<<(std::ostream& os, const Vector<T>& v)
|
||||
{
|
||||
for (unsigned i=0; i<v.size(); i++) os << v[i] << " ";
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
// vim: ts=4 sw=4
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "Vector.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
typedef Vector<int> TestVector;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
TestVector test1(5);
|
||||
for (int i=0; i<5; i++) test1[i]=i;
|
||||
TestVector test2(5);
|
||||
for (int i=0; i<5; i++) test2[i]=10+i;
|
||||
|
||||
cout << test1 << endl;
|
||||
cout << test2 << endl;
|
||||
|
||||
{
|
||||
TestVector testC(test1,test2);
|
||||
cout << testC << endl;
|
||||
cout << testC.head(3) << endl;
|
||||
cout << testC.tail(3) << endl;
|
||||
testC.fill(8);
|
||||
cout << testC << endl;
|
||||
test1.copyToSegment(testC,3);
|
||||
cout << testC << endl;
|
||||
|
||||
TestVector testD(testC.segment(4,3));
|
||||
cout << testD << endl;
|
||||
testD.fill(9);
|
||||
cout << testC << endl;
|
||||
cout << testD << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
# example file
|
||||
key1 value1
|
||||
|
||||
key2 123456
|
||||
$static key2
|
||||
key3 ssdf klsdf lkdf sf
|
||||
$optional key3
|
||||
|
||||
key4
|
||||
|
||||
key5 10 11 13 15
|
||||
|
||||
# This file is also used to test the logging system.
|
||||
|
||||
Log.Alarms.Max 10
|
||||
Log.Alarms.TargetIP 127.0.0.1
|
||||
Log.Alarms.TargetPort 10101
|
||||
Log.Level INFO
|
Loading…
Reference in New Issue