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:37:14 UTC

svn commit: r1710004 - in /tcl/rivet/trunk: ChangeLog rivet/init.tcl rivet/packages/hexglyphs/hexglyphs.tcl

Author: mxmanghi
Date: Thu Oct 22 12:37:14 2015
New Revision: 1710004

URL: http://svn.apache.org/viewvc?rev=1710004&view=rev
Log:
    * rivet/init.tcl: now renaming the [exit] core command into ::Rivet::tclcore_exit
    and replacing with a Tcl scripts that calls ::rivet::thread_exit
    * rivet/packages/hexglyphs/hexglyphs.tcl: package generating ASCII 
    glyphs of hexadecimal characters and punctuation character : and -


Modified:
    tcl/rivet/trunk/ChangeLog
    tcl/rivet/trunk/rivet/init.tcl
    tcl/rivet/trunk/rivet/packages/hexglyphs/hexglyphs.tcl

Modified: tcl/rivet/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/ChangeLog?rev=1710004&r1=1710003&r2=1710004&view=diff
==============================================================================
--- tcl/rivet/trunk/ChangeLog (original)
+++ tcl/rivet/trunk/ChangeLog Thu Oct 22 12:37:14 2015
@@ -1,3 +1,9 @@
+2015-10-22 Massimo Manghi <mx...@apache.org>
+    * rivet/init.tcl: now renaming the [exit] core command into ::Rivet::tclcore_exit
+    and replacing with a Tcl scripts that calls ::rivet::thread_exit
+    * rivet/packages/hexglyphs/hexglyphs.tcl: package generating ASCII 
+    glyphs of hexadecimal characters and punctuation character : and -
+
 2015-10-18 Massimo Manghi <mx...@apache.org>
     * src/mod_rivet/rivet_worker_mpm.c: returning HTTP_INTERNAL_SERVER_ERROR
     to requests coming in during a process shutdown. This is required

Modified: tcl/rivet/trunk/rivet/init.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/rivet/init.tcl?rev=1710004&r1=1710003&r2=1710004&view=diff
==============================================================================
--- tcl/rivet/trunk/rivet/init.tcl (original)
+++ tcl/rivet/trunk/rivet/init.tcl Thu Oct 22 12:37:14 2015
@@ -164,16 +164,21 @@ namespace eval ::Rivet {
         lappend auto_path .
     }
 
+} ;## namespace eval ::Rivet
+
+    
+## eventually we have to divert Tcl ::exit to ::rivet::exit_thread
 
-    ## eventually we have to divert Tcl ::exit to ::rivet::exit_thread
+rename ::exit ::Rivet::tclcore_exit
+proc ::exit {code} {
 
-    rename ::exit ::Rivet::exit
-    proc exit {code} {
+    if {[string is integer $code]} {
         eval ::rivet::exit_thread $code
+    } else {
+        eval ::rivet::exit_thread 0
     }
 
-} ;## namespace eval ::Rivet
-
+}
 
 ## Rivet 2.1.x supports Tcl >= 8.5, therefore there's no more need for
 ## the command incr0, as the functionality of creating a not yet

Modified: tcl/rivet/trunk/rivet/packages/hexglyphs/hexglyphs.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/rivet/packages/hexglyphs/hexglyphs.tcl?rev=1710004&r1=1710003&r2=1710004&view=diff
==============================================================================
--- tcl/rivet/trunk/rivet/packages/hexglyphs/hexglyphs.tcl (original)
+++ tcl/rivet/trunk/rivet/packages/hexglyphs/hexglyphs.tcl Thu Oct 22 12:37:14 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