NEURON
oc2iv.cpp
Go to the documentation of this file.
1 #include <../../nrnconf.h>
2 
3 #include <stdio.h>
4 #include "InterViews/resource.h"
5 #include "oc2iv.h"
6 #include "ocpointer.h"
7 
8 #include "parse.hpp"
11 extern Object* hoc_thisobject;
12 extern Symlist* hoc_symlist;
13 
14 char* Oc2IV::object_str(const char* name, Object* ob) {
15  if (ob && ob->ctemplate->constructor) {
16  if (is_obj_type(ob, "Pointer") && strcmp(name, "s") == 0) {
17  return ((OcPointer*) (ob->u.this_pointer))->s_;
18  }
19  } else {
20  return *object_pstr(name, ob);
21  }
22  return 0;
23 }
24 
25 char** Oc2IV::object_pstr(const char* name, Object* ob) {
26  Objectdata* od;
27  Symlist* sl;
28  if (ob) {
29  if (ob->ctemplate->constructor) {
30  return NULL;
31  } else {
32  od = ob->u.dataspace;
33  sl = ob->ctemplate->symtable;
34  }
35  } else {
36  od = hoc_top_level_data;
38  }
39  Symbol* sym = hoc_table_lookup(name, sl);
40  if (sym && sym->type == STRING) {
41  return ::object_pstr(sym, od);
42  } else {
43  return 0;
44  }
45 }
46 
48  restored_ = true;
49  save();
50 }
52  restore();
53 }
55  if (restored_ == true) {
57  obdsav_ = NULL;
58  } else {
60  }
66  restored_ = false;
67  }
68 }
69 
70 extern int hoc_in_template;
71 
73  if (restored_ == false) {
74  if (obdsav_ || hoc_in_template) {
76  } else {
78  }
81  restored_ = true;
82  }
83 }
static char ** object_pstr(const char *symname, Object *=NULL)
Definition: oc2iv.cpp:25
static char * object_str(const char *symname, Object *=NULL)
Definition: oc2iv.cpp:14
virtual ~ParseTopLevel()
Definition: oc2iv.cpp:51
Object * obsav_
Definition: oc2iv.h:103
Objectdata * obdsav_
Definition: oc2iv.h:102
Symlist * symsav_
Definition: oc2iv.h:104
void save()
Definition: oc2iv.cpp:54
void restore()
Definition: oc2iv.cpp:72
bool restored_
Definition: oc2iv.h:105
ParseTopLevel()
Definition: oc2iv.cpp:47
Symbol * hoc_table_lookup(const char *, Symlist *)
Definition: symbol.cpp:61
Objectdata * hoc_objectdata
Definition: hoc_oop.cpp:123
int is_obj_type(Object *obj, const char *type_name)
Definition: hoc_oop.cpp:2059
char * name
Definition: init.cpp:16
int hoc_in_template
Definition: hoc_oop.cpp:126
Symlist * hoc_top_level_symlist
Definition: symdir.cpp:23
Symlist * hoc_symlist
Objectdata * hoc_top_level_data
Definition: hoc_oop.cpp:124
Object * hoc_thisobject
Definition: hoc_oop.cpp:122
char ** object_pstr(Symbol *sym, Objectdata *od)
Definition: oc2iv.h:74
#define STRING
Definition: bbslsrv.cpp:9
sl
Definition: seclist.cpp:181
#define NULL
Definition: sptree.h:16
Definition: hocdec.h:227
void * this_pointer
Definition: hocdec.h:232
Objectdata * dataspace
Definition: hocdec.h:231
union Object::@39 u
Definition: model.h:57
short type
Definition: model.h:58
Definition: hocdec.h:84