Plan 9 from Bell Labs’s /usr/web/sources/contrib/fgb/root/sys/src/cmd/4th/lib/back.4th

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


\ 4tH library - TOOLBELT BACK - Copyright 2004,2007 J.L. Bezemer
\ You can redistribute this file and/or modify it under
\ the terms of the GNU General Public License

[UNDEFINED] BACK [IF]
: BACK ( addr1 n1 c -- addr1 n2 )
  >R BEGIN DUP IF OVER OVER 1- CHARS + C@ R@ <> ELSE DUP THEN
  WHILE 1- REPEAT R> DROP
;

: -SCAN OVER >R BACK R> OVER - >R CHARS + R> -1 /STRING ;

: (SPLIT)                  ( a1 n1 a2 n2  -- a2 n2 a1 n1-n2 n2)
   DUP >R ROT >R ROT R> R@ - R> ;
: /SPLIT                   ( a1 n1 a2 n2  -- a2 n2 a1 n1-n2)
  (SPLIT) DROP ;
: -SPLIT                   ( a1 n1 a2 n2  -- a2 n2 a1+n2 n1-n2)
  (SPLIT) CHARS ROT + SWAP ;

[DEFINED] 4TH# [IF]
hide (SPLIT)
[THEN]
[THEN]


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.