PositionableStream.st
author Claus Gittinger <cg@exept.de>
Tue, 18 May 2004 15:30:47 +0200
changeset 8363 a7644643904e
parent 8320 229adaeaf183
child 8443 7bc4348c059e
permissions -rw-r--r--
dont send obsolete message (OptionBox request:..form:..)
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
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
     3
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
a27a279701f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
5393
7e2230bd4bad moved some stuff to superclass
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
    13
"{ Package: 'stx:libbasic' }"
7e2230bd4bad moved some stuff to superclass
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
    14
57
db9677479d35 *** empty log message ***
claus
parents: 44
diff changeset
    15
PeekableStream subclass:#PositionableStream
973
5bb2473bf1ef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 875
diff changeset
    16
	instanceVariableNames:'collection position readLimit writeLimit'
4405
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
    17
	classVariableNames:'ZeroPosition InvalidPositionErrorSignal ErrorDuringFileInSignal
5393
7e2230bd4bad moved some stuff to superclass
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
    18
		CurrentFileInDirectoryQuerySignal ChunkSeparator'
973
5bb2473bf1ef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 875
diff changeset
    19
	poolDictionaries:''
5bb2473bf1ef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 875
diff changeset
    20
	category:'Streams'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    21
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    22
1897
22d1ce9b62a4 fixes for packageQuery
Claus Gittinger <cg@exept.de>
parents: 1489
diff changeset
    23
!PositionableStream class methodsFor:'documentation'!
88
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    24
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    25
copyright
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    26
"
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    27
 COPYRIGHT (c) 1989 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
    28
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    29
88
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    30
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    31
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    33
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    34
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    35
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    36
"
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    37
!
10
claus
parents: 5
diff changeset
    38
88
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    39
documentation
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    40
"
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    41
    Instances of PositionableStream allow positioning the read pointer.
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    42
    The PositionableStream class also adds methods for source-chunk reading
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    43
    and writing, and for filing-in/out of source code.
3249
8401c3e42165 checkin to force re-checkout.
Claus Gittinger <cg@exept.de>
parents: 3184
diff changeset
    44
88
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    45
    This is an abstract class.
1295
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1086
diff changeset
    46
