|
|||
|
Line 1 of my program is: #!/usr/bin/rexx --
Sourceline(1) returns: --/usr/bin/rexx -- I can see that changing the "#!" to "--" makes life easier for the interpreter, but shouldn't sourceline(1) return the first line of the code? My problem is that the program lists out all of the comments in the first block of comments (i.e. from the first line starting with "--" up to, but not including the next following line which does not start with "--", and that value for line 1 is complicating my code. In truth, I'm left with no way of knowing if line 1 really is a comment, or a shebang line. -- Steve Swift http://www.swiftys.org.uk/swifty.html http://www.ringers.org.uk |
|
|
||||
|
||||
|
|
|
|||
|
On Tuesday, July 17, 2012 3:42:44 AM UTC-5, Swifty wrote:
> Line 1 of my program is: #!/usr/bin/rexx -- > > Sourceline(1) returns: --/usr/bin/rexx -- > > I can see that changing the "#!" to "--" makes life easier for the > interpreter, but shouldn't sourceline(1) return the first line of the > code? > > My problem is that the program lists out all of the comments in the > first block of comments (i.e. from the first line starting with "--" > up to, but not including the next following line which does not start > with "--", and that value for line 1 is complicating my code. > > In truth, I'm left with no way of knowing if line 1 really is a > comment, or a shebang line. > > -- > Steve Swift > http://www.swiftys.org.uk/swifty.html > http://www.ringers.org.uk I just looked at the Regina PDF doc. It says that a Unix shell program would execute the program specified in the shebang line (also called a magic number) and pass the remainder of the lines in the file to this program via stdin. This implies that Regina wouldn't see the shebang line. The implication (from above) is that the shebang line isn't part of the program. On my Windows systems, Regina and R4 considers the shebang line as part of the program, but ignores it for execution, and furthermore, SOURCELINE(1) is the shebang line. This further implies that some REXXes (at least Regina and R4) are treatinga shebang line inconsistantly under different operating systems. __________________________________________________ _________ Gerard Schildberger |
|
|||
|
On 7/17/2012 3:59 PM, Gerard_Schildberger wrote:
> On Tuesday, July 17, 2012 3:42:44 AM UTC-5, Swifty wrote: >> Line 1 of my program is: #!/usr/bin/rexx -- >> >> Sourceline(1) returns: --/usr/bin/rexx -- >> >> I can see that changing the "#!" to "--" makes life easier for the >> interpreter, but shouldn't sourceline(1) return the first line of the >> code? >> >> My problem is that the program lists out all of the comments in the >> first block of comments (i.e. from the first line starting with "--" >> up to, but not including the next following line which does not start >> with "--", and that value for line 1 is complicating my code. >> >> In truth, I'm left with no way of knowing if line 1 really is a >> comment, or a shebang line. >> >> -- >> Steve Swift >> http://www.swiftys.org.uk/swifty.html >> http://www.ringers.org.uk > > I just looked at the Regina PDF doc. It says that a Unix shell program would execute the program specified in the shebang line (also called a magic number) and pass the remainder of the lines in the file to this program via stdin. This implies that Regina wouldn't see the shebang line. > > The implication (from above) is that the shebang line isn't part of the program. On my Windows systems, Regina and R4 considers the shebang line as part of the program, but ignores it for execution, and furthermore, SOURCELINE(1) is the shebang line. > > This further implies that some REXXes (at least Regina and R4) are treating a shebang line inconsistantly under different operating systems. > __________________________________________________ _________ Gerard Schildberger > > If Regina doesn't get to see the shebang line under Unix, then it isn't "treating it differently". People who use an OS that is designed around a 32 baud teletype as the input/output device have to live with the consequences. :-) Steve: You shot yourself in the foot by using a non-standard (neither ANSI or TRL2) commenting technique. -- Les (Change Arabic to Roman to email me) |
|
|||
|
LesK <5mre20@tampabay.rr.com> wrote:
>On 7/17/2012 3:59 PM, Gerard_Schildberger wrote: >> On Tuesday, July 17, 2012 3:42:44 AM UTC-5, Swifty wrote: >>> Line 1 of my program is: #!/usr/bin/rexx -- >>> >>> Sourceline(1) returns: --/usr/bin/rexx -- [snip] > Steve: You shot yourself in the foot by using a non-standard (neither ANSI > or TRL2) commenting technique. I thought what he meant was that the first line in his file contains: #!/usr/bin/rexx -- and that the interpreter had replaced the first two characters "#!" with "--" as a simple way of making that line legal but ineffective. Does he mean something else, do you think? -- Jeremy C B Nicoll - my opinions are my own. Email sent to my from-address will be deleted. Instead, please reply to newsreplyaaa@wingsandbeaks.org.uk replacing "aaa" by "284". |
|
|||
|
On Wed, 18 Jul 2012 02:48:40 -0400, LesK <5mre20@tampabay.rr.com>
wrote: >Steve: You shot yourself in the foot by using a non-standard (neither >ANSI or TRL2) commenting technique. Ah, but my foot recovered, and was afterwards much improved, as it was freed from worrying about nesting comments inside comments. :--) -- Steve Swift http://www.swiftys.org.uk/swifty.html http://www.ringers.org.uk |
|
|||
|
On Wed, 18 Jul 2012 14:00:49 +0100, Jeremy Nicoll - news posts
<jn.nntp.scrap007@wingsandbeaks.org.uk> wrote: >Does he >mean something else, do you think? Well, *I* don't think that he means something else. I can't be 100% sure though. Nothing is, these days. See http://www.swiftys.org.uk/wiz?618 (the page built by a REXX CGI script) -- Steve Swift http://www.swiftys.org.uk/swifty.html http://www.ringers.org.uk |
|
|||
|
On Wednesday, July 18, 2012 1:48:40 AM UTC-5, LesK wrote:
> On 7/17/2012 3:59 PM, Gerard_Schildberger wrote: > > On Tuesday, July 17, 2012 3:42:44 AM UTC-5, Swifty wrote: > >> Line 1 of my program is: #!/usr/bin/rexx -- > >> > >> Sourceline(1) returns: --/usr/bin/rexx -- > >> > >> I can see that changing the &quot;#!&quot; to &quot;--&quot; makes life easier for the > >> interpreter, but shouldn&#39;t sourceline(1) return the first line of the > >> code? > >> > >> My problem is that the program lists out all of the comments in the > >> first block of comments (i.e. from the first line starting with &quot;--&quot; > >> up to, but not including the next following line which does not start > >> with &quot;--&quot;, and that value for line 1 is complicating my code. > >> > >> In truth, I&#39;m left with no way of knowing if line 1 really is a > >> comment, or a shebang line. > >> > >> -- > >> Steve Swift > >> http://www.swiftys.org.uk/swifty.html > >> http://www.ringers.org.uk > > > > I just looked at the Regina PDF doc. It says that a Unix shell program would execute the > > program specified in the shebang line (also called a magic number) and > pass the remainder of > > the lines in the file to this program via stdin. This implies that > Regina wouldn't see the > > shebang line. > > > > The implication (from above) is that the shebang line isn't partof the program. On my > > Windows systems, Regina and R4 considers the shebang line as part of > the program, but > > ignores it for execution, and furthermore, SOURCELINE(1) is the > shebang line. > > > > This further implies that some REXXes (at least Regina and R4) are treating a shebang line > > inconsistantly under different operating systems. > > __________________________________________________ _________ Gerard Schildberger > > > > > If Regina doesn't get to see the shebang line under Unix, then it isn't > "treating it differently". > > People who use an OS that is designed around a 32 baud teletype as the > input/output device have to live with the consequences. :-) > > Steve: You shot yourself in the foot by using a non-standard (neither > ANSI or TRL2) commenting technique. > > -- > > Les (Change Arabic to Roman to email me) If Regina doesn't see the shebang line, it doesn't treat it at all, let alone deferently. If it DOES see it, then it apparently recognizes it as partof the REXX program (it thinks it's line #1), but ignores it (as if it were a comment). As for the shebang being changed into a "-- comment": (apparently using open object REXX)" I think you may have missed the point. The shebang line was changed by something, not the person who wrote the code. Note that SOURCELINE(1) returnsa line of text that isn't the original line of text. Note that I said text, not a REXX statement, as the shebang is not part of the REXX source program. It's not the first line of the REXX program [but which SOURCELINE(1) apparently thinks it is]. __________________________________________________ _______ Gerard Schildberger |
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|