IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25742


Ignore:
Timestamp:
Oct 2, 2009, 11:48:31 AM (17 years ago)
Author:
eugene
Message:

add macros to save and load labels; protect user-set values for globals when reloading pantasks.pro

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTasks/pantasks.pro

    r25456 r25742  
    11## pantasks.pro : globals and support macros : -*- sh -*-
    22
     3# globals that may be modified by the user -- only init if not set
     4if ($?NEBULOUS == 0)      set NEBULOUS = 0
     5if ($?NETWORK == 0)       set NETWORK = 1
     6if ($?PARALLEL == 0)      set PARALLEL = 1
     7if ($?VERBOSE == 0)       set VERBOSE = 1
     8if ($?LABEL:n == 0)       set LABEL:n = 0
     9if ($?POLLLIMIT == 0)     set POLLLIMIT = 32
     10if ($?KEEP_FAILURES == 0) set KEEP_FAILURES = 0
     11
     12if ($?LOGDIR == 0)
     13  $LOGDIR = `pwd`
     14  $LOGDIR = $LOGDIR/pantasks_logs
     15  mkdir $LOGDIR
     16end
     17
    318# globals used to control system behavior : these should be in uppercase
    4 $NEBULOUS = 0
    5 $NETWORK = 1
    6 $PARALLEL = 1
    7 $VERBOSE = 1
    8 $LABEL:n = 0
    9 $POLLLIMIT = 32
    10 $LOGDIR = `pwd`
    11 $LOGDIR = $LOGDIR/pantasks_logs
    12 mkdir $LOGDIR
    13 $KEEP_FAILURES = 0
    14 
    1519$LOADPOLL = 1.0
    1620$LOADEXEC = 5.0
     
    144148  for i 0 $LABEL:n
    145149    echo $LABEL:$i
     150  end
     151end
     152
     153macro save.labels
     154  if ($0 != 1)
     155    echo "USAGE: save.labels"
     156    break
     157  end
     158  if ($?LABEL:n == 0)
     159    echo "no labels defined"
     160  end
     161  if ($LABEL:n == 0)
     162    echo "no labels defined"
     163  end
     164
     165  exec rm -f labels.list
     166  local i
     167  for i 0 $LABEL:n
     168    exec echo $LABEL:$i >> labels.list
     169  end
     170end
     171
     172macro load.labels
     173  if ($0 != 1)
     174    echo "USAGE: load.labels"
     175    break
     176  end
     177
     178  file labels.list found
     179  if (not($found))
     180    echo "no saved labels in labels.list"
     181    return
     182  end
     183 
     184  list mylabels -x "cat labels.list"
     185  local i
     186  for i 0 $mylabels:n
     187    add.label $mylabels:$i
    146188  end
    147189end
Note: See TracChangeset for help on using the changeset viewer.