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