Page 1 of 1

Error on Include if <<< in line-comment

Posted: 25 Apr 2015 17:18
by PeterH
A very strange one!!! :shock:

A script file starts with several full-line-comments //
These comments are followed by 1 or more Include statements.
Next is a caption "Test" for the start of the only non-hidden script, then commands.

If one of the comments includes the heredoc identifier <<< the Include stmt(s) is/are interpreted as if they were Script-Captions, and on Load of the scriptfile a selection panel is shown. Delete the <<< (or shorten to <<) and everything is fine.

Code: Select all

// 
// abc <<< def
// Include Functions for Debug (Very Beginning or Very End!)
Include DecHexBin.inc
// =====================================================================================================================
//
"Test"
 step;
(You don't need the include file: the problem occurs before including it. For positive test create an empty file.)
(Boah - some hours! I looked at everything - but who thinks of commented text :evil: )

Re: Error on Include if <<< in line-comment

Posted: 26 Apr 2015 10:18
by admin
Ah, very good. You discovered a basic design flaw. Fix comes.

Re: Error on Include if <<< in line-comment

Posted: 26 Apr 2015 10:36
by PeterH
I said it's a very strange one, and you say it's basic :lol:
Glad to help :biggrin:

But I love to help making scripting better :whistle:
(Though this was a bad one, be it strange or basic.)

Re: Error on Include if <<< in line-comment

Posted: 26 Apr 2015 10:54
by admin
I meant basic in the sense of fundamental. Which translates in several hours of work, but it's worth it. :)

Along the way you will get nested include statements. :beer:

Re: Error on Include if <<< in line-comment

Posted: 26 Apr 2015 11:25
by PeterH
This comparison of out-of-correlation-words just was a joke with unrelated words. :P

The basic meaning of that post was:
Thanks for your answer, and for your reply! :appl:

By the way: my "distance" from using (OK: testing) Stacked Includes was just 1mm 8)
- so I will wait a bit longer.

I hope there is a bit of optimization? E.g. if 2 different included functions each include a third one, this isn't included (i.e.loaded) multiple?

Re: Error on Include if <<< in line-comment

Posted: 26 Apr 2015 12:08
by admin
PeterH wrote:I hope there is a bit of optimization? E.g. if 2 different included functions each include a third one, this isn't included (i.e.loaded) multiple?
Including one file again can be meaningful if the script or something else modifies the file in between.

Therefore I'd rather leave that to a specific statement a later version: include_once
see also: http://php.net/manual/en/function.include-once.php

Re: Error on Include if <<< in line-comment

Posted: 26 Apr 2015 13:22
by PeterH
I understand a part of this, but in other situations...

If I include a file with some stmts *into code*, this must be present wherever it's included, i.e. multiple.

If an include is located outside a script, and as such defines scripts and/or functions, it would define these multiple if multiple included.

So if
- a scriptfile defines "Main", and it includes a.inc, b.inc and z.inc
- a.inc defines Function a(), and it includes z.inc,
- b.inc defines Function b(), and includes z.inc
- z.inc defines Function z()
=> function z() would "exist" 3 times. Does this make sense?

And as the includes are handled during preprocessing (are they?) there's little chance that z.inc can be modified in between.

So in the moment I don't understand what you say :?:

Re: Error on Include if <<< in line-comment

Posted: 26 Apr 2015 13:27
by admin
PeterH wrote:And as the includes are handled during preprocessing (are they?) there's little chance that z.inc can be modified in between.
Hm, that's a good point. I was on the wrong track there.

Anyway, at some point I will add include_once. For now I need no further complications since the glorious 15.10 wants to get published! :beer:

Re: Error on Include if <<< in line-comment

Posted: 27 Apr 2015 22:39
by PeterH
At least I finally managed to test the // <<< Problem: it's gone, as you said :appl: :appl: :appl: