Page 1 of 1

Printf statments

Posted: Wed Feb 15, 2012 7:59 pm
by Krishna Chaitanya
Hi Ted,

Is it not possible to use printf statements inside BREAKPOINT and FUNCTION blocks defined inside mod file?. It becomes very difficult to debug if these statements cannot be used. Is there any other way to do this? Thank you.

Re: Printf statments

Posted: Thu Feb 16, 2012 9:39 am
by ted
printf statements can indeed be very useful for debugging NMODL source code. The syntax is identical to that used by C. Variable names should be as they are known inside the NMODL source code (no suffix or dot notation). For example

Code: Select all

NEURON {
  POINT_PROCESS PRtest
  RANGE index
}
ASSIGNED {
  v (mV)
}
PARAMETER {
  index = 0
}
BREAKPOINT {
  printf("BREAKPOINT\t index %d\t, t %g,\t v %g\n", index, t, v)
}
AFTER BREAKPOINT {
  printf("AFTER BREAKPOINT\t index %d\t, t %g,\t v %g\n", index, t, v)
}