4405
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
    47
    Compatibility Notice:
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
    48
       For historical reasons, ST/X starts with a 1-position (i.e. as in collections),
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
    49
       while ST-80 uses 0-based postions for streams and 1-based positions for collections.
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
    50
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
    51
    THIS CERTAINLY IS BAD.
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
    52
    To allow for portable code, this method can be asked to return the initial position.
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
    53
    (for code, which ought to execute under other systems, use:
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
    54
       posZero := (PositionableStream class respondsTo:#zeroPosition) 
7051
984d8271d06b preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
    55
		       ifTrue:[PositionableStream zeroPosition]
984d8271d06b preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
    56
		       ifFalse:[0] 
5228
637a1a93b740 comments
Claus Gittinger <cg@exept.de>
parents: 5223
diff changeset
    57
    Please use this query for ST/X programs - we will eventually switch to a 0-based
637a1a93b740 comments
Claus Gittinger <cg@exept.de>
parents: 5223
diff changeset
    58
    indexing scheme, and your programs should be prepared for that.
4405
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
    59
1295
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1086
diff changeset
    60
    [author:]
7051
984d8271d06b preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
    61
	Claus Gittinger
88
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    62
"
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    63
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    64
1897
22d1ce9b62a4 fixes for packageQuery
Claus Gittinger <cg@exept.de>
parents: 1489
diff changeset
    65
!PositionableStream class methodsFor:'initialization'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    66
10
claus
parents: 5
diff changeset
    67
initialize
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
    68
    "setup the signal used to handle errors during fileIn"
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
    69
7363
721c2a72449a stream position now 0-based
Claus Gittinger <cg@exept.de>
parents: 7261
diff changeset
    70
    ZeroPosition := 0.        "/ changed with stx rel5.1
721c2a72449a stream position now 0-based
Claus Gittinger <cg@exept.de>
parents: 7261
diff changeset
    71
10
claus
parents: 5
diff changeset
    72
    ErrorDuringFileInSignal isNil ifTrue:[
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
    73
        ErrorDuringFileInSignal := Error newSignalMayProceed:true.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
    74
        ErrorDuringFileInSignal nameClass:self message:#errorDuringFileInSignal.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
    75
        ErrorDuringFileInSignal notifierString:'error during fileIn'.
276
3b6d97620494 *** empty log message ***
claus
parents: 253
diff changeset
    76
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
    77
        InvalidPositionErrorSignal := PositionOutOfBoundsError.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
    78
        InvalidPositionErrorSignal notifierString:'position out of bounds: '.
2966
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
    79
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
    80
        CurrentFileInDirectoryQuerySignal := QuerySignal new.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
    81
        CurrentFileInDirectoryQuerySignal nameClass:self message:#currentFileInDirectoryQuerySignal.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
    82
        CurrentFileInDirectoryQuerySignal notifierString:'query for current directory when filing in'.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
    83
        CurrentFileInDirectoryQuerySignal handlerBlock:[:ex | ex proceedWith:Filename currentDirectory].
10
claus
parents: 5
diff changeset
    84
    ]
claus
parents: 5
diff changeset
    85
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    86
1897
22d1ce9b62a4 fixes for packageQuery
Claus Gittinger <cg@exept.de>
parents: 1489
diff changeset
    87
!PositionableStream class methodsFor:'instance creation'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    88
a27a279701f8 Initial revision
claus
parents:
diff changeset
    89
on:aCollection
a27a279701f8 Initial revision
claus
parents:
diff changeset
    90
    "return a new PositionableStream streaming on aCollection"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    91
a27a279701f8 Initial revision
claus
parents:
diff changeset
    92
    ^ (self basicNew) on:aCollection
a27a279701f8 Initial revision
claus
parents:
diff changeset
    93
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    94
a27a279701f8 Initial revision
claus
parents:
diff changeset
    95
on:aCollection from:first to:last
a27a279701f8 Initial revision
claus
parents:
diff changeset
    96
    "return a new PositionableStream streaming on aCollection
a27a279701f8 Initial revision
claus
parents:
diff changeset
    97
     from first to last"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    98
369
claus
parents: 362
diff changeset
    99
    ^ (self basicNew) on:aCollection from:first to:last
57
db9677479d35 *** empty log message ***
claus
parents: 44
diff changeset
   100
!
db9677479d35 *** empty log message ***
claus
parents: 44
diff changeset
   101
db9677479d35 *** empty log message ***
claus
parents: 44
diff changeset
   102
with:aCollection
db9677479d35 *** empty log message ***
claus
parents: 44
diff changeset
   103
    "return a new PositionableStream streaming on aCollection,
db9677479d35 *** empty log message ***
claus
parents: 44
diff changeset
   104
     the stream is positioned to the end of the collection."
db9677479d35 *** empty log message ***
claus
parents: 44
diff changeset
   105
362
claus
parents: 360
diff changeset
   106
    ^ (self basicNew) with:aCollection
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   107
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   108
3032
d267a0b1b48d handle empty chunks when filing in
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   109
!PositionableStream class methodsFor:'Signal constants'!
d267a0b1b48d handle empty chunks when filing in
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   110
5223
06cf79da1d4a added currentFileInDirectory query
tm
parents: 5098
diff changeset
   111
currentFileInDirectoryQuerySignal
06cf79da1d4a added currentFileInDirectory query
tm
parents: 5098
diff changeset
   112
    "return the querySignal, which can be used to ask for the current directory
5228
637a1a93b740 comments
Claus Gittinger <cg@exept.de>
parents: 5223
diff changeset
   113
     during a fileIn (that is the directory where the filed-in file resides),
637a1a93b740 comments
Claus Gittinger <cg@exept.de>
parents: 5223
diff changeset
   114
     and in a fileBrowsers doIt.
637a1a93b740 comments
Claus Gittinger <cg@exept.de>
parents: 5223
diff changeset
   115
     Using this, allows for the loaded code or doIts to ask for the fileBrowsers
637a1a93b740 comments
Claus Gittinger <cg@exept.de>
parents: 5223
diff changeset
   116
     current directory, by asking this querySignal (which is nice sometimes)."
5223
06cf79da1d4a added currentFileInDirectory query
tm
parents: 5098
diff changeset
   117
06cf79da1d4a added currentFileInDirectory query
tm
parents: 5098
diff changeset
   118
    ^ CurrentFileInDirectoryQuerySignal
06cf79da1d4a added currentFileInDirectory query
tm
parents: 5098
diff changeset
   119
!
06cf79da1d4a added currentFileInDirectory query
tm
parents: 5098
diff changeset
   120
3032
d267a0b1b48d handle empty chunks when filing in
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   121
invalidPositionErrorSignal
d267a0b1b48d handle empty chunks when filing in
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   122
    "return the signal raised if positioning is attempted to an
d267a0b1b48d handle empty chunks when filing in
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   123
     invalid position (i.e. before the begin of the stream or after
d267a0b1b48d handle empty chunks when filing in
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   124
     the end)"
d267a0b1b48d handle empty chunks when filing in
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   125
8320
229adaeaf183 Use exception classes instead of class vars
Stefan Vogel <sv@exept.de>
parents: 8318
diff changeset
   126
    ^ PositionOutOfBoundsError
3032
d267a0b1b48d handle empty chunks when filing in
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   127
! !
d267a0b1b48d handle empty chunks when filing in
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   128
1897
22d1ce9b62a4 fixes for packageQuery
Claus Gittinger <cg@exept.de>
parents: 1489
diff changeset
   129
!PositionableStream class methodsFor:'constants'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   130
4405
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   131
zeroPosition
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   132
    "return the number, which marks the initial position.
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   133
     Compatibility Notice:
7051
984d8271d06b preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
   134
	For historical reasons, ST/X starts with a 1-position (i.e. as in collections),
984d8271d06b preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
   135
	while ST-80 uses 0-based postions for streams and 1-based positions for collections.
4405
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   136
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   137
     THIS CERTAINLY IS BAD.
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   138
     To allow for portable code, this method can be asked to return the initial position.
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   139
     (for code, which ought to execute under other systems, use:
7051
984d8271d06b preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
   140
	posZero := (PositionableStream class respondsTo:#zeroPosition) 
984d8271d06b preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
   141
			ifTrue:[PositionableStream zeroPosition]
984d8271d06b preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
   142
			ifFalse:[0] 
4405
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   143
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   144
     Be prepared for this to be changed to return 0 as other ST's do.
7051
984d8271d06b preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
   145
	"
4405
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   146
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   147
    ^ ZeroPosition
360
claus
parents: 329
diff changeset
   148
! !
claus
parents: 329
diff changeset
   149
6777
5efddf5358b2 currentFileInDirectory query
Claus Gittinger <cg@exept.de>
parents: 6707
diff changeset
   150
!PositionableStream class methodsFor:'queries'!
5efddf5358b2 currentFileInDirectory query
Claus Gittinger <cg@exept.de>
parents: 6707
diff changeset
   151
5efddf5358b2 currentFileInDirectory query
Claus Gittinger <cg@exept.de>
parents: 6707
diff changeset
   152
currentFileInDirectory
5efddf5358b2 currentFileInDirectory query
Claus Gittinger <cg@exept.de>
parents: 6707
diff changeset
   153
    "during a fileIn (if a script), the script can ask for the current directory"
5efddf5358b2 currentFileInDirectory query
Claus Gittinger <cg@exept.de>
parents: 6707
diff changeset
   154
5efddf5358b2 currentFileInDirectory query
Claus Gittinger <cg@exept.de>
parents: 6707
diff changeset
   155
    ^ CurrentFileInDirectoryQuerySignal query
5efddf5358b2 currentFileInDirectory query
Claus Gittinger <cg@exept.de>
parents: 6707
diff changeset
   156
! !
5efddf5358b2 currentFileInDirectory query
Claus Gittinger <cg@exept.de>
parents: 6707
diff changeset
   157
7261
f35fc9cee675 method category rename
Claus Gittinger <cg@exept.de>
parents: 7226
diff changeset
   158
!PositionableStream methodsFor:'Compatibility-Dolphin'!
6413
dc8d492a39ff dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 6361
diff changeset
   159
dc8d492a39ff dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 6361
diff changeset
   160
endChunk
dc8d492a39ff dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 6361
diff changeset
   161
    self nextPutChunkSeparator
dc8d492a39ff dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 6361
diff changeset
   162
! !
dc8d492a39ff dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 6361
diff changeset
   163
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   164
!PositionableStream methodsFor:'accessing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   165
7686
290cda6075ac String new -> uninitializedNew: / basicNew:
Claus Gittinger <cg@exept.de>
parents: 7619
diff changeset
   166
collection
290cda6075ac String new -> uninitializedNew: / basicNew:
Claus Gittinger <cg@exept.de>
parents: 7619
diff changeset
   167
    ^ collection
290cda6075ac String new -> uninitializedNew: / basicNew:
Claus Gittinger <cg@exept.de>
parents: 7619
diff changeset
   168
!
290cda6075ac String new -> uninitializedNew: / basicNew:
Claus Gittinger <cg@exept.de>
parents: 7619
diff changeset
   169
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   170
contents
a27a279701f8 Initial revision
claus
parents:
diff changeset
   171
    "return the entire contents of the stream"
a27a279701f8 Initial revision
claus
parents:
diff changeset
   172
a27a279701f8 Initial revision
claus
parents:
diff changeset
   173
    ^ collection
a27a279701f8 Initial revision
claus
parents:
diff changeset
   174
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   175
a27a279701f8 Initial revision
claus
parents:
diff changeset
   176
peek
a27a279701f8 Initial revision
claus
parents:
diff changeset
   177
    "look ahead for and return the next element"
a27a279701f8 Initial revision
claus
parents:
diff changeset
   178
a27a279701f8 Initial revision
claus
parents:
diff changeset
   179
    |peekObject|
a27a279701f8 Initial revision
claus
parents:
diff changeset
   180
a27a279701f8 Initial revision
claus
parents:
diff changeset
   181
    peekObject := self next.
10
claus
parents: 5
diff changeset
   182
    self backStep.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   183
    ^ peekObject
a27a279701f8 Initial revision
claus
parents:
diff changeset
   184
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   185
2432
5338f9b60a66 added #peekForAll:
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   186
peekForAll:aCollection
5338f9b60a66 added #peekForAll:
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   187
    "return true and advance if the next elements are the same
5338f9b60a66 added #peekForAll:
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   188
     as aCollection. 
5338f9b60a66 added #peekForAll:
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   189
     otherwise stay and let the position unchanged"
5338f9b60a66 added #peekForAll:
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   190
5338f9b60a66 added #peekForAll:
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   191
    |oldPos|
5338f9b60a66 added #peekForAll:
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   192
5338f9b60a66 added #peekForAll:
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   193
    oldPos := self position.
5338f9b60a66 added #peekForAll:
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   194
    (self next:(aCollection size)) = aCollection ifTrue:[
7051
984d8271d06b preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
   195
	^ true
2432
5338f9b60a66 added #peekForAll:
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   196
    ].
5338f9b60a66 added #peekForAll:
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   197
    self position:oldPos.
5338f9b60a66 added #peekForAll:
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   198
    ^ false
5338f9b60a66 added #peekForAll:
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   199
5338f9b60a66 added #peekForAll:
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   200
    "Created: 1.3.1997 / 15:11:25 / cg"
5338f9b60a66 added #peekForAll:
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   201
!
5338f9b60a66 added #peekForAll:
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   202
3905
682fc38fd339 added read-access to readLimit.
Claus Gittinger <cg@exept.de>
parents: 3604
diff changeset
   203
readLimit
682fc38fd339 added read-access to readLimit.
Claus Gittinger <cg@exept.de>
parents: 3604
diff changeset
   204
    "return the read-limit; thats the position at which EOF is returned"
682fc38fd339 added read-access to readLimit.
Claus Gittinger <cg@exept.de>
parents: 3604
diff changeset
   205
682fc38fd339 added read-access to readLimit.
Claus Gittinger <cg@exept.de>
parents: 3604
diff changeset
   206
    ^ readLimit
682fc38fd339 added read-access to readLimit.
Claus Gittinger <cg@exept.de>
parents: 3604
diff changeset
   207
682fc38fd339 added read-access to readLimit.
Claus Gittinger <cg@exept.de>
parents: 3604
diff changeset
   208
    "Created: / 30.10.1998 / 16:47:04 / cg"
682fc38fd339 added read-access to readLimit.
Claus Gittinger <cg@exept.de>
parents: 3604
diff changeset
   209
!
682fc38fd339 added read-access to readLimit.
Claus Gittinger <cg@exept.de>
parents: 3604
diff changeset
   210
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   211
readLimit:aNumber
369
claus
parents: 362
diff changeset
   212
    "set the read-limit; thats the position at which EOF is returned"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   213
a27a279701f8 Initial revision
claus
parents:
diff changeset
   214
    readLimit := aNumber
369
claus
parents: 362
diff changeset
   215
!
claus
parents: 362
diff changeset
   216
claus
parents: 362
diff changeset
   217
writeLimit:aNumber
claus
parents: 362
diff changeset
   218
    "set the writeLimit; thats the position after which writing is prohibited"
claus
parents: 362
diff changeset
   219
claus
parents: 362
diff changeset
   220
    writeLimit := aNumber
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   221
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   222
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
   223
!PositionableStream methodsFor:'fileIn'!
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
   224
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   225
askForDebug:message
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   226
    "launch a box asking if a debugger is wanted - used when an error
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   227
     occurs while filing in"
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   228
4416
c6f292792b81 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
   229
    ^ self askForDebug:message canContinueForAll:false
c6f292792b81 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
   230
!
c6f292792b81 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
   231
c6f292792b81 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
   232
askForDebug:message canContinueForAll:canContinueForAll
c6f292792b81 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
   233
    "launch a box asking if a debugger is wanted - used when an error
c6f292792b81 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
   234
     occurs while filing in"
c6f292792b81 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
   235
c6f292792b81 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
   236
    |labels values|
c6f292792b81 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
   237
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   238
    Smalltalk isInitialized ifFalse:[
7578
9ac1e4ee012a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7573
diff changeset
   239
        'PositionableStream [warning]: fileIn error during startup: ' errorPrint. message errorPrintCR.
9ac1e4ee012a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7573
diff changeset
   240
        ^ #debug
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   241
    ].
875
2bb6fea4cb55 dont launch box when fileIn errors occur during startup
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
   242
    "/
2bb6fea4cb55 dont launch box when fileIn errors occur during startup
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
   243
    "/ are we in the startup sequence of an image restart ?
2bb6fea4cb55 dont launch box when fileIn errors occur during startup
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
   244
    "/
2bb6fea4cb55 dont launch box when fileIn errors occur during startup
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
   245
    Processor activeProcessIsSystemProcess ifTrue:[
7578
9ac1e4ee012a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7573
diff changeset
   246
        'PositionableStream [warning]: fileIn error during startup: ' errorPrint. message errorPrintCR.
9ac1e4ee012a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7573
diff changeset
   247
        ^ #continue
875
2bb6fea4cb55 dont launch box when fileIn errors occur during startup
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
   248
    ].
2bb6fea4cb55 dont launch box when fileIn errors occur during startup
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
   249
4416
c6f292792b81 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
   250
    canContinueForAll ifTrue:[
7578
9ac1e4ee012a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7573
diff changeset
   251
          labels := #('Cancel' 'Skip' 'Debug' 'Dont ask again' 'Continue').
9ac1e4ee012a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7573
diff changeset
   252
          values := #(#abort   #skip  #debug  #continueForAll #continue).
4416
c6f292792b81 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
   253
    ] ifFalse:[
7578
9ac1e4ee012a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7573
diff changeset
   254
          labels := #('Cancel' 'Skip' 'Debug' 'Continue').
9ac1e4ee012a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7573
diff changeset
   255
          values := #(#abort  #skip   #debug #continue).
4416
c6f292792b81 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
   256
    ].
6699
3a8b14a9c51a offer cancelAll in fileIn (if AbortAllSignal is handled)
Claus Gittinger <cg@exept.de>
parents: 6626
diff changeset
   257
    AbortAllSignal isHandled ifTrue:[
3a8b14a9c51a offer cancelAll in fileIn (if AbortAllSignal is handled)
Claus Gittinger <cg@exept.de>
parents: 6626
diff changeset
   258
      labels := #('Cancel All') , labels.
3a8b14a9c51a offer cancelAll in fileIn (if AbortAllSignal is handled)
Claus Gittinger <cg@exept.de>
parents: 6626
diff changeset
   259
      values := #(#cancelAll) , values.
3a8b14a9c51a offer cancelAll in fileIn (if AbortAllSignal is handled)
Claus Gittinger <cg@exept.de>
parents: 6626
diff changeset
   260
    ].
4416
c6f292792b81 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
   261
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   262
    ^ OptionBox 
7578
9ac1e4ee012a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7573
diff changeset
   263
          request:message 
9ac1e4ee012a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7573
diff changeset
   264
          label:'Error in fileIn'
8363
a7644643904e dont send obsolete message (OptionBox request:..form:..)
Claus Gittinger <cg@exept.de>
parents: 8320
diff changeset
   265
          image:(WarningBox iconBitmap)
7578
9ac1e4ee012a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7573
diff changeset
   266
          buttonLabels:labels
9ac1e4ee012a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7573
diff changeset
   267
          values:values
9ac1e4ee012a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7573
diff changeset
   268
          default:#continue
9ac1e4ee012a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7573
diff changeset
   269
          onCancel:#abort.
975
716245c81bc0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
   270
2130
b9e7e1cf98bd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2005
diff changeset
   271
    "Modified: 10.1.1997 / 18:00:56 / cg"
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   272
!
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   273
7573
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   274
basicFileInNotifying:someone passChunk:passChunk
5302
f654a1cbc5b0 support for xml-fileIn
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   275
    "central method to file in from the receiver, i.e. read chunks and evaluate them -
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   276
     return the value of the last chunk.
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   277
     Someone (which is usually some codeView) is notified of errors."
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   278
2893
8ba406da6b22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2559
diff changeset
   279
    |lastValue pkg spc spaces
3584
099a64bc9b63 support for V'Age fileIn (application stuff)
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
   280
     packageQuerySignal nameSpaceQuerySignal usedNameSpaceQuerySignal
099a64bc9b63 support for V'Age fileIn (application stuff)
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
   281
     changeDefaultApplicationNotificationSignal
099a64bc9b63 support for V'Age fileIn (application stuff)
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
   282
     defaultApplicationQuerySignal defaultApplication
5250
991f068f9a80 not all query signals are passed (packageQuery)
Claus Gittinger <cg@exept.de>
parents: 5228
diff changeset
   283
     confirmationQuerySignal handledSignals passedSignals
991f068f9a80 not all query signals are passed (packageQuery)
Claus Gittinger <cg@exept.de>
parents: 5228
diff changeset
   284
     dontAskSignals askSomeoneForPackage redef outerContext|
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   285
5302
f654a1cbc5b0 support for xml-fileIn
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   286
    self skipSeparators.
6538
1828dcb8f067 Allow #! as begin of filein chunk
Stefan Vogel <sv@exept.de>
parents: 6494
diff changeset
   287
    lastValue := self peek.
1828dcb8f067 Allow #! as begin of filein chunk
Stefan Vogel <sv@exept.de>
parents: 6494
diff changeset
   288
    lastValue == $< ifTrue:[
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   289
        "/ assume, its an xml file
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   290
        ^ self fileInXMLNotifying:someone passChunk:passChunk.
5302
f654a1cbc5b0 support for xml-fileIn
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   291
    ].
6538
1828dcb8f067 Allow #! as begin of filein chunk
Stefan Vogel <sv@exept.de>
parents: 6494
diff changeset
   292
    lastValue == $# ifTrue:[
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   293
        "assume unix interpreter name:
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   294
         '#!!stx -e' or something like this"
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   295
        self nextPeek == $!! ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   296
            "skip the unix command line"
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   297
            self nextLine
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   298
        ] ifFalse:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   299
             self error:'Invalid chunk start'
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   300
        ]
6538
1828dcb8f067 Allow #! as begin of filein chunk
Stefan Vogel <sv@exept.de>
parents: 6494
diff changeset
   301
    ].
5302
f654a1cbc5b0 support for xml-fileIn
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   302
6924
e6bdcfc147e1 *** empty log message ***
penk
parents: 6923
diff changeset
   303
    Smalltalk::Compiler isNil ifTrue:[
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   304
        self isFileStream ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   305
            Transcript show:('[' , self pathName , '] ').
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   306
        ].
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   307
        Transcript showCR:'cannot fileIn (no compiler).'.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   308
        ^ nil.
6924
e6bdcfc147e1 *** empty log message ***
penk
parents: 6923
diff changeset
   309
    ].
