home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.tcl
- Path: sparky!uunet!newsgate.watson.ibm.com!yktnews!admin!ghostwind!shmdgljd
- From: shmdgljd@rchland.vnet.ibm.com (Jay Schmidgall)
- Subject: Re: How do I imbed tcl in an application
- Sender: news@rchland.ibm.com
- Message-ID: <1992Jul28.114518.12123@rchland.ibm.com>
- Date: Tue, 28 Jul 1992 11:45:18 GMT
- Reply-To: jay@vnet.ibm.com
- Disclaimer: This posting represents the poster's views, not necessarily those of IBM
- References: <1992Jul27.175107.7633@rchland.ibm.com> <ADRIANHO.92Jul27175403@barkley.berkeley.edu>
- Nntp-Posting-Host: ghostwind.rchland.ibm.com
- Organization: IBM Rochester, MN
- Lines: 45
-
- In article <ADRIANHO.92Jul27175403@barkley.berkeley.edu>, adrianho@barkley.berkeley.edu (Adrian J Ho) writes:
- |> A pretty good example is in the Tcl distribution itself: tclTest.c is
- |> a simple Tcl command-shell.
-
- Thanks to Adrian and the off-line responses. The consensus seems to be look
- at how tclTest works, which I am in the process of doing.
-
- Question 2: (long winded, sorry)
-
- How do I provide access to structures more complex than just strings?
-
- For example, I've got a structure
-
- typedef struct {
- char *name;
- int rank;
- int ssn;
- } Soldier;
-
- Soldier grunt;
-
- Now, is there any way I can pass ``grunt'' to a tcl proc and have it be
- able to access grunt.name or grunt.rank ?
-
- I was thinking that I would do this by adding a new command, say soldier,
- which would be like
-
- soldier name x : returns x.name
- soldier rank x : returns x.rank
- soldier ssn x : returns x.ssn
-
- But I'm still left with the problem of x being a Soldier, rather than a
- string. For that matter, how would I initialize x.name?
-
- Hmmm. I guess what I'm wondering is sort of how other people have made
- the association between a string and the more complex data structure of
- which that string is just the name? a pointer to it, somehow? ??
-
- I hope this makes sense.
-
- (In the meantime, I'll look at tk as well to see how the man did it for
- windows, etc.)
- --
- : jay jay@vnet.ibm.com My opinions and ideas, not my employer's.
- : shmdgljd@rchland.vnet.ibm.com (c) Copyright 1992. All rights reserved.
-