Hello Guest it is March 29, 2024, 01:44:15 AM

Author Topic: Is there any way to compile a .m1s script to a .m1c?  (Read 1727 times)

0 Members and 1 Guest are viewing this topic.

Is there any way to compile a .m1s script to a .m1c?
« on: December 11, 2020, 03:24:22 PM »
Thinking they would be useful, I copied the various tables from the end of the Mach3 programming manual and pasted them into machine executable .m1s script files that contain a bunch of constant declarations.  I'd prefer to avoid using 'magic numbers' in my code since I've been taught that's a no-no since, like 1980.  Even assembly language back then had good macro expansion support.

Problem is, pulling them in with #expand is absurdly slow, at least in the interpreter environment.  And RunScript loses it's context so it's useless for initialization.  So I see why that's just not done in Mach's VBScript (aka Cypress Enable).

For the short-term I've resorted to just using the scripts for reference and copy & pasting in the lines I need, but that's triggering my compulsive-programmer disorder, I like my the code I write to be 'perfect' (as possible anyway).

So long story short, is there any way of compiling .m1s script text files into binary .m1c files as referred to in a few places in the manuals?  This should eliminate the text file copying & parsing that's going on while reaping the benefits of getting clear, consistent & readable definitions layed out, thus improving code without the overhead.  Is it possible?

Apologies in advance, I'm new here and just starting to get up to speed.  I'd be happy to share the constant definition files if anyone is interested.  Ideally someone would throw them up on GitHub & better document & maintain them.

... hmm...  Alternatively, there appear multiple ways to escape the execution environment, even mention of com interfaces, but is there any provision (API) for integrating an app running externally to for example, read & write internals in Mach3?  Otherwise that seems pretty futile without some serious hacking.

Or I guess I could hack together my own pre-processor, even handle #expand & remove the unnecessary fluff, but that seems overkill unless it became a community project useful to many.

My hopes aren't high here, but I thought it's worth asking since I'm so new to this programming environment.  Am I just missing something obvious?  I'm kinda legendary for that...
« Last Edit: December 11, 2020, 03:32:55 PM by machiavellian »
Think twice before you G0 -Z...

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: Is there any way to compile a .m1s script to a .m1c?
« Reply #1 on: December 12, 2020, 01:25:08 AM »
just open your maro in VB script Editor

->file-> save as
-> choose -> Compiled code as filetype
-> done
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Is there any way to compile a .m1s script to a .m1c?
« Reply #2 on: December 12, 2020, 08:04:32 PM »
Oh gosh, so obvious.

Thanks TPS, that's a big help.

Think twice before you G0 -Z...