comparison man/internals/internals.texi @ 4984:f23cd0184dcf

xlike, doc changes -------------------- ChangeLog entries follow: -------------------- man/ChangeLog addition: 2010-02-05 Ben Wing <ben@xemacs.org> * internals/internals.texi (A Summary of the Various XEmacs Modules): * internals/internals.texi (Conversion to and from External Data): * internals/internals.texi (General Guidelines for Writing Mule-Aware Code): Correct names of files renamed common -> xlike. Fix up outdated explanation of old-style DFC conversion macros. Add a section on the different types of character and their uses, taken from a long comment in lisp.h. src/ChangeLog addition: 2010-02-05 Ben Wing <ben@xemacs.org> * depend: Regenerate. * make-src-depend (PrintPatternDeps): Remove refs to xgccache, no longer existent. * select-gtk.c (THIS_IS_GTK): * select-gtk.c (gtk_decline_selection_request): * select-x.c (THIS_IS_X): * select-xlike-inc.c: * select-xlike-inc.c (selection_data_to_lisp_data): Rename PROCESSING_X_CODE to THIS_IS_X and PROCESSING_GTK_CODE to THIS_SI_GTK for consistency with other xlike code. Rename select-xlike-inc.c from select-common.h, in keeping with xlike terminology.
author Ben Wing <ben@xemacs.org>
date Fri, 05 Feb 2010 12:11:12 -0600
parents cbe181529c34
children 865c9a95f21c
comparison
equal deleted inserted replaced
4979:4234fd5a7b17 4984:f23cd0184dcf
3181 @item @file{scrollbar-x.c} @tab @ref{Modules for other Display-Related Lisp Objects}. 3181 @item @file{scrollbar-x.c} @tab @ref{Modules for other Display-Related Lisp Objects}.
3182 @item @file{scrollbar-x.h} @tab @ref{Modules for other Display-Related Lisp Objects}. 3182 @item @file{scrollbar-x.h} @tab @ref{Modules for other Display-Related Lisp Objects}.
3183 @item @file{scrollbar.c} @tab @ref{Modules for other Display-Related Lisp Objects}. 3183 @item @file{scrollbar.c} @tab @ref{Modules for other Display-Related Lisp Objects}.
3184 @item @file{scrollbar.h} @tab @ref{Modules for other Display-Related Lisp Objects}. 3184 @item @file{scrollbar.h} @tab @ref{Modules for other Display-Related Lisp Objects}.
3185 @item @file{search.c} @tab @ref{Modules for Standard Editing Operations}. 3185 @item @file{search.c} @tab @ref{Modules for Standard Editing Operations}.
3186 @item @file{select-common.h} @tab 3186 @item @file{select-xlike-inc.c} @tab
3187 @item @file{select-gtk.c} @tab 3187 @item @file{select-gtk.c} @tab
3188 @item @file{select-msw.c} @tab @ref{Modules for Interfacing with X Windows}. 3188 @item @file{select-msw.c} @tab @ref{Modules for Interfacing with X Windows}.
3189 @item @file{select-x.c} @tab @ref{Modules for Interfacing with X Windows}. 3189 @item @file{select-x.c} @tab @ref{Modules for Interfacing with X Windows}.
3190 @item @file{select.c} @tab @ref{Modules for Interfacing with X Windows}. 3190 @item @file{select.c} @tab @ref{Modules for Interfacing with X Windows}.
3191 @item @file{select.h} @tab @ref{Modules for Interfacing with X Windows}. 3191 @item @file{select.h} @tab @ref{Modules for Interfacing with X Windows}.
3227 @item @file{terminfo.c} @tab @ref{Modules for the Redisplay Mechanism}. 3227 @item @file{terminfo.c} @tab @ref{Modules for the Redisplay Mechanism}.
3228 @item @file{test-harness.el} @tab @ref{Modules for Regression Testing}. 3228 @item @file{test-harness.el} @tab @ref{Modules for Regression Testing}.
3229 @item @file{tests.c} @tab 3229 @item @file{tests.c} @tab
3230 @item @file{text.c} @tab 3230 @item @file{text.c} @tab
3231 @item @file{text.h} @tab 3231 @item @file{text.h} @tab
3232 @item @file{toolbar-common.c} @tab 3232 @item @file{toolbar-xlike.c} @tab
3233 @item @file{toolbar-common.h} @tab 3233 @item @file{toolbar-xlike.h} @tab
3234 @item @file{toolbar-gtk.c} @tab 3234 @item @file{toolbar-gtk.c} @tab
3235 @item @file{toolbar-msw.c} @tab @ref{Modules for other Display-Related Lisp Objects}. 3235 @item @file{toolbar-msw.c} @tab @ref{Modules for other Display-Related Lisp Objects}.
3236 @item @file{toolbar-x.c} @tab @ref{Modules for other Display-Related Lisp Objects}. 3236 @item @file{toolbar-x.c} @tab @ref{Modules for other Display-Related Lisp Objects}.
3237 @item @file{toolbar.c} @tab @ref{Modules for other Display-Related Lisp Objects}. 3237 @item @file{toolbar.c} @tab @ref{Modules for other Display-Related Lisp Objects}.
3238 @item @file{toolbar.h} @tab @ref{Modules for other Display-Related Lisp Objects}. 3238 @item @file{toolbar.h} @tab @ref{Modules for other Display-Related Lisp Objects}.
12899 @code{xmalloc()}. For this reason, convenience macros are defined for 12899 @code{xmalloc()}. For this reason, convenience macros are defined for
12900 many types of conversions involving raw data and/or Lisp strings, 12900 many types of conversions involving raw data and/or Lisp strings,
12901 especially when the output is an @code{alloca()}ed string. (When the 12901 especially when the output is an @code{alloca()}ed string. (When the
12902 destination is a Lisp string, there are other functions that should be 12902 destination is a Lisp string, there are other functions that should be
12903 used instead -- @code{build_extstring()} and @code{make_extstring()}, 12903 used instead -- @code{build_extstring()} and @code{make_extstring()},
12904 for example.) The convenience macros are of two types -- the older kind 12904 for example.) Most convenience macros return the result as the return
12905 that store the result into a specified variable, and the newer kind that 12905 value. However, when two values need to be returned (that is, the
12906 return the result. The newer kind of macros don't exist when the output 12906 output is sized data), both values are stored into variables that are
12907 is sized data, because that would have two return values. NOTE: All 12907 passed into the macros as parameters. NOTE: All convenience macros
12908 convenience macros are ultimately defined in terms of 12908 are ultimately defined in terms of @code{TO_EXTERNAL_FORMAT} and
12909 @code{TO_EXTERNAL_FORMAT} and @code{TO_INTERNAL_FORMAT}. Thus, any 12909 @code{TO_INTERNAL_FORMAT}. Thus, any comments above about the
12910 comments above about the workings of these macros also apply to all 12910 workings of these macros also apply to all convenience macros.
12911 convenience macros. 12911
12912 12912 A typical convenience macro is
12913 A typical old-style convenience macro is
12914 12913
12915 @example 12914 @example
12916 C_STRING_TO_EXTERNAL (in, out, codesys); 12915 out = ITEXT_TO_EXTERNAL (in, codesys);
12917 @end example 12916 @end example
12918 12917
12919 This is equivalent to 12918 This is equivalent to
12920 12919
12921 @example 12920 @example
12922 TO_EXTERNAL_FORMAT (C_STRING, in, C_STRING_ALLOCA, out, codesys); 12921 TO_EXTERNAL_FORMAT (C_STRING, in, C_STRING_ALLOCA, out, codesys);
12923 @end example 12922 @end example
12924 12923
12925 but is easier to write and somewhat clearer, since it clearly identifies 12924 but is easier to write and somewhat clearer, since it clearly
12926 the arguments without the clutter of having the preprocessor types mixed 12925 identifies the arguments without the clutter of having the
12927 in. 12926 preprocessor types mixed in. Furthermore, it @emph{returns} the
12928 12927 converted data (still in @code{alloca()} space) rather than
12929 The new-style equivalent is @code{NEW_C_STRING_TO_EXTERNAL (src, 12928 @emph{storing} it, which is far more convenient for most operations
12930 codesys)}, which @emph{returns} the converted data (still in 12929 as there is no need to declare an extra temporary variable to hold
12931 @code{alloca()} space). This is far more convenient for most 12930 the return value.
12932 operations.
12933 12931
12934 @node General Guidelines for Writing Mule-Aware Code, An Example of Mule-Aware Code, Conversion to and from External Data, Coding for Mule 12932 @node General Guidelines for Writing Mule-Aware Code, An Example of Mule-Aware Code, Conversion to and from External Data, Coding for Mule
12935 @subsection General Guidelines for Writing Mule-Aware Code 12933 @subsection General Guidelines for Writing Mule-Aware Code
12936 @cindex writing Mule-aware code, general guidelines for 12934 @cindex writing Mule-aware code, general guidelines for
12937 @cindex Mule-aware code, general guidelines for writing 12935 @cindex Mule-aware code, general guidelines for writing
12946 mistake. If you want to manipulate an Emacs character from ``C'', use 12944 mistake. If you want to manipulate an Emacs character from ``C'', use
12947 @code{Ichar}. If you want to examine a specific octet in the internal 12945 @code{Ichar}. If you want to examine a specific octet in the internal
12948 format, use @code{Ibyte}. If you want a Lisp-visible character, use a 12946 format, use @code{Ibyte}. If you want a Lisp-visible character, use a
12949 @code{Lisp_Object} and @code{make_char}. If you want a pointer to move 12947 @code{Lisp_Object} and @code{make_char}. If you want a pointer to move
12950 through the internal text, use @code{Ibyte *}. Also note that you 12948 through the internal text, use @code{Ibyte *}. Also note that you
12951 almost certainly do not need @code{Ichar *}. Other typedefs to clarify 12949 almost certainly do not need @code{Ichar *}.
12952 the use of @code{char} are @code{Char_ASCII}, @code{Char_Binary}, 12950
12953 @code{UChar_Binary}, and @code{CIbyte}. 12951 All uses of @code{char} should be replaced with one of the following:
12952
12953 @table @code
12954 @item Ibyte
12955 Pointer to internally-formatted text. The data representing the text
12956 in a buffer is logically a set of Ibytes.
12957 @item CIbyte
12958 Used when you are working with internal data but for whatever reason
12959 need to have it declared a @code{char *}. Examples are function arguments
12960 whose values are most commonly literal strings, or where you have to
12961 apply a stdlib string function to internal data.
12962
12963 In general, you should avoid this where possible and use Ascbyte if the
12964 text is just ASCII (e.g. string literals) or otherwise Ibyte, for
12965 consistency. For example, the new Mule workspace contains Ibyte
12966 versions of the stdlib string functions.
12967 @item Extbyte, UExtbyte
12968 Pointer to text in some external format, which can be defined as all
12969 formats other than the internal one. The data representing a string
12970 in "external" format (binary or any external encoding) is logically a
12971 set of Extbytes. Extbyte is guaranteed to be just a char, so for
12972 example strlen (Extbyte *) is OK. Extbyte is only a documentation
12973 device for referring to external text.
12974 @item Ascbyte, UAscbyte
12975 pure ASCII text, consisting of bytesf in a string in entirely US-ASCII
12976 format: (Nothing outside the range 00 - 7F).
12977 @item Binbyte, CBinbyte, SBinbyte
12978 Binary data that is not meant to be interpreted as text.
12979 @item Rawbyte, CRawbyte
12980 General data in memory, where we don't care about whether it's text or
12981 binary; often used when computing memory-based/byte-based offsets of
12982 pointers. In general, there should be no manipulation of the memory
12983 pointed to by these pointers other than just copying it around.
12984 @item Boolbyte
12985 A byte used to represent a boolean value: 0 or 1.
12986 Normally use plain Boolint, and only use Boolbyte to save space.
12987 @item Bitbyte
12988 A byte composed of bitfields. Hardly ever used.
12989 @item Chbyte, UChbyte, SChbyte
12990 A no-semantics @code{char}. Used (pretty-much) ONLY for casting
12991 arguments to functions accepting a @code{char *}, @code{unsigned char
12992 *}, etc. where the other types don't exactly apply and what you are
12993 logically concerned with is the type of the function's argument and
12994 not its semantics.
12995
12996 DO NOT DO NOT DO NOT DO NOT use this as a sloppy replacement for one of
12997 the other types. If you're not using this as part of casting an
12998 argument to a function call, and you're not Ben Wing, you're using it
12999 wrong. Go find another one of the types.
13000 @end table
13001
13002 Note the significance of the prefixed versions of the above types:
13003
13004 @table @code
13005 @item U
13006 @code{unsigned char}
13007 @item S
13008 @code{signed char}
13009 @item C
13010 plain @code{char}
13011 @end table
12954 13012
12955 @item Be careful not to confuse @code{Charcount}, @code{Bytecount}, @code{Charbpos} and @code{Bytebpos}. 13013 @item Be careful not to confuse @code{Charcount}, @code{Bytecount}, @code{Charbpos} and @code{Bytebpos}.
12956 The whole point of using different types is to avoid confusion about the 13014 The whole point of using different types is to avoid confusion about the
12957 use of certain variables. Lest this effect be nullified, you need to be 13015 use of certain variables. Lest this effect be nullified, you need to be
12958 careful about using the right types. 13016 careful about using the right types.