@MAINFILE preprocessor command
@MAINFILE preprocessor command
Hi
i propose the use of @MAINFILEin preprocessor command
the idea is to have @MAINFILE "main.hws" in all includes expect main, so compiler will know what to compile
this is usefull in case you use many includes and while playing around you want to test run (F5),
extremelly usefull in hollywood ide and/or alternatives ones
i propose the use of @MAINFILEin preprocessor command
the idea is to have @MAINFILE "main.hws" in all includes expect main, so compiler will know what to compile
this is usefull in case you use many includes and while playing around you want to test run (F5),
extremelly usefull in hollywood ide and/or alternatives ones
Christos
Re: @MAINFILE preprocessor command
You've got a similar mechanism in my Hollywood extension for Visual Studio Code: viewtopic.php?f=13&t=2424
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
-
- Posts: 475
- Joined: Fri May 15, 2015 5:15 pm
- Location: Waterville, Minnesota USA
Re: @MAINFILE preprocessor command
As a workaround, you can pass in a string constant into your Hollywood script (compiled or through the interpreter) to prepend onto the path of your includes. This allows you to put all of your includes in one directory and callers into another. To make a string constant from the command prompt, you have to use double square brackets, I think.
I'm on registered MorphOS using FlowStudio.
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: @MAINFILE preprocessor command
Don't understand this proposal... please elaborate
Re: @MAINFILE preprocessor command
if you have
mainfile.hws
file1.hws
file2.hws
Compiling ANY of the above files (pressing F5 in IDE) will correct compile and print Hello
mainfile.hws
Code: Select all
@INCLUDE "file1.hws"
@INCLUDE "file2.hws"
Print("hello")
file1.hws
Code: Select all
@MAINFILE "mainfile.hws"
a =1
Code: Select all
@MAINFILE "mainfile.hws"
b=1
Christos
Re: @MAINFILE preprocessor command
Not sure, but I guess your problem would be solved by using simply #INCLUDE for the mainfile.hws?
For I think when you include some file, it will also include all the includes the included file includes.
But Andreas can probably confirm this one since I am not sure.
Also, not doing exactly what you are after, but you might find Allanons Appbuilder useful, at least I personally have found it extremely useful in some cases, it can save you a load of time and hassle: viewtopic.php?f=7&t=1097
For I think when you include some file, it will also include all the includes the included file includes.
But Andreas can probably confirm this one since I am not sure.
Also, not doing exactly what you are after, but you might find Allanons Appbuilder useful, at least I personally have found it extremely useful in some cases, it can save you a load of time and hassle: viewtopic.php?f=7&t=1097
Re: @MAINFILE preprocessor command
nop since
a) will end in endless loop of including mainfile, mainfile will include file1, file1 will include again mainfile etc
b) the possibility of INCLUDEONCE (this is another idea ) will be better but will not follow include order
as using includeonce will have diffirend order of including file dependeing on which file you are compiling
a) will end in endless loop of including mainfile, mainfile will include file1, file1 will include again mainfile etc
b) the possibility of INCLUDEONCE (this is another idea ) will be better but will not follow include order
as using includeonce will have diffirend order of including file dependeing on which file you are compiling
Christos
Re: @MAINFILE preprocessor command
The problem of plouf's example I see is that if you add such a @mainfile tag you would limit that specific file to be in included just in this one main files. Sou you couldn't use a (helper) file in other projects (or you would have more than one version of this file). IMHO not so convinient. I think it would be better to have a project/workspace management (like my extentension for VS Code has ).
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: @MAINFILE preprocessor command
Yes, definitely. I understand plouf's proposal now but this is tricky to implement because obviously the main file has to be parsed first but if there was something like @MAINFILE, the parser would have to stop parsing the current file and then restart parsing in the main file etc. Sounds like a lot of work for little gain so it's probably not worth the hassle. Maybe just use an IDE that has project/workspace management like Clydos' extension for VS CodeClyde wrote: ↑Sun May 10, 2020 11:09 am The problem of plouf's example I see is that if you add such a @mainfile tag you would limit that specific file to be in included just in this one main files. Sou you couldn't use a (helper) file in other projects (or you would have more than one version of this file). IMHO not so convinient. I think it would be better to have a project/workspace management (like my extentension for VS Code has ).
Re: @MAINFILE preprocessor command
why cant a "Helper" file is not possible in my case ?
and need no more "mainfiles"
the @MAINFILE is for compiler and compiler ONLY management
that if compiler , compiles file1.hws and finds @MAINFILE (prefererable as the first line)
1) it will stop-abort compile everythink
2) start again compiling main.hws
3) ignore from now on every time it finds (again) @MAINFILE
this is possible to use big projects and when you only do changes in file1.hws open-execute-compile (F5)
in addition it WILL help using alternative editors since editor will usually pass
current source file, and you are going to have a project management
(project management is GOOD, but my idea is NOT preventing or creates the need of a extra single line of code to alter its behaviour)
and need no more "mainfiles"
the @MAINFILE is for compiler and compiler ONLY management
that if compiler , compiles file1.hws and finds @MAINFILE (prefererable as the first line)
1) it will stop-abort compile everythink
2) start again compiling main.hws
3) ignore from now on every time it finds (again) @MAINFILE
this is possible to use big projects and when you only do changes in file1.hws open-execute-compile (F5)
in addition it WILL help using alternative editors since editor will usually pass
current source file, and you are going to have a project management
(project management is GOOD, but my idea is NOT preventing or creates the need of a extra single line of code to alter its behaviour)
Christos