utilities.tcl File Reference

Go to the source code of this file.

Modules

module  xslt::utilities

Functions/Subroutines

ret xslt::utilities::character first (type srcNd, type charsNd, type args)
ret xslt::utilities::decode base64 (type srcNd, type args)
ret xslt::utilities::binary document (type fnameNd, type srcNd, type args)
ret xslt::utilities::base64 binary document (type fnameNd, type args)

Function Documentation

ret xslt::utilities::decode base64 ( type  srcNd,
type  args 
)

Definition at line 63 of file utilities.tcl.

00063                                                          {
00064     if {[llength $args]} {
00065     return -code error "too many arguments"
00066     }
00067 
00068     if {[catch {package require base64}]} {
00069     return {}
00070     }
00071 
00072     set src $srcNd
00073     catch {set src [dom::node stringValue [lindex $srcNd 0]]}
00074 
00075     return [base64::decode $src]
00076 }

ret xslt::utilities::base64 binary document ( type  fnameNd,
type  args 
)

Definition at line 123 of file utilities.tcl.

00123                                                                     {
00124     if {[llength $args]} {
00125     return -code error "too many arguments"
00126     }
00127 
00128     if {[catch {package require base64}]} {
00129     return {}
00130     }
00131 
00132     set fname $fnameNd
00133     catch {set fname [dom::node stringValue [lindex $fnameNd 0]]}
00134 
00135     if {[catch {open $fname} ch]} {
00136     return {}
00137     }
00138     fconfigure $ch -trans binary -encoding binary
00139     set data [read $ch]
00140     close $ch
00141 
00142     return [base64::encode $data]
00143 }

ret xslt::utilities::binary document ( type  fnameNd,
type  srcNd,
type  args 
)

Definition at line 92 of file utilities.tcl.

00092                                                                           {
00093     if {[llength $args]} {
00094     return -code error "too many arguments"
00095     }
00096 
00097     set fname $fnameNd
00098     catch {set fname [dom::node stringValue [lindex $fnameNd 0]]}
00099     set data $dataNd
00100     catch {set data [dom::node stringValue [lindex $dataNd 0]]}
00101 
00102     if {[catch {open $fname w} ch]} {
00103     return 0
00104     }
00105     fconfigure $ch -trans binary -encoding binary
00106     puts -nonewline $ch $data
00107     close $ch
00108 
00109     return 1
00110 }

ret xslt::utilities::character first ( type  srcNd,
type  charsNd,
type  args 
)

Definition at line 34 of file utilities.tcl.

Referenced by TextInitialize().

00034                                                                           {
00035     if {[llength $args]} {
00036     return -code error "too many arguments"
00037     }
00038 
00039     set src $srcNd
00040     catch {set src [dom::node stringValue [lindex $srcNd 0]]}
00041     set chars $charsNd
00042     catch {set chars [dom::node stringValue [lindex $charsNd 0]]}
00043 
00044     regsub -all {([\\\[\]^$-])} $chars {\\\1} chars
00045     if {[regexp [format {([%s])} $chars] $src dummy theChar]} {
00046     return $theChar
00047     }
00048 
00049     return {}
00050 }

Here is the caller graph for this function:


Generated on 21 Sep 2010 for Gui by  doxygen 1.6.1