svn commit: r351865 - head/stand/ficl/softwords

Toomas Soome tsoome at FreeBSD.org
Thu Sep 5 15:06:30 UTC 2019


Author: tsoome
Date: Thu Sep  5 15:06:30 2019
New Revision: 351865
URL: https://svnweb.freebsd.org/changeset/base/351865

Log:
  ficl: add xemit word
  
  While emit will output one byte on screen, the xemit will output xchar.
  
  See: http://forth-standard.org/standard/xchar/XEMIT

Modified:
  head/stand/ficl/softwords/softcore.fr

Modified: head/stand/ficl/softwords/softcore.fr
==============================================================================
--- head/stand/ficl/softwords/softcore.fr	Thu Sep  5 15:01:24 2019	(r351864)
+++ head/stand/ficl/softwords/softcore.fr	Thu Sep  5 15:06:30 2019	(r351865)
@@ -199,6 +199,14 @@ set-current   \ stop hiding words
 	a-addr 0  b-addr b-u  strcat
 	;
 
+: xemit ( xchar -- )
+ 	dup 0x80 u< if emit exit then \ special case ASCII
+ 	0 swap 0x3F
+ 	begin 2dup u> while
+ 		2/ >r dup 0x3F and 0x80 or swap 6 rshift r>
+ 	repeat 0x7F xor 2* or
+ 	begin dup 0x80 u< 0= while emit repeat drop
+ 	;
 
 previous   \ lose hidden words from search order
 


More information about the svn-src-all mailing list