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
|
|
14 |
instanceVariableNames:'myClass myCategory'
|
|
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 |
|
5
|
27 |
$Header: /cvs/stx/stx/libbasic/ClassCategoryReader.st,v 1.4 1993-10-13 02:11:16 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.
|
|
46 |
myCategory := aCategory
|
|
47 |
! !
|
|
48 |
|
|
49 |
!ClassCategoryReader methodsFor:'fileIn'!
|
|
50 |
|
|
51 |
fileInFrom:aStream notifying:requestor
|
|
52 |
"read method-chunks from the input stream, aStream; compile them
|
|
53 |
and add the methods to the class defined by the class-instance var;
|
|
54 |
errors notifications are passed to requestor"
|
|
55 |
|
|
56 |
|aString done method|
|
|
57 |
|
|
58 |
done := false.
|
|
59 |
[done] whileFalse:[
|
|
60 |
done := aStream atEnd.
|
|
61 |
done ifFalse:[
|
|
62 |
aString := aStream nextChunk.
|
|
63 |
done := aString isNil or:[aString isEmpty].
|
|
64 |
done ifFalse:[
|
|
65 |
method := Compiler compile:aString
|
|
66 |
forClass:myClass
|
|
67 |
inCategory:myCategory
|
|
68 |
notifying:requestor
|
|
69 |
install:true
|
|
70 |
skipIfSame:true
|
|
71 |
]
|
|
72 |
]
|
|
73 |
]
|
|
74 |
!
|
|
75 |
|
|
76 |
fileInFrom:aStream
|
|
77 |
"read method-chunks from the input stream, aStream; compile them
|
|
78 |
and add the methods to the class defined by the class-instance var"
|
|
79 |
|
|
80 |
self fileInFrom:aStream notifying:nil
|
|
81 |
! !
|