home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / rexx / 967 < prev    next >
Encoding:
Internet Message Format  |  1992-09-09  |  2.0 KB

  1. Path: sparky!uunet!mcsun!uknet!comlab.ox.ac.uk!imc
  2. From: imc@comlab.ox.ac.uk (Ian Collier)
  3. Newsgroups: comp.lang.rexx
  4. Subject: Re: Reading inline "code" as input?
  5. Keywords: inline, sourceline
  6. Message-ID: <2417.imc@uk.ac.ox.prg>
  7. Date: 9 Sep 92 14:08:27 GMT
  8. References: <1992Sep8.163642.16833@midway.uchicago.edu> <275@zam103.zam.kfa-juelich.de>
  9. Organization: Oxford University Computing Laboratory, UK
  10. Lines: 40
  11. X-Local-Date: Wednesday, 9th September 1992 at 3:08pm BST
  12. Originator: imc@msc11.comlab
  13.  
  14. In article <275@zam103.zam.kfa-juelich.de>, kiehl@ibt013.ibt.kfa-juelich.de (Horst Kiehl) wrote:
  15. >In article <1992Sep8.163642.16833@midway.uchicago.edu>,
  16. >sip1@ellis.uchicago.edu (Timothy F. Sipples) writes:
  17.  
  18. >>Is there any way a REXX program can take data input from itself
  19. >>(without resorting to QUEUE or PUSH)?
  20.  
  21. >So you could insert the XXEncoded stuff in a comment in the middle
  22. >of the program, [...]
  23. >and locate the line containing ' XX:' by a loop using SOURCELINE.
  24.  
  25. Two points:
  26.  (a) You don't necessarily need to locate the XX: - use something like this:
  27.  
  28.         print_data: signal data_end  /*
  29.         A line of data
  30.         Another line of data
  31.         ...
  32.         The last line of data
  33.         */
  34.         data_end: do i = sigl to sourceline()
  35.            data = sourceline(i)
  36.            if data == "*/" then leave
  37.            ... do whatever with data ...
  38.         end
  39.         return
  40.  
  41.      The point I'm making is that it's possible to have Rexx tell you the
  42.      line number of the data by using the special variable "sigl".  I
  43.      wouldn't consider this use of signal to be at all untidy or
  44.      unnecessary.
  45.  
  46.  (b) Someone has already mentioned that unmatched quotes and comment
  47.      delimiters in the data may cause problems.  Well if the data is all
  48.      typed in hex (or if XXencode data doesn't contain those characters
  49.      anyway), you can easily avoid that problem.  Simply use the x2c()
  50.      conversion function on each line before dealing with it.
  51.  
  52. Ian Collier
  53. Ian.Collier@prg.ox.ac.uk | imc@ecs.ox.ac.uk
  54.