-Delete some old unused files

-Some style fixes (mostly whitespace)
-Switch to the short language list and make it build again. seems to have trouble with BStringByteSink and utf8, or is it just my build env having encoding problems ?


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33209 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues 2009-09-20 17:57:06 +00:00
parent 36e4aeea57
commit 76065080e6
7 changed files with 72 additions and 428 deletions

View File

@ -87,11 +87,11 @@ extern BCatalog* be_app_catalog;
be_catalog->GetString((str), TR_CONTEXT)
#undef TR_CMT
#define TR_CMT(str,cmt) \
#define TR_CMT(str, cmt) \
be_catalog->GetString((str), TR_CONTEXT, (cmt))
#undef TR_ALL
#define TR_ALL(str,ctx,cmt) \
#define TR_ALL(str, ctx, cmt) \
be_catalog->GetString((str), (ctx), (cmt))
#undef TR_ID
@ -127,11 +127,11 @@ extern BCatalog* be_app_catalog;
BCatalogAddOn::MarkForTranslation((str), TR_CONTEXT, "")
#undef TR_MARK_CMT
#define TR_MARK_CMT(str,cmt) \
#define TR_MARK_CMT(str, cmt) \
BCatalogAddOn::MarkForTranslation((str), TR_CONTEXT, (cmt))
#undef TR_MARK_ALL
#define TR_MARK_ALL(str,ctx,cmt) \
#define TR_MARK_ALL(str, ctx, cmt) \
BCatalogAddOn::MarkForTranslation((str), (ctx), (cmt))
#undef TR_MARK_ID
@ -148,20 +148,20 @@ class BCatalogAddOn {
friend class BLocaleRoster;
public:
BCatalogAddOn(const char *signature, const char *language,
uint32 fingerprint);
uint32 fingerprint);
virtual ~BCatalogAddOn();
virtual const char *GetString(const char *string,
const char *context=NULL,
const char *comment=NULL) = 0;
const char *context = NULL,
const char *comment = NULL) = 0;
virtual const char *GetString(uint32 id) = 0;
status_t InitCheck() const;
BCatalogAddOn *Next();
// the following could be used to localize non-textual data (e.g. icons),
// but these will only be implemented if there's demand for such a
// feature:
// the following could be used to localize non-textual data (e.g.
// icons), but these will only be implemented if there's demand for such
// a feature:
virtual bool CanHaveData() const;
virtual status_t GetData(const char *name, BMessage *msg);
virtual status_t GetData(uint32 id, BMessage *msg);
@ -169,21 +169,21 @@ class BCatalogAddOn {
// interface for catalog-editor-app and testing apps:
virtual status_t SetString(const char *string,
const char *translated,
const char *context=NULL,
const char *comment=NULL);
const char *context = NULL,
const char *comment = NULL);
virtual status_t SetString(int32 id, const char *translated);
//
virtual bool CanWriteData() const;
virtual status_t SetData(const char *name, BMessage *msg);
virtual status_t SetData(uint32 id, BMessage *msg);
//
virtual status_t ReadFromFile(const char *path = NULL);
virtual status_t ReadFromAttribute(entry_ref *appOrAddOnRef);
virtual status_t ReadFromResource(entry_ref *appOrAddOnRef);
virtual status_t WriteToFile(const char *path = NULL);
virtual status_t WriteToAttribute(entry_ref *appOrAddOnRef);
virtual status_t WriteToResource(entry_ref *appOrAddOnRef);
//
virtual void MakeEmpty();
virtual int32 CountItems() const;
@ -323,21 +323,21 @@ class EditableCatalog : public BCatalog {
status_t SetString(const char *string,
const char *translated,
const char *context=NULL,
const char *comment=NULL);
const char *context = NULL,
const char *comment = NULL);
status_t SetString(int32 id, const char *translated);
//
bool CanWriteData() const;
status_t SetData(const char *name, BMessage *msg);
status_t SetData(uint32 id, BMessage *msg);
//
status_t ReadFromFile(const char *path = NULL);
status_t ReadFromAttribute(entry_ref *appOrAddOnRef);
status_t ReadFromResource(entry_ref *appOrAddOnRef);
status_t WriteToFile(const char *path = NULL);
status_t WriteToAttribute(entry_ref *appOrAddOnRef);
status_t WriteToResource(entry_ref *appOrAddOnRef);
//
void MakeEmpty();
private:
@ -350,4 +350,4 @@ class EditableCatalog : public BCatalog {
} // namespace BPrivate
#endif /* _CATALOG_H_ */
#endif /* _CATALOG_H_ */

