ClassCategoryReader.st
author Claus Gittinger <cg@exept.de>
Thu, 18 Jul 1996 17:42:31 +0200
changeset 1565 63876d73db7d
parent 1295 83f594f05c52
child 1644 db0810ccbd61
permissions -rw-r--r--
checkin from browser
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
1565
63876d73db7d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
    20
!ClassCategoryReader  class methodsFor:'documentation'!
88
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.
1295
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1176
diff changeset
    64
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1176
diff changeset
    65
    [author:]
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1176
diff changeset
    66
        Claus Gittinger
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1176
diff changeset
    67
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1176
diff changeset
    68
    [see also:]
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1176
diff changeset
    69
        Class PositionableStream
88
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    70
"
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    71
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    72
1565
63876d73db7d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
    73
!ClassCategoryReader  class methodsFor:'initialization'!
425
claus
parents: 384
diff changeset
    74
claus
parents: 384
diff changeset
    75
initialize
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    76
    KeepSource := true.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    77
    SourceMode := #keep.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    78
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    79
    "
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    80
     ClassCategoryReader initialize
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    81
    "
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    82
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    83
    "Modified: 9.2.1996 / 17:22:57 / cg"
425
claus
parents: 384
diff changeset
    84
! !
claus
parents: 384
diff changeset
    85
1565
63876d73db7d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
    86
!ClassCategoryReader  class methodsFor:'instance creation'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    87
a27a279701f8 Initial revision
claus
parents:
diff changeset
    88
class:aClass category:aCategory
a27a279701f8 Initial revision
claus
parents:
diff changeset
    89
    "return a new ClassCategoryReader to read methods for aClass with
a27a279701f8 Initial revision
claus
parents:
diff changeset
    90
     methodCategory aCategory"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    91
a27a279701f8 Initial revision
claus
parents:
diff changeset
    92
    ^ self new class:aClass category:aCategory
167
f93304c133e3 support private, protected and ignored code
claus
parents: 135
diff changeset
    93
!
f93304c133e3 support private, protected and ignored code
claus
parents: 135
diff changeset
    94
216
a8abff749575 *** empty log message ***
claus
parents: 167
diff changeset
    95
class:aClass primitiveSpec:which
a8abff749575 *** empty log message ***
claus
parents: 167
diff changeset
    96
    "return a ClassCategoryReader to read a primitiveSpec chunk"
a8abff749575 *** empty log message ***
claus
parents: 167
diff changeset
    97
a8abff749575 *** empty log message ***
claus
parents: 167
diff changeset
    98
    ^ self new class:aClass primitiveSpec:which
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    99
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   100
1565
63876d73db7d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   101
!ClassCategoryReader  class methodsFor:'defaults'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   102
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   103
keepSource
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   104
    ^ KeepSource
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   105
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   106
    "Created: 9.9.1995 / 15:22:27 / claus"
216
a8abff749575 *** empty log message ***
claus
parents: 167
diff changeset
   107
!
a8abff749575 *** empty log message ***
claus
parents: 167
diff changeset
   108
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   109
keepSource:aBoolean
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   110
    KeepSource := aBoolean.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   111
    SourceMode := (aBoolean ifTrue:[#keep] ifFalse:[#reference])
68
59faa75185ba *** empty log message ***
claus
parents: 12
diff changeset
   112
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   113
    "Created: 9.9.1995 / 15:22:26 / claus"
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   114
    "Modified: 9.2.1996 / 17:23:04 / cg"
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   115
!
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
sourceMode 
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   118
    "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
   119
     Read #documentation for more info"
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   120
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   121
    ^ SourceMode
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   122
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   123
    "Created: 9.2.1996 / 17:22:58 / cg"
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   124
!
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
sourceMode:aSymbol 
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   127
    "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
   128
     Read #documentation for more info"
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   129
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   130
    SourceMode := aSymbol
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   131
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   132
    "Created: 9.2.1996 / 17:23:00 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   133
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   134
a27a279701f8 Initial revision
claus
parents:
diff changeset
   135
!ClassCategoryReader methodsFor:'fileIn'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   136
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   137
fileInFrom:aStream
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   138
    "read method-chunks from the input stream, aStream; compile them
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   139
     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
   140
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   141
    self fileInFrom:aStream notifying:nil passChunk:false
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   142
!
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   143
328
claus
parents: 249
diff changeset
   144
fileInFrom:aStream notifying:requestor passChunk:passChunk
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   145
    "read method-chunks from the input stream, aStream; compile them
a27a279701f8 Initial revision
claus
parents:
diff changeset
   146
     and add the methods to the class defined by the class-instance var;
12
8e03bd717355 *** empty log message ***
claus
parents: 10
diff changeset
   147
     errors and notifications are passed to requestor"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   148
1176
1c53fc7a69c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
   149
    |aString done method compiler canMakeSourceRef sourceFile pos nm src s|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   150
1565
63876d73db7d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   151
    Smalltalk silentLoading == true ifFalse:[
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   152
        myClass isNil ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   153
            nm := '** UndefinedClass **'
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
            nm := myClass name
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   156
        ].
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   157
        Transcript show:'  '; show:nm; show:' -> '; show:myCategory.
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   158
        ignore ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   159
            Transcript show:' (** ignored **)'.
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   160
        ] ifFalse:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   161
            privacy notNil ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   162
                Transcript show:' (** '; show:privacy; show:' **)'
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   163
            ]
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
        Transcript cr.
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   166
    ].
868
fc7ab02e0537 only keep sourceRef in methods if the sourceFIle is a '.st' file
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   167
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   168
    canMakeSourceRef := false.
