ClassCategoryReader.st
author Claus Gittinger <cg@exept.de>
Sat, 13 Apr 1996 22:35:19 +0200
changeset 1176 1c53fc7a69c0
parent 959 dbf9d63b4a6c
child 1295 83f594f05c52
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     1
"
5
67342904af11 *** empty log message ***
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
167
f93304c133e3 support private, protected and ignored code
claus
parents: 135
diff changeset
     3
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
a27a279701f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
a27a279701f8 Initial revision
claus
parents:
diff changeset
    13
Object subclass:#ClassCategoryReader
784
0811a8196743 prints replaced by infoPrint
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    14
	instanceVariableNames:'myClass myCategory privacy ignore primSpec'
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    15
	classVariableNames:'KeepSource SourceMode'
784
0811a8196743 prints replaced by infoPrint
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    16
	poolDictionaries:''
0811a8196743 prints replaced by infoPrint
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    17
	category:'Kernel-Support'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    18
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    19
88
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    20
!ClassCategoryReader class methodsFor:'documentation'!
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    21
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    22
copyright
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    23
"
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    24
 COPYRIGHT (c) 1989 by Claus Gittinger
167
f93304c133e3 support private, protected and ignored code
claus
parents: 135
diff changeset
    25
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    26
88
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    27
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    28
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    30
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    31
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    32
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    33
"
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    34
!
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    35
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    36
documentation
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    37
"
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    38
    a helper class for fileIn - keeps track of class and category to filein for.
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    39
    Instances of this are created by the #methodsFor: methods in Class, to
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    40
    read the next chunk(s) from a stream.
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    41
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    42
    ClassCategoryReaders allow different ways of keeping the sourceCode of its
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    43
    loaded code. This is controlled by the SourceMode class variable which may be:
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    44
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    45
        #discard         - forget the source code; no browsing/recompilation is possible
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    46
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    47
        #keep            - keep the source code as a string.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    48
                           any saved image will later be fully independent of any
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    49
                           source files.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    50
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    51
        #reference       - keep a reference to the loaded files basename
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    52
                           In order to be browsable, the original sourcefile should be
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    53
                           found along the sourcePath 
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    54
                           (i.e. typically a link in the source directory should be present)
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    55
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    56
        #absReference    - keep a reference to the loaded files absolute pathname
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    57
                           (this is ok in multiUser configurations, where all sourcefiles are mounted
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    58
                           on a common path; typically automounted systems)
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    59
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    60
        #sourceReference - append source to the `st.src' file,
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    61
                           and keep a reference to that file.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    62
                           if the image is later moved to another location,
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    63
                           this file should be moved along with it.
88
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    64
"
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    65
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    66
425
claus
parents: 384
diff changeset
    67
!ClassCategoryReader class methodsFor:'initialization'!
claus
parents: 384
diff changeset
    68
claus
parents: 384
diff changeset
    69
initialize
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    70
    KeepSource := true.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    71
    SourceMode := #keep.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    72
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    73
    "
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    74
     ClassCategoryReader initialize
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    75
    "
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    76
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    77
    "Modified: 9.2.1996 / 17:22:57 / cg"
425
claus
parents: 384
diff changeset
    78
! !
claus
parents: 384
diff changeset
    79
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    80
!ClassCategoryReader class methodsFor:'instance creation'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    81
a27a279701f8 Initial revision
claus
parents:
diff changeset
    82
class:aClass category:aCategory
a27a279701f8 Initial revision
claus
parents:
diff changeset
    83
    "return a new ClassCategoryReader to read methods for aClass with
a27a279701f8 Initial revision
claus
parents:
diff changeset
    84
     methodCategory aCategory"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    85
a27a279701f8 Initial revision
claus
parents:
diff changeset
    86
    ^ self new class:aClass category:aCategory
167
f93304c133e3 support private, protected and ignored code
claus
parents: 135
diff changeset
    87
!
f93304c133e3 support private, protected and ignored code
claus
parents: 135
diff changeset
    88
216
a8abff749575 *** empty log message ***
claus
parents: 167
diff changeset
    89
class:aClass primitiveSpec:which
a8abff749575 *** empty log message ***
claus
parents: 167
diff changeset
    90
    "return a ClassCategoryReader to read a primitiveSpec chunk"
a8abff749575 *** empty log message ***
claus
parents: 167
diff changeset
    91
a8abff749575 *** empty log message ***
claus
parents: 167
diff changeset
    92
    ^ self new class:aClass primitiveSpec:which
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    93
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
    94
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    95
!ClassCategoryReader class methodsFor:'defaults'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    96
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    97
keepSource
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    98
    ^ KeepSource
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    99
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   100
    "Created: 9.9.1995 / 15:22:27 / claus"
