Page 1 of 1

"Procedure too long" error message

Posted: Thu Nov 24, 2011 11:27 pm
by sanjaybioe
Dear Ted,

Further to your advice, I tried out a different way of making a template but am ending up in an error. From the model with accession number 101629 by Migliore, I took the geometry/morphology file alone(geo-cell1zr.hoc), and tried to create a template by adding appropriate lines of code, renaming it as Geometry.hoc. The whole code as of now is:

//changed axon and soma

load_file ("nrngui.hoc")

begintemplate CA3new

public soma, axon, dendrite, apical_dendrite

{create soma[1.]}
{create axon[1]}
{create dendrite[52.]}
{create apical_dendrite[81.]}

proc init(){

{access soma[0.]}

{soma[0] connect axon[0](0), 1}
{access axon[0]}

{soma[0.] connect apical_dendrite[0.](0), 1}
{access apical_dendrite[0.]}
//morphology continues here//

{dendrite[49.] connect dendrite[51.](0), 1}
{access dendrite[51.]}


endtemplate CA3new


nCA3bnew = 2

objectvar CA3bnew[nCA3bnew]

for i = 0, nCA3bnew-1 {
CA3bnew = new CA3new()

access CA3bnew[0].soma

I wrote another hoc file named Mainfile.hoc with the following statements:


Both of them are put in a single folder. When I run the main file, it gives me an error message :

NEURON -- VERSION 7.2 (524+:1a4443872b11+) 2011-06-14
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2008

nrniv: procedure too big
in Geometry.hoc near line 458
xopen("Geometry.hoc" )

Why does this happen? Without the proc init () being put, if I look the shape plot I just see a set of short lines alone stacked in space. There doesn't seem to be any other syntax error, though there were quite a few ones which I corrected myself.

I have a basic question as well. When the xterm shows the error, is it exactly at the point where the arrow points or could it be anywhere in the said line.Now itself when I post this query the arrow pointing under 69.5 gets shifted to the leftend below the opening brace.

In a very long code how can we easily identify the line where the error is notified, say, line 506 in a code having 2234 lines?

Kindly help.


Re: "Procedure too long" error message

Posted: Fri Nov 25, 2011 11:16 am
by ted
Break the procedure into several smaller procedures. Parse errors usually generate messages that refer to the line where the error occurred and may even contain specific clues about the nature of the error itself. Runtime errors may not, but instead might require you to insert comments that bracket suspicous code in order to track down the cause.

In this particular case, the fix is to break the long procedure into two or more shorter procedures. "How long should each be?" I'd suggest a "binary strategy"--

Code: Select all

  cut the long procedure(s) in half, more or less
  try the revised program
until the error message disappears