21#ifndef SATYR_JS_PLATFORM_H
22#define SATYR_JS_PLATFORM_H
42 SR_JS_ENGINE_V8 = 0x1,
50 _SR_JS_ENGINE_UPPER_BOUND,
54 _SR_JS_ENGINE_UNINIT = 0xF,
57#define SR_JS_ENGINE_VALIDITY_CHECK(engine) (engine > 0 && engine < _SR_JS_ENGINE_UPPER_BOUND)
63 SR_JS_RUNTIME_NODEJS = 0x1,
75 _SR_JS_RUNTIME_UPPER_BOUND,
79 _SR_JS_RUNTIME_UNINIT=0xFFF,
82#define SR_JS_RUNTIME_VALIDITY_CHECK(runtime) (runtime > 0 && runtime < _SR_JS_RUNTIME_UPPER_BOUND)
87typedef uint32_t sr_js_platform_t;
89#define SR_JS_PLATFORM_NULL 0
91#define _sr_js_platform_assemble(runtime, engine) ((uint32_t)(runtime << 4) | engine)
94#define sr_js_platform_new() (_sr_js_platform_assemble(_SR_JS_RUNTIME_UNINIT, _SR_JS_ENGINE_UNINIT))
96#define sr_js_platform_init(platform, runtime, engine) \
97 do { platform = _sr_js_platform_assemble(runtime, engine); } while (0)
99#define sr_js_platform_free(platform) ((void)platform)
101#define sr_js_platform_dup(platform) (platform)
103#define sr_js_platform_engine(platform) (platform & 0xF)
105#define sr_js_platform_runtime(platform) (platform >> 4)
108sr_js_engine_to_string(
enum sr_js_engine engine);
111sr_js_engine_from_string(
const char * engine);
114sr_js_runtime_to_string(
enum sr_js_runtime runtime);
117sr_js_runtime_from_string(
const char * runtime);
129sr_js_platform_from_string(
const char *runtime_name,
130 const char *runtime_version,
131 char **error_message);
134sr_js_platform_to_json(sr_js_platform_t platform);
137sr_js_platform_from_json(json_object *root,
char **error_message);
140sr_js_platform_parse_stacktrace(sr_js_platform_t platform,
const char **input,
144sr_js_platform_parse_frame(sr_js_platform_t platform,
const char **input,
A location of a parser in the input stream.