On 23 October 2010 14:36, Stéphane Ducasse <[email protected]> wrote: > What is the way to fix that? >
something ifTrue: [ [ code which never runs ] ] -->> something ifTrue: [ code which now can run ] unless, of course it is used like: block := something ifTrue: [ [block1 ] ] ifFalse: [ [block2]]. > >> SystemNavigation new browseAllSelect: >> [:m| | is | >> is := InstructionStream on: m. >> is scanFor: [:b| b = 143 and: [(m at: is thirdByte * 256 + is >> fourthByte + is pc + 4) = 135]]] > > > lookForCode: code ifDifferent: handleBlock > "We are expecting a certain numeric code next. > However, in the FTP protocol, multiple lines are allowed. > If the response is multi-line, the fourth character of the first line > is a > $- and the last line repeats the numeric code but the code is followed > by > a space. So it's possible that there are more lines left of the last > response that > we need to throw away. We use peekForAll: so that we don't discard the > next response that is not a continuation line." > > > "check for multi-line response" > (self lastResponse size > 3 > and: [(self lastResponse at: 4) = $-]) > ifTrue: ["Discard continuation lines." > [ | headToDiscard | > headToDiscard := self lastResponse first: 4. > [[self stream peekForAll: headToDiscard] > whileTrue: [self stream nextLine]] > on: Exception > do: [:ex | ^handleBlock value: nil]]]. > ^ super lookForCode: code ifDifferent: handleBlock > _______________________________________________ > Pharo-project mailing list > [email protected] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > -- Best regards, Igor Stasenko AKA sig. _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
