Mercurial > hg > xemacs-beta
comparison src/doprnt.c @ 5581:56144c8593a8
Mechanically change INT to FIXNUM in our sources.
src/ChangeLog addition:
2011-10-09 Aidan Kehoe <kehoea@parhasard.net>
[...]
Mechanically change INT (where it refers to non-bignum Lisp
integers) to FIXNUM in our sources. Done for the following
functions, enums, and macros: Lisp_Type_Int_Even,
Lisp_Type_Int_Odd, INT_GCBITS, INT_VALBITS, make_int(), INTP(),
XINT(), CHECK_INT(), XREALINT(), INT_PLUS(), INT_MINUS(),
EMACS_INT_MAX (to MOST_POSITIVE_FIXNUM), EMACS_INT_MIN (to
MOST_NEGATIVE_FIXNUM), NUMBER_FITS_IN_AN_EMACS_INT() to
NUMBER_FITS_IN_A_FIXNUM(), XFLOATINT, XCHAR_OR_INT, INT_OR_FLOAT.
The EMACS_INT typedef was not changed, it does not describe
non-bignum Lisp integers.
Script that did the change available in
http://mid.gmane.org/20067.17650.181273.12014@parhasard.net .
modules/ChangeLog addition:
2011-10-09 Aidan Kehoe <kehoea@parhasard.net>
[...]
Mechanically change INT to FIXNUM, where the usage describes non-bignum
Lisp integers. See the src/ChangeLog entry for more details.
man/ChangeLog addition:
2011-10-09 Aidan Kehoe <kehoea@parhasard.net>
* internals/internals.texi (How Lisp Objects Are Represented in C):
* internals/internals.texi (Integers and Characters):
Mechanically change INT to FIXNUM, where the usage describes non-bignum
Lisp integers.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 09 Oct 2011 09:51:57 +0100 |
parents | 308d34e9f07d |
children | b3824b7f5627 |
comparison
equal
deleted
inserted
replaced
5580:a0e81357194e | 5581:56144c8593a8 |
---|---|
369 if (spec->argnum == i) | 369 if (spec->argnum == i) |
370 break; | 370 break; |
371 } | 371 } |
372 | 372 |
373 if (j == Dynarr_length (specs)) | 373 if (j == Dynarr_length (specs)) |
374 syntax_error ("No conversion spec for argument", make_int (i)); | 374 syntax_error ("No conversion spec for argument", make_fixnum (i)); |
375 | 375 |
376 ch = spec->converter; | 376 ch = spec->converter; |
377 | 377 |
378 if (strchr (int_converters, ch)) | 378 if (strchr (int_converters, ch)) |
379 { | 379 { |
451 { | 451 { |
452 /* allow too many args for string, but not too few */ | 452 /* allow too many args for string, but not too few */ |
453 if (nargs < get_args_needed (specs)) | 453 if (nargs < get_args_needed (specs)) |
454 signal_error_1 (Qwrong_number_of_arguments, | 454 signal_error_1 (Qwrong_number_of_arguments, |
455 list3 (Qformat, | 455 list3 (Qformat, |
456 make_int (nargs), | 456 make_fixnum (nargs), |
457 !NILP (format_reloc) ? format_reloc : | 457 !NILP (format_reloc) ? format_reloc : |
458 make_string (format_nonreloc, format_length))); | 458 make_string (format_nonreloc, format_length))); |
459 } | 459 } |
460 else | 460 else |
461 { | 461 { |
492 if (ch == '*') | 492 if (ch == '*') |
493 { | 493 { |
494 struct printf_spec *nextspec = Dynarr_atp (specs, i + 1); | 494 struct printf_spec *nextspec = Dynarr_atp (specs, i + 1); |
495 Lisp_Object obj = largs[spec->argnum - 1]; | 495 Lisp_Object obj = largs[spec->argnum - 1]; |
496 | 496 |
497 if (INTP (obj)) | 497 if (FIXNUMP (obj)) |
498 { | 498 { |
499 if (spec->forwarding_precision) | 499 if (spec->forwarding_precision) |
500 { | 500 { |
501 nextspec->precision = XINT (obj); | 501 nextspec->precision = XFIXNUM (obj); |
502 nextspec->minwidth = spec->minwidth; | 502 nextspec->minwidth = spec->minwidth; |
503 } | 503 } |
504 else | 504 else |
505 { | 505 { |
506 nextspec->minwidth = XINT (obj); | 506 nextspec->minwidth = XFIXNUM (obj); |
507 if (XINT (obj) < 0) | 507 if (XFIXNUM (obj) < 0) |
508 { | 508 { |
509 spec->minus_flag = 1; | 509 spec->minus_flag = 1; |
510 nextspec->minwidth = - nextspec->minwidth; | 510 nextspec->minwidth = - nextspec->minwidth; |
511 } | 511 } |
512 } | 512 } |
519 continue; | 519 continue; |
520 } | 520 } |
521 | 521 |
522 if (largs && (spec->argnum < 1 || spec->argnum > nargs)) | 522 if (largs && (spec->argnum < 1 || spec->argnum > nargs)) |
523 syntax_error ("Invalid repositioning argument", | 523 syntax_error ("Invalid repositioning argument", |
524 make_int (spec->argnum)); | 524 make_fixnum (spec->argnum)); |
525 | 525 |
526 else if (ch == 'S' || ch == 's') | 526 else if (ch == 'S' || ch == 's') |
527 { | 527 { |
528 Ibyte *string; | 528 Ibyte *string; |
529 Bytecount string_len; | 529 Bytecount string_len; |
586 } | 586 } |
587 else | 587 else |
588 { | 588 { |
589 Lisp_Object obj = largs[spec->argnum - 1]; | 589 Lisp_Object obj = largs[spec->argnum - 1]; |
590 if (CHARP (obj)) | 590 if (CHARP (obj)) |
591 obj = make_int (XCHAR (obj)); | 591 obj = make_fixnum (XCHAR (obj)); |
592 if (!NUMBERP (obj)) | 592 if (!NUMBERP (obj)) |
593 { | 593 { |
594 /* WARNING! This MUST be big enough for the sprintf below */ | 594 /* WARNING! This MUST be big enough for the sprintf below */ |
595 CIbyte msg[48]; | 595 CIbyte msg[48]; |
596 sprintf (msg, | 596 sprintf (msg, |
598 ch); | 598 ch); |
599 syntax_error (msg, Qunbound); | 599 syntax_error (msg, Qunbound); |
600 } | 600 } |
601 else if (strchr (double_converters, ch)) | 601 else if (strchr (double_converters, ch)) |
602 { | 602 { |
603 if (INTP (obj)) | 603 if (FIXNUMP (obj)) |
604 arg.d = XINT (obj); | 604 arg.d = XFIXNUM (obj); |
605 else if (FLOATP (obj)) | 605 else if (FLOATP (obj)) |
606 arg.d = XFLOAT_DATA (obj); | 606 arg.d = XFLOAT_DATA (obj); |
607 #ifdef HAVE_BIGNUM | 607 #ifdef HAVE_BIGNUM |
608 else if (BIGNUMP (obj)) | 608 else if (BIGNUMP (obj)) |
609 arg.d = bignum_to_double (XBIGNUM_DATA (obj)); | 609 arg.d = bignum_to_double (XBIGNUM_DATA (obj)); |
641 bignum_sign (scratch_bignum) < 0) | 641 bignum_sign (scratch_bignum) < 0) |
642 dead_wrong_type_argument (Qnonnegativep, obj); | 642 dead_wrong_type_argument (Qnonnegativep, obj); |
643 obj = | 643 obj = |
644 Fcanonicalize_number (make_bignum_bg (scratch_bignum)); | 644 Fcanonicalize_number (make_bignum_bg (scratch_bignum)); |
645 #else /* !HAVE_BIGNUM */ | 645 #else /* !HAVE_BIGNUM */ |
646 obj = make_int (bigfloat_to_long (XBIGFLOAT_DATA (obj))); | 646 obj = make_fixnum (bigfloat_to_long (XBIGFLOAT_DATA (obj))); |
647 #endif /* HAVE_BIGNUM */ | 647 #endif /* HAVE_BIGNUM */ |
648 } | 648 } |
649 #endif /* HAVE_BIGFLOAT */ | 649 #endif /* HAVE_BIGFLOAT */ |
650 #ifdef HAVE_RATIO | 650 #ifdef HAVE_RATIO |
651 else if (RATIOP (obj)) | 651 else if (RATIOP (obj)) |
685 else | 685 else |
686 ch = 'n'; | 686 ch = 'n'; |
687 } | 687 } |
688 } | 688 } |
689 #endif | 689 #endif |
690 if (INTP (obj)) | 690 if (FIXNUMP (obj)) |
691 { | 691 { |
692 if (strchr (unsigned_int_converters, ch)) | 692 if (strchr (unsigned_int_converters, ch)) |
693 { | 693 { |
694 #ifdef HAVE_BIGNUM | 694 #ifdef HAVE_BIGNUM |
695 if (XINT (obj) < 0) | 695 if (XFIXNUM (obj) < 0) |
696 dead_wrong_type_argument (Qnatnump, obj); | 696 dead_wrong_type_argument (Qnatnump, obj); |
697 #endif | 697 #endif |
698 arg.ul = (unsigned long) XUINT (obj); | 698 arg.ul = (unsigned long) XUINT (obj); |
699 } | 699 } |
700 else | 700 else |
701 arg.l = XINT (obj); | 701 arg.l = XFIXNUM (obj); |
702 } | 702 } |
703 } | 703 } |
704 } | 704 } |
705 | 705 |
706 if (ch == 'c') | 706 if (ch == 'c') |