static Lisp_Object
x_get_local_selection (Lisp_Object selection_symbol, Lisp_Object target_type,
		       int local_request, struct mac_display_info *dpyinfo)
{
  Lisp_Object local_value;
  Lisp_Object handler_fn, value, type, check;

  if (!x_selection_owner_p (selection_symbol, dpyinfo))
    return Qnil;

  local_value = LOCAL_SELECTION (selection_symbol, dpyinfo);

  /* TIMESTAMP is a special case.  */
  if (EQ (target_type, QTIMESTAMP))
    {
      handler_fn = Qnil;
      value = XCAR (XCDR (XCDR (local_value)));
    }
  else
    {
      /* Don't allow a quit within the converter.
	 When the user types C-g, he would be surprised
	 if by luck it came during a converter.  */
      ptrdiff_t count = SPECPDL_INDEX ();
      specbind (Qinhibit_quit, Qt);

      CHECK_SYMBOL (target_type);
      handler_fn = Fcdr (Fassq (target_type, Vselection_converter_alist));
      /* gcpro is not needed here since nothing but HANDLER_FN
	 is live, and that ought to be a symbol.  */

      if (!NILP (handler_fn))
	value = call3 (handler_fn,
		       selection_symbol, (local_request ? Qnil : target_type),
		       XCAR (XCDR (local_value)));
      else
	value = Qnil;
      unbind_to (count, Qnil);
    }

  if (local_request)
    return value;

  /* Make sure this value is of a type that we could transmit
     to another application.  */

  type = target_type;
  check = value;
  if (CONSP (value)
      && SYMBOLP (XCAR (value)))
    type = XCAR (value),
    check = XCDR (value);

  if (NILP (value) || mac_valid_selection_value_p (check, type))
    return value;

  signal_error ("Invalid data returned by selection-conversion function",
		list2 (handler_fn, value));
}
Exemple #2
0
int main(int argc, char *argv[])
{
    call0();
    call1();
    call2(0,0,0,0,0,0,0,0,0);
    call3();
    call4();
}
Exemple #3
0
int main() {
	CallHandler handler;

	handler.employ(new Fresher("Lily"));
	handler.employ(new Fresher("Ben"));
	handler.employ(new Fresher("Carlos"));
	handler.employ(new Fresher("David"));
	handler.employ(new Fresher("Thomas"));
	handler.employ(new TechLead("Anglela"));
	handler.employ(new ProductManager("Benson"));

	Call call1_1(CallHandler::FRESHER);
	Call call1_2(CallHandler::FRESHER);
	Call call1_3(CallHandler::FRESHER);
	Call call1_4(CallHandler::FRESHER);
	Call call1_5(CallHandler::FRESHER);
	Call call2(CallHandler::TECHLEAD);
	Call call3(CallHandler::TECHLEAD);
	Call call4(CallHandler::PRODUCTMANAGER);

	handler.dispatchCall(&call1_1);
	handler.dispatchCall(&call1_2);
	handler.dispatchCall(&call1_3);
	handler.dispatchCall(&call1_4);
	handler.dispatchCall(&call1_5);
	handler.dispatchCall(&call2);
	handler.dispatchCall(&call3);
	handler.dispatchCall(&call4);

	call1_1.disconnect();
	call2.complain();
	call3.disconnect();

	// Call Handler updates and dispatch Call4 to ProductManager
	handler.update();
	call4.disconnect();

	// Call Handler updates and dispatch Call2 to ProductManager
	handler.update();

	// Complain again, product manager just give up ...
	call2.complain();

	// ...

	return 0;
}
Exemple #4
0
void
main (void)
{

  call1 (uchar0);
  call2 (uint0);
  uchar1 = call3 ();
  uint1 = call4 ();
  if (uint1)
    failures++;

  uint1 = call5 (uint0);
  if (uint1)
    failures++;

  if(call6(uchar0))
    failures++;


  if(call7(0))
    failures++;

  if(!call7(1))
    failures++;

  if(!call7(0xff00))
    failures++;

  uchar0=4;
  uchar1=3;
  uchar0 = call8(uchar0,uchar1);

  if(uchar0 != 7)
    failures++;

  call9(0x1234,0x5678);

  done ();
}
Exemple #5
0
void call2(void)
{
	printk("Inside call2\r\n");
	call3();
}
Exemple #6
0
 Crasher(void) { 
     str = nullptr; 
     call3(); 
 }
static void
x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value,
		 Lisp_Object frame)
{
  struct frame *f = XFRAME (frame);
  struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f);
  Time timestamp = last_event_timestamp;
  OSStatus err;
  Selection sel;
  struct gcpro gcpro1, gcpro2;
  Lisp_Object rest, handler_fn, value, target_type;

  GCPRO2 (selection_name, selection_value);

  block_input ();

  err = mac_get_selection_from_symbol (selection_name, 1, &sel);
  if (err == noErr && sel)
    {
      /* Don't allow a quit within the converter.
	 When the user types C-g, he would be surprised
	 if by luck it came during a converter.  */
      ptrdiff_t count = SPECPDL_INDEX ();
      specbind (Qinhibit_quit, Qt);

      for (rest = Vselection_converter_alist; CONSP (rest); rest = XCDR (rest))
	{
	  if (!(CONSP (XCAR (rest))
		&& (target_type = XCAR (XCAR (rest)),
		    SYMBOLP (target_type))
		&& mac_valid_selection_target_p (target_type)
		&& (handler_fn = XCDR (XCAR (rest)),
		    SYMBOLP (handler_fn))))
	    continue;

	  if (!NILP (handler_fn))
	    value = call3 (handler_fn, selection_name,
			   target_type, selection_value);
	  else
	    value = Qnil;

	  if (NILP (value))
	    continue;

	  if (mac_valid_selection_value_p (value, target_type))
	    err = mac_put_selection_value (sel, target_type, value);
	  else if (CONSP (value)
		   && EQ (XCAR (value), target_type)
		   && mac_valid_selection_value_p (XCDR (value), target_type))
	    err = mac_put_selection_value (sel, target_type, XCDR (value));
	}

      unbind_to (count, Qnil);
    }

  unblock_input ();

  UNGCPRO;

  if (sel && err != noErr)
    error ("Can't set selection");

  /* Now update the local cache */
  {
    Lisp_Object selection_data;
    Lisp_Object ownership_info;
    Lisp_Object prev_value;

    if (sel)
      {
	block_input ();
	ownership_info = mac_get_selection_ownership_info (sel);
	unblock_input ();
      }
    else
      ownership_info = Qnil; 	/* dummy value for local-only selection */
    selection_data = list5 (selection_name, selection_value,
			    INTEGER_TO_CONS (timestamp), frame, ownership_info);
    prev_value = LOCAL_SELECTION (selection_name, dpyinfo);

    tset_selection_alist
      (dpyinfo->terminal,
       Fcons (selection_data, dpyinfo->terminal->Vselection_alist));

    /* If we already owned the selection, remove the old selection
       data.  Don't use Fdelq as that may QUIT.  */
    if (!NILP (prev_value))
      {
	/* We know it's not the CAR, so it's easy.  */
	Lisp_Object rest = dpyinfo->terminal->Vselection_alist;
	for (; CONSP (rest); rest = XCDR (rest))
	  if (EQ (prev_value, Fcar (XCDR (rest))))
	    {
	      XSETCDR (rest, XCDR (XCDR (rest)));
	      break;
	    }
      }
  }
}