ClassCategoryReader.st
author Claus Gittinger <cg@exept.de>
Fri, 17 Aug 2001 14:37:43 +0200
changeset 5911 b9b601514f13
parent 5747 95f11bec8998
child 6222 339364ec5573
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
5747
95f11bec8998 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5170
diff changeset
    13
"{ Package: 'stx:libbasic' }"
95f11bec8998 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5170
diff changeset
    14
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    15
Object subclass:#ClassCategoryReader
784
0811a8196743 prints replaced by infoPrint
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    16
	instanceVariableNames:'myClass myCategory privacy ignore primSpec'
2404
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
    17
	classVariableNames:'KeepSource SourceMode SkipUnchangedMethods'
784
0811a8196743 prints replaced by infoPrint
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    18
	poolDictionaries:''
0811a8196743 prints replaced by infoPrint
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    19
	category:'Kernel-Support'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    20
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    21
2065
a4f9b960a122 commentary
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
    22
!ClassCategoryReader class methodsFor:'documentation'!
88
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    23
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    24
copyright
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    25
"
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    26
 COPYRIGHT (c) 1989 by Claus Gittinger
167
f93304c133e3 support private, protected and ignored code
claus
parents: 135
diff changeset
    27
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    28
88
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    29
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    30
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    32
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    33
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    34
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    35
"
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    36
!
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    37
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    38
documentation
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    39
"
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    40
    a helper class for fileIn - keeps track of class and category to filein for.
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    41
    Instances of this are created by the #methodsFor: methods in Class, to
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    42
    read the next chunk(s) from a stream.
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    43
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    44
    ClassCategoryReaders allow different ways of keeping the sourceCode of its
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    45
    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
    46
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    47
        #discard         - forget the source code; no browsing/recompilation is possible
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    48
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    49
        #keep            - keep the source code as a string.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    50
                           any saved image will later be fully independent of any
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    51
                           source files.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    52
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    53
        #reference       - keep a reference to the loaded files basename
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    54
                           In order to be browsable, the original sourcefile should be
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    55
                           found along the sourcePath 
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    56
                           (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
    57
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    58
        #absReference    - keep a reference to the loaded files absolute pathname
3860
6ec12b7b2073 added #forceAbsReference sourceMode.
Claus Gittinger <cg@exept.de>
parents: 3519
diff changeset
    59
                           but only if the file ends with .st.
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    60
                           (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
    61
                           on a common path; typically automounted systems)
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    62
3860
6ec12b7b2073 added #forceAbsReference sourceMode.
Claus Gittinger <cg@exept.de>
parents: 3519
diff changeset
    63
        #forceAbsReference 
6ec12b7b2073 added #forceAbsReference sourceMode.
Claus Gittinger <cg@exept.de>
parents: 3519
diff changeset
    64
                         - like above, but also do it for files not ending with .st.
6ec12b7b2073 added #forceAbsReference sourceMode.
Claus Gittinger <cg@exept.de>
parents: 3519
diff changeset
    65
                           Must be used with care - NEVER ever reference sources from the changes
6ec12b7b2073 added #forceAbsReference sourceMode.
Claus Gittinger <cg@exept.de>
parents: 3519
diff changeset
    66
                           file, because the changesBrowser does not adjust methods sources
6ec12b7b2073 added #forceAbsReference sourceMode.
Claus Gittinger <cg@exept.de>
parents: 3519
diff changeset
    67
                           when it compresses or removes changes.
6ec12b7b2073 added #forceAbsReference sourceMode.
Claus Gittinger <cg@exept.de>
parents: 3519
diff changeset
    68
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    69
        #sourceReference - append source to the `st.src' file,
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    70
                           and keep a reference to that file.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    71
                           if the image is later moved to another location,
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    72
                           this file should be moved along with it.
1295
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1176
diff changeset
    73
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1176
diff changeset
    74
    [author:]
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1176
diff changeset
    75
        Claus Gittinger
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1176
diff changeset
    76
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1176
diff changeset
    77
    [see also:]
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1176
diff changeset
    78
        Class PositionableStream
88
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    79
"
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    80
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    81
2065
a4f9b960a122 commentary
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
    82
!ClassCategoryReader class methodsFor:'initialization'!
425
claus
parents: 384
diff changeset
    83
claus
parents: 384
diff changeset
    84
initialize
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    85
    KeepSource := true.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    86
    SourceMode := #keep.
2404
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
    87
    SkipUnchangedMethods := true.
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    88
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    89
    "
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    90
     ClassCategoryReader initialize
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    91
    "
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
    92
2404
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
    93
    "Modified: 14.2.1997 / 18:26:52 / cg"
425
claus
parents: 384
diff changeset
    94
! !
claus
parents: 384
diff changeset
    95
2065
a4f9b960a122 commentary
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
    96
!ClassCategoryReader class methodsFor:'instance creation'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    97
a27a279701f8 Initial revision
claus
parents:
diff changeset
    98
class:aClass category:aCategory
a27a279701f8 Initial revision
claus
parents:
diff changeset
    99
    "return a new ClassCategoryReader to read methods for aClass with
a27a279701f8 Initial revision
claus
parents:
diff changeset
   100
     methodCategory aCategory"
a27a279701f8 Initial revision
claus
parents:
diff changeset
   101
a27a279701f8 Initial revision
claus
parents:
diff changeset
   102
    ^ self new class:aClass category:aCategory
167
f93304c133e3 support private, protected and ignored code
claus
parents: 135
diff changeset
   103
!
f93304c133e3 support private, protected and ignored code
claus
parents: 135
diff changeset
   104
216
a8abff749575 *** empty log message ***
claus
parents: 167
diff changeset
   105
class:aClass primitiveSpec:which
a8abff749575 *** empty log message ***
claus
parents: 167
diff changeset
   106
    "return a ClassCategoryReader to read a primitiveSpec chunk"
a8abff749575 *** empty log message ***
claus
parents: 167
diff changeset
   107
a8abff749575 *** empty log message ***
claus
parents: 167
diff changeset
   108
    ^ self new class:aClass primitiveSpec:which
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   109
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   110
2065
a4f9b960a122 commentary
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
   111
!ClassCategoryReader class methodsFor:'defaults'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   112
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   113
keepSource
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   114
    ^ KeepSource
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   115
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   116
    "Created: 9.9.1995 / 15:22:27 / claus"
216
a8abff749575 *** empty log message ***
claus
parents: 167
diff changeset
   117
!
a8abff749575 *** empty log message ***
claus
parents: 167
diff changeset
   118
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   119
keepSource:aBoolean
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   120
    KeepSource := aBoolean.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   121
    SourceMode := (aBoolean ifTrue:[#keep] ifFalse:[#reference])
68
59faa75185ba *** empty log message ***
claus
parents: 12
diff changeset
   122
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   123
    "Created: 9.9.1995 / 15:22:26 / claus"
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   124
    "Modified: 9.2.1996 / 17:23:04 / cg"
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
2404
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
   127
skipUnchangedMethods
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
   128
    "return true, if the default for unchanged methods is to skip them.
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
   129
     The default is true."
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
   130
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
   131
    ^ SkipUnchangedMethods
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
   132
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
   133
    "Created: 14.2.1997 / 18:27:49 / cg"
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
   134
    "Modified: 14.2.1997 / 18:28:13 / cg"
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
   135
!
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
   136
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
   137
skipUnchangedMethods:aBoolean
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
   138
    "return true, if the default for unchanged methods is to skip them.
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
   139
     The default is true. Can be temporarily changed to false, if
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
   140
     a forced fileIn is required."
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
   141
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
   142
    SkipUnchangedMethods := aBoolean
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
   143
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
   144
    "Created: 14.2.1997 / 18:27:43 / cg"
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
   145
    "Modified: 14.2.1997 / 18:28:42 / cg"
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
   146
!
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
   147
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   148
sourceMode 
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   149
    "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
   150
     Read #documentation for more info"
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   151
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   152
    ^ SourceMode
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   153
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   154
    "Created: 9.2.1996 / 17:22:58 / cg"
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   155
!
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   156
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   157
sourceMode:aSymbol 
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   158
    "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
   159
     Read #documentation for more info"
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   160
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   161
    SourceMode := aSymbol
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   162
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   163
    "Created: 9.2.1996 / 17:23:00 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   164
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   165
a27a279701f8 Initial revision
claus
parents:
diff changeset
   166
!ClassCategoryReader methodsFor:'fileIn'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   167
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   168
fileInFrom:aStream
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   169
    "read method-chunks from the input stream, aStream; compile them
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   170
     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
   171
3453
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   172
    ^ self 
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   173
        fileInFrom:aStream 
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   174
        notifying:nil 
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   175
        passChunk:false
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   176
        single:false
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   177
        silent:nil
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   178
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   179
    "Modified: / 17.5.1998 / 19:58:33 / cg"
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   180
!
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   181
328
claus
parents: 249
diff changeset
   182
fileInFrom:aStream notifying:requestor passChunk:passChunk
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   183
    "read method-chunks from the input stream, aStream; compile them
a27a279701f8 Initial revision
claus
parents:
diff changeset
   184
     and add the methods to the class defined by the class-instance var;
2065
a4f9b960a122 commentary
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
   185
     errors and notifications are passed to requestor.
a4f9b960a122 commentary
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
   186
     If passChunk is true, chunks are given to the requestor,
a4f9b960a122 commentary
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
   187
     via a #source: message, allowing it to open a view showing any
a4f9b960a122 commentary
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
   188
     arronous source code."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   189
1644
db0810ccbd61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1565
diff changeset
   190
    ^ self
db0810ccbd61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1565
diff changeset
   191
        fileInFrom:aStream 
db0810ccbd61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1565
diff changeset
   192
        notifying:requestor 
db0810ccbd61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1565
diff changeset
   193
        passChunk:passChunk 
db0810ccbd61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1565
diff changeset
   194
        single:false
3453
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   195
        silent:nil
1644
db0810ccbd61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1565
diff changeset
   196
3453
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   197
    "Modified: / 17.5.1998 / 19:58:15 / cg"
1644
db0810ccbd61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1565
diff changeset
   198
!
db0810ccbd61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1565
diff changeset
   199
db0810ccbd61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1565
diff changeset
   200
fileInFrom:aStream notifying:requestor passChunk:passChunk single:oneChunkOnly
db0810ccbd61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1565
diff changeset
   201
    "read method-chunks from the input stream, aStream; compile them
db0810ccbd61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1565
diff changeset
   202
     and add the methods to the class defined by the class-instance var;
2065
a4f9b960a122 commentary
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
   203
     errors and notifications are passed to requestor.
a4f9b960a122 commentary
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
   204
     If passChunk is true, chunks are given to the requestor,
a4f9b960a122 commentary
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
   205
     via a #source: message, allowing it to open a view showing any
3028
3a05e7a72d2f comment
Claus Gittinger <cg@exept.de>
parents: 2404
diff changeset
   206
     erronous source code.
2065
a4f9b960a122 commentary
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
   207
     If oneChunkOnly is true, the fileIn is finished after the first chunk."
1644
db0810ccbd61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1565
diff changeset
   208
3453
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   209
    ^ self
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   210
        fileInFrom:aStream 
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   211
        notifying:requestor 
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   212
        passChunk:passChunk 
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   213
        single:oneChunkOnly 
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   214
        silent:nil
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   215
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   216
    "Modified: / 17.5.1998 / 19:58:05 / cg"
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   217
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   218
3453
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   219
fileInFrom:aStream notifying:requestor passChunk:passChunk single:oneChunkOnly silent:beSilent
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   220
    "read method-chunks from the input stream, aStream; compile them
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   221
     and add the methods to the class defined by the class-instance var;
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   222
     errors and notifications are passed to requestor.
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   223
     If passChunk is true, chunks are given to the requestor,
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   224
     via a #source: message, allowing it to open a view showing any
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   225
     erronous source code.
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   226
     If oneChunkOnly is true, the fileIn is finished after the first chunk.
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   227
     The beSilent argument controls output to the transcript, if its true or
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   228
     false. If its nil, output is controlled by the Smalltalk>>silenLoading setting."
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   229
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   230
    |aString done method compiler canMakeSourceRef sourceFile pos nm src s silent|
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   231
5911
b9b601514f13 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5747
diff changeset
   232
b9b601514f13 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5747
diff changeset
   233
    (silent := beSilent isNil) ifTrue:[silent := Smalltalk silentLoading].
3453
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   234
    silent == true ifFalse:[
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   235
        myClass isNil ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   236
            nm := '** UndefinedClass **'
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   237
        ] ifFalse:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   238
            nm := myClass name
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   239
        ].
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   240
        Transcript show:'  '; show:nm; show:' -> '; show:myCategory.
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   241
        ignore ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   242
            Transcript show:' (** ignored **)'.
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   243
        ] ifFalse:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   244
            privacy notNil ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   245
                Transcript show:' (** '; show:privacy; show:' **)'
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   246
            ]
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   247
        ].
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   248
        Transcript cr.
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   249
    ].
868
fc7ab02e0537 only keep sourceRef in methods if the sourceFIle is a '.st' file
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   250
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   251
    canMakeSourceRef := false.
328
claus
parents: 249
diff changeset
   252
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   253
    "/
3519
6f4ccc0c6eff handle squeaks commentStamp: special
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
   254
    "/ SourceMode controls if
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   255
    "/ the sourceString should be kept or
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   256
    "/ a reference to the fileStream should be placed into the
3519
6f4ccc0c6eff handle squeaks commentStamp: special
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
   257
    "/ method instead.
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   258
    "/
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   259
    ((SourceMode ~~ #keep) 
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   260
    and:[SourceMode ~~ #discard]) ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   261
        aStream isFileStream ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   262
            sourceFile := aStream pathName.
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   263
            "/
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   264
            "/ only do it, if the sourceFiles name
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   265
            "/ ends with '.st'
3028
3a05e7a72d2f comment
Claus Gittinger <cg@exept.de>
parents: 2404
diff changeset
   266
            "/ this prevents methods from referencing the changes file.
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   267
            "/
3860
6ec12b7b2073 added #forceAbsReference sourceMode.
Claus Gittinger <cg@exept.de>
parents: 3519
diff changeset
   268
            ((SourceMode == #forceAbsReference)
6ec12b7b2073 added #forceAbsReference sourceMode.
Claus Gittinger <cg@exept.de>
parents: 3519
diff changeset
   269
            or:[sourceFile asFilename hasSuffix:'st']) ifTrue:[
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   270
                canMakeSourceRef := true.
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   271
3860
6ec12b7b2073 added #forceAbsReference sourceMode.
Claus Gittinger <cg@exept.de>
parents: 3519
diff changeset
   272
                (SourceMode ~~ #absReference
3904
4c4cb0d94bd6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3860
diff changeset
   273
                and:[SourceMode ~~ #forceAbsReference]) ifTrue:[
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   274
                    SourceMode == #sourceReference ifTrue:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   275
                        sourceFile := 'st.src'.
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   276
                    ] ifFalse:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   277
                        sourceFile := aStream pathName asFilename baseName
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   278
                    ]
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
            ]
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   281
        ]
425
claus
parents: 384
diff changeset
   282
    ].
claus
parents: 384
diff changeset
   283
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   284
    done := false.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   285
    [done] whileFalse:[
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   286
        done := aStream atEnd.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   287
        done ifFalse:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   288
            canMakeSourceRef ifTrue:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   289
                pos := aStream position
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   290
            ].
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   291
            aString := aStream nextChunk.
3028
3a05e7a72d2f comment
Claus Gittinger <cg@exept.de>
parents: 2404
diff changeset
   292
            done := aString size == 0.
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   293
            done ifFalse:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   294
                primSpec notNil ifTrue:[
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   295
                    ignore ifFalse:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   296
                        myClass perform:primSpec with:aString.
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   297
                        "
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   298
                         ignore rest
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   299
                        "
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   300
                        ignore := true
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   301
                    ]
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   302
                ] ifFalse:[
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   303
                    passChunk ifTrue:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   304
                        requestor source:aString
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   305
                    ].
328
claus
parents: 249
diff changeset
   306
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   307
                    compiler := myClass compilerClass.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   308
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   309
                    "/
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   310
                    "/ kludge - for now;
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   311
                    "/ 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
   312
                    "/ for other compilers to work ... (TGEN for example)
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   313
                    "/
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   314
                    (compiler respondsTo:#compile:forClass:inCategory:notifying:install:skipIfSame:)
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   315
                    ifTrue:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   316
                        "/ ST/X's compiler
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   317
                        method :=compiler
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   318
                                     compile:aString
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   319
                                     forClass:myClass
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   320
                                     inCategory:myCategory
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   321
                                     notifying:requestor
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   322
                                     install:true
2404
77c6111ce6ba added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
   323
                                     skipIfSame:SkipUnchangedMethods.
350
claus
parents: 328
diff changeset
   324
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   325
                        (method notNil and:[method ~~ #Error]) ifTrue:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   326
                            canMakeSourceRef ifTrue:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   327
                                (src := method getSource) = aString ifTrue:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   328
                                    "/ it was not corrected ...
350
claus
parents: 328
diff changeset
   329
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   330
                                    SourceMode == #sourceReference ifTrue:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   331
                                        s := sourceFile asFilename appendingWriteStream.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   332
                                        s setToEnd.     
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   333
                                        pos := s position.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   334
                                        s nextChunkPut:src.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   335
                                        s close.
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   336
                                    ].
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   337
                                    method sourceFilename:sourceFile position:pos 
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   338
                                ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   339
                            ] ifFalse:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   340
                                SourceMode == #discard ifTrue:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   341
                                    method sourceFilename:nil position:nil
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   342
                                ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   343
                            ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   344
                        ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   345
                    ] ifFalse:[
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   346
                        "/ some generated (TGEN) compiler
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   347
                        method := compiler new
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   348
                                      compile:aString 
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   349
                                      in:myClass 
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   350
                                      notifying:requestor 
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   351
                                      ifFail:nil
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   352
                    ].
328
claus
parents: 249
diff changeset
   353
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   354
                    ignore ifTrue:[
3217
568eaf667294 Use #setPrivacy: instead of #setPrivate #setProtected and #setIgnored
Stefan Vogel <sv@exept.de>
parents: 3089
diff changeset
   355
                        method setPrivacy:#ignore
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   356
                    ] ifFalse:[
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   357
                        privacy notNil ifTrue:[
3217
568eaf667294 Use #setPrivacy: instead of #setPrivate #setProtected and #setIgnored
Stefan Vogel <sv@exept.de>
parents: 3089
diff changeset
   358
                            method setPrivacy:privacy
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   359
                        ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   360
                    ]
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   361
                ]
1644
db0810ccbd61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1565
diff changeset
   362
            ].
