Permalink
Browse files

Add util directory to wxc.

Ignore-this: b133e073586824e1d9f4e6c57779a06c
util contains a few files. These are come from Subversion repository at
http://snmsts.dreamhosters.com/wxc for to sync two repositories.

darcs-hash:20090313065547-c1071-70a7e4ac247c69cd83332ebcd74ed69fae13a5cd.gz
  • Loading branch information...
shelarcy committed Mar 13, 2009
1 parent 1b2c3b6 commit d2db604ede149b18cad13f73d3f5fe06731733cc
Showing with 70 additions and 0 deletions.
  1. +56 −0 wxc/util/gconst.cc
  2. +14 −0 wxc/util/gfunc.cc
View
@@ -0,0 +1,56 @@
+#include "wx/dynlib.h"
+
+void getint(wxDynamicLibrary *lib,const char* name)
+{
+ typedef int (*wxexpType)();
+ wxString s = wxString::FromAscii(name);
+ wxString s2 = _T("exp");
+ wxString s3 = s2 + s;
+ wxexpType pfnexp = (wxexpType)lib->GetSymbol(s3);
+ if ( !pfnexp )
+ {
+ wxPrintf(_T("//ERROR: function '%s' wasn't found \n"),s3.c_str());
+ } else {
+ wxPrintf(_T("def_const_int(\"%s\",%d)\n"),s.c_str(),pfnexp());
+ }
+}
+
+void getstr(wxDynamicLibrary *lib,const char* name)
+{
+ typedef wxString* (*wxexpstrType)();
+ wxString s = wxString::FromAscii(name);
+ wxString s2 = _T("exp");
+ wxString s3 = s2 + s;
+ wxexpstrType pfnexp = (wxexpstrType)lib->GetSymbol(s3);
+ if ( !pfnexp )
+ {
+ wxPrintf(_T("//ERROR: function '%s' wasn't found \n"),s3.c_str());
+ } else {
+ wxString* sp = pfnexp();
+ wxPrintf(_T("def_const_str(\"%s\",\"%s\")\n"),s.c_str(),sp->c_str());
+ delete sp;
+ }
+}
+
+int main(void)
+{
+ static const wxChar *LIB_NAME = _T("./libwxc.so");
+
+ wxDynamicLibrary lib(LIB_NAME);
+ if ( !lib.IsLoaded() )
+ {
+ wxPrintf(_T("ERROR: failed to load '%s'.\n"), LIB_NAME);
+ }
+ else
+ {
+#define def_const_int(name,value) {\
+ getint(&lib,name); \
+}
+
+#define def_const_str(name,value) { \
+ getstr(&lib,name); \
+}
+
+#include "const_.h"
+ }
+}
View
@@ -0,0 +1,14 @@
+#include "wx/wx.h"
+#include "wx/string.h"
+
+int main(int argc,char **argv)
+{
+ wxString s = wxString::FromAscii(argv[1]);
+ int tok;
+ tok = s.Find('.');
+ while (tok != wxNOT_FOUND) {
+ wxPrintf(_T("#include \"src/%s.cpp\"\n"),s.Mid(4,tok-4).c_str());
+ s = s.Mid(tok+3);
+ tok = s.Find('.');
+ }
+}

0 comments on commit d2db604

Please sign in to comment.