Index: ObjFW.xcodeproj/project.pbxproj ================================================================== --- ObjFW.xcodeproj/project.pbxproj +++ ObjFW.xcodeproj/project.pbxproj @@ -279,10 +279,17 @@ 4B674402163C395900EB1E59 /* OFLocking.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6743F9163C395900EB1E59 /* OFLocking.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4B674403163C395900EB1E59 /* OFMutex.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6743FA163C395900EB1E59 /* OFMutex.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4B674404163C395900EB1E59 /* OFMutex.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6743FB163C395900EB1E59 /* OFMutex.m */; }; 4B674405163C395900EB1E59 /* OFRecursiveMutex.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6743FC163C395900EB1E59 /* OFRecursiveMutex.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4B674406163C395900EB1E59 /* OFRecursiveMutex.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6743FD163C395900EB1E59 /* OFRecursiveMutex.m */; }; + 4B6C8AD817BD5C2E00B194F2 /* OFRunLoop+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C8AD117BD5C2E00B194F2 /* OFRunLoop+Private.h */; }; + 4B6C8AD917BD5C2E00B194F2 /* OFStream+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C8AD217BD5C2E00B194F2 /* OFStream+Private.h */; }; + 4B6C8ADA17BD5C2E00B194F2 /* OFStreamObserver+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C8AD317BD5C2E00B194F2 /* OFStreamObserver+Private.h */; }; + 4B6C8ADB17BD5C2E00B194F2 /* OFString_UTF8+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C8AD417BD5C2E00B194F2 /* OFString_UTF8+Private.h */; }; + 4B6C8ADC17BD5C2E00B194F2 /* OFThread+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C8AD517BD5C2E00B194F2 /* OFThread+Private.h */; }; + 4B6C8ADD17BD5C2E00B194F2 /* OFTimer+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C8AD617BD5C2E00B194F2 /* OFTimer+Private.h */; }; + 4B6C8ADE17BD5C2E00B194F2 /* OFZIPArchiveEntry+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C8AD717BD5C2E00B194F2 /* OFZIPArchiveEntry+Private.h */; }; 4B7161AD17A6FC7600B74970 /* OFHTTPResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B7161AB17A6FC7600B74970 /* OFHTTPResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4B7161AE17A6FC7600B74970 /* OFHTTPResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B7161AC17A6FC7600B74970 /* OFHTTPResponse.m */; }; 4B745BA5168B25E600A6C20E /* OFSystemInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B745BA3168B25E600A6C20E /* OFSystemInfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4B745BA6168B25E600A6C20E /* OFSystemInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B745BA4168B25E600A6C20E /* OFSystemInfo.m */; }; 4B7FF3B4133CED6200000324 /* OFConditionStillWaitingException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B7FF3B2133CED6100000324 /* OFConditionStillWaitingException.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -676,10 +683,17 @@ 4B67998C1099E7C50041064A /* unicode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = unicode.h; path = src/unicode.h; sourceTree = ""; }; 4B6AF96C10A8D3E40003FB0A /* asprintf.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = asprintf.m; path = src/asprintf.m; sourceTree = ""; }; 4B6AF96F10A8D40E0003FB0A /* iso_8859_15.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = iso_8859_15.m; path = src/iso_8859_15.m; sourceTree = ""; }; 4B6AF97210A8D42E0003FB0A /* windows_1252.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = windows_1252.m; path = src/windows_1252.m; sourceTree = ""; }; 4B6AF97310A8D4450003FB0A /* ObjFW.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ObjFW.h; path = src/ObjFW.h; sourceTree = ""; }; + 4B6C8AD117BD5C2E00B194F2 /* OFRunLoop+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "OFRunLoop+Private.h"; path = "src/OFRunLoop+Private.h"; sourceTree = ""; }; + 4B6C8AD217BD5C2E00B194F2 /* OFStream+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "OFStream+Private.h"; path = "src/OFStream+Private.h"; sourceTree = ""; }; + 4B6C8AD317BD5C2E00B194F2 /* OFStreamObserver+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "OFStreamObserver+Private.h"; path = "src/OFStreamObserver+Private.h"; sourceTree = ""; }; + 4B6C8AD417BD5C2E00B194F2 /* OFString_UTF8+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "OFString_UTF8+Private.h"; path = "src/OFString_UTF8+Private.h"; sourceTree = ""; }; + 4B6C8AD517BD5C2E00B194F2 /* OFThread+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "OFThread+Private.h"; path = "src/OFThread+Private.h"; sourceTree = ""; }; + 4B6C8AD617BD5C2E00B194F2 /* OFTimer+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "OFTimer+Private.h"; path = "src/OFTimer+Private.h"; sourceTree = ""; }; + 4B6C8AD717BD5C2E00B194F2 /* OFZIPArchiveEntry+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "OFZIPArchiveEntry+Private.h"; path = "src/OFZIPArchiveEntry+Private.h"; sourceTree = ""; }; 4B6EF66E1235358D0076B512 /* OFArrayTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFArrayTests.m; path = tests/OFArrayTests.m; sourceTree = SOURCE_ROOT; }; 4B6EF66F1235358D0076B512 /* OFDataArrayTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFDataArrayTests.m; path = tests/OFDataArrayTests.m; sourceTree = SOURCE_ROOT; }; 4B6EF6701235358D0076B512 /* OFDictionaryTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFDictionaryTests.m; path = tests/OFDictionaryTests.m; sourceTree = SOURCE_ROOT; }; 4B6EF6721235358D0076B512 /* OFListTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFListTests.m; path = tests/OFListTests.m; sourceTree = SOURCE_ROOT; }; 4B6EF6731235358D0076B512 /* OFMD5HashTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFMD5HashTests.m; path = tests/OFMD5HashTests.m; sourceTree = SOURCE_ROOT; }; @@ -1180,10 +1194,11 @@ 4BB524C0143D1E4E0085FBCC /* OFProcess.m */, 4B6743FC163C395900EB1E59 /* OFRecursiveMutex.h */, 4B6743FD163C395900EB1E59 /* OFRecursiveMutex.m */, 4B325ED91605F3A0007836CA /* OFRunLoop.h */, 4B325EDA1605F3A0007836CA /* OFRunLoop.m */, + 4B6C8AD117BD5C2E00B194F2 /* OFRunLoop+Private.h */, 4B981CDE116F71DD00294DB7 /* OFSeekableStream.h */, 4B981CDF116F71DD00294DB7 /* OFSeekableStream.m */, 4B989C2E13771A3700109A30 /* OFSerialization.h */, 4B39844013D3A24600E6F825 /* OFSet.h */, 4B39844113D3A24600E6F825 /* OFSet.m */, @@ -1195,12 +1210,14 @@ 4B141BA315FCDF74000C21A8 /* OFSortedList.m */, 4B0256E2172B60400062B5F1 /* OFStdIOStream.h */, 4B0256E3172B60400062B5F1 /* OFStdIOStream.m */, 4B67997D1099E7C50041064A /* OFStream.h */, 4B67997E1099E7C50041064A /* OFStream.m */, + 4B6C8AD217BD5C2E00B194F2 /* OFStream+Private.h */, 4BAF5F47123460C900F4E111 /* OFStreamObserver.h */, 4BAF5F48123460C900F4E111 /* OFStreamObserver.m */, + 4B6C8AD317BD5C2E00B194F2 /* OFStreamObserver+Private.h */, 4B83F0F2142FDEFD00E4A821 /* OFStreamObserver_kqueue.h */, 4B83F0F3142FDEFD00E4A821 /* OFStreamObserver_kqueue.m */, 4B64D6EB1425381E007BDFB1 /* OFStreamObserver_poll.h */, 4B64D6EC1425381E007BDFB1 /* OFStreamObserver_poll.m */, 4B64D6ED1425381E007BDFB1 /* OFStreamObserver_select.h */, @@ -1221,22 +1238,25 @@ 4BF1BCCB11C9663F0025511F /* OFString+XMLEscaping.m */, 4BF1BCCC11C9663F0025511F /* OFString+XMLUnescaping.h */, 4BF1BCCD11C9663F0025511F /* OFString+XMLUnescaping.m */, 4B552550147AA5DB0003BF47 /* OFString_UTF8.h */, 4B552551147AA5DB0003BF47 /* OFString_UTF8.m */, + 4B6C8AD417BD5C2E00B194F2 /* OFString_UTF8+Private.h */, 4B745BA3168B25E600A6C20E /* OFSystemInfo.h */, 4B745BA4168B25E600A6C20E /* OFSystemInfo.m */, 4B6799811099E7C50041064A /* OFTCPSocket.h */, 4B6799821099E7C50041064A /* OFTCPSocket.m */, 4BD653C3143B8489006182F0 /* OFTCPSocket+SOCKS5.h */, 4BD653C4143B8489006182F0 /* OFTCPSocket+SOCKS5.m */, 4B6799831099E7C50041064A /* OFThread.h */, 4B6799841099E7C50041064A /* OFThread.m */, + 4B6C8AD517BD5C2E00B194F2 /* OFThread+Private.h */, 4B9361A61511000C00DCD16B /* OFThreadPool.h */, 4B9361A71511000C00DCD16B /* OFThreadPool.m */, 4B325EDB1605F3A0007836CA /* OFTimer.h */, 4B325EDC1605F3A0007836CA /* OFTimer.m */, + 4B6C8AD617BD5C2E00B194F2 /* OFTimer+Private.h */, 4BA02BA015041F5900002F84 /* OFTLSSocket.h */, 4B4A61F212DF5EA20048F3F2 /* OFURL.h */, 4B4A61F312DF5EA20048F3F2 /* OFURL.m */, 4BF1BCCE11C9663F0025511F /* OFXMLAttribute.h */, 4BF1BCCF11C9663F0025511F /* OFXMLAttribute.m */, @@ -1260,10 +1280,11 @@ 4B48B95314DC23B100546D39 /* OFXMLProcessingInstructions.m */, 4BE52D1F17B990B4005958D1 /* OFZIPArchive.h */, 4BE52D2017B990B4005958D1 /* OFZIPArchive.m */, 4B8B025717BBA7C7009ED983 /* OFZIPArchiveEntry.h */, 4B8B025817BBA7C7009ED983 /* OFZIPArchiveEntry.m */, + 4B6C8AD717BD5C2E00B194F2 /* OFZIPArchiveEntry+Private.h */, 4B6AF97310A8D4450003FB0A /* ObjFW.h */, 4BB52CC817B8EA8E00B7EBF5 /* apple-forwarding-arm.S */, 4BB52CC917B8EA8E00B7EBF5 /* apple-forwarding-i386.S */, 4BB52CCA17B8EA8E00B7EBF5 /* apple-forwarding-ppc.S */, 4BB52CCB17B8EA8E00B7EBF5 /* apple-forwarding-x86_64.S */, @@ -1551,16 +1572,23 @@ 4B2B3E7F140D430500EC2F7C /* OFDictionary_hashtable.h in Headers */, 4B2B3E81140D430500EC2F7C /* OFMutableArray_adjacent.h in Headers */, 4B2B3E83140D430500EC2F7C /* OFMutableDictionary_hashtable.h in Headers */, 4BA85BCC140ECCE800E91D51 /* OFMutableSet_hashtable.h in Headers */, 4B552552147AA5DB0003BF47 /* OFMutableString_UTF8.h in Headers */, + 4B6C8AD817BD5C2E00B194F2 /* OFRunLoop+Private.h in Headers */, 4BA85BCE140ECCE800E91D51 /* OFSet_hashtable.h in Headers */, + 4B6C8AD917BD5C2E00B194F2 /* OFStream+Private.h in Headers */, + 4B6C8ADA17BD5C2E00B194F2 /* OFStreamObserver+Private.h in Headers */, 4B83F0F4142FDEFD00E4A821 /* OFStreamObserver_kqueue.h in Headers */, 4B64D6EF1425381E007BDFB1 /* OFStreamObserver_poll.h in Headers */, 4B64D6F11425381E007BDFB1 /* OFStreamObserver_select.h in Headers */, 4B552554147AA5DB0003BF47 /* OFString_UTF8.h in Headers */, + 4B6C8ADB17BD5C2E00B194F2 /* OFString_UTF8+Private.h in Headers */, 4BD653C5143B8489006182F0 /* OFTCPSocket+SOCKS5.h in Headers */, + 4B6C8ADC17BD5C2E00B194F2 /* OFThread+Private.h in Headers */, + 4B6C8ADD17BD5C2E00B194F2 /* OFTimer+Private.h in Headers */, + 4B6C8ADE17BD5C2E00B194F2 /* OFZIPArchiveEntry+Private.h in Headers */, 4BDF37B51338055600F9A81A /* config.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ Index: src/OFApplication.h ================================================================== --- src/OFApplication.h +++ src/OFApplication.h @@ -167,17 +167,10 @@ * * @param status The status with which the application will terminate */ + (void)terminateWithStatus: (int)status; -- (void)OF_setArgumentCount: (int*)argc - andArgumentValues: (char**[])argv; -#ifdef _WIN32 -- (void)OF_setArgumentCount: (int)argc - andWideArgumentValues: (wchar_t*[])argv; -#endif - /*! * @brief Gets args and argv. * * @param argc A pointer where a pointer to argc should be stored * @param argv A pointer where a pointer to argv should be stored @@ -218,12 +211,10 @@ * * @param delegate The delegate for the application */ - (void)setDelegate: (id )delegate; -- (void)OF_run; - /*! * @brief Terminates the application. */ - (void)terminate; Index: src/OFApplication.m ================================================================== --- src/OFApplication.m +++ src/OFApplication.m @@ -25,11 +25,13 @@ #import "OFApplication.h" #import "OFString.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFRunLoop.h" +#import "OFRunLoop+Private.h" #import "OFThread.h" +#import "OFThread+Private.h" #import "autorelease.h" #import "macros.h" #if defined(__MACH__) && !defined(OF_IOS) @@ -45,10 +47,20 @@ #ifdef _PSP # include # include #endif + +@interface OFApplication (OF_PRIVATE_CATEGORY) +- (void)OF_setArgumentCount: (int*)argc + andArgumentValues: (char**[])argv; +#ifdef _WIN32 +- (void)OF_setArgumentCount: (int)argc + andWideArgumentValues: (wchar_t*[])argv; +#endif +- (void)OF_run; +@end static OFApplication *app = nil; static void atexit_handler(void) Index: src/OFHTTPServer.h ================================================================== --- src/OFHTTPServer.h +++ src/OFHTTPServer.h @@ -151,13 +151,9 @@ * @brief Stops the HTTP server, meaning it will not accept any new incoming * connections, but still handle existing connections until they are * finished or timed out. */ - (void)stop; - -- (bool)OF_socket: (OFTCPSocket*)socket - didAcceptSocket: (OFTCPSocket*)clientSocket - exception: (OFException*)exception; @end @interface OFObject (OFHTTPServerDelegate) @end Index: src/OFHTTPServer.m ================================================================== --- src/OFHTTPServer.m +++ src/OFHTTPServer.m @@ -44,10 +44,16 @@ /* * FIXME: Key normalization replaces headers like "DNT" with "Dnt". * FIXME: Errors are not reported to the user. */ + +@interface OFHTTPServer (OF_PRIVATE_CATEGORY) +- (bool)OF_socket: (OFTCPSocket*)socket + didAcceptSocket: (OFTCPSocket*)clientSocket + exception: (OFException*)exception; +@end static const char* status_code_to_string(short code) { switch (code) { Index: src/OFMapTable.h ================================================================== --- src/OFMapTable.h +++ src/OFMapTable.h @@ -134,14 +134,10 @@ * @param key The key whose object should be returned * @return The value for the given key or nil if the key was not found */ - (void*)valueForKey: (void*)key; -- (void)OF_setValue: (void*)value - forKey: (void*)key - hash: (uint32_t)hash; - /*! * @brief Sets a value for a key. * * @param key The key to set * @param value The value to set the key to @@ -240,15 +236,10 @@ unsigned long _mutations; unsigned long *_mutationsPtr; uint32_t _position; } -- OF_initWithMapTable: (OFMapTable*)mapTable - buckets: (struct of_map_table_bucket**)buckets - capacity: (uint32_t)capacity - mutationsPointer: (unsigned long*)mutationsPtr; - /*! * @brief Returns the next value. * * @return The next value */ Index: src/OFMapTable.m ================================================================== --- src/OFMapTable.m +++ src/OFMapTable.m @@ -58,10 +58,23 @@ static bool default_equal(void *value1, void *value2) { return (value1 == value2); } + +@interface OFMapTable (OF_PRIVATE_CATEGORY) +- (void)OF_setValue: (void*)value + forKey: (void*)key + hash: (uint32_t)hash; +@end + +@interface OFMapTableEnumerator (OF_PRIVATE_CATEGORY) +- OF_initWithMapTable: (OFMapTable*)mapTable + buckets: (struct of_map_table_bucket**)buckets + capacity: (uint32_t)capacity + mutationsPointer: (unsigned long*)mutationsPtr; +@end @interface OFMapTableKeyEnumerator: OFMapTableEnumerator @end @interface OFMapTableValueEnumerator: OFMapTableEnumerator Index: src/OFProcess.h ================================================================== --- src/OFProcess.h +++ src/OFProcess.h @@ -162,20 +162,14 @@ - initWithProgram: (OFString*)program programName: (OFString*)programName arguments: (OFArray*)arguments environment: (OFDictionary*)environment; -#ifndef _WIN32 -- (char**)OF_environmentForDictionary: (OFDictionary*)dictionary; -#else -- (of_char16_t*)OF_environmentForDictionary: (OFDictionary*)dictionary; -#endif - /*! * @brief Closes the write direction of the process. * * This method needs to be called for some programs before data can be read, * since some programs don't start processing before the write direction is * closed. */ - (void)closeForWriting; @end Index: src/OFProcess.m ================================================================== --- src/OFProcess.m +++ src/OFProcess.m @@ -46,10 +46,18 @@ #import "autorelease.h" #ifndef __MACH__ extern char **environ; #endif + +@interface OFProcess (OF_PRIVATE_CATEGORY) +#ifndef _WIN32 +- (char**)OF_environmentForDictionary: (OFDictionary*)dictionary; +#else +- (of_char16_t*)OF_environmentForDictionary: (OFDictionary*)dictionary; +#endif +@end @implementation OFProcess + (instancetype)processWithProgram: (OFString*)program { return [[[self alloc] initWithProgram: program] autorelease]; ADDED src/OFRunLoop+Private.h Index: src/OFRunLoop+Private.h ================================================================== --- src/OFRunLoop+Private.h +++ src/OFRunLoop+Private.h @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#import "OFRunLoop.h" + +#import "macros.h" + +@interface OFRunLoop (OF_PRIVATE_CATEGORY) ++ (void)OF_setMainRunLoop: (OFRunLoop*)runLoop; +#ifdef OF_HAVE_SOCKETS ++ (void)OF_addAsyncReadForStream: (OFStream*)stream + buffer: (void*)buffer + length: (size_t)length + target: (id)target + selector: (SEL)selector; ++ (void)OF_addAsyncReadForStream: (OFStream*)stream + buffer: (void*)buffer + exactLength: (size_t)length + target: (id)target + selector: (SEL)selector; ++ (void)OF_addAsyncReadLineForStream: (OFStream*)stream + encoding: (of_string_encoding_t)encoding + target: (id)target + selector: (SEL)selector; ++ (void)OF_addAsyncAcceptForTCPSocket: (OFTCPSocket*)socket + target: (id)target + selector: (SEL)selector; +# ifdef OF_HAVE_BLOCKS ++ (void)OF_addAsyncReadForStream: (OFStream*)stream + buffer: (void*)buffer + length: (size_t)length + block: (of_stream_async_read_block_t)block; ++ (void)OF_addAsyncReadForStream: (OFStream*)stream + buffer: (void*)buffer + exactLength: (size_t)length + block: (of_stream_async_read_block_t)block; ++ (void)OF_addAsyncReadLineForStream: (OFStream*)stream + encoding: (of_string_encoding_t)encoding + block: (of_stream_async_read_line_block_t)block; ++ (void)OF_addAsyncAcceptForTCPSocket: (OFTCPSocket*)socket + block: (of_tcpsocket_async_accept_block_t)block; +# endif ++ (void)OF_cancelAsyncRequestsForStream: (OFStream*)stream; +#endif +- (void)OF_removeTimer: (OFTimer*)timer; +@end Index: src/OFRunLoop.h ================================================================== --- src/OFRunLoop.h +++ src/OFRunLoop.h @@ -61,56 +61,17 @@ * * @return The run loop for the current thread */ + (OFRunLoop*)currentRunLoop; -+ (void)OF_setMainRunLoop: (OFRunLoop*)runLoop; -#ifdef OF_HAVE_SOCKETS -+ (void)OF_addAsyncReadForStream: (OFStream*)stream - buffer: (void*)buffer - length: (size_t)length - target: (id)target - selector: (SEL)selector; -+ (void)OF_addAsyncReadForStream: (OFStream*)stream - buffer: (void*)buffer - exactLength: (size_t)length - target: (id)target - selector: (SEL)selector; -+ (void)OF_addAsyncReadLineForStream: (OFStream*)stream - encoding: (of_string_encoding_t)encoding - target: (id)target - selector: (SEL)selector; -+ (void)OF_addAsyncAcceptForTCPSocket: (OFTCPSocket*)socket - target: (id)target - selector: (SEL)selector; -# ifdef OF_HAVE_BLOCKS -+ (void)OF_addAsyncReadForStream: (OFStream*)stream - buffer: (void*)buffer - length: (size_t)length - block: (of_stream_async_read_block_t)block; -+ (void)OF_addAsyncReadForStream: (OFStream*)stream - buffer: (void*)buffer - exactLength: (size_t)length - block: (of_stream_async_read_block_t)block; -+ (void)OF_addAsyncReadLineForStream: (OFStream*)stream - encoding: (of_string_encoding_t)encoding - block: (of_stream_async_read_line_block_t)block; -+ (void)OF_addAsyncAcceptForTCPSocket: (OFTCPSocket*)socket - block: (of_tcpsocket_async_accept_block_t)block; -# endif -+ (void)OF_cancelAsyncRequestsForStream: (OFStream*)stream; -#endif - /*! * @brief Adds an OFTimer to the run loop. * * @param timer The timer to add */ - (void)addTimer: (OFTimer*)timer; -- (void)OF_removeTimer: (OFTimer*)timer; - /*! * @brief Starts the run loop. */ - (void)run; Index: src/OFRunLoop.m ================================================================== --- src/OFRunLoop.m +++ src/OFRunLoop.m @@ -17,10 +17,11 @@ #include "config.h" #include #import "OFRunLoop.h" +#import "OFRunLoop+Private.h" #import "OFDictionary.h" #ifdef OF_HAVE_SOCKETS # import "OFStreamObserver.h" #endif #import "OFThread.h" @@ -28,10 +29,11 @@ # import "OFMutex.h" # import "OFCondition.h" #endif #import "OFSortedList.h" #import "OFTimer.h" +#import "OFTimer+Private.h" #import "OFDate.h" #import "autorelease.h" #import "macros.h" Index: src/OFStdIOStream.h ================================================================== --- src/OFStdIOStream.h +++ src/OFStdIOStream.h @@ -25,12 +25,10 @@ @interface OFStdIOStream: OFStream { int _fd; bool _atEndOfStream; } - -- (instancetype)OF_initWithFileDescriptor: (int)fd; @end #ifdef __cplusplus extern "C" { #endif Index: src/OFStdIOStream.m ================================================================== --- src/OFStdIOStream.m +++ src/OFStdIOStream.m @@ -29,10 +29,14 @@ #import "autorelease.h" OFStdIOStream *of_stdin = nil; OFStdIOStream *of_stdout = nil; OFStdIOStream *of_stderr = nil; + +@interface OFStdIOStream (OF_PRIVATE_CATEGORY) +- (instancetype)OF_initWithFileDescriptor: (int)fd; +@end void of_log(OFConstantString *format, ...) { void *pool = objc_autoreleasePoolPush(); ADDED src/OFStream+Private.h Index: src/OFStream+Private.h ================================================================== --- src/OFStream+Private.h +++ src/OFStream+Private.h @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#import "OFStream.h" + +#import "macros.h" + +@interface OFStream (OF_PRIVATE_CATEGORY) +- (bool)OF_isWaitingForDelimiter; +@end Index: src/OFStream.h ================================================================== --- src/OFStream.h +++ src/OFStream.h @@ -1093,8 +1093,6 @@ * when subclassing! * * @return Whether the lowlevel is at the end of the stream */ - (bool)lowlevelIsAtEndOfStream; - -- (bool)OF_isWaitingForDelimiter; @end Index: src/OFStream.m ================================================================== --- src/OFStream.m +++ src/OFStream.m @@ -30,14 +30,16 @@ #ifndef _WIN32 # include #endif #import "OFStream.h" +#import "OFStream+Private.h" #import "OFString.h" #import "OFDataArray.h" #import "OFSystemInfo.h" #import "OFRunLoop.h" +#import "OFRunLoop+Private.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFNotImplementedException.h" #import "OFSetOptionFailedException.h" ADDED src/OFStreamObserver+Private.h Index: src/OFStreamObserver+Private.h ================================================================== --- src/OFStreamObserver+Private.h +++ src/OFStreamObserver+Private.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#import "OFStreamObserver.h" + +#import "macros.h" + +@interface OFStreamObserver (OF_PRIVATE_CATEGORY) +- (void)OF_addFileDescriptorForReading: (int)fd; +- (void)OF_addFileDescriptorForWriting: (int)fd; +- (void)OF_removeFileDescriptorForReading: (int)fd; +- (void)OF_removeFileDescriptorForWriting: (int)fd; +- (void)OF_processQueue; +- (bool)OF_processCache; +@end Index: src/OFStreamObserver.h ================================================================== --- src/OFStreamObserver.h +++ src/OFStreamObserver.h @@ -205,16 +205,9 @@ * This is automatically done when a new stream is added or removed by another * thread, but in some circumstances, it might be desirable for a thread to * manually stop the observe running in another thread. */ - (void)cancel; - -- (void)OF_addFileDescriptorForReading: (int)fd; -- (void)OF_addFileDescriptorForWriting: (int)fd; -- (void)OF_removeFileDescriptorForReading: (int)fd; -- (void)OF_removeFileDescriptorForWriting: (int)fd; -- (void)OF_processQueue; -- (bool)OF_processCache; @end @interface OFObject (OFStreamObserverDelegate) @end Index: src/OFStreamObserver.m ================================================================== --- src/OFStreamObserver.m +++ src/OFStreamObserver.m @@ -23,13 +23,15 @@ #include #include #import "OFStreamObserver.h" +#import "OFStreamObserver+Private.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFStream.h" +#import "OFStream+Private.h" #import "OFDataArray.h" #ifndef OF_HAVE_PIPE # import "OFStreamSocket.h" #endif #ifdef OF_HAVE_THREADS Index: src/OFStreamObserver_kqueue.m ================================================================== --- src/OFStreamObserver_kqueue.m +++ src/OFStreamObserver_kqueue.m @@ -24,10 +24,12 @@ #include #include #include +#import "OFStreamObserver.h" +#import "OFStreamObserver+Private.h" #import "OFStreamObserver_kqueue.h" #import "OFDataArray.h" #import "OFInitializationFailedException.h" #import "OFOutOfMemoryException.h" Index: src/OFStreamObserver_poll.m ================================================================== --- src/OFStreamObserver_poll.m +++ src/OFStreamObserver_poll.m @@ -22,10 +22,12 @@ #ifdef HAVE_POLL_H # include #endif +#import "OFStreamObserver.h" +#import "OFStreamObserver+Private.h" #import "OFStreamObserver_poll.h" #import "OFDataArray.h" #import "OFOutOfRangeException.h" Index: src/OFStreamObserver_select.m ================================================================== --- src/OFStreamObserver_select.m +++ src/OFStreamObserver_select.m @@ -22,10 +22,12 @@ #include #include #include +#import "OFStreamObserver.h" +#import "OFStreamObserver+Private.h" #import "OFStreamObserver_select.h" #import "OFStream.h" #import "OFArray.h" #import "autorelease.h" Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -22,10 +22,11 @@ #include #import "OFString.h" #import "OFString_UTF8.h" +#import "OFString_UTF8+Private.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFFile.h" #import "OFURL.h" #ifdef OF_HAVE_SOCKETS ADDED src/OFString_UTF8+Private.h Index: src/OFString_UTF8+Private.h ================================================================== --- src/OFString_UTF8+Private.h +++ src/OFString_UTF8+Private.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#import "OFString_UTF8.h" + +#import "macros.h" + +@interface OFString_UTF8 (OF_PRIVATE_CATEGORY) +- (instancetype)OF_initWithUTF8String: (const char*)UTF8String + length: (size_t)UTF8StringLength + storage: (char*)storage; +@end Index: src/OFString_UTF8.h ================================================================== --- src/OFString_UTF8.h +++ src/OFString_UTF8.h @@ -35,14 +35,10 @@ uint32_t hash; char *freeWhenDone; } *restrict _s; struct of_string_utf8_ivars _storage; } - -- (instancetype)OF_initWithUTF8String: (const char*)UTF8String - length: (size_t)UTF8StringLength - storage: (char*)storage; @end #ifdef __cplusplus extern "C" { #endif Index: src/OFString_UTF8.m ================================================================== --- src/OFString_UTF8.m +++ src/OFString_UTF8.m @@ -22,10 +22,11 @@ #include #include #import "OFString_UTF8.h" +#import "OFString_UTF8+Private.h" #import "OFMutableString_UTF8.h" #import "OFArray.h" #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -39,10 +39,11 @@ #import "OFTCPSocket+SOCKS5.h" #import "OFString.h" #import "OFThread.h" #import "OFTimer.h" #import "OFRunLoop.h" +#import "OFRunLoop+Private.h" #import "OFAcceptFailedException.h" #import "OFAlreadyConnectedException.h" #import "OFAddressTranslationFailedException.h" #import "OFBindFailedException.h" ADDED src/OFThread+Private.h Index: src/OFThread+Private.h ================================================================== --- src/OFThread+Private.h +++ src/OFThread+Private.h @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#import "OFThread.h" + +#import "macros.h" + +@interface OFThread (OF_PRIVATE_CATEGORY) ++ (void)OF_createMainThread; +@end Index: src/OFThread.h ================================================================== --- src/OFThread.h +++ src/OFThread.h @@ -149,12 +149,10 @@ * * @param object The object which the terminated thread will return */ + (void)terminateWithObject: (id)object; -+ (void)OF_createMainThread; - # ifdef OF_HAVE_BLOCKS /*! * @brief Initializes an already allocated thread with the specified block. * * @param threadBlock A block which is executed by the thread Index: src/OFThread.m ================================================================== --- src/OFThread.m +++ src/OFThread.m @@ -35,12 +35,13 @@ #if defined(OF_HAVE_THREADS) && defined(__HAIKU__) # include #endif -#import "OFRunLoop.h" #import "OFThread.h" +#import "OFThread+Private.h" +#import "OFRunLoop.h" #import "OFList.h" #import "OFDate.h" #import "OFDictionary.h" #import "OFAutoreleasePool.h" ADDED src/OFTimer+Private.h Index: src/OFTimer+Private.h ================================================================== --- src/OFTimer+Private.h +++ src/OFTimer+Private.h @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#import "OFTimer.h" + +#import "macros.h" + +@interface OFTimer (OF_PRIVATE_CATEGORY) +- (void)OF_setInRunLoop: (OFRunLoop*)inRunLoop; +@end Index: src/OFTimer.h ================================================================== --- src/OFTimer.h +++ src/OFTimer.h @@ -326,8 +326,6 @@ /*! * @brief Waits until the timer fired. */ - (void)waitUntilDone; #endif - -- (void)OF_setInRunLoop: (OFRunLoop*)inRunLoop; @end Index: src/OFTimer.m ================================================================== --- src/OFTimer.m +++ src/OFTimer.m @@ -19,12 +19,14 @@ #include #include #import "OFTimer.h" +#import "OFTimer+Private.h" #import "OFDate.h" #import "OFRunLoop.h" +#import "OFRunLoop+Private.h" #ifdef OF_HAVE_THREADS # import "OFCondition.h" #endif #import "OFInvalidArgumentException.h" Index: src/OFZIPArchive.h ================================================================== --- src/OFZIPArchive.h +++ src/OFZIPArchive.h @@ -80,9 +80,6 @@ * * @param path The path to the file inside the archive * @return A stream for reading the specified file form the archive */ - (OFStream*)streamForReadingFile: (OFString*)path; - -- (void)OF_readZIPInfo; -- (void)OF_readEntries; @end Index: src/OFZIPArchive.m ================================================================== --- src/OFZIPArchive.m +++ src/OFZIPArchive.m @@ -18,10 +18,11 @@ #include #import "OFZIPArchive.h" #import "OFZIPArchiveEntry.h" +#import "OFZIPArchiveEntry+Private.h" #import "OFDictionary.h" #import "OFFile.h" #import "OFChecksumFailedException.h" #import "OFInvalidArgumentException.h" @@ -44,10 +45,15 @@ * - Write support is missing. * - The ZIP has to be a file on the local file system. * - No support for ZIP64. * - No support for data descriptors (useless without compression anyway). */ + +@interface OFZIPArchive (OF_PRIVATE_CATEGORY) +- (void)OF_readZIPInfo; +- (void)OF_readEntries; +@end @interface OFZIPArchive_LocalFileHeader: OFObject { @public uint16_t _minVersion, _generalPurposeBitFlag, _compressionMethod; ADDED src/OFZIPArchiveEntry+Private.h Index: src/OFZIPArchiveEntry+Private.h ================================================================== --- src/OFZIPArchiveEntry+Private.h +++ src/OFZIPArchiveEntry+Private.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#import "OFZIPArchive.h" + +#import "macros.h" + +@interface OFZIPArchiveEntry (OF_PRIVATE_CATEGORY) +- (instancetype)OF_initWithFile: (OFFile*)file; +- (uint16_t)OF_madeWithVersion; +- (uint16_t)OF_minVersion; +- (uint16_t)OF_generalPurposeBitFlag; +- (uint16_t)OF_compressionMethod; +- (uint16_t)OF_lastModifiedFileTime; +- (uint16_t)OF_lastModifiedFileDate; +- (OFDataArray*)OF_extraField; +- (uint16_t)OF_startDiskNumber; +- (uint16_t)OF_internalAttributes; +- (uint32_t)OF_externalAttributes; +- (uint32_t)OF_localFileHeaderOffset; +@end Index: src/OFZIPArchiveEntry.h ================================================================== --- src/OFZIPArchiveEntry.h +++ src/OFZIPArchiveEntry.h @@ -45,12 +45,10 @@ @property (readonly) off_t compressedSize, uncompressedSize; @property (readonly, retain) OFDate *modificationDate; @property (readonly) uint32_t CRC32; #endif -- (instancetype)OF_initWithFile: (OFFile*)file; - /*! * @brief Returns the file name of the entry. * * @return The file name of the entry */ @@ -88,18 +86,6 @@ * @brief Returns the CRC32 checksum of the entry's file. * * @return The CRC32 checksum of the entry's file */ - (uint32_t)CRC32; - -- (uint16_t)OF_madeWithVersion; -- (uint16_t)OF_minVersion; -- (uint16_t)OF_generalPurposeBitFlag; -- (uint16_t)OF_compressionMethod; -- (uint16_t)OF_lastModifiedFileTime; -- (uint16_t)OF_lastModifiedFileDate; -- (OFDataArray*)OF_extraField; -- (uint16_t)OF_startDiskNumber; -- (uint16_t)OF_internalAttributes; -- (uint32_t)OF_externalAttributes; -- (uint32_t)OF_localFileHeaderOffset; @end Index: src/OFZIPArchiveEntry.m ================================================================== --- src/OFZIPArchiveEntry.m +++ src/OFZIPArchiveEntry.m @@ -15,10 +15,11 @@ */ #include "config.h" #import "OFZIPArchiveEntry.h" +#import "OFZIPArchiveEntry+Private.h" #import "OFString.h" #import "OFDataArray.h" #import "OFFile.h" #import "OFDate.h" Index: src/macros.h ================================================================== --- src/macros.h +++ src/macros.h @@ -129,10 +129,16 @@ #define OF_IVAR_OFFSET(ivar) ((intptr_t)&ivar - (intptr_t)self) #define OF_GETTER(ivar, atomic) \ return objc_getProperty(self, _cmd, OF_IVAR_OFFSET(ivar), atomic); #define OF_SETTER(ivar, value, atomic, copy) \ objc_setProperty(self, _cmd, OF_IVAR_OFFSET(ivar), value, atomic, copy); + +#ifdef OF_HAVE_CLASS_EXTENSIONS +# define OF_PRIVATE_CATEGORY +#else +# define OF_PRIVATE_CATEGORY Private +#endif static OF_INLINE uint16_t OF_CONST_FUNC OF_BSWAP16_CONST(uint16_t i) { return (i & UINT16_C(0xFF00)) >> 8 |