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

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


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

[UNDEFINED] PARSE-NAME [IF]
                                       \ mamma's little helpers
: source' source drop ;                ( -- a)
: >in+ 1 >in +! ;                      ( --)
: source@ >in @ + c@ dup ;             ( a -- c c)
: print? bl - 0> ;                     ( c -- f)
                                       \ parse WS delimited string
: PARSE-BL                             ( -- a n)
  source' dup >r >in @ chars + 0
  begin r@ source@ if >in+ then print? while 1+ repeat r> drop
;
                                       \ skip leading WS chars in buffer
: OMIT-BL                              ( --)
  source' begin dup source@ 0= swap print? or 0= while >in+ repeat drop
;
                                       \ parse WS delimited string like WORD
: PARSE-NAME omit-bl parse-bl ;        ( -- a n)

[DEFINED] 4TH# [IF]
hide source'
hide >in+
hide source@
hide print?
[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 [email protected].