tcl using $HCISITEDIR and other variables

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf tcl using $HCISITEDIR and other variables

  • Creator
    Topic
  • #47635
    Keith McLeod
    Participant

    I have been reworking some tcl code.  Is it best to use variables in your code such as $HCISITEDIR.  I have have several platforms represented, each with much of its code with actual paths in the tcl procs.  Can I simply replace the “/hci/root3.8.1P/prod” with $HCISITEDIR whereever it is used in the tclprocs?  I am upgrading several systems and would like to make it a little more pain free by using portable code to accommodate for things like the new paths C:quovadxqdx5.3….  I beleive this would also help when changing site names.  Any comments or suggestions are most helpful.

Viewing 2 reply threads
  • Author
    Replies
    • #56318
      Bill Bertera
      Participant

      in tcl they’re: HciSiteDir, HciSite, HciRoot. they’re global variables, so you need to have:

      global HciSiteDir

      global HciSite

      global HciRoot

      before you use them. It’s better to use the variables then hardcode, for the reasons you mention.

    • #56319
      Rob Abbott
      Keymaster

      FWIW, you can also access any environment variable with the env() array:

      Code:

      global env
      echo $env(HCISITEDIR)

      Rob Abbott
      Cloverleaf Emeritus

    • #56320
      Anonymous
      Participant

      Also, you can find out what all the Cloverleaf provided global variables are using the ‘info globals’ command.

      To find out what the engine globals are, add the following line to a tps proc and look for the output in the log.

      echo INFO_GLOBALS<[info globals]>

      Note that you’ll get a slightly different list if you do the same thing in ‘hcitcl’.

Viewing 2 reply threads
  • The forum ‘Cloverleaf’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,127
Forums
28
Topics
9,299
Replies
34,443
Topic Tags
288
Empty Topic Tags
10