Page 1 of 1

Compiling using .pnml files

Posted: 06 May 2018 13:52
by FulliAutomatix
So I've got to the point where I'm using a 1500 line .nml file, and I've found no useful explanation to get gcc.exe working to compile from multiple .pnml files.
Since I've been working on RUKTS with Gwyd for the past few months, he's always had to compile, even when testing, as I have no working method for compiling with .pnml files, nor have found any.
He's tried to give gcc.exe to me but I can't get it to work at all.

Could someone please give me a run down on how to compile with .pnml files please?

Re: Compiling using .pnml files

Posted: 06 May 2018 17:44
by Erato

Re: Compiling using .pnml files

Posted: 06 May 2018 22:43
by rowdog
My primary use of the pre-processor part of gcc is to combine partial source files together into one big file that I then pass to nmlc to compile.

Suppose I have a top level project file that only exists to collect the parts together. I then "include" the other files to substitute their content.

Code: Select all

#include "src_a.pnml"
#include "src_b.pnml"

Code: Select all

gcc -E project.pnml > project.nml
will combine the files in the specified order and redirect the output into the project.nml

A more advanced use is to #define strings and/or macros that can be substituted throughout your sources.

It's not all that difficult to roll your own makefile and project source structures but, in the long run, you'll be better off starting with the fully developed make-nml project that Erato recommended.

Re: Compiling using .pnml files

Posted: 07 May 2018 16:04
by FulliAutomatix
rowdog wrote:

Code: Select all

gcc -E project.pnml > project.nml
will combine the files in the specified order and redirect the output into the project.nml

It's not all that difficult to roll your own makefile and project source structures but, in the long run, you'll be better off starting with the fully developed make-nml project that Erato recommended.
I've tried gcc, but it always throws an error "Failed: Create process" or something.
And I've looked into makefile, but it's from Ubuntu and any method I've tried to get it to work on Windows 10 have failed for many reasons

Re: Compiling using .pnml files

Posted: 07 May 2018 16:42
by andythenorth
How about a Windows batch file? :twisted:

Re: Compiling using .pnml files

Posted: 09 May 2018 14:46
by FulliAutomatix
andythenorth wrote:How about a Windows batch file? :twisted:
Umm, I suppose. But I have no idea how to do that.
It doesn't matter now, I've made my own python program for it

Re: Compiling using .pnml files

Posted: 09 May 2018 15:44
by Transportman
Just curious, how did you try setting up your environment? Did you use this guide, or something else?

Re: Compiling using .pnml files

Posted: 09 May 2018 16:31
by FulliAutomatix
Transportman wrote:Just curious, how did you try setting up your environment? Did you use this guide, or something else?
Something else. Thanks btw, but I think I'll stick with my simple python program. I'll be giving that to the community at some point in the future because I think I've made it robust enough

Re: Compiling using .pnml files

Posted: 09 May 2018 19:53
by andythenorth
FulliAutomatix wrote:It doesn't matter now, I've made my own python program for it
That's a good solution. I was trolling a bit with the batch file suggestion.

I'm guessing you've made something that concatenates files in python :) . IMHO it's a much better solution than the C Pre-Processor route.

You can also use python to template the nml ;) viewtopic.php?f=68&t=58390