home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!usenet.ins.cwru.edu!agate!usenet
- From: izumi@pinoko.berkeley.edu (Izumi Ohzawa)
- Newsgroups: comp.sys.next.programmer
- Subject: Re: Pointers to functions in method definitions
- Date: 6 Jan 1993 09:49:24 GMT
- Organization: University of California, Berkeley
- Lines: 32
- Distribution: world
- Message-ID: <1ie9v4INNhvl@agate.berkeley.edu>
- References: <6164@rosie.NeXT.COM>
- Reply-To: izumi@pinoko.berkeley.edu
- NNTP-Posting-Host: moica.berkeley.edu
-
- In article <6164@rosie.NeXT.COM> sam_s@NeXT.com (Sam Streeper) writes:
- >alastair@hecate.phy.queensu.ca (A.B. McLean) writes:
- >> I want to write a method that will accept a pointer to a C function.
- >
- >I would guess that this isn't directly possible; it looks like the Objective-C
- >runtime doesn't have the ability to encode data of type function pointer.
-
- In NextDeveloper/Examples/AppKit/Graph/Expression.h, there is an example
- that uses typedefs. It may not cover all situations, but at least
- the code can remain comprehensible if you can use it.
-
-
- /* function supplied by term implementor for evaluation */
- typedef float EXPTermEvalFunc(int numArgs, float *args);
-
- .....
-
- - addFuncTerm:(const char *)name minArgs:(int)min maxArgs:(int)max
- evalFunc:(EXPTermEvalFunc *)func;
- /*
- * Adds a function to the set of functions this Expression can parse.
- * Functions look like "name(arg1, arg2,...)" in the text that is
- * parsed. At evaluation time the C function func() will be called with
- * the values of the arguments. ....
- */
-
-
- --
- Izumi Ohzawa [ $@Bg_78^=;(J ]
- USMail: University of California, 360 Minor Hall, Berkeley, CA 94720
- Telephone: (510) 642-6440 Fax: (510) 642-3323
- Internet: izumi@pinoko.berkeley.edu (NeXT Mail OK)
-