Source Code Cross Referenced for ItclInt.java in  » Scripting » jacl » itcl » lang » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Scripting » jacl » itcl.lang 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * ------------------------------------------------------------------------
003:         *      PACKAGE:  [incr Tcl]
004:         *  DESCRIPTION:  Object-Oriented Extensions to Tcl
005:         *
006:         *  [incr Tcl] provides object-oriented extensions to Tcl, much as
007:         *  C++ provides object-oriented extensions to C.  It provides a means
008:         *  of encapsulating related procedures together with their shared data
009:         *  in a local namespace that is hidden from the outside world.  It
010:         *  promotes code re-use through inheritance.  More than anything else,
011:         *  it encourages better organization of Tcl applications through the
012:         *  object-oriented paradigm, leading to code that is easier to
013:         *  understand and maintain.
014:         *  
015:         * ========================================================================
016:         *  AUTHOR:  Michael J. McLennan
017:         *           Bell Labs Innovations for Lucent Technologies
018:         *           mmclennan@lucent.com
019:         *           http://www.tcltk.com/itcl
020:         *
021:         *     RCS:  $Id: ItclInt.java,v 1.3 2006/01/26 19:49:18 mdejong Exp $
022:         * ========================================================================
023:         *           Copyright (c) 1993-1998  Lucent Technologies, Inc.
024:         * ------------------------------------------------------------------------
025:         * See the file "license.itcl" for information on usage and redistribution
026:         * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
027:         */
028:
029:        package itcl.lang;
030:
031:        import tcl.lang.*;
032:
033:        import java.util.HashMap;
034:
035:        class ItclObjectInfo implements  AssocData, ItclEventuallyFreed {
036:
037:            Interp interp; // interpreter that manages this info
038:
039:            HashMap objects; // Maps Command to ItclObject
040:            // for all known objects
041:
042:            Itcl_Stack transparentFrames; // stack of call frames that should be
043:            // treated transparently.  When
044:            // Itcl_EvalMemberCode is invoked in
045:            // one of these contexts, it does an
046:            // "uplevel" to get past the transparent
047:            // frame and back to the calling context.
048:            HashMap contextFrames; // object contexts for active call frames
049:
050:            int protection; // protection level currently in effect
051:
052:            Itcl_Stack cdefnStack; // stack of class definitions currently
053:
054:            // being parsed
055:
056:            // No implementation for the assoc data delete callback.
057:            // Itcl ref counting is used to track use of a ItclObjectInfo.
058:
059:            public void disposeAssocData(Interp interp) {
060:                // No-op
061:            }
062:
063:            // Invoke via Util.ReleaseData() when refCount drops to 0.
064:
065:            public void eventuallyFreed() {
066:                Cmds.DelObjectInfo(this );
067:            }
068:        }
069:
070:        //  Representation for each [incr Tcl] class.
071:
072:        class ItclClass implements  ItclEventuallyFreed {
073:            String name; // class name
074:            String fullname; // fully qualified class name
075:            Interp interp; // interpreter that manages this info
076:            Namespace namesp; // namespace representing class scope
077:            Command accessCmd; // access command for creating instances
078:            WrappedCommand w_accessCmd; // WrappedCommand for accessCmd
079:
080:            ItclObjectInfo info; // info about all known objects
081:            Itcl_List bases; // list of base classes
082:            Itcl_List derived; // list of all derived classes
083:            HashMap heritage; // table of all base classes that provides
084:            // provides fast lookup for inheritance tests.
085:            // Maps ItclClass to the empty string.
086:            TclObject initCode; // initialization code for new objs
087:            HashMap variables; // definitions for all data members
088:            // in this class.  Look up simple string
089:            // names and get back ItclVarDefn refs
090:            HashMap functions; // definitions for all member functions
091:            // in this class.  Look up simple string
092:            // names and get back ItclMemberFunc refs
093:            int numInstanceVars; // number of instance vars in variables
094:            // table
095:            HashMap resolveVars; // all possible names for variables in
096:            // this class (e.g., x, foo::x, etc.)
097:            // Maps String to ItclVarLookup.
098:            HashMap resolveCmds; // all possible names for functions in
099:            // this class (e.g., x, foo::x, etc.)
100:            // Maps String to ItclMemberFunc.
101:            int unique; // unique number for #auto generation
102:            int flags; // maintains class status
103:
104:            // Invoke via ItclEventuallyFreed interface when
105:            // refCount for this class drops to 0
106:
107:            public void eventuallyFreed() {
108:                Class.FreeClass(this );
109:            }
110:        }
111:
112:        class ItclHierIter {
113:            ItclClass current; // current position in hierarchy
114:            Itcl_Stack stack; // stack used for traversal
115:        }
116:
117:        //  Representation for each [incr Tcl] object.
118:
119:        class ItclObject implements  ItclEventuallyFreed, VarTrace {
120:            ItclClass classDefn; // most-specific class
121:            Command accessCmd; // object access command
122:            WrappedCommand w_accessCmd; // WrappedCommand for accessCmd
123:
124:            int dataSize; // number of elements in data array
125:            Var[] data; // all object-specific data members
126:            HashMap constructed; // temp storage used during construction
127:            // Maps class name String to the empty string.
128:            HashMap destructed; // temp storage used during destruction
129:
130:            // Maps class name String to the empty string.
131:
132:            // Invoke via ItclEventuallyFreed interface when
133:            // refCount for this instance drops to 0
134:
135:            public void eventuallyFreed() {
136:                Objects.FreeObject(this );
137:            }
138:
139:            // traceProc is invoked to handle variable traces on
140:            // the "this" instance variable.
141:
142:            public void traceProc(Interp interp, String part1, String part2,
143:                    int flags) throws TclException {
144:                Objects.TraceThisVar(this , interp, part1, part2, flags);
145:            }
146:        }
147:
148:        //  Implementation for any code body in an [incr Tcl] class.
149:
150:        class ItclMemberCode implements  ItclEventuallyFreed {
151:            int flags; // flags describing implementation
152:            CompiledLocal arglist; // list of arg names and initial values
153:            int argcount; // number of args in arglist
154:            Procedure proc; // Tcl proc representation
155:            String body; // String based representation of proc "body".
156:            // Used for both a Tcl proc and one
157:            // implemented via a Java Command.
158:
159:            Command objCmd; // Java style objv Command
160:
161:            //    Object clientData;      // client data for Java implementations
162:
163:            // Invoke via ItclEventuallyFreed interface when
164:            // refCount for this instance drops to 0
165:
166:            public void eventuallyFreed() {
167:                Methods.DeleteMemberCode(this );
168:            }
169:        }
170:
171:        //  Basic representation for class members (commands/variables)
172:
173:        class ItclMember {
174:            Interp interp; // interpreter containing the class
175:            ItclClass classDefn; // class containing this member
176:            String name; // member name
177:            String fullname; // member name with "class::" qualifier
178:            int protection; // protection level
179:            int flags; // flags describing member (see below)
180:            ItclMemberCode code; // code associated with member
181:        }
182:
183:        // Constants: ITCL_IGNORE_ERRS -> ItclInt.IGNORE_ERRS
184:
185:        class ItclInt {
186:            static int IMPLEMENT_NONE = 0x001; // no implementation
187:            static int IMPLEMENT_TCL = 0x002; // Tcl implementation
188:            static int IMPLEMENT_ARGCMD = 0x004; // (argc,argv) implementation (unused)
189:            static int IMPLEMENT_OBJCMD = 0x008; // (objc,objv) implementation (unused)
190:            static int IMPLEMENT_C = 0x00c; // either of previous two (unused)
191:            static int CONSTRUCTOR = 0x010; // non-zero => is a constructor
192:            static int DESTRUCTOR = 0x020; // non-zero => is a destructor
193:            static int COMMON = 0x040; // non-zero => is a "proc"
194:            static int ARG_SPEC = 0x080; // non-zero => has an argument spec
195:            static int OLD_STYLE = 0x100; // non-zero => old-style method
196:            // (process "config" argument)
197:            // (unused)
198:            static int THIS_VAR = 0x200; // non-zero => built-in "this" variable
199:
200:            static int IGNORE_ERRS = 0x002; // useful for construction/destruction
201:            static String INTERP_DATA = "itcl_data";
202:        }
203:
204:        //  Representation of member functions in an [incr Tcl] class.
205:
206:        class ItclMemberFunc implements  ItclEventuallyFreed {
207:            ItclMember member; // basic member info
208:            Command accessCmd; // Tcl command installed for this function
209:            WrappedCommand w_accessCmd; // WrappedCommand for accessCmd
210:
211:            CompiledLocal arglist; // list of arg names and initial values
212:            int argcount; // number of args in arglist
213:
214:            // Invoke via ItclEventuallyFreed interface when
215:            // refCount for this instance drops to 0
216:
217:            public void eventuallyFreed() {
218:                Methods.DeleteMemberFunc(this );
219:            }
220:        }
221:
222:        //  Instance variables.
223:
224:        class ItclVarDefn {
225:            ItclMember member; // basic member info
226:            String init; // initial value
227:        }
228:
229:        //  Instance variable lookup entry.
230:
231:        class ItclVarLookup {
232:            ItclVarDefn vdefn; // variable definition
233:            int usage; // number of uses for this record
234:            boolean accessible; // true => accessible from class with
235:            // this lookup record in its resolveVars
236:            String leastQualName; // simplist name for this variable, with
237:            // the fewest qualifiers.  This string is
238:            // taken from the resolveVars table, so
239:            // it shouldn't be freed.
240:
241:            int index; // index into virtual table (instance data)
242:            Var common; // variable (common data)
243:        }
244:
245:        //  Representation for the context in which a body of [incr Tcl]
246:        //  code executes.  In ordinary Tcl, this is a CallFrame.  But for
247:        //  [incr Tcl] code bodies, we must be careful to set up the
248:        //  CallFrame properly, to plug in instance variables before
249:        //  executing the code body.
250:
251:        class ItclContext {
252:            ItclClass classDefn; // class definition
253:            CallFrame frame; // call frame for object context
254:
255:            //Var[] compiledLocals;     // array that holds references to compiled locals
256:
257:            ItclContext(Interp interp) {
258:                frame = ItclAccess.newCallFrame(interp);
259:            }
260:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.