NEURON
checkpnt.cpp
Go to the documentation of this file.
1 #include <../../nrnconf.h>
2 #if HAVE_IV // to end of file
3 
4 /*
5 
6 strategy:
7 
8 symbols
9  hoc_built_in_symlist
10  hoc_top_level_symlist
11  symlists for each template
12  object data
13 linked-function pointers
14 
15 procedures
16  symbol pointers and linked function pointers used here
17 
18 nrnoc
19  mostly data but also pointers in the dparam.
20  because of setpointer (eg, pre-synaptic potential, these can
21  be pointers to any object data or nrnoc data.
22 
23 
24 bottom line:
25  extremely important to have generic method for pointers to any
26  location of an allocated block.
27 
28 two pass:
29  allocate all blocks
30  make pointer map
31  fill pointers
32 
33 two kinds of pointers
34  ownership -- responsible for allocating the space
35  observer
36 map
37  key address size type
38 
39 This was my initial thought. The incremental implementation has
40 evolved considerably with many ad hoc aspects and false starts.
41 
42 assume usage of compatible executeable. This means the same hoc_built_in_symlist
43 for writing and reading the checkpoint. For now we save this symlist in the
44 checkpoint and on reading check to make sure it is the same as the one
45 in memory. If so I think we have prima facie evidence that the instruction
46 list is consistent. ie add() -inst_table-> int ---> int -hoc_inst[]-> add().
47 the hoc_inst[] contains the signature of an instruction that tells what
48 (if anything)is expected on the execution list.
49 All other built-in functions are accessed through their symbols.
50 In fact all symbols are transmitted via
51  sym -stable_-> int -----> int -symplist[]-> sym
52 
53 Here is the format of the checkpoint file (no leading blanks in file):
54 
55 total number of symbols
56 hoc_built-in-symlist (in recursive symbol and table format)
57 hoc_top_level_symlist (in recursive symbol and table format)
58 instructions for all FUNC/PROC symbols
59 -1
60 Objectdata (VAR with NOTUSER subtype, OBJECTVAR, STRING) and local data
61 -1
62 ivoc,nrnoc, nrniv stuff (to be implemented)
63 
64 
65 The recursive symbol and table format is
66 symtable size
67 symbolinteger type subtype
68 symbolname
69  if the symbol is of a type that itself has a symbol table then we recurse
70 
71 instructions for all ... is a -1 terminated list of
72 symbolinteger
73 size
74 instructionintegers mingled with
75  signature info consisting of symbolinteger, integer, etc
76 
77 Objectdata etc is -1 terminated list of
78 symbolinteger
79 data depending on type. eg for VAR && NOTUSER it is
80  arrayinfo
81  values for all elements in the array
82  and for OBJECTVAR it is
83  arrayinfo
84  Objectdata recursion for all elements in the array
85  objectref to the objects for all elements in the array
86 
87 */
88 
89 #ifndef MAC
90 
91 #define HAVE_XDR 0
92 
93 #include <OS/list.h>
94 #include <OS/table.h>
95 #include "oc2iv.h"
96 #include "ocfunc.h"
97 #if HAVE_XDR
98 #include <rpc/xdr.h>
99 #endif
100 #include "checkpnt.h"
101 
102 #include "redef.h"
103 #include "hoclist.h"
104 #include "parse.hpp"
105 #include "code.h"
106 #include "equation.h"
107  int hoc_readcheckpoint(char*);
108  extern int hoc_resize_toplevel(int);
109 
110 static struct HocInst {
111  Pfrv pi;
112  const char* signature;
113 } hoc_inst_[] = {
114  0, 0, //0
115  nopop, 0,
116  eval, 0,
117  add, 0,
118  hoc_sub, 0,
119  mul, 0,
120  hoc_div, 0,
121  negate, 0,
122  power, 0,
123  assign, 0,
124  bltin, "s", // requires change
125  varpush, "s", //10
126  constpush, "s",
127  pushzero, 0,
128  print, 0,
129  varread, "s",
130  prexpr, 0,
131  prstr,0,
132  gt, 0,
133  lt, 0,
134  eq, 0, //20
135  ge, 0,
136  le, 0,
137  ne, 0,
138  hoc_and, 0,
139  hoc_or, 0,
140  hoc_not, 0,
141  ifcode, "iii",
142  forcode, "iii",
143  shortfor, "ii",
144  call, "si", //30
145  arg, "i",
146  argassign, "i",
147  funcret, 0,
148  procret, 0,
149  hoc_stringarg, "i",
150  hoc_push_string, "s",
151  Break, 0,
152  Continue, 0,
153  Stop, 0,
154  assstr, 0, //40
155  hoc_evalpointer, 0,
156  hoc_newline, 0,
157  hoc_delete_symbol, "s",
158  hoc_cyclic, 0,
160  hoc_parallel_end, 0,
161  dep_make, 0,
162  eqn_name, 0,
163  eqn_init, 0,
164  eqn_lhs, 0, //50
165  eqn_rhs, 0,
166  hoc_objectvar, "s",
167  hoc_object_component, "siis",
168  hoc_object_eval, 0,
169  hoc_object_asgn, 0,
170  hoc_objvardecl, "si",
171  hoc_cmp_otype, "i",
172  hoc_newobj, "si",
174  hoc_known_type, "i", //60
175  hoc_push_string, "s",
176  hoc_objectarg, "i",
177  hoc_ob_pointer, 0,
178  connectsection, 0,
180  connectpointer, "s",
181  add_section, "si",
182  range_const, "s",
183  range_interpolate, "s",
184  range_interpolate_single, "s", //70
185  rangevareval, "s",
186  rangepoint, "s",
187  sec_access, "s",
188  ob_sec_access, 0,
189  mech_access, "s",
190  for_segment, "ii",
191  sec_access_push, "s",
192  sec_access_pop, 0,
193  forall_section, "ii",
194  hoc_ifsec, "ii", //80
195  hoc_ifseclist, "ii",
196  forall_sectionlist, "ii",
198  nrn_cppp, 0,
199  rangevarevalpointer, "s",
201  mech_uninsert, "s",
202  hoc_arayinstal, "i",
203  0, 0
204 };
205 
206 #define VPfri void*
207 declareTable(InstTable, VPfri, short)
208 implementTable(InstTable, VPfri, short)
209 static InstTable* inst_table_;
210 
211 declareTable(Symbols, Symbol*, int)
212 implementTable(Symbols, Symbol*, int)
213 
214 declareTable(Objects, Object*, int)
215 implementTable(Objects, Object*, int)
216 
217 class PortablePointer {
218 public:
219  PortablePointer();
220  PortablePointer(void* address, int type, unsigned long size = 1);
221  virtual ~PortablePointer();
222  void set(void* address, int type, unsigned long size = 1);
223  void size(unsigned long s) { size_ = s;}
224  unsigned long size() { return size_;}
225  void* address() { return address_;}
226  int type() { return type_;}
227 private:
228  void* address_;
229  int type_;
230  unsigned long size_;
231 };
232 
233 PortablePointer::PortablePointer() {
234  address_ = NULL;
235  type_ = 0;
236  size_ = 0;
237 }
238 PortablePointer::PortablePointer(void* address, int type, unsigned long s) {
239  set(address, type, s);
240 }
241 void PortablePointer::set(void* address, int type, unsigned long s) {
242  address_ = address;
243  type_ = type;
244  size_ = s;
245 }
246 PortablePointer::~PortablePointer() {
247 }
248 
249 declareList(PPList,PortablePointer)
250 implementList(PPList,PortablePointer)
251 
252 class OcCheckpoint {
253 public:
254  OcCheckpoint();
255  virtual ~OcCheckpoint();
256 
257  bool write(const char*);
258 private:
259  friend class Checkpoint;
260  bool pass1();
261  bool pass2();
262  bool make_sym_table();
263  bool build_map();
264  PortablePointer* find(void*);
265 
266  bool func(Symbol*);
267 
268  bool sym_count(Symbol*);
269  bool sym_table_install(Symbol*);
270  bool sym_out(Symbol*);
271  bool sym_instructions(Symbol*);
272  bool sym_values(Symbol*);
273  bool objects(Symbol*);
274 
275  bool symlist(Symlist*);
276  bool symbol(Symbol*);
277  bool proc(Proc*);
278  bool instlist(unsigned long, Inst*);
279  bool datum(Datum*);
280  bool ctemplate(Symbol*);
281  bool object();
282  bool objectdata(Objectdata*);
283  long arrayinfo(Symbol* s, Objectdata*);
284  bool xdr(int&);
285  bool xdr(long&);
286  bool xdr(char*&, int);
287  bool xdr(short&);
288  bool xdr(unsigned int&);
289  bool xdr(unsigned long&);
290  bool xdr(double&);
291  bool xdr(Object*&);
292 private:
293  int cnt_;
294  int nobj_;
295  Objects* otable_;
296  PPList* ppl_;
297  bool (OcCheckpoint::* func_)(Symbol*);
298  Symbols* stable_;
299 #if HAVE_XDR
300  XDR xdrs_;
301 #endif
302  Objectdata* objectdata_;
303 };
304 
305 class OcReadChkPnt {
306 public:
307  OcReadChkPnt();
308  virtual ~OcReadChkPnt();
309 
310  bool read();
311 private:
312  friend class Checkpoint;
313  bool symbols();
314  bool symtable();
315  bool symbol();
316  bool instructions();
317  bool objects();
318  bool objectdata();
319 
320  long arrayinfo(Symbol* s, Objectdata*);
321 
322  bool get(int&);
323  bool get(long&);
324  bool get(char*&);
325  bool get(double&);
326  bool get(Object*&);
327 private:
328  bool lookup_;
329  int builtin_size_;
330  int lineno_;
331  int id_;
332  int nsym_;
333  Symbol** psym_;
334  long nobj_;
335  Object** pobj_;
336  Symlist* symtable_;
337 };
338 
339 static bool out_;
340 static FILE* f_;
341 static OcCheckpoint* cp_;
342 static OcReadChkPnt* rdckpt_;
343 static Checkpoint* ckpt_;
344 
346  if (!ckpt_) {
347  ckpt_ = new Checkpoint();
348  }
349  return ckpt_;
350 }
351 
353 }
355 }
356 bool Checkpoint::out() {
357  return out_;
358 }
359 bool Checkpoint::xdr(long& i) {
360  if (out()) {
361  return cp_->xdr(i);
362  }else{
363  return rdckpt_->get(i);
364  }
365 }
366 bool Checkpoint::xdr(Object*& o) {
367  if (out()) {
368  return cp_->xdr(o);
369  }else{
370  return rdckpt_->get(o);
371  }
372 }
373 
374 
375 #else
376 void hoc_checkpoint();
377 int hoc_readcheckpoint(char*);
378 void hoc_ret();
379 void hoc_pushx(double);
380 
381 
382 
383 #endif //from top of file
384 
385 void hoc_checkpoint() {
386 #ifndef MAC
387  if (! cp_) {
388  cp_ = new OcCheckpoint();
389  }
390  bool b;
391  b = cp_->write(gargstr(1));
392  hoc_ret();
393  hoc_pushx(double(b));
394 #else
395 hoc_ret();
396 hoc_pushx(0.);
397 #endif
398 }
399 
400 int hoc_readcheckpoint(char* fname) {
401 #ifndef MAC
402  f_ = fopen(fname, "r");
403  if (!f_) {
404  return 0;
405  }
406  char buf[256];
407  if (fgets(buf, 256, f_) == 0) {
408  printf("checkpoint read from file %s failed.\n", fname);
409  return 2;
410  }
411  if (strcmp(buf, "NEURON Checkpoint\n") != 0) {
412  fclose(f_);
413  return 0;
414  }
415  rdckpt_ = new OcReadChkPnt();
416  bool b;
417  b = rdckpt_->read();
418  int rval = 1;
419  if (!b) {
420  printf("checkpoint read from file %s failed.\n", fname);
421  rval = 2;
422  }
423  delete rdckpt_;
424  rdckpt_ = NULL;
425  return rval;
426 #else
427 return 0;
428 #endif
429 }
430 
431 #ifndef MAC
432 OcCheckpoint::OcCheckpoint() {
433  ppl_ = NULL;
434  func_ = NULL;
435  stable_ = NULL;
436  otable_ = NULL;
437  if (!inst_table_) {
438  short i;
439  for(i=1; hoc_inst_[i].pi; ++i) {
440  ;
441  }
442  inst_table_ = new InstTable(2*i);
443  for (i = 1; hoc_inst_[i].pi; ++i) {
444  inst_table_->insert((VPfri)hoc_inst_[i].pi, i);
445  }
446  }
447 }
448 
449 OcCheckpoint::~OcCheckpoint() {
450  if (ppl_) {
451  delete ppl_;
452  }
453  if (stable_) {
454  delete stable_;
455  }
456  if (otable_) {
457  delete otable_;
458  }
459 }
460 
461 #if HAVE_XDR
462 #define USEXDR 1
463 #else
464 #define USEXDR 0
465 #endif
466 
467 #undef DEBUG
468 
469 #if USEXDR
470 #define DEBUG if(0) fprintf
471 #else
472 #define DEBUG fprintf
473 #endif
474 
475 bool OcCheckpoint::write(const char* fname) {
476  bool b;
477  int i;
478  out_ = 1;
479  f_ = fopen(fname, "w");
480  if (!f_) {
481  return false;
482  }
483  fprintf(f_, "NEURON Checkpoint\n");
484 #if USEXDR
485  xdrstdio_create(&xdrs_, f_, XDR_ENCODE);
486 #endif
487  b = make_sym_table();
488  func_ = &OcCheckpoint::sym_out;
489  b = (b && pass1());
490  func_ = &OcCheckpoint::sym_instructions;
491  b = (b && pass1());
492  i = -1; b = (b && xdr(i));
493 
494 //printf("nobj_ = %d\n", nobj_);
495  b = b && object();
496 
497  func_ = &OcCheckpoint::sym_values;
498  objectdata_ = hoc_top_level_data;
499  int size = hoc_resize_toplevel(0);
500  b = b && xdr(size);
501  i = 0; b = b && xdr(i);
502  b = b && pass1();
503  i = -1; b = (b && xdr(i));
504 #if USEXDR
505  xdr_destroy(&xdrs_);
506 #endif
507  fclose(f_);
508  return b;
509 }
510 
511 bool OcCheckpoint::make_sym_table() {
512  bool b;
513  cnt_ = 1;
514  nobj_ = 0;
515  func_ = &OcCheckpoint::sym_count;
516  b = pass1();
517  if (!b) {
518  printf("make_sym_table failed on first pass1\n");
519  }
520  DEBUG(f_, "#symbols=%d\n", cnt_);
521  b = (b && xdr(cnt_));
522  if (stable_) {
523  delete stable_;
524  }
525  stable_ = new Symbols(2*cnt_);
526  cnt_ = 1;
527  func_ = &OcCheckpoint::sym_table_install;
528  if (!b) {
529  printf("make_sym_table failed before second pass1\n");
530  }
531  b = (b && pass1());
532  if (!b) {
533  printf("make_sym_table failed on second pass1\n");
534  }
535  func_ = NULL;
536  return b;
537 }
538 
539 bool OcCheckpoint::sym_count(Symbol* s) {
540  ++cnt_;
541  if (s->type == TEMPLATE) {
542  nobj_ += s->u.ctemplate->count;
543  }
544  return true;
545 }
546 
547 bool OcCheckpoint::sym_table_install(Symbol* s) {
548  stable_->insert(s, cnt_);
549  ++cnt_;
550  return true;
551 }
552 bool OcCheckpoint::sym_out(Symbol* s) {
553  int val;
554  stable_->find(val, s);
555  DEBUG(f_, "%d %s %d %d\n", val, s->name, s->type, s->subtype);
556  int l1 = strlen(s->name);
557  bool b = xdr(val)
558  && xdr(s->name, l1)
559  && xdr(s->type)
560  && xdr(s->subtype)
561  && xdr(s->cpublic)
562  && xdr(s->s_varn)
563  && xdr(s->defined_on_the_fly)
564  ;
565  switch (s->type) {
566  case VAR:
567  if (s->subtype == NOTUSER) {
568  b = b && xdr(s->u.oboff);
569  }
570  arrayinfo(s, NULL);
571  break;
572  case STRING:
573  case OBJECTVAR:
574  b = b && xdr(s->u.oboff);
575  arrayinfo(s, NULL);
576  break;
577  case TEMPLATE:
578  {
579  cTemplate* t = s->u.ctemplate;
580  if (!t->constructor) {
581  b = b && xdr(t->dataspace_size)
582  && xdr(t->id)
583  ;
584  }
585  break;
586  }
587  case NUMBER:
588  b = b && xdr(*s->u.pnum);
589  break;
590  case CSTRING:
591  b = b && xdr(s->u.cstr, strlen(s->u.cstr));
592  break;
593  }
594  if (!b) {
595  printf("failed in sym_table_install\n");
596  }
597  return b;
598 }
599 
600 bool OcCheckpoint::pass1() {
602 }
603 bool OcCheckpoint::pass2() {
604  return false;
605 }
606 bool OcCheckpoint::build_map() {
607  return false;
608 }
609 PortablePointer* find(void*) {
610  return NULL;
611 }
612 bool OcCheckpoint::func(Symbol* s) {
613  if (func_) {
614  return (this->*func_)(s);
615  }
616  return true;
617 }
619  if (func_ == &OcCheckpoint::sym_out) {
620  int i = 0;
621  if (sl) for (Symbol* s = sl->first; s; s = s->next) {
622  ++i;
623  }
624  DEBUG(f_, "symboltable size %d\n", i);
625  if (!xdr(i)) {
626  return false;
627  }
628 
629  }
630  if (sl) for (Symbol* s = sl->first; s; s = s->next) {
631  if (!symbol(s)) {
632 printf("symlist failed\n");
633  return false;
634  }
635  }
636  return true;
637 }
638 bool OcCheckpoint::symbol(Symbol* s) {
639  if (!func(s)) {
640  return false;
641  }
642  bool b = true;
643  switch (s->type) {
644  case TEMPLATE:
645  b = ctemplate(s);
646  break;
647  case FUNCTION:
648  case PROCEDURE:
649  b = symlist(s->u.u_proc->list);
650  break;
651  }
652 if (!b) printf("symbol failed\n");
653  return b;
654 }
655 bool OcCheckpoint::sym_instructions(Symbol* s) {
656  Proc* p = s->u.u_proc;
657  if (s->type == FUNCTION || s->type == PROCEDURE) {
658  int val;
659  if (!stable_->find(val, s)) {
660 printf("couldn't find %s in table\n", s->name);
661  return false;
662  }
663  if (p->size) {
664  DEBUG(f_, "instructions for %d |%s|\n", val, s->name);
665  DEBUG(f_, "size %lu\n", p->size);
666  bool b = xdr(val)
667  && xdr(p->size);
668  if (!b) {
669  printf("failed in sym_intructions\n");
670  return false;
671  }
672  b = instlist(p->size, p->defn.in);
673  if (!b) {
674  printf("instlist failed for %s\n", s->name);
675  }
676  return b;
677  }
678  }
679  return true;
680 }
681 bool OcCheckpoint::instlist(unsigned long size, Inst* in) {
682  for (unsigned long i = 0; i < size; ++i) {
683  short val;
684  int sval;
685  if (in[i].in == STOP) {
686  DEBUG(f_, " STOP\n");
687  val = 0;
688  if (!xdr(val)) {
689 printf("instlist failed 1\n");
690  return false;
691  }
692  continue;
693  }
694  if (inst_table_->find(val, (VPfri)in[i].pf)) {
695  DEBUG(f_, " %d\n", val);
696  if (!xdr(val)) {
697 printf("instlist failed 2\n");
698  return false;
699  }
700  const char* s = hoc_inst_[val].signature;
701  for (int j=0; s && s[j]; ++j) {
702  ++i;
703  switch (s[j]) {
704  case 's':
705  if (in[i].sym) {
706  if (!stable_->find(sval, in[i].sym)) {
707 printf("couldn't find |%s| in table at instruction index %ld\n",
708  in[i].sym->name, i);
709  return false;
710  }
711 //DEBUG(f_, " %d |%s|\n", sval, in[i].sym->name);
712  if (!xdr(sval)) {
713 printf("instlist failed 3\n");
714  return false;
715  }
716  }else{
717  DEBUG(f_, " 0 SYMBOL0\n");
718  sval = 0;
719  if (!xdr(sval)) {
720 printf("instlist failed 4\n");
721  return false;
722  }
723  }
724  break;
725  case 'i':
726  DEBUG(f_, " %i\n", in[i].i);
727  if (!xdr(in[i].i)) {
728 printf("instlist failed 5\n");
729  return false;
730  }
731  break;
732  }
733  }
734  }else{
735 printf("OcCheckpoint::instlist failed at i = %lu\n", i);
736  return false;
737  }
738  }
739  return true;
740 }
741 bool OcCheckpoint::datum(Datum*) {
742  return false;
743 }
744 bool OcCheckpoint::ctemplate(Symbol* s) {
745  cTemplate* t = s->u.ctemplate;
746  if (func_ == &OcCheckpoint::sym_values) {
747  Objectdata* saveod = objectdata_;
748  int ti;
749  bool b;
750  b = stable_->find(ti, s);
751  DEBUG(f_, "%d %d %s\n", ti, t->count, s->name);
752  b = b && xdr(ti);
753 // b = b && xdr(t->count);
754  hoc_Item* q;
755  ITERATE(q, t->olist) {
756  Object* ob = OBJ(q);
757  int oid;
758  b = b && otable_->find(oid, ob);
759  b = b && xdr(oid);
760  if (t->constructor) {
761  if (t->checkpoint) {
762  b = b && (t->checkpoint)(&ob->u.this_pointer);
763  }else{
764 printf("No checkpoint available for %s\n", hoc_object_name(ob));
765  b = false;
766  }
767  }else{
768  objectdata_ = ob->u.dataspace;
769  b = b && symlist(t->symtable);
770  }
771  if (!b) {
772  break;
773  }
774  }
775  objectdata_ = saveod;
776  return b;
777  }else{
778  return symlist(t->symtable);
779  }
780 }
781 bool OcCheckpoint::object() {
782  bool b;
783  int i;
784  if (otable_) {
785  delete otable_;
786  }
787  b = xdr(nobj_);
788  otable_ = new Objects(2*nobj_ + 1);
789  nobj_ = 0;
790  func_ = &OcCheckpoint::objects;
791  b = pass1();
792  i = -1;
793  b = b && xdr(i);
794  return b;
795 }
796 bool OcCheckpoint::objects(Symbol* s) {
797  bool b = true;
798  if (s->type == TEMPLATE) {
799  int sid;
800  b = b && stable_->find(sid, s);
801  b = b && xdr(sid);
802  cTemplate* t = s->u.ctemplate;
803 #undef init
804  if (t->init) {
805  b = b && stable_->find(sid, t->init);
806  }else{
807  sid = 0;
808  }
809  b = b && xdr(sid);
810  b = b && xdr(t->index)
811  && xdr(t->count)
812  && xdr(t->id);
813  hoc_Item* q;
814  ITERATE(q, t->olist) {
815  Object* ob = OBJ(q);
816  ++nobj_;
817  otable_->insert(ob, nobj_); // 0 is null object
818  b = b && xdr(nobj_)
819  && xdr(ob->refcount)
820  && xdr(ob->index);
821  }
822  }
823  return b;
824 }
825 
826 bool OcCheckpoint::objectdata(Objectdata*) {
827  return false;
828 }
829 #undef sub
830 long OcCheckpoint::arrayinfo(Symbol* s, Objectdata* od) {
831 
832  Arrayinfo* ao;
833  Arrayinfo* as;
834 
835  as = s->arayinfo;
836  if (od) {
837  ao = od[s->u.oboff + 1].arayinfo;
838  }else{
839  ao = as;
840  }
841  long n = long(hoc_total_array_data(s, od));
842  if (!as) { // not an array
843  DEBUG(f_, "0\n");
844  int i = 0;
845  xdr(i);
846  }else if (od && as == ao) { // same as original
847  DEBUG(f_, "-1\n");
848  int i = -1;
849  xdr(i);
850  }else{
851  int v = ao->a_varn ? 1 : 0;
852  DEBUG(f_, "%d %d %d", ao->nsub, ao->refcount, v);
853  if (v) {
854 printf("checkpoint of equation array vars not implemented: %s\n", s->name);
855  return -1;
856  }
857  xdr(ao->nsub);
858 // xdr(ao->refcount);
859 // xdr(v);
860  for (int i = 0; i < ao->nsub; ++i) {
861  DEBUG(f_, " %d", ao->sub[i]);
862  xdr(ao->sub[i]);
863  }
864  DEBUG(f_, "\n");
865  }
866  return n;
867 }
868 
869 bool OcCheckpoint::proc(Proc*) {
870  return false;
871 }
872 
873 bool OcCheckpoint::sym_values(Symbol* s) {
874  int sp;
875  bool b;
876  stable_->find(sp, s);
877  if ((s->type == VAR && s->subtype == NOTUSER)
878  || s->type == OBJECTVAR || s->type == STRING || s->type == SECTION) {
879  DEBUG(f_, "%d %s\n", sp, s->name);
880  b = xdr(sp);
881  long n = arrayinfo(s, objectdata_);
882  if (n == -1) {
883  return false;
884  }
885 // DEBUG(f_, " %ld\n", n);
886 // b = b && xdr(n);
887  for (long i = 0; i < n; ++i) {
888  Objectdata od = objectdata_[s->u.oboff];
889  if (s->type == VAR) {
890  double d = od.pval[i];
891  DEBUG(f_, " %g\n", d);
892  b = b && xdr(d);
893  }else if (s->type == OBJECTVAR) {
894  Object* ob = od.pobj[i];
895  if (ob == NULL) {
896  DEBUG(f_, " 0\n");
897  int i = 0;
898  b = b && xdr(i);
899  }else{
900 #if 0
901  int t;
902  stable_->find(t, ob->ctemplate->sym);
903  DEBUG(f_, " %d %d %s\n", t, ob->index,
904  ob->ctemplate->sym->name);
905  b = b && xdr(t);
906  b = b && xdr(ob->index);
907 #else
908  int oid;
909  b = b && otable_->find(oid, ob);
910  b = b && xdr(oid);
911 #endif
912  }
913  }else if (s->type == STRING) {
914  char* cp = od.ppstr[i];
915  DEBUG(f_, " |%s|\n", cp);
916  b = b && xdr(cp, strlen(cp));
917 // }else if (s->type == SECTION) {
918  }
919  }
920  }
921  return true;
922 }
923 
924 #if USEXDR && 0
925 bool OcCheckpoint::xdr(int& i) {
926  return xdr_int(&xdrs_, &i);
927 }
928 bool OcCheckpoint::xdr(char*& i, int size){
929  return xdr_string(&xdrs_, &i, size);
930 }
931 bool OcCheckpoint::xdr(short& i){
932  return xdr_short(&xdrs_, &i);
933 }
934 bool OcCheckpoint::xdr(unsigned int& i){
935  return xdr_u_int(&xdrs_, &i);
936 }
937 bool OcCheckpoint::xdr(unsigned long& i){
938  return xdr_u_long(&xdrs_, &i);
939 }
940 #else
941 bool OcCheckpoint::xdr(int& i) {
942  fprintf(f_, "%d\n", i);
943  return true;
944 }
945 bool OcCheckpoint::xdr(long& i) {
946  fprintf(f_, "%ld\n", i);
947  return true;
948 }
949 bool OcCheckpoint::xdr(char*& s, int){
950  fprintf(f_, "%s\n", s);
951  return true;
952 }
953 bool OcCheckpoint::xdr(short& i){
954  int j = i;
955  fprintf(f_, "%d\n", j);
956  return true;
957 }
958 bool OcCheckpoint::xdr(unsigned int& i){
959  int j = i;
960  fprintf(f_, "%d\n", j);
961  return true;
962 }
963 bool OcCheckpoint::xdr(unsigned long& i){
964  long j = i;
965  fprintf(f_, "%ld\n", j);
966  return true;
967 }
968 bool OcCheckpoint::xdr(double& i){
969  fprintf(f_, "%g\n", i);
970  return true;
971 }
972 #endif
973 bool OcCheckpoint::xdr(Object*& o) {
974  int i;
975  bool b;
976  b = otable_->find(i, o);
977  b = b && xdr(i);
978  return b;
979 }
980 
981 #undef Chk
982 #define Chk(arg1,arg2) if (!(arg1)) { printf("%s line %d\n", arg2, lineno_); return false;}
983 #undef Get
984 #define Get(arg) if (!get(arg)) { return false; }
985 
986 OcReadChkPnt::OcReadChkPnt() {
987  builtin_size_ = hoc_resize_toplevel(0);
988 }
989 
990 OcReadChkPnt::~OcReadChkPnt() {
991  delete [] psym_;
992  delete [] pobj_;
993 }
994 
995 bool OcReadChkPnt::read() {
996  int size;
997  out_ = 0;
998  lineno_ = 1;
999  id_ = 1;
1000  Chk(symbols(), "OcReadChkPnt::symbols() read failure");
1001 printf("finished with symbols at lineno = %d\n", lineno_);
1002  Chk(instructions(), "OcReadChkPnt::instructions() read failure");
1003 printf("finished with instructions at lineno = %d\n", lineno_);
1004  Chk(objects(), "OcReadChkPnt::objects() read failure");
1005 printf("finished with objects at lineno = %d\n", lineno_);
1006  Get(size);
1007  if (size != hoc_resize_toplevel(size - builtin_size_)) {
1008  printf("top_level_data not right size\n");
1009  return false;
1010  }
1011  Chk(objectdata(), "OcReadChkPnt::objectdata() read failure");
1012 printf("finished with objectdata at lineno = %d\n", lineno_);
1013  return true;
1014 }
1015 
1016 bool OcReadChkPnt::symbols() {
1017  Get(nsym_);
1018  psym_ = new Symbol*[nsym_];
1019  for (int i=0; i < nsym_; ++i) {
1020  psym_[i] = 0;
1021  }
1022  lookup_ = true;
1023  symtable_ = hoc_built_in_symlist;
1024  Chk(symtable(), "built_in_symlist failure");
1025  lookup_ = false;
1026  symtable_ = hoc_top_level_symlist;
1027  if (symtable_->first != NULL) {
1028  printf("Some user symbols are already defined at the top level\n");
1029  return false;
1030  }
1031  Chk(symtable(), "top_level_symlist failure");
1032  return true;
1033 }
1034 bool OcReadChkPnt::symtable() {
1035  int size;
1036  Get(size);
1037  for (int i = 0; i < size; ++i) {
1038  Chk(symbol(), "symbol read failure");
1039  }
1040  return true;
1041 }
1042 bool OcReadChkPnt::symbol() {
1043  int id, type, subtype, i;
1044  char buf[2048], *name = buf;
1045 
1046  Get(id);
1047  if (id != id_) {
1048  printf("expected symbol id = %d but file id was %d\n", id_, id);
1049  return false;
1050  }
1051  ++id_;
1052  Get(name);
1053  Get(type);
1054  Get(subtype);
1055 
1056  Symbol* sym;
1057  if (lookup_) {
1058  sym = hoc_table_lookup(name, symtable_);
1059  if (!sym || sym->type != type || sym->subtype != subtype) {
1060  printf("%s not a built-in\n", name);
1061  return false;
1062  }
1063  }else{
1064  sym = hoc_install(name, (type == VAR)? UNDEF : type, 0.0, &symtable_);
1065  sym->type = type;
1066  sym->subtype = subtype;
1067  }
1068 
1069  psym_[id] = sym;
1070  Get(i); sym->cpublic = i;
1071  Get(i); sym->s_varn = i;
1072  Get(i); sym->defined_on_the_fly = i;
1073  switch (type) {
1074  case VAR:
1075  {
1076  if (subtype == NOTUSER) {
1077  Get(i);
1078  if (lookup_ && i != sym->u.oboff) {
1079  printf("bad u.oboff field for built-in VAR\n");
1080  return false;
1081  }else{
1082  sym->u.oboff = i;
1083  }
1084  }
1085  arrayinfo(sym, NULL);
1086  }
1087  break;
1088  case OBJECTVAR:
1089  case STRING:
1090  Get(i);
1091  sym->u.oboff = i;
1092  arrayinfo(sym, NULL);
1093  break;
1094  case CSTRING:
1095  sym->u.cstr = NULL;
1096  Get(sym->u.cstr);
1097  break;
1098  case NUMBER:
1099  sym->u.pnum = new double;
1100  Get(*sym->u.pnum);
1101  break;
1102  case TEMPLATE:
1103  {
1104  cTemplate* t;
1105  int dsize, id;
1106  Symlist* slsave = symtable_;
1107  if (!lookup_) {
1108  Get(dsize);
1109  Get(id);
1110  t = new cTemplate;
1111  sym->u.ctemplate = t;
1112  t->sym = sym;
1113  t->dataspace_size = dsize;
1114  t->constructor = 0;
1115  t->destructor = 0;
1116  t->steer = 0;
1117  t->id = id;
1118  symtable_ = NULL;
1119  Chk(symtable(), "");
1120  t->symtable = symtable_;
1121  }else{
1122  // these don't have a dataspace
1123  t = sym->u.ctemplate;
1124  symtable_ = t->symtable;
1125  Chk(symtable(), "");
1126  }
1127  symtable_ = slsave;
1128  }
1129  break;
1130  case FUNCTION:
1131  case PROCEDURE:
1132  {
1133  Symlist* slsave = symtable_;
1134  symtable_ = sym->u.u_proc->list;
1135  Chk(symtable(), "");
1136  sym->u.u_proc->list = symtable_;
1137  symtable_ = slsave;
1138  }
1139  break;
1140  }
1141  return true;
1142 }
1143 bool OcReadChkPnt::instructions() {
1144  int sid, size, i, iid;
1145  Symbol* sym;
1146  const char* signature;
1147  for (;;) {
1148  Get(sid);
1149  if (sid == -1) {
1150  break;
1151  }
1152  sym = psym_[sid];
1153  if (!sym || (sym->type != FUNCTION && sym->type != PROCEDURE)) {
1154  printf("not a PROC or FUNC\n");
1155  return false;
1156  }
1157  Get(size);
1158  sym->u.u_proc->size = size;
1159  Inst* lin;
1160  sym->u.u_proc->defn.in = lin = new Inst[size];
1161  for (i=0; i < size;) {
1162  Get(iid);
1163  lin[i++].pf = hoc_inst_[iid].pi;
1164  signature = hoc_inst_[iid].signature;
1165  if (signature) for(const char* cp = signature; *cp; ++cp) {
1166  Get(iid);
1167  switch (*cp) {
1168  case 's':
1169  lin[i++].sym = psym_[iid];
1170  break;
1171  case 'i':
1172  lin[i++].i = iid;
1173  break;
1174  }
1175  }
1176  }
1177  }
1178 
1179  return true;
1180 }
1181 bool OcReadChkPnt::objects() {
1182  int sid;
1183  long i, n, iob = 0;
1184  Symbol* sym;
1185  Get(nobj_);
1186  pobj_ = new Object*[nobj_ + 1];
1187  pobj_[0] = NULL;
1188  for (;;) {
1189  Get(sid);
1190  if (sid == -1) {
1191  break;
1192  }
1193  sym = psym_[sid];
1194  if (sym->type != TEMPLATE) {
1195  printf("not a template\n");
1196  return false;
1197  }
1198  cTemplate* t = sym->u.ctemplate;
1199  Get(sid);
1200 #undef init
1201  t->init = psym_[sid];
1202  Get(t->index);
1203  Get(n);
1204  t->count = int(n);
1205  if (t->constructor && !t->checkpoint && t->count > 0) {
1206  printf("Objects for a built-in template without checkpoint: %s\n", sym->name);
1207  return false;
1208  }
1209  t->olist = hoc_l_newlist();
1210  Get(t->id);
1211  for (i=0; i < n; ++i) {
1212  int fiob; // not really needed
1213  Get(fiob);
1214  Object* pob = new Object;
1215  pobj_[++iob] = pob;
1216  if (fiob != iob) {
1217  printf("object indexes out of sync\n");
1218  }
1219  pob->itm_me = hoc_l_lappendobj(t->olist, pob);
1220  pob->ctemplate = t;
1221  Get(pob->refcount);
1222  Get(pob->index);
1223  if (t->constructor) {
1224  //have to set this up later
1225  pob->u.this_pointer = NULL;
1226  }else{
1227  pob->u.dataspace = new Objectdata[t->dataspace_size];
1228  }
1229  }
1230  }
1231  if (iob != nobj_) {
1232  printf("objects read != objects expected\n");
1233  return false;
1234  }
1235  return true;
1236 }
1237 bool OcReadChkPnt::objectdata() {
1238  int sid;
1239  long n, i;
1240  Symbol* sym;
1241  double d;
1242  int oid;
1243  Objectdata* od, *odp;
1244  Get(oid);
1245  if (oid == 0) {
1246  od = hoc_top_level_data;
1247  }else if (oid == -1) {
1248  return true;
1249  }else{
1250  od = pobj_[oid]->u.dataspace;
1251  }
1252  for (;;) {
1253  Get(sid);
1254  if (sid == -1) {
1255  break;
1256  }
1257  sym = psym_[sid];
1258  switch (sym->type) {
1259  case VAR:
1260  n = arrayinfo(sym, od);
1261 #if 0
1262  Get(i); //not necessary but if present don't forget others
1263  if (i != n) {
1264  printf("inconsistent array size %d %d\n", i, n);
1265  returnf false;
1266  }
1267 #endif
1268  odp = od + sym->u.oboff;
1269  if (od != hoc_top_level_data || builtin_size_ <= sym->u.oboff) {
1270  odp->pval = new double[n];
1271  }
1272  for (i = 0; i < n; ++i) {
1273  Get(d);
1274  odp->pval[i] = d;
1275  }
1276  break;
1277  case OBJECTVAR:
1278  n = arrayinfo(sym, od);
1279  odp = od + sym->u.oboff;
1280  odp->pobj = new Object*[n];
1281  for (i = 0; i < n; ++i) {
1282  int iob;
1283  Get(iob);
1284  odp->pobj[i] = pobj_[iob];
1285  }
1286  break;
1287  case STRING:
1288  n = arrayinfo(sym, od);
1289  od[sym->u.oboff].ppstr = new char*[n];
1290  for (i=0; i < n; ++i) {
1291  od[sym->u.oboff].ppstr[i] = NULL;
1292  Get(od[sym->u.oboff].ppstr[i]);
1293  }
1294  break;
1295  case TEMPLATE:
1296  {
1297  cTemplate* t = sym->u.ctemplate;
1298  if (t->constructor) {
1299  for (long j = 0; j < t->count; ++j) {
1300  int iob;
1301  Object* ob;
1302  Get(iob);
1303  ob = pobj_[iob];
1304  if (!(*t->checkpoint)(&ob->u.this_pointer)) {
1305 printf("failed reading data for %s\n", hoc_object_name(ob));
1306  return false;
1307  }
1308  }
1309  }else{
1310  for (long j = 0; j < t->count; ++j) {
1311  objectdata();
1312  }
1313  }
1314  }
1315  break;
1316  default:
1317  return false;
1318  }
1319  }
1320  return true;
1321 }
1322 long OcReadChkPnt::arrayinfo(Symbol* s, Objectdata* od) {
1323  int nsub;
1324  Get(nsub);
1325  if (lookup_) {
1326  int i;
1327  for (i=0; i < nsub; ++i) {
1328  Get(i);
1329  }
1330  }
1331  Arrayinfo** ap;
1332  if (od == NULL) {
1333  ap = &s->arayinfo;
1334  }else{
1335  ap = &od[s->u.oboff + 1].arayinfo;
1336  }
1337  if (nsub == 0) {
1338  *ap = NULL;
1339  return 1;
1340  }
1341  if (nsub == -1) {
1342  *ap = s->arayinfo;
1343  if (*ap) {
1344  (*ap)->refcount++;
1345  }
1346  return long(hoc_total_array_data(s, NULL));
1347  }
1348  Arrayinfo* a = (Arrayinfo*)hoc_Emalloc(sizeof(Arrayinfo) + nsub*sizeof(int));
1349  if (!a) {
1350  return -1;
1351  }
1352  *ap = a;
1353  a->refcount = 1;
1354  a->a_varn = NULL;
1355  a->nsub = nsub;
1356 
1357  long n = 1;
1358  for (int i = 0; i < nsub; ++i) {
1359  int sub;
1360  Get(sub);
1361  a->sub[i] = sub;
1362  n *= sub;
1363  }
1364  return n;
1365 }
1366 bool OcReadChkPnt::get(int& i) {
1367  ++lineno_;
1368  char buf[200];
1369  if (!fgets(buf, 200, f_)
1370  ||(sscanf(buf, "%d", &i) != 1)) {
1371  printf("error reading integer at line %d\n", lineno_);
1372  return false;
1373  }
1374 
1375  return true;
1376 }
1377 bool OcReadChkPnt::get(double& i) {
1378  ++lineno_;
1379  char buf[200];
1380  if (!fgets(buf, 200, f_)
1381  ||(sscanf(buf, "%lf", &i) != 1)) {
1382  printf("error reading double at line %d\n", lineno_);
1383  return false;
1384  }
1385 
1386  return true;
1387 }
1388 bool OcReadChkPnt::get(long& i) {
1389  int j;
1390  Get(j);
1391  i = j;
1392  return true;
1393 }
1394 
1395 bool OcReadChkPnt::get(char*& s) {
1396  ++lineno_;
1397  if (s) {
1398  if (!fgets(s, 2048, f_)) {
1399  printf("error reading string at line %d\n", lineno_);
1400  return false;
1401  }
1402  s[strlen(s)-1] = '\0';
1403  }else{
1404  char buf[256];
1405  if (!fgets(buf, 256, f_)) {
1406  printf("error reading string at line %d\n", lineno_);
1407  return false;
1408  }
1409  buf[strlen(buf)-1] = '\0';
1410  s = new char[strlen(buf) + 1];
1411  strcpy(s, buf);
1412  }
1413  return true;
1414 }
1415 
1416 
1417 bool OcReadChkPnt::get(Object*& o) {
1418  long i;
1419  Get(i);
1420  o = pobj_[i];
1421  return true;
1422 }
1423 #endif
1424 #endif
o
Definition: seclist.cpp:180
void sec_access_pop(void)
Definition: cabcode.cpp:144
void hoc_stringarg(void)
Definition: code.cpp:1639
Definition: hocdec.h:84
size_t hoc_total_array_data(Symbol *s, Objectdata *obd)
Definition: hoc_oop.cpp:106
int dataspace_size
Definition: hocdec.h:197
hoc_List * hoc_l_newlist()
HocStruct Symbol * sym
Definition: hocdec.h:61
void nrn_cppp(void)
Definition: point.cpp:317
short type
Definition: cabvars.h:10
#define bltin
Definition: redef.h:33
void Stop(void)
Definition: code.cpp:1275
Symbol * sym
Definition: hocdec.h:195
void hoc_cmp_otype(void)
#define forcode
Definition: redef.h:62
void sec_access_object(void)
Definition: cabcode.cpp:721
short type
Definition: model.h:58
#define procret
Definition: redef.h:111
void hoc_div(void)
Definition: code.cpp:2035
#define assstr
Definition: redef.h:31
int hoc_resize_toplevel(int more)
Definition: hoc_oop.cpp:292
int nsub
Definition: hocdec.h:70
void hoc_ifseclist(void)
Definition: seclist.cpp:343
#define ge
Definition: redef.h:73
void hoc_newobj(void)
Definition: hoc_oop.cpp:665
#define ITERATE(itm, lst)
Definition: model.h:25
void rangevareval(void)
Definition: cabcode.cpp:1455
Symlist * symtable
Definition: hocdec.h:196
void * this_pointer
Definition: hocdec.h:231
char * hoc_object_name(Object *ob)
Definition: hoc_oop.cpp:84
size_t p
void hoc_objectarg(void)
Objectdata * hoc_top_level_data
Definition: hoc_oop.cpp:134
#define implementList(List, T)
char * name
Definition: model.h:72
void forall_sectionlist(void)
Definition: seclist.cpp:297
void hoc_known_type(void)
void hoc_not(void)
Definition: code.cpp:2199
unsigned long size
Definition: hocdec.h:77
#define print
Definition: redef.h:109
#define Continue
Definition: redef.h:7
#define v
Definition: md1redef.h:4
void hoc_object_component()
Definition: hoc_oop.cpp:1032
void rangepoint(void)
Definition: cabcode.cpp:1464
HocStruct Symlist * list
Definition: hocdec.h:78
void hoc_cyclic(void)
Definition: code.cpp:2056
void forall_section(void)
Definition: cabcode.cpp:2151
Arrayinfo * arayinfo
Definition: hocdec.h:222
void sec_access_push(void)
Definition: cabcode.cpp:738
hoc_Item * hoc_l_lappendobj(hoc_List *, struct Object *)
Definition: hocdec.h:51
#define mul
Definition: redef.h:93
std::vector< Point_process * > PPList
Definition: partrans.cpp:174
hoc_List * olist
Definition: hocdec.h:203
Symbol * hoc_install(const char *, int, double, Symlist **)
#define gargstr
Definition: hocdec.h:14
int refcount
Definition: hocdec.h:71
void hoc_asgn_obj_to_str(void)
struct Object Object
#define eqn_rhs
Definition: redef.h:54
#define implementTable(Table, Key, Value)
Definition: table.h:113
#define declareTable(Table, Key, Value)
Definition: table.h:46
void(* steer)(void *)
Definition: hocdec.h:208
void hoc_ret()
unsigned s_varn
Definition: hocdec.h:157
long
Definition: netcvode.cpp:4792
Symlist * hoc_top_level_symlist
Definition: code2.cpp:662
int refcount
Definition: hocdec.h:227
#define lt
Definition: redef.h:91
sl
Definition: seclist.cpp:186
void hoc_objvardecl(void)
void ob_sec_access(void)
Definition: cabcode.cpp:827
int sub[1]
Definition: hocdec.h:72
#define NOTUSER
Definition: hocdec.h:91
void connectsection(void)
Definition: cabcode.cpp:664
void simpleconnectsection(void)
Definition: cabcode.cpp:655
int const size_t const size_t n
Definition: nrngsl.h:12
bool xdr(long &)
double * pval
Definition: hocdec.h:217
_CONST char * s
Definition: system.cpp:74
Objectdata * dataspace
Definition: hocdec.h:230
int get()
Definition: units.cpp:1119
HocStruct Object ** pobj
Definition: hocdec.h:219
#define argassign
Definition: redef.h:29
int val
Definition: dll.cpp:167
void add_section(void)
Definition: cabcode.cpp:185
#define STOP
Definition: hocdec.h:66
Arrayinfo * arayinfo
Definition: hocdec.h:158
int(* checkpoint)(void **)
Definition: hocdec.h:209
#define printf
Definition: mwprefix.h:26
HocStruct hoc_Item * itm_me
Definition: hocdec.h:239
#define eqn_name
Definition: redef.h:53
int
Definition: nrnmusic.cpp:71
void hoc_arayinstal(void)
int read(int, void *, unsigned int)
void hoc_and(void)
Definition: code.cpp:2183
#define dep_make
Definition: redef.h:47
#define assign
Definition: redef.h:30
static const char * fname(const char *name)
Definition: nrnbbs.cpp:108
#define STRING
Definition: bbslsrv.cpp:9
Symbol * init
Definition: hocdec.h:199
void connectpointer(void)
Definition: cabcode.cpp:1125
#define negate
Definition: redef.h:95
#define power
Definition: redef.h:107
#define DEBUG
Definition: list.cpp:36
void *(* constructor)(struct Object *)
Definition: hocdec.h:206
#define nopop
Definition: redef.h:106
void hoc_objectvar()
Definition: hoc_oop.cpp:888
Proc * u_proc
Definition: hocdec.h:144
Inst defn
Definition: hocdec.h:76
#define Break
Definition: _defines.h:55
char ** ppstr
Definition: hocdec.h:218
char * cstr
Definition: hocdec.h:138
int hoc_readcheckpoint(char *)
Definition: ocnoiv1.cpp:18
bool out()
size_t j
int index
Definition: hocdec.h:201
void hoc_push_string()
Definition: code.cpp:671
fprintf(stderr, "Don't know the location of params at %p\, pp)
Definition: model.h:57
void for_segment(void)
Definition: code.cpp:1237
char * name
Definition: init.cpp:16
static Checkpoint * instance()
double * hoc_evalpointer()
Definition: code.cpp:1891
void hoc_or(void)
Definition: code.cpp:2191
int oboff
Definition: hocdec.h:131
void range_interpolate(void)
Definition: cabcode.cpp:1195
#define eq
Definition: redef.h:49
#define le
Definition: redef.h:88
#define varread
Definition: redef.h:132
Symlist * hoc_built_in_symlist
Definition: symbol.cpp:39
#define eqn_init
Definition: redef.h:51
double(* func)(double)
Definition: hoc_init.cpp:111
HocStruct Symbol * next
Definition: hocdec.h:161
#define ne
Definition: redef.h:94
void hoc_delete_symbol(void)
Definition: code.cpp:2528
#define funcret
Definition: redef.h:68
void sec_access(void)
Definition: cabcode.cpp:709
struct cTemplate cTemplate
#define call
Definition: redef.h:34
#define pushzero
Definition: redef.h:42
int id
Definition: hocdec.h:204
long subtype
Definition: model.h:59
Pfrv pf
Definition: hocdec.h:52
void hoc_pushx(double)
void hoc_parallel_end(void)
#define OBJ(q)
Definition: hoclist.h:67
void hoc_newline(void)
Definition: code.cpp:2559
void mech_uninsert(void)
Definition: cabcode.cpp:907
#define prexpr
Definition: redef.h:108
void hoc_checkpoint()
Definition: ocnoiv1.cpp:140
short cpublic
Note: public is a reserved keyword.
Definition: hocdec.h:125
#define prstr
Definition: redef.h:117
#define FUNCTION(a, b)
Definition: nrngsl.h:6
void hoc_parallel_begin(void)
#define eqn_lhs
Definition: redef.h:52
void rangevarevalpointer(void)
Definition: cabcode.cpp:1410
#define symlist
Definition: cabcode.cpp:17
void connect_point_process_pointer(void)
Definition: point.cpp:321
#define eval
Definition: redef.h:57
void hoc_object_eval(void)
Definition: hoc_oop.cpp:1318
Definition: hocdec.h:226
HocStruct cTemplate * ctemplate
Definition: hocdec.h:151
#define shortfor
Definition: redef.h:63
void hoc_ob_pointer(void)
short defined_on_the_fly
Definition: hocdec.h:129
void symbols(void)
Definition: code2.cpp:570
void hoc_ifsec(void)
Definition: cabcode.cpp:2221
virtual ~Checkpoint()
Symbol * hoc_table_lookup(const char *, Symlist *)
Definition: symbol.cpp:60
void hoc_sub(void)
Definition: code.cpp:1980
long subtype
Definition: init.cpp:122
#define ifcode
Definition: redef.h:76
#define varpush
Definition: redef.h:131
#define i
Definition: md1redef.h:12
#define id
Definition: md1redef.h:33
void range_interpolate_single(void)
Definition: cabcode.cpp:1153
void hoc_object_asgn(void)
void(* Pfrv)(void)
Definition: hocdec.h:40
#define gt
Definition: redef.h:75
#define declareList(List, T)
Definition: list.h:49
#define arg
Definition: redef.h:28
char buf[512]
Definition: init.cpp:13
void mech_access(void)
Definition: cabcode.cpp:839
#define add
Definition: redef.h:24
int find(const int, const int, const int, const int, const int)
void(* destructor)(void *)
Definition: hocdec.h:207
union Symbol::@18 u
union Object::@54 u
double t
Definition: init.cpp:123
void range_const(void)
Definition: cabcode.cpp:1052
int count
Definition: hocdec.h:202
size_t q
Definition: hocdec.h:176
FILE * fopen()
Definition: hocdec.h:75
int index
Definition: hocdec.h:228
unsigned * a_varn
Definition: hocdec.h:69
return NULL
Definition: cabcode.cpp:461
#define constpush
Definition: redef.h:41
double * pnum
Definition: hocdec.h:139
int i
Definition: hocdec.h:63
void * hoc_Emalloc(size_t size)
Definition: symbol.cpp:194
static N_Vector id_
HocStruct Symbol * first
Definition: hocdec.h:85
HocUnion Inst * in
Definition: hocdec.h:60