328
claus
parents: 249
diff changeset
   169
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   170
    "/
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   171
    "/ KeepSource controls if
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   172
    "/ the sourceString should be kept or
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   173
    "/ a reference to the fileStream should be placed into the
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   174
    "/ method intead.
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   175
    "/
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   176
    ((SourceMode ~~ #keep) 
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   177
    and:[SourceMode ~~ #discard]) ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   178
        aStream isFileStream ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   179
            sourceFile := aStream pathName.
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   180
            "/
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   181
            "/ only do it, if the sourceFiles name
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   182
            "/ ends with '.st'
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   183
            "/ this prevents methods to reference the changes file.
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   184
            "/
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   185
            (sourceFile endsWith:'.st') ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   186
                canMakeSourceRef := true.
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   187
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   188
                SourceMode == #absReference ifFalse:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   189
                    SourceMode == #sourceReference ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   190
                        sourceFile := 'st.src'.
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   191
                    ] ifFalse:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   192
                        sourceFile := aStream pathName asFilename baseName
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   193
                    ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   194
                ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   195
            ]
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   196
        ]
425
claus
parents: 384
diff changeset
   197
    ].
claus
parents: 384
diff changeset
   198
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   199
    done := false.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   200
    [done] whileFalse:[
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   201
        done := aStream atEnd.
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
            canMakeSourceRef ifTrue:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   204
                pos := aStream position
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   205
            ].
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   206
            aString := aStream nextChunk.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   207
            done := aString isNil or:[aString isEmpty].
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   208
            done ifFalse:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   209
                primSpec notNil ifTrue:[
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   210
                    ignore ifFalse:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   211
                        myClass perform:primSpec with:aString.
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   212
                        "
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   213
                         ignore rest
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   214
                        "
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   215
                        ignore := true
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   216
                    ]
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   217
                ] ifFalse:[
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   218
                    passChunk ifTrue:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   219
                        requestor source:aString
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   220
                    ].
328
claus
parents: 249
diff changeset
   221
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   222
                    compiler := myClass compilerClass.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   223
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   224
                    "/
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   225
                    "/ kludge - for now;
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   226
                    "/ 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
   227
                    "/ for other compilers to work ... (TGEN for example)
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   228
                    "/
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   229
                    (compiler respondsTo:#compile:forClass:inCategory:notifying:install:skipIfSame:)
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   230
                    ifTrue:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   231
                        "/ ST/X's compiler
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   232
                        method :=compiler
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   233
                                     compile:aString
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   234
                                     forClass:myClass
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   235
                                     inCategory:myCategory
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   236
                                     notifying:requestor
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   237
                                     install:true
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   238
                                     skipIfSame:true.
350
claus
parents: 328
diff changeset
   239
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   240
                        (method notNil and:[method ~~ #Error]) ifTrue:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   241
                            canMakeSourceRef ifTrue:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   242
                                (src := method getSource) = aString ifTrue:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   243
                                    "/ it was not corrected ...
350
claus
parents: 328
diff changeset
   244
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   245
                                    SourceMode == #sourceReference ifTrue:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   246
                                        s := sourceFile asFilename appendingWriteStream.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   247
                                        s setToEnd.     
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   248
                                        pos := s position.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   249
                                        s nextChunkPut:src.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   250
                                        s close.
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
                                    method sourceFilename:sourceFile position:pos 
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
                                SourceMode == #discard ifTrue:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   256
                                    method sourceFilename:nil position:nil
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   257
                                ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   258
                            ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   259
                        ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   260
                    ] ifFalse:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   261
                        "/ some generated (TGEN) compiler
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   262
                        method := compiler new
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   263
                                      compile:aString 
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   264
                                      in:myClass 
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   265
                                      notifying:requestor 
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   266
                                      ifFail:nil
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   267
                    ].
328
claus
parents: 249
diff changeset
   268
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   269
                    ignore ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   270
                        method setToIgnored
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   271
                    ] ifFalse:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   272
                        privacy notNil ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   273
                            privacy == #private ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   274
                                method setToPrivate
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   275
                            ] ifFalse:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   276
                                privacy == #protected ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   277
                                    method setToProtected
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   278
                                ]
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   279
                            ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   280
                        ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   281
                    ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   282
                ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   283
            ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   284
        ]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   285
    ]
425
claus
parents: 384
diff changeset
   286
claus
parents: 384
diff changeset
   287
    "Modified: 9.9.1995 / 15:29:08 / claus"
1565
63876d73db7d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   288
    "Modified: 18.7.1996 / 17:42:09 / cg"
699
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
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   291
!ClassCategoryReader methodsFor:'private'!
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   292
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   293
class:aClass category:aCategory
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   294
    "set the instance variables"
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   295
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   296
    myClass := aClass.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   297
    myCategory := aCategory.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   298
    ignore := false
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   299
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   300
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   301
class:aClass primitiveSpec:which
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   302
    "set the instance variables"
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   303
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   304
    myClass := aClass.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   305
    primSpec := which.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   306
    ignore := false
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   307
! !
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   308
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   309
!ClassCategoryReader methodsFor:'special'!
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   310
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   311
ignoredProtocol 
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   312
    ignore := true
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   313
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   314
    "Created: 10.2.1996 / 12:54:15 / cg"
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   315
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   316
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   317
privateProtocol
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   318
    privacy := #private
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   319
!
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
protectedProtocol
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   322
    privacy := #protected
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   323
! !
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   324
1565
63876d73db7d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   325
!ClassCategoryReader  class methodsFor:'documentation'!
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   326
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   327
version
1565
63876d73db7d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   328
    ^ '$Header: /cvs/stx/stx/libbasic/ClassCategoryReader.st,v 1.31 1996-07-18 15:42:31 cg Exp $'
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   329
! !
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   330
ClassCategoryReader initialize!