Files
Aurora.3/code/__defines/rust_g.dm
Werner 1762f16344 Migrate basic build to drone (#10651)
* Adds drone tasks to Execute UTs on Aurora and Exodus
* Adds a drone task to Migrate SQL and Perform the SQL UT on Runtime
* Changes the SQL UT to respect the config.sql_enabled setting and
  use that sql connection
* Changes the default config.sql_enabled state to 0, so uncommenting
  SQL_ENABLED has a actual effect
* Moves a number of UT tests into a helper script (code_check.sh)
* Updates the way the RUST_G dll/so is located
* Adds a check to load_databases to verify that sql is enabled
* Adds a check to establish_db_connection to verify that sql is enabled
* Adds spearate config files used during the UTs (which hold the UT db
  connection info and enable/disable the db epending on the UT)
2020-11-26 17:13:56 +01:00

59 lines
2.2 KiB
Plaintext

// rust_g.dm - DM API for rust_g extension library
//
// To configure, create a `rust_g.config.dm` and set what you care about from
// the following options:
//
// #define RUST_G "path/to/rust_g"
// Override the .dll/.so detection logic with a fixed path or with detection
// logic of your own.
//
// #define RUSTG_OVERRIDE_BUILTINS
// Enable replacement rust-g functions for certain builtins. Off by default.
#ifndef RUST_G
// Default automatic RUST_G detection.
// On Windows, looks in the standard places for `rust_g.dll`.
// On Linux, looks in `.`, `$LD_LIBRARY_PATH`, and `~/.byond/bin` for either of
// `librust_g.so` (preferred) or `rust_g` (old).
/* This comment bypasses grep checks */ /var/__rust_g
/proc/__detect_rust_g()
if (world.system_type == UNIX)
if (fexists("./librust_g.so"))
// No need for LD_LIBRARY_PATH badness.
return __rust_g = "./librust_g.so"
else if (fexists("./rust_g"))
// Old dumb filename.
return __rust_g = "./rust_g"
else if (fexists("[world.GetConfig("env", "HOME")]/.byond/bin/rust_g"))
// Old dumb filename in `~/.byond/bin`.
return __rust_g = "rust_g"
else
// It's not in the current directory, so try others
return __rust_g = "librust_g.so"
else
return __rust_g = "rust_g"
#define RUST_G (__rust_g || __detect_rust_g())
#endif
#define WRITE_LOG(log, text) dll_call(RUST_G, "log_write", log, text) // Using Rust g dll to log faster with less CPU usage.
#define RUSTG_JOB_NO_RESULTS_YET "NO RESULTS YET"
#define RUSTG_JOB_NO_SUCH_JOB "NO SUCH JOB"
#define RUSTG_JOB_ERROR "JOB PANICKED"
#define rustg_udp_shipper_send(addr, text) dll_call(RUST_G, "udp_shipper_send", addr, text)
#define RUSTG_HTTP_METHOD_GET "get"
#define RUSTG_HTTP_METHOD_POST "post"
#define RUSTG_HTTP_METHOD_PUT "put"
#define RUSTG_HTTP_METHOD_DELETE "delete"
#define RUSTG_HTTP_METHOD_PATCH "patch"
#define RUSTG_HTTP_METHOD_HEAD "head"
#define rustg_http_request_blocking(method, url, body, headers) dll_call(RUST_G, "http_request_blocking", method, url, body, headers)
#define rustg_http_request_async(method, url, body, headers) dll_call(RUST_G, "http_request_async", method, url, body, headers)
#define rustg_http_check_request(req_id) dll_call(RUST_G, "http_check_request", req_id)