src/main.cpp
changeset 161 b3f0aaee735a
parent 129 86b368a4d80d
child 162 c9fa93ce2f1f
     1.1 --- a/src/main.cpp	Sun Aug 05 01:28:12 2012 -0700
     1.2 +++ b/src/main.cpp	Sun Aug 05 01:45:37 2012 -0700
     1.3 @@ -16,23 +16,12 @@
     1.4   * JITCraft. If not, see http://www.gnu.org/licenses/.
     1.5   */
     1.6  #include <stdio.h>
     1.7 -#include "Utility.h"
     1.8 -#include "Scanner.h"
     1.9 -#include "Parser.h"
    1.10 -#include "SemanticAnalysis.h"
    1.11 -#include "Zone.h"
    1.12 -#include "BytecodeCompiler.h"
    1.13 -#include "Code.h"
    1.14 -#include "Interpreter.h"
    1.15 -#include "Modules.h"
    1.16 -#include "RootScopes.h"
    1.17 +#include <stdlib.h>
    1.18  #include "../include/keima.h"
    1.19 -#include "Spaces-inl.h"
    1.20 -#include "Heap-inl.h"
    1.21  
    1.22 -using namespace ke;
    1.23 +using namespace Ke;
    1.24  
    1.25 -class MessageReporter : public Ke::IMessageReporter
    1.26 +class MessageReporter : public IMessageReporter
    1.27  {
    1.28    public:
    1.29      void onOutOfMemory() {
    1.30 @@ -41,7 +30,7 @@
    1.31      void onUncaughtException(const char *message) {
    1.32          fprintf(stderr, "Uncaught exception: %s\n", message);
    1.33  
    1.34 -        Ke::IStackFrameIterator *iter = Ke::Keima::NewStackFrameIterator();
    1.35 +        IStackFrameIterator *iter = Keima::NewStackFrameIterator();
    1.36          unsigned index = 0;
    1.37          while (!iter->done()) {
    1.38              fprintf(stderr, "[%d] %s (%s line %d)\n",
    1.39 @@ -111,26 +100,28 @@
    1.40          return 1;
    1.41      }
    1.42  
    1.43 -    if (!Ke::Keima::Initialize())
    1.44 +    if (!Keima::Initialize())
    1.45          return 1;
    1.46 -    Ke::Keima::InstallMessageReporter(&s_Reporter);
    1.47 +    Keima::InstallMessageReporter(&s_Reporter);
    1.48      {
    1.49 -        Ke::HandleScope scope;
    1.50 -        Ke::Local<Ke::Module> module = Ke::Compile(argv[1]);
    1.51 +        HandleScope scope;
    1.52 +        Local<Module> module = Compile(argv[1]);
    1.53          if (!module)
    1.54              return 1;
    1.55  
    1.56 -        //Ke::Local<Ke::Native> native = module->getNative(0);
    1.57 +	// Keima::CollectGarbage();
    1.58 +
    1.59 +        //Local<Native> native = module->getNative(0);
    1.60          //native->bind(reinterpret_cast<void *>(PrintToServer));
    1.61          //module->setNativeIdentity(reinterpret_cast<void *>(5));
    1.62  
    1.63          int result;
    1.64 -        Ke::Local<Ke::Function> fun = module->getPublic(0);
    1.65 -        if (Ke::Keima::Invoke(fun, NULL, 0, true, &result))
    1.66 +        Local<Function> fun = module->getPublic(0);
    1.67 +        if (Keima::Invoke(fun, NULL, 0, true, &result))
    1.68              printf("%d\n", result);
    1.69      }
    1.70  
    1.71 -    Ke::Keima::Shutdown();
    1.72 +    Keima::Shutdown();
    1.73  }
    1.74  
    1.75  /* Overload a few things to prevent libstdc++ linking */