comparison src/tests.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 65d65b52d608
comparison
equal deleted inserted replaced
5580:a0e81357194e 5581:56144c8593a8
571 static int 571 static int
572 test_hash_tables_mapper (Lisp_Object UNUSED (key), Lisp_Object value, 572 test_hash_tables_mapper (Lisp_Object UNUSED (key), Lisp_Object value,
573 void *extra_arg) 573 void *extra_arg)
574 { 574 {
575 test_hash_tables_data *p = (test_hash_tables_data *) extra_arg; 575 test_hash_tables_data *p = (test_hash_tables_data *) extra_arg;
576 p->sum += XINT (value); 576 p->sum += XFIXNUM (value);
577 return 0; 577 return 0;
578 } 578 }
579 579
580 static int 580 static int
581 test_hash_tables_modifying_mapper (Lisp_Object key, Lisp_Object value, 581 test_hash_tables_modifying_mapper (Lisp_Object key, Lisp_Object value,
582 void *extra_arg) 582 void *extra_arg)
583 { 583 {
584 test_hash_tables_data *p = (test_hash_tables_data *) extra_arg; 584 test_hash_tables_data *p = (test_hash_tables_data *) extra_arg;
585 Fputhash (make_int (- XINT (key)), 585 Fputhash (make_fixnum (- XFIXNUM (key)),
586 make_int (2 * XINT (value)), 586 make_fixnum (2 * XFIXNUM (value)),
587 p->hash_table); 587 p->hash_table);
588 p->sum += XINT (value); 588 p->sum += XFIXNUM (value);
589 return 0; 589 return 0;
590 } 590 }
591 591
592 static int 592 static int
593 test_hash_tables_predicate (Lisp_Object key, 593 test_hash_tables_predicate (Lisp_Object key,
594 Lisp_Object UNUSED (value), 594 Lisp_Object UNUSED (value),
595 void *UNUSED (extra_arg)) 595 void *UNUSED (extra_arg))
596 { 596 {
597 return XINT (key) < 0; 597 return XFIXNUM (key) < 0;
598 } 598 }
599 599
600 600
601 DEFUN ("test-hash-tables", Ftest_hash_tables, 0, 0, "", /* 601 DEFUN ("test-hash-tables", Ftest_hash_tables, 0, 0, "", /*
602 Return list of results of testing C interface to hash tables. 602 Return list of results of testing C interface to hash tables.
613 613
614 test_hash_tables_data data; 614 test_hash_tables_data data;
615 data.hash_table = make_lisp_hash_table (50, HASH_TABLE_NON_WEAK, 615 data.hash_table = make_lisp_hash_table (50, HASH_TABLE_NON_WEAK,
616 Qequal); 616 Qequal);
617 617
618 Fputhash (make_int (1), make_int (2), data.hash_table); 618 Fputhash (make_fixnum (1), make_fixnum (2), data.hash_table);
619 Fputhash (make_int (3), make_int (4), data.hash_table); 619 Fputhash (make_fixnum (3), make_fixnum (4), data.hash_table);
620 620
621 data.sum = 0; 621 data.sum = 0;
622 elisp_maphash_unsafe (test_hash_tables_mapper, 622 elisp_maphash_unsafe (test_hash_tables_mapper,
623 data.hash_table, (void *) &data); 623 data.hash_table, (void *) &data);
624 hash_result = Fcons (list3 (build_ascstring ("simple mapper"), 624 hash_result = Fcons (list3 (build_ascstring ("simple mapper"),
672 { \ 672 { \
673 void *pval = (void *) (val); \ 673 void *pval = (void *) (val); \
674 assert (GET_VOID_FROM_LISP (STORE_VOID_IN_LISP (pval)) == pval); \ 674 assert (GET_VOID_FROM_LISP (STORE_VOID_IN_LISP (pval)) == pval); \
675 } \ 675 } \
676 while (0) 676 while (0)
677 assert (INT_VALBITS >= 31); 677 assert (FIXNUM_VALBITS >= 31);
678 FROB (&baz); 678 FROB (&baz);
679 FROB (&baz.x); 679 FROB (&baz.x);
680 FROB (&baz.y); 680 FROB (&baz.y);
681 FROB (&baz.z); 681 FROB (&baz.z);
682 FROB (&baz.q); 682 FROB (&baz.q);
687 FROB (0x00008080); 687 FROB (0x00008080);
688 FROB (0x00808080); 688 FROB (0x00808080);
689 FROB (0x80808080); 689 FROB (0x80808080);
690 FROB (0xCAFEBABE); 690 FROB (0xCAFEBABE);
691 FROB (0xFFFFFFFE); 691 FROB (0xFFFFFFFE);
692 #if INT_VALBITS >= 63 692 #if FIXNUM_VALBITS >= 63
693 FROB (0x0000808080808080); 693 FROB (0x0000808080808080);
694 FROB (0x8080808080808080); 694 FROB (0x8080808080808080);
695 FROB (0XDEADBEEFCAFEBABE); 695 FROB (0XDEADBEEFCAFEBABE);
696 FROB (0XFFFFFFFFFFFFFFFE); 696 FROB (0XFFFFFFFFFFFFFFFE);
697 #endif /* INT_VALBITS >= 63 */ 697 #endif /* FIXNUM_VALBITS >= 63 */
698 698
699 return list1 (list3 (build_ascstring ("STORE_VOID_IN_LISP"), Qt, Qnil)); 699 return list1 (list3 (build_ascstring ("STORE_VOID_IN_LISP"), Qt, Qnil));
700 } 700 }
701 701
702 702