On Mon, Oct 22, 2007 at 12:03:50PM +0200, Szabolcs Nagy wrote:
> you could do
> 
> #define index_to_tag(i) (tags + i)
> #define tag_to_index(t) (t - tags)
> 
> as well and define every function with a void * argument
> (in this case you don't need these macros or ugly casts)

Ok. As you noted this requires a new set of changes: define every function
with a `void *' argument instead of `char *', plus a little change in the
definition of the `Key' structure.

Now, I am looking at the `config.def.h' and it seems to me that the majority
of the lines in the definition of the macro `KEYS' can be reformulated using
an `int' instead of a pointer type.

The cases `view', `toggleview', `tag' and `toggletag' are discussed in the
previous patch. The `setmwfact' case can be handled as

  "+0.05" --> 5
  "-0.05" --> -5

The `spawn' case can be handled defining a

const char *spawned_command[] = {
  ...,
  "exec uxterm",
  ...
};

then in the definition of KEYS:

  ...
  { MODKEY|ShiftMask,             XK_Return,      spawn,    1 }, \
  ...

Other cases does not require an argument.

So, `changing for changing', using an `int' instead of a `void*' avoids the
need of any type of explicit or implicit cast, thus the need for any macros
and to me, it seems sufficiently general.

Said this, your solution is probably a good trade-off between my two proposal.
If the overall idea will be considered worthy of including we will look better
at the details.

Gingioerge





Reply via email to