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