1 /* Copyright (c) 2006-2007 Christopher J. W. Lloyd
3 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
9 #import <Foundation/NSObject.h>
10 #import <Foundation/NSDate.h>
11 #import <Foundation/NSError.h>
13 @
class NSTimeZone
, NSThread
, NSInputSource
, NSInputSourceSet
, NSError
;
15 FOUNDATION_EXPORT NSString
*const NSPlatformExecutableFileExtension
;
16 FOUNDATION_EXPORT NSString
*const NSPlatformLoadableObjectFileExtension
;
17 FOUNDATION_EXPORT NSString
*const NSPlatformLoadableObjectFilePrefix
;
18 FOUNDATION_EXPORT NSString
*const NSPlatformExecutableDirectory
;
19 FOUNDATION_EXPORT NSString
*const NSPlatformResourceNameSuffix
;
21 @interface NSPlatform
: NSObject
25 - (NSInputSource
*)parentDeathInputSource
;
29 - (Class
)socketPortClass
;
32 - (Class
)recursiveLockClass
;
33 - (Class
)conditionLockClass
;
34 - (Class
)persistantDomainClass
;
35 - (Class
)timeZoneClass
;
36 - (Class
)conditionClass
;
38 - (NSString
*)userName
;
39 - (NSString
*)fullUserName
;
40 - (NSString
*)homeDirectory
;
41 - (NSString
*)libraryDirectory
;
42 - (NSString
*)temporaryDirectory
;
44 - (NSArray
*)arguments
;
45 - (NSDictionary
*)environment
;
47 - (NSString
*)hostName
;
49 - (NSString
*)DNSHostName
;
50 - (NSArray
*)addressesForDNSHostName
:(NSString
*)name
;
51 - (NSString
*)hostNameByAddress
:(NSString
*)address
;
53 - (void *)mapContentsOfFile
:(NSString
*)path length
:(NSUInteger
*)length
;
54 - (void)unmapAddress
:(void *)ptr length
:(NSUInteger
)length
;
56 - (BOOL
)writeContentsOfFile
:(NSString
*)path bytes
:(const void *)bytes length
:(NSUInteger
)length options
:(NSUInteger
)options error
:(NSError
**)errorp
;
58 - (void)checkEnvironmentKey
:(NSString
*)key value
:(NSString
*)value
;
61 FOUNDATION_EXPORT
int NSPlatformProcessorCount();
62 FOUNDATION_EXPORT
int NSPlatformProcessID();
63 FOUNDATION_EXPORT NSUInteger
NSPlatformThreadID();
64 FOUNDATION_EXPORT NSTimeInterval
NSPlatformTimeIntervalSinceReferenceDate();
65 FOUNDATION_EXPORT
void NSPlatformLogString(NSString
*string
);
66 FOUNDATION_EXPORT
void NSPlatformSleepThreadForTimeInterval(NSTimeInterval interval
);
67 FOUNDATION_EXPORT
void *NSPlatformContentsOfFile(NSString
*path
, NSUInteger
*length
);
69 // These functions are implemented in the platform subproject
71 NSThread
*NSPlatformCurrentThread();
72 void NSPlatformSetCurrentThread(NSThread
*thread
);
74 NSUInteger
NSPlatformDetachThread(unsigned (*__stdcall func
)(void *arg
), void *arg
, NSError
**errorp
);
76 NSUInteger
NSPlatformDetachThread(void *(*func
)(void *arg
), void *arg
, NSError
**errorp
);