ObjFW  Diff

Differences From Artifact [d924c68c15]:

To Artifact [c0f38ac196]:


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

#import "OFInitializationFailedException.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidEncodingException.h"
#import "OFOpenItemFailedException.h"

#ifdef OF_AMIGAOS
# ifdef OF_AMIGAOS4
#  define __NOLIBBASE__
#  define __NOGLOBALIFACE__
#  define __USE_INLINE__
# endif
# include <proto/dos.h>
# include <proto/exec.h>
# include <proto/locale.h>
#endif

static OFLocale *currentLocale = nil;

#ifdef OF_AMIGAOS4
extern struct ExecIFace *IExec;
static struct Library *DOSBase = NULL;
static struct DOSIFace *IDOS = NULL;
static struct Library *LocaleBase = NULL;
static struct LocaleIFace *ILocale = NULL;

OF_DESTRUCTOR()
{
	if (ILocale != NULL)
		DropInterface((struct Interface *)ILocale);

	if (LocaleBase != NULL)
		CloseLibrary(LocaleBase);

	if (IDOS != NULL)
		DropInterface((struct Interface *)IDOS);

	if (DOSBase != NULL)
		CloseLibrary(DOSBase);
}
#endif

#ifndef OF_AMIGAOS
static void
parseLocale(char *locale, of_string_encoding_t *encoding,
    OFString **language, OFString **territory)
{
	if ((locale = of_strdup(locale)) == NULL)
		return;







<
<
<
<
<







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







26
27
28
29
30
31
32





33
34
35
36
37
38
39























40
41
42
43
44
45
46

#import "OFInitializationFailedException.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidEncodingException.h"
#import "OFOpenItemFailedException.h"

#ifdef OF_AMIGAOS





# include <proto/dos.h>
# include <proto/exec.h>
# include <proto/locale.h>
#endif

static OFLocale *currentLocale = nil;
























#ifndef OF_AMIGAOS
static void
parseLocale(char *locale, of_string_encoding_t *encoding,
    OFString **language, OFString **territory)
{
	if ((locale = of_strdup(locale)) == NULL)
		return;
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
}
#endif

@implementation OFLocale
@synthesize language = _language, territory = _territory, encoding = _encoding;
@synthesize decimalPoint = _decimalPoint;

#ifdef OF_AMIGAOS4
+ (void)initialize
{
	if (self != [OFLocale class])
		return;

	if ((DOSBase = OpenLibrary("dos.library", 36)) == NULL)
		@throw [OFInitializationFailedException
		    exceptionWithClass: self];

	if ((IDOS = (struct DOSIFace *)
	    GetInterface(DOSBase, "main", 1, NULL)) == NULL)
		@throw [OFInitializationFailedException
		    exceptionWithClass: self];

	if ((LocaleBase = OpenLibrary("locale.library", 38)) == NULL)
		@throw [OFInitializationFailedException
		    exceptionWithClass: self];

	if ((ILocale = (struct LocaleIFace *)
	    GetInterface(LocaleBase, "main", 1, NULL)) == NULL)
		@throw [OFInitializationFailedException
		    exceptionWithClass: self];
}
#endif

+ (OFLocale *)currentLocale
{
	return currentLocale;
}

+ (OFString *)language
{







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







84
85
86
87
88
89
90


























91
92
93
94
95
96
97
}
#endif

@implementation OFLocale
@synthesize language = _language, territory = _territory, encoding = _encoding;
@synthesize decimalPoint = _decimalPoint;



























+ (OFLocale *)currentLocale
{
	return currentLocale;
}

+ (OFString *)language
{