# Straight from the source: NEURON’s incredible backwards compatibility

NEURON is a neural simulator, but it’s not just another neural network application. NEURON has been around much longer than your fancy deep learning software. It was first released in 1994, although some of it’s early code and concepts seem to stem from the 70’s and 80’s. In fact, NEURON is not a machine learning library at all. It simulates real neurons. It uses real morphologies and ion channel densities to reproduce experiments. Some labs even use machine learning algorithms to fit the parameters of their NEURON models. NEURON is one of the workhorses of the computational branch of the Human Brain Project and the core engine in the Blue Brain Project.

But the age of NEURON is starting to show in its source code. Because some things are a bit awkward when working with this simulator1 I decided to peek at its sources. Just to see what this old engine looks like on the inside. And it turned out to be an interesting journey. Deep inside NEURON’s plotting library, I found this:

#if VT125
case VT:
vtplot(mode, x, y);
break;
#endif

Now, I didn’t know what VT125 was when I first saw this, but a quick search on the web reminded me that I’m still a young software developer. I present to you, the VT100:

Now that’s what I call backwards compatibility!

Some of you may want to lecture me about how modern terminals actually emulate VT100s and that this code might be in there to allow some fancy plotting inside xterm or its siblings. But I would argue that there are other parts of this code that give away its impressive attempt at supporting older platforms. Such as the rest of the above switch statement:

		switch (graphdev)
{
case SSUN:
#if SUNCORE
hoc_sunplot(&amp;amp;amp;amp;text, mode, x, y);
break;
#else
#if NRNOC_X11
hoc_x11plot(mode,x,y);
break;
#else
#if NeXTstep
break;
case NX:
hoc_NeXTplot(mode,x,y);
break;
#endif
#endif
#endif
#if TEK
case SEL:
case TEK4014:
tplot(mode, x, y);
break;
#endif
#if VT125
case VT:
vtplot(mode, x, y);
break;
#endif
}
#endif


Now, we all love nested preprocessor if-statements inside switch blocks, but let’s look aside from that and at what’s supported here.

There’s the NRNOC_X11, which I believe introduces the only part of this block that might actually be executed nowadays. In addition we have SUNCORE, which might be Solaris, but I’d bet this supports something that existed long before Oracle acquired Sun back in 2010. There’s TEK, which may refer to something like the Tektronix 4010:

And then there’s NeXTstep, which Apple acquired in 1997 and used to replace its own Mac OS with Mac OS X. Considering that NeXTstep made its last official release in 1995, I think its fair to say that this piece of code was written in the previous century. It could, of course, just be that no one has deared to search-replace NeXTstep with OS X, but I doubt it.

I should finish this with a final caveat: It could be that this code isn’t at all in use by NEURON anymore. After all, I found all of the above in the plot.c file in the src/oc folder of NEURON’s source code. The above could be remainders of NEURON’s interpreter language, hoc, which was originally made as a demonstration of how to use the parser generator Yacc in the The Unix Programming Environment book. As far as I know, NEURON is the only software out there that’s still using hoc, but that’s a story for another day.

Image Credits: Wikipedia User:ClickRick, Wikipedia User:Rees11.

### Svenn-Arne Dragly

I'm a physicist and programmer, writing about the stuff I figure out as I go.

## One thought on “Straight from the source: NEURON’s incredible backwards compatibility”

1. You might be able to get it to render in xterm using the TEK4014 emulation built in. 🙂

Launch an xterm, use ctrl+button3 (middle) to get the option to show the TEK window, find your current tty (use the ‘tty’ command… it’ll say ‘ttys2’ or similar), then choose “switch to TEK mode” … then from another terminal do something like…

\$ cat neuron-output.tek > /dev/ttys2

It’ll probably work 🙂