e6bdcfc147e1 *** empty log message ***
penk
parents: 6923
diff changeset
   310
3584
099a64bc9b63 support for V'Age fileIn (application stuff)
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
   311
    "/ support for V'Age applications
099a64bc9b63 support for V'Age fileIn (application stuff)
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
   312
    defaultApplicationQuerySignal := Class defaultApplicationQuerySignal.
099a64bc9b63 support for V'Age fileIn (application stuff)
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
   313
    changeDefaultApplicationNotificationSignal := Class changeDefaultApplicationNotificationSignal.
099a64bc9b63 support for V'Age fileIn (application stuff)
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
   314
099a64bc9b63 support for V'Age fileIn (application stuff)
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
   315
    "/ support for ST/X's namespaces & packages
2343
93152bcf4101 only fetch signals once
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
   316
    packageQuerySignal := Class packageQuerySignal.
93152bcf4101 only fetch signals once
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
   317
    nameSpaceQuerySignal := Class nameSpaceQuerySignal.
93152bcf4101 only fetch signals once
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
   318
    usedNameSpaceQuerySignal := Class usedNameSpaceQuerySignal.
93152bcf4101 only fetch signals once
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
   319
2893
8ba406da6b22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2559
diff changeset
   320
    (someone respondsTo:#packageToInstall) ifFalse:[
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   321
        pkg := packageQuerySignal query.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   322
        askSomeoneForPackage := false.
2893
8ba406da6b22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2559
diff changeset
   323
    ] ifTrue:[
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   324
        pkg := someone packageToInstall.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   325
        askSomeoneForPackage := true.
2893
8ba406da6b22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2559
diff changeset
   326
    ].
8ba406da6b22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2559
diff changeset
   327
    (someone respondsTo:#currentNameSpace) ifFalse:[
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   328
        spc := nameSpaceQuerySignal query.
2893
8ba406da6b22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2559
diff changeset
   329
    ] ifTrue:[
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   330
        spc := someone currentNameSpace
2893
8ba406da6b22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2559
diff changeset
   331
    ].
8ba406da6b22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2559
diff changeset
   332
    (someone respondsTo:#usedNameSpaces) ifFalse:[
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   333
        spaces := usedNameSpaceQuerySignal query.
2893
8ba406da6b22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2559
diff changeset
   334
    ] ifTrue:[
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   335
        spaces := someone usedNameSpaces
2893
8ba406da6b22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2559
diff changeset
   336
    ].
3584
099a64bc9b63 support for V'Age fileIn (application stuff)
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
   337
    (someone respondsTo:#defaultApplication) ifFalse:[
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   338
        defaultApplication := defaultApplicationQuerySignal query.
3584
099a64bc9b63 support for V'Age fileIn (application stuff)
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
   339
    ] ifTrue:[
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   340
        defaultApplication := someone defaultApplication
3584
099a64bc9b63 support for V'Age fileIn (application stuff)
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
   341
    ].
2893
8ba406da6b22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2559
diff changeset
   342
