예제 #1
0
Scheme_Object *
rdbus_call_method (int i, Scheme_Object *proc, Scheme_Object *list )
{
  //This is the final return value that will be saved in memory after calling Gimp Server 
  GVariant *frvalue;
  // Intermediary return value for helper method return for scheme to gvariant
  GVariant *ivalue;
  // returning the string of the method name
  const char *methodname;
  //saving the error in memory
  GError *error;
  //final Scheme_Object
  Scheme_Object *fobject;
  //Our GDBusProxy Object
  GDBusProxy *proxy;
  
  
  if (i == 0)
    { 
      proxy = Proxyobj; 
      ivalue = scheme_obj_to_gvariant (list);
      // the method is converted into string here
      methodname = tostring (proc);
      fprintf (stderr, "Calling %s\n", methodname);
      frvalue = g_dbus_proxy_call_sync (proxy, methodname, ivalue, 0, -1, NULL, &error);
      fobject = gvariant_to_schemeobj (frvalue);
      return fobject;
    } // if (i == 0)
 
  else // if (i != 0)
    {
      return scheme_make_utf8_string("There is sth wrong with the Proxy Object");
    } // if (i != 0)
} // rdbus_call_method
예제 #2
0
Scheme_Object *
gvariant_to_schemeobj (GVariant *ivalue)
{
  Scheme_Object *fvalue = NULL;
  const gchar *fstring;
  gsize length;
  gsize *plength;
  gint64 r1;
  

  length = g_variant_get_size(ivalue);
  plength = &length;

  if (g_variant_is_of_type (ivalue, G_VARIANT_TYPE_INT64))
    { 
      g_variant_get (ivalue,"(i)", &r1);
      fvalue = scheme_make_integer_value(r1);
      return fvalue;
    }

  else if (g_variant_is_of_type (ivalue,G_VARIANT_TYPE_STRING))
    {
      fstring = g_variant_get_string (ivalue, plength);
      fvalue = scheme_make_utf8_string (fstring);
      return fvalue;
    }

  return fvalue;
    
  


}
예제 #3
0
파일: rdbus.c 프로젝트: ZarniHtet13/Client
Scheme_Object *
rdbus_call_method (int i, Scheme_Object *proc, Scheme_Object *list )
{
  //This is the final return value that will be saved in memory after calling Gimp Server 
  GVariant *frvalue;
  // Intermediary return value for helper method return for scheme to gvariant
  GVariant *ivalue;
  // returning the string of the method name
  const char *methodname;
  //saving the error in memory
  GError *error;
  //final Scheme_Object
  Scheme_Object *fobject;
  //Our GDBusProxy Object
  GDBusProxy *proxy;
  //Scheme_Object actual list
  // Scheme_Object *alist;
  
  
  
  if (i == 0)
    { 
      proxy = Proxyobj; 
      fprintf (stderr, "Before crashing\n");
      ivalue = scheme_obj_to_gvariant (list);
      // the method is converted into string here
      methodname = tostring (proc);
     // scheme_signal_error("callerror");
      fprintf (stderr, "after method name\n");
      //  scheme_signal_error ("methodnamepassed");
      error = NULL;
      frvalue = g_dbus_proxy_call_sync (proxy, methodname, ivalue, 0, -1, NULL, &error);
      fprintf (stderr, "after calling gdbus\n");
      if (frvalue == NULL)
        {
	  fprintf (stderr, "Call to %s failed ", methodname);
	  if (error != NULL)
	    fprintf (stderr, "because %s.\n", error->message);
	  else
	    fprintf (stderr, "for an unknown reason.\n");
	  return scheme_void;
	  } // if (frvalue == NULL) 
      // scheme_signal_error ("calling gimp");
      //scheme_signal_error("newerror");
      fobject = gvariant_to_schemeobj (frvalue);
      fprintf (stderr, "after calling gvariant_to_schemeobj\n");
      //scheme_signal_error ("getting the scheme object back");
      // scheme_signal_error("lasterror");
      return fobject;
    } // if (i == 0)
 
  else // if (i != 0)
    {
      return scheme_make_utf8_string("There is sth wrong with the Proxy Object");
    } // if (i != 0)
} // rdbus_call_method
예제 #4
0
static Scheme_Object *list_devices(int argc, Scheme_Object **argv)
{
const PmDeviceInfo *info; // portMidi device info
Scheme_Object *output_list;

  /*
   * Use PortMidi info to build an array of device info objects
   */
  Scheme_Object *device_info[Pm_CountDevices()];

  /* device info object with details about the device:
   *  int index
   *  string direction -->  IN or OUT
   *  string name
   */
  Scheme_Object *device_info_detail[Pm_CountDevices()][3];

  // Build a list of lists
  for(int d=0;d<Pm_CountDevices();d++)
  {
    device_info_detail[d][0]=scheme_make_integer(d);
    info = Pm_GetDeviceInfo(d);

    if(info->input > 0)
      device_info_detail[d][1]=scheme_make_utf8_string("IN");
    else if(info->output > 0)
      device_info_detail[d][1]=scheme_make_utf8_string("OUT");
    else
      device_info_detail[d][1]=scheme_make_utf8_string("-");

    device_info_detail[d][2]=scheme_make_utf8_string(info->name);

    device_info[d]=scheme_build_list(3,device_info_detail[d]);
  } // for

  output_list=scheme_build_list(Pm_CountDevices(),device_info);

  return output_list;
} // list_devices()
예제 #5
0
Scheme_Object *scheme_reload(Scheme_Env *env)
{
  /* When the extension is loaded, return a Scheme string: */
  return scheme_make_utf8_string("Hello, world!");
}
예제 #6
0
파일: embed-me8.c 프로젝트: 97jaz/racket
Scheme_Object *ex(int argc, Scheme_Object **argv)
{
  return scheme_make_utf8_string("Hello, world!");
}