annotate libobjc/README @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1
kono
parents:
diff changeset
2 GNU Objective C notes
kono
parents:
diff changeset
3 *********************
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 This document is to explain what has been done, and a little about how
kono
parents:
diff changeset
6 specific features differ from other implementations. The runtime has
kono
parents:
diff changeset
7 been completely rewritten in gcc 2.4. The earlier runtime had several
kono
parents:
diff changeset
8 severe bugs and was rather incomplete. The compiler has had several
kono
parents:
diff changeset
9 new features added as well.
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 This is not documentation for Objective C, it is usable to someone
kono
parents:
diff changeset
12 who knows Objective C from somewhere else.
kono
parents:
diff changeset
13
kono
parents:
diff changeset
14
kono
parents:
diff changeset
15 Runtime API functions
kono
parents:
diff changeset
16 =====================
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 The runtime is modeled after the NeXT Objective C runtime. That is,
kono
parents:
diff changeset
19 most functions have semantics as it is known from the NeXT. The
kono
parents:
diff changeset
20 names, however, have changed. All runtime API functions have names
kono
parents:
diff changeset
21 of lowercase letters and underscores as opposed to the
kono
parents:
diff changeset
22 `traditional' mixed case names.
kono
parents:
diff changeset
23 The runtime api functions are not documented as of now.
kono
parents:
diff changeset
24 Someone offered to write it, and did it, but we were not allowed to
kono
parents:
diff changeset
25 use it by his university (Very sad story). We have started writing
kono
parents:
diff changeset
26 the documentation over again. This will be announced in appropriate
kono
parents:
diff changeset
27 places when it becomes available.
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29
kono
parents:
diff changeset
30 Protocols
kono
parents:
diff changeset
31 =========
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 Protocols are now fully supported. The semantics is exactly as on the
kono
parents:
diff changeset
34 NeXT. There is a flag to specify how protocols should be typechecked
kono
parents:
diff changeset
35 when adopted to classes. The normal typechecker requires that all
kono
parents:
diff changeset
36 methods in a given protocol must be implemented in the class that
kono
parents:
diff changeset
37 adopts it -- it is not enough to inherit them. The flag
kono
parents:
diff changeset
38 `-Wno-protocol' causes it to allow inherited methods, while
kono
parents:
diff changeset
39 `-Wprotocols' is the default which requires them defined.
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 +load
kono
parents:
diff changeset
43 ===========
kono
parents:
diff changeset
44 This method, if defined, is called for each class and category
kono
parents:
diff changeset
45 implementation when the class is loaded into the runtime. This method
kono
parents:
diff changeset
46 is not inherited, and is thus not called for a subclass that doesn't
kono
parents:
diff changeset
47 define it itself. Thus, each +load method is called exactly once by
kono
parents:
diff changeset
48 the runtime. The runtime invocation of this method is thread safe.
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51 +initialize
kono
parents:
diff changeset
52 ===========
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 This method, if defined, is called before any other instance or class
kono
parents:
diff changeset
55 methods of that particular class. For the GNU runtime, this method is
kono
parents:
diff changeset
56 not inherited, and is thus not called as initializer for a subclass that
kono
parents:
diff changeset
57 doesn't define it itself. Thus, each +initialize method is called exactly
kono
parents:
diff changeset
58 once by the runtime (or never if no methods of that particular class is
kono
parents:
diff changeset
59 never called). It is wise to guard against multiple invocations anyway
kono
parents:
diff changeset
60 to remain portable with the NeXT runtime. The runtime invocation of
kono
parents:
diff changeset
61 this method is thread safe.
kono
parents:
diff changeset
62
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 Passivation/Activation/Typedstreams
kono
parents:
diff changeset
65 ===================================
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 This is supported in the style of NeXT TypedStream's. Consult the
kono
parents:
diff changeset
68 headerfile Typedstreams.h for api functions. I (Kresten) have
kono
parents:
diff changeset
69 rewritten it in Objective C, but this implementation is not part of
kono
parents:
diff changeset
70 2.4, it is available from the GNU Objective C prerelease archive.
kono
parents:
diff changeset
71 There is one difference worth noting concerning objects stored with
kono
parents:
diff changeset
72 objc_write_object_reference (aka NXWriteObjectReference). When these
kono
parents:
diff changeset
73 are read back in, their object is not guaranteed to be available until
kono
parents:
diff changeset
74 the `-awake' method is called in the object that requests that object.
kono
parents:
diff changeset
75 To objc_read_object you must pass a pointer to an id, which is valid
kono
parents:
diff changeset
76 after exit from the function calling it (like e.g. an instance
kono
parents:
diff changeset
77 variable). In general, you should not use objects read in until the
kono
parents:
diff changeset
78 -awake method is called.
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80
kono
parents:
diff changeset
81 Acknowledgements
kono
parents:
diff changeset
82 ================
kono
parents:
diff changeset
83
kono
parents:
diff changeset
84 The GNU Objective C team: Geoffrey Knauth <gsk@marble.com> (manager),
kono
parents:
diff changeset
85 Tom Wood <wood@next.com> (compiler) and Kresten Krab Thorup
kono
parents:
diff changeset
86 <krab@iesd.auc.dk> (runtime) would like to thank a some people for
kono
parents:
diff changeset
87 participating in the development of the present GNU Objective C.
kono
parents:
diff changeset
88
kono
parents:
diff changeset
89 Paul Burchard <burchard@geom.umn.edu> and Andrew McCallum
kono
parents:
diff changeset
90 <mccallum@cs.rochester.edu> has been very helpful debugging the
kono
parents:
diff changeset
91 runtime. Eric Herring <herring@iesd.auc.dk> has been very helpful
kono
parents:
diff changeset
92 cleaning up after the documentation-copyright disaster and is now
kono
parents:
diff changeset
93 helping with the new documentation.
kono
parents:
diff changeset
94
kono
parents:
diff changeset
95 Steve Naroff <snaroff@next.com> and Richard Stallman
kono
parents:
diff changeset
96 <rms@gnu.ai.mit.edu> has been very helpful with implementation details
kono
parents:
diff changeset
97 in the compiler.
kono
parents:
diff changeset
98
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 Bug Reports
kono
parents:
diff changeset
101 ===========
kono
parents:
diff changeset
102
kono
parents:
diff changeset
103 Please read the section `Submitting Bugreports' of the gcc manual
kono
parents:
diff changeset
104 before you submit any bugs.