complement-svn Mailing List for Complement (Page 21)
Status: Pre-Alpha
Brought to you by:
complement
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(61) |
Nov
(76) |
Dec
(39) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(33) |
Feb
(41) |
Mar
(16) |
Apr
|
May
(22) |
Jun
(14) |
Jul
(64) |
Aug
(60) |
Sep
(35) |
Oct
(34) |
Nov
(10) |
Dec
(5) |
2008 |
Jan
(4) |
Feb
(24) |
Mar
(10) |
Apr
(30) |
May
(15) |
Jun
(50) |
Jul
(20) |
Aug
(7) |
Sep
(8) |
Oct
(10) |
Nov
|
Dec
|
From: <com...@us...> - 2007-01-26 13:58:07
|
Revision: 1478 http://svn.sourceforge.net/complement/?rev=1478&view=rev Author: complement Date: 2007-01-26 05:58:06 -0800 (Fri, 26 Jan 2007) Log Message: ----------- multiple decision pathes for all *clean tags Modified Paths: -------------- trunk/complement/explore/Makefiles/clean.mak Modified: trunk/complement/explore/Makefiles/clean.mak =================================================================== --- trunk/complement/explore/Makefiles/clean.mak 2007-01-26 13:55:37 UTC (rev 1477) +++ trunk/complement/explore/Makefiles/clean.mak 2007-01-26 13:58:06 UTC (rev 1478) @@ -39,10 +39,10 @@ # $(DEPENDS_COLLECTION) removed before directory, # see app/clean.mak and lib/clean.mak -mostlyclean: clean +mostlyclean:: clean @-rm -f $(DEPENDS_COLLECTION) @-rm -f TAGS tags -maintainer-clean: distclean +maintainer-clean:: distclean @rm -f ${RULESBASE}/config.mak @-rm -f TAGS tags This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-01-26 13:55:38
|
Revision: 1477 http://svn.sourceforge.net/complement/?rev=1477&view=rev Author: complement Date: 2007-01-26 05:55:37 -0800 (Fri, 26 Jan 2007) Log Message: ----------- clean Removed Paths: ------------- tags/complement-20070125/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-01-26 13:54:53
|
Revision: 1476 http://svn.sourceforge.net/complement/?rev=1476&view=rev Author: complement Date: 2007-01-26 05:54:47 -0800 (Fri, 26 Jan 2007) Log Message: ----------- complement snapshot, 2007-01-26 Added Paths: ----------- tags/complement-20070126/ Copied: tags/complement-20070126 (from rev 1475, trunk/complement) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-01-26 13:52:13
|
Revision: 1475 http://svn.sourceforge.net/complement/?rev=1475&view=rev Author: complement Date: 2007-01-26 05:52:08 -0800 (Fri, 26 Jan 2007) Log Message: ----------- fix check- targets Modified Paths: -------------- trunk/complement/extern/custom/boost/libs/Makefile trunk/complement/extern/custom/boost/libs/program_options/Makefile trunk/complement/extern/custom/boost/libs/regex/Makefile trunk/complement/extern/custom/boost/libs/test/prg_exec_mon/Makefile trunk/complement/extern/custom/boost/libs/test/test_exec_mon/Makefile trunk/complement/extern/custom/boost/libs/test/unit_test_framework/Makefile Modified: trunk/complement/extern/custom/boost/libs/Makefile =================================================================== --- trunk/complement/extern/custom/boost/libs/Makefile 2007-01-25 14:21:57 UTC (rev 1474) +++ trunk/complement/extern/custom/boost/libs/Makefile 2007-01-26 13:52:08 UTC (rev 1475) @@ -8,7 +8,7 @@ SRCROOT := ../../../../explore SUBDIRS := date_time filesystem program_options regex serialization \ - test/unit_test_framework test/test_exec_mon \ + test/unit_test_framework test/test_exec_mon test/prg_exec_mon \ thread include ${SRCROOT}/Makefiles/gmake/subdirs.mak Modified: trunk/complement/extern/custom/boost/libs/program_options/Makefile =================================================================== --- trunk/complement/extern/custom/boost/libs/program_options/Makefile 2007-01-25 14:21:57 UTC (rev 1474) +++ trunk/complement/extern/custom/boost/libs/program_options/Makefile 2007-01-26 13:52:08 UTC (rev 1475) @@ -11,14 +11,14 @@ check: all-shared $(MAKE) -C test check || exit 1 -check-release: release-shared +check-release-shared: release-shared $(MAKE) -C test check-release-shared || exit 1 -check-dbg: dbg-shared +check-dbg-shared: dbg-shared $(MAKE) -C test check-dbg-shared || exit 1 ifndef WITHOUT_STLPORT -check-stldbg: stldbg-shared +check-stldbg-shared: stldbg-shared $(MAKE) -C test check-stldbg-shared || exit 1 endif Modified: trunk/complement/extern/custom/boost/libs/regex/Makefile =================================================================== --- trunk/complement/extern/custom/boost/libs/regex/Makefile 2007-01-25 14:21:57 UTC (rev 1474) +++ trunk/complement/extern/custom/boost/libs/regex/Makefile 2007-01-26 13:52:08 UTC (rev 1475) @@ -24,3 +24,15 @@ depend:: $(MAKE) -C test depend + +clean:: + $(MAKE) -C test clean + +distclean:: + $(MAKE) -C test distclean + +mostlyclean:: + $(MAKE) -C test mostlyclean + +maintainer-clean:: + $(MAKE) -C test maintainer-clean Modified: trunk/complement/extern/custom/boost/libs/test/prg_exec_mon/Makefile =================================================================== --- trunk/complement/extern/custom/boost/libs/test/prg_exec_mon/Makefile 2007-01-25 14:21:57 UTC (rev 1474) +++ trunk/complement/extern/custom/boost/libs/test/prg_exec_mon/Makefile 2007-01-26 13:52:08 UTC (rev 1475) @@ -11,14 +11,14 @@ check: all-shared $(MAKE) -C test check || exit 1 -check-release: release-shared +check-release-shared: release-shared $(MAKE) -C test check-release-shared || exit 1 -check-dbg: dbg-shared +check-dbg-shared: dbg-shared $(MAKE) -C test check-dbg-shared || exit 1 ifndef WITHOUT_STLPORT -check-stldbg: stldbg-shared +check-stldbg-shared: stldbg-shared $(MAKE) -C test check-stldbg-shared || exit 1 endif Modified: trunk/complement/extern/custom/boost/libs/test/test_exec_mon/Makefile =================================================================== --- trunk/complement/extern/custom/boost/libs/test/test_exec_mon/Makefile 2007-01-25 14:21:57 UTC (rev 1474) +++ trunk/complement/extern/custom/boost/libs/test/test_exec_mon/Makefile 2007-01-26 13:52:08 UTC (rev 1475) @@ -18,14 +18,14 @@ check: all-shared $(MAKE) -C test check || exit 1 -check-release: release-shared +check-release-shared: release-shared $(MAKE) -C test check-release-shared || exit 1 -check-dbg: dbg-shared +check-dbg-shared: dbg-shared $(MAKE) -C test check-dbg-shared || exit 1 ifndef WITHOUT_STLPORT -check-stldbg: stldbg-shared +check-stldbg-shared: stldbg-shared $(MAKE) -C test check-stldbg-shared || exit 1 endif Modified: trunk/complement/extern/custom/boost/libs/test/unit_test_framework/Makefile =================================================================== --- trunk/complement/extern/custom/boost/libs/test/unit_test_framework/Makefile 2007-01-25 14:21:57 UTC (rev 1474) +++ trunk/complement/extern/custom/boost/libs/test/unit_test_framework/Makefile 2007-01-26 13:52:08 UTC (rev 1475) @@ -18,14 +18,14 @@ check: all-shared $(MAKE) -C test check || exit 1 -check-release: release-shared +check-release-shared: release-shared $(MAKE) -C test check-release-shared || exit 1 -check-dbg: dbg-shared +check-dbg-shared: dbg-shared $(MAKE) -C test check-dbg-shared || exit 1 ifndef WITHOUT_STLPORT -check-stldbg: stldbg-shared +check-stldbg-shared: stldbg-shared $(MAKE) -C test check-stldbg-shared || exit 1 endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-01-25 14:21:59
|
Revision: 1474 http://svn.sourceforge.net/complement/?rev=1474&view=rev Author: complement Date: 2007-01-25 06:21:57 -0800 (Thu, 25 Jan 2007) Log Message: ----------- working snapshot, 2007-01-25 Added Paths: ----------- tags/complement-20070125/ Copied: tags/complement-20070125 (from rev 1473, trunk/complement) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-01-25 13:17:59
|
Revision: 1473 http://svn.sourceforge.net/complement/?rev=1473&view=rev Author: complement Date: 2007-01-25 05:17:57 -0800 (Thu, 25 Jan 2007) Log Message: ----------- more tests added; note, that tests for regex not pass! Modified Paths: -------------- trunk/complement/extern/custom/boost/libs/program_options/Makefile trunk/complement/extern/custom/boost/libs/regex/Makefile trunk/complement/extern/custom/boost/libs/test/prg_exec_mon/Makefile trunk/complement/extern/custom/boost/libs/test/prg_exec_mon/Makefile.inc trunk/complement/extern/custom/boost/libs/test/test_exec_mon/Makefile trunk/complement/extern/custom/boost/libs/test/unit_test_framework/Makefile Added Paths: ----------- trunk/complement/extern/custom/boost/libs/program_options/test/ trunk/complement/extern/custom/boost/libs/program_options/test/Makefile trunk/complement/extern/custom/boost/libs/program_options/test/Makefile.inc trunk/complement/extern/custom/boost/libs/regex/test/ trunk/complement/extern/custom/boost/libs/regex/test/Makefile trunk/complement/extern/custom/boost/libs/regex/test/Makefile.inc trunk/complement/extern/custom/boost/libs/test/prg_exec_mon/test/ trunk/complement/extern/custom/boost/libs/test/prg_exec_mon/test/Makefile trunk/complement/extern/custom/boost/libs/test/prg_exec_mon/test/Makefile.inc trunk/complement/extern/custom/boost/libs/test/test_exec_mon/test/ trunk/complement/extern/custom/boost/libs/test/test_exec_mon/test/Makefile trunk/complement/extern/custom/boost/libs/test/test_exec_mon/test/Makefile.inc Modified: trunk/complement/extern/custom/boost/libs/program_options/Makefile =================================================================== --- trunk/complement/extern/custom/boost/libs/program_options/Makefile 2007-01-23 19:02:08 UTC (rev 1472) +++ trunk/complement/extern/custom/boost/libs/program_options/Makefile 2007-01-25 13:17:57 UTC (rev 1473) @@ -1,4 +1,4 @@ -# -*- makefile -*- Time-stamp: <03/03/31 15:18:29 ptr> +# -*- makefile -*- Time-stamp: <07/01/25 00:51:36 ptr> SRCROOT := ../../../../../explore COMPILER_NAME := gcc @@ -7,3 +7,20 @@ include ${SRCROOT}/Makefiles/top.mak INCLUDES += -I${BOOST_INCLUDE_DIR} + +check: all-shared + $(MAKE) -C test check || exit 1 + +check-release: release-shared + $(MAKE) -C test check-release-shared || exit 1 + +check-dbg: dbg-shared + $(MAKE) -C test check-dbg-shared || exit 1 + +ifndef WITHOUT_STLPORT +check-stldbg: stldbg-shared + $(MAKE) -C test check-stldbg-shared || exit 1 +endif + +depend:: + $(MAKE) -C test depend Property changes on: trunk/complement/extern/custom/boost/libs/program_options/test ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/extern/custom/boost/libs/program_options/test/Makefile =================================================================== --- trunk/complement/extern/custom/boost/libs/program_options/test/Makefile (rev 0) +++ trunk/complement/extern/custom/boost/libs/program_options/test/Makefile 2007-01-25 13:17:57 UTC (rev 1473) @@ -0,0 +1,52 @@ +# -*- makefile -*- Time-stamp: <07/01/25 00:49:53 ptr> + +SRCROOT := ../../../../../../explore +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +INCLUDES += -I${BOOST_INCLUDE_DIR} + +release-shared: LDFLAGS += -L../${OUTPUT_DIR} -L../../test/test_exec_mon/${OUTPUT_DIR} -Wl,-rpath=../${OUTPUT_DIR}:../../test/test_exec_mon/${OUTPUT_DIR}:${STLPORT_LIB_DIR} +dbg-shared: LDFLAGS += -L../${OUTPUT_DIR_DBG} -L../../test/test_exec_mon/${OUTPUT_DIR_DBG} -Wl,-rpath=../${OUTPUT_DIR_DBG}:../../test/test_exec_mon/${OUTPUT_DIR_DBG}:${STLPORT_LIB_DIR} +ifndef WITHOUT_STLPORT +stldbg-shared: LDFLAGS += -L../${OUTPUT_DIR_STLDBG} -L../../test/test_exec_mon/${OUTPUT_DIR_STLDBG} -Wl,-rpath=../${OUTPUT_DIR_STLDBG}:../../test/test_exec_mon/${OUTPUT_DIR_STLDBG}:${STLPORT_LIB_DIR} +endif + +release-shared: LDLIBS = -lboost_test_tem -lboost_program_options +dbg-shared: LDLIBS = -lboost_test_temg -lboost_program_optionsg +ifndef WITHOUT_STLPORT +stldbg-shared: LDLIBS = -lboost_test_temstlg -lboost_program_optionsstlg +endif + +check: all + @for p in ${PRGNAME} ${PRGNAMES}; do \ + ${OUTPUT_DIR}/$$p || exit 1; \ + done + @for p in ${PRGNAME} ${PRGNAMES}; do \ + ${OUTPUT_DIR_DBG}/$$p || exit 1; \ + done +ifndef WITHOUT_STLPORT + @for p in ${PRGNAME} ${PRGNAMES}; do \ + ${OUTPUT_DIR_STLDBG}/$$p || exit 1; \ + done +endif + +check-release-shared: release-shared + @for p in ${PRGNAME} ${PRGNAMES}; do \ + ${OUTPUT_DIR}/$$p || exit 1; \ + done + +check-dbg-shared: dbg-shared + @for p in ${PRGNAME} ${PRGNAMES}; do \ + ${OUTPUT_DIR_DBG}/$$p || exit 1; \ + done + +ifndef WITHOUT_STLPORT +check-stldbg-shared: stldbg-shared + @for p in ${PRGNAME} ${PRGNAMES}; do \ + ${OUTPUT_DIR_STLDBG}/$$p || exit 1; \ + done +endif + Added: trunk/complement/extern/custom/boost/libs/program_options/test/Makefile.inc =================================================================== --- trunk/complement/extern/custom/boost/libs/program_options/test/Makefile.inc (rev 0) +++ trunk/complement/extern/custom/boost/libs/program_options/test/Makefile.inc 2007-01-25 13:17:57 UTC (rev 1473) @@ -0,0 +1,13 @@ +# -*- makefile -*- Time-stamp: <07/01/25 00:54:51 ptr> + +BOOST_FS_SRC = ${BOOST_INCLUDE_DIR}/libs/program_options/test +PRGNAME = options_description_test +PRGNAMES = parsers_test variable_map_test cmdline_test positional_options_test \ + unicode_test winmain +SRC_CPP = ${BOOST_FS_SRC}/options_description_test.cpp +parsers_test_SRC_CPP = ${BOOST_FS_SRC}/parsers_test.cpp +variable_map_test_SRC_CPP = ${BOOST_FS_SRC}/variable_map_test.cpp +cmdline_test_SRC_CPP = ${BOOST_FS_SRC}/cmdline_test.cpp +positional_options_test_SRC_CPP = ${BOOST_FS_SRC}/positional_options_test.cpp +unicode_test_SRC_CPP = ${BOOST_FS_SRC}/unicode_test.cpp +winmain_SRC_CPP = ${BOOST_FS_SRC}/winmain.cpp Modified: trunk/complement/extern/custom/boost/libs/regex/Makefile =================================================================== --- trunk/complement/extern/custom/boost/libs/regex/Makefile 2007-01-23 19:02:08 UTC (rev 1472) +++ trunk/complement/extern/custom/boost/libs/regex/Makefile 2007-01-25 13:17:57 UTC (rev 1473) @@ -1,4 +1,4 @@ -# -*- makefile -*- Time-stamp: <03/03/31 15:18:29 ptr> +# -*- makefile -*- Time-stamp: <07/01/25 09:30:29 ptr> SRCROOT := ../../../../../explore COMPILER_NAME := gcc @@ -7,3 +7,20 @@ include ${SRCROOT}/Makefiles/top.mak INCLUDES += -I${BOOST_INCLUDE_DIR} + +check: all-shared + $(MAKE) -C test check || exit 1 + +check-release: release-shared + $(MAKE) -C test check-release-shared || exit 1 + +check-dbg: dbg-shared + $(MAKE) -C test check-dbg-shared || exit 1 + +ifndef WITHOUT_STLPORT +check-stldbg: stldbg-shared + $(MAKE) -C test check-stldbg-shared || exit 1 +endif + +depend:: + $(MAKE) -C test depend Property changes on: trunk/complement/extern/custom/boost/libs/regex/test ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/extern/custom/boost/libs/regex/test/Makefile =================================================================== --- trunk/complement/extern/custom/boost/libs/regex/test/Makefile (rev 0) +++ trunk/complement/extern/custom/boost/libs/regex/test/Makefile 2007-01-25 13:17:57 UTC (rev 1473) @@ -0,0 +1,52 @@ +# -*- makefile -*- Time-stamp: <07/01/25 00:49:53 ptr> + +SRCROOT := ../../../../../../explore +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +INCLUDES += -I${BOOST_INCLUDE_DIR} + +release-shared: LDFLAGS += -L../${OUTPUT_DIR} -Wl,-rpath=../${OUTPUT_DIR}:${STLPORT_LIB_DIR} +dbg-shared: LDFLAGS += -L../${OUTPUT_DIR_DBG} -Wl,-rpath=../${OUTPUT_DIR_DBG}:${STLPORT_LIB_DIR} +ifndef WITHOUT_STLPORT +stldbg-shared: LDFLAGS += -L../${OUTPUT_DIR_STLDBG} -Wl,-rpath=../${OUTPUT_DIR_STLDBG}:${STLPORT_LIB_DIR} +endif + +release-shared: LDLIBS = -lboost_regex +dbg-shared: LDLIBS = -lboost_regexg +ifndef WITHOUT_STLPORT +stldbg-shared: LDLIBS = -lboost_regexstlg +endif + +check: all + @for p in ${PRGNAME} ${PRGNAMES}; do \ + ${OUTPUT_DIR}/$$p || exit 1; \ + done + @for p in ${PRGNAME} ${PRGNAMES}; do \ + ${OUTPUT_DIR_DBG}/$$p || exit 1; \ + done +ifndef WITHOUT_STLPORT + @for p in ${PRGNAME} ${PRGNAMES}; do \ + ${OUTPUT_DIR_STLDBG}/$$p || exit 1; \ + done +endif + +check-release-shared: release-shared + @for p in ${PRGNAME} ${PRGNAMES}; do \ + ${OUTPUT_DIR}/$$p || exit 1; \ + done + +check-dbg-shared: dbg-shared + @for p in ${PRGNAME} ${PRGNAMES}; do \ + ${OUTPUT_DIR_DBG}/$$p || exit 1; \ + done + +ifndef WITHOUT_STLPORT +check-stldbg-shared: stldbg-shared + @for p in ${PRGNAME} ${PRGNAMES}; do \ + ${OUTPUT_DIR_STLDBG}/$$p || exit 1; \ + done +endif + Added: trunk/complement/extern/custom/boost/libs/regex/test/Makefile.inc =================================================================== --- trunk/complement/extern/custom/boost/libs/regex/test/Makefile.inc (rev 0) +++ trunk/complement/extern/custom/boost/libs/regex/test/Makefile.inc 2007-01-25 13:17:57 UTC (rev 1473) @@ -0,0 +1,34 @@ +# -*- makefile -*- Time-stamp: <07/01/25 09:51:52 ptr> + +BOOST_FS_SRC = ${BOOST_INCLUDE_DIR}/libs/regex/test +PRGNAME = regex +PRGNAMES = posix_api_check wide_posix_api_check bad_expression_test \ + recursion_test unicode_iterator_test +SRC_CPP = ${BOOST_FS_SRC}/regress/basic_tests.cpp \ + ${BOOST_FS_SRC}/regress/main.cpp \ + ${BOOST_FS_SRC}/regress/test_alt.cpp \ + ${BOOST_FS_SRC}/regress/test_anchors.cpp \ + ${BOOST_FS_SRC}/regress/test_asserts.cpp \ + ${BOOST_FS_SRC}/regress/test_backrefs.cpp \ + ${BOOST_FS_SRC}/regress/test_deprecated.cpp \ + ${BOOST_FS_SRC}/regress/test_emacs.cpp \ + ${BOOST_FS_SRC}/regress/test_escapes.cpp \ + ${BOOST_FS_SRC}/regress/test_grep.cpp \ + ${BOOST_FS_SRC}/regress/test_locale.cpp \ + ${BOOST_FS_SRC}/regress/test_mfc.cpp \ + ${BOOST_FS_SRC}/regress/test_non_greedy_repeats.cpp \ + ${BOOST_FS_SRC}/regress/test_perl_ex.cpp \ + ${BOOST_FS_SRC}/regress/test_replace.cpp \ + ${BOOST_FS_SRC}/regress/test_sets.cpp \ + ${BOOST_FS_SRC}/regress/test_simple_repeats.cpp \ + ${BOOST_FS_SRC}/regress/test_tricky_cases.cpp \ + ${BOOST_FS_SRC}/regress/test_icu.cpp \ + ${BOOST_FS_SRC}/regress/test_unicode.cpp \ + ${BOOST_FS_SRC}/regress/test_overloads.cpp \ + ${BOOST_FS_SRC}/regress/test_operators.cpp + +posix_api_check_SRC_CPP = ${BOOST_FS_SRC}/c_compiler_checks/posix_api_check.cpp +wide_posix_api_check_SRC_CPP = ${BOOST_FS_SRC}/c_compiler_checks/wide_posix_api_check.cpp +bad_expression_test_SRC_CPP = ${BOOST_FS_SRC}/pathology/bad_expression_test.cpp +recursion_test_SRC_CPP = ${BOOST_FS_SRC}/pathology/recursion_test.cpp +unicode_iterator_test_SRC_CPP = ${BOOST_FS_SRC}/unicode/unicode_iterator_test.cpp Modified: trunk/complement/extern/custom/boost/libs/test/prg_exec_mon/Makefile =================================================================== --- trunk/complement/extern/custom/boost/libs/test/prg_exec_mon/Makefile 2007-01-23 19:02:08 UTC (rev 1472) +++ trunk/complement/extern/custom/boost/libs/test/prg_exec_mon/Makefile 2007-01-25 13:17:57 UTC (rev 1473) @@ -1,5 +1,4 @@ -# -*- makefile -*- Time-stamp: <03/03/31 15:18:29 ptr> -# $Id$ +# -*- makefile -*- Time-stamp: <07/01/24 22:10:47 ptr> SRCROOT := ../../../../../../explore COMPILER_NAME := gcc @@ -7,5 +6,21 @@ include Makefile.inc include ${SRCROOT}/Makefiles/top.mak -INCLUDES += -I$(STLPORT_INCLUDE_DIR) -I${BOOST_INCLUDE_DIR} +INCLUDES += -I${BOOST_INCLUDE_DIR} +check: all-shared + $(MAKE) -C test check || exit 1 + +check-release: release-shared + $(MAKE) -C test check-release-shared || exit 1 + +check-dbg: dbg-shared + $(MAKE) -C test check-dbg-shared || exit 1 + +ifndef WITHOUT_STLPORT +check-stldbg: stldbg-shared + $(MAKE) -C test check-stldbg-shared || exit 1 +endif + +depend:: + $(MAKE) -C test depend Modified: trunk/complement/extern/custom/boost/libs/test/prg_exec_mon/Makefile.inc =================================================================== --- trunk/complement/extern/custom/boost/libs/test/prg_exec_mon/Makefile.inc 2007-01-23 19:02:08 UTC (rev 1472) +++ trunk/complement/extern/custom/boost/libs/test/prg_exec_mon/Makefile.inc 2007-01-25 13:17:57 UTC (rev 1473) @@ -1,9 +1,11 @@ -# -*- makefile -*- Time-stamp: <03/03/31 15:11:21 ptr> -# $Id$ +# -*- makefile -*- Time-stamp: <07/01/24 22:12:03 ptr> BOOST_TST_SRC = ${BOOST_INCLUDE_DIR}/libs/test/src LIBNAME = boost_test_pem MAJOR = 1 -MINOR = 32 -PATCH = 0 -SRC_CPP = ${BOOST_TST_SRC}/execution_monitor.cpp ${BOOST_TST_SRC}/cpp_main.cpp +MINOR = 33 +PATCH = 1 +SRC_CPP = ${BOOST_TST_SRC}/execution_monitor.cpp \ + ${BOOST_TST_SRC}/cpp_main.cpp + + Property changes on: trunk/complement/extern/custom/boost/libs/test/prg_exec_mon/test ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/extern/custom/boost/libs/test/prg_exec_mon/test/Makefile =================================================================== --- trunk/complement/extern/custom/boost/libs/test/prg_exec_mon/test/Makefile (rev 0) +++ trunk/complement/extern/custom/boost/libs/test/prg_exec_mon/test/Makefile 2007-01-25 13:17:57 UTC (rev 1473) @@ -0,0 +1,58 @@ +# -*- makefile -*- Time-stamp: <07/01/24 23:48:37 ptr> + +SRCROOT := ../../../../../../../explore +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +INCLUDES += -I${BOOST_INCLUDE_DIR} + +release-shared: LDFLAGS += -L../${OUTPUT_DIR} -Wl,-rpath=../${OUTPUT_DIR}:${STLPORT_LIB_DIR} +dbg-shared: LDFLAGS += -L../${OUTPUT_DIR_DBG} -Wl,-rpath=../${OUTPUT_DIR_DBG}:${STLPORT_LIB_DIR} +ifndef WITHOUT_STLPORT +stldbg-shared: LDFLAGS += -L../${OUTPUT_DIR_STLDBG} -Wl,-rpath=../${OUTPUT_DIR_STLDBG}:${STLPORT_LIB_DIR} +endif + +release-shared: LDLIBS = -lboost_test_pem +dbg-shared: LDLIBS = -lboost_test_pemg +ifndef WITHOUT_STLPORT +stldbg-shared: LDLIBS = -lboost_test_pemstlg +endif + +check: all + @for p in ${PRGNAME} ${PRGNAMES}; do \ + s=`${OUTPUT_DIR}/$$p 2>&1 | grep 'errors detected'`; \ + if [ "$$s" = "" ]; then echo $$p; exit 1; fi \ + done + @for p in ${PRGNAME} ${PRGNAMES}; do \ + s=`${OUTPUT_DIR_DBG}/$$p 2>&1 | grep 'errors detected'`; \ + if [ "$$s" = "" ]; then echo $$p; exit 1; fi \ + done +ifndef WITHOUT_STLPORT + @for p in ${PRGNAME} ${PRGNAMES}; do \ + s=`${OUTPUT_DIR_STLDBG}/$$p 2>&1 | grep 'errors detected'`; \ + if [ "$$s" = "" ]; then echo $$p; exit 1; fi \ + done +endif + +check-release-shared: release-shared + @for p in ${PRGNAME} ${PRGNAMES}; do \ + s=`${OUTPUT_DIR}/$$p 2>&1 | grep 'errors detected'`; \ + if [ "$$s" = "" ]; then echo $$p; exit 1; fi \ + done + +check-dbg-shared: dbg-shared + @for p in ${PRGNAME} ${PRGNAMES}; do \ + s=`${OUTPUT_DIR_DBG}/$$p 2>&1 | grep 'errors detected'`; \ + if [ "$$s" = "" ]; then echo $$p; exit 1; fi \ + done + +ifndef WITHOUT_STLPORT +check-stldbg-shared: stldbg-shared + @for p in ${PRGNAME} ${PRGNAMES}; do \ + s=`${OUTPUT_DIR_STLDBG}/$$p 2>&1 | grep 'errors detected'`; \ + if [ "$$s" = "" ]; then echo $$p; exit 1; fi \ + done +endif + Added: trunk/complement/extern/custom/boost/libs/test/prg_exec_mon/test/Makefile.inc =================================================================== --- trunk/complement/extern/custom/boost/libs/test/prg_exec_mon/test/Makefile.inc (rev 0) +++ trunk/complement/extern/custom/boost/libs/test/prg_exec_mon/test/Makefile.inc 2007-01-25 13:17:57 UTC (rev 1473) @@ -0,0 +1,11 @@ +# -*- makefile -*- Time-stamp: <07/01/24 22:17:50 ptr> + +BOOST_FS_SRC = ${BOOST_INCLUDE_DIR}/libs/test/test +PRGNAME = prg_exec_fail1 +PRGNAMES = prg_exec_fail2 prg_exec_fail3 prg_exec_fail4 +SRC_CPP = ${BOOST_FS_SRC}/prg_exec_fail1.cpp +prg_exec_fail2_SRC_CPP = ${BOOST_FS_SRC}/prg_exec_fail2.cpp +prg_exec_fail3_SRC_CPP = ${BOOST_FS_SRC}/prg_exec_fail3.cpp +prg_exec_fail4_SRC_CPP = ${BOOST_FS_SRC}/prg_exec_fail4.cpp + + Modified: trunk/complement/extern/custom/boost/libs/test/test_exec_mon/Makefile =================================================================== --- trunk/complement/extern/custom/boost/libs/test/test_exec_mon/Makefile 2007-01-23 19:02:08 UTC (rev 1472) +++ trunk/complement/extern/custom/boost/libs/test/test_exec_mon/Makefile 2007-01-25 13:17:57 UTC (rev 1473) @@ -1,4 +1,4 @@ -# -*- makefile -*- Time-stamp: <06/06/27 02:26:25 ptr> +# -*- makefile -*- Time-stamp: <07/01/24 22:12:49 ptr> SRCROOT := ../../../../../../explore COMPILER_NAME := gcc @@ -14,3 +14,20 @@ POST_INSTALL += ; rm -f $(INSTALL_LIB_DIR)/libboost_unit_test_framework.so $(INSTALL_LIB_DIR)/${SO_NAME} POST_INSTALL_DBG += ; rm -f $(INSTALL_LIB_DIR_DBG)/libboost_unit_test_framework.so $(INSTALL_LIB_DIR_DBG)/${SO_NAME_DBG} endif + +check: all-shared + $(MAKE) -C test check || exit 1 + +check-release: release-shared + $(MAKE) -C test check-release-shared || exit 1 + +check-dbg: dbg-shared + $(MAKE) -C test check-dbg-shared || exit 1 + +ifndef WITHOUT_STLPORT +check-stldbg: stldbg-shared + $(MAKE) -C test check-stldbg-shared || exit 1 +endif + +depend:: + $(MAKE) -C test depend Property changes on: trunk/complement/extern/custom/boost/libs/test/test_exec_mon/test ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/extern/custom/boost/libs/test/test_exec_mon/test/Makefile =================================================================== --- trunk/complement/extern/custom/boost/libs/test/test_exec_mon/test/Makefile (rev 0) +++ trunk/complement/extern/custom/boost/libs/test/test_exec_mon/test/Makefile 2007-01-25 13:17:57 UTC (rev 1473) @@ -0,0 +1,81 @@ +# -*- makefile -*- Time-stamp: <07/01/24 23:37:22 ptr> + +SRCROOT := ../../../../../../../explore +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +INCLUDES += -I${BOOST_INCLUDE_DIR} + +release-shared: LDFLAGS += -L../${OUTPUT_DIR} -Wl,-rpath=../${OUTPUT_DIR}:${STLPORT_LIB_DIR} +dbg-shared: LDFLAGS += -L../${OUTPUT_DIR_DBG} -Wl,-rpath=../${OUTPUT_DIR_DBG}:${STLPORT_LIB_DIR} +ifndef WITHOUT_STLPORT +stldbg-shared: LDFLAGS += -L../${OUTPUT_DIR_STLDBG} -Wl,-rpath=../${OUTPUT_DIR_STLDBG}:${STLPORT_LIB_DIR} +endif + +release-shared: LDLIBS = -lboost_test_tem +dbg-shared: LDLIBS = -lboost_test_temg +ifndef WITHOUT_STLPORT +stldbg-shared: LDLIBS = -lboost_test_temstlg +endif + +check: all + @for p in ${PRGNAME} ${PRGNAMES}; do \ + if [ "$$p" != "boost_check_equal_str" ]; then \ + ${OUTPUT_DIR}/$$p >/dev/null 2>&1; \ + if [ $$? -eq 0 ]; then echo $$p; exit 1; fi \ + else \ + ${OUTPUT_DIR}/$$p; \ + fi \ + done + @for p in ${PRGNAME} ${PRGNAMES}; do \ + if [ "$$p" != "boost_check_equal_str" ]; then \ + ${OUTPUT_DIR_DBG}/$$p >/dev/null 2>&1; \ + if [ $$? -eq 0 ]; then echo $$p; exit 1; fi \ + else \ + ${OUTPUT_DIR_DBG}/$$p; \ + fi \ + done +ifndef WITHOUT_STLPORT + @for p in ${PRGNAME} ${PRGNAMES}; do \ + if [ "$$p" != "boost_check_equal_str" ]; then \ + ${OUTPUT_DIR_STLDBG}/$$p >/dev/null 2>&1; \ + if [ $$? -eq 0 ]; then echo $$p; exit 1; fi \ + else \ + ${OUTPUT_DIR_STLDBG}/$$p; \ + fi \ + done +endif + +check-release-shared: release-shared + @for p in ${PRGNAME} ${PRGNAMES}; do \ + if [ "$$p" != "boost_check_equal_str" ]; then \ + ${OUTPUT_DIR}/$$p >/dev/null 2>&1; \ + if [ $$? -eq 0 ]; then echo $$p; exit 1; fi; \ + else \ + ${OUTPUT_DIR}/$$p; \ + fi \ + done + +check-dbg-shared: dbg-shared + @for p in ${PRGNAME} ${PRGNAMES}; do \ + if [ "$$p" != "boost_check_equal_str" ]; then \ + ${OUTPUT_DIR_DBG}/$$p >/dev/null 2>&1; \ + if [ $$? -eq 0 ]; then echo $$p; exit 1; fi \ + else \ + ${OUTPUT_DIR_DBG}/$$p; \ + fi \ + done + +ifndef WITHOUT_STLPORT +check-stldbg-shared: stldbg-shared + @for p in ${PRGNAME} ${PRGNAMES}; do \ + if [ "$$p" != "boost_check_equal_str" ]; then \ + ${OUTPUT_DIR_STLDBG}/$$p >/dev/null 2>&1; \ + if [ $$? -eq 0 ]; then echo $$p; exit 1; fi \ + else \ + ${OUTPUT_DIR_STLDBG}/$$p; \ + fi \ + done +endif Added: trunk/complement/extern/custom/boost/libs/test/test_exec_mon/test/Makefile.inc =================================================================== --- trunk/complement/extern/custom/boost/libs/test/test_exec_mon/test/Makefile.inc (rev 0) +++ trunk/complement/extern/custom/boost/libs/test/test_exec_mon/test/Makefile.inc 2007-01-25 13:17:57 UTC (rev 1473) @@ -0,0 +1,11 @@ +# -*- makefile -*- Time-stamp: <07/01/24 23:23:35 ptr> + +BOOST_FS_SRC = ${BOOST_INCLUDE_DIR}/libs/test/test +PRGNAME = test_exec_fail1 +PRGNAMES = test_exec_fail2 test_exec_fail3 test_exec_fail4 \ + boost_check_equal_str +SRC_CPP = ${BOOST_FS_SRC}/test_exec_fail1.cpp +test_exec_fail2_SRC_CPP = ${BOOST_FS_SRC}/test_exec_fail2.cpp +test_exec_fail3_SRC_CPP = ${BOOST_FS_SRC}/test_exec_fail3.cpp +test_exec_fail4_SRC_CPP = ${BOOST_FS_SRC}/test_exec_fail4.cpp +boost_check_equal_str_SRC_CPP = ${BOOST_FS_SRC}/boost_check_equal_str.cpp Modified: trunk/complement/extern/custom/boost/libs/test/unit_test_framework/Makefile =================================================================== --- trunk/complement/extern/custom/boost/libs/test/unit_test_framework/Makefile 2007-01-23 19:02:08 UTC (rev 1472) +++ trunk/complement/extern/custom/boost/libs/test/unit_test_framework/Makefile 2007-01-25 13:17:57 UTC (rev 1473) @@ -1,4 +1,4 @@ -# -*- makefile -*- Time-stamp: <06/06/27 02:26:25 ptr> +# -*- makefile -*- Time-stamp: <07/01/24 10:41:48 ptr> SRCROOT := ../../../../../../explore COMPILER_NAME := gcc @@ -14,3 +14,20 @@ POST_INSTALL += ; rm -f $(INSTALL_LIB_DIR)/libboost_unit_test_framework.so $(INSTALL_LIB_DIR)/${SO_NAME} POST_INSTALL_DBG += ; rm -f $(INSTALL_LIB_DIR_DBG)/libboost_unit_test_framework.so $(INSTALL_LIB_DIR_DBG)/${SO_NAME_DBG} endif + +check: all-shared + $(MAKE) -C test check || exit 1 + +check-release: release-shared + $(MAKE) -C test check-release-shared || exit 1 + +check-dbg: dbg-shared + $(MAKE) -C test check-dbg-shared || exit 1 + +ifndef WITHOUT_STLPORT +check-stldbg: stldbg-shared + $(MAKE) -C test check-stldbg-shared || exit 1 +endif + +depend:: + $(MAKE) -C test depend This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-01-23 19:02:15
|
Revision: 1472 http://svn.sourceforge.net/complement/?rev=1472&view=rev Author: complement Date: 2007-01-23 11:02:08 -0800 (Tue, 23 Jan 2007) Log Message: ----------- named objects added Modified Paths: -------------- trunk/complement/explore/include/mt/shm.h Modified: trunk/complement/explore/include/mt/shm.h =================================================================== --- trunk/complement/explore/include/mt/shm.h 2007-01-23 19:00:47 UTC (rev 1471) +++ trunk/complement/explore/include/mt/shm.h 2007-01-23 19:02:08 UTC (rev 1472) @@ -19,6 +19,7 @@ #include <stdint.h> #include <stdexcept> +#include <algorithm> #include <stl/type_traits.h> @@ -128,6 +129,16 @@ static size_type max_size() throw() { return _id == -1 ? 0 : _ds.shm_segsz; } + static size_type count() throw() + { + if ( _id != -1 ) { + if ( shmctl( _id, IPC_STAT, &_ds ) == 0 ) { + return _ds.shm_nattch; + } + } + return 0; + } + private: static shmid_ds _ds; static int _id; @@ -248,7 +259,126 @@ } // detail +template <int _Inst> class shm_alloc; + template <int _Inst> +class shm_name_mgr +{ + public: + typedef typename detail::__shm_alloc<_Inst>::size_type size_type; + + public: + bool is_name_exist( int ); + + template <class T> + void named( const T& obj, int name ) + { + xmt::__Locker<__Mutex<false,true> > lk( _lock ); + if ( _last == 255 ) { + throw std::range_error( "too many named objects" ); + } + if ( (reinterpret_cast<void *>(&obj) <= shm_alloc<_Inst>::_seg.address()) || + (reinterpret_cast<void *>(&obj) > (reinterpret_cast<char *>(shm_alloc<_Inst>::_seg.address()) + + shm_alloc<_Inst>::max_size() + + sizeof(shm_alloc<_Inst>::_master) + + sizeof(shm_alloc<_Inst>::_aheader) )) ) { + throw std::invalid_argument( std::string("object beyond this shared segment") ); + } + for ( int i = 0; _nm_table[i].name != -1; ++i ) { + if ( _nm_table[i].name == name ) { + throw std::invalid_argument( std::string("name id already exist") ); + } + } + _nm_table[_last].name = name; + _nm_table[_last].offset = reinterpret_cast<char *>(&obj) - reinterpret_cast<char *>(shm_alloc<_Inst>::_seg.address()); + _nm_table[_last].count = 1; + ++_last; + } + + template <class T> + T& named( int name ) + { + xmt::__Locker<__Mutex<false,true> > lk( _lock ); + for ( int i = 0; _nm_table[i].name != -1; ++i ) { + if ( _nm_table[i].name == name ) { + ++_nm_table[i].count; + return *reinterpret_cast<T *>(reinterpret_cast<char *>(shm_alloc<_Inst>::_seg.address()) + _nm_table[i].offset ); + } + } + throw std::invalid_argument( std::string("name id not found") ); + } + + template <class T> + const T& named( int name ) const + { + xmt::__Locker<__Mutex<false,true> > lk( _lock ); + for ( int i = 0; _nm_table[i].name != -1; ++i ) { + if ( _nm_table[i].name == name ) { + ++_nm_table[i].count; + return *reinterpret_cast<const T *>(reinterpret_cast<char *>(shm_alloc<_Inst>::_seg.address()) + _nm_table[i].offset ); + } + } + throw std::invalid_argument( std::string("name id not found") ); + } + + template <class T> + void release( int name ) + { + xmt::__Locker<__Mutex<false,true> > lk( _lock ); + for ( int i = 0; _nm_table[i].name != -1; ++i ) { + if ( _nm_table[i].name == name ) { + if ( --_nm_table[i].count == 0 ) { + reinterpret_cast<T *>(reinterpret_cast<char *>(shm_alloc<_Inst>::_seg.address()) + _nm_table[i].offset )->~T(); + // shift table; + std::copy( _nm_table + i + 1, _nm_table + _last + 1, _nm_table + i ); + --_last; + } + return; + } + } + throw std::invalid_argument( std::string("name id not found") ); + } + + int count( int name ) const throw() + { + xmt::__Locker<__Mutex<false,true> > lk( _lock ); + for ( int i = 0; _nm_table[i].name != -1; ++i ) { + if ( _nm_table[i].name == name ) { + return _nm_table[i].count; + } + } + return 0; + } + + private: + shm_name_mgr() + { + _nm_table[0].name = -1; + _last = 0; + } + shm_name_mgr( const shm_name_mgr& ) + { } + shm_name_mgr& operator =( const shm_name_mgr& ) + { return *this; } + + xmt::__Mutex<false,true> _lock; + struct _name_rec + { + int name; + typename shm_name_mgr<_Inst>::size_type offset; + int count; + // size + // type + }; + + _name_rec _nm_table[256]; + int _last; + + friend class shm_alloc<_Inst>; +}; + + +template <int _Inst> class shm_alloc { protected: @@ -261,6 +391,7 @@ uint64_t _magic; size_type _first; xmt::__Mutex<false,true> _lock; + size_type _nm; }; struct _fheader @@ -297,9 +428,20 @@ } static void deallocate( bool force = false ) - { _seg.deallocate( force ); } + { + pointer p = _seg.address(); - size_type max_size() const throw() + if ( p != reinterpret_cast<pointer>(-1) && (force || _seg.count() <= 1) ) { + _master *m = reinterpret_cast<_master *>( _seg.address() ); + (&m->_lock)->~__Mutex<false,true>(); + if ( m->_nm != 0 ) { + reinterpret_cast<shm_name_mgr<_Inst> *>(reinterpret_cast<char *>(p) + m->_nm)->~shm_name_mgr<_Inst>(); + } + } + _seg.deallocate( force ); + } + + static size_type max_size() throw() { return _seg.max_size() == 0 ? 0 : (_seg.max_size() - sizeof(_master) - sizeof(_aheader)); } protected: @@ -326,6 +468,7 @@ new ( &m._lock ) xmt::__Mutex<false,true>(); xmt::__Locker<xmt::__Mutex<false,true> > lk( m._lock ); m._first = sizeof( _master ); + m._nm = 0; _fheader& h = *new ( reinterpret_cast<char *>(&m) + sizeof(_master) ) _fheader(); h._next = 0; h._sz = _seg.max_size() - sizeof( _master ) - sizeof( _aheader ); @@ -336,6 +479,7 @@ static detail::__shm_alloc<_Inst> _seg; friend class detail::__shm_alloc<_Inst>; + friend class shm_name_mgr<_Inst>; }; template <int _Inst> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-01-23 19:00:48
|
Revision: 1471 http://svn.sourceforge.net/complement/?rev=1471&view=rev Author: complement Date: 2007-01-23 11:00:47 -0800 (Tue, 23 Jan 2007) Log Message: ----------- try to catch bug (?) in make 3.80; no success Modified Paths: -------------- trunk/complement/explore/Makefiles/ut/app2/Makefile.inc Added Paths: ----------- trunk/complement/explore/Makefiles/ut/app2/test31.cc Modified: trunk/complement/explore/Makefiles/ut/app2/Makefile.inc =================================================================== --- trunk/complement/explore/Makefiles/ut/app2/Makefile.inc 2007-01-23 18:58:29 UTC (rev 1470) +++ trunk/complement/explore/Makefiles/ut/app2/Makefile.inc 2007-01-23 19:00:47 UTC (rev 1471) @@ -5,4 +5,4 @@ #SRC_C = test.c SRC_CC = test.cc test2_SRC_CC = test2.cc -test3_SRC_CC = test3.cc +test3_SRC_CC = test3.cc test31.cc Added: trunk/complement/explore/Makefiles/ut/app2/test31.cc =================================================================== --- trunk/complement/explore/Makefiles/ut/app2/test31.cc (rev 0) +++ trunk/complement/explore/Makefiles/ut/app2/test31.cc 2007-01-23 19:00:47 UTC (rev 1471) @@ -0,0 +1,4 @@ +int f() +{ + return 3; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-01-23 18:58:34
|
Revision: 1470 http://svn.sourceforge.net/complement/?rev=1470&view=rev Author: complement Date: 2007-01-23 10:58:29 -0800 (Tue, 23 Jan 2007) Log Message: ----------- add tests Added Paths: ----------- trunk/complement/extern/custom/boost/libs/test/unit_test_framework/test/ trunk/complement/extern/custom/boost/libs/test/unit_test_framework/test/Makefile trunk/complement/extern/custom/boost/libs/test/unit_test_framework/test/Makefile.inc Property changes on: trunk/complement/extern/custom/boost/libs/test/unit_test_framework/test ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/extern/custom/boost/libs/test/unit_test_framework/test/Makefile =================================================================== --- trunk/complement/extern/custom/boost/libs/test/unit_test_framework/test/Makefile (rev 0) +++ trunk/complement/extern/custom/boost/libs/test/unit_test_framework/test/Makefile 2007-01-23 18:58:29 UTC (rev 1470) @@ -0,0 +1,60 @@ +# -*- makefile -*- Time-stamp: <06/06/27 02:25:13 ptr> + +SRCROOT := ../../../../../../../explore +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +INCLUDES += -I${BOOST_INCLUDE_DIR} + +release-shared: LDFLAGS += -L../${OUTPUT_DIR} -Wl,-rpath=../${OUTPUT_DIR}:${STLPORT_LIB_DIR} +dbg-shared: LDFLAGS += -L../${OUTPUT_DIR_DBG} -Wl,-rpath=../${OUTPUT_DIR_DBG}:${STLPORT_LIB_DIR} +ifndef WITHOUT_STLPORT +stldbg-shared: LDFLAGS += -L../${OUTPUT_DIR_STLDBG} -Wl,-rpath=../${OUTPUT_DIR_STLDBG}:${STLPORT_LIB_DIR} +endif + +release-shared: LDLIBS = -lboost_test_utf +dbg-shared: LDLIBS = -lboost_test_utfg +ifndef WITHOUT_STLPORT +stldbg-shared: LDLIBS = -lboost_test_utfstlg +endif + +TMPFILES = pattern.temp2 pattern.test + +check: all + for p in ${PRGNAME} ${PRGNAMES}; do \ + ${OUTPUT_DIR}/$$p || exit 1; \ + done + rm -f ${TMPFILES} + for p in ${PRGNAME} ${PRGNAMES}; do \ + ${OUTPUT_DIR_DBG}/$$p || exit 1; \ + done + rm -f ${TMPFILES} +ifndef WITHOUT_STLPORT + for p in ${PRGNAME} ${PRGNAMES}; do \ + ${OUTPUT_DIR_STLDBG}/$$p || exit 1; \ + done + rm -f ${TMPFILES} +endif + +check-release-shared: release-shared + for p in ${PRGNAME} ${PRGNAMES}; do \ + ${OUTPUT_DIR}/$$p || exit 1; \ + done + rm -f ${TMPFILES} + +check-dbg-shared: dbg-shared + for p in ${PRGNAME} ${PRGNAMES}; do \ + ${OUTPUT_DIR_DBG}/$$p || exit 1; \ + done + rm -f ${TMPFILES} + +ifndef WITHOUT_STLPORT +check-stldbg-shared: stldbg-shared + for p in ${PRGNAME} ${PRGNAMES}; do \ + ${OUTPUT_DIR_STLDBG}/$$p || exit 1; \ + done + rm -f ${TMPFILES} +endif + Added: trunk/complement/extern/custom/boost/libs/test/unit_test_framework/test/Makefile.inc =================================================================== --- trunk/complement/extern/custom/boost/libs/test/unit_test_framework/test/Makefile.inc (rev 0) +++ trunk/complement/extern/custom/boost/libs/test/unit_test_framework/test/Makefile.inc 2007-01-23 18:58:29 UTC (rev 1470) @@ -0,0 +1,22 @@ +# -*- makefile -*- Time-stamp: <03/03/31 15:11:21 ptr> + +BOOST_FS_SRC = ${BOOST_INCLUDE_DIR}/libs/test/test +PRGNAME = class_properties_test +PRGNAMES = basic_cstring_test output_test_stream_test parameterized_test_test test_fp_comparisons \ + auto_unit_test_test test_case_template_test \ + custom_exception_test fixed_mapping_test algorithms_test token_iterator_test +# auto_unit_test_test_mult +SRC_CPP = ${BOOST_FS_SRC}/class_properties_test.cpp +basic_cstring_test_SRC_CPP = ${BOOST_FS_SRC}/basic_cstring_test.cpp +output_test_stream_test_SRC_CPP = ${BOOST_FS_SRC}/output_test_stream_test.cpp +parameterized_test_test_SRC_CPP = ${BOOST_FS_SRC}/parameterized_test_test.cpp +test_fp_comparisons_SRC_CPP = ${BOOST_FS_SRC}/test_fp_comparisons.cpp +auto_unit_test_test_SRC_CPP = ${BOOST_FS_SRC}/auto_unit_test_test.cpp +auto_unit_test_test_mult_SRC_CPP = ${BOOST_FS_SRC}/auto_unit_test_test_mult.cpp \ + ${BOOST_FS_SRC}/auto_unit_test_test_mult1.cpp \ + ${BOOST_FS_SRC}/auto_unit_test_test_mult2.cpp +test_case_template_test_SRC_CPP = ${BOOST_FS_SRC}/test_case_template_test.cpp +custom_exception_test_SRC_CPP = ${BOOST_FS_SRC}/custom_exception_test.cpp +fixed_mapping_test_SRC_CPP = ${BOOST_FS_SRC}/fixed_mapping_test.cpp +algorithms_test_SRC_CPP = ${BOOST_FS_SRC}/algorithms_test.cpp +token_iterator_test_SRC_CPP = ${BOOST_FS_SRC}/token_iterator_test.cpp This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-01-23 12:28:24
|
Revision: 1469 http://svn.sourceforge.net/complement/?rev=1469&view=rev Author: complement Date: 2007-01-23 04:28:23 -0800 (Tue, 23 Jan 2007) Log Message: ----------- build unit tests and run it (check target) Modified Paths: -------------- trunk/complement/explore/lib/Makefile trunk/complement/explore/lib/mt/Makefile trunk/complement/explore/lib/sockios/Makefile trunk/complement/explore/lib/stem/Makefile Modified: trunk/complement/explore/lib/Makefile =================================================================== --- trunk/complement/explore/lib/Makefile 2007-01-23 12:27:17 UTC (rev 1468) +++ trunk/complement/explore/lib/Makefile 2007-01-23 12:28:23 UTC (rev 1469) @@ -1,4 +1,4 @@ -# Time-stamp: <06/11/01 22:59:18 ptr> +# Time-stamp: <07/01/23 14:12:04 ptr> # # Copyright (c) 2006 # Petr Ovtchenkov @@ -11,7 +11,7 @@ include ${SRCROOT}/Makefiles/gmake/subdirs.mak -all install depend clean clobber distclean: +all install depend clean clobber distclean check: $(doinsubdirs) -.PHONY: all install depend clean clobber distclean +.PHONY: all install depend clean clobber distclean check Modified: trunk/complement/explore/lib/mt/Makefile =================================================================== --- trunk/complement/explore/lib/mt/Makefile 2007-01-23 12:27:17 UTC (rev 1468) +++ trunk/complement/explore/lib/mt/Makefile 2007-01-23 12:28:23 UTC (rev 1469) @@ -1,4 +1,4 @@ -# -*- Makefile -*- Time-stamp: <06/11/10 16:23:01 ptr> +# -*- Makefile -*- Time-stamp: <07/01/23 15:00:11 ptr> SRCROOT := ../.. @@ -6,3 +6,26 @@ include ${SRCROOT}/Makefiles/top.mak INCLUDES += -I$(SRCROOT)/include + +check: install + $(MAKE) -C ../../test/mt + (cd ../../test/mt; ${OUTPUT_DIR}/mt_ut) || exit 1 + (cd ../../test/mt; ${OUTPUT_DIR_DBG}/mt_ut) || exit 1 + (cd ../../test/mt; ${OUTPUT_DIR_STLDBG}/mt_ut) || exit 1 + +check-release: install-release-shared + $(MAKE) -C ../../test/mt release-shared + (cd ../../test/mt; ${OUTPUT_DIR}/mt_ut) || exit 1 + +check-dbg: install-dbg-shared + $(MAKE) -C ../../test/mt dbg-shared + (cd ../../test/mt; ${OUTPUT_DIR_DBG}/mt_ut) || exit 1 + +ifndef WITHOUT_STLPORT +check-stldbg: install-stldbg-shared + $(MAKE) -C ../../test/mt stldbg-shared + (cd ../../test/mt; ${OUTPUT_DIR_STLDBG}/mt_ut) || exit 1 +endif + +depend:: + $(MAKE) -C ../../test/mt depend Modified: trunk/complement/explore/lib/sockios/Makefile =================================================================== --- trunk/complement/explore/lib/sockios/Makefile 2007-01-23 12:27:17 UTC (rev 1468) +++ trunk/complement/explore/lib/sockios/Makefile 2007-01-23 12:28:23 UTC (rev 1469) @@ -1,4 +1,4 @@ -# -*- Makefile -*- Time-stamp: <03/07/09 18:08:47 ptr> +# -*- Makefile -*- Time-stamp: <07/01/23 14:59:53 ptr> SRCROOT := ../.. COMPILER_NAME := gcc @@ -8,3 +8,25 @@ INCLUDES += -I$(SRCROOT)/include +check: install + $(MAKE) -C ../../test/sockios + (cd ../../test/sockios; ${OUTPUT_DIR}/sockios_ut) || exit 1 + (cd ../../test/sockios; ${OUTPUT_DIR_DBG}/sockios_ut) || exit 1 + (cd ../../test/sockios; ${OUTPUT_DIR_STLDBG}/sockios_ut) || exit 1 + +check-release: install-release-shared + $(MAKE) -C ../../test/sockios release-shared + (cd ../../test/sockios; ${OUTPUT_DIR}/sockios_ut) || exit 1 + +check-dbg: install-dbg-shared + $(MAKE) -C ../../test/sockios dbg-shared + (cd ../../test/sockios; ${OUTPUT_DIR_DBG}/sockios_ut) || exit 1 + +ifndef WITHOUT_STLPORT +check-stldbg: install-stldbg-shared + $(MAKE) -C ../../test/sockios stldbg-shared + (cd ../../test/sockios; ${OUTPUT_DIR_STLDBG}/sockios_ut) || exit 1 +endif + +depend:: + $(MAKE) -C ../../test/sockios depend Modified: trunk/complement/explore/lib/stem/Makefile =================================================================== --- trunk/complement/explore/lib/stem/Makefile 2007-01-23 12:27:17 UTC (rev 1468) +++ trunk/complement/explore/lib/stem/Makefile 2007-01-23 12:28:23 UTC (rev 1469) @@ -1,4 +1,4 @@ -# -*- Makefile -*- Time-stamp: <06/11/30 22:27:35 ptr> +# -*- Makefile -*- Time-stamp: <07/01/23 14:58:35 ptr> SRCROOT := ../.. COMPILER_NAME := gcc @@ -15,3 +15,26 @@ else stldbg-shared: DEFS += -D__FIT_STEM_TRACE=1 endif + +check: install + $(MAKE) -C ../../test/stem + (cd ../../test/stem; ${OUTPUT_DIR}/stem_ut) || exit 1 + (cd ../../test/stem; ${OUTPUT_DIR_DBG}/stem_ut) || exit 1 + (cd ../../test/stem; ${OUTPUT_DIR_STLDBG}/stem_ut) || exit 1 + +check-release: install-release-shared + $(MAKE) -C ../../test/stem release-shared + (cd ../../test/stem; ${OUTPUT_DIR}/stem_ut) || exit 1 + +check-dbg: install-dbg-shared + $(MAKE) -C ../../test/stem dbg-shared + (cd ../../test/stem; ${OUTPUT_DIR_DBG}/stem_ut) || exit 1 + +ifndef WITHOUT_STLPORT +check-stldbg: install-stldbg-shared + $(MAKE) -C ../../test/stem stldbg-shared + (cd ../../test/stem; ${OUTPUT_DIR_STLDBG}/stem_ut) || exit 1 +endif + +depend:: + $(MAKE) -C ../../test/stem depend This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-01-23 12:27:18
|
Revision: 1468 http://svn.sourceforge.net/complement/?rev=1468&view=rev Author: complement Date: 2007-01-23 04:27:17 -0800 (Tue, 23 Jan 2007) Log Message: ----------- allow few ways for target depend Modified Paths: -------------- trunk/complement/explore/Makefiles/gmake/depend.mak Modified: trunk/complement/explore/Makefiles/gmake/depend.mak =================================================================== --- trunk/complement/explore/Makefiles/gmake/depend.mak 2007-01-23 12:24:52 UTC (rev 1467) +++ trunk/complement/explore/Makefiles/gmake/depend.mak 2007-01-23 12:27:17 UTC (rev 1468) @@ -1,4 +1,4 @@ -# Time-stamp: <06/11/11 01:04:15 ptr> +# Time-stamp: <07/01/23 14:58:21 ptr> # # Copyright (c) 1997-1999, 2002, 2003, 2005, 2006 # Petr Ovtchenkov @@ -31,7 +31,7 @@ endif -depend: $(OUTPUT_DIRS) ${_DASH_DEP} +depend:: $(OUTPUT_DIRS) ${_DASH_DEP} @cat -s $(_ALL_DEP) /dev/null > $(DEPENDS_COLLECTION) TAGS: $(OUTPUT_DIRS) ${_DASH_DEP} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-01-23 12:24:57
|
Revision: 1467 http://svn.sourceforge.net/complement/?rev=1467&view=rev Author: complement Date: 2007-01-23 04:24:52 -0800 (Tue, 23 Jan 2007) Log Message: ----------- build some tests and check (run ones) Modified Paths: -------------- trunk/complement/extern/custom/boost/libs/Makefile trunk/complement/extern/custom/boost/libs/filesystem/Makefile trunk/complement/extern/custom/boost/libs/test/test_exec_mon/Makefile trunk/complement/extern/custom/boost/libs/test/test_exec_mon/Makefile.inc Added Paths: ----------- trunk/complement/extern/custom/boost/libs/filesystem/test/ trunk/complement/extern/custom/boost/libs/filesystem/test/Makefile trunk/complement/extern/custom/boost/libs/filesystem/test/Makefile.inc Modified: trunk/complement/extern/custom/boost/libs/Makefile =================================================================== --- trunk/complement/extern/custom/boost/libs/Makefile 2006-12-29 13:24:41 UTC (rev 1466) +++ trunk/complement/extern/custom/boost/libs/Makefile 2007-01-23 12:24:52 UTC (rev 1467) @@ -7,11 +7,13 @@ # SRCROOT := ../../../../explore -SUBDIRS := date_time filesystem program_options regex serialization test/unit_test_framework thread +SUBDIRS := date_time filesystem program_options regex serialization \ + test/unit_test_framework test/test_exec_mon \ + thread include ${SRCROOT}/Makefiles/gmake/subdirs.mak -all install install-release-static depend clean clobber distclean: +all install install-release-static depend clean clobber distclean check: $(doinsubdirs) -.PHONY: all install install-release-static depend clean clobber distclean +.PHONY: all install install-release-static depend clean clobber distclean check Modified: trunk/complement/extern/custom/boost/libs/filesystem/Makefile =================================================================== --- trunk/complement/extern/custom/boost/libs/filesystem/Makefile 2006-12-29 13:24:41 UTC (rev 1466) +++ trunk/complement/extern/custom/boost/libs/filesystem/Makefile 2007-01-23 12:24:52 UTC (rev 1467) @@ -14,3 +14,18 @@ POST_INSTALL += ; rm -f $(INSTALL_LIB_DIR)/libboost_filesystem.so $(INSTALL_LIB_DIR)/${SO_NAME} POST_INSTALL_DBG += ; rm -f $(INSTALL_LIB_DIR_DBG)/libboost_filesystem.so $(INSTALL_LIB_DIR_DBG)/${SO_NAME_DBG} endif + +check: all + ${MAKE} -C test check + +check-release-shared: release-shared + ${MAKE} -C test check-release-shared + +check-dbg-shared: dbg-shared + ${MAKE} -C test check-dbg-shared + +ifndef WITHOUT_STLPORT +check-stldbg-shared: stldbg-shared + ${MAKE} -C test check-stldbg-shared +endif + Property changes on: trunk/complement/extern/custom/boost/libs/filesystem/test ___________________________________________________________________ Name: svn:ignore + obj xx fstream_test_?foo Added: trunk/complement/extern/custom/boost/libs/filesystem/test/Makefile =================================================================== --- trunk/complement/extern/custom/boost/libs/filesystem/test/Makefile (rev 0) +++ trunk/complement/extern/custom/boost/libs/filesystem/test/Makefile 2007-01-23 12:24:52 UTC (rev 1467) @@ -0,0 +1,50 @@ +# -*- makefile -*- Time-stamp: <06/06/27 02:25:13 ptr> + +SRCROOT := ../../../../../../explore +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +INCLUDES += -I${BOOST_INCLUDE_DIR} + +LDFLAGS += -L${INSTALL_LIB_DIR} -Wl,-rpath=${INSTALL_LIB_DIR}:${STLPORT_LIB_DIR} + +release-shared: LDLIBS = -lboost_test_tem -lboost_fs +dbg-shared: LDLIBS = -lboost_test_temg -lboost_fsg +ifndef WITHOUT_STLPORT +stldbg-shared: LDLIBS = -lboost_test_temstlg -lboost_fsstlg +endif + +check: all + for p in ${PRGNAME} ${PRGNAMES}; do \ + ${OUTPUT_DIR}/$$p || exit 1; \ + ${OUTPUT_DIR_DBG}/$$p || exit 1; \ + done +ifndef WITHOUT_STLPORT + for p in ${PRGNAME} ${PRGNAMES}; do \ + ${OUTPUT_DIR_STLDBG}/$$p || exit 1; \ + done +endif + rm -rf ./xx fstream_test_?foo + +check-release-shared: release-shared + for p in ${PRGNAME} ${PRGNAMES}; do \ + ${OUTPUT_DIR}/$$p || exit 1; \ + done + rm -rf ./xx fstream_test_?foo + +check-dbg-shared: dbg-shared + for p in ${PRGNAME} ${PRGNAMES}; do \ + ${OUTPUT_DIR_DBG}/$$p || exit 1; \ + done + rm -rf ./xx fstream_test_?foo + +ifndef WITHOUT_STLPORT +check-stldbg-shared: stldbg-shared + for p in ${PRGNAME} ${PRGNAMES}; do \ + ${OUTPUT_DIR_STLDBG}/$$p || exit 1; \ + done + rm -rf ./xx fstream_test_?foo +endif + Added: trunk/complement/extern/custom/boost/libs/filesystem/test/Makefile.inc =================================================================== --- trunk/complement/extern/custom/boost/libs/filesystem/test/Makefile.inc (rev 0) +++ trunk/complement/extern/custom/boost/libs/filesystem/test/Makefile.inc 2007-01-23 12:24:52 UTC (rev 1467) @@ -0,0 +1,12 @@ +# -*- makefile -*- Time-stamp: <03/03/31 15:11:21 ptr> + +BOOST_FS_SRC = ${BOOST_INCLUDE_DIR}/libs/filesystem/test +PRGNAME = path_test +PRGNAMES = default_name_check_test operations_test fstream_test convenience_test +# large_file_support_test +SRC_CPP = ${BOOST_FS_SRC}/path_test.cpp +default_name_check_test_SRC_CPP = ${BOOST_FS_SRC}/default_name_check_test.cpp +operations_test_SRC_CPP = ${BOOST_FS_SRC}/operations_test.cpp +fstream_test_SRC_CPP = ${BOOST_FS_SRC}/fstream_test.cpp +convenience_test_SRC_CPP = ${BOOST_FS_SRC}/convenience_test.cpp +# large_file_support_test_SRC_CPP = ${BOOST_FS_SRC}/large_file_support_test.cpp Modified: trunk/complement/extern/custom/boost/libs/test/test_exec_mon/Makefile =================================================================== --- trunk/complement/extern/custom/boost/libs/test/test_exec_mon/Makefile 2006-12-29 13:24:41 UTC (rev 1466) +++ trunk/complement/extern/custom/boost/libs/test/test_exec_mon/Makefile 2007-01-23 12:24:52 UTC (rev 1467) @@ -1,10 +1,16 @@ -# -*- makefile -*- Time-stamp: <03/03/31 15:18:29 ptr> -# $Id$ +# -*- makefile -*- Time-stamp: <06/06/27 02:26:25 ptr> SRCROOT := ../../../../../../explore COMPILER_NAME := gcc +POST_INSTALL = ln -sf ${SO_NAME} $(INSTALL_LIB_DIR)/libboost_unit_test_framework.so +POST_INSTALL_DBG = ln -sf ${SO_NAME_DBG} $(INSTALL_LIB_DIR_DBG)/libboost_unit_test_framework.so include Makefile.inc include ${SRCROOT}/Makefiles/top.mak -INCLUDES += -I$(STLPORT_INCLUDE_DIR) -I${BOOST_INCLUDE_DIR} +INCLUDES += -I${BOOST_INCLUDE_DIR} + +ifdef USE_SYSTEM_BOOST +POST_INSTALL += ; rm -f $(INSTALL_LIB_DIR)/libboost_unit_test_framework.so $(INSTALL_LIB_DIR)/${SO_NAME} +POST_INSTALL_DBG += ; rm -f $(INSTALL_LIB_DIR_DBG)/libboost_unit_test_framework.so $(INSTALL_LIB_DIR_DBG)/${SO_NAME_DBG} +endif Modified: trunk/complement/extern/custom/boost/libs/test/test_exec_mon/Makefile.inc =================================================================== --- trunk/complement/extern/custom/boost/libs/test/test_exec_mon/Makefile.inc 2006-12-29 13:24:41 UTC (rev 1466) +++ trunk/complement/extern/custom/boost/libs/test/test_exec_mon/Makefile.inc 2007-01-23 12:24:52 UTC (rev 1467) @@ -1,14 +1,23 @@ # -*- makefile -*- Time-stamp: <03/03/31 15:11:21 ptr> -# $Id$ BOOST_TST_SRC = ${BOOST_INCLUDE_DIR}/libs/test/src LIBNAME = boost_test_tem MAJOR = 1 -MINOR = 32 -PATCH = 0 -SRC_CPP = ${BOOST_TST_SRC}/execution_monitor.cpp ${BOOST_TST_SRC}/test_tools.cpp \ +MINOR = 33 +PATCH = 1 +SRC_CPP = ${BOOST_TST_SRC}/compiler_log_formatter.cpp \ + ${BOOST_TST_SRC}/execution_monitor.cpp \ + ${BOOST_TST_SRC}/framework.cpp \ + ${BOOST_TST_SRC}/plain_report_formatter.cpp \ + ${BOOST_TST_SRC}/progress_monitor.cpp \ + ${BOOST_TST_SRC}/results_collector.cpp \ + ${BOOST_TST_SRC}/results_reporter.cpp \ + ${BOOST_TST_SRC}/test_main.cpp \ + ${BOOST_TST_SRC}/test_tools.cpp \ + ${BOOST_TST_SRC}/unit_test_log.cpp \ + ${BOOST_TST_SRC}/unit_test_main.cpp \ + ${BOOST_TST_SRC}/unit_test_monitor.cpp \ ${BOOST_TST_SRC}/unit_test_parameters.cpp \ - ${BOOST_TST_SRC}/unit_test_log.cpp ${BOOST_TST_SRC}/unit_test_monitor.cpp \ - ${BOOST_TST_SRC}/unit_test_result.cpp \ - ${BOOST_TST_SRC}/unit_test_suite.cpp ${BOOST_TST_SRC}/test_main.cpp \ - ${BOOST_TST_SRC}/supplied_log_formatters.cpp + ${BOOST_TST_SRC}/unit_test_suite.cpp \ + ${BOOST_TST_SRC}/xml_log_formatter.cpp \ + ${BOOST_TST_SRC}/xml_report_formatter.cpp This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2006-12-29 13:24:44
|
Revision: 1466 http://svn.sourceforge.net/complement/?rev=1466&view=rev Author: complement Date: 2006-12-29 05:24:41 -0800 (Fri, 29 Dec 2006) Log Message: ----------- function return: increment operator for POD and non-pod; memfunc Added Paths: ----------- trunk/complement/explore/inquiry/STLport/mem_func/ trunk/complement/explore/inquiry/STLport/mem_func/Makefile trunk/complement/explore/inquiry/STLport/mem_func/Makefile.inc trunk/complement/explore/inquiry/STLport/mem_func/mm.cc trunk/complement/explore/inquiry/STLport/tmp_iter/ trunk/complement/explore/inquiry/STLport/tmp_iter/Makefile trunk/complement/explore/inquiry/STLport/tmp_iter/Makefile.inc trunk/complement/explore/inquiry/STLport/tmp_iter/test.cc Property changes on: trunk/complement/explore/inquiry/STLport/mem_func ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/inquiry/STLport/mem_func/Makefile =================================================================== --- trunk/complement/explore/inquiry/STLport/mem_func/Makefile (rev 0) +++ trunk/complement/explore/inquiry/STLport/mem_func/Makefile 2006-12-29 13:24:41 UTC (rev 1466) @@ -0,0 +1,10 @@ +# -*- Makefile -*- Time-stamp: <03/07/09 18:08:47 ptr> + +SRCROOT := ../../.. +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +LDFLAGS += -Wl,-rpath=$(STLPORT_LIB_DIR) + Added: trunk/complement/explore/inquiry/STLport/mem_func/Makefile.inc =================================================================== --- trunk/complement/explore/inquiry/STLport/mem_func/Makefile.inc (rev 0) +++ trunk/complement/explore/inquiry/STLport/mem_func/Makefile.inc 2006-12-29 13:24:41 UTC (rev 1466) @@ -0,0 +1,4 @@ +# -*- makefile -*- Time-stamp: <02/07/14 14:03:13 ptr> + +PRGNAME = test +SRC_CC = mm.cc Added: trunk/complement/explore/inquiry/STLport/mem_func/mm.cc =================================================================== --- trunk/complement/explore/inquiry/STLport/mem_func/mm.cc (rev 0) +++ trunk/complement/explore/inquiry/STLport/mem_func/mm.cc 2006-12-29 13:24:41 UTC (rev 1466) @@ -0,0 +1,39 @@ +#include <iostream> +#include <string> +#include <vector> +#include <functional> +#include <algorithm> + +class Person +{ + private: + std::string name; + + public: + //... + void print () const + { std::cout << name << std::endl; } + + void printWithPrefix (std::string prefix) const + { std::cout << prefix << name << std::endl; } +}; + +void foo (const std::vector<Person>& coll) +{ + using std::for_each; + using std::bind2nd; + using std::mem_fun_ref; + + // call member function print() for each element + for_each( coll.begin(), coll.end(), mem_fun_ref(&Person::print) ); + + // call member function printWithPrefix() for each element + // - "person: " is passed as an argument to the member function + for_each( coll.begin(), coll.end(), bind2nd(mem_fun_ref(&Person::printWithPrefix), "person: ") ); + for_each( coll.begin(), coll.end(), bind2nd(mem_fun_ref(&Person::printWithPrefix), std::string("person: ") ) ); +} + +int main() +{ + return 0; +} Property changes on: trunk/complement/explore/inquiry/STLport/tmp_iter ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/inquiry/STLport/tmp_iter/Makefile =================================================================== --- trunk/complement/explore/inquiry/STLport/tmp_iter/Makefile (rev 0) +++ trunk/complement/explore/inquiry/STLport/tmp_iter/Makefile 2006-12-29 13:24:41 UTC (rev 1466) @@ -0,0 +1,10 @@ +# -*- Makefile -*- Time-stamp: <03/07/09 18:08:47 ptr> + +SRCROOT := ../../.. +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +LDFLAGS += -Wl,-rpath=$(STLPORT_LIB_DIR) + Added: trunk/complement/explore/inquiry/STLport/tmp_iter/Makefile.inc =================================================================== --- trunk/complement/explore/inquiry/STLport/tmp_iter/Makefile.inc (rev 0) +++ trunk/complement/explore/inquiry/STLport/tmp_iter/Makefile.inc 2006-12-29 13:24:41 UTC (rev 1466) @@ -0,0 +1,4 @@ +# -*- makefile -*- Time-stamp: <02/07/14 14:03:13 ptr> + +PRGNAME = test +SRC_CC = test.cc Added: trunk/complement/explore/inquiry/STLport/tmp_iter/test.cc =================================================================== --- trunk/complement/explore/inquiry/STLport/tmp_iter/test.cc (rev 0) +++ trunk/complement/explore/inquiry/STLport/tmp_iter/test.cc 2006-12-29 13:24:41 UTC (rev 1466) @@ -0,0 +1,67 @@ +/* +end() return rvalue (Standard, 3.10 par. 5) + +If this is a POD, increment/decrement operators invalid in this context; +If this is user-defined object, temporary object created from rvalue +(Standard, 12.2; 6.6.3) and increment/decrement operators may be valid; + +Usage POD type for string iterator is effective and don't contradict to +Standard. + +So the code + +char c = *(--s.end()); + +is implementation-specific and that's why not good. + +[this is explanation why this code work if begin() return v, but not work +when end() return char *; inspired by string::iterator] +*/ +#include <string> + +using namespace std; + +class v +{ + public: + v& operator ++() { return *this; } +}; + +class vconst +{ + public: + vconst& operator ++() { return *this; } +}; + + +class q +{ + public: + v begin() + { return v(); } + + vconst begin() const + { return vconst(); } + + char *end() + { return 0; } + + private: +}; + +int main() +{ + q x; + + ++x.begin(); + ++x.end(); + + // string s( "123456" ); + + // --s.end(); + + // char c = *(--s.end()); + + return 0; +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2006-12-28 10:04:22
|
Revision: 1465 http://svn.sourceforge.net/complement/?rev=1465&view=rev Author: complement Date: 2006-12-28 02:04:20 -0800 (Thu, 28 Dec 2006) Log Message: ----------- make description; start Boiler sample Modified Paths: -------------- trunk/WWW/explore/Complement/ContentTech.shtml trunk/WWW/explore/Complement/MakeTags.shtml trunk/WWW/explore/Complement/main.css Added Paths: ----------- trunk/WWW/explore/Complement/Boiler1.shtml trunk/WWW/explore/Complement/MakeConfig.shtml trunk/WWW/explore/Complement/MakeMacros.shtml trunk/WWW/explore/Complement/MakeStart.shtml trunk/WWW/explore/Complement/img/fig/ trunk/WWW/explore/Complement/img/fig/boiler-comp.fig trunk/WWW/explore/Complement/img/fig/boiler-comp.png trunk/WWW/explore/Complement/img/fig/boiler-general.fig trunk/WWW/explore/Complement/img/fig/boiler-general.png trunk/WWW/explore/Complement/img/fig/sensors-lifecycle.fig trunk/WWW/explore/Complement/img/fig/sensors-lifecycle.png trunk/WWW/explore/Complement/img/fig/termo.fig trunk/WWW/explore/Complement/img/fig/termo.png trunk/WWW/explore/Complement/img/fig/valve-lifecycle.fig trunk/WWW/explore/Complement/img/fig/valve-lifecycle.png Added: trunk/WWW/explore/Complement/Boiler1.shtml =================================================================== --- trunk/WWW/explore/Complement/Boiler1.shtml (rev 0) +++ trunk/WWW/explore/Complement/Boiler1.shtml 2006-12-28 10:04:20 UTC (rev 1465) @@ -0,0 +1,82 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> + +<!-- Time-stamp: <06/12/19 09:11:21 ptr> --> + +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <link rel="stylesheet" type="text/css" href="main.css" media="screen" title="general"> + <link rel="stylesheet" type="text/css" href="decor.css" media="screen" title="general"> + <link rel="stylesheet" type="text/css" href="float.css" media="screen" title="general"> + <title>Complement: System Design Sample (Boiler)</title> + </head> + + <body> +<!--#include file="head-tech.shtml" --> +<div class="toppic"> +<img src="img/jpg/apropos.jpg"> +</div> +<div class="main"> + <h2 class="lheader"></h2> + <p> + Let's consider design of model of boiler (design of software model). + </p> + <p> + When I want imagine system in whole, I start from drawing component + diagram like this: + </p> +<center> +<img src="img/fig/boiler-general.png"> +</center> +<pre class="ddisplay"> +</pre> + + <p> + On this figure I consider boiler as 'black box', and focused on + behavior of this device from external point of view. I try to answer + on question 'What I expect from this device?'. + </p> + + <p> + On the next step I should define components of the whole system + and expected interaction between ones. + This design stage leads to components point of view on boiler: + </p> +<center> +<img src="img/fig/boiler-comp.png"> +</center> + + <p> + Now, descending in abstraction layer, consider every component separately. + </p> + <p> + Valve life cycle, is here: + </p> +<center> +<img src="img/fig/valve-lifecycle.png"> +</center> + <p> + Valve is opened when power on and closed otherwise. + </p> + + <p> + Thermo elements may has step or continuous regulation of power: + </p> +<center> +<img src="img/fig/termo.png"> +</center> + + <p> + Sensors start work whith power on and take temperature, pressure, + water level, plus two kinds of alarms---low and high water. + </p> +<center> +<img src="img/fig/sensors-lifecycle.png"> +</center> + +</div> +<!--#include file="foot.shtml" --> +<!-- Created: Mon Oct 7 16:33:17 MSD 2002 --> + </body> +</html> + Modified: trunk/WWW/explore/Complement/ContentTech.shtml =================================================================== --- trunk/WWW/explore/Complement/ContentTech.shtml 2006-12-27 12:17:36 UTC (rev 1464) +++ trunk/WWW/explore/Complement/ContentTech.shtml 2006-12-28 10:04:20 UTC (rev 1465) @@ -1,9 +1,12 @@ -<!-- Time-stamp: <03/06/29 16:07:20 ptr> --> +<!-- Time-stamp: <06/12/08 00:48:21 ptr> --> <div class="nodecor"> <a href="index.shtml">Home</a><br> <a href="Anti-autotools.shtml">Anti-autotools</a><br> -<a href="MakeTags.shtml">Make system</a><br> -<a href="compare.pdf">Comparison of STL<br>Implementations (PDF)</a><br> +<a href="MakeStart.shtml">Make system: quick start</a><br> +<a href="MakeConfig.shtml">Make system: global customization</a><br> +<a href="MakeTags.shtml">Make system: tags</a><br> +<a href="MakeMacros.shtml">Make system: macros</a><br> +<a href="compare.pdf">Comparison of STL Implementations (PDF)</a><br> <br> <a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=63160&type=2" width="125" height="37" border="0" alt="SourceForge.net Logo"></a><br> </div> Added: trunk/WWW/explore/Complement/MakeConfig.shtml =================================================================== --- trunk/WWW/explore/Complement/MakeConfig.shtml (rev 0) +++ trunk/WWW/explore/Complement/MakeConfig.shtml 2006-12-28 10:04:20 UTC (rev 1465) @@ -0,0 +1,29 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> + +<!-- Time-stamp: <06/12/08 01:01:55 ptr> --> + +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <link rel="stylesheet" type="text/css" href="main.css" media="screen" title="general"> + <link rel="stylesheet" type="text/css" href="decor.css" media="screen" title="general"> + <link rel="stylesheet" type="text/css" href="float.css" media="screen" title="general"> + <title>Complement: Make global customization</title> + </head> + + <body> +<!--#include file="head-tech.shtml" --> +<div class="toppic"> +<img src="img/jpg/apropos.jpg"> +</div> +<div class="main"> + <h2 class="lheader">Global customization: configure again?</h2> +<pre class="ddisplay"> +</pre> + +</div> +<!--#include file="foot.shtml" --> +<!-- Created: Mon Oct 7 16:33:17 MSD 2002 --> + </body> +</html> + Added: trunk/WWW/explore/Complement/MakeMacros.shtml =================================================================== --- trunk/WWW/explore/Complement/MakeMacros.shtml (rev 0) +++ trunk/WWW/explore/Complement/MakeMacros.shtml 2006-12-28 10:04:20 UTC (rev 1465) @@ -0,0 +1,120 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> + +<!-- Time-stamp: <06/12/12 09:45:03 ptr> --> + +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <link rel="stylesheet" type="text/css" href="main.css" media="screen" title="general"> + <link rel="stylesheet" type="text/css" href="decor.css" media="screen" title="general"> + <link rel="stylesheet" type="text/css" href="float.css" media="screen" title="general"> + <title>Complement: Make Macros</title> + </head> + + <body> +<!--#include file="head-tech.shtml" --> +<div class="toppic"> +<img src="img/jpg/apropos.jpg"> +</div> +<div class="main"> + <h2 class="lheader">Macros for general use</h2> + <dl> + <dt>COMPILER_NAME + <dd>kind of compiler; something like 'gcc', 'vc6', 'icc', 'aCC', ...; if not set assumed 'gcc'; note, that this isn't + compiler call string, it used as identifier for compiler 'family'</dd> + <dt>ALL_TAGS</dt> + <dd>tags, that should be build during 'all' tag</dd> + <dt>OUTPUT_DIR</dt> + <dd>catalog for object files, resulting programs or libraries for release build</dd> + <dt>OUTPUT_DIR_DBG</dt> + <dd>catalog for object files, resulting programs or libraries for debug build</dd> + <dt>OUTPUT_DIR_STLDBG</dt> + <dd>catalog for object files, resulting programs or libraries for STLport debug mode build</dd> + <dt>BASE_INSTALL_DIR</dt> + <dd>base path for install; ${SRCROOT}/build/$(TARGET_NAME), if not redefined (TARGET_NAME is identification of target OS in case of cross-compilation)</dd> + <dt>INCLUDES</dt> + <dd>include options for compiler (like -I/path/to/someware); if STLport assumed, already have -I${STLPORT_INCLUDE_DIR}</dd> + <dt>DEFS</dt> + <dd>define options for preprocessor (like -DMY_MACRO=1); if STLport assumed already have -DSTLPORT_DEBUG for STLport debug mode</dd> + <dt>OPT</dt> + <dd>optimization flags; already have -g for debug or STLport debug, -O2 for release (or appropriate options for other compilers)</dd> + <dt>LDFLAGS</dt> + <dd>options for linker</dd> + <dt>SRC_CC</dt> + <dd>C++ sources (*.cc)</dd> + <dt>SRC_CPP</dt> + <dd>C++ sources (*.cpp)</dd> + <dt>SRC_CXX</dt> + <dd>C++ sources (*.cxx)</dd> + <dt>SRC_C</dt> + <dd>C sources (*.c)</dd> + </dl> + <h2 class="lheader">Macros to build application</h2> + <dl> + <dt>PRGNAME</dt> + <dd>base name of application (i.e. without .exe on platforms where it used); presense of this macro is direction to build application</dd> + <dt>PRGNAMES</dt> + <dd>build few programs from same catalog</dd> + <dt>BASE_INSTALL_BIN_DIR</dt> + <dd>base path for application installation; BASE_INSTALL_DIR by default</dd> + <dt>INSTALL_BIN_DIR</dt> + <dd>path for release application installation; default BASE_INSTALL_BIN_DIR/bin</dd> + <dt>INSTALL_BIN_DIR_DBG</dt> + <dd>path for debug application installation; default $(INSTALL_BIN_DIR)_g</dd> + <dt>INSTALL_BIN_DIR_STLDBG</dt> + <dd>path for STLport debug mode application installation; default $(INSTALL_BIN_DIR)_stlg</dd> + </dl> + <h2 class="lheader">Macros to build library</h2> + <dl> + <dt>LIBNAME</dt> + <dd>base name of library (i.e. without 'lib' prefix, '.lib', '.so', '.a', '.dll', etc. suffixes)</dd> + <dt>LIBNAMES</dt> + <dd>build few libraries from same catalog</dd> + <dt>BASE_INSTALL_LIB_DIR</dt> + <dd>base path for libararies installation; BASE_INSTALL_DIR by default</dd> + <dt>INSTALL_LIB_DIR</dt> + <dd>path for release libraries installation; default BASE_INSTALL_LIB_DIR/lib</dd> + <dt>INSTALL_LIB_DIR_DBG</dt> + <dd>path for debug libraries installation; default BASE_INSTALL_LIB_DIR/lib</dd> + <dt>INSTALL_LIB_DIR_STLDBG</dt> + <dd>path for STLport debug mode libraries installation; default BASE_INSTALL_LIB_DIR/lib</dd> + </dl> + <h2 class="lheader">Macros for specific tasks</h2> + <dl> + <dt>WITHOUT_STLPORT</dt> + <dd>build without STLport, if defined</dd> + <dt>NOT_USE_NOSTDLIB</dt> + <dd>with STLport, I can avoid link with libstdc++ (only gcc-related); this is default, if it possible; to force link with libstdc++, define this as 1</dd> + <dt>RULESBASE</dt> + <dd>path where this make support system situated</dd> + <dt>_FORCE_CXX</dt> + <dd>use this name as C++ compiler, if defined; don't use it for cross!</dd> + <dt>_FORCE_CC</dt> + <dd>use this name as C compiler, if defined; don't use it for cross!</dd> + <dt>OSNAME</dt> + <dd>contain lower-case one-word OS name (linux, freebsd, hp-ux, sunos, windows, etc.); in case of cross-compilation this is for target OS</dd> + <dt>POST_INSTALL</dt> + <dd>command or group of command that will be made after release library or program installation; not defined</dd> + <dt>POST_INSTALL_DBG</dt> + <dd>command or group of command that will be made after debug library or program installation; not defined</dd> + <dt>POST_INSTALL_STLDBG</dt> + <dd>command or group of command that will be made after STLport debug mode library installation; not defined</dd> + <dt>EXTRA_PRE</dt> + <dd>tags that should be made before release-shared; not defined</dd> + <dt>EXTRA_PRE_DBG</dt> + <dd>tags that should be made before dbg-shared; not defined</dd> + <dt>EXTRA_PRE_STLDBG</dt> + <dd>tags that should be made before stldbg-shared; not defined</dd> + <dt>EXTRA_POST</dt> + <dd>tags that should be made after release-shared; not defined</dd> + <dt>EXTRA_POST_DBG</dt> + <dd>tags that should be made after dbg-shared; not defined</dd> + <dt>EXTRA_POST_STLDBG</dt> + <dd>tags that should be made after stldbg-shared; not defined</dd> + </dl> +</div> +<!--#include file="foot.shtml" --> +<!-- Created: Fri Dec 8 14:11:17 MSD 2006 --> + </body> +</html> + Added: trunk/WWW/explore/Complement/MakeStart.shtml =================================================================== --- trunk/WWW/explore/Complement/MakeStart.shtml (rev 0) +++ trunk/WWW/explore/Complement/MakeStart.shtml 2006-12-28 10:04:20 UTC (rev 1465) @@ -0,0 +1,178 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> + +<!-- Time-stamp: <06/12/08 01:01:55 ptr> --> + +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <link rel="stylesheet" type="text/css" href="main.css" media="screen" title="general"> + <link rel="stylesheet" type="text/css" href="decor.css" media="screen" title="general"> + <link rel="stylesheet" type="text/css" href="float.css" media="screen" title="general"> + <title>Complement: Make Basic Use-cases</title> + </head> + + <body> +<!--#include file="head-tech.shtml" --> +<div class="toppic"> +<img src="img/jpg/apropos.jpg"> +</div> +<div class="main"> + <h2 class="lheader">Make versions</h2> + <p> + I stop on support on two make variants. Well, really on single + GNU Make + and one naive utility (nmake). + </p> + + <p> + GNU Make is everyware (or can be + everyware) in *NIX world. So I don't have stimulus to play with + another make incarnations (for example, BSD make is very nice, + but GNU Make more common). If GNU Make is present, I expect that + other POSIX utilities (sed, awk, sh, grep, cat, test, ... ) + present too. + </p> + + <p> + To play with compilers from one Redmond's company, you may + use nmake. The makefiles less attached to absolute paths, + and really may be moved from one box to another, in contrast + to MS's project files. Even more, VS's projects are castrated makefiles + that processed by nmake; this process screened by GUI from users. + Nmake is really restricted, and system based on it has less + features and power then GNU make-based. But it work too. + </p> + + <h2 class="lheader">Use-case: application</h2> + <p> + To build program you need compiler-specific (often + OS-specific) file like <tt>Makefile</tt>: + </p> +<pre class="ddisplay"> +# -*- Makefile -*- Time-stamp: <06/08/04 10:54:19 ptr> + +SRCROOT := ../../.. +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + + +INCLUDES += -I$(SRCROOT)/include -I$(BOOST_INCLUDE_DIR) + +release-shared : LDLIBS = -lxmt -lboost_test_utf +stldbg-shared : LDLIBS = -lxmtstlg -lboost_test_utfstlg +dbg-shared : LDLIBS = -lxmtg -lboost_test_utfg +</pre> + <p> + Here present reference to file with list of sources and program name + (<tt>Makefile.inc</tt>), and inclusion of build system (that + rules for common build use-cases, <tt>${SRCROOT}/Makefiles/top.mak</tt>). + The rest is custom options to this particular build: options for compiler + and linker. + </p> + <p> + Another part is shared by all compilers and all OS, + <tt>Makefile.inc</tt> contains name of program and list of sources: + </p> +<pre class="ddisplay"> +# -*- makefile -*- Time-stamp: <04/05/06 18:40:56 ptr> + +PRGNAME = mt_ut +SRC_CC = unit_test.cc timespec.cc mutex_test.cc spinlock_test.cc \ + recursive_mutex.cc join.cc signal-1.cc signal-2.cc flck.cc lfs.cc +</pre> + <p> + The result of + </p> +<pre class="ddisplay"> +make +</pre> + <p> + will be compilation and linking program mt_ut in three (in case of <a href="http://stlport.sourceforge.net">STLport</a> + as STL implementation) or two (<tt>libstdc++</tt>) modes---release, debug, and STLPORT_DEBUG. + Results will be in <tt>./obj/gcc/so/mt_ut</tt>, <tt>./obj/gcc/so_g/mt_ut</tt>, <tt>./obj/gcc/so_stlg/mt_ut</tt>. + </p> + <p> + Note, that if you use <a href="http://stlport.sourceforge.net">STLport</a>, the result not depends upon <tt>libstdc++</tt>. + </p> + <p> + As illustration I add here <tt>nmake-vc6.mak</tt> for VC6 compiler + and <tt>nmake</tt>: + </p> +<pre class="ddisplay"> +# -*- Makefile -*- Time-stamp: <03/10/17 19:42:29 ptr> + +SRCROOT=..\..\.. +COMPILER_NAME=vc6 + +!include Makefile.inc + +INCLUDES=$(INCLUDES) /I "$(SRCROOT)/include" /I "$(STLPORT_INCLUDE_DIR)" /I "$(BOOST_INCLUDE_DIR)" +DEFS = $(DEFS) /D_STLP_USE_DYNAMIC_LIB + +LDSEARCH=/LIBPATH:"$(CoMT_LIB_DIR)" +LDLIBS = xmt_vc6.lib boost_test_utf_vc6s.lib +!include $(SRCROOT)/Makefiles/nmake/top.mak +</pre> + + <h2 class="lheader">Use-case: library</h2> + <p> + The same structure is for libraries, <tt>Makefile</tt>: + </p> +<pre class="ddisplay"> +# -*- Makefile -*- Time-stamp: <06/11/10 16:23:01 ptr> + +SRCROOT := ../.. + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +INCLUDES += -I$(SRCROOT)/include +</pre> + <p> + Compiler-independent part, that contain list of sources, + base name of library and it vertion (<tt>Makefile.inc</tt>): + </p> +<pre class="ddisplay"> +# -*- Makefile -*- Time-stamp: <06/11/29 01:59:50 ptr> + +LIBNAME = xmt +MAJOR = 1 +MINOR = 9 +PATCH = 3 +SRC_CC = xmt.cc thr_mgr.cc time.cc uid.cc +SRC_C = fl.c +</pre> + <p> + And again, as reference, file for <tt>VC6/nmake</tt> (<tt>nmake-vc6.mak</tt>): + </p> +<pre class="ddisplay"> +# -*- Makefile -*- Time-stamp: <03/09/28 19:14:05 ptr> + +SRCROOT=..\.. +COMPILER_NAME=vc6 + +!include Makefile.inc + +DEFS = /D_STLP_USE_DYNAMIC_LIB +INCLUDES=$(INCLUDES) /I "$(SRCROOT)/include" /I "$(STLPORT_INCLUDE_DIR)" +OPT_STLDBG = /Zm800 +LDSEARCH=$(LDSEARCH) /LIBPATH:$(STLPORT_LIB_DIR) + +!include $(SRCROOT)/Makefiles/nmake/top.mak +</pre> + + <h2 class="lheader">Global settings: configure again?</h2> +<pre class="ddisplay"> +</pre> + <center> + <a href="MakeConfig.shtml">Next >></a> + </center> + +</div> +<!--#include file="foot.shtml" --> +<!-- Created: Mon Oct 7 16:33:17 MSD 2002 --> + </body> +</html> + Modified: trunk/WWW/explore/Complement/MakeTags.shtml =================================================================== --- trunk/WWW/explore/Complement/MakeTags.shtml 2006-12-27 12:17:36 UTC (rev 1464) +++ trunk/WWW/explore/Complement/MakeTags.shtml 2006-12-28 10:04:20 UTC (rev 1465) @@ -1,6 +1,6 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<!-- Time-stamp: <03/10/07 15:50:35 ptr> --> +<!-- Time-stamp: <06/12/08 01:38:20 ptr> --> <html> <head> @@ -17,117 +17,63 @@ <img src="img/jpg/apropos.jpg"> </div> <div class="main"> - <h2 class="lheader">Make versions</h2> - <p> - I stop on support on two make variants. Well, really on single - GNU Make - and one naive utility (nmake). - </p> - - <p> - GNU Make is everyware (or can be - everyware) in *NIX world. So I don't have stimulus to play with - another make incarnations (for example, BSD make is very nice, - but GNU Make more common). If GNU Make is present, I expect that - other POSIX utilities (sed, awk, sh, grep, cat, test, ... ) - present too. - </p> - - <p> - To play with compilers from one Redmond's company, you may - use nmake. The makefiles less attached to absolute paths, - and really may be moved from one box to another, in contrast - to MS's project files. Even more, VS's projects are castrated makefiles - that processed by nmake; this process screened by GUI from users. - Nmake is really restricted, and system based on it has less - features and power then GNU make-based. But it work too. - </p> - - <h2 class="lheader">Use-case: application</h2> - -<pre class="ddisplay"> -# -*- Makefile -*- Time-stamp: <06/08/04 10:54:19 ptr> - -SRCROOT := ../../.. -COMPILER_NAME := gcc - -include Makefile.inc -include ${SRCROOT}/Makefiles/top.mak - - -INCLUDES += -I$(SRCROOT)/include -I$(BOOST_INCLUDE_DIR) - -release-shared : LDLIBS = -lxmt -lboost_test_utf -stldbg-shared : LDLIBS = -lxmtstlg -lboost_test_utfstlg -dbg-shared : LDLIBS = -lxmtg -lboost_test_utfg -</pre> - -<pre class="ddisplay"> -# -*- makefile -*- Time-stamp: <04/05/06 18:40:56 ptr> - -PRGNAME = mt_ut -SRC_CC = unit_test.cc timespec.cc mutex_test.cc spinlock_test.cc \ - recursive_mutex.cc join.cc signal-1.cc signal-2.cc flck.cc lfs.cc -</pre> - -<pre class="ddisplay"> -# -*- Makefile -*- Time-stamp: <03/10/17 19:42:29 ptr> - -SRCROOT=..\..\.. -COMPILER_NAME=vc6 - -!include Makefile.inc - -INCLUDES=$(INCLUDES) /I "$(SRCROOT)/include" /I "$(STLPORT_INCLUDE_DIR)" /I "$(BOOST_INCLUDE_DIR)" -DEFS = $(DEFS) /D_STLP_USE_DYNAMIC_LIB - -LDSEARCH=/LIBPATH:"$(CoMT_LIB_DIR)" -LDLIBS = xmt_vc6.lib boost_test_utf_vc6s.lib -!include $(SRCROOT)/Makefiles/nmake/top.mak -</pre> - - <h2 class="lheader">Use-case: library</h2> - -<pre class="ddisplay"> -# -*- Makefile -*- Time-stamp: <06/11/10 16:23:01 ptr> - -SRCROOT := ../.. - -include Makefile.inc -include ${SRCROOT}/Makefiles/top.mak - -INCLUDES += -I$(SRCROOT)/include -</pre> - -<pre class="ddisplay"> -# -*- Makefile -*- Time-stamp: <06/11/29 01:59:50 ptr> - -LIBNAME = xmt -MAJOR = 1 -MINOR = 9 -PATCH = 3 -SRC_CC = xmt.cc thr_mgr.cc time.cc uid.cc -SRC_C = fl.c -</pre> - -<pre class="ddisplay"> -# -*- Makefile -*- Time-stamp: <03/09/28 19:14:05 ptr> - -SRCROOT=..\.. -COMPILER_NAME=vc6 - -!include Makefile.inc - -DEFS = /D_STLP_USE_DYNAMIC_LIB -INCLUDES=$(INCLUDES) /I "$(SRCROOT)/include" /I "$(STLPORT_INCLUDE_DIR)" -OPT_STLDBG = /Zm800 -LDSEARCH=$(LDSEARCH) /LIBPATH:$(STLPORT_LIB_DIR) - -!include $(SRCROOT)/Makefiles/nmake/top.mak -</pre> - - <h2 class="lheader">Global settings: configure again?</h2> <h2 class="lheader">Build tags</h2> + <dl> + <dt>all</dt> + <dd>Deafult tag; build release-shared, dbg-shared, stlport-debug (if applicable) tags</dd> + <dt>install</dt> + <dd>install-release-shared, install-dbg-shared, install-stldbg-shared (if applicable) variants</dd> + <dt>release-shared</dt> + <dd>Build optimized application with (link with dynamic libraries) or dynamic library; no debug information. Result will be in OUTPUT_DIR (./obj/gcc/so for gcc compilers family, if not overridden)</dd> + <dt>dbg-shared</dt> + <dd>Build application with (link with dynamic libraries) or dynamic library without optimization, but with debug information. Result will be in OUTPUT_DIR_DBG (./obj/gcc/so_g for gcc compilers family, if not overridden)</dd> + <dt>stldbg-shared</dt> + <dd>Build application with (link with dynamic libraries) or dynamic library without optimization, but with debug information and with special STL debug mode turned on (<a href="http://stlport.sourceforge.net">STLport</a>). Result will be in OUTPUT_DIR_STLDBG (./obj/gcc/so_stlg for gcc compilers family, if not overridden)</dd> + <dt>release-static</dt> + <dd>Build optimized application with (link mostly with static libraries) or static library; no debug information. Result will be in OUTPUT_DIR_A (./obj/gcc/so for gcc compilers family, if not overridden)</dd> + <dt>dbg-static</dt> + <dd>Build application with (link mostly with static libraries) or static library without optimization, but with debug information. Result will be in OUTPUT_DIR_DBG_A (./obj/gcc/so_g for gcc compilers family, if not overridden)</dd> + <dt>stldbg-static</dt> + <dd>Build application with (link mostly with static libraries) or static library without optimization, but with debug information and with special STL debug mode turned on (<a href="http://stlport.sourceforge.net">STLport</a>). Result will be in OUTPUT_DIR_STLDBG_A (./obj/gcc/so_stlg for gcc compilers family, if not overridden)</dd> + <dt>install-release-shared</dt> + <dd>Build release-shared tag; install resulting program(s) or dynamic library(s) into place INSTALL_BIN_DIR or INSTALL_LIB_DIR</dd> + <dt>install-dbg-shared</dt> + <dd>Build dbg-shared tag; install resulting program(s) or dynamic library(s) into place INSTALL_BIN_DIR or INSTALL_LIB_DIR_DBG</dd> + <dt>install-stldbg-shared</dt> + <dd>Build stldbg-shared tag; install resulting program(s) or dynamic library(s) into place INSTALL_BIN_DIR or INSTALL_LIB_DIR_STLDBG</dd> + <dt>install-release-static</dt> + <dd>Build release-shared tag; install resulting program(s) or static library(s) into place INSTALL_BIN_DIR or INSTALL_LIB_DIR</dd> + <dt>install-dbg-static</dt> + <dd>Build dbg-shared tag; install resulting program(s) or static library(s) into place INSTALL_BIN_DIR or INSTALL_LIB_DIR_DBG</dd> + <dt>install-stldbg-static</dt> + <dd>Build stldbg-shared tag; install resulting program(s) or static library(s) into place INSTALL_BIN_DIR or INSTALL_LIB_DIR_STLDBG</dd> + <dt>depend</dt> + <dd>Calculate compilation dependences (C, C++, etc.) for release, dbg, stldbg modes; note, that dependencies calculated separately from compilation process, but use the same options and same compilers as regular compilation.</dd> + <dt>clean</dt> + <dd>Delete object files, intermediate depenedency files that are created by building the program. However, don't delete the files that record the configuration. Also preserve dependencies file, tags files and resulting program or library.</dd> + <dt>distclean</dt> + <dd>Same as 'clean' plus delete resulting program(s) or libraie(s) files, dependencies file and directories that used for compilation and linking (directories should be empty at this stage). `make distclean' should leave only the files that were in the distribution.</dd> + <dt>mostlyclean</dt> + <dd>Like `clean', but may refrain from deleting a few files that people normally don't want to recompile.</dd> + <dt>maintainer-clean</dt> + <dd>Delete almost everything that can be reconstructed with this Makefile. This includes everything deleted by distclean, plus more: C source files produced by Bison, tags tables, Info files, and so on.</dd> + <dt>uninstall</dt> + <dd></dd> + <dt>install-strip</dt> + <dd></dd> + <dt>TAGS</dt> + <dd></dd> + <dt>tags</dt> + <dd></dd> + <dt>dist</dt> + <dd></dd> + <dt>check</dt> + <dd></dd> + <dt>installcheck</dt> + <dd></dd> + <dt>installdirs</dt> + <dd></dd> + </dl> <pre class="ddisplay"> </pre> Added: trunk/WWW/explore/Complement/img/fig/boiler-comp.fig =================================================================== --- trunk/WWW/explore/Complement/img/fig/boiler-comp.fig (rev 0) +++ trunk/WWW/explore/Complement/img/fig/boiler-comp.fig 2006-12-28 10:04:20 UTC (rev 1465) @@ -0,0 +1,86 @@ +#FIG 3.2 Produced by xfig version 3.2.5-alpha5 +Landscape +Center +Inches +Letter +100.00 +Single +-2 +1200 2 +6 1875 600 3225 1200 +1 1 0 1 0 7 50 -1 -1 0.000 1 0.0000 2550 900 675 300 2550 900 3225 1200 +4 1 0 50 -1 20 12 0.0000 4 165 1080 2550 975 Power Supply\001 +-6 +6 150 1575 1650 2175 +1 1 0 1 0 7 50 -1 -1 0.000 1 0.0000 900 1875 750 300 900 1875 1650 2175 +4 1 0 50 -1 20 12 0.0000 4 135 1350 900 1950 Controller Unit\001 +-6 +6 1950 1650 2850 2250 +1 1 0 1 0 7 50 -1 -1 0.000 1 0.0000 2400 1950 450 300 2400 1950 2850 2250 +4 1 0 50 -1 20 12 0.0000 4 135 630 2400 2025 Sensors\001 +-6 +6 1800 3750 2850 4800 +1 3 0 1 0 7 50 -1 -1 0.000 1 0.0000 2325 4275 480 480 2325 4275 2700 4575 +4 1 0 50 -1 20 12 0.0000 4 135 360 2325 4350 Tank\001 +-6 +6 2700 2250 4200 2850 +1 1 0 1 0 7 50 -1 -1 0.000 1 0.0000 3450 2550 750 300 3450 2550 4200 2850 +4 1 0 50 -1 20 12 0.0000 4 135 1260 3450 2625 Termo Elements\001 +-6 +6 3225 4500 3975 4950 +1 1 0 1 0 7 50 -1 -1 0.000 1 0.0000 3600 4725 375 225 3600 4725 3975 4950 +4 1 0 50 -1 20 12 0.0000 4 135 450 3600 4800 Valve\001 +-6 +6 3375 3750 4125 4200 +1 1 0 1 0 7 50 -1 -1 0.000 1 0.0000 3750 3975 375 225 3750 3975 4125 4200 +4 1 0 50 -1 20 12 0.0000 4 135 450 3750 4050 Valve\001 +-6 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 2700 4500 3225 4725 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 3375 3975 2775 4125 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 2775 1200 3150 2250 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 2400 1200 2400 1650 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 3975 4725 5100 4725 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 1875 975 900 1575 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 1275 1650 2100 1125 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 1950 1950 1650 1875 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 2550 225 2550 600 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 2400 2250 2325 3825 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 3075 2850 2475 3900 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 5100 3975 4125 3975 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 3 + 0 0 1.00 60.00 120.00 + 3000 1125 4575 2325 3825 3750 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 4 + 0 0 1.00 60.00 120.00 + 3225 900 5400 2250 5400 4200 3825 4575 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 825 2850 825 2175 +4 0 0 50 -1 20 12 0.0000 4 165 810 2625 375 Line (AC)\001 +4 0 0 50 -1 20 12 0.0000 4 135 900 4275 3750 Cold water\001 +4 0 0 50 -1 20 12 0.0000 4 135 810 4125 5025 Hot water\001 +4 0 0 50 -1 20 12 0.0000 4 135 1260 900 3075 Control Action\001 Added: trunk/WWW/explore/Complement/img/fig/boiler-comp.png =================================================================== (Binary files differ) Property changes on: trunk/WWW/explore/Complement/img/fig/boiler-comp.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/WWW/explore/Complement/img/fig/boiler-general.fig =================================================================== --- trunk/WWW/explore/Complement/img/fig/boiler-general.fig (rev 0) +++ trunk/WWW/explore/Complement/img/fig/boiler-general.fig 2006-12-28 10:04:20 UTC (rev 1465) @@ -0,0 +1,39 @@ +#FIG 3.2 Produced by xfig version 3.2.5-alpha5 +Landscape +Center +Inches +Letter +100.00 +Single +-2 +1200 2 +1 3 0 1 0 7 50 -1 -1 0.000 1 0.0000 2025 2100 855 855 2025 2100 2550 1425 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 1950 525 1950 1275 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 3675 1125 2775 1650 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 2700 2625 3750 3300 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 225 2175 1125 2175 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 450 3375 1350 2700 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 600 975 1350 1575 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 2025 3000 2025 3450 +4 1 0 50 -1 20 12 0.0000 4 135 540 2025 2175 Boiler\001 +4 0 0 50 -1 20 12 0.0000 4 165 810 2100 450 Line (AC)\001 +4 0 0 50 -1 20 12 0.0000 4 135 900 3825 1200 Cold water\001 +4 0 0 50 -1 20 12 0.0000 4 135 810 3825 3075 Hot water\001 +4 0 0 50 -1 20 12 0.0000 4 135 720 675 3375 Turn off\001 +4 0 0 50 -1 20 12 0.0000 4 135 630 150 2475 Turn on\001 +4 0 0 50 -1 20 12 0.0000 4 135 1260 2175 3375 Visual control\001 +4 0 0 50 -1 20 12 0.0000 4 165 1800 150 825 Operational settings\001 Added: trunk/WWW/explore/Complement/img/fig/boiler-general.png =================================================================== (Binary files differ) Property changes on: trunk/WWW/explore/Complement/img/fig/boiler-general.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/WWW/explore/Complement/img/fig/sensors-lifecycle.fig =================================================================== --- trunk/WWW/explore/Complement/img/fig/sensors-lifecycle.fig (rev 0) +++ trunk/WWW/explore/Complement/img/fig/sensors-lifecycle.fig 2006-12-28 10:04:20 UTC (rev 1465) @@ -0,0 +1,133 @@ +#FIG 3.2 Produced by xfig version 3.2.5-alpha5 +Landscape +Center +Inches +Letter +100.00 +Single +-2 +1200 2 +1 1 0 1 0 7 50 -1 -1 0.000 1 0.0000 1275 1200 825 450 1275 1200 2100 1650 +1 1 0 1 0 7 50 -1 -1 0.000 1 0.0000 4500 3675 825 450 4500 3675 5325 4125 +1 1 0 1 0 7 50 -1 -1 0.000 1 0.0000 1050 3600 825 450 1050 3600 1875 4050 +1 1 0 1 0 7 50 -1 -1 0.000 1 0.0000 4425 1125 825 450 4425 1125 5250 1575 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 1200 300 1650 825 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 5550 2850 5025 3375 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 5100 3975 5550 4575 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 4425 5100 4425 4125 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 2100 2775 1575 3300 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 1650 3900 2100 4500 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 675 5175 975 4050 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 5475 300 4950 825 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 5025 1425 5475 2025 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 4650 2175 4350 1575 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 4725 4125 4950 4725 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 1200 4050 1575 4725 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 5250 1125 5775 1275 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 5325 3750 5850 3975 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 1800 3750 2250 3975 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 5175 900 5850 675 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 5250 3525 5925 3375 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 1875 3675 2400 3525 +3 2 0 1 0 7 50 -1 -1 0.000 0 1 0 3 + 0 0 1.00 60.00 120.00 + 1650 750 2925 525 4425 675 + 0.000 -1.000 0.000 +3 2 0 1 0 7 50 -1 -1 0.000 0 1 0 3 + 0 0 1.00 60.00 120.00 + 4425 1575 2925 1875 1800 1575 + 0.000 -1.000 0.000 +3 2 0 1 0 7 50 -1 -1 0.000 0 1 0 3 + 0 0 1.00 60.00 120.00 + 4425 4125 3375 4350 1500 1650 + 0.000 -1.000 0.000 +3 2 0 1 0 7 50 -1 -1 0.000 0 1 0 3 + 0 0 1.00 60.00 120.00 + 1650 750 3075 1200 4500 3225 + 0.000 -1.000 0.000 +3 2 0 1 0 7 50 -1 -1 0.000 0 1 0 3 + 0 0 1.00 60.00 120.00 + 1650 750 2625 1350 1350 3225 + 0.000 -1.000 0.000 +3 2 0 1 0 7 50 -1 -1 0.000 0 1 0 3 + 0 0 1.00 60.00 120.00 + 3900 1500 3525 2625 3675 3600 + 0.000 -1.000 0.000 +3 2 0 1 0 7 50 -1 -1 0.000 0 1 0 3 + 0 0 1.00 60.00 120.00 + 3750 1425 3075 2700 1875 3600 + 0.000 -1.000 0.000 +3 2 0 1 0 7 50 -1 -1 0.000 0 1 0 3 + 0 0 1.00 60.00 120.00 + 3900 3375 3825 2550 4050 1500 + 0.000 -1.000 0.000 +3 2 0 1 0 7 50 -1 -1 0.000 0 1 0 3 + 0 0 1.00 60.00 120.00 + 1875 3450 3000 2175 3675 1350 + 0.000 -1.000 0.000 +3 2 0 1 0 7 50 -1 -1 0.000 0 1 0 4 + 0 0 1.00 60.00 120.00 + 975 4050 375 4275 150 3075 1050 1650 + 0.000 -1.000 -1.000 0.000 +4 0 0 50 -1 20 12 0.0000 4 135 720 1425 300 Power On\001 +4 0 0 50 -1 20 12 0.0000 4 165 990 5625 4425 Temperature\001 +4 0 0 50 -1 20 12 0.0000 4 165 990 2175 4350 Temperature\001 +4 0 0 50 -1 20 12 0.0000 4 165 990 5550 1875 Temperature\001 +4 0 0 50 -1 20 12 0.0000 4 135 810 4500 2400 Power Off\001 +4 0 0 50 -1 20 12 0.0000 4 135 450 1950 2775 Power\001 +4 0 0 50 -1 20 12 0.0000 4 135 450 5475 2775 Power\001 +4 0 0 50 -1 20 12 0.0000 4 135 450 5400 225 Power\001 +4 0 0 50 -1 20 12 0.0000 4 135 630 2250 3825 Presure\001 +4 0 0 50 -1 20 12 0.0000 4 135 720 5925 3825 Pressure\001 +4 0 0 50 -1 20 12 0.0000 4 135 720 5775 1050 Pressure\001 +4 1 0 50 -1 20 12 0.0000 4 135 630 1275 1050 Sensors\001 +4 1 0 50 -1 20 12 0.0000 4 135 720 1275 1350 No Power\001 +4 1 0 50 -1 20 12 0.0000 4 135 630 4425 975 Sensors\001 +4 1 0 50 -1 20 12 0.0000 4 135 540 4425 1275 Normal\001 +4 1 0 50 -1 20 12 0.0000 4 135 630 4500 3525 Sensors\001 +4 1 0 50 -1 20 12 0.0000 4 135 1350 4500 3825 Low Water Alarm\001 +4 1 0 50 -1 20 12 0.0000 4 135 630 1050 3450 Sensors\001 +4 1 0 50 -1 20 12 0.0000 4 165 1440 1050 3750 High Water Alarm\001 +4 0 0 50 -1 20 12 0.0000 4 135 990 5700 3225 Water Level\001 +4 0 0 50 -1 20 12 0.0000 4 135 990 5625 525 Water Level\001 +4 0 0 50 -1 20 12 0.0000 4 135 990 2475 3450 Water Level\001 +4 0 0 50 -1 20 12 0.0000 4 165 1440 4950 4875 Low Water Signal\001 +4 0 0 50 -1 20 12 0.0000 4 135 810 4425 5325 Power Off\001 +4 0 0 50 -1 20 12 0.0000 4 135 810 750 5250 Power Off\001 +4 0 0 50 -1 20 12 0.0000 4 165 1530 1650 4800 High Water Signal\001 Added: trunk/WWW/explore/Complement/img/fig/sensors-lifecycle.png =================================================================== (Binary files differ) Property changes on: trunk/WWW/explore/Complement/img/fig/sensors-lifecycle.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/WWW/explore/Complement/img/fig/termo.fig =================================================================== --- trunk/WWW/explore/Complement/img/fig/termo.fig (rev 0) +++ trunk/WWW/explore/Complement/img/fig/termo.fig 2006-12-28 10:04:20 UTC (rev 1465) @@ -0,0 +1,17 @@ +#FIG 3.2 Produced by xfig version 3.2.5-alpha5 +Landscape +Center +Inches +Letter +100.00 +Single +-2 +1200 2 +1 1 0 1 0 7 50 -1 -1 0.000 1 0.0000 1500 1350 1050 600 1500 1350 2550 1950 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 1 + 2700 1350 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 1500 300 1500 750 +4 1 0 50 -1 20 12 0.0000 4 135 1260 1575 1425 Termo Elements\001 +4 0 0 50 -1 20 12 0.0000 4 150 1080 1650 450 Power 0..100\001 Added: trunk/WWW/explore/Complement/img/fig/termo.png =================================================================== (Binary files differ) Property changes on: trunk/WWW/explore/Complement/img/fig/termo.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/WWW/explore/Complement/img/fig/valve-lifecycle.fig =================================================================== --- trunk/WWW/explore/Complement/img/fig/valve-lifecycle.fig (rev 0) +++ trunk/WWW/explore/Complement/img/fig/valve-lifecycle.fig 2006-12-28 10:04:20 UTC (rev 1465) @@ -0,0 +1,43 @@ +#FIG 3.2 Produced by xfig version 3.2.5-alpha5 +Landscape +Center +Inches +Letter +100.00 +Single +-2 +1200 2 +1 1 0 1 0 7 50 -1 -1 0.000 1 0.0000 2025 1425 675 300 2025 1425 2700 1725 +1 1 0 1 0 7 50 -1 -1 0.000 1 0.0000 4200 1425 675 300 4200 1425 4875 1725 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 1350 600 2025 1125 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 5025 2250 4125 1725 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 975 2400 1575 1650 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 1350 1425 450 1425 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 5100 525 4425 1125 +3 2 0 1 0 7 50 -1 -1 0.000 0 1 0 3 + 0 0 1.00 60.00 120.00 + 2025 1125 3075 825 4125 1125 + 0.000 -1.000 0.000 +3 2 0 1 0 7 50 -1 -1 0.000 0 1 0 3 + 0 0 1.00 60.00 120.00 + 4125 1725 3075 2100 2025 1725 + 0.000 -1.000 0.000 +4 1 0 50 -1 20 12 0.0000 4 165 540 2025 1575 opened\001 +4 1 0 50 -1 20 12 0.0000 4 135 450 2025 1350 Valve\001 +4 1 0 50 -1 20 12 0.0000 4 135 540 4200 1575 closed\001 +4 1 0 50 -1 20 12 0.0000 4 135 450 4200 1350 Valve\001 +4 1 0 50 -1 20 12 0.0000 4 135 720 5100 2475 Power On\001 +4 1 0 50 -1 20 12 0.0000 4 135 810 1350 525 Power off\001 +4 1 0 50 -1 20 12 0.0000 4 135 720 975 2625 Water In\001 +4 1 0 50 -1 20 12 0.0000 4 135 720 5100 450 Water In\001 +4 0 0 50 -1 20 12 0.0000 4 135 810 375 1275 Water Out\001 Added: trunk/WWW/explore/Complement/img/fig/valve-lifecycle.png =================================================================== (Binary files differ) Property changes on: trunk/WWW/explore/Complement/img/fig/valve-lifecycle.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/WWW/explore/Complement/main.css =================================================================== --- trunk/WWW/explore/Complement/main.css 2006-12-27 12:17:36 UTC (rev 1464) +++ trunk/WWW/explore/Complement/main.css 2006-12-28 10:04:20 UTC (rev 1465) @@ -170,10 +170,10 @@ pre.ddisplay { font-family: Courier; font-size: 8pt; - background: grey90; - color: green; + background: gray90; + color: #070; padding-top: 10px; padding-left: 10px; padding-right: 10px; padding-bottom: 10px; -} \ No newline at end of file +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2006-12-27 12:17:39
|
Revision: 1464 http://svn.sourceforge.net/complement/?rev=1464&view=rev Author: complement Date: 2006-12-27 04:17:36 -0800 (Wed, 27 Dec 2006) Log Message: ----------- minimal allocation unit is sizeof(_fheader); protection against allocation of not-ready for IPC objects Modified Paths: -------------- trunk/complement/explore/include/mt/shm.h Modified: trunk/complement/explore/include/mt/shm.h =================================================================== --- trunk/complement/explore/include/mt/shm.h 2006-12-26 16:32:32 UTC (rev 1463) +++ trunk/complement/explore/include/mt/shm.h 2006-12-27 12:17:36 UTC (rev 1464) @@ -341,7 +341,7 @@ template <int _Inst> void shm_alloc<_Inst>::deallocate( pointer p, size_type n ) { - n += (__align - n % __align) % __align; + n = max( n + (__align - n % __align) % __align, sizeof(_fheader) ); _master *m = reinterpret_cast<_master *>( _seg.address() ); if ( m != reinterpret_cast<_master *>(-1) && (reinterpret_cast<char *>(p) - reinterpret_cast<char *>(_seg.address())) < (_seg.max_size() + sizeof(_master) + sizeof(_aheader) ) ) { xmt::__Locker<xmt::__Mutex<false,true> > lk( m->_lock ); @@ -402,10 +402,10 @@ template <int _Inst> void *shm_alloc<_Inst>::_traverse( size_type *_prev, size_type n ) { - n += (__align - n % __align) % __align; + n = max( n + (__align - n % __align) % __align, sizeof(_fheader) ); for ( _fheader *h = reinterpret_cast<_fheader *>(reinterpret_cast<char *>(_seg.address()) + *_prev); *_prev != 0; _prev = &h->_next, h = reinterpret_cast<_fheader *>(reinterpret_cast<char *>(_seg.address()) + *_prev)) { - if ( h->_sz > (n + sizeof( _fheader )) ) { // reduce this free block, write new free header + if ( h->_sz >= (n + sizeof( _fheader )) ) { // reduce this free block, write new free header *_prev += n + sizeof( _aheader ); _fheader *hnew = reinterpret_cast<_fheader *>(reinterpret_cast<char *>(_seg.address()) + *_prev ); hnew->_sz = h->_sz - n - sizeof( _aheader ); @@ -431,9 +431,38 @@ template <int _Inst> detail::__shm_alloc<_Inst> shm_alloc<_Inst>::_seg; +namespace detail { + +template <class T> +class __allocator_shm +{ + private: + __allocator_shm() + { } +}; + +template <> +class __allocator_shm<std::__false_type> +{ + private: + __allocator_shm() + { } +}; + +template <> +class __allocator_shm<std::__true_type> +{ + public: + __allocator_shm() + { } +}; + +} // namespace detail + template <class _Tp, int _Inst> class allocator_shm : - public shm_alloc<_Inst> + public shm_alloc<_Inst>, + private detail::__allocator_shm<typename ipc_sharable<_Tp>::is_ipc_sharable> { public: typedef shm_alloc<_Inst> chunk_type; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2006-12-26 16:32:33
|
Revision: 1463 http://svn.sourceforge.net/complement/?rev=1463&view=rev Author: complement Date: 2006-12-26 08:32:32 -0800 (Tue, 26 Dec 2006) Log Message: ----------- check more deallocation sequences Modified Paths: -------------- trunk/complement/explore/test/mt/mt_test.cc Modified: trunk/complement/explore/test/mt/mt_test.cc =================================================================== --- trunk/complement/explore/test/mt/mt_test.cc 2006-12-26 16:13:00 UTC (rev 1462) +++ trunk/complement/explore/test/mt/mt_test.cc 2006-12-26 16:32:32 UTC (rev 1463) @@ -226,34 +226,59 @@ { xmt::allocator_shm<char,0> shmall; size_t sz = shmall.max_size(); + // two blocks char *ch1 = shmall.allocate( 3500 ); BOOST_CHECK( ch1 != 0 ); char *ch2 = shmall.allocate( 3500 ); BOOST_CHECK( ch2 != 0 ); try { + // try to allocate third block, not enough room char *ch3 = shmall.allocate( 8 * 1024 - 7000 ); BOOST_CHECK( false ); } catch ( xmt::shm_bad_alloc& err ) { BOOST_CHECK( true ); } + // free first blocks shmall.deallocate( ch1, 3500 ); ch1 = shmall.allocate( 3500 ); + // allocate [first] block again BOOST_CHECK( ch1 != 0 ); + // free second block shmall.deallocate( ch2, 3500 ); + // allocate [second] block again ch2 = shmall.allocate( 3500 ); BOOST_CHECK( ch2 != 0 ); + // free both blocks shmall.deallocate( ch1, 3500 ); shmall.deallocate( ch2, 3500 ); + // allocate big block, enough for initial memory chunk ch1 = shmall.allocate( 7000 ); BOOST_CHECK( ch1 != 0 ); + // free it shmall.deallocate( ch1, 7000 ); + // allocate block of maximum size ch1 = shmall.allocate( sz ); BOOST_CHECK( ch1 != 0 ); + // free it shmall.deallocate( ch1, sz ); + // allocate block, enough for initial memory chunk ch1 = shmall.allocate( 7000 ); BOOST_CHECK( ch1 != 0 ); + // free it shmall.deallocate( ch1, 7000 ); + ch1 = shmall.allocate( 3000 ); + BOOST_CHECK( ch1 != 0 ); + ch2 = shmall.allocate( 400 ); + BOOST_CHECK( ch2 != 0 ); + char *ch3 = shmall.allocate( 3500 ); + BOOST_CHECK( ch3 != 0 ); + shmall.deallocate( ch1, 3000 ); + shmall.deallocate( ch2, 400 ); + shmall.deallocate( ch3, 3500 ); + ch1 = shmall.allocate( sz ); + BOOST_CHECK( ch1 != 0 ); + shmall.deallocate( ch1, sz ); } seg.deallocate(); fs::remove( fname ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2006-12-26 16:13:03
|
Revision: 1462 http://svn.sourceforge.net/complement/?rev=1462&view=rev Author: complement Date: 2006-12-26 08:13:00 -0800 (Tue, 26 Dec 2006) Log Message: ----------- shared memory-based allocator; libxmt 1.9.4 Modified Paths: -------------- trunk/complement/explore/lib/mt/ChangeLog trunk/complement/explore/lib/mt/Makefile.inc trunk/complement/explore/test/mt/Makefile trunk/complement/explore/test/mt/mt_test.cc trunk/complement/explore/test/mt/mt_test.h trunk/complement/explore/test/mt/mt_test_suite.cc Added Paths: ----------- trunk/complement/explore/include/mt/shm.h trunk/complement/explore/lib/mt/shm.cc Added: trunk/complement/explore/include/mt/shm.h =================================================================== --- trunk/complement/explore/include/mt/shm.h (rev 0) +++ trunk/complement/explore/include/mt/shm.h 2006-12-26 16:13:00 UTC (rev 1462) @@ -0,0 +1,515 @@ +// -*- C++ -*- Time-stamp: <06/12/26 10:24:35 ptr> + +/* + * Copyright (c) 2006 + * Petr Ovtchenkov + * + * Licensed under the Academic Free License version 3.0 + * + */ + +#ifndef __mt_shm_h +#define __mt_shm_h + +#include <sys/ipc.h> +#include <sys/shm.h> +#include <errno.h> +#include <fcntl.h> +#include <unistd.h> +#include <stdint.h> + +#include <stdexcept> + +#include <stl/type_traits.h> + +#include <mt/xmt.h> + +namespace xmt { + +struct shm_base +{ + enum open_type { + create = IPC_CREAT, + exclusive = IPC_EXCL + }; + + enum flags_type { + round = SHM_RND, + ro = SHM_RDONLY, + }; +}; + +class shm_bad_alloc : + public std::bad_alloc +{ + public: + shm_bad_alloc() throw() : + err( errno ) + {} + shm_bad_alloc( int s ) throw() : + err( s ) + {} + shm_bad_alloc( const shm_bad_alloc& a ) throw() : + err( a.err ) + {} + shm_bad_alloc& operator =( const shm_bad_alloc& r ) throw() + { err = r.err; return *this; } + virtual ~shm_bad_alloc() throw() + {} + virtual const char *what() const throw(); + + private: + int err; +}; + +template <class T> +struct ipc_sharable +{ + typedef typename std::__type_traits<T>::is_POD_type is_ipc_sharable; +}; + +template <int _Inst> class shm_alloc; + +namespace detail { + +template <int Inst> +class __shm_alloc : + public xmt::shm_base +{ + public: + typedef void * pointer; + typedef const void * const_pointer; + typedef size_t size_type; + typedef size_t difference_type; + + __shm_alloc() throw() + { } + + __shm_alloc( const char *name, size_type sz, int o, int mode, int f = 0, void *addr = 0 ) + { allocate( name, sz, o, mode, f, addr ); } + + __shm_alloc( key_t k, size_type sz, int o, int mode, int f = 0, void *addr = 0 ) + { allocate( k, sz, o, mode, f, addr ); } + + __shm_alloc( int id, int f = 0, void *addr = 0 ) + { allocate( id, f, addr ); } + + ~__shm_alloc() throw() + { + if ( _seg != reinterpret_cast<void *>(-1) ) { + shmdt( _seg ); + _seg = reinterpret_cast<void *>(-1); + } + } + + static pointer allocate( const char *name, size_type sz, int o, int mode, int f = 0, void *addr = 0 ); + static pointer allocate( key_t k, size_type sz, int o, int mode, int f = 0, void *addr = 0 ); + static pointer allocate( int id, int f = 0, void *addr = 0 ); + + static pointer reallocate( int f = 0, void *addr = 0 ); + + static void deallocate( bool force = false ) + { + if ( _seg != reinterpret_cast<void *>(-1) ) { + shmdt( _seg ); + _seg = reinterpret_cast<void *>(-1); + } + if ( _id != -1 ) { + if ( force || (shmctl( _id, IPC_STAT, &_ds ) == 0 && _ds.shm_nattch == 0) ) { + shmctl( _id, IPC_RMID, &_ds ); + _id = -1; + } + } + } + + static pointer address() throw() + { return _seg; } + + static size_type max_size() throw() + { return _id == -1 ? 0 : _ds.shm_segsz; } + + private: + static shmid_ds _ds; + static int _id; + static void *_seg; +}; + +template <int Inst> +shmid_ds __shm_alloc<Inst>::_ds; + +template <int Inst> +int __shm_alloc<Inst>::_id = -1; + +template <int Inst> +void *__shm_alloc<Inst>::_seg = reinterpret_cast<void *>(-1); + +template <int Inst> +typename __shm_alloc<Inst>::pointer __shm_alloc<Inst>::allocate( const char *name, size_type sz, int o, int mode, int f, void *addr ) +{ + if ( _id != -1 ) { + throw shm_bad_alloc( -1 ); + } + int of = 0; + if ( o & create ) { + of |= O_CREAT; + } + if ( o & exclusive ) { + of |= O_EXCL; + } + if ( f & SHM_RDONLY ) { + of |= O_RDONLY; + } else { + of |= O_RDWR; + } + bool rmfile = true; + if ( (o & create) && !(o & exclusive) ) { + int exist_fd = open( name, of & ~O_CREAT, (0777 & mode) ); + if ( exist_fd >= 0 ) { + rmfile = false; + ::close( exist_fd ); + } + } + int fd = open( name, of, (0777 & mode) ); + if ( fd < 0 ) { + throw shm_bad_alloc(); + } + close( fd ); + key_t k = ftok( name, Inst ); + if ( k == -1 ) { + if ( (o & create) && (rmfile || (o & exclusive)) ) { + unlink( name ); + } + throw shm_bad_alloc(); + } + return allocate( k, sz, o, mode, f, addr ); +} + +template <int Inst> +typename __shm_alloc<Inst>::pointer __shm_alloc<Inst>::allocate( key_t k, size_type sz, int o, int mode, int f, void *addr ) +{ + if ( _id != -1 ) { + throw shm_bad_alloc( -1 ); + } + + static const size_type psz = getpagesize(); + + _id = shmget( k, ((sz + sizeof(typename shm_alloc<Inst>::_master) + sizeof(typename shm_alloc<Inst>::_aheader) )/ psz + 1) * psz, o | (0777 & mode) ); + if ( _id == -1 ) { + throw shm_bad_alloc(); + } + if ( shmctl( _id, IPC_STAT, &_ds ) == -1 ) { + throw shm_bad_alloc(); + } + _seg = shmat( _id, addr, f ); + if ( _seg == reinterpret_cast<void *>(-1) ) { + if ( (o & create) && (o & exclusive) ) { + shmctl( _id, IPC_RMID, &_ds ); + } + throw shm_bad_alloc(); + } + + return _seg; +} + +template <int Inst> +typename __shm_alloc<Inst>::pointer __shm_alloc<Inst>::allocate( int id, int f, void *addr ) +{ + if ( _id != -1 ) { + throw shm_bad_alloc( -1 ); + } + if ( shmctl( id, IPC_STAT, &_ds ) == -1 ) { + throw shm_bad_alloc(); + } + _id = id; + _seg = shmat( _id, addr, f ); + if ( _seg == reinterpret_cast<void *>(-1) ) { + throw shm_bad_alloc(); + } + + return _seg; +} + +template <int Inst> +typename __shm_alloc<Inst>::pointer __shm_alloc<Inst>::reallocate( int f, void *addr ) +{ + if ( _id == -1 ) { + throw shm_bad_alloc( -1 ); + } + if ( shmctl( _id, IPC_STAT, &_ds ) == -1 ) { + throw shm_bad_alloc(); + } + _seg = shmat( _id, addr, f ); + if ( _seg == reinterpret_cast<void *>(-1) ) { + throw shm_bad_alloc(); + } + + return _seg; +} + +} // detail + +template <int _Inst> +class shm_alloc +{ + protected: + typedef void * pointer; + typedef const void * const_pointer; + typedef typename detail::__shm_alloc<_Inst>::size_type size_type; + + struct _master + { + uint64_t _magic; + size_type _first; + xmt::__Mutex<false,true> _lock; + }; + + struct _fheader + { + size_type _sz; + size_type _next; + }; + + struct _aheader + { + size_type _sz; + }; + + enum { + __align = sizeof(int) + }; + + + public: + static void allocate( const char *name, size_type sz, int o, int mode, int f = 0, void *addr = 0 ) + { + _master *m = reinterpret_cast<_master *>( _seg.allocate( name, sz, o, mode, f, addr ) ); + if ( m->_magic != MAGIC ) { + init( *m ); + } + } + + static void allocate( key_t k, size_type sz, int o, int mode, int f = 0, void *addr = 0 ) + { + _master *m = reinterpret_cast<_master *>( _seg.allocate( k, sz, o, mode, f, addr ) ); + if ( m->_magic != MAGIC ) { + init( *m ); + } + } + + static void deallocate( bool force = false ) + { _seg.deallocate( force ); } + + size_type max_size() const throw() + { return _seg.max_size() == 0 ? 0 : (_seg.max_size() - sizeof(_master) - sizeof(_aheader)); } + + protected: + static void *allocate( size_type n, void *hint = 0 ) + { + _master *m = reinterpret_cast<_master *>( _seg.address() ); + if ( m != reinterpret_cast<_master *>(-1) ) { + xmt::__Locker<xmt::__Mutex<false,true> > lk( m->_lock ); + return _traverse( &m->_first, n ); + } + + throw shm_bad_alloc( -2 ); + + return 0; + } + + static void deallocate( pointer p, size_type n ); + static void *_traverse( size_type *_prev, size_type n ); + + private: + static void init( _master& m ) + { + m._magic = MAGIC; + new ( &m._lock ) xmt::__Mutex<false,true>(); + xmt::__Locker<xmt::__Mutex<false,true> > lk( m._lock ); + m._first = sizeof( _master ); + _fheader& h = *new ( reinterpret_cast<char *>(&m) + sizeof(_master) ) _fheader(); + h._next = 0; + h._sz = _seg.max_size() - sizeof( _master ) - sizeof( _aheader ); + } + + private: + static const uint64_t MAGIC; + static detail::__shm_alloc<_Inst> _seg; + + friend class detail::__shm_alloc<_Inst>; +}; + +template <int _Inst> +void shm_alloc<_Inst>::deallocate( pointer p, size_type n ) +{ + n += (__align - n % __align) % __align; + _master *m = reinterpret_cast<_master *>( _seg.address() ); + if ( m != reinterpret_cast<_master *>(-1) && (reinterpret_cast<char *>(p) - reinterpret_cast<char *>(_seg.address())) < (_seg.max_size() + sizeof(_master) + sizeof(_aheader) ) ) { + xmt::__Locker<xmt::__Mutex<false,true> > lk( m->_lock ); + _aheader *a = reinterpret_cast<_aheader *>( reinterpret_cast<char *>(p) - sizeof(_aheader) ); + size_type off = reinterpret_cast<char *>(p) - reinterpret_cast<char *>(_seg.address()); + if ( m->_first == 0 ) { + m->_first = off - sizeof(_aheader); + reinterpret_cast<_fheader *>(a)->_next = 0; + } else { + _fheader *h; + for ( h = reinterpret_cast<_fheader *>(reinterpret_cast<char *>(_seg.address()) + m->_first); h->_next != 0; + h = reinterpret_cast<_fheader *>(reinterpret_cast<char *>(_seg.address()) + h->_next) ) { + if ( h->_next < off ) { // the case h->_next == off is illegal, due to shift on sizeof(_aheader) + continue; + } + if ( reinterpret_cast<char *>(&h->_next) + h->_sz + sizeof(_aheader) == p ) { // attach to prev block + if ( h->_next == (off + a->_sz) ) { // glue with following free block + _fheader *nextheader = reinterpret_cast<_fheader *>(reinterpret_cast<char *>(_seg.address()) + h->_next); + h->_sz += a->_sz + sizeof(_aheader) * 2 + nextheader->_sz; + h->_next = nextheader->_next; + } else { + h->_sz += a->_sz + sizeof(_aheader); + } + } else if ( h->_next == (off + a->_sz) ) { // glue with following free block + _fheader *nextheader = reinterpret_cast<_fheader *>(reinterpret_cast<char *>(_seg.address()) + h->_next); + reinterpret_cast<_fheader *>(a)->_next = nextheader->_next; + reinterpret_cast<_fheader *>(a)->_sz += sizeof(_aheader) + nextheader->_sz; + } else { + reinterpret_cast<_fheader *>(a)->_next = h->_next; + h->_next = off - sizeof(_aheader); + } + return; + } + // before first free block or after last free block + // Note, that list of free blocks not empty here! + if ( off > (reinterpret_cast<char *>(h) - reinterpret_cast<char *>(_seg.address())) ) { // become last free block + if ( reinterpret_cast<pointer>(reinterpret_cast<char *>(h) + sizeof(_aheader) * 2 + h->_sz) == p ) { + // glue with last free block + h->_sz += a->_sz + sizeof(_aheader); + } else { + h->_next = off - sizeof(_aheader); + reinterpret_cast<_fheader *>(a)->_next = 0; + } + } else { // become first free block + if ( m->_first == off + a->_sz ) { // glue with next free block + _fheader *nextheader = reinterpret_cast<_fheader *>(reinterpret_cast<char *>(_seg.address()) + m->_first); + reinterpret_cast<_fheader *>(a)->_next = nextheader->_next; + reinterpret_cast<_fheader *>(a)->_sz += sizeof(_aheader) + nextheader->_sz; + } else { // link to next free block + reinterpret_cast<_fheader *>(a)->_next = m->_first; + } + m->_first = off - sizeof(_aheader); + } + } + } +} + +template <int _Inst> +void *shm_alloc<_Inst>::_traverse( size_type *_prev, size_type n ) +{ + n += (__align - n % __align) % __align; + for ( _fheader *h = reinterpret_cast<_fheader *>(reinterpret_cast<char *>(_seg.address()) + *_prev); *_prev != 0; + _prev = &h->_next, h = reinterpret_cast<_fheader *>(reinterpret_cast<char *>(_seg.address()) + *_prev)) { + if ( h->_sz > (n + sizeof( _fheader )) ) { // reduce this free block, write new free header + *_prev += n + sizeof( _aheader ); + _fheader *hnew = reinterpret_cast<_fheader *>(reinterpret_cast<char *>(_seg.address()) + *_prev ); + hnew->_sz = h->_sz - n - sizeof( _aheader ); + hnew->_next = h->_next; + reinterpret_cast<_aheader *>(h)->_sz = n; + return reinterpret_cast<void *>(reinterpret_cast<char *>(h) + sizeof( _aheader )); + } else if ( h->_sz >= n ) { // this block is too small to split it; use it in whole + *_prev = h->_next; + reinterpret_cast<_aheader *>(h)->_sz = h->_sz; + return reinterpret_cast<void *>(reinterpret_cast<char *>(h) + sizeof( _aheader )); + } + } + + throw shm_bad_alloc( -3 ); + + return 0; +} + + +template <int _Inst> +const uint64_t shm_alloc<_Inst>::MAGIC = 0xaa99665500000000ULL + _Inst; + +template <int _Inst> +detail::__shm_alloc<_Inst> shm_alloc<_Inst>::_seg; + +template <class _Tp, int _Inst> +class allocator_shm : + public shm_alloc<_Inst> +{ + public: + typedef shm_alloc<_Inst> chunk_type; + typedef _Tp value_type; + typedef _Tp* pointer; + typedef const _Tp* const_pointer; + typedef _Tp& reference; + typedef const _Tp& const_reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + + template <class _Tp1, int _Inst1> + struct rebind + { + typedef allocator_shm<_Tp1, _Inst1> other; + }; + + allocator_shm() throw() + {} + + template <class _Tp1, int _Inst1> + allocator_shm(const allocator_shm<_Tp1, _Inst1>&) throw() + {} + + allocator_shm(const allocator_shm<_Tp,_Inst>&) throw() + {} + + // allocator_shm(__move_source<allocator_shm<_Tp> > src) throw() + // {} + + ~allocator_shm() throw() + {} + + pointer address(reference __x) const + {return &__x;} + + const_pointer address(const_reference __x) const + { return &__x; } + + // __n is permitted to be 0. The C++ standard says nothing about what the return value is when __n == 0. + _Tp* allocate( size_type __n, const void* = 0 ) + { + if ( __n > max_size() ) { + throw shm_bad_alloc(); + } + if ( __n != 0 ) { + return reinterpret_cast<_Tp *>( chunk_type::allocate( __n * sizeof(value_type) ) ); + } + return 0; + } + // __p is permitted to be a null pointer, only if n==0. + void deallocate( pointer __p, size_type __n ) + { + if ( __p != 0 ) { + chunk_type::deallocate( __p, __n * sizeof(value_type) ); + } + } + // backwards compatibility + void deallocate( pointer __p ) const + { + if ( __p != 0 ) { + chunk_type::deallocate( __p, sizeof(value_type) ); + } + } + + size_type max_size() const throw() + { return chunk_type::max_size() / sizeof(value_type); } + + void construct(pointer __p, const_reference __val) + { _STLP_STD::_Copy_Construct(__p, __val); } + + void destroy(pointer __p) + { _STLP_STD::_Destroy(__p); } + +}; + +} // namespace xmt + +#endif // __mt_shm_h Modified: trunk/complement/explore/lib/mt/ChangeLog =================================================================== --- trunk/complement/explore/lib/mt/ChangeLog 2006-12-18 17:29:25 UTC (rev 1461) +++ trunk/complement/explore/lib/mt/ChangeLog 2006-12-26 16:13:00 UTC (rev 1462) @@ -1,3 +1,9 @@ +2006-12-26 Petr Ovtchenkov <pt...@is...> + + * shm.h, shm.cc: shared memory-based allocator + + * libxmt: version 1.9.4 + 2006-12-15 Petr Ovtchenkov <pt...@is...> * time.h, time.cc: add timespec in xmt namespace, useful Modified: trunk/complement/explore/lib/mt/Makefile.inc =================================================================== --- trunk/complement/explore/lib/mt/Makefile.inc 2006-12-18 17:29:25 UTC (rev 1461) +++ trunk/complement/explore/lib/mt/Makefile.inc 2006-12-26 16:13:00 UTC (rev 1462) @@ -3,6 +3,6 @@ LIBNAME = xmt MAJOR = 1 MINOR = 9 -PATCH = 3 -SRC_CC = xmt.cc thr_mgr.cc time.cc uid.cc +PATCH = 4 +SRC_CC = xmt.cc thr_mgr.cc time.cc uid.cc shm.cc SRC_C = fl.c Added: trunk/complement/explore/lib/mt/shm.cc =================================================================== --- trunk/complement/explore/lib/mt/shm.cc (rev 0) +++ trunk/complement/explore/lib/mt/shm.cc 2006-12-26 16:13:00 UTC (rev 1462) @@ -0,0 +1,64 @@ +// -*- C++ -*- Time-stamp: <06/12/20 11:44:26 ptr> + +/* + * Copyright (c) 2006 + * Petr Ovtchenkov + * + * Licensed under the Academic Free License version 3.0 + * + */ + +#include <mt/shm.h> + +namespace xmt { + +const char *shm_bad_alloc::what() const throw() +{ + switch ( err ) { + case 0: + return "All fine"; + case EACCES: + return "Permission denied"; + case EBADF: + return "Bad file number"; + case EFAULT: + return "Bad address"; + case ELOOP: + return "Too many symbolic links encountered"; + case ENAMETOOLONG: + return "File name too long"; + case ENOENT: + return "No such file or directory or segment"; + case ENOMEM: + return "Out of memory"; + case ENOTDIR: + return "Not a directory"; + case EEXIST: + return "File exists"; + case EINVAL: + return "Invalid argument"; + case ENFILE: + return "File table overflow"; + case ENOSPC: + return "No space left on device"; + case EPERM: + return "Operation not permitted"; + case EIDRM: + return "Identifier removed"; + case EOVERFLOW: + return "Value too large for defined data type"; + + case -1: + return "Address already assigned"; + case -2: + return "Shared memory segment not allocated"; + case -3: + return "Not enough space left in shared memory segment"; + case -4: + return "Reference file exists"; + } + + return "unknown"; +} + +} // namespace xmt Modified: trunk/complement/explore/test/mt/Makefile =================================================================== --- trunk/complement/explore/test/mt/Makefile 2006-12-18 17:29:25 UTC (rev 1461) +++ trunk/complement/explore/test/mt/Makefile 2006-12-26 16:13:00 UTC (rev 1462) @@ -29,9 +29,9 @@ dbg-shared: LDSEARCH += -L${CoMT_LIB_DIR_DBG} -Wl,-R${CoMT_LIB_DIR_DBG}:${STLPORT_LIB_DIR} endif -release-shared : LDLIBS = -lxmt -lboost_test_utf -stldbg-shared : LDLIBS = -lxmtstlg -lboost_test_utfstlg -dbg-shared : LDLIBS = -lxmtg -lboost_test_utfg +release-shared : LDLIBS = -lxmt -lboost_test_utf -lboost_fs +stldbg-shared : LDLIBS = -lxmtstlg -lboost_test_utfstlg -lboost_fsstlg +dbg-shared : LDLIBS = -lxmtg -lboost_test_utfg -lboost_fsg ifeq ($(OSNAME),freebsd) release-shared : LDLIBS += -lthr Modified: trunk/complement/explore/test/mt/mt_test.cc =================================================================== --- trunk/complement/explore/test/mt/mt_test.cc 2006-12-18 17:29:25 UTC (rev 1461) +++ trunk/complement/explore/test/mt/mt_test.cc 2006-12-26 16:13:00 UTC (rev 1462) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/12/18 20:00:15 ptr> +// -*- C++ -*- Time-stamp: <06/12/26 10:45:51 ptr> /* * Copyright (c) 2006 @@ -13,13 +13,22 @@ #include "mt_test.h" #include <mt/xmt.h> +#include <mt/shm.h> #include <sys/shm.h> #include <sys/wait.h> #include <signal.h> +#include <boost/filesystem/operations.hpp> +#include <boost/filesystem/path.hpp> + +#include <iostream> + +using namespace std; + using namespace boost::unit_test_framework; +namespace fs = boost::filesystem; void mt_test::fork() { @@ -137,3 +146,120 @@ shmdt( buf ); shmctl( id, IPC_RMID, &ds ); } + +void mt_test::shm_segment() +{ + const char fname[] = "/tmp/mt_test.shm"; + try { + xmt::detail::__shm_alloc<0> seg( 5000, 1024, xmt::shm_base::create | xmt::shm_base::exclusive, 0660 ); + + BOOST_CHECK( seg.address() != reinterpret_cast<void *>(-1) ); + seg.deallocate(); + BOOST_CHECK( seg.address() == reinterpret_cast<void *>(-1) ); + + BOOST_REQUIRE( !fs::exists( fname ) ); + + seg.allocate( fname, 1024, xmt::shm_base::create | xmt::shm_base::exclusive, 0660 ); + BOOST_CHECK( seg.address() != reinterpret_cast<void *>(-1) ); + seg.deallocate(); + BOOST_CHECK( seg.address() == reinterpret_cast<void *>(-1) ); + BOOST_CHECK( fs::exists( fname ) ); // well, now I don't remove ref file, because shm segment may be created with another way + + // not exclusive, should pass + seg.allocate( fname, 1024, xmt::shm_base::create, 0660 ); + BOOST_CHECK( seg.address() != reinterpret_cast<void *>(-1) ); + try { + // This instance has segment in usage, should throw + seg.allocate( fname, 1024, 0, 0660 ); + BOOST_CHECK( false ); + } + catch ( xmt::shm_bad_alloc& err ) { + BOOST_CHECK( true ); // Ok + } + + /* + + I will treat another instanse (<1>) as interface to another + segment, so this sample not work. + + try { + // But this is another instanse, it's ok: + xmt::detail::__shm_alloc<1> seg1( fname, 1024, 0, 0660 ); + BOOST_CHECK( seg1.address() != reinterpret_cast<void *>(-1) ); + // Don't call seg1.deallocate() here, it destroy + } + catch ( xmt::shm_bad_alloc& err ) { + BOOST_CHECK( false ); // Fail + } + */ + + seg.deallocate(); + BOOST_CHECK( seg.address() == reinterpret_cast<void *>(-1) ); + + // ---- + try { + // exclusive, should throw + seg.allocate( fname, 1024, xmt::shm_base::create | xmt::shm_base::exclusive, 0660 ); + BOOST_CHECK( false ); // Fail, should throw + } + catch ( xmt::shm_bad_alloc& err ) { + BOOST_CHECK( true ); // Ok + } + BOOST_CHECK( fs::exists( fname ) ); + // ---- + + fs::remove( fname ); + } + catch ( xmt::shm_bad_alloc& err ) { + BOOST_CHECK_MESSAGE( false, "error report: " << err.what() ); + } +} + +void mt_test::shm_alloc() +{ + const char fname[] = "/tmp/mt_test.shm"; + try { + xmt::shm_alloc<0> seg; + + seg.allocate( fname, 7000, xmt::shm_base::create | xmt::shm_base::exclusive, 0660 ); + + { + xmt::allocator_shm<char,0> shmall; + size_t sz = shmall.max_size(); + char *ch1 = shmall.allocate( 3500 ); + BOOST_CHECK( ch1 != 0 ); + char *ch2 = shmall.allocate( 3500 ); + BOOST_CHECK( ch2 != 0 ); + try { + char *ch3 = shmall.allocate( 8 * 1024 - 7000 ); + BOOST_CHECK( false ); + } + catch ( xmt::shm_bad_alloc& err ) { + BOOST_CHECK( true ); + } + shmall.deallocate( ch1, 3500 ); + ch1 = shmall.allocate( 3500 ); + BOOST_CHECK( ch1 != 0 ); + shmall.deallocate( ch2, 3500 ); + ch2 = shmall.allocate( 3500 ); + BOOST_CHECK( ch2 != 0 ); + shmall.deallocate( ch1, 3500 ); + shmall.deallocate( ch2, 3500 ); + ch1 = shmall.allocate( 7000 ); + BOOST_CHECK( ch1 != 0 ); + shmall.deallocate( ch1, 7000 ); + ch1 = shmall.allocate( sz ); + BOOST_CHECK( ch1 != 0 ); + shmall.deallocate( ch1, sz ); + ch1 = shmall.allocate( 7000 ); + BOOST_CHECK( ch1 != 0 ); + shmall.deallocate( ch1, 7000 ); + } + seg.deallocate(); + fs::remove( fname ); + } + catch ( xmt::shm_bad_alloc& err ) { + BOOST_CHECK_MESSAGE( false, "error report: " << err.what() ); + } +} + Modified: trunk/complement/explore/test/mt/mt_test.h =================================================================== --- trunk/complement/explore/test/mt/mt_test.h 2006-12-18 17:29:25 UTC (rev 1461) +++ trunk/complement/explore/test/mt/mt_test.h 2006-12-26 16:13:00 UTC (rev 1462) @@ -15,6 +15,8 @@ { void fork(); void pid(); + void shm_segment(); + void shm_alloc(); }; #endif // __MT_TEST_H Modified: trunk/complement/explore/test/mt/mt_test_suite.cc =================================================================== --- trunk/complement/explore/test/mt/mt_test_suite.cc 2006-12-18 17:29:25 UTC (rev 1461) +++ trunk/complement/explore/test/mt/mt_test_suite.cc 2006-12-26 16:13:00 UTC (rev 1462) @@ -20,9 +20,14 @@ test_case *fork_tc = BOOST_CLASS_TEST_CASE( &mt_test::fork, instance ); test_case *pid_tc = BOOST_CLASS_TEST_CASE( &mt_test::pid, instance ); + test_case *shm_segment_tc = BOOST_CLASS_TEST_CASE( &mt_test::shm_segment, instance ); + test_case *shm_alloc_tc = BOOST_CLASS_TEST_CASE( &mt_test::shm_alloc, instance ); pid_tc->depends_on( fork_tc ); + shm_alloc_tc->depends_on( shm_segment_tc ); add( fork_tc ); add( pid_tc ); + add( shm_segment_tc ); + add( shm_alloc_tc ); }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2006-12-18 17:29:27
|
Revision: 1461 http://svn.sourceforge.net/complement/?rev=1461&view=rev Author: complement Date: 2006-12-18 09:29:25 -0800 (Mon, 18 Dec 2006) Log Message: ----------- sockios test suite added; try test sigpipe: broken line Modified Paths: -------------- trunk/complement/explore/test/sockios/Makefile.inc trunk/complement/explore/test/sockios/unit_test.cc Added Paths: ----------- trunk/complement/explore/test/sockios/sockios_test.cc trunk/complement/explore/test/sockios/sockios_test.h trunk/complement/explore/test/sockios/sockios_test_suite.cc trunk/complement/explore/test/sockios/sockios_test_suite.h Modified: trunk/complement/explore/test/sockios/Makefile.inc =================================================================== --- trunk/complement/explore/test/sockios/Makefile.inc 2006-12-18 17:27:35 UTC (rev 1460) +++ trunk/complement/explore/test/sockios/Makefile.inc 2006-12-18 17:29:25 UTC (rev 1461) @@ -1,5 +1,6 @@ -# -*- makefile -*- Time-stamp: <06/07/17 10:27:56 ptr> +# -*- makefile -*- Time-stamp: <06/12/18 16:43:21 ptr> PRGNAME = sockios_ut SRC_CC = unit_test.cc ConnectionProcessor.cc message.cc client.cc client-mw.cc \ - client-wc.cc close_socket.cc bytes_in_socket.cc bytes_in_socket2.cc read0_on_exec.cc + client-wc.cc close_socket.cc bytes_in_socket.cc bytes_in_socket2.cc read0_on_exec.cc \ + sockios_test.cc sockios_test_suite.cc Added: trunk/complement/explore/test/sockios/sockios_test.cc =================================================================== --- trunk/complement/explore/test/sockios/sockios_test.cc (rev 0) +++ trunk/complement/explore/test/sockios/sockios_test.cc 2006-12-18 17:29:25 UTC (rev 1461) @@ -0,0 +1,354 @@ +// -*- C++ -*- Time-stamp: <06/12/18 18:51:17 ptr> + +/* + * + * Copyright (c) 2002, 2003, 2005, 2006 + * Petr Ovtchenkov + * + * Licensed under the Academic Free License version 3.0 + * + */ + +#include "sockios_test.h" +#include "message.h" + +#include <boost/test/unit_test.hpp> + +#include <sockios/sockstream> +#include <sockios/sockmgr.h> + +#include <list> + +#include <arpa/inet.h> + +#include <sys/shm.h> +#include <sys/wait.h> + +#include <signal.h> + +using namespace boost::unit_test_framework; +using namespace std; + +void sockios_test::hostname_test() +{ + unsigned long local = htonl( 0x7f000001 ); // 127.0.0.1 + +#ifdef _LITTLE_ENDIAN + BOOST_CHECK_EQUAL( local, 0x0100007f ); +#endif + +#ifdef _BIG_ENDIAN + BOOST_CHECK_EQUAL( local, 0x7f000001 ); +#endif + + BOOST_CHECK_EQUAL( std::hostname( local ), "localhost [127.0.0.1]" ); + +#ifdef __unix + char buff[1024]; + + gethostname( buff, 1024 ); + + BOOST_CHECK_EQUAL( std::hostname(), buff ); +#endif +} + +void sockios_test::service_test() +{ +#ifdef __unix + BOOST_CHECK( std::service( "ftp", "tcp" ) == 21 ); + BOOST_CHECK( std::service( 7, "udp" ) == "echo" ); +#else + BOOST_ERROR( "requests for service (/etc/services) not implemented on this platform" ); +#endif +} + +void sockios_test::hostaddr_test1() +{ +#ifdef __unix + in_addr addr = std::findhost( "localhost" ); + +# ifdef _LITTLE_ENDIAN + BOOST_CHECK_EQUAL( addr.s_addr, 0x0100007f ); +# endif + +# ifdef _BIG_ENDIAN + BOOST_CHECK_EQUAL( addr.s_addr, 0x7f000001 ); +# endif + +#else + BOOST_ERROR( "Not implemented" ); +#endif +} + +void sockios_test::hostaddr_test2() +{ +#ifdef __unix + list<in_addr> haddrs; + std::gethostaddr( "localhost", back_inserter(haddrs) ); + + bool localhost_found = false; + + for ( list<in_addr>::const_iterator i = haddrs.begin(); i != haddrs.end(); ++i ) { + if ( i->s_addr == htonl( 0x7f000001 ) ) { // 127.0.0.1 + localhost_found = true; + break; + } + } + + BOOST_CHECK( localhost_found == true ); + +#else + BOOST_ERROR( "Not implemented" ); +#endif +} + +void sockios_test::hostaddr_test3() +{ +#ifdef __unix + list<sockaddr> haddrs; + gethostaddr2( "localhost", back_inserter(haddrs) ); + + bool localhost_found = false; + + for ( list<sockaddr>::const_iterator i = haddrs.begin(); i != haddrs.end(); ++i ) { + switch ( i->sa_family ) { + case PF_INET: + if ( ((sockaddr_in *)&*i)->sin_addr.s_addr == htonl( 0x7f000001 ) ) { + localhost_found = true; + } + break; + case PF_INET6: + if ( ((sockaddr_in6 *)&*i)->sin6_addr.in6_u.u6_addr32[0] == 0 && + ((sockaddr_in6 *)&*i)->sin6_addr.in6_u.u6_addr32[1] == 0 && + ((sockaddr_in6 *)&*i)->sin6_addr.in6_u.u6_addr32[2] == 0 && + ((sockaddr_in6 *)&*i)->sin6_addr.in6_u.u6_addr32[3] == 1 ) { + localhost_found = true; + } + break; + } + } + + BOOST_CHECK( localhost_found == true ); + +#else + BOOST_ERROR( "Not implemented" ); +#endif +} + +class Cnt +{ + public: + Cnt( sockstream& ) + { xmt::Locker lk(lock); ++cnt; } + + ~Cnt() + { xmt::Locker lk(lock); --cnt; } + + void connect( sockstream& ) + { } + + void close() + { } + + static xmt::Mutex lock; + static int cnt; +}; + +xmt::Mutex Cnt::lock; +int Cnt::cnt = 0; + +void sockios_test::ctor_dtor() +{ + // Check, that naumber of ctors of Cnt is the same as number of called dtors + // i.e. all created Cnt freed. + // due to async nature of communication, no way to check Cnt::cnt + // before server stop. + { + sockmgr_stream_MP<Cnt> srv( port ); + + { + sockstream s1( "localhost", port ); + + BOOST_CHECK( s1.good() ); + BOOST_CHECK( s1.is_open() ); + + s1 << "1234" << endl; + + BOOST_CHECK( s1.good() ); + BOOST_CHECK( s1.is_open() ); + } + + srv.close(); + srv.wait(); + + Cnt::lock.lock(); + BOOST_CHECK( Cnt::cnt == 0 ); + Cnt::lock.unlock(); + + } + { + sockmgr_stream_MP<Cnt> srv( port ); + + { + sockstream s1( "localhost", port ); + sockstream s2( "localhost", port ); + + BOOST_CHECK( s1.good() ); + BOOST_CHECK( s1.is_open() ); + BOOST_CHECK( s2.good() ); + BOOST_CHECK( s2.is_open() ); + + s1 << "1234" << endl; + s2 << "1234" << endl; + + BOOST_CHECK( s1.good() ); + BOOST_CHECK( s1.is_open() ); + BOOST_CHECK( s2.good() ); + BOOST_CHECK( s2.is_open() ); + } + + srv.close(); + srv.wait(); + + Cnt::lock.lock(); + BOOST_CHECK( Cnt::cnt == 0 ); + Cnt::lock.unlock(); + + } +} + +class loader +{ + public: + loader( std::sockstream& ); + + void connect( std::sockstream& ); + void close(); +}; + +loader::loader( std::sockstream& ) +{ +} + +void loader::connect( std::sockstream& s ) +{ + char buf[1024]; + + s.read( buf, 1024 ); + s.write( buf, 1024 ); + s.flush(); +} + +void loader::close() +{ +} + +xmt::Thread::ret_code client_thr( void * ) +{ + xmt::Thread::ret_code ret; + + ret.iword = 0; + + sockstream s( "localhost", port ); + + char buf[1024]; + + fill( buf, buf + 1024, 0 ); + + while( true ) { + s.write( buf, 1024 ); + s.flush(); + + s.read( buf, 1024 ); + } + + return ret; +} + +void sigpipe_handler( int sig, siginfo_t *si, void * ) +{ + cerr << "-----------------------------------------------\n" + << "my pid: " << xmt::getpid() << ", ppid: " << xmt::getppid() << "\n" + << "signal: " << sig << ", number " << si->si_signo + << " errno " << si->si_errno + << " code " << si->si_code << endl; +} + +void sockios_test::sigpipe() +{ + shmid_ds ds; + int id = shmget( 5000, 1024, IPC_CREAT | IPC_EXCL | 0600 ); + BOOST_REQUIRE( id != -1 ); + // if ( id == -1 ) { + // cerr << "Error on shmget" << endl; + // } + BOOST_REQUIRE( shmctl( id, IPC_STAT, &ds ) != -1 ); + // if ( shmctl( id, IPC_STAT, &ds ) == -1 ) { + // cerr << "Error on shmctl" << endl; + // } + void *buf = shmat( id, 0, 0 ); + BOOST_REQUIRE( buf != reinterpret_cast<void *>(-1) ); + // if ( buf == reinterpret_cast<void *>(-1) ) { + // cerr << "Error on shmat" << endl; + // } + + xmt::__Condition<true>& fcnd = *new( buf ) xmt::__Condition<true>(); + fcnd.set( false ); + xmt::__Condition<true>& tcnd = *new( (char *)buf + sizeof(xmt::__Condition<true>) ) xmt::__Condition<true>(); + tcnd.set( false ); + + try { + xmt::fork(); + + fcnd.try_wait(); + + try { + /* + * This process will be killed, + * so I don't care about safe termination. + */ + xmt::Thread *th1 = new xmt::Thread( client_thr ); + for ( int i = 0; i < 10; ++i ) { + new xmt::Thread( client_thr ); + new xmt::Thread( client_thr ); + new xmt::Thread( client_thr ); + new xmt::Thread( client_thr ); + } + + xmt::delay( xmt::timespec(5,0) ); + + tcnd.set( true ); + + th1->join(); + + exit( 0 ); + } + catch ( ... ) { + } + } + catch ( xmt::fork_in_parent& child ) { + try { + xmt::signal_handler( SIGPIPE, &sigpipe_handler ); + sockmgr_stream_MP<loader> srv( port ); + + fcnd.set( true ); + + tcnd.try_wait(); + + kill( child.pid(), SIGTERM ); + + int stat; + waitpid( child.pid(), &stat, 0 ); + + srv.close(); + srv.wait(); + } + catch ( ... ) { + } + } + + (&fcnd)->~__Condition<true>(); + + shmdt( buf ); + shmctl( id, IPC_RMID, &ds ); +} Added: trunk/complement/explore/test/sockios/sockios_test.h =================================================================== --- trunk/complement/explore/test/sockios/sockios_test.h (rev 0) +++ trunk/complement/explore/test/sockios/sockios_test.h 2006-12-18 17:29:25 UTC (rev 1461) @@ -0,0 +1,29 @@ +// -*- C++ -*- Time-stamp: <06/12/18 16:54:00 ptr> + +/* + * + * Copyright (c) 2002, 2003, 2005, 2006 + * Petr Ovtchenkov + * + * Licensed under the Academic Free License version 3.0 + * + */ + +#ifndef __sockios_test_h +#define __sockios_test_h + +struct sockios_test +{ + void hostname_test(); + void service_test(); + + void hostaddr_test1(); + void hostaddr_test2(); + void hostaddr_test3(); + + void ctor_dtor(); + + void sigpipe(); +}; + +#endif // __sockios_test_h Added: trunk/complement/explore/test/sockios/sockios_test_suite.cc =================================================================== --- trunk/complement/explore/test/sockios/sockios_test_suite.cc (rev 0) +++ trunk/complement/explore/test/sockios/sockios_test_suite.cc 2006-12-18 17:29:25 UTC (rev 1461) @@ -0,0 +1,43 @@ +// -*- C++ -*- Time-stamp: <06/12/18 17:10:02 ptr> + +/* + * + * Copyright (c) 2002, 2003, 2005, 2006 + * Petr Ovtchenkov + * + * Licensed under the Academic Free License version 3.0 + * + */ + +#include "sockios_test_suite.h" +#include "sockios_test.h" + +#include <boost/test/unit_test.hpp> + +using namespace boost::unit_test_framework; + + +sockios_test_suite::sockios_test_suite() : + test_suite( "sockios library test suite" ) +{ + boost::shared_ptr<sockios_test> instance( new sockios_test() ); + test_case *hostname_tc = BOOST_CLASS_TEST_CASE( &sockios_test::hostname_test, instance ); + test_case *service_tc = BOOST_CLASS_TEST_CASE( &sockios_test::service_test, instance ); + + test_case *hostaddr1_tc = BOOST_CLASS_TEST_CASE( &sockios_test::hostaddr_test1, instance ); + test_case *hostaddr2_tc = BOOST_CLASS_TEST_CASE( &sockios_test::hostaddr_test2, instance ); + test_case *hostaddr3_tc = BOOST_CLASS_TEST_CASE( &sockios_test::hostaddr_test3, instance ); + test_case *ctor_dtor_tc = BOOST_CLASS_TEST_CASE( &sockios_test::ctor_dtor, instance ); + test_case *sigpipe_tc = BOOST_CLASS_TEST_CASE( &sockios_test::sigpipe, instance ); + + // hostaddr2_tc->depends_on( hostaddr1_tc ); + + add( hostname_tc ); + add( service_tc ); + + add( hostaddr1_tc ); + add( hostaddr2_tc ); + add( hostaddr3_tc ); + add( ctor_dtor_tc ); + add( sigpipe_tc ); +} Added: trunk/complement/explore/test/sockios/sockios_test_suite.h =================================================================== --- trunk/complement/explore/test/sockios/sockios_test_suite.h (rev 0) +++ trunk/complement/explore/test/sockios/sockios_test_suite.h 2006-12-18 17:29:25 UTC (rev 1461) @@ -0,0 +1,23 @@ +// -*- C++ -*- Time-stamp: <06/12/18 16:52:16 ptr> + +/* + * + * Copyright (c) 2002, 2003, 2005, 2006 + * Petr Ovtchenkov + * + * Licensed under the Academic Free License version 3.0 + * + */ + +#ifndef __sockios_test_suite_h +#define __sockios_test_suite_h + +#include <boost/test/unit_test.hpp> + +struct sockios_test_suite : + public boost::unit_test_framework::test_suite +{ + sockios_test_suite(); +}; + +#endif // __sockios_test_suite_h Modified: trunk/complement/explore/test/sockios/unit_test.cc =================================================================== --- trunk/complement/explore/test/sockios/unit_test.cc 2006-12-18 17:27:35 UTC (rev 1460) +++ trunk/complement/explore/test/sockios/unit_test.cc 2006-12-18 17:29:25 UTC (rev 1461) @@ -1,8 +1,8 @@ -// -*- C++ -*- Time-stamp: <06/11/28 10:07:49 ptr> +// -*- C++ -*- Time-stamp: <06/12/18 16:41:59 ptr> /* * - * Copyright (c) 2002, 2003, 2005 + * Copyright (c) 2002, 2003, 2005, 2006 * Petr Ovtchenkov * * Licensed under the Academic Free License version 3.0 @@ -13,6 +13,8 @@ using namespace boost::unit_test_framework; +#include "sockios_test_suite.h" + #include <iostream> #include <list> #include <mt/xmt.h> @@ -347,235 +349,7 @@ void test_read0(); void test_read0_srv(); -struct sockios_test -{ - void hostname_test(); - void service_test(); - void hostaddr_test1(); - void hostaddr_test2(); - void hostaddr_test3(); - - void ctor_dtor(); -}; - -void sockios_test::hostname_test() -{ - unsigned long local = htonl( 0x7f000001 ); // 127.0.0.1 - -#ifdef _LITTLE_ENDIAN - BOOST_CHECK_EQUAL( local, 0x0100007f ); -#endif - -#ifdef _BIG_ENDIAN - BOOST_CHECK_EQUAL( local, 0x7f000001 ); -#endif - - BOOST_CHECK_EQUAL( hostname( local ), "localhost [127.0.0.1]" ); - -#ifdef __unix - char buff[1024]; - - gethostname( buff, 1024 ); - - BOOST_CHECK_EQUAL( hostname(), buff ); -#endif -} - -void sockios_test::service_test() -{ -#ifdef __unix - BOOST_CHECK( service( "ftp", "tcp" ) == 21 ); - BOOST_CHECK( service( 7, "udp" ) == "echo" ); -#else - BOOST_ERROR( "requests for service (/etc/services) not implemented on this platform" ); -#endif -} - -void sockios_test::hostaddr_test1() -{ -#ifdef __unix - in_addr addr = findhost( "localhost" ); - -# ifdef _LITTLE_ENDIAN - BOOST_CHECK_EQUAL( addr.s_addr, 0x0100007f ); -# endif - -# ifdef _BIG_ENDIAN - BOOST_CHECK_EQUAL( addr.s_addr, 0x7f000001 ); -# endif - -#else - BOOST_ERROR( "Not implemented" ); -#endif -} - -void sockios_test::hostaddr_test2() -{ -#ifdef __unix - list<in_addr> haddrs; - gethostaddr( "localhost", back_inserter(haddrs) ); - - bool localhost_found = false; - - for ( list<in_addr>::const_iterator i = haddrs.begin(); i != haddrs.end(); ++i ) { - if ( i->s_addr == htonl( 0x7f000001 ) ) { // 127.0.0.1 - localhost_found = true; - break; - } - } - - BOOST_CHECK( localhost_found == true ); - -#else - BOOST_ERROR( "Not implemented" ); -#endif -} - -void sockios_test::hostaddr_test3() -{ -#ifdef __unix - list<sockaddr> haddrs; - gethostaddr2( "localhost", back_inserter(haddrs) ); - - bool localhost_found = false; - - for ( list<sockaddr>::const_iterator i = haddrs.begin(); i != haddrs.end(); ++i ) { - switch ( i->sa_family ) { - case PF_INET: - if ( ((sockaddr_in *)&*i)->sin_addr.s_addr == htonl( 0x7f000001 ) ) { - localhost_found = true; - } - break; - case PF_INET6: - if ( ((sockaddr_in6 *)&*i)->sin6_addr.in6_u.u6_addr32[0] == 0 && - ((sockaddr_in6 *)&*i)->sin6_addr.in6_u.u6_addr32[1] == 0 && - ((sockaddr_in6 *)&*i)->sin6_addr.in6_u.u6_addr32[2] == 0 && - ((sockaddr_in6 *)&*i)->sin6_addr.in6_u.u6_addr32[3] == 1 ) { - localhost_found = true; - } - break; - } - } - - BOOST_CHECK( localhost_found == true ); - -#else - BOOST_ERROR( "Not implemented" ); -#endif -} - -class Cnt -{ - public: - Cnt( sockstream& ) - { xmt::Locker lk(lock); ++cnt; } - - ~Cnt() - { xmt::Locker lk(lock); --cnt; } - - void connect( sockstream& ) - { } - - void close() - { } - - static xmt::Mutex lock; - static int cnt; -}; - -xmt::Mutex Cnt::lock; -int Cnt::cnt = 0; - -void sockios_test::ctor_dtor() -{ - // Check, that naumber of ctors of Cnt is the same as number of called dtors - // i.e. all created Cnt freed. - // due to async nature of communication, no way to check Cnt::cnt - // before server stop. - { - sockmgr_stream_MP<Cnt> srv( port ); - - { - sockstream s1( "localhost", port ); - - BOOST_CHECK( s1.good() ); - BOOST_CHECK( s1.is_open() ); - - s1 << "1234" << endl; - - BOOST_CHECK( s1.good() ); - BOOST_CHECK( s1.is_open() ); - } - - srv.close(); - srv.wait(); - - Cnt::lock.lock(); - BOOST_CHECK( Cnt::cnt == 0 ); - Cnt::lock.unlock(); - - } - { - sockmgr_stream_MP<Cnt> srv( port ); - - { - sockstream s1( "localhost", port ); - sockstream s2( "localhost", port ); - - BOOST_CHECK( s1.good() ); - BOOST_CHECK( s1.is_open() ); - BOOST_CHECK( s2.good() ); - BOOST_CHECK( s2.is_open() ); - - s1 << "1234" << endl; - s2 << "1234" << endl; - - BOOST_CHECK( s1.good() ); - BOOST_CHECK( s1.is_open() ); - BOOST_CHECK( s2.good() ); - BOOST_CHECK( s2.is_open() ); - } - - srv.close(); - srv.wait(); - - Cnt::lock.lock(); - BOOST_CHECK( Cnt::cnt == 0 ); - Cnt::lock.unlock(); - - } -} - -struct sockios_test_suite : - public test_suite -{ - sockios_test_suite(); -}; - -sockios_test_suite::sockios_test_suite() : - test_suite( "sockios library test suite" ) -{ - boost::shared_ptr<sockios_test> instance( new sockios_test() ); - test_case *hostname_tc = BOOST_CLASS_TEST_CASE( &sockios_test::hostname_test, instance ); - test_case *service_tc = BOOST_CLASS_TEST_CASE( &sockios_test::service_test, instance ); - - test_case *hostaddr1_tc = BOOST_CLASS_TEST_CASE( &sockios_test::hostaddr_test1, instance ); - test_case *hostaddr2_tc = BOOST_CLASS_TEST_CASE( &sockios_test::hostaddr_test2, instance ); - test_case *hostaddr3_tc = BOOST_CLASS_TEST_CASE( &sockios_test::hostaddr_test3, instance ); - test_case *ctor_dtor_tc = BOOST_CLASS_TEST_CASE( &sockios_test::ctor_dtor, instance ); - - // hostaddr2_tc->depends_on( hostaddr1_tc ); - - add( hostname_tc ); - add( service_tc ); - - add( hostaddr1_tc ); - add( hostaddr2_tc ); - add( hostaddr3_tc ); - add( ctor_dtor_tc ); -} - test_suite *init_unit_test_suite( int argc, char **argv ) { test_suite *ts = BOOST_TEST_SUITE( "libsockios test" ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2006-12-18 17:27:37
|
Revision: 1460 http://svn.sourceforge.net/complement/?rev=1460&view=rev Author: complement Date: 2006-12-18 09:27:35 -0800 (Mon, 18 Dec 2006) Log Message: ----------- check getpid and getppid Modified Paths: -------------- trunk/complement/explore/test/mt/mt_test.cc trunk/complement/explore/test/mt/mt_test.h trunk/complement/explore/test/mt/mt_test_suite.cc Modified: trunk/complement/explore/test/mt/mt_test.cc =================================================================== --- trunk/complement/explore/test/mt/mt_test.cc 2006-12-18 13:04:02 UTC (rev 1459) +++ trunk/complement/explore/test/mt/mt_test.cc 2006-12-18 17:27:35 UTC (rev 1460) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/12/14 11:10:26 ptr> +// -*- C++ -*- Time-stamp: <06/12/18 20:00:15 ptr> /* * Copyright (c) 2006 @@ -75,3 +75,65 @@ shmdt( buf ); shmctl( id, IPC_RMID, &ds ); } + +void mt_test::pid() +{ + shmid_ds ds; + int id = shmget( 5000, 1024, IPC_CREAT | IPC_EXCL | 0600 ); + BOOST_REQUIRE( id != -1 ); + // if ( id == -1 ) { + // cerr << "Error on shmget" << endl; + // } + BOOST_REQUIRE( shmctl( id, IPC_STAT, &ds ) != -1 ); + // if ( shmctl( id, IPC_STAT, &ds ) == -1 ) { + // cerr << "Error on shmctl" << endl; + // } + void *buf = shmat( id, 0, 0 ); + BOOST_REQUIRE( buf != reinterpret_cast<void *>(-1) ); + // if ( buf == reinterpret_cast<void *>(-1) ) { + // cerr << "Error on shmat" << endl; + // } + + xmt::__Condition<true>& fcnd = *new( buf ) xmt::__Condition<true>(); + fcnd.set( false ); + pid_t my_pid = xmt::getpid(); + + try { + xmt::fork(); + + try { + + // Child code + BOOST_CHECK( my_pid == xmt::getppid() ); + *reinterpret_cast<pid_t *>(static_cast<char *>(buf) + sizeof(xmt::__Condition<true>)) = xmt::getpid(); + + fcnd.set( true ); + + } + catch ( ... ) { + } + + exit( 0 ); + } + catch ( xmt::fork_in_parent& child ) { + try { + BOOST_CHECK( child.pid() > 0 ); + + fcnd.try_wait(); + + BOOST_CHECK( *reinterpret_cast<pid_t *>(static_cast<char *>(buf) + sizeof(xmt::__Condition<true>)) == child.pid() ); + + int stat; + BOOST_CHECK( waitpid( child.pid(), &stat, 0 ) == child.pid() ); + } + catch ( ... ) { + } + } + catch ( ... ) { + } + + (&fcnd)->~__Condition<true>(); + + shmdt( buf ); + shmctl( id, IPC_RMID, &ds ); +} Modified: trunk/complement/explore/test/mt/mt_test.h =================================================================== --- trunk/complement/explore/test/mt/mt_test.h 2006-12-18 13:04:02 UTC (rev 1459) +++ trunk/complement/explore/test/mt/mt_test.h 2006-12-18 17:27:35 UTC (rev 1460) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/12/14 10:45:35 ptr> +// -*- C++ -*- Time-stamp: <06/12/18 19:49:04 ptr> /* * Copyright (c) 2006 @@ -14,6 +14,7 @@ struct mt_test { void fork(); + void pid(); }; #endif // __MT_TEST_H Modified: trunk/complement/explore/test/mt/mt_test_suite.cc =================================================================== --- trunk/complement/explore/test/mt/mt_test_suite.cc 2006-12-18 13:04:02 UTC (rev 1459) +++ trunk/complement/explore/test/mt/mt_test_suite.cc 2006-12-18 17:27:35 UTC (rev 1460) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/12/14 11:12:02 ptr> +// -*- C++ -*- Time-stamp: <06/12/18 19:58:56 ptr> /* * Copyright (c) 2006 @@ -19,8 +19,10 @@ boost::shared_ptr<mt_test> instance( new mt_test() ); test_case *fork_tc = BOOST_CLASS_TEST_CASE( &mt_test::fork, instance ); + test_case *pid_tc = BOOST_CLASS_TEST_CASE( &mt_test::pid, instance ); - // basic2_tc->depends_on( basic1_tc ); + pid_tc->depends_on( fork_tc ); add( fork_tc ); + add( pid_tc ); }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2006-12-18 13:04:04
|
Revision: 1459 http://svn.sourceforge.net/complement/?rev=1459&view=rev Author: complement Date: 2006-12-18 05:04:02 -0800 (Mon, 18 Dec 2006) Log Message: ----------- clean tests for signal catchers; add test for block/unblock signal Modified Paths: -------------- trunk/complement/explore/test/mt/Makefile.inc trunk/complement/explore/test/mt/signal-1.cc trunk/complement/explore/test/mt/unit_test.cc Added Paths: ----------- trunk/complement/explore/test/mt/signal-3.cc Removed Paths: ------------- trunk/complement/explore/test/libmt/signal-3/ trunk/complement/explore/test/libmt/signal-4/ Modified: trunk/complement/explore/test/mt/Makefile.inc =================================================================== --- trunk/complement/explore/test/mt/Makefile.inc 2006-12-15 12:26:46 UTC (rev 1458) +++ trunk/complement/explore/test/mt/Makefile.inc 2006-12-18 13:04:02 UTC (rev 1459) @@ -1,6 +1,6 @@ -# -*- makefile -*- Time-stamp: <06/12/14 11:11:10 ptr> +# -*- makefile -*- Time-stamp: <06/12/16 00:37:10 ptr> PRGNAME = mt_ut SRC_CC = unit_test.cc timespec.cc mutex_test.cc spinlock_test.cc \ - recursive_mutex.cc join.cc signal-1.cc signal-2.cc flck.cc lfs.cc \ + recursive_mutex.cc join.cc signal-1.cc signal-2.cc signal-3.cc flck.cc lfs.cc \ mt_test.cc mt_test_suite.cc Modified: trunk/complement/explore/test/mt/signal-1.cc =================================================================== --- trunk/complement/explore/test/mt/signal-1.cc 2006-12-15 12:26:46 UTC (rev 1458) +++ trunk/complement/explore/test/mt/signal-1.cc 2006-12-18 13:04:02 UTC (rev 1459) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/12/15 10:40:53 ptr> +// -*- C++ -*- Time-stamp: <06/12/16 00:28:34 ptr> /* * Copyright (c) 2003, 2006 @@ -16,6 +16,15 @@ using namespace xmt; + +/* + * thread 2: v = 1; create thread 1 ----------------------------------- join; v == 4? + * \ / + * thread 1: set handler; v == 1? - kill ----------- exit + * \ + * handler (within thread 1): v == 1?; v = 4 + */ + static Thread::ret_code thread_one( void * ); static Thread::ret_code thread_two( void * ); @@ -24,6 +33,8 @@ static int v = 0; +static Condition cnd; + extern "C" { static void handler( int ); @@ -55,29 +66,10 @@ BOOST_CHECK( v == 1 ); -// pm.lock(); -// cerr << "thread_one: unblock signal SIGINT" << endl; -// cerr << "thread_one: set own handler for signal SIGINT" << endl; -// pm.unlock(); + cnd.try_wait(); - - // wait while set thread's pointer (from thread_two) - xmt::timespec t(1,0); - - while ( th_one == 0 ) { - xmt::sleep( t ); - } - -// pm.lock(); -// cerr << "thread_one: send SIGINT" << endl; -// pm.unlock(); th_one->kill( SIGINT ); // send signal SIGINT to self -// pm.lock(); -// cerr << "thread_one: after send SIGINT" << endl; -// pm.unlock(); - // v = 2; // not reached (exit before) - Thread::ret_code rt; rt.iword = 0; @@ -86,22 +78,16 @@ Thread::ret_code thread_two( void * ) { - // pm.lock(); - // cerr << "thread_two: create thread one" << endl; - // pm.unlock(); + cnd.set( false ); v = 1; Thread t( thread_one ); // start thread_one - th_one = &t; // store address to be called from thread_one + th_one = &t; // store address to be called from thread_one - // pm.lock(); - // cerr << "thread_two: wait termination of thread one" << endl; - // pm.unlock(); + cnd.set( true ); + t.join(); - // pm.lock(); - // cerr << "thread_two: EOL of thread one" << endl; - // pm.unlock(); BOOST_CHECK( v == 4 ); Added: trunk/complement/explore/test/mt/signal-3.cc =================================================================== --- trunk/complement/explore/test/mt/signal-3.cc (rev 0) +++ trunk/complement/explore/test/mt/signal-3.cc 2006-12-18 13:04:02 UTC (rev 1459) @@ -0,0 +1,114 @@ +// -*- C++ -*- Time-stamp: <06/12/16 00:35:45 ptr> + +/* + * Copyright (c) 2003, 2006 + * Petr Ovtchenkov + * + * Licensed under the Academic Free License Version 3.0 + * + */ + +#include <boost/test/unit_test.hpp> + +using namespace boost::unit_test_framework; + +#include <mt/xmt.h> + +using namespace xmt; + +/* + * This is the same as signal-1, but instead of unblock signal, I block one + * so I don't take this signal. + */ + +/* + * handler (within thread 2): v == 1?; v = 4 + * / + * thread 2: v = 1; create thread 1 ----------------------------------- join; v == 4? + * \ / / + * thread 1: set handler; v == 1? - kill ------ exit + * + */ + +static Thread::ret_code thread_one( void * ); +static Thread::ret_code thread_two( void * ); + +static Thread *th_one = 0; +static Thread *th_two = 0; + +static int v = 0; + +static Condition cnd; + +extern "C" { + static void handler( int ); + + void handler( int ) + { + BOOST_CHECK( v == 1 ); + v = 4; + /* + Note: you have very restricted list of system calls that you can use here + (in the handler of signal) safely. In particular, you can't call pthread_* + functions. Reason: async-signal-safe calls, Unix 98, POSIX 1002.1 + */ + // cerr << "thread_one: Handler" << endl; + // Thread::signal_exit( SIGTERM ); + // send signal to caller thread to exit: + // th_one->kill( SIGTERM ); + + // v = 3; // not reached + } +} + +Thread::ret_code thread_one( void * ) +{ + BOOST_CHECK( v == 1 ); + + cnd.try_wait(); + + th_two->kill( SIGINT ); // send signal SIGINT to self + + Thread::ret_code rt; + rt.iword = 0; + + return rt; +} + +Thread::ret_code thread_two( void * ) +{ + xmt::signal_handler( SIGINT, handler ); + xmt::block_signal( SIGINT ); // block signal + + v = 1; + + Thread t( thread_one ); // start thread_one + + t.join(); + + BOOST_CHECK( v == 1 ); // signal was blocked! + + xmt::unblock_signal( SIGINT ); // unblock signal + + BOOST_CHECK( v == 4 ); + + Thread::ret_code rt; + rt.iword = 0; + + return rt; +} + +void signal_3_test() +{ + cnd.set( false ); + + Thread t( thread_two ); + + th_two = &t; // store address to be called from thread_one + + cnd.set( true ); + + t.join(); + + BOOST_CHECK( v == 4 ); +} Modified: trunk/complement/explore/test/mt/unit_test.cc =================================================================== --- trunk/complement/explore/test/mt/unit_test.cc 2006-12-15 12:26:46 UTC (rev 1458) +++ trunk/complement/explore/test/mt/unit_test.cc 2006-12-18 13:04:02 UTC (rev 1459) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/12/14 10:47:39 ptr> +// -*- C++ -*- Time-stamp: <06/12/16 00:36:47 ptr> /* * Copyright (c) 2002, 2003, 2004, 2006 @@ -24,6 +24,7 @@ void recursive_mutex_test(); void signal_1_test(); void signal_2_test(); +void signal_3_test(); void flock_test(); void lfs_test(); @@ -48,6 +49,7 @@ // (stack saved/restored, that confuse stack unwind); // by this reason next test is commented: // ts->add( BOOST_TEST_CASE( &signal_2_test ) ); + ts->add( BOOST_TEST_CASE( &signal_3_test ) ); // flock requre revision, commented now. // ts->add( BOOST_TEST_CASE( &flock_test ) ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2006-12-15 12:26:49
|
Revision: 1458 http://svn.sourceforge.net/complement/?rev=1458&view=rev Author: complement Date: 2006-12-15 04:26:46 -0800 (Fri, 15 Dec 2006) Log Message: ----------- add setting signal handler with siginfo Modified Paths: -------------- trunk/complement/explore/include/mt/xmt.h trunk/complement/explore/lib/mt/ChangeLog trunk/complement/explore/lib/mt/xmt.cc Added Paths: ----------- trunk/complement/explore/inquiry/shades/dump_term/ trunk/complement/explore/inquiry/shades/dump_term/Makefile trunk/complement/explore/inquiry/shades/dump_term/Makefile.inc trunk/complement/explore/inquiry/shades/dump_term/test.cc Modified: trunk/complement/explore/include/mt/xmt.h =================================================================== --- trunk/complement/explore/include/mt/xmt.h 2006-12-15 08:11:12 UTC (rev 1457) +++ trunk/complement/explore/include/mt/xmt.h 2006-12-15 12:26:46 UTC (rev 1458) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/12/15 03:03:00 ptr> +// -*- C++ -*- Time-stamp: <06/12/15 14:35:45 ptr> /* * Copyright (c) 1997-1999, 2002-2006 @@ -124,6 +124,8 @@ # endif #endif // SIG_PF +typedef void siginfo_handler_type( int, siginfo_t *, void * ); + } // extern "C" namespace xmt { @@ -1402,7 +1404,8 @@ __FIT_DECLSPEC void become_daemon() throw( fork_in_parent, std::runtime_error ); __FIT_DECLSPEC void block_signal( int sig ); __FIT_DECLSPEC void unblock_signal( int sig ); -__FIT_DECLSPEC void signal_handler( int sig, SIG_PF ); +__FIT_DECLSPEC int signal_handler( int sig, SIG_PF ); +__FIT_DECLSPEC int signal_handler( int sig, siginfo_handler_type ); class Thread { Property changes on: trunk/complement/explore/inquiry/shades/dump_term ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/inquiry/shades/dump_term/Makefile =================================================================== --- trunk/complement/explore/inquiry/shades/dump_term/Makefile (rev 0) +++ trunk/complement/explore/inquiry/shades/dump_term/Makefile 2006-12-15 12:26:46 UTC (rev 1458) @@ -0,0 +1,16 @@ +# -*- Makefile -*- Time-stamp: <06/12/15 13:47:56 ptr> + +SRCROOT := ../../.. + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +INCLUDES += -I${CoMT_INCLUDE_DIR} + +release-shared : LDFLAGS += -Wl,-rpath=${STLPORT_LIB_DIR}:${CoMT_LIB_DIR} +dbg-shared : LDFLAGS += -Wl,-rpath=${STLPORT_LIB_DIR}:${CoMT_LIB_DIR} +stldbg-shared : LDFLAGS += -Wl,-rpath=${STLPORT_LIB_DIR}:${CoMT_LIB_DIR} + +release-shared: LDLIBS = -L${CoMT_LIB_DIR} -lxmt +dbg-shared: LDLIBS = -L${CoMT_LIB_DIR} -lxmtg +stldbg-shared: LDLIBS = -L${CoMT_LIB_DIR} -lxmtstlg Added: trunk/complement/explore/inquiry/shades/dump_term/Makefile.inc =================================================================== --- trunk/complement/explore/inquiry/shades/dump_term/Makefile.inc (rev 0) +++ trunk/complement/explore/inquiry/shades/dump_term/Makefile.inc 2006-12-15 12:26:46 UTC (rev 1458) @@ -0,0 +1,4 @@ +# -*- makefile -*- Time-stamp: <04/01/12 15:37:40 ptr> + +PRGNAME = test +SRC_CC = test.cc Added: trunk/complement/explore/inquiry/shades/dump_term/test.cc =================================================================== --- trunk/complement/explore/inquiry/shades/dump_term/test.cc (rev 0) +++ trunk/complement/explore/inquiry/shades/dump_term/test.cc 2006-12-15 12:26:46 UTC (rev 1458) @@ -0,0 +1,77 @@ +#include <mt/xmt.h> +#include <iostream> + +using namespace std; +using namespace xmt; + +void h1( int sig ) +{ + cerr << "Signal: " << sig << endl; +} + +void h2( int sig, siginfo_t *si, void * ) +{ + cerr << "-----------------------------------------------\n" + << "my pid: " << xmt::getpid() << ", ppid: " << xmt::getppid() << "\n" + << "signal: " << sig << ", number " << si->si_signo + << " errno " << si->si_errno + << " code " << si->si_code << endl; + switch ( si->si_signo ) { + case SIGKILL: + case SIGTERM: + case SIGINT: + case SIGQUIT: + case SIGPIPE: + case SIGABRT: + case SIGALRM: + case SIGHUP: + cerr << "pid: " << si->si_pid + << "\nuid: " << si->si_uid + << endl; + break; + case SIGILL: + case SIGFPE: + case SIGSEGV: + case SIGBUS: + cerr << "Address: " << si->si_addr << endl; + break; + } +} + +class Superviser +{ + public: + ~Superviser(); +}; + +Superviser::~Superviser() +{ + cerr << "Good bye" << endl; + kill( xmt::getpid(), SIGABRT ); +} + +// Superviser s; + +int main() +{ + Condition cnd; + + cnd.set( false ); + signal_handler( SIGTERM, &h2 ); + signal_handler( SIGKILL, &h2 ); + signal_handler( SIGQUIT, &h2 ); + signal_handler( SIGINT, &h2 ); + signal_handler( SIGHUP, &h2 ); + signal_handler( SIGALRM, &h2 ); + signal_handler( SIGABRT, &h2 ); + signal_handler( SIGPIPE, &h2 ); + // signal_handler( SIGKILL, &h1 ); + // signal_handler( SIGSTOP, &h1 ); + // unblock_signal( SIGTERM ); + + cerr << "Hello, world!" << endl; + + cnd.wait(); + + return 0; +} Modified: trunk/complement/explore/lib/mt/ChangeLog =================================================================== --- trunk/complement/explore/lib/mt/ChangeLog 2006-12-15 08:11:12 UTC (rev 1457) +++ trunk/complement/explore/lib/mt/ChangeLog 2006-12-15 12:26:46 UTC (rev 1458) @@ -2,12 +2,14 @@ * time.h, time.cc: add timespec in xmt namespace, useful for conversions and inline objects; clean some code in - timespec operations. + timespec operations; * xmt.h: changes related to timespec in xmt namespace and in global namespace; now 'delay' functions family only in xmt - namespace and go away from Thread class. + namespace and go away from Thread class; + * xmt.h, xmt.cc: add setting signal handler with siginfo. + 2006-12-14 Petr Ovtchenkov <pt...@is...> * xmt.h, xmt.cc: move 'fork' and 'become_daemon' from Thread Modified: trunk/complement/explore/lib/mt/xmt.cc =================================================================== --- trunk/complement/explore/lib/mt/xmt.cc 2006-12-15 08:11:12 UTC (rev 1457) +++ trunk/complement/explore/lib/mt/xmt.cc 2006-12-15 12:26:46 UTC (rev 1458) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/12/15 10:10:57 ptr> +// -*- C++ -*- Time-stamp: <06/12/15 14:39:47 ptr> /* * Copyright (c) 1997-1999, 2002-2006 @@ -695,7 +695,7 @@ } __FIT_DECLSPEC -void signal_handler( int sig, SIG_PF handler ) +int signal_handler( int sig, SIG_PF handler ) { #ifdef __unix // catch SIGPIPE here struct sigaction act; @@ -705,11 +705,30 @@ act.sa_flags = 0; // SA_RESTART; act.sa_handler = handler; - sigaction( sig, &act, 0 ); + return sigaction( sig, &act, 0 ); +#else + return -1; #endif // __unix } __FIT_DECLSPEC +int signal_handler( int sig, siginfo_handler_type handler ) +{ +#ifdef __unix // catch SIGPIPE here + struct sigaction act; + + sigemptyset( &act.sa_mask ); + sigaddset( &act.sa_mask, sig ); + + act.sa_flags = SA_SIGINFO; // SA_RESTART; + act.sa_sigaction = handler; + return sigaction( sig, &act, 0 ); +#else + return -1; +#endif // __unix +} + +__FIT_DECLSPEC void fork() throw( fork_in_parent, std::runtime_error ) { #ifdef __unix This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2006-12-15 08:11:13
|
Revision: 1457 http://svn.sourceforge.net/complement/?rev=1457&view=rev Author: complement Date: 2006-12-15 00:11:12 -0800 (Fri, 15 Dec 2006) Log Message: ----------- add timespec in xmt namespace, useful for conversions and inline objects; clean some code in timespec operations. changes related to timespec in xmt namespace and in global namespace; now 'delay' functions family only in xmt namespace and go away from Thread class. Modified Paths: -------------- trunk/complement/explore/include/mt/time.h trunk/complement/explore/include/mt/xmt.h trunk/complement/explore/include/sockios/sockmgr.cc trunk/complement/explore/include/stem/Cron.h trunk/complement/explore/inquiry/makes/static-lib/Makefile trunk/complement/explore/lib/DB/PgSQL/PgSQL.cc trunk/complement/explore/lib/mt/ChangeLog trunk/complement/explore/lib/mt/time.cc trunk/complement/explore/lib/mt/xmt.cc trunk/complement/explore/lib/stem/Cron.cc trunk/complement/explore/test/mt/flck.cc trunk/complement/explore/test/mt/lfs.cc trunk/complement/explore/test/mt/mutex_test.cc trunk/complement/explore/test/mt/recursive_mutex.cc trunk/complement/explore/test/mt/signal-1.cc trunk/complement/explore/test/mt/signal-2.cc trunk/complement/explore/test/mt/spinlock_test.cc trunk/complement/explore/test/sockios/client-wc.cc trunk/complement/explore/test/sockios/read0_on_exec.cc Modified: trunk/complement/explore/include/mt/time.h =================================================================== --- trunk/complement/explore/include/mt/time.h 2006-12-14 14:23:00 UTC (rev 1456) +++ trunk/complement/explore/include/mt/time.h 2006-12-15 08:11:12 UTC (rev 1457) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/10/24 09:28:28 ptr> +// -*- C++ -*- Time-stamp: <06/12/15 10:21:37 ptr> /* * Copyright (c) 2002, 2006 @@ -51,32 +51,95 @@ std::string calendar_time( time_t t ); -timespec operator +( const timespec& a, const timespec& b ); -timespec operator -( const timespec& a, const timespec& b ); -timespec operator /( const timespec& a, unsigned b ); -timespec operator /( const timespec& a, unsigned long b ); +::timespec operator +( const ::timespec& a, const ::timespec& b ); +::timespec operator -( const ::timespec& a, const ::timespec& b ); +::timespec operator /( const ::timespec& a, unsigned b ); +::timespec operator /( const ::timespec& a, unsigned long b ); +::timespec operator *( const ::timespec& a, unsigned b ); +::timespec operator *( const ::timespec& a, unsigned long b ); +inline ::timespec operator *( unsigned b, const ::timespec& a ) +{ return a * b; } +inline ::timespec operator *( unsigned long b, const ::timespec& a ) +{ return a * b; } // timespec& operator =( timespec& a, const timespec& b ); -timespec& operator +=( timespec& a, const timespec& b ); -timespec& operator -=( timespec& a, const timespec& b ); -timespec& operator /=( timespec& a, unsigned b ); -timespec& operator /=( timespec& a, unsigned long b ); +::timespec& operator +=( ::timespec& a, const ::timespec& b ); +::timespec& operator -=( ::timespec& a, const ::timespec& b ); +::timespec& operator /=( ::timespec& a, unsigned b ); +::timespec& operator /=( ::timespec& a, unsigned long b ); +::timespec& operator *=( ::timespec& a, unsigned b ); +::timespec& operator *=( ::timespec& a, unsigned long b ); -bool operator >( const timespec& a, const timespec& b ); -bool operator >=( const timespec& a, const timespec& b ); -bool operator <( const timespec& a, const timespec& b ); -bool operator <=( const timespec& a, const timespec& b ); -bool operator ==( const timespec& a, const timespec& b ); -bool operator !=( const timespec& a, const timespec& b ); +bool operator >( const ::timespec& a, const ::timespec& b ); +bool operator >=( const ::timespec& a, const ::timespec& b ); +bool operator <( const ::timespec& a, const ::timespec& b ); +bool operator <=( const ::timespec& a, const ::timespec& b ); +bool operator ==( const ::timespec& a, const ::timespec& b ); +bool operator !=( const ::timespec& a, const ::timespec& b ); namespace xmt { +struct timespec : + public ::timespec +{ + timespec() + { tv_sec = 0; tv_nsec = 0; } + + timespec( time_t s, long ns ) + { tv_sec = s; tv_nsec = ns; } + + timespec( time_t s ) + { tv_sec = s; tv_nsec = 0; } + + timespec( const timespec& t ) + { tv_sec = t.tv_sec; tv_nsec = t.tv_nsec; } + + timespec( const ::timespec& t ) + { tv_sec = t.tv_sec; tv_nsec = t.tv_nsec; } + + timespec& operator =( const timespec& t ) + { tv_sec = t.tv_sec; tv_nsec = t.tv_nsec; return *this; } + + timespec& operator =( const ::timespec& t ) + { tv_sec = t.tv_sec; tv_nsec = t.tv_nsec; return *this; } + + timespec& operator =( time_t t ) + { tv_sec = t; tv_nsec = 0; return *this; } + + operator ::timespec() const + { return *this; } + + operator const ::timespec&() const + { return *this; } + + operator ::timespec&() + { return *this; } + + operator time_t() const + { return tv_sec; } + + operator double() const + { return tv_nsec == 0 ? static_cast<double>(tv_sec) : tv_sec + 1.0e-9 * tv_nsec; } +}; + // delay execution at least on time interval t -__FIT_DECLSPEC void delay( timespec *interval, timespec *remain ); +__FIT_DECLSPEC void delay( const ::timespec& interval, ::timespec& remain ); +__FIT_DECLSPEC void delay( const ::timespec& interval ); +inline void delay( const ::timespec *interval, ::timespec *remain ) +{ delay( *interval, *remain ); } +inline void delay( const ::timespec *interval ) +{ delay( *interval ); } // sleep at least up to time t -__FIT_DECLSPEC void sleep( timespec *abstime, timespec *real_time ); +__FIT_DECLSPEC void sleep( const ::timespec& abstime, ::timespec& real_time ); +__FIT_DECLSPEC void sleep( const ::timespec& abstime ); +inline void sleep( const ::timespec *abstime, ::timespec *real_time ) +{ sleep( *abstime, *real_time ); } +inline void sleep( const ::timespec *abstime ) +{ sleep( *abstime ); } // get precise time -__FIT_DECLSPEC void gettime( timespec *t ); +__FIT_DECLSPEC void gettime( ::timespec& t ); +inline void gettime( ::timespec *t ) +{ gettime( *t ); } } // namespace xmt Modified: trunk/complement/explore/include/mt/xmt.h =================================================================== --- trunk/complement/explore/include/mt/xmt.h 2006-12-14 14:23:00 UTC (rev 1456) +++ trunk/complement/explore/include/mt/xmt.h 2006-12-15 08:11:12 UTC (rev 1457) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/12/14 17:08:37 ptr> +// -*- C++ -*- Time-stamp: <06/12/15 03:03:00 ptr> /* * Copyright (c) 1997-1999, 2002-2006 @@ -1203,11 +1203,22 @@ #endif } - int wait_time( const timespec *abstime ); - int wait_delay( const timespec *abstime ); - int try_wait_time( const timespec *abstime ); - int try_wait_delay( const timespec *abstime ); + int wait_time( const ::timespec *abstime ); + int wait_time( const ::timespec& abstime ) + { return wait_time( &abstime ); } + int wait_delay( const ::timespec *abstime ); + int wait_delay( const ::timespec& abstime ) + { return wait_time( &abstime ); } + + int try_wait_time( const ::timespec *abstime ); + int try_wait_time( const ::timespec& abstime ) + { return try_wait_time( &abstime ); } + + int try_wait_delay( const ::timespec *abstime ); + int try_wait_delay( const ::timespec& abstime ) + { return try_wait_delay( &abstime ); } + int signal( bool _broadcast = false ) { __Locker<__Mutex<false,SCOPE> > _x1( _lock ); @@ -1310,8 +1321,12 @@ #endif } - __FIT_DECLSPEC int wait_time( const timespec *t ); // wait for time t, or signal - __FIT_DECLSPEC int wait_delay( const timespec *t ); // wait, timeout is delay t, or signal + __FIT_DECLSPEC int wait_time( const ::timespec *t ); // wait for time t, or signal + int wait_time( const ::timespec& t ) + { return wait_time( &t ); } + __FIT_DECLSPEC int wait_delay( const ::timespec *t ); // wait, timeout is delay t, or signal + int wait_delay( const ::timespec& t ) + { return wait_delay( &t ); } int try_wait() { @@ -1385,6 +1400,9 @@ __FIT_DECLSPEC void fork() throw( fork_in_parent, std::runtime_error ); __FIT_DECLSPEC void become_daemon() throw( fork_in_parent, std::runtime_error ); +__FIT_DECLSPEC void block_signal( int sig ); +__FIT_DECLSPEC void unblock_signal( int sig ); +__FIT_DECLSPEC void signal_handler( int sig, SIG_PF ); class Thread { @@ -1474,21 +1492,8 @@ #ifdef __FIT_UITHREADS static __FIT_DECLSPEC int join_all(); #endif - static __FIT_DECLSPEC void block_signal( int sig ); - static __FIT_DECLSPEC void unblock_signal( int sig ); - static __FIT_DECLSPEC void signal_handler( int sig, SIG_PF ); static __FIT_DECLSPEC void signal_exit( int sig ); // signal handler - // sleep at least up to time t - static void sleep( timespec *t, timespec *e = 0 ) - { xmt::sleep( t, e ); } - // delay execution at least on time interval t - static void delay( timespec *t, timespec *e = 0 ) - { xmt::delay( t, e ); } - // get precise time - static void gettime( timespec *t ) - { xmt::gettime( t ); } - bool good() const { return (_state == goodbit) && (_id != bad_thread_id); } bool bad() const @@ -1581,7 +1586,7 @@ }; template <bool SCOPE> -int __Condition<SCOPE>::try_wait_time( const timespec *abstime ) +int __Condition<SCOPE>::try_wait_time( const ::timespec *abstime ) { #if defined(__FIT_WIN32THREADS) || defined(__FIT_NOVELL_THREADS) MT_LOCK( _lock ); @@ -1607,16 +1612,15 @@ #endif #if defined(__FIT_UITHREADS) || defined(_PTHREADS) int ret = 0; - timespec _abstime = *abstime; while ( !_val ) { # ifdef _PTHREADS - ret = pthread_cond_timedwait( &_cond, &_lock._M_lock, &_abstime ); + ret = pthread_cond_timedwait( &_cond, &_lock._M_lock, abstime ); if ( ret == ETIMEDOUT ) { break; } # endif # ifdef __FIT_UITHREADS - ret = cond_timedwait( &_cond, /* &_lock.mutex */ &_lock._M_lock, &_abstime ); + ret = cond_timedwait( &_cond, /* &_lock.mutex */ &_lock._M_lock, abstime ); if ( ret == ETIME ) { ret = ETIMEDOUT; } else if ( ret == ETIMEDOUT ) { @@ -1644,7 +1648,7 @@ } template <bool SCOPE> -int __Condition<SCOPE>::try_wait_delay( const timespec *interval ) +int __Condition<SCOPE>::try_wait_delay( const ::timespec *interval ) { #if defined(__FIT_WIN32THREADS) || defined(__FIT_NOVELL_THREADS) MT_LOCK( _lock ); @@ -1669,21 +1673,20 @@ return 0; #endif #if defined(__FIT_UITHREADS) || defined(_PTHREADS) - timespec ct; + ::timespec ct; xmt::gettime( &ct ); ct += *interval; int ret = 0; - timespec _abstime = ct; while ( !_val ) { # ifdef _PTHREADS - ret = pthread_cond_timedwait( &_cond, &_lock._M_lock, &_abstime ); + ret = pthread_cond_timedwait( &_cond, &_lock._M_lock, &ct ); if ( ret == ETIMEDOUT ) { break; } # endif # ifdef __FIT_UITHREADS - ret = cond_timedwait( &_cond, /* &_lock.mutex */ &_lock._M_lock, &_abstime ); + ret = cond_timedwait( &_cond, /* &_lock.mutex */ &_lock._M_lock, &ct ); if ( ret == ETIME ) { ret = ETIMEDOUT; } else if ( ret == ETIMEDOUT ) { @@ -1711,7 +1714,7 @@ } template <bool SCOPE> -int __Condition<SCOPE>::wait_time( const timespec *abstime ) +int __Condition<SCOPE>::wait_time( const ::timespec *abstime ) { #ifdef __FIT_WIN32THREADS MT_LOCK( _lock ); @@ -1733,8 +1736,7 @@ #ifdef _PTHREADS MT_REENTRANT( _lock, _x1 ); // ?? _val = false; - timespec _abstime = *abstime; - int ret = pthread_cond_timedwait( &_cond, &_lock._M_lock, &_abstime ); + int ret = pthread_cond_timedwait( &_cond, &_lock._M_lock, abstime ); if ( ret == ETIMEDOUT ) { _val = true; } @@ -1744,9 +1746,8 @@ MT_REENTRANT( _lock, _x1 ); _val = false; int ret; - timespec _abstime = *abstime; while ( !_val ) { - ret = cond_timedwait( &_cond, /* &_lock.mutex */ &_lock._M_lock, &_abstime ); + ret = cond_timedwait( &_cond, /* &_lock.mutex */ &_lock._M_lock, abstime ); if ( ret == ETIME ) { _val = true; ret = ETIMEDOUT; @@ -1771,7 +1772,7 @@ } template <bool SCOPE> -int __Condition<SCOPE>::wait_delay( const timespec *interval ) +int __Condition<SCOPE>::wait_delay( const ::timespec *interval ) { #ifdef __FIT_WIN32THREADS MT_LOCK( _lock ); @@ -1790,7 +1791,7 @@ return 0; #endif #if defined(__FIT_UITHREADS) || defined(_PTHREADS) - timespec ct; + ::timespec ct; xmt::gettime( &ct ); ct += *interval; Modified: trunk/complement/explore/include/sockios/sockmgr.cc =================================================================== --- trunk/complement/explore/include/sockios/sockmgr.cc 2006-12-14 14:23:00 UTC (rev 1456) +++ trunk/complement/explore/include/sockios/sockmgr.cc 2006-12-15 08:11:12 UTC (rev 1457) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/12/13 18:07:06 ptr> +// -*- C++ -*- Time-stamp: <06/12/15 01:27:36 ptr> /* * Copyright (c) 1997-1999, 2002, 2003, 2005, 2006 @@ -397,7 +397,7 @@ c = me->_conn_pool.front(); me->_conn_pool.pop_front(); _non_empty = true; - xmt::Thread::gettime( &me->_tpop ); + xmt::gettime( &me->_tpop ); } me->_dlock.unlock(); @@ -434,7 +434,7 @@ c = me->_conn_pool.front(); me->_conn_pool.pop_front(); _non_empty = true; - xmt::Thread::gettime( &me->_tpop ); + xmt::gettime( &me->_tpop ); break; } me->_pool_cnd.set( false ); @@ -485,14 +485,14 @@ // queue not empty and not decrease me->mgr.launch( connect_processor, me /* , 0, 0, PTHREAD_STACK_MIN * 2 */ ); } else { - xmt::Thread::gettime( &now ); + xmt::gettime( &now ); if ( (tpop + delta) < now ) { // a long time was since last pop from queue me->mgr.launch( connect_processor, me /* , 0, 0, PTHREAD_STACK_MIN * 2 */ ); } } } - xmt::Thread::delay( &alarm ); + xmt::delay( &alarm ); } else { if ( me->_observer_cnd.try_wait_delay( &idle ) != 0 ) { MT_REENTRANT( me->_orlock, _1 ); Modified: trunk/complement/explore/include/stem/Cron.h =================================================================== --- trunk/complement/explore/include/stem/Cron.h 2006-12-14 14:23:00 UTC (rev 1456) +++ trunk/complement/explore/include/stem/Cron.h 2006-12-15 08:11:12 UTC (rev 1457) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/08/04 00:02:55 ptr> +// -*- C++ -*- Time-stamp: <06/12/15 03:20:55 ptr> /* * Copyright (c) 1998, 2002, 2003, 2005 @@ -7,16 +7,8 @@ * Copyright (c) 1999-2001 * ParallelGraphics Ltd. * - * Licensed under the Academic Free License version 2.1 + * Licensed under the Academic Free License version 3.0 * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. */ #ifndef __stem_Cron_h @@ -40,6 +32,7 @@ #include <ctime> #include <mt/xmt.h> +#include <mt/time.h> #include <queue> @@ -58,8 +51,8 @@ n( static_cast<unsigned>(infinite) ), arg( 0 ) { - start.tv_sec = immediate; start.tv_nsec = 0; - period.tv_sec = 0; period.tv_nsec = 0; + start = immediate; + period = 0; } CronEntry( const CronEntry& x ) : @@ -67,15 +60,15 @@ n( x.n ), arg( x.arg ) { - start.tv_sec = x.start.tv_sec; start.tv_nsec = x.start.tv_nsec; - period.tv_sec = x.period.tv_sec; period.tv_nsec = x.period.tv_nsec; + start = x.start; + period = x.period; } code_type code; // time_t start; - timespec start; + xmt::timespec start; // time_t end; - timespec period; + xmt::timespec period; uint32_t n; uint32_t arg; @@ -94,9 +87,9 @@ count( 0 ), arg( 0 ) { - expired.tv_sec = 0; expired.tv_nsec = 0; - start.tv_sec = 0; start.tv_nsec = 0; - period.tv_sec = 0; period.tv_nsec = 0; + expired = 0; + start = 0; + period = 0; } __CronEntry( const __CronEntry& x ) : @@ -106,55 +99,40 @@ count( x.count ), arg( x.arg ) { - expired.tv_sec = x.expired.tv_sec; expired.tv_nsec = x.expired.tv_nsec; - start.tv_sec = x.start.tv_sec; start.tv_nsec = x.start.tv_nsec; - period.tv_sec = x.period.tv_sec; period.tv_nsec = x.period.tv_nsec; + expired = x.expired; + start = x.start; + period = x.period; } - timespec expired; + xmt::timespec expired; code_type code; addr_type addr; - timespec start; - timespec period; + xmt::timespec start; + xmt::timespec period; unsigned n; unsigned count; unsigned arg; - -#if 0 - operator <( const __CronEntry& __x ) const - { return expired.tv_sec < __x.expired.tv_sec ? true : - expired.tv_sec > __x.expired.tv_sec ? false : - expired.tv_nsec < __x.expired.tv_nsec; } - operator >( const __CronEntry& __x ) const - { return expired.tv_sec > __x.expired.tv_sec ? true : - expired.tv_sec < __x.expired.tv_sec ? false : - expired.tv_nsec > __x.expired.tv_nsec; } - operator ==( const __CronEntry& __x ) const - { return expired.tv_sec == __x.expired.tv_sec && - expired.tv_nsec == __x.expired.tv_nsec; } -#endif }; inline bool operator <( const __CronEntry& __l, const __CronEntry& __r ) -{ return __l.expired.tv_sec < __r.expired.tv_sec ? true : - __l.expired.tv_sec > __r.expired.tv_sec ? false : - __l.expired.tv_nsec < __r.expired.tv_nsec; } +{ return __l.expired < __r.expired; } inline bool operator >( const __CronEntry& __l, const __CronEntry& __r ) -{ return __l.expired.tv_sec > __r.expired.tv_sec ? true : - __l.expired.tv_sec < __r.expired.tv_sec ? false : - __l.expired.tv_nsec > __r.expired.tv_nsec; } +{ return __l.expired > __r.expired; } inline bool operator ==( const __CronEntry& __l, const __CronEntry& __r ) -{ return __l.expired.tv_sec == __r.expired.tv_sec && - __l.expired.tv_nsec == __r.expired.tv_nsec; } +{ return __l.expired == __r.expired; } +inline +bool operator !=( const __CronEntry& __l, const __CronEntry& __r ) +{ return __l.expired != __r.expired; } + class Cron : public EventHandler { Modified: trunk/complement/explore/inquiry/makes/static-lib/Makefile =================================================================== --- trunk/complement/explore/inquiry/makes/static-lib/Makefile 2006-12-14 14:23:00 UTC (rev 1456) +++ trunk/complement/explore/inquiry/makes/static-lib/Makefile 2006-12-15 08:11:12 UTC (rev 1457) @@ -6,11 +6,15 @@ include Makefile.inc include ${SRCROOT}/Makefiles/top.mak +PHONY += qq # $(foreach ${LIBNAMES}) +qq: testx2 +testx2: DEFS += -Dtestx2 + define P_TEMPLATE $(1): $$($(1)_SRC_CPP) - echo "$$+ $$@ " + echo "$$+ $$@ $${DEFS}" endef $(foreach name,${LIBNAMES},$(eval $(call P_TEMPLATE,$(name)))) Modified: trunk/complement/explore/lib/DB/PgSQL/PgSQL.cc =================================================================== --- trunk/complement/explore/lib/DB/PgSQL/PgSQL.cc 2006-12-14 14:23:00 UTC (rev 1456) +++ trunk/complement/explore/lib/DB/PgSQL/PgSQL.cc 2006-12-15 08:11:12 UTC (rev 1457) @@ -1,21 +1,14 @@ -// -*- C++ -*- Time-stamp: <05/09/11 12:01:55 ptr> +// -*- C++ -*- Time-stamp: <06/12/15 01:45:37 ptr> /* - * * Copyright (c) 2002 * Petr Ovtchenkov * * Copyright (c) 1999-2001 * ParallelGraphics Ltd. * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. + * Licensed under the Academic Free License Version 3.0 * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. */ #include <config/feature.h> @@ -60,7 +53,7 @@ con_cond.set( false ); thr.launch( conn_proc, this ); timespec tm; - xmt::Thread::gettime( &tm ); + xmt::gettime( &tm ); tm.tv_sec += 10; // wait 10 secs @@ -119,7 +112,7 @@ if ( thr.good() ) { timespec tm; - xmt::Thread::gettime( &tm ); + xmt::gettime( &tm ); tm.tv_sec += 2; // thread already running, so wait only 2 secs @@ -128,9 +121,9 @@ _dberr << "Connect to DB timeout" << endl; } } else { - thr.launch( (__impl::Thread::entrance_type)conn_proc, (void *)this ); + thr.launch( (xmt::Thread::entrance_type)conn_proc, (void *)this ); timespec tm; - xmt::Thread::gettime( &tm ); + xmt::gettime( &tm ); tm.tv_sec += 5; // wait 5 secs Modified: trunk/complement/explore/lib/mt/ChangeLog =================================================================== --- trunk/complement/explore/lib/mt/ChangeLog 2006-12-14 14:23:00 UTC (rev 1456) +++ trunk/complement/explore/lib/mt/ChangeLog 2006-12-15 08:11:12 UTC (rev 1457) @@ -1,3 +1,13 @@ +2006-12-15 Petr Ovtchenkov <pt...@is...> + + * time.h, time.cc: add timespec in xmt namespace, useful + for conversions and inline objects; clean some code in + timespec operations. + + * xmt.h: changes related to timespec in xmt namespace and in + global namespace; now 'delay' functions family only in xmt + namespace and go away from Thread class. + 2006-12-14 Petr Ovtchenkov <pt...@is...> * xmt.h, xmt.cc: move 'fork' and 'become_daemon' from Thread Modified: trunk/complement/explore/lib/mt/time.cc =================================================================== --- trunk/complement/explore/lib/mt/time.cc 2006-12-14 14:23:00 UTC (rev 1456) +++ trunk/complement/explore/lib/mt/time.cc 2006-12-15 08:11:12 UTC (rev 1457) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/10/24 09:26:53 ptr> +// -*- C++ -*- Time-stamp: <06/12/15 10:35:48 ptr> /* * Copyright (c) 2002, 2003, 2006 @@ -85,8 +85,8 @@ double d = a.tv_sec + 1.0e-9 * a.tv_nsec; d /= b; - c.tv_nsec = int(1.0e9 * modf( d, &d ) + 0.5); - c.tv_sec = int(d); + c.tv_nsec = static_cast<time_t>(1.0e9 * modf( d, &d ) + 0.5); + c.tv_sec = static_cast<long>(d); return c; } @@ -97,12 +97,50 @@ double d = a.tv_sec + 1.0e-9 * a.tv_nsec; d /= b; - c.tv_nsec = int(1.0e9 * modf( d, &d ) + 0.5); - c.tv_sec = int(d); + c.tv_nsec = static_cast<time_t>(1.0e9 * modf( d, &d ) + 0.5); + c.tv_sec = static_cast<long>(d); return c; } +timespec operator *( const timespec& a, unsigned b ) +{ + timespec c; +#if 0 + double d = a.tv_sec + 1.0e-9 * a.tv_nsec; + d *= b; + + c.tv_nsec = static_cast<time_t>(1.0e9 * modf( d, &d ) + 0.5); + c.tv_sec = static_cast<long>(d); +#else + c.tv_sec = a.tv_sec * b; + unsigned long long _tmp = c.tv_nsec; + _tmp *= b; + c.tv_sec += static_cast<time_t>(_tmp / 1000000000UL); + c.tv_nsec = static_cast<long>(_tmp % 1000000000UL); +#endif + return c; +} + +timespec operator *( const timespec& a, unsigned long b ) +{ + timespec c; +#if 0 + double d = a.tv_sec + 1.0e-9 * a.tv_nsec; + d *= b; + + c.tv_nsec = static_cast<time_t>(1.0e9 * modf( d, &d ) + 0.5); + c.tv_sec = static_cast<long>(d); +#else + c.tv_sec = a.tv_sec * b; + unsigned long long _tmp = c.tv_nsec; + _tmp *= b; + c.tv_sec += static_cast<time_t>(_tmp / 1000000000UL); + c.tv_nsec = static_cast<long>(_tmp % 1000000000UL); +#endif + return c; +} + timespec& operator +=( timespec& a, const timespec& b ) { a.tv_sec += b.tv_sec; @@ -133,8 +171,8 @@ double d = a.tv_sec + 1.0e-9 * a.tv_nsec; d /= b; - a.tv_nsec = int(1.0e9 * modf( d, &d ) + 0.5); - a.tv_sec = int(d); + a.tv_nsec = static_cast<time_t>(1.0e9 * modf( d, &d ) + 0.5); + a.tv_sec = static_cast<long>(d); return a; } @@ -144,12 +182,34 @@ double d = a.tv_sec + 1.0e-9 * a.tv_nsec; d /= b; - a.tv_nsec = int(1.0e9 * modf( d, &d ) + 0.5); - a.tv_sec = int(d); + a.tv_nsec = static_cast<time_t>(1.0e9 * modf( d, &d ) + 0.5); + a.tv_sec = static_cast<long>(d); return a; } +timespec& operator *=( timespec& a, unsigned b ) +{ + a.tv_sec *= b; + unsigned long long _tmp = a.tv_nsec; + _tmp *= b; + a.tv_sec += static_cast<time_t>(_tmp / 1000000000UL); + a.tv_nsec = static_cast<long>(_tmp % 1000000000UL); + + return a; +} + +timespec& operator *=( timespec& a, unsigned long b ) +{ + a.tv_sec *= b; + unsigned long long _tmp = a.tv_nsec; + _tmp *= b; + a.tv_sec += static_cast<time_t>(_tmp / 1000000000UL); + a.tv_nsec = static_cast<long>(_tmp % 1000000000UL); + + return a; +} + bool operator ==( const timespec& a, const timespec& b ) { return (a.tv_sec == b.tv_sec) && (a.tv_nsec == b.tv_nsec); @@ -207,97 +267,126 @@ namespace xmt { __FIT_DECLSPEC -void delay( timespec *interval, timespec *remain ) +void delay( const ::timespec& interval, ::timespec& remain ) { #ifdef __unix - nanosleep( interval, remain ); + nanosleep( &interval, &remain ); #endif #ifdef WIN32 - unsigned ms = interval->tv_sec * 1000 + interval->tv_nsec / 1000000; - Sleep( ms ); - if ( remain != 0 ) { // M$ not return remain time interval - remain->tv_sec = 0; - remain->tv_nsec = 0; - } + Sleep( interval.tv_sec * 1000 + interval.tv_nsec / 1000000 ); + remain.tv_sec = 0; + remain.tv_nsec = 0; #endif #ifdef __FIT_NETWARE - unsigned ms = interval->tv_sec * 1000 + interval->tv_nsec / 1000000; - ::delay( ms ); - if ( remain != 0 ) { // Novell not return remain time interval - remain->tv_sec = 0; - remain->tv_nsec = 0; - } + ::delay( interval.tv_sec * 1000 + interval.tv_nsec / 1000000 ); + remain.tv_sec = 0; + remain.tv_nsec = 0; #endif } __FIT_DECLSPEC -void sleep( timespec *abstime, timespec *real_time ) +void delay( const ::timespec& interval ) { #ifdef __unix - timespec ct; - gettime( &ct ); - timespec st = *abstime; + nanosleep( &interval, 0 ); +#endif +#ifdef WIN32 + Sleep( interval.tv_sec * 1000 + interval.tv_nsec / 1000000 ); +#endif +#ifdef __FIT_NETWARE + ::delay( interval.tv_sec * 1000 + interval.tv_nsec / 1000000 ); +#endif +} - if ( st > ct ) { +__FIT_DECLSPEC +void sleep( const ::timespec& abstime, ::timespec& real_time ) +{ +#ifdef __unix + ::timespec ct; + gettime( ct ); + + if ( abstime > ct ) { + xmt::timespec st( abstime ); st -= ct; - nanosleep( &st, real_time ); - if ( real_time != 0 ) { - *real_time += ct; - } - } else if ( real_time != 0 ) { - *real_time = ct; + nanosleep( static_cast<const ::timespec *>(&st), &real_time ); + real_time += ct; + } else { + real_time.tv_sec = ct.tv_sec; + real_time.tv_nsec = ct.tv_nsec; } #endif #ifdef WIN32 time_t ct = time( 0 ); - time_t _conv = abstime->tv_sec * 1000 + abstime->tv_nsec / 1000000; + time_t _conv = abstime.tv_sec * 1000 + abstime.tv_nsec / 1000000; - unsigned ms = _conv >= ct ? _conv - ct : 1; - Sleep( ms ); - if ( real_time != 0 ) { // M$ not return elapsed time interval - real_time->tv_sec = abstime->tv_sec; - real_time->tv_nsec = abstime->tv_nsec; - } + Sleep( _conv >= ct ? _conv - ct : 1 ); + real_time.tv_sec = abstime.tv_sec; + real_time.tv_nsec = abstime.tv_nsec; #endif #ifdef __FIT_NETWARE time_t ct = time( 0 ); - time_t _conv = abstime->tv_sec * 1000 + abstime->tv_nsec / 1000000; + time_t _conv = abstime.tv_sec * 1000 + abstime.tv_nsec / 1000000; - unsigned ms = _conv >= ct ? _conv - ct : 1; - ::delay( ms ); - if ( real_time != 0 ) { // Novell not return elapsed time interval - real_time->tv_sec = abstime->tv_sec; - real_time->tv_nsec = abstime->tv_nsec; + ::delay( _conv >= ct ? _conv - ct : 1 ); + // Novell not return elapsed time interval + real_time.tv_sec = abstime.tv_sec; + real_time.tv_nsec = abstime.tv_nsec; +#endif +} + +__FIT_DECLSPEC +void sleep( const ::timespec& abstime ) +{ +#ifdef __unix + ::timespec ct; + gettime( ct ); + + if ( abstime > ct ) { + xmt::timespec st( abstime ); + st -= ct; + nanosleep( static_cast<const ::timespec *>(&st), 0 ); } #endif +#ifdef WIN32 + time_t ct = time( 0 ); + time_t _conv = abstime.tv_sec * 1000 + abstime.tv_nsec / 1000000; + + Sleep( _conv >= ct ? _conv - ct : 1 ); +#endif +#ifdef __FIT_NETWARE + time_t ct = time( 0 ); + time_t _conv = abstime.tv_sec * 1000 + abstime.tv_nsec / 1000000; + + ::delay( _conv >= ct ? _conv - ct : 1 ); +#endif } __FIT_DECLSPEC -void gettime( timespec *t ) +void gettime( ::timespec& t ) { #if defined(__linux) || defined(__FreeBSD__) || defined(__OpenBSD__) timeval tv; gettimeofday( &tv, 0 ); - TIMEVAL_TO_TIMESPEC( &tv, t ); + TIMEVAL_TO_TIMESPEC( &tv, &t ); #elif defined( WIN32 ) union { FILETIME ft; // 100 ns intervals since Jan 1 1601 (UTC) __int64 t; } ft; GetSystemTimeAsFileTime( &ft.ft ); - t->tv_sec = int(ft.t / (__int64)10000000 - (__int64)(11644473600)); // 60 * 60 * 24 * 134774, 1970 - 1601 - t->tv_nsec = int(ft.t % (__int64)(10000000)) * 100; + t.tv_sec = int(ft.t / (__int64)10000000 - (__int64)(11644473600)); // 60 * 60 * 24 * 134774, 1970 - 1601 + t.tv_nsec = int(ft.t % (__int64)(10000000)) * 100; //time_t ct = time( 0 ); //t->tv_sec = ct; // ct / 1000; //t->tv_nsec = 0; // (ct % 1000) * 1000000; #elif defined(__sun) || defined(__hpux) - clock_gettime( CLOCK_REALTIME, t ); + clock_gettime( CLOCK_REALTIME, &t ); #elif defined(__FIT_NETWARE) time_t ct = time(0); // GetHighResolutionTimer (ret current time in 100 microsec increments) // GetSuperHighResolutionTimer() (ret current time in 838 nanosec increments) - t->tv_sec = ct; - t->tv_nsec = 0; + t.tv_sec = ct; + t.tv_nsec = 0; #else #error "You should implement OS-dependent precise clock" #endif Modified: trunk/complement/explore/lib/mt/xmt.cc =================================================================== --- trunk/complement/explore/lib/mt/xmt.cc 2006-12-14 14:23:00 UTC (rev 1456) +++ trunk/complement/explore/lib/mt/xmt.cc 2006-12-15 08:11:12 UTC (rev 1457) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/12/14 17:12:53 ptr> +// -*- C++ -*- Time-stamp: <06/12/15 10:10:57 ptr> /* * Copyright (c) 1997-1999, 2002-2006 @@ -171,7 +171,7 @@ __FIT_DECLSPEC -int Semaphore::wait_time( const timespec *abstime ) // wait for time t, or signal +int Semaphore::wait_time( const ::timespec *abstime ) // wait for time t, or signal { #ifdef __FIT_WIN32THREADS time_t ct = time( 0 ); @@ -204,7 +204,7 @@ } __FIT_DECLSPEC -int Semaphore::wait_delay( const timespec *interval ) // wait, timeout is delay t, or signal +int Semaphore::wait_delay( const ::timespec *interval ) // wait, timeout is delay t, or signal { #ifdef __FIT_WIN32THREADS unsigned ms = interval->tv_sec * 1000 + interval->tv_nsec / 1000000; @@ -219,7 +219,7 @@ #endif #ifdef _PTHREADS timespec st; - Thread::gettime( &st ); + xmt::gettime( &st ); st += *interval; # if !(defined(__FreeBSD__) || defined(__OpenBSD__)) return sem_timedwait( &_sem, &st ); @@ -623,8 +623,46 @@ #endif __FIT_DECLSPEC -void Thread::block_signal( int sig ) +void Thread::signal_exit( int sig ) { +#ifdef _PTHREADS + _uw_alloc_type *user_words = + static_cast<_uw_alloc_type *>(pthread_getspecific( Thread::_mt_key )); + if ( user_words == 0 ) { + // async signal unsafe? or wrong thread called? + // this a bad point, do nothing + return; + } + user_words += Thread::_self_idx; + Thread *me = reinterpret_cast<Thread *>(*reinterpret_cast<void **>(user_words)); + // _STLP_ASSERT( me->is_self() ); + + me->_state = badbit; + // follow part of _call + if ( (me->_flags & (daemon | detached)) != 0 ) { // otherwise join expected + me->_id = bad_thread_id; + } + me->_dealloc_uw(); // clear user words + void *_param = me->_param; + size_t _param_sz = me->_param_sz; + try { + if ( _param_sz > sizeof(void *) ) { // that's allocated + delete [] __STATIC_CAST(char *,_param); + _param_sz = 0; + _param = 0; + } + } + catch ( ... ) { + } +#endif + // well, this is suspicious, due to pthread_exit isn't async signal + // safe; what I should use here? + Thread::_exit( 0 ); +} + +__FIT_DECLSPEC +void block_signal( int sig ) +{ #ifdef __unix sigset_t sigset; @@ -640,7 +678,7 @@ } __FIT_DECLSPEC -void Thread::unblock_signal( int sig ) +void unblock_signal( int sig ) { #ifdef __unix sigset_t sigset; @@ -657,7 +695,7 @@ } __FIT_DECLSPEC -void Thread::signal_handler( int sig, SIG_PF handler ) +void signal_handler( int sig, SIG_PF handler ) { #ifdef __unix // catch SIGPIPE here struct sigaction act; @@ -672,44 +710,6 @@ } __FIT_DECLSPEC -void Thread::signal_exit( int sig ) -{ -#ifdef _PTHREADS - _uw_alloc_type *user_words = - static_cast<_uw_alloc_type *>(pthread_getspecific( _mt_key )); - if ( user_words == 0 ) { - // async signal unsafe? or wrong thread called? - // this a bad point, do nothing - return; - } - user_words += Thread::_self_idx; - Thread *me = reinterpret_cast<Thread *>(*reinterpret_cast<void **>(user_words)); - // _STLP_ASSERT( me->is_self() ); - - me->_state = badbit; - // follow part of _call - if ( (me->_flags & (daemon | detached)) != 0 ) { // otherwise join expected - me->_id = bad_thread_id; - } - me->_dealloc_uw(); // clear user words - void *_param = me->_param; - size_t _param_sz = me->_param_sz; - try { - if ( _param_sz > sizeof(void *) ) { // that's allocated - delete [] __STATIC_CAST(char *,_param); - _param_sz = 0; - _param = 0; - } - } - catch ( ... ) { - } -#endif - // well, this is suspicious, due to pthread_exit isn't async signal - // safe; what I should use here? - Thread::_exit( 0 ); -} - -__FIT_DECLSPEC void fork() throw( fork_in_parent, std::runtime_error ) { #ifdef __unix Modified: trunk/complement/explore/lib/stem/Cron.cc =================================================================== --- trunk/complement/explore/lib/stem/Cron.cc 2006-12-14 14:23:00 UTC (rev 1456) +++ trunk/complement/explore/lib/stem/Cron.cc 2006-12-15 08:11:12 UTC (rev 1457) @@ -1,22 +1,14 @@ -// -*- C++ -*- Time-stamp: <06/08/04 00:01:51 ptr> +// -*- C++ -*- Time-stamp: <06/12/15 03:12:28 ptr> /* - * Copyright (c) 1998, 2002, 2003, 2005 + * Copyright (c) 1998, 2002, 2003, 2005, 2006 * Petr Ovtchenkov * * Copyright (c) 1999-2001 * ParallelGraphics Ltd. * - * Licensed under the Academic Free License version 2.1 + * Licensed under the Academic Free License version 3.0 * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. */ #ifdef _MSC_VER @@ -71,16 +63,13 @@ en.code = ne.code; en.addr = entry.src(); - en.start.tv_sec = ne.start.tv_sec; - en.start.tv_nsec = ne.start.tv_nsec; + en.start = ne.start; en.n = ne.n; en.arg = ne.arg; if ( en.n == 1 ) { - en.period.tv_sec = 0; - en.period.tv_nsec = 0; + en.period = 0; } else { - en.period.tv_sec = ne.period.tv_sec; - en.period.tv_nsec = ne.period.tv_nsec; + en.period = ne.period; if ( en.n == 0 || en.period.tv_nsec >= 1000000000 || (en.period.tv_sec == 0 && en.period.tv_nsec == 0) ) return; @@ -91,8 +80,7 @@ en.start.tv_sec = current; } - en.expired.tv_sec = en.start.tv_sec; - en.expired.tv_nsec = en.start.tv_nsec; + en.expired = en.start; en.count = 0; MT_REENTRANT( _M_l, _x1 ); @@ -231,31 +219,13 @@ continue; } -#if !defined(_STLP_LONG_LONG) && !defined(_GLIBCXX_USE_LONG_LONG) - double _next = en.start.tv_sec + en.start.tv_nsec * 1.0e-9 + - (en.period.tv_sec + en.period.tv_nsec * 1.0e-9) * ++en.count; - en.expired.tv_nsec = static_cast<long>(1.0e9 * modf( _next, &_next )); - en.expired.tv_sec = static_cast<long>(_next); -#else -# ifdef _MSC_VER - __int64 -# else - long long -# endif - _d = en.period.tv_nsec; - _d *= ++en.count; - _d += en.start.tv_nsec; - en.expired.tv_sec = en.period.tv_sec; - en.expired.tv_sec *= en.count; - en.expired.tv_sec += en.start.tv_sec; - en.expired.tv_sec += unsigned(_d / 1000000000); - en.expired.tv_nsec = unsigned(_d % 1000000000); -#endif + en.expired = en.start; + en.expired += en.period * ++en.count; + // if loop infinite, always put Cron entry in stack, // otherwise check counter if ( en.n == CronEntry::infinite ) { - en.start.tv_sec = en.expired.tv_sec; - en.start.tv_nsec = en.expired.tv_nsec; + en.start = en.expired; en.count = 0; me._M_c.push( en ); } else if ( (en.count) < (en.n) ) { // This SC5.0 patch 107312-06 bug Modified: trunk/complement/explore/test/mt/flck.cc =================================================================== --- trunk/complement/explore/test/mt/flck.cc 2006-12-14 14:23:00 UTC (rev 1456) +++ trunk/complement/explore/test/mt/flck.cc 2006-12-15 08:11:12 UTC (rev 1457) @@ -1,23 +1,14 @@ -// -*- C++ -*- Time-stamp: <06/08/04 11:21:10 ptr> +// -*- C++ -*- Time-stamp: <06/12/15 10:43:07 ptr> /* - * * Copyright (c) 2004, 2006 * Petr Ovtchenkov * * Copyright (c) 2004 * Kaspersky Labs * - * Licensed under the Academic Free License Version 2.1 + * Licensed under the Academic Free License Version 3.0 * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. */ #include <boost/test/unit_test.hpp> @@ -74,12 +65,8 @@ ++cnt; m.unlock(); - timespec t; - t.tv_sec = 1; - t.tv_nsec = 0; + delay( xmt::timespec(1,0) ); - Thread::delay( &t ); - check = flck( fd, _F_UNLCK ); b.lock(); @@ -195,12 +182,8 @@ } } - timespec t; - t.tv_sec = 1; - t.tv_nsec = 0; + delay( xmt::timespec(1,0) ); - Thread::delay( &t ); - check = flck( fd, _F_UNLCK ); b.lock(); Modified: trunk/complement/explore/test/mt/lfs.cc =================================================================== --- trunk/complement/explore/test/mt/lfs.cc 2006-12-14 14:23:00 UTC (rev 1456) +++ trunk/complement/explore/test/mt/lfs.cc 2006-12-15 08:11:12 UTC (rev 1457) @@ -1,23 +1,14 @@ -// -*- C++ -*- Time-stamp: <06/08/04 11:25:15 ptr> +// -*- C++ -*- Time-stamp: <06/12/15 10:44:27 ptr> /* - * * Copyright (c) 2004, 2006 * Petr Ovtchenkov * * Copyright (c) 2004 * Kaspersky Lab * - * Licensed under the Academic Free License Version 2.1 + * Licensed under the Academic Free License Version 3.0 * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. */ #include <boost/test/unit_test.hpp> @@ -72,12 +63,8 @@ cnd.set( true, true ); - timespec t; - t.tv_sec = 1; - t.tv_nsec = 0; + delay( xmt::timespec(1,0) ); - Thread::delay( &t ); - s.unlock(); b.lock(); @@ -142,12 +129,8 @@ b.unlock(); } - timespec t; - t.tv_sec = 1; - t.tv_nsec = 0; + delay( xmt::timespec(1,0) ); - Thread::delay( &t ); - s.unlock(); b.lock(); BOOST_REQUIRE( s.good() ); @@ -190,12 +173,8 @@ cnd.set( true, true ); - timespec t; - t.tv_sec = 1; - t.tv_nsec = 0; + delay( xmt::timespec(1,0) ); - Thread::delay( &t ); - s << ulck; b.lock(); @@ -245,12 +224,8 @@ b.unlock(); } - timespec t; - t.tv_sec = 1; - t.tv_nsec = 0; + delay( xmt::timespec(1,0) ); - Thread::delay( &t ); - s >> ulck; b.lock(); BOOST_REQUIRE( s.good() ); Modified: trunk/complement/explore/test/mt/mutex_test.cc =================================================================== --- trunk/complement/explore/test/mt/mutex_test.cc 2006-12-14 14:23:00 UTC (rev 1456) +++ trunk/complement/explore/test/mt/mutex_test.cc 2006-12-15 08:11:12 UTC (rev 1457) @@ -1,20 +1,11 @@ -// -*- C++ -*- Time-stamp: <06/08/04 10:59:26 ptr> +// -*- C++ -*- Time-stamp: <06/12/15 10:37:09 ptr> /* - * * Copyright (c) 2002, 2003, 2006 * Petr Ovtchenkov * - * Licensed under the Academic Free License Version 2.1 + * Licensed under the Academic Free License Version 3.0 * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. */ #include <boost/test/unit_test.hpp> @@ -24,7 +15,7 @@ #include <mt/xmt.h> using namespace std; -using namespace __impl; +using namespace xmt; static Mutex m1; @@ -37,12 +28,8 @@ msync = 1; BOOST_CHECK( v == 0 ); - timespec t; - t.tv_sec = 1; - t.tv_nsec = 0; + delay( xmt::timespec( 1, 0 ) ); - Thread::delay( &t ); - BOOST_CHECK( v == 0 ); v = 1; @@ -78,12 +65,8 @@ BOOST_CHECK( v == 0 ); - timespec t; - t.tv_sec = 1; - t.tv_nsec = 0; + delay( xmt::timespec( 1, 0 ) ); - Thread::delay( &t ); - v = 1; m1.unlock(); Modified: trunk/complement/explore/test/mt/recursive_mutex.cc =================================================================== --- trunk/complement/explore/test/mt/recursive_mutex.cc 2006-12-14 14:23:00 UTC (rev 1456) +++ trunk/complement/explore/test/mt/recursive_mutex.cc 2006-12-15 08:11:12 UTC (rev 1457) @@ -1,19 +1,11 @@ -// -*- C++ -*- Time-stamp: <06/08/04 11:07:52 ptr> +// -*- C++ -*- Time-stamp: <06/12/15 10:39:45 ptr> /* * Copyright (c) 2003, 2006 * Petr Ovtchenkov * - * Licensed under the Academic Free License Version 2.1 + * Licensed under the Academic Free License Version 3.0 * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. */ @@ -64,12 +56,8 @@ m.lock(); v = 2; - timespec t; - t.tv_sec = 1; - t.tv_nsec = 0; - - Thread::sleep( &t ); + xmt::sleep( xmt::timespec(1,0) ); BOOST_CHECK( v == 2 ); m.unlock(); @@ -94,13 +82,8 @@ // cerr << "after lock in thread one" << endl; // pm.unlock(); - timespec t; + xmt::sleep( xmt::timespec(1,0) ); - t.tv_sec = 1; - t.tv_nsec = 0; - - Thread::sleep( &t ); - BOOST_CHECK( v == 1 ); recursive(); @@ -139,13 +122,7 @@ // pm.unlock(); BOOST_CHECK( v == 3 ); - - timespec t; - - t.tv_sec = 1; - t.tv_nsec = 0; - - Thread::sleep( &t ); + xmt::sleep( xmt::timespec(1,0) ); recursive(); // pm.lock(); Modified: trunk/complement/explore/test/mt/signal-1.cc =================================================================== --- trunk/complement/explore/test/mt/signal-1.cc 2006-12-14 14:23:00 UTC (rev 1456) +++ trunk/complement/explore/test/mt/signal-1.cc 2006-12-15 08:11:12 UTC (rev 1457) @@ -1,19 +1,11 @@ -// -*- C++ -*- Time-stamp: <06/08/04 11:13:44 ptr> +// -*- C++ -*- Time-stamp: <06/12/15 10:40:53 ptr> /* * Copyright (c) 2003, 2006 * Petr Ovtchenkov * - * Licensed under the Academic Free License Version 2.1 + * Licensed under the Academic Free License Version 3.0 * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. */ #include <boost/test/unit_test.hpp> @@ -55,11 +47,11 @@ Thread::ret_code thread_one( void * ) { - Thread::unblock_signal( SIGINT ); // we wait this signal + xmt::unblock_signal( SIGINT ); // we wait this signal // Default handler make exit() call: // Thread::signal_handler( SIGINT, SIG_DFL ); // That's why I set own handler: - Thread::signal_handler( SIGINT, handler ); + xmt::signal_handler( SIGINT, handler ); BOOST_CHECK( v == 1 ); @@ -70,13 +62,10 @@ // wait while set thread's pointer (from thread_two) - timespec t; + xmt::timespec t(1,0); - t.tv_sec = 1; - t.tv_nsec = 0; - while ( th_one == 0 ) { - Thread::sleep( &t ); + xmt::sleep( t ); } // pm.lock(); Modified: trunk/complement/explore/test/mt/signal-2.cc =================================================================== --- trunk/complement/explore/test/mt/signal-2.cc 2006-12-14 14:23:00 UTC (rev 1456) +++ trunk/complement/explore/test/mt/signal-2.cc 2006-12-15 08:11:12 UTC (rev 1457) @@ -1,19 +1,11 @@ -// -*- C++ -*- Time-stamp: <06/08/04 11:16:33 ptr> +// -*- C++ -*- Time-stamp: <06/12/15 10:41:46 ptr> /* * Copyright (c) 2003, 2006 * Petr Ovtchenkov * - * Licensed under the Academic Free License Version 2.1 + * Licensed under the Academic Free License Version 3.0 * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. */ #include <boost/test/unit_test.hpp> @@ -56,20 +48,17 @@ rt.iword = 0; try { - Thread::unblock_signal( SIGINT ); // we wait this signal + xmt::unblock_signal( SIGINT ); // we wait this signal // I set own handler, that throw signal: - Thread::signal_handler( SIGINT, handler ); + xmt::signal_handler( SIGINT, handler ); BOOST_CHECK( v == 1 ); // wait while set thread's pointer (from thread_two) - timespec t; + xmt::timespec t(1,0); - t.tv_sec = 1; - t.tv_nsec = 0; - while ( th_one == 0 ) { - Thread::sleep( &t ); + xmt::sleep( t ); } // pm.lock(); Modified: trunk/complement/explore/test/mt/spinlock_test.cc =================================================================== --- trunk/complement/explore/test/mt/spinlock_test.cc 2006-12-14 14:23:00 UTC (rev 1456) +++ trunk/complement/explore/test/mt/spinlock_test.cc 2006-12-15 08:11:12 UTC (rev 1457) @@ -1,20 +1,11 @@ -// -*- C++ -*- Time-stamp: <06/08/04 11:05:07 ptr> +// -*- C++ -*- Time-stamp: <06/12/15 10:38:16 ptr> /* - * * Copyright (c) 2002, 2003, 2006 * Petr Ovtchenkov * - * Licensed under the Academic Free License Version 2.1 + * Licensed under the Academic Free License Version 3.0 * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. */ #include <boost/test/unit_test.hpp> @@ -24,7 +15,7 @@ #include <mt/xmt.h> using namespace std; -using namespace __impl; +using namespace xmt; static int v = 0; @@ -36,12 +27,8 @@ sl1.lock(); BOOST_CHECK( v == 0 ); - timespec t; - t.tv_sec = 1; - t.tv_nsec = 0; + delay( xmt::timespec( 1, 0 ) ); - Thread::delay( &t ); - BOOST_CHECK( v == 0 ); v = 1; @@ -72,12 +59,8 @@ BOOST_CHECK( v == 0 ); - timespec t; - t.tv_sec = 1; - t.tv_nsec = 0; + delay( xmt::timespec( 1, 0 ) ); - Thread::delay( &t ); - v = 1; sl1.unlock(); Modified: trunk/complement/explore/test/sockios/client-wc.cc =================================================================== --- trunk/complement/explore/test/sockios/client-wc.cc 2006-12-14 14:23:00 UTC (rev 1456) +++ trunk/complement/explore/test/sockios/client-wc.cc 2006-12-15 08:11:12 UTC (rev 1457) @@ -1,20 +1,11 @@ -// -*- C++ -*- Time-stamp: <06/08/04 12:01:50 ptr> +// -*- C++ -*- Time-stamp: <06/12/15 10:49:16 ptr> /* - * * Copyright (c) 2004, 2006 * Petr Ovtchenkov * - * Licensed under the Academic Free License Version 2.1 + * Licensed under the Academic Free License Version 3.0 * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. */ #include <boost/test/test_tools.hpp> @@ -51,12 +42,8 @@ { s << "hello" << endl; - timespec t; - t.tv_sec = 1; - t.tv_nsec = 0; + xmt::delay( xmt::timespec( 1, 0 ) ); - Thread::delay( &t ); - s.close(); // ::shutdown( s.rdbuf()->fd(), 2 ); } @@ -117,12 +104,8 @@ BOOST_CHECK( buf == "hello" ); pr_lock.unlock(); - timespec t; - t.tv_sec = 5; - t.tv_nsec = 0; + xmt::delay( xmt::timespec( 5, 0 ) ); - Thread::delay( &t ); - // sock << 'a' << endl; /* Modified: trunk/complement/explore/test/sockios/read0_on_exec.cc =================================================================== --- trunk/complement/explore/test/sockios/read0_on_exec.cc 2006-12-14 14:23:00 UTC (rev 1456) +++ trunk/complement/explore/test/sockios/read0_on_exec.cc 2006-12-15 08:11:12 UTC (rev 1457) @@ -1,7 +1,6 @@ -// -*- C++ -*- Time-stamp: <06/11/28 09:33:13 ptr> +// -*- C++ -*- Time-stamp: <06/12/15 10:50:48 ptr> /* - * * Copyright (c) 2006 * Petr Ovtchenkov * @@ -83,10 +82,7 @@ pr_lock.unlock(); // cerr << "ConnectionProcessor5::ConnectionProcessor5\n"; - timespec tm; - tm.tv_sec = 3; - tm.tv_nsec = 0; - Thread::delay( &tm ); + delay( xmt::timespec(3,0) ); int n = 1; // cerr << "ConnectionProcessor5::ConnectionProcessor5, write\n"; @@ -156,10 +152,7 @@ cnd.try_wait(); // wait for read call - timespec tm; - tm.tv_sec = 1; - tm.tv_nsec = 0; - Thread::delay( &tm ); + delay( xmt::timespec(1,0) ); // cerr << "system" << endl; system( "echo > /dev/null" ); // <------ key line This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2006-12-14 14:23:02
|
Revision: 1456 http://svn.sourceforge.net/complement/?rev=1456&view=rev Author: complement Date: 2006-12-14 06:23:00 -0800 (Thu, 14 Dec 2006) Log Message: ----------- move 'fork' and 'become_daemon' from Thread class directly to namespace xmt Modified Paths: -------------- trunk/complement/explore/include/mt/xmt.h trunk/complement/explore/lib/mt/ChangeLog trunk/complement/explore/lib/mt/xmt.cc trunk/complement/explore/test/mt/mt_test.cc trunk/complement/explore/test/sockios/read0_on_exec.cc trunk/complement/explore/test/stem/unit_test.cc Modified: trunk/complement/explore/include/mt/xmt.h =================================================================== --- trunk/complement/explore/include/mt/xmt.h 2006-12-14 12:04:02 UTC (rev 1455) +++ trunk/complement/explore/include/mt/xmt.h 2006-12-14 14:23:00 UTC (rev 1456) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/11/29 01:50:24 ptr> +// -*- C++ -*- Time-stamp: <06/12/14 17:08:37 ptr> /* * Copyright (c) 1997-1999, 2002-2006 @@ -1383,6 +1383,9 @@ { } }; +__FIT_DECLSPEC void fork() throw( fork_in_parent, std::runtime_error ); +__FIT_DECLSPEC void become_daemon() throw( fork_in_parent, std::runtime_error ); + class Thread { public: @@ -1486,11 +1489,6 @@ static void gettime( timespec *t ) { xmt::gettime( t ); } -#ifndef _WIN32 - static __FIT_DECLSPEC void fork() throw( fork_in_parent, std::runtime_error ); - static __FIT_DECLSPEC void become_daemon() throw( fork_in_parent, std::runtime_error ); -#endif - bool good() const { return (_state == goodbit) && (_id != bad_thread_id); } bool bad() const Modified: trunk/complement/explore/lib/mt/ChangeLog =================================================================== --- trunk/complement/explore/lib/mt/ChangeLog 2006-12-14 12:04:02 UTC (rev 1455) +++ trunk/complement/explore/lib/mt/ChangeLog 2006-12-14 14:23:00 UTC (rev 1456) @@ -1,3 +1,9 @@ +2006-12-14 Petr Ovtchenkov <pt...@is...> + + * xmt.h, xmt.cc: move 'fork' and 'become_daemon' from Thread + class directly to namespace xmt; this may block usage + of compilers without namespaces. + 2006-12-13 Petr Ovtchenkov <pt...@is...> * thr_mgr.h, thr_mgr.cc: add join method. Modified: trunk/complement/explore/lib/mt/xmt.cc =================================================================== --- trunk/complement/explore/lib/mt/xmt.cc 2006-12-14 12:04:02 UTC (rev 1455) +++ trunk/complement/explore/lib/mt/xmt.cc 2006-12-14 14:23:00 UTC (rev 1456) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/11/29 03:10:16 ptr> +// -*- C++ -*- Time-stamp: <06/12/14 17:12:53 ptr> /* * Copyright (c) 1997-1999, 2002-2006 @@ -709,9 +709,8 @@ Thread::_exit( 0 ); } -#ifndef _WIN32 __FIT_DECLSPEC -void Thread::fork() throw( fork_in_parent, std::runtime_error ) +void fork() throw( fork_in_parent, std::runtime_error ) { #ifdef __unix // MT_REENTRANT( detail::_F_lock, _1 ); @@ -728,13 +727,14 @@ } __FIT_DECLSPEC -void Thread::become_daemon() throw( fork_in_parent, std::runtime_error ) +void become_daemon() throw( fork_in_parent, std::runtime_error ) { #ifdef __unix try { - Thread::fork(); + xmt::fork(); - // chdir( "/var/tmp" ); + chdir( "/var/tmp" ); // for CWD: if not done, process remain with same WD + // and don't allow unmount volume, for example ::setsid(); // become session leader ::close( 0 ); // close stdin ::close( 1 ); // close stdout @@ -752,7 +752,6 @@ } #endif } -#endif // _WIN32 // #ifdef __GNUC__ // void Thread::_create( const void *p, size_t psz ) Modified: trunk/complement/explore/test/mt/mt_test.cc =================================================================== --- trunk/complement/explore/test/mt/mt_test.cc 2006-12-14 12:04:02 UTC (rev 1455) +++ trunk/complement/explore/test/mt/mt_test.cc 2006-12-14 14:23:00 UTC (rev 1456) @@ -43,7 +43,7 @@ fcnd.set( false ); try { - xmt::Thread::fork(); + xmt::fork(); try { Modified: trunk/complement/explore/test/sockios/read0_on_exec.cc =================================================================== --- trunk/complement/explore/test/sockios/read0_on_exec.cc 2006-12-14 12:04:02 UTC (rev 1455) +++ trunk/complement/explore/test/sockios/read0_on_exec.cc 2006-12-14 14:23:00 UTC (rev 1456) @@ -145,7 +145,7 @@ // cerr << "** 1" << endl; // cndf.set( false ); - xmt::Thread::fork(); // <---- key line + xmt::fork(); // <---- key line sem.wait(); // wait server for listen us // cerr << "** 2" << endl; Modified: trunk/complement/explore/test/stem/unit_test.cc =================================================================== --- trunk/complement/explore/test/stem/unit_test.cc 2006-12-14 12:04:02 UTC (rev 1455) +++ trunk/complement/explore/test/stem/unit_test.cc 2006-12-14 14:23:00 UTC (rev 1456) @@ -311,7 +311,7 @@ fcnd.set( false ); try { - xmt::Thread::fork(); + xmt::fork(); try { stem::NetTransportMgr mgr; @@ -423,7 +423,7 @@ try { // Client 1 - xmt::Thread::fork(); + xmt::fork(); #if 0 struct sigaction action; struct sigaction old_action; @@ -524,7 +524,7 @@ try { // Client 2 - xmt::Thread::fork(); + xmt::fork(); #if 0 struct sigaction action; @@ -619,7 +619,7 @@ try { // Client - xmt::Thread::fork(); + xmt::fork(); try { fcnd.try_wait(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2006-12-14 12:04:05
|
Revision: 1455 http://svn.sourceforge.net/complement/?rev=1455&view=rev Author: complement Date: 2006-12-14 04:04:02 -0800 (Thu, 14 Dec 2006) Log Message: ----------- add test for single application and C programms only Added Paths: ----------- trunk/complement/explore/Makefiles/ut/app-c/ trunk/complement/explore/Makefiles/ut/app-c/Makefile trunk/complement/explore/Makefiles/ut/app-c/Makefile.inc trunk/complement/explore/Makefiles/ut/app-c/test.c trunk/complement/explore/Makefiles/ut/app1/ trunk/complement/explore/Makefiles/ut/app1/Makefile trunk/complement/explore/Makefiles/ut/app1/Makefile.inc trunk/complement/explore/Makefiles/ut/app1/test.cc Property changes on: trunk/complement/explore/Makefiles/ut/app-c ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/Makefiles/ut/app-c/Makefile =================================================================== --- trunk/complement/explore/Makefiles/ut/app-c/Makefile (rev 0) +++ trunk/complement/explore/Makefiles/ut/app-c/Makefile 2006-12-14 12:04:02 UTC (rev 1455) @@ -0,0 +1,52 @@ +# -*- Makefile -*- Time-stamp: <06/11/13 23:03:45 ptr> + +SRCROOT := ../../.. + +EXTRA_POST := checks +EXTRA_POST_DBG := checks-dbg +EXTRA_POST_STLDBG := checks-stldbg + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +ifndef WITHOUT_STLPORT +LDFLAGS += -Wl,-rpath=${STLPORT_LIB_DIR} +endif + +# Check that we really use C compiler here + +define ldd_check +r=`ldd $(1) | grep $(2)`; if [ "$$r" != "" ]; then exit 1; fi +endef + + +checks: + file ${PRG} | grep ELF >/dev/null || exit 1 + ${call ldd_check,${PRG},stlport} + ${call ldd_check,${PRG},stdc++} + ${call ldd_check,${PRG},gcc_s} + @echo + @echo release ok + @echo + +checks-dbg: + file ${PRG_DBG} | grep ELF >/dev/null || exit 1 + ${call ldd_check,${PRG_DBG},stlport} + ${call ldd_check,${PRG_DBG},stdc++} + ${call ldd_check,${PRG_DBG},gcc_s} + @echo + @echo dbg ok + @echo + +ifndef WITHOUT_STLPORT +checks-stldbg: + file ${PRG_STLDBG} | grep ELF >/dev/null || exit 1 + ${call ldd_check,${PRG_STLDBG},stlport} + ${call ldd_check,${PRG_STLDBG},stdc++} + ${call ldd_check,${PRG_STLDBG},gcc_s} + @echo + @echo stldbg ok + @echo +endif + +PHONY += checks checks-dbg checks-stldbg Added: trunk/complement/explore/Makefiles/ut/app-c/Makefile.inc =================================================================== --- trunk/complement/explore/Makefiles/ut/app-c/Makefile.inc (rev 0) +++ trunk/complement/explore/Makefiles/ut/app-c/Makefile.inc 2006-12-14 12:04:02 UTC (rev 1455) @@ -0,0 +1,4 @@ +# -*- makefile -*- Time-stamp: <04/01/12 15:37:40 ptr> + +PRGNAME = test +SRC_C = test.c Added: trunk/complement/explore/Makefiles/ut/app-c/test.c =================================================================== --- trunk/complement/explore/Makefiles/ut/app-c/test.c (rev 0) +++ trunk/complement/explore/Makefiles/ut/app-c/test.c 2006-12-14 12:04:02 UTC (rev 1455) @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} Property changes on: trunk/complement/explore/Makefiles/ut/app1 ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/Makefiles/ut/app1/Makefile =================================================================== --- trunk/complement/explore/Makefiles/ut/app1/Makefile (rev 0) +++ trunk/complement/explore/Makefiles/ut/app1/Makefile 2006-12-14 12:04:02 UTC (rev 1455) @@ -0,0 +1,36 @@ +# -*- Makefile -*- Time-stamp: <06/11/13 23:03:45 ptr> + +SRCROOT := ../../.. + +EXTRA_POST := checks +EXTRA_POST_DBG := checks-dbg +EXTRA_POST_STLDBG := checks-stldbg + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +ifndef WITHOUT_STLPORT +LDFLAGS += -Wl,-rpath=${STLPORT_LIB_DIR} +endif + +checks: + file ${PRG} | grep ELF >/dev/null || exit 1 + @echo + @echo release ok + @echo + +checks-dbg: + file ${PRG_DBG} | grep ELF >/dev/null || exit 1 + @echo + @echo dbg ok + @echo + +ifndef WITHOUT_STLPORT +checks-stldbg: + file ${PRG_STLDBG} | grep ELF >/dev/null || exit 1 + @echo + @echo stldbg ok + @echo +endif + +PHONY += checks checks-dbg checks-stldbg Added: trunk/complement/explore/Makefiles/ut/app1/Makefile.inc =================================================================== --- trunk/complement/explore/Makefiles/ut/app1/Makefile.inc (rev 0) +++ trunk/complement/explore/Makefiles/ut/app1/Makefile.inc 2006-12-14 12:04:02 UTC (rev 1455) @@ -0,0 +1,5 @@ +# -*- makefile -*- Time-stamp: <04/01/12 15:37:40 ptr> + +PRGNAME = test +#SRC_C = test.c +SRC_CC = test.cc Added: trunk/complement/explore/Makefiles/ut/app1/test.cc =================================================================== --- trunk/complement/explore/Makefiles/ut/app1/test.cc (rev 0) +++ trunk/complement/explore/Makefiles/ut/app1/test.cc 2006-12-14 12:04:02 UTC (rev 1455) @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2006-12-14 11:03:38
|
Revision: 1454 http://svn.sourceforge.net/complement/?rev=1454&view=rev Author: complement Date: 2006-12-14 03:03:35 -0800 (Thu, 14 Dec 2006) Log Message: ----------- test: build few application in the same catalog Added Paths: ----------- trunk/complement/explore/Makefiles/ut/app2/ trunk/complement/explore/Makefiles/ut/app2/Makefile trunk/complement/explore/Makefiles/ut/app2/Makefile.inc trunk/complement/explore/Makefiles/ut/app2/test.cc trunk/complement/explore/Makefiles/ut/app2/test2.cc trunk/complement/explore/Makefiles/ut/app2/test3.cc Property changes on: trunk/complement/explore/Makefiles/ut/app2 ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/Makefiles/ut/app2/Makefile =================================================================== --- trunk/complement/explore/Makefiles/ut/app2/Makefile (rev 0) +++ trunk/complement/explore/Makefiles/ut/app2/Makefile 2006-12-14 11:03:35 UTC (rev 1454) @@ -0,0 +1,42 @@ +# -*- Makefile -*- Time-stamp: <06/11/13 23:03:45 ptr> + +SRCROOT := ../../.. + +EXTRA_POST := checks +EXTRA_POST_DBG := checks-dbg +EXTRA_POST_STLDBG := checks-stldbg + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +ifndef WITHOUT_STLPORT +LDFLAGS += -Wl,-rpath=${STLPORT_LIB_DIR} +endif + +checks: + file ${PRG} | grep ELF >/dev/null || exit 1 + file ${test2_PRG} | grep ELF >/dev/null || exit 1 + file ${test3_PRG} | grep ELF >/dev/null || exit 1 + @echo + @echo release ok + @echo + +checks-dbg: + file ${PRG_DBG} | grep ELF >/dev/null || exit 1 + file ${test2_PRG_DBG} | grep ELF >/dev/null || exit 1 + file ${test3_PRG_DBG} | grep ELF >/dev/null || exit 1 + @echo + @echo dbg ok + @echo + +ifndef WITHOUT_STLPORT +checks-stldbg: + file ${PRG_STLDBG} | grep ELF >/dev/null || exit 1 + file ${test2_PRG_STLDBG} | grep ELF >/dev/null || exit 1 + file ${test3_PRG_STLDBG} | grep ELF >/dev/null || exit 1 + @echo + @echo stldbg ok + @echo +endif + +PHONY += checks checks-dbg checks-stldbg Added: trunk/complement/explore/Makefiles/ut/app2/Makefile.inc =================================================================== --- trunk/complement/explore/Makefiles/ut/app2/Makefile.inc (rev 0) +++ trunk/complement/explore/Makefiles/ut/app2/Makefile.inc 2006-12-14 11:03:35 UTC (rev 1454) @@ -0,0 +1,8 @@ +# -*- makefile -*- Time-stamp: <04/01/12 15:37:40 ptr> + +PRGNAME = test +PRGNAMES = test2 test3 +#SRC_C = test.c +SRC_CC = test.cc +test2_SRC_CC = test2.cc +test3_SRC_CC = test3.cc Added: trunk/complement/explore/Makefiles/ut/app2/test.cc =================================================================== --- trunk/complement/explore/Makefiles/ut/app2/test.cc (rev 0) +++ trunk/complement/explore/Makefiles/ut/app2/test.cc 2006-12-14 11:03:35 UTC (rev 1454) @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} Added: trunk/complement/explore/Makefiles/ut/app2/test2.cc =================================================================== --- trunk/complement/explore/Makefiles/ut/app2/test2.cc (rev 0) +++ trunk/complement/explore/Makefiles/ut/app2/test2.cc 2006-12-14 11:03:35 UTC (rev 1454) @@ -0,0 +1,4 @@ +int main() +{ + return 2; +} Added: trunk/complement/explore/Makefiles/ut/app2/test3.cc =================================================================== --- trunk/complement/explore/Makefiles/ut/app2/test3.cc (rev 0) +++ trunk/complement/explore/Makefiles/ut/app2/test3.cc 2006-12-14 11:03:35 UTC (rev 1454) @@ -0,0 +1,4 @@ +int main() +{ + return 3; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |