Denis Bueno wrote:
On 30 Aug 2005, at 16.51, Roy Smith wrote:
I'm working on a project which uses a LOCK/END_LOCK macro pair for
mutex locking in C++ source files. A typical section of code would
look like:
LOCK (myDataLock)
myData = foo;
END_LOCK
How can I convince the indenting engine to treat the LOCK and END_LOCK
lines as beginning and ending blocks?
If you wrote the macro in a certain way, you can use braces in your
source code (thus obviating your problem):
#define WITH_MUTEX_LOCK
(l) \
for (int WITH_MUTEX_LOCK_ret = (0 == pthread_mutex_lock
(l)); \
WITH_MUTEX_LOCK_ret; \
WITH_MUTEX_LOCK_ret = 0, (void) pthread_mutex_unlock
(l)) \
That's at least one solution (perhaps not the best). Then you would
write:
WITH_MUTEX_LOCK (myDataLock) {
myData = foo;
}
-Denis
Thanks, but unfortunately, the macro pre-dates me and isn't going to
change. I must live with what I've been given.
_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs