Sha256: c07a7e87ba1a737cf9787b6238c0febcab9e40b6cf9420b10bbbf0080cc068e3

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

/*
  Copyright 1999 Kazuhiro HIWADA
  Copyright 2006 Suraj N. Kurapati
  See the file named LICENSE for details.
*/

#include "main.h"
#include "relay.h"
#include <stdlib.h>
#include <stdio.h>


// load the SWIG-generated Ruby interface to VPI
#include "swig_wrap.cin"


void main_init() {
  ruby_init();
  ruby_init_loadpath();

  // load the VPI interface for Ruby
    Init_VPI();
    rb_define_module_function(mVPI, "__extension__relay_verilog", main_relay_verilog, 0);
    rb_define_module_function(mVPI, "__extension__relay_ruby_reason", main_relay_ruby_reason, 0);

    // some compilers have trouble with pointers to the va_list
    // type.  See ext/Rakefile and the user manual for details
    rb_define_alias(mVPI, "vpi_vprintf", "vpi_printf");
    rb_define_alias(mVPI, "vpi_mcd_vprintf", "vpi_mcd_printf");


  char* bootLoader = getenv("RUBYVPI_BOOT_LOADER");
  char* testLoader = getenv("RUBYVPI_TEST_LOADER");

  if (bootLoader != NULL && testLoader != NULL) {
    ruby_script(testLoader);
    rb_load_file(bootLoader);
    ruby_run();
  }
  else {
    common_printf("error: the RUBYVPI_BOOT_LOADER and RUBYVPI_TEST_LOADER environment variables must be defined.");
    exit(EXIT_FAILURE);
  }
}

VALUE main_relay_verilog(VALUE arSelf) {
  relay_verilog();
  return arSelf;
}

VALUE main_relay_ruby_reason(VALUE arSelf) {
  return SWIG_NewPointerObj(vlog_relay_ruby_reason(), SWIGTYPE_p_t_cb_data, 0);
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-vpi-20.0.0 ext/main.c