Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 64 lines (48 sloc) 1.288 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
#ifndef RBX_ENVIRONMENT_HPP
#define RBX_ENVIRONMENT_HPP

#include <string>
#include <stdexcept>

#include "vm.hpp"
#include "config_parser.hpp"
#include "configuration.hpp"

namespace rubinius {

  class ConfigParser;
  class QueryAgent;

  // throw when there is a bad signature on a kernel .rbc file.
  class BadKernelFile : public std::runtime_error {
  public:
    BadKernelFile(const std::string& str)
      : std::runtime_error(str)
    {}
  };

  class Environment {
    int argc_;
    char** argv_;

    uint64_t signature_;

  public:
    SharedState* shared;
    VM* state;
    QueryAgent* agent;

    ConfigParser config_parser;
    Configuration config;

  public:
    Environment(int argc, char** argv);
    ~Environment();

    void setup_cpp_terminate();

    void load_config_argv(int argc, char** argv);
    void load_argv(int argc, char** argv);
    void load_kernel(std::string root);
    void load_directory(std::string dir);
    void load_platform_conf(std::string dir);
    void load_conf(std::string path);
    void load_string(std::string str);
    void run_file(std::string path);
    void run_from_filesystem(std::string root);
    void boot_vm();

    void halt();
    int exit_code();
    void start_signals();
    void start_agent(int port);
  };

}

#endif
Something went wrong with that request. Please try again.