Page 1 of 1

local strdef?

Posted: Thu Mar 09, 2006 6:17 pm
by jaambros
Is there a chance to have a local strdef, e.g, localstr ?

local variables (local and localobj) are great when writing templates.
However strings are only global and can get in the way in a complex template.

"local strdef" workaround: String class + localobj

Posted: Thu Mar 09, 2006 6:43 pm
by ted
The standard run system
/usr/local/nrn/share/nrn/lib/hoc/stdlib.hoc
or
c:\nrn\lib\hoc\stdlib.hoc
contains a lot of useful stuff, including the definition of a String class.
The latter is just a wrapper for a strdef--see

Code: Select all

begintemplate String
 . . .
endtemplate String
in stdlib.hoc for particulars. That plus localobj lets you work around the
absence of a localstr. If you prefer not to use the standard run system,
just steal the String class definition and use it with your own code.