| 1 |
#ifndef RBIMPL_INTERN_RUBY_H /*-*-C++-*-vi:se ft=cpp:*/ |
| 2 |
#define RBIMPL_INTERN_RUBY_H |
| 3 |
/** |
| 4 |
* @file |
| 5 |
* @author Ruby developers <[email protected]> |
| 6 |
* @copyright This file is a part of the programming language Ruby. |
| 7 |
* Permission is hereby granted, to either redistribute and/or |
| 8 |
* modify this file, provided that the conditions mentioned in the |
| 9 |
* file COPYING are met. Consult the file for details. |
| 10 |
* @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are |
| 11 |
* implementation details. Don't take them as canon. They could |
| 12 |
* rapidly appear then vanish. The name (path) of this header file |
| 13 |
* is also an implementation detail. Do not expect it to persist |
| 14 |
* at the place it is now. Developers are free to move it anywhere |
| 15 |
* anytime at will. |
| 16 |
* @note To ruby-core: remember that this header can be possibly |
| 17 |
* recursively included from extension libraries written in C++. |
| 18 |
* Do not expect for instance `__VA_ARGS__` is always available. |
| 19 |
* We assume C99 for ruby itself but we don't assume languages of |
| 20 |
* extension libraries. They could be written in C++98. |
| 21 |
* @brief Process-global APIs. |
| 22 |
*/ |
| 23 |
#include "ruby/internal/attr/nonnull.h" |
| 24 |
#include "ruby/internal/dllexport.h" |
| 25 |
#include "ruby/internal/value.h" |
| 26 |
|
| 27 |
RBIMPL_SYMBOL_EXPORT_BEGIN() |
| 28 |
|
| 29 |
/* ruby.c */ |
| 30 |
/** @alias{rb_get_argv} */ |
| 31 |
#define rb_argv rb_get_argv() |
| 32 |
|
| 33 |
/** |
| 34 |
* The value of `$0` at process bootup. |
| 35 |
* |
| 36 |
* @note This is just a snapshot of `$0`, not the backend storage of it. `$0` |
| 37 |
* could become something different because it is a writable global |
| 38 |
* variable. Modifying it for instance affects `ps(1)` output. Don't |
| 39 |
* assume they are synced. |
| 40 |
*/ |
| 41 |
RUBY_EXTERN VALUE rb_argv0; |
| 42 |
|
| 43 |
/* io.c */ |
| 44 |
|
| 45 |
/** |
| 46 |
* Queries the arguments passed to the current process that you can access from |
| 47 |
* Ruby as `ARGV`. |
| 48 |
* |
| 49 |
* @return An array of strings containing arguments passed to the process. |
| 50 |
*/ |
| 51 |
VALUE rb_get_argv(void); |
| 52 |
|
| 53 |
/* ruby.c */ |
| 54 |
|
| 55 |
RBIMPL_ATTR_NONNULL(()) |
| 56 |
/** |
| 57 |
* Loads the given file. This function opens the given pathname for reading, |
| 58 |
* parses the contents as a Ruby script, and returns an opaque "node" pointer. |
| 59 |
* You can then pass it to ruby_run_node() for evaluation. |
| 60 |
* |
| 61 |
* @param[in] file File name, or "-" to read from stdin. |
| 62 |
* @return Opaque "node" pointer. |
| 63 |
*/ |
| 64 |
void *rb_load_file(const char *file); |
| 65 |
|
| 66 |
/** |
| 67 |
* Identical to rb_load_file(), except it takes the argument as a Ruby's string |
| 68 |
* instead of C's. |
| 69 |
* |
| 70 |
* @param[in] file File name, or "-" to read from stdin. |
| 71 |
* @return Opaque "node" pointer. |
| 72 |
*/ |
| 73 |
void *rb_load_file_str(VALUE file); |
| 74 |
|
| 75 |
RBIMPL_SYMBOL_EXPORT_END() |
| 76 |
|
| 77 |
#endif /* RBIMPL_INTERN_RUBY_H */ |