1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
+
+
+
+
+
-
+
-
+
-
+
|
Legend:
* Changes of existing features or bugfixes
+ New features
This file only contains the most significant changes.
ObjFW 0.90.2 -> ObjFW 1.0, 2023-08-29
+ First stable release with stable API and ABI
* Too many changes to list, as it has been almost 6 years since the last
release. See commits in the repository for details.
ObjFW 0.90.1 -> ObjFW 0.90.2, 23.10.2017
ObjFW 0.90.1 -> ObjFW 0.90.2, 2017-10-23
* Fix shadowed variables which caused many bugs (e.g. using the wrong object)
* Many, many nullability fixes
* OFTCPSocket: Fix exception not being retained for async connect
* OFThread: Fix setting the name on the wrong thread
* OFMutableSet: Fix missing override for -[copy]
* configure: Fix posix_spawnp check
* Xcode project: Set the correct version for the bridge
* Better check for iOS
* tests: Fix testing the wrong OFKernelEventObserver
ObjFW 0.90 -> ObjFW 0.90.1, 20.08.2017
ObjFW 0.90 -> ObjFW 0.90.1, 2017-08-20
* OFData: Fix -[description]
* OFFileManager: Set errno to 0 before readdir()
* OFDate: Add -[localMinute]
* OFTarArchiveEntry: Fix prefix handling for ustar
* OFZIPArchive: Fix uncompressed + data descriptor
* OFArray: Fix MessagePack encoding
* of_asprintf: Don't require set up OFLocalization
* OFGZIPStream: Add missing documentation
* Fix a linker warning on OpenBSD/SPARC64
* Remove the OFFile b modes from MorphOS
(they were already removed for all other OSes)
ObjFW 0.8.1 -> ObjFW 0.90, 01.08.2017
ObjFW 0.8.1 -> ObjFW 0.90, 2017-08-01
+ New classes: OFFileManager, OFGZIPStream, OFTarArchive, OFTarArchiveEntry
OFHMAC, OFSandbox, OFHTTPCookie, OFHTTPCookieManager,
OFLocalization
+ New platforms: Nintendo 3DS, MorphOS
+ New lookup assembly for platforms: SPARC64/ELF, ARM64/ELF
+ New forwarding for: ARM64/ELF
+ New tools: objfw-new (to create boilerplate code)
|
︙ | | |
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
-
+
-
+
|
* OFHash was renamed to OFCryptoHash
+ PBKDF2
+ scrypt
+ Xcode project to build for iOS
+ String decomposition to NFD
* OFFile modes simplified ('b' removed)
ObjFW 0.8 -> ObjFW 0.8.1, 04.10.2015
ObjFW 0.8 -> ObjFW 0.8.1, 2015-10-04
* Adjust to __nullable / __nonnull being changed to _Nullable / _Nonnull in
Clang 3.7 (this fixes compilation with Clang 3.7)
* Blocks: Proper handling when called from a byref handler
* Fix compilation on Solaris
* Fix compilation for Wii, PSP and Nintendo DS
* OFProcess: Send SIGTERM on close instead of SIGKILL
* OFZIPArchive: Throw invalid format exception on failed seeks
* Make sure of_hash_seed is never initialized to 0
* Special cases for the Wii's weird network stack (fixes the tests)
* Better length checks for write / send calls
* Don't use -pedantic on platforms where it's broken by the system headers
* Documentation fixes
ObjFW 0.7.1 -> ObjFW 0.8, 14.08.2015
ObjFW 0.7.1 -> ObjFW 0.8, 2015-08-14
+ An insanely huge amount of new APIs
+ New classes: OFHTTPServer, OFINICategory, OFINIFile, OFInflate64Stream,
OFInflateStream, OFMapTable, OFRIPEMD160Hash, OFSHA224Hash, OFSHA256Hash,
OFSHA384Hash, OFSHA512Hash, OFSettings, OFStdIOStream, OFSystemInfo,
OFUDPSocket, OFZIPArchive, OFZIPArchiveEntry
+ New utils: ofzip, ofhash, ofhttp
|
︙ | | |
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
-
+
-
+
|
* OFProcess improvements for Win32
+ epoll support for OFKernelEventObserver
* Rewritten OFMD5Hash and OFSHA1Hash
* Reworked OFTLSSocket API (easier verification)
* Unicode support updated to Unicode 8.0
* OFURL: Proper escaping and unescaping
ObjFW 0.7 -> ObjFW 0.7.1, 12.11.2012
ObjFW 0.7 -> ObjFW 0.7.1, 2012-11-12
+ Support for Haiku
* Autorelease pools now work properly without __thread
* Incorrect framework version in Xcode project fixed
* Documentation fixes and improvements
* Blocks now only use 16 bits for the reference count in order to avoid
problems with newer Clang versions
* More use of OF_SENTINEL
ObjFW 0.6 -> ObjFW 0.7, 27.10.2012
ObjFW 0.6 -> ObjFW 0.7, 2012-10-27
Again, the differences are more than in any release before, thus listing them
all would be too much. The major differences are:
+ ObjFW now comes with its own runtime, which greatly increases performance
compared to the GNU runtime and is even faster than the Apple runtime
(using Clang >= 3.2 is recommended, but not necessary)
* Support for the GNU runtime has been dropped
+ New, much faster autorelease pool implementation (now inside the runtime)
|
︙ | | |
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
|
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
|
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
|
* Strings are allocated faster now
+ Support for JSON5
* All private methods use the prefix OF_ now instead of _, making it possible
to use the _ prefix in applications
* Most ObjC compiler feature checks are not part of configure anymore, making
it possible to use the same installation with different compilers
ObjFW 0.5.4 -> ObjFW 0.6, 27.02.2012
ObjFW 0.5.4 -> ObjFW 0.6, 2012-02-27
The differences between 0.5.4 and 0.6 are too big to list them all. However,
the major new features are:
* OFString, OFArray, OFDictionary, OFSet and OFCountedSet are now class
clusters
+ Serialization and deserialization of objects into/from XML and JSON
+ New class OFIntrospection for introspecting classes
+ New class OFProcess for working with and controlling child processes
* Lots of OFXMLParser and OFXMLElement improvements
+ OFHTTPRequests can have a delegate now for status updates and processing
data as soon as it arrives
+ There are several backends for OFStreamObserver now, including kqueue, poll
and select
+ SOCKS5 support for OFTCPSockets (client only)
* Several API changes
ObjFW 0.5.3 -> ObjFW 0.5.4, 30.08.2011
ObjFW 0.5.3 -> ObjFW 0.5.4, 2011-08-30
* The blocks runtime is now working correctly
* Documentation fixes
* -framework works with objfw-compile now
+ Support for QNX
* Various small fixes
ObjFW 0.5.2 -> ObjFW 0.5.3, 01.07.2011
ObjFW 0.5.2 -> ObjFW 0.5.3, 2011-07-01
* Lots of bugfixes, see Git log for details
ObjFW 0.5.1 -> ObjFW 0.5.2, 25.04.2011
ObjFW 0.5.1 -> ObjFW 0.5.2, 2011-04-25
* Fix double-retain in OFList
* Don't ignore the timeout in OFStreamObserver when using select()
* Do -[OFURL copy] in a try block to prevent a leak when an exception occurs
* Fix too big buffer in -[OFMutableString _applyTable:withSize:]
* Call madvise() on the correct length variable so it covers the whole string
* Fix a warning when sizeof(size_t) < sizeof(long long)
* Skip possible BOMs when appending strings
ObjFW 0.5 -> ObjFW 0.5.1, 21.04.2011
ObjFW 0.5 -> ObjFW 0.5.1, 2011-04-21
* Work around a wrong warning produced by Apple GCC 4.0.1 which would cause
the build to fail due to -Werror
* Call objc_thread_{add,remove} when using the GNU runtime to make sure the
runtime knows about our thread
* Detach a thread before restarting if it was never joined
* Release the old return value when restarting a thread
ObjFW 0.4-alpha1 -> 0.5, 09.04.2011
ObjFW 0.4-alpha1 -> 0.5, 2011-04-09
+ %@ is now allowed in format strings
+ Added of_log for easy logging
* Exceptions have one header per exception now
* Lots of exception improvements
* Huge improvements in XML handling
* Improvements in socket handling, including improved API
* OFStreamObserver is now thread-safe and stops the current observe call when
the set of streams to observe is modified
+ New class OFURL
+ New class OFHTTPRequest
+ New class OFCondition
* Improvements in objfw-compile
+ Blocks can be used together with Cocoa now
+ When linking ObjFW and Cocoa, OFAutoreleasePools are used by both now
+ Support for Base64
+ Use a real Xcode project instead of just calling make
+ Add Haiku to the list of supported platforms
* Lots of small bugfixes and countless small changes. Read the commits!
ObjFW 0.3.1 -> 0.4-alpha1, 03.01.2011
ObjFW 0.3.1 -> 0.4-alpha1, 2011-01-03
* ObjFW is now available under the terms of the QPL, GPLv2 and GPLv3
+ Support for blocks was added, including a blocks runtime
+ Added support for the new GNU runtime, introduced in GCC 4.6
* Objects returned from collections are no longer retained and autoreleased
+ Added new classes OFXMLParser, OFXMLElement, OFXMLAttribute and
OFXMLElementBuilder
+ Added new class OFStreamObserver to observe streams
+ Added new class OFDate for storing dates
+ Many new methods in almost all classes
* OFAutoreleasePool was optimized
* Handling of ASCII strings was optimized
* OFSocket was renamed to OFStreamSocket
* OFConstString was renamed to OFConstantString
* objfw-compile now has a new syntax
+ objfw-compile can now compile libraries and plugins
* Many small changes and new features that would be too much to list here
The diff between 0.3.1 and 0.4-alpha1 has almost 24000 lines!
ObjFW 0.3 -> 0.3.1, 19.06.2010
ObjFW 0.3 -> 0.3.1, 2010-06-19
* Fix a typo in OFMutableDictionary that prevented termination in case
the last bucket is already used when the dictionary is resized
* The mutations pointer is now correctly initialized in enumerators for
immutable collections
* The objc_sync test was still using the old threads API and was
updated to use the new one now
* PLATFORMS has been updated to be more specific
ObjFW 0.2.1 -> 0.3, 09.05.2010
ObjFW 0.2.1 -> 0.3, 2010-05-09
+ Many new methods were added to different classes
+ A huge amount of methods was added to OFStream, allowing easy binary
stream handling and even mixing string-based and binary operations
+ An optional write buffer was added to OFStream
+ OFSeekableStream was added for streams that allow seeking, for example
OFFiles
* OFNumber was completely reworked and got many new features now
|
︙ | | |
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
|
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
-
+
-
+
|
* The instance variable naming convention was changed so that properties work
+ Properties were added to the interfaces and are used if they are supported
by the compiler
+ The library version is now included in the resulting dylib and libobjc is
reexported now. Additionally, objfw-config offers --reexport now to produce
libraries that link against ObjFW and reexport it
ObjFW 0.2 -> 0.2.1, 14.03.2010
ObjFW 0.2 -> 0.2.1, 2010-03-14
* Fix for OFNumbers not doing calculations
* Improved -[hash] for OFNumbers with floats and doubles
+ Tests for OFNumber
* Small optimization for OFArray's -[componentsJoinedByString:]
* Documentation improvements
* Updated copyright
ObjFW 0.1.2 -> 0.2, 01.02.2010
ObjFW 0.1.2 -> 0.2, 2010-02-01
+ Support for ObjC 2 Fast Enumerations on every platform which has
compiler support for fast enumerations
+ Support for ObjC 2 properties on every platform with compiler support
+ Fast Enumeration through arrays and dictionaries
* OFIterator has been removed
+ OFEnumerator was added to replace OFIterator, which is more general
and works with arrays and dictionaries
|
︙ | | |
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
|
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
|
-
+
-
+
-
+
|
* The interfaces of OFSocket and OFStream were cleaned up and some
methods were moved to OFTCPSocket, as they make sense only there
* File methods unavailable on Windows don't throw an exception at
runtime anymore, but instead are not even in the interface on
Windows. This way, it is a compile time error instead of a runtime
error
ObjFW 0.1.1 -> 0.1.2, 15.01.2010
ObjFW 0.1.1 -> 0.1.2, 2010-01-15
* Fix a bug in OFMutableArray's -[removeObject:] and
-[removeObjectIdenticalTo:] that could lead to not removing all
occurrences of the object from the array and to out of bounds reads
* Change the URL in the framework plist to the homepage
ObjFW 0.1 -> 0.1.1, 04.01.2010
ObjFW 0.1 -> 0.1.1, 2010-01-04
* Fix a missing out of range check for -[removeNItems:atIndex:] that
allowed the programmer to specify too big ranges so it would crash
instead of throwing an exception
* Fix missing calls to -[retain] and -[autorelease] when getting
objects from an OFArray or OFDictionary
* Safer and more fault-tolerant way to remove objects from an
OFMutableArray
* Calling +[dealloc] throws an exception now. If someone really calls
[SomeClass dealloc], this should be punished and not ignored, as
this is a serious programmer error
* -[readLineWithEncoding:] is more fault-tolerant now and does not
lose data when it stumbles upon invalid encoding. Instead, it allows
recalling with the correct encoding now
ObjFW 0.1, 24.12.2009
ObjFW 0.1, 2009-12-24
+ Initial release
|
︙ | | |
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
-
+
|
enable_shared="no"
enable_threads="no"
enable_sockets="no"
enable_files="no"
;;
m68k-*-amigaos*)
AS_IF([test x"$OBJCFLAGS" = x""], [OBJCFLAGS="-O0"])
AS_IF([test x"$OBJCFLAGS" = x""], [OBJCFLAGS="-O0 -g"])
OBJCFLAGS="$OBJCFLAGS -noixemul"
OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS -noixemul"
CPPFLAGS="$CPPFLAGS -D__NO_NET_API"
LDFLAGS="$LDFLAGS -noixemul"
LIBS="$LIBS -ldebug"
enable_files="yes" # Required for reading ENV:
|
︙ | | |
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
|
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
|
-
-
-
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
|
AC_DEFINE(OF_HAVE_NETINET_IN_H, 1,
[Whether we have netinet/in.h])
])
AC_CHECK_HEADER(netinet/tcp.h, [
AC_DEFINE(OF_HAVE_NETINET_TCP_H, 1,
[Whether we have netinet/tcp.h])
])
AC_CHECK_HEADERS([arpa/inet.h netdb.h])
AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h net/if_types.h])
AC_CHECK_FUNCS([if_indextoname if_nametoindex])
AC_CHECK_HEADERS([arpa/inet.h netdb.h sys/sockio.h])
AC_CHECK_HEADERS([net/if.h], [], [], [
#ifdef OF_HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
])
AC_CHECK_HEADERS([net/if_arp.h net/if_dl.h net/if_types.h])
AC_CHECK_FUNCS([if_indextoname if_nametoindex if_nameindex])
AC_CHECK_TYPES([struct sockaddr_dl], [], [], [
#ifdef HAVAE_SYS_TYPES_H
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_NET_IF_DL_H
# include <net/if_dl.h>
#endif
])
AC_CHECK_TYPES([struct lifconf], [], [], [
#ifdef HAVE_NET_IF_H
# include <net/if.h>
#endif
])
AC_CHECK_MEMBERS([struct ifreq.ifr_hwaddr], [], [], [
#ifdef HAVE_NET_IF_H
# include <net/if.h>
#endif
])
AC_CHECK_HEADER(sys/un.h, [
AC_DEFINE(OF_HAVE_SYS_UN_H, 1, [Whether we have sys/un.h])
])
AC_CHECK_MEMBER([struct sockaddr_in6.sin6_addr], [
AC_EGREP_CPP(egrep_cpp_yes, [
#ifdef _WIN32
|
︙ | | |
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
|
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
|
+
+
|
#endif
#ifdef AF_INET6
egrep_cpp_yes
#endif
], [
AC_DEFINE(OF_HAVE_IPV6, 1, [Whether we have IPv6])
AC_CHECK_FUNCS(inet6_getscopeid)
])
], [
dnl Work around a bug in autoconf 2.61 that creates a broken
dnl configure if this branch is empty.
:
], [
#ifdef _WIN32
|
︙ | | |
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
|
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
|
-
-
-
-
-
-
+
+
|
#ifdef __morphos__
# error MorphOS has the struct but does not support it
#endif
#ifdef __MINT__
# error Gives invalid argument at runtime
#endif
#ifdef __gnu_hurd__
# error Empty sun_path in the source given by recvfrom()
#endif
])
AC_CHECK_HEADER(netipx/ipx.h, [
AC_DEFINE(OF_HAVE_NETIPX_IPX_H, 1,
[Whether we have netipx/ipx.h])
])
AC_CHECK_MEMBER(struct sockaddr_ipx.sipx_network, [], [
AC_CHECK_MEMBER(struct sockaddr_ipx.sa_netnum, [], [
AC_CHECK_MEMBER(struct sockaddr_ipx.sipx_addr.x_port, [
], [], [
AC_CHECK_MEMBER(struct sockaddr_ipx.sipx_addr.x_port,
[], [], [
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef OF_HAVE_NETIPX_IPX_H
# include <netipx/ipx.h>
#endif
|
︙ | | |
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
|
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
|
-
-
-
|
[Whether we have select() or similar])
AC_SUBST(OF_SELECT_KERNEL_EVENT_OBSERVER_M,
"OFSelectKernelEventObserver.m")
])
;;
esac
AC_CHECK_HEADERS(net/if.h)
AC_CHECK_FUNCS(if_nameindex)
AC_ARG_WITH(tls,
AS_HELP_STRING([--with-tls], [
enable TLS support using the specified library
(yes, openssl, gnutls, securetransport or no)]))
AS_IF([test x"$with_tls" = x""], [with_tls="yes"])
tls_support="no"
|
︙ | | |
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
|
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
AC_CHECK_FUNCS(SSLCreateContext)
], [])
LIBS="$old_LIBS"
])
])
AS_IF([test x"$with_tls" = x"gnutls" \
-o \( x"$with_tls" = x"yes" -a x"$tls_support" = x"no" \)], [
PKG_CHECK_MODULES(gnutls, [gnutls >= 3.5.0], [
tls_support="GnuTLS"
TLS_CPPFLAGS="$gnutls_CFLAGS $TLS_CPPFLAGS"
TLS_LIBS="$gnutls_LIBS $TLS_LIBS"
AC_SUBST(OF_GNUTLS_TLS_STREAM_M, "OFGnuTLSTLSStream.m")
], [
dnl Disable default action-if-not-found, which exits
dnl configure with an error.
:
])
])
AS_IF([test x"$with_tls" = x"openssl" \
-o \( x"$with_tls" = x"yes" -a x"$tls_support" = x"no" \)], [
case "$host_os" in
morphos*)
ssl="ssl_shared"
crypto="crypto_shared"
;;
|
︙ | | |
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
|
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
TLS_LIBS="-l$ssl -l$crypto $TLS_LIBS"
AC_SUBST(OF_OPENSSL_TLS_STREAM_M,
"OFOpenSSLTLSStream.m")
])
], [], [-l$crypto])
])
AS_IF([test x"$with_tls" = x"gnutls" \
-o \( x"$with_tls" = x"yes" -a x"$tls_support" = x"no" \)], [
PKG_CHECK_MODULES(gnutls, [gnutls >= 3.5.0], [
tls_support="GnuTLS"
TLS_CPPFLAGS="$gnutls_CFLAGS $TLS_CPPFLAGS"
TLS_LIBS="$gnutls_LIBS $TLS_LIBS"
AC_SUBST(OF_GNUTLS_TLS_STREAM_M, "OFGnuTLSTLSStream.m")
], [
dnl Disable default action-if-not-found, which exits
dnl configure with an error.
:
])
])
AS_IF([test x"$tls_support" != x"no"], [
AC_SUBST(TLS, "tls")
AC_SUBST(TLS_CPPFLAGS)
AC_SUBST(TLS_LIBS)
AC_DEFINE(HAVE_TLS_SUPPORT, 1,
[Whether we have an implementation for TLS])
|
︙ | | |
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
|
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
|
-
+
+
+
+
+
+
+
+
+
|
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
OBJCFLAGS="$old_OBJCFLAGS"
])
AS_IF([test x"$GOBJC" = x"yes"], [
OBJCFLAGS="$OBJCFLAGS -Wwrite-strings -Wpointer-arith -Werror"
OBJCFLAGS="$OBJCFLAGS -Wwrite-strings -Wpointer-arith"
AC_ARG_ENABLE(werror,
AS_HELP_STRING([--disable-werror], [do not build with -Werror]))
AS_IF([test x"$enable_werror" != x"no"], [
OBJCFLAGS="$OBJCFLAGS -Werror"
])
old_OBJCFLAGS="$OBJCFLAGS"
OBJCFLAGS="$OBJCFLAGS -Werror"
AC_MSG_CHECKING(whether we need -Wno-strict-aliasing due to GCC bugs)
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([
#ifdef __has_attribute
# if __has_attribute(objc_root_class)
__attribute__((__objc_root_class__))
# endif
|
︙ | | |
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
|
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
|
+
-
+
+
+
|
} object;
], [
Foo *test = (Foo *)&object;
(void)test; /* Get rid of unused variable warning */
])
], [
AC_MSG_RESULT(no)
OBJCFLAGS="$old_OBJCFLAGS"
], [
AC_MSG_RESULT(yes)
OBJCFLAGS="$OBJCFLAGS -Wno-strict-aliasing"
OBJCFLAGS="$old_OBJCFLAGS -Wno-strict-aliasing"
])
old_OBJCFLAGS="$OBJCFLAGS"
OBJCFLAGS="$OBJCFLAGS -Werror"
AC_MSG_CHECKING(
whether we need -Wno-unused-property-ivar due to Clang bugs)
AC_COMPILE_IFELSE([
AC_LANG_SOURCE([
#ifdef __has_attribute
# if __has_attribute(objc_root_class)
__attribute__((__objc_root_class__))
|
︙ | | |
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
|
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
|
+
-
+
-
+
|
{
return (Foo *)0;
}
@end
])
], [
AC_MSG_RESULT(no)
OBJCFLAGS="$old_OBJCFLAGS"
], [
AC_MSG_RESULT(yes)
OBJCFLAGS="$OBJCFLAGS -Wno-unused-property-ivar"
OBJCFLAGS="$old_OBJCFLAGS -Wno-unused-property-ivar"
])
old_OBJCFLAGS="$OBJCFLAGS"
OBJCFLAGS="$OBJCFLAGS -Wcast-align"
OBJCFLAGS="$OBJCFLAGS -Wcast-align -Werror"
AC_MSG_CHECKING(whether -Wcast-align is buggy)
AC_COMPILE_IFELSE([
AC_LANG_SOURCE([
#ifdef __has_attribute
# if __has_attribute(objc_root_class)
__attribute__((__objc_root_class__))
# endif
|
︙ | | |
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
|
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
|
+
-
+
|
struct objc_class *c = _isa;
(void)c;
}
@end
])
], [
AC_MSG_RESULT(no)
OBJCFLAGS="$old_OBJCFLAGS -Wcast-align"
], [
AC_MSG_RESULT(yes)
OBJCFLAGS="$old_OBJCFLAGS"
])
old_OBJCFLAGS="$OBJCFLAGS"
OBJCFLAGS="$OBJCFLAGS -Wunreachable-code"
OBJCFLAGS="$OBJCFLAGS -Wunreachable-code -Werror"
AC_MSG_CHECKING(whether -Wunreachable-code can be used)
AC_COMPILE_IFELSE([
AC_LANG_SOURCE([[
#include <stdlib.h>
struct objc_selector;
typedef const struct objc_selector *SEL;
|
︙ | | |
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
|
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
|
+
-
+
|
{
OF_DEALLOC_UNSUPPORTED
}
@end
]])
], [
AC_MSG_RESULT(yes)
OBJCFLAGS="$old_OBJCFLAGS -Wunreachable-code"
], [
AC_MSG_RESULT(no)
OBJCFLAGS="$old_OBJCFLAGS"
])
old_OBJCFLAGS="$OBJCFLAGS"
OBJCFLAGS="$OBJCFLAGS -Wdocumentation"
OBJCFLAGS="$OBJCFLAGS -Wdocumentation -Werror"
AC_MSG_CHECKING(whether -Wdocumentation works correctly)
AC_COMPILE_IFELSE([
AC_LANG_SOURCE([
/**
* @class Test conftest.m conftest.m
*/
#ifdef __has_attribute
|
︙ | | |
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
|
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
|
+
-
+
|
/**
* @struct Foo conftest.m conftest.m
*/
typedef struct {} Foo;
])
], [
AC_MSG_RESULT(yes)
OBJCFLAGS="$old_OBJCFLAGS -Wdocumentation"
], [
AC_MSG_RESULT(no)
OBJCFLAGS="$old_OBJCFLAGS"
])
AS_IF([test x"$check_pedantic" = x"yes"], [
old_OBJCFLAGS="$OBJCFLAGS"
OBJCFLAGS="$OBJCFLAGS -pedantic"
OBJCFLAGS="$OBJCFLAGS -pedantic -Werror"
AC_MSG_CHECKING(whether -pedantic is buggy)
AC_COMPILE_IFELSE([
AC_LANG_SOURCE([
#include <stdlib.h>
#include <assert.h>
|
︙ | | |
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
|
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
|
+
+
+
+
-
+
+
+
+
-
+
|
*/
assert(1);
}
@end
])
], [
AC_MSG_RESULT(no)
OBJCFLAGS="$old_OBJCFLAGS -pedantic"
], [
AC_MSG_RESULT(yes)
OBJCFLAGS="$old_OBJCFLAGS"
])
])
old_OBJCFLAGS="$OBJCFLAGS"
OBJCFLAGS="$OBJCFLAGS -Werror"
AC_MSG_CHECKING(whether we need -Wno-strict-prototypes)
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([
#include <signal.h>
], [
signal(SIGINT, SIG_DFL);
])
], [
AC_MSG_RESULT(no)
OBJCFLAGS="$old_OBJCFLAGS"
], [
AC_MSG_RESULT(yes)
OBJCFLAGS="$OBJCFLAGS -Wno-strict-prototypes"
OBJCFLAGS="$old_OBJCFLAGS -Wno-strict-prototypes"
])
AS_IF([test x"$ac_cv_header_complex_h" = x"yes"], [
old_OBJCFLAGS="$OBJCFLAGS"
OBJCFLAGS="$OBJCFLAGS -Werror"
AC_MSG_CHECKING(whether we need -Wno-gnu-imaginary-constant)
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([
#include <complex.h>
], [
complex float f = 0.5 + 0.5 * I;
(void)f;
])
], [
AC_MSG_RESULT(no)
OBJCFLAGS="$old_OBJCFLAGS"
], [
AC_MSG_RESULT(yes)
OBJCFLAGS="$OBJCFLAGS -Wno-gnu-imaginary-constant"
OBJCFLAGS="$old_OBJCFLAGS -Wno-gnu-imaginary-constant"
])
])
])
AS_IF([test x"$cross_compiling" = x"yes"], [
AC_SUBST(BIN_PREFIX, "${host_alias}-")
|
︙ | | |
︙ | | |
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
-
-
|
_HTTPClient = [[OFHTTPClient alloc] init];
_HTTPClient.delegate = self;
_uppercaseTableSize = SIZE_MAX;
_lowercaseTableSize = SIZE_MAX;
_titlecaseTableSize = SIZE_MAX;
_caseFoldingTableSize = SIZE_MAX;
_decompositionTableSize = SIZE_MAX;
_decompositionCompatTableSize = SIZE_MAX;
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
|
︙ | | |
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
_uppercaseTable[codePoint] = (OFUnichar)[[components
objectAtIndex: 12] unsignedLongLongValueWithBase: 16];
_lowercaseTable[codePoint] = (OFUnichar)[[components
objectAtIndex: 13] unsignedLongLongValueWithBase: 16];
_titlecaseTable[codePoint] = (OFUnichar)[[components
objectAtIndex: 14] unsignedLongLongValueWithBase: 16];
if ([[components objectAtIndex: 5] length] > 0) {
OFArray *decomposed = [[components objectAtIndex: 5]
componentsSeparatedByString: @" "];
bool compat = false;
OFMutableString *string;
if ([decomposed.firstObject hasPrefix: @"<"]) {
decomposed = [decomposed objectsInRange:
OFMakeRange(1, decomposed.count - 1)];
compat = true;
}
string = [OFMutableString string];
for (OFString *character in decomposed) {
OFUnichar unichar = (OFUnichar)[character
unsignedLongLongValueWithBase: 16];
[string appendCharacters: &unichar
length: 1];
}
[string makeImmutable];
if (!compat)
_decompositionTable[codePoint] = [string copy];
_decompositionCompatTable[codePoint] = [string copy];
}
objc_autoreleasePoolPop(pool2);
}
[self applyDecompositionRecursivelyForTable: _decompositionTable];
[self applyDecompositionRecursivelyForTable: _decompositionCompatTable];
[OFStdOut writeLine: @" done"];
[OFStdOut writeString: @"Downloading CaseFolding.txt…"];
_state = stateCaseFolding;
request = [OFHTTPRequest requestWithIRI:
[OFIRI IRIWithString: caseFoldingIRI]];
[_HTTPClient asyncPerformRequest: request];
|
︙ | | |
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
|
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
}
[OFStdOut writeLine: @" done"];
[self writeFiles];
}
- (void)applyDecompositionRecursivelyForTable: (OFString *[0x110000])table
{
bool done;
do {
done = true;
for (OFUnichar i = 0; i < 0x110000; i++) {
void *pool;
const OFUnichar *characters;
size_t length;
OFMutableString *replacement;
bool changed = false;
if (table[i] == nil)
continue;
pool = objc_autoreleasePoolPush();
characters = table[i].characters;
length = table[i].length;
replacement = [OFMutableString string];
for (size_t j = 0; j < length; j++) {
if (characters[j] > 0x10FFFF)
@throw [OFOutOfRangeException
exception];
if (table[characters[j]] == nil)
[replacement
appendCharacters: &characters[j]
length: 1];
else {
[replacement
appendString: table[characters[j]]];
changed = true;
}
}
[replacement makeImmutable];
if (changed) {
[table[i] release];
table[i] = [replacement copy];
done = false;
}
objc_autoreleasePoolPop(pool);
}
} while (!done);
}
- (void)writeFiles
{
OFIRI *IRI;
[OFStdOut writeString: @"Writing files…"];
IRI = [OFIRI fileIRIWithPath: @"../../src/unicode.m"];
|
︙ | | |
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
|
206
207
208
209
210
211
212
213
214
215
216
217
218
219
|
-
|
mode: @"w"];
[file writeString: COPYRIGHT
@"#include \"config.h\"\n"
@"\n"
@"#import \"OFString.h\"\n\n"
@"static const OFUnichar emptyPage[0x100] = { 0 };\n"
@"static const char *emptyDecompositionPage[0x100] = { NULL };\n"
@"\n"];
/* Write uppercasePage%u */
for (OFUnichar i = 0; i < 0x110000; i += 0x100) {
bool isEmpty = true;
for (OFUnichar j = i; j < i + 0x100; j++) {
|
︙ | | |
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
|
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
[file writeString: @"};\n\n"];
objc_autoreleasePoolPop(pool2);
}
}
/* Write decompositionPage%u */
for (OFUnichar i = 0; i < 0x110000; i += 0x100) {
bool isEmpty = true;
for (OFUnichar j = i; j < i + 0x100; j++) {
if (_decompositionTable[j] != nil) {
isEmpty = false;
_decompositionTableSize = i >> 8;
_decompositionTableUsed[
_decompositionTableSize] = 1;
break;
}
}
if (!isEmpty) {
void *pool2 = objc_autoreleasePoolPush();
[file writeFormat: @"static const char *const "
@"decompositionPage%u[0x100] = {\n",
i >> 8];
for (OFUnichar j = i; j < i + 0x100; j++) {
if ((j - i) % 2 == 0)
[file writeString: @"\t"];
else
[file writeString: @" "];
if (_decompositionTable[j] != nil) {
const char *UTF8String =
_decompositionTable[j].UTF8String;
size_t length = _decompositionTable[j]
.UTF8StringLength;
[file writeString: @"\""];
for (size_t k = 0; k < length; k++)
[file writeFormat:
@"\\x%02X",
(uint8_t)UTF8String[k]];
[file writeString: @"\","];
} else
[file writeString: @"NULL,"];
if ((j - i) % 2 == 1)
[file writeString: @"\n"];
}
[file writeString: @"};\n\n"];
objc_autoreleasePoolPop(pool2);
}
}
/* Write decompCompatPage%u if it does NOT match decompositionPage%u */
for (OFUnichar i = 0; i < 0x110000; i += 0x100) {
bool isEmpty = true;
for (OFUnichar j = i; j < i + 0x100; j++) {
if (_decompositionCompatTable[j] != 0) {
/*
* We bulk-compare pointers via memcmp here.
* This is safe, as we always set the same
* pointer in both tables if both are the same.
*/
isEmpty = !memcmp(_decompositionTable + i,
_decompositionCompatTable + i,
256 * sizeof(const char *));
_decompositionCompatTableSize = i >> 8;
_decompositionCompatTableUsed[
_decompositionCompatTableSize] =
(isEmpty ? 2 : 1);
break;
}
}
if (!isEmpty) {
void *pool2 = objc_autoreleasePoolPush();
[file writeFormat: @"static const char *const "
@"decompCompatPage%u[0x100] = {\n",
i >> 8];
for (OFUnichar j = i; j < i + 0x100; j++) {
if ((j - i) % 2 == 0)
[file writeString: @"\t"];
else
[file writeString: @" "];
if (_decompositionCompatTable[j] != nil) {
const char *UTF8String =
_decompositionCompatTable[j]
.UTF8String;
size_t length =
_decompositionCompatTable[j]
.UTF8StringLength;
[file writeString: @"\""];
for (size_t k = 0; k < length; k++)
[file writeFormat:
@"\\x%02X",
(uint8_t)UTF8String[k]];
[file writeString: @"\","];
} else
[file writeString: @"NULL,"];
if ((j - i) % 2 == 1)
[file writeString: @"\n"];
}
[file writeString: @"};\n\n"];
objc_autoreleasePoolPop(pool2);
}
}
/*
* Those are currently set to the last index.
* But from now on, we need the size.
*/
_uppercaseTableSize++;
_lowercaseTableSize++;
_titlecaseTableSize++;
_caseFoldingTableSize++;
_decompositionTableSize++;
_decompositionCompatTableSize++;
/* Write OFUnicodeUppercaseTable */
[file writeFormat: @"const OFUnichar *const "
@"OFUnicodeUppercaseTable[0x%X] = {\n\t",
_uppercaseTableSize];
for (OFUnichar i = 0; i < _uppercaseTableSize; i++) {
|
︙ | | |
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
|
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
+
-
-
-
-
-
-
-
|
else
[file writeString: @", "];
}
}
[file writeString: @"\n};\n\n"];
/* Write OFUnicodeDecompositionTable */
[file writeFormat: @"const char *const "
@"*OFUnicodeDecompositionTable[0x%X] = {\n\t",
_decompositionTableSize];
for (OFUnichar i = 0; i < _decompositionTableSize; i++) {
if (_decompositionTableUsed[i])
[file writeFormat: @"decompositionPage%u", i];
else
[file writeString: @"emptyDecompositionPage"];
if (i + 1 < _decompositionTableSize) {
if ((i + 1) % 3 == 0)
[file writeString: @",\n\t"];
else
[file writeString: @", "];
}
}
[file writeString: @"\n};\n\n"];
/* Write OFUnicodeDecompositionCompatTable */
[file writeFormat: @"const char *const "
@"*OFUnicodeDecompositionCompatTable[0x%X] = {"
@"\n\t",
_decompositionCompatTableSize];
for (OFUnichar i = 0; i < _decompositionCompatTableSize; i++) {
if (_decompositionCompatTableUsed[i] == 1)
[file writeFormat: @"decompCompatPage%u", i];
else if (_decompositionCompatTableUsed[i] == 2)
[file writeFormat: @"decompositionPage%u", i];
else
[file writeString: @"emptyDecompositionPage"];
if (i + 1 < _decompositionCompatTableSize) {
if ((i + 1) % 3 == 0)
[file writeString: @",\n\t"];
else
[file writeString: @", "];
}
}
[file writeString: @"\n};\n"];
objc_autoreleasePoolPop(pool);
}
- (void)writeHeaderToFile: (OFString *)path
{
void *pool = objc_autoreleasePoolPush();
OFFile *file = [OFFile fileWithPath: path
mode: @"w"];
[file writeString: COPYRIGHT
@"#import \"OFString.h\"\n\n"];
[file writeFormat:
@"#define OFUnicodeUppercaseTableSize 0x%X\n"
@"#define OFUnicodeLowercaseTableSize 0x%X\n"
@"#define OFUnicodeTitlecaseTableSize 0x%X\n"
@"#define OFUnicodeCaseFoldingTableSize 0x%X\n"
@"#define OFUnicodeCaseFoldingTableSize 0x%X\n\n",
@"#define OFUnicodeDecompositionTableSize 0x%X\n"
@"#define OFUnicodeDecompositionCompatTableSize 0x%X\n\n",
_uppercaseTableSize, _lowercaseTableSize, _titlecaseTableSize,
_caseFoldingTableSize, _decompositionTableSize,
_caseFoldingTableSize];
_decompositionCompatTableSize];
[file writeString:
@"#ifdef __cplusplus\n"
@"extern \"C\" {\n"
@"#endif\n"
@"extern const OFUnichar *const _Nonnull\n"
@" OFUnicodeUppercaseTable[OFUnicodeUppercaseTableSize];\n"
@"extern const OFUnichar *const _Nonnull\n"
@" OFUnicodeLowercaseTable[OFUnicodeLowercaseTableSize];\n"
@"extern const OFUnichar *const _Nonnull\n"
@" OFUnicodeTitlecaseTable[OFUnicodeTitlecaseTableSize];\n"
@"extern const OFUnichar *const _Nonnull\n"
@" OFUnicodeCaseFoldingTable[OFUnicodeCaseFoldingTableSize];\n"
@"extern const char *const _Nullable *const _Nonnull\n"
@" OFUnicodeDecompositionTable["
@"OFUnicodeDecompositionTableSize];\n"
@"extern const char *const _Nullable *const _Nonnull\n"
@" OFUnicodeDecompositionCompatTable["
@"OFUnicodeDecompositionCompatTableSize];\n"
@"#ifdef __cplusplus\n"
@"}\n"
@"#endif\n"];
objc_autoreleasePoolPop(pool);
}
@end
|
︙ | | |
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
-
+
|
#include "config.h"
#include <stdarg.h>
#include <stdlib.h>
#import "OFArray.h"
#import "OFArray+Private.h"
#import "OFAdjacentArray.h"
#import "OFConcreteArray.h"
#import "OFData.h"
#import "OFNull.h"
#import "OFString.h"
#import "OFSubarray.h"
#import "OFEnumerationMutationException.h"
#import "OFInvalidArgumentException.h"
|
︙ | | |
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
+
-
-
-
-
-
+
-
-
+
-
-
+
-
-
-
-
-
+
|
depth: (size_t)depth;
@end
@interface OFPlaceholderArray: OFArray
@end
@implementation OFPlaceholderArray
#ifdef __clang__
/* We intentionally don't call into super, so silence the warning. */
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wunknown-pragmas"
# pragma clang diagnostic ignored "-Wobjc-designated-initializers"
#endif
- (instancetype)init
{
return (id)[[OFAdjacentArray alloc] init];
return (id)[[OFConcreteArray alloc] init];
}
- (instancetype)initWithObject: (id)object
{
return (id)[[OFAdjacentArray alloc] initWithObject: object];
return (id)[[OFConcreteArray alloc] initWithObject: object];
}
- (instancetype)initWithObjects: (id)firstObject, ...
{
id ret;
va_list arguments;
va_start(arguments, firstObject);
ret = [[OFAdjacentArray alloc] initWithObject: firstObject
ret = [[OFConcreteArray alloc] initWithObject: firstObject
arguments: arguments];
va_end(arguments);
return ret;
}
- (instancetype)initWithObject: (id)firstObject
arguments: (va_list)arguments
{
return (id)[[OFAdjacentArray alloc] initWithObject: firstObject
return (id)[[OFConcreteArray alloc] initWithObject: firstObject
arguments: arguments];
}
- (instancetype)initWithArray: (OFArray *)array
{
return (id)[[OFAdjacentArray alloc] initWithArray: array];
return (id)[[OFConcreteArray alloc] initWithArray: array];
}
- (instancetype)initWithObjects: (id const *)objects
count: (size_t)count
{
return (id)[[OFAdjacentArray alloc] initWithObjects: objects
return (id)[[OFConcreteArray alloc] initWithObjects: objects
count: count];
}
#ifdef __clang__
- (instancetype)retain
{
return self;
}
# pragma clang diagnostic pop
- (instancetype)autorelease
{
return self;
}
#endif
- (void)release
{
}
OF_SINGLETON_METHODS
- (void)dealloc
{
OF_DEALLOC_UNSUPPORTED
}
@end
@implementation OFArray
+ (void)initialize
{
if (self == [OFArray class])
placeholder.isa = [OFPlaceholderArray class];
object_setClass((id)&placeholder, [OFPlaceholderArray class]);
}
+ (instancetype)alloc
{
if (self == [OFArray class])
return (id)&placeholder;
|
︙ | | |
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
|
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
|
-
+
+
-
-
-
-
-
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
{
return [[[self alloc] initWithObjects: objects
count: count] autorelease];
}
- (instancetype)init
{
if ([self isMemberOfClass: [OFArray class]]) {
if ([self isMemberOfClass: [OFArray class]] ||
[self isMemberOfClass: [OFMutableArray class]]) {
@try {
[self doesNotRecognizeSelector: _cmd];
} @catch (id e) {
[self release];
@throw e;
}
abort();
}
return [super init];
}
- (instancetype)initWithObject: (id)object
{
if (object == nil) {
[self release];
@throw [OFInvalidArgumentException exception];
}
return [self initWithObjects: object, nil];
return [self initWithObjects: &object count: 1];
}
- (instancetype)initWithObjects: (id)firstObject, ...
{
id ret;
va_list arguments;
va_start(arguments, firstObject);
ret = [self initWithObject: firstObject arguments: arguments];
va_end(arguments);
return ret;
}
- (instancetype)initWithObject: (id)firstObject
arguments: (va_list)arguments
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithObject: (id)firstObject arguments: (va_list)arguments
{
size_t count = 1;
va_list argumentsCopy;
id *objects;
if (firstObject == nil)
return [self init];
va_copy(argumentsCopy, arguments);
while (va_arg(argumentsCopy, id) != nil)
count++;
@try {
objects = OFAllocMemory(count, sizeof(id));
} @catch (id e) {
[self release];
@throw e;
}
@try {
objects[0] = firstObject;
for (size_t i = 1; i < count; i++) {
objects[i] = va_arg(arguments, id);
OFEnsure(objects[i] != nil);
}
self = [self initWithObjects: objects count: count];
} @finally {
OFFreeMemory(objects);
}
return self;
}
- (instancetype)initWithArray: (OFArray *)array
{
id *objects;
size_t count;
OF_INVALID_INIT_METHOD
}
@try {
count = array.count;
objects = OFAllocMemory(count, sizeof(id));
[array getObjects: objects
inRange: OFMakeRange(0, count)];
} @catch (id e) {
[self release];
@throw e;
}
@try {
self = [self initWithObjects: objects count: count];
} @finally {
OFFreeMemory(objects);
}
return self;
}
#ifdef __clang__
/* We intentionally don't call into super, so silence the warning. */
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wunknown-pragmas"
# pragma clang diagnostic ignored "-Wobjc-designated-initializers"
#endif
- (instancetype)initWithObjects: (id const *)objects
count: (size_t)count
{
OF_INVALID_INIT_METHOD
}
#ifdef __clang__
# pragma clang diagnostic pop
#endif
- (size_t)count
{
OF_UNRECOGNIZED_SELECTOR
}
- (void)getObjects: (id *)buffer inRange: (OFRange)range
|
︙ | | |
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
|
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
|
+
-
+
|
id *buffer;
if (range.length > SIZE_MAX - range.location ||
range.location + range.length < self.count)
@throw [OFOutOfRangeException exception];
if (![self isKindOfClass: [OFMutableArray class]])
return [[[OFSubarray alloc] initWithArray: self
return [OFSubarray arrayWithArray: self range: range];
range: range] autorelease];
buffer = OFAllocMemory(range.length, sizeof(*buffer));
@try {
[self getObjects: buffer inRange: range];
ret = [OFArray arrayWithObjects: buffer count: range.length];
} @finally {
|
︙ | | |
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
|
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
|
+
-
+
|
return new;
}
- (int)countByEnumeratingWithState: (OFFastEnumerationState *)state
objects: (id *)objects
count: (int)count
{
static unsigned long dummyMutations;
OFRange range = OFMakeRange(state->state, count);
if (range.length > SIZE_MAX - range.location)
@throw [OFOutOfRangeException exception];
if (range.location + range.length > self.count)
range.length = self.count - range.location;
[self getObjects: objects inRange: range];
if (range.location + range.length > ULONG_MAX)
@throw [OFOutOfRangeException exception];
state->state = (unsigned long)(range.location + range.length);
state->itemsPtr = objects;
state->mutationsPtr = (unsigned long *)self;
state->mutationsPtr = &dummyMutations;
return (int)range.length;
}
- (OFEnumerator *)objectEnumerator
{
return [[[OFArrayEnumerator alloc] initWithArray: self
|
︙ | | |
︙ | | |
14
15
16
17
18
19
20
21
22
23
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
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
152
153
154
155
156
157
158
159
160
|
14
15
16
17
18
19
20
21
22
23
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
+
-
+
-
-
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
+
-
-
+
-
-
-
+
-
-
-
+
-
-
+
-
-
-
-
+
-
-
-
-
-
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
+
|
*/
#include "config.h"
#include <math.h>
#import "OFColor.h"
#import "OFConcreteColor.h"
#import "OFOnce.h"
#import "OFString.h"
#import "OFTaggedPointerColor.h"
#import "OFInvalidArgumentException.h"
@interface OFColor ()
@interface OFPlaceholderColor: OFColor
+ (instancetype)of_alloc;
@end
@interface OFColorSingleton: OFColor
@interface OFConcreteColorSingleton: OFConcreteColor
@end
@interface OFColorPlaceholder: OFColorSingleton
@end
#ifdef OF_OBJFW_RUNTIME
@interface OFTaggedPointerColor: OFColorSingleton
@end
static const float allowedImprecision = 0.0000001;
#endif
static struct {
Class isa;
} placeholder;
#ifdef OF_OBJFW_RUNTIME
static int colorTag;
static const float allowedImprecision = 0.0000001;
#endif
@implementation OFColorSingleton
@implementation OFPlaceholderColor
- (instancetype)autorelease
{
return self;
}
- (instancetype)retain
{
return self;
}
- (void)release
{
}
- (unsigned int)retainCount
{
return OFMaxRetainCount;
}
@end
@implementation OFColorPlaceholder
- (instancetype)initWithRed: (float)red
green: (float)green
blue: (float)blue
alpha: (float)alpha
{
#ifdef OF_OBJFW_RUNTIME
uint8_t redInt = nearbyintf(red * 255);
uint8_t greenInt = nearbyintf(green * 255);
uint8_t blueInt = nearbyintf(blue * 255);
if (fabsf(red * 255 - redInt) < allowedImprecision &&
fabsf(green * 255 - greenInt) < allowedImprecision &&
fabsf(blue * 255 - blueInt) < allowedImprecision && alpha == 1) {
id ret = objc_createTaggedPointer(colorTag,
(uintptr_t)redInt << 16 | (uintptr_t)greenInt << 8 |
(uintptr_t)blueInt);
id ret = [OFTaggedPointerColor colorWithRed: redInt
green: greenInt
blue: blueInt];
if (ret != nil)
return ret;
}
#endif
return (id)[[OFColor of_alloc] initWithRed: red
return (id)[[OFConcreteColor alloc] initWithRed: red
green: green
blue: blue
alpha: alpha];
}
@end
#ifdef OF_OBJFW_RUNTIME
OF_SINGLETON_METHODS
@implementation OFTaggedPointerColor
- (void)getRed: (float *)red
green: (float *)green
@end
blue: (float *)blue
alpha: (float *)alpha
{
uintptr_t value = object_getTaggedPointerValue(self);
@implementation OFConcreteColorSingleton
*red = (float)(value >> 16) / 255;
*green = (float)((value >> 8) & 0xFF) / 255;
*blue = (float)(value & 0xFF) / 255;
OF_SINGLETON_METHODS
if (alpha != NULL)
*alpha = 1;
}
@end
#endif
@implementation OFColor
+ (void)initialize
{
if (self != [OFColor class])
if (self == [OFColor class])
return;
object_setClass((id)&placeholder, [OFPlaceholderColor class]);
placeholder.isa = [OFColorPlaceholder class];
#ifdef OF_OBJFW_RUNTIME
colorTag =
objc_registerTaggedPointerClass([OFTaggedPointerColor class]);
#endif
}
+ (instancetype)of_alloc
{
return [super alloc];
}
+ (instancetype)alloc
{
if (self == [OFColor class])
return (id)&placeholder;
return [super alloc];
}
#define PREDEFINED_COLOR(name, redValue, greenValue, blueValue) \
static OFColor *name##Color = nil; \
\
static void \
initPredefinedColor_##name(void) \
{ \
name##Color = [[OFColorSingleton alloc] \
name##Color = [[OFConcreteColorSingleton alloc] \
initWithRed: redValue \
green: greenValue \
blue: blueValue \
alpha: 1]; \
} \
\
+ (OFColor *)name \
|
︙ | | |
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
|
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
|
-
-
+
-
-
-
-
-
-
+
-
-
-
-
+
+
+
-
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
+
+
+
-
+
+
+
+
+
-
+
-
+
-
-
-
-
-
-
-
-
+
-
-
|
}
- (instancetype)initWithRed: (float)red
green: (float)green
blue: (float)blue
alpha: (float)alpha
{
self = [super init];
if ([self isMemberOfClass: [OFColor class]]) {
@try {
if (red < 0.0 || red > 1.0 ||
green < 0.0 || green > 1.0 ||
blue < 0.0 || blue > 1.0 ||
alpha < 0.0 || alpha > 1.0)
@throw [OFInvalidArgumentException exception];
[self doesNotRecognizeSelector: _cmd];
_red = red;
_green = green;
_blue = blue;
_alpha = alpha;
} @catch (id e) {
[self release];
@throw e;
}
abort();
}
return self;
return [super init];
}
- (bool)isEqual: (id)object
{
OFColor *other;
float red, green, blue, alpha;
float otherRed, otherGreen, otherBlue, otherAlpha;
if (object == self)
return true;
if (![object isKindOfClass: [OFColor class]])
return false;
other = object;
[self getRed: &red green: &green blue: &blue alpha: &alpha];
[other getRed: &otherRed
green: &otherGreen
blue: &otherBlue
alpha: &otherAlpha];
if (other->_red != _red)
if (otherRed != red)
return false;
if (other->_green != _green)
if (otherGreen != green)
return false;
if (other->_blue != _blue)
if (otherBlue != blue)
return false;
if (other->_alpha != _alpha)
if (otherAlpha != alpha)
return false;
return true;
}
- (unsigned long)hash
{
float red, green, blue, alpha;
unsigned long hash;
float tmp;
[self getRed: &red green: &green blue: &blue alpha: &alpha];
OFHashInit(&hash);
tmp = OFToLittleEndianFloat(_red);
tmp = OFToLittleEndianFloat(red);
for (uint_fast8_t i = 0; i < sizeof(float); i++)
OFHashAddByte(&hash, ((char *)&tmp)[i]);
tmp = OFToLittleEndianFloat(green);
for (uint_fast8_t i = 0; i < sizeof(float); i++)
OFHashAddByte(&hash, ((char *)&tmp)[i]);
tmp = OFToLittleEndianFloat(_green);
tmp = OFToLittleEndianFloat(blue);
for (uint_fast8_t i = 0; i < sizeof(float); i++)
OFHashAddByte(&hash, ((char *)&tmp)[i]);
tmp = OFToLittleEndianFloat(_blue);
tmp = OFToLittleEndianFloat(alpha);
for (uint_fast8_t i = 0; i < sizeof(float); i++)
OFHashAddByte(&hash, ((char *)&tmp)[i]);
tmp = OFToLittleEndianFloat(_alpha);
for (uint_fast8_t i = 0; i < sizeof(float); i++)
OFHashAddByte(&hash, ((char *)&tmp)[i]);
OFHashFinalize(&hash);
return hash;
}
- (void)getRed: (float *)red
green: (float *)green
blue: (float *)blue
alpha: (float *)alpha
{
*red = _red;
*green = _green;
*blue = _blue;
OF_UNRECOGNIZED_SELECTOR
if (alpha != NULL)
*alpha = _alpha;
}
- (OFString *)description
{
float red, green, blue, alpha;
[self getRed: &red green: &green blue: &blue alpha: &alpha];
return [OFString stringWithFormat:
@"<%@ red=%f green=%f blue=%f alpha=%f>",
self.class, red, green, blue, alpha];
}
@end
|