You are viewing a plain text version of this content. The canonical link for it is here.
Posted to site-cvs@tcl.apache.org by mx...@apache.org on 2015/10/22 14:39:01 UTC
svn commit: r1710005 - in /tcl/rivet/branches/2.2/rivet/packages/hexglyphs:
./ hexglyphs.tcl
Author: mxmanghi
Date: Thu Oct 22 12:39:00 2015
New Revision: 1710005
URL: http://svn.apache.org/viewvc?rev=1710005&view=rev
Log:
packages/hexglyphs/hexglyphs.tcl: merging changes done in trunk
Modified:
tcl/rivet/branches/2.2/rivet/packages/hexglyphs/ (props changed)
tcl/rivet/branches/2.2/rivet/packages/hexglyphs/hexglyphs.tcl
Propchange: tcl/rivet/branches/2.2/rivet/packages/hexglyphs/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Thu Oct 22 12:39:00 2015
@@ -0,0 +1,7 @@
+/tcl/rivet/branches/2_0/rivet/packages/hexglyphs:939332-1027850
+/tcl/rivet/branches/master-interp/rivet/packages/hexglyphs:1062190-1065801
+/tcl/rivet/branches/modular/rivet/packages/hexglyphs:1486173-1588076
+/tcl/rivet/branches/neh/rivet/packages/hexglyphs:1069501-1076014
+/tcl/rivet/branches/rivet-namespace/rivet/packages/hexglyphs:1065843-1211714
+/tcl/rivet/tags/2.2.0/rivet/packages/hexglyphs:1604411-1647385
+/tcl/rivet/trunk/rivet/packages/hexglyphs:1599312-1615699,1709199-1710004
Modified: tcl/rivet/branches/2.2/rivet/packages/hexglyphs/hexglyphs.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.2/rivet/packages/hexglyphs/hexglyphs.tcl?rev=1710005&r1=1710004&r2=1710005&view=diff
==============================================================================
--- tcl/rivet/branches/2.2/rivet/packages/hexglyphs/hexglyphs.tcl (original)
+++ tcl/rivet/branches/2.2/rivet/packages/hexglyphs/hexglyphs.tcl Thu Oct 22 12:39:00 2015
@@ -17,19 +17,49 @@
# specific language governing permissions and limitations
# under the License.
+#
+# The ASCII glyphs appearance was taken from Fossil
+# http://fossil-scm.org/ and reproduced by permission
+# of Richard Hipp
+#
+
namespace eval ::HexGlyphs:: {
variable HEXGLYPH
array set HEXGLYPH {}
+ proc glyph {g} {
+ variable HEXGLYPH
+
+ return $HEXGLYPH([string toupper $g])
+ }
+ namespace export glyph
+
+ proc glyph_catalog {} {
+ variable HEXGLYPH
+
+ return [array names HEXGLYPH]
+
+ }
+ namespace export glyph_catalog
proc build_hex {hs} {
variable HEXGLYPH
+ set glyphs_avail [array names HEXGLYPH]
+
+ set hs [string toupper $hs]
for {set i 0} {$i < [string length $hs]} {incr i} {
- set lines [split $HEXGLYPH([string toupper [string index $hs $i]]) "\n"]
+ set c [string index $hs $i]
+
+ #if {![string is xdigit $c]}
+ if {[lsearch $glyphs_avail $c] < 0} {
+ return -code error -errocode invalid_char "Invalid non hexadecimal or non space character"
+ }
+
+ set lines [split $HEXGLYPH($c) "\n"]
set lines [lrange $lines 1 end-1]
set l 0
@@ -51,7 +81,7 @@ namespace eval ::HexGlyphs:: {
proc toGlyphs {hexstring} {
- set hexstring_l [split $hexstring " "]
+ set hexstring_l [split $hexstring " \t"]
foreach s $hexstring_l {
set s [string trim $s]
@@ -63,18 +93,16 @@ namespace eval ::HexGlyphs:: {
}
- return [join [list [join $bigstring(0) " "] \
- [join $bigstring(1) " "] \
- [join $bigstring(2) " "] \
- [join $bigstring(3) " "] \
- [join $bigstring(4) " "] \
- [join $bigstring(5) " "]] "\n"]
+ return [join [list [join $bigstring(0) " "] \
+ [join $bigstring(1) " "] \
+ [join $bigstring(2) " "] \
+ [join $bigstring(3) " "] \
+ [join $bigstring(4) " "] \
+ [join $bigstring(5) " "]] "\n"]
}
namespace export toGlyphs
-
namespace ensemble create
-
}
set ::HexGlyphs::HEXGLYPH(A) {
@@ -131,6 +159,15 @@ set ::HexGlyphs::HEXGLYPH(F) {
|_|
}
+set ::HexGlyphs::HEXGLYPH(G) {
+ _____
+ / ____|
+| | __
+| | |_ \
+| |___| |
+ \_____/
+}
+
set ::HexGlyphs::HEXGLYPH(0) {
___
/ _ \
@@ -220,7 +257,24 @@ set ::HexGlyphs::HEXGLYPH(9) {
/_/
}
+set ::HexGlyphs::HEXGLYPH(-) {
+
+
+ _____
+|_____|
+
+
+}
+set ::HexGlyphs::HEXGLYPH(:) {
+
+ __
+ |__|
+ __
+ |__|
+
+
+}
package provide HexGlyphs 0.1
---------------------------------------------------------------------
To unsubscribe, e-mail: site-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: site-cvs-help@tcl.apache.org