home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / maths / plplot / plplot_2 / drivers / tk / mktclidx < prev    next >
Encoding:
Tcl/Tk script  |  1994-06-10  |  3.2 KB  |  82 lines

  1. #!/usr/local/bin/wish -f
  2. #
  3. # itcl_mkindex:
  4. # Regenerate a tclIndex file from Tcl source files.  Takes as argument
  5. # the name of the directory in which the tclIndex file is to be placed,
  6. # floowed by any number of glob patterns to use in that directory to
  7. # locate all of the relevant files.
  8. #
  9. # ////////////////////////////////////////////////////////////////////////
  10. #                MODIFIED TO RECOGNIZED [incr Tcl] CLASSES
  11. # ////////////////////////////////////////////////////////////////////////
  12. #
  13. #   AUTHOR:  Michael J. McLennan       Phone: (610)712-2842
  14. #            AT&T Bell Laboratories   E-mail: michael.mclennan@att.com
  15. #
  16. #      RCS:  itcl_mkindex.tcl,v 1.1.1.1 1994/03/21 22:09:46 mmc Exp
  17. # ----------------------------------------------------------------------
  18. #               Copyright (c) 1993  AT&T Bell Laboratories
  19. # ======================================================================
  20. # Permission to use, copy, modify, and distribute this software and its
  21. # documentation for any purpose and without fee is hereby granted,
  22. # provided that the above copyright notice appear in all copies and that
  23. # both that the copyright notice and warranty disclaimer appear in
  24. # supporting documentation, and that the names of AT&T Bell Laboratories
  25. # any of their entities not be used in advertising or publicity
  26. # pertaining to distribution of the software without specific, written
  27. # prior permission.
  28. #
  29. # AT&T disclaims all warranties with regard to this software, including
  30. # all implied warranties of merchantability and fitness.  In no event
  31. # shall AT&T be liable for any special, indirect or consequential
  32. # damages or any damages whatsoever resulting from loss of use, data or
  33. # profits, whether in an action of contract, negligence or other
  34. # tortuous action, arising out of or in connection with the use or
  35. # performance of this software.
  36. # ======================================================================
  37.  
  38. proc itcl_mkindex {dir args} {
  39.     global errorCode errorInfo
  40.     set oldDir [pwd]
  41.     cd $dir
  42.     set dir [pwd]
  43.     append index "# Tcl autoload index file, version 2.0\n"
  44.     append index "# This file is generated by the \"itcl_mkindex\" command\n"
  45.     append index "# and sourced to set up indexing information for one or\n"
  46.     append index "# more commands.  Typically each line is a command that\n"
  47.     append index "# sets an element in the auto_index array, where the\n"
  48.     append index "# element name is the name of a command and the value is\n"
  49.     append index "# a script that loads the command.\n\n"
  50.     foreach file [eval glob $args] {
  51.     set f ""
  52.     set error [catch {
  53.         set f [open $file]
  54.         while {[gets $f line] >= 0} {
  55.         if [regexp {^proc[     ]+([^     ]*)} $line match procName] {
  56.             append index "set [list auto_index($procName)]"
  57.             append index " \"source \$dir/$file\"\n"
  58.         }
  59.         if [regexp {^itcl_class[     ]+([^     ]*)} $line match className] {
  60.             append index "set [list auto_index($className)]"
  61.             append index " \"source \$dir/$file\"\n"
  62.         }
  63.         }
  64.         close $f
  65.     } msg]
  66.     if $error {
  67.         set code $errorCode
  68.         set info $errorInfo
  69.         catch {close $f}
  70.         cd $oldDir
  71.         error $msg $info $code
  72.     }
  73.     }
  74.     set f [open tclIndex w]
  75.     puts $f $index nonewline
  76.     close $f
  77.     cd $oldDir
  78. }
  79.  
  80. itcl_mkindex . *.tcl
  81. exit
  82.