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