ObjFW  Check-in [0abbcb442c]

Overview
Comment:Rename OF_MAC_OS_X define to OF_MACOS
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 0abbcb442c50f245a863754d0f9f45dae3b8d4911d7364a8a4e0f194b6f95869
User & Date: js on 2017-02-26 15:38:19
Other Links: manifest | tags
Context
2017-02-26
15:38
Update PLATFORMS.md check-in: 23b20ade3f user: js tags: trunk
15:38
Rename OF_MAC_OS_X define to OF_MACOS check-in: 0abbcb442c user: js tags: trunk
15:34
Update README.md check-in: e8b1d00205 user: js tags: trunk
Changes

Modified src/OFApplication.m from [735d2c61f2] to [2a2a047c69].

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#import "OFRunLoop+Private.h"
#import "OFThread.h"
#import "OFThread+Private.h"

#import "OFOutOfMemoryException.h"
#import "OFOutOfRangeException.h"

#if defined(OF_MAC_OS_X)
# include <crt_externs.h>
#elif defined(OF_WINDOWS)
# include <windows.h>

extern int _CRT_glob;
extern void __wgetmainargs(int*, wchar_t***, wchar_t***, int, int*);
#elif !defined(OF_IOS)







|







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#import "OFRunLoop+Private.h"
#import "OFThread.h"
#import "OFThread+Private.h"

#import "OFOutOfMemoryException.h"
#import "OFOutOfRangeException.h"

#if defined(OF_MACOS)
# include <crt_externs.h>
#elif defined(OF_WINDOWS)
# include <windows.h>

