Esempio n. 1
0
// See: http://duktape.org/api.html#duk_pcompile_lstring
func (d *Context) PcompileLstring(flags uint, src string, len int) error {
	__src__ := C.CString(src)
	defer C.free(unsafe.Pointer(__src__))

	result := int(C._duk_pcompile_lstring(d.duk_context, C.duk_uint_t(flags), __src__, C.duk_size_t(len)))
	return d.castStringToError(result)
}
Esempio n. 2
0
// See: http://duktape.org/api.html#duk_push_buffer
func (d *Context) PushBuffer(size int, dynamic bool) {
	var __dynamic__ int
	if dynamic {
		__dynamic__ = 1
	}
	C._duk_push_buffer(d.duk_context, C.duk_size_t(size), C.duk_bool_t(__dynamic__))
}
Esempio n. 3
0
// See: http://duktape.org/api.html#duk_peval_lstring
func (d *Context) PevalLstring(src string, len int) error {
	__src__ := C.CString(src)
	defer C.free(unsafe.Pointer(__src__))

	result := int(C._duk_peval_lstring(d.duk_context, __src__, C.duk_size_t(len)))
	return d.castStringToError(result)

}
Esempio n. 4
0
// See: http://duktape.org/api.html#duk_push_lstring
func (d *Context) PushLstring(str string, len int) string {
	__str__ := C.CString(str)
	defer C.free(unsafe.Pointer(__str__))
	if s := C.duk_push_lstring(d.duk_context, __str__, C.duk_size_t(len)); s != nil {
		return C.GoString(s)
	}
	return ""
}
Esempio n. 5
0
// See: http://duktape.org/api.html#duk_push_dynamic_buffer
func (d *Context) PushDynamicBuffer(size int) {
	C._duk_push_dynamic_buffer(d.duk_context, C.duk_size_t(size))
}
Esempio n. 6
0
// See: http://duktape.org/api.html#duk_peval_lstring_noresult
func (d *Context) PevalLstringNoresult(src string, len int) int {
	__src__ := C.CString(src)
	defer C.free(unsafe.Pointer(__src__))
	return int(C._duk_peval_lstring_noresult(d.duk_context, __src__, C.duk_size_t(len)))
}
Esempio n. 7
0
// See: http://duktape.org/api.html#duk_eval_lstring
func (d *Context) EvalLstring(src string, len int) {
	__src__ := C.CString(src)
	defer C.free(unsafe.Pointer(__src__))
	C._duk_eval_lstring(d.duk_context, __src__, C.duk_size_t(len))
}
Esempio n. 8
0
// See: http://duktape.org/api.html#duk_compile_lstring_filename
func (d *Context) CompileLstringFilename(flags uint, src string, len int) {
	__src__ := C.CString(src)
	defer C.free(unsafe.Pointer(__src__))
	C._duk_compile_lstring_filename(d.duk_context, C.duk_uint_t(flags), __src__, C.duk_size_t(len))
}
Esempio n. 9
0
// See: http://duktape.org/api.html#duk_alloc_raw
func (d *Context) AllocRaw(size int) {
	C.duk_alloc_raw(d.duk_context, C.duk_size_t(size))
}
Esempio n. 10
0
// See: http://duktape.org/api.html#duk_substring
func (d *Context) Substring(index int, startCharOffset int, endCharOffset int) {
	C.duk_substring(d.duk_context, C.duk_idx_t(index), C.duk_size_t(startCharOffset), C.duk_size_t(endCharOffset))
}
Esempio n. 11
0
// See: http://duktape.org/api.html#duk_resize_buffer
func (d *Context) ResizeBuffer(index int, newSize int) {
	C.duk_resize_buffer(d.duk_context, C.duk_idx_t(index), C.duk_size_t(newSize))
}
Esempio n. 12
0
// See: http://duktape.org/api.html#duk_push_fixed_buffer
func (d *Context) PushFixedBuffer(size int) {
	C._duk_push_fixed_buffer(d.duk_context, C.duk_size_t(size))
}