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:'
|
|
21 |
|
5
|
22 |
COPYRIGHT (c) 1989 by Claus Gittinger
|
1
|
23 |
All Rights Reserved
|
|
24 |
|
|
25 |
a helper class for fileIn - keeps track of class and category to filein for.
|
|
26 |
|
68
|
27 |
$Header: /cvs/stx/stx/libbasic/Attic/CCReader.st,v 1.7 1994-03-30 09:30:13 claus Exp $
|
1
|
28 |
written 89 by claus
|
|
29 |
'!
|
|
30 |
|
|
31 |
!ClassCategoryReader class methodsFor:'instance creation'!
|
|
32 |
|
|
33 |
class:aClass category:aCategory
|
|
34 |
"return a new ClassCategoryReader to read methods for aClass with
|
|
35 |
methodCategory aCategory"
|
|
36 |
|
|
37 |
^ self new class:aClass category:aCategory
|
|
38 |
! !
|
|
39 |
|
|
40 |
!ClassCategoryReader methodsFor:'private'!
|
|
41 |
|
|
42 |
class:aClass category:aCategory
|
|
43 |
"set the instance variables"
|
|
44 |
|
|
45 |
myClass := aClass.
|
68
|
46 |
myCategory := aCategory.
|
|
47 |
myPrivacy := false
|
|
48 |
! !
|
|
49 |
|
|
50 |
!ClassCategoryReader methodsFor:'special'!
|
|
51 |
|
|
52 |
privateProtocol
|
|
53 |
myPrivacy := true
|
1
|
54 |
! !
|
|
55 |
|
|
56 |
!ClassCategoryReader methodsFor:'fileIn'!
|
|
57 |
|
|
58 |
fileInFrom:aStream notifying:requestor
|
|
59 |
"read method-chunks from the input stream, aStream; compile them
|
|
60 |
and add the methods to the class defined by the class-instance var;
|
12
|
61 |
errors and notifications are passed to requestor"
|
1
|
62 |
|
|
63 |
|aString done method|
|
|
64 |
|
|
65 |
done := false.
|
|
66 |
[done] whileFalse:[
|
|
67 |
done := aStream atEnd.
|
|
68 |
done ifFalse:[
|
|
69 |
aString := aStream nextChunk.
|
|
70 |
done := aString isNil or:[aString isEmpty].
|
|
71 |
done ifFalse:[
|
10
|
72 |
method := myClass compiler compile:aString
|
|
73 |
forClass:myClass
|
|
74 |
inCategory:myCategory
|
|
75 |
notifying:requestor
|
|
76 |
install:true
|
68
|
77 |
skipIfSame:true.
|
|
78 |
myPrivacy ifTrue:[
|
|
79 |
method private:true
|
|
80 |
]
|
1
|
81 |
]
|
|
82 |
]
|
|
83 |
]
|
|
84 |
!
|
|
85 |
|
|
86 |
fileInFrom:aStream
|
|
87 |
"read method-chunks from the input stream, aStream; compile them
|
|
88 |
and add the methods to the class defined by the class-instance var"
|
|
89 |
|
|
90 |
self fileInFrom:aStream notifying:nil
|
|
91 |
! !
|