Skip to content

nmodl translator version for VERBATIM blocks #1696

Description

@nrnhines

The NMODL translator version (presently "7.7.0") is not convenient for conditionals in VERBATIM blocks.

The version is not exposed to mod files for use in conditionals.

The https://senselab.med.yale.edu/ModelDB/showmodel?model=82894 nrntraub model does not compile with the prospective NEURON 8.1 release because the ri.mod file in a VERBATIM block refers to _NrnThread. This name became invalid with #1609.

The NMODL translator version was last updated with #177 (from "7.5.0")

The version definition is specified in nrn/src/nmodl/nocpout.cpp with

/*
nrnversion is a string that is passed via the _mechanism structure
as the first arg. It will be interpreted within neuron to determine if
that version is compatible with this version.
For now try to use something of the form d.d
If this is changed then also change nrnoc/init.c
*/
char* nmodl_version_ = "7.7.0";

In mod2c

nrn/external/coreneuron/external/mod2c/src/mod2c_core/nocpout.c:char* nmodl_version_ = "6.2.0";

In the new NMODL I see

nrn/external/coreneuron/external/nmodl/src/codegen/codegen_naming.hpp:static constexpr char NMODL_VERSION[] = "6.2.0";

On first thought, it seems reasonable to switch to an integer version scheme that is consistent for nocmodl, mod2c, nmodl. But ...
The use of the version string in nrn/src/nrnoc/init.cpp is currently:

/* change this to correspond to the ../nmodl/nocpout nmodl_version_ string*/
static char nmodl_version_[] =
        "7.7.0";

and

        /* as of 5.2 nmodl translates so that the version string
           is the first string in m. This allows the neuron application
           to determine if nmodl c files are compatible with this version
           Note that internal mechanisms have a version of "0" and are
           by nature consistent.
        */

/*printf("%s %s\n", m[0], m[1]);*/
        if (strcmp(m[0], "0") == 0) { /* valid by nature */
        }else if (m[0][0] > '9') { /* must be 5.1 or before */
Fprintf(stderr, "Mechanism %s needs to be re-translated.\n\
It's pre version 6.0 \"c\" code is incompatible with this neuron version.\n", m$
                if (nrn_load_dll_recover_error()) {
                        hoc_execerror("Mechanism needs to be retranslated:", m[$
                }else{
                        nrn_exit(1);
                }
        }else if (strcmp(m[0], nmodl_version_) != 0){
Fprintf(stderr, "Mechanism %s needs to be re-translated.\n\
It's version %s \"c\" code is incompatible with this neuron version.\n",
m[1], m[0]);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions