1 # Copyright 2002-2007 Interchange Development Group and others
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version. See the LICENSE file for details.
8 # $Id: control.coretag,v 1.4 2007-03-30 23:40:49 pajamian Exp $
10 UserTag control Order name default
11 UserTag control addAttr
12 UserTag control PosNumber 2
13 UserTag control Version $Revision: 1.4 $
14 UserTag control Routine <<EOR
16 my ($name, $default, $opt) = @_;
21 # Here we either reset the index or increment it
22 # Done this way for speed, no blocks to enter other than top one
24 $::Control = $Tmp->{$opt->{space}} ||= [];
25 return set_tmp('control_index', 0);
28 ($::Scratch->{control_index} = 0, return) if $opt->{reset};
29 return set_tmp('control_index', ++$::Scratch->{control_index});
36 if (! defined $default and $opt->{set}) {
37 $::Control->[$::Scratch->{control_index}]{$name} = $::Scratch->{$name};
41 return defined $::Control->[$::Scratch->{control_index}]{$name}
42 ? ( $::Control->[$::Scratch->{control_index}]{$name} || $default )
43 : ( length($::Scratch->{$name}) ? ($::Scratch->{$name}) : $default )