Objective-Everything Release 5. Copyright ©1994-1998 by TipTop Software, Inc. All Rights Reserved.
Parses arbitrary C/ObjC syntax text.
You can use this to define types, global variables, functions,
classes, protocols, and even implement methods.
Example:
tcl% cdef -out { %--> extern double sin(double); %--> %--> @protocol MyProtocol %--> - (void)aMethod; %--> @end %--> %--> @interface NSObject(Add_A_Method) %--> - (NSString*)sayHello; %--> /* ObjTcl: %--> return "$self sez hello to you" %--> */ %--> @end %--> } sin <"?"d"?"d> #@protocol MyProtocol #@category NSObject(Add_A_Method)
tcl% sin 1 0.841470984808 tcl% unparse [protocol MyProtocol] @protocol MyProtocol // Implemented by: no one
// Class methods: none
// Instance methods - (void)aMethod; @end
tcl% $NSApp sayHello @TTApplication@98df0 sez hello to you
Note: The cdef facility is not a full-fledged C compiler: C function bodies, and ObjC method bodies are not parsed.
Note: Mixing multiple-language method implementations in a single category definition is not yet fully supported.
Parses C/ObjC syntax text from file.
Example:
tcl% cinclude -cpp {} /usr/include/ansi/stdio.h tcl% set f [fopen "/tmp/test" "w"] ^{_iobuf}@0x50c248c tcl% fprintf $f "Hello World!\n" 0 tcl% fclose $f 0 tcl% exec cat /tmp/test Hello World!
Invokes obj's method selector with args.
Invokes obj's method selector in the specified class with args.
This is the most general form of the msg_send. It invokes obj's method selector in the specified class and category indicated by idx.
The idx argument has the following meaning:
msg_send_ex [$obj class] -2 $obj aMethod args...
invokes aMethod implementation two category definitions "old" (or older).
Returns 1 if value val is "non-zero", 0 otherwise. "Zero" values are [NULL], [nil], "nil", "0x0", {}, 0, etc. This command provides a convenient way to test the return value of a method invocation. E.g.:
If ivar is specified, and value is not, ivarset returns the value of object obj's instance variable ivar. If value is specified, then set the value of obj's instance variable ivar to value. In neigher ivar nor value is specified, returns a list of all instance variables.
tcl% ivarset $NSApp isa _nextResponder _currentEvent _windowList _keyWindow _mainWindow _delegate _hiddenList _hiddenCount _context _appListener _appSpeaker _unusedApp _running _appFlags _mainMenu _appIcon _nameTable _reservedApplication1 _reservedApplication2 tcl% ivarset $NSApp isa TTApplication
In addition to instance variables, Objective-Everything objects can have any number of attribute values associated with it. Attribute values are of type "id". If name is specified, and value is not specified, xvarset returns the value of object obj's attribute name. If value is specified, then set the value of obj's attribute name to value.
tcl% xvarset $NSApp tcl% xvarset $NSApp attr object <TTApplication:0x98df0> has no key "attr" tcl% xvarset $NSApp attr [NSObject object] @NSObject@ad1b0 tcl% xvarset $NSApp attr @NSObject@ad1b0 tcl% xvarset $NSApp attr
Renames class to newname. Use this with caution!
Dynamically loads specified modules. To build a module from files a.m, b.m, and c.m so that it can be loaded:
NeXT:
compile each file into .o, then:
cc -bundle -undefined suppress -o abc.so a.o b.o c.o
GNU:
compile each file:
gcc -fpic -FPIC -c a.m
...
then link:
gcc -nostdlib -nostartfiles -o abc.so a.o b.o c.o
To load abc.so:
objtcl::dyload abc.so
If objname is a valid object name, returns object the object corresponding to objname. Otherwise, an error is raised.
tcl% lookup nil nil tcl% lookup NSObject NSObject tcl% lookup 0x46f38 @NSObject@46f38 tcl% lookup [addrof NSObject] NSObject tcl% set x [NSObject object] @NSObject@46f38 tcl% lookup @NSObject@46f38 @NSObject@46f38 tcl% lookup @NSObject@1234 object 0x1234 is not registered tcl% lookup "<NSObject: 0x46f38>" @NSObject@46f38
Returns a 1-element string that corresponds to ASCII character code number. E.g., chr 65 returns A.
Returns the ASCII code number of the first character of string str. E.g., ord A returns 65.
Replacement for the default Tcl puts which prints string into the current interactor, instead of writing it to stdout. If there is no current interactor, the default Tcl puts is used.
Replacement for the default Tcl gets which modally reads a line from the current interactor, instead of reading it from stdin. If there is no current interactor, the default Tcl gets is used.
Returns: [NSString stringWithCString: str]
Converts Tcl list list to an NSMutableArray.
Convert Tcl list list to an NSMutableDictionary. List must have an even number of elements. Even elements are keys, odd elements are values.
Returns object's description as a plain Tcl string value. It obj is not an object, then * just returns its argument.
Applies "extended-conversion" to obj. NSArrays and NSDictionaries are converted to Tcl lists.
Iterates variable over the elements of obj enumerated by enumerator. In each iteration, body is executed. The default enumerator is objectEnumerator.
Loads the AppKit and ObjAppKit frameworks and returns 1 if successful.
Runs the AppKit main event loop. Loads AppKit if needed. The -nib flag can be used to specify the main nib file. The -class flag can be used to specify the application class. If command is specified, it is executed as soon as the main event loop starts running.
Asynchronously executes command. If the delay argument is specified, command is executed after delay seconds.
If bool is 1, then the Tcl debugger is activated. If -now flag is given, then the debugger is immediately invoked. If bool is 0, then the debugger is deactivated. If no arguments are given, this procedure returns 1 if the debugger is currently active, or 0 if not.
Attaches GDB to this process. This procedure tries its best to guess the full executable path of this process. This file is used by GDB to read symbols. You can explicitly specify this path.
Represents the interpreter object.
Linked C globals. See $objtcl_library/objtcl.tcl.