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

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


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

\ Load definitions when needed
[UNDEFINED] 2OVER [IF]
[NEEDS lib/2rotover.4th]
[THEN]

[UNDEFINED] UNDER+ [IF]
1 CELLS CONSTANT CELL

: (.)  ( n -- str len )
  BASE @ 10 = IF DUP ELSE 0 SWAP THEN ABS <# #S SIGN #> ;

: 2+   ( n1|u1 -- n2|u2 )  1+ 1+ ;
: 2-   ( n1|u1 -- n2|u2 )  1- 1- ;
: 3DUP ( x1 x2 x3 -- x1 x2 x3 x1 x2 x3 )  DUP 2OVER ROT ;
: 4DUP ( x1 x2 x3 -- x1 x2 x3 x1 x2 x3 )  2OVER 2OVER ;
: @+   ( a-addr1 -- a-addr2 x )  DUP CELL+  SWAP @ ;
: !+   ( addr1 x -- addr2 )  OVER !  CELL+ ;
: C@+  ( c-addr1 -- c-addr2 c )  DUP CHAR+  SWAP C@ ;
: C!+  ( c-addr1 c -- c-addr2 )  OVER C!  CHAR+ ;
: C+!  ( n c-addr -- )  DUP >R C@ + R> C! ;
: CLEAR   ( i*x -- )  DEPTH 0 ?DO DROP LOOP ;
: NOOP ;
: OFF     ( a-addr -- )  FALSE SWAP ! ;
: ON      ( a-addr -- )  TRUE SWAP ! ;
: PERFORM ( i*x a-addr -- j*x )  @ EXECUTE ;
: UNDER+  ( n1|u1 x n2|u2 -- n3|u3 x ) ROT + SWAP ;
[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 [email protected].