db0810ccbd61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1565
diff changeset
   363
            oneChunkOnly ifTrue:[done := true].
955
6b5487deebfa more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
   364
        ]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   365
    ]
425
claus
parents: 384
diff changeset
   366
3217
568eaf667294 Use #setPrivacy: instead of #setPrivate #setProtected and #setIgnored
Stefan Vogel <sv@exept.de>
parents: 3089
diff changeset
   367
    "Modified: / 9.9.1995 / 15:29:08 / claus"
568eaf667294 Use #setPrivacy: instead of #setPrivate #setProtected and #setIgnored
Stefan Vogel <sv@exept.de>
parents: 3089
diff changeset
   368
    "Modified: / 23.1.1998 / 15:25:01 / stefan"
3453
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   369
    "Created: / 17.5.1998 / 19:56:32 / cg"
3904
4c4cb0d94bd6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3860
diff changeset
   370
    "Modified: / 29.10.1998 / 21:34:59 / cg"
3453
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   371
!
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   372
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   373
fileInFrom:aStream silent:beSilent
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   374
    "read method-chunks from the input stream, aStream; compile them
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   375
     and add the methods to the class defined by the class-instance var.
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   376
     The beSilent argument controls if a message is to be sent to the Transcript."
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   377
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   378
    ^ self 
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   379
        fileInFrom:aStream 
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   380
        notifying:nil 
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   381
        passChunk:false
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   382
        single:false