View File

@ -30,7 +30,7 @@ BCatalog::BCatalog()
}
BCatalog::BCatalog(const char *signature, const char *language,
BCatalog::BCatalog(const char *signature, const char *language,
uint32 fingerprint)
{
fCatalog = be_locale_roster->LoadCatalog(signature, language, fingerprint);
@ -46,7 +46,8 @@ BCatalog::~BCatalog()
const char *
BCatalog::GetString(const char *string, const char *context, const char *comment)
BCatalog::GetString(const char *string, const char *context,
const char *comment)
{
const char *translated;
for (BCatalogAddOn* cat = fCatalog; cat != NULL; cat = cat->fNext) {
@ -71,7 +72,7 @@ BCatalog::GetString(uint32 id)
}
status_t
status_t
BCatalog::GetData(const char *name, BMessage *msg)
{
if (!fCatalog)
@ -80,14 +81,13 @@ BCatalog::GetData(const char *name, BMessage *msg)
for (BCatalogAddOn* cat = fCatalog; cat != NULL; cat = cat->fNext) {
res = cat->GetData(name, msg);
if (res != B_NAME_NOT_FOUND && res != EOPNOTSUPP)
return res;
// return B_OK if found, or specific error-code
return res; // return B_OK if found, or specific error-code
}
return B_NAME_NOT_FOUND;
}
status_t
status_t
BCatalog::GetData(uint32 id, BMessage *msg)
{
if (!fCatalog)
@ -96,15 +96,14 @@ BCatalog::GetData(uint32 id, BMessage *msg)
for (BCatalogAddOn* cat = fCatalog; cat != NULL; cat = cat->fNext) {
res = cat->GetData(id, msg);
if (res != B_NAME_NOT_FOUND && res != EOPNOTSUPP)
return res;
// return B_OK if found, or specific error-code
return res; // return B_OK if found, or specific error-code
}
return B_NAME_NOT_FOUND;
}
status_t
BCatalog::GetAppCatalog(BCatalog* catalog)
status_t
BCatalog::GetAppCatalog(BCatalog* catalog)
{
app_info appInfo;
if (!be_app || be_app->GetAppInfo(&appInfo) != B_OK)
@ -119,15 +118,15 @@ BCatalog::GetAppCatalog(BCatalog* catalog)
// try to fetch fingerprint from app-file (attribute):
uint32 fingerprint = 0;
BNode appNode(&appInfo.ref);
appNode.ReadAttr(BLocaleRoster::kCatFingerprintAttr, B_UINT32_TYPE, 0,
appNode.ReadAttr(BLocaleRoster::kCatFingerprintAttr, B_UINT32_TYPE, 0,
&fingerprint, sizeof(uint32));
// try to load catalog (with given fingerprint):
catalog->fCatalog
= be_locale_roster->LoadCatalog(sig.String(), NULL, fingerprint);
// load native embedded id-based catalog. If such a catalog exists,
// load native embedded id-based catalog. If such a catalog exists,
// we can fall back to native strings for id-based access, too.
BCatalogAddOn *embeddedCatalog
BCatalogAddOn *embeddedCatalog
= be_locale_roster->LoadEmbeddedCatalog(&appInfo.ref);
if (embeddedCatalog) {
if (!catalog->fCatalog)
@ -178,35 +177,35 @@ BCatalogAddOn::UpdateFingerprint()
}
status_t
status_t
BCatalogAddOn::InitCheck() const
{
{
return fInitCheck;
}
bool
bool
BCatalogAddOn::CanHaveData() const
{
return false;
}
status_t
status_t
BCatalogAddOn::GetData(const char *name, BMessage *msg)
{
return EOPNOTSUPP;
}
status_t
status_t
BCatalogAddOn::GetData(uint32 id, BMessage *msg)
{
return EOPNOTSUPP;
}
status_t
status_t
BCatalogAddOn::SetString(const char *string, const char *translated,
const char *context, const char *comment)
{
@ -214,70 +213,70 @@ BCatalogAddOn::SetString(const char *string, const char *translated,
}
status_t
status_t
BCatalogAddOn::SetString(int32 id, const char *translated)
{
return EOPNOTSUPP;
}
bool
bool
BCatalogAddOn::CanWriteData() const
{
return false;
}
status_t
status_t
BCatalogAddOn::SetData(const char *name, BMessage *msg)
{
return EOPNOTSUPP;
}
status_t
status_t
BCatalogAddOn::SetData(uint32 id, BMessage *msg)
{
return EOPNOTSUPP;
}
status_t
status_t
BCatalogAddOn::ReadFromFile(const char *path)
{
return EOPNOTSUPP;
}
status_t
status_t
BCatalogAddOn::ReadFromAttribute(entry_ref *appOrAddOnRef)
{
return EOPNOTSUPP;
}
status_t
status_t
BCatalogAddOn::ReadFromResource(entry_ref *appOrAddOnRef)
{
return EOPNOTSUPP;
}
status_t
status_t
BCatalogAddOn::WriteToFile(const char *path)
{
return EOPNOTSUPP;
}
status_t
status_t
BCatalogAddOn::WriteToAttribute(entry_ref *appOrAddOnRef)
{
return EOPNOTSUPP;
}
status_t
status_t
BCatalogAddOn::WriteToResource(entry_ref *appOrAddOnRef)
{
return EOPNOTSUPP;
@ -289,7 +288,7 @@ void BCatalogAddOn::MakeEmpty()
}
int32
int32
BCatalogAddOn::CountItems() const
{
return 0;
@ -298,7 +297,7 @@ BCatalogAddOn::CountItems() const
//#pragma mark - EditableCatalog
namespace BPrivate {
EditableCatalog::EditableCatalog(const char *type, const char *signature,
EditableCatalog::EditableCatalog(const char *type, const char *signature,
const char *language)
{
fCatalog = be_locale_roster->CreateCatalog(type, signature, language);
@ -310,7 +309,7 @@ EditableCatalog::~EditableCatalog()
}
status_t
status_t
EditableCatalog::SetString(const char *string, const char *translated,
const char *context, const char *comment)
{
@ -320,7 +319,7 @@ EditableCatalog::SetString(const char *string, const char *translated,
}
status_t
status_t
EditableCatalog::SetString(int32 id, const char *translated)
{
if (!fCatalog)
@ -329,7 +328,7 @@ EditableCatalog::SetString(int32 id, const char *translated)
}
bool
bool
EditableCatalog::CanWriteData() const
{
if (!fCatalog)
@ -338,7 +337,7 @@ EditableCatalog::CanWriteData() const
}
status_t
status_t
EditableCatalog::SetData(const char *name, BMessage *msg)
{
if (!fCatalog)
@ -347,7 +346,7 @@ EditableCatalog::SetData(const char *name, BMessage *msg)
}
status_t
status_t
EditableCatalog::SetData(uint32 id, BMessage *msg)
{
if (!fCatalog)
@ -356,7 +355,7 @@ EditableCatalog::SetData(uint32 id, BMessage *msg)
}
status_t
status_t
EditableCatalog::ReadFromFile(const char *path)
{
if (!fCatalog)
@ -365,7 +364,7 @@ EditableCatalog::ReadFromFile(const char *path)
}
status_t
status_t
EditableCatalog::ReadFromAttribute(entry_ref *appOrAddOnRef)
{
if (!fCatalog)
@ -374,7 +373,7 @@ EditableCatalog::ReadFromAttribute(entry_ref *appOrAddOnRef)
}
status_t
status_t
EditableCatalog::ReadFromResource(entry_ref *appOrAddOnRef)
{
if (!fCatalog)
@ -383,7 +382,7 @@ EditableCatalog::ReadFromResource(entry_ref *appOrAddOnRef)
}
status_t
status_t
EditableCatalog::WriteToFile(const char *path)
{
if (!fCatalog)
@ -392,7 +391,7 @@ EditableCatalog::WriteToFile(const char *path)
}
status_t
status_t
EditableCatalog::WriteToAttribute(entry_ref *appOrAddOnRef)
{
if (!fCatalog)
@ -401,7 +400,7 @@ EditableCatalog::WriteToAttribute(entry_ref *appOrAddOnRef)
}
status_t
status_t
EditableCatalog::WriteToResource(entry_ref *appOrAddOnRef)
{
if (!fCatalog)

View File

@ -32,7 +32,6 @@ SharedLibrary liblocale.so
NumberFormatImpl.cpp
NumberFormatParameters.cpp
PropertyFile.cpp
strfmon.cpp
UnicodeChar.cpp
: be $(TARGET_LIBSTDC++) libicu-common.so libicu-i18n.so
;

View File

@ -498,7 +498,7 @@ BLocaleRoster::GetInstalledLanguages(BMessage *languages) const
BString languageName;
std::set<BString> languageSet;
#define REALLY_ALL_LANGUAGES
#undef REALLY_ALL_LANGUAGES
#ifdef REALLY_ALL_LANGUAGES
static const char* const* icuLocaleList = Locale::getISOLanguages();
@ -513,7 +513,12 @@ BLocaleRoster::GetInstalledLanguages(BMessage *languages) const
// Loop over the strings and add them to an std::set to remove duplicates
for (i = 0; i < localeCount; i++) {
languageSet.insert(BString(icuLocaleList[i]));
UnicodeString ICULanguageName;
BString LanguageName;
BStringByteSink StringConverter(&LanguageName);
icuLocaleList[i].getDisplayLanguage(ICULanguageName);
ICULanguageName.toUTF8(StringConverter);
languageSet.insert(LanguageName);
}
#endif
@ -523,7 +528,7 @@ BLocaleRoster::GetInstalledLanguages(BMessage *languages) const
languages->AddString("langs", *setIterator);
}
return B_OK;
return B_OK;
}

View File

@ -1,179 +0,0 @@
## BeOS Generic Makefile v2.2 ##
## Fill in this file to specify the project being created, and the referenced
## makefile-engine will do all of the hard work for you. This handles both
## Intel and PowerPC builds of the BeOS.
## Application Specific Settings ---------------------------------------------
# specify the name of the binary
NAME= liblocale.so
# specify the type of binary
# APP: Application
# SHARED: Shared library or add-on
# STATIC: Static library archive
# DRIVER: Kernel Driver
TYPE= SHARED
# add support for new Pe and Eddie features
# to fill in generic makefile
#%{
# @src->@
# specify the source files to use
# full paths or paths relative to the makefile can be included
# all files, regardless of directory, will have their object
# files created in the common object directory.
# Note that this means this makefile will not work correctly
# if two source files with the same name (source.c or source.cpp)
# are included from different directories. Also note that spaces
# in folder names do not work well with this makefile.
SRCS= \
adler32.c \
cat.cpp \
Catalog.cpp \
Collator.cpp \
Country.cpp \
Currency.cpp \
DefaultCatalog.cpp \
FloatFormat.cpp \
FloatFormatImpl.cpp \
FloatFormatParameters.cpp \
Format.cpp \
FormatImpl.cpp \
FormatParameters.cpp \
GenericNumberFormat.cpp \
IntegerFormat.cpp \
IntegerFormatImpl.cpp \
IntegerFormatParameters.cpp \
langinfo.cpp \
Language.cpp \
LibraryInit.cpp \
Locale.cpp \
LocaleRoster.cpp \
NumberFormat.cpp \
NumberFormatImpl.cpp \
NumberFormatParameters.cpp \
PropertyFile.cpp \
strfmon.cpp \
UnicodeChar.cpp
# specify the resource files to use
# full path or a relative path to the resource file can be used.
RSRCS=
# @<-src@
#%}
# end support for Pe and Eddie
# specify additional libraries to link against
# there are two acceptable forms of library specifications
# - if your library follows the naming pattern of:
# libXXX.so or libXXX.a you can simply specify XXX
# library: libbe.so entry: be
#
# - if your library does not follow the standard library
# naming scheme you need to specify the path to the library
# and it's name
# library: my_lib.a entry: my_lib.a or path/my_lib.a
LIBS= be
# specify additional paths to directories following the standard
# libXXX.so or libXXX.a naming scheme. You can specify full paths
# or paths relative to the makefile. The paths included may not
# be recursive, so include all of the paths where libraries can
# be found. Directories where source files are found are
# automatically included.
LIBPATHS=
# additional paths to look for system headers
# thes use the form: #include <header>
# source file directories are NOT auto-included here
SYSTEM_INCLUDE_PATHS = ../include ../include/posix
# additional paths to look for local headers
# thes use the form: #include "header"
# source file directories are automatically included
LOCAL_INCLUDE_PATHS =
# specify the level of optimization that you desire
# NONE, SOME, FULL
OPTIMIZE= SOME
# specify any preprocessor symbols to be defined. The symbols will not
# have their values set automatically; you must supply the value (if any)
# to use. For example, setting DEFINES to "DEBUG=1" will cause the
# compiler option "-DDEBUG=1" to be used. Setting DEFINES to "DEBUG"
# would pass "-DDEBUG" on the compiler's command line.
DEFINES=
# specify special warning levels
# if unspecified default warnings will be used
# NONE = supress all warnings
# ALL = enable all warnings
WARNINGS = ALL
# specify whether image symbols will be created
# so that stack crawls in the debugger are meaningful
# if TRUE symbols will be created
SYMBOLS = TRUE
# specify debug settings
# if TRUE will allow application to be run from a source-level
# debugger. Note that this will disable all optimzation.
ifeq ($(DEBUG_BUILD), true)
DEBUGGER = TRUE
else
DEBUGGER = FALSE
endif
# specify additional compiler flags for all files
COMPILER_FLAGS =
# specify additional linker flags
LINKER_FLAGS =
# specify the version of this particular item
# (for example, -app 3 4 0 d 0 -short 340 -long "340 "`echo -n -e '\302\251'`"1999 GNU GPL")
# This may also be specified in a resource.
APP_VERSION =
# (for TYPE == DRIVER only) Specify desired location of driver in the /dev
# hierarchy. Used by the driverinstall rule. E.g., DRIVER_PATH = video/usb will
# instruct the driverinstall rule to place a symlink to your driver's binary in
# ~/add-ons/kernel/drivers/dev/video/usb, so that your driver will appear at
# /dev/video/usb when loaded. Default is "misc".
DRIVER_PATH =
#MACHINE=$(shell uname -m)
#ifneq ($(MACHINE),BePC)
# COMPILER_FLAGS += -w iserr
#else
# COMPILER_FLAGS += -Werror
#endif
# Custom overrides that can be set from the command line.
ifeq ($(DEBUG_BUILD), true)
SYMBOLS := TRUE
DEBUGGER := TRUE
OPTIMIZE := NONE
COMPILER_FLAGS += -DDEBUG=1
endif
ifeq ($(CHECK_MEM), true)
SYMBOLS := TRUE
DEBUGGER := TRUE
OPTIMIZE := NONE
COMPILER_FLAGS += -fcheck-memory-usage -DDEBUG=1 -D_NO_INLINE_ASM=1
#-D_KERNEL_MODE=1
endif
INSTALL_DIR=/boot/home/config/lib
TARGET_DIR=.
## include the makefile-engine
include $(BUILDHOME)/etc/makefile-engine

View File

@ -1,181 +0,0 @@
/*
** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
** Distributed under the terms of the MIT License.
*/
#include <SupportDefs.h>
#include <errno.h>
#include <monetary.h>
#include <locale.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
// ToDo: implementation is not yet working!
enum strfmon_flags {
USE_GROUPING = 1,
USE_SIGN = 2,
USE_LOCALE_POSNEG = 4,
NEG_IN_PARENTHESES = 8,
NO_CURRENCY = 16,
LEFT_JUSTIFIED = 32,
USE_INT_CURRENCY = 64
};
static int32
parseNumber(const char **_format)
{
const char *format = *_format;
int32 number = 0;
while (isdigit(*format))
number = number * 10 + *format++ - '0';
*_format = format;
return number;
}
ssize_t
vstrfmon(char *string, size_t maxSize, const char *format, va_list args)
{
if (format == NULL || string == NULL)
return B_BAD_VALUE;
struct lconv *lconv = localeconv();
int32 length = 0;
while (*format) {
if (format[0] != '%' || *++format == '%') {
if (++length >= (int32)maxSize)
return E2BIG;
*string++ = *format++;
continue;
}
if (format[0] == '\0')
return B_BAD_VALUE;
char flags = USE_GROUPING | USE_LOCALE_POSNEG;
char fill = ' ';
int32 width = 0, leftPrecision = 0, rightPrecision = -1;
bool isNegative = false;
// flags
int32 mode = 0;
while (*format && mode == 0) {
switch (*format++) {
case '=':
fill = *format++;
if (fill == '\0')
return B_BAD_VALUE;
break;
case '+':
if (flags & USE_SIGN)
return B_BAD_VALUE;
flags |= USE_SIGN;
break;
case '(':
if (flags & USE_SIGN)
return B_BAD_VALUE;
flags |= USE_SIGN | NEG_IN_PARENTHESES;
break;
case '^':
flags &= ~USE_GROUPING;
break;
case '!':
flags |= NO_CURRENCY;
break;
case '-':
flags |= LEFT_JUSTIFIED;
break;
default:
mode = 1;
}
}
// width
if (isdigit(*format))
width = parseNumber(&format);
// left precision
if (*format == '#') {
format++;
if (!isdigit(*format))
return B_BAD_VALUE;
leftPrecision = parseNumber(&format);
}
// right precision
if (*format == '.') {
format++;
if (!isdigit(*format))
return B_BAD_VALUE;
rightPrecision = parseNumber(&format);
}
// which currency symbol to use?
switch (*format++) {
case 'n':
// national currency symbol is the default
break;
case 'i':
flags |= USE_INT_CURRENCY;
break;
default:
return B_BAD_VALUE;
}
// adjust the default right precision value according the currency symbol
if (rightPrecision == -1) {
rightPrecision = flags & USE_INT_CURRENCY ? lconv->int_frac_digits : lconv->frac_digits;
if (rightPrecision == CHAR_MAX)
rightPrecision = 2;
}
double value = va_arg(args,double);
if (value < 0) {
isNegative = true;
value = -value;
}
if (leftPrecision + rightPrecision > 255)
return B_BAD_VALUE;
char number[256];
sprintf(number, "%*.*f", (int)leftPrecision, (int)rightPrecision,
value);
if (leftPrecision >= 0) {
}
}
return B_OK;
}
ssize_t
strfmon(char *string, size_t maxSize, const char *format, ...)
{
va_list args;
va_start(args, format);
ssize_t status = vstrfmon(string, maxSize, format, args);
va_end(args);
if (status < B_OK) {
errno = status;
return -1;
}
return status;
}

View File

@ -331,7 +331,8 @@ const static uint32 kMsgRevert = 'revt';
LocaleWindow::LocaleWindow(BRect rect)
: BWindow(rect, "Locale", B_TITLED_WINDOW,
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS)
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS
| B_AUTO_UPDATE_SIZE_LIMITS)
{
SetLayout(new BGroupLayout(B_HORIZONTAL));