Mercurial > hg > xemacs-beta
view man/lispref/internationalization.texi @ 4921:17362f371cc2
add more byte-code assertions and better failure output
-------------------- ChangeLog entries follow: --------------------
src/ChangeLog addition:
2010-02-03 Ben Wing <ben@xemacs.org>
* alloc.c (Fmake_byte_code):
* bytecode.h:
* lisp.h:
* lread.c:
* lread.c (readevalloop):
* lread.c (Fread):
* lread.c (Fread_from_string):
* lread.c (read_list_conser):
* lread.c (read_list):
* lread.c (vars_of_lread):
* symbols.c:
* symbols.c (Fdefine_function):
Turn on the "compiled-function annotation hack". Implement it
properly by hooking into Fdefalias(). Note in the docstring to
`defalias' that we do this. Remove some old broken code and
change code that implemented the old kludgy way of hooking into
the Lisp reader into bracketed by `#ifdef
COMPILED_FUNCTION_ANNOTATION_HACK_OLD_WAY', which is not enabled.
Also enable byte-code metering when DEBUG_XEMACS -- this is a form
of profiling for computing histograms of which sequences of two
bytecodes are used most often.
* bytecode-ops.h:
* bytecode-ops.h (OPCODE):
New file. Extract out all the opcodes and declare them using
OPCODE(), a bit like frame slots and such. This way the file can
be included multiple times if necessary to iterate multiple times
over the byte opcodes.
* bytecode.c:
* bytecode.c (NUM_REMEMBERED_BYTE_OPS):
* bytecode.c (OPCODE):
* bytecode.c (assert_failed_with_remembered_ops):
* bytecode.c (READ_UINT_2):
* bytecode.c (READ_INT_1):
* bytecode.c (READ_INT_2):
* bytecode.c (PEEK_INT_1):
* bytecode.c (PEEK_INT_2):
* bytecode.c (JUMP_RELATIVE):
* bytecode.c (JUMP_NEXT):
* bytecode.c (PUSH):
* bytecode.c (POP_WITH_MULTIPLE_VALUES):
* bytecode.c (DISCARD):
* bytecode.c (UNUSED):
* bytecode.c (optimize_byte_code):
* bytecode.c (optimize_compiled_function):
* bytecode.c (Fbyte_code):
* bytecode.c (vars_of_bytecode):
* bytecode.c (init_opcode_table_multi_op):
* bytecode.c (reinit_vars_of_bytecode):
* emacs.c (main_1):
* eval.c (funcall_compiled_function):
* symsinit.h:
Any time we change either the instruction pointer or the stack
pointer, assert that we're going to move it to a valid location.
This should catch failures right when they occur rather than
sometime later. This requires that we pass in another couple of
parameters into some functions (only with error-checking enabled,
see below).
Also keep track, using a circular queue, of the last 100 byte
opcodes seen, and when we hit an assert failure during byte-code
execution, output the contents of the queue in a nice readable
fashion. This requires that bytecode-ops.h be included a second
time so that a table mapping opcodes to the name of their operation
can be constructed. This table is constructed in new function
reinit_vars_of_bytecode().
Everything in the last two paras happens only when
ERROR_CHECK_BYTE_CODE.
Add some longish comments describing how the arrays that hold the
stack and instructions, and the pointers used to access them, work.
* gc.c:
Import some code from my `latest-fix' workspace to mark the
staticpro's in order from lowest to highest, rather than highest to
lowest, so it's easier to debug when something goes wrong.
* lisp.h (abort_with_message): Renamed from abort_with_msg().
* symbols.c (defsymbol_massage_name_1):
* symbols.c (defsymbol_nodump):
* symbols.c (defsymbol):
* symbols.c (defkeyword):
* symeval.h (DEFVAR_SYMVAL_FWD_OBJECT):
Make the various calls to staticpro() instead call staticpro_1(),
passing in the name of the C var being staticpro'ed, so that it
shows up in staticpro_names. Otherwise staticpro_names just has
1000+ copies of the word `location'.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Wed, 03 Feb 2010 08:01:55 -0600 |
parents | 03ab78e48ef6 |
children | 62b9ef1ed4ac |
line wrap: on
line source
@c -*-texinfo-*- @c This is part of the XEmacs Lisp Reference Manual. @c Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc. @c See the file lispref.texi for copying conditions. @setfilename ../../info/internationalization.info @node Internationalization, MULE, PostgreSQL Support, top @chapter Internationalization @menu * I18N Levels 1 and 2:: Support for different time, date, and currency formats. * I18N Level 3:: Support for localized messages. * I18N Level 4:: Support for Asian languages. @end menu @node I18N Levels 1 and 2 @section I18N Levels 1 and 2 XEmacs is now compliant with I18N levels 1 and 2. Specifically, this means that it is 8-bit clean and correctly handles time and date functions. XEmacs will correctly display the entire ISO-Latin 1 character set. The compose key may now be used to create any character in the ISO-Latin 1 character set not directly available via the keyboard.. In order for the compose key to work it is necessary to load the file @file{x-compose.el}. At any time while composing a character, @code{C-h} will display all valid completions and the character which would be produced. @node I18N Level 3 @section I18N Level 3 @menu * Level 3 Basics:: * Level 3 Primitives:: * Dynamic Messaging:: * Domain Specification:: @end menu @node Level 3 Basics @subsection Level 3 Basics XEmacs now provides alpha-level functionality for I18N Level 3. This means that everything necessary for full messaging is available, but not every file has been converted. The two message files which have been created are @file{src/emacs.po} and @file{lisp/packages/mh-e.po}. Both files need to be converted using @code{msgfmt}, and the resulting @file{.mo} files placed in some locale's @code{LC_MESSAGES} directory. The test ``translations'' in these files are the original messages prefixed by @code{TRNSLT_}. The domain for a variable is stored on the variable's property list under the property name @var{variable-domain}. The function @code{documentation-property} uses this information when translating a variable's documentation. @node Level 3 Primitives @subsection Level 3 Primitives @defun gettext string This function looks up @var{string} in the default message domain and returns its translation. If @code{I18N3} was not enabled when XEmacs was compiled, it just returns @var{string}. @end defun @defun dgettext domain string This function looks up @var{string} in the specified message domain and returns its translation. If @code{I18N3} was not enabled when XEmacs was compiled, it just returns @var{string}. @end defun @defun bind-text-domain domain pathname This function associates a pathname with a message domain. Here's how the path to message file is constructed under SunOS 5.x: @example @code{@{pathname@}/@{LANG@}/LC_MESSAGES/@{domain@}.mo} @end example If @code{I18N3} was not enabled when XEmacs was compiled, this function does nothing. @end defun @defspec domain string This function specifies the text domain used for translating documentation strings and interactive prompts of a function. For example, write: @example (defun foo (arg) "Doc string" (domain "emacs-foo") @dots{}) @end example to specify @code{emacs-foo} as the text domain of the function @code{foo}. The ``call'' to @code{domain} is actually a declaration rather than a function; when actually called, @code{domain} just returns @code{nil}. @end defspec @defun domain-of function This function returns the text domain of @var{function}; it returns @code{nil} if it is the default domain. If @code{I18N3} was not enabled when XEmacs was compiled, it always returns @code{nil}. @end defun @node Dynamic Messaging @subsection Dynamic Messaging The @code{format} function has been extended to permit you to change the order of parameter insertion. For example, the conversion format @code{%1$s} inserts parameter one as a string, while @code{%2$s} inserts parameter two. This is useful when creating translations which require you to change the word order. @node Domain Specification @subsection Domain Specification The default message domain of XEmacs is `emacs'. For add-on packages, it is best to use a different domain. For example, let us say we want to convert the ``gorilla'' package to use the domain `emacs-gorilla'. To translate the message ``What gorilla?'', use @code{dgettext} as follows: @example (dgettext "emacs-gorilla" "What gorilla?") @end example A function (or macro) which has a documentation string or an interactive prompt needs to be associated with the domain in order for the documentation or prompt to be translated. This is done with the @code{domain} special form as follows: @page @example (defun scratch (location) "Scratch the specified location." (domain "emacs-gorilla") (interactive "sScratch: ") @dots{} ) @end example It is most efficient to specify the domain in the first line of the function body, before the @code{interactive} form. For variables and constants which have documentation strings, specify the domain after the documentation. @defspec defvar symbol [value [doc-string [domain]]] Example: @example (defvar weight 250 "Weight of gorilla, in pounds." "emacs-gorilla") @end example @end defspec @defspec defconst symbol [value [doc-string [domain]]] Example: @example (defconst limbs 4 "Number of limbs" "emacs-gorilla") @end example @end defspec @defun autoload function filename &optional docstring interactive type This function defines @var{function} to autoload from @var{filename} Example: @example (autoload 'explore "jungle" "Explore the jungle." nil nil "emacs-gorilla") @end example @end defun @node I18N Level 4 @section I18N Level 4 The Asian-language support in XEmacs is called ``MULE''. @xref{MULE}.