Skip to content
This repository was archived by the owner on Nov 12, 2022. It is now read-only.

Commit 47000fa

Browse files
committed
Add wrappers for glue
1 parent 343ee62 commit 47000fa

File tree

5 files changed

+382
-367
lines changed

5 files changed

+382
-367
lines changed

src/generate_jsapi_wrappers.sh

-17
This file was deleted.

src/generate_wrappers.sh

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh
2+
# This is one big heuristic but seems to work well enough
3+
grep_heur() {
4+
grep -v "link_name" "$1" | \
5+
grep -v '"\]' | \
6+
grep -F -v '/\*\*' | \
7+
sed -z 's/,\n */, /g' | \
8+
sed -z 's/:\n */: /g' | \
9+
sed -z 's/\n *->/ ->/g' | \
10+
grep -v '^\}$' | \
11+
sed 's/^ *pub/pub/' | \
12+
sed -z 's/\;\n/\n/g' | \
13+
grep 'pub fn' | \
14+
grep Handle | \
15+
grep -v Handler | \
16+
sed 's/Handle<\*mut JSObject>/HandleObject/g'
17+
}
18+
19+
grep_heur jsapi_linux_64.rs | sed 's/\(.*\)/wrap!(jsapi \1);/g' > jsapi_wrappers.in
20+
grep_heur glue.rs | sed 's/\(.*\)/wrap!(glue \1);/g' > glue_wrappers.in

src/glue_wrappers.in

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
wrap!(glue: pub fn InvokeGetOwnPropertyDescriptor(handler: *const ::libc::c_void, cx: *mut JSContext, proxy: HandleObject, id: HandleId, desc: MutableHandle<PropertyDescriptor>) -> bool);
2+
wrap!(glue: pub fn InvokeHasOwn(handler: *const ::libc::c_void, cx: *mut JSContext, proxy: HandleObject, id: HandleId, bp: *mut bool) -> bool);
3+
wrap!(glue: pub fn CallJitGetterOp(info: *const JSJitInfo, cx: *mut JSContext, thisObj: HandleObject, specializedThis: *mut ::libc::c_void, argc: u32, vp: *mut Value) -> bool);
4+
wrap!(glue: pub fn CallJitSetterOp(info: *const JSJitInfo, cx: *mut JSContext, thisObj: HandleObject, specializedThis: *mut ::libc::c_void, argc: u32, vp: *mut Value) -> bool);
5+
wrap!(glue: pub fn CallJitMethodOp(info: *const JSJitInfo, cx: *mut JSContext, thisObj: HandleObject, specializedThis: *mut ::libc::c_void, argc: u32, vp: *mut Value) -> bool);
6+
wrap!(glue: pub fn RUST_JSID_IS_INT(id: HandleId) -> bool);
7+
wrap!(glue: pub fn RUST_JSID_TO_INT(id: HandleId) -> i32);
8+
wrap!(glue: pub fn RUST_JSID_IS_STRING(id: HandleId) -> bool);
9+
wrap!(glue: pub fn RUST_JSID_TO_STRING(id: HandleId) -> *mut JSString);

0 commit comments

Comments
 (0)