|
From: | Paul Eggert |
Subject: | Re: Emacs rewrite in a maintainable language |
Date: | Mon, 12 Oct 2015 15:39:11 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 |
On 10/12/2015 08:17 AM, Oleh Krehel wrote:
Quoting the Emacs sources: # define MIN(a,b) ((a) < (b) ? (a) : (b)) #define streq(X, Y) (*(X) == *(Y) && strcmp ((X) + 1, (Y) + 1) == 0) #define SET_FLAG(F, FLAG) ((F) |= (FLAG)) #define HAS_FLAG(F, FLAG) (((F) & (FLAG)) != 0) #define xnew(n, Type) ((Type *) xmalloc ((n) * sizeof (Type))) #define xrnew(op, n, Type) ((op) = (Type *) xrealloc (op, (n) * sizeof (Type))) #define switch_line_buffers() (curndx = 1 - curndx) #define curlinepos (lbs[curndx].linepos) #define BVAR(buf, field) ((buf)->field ## _) Some of these can be replaced with plain type checked C++
Only BVAR belongs to the Emacs core. The other macros belong to auxiliary executables that presumably would be unaffected by any rewrite of the core. Anyway, for fun I just now replaced streq, SET_FLAG, and HAS_FLAG with functions, in the attached patch. More work needs to be done in this area but one step at a time....
0001-Unmacroize-ebrowse.c-and-etags.c-a-bit.patch
Description: Text Data
[Prev in Thread] | Current Thread | [Next in Thread] |