00001
00009 #include <cmath>
00010 #include <iostream>
00011 #include <sstream>
00012 #include <vector>
00013
00014 #include "dynload.h"
00015 #include "popassert.h"
00016 #include "CColor.h"
00017 #include "CVector3f.h"
00018 #include "compute.h"
00019 #include "CMathExpression.h"
00020 #include "CVectBase.h"
00021 #include "CRenderObj.h"
00022 #include "CCommand.h"
00023 #include "CCommandParser.h"
00024 #include "CCommandExecutor.h"
00025
00026 int (* GetGuiFunc(LIBHANDLE* pGuiLibHandle))(int, char**);
00027
00028
00035 int main(int argc, char** argv)
00036 {
00037 LIBHANDLE pGuiLibHandle = NULL;
00038 int (*GuiFunc)(int, char**) = NULL;
00039
00040 if (argc > 2)
00041 {
00042 std::cerr << "Usage: mathray [-nw]" << std::endl;
00043 return 1;
00044 }
00045 else if (argc == 2)
00046 {
00047 if (strcmp(argv[1],"-nw") != 0)
00048 {
00049 std::cerr << "Usage: mathray [-nw]" << std::endl;
00050 return 1;
00051 }
00052 }
00053 else
00054 {
00055 GuiFunc = GetGuiFunc(&pGuiLibHandle);
00056 }
00057
00058 if (GuiFunc)
00059 {
00060
00061 int ReturnValue = GuiFunc(argc, argv);
00062 if (pGuiLibHandle)
00063 FreeLibrary(pGuiLibHandle);
00064 return ReturnValue;
00065 }
00066 else
00067 {
00068
00069 CCommand Com;
00070 std::string strCommand;
00071 CRenderObj surfaceobj;
00072 while(1)
00073 {
00074 Com = CCommand();
00075 strCommand = "";
00076
00077 std::cout << "< mathray > ";
00078 GetLine(std::cin, strCommand);
00079
00080 Com = CCommandParser::getInstance()->Parse(strCommand);
00081 CCommandExecutor::getInstance()->Execute(Com, surfaceobj);
00082 }
00083
00084 return 0;
00085 }
00086 }