search for: val_sexp

Displaying 3 results from an estimated 3 matches for "val_sexp".

Did you mean: val_sec
2009 Nov 28
1
PROTECT and OCaml GC.
...have C stub functions that are in charge of calling R for everything. Here's a simple example: > CAMLprim value r_findvar (value symbol) { > /* The findVar function is defined in envir.c. It looks up a symbol > in an environment. */ > CAMLparam1(symbol); > CAMLreturn(Val_sexp(findVar(Sexp_val(symbol), R_GlobalEnv))); > } This simply makes a call to findVar and returns the value to Objective Caml. It seems to me that I should be writing: > CAMLprim value r_findvar (value symbol) { > /* The findVar function is defined in envir.c. It looks up a symbol >...
2009 Nov 18
1
R_NilValue and segfault.
...> LibExtern SEXP R_UnboundValue; /* Unbound marker */ > LibExtern SEXP R_MissingArg; /* Missing argument marker */ So, in my r_data.c file, I have: -1- an #include directive. > #include <Rinternals.h> -2- the function wrapping R data in OCaml data > CAMLprim value Val_sexp (SEXP sexp) > { > CAMLparam0(); > CAMLlocal1(result); > result = caml_alloc(1, Abstract_tag); > Field(result, 0) = (value) sexp; > /* Do not use Val_long in the above statement, > as it will drop the top bit. See mlvalues.h. */ > CAMLreturn(result); >...
2010 Jan 07
1
Segfault in GetNewPage, memory.c.
...case PARSE_EOF: > caml_raise_with_string(*caml_named_value("Parse_incomplete"), (String_val(s))); > case PARSE_NULL: > case PARSE_ERROR: > caml_raise_with_string(*caml_named_value("Parse_error"), (String_val(s))); > } > CAMLreturn(Val_sexp(VECTOR_ELT(pr,0))); > } But before calling ParseVector, it allocates an R string with the command. > PROTECT(text = mkString(String_val(s))); It is this call to mkString which gives the segfault. String_val essentially is a macro that casts an OCaml value to a char *. > yziquel at s...