3966
1013f1476687 suppress confirmation dialogs when classes violate conventions
Claus Gittinger <cg@exept.de>
parents: 3905
diff changeset
   343
    confirmationQuerySignal := Metaclass confirmationQuerySignal.
1013f1476687 suppress confirmation dialogs when classes violate conventions
Claus Gittinger <cg@exept.de>
parents: 3905
diff changeset
   344
5250
991f068f9a80 not all query signals are passed (packageQuery)
Claus Gittinger <cg@exept.de>
parents: 5228
diff changeset
   345
    passedSignals := IdentitySet new.
991f068f9a80 not all query signals are passed (packageQuery)
Claus Gittinger <cg@exept.de>
parents: 5228
diff changeset
   346
3584
099a64bc9b63 support for V'Age fileIn (application stuff)
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
   347
    handledSignals := SignalSet new.
099a64bc9b63 support for V'Age fileIn (application stuff)
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
   348
    handledSignals add:changeDefaultApplicationNotificationSignal.
5250
991f068f9a80 not all query signals are passed (packageQuery)
Claus Gittinger <cg@exept.de>
parents: 5228
diff changeset
   349
    passedSignals add:changeDefaultApplicationNotificationSignal.
991f068f9a80 not all query signals are passed (packageQuery)
Claus Gittinger <cg@exept.de>
parents: 5228
diff changeset
   350
    handledSignals add:defaultApplicationQuerySignal.
991f068f9a80 not all query signals are passed (packageQuery)
Claus Gittinger <cg@exept.de>
parents: 5228
diff changeset
   351
    passedSignals add:defaultApplicationQuerySignal.
991f068f9a80 not all query signals are passed (packageQuery)
Claus Gittinger <cg@exept.de>
parents: 5228
diff changeset
   352
3584
099a64bc9b63 support for V'Age fileIn (application stuff)
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
   353
    handledSignals add:packageQuerySignal.
099a64bc9b63 support for V'Age fileIn (application stuff)
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
   354
    handledSignals add:usedNameSpaceQuerySignal.
099a64bc9b63 support for V'Age fileIn (application stuff)
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
   355
    handledSignals add:nameSpaceQuerySignal.
5250
991f068f9a80 not all query signals are passed (packageQuery)
Claus Gittinger <cg@exept.de>
parents: 5228
diff changeset
   356
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   357
    handledSignals add:Error.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   358
    passedSignals add:Error.
5250
991f068f9a80 not all query signals are passed (packageQuery)
Claus Gittinger <cg@exept.de>
parents: 5228
diff changeset
   359
3592
ac5e8c09ff42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3584
diff changeset
   360
    handledSignals add:(Class methodRedefinitionSignal).
5250
991f068f9a80 not all query signals are passed (packageQuery)
Claus Gittinger <cg@exept.de>
parents: 5228
diff changeset
   361
    passedSignals add:(Class methodRedefinitionSignal).
3597
98bd336b3c3f also care for class redefinitions.
Claus Gittinger <cg@exept.de>
parents: 3592
diff changeset
   362
    handledSignals add:(Class classRedefinitionSignal).
5250
991f068f9a80 not all query signals are passed (packageQuery)
Claus Gittinger <cg@exept.de>
parents: 5228
diff changeset
   363
    passedSignals add:(Class classRedefinitionSignal).
3966
1013f1476687 suppress confirmation dialogs when classes violate conventions
Claus Gittinger <cg@exept.de>
parents: 3905
diff changeset
   364
    handledSignals add:confirmationQuerySignal.
5250
991f068f9a80 not all query signals are passed (packageQuery)
Claus Gittinger <cg@exept.de>
parents: 5228
diff changeset
   365
    passedSignals add:confirmationQuerySignal.
991f068f9a80 not all query signals are passed (packageQuery)
Claus Gittinger <cg@exept.de>
parents: 5228
diff changeset
   366
4772
8e701a1c9d6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
   367
    outerContext := thisContext.
8e701a1c9d6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
   368
3584
099a64bc9b63 support for V'Age fileIn (application stuff)
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
   369
    handledSignals handle:[:ex |
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   370
        |sig action what sender msg param oldPackage newPackage proceedValue
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   371
         canContinueForAll|
1902
52376295aca8 namespace fixes
Claus Gittinger <cg@exept.de>
parents: 1897
diff changeset
   372
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   373
        sig := ex signal.
5250
991f068f9a80 not all query signals are passed (packageQuery)
Claus Gittinger <cg@exept.de>
parents: 5228
diff changeset
   374
"/sig == packageQuerySignal ifTrue:[
991f068f9a80 not all query signals are passed (packageQuery)
Claus Gittinger <cg@exept.de>
parents: 5228
diff changeset
   375
"/self halt.
991f068f9a80 not all query signals are passed (packageQuery)
Claus Gittinger <cg@exept.de>
parents: 5228
diff changeset
   376
"/].
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   377
        (passedSignals includes:sig) ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   378
            (sig isHandledIn:outerContext) ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   379
                ex reject
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   380
            ]
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   381
        ].
4772
8e701a1c9d6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
   382
        
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   383
        sig == changeDefaultApplicationNotificationSignal ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   384
            "/ invoked via #becomeDefault to set the defaultApp and the package.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   385
            "/ (only when filing in V'Age code)
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   386
            defaultApplication := ex parameter.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   387
            pkg := defaultApplication name asSymbol.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   388
            ex proceedWith:nil
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   389
        ].
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   390
        sig == defaultApplicationQuerySignal ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   391
            "/ query for the application to add classes & methods into
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   392
            "/ (only when filing in V'Age code)
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   393
            ex proceedWith:defaultApplication
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   394
        ].
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   395
        sig == packageQuerySignal ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   396
            "/ query for the package to use for classes & methods
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   397
            askSomeoneForPackage ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   398
                ex proceedWith:someone packageToInstall
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   399
            ] ifFalse:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   400
                ex proceedWith:pkg
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   401
            ]
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   402
        ].
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   403
        sig == usedNameSpaceQuerySignal ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   404
            "/ query for the namespaces searched when encountering globals
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   405
            ex proceedWith:spaces
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   406
        ].
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   407
        sig == nameSpaceQuerySignal ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   408
            "/ query for the namespace to install new classes in
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   409
            ex proceedWith:spc
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   410
        ].
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   411
        sig == confirmationQuerySignal ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   412
            ex proceedWith:false "/ no dialogs popping up
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   413
        ].
3966
1013f1476687 suppress confirmation dialogs when classes violate conventions
Claus Gittinger <cg@exept.de>
parents: 3905
diff changeset
   414
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   415
        sig == Stream endOfStreamSignal ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   416
            ex reject
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   417
        ].
3580
47534257f9e5 avoid two queries for rejected signals.
Claus Gittinger <cg@exept.de>
parents: 3386
diff changeset
   418
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   419
        sig == Signal noHandlerSignal ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   420
            ex parameter rejected ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   421
                ex reject
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   422
            ].
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   423
        ].
2893
8ba406da6b22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2559
diff changeset
   424
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   425
        (dontAskSignals notNil and:[dontAskSignals includesKey:sig]) ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   426
            ex proceedWith:(dontAskSignals at:sig)
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   427
        ].
4639
a139399c5f4f package redefinition handling fixed
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
   428
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   429
        canContinueForAll := false.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   430
        redef := false.
4416
c6f292792b81 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
   431
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   432
        "/ for your convenience ...
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   433
        (sig == Class methodRedefinitionSignal) ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   434
            param := ex parameter. "/ an association: oldMethod -> newMethod
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   435
            oldPackage := param key package.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   436
            newPackage := param value package.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   437
            msg := 'trying to overwrite method:\\    ' , param key whoString , '\\in package ''' 
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   438
                   , oldPackage , ''' with method from package ''' , newPackage , ''''.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   439
            canContinueForAll := true.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   440
        ] ifFalse:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   441
            (sig == Class classRedefinitionSignal) ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   442
                param := ex parameter. "/ an association: oldClass -> newClass
4639
a139399c5f4f package redefinition handling fixed
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
   443
                
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   444
                oldPackage := param key package.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   445
                newPackage := param value package.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   446
                msg := 'trying to redefine class: ' , param key name allBold , '\\in package ''' 
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   447
                       , oldPackage , ''' with new definition from package ''' , newPackage , ''''.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   448
                canContinueForAll := true.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   449
                redef := true.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   450
            ] ifFalse:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   451
                msg := 'error in fileIn: %1'
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   452
            ]
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   453
        ].
2893
8ba406da6b22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2559
diff changeset
   454
7205
903fef64420c #errorSignal -> #description
Stefan Vogel <sv@exept.de>
parents: 7114
diff changeset
   455
        what := ex description.
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   456
        what isNil ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   457
            what := ex signal notifierString.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   458
        ].
3584
099a64bc9b63 support for V'Age fileIn (application stuff)
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
   459
7712
539e7a5c800a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7686
diff changeset
   460
        msg := msg bindWith:what.
539e7a5c800a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7686
diff changeset
   461
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   462
        "/ handle the case where no GUI has been built in,
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   463
        "/ just abort the fileIn with a notification
2893
8ba406da6b22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2559
diff changeset
   464
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   465
        Display isNil ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   466
            sender := ex suspendedContext sender.
7712
539e7a5c800a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7686
diff changeset
   467
            msg := msg , ('\\in ' , sender receiver class name , '>>>' , sender selector) withCRs.
539e7a5c800a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7686
diff changeset
   468
            self notify:msg.
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   469
            ex return
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   470
        ].
3584
099a64bc9b63 support for V'Age fileIn (application stuff)
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
   471
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   472
        sig == HaltInterrupt ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   473
            sender := ex suspendedContext.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   474
            msg := msg , ('\\in ' , sender receiver class name , '>>>' , sender selector) withCRs
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   475
        ].
2893
8ba406da6b22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2559
diff changeset
   476
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   477
        "/ otherwise ask what should be done now and either
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   478
        "/ continue or abort the fileIn
7742
936f337d9f2a oops - leftover debugprint
Claus Gittinger <cg@exept.de>
parents: 7712
diff changeset
   479
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   480
        redef ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   481
            action := OptionBox 
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   482
                          request:(msg withCRs) 
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   483
                          label:'Class redefinition in fileIn'
8363
a7644643904e dont send obsolete message (OptionBox request:..form:..)
Claus Gittinger <cg@exept.de>
parents: 8320
diff changeset
   484
                          image:(WarningBox iconBitmap)
5098
4cb82101e94a always preserve the packageID, when redefining a class
Claus Gittinger <cg@exept.de>
parents: 4912
diff changeset
   485
"/ cg: now always keep the old packageID
4cb82101e94a always preserve the packageID, when redefining a class
Claus Gittinger <cg@exept.de>
parents: 4912
diff changeset
   486
"/                          buttonLabels:#('cancel' 'skip' 'debug' 'keep' 'keep all' 'continue' 'continue all')
4cb82101e94a always preserve the packageID, when redefining a class
Claus Gittinger <cg@exept.de>
parents: 4912
diff changeset
   487
"/                          values:#(#abort #skip #debug #keep #keepAll #continue #continueForAll)
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   488
                          buttonLabels:#('Cancel' 'Skip' 'Debug' 'Continue' 'Continue All')
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   489
                          values:#(#abort #skip #debug #keep #keepAll)
7619
357eb8001851 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7578
diff changeset
   490
                          default:#keep
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   491
                          onCancel:#abort.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   492
        ] ifFalse:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   493
            action := self askForDebug:msg withCRs canContinueForAll:canContinueForAll.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   494
        ].
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   495
        action == #continueForAll ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   496
            dontAskSignals isNil ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   497
                dontAskSignals := IdentityDictionary new.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   498
            ].
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   499
            dontAskSignals at:sig put:#continue.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   500
            action := proceedValue := #continue.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   501
        ] ifFalse:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   502
            action == #keepForAll ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   503
                dontAskSignals isNil ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   504
                    dontAskSignals := IdentityDictionary new.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   505
                ].
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   506
                dontAskSignals at:sig put:#keep.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   507
                action := #continue.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   508
                proceedValue := #keep.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   509
            ] ifFalse:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   510
                action == #keep ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   511
                    action := #continue.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   512
                    proceedValue := #keep.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   513
                ].
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   514
            ].
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   515
        ].
4416
c6f292792b81 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4405
diff changeset
   516
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   517
        action == #continue ifTrue:[
7619
357eb8001851 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7578
diff changeset
   518
            ex proceedWith:proceedValue
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   519
        ].
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   520
        action == #abort ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   521
            AbortSignal raise.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   522
            ex return
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   523
        ].
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   524
        action == #cancelAll ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   525
            AbortAllSignal raise.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   526
            ex return
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   527
        ].
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   528
        action == #skip ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   529
            ex proceedWith:nil
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   530
        ].
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   531
        action == #debug ifTrue:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   532
            Debugger enter:ex suspendedContext 
7205
903fef64420c #errorSignal -> #description
Stefan Vogel <sv@exept.de>
parents: 7114
diff changeset
   533
                     withMessage:ex description 
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   534
                     mayProceed:true.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   535
            ex proceedWith:proceedValue
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   536
        ].
3584
099a64bc9b63 support for V'Age fileIn (application stuff)
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
   537
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   538
        "/ (ex signal) enterDebuggerWith:ex message:what.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   539
        ex reject
3584
099a64bc9b63 support for V'Age fileIn (application stuff)
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
   540
    ] do:[
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   541
        [self atEnd] whileFalse:[
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   542
            lastValue := self fileInNextChunkNotifying:someone passChunk:passChunk
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7054
diff changeset
   543
        ]
180
c488255bd0be *** empty log message ***
claus
parents: 159
diff changeset
   544
    ].
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   545
    ^ lastValue
973
5bb2473bf1ef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 875
diff changeset
   546
4717
db56d09f509a Fix assignment.
Stefan Vogel <sv@exept.de>
parents: 4716
diff changeset
   547
    "Modified: / 10.9.1999 / 16:54:01 / stefan"
6201
389dc86fdb80 class based exceptions - no longer need to send #haltSígnal
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
   548
    "Modified: / 16.11.2001 / 16:21:28 / cg"
5302
f654a1cbc5b0 support for xml-fileIn
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   549
!
f654a1cbc5b0 support for xml-fileIn
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   550
7573
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   551
fileIn
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   552
    "file in from the receiver, i.e. read chunks and evaluate them -
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   553
     return the value of the last chunk."
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   554
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   555
    |notifiedLoader|
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   556
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   557
    SourceFileLoader notNil ifTrue:[
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   558
        notifiedLoader := SourceFileLoader on:self.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   559
    ].
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   560
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   561
    ^ self fileInNotifying:notifiedLoader passChunk:true.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   562
!
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   563
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   564
fileInBinary
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   565
    "file in from the receiver, i.e. read binary stored classes and/or objects.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   566
     Return the last object."
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   567
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   568
    |bos obj|
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   569
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   570
    bos := BinaryObjectStorage onOld:self.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   571
    Class nameSpaceQuerySignal 
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   572
	answer:Smalltalk
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   573
	do:[
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   574
	    [self atEnd] whileFalse:[
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   575
		obj := bos next.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   576
	    ]
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   577
	].
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   578
    bos close.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   579
    ^ obj
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   580
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   581
    "Created: / 13.11.2001 / 10:12:30 / cg"
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   582
    "Modified: / 13.11.2001 / 10:14:04 / cg"
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   583
!
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   584
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   585
fileInNextChunkNotifying:someone
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   586
    "read next chunk, evaluate it and return the result;
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   587
     someone (which is usually some codeView) is notified of errors.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   588
     Filein is done as follows:
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   589
	read a chunk
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   590
	if it started with an excla, evaluate it, and let the resulting object
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   591
	fileIn more chunks.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   592
	This is a nice trick, since the methodsFor: expression evaluates to
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   593
	a ClassCategoryReader which reads and compiles chunks for its class.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   594
	However, other than methodsFor expressions are possible - you can
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   595
	(in theory) create readers for any syntax.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   596
    "
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   597
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   598
    ^ self fileInNextChunkNotifying:someone passChunk:false
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   599
!
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   600
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   601
fileInNextChunkNotifying:someone passChunk:passChunk
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   602
    "read next chunk, evaluate it and return the result;
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   603
     someone (which is usually some codeView) is notified of errors.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   604
     Filein is done as follows:
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   605
	read a chunk
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   606
	if it started with an excla, evaluate it, and let the resulting object
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   607
	fileIn more chunks.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   608
	This is a nice trick, since the methodsFor: expression evaluates to
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   609
	a ClassCategoryReader which reads and compiles chunks for its class.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   610
	However, other than methodsFor expressions are possible - you can
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   611
	(in theory) create readers for any syntax.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   612
    "
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   613
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   614
    ^ self fileInNextChunkNotifying:someone passChunk:passChunk silent:nil
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   615
!
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   616
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   617
fileInNextChunkNotifying:someone passChunk:passChunk silent:beSilent
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   618
    "read next chunk, evaluate it and return the result;
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   619
     someone (which is usually some codeView) is notified of errors.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   620
     Filein is done as follows:
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   621
	read a chunk
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   622
	if it started with an excla, evaluate it, and let the resulting object
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   623
	fileIn more chunks.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   624
	This is a nice trick, since the methodsFor: expression evaluates to
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   625
	a ClassCategoryReader which reads and compiles chunks for its class.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   626
	However, other than methodsFor expressions are possible - you can
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   627
	(in theory) create readers for any syntax.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   628
    "
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   629
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   630
    |aString sawExcla rslt done|
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   631
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   632
    self skipSeparators.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   633
    self atEnd ifFalse:[
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   634
	sawExcla := self peekFor:(self class chunkSeparator).
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   635
	aString := self nextChunk.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   636
	"/
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   637
	"/ handle empty chunks;
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   638
	"/ this allows for Squeak code to be filedIn
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   639
	"/
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   640
	[aString size == 0
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   641
	and:[self atEnd not]] whileTrue:[
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   642
	    aString := self nextChunk.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   643
	].
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   644
	aString size ~~ 0 ifTrue:[
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   645
	    passChunk ifTrue:[
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   646
		someone notNil ifTrue:[someone source:aString]
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   647
	    ].
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   648
	    sawExcla ifFalse:[
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   649
		rslt := Smalltalk::Compiler evaluate:aString notifying:someone.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   650
	    ] ifTrue:[
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   651
		Smalltalk::Compiler emptySourceNotificationSignal handle:[:ex |
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   652
		    ^ nil
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   653
		] do:[
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   654
		    rslt := Smalltalk::Compiler evaluate:aString notifying:someone compile:false.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   655
		].
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   656
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   657
		"
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   658
		 usually, the above chunk consists of some methodsFor:-expression
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   659
		 in this case, the returned value is a ClassCategoryReader,
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   660
		 which is used to load & compile the methods ...
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   661
		"
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   662
		rslt isNil ifTrue:[
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   663
		    "
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   664
		     however, if that was nil (i.e. some error), we skip chunks
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   665
		     up to the next empty chunk.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   666
		    "
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   667
		    Transcript showCR:'skipping chunks ...'.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   668
		    done := false.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   669
		    [done] whileFalse:[
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   670
			aString := self nextChunk.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   671
			done := (aString size == 0).
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   672
		    ]
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   673
		] ifFalse:[
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   674
		    rslt := rslt 
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   675
				fileInFrom:self 
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   676
				notifying:someone 
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   677
				passChunk:passChunk
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   678
				single:false
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   679
				silent:beSilent
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   680
		]
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   681
	    ]
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   682
	]
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   683
    ].
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   684
    ^ rslt
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   685
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   686
    "Modified: 14.10.1997 / 17:10:35 / cg"
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   687
!
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   688
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   689
fileInNotifying:notifiedLoader passChunk:passChunk
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   690
    "central method to file in from the receiver, i.e. read chunks and evaluate them -
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   691
     return the value of the last chunk.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   692
     Someone (which is usually some codeView) is notified of errors."
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   693
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   694
    self isFileStream ifFalse:[
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   695
        ^ self basicFileInNotifying:notifiedLoader passChunk:passChunk.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   696
    ].
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   697
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   698
    ^ self fileInNotifying:notifiedLoader passChunk:passChunk inDirectory:(self pathName asFilename directory).
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   699
!
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   700
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   701
fileInNotifying:notifiedLoader passChunk:passChunk inDirectory:aDirectory
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   702
    "central method to file in from the receiver, i.e. read chunks and evaluate them -
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   703
     return the value of the last chunk.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   704
     Someone (which is usually some codeView) is notified of errors."
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   705
8318
6fd12ab774c0 Systempath set by smalltalk.rc has bee reset from fileIn
Stefan Vogel <sv@exept.de>
parents: 8053
diff changeset
   706
    |oldPath val thisDirectory thisDirectoryPathName|
6fd12ab774c0 Systempath set by smalltalk.rc has bee reset from fileIn
Stefan Vogel <sv@exept.de>
parents: 8053
diff changeset
   707
6fd12ab774c0 Systempath set by smalltalk.rc has bee reset from fileIn
Stefan Vogel <sv@exept.de>
parents: 8053
diff changeset
   708
    thisDirectory := aDirectory asFilename.
6fd12ab774c0 Systempath set by smalltalk.rc has bee reset from fileIn
Stefan Vogel <sv@exept.de>
parents: 8053
diff changeset
   709
    thisDirectoryPathName := thisDirectory pathName.
6fd12ab774c0 Systempath set by smalltalk.rc has bee reset from fileIn
Stefan Vogel <sv@exept.de>
parents: 8053
diff changeset
   710
    oldPath := Smalltalk systemPath.
7573
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   711
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   712
    [   
8318
6fd12ab774c0 Systempath set by smalltalk.rc has bee reset from fileIn
Stefan Vogel <sv@exept.de>
parents: 8053
diff changeset
   713
        Smalltalk systemPath:(oldPath copy addFirst:thisDirectoryPathName; yourself).
7573
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   714
        CurrentFileInDirectoryQuerySignal answer:thisDirectory do:[
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   715
            val := self basicFileInNotifying:notifiedLoader passChunk:passChunk.
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   716
        ]
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   717
    ] ensure:[
8318
6fd12ab774c0 Systempath set by smalltalk.rc has bee reset from fileIn
Stefan Vogel <sv@exept.de>
parents: 8053
diff changeset
   718
        "take care, someone could have changed SystemPath during fileIn!!"
6fd12ab774c0 Systempath set by smalltalk.rc has bee reset from fileIn
Stefan Vogel <sv@exept.de>
parents: 8053
diff changeset
   719
        (Smalltalk systemPath copyFrom:2) = oldPath ifTrue:[
6fd12ab774c0 Systempath set by smalltalk.rc has bee reset from fileIn
Stefan Vogel <sv@exept.de>
parents: 8053
diff changeset
   720
            Smalltalk systemPath:oldPath.
6fd12ab774c0 Systempath set by smalltalk.rc has bee reset from fileIn
Stefan Vogel <sv@exept.de>
parents: 8053
diff changeset
   721
        ] ifFalse:[
6fd12ab774c0 Systempath set by smalltalk.rc has bee reset from fileIn
Stefan Vogel <sv@exept.de>
parents: 8053
diff changeset
   722
            (oldPath includes:thisDirectoryPathName) ifFalse:[
6fd12ab774c0 Systempath set by smalltalk.rc has bee reset from fileIn
Stefan Vogel <sv@exept.de>
parents: 8053
diff changeset
   723
                Smalltalk systemPath remove:thisDirectoryPathName ifAbsent:[].
6fd12ab774c0 Systempath set by smalltalk.rc has bee reset from fileIn
Stefan Vogel <sv@exept.de>
parents: 8053
diff changeset
   724
                Smalltalk flushPathCaches.
6fd12ab774c0 Systempath set by smalltalk.rc has bee reset from fileIn
Stefan Vogel <sv@exept.de>
parents: 8053
diff changeset
   725
            ].
6fd12ab774c0 Systempath set by smalltalk.rc has bee reset from fileIn
Stefan Vogel <sv@exept.de>
parents: 8053
diff changeset
   726
        ].
7573
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   727
    ].
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   728
    ^ val
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   729
!
5c0f8cd19b66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
   730
5302
f654a1cbc5b0 support for xml-fileIn
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   731
fileInXMLNotifying:someone passChunk:passChunk
f654a1cbc5b0 support for xml-fileIn
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   732
    "filein an XML source file (format as in campSmalltalk DTD)"
f654a1cbc5b0 support for xml-fileIn
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   733
f654a1cbc5b0 support for xml-fileIn
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   734
    | builder parser|
f654a1cbc5b0 support for xml-fileIn
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   735
6093
871a6f06ea1e XML-fileIn fixed
Claus Gittinger <cg@exept.de>
parents: 6003
diff changeset
   736
    (XML isNil or:[XML::SourceNodeBuilder isNil or:[XML::XMLParser isNil]]) ifTrue:[
7226
714dbc698b2e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7205
diff changeset
   737
	Smalltalk loadPackage:'stx:goodies/xml/vw'.
7051
984d8271d06b preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
   738
	(XML isNil or:[XML::SourceNodeBuilder isNil or:[XML::XMLParser isNil]]) ifTrue:[
7226
714dbc698b2e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7205
diff changeset
   739
	    self error:'Could not load XML package(s) from ''stx:goodies/xml/vw'''.
