Commit 7082eac6 authored by Paul Eggert's avatar Paul Eggert

* lisp.h: New macros GCPRO2_VAR, GCPRO3_VAR, etc.

parent 38b2c076
2011-03-15 Paul Eggert <eggert@cs.ucla.edu>
* lisp.h (GCPRO2_VAR, GCPRO3_VAR, GCPRO4_VAR, GCPRO5_VAR, GCPRO6_VAR):
New macros, so that the caller can use some names other than
gcpro1, gcpro2, etc.
(GCPRO2, GCPRO3, GCPRO4, GCPRO5, GCPRO6): Reimplement in terms
of the new macros.
(GCPRO1_VAR, UNGCPRO_VAR): Change the meaning of the second
argument, for consistency with GCPRO2_VAR, etc: it is now the
prefix of the variable, not the variable itself. All uses
changed.
* dired.c (directory_files_internal, file_name_completion):
Rename locals to avoid shadowing.
......@@ -2942,7 +2942,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
keys = Fcopy_sequence (this_command_keys);
else
keys = Qnil;
GCPRO1_VAR (keys, inner_gcpro1);
GCPRO1_VAR (keys, inner_gcpro);
/* Clear out this_command_keys. */
this_command_key_count = 0;
......@@ -2980,7 +2980,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
if (saved_immediate_echo)
echo_now ();
UNGCPRO_VAR (inner_gcpro1);
UNGCPRO_VAR (inner_gcpro);
/* The input method can return no events. */
if (! CONSP (tem))
......@@ -8963,7 +8963,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
struct gcpro outer_gcpro1;
GCPRO1_VAR (fake_prefixed_keys, outer_gcpro1);
GCPRO1_VAR (fake_prefixed_keys, outer_gcpro);
raw_keybuf_count = 0;
last_nonmenu_event = Qnil;
......@@ -9258,7 +9258,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
if (EQ (key, Qt))
{
unbind_to (count, Qnil);
UNGCPRO_VAR (outer_gcpro1);
UNGCPRO_VAR (outer_gcpro);
return -1;
}
......@@ -9941,7 +9941,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
add_command_key (keybuf[t]);
}
UNGCPRO_VAR (outer_gcpro1);
UNGCPRO_VAR (outer_gcpro);
return t;
}
......
......@@ -2109,129 +2109,143 @@ struct gcpro
|| GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS)
#define GCPRO1(varname) GCPRO1_VAR (varname, gcpro1)
#define UNGCPRO UNGCPRO_VAR (gcpro1)
#define GCPRO1(var) \
GCPRO1_VAR (var, gcpro)
#define GCPRO2(var1, var2) \
GCPRO2_VAR (var1, var2, gcpro)
#define GCPRO3(var1, var2, var3) \
GCPRO3_VAR (var1, var2, var3, gcpro)
#define GCPRO4(var1, var2, var3, var4) \
GCPRO4_VAR (var1, var2, var3, var4, gcpro)
#define GCPRO5(var1, var2, var3, var4, var5) \
GCPRO5_VAR (var1, var2, var3, var4, var5, gcpro)
#define GCPRO6(var1, var2, var3, var4, var5, var6) \
GCPRO6_VAR (var1, var2, var3, var4, var5, var6, gcpro)
#define UNGCPRO UNGCPRO_VAR (gcpro)
#if GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS
/* Do something silly with gcproN vars just so gcc shuts up. */
/* You get warnings from MIPSPro... */
#define GCPRO1_VAR(varname, gcpro1) ((void) gcpro1)
#define GCPRO2(varname1, varname2)(((void) gcpro2, (void) gcpro1))
#define GCPRO3(varname1, varname2, varname3) \
(((void) gcpro3, (void) gcpro2, (void) gcpro1))
#define GCPRO4(varname1, varname2, varname3, varname4) \
(((void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1))
#define GCPRO5(varname1, varname2, varname3, varname4, varname5) \
(((void) gcpro5, (void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1))
#define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \
(((void) gcpro6, (void) gcpro5, (void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1))
#define UNGCPRO_VAR(gcpro1) ((void) 0)
#define GCPRO1_VAR(var, gcpro) ((void) gcpro##1)
#define GCPRO2_VAR(var1, var2, gcpro) \
((void) gcpro##2, (void) gcpro##1)
#define GCPRO3_VAR(var1, var2, var3, gcpro) \
((void) gcpro##3, (void) gcpro##2, (void) gcpro##1)
#define GCPRO4_VAR(var1, var2, var3, var4, gcpro) \
((void) gcpro##4, (void) gcpro##3, (void) gcpro##2, (void) gcpro##1)
#define GCPRO5_VAR(var1, var2, var3, var4, var5, gcpro) \
((void) gcpro##5, (void) gcpro##4, (void) gcpro##3, (void) gcpro##2, \
(void) gcpro##1)
#define GCPRO6_VAR(var1, var2, var3, var4, var5, var6, gcpro) \
((void) gcpro##6, (void) gcpro##5, (void) gcpro##4, (void) gcpro##3, \
(void) gcpro##2, (void) gcpro##1)
#define UNGCPRO_VAR(gcpro) ((void) 0)
#else /* GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS */
#ifndef DEBUG_GCPRO
#define GCPRO1_VAR(varname, gcpro1) \
{gcpro1.next = gcprolist; gcpro1.var = &varname; gcpro1.nvars = 1; \
gcprolist = &gcpro1; }
#define GCPRO2(varname1, varname2) \
{gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
gcprolist = &gcpro2; }
#define GCPRO3(varname1, varname2, varname3) \
{gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
gcprolist = &gcpro3; }
#define GCPRO4(varname1, varname2, varname3, varname4) \
{gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \
gcprolist = &gcpro4; }
#define GCPRO5(varname1, varname2, varname3, varname4, varname5) \
{gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \
gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \
gcprolist = &gcpro5; }
#define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \
{gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \
gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \
gcpro6.next = &gcpro5; gcpro6.var = &varname6; gcpro6.nvars = 1; \
gcprolist = &gcpro6; }
#define UNGCPRO_VAR(gcpro1) (gcprolist = gcpro1.next)
#define GCPRO1_VAR(var, gcpro) \
{gcpro##1.next = gcprolist; gcpro##1.var = &var; gcpro##1.nvars = 1; \
gcprolist = &gcpro##1; }
#define GCPRO2_VAR(var1, var2, gcpro) \
{gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \
gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \
gcprolist = &gcpro##2; }
#define GCPRO3_VAR(var1, var2, var3, gcpro) \
{gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \
gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \
gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \
gcprolist = &gcpro##3; }
#define GCPRO4_VAR(var1, var2, var3, var4, gcpro) \
{gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \
gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \
gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \
gcpro##4.next = &gcpro##3; gcpro##4.var = &var4; gcpro##4.nvars = 1; \
gcprolist = &gcpro##4; }
#define GCPRO5_VAR(var1, var2, var3, var4, var5, gcpro) \
{gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \
gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \
gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \
gcpro##4.next = &gcpro##3; gcpro##4.var = &var4; gcpro##4.nvars = 1; \
gcpro##5.next = &gcpro##4; gcpro##5.var = &var5; gcpro##5.nvars = 1; \
gcprolist = &gcpro##5; }
#define GCPRO6_VAR(var1, var2, var3, var4, var5, var6, gcpro) \
{gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \
gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \
gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \
gcpro##4.next = &gcpro##3; gcpro##4.var = &var4; gcpro##4.nvars = 1; \
gcpro##5.next = &gcpro##4; gcpro##5.var = &var5; gcpro##5.nvars = 1; \
gcpro##6.next = &gcpro##5; gcpro##6.var = &var6; gcpro##6.nvars = 1; \
gcprolist = &gcpro##6; }
#define UNGCPRO_VAR(gcpro) (gcprolist = gcpro##1.next)
#else
extern int gcpro_level;
#define GCPRO1_VAR(varname, gcpro1) \
{gcpro1.next = gcprolist; gcpro1.var = &varname; gcpro1.nvars = 1; \
gcpro1.level = gcpro_level++; \
gcprolist = &gcpro1; }
#define GCPRO2(varname1, varname2) \
{gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
gcpro1.level = gcpro_level; \
gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
gcpro2.level = gcpro_level++; \
gcprolist = &gcpro2; }
#define GCPRO3(varname1, varname2, varname3) \
{gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
gcpro1.level = gcpro_level; \
gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
gcpro3.level = gcpro_level++; \
gcprolist = &gcpro3; }
#define GCPRO4(varname1, varname2, varname3, varname4) \
{gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
gcpro1.level = gcpro_level; \
gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \
gcpro4.level = gcpro_level++; \
gcprolist = &gcpro4; }
#define GCPRO5(varname1, varname2, varname3, varname4, varname5) \
{gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
gcpro1.level = gcpro_level; \
gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \
gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \
gcpro5.level = gcpro_level++; \
gcprolist = &gcpro5; }
#define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \
{gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
gcpro1.level = gcpro_level; \
gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \
gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \
gcpro6.next = &gcpro5; gcpro6.var = &varname6; gcpro6.nvars = 1; \
gcpro6.level = gcpro_level++; \
gcprolist = &gcpro6; }
#define UNGCPRO_VAR(gcpro1) \
((--gcpro_level != gcpro1.level) \
? (abort (), 0) \
: ((gcprolist = gcpro1.next), 0))
#define GCPRO1_VAR(var, gcpro) \
{gcpro##1.next = gcprolist; gcpro##1.var = &var; gcpro##1.nvars = 1; \
gcpro##1.level = gcpro_level++; \
gcprolist = &gcpro##1; }
#define GCPRO2_VAR(var1, var2, gcpro) \
{gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \
gcpro##1.level = gcpro_level; \
gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \
gcpro##2.level = gcpro_level++; \
gcprolist = &gcpro##2; }
#define GCPRO3_VAR(var1, var2, var3, gcpro) \
{gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \
gcpro##1.level = gcpro_level; \
gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \
gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \
gcpro##3.level = gcpro_level++; \
gcprolist = &gcpro##3; }
#define GCPRO4_VAR(var1, var2, var3, var4, gcpro) \
{gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \
gcpro##1.level = gcpro_level; \
gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \
gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \
gcpro##4.next = &gcpro##3; gcpro##4.var = &var4; gcpro##4.nvars = 1; \
gcpro##4.level = gcpro_level++; \
gcprolist = &gcpro##4; }
#define GCPRO5_VAR(var1, var2, var3, var4, var5, gcpro) \
{gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \
gcpro##1.level = gcpro_level; \
gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \
gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \
gcpro##4.next = &gcpro##3; gcpro##4.var = &var4; gcpro##4.nvars = 1; \
gcpro##5.next = &gcpro##4; gcpro##5.var = &var5; gcpro##5.nvars = 1; \
gcpro##5.level = gcpro_level++; \
gcprolist = &gcpro##5; }
#define GCPRO6_VAR(var1, var2, var3, var4, var5, var6, gcpro) \
{gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \
gcpro##1.level = gcpro_level; \
gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \
gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \
gcpro##4.next = &gcpro##3; gcpro##4.var = &var4; gcpro##4.nvars = 1; \
gcpro##5.next = &gcpro##4; gcpro##5.var = &var5; gcpro##5.nvars = 1; \
gcpro##6.next = &gcpro##5; gcpro##6.var = &var6; gcpro##6.nvars = 1; \
gcpro##6.level = gcpro_level++; \
gcprolist = &gcpro##6; }
#define UNGCPRO_VAR(gcpro) \
((--gcpro_level != gcpro##1.level) \
? (abort (), 0) \
: ((gcprolist = gcpro##1.next), 0))
#endif /* DEBUG_GCPRO */
#endif /* GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS */
......
......@@ -3196,7 +3196,7 @@ This function is an internal primitive--use `make-frame' instead. */)
f->output_data.x->mouse_pixel = -1;
black = build_string ("black");
GCPRO1_VAR (black, inner_gcpro1);
GCPRO1_VAR (black, inner_gcpro);
FRAME_FOREGROUND_PIXEL (f)
= x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
FRAME_BACKGROUND_PIXEL (f)
......@@ -3209,7 +3209,7 @@ This function is an internal primitive--use `make-frame' instead. */)
= x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
f->output_data.x->mouse_pixel
= x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
UNGCPRO_VAR (inner_gcpro1);
UNGCPRO_VAR (inner_gcpro);
}
/* Specify the parent under which to make this X window. */
......@@ -4664,7 +4664,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
f->output_data.x->mouse_pixel = -1;
black = build_string ("black");
GCPRO1_VAR (black, inner_gcpro1);
GCPRO1_VAR (black, inner_gcpro);
FRAME_FOREGROUND_PIXEL (f)
= x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
FRAME_BACKGROUND_PIXEL (f)
......@@ -4677,7 +4677,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
= x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
f->output_data.x->mouse_pixel
= x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
UNGCPRO_VAR (inner_gcpro1);
UNGCPRO_VAR (inner_gcpro);
}
/* Set the name; the functions to which we pass f expect the name to
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment