Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #45376

Re: Standard for substitute?

From Gerry Jackson <gerry@jackson9000.fsnet.co.uk>
Newsgroups comp.lang.forth
Subject Re: Standard for substitute?
Date 2016-02-08 20:27 +0000
Organization A noiseless patient Spider
Message-ID <n9atgi$eoh$1@dont-email.me> (permalink)
References <74c901b1-0d95-427a-91ec-c6d1ca079d6e@googlegroups.com>

Show all headers | View raw


On 08/02/2016 13:14, josv@planet.nl wrote:
> It seems there exist several versions of SUBSTITUTE
>   1) Is the version at
>      http://www.forth200x.org/text-substitution.txt still right?
>   2) gForth uses an other version which seems to be Forth-2012
>      but not the same as described at forth200x.
> Next follows a test code.
> Most important is the difference at the test of %5b1%mac2
> How should substitute behave?
>
> The test code is:
>
> cr cr .( Extra tests for Substitute ) cr
> \ needs _200xSubstitute.f \ See below
>
> : .before ( adr1 n1 adr2 n2 - adr1 n1 adr2 n2 )
>      2over type ."  + " 2dup type ."  Stubstitute --> " ;
>
> : .result ( adr len RESn - adr len ) .s drop type ;
>
> cr cr .( Invalid names:)
> cr s" %1ab"  s" _____" .before SUBSTITUTE .result
> cr s" 2ab%"  s" _____" .before SUBSTITUTE .result
> cr s" 3bc%mac1" s" abc%mac1" .before SUBSTITUTE .result
> cr s" 4bc%mac1" s" abc%mac" .before  SUBSTITUTE .result
>
> cr cr .( Valid name:)
> cr s" %5b1%mac2" s" __________" .before SUBSTITUTE .result
> cr
>

You could save yourself some work if you used the SUBSTITUTE and 
REPLACES tests in the forth 2012 test file:   stringtest.fth
See https://github.com/gerryjackson/forth2012-test-suite

-- 
Gerry

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Standard for substitute? josv@planet.nl - 2016-02-08 05:14 -0800
  Re: Standard for substitute? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-02-08 17:08 +0000
    Re: Standard for substitute? josv@planet.nl - 2016-02-08 14:12 -0800
    Re: Standard for substitute? josv@planet.nl - 2016-02-08 15:08 -0800
  Re: Standard for substitute? Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2016-02-08 20:27 +0000
    Re: Standard for substitute? josv@planet.nl - 2016-02-08 14:22 -0800

csiph-web