mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
missing files
This commit is contained in:
parent
7bf5361a9a
commit
fab592ce74
3 changed files with 47 additions and 0 deletions
3
src/servo/content/jsnames.rs
Normal file
3
src/servo/content/jsnames.rs
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
type name_pool = {
|
||||||
|
|
||||||
|
};
|
27
src/servo/content/jsutil.rs
Normal file
27
src/servo/content/jsutil.rs
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
import spidermonkey::jsapi::{JSContext, jsval};
|
||||||
|
|
||||||
|
impl methods<T: copy> for *T {
|
||||||
|
unsafe fn +(idx: uint) -> *T {
|
||||||
|
ptr::offset(self, idx)
|
||||||
|
}
|
||||||
|
unsafe fn [](idx: uint) -> T {
|
||||||
|
*(self + idx)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const JSVAL_VOID: u64 = 0x0001fff2_00000000_u64;
|
||||||
|
const JSVAL_NULL: u64 = 0x0001fff6_00000000_u64;
|
||||||
|
const JSVAL_ZERO: u64 = 0x0001fff1_00000000_u64;
|
||||||
|
const JSVAL_ONE: u64 = 0x0001fff1_00000001_u64;
|
||||||
|
const JSVAL_FALSE: u64 = 0x0001fff3_00000000_u64;
|
||||||
|
const JSVAL_TRUE: u64 = 0x0001fff3_00000001_u64;
|
||||||
|
|
||||||
|
unsafe fn JS_ARGV(_cx: *JSContext, vp: *jsval) -> *jsval {
|
||||||
|
vp + 2u
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn JS_SET_RVAL(_cx: *JSContext, vp: *jsval, v: jsval) {
|
||||||
|
let vp: *mut jsval = unsafe::reinterpret_cast(vp);
|
||||||
|
*vp = v;
|
||||||
|
}
|
||||||
|
|
17
src/servo/content/name_pool.rs
Normal file
17
src/servo/content/name_pool.rs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
import libc::c_char;
|
||||||
|
|
||||||
|
type name_pool = @{
|
||||||
|
mut strbufs: [str]
|
||||||
|
};
|
||||||
|
|
||||||
|
fn name_pool() -> name_pool {
|
||||||
|
@{mut strbufs: []}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl methods for name_pool {
|
||||||
|
fn add(-s: str) -> *c_char {
|
||||||
|
let c_str = str::as_c_str(s) { |bytes| bytes };
|
||||||
|
self.strbufs += [s]; // in theory, this should *move* the str in here..
|
||||||
|
ret c_str; // ...and so this ptr ought to be valid.
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue