cmdr
Check-in [c843b9c1dd]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Extended the set of common validation types, added "double". Bumped cmdr::validate to 1.2
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:c843b9c1ddf3c49bd4e89aa396f85e5f80418332
User & Date: andreask 2014-02-12 23:29:08
Original Comment: Extended set of common validation types, added "double". Bumped cmdr::validate to 1.2
Context
2014-02-13
05:39
Extended the set of common validation types, added "percent" (double limited to [0,100]). Updated documentation. check-in: 49d0a10137 user: aku tags: trunk
2014-02-12
23:29
Extended the set of common validation types, added "double". Bumped cmdr::validate to 1.2 check-in: c843b9c1dd user: andreask tags: trunk
2014-02-07
20:39
Rename "_find" to "internal_find" instead of diddling with export. check-in: a2da845671 user: andreask tags: trunk, release, release-1-1, v1.1, cmdr-1-1
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to validate.tcl.

    28     28   
    29     29   namespace eval ::cmdr {
    30     30       namespace export validate
    31     31       namespace ensemble create
    32     32   }
    33     33   
    34     34   namespace eval ::cmdr::validate {
    35         -    namespace export boolean integer identity pass str \
           35  +    namespace export boolean integer double identity pass str \
    36     36   	rfile rwfile rdirectory rwdirectory rpath rwpath
    37     37       #namespace ensemble create
    38     38   
    39     39       # For external v-types relying on them here.
    40     40       namespace import ::cmdr::validate::common::fail
    41     41       namespace import ::cmdr::validate::common::complete-enum
    42     42   }
................................................................................
    95     95       return {}
    96     96   }
    97     97   proc ::cmdr::validate::integer::validate {p x} {
    98     98       debug.cmdr/validate {}
    99     99       if {[string is integer -strict $x]} { return $x }
   100    100       fail $p INTEGER "an integer" $x
   101    101   }
          102  +
          103  +# # ## ### ##### ######## ############# #####################
          104  +## Any float
          105  +
          106  +namespace eval ::cmdr::validate::double {
          107  +    namespace export default validate complete release
          108  +    namespace ensemble create
          109  +    namespace import ::cmdr::validate::common::fail
          110  +}
          111  +
          112  +proc ::cmdr::validate::double::release  {p x} { return }
          113  +proc ::cmdr::validate::double::default  {p}  {
          114  +    debug.cmdr/validate {}
          115  +    return 0
          116  +}
          117  +proc ::cmdr::validate::double::complete {p x} {
          118  +    debug.cmdr/validate {} 10
          119  +    return {}
          120  +}
          121  +proc ::cmdr::validate::double::validate {p x} {
          122  +    debug.cmdr/validate {}
          123  +    if {[string is double -strict $x]} { return $x }
          124  +    fail $p DOUBLE "a double" $x
          125  +}
   102    126   
   103    127   # # ## ### ##### ######## ############# #####################
   104    128   ## Any string
   105    129   
   106    130   namespace eval ::cmdr::validate::identity {
   107    131       namespace export default validate complete release
   108    132       namespace ensemble create
................................................................................
   317    341       if {![file readable    $path]} {return 0}
   318    342       if {![file writable    $path]} {return 0}
   319    343       return 1
   320    344   }
   321    345   
   322    346   # # ## ### ##### ######## ############# #####################
   323    347   ## Ready
   324         -package provide cmdr::validate 1.1
          348  +package provide cmdr::validate 1.2
   325    349   return