7051
984d8271d06b preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
   740
	]
6003
9bfa2051faeb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5899
diff changeset
   741
    ].
9bfa2051faeb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5899
diff changeset
   742
6093
871a6f06ea1e XML-fileIn fixed
Claus Gittinger <cg@exept.de>
parents: 6003
diff changeset
   743
    builder := XML::SourceNodeBuilder new.
871a6f06ea1e XML-fileIn fixed
Claus Gittinger <cg@exept.de>
parents: 6003
diff changeset
   744
    parser := XML::XMLParser on:self.
5302
f654a1cbc5b0 support for xml-fileIn
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   745
    parser builder:builder.
f654a1cbc5b0 support for xml-fileIn
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   746
    parser validate:false.
f654a1cbc5b0 support for xml-fileIn
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   747
    parser scanDocument.
6093
871a6f06ea1e XML-fileIn fixed
Claus Gittinger <cg@exept.de>
parents: 6003
diff changeset
   748
    "/ self halt.
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   749
! !
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   750
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   751
!PositionableStream methodsFor:'positioning'!
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   752
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   753
backStep
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   754
    "move backward read position by one"
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   755
4405
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   756
    self position:(self position - 1)
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   757
!
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   758
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   759
position
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   760
    "return the read position"
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   761
7052
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   762
    ZeroPosition == 0 ifTrue:[
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   763
        ^ self position0Based
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   764
    ] ifFalse:[
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   765
        ^ self position1Based
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   766
    ].
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   767
!
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   768
7052
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   769
position0Based
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   770
    "return the read position 0-based"
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   771
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   772
    ^ position - ZeroPosition
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   773
!
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   774
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   775
position0Based:index0Based
4405
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   776
    "set the read (or write) position"
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   777
7052
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   778
    ((index0Based > readLimit) or:[index0Based < 0]) ifTrue: [^ self positionError:index0Based].
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   779
    position := index0Based + ZeroPosition
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   780
!
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   781
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   782
position1Based
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   783
    "return the read position 1-based"
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   784
7053
13e04c48e23c prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7052
diff changeset
   785
    ^ self position0Based + 1
7052
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   786
!
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   787
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   788
position1Based:index1Based
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   789
    "set the read (or write) position"
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   790
7053
13e04c48e23c prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7052
diff changeset
   791
    self position0Based:(index1Based - 1)
