comparison man/internals/internals.texi @ 2597:d6a2e12b8411

[xemacs-hg @ 2005-02-19 16:18:52 by stephent] autoconf and Xft docs <874qg8msql.fsf@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Sat, 19 Feb 2005 16:18:56 +0000
parents e27943beb30f
children a4040d921acc
comparison
equal deleted inserted replaced
2596:ad434b45ea15 2597:d6a2e12b8411
309 * XEmacs from the Outside:: A broad conceptual overview. 309 * XEmacs from the Outside:: A broad conceptual overview.
310 * The Lisp Language:: An overview. 310 * The Lisp Language:: An overview.
311 * XEmacs from the Perspective of Building:: 311 * XEmacs from the Perspective of Building::
312 * Build-Time Dependencies:: 312 * Build-Time Dependencies::
313 * The Modules of XEmacs:: 313 * The Modules of XEmacs::
314 * The Build Configuration System::
314 * Rules When Writing New C Code:: 315 * Rules When Writing New C Code::
315 * Regression Testing XEmacs:: 316 * Regression Testing XEmacs::
316 * CVS Techniques:: 317 * CVS Techniques::
317 * XEmacs from the Inside:: 318 * XEmacs from the Inside::
318 * Basic Types:: 319 * Basic Types::
2407 that is not normally used or needed. 2408 that is not normally used or needed.
2408 2409
2409 The first step of building involves running the @file{configure} program 2410 The first step of building involves running the @file{configure} program
2410 and passing it various parameters to specify any optional features you 2411 and passing it various parameters to specify any optional features you
2411 want and compiler arguments and such, as described in the @file{INSTALL} 2412 want and compiler arguments and such, as described in the @file{INSTALL}
2412 file. This determines what the build environment is, chooses the 2413 file. (You may optionally run @file{autoconf} first to update the
2414 @file{configure} script. @xref{Modules for Build Configuration}.)
2415 This determines what the build environment is, chooses the
2413 appropriate @file{s/} and @file{m/} file, and runs a series of tests to 2416 appropriate @file{s/} and @file{m/} file, and runs a series of tests to
2414 determine many details about your environment, such as which library 2417 determine many details about your environment, such as which library
2415 functions are available and exactly how they work. The reason for 2418 functions are available and exactly how they work. The reason for
2416 running these tests is that it allows XEmacs to be compiled on a much 2419 running these tests is that it allows XEmacs to be compiled on a much
2417 wider variety of platforms than those that the XEmacs developers happen 2420 wider variety of platforms than those that the XEmacs developers happen
2518 use any higher-level functionality that might load @file{custom.el}, but 2521 use any higher-level functionality that might load @file{custom.el}, but
2519 you do not need @file{subr.el}, you should @samp{defvar} 2522 you do not need @file{subr.el}, you should @samp{defvar}
2520 @code{custom-declare-variable-list} to prevent the @samp{void-variable} 2523 @code{custom-declare-variable-list} to prevent the @samp{void-variable}
2521 error. (Currently this is only needed for @file{make-docfile.el}.) 2524 error. (Currently this is only needed for @file{make-docfile.el}.)
2522 2525
2523 @node The Modules of XEmacs, Rules When Writing New C Code, Build-Time Dependencies, Top 2526 @node The Modules of XEmacs, The Build Configuration System, Build-Time Dependencies, Top
2524 @chapter The Modules of XEmacs 2527 @chapter The Modules of XEmacs
2525 @cindex modules of XEmacs 2528 @cindex modules of XEmacs
2526 2529
2527 @menu 2530 @menu
2528 * A Summary of the Various XEmacs Modules:: 2531 * A Summary of the Various XEmacs Modules::
2532 * Modules for Building XEmacs::
2529 * Low-Level Modules:: 2533 * Low-Level Modules::
2530 * Basic Lisp Modules:: 2534 * Basic Lisp Modules::
2531 * Modules for Standard Editing Operations:: 2535 * Modules for Standard Editing Operations::
2532 * Modules for Interfacing with the File System:: 2536 * Modules for Interfacing with the File System::
2533 * Modules for Other Aspects of the Lisp Interpreter and Object System:: 2537 * Modules for Other Aspects of the Lisp Interpreter and Object System::
2534 * Modules for Interfacing with the Operating System:: 2538 * Modules for Interfacing with the Operating System::
2535 @end menu 2539 @end menu
2536 2540
2537 @node A Summary of the Various XEmacs Modules, Low-Level Modules, The Modules of XEmacs, The Modules of XEmacs 2541 @node A Summary of the Various XEmacs Modules, Modules for Building XEmacs, The Modules of XEmacs, The Modules of XEmacs
2538 @section A Summary of the Various XEmacs Modules 2542 @section A Summary of the Various XEmacs Modules
2539 @cindex summary of the various XEmacs modules 2543 @cindex summary of the various XEmacs modules
2540 @cindex modules, summary of the various XEmacs 2544 @cindex modules, summary of the various XEmacs
2541 2545
2542 The following is a list of the sections describing the various modules 2546 The following is a list of the sections describing the various modules
2543 (i.e. files) that implement XEmacs. Some of them are in this chapter; 2547 (i.e. files) that implement XEmacs. Some of them are in this chapter;
2544 some of them are attached to the chapters describing the modules in 2548 some of them are attached to the chapters describing the modules in
2545 question. 2549 question.
2546 2550
2547 @itemize @bullet 2551 @itemize @bullet
2552 @item
2553 @ref{Modules for Build Configuration}.
2554 @item
2555 @ref{Modules for Compiling XEmacs}.
2556 @item
2557 @ref{Modules for Preloading Lisp}.
2548 @item 2558 @item
2549 @ref{Low-Level Modules}. 2559 @ref{Low-Level Modules}.
2550 @item 2560 @item
2551 @ref{Basic Lisp Modules}. 2561 @ref{Basic Lisp Modules}.
2552 @item 2562 @item
3020 @item @file{xmu.h} @tab @ref{Modules for Interfacing with X Windows}. 3030 @item @file{xmu.h} @tab @ref{Modules for Interfacing with X Windows}.
3021 @end multitable 3031 @end multitable
3022 3032
3023 3033
3024 3034
3025 @node Low-Level Modules, Basic Lisp Modules, A Summary of the Various XEmacs Modules, The Modules of XEmacs 3035 @node Modules for Building XEmacs, Low-Level Modules, A Summary of the Various XEmacs Modules, The Modules of XEmacs
3036 @section Modules for Building XEmacs
3037 @cindex modules for building XEmacs
3038 @cindex building XEmacs, modules for
3039
3040 @menu
3041 * Modules for Build Configuration::
3042 * Modules for Compiling XEmacs::
3043 * Modules for Preloading Lisp::
3044 @end menu
3045
3046
3047
3048 @node Modules for Build Configuration, Modules for Compiling XEmacs, Modules for Building XEmacs, Modules for Building XEmacs
3049 @subsection Modules for Build Configuration
3050 @cindex modules for build configuration
3051 @cindex build configuration, modules for
3052
3053 @example
3054 @file{configure}
3055 @file{config.h.in}
3056 @file{Makefile.in.in}
3057 @end example
3058
3059 @example
3060 @file{configure.ac}
3061 @file{configure.in}
3062 @end example
3063
3064 @xref{The configure Script}.
3065
3066
3067
3068 @node Modules for Compiling XEmacs, Modules for Preloading Lisp, Modules for Build Configuration, Modules for Building XEmacs
3069 @subsection Modules for Compiling XEmacs
3070 @cindex modules for compiling xemacs
3071 @cindex compiling xemacs, modules for
3072
3073 @strong{Please write this node!} @c ####
3074
3075 This node should contain descriptions of files like the various
3076 Makefiles, and I guess cross-references to ellcc etc.
3077
3078
3079
3080 @node Modules for Preloading Lisp, , Modules for Compiling XEmacs, Modules for Building XEmacs
3081 @subsection Modules for Preloading Lisp
3082 @cindex modules for preloading lisp
3083 @cindex preloading lisp, modules for
3084
3085 @strong{Please write this node!} @c ####
3086
3087 This node should contain descriptions of files like dumped-lisp.el
3088 (maybe that goes in Modules for Build Configuration supra?),
3089 update-elcs.el, and so on.
3090
3091
3092
3093 @node Low-Level Modules, Basic Lisp Modules, Modules for Building XEmacs, The Modules of XEmacs
3026 @section Low-Level Modules 3094 @section Low-Level Modules
3027 @cindex low-level modules 3095 @cindex low-level modules
3028 @cindex modules, low-level 3096 @cindex modules, low-level
3029 3097
3030 @example 3098 @example
4054 @end example 4122 @end example
4055 4123
4056 This module provides some terminal-control code necessary on versions of 4124 This module provides some terminal-control code necessary on versions of
4057 AIX prior to 4.1. 4125 AIX prior to 4.1.
4058 4126
4059 @node Rules When Writing New C Code, Regression Testing XEmacs, The Modules of XEmacs, Top 4127
4128
4129 @node The Build Configuration System, Rules When Writing New C Code, The Modules of XEmacs, Top
4130 @chapter The Build Configuration System
4131 @cindex build configuration
4132 @cindex configuration, build
4133
4134 @strong{Please write this node!} @c ####
4135
4136 This node should describe XEmacs-specific techniques and idioms in the
4137 configuration system. A particular example is the set of @samp{XE_}
4138 macros in @file{configure.in} and @file{configure.ac}.
4139
4140 @menu
4141 * Adding Configurable Features::
4142 * The configure Script::
4143 * The Makefile Precursors::
4144 @end menu
4145
4146
4147
4148 @node Adding Configurable Features, The configure Script, The Build Configuration System, The Build Configuration System
4149 @section Adding Configurable Features
4150 @cindex adding configurable features
4151 @cindex configurable features, adding
4152 @cindex features, adding configurable
4153
4154 Adding a configurable feature requires at least adding an option to the
4155 @file{configure} script and a macro definition to @file{src/config.h.in}
4156 (@pxref{The configure Script}), and often changes to Makefile precursors
4157 (@pxref{The Makefile Precursors}).
4158
4159
4160
4161 @node The configure Script, The Makefile Precursors, Adding Configurable Features, The Build Configuration System
4162 @section The configure Script
4163 @cindex configure script
4164 @cindex script, configure
4165
4166 At the heart of the XEmacs build configuration system is the
4167 @file{configure} script. This beast is maintained using the Autoconf
4168 system, which is a truly terrifying monstrosity based on a fundamentally
4169 flawed programming model (extensive use of macros), with an
4170 implementation about which I've never heard a nice word (GNU @file{m4}),
4171 used to string together a large set of @emph{ad hoc} tests, to implement
4172 a configuration language with conventions that are unimportant in simple
4173 cases and counterintuitive when things get complicated. If that doesn't
4174 scare you off, Welcome! I think you're ready to become a configure
4175 hacker! (But be prepared for things to go downhill from here.)
4176
4177 @file{configure} is, of course, is written in POSIX shell language, and
4178 autogenerated from a precursor (see? the first step was a doozy!)
4179 Currently that precursor is called @file{configure.ac}, but in the
4180 previous generation it was called @file{configure.in}. As of February
4181 2005, @file{configure.ac} is used in the development mainline, but
4182 because the semantics of many predefined macros changed drastically
4183 between @file{autoconf} 2.13 and @file{autoconf} 2.50 (why not ``3.0''?
4184 you got me), the XEmacs Project chose to stick with the devil it knew
4185 for the stable line of XEmacs 21.4 releases.
4186
4187 One reason for worrying about the semantic changes is the fact that
4188 XEmacs uses a lot of homebrew code, including @file{m4} macros, to
4189 implement special features in its @file{configure} script. Here are
4190 some of the important features:
4191
4192 @itemize
4193 @item
4194 Selectively enabling debugging, error checking, and tracing.
4195 @item
4196 Complex options, which are set-valued (@i{i.e.}, unordered; ordered
4197 lists of options, for example ``take the first available from the
4198 list,'' are neither used currently nor given special support).
4199 @end itemize
4200
4201 Where these are implemented as @file{m4} macros, the prefix @samp{XE_}
4202 is used to identify them as XEmacs features in the @file{configure}
4203 precursor code. Here is a list of prototypes of the convenience macros
4204 provided for performing common operations:
4205
4206 @c #### @var{}-ize the formal parameters of these functions?
4207 @table @code
4208 @item USAGE_ERROR(string)
4209 prints a usage error and dies
4210
4211 @item PRINT_VAR(var var ...)
4212 prints values of shell variables
4213
4214 @item XE_ADD_OBJS(foo.o ...)
4215 @strong{#### Please document me!}
4216
4217 @item XE_APPEND(value, varname)
4218 @strong{#### Please document me!}
4219
4220 @item XE_PREPEND(value, varname)
4221 @strong{#### Please document me!}
4222
4223 @item XE_DIE(message)
4224 used for situations that can't lead to a successful build, such as
4225 missing include files or conflicts between requested features.
4226
4227 @item XE_CHECK_FEATURE_DEPENDENCY(feature1, feature2)
4228 @strong{#### Please document me!}
4229
4230 @item XE_STRIP_4TH_COMPONENT(var)
4231 @strong{#### Please document me!}
4232
4233 @item CANONICALIZE_PATH(varname)
4234 @strong{#### Please document me!}
4235
4236 @item XE_PROTECT_LINKER_FLAGS(shell_var)
4237 @strong{#### Please document me!}
4238
4239 @item COLON_TO_SPACE(path)
4240 Allow use of either @samp{:} or spaces for lists of directories.
4241
4242 @item XE_ADD_RUNPATH_DIR(directory)
4243 @strong{#### Please document me!}
4244
4245 @item XE_COMPUTE_RUNPATH()
4246 @strong{#### Please document me!}
4247
4248 @item XE_SPACE(var, words)
4249 @strong{#### Please document me!}
4250
4251 @item XE_SHLIB_STUFF
4252 See @file{aclocal.m4}.
4253 @end table
4254
4255 @heading XEmacs keyword option support
4256
4257 A @dfn{keyword} option is one that accepts one of a number of
4258 pre-defined values (if support for sets of values is needed, see
4259 ``complex options'' below). For example,
4260 @samp{--with-mail-locking=flock}.
4261
4262 Keyword options use expanded forms of @samp{AC_ARG_[WITH|ENABLE]} called
4263 @samp{XE_KEYWORD_ARG_[WITH|ENABLE]}, both taking 5 parameters. The
4264 first 4 parameters of these macros are the same as original macros with
4265 the exception that all four parameters are @strong{required}. The
4266 @var{action-if-true} code is run after the argument list has been
4267 parsed.
4268
4269 The 5th parameter is a list of supported keywords. The whole list must
4270 be quoted but the individual keywords should not.
4271
4272 If the option value is a not a valid keyword then an error message is
4273 generated, otherwise the value is left untouched.
4274
4275 This support is implemented via the following @file{GNU m4} macros.
4276 Macros labelled @dfn{internal} are not expected to be used by
4277 @file{configure.ac} programmers; they are part of the implementation of
4278 higher-level features.
4279
4280 @table @code
4281 @item XE_KEYWORD_ARG_WITH(package, help-string, action-if-true, action-if-false, [keyword1, keyword2, ....])
4282 Expanded version of @samp{AC_ARG_WITH} for keyword options. All the
4283 parameters are required. The last argument is a comma-separated list of
4284 supported keywords, @file{m4}-quoted with @samp{[]}.
4285
4286 @item XE_KEYWORD_ARG_ENABLE(feature, help-string, action-if-true, action-if-false, [keyword1, keyword2, ....])
4287 Expanded version of @samp{AC_ARG_ENABLE} for keyword options. All the
4288 parameters are required. The last argument is a comma-separated list of
4289 supported keywords, @file{m4}-quoted with @samp{[]}.
4290
4291 @item XE_PARSE_KEYWORD_OPTION(prefix, cmdline-flag)
4292 Internal macro to parse the option values. If an undeclared option is
4293 found then an error is generated.
4294
4295 @item XE_KEYWORD(keyword)
4296 Internal macro to declare an option value.
4297
4298 @end table
4299
4300 @heading XEmacs complex option support
4301
4302 A @dfn{complex option} is one that takes a number of related values, as
4303 a set. For example, we might use "--with-xft=all,nomenubars" for
4304 compatibility with XFontSet i18n of menubars. (The example is
4305 contrived, Xft looks much better than XFS.) Processing such an option
4306 requires a number of auxiliary variables.
4307
4308 Complex options use expanded forms of @samp{AC_ARG_[WITH|ENABLE]} called
4309 @samp{XE_COMPLEX_ARG_[WITH|ENABLE]}, both taking 5 parameters. The
4310 first 4 parameters of these macros are the same as original macros with
4311 the exception that all four parameters are @strong{required}. The
4312 @var{action-if-true} code is run after the argument list has been
4313 parsed.
4314
4315 The 5th parameter is a list of @samp{XE_COMPLEX_OPTION} macro calls that
4316 define the valid components and their default values. The list must be
4317 quoted but the individual macro calls should not. Here is how the
4318 @samp{sound} flag is defined:
4319
4320 @example
4321 XE_COMPLEX_ARG_ENABLE([sound],
4322 AC_HELP_STRING([--enable-sound],[Compile with sound support.
4323 Valid types are `native', `nas' and `esd'.
4324 Prefix a type with 'no' to disable.
4325 The first type can be `none' or `all'. `none' means
4326 `nonative,nonas,noesd'. `all' means `native,nas,esd'.
4327 Later options override earlier ones for the same TYPE.
4328 The default is to autodetect all sound support except
4329 for ESD which defaults to off.]),
4330 [],
4331 [enable_sound_nas=""],
4332 [XE_COMPLEX_OPTION([native],[""]),
4333 XE_COMPLEX_OPTION([nas],[""]),
4334 XE_COMPLEX_OPTION([esd],[no])])
4335 @end example
4336
4337 (Note that the help string will be reformatted by @file{autoconf} so
4338 that all whitespace is first compressed to a single space, then folded
4339 to appear in the right-hand column as above. Thus the help string may
4340 appear differently when @code{./configure --help} is invoked.)
4341
4342 @c #### verify for INSTALL and xemacs Texinfo.
4343 Each component is interpreted as a separate feature to be enabled or
4344 disabled. As usual, the distinction between ``with'' and ``enable'' is
4345 that ``with'' features require specific support from the system, usually
4346 one or more optional libraries, and ``enable'' features are supported
4347 entirely by code in XEmacs, but the user might want to switch it off for
4348 some reason. Option values are stored in the variables
4349 @samp{with_@var{package}_@var{component}} or
4350 @samp{enable_@var{feature}_@var{component}} (@i{e.g.}
4351 @samp{with_xft_menubars}).
4352
4353 The user of @file{configure} specifies the configuration by providing a
4354 list of components. The special components @samp{all} and @samp{none}
4355 may occur first in the list, setting the defaults for all components to
4356 @samp{yes} or @samp{no} respectively.
4357
4358 In @file{configure.ac}, default values of option values may be
4359 @samp{yes} which means that the option must be used and an error must
4360 occur if there is a configuration problems (such as a missing library)
4361 or @samp{no} which means that the option must not be used. The default
4362 value can also be the null string @samp{""}, usually meaning that
4363 @file{configure} will attempt to find support for the feature on the
4364 system, and will enable the configuration if it is available. Sometimes
4365 the null string means that @file{configure}'s default is
4366 system-dependent. (This usage is not consistent, and depends on the
4367 implementation of the feature detector rather than the argument parser.)
4368 Users cannot specify the null string for an individual component from
4369 the command line.
4370
4371 There are two possible uses in XEmacs for this kind of facility. One is
4372 exemplified by sound: there are alternative protocols (native, ESD, NAS)
4373 and each is supported by a corresponding library. The other is a single
4374 library which may or may not be supported by multiple components of
4375 XEmacs, as exemplified by Xft. This latter usage may be more common
4376 during development of a feature. Perhaps specialized APIs should be
4377 provided, see comment on @samp{XE_COMPLEX_OPTION_HELP_STRING} below.
4378
4379 @table @code
4380 @item XE_COMPLEX_OPTION(option, yesno)
4381 Declare a complex option and its default value. The value @strong{must}
4382 be either @samp{yes} or @samp{no} or the null string @samp{""}. The
4383 null string means ``maybe'', whose semantics are determined by the
4384 implementation of the option, not by the parser. Typical semantics are
4385 ``use the library if found in the usual places'' or ``default is
4386 platform-dependent''.
4387
4388 @item XE_COMPLEX_OPTION_HELP_STRING(flag, long, short, components, libraries)
4389 Format a boilerplate help string for complex options.
4390
4391 This was originally written for the Xft option, and doesn't read so well
4392 for options based on alternative libraries like sound. Hackers beware:
4393 the API may be enhanced to deal with this in the future.
4394
4395 @item XE_COMPLEX_ARG_WITH(PACKAGE, HELP-STRING, ACTION-IF-TRUE, ACTION-IF-FALSE, [XE_COMPLEX_OPTION(a,yes), ....])
4396 Extended version of @samp{AC_ARG_WITH} for complex options. All the
4397 parameters are required.
4398
4399 @item XE_COMPLEX_ARG_ENABLE(FEATURE, HELP-STRING, ACTION-IF-TRUE, ACTION-IF-FALSE, [XE_COMPLEX_OPTION(a,yes), ....])
4400 Expanded version of @samp{AC_ARG_ENABLE} for complex options. All the
4401 parameters are required.
4402
4403 @item XE_EXPAND_COMPLEX_OPTION(prefix, component, yesno)
4404 Internal macro create the option's shell variable containing the default
4405 value and to note the values in an option list.
4406
4407 @item XE_EXPAND_COMPLEX_OPTIONS(prefix, option_list)
4408 Internal macro which recursively expands an option list.
4409
4410 @item XE_INIT_COMPLEX_OPTION(prefix, option_list)
4411 Internal macro to initialise the complex option shell variables.
4412
4413 Variables of the form @samp{@var{prefix}_@var{option}} contain the
4414 default value for that option. @samp{@var{prefix}_types} contains a
4415 space-separated list of all the options and @samp{@var{prefix}_default}
4416 contains a comma-separated list of all the default values.
4417
4418 @item XE_PARSE_COMPLEX_OPTION(prefix, cmdline-flag)
4419 Internal macro to parse the option values. If an undeclared option is
4420 found then an error is generated.
4421
4422 @end table
4423
4424
4425
4426 @node The Makefile Precursors, , The configure Script, The Build Configuration System
4427 @section The Makefile Precursors
4428 @cindex Makefile precursors
4429 @cindex precursors, Makefile
4430
4431 @strong{Please write this node!} @c ####
4432
4433 As in other programs using a @file{configure} program, XEmacs's
4434 Makefiles are not written, they are generated. The @file{configure}
4435 program uses Makefile precursors, or templates, to generate the actual
4436 Makefiles. In fact, it is a multistage process. The developer changes
4437 the file @file{Makefile.in.in}, then @file{configure} first generates an
4438 intermediate file @file{Makefile.in}, and finally produces a portable
4439 Makefile called @file{Makefile}, and a Makefile optimized for @file{GNU
4440 make} called @file{GNUmakefile}.
4441
4442 This node describes XEmacs-specific techniques and idioms used in the
4443 @file{Makefile.in.in} files.
4444
4445
4446
4447 @node Rules When Writing New C Code, Regression Testing XEmacs, The Build Configuration System, Top
4060 @chapter Rules When Writing New C Code 4448 @chapter Rules When Writing New C Code
4061 @cindex writing new C code, rules when 4449 @cindex writing new C code, rules when
4062 @cindex C code, rules when writing new 4450 @cindex C code, rules when writing new
4063 @cindex code, rules when writing new C 4451 @cindex code, rules when writing new C
4064 4452
4088 @section Introduction to Writing C Code 4476 @section Introduction to Writing C Code
4089 @cindex introduction to writing c code 4477 @cindex introduction to writing c code
4090 @cindex coding conventions 4478 @cindex coding conventions
4091 4479
4092 The C code is actually written in a dialect of C called @dfn{Clean C}, 4480 The C code is actually written in a dialect of C called @dfn{Clean C},
4093 meaning that it can be compiled, mostly warning-free, with either a C 4481 meaning that it can be compiled, warning-free, with either a C or C++
4094 or C++ compiler. Coding in Clean C has several advantages over plain 4482 compiler. Coding in Clean C has several advantages over plain
4095 C. C++ compilers are more nit-picking, and a number of coding errors 4483 C. C++ compilers are more nit-picking, and a number of coding errors
4096 have been found by compiling with C++. The ability to use both C and 4484 have been found by compiling with C++. The ability to use both C and
4097 C++ tools means that a greater variety of development tools are 4485 C++ tools means that a greater variety of development tools are
4098 available to the developer. In addition, the ability to overload 4486 available to the developer. In addition, the ability to overload
4099 operators in C++ means it is possible, for error-checking purposes, to 4487 operators in C++ means it is possible, for error-checking purposes, to
4100 redefine certain simple types (normally defined as aliases for simple 4488 redefine certain simple types (normally defined as aliases for simple
4101 built-in types such as @code{unsigned char} or @code{long}) as 4489 built-in types such as @code{unsigned char} or @code{long}) as
4102 classes, strictly limiting the permissible operations and catching 4490 classes, strictly limiting the permissible operations and catching
4103 illegal implicit casts and such. 4491 illegal implicit casts and such.
4104 4492
4493 @c #### did Ben delete this, or just the CODING-STANDARDS file in ./etc?
4105 XEmacs follows the GNU coding standards, which are documented 4494 XEmacs follows the GNU coding standards, which are documented
4106 separately in @xref{top,,, standards, GNU Coding Standards}. This 4495 separately in @xref{top,,, standards, GNU Coding Standards}. This
4107 section mainly documents standards that are not included in that 4496 section mainly documents standards that are not included in that
4108 document; typically this consists of standards that are specifically 4497 document; typically this consists of standards that are specifically
4109 relevant to the XEmacs code itself. 4498 relevant to the XEmacs code itself.
23220 ad-hocked since kingdom come, and it's high time that we make this 23609 ad-hocked since kingdom come, and it's high time that we make this
23221 work properly so that it could be relied upon, and a lot of things 23610 work properly so that it could be relied upon, and a lot of things
23222 could "just work". 23611 could "just work".
23223 23612
23224 23613
23614
23225 @node Future Work -- Better Rendering Support, , Future Work -- Lisp Engine Replacement, Future Work 23615 @node Future Work -- Better Rendering Support, , Future Work -- Lisp Engine Replacement, Future Work
23226 @section Future Work -- Better Rendering Support 23616 @section Future Work -- Better Rendering Support
23227 @cindex future work, better rendering support 23617 @cindex future work, better rendering support
23228 @cindex better rendering support, future work 23618 @cindex better rendering support, future work
23229 23619
23230 This section was written by Stephen Turnbull <stephen@@xemacs.org>, so 23620 This section was written by Stephen Turnbull <stephen@@xemacs.org>, so
23231 don't blame Ben (or Eric and Matthias, for that matter). Feel free to 23621 don't blame Ben (or Eric and Matthias, for that matter). Feel free to
23232 add, edit, and share the blame, guys! 23622 add, edit, and share the blame, guys!
23233 23623
23234 @c #### make these @urlref's!! 23624 @c #### Make these @urlref's!!
23235 As of late November 2004, this principally means adding support for the 23625 As of late November 2004, this principally means adding support for the
23236 @file{Xft} library, which provides a more robust @emph{font 23626 @file{Xft} library, which provides a more robust @emph{font
23237 configuration} mechanism via Keith Packard's @file{fontconfig} library 23627 configuration} mechanism via Keith Packard's @file{fontconfig} library
23238 improved glyph rendering, including antialiasing, via the 23628 improved glyph rendering, including antialiasing, via the
23239 @file{freetype} library, and client-side rendering (saving bandwidth and 23629 @file{freetype} library, and client-side rendering (saving bandwidth and
23242 authors have been unwilling to deal with several important issues which 23632 authors have been unwilling to deal with several important issues which
23243 block integration. These are @emph{Mule}, and more generally, 23633 block integration. These are @emph{Mule}, and more generally,
23244 @emph{face} support; @emph{widget} support (including the toolbar and 23634 @emph{face} support; @emph{widget} support (including the toolbar and
23245 menubar); and @emph{redisplay refactoring}. 23635 menubar); and @emph{redisplay refactoring}.
23246 23636
23247 @c Describe Alexey Gladkov and Yury Konovalov's work. 23637 @c #### Describe Alexey Gladkov and Yury Konovalov's work.
23248 23638
23249 However, in late 2003 Eric Knauel <knauel@@informatik.uni-tuebingen.de> 23639 However, in late 2003 Eric Knauel <knauel@@informatik.uni-tuebingen.de>
23250 and Matthias Neubauer <neubauer@@informatik.uni-freiburg.de> put forward 23640 and Matthias Neubauer <neubauer@@informatik.uni-freiburg.de> put forward
23251 a relatively complete patch which was robust to daily use in ISO 8859-1 23641 a relatively complete patch which was robust to daily use in ISO 8859-1
23252 locales, and Stephen Turnbull began work on the integration issues. At 23642 locales, and Stephen Turnbull began work on the integration issues. At
23253 this point a (private) CVS branch is available for Stephen's patch 23643 this point a (private) CVS branch is available for Stephen's patch
23254 (branch point tag @samp{sjt-xft-bp}, branch tag @samp{sjt-xft}), and 23644 (branch point tag @samp{sjt-xft-bp}, branch tag @samp{sjt-xft}), and
23255 one may be made available for the Knauel-Matthias patch soon. 23645 one may be made available for the Knauel-Matthias patch soon.
23256 23646
23257 @menu 23647 @menu
23258 * Better Rendering Support -- Issues:: 23648 * Better Rendering Support -- Review Criteria::
23259 * Better Rendering Support -- Implementation:: 23649 * Better Rendering Support -- Implementation::
23260 * Better Rendering Support -- Current Status:: 23650 * Better Rendering Support -- Current Status::
23261 * Better Rendering Support -- Configuration with the Interim Patches:: 23651 * Better Rendering Support -- Configuration with the Interim Patches::
23262 @end menu 23652 @end menu
23263 23653
23264 23654
23265 @node Better Rendering Support -- Issues, Better Rendering Support -- Implementation, , Future Work -- Better Rendering Support 23655 @node Better Rendering Support -- Review Criteria, Better Rendering Support -- Implementation, , Future Work -- Better Rendering Support
23266 @subsection Better Rendering Support -- Issues 23656 @subsection Better Rendering Support -- Review Criteria
23267 @cindex better rendering support, issues 23657 @cindex better rendering support, issues
23268 @cindex issues, better rendering support 23658 @cindex issues, better rendering support
23269 23659
23270 Of course it's ``unfair'' to demand that the implementers of a nice 23660 Of course it's ``unfair'' to demand that the implementers of a nice
23271 feature like anti-aliasing support deal with accumulated cruft of the 23661 feature like anti-aliasing support deal with accumulated cruft of the
23298 displayed in a window, but may appear in other contexts, especially in 23688 displayed in a window, but may appear in other contexts, especially in
23299 the gutters. So specifiers will probably have to be reworked, in order 23689 the gutters. So specifiers will probably have to be reworked, in order
23300 to properly support display of different faces in non-buffer, non-window 23690 to properly support display of different faces in non-buffer, non-window
23301 contexts. 23691 contexts.
23302 23692
23303 @node Better Rendering Support -- Implementation, Better Rendering Support -- Current Status, Better Rendering Support -- Issues, Future Work -- Better Rendering Support 23693 @node Better Rendering Support -- Implementation, Better Rendering Support -- Current Status, Better Rendering Support -- Review Criteria, Future Work -- Better Rendering Support
23304 @subsection Better Rendering Support -- Implementation 23694 @subsection Better Rendering Support -- Implementation
23305 @cindex better rendering support, implementation 23695 @cindex better rendering support, implementation
23306 @cindex implementation, better rendering support 23696 @cindex implementation, better rendering support
23307 23697
23308 Stephen is thinking in terms of the following components of a 23698 Stephen is thinking in terms of the following components of a
23322 specifiers and @file{fontconfig} overlap, we should consider using 23712 specifiers and @file{fontconfig} overlap, we should consider using
23323 @file{fontconfig} instead of @samp{XLFD} names. This implies that use 23713 @file{fontconfig} instead of @samp{XLFD} names. This implies that use
23324 of @file{Xft}'s rendering functionality should be separated from use of 23714 of @file{Xft}'s rendering functionality should be separated from use of
23325 @file{fontconfig}. 23715 @file{fontconfig}.
23326 23716
23717 @item fontconfig
23718 Fontconfig is dramatically different from the X model in several ways.
23719 In particular, @emph{fontconfig always returns a font}. However, the
23720 font returned need not be anything like the desired font. This means
23721 that XEmacs must adopt a strategy of delegating the search to
23722 fontconfig, then sanity-checking the return, rather than trying to use
23723 the fontconfig API to search using techniques appropriate for the X11
23724 core font API.
23725
23327 @item Font menus 23726 @item Font menus
23328 The @samp{Options->Font} and @samp{Options->Font Sizes} menus are 23727 The @samp{Options->Font} and @samp{Options->Font Sizes} menus are
23329 broken, by design, not just by @file{Xft}. Although they work better 23728 broken, by design, not just by @file{Xft}. Although they work better
23330 in Eric and Matthias's patch than in Stephen's, even their version has 23729 in Eric and Matthias's patch than in Stephen's, even their version has
23331 the problem that many fonts are unavailable because they don't match the 23730 the problem that many fonts are unavailable because they don't match the
23490 @item Options->Font 23889 @item Options->Font
23491 @itemx Options->Font Size 23890 @itemx Options->Font Size
23492 These menus don't work. All fonts are greyed out. All sizes are 23891 These menus don't work. All fonts are greyed out. All sizes are
23493 available, but many (most?) faces don't change size, in particular, 23892 available, but many (most?) faces don't change size, in particular,
23494 @samp{default} does not. 23893 @samp{default} does not.
23894
23895 @item Antialiased text bleeding outside of reported extent
23896 On my PowerBook G4 Titanium 15" screen, X.org server v6.8.1,
23897 dimensions: 1280x833 pixels (433x282 millimeters),
23898 resolution: 75x75 dots per inch,
23899 depth of root window: 24 planes
23900 (yes, those dimensions are broken),
23901 with font "Bitstream Vera Sans Mono-16:dpi=75" antialiased text may
23902 bleed out of the extent reported by XftTextExtents and other such
23903 facilities. This is most obvious with the underscore character in that
23904 font. The bottom of the underscore is antialiased, and insertions or
23905 deletions in the same line before the underscore leave a series of
23906 "phantom" underlines. Except that it doesn't happen on the very first
23907 such insertion or deletion after a window refresh. A similar effect
23908 sometimes occurs with deletions at the end of the line (no, I can't
23909 define "sometimes"). See also comments in @file{redisplay-x.c},
23910 functions @code{x_output_string} and @code{x_output_display_block}.
23911 (Mostly duplicated here.)
23912
23913 I think this is probably an Xft bug, but I'm not sure.
23495 @end table 23914 @end table
23496 23915
23497 23916
23498 @node Better Rendering Support -- Configuration with the Interim Patches, , Better Rendering Support -- Current Status, Future Work -- Better Rendering Support 23917 @node Better Rendering Support -- Configuration with the Interim Patches, , Better Rendering Support -- Current Status, Future Work -- Better Rendering Support
23499 @subsection Better Rendering Support -- Configuration with the Interim Patches 23918 @subsection Better Rendering Support -- Configuration with the Interim Patches
23503 For Stephen's @samp{sjt-xft} branch, you should keep the following in 23922 For Stephen's @samp{sjt-xft} branch, you should keep the following in
23504 mind when configuring: 23923 mind when configuring:
23505 23924
23506 @itemize 23925 @itemize
23507 @item 23926 @item
23508 The only way to configure widget fonts at the present time is to use X 23927 Although the menus don't work, it is possible to specify fonts for
23509 resources (or hack the source and rebuild). Currently supported widgets 23928 @emph{faces} using @code{set-face-font} (and other specifier-changing
23510 are 23929 functions).
23511 @itemize 23930
23512 @item 23931 There currently is no explicit way to specify that a particular font be
23513 menubars 23932 used only for a given language. However, since many fonts support only
23514 @item 23933 a limited repertoire such as ISO 8859/1, you can use the precedence of
23515 tab controls 23934 specifications for a given specifier locale to get something of this
23516 @end itemize 23935 effect for non-Latin character sets. This will normally work rather
23517 23936 poorly for multiple Latin character sets, however, because the
23518 Here are the resources I use. @strong{Warning:} @emph{This interface 23937 repertoires tend to have large amounts of overlap. Support for
23519 will change.} The tab control has separate Font and XftFont resources, 23938 specifying font by @emph{language} as well as by character set is
23520 and uses the X resource manager to instantiate a FontStruct from the 23939 planned.
23521 Font resource. The menubar on the other hand uses Font for both, but 23940
23522 converts to FontStruct if Xft is not compiled in, and leaves it as a
23523 string if Xft is compiled in. There is no equivalent facility for
23524 XftFont yet, and creating one that handles both FontStruct and XftFont
23525 depending on XEmacs's configuration and the font name seems error-prone
23526 at best. Probably we will revert to a simple string representation for
23527 this resource, and convert to a face in XEmacs rather than a font in
23528 Xt/Xft.
23529 @example
23530 XEmacs*Tabs.xftFont: Bitstream Vera Sans-18
23531 XEmacs*menubar.font: Bitstream Vera Sans-18
23532 XEmacs.modeline.attributeFont: Bitstream Charter-26
23533 XEmacs.default.attributeFont: Bitstream Vera Sans Mono-24
23534 @end example
23535 No, I don't understand why I need to use different point sizes to get
23536 what looks like good balance to my eyes. I do highly recommend use of a
23537 proportional font in the modeline because it allows a lot more text to
23538 fit there.
23539
23540 @item
23541 Because fonts supporting other languages tend to support English as 23941 Because fonts supporting other languages tend to support English as
23542 well, if you want to use one font for English and another for the other 23942 well, if you want to use one font for English and another for the other
23543 language, you must use the @code{append} method when adding font 23943 language, you must use the @code{append} method when adding font
23544 specifications for the other language. 23944 specifications for the @emph{other} language.
23545 23945
23546 However, this leaves you with a problem if you want to change the other 23946 However, this leaves you with a problem if you want to change the other
23547 language's font: you have to remove the existing specification so it 23947 language's font: you have to remove the existing specification so it
23548 won't shadow the new one when you append. 23948 won't shadow the new one when you append.
23549 23949
23557 (set-face-font 'default "Kochi Mincho-14" nil '(lang-ja) 'append) 23957 (set-face-font 'default "Kochi Mincho-14" nil '(lang-ja) 'append)
23558 ;; Oops, too sober. Try something to match AirCut. 23958 ;; Oops, too sober. Try something to match AirCut.
23559 (set-face-font 'default "Mikachan-14" 23959 (set-face-font 'default "Mikachan-14"
23560 nil '(lang-ja) 'remove-tag-set-append) 23960 nil '(lang-ja) 'remove-tag-set-append)
23561 @end example 23961 @end example
23962
23963 @item
23964 The only way to configure widget fonts at the present time is to use X
23965 resources (or hack the source and rebuild). Currently supported widgets
23966 are
23967 @itemize
23968 @item
23969 menubars
23970 @item
23971 tab controls
23562 @end itemize 23972 @end itemize
23973
23974 Here are the resources I use. @strong{Warning:} @emph{This interface
23975 will change.} The tab control and menubar have separate Font and
23976 XftFont resources, and use the X resource manager to instantiate a
23977 FontStruct from the Font resource. There is no converter facility for
23978 XftFont yet, and creating one that handles both FontStruct and XftFont
23979 depending on XEmacs's configuration and the font name seems error-prone
23980 at best. Probably we will should to a simple string representation for
23981 this resource, and convert to a face in XEmacs rather than a font in
23982 Xt/Xft.
23983 @example
23984 XEmacs*Tabs.xftFont: Bitstream Vera Sans-16
23985 XEmacs*menubar*xftFont: Bitstream Vera Sans-16
23986 XEmacs.modeline.attributeFont: Bitstream Charter-16
23987 XEmacs.default.attributeFont: Bitstream Vera Sans Mono-16
23988 @end example
23989 I highly recommend use of a proportional font in the modeline because it
23990 allows a lot more text to fit there. (Previously the font sizes were
23991 quite varied, and there was a comment that this weirdness gave good
23992 balance. This isn't true on my main platform, Mac OS X, and needs to be
23993 rechecked on Linux, where it was observed.)
23994 @end itemize
23995
23563 23996
23564 23997
23565 @node Future Work Discussion, Old Future Work, Future Work, Top 23998 @node Future Work Discussion, Old Future Work, Future Work, Top
23566 @chapter Future Work Discussion 23999 @chapter Future Work Discussion
23567 @cindex future work, discussion 24000 @cindex future work, discussion