The semantic version number for the current definition of Inter bytecode.

§1. We can expect the details of the Inter language to change. Such changes could easily render text or binary files of Inter code useless; so we will want to use semantic versioning to compare the language as we understand it (the "current version") with the language as it was understood by whoever wrote the Inter file we are loading (the "file version").

If we consider the version as having the traditional form major.minor.patch, the major version should change on any of the following:

This may result in ungainly, high major version numbers: so be it. However, the following need only mean a bump of the minor version —

The patch version number should always remain 0 — this is not a version for the implementation of anything, just for the specification itself, so in some sense it cannot be bug-fixed, only changed.

Modifiers of the + and - sort are also best avoided here, so we will deal only with SVNs in the traditional x.y.z format.

§2. 1.0.0 (28 April 2022) was the baseline Inter implementation used in the beta of Inform 10.1.0.

2.0.0 (24 May 2022) introduced a new base type constructor for "activity on T". This renumbers the binary representation of types, so it is a major not minor bump.

3.0.0 (9 October 2022) added a new optional field to SPLAT_IST instructions, which holds I6 annotations in the sense of Inform evolution proposal IE-0006. Note that these are not Inter annotations, which apply to symbols: these apply to directives.

4.0.0 (7 January 2023) added new type constructor codes to make it possible to represent new data structures with custom kind constructors from Neptune files in Inform kits.

§3. Anyway, the implementation, such as it is:

semantic_version_number InterVersion::current(void) {
    semantic_version_number V = VersionNumbers::from_text(I"4.0.0");
    if (VersionNumbers::is_null(V)) internal_error("malformed version number");
    return V;
}

int InterVersion::check_readable(semantic_version_number file_version) {
    return VersionNumberRanges::in_range(
        InterVersion::current(),
        VersionNumberRanges::compatibility_range(file_version));
}

§4. When Inter is stored in binary format, the version number is stored in three consecutive unsigned integers in the file header: see Inter in Binary Files.

void InterVersion::to_three_words(unsigned int *w1, unsigned int *w2, unsigned int *w3) {
    semantic_version_number V = InterVersion::current();
    *w1 = (unsigned int) V.version_numbers[0];
    *w2 = (unsigned int) V.version_numbers[1];
    *w3 = (unsigned int) V.version_numbers[2];
}

semantic_version_number InterVersion::from_three_words(unsigned int w1, unsigned int w2,
    unsigned int w3) {
    TEMPORARY_TEXT(textual)
    WRITE_TO(textual, "%d.%d.%d", w1, w2, w3);
    semantic_version_number V = VersionNumbers::from_text(textual);
    DISCARD_TEXT(textual)
    return V;
}