home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / tcl / 1070 < prev    next >
Encoding:
Text File  |  1992-07-29  |  2.1 KB  |  44 lines

  1. Newsgroups: comp.lang.tcl
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!wupost!tulane!cpu.com!cpu.com!GWLESTER
  3. From: gwlester@cpu.com (Gerald W. Lester)
  4. Subject: Re: How do I imbed tcl in an application
  5. Nntp-Posting-Host: merlin.cpu.com
  6. References: <1992Jul27.175107.7633@rchland.ibm.com> <ADRIANHO.92Jul27175403@barkley.berkeley.edu> <1992Jul28.113922.19882@cas.org>,<156g6sINNnp2@agate.berkeley.edu>
  7. Sender: usenet@cpu.com (Usenet administrator)
  8. Organization: Computerized Processes Unlimited, Metairie, LA, (504)-889-2784
  9. Date: Wed, 29 Jul 1992 22:25:57 GMT
  10. Message-ID: <1992Jul29.222557.7305@cpu.com>
  11. Reply-To: gwlester@cpu.com
  12. Lines: 30
  13.  
  14. In article <156g6sINNnp2@agate.berkeley.edu>, ouster@sprite.Berkeley.EDU (John Ousterhout) writes:
  15. >...
  16. >Second, Larry Virden asked about the extension at the level of sub-commands:
  17. >
  18. >    Something that I have been wondering about along these lines is based on
  19. >    John's two initial papers.  They described the tcl/tk environment in 
  20. >    such a way that it seemed that a user would be able to write their own
  21. >    extended sub-options for tcl commands and then the application would
  22. >    read these extentions / parameters , etc and allow the user customizations.
  23. >    
  24. >    Did I get the wrong idea?  Is there a way for me to add new commands to
  25. >    a tcl/tk application automatically, or does each application need to add
  26. >    code to handle this possibility?  If so, where does that fit into the
  27. >    previously described skeleton that you folks are talking about?
  28. >
  29. >You can add commands, but you can't add subcommands to existing commands.
  30. >For example, if you wanted to add a "remove" option to the string command,
  31. >so that you could say "string remove <string> <letter>" to remove all
  32. >instances of <letter> from <string>, you'd have to modify the C code that
  33. >implements "string".
  34.  
  35. John,
  36.  
  37.     You could also rename string to something else (eg string_org) than add
  38. a proc called string that sees if the "command" is an extended command (like
  39. "remove" in your example above), if so it would process it, otherwise it would
  40. do an uplevel on "string_orig $args".  I know it is "cheating", but it works.
  41.  
  42. gwl
  43.  
  44.