scripting C++

Discussion in 'C++' started by christopher diggins, Jan 8, 2005.

  1. 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! ]
     
    christopher diggins, Jan 8, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wilfredo Perez

    vb.net scripting

    Wilfredo Perez, Feb 23, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    536
    James Peters
    Feb 24, 2004
  2. Mark
    Replies:
    3
    Views:
    622
    Joe Smith
    Mar 18, 2005
  3. Hrvoje Vrbanc
    Replies:
    8
    Views:
    354
    Hrvoje Vrbanc
    Aug 9, 2003
  4. Ron Stephens
    Replies:
    23
    Views:
    2,981
    Ron Stephens
    Apr 12, 2004
  5. DaveInSidney
    Replies:
    0
    Views:
    447
    DaveInSidney
    May 9, 2005
Loading...

Share This Page