3454
57cf0b76c28a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3453
diff changeset
   383
        silent:beSilent
3453
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   384
6bc29ebe14bb added #fileIn:silent:
Claus Gittinger <cg@exept.de>
parents: 3217
diff changeset
   385
    "Created: / 17.5.1998 / 19:59:08 / cg"
3454
57cf0b76c28a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3453
diff changeset
   386
    "Modified: / 17.5.1998 / 19:59:57 / cg"
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   387
! !
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   388
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   389
!ClassCategoryReader methodsFor:'private'!
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   390
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   391
class:aClass category:aCategory
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   392
    "set the instance variables"
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   393
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   394
    myClass := aClass.
5170
c4dba8f4f06e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4708
diff changeset
   395
    "/ ensure that the class is loaded.
c4dba8f4f06e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4708
diff changeset
   396
    myClass autoload.
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   397
    myCategory := aCategory.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   398
    ignore := false
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   399
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   400
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   401
class:aClass primitiveSpec:which
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   402
    "set the instance variables"
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   403
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   404
    myClass := aClass.
5170
c4dba8f4f06e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4708
diff changeset
   405
    "/ ensure that the class is loaded.
c4dba8f4f06e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4708
diff changeset
   406
    myClass autoload.
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   407
    primSpec := which.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   408
    ignore := false
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   409
! !
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   410
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   411
!ClassCategoryReader methodsFor:'special'!
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   412
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   413
ignoredProtocol 
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   414
    ignore := true
959
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   415
dbf9d63b4a6c correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   416
    "Created: 10.2.1996 / 12:54:15 / cg"
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   417
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   418
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   419
privateProtocol
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   420
    privacy := #private
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   421
!
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   422
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   423
protectedProtocol
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   424
    privacy := #protected
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   425
! !
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   426
2065
a4f9b960a122 commentary
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
   427
!ClassCategoryReader class methodsFor:'documentation'!
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   428
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   429
version
5911
b9b601514f13 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5747
diff changeset
   430
    ^ '$Header: /cvs/stx/stx/libbasic/ClassCategoryReader.st,v 1.46 2001-08-17 12:37:00 cg Exp $'
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   431
! !
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   432
ClassCategoryReader initialize!