Mercurial > hg > xemacs-beta
comparison src/fns.c @ 165:5a88923fcbfe r20-3b9
Import from CVS: tag r20-3b9
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:44:42 +0200 |
parents | 0132846995bd |
children | 85ec50267440 |
comparison
equal
deleted
inserted
replaced
164:4e0740e5aab2 | 165:5a88923fcbfe |
---|---|
717 break; | 717 break; |
718 | 718 |
719 /* Fetch next element of `seq' arg into `elt' */ | 719 /* Fetch next element of `seq' arg into `elt' */ |
720 if (CONSP (seq)) | 720 if (CONSP (seq)) |
721 { | 721 { |
722 elt = Fcar (seq); | 722 elt = XCAR (seq); |
723 seq = Fcdr (seq); | 723 seq = XCDR (seq); |
724 } | 724 } |
725 else | 725 else |
726 { | 726 { |
727 if (thisindex >= thisleni) | 727 if (thisindex >= thisleni) |
728 break; | 728 break; |
1731 tail = list; | 1731 tail = list; |
1732 GCPRO2 (prev, tail); | 1732 GCPRO2 (prev, tail); |
1733 while (!NILP (tail)) | 1733 while (!NILP (tail)) |
1734 { | 1734 { |
1735 QUIT; | 1735 QUIT; |
1736 next = Fcdr (tail); | 1736 CHECK_CONS (tail); |
1737 Fsetcdr (tail, prev); | 1737 next = XCDR (tail); |
1738 XCDR (tail) = prev; | |
1738 prev = tail; | 1739 prev = tail; |
1739 tail = next; | 1740 tail = next; |
1740 } | 1741 } |
1741 UNGCPRO; | 1742 UNGCPRO; |
1742 return prev; | 1743 return prev; |
1746 Reverse LIST, copying. Returns the beginning of the reversed list. | 1747 Reverse LIST, copying. Returns the beginning of the reversed list. |
1747 See also the function `nreverse', which is used more often. | 1748 See also the function `nreverse', which is used more often. |
1748 */ | 1749 */ |
1749 (list)) | 1750 (list)) |
1750 { | 1751 { |
1751 Lisp_Object length; | 1752 Lisp_Object new; |
1752 Lisp_Object *vec; | 1753 |
1753 Lisp_Object tail; | 1754 for (new = Qnil; CONSP (list); list = XCDR (list)) |
1754 REGISTER int i; | 1755 new = Fcons (XCAR (list), new); |
1755 | 1756 if (!NILP (list)) |
1756 length = Flength (list); | 1757 list = wrong_type_argument (Qconsp, list); |
1757 vec = (Lisp_Object *) alloca (XINT (length) * sizeof (Lisp_Object)); | 1758 return new; |
1758 for (i = XINT (length) - 1, tail = list; i >= 0; i--, tail = Fcdr (tail)) | |
1759 vec[i] = Fcar (tail); | |
1760 | |
1761 return Flist (XINT (length), vec); | |
1762 } | 1759 } |
1763 | 1760 |
1764 static Lisp_Object list_merge (Lisp_Object org_l1, Lisp_Object org_l2, | 1761 static Lisp_Object list_merge (Lisp_Object org_l1, Lisp_Object org_l2, |
1765 Lisp_Object lisp_arg, | 1762 Lisp_Object lisp_arg, |
1766 int (*pred_fn) (Lisp_Object, Lisp_Object, | 1763 int (*pred_fn) (Lisp_Object, Lisp_Object, |
2885 /* Note that (equal 20 20.0) should be nil */ | 2882 /* Note that (equal 20 20.0) should be nil */ |
2886 else if (XTYPE (o1) != XTYPE (o2)) | 2883 else if (XTYPE (o1) != XTYPE (o2)) |
2887 return 0; | 2884 return 0; |
2888 else if (CONSP (o1)) | 2885 else if (CONSP (o1)) |
2889 { | 2886 { |
2890 if (!internal_equal (Fcar (o1), Fcar (o2), depth + 1)) | 2887 if (!internal_equal (XCAR (o1), XCAR (o2), depth + 1)) |
2891 return 0; | 2888 return 0; |
2892 o1 = Fcdr (o1); | 2889 o1 = XCDR (o1); |
2893 o2 = Fcdr (o2); | 2890 o2 = XCDR (o2); |
2894 goto do_cdr; | 2891 goto do_cdr; |
2895 } | 2892 } |
2896 | 2893 |
2897 #ifndef LRECORD_VECTOR | 2894 #ifndef LRECORD_VECTOR |
2898 else if (VECTORP (o1)) | 2895 else if (VECTORP (o1)) |
2955 /* Note that (equal 20 20.0) should be nil */ | 2952 /* Note that (equal 20 20.0) should be nil */ |
2956 else if (XTYPE (o1) != XTYPE (o2)) | 2953 else if (XTYPE (o1) != XTYPE (o2)) |
2957 return 0; | 2954 return 0; |
2958 else if (CONSP (o1)) | 2955 else if (CONSP (o1)) |
2959 { | 2956 { |
2960 if (!internal_old_equal (Fcar (o1), Fcar (o2), depth + 1)) | 2957 if (!internal_old_equal (XCAR (o1), XCAR (o2), depth + 1)) |
2961 return 0; | 2958 return 0; |
2962 o1 = Fcdr (o1); | 2959 o1 = XCDR (o1); |
2963 o2 = Fcdr (o2); | 2960 o2 = XCDR (o2); |
2964 goto do_cdr; | 2961 goto do_cdr; |
2965 } | 2962 } |
2966 | 2963 |
2967 #ifndef LRECORD_VECTOR | 2964 #ifndef LRECORD_VECTOR |
2968 else if (VECTORP (o1)) | 2965 else if (VECTORP (o1)) |
3133 tem = wrong_type_argument (Qlistp, tem); | 3130 tem = wrong_type_argument (Qlistp, tem); |
3134 | 3131 |
3135 while (CONSP (tem)) | 3132 while (CONSP (tem)) |
3136 { | 3133 { |
3137 tail = tem; | 3134 tail = tem; |
3138 tem = Fcdr (tail); | 3135 tem = XCDR (tail); |
3139 QUIT; | 3136 QUIT; |
3140 } | 3137 } |
3141 | 3138 |
3142 tem = args[argnum + 1]; | 3139 tem = args[argnum + 1]; |
3143 Fsetcdr (tail, tem); | 3140 Fsetcdr (tail, tem); |