[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch for fields of `struct buffer'

From: Tom Tromey
Subject: Re: Patch for fields of `struct buffer'
Date: Fri, 28 Jan 2011 10:36:19 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

>>>>> "Kim" == Kim F Storm <address@hidden> writes:

Kim> Just wondering how "unreadable" the resulting code becomes with
Kim> all those new macros ....

I find it pretty much in keeping with the already heavy macroization in
emacs, but YMMV.  Take a glance at the patch -- nearly any part will
do -- and let me know what you think.

Kim> Rather than defining all the individual BUF_xxxx(buf) macros 
Kim> for each field buf->xxxx field, would it be possible to factor
Kim> this out in a single accessor macro like
Kim>       B_(buf, XXXX)
Kim> If necessary, behind the scenes (by help of the proprocessor),
Kim> this could further map into a BUF_xxxx(buf) macro, but I don't
Kim> know what kind of mapping the BUF_XXXX macros are supposed to
Kim> do, so I cannot say whether it is possible or not...

Yes, this would work.  I will implement it if it is generally agreed
upon, or more specifically if Stefan wants it this way :-)

The key thing is to intercept all references to the field, either rvalue
or lvalue, to introduce an indirection.  On the concurrency branch, a
sample macro will look something like:

#define BUF_NAME(buf) *find_variable_location (&((buf)->name_))

find_variable_location looks to see if its argument has a
thread-local binding.  It may return its argument, a pointer to the
thread-local slot, or a pointer to the global slot, depending on what is
stored in the field.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]