source: branches/nanovis2/lang/tcl/scripts/validations/imformat.tcl @ 3305

Last change on this file since 3305 was 3305, checked in by ldelgass, 12 years ago

sync with trunk

File size: 966 bytes
Line 
1# ----------------------------------------------------------------------
2#  VALIDATION: imformat
3#
4#  Handles the string:validate=imformat setting for an object attribute.
5#  Checks the given string to see if it is one of the allowed image
6#  format strings:  gif, jpeg, png, etc.  Returns an error if something
7#  is wrong.
8# ======================================================================
9#  AUTHOR:  Michael McLennan, Purdue University
10#  Copyright (c) 2004-2012  HUBzero Foundation, LLC
11#
12#  See the file "license.terms" for information on usage and
13#  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14# ======================================================================
15proc validate_imformat {str} {
16    set valid {bmp gif ico jpeg pcx png pgm ppm ps pdf sgi sun tga tiff xbm xpm}
17    if {$str ne "" && [lsearch $valid $str] < 0} {
18        error "bad format \"$str\": should be one of [join $valid {, }]"
19    }
20    return "ok"
21}
Note: See TracBrowser for help on using the repository browser.