I need a function to deserialize the contents of an MX source file for reading. We can’t simply use Get because I don’t want to load or run the code, but rather to read whatever in the file? Is there such a function in existence, if not how could we write this UnscrambleSourceMXFile[], if this is even possible?
Asked
Active
Viewed 159 times
2
user5601
- 3,573
- 2
- 24
- 56
LockedandReadProtectedthere’s absolutely no way. On the other hand, if you know what symbols are declared in the MX file you can useGeneralUtilities`PrintDefinitionsLocalto see the definitions of those. – b3m2a1 Dec 13 '19 at 17:32Exporta plain expression to MX, it will first be assigned to special internal symbol, then this symbol isDumpSaved.ImportwillGetthe file, then check the definition of that symbol. – Szabolcs Dec 13 '19 at 21:00.mfile,Compressor sending through MathLink. All those encode a plain expression. If that expression is evaluated, that can in turn create definitions. I think MX is the opposite: it just saves the kernel state associated with some symbols. – Szabolcs Dec 13 '19 at 21:02