Error on Include if <<< in line-comment

Things you’d like to miss in the future...
Forum rules
You might want to read this if you're looking for priority service

:info: Please Include The Following Information
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).

:info: Use Your Profile Or Signature
We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.

:info: How To Attach Images
When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".
Post Reply
PeterH
Posts: 2830
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Error on Include if <<< in line-comment

Post 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: )

admin
Site Admin
Posts: 67271
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

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

Post by admin »

Ah, very good. You discovered a basic design flaw. Fix comes.

PeterH
Posts: 2830
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

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

Post 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.)

admin
Site Admin
Posts: 67271
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

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

Post 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:

PeterH
Posts: 2830
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

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

Post 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?

admin
Site Admin
Posts: 67271
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

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

Post 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

PeterH
Posts: 2830
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

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

Post 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 :?:

admin
Site Admin
Posts: 67271
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

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

Post 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:

PeterH
Posts: 2830
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

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

Post by PeterH »

At least I finally managed to test the // <<< Problem: it's gone, as you said :appl: :appl: :appl:

Post Reply