4405
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   792
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   793
    "
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   794
     |s|
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   795
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   796
     s := '1234567890' readStream.
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   797
     s next:5.
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   798
     s position:1.
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   799
     s next:7.       
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   800
    "
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   801
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   802
    "
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   803
     |s|
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   804
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   805
     s := '' writeStream.
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   806
     s nextPutAll:'1234567890'.
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   807
     s position:5.
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   808
     s nextPutAll:'abcdefg'.
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   809
     s contents 
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   810
    "
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   811
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   812
    "
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   813
     |s|
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   814
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   815
     s := '' writeStream.
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   816
     s nextPutAll:'1234567890'.
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   817
     s position:0.
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   818
     s nextPutAll:'abcdefg'.
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   819
     s contents 
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   820
    "
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   821
!
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   822
7052
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   823
position:newPos
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   824
    "set the read (or write) position"
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   825
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   826
    ZeroPosition == 0 ifTrue:[
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   827
        ^ self position0Based:newPos
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   828
    ] ifFalse:[
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   829
        ^ self position1Based:newPos
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   830
    ].
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   831
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   832
    "
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   833
     |s|
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   834
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   835
     s := '1234567890' readStream.
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   836
     s next:5.
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   837
     s position:1.
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   838
     s next:7.       
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   839
    "
6626
f7b08d6bee3f #positionStartingAt0 and #positionStartingAt1
Stefan Vogel <sv@exept.de>
parents: 6538
diff changeset
   840
7052
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   841
    "
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   842
     |s|
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   843
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   844
     s := '' writeStream.
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   845
     s nextPutAll:'1234567890'.
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   846
     s position:5.
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   847
     s nextPutAll:'abcdefg'.
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   848
     s contents 
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   849
    "
6626
f7b08d6bee3f #positionStartingAt0 and #positionStartingAt1
Stefan Vogel <sv@exept.de>
parents: 6538
diff changeset
   850
7052
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   851
    "
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   852
     |s|
6626
f7b08d6bee3f #positionStartingAt0 and #positionStartingAt1
Stefan Vogel <sv@exept.de>
parents: 6538
diff changeset
   853
7052
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   854
     s := '' writeStream.
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   855
     s nextPutAll:'1234567890'.
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   856
     s position:0.
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   857
     s nextPutAll:'abcdefg'.
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   858
     s contents 
207cc9c62982 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 7051
diff changeset
   859
    "
6626
f7b08d6bee3f #positionStartingAt0 and #positionStartingAt1
Stefan Vogel <sv@exept.de>
parents: 6538
diff changeset
   860
!
f7b08d6bee3f #positionStartingAt0 and #positionStartingAt1
Stefan Vogel <sv@exept.de>
parents: 6538
diff changeset
   861
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   862
reset
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   863
    "set the read position to the beginning of the collection"
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   864
5308
8e8b5d2b3b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5302
diff changeset
   865
    self resetPosition
8e8b5d2b3b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5302
diff changeset
   866
8e8b5d2b3b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5302
diff changeset
   867
    "
8e8b5d2b3b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5302
diff changeset
   868
     |s|
8e8b5d2b3b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5302
diff changeset
   869
8e8b5d2b3b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5302
diff changeset
   870
     s := 'hello world' readStream.
8e8b5d2b3b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5302
diff changeset
   871
     Transcript showCR:(s next:5).
8e8b5d2b3b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5302
diff changeset
   872
     s reset.
8e8b5d2b3b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5302
diff changeset
   873
     Transcript showCR:(s next:10).
8e8b5d2b3b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5302
diff changeset
   874
    "
8e8b5d2b3b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5302
diff changeset
   875
!
8e8b5d2b3b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5302
diff changeset
   876
8e8b5d2b3b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5302
diff changeset
   877
resetPosition
8e8b5d2b3b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5302
diff changeset
   878
    "set the read position to the beginning of the collection"
8e8b5d2b3b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5302
diff changeset
   879
7114
acc13967229e position fixes
Claus Gittinger <cg@exept.de>
parents: 7092
diff changeset
   880
    position := ZeroPosition
4405
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   881
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   882
    "
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   883
     |s|
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   884
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   885
     s := 'hello world' readStream.
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   886
     Transcript showCR:(s next:5).
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   887
     s reset.
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   888
     Transcript showCR:(s next:10).
247058206089 added ZeroPosition;
Claus Gittinger <cg@exept.de>
parents: 4325
diff changeset
   889
    "
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   890
!
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   891
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   892
setToEnd
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   893
    "set the read position to the end of the collection"
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   894
7114
acc13967229e position fixes
Claus Gittinger <cg@exept.de>
parents: 7092
diff changeset
   895
    position := readLimit - 1 + ZeroPosition
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   896
!
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   897
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   898
skip:numberToSkip
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   899
    "skip the next numberToSkip elements"
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   900
5774
dafe65be735b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5748
diff changeset
   901
    numberToSkip ~~ 0 ifTrue:[
7051
984d8271d06b preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
   902
	self position:(self position + numberToSkip)
5774
dafe65be735b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5748
diff changeset
   903
    ]
1489
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   904
!
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   905
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   906
skipThroughAll:aCollection
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   907
    "skip for and through the sequence given by the argument, aCollection;
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   908
     return nil if not found, self otherwise. 
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   909
     On a successful match, the next read will return elements after aCollection;
2153
244e36cbbd9b skipThroughAll: does not need the old position
Claus Gittinger <cg@exept.de>
parents: 2130
diff changeset
   910
     if no match was found, the receiver will be positioned at the end.
244e36cbbd9b skipThroughAll: does not need the old position
Claus Gittinger <cg@exept.de>
parents: 2130
diff changeset
   911
     This is redefined here, to make use of positioning."
1489
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   912
7054
685d359f9847 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 7053
diff changeset
   913
    |buffer len first idx|
1489
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   914
7054
685d359f9847 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 7053
diff changeset
   915
    len := aCollection size.
1489
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   916
    first := aCollection at:1.
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   917
    [self atEnd] whileFalse:[
7054
685d359f9847 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 7053
diff changeset
   918
        buffer := self nextAvailable:len.
685d359f9847 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 7053
diff changeset
   919
        buffer = aCollection ifTrue:[
685d359f9847 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 7053
diff changeset
   920
            ^ self
685d359f9847 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 7053
diff changeset
   921
        ].
685d359f9847 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 7053
diff changeset
   922
        idx := buffer indexOf:first startingAt:2.
685d359f9847 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 7053
diff changeset
   923
        idx == 0 ifFalse:[
685d359f9847 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 7053
diff changeset
   924
            self position:(self position - len + idx - 1)
685d359f9847 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 7053
diff changeset
   925
        ]
1489
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   926
    ].
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   927
    ^ nil
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   928
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   929
    "
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   930
     |s|
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   931
     s := ReadStream on:'12345678901234567890'.
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   932
     s skipThroughAll:'901'.
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   933
     s upToEnd  
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   934
    "
2153
244e36cbbd9b skipThroughAll: does not need the old position
Claus Gittinger <cg@exept.de>
parents: 2130
diff changeset
   935
    "
244e36cbbd9b skipThroughAll: does not need the old position
Claus Gittinger <cg@exept.de>
parents: 2130
diff changeset
   936
     |s|
244e36cbbd9b skipThroughAll: does not need the old position
Claus Gittinger <cg@exept.de>
parents: 2130
diff changeset
   937
     s := ReadStream on:'12345678901234567890'.
244e36cbbd9b skipThroughAll: does not need the old position
Claus Gittinger <cg@exept.de>
parents: 2130
diff changeset
   938
     s skipThroughAll:'1234'.
244e36cbbd9b skipThroughAll: does not need the old position
Claus Gittinger <cg@exept.de>
parents: 2130
diff changeset
   939
     s upToEnd  
244e36cbbd9b skipThroughAll: does not need the old position
Claus Gittinger <cg@exept.de>
parents: 2130
diff changeset
   940
    "
244e36cbbd9b skipThroughAll: does not need the old position
Claus Gittinger <cg@exept.de>
parents: 2130
diff changeset
   941
    "
244e36cbbd9b skipThroughAll: does not need the old position
Claus Gittinger <cg@exept.de>
parents: 2130
diff changeset
   942
     |s|
244e36cbbd9b skipThroughAll: does not need the old position
Claus Gittinger <cg@exept.de>
parents: 2130
diff changeset
   943
     s := ReadStream on:'12345678901234567890'.
244e36cbbd9b skipThroughAll: does not need the old position
Claus Gittinger <cg@exept.de>
parents: 2130
diff changeset
   944
     s skipThroughAll:'999'.
244e36cbbd9b skipThroughAll: does not need the old position
Claus Gittinger <cg@exept.de>
parents: 2130
diff changeset
   945
     s atEnd  
244e36cbbd9b skipThroughAll: does not need the old position
Claus Gittinger <cg@exept.de>
parents: 2130
diff changeset
   946
    "
1489
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   947
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   948
    "Created: 26.6.1996 / 09:35:35 / cg"
2154
89e96599e1e2 skipThroughAll: does not need the old position
Claus Gittinger <cg@exept.de>
parents: 2153
diff changeset
   949
    "Modified: 11.1.1997 / 19:16:38 / cg"
1489
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   950
!
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   951
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   952
skipToAll:aCollection
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   953
    "skip for the sequence given by the argument, aCollection;
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   954
     return nil if not found, self otherwise. 
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   955
     On a successful match, the next read will return elements of aCollection."
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   956
7054
685d359f9847 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 7053
diff changeset
   957
    |oldPos buffer len first idx|
1489
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   958
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   959
    oldPos := self position.
7054
685d359f9847 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 7053
diff changeset
   960
    len := aCollection size.
1489
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   961
    first := aCollection at:1.
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   962
    [self atEnd] whileFalse:[
7054
685d359f9847 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 7053
diff changeset
   963
        buffer := self next:len.
685d359f9847 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 7053
diff changeset
   964
        buffer = aCollection ifTrue:[
685d359f9847 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 7053
diff changeset
   965
            self position:(self position - len).
685d359f9847 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 7053
diff changeset
   966
            ^ self
685d359f9847 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 7053
diff changeset
   967
        ].
685d359f9847 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 7053
diff changeset
   968
        idx := buffer indexOf:first startingAt:2.
685d359f9847 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 7053
diff changeset
   969
        idx == 0 ifFalse:[
685d359f9847 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 7053
diff changeset
   970
            self position:(self position - len + idx - 1)
685d359f9847 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 7053
diff changeset
   971
        ]
1489
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   972
    ].
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   973
    self position:oldPos.
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   974
    ^ nil
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   975
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   976
    "
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   977
     |s|
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   978
     s := ReadStream on:'12345678901234567890'.
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   979
     s skipToAll:'901'.
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   980
     s upToEnd  
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   981
    "
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   982
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   983
    "Modified: 26.6.1996 / 09:28:27 / cg"
9e3b166483fb moved some skip methods from readStream;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   984
    "Created: 26.6.1996 / 09:35:06 / cg"
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
   985
! !
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   986
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   987
!PositionableStream methodsFor:'private'!
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   988
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   989
contentsSpecies
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   990
    "return a class of which instances will be returned, when
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   991
     parts of the collection are asked for. 
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   992
     (see upTo-kind of methods in subclasses)"
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   993
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   994
    ^ collection species
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   995
!
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   996
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   997
on:aCollection
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   998
    "setup for streaming on aCollection"
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   999
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1000
    collection := aCollection.
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1001
    readLimit := aCollection size.
7114
acc13967229e position fixes
Claus Gittinger <cg@exept.de>
parents: 7092
diff changeset
  1002
    position := ZeroPosition
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1003
!
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1004
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1005
on:aCollection from:first to:last
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1006
    "setup for streaming on aCollection from first to last"
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1007
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1008
    collection := aCollection.
7114
acc13967229e position fixes
Claus Gittinger <cg@exept.de>
parents: 7092
diff changeset
  1009
    position := first - 1 + ZeroPosition.
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1010
    readLimit := last
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1011
!
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1012
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1013
positionError
1998
9749a5f87238 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1929
diff changeset
  1014
    "{ Pragma: +optSpace }"
9749a5f87238 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1929
diff changeset
  1015
2966
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
  1016
    "report an error when positioning past the end
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
  1017
     or before the beginning."
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1018
8320
229adaeaf183 Use exception classes instead of class vars
Stefan Vogel <sv@exept.de>
parents: 8318
diff changeset
  1019
    ^ PositionOutOfBoundsError raiseRequestWith:nil
4452
3d050f505a0a Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents: 4416
diff changeset
  1020
3d050f505a0a Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents: 4416
diff changeset
  1021
    "Modified: / 26.7.1999 / 10:59:13 / stefan"
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1022
!
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1023
6314
e1aad938d629 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6230
diff changeset
  1024
positionError:badPostition
e1aad938d629 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6230
diff changeset
  1025
    "{ Pragma: +optSpace }"
e1aad938d629 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6230
diff changeset
  1026
e1aad938d629 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6230
diff changeset
  1027
    "report an error when positioning past the end
e1aad938d629 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6230
diff changeset
  1028
     or before the beginning."
e1aad938d629 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6230
diff changeset
  1029
8320
229adaeaf183 Use exception classes instead of class vars
Stefan Vogel <sv@exept.de>
parents: 8318
diff changeset
  1030
    ^ PositionOutOfBoundsError raiseRequestWith:badPostition
6314
e1aad938d629 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6230
diff changeset
  1031
!
e1aad938d629 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6230
diff changeset
  1032
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1033
with:aCollection
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1034
    "setup for streaming to the end of aCollection"
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1035
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1036
    collection := aCollection.
6230
877a8da90c7c fixed initial position in
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1037
    readLimit := aCollection size + 1.
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1038
    self setToEnd
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1039
! !
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1040
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1041
!PositionableStream methodsFor:'queries'!
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1042
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1043
isPositionable
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1044
    "return true, if the stream supports positioning (this one is)"
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1045
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1046
    ^ true
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1047
! !
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1048
3170
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1049
!PositionableStream methodsFor:'reading'!
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1050
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1051
upToAll:aCollection
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1052
    "read until a subcollection consisisting of the elements in aCollection
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1053
     is encountered.
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1054
     Return everything read excluding the elements in aCollection.
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1055
     The position is left before the collection; i.e. the next
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1056
     read operations will return those elements.
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1057
     If no such subcollection is encountered, all elements up to the end 
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1058
     are read and returned.
6494
5b3d8667c22a comment
Claus Gittinger <cg@exept.de>
parents: 6421
diff changeset
  1059
     See also #throughAll: which also reads up to some objects
3170
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1060
     but positions behind it and DOES include it in the returned
3184
d99302322139 Ok, #upToAll: positions after the collection.
Stefan Vogel <sv@exept.de>
parents: 3170
diff changeset
  1061
     collection.
6494
5b3d8667c22a comment
Claus Gittinger <cg@exept.de>
parents: 6421
diff changeset
  1062
     See also #upToAllExcluding:, which returns the same, but leaves the
5b3d8667c22a comment
Claus Gittinger <cg@exept.de>
parents: 6421
diff changeset
  1063
     read pointer after the matched subcollection.
3184
d99302322139 Ok, #upToAll: positions after the collection.
Stefan Vogel <sv@exept.de>
parents: 3170
diff changeset
  1064
d99302322139 Ok, #upToAll: positions after the collection.
Stefan Vogel <sv@exept.de>
parents: 3170
diff changeset
  1065
     Note: this behavior is inconsistent with the other upTo.. methods,
7051
984d8271d06b preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
  1066
	   which position after the found item. We implement the method
984d8271d06b preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
  1067
	   this way for the sake of ST80-compatibility."
3170
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1068
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1069
    |answerStream element last rslt|
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1070
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1071
    last := aCollection last.
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1072
    answerStream := WriteStream on:(self contentsSpecies new).
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1073
    [self atEnd] whileFalse:[
7051
984d8271d06b preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
  1074
	element := self next.
984d8271d06b preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
  1075
	answerStream nextPut:element.
984d8271d06b preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
  1076
	element == last ifTrue:[
984d8271d06b preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
  1077
	    ((rslt := answerStream contents) endsWith:aCollection) ifTrue:[
984d8271d06b preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
  1078
		self position:(self position - aCollection size).
984d8271d06b preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
  1079
		^ rslt copyWithoutLast:aCollection size
984d8271d06b preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
  1080
	    ]
984d8271d06b preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
  1081
	].
3170
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1082
    ].
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1083
    ^ answerStream contents
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1084
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1085
    "
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1086
     |s|
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1087
     s := ReadStream on:'hello world'.
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1088
     Transcript show:'<'; show:(s upToAll:'wo'); showCR:'>'. 
6494
5b3d8667c22a comment
Claus Gittinger <cg@exept.de>
parents: 6421
diff changeset
  1089
     Transcript showCR:s atEnd.
3170
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1090
     Transcript show:'<'; show:(s upToEnd); showCR:'>'. 
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1091
    "
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1092
    "
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1093
     |s|
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1094
     s := ReadStream on:'hello world'.
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1095
     Transcript show:'<'; show:(s upToAll:'xx'); showCR:'>'. 
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1096
     Transcript showCR:s atEnd.
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1097
     Transcript show:'<'; show:(s upToEnd); showCR:'>'. 
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1098
    "
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1099
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1100
    "Modified: / 12.1.1998 / 22:06:42 / cg"
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1101
    "Created: / 12.1.1998 / 22:07:01 / cg"
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1102
! !
7b299d83c45a moved upToAll: to positionableStream.
Claus Gittinger <cg@exept.de>
parents: 3032
diff changeset
  1103
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1104
!PositionableStream methodsFor:'testing'!
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1105
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1106
atEnd
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1107
    "return true, if the read-position is at the end"
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1108
7114
acc13967229e position fixes
Claus Gittinger <cg@exept.de>
parents: 7092
diff changeset
  1109
    ^ (position - ZeroPosition + 1) > readLimit
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1110
!
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1111
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1112
isEmpty
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1113
    "return true, if the contents of the stream is empty"
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1114
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1115
    ^ readLimit == 0
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1116
! !
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1117
1897
22d1ce9b62a4 fixes for packageQuery
Claus Gittinger <cg@exept.de>
parents: 1489
diff changeset
  1118
!PositionableStream class methodsFor:'documentation'!
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1119
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1120
version
8363
a7644643904e dont send obsolete message (OptionBox request:..form:..)
Claus Gittinger <cg@exept.de>
parents: 8320
diff changeset
  1121
    ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.141 2004-05-18 13:30:47 cg Exp $'
701
a309e3ef7faf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1122
! !
6777
5efddf5358b2 currentFileInDirectory query
Claus Gittinger <cg@exept.de>
parents: 6707
diff changeset
  1123
611
80bb0f1a7bab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1124
PositionableStream initialize!