extern int _CRT_glob;
extern void __wgetmainargs(int*, wchar_t***, wchar_t***, int, int*);
#elif !defined(OF_IOS)
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
- init
{
	self = [super init];

	@try {
		void *pool;
		OFMutableDictionary *environment;
#if defined(OF_MAC_OS_X)
		char **env = *_NSGetEnviron();
#elif defined(OF_WINDOWS)
		of_char16_t *env, *env0;
#elif !defined(OF_IOS)
		char **env = environ;
#else
		char *env;







|







189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
- init
{
	self = [super init];

	@try {
		void *pool;
		OFMutableDictionary *environment;
#if defined(OF_MACOS)
		char **env = *_NSGetEnviron();
#elif defined(OF_WINDOWS)
		of_char16_t *env, *env0;
#elif !defined(OF_IOS)
		char **env = environ;
#else
		char *env;

Modified src/OFSystemInfo.m from [4830f6e850] to [3184c9a0c5].

24
25
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
# undef __USE_XOPEN
#endif

#include <unistd.h>

#include "platform.h"

#ifdef OF_MAC_OS_X
# include <sys/sysctl.h>
#endif

#import "OFSystemInfo.h"
#import "OFString.h"
#import "OFArray.h"
#import "OFDictionary.h"
#import "OFApplication.h"

#import "OFNotImplementedException.h"

#if defined(OF_MAC_OS_X) || defined(OF_IOS)
# ifdef HAVE_SYSDIR_H
#  include <sysdir.h>
# else
#  include <NSSystemDirectories.h>
# endif
#endif
#ifdef OF_WINDOWS







|











|







24
25
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
# undef __USE_XOPEN
#endif

#include <unistd.h>

#include "platform.h"

#ifdef OF_MACOS
# include <sys/sysctl.h>
#endif

#import "OFSystemInfo.h"
#import "OFString.h"
#import "OFArray.h"
#import "OFDictionary.h"
#import "OFApplication.h"

#import "OFNotImplementedException.h"

#if defined(OF_MACOS) || defined(OF_IOS)
# ifdef HAVE_SYSDIR_H
#  include <sysdir.h>
# else
#  include <NSSystemDirectories.h>
# endif
#endif
#ifdef OF_WINDOWS
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
+ (size_t)numberOfCPUs
{
	return numberOfCPUs;
}

+ (OFString*)userDataPath
{
#if defined(OF_MAC_OS_X) || defined(OF_IOS)
	void *pool = objc_autoreleasePoolPush();
	char pathC[PATH_MAX];
	OFMutableString *path;
	OFString *home;

# ifdef HAVE_SYSDIR_START_SEARCH_PATH_ENUMERATION
	sysdir_search_path_enumeration_state state;







|







141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
+ (size_t)numberOfCPUs
{
	return numberOfCPUs;
}

+ (OFString*)userDataPath
{
#if defined(OF_MACOS) || defined(OF_IOS)
	void *pool = objc_autoreleasePoolPush();
	char pathC[PATH_MAX];
	OFMutableString *path;
	OFString *home;

# ifdef HAVE_SYSDIR_START_SEARCH_PATH_ENUMERATION
	sysdir_search_path_enumeration_state state;
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
	objc_autoreleasePoolPop(pool);
	return [var autorelease];
#endif
}

+ (OFString*)userConfigPath
{
#if defined(OF_MAC_OS_X) || defined(OF_IOS)
	void *pool = objc_autoreleasePoolPush();
	char pathC[PATH_MAX];
	OFMutableString *path;
	OFString *home;

# ifdef HAVE_SYSDIR_START_SEARCH_PATH_ENUMERATION
	sysdir_search_path_enumeration_state state;







|







231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
	objc_autoreleasePoolPop(pool);
	return [var autorelease];
#endif
}

+ (OFString*)userConfigPath
{
#if defined(OF_MACOS) || defined(OF_IOS)
	void *pool = objc_autoreleasePoolPush();
	char pathC[PATH_MAX];
	OFMutableString *path;
	OFString *home;

# ifdef HAVE_SYSDIR_START_SEARCH_PATH_ENUMERATION
	sysdir_search_path_enumeration_state state;
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
	return x86_cpuid(0, 0).eax >= 7 && (x86_cpuid(7, 0).ebx & (1 << 5));
}
#endif

#if defined(OF_POWERPC) || defined(OF_POWERPC64)
+ (bool)supportsAltiVec
{
# ifdef OF_MAC_OS_X
	int name[2] = { CTL_HW, HW_VECTORUNIT }, value = 0;
	size_t length = sizeof(value);

	if (sysctl(name, 2, &value, &length, NULL, 0) == 0)
		return value;
# endif

	return 0;
}
#endif
@end







|











391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
	return x86_cpuid(0, 0).eax >= 7 && (x86_cpuid(7, 0).ebx & (1 << 5));
}
#endif

#if defined(OF_POWERPC) || defined(OF_POWERPC64)
+ (bool)supportsAltiVec
{
# ifdef OF_MACOS
	int name[2] = { CTL_HW, HW_VECTORUNIT }, value = 0;
	size_t length = sizeof(value);

	if (sysctl(name, 2, &value, &length, NULL, 0) == 0)
		return value;
# endif

	return 0;
}
#endif
@end

Modified src/platform.h from [35537a45b9] to [f09a565791].

74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
#  define OF_IOS
/*
 * iOS has the functions, so configure will find them, but they cannot be used.
 */
#  undef OF_HAVE_PROCESSES
# else
#  define OF_MAC_OS_X
# endif
#elif defined(__linux__)
# define OF_LINUX
#elif defined(_WIN32)
# define OF_WINDOWS
#elif defined(__NetBSD__)
# define OF_NETBSD







|







74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
#  define OF_IOS
/*
 * iOS has the functions, so configure will find them, but they cannot be used.
 */
#  undef OF_HAVE_PROCESSES
# else
#  define OF_MACOS
# endif
#elif defined(__linux__)
# define OF_LINUX
#elif defined(_WIN32)
# define OF_WINDOWS
#elif defined(__NetBSD__)
# define OF_NETBSD

Modified src/threading_pthread.m from [39237b073e] to [7669b743f6].

179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
of_thread_set_name(of_thread_t thread, const char *name)
{
#if defined(OF_HAIKU)
	rename_thread(get_pthread_thread_id(thread), name);
#elif defined(HAVE_PTHREAD_SET_NAME_NP)
	pthread_set_name_np(pthread_self(), name);
#elif defined(HAVE_PTHREAD_SETNAME_NP)
# if defined(OF_MAC_OS_X) || defined(OF_IOS)
	pthread_setname_np(name);
# elif defined(__GLIBC__)
	char buffer[16];

	strncpy(buffer, name, 15);
	buffer[15] = 0;








|







179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
of_thread_set_name(of_thread_t thread, const char *name)
{
#if defined(OF_HAIKU)
	rename_thread(get_pthread_thread_id(thread), name);
#elif defined(HAVE_PTHREAD_SET_NAME_NP)
	pthread_set_name_np(pthread_self(), name);
#elif defined(HAVE_PTHREAD_SETNAME_NP)
# if defined(OF_MACOS) || defined(OF_IOS)
	pthread_setname_np(name);
# elif defined(__GLIBC__)
	char buffer[16];

	strncpy(buffer, name, 15);
	buffer[15] = 0;