Sha256: 6fa6a9619f9221e05f824d42ca120e4fdcb926133b37048d018ac73cfb75b078

Contents?: true

Size: 1.36 KB

Versions: 4

Compression:

Stored size: 1.36 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, "relay_verilog", main_relay_verilog, 0);
    rb_define_module_function(mVpi, "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* bootTarget = getenv("RUBYVPI_BOOT_TARGET");

  if (bootLoader != NULL && bootTarget != NULL) {
    ruby_script(bootTarget);
    rb_load_file(bootLoader);
    ruby_run();
  }
  else {
    common_printf("error: the RUBYVPI_BOOT_LOADER and RUBYVPI_BOOT_TARGET environment variables are not initialized.");
    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

4 entries across 4 versions & 1 rubygems

Version Path
ruby-vpi-18.0.0 ext/main.c
ruby-vpi-17.0.0 ext/main.c
ruby-vpi-18.0.1 ext/main.c
ruby-vpi-18.0.2 ext/main.c