1
|
1 |
"
|
5
|
2 |
COPYRIGHT (c) 1989 by Claus Gittinger
|
1
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
Object subclass:#ClassCategoryReader
|
68
|
14 |
instanceVariableNames:'myClass myCategory myPrivacy'
|
1
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Kernel-Support'
|
|
18 |
!
|
|
19 |
|
|
20 |
ClassCategoryReader comment:'
|
5
|
21 |
COPYRIGHT (c) 1989 by Claus Gittinger
|
1
|
22 |
All Rights Reserved
|
88
|
23 |
'!
|
1
|
24 |
|
88
|
25 |
!ClassCategoryReader class methodsFor:'documentation'!
|
|
26 |
|
|
27 |
copyright
|
|
28 |
"
|
|
29 |
COPYRIGHT (c) 1989 by Claus Gittinger
|
|
30 |
All Rights Reserved
|
1
|
31 |
|
88
|
32 |
This software is furnished under a license and may be used
|
|
33 |
only in accordance with the terms of that license and with the
|
|
34 |
inclusion of the above copyright notice. This software may not
|
|
35 |
be provided or otherwise made available to, or used by, any
|
|
36 |
other person. No title to or ownership of the software is
|
|
37 |
hereby transferred.
|
|
38 |
"
|
|
39 |
!
|
|
40 |
|
|
41 |
version
|
|
42 |
"
|
|
43 |
$Header: /cvs/stx/stx/libbasic/ClassCategoryReader.st,v 1.8 1994-06-02 16:19:33 claus Exp $
|
|
44 |
"
|
|
45 |
!
|
|
46 |
|
|
47 |
documentation
|
|
48 |
"
|
|
49 |
a helper class for fileIn - keeps track of class and category to filein for.
|
|
50 |
Instances of this are created by the #methodsFor: methods in Class, to
|
|
51 |
read the next chunk(s) from a stream.
|
|
52 |
"
|
|
53 |
! !
|
1
|
54 |
|
|
55 |
!ClassCategoryReader class methodsFor:'instance creation'!
|
|
56 |
|
|
57 |
class:aClass category:aCategory
|
|
58 |
"return a new ClassCategoryReader to read methods for aClass with
|
|
59 |
methodCategory aCategory"
|
|
60 |
|
|
61 |
^ self new class:aClass category:aCategory
|
|
62 |
! !
|
|
63 |
|
|
64 |
!ClassCategoryReader methodsFor:'private'!
|
|
65 |
|
|
66 |
class:aClass category:aCategory
|
|
67 |
"set the instance variables"
|
|
68 |
|
|
69 |
myClass := aClass.
|
68
|
70 |
myCategory := aCategory.
|
|
71 |
myPrivacy := false
|
|
72 |
! !
|
|
73 |
|
|
74 |
!ClassCategoryReader methodsFor:'special'!
|
|
75 |
|
|
76 |
privateProtocol
|
|
77 |
myPrivacy := true
|
1
|
78 |
! !
|
|
79 |
|
|
80 |
!ClassCategoryReader methodsFor:'fileIn'!
|
|
81 |
|
|
82 |
fileInFrom:aStream notifying:requestor
|
|
83 |
"read method-chunks from the input stream, aStream; compile them
|
|
84 |
and add the methods to the class defined by the class-instance var;
|
12
|
85 |
errors and notifications are passed to requestor"
|
1
|
86 |
|
|
87 |
|aString done method|
|
|
88 |
|
|
89 |
done := false.
|
|
90 |
[done] whileFalse:[
|
|
91 |
done := aStream atEnd.
|
|
92 |
done ifFalse:[
|
|
93 |
aString := aStream nextChunk.
|
|
94 |
done := aString isNil or:[aString isEmpty].
|
|
95 |
done ifFalse:[
|
10
|
96 |
method := myClass compiler compile:aString
|
|
97 |
forClass:myClass
|
|
98 |
inCategory:myCategory
|
|
99 |
notifying:requestor
|
|
100 |
install:true
|
68
|
101 |
skipIfSame:true.
|
|
102 |
myPrivacy ifTrue:[
|
|
103 |
method private:true
|
|
104 |
]
|
1
|
105 |
]
|
|
106 |
]
|
|
107 |
]
|
|
108 |
!
|
|
109 |
|
|
110 |
fileInFrom:aStream
|
|
111 |
"read method-chunks from the input stream, aStream; compile them
|
|
112 |
and add the methods to the class defined by the class-instance var"
|
|
113 |
|
|
114 |
self fileInFrom:aStream notifying:nil
|
|
115 |
! !
|