216
a8abff749575 *** empty log message ***
claus
parents: 167
diff changeset
   101
!
a8abff749575 *** empty log message ***
claus
parents: 167
diff changeset
   102
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   103
keepSource:aBoolean
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   104
    KeepSource := aBoolean.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   105
    SourceMode := (aBoolean ifTrue:[#keep] ifFalse:[#reference])
68
59faa75185ba *** empty log message ***
claus
parents: 12
diff changeset
   106
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   107
    "Created: 9.9.1995 / 15:22:26 / claus"
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   108
    "Modified: 9.2.1996 / 17:23:04 / cg"
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   109
!
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   110
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   111
sourceMode 
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   112
    "return the sourceMode, which controls how sources are to be handled.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   113
     Read #documentation for more info"
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   114
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   115
    ^ SourceMode
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   116
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   117
    "Created: 9.2.1996 / 17:22:58 / cg"
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   118
!
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   119
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   120
sourceMode:aSymbol 
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   121
    "set the sourceMode, which controls how sources are to be handled.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   122
     Read #documentation for more info"
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   123
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   124
    SourceMode := aSymbol
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   125
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   126
    "Created: 9.2.1996 / 17:23:00 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   127
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   128
a27a279701f8 Initial revision
claus
parents:
diff changeset
   129
!ClassCategoryReader methodsFor:'fileIn'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   130
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   131
fileInFrom:aStream
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   132
    "read method-chunks from the input stream, aStream; compile them
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   133
     and add the methods to the class defined by the class-instance var"
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   134
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   135
    self fileInFrom:aStream notifying:nil passChunk:false
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   136
!
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   137
328
claus
parents: 249
diff changeset
   138
fileInFrom:aStream notifying:requestor passChunk:passChunk
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   139
    "read method-chunks from the input stream, aStream; compile them
a27a279701f8 Initial revision
claus
parents:
diff changeset
   140
     and add the methods to the class defined by the class-instance var;
12
8e03bd717355 *** empty log message ***
claus
parents: 10
diff changeset
   141
     errors and notifications are passed to requestor"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   142
1176
1c53fc7a69c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
   143
    |aString done method compiler canMakeSourceRef sourceFile pos nm src s|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   144
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   145
    Smalltalk silentLoading ifFalse:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   146
        myClass isNil ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   147
            nm := '** UndefinedClass **'
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   148
        ] ifFalse:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   149
            nm := myClass name
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   150
        ].
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   151
        Transcript show:'  '; show:nm; show:' -> '; show:myCategory.
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   152
        ignore ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   153
            Transcript show:' (** ignored **)'.
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   154
        ] ifFalse:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   155
            privacy notNil ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   156
                Transcript show:' (** '; show:privacy; show:' **)'
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   157
            ]
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   158
        ].
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   159
        Transcript cr.
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   160
    ].
868
fc7ab02e0537 only keep sourceRef in methods if the sourceFIle is a '.st' file
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   161
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   162
    canMakeSourceRef := false.
328
claus
parents: 249
diff changeset
   163
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   164
    "/
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   165
    "/ KeepSource controls if
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   166
    "/ the sourceString should be kept or
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   167
    "/ a reference to the fileStream should be placed into the
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   168
    "/ method intead.
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   169
    "/
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   170
    ((SourceMode ~~ #keep) 
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   171
    and:[SourceMode ~~ #discard]) ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   172
        aStream isFileStream ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   173
            sourceFile := aStream pathName.
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   174
            "/
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   175
            "/ only do it, if the sourceFiles name
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   176
            "/ ends with '.st'
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   177
            "/ this prevents methods to reference the changes file.
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   178
            "/
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   179
            (sourceFile endsWith:'.st') ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   180
                canMakeSourceRef := true.
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   181
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   182
                SourceMode == #absReference ifFalse:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   183
                    SourceMode == #sourceReference ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   184
                        sourceFile := 'st.src'.
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   185
                    ] ifFalse:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   186
                        sourceFile := aStream pathName asFilename baseName
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   187
                    ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   188
                ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   189
            ]
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   190
        ]
425
claus
parents: 384
diff changeset
   191
    ].
