Пример #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)
}
Пример #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__))
}
Пример #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)

}
Пример #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 ""
}
Пример #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))
}
Пример #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)))
}
Пример #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))
}
Пример #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))
}
Пример #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))
}
Пример #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))
}
Пример #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))
}
Пример #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))
}