I am trying to read the contents of a user-specified file into a 3D table. I understand I can do this in HOC through Vectors and Lists, but that seems like it might be slow. (I need to reference various locations in this table quite frequently after it is built).
I am therefore trying to write NMODL code that stores the 3D array and has a function to get appropriate values. I see how I can create some 3D array (or 1D with fast offset calculations) in NMODL, but I do not see where I can code a FUNCTION/PROCEDURE to accept a string that will serve as the file to read. Allowable parameters seem to be doubles. Is that true? (I'm also wanting to label instances of my object and have a "name" field).
With one approach, I can place my function (with char* parameter) entirely in a VERBATIM statement, which will compile, but hoc does not see the function. If I pursue this route, I need to know how to properly install the method so that it is available in hoc. (I guess something following Lytton's "install_vector_method").
Using the FUNCTION/PROCEDURE approach, the parameter has to be a double. Is there a way to cast the string from HOC, properly to a double pointer?
Thanks
Installing new function OR Passing string as argument
Re: Installing new function OR Passing string as argument
I'd use either Python or, in hoc,I am trying to read the contents of a user-specified file into a 3D table.
Code: Select all
double x[a][b][c]
nrn/src/ivoc/oc2iv.h and nrn/src/nrniv/nrnoc2iv.h give useful lists. In particular, the one you want
to read a string arg is
Code: Select all
extern char* gargstr(int);
Re: Installing new function OR Passing string as argument
Thanks Michael.