Changeset 2080 for trunk/lang
- Timestamp:
- Feb 2, 2011, 4:51:29 PM (14 years ago)
- Location:
- trunk/lang/tcl/scripts
- Files:
-
- 13 added
- 2 edited
- 30 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/lang/tcl/scripts/Makefile.in
r2061 r2080 41 41 $(srcdir)/exec.tcl \ 42 42 $(srcdir)/library.tcl \ 43 $(srcdir)/objects.tcl \ 44 $(srcdir)/objects/base.rp \ 43 45 $(srcdir)/result.tcl \ 44 46 $(srcdir)/units.tcl 45 47 48 OBJECTS = \ 49 boolean \ 50 choice \ 51 curve \ 52 group \ 53 histogram \ 54 integer \ 55 note \ 56 number \ 57 phase \ 58 string 59 60 TYPEFILES = \ 61 $(srcdir)/types/boolean.tcl \ 62 $(srcdir)/types/color.tcl \ 63 $(srcdir)/types/file.tcl \ 64 $(srcdir)/types/string.tcl \ 65 $(srcdir)/types/units.tcl 66 67 VALIDATEFILES = \ 68 $(srcdir)/validations/enable.tcl \ 69 $(srcdir)/validations/int.tcl \ 70 $(srcdir)/validations/number.tcl \ 71 $(srcdir)/validations/size.tcl 72 46 73 all: tclIndex 47 74 48 tclIndex: $(FILES)75 tclIndex: install-objects install-types install-validations $(FILES) 49 76 $(TCLSH) $(srcdir)/../tclconfig/mkindex.tcl --srcdir $(srcdir) \ 50 77 --outfile tclIndex … … 57 84 $(INSTALL) -m 0444 tclIndex $(destdir) 58 85 86 install-objects: 87 $(MKDIR_P) -m 0755 $(destdir)/objects 88 for i in $(OBJECTS); do \ 89 echo "Installing object definition: $$i" ; \ 90 $(MKDIR_P) -m 0755 $(destdir)/objects/$$i ; \ 91 for j in $(srcdir)/objects/$$i/*; do \ 92 $(INSTALL) -m 0444 $$j $(destdir)/objects/$$i ; \ 93 done 94 done 95 96 install-types: $(TYPEFILES) 97 $(MKDIR_P) -m 0755 $(destdir)/types 98 @for i in $(TYPEFILES); do \ 99 echo "Installing $$i" ; \ 100 $(INSTALL) -m 555 $$i $(destdir)/types ; \ 101 done 102 103 install-validations: $(VALIDATEFILES) 104 $(MKDIR_P) -m 0755 $(destdir)/validations 105 @for i in $(VALIDATEFILES); do \ 106 echo "Installing $$i" ; \ 107 $(INSTALL) -m 555 $$i $(destdir)/validations ; \ 108 done 109 59 110 clean: 60 111 $(RM) tclIndex -
trunk/lang/tcl/scripts/library.tcl
r2079 r2080 16 16 namespace eval Rappture { 17 17 variable stdlib "" 18 } 19 20 # automatically load all Rappture object types 21 if {[catch {Rappture::objects::init} err]} { 22 puts stderr "Error loading object definitions:\n$err" 23 exit 1 18 24 } 19 25 -
trunk/lang/tcl/scripts/objects.tcl
r2076 r2080 17 17 # ====================================================================== 18 18 # AUTHOR: Michael McLennan, Purdue University 19 # Copyright (c) 2004-201 0Purdue Research Foundation19 # Copyright (c) 2004-2011 Purdue Research Foundation 20 20 # 21 21 # See the file "license.terms" for information on usage and … … 26 26 namespace eval Rappture { # forward declaration } 27 27 namespace eval Rappture::objects { 28 # location of system object info 29 variable installdir [file dirname [file normalize [info script]]] 30 28 31 # 29 32 # Set up a safe interpreter for loading object defn files... … … 61 64 # this variable will hold the name of the object file being parsed 62 65 variable currFile "" 66 } 67 68 # ---------------------------------------------------------------------- 69 # USAGE: Rappture::objects::init 70 # 71 # Called at the beginning of a Rappture program to initialize the 72 # object system. Loads all object definitions in the "objects" 73 # directory found at the system location. Object types can be 74 # queried by calling Rappture::objects::get. 75 # ---------------------------------------------------------------------- 76 proc Rappture::objects::init {} { 77 variable installdir 78 79 # load supporting type definitions 80 foreach fname [glob [file join $installdir types *.tcl]] { 81 source $fname 82 } 83 84 # load supporting validation procs 85 foreach fname [glob [file join $installdir validations *.tcl]] { 86 source $fname 87 } 88 89 # load the base class 90 Rappture::objects::load [file join $installdir objects base.rp] 91 92 # load any other classes found 93 foreach dir [glob -nocomplain -types d [file join $installdir objects *]] { 94 Rappture::objects::load [file join $dir *.rp] 95 } 63 96 } 64 97
Note: See TracChangeset
for help on using the changeset viewer.