Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 23rd, 2005, 12:30 AM
christopher diggins
Guest
 
Posts: n/a
Default scripting C++

Using the OOTL (Object Oriented Template Library, http://www.ootl.org ) it
would very feasable to write a scripting engine for C++ programs.

The way this hypothetical engine would work is that any OOTL object (that is
an object containing the OOTL_DEF_OBJECT macro) could be exposed along with
an interface written using the BIL (Boost Interfaces Library) IDL
(Interfaces Description Language).

Using the scripting library, would look like this (pardon any C++ usage
errors):

CppScriptEngine theEngine;

std::list<ootl::String> gList;

class MyClass {
DEF_OOTL_OBJECT(MyClass);
void Push(ool::String x) {
gList.push_back(x);
}
};

BOOST_IDL_BEGIN(IMyInterface)
BOOST_IDL_FN0(Push, void, (ootl::String, x))
BOOST_IDL_END(IMyInterface)

int main() {
theEngine.Expose("MyClass", MyClass, IMyInterface);
theEngine.RunInteractiveSession();
while (!gList.empty()) {
std::cout << gList.back() << std::endl;
gList.pop_back();
}
return 0;
}

When this program is run, it would go into a console mode, where it would
allow a limited C++ syntax, and support the core OOTL objects, i.e. Int,
Bool, Char, String, etc. So a possible user session might look like this:

String s = "hello";
MyClass m;
m.Push(s);
m.Push("world");
^Z

Does this kind of tool (open-source of course) interest anyone? Anyone
potentially interested in collaborating?

--
Christopher Diggins
http://www.cdiggins.com
http://www.heron-language.com


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles