Ejemplo n.º 1
0
SCM script_ogre_attach_object(SCM s_parent, SCM s_child)
{
  void *parent = (void*)scm_to_uint64(s_parent),
       *child  = (void*)scm_to_uint64(s_child);

  ogre_attach_object(parent, child);
  return scm_from_int32(1);
}
Ejemplo n.º 2
0
SCM script_ogre_set_position(SCM s_obj, SCM s_x, SCM s_y, SCM s_z)
{
  void *obj = (void*)scm_to_uint64(s_obj);

  float x = scm_to_double(s_x), y = scm_to_double(s_y), z = scm_to_double(s_z);
  ogre_set_position(obj, x, y, z);
  return scm_from_int32(1);
}
Ejemplo n.º 3
0
SCM script_ogre_create_child_scene_node(SCM s_parent, SCM s_name)
{
  void *parent = (void*)scm_to_uint64(s_parent);
  const char *name = scm_to_locale_string(s_name);

  uint64_t ret = ogre_create_child_scene_node(parent, name);
  return scm_from_uint64(ret);
}
Ejemplo n.º 4
0
SCM guilePushElement(SCM elementSymbol)
{
  if(scm_is_integer(elementSymbol))
  {
    guihckElementId id = scm_to_uint64(elementSymbol);
    guihckStackPushElement(threadLocalContext.ctx, id);
    return SCM_BOOL_T;
  }
  else
  {
    return SCM_BOOL_F;
  }
}
Ejemplo n.º 5
0
static LLVMValueRef scm_to_llvm_value(int type, SCM scm_value)
{
  switch (type) {
    case SCM_FOREIGN_TYPE_FLOAT:
    case SCM_FOREIGN_TYPE_DOUBLE:
      return LLVMConstReal(llvm_type(type), scm_to_double(scm_value));
    case SCM_FOREIGN_TYPE_BOOL:
      return LLVMConstInt(llvm_type(type), scm_is_true(scm_value), 0);
    case SCM_FOREIGN_TYPE_UINT8:
    case SCM_FOREIGN_TYPE_UINT16:
    case SCM_FOREIGN_TYPE_UINT32:
    case SCM_FOREIGN_TYPE_UINT64:
      return LLVMConstInt(llvm_type(type), scm_to_uint64(scm_value), 0);
    case SCM_FOREIGN_TYPE_INT8:
    case SCM_FOREIGN_TYPE_INT16:
    case SCM_FOREIGN_TYPE_INT32:
    case SCM_FOREIGN_TYPE_INT64:
      return LLVMConstInt(llvm_type(type), scm_to_int64(scm_value), 1);
    default:
      return NULL;
  };
}
Ejemplo n.º 6
0
static SCM guileRemovePropertyListener(SCM listener)
{
  guihckElementRemoveListener(threadLocalContext.ctx, scm_to_uint64(listener));
  return SCM_BOOL_T;
}
Ejemplo n.º 7
0
static SCM guileAddPropertyListener(SCM element, SCM keySymbol, SCM callback)
{
  char* key = scm_to_utf8_string(scm_symbol_to_string(keySymbol));
  guihckElementId listenerId = guihckStackGetElement(threadLocalContext.ctx);
  guihckPropertyListenerId id = guihckElementAddListener(threadLocalContext.ctx, listenerId, scm_to_uint64(element), key,
                                                         guilePropertyListenerCallback, callback, guilePropertyListenerFreeCallback);
  scm_gc_protect_object(callback);
  free(key);
  return scm_from_uint64(id);
}