Example #1
0
SCM guihckGuileRunExpression(guihckContext* ctx, SCM expression)
{
  threadLocalContext.ctx = ctx;
  threadLocalContext.ctxRefs += 1;

  SCM result = scm_with_guile(runExpressionInGuile, expression);
#if 0
  if(result)
  {
    char* resultStr = scm_to_utf8_string(scm_object_to_string(result, SCM_UNDEFINED));
    printf("RESULT: %s\n", resultStr);
    free(resultStr);
  }
  else
  {
    printf("RESULT: NULL\n");
  }
#endif

  threadLocalContext.ctxRefs -= 1;
  if(threadLocalContext.ctxRefs <= 0)
  {
    threadLocalContext.ctx = NULL;
    threadLocalContext.ctxRefs = 0;
  }

  return result;
}
static SCM
object_to_string (SCM obj) // variant 2
{
    SCM str = scm_object_to_string (obj, SCM_UNDEFINED);

    return str;
}
Example #3
0
void* runExpressionInGuile(void* data)
{
  SCM expression = data;
#if 0
  char* expressionStr = scm_to_utf8_string(scm_object_to_string(expression, SCM_UNDEFINED));
  printf("EXPR: %s\n", expressionStr);
  free(expressionStr);
#endif
  SCM result = scm_primitive_eval(expression);
  if(!result)
    exit(1);
  return result;
}
Example #4
0
// Does not include the template object in the string representation.
static PyObject *
pyscm_PySCM_str(pyscm_PySCMObject *self)
{
  if (0 == self->ob_scm_index) {
    return(PyString_FromString("<no SCM association>"));
  }
  SCM shandle = scm_hashv_get_handle(pyscm_registration_hash,scm_long2num(self->ob_scm_index));
  if (SCM_BOOLP(shandle) && SCM_EQ_P(SCM_BOOL_F,shandle)) {
    Py_FatalError("PySCM object lost its associated SCM object");
  }
  SCM sstr = scm_object_to_string(SCM_CADR(shandle),scm_variable_ref(scm_c_lookup("write")));

  PyObject *pstr = PyString_FromStringAndSize(SCM_STRING_CHARS(sstr),SCM_STRING_LENGTH(sstr));
  return(pstr);  // possibly NULL.
}