Skip to content

Commit

Permalink
New snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
forthy42 committed Aug 24, 2015
1 parent 2b3aaba commit 7052fb8
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 15 deletions.
1 change: 1 addition & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ GFORTH_FI_SRC2=\
stuff.fs \
substitute.fs \
tasker.fs \
table.fs \
termsize.fs \
utf-8.fs \
vt100.fs \
Expand Down
4 changes: 2 additions & 2 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ dnl Process this file with autoconf to produce a configure script.

dnl We use some automake macros here,
dnl but don't use automake for creating Makefile.in
AC_INIT([gforth],[0.7.9_20150824],[https://savannah.gnu.org/bugs/?func=addbug&group=gforth])
AC_INIT([gforth],[0.7.9_20150825],[https://savannah.gnu.org/bugs/?func=addbug&group=gforth])
AC_PREREQ(2.54)
#snapshots have numbers major.minor.release_YYYYMMDD
#note that lexicographic ordering must be heeded.
#I.e., 0.4.1_YYYYMMDD must not exist before 0.4.1!
UPDATED="August 24, 2015" # Qixi release
UPDATED="August 25, 2015"
AC_SUBST(UPDATED)
AC_CONFIG_HEADERS(engine/config.h)

Expand Down
4 changes: 2 additions & 2 deletions gforth.el
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ PARSED-TYPE specifies what kind of text is parsed. It should be on of 'name',
"[ \t\n]" t name (font-lock-variable-name-face . 3))

(("create" "variable" "constant" "2variable" "2constant" "fvariable"
"fconstant" "value" "2value" "field" "user" "vocabulary"
"fconstant" "value" "2value" "field" "user" "vocabulary" "voctable"
"create-interpret/compile" "interpret/compile:"
"debug:" "field:" "2field:" "ffield:" "sffield:" "dffield:"
"uvar" "uvalue" "cfield:" "wfield:" "lfield:")
Expand Down Expand Up @@ -773,7 +773,7 @@ End:\" construct).")
'("VARIABLE" "CONSTANT" "2VARIABLE" "2CONSTANT" "FVARIABLE" "FCONSTANT"
"USER" "VALUE" "2Value" "field" "end-struct" "VOCABULARY" "CREATE" ":" "CODE"
"DEFER" "ALIAS" "interpret/compile:" "debug:" "field:" "2field:" "ffield:"
"sffield:" "dffield:" "uvar" "uvalue")
"sffield:" "dffield:" "uvar" "uvalue" "voctable")
"List of words, that define the following word.
Used for imenu index generation.")

Expand Down
44 changes: 33 additions & 11 deletions utf16.fs
Original file line number Diff line number Diff line change
@@ -1,24 +1,46 @@
\ simple tools to convert UTF-8 into UTF-16 and back

: .utf16 ( xchar -- )
\ Copyright (C) 2015 Free Software Foundation, Inc.

\ This file is part of Gforth.

\ Gforth is free software; you can redistribute it and/or
\ modify it under the terms of the GNU General Public License
\ as published by the Free Software Foundation, either version 3
\ of the License, or (at your option) any later version.

\ This program is distributed in the hope that it will be useful,
\ but WITHOUT ANY WARRANTY; without even the implied warranty of
\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\ GNU General Public License for more details.

\ You should have received a copy of the GNU General Public License
\ along with this program. If not, see http://www.gnu.org/licenses/.

: .utf16 ( xchar -- ) 0 { w^ ucs16 }
dup $10000 u>= IF
$10000 - >r r@ 10 rshift $3FF and $D800 + recurse
r> $3FF and $DC00 +
$10000 - >r r@ 10 rshift $3FF and $D800 +
ucs16 w! ucs16 2 type \ high surrogate
r> $3FF and $DC00 + \ low surrogate
THEN
dup $FF and emit 8 rshift $FF and emit ;
: typex16 ( addr u -- )
\ type UTF-8 string as UCS16 string
ucs16 w! ucs16 2 type ;
: typeu16 ( addr u -- )
\ type UTF-8 string as UTF-16 string, byte order: host, no BOM
bounds ?DO
I xc@ .utf16
I I' over - x-size +LOOP ;
: $utf16 ( addr1 u1 -- addr2 u2 )
[: typex16 0 .utf16 ;] $tmp 2 - ;
: typex8 ( addr u -- )
: >utf16 ( addr1 u1 -- addr2 u2 )
\g convert UTF-8 string to UTF-16
[: typeu16 0 .utf16 ;] $tmp 2 - ;

: typeu8 ( addr u -- )
\g print UTF-16 string as UTF-8, byte order: host, BOM ignored
bounds ?DO
I uw@ dup $D800 $DC00 within IF
$3FF and 10 lshift I 2 + uw@
$3FF and or $10000 + xemit 4 \ no check for sanity
ELSE xemit 2 THEN
+LOOP ;
: $utf8 ( addr1 u1 -- addr2 u2 )
[: typex8 0 emit ;] $tmp 1- ;
: >utf8 ( addr1 u1 -- addr2 u2 )
\g convert UTF-16 string to UTF-8
[: typeu8 0 emit ;] $tmp 1- ;

0 comments on commit 7052fb8

Please sign in to comment.