/**
    @file SimpleApp.cpp

  */

#include <afx.h>
#include <afxwin.h>

#include <exception>

#include <ErrorReport.h>
#include <Toolkit.h>
#include <EML.h>


int
main( int argc, char** argv )
{
    // wrapper round general toolkit object
    Imagine::Toolkit     toolkit;

    // wrapper for EML part of toolkit
    Imagine::EML         eml;

    // holder for eml.initialize() result; not really needed as we can hide 
    // Imagine Toolkit data structures entirely if we want.  I.e., use
    // EML::root() calls to get at root widget when needed; and that's not
    // usually going to be the case as internal object calls will get this
    // as needed.
    Eui_Root *           root;

    // holder for eml.parseScript() result; not really needed as the parse
    // result is also saved internally to the EML object.  Similarly, you
    // won't necessarily need to keep this around as ImagineObjects classes
    // can grab this internally as needed.
    Eml_ParseResult *    parse_result;


    // Yes, there are no Eerr_Report objects.  They are internal to 
    // other objects.

    try
    {
        root = eml.initialize( toolkit, argv[0], argc, argv );

        parse_result = eml.parseScript( "SimpleApp.eml" );

        eml.mainEventLoop();
    }
    catch ( std::exception & e )
    {
        AfxMessageBox( e.what() );
        return 1; // for now, just return an arbitrary non-zero
    }

    return 0;
}