<commit_before>#ifndef _JSC_PERL_H_
#define _JSC_PERL_H_

#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#include <JavaScriptCore/JavaScript.h>


#define JSGlobalContext JSGlobalContextRef
#define JSContextGroup  JSContextGroupRef
#define JSContext       JSContextRef
#define JSValue         JSValueRef
#define JSObject        JSObjectRef


typedef struct _JSPValue {
    JSContext ctx;
    JSValue   val;
} JSPValue;

typedef struct _JSPObject {
    JSContext ctx;
    JSObject  obj;
} JSPObject;

#define jsc_perl_sv_is_ref(sv) (jsc_perl_sv_is_defined(sv) && SvROK(sv))
#define JSC_PERL_CALL_BOOT(name) jsc_perl_call_xs(aTHX_ name, cv, mark);


const char* jsc_perl_get_type (JSContextRef ctx, JSValueRef value);
char* jsc_perl_js_str_to_str (JSStringRef js_str);
char* jsc_perl_js_value_to_json (JSContextRef ctx, JSValueRef value);
SV* jsc_perl_js_value_to_sv (JSContextRef ctx, JSValueRef value);
bool jsc_perl_sv_is_defined (SV *sv);
void jsc_perl_call_xs (pTHX_ XSPROTO(subaddr), CV *cv, SV **mark);
void jsc_perl_throw_exception (JSContext ctx, JSValueRef exception);


#endif /* _JSC_PERL_H_ */
<commit_msg>Add jsc_sv_to_js<commit_after>#ifndef _JSC_PERL_H_
#define _JSC_PERL_H_

#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#include <JavaScriptCore/JavaScript.h>


#define JSGlobalContext JSGlobalContextRef
#define JSContextGroup  JSContextGroupRef
#define JSContext       JSContextRef
#define JSValue         JSValueRef
#define JSObject        JSObjectRef


typedef struct _JSPValue {
    JSContext ctx;
    JSValue   val;
} JSPValue;

typedef struct _JSPObject {
    JSContext ctx;
    JSObject  obj;
} JSPObject;

#define jsc_perl_sv_is_ref(sv)    (jsc_perl_sv_is_defined(sv) && SvROK(sv))
#define jsc_sv_to_js(TYPE, VAR)   (jsc_perl_sv_is_ref(VAR) ? INT2PTR(TYPE, SvIV(SvRV(VAR))) : NULL)
#define JSC_PERL_CALL_BOOT(name)  jsc_perl_call_xs(aTHX_ name, cv, mark)


const char* jsc_perl_get_type (JSContextRef ctx, JSValueRef value);
char* jsc_perl_js_str_to_str (JSStringRef js_str);
char* jsc_perl_js_value_to_json (JSContextRef ctx, JSValueRef value);
SV* jsc_perl_js_value_to_sv (JSContextRef ctx, JSValueRef value);
bool jsc_perl_sv_is_defined (SV *sv);
void jsc_perl_call_xs (pTHX_ XSPROTO(subaddr), CV *cv, SV **mark);
void jsc_perl_throw_exception (JSContext ctx, JSValueRef exception);


#endif /* _JSC_PERL_H_ */

{'fraction_non_alphanumeric': 0.0899067005937235, 'fraction_numerical': 0.00042408821034775233, 'mean_word_length': 5.877551020408164, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2033805', 'n_tokens_mistral': 965, 'n_tokens_neox': 923, 'n_words': 200}