Mercurial > hg > xemacs-beta
comparison src/fns.c @ 195:a2f645c6b9f8 r20-3b24
Import from CVS: tag r20-3b24
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:59:05 +0200 |
parents | b405438285a2 |
children | eb5470882647 |
comparison
equal
deleted
inserted
replaced
194:2947057885e5 | 195:a2f645c6b9f8 |
---|---|
53 | 53 |
54 static Lisp_Object mark_bit_vector (Lisp_Object, void (*) (Lisp_Object)); | 54 static Lisp_Object mark_bit_vector (Lisp_Object, void (*) (Lisp_Object)); |
55 static void print_bit_vector (Lisp_Object, Lisp_Object, int); | 55 static void print_bit_vector (Lisp_Object, Lisp_Object, int); |
56 static int bit_vector_equal (Lisp_Object o1, Lisp_Object o2, int depth); | 56 static int bit_vector_equal (Lisp_Object o1, Lisp_Object o2, int depth); |
57 static unsigned long bit_vector_hash (Lisp_Object obj, int depth); | 57 static unsigned long bit_vector_hash (Lisp_Object obj, int depth); |
58 static int internal_old_equal (Lisp_Object o1, Lisp_Object o2, int depth); | |
59 | |
58 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("bit-vector", bit_vector, | 60 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("bit-vector", bit_vector, |
59 mark_bit_vector, print_bit_vector, 0, | 61 mark_bit_vector, print_bit_vector, 0, |
60 bit_vector_equal, bit_vector_hash, | 62 bit_vector_equal, bit_vector_hash, |
61 struct Lisp_Bit_Vector); | 63 struct Lisp_Bit_Vector); |
62 | 64 |
1062 { | 1064 { |
1063 REGISTER Lisp_Object tail, tem; | 1065 REGISTER Lisp_Object tail, tem; |
1064 for (tail = list; !NILP (tail); tail = Fcdr (tail)) | 1066 for (tail = list; !NILP (tail); tail = Fcdr (tail)) |
1065 { | 1067 { |
1066 tem = Fcar (tail); | 1068 tem = Fcar (tail); |
1067 if (! NILP (Fequal (elt, tem))) | 1069 if (internal_equal (elt, tem, 0)) |
1068 return tail; | 1070 return tail; |
1069 QUIT; | 1071 QUIT; |
1070 } | 1072 } |
1071 return Qnil; | 1073 return Qnil; |
1072 } | 1074 } |
1081 { | 1083 { |
1082 REGISTER Lisp_Object tail, tem; | 1084 REGISTER Lisp_Object tail, tem; |
1083 for (tail = list; !NILP (tail); tail = Fcdr (tail)) | 1085 for (tail = list; !NILP (tail); tail = Fcdr (tail)) |
1084 { | 1086 { |
1085 tem = Fcar (tail); | 1087 tem = Fcar (tail); |
1086 if (! NILP (Fold_equal (elt, tem))) | 1088 if (internal_old_equal (elt, tem, 0)) |
1087 return tail; | 1089 return tail; |
1088 QUIT; | 1090 QUIT; |
1089 } | 1091 } |
1090 return Qnil; | 1092 return Qnil; |
1091 } | 1093 } |
1141 The value is actually the element of LIST whose car equals KEY. | 1143 The value is actually the element of LIST whose car equals KEY. |
1142 */ | 1144 */ |
1143 (key, list)) | 1145 (key, list)) |
1144 { | 1146 { |
1145 /* This function can GC. */ | 1147 /* This function can GC. */ |
1146 REGISTER Lisp_Object tail, elt, tem; | 1148 REGISTER Lisp_Object tail, elt; |
1147 for (tail = list; !NILP (tail); tail = Fcdr (tail)) | 1149 for (tail = list; !NILP (tail); tail = Fcdr (tail)) |
1148 { | 1150 { |
1149 elt = Fcar (tail); | 1151 elt = Fcar (tail); |
1150 if (!CONSP (elt)) continue; | 1152 if (!CONSP (elt)) |
1151 tem = Fequal (Fcar (elt), key); | 1153 continue; |
1152 if (!NILP (tem)) return elt; | 1154 if (internal_equal (XCAR (elt), key, 0)) |
1155 return elt; | |
1153 QUIT; | 1156 QUIT; |
1154 } | 1157 } |
1155 return Qnil; | 1158 return Qnil; |
1156 } | 1159 } |
1157 | 1160 |
1160 The value is actually the element of LIST whose car equals KEY. | 1163 The value is actually the element of LIST whose car equals KEY. |
1161 */ | 1164 */ |
1162 (key, list)) | 1165 (key, list)) |
1163 { | 1166 { |
1164 /* This function can GC. */ | 1167 /* This function can GC. */ |
1165 REGISTER Lisp_Object tail, elt, tem; | 1168 REGISTER Lisp_Object tail, elt; |
1166 for (tail = list; !NILP (tail); tail = Fcdr (tail)) | 1169 for (tail = list; !NILP (tail); tail = Fcdr (tail)) |
1167 { | 1170 { |
1168 elt = Fcar (tail); | 1171 elt = Fcar (tail); |
1169 if (!CONSP (elt)) continue; | 1172 if (!CONSP (elt)) |
1170 tem = Fold_equal (Fcar (elt), key); | 1173 continue; |
1171 if (!NILP (tem)) return elt; | 1174 if (internal_old_equal (XCAR (elt), key, 0)) |
1175 return elt; | |
1172 QUIT; | 1176 QUIT; |
1173 } | 1177 } |
1174 return Qnil; | 1178 return Qnil; |
1175 } | 1179 } |
1176 | 1180 |
1191 { | 1195 { |
1192 REGISTER Lisp_Object tail, elt, tem; | 1196 REGISTER Lisp_Object tail, elt, tem; |
1193 for (tail = list; !NILP (tail); tail = Fcdr (tail)) | 1197 for (tail = list; !NILP (tail); tail = Fcdr (tail)) |
1194 { | 1198 { |
1195 elt = Fcar (tail); | 1199 elt = Fcar (tail); |
1196 if (!CONSP (elt)) continue; | 1200 if (!CONSP (elt)) |
1197 tem = Fcar (elt); | 1201 continue; |
1198 if (EQ_WITH_EBOLA_NOTICE (key, tem)) return elt; | 1202 /* Note: we use a temporary variable to avoid multiple |
1203 evaluations of XCAR (elt). */ | |
1204 tem = XCAR (elt); | |
1205 if (EQ_WITH_EBOLA_NOTICE (key, tem)) | |
1206 return elt; | |
1199 QUIT; | 1207 QUIT; |
1200 } | 1208 } |
1201 return Qnil; | 1209 return Qnil; |
1202 } | 1210 } |
1203 | 1211 |
1212 { | 1220 { |
1213 REGISTER Lisp_Object tail, elt, tem; | 1221 REGISTER Lisp_Object tail, elt, tem; |
1214 for (tail = list; !NILP (tail); tail = Fcdr (tail)) | 1222 for (tail = list; !NILP (tail); tail = Fcdr (tail)) |
1215 { | 1223 { |
1216 elt = Fcar (tail); | 1224 elt = Fcar (tail); |
1217 if (!CONSP (elt)) continue; | 1225 if (!CONSP (elt)) |
1218 tem = Fcar (elt); | 1226 continue; |
1219 if (HACKEQ_UNSAFE (key, tem)) return elt; | 1227 tem = XCAR (elt); |
1228 if (HACKEQ_UNSAFE (key, tem)) | |
1229 return elt; | |
1220 QUIT; | 1230 QUIT; |
1221 } | 1231 } |
1222 return Qnil; | 1232 return Qnil; |
1223 } | 1233 } |
1224 | 1234 |
1247 (key, list)) | 1257 (key, list)) |
1248 { | 1258 { |
1249 REGISTER Lisp_Object tail; | 1259 REGISTER Lisp_Object tail; |
1250 for (tail = list; !NILP (tail); tail = Fcdr (tail)) | 1260 for (tail = list; !NILP (tail); tail = Fcdr (tail)) |
1251 { | 1261 { |
1252 REGISTER Lisp_Object elt, tem; | 1262 REGISTER Lisp_Object elt; |
1253 elt = Fcar (tail); | 1263 elt = Fcar (tail); |
1254 if (!CONSP (elt)) continue; | 1264 if (!CONSP (elt)) |
1255 tem = Fequal (Fcdr (elt), key); | 1265 continue; |
1256 if (!NILP (tem)) return elt; | 1266 if (internal_equal (XCDR (elt), key, 0)) |
1267 return elt; | |
1257 QUIT; | 1268 QUIT; |
1258 } | 1269 } |
1259 return Qnil; | 1270 return Qnil; |
1260 } | 1271 } |
1261 | 1272 |
1266 (key, list)) | 1277 (key, list)) |
1267 { | 1278 { |
1268 REGISTER Lisp_Object tail; | 1279 REGISTER Lisp_Object tail; |
1269 for (tail = list; !NILP (tail); tail = Fcdr (tail)) | 1280 for (tail = list; !NILP (tail); tail = Fcdr (tail)) |
1270 { | 1281 { |
1271 REGISTER Lisp_Object elt, tem; | 1282 REGISTER Lisp_Object elt; |
1272 elt = Fcar (tail); | 1283 elt = Fcar (tail); |
1273 if (!CONSP (elt)) continue; | 1284 if (!CONSP (elt)) |
1274 tem = Fold_equal (Fcdr (elt), key); | 1285 continue; |
1275 if (!NILP (tem)) return elt; | 1286 if (internal_old_equal (XCDR (elt), key, 0)) |
1287 return elt; | |
1276 QUIT; | 1288 QUIT; |
1277 } | 1289 } |
1278 return Qnil; | 1290 return Qnil; |
1279 } | 1291 } |
1280 | 1292 |
1286 { | 1298 { |
1287 REGISTER Lisp_Object tail, elt, tem; | 1299 REGISTER Lisp_Object tail, elt, tem; |
1288 for (tail = list; !NILP (tail); tail = Fcdr (tail)) | 1300 for (tail = list; !NILP (tail); tail = Fcdr (tail)) |
1289 { | 1301 { |
1290 elt = Fcar (tail); | 1302 elt = Fcar (tail); |
1291 if (!CONSP (elt)) continue; | 1303 if (!CONSP (elt)) |
1292 tem = Fcdr (elt); | 1304 continue; |
1293 if (EQ_WITH_EBOLA_NOTICE (key, tem)) return elt; | 1305 tem = XCDR (elt); |
1306 if (EQ_WITH_EBOLA_NOTICE (key, tem)) | |
1307 return elt; | |
1294 QUIT; | 1308 QUIT; |
1295 } | 1309 } |
1296 return Qnil; | 1310 return Qnil; |
1297 } | 1311 } |
1298 | 1312 |
1304 { | 1318 { |
1305 REGISTER Lisp_Object tail, elt, tem; | 1319 REGISTER Lisp_Object tail, elt, tem; |
1306 for (tail = list; !NILP (tail); tail = Fcdr (tail)) | 1320 for (tail = list; !NILP (tail); tail = Fcdr (tail)) |
1307 { | 1321 { |
1308 elt = Fcar (tail); | 1322 elt = Fcar (tail); |
1309 if (!CONSP (elt)) continue; | 1323 if (!CONSP (elt)) |
1310 tem = Fcdr (elt); | 1324 continue; |
1311 if (HACKEQ_UNSAFE (key, tem)) return elt; | 1325 tem = XCDR (elt); |
1326 if (HACKEQ_UNSAFE (key, tem)) | |
1327 return elt; | |
1312 QUIT; | 1328 QUIT; |
1313 } | 1329 } |
1314 return Qnil; | 1330 return Qnil; |
1315 } | 1331 } |
1316 | 1332 |
1342 | 1358 |
1343 tail = list; | 1359 tail = list; |
1344 prev = Qnil; | 1360 prev = Qnil; |
1345 while (!NILP (tail)) | 1361 while (!NILP (tail)) |
1346 { | 1362 { |
1347 if (!NILP (Fequal (elt, Fcar (tail)))) | 1363 if (internal_equal (elt, Fcar (tail), 0)) |
1348 { | 1364 { |
1349 if (NILP (prev)) | 1365 if (NILP (prev)) |
1350 list = Fcdr (tail); | 1366 list = Fcdr (tail); |
1351 else | 1367 else |
1352 Fsetcdr (prev, Fcdr (tail)); | 1368 Fsetcdr (prev, Fcdr (tail)); |
1372 | 1388 |
1373 tail = list; | 1389 tail = list; |
1374 prev = Qnil; | 1390 prev = Qnil; |
1375 while (!NILP (tail)) | 1391 while (!NILP (tail)) |
1376 { | 1392 { |
1377 if (!NILP (Fold_equal (elt, Fcar (tail)))) | 1393 if (internal_old_equal (elt, Fcar (tail), 0)) |
1378 { | 1394 { |
1379 if (NILP (prev)) | 1395 if (NILP (prev)) |
1380 list = Fcdr (tail); | 1396 list = Fcdr (tail); |
1381 else | 1397 else |
1382 Fsetcdr (prev, Fcdr (tail)); | 1398 Fsetcdr (prev, Fcdr (tail)); |
1530 tail = list; | 1546 tail = list; |
1531 prev = Qnil; | 1547 prev = Qnil; |
1532 while (!NILP (tail)) | 1548 while (!NILP (tail)) |
1533 { | 1549 { |
1534 Lisp_Object elt = Fcar (tail); | 1550 Lisp_Object elt = Fcar (tail); |
1535 if (CONSP (elt) && ! NILP (Fequal (key, Fcar (elt)))) | 1551 if (CONSP (elt) && internal_equal (key, XCAR (elt), 0)) |
1536 { | 1552 { |
1537 if (NILP (prev)) | 1553 if (NILP (prev)) |
1538 list = Fcdr (tail); | 1554 list = Fcdr (tail); |
1539 else | 1555 else |
1540 Fsetcdr (prev, Fcdr (tail)); | 1556 Fsetcdr (prev, Fcdr (tail)); |
1627 tail = list; | 1643 tail = list; |
1628 prev = Qnil; | 1644 prev = Qnil; |
1629 while (!NILP (tail)) | 1645 while (!NILP (tail)) |
1630 { | 1646 { |
1631 Lisp_Object elt = Fcar (tail); | 1647 Lisp_Object elt = Fcar (tail); |
1632 if (CONSP (elt) && ! NILP (Fequal (value, Fcdr (elt)))) | 1648 if (CONSP (elt) && internal_equal (value, XCDR (elt), 0)) |
1633 { | 1649 { |
1634 if (NILP (prev)) | 1650 if (NILP (prev)) |
1635 list = Fcdr (tail); | 1651 list = Fcdr (tail); |
1636 else | 1652 else |
1637 Fsetcdr (prev, Fcdr (tail)); | 1653 Fsetcdr (prev, Fcdr (tail)); |