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/15 00:31:55 UTC
svn commit: r1708708 - in /tcl/rivet/trunk: ChangeLog
rivet/packages/hexgliphs/ rivet/packages/hexgliphs/hexgliphs.tcl
Author: mxmanghi
Date: Wed Oct 14 22:31:55 2015
New Revision: 1708708
URL: http://svn.apache.org/viewvc?rev=1708708&view=rev
Log:
* rivet/packages/hexgliphs/hexgliphs.tcl: new package HexGliphsto print hexadecimal character gliphs as ascii art
Added:
tcl/rivet/trunk/rivet/packages/hexgliphs/
tcl/rivet/trunk/rivet/packages/hexgliphs/hexgliphs.tcl
Modified:
tcl/rivet/trunk/ChangeLog
Modified: tcl/rivet/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/ChangeLog?rev=1708708&r1=1708707&r2=1708708&view=diff
==============================================================================
--- tcl/rivet/trunk/ChangeLog (original)
+++ tcl/rivet/trunk/ChangeLog Wed Oct 14 22:31:55 2015
@@ -1,3 +1,7 @@
+2015-10-14 Massimo Manghi <mx...@apache.org>
+ * rivet/packages/hexgliphs/hexgliphs.tcl: new package HexGliphs
+ to print hexadecimal character gliphs as ascii art
+
2015-10-04 Massimo Manghi <mx...@apache.org>
* src/mod_rivet/mod_rivet.c: moving Rivet_ProcessorCleanup in
mod_rivet_common.c
Added: tcl/rivet/trunk/rivet/packages/hexgliphs/hexgliphs.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/rivet/packages/hexgliphs/hexgliphs.tcl?rev=1708708&view=auto
==============================================================================
--- tcl/rivet/trunk/rivet/packages/hexgliphs/hexgliphs.tcl (added)
+++ tcl/rivet/trunk/rivet/packages/hexgliphs/hexgliphs.tcl Wed Oct 14 22:31:55 2015
@@ -0,0 +1,226 @@
+# hexgliphs.tcl --
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+namespace eval ::HexGliphs:: {
+
+ variable HEXGLIPH
+
+ array set HEXGLIPH {}
+
+
+ proc build_hex {hs} {
+ variable HEXGLIPH
+
+ for {set i 0} {$i < [string length $hs]} {incr i} {
+
+ set lines [split $HEXGLIPH([string toupper [string index $hs $i]]) "\n"]
+ set lines [lrange $lines 1 end-1]
+
+ set l 0
+ foreach gliphline $lines {
+ append hexline($l) $gliphline
+ incr l
+ }
+
+ }
+
+ return [list $hexline(0) \
+ $hexline(1) \
+ $hexline(2) \
+ $hexline(3) \
+ $hexline(4) \
+ $hexline(5)]
+
+ }
+
+ proc toGliphs {hexstring} {
+
+ set hexstring_l [split $hexstring " "]
+ foreach s $hexstring_l {
+
+ set s [string trim $s]
+
+ set string_l [[namespace current]::build_hex $s]
+ for {set i 0} {$i < 6} {incr i} {
+ lappend bigstring($i) [lindex $string_l $i]
+ }
+
+ }
+
+ return [join [list [join $bigstring(0) " "] \
+ [join $bigstring(1) " "] \
+ [join $bigstring(2) " "] \
+ [join $bigstring(3) " "] \
+ [join $bigstring(4) " "] \
+ [join $bigstring(5) " "]] "\n"]
+ }
+ namespace export toGliphs
+
+
+ namespace ensemble create
+
+}
+
+set ::HexGliphs::HEXGLIPH(A) {
+
+ /\
+ / \
+ / /\ \
+ / ____ \
+/_/ \_\
+}
+
+set ::HexGliphs::HEXGLIPH(B) {
+ ____
+| _ \
+| |_) |
+| _ <
+| |_) |
+|____/
+}
+
+set ::HexGliphs::HEXGLIPH(C) {
+ _____
+ / ____|
+| |
+| |
+| |____
+ \_____|
+}
+
+set ::HexGliphs::HEXGLIPH(D) {
+ _____
+| __ \
+| | | |
+| | | |
+| |__| |
+|_____/
+}
+
+set ::HexGliphs::HEXGLIPH(E) {
+ ______
+| ____|
+| |__
+| __|
+| |____
+|______|
+}
+
+set ::HexGliphs::HEXGLIPH(F) {
+ ______
+| ____|
+| |__
+| __|
+| |
+|_|
+}
+
+set ::HexGliphs::HEXGLIPH(0) {
+ ___
+ / _ \
+| | | |
+| | | |
+| |_| |
+ \___/
+}
+
+set ::HexGliphs::HEXGLIPH(1) {
+ __
+/_ |
+ | |
+ | |
+ | |
+ |_|
+}
+
+set ::HexGliphs::HEXGLIPH(2) {
+ ___
+|__ \
+ ) |
+ / /
+ / /_
+|____|
+}
+
+set ::HexGliphs::HEXGLIPH(3) {
+ ____
+|___ \
+ __) |
+ |__ <
+ ___) |
+|____/
+}
+
+set ::HexGliphs::HEXGLIPH(4) {
+ _ _
+| || |
+| || |_
+|__ _|
+ | |
+ |_|
+}
+
+set ::HexGliphs::HEXGLIPH(5) {
+ _____
+| ____|
+| |__
+|___ \
+ ___) |
+|____/
+}
+
+set ::HexGliphs::HEXGLIPH(6) {
+ __
+ / /
+ / /_
+| '_ \
+| (_) |
+ \___/
+}
+
+set ::HexGliphs::HEXGLIPH(7) {
+ ______
+|____ |
+ / /
+ / /
+ / /
+ /_/
+}
+set ::HexGliphs::HEXGLIPH(8) {
+ ___
+ / _ \
+| (_) |
+ > _ <
+| (_) |
+ \___/
+}
+
+set ::HexGliphs::HEXGLIPH(9) {
+ ___
+ / _ \
+| (_) |
+ \__, |
+ / /
+ /_/
+}
+
+
+package provide HexGliphs
+
+
---------------------------------------------------------------------
To unsubscribe, e-mail: site-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: site-cvs-help@tcl.apache.org