/*
 Copyright (C) 2003 Niels Elken Sønderby

 Contains code from Wolfram Research
 http://www.wolfram.com/solutions/mathlink/

 This file is part of QuantLib for Mathematica, a Mathematica extension for
 QuantLib, a free-software/open-source financial C++ library
 http://www.nielses.dk/quantlib/mma
 http://quantlib.org/

 QuantLib for Mathematica is free software: you can redistribute it and/or
 modify it under the terms of the QuantLib license.  You should have received
 a copy of the license along with this program; if not, please email
 ferdinando@ametrano.net The license is also available online at
 http://quantlib.org/html/license.html

 This program is distributed in the hope that it will be useful, but WITHOUT
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 FOR A PARTICULAR PURPOSE.  See the license for more details.
*/

#include "qlmma.hpp"

#include "mathlink.h"

#include "mmacalendar.hpp"
#include "mmaoptions.hpp"
#include "mmamontecarlo.hpp"

// General MathLink-code by Wolfram Research

#if MACINTOSH_MATHLINK

int main( int argc, char* argv[])
{
    /* Due to a bug in some standard C libraries that have shipped with
     * MPW, zero is passed to MLMain below.  (If you build this program
     * as an MPW tool, you can change the zero to argc.)
     */
    argc = argc; /* suppress warning */
    return MLMain( 0, argv);
}

#elif WINDOWS_MATHLINK

#if __BORLANDC__
#pragma argsused
#endif

int PASCAL WinMain( HINSTANCE hinstCurrent, HINSTANCE hinstPrevious,
                    LPSTR lpszCmdLine, int nCmdShow)
{
    char  buff[512];
    char FAR * buff_start = buff;
    char FAR * argv[32];
    char FAR * FAR * argv_end = argv + 32;

    hinstPrevious = hinstPrevious; /* suppress warning */

    if( !MLInitializeIcon( hinstCurrent, nCmdShow)) return 1;
    MLScanString( argv, &argv_end, &lpszCmdLine, &buff_start);
    return MLMain( argv_end - argv, argv);
}

#else

int main(argc, argv)
    int argc; char* argv[];
{
    return MLMain(argc, argv);
}

#endif

