home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / smalltal / 2597 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  2.2 KB

  1. Path: sparky!uunet!mcsun!Germany.EU.net!ernohb!ernohb.UUCP!token
  2. From: token@ernohb.UUCP (thomas kendelbacher)
  3. Newsgroups: comp.lang.smalltalk
  4. Subject: Re: command line arguments
  5. Message-ID: <2087@ernohb.UUCP>
  6. Date: 21 Dec 92 11:54:42 GMT
  7. References: <667@funsys.funsys.se> <1992Dec18.213909.18271@sol.ctr.columbia.edu>
  8. Sender: news@ernohb.UUCP
  9. Organization: Erno Raumfahrttechnik GmbH, Bremen, Germany
  10. Lines: 43
  11. Nntp-Posting-Host: csf_9
  12.  
  13. In article <1992Dec18.213909.18271@sol.ctr.columbia.edu>, mchan@deacon (Samuel R. McHan) writes:
  14. |> Jan Gifvars (jgs@funsys.se) wrote:
  15. |> : Is it possible to retreive command line arguments in my smalltalk image ?
  16. |> : For example : 
  17. |> : 
  18. |> : $ st80 myImage.im textFile.doc
  19. |> : 
  20. |> : I just want to parse the commandline.
  21. |> : 
  22. |> : [...]
  23. |> : 
  24. |> 
  25. |> In the past, I've used a program which would take the command line
  26. |> arguments, stuff them into a file, and then start my image.  The image
  27. |> would then look for the existance of the file and copy the contents from
  28. |> it.  A kludge, I know, but I didn't know how to read the command line
  29. |> any other way.  Ideas?
  30.  
  31. Just another kludge: Use a programming language other than C (but with
  32. access to C routines), where the "main" procedure is not identified
  33. by the symbol "_main". Link it with the "st80.o" provided for VMs
  34. with user defined primitives (this, since it is written in C, **does**
  35. provide an entry point "_main" -- look into the symbol table.)
  36.  
  37. Use the main program body to analyse the command line arguments,
  38. store them so that Smalltalk will later be able to access them via
  39. User Defined Primitives (which you must provide, too, of course),
  40. then call the Smalltalk VM by calling the C function "main" with
  41. call parameters appropriate for the Smalltalk VM.
  42.  
  43. I once tried this on a Sun-3 with Ada, and it worked just fine.
  44. Smalltalk was Objectworks V2.5 (sorry, no newer experience).
  45.  
  46. One caveat: If using Ada, avoid tasks, since the Smalltalk VM and
  47. the Ada runtime system will compete for some UNIX signals
  48. (e.g. SIGALRM, maybe others, too). Should be a lesser problem
  49. with languages with a less "embracing" runtime system.
  50.  
  51. Have fun.
  52. Thomas Kendelbacher  |  email : tkendel@ernohb.uucp
  53. Robbenplate 13       |  voice : +49 421 539 5492
  54. D-2800 Bremen 66     |     or : +49 421 57 04 37
  55. Germany
  56.