claus
parents: 384
diff changeset
   192
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   193
    done := false.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   194
    [done] whileFalse:[
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   195
        done := aStream atEnd.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   196
        done ifFalse:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   197
            canMakeSourceRef ifTrue:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   198
                pos := aStream position
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   199
            ].
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   200
            aString := aStream nextChunk.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   201
            done := aString isNil or:[aString isEmpty].
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   202
            done ifFalse:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   203
                primSpec notNil ifTrue:[
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   204
                    ignore ifFalse:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   205
                        myClass perform:primSpec with:aString.
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   206
                        "
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   207
                         ignore rest
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   208
                        "
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   209
                        ignore := true
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   210
                    ]
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   211
                ] ifFalse:[
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   212
                    passChunk ifTrue:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   213
                        requestor source:aString
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   214
                    ].
328
claus
parents: 249
diff changeset
   215
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   216
                    compiler := myClass compilerClass.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   217
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   218
                    "/
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   219
                    "/ kludge - for now;
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   220
                    "/ have to make ST/X's compiler protocol be compatible to ST-80's
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   221
                    "/ for other compilers to work ... (TGEN for example)
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   222
                    "/
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   223
                    (compiler respondsTo:#compile:forClass:inCategory:notifying:install:skipIfSame:)
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   224
                    ifTrue:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   225
                        "/ ST/X's compiler
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   226
                        method :=compiler
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   227
                                     compile:aString
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   228
                                     forClass:myClass
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   229
                                     inCategory:myCategory
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   230
                                     notifying:requestor
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   231
                                     install:true
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   232
                                     skipIfSame:true.
350
claus
parents: 328
diff changeset
   233
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   234
                        (method notNil and:[method ~~ #Error]) ifTrue:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   235
                            canMakeSourceRef ifTrue:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   236
                                (src := method getSource) = aString ifTrue:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   237
                                    "/ it was not corrected ...
350
claus
parents: 328
diff changeset
   238
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   239
                                    SourceMode == #sourceReference ifTrue:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   240
                                        s := sourceFile asFilename appendingWriteStream.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   241
                                        s setToEnd.     
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   242
                                        pos := s position.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   243
                                        s nextChunkPut:src.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   244
                                        s close.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   245
                                    ].
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   246
                                    method sourceFilename:sourceFile position:pos 
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   247
                                ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   248
                            ] ifFalse:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   249
                                SourceMode == #discard ifTrue:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   250
                                    method sourceFilename:nil position:nil
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   251
                                ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   252
                            ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   253
                        ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   254
                    ] ifFalse:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   255
                        "/ some generated (TGEN) compiler
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   256
                        method := compiler new
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   257
                                      compile:aString 
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   258
                                      in:myClass 
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   259
                                      notifying:requestor 
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   260
                                      ifFail:nil
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   261
                    ].
328
claus
parents: 249
diff changeset
   262
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   263
                    ignore ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   264
                        method setToIgnored
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   265
                    ] ifFalse:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   266
                        privacy notNil ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   267
                            privacy == #private ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   268
                                method setToPrivate
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   269
                            ] ifFalse:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   270
                                privacy == #protected ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   271
                                    method setToProtected
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   272
                                ]
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   273
                            ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   274
                        ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   275
                    ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   276
                ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   277
            ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   278
        ]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   279
    ]
425
claus
parents: 384
diff changeset
   280
claus
parents: 384
diff changeset
   281
    "Modified: 9.9.1995 / 15:29:08 / claus"
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   282
    "Modified: 10.2.1996 / 13:24:04 / cg"
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   283
! !
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   284
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   285
!ClassCategoryReader methodsFor:'private'!
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   286
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   287
class:aClass category:aCategory
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   288
    "set the instance variables"
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   289
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   290
    myClass := aClass.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   291
    myCategory := aCategory.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   292
    ignore := false
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   293
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   294
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   295
class:aClass primitiveSpec:which
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   296
    "set the instance variables"
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   297
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   298
    myClass := aClass.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   299
    primSpec := which.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   300
    ignore := false
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   301
! !
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   302
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   303
!ClassCategoryReader methodsFor:'special'!
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   304
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   305
ignoredProtocol 
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   306
    ignore := true
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   307
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   308
    "Created: 10.2.1996 / 12:54:15 / cg"
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   309
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   310
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   311
privateProtocol
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   312
    privacy := #private
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   313
!
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   314
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   315
protectedProtocol
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   316
    privacy := #protected
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   317
! !
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   318
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   319
!ClassCategoryReader class methodsFor:'documentation'!
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   320
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   321
version
1176
1c53fc7a69c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
   322
    ^ '$Header: /cvs/stx/stx/libbasic/ClassCategoryReader.st,v 1.29 1996-04-13 20:35:19 cg Exp $'
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   323
! !
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   324
ClassCategoryReader initialize!