Tcl Libraries

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Tcl Libraries

  • Creator
    Topic
  • #48931
    garry r fisher
    Participant

      Hi,

      I have a lot of Tcl scripts that I have developed over the years and I was wondering how people manage these? Do you setup your own auto_path and TclIndex, do you use packages or namespaces etc?

      I’d be interested in what you think is the best/simplest way of managing these.

      Regards

      Garry

    Viewing 2 reply threads
    • Author
      Replies
      • #60156
        Jim Kosloskey
        Participant

          Garry,

          I am sure there are more sophisticated mechanisms but here is what I do:

          In our environment we have multiple sites.

          The sites all share some common objects (Tables, Formats, Tcl Procs, etc.) as well as local objects (Xlates for example are almost always local).

          In order to facilitate that we constructed a site which contains no integrations but just provides a directory structure to contain the common objects described above. In other words common Tcl procs reside in the common site’s tclprocs directory.

          Then the using sites (where the integrations really reside) soft link to the appropriate object in the common site’s appropriate directory. Except for tclprocs – more on that later.

          This allows us to maintain only one copy of the objects but have multiple uses.

          Nearly all of our Tcl procs are constructed to be reusable by nature. In other words the procs are driven by arguments such that one proc can be used multiple times within a given site or any number of sites. Thus they need to be referenced from a common location.

          Our procs do reside in the common site’s tclprocs directory BUT the soft link to that location is from the $HCIROOT/tclprocs directory. This is because Cloverleaf(R) will populate the pull down lists for selecting procs with entries from $HCIROOT/tclprocs AND the sites’s tclprocs directory. Thus we do not need soft links for common tclprocs in all sites.

          One caveat though – when a new release comes the $HCIROOT/tclprocs directory gets rebuilt – meaning our soft links (and if not using soft links the procs themselves) disappear. With using soft links, all we need to do is rebuild the links in the $HCIROOT/tclprocs directory after upgrade but before turning any sites on.

          I use UltraEdit to edit my Tcl procs. UtraEdit has an FTP option. But I maintain the originals on my PC and then FTP them. If they are new procs or need major upgrade, I FTP them to the site where I am testing and place them in that site’s tclprocs directory. Once they are tested and ready, they are moved to the common site and a soft link is made in the $HCIROOT/tclprocs directory, then a mktclindex is done, and the local copy is removed.

          If they are modifed and not new, then all sites using the proc(s) in question either reload the proc(s) or the appropriate control (thread, process) is cycled to reload the proc(s).

          Jim Kosloskey

          email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

        • #60157
          Richard Hart
          Participant

            Guys.

            We share code (Xlate, Tables etc) across sites with links (Unix).  For our tclprocs, which we perform almost all of our translations in, we use library code and a makefile setup.  

            The ‘make’ command extracts the latest (or appropriate) code creates the tclIndex for the site and library code (eg mktclindex {*.tcl,../LIB2/*.tcl}) and strips out functions to avoid translation issues.

            A simple site has a tclIndex

            set auto_index(eds_xlate_top)

              ]

              set auto_index(Print)

                ]

                set auto_index(gen_code_new_resend)

                  ]

                1. #60158
                  garry r fisher
                  Participant

                    Jim/Richard,

                    Thanks for sharing that.

                    Regards

                    Garry

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