satyr 0.43
Loading...
Searching...
No Matches
Macros | Typedefs | Enumerations | Functions
platform.h File Reference

Platform JavaScript platform. More...

#include <inttypes.h>
#include <json.h>

Go to the source code of this file.

Macros

#define SR_JS_ENGINE_VALIDITY_CHECK(engine)   (engine > 0 && engine < _SR_JS_ENGINE_UPPER_BOUND)
 
#define SR_JS_RUNTIME_VALIDITY_CHECK(runtime)   (runtime > 0 && runtime < _SR_JS_RUNTIME_UPPER_BOUND)
 
#define SR_JS_PLATFORM_NULL   0
 
#define _sr_js_platform_assemble(runtime, engine)   ((uint32_t)(runtime << 4) | engine)
 
#define sr_js_platform_new()   (_sr_js_platform_assemble(_SR_JS_RUNTIME_UNINIT, _SR_JS_ENGINE_UNINIT))
 
#define sr_js_platform_init(platform, runtime, engine)    do { platform = _sr_js_platform_assemble(runtime, engine); } while (0)
 
#define sr_js_platform_free(platform)   ((void)platform)
 
#define sr_js_platform_dup(platform)   (platform)
 
#define sr_js_platform_engine(platform)   (platform & 0xF)
 
#define sr_js_platform_runtime(platform)   (platform >> 4)
 

Typedefs

typedef uint32_t sr_js_platform_t
 

Enumerations

enum  sr_js_engine { SR_JS_ENGINE_V8 = 0x1 , _SR_JS_ENGINE_UPPER_BOUND , _SR_JS_ENGINE_UNINIT = 0xF }
 
enum  sr_js_runtime { SR_JS_RUNTIME_NODEJS = 0x1 , _SR_JS_RUNTIME_UPPER_BOUND , _SR_JS_RUNTIME_UNINIT =0xFFF }
 

Functions

const char * sr_js_engine_to_string (enum sr_js_engine engine)
 
enum sr_js_engine sr_js_engine_from_string (const char *engine)
 
const char * sr_js_runtime_to_string (enum sr_js_runtime runtime)
 
enum sr_js_runtime sr_js_runtime_from_string (const char *runtime)
 
sr_js_platform_t sr_js_platform_from_string (const char *runtime_name, const char *runtime_version, char **error_message)
 
char * sr_js_platform_to_json (sr_js_platform_t platform)
 
sr_js_platform_t sr_js_platform_from_json (json_object *root, char **error_message)
 
struct sr_js_stacktracesr_js_platform_parse_stacktrace (sr_js_platform_t platform, const char **input, struct sr_location *location)
 
struct sr_js_framesr_js_platform_parse_frame (sr_js_platform_t platform, const char **input, struct sr_location *location)
 

Detailed Description

Platform JavaScript platform.

Definition in file platform.h.

Macro Definition Documentation

◆ _sr_js_platform_assemble

#define _sr_js_platform_assemble ( runtime,
engine )   ((uint32_t)(runtime << 4) | engine)

Definition at line 91 of file platform.h.

◆ SR_JS_ENGINE_VALIDITY_CHECK

#define SR_JS_ENGINE_VALIDITY_CHECK ( engine)    (engine > 0 && engine < _SR_JS_ENGINE_UPPER_BOUND)

Definition at line 57 of file platform.h.

◆ sr_js_platform_dup

#define sr_js_platform_dup ( platform)    (platform)

Definition at line 101 of file platform.h.

◆ sr_js_platform_engine

#define sr_js_platform_engine ( platform)    (platform & 0xF)

Definition at line 103 of file platform.h.

◆ sr_js_platform_free

#define sr_js_platform_free ( platform)    ((void)platform)

Definition at line 99 of file platform.h.

◆ sr_js_platform_init

#define sr_js_platform_init ( platform,
runtime,
engine )    do { platform = _sr_js_platform_assemble(runtime, engine); } while (0)

Definition at line 96 of file platform.h.

◆ sr_js_platform_new

#define sr_js_platform_new ( )    (_sr_js_platform_assemble(_SR_JS_RUNTIME_UNINIT, _SR_JS_ENGINE_UNINIT))

Definition at line 94 of file platform.h.

◆ SR_JS_PLATFORM_NULL

#define SR_JS_PLATFORM_NULL   0

Definition at line 89 of file platform.h.

◆ sr_js_platform_runtime

#define sr_js_platform_runtime ( platform)    (platform >> 4)

Definition at line 105 of file platform.h.

◆ SR_JS_RUNTIME_VALIDITY_CHECK

#define SR_JS_RUNTIME_VALIDITY_CHECK ( runtime)    (runtime > 0 && runtime < _SR_JS_RUNTIME_UPPER_BOUND)

Definition at line 82 of file platform.h.

Typedef Documentation

◆ sr_js_platform_t

typedef uint32_t sr_js_platform_t

Definition at line 87 of file platform.h.

Enumeration Type Documentation

◆ sr_js_engine

enum sr_js_engine

Definition at line 38 of file platform.h.

◆ sr_js_runtime

enum sr_js_runtime

Definition at line 59 of file platform.h.