Permalink
Browse files

get_pointer and set_pointer vtables, some use in nci

  • Loading branch information...
1 parent 0c42303 commit df1d6bba3b56d659eeced825ac6ea51699b23521 @NotFound committed Jun 2, 2012
Showing with 64 additions and 0 deletions.
  1. +8 −0 winxedxx.h
  2. +5 −0 winxedxx_classes.cxx
  3. +11 −0 winxedxx_default.cxx
  4. +2 −0 winxedxx_default.h
  5. +1 −0 winxedxx_integer.h
  6. +10 −0 winxedxx_nci.cxx
  7. +11 −0 winxedxx_null.cxx
  8. +2 −0 winxedxx_null.h
  9. +2 −0 winxedxx_object.h
  10. +10 −0 winxedxx_objectptr.cxx
  11. +2 −0 winxedxx_types.h
View
@@ -32,9 +32,12 @@ class WxxNCI : public WxxDefault
{
public:
WxxNCI(const std::string &funcname);
+ int get_integer();
+ void * get_pointer();
WxxObjectPtr operator()(WxxObjectArray &args);
protected:
std::string name;
+ virtual void *getNciFun() = 0;
};
template <typename NciSig, int nargs>
@@ -46,6 +49,7 @@ class WxxNCIcall : public WxxNCI
private:
WxxObjectPtr call(WxxObjectArray &args);
NciSig fun;
+ void *getNciFun() { return (void *) fun; }
};
//*************************************************************
@@ -70,6 +74,7 @@ class WxxNCIcall<NciSig, 0> : public WxxNCI
}
private:
NciSig fun;
+ void *getNciFun() { return (void *) fun; }
};
template <typename NciSig>
@@ -88,6 +93,7 @@ class WxxNCIcall<NciSig, 1> : public WxxNCI
}
private:
NciSig fun;
+ void *getNciFun() { return (void *) fun; }
};
template <typename NciSig>
@@ -106,6 +112,7 @@ class WxxNCIcall<NciSig, 2> : public WxxNCI
}
private:
NciSig fun;
+ void *getNciFun() { return (void *) fun; }
};
template <typename NciSig>
@@ -124,6 +131,7 @@ class WxxNCIcall<NciSig, 3> : public WxxNCI
}
private:
NciSig fun;
+ void *getNciFun() { return (void *) fun; }
};
template <typename NciSig, int nargs>
View
@@ -582,6 +582,11 @@ int WxxLibrary::get_integer()
return dl_h != 0;
}
+void * WxxLibrary::get_pointer()
+{
+ return dl_h;
+}
+
void * WxxLibrary::getsym(const std::string &funcname)
{
return dlsym(dl_h, funcname.c_str());
View
@@ -61,6 +61,17 @@ double WxxDefault::get_number()
return 0;
}
+void * WxxDefault::get_pointer()
+{
+ notimplemented("get_pointer");
+ return 0;
+}
+
+void WxxDefault::set_pointer(void *)
+{
+ notimplemented("set_pointer");
+}
+
int WxxDefault::elements() const
{
notimplemented("elements");
View
@@ -22,6 +22,8 @@ class WxxDefault : public WxxObject
int get_bool();
int get_integer();
double get_number();
+ void * get_pointer();
+ void set_pointer(void *p);
int elements() const;
virtual std::string get_string();
int is_equal(const WxxObject &to);
View
@@ -260,6 +260,7 @@ class WxxLibrary : public WxxDefault
int get_bool();
int get_integer();
+ void * get_pointer();
private:
void *dl_h;
};
View
@@ -16,6 +16,16 @@ WxxNCI::WxxNCI(const std::string &funcname) :
{
}
+int WxxNCI::get_integer()
+{
+ return get_pointer() != 0;
+}
+
+void * WxxNCI::get_pointer()
+{
+ return getNciFun();
+}
+
WxxObjectPtr WxxNCI::operator()(WxxObjectArray &args)
{
return winxedxxnull;
View
@@ -44,6 +44,17 @@ double WxxNull::get_number()
return 0;
}
+void * WxxNull::get_pointer()
+{
+ nullaccess("get_pointer");
+ return 0;
+}
+
+void WxxNull::set_pointer(void *)
+{
+ nullaccess("set_pointer");
+}
+
int WxxNull::elements() const
{
nullaccess("elements");
View
@@ -17,6 +17,8 @@ class WxxNull : public WxxObject
int get_bool();
int get_integer();
double get_number();
+ void * get_pointer();
+ void set_pointer(void *p);
int elements() const;
std::string get_string();
int is_equal(const WxxObject &to);
View
@@ -16,6 +16,8 @@ class WxxObject : public WxxRefcounted
virtual int get_bool() = 0;
virtual int get_integer() = 0;
virtual double get_number() = 0;
+ virtual void * get_pointer() = 0;
+ virtual void set_pointer(void *p) = 0;
virtual int elements() const = 0;
virtual std::string get_string() = 0;
virtual int is_equal(const WxxObject &to) = 0;
View
@@ -195,6 +195,16 @@ std::string WxxObjectPtr::get_string() const
return object->get_string();
}
+void WxxObjectPtr::set_pointer(void *p) const
+{
+ object->set_pointer(p);
+}
+
+void * WxxObjectPtr::get_pointer() const
+{
+ return object->get_pointer();
+}
+
int WxxObjectPtr::elements() const
{
return object->elements();
View
@@ -80,6 +80,8 @@ class WxxObjectPtr
std::string get_string() const;
int get_integer() const;
double get_number() const;
+ void *get_pointer() const;
+ void set_pointer(void *p) const;
int elements() const;
WxxObjectPtr add(const WxxObjectPtr &value);
WxxObjectPtr sub(const WxxObjectPtr &value);

0 comments on commit df1d6bb

Please sign in to comment.