Replace calls to AS_CHARACTER with new static function coerce_to_char.
The new function checks that the R object is coercible and therefore
ensures we don't throw an error in R code which involves a longjmp
and subsequent crash in postgres.

In passing generate body of R function in slightly cleaner fashion,
and include the return value from R_PARSEVECTOR inside the PROTECT()
macro in plr_parse_func_body().