comparison src/editfns.c @ 40656:cdfd4d09b79a

Update usage of CHECK_ macros (remove unused second argument).
author Pavel Janík <Pavel@Janik.cz>
date Fri, 02 Nov 2001 20:46:55 +0000
parents 5798240154fd
children d51d2fa675d0
comparison
equal deleted inserted replaced
40655:45453187feeb 40656:cdfd4d09b79a
170 Lisp_Object character; 170 Lisp_Object character;
171 { 171 {
172 int len; 172 int len;
173 unsigned char str[MAX_MULTIBYTE_LENGTH]; 173 unsigned char str[MAX_MULTIBYTE_LENGTH];
174 174
175 CHECK_NUMBER (character, 0); 175 CHECK_NUMBER (character);
176 176
177 len = (SINGLE_BYTE_CHAR_P (XFASTINT (character)) 177 len = (SINGLE_BYTE_CHAR_P (XFASTINT (character))
178 ? (*str = (unsigned char)(XFASTINT (character)), 1) 178 ? (*str = (unsigned char)(XFASTINT (character)), 1)
179 : char_to_string (XFASTINT (character), str)); 179 : char_to_string (XFASTINT (character), str));
180 return make_string_from_bytes (str, 1, len); 180 return make_string_from_bytes (str, 1, len);
186 (string) 186 (string)
187 register Lisp_Object string; 187 register Lisp_Object string;
188 { 188 {
189 register Lisp_Object val; 189 register Lisp_Object val;
190 register struct Lisp_String *p; 190 register struct Lisp_String *p;
191 CHECK_STRING (string, 0); 191 CHECK_STRING (string);
192 p = XSTRING (string); 192 p = XSTRING (string);
193 if (p->size) 193 if (p->size)
194 { 194 {
195 if (STRING_MULTIBYTE (string)) 195 if (STRING_MULTIBYTE (string))
196 XSETFASTINT (val, STRING_CHAR (p->data, STRING_BYTES (p))); 196 XSETFASTINT (val, STRING_CHAR (p->data, STRING_BYTES (p)));
264 SET_PT_BOTH (pos, marker_byte_position (position)); 264 SET_PT_BOTH (pos, marker_byte_position (position));
265 265
266 return position; 266 return position;
267 } 267 }
268 268
269 CHECK_NUMBER_COERCE_MARKER (position, 0); 269 CHECK_NUMBER_COERCE_MARKER (position);
270 270
271 pos = clip_to_bounds (BEGV, XINT (position), ZV); 271 pos = clip_to_bounds (BEGV, XINT (position), ZV);
272 SET_PT (pos); 272 SET_PT (pos);
273 return position; 273 return position;
274 } 274 }
433 int at_field_end = 0; 433 int at_field_end = 0;
434 434
435 if (NILP (pos)) 435 if (NILP (pos))
436 XSETFASTINT (pos, PT); 436 XSETFASTINT (pos, PT);
437 else 437 else
438 CHECK_NUMBER_COERCE_MARKER (pos, 0); 438 CHECK_NUMBER_COERCE_MARKER (pos);
439 439
440 after_field 440 after_field
441 = get_char_property_and_overlay (pos, Qfield, Qnil, &after_overlay); 441 = get_char_property_and_overlay (pos, Qfield, Qnil, &after_overlay);
442 before_field 442 before_field
443 = (XFASTINT (pos) > BEGV 443 = (XFASTINT (pos) > BEGV
687 move NEW_POS so that it is. */ 687 move NEW_POS so that it is. */
688 { 688 {
689 int fwd, shortage; 689 int fwd, shortage;
690 Lisp_Object field_bound; 690 Lisp_Object field_bound;
691 691
692 CHECK_NUMBER_COERCE_MARKER (new_pos, 0); 692 CHECK_NUMBER_COERCE_MARKER (new_pos);
693 CHECK_NUMBER_COERCE_MARKER (old_pos, 0); 693 CHECK_NUMBER_COERCE_MARKER (old_pos);
694 694
695 fwd = (XFASTINT (new_pos) > XFASTINT (old_pos)); 695 fwd = (XFASTINT (new_pos) > XFASTINT (old_pos));
696 696
697 if (fwd) 697 if (fwd)
698 field_bound = Ffield_end (old_pos, escape_from_edge); 698 field_bound = Ffield_end (old_pos, escape_from_edge);
746 int orig, orig_byte, end; 746 int orig, orig_byte, end;
747 747
748 if (NILP (n)) 748 if (NILP (n))
749 XSETFASTINT (n, 1); 749 XSETFASTINT (n, 1);
750 else 750 else
751 CHECK_NUMBER (n, 0); 751 CHECK_NUMBER (n);
752 752
753 orig = PT; 753 orig = PT;
754 orig_byte = PT_BYTE; 754 orig_byte = PT_BYTE;
755 Fforward_line (make_number (XINT (n) - 1)); 755 Fforward_line (make_number (XINT (n) - 1));
756 end = PT; 756 end = PT;
781 int orig = PT; 781 int orig = PT;
782 782
783 if (NILP (n)) 783 if (NILP (n))
784 XSETFASTINT (n, 1); 784 XSETFASTINT (n, 1);
785 else 785 else
786 CHECK_NUMBER (n, 0); 786 CHECK_NUMBER (n);
787 787
788 end_pos = find_before_next_newline (orig, 0, XINT (n) - (XINT (n) <= 0)); 788 end_pos = find_before_next_newline (orig, 0, XINT (n) - (XINT (n) <= 0));
789 789
790 /* Return END_POS constrained to the current input field. */ 790 /* Return END_POS constrained to the current input field. */
791 return Fconstrain_to_field (make_number (end_pos), make_number (orig), 791 return Fconstrain_to_field (make_number (end_pos), make_number (orig),
940 { 940 {
941 if (NILP (buffer)) 941 if (NILP (buffer))
942 return make_number (Z - BEG); 942 return make_number (Z - BEG);
943 else 943 else
944 { 944 {
945 CHECK_BUFFER (buffer, 1); 945 CHECK_BUFFER (buffer);
946 return make_number (BUF_Z (XBUFFER (buffer)) 946 return make_number (BUF_Z (XBUFFER (buffer))
947 - BUF_BEG (XBUFFER (buffer))); 947 - BUF_BEG (XBUFFER (buffer)));
948 } 948 }
949 } 949 }
950 950
1010 doc: /* Return the byte position for character position POSITION. 1010 doc: /* Return the byte position for character position POSITION.
1011 If POSITION is out of range, the value is nil. */) 1011 If POSITION is out of range, the value is nil. */)
1012 (position) 1012 (position)
1013 Lisp_Object position; 1013 Lisp_Object position;
1014 { 1014 {
1015 CHECK_NUMBER_COERCE_MARKER (position, 1); 1015 CHECK_NUMBER_COERCE_MARKER (position);
1016 if (XINT (position) < BEG || XINT (position) > Z) 1016 if (XINT (position) < BEG || XINT (position) > Z)
1017 return Qnil; 1017 return Qnil;
1018 return make_number (CHAR_TO_BYTE (XINT (position))); 1018 return make_number (CHAR_TO_BYTE (XINT (position)));
1019 } 1019 }
1020 1020
1022 doc: /* Return the character position for byte position BYTEPOS. 1022 doc: /* Return the character position for byte position BYTEPOS.
1023 If BYTEPOS is out of range, the value is nil. */) 1023 If BYTEPOS is out of range, the value is nil. */)
1024 (bytepos) 1024 (bytepos)
1025 Lisp_Object bytepos; 1025 Lisp_Object bytepos;
1026 { 1026 {
1027 CHECK_NUMBER (bytepos, 1); 1027 CHECK_NUMBER (bytepos);
1028 if (XINT (bytepos) < BEG_BYTE || XINT (bytepos) > Z_BYTE) 1028 if (XINT (bytepos) < BEG_BYTE || XINT (bytepos) > Z_BYTE)
1029 return Qnil; 1029 return Qnil;
1030 return make_number (BYTE_TO_CHAR (XINT (bytepos))); 1030 return make_number (BYTE_TO_CHAR (XINT (bytepos)));
1031 } 1031 }
1032 1032
1122 if (pos_byte < BEGV_BYTE || pos_byte >= ZV_BYTE) 1122 if (pos_byte < BEGV_BYTE || pos_byte >= ZV_BYTE)
1123 return Qnil; 1123 return Qnil;
1124 } 1124 }
1125 else 1125 else
1126 { 1126 {
1127 CHECK_NUMBER_COERCE_MARKER (pos, 0); 1127 CHECK_NUMBER_COERCE_MARKER (pos);
1128 if (XINT (pos) < BEGV || XINT (pos) >= ZV) 1128 if (XINT (pos) < BEGV || XINT (pos) >= ZV)
1129 return Qnil; 1129 return Qnil;
1130 1130
1131 pos_byte = CHAR_TO_BYTE (XINT (pos)); 1131 pos_byte = CHAR_TO_BYTE (XINT (pos));
1132 } 1132 }
1157 if (pos_byte <= BEGV_BYTE || pos_byte > ZV_BYTE) 1157 if (pos_byte <= BEGV_BYTE || pos_byte > ZV_BYTE)
1158 return Qnil; 1158 return Qnil;
1159 } 1159 }
1160 else 1160 else
1161 { 1161 {
1162 CHECK_NUMBER_COERCE_MARKER (pos, 0); 1162 CHECK_NUMBER_COERCE_MARKER (pos);
1163 1163
1164 if (XINT (pos) <= BEGV || XINT (pos) > ZV) 1164 if (XINT (pos) <= BEGV || XINT (pos) > ZV)
1165 return Qnil; 1165 return Qnil;
1166 1166
1167 pos_byte = CHAR_TO_BYTE (XINT (pos)); 1167 pos_byte = CHAR_TO_BYTE (XINT (pos));
1200 init_editfns (); 1200 init_editfns ();
1201 1201
1202 if (NILP (uid)) 1202 if (NILP (uid))
1203 return Vuser_login_name; 1203 return Vuser_login_name;
1204 1204
1205 CHECK_NUMBER (uid, 0); 1205 CHECK_NUMBER (uid);
1206 pw = (struct passwd *) getpwuid (XINT (uid)); 1206 pw = (struct passwd *) getpwuid (XINT (uid));
1207 return (pw ? build_string (pw->pw_name) : Qnil); 1207 return (pw ? build_string (pw->pw_name) : Qnil);
1208 } 1208 }
1209 1209
1210 DEFUN ("user-real-login-name", Fuser_real_login_name, Suser_real_login_name, 1210 DEFUN ("user-real-login-name", Fuser_real_login_name, Suser_real_login_name,
1364 } 1364 }
1365 else 1365 else
1366 { 1366 {
1367 Lisp_Object high, low; 1367 Lisp_Object high, low;
1368 high = Fcar (specified_time); 1368 high = Fcar (specified_time);
1369 CHECK_NUMBER (high, 0); 1369 CHECK_NUMBER (high);
1370 low = Fcdr (specified_time); 1370 low = Fcdr (specified_time);
1371 if (CONSP (low)) 1371 if (CONSP (low))
1372 { 1372 {
1373 if (usec) 1373 if (usec)
1374 { 1374 {
1377 usec_l = Fcar (usec_l); 1377 usec_l = Fcar (usec_l);
1378 if (NILP (usec_l)) 1378 if (NILP (usec_l))
1379 *usec = 0; 1379 *usec = 0;
1380 else 1380 else
1381 { 1381 {
1382 CHECK_NUMBER (usec_l, 0); 1382 CHECK_NUMBER (usec_l);
1383 *usec = XINT (usec_l); 1383 *usec = XINT (usec_l);
1384 } 1384 }
1385 } 1385 }
1386 low = Fcar (low); 1386 low = Fcar (low);
1387 } 1387 }
1388 else if (usec) 1388 else if (usec)
1389 *usec = 0; 1389 *usec = 0;
1390 CHECK_NUMBER (low, 0); 1390 CHECK_NUMBER (low);
1391 *result = (XINT (high) << 16) + (XINT (low) & 0xffff); 1391 *result = (XINT (high) << 16) + (XINT (low) & 0xffff);
1392 return *result >> 16 == XINT (high); 1392 return *result >> 16 == XINT (high);
1393 } 1393 }
1394 } 1394 }
1395 1395
1525 time_t value; 1525 time_t value;
1526 int size; 1526 int size;
1527 struct tm *tm; 1527 struct tm *tm;
1528 int ut = ! NILP (universal); 1528 int ut = ! NILP (universal);
1529 1529
1530 CHECK_STRING (format_string, 1); 1530 CHECK_STRING (format_string);
1531 1531
1532 if (! lisp_time_argument (time, &value, NULL)) 1532 if (! lisp_time_argument (time, &value, NULL))
1533 error ("Invalid time specification"); 1533 error ("Invalid time specification");
1534 1534
1535 format_string = code_convert_string_norecord (format_string, 1535 format_string = code_convert_string_norecord (format_string,
1637 { 1637 {
1638 time_t time; 1638 time_t time;
1639 struct tm tm; 1639 struct tm tm;
1640 Lisp_Object zone = (nargs > 6 ? args[nargs - 1] : Qnil); 1640 Lisp_Object zone = (nargs > 6 ? args[nargs - 1] : Qnil);
1641 1641
1642 CHECK_NUMBER (args[0], 0); /* second */ 1642 CHECK_NUMBER (args[0]); /* second */
1643 CHECK_NUMBER (args[1], 1); /* minute */ 1643 CHECK_NUMBER (args[1]); /* minute */
1644 CHECK_NUMBER (args[2], 2); /* hour */ 1644 CHECK_NUMBER (args[2]); /* hour */
1645 CHECK_NUMBER (args[3], 3); /* day */ 1645 CHECK_NUMBER (args[3]); /* day */
1646 CHECK_NUMBER (args[4], 4); /* month */ 1646 CHECK_NUMBER (args[4]); /* month */
1647 CHECK_NUMBER (args[5], 5); /* year */ 1647 CHECK_NUMBER (args[5]); /* year */
1648 1648
1649 tm.tm_sec = XINT (args[0]); 1649 tm.tm_sec = XINT (args[0]);
1650 tm.tm_min = XINT (args[1]); 1650 tm.tm_min = XINT (args[1]);
1651 tm.tm_hour = XINT (args[2]); 1651 tm.tm_hour = XINT (args[2]);
1652 tm.tm_mday = XINT (args[3]); 1652 tm.tm_mday = XINT (args[3]);
1842 tzstring = 0; 1842 tzstring = 0;
1843 else if (EQ (tz, Qt)) 1843 else if (EQ (tz, Qt))
1844 tzstring = "UTC0"; 1844 tzstring = "UTC0";
1845 else 1845 else
1846 { 1846 {
1847 CHECK_STRING (tz, 0); 1847 CHECK_STRING (tz);
1848 tzstring = (char *) XSTRING (tz)->data; 1848 tzstring = (char *) XSTRING (tz)->data;
1849 } 1849 }
1850 1850
1851 set_time_zone_rule (tzstring); 1851 set_time_zone_rule (tzstring);
1852 if (environbuf) 1852 if (environbuf)
2112 register int strlen; 2112 register int strlen;
2113 register int i, n; 2113 register int i, n;
2114 int len; 2114 int len;
2115 unsigned char str[MAX_MULTIBYTE_LENGTH]; 2115 unsigned char str[MAX_MULTIBYTE_LENGTH];
2116 2116
2117 CHECK_NUMBER (character, 0); 2117 CHECK_NUMBER (character);
2118 CHECK_NUMBER (count, 1); 2118 CHECK_NUMBER (count);
2119 2119
2120 if (!NILP (current_buffer->enable_multibyte_characters)) 2120 if (!NILP (current_buffer->enable_multibyte_characters))
2121 len = CHAR_STRING (XFASTINT (character), str); 2121 len = CHAR_STRING (XFASTINT (character), str);
2122 else 2122 else
2123 str[0] = XFASTINT (character), len = 1; 2123 str[0] = XFASTINT (character), len = 1;
2324 2324
2325 if (NILP (start)) 2325 if (NILP (start))
2326 b = BUF_BEGV (bp); 2326 b = BUF_BEGV (bp);
2327 else 2327 else
2328 { 2328 {
2329 CHECK_NUMBER_COERCE_MARKER (start, 0); 2329 CHECK_NUMBER_COERCE_MARKER (start);
2330 b = XINT (start); 2330 b = XINT (start);
2331 } 2331 }
2332 if (NILP (end)) 2332 if (NILP (end))
2333 e = BUF_ZV (bp); 2333 e = BUF_ZV (bp);
2334 else 2334 else
2335 { 2335 {
2336 CHECK_NUMBER_COERCE_MARKER (end, 1); 2336 CHECK_NUMBER_COERCE_MARKER (end);
2337 e = XINT (end); 2337 e = XINT (end);
2338 } 2338 }
2339 2339
2340 if (b > e) 2340 if (b > e)
2341 temp = b, b = e, e = temp; 2341 temp = b, b = e, e = temp;
2390 2390
2391 if (NILP (start1)) 2391 if (NILP (start1))
2392 begp1 = BUF_BEGV (bp1); 2392 begp1 = BUF_BEGV (bp1);
2393 else 2393 else
2394 { 2394 {
2395 CHECK_NUMBER_COERCE_MARKER (start1, 1); 2395 CHECK_NUMBER_COERCE_MARKER (start1);
2396 begp1 = XINT (start1); 2396 begp1 = XINT (start1);
2397 } 2397 }
2398 if (NILP (end1)) 2398 if (NILP (end1))
2399 endp1 = BUF_ZV (bp1); 2399 endp1 = BUF_ZV (bp1);
2400 else 2400 else
2401 { 2401 {
2402 CHECK_NUMBER_COERCE_MARKER (end1, 2); 2402 CHECK_NUMBER_COERCE_MARKER (end1);
2403 endp1 = XINT (end1); 2403 endp1 = XINT (end1);
2404 } 2404 }
2405 2405
2406 if (begp1 > endp1) 2406 if (begp1 > endp1)
2407 temp = begp1, begp1 = endp1, endp1 = temp; 2407 temp = begp1, begp1 = endp1, endp1 = temp;
2428 2428
2429 if (NILP (start2)) 2429 if (NILP (start2))
2430 begp2 = BUF_BEGV (bp2); 2430 begp2 = BUF_BEGV (bp2);
2431 else 2431 else
2432 { 2432 {
2433 CHECK_NUMBER_COERCE_MARKER (start2, 4); 2433 CHECK_NUMBER_COERCE_MARKER (start2);
2434 begp2 = XINT (start2); 2434 begp2 = XINT (start2);
2435 } 2435 }
2436 if (NILP (end2)) 2436 if (NILP (end2))
2437 endp2 = BUF_ZV (bp2); 2437 endp2 = BUF_ZV (bp2);
2438 else 2438 else
2439 { 2439 {
2440 CHECK_NUMBER_COERCE_MARKER (end2, 5); 2440 CHECK_NUMBER_COERCE_MARKER (end2);
2441 endp2 = XINT (end2); 2441 endp2 = XINT (end2);
2442 } 2442 }
2443 2443
2444 if (begp2 > endp2) 2444 if (begp2 > endp2)
2445 temp = begp2, begp2 = endp2, endp2 = temp; 2445 temp = begp2, begp2 = endp2, endp2 = temp;
2545 int maybe_byte_combining = COMBINING_NO; 2545 int maybe_byte_combining = COMBINING_NO;
2546 int last_changed = 0; 2546 int last_changed = 0;
2547 int multibyte_p = !NILP (current_buffer->enable_multibyte_characters); 2547 int multibyte_p = !NILP (current_buffer->enable_multibyte_characters);
2548 2548
2549 validate_region (&start, &end); 2549 validate_region (&start, &end);
2550 CHECK_NUMBER (fromchar, 2); 2550 CHECK_NUMBER (fromchar);
2551 CHECK_NUMBER (tochar, 3); 2551 CHECK_NUMBER (tochar);
2552 2552
2553 if (multibyte_p) 2553 if (multibyte_p)
2554 { 2554 {
2555 len = CHAR_STRING (XFASTINT (fromchar), fromstr); 2555 len = CHAR_STRING (XFASTINT (fromchar), fromstr);
2556 if (CHAR_STRING (XFASTINT (tochar), tostr) != len) 2556 if (CHAR_STRING (XFASTINT (tochar), tostr) != len)
2710 int size; /* Size of translate table. */ 2710 int size; /* Size of translate table. */
2711 int pos; 2711 int pos;
2712 int multibyte = !NILP (current_buffer->enable_multibyte_characters); 2712 int multibyte = !NILP (current_buffer->enable_multibyte_characters);
2713 2713
2714 validate_region (&start, &end); 2714 validate_region (&start, &end);
2715 CHECK_STRING (table, 2); 2715 CHECK_STRING (table);
2716 2716
2717 size = STRING_BYTES (XSTRING (table)); 2717 size = STRING_BYTES (XSTRING (table));
2718 tt = XSTRING (table)->data; 2718 tt = XSTRING (table)->data;
2719 2719
2720 pos_byte = CHAR_TO_BYTE (XINT (start)); 2720 pos_byte = CHAR_TO_BYTE (XINT (start));
2828 When calling from a program, pass two arguments; positions (integers 2828 When calling from a program, pass two arguments; positions (integers
2829 or markers) bounding the text that should remain visible. */) 2829 or markers) bounding the text that should remain visible. */)
2830 (start, end) 2830 (start, end)
2831 register Lisp_Object start, end; 2831 register Lisp_Object start, end;
2832 { 2832 {
2833 CHECK_NUMBER_COERCE_MARKER (start, 0); 2833 CHECK_NUMBER_COERCE_MARKER (start);
2834 CHECK_NUMBER_COERCE_MARKER (end, 1); 2834 CHECK_NUMBER_COERCE_MARKER (end);
2835 2835
2836 if (XINT (start) > XINT (end)) 2836 if (XINT (start) > XINT (end))
2837 { 2837 {
2838 Lisp_Object tem; 2838 Lisp_Object tem;
2839 tem = start; start = end; end = tem; 2839 tem = start; start = end; end = tem;
3101 3101
3102 properties = string = Qnil; 3102 properties = string = Qnil;
3103 GCPRO2 (properties, string); 3103 GCPRO2 (properties, string);
3104 3104
3105 /* First argument must be a string. */ 3105 /* First argument must be a string. */
3106 CHECK_STRING (args[0], 0); 3106 CHECK_STRING (args[0]);
3107 string = Fcopy_sequence (args[0]); 3107 string = Fcopy_sequence (args[0]);
3108 3108
3109 for (i = 1; i < nargs; i += 2) 3109 for (i = 1; i < nargs; i += 2)
3110 { 3110 {
3111 CHECK_SYMBOL (args[i], i); 3111 CHECK_SYMBOL (args[i]);
3112 properties = Fcons (args[i], Fcons (args[i + 1], properties)); 3112 properties = Fcons (args[i], Fcons (args[i + 1], properties));
3113 } 3113 }
3114 3114
3115 Fadd_text_properties (make_number (0), 3115 Fadd_text_properties (make_number (0),
3116 make_number (XSTRING (string)->size), 3116 make_number (XSTRING (string)->size),
3180 and in that case, we won't know it here. */ 3180 and in that case, we won't know it here. */
3181 for (n = 0; n < nargs; n++) 3181 for (n = 0; n < nargs; n++)
3182 if (STRINGP (args[n]) && STRING_MULTIBYTE (args[n])) 3182 if (STRINGP (args[n]) && STRING_MULTIBYTE (args[n]))
3183 multibyte = 1; 3183 multibyte = 1;
3184 3184
3185 CHECK_STRING (args[0], 0); 3185 CHECK_STRING (args[0]);
3186 3186
3187 /* If we start out planning a unibyte result, 3187 /* If we start out planning a unibyte result,
3188 and later find it has to be multibyte, we jump back to retry. */ 3188 and later find it has to be multibyte, we jump back to retry. */
3189 retry: 3189 retry:
3190 3190
3575 Case is ignored if `case-fold-search' is non-nil in the current buffer. */) 3575 Case is ignored if `case-fold-search' is non-nil in the current buffer. */)
3576 (c1, c2) 3576 (c1, c2)
3577 register Lisp_Object c1, c2; 3577 register Lisp_Object c1, c2;
3578 { 3578 {
3579 int i1, i2; 3579 int i1, i2;
3580 CHECK_NUMBER (c1, 0); 3580 CHECK_NUMBER (c1);
3581 CHECK_NUMBER (c2, 1); 3581 CHECK_NUMBER (c2);
3582 3582
3583 if (XINT (c1) == XINT (c2)) 3583 if (XINT (c1) == XINT (c2))
3584 return Qt; 3584 return Qt;
3585 if (NILP (current_buffer->case_fold_search)) 3585 if (NILP (current_buffer->case_fold_search))
3586 return Qnil; 3586 return Qnil;