diff -r 23462e06dcff -r 0f748abc0c17 CharacterArray.st --- a/CharacterArray.st Tue Sep 04 20:48:06 2001 +0200 +++ b/CharacterArray.st Tue Sep 04 20:57:13 2001 +0200 @@ -2223,146 +2223,6 @@ " ! ! -!CharacterArray methodsFor:'Compatibility - ST80'! - -expandMacros - "ST80 compatibility - expand '<..>' macros with - argument strings. Similar to #bindWith:. - Read the comment in #expandMacrosWithArguments: about - limited compatibility issues." - - ^ self expandMacrosWithArguments:#() - - " - 'hellofoo' expandMacros - " - - "Modified: / 18.6.1998 / 16:03:02 / cg" -! - -expandMacrosWith:arg - "ST80 compatibility - expand '<..>' macros with - argument strings. Similar to #bindWith:. - Read the comment in #expandMacrosWithArguments: about - limited compatibility issues." - - ^ self expandMacrosWithArguments:(Array with:arg) - - "Created: / 1.11.1997 / 13:01:28 / cg" - "Modified: / 1.11.1997 / 13:30:50 / cg" -! - -expandMacrosWith:arg1 with:arg2 - "ST80 compatibility - expand '<..>' macros with - argument strings. Similar to #bindWith:. - Read the comment in #expandMacrosWithArguments: about - limited compatibility issues." - - ^ self expandMacrosWithArguments:(Array with:arg1 with:arg2) - - "Modified: / 6.7.1998 / 21:58:14 / cg" -! - -expandMacrosWith:arg1 with:arg2 with:arg3 - "ST80 compatibility - expand '<..>' macros with - argument strings. Similar to #bindWith:. - Read the comment in #expandMacrosWithArguments: about - limited compatibility issues." - - ^ self expandMacrosWithArguments:(Array with:arg1 with:arg2 with:arg3) -! - -expandMacrosWithArguments:argArray - "ST80 compatibility - expand '<..>' macros with - argument strings. Similar to #bindWith:. - WARNING: possibly not all ST80 expansions are supported here." - - "/ supported expansions: - "/ - "/ <#p> # is arg Number; slice in the args printString - "/ <#s> # is arg Number; slice in the arg itself (must be a String) - "/ <#?s1:s2> # is arg Number; slice in s1 if the arg is true, s2 otherwise - "/ slice in the arg - "/ replace by a newLine character - "/ replace by a tab character - - |in out c fmt nr arg s1 s2| - - in := self readStream. - out := '' writeStream. - - [in atEnd] whileFalse:[ - c := in next. - c == $< ifTrue:[ - [in peek == $<] whileTrue:[ - out nextPut:$<. - in next. - ]. - in peek == $n ifTrue:[ - out nextPut:Character cr. - in next - ] ifFalse:[in peek == $t ifTrue:[ - out nextPut:Character tab. - in next - ] ifFalse:[ - in peek isDigit ifFalse:[ - nr := 1 - ] ifTrue:[ - "/ start an argument expansion ... - nr := Integer readFrom:in onError:nil. - nr isNil ifTrue:[ - "/ what does VW do here ? - self error:'invalid format' mayProceed:true. - ^ self - ]. - (nr between:1 and:argArray size) ifFalse:[ - "/ what does VW do here ? - self error:'invalid format - bad argNr' mayProceed:true. - ^ self - ]. - ]. - arg := argArray at:nr. - - fmt := in next. - (fmt == $p) ifTrue:[ - "/ expand with args printString - out nextPutAll:arg printString. - ] ifFalse:[ (fmt == $s) ifTrue:[ - "/ expand with arg itself - out nextPutAll:arg asString. - ] ifFalse:[ (fmt == $?) ifTrue:[ - s1 := in upTo:$:. - s2 := in nextUpTo:$>. - arg ifTrue:[ - out nextPutAll:s1 - ] ifFalse:[ - out nextPutAll:s2 - ]. - ] ifFalse:[ - "/ what does VW do here ? - self error:'invalid format' mayProceed:true. - ^ self - ]]]. - ]]. - c := in next. - c ~~ $> ifTrue:[ - "/ what does VW do here ? - self error:'invalid format' mayProceed:true. - ^ self - ] - ] ifFalse:[ - out nextPut:c - ]. - ]. - ^ out contents - - " - 'hello <1p> how are you' expandMacrosWith:(OperatingSystem getLoginName) - " - - "Modified: / 18.6.1998 / 16:04:46 / cg" -! ! - !CharacterArray methodsFor:'Compatibility - Squeak'! capitalized @@ -2637,6 +2497,146 @@ ^ self withoutSeparators ! ! +!CharacterArray methodsFor:'Compatibility - VW'! + +expandMacros + "ST80 compatibility - expand '<..>' macros with + argument strings. Similar to #bindWith:. + Read the comment in #expandMacrosWithArguments: about + limited compatibility issues." + + ^ self expandMacrosWithArguments:#() + + " + 'hellofoo' expandMacros + " + + "Modified: / 18.6.1998 / 16:03:02 / cg" +! + +expandMacrosWith:arg + "ST80 compatibility - expand '<..>' macros with + argument strings. Similar to #bindWith:. + Read the comment in #expandMacrosWithArguments: about + limited compatibility issues." + + ^ self expandMacrosWithArguments:(Array with:arg) + + "Created: / 1.11.1997 / 13:01:28 / cg" + "Modified: / 1.11.1997 / 13:30:50 / cg" +! + +expandMacrosWith:arg1 with:arg2 + "ST80 compatibility - expand '<..>' macros with + argument strings. Similar to #bindWith:. + Read the comment in #expandMacrosWithArguments: about + limited compatibility issues." + + ^ self expandMacrosWithArguments:(Array with:arg1 with:arg2) + + "Modified: / 6.7.1998 / 21:58:14 / cg" +! + +expandMacrosWith:arg1 with:arg2 with:arg3 + "ST80 compatibility - expand '<..>' macros with + argument strings. Similar to #bindWith:. + Read the comment in #expandMacrosWithArguments: about + limited compatibility issues." + + ^ self expandMacrosWithArguments:(Array with:arg1 with:arg2 with:arg3) +! + +expandMacrosWithArguments:argArray + "ST80 compatibility - expand '<..>' macros with + argument strings. Similar to #bindWith:. + WARNING: possibly not all ST80 expansions are supported here." + + "/ supported expansions: + "/ + "/ <#p> # is arg Number; slice in the args printString + "/ <#s> # is arg Number; slice in the arg itself (must be a String) + "/ <#?s1:s2> # is arg Number; slice in s1 if the arg is true, s2 otherwise + "/ slice in the arg + "/ replace by a newLine character + "/ replace by a tab character + + |in out c fmt nr arg s1 s2| + + in := self readStream. + out := '' writeStream. + + [in atEnd] whileFalse:[ + c := in next. + c == $< ifTrue:[ + [in peek == $<] whileTrue:[ + out nextPut:$<. + in next. + ]. + in peek == $n ifTrue:[ + out nextPut:Character cr. + in next + ] ifFalse:[in peek == $t ifTrue:[ + out nextPut:Character tab. + in next + ] ifFalse:[ + in peek isDigit ifFalse:[ + nr := 1 + ] ifTrue:[ + "/ start an argument expansion ... + nr := Integer readFrom:in onError:nil. + nr isNil ifTrue:[ + "/ what does VW do here ? + self error:'invalid format' mayProceed:true. + ^ self + ]. + (nr between:1 and:argArray size) ifFalse:[ + "/ what does VW do here ? + self error:'invalid format - bad argNr' mayProceed:true. + ^ self + ]. + ]. + arg := argArray at:nr. + + fmt := in next. + (fmt == $p) ifTrue:[ + "/ expand with args printString + out nextPutAll:arg printString. + ] ifFalse:[ (fmt == $s) ifTrue:[ + "/ expand with arg itself + out nextPutAll:arg asString. + ] ifFalse:[ (fmt == $?) ifTrue:[ + s1 := in upTo:$:. + s2 := in nextUpTo:$>. + arg ifTrue:[ + out nextPutAll:s1 + ] ifFalse:[ + out nextPutAll:s2 + ]. + ] ifFalse:[ + "/ what does VW do here ? + self error:'invalid format' mayProceed:true. + ^ self + ]]]. + ]]. + c := in next. + c ~~ $> ifTrue:[ + "/ what does VW do here ? + self error:'invalid format' mayProceed:true. + ^ self + ] + ] ifFalse:[ + out nextPut:c + ]. + ]. + ^ out contents + + " + 'hello <1p> how are you' expandMacrosWith:(OperatingSystem getLoginName) + " + + "Modified: / 18.6.1998 / 16:04:46 / cg" +! ! + !CharacterArray methodsFor:'character searching'! includesMatchCharacters @@ -5968,6 +5968,6 @@ !CharacterArray class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.208 2001-09-04 18:48:06 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.209 2001-09-04 18:57:13 cg Exp $' ! ! CharacterArray initialize!