emacs-devel
[Top][All Lists]
Advanced

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

abstracting Lisp strings - macro name convention?


From: Ken Raeburn
Subject: abstracting Lisp strings - macro name convention?
Date: Sun, 30 Jun 2002 19:13:02 -0400

I'd like to give Lisp_String the same treatment I gave Lisp_Cons a
while back, hiding all the knowledge about the internal structure in
the lisp.h macros, except for the creation and GC code.  The goal, of
course, is to make the string implementation more easily replaceable,
either with Guile code or anything else someone comes up with to
improve string handling.

The string-related macros currently follow two different naming
conventions.  One set (STRING_BYTES, STRING_MULTIBYTE,
SET_STRING_BYTES) has been around a long time, but doesn't cover all
the functionality I need; most code still uses XSTRING()->data to get
at the contents.  And there are some "convenience macros", some of
which are already closer to what I need:

    /* Convenience macros for dealing with Lisp strings.  */

    #define SREF(string, index)     XSTRING (string)->data[index]
    #define SDATA(string)           XSTRING (string)->data
    #define SCHARS(string)          XSTRING (string)->size
    #define SBYTES(string)          STRING_BYTES (XSTRING (string))
    #define SMBP(string)            STRING_MULTIBYTE (string)

But these short names don't follow the naming convention used for
other string macros, usually STRING_FOO or SET_STRING_FOO.  And
outside of xdisp.c, they're not used much.  However, they are in line
with the names for macros for accessing Lisp arrays.

If there are no objections to these names, I'll go ahead and start
working on the changes, adding similar names for assignment operations
and whatever else is needed; if the longer STRING_ names are
preferred, I'll work up some new names in that style to use.

Ken



reply via email to

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