Hello Guest it is April 16, 2024, 05:49:44 PM

Author Topic: Scripter Compile Error bites again :(  (Read 15604 times)

0 Members and 1 Guest are viewing this topic.

Re: Scripter Compile Error bites again :(
« Reply #60 on: March 14, 2018, 05:24:02 PM »
Hi,
yeah precompiled macros are a definite way forward...can Mach3 do that, or rather can VB do that?

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Scripter Compile Error bites again :(
« Reply #61 on: March 14, 2018, 05:29:25 PM »
Seems so, just save them from the editor as .mcc instead of .m1s
Re: Scripter Compile Error bites again :(
« Reply #62 on: March 14, 2018, 06:21:39 PM »
Hi,
makes me scratch my head...if its compiled then all other scripts would have to be compiled and
be linked for it to be ready to run. That does not seem to be the case.

I would guess that if indeed the script is compiled it will be object code and still needs to be linked before it can run.

It occurs to me that 'compiled' means that only half the job is done and the remaining half (linking) which by necessity has to
be done at runtime would still be subject to random errors.

Given VB's essential 'interpreted' DNA I am unsure that precompiling will be sufficent to overcome your problem.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline rcaffin

*
  •  1,054 1,054
    • View Profile
Re: Scripter Compile Error bites again :(
« Reply #63 on: March 14, 2018, 06:50:40 PM »
What this so-called pre-compiling MAY do is prevent Mach3 or the VB interpreter from rewriting the file back to disk incorrectly after it has used it. The .mcc suffix might even be just a flag telling Mach3 not to write out to disk. Given how often the XML file can get corrupted, this could be a good idea ...

Cheers
Roger

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Scripter Compile Error bites again :(
« Reply #64 on: March 15, 2018, 03:23:03 AM »
The wonders of Mach3 :)

Once the file is saved as .mcc it is filled with gobbledygook and can not be edited with Notepad etc any more so there is certainly some conversion going on there.

The editors Save-As dialog box lists "Pre-compiled" as an option as well.

Interesting

Offline rcaffin

*
  •  1,054 1,054
    • View Profile
Re: Scripter Compile Error bites again :(
« Reply #65 on: March 15, 2018, 04:23:48 AM »
I learn something new every time. I had never looked at the options for the save command. Never bothered.

So I saved a 'spare' macro as a .mcc file, and then opened it with Notepad. Hum ... a lot of gibberish, then the text of the original macro in a slightly mangled manner, and some more gibberish. OK - sort of packed?

Then I tried to open that file with the VB Script Editor. I had to type in the extension as .mcc was not an option, but it loaded. Well, sort of: the 'Cypress enable' at the start appeared, but nothing else. Almost as though the Script Editor stopped loading as soon as it ran into non-ASCII characters.

At least, it seems that once the file has been pre-compiled, Mach3 is not likely to try and change it! This could have some value.

So ... why doesn't Artsoft ship most of the macros pre-compiled?
And why isn't there anything about the .mcc extension in any of the manuals I have looked in recently? Sigh.

Cheers
Roger

Re: Scripter Compile Error bites again :(
« Reply #66 on: March 15, 2018, 04:52:48 AM »
Hi,
when code is compiled it gets turned into object code, the gibberish, yet it retains a few references to the variables in the form of a table. The object code
is passed to the linker which resolves the last variable references to produce executable machine code.

A de-compile process is the secret wet dream of every hacker....its not going to happen. Likewise you can't edit it either, you'll just break it.

Any code that NFS wants for us to run but doesn't want us to have the source code is often shipped as object code only. It is mentioned in Mach4 as a method for your
own code to be published and used but without releasing the source. I can only guess that Mach3 was written and its manuals published in an earlier and less
cynical time.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Scripter Compile Error bites again :(
« Reply #67 on: March 15, 2018, 05:45:08 AM »
I learn something new every time. I had never looked at the options for the save command. Never bothered.

So I saved a 'spare' macro as a .mcc file, and then opened it with Notepad. Hum ... a lot of gibberish, then the text of the original macro in a slightly mangled manner, and some more gibberish. OK - sort of packed?

Then I tried to open that file with the VB Script Editor. I had to type in the extension as .mcc was not an option, but it loaded. Well, sort of: the 'Cypress enable' at the start appeared, but nothing else. Almost as though the Script Editor stopped loading as soon as it ran into non-ASCII characters.

At least, it seems that once the file has been pre-compiled, Mach3 is not likely to try and change it! This could have some value.

So ... why doesn't Artsoft ship most of the macros pre-compiled?
And why isn't there anything about the .mcc extension in any of the manuals I have looked in recently? Sigh.

Cheers
Roger



Yep, I did read somewhere, that once compiled you cannot edit so you MUST save a copy in a folder somewhere, you must delete the .m1s files or Mach will simply read those instead.

Offline rcaffin

*
  •  1,054 1,054
    • View Profile
Re: Scripter Compile Error bites again :(
« Reply #68 on: March 15, 2018, 06:11:20 AM »
A de-compile process is the secret wet dream of every hacker....its not going to happen.
Oh???
There are any number of Disassemblers on the market - many of them free. Must be a lot of wet hackers out there ...

Let us start with a simple macros:
'M126 write top pulley speed
TPS = param1()
MPS = param2()
setoemdro(57,TPS)   ' pulley max
setoemdro(121,MPS)   ' pulley minimum
End

What you find in the .mcc file looks like this but the first line is repeated many times before we get here:
      þÿ2         þÿ2         þÿ3         þÿ3         þÿ4         þÿ4         þÿ5         þÿ5         þÿ6         þÿ6         þÿ7         þÿ7         Z           ÿÿ         ÿÿÿÿ       p a r a m 1   ôÿ T P S   Z           ÿÿ         ÿÿÿÿ       p a r a m 2   ôÿ M P S   þÿ9         Z          ÿÿ         ÿÿÿÿ        S e t O E M D R O   ôÿ  þÿy         Z          ÿÿ         ÿÿÿÿ        S e t O E M D R O   ôÿ ð   :  ÿÿ       ;   ;  <   ;ÿÿÿÿ   =  ÿÿ       >   >  ?   >ÿÿÿÿ   <ÿÿÿÿ   @ÿÿÿÿ   A ÿÿ       B   Bÿÿÿÿ

I think I can see the source code there - slightly mangled of course, but NOT object code or binary assembler.
Takes all sorts.

Cheers
Roger



Re: Scripter Compile Error bites again :(
« Reply #69 on: March 15, 2018, 06:36:26 AM »
Hi Roger,
a disassembler or de-compiler loses references to the sources variables. Object code retains some, may all of those references but is by and large
impossible to reverse.

You or I would be wasting our time when we could be making billions if we could come up with a de-compiler/disassembler that can take executable code
and produce source code.

I suggest you try a disassembler or two and explore their limitations, I did and was shocked at how much you lose. I could not follow the disassembled
code despite me having written the source code and in assembler at that. How much worse would it be trying to de-compile C?

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'