flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > include once

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 18042
Location: In your JS exploiting you and your system
revolution
l_inc wrote:
revolution
Quote:
Because Linux, Unix and Windows would break the code in different ways due to case and path differences.

Provide an example. Without it it seems you are just ignoring what I say.
Code:
include 'c:\code\uberstuff.inc' ;<--- Linux can open this?    
Post 15 Dec 2015, 14:19
View user's profile Send private message Visit poster's website Reply with quote
idle



Joined: 06 Jan 2011
Posts: 407
Location: Ukraine
idle
Post 15 Dec 2015, 14:24
View user's profile Send private message Reply with quote
l_inc



Joined: 23 Oct 2009
Posts: 881
l_inc
revolution
I didn't say, one should use full paths, but your suggestion is to introduce many more limitations. Say there's a library that includes its files using relative paths (similar to win32a.inc). Some files can be included as a part of the library or individually. The relative paths would be different. How restrictive should be your rules to avoid this?

That's not mentioning that soft and hard links are possible in both Windows and Linux. Taking that into account shows that C-style inclusion duplication prevention is the only correct way. Just consider what you'd do to compile a project making use of soft links on a system that has no support for them.

_________________
Faith is a superposition of knowledge and fallacy
Post 15 Dec 2015, 14:30
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 18042
Location: In your JS exploiting you and your system
revolution
l_inc wrote:
That's not mentioning that soft and hard links are possible in both Windows and Linux. Taking that into account shows that C-style inclusion duplication prevention is the only correct way. Just consider what you'd do to compile a project making use of soft links on a system that has no support for them.
I agree. I never said this was a proper or complete solution. It is not. But if one wants to make to most of it then such self restrictions can help to make it less error prone to use.
Post 15 Dec 2015, 16:41
View user's profile Send private message Visit poster's website Reply with quote
l_inc



Joined: 23 Oct 2009
Posts: 881
l_inc
revolution
I have nothing against some rules of project organization. I'm just saying that the only reason to implement "include once" natively is the ability to unambiguously identify files, and if even this advantage is ignored, then it's just useless.

_________________
Faith is a superposition of knowledge and fallacy
Post 15 Dec 2015, 19:16
View user's profile Send private message Reply with quote
idle



Joined: 06 Jan 2011
Posts: 407
Location: Ukraine
idle
Again, once is a user-typed hint to overcome standard behaviour of fasm.
It does nothing to fasm structures, keeping inclusion order as described in official manual.
What it really does: when fasm is just about including a file, once checks for its presence and does its job.
Post 16 Dec 2015, 06:25
View user's profile Send private message Reply with quote
idle



Joined: 06 Jan 2011
Posts: 407
Location: Ukraine
idle
hi, just updated to 1.72
esp tnx to TG for keeping include logics same
Post 21 Nov 2017, 16:55
View user's profile Send private message Reply with quote
idle



Joined: 06 Jan 2011
Posts: 407
Location: Ukraine
idle
Damn!..
I'm glad to see you again!
According the topic, i solved to automate patching process.
The only condition - the Author not to change inclusion logics.
Right now it is 2/3 complete.
There it is.
And the stumble: how to analize preproce.inc guys?
Do we need to read&trim lines, or tokenize(that is heavy), extract lexems, how to mind the style (e.g. was movsb, became movs byte [etc]), or should we detect inclusion code and replace it all.
I donot know.
Tnx!
Post 23 Feb 2021, 18:38
View user's profile Send private message Reply with quote
idle



Joined: 06 Jan 2011
Posts: 407
Location: Ukraine
idle
Post 24 Feb 2021, 23:30
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4251
Location: Now
edfed
include once useless now.

test_it.asm:
Code:
include 'file_to_include_once.inc'
include 'file_that_includes_the_file_to_include_once.inc'
call something_from_this_once_file
call something_from_the_second_file
    


file_to_include_once.inc:
Code:
if ~ definite FileToIncludeOnceStillIncluded
...
end if
FileToIncludeOnceStillIncluded=0
    

file_that_includes_the_file_to_include_once.inc:
Code:
include 'file_that_includes_the_file_to_include_once.inc'
call something_from_the_once_file
    


definite keyword is a new feature and i like it.
Post 28 Feb 2021, 19:21
View user's profile Send private message Visit poster's website Reply with quote
idle



Joined: 06 Jan 2011
Posts: 407
Location: Ukraine
idle
I gues defined (i must admit i have not coded since 2017) )


Glad to meet you, edfed, again.
Post 28 Feb 2021, 19:41
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4251
Location: Now
edfed
that's not defined, i've tested to make include guards with this statement but it don't works at all cause it doesn't care if defined before or after, it tests the entire source before to return a result.

with definite, you can make the distinction between before and after definitions.

glad to come back here too... finally i've got time and projects to code with fasm again.
Post 28 Feb 2021, 21:37
View user's profile Send private message Visit poster's website Reply with quote
idle



Joined: 06 Jan 2011
Posts: 407
Location: Ukraine
idle
Updated.
I hope it helps/serves/useful.


Description:
Filesize: 44.93 KB
Viewed: 878 Time(s)

We won the lottery.png


Post 23 Mar 2021, 21:33
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.