aboutsummaryrefslogtreecommitdiffstats
path: root/src/xselect.c
diff options
context:
space:
mode:
authorKen Raeburn1999-09-12 07:05:34 +0000
committerKen Raeburn1999-09-12 07:05:34 +0000
commit8e713be64cb396e4fa30d8a393987b77d6cd99f6 (patch)
tree8ca8beed123bcd05a9849f9a575fbc73ca17edad /src/xselect.c
parent70949dac51f3e975477e6b1a38cc78625efc4a40 (diff)
downloademacs-8e713be64cb396e4fa30d8a393987b77d6cd99f6.tar.gz
emacs-8e713be64cb396e4fa30d8a393987b77d6cd99f6.zip
Use XCAR and XCDR instead of explicit member references.
Diffstat (limited to 'src/xselect.c')
-rw-r--r--src/xselect.c134
1 files changed, 67 insertions, 67 deletions
diff --git a/src/xselect.c b/src/xselect.c
index 6219483eac7..ba7b7063f9c 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -278,9 +278,9 @@ x_own_selection (selection_name, selection_value)
278 { 278 {
279 Lisp_Object rest; /* we know it's not the CAR, so it's easy. */ 279 Lisp_Object rest; /* we know it's not the CAR, so it's easy. */
280 for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest)) 280 for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest))
281 if (EQ (prev_value, Fcar (XCONS (rest)->cdr))) 281 if (EQ (prev_value, Fcar (XCDR (rest))))
282 { 282 {
283 XCONS (rest)->cdr = Fcdr (XCONS (rest)->cdr); 283 XCDR (rest) = Fcdr (XCDR (rest));
284 break; 284 break;
285 } 285 }
286 } 286 }
@@ -311,7 +311,7 @@ x_get_local_selection (selection_symbol, target_type)
311 if (EQ (target_type, QTIMESTAMP)) 311 if (EQ (target_type, QTIMESTAMP))
312 { 312 {
313 handler_fn = Qnil; 313 handler_fn = Qnil;
314 value = XCONS (XCONS (XCONS (local_value)->cdr)->cdr)->car; 314 value = XCAR (XCDR (XCDR (local_value)));
315 } 315 }
316#if 0 316#if 0
317 else if (EQ (target_type, QDELETE)) 317 else if (EQ (target_type, QDELETE))
@@ -319,19 +319,19 @@ x_get_local_selection (selection_symbol, target_type)
319 handler_fn = Qnil; 319 handler_fn = Qnil;
320 Fx_disown_selection_internal 320 Fx_disown_selection_internal
321 (selection_symbol, 321 (selection_symbol,
322 XCONS (XCONS (XCONS (local_value)->cdr)->cdr)->car); 322 XCAR (XCDR (XCDR (local_value))));
323 value = QNULL; 323 value = QNULL;
324 } 324 }
325#endif 325#endif
326 326
327#if 0 /* #### MULTIPLE doesn't work yet */ 327#if 0 /* #### MULTIPLE doesn't work yet */
328 else if (CONSP (target_type) 328 else if (CONSP (target_type)
329 && XCONS (target_type)->car == QMULTIPLE) 329 && XCAR (target_type) == QMULTIPLE)
330 { 330 {
331 Lisp_Object pairs; 331 Lisp_Object pairs;
332 int size; 332 int size;
333 int i; 333 int i;
334 pairs = XCONS (target_type)->cdr; 334 pairs = XCDR (target_type);
335 size = XVECTOR (pairs)->size; 335 size = XVECTOR (pairs)->size;
336 /* If the target is MULTIPLE, then target_type looks like 336 /* If the target is MULTIPLE, then target_type looks like
337 (MULTIPLE . [[SELECTION1 TARGET1] [SELECTION2 TARGET2] ... ]) 337 (MULTIPLE . [[SELECTION1 TARGET1] [SELECTION2 TARGET2] ... ])
@@ -362,7 +362,7 @@ x_get_local_selection (selection_symbol, target_type)
362 if (!NILP (handler_fn)) 362 if (!NILP (handler_fn))
363 value = call3 (handler_fn, 363 value = call3 (handler_fn,
364 selection_symbol, target_type, 364 selection_symbol, target_type,
365 XCONS (XCONS (local_value)->cdr)->car); 365 XCAR (XCDR (local_value)));
366 else 366 else
367 value = Qnil; 367 value = Qnil;
368 unbind_to (count, Qnil); 368 unbind_to (count, Qnil);
@@ -373,9 +373,9 @@ x_get_local_selection (selection_symbol, target_type)
373 373
374 check = value; 374 check = value;
375 if (CONSP (value) 375 if (CONSP (value)
376 && SYMBOLP (XCONS (value)->car)) 376 && SYMBOLP (XCAR (value)))
377 type = XCONS (value)->car, 377 type = XCAR (value),
378 check = XCONS (value)->cdr; 378 check = XCDR (value);
379 379
380 if (STRINGP (check) 380 if (STRINGP (check)
381 || VECTORP (check) 381 || VECTORP (check)
@@ -385,12 +385,12 @@ x_get_local_selection (selection_symbol, target_type)
385 return value; 385 return value;
386 /* Check for a value that cons_to_long could handle. */ 386 /* Check for a value that cons_to_long could handle. */
387 else if (CONSP (check) 387 else if (CONSP (check)
388 && INTEGERP (XCONS (check)->car) 388 && INTEGERP (XCAR (check))
389 && (INTEGERP (XCONS (check)->cdr) 389 && (INTEGERP (XCDR (check))
390 || 390 ||
391 (CONSP (XCONS (check)->cdr) 391 (CONSP (XCDR (check))
392 && INTEGERP (XCONS (XCONS (check)->cdr)->car) 392 && INTEGERP (XCAR (XCDR (check)))
393 && NILP (XCONS (XCONS (check)->cdr)->cdr)))) 393 && NILP (XCDR (XCDR (check))))))
394 return value; 394 return value;
395 else 395 else
396 return 396 return
@@ -687,7 +687,7 @@ x_handle_selection_request (event)
687 } 687 }
688 688
689 local_selection_time = (Time) 689 local_selection_time = (Time)
690 cons_to_long (XCONS (XCONS (XCONS (local_selection_data)->cdr)->cdr)->car); 690 cons_to_long (XCAR (XCDR (XCDR (local_selection_data))));
691 691
692 if (SELECTION_EVENT_TIME (event) != CurrentTime 692 if (SELECTION_EVENT_TIME (event) != CurrentTime
693 && local_selection_time > SELECTION_EVENT_TIME (event)) 693 && local_selection_time > SELECTION_EVENT_TIME (event))
@@ -799,7 +799,7 @@ x_handle_selection_clear (event)
799 if (NILP (local_selection_data)) return; 799 if (NILP (local_selection_data)) return;
800 800
801 local_selection_time = (Time) 801 local_selection_time = (Time)
802 cons_to_long (XCONS (XCONS (XCONS (local_selection_data)->cdr)->cdr)->car); 802 cons_to_long (XCAR (XCDR (XCDR (local_selection_data))));
803 803
804 /* This SelectionClear is for a selection that we no longer own, so we can 804 /* This SelectionClear is for a selection that we no longer own, so we can
805 disregard it. (That is, we have reasserted the selection since this 805 disregard it. (That is, we have reasserted the selection since this
@@ -818,9 +818,9 @@ x_handle_selection_clear (event)
818 { 818 {
819 Lisp_Object rest; 819 Lisp_Object rest;
820 for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest)) 820 for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest))
821 if (EQ (local_selection_data, Fcar (XCONS (rest)->cdr))) 821 if (EQ (local_selection_data, Fcar (XCDR (rest))))
822 { 822 {
823 XCONS (rest)->cdr = Fcdr (XCONS (rest)->cdr); 823 XCDR (rest) = Fcdr (XCDR (rest));
824 break; 824 break;
825 } 825 }
826 } 826 }
@@ -881,13 +881,13 @@ x_clear_frame_selections (f)
881 881
882 /* Delete elements after the beginning of Vselection_alist. */ 882 /* Delete elements after the beginning of Vselection_alist. */
883 for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest)) 883 for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest))
884 if (EQ (frame, Fcar (Fcdr (Fcdr (Fcdr (Fcar (XCONS (rest)->cdr))))))) 884 if (EQ (frame, Fcar (Fcdr (Fcdr (Fcdr (Fcar (XCDR (rest))))))))
885 { 885 {
886 /* Let random Lisp code notice that the selection has been stolen. */ 886 /* Let random Lisp code notice that the selection has been stolen. */
887 Lisp_Object hooks, selection_symbol; 887 Lisp_Object hooks, selection_symbol;
888 888
889 hooks = Vx_lost_selection_hooks; 889 hooks = Vx_lost_selection_hooks;
890 selection_symbol = Fcar (Fcar (XCONS (rest)->cdr)); 890 selection_symbol = Fcar (Fcar (XCDR (rest)));
891 891
892 if (!EQ (hooks, Qunbound)) 892 if (!EQ (hooks, Qunbound))
893 { 893 {
@@ -897,7 +897,7 @@ x_clear_frame_selections (f)
897 redisplay_preserve_echo_area (); 897 redisplay_preserve_echo_area ();
898#endif 898#endif
899 } 899 }
900 XCONS (rest)->cdr = Fcdr (XCONS (rest)->cdr); 900 XCDR (rest) = Fcdr (XCDR (rest));
901 break; 901 break;
902 } 902 }
903} 903}
@@ -975,8 +975,8 @@ wait_for_property_change_unwind (identifierval)
975 Lisp_Object identifierval; 975 Lisp_Object identifierval;
976{ 976{
977 unexpect_property_change ((struct prop_location *) 977 unexpect_property_change ((struct prop_location *)
978 (XFASTINT (XCONS (identifierval)->car) << 16 978 (XFASTINT (XCAR (identifierval)) << 16
979 | XFASTINT (XCONS (identifierval)->cdr))); 979 | XFASTINT (XCDR (identifierval))));
980 return Qnil; 980 return Qnil;
981} 981}
982 982
@@ -992,13 +992,13 @@ wait_for_property_change (location)
992 Lisp_Object tem; 992 Lisp_Object tem;
993 993
994 tem = Fcons (Qnil, Qnil); 994 tem = Fcons (Qnil, Qnil);
995 XSETFASTINT (XCONS (tem)->car, (EMACS_UINT)location >> 16); 995 XSETFASTINT (XCAR (tem), (EMACS_UINT)location >> 16);
996 XSETFASTINT (XCONS (tem)->cdr, (EMACS_UINT)location & 0xffff); 996 XSETFASTINT (XCDR (tem), (EMACS_UINT)location & 0xffff);
997 997
998 /* Make sure to do unexpect_property_change if we quit or err. */ 998 /* Make sure to do unexpect_property_change if we quit or err. */
999 record_unwind_protect (wait_for_property_change_unwind, tem); 999 record_unwind_protect (wait_for_property_change_unwind, tem);
1000 1000
1001 XCONS (property_change_reply)->car = Qnil; 1001 XCAR (property_change_reply) = Qnil;
1002 1002
1003 property_change_reply_object = location; 1003 property_change_reply_object = location;
1004 /* If the event we are waiting for arrives beyond here, it will set 1004 /* If the event we are waiting for arrives beyond here, it will set
@@ -1009,7 +1009,7 @@ wait_for_property_change (location)
1009 usecs = (x_selection_timeout % 1000) * 1000; 1009 usecs = (x_selection_timeout % 1000) * 1000;
1010 wait_reading_process_input (secs, usecs, property_change_reply, 0); 1010 wait_reading_process_input (secs, usecs, property_change_reply, 0);
1011 1011
1012 if (NILP (XCONS (property_change_reply)->car)) 1012 if (NILP (XCAR (property_change_reply)))
1013 error ("Timed out waiting for property-notify event"); 1013 error ("Timed out waiting for property-notify event");
1014 } 1014 }
1015 1015
@@ -1043,7 +1043,7 @@ x_handle_property_notify (event)
1043 /* If this is the one wait_for_property_change is waiting for, 1043 /* If this is the one wait_for_property_change is waiting for,
1044 tell it to wake up. */ 1044 tell it to wake up. */
1045 if (rest == property_change_reply_object) 1045 if (rest == property_change_reply_object)
1046 XCONS (property_change_reply)->car = Qt; 1046 XCAR (property_change_reply) = Qt;
1047 1047
1048 if (prev) 1048 if (prev)
1049 prev->next = rest->next; 1049 prev->next = rest->next;
@@ -1092,7 +1092,7 @@ copy_multiple_data (obj)
1092 int i; 1092 int i;
1093 int size; 1093 int size;
1094 if (CONSP (obj)) 1094 if (CONSP (obj))
1095 return Fcons (XCONS (obj)->car, copy_multiple_data (XCONS (obj)->cdr)); 1095 return Fcons (XCAR (obj), copy_multiple_data (XCDR (obj)));
1096 1096
1097 CHECK_VECTOR (obj, 0); 1097 CHECK_VECTOR (obj, 0);
1098 vec = Fmake_vector (size = XVECTOR (obj)->size, Qnil); 1098 vec = Fmake_vector (size = XVECTOR (obj)->size, Qnil);
@@ -1140,7 +1140,7 @@ x_get_foreign_selection (selection_symbol, target_type)
1140 Lisp_Object frame; 1140 Lisp_Object frame;
1141 1141
1142 if (CONSP (target_type)) 1142 if (CONSP (target_type))
1143 type_atom = symbol_to_x_atom (dpyinfo, display, XCONS (target_type)->car); 1143 type_atom = symbol_to_x_atom (dpyinfo, display, XCAR (target_type));
1144 else 1144 else
1145 type_atom = symbol_to_x_atom (dpyinfo, display, target_type); 1145 type_atom = symbol_to_x_atom (dpyinfo, display, target_type);
1146 1146
@@ -1153,7 +1153,7 @@ x_get_foreign_selection (selection_symbol, target_type)
1153 /* Prepare to block until the reply has been read. */ 1153 /* Prepare to block until the reply has been read. */
1154 reading_selection_window = requestor_window; 1154 reading_selection_window = requestor_window;
1155 reading_which_selection = selection_atom; 1155 reading_which_selection = selection_atom;
1156 XCONS (reading_selection_reply)->car = Qnil; 1156 XCAR (reading_selection_reply) = Qnil;
1157 1157
1158 frame = some_frame_on_display (dpyinfo); 1158 frame = some_frame_on_display (dpyinfo);
1159 1159
@@ -1179,9 +1179,9 @@ x_get_foreign_selection (selection_symbol, target_type)
1179 x_uncatch_errors (display, count); 1179 x_uncatch_errors (display, count);
1180 UNBLOCK_INPUT; 1180 UNBLOCK_INPUT;
1181 1181
1182 if (NILP (XCONS (reading_selection_reply)->car)) 1182 if (NILP (XCAR (reading_selection_reply)))
1183 error ("Timed out waiting for reply from selection owner"); 1183 error ("Timed out waiting for reply from selection owner");
1184 if (EQ (XCONS (reading_selection_reply)->car, Qlambda)) 1184 if (EQ (XCAR (reading_selection_reply), Qlambda))
1185 error ("No `%s' selection", XSYMBOL (selection_symbol)->name->data); 1185 error ("No `%s' selection", XSYMBOL (selection_symbol)->name->data);
1186 1186
1187 /* Otherwise, the selection is waiting for us on the requested property. */ 1187 /* Otherwise, the selection is waiting for us on the requested property. */
@@ -1627,12 +1627,12 @@ lisp_data_to_selection_data (display, obj,
1627 1627
1628 *nofree_ret = 0; 1628 *nofree_ret = 0;
1629 1629
1630 if (CONSP (obj) && SYMBOLP (XCONS (obj)->car)) 1630 if (CONSP (obj) && SYMBOLP (XCAR (obj)))
1631 { 1631 {
1632 type = XCONS (obj)->car; 1632 type = XCAR (obj);
1633 obj = XCONS (obj)->cdr; 1633 obj = XCDR (obj);
1634 if (CONSP (obj) && NILP (XCONS (obj)->cdr)) 1634 if (CONSP (obj) && NILP (XCDR (obj)))
1635 obj = XCONS (obj)->car; 1635 obj = XCAR (obj);
1636 } 1636 }
1637 1637
1638 if (EQ (obj, QNULL) || (EQ (type, QNULL))) 1638 if (EQ (obj, QNULL) || (EQ (type, QNULL)))
@@ -1722,10 +1722,10 @@ lisp_data_to_selection_data (display, obj,
1722 if (NILP (type)) type = QINTEGER; 1722 if (NILP (type)) type = QINTEGER;
1723 } 1723 }
1724 else if (INTEGERP (obj) 1724 else if (INTEGERP (obj)
1725 || (CONSP (obj) && INTEGERP (XCONS (obj)->car) 1725 || (CONSP (obj) && INTEGERP (XCAR (obj))
1726 && (INTEGERP (XCONS (obj)->cdr) 1726 && (INTEGERP (XCDR (obj))
1727 || (CONSP (XCONS (obj)->cdr) 1727 || (CONSP (XCDR (obj))
1728 && INTEGERP (XCONS (XCONS (obj)->cdr)->car))))) 1728 && INTEGERP (XCAR (XCDR (obj)))))))
1729 { 1729 {
1730 *format_ret = 32; 1730 *format_ret = 32;
1731 *size_ret = 1; 1731 *size_ret = 1;
@@ -1831,20 +1831,20 @@ clean_local_selection_data (obj)
1831 Lisp_Object obj; 1831 Lisp_Object obj;
1832{ 1832{
1833 if (CONSP (obj) 1833 if (CONSP (obj)
1834 && INTEGERP (XCONS (obj)->car) 1834 && INTEGERP (XCAR (obj))
1835 && CONSP (XCONS (obj)->cdr) 1835 && CONSP (XCDR (obj))
1836 && INTEGERP (XCONS (XCONS (obj)->cdr)->car) 1836 && INTEGERP (XCAR (XCDR (obj)))
1837 && NILP (XCONS (XCONS (obj)->cdr)->cdr)) 1837 && NILP (XCDR (XCDR (obj))))
1838 obj = Fcons (XCONS (obj)->car, XCONS (obj)->cdr); 1838 obj = Fcons (XCAR (obj), XCDR (obj));
1839 1839
1840 if (CONSP (obj) 1840 if (CONSP (obj)
1841 && INTEGERP (XCONS (obj)->car) 1841 && INTEGERP (XCAR (obj))
1842 && INTEGERP (XCONS (obj)->cdr)) 1842 && INTEGERP (XCDR (obj)))
1843 { 1843 {
1844 if (XINT (XCONS (obj)->car) == 0) 1844 if (XINT (XCAR (obj)) == 0)
1845 return XCONS (obj)->cdr; 1845 return XCDR (obj);
1846 if (XINT (XCONS (obj)->car) == -1) 1846 if (XINT (XCAR (obj)) == -1)
1847 return make_number (- XINT (XCONS (obj)->cdr)); 1847 return make_number (- XINT (XCDR (obj)));
1848 } 1848 }
1849 if (VECTORP (obj)) 1849 if (VECTORP (obj))
1850 { 1850 {
@@ -1876,7 +1876,7 @@ x_handle_selection_notify (event)
1876 if (event->selection != reading_which_selection) 1876 if (event->selection != reading_which_selection)
1877 return; 1877 return;
1878 1878
1879 XCONS (reading_selection_reply)->car 1879 XCAR (reading_selection_reply)
1880 = (event->property != 0 ? Qt : Qlambda); 1880 = (event->property != 0 ? Qt : Qlambda);
1881} 1881}
1882 1882
@@ -1920,9 +1920,9 @@ TYPE is the type of data desired, typically `STRING'.")
1920 1920
1921#if 0 /* #### MULTIPLE doesn't work yet */ 1921#if 0 /* #### MULTIPLE doesn't work yet */
1922 if (CONSP (target_type) 1922 if (CONSP (target_type)
1923 && XCONS (target_type)->car == QMULTIPLE) 1923 && XCAR (target_type) == QMULTIPLE)
1924 { 1924 {
1925 CHECK_VECTOR (XCONS (target_type)->cdr, 0); 1925 CHECK_VECTOR (XCDR (target_type), 0);
1926 /* So we don't destructively modify this... */ 1926 /* So we don't destructively modify this... */
1927 target_type = copy_multiple_data (target_type); 1927 target_type = copy_multiple_data (target_type);
1928 } 1928 }
@@ -1939,11 +1939,11 @@ TYPE is the type of data desired, typically `STRING'.")
1939 } 1939 }
1940 1940
1941 if (CONSP (val) 1941 if (CONSP (val)
1942 && SYMBOLP (XCONS (val)->car)) 1942 && SYMBOLP (XCAR (val)))
1943 { 1943 {
1944 val = XCONS (val)->cdr; 1944 val = XCDR (val);
1945 if (CONSP (val) && NILP (XCONS (val)->cdr)) 1945 if (CONSP (val) && NILP (XCDR (val)))
1946 val = XCONS (val)->car; 1946 val = XCAR (val);
1947 } 1947 }
1948 val = clean_local_selection_data (val); 1948 val = clean_local_selection_data (val);
1949 DONE: 1949 DONE:
@@ -2006,14 +2006,14 @@ x_disown_buffer_selections (buffer)
2006 Lisp_Object tail; 2006 Lisp_Object tail;
2007 struct buffer *buf = XBUFFER (buffer); 2007 struct buffer *buf = XBUFFER (buffer);
2008 2008
2009 for (tail = Vselection_alist; CONSP (tail); tail = XCONS (tail)->cdr) 2009 for (tail = Vselection_alist; CONSP (tail); tail = XCDR (tail))
2010 { 2010 {
2011 Lisp_Object elt, value; 2011 Lisp_Object elt, value;
2012 elt = XCONS (tail)->car; 2012 elt = XCAR (tail);
2013 value = XCONS (elt)->cdr; 2013 value = XCDR (elt);
2014 if (CONSP (value) && MARKERP (XCONS (value)->car) 2014 if (CONSP (value) && MARKERP (XCAR (value))
2015 && XMARKER (XCONS (value)->car)->buffer == buf) 2015 && XMARKER (XCAR (value))->buffer == buf)
2016 Fx_disown_selection_internal (XCONS (elt)->car, Qnil); 2016 Fx_disown_selection_internal (XCAR (elt), Qnil);
2017 } 2017 }
2018} 2018}
2019 2019