This repository was archived by the owner on Aug 31, 2021. It is now read-only.
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: libscript/src/script-builder.cpp +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -148,8 +148,8 @@ bool MCScriptEndModule(MCScriptModuleBuilderRef self, MCStreamRef p_stream) |
148 | 148 | byte_t t_header[4]; |
149 | 149 | t_header[0] = 'L'; |
150 | 150 | t_header[1] = 'C'; |
151 | | - t_header[2] = 0; |
152 | | - t_header[3] = 0; |
| 151 | + t_header[2] = ((kMCScriptCurrentModuleVersion & 0xFF) >> 0); |
| 152 | + t_header[3] = ((kMCScriptCurrentModuleVersion & 0xFF) >> 8); |
153 | 153 |
|
154 | 154 | t_success = MCStreamWrite(p_stream, t_header, 4) && |
155 | 155 | MCScriptWriteRawModule(p_stream, &self -> module); |
|
Collapse file
Copy file name to clipboardExpand all lines: libscript/src/script-module.cpp +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -427,8 +427,8 @@ bool MCScriptCreateModuleFromStream(MCStreamRef stream, MCScriptModuleRef& r_mod |
427 | 427 |
|
428 | 428 | if (t_header[0] != 'L' || |
429 | 429 | t_header[1] != 'C' || |
430 | | - t_header[2] != 0x00 || |
431 | | - t_header[3] != 0x00) |
| 430 | + t_header[2] != (kMCScriptCurrentModuleVersion & 0xFF) || |
| 431 | + t_header[3] != ((kMCScriptCurrentModuleVersion >> 8) & 0xFF)) |
432 | 432 | return false; |
433 | 433 |
|
434 | 434 | MCScriptModule *t_module; |
|
Collapse file
Copy file name to clipboardExpand all lines: libscript/src/script-private.h +12Lines changed: 12 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -565,6 +565,18 @@ bool MCScriptBytecodeIterate(byte_t*& x_bytecode, byte_t *p_bytecode_limit, MCSc |
565 | 565 | // byte version[1] |
566 | 566 | // <pickle of module struct> |
567 | 567 |
|
| 568 | +// The module version will be incremented for every public release of the libscript |
| 569 | +// which occurs in which the module binary format changes. |
| 570 | +// |
| 571 | +// We will only aim to support module formats which have been released as final and |
| 572 | +// stable. |
| 573 | +// |
| 574 | +// The following constants keep track of, and should be updated to reflect the meaning |
| 575 | +// of each module version. |
| 576 | + |
| 577 | +#define kMCScriptModuleVersion_8_0_0_DP_1 0 |
| 578 | +#define kMCScriptCurrentModuleVersion kMCScriptModuleVersion_8_0_0_DP_1 |
| 579 | + |
568 | 580 | //////////////////////////////////////////////////////////////////////////////// |
569 | 581 |
|
570 | 582 | #endif |