From 25dc253d6ab28ce204fa4de2d3e7a27d167fc817 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 22 Nov 2010 13:06:36 +0000 Subject: [PATCH] * Merged weak-symbols branch. * Fixed trivial merge conflict in src/system/libroot/posix/locale/nl_langinfo.cpp * Fixed gcc 2 compilation of src/system/glue/init_term_dyn.c. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39571 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/OptionalBuildFeatures | 7 +- build/jam/OptionalPackages | 413 +++++++++++------- configure | 1 + headers/os/locale/Catalog.h | 14 +- headers/os/locale/Locale.h | 6 +- headers/os/locale/LocaleRoster.h | 5 +- headers/posix/resolv.h | 2 +- .../private/libroot/locale/ICUCategoryData.h | 2 + .../private/libroot/locale/ICUCollateData.h | 2 + headers/private/libroot/locale/ICUCtypeData.h | 2 + .../private/libroot/locale/ICULocaleBackend.h | 2 + .../libroot/locale/ICULocaleconvData.h | 2 + .../private/libroot/locale/ICUMessagesData.h | 2 + .../private/libroot/locale/ICUMonetaryData.h | 2 + .../private/libroot/locale/ICUNumericData.h | 2 + .../libroot/locale/ICUTimeConversion.h | 2 + headers/private/libroot/locale/ICUTimeData.h | 2 + .../private/libroot/locale/LocaleBackend.h | 2 + headers/private/libroot/locale/PosixCtype.h | 2 + .../private/libroot/locale/PosixLanginfo.h | 2 + .../private/libroot/locale/PosixLocaleConv.h | 2 + .../private/libroot/time/PosixLCTimeInfo.h | 2 + headers/private/locale/MutableLocaleRoster.h | 12 +- headers/private/system/elf32.h | 66 ++- src/apps/aboutsystem/AboutSystem.cpp | 14 +- src/apps/deskbar/BarApp.cpp | 2 +- src/apps/deskbar/CalendarMenuWindow.cpp | 2 +- src/apps/deskbar/TimeView.cpp | 6 +- src/apps/icon-o-matic/CanvasView.h | 10 +- src/apps/icon-o-matic/Jamfile | 5 +- src/apps/icon-o-matic/MainWindow.h | 12 +- src/apps/icon-o-matic/Util.h | 11 +- src/apps/icon-o-matic/document/Document.cpp | 8 +- src/apps/icon-o-matic/document/Document.h | 18 +- src/apps/icon-o-matic/gui/GradientControl.h | 19 +- src/apps/icon-o-matic/gui/IconView.h | 9 +- src/apps/icon-o-matic/gui/PathListView.h | 11 +- src/apps/icon-o-matic/gui/ShapeListView.h | 10 +- src/apps/icon-o-matic/gui/StyleListView.h | 10 +- src/apps/icon-o-matic/gui/StyleView.h | 11 +- .../icon-o-matic/gui/TransformerListView.h | 7 +- .../icon-o-matic/import_export/Exporter.h | 13 +- .../icon-o-matic/import_export/Importer.h | 11 +- .../flat_icon/FlatIconExporter.h | 21 +- .../import_export/message/MessageExporter.h | 7 +- .../styled_text/StyledTextImporter.h | 8 +- .../import_export/svg/DocumentBuilder.h | 23 +- .../import_export/svg/SVGExporter.h | 10 +- .../import_export/svg/SVGGradients.h | 9 +- .../shape/commands/AddPathsCommand.h | 13 +- .../shape/commands/AddShapesCommand.h | 13 +- .../shape/commands/AddTransformersCommand.h | 13 +- .../commands/FreezeTransformationCommand.h | 13 +- .../shape/commands/MovePathsCommand.h | 14 +- .../shape/commands/MoveShapesCommand.h | 13 +- .../shape/commands/MoveTransformersCommand.h | 15 +- .../shape/commands/NudgePointsCommand.h | 13 +- .../icon-o-matic/shape/commands/PathCommand.h | 13 +- .../shape/commands/RemovePathsCommand.h | 13 +- .../shape/commands/RemoveShapesCommand.h | 13 +- .../commands/RemoveTransformersCommand.h | 13 +- .../shape/commands/TransformPointsCommand.h | 13 +- .../shape/commands/UnassignPathCommand.h | 13 +- .../icon-o-matic/style/AddStylesCommand.h | 13 +- .../icon-o-matic/style/AssignStyleCommand.h | 11 +- .../icon-o-matic/style/MoveStylesCommand.h | 14 +- .../icon-o-matic/style/RemoveStylesCommand.h | 13 +- src/apps/icon-o-matic/style/SetColorCommand.h | 11 +- .../icon-o-matic/style/SetGradientCommand.h | 11 +- .../ResetTransformationCommand.h | 17 +- .../transformable/TransformGradientBox.h | 11 +- .../transformable/TransformGradientCommand.h | 12 +- .../transformable/TransformObjectsCommand.h | 13 +- .../transformable/TransformPointsBox.h | 11 +- .../transformable/TransformShapesBox.h | 11 +- .../readonlybootprompt/BootPromptWindow.cpp | 25 +- src/bin/coreutils/lib/Jamfile | 4 +- src/bin/dstcheck.cpp | 2 +- src/kits/locale/Catalog.cpp | 16 +- src/kits/locale/Country.cpp | 7 +- src/kits/locale/DurationFormat.cpp | 2 +- src/kits/locale/FormattingConventions.cpp | 2 +- src/kits/locale/Language.cpp | 2 +- src/kits/locale/LibbeLocaleBackend.cpp | 2 +- src/kits/locale/Locale.cpp | 11 +- src/kits/locale/LocaleRoster.cpp | 41 +- src/kits/locale/MutableLocaleRoster.cpp | 83 ++-- src/kits/locale/TimeUnitFormat.cpp | 2 +- src/kits/tracker/WidgetAttributeText.cpp | 6 +- src/libs/icon/Icon.h | 10 +- src/libs/icon/IconBuild.h | 22 + src/libs/icon/IconRenderer.h | 16 +- src/libs/icon/IconUtils.cpp | 2 +- src/libs/icon/flat_icon/FlatIconFormat.cpp | 12 +- src/libs/icon/flat_icon/FlatIconFormat.h | 11 +- src/libs/icon/flat_icon/FlatIconImporter.h | 13 +- .../icon/flat_icon/LittleEndianBuffer.cpp | 4 +- src/libs/icon/flat_icon/LittleEndianBuffer.h | 11 +- src/libs/icon/flat_icon/PathCommandQueue.h | 11 +- src/libs/icon/message/Defines.cpp | 9 + src/libs/icon/message/Defines.h | 10 + src/libs/icon/message/MessageImporter.h | 13 +- src/libs/icon/shape/PathContainer.h | 11 +- src/libs/icon/shape/Shape.h | 14 +- src/libs/icon/shape/ShapeContainer.h | 11 +- src/libs/icon/shape/VectorPath.h | 16 +- src/libs/icon/style/GradientTransformable.h | 11 +- src/libs/icon/style/Style.h | 20 +- src/libs/icon/style/StyleContainer.h | 11 +- src/libs/icon/transformable/Transformable.h | 17 +- .../icon/transformer/AffineTransformer.cpp | 4 +- src/libs/icon/transformer/AffineTransformer.h | 10 +- .../icon/transformer/ContourTransformer.cpp | 2 +- .../icon/transformer/ContourTransformer.h | 9 +- src/libs/icon/transformer/PathSource.h | 10 +- .../transformer/PerspectiveTransformer.cpp | 3 +- .../icon/transformer/PerspectiveTransformer.h | 10 +- .../icon/transformer/StrokeTransformer.cpp | 3 +- src/libs/icon/transformer/StrokeTransformer.h | 10 +- src/libs/icon/transformer/Transformer.cpp | 2 +- src/libs/icon/transformer/Transformer.h | 11 +- .../icon/transformer/TransformerFactory.cpp | 3 +- .../icon/transformer/TransformerFactory.h | 14 +- src/preferences/locale/FormatSettingsView.cpp | 43 +- src/preferences/locale/LanguageListView.cpp | 2 +- src/preferences/locale/LocaleWindow.cpp | 21 +- src/preferences/time/DateTimeEdit.cpp | 10 +- src/preferences/time/ZoneView.cpp | 19 +- src/system/glue/arch/m68k/crti.S | 4 +- src/system/glue/arch/mipsel/crti.S | 4 +- src/system/glue/arch/mipsel/crtn.S | 6 +- src/system/glue/arch/ppc/crti.S | 4 +- src/system/glue/arch/ppc/crtn.S | 4 +- src/system/glue/arch/x86/crti.S | 4 +- src/system/glue/arch/x86/crtn.S | 4 +- src/system/glue/init_term_dyn.c | 49 ++- src/system/glue/init_term_dyn.h | 9 +- .../device_manager/AbstractModuleDevice.h | 11 +- src/system/kernel/device_manager/BaseDevice.h | 9 + src/system/kernel/device_manager/FileDevice.h | 9 + .../kernel/device_manager/devfs_private.h | 7 +- .../kernel/device_manager/device_manager.cpp | 8 + src/system/kernel/elf.cpp | 105 +++-- .../libroot/add-ons/icu/ICUCategoryData.cpp | 2 + .../libroot/add-ons/icu/ICUCollateData.cpp | 2 + .../libroot/add-ons/icu/ICUCtypeData.cpp | 2 + .../libroot/add-ons/icu/ICULocaleBackend.cpp | 2 + .../libroot/add-ons/icu/ICULocaleconvData.cpp | 2 + .../libroot/add-ons/icu/ICUMessagesData.cpp | 2 + .../libroot/add-ons/icu/ICUMonetaryData.cpp | 2 + .../libroot/add-ons/icu/ICUNumericData.cpp | 2 + .../libroot/add-ons/icu/ICUTimeConversion.cpp | 2 + .../libroot/add-ons/icu/ICUTimeData.cpp | 2 + .../libroot/posix/locale/LocaleBackend.cpp | 4 +- .../libroot/posix/locale/LocaleData.cpp | 8 +- .../libroot/posix/locale/LocaleDataBridge.cpp | 2 + .../libroot/posix/locale/localeconv.cpp | 4 +- .../libroot/posix/locale/nl_langinfo.cpp | 4 +- src/system/libroot/posix/locale/setlocale.cpp | 4 +- src/system/libroot/posix/locale/wctype.cpp | 2 +- src/system/libroot/posix/string/strcoll.cpp | 2 +- src/system/libroot/posix/string/strxfrm.cpp | 2 +- src/system/libroot/posix/time/asctime.cpp | 2 +- src/system/libroot/posix/time/localtime.cpp | 4 +- src/system/libroot/posix/time/timelocal.cpp | 4 +- .../arch/m68k/arch_relocate.cpp | 14 +- .../runtime_loader/arch/ppc/arch_relocate.cpp | 10 +- .../runtime_loader/arch/x86/arch_relocate.cpp | 12 +- src/system/runtime_loader/elf.cpp | 28 +- src/system/runtime_loader/elf_load_image.cpp | 25 +- .../runtime_loader/elf_symbol_lookup.cpp | 373 +++++++++------- src/system/runtime_loader/elf_symbol_lookup.h | 60 ++- src/system/runtime_loader/elf_versioning.cpp | 1 + .../runtime_loader/runtime_loader_private.h | 8 +- 174 files changed, 1622 insertions(+), 1010 deletions(-) create mode 100644 src/libs/icon/IconBuild.h diff --git a/build/jam/OptionalBuildFeatures b/build/jam/OptionalBuildFeatures index bfcbab8526..f8693b560d 100644 --- a/build/jam/OptionalBuildFeatures +++ b/build/jam/OptionalBuildFeatures @@ -11,8 +11,13 @@ if [ IsOptionalHaikuImagePackageAdded OpenSSL ] { HAIKU_BUILD_FEATURE_SSL = 1 ; } +if $(HAIKU_GCC_VERSION[1]) >= 4 { + HAIKU_OPENSSL_PACKAGE = openssl-1.0.0a-x86-gcc4-2010-11-12.zip ; +} else { + HAIKU_OPENSSL_PACKAGE = openssl-1.0.0a-x86-gcc2-2010-08-29.zip ; +} + local baseURL = http://haiku-files.org/files/optional-packages ; -HAIKU_OPENSSL_PACKAGE = openssl-1.0.0a-x86-gcc2-2010-08-29.zip ; HAIKU_OPENSSL_URL = $(baseURL)/$(HAIKU_OPENSSL_PACKAGE) ; if $(HAIKU_BUILD_FEATURE_SSL) { diff --git a/build/jam/OptionalPackages b/build/jam/OptionalPackages index 5fe6683781..59976c6e10 100644 --- a/build/jam/OptionalPackages +++ b/build/jam/OptionalPackages @@ -113,12 +113,14 @@ if [ IsOptionalHaikuImagePackageAdded ABI-compliance-checker ] { if [ IsOptionalHaikuImagePackageAdded APR ] { if $(TARGET_ARCH) != x86 { Echo "No optional package APR available for $(TARGET_ARCH)" ; + } else if $(HAIKU_GCC_VERSION[1]) >= 4 { + InstallOptionalHaikuImagePackage apr-1.4.2-x86-gcc4-2010-11-12.zip + : $(baseURL)/apr-1.4.2-x86-gcc4-2010-11-12.zip + : : true ; } else { InstallOptionalHaikuImagePackage apr-1.4.2-x86-gcc2-2010-10-13.zip : $(baseURL)/apr-1.4.2-x86-gcc2-2010-10-13.zip - : - : true - ; + : : true ; } } @@ -127,13 +129,14 @@ if [ IsOptionalHaikuImagePackageAdded APR ] { if [ IsOptionalHaikuImagePackageAdded APR-util ] { if $(TARGET_ARCH) != x86 { Echo "No optional package APR-util available for $(TARGET_ARCH)" ; + } else if $(HAIKU_GCC_VERSION[1]) >= 4 { + InstallOptionalHaikuImagePackage apr-util-1.3.10-x86-gcc4-2010-11-12.zip + : $(baseURL)/apr-util-1.3.10-x86-gcc4-2010-11-12.zip + : : true ; } else { - InstallOptionalHaikuImagePackage - apr-util-1.3.10-x86-gcc2-2010-10-13.zip + InstallOptionalHaikuImagePackage apr-util-1.3.10-x86-gcc2-2010-10-13.zip : $(baseURL)/apr-util-1.3.10-x86-gcc2-2010-10-13.zip - : - : true - ; + : : true ; } } @@ -391,12 +394,12 @@ if [ IsOptionalHaikuImagePackageAdded CCache ] { if [ IsOptionalHaikuImagePackageAdded CDRecord ] { if $(TARGET_ARCH) != x86 { Echo "No optional package CDRecord available for $(TARGET_ARCH)" ; + } else if $(HAIKU_GCC_VERSION[1]) >= 4 { + InstallOptionalHaikuImagePackage cdrtools-3.00-x86-gcc4-2010-11-12.zip + : $(baseURL)/cdrtools-3.00-x86-gcc4-2010-11-12.zip ; } else { - InstallOptionalHaikuImagePackage - cdrtools-3.00-x86-gcc2-2010-08-25-1.zip - : $(baseURL)/cdrtools-3.00-x86-gcc2-2010-08-25-1.zip - : - ; + InstallOptionalHaikuImagePackage cdrtools-3.00-x86-gcc2-2010-08-25-1.zip + : $(baseURL)/cdrtools-3.00-x86-gcc2-2010-08-25-1.zip ; } } @@ -470,13 +473,14 @@ if [ IsOptionalHaikuImagePackageAdded CMake ] { if [ IsOptionalHaikuImagePackageAdded Curl ] { if $(TARGET_ARCH) != x86 { Echo "No optional package Curl available for $(TARGET_ARCH)" ; + } else if $(HAIKU_GCC_VERSION[1]) >= 4 { + InstallOptionalHaikuImagePackage curl-7.21.2-x86-gcc4-2010-11-12.zip + : $(baseURL)/curl-7.21.2-x86-gcc4-2010-11-12.zip + : : true ; } else { - InstallOptionalHaikuImagePackage - curl-7.21.2-x86-gcc2-2010-10-13.zip + InstallOptionalHaikuImagePackage curl-7.21.2-x86-gcc2-2010-10-13.zip : $(baseURL)/curl-7.21.2-x86-gcc2-2010-10-13.zip - : - : true - ; + : : true ; } } @@ -486,12 +490,18 @@ if [ IsOptionalHaikuImagePackageAdded CVS ] { if $(TARGET_ARCH) != x86 { Echo "No optional package CVS available for $(TARGET_ARCH)" ; } else { - InstallOptionalHaikuImagePackage - cvs-1.12.13-r1a2-x86-gcc2-2010-04-29-a.zip - : $(baseURL)/cvs-1.12.13-r1a2-x86-gcc2-2010-04-29-a.zip - : - : true - ; + if $(HAIKU_GCC_VERSION[1]) >= 4 { + InstallOptionalHaikuImagePackage + cvs-1.12.13.1-x86-gcc4-2010-11-12.zip + : $(baseURL)/cvs-1.12.13.1-x86-gcc4-2010-11-12.zip + : : true ; + } else { + InstallOptionalHaikuImagePackage + cvs-1.12.13-r1a2-x86-gcc2-2010-04-29-a.zip + : $(baseURL)/cvs-1.12.13-r1a2-x86-gcc2-2010-04-29-a.zip + : : true ; + } + InstallSourceArchive cvs-1.12.13_haiku-2010-04-29.tar.xz : $(baseSourceURL)/2010/cvs-1.12.13_haiku-2010-04-29.tar.xz ; } @@ -501,27 +511,39 @@ if [ IsOptionalHaikuImagePackageAdded CVS ] { # Development if [ IsOptionalHaikuImagePackageAdded Development ] && $(TARGET_ARCH) = x86 { # autotools - InstallOptionalHaikuImagePackage autoconf-2.68-x86-gcc2-2010-09-23.zip - : $(baseURL)/autoconf-2.68-x86-gcc2-2010-09-23.zip - : - : true - ; - InstallOptionalHaikuImagePackage automake-1.11.1-r1a2-x86-gcc2-2010-04-21-a.zip - : $(baseURL)/automake-1.11.1-r1a2-x86-gcc2-2010-04-21-a.zip - : - : true ; + if $(HAIKU_GCC_VERSION[1]) >= 4 { + InstallOptionalHaikuImagePackage autoconf-2.68-x86-gcc4-2010-11-12.zip + : $(baseURL)/autoconf-2.68-x86-gcc4-2010-11-12.zip + : : true ; + InstallOptionalHaikuImagePackage automake-1.11.1-x86-gcc4-2010-11-12.zip + : $(baseURL)/automake-1.11.1-x86-gcc4-2010-11-12.zip + : : true ; + InstallOptionalHaikuImagePackage libtool-2.4-x86-gcc4-2010-11-12.zip + : $(baseURL)/libtool-2.4-x86-gcc4-2010-11-12.zip + : : true ; + InstallOptionalHaikuImagePackage texinfo-4.13a-x86-gcc4-2010-11-12.zip + : $(baseURL)/texinfo-4.13a-x86-gcc4-2010-11-12.zip + : : true ; + } else { + InstallOptionalHaikuImagePackage autoconf-2.68-x86-gcc2-2010-09-23.zip + : $(baseURL)/autoconf-2.68-x86-gcc2-2010-09-23.zip + : : true ; + InstallOptionalHaikuImagePackage + automake-1.11.1-r1a2-x86-gcc2-2010-04-21-a.zip + : $(baseURL)/automake-1.11.1-r1a2-x86-gcc2-2010-04-21-a.zip + : : true ; + InstallOptionalHaikuImagePackage libtool-2.4-x86-gcc2-2010-09-25.zip + : $(baseURL)/libtool-2.4-x86-gcc2-2010-09-25.zip + : : true ; + InstallOptionalHaikuImagePackage + texinfo-4.13a-r1a2-x86-gcc2-2010-04-21-a.zip + : $(baseURL)/texinfo-4.13a-r1a2-x86-gcc2-2010-04-21-a.zip + : : true ; + } + InstallSourceArchive automake-1.11.1_haiku-2010-04-29.tar.xz : $(baseSourceURL)/2010/automake-1.11.1_haiku-2010-04-29.tar.xz ; - InstallOptionalHaikuImagePackage libtool-2.4-x86-gcc2-2010-09-25.zip - : $(baseURL)/libtool-2.4-x86-gcc2-2010-09-25.zip - : - : true - ; - InstallOptionalHaikuImagePackage texinfo-4.13a-r1a2-x86-gcc2-2010-04-21-a.zip - : $(baseURL)/texinfo-4.13a-r1a2-x86-gcc2-2010-04-21-a.zip - : - : true ; InstallSourceArchive texinfo-4.13a_haiku-2010-04-29.tar.xz : $(baseSourceURL)/2010/texinfo-4.13a_haiku-2010-04-29.tar.xz ; @@ -546,8 +568,8 @@ if [ IsOptionalHaikuImagePackageAdded DevelopmentBase ] } if $(HAIKU_GCC_VERSION[1]) = 4 || $(isHybridBuild) { - InstallOptionalHaikuImagePackage gcc-4.4.4-x86-gcc4-2010-10-09.zip - : $(baseURL)/gcc-4.4.4-x86-gcc4-2010-10-09.zip ; + InstallOptionalHaikuImagePackage gcc-4.4.4-x86-gcc4-2010-11-11.zip + : $(baseURL)/gcc-4.4.4-x86-gcc4-2010-11-11.zip ; } if $(HAIKU_GCC_VERSION[1]) = 4 { @@ -559,30 +581,51 @@ if [ IsOptionalHaikuImagePackageAdded DevelopmentBase ] local libs = libstdc++.so libsupc++.so ; for lib in $(libs) { AddSymlinkToHaikuHybridImage - develop abi x86 gcc4 tools gcc-4.4.4-haiku-100705 lib + develop abi x86 gcc4 tools gcc-4.4.4-haiku-101111 lib : /system/lib $(lib) : : true ; } } # other commonly used tools - InstallOptionalHaikuImagePackage bison-2.4.1-r1a2-x86-gcc2-2010-04-21-a.zip - : $(baseURL)/bison-2.4.1-r1a2-x86-gcc2-2010-04-21-a.zip ; + if $(HAIKU_GCC_VERSION[1]) >= 4 { + InstallOptionalHaikuImagePackage + bison-2.4.1-x86-gcc4-2010-11-12.zip + : $(baseURL)/bison-2.4.1-x86-gcc4-2010-11-12.zip ; + InstallOptionalHaikuImagePackage + m4-1.4.14-x86-gcc4-2010-11-12.zip + : $(baseURL)/m4-1.4.14-x86-gcc4-2010-11-12.zip ; + InstallOptionalHaikuImagePackage flex-2.5.35-x86-gcc4-2010-11-12.zip + : $(baseURL)/flex-2.5.35-x86-gcc4-2010-11-12.zip ; + InstallOptionalHaikuImagePackage jam-2.5-x86-gcc4-2010-11-12.zip + : $(baseURL)/jam-2.5-x86-gcc4-2010-11-12.zip ; + InstallOptionalHaikuImagePackage mkdepend-1.7-x86-gcc4-2010-11-12.zip + : $(baseURL)/mkdepend-1.7-x86-gcc4-2010-11-12.zip ; + InstallOptionalHaikuImagePackage make-3.82-x86-gcc4-2010-11-12.zip + : $(baseURL)/make-3.82-x86-gcc4-2010-11-12.zip ; + } else { + InstallOptionalHaikuImagePackage + bison-2.4.1-r1a2-x86-gcc2-2010-04-21-a.zip + : $(baseURL)/bison-2.4.1-r1a2-x86-gcc2-2010-04-21-a.zip ; + InstallOptionalHaikuImagePackage + m4-1.4.14-r1a2-x86-gcc2-2010-04-21-a.zip + : $(baseURL)/m4-1.4.14-r1a2-x86-gcc2-2010-04-21-a.zip ; + InstallOptionalHaikuImagePackage + flex-2.5.35-r1a2-x86-gcc2-2010-04-21-a.zip + : $(baseURL)/flex-2.5.35-r1a2-x86-gcc2-2010-04-21-a.zip ; + InstallOptionalHaikuImagePackage jam-2.5-r1a2-x86-gcc2-2010-04-21.zip + : $(baseURL)/jam-2.5-r1a2-x86-gcc2-2010-04-21.zip ; + InstallOptionalHaikuImagePackage mkdepend-1.7-x86-gcc2-2010-09-24.zip + : $(baseURL)/mkdepend-1.7-x86-gcc2-2010-09-24.zip ; + InstallOptionalHaikuImagePackage make-3.82-x86-gcc2-2010-09-25.zip + : $(baseURL)/make-3.82-x86-gcc2-2010-09-25.zip ; + } + InstallSourceArchive bison-2.4.1_haiku-2010-04-29.tar.xz : $(baseSourceURL)/2010/bison-2.4.1_haiku-2010-04-29.tar.xz ; - InstallOptionalHaikuImagePackage m4-1.4.14-r1a2-x86-gcc2-2010-04-21-a.zip - : $(baseURL)/m4-1.4.14-r1a2-x86-gcc2-2010-04-21-a.zip ; InstallSourceArchive m4-1.4.14_haiku-2010-04-29.tar.xz : $(baseSourceURL)/2010/m4-1.4.14_haiku-2010-04-29.tar.xz ; - InstallOptionalHaikuImagePackage flex-2.5.35-r1a2-x86-gcc2-2010-04-21-a.zip - : $(baseURL)/flex-2.5.35-r1a2-x86-gcc2-2010-04-21-a.zip ; InstallSourceArchive flex-2.5.35_haiku-2010-04-29.tar.xz : $(baseSourceURL)/2010/flex-2.5.35_haiku-2010-04-29.tar.xz ; - InstallOptionalHaikuImagePackage jam-2.5-r1a2-x86-gcc2-2010-04-21.zip - : $(baseURL)/jam-2.5-r1a2-x86-gcc2-2010-04-21.zip ; - InstallOptionalHaikuImagePackage mkdepend-1.7-x86-gcc2-2010-09-24.zip - : $(baseURL)/mkdepend-1.7-x86-gcc2-2010-09-24.zip ; - InstallOptionalHaikuImagePackage make-3.82-x86-gcc2-2010-09-25.zip - : $(baseURL)/make-3.82-x86-gcc2-2010-09-25.zip ; } @@ -724,13 +767,19 @@ if [ IsOptionalHaikuImagePackageAdded Expat ] { if $(TARGET_ARCH) != x86 { Echo "No optional package Expat available for $(TARGET_ARCH)" ; } else { - InstallOptionalHaikuImagePackage - expat-2.0.1-r1a2-x86-gcc2-2010-04-22-a.zip - : $(baseURL)/expat-2.0.1-r1a2-x86-gcc2-2010-04-22-a.zip - : - : true - : true - ; + + if $(HAIKU_GCC_VERSION[1]) >= 4 { + InstallOptionalHaikuImagePackage + expat-2.0.1-x86-gcc4-2010-11-12.zip + : $(baseURL)/expat-2.0.1-x86-gcc4-2010-11-12.zip + : : true ; + } else { + InstallOptionalHaikuImagePackage + expat-2.0.1-r1a2-x86-gcc2-2010-04-22-a.zip + : $(baseURL)/expat-2.0.1-r1a2-x86-gcc2-2010-04-22-a.zip + : : true ; + } + InstallSourceArchive expat-2.0.1_haiku-2010-04-29.tar.xz : $(baseSourceURL)/2010/expat-2.0.1_haiku-2010-04-29.tar.xz ; } @@ -956,13 +1005,16 @@ if [ IsOptionalHaikuImagePackageAdded LibIconv ] { if $(TARGET_ARCH) != x86 { Echo "No optional package LibIconv available for $(TARGET_ARCH)" ; } else { - InstallOptionalHaikuImagePackage - libiconv-1.13.1-r1a2-x86-gcc2-2010-04-21-a.zip - : $(baseURL)/libiconv-1.13.1-r1a2-x86-gcc2-2010-04-21-a.zip - : - : - : true - ; + if $(HAIKU_GCC_VERSION[1]) >= 4 { + InstallOptionalHaikuImagePackage + libiconv-1.13.1-x86-gcc4-2010-11-12.zip + : $(baseURL)/libiconv-1.13.1-x86-gcc4-2010-11-12.zip ; + } else { + InstallOptionalHaikuImagePackage + libiconv-1.13.1-r1a2-x86-gcc2-2010-04-21-a.zip + : $(baseURL)/libiconv-1.13.1-r1a2-x86-gcc2-2010-04-21-a.zip ; + } + InstallSourceArchive libiconv-1.13.1_haiku-2010-04-29.tar.xz : $(baseSourceURL)/2010/libiconv-1.13.1_haiku-2010-04-29.tar.xz ; } @@ -1007,13 +1059,16 @@ if [ IsOptionalHaikuImagePackageAdded LibXML2 ] { if $(TARGET_ARCH) != x86 { Echo "No optional package LibXML2 available for $(TARGET_ARCH)" ; } else { - InstallOptionalHaikuImagePackage - libxml2-2.7.7-r1a2-x86-gcc2-2010-04-22-a.zip - : $(baseURL)/libxml2-2.7.7-r1a2-x86-gcc2-2010-04-22-a.zip - : - : - : true - ; + if $(HAIKU_GCC_VERSION[1]) >= 4 { + InstallOptionalHaikuImagePackage + libxml2-2.7.7-x86-gcc4-2010-11-12.zip + : $(baseURL)/libxml2-2.7.7-x86-gcc4-2010-11-12.zip ; + } else { + InstallOptionalHaikuImagePackage + libxml2-2.7.7-r1a2-x86-gcc2-2010-04-22-a.zip + : $(baseURL)/libxml2-2.7.7-r1a2-x86-gcc2-2010-04-22-a.zip ; + } + InstallSourceArchive libxml2-2.7.7_haiku-2010-04-29.tar.xz : $(baseSourceURL)/2010/libxml2-2.7.7_haiku-2010-04-29.tar.xz ; } @@ -1103,12 +1158,17 @@ if [ IsOptionalHaikuImagePackageAdded Mercurial ] { if $(TARGET_ARCH) != x86 { Echo "No optional package Mercurial available for $(TARGET_ARCH)" ; } else { - InstallOptionalHaikuImagePackage - mercurial-1.6-x86-gcc2-2010-07-01.zip - : $(baseURL)/mercurial-1.6-x86-gcc2-2010-07-01.zip - : - : true - ; + if $(HAIKU_GCC_VERSION[1]) >= 4 { + InstallOptionalHaikuImagePackage + mercurial-1.6-x86-gcc4-2010-11-12.zip + : $(baseURL)/mercurial-1.6-x86-gcc4-2010-11-12.zip + : : true ; + } else { + InstallOptionalHaikuImagePackage + mercurial-1.6-x86-gcc2-2010-07-01.zip + : $(baseURL)/mercurial-1.6-x86-gcc2-2010-07-01.zip + : : true ; + } } } @@ -1118,11 +1178,15 @@ if [ IsOptionalHaikuImagePackageAdded Nano ] { if $(TARGET_ARCH) != x86 { Echo "No optional package Nano available for $(TARGET_ARCH)" ; } else { - InstallOptionalHaikuImagePackage - nano-2.2.5-x86-gcc2-2010-10-16.zip - : $(baseURL)/nano-2.2.5-x86-gcc2-2010-10-16.zip - : - ; + if $(HAIKU_GCC_VERSION[1]) >= 4 { + InstallOptionalHaikuImagePackage + nano-2.2.5-x86-gcc4-2010-11-13.zip + : $(baseURL)/nano-2.2.5-x86-gcc4-2010-11-13.zip ; + } else { + InstallOptionalHaikuImagePackage + nano-2.2.5-x86-gcc2-2010-10-16.zip + : $(baseURL)/nano-2.2.5-x86-gcc2-2010-10-16.zip ; + } } } @@ -1132,11 +1196,15 @@ if [ IsOptionalHaikuImagePackageAdded Neon ] { if $(TARGET_ARCH) != x86 { Echo "No optional package Neon available for $(TARGET_ARCH)" ; } else { - InstallOptionalHaikuImagePackage - neon-0.29.5-x86-gcc2-2010-10-16.zip - : $(baseURL)/neon-0.29.5-x86-gcc2-2010-10-16.zip - : - ; + if $(HAIKU_GCC_VERSION[1]) >= 4 { + InstallOptionalHaikuImagePackage + neon-0.29.5-x86-gcc4-2010-11-12.zip + : $(baseURL)/neon-0.29.5-x86-gcc4-2010-11-12.zip ; + } else { + InstallOptionalHaikuImagePackage + neon-0.29.5-x86-gcc2-2010-10-16.zip + : $(baseURL)/neon-0.29.5-x86-gcc2-2010-10-16.zip ; + } } } @@ -1232,11 +1300,16 @@ if [ IsOptionalHaikuImagePackageAdded OpenSSH ] { Exit "Optional package OpenSSH requires the HAIKU_IMAGE_HOST_NAME" "variable to be set!" ; } - InstallOptionalHaikuImagePackage - openssh-5.6p1-x86-gcc2-2010-11-03.zip - : $(baseURL)/openssh-5.6p1-x86-gcc2-2010-11-03.zip - : - ; + + if $(HAIKU_GCC_VERSION[1]) >= 4 { + InstallOptionalHaikuImagePackage + openssh-5.6p1-x86-gcc4-2010-11-12.zip + : $(baseURL)/openssh-5.6p1-x86-gcc4-2010-11-12.zip ; + } else { + InstallOptionalHaikuImagePackage + openssh-5.6p1-x86-gcc2-2010-11-03.zip + : $(baseURL)/openssh-5.6p1-x86-gcc2-2010-11-03.zip ; + } AddUserToHaikuImage sshd : 1001 : 100 : /var/empty : /bin/true : "sshd user" ; @@ -1249,12 +1322,13 @@ if [ IsOptionalHaikuImagePackageAdded OpenSSL ] { if $(TARGET_ARCH) != x86 { Echo "No optional package OpenSSL available for $(TARGET_ARCH)" ; } else { - InstallOptionalHaikuImagePackage $(HAIKU_OPENSSL_PACKAGE) - : $(HAIKU_OPENSSL_URL) - : - : - : true - ; + if $(HAIKU_GCC_VERSION[1]) >= 4 { + InstallOptionalHaikuImagePackage $(HAIKU_OPENSSL_PACKAGE) + : $(HAIKU_OPENSSL_URL) ; + } else { + InstallOptionalHaikuImagePackage $(HAIKU_OPENSSL_PACKAGE) + : $(HAIKU_OPENSSL_URL) ; + } } } @@ -1266,10 +1340,8 @@ if [ IsOptionalHaikuImagePackageAdded P7zip ] { } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - p7zip-9.04-r1a2-x86-gcc4-2010-05-06.zip - : $(baseURL)/p7zip-9.04-r1a2-x86-gcc4-2010-05-06.zip - : - ; + p7zip-9.04-x86-gcc4-2010-11-13.zip + : $(baseURL)/p7zip-9.04-x86-gcc4-2010-11-13.zip ; } else { InstallOptionalHaikuImagePackage p7zip-9.04-x86-gcc2-2010-09-01.zip @@ -1337,9 +1409,9 @@ if [ IsOptionalHaikuImagePackageAdded Pe ] { Echo "No optional package Pe available for $(TARGET_ARCH)" ; } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { - InstallOptionalHaikuImagePackage pe-2.4.3-600-x86-gcc4-2010-09-28.zip - : $(baseURL)/pe-2.4.3-600-x86-gcc4-2010-09-28.zip - ; + InstallOptionalHaikuImagePackage + pe-2.4.3-600-x86-gcc4-2010-11-14.zip + : $(baseURL)/pe-2.4.3-600-x86-gcc4-2010-11-14.zip ; } else { InstallOptionalHaikuImagePackage pe-2.4.3-600-x86-gcc2-2010-09-28.zip @@ -1360,13 +1432,18 @@ if [ IsOptionalHaikuImagePackageAdded Perl ] { if $(TARGET_ARCH) != x86 { Echo "No optional package Perl available for $(TARGET_ARCH)" ; } else { - InstallOptionalHaikuImagePackage - perl-5.10.1-r1a2-x86-gcc2-2010-04-25-a.zip - : $(baseURL)/perl-5.10.1-r1a2-x86-gcc2-2010-04-25-a.zip - : - : true - : true - ; + if $(HAIKU_GCC_VERSION[1]) >= 4 { + InstallOptionalHaikuImagePackage + perl-5.10.1-x86-gcc4-2010-11-12.zip + : $(baseURL)/perl-5.10.1-x86-gcc4-2010-11-12.zip + : : true ; + } else { + InstallOptionalHaikuImagePackage + perl-5.10.1-r1a2-x86-gcc2-2010-04-25-a.zip + : $(baseURL)/perl-5.10.1-r1a2-x86-gcc2-2010-04-25-a.zip + : : true ; + } + InstallSourceArchive perl-5.10.1_haiku-2010-04-29.tar.xz : $(baseSourceURL)/2010/perl-5.10.1_haiku-2010-04-29.tar.xz ; } @@ -1378,13 +1455,17 @@ if [ IsOptionalHaikuImagePackageAdded Python ] { if $(TARGET_ARCH) != x86 { Echo "No optional package Python available for $(TARGET_ARCH)" ; } else { - InstallOptionalHaikuImagePackage - python-2.6.6-x86-gcc2-2010-08-30.zip - : $(baseURL)/python-2.6.6-x86-gcc2-2010-08-30.zip - : - : true - : true - ; + if $(HAIKU_GCC_VERSION[1]) >= 4 { + InstallOptionalHaikuImagePackage + python-2.6.6-x86-gcc4-2010-11-12.zip + : $(baseURL)/python-2.6.6-x86-gcc4-2010-11-12.zip + : : true ; + } else { + InstallOptionalHaikuImagePackage + python-2.6.6-x86-gcc2-2010-08-30.zip + : $(baseURL)/python-2.6.6-x86-gcc2-2010-08-30.zip + : : true ; + } } } @@ -1441,12 +1522,17 @@ if [ IsOptionalHaikuImagePackageAdded SQLite ] { if $(TARGET_ARCH) != x86 { Echo "No optional package SQLite available for $(TARGET_ARCH)" ; } else { - InstallOptionalHaikuImagePackage - sqlite-3.7.3-x86-gcc2-2010-10-13.zip - : $(baseURL)/sqlite-3.7.3-x86-gcc2-2010-10-13.zip - : - : true - ; + if $(HAIKU_GCC_VERSION[1]) >= 4 { + InstallOptionalHaikuImagePackage + sqlite-3.7.3-x86-gcc4-2010-11-12.zip + : $(baseURL)/sqlite-3.7.3-x86-gcc4-2010-11-12.zip + : : true ; + } else { + InstallOptionalHaikuImagePackage + sqlite-3.7.3-x86-gcc2-2010-10-13.zip + : $(baseURL)/sqlite-3.7.3-x86-gcc2-2010-10-13.zip + : : true ; + } } } @@ -1456,12 +1542,17 @@ if [ IsOptionalHaikuImagePackageAdded Subversion ] { if $(TARGET_ARCH) != x86 { Echo "No optional package Subversion available for $(TARGET_ARCH)" ; } else { - InstallOptionalHaikuImagePackage - subversion-1.6.13-x86-gcc2-2010-10-13.zip - : $(baseURL)/subversion-1.6.13-x86-gcc2-2010-10-13.zip - : - : true - ; + if $(HAIKU_GCC_VERSION[1]) >= 4 { + InstallOptionalHaikuImagePackage + subversion-1.6.13-x86-gcc4-2010-11-12.zip + : $(baseURL)/subversion-1.6.13-x86-gcc4-2010-11-12.zip + : : true ; + } else { + InstallOptionalHaikuImagePackage + subversion-1.6.13-x86-gcc2-2010-10-13.zip + : $(baseURL)/subversion-1.6.13-x86-gcc2-2010-10-13.zip + : : true ; + } } } @@ -1489,11 +1580,16 @@ if [ IsOptionalHaikuImagePackageAdded Tar ] { if $(TARGET_ARCH) != x86 { Echo "No optional package Tar available for $(TARGET_ARCH)" ; } else { - InstallOptionalHaikuImagePackage - tar-1.22-r1a2-x86-gcc2-2010-04-22-a.zip - : $(baseURL)/tar-1.22-r1a2-x86-gcc2-2010-04-22-a.zip - : - ; + if $(HAIKU_GCC_VERSION[1]) >= 4 && ! $(isHybridBuild) { + InstallOptionalHaikuImagePackage + tar-1.22-x86-gcc4-2010-11-13.zip + : $(baseURL)/tar-1.22-x86-gcc4-2010-11-13.zip ; + } else { + InstallOptionalHaikuImagePackage + tar-1.22-r1a2-x86-gcc2-2010-04-22-a.zip + : $(baseURL)/tar-1.22-r1a2-x86-gcc2-2010-04-22-a.zip ; + } + InstallSourceArchive tar-1.22_haiku-2010-04-29.tar.xz : $(baseSourceURL)/2010/tar-1.22_haiku-2010-04-29.tar.xz ; } @@ -1621,17 +1717,13 @@ if [ IsOptionalHaikuImagePackageAdded Vision ] { if $(TARGET_ARCH) != x86 { Echo "No optional package Vision available for $(TARGET_ARCH)" ; } else if $(HAIKU_GCC_VERSION[1]) >= 4 { - InstallOptionalHaikuImagePackage vision-908-x86-gcc2-2010-10-30.zip - : $(baseURL)/vision-908-x86-gcc4-2010-11-04.zip - : - ; + InstallOptionalHaikuImagePackage vision-908-x86-gcc4-2010-11-14.zip + : $(baseURL)/vision-908-x86-gcc4-2010-11-14.zip ; AddSymlinkToHaikuImage home config be Applications : /boot/apps/Vision/Vision ; } else { InstallOptionalHaikuImagePackage vision-908-x86-gcc2-2010-10-30.zip - : $(baseURL)/vision-908-x86-gcc2-2010-10-30.zip - : - ; + : $(baseURL)/vision-908-x86-gcc2-2010-10-30.zip ; AddSymlinkToHaikuImage home config be Applications : /boot/apps/Vision/Vision ; } @@ -1665,8 +1757,8 @@ if [ IsOptionalHaikuImagePackageAdded WebPositive ] { Echo "No optional package WebPositive available for gcc2" ; } else { InstallOptionalHaikuImagePackage - WebPositive-gcc4-x86-r545-2010-08-31.zip - : $(baseURL)/WebPositive-gcc4-x86-r545-2010-08-31.zip + WebPositive-gcc4-x86-r547-2010-11-16.zip + : $(baseURL)/WebPositive-gcc4-x86-r547-2010-11-16.zip : ; AddSymlinkToHaikuImage home config be Applications @@ -1759,13 +1851,16 @@ if [ IsOptionalHaikuImagePackageAdded XZ-Utils ] { if $(TARGET_ARCH) != x86 { Echo "No optional package XZ-Utils available for $(TARGET_ARCH)" ; } else { - InstallOptionalHaikuImagePackage - xz-utils-4.999.9-r1a2-x86-gcc4-2010-04-25-a.zip - : $(baseURL)/xz-utils-4.999.9-r1a2-x86-gcc4-2010-04-25-a.zip - : - : - : true - ; + if $(HAIKU_GCC_VERSION[1]) >= 4 { + InstallOptionalHaikuImagePackage + xz-utils-4.999.9-x86-gcc4-2010-11-13.zip + : $(baseURL)/xz-utils-4.999.9-x86-gcc4-2010-11-13.zip ; + } else { + InstallOptionalHaikuImagePackage + xz-utils-4.999.9-r1a2-x86-gcc4-2010-04-25-a.zip + : $(baseURL)/xz-utils-4.999.9-r1a2-x86-gcc4-2010-04-25-a.zip ; + } + InstallSourceArchive xz-utils-4.999.9_haiku-2010-04-29.tar.xz : $(baseSourceURL)/2010/xz-utils-4.999.9_haiku-2010-04-29.tar.xz ; AddExpanderRuleToHaikuImage "application/x-xz" : .tar.xz diff --git a/configure b/configure index 2119f40e60..a93bd04b67 100755 --- a/configure +++ b/configure @@ -478,6 +478,7 @@ if [ $targetArch = "x86" ]; then 0.[0-6].*) ;; *) versionOK=1 ;; esac +versionOK=1 if [ $versionOK = 0 ]; then echo "The yasm assembler version 0.7.0 or later must be installed." diff --git a/headers/os/locale/Catalog.h b/headers/os/locale/Catalog.h index c41040476a..e58815dec3 100644 --- a/headers/os/locale/Catalog.h +++ b/headers/os/locale/Catalog.h @@ -93,24 +93,26 @@ private: // Translation macros which may be used to shorten translation requests: #undef B_TRANSLATE #define B_TRANSLATE(string) \ - be_locale_roster->GetCatalog()->GetString((string), B_TRANSLATE_CONTEXT) + BLocaleRoster::Default()->GetCatalog()->GetString((string), \ + B_TRANSLATE_CONTEXT) #undef B_TRANSLATE_WITH_CONTEXT #define B_TRANSLATE_WITH_CONTEXT(string, context) \ - be_locale_roster->GetCatalog()->GetString((string), (context)) + BLocaleRoster::Default()->GetCatalog()->GetString((string), (context)) #undef B_TRANSLATE_COMMENT #define B_TRANSLATE_COMMENT(string, comment) \ - be_locale_roster->GetCatalog()->GetString((string), B_TRANSLATE_CONTEXT, \ - (comment)) + BLocaleRoster::Default()->GetCatalog()->GetString((string), \ + B_TRANSLATE_CONTEXT, (comment)) #undef B_TRANSLATE_ALL #define B_TRANSLATE_ALL(string, context, comment) \ - be_locale_roster->GetCatalog()->GetString((string), (context), (comment)) + BLocaleRoster::Default()->GetCatalog()->GetString((string), (context), \ + (comment)) #undef B_TRANSLATE_ID #define B_TRANSLATE_ID(id) \ - be_locale_roster->GetCatalog()->GetString((id)) + BLocaleRoster::Default()->GetCatalog()->GetString((id)) // Translation markers which can be used to mark static strings/IDs which // are used as key for translation requests (at other places in the code): diff --git a/headers/os/locale/Locale.h b/headers/os/locale/Locale.h index 22d8307828..77b7c58a9d 100644 --- a/headers/os/locale/Locale.h +++ b/headers/os/locale/Locale.h @@ -49,6 +49,8 @@ public: BLocale(const BLocale& other); ~BLocale(); + static const BLocale* Default(); + BLocale& operator=(const BLocale& other); status_t GetCollator(BCollator* collator) const; @@ -155,10 +157,6 @@ private: }; -// global locale object -extern const BLocale* be_locale; - - //--- collator short-hands inlines --- // #pragma mark - diff --git a/headers/os/locale/LocaleRoster.h b/headers/os/locale/LocaleRoster.h index 25edc1d69b..298fcf3018 100644 --- a/headers/os/locale/LocaleRoster.h +++ b/headers/os/locale/LocaleRoster.h @@ -30,6 +30,8 @@ public: BLocaleRoster(); ~BLocaleRoster(); + static BLocaleRoster* Default(); + status_t GetDefaultTimeZone(BTimeZone* timezone) const; status_t GetLanguage(const char* languageCode, @@ -76,7 +78,4 @@ private: }; -extern BLocaleRoster* be_locale_roster; - - #endif // _LOCALE_ROSTER_H_ diff --git a/headers/posix/resolv.h b/headers/posix/resolv.h index e4885312b1..7ed5767697 100644 --- a/headers/posix/resolv.h +++ b/headers/posix/resolv.h @@ -406,7 +406,7 @@ const char * loc_ntoa(const u_char *, char *); int dn_skipname(const u_char *, const u_char *); void putlong(u_int32_t, u_char *); void putshort(u_int16_t, u_char *); -#ifndef __ultrix__ +#if !defined(__ultrix__) && !defined(__HAIKU__) u_int16_t _getshort(const u_char *); u_int32_t _getlong(const u_char *); #endif diff --git a/headers/private/libroot/locale/ICUCategoryData.h b/headers/private/libroot/locale/ICUCategoryData.h index 1c325a8d06..78515117a6 100644 --- a/headers/private/libroot/locale/ICUCategoryData.h +++ b/headers/private/libroot/locale/ICUCategoryData.h @@ -14,6 +14,7 @@ namespace BPrivate { +namespace Libroot { class ICUCategoryData { @@ -47,6 +48,7 @@ private: }; +} // namespace Libroot } // namespace BPrivate diff --git a/headers/private/libroot/locale/ICUCollateData.h b/headers/private/libroot/locale/ICUCollateData.h index 284b840874..c22daf6297 100644 --- a/headers/private/libroot/locale/ICUCollateData.h +++ b/headers/private/libroot/locale/ICUCollateData.h @@ -12,6 +12,7 @@ namespace BPrivate { +namespace Libroot { class ICUCollateData : public ICUCategoryData { @@ -37,6 +38,7 @@ private: }; +} // namespace Libroot } // namespace BPrivate diff --git a/headers/private/libroot/locale/ICUCtypeData.h b/headers/private/libroot/locale/ICUCtypeData.h index 6d6d09dc5e..e6a74bfefa 100644 --- a/headers/private/libroot/locale/ICUCtypeData.h +++ b/headers/private/libroot/locale/ICUCtypeData.h @@ -11,6 +11,7 @@ namespace BPrivate { +namespace Libroot { class ICUCtypeData : public ICUCategoryData { @@ -49,6 +50,7 @@ private: }; +} // namespace Libroot } // namespace BPrivate diff --git a/headers/private/libroot/locale/ICULocaleBackend.h b/headers/private/libroot/locale/ICULocaleBackend.h index e5d0a14300..a4292ec902 100644 --- a/headers/private/libroot/locale/ICULocaleBackend.h +++ b/headers/private/libroot/locale/ICULocaleBackend.h @@ -21,6 +21,7 @@ namespace BPrivate { +namespace Libroot { class ICULocaleBackend : public LocaleBackend { @@ -77,6 +78,7 @@ private: }; +} // namespace Libroot } // namespace BPrivate diff --git a/headers/private/libroot/locale/ICULocaleconvData.h b/headers/private/libroot/locale/ICULocaleconvData.h index 35606d3bd8..7e86e2143e 100644 --- a/headers/private/libroot/locale/ICULocaleconvData.h +++ b/headers/private/libroot/locale/ICULocaleconvData.h @@ -12,6 +12,7 @@ namespace BPrivate { +namespace Libroot { typedef DecimalFormatSymbols::ENumberFormatSymbol FormatSymbol; @@ -27,6 +28,7 @@ protected: }; +} // namespace Libroot } // namespace BPrivate diff --git a/headers/private/libroot/locale/ICUMessagesData.h b/headers/private/libroot/locale/ICUMessagesData.h index fe8c5e52a7..fe94ded256 100644 --- a/headers/private/libroot/locale/ICUMessagesData.h +++ b/headers/private/libroot/locale/ICUMessagesData.h @@ -11,6 +11,7 @@ namespace BPrivate { +namespace Libroot { class ICUMessagesData : public ICUCategoryData { @@ -33,6 +34,7 @@ private: }; +} // namespace Libroot } // namespace BPrivate diff --git a/headers/private/libroot/locale/ICUMonetaryData.h b/headers/private/libroot/locale/ICUMonetaryData.h index ded34d54e5..5d3571ed5a 100644 --- a/headers/private/libroot/locale/ICUMonetaryData.h +++ b/headers/private/libroot/locale/ICUMonetaryData.h @@ -13,6 +13,7 @@ namespace BPrivate { +namespace Libroot { class ICUMonetaryData : public ICULocaleconvData { @@ -63,6 +64,7 @@ private: }; +} // namespace Libroot } // namespace BPrivate diff --git a/headers/private/libroot/locale/ICUNumericData.h b/headers/private/libroot/locale/ICUNumericData.h index 723f393f80..c95ad4d5ed 100644 --- a/headers/private/libroot/locale/ICUNumericData.h +++ b/headers/private/libroot/locale/ICUNumericData.h @@ -11,6 +11,7 @@ namespace BPrivate { +namespace Libroot { class ICUNumericData : public ICULocaleconvData { @@ -37,6 +38,7 @@ private: }; +} // namespace Libroot } // namespace BPrivate diff --git a/headers/private/libroot/locale/ICUTimeConversion.h b/headers/private/libroot/locale/ICUTimeConversion.h index 6ceb45f3b1..58b2b098e7 100644 --- a/headers/private/libroot/locale/ICUTimeConversion.h +++ b/headers/private/libroot/locale/ICUTimeConversion.h @@ -15,6 +15,7 @@ namespace BPrivate { +namespace Libroot { class ICUTimeConversion { @@ -45,6 +46,7 @@ private: }; +} // namespace Libroot } // namespace BPrivate diff --git a/headers/private/libroot/locale/ICUTimeData.h b/headers/private/libroot/locale/ICUTimeData.h index c858f25112..d3a8384df7 100644 --- a/headers/private/libroot/locale/ICUTimeData.h +++ b/headers/private/libroot/locale/ICUTimeData.h @@ -15,6 +15,7 @@ namespace BPrivate { +namespace Libroot { class ICUTimeData : public ICUCategoryData { @@ -60,6 +61,7 @@ private: }; +} // namespace Libroot } // namespace BPrivate diff --git a/headers/private/libroot/locale/LocaleBackend.h b/headers/private/libroot/locale/LocaleBackend.h index 635b2f4ff1..3e754e6442 100644 --- a/headers/private/libroot/locale/LocaleBackend.h +++ b/headers/private/libroot/locale/LocaleBackend.h @@ -18,6 +18,7 @@ struct locale_data; // glibc namespace BPrivate { +namespace Libroot { struct LocaleCtypeDataBridge { @@ -144,6 +145,7 @@ public: extern LocaleBackend* gLocaleBackend; +} // namespace Libroot } // namespace BPrivate diff --git a/headers/private/libroot/locale/PosixCtype.h b/headers/private/libroot/locale/PosixCtype.h index d374866d93..f89425777f 100644 --- a/headers/private/libroot/locale/PosixCtype.h +++ b/headers/private/libroot/locale/PosixCtype.h @@ -7,6 +7,7 @@ namespace BPrivate { +namespace Libroot { /* @@ -22,6 +23,7 @@ extern const int gPosixToLowerMap[384]; extern const int gPosixToUpperMap[384]; +} // namespace Libroot } // namespace BPrivate diff --git a/headers/private/libroot/locale/PosixLanginfo.h b/headers/private/libroot/locale/PosixLanginfo.h index 42bf2d8181..4f8e27d9c1 100644 --- a/headers/private/libroot/locale/PosixLanginfo.h +++ b/headers/private/libroot/locale/PosixLanginfo.h @@ -7,11 +7,13 @@ namespace BPrivate { +namespace Libroot { extern const char* gPosixLanginfo[]; +} // namespace Libroot } // namespace BPrivate diff --git a/headers/private/libroot/locale/PosixLocaleConv.h b/headers/private/libroot/locale/PosixLocaleConv.h index 5c27ce5662..0d36637d80 100644 --- a/headers/private/libroot/locale/PosixLocaleConv.h +++ b/headers/private/libroot/locale/PosixLocaleConv.h @@ -10,11 +10,13 @@ namespace BPrivate { +namespace Libroot { extern struct lconv gPosixLocaleConv; +} // namespace Libroot } // namespace BPrivate diff --git a/headers/private/libroot/time/PosixLCTimeInfo.h b/headers/private/libroot/time/PosixLCTimeInfo.h index 8819bb3356..5af9eab9cf 100644 --- a/headers/private/libroot/time/PosixLCTimeInfo.h +++ b/headers/private/libroot/time/PosixLCTimeInfo.h @@ -10,11 +10,13 @@ namespace BPrivate { +namespace Libroot { extern const struct lc_time_t gPosixLCTimeInfo; +} // namespace Libroot } // namespace BPrivate diff --git a/headers/private/locale/MutableLocaleRoster.h b/headers/private/locale/MutableLocaleRoster.h index 1c1606c2ef..afdb659be0 100644 --- a/headers/private/locale/MutableLocaleRoster.h +++ b/headers/private/locale/MutableLocaleRoster.h @@ -34,6 +34,8 @@ public: MutableLocaleRoster(); ~MutableLocaleRoster(); + static MutableLocaleRoster* Default(); + status_t SetDefaultFormattingConventions( const BFormattingConventions& conventions); status_t SetDefaultTimeZone(const BTimeZone& zone); @@ -57,9 +59,6 @@ public: }; -extern MutableLocaleRoster* gMutableLocaleRoster; - - typedef BCatalogAddOn* (*InstantiateCatalogFunc)(const char* name, const char* language, uint32 fingerprint); @@ -116,8 +115,12 @@ struct RosterData { BResources fResources; RosterData(); + RosterData(const BLanguage& language, + const BFormattingConventions& conventions); ~RosterData(); + static RosterData* Default(); + void InitializeCatalogAddOns(); void CleanupCatalogAddOns(); status_t Refresh(); @@ -150,9 +153,6 @@ private: }; -extern RosterData gRosterData; - - } // namespace BPrivate diff --git a/headers/private/system/elf32.h b/headers/private/system/elf32.h index 71c5798ac0..9a4aec0e29 100644 --- a/headers/private/system/elf32.h +++ b/headers/private/system/elf32.h @@ -228,30 +228,40 @@ struct Elf32_Dyn { } d_un; }; -#define DT_NULL 0 -#define DT_NEEDED 1 -#define DT_PLTRELSZ 2 -#define DT_PLTGOT 3 -#define DT_HASH 4 -#define DT_STRTAB 5 -#define DT_SYMTAB 6 -#define DT_RELA 7 -#define DT_RELASZ 8 -#define DT_RELAENT 9 -#define DT_STRSZ 10 -#define DT_SYMENT 11 -#define DT_INIT 12 -#define DT_FINI 13 -#define DT_SONAME 14 -#define DT_RPATH 15 -#define DT_SYMBOLIC 16 -#define DT_REL 17 -#define DT_RELSZ 18 -#define DT_RELENT 19 -#define DT_PLTREL 20 -#define DT_DEBUG 21 -#define DT_TEXTREL 22 -#define DT_JMPREL 23 +#define DT_NULL 0 +#define DT_NEEDED 1 +#define DT_PLTRELSZ 2 +#define DT_PLTGOT 3 +#define DT_HASH 4 +#define DT_STRTAB 5 +#define DT_SYMTAB 6 +#define DT_RELA 7 +#define DT_RELASZ 8 +#define DT_RELAENT 9 +#define DT_STRSZ 10 +#define DT_SYMENT 11 +#define DT_INIT 12 +#define DT_FINI 13 +#define DT_SONAME 14 +#define DT_RPATH 15 +#define DT_SYMBOLIC 16 +#define DT_REL 17 +#define DT_RELSZ 18 +#define DT_RELENT 19 +#define DT_PLTREL 20 +#define DT_DEBUG 21 +#define DT_TEXTREL 22 +#define DT_JMPREL 23 +#define DT_BIND_NOW 24 /* no lazy binding */ +#define DT_INIT_ARRAY 25 /* init function array */ +#define DT_FINI_ARRAY 26 /* termination function array */ +#define DT_INIT_ARRAYSZ 27 /* init function array size */ +#define DT_FINI_ARRAYSZ 28 /* termination function array size */ +#define DT_RUNPATH 29 /* library search path (supersedes DT_RPATH) */ +#define DT_FLAGS 30 /* flags (see below) */ +#define DT_ENCODING 32 +#define DT_PREINIT_ARRAY 32 /* preinitialization array */ +#define DT_PREINIT_ARRAYSZ 33 /* preinitialization array size */ #define DT_VERSYM 0x6ffffff0 /* symbol version table */ #define DT_VERDEF 0x6ffffffc /* version definition table */ @@ -263,6 +273,14 @@ struct Elf32_Dyn { #define DT_HIPROC 0x7fffffff +/* DT_FLAGS values */ +#define DF_ORIGIN 0x01 +#define DF_SYMBOLIC 0x02 +#define DF_TEXTREL 0x04 +#define DF_BIND_NOW 0x08 +#define DF_STATIC_TLS 0x10 + + /* version definition section */ struct Elf32_Verdef { diff --git a/src/apps/aboutsystem/AboutSystem.cpp b/src/apps/aboutsystem/AboutSystem.cpp index 2b5d35daac..3f380ca44a 100644 --- a/src/apps/aboutsystem/AboutSystem.cpp +++ b/src/apps/aboutsystem/AboutSystem.cpp @@ -180,23 +180,23 @@ TranslationComparator(const void* left, const void* right) BLanguage* language; BString leftName; - if (be_locale_roster->GetLanguage(leftTranslation->languageCode, &language) - == B_OK) { + if (BLocaleRoster::Default()->GetLanguage(leftTranslation->languageCode, + &language) == B_OK) { language->GetName(leftName); delete language; } else leftName = leftTranslation->languageCode; BString rightName; - if (be_locale_roster->GetLanguage(rightTranslation->languageCode, &language) - == B_OK) { + if (BLocaleRoster::Default()->GetLanguage(rightTranslation->languageCode, + &language) == B_OK) { language->GetName(rightName); delete language; } else rightName = rightTranslation->languageCode; BCollator collator; - be_locale->GetCollator(&collator); + BLocale::Default()->GetCollator(&collator); return collator.Compare(leftName.String(), rightName.String()); } @@ -1105,8 +1105,8 @@ AboutView::_CreateCreditsView() = *(const Translation*)sortedTranslations.ItemAt(i); langName.Truncate(0); - if (be_locale_roster->GetLanguage(translation.languageCode, &lang) - == B_OK) { + if (BLocaleRoster::Default()->GetLanguage(translation.languageCode, + &lang) == B_OK) { lang->GetName(langName); delete lang; } else { diff --git a/src/apps/deskbar/BarApp.cpp b/src/apps/deskbar/BarApp.cpp index e36716678c..532e1bc998 100644 --- a/src/apps/deskbar/BarApp.cpp +++ b/src/apps/deskbar/BarApp.cpp @@ -515,7 +515,7 @@ TBarApp::MessageReceived(BMessage* message) case B_LOCALE_CHANGED: { - be_locale_roster->Refresh(); + BLocaleRoster::Default()->Refresh(); BMessenger(fBarWindow->FindView("_deskbar_tv_")).SendMessage( message); diff --git a/src/apps/deskbar/CalendarMenuWindow.cpp b/src/apps/deskbar/CalendarMenuWindow.cpp index 5d89a546a8..7cdbb6154b 100644 --- a/src/apps/deskbar/CalendarMenuWindow.cpp +++ b/src/apps/deskbar/CalendarMenuWindow.cpp @@ -89,7 +89,7 @@ CalendarMenuWindow::CalendarMenuWindow(BPoint where) fSuppressFirstClose(true) { BPrivate::week_start startOfWeek - = (BPrivate::week_start)be_locale->StartOfWeek(); + = (BPrivate::week_start)BLocale::Default()->StartOfWeek(); RemoveShortcut('H', B_COMMAND_KEY | B_CONTROL_KEY); AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED)); diff --git a/src/apps/deskbar/TimeView.cpp b/src/apps/deskbar/TimeView.cpp index cebb65738f..16c4982c08 100644 --- a/src/apps/deskbar/TimeView.cpp +++ b/src/apps/deskbar/TimeView.cpp @@ -84,7 +84,7 @@ TTimeView::TTimeView(float maxWidth, float height, bool showSeconds, fLastDateStr[0] = 0; fNeedToUpdate = true; - fLocale = *be_locale; + fLocale = *BLocale::Default(); } @@ -96,7 +96,7 @@ TTimeView::TTimeView(BMessage* data) data->FindBool("seconds", &fShowSeconds); data->FindBool("interval", &fInterval); - fLocale = *be_locale; + fLocale = *BLocale::Default(); } #endif @@ -357,7 +357,7 @@ TTimeView::ShowSeconds(bool on) void TTimeView::Update() { - fLocale = *be_locale; + fLocale = *BLocale::Default(); GetCurrentTime(); GetCurrentDate(); diff --git a/src/apps/icon-o-matic/CanvasView.h b/src/apps/icon-o-matic/CanvasView.h index 5dd6bf5db5..60b9be51bc 100644 --- a/src/apps/icon-o-matic/CanvasView.h +++ b/src/apps/icon-o-matic/CanvasView.h @@ -16,12 +16,12 @@ class BBitmap; -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class IconRenderer; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + enum { SNAPPING_OFF = 0, diff --git a/src/apps/icon-o-matic/Jamfile b/src/apps/icon-o-matic/Jamfile index 6204c93254..32873d9c81 100644 --- a/src/apps/icon-o-matic/Jamfile +++ b/src/apps/icon-o-matic/Jamfile @@ -4,10 +4,7 @@ SetSubDirSupportedPlatformsBeOSCompatible ; AddSubDirSupportedPlatforms libbe_test ; # defines (get all the extra stuff in from libicon.a classes) -local defines = [ FDefines ICON_O_MATIC=1 ] ; - -SubDirCcFlags $(defines) ; -SubDirC++Flags $(defines) ; +DEFINES = ICON_O_MATIC=1 ; # libicon.a source directories local iconSourceDirs = diff --git a/src/apps/icon-o-matic/MainWindow.h b/src/apps/icon-o-matic/MainWindow.h index d2cec5cbc8..778a474867 100644 --- a/src/apps/icon-o-matic/MainWindow.h +++ b/src/apps/icon-o-matic/MainWindow.h @@ -12,8 +12,10 @@ #include #include +#include "IconBuild.h" #include "Observer.h" + class BMenu; class BMenuBar; class BMenuItem; @@ -29,12 +31,12 @@ class StyleView; class SwatchGroup; class TransformerListView; -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Icon; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class MultipleManipulatorState; diff --git a/src/apps/icon-o-matic/Util.h b/src/apps/icon-o-matic/Util.h index b22eae3ddf..167139fa75 100644 --- a/src/apps/icon-o-matic/Util.h +++ b/src/apps/icon-o-matic/Util.h @@ -11,19 +11,20 @@ #include +#include "IconBuild.h" + class AddPathsCommand; class AddStylesCommand; -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class PathContainer; class Style; class StyleContainer; class VectorPath; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE void new_style(rgb_color color, StyleContainer* container, diff --git a/src/apps/icon-o-matic/document/Document.cpp b/src/apps/icon-o-matic/document/Document.cpp index ade4d275cc..e44ef85d48 100644 --- a/src/apps/icon-o-matic/document/Document.cpp +++ b/src/apps/icon-o-matic/document/Document.cpp @@ -24,13 +24,13 @@ using std::nothrow; -using namespace BPrivate::Icon; +_USING_ICON_NAMESPACE // constructor Document::Document(const char* name) : RWLocker("document rw lock"), - fIcon(new (nothrow) BPrivate::Icon::Icon()), + fIcon(new (nothrow) _ICON_NAMESPACE Icon()), fCommandStack(new (nothrow) ::CommandStack()), fSelection(new (nothrow) ::Selection()), @@ -87,7 +87,7 @@ Document::SetExportSaver(::DocumentSaver* saver) // SetIcon void -Document::SetIcon(BPrivate::Icon::Icon* icon) +Document::SetIcon(_ICON_NAMESPACE Icon* icon) { if (fIcon == icon) return; @@ -121,6 +121,6 @@ Document::IsEmpty() const { return fIcon->Styles()->CountStyles() == 0 && fIcon->Paths()->CountPaths() == 0 - && fIcon->Shapes()->CountShapes() == 0; + && fIcon->Shapes()->CountShapes() == 0; } diff --git a/src/apps/icon-o-matic/document/Document.h b/src/apps/icon-o-matic/document/Document.h index 7863b0c92d..6051350be5 100644 --- a/src/apps/icon-o-matic/document/Document.h +++ b/src/apps/icon-o-matic/document/Document.h @@ -9,20 +9,18 @@ #define DOCUMENT_H +#include "IconBuild.h" #include "Observable.h" #include "RWLocker.h" #include + struct entry_ref; -namespace BPrivate { -namespace Icon { - -class Icon; - -} // namespace Icon -} // namespace BPrivate +_BEGIN_ICON_NAMESPACE + class Icon; +_END_ICON_NAMESPACE class CommandStack; class DocumentSaver; @@ -51,8 +49,8 @@ class Document : public RWLocker, inline ::DocumentSaver* ExportSaver() const { return fExportSaver; } - void SetIcon(BPrivate::Icon::Icon* icon); - inline BPrivate::Icon::Icon* Icon() const + void SetIcon(_ICON_NAMESPACE Icon* icon); + inline _ICON_NAMESPACE Icon* Icon() const { return fIcon; } void MakeEmpty(bool includingSavers = true); @@ -60,7 +58,7 @@ class Document : public RWLocker, bool IsEmpty() const; private: - BPrivate::Icon::Icon* fIcon; + _ICON_NAMESPACE Icon* fIcon; ::CommandStack* fCommandStack; ::Selection* fSelection; diff --git a/src/apps/icon-o-matic/gui/GradientControl.h b/src/apps/icon-o-matic/gui/GradientControl.h index 96b9bf0ac6..77048112df 100644 --- a/src/apps/icon-o-matic/gui/GradientControl.h +++ b/src/apps/icon-o-matic/gui/GradientControl.h @@ -11,24 +11,23 @@ #include - #if LIB_LAYOUT # include #endif -namespace BPrivate { -namespace Icon { +#include "IconBuild.h" -class Gradient; -} // namespace Icon -} // namespace BPrivate +_BEGIN_ICON_NAMESPACE + class Gradient; +_END_ICON_NAMESPACE + enum { MSG_GRADIENT_CONTROL_FOCUS_CHANGED = 'gcfc', }; -class GradientControl : +class GradientControl : #if LIB_LAYOUT public MView, #endif @@ -61,9 +60,9 @@ class GradientControl : virtual void FrameResized(float width, float height); // GradientControl - void SetGradient(const BPrivate::Icon::Gradient* + void SetGradient(const _ICON_NAMESPACE Gradient* gradient); - BPrivate::Icon::Gradient* Gradient() const + _ICON_NAMESPACE Gradient* Gradient() const { return fGradient; } void SetCurrentStop(const rgb_color& color); @@ -81,7 +80,7 @@ class GradientControl : float _OffsetFor(BPoint where) const; void _UpdateCurrentColor() const; - BPrivate::Icon::Gradient* fGradient; + _ICON_NAMESPACE Gradient* fGradient; BBitmap* fGradientBitmap; int32 fDraggingStepIndex; int32 fCurrentStepIndex; diff --git a/src/apps/icon-o-matic/gui/IconView.h b/src/apps/icon-o-matic/gui/IconView.h index 1007ec3380..2ea19c2f3a 100644 --- a/src/apps/icon-o-matic/gui/IconView.h +++ b/src/apps/icon-o-matic/gui/IconView.h @@ -16,12 +16,11 @@ class BBitmap; -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class IconRenderer; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE class IconView : public BView, public IconListener { diff --git a/src/apps/icon-o-matic/gui/PathListView.h b/src/apps/icon-o-matic/gui/PathListView.h index db3c3f68e6..3ea02304e1 100644 --- a/src/apps/icon-o-matic/gui/PathListView.h +++ b/src/apps/icon-o-matic/gui/PathListView.h @@ -12,23 +12,24 @@ #include "ListViews.h" #include "PathContainer.h" + class BMenu; class BMenuItem; -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class VectorPath; class Shape; class ShapeContainer; -} -} +_END_ICON_NAMESPACE class CommandStack; class PathListItem; class Selection; class ShapePathListener; -using namespace BPrivate::Icon; + +_USING_ICON_NAMESPACE + class PathListView : public SimpleListView, public PathContainerListener { diff --git a/src/apps/icon-o-matic/gui/ShapeListView.h b/src/apps/icon-o-matic/gui/ShapeListView.h index f297407c08..b8464aed0a 100644 --- a/src/apps/icon-o-matic/gui/ShapeListView.h +++ b/src/apps/icon-o-matic/gui/ShapeListView.h @@ -19,12 +19,12 @@ class CommandStack; class ShapeListItem; class Selection; -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Shape; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + enum { MSG_ADD_SHAPE = 'adsh', diff --git a/src/apps/icon-o-matic/gui/StyleListView.h b/src/apps/icon-o-matic/gui/StyleListView.h index 49e5e99416..642257963e 100644 --- a/src/apps/icon-o-matic/gui/StyleListView.h +++ b/src/apps/icon-o-matic/gui/StyleListView.h @@ -20,15 +20,15 @@ class Selection; class ShapeStyleListener; class StyleListItem; -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Shape; class ShapeContainer; class ShapeListener; class Style; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class StyleListView : public SimpleListView, public StyleContainerListener { diff --git a/src/apps/icon-o-matic/gui/StyleView.h b/src/apps/icon-o-matic/gui/StyleView.h index d22813f08a..8fb0dea7e1 100644 --- a/src/apps/icon-o-matic/gui/StyleView.h +++ b/src/apps/icon-o-matic/gui/StyleView.h @@ -9,6 +9,7 @@ #define STYLE_VIEW_H +#include "IconBuild.h" #include "Observer.h" #include @@ -20,13 +21,13 @@ class CommandStack; class CurrentColor; class GradientControl; -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Gradient; class Style; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + // TODO: write lock the document when changing something... diff --git a/src/apps/icon-o-matic/gui/TransformerListView.h b/src/apps/icon-o-matic/gui/TransformerListView.h index ee6410c813..b08171718d 100644 --- a/src/apps/icon-o-matic/gui/TransformerListView.h +++ b/src/apps/icon-o-matic/gui/TransformerListView.h @@ -18,11 +18,10 @@ class CommandStack; class TransformerItem; class Selection; -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Transformer; -} -} +_END_ICON_NAMESPACE + class TransformerListView : public SimpleListView, public ShapeListener { diff --git a/src/apps/icon-o-matic/import_export/Exporter.h b/src/apps/icon-o-matic/import_export/Exporter.h index f323cccbd3..ce7d2112cd 100644 --- a/src/apps/icon-o-matic/import_export/Exporter.h +++ b/src/apps/icon-o-matic/import_export/Exporter.h @@ -12,18 +12,19 @@ #include #include +#include "IconBuild.h" + + class BPositionIO; class Document; -namespace BPrivate { -namespace Icon { -class Icon; +_BEGIN_ICON_NAMESPACE + class Icon; +_END_ICON_NAMESPACE -} // namespace Icon -} // namespace BPrivate +_USING_ICON_NAMESPACE -using namespace BPrivate::Icon; class Exporter { public: diff --git a/src/apps/icon-o-matic/import_export/Importer.h b/src/apps/icon-o-matic/import_export/Importer.h index 6405f864b7..0791506e90 100644 --- a/src/apps/icon-o-matic/import_export/Importer.h +++ b/src/apps/icon-o-matic/import_export/Importer.h @@ -11,16 +11,15 @@ #include +#include "IconBuild.h" -namespace BPrivate { -namespace Icon { -class Icon; +_BEGIN_ICON_NAMESPACE + class Icon; +_END_ICON_NAMESPACE -} // namespace Icon -} // namespace BPrivate +_USING_ICON_NAMESPACE -using namespace BPrivate::Icon; class Importer { public: diff --git a/src/apps/icon-o-matic/import_export/flat_icon/FlatIconExporter.h b/src/apps/icon-o-matic/import_export/flat_icon/FlatIconExporter.h index 56bfb20eeb..455c7aabff 100644 --- a/src/apps/icon-o-matic/import_export/flat_icon/FlatIconExporter.h +++ b/src/apps/icon-o-matic/import_export/flat_icon/FlatIconExporter.h @@ -16,18 +16,15 @@ class BMessage; class BNode; class BPositionIO; -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE + class Gradient; + class LittleEndianBuffer; + class PathContainer; + class ShapeContainer; + class StyleContainer; + class VectorPath; +_END_ICON_NAMESPACE -class Gradient; -class LittleEndianBuffer; -class PathContainer; -class ShapeContainer; -class StyleContainer; -class VectorPath; - -} // namespace Icon -} // namespace BPrivate #define PRINT_STATISTICS 1 @@ -86,7 +83,7 @@ class FlatIconExporter : public Exporter { int32& straightCount, int32& lineCount, int32& curveCount); - + #if PRINT_STATISTICS int32 fStyleSectionSize; int32 fGradientSize; diff --git a/src/apps/icon-o-matic/import_export/message/MessageExporter.h b/src/apps/icon-o-matic/import_export/message/MessageExporter.h index ffec1b4314..fd6f2cfcc3 100644 --- a/src/apps/icon-o-matic/import_export/message/MessageExporter.h +++ b/src/apps/icon-o-matic/import_export/message/MessageExporter.h @@ -14,8 +14,7 @@ class BMessage; class BPositionIO; -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Icon; class PathContainer; class Shape; @@ -23,8 +22,8 @@ namespace Icon { class StyleContainer; class Transformer; class VectorPath; -} -} +_END_ICON_NAMESPACE + class MessageExporter : public Exporter { public: diff --git a/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.h b/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.h index 471638d380..5a3ff9d7a2 100644 --- a/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.h +++ b/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.h @@ -17,16 +17,14 @@ class BShape; struct text_run; struct text_run_array; -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Icon; class Style; class VectorPath; class PathContainer; class ShapeContainer; class StyleContainer; -} -} +_END_ICON_NAMESPACE struct style_map { text_run *run; @@ -44,7 +42,7 @@ class StyledTextImporter : public Importer { const entry_ref* ref); private: - status_t _Import(Icon* icon, const char *text, + status_t _Import(Icon* icon, const char *text, text_run_array *runs); status_t _AddStyle(Icon *icon, text_run *run); diff --git a/src/apps/icon-o-matic/import_export/svg/DocumentBuilder.h b/src/apps/icon-o-matic/import_export/svg/DocumentBuilder.h index 28b33bd324..6874f611e1 100644 --- a/src/apps/icon-o-matic/import_export/svg/DocumentBuilder.h +++ b/src/apps/icon-o-matic/import_export/svg/DocumentBuilder.h @@ -10,8 +10,8 @@ // Anti-Grain Geometry - Version 2.2 // Copyright (C) 2002-2004 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -39,17 +39,18 @@ #include #include +#include "IconBuild.h" #include "PathTokenizer.h" + class SVGImporter; -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Icon; class Transformable; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE namespace agg { namespace svg { @@ -159,7 +160,7 @@ class DocumentBuilder { double x, double y, bool rel = false); void curve3(double x, double y, bool rel = false); // T, t void curve4(double x1, double y1, // C, c - double x2, double y2, + double x2, double y2, double x, double y, bool rel = false); void curve4(double x2, double y2, // S, s double x, double y, bool rel = false); @@ -181,12 +182,12 @@ class DocumentBuilder { void SetTitle(const char* title); void SetDimensions(uint32 width, uint32 height, BRect viewBox); - + // Call these functions on tag (start_element, end_element respectively) void push_attr(); void pop_attr(); - + // Attribute setting functions. void fill(const rgba8& f); void stroke(const rgba8& s); @@ -203,7 +204,7 @@ class DocumentBuilder { void line_cap(line_cap_e cap); void miter_limit(double ml); trans_affine& transform(); - + /* // Make all polygons CCW-oriented void arrange_orientations() { diff --git a/src/apps/icon-o-matic/import_export/svg/SVGExporter.h b/src/apps/icon-o-matic/import_export/svg/SVGExporter.h index 8ca818acf1..febd59cef2 100644 --- a/src/apps/icon-o-matic/import_export/svg/SVGExporter.h +++ b/src/apps/icon-o-matic/import_export/svg/SVGExporter.h @@ -14,15 +14,15 @@ #include -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Gradient; class Shape; class Style; class Transformable; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class SVGExporter : public Exporter { public: diff --git a/src/apps/icon-o-matic/import_export/svg/SVGGradients.h b/src/apps/icon-o-matic/import_export/svg/SVGGradients.h index 16e55ce886..c510ecbec1 100644 --- a/src/apps/icon-o-matic/import_export/svg/SVGGradients.h +++ b/src/apps/icon-o-matic/import_export/svg/SVGGradients.h @@ -15,11 +15,12 @@ #include #include -namespace BPrivate { -namespace Icon { +#include "IconBuild.h" + + +_BEGIN_ICON_NAMESPACE class Gradient; -} -} +_END_ICON_NAMESPACE namespace agg { namespace svg { diff --git a/src/apps/icon-o-matic/shape/commands/AddPathsCommand.h b/src/apps/icon-o-matic/shape/commands/AddPathsCommand.h index 655086e94d..01560ae5ba 100644 --- a/src/apps/icon-o-matic/shape/commands/AddPathsCommand.h +++ b/src/apps/icon-o-matic/shape/commands/AddPathsCommand.h @@ -10,15 +10,16 @@ #include "Command.h" +#include "IconBuild.h" -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class VectorPath; class PathContainer; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class AddPathsCommand : public Command { public: @@ -29,7 +30,7 @@ class AddPathsCommand : public Command { bool ownsPaths, int32 index); virtual ~AddPathsCommand(); - + virtual status_t InitCheck(); virtual status_t Perform(); diff --git a/src/apps/icon-o-matic/shape/commands/AddShapesCommand.h b/src/apps/icon-o-matic/shape/commands/AddShapesCommand.h index 0d78c4de24..7d4032679b 100644 --- a/src/apps/icon-o-matic/shape/commands/AddShapesCommand.h +++ b/src/apps/icon-o-matic/shape/commands/AddShapesCommand.h @@ -10,17 +10,18 @@ #include "Command.h" +#include "IconBuild.h" class Selection; -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Shape; class ShapeContainer; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class AddShapesCommand : public Command { public: @@ -31,7 +32,7 @@ class AddShapesCommand : public Command { int32 index, Selection* selection); virtual ~AddShapesCommand(); - + virtual status_t InitCheck(); virtual status_t Perform(); diff --git a/src/apps/icon-o-matic/shape/commands/AddTransformersCommand.h b/src/apps/icon-o-matic/shape/commands/AddTransformersCommand.h index 5f6b392282..9f25b577f4 100644 --- a/src/apps/icon-o-matic/shape/commands/AddTransformersCommand.h +++ b/src/apps/icon-o-matic/shape/commands/AddTransformersCommand.h @@ -10,15 +10,16 @@ #include "Command.h" +#include "IconBuild.h" -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Shape; class Transformer; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + // TODO: make a templated "add items" command? @@ -30,7 +31,7 @@ class AddTransformersCommand : public Command { int32 count, int32 index); virtual ~AddTransformersCommand(); - + virtual status_t InitCheck(); virtual status_t Perform(); diff --git a/src/apps/icon-o-matic/shape/commands/FreezeTransformationCommand.h b/src/apps/icon-o-matic/shape/commands/FreezeTransformationCommand.h index 498b6cc39e..82c452c44d 100644 --- a/src/apps/icon-o-matic/shape/commands/FreezeTransformationCommand.h +++ b/src/apps/icon-o-matic/shape/commands/FreezeTransformationCommand.h @@ -10,15 +10,16 @@ #include "Command.h" +#include "IconBuild.h" -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Shape; class Transformable; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class FreezeTransformationCommand : public Command { public: @@ -26,7 +27,7 @@ class FreezeTransformationCommand : public Command { Shape** const shapes, int32 count); virtual ~FreezeTransformationCommand(); - + virtual status_t InitCheck(); virtual status_t Perform(); diff --git a/src/apps/icon-o-matic/shape/commands/MovePathsCommand.h b/src/apps/icon-o-matic/shape/commands/MovePathsCommand.h index be0369f732..bf0f73c69b 100644 --- a/src/apps/icon-o-matic/shape/commands/MovePathsCommand.h +++ b/src/apps/icon-o-matic/shape/commands/MovePathsCommand.h @@ -10,16 +10,18 @@ #include "Command.h" +#include "IconBuild.h" + // TODO: make a templated "move items" command? -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class VectorPath; class PathContainer; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class MovePathsCommand : public Command { public: @@ -29,7 +31,7 @@ class MovePathsCommand : public Command { int32 count, int32 toIndex); virtual ~MovePathsCommand(); - + virtual status_t InitCheck(); virtual status_t Perform(); diff --git a/src/apps/icon-o-matic/shape/commands/MoveShapesCommand.h b/src/apps/icon-o-matic/shape/commands/MoveShapesCommand.h index 6e0c836c55..2a02f7ac1c 100644 --- a/src/apps/icon-o-matic/shape/commands/MoveShapesCommand.h +++ b/src/apps/icon-o-matic/shape/commands/MoveShapesCommand.h @@ -10,17 +10,18 @@ #include "Command.h" +#include "IconBuild.h" // TODO: make a templated "move items" command? -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Shape; class ShapeContainer; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class MoveShapesCommand : public Command { public: @@ -30,7 +31,7 @@ class MoveShapesCommand : public Command { int32 count, int32 toIndex); virtual ~MoveShapesCommand(); - + virtual status_t InitCheck(); virtual status_t Perform(); diff --git a/src/apps/icon-o-matic/shape/commands/MoveTransformersCommand.h b/src/apps/icon-o-matic/shape/commands/MoveTransformersCommand.h index e6ead77d5a..1a6f6284e9 100644 --- a/src/apps/icon-o-matic/shape/commands/MoveTransformersCommand.h +++ b/src/apps/icon-o-matic/shape/commands/MoveTransformersCommand.h @@ -10,16 +10,19 @@ #include "Command.h" +#include "IconBuild.h" + // TODO: make a templated "move items" command? -namespace BPrivate { -namespace Icon { + +_BEGIN_ICON_NAMESPACE class Shape; class Transformer; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class MoveTransformersCommand : public Command { public: @@ -29,7 +32,7 @@ class MoveTransformersCommand : public Command { int32 count, int32 toIndex); virtual ~MoveTransformersCommand(); - + virtual status_t InitCheck(); virtual status_t Perform(); diff --git a/src/apps/icon-o-matic/shape/commands/NudgePointsCommand.h b/src/apps/icon-o-matic/shape/commands/NudgePointsCommand.h index b9a1723556..392df3dc63 100644 --- a/src/apps/icon-o-matic/shape/commands/NudgePointsCommand.h +++ b/src/apps/icon-o-matic/shape/commands/NudgePointsCommand.h @@ -9,18 +9,19 @@ #define NUDGE_POINTS_ACTION_H +#include "IconBuild.h" #include "TransformCommand.h" #include -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class VectorPath; struct control_point; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class NudgePointsCommand : public TransformCommand { public: @@ -31,7 +32,7 @@ class NudgePointsCommand : public TransformCommand { int32 count); virtual ~NudgePointsCommand(); - + virtual status_t InitCheck(); protected: diff --git a/src/apps/icon-o-matic/shape/commands/PathCommand.h b/src/apps/icon-o-matic/shape/commands/PathCommand.h index 2731add851..077b794d14 100644 --- a/src/apps/icon-o-matic/shape/commands/PathCommand.h +++ b/src/apps/icon-o-matic/shape/commands/PathCommand.h @@ -10,20 +10,21 @@ #include "Command.h" +#include "IconBuild.h" -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class VectorPath; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class PathCommand : public Command { public: PathCommand(VectorPath* path); virtual ~PathCommand(); - + virtual status_t InitCheck(); virtual void GetName(BString& name); diff --git a/src/apps/icon-o-matic/shape/commands/RemovePathsCommand.h b/src/apps/icon-o-matic/shape/commands/RemovePathsCommand.h index 305a245212..289dc1efe7 100644 --- a/src/apps/icon-o-matic/shape/commands/RemovePathsCommand.h +++ b/src/apps/icon-o-matic/shape/commands/RemovePathsCommand.h @@ -10,17 +10,18 @@ #include "Command.h" +#include "IconBuild.h" #include -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class VectorPath; class PathContainer; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class RemovePathsCommand : public Command { public: @@ -29,7 +30,7 @@ class RemovePathsCommand : public Command { VectorPath** const paths, int32 count); virtual ~RemovePathsCommand(); - + virtual status_t InitCheck(); virtual status_t Perform(); diff --git a/src/apps/icon-o-matic/shape/commands/RemoveShapesCommand.h b/src/apps/icon-o-matic/shape/commands/RemoveShapesCommand.h index 1729a48dfd..867b21d6ff 100644 --- a/src/apps/icon-o-matic/shape/commands/RemoveShapesCommand.h +++ b/src/apps/icon-o-matic/shape/commands/RemoveShapesCommand.h @@ -10,15 +10,16 @@ #include "Command.h" +#include "IconBuild.h" -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Shape; class ShapeContainer; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class RemoveShapesCommand : public Command { public: @@ -27,7 +28,7 @@ class RemoveShapesCommand : public Command { int32* const indices, int32 count); virtual ~RemoveShapesCommand(); - + virtual status_t InitCheck(); virtual status_t Perform(); diff --git a/src/apps/icon-o-matic/shape/commands/RemoveTransformersCommand.h b/src/apps/icon-o-matic/shape/commands/RemoveTransformersCommand.h index 786d27169f..2745011ea5 100644 --- a/src/apps/icon-o-matic/shape/commands/RemoveTransformersCommand.h +++ b/src/apps/icon-o-matic/shape/commands/RemoveTransformersCommand.h @@ -10,15 +10,16 @@ #include "Command.h" +#include "IconBuild.h" -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Shape; class Transformer; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + // TODO: make a templated "remove items" command? @@ -29,7 +30,7 @@ class RemoveTransformersCommand : public Command { const int32* indices, int32 count); virtual ~RemoveTransformersCommand(); - + virtual status_t InitCheck(); virtual status_t Perform(); diff --git a/src/apps/icon-o-matic/shape/commands/TransformPointsCommand.h b/src/apps/icon-o-matic/shape/commands/TransformPointsCommand.h index 8fddaf3c12..33ee32a65c 100644 --- a/src/apps/icon-o-matic/shape/commands/TransformPointsCommand.h +++ b/src/apps/icon-o-matic/shape/commands/TransformPointsCommand.h @@ -9,18 +9,19 @@ #define TRANSFORM_POINTS_COMMAND_H +#include "IconBuild.h" #include "TransformBox.h" #include "TransformCommand.h" -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE struct control_point; class Transformable; class VectorPath; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class TransformPointsCommand : public TransformCommand, public TransformBoxListener { @@ -42,7 +43,7 @@ class TransformPointsCommand : public TransformCommand, const char* name, int32 nameIndex); virtual ~TransformPointsCommand(); - + // Command interface virtual status_t InitCheck(); diff --git a/src/apps/icon-o-matic/shape/commands/UnassignPathCommand.h b/src/apps/icon-o-matic/shape/commands/UnassignPathCommand.h index fa5063ec1d..7395268611 100644 --- a/src/apps/icon-o-matic/shape/commands/UnassignPathCommand.h +++ b/src/apps/icon-o-matic/shape/commands/UnassignPathCommand.h @@ -10,22 +10,23 @@ #include "Command.h" +#include "IconBuild.h" -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Shape; class VectorPath; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class UnassignPathCommand : public Command { public: UnassignPathCommand(Shape* shape, VectorPath* path); virtual ~UnassignPathCommand(); - + virtual status_t InitCheck(); virtual status_t Perform(); diff --git a/src/apps/icon-o-matic/style/AddStylesCommand.h b/src/apps/icon-o-matic/style/AddStylesCommand.h index 802fa5750d..76b5138325 100644 --- a/src/apps/icon-o-matic/style/AddStylesCommand.h +++ b/src/apps/icon-o-matic/style/AddStylesCommand.h @@ -10,15 +10,16 @@ #include "Command.h" +#include "IconBuild.h" -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Style; class StyleContainer; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class AddStylesCommand : public Command { public: @@ -28,7 +29,7 @@ class AddStylesCommand : public Command { int32 count, int32 index); virtual ~AddStylesCommand(); - + virtual status_t InitCheck(); virtual status_t Perform(); diff --git a/src/apps/icon-o-matic/style/AssignStyleCommand.h b/src/apps/icon-o-matic/style/AssignStyleCommand.h index 0dbff1eb0c..b50c9252c8 100644 --- a/src/apps/icon-o-matic/style/AssignStyleCommand.h +++ b/src/apps/icon-o-matic/style/AssignStyleCommand.h @@ -10,17 +10,18 @@ #include "Command.h" +#include "IconBuild.h" #include -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Shape; class Style; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class AssignStyleCommand : public Command { public: diff --git a/src/apps/icon-o-matic/style/MoveStylesCommand.h b/src/apps/icon-o-matic/style/MoveStylesCommand.h index 910bb530a2..0ee83d0a3a 100644 --- a/src/apps/icon-o-matic/style/MoveStylesCommand.h +++ b/src/apps/icon-o-matic/style/MoveStylesCommand.h @@ -10,16 +10,18 @@ #include "Command.h" +#include "IconBuild.h" + // TODO: make a templated "move items" command? -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Style; class StyleContainer; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class MoveStylesCommand : public Command { public: @@ -29,7 +31,7 @@ class MoveStylesCommand : public Command { int32 count, int32 toIndex); virtual ~MoveStylesCommand(); - + virtual status_t InitCheck(); virtual status_t Perform(); diff --git a/src/apps/icon-o-matic/style/RemoveStylesCommand.h b/src/apps/icon-o-matic/style/RemoveStylesCommand.h index 0fc9d5894f..e41acfc0f5 100644 --- a/src/apps/icon-o-matic/style/RemoveStylesCommand.h +++ b/src/apps/icon-o-matic/style/RemoveStylesCommand.h @@ -10,17 +10,18 @@ #include "Command.h" +#include "IconBuild.h" #include -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Style; class StyleContainer; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class RemoveStylesCommand : public Command { public: @@ -29,7 +30,7 @@ class RemoveStylesCommand : public Command { Style** const styles, int32 count); virtual ~RemoveStylesCommand(); - + virtual status_t InitCheck(); virtual status_t Perform(); diff --git a/src/apps/icon-o-matic/style/SetColorCommand.h b/src/apps/icon-o-matic/style/SetColorCommand.h index 3977402135..ffcf7e9c66 100644 --- a/src/apps/icon-o-matic/style/SetColorCommand.h +++ b/src/apps/icon-o-matic/style/SetColorCommand.h @@ -10,16 +10,17 @@ #include "Command.h" +#include "IconBuild.h" #include -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Style; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class SetColorCommand : public Command { public: diff --git a/src/apps/icon-o-matic/style/SetGradientCommand.h b/src/apps/icon-o-matic/style/SetGradientCommand.h index accaaf7399..0a4887cc72 100644 --- a/src/apps/icon-o-matic/style/SetGradientCommand.h +++ b/src/apps/icon-o-matic/style/SetGradientCommand.h @@ -10,15 +10,16 @@ #include "Command.h" +#include "IconBuild.h" -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Gradient; class Style; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class SetGradientCommand : public Command { public: diff --git a/src/apps/icon-o-matic/transformable/ResetTransformationCommand.h b/src/apps/icon-o-matic/transformable/ResetTransformationCommand.h index 788ec480e7..421df536df 100644 --- a/src/apps/icon-o-matic/transformable/ResetTransformationCommand.h +++ b/src/apps/icon-o-matic/transformable/ResetTransformationCommand.h @@ -9,14 +9,17 @@ #ifndef RESET_TRANSFORM_COMMAND_H #define RESET_TRANSFORM_COMMAND_H -#include "Command.h" -namespace BPrivate { -namespace Icon { +#include "Command.h" +#include "IconBuild.h" + + +_BEGIN_ICON_NAMESPACE class Transformable; -} -} -using BPrivate::Icon::Transformable; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class ResetTransformationCommand : public Command { public: @@ -24,7 +27,7 @@ class ResetTransformationCommand : public Command { Transformable** const objects, int32 count); virtual ~ResetTransformationCommand(); - + // Command interface virtual status_t InitCheck(); diff --git a/src/apps/icon-o-matic/transformable/TransformGradientBox.h b/src/apps/icon-o-matic/transformable/TransformGradientBox.h index 6f40f74c76..3b3e440b8d 100644 --- a/src/apps/icon-o-matic/transformable/TransformGradientBox.h +++ b/src/apps/icon-o-matic/transformable/TransformGradientBox.h @@ -9,18 +9,19 @@ #define TRANSFORM_GRADIENT_BOX_H +#include "IconBuild.h" #include "TransformBox.h" class CanvasView; -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Gradient; class Shape; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class TransformGradientBox : public TransformBox { public: diff --git a/src/apps/icon-o-matic/transformable/TransformGradientCommand.h b/src/apps/icon-o-matic/transformable/TransformGradientCommand.h index e2131d75ab..85d68f99ee 100644 --- a/src/apps/icon-o-matic/transformable/TransformGradientCommand.h +++ b/src/apps/icon-o-matic/transformable/TransformGradientCommand.h @@ -6,16 +6,16 @@ #define TRANSFORM_GRADIENT_COMMAND_H +#include "IconBuild.h" #include "TransformBox.h" #include "TransformCommand.h" -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Gradient; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE class TransformGradientCommand : public TransformCommand, @@ -28,7 +28,7 @@ public: double yScale, const char* name, int32 nameIndex); virtual ~TransformGradientCommand(); - + // Command interface virtual status_t InitCheck(); diff --git a/src/apps/icon-o-matic/transformable/TransformObjectsCommand.h b/src/apps/icon-o-matic/transformable/TransformObjectsCommand.h index 150ad077cb..46725a9cb0 100644 --- a/src/apps/icon-o-matic/transformable/TransformObjectsCommand.h +++ b/src/apps/icon-o-matic/transformable/TransformObjectsCommand.h @@ -9,16 +9,17 @@ #define TRANSFORM_OBJECTS_COMMAND_H +#include "IconBuild.h" #include "TransformBox.h" #include "TransformCommand.h" -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Transformable; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class TransformObjectsCommand : public TransformCommand, public TransformBoxListener { @@ -38,7 +39,7 @@ class TransformObjectsCommand : public TransformCommand, const char* name, int32 nameIndex); virtual ~TransformObjectsCommand(); - + // Command interface virtual status_t InitCheck(); diff --git a/src/apps/icon-o-matic/transformable/TransformPointsBox.h b/src/apps/icon-o-matic/transformable/TransformPointsBox.h index 7c2d6512cd..022c290eb6 100644 --- a/src/apps/icon-o-matic/transformable/TransformPointsBox.h +++ b/src/apps/icon-o-matic/transformable/TransformPointsBox.h @@ -10,18 +10,19 @@ #include "CanvasTransformBox.h" +#include "IconBuild.h" class CanvasView; class PathManipulator; -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class VectorPath; struct control_point; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class TransformPointsBox : public CanvasTransformBox { public: diff --git a/src/apps/icon-o-matic/transformable/TransformShapesBox.h b/src/apps/icon-o-matic/transformable/TransformShapesBox.h index 1036051048..5544cc9633 100644 --- a/src/apps/icon-o-matic/transformable/TransformShapesBox.h +++ b/src/apps/icon-o-matic/transformable/TransformShapesBox.h @@ -10,14 +10,15 @@ #include "CanvasTransformBox.h" +#include "IconBuild.h" -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE class Shape; -} -} -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + +_USING_ICON_NAMESPACE + class TransformShapesBox : public CanvasTransformBox { public: diff --git a/src/apps/readonlybootprompt/BootPromptWindow.cpp b/src/apps/readonlybootprompt/BootPromptWindow.cpp index 1147979826..b65aa6de1a 100644 --- a/src/apps/readonlybootprompt/BootPromptWindow.cpp +++ b/src/apps/readonlybootprompt/BootPromptWindow.cpp @@ -39,7 +39,7 @@ #include "KeymapListItem.h" -using BPrivate::gMutableLocaleRoster; +using BPrivate::MutableLocaleRoster; enum { @@ -59,8 +59,8 @@ public: fLanguage(language) { fIcon = new(std::nothrow) BBitmap(BRect(0, 0, 15, 15), B_RGBA32); - if (fIcon != NULL && be_locale_roster->GetFlagIconForCountry(fIcon, - language) != B_OK) { + if (fIcon != NULL && BLocaleRoster::Default()->GetFlagIconForCountry( + fIcon, language) != B_OK) { delete fIcon; fIcon = NULL; } @@ -247,7 +247,7 @@ BootPromptWindow::BootPromptWindow() | B_AUTO_UPDATE_SIZE_LIMITS) { // Get the list of all known languages (suffice to do it only once) - be_locale_roster->GetAvailableLanguages(&fInstalledLanguages); + BLocaleRoster::Default()->GetAvailableLanguages(&fInstalledLanguages); fInfoTextView = new TextBitmapView(BSize(480, 140)); static_cast(fInfoTextView)->SetInsets(5, 5, 5, 5); @@ -333,7 +333,7 @@ BootPromptWindow::MessageReceived(BMessage* message) BMessage preferredLanguages; preferredLanguages.AddString("language", languageItem->Language()); - gMutableLocaleRoster->SetPreferredLanguages( + MutableLocaleRoster::Default()->SetPreferredLanguages( &preferredLanguages); _InitCatalog(true); } @@ -368,14 +368,14 @@ BootPromptWindow::_InitCatalog(bool saveSettings) BMessage settings; BString language; - if (be_locale_roster->GetCatalog()->GetLanguage(&language) == B_OK) { + if (BLocaleRoster::Default()->GetCatalog()->GetLanguage(&language) == B_OK) settings.AddString("language", language.String()); - } - gMutableLocaleRoster->SetPreferredLanguages(&settings); + MutableLocaleRoster::Default()->SetPreferredLanguages(&settings); BFormattingConventions conventions(language.String()); - gMutableLocaleRoster->SetDefaultFormattingConventions(conventions); + MutableLocaleRoster::Default()->SetDefaultFormattingConventions( + conventions); } @@ -422,7 +422,7 @@ BootPromptWindow::_PopulateLanguages() // Get current first preferred language of the user BMessage preferredLanguages; - be_locale_roster->GetPreferredLanguages(&preferredLanguages); + BLocaleRoster::Default()->GetPreferredLanguages(&preferredLanguages); const char* firstPreferredLanguage; if (preferredLanguages.FindString("language", &firstPreferredLanguage) != B_OK) { @@ -431,7 +431,7 @@ BootPromptWindow::_PopulateLanguages() } BMessage installedCatalogs; - be_locale_roster->GetAvailableCatalogs(&installedCatalogs, + BLocaleRoster::Default()->GetAvailableCatalogs(&installedCatalogs, "x-vnd.Haiku-ReadOnlyBootPrompt"); BFont font; @@ -446,7 +446,8 @@ BootPromptWindow::_PopulateLanguages() for (int32 i = 0; installedCatalogs.FindString("language", i, &languageID) == B_OK; i++) { BLanguage* language; - if (be_locale_roster->GetLanguage(languageID, &language) == B_OK) { + if (BLocaleRoster::Default()->GetLanguage(languageID, &language) + == B_OK) { BString name; language->GetNativeName(name); diff --git a/src/bin/coreutils/lib/Jamfile b/src/bin/coreutils/lib/Jamfile index ec0f57a499..2497670775 100644 --- a/src/bin/coreutils/lib/Jamfile +++ b/src/bin/coreutils/lib/Jamfile @@ -9,7 +9,7 @@ SubDirCcFlags -DHAVE_CONFIG_H -DB_ENABLE_INCOMPLETE_POSIX_AT_SUPPORT ; SubDirSysHdrs $(SUBDIR) ; #SubDirSysHdrs $(SUBDIR) $(DOTDOT) ; -StaticLibrary libfetish.a : +StaticLibrary libfetish.a : # __fpending.c # acl.c # alloca.c @@ -205,7 +205,7 @@ StaticLibrary libfetish.a : # strtoull.c # strtoumax.c tempname.c - time_r.c +# time_r.c trim.c u8-uctomb.c u8-uctomb-aux.c diff --git a/src/bin/dstcheck.cpp b/src/bin/dstcheck.cpp index 4f3cb0060b..774c3e6565 100644 --- a/src/bin/dstcheck.cpp +++ b/src/bin/dstcheck.cpp @@ -83,7 +83,7 @@ TimedAlert::GetLabel(BString &string) time(&t); localtime_r(&t, &tm); - be_locale->FormatTime(timestring, 15, t, B_SHORT_TIME_FORMAT); + BLocale::Default()->FormatTime(timestring, 15, t, B_SHORT_TIME_FORMAT); string += " "; string += timestring; diff --git a/src/kits/locale/Catalog.cpp b/src/kits/locale/Catalog.cpp index 50919c0531..1791e9132a 100644 --- a/src/kits/locale/Catalog.cpp +++ b/src/kits/locale/Catalog.cpp @@ -15,7 +15,7 @@ #include -using BPrivate::gMutableLocaleRoster; +using BPrivate::MutableLocaleRoster; //#pragma mark - BCatalog @@ -29,14 +29,14 @@ BCatalog::BCatalog() BCatalog::BCatalog(const char *signature, const char *language, uint32 fingerprint) { - fCatalog - = gMutableLocaleRoster->LoadCatalog(signature, language, fingerprint); + fCatalog = MutableLocaleRoster::Default()->LoadCatalog(signature, language, + fingerprint); } BCatalog::~BCatalog() { - gMutableLocaleRoster->UnloadCatalog(fCatalog); + MutableLocaleRoster::Default()->UnloadCatalog(fCatalog); } @@ -102,8 +102,9 @@ BCatalog::SetCatalog(const char* signature, uint32 fingerprint) { // This is not thread safe. It is used only in ReadOnlyBootPrompt and should // not do harm there, but not sure what to do about it… - gMutableLocaleRoster->UnloadCatalog(fCatalog); - fCatalog = gMutableLocaleRoster->LoadCatalog(signature, NULL, fingerprint); + MutableLocaleRoster::Default()->UnloadCatalog(fCatalog); + fCatalog = MutableLocaleRoster::Default()->LoadCatalog(signature, NULL, + fingerprint); return B_OK; } @@ -268,7 +269,8 @@ namespace BPrivate { EditableCatalog::EditableCatalog(const char *type, const char *signature, const char *language) { - fCatalog = gMutableLocaleRoster->CreateCatalog(type, signature, language); + fCatalog = MutableLocaleRoster::Default()->CreateCatalog(type, signature, + language); } diff --git a/src/kits/locale/Country.cpp b/src/kits/locale/Country.cpp index e9e620607e..20e489b1d3 100644 --- a/src/kits/locale/Country.cpp +++ b/src/kits/locale/Country.cpp @@ -83,7 +83,7 @@ BCountry::GetName(BString& name, const BLanguage* displayLanguage) const BString appLanguage; if (displayLanguage == NULL) { BMessage preferredLanguage; - be_locale_roster->GetPreferredLanguages(&preferredLanguage); + BLocaleRoster::Default()->GetPreferredLanguages(&preferredLanguage); preferredLanguage.FindString("language", 0, &appLanguage); } else { appLanguage = displayLanguage->Code(); @@ -112,13 +112,14 @@ BCountry::GetIcon(BBitmap* result) const const char* code = fICULocale->getCountry(); if (code == NULL) return B_ERROR; - return be_locale_roster->GetFlagIconForCountry(result, code); + return BLocaleRoster::Default()->GetFlagIconForCountry(result, code); } status_t BCountry::GetAvailableTimeZones(BMessage* timeZones) const { - return be_locale_roster->GetAvailableTimeZonesForCountry(timeZones, Code()); + return BLocaleRoster::Default()->GetAvailableTimeZonesForCountry(timeZones, + Code()); } diff --git a/src/kits/locale/DurationFormat.cpp b/src/kits/locale/DurationFormat.cpp index 316202fc3f..146578fc4a 100644 --- a/src/kits/locale/DurationFormat.cpp +++ b/src/kits/locale/DurationFormat.cpp @@ -116,7 +116,7 @@ BDurationFormat::SetTimeZone(const BTimeZone* timeZone) if (timeZone == NULL) { BTimeZone defaultTimeZone; status_t result - = be_locale_roster->GetDefaultTimeZone(&defaultTimeZone); + = BLocaleRoster::Default()->GetDefaultTimeZone(&defaultTimeZone); if (result != B_OK) return result; zonePrivate.SetTo(&defaultTimeZone); diff --git a/src/kits/locale/FormattingConventions.cpp b/src/kits/locale/FormattingConventions.cpp index 9a86223ad7..3a02f25bd3 100644 --- a/src/kits/locale/FormattingConventions.cpp +++ b/src/kits/locale/FormattingConventions.cpp @@ -362,7 +362,7 @@ BFormattingConventions::GetName(BString& name, BString displayLanguageID; if (displayLanguage == NULL) { BLanguage defaultLanguage; - be_locale->GetLanguage(&defaultLanguage); + BLocale::Default()->GetLanguage(&defaultLanguage); displayLanguageID = defaultLanguage.Code(); } else { displayLanguageID = displayLanguage->Code(); diff --git a/src/kits/locale/Language.cpp b/src/kits/locale/Language.cpp index 62e3a9a3e8..e686b5a0ab 100644 --- a/src/kits/locale/Language.cpp +++ b/src/kits/locale/Language.cpp @@ -130,7 +130,7 @@ BLanguage::GetName(BString& name, const BLanguage* displayLanguage) const BString appLanguage; if (displayLanguage == NULL) { BMessage preferredLanguage; - be_locale_roster->GetPreferredLanguages(&preferredLanguage); + BLocaleRoster::Default()->GetPreferredLanguages(&preferredLanguage); preferredLanguage.FindString("language", 0, &appLanguage); } else { appLanguage = displayLanguage->Code(); diff --git a/src/kits/locale/LibbeLocaleBackend.cpp b/src/kits/locale/LibbeLocaleBackend.cpp index 46efd360d0..4fcb54e5e1 100644 --- a/src/kits/locale/LibbeLocaleBackend.cpp +++ b/src/kits/locale/LibbeLocaleBackend.cpp @@ -25,7 +25,7 @@ CreateLocaleBackendInstance() LibbeLocaleBackend::LibbeLocaleBackend() { - gMutableLocaleRoster->GetSystemCatalog(&systemCatalog); + MutableLocaleRoster::Default()->GetSystemCatalog(&systemCatalog); } diff --git a/src/kits/locale/Locale.cpp b/src/kits/locale/Locale.cpp index 563e8b3058..53edd1a509 100644 --- a/src/kits/locale/Locale.cpp +++ b/src/kits/locale/Locale.cpp @@ -42,12 +42,12 @@ BLocale::BLocale(const BLanguage* language, if (conventions != NULL) fConventions = *conventions; else - be_locale->GetFormattingConventions(&fConventions); + BLocale::Default()->GetFormattingConventions(&fConventions); if (language != NULL) fLanguage = *language; else - be_locale->GetLanguage(&fLanguage); + BLocale::Default()->GetLanguage(&fLanguage); } @@ -59,6 +59,13 @@ BLocale::BLocale(const BLocale& other) } +/*static*/ const BLocale* +BLocale::Default() +{ + return &BPrivate::RosterData::Default()->fDefaultLocale; +} + + BLocale& BLocale::operator=(const BLocale& other) { diff --git a/src/kits/locale/LocaleRoster.cpp b/src/kits/locale/LocaleRoster.cpp index 7ee5f26002..6fca2d6c78 100644 --- a/src/kits/locale/LocaleRoster.cpp +++ b/src/kits/locale/LocaleRoster.cpp @@ -75,10 +75,17 @@ BLocaleRoster::~BLocaleRoster() } +/*static*/ BLocaleRoster* +BLocaleRoster::Default() +{ + return MutableLocaleRoster::Default(); +} + + status_t BLocaleRoster::Refresh() { - return gRosterData.Refresh(); + return RosterData::Default()->Refresh(); } @@ -88,11 +95,12 @@ BLocaleRoster::GetDefaultTimeZone(BTimeZone* timezone) const if (!timezone) return B_BAD_VALUE; - BAutolock lock(gRosterData.fLock); + RosterData* rosterData = RosterData::Default(); + BAutolock lock(rosterData->fLock); if (!lock.IsLocked()) return B_ERROR; - *timezone = gRosterData.fDefaultTimeZone; + *timezone = rosterData->fDefaultTimeZone; return B_OK; } @@ -120,11 +128,12 @@ BLocaleRoster::GetPreferredLanguages(BMessage* languages) const if (!languages) return B_BAD_VALUE; - BAutolock lock(gRosterData.fLock); + RosterData* rosterData = RosterData::Default(); + BAutolock lock(rosterData->fLock); if (!lock.IsLocked()) return B_ERROR; - *languages = gRosterData.fPreferredLanguages; + *languages = rosterData->fPreferredLanguages; return B_OK; } @@ -234,20 +243,21 @@ BLocaleRoster::GetFlagIconForCountry(BBitmap* flagIcon, const char* countryCode) if (countryCode == NULL) return B_BAD_DATA; - BAutolock lock(gRosterData.fLock); + RosterData* rosterData = RosterData::Default(); + BAutolock lock(rosterData->fLock); if (!lock.IsLocked()) return B_ERROR; - if (!gRosterData.fAreResourcesLoaded) { - status_t result = gRosterData.fResources.SetToImage(&gRosterData); + if (!rosterData->fAreResourcesLoaded) { + status_t result = rosterData->fResources.SetToImage(rosterData); if (result != B_OK) return result; - result = gRosterData.fResources.PreloadResourceType(); + result = rosterData->fResources.PreloadResourceType(); if (result != B_OK) return result; - gRosterData.fAreResourcesLoaded = true; + rosterData->fAreResourcesLoaded = true; } size_t size; @@ -262,8 +272,8 @@ BLocaleRoster::GetFlagIconForCountry(BBitmap* flagIcon, const char* countryCode) normalizedCode[0] = toupper(countryCode[codeLength - 2]); normalizedCode[1] = toupper(countryCode[codeLength - 1]); - const void* buffer = gRosterData.fResources.LoadResource(B_VECTOR_ICON_TYPE, - normalizedCode, &size); + const void* buffer = rosterData->fResources.LoadResource( + B_VECTOR_ICON_TYPE, normalizedCode, &size); if (buffer == NULL || size == 0) return B_NAME_NOT_FOUND; @@ -279,14 +289,15 @@ BLocaleRoster::GetAvailableCatalogs(BMessage* languageList, if (languageList == NULL) return B_BAD_VALUE; - BAutolock lock(gRosterData.fLock); + RosterData* rosterData = RosterData::Default(); + BAutolock lock(rosterData->fLock); if (!lock.IsLocked()) return B_ERROR; - int32 count = gRosterData.fCatalogAddOnInfos.CountItems(); + int32 count = rosterData->fCatalogAddOnInfos.CountItems(); for (int32 i = 0; i < count; ++i) { CatalogAddOnInfo* info - = (CatalogAddOnInfo*)gRosterData.fCatalogAddOnInfos.ItemAt(i); + = (CatalogAddOnInfo*)rosterData->fCatalogAddOnInfos.ItemAt(i); if (!info->MakeSureItsLoaded() || !info->fLanguagesFunc) continue; diff --git a/src/kits/locale/MutableLocaleRoster.cpp b/src/kits/locale/MutableLocaleRoster.cpp index c39802ebc3..09e9926349 100644 --- a/src/kits/locale/MutableLocaleRoster.cpp +++ b/src/kits/locale/MutableLocaleRoster.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -125,8 +126,6 @@ CatalogAddOnInfo::UnloadIfPossible() // #pragma mark - RosterData -RosterData gRosterData; - static const char* kPriorityAttr = "ADDON:priority"; static const char* kLanguageField = "language"; @@ -134,6 +133,9 @@ static const char* kLanguageField = "language"; static const char* kTimezoneField = "timezone"; static const char* kOffsetField = "offset"; +static RosterData sRosterData(BLanguage("en_US"), + BFormattingConventions("en_US")); + RosterData::RosterData() : @@ -151,6 +153,24 @@ RosterData::RosterData() } +RosterData::RosterData(const BLanguage& language, + const BFormattingConventions& conventions) + : + fLock("LocaleRosterData"), + fDefaultLocale(&language, &conventions), + fAreResourcesLoaded(false) +{ + openlog_team("liblocale.so", LOG_PID, LOG_USER); +#ifndef DEBUG + setlogmask_team(LOG_UPTO(LOG_WARNING)); +#endif + + InitializeCatalogAddOns(); + + Refresh(); +} + + RosterData::~RosterData() { BAutolock lock(fLock); @@ -160,6 +180,13 @@ RosterData::~RosterData() } +/*static*/ RosterData* +RosterData::Default() +{ + return &sRosterData; +} + + int RosterData::CompareInfos(const void* left, const void* right) { @@ -626,8 +653,7 @@ RosterData::_AddPreferredLanguagesToMessage(BMessage* message) const // #pragma mark - MutableLocaleRoster -static MutableLocaleRoster gLocaleRoster; -MutableLocaleRoster* gMutableLocaleRoster = &gLocaleRoster; +static MutableLocaleRoster sLocaleRoster; MutableLocaleRoster::MutableLocaleRoster() @@ -640,24 +666,32 @@ MutableLocaleRoster::~MutableLocaleRoster() } +/*static*/ MutableLocaleRoster* +MutableLocaleRoster::Default() +{ + return &sLocaleRoster; +} + + status_t MutableLocaleRoster::SetDefaultFormattingConventions(const BFormattingConventions& newFormattingConventions) { - return gRosterData.SetDefaultFormattingConventions(newFormattingConventions); + return RosterData::Default()->SetDefaultFormattingConventions( + newFormattingConventions); } status_t MutableLocaleRoster::SetDefaultTimeZone(const BTimeZone& newZone) { - return gRosterData.SetDefaultTimeZone(newZone); + return RosterData::Default()->SetDefaultTimeZone(newZone); } status_t MutableLocaleRoster::SetPreferredLanguages(const BMessage* languages) { - return gRosterData.SetPreferredLanguages(languages); + return RosterData::Default()->SetPreferredLanguages(languages); } @@ -686,14 +720,14 @@ MutableLocaleRoster::CreateCatalog(const char* type, const char* signature, if (!type || !signature || !language) return NULL; - BAutolock lock(gRosterData.fLock); + BAutolock lock(RosterData::Default()->fLock); if (!lock.IsLocked()) return NULL; - int32 count = gRosterData.fCatalogAddOnInfos.CountItems(); + int32 count = RosterData::Default()->fCatalogAddOnInfos.CountItems(); for (int32 i = 0; i < count; ++i) { - CatalogAddOnInfo* info - = (CatalogAddOnInfo*)gRosterData.fCatalogAddOnInfos.ItemAt(i); + CatalogAddOnInfo* info = (CatalogAddOnInfo*) + RosterData::Default()->fCatalogAddOnInfos.ItemAt(i); if (info->fName.ICompare(type)!=0 || !info->MakeSureItsLoaded() || !info->fCreateFunc) continue; @@ -727,14 +761,14 @@ MutableLocaleRoster::LoadCatalog(const char* signature, const char* language, if (!signature) return NULL; - BAutolock lock(gRosterData.fLock); + BAutolock lock(RosterData::Default()->fLock); if (!lock.IsLocked()) return NULL; - int32 count = gRosterData.fCatalogAddOnInfos.CountItems(); + int32 count = RosterData::Default()->fCatalogAddOnInfos.CountItems(); for (int32 i = 0; i < count; ++i) { - CatalogAddOnInfo* info - = (CatalogAddOnInfo*)gRosterData.fCatalogAddOnInfos.ItemAt(i); + CatalogAddOnInfo* info = (CatalogAddOnInfo*) + RosterData::Default()->fCatalogAddOnInfos.ItemAt(i); if (!info->MakeSureItsLoaded() || !info->fInstantiateFunc) continue; @@ -801,14 +835,14 @@ MutableLocaleRoster::LoadEmbeddedCatalog(entry_ref* appOrAddOnRef) if (!appOrAddOnRef) return NULL; - BAutolock lock(gRosterData.fLock); + BAutolock lock(RosterData::Default()->fLock); if (!lock.IsLocked()) return NULL; - int32 count = gRosterData.fCatalogAddOnInfos.CountItems(); + int32 count = RosterData::Default()->fCatalogAddOnInfos.CountItems(); for (int32 i = 0; i < count; ++i) { - CatalogAddOnInfo* info - = (CatalogAddOnInfo*)gRosterData.fCatalogAddOnInfos.ItemAt(i); + CatalogAddOnInfo* info = (CatalogAddOnInfo*) + RosterData::Default()->fCatalogAddOnInfos.ItemAt(i); if (!info->MakeSureItsLoaded() || !info->fInstantiateEmbeddedFunc) continue; @@ -837,7 +871,7 @@ MutableLocaleRoster::UnloadCatalog(BCatalogAddOn* catalog) if (!catalog) return B_BAD_VALUE; - BAutolock lock(gRosterData.fLock); + BAutolock lock(RosterData::Default()->fLock); if (!lock.IsLocked()) return B_ERROR; @@ -846,10 +880,10 @@ MutableLocaleRoster::UnloadCatalog(BCatalogAddOn* catalog) while (catalog) { nextCatalog = catalog->Next(); - int32 count = gRosterData.fCatalogAddOnInfos.CountItems(); + int32 count = RosterData::Default()->fCatalogAddOnInfos.CountItems(); for (int32 i = 0; i < count; ++i) { CatalogAddOnInfo* info = static_cast( - gRosterData.fCatalogAddOnInfos.ItemAt(i)); + RosterData::Default()->fCatalogAddOnInfos.ItemAt(i)); if (info->fLoadedCatalogs.HasItem(catalog)) { info->fLoadedCatalogs.RemoveItem(catalog); delete catalog; @@ -864,8 +898,3 @@ MutableLocaleRoster::UnloadCatalog(BCatalogAddOn* catalog) } // namespace BPrivate - - -BLocaleRoster* be_locale_roster = &BPrivate::gLocaleRoster; - -const BLocale* be_locale = &BPrivate::gRosterData.fDefaultLocale; diff --git a/src/kits/locale/TimeUnitFormat.cpp b/src/kits/locale/TimeUnitFormat.cpp index 5873df2c55..092083bdd0 100644 --- a/src/kits/locale/TimeUnitFormat.cpp +++ b/src/kits/locale/TimeUnitFormat.cpp @@ -90,7 +90,7 @@ BTimeUnitFormat::SetLocale(const BLocale* locale) if (fLocale != NULL) fLocale->GetLanguage(&language); else - be_locale->GetLanguage(&language); + BLocale::Default()->GetLanguage(&language); Locale icuLocale(language.Code()); UErrorCode icuStatus = U_ZERO_ERROR; diff --git a/src/kits/tracker/WidgetAttributeText.cpp b/src/kits/tracker/WidgetAttributeText.cpp index 5fd0e651af..0c01a49ee7 100644 --- a/src/kits/tracker/WidgetAttributeText.cpp +++ b/src/kits/tracker/WidgetAttributeText.cpp @@ -190,12 +190,12 @@ TruncTimeBase(BString* result, int64 value, const View* view, float width) time_t timeValue = (time_t)value; - if (be_locale->FormatDateTime(buffer, 256, timeValue, B_FULL_DATE_FORMAT, - B_MEDIUM_TIME_FORMAT) == B_OK) + if (BLocale::Default()->FormatDateTime(buffer, 256, timeValue, + B_FULL_DATE_FORMAT, B_MEDIUM_TIME_FORMAT) == B_OK) resultWidth = view->StringWidth(buffer); if (resultWidth > width - && be_locale->FormatDateTime(buffer, 256, timeValue, + && BLocale::Default()->FormatDateTime(buffer, 256, timeValue, B_SHORT_DATE_FORMAT, B_SHORT_TIME_FORMAT) == B_OK) { resultWidth = view->StringWidth(buffer); } diff --git a/src/libs/icon/Icon.h b/src/libs/icon/Icon.h index 0b21757090..3d2cbeaa72 100644 --- a/src/libs/icon/Icon.h +++ b/src/libs/icon/Icon.h @@ -9,6 +9,7 @@ #define ICON_H +#include "IconBuild.h" #include "ShapeContainer.h" #ifdef ICON_O_MATIC @@ -23,8 +24,8 @@ class BRect; -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE + class PathContainer; class StyleContainer; @@ -90,7 +91,8 @@ class Icon { #endif }; -} // namespace Icon -} // namespace BPrivate + +_END_ICON_NAMESPACE + #endif // ICON_H diff --git a/src/libs/icon/IconBuild.h b/src/libs/icon/IconBuild.h new file mode 100644 index 0000000000..fd4c0e96e2 --- /dev/null +++ b/src/libs/icon/IconBuild.h @@ -0,0 +1,22 @@ +/* + * Copyright 2010, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef ICON_BUILD_H +#define ICON_BUILD_H + + +#ifdef ICON_O_MATIC +# define _BEGIN_ICON_NAMESPACE +# define _END_ICON_NAMESPACE +# define _ICON_NAMESPACE :: +# define _USING_ICON_NAMESPACE +#else +# define _BEGIN_ICON_NAMESPACE namespace BPrivate { namespace Icon { +# define _END_ICON_NAMESPACE } } +# define _ICON_NAMESPACE BPrivate::Icon:: +# define _USING_ICON_NAMESPACE using namespace BPrivate::Icon; +#endif + + +#endif // ICON_BUILD_H diff --git a/src/libs/icon/IconRenderer.h b/src/libs/icon/IconRenderer.h index ac461ecc3d..d4c42681c0 100644 --- a/src/libs/icon/IconRenderer.h +++ b/src/libs/icon/IconRenderer.h @@ -19,12 +19,15 @@ #include #include +#include "IconBuild.h" + + class BBitmap; class BRect; -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE + class Icon; @@ -66,7 +69,7 @@ class IconRenderer { // used when no background bitmap // is set - const BPrivate::Icon::GammaTable& GammaTable() const + const _ICON_NAMESPACE GammaTable& GammaTable() const { return fGammaTable; } void Demultiply(); @@ -83,7 +86,7 @@ class IconRenderer { agg::rgba8 fBackgroundColor; const Icon* fIcon; - BPrivate::Icon::GammaTable fGammaTable; + _ICON_NAMESPACE GammaTable fGammaTable; RenderingBuffer fRenderingBuffer; PixelFormat fPixelFormat; @@ -100,7 +103,8 @@ class IconRenderer { Transformation fGlobalTransform; }; -} // namespace Icon -} // namespace BPrivate + +_END_ICON_NAMESPACE + #endif // ICON_RENDERER_H diff --git a/src/libs/icon/IconUtils.cpp b/src/libs/icon/IconUtils.cpp index d7a0df5bdc..83a99f384b 100644 --- a/src/libs/icon/IconUtils.cpp +++ b/src/libs/icon/IconUtils.cpp @@ -30,7 +30,7 @@ # define B_LARGE_ICON_TYPE 'ICON' #endif -using namespace BPrivate::Icon; +_USING_ICON_NAMESPACE; using std::nothrow; diff --git a/src/libs/icon/flat_icon/FlatIconFormat.cpp b/src/libs/icon/flat_icon/FlatIconFormat.cpp index abe1e7d294..eb5d4679ce 100644 --- a/src/libs/icon/flat_icon/FlatIconFormat.cpp +++ b/src/libs/icon/flat_icon/FlatIconFormat.cpp @@ -12,8 +12,8 @@ #include "LittleEndianBuffer.h" -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE + const uint32 FLAT_ICON_MAGIC = 'ficn'; @@ -85,7 +85,7 @@ read_float_24(LittleEndianBuffer& buffer, float& _value) int sign = (shortValue & 0x800000) >> 23; int exponent = ((shortValue & 0x7e0000) >> 17) - 32; int mantissa = (shortValue & 0x01ffff) << 6; - + if (shortValue == 0) _value = 0.0; else { @@ -110,7 +110,7 @@ write_float_24(LittleEndianBuffer& buffer, float _value) int sign = (value & 0x80000000) >> 31; int exponent = ((value & 0x7f800000) >> 23) - 127; int mantissa = value & 0x007fffff; - + if (exponent >= 32 || exponent < -32) { uint8 zero = 0; return buffer.Write(zero) && buffer.Write(zero) @@ -126,5 +126,5 @@ write_float_24(LittleEndianBuffer& buffer, float _value) && buffer.Write((uint8)(shortValue & 0xff)); } -} // namespace Icon -} // namespace BPrivate + +_END_ICON_NAMESPACE diff --git a/src/libs/icon/flat_icon/FlatIconFormat.h b/src/libs/icon/flat_icon/FlatIconFormat.h index c2ba0624b9..d8173f5aa3 100644 --- a/src/libs/icon/flat_icon/FlatIconFormat.h +++ b/src/libs/icon/flat_icon/FlatIconFormat.h @@ -11,9 +11,11 @@ #include +#include "IconBuild.h" + + +_BEGIN_ICON_NAMESPACE -namespace BPrivate { -namespace Icon { extern const uint32 FLAT_ICON_MAGIC; @@ -73,7 +75,8 @@ bool write_coord(LittleEndianBuffer& buffer, float coord); bool read_float_24(LittleEndianBuffer& buffer, float& value); bool write_float_24(LittleEndianBuffer& buffer, float value); -} // namespace Icon -} // namespace BPrivate + +_END_ICON_NAMESPACE + #endif // FLAT_ICON_FORMAT_H diff --git a/src/libs/icon/flat_icon/FlatIconImporter.h b/src/libs/icon/flat_icon/FlatIconImporter.h index 8d0d0a325e..1beea22bbb 100644 --- a/src/libs/icon/flat_icon/FlatIconImporter.h +++ b/src/libs/icon/flat_icon/FlatIconImporter.h @@ -15,11 +15,15 @@ # include #endif +#include "IconBuild.h" + + class BMessage; class BPositionIO; -namespace BPrivate { -namespace Icon { + +_BEGIN_ICON_NAMESPACE + class Icon; class LittleEndianBuffer; @@ -62,7 +66,8 @@ class FlatIconImporter { ShapeContainer* shapes); }; -} // namespace Icon -} // namespace BPrivate + +_END_ICON_NAMESPACE + #endif // FLAT_ICON_IMPORTER_H diff --git a/src/libs/icon/flat_icon/LittleEndianBuffer.cpp b/src/libs/icon/flat_icon/LittleEndianBuffer.cpp index 26606c01a0..aa9c25f29f 100644 --- a/src/libs/icon/flat_icon/LittleEndianBuffer.cpp +++ b/src/libs/icon/flat_icon/LittleEndianBuffer.cpp @@ -15,7 +15,9 @@ #include #include -using namespace BPrivate::Icon; + +_USING_ICON_NAMESPACE + #define CHUNK_SIZE 256 diff --git a/src/libs/icon/flat_icon/LittleEndianBuffer.h b/src/libs/icon/flat_icon/LittleEndianBuffer.h index 3b3e035564..ec32df17d5 100644 --- a/src/libs/icon/flat_icon/LittleEndianBuffer.h +++ b/src/libs/icon/flat_icon/LittleEndianBuffer.h @@ -11,9 +11,11 @@ #include +#include "IconBuild.h" + + +_BEGIN_ICON_NAMESPACE -namespace BPrivate { -namespace Icon { class LittleEndianBuffer { public: @@ -58,7 +60,8 @@ class LittleEndianBuffer { bool fOwnsBuffer; }; -} // namespace Icon -} // namespace BPrivate + +_END_ICON_NAMESPACE + #endif // LITTLE_ENDIAN_BUFFER_H diff --git a/src/libs/icon/flat_icon/PathCommandQueue.h b/src/libs/icon/flat_icon/PathCommandQueue.h index 4d899f610c..4b8bc8a33a 100644 --- a/src/libs/icon/flat_icon/PathCommandQueue.h +++ b/src/libs/icon/flat_icon/PathCommandQueue.h @@ -9,13 +9,15 @@ #define PATH_COMMAND_QUEUE_H +#include "IconBuild.h" #include "LittleEndianBuffer.h" + class BPoint; -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE + class VectorPath; @@ -55,7 +57,8 @@ class PathCommandQueue { uint8 fCommandCount; }; -} // namespace Icon -} // namespace BPrivate + +_END_ICON_NAMESPACE + #endif // PATH_COMMAND_QUEUE_H diff --git a/src/libs/icon/message/Defines.cpp b/src/libs/icon/message/Defines.cpp index 8b0d4f2969..702e3c0219 100644 --- a/src/libs/icon/message/Defines.cpp +++ b/src/libs/icon/message/Defines.cpp @@ -5,7 +5,16 @@ * Authors: * Stephan Aßmus */ + + #include "Defines.h" + +_BEGIN_ICON_NAMESPACE + + const uint32 kNativeIconMagicNumber = 'IMSG'; const char* kNativeIconMimeType = "application/x-vnd.Haiku-icon"; + + +_END_ICON_NAMESPACE diff --git a/src/libs/icon/message/Defines.h b/src/libs/icon/message/Defines.h index 8d75a1cebf..fdf1683e54 100644 --- a/src/libs/icon/message/Defines.h +++ b/src/libs/icon/message/Defines.h @@ -8,10 +8,20 @@ #ifndef DEFINES_H #define DEFINES_H + #include +#include "IconBuild.h" + + +_BEGIN_ICON_NAMESPACE + extern const uint32 kNativeIconMagicNumber; extern const char* kNativeIconMimeType; + +_END_ICON_NAMESPACE + + #endif // DEFINES_H diff --git a/src/libs/icon/message/MessageImporter.h b/src/libs/icon/message/MessageImporter.h index 31b9058271..5696740d11 100644 --- a/src/libs/icon/message/MessageImporter.h +++ b/src/libs/icon/message/MessageImporter.h @@ -15,11 +15,15 @@ # include #endif +#include "IconBuild.h" + + class BMessage; class BPositionIO; -namespace BPrivate { -namespace Icon { + +_BEGIN_ICON_NAMESPACE + class Icon; class PathContainer; @@ -50,7 +54,8 @@ class MessageImporter { ShapeContainer* shapes) const; }; -} // namespace Icon -} // namespace BPrivate + +_END_ICON_NAMESPACE + #endif // MESSAGE_IMPORTER_H diff --git a/src/libs/icon/shape/PathContainer.h b/src/libs/icon/shape/PathContainer.h index b1d336e18b..8177e03083 100644 --- a/src/libs/icon/shape/PathContainer.h +++ b/src/libs/icon/shape/PathContainer.h @@ -11,9 +11,11 @@ #include +#include "IconBuild.h" + + +_BEGIN_ICON_NAMESPACE -namespace BPrivate { -namespace Icon { class VectorPath; @@ -67,7 +69,8 @@ class PathContainer { #endif // ICON_O_MATIC }; -} // namespace Icon -} // namespace BPrivate + +_END_ICON_NAMESPACE + #endif // PATH_CONTAINER_H diff --git a/src/libs/icon/shape/Shape.h b/src/libs/icon/shape/Shape.h index eaf735ef6c..8f1e5b15f0 100644 --- a/src/libs/icon/shape/Shape.h +++ b/src/libs/icon/shape/Shape.h @@ -13,6 +13,7 @@ # include "IconObject.h" # include "Observer.h" #endif +#include "IconBuild.h" #include "PathContainer.h" #include "PathSource.h" #include "Transformable.h" @@ -22,8 +23,8 @@ #include -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE + class Style; @@ -46,12 +47,12 @@ class ShapeListener { #ifdef ICON_O_MATIC class Shape : public IconObject, - public BPrivate::Icon::Transformable, + public _ICON_NAMESPACE Transformable, public Observer, // observing all the paths and the style public PathContainerListener, public PathListener { #else -class Shape : public BPrivate::Icon::Transformable { +class Shape : public _ICON_NAMESPACE Transformable { #endif public: @@ -164,7 +165,8 @@ class Shape : public BPrivate::Icon::Transformable { #endif }; -} // namespace Icon -} // namespace BPrivate + +_END_ICON_NAMESPACE + #endif // SHAPE_H diff --git a/src/libs/icon/shape/ShapeContainer.h b/src/libs/icon/shape/ShapeContainer.h index ffb8185ac4..fabdf252a7 100644 --- a/src/libs/icon/shape/ShapeContainer.h +++ b/src/libs/icon/shape/ShapeContainer.h @@ -11,9 +11,11 @@ #include +#include "IconBuild.h" + + +_BEGIN_ICON_NAMESPACE -namespace BPrivate { -namespace Icon { class Shape; @@ -67,7 +69,8 @@ class ShapeContainer { #endif // ICON_O_MATIC }; -} // namespace Icon -} // namespace BPrivate + +_END_ICON_NAMESPACE + #endif // SHAPE_CONTAINER_H diff --git a/src/libs/icon/shape/VectorPath.h b/src/libs/icon/shape/VectorPath.h index e69641353a..7deb160cce 100644 --- a/src/libs/icon/shape/VectorPath.h +++ b/src/libs/icon/shape/VectorPath.h @@ -9,6 +9,7 @@ #define VECTOR_PATH_H +#include "IconBuild.h" #include "Transformable.h" #include @@ -28,8 +29,8 @@ class BMessage; class BView; -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE + struct control_point { BPoint point; // actual point on path @@ -63,7 +64,7 @@ class VectorPath { public: Iterator() {} virtual ~Iterator() {} - + virtual void MoveTo(BPoint point) = 0; virtual void LineTo(BPoint point) = 0; }; @@ -118,7 +119,7 @@ class VectorPath { bool GetPointInAt(int32 index, BPoint& point) const; bool GetPointOutAt(int32 index, BPoint& point) const; bool GetPointsAt(int32 index, - BPoint& point, + BPoint& point, BPoint& pointIn, BPoint& pointOut, bool* connected = NULL) const; @@ -171,7 +172,7 @@ class VectorPath { int32 CountListeners() const; PathListener* ListenerAtFast(int32 index) const; #endif // ICON_O_MATIC - + private: BRect _Bounds() const; @@ -210,7 +211,8 @@ class VectorPath { mutable BRect fCachedBounds; }; -} // namespace Icon -} // namespace BPrivate + +_END_ICON_NAMESPACE + #endif // VECTOR_PATH_H diff --git a/src/libs/icon/style/GradientTransformable.h b/src/libs/icon/style/GradientTransformable.h index 596cc93bcf..dff779f6b9 100644 --- a/src/libs/icon/style/GradientTransformable.h +++ b/src/libs/icon/style/GradientTransformable.h @@ -15,6 +15,7 @@ # include "Observable.h" #endif // ICON_O_MATIC +#include "IconBuild.h" #include "Transformable.h" #include @@ -37,8 +38,9 @@ enum interpolation_type { INTERPOLATION_SMOOTH }; -namespace BPrivate { -namespace Icon { + +_BEGIN_ICON_NAMESPACE + #ifdef ICON_O_MATIC class Gradient : public BArchivable, @@ -115,7 +117,8 @@ class Gradient : public Transformable { bool fInheritTransformation; }; -} // namespace Icon -} // namespace BPrivate + +_END_ICON_NAMESPACE + #endif // GRADIENT_TRANSFORMABLE_H diff --git a/src/libs/icon/style/Style.h b/src/libs/icon/style/Style.h index 177024e98d..26e58bf97f 100644 --- a/src/libs/icon/style/Style.h +++ b/src/libs/icon/style/Style.h @@ -14,6 +14,7 @@ # include "Observer.h" #endif +#include "IconBuild.h" #include "IconRenderer.h" // TODO: put GammaTable into its own file @@ -24,8 +25,9 @@ class BMessage; -namespace BPrivate { -namespace Icon { + +_BEGIN_ICON_NAMESPACE + class Gradient; @@ -62,9 +64,9 @@ class Style { inline rgb_color Color() const { return fColor; } - void SetGradient(const BPrivate::Icon::Gradient* + void SetGradient(const _ICON_NAMESPACE Gradient* gradient); - BPrivate::Icon::Gradient* Gradient() const + _ICON_NAMESPACE Gradient* Gradient() const { return fGradient; } const agg::rgba8* Colors() const @@ -75,7 +77,7 @@ class Style { private: rgb_color fColor; - BPrivate::Icon::Gradient* fGradient; + _ICON_NAMESPACE Gradient* fGradient; // hold gradient color array agg::rgba8* fColors; @@ -85,9 +87,11 @@ class Style { mutable bool fGammaCorrectedColorsValid; }; -} // namespace Icon -} // namespace BPrivate -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + + +_USING_ICON_NAMESPACE + #endif // STYLE_H diff --git a/src/libs/icon/style/StyleContainer.h b/src/libs/icon/style/StyleContainer.h index 3ef2a9163c..ee498063d7 100644 --- a/src/libs/icon/style/StyleContainer.h +++ b/src/libs/icon/style/StyleContainer.h @@ -11,9 +11,11 @@ #include +#include "IconBuild.h" + + +_BEGIN_ICON_NAMESPACE -namespace BPrivate { -namespace Icon { class Style; @@ -66,7 +68,8 @@ class StyleContainer { #endif // ICON_O_MATIC }; -} // namespace Icon -} // namespace BPrivate + +_END_ICON_NAMESPACE + #endif // STYLE_MANAGER_H diff --git a/src/libs/icon/transformable/Transformable.h b/src/libs/icon/transformable/Transformable.h index d916b83db5..aac1740ac5 100644 --- a/src/libs/icon/transformable/Transformable.h +++ b/src/libs/icon/transformable/Transformable.h @@ -13,13 +13,16 @@ #include -namespace BPrivate { -namespace Icon { +#include "IconBuild.h" + + +_BEGIN_ICON_NAMESPACE + class Transformable : public agg::trans_affine { public: enum { - matrix_size = 6, + matrix_size = 6, }; Transformable(); @@ -69,10 +72,12 @@ class Transformable : public agg::trans_affine { // is changed for some reason }; -} // namespace Icon -} // namespace BPrivate -using namespace BPrivate::Icon; +_END_ICON_NAMESPACE + + +_USING_ICON_NAMESPACE + #endif // TRANSFORMABLE_H diff --git a/src/libs/icon/transformer/AffineTransformer.cpp b/src/libs/icon/transformer/AffineTransformer.cpp index e3d73e673f..2b87ce5492 100644 --- a/src/libs/icon/transformer/AffineTransformer.cpp +++ b/src/libs/icon/transformer/AffineTransformer.cpp @@ -20,7 +20,7 @@ #include -using namespace BPrivate::Icon; +_USING_ICON_NAMESPACE using std::nothrow; @@ -179,7 +179,7 @@ AffineTransformer::SetToPropertyObject(const PropertyObject* object) || newScaleY != scaleY) { reset(); - + multiply(agg::trans_affine_scaling(newScaleX, newScaleY)); multiply(agg::trans_affine_rotation(newR)); multiply(agg::trans_affine_translation(newTX, newTY)); diff --git a/src/libs/icon/transformer/AffineTransformer.h b/src/libs/icon/transformer/AffineTransformer.h index 452db3b728..929217e866 100644 --- a/src/libs/icon/transformer/AffineTransformer.h +++ b/src/libs/icon/transformer/AffineTransformer.h @@ -9,14 +9,15 @@ #define AFFINE_TRANSFORMER_H +#include "IconBuild.h" #include "Transformer.h" #include #include -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE + typedef agg::conv_transform Affine; @@ -57,7 +58,8 @@ class AffineTransformer : public Transformer, #endif }; -} // namespace Icon -} // namespace BPrivate + +_END_ICON_NAMESPACE + #endif // AFFINE_TRANSFORMER_H diff --git a/src/libs/icon/transformer/ContourTransformer.cpp b/src/libs/icon/transformer/ContourTransformer.cpp index 1ab7073887..a120e8291f 100644 --- a/src/libs/icon/transformer/ContourTransformer.cpp +++ b/src/libs/icon/transformer/ContourTransformer.cpp @@ -21,7 +21,7 @@ #include -using namespace BPrivate::Icon; +_USING_ICON_NAMESPACE using std::nothrow; diff --git a/src/libs/icon/transformer/ContourTransformer.h b/src/libs/icon/transformer/ContourTransformer.h index 1e756ec5fe..258528988e 100644 --- a/src/libs/icon/transformer/ContourTransformer.h +++ b/src/libs/icon/transformer/ContourTransformer.h @@ -9,13 +9,14 @@ #define CONTOUR_TRANSFORMER_H +#include "IconBuild.h" #include "Transformer.h" #include -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE + typedef agg::conv_contour Contour; @@ -54,7 +55,7 @@ class ContourTransformer : public Transformer, #endif }; -} // namespace Icon -} // namespace BPrivate +_END_ICON_NAMESPACE + #endif // CONTOUR_TRANSFORMER_H diff --git a/src/libs/icon/transformer/PathSource.h b/src/libs/icon/transformer/PathSource.h index 3de12de895..903c568d10 100644 --- a/src/libs/icon/transformer/PathSource.h +++ b/src/libs/icon/transformer/PathSource.h @@ -9,14 +9,15 @@ #define PATH_SOURCE_H +#include "IconBuild.h" #include "Transformer.h" #include "agg_path_storage.h" #include "agg_conv_curve.h" -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE + class PathContainer; class VectorPath; @@ -50,7 +51,8 @@ class PathSource : public VertexSource { double fLastTransformerScale; }; -} // namespace Icon -} // namespace BPrivate + +_END_ICON_NAMESPACE + #endif // PATH_SOURCE_H diff --git a/src/libs/icon/transformer/PerspectiveTransformer.cpp b/src/libs/icon/transformer/PerspectiveTransformer.cpp index 0f4525000a..33600645af 100644 --- a/src/libs/icon/transformer/PerspectiveTransformer.cpp +++ b/src/libs/icon/transformer/PerspectiveTransformer.cpp @@ -15,7 +15,8 @@ #include -using namespace BPrivate::Icon; + +_USING_ICON_NAMESPACE using std::nothrow; diff --git a/src/libs/icon/transformer/PerspectiveTransformer.h b/src/libs/icon/transformer/PerspectiveTransformer.h index 2bddc83ca4..6d2e246bd4 100644 --- a/src/libs/icon/transformer/PerspectiveTransformer.h +++ b/src/libs/icon/transformer/PerspectiveTransformer.h @@ -9,14 +9,15 @@ #define PERSPECTIVE_TRANSFORMER_H +#include "IconBuild.h" #include "Transformer.h" #include #include -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE + typedef agg::conv_transform Perspective; @@ -55,7 +56,8 @@ class PerspectiveTransformer : public Transformer, #endif }; -} // namespace Icon -} // namespace BPrivate + +_END_ICON_NAMESPACE + #endif // PERSPECTIVE_TRANSFORMER_H diff --git a/src/libs/icon/transformer/StrokeTransformer.cpp b/src/libs/icon/transformer/StrokeTransformer.cpp index 6cd818f5d5..25d64a4504 100644 --- a/src/libs/icon/transformer/StrokeTransformer.cpp +++ b/src/libs/icon/transformer/StrokeTransformer.cpp @@ -20,7 +20,8 @@ #include -using namespace BPrivate::Icon; + +_USING_ICON_NAMESPACE using std::nothrow; diff --git a/src/libs/icon/transformer/StrokeTransformer.h b/src/libs/icon/transformer/StrokeTransformer.h index b1b47dc4e5..011d0cc305 100644 --- a/src/libs/icon/transformer/StrokeTransformer.h +++ b/src/libs/icon/transformer/StrokeTransformer.h @@ -9,13 +9,14 @@ #define STROKE_TRANSFORMER_H +#include "IconBuild.h" #include "Transformer.h" #include -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE + typedef agg::conv_stroke Stroke; @@ -56,7 +57,8 @@ class StrokeTransformer : public Transformer, #endif }; -} // namespace Icon -} // namespace BPrivate + +_END_ICON_NAMESPACE + #endif // STROKE_TRANSFORMER_H diff --git a/src/libs/icon/transformer/Transformer.cpp b/src/libs/icon/transformer/Transformer.cpp index 85230f23f3..d9098c8c0e 100644 --- a/src/libs/icon/transformer/Transformer.cpp +++ b/src/libs/icon/transformer/Transformer.cpp @@ -10,7 +10,7 @@ #include "Transformer.h" -using namespace BPrivate::Icon; +_USING_ICON_NAMESPACE // constructor diff --git a/src/libs/icon/transformer/Transformer.h b/src/libs/icon/transformer/Transformer.h index ddc11ded40..b67c1b8fcc 100644 --- a/src/libs/icon/transformer/Transformer.h +++ b/src/libs/icon/transformer/Transformer.h @@ -16,9 +16,11 @@ # include #endif +#include "IconBuild.h" + + +_BEGIN_ICON_NAMESPACE -namespace BPrivate { -namespace Icon { class VertexSource { public: @@ -62,7 +64,8 @@ class Transformer : public VertexSource { VertexSource& fSource; }; -} // namespace Icon -} // namespace BPrivate + +_END_ICON_NAMESPACE + #endif // TRANSFORMER_H diff --git a/src/libs/icon/transformer/TransformerFactory.cpp b/src/libs/icon/transformer/TransformerFactory.cpp index f531c38eaf..3dfc83d0d9 100644 --- a/src/libs/icon/transformer/TransformerFactory.cpp +++ b/src/libs/icon/transformer/TransformerFactory.cpp @@ -17,7 +17,8 @@ # include #endif -using namespace BPrivate::Icon; + +_USING_ICON_NAMESPACE // TransformerFor diff --git a/src/libs/icon/transformer/TransformerFactory.h b/src/libs/icon/transformer/TransformerFactory.h index f0ade510ba..087f541acc 100644 --- a/src/libs/icon/transformer/TransformerFactory.h +++ b/src/libs/icon/transformer/TransformerFactory.h @@ -11,18 +11,21 @@ #include +#include "IconBuild.h" + + class BMessage; -namespace BPrivate { -namespace Icon { +_BEGIN_ICON_NAMESPACE + class Transformer; class VertexSource; class TransformerFactory { public: - + static Transformer* TransformerFor(uint32 type, VertexSource& source); @@ -37,7 +40,8 @@ class TransformerFactory { #endif // ICON_O_MATIC }; -} // namespace Icon -} // namespace BPrivate + +_END_ICON_NAMESPACE + #endif // TRANSFORMER_FACTORY_H diff --git a/src/preferences/locale/FormatSettingsView.cpp b/src/preferences/locale/FormatSettingsView.cpp index 9fff7efc2a..9470a980b4 100644 --- a/src/preferences/locale/FormatSettingsView.cpp +++ b/src/preferences/locale/FormatSettingsView.cpp @@ -38,7 +38,7 @@ #include "LocalePreflet.h" -using BPrivate::gMutableLocaleRoster; +using BPrivate::MutableLocaleRoster; #undef B_TRANSLATE_CONTEXT @@ -261,10 +261,11 @@ FormatSettingsView::MessageReceived(BMessage* message) case kClockFormatChange: { BFormattingConventions conventions; - be_locale->GetFormattingConventions(&conventions); + BLocale::Default()->GetFormattingConventions(&conventions); conventions.SetExplicitUse24HourClock( f24HourRadioButton->Value() ? true : false); - gMutableLocaleRoster->SetDefaultFormattingConventions(conventions); + MutableLocaleRoster::Default()->SetDefaultFormattingConventions( + conventions); _UpdateExamples(); Window()->PostMessage(kMsgSettingsChanged); @@ -274,10 +275,11 @@ FormatSettingsView::MessageReceived(BMessage* message) case kStringsLanguageChange: { BFormattingConventions conventions; - be_locale->GetFormattingConventions(&conventions); + BLocale::Default()->GetFormattingConventions(&conventions); conventions.SetUseStringsFromPreferredLanguage( fUseLanguageStringsCheckBox->Value() ? true : false); - gMutableLocaleRoster->SetDefaultFormattingConventions(conventions); + MutableLocaleRoster::Default()->SetDefaultFormattingConventions( + conventions); _UpdateExamples(); @@ -294,7 +296,8 @@ FormatSettingsView::MessageReceived(BMessage* message) void FormatSettingsView::Revert() { - gMutableLocaleRoster->SetDefaultFormattingConventions(fInitialConventions); + MutableLocaleRoster::Default()->SetDefaultFormattingConventions( + fInitialConventions); _UpdateExamples(); } @@ -304,7 +307,7 @@ void FormatSettingsView::Refresh(bool setInitial) { BFormattingConventions conventions; - be_locale->GetFormattingConventions(&conventions); + BLocale::Default()->GetFormattingConventions(&conventions); if (setInitial) fInitialConventions = conventions; @@ -330,7 +333,7 @@ bool FormatSettingsView::IsReversible() const { BFormattingConventions conventions; - be_locale->GetFormattingConventions(&conventions); + BLocale::Default()->GetFormattingConventions(&conventions); return conventions != fInitialConventions; } @@ -342,49 +345,49 @@ FormatSettingsView::_UpdateExamples() time_t timeValue = (time_t)time(NULL); BString result; - be_locale->FormatDate(&result, timeValue, B_FULL_DATE_FORMAT); + BLocale::Default()->FormatDate(&result, timeValue, B_FULL_DATE_FORMAT); fFullDateExampleView->SetText(result); - be_locale->FormatDate(&result, timeValue, B_LONG_DATE_FORMAT); + BLocale::Default()->FormatDate(&result, timeValue, B_LONG_DATE_FORMAT); fLongDateExampleView->SetText(result); - be_locale->FormatDate(&result, timeValue, B_MEDIUM_DATE_FORMAT); + BLocale::Default()->FormatDate(&result, timeValue, B_MEDIUM_DATE_FORMAT); fMediumDateExampleView->SetText(result); - be_locale->FormatDate(&result, timeValue, B_SHORT_DATE_FORMAT); + BLocale::Default()->FormatDate(&result, timeValue, B_SHORT_DATE_FORMAT); fShortDateExampleView->SetText(result); - be_locale->FormatTime(&result, timeValue, B_FULL_TIME_FORMAT); + BLocale::Default()->FormatTime(&result, timeValue, B_FULL_TIME_FORMAT); fFullTimeExampleView->SetText(result); - be_locale->FormatTime(&result, timeValue, B_LONG_TIME_FORMAT); + BLocale::Default()->FormatTime(&result, timeValue, B_LONG_TIME_FORMAT); fLongTimeExampleView->SetText(result); - be_locale->FormatTime(&result, timeValue, B_MEDIUM_TIME_FORMAT); + BLocale::Default()->FormatTime(&result, timeValue, B_MEDIUM_TIME_FORMAT); fMediumTimeExampleView->SetText(result); - be_locale->FormatTime(&result, timeValue, B_SHORT_TIME_FORMAT); + BLocale::Default()->FormatTime(&result, timeValue, B_SHORT_TIME_FORMAT); fShortTimeExampleView->SetText(result); - status_t status = be_locale->FormatNumber(&result, 1234.5678); + status_t status = BLocale::Default()->FormatNumber(&result, 1234.5678); if (status == B_OK) fPositiveNumberExampleView->SetText(result); else fPositiveNumberExampleView->SetText("ERROR"); - status = be_locale->FormatNumber(&result, -1234.5678); + status = BLocale::Default()->FormatNumber(&result, -1234.5678); if (status == B_OK) fNegativeNumberExampleView->SetText(result); else fNegativeNumberExampleView->SetText("ERROR"); - status = be_locale->FormatMonetary(&result, 1234.56); + status = BLocale::Default()->FormatMonetary(&result, 1234.56); if (status == B_OK) fPositiveMonetaryExampleView->SetText(result); else fPositiveMonetaryExampleView->SetText("ERROR"); - status = be_locale->FormatMonetary(&result, -1234.56); + status = BLocale::Default()->FormatMonetary(&result, -1234.56); if (status == B_OK) fNegativeMonetaryExampleView->SetText(result); else diff --git a/src/preferences/locale/LanguageListView.cpp b/src/preferences/locale/LanguageListView.cpp index edc8b32440..a15b86f6e3 100644 --- a/src/preferences/locale/LanguageListView.cpp +++ b/src/preferences/locale/LanguageListView.cpp @@ -40,7 +40,7 @@ LanguageListItem::LanguageListItem(const char* text, const char* id, fCode(code) { fIcon = new(std::nothrow) BBitmap(BRect(0, 0, 15, 15), B_RGBA32); - if (fIcon != NULL && be_locale_roster->GetFlagIconForCountry(fIcon, + if (fIcon != NULL && BLocaleRoster::Default()->GetFlagIconForCountry(fIcon, countryCode) != B_OK) { delete fIcon; fIcon = NULL; diff --git a/src/preferences/locale/LocaleWindow.cpp b/src/preferences/locale/LocaleWindow.cpp index 5ba2200f3e..58864514c4 100644 --- a/src/preferences/locale/LocaleWindow.cpp +++ b/src/preferences/locale/LocaleWindow.cpp @@ -30,7 +30,7 @@ #include "LanguageListView.h" -using BPrivate::gMutableLocaleRoster; +using BPrivate::MutableLocaleRoster; #undef B_TRANSLATE_CONTEXT @@ -92,7 +92,8 @@ LocaleWindow::LocaleWindow() // Fill the language list from the LocaleRoster data BMessage availableLanguages; - if (be_locale_roster->GetAvailableLanguages(&availableLanguages) == B_OK) { + if (BLocaleRoster::Default()->GetAvailableLanguages(&availableLanguages) + == B_OK) { BString currentID; LanguageListItem* lastAddedCountryItem = NULL; @@ -178,7 +179,7 @@ LocaleWindow::LocaleWindow() // get all available formatting conventions (by language) BFormattingConventions defaultConventions; - be_locale->GetFormattingConventions(&defaultConventions); + BLocale::Default()->GetFormattingConventions(&defaultConventions); BString conventionID; fInitialConventionsItem = NULL; LanguageListItem* lastAddedConventionsItem = NULL; @@ -387,7 +388,8 @@ LocaleWindow::MessageReceived(BMessage* message) break; BFormattingConventions conventions(item->ID()); - gMutableLocaleRoster->SetDefaultFormattingConventions(conventions); + MutableLocaleRoster::Default()->SetDefaultFormattingConventions( + conventions); _SettingsChanged(); fFormatView->Refresh(); @@ -440,7 +442,7 @@ bool LocaleWindow::_IsReversible() const { BMessage preferredLanguages; - be_locale_roster->GetPreferredLanguages(&preferredLanguages); + BLocaleRoster::Default()->GetPreferredLanguages(&preferredLanguages); return !preferredLanguages.HasSameData(fInitialPreferredLanguages); } @@ -459,7 +461,7 @@ LocaleWindow::_PreferredLanguagesChanged() preferredLanguages.AddString("language", item->ID()); index++; } - gMutableLocaleRoster->SetPreferredLanguages(&preferredLanguages); + MutableLocaleRoster::Default()->SetPreferredLanguages(&preferredLanguages); _EnableDisableLanguages(); } @@ -495,7 +497,7 @@ void LocaleWindow::_Refresh(bool setInitial) { BMessage preferredLanguages; - be_locale_roster->GetPreferredLanguages(&preferredLanguages); + BLocaleRoster::Default()->GetPreferredLanguages(&preferredLanguages); if (setInitial) fInitialPreferredLanguages = preferredLanguages; @@ -574,11 +576,12 @@ LocaleWindow::_Defaults() { BMessage preferredLanguages; preferredLanguages.AddString("language", "en"); - gMutableLocaleRoster->SetPreferredLanguages(&preferredLanguages); + MutableLocaleRoster::Default()->SetPreferredLanguages(&preferredLanguages); _SetPreferredLanguages(preferredLanguages); BFormattingConventions conventions("en_US"); - gMutableLocaleRoster->SetDefaultFormattingConventions(conventions); + MutableLocaleRoster::Default()->SetDefaultFormattingConventions( + conventions); fConventionsListView->DeselectAll(); if (fDefaultConventionsItem != NULL) { diff --git a/src/preferences/time/DateTimeEdit.cpp b/src/preferences/time/DateTimeEdit.cpp index f6fe301a3e..134491aa61 100644 --- a/src/preferences/time/DateTimeEdit.cpp +++ b/src/preferences/time/DateTimeEdit.cpp @@ -277,9 +277,10 @@ void TTimeEdit::_UpdateFields() { time_t time = fTime.Time_t(); - be_locale->FormatTime(&fText, fFieldPositions, fFieldPosCount, time, + BLocale::Default()->FormatTime(&fText, fFieldPositions, fFieldPosCount, + time, B_MEDIUM_TIME_FORMAT); + BLocale::Default()->GetTimeFields(fFields, fFieldCount, B_MEDIUM_TIME_FORMAT); - be_locale->GetTimeFields(fFields, fFieldCount, B_MEDIUM_TIME_FORMAT); } @@ -676,9 +677,10 @@ void TDateEdit::_UpdateFields() { time_t time = BDateTime(fDate, BTime()).Time_t(); - be_locale->FormatDate(&fText, fFieldPositions, fFieldPosCount, time, + BLocale::Default()->FormatDate(&fText, fFieldPositions, fFieldPosCount, + time, B_SHORT_DATE_FORMAT); + BLocale::Default()->GetDateFields(fFields, fFieldCount, B_SHORT_DATE_FORMAT); - be_locale->GetDateFields(fFields, fFieldCount, B_SHORT_DATE_FORMAT); } diff --git a/src/preferences/time/ZoneView.cpp b/src/preferences/time/ZoneView.cpp index 3ba73abc7d..3cc32f33cc 100644 --- a/src/preferences/time/ZoneView.cpp +++ b/src/preferences/time/ZoneView.cpp @@ -51,7 +51,7 @@ #include "TimeWindow.h" -using BPrivate::gMutableLocaleRoster; +using BPrivate::MutableLocaleRoster; using BPrivate::ObjectDeleter; @@ -184,11 +184,11 @@ TimeZoneView::GetToolTipAt(BPoint point, BToolTip** _tip) BString nowInTimeZone; time_t now = time(NULL); - be_locale->FormatTime(&nowInTimeZone, now, B_SHORT_TIME_FORMAT, + BLocale::Default()->FormatTime(&nowInTimeZone, now, B_SHORT_TIME_FORMAT, &item->TimeZone()); BString dateInTimeZone; - be_locale->FormatDate(&dateInTimeZone, now, B_SHORT_DATE_FORMAT, + BLocale::Default()->FormatDate(&dateInTimeZone, now, B_SHORT_DATE_FORMAT, &item->TimeZone()); BString toolTip = item->Text(); @@ -276,13 +276,13 @@ void TimeZoneView::_BuildZoneMenu() { BTimeZone defaultTimeZone; - be_locale_roster->GetDefaultTimeZone(&defaultTimeZone); + BLocaleRoster::Default()->GetDefaultTimeZone(&defaultTimeZone); BLanguage language; - be_locale->GetLanguage(&language); + BLocale::Default()->GetLanguage(&language); BMessage countryList; - be_locale_roster->GetAvailableCountries(&countryList); + BLocaleRoster::Default()->GetAvailableCountries(&countryList); countryList.AddString("country", ""); /* @@ -308,7 +308,7 @@ TimeZoneView::_BuildZoneMenu() // Now list the timezones for this country BMessage zoneList; - be_locale_roster->GetAvailableTimeZonesForCountry(&zoneList, + BLocaleRoster::Default()->GetAvailableTimeZonesForCountry(&zoneList, countryCode.Length() == 0 ? NULL : countryCode.String()); int32 count = 0; @@ -508,7 +508,7 @@ TimeZoneView::_SetSystemTimeZone() fCurrentZoneItem = item; const BTimeZone& timeZone = item->TimeZone(); - gMutableLocaleRoster->SetDefaultTimeZone(timeZone); + MutableLocaleRoster::Default()->SetDefaultTimeZone(timeZone); _kern_set_timezone(timeZone.OffsetFromGMT(), timeZone.ID().String(), timeZone.ID().Length()); @@ -534,7 +534,8 @@ TimeZoneView::_FormatTime(const BTimeZone& timeZone) : 0; now -= timeZone.OffsetFromGMT() - currentOffset; } - be_locale->FormatTime(&result, now, B_SHORT_TIME_FORMAT, &timeZone); + BLocale::Default()->FormatTime(&result, now, B_SHORT_TIME_FORMAT, + &timeZone); return result; } diff --git a/src/system/glue/arch/m68k/crti.S b/src/system/glue/arch/m68k/crti.S index 1968449d12..27e4ea9654 100644 --- a/src/system/glue/arch/m68k/crti.S +++ b/src/system/glue/arch/m68k/crti.S @@ -21,10 +21,10 @@ .section .init FUNCTION(_init): - jsr _init_before + jsr __haiku_init_before // crtbegin.o stuff comes here .section .fini FUNCTION(_fini): - jsr _term_before + jsr __haiku_term_before // crtbegin.o stuff comes here diff --git a/src/system/glue/arch/mipsel/crti.S b/src/system/glue/arch/mipsel/crti.S index a52b33dc5b..c53a2782a6 100644 --- a/src/system/glue/arch/mipsel/crti.S +++ b/src/system/glue/arch/mipsel/crti.S @@ -28,7 +28,7 @@ .section .init FUNCTION(_init): .set noreorder - jal _init_before + jal __haiku_init_before nop .set reorder // crtbegin.o stuff comes here @@ -36,7 +36,7 @@ FUNCTION(_init): .section .fini FUNCTION(_fini): .set noreorder - jal _term_before + jal __haiku_term_before nop .set reorder // crtbegin.o stuff comes here diff --git a/src/system/glue/arch/mipsel/crtn.S b/src/system/glue/arch/mipsel/crtn.S index 754632262e..5f099be540 100644 --- a/src/system/glue/arch/mipsel/crtn.S +++ b/src/system/glue/arch/mipsel/crtn.S @@ -17,13 +17,13 @@ .section .init // the image ID and program args are still on the stack .set noreorder - jal _init_after + jal __haiku_init_after nop .set reorder .section .fini // the image ID and program args are still on the stack - .set noreorder - jal _term_after + .set noreorder + jal __haiku_term_after nop .set reorder diff --git a/src/system/glue/arch/ppc/crti.S b/src/system/glue/arch/ppc/crti.S index e463c4dc8c..ce318b5788 100644 --- a/src/system/glue/arch/ppc/crti.S +++ b/src/system/glue/arch/ppc/crti.S @@ -21,10 +21,10 @@ .section .init FUNCTION(_init): - bl _init_before + bl __haiku_init_before // crtbegin.o stuff comes here .section .fini FUNCTION(_fini): - bl _term_before + bl __haiku_term_before // crtbegin.o stuff comes here diff --git a/src/system/glue/arch/ppc/crtn.S b/src/system/glue/arch/ppc/crtn.S index c00a1c0f37..b9666c9b02 100644 --- a/src/system/glue/arch/ppc/crtn.S +++ b/src/system/glue/arch/ppc/crtn.S @@ -10,10 +10,10 @@ .section .init // the image ID and program args are still on the stack - bl _init_after + bl __haiku_init_after blr .section .fini // the image ID and program args are still on the stack - bl _term_after + bl __haiku_term_after blr diff --git a/src/system/glue/arch/x86/crti.S b/src/system/glue/arch/x86/crti.S index 553b7881ab..d9571d3533 100644 --- a/src/system/glue/arch/x86/crti.S +++ b/src/system/glue/arch/x86/crti.S @@ -24,7 +24,7 @@ FUNCTION(_init): pushl %ebp movl %esp, %ebp pushl 8(%ebp) // put image ID on the stack again - call _init_before + call __haiku_init_before // crtbegin.o stuff comes here .section .fini @@ -32,5 +32,5 @@ FUNCTION(_fini): pushl %ebp movl %esp, %ebp pushl 8(%ebp) - call _term_before + call __haiku_term_before // crtend.o stuff comes here diff --git a/src/system/glue/arch/x86/crtn.S b/src/system/glue/arch/x86/crtn.S index b6b25d791c..f898161818 100644 --- a/src/system/glue/arch/x86/crtn.S +++ b/src/system/glue/arch/x86/crtn.S @@ -10,14 +10,14 @@ .section .init // the image ID is still on the stack - call _init_after + call __haiku_init_after movl %ebp, %esp popl %ebp ret .section .fini // the image ID is still on the stack - call _term_after + call __haiku_term_after movl %ebp, %esp popl %ebp ret diff --git a/src/system/glue/init_term_dyn.c b/src/system/glue/init_term_dyn.c index d395a4176a..707b2e41a3 100644 --- a/src/system/glue/init_term_dyn.c +++ b/src/system/glue/init_term_dyn.c @@ -3,6 +3,7 @@ * Distributed under the terms of the MIT License. */ + #include #include @@ -13,50 +14,68 @@ #include "haiku_version_glue.c" -/** These functions are called from _init()/_fini() (in crti.S, crtn.S) - * _init/_term_before() is called before crtbegin/end code is executed, - * _init/_term_after() after this. - * crtbegin contains code to initialize all global constructors and - * other GCC related things (like exception frames). +/*! These functions are called from _init()/_fini() (in crti.S, crtn.S) + __haiku_{init,term}_before() is called before crtbegin/end code is + executed, __haiku_{init,term}_after() after this. crtbegin contains + code to initialize all global constructors and other GCC related things + (like exception frames). */ +#define HIDDEN_FUNCTION(function) asm volatile(".hidden " #function) + + void -_init_before(image_id id) +__haiku_init_before(image_id id) { void (*before)(image_id); - if (get_image_symbol(id, B_INIT_BEFORE_FUNCTION_NAME, B_SYMBOL_TYPE_TEXT, (void **)&before) == B_OK) + HIDDEN_FUNCTION(__haiku_init_before); + + if (get_image_symbol(id, B_INIT_BEFORE_FUNCTION_NAME, B_SYMBOL_TYPE_TEXT, + (void**)&before) == B_OK) { before(id); + } } void -_init_after(image_id id) +__haiku_init_after(image_id id) { void (*after)(image_id); - if (get_image_symbol(id, B_INIT_AFTER_FUNCTION_NAME, B_SYMBOL_TYPE_TEXT, (void **)&after) == B_OK) + HIDDEN_FUNCTION(__haiku_init_after); + + if (get_image_symbol(id, B_INIT_AFTER_FUNCTION_NAME, B_SYMBOL_TYPE_TEXT, + (void**)&after) == B_OK) { after(id); + } } void -_term_before(image_id id) +__haiku_term_before(image_id id) { void (*before)(image_id); - if (get_image_symbol(id, B_TERM_BEFORE_FUNCTION_NAME, B_SYMBOL_TYPE_TEXT, (void **)&before) == B_OK) + HIDDEN_FUNCTION(__haiku_term_before); + + if (get_image_symbol(id, B_TERM_BEFORE_FUNCTION_NAME, B_SYMBOL_TYPE_TEXT, + (void**)&before) == B_OK) { before(id); + } } void -_term_after(image_id id) +__haiku_term_after(image_id id) { void (*after)(image_id); - if (get_image_symbol(id, B_TERM_AFTER_FUNCTION_NAME, B_SYMBOL_TYPE_TEXT, (void **)&after) == B_OK) - after(id); -} + HIDDEN_FUNCTION(__haiku_term_after); + if (get_image_symbol(id, B_TERM_AFTER_FUNCTION_NAME, B_SYMBOL_TYPE_TEXT, + (void**)&after) == B_OK) { + after(id); + } +} diff --git a/src/system/glue/init_term_dyn.h b/src/system/glue/init_term_dyn.h index 3b45abef9f..e35ae8c811 100644 --- a/src/system/glue/init_term_dyn.h +++ b/src/system/glue/init_term_dyn.h @@ -9,9 +9,10 @@ #include -void _init_before(image_id id); -void _init_after(image_id id); -void _term_before(image_id id); -void _term_after(image_id id); +void __haiku_init_before(image_id id); +void __haiku_init_after(image_id id); +void __haiku_term_before(image_id id); +void __haiku_term_after(image_id id); + #endif /* INIT_TERM_DYN_H */ diff --git a/src/system/kernel/device_manager/AbstractModuleDevice.h b/src/system/kernel/device_manager/AbstractModuleDevice.h index 7da1a1fb5a..3e6a833a53 100644 --- a/src/system/kernel/device_manager/AbstractModuleDevice.h +++ b/src/system/kernel/device_manager/AbstractModuleDevice.h @@ -1,5 +1,5 @@ /* - * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2009-2010, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2008-2009, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. */ @@ -10,6 +10,9 @@ #include "BaseDevice.h" +namespace BPrivate { + + class AbstractModuleDevice : public BaseDevice { public: AbstractModuleDevice(); @@ -50,4 +53,10 @@ protected: }; +} // namespace BPrivate + + +using BPrivate::AbstractModuleDevice; + + #endif // ABSTRACT_MODULE_DEVICE_H diff --git a/src/system/kernel/device_manager/BaseDevice.h b/src/system/kernel/device_manager/BaseDevice.h index e4c5f146a5..bd35351300 100644 --- a/src/system/kernel/device_manager/BaseDevice.h +++ b/src/system/kernel/device_manager/BaseDevice.h @@ -9,6 +9,9 @@ #include +namespace BPrivate { + + class BaseDevice { public: BaseDevice(); @@ -49,4 +52,10 @@ protected: }; +} // namespace BPrivate + + +using BPrivate::BaseDevice; + + #endif // BASE_DEVICE_H diff --git a/src/system/kernel/device_manager/FileDevice.h b/src/system/kernel/device_manager/FileDevice.h index c49858fa8c..abc0d440bc 100644 --- a/src/system/kernel/device_manager/FileDevice.h +++ b/src/system/kernel/device_manager/FileDevice.h @@ -9,6 +9,9 @@ #include "BaseDevice.h" +namespace BPrivate { + + class FileDevice : public BaseDevice { public: FileDevice(); @@ -52,4 +55,10 @@ private: }; +} // namespace BPrivate + + +using BPrivate::FileDevice; + + #endif // FILE_DEVICE_H diff --git a/src/system/kernel/device_manager/devfs_private.h b/src/system/kernel/device_manager/devfs_private.h index beeca381e9..dc0ea9196a 100644 --- a/src/system/kernel/device_manager/devfs_private.h +++ b/src/system/kernel/device_manager/devfs_private.h @@ -9,7 +9,12 @@ #include -class BaseDevice; +namespace BPrivate { + class BaseDevice; +} + +using BPrivate::BaseDevice; + status_t devfs_publish_device(const char* path, BaseDevice* device); status_t devfs_unpublish_device(BaseDevice* device, bool disconnect); diff --git a/src/system/kernel/device_manager/device_manager.cpp b/src/system/kernel/device_manager/device_manager.cpp index d2436d8e54..93f811505c 100644 --- a/src/system/kernel/device_manager/device_manager.cpp +++ b/src/system/kernel/device_manager/device_manager.cpp @@ -72,6 +72,10 @@ typedef struct io_resource_info { io_resource resource; // info about actual resource } io_resource_info; + +namespace { + + class Device : public AbstractModuleDevice, public DoublyLinkedListLinkImpl { public: @@ -95,6 +99,10 @@ private: bool fRemovedFromParent; }; + +} // unnamed namespace + + typedef DoublyLinkedList DeviceList; typedef DoublyLinkedList NodeList; diff --git a/src/system/kernel/elf.cpp b/src/system/kernel/elf.cpp index a50c79b950..ddd7099062 100644 --- a/src/system/kernel/elf.cpp +++ b/src/system/kernel/elf.cpp @@ -901,6 +901,7 @@ init_image_version_infos(elf_image_info* image) elf_version_info& info = image->versions[versionIndex]; info.hash = definition->vd_hash; info.name = STRING(image, verdaux->vda_name); + info.file_name = NULL; } definition = (Elf32_Verdef*) @@ -972,68 +973,62 @@ status_t elf_resolve_symbol(struct elf_image_info *image, struct Elf32_Sym *symbol, struct elf_image_info *sharedImage, addr_t *_symbolAddress) { - switch (symbol->st_shndx) { - case SHN_UNDEF: - { - struct Elf32_Sym *newSymbol; - const char *symbolName = SYMNAME(image, symbol); + // Local symbols references are always resolved to the given symbol. + if (ELF32_ST_BIND(symbol->st_info) == STB_LOCAL) { + *_symbolAddress = symbol->st_value + image->text_region.delta; + return B_OK; + } - // get the version info - const elf_version_info* versionInfo = NULL; - if (image->symbol_versions != NULL) { - uint32 index = symbol - image->syms; - uint32 versionIndex = VER_NDX(image->symbol_versions[index]); - if (versionIndex >= VER_NDX_INITIAL) - versionInfo = image->versions + versionIndex; - } + // Non-local symbols we try to resolve to the kernel image first. + const char *symbolName = SYMNAME(image, symbol); - // it's undefined, must be outside this image, try the other image - newSymbol = elf_find_symbol(sharedImage, symbolName, versionInfo, - false); - if (newSymbol == NULL) { - // Weak undefined symbols get a value of 0, if unresolved. - if (ELF32_ST_BIND(symbol->st_info) == STB_WEAK) { - *_symbolAddress = 0; - return B_OK; - } + // get the version info + const elf_version_info* versionInfo = NULL; + if (image->symbol_versions != NULL) { + uint32 index = symbol - image->syms; + uint32 versionIndex = VER_NDX(image->symbol_versions[index]); + if (versionIndex >= VER_NDX_INITIAL) + versionInfo = image->versions + versionIndex; + } - dprintf("\"%s\": could not resolve symbol '%s'\n", - image->name, symbolName); - return B_MISSING_SYMBOL; - } + // find the symbol + elf_image_info* foundImage = sharedImage; + struct Elf32_Sym* foundSymbol = elf_find_symbol(sharedImage, symbolName, + versionInfo, false); + if (foundSymbol == NULL) { + // not found yet, try to resolve in the requesting image + foundImage = image; + foundSymbol = elf_find_symbol(image, symbolName, versionInfo, false); + } - // make sure they're the same type - if (ELF32_ST_TYPE(symbol->st_info) - != ELF32_ST_TYPE(newSymbol->st_info)) { - dprintf("elf_resolve_symbol: found symbol '%s' in shared image " - "but wrong type\n", symbolName); - return B_MISSING_SYMBOL; - } - - if (ELF32_ST_BIND(newSymbol->st_info) != STB_GLOBAL - && ELF32_ST_BIND(newSymbol->st_info) != STB_WEAK) { - TRACE(("elf_resolve_symbol: found symbol '%s' but not " - "exported\n", symbolName)); - return B_MISSING_SYMBOL; - } - - *_symbolAddress = newSymbol->st_value - + sharedImage->text_region.delta; + if (foundSymbol == NULL) { + // Weak undefined symbols get a value of 0, if unresolved. + if (ELF32_ST_BIND(symbol->st_info) == STB_WEAK) { + *_symbolAddress = 0; return B_OK; } - case SHN_ABS: - *_symbolAddress = symbol->st_value; - return B_OK; - case SHN_COMMON: - // ToDo: finish this - TRACE(("elf_resolve_symbol: COMMON symbol, finish me!\n")); - return B_ERROR; - default: - // standard symbol - *_symbolAddress = symbol->st_value + image->text_region.delta; - return B_OK; + dprintf("\"%s\": could not resolve symbol '%s'\n", image->name, + symbolName); + return B_MISSING_SYMBOL; } + + // make sure they're the same type + if (ELF32_ST_TYPE(symbol->st_info) != ELF32_ST_TYPE(foundSymbol->st_info)) { + dprintf("elf_resolve_symbol: found symbol '%s' in shared image " + "but wrong type\n", symbolName); + return B_MISSING_SYMBOL; + } + + if (ELF32_ST_BIND(foundSymbol->st_info) != STB_GLOBAL + && ELF32_ST_BIND(foundSymbol->st_info) != STB_WEAK) { + TRACE(("elf_resolve_symbol: found symbol '%s' but not exported\n", + symbolName)); + return B_MISSING_SYMBOL; + } + + *_symbolAddress = foundSymbol->st_value + foundImage->text_region.delta; + return B_OK; } @@ -1043,7 +1038,7 @@ elf_relocate(struct elf_image_info *image) { int status = B_NO_ERROR; - TRACE(("top of elf_relocate\n")); + TRACE(("elf_relocate(%p (\"%s\"))\n", image, image->name)); // deal with the rels first if (image->rel) { diff --git a/src/system/libroot/add-ons/icu/ICUCategoryData.cpp b/src/system/libroot/add-ons/icu/ICUCategoryData.cpp index 11c626750e..359f30bf60 100644 --- a/src/system/libroot/add-ons/icu/ICUCategoryData.cpp +++ b/src/system/libroot/add-ons/icu/ICUCategoryData.cpp @@ -12,6 +12,7 @@ namespace BPrivate { +namespace Libroot { ICUCategoryData::ICUCategoryData() @@ -130,4 +131,5 @@ ICUCategoryData::_ConvertUnicodeStringToLocaleconvEntry( } +} // namespace Libroot } // namespace BPrivate diff --git a/src/system/libroot/add-ons/icu/ICUCollateData.cpp b/src/system/libroot/add-ons/icu/ICUCollateData.cpp index 7789e9b64e..c394886309 100644 --- a/src/system/libroot/add-ons/icu/ICUCollateData.cpp +++ b/src/system/libroot/add-ons/icu/ICUCollateData.cpp @@ -12,6 +12,7 @@ namespace BPrivate { +namespace Libroot { ICUCollateData::ICUCollateData() @@ -173,4 +174,5 @@ ICUCollateData::_ToUnicodeString(const char* in, UnicodeString& out) } +} // namespace Libroot } // namespace BPrivate diff --git a/src/system/libroot/add-ons/icu/ICUCtypeData.cpp b/src/system/libroot/add-ons/icu/ICUCtypeData.cpp index 2aa6dd15b9..4e6860532e 100644 --- a/src/system/libroot/add-ons/icu/ICUCtypeData.cpp +++ b/src/system/libroot/add-ons/icu/ICUCtypeData.cpp @@ -13,6 +13,7 @@ namespace BPrivate { +namespace Libroot { ICUCtypeData::ICUCtypeData() @@ -192,4 +193,5 @@ ICUCtypeData::GetLanginfo(int index) } +} // namespace Libroot } // namespace BPrivate diff --git a/src/system/libroot/add-ons/icu/ICULocaleBackend.cpp b/src/system/libroot/add-ons/icu/ICULocaleBackend.cpp index b4bed3f4b7..52bff29e62 100644 --- a/src/system/libroot/add-ons/icu/ICULocaleBackend.cpp +++ b/src/system/libroot/add-ons/icu/ICULocaleBackend.cpp @@ -16,6 +16,7 @@ namespace BPrivate { +namespace Libroot { extern "C" LocaleBackend* @@ -370,4 +371,5 @@ ICULocaleBackend::_SetPosixLocale(int category) } +} // namespace Libroot } // namespace BPrivate diff --git a/src/system/libroot/add-ons/icu/ICULocaleconvData.cpp b/src/system/libroot/add-ons/icu/ICULocaleconvData.cpp index 5bfb2c153e..f59272ea55 100644 --- a/src/system/libroot/add-ons/icu/ICULocaleconvData.cpp +++ b/src/system/libroot/add-ons/icu/ICULocaleconvData.cpp @@ -10,6 +10,7 @@ namespace BPrivate { +namespace Libroot { status_t @@ -29,4 +30,5 @@ ICULocaleconvData::_SetLocaleconvEntry(const DecimalFormatSymbols* formatSymbols } +} // namespace Libroot } // namespace BPrivate diff --git a/src/system/libroot/add-ons/icu/ICUMessagesData.cpp b/src/system/libroot/add-ons/icu/ICUMessagesData.cpp index b1aacd1b60..dafcfe4abf 100644 --- a/src/system/libroot/add-ons/icu/ICUMessagesData.cpp +++ b/src/system/libroot/add-ons/icu/ICUMessagesData.cpp @@ -11,6 +11,7 @@ namespace BPrivate { +namespace Libroot { void @@ -57,4 +58,5 @@ ICUMessagesData::GetLanginfo(int index) } +} // namespace Libroot } // namespace BPrivate diff --git a/src/system/libroot/add-ons/icu/ICUMonetaryData.cpp b/src/system/libroot/add-ons/icu/ICUMonetaryData.cpp index e6d061a864..a7d470fdb0 100644 --- a/src/system/libroot/add-ons/icu/ICUMonetaryData.cpp +++ b/src/system/libroot/add-ons/icu/ICUMonetaryData.cpp @@ -12,6 +12,7 @@ namespace BPrivate { +namespace Libroot { ICUMonetaryData::ICUMonetaryData(struct lconv& localeConv) @@ -319,4 +320,5 @@ ICUMonetaryData::_DetermineSignPos(const UnicodeString& prefix, } +} // namespace Libroot } // namespace BPrivate diff --git a/src/system/libroot/add-ons/icu/ICUNumericData.cpp b/src/system/libroot/add-ons/icu/ICUNumericData.cpp index b59aa64df9..1612c99435 100644 --- a/src/system/libroot/add-ons/icu/ICUNumericData.cpp +++ b/src/system/libroot/add-ons/icu/ICUNumericData.cpp @@ -12,6 +12,7 @@ namespace BPrivate { +namespace Libroot { ICUNumericData::ICUNumericData(struct lconv& localeConv) @@ -123,4 +124,5 @@ ICUNumericData::GetLanginfo(int index) } +} // namespace Libroot } // namespace BPrivate diff --git a/src/system/libroot/add-ons/icu/ICUTimeConversion.cpp b/src/system/libroot/add-ons/icu/ICUTimeConversion.cpp index 990d08e839..5a5855b7f0 100644 --- a/src/system/libroot/add-ons/icu/ICUTimeConversion.cpp +++ b/src/system/libroot/add-ons/icu/ICUTimeConversion.cpp @@ -15,6 +15,7 @@ namespace BPrivate { +namespace Libroot { ICUTimeConversion::ICUTimeConversion(const ICUTimeData& timeData) @@ -217,4 +218,5 @@ ICUTimeConversion::_FillTmValues(const TimeZone* icuTimeZone, } +} // namespace Libroot } // namespace BPrivate diff --git a/src/system/libroot/add-ons/icu/ICUTimeData.cpp b/src/system/libroot/add-ons/icu/ICUTimeData.cpp index 7fddb086d9..4354150f55 100644 --- a/src/system/libroot/add-ons/icu/ICUTimeData.cpp +++ b/src/system/libroot/add-ons/icu/ICUTimeData.cpp @@ -17,6 +17,7 @@ namespace BPrivate { +namespace Libroot { ICUTimeData::ICUTimeData(struct lc_time_t& lcTimeInfo) @@ -413,4 +414,5 @@ ICUTimeData::ICULocale() const } +} // namespace Libroot } // namespace BPrivate diff --git a/src/system/libroot/posix/locale/LocaleBackend.cpp b/src/system/libroot/posix/locale/LocaleBackend.cpp index dc0b7798ba..45c14a38e5 100644 --- a/src/system/libroot/posix/locale/LocaleBackend.cpp +++ b/src/system/libroot/posix/locale/LocaleBackend.cpp @@ -12,6 +12,7 @@ namespace BPrivate { +namespace Libroot { LocaleBackend* gLocaleBackend = NULL; @@ -52,7 +53,7 @@ status_t LocaleBackend::LoadBackend() { if (gLocaleBackend == NULL) { - pthread_once(&sBackendInitOnce, &BPrivate::LoadBackend); + pthread_once(&sBackendInitOnce, &BPrivate::Libroot::LoadBackend); if (gLocaleBackend != NULL) gLocaleBackend->Initialize(&sLocaleDataBridge); } @@ -61,4 +62,5 @@ LocaleBackend::LoadBackend() } +} // namespace Libroot } // namespace BPrivate diff --git a/src/system/libroot/posix/locale/LocaleData.cpp b/src/system/libroot/posix/locale/LocaleData.cpp index b1724848b3..87ab763f48 100644 --- a/src/system/libroot/posix/locale/LocaleData.cpp +++ b/src/system/libroot/posix/locale/LocaleData.cpp @@ -25,6 +25,7 @@ namespace BPrivate { +namespace Libroot { /* @@ -323,9 +324,10 @@ const char* gPosixLanginfo[_NL_LANGINFO_LAST] = { #endif // !_KERNEL_MODE +} // namespace Libroot } // namespace BPrivate -const unsigned short* __ctype_b = &BPrivate::gPosixClassInfo[128]; -const int* __ctype_tolower = &BPrivate::gPosixToLowerMap[128]; -const int* __ctype_toupper = &BPrivate::gPosixToUpperMap[128]; +const unsigned short* __ctype_b = &BPrivate::Libroot::gPosixClassInfo[128]; +const int* __ctype_tolower = &BPrivate::Libroot::gPosixToLowerMap[128]; +const int* __ctype_toupper = &BPrivate::Libroot::gPosixToUpperMap[128]; diff --git a/src/system/libroot/posix/locale/LocaleDataBridge.cpp b/src/system/libroot/posix/locale/LocaleDataBridge.cpp index 1b9817d552..d2cce87b60 100644 --- a/src/system/libroot/posix/locale/LocaleDataBridge.cpp +++ b/src/system/libroot/posix/locale/LocaleDataBridge.cpp @@ -21,6 +21,7 @@ extern locale_data* _nl_current_LC_NUMERIC; namespace BPrivate { +namespace Libroot { LocaleCtypeDataBridge::LocaleCtypeDataBridge() @@ -89,4 +90,5 @@ LocaleDataBridge::LocaleDataBridge() } +} // namespace Libroot } // namespace BPrivate diff --git a/src/system/libroot/posix/locale/localeconv.cpp b/src/system/libroot/posix/locale/localeconv.cpp index 52ad10596d..8b353ccef5 100644 --- a/src/system/libroot/posix/locale/localeconv.cpp +++ b/src/system/libroot/posix/locale/localeconv.cpp @@ -12,7 +12,7 @@ #ifndef _KERNEL_MODE #include "LocaleBackend.h" -using BPrivate::gLocaleBackend; +using BPrivate::Libroot::gLocaleBackend; #endif @@ -24,5 +24,5 @@ localeconv(void) return const_cast(gLocaleBackend->LocaleConv()); #endif - return &BPrivate::gPosixLocaleConv; + return &BPrivate::Libroot::gPosixLocaleConv; } diff --git a/src/system/libroot/posix/locale/nl_langinfo.cpp b/src/system/libroot/posix/locale/nl_langinfo.cpp index d77a048a1f..b48f6f56ed 100644 --- a/src/system/libroot/posix/locale/nl_langinfo.cpp +++ b/src/system/libroot/posix/locale/nl_langinfo.cpp @@ -11,8 +11,8 @@ #include -using BPrivate::gLocaleBackend; -using BPrivate::gPosixLanginfo; +using BPrivate::Libroot::gLocaleBackend; +using BPrivate::Libroot::gPosixLanginfo; extern "C" char* diff --git a/src/system/libroot/posix/locale/setlocale.cpp b/src/system/libroot/posix/locale/setlocale.cpp index a4688688d5..cb4ff6a158 100644 --- a/src/system/libroot/posix/locale/setlocale.cpp +++ b/src/system/libroot/posix/locale/setlocale.cpp @@ -13,8 +13,8 @@ #include "LocaleBackend.h" -using BPrivate::gLocaleBackend; -using BPrivate::LocaleBackend; +using BPrivate::Libroot::gLocaleBackend; +using BPrivate::Libroot::LocaleBackend; static status_t diff --git a/src/system/libroot/posix/locale/wctype.cpp b/src/system/libroot/posix/locale/wctype.cpp index a0174dafda..05df504802 100644 --- a/src/system/libroot/posix/locale/wctype.cpp +++ b/src/system/libroot/posix/locale/wctype.cpp @@ -11,7 +11,7 @@ #include "LocaleBackend.h" -using BPrivate::gLocaleBackend; +using BPrivate::Libroot::gLocaleBackend; /* * In many of the following functions, we make use of the fact that with diff --git a/src/system/libroot/posix/string/strcoll.cpp b/src/system/libroot/posix/string/strcoll.cpp index 6f45badc51..5c1aa1fb14 100644 --- a/src/system/libroot/posix/string/strcoll.cpp +++ b/src/system/libroot/posix/string/strcoll.cpp @@ -10,7 +10,7 @@ #include "LocaleBackend.h" -using BPrivate::gLocaleBackend; +using BPrivate::Libroot::gLocaleBackend; extern "C" int diff --git a/src/system/libroot/posix/string/strxfrm.cpp b/src/system/libroot/posix/string/strxfrm.cpp index 9a19996b09..e3b21bdf86 100644 --- a/src/system/libroot/posix/string/strxfrm.cpp +++ b/src/system/libroot/posix/string/strxfrm.cpp @@ -10,7 +10,7 @@ #include "LocaleBackend.h" -using BPrivate::gLocaleBackend; +using BPrivate::Libroot::gLocaleBackend; extern "C" size_t diff --git a/src/system/libroot/posix/time/asctime.cpp b/src/system/libroot/posix/time/asctime.cpp index 9761ad9b7d..e4c292915a 100644 --- a/src/system/libroot/posix/time/asctime.cpp +++ b/src/system/libroot/posix/time/asctime.cpp @@ -11,7 +11,7 @@ #include "PosixLCTimeInfo.h" -using BPrivate::gPosixLCTimeInfo; +using BPrivate::Libroot::gPosixLCTimeInfo; static char* diff --git a/src/system/libroot/posix/time/localtime.cpp b/src/system/libroot/posix/time/localtime.cpp index d2b897f213..2486085d0b 100644 --- a/src/system/libroot/posix/time/localtime.cpp +++ b/src/system/libroot/posix/time/localtime.cpp @@ -16,8 +16,8 @@ #include "LocaleBackend.h" -using BPrivate::gLocaleBackend; -using BPrivate::LocaleBackend; +using BPrivate::Libroot::gLocaleBackend; +using BPrivate::Libroot::LocaleBackend; static char sStandardTZName[64] = { "???" }; diff --git a/src/system/libroot/posix/time/timelocal.cpp b/src/system/libroot/posix/time/timelocal.cpp index e05814bff4..bfa62bbdc9 100644 --- a/src/system/libroot/posix/time/timelocal.cpp +++ b/src/system/libroot/posix/time/timelocal.cpp @@ -12,7 +12,7 @@ #include "PosixLCTimeInfo.h" -using BPrivate::gLocaleBackend; +using BPrivate::Libroot::gLocaleBackend; extern "C" const lc_time_t* @@ -21,5 +21,5 @@ __get_current_time_locale(void) if (gLocaleBackend) return gLocaleBackend->LCTimeInfo(); - return &BPrivate::gPosixLCTimeInfo; + return &BPrivate::Libroot::gPosixLCTimeInfo; } diff --git a/src/system/runtime_loader/arch/m68k/arch_relocate.cpp b/src/system/runtime_loader/arch/m68k/arch_relocate.cpp index 658b633975..7b24c6dcd6 100644 --- a/src/system/runtime_loader/arch/m68k/arch_relocate.cpp +++ b/src/system/runtime_loader/arch/m68k/arch_relocate.cpp @@ -73,7 +73,7 @@ write_8_check(addr_t *P, Elf32_Word value) static int relocate_rela(image_t *rootImage, image_t *image, struct Elf32_Rela *rel, - int rel_len) + int rel_len, SymbolLookupCache* cache) { int i; addr_t S; @@ -101,7 +101,7 @@ relocate_rela(image_t *rootImage, image_t *image, struct Elf32_Rela *rel, status_t status; sym = SYMBOL(image, ELF32_R_SYM(rel[i].r_info)); - status = resolve_symbol(rootImage, image, sym, &S); + status = resolve_symbol(rootImage, image, sym, cache, &S); if (status < B_OK) { TRACE(("resolve symbol \"%s\" returned: %ld\n", SYMNAME(image, sym), status)); @@ -195,14 +195,14 @@ relocate_rela(image_t *rootImage, image_t *image, struct Elf32_Rela *rel, break; TRACE(("R_68K_PLT16 overflow\n")); return B_BAD_DATA; - + case R_68K_PLT8: REQUIRE_PLT; if (write_8_check(P, (L + A - P))) break; TRACE(("R_68K_PLT8 overflow\n")); return B_BAD_DATA; - + case R_68K_PLT32O: REQUIRE_PLT; write_32(P, (L + A)); @@ -272,7 +272,8 @@ relocate_rela(image_t *rootImage, image_t *image, struct Elf32_Rela *rel, status_t -arch_relocate_image(image_t *rootImage, image_t *image) +arch_relocate_image(image_t *rootImage, image_t *image, + SymbolLookupCache* cache) { status_t status; @@ -294,7 +295,8 @@ arch_relocate_image(image_t *rootImage, image_t *image) } if (image->rela) { - status = relocate_rela(rootImage, image, image->rela, image->rela_len); + status = relocate_rela(rootImage, image, image->rela, image->rela_len, + cache); //int i; if (status < B_OK) return status; diff --git a/src/system/runtime_loader/arch/ppc/arch_relocate.cpp b/src/system/runtime_loader/arch/ppc/arch_relocate.cpp index 229362e81a..6803697213 100644 --- a/src/system/runtime_loader/arch/ppc/arch_relocate.cpp +++ b/src/system/runtime_loader/arch/ppc/arch_relocate.cpp @@ -22,7 +22,7 @@ static int relocate_rel(image_t *rootImage, image_t *image, struct Elf32_Rel *rel, - int rel_len) + int rel_len, SymbolLookupCache* cache) { // ToDo: implement me! @@ -31,20 +31,22 @@ relocate_rel(image_t *rootImage, image_t *image, struct Elf32_Rel *rel, status_t -arch_relocate_image(image_t *rootImage, image_t *image) +arch_relocate_image(image_t *rootImage, image_t *image, + SymbolLookupCache* cache) { status_t status = B_NO_ERROR; // deal with the rels first if (image->rel) { - status = relocate_rel(rootImage, image, image->rel, image->rel_len); + status = relocate_rel(rootImage, image, image->rel, image->rel_len, + cache); if (status < B_OK) return status; } if (image->pltrel) { status = relocate_rel(rootImage, image, image->pltrel, - image->pltrel_len); + image->pltrel_len, cache); if (status < B_OK) return status; } diff --git a/src/system/runtime_loader/arch/x86/arch_relocate.cpp b/src/system/runtime_loader/arch/x86/arch_relocate.cpp index b4db1e2930..4e1f041612 100644 --- a/src/system/runtime_loader/arch/x86/arch_relocate.cpp +++ b/src/system/runtime_loader/arch/x86/arch_relocate.cpp @@ -19,7 +19,7 @@ static int relocate_rel(image_t *rootImage, image_t *image, struct Elf32_Rel *rel, - int rel_len) + int rel_len, SymbolLookupCache* cache) { int i; addr_t S; @@ -43,7 +43,7 @@ relocate_rel(image_t *rootImage, image_t *image, struct Elf32_Rel *rel, status_t status; sym = SYMBOL(image, ELF32_R_SYM(rel[i].r_info)); - status = resolve_symbol(rootImage, image, sym, &S); + status = resolve_symbol(rootImage, image, sym, cache, &S); if (status < B_OK) { TRACE(("resolve symbol \"%s\" returned: %ld\n", SYMNAME(image, sym), status)); @@ -107,20 +107,22 @@ relocate_rel(image_t *rootImage, image_t *image, struct Elf32_Rel *rel, status_t -arch_relocate_image(image_t *rootImage, image_t *image) +arch_relocate_image(image_t* rootImage, image_t* image, + SymbolLookupCache* cache) { status_t status; // deal with the rels first if (image->rel) { - status = relocate_rel(rootImage, image, image->rel, image->rel_len); + status = relocate_rel(rootImage, image, image->rel, image->rel_len, + cache); if (status < B_OK) return status; } if (image->pltrel) { status = relocate_rel(rootImage, image, image->pltrel, - image->pltrel_len); + image->pltrel_len, cache); if (status < B_OK) return status; } diff --git a/src/system/runtime_loader/elf.cpp b/src/system/runtime_loader/elf.cpp index eff87612d8..fd7f9b0225 100644 --- a/src/system/runtime_loader/elf.cpp +++ b/src/system/runtime_loader/elf.cpp @@ -198,7 +198,9 @@ load_dependencies(image_t* image) static status_t relocate_image(image_t *rootImage, image_t *image) { - status_t status = arch_relocate_image(rootImage, image); + SymbolLookupCache cache(image); + + status_t status = arch_relocate_image(rootImage, image, &cache); if (status < B_OK) { FATAL("%s: Troubles relocating: %s\n", image->path, strerror(status)); return status; @@ -796,6 +798,9 @@ get_library_symbol(void* handle, void* caller, const char* symbolName, bool hitCallerImage = false; set_image_flags_recursively(callerImage, RFLAG_USE_FOR_RESOLVING); + Elf32_Sym* candidateSymbol = NULL; + image_t* candidateImage = NULL; + image_t* image = get_loaded_images().head; for (; image != NULL; image = image->next) { // skip the caller image @@ -818,14 +823,27 @@ get_library_symbol(void* handle, void* caller, const char* symbolName, if (symbol == NULL) continue; + // found a symbol + bool isWeak = ELF32_ST_BIND(symbol->st_info) == STB_WEAK; + if (candidateImage == NULL || !isWeak) { + candidateSymbol = symbol; + candidateImage = image; + + if (!isWeak) + break; + } + + // symbol is weak, so we need to continue + } + + if (candidateSymbol != NULL) { // found the symbol - *_location = (void*)(symbol->st_value - + image->regions[0].delta); + *_location = (void*)(candidateSymbol->st_value + + candidateImage->regions[0].delta); int32 symbolType = B_SYMBOL_TYPE_TEXT; - patch_defined_symbol(image, symbolName, _location, + patch_defined_symbol(candidateImage, symbolName, _location, &symbolType); status = B_OK; - break; } clear_image_flags_recursively(callerImage, RFLAG_USE_FOR_RESOLVING); diff --git a/src/system/runtime_loader/elf_load_image.cpp b/src/system/runtime_loader/elf_load_image.cpp index 0a2ae72538..97f6988aa3 100644 --- a/src/system/runtime_loader/elf_load_image.cpp +++ b/src/system/runtime_loader/elf_load_image.cpp @@ -270,8 +270,8 @@ parse_dynamic_segment(image_t* image) case DT_RELASZ: image->rela_len = d[i].d_un.d_val; break; - // TK: procedure linkage table case DT_JMPREL: + // procedure linkage table relocations image->pltrel = (struct Elf32_Rel*) (d[i].d_un.d_ptr + image->regions[0].delta); break; @@ -307,8 +307,31 @@ parse_dynamic_segment(image_t* image) case DT_VERNEEDNUM: image->num_needed_versions = d[i].d_un.d_val; break; + case DT_SYMBOLIC: + image->flags |= RFLAG_SYMBOLIC; + break; + case DT_FLAGS: + { + uint32 flags = d[i].d_un.d_val; + if ((flags & DF_SYMBOLIC) != 0) + image->flags |= RFLAG_SYMBOLIC; + break; + } default: continue; + + // TODO: Implement: + // DT_RELENT: The size of a DT_REL entry. + // DT_RELAENT: The size of a DT_RELA entry. + // DT_SYMENT: The size of a symbol table entry. + // DT_PLTREL: The type of the PLT relocation entries (DT_JMPREL). + // DT_BIND_NOW/DF_BIND_NOW: No lazy binding allowed. + // DT_INIT_ARRAY[SZ], DT_FINI_ARRAY[SZ]: Initialization/termination + // function arrays. + // DT_PREINIT_ARRAY[SZ]: Preinitialization function array. + // DT_RUNPATH: Library search path (supersedes DT_RPATH). + // DT_TEXTREL/DF_TEXTREL: Indicates whether text relocations are + // required (for optimization purposes only). } } diff --git a/src/system/runtime_loader/elf_symbol_lookup.cpp b/src/system/runtime_loader/elf_symbol_lookup.cpp index bd4a70d726..b1de1be4f7 100644 --- a/src/system/runtime_loader/elf_symbol_lookup.cpp +++ b/src/system/runtime_loader/elf_symbol_lookup.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2008-2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2008-2010, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2003-2008, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. * @@ -20,9 +20,22 @@ #include "runtime_loader_private.h" +/*! Checks whether \a name matches the name of \a image. + + It is expected that \a name does not contain directory components. It is + compared with the base name of \a image's name. + + \param image The image. + \param name The name to check against. Can be NULL, in which case \c false + is returned. + \return \c true, iff \a name is non-NULL and matches the name of \a image. +*/ static bool equals_image_name(image_t* image, const char* name) { + if (name == NULL) + return false; + const char* lastSlash = strrchr(name, '/'); return strcmp(image->name, lastSlash != NULL ? lastSlash + 1 : name) == 0; } @@ -231,16 +244,23 @@ find_symbol_breadth_first(image_t* image, const SymbolLookupInfo& lookupInfo, queue[count++] = image; image->flags |= RFLAG_VISITED; - bool found = false; + Elf32_Sym* candidateSymbol = NULL; + image_t* candidateImage = NULL; + while (index < count) { // pop next image image = queue[index++]; - if (find_symbol(image, lookupInfo, _location) == B_OK) { - if (_foundInImage != NULL) - *_foundInImage = image; - found = true; - break; + Elf32_Sym* symbol = find_symbol(image, lookupInfo); + if (symbol != NULL) { + bool isWeak = ELF32_ST_BIND(symbol->st_info) == STB_WEAK; + if (candidateImage == NULL || !isWeak) { + candidateSymbol = symbol; + candidateImage = image; + + if (!isWeak) + break; + } } // push needed images @@ -257,7 +277,20 @@ find_symbol_breadth_first(image_t* image, const SymbolLookupInfo& lookupInfo, for (uint32 i = 0; i < count; i++) queue[i]->flags &= ~RFLAG_VISITED; - return found ? B_OK : B_ENTRY_NOT_FOUND; + if (candidateSymbol == NULL) + return B_ENTRY_NOT_FOUND; + + // compute the symbol location + *_location = (void*)(candidateSymbol->st_value + + candidateImage->regions[0].delta); + int32 symbolType = lookupInfo.type; + patch_defined_symbol(candidateImage, lookupInfo.name, _location, + &symbolType); + + if (_foundInImage != NULL) + *_foundInImage = candidateImage; + + return B_OK; } @@ -285,182 +318,226 @@ find_undefined_symbol_beos(image_t* rootImage, image_t* image, Elf32_Sym* find_undefined_symbol_global(image_t* rootImage, image_t* image, - const SymbolLookupInfo& lookupInfo, image_t** foundInImage) + const SymbolLookupInfo& lookupInfo, image_t** _foundInImage) { // Global load order symbol resolution: All loaded images are searched for // the symbol in the order they have been loaded. We skip add-on images and // RTLD_LOCAL images though. + image_t* candidateImage = NULL; + Elf32_Sym* candidateSymbol = NULL; + + // If the requesting image is linked symbolically, look up the symbol there + // first. + bool symbolic = (image->flags & RFLAG_SYMBOLIC) != 0; + if (symbolic) { + candidateSymbol = find_symbol(image, lookupInfo); + if (candidateSymbol != NULL) { + if (ELF32_ST_BIND(candidateSymbol->st_info) != STB_WEAK) { + *_foundInImage = image; + return candidateSymbol; + } + + candidateImage = image; + } + } + image_t* otherImage = get_loaded_images().head; while (otherImage != NULL) { if (otherImage == rootImage - || (otherImage->type != B_ADD_ON_IMAGE - && (otherImage->flags - & (RTLD_GLOBAL | RFLAG_USE_FOR_RESOLVING)) != 0)) { - Elf32_Sym *symbol = find_symbol(otherImage, lookupInfo); - if (symbol) { - *foundInImage = otherImage; - return symbol; + ? !symbolic + : (otherImage->type != B_ADD_ON_IMAGE + && (otherImage->flags + & (RTLD_GLOBAL | RFLAG_USE_FOR_RESOLVING)) != 0)) { + if (Elf32_Sym* symbol = find_symbol(otherImage, lookupInfo)) { + if (ELF32_ST_BIND(symbol->st_info) != STB_WEAK) { + *_foundInImage = otherImage; + return symbol; + } + + if (candidateSymbol == NULL) { + candidateSymbol = symbol; + candidateImage = otherImage; + } } } otherImage = otherImage->next; } - return NULL; + if (candidateSymbol != NULL) + *_foundInImage = candidateImage; + + return candidateSymbol; } Elf32_Sym* find_undefined_symbol_add_on(image_t* rootImage, image_t* image, - const SymbolLookupInfo& lookupInfo, image_t** foundInImage) + const SymbolLookupInfo& lookupInfo, image_t** _foundInImage) { - // Do a breadth-first resolution in the add-on dependency scope, - // skipping the add-on itself. - Elf32_Sym* foundSymbol = NULL; + // Similar to global load order symbol resolution: All loaded images are + // searched for the symbol in the order they have been loaded. We skip + // add-on images and RTLD_LOCAL images though. The root image (i.e. the + // add-on image) is skipped, too, but for the add-on itself we look up + // a symbol that hasn't been found anywhere else in the add-on image. + // The reason for skipping the add-on image is that we must not resolve + // library symbol references to symbol definitions in the add-on, as + // libraries can be shared between different add-ons and we must not + // introduce connections between add-ons. + image_t* candidateImage = NULL; + Elf32_Sym* candidateSymbol = NULL; - image_t* queue[count_loaded_images()]; - uint32 count = 0; - uint32 index = 0; - queue[count++] = image; - image->flags |= RFLAG_VISITED; - - image_t* currentImage; - while (index < count) { - // pop next image - currentImage = queue[index++]; - - if (currentImage != image) { - foundSymbol = find_symbol(currentImage, lookupInfo); - if (foundSymbol != NULL) { - if (foundInImage != NULL) - *foundInImage = currentImage; - break; + // If the requesting image is linked symbolically, look up the symbol there + // first. + bool symbolic = (image->flags & RFLAG_SYMBOLIC) != 0; + if (symbolic) { + candidateSymbol = find_symbol(image, lookupInfo); + if (candidateSymbol != NULL) { + if (ELF32_ST_BIND(candidateSymbol->st_info) != STB_WEAK) { + *_foundInImage = image; + return candidateSymbol; } - } - // push needed images - for (uint32 i = 0; i < currentImage->num_needed; i++) { - image_t* needed = currentImage->needed[i]; - if ((needed->flags & RFLAG_VISITED) == 0) { - queue[count++] = needed; - needed->flags |= RFLAG_VISITED; - } + candidateImage = image; } } - // clear visited flags - for (uint32 i = 0; i < count; i++) - queue[i]->flags &= ~RFLAG_VISITED; + image_t* otherImage = get_loaded_images().head; + while (otherImage != NULL) { + if (otherImage != rootImage + && otherImage->type != B_ADD_ON_IMAGE + && (otherImage->flags + & (RTLD_GLOBAL | RFLAG_USE_FOR_RESOLVING)) != 0) { + if (Elf32_Sym* symbol = find_symbol(otherImage, lookupInfo)) { + if (ELF32_ST_BIND(symbol->st_info) != STB_WEAK) { + *_foundInImage = otherImage; + return symbol; + } - return foundSymbol; + if (candidateSymbol == NULL) { + candidateSymbol = symbol; + candidateImage = otherImage; + } + } + } + otherImage = otherImage->next; + } + + // If the symbol has not been found and we're trying to resolve a reference + // in the add-on image, we also try to look it up there. + if (!symbolic && candidateSymbol == NULL && image == rootImage) { + candidateSymbol = find_symbol(image, lookupInfo); + candidateImage = image; + } + + if (candidateSymbol != NULL) + *_foundInImage = candidateImage; + + return candidateSymbol; } int resolve_symbol(image_t* rootImage, image_t* image, struct Elf32_Sym* sym, - addr_t* symAddress) + SymbolLookupCache* cache, addr_t* symAddress) { - switch (sym->st_shndx) { - case SHN_UNDEF: - { - struct Elf32_Sym* sharedSym; - image_t* sharedImage; - const char* symName = SYMNAME(image, sym); + uint32 index = sym - image->syms; - // get the version info - const elf_version_info* versionInfo = NULL; - if (image->symbol_versions != NULL) { - uint32 index = sym - image->syms; - uint32 versionIndex = VER_NDX(image->symbol_versions[index]); - if (versionIndex >= VER_NDX_INITIAL) - versionInfo = image->versions + versionIndex; - } + // check the cache first + if (cache->IsSymbolValueCached(index)) { + *symAddress = cache->SymbolValueAt(index); + return B_OK; + } - int32 type = B_SYMBOL_TYPE_ANY; - if (ELF32_ST_TYPE(sym->st_info) == STT_FUNC) - type = B_SYMBOL_TYPE_TEXT; - else if (ELF32_ST_TYPE(sym->st_info) == STT_OBJECT) - type = B_SYMBOL_TYPE_DATA; + struct Elf32_Sym* sharedSym; + image_t* sharedImage; + const char* symName = SYMNAME(image, sym); - // it's undefined, must be outside this image, try the other images - sharedSym = rootImage->find_undefined_symbol(rootImage, image, - SymbolLookupInfo(symName, type, versionInfo), &sharedImage); - void* location = NULL; + // get the symbol type + int32 type = B_SYMBOL_TYPE_ANY; + if (ELF32_ST_TYPE(sym->st_info) == STT_FUNC) + type = B_SYMBOL_TYPE_TEXT; + else if (ELF32_ST_TYPE(sym->st_info) == STT_OBJECT) + type = B_SYMBOL_TYPE_DATA; - enum { - ERROR_NO_SYMBOL, - ERROR_WRONG_TYPE, - ERROR_NOT_EXPORTED, - ERROR_UNPATCHED - }; - uint32 lookupError = ERROR_UNPATCHED; - - if (sharedSym == NULL) { - // symbol not found at all - lookupError = ERROR_NO_SYMBOL; - sharedImage = NULL; - } else if (ELF32_ST_TYPE(sym->st_info) != STT_NOTYPE - && ELF32_ST_TYPE(sym->st_info) - != ELF32_ST_TYPE(sharedSym->st_info)) { - // symbol not of the requested type - lookupError = ERROR_WRONG_TYPE; - sharedImage = NULL; - } else if (ELF32_ST_BIND(sharedSym->st_info) != STB_GLOBAL - && ELF32_ST_BIND(sharedSym->st_info) != STB_WEAK) { - // symbol not exported - lookupError = ERROR_NOT_EXPORTED; - sharedImage = NULL; - } else { - // symbol is fine, get its location - location = (void*)(sharedSym->st_value - + sharedImage->regions[0].delta); - } - - patch_undefined_symbol(rootImage, image, symName, &sharedImage, - &location, &type); - - if (location == NULL) { - switch (lookupError) { - case ERROR_NO_SYMBOL: - FATAL("%s: Could not resolve symbol '%s'\n", - image->path, symName); - break; - case ERROR_WRONG_TYPE: - FATAL("%s: Found symbol '%s' in shared image but wrong " - "type\n", image->path, symName); - break; - case ERROR_NOT_EXPORTED: - FATAL("%s: Found symbol '%s', but not exported\n", - image->path, symName); - break; - case ERROR_UNPATCHED: - FATAL("%s: Found symbol '%s', but was hidden by symbol " - "patchers\n", image->path, symName); - break; - } - - if (report_errors()) - gErrorMessage.AddString("missing symbol", symName); - - return B_MISSING_SYMBOL; - } - - *symAddress = (addr_t)location; - return B_OK; + if (ELF32_ST_BIND(sym->st_info) == STB_LOCAL) { + // Local symbols references are always resolved to the given symbol. + sharedImage = image; + sharedSym = sym; + } else { + // get the version info + const elf_version_info* versionInfo = NULL; + if (image->symbol_versions != NULL) { + uint32 versionIndex = VER_NDX(image->symbol_versions[index]); + if (versionIndex >= VER_NDX_INITIAL) + versionInfo = image->versions + versionIndex; } - case SHN_ABS: - *symAddress = sym->st_value + image->regions[0].delta; - return B_NO_ERROR; - - case SHN_COMMON: - // TODO: finish this - FATAL("%s: elf_resolve_symbol: COMMON symbol, finish me!\n", - image->path); - return B_ERROR; //ERR_NOT_IMPLEMENTED_YET; - - default: - // standard symbol - *symAddress = sym->st_value + image->regions[0].delta; - return B_NO_ERROR; + // search the symbol + sharedSym = rootImage->find_undefined_symbol(rootImage, image, + SymbolLookupInfo(symName, type, versionInfo), &sharedImage); } + + enum { + ERROR_NO_SYMBOL, + ERROR_WRONG_TYPE, + ERROR_NOT_EXPORTED, + ERROR_UNPATCHED + }; + uint32 lookupError = ERROR_UNPATCHED; + + void* location = NULL; + if (sharedSym == NULL) { + // symbol not found at all + lookupError = ERROR_NO_SYMBOL; + sharedImage = NULL; + } else if (ELF32_ST_TYPE(sym->st_info) != STT_NOTYPE + && ELF32_ST_TYPE(sym->st_info) + != ELF32_ST_TYPE(sharedSym->st_info)) { + // symbol not of the requested type + lookupError = ERROR_WRONG_TYPE; + sharedImage = NULL; + } else if (ELF32_ST_BIND(sharedSym->st_info) != STB_GLOBAL + && ELF32_ST_BIND(sharedSym->st_info) != STB_WEAK) { + // symbol not exported + lookupError = ERROR_NOT_EXPORTED; + sharedImage = NULL; + } else { + // symbol is fine, get its location + location = (void*)(sharedSym->st_value + + sharedImage->regions[0].delta); + } + + patch_undefined_symbol(rootImage, image, symName, &sharedImage, &location, + &type); + + if (location == NULL) { + switch (lookupError) { + case ERROR_NO_SYMBOL: + FATAL("%s: Could not resolve symbol '%s'\n", + image->path, symName); + break; + case ERROR_WRONG_TYPE: + FATAL("%s: Found symbol '%s' in shared image but wrong " + "type\n", image->path, symName); + break; + case ERROR_NOT_EXPORTED: + FATAL("%s: Found symbol '%s', but not exported\n", + image->path, symName); + break; + case ERROR_UNPATCHED: + FATAL("%s: Found symbol '%s', but was hidden by symbol " + "patchers\n", image->path, symName); + break; + } + + if (report_errors()) + gErrorMessage.AddString("missing symbol", symName); + + return B_MISSING_SYMBOL; + } + + cache->SetSymbolValueAt(index, (addr_t)location); + + *symAddress = (addr_t)location; + return B_OK; } diff --git a/src/system/runtime_loader/elf_symbol_lookup.h b/src/system/runtime_loader/elf_symbol_lookup.h index 1bf6e1b5ec..e9117d4740 100644 --- a/src/system/runtime_loader/elf_symbol_lookup.h +++ b/src/system/runtime_loader/elf_symbol_lookup.h @@ -1,10 +1,14 @@ /* - * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2009-2010, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ #ifndef ELF_SYMBOL_LOOKUP_H #define ELF_SYMBOL_LOOKUP_H + +#include +#include + #include @@ -46,6 +50,60 @@ struct SymbolLookupInfo { }; +struct SymbolLookupCache { + SymbolLookupCache(image_t* image) + : + fTableSize(image->symhash[1]), + fValues(NULL), + fValuesResolved(NULL) + { + if (fTableSize > 0) { + fValues = (addr_t*)malloc(sizeof(addr_t) * fTableSize); + + size_t elementCount = (fTableSize + 31) / 32; + fValuesResolved = (uint32*)malloc(4 * elementCount); + memset(fValuesResolved, 0, 4 * elementCount); + + if (fValues == NULL || fValuesResolved == NULL) { + free(fValuesResolved); + free(fValues); + fTableSize = 0; + } + } + } + + ~SymbolLookupCache() + { + free(fValuesResolved); + free(fValues); + } + + bool IsSymbolValueCached(size_t index) const + { + return index < fTableSize + && (fValuesResolved[index / 32] & (1 << (index % 32))) != 0; + } + + addr_t SymbolValueAt(size_t index) const + { + return fValues[index]; + } + + void SetSymbolValueAt(size_t index, addr_t value) + { + if (index < fTableSize) { + fValues[index] = value; + fValuesResolved[index / 32] |= 1 << (index % 32); + } + } + +private: + size_t fTableSize; + addr_t* fValues; + uint32* fValuesResolved; +}; + + void patch_defined_symbol(image_t* image, const char* name, void** symbol, int32* type); void patch_undefined_symbol(image_t* rootImage, image_t* image, diff --git a/src/system/runtime_loader/elf_versioning.cpp b/src/system/runtime_loader/elf_versioning.cpp index 1cdd3b75e7..756459aa68 100644 --- a/src/system/runtime_loader/elf_versioning.cpp +++ b/src/system/runtime_loader/elf_versioning.cpp @@ -130,6 +130,7 @@ init_image_version_infos(image_t* image) elf_version_info& info = image->versions[versionIndex]; info.hash = definition->vd_hash; info.name = STRING(image, verdaux->vda_name); + info.file_name = NULL; } definition = (Elf32_Verdef*) diff --git a/src/system/runtime_loader/runtime_loader_private.h b/src/system/runtime_loader/runtime_loader_private.h index d324c6f629..1ff95cd41e 100644 --- a/src/system/runtime_loader/runtime_loader_private.h +++ b/src/system/runtime_loader/runtime_loader_private.h @@ -39,6 +39,9 @@ } while (false) +struct SymbolLookupCache; + + extern struct user_space_program_args* gProgramArgs; extern struct rld_export gRuntimeLoader; extern char* (*gGetEnv)(const char* name); @@ -69,7 +72,7 @@ status_t get_library_symbol(void* handle, void* caller, const char* symbolName, status_t get_next_image_dependency(image_id id, uint32* cookie, const char** _name); int resolve_symbol(image_t* rootImage, image_t* image, struct Elf32_Sym* sym, - addr_t* sym_addr); + SymbolLookupCache* cache, addr_t* sym_addr); status_t elf_verify_header(void* header, int32 length); @@ -80,7 +83,8 @@ status_t elf_reinit_after_fork(void); status_t heap_init(void); // arch dependent prototypes -status_t arch_relocate_image(image_t* rootImage, image_t* image); +status_t arch_relocate_image(image_t* rootImage, image_t* image, + SymbolLookupCache* cache); #ifdef __cplusplus }