From: Chris Hanson Date: Sun, 21 Nov 2004 04:21:06 +0000 (+0000) Subject: Use EMPTY_LIST_P. X-Git-Tag: 20090517-FFI~1451 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=9f48eab40275925738460f10bec48d4812ca39d9;p=mit-scheme.git Use EMPTY_LIST_P. --- diff --git a/v7/src/microcode/daemon.c b/v7/src/microcode/daemon.c index 26414fd28..847cfde51 100644 --- a/v7/src/microcode/daemon.c +++ b/v7/src/microcode/daemon.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: daemon.c,v 9.33 2003/02/14 18:28:18 cph Exp $ +$Id: daemon.c,v 9.34 2004/11/21 04:17:22 cph Exp $ Copyright (c) 1987-1999 Massachusetts Institute of Technology @@ -52,7 +52,7 @@ DEFINE_PRIMITIVE ("CLOSE-LOST-OPEN-FILES", Prim_close_lost_open_files, 1, 1, 0) SCHEME_OBJECT file_list = (ARG_REF (1)); SCHEME_OBJECT * smash = (PAIR_CDR_LOC (file_list)); SCHEME_OBJECT cell = (*smash); - while (cell != EMPTY_LIST) + while (!EMPTY_LIST_P (cell)) { SCHEME_OBJECT weak_cell = (FAST_PAIR_CAR (cell)); if ((FAST_PAIR_CAR (weak_cell)) == SHARP_F) @@ -96,7 +96,6 @@ DEFUN (rehash_pair, (pair, hash_table, table_size), FAST_MEMORY_SET (hash_table, hash_address, (MAKE_POINTER_OBJECT (TC_LIST, new_pair))); - return; } static void @@ -106,7 +105,7 @@ DEFUN (rehash_bucket, (bucket, hash_table, table_size), { fast SCHEME_OBJECT weak_pair; - while (*bucket != EMPTY_LIST) + while (!EMPTY_LIST_P (*bucket)) { weak_pair = (FAST_PAIR_CAR (*bucket)); if ((FAST_PAIR_CAR (weak_pair)) != SHARP_F) @@ -115,7 +114,6 @@ DEFUN (rehash_bucket, (bucket, hash_table, table_size), } bucket = (PAIR_CDR_LOC (*bucket)); } - return; } static void @@ -125,7 +123,7 @@ DEFUN (splice_and_rehash_bucket, (bucket, hash_table, table_size), { fast SCHEME_OBJECT weak_pair; - while ((*bucket) != EMPTY_LIST) + while (!EMPTY_LIST_P (*bucket)) { weak_pair = (FAST_PAIR_CAR (*bucket)); if ((FAST_PAIR_CAR (weak_pair)) != SHARP_F) @@ -136,7 +134,6 @@ DEFUN (splice_and_rehash_bucket, (bucket, hash_table, table_size), else *bucket = (FAST_PAIR_CDR (*bucket)); } - return; } /* (REHASH unhash-table hash-table) diff --git a/v7/src/microcode/debug.c b/v7/src/microcode/debug.c index 88a7e624f..ab13ae382 100644 --- a/v7/src/microcode/debug.c +++ b/v7/src/microcode/debug.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: debug.c,v 9.57 2003/02/14 18:28:18 cph Exp $ +$Id: debug.c,v 9.58 2004/11/21 04:17:29 cph Exp $ Copyright (c) 1987-2002 Massachusetts Institute of Technology @@ -232,7 +232,7 @@ DEFUN (print_list, (stream, pair), outf_channel stream AND SCHEME_OBJECT pair) pair = (PAIR_CDR (pair)); count += 1; } - if (pair != EMPTY_LIST) + if (!EMPTY_LIST_P (pair)) { if (count == MAX_LIST_PRINT) outf (stream, " ..."); @@ -433,7 +433,7 @@ DEFUN (do_printing, (stream, Expr, Detailed), Temp_Address = (OBJECT_DATUM (Expr)); handled_p = false; - if (Expr == EMPTY_LIST) { outf (stream, "()"); return; } + if (EMPTY_LIST_P (Expr)) { outf (stream, "()"); return; } else if (Expr == SHARP_F) { outf (stream, "#F"); return; } else if (Expr == SHARP_T) { outf (stream, "#T"); return; } else if (Expr == UNSPECIFIC) { outf (stream, "[UNSPECIFIC]"); return; } diff --git a/v7/src/microcode/foreign.c b/v7/src/microcode/foreign.c index 969c2e8fd..706abed11 100644 --- a/v7/src/microcode/foreign.c +++ b/v7/src/microcode/foreign.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: foreign.c,v 1.5 2003/02/14 18:28:19 cph Exp $ +$Id: foreign.c,v 1.6 2004/11/21 04:17:37 cph Exp $ Copyright (c) 1992, 1999, 2000 Massachusetts Institute of Technology @@ -521,7 +521,7 @@ If LOAD_INFO is #F then we search over all the dynamically loaded files.") PTR func_ptr; LOAD_INFO * load_info; - load_info = ((ARG_REF (2) == EMPTY_LIST) ? + load_info = ((EMPTY_LIST_P (ARG_REF (2))) ? ((LOAD_INFO *) NULL) : ((LOAD_INFO *) handle_to_foreign_pointer (arg_handle (2)))); diff --git a/v7/src/microcode/hooks.c b/v7/src/microcode/hooks.c index 75230f85f..53fbdd58d 100644 --- a/v7/src/microcode/hooks.c +++ b/v7/src/microcode/hooks.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: hooks.c,v 9.65 2003/02/14 18:28:19 cph Exp $ +$Id: hooks.c,v 9.66 2004/11/21 04:17:44 cph Exp $ Copyright (c) 1988-2002 Massachusetts Institute of Technology @@ -84,7 +84,7 @@ Invoke PROCEDURE on the arguments contained in list-of-ARGS.") number_of_args += 2; } } - if (scan_list != EMPTY_LIST) + if (!EMPTY_LIST_P (scan_list)) error_wrong_type_arg (2); } diff --git a/v7/src/microcode/image.c b/v7/src/microcode/image.c index 4f4c9dc00..213ea2435 100644 --- a/v7/src/microcode/image.c +++ b/v7/src/microcode/image.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: image.c,v 9.36 2003/02/14 18:28:19 cph Exp $ +$Id: image.c,v 9.37 2004/11/21 04:17:59 cph Exp $ Copyright (c) 1987-1999 Massachusetts Institute of Technology @@ -51,7 +51,7 @@ arg_image (arg_number, nrows, ncols, array) if (! (PAIR_P (rest))) goto loser; third = (PAIR_CAR (rest)); if (! (ARRAY_P (third))) goto loser; - if ((PAIR_CDR (rest)) != EMPTY_LIST) goto loser; + if (!EMPTY_LIST_P (PAIR_CDR (rest))) goto loser; (*nrows) = (UNSIGNED_FIXNUM_TO_LONG (first)); (*ncols) = (UNSIGNED_FIXNUM_TO_LONG (second)); (*array) = (ARRAY_CONTENTS (third)); diff --git a/v7/src/microcode/intercom.c b/v7/src/microcode/intercom.c index 4c4d0002f..50ae2f526 100644 --- a/v7/src/microcode/intercom.c +++ b/v7/src/microcode/intercom.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: intercom.c,v 9.35 2003/02/14 18:28:19 cph Exp $ +$Id: intercom.c,v 9.36 2004/11/21 04:18:06 cph Exp $ Copyright (c) 1987-1999, 2002 Massachusetts Institute of Technology @@ -90,7 +90,7 @@ DEFINE_PRIMITIVE ("PUT-WORK", Prim_put_work, 1, 1, 0) PRIMITIVE_HEADER (1); { SCHEME_OBJECT queue = (Get_Fixed_Obj_Slot (The_Work_Queue)); - if (queue == EMPTY_LIST) + if (EMPTY_LIST_P (queue)) { queue = (cons (EMPTY_LIST, EMPTY_LIST)); Set_Fixed_Obj_Slot (The_Work_Queue, queue); @@ -99,7 +99,7 @@ DEFINE_PRIMITIVE ("PUT-WORK", Prim_put_work, 1, 1, 0) SCHEME_OBJECT queue_tail = (PAIR_CDR (queue)); SCHEME_OBJECT new_entry = (cons ((ARG_REF (1)), EMPTY_LIST)); SET_PAIR_CDR (queue, new_entry); - if (queue_tail == EMPTY_LIST) + if (EMPTY_LIST_P (queue_tail)) SET_PAIR_CAR (queue, new_entry); else SET_PAIR_CDR (queue_tail, new_entry); @@ -113,7 +113,7 @@ DEFINE_PRIMITIVE ("PUT-WORK-IN-FRONT", Prim_put_work_in_front, 1, 1, 0) PRIMITIVE_HEADER (1); { SCHEME_OBJECT queue = (Get_Fixed_Obj_Slot (The_Work_Queue)); - if (queue == EMPTY_LIST) + if (EMPTY_LIST_P (queue)) { queue = (cons (EMPTY_LIST, EMPTY_LIST)); Set_Fixed_Obj_Slot (The_Work_Queue, queue); @@ -122,7 +122,7 @@ DEFINE_PRIMITIVE ("PUT-WORK-IN-FRONT", Prim_put_work_in_front, 1, 1, 0) SCHEME_OBJECT queue_head = (PAIR_CAR (queue)); SCHEME_OBJECT new_entry = (cons ((ARG_REF (1)), queue_head)); SET_PAIR_CAR (queue, new_entry); - if (queue_head == EMPTY_LIST) + if (EMPTY_LIST_P (queue_head)) SET_PAIR_CDR (queue, new_entry); } } @@ -135,7 +135,7 @@ DEFINE_PRIMITIVE ("DRAIN-WORK-QUEUE!", Prim_drain_queue, 0, 0, 0) { SCHEME_OBJECT queue = (Get_Fixed_Obj_Slot (The_Work_Queue)); Set_Fixed_Obj_Slot (The_Work_Queue, EMPTY_LIST); - PRIMITIVE_RETURN ((queue != EMPTY_LIST) ? (PAIR_CAR (queue)) : EMPTY_LIST); + PRIMITIVE_RETURN ((!EMPTY_LIST_P (queue)) ? (PAIR_CAR (queue)) : EMPTY_LIST); } } @@ -144,14 +144,14 @@ DEFINE_PRIMITIVE ("PEEK-AT-WORK-QUEUE", Prim_peek_queue, 0, 0, 0) PRIMITIVE_HEADER (0); { fast SCHEME_OBJECT queue = (Get_Fixed_Obj_Slot (The_Work_Queue)); - if (queue == EMPTY_LIST) + if (EMPTY_LIST_P (queue)) PRIMITIVE_RETURN (EMPTY_LIST); /* Reverse the queue and return it. (Why is it being reversed? -- cph) */ { fast SCHEME_OBJECT this_pair = (PAIR_CAR (queue)); fast SCHEME_OBJECT result = EMPTY_LIST; - while (this_pair != EMPTY_LIST) + while (!EMPTY_LIST_P (this_pair)) { result = (cons ((PAIR_CAR (this_pair)), result)); this_pair = (PAIR_CDR (this_pair)); @@ -170,8 +170,8 @@ DEFINE_PRIMITIVE ("GET-WORK", Prim_get_work, 1, 1, 0) SCHEME_OBJECT primitive = (Registers[REGBLOCK_PRIMITIVE]); SCHEME_OBJECT queue = (Get_Fixed_Obj_Slot (The_Work_Queue)); SCHEME_OBJECT queue_head = - ((queue == EMPTY_LIST) ? EMPTY_LIST : (PAIR_CAR (queue))); - if (queue_head == EMPTY_LIST) + ((EMPTY_LIST_P (queue)) ? EMPTY_LIST : (PAIR_CAR (queue))); + if (EMPTY_LIST_P (queue_head)) { if (thunk == SHARP_F) { @@ -200,7 +200,7 @@ DEFINE_PRIMITIVE ("GET-WORK", Prim_get_work, 1, 1, 0) SCHEME_OBJECT result = (PAIR_CAR (queue_head)); queue_head = (PAIR_CDR (queue_head)); SET_PAIR_CAR (queue, queue_head); - if (queue_head == EMPTY_LIST) + if (EMPTY_LIST_P (queue_head)) SET_PAIR_CDR (queue, EMPTY_LIST); PRIMITIVE_RETURN (result); } diff --git a/v7/src/microcode/intern.c b/v7/src/microcode/intern.c index fd0f9452e..b4771a9ee 100644 --- a/v7/src/microcode/intern.c +++ b/v7/src/microcode/intern.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: intern.c,v 9.59 2003/02/14 18:28:19 cph Exp $ +$Id: intern.c,v 9.60 2004/11/21 04:18:14 cph Exp $ Copyright (c) 1987-2000 Massachusetts Institute of Technology @@ -95,7 +95,7 @@ DEFUN (find_symbol_internal, (length, string), % (VECTOR_LENGTH (obarray))) + 1))); } - while ((*bucket) != EMPTY_LIST) + while (!EMPTY_LIST_P (*bucket)) { fast SCHEME_OBJECT symbol = (PAIR_CAR (*bucket)); fast SCHEME_OBJECT name = (FAST_MEMORY_REF (symbol, SYMBOL_NAME)); @@ -131,7 +131,7 @@ SCHEME_OBJECT DEFUN (find_symbol, (length, string), long length AND unsigned char * string) { SCHEME_OBJECT result = (* (find_symbol_internal (length, string))); - return ((result == EMPTY_LIST) ? SHARP_F : result); + return ((EMPTY_LIST_P (result)) ? SHARP_F : result); } static SCHEME_OBJECT @@ -156,7 +156,7 @@ DEFUN (memory_to_symbol, (length, string), { SCHEME_OBJECT * cell = (find_symbol_internal (length, string)); return - (((*cell) == EMPTY_LIST) + ((EMPTY_LIST_P (*cell)) ? (make_symbol ((memory_to_string (length, string)), cell)) : (*cell)); } @@ -173,7 +173,7 @@ DEFUN (string_to_symbol, (string), SCHEME_OBJECT string) SCHEME_OBJECT * cell = (find_symbol_internal ((STRING_LENGTH (string)), (STRING_LOC (string, 0)))); - return (((*cell) == EMPTY_LIST) ? (make_symbol (string, cell)) : (*cell)); + return ((EMPTY_LIST_P (*cell)) ? (make_symbol (string, cell)) : (*cell)); } SCHEME_OBJECT @@ -182,7 +182,7 @@ DEFUN (intern_symbol, (symbol), SCHEME_OBJECT symbol) SCHEME_OBJECT name = (FAST_MEMORY_REF (symbol, SYMBOL_NAME)); SCHEME_OBJECT * cell = (find_symbol_internal ((STRING_LENGTH (name)), (STRING_LOC (name, 0)))); - return (((*cell) == EMPTY_LIST) + return ((EMPTY_LIST_P (*cell)) ? (link_new_symbol (symbol, cell)) : (*cell)); } diff --git a/v7/src/microcode/intprm.c b/v7/src/microcode/intprm.c index 4c506dddc..c39d381e2 100644 --- a/v7/src/microcode/intprm.c +++ b/v7/src/microcode/intprm.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: intprm.c,v 1.11 2003/02/14 18:28:19 cph Exp $ +$Id: intprm.c,v 1.12 2004/11/21 04:18:27 cph Exp $ Copyright (c) 1989-1999 Massachusetts Institute of Technology @@ -221,7 +221,7 @@ Converts the list to an integer. NEGATIVE? specifies the sign.") error_bad_range_arg (1); n_digits += 1; scan = (PAIR_CDR (scan)); - if (scan == EMPTY_LIST) + if (EMPTY_LIST_P (scan)) break; if (!PAIR_P (scan)) error_wrong_type_arg (1); diff --git a/v7/src/microcode/list.c b/v7/src/microcode/list.c index 0c62f4992..172e9a127 100644 --- a/v7/src/microcode/list.c +++ b/v7/src/microcode/list.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: list.c,v 9.34 2003/02/14 18:28:19 cph Exp $ +$Id: list.c,v 9.35 2004/11/21 04:18:35 cph Exp $ Copyright (c) 1987-1999 Massachusetts Institute of Technology @@ -190,7 +190,7 @@ DEFINE_PRIMITIVE ("LENGTH", Prim_length, 1, 1, i += 1; TOUCH_IN_PRIMITIVE ((PAIR_CDR (list)), list); } - if (list != EMPTY_LIST) + if (!EMPTY_LIST_P (list)) error_wrong_type_arg (1); PRIMITIVE_RETURN (LONG_TO_UNSIGNED_FIXNUM (i)); } @@ -230,7 +230,7 @@ DEFINE_PRIMITIVE ("MEMQ", Prim_memq, 2, 2, PRIMITIVE_RETURN (list); TOUCH_IN_PRIMITIVE ((PAIR_CDR (list)), list); } - if (list != EMPTY_LIST) + if (!EMPTY_LIST_P (list)) error_wrong_type_arg (2); PRIMITIVE_RETURN (SHARP_F); } @@ -277,7 +277,7 @@ DEFINE_PRIMITIVE ("ASSQ", Prim_assq, 2, 2, PRIMITIVE_RETURN (association); TOUCH_IN_PRIMITIVE ((PAIR_CDR (alist)), alist); } - if (alist != EMPTY_LIST) + if (!EMPTY_LIST_P (alist)) error_wrong_type_arg (2); PRIMITIVE_RETURN (SHARP_F); } diff --git a/v7/src/microcode/object.h b/v7/src/microcode/object.h index 0e37499c9..353bce381 100644 --- a/v7/src/microcode/object.h +++ b/v7/src/microcode/object.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: object.h,v 9.55 2003/11/26 05:01:25 cph Exp $ +$Id: object.h,v 9.56 2004/11/21 04:18:43 cph Exp $ Copyright 1986,1987,1988,1989,1990,1992 Massachusetts Institute of Technology Copyright 1993,1995,1997,1998,2000,2001 Massachusetts Institute of Technology @@ -198,7 +198,7 @@ extern SCHEME_OBJECT * memory_base; #define PRIMITIVE_P(object) ((OBJECT_TYPE (object)) == TC_PRIMITIVE) #define FUTURE_P(object) ((OBJECT_TYPE (object)) == TC_FUTURE) #define PROMISE_P(object) ((OBJECT_TYPE (object)) == TC_DELAYED) -#define APPARENT_LIST_P(object) (((object) == EMPTY_LIST) || (PAIR_P (object))) +#define APPARENT_LIST_P(object) ((EMPTY_LIST_P (object)) || (PAIR_P (object))) #define CONTROL_POINT_P(object) ((OBJECT_TYPE (object)) == TC_CONTROL_POINT) #define BROKEN_HEART_P(object) ((OBJECT_TYPE (object)) == TC_BROKEN_HEART) #define GC_NON_POINTER_P(object) ((GC_Type (object)) == GC_Non_Pointer) diff --git a/v7/src/microcode/prim.c b/v7/src/microcode/prim.c index 53e2cf15a..c8e6d0de3 100644 --- a/v7/src/microcode/prim.c +++ b/v7/src/microcode/prim.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: prim.c,v 9.42 2004/07/04 05:23:43 cph Exp $ +$Id: prim.c,v 9.43 2004/11/21 04:21:06 cph Exp $ Copyright 1986,1987,1988,1989,1992,1993 Massachusetts Institute of Technology Copyright 1996,2004 Massachusetts Institute of Technology @@ -217,7 +217,7 @@ DEFINE_PRIMITIVE ("NULL?", Prim_null_p, 1, 1, 0) fast SCHEME_OBJECT object; PRIMITIVE_HEADER (1); TOUCH_IN_PRIMITIVE ((ARG_REF (1)), object); - PRIMITIVE_RETURN (BOOLEAN_TO_OBJECT (object == EMPTY_LIST)); + PRIMITIVE_RETURN (BOOLEAN_TO_OBJECT (EMPTY_LIST_P (object))); } /* Cells */ diff --git a/v7/src/microcode/sgraph_a.c b/v7/src/microcode/sgraph_a.c index c5d2e263e..3dff31b58 100644 --- a/v7/src/microcode/sgraph_a.c +++ b/v7/src/microcode/sgraph_a.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: sgraph_a.c,v 1.18 2003/02/14 18:28:23 cph Exp $ +$Id: sgraph_a.c,v 1.19 2004/11/21 04:18:52 cph Exp $ Copyright (c) 1987-1999 Massachusetts Institute of Technology @@ -63,7 +63,7 @@ arg_plotting_box (arg_number, plotting_box) } TOUCH_IN_PRIMITIVE ((PAIR_CDR (object)), object); } - if (object != EMPTY_LIST) + if (!EMPTY_LIST_P (object)) error_wrong_type_arg (arg_number); return; } @@ -323,7 +323,7 @@ DEFINE_PRIMITIVE ("POLYGON2D", Prim_polygon2d, 2,2, 0) error_bad_range_arg (2); TOUCH_IN_PRIMITIVE ((PAIR_CDR (object)), object); } - if (object != EMPTY_LIST) + if (!EMPTY_LIST_P (object)) error_wrong_type_arg (2); (clist [count]) = (clist [0]); diff --git a/v7/src/microcode/step.c b/v7/src/microcode/step.c index e8ad9d0cf..a68ba66f0 100644 --- a/v7/src/microcode/step.c +++ b/v7/src/microcode/step.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: step.c,v 9.38 2003/02/14 18:28:23 cph Exp $ +$Id: step.c,v 9.39 2004/11/21 04:19:00 cph Exp $ Copyright (c) 1987-1999, 2002 Massachusetts Institute of Technology @@ -107,7 +107,7 @@ DEFINE_PRIMITIVE ("PRIMITIVE-APPLY-STEP", Prim_apply_step, 3, 3, 0) number_of_args += 1; TOUCH_IN_PRIMITIVE ((PAIR_CDR (scan_list)), scan_list); } - if (scan_list != EMPTY_LIST) + if (!EMPTY_LIST_P (scan_list)) error_wrong_type_arg (2); } POP_PRIMITIVE_FRAME (3); diff --git a/v7/src/microcode/vector.c b/v7/src/microcode/vector.c index fdfd119a3..fd342ba8b 100644 --- a/v7/src/microcode/vector.c +++ b/v7/src/microcode/vector.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: vector.c,v 9.41 2003/02/14 18:28:24 cph Exp $ +$Id: vector.c,v 9.42 2004/11/21 04:19:06 cph Exp $ Copyright (c) 1987-1999 Massachusetts Institute of Technology @@ -280,7 +280,7 @@ DEFUN (list_to_vector, (result_type, argument_number), (*Free++) = (PAIR_CAR (list)); TOUCH_IN_PRIMITIVE ((PAIR_CDR (list)), list); } - if (list != EMPTY_LIST) + if (!EMPTY_LIST_P (list)) error_wrong_type_arg (argument_number); (*result) = (MAKE_OBJECT (TC_MANIFEST_VECTOR, count)); return (MAKE_POINTER_OBJECT (result_type, result));