From 9e54316c528c34ee76f4d0d21150ceadd031c4de Mon Sep 17 00:00:00 2001 From: CodeforEvolution Date: Tue, 27 Aug 2019 22:56:47 -0500 Subject: [PATCH] Fix the build of test_app_server on 64bit So many Jamfiles to search through...runs also, but there are lots of graphical glitches Change-Id: Ibf9e64566a5b8c5742792ac9b1b0f9ccc6693c8d Reviewed-on: https://review.haiku-os.org/c/haiku/+/1753 Reviewed-by: waddlesplash --- build/jam/SystemLibraryRules | 9 +- src/apps/charactermap/Jamfile | 2 +- src/apps/magnify/Jamfile | 2 +- src/apps/workspaces/Jamfile | 6 +- src/bin/Jamfile | 2 +- src/kits/Jamfile | 13 +-- src/kits/game/Jamfile | 2 +- src/kits/textencoding/Jamfile | 2 +- src/preferences/filetypes/Jamfile | 2 +- src/preferences/screen/Jamfile | 2 +- src/tests/kits/game/chart/Jamfile | 2 +- .../kits/game/direct_window_test/Jamfile | 2 +- src/tests/kits/interface/layout/Jamfile | 2 +- .../layout/widget_layout_test/Jamfile | 2 +- .../widget_layout_test/tests/BoxTest.cpp | 4 +- .../tests/ScrollBarTest.cpp | 2 +- .../widget_layout_test/tests/SliderTest.cpp | 12 +-- src/tests/kits/interface/picture/Jamfile | 4 +- src/tests/servers/app/Jamfile | 10 +- src/tests/servers/app/NOTES | 11 ++- src/tests/servers/app/archived_view/Jamfile | 2 +- src/tests/servers/app/async_drawing/Jamfile | 2 +- src/tests/servers/app/avoid_focus/Jamfile | 2 +- src/tests/servers/app/benchmark/Jamfile | 2 +- src/tests/servers/app/bitmap_bounds/Jamfile | 2 +- src/tests/servers/app/bitmap_drawing/Jamfile | 2 +- src/tests/servers/app/clip_to_picture/Jamfile | 2 +- src/tests/servers/app/code_to_name/Jamfile | 2 +- .../app/constrain_clipping_region/Jamfile | 2 +- src/tests/servers/app/copy_bits/Jamfile | 2 +- src/tests/servers/app/cursor_test/Jamfile | 2 +- src/tests/servers/app/desktop_window/Jamfile | 2 +- .../servers/app/draw_string_offsets/Jamfile | 2 +- src/tests/servers/app/event_mask/Jamfile | 2 +- src/tests/servers/app/find_view/Jamfile | 2 +- src/tests/servers/app/following/Jamfile | 2 +- src/tests/servers/app/font_spacing/Jamfile | 2 +- src/tests/servers/app/gradients/Jamfile | 2 +- src/tests/servers/app/hide_and_show/Jamfile | 2 +- src/tests/servers/app/idle_test/Jamfile | 2 +- .../servers/app/lagging_get_mouse/Jamfile | 2 +- src/tests/servers/app/lock_focus/Jamfile | 2 +- src/tests/servers/app/look_and_feel/Jamfile | 2 +- src/tests/servers/app/menu_crash/Jamfile | 2 +- src/tests/servers/app/newerClipping/makefile | 2 +- src/tests/servers/app/playground/Jamfile | 2 +- src/tests/servers/app/pulsed_drawing/Jamfile | 2 +- src/tests/servers/app/regularapps/Jamfile | 2 +- src/tests/servers/app/resize_limits/Jamfile | 2 +- src/tests/servers/app/run | 28 ------ src/tests/servers/app/run.sh | 28 ++++++ src/tests/servers/app/scrollbar/Jamfile | 2 +- src/tests/servers/app/scrolling/Jamfile | 2 +- src/tests/servers/app/shape_test/Jamfile | 2 +- src/tests/servers/app/stacktile/Jamfile | 2 +- src/tests/servers/app/statusbar/Jamfile | 2 +- src/tests/servers/app/text_rendering/Jamfile | 2 +- src/tests/servers/app/textview/Jamfile | 2 +- src/tests/servers/app/transformation/Jamfile | 2 +- src/tests/servers/app/view_state/Jamfile | 2 +- src/tests/servers/app/view_transit/Jamfile | 2 +- .../servers/registrar/RegistrarTest1.cpp | 18 ++-- src/tests/servers/registrar/RosterShell.cpp | 99 ++++++++++++------- 63 files changed, 193 insertions(+), 151 deletions(-) delete mode 100755 src/tests/servers/app/run create mode 100755 src/tests/servers/app/run.sh diff --git a/build/jam/SystemLibraryRules b/build/jam/SystemLibraryRules index a88fa04aee..d7d75cc7f7 100644 --- a/build/jam/SystemLibraryRules +++ b/build/jam/SystemLibraryRules @@ -22,7 +22,7 @@ rule TargetLibstdc++ asPath # Returns the c++-standard-library for the target. # Invoking with = true will return the full library path. - if $(TARGET_PLATFORM) = haiku { + if $(TARGET_PLATFORM) = haiku || $(TARGET_PLATFORM) = libbe_test { if $(TARGET_PACKAGING_ARCH) = x86_gcc2 { # the libstdc++.so for our legacy compiler (needs to be built) return libstdc++.r4.so ; @@ -35,13 +35,8 @@ rule TargetLibstdc++ asPath return [ BuildFeatureAttribute gcc_syslibs : libstdc++.so : $(flags) ] ; - } else { - if $(TARGET_PLATFORM) = libbe_test { - # Use the existing host library - return stdc++.r4 ; - } - # TODO: return libstdc++.so for non-Haiku target platform if needed } + # TODO: return libstdc++.so for non-Haiku target platform if needed } diff --git a/src/apps/charactermap/Jamfile b/src/apps/charactermap/Jamfile index c1146fdd1a..395e6bc4d5 100644 --- a/src/apps/charactermap/Jamfile +++ b/src/apps/charactermap/Jamfile @@ -11,7 +11,7 @@ Application CharacterMap : UnicodeBlocks.cpp UnicodeBlockView.cpp - : be [ TargetLibsupc++ ] localestub + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] localestub : CharacterMap.rdef ; diff --git a/src/apps/magnify/Jamfile b/src/apps/magnify/Jamfile index 7fecb25ee2..cf19c325c5 100644 --- a/src/apps/magnify/Jamfile +++ b/src/apps/magnify/Jamfile @@ -6,7 +6,7 @@ UsePrivateHeaders shared ; Application Magnify : Magnify.cpp - : be game localestub [ TargetLibsupc++ ] tracker translation + : be game localestub [ TargetLibstdc++ ] [ TargetLibsupc++ ] tracker translation : Magnify.rdef ; diff --git a/src/apps/workspaces/Jamfile b/src/apps/workspaces/Jamfile index 45d80f26b5..95946c5123 100644 --- a/src/apps/workspaces/Jamfile +++ b/src/apps/workspaces/Jamfile @@ -5,9 +5,9 @@ AddSubDirSupportedPlatforms libbe_test ; UsePrivateHeaders app interface shared ; Application Workspaces : - Workspaces.cpp - : be shared localestub [ TargetLibsupc++ ] - : Workspaces.rdef + Workspaces.cpp + : be shared localestub [ TargetLibstdc++ ] [ TargetLibsupc++ ] + : Workspaces.rdef ; if $(TARGET_PLATFORM) = libbe_test { diff --git a/src/bin/Jamfile b/src/bin/Jamfile index fe5c085315..d0d3ad190d 100644 --- a/src/bin/Jamfile +++ b/src/bin/Jamfile @@ -123,7 +123,7 @@ StdBinCommands settype.cpp spybmessage.cpp urlwrapper.cpp - : be [ TargetLibsupc++ ] : $(haiku-utils_rsrc) ; + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] : $(haiku-utils_rsrc) ; # standard commands that need libbe.so, libsupc++.so, and libshared.a StdBinCommands diff --git a/src/kits/Jamfile b/src/kits/Jamfile index cd091b3611..ca6fdbb1bf 100644 --- a/src/kits/Jamfile +++ b/src/kits/Jamfile @@ -63,11 +63,11 @@ UsePrivateHeaders storage mime ; SharedLibrary libbe_test.so : : - app_kit.o - interface_kit.o - locale_kit.o - storage_kit.o - support_kit.o + app_kit.o + interface_kit.o + locale_kit.o + storage_kit.o + support_kit.o [ MultiArchDefaultGristFiles libstorage_kit_mime.a ] @@ -77,7 +77,8 @@ SharedLibrary libbe_test.so : [ TargetLibstdc++ ] [ BuildFeatureAttribute icu : libraries ] [ BuildFeatureAttribute zlib : library ] -; + [ BuildFeatureAttribute zstd : library ] + ; SEARCH_SOURCE += [ FDirName $(SUBDIR) interface ] ; SEARCH_SOURCE += [ FDirName $(SUBDIR) interface textview_support ] ; diff --git a/src/kits/game/Jamfile b/src/kits/game/Jamfile index 51f1329c00..1cf16782cd 100644 --- a/src/kits/game/Jamfile +++ b/src/kits/game/Jamfile @@ -37,7 +37,7 @@ if $(TARGET_PLATFORM) = haiku { SharedLibrary libgame.so : DirectWindow.cpp WindowScreen.cpp - : be + : be [ TargetLibstdc++ ] ; HaikuInstall install-test-apps : $(HAIKU_APP_TEST_LIB_DIR) : libgame.so diff --git a/src/kits/textencoding/Jamfile b/src/kits/textencoding/Jamfile index 5d0437a675..88d9bf4027 100644 --- a/src/kits/textencoding/Jamfile +++ b/src/kits/textencoding/Jamfile @@ -18,7 +18,7 @@ for architectureObject in [ MultiArchSubDirSetup ] { : be [ MultiArchDefaultGristFiles libiconv.a ] - [ TargetLibsupc++ ] localestub ; + [ TargetLibstdc++ ] [ TargetLibsupc++ ] localestub ; } } diff --git a/src/preferences/filetypes/Jamfile b/src/preferences/filetypes/Jamfile index f1a70b4a88..5360c14196 100644 --- a/src/preferences/filetypes/Jamfile +++ b/src/preferences/filetypes/Jamfile @@ -24,7 +24,7 @@ Preference FileTypes : PreferredAppMenu.cpp StringView.cpp - : be tracker [ TargetLibsupc++ ] localestub + : be tracker [ TargetLibstdc++ ] [ TargetLibsupc++ ] localestub : FileTypes.rdef FileTypes.icons.rdef ; diff --git a/src/preferences/screen/Jamfile b/src/preferences/screen/Jamfile index ce605a80b0..002d6fcb58 100644 --- a/src/preferences/screen/Jamfile +++ b/src/preferences/screen/Jamfile @@ -17,7 +17,7 @@ Preference Screen : ScreenSettings.cpp ScreenWindow.cpp Utility.cpp - : be [ TargetLibsupc++ ] localestub libaccelerantscommon.a + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] localestub libaccelerantscommon.a : Screen.rdef ; diff --git a/src/tests/kits/game/chart/Jamfile b/src/tests/kits/game/chart/Jamfile index 3f53392514..942e3cc1ed 100644 --- a/src/tests/kits/game/chart/Jamfile +++ b/src/tests/kits/game/chart/Jamfile @@ -7,7 +7,7 @@ Application Chart : ChartRender.cpp ChartView.cpp ChartWindow.cpp - : be game localestub [ TargetLibsupc++ ] + : be game localestub [ TargetLibstdc++ ] [ TargetLibsupc++ ] : Chart.rdef ; diff --git a/src/tests/kits/game/direct_window_test/Jamfile b/src/tests/kits/game/direct_window_test/Jamfile index ace903b0ca..047c7c0951 100644 --- a/src/tests/kits/game/direct_window_test/Jamfile +++ b/src/tests/kits/game/direct_window_test/Jamfile @@ -4,7 +4,7 @@ AddSubDirSupportedPlatforms libbe_test ; SimpleTest DirectWindowStars : Stars.cpp StarWindow.cpp - : game be [ TargetLibsupc++ ] + : game be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if ( $(TARGET_PLATFORM) = libbe_test ) { diff --git a/src/tests/kits/interface/layout/Jamfile b/src/tests/kits/interface/layout/Jamfile index 8b3e2abaf7..2fe80c0ca6 100644 --- a/src/tests/kits/interface/layout/Jamfile +++ b/src/tests/kits/interface/layout/Jamfile @@ -5,7 +5,7 @@ SetSubDirSupportedPlatforms haiku libbe_test ; SimpleTest LayoutTest1 : LayoutTest1.cpp : - be [ TargetLibsupc++ ] + be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if $(TARGET_PLATFORM) = libbe_test { diff --git a/src/tests/kits/interface/layout/widget_layout_test/Jamfile b/src/tests/kits/interface/layout/widget_layout_test/Jamfile index 4f8fe8ad86..224d103b56 100644 --- a/src/tests/kits/interface/layout/widget_layout_test/Jamfile +++ b/src/tests/kits/interface/layout/widget_layout_test/Jamfile @@ -33,7 +33,7 @@ SimpleTest WidgetLayoutTest : TextControlTest.cpp TextViewTest.cpp : - be [ TargetLibsupc++ ] + be [ TargetLibsupc++ ] [ TargetLibstdc++ ] ; if $(TARGET_PLATFORM) = libbe_test { diff --git a/src/tests/kits/interface/layout/widget_layout_test/tests/BoxTest.cpp b/src/tests/kits/interface/layout/widget_layout_test/tests/BoxTest.cpp index 564774e7a2..77821f0c1a 100644 --- a/src/tests/kits/interface/layout/widget_layout_test/tests/BoxTest.cpp +++ b/src/tests/kits/interface/layout/widget_layout_test/tests/BoxTest.cpp @@ -122,7 +122,7 @@ BoxTest::ActivateTest(View* controls) fBorderStyleRadioGroup->AddButton(button->GetRadioButton()); // default to no border - fBorderStyleRadioGroup->SelectButton(0L); + fBorderStyleRadioGroup->SelectButton((int32)0); // spacing group->AddChild(new VStrut(10)); @@ -148,7 +148,7 @@ BoxTest::ActivateTest(View* controls) fLabelRadioGroup->AddButton(button->GetRadioButton()); // default to no border - fLabelRadioGroup->SelectButton(0L); + fLabelRadioGroup->SelectButton((int32)0); // spacing group->AddChild(new VStrut(10)); diff --git a/src/tests/kits/interface/layout/widget_layout_test/tests/ScrollBarTest.cpp b/src/tests/kits/interface/layout/widget_layout_test/tests/ScrollBarTest.cpp index bd1ac21357..df08f8ecf2 100644 --- a/src/tests/kits/interface/layout/widget_layout_test/tests/ScrollBarTest.cpp +++ b/src/tests/kits/interface/layout/widget_layout_test/tests/ScrollBarTest.cpp @@ -78,7 +78,7 @@ ScrollBarTest::ActivateTest(View* controls) fOrientationRadioGroup->AddButton(button->GetRadioButton()); // default to horizontal - fOrientationRadioGroup->SelectButton(0L); + fOrientationRadioGroup->SelectButton((int32)0); // glue vGroup->AddChild(new Glue()); diff --git a/src/tests/kits/interface/layout/widget_layout_test/tests/SliderTest.cpp b/src/tests/kits/interface/layout/widget_layout_test/tests/SliderTest.cpp index 9f9b3de551..bcdb41cd31 100644 --- a/src/tests/kits/interface/layout/widget_layout_test/tests/SliderTest.cpp +++ b/src/tests/kits/interface/layout/widget_layout_test/tests/SliderTest.cpp @@ -206,7 +206,7 @@ SliderTest::ActivateTest(View* controls) fOrientationRadioGroup->AddButton(button->GetRadioButton()); // default to horizontal - fOrientationRadioGroup->SelectButton(0L); + fOrientationRadioGroup->SelectButton((int32)0); // the radio button group for selecting the thumb style @@ -228,7 +228,7 @@ SliderTest::ActivateTest(View* controls) fThumbStyleRadioGroup->AddButton(button->GetRadioButton()); // default to block thumb - fThumbStyleRadioGroup->SelectButton(0L); + fThumbStyleRadioGroup->SelectButton((int32)0); // spacing group->AddChild(new VStrut(10)); @@ -263,7 +263,7 @@ SliderTest::ActivateTest(View* controls) fHashMarkLocationRadioGroup->AddButton(button->GetRadioButton()); // default to no hash marks - fHashMarkLocationRadioGroup->SelectButton(0L); + fHashMarkLocationRadioGroup->SelectButton((int32)0); // spacing group->AddChild(new VStrut(10)); @@ -289,7 +289,7 @@ SliderTest::ActivateTest(View* controls) fBarThicknessRadioGroup->AddButton(button->GetRadioButton()); // default to default thickness - fBarThicknessRadioGroup->SelectButton(1L); + fBarThicknessRadioGroup->SelectButton((int32)1); // spacing group->AddChild(new VStrut(10)); @@ -316,7 +316,7 @@ SliderTest::ActivateTest(View* controls) fLabelRadioGroup->AddButton(button->GetRadioButton()); // default to normal label - fLabelRadioGroup->SelectButton(1L); + fLabelRadioGroup->SelectButton((int32)1); // spacing group->AddChild(new VStrut(10)); @@ -343,7 +343,7 @@ SliderTest::ActivateTest(View* controls) fLimitLabelsRadioGroup->AddButton(button->GetRadioButton()); // default to no limit labels - fLimitLabelsRadioGroup->SelectButton(0L); + fLimitLabelsRadioGroup->SelectButton((int32)0); // spacing group->AddChild(new VStrut(10)); diff --git a/src/tests/kits/interface/picture/Jamfile b/src/tests/kits/interface/picture/Jamfile index 280bd1ccf6..ac938489a7 100644 --- a/src/tests/kits/interface/picture/Jamfile +++ b/src/tests/kits/interface/picture/Jamfile @@ -23,9 +23,9 @@ UseLibraryHeaders agg expat ; SimpleTest PictureTest : PictureTest.cpp SVGViewView.cpp - : be translation + : be translation [ BuildFeatureAttribute expat : library ] - [ TargetLibsupc++ ] + [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if $(TARGET_PLATFORM) = libbe_test { diff --git a/src/tests/servers/app/Jamfile b/src/tests/servers/app/Jamfile index b31dbbe303..dad12fab49 100644 --- a/src/tests/servers/app/Jamfile +++ b/src/tests/servers/app/Jamfile @@ -81,8 +81,10 @@ SharedLibrary libhwinterfaceimpl.so : DWindowHWInterface.cpp MultiLocker.cpp -# trace.c - : libhwinterface.so +# libraries + : + libhwinterface.so + [ TargetLibstdc++ ] ; local decorator_src = @@ -187,6 +189,7 @@ SharedLibrary libtestappserver.so : : be libpainter.a libagg.a libtextencoding.so shared libstackandtile.a liblinprog.a libhwinterface.so libhwinterfaceimpl.so [ BuildFeatureAttribute freetype : library ] + [ TargetLibstdc++ ] ; Includes [ FGristFiles AppServer.cpp BitmapManager.cpp Canvas.cpp @@ -222,6 +225,9 @@ HaikuInstall install-test-apps : $(HAIKU_APP_TEST_LIB_DIR) HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : test_app_server : tests!apps ; +HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : run.sh + : tests!apps ; + } # if $(TARGET_PLATFORM) = libbe_test SubInclude HAIKU_TOP src tests servers app archived_view ; diff --git a/src/tests/servers/app/NOTES b/src/tests/servers/app/NOTES index 0ba1c13e75..20a0937370 100644 --- a/src/tests/servers/app/NOTES +++ b/src/tests/servers/app/NOTES @@ -4,12 +4,17 @@ There is a pseudo target "install-test-apps" which needs to be built like this: $ TARGET_PLATFORM=libbe_test jam install-test-apps -This will build "test_registrar", "test_app_server", the needed libs and some test apps and install everything into "generated/tests/apps". +This will build "test_registrar", "test_app_server", +the needed libs and some test apps and install everything into "generated/tests/libbe_test/(your architecture)/apps". -You can use the "run" script in this folder to run the servers, as well as open the test app folder in Tracker (via the -o option), or launch specific test app(s) by specifying their name in the command line, for example "run WindowInvalidation". +You can use the "run.sh" script installed in the "generated/tests/libbe_test/(your architecture)/apps" folder to run the servers, +as well as open the test app folder in Tracker (via the -o option), +or launch specific test app(s) by specifying their name in the command line, +for example "run WindowInvalidation". NOTE: it is currently necessary to prefix the starting of test_app_server with LD_PRELOAD="lib/libbe_test.so" -This is a bug that should be fixed (go for it :-), but supplying the library manually is a workaround for using test_app_server for now. +This is a bug that should be fixed (go for it :-), +but supplying the library manually is a workaround for using test_app_server for now. Have fun! diff --git a/src/tests/servers/app/archived_view/Jamfile b/src/tests/servers/app/archived_view/Jamfile index fd2b998c8b..7d694309a6 100644 --- a/src/tests/servers/app/archived_view/Jamfile +++ b/src/tests/servers/app/archived_view/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; SimpleTest ArchivedView : main.cpp - : be [ TargetLibsupc++ ] + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] : ArchivedView.rdef ; diff --git a/src/tests/servers/app/async_drawing/Jamfile b/src/tests/servers/app/async_drawing/Jamfile index d98cd6397c..28bf656914 100644 --- a/src/tests/servers/app/async_drawing/Jamfile +++ b/src/tests/servers/app/async_drawing/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; SimpleTest AsyncDrawing : main.cpp - : be [ TargetLibsupc++ ] ; + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if ( $(TARGET_PLATFORM) = libbe_test ) { HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : AsyncDrawing diff --git a/src/tests/servers/app/avoid_focus/Jamfile b/src/tests/servers/app/avoid_focus/Jamfile index 3439ac87a3..d8036ed857 100644 --- a/src/tests/servers/app/avoid_focus/Jamfile +++ b/src/tests/servers/app/avoid_focus/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; Application AvoidFocus : AvoidFocus.cpp - : be [ TargetLibsupc++ ] + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if $(TARGET_PLATFORM) = libbe_test { diff --git a/src/tests/servers/app/benchmark/Jamfile b/src/tests/servers/app/benchmark/Jamfile index b52d79fc59..a894241704 100644 --- a/src/tests/servers/app/benchmark/Jamfile +++ b/src/tests/servers/app/benchmark/Jamfile @@ -14,7 +14,7 @@ Application Benchmark : Test.cpp TestWindow.cpp VerticalLineTest.cpp - : be [ TargetLibsupc++ ] + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if ( $(TARGET_PLATFORM) = libbe_test ) { diff --git a/src/tests/servers/app/bitmap_bounds/Jamfile b/src/tests/servers/app/bitmap_bounds/Jamfile index 02f29329cb..6ead2c9d29 100644 --- a/src/tests/servers/app/bitmap_bounds/Jamfile +++ b/src/tests/servers/app/bitmap_bounds/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; SimpleTest BitmapBounds : main.cpp - : be [ TargetLibsupc++ ] ; + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if ( $(TARGET_PLATFORM) = libbe_test ) { HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : BitmapBounds diff --git a/src/tests/servers/app/bitmap_drawing/Jamfile b/src/tests/servers/app/bitmap_drawing/Jamfile index f5006397df..7ffc9c0cb1 100644 --- a/src/tests/servers/app/bitmap_drawing/Jamfile +++ b/src/tests/servers/app/bitmap_drawing/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; Application BitmapDrawing : main.cpp - : be [ TargetLibsupc++ ] + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if ( $(TARGET_PLATFORM) = libbe_test ) { diff --git a/src/tests/servers/app/clip_to_picture/Jamfile b/src/tests/servers/app/clip_to_picture/Jamfile index e370807356..ad93a93384 100644 --- a/src/tests/servers/app/clip_to_picture/Jamfile +++ b/src/tests/servers/app/clip_to_picture/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; SimpleTest ClipToPicture : main.cpp - : be [ TargetLibsupc++ ] + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if ( $(TARGET_PLATFORM) = libbe_test ) { diff --git a/src/tests/servers/app/code_to_name/Jamfile b/src/tests/servers/app/code_to_name/Jamfile index dd36a47431..89bfa8e462 100644 --- a/src/tests/servers/app/code_to_name/Jamfile +++ b/src/tests/servers/app/code_to_name/Jamfile @@ -2,6 +2,6 @@ SubDir HAIKU_TOP src tests servers app code_to_name ; SimpleTest code_to_name : code_to_name.cpp - : be + : be [ TargetLibstdc++ ] ; diff --git a/src/tests/servers/app/constrain_clipping_region/Jamfile b/src/tests/servers/app/constrain_clipping_region/Jamfile index 62ac660751..ea689249e0 100644 --- a/src/tests/servers/app/constrain_clipping_region/Jamfile +++ b/src/tests/servers/app/constrain_clipping_region/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; SimpleTest ClippingRegion : main.cpp - : be [ TargetLibsupc++ ] ; + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if ( $(TARGET_PLATFORM) = libbe_test ) { HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : ClippingRegion diff --git a/src/tests/servers/app/copy_bits/Jamfile b/src/tests/servers/app/copy_bits/Jamfile index a279cdf7d1..4118f0ded0 100644 --- a/src/tests/servers/app/copy_bits/Jamfile +++ b/src/tests/servers/app/copy_bits/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; SimpleTest CopyBits : main.cpp - : be [ TargetLibsupc++ ] ; + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; #if ( $(TARGET_PLATFORM) = libbe_test ) { # HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : CopyBits diff --git a/src/tests/servers/app/cursor_test/Jamfile b/src/tests/servers/app/cursor_test/Jamfile index d89808043e..5068ffa05b 100644 --- a/src/tests/servers/app/cursor_test/Jamfile +++ b/src/tests/servers/app/cursor_test/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; Application CursorTest : CursorTest.cpp - : be [ TargetLibsupc++ ] + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if $(TARGET_PLATFORM) = libbe_test { diff --git a/src/tests/servers/app/desktop_window/Jamfile b/src/tests/servers/app/desktop_window/Jamfile index bc4956916c..819a265630 100644 --- a/src/tests/servers/app/desktop_window/Jamfile +++ b/src/tests/servers/app/desktop_window/Jamfile @@ -8,7 +8,7 @@ UsePrivateHeaders interface ; Application DesktopWindow : DesktopWindow.cpp - : be [ TargetLibsupc++ ] + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if $(TARGET_PLATFORM) = libbe_test { diff --git a/src/tests/servers/app/draw_string_offsets/Jamfile b/src/tests/servers/app/draw_string_offsets/Jamfile index d9731041ec..b7a0add798 100644 --- a/src/tests/servers/app/draw_string_offsets/Jamfile +++ b/src/tests/servers/app/draw_string_offsets/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; SimpleTest DrawStringOffsets : main.cpp - : be [ TargetLibsupc++ ] + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if ( $(TARGET_PLATFORM) = libbe_test ) { diff --git a/src/tests/servers/app/event_mask/Jamfile b/src/tests/servers/app/event_mask/Jamfile index 96e2ba25c0..9717243cdf 100644 --- a/src/tests/servers/app/event_mask/Jamfile +++ b/src/tests/servers/app/event_mask/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; Application EventMask : EventMask.cpp - : be [ TargetLibsupc++ ] + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if $(TARGET_PLATFORM) = libbe_test { diff --git a/src/tests/servers/app/find_view/Jamfile b/src/tests/servers/app/find_view/Jamfile index 4bb1ddbf34..f78e6e49e3 100644 --- a/src/tests/servers/app/find_view/Jamfile +++ b/src/tests/servers/app/find_view/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; Application FindView : FindView.cpp - : be [ TargetLibsupc++ ] + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if ( $(TARGET_PLATFORM) = libbe_test ) { diff --git a/src/tests/servers/app/following/Jamfile b/src/tests/servers/app/following/Jamfile index 54e34bb763..6997d499c1 100644 --- a/src/tests/servers/app/following/Jamfile +++ b/src/tests/servers/app/following/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; SimpleTest Following : main.cpp - : be [ TargetLibsupc++ ] ; + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if ( $(TARGET_PLATFORM) = libbe_test ) { HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : Following diff --git a/src/tests/servers/app/font_spacing/Jamfile b/src/tests/servers/app/font_spacing/Jamfile index fa1cfa0d58..ad872fa703 100644 --- a/src/tests/servers/app/font_spacing/Jamfile +++ b/src/tests/servers/app/font_spacing/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; SimpleTest FontSpacing : main.cpp - : be [ TargetLibsupc++ ] + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] : ; diff --git a/src/tests/servers/app/gradients/Jamfile b/src/tests/servers/app/gradients/Jamfile index 7241c88764..07e0f9307a 100644 --- a/src/tests/servers/app/gradients/Jamfile +++ b/src/tests/servers/app/gradients/Jamfile @@ -10,7 +10,7 @@ SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src tests servers app harness ] ; SimpleTest Gradients : harness.cpp main.cpp - : be [ TargetLibsupc++ ] + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] : Gradients.rdef ; diff --git a/src/tests/servers/app/hide_and_show/Jamfile b/src/tests/servers/app/hide_and_show/Jamfile index 5a27848080..a210a5b70e 100644 --- a/src/tests/servers/app/hide_and_show/Jamfile +++ b/src/tests/servers/app/hide_and_show/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; Application HideAndShow : HideAndShow.cpp - : be [ TargetLibsupc++ ] + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if $(TARGET_PLATFORM) = libbe_test { diff --git a/src/tests/servers/app/idle_test/Jamfile b/src/tests/servers/app/idle_test/Jamfile index 2a6d39ba16..c361993092 100644 --- a/src/tests/servers/app/idle_test/Jamfile +++ b/src/tests/servers/app/idle_test/Jamfile @@ -2,5 +2,5 @@ SubDir HAIKU_TOP src tests servers app idle_test ; SimpleTest idle_test : test.cpp - : be ; + : be [ TargetLibstdc++ ] ; diff --git a/src/tests/servers/app/lagging_get_mouse/Jamfile b/src/tests/servers/app/lagging_get_mouse/Jamfile index 75c397b192..839efee60d 100644 --- a/src/tests/servers/app/lagging_get_mouse/Jamfile +++ b/src/tests/servers/app/lagging_get_mouse/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; SimpleTest LaggingGetMouse : main.cpp - : be [ TargetLibsupc++ ] ; + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if ( $(TARGET_PLATFORM) = libbe_test ) { HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : LaggingGetMouse diff --git a/src/tests/servers/app/lock_focus/Jamfile b/src/tests/servers/app/lock_focus/Jamfile index 789e49bc67..73599c1926 100644 --- a/src/tests/servers/app/lock_focus/Jamfile +++ b/src/tests/servers/app/lock_focus/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; Application LockFocusTest : LockFocusTest.cpp - : be [ TargetLibsupc++ ] + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if $(TARGET_PLATFORM) = libbe_test { diff --git a/src/tests/servers/app/look_and_feel/Jamfile b/src/tests/servers/app/look_and_feel/Jamfile index bda76a89b3..8a13cde5c7 100644 --- a/src/tests/servers/app/look_and_feel/Jamfile +++ b/src/tests/servers/app/look_and_feel/Jamfile @@ -8,7 +8,7 @@ UsePrivateHeaders interface ; Application LookAndFeel : LookAndFeel.cpp - : be [ TargetLibsupc++ ] + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if $(TARGET_PLATFORM) = libbe_test { diff --git a/src/tests/servers/app/menu_crash/Jamfile b/src/tests/servers/app/menu_crash/Jamfile index 7f1b70be24..05b6cd5447 100644 --- a/src/tests/servers/app/menu_crash/Jamfile +++ b/src/tests/servers/app/menu_crash/Jamfile @@ -7,6 +7,6 @@ UseHeaders [ FDirName os interface ] ; Application MenuCrash : MenuCrash.cpp - : be [ TargetLibsupc++ ] + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; diff --git a/src/tests/servers/app/newerClipping/makefile b/src/tests/servers/app/newerClipping/makefile index b7c291d8f2..1e3d781bde 100644 --- a/src/tests/servers/app/newerClipping/makefile +++ b/src/tests/servers/app/newerClipping/makefile @@ -61,7 +61,7 @@ RSRCS= # naming scheme you need to specify the path to the library # and it's name # library: my_lib.a entry: my_lib.a or path/my_lib.a -LIBS= be game +LIBS= $(STDCPPLIBS) be game # specify additional paths to directories following the standard # libXXX.so or libXXX.a naming scheme. You can specify full paths diff --git a/src/tests/servers/app/playground/Jamfile b/src/tests/servers/app/playground/Jamfile index ba5b4470d1..26a72c018e 100644 --- a/src/tests/servers/app/playground/Jamfile +++ b/src/tests/servers/app/playground/Jamfile @@ -10,7 +10,7 @@ Application Playground : ObjectView.cpp ObjectWindow.cpp States.cpp - : be [ TargetLibsupc++ ] localestub + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] localestub : Playground.rdef ; diff --git a/src/tests/servers/app/pulsed_drawing/Jamfile b/src/tests/servers/app/pulsed_drawing/Jamfile index 164e3d763c..866702e2ff 100644 --- a/src/tests/servers/app/pulsed_drawing/Jamfile +++ b/src/tests/servers/app/pulsed_drawing/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; SimpleTest PulsedDrawing : main.cpp - : be [ TargetLibsupc++ ] ; + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if ( $(TARGET_PLATFORM) = libbe_test ) { HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : PulsedDrawing diff --git a/src/tests/servers/app/regularapps/Jamfile b/src/tests/servers/app/regularapps/Jamfile index b5de971bd7..245e380737 100644 --- a/src/tests/servers/app/regularapps/Jamfile +++ b/src/tests/servers/app/regularapps/Jamfile @@ -15,7 +15,7 @@ SimpleTest TestApp_Clock : cl_view.cpp cl_wind.cpp clock.cpp - : be localestub [ TargetLibsupc++ ] + : be localestub [ TargetLibstdc++ ] [ TargetLibsupc++ ] : Clock.rdef ; diff --git a/src/tests/servers/app/resize_limits/Jamfile b/src/tests/servers/app/resize_limits/Jamfile index e8f9448f78..00bba25cc3 100644 --- a/src/tests/servers/app/resize_limits/Jamfile +++ b/src/tests/servers/app/resize_limits/Jamfile @@ -4,5 +4,5 @@ AddSubDirSupportedPlatforms libbe_test ; Application ResizeLimits : ResizeLimits.cpp - : be [ TargetLibsupc++ ] + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; diff --git a/src/tests/servers/app/run b/src/tests/servers/app/run deleted file mode 100755 index fa8e796c64..0000000000 --- a/src/tests/servers/app/run +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -BASE=../../../../generated/tests/libbe_test/x86/apps - -if [ ! -f $BASE/test_app_server ]; then - echo "You need to \"TARGET_PLATFORM=libbe_test jam install-test-apps\" first." - exit -fi - -# launch registrar -$BASE/run_test_registrar || exit - -# launch app_server -$BASE/test_app_server & - -if [ "$#" -eq 0 ]; then - # no argument given, don't start any apps - exit -elif [ "$1" = "-o" ]; then - open $BASE - shift -fi - -sleep 1 - -for i in $@; do - $BASE/$i & -done diff --git a/src/tests/servers/app/run.sh b/src/tests/servers/app/run.sh new file mode 100755 index 0000000000..c6dc613127 --- /dev/null +++ b/src/tests/servers/app/run.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +if [ ! -f test_app_server ]; then + echo "You need to \"TARGET_PLATFORM=libbe_test jam -q install-test-apps\" first." + echo "Afterwards, make sure you head to the folder with the test_app_server and run the script installed there." + echo "If you need additional help, check in the \"NOTES\" file." + exit +fi + +# launch registrar +run_test_registrar || exit + +# launch app_server +test_app_server & + +if [ "$#" -eq 0 ]; then + # no argument given, don't start any apps + exit +elif [ "$1" = "-o" ]; then + open . + shift +fi + +sleep 1 + +for i in $@; do + $i & +done diff --git a/src/tests/servers/app/scrollbar/Jamfile b/src/tests/servers/app/scrollbar/Jamfile index 4829d0f3c9..45ab38c407 100644 --- a/src/tests/servers/app/scrollbar/Jamfile +++ b/src/tests/servers/app/scrollbar/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; SimpleTest ScrollBar : main.cpp - : be [ TargetLibsupc++ ] ; + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if ( $(TARGET_PLATFORM) = libbe_test ) { HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : ScrollBar diff --git a/src/tests/servers/app/scrolling/Jamfile b/src/tests/servers/app/scrolling/Jamfile index 633c547653..e3113efe3e 100644 --- a/src/tests/servers/app/scrolling/Jamfile +++ b/src/tests/servers/app/scrolling/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; SimpleTest Scrolling : main.cpp - : be [ TargetLibsupc++ ] ; + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; #if ( $(TARGET_PLATFORM) = libbe_test ) { # HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : Scrolling diff --git a/src/tests/servers/app/shape_test/Jamfile b/src/tests/servers/app/shape_test/Jamfile index 075b793b66..3823576ac2 100644 --- a/src/tests/servers/app/shape_test/Jamfile +++ b/src/tests/servers/app/shape_test/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; SimpleTest ShapeTest : main.cpp - : be [ TargetLibsupc++ ] + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if ( $(TARGET_PLATFORM) = libbe_test ) { diff --git a/src/tests/servers/app/stacktile/Jamfile b/src/tests/servers/app/stacktile/Jamfile index 274beaa139..ae23422370 100644 --- a/src/tests/servers/app/stacktile/Jamfile +++ b/src/tests/servers/app/stacktile/Jamfile @@ -8,7 +8,7 @@ UsePrivateHeaders interface ; Application StackTileTest : main.cpp - : [ TargetLibstdc++ ] be + : [ TargetLibstdc++ ] [ TargetLibstdc++ ] be ; if ( $(TARGET_PLATFORM) = libbe_test ) { diff --git a/src/tests/servers/app/statusbar/Jamfile b/src/tests/servers/app/statusbar/Jamfile index f24a7372df..a98ff19dd1 100644 --- a/src/tests/servers/app/statusbar/Jamfile +++ b/src/tests/servers/app/statusbar/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; SimpleTest StatusBar : main.cpp - : be [ TargetLibsupc++ ] ; + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if ( $(TARGET_PLATFORM) = libbe_test ) { HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : StatusBar diff --git a/src/tests/servers/app/text_rendering/Jamfile b/src/tests/servers/app/text_rendering/Jamfile index b51e28eb05..fa2c9624d7 100644 --- a/src/tests/servers/app/text_rendering/Jamfile +++ b/src/tests/servers/app/text_rendering/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; SimpleTest TextRendering : main.cpp - : be [ TargetLibsupc++ ] ; + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if ( $(TARGET_PLATFORM) = libbe_test ) { HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : TextRendering diff --git a/src/tests/servers/app/textview/Jamfile b/src/tests/servers/app/textview/Jamfile index 3350eb9399..32bb062529 100644 --- a/src/tests/servers/app/textview/Jamfile +++ b/src/tests/servers/app/textview/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; SimpleTest TextView : main.cpp - : be [ TargetLibsupc++ ] ; + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; #if ( $(TARGET_PLATFORM) = libbe_test ) { # HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : TextView diff --git a/src/tests/servers/app/transformation/Jamfile b/src/tests/servers/app/transformation/Jamfile index fe227f63ab..e818d74893 100644 --- a/src/tests/servers/app/transformation/Jamfile +++ b/src/tests/servers/app/transformation/Jamfile @@ -10,7 +10,7 @@ SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src tests servers app harness ] ; SimpleTest Transformation : harness.cpp main.cpp - : be [ TargetLibsupc++ ] + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] : Transformation.rdef ; diff --git a/src/tests/servers/app/view_state/Jamfile b/src/tests/servers/app/view_state/Jamfile index d8a0127fdc..5920226783 100644 --- a/src/tests/servers/app/view_state/Jamfile +++ b/src/tests/servers/app/view_state/Jamfile @@ -7,7 +7,7 @@ UseHeaders [ FDirName os interface ] ; Application ViewState : ViewState.cpp - : be [ TargetLibsupc++ ] + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; if $(TARGET_PLATFORM) = libbe_test { diff --git a/src/tests/servers/app/view_transit/Jamfile b/src/tests/servers/app/view_transit/Jamfile index e5790bcb1a..dff0030fed 100644 --- a/src/tests/servers/app/view_transit/Jamfile +++ b/src/tests/servers/app/view_transit/Jamfile @@ -7,6 +7,6 @@ UseHeaders [ FDirName os interface ] ; Application ViewTransit : ViewTransit.cpp - : be [ TargetLibsupc++ ] + : be [ TargetLibstdc++ ] [ TargetLibsupc++ ] ; diff --git a/src/tests/servers/registrar/RegistrarTest1.cpp b/src/tests/servers/registrar/RegistrarTest1.cpp index 11e3cadf0f..d162e183c5 100644 --- a/src/tests/servers/registrar/RegistrarTest1.cpp +++ b/src/tests/servers/registrar/RegistrarTest1.cpp @@ -6,8 +6,9 @@ class TestApp : public BApplication { public: - TestApp(const char *signature) - : BApplication(signature) + TestApp(const char* signature) + : + BApplication(signature) { } @@ -15,18 +16,18 @@ public: { } - virtual void ArgvReceived(int32 argc, char **argv) + virtual void ArgvReceived(int32 argc, char** argv) { - printf("TestApp::ArgvReceived(%ld)\n", argc); + printf("TestApp::ArgvReceived(%" B_PRId32 ")\n", argc); BMessage *message = CurrentMessage(); message->PrintToStream(); BMessenger returnAddress(message->ReturnAddress()); - printf("team: %ld\n", returnAddress.Team()); + printf("team: %" B_PRId32 "\n", returnAddress.Team()); for (int32 i = 0; i < argc; i++) - printf("arg %ld: `%s'\n", i, argv[i]); + printf("arg %" B_PRId32 ": `%s'\n", i, argv[i]); } - virtual void RefsReceived(BMessage *message) + virtual void RefsReceived(BMessage* message) { printf("TestApp::RefsReceived()\n"); message->PrintToStream(); @@ -44,9 +45,10 @@ public: int main() { - TestApp *app = new TestApp("application/x-vnd.OBOS-TestApp1"); + TestApp* app = new TestApp("application/x-vnd.Haiku-TestApp1"); app->Run(); delete app; + return 0; } diff --git a/src/tests/servers/registrar/RosterShell.cpp b/src/tests/servers/registrar/RosterShell.cpp index 0dd89a6505..6f6a83f426 100644 --- a/src/tests/servers/registrar/RosterShell.cpp +++ b/src/tests/servers/registrar/RosterShell.cpp @@ -1,9 +1,10 @@ // RosterShell.cpp +#include +#include #include #include #include -#include #include #include @@ -11,6 +12,9 @@ #include #include +using std::string; +using std::vector; + const char kShellUsage[] = "Commands Parameters Description\n" "---------------------------------------------------------------------------\n" @@ -29,13 +33,15 @@ const char kShellUsage[] = class Shell { public: Shell() - : fTerminating(false) + : + fTerminating(false) { } bool IsTerminating() const { return fTerminating; } - void DoCommand(vector &cmdLine) + void + DoCommand(vector& cmdLine) { if (cmdLine.size() > 0) { string command = cmdLine[0]; @@ -44,7 +50,7 @@ public: else if (command == "exit" || command == "e") CmdExit(cmdLine); else if (command == "help" || command == "h") - Usage(); + Usage(string(" ")); else if (command == "launch") CmdLaunch(cmdLine); else if (command == "list" || command == "l") @@ -58,43 +64,50 @@ public: } } - void Usage(string error = "") + void + Usage(string error) { if (error.length() > 0) - cout << error << endl; - cout << kShellUsage; + std::cout << error << std::endl; + std::cout << kShellUsage; } - void CmdActivate(vector &args) + void + CmdActivate(vector& args) { BRoster roster; + // get a list of team IDs BList teamList; if (args.size() <= 1) { printf("activate: requires exactly one argument\n"); return; } + ParseTeamList(args, &teamList); int32 count = teamList.CountItems(); if (count != 1) { printf("activate: requires exactly one argument\n"); return; } + // activate the team team_id team = (team_id)(uintptr_t)teamList.ItemAt(0); status_t error = roster.ActivateApp(team); if (error != B_OK) { - printf("activate: failed to activate application %ld: %s\n", - team, strerror(error)); + printf("activate: failed to activate application %" B_PRId32 + ": %s\n", team, strerror(error)); } } - void CmdExit(vector &) + void + CmdExit(vector&) { fTerminating = true; } - void CmdLaunch(vector &args) + void + CmdLaunch(vector& args) { // check args if (args.size() != 2) { @@ -118,32 +131,37 @@ public: team_id teamID; error = roster.Launch(&ref, (const BMessage*)NULL, &teamID); if (error == B_OK) { - printf("launched \"%s\", team id: %ld\n", program.c_str(), teamID); + printf("launched \"%s\", team id: %" B_PRId32 "\n", program.c_str(), + teamID); } else { printf("launch: Failed to launch \"%s\": %s\n", program.c_str(), strerror(error)); } } - static void ParseTeamList(vector &args, BList *teamList) + static void + ParseTeamList(vector& args, BList* teamList) { for (int32 i = 1; i < (int32)args.size(); i++) { string arg = args[i]; team_id team = -1; - if (sscanf(arg.c_str(), "%ld", &team) > 0) - teamList->AddItem((void*)team); + if (sscanf(arg.c_str(), "%" B_PRId32, &team) > 0) + teamList->AddItem((void*)(addr_t)team); } } - void CmdList(vector &args) + void + CmdList(vector& args) { BRoster roster; + // get a list of team IDs BList teamList; if (args.size() > 1) ParseTeamList(args, &teamList); else roster.GetAppList(&teamList); + // print an info for each team int32 count = teamList.CountItems(); printf("%-8s%-40s\n", "team", "signature"); @@ -153,37 +171,40 @@ public: app_info info; status_t error = roster.GetRunningAppInfo(team, &info); if (error == B_OK) - printf("%-8ld%-40s\n", team, info.signature); + printf("%-8" B_PRId32 "%-40s\n", team, info.signature); else { - printf("%-8ldfailed to get the app_info: %s\n", team, + printf("%-8" B_PRId32 "failed to get the app_info: %s\n", team, strerror(error)); } } printf("\n"); } - void CmdListLong(vector &args) + void + CmdListLong(vector& args) { BRoster roster; + // get a list of team IDs BList teamList; if (args.size() > 1) ParseTeamList(args, &teamList); else roster.GetAppList(&teamList); + // print an info for each team int32 count = teamList.CountItems(); for (int32 i = 0; i < count; i++) { team_id team = (team_id)(uintptr_t)teamList.ItemAt(i); - printf("team %8ld\n", team); + printf("team %8" B_PRId32 "\n", team); printf("-------------\n"); app_info info; status_t error = roster.GetRunningAppInfo(team, &info); if (error == B_OK) { printf("signature: %s\n", info.signature); - printf("thread: %ld\n", info.thread); - printf("port: %ld\n", info.port); - printf("flags: 0x%lx\n", info.flags); + printf("thread: %" B_PRId32 "\n", info.thread); + printf("port: %" B_PRId32 "\n", info.port); + printf("flags: 0x%" B_PRIx32 "\n", info.flags); printf("file: %s\n", BPath(&info.ref).Path()); } else printf("failed to get the app_info: %s\n", strerror(error)); @@ -191,7 +212,8 @@ public: } } - void CmdQuit(vector &args) + void + CmdQuit(vector& args) { BRoster roster; // get a list of team IDs @@ -200,12 +222,14 @@ public: printf("quit: requires at least one argument\n"); return; } + ParseTeamList(args, &teamList); int32 count = teamList.CountItems(); if (count < 1) { printf("quit: requires at least one argument\n"); return; } + // send a B_QUIT_REQUESTED message to each team for (int32 i = 0; i < count; i++) { team_id team = (team_id)(uintptr_t)teamList.ItemAt(i); @@ -215,12 +239,12 @@ public: error = messenger.SendMessage(B_QUIT_REQUESTED); if (error != B_OK) { printf("quit: failed to deliver the B_QUIT_REQUESTED " - "message to team %ld\n", team); + "message to team %" B_PRId32 "\n", team); printf(" %s\n", strerror(error)); } } else { - printf("quit: failed to create a messenger for team %ld\n", - team); + printf("quit: failed to create a messenger for team %" B_PRId32 + "\n", team); printf(" %s\n", strerror(error)); } } @@ -233,11 +257,18 @@ private: // read_line bool -read_line(char *line, size_t size) +read_line(char* line, size_t size) { - cout << "roster> "; - cout.flush(); - return cin.getline(line, size); + std::cout << "roster> "; + std::cout.flush(); + + try { + std::cin.getline(line, size); + } catch (const std::exception &ex) { + return false; + } + + return true; } // main @@ -245,11 +276,12 @@ int main() { Shell shell; + // main input loop char line[10240]; while (!shell.IsTerminating() && read_line(line, sizeof(line))) { // parse args - istrstream in(line); + std::istringstream in(line); vector args; string arg; while (in >> arg) @@ -257,6 +289,7 @@ main() // invoke command shell.DoCommand(args); } + return 0; }