Mercurial > hg > xemacs-beta
view src/intl.c @ 934:c925bacdda60
[xemacs-hg @ 2002-07-29 09:21:12 by michaels]
2002-07-17 Marcus Crestani <crestani@informatik.uni-tuebingen.de>
Markus Kaltenbach <makalten@informatik.uni-tuebingen.de>
Mike Sperber <mike@xemacs.org>
configure flag to turn these changes on: --use-kkcc
First we added a dumpable flag to lrecord_implementation. It shows,
if the object is dumpable and should be processed by the dumper.
* lrecord.h (struct lrecord_implementation): added dumpable flag
(MAKE_LRECORD_IMPLEMENTATION): fitted the different makro definitions
to the new lrecord_implementation and their calls.
Then we changed mark_object, that it no longer needs a mark method for
those types that have pdump descritions.
* alloc.c:
(mark_object): If the object has a description, the new mark algorithm
is called, and the object is marked according to its description.
Otherwise it uses the mark method like before.
These procedures mark objects according to their descriptions. They
are modeled on the corresponding pdumper procedures.
(mark_with_description):
(get_indirect_count):
(structure_size):
(mark_struct_contents):
These procedures still call mark_object, this is needed while there are
Lisp_Objects without descriptions left.
We added pdump descriptions for many Lisp_Objects:
* extents.c: extent_auxiliary_description
* database.c: database_description
* gui.c: gui_item_description
* scrollbar.c: scrollbar_instance_description
* toolbar.c: toolbar_button_description
* event-stream.c: command_builder_description
* mule-charset.c: charset_description
* device-msw.c: devmode_description
* dialog-msw.c: mswindows_dialog_id_description
* eldap.c: ldap_description
* postgresql.c: pgconn_description
pgresult_description
* tooltalk.c: tooltalk_message_description
tooltalk_pattern_description
* ui-gtk.c: emacs_ffi_description
emacs_gtk_object_description
* events.c:
* events.h:
* event-stream.c:
* event-Xt.c:
* event-gtk.c:
* event-tty.c:
To write a pdump description for Lisp_Event, we converted every struct
in the union event to a Lisp_Object. So we created nine new
Lisp_Objects: Lisp_Key_Data, Lisp_Button_Data, Lisp_Motion_Data,
Lisp_Process_Data, Lisp_Timeout_Data, Lisp_Eval_Data,
Lisp_Misc_User_Data, Lisp_Magic_Data, Lisp_Magic_Eval_Data.
We also wrote makro selectors and mutators for the fields of the new
designed Lisp_Event and added everywhere these new abstractions.
We implemented XD_UNION support in (mark_with_description), so
we can describe exspecially console/device specific data with XD_UNION.
To describe with XD_UNION, we added a field to these objects, which
holds the variant type of the object. This field is initialized in
the appendant constructor. The variant is an integer, it has also to
be described in an description, if XD_UNION is used.
XD_UNION is used in following descriptions:
* console.c: console_description
(get_console_variant): returns the variant
(create_console): added variant initialization
* console.h (console_variant): the different console types
* console-impl.h (struct console): added enum console_variant contype
* device.c: device_description
(Fmake_device): added variant initialization
* device-impl.h (struct device): added enum console_variant devtype
* objects.c: image_instance_description
font_instance_description
(Fmake_color_instance): added variant initialization
(Fmake_font_instance): added variant initialization
* objects-impl.h (struct Lisp_Color_Instance): added color_instance_type
* objects-impl.h (struct Lisp_Font_Instance): added font_instance_type
* process.c: process_description
(make_process_internal): added variant initialization
* process.h (process_variant): the different process types
author | michaels |
---|---|
date | Mon, 29 Jul 2002 09:21:25 +0000 |
parents | 2b6fa2618f76 |
children | 4a9a804b31cb |
line wrap: on
line source
/* Various functions for internationalizing XEmacs. Copyright (C) 1993, 1994, 1995 Board of Trustees, University of Illinois. Copyright (C) 2000, 2001, 2002 Ben Wing. This file is part of XEmacs. XEmacs is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XEmacs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XEmacs; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Synched up with: Not in FSF. */ #include <config.h> #include "lisp.h" #if defined (HAVE_X_WINDOWS) && defined (HAVE_X11_XLOCALE_H) #include <X11/Xlocale.h> #else #ifdef HAVE_LOCALE_H #include <locale.h> #endif #endif #ifdef HAVE_X_WINDOWS int init_x_locale (Lisp_Object locale); #endif DEFUN ("current-locale", Fcurrent_locale, 0, 0, 0, /* Return the current locale. This is of the form LANG_COUNTRY.ENCODING, or LANG_COUNTRY, or LANG, or .ENCODING. Unfortunately, the meanings of these three values are system-dependent, and there is no universal agreement. */ ()) { Extbyte *loc; loc = setlocale (LC_CTYPE, NULL); if (!loc) return Qnil; return build_ext_string (loc, Qctext); } DEFUN ("set-current-locale", Fset_current_locale, 1, 1, 0, /* Set the user's current locale. Takes a string, the value passed to setlocale(). This is of the form LANG_COUNTRY.ENCODING, or LANG_COUNTRY, or LANG, or .ENCODING. Unfortunately, the meanings of these three values are system-dependent, and there is no universal agreement. This function is meant to be called only from `set-language-environment', which keeps tables to figure out the values to use for particular systems. If the empty string is passed in, the locale is initialized from environment variables. Returns nil if the call failed (typically, an invalid locale was given). Otherwise, returns the locale, or possibly a more-specified version. */ (locale)) { Extbyte *loc; CHECK_STRING (locale); /* RedHat 6.2 contains a locale called "Francais" with the C-cedilla encoded in ISO2022! */ LISP_STRING_TO_EXTERNAL (locale, loc, Qctext); loc = setlocale (LC_ALL, loc); setlocale (LC_NUMERIC, "C"); if (!loc) return Qnil; #ifdef HAVE_X_WINDOWS if (!init_x_locale (locale)) { /* Locale not supported under X. Put it back. */ setlocale (LC_ALL, loc); setlocale (LC_NUMERIC, "C"); return Qnil; } #endif return build_ext_string (loc, Qctext); } #if 0 /* #### some old code that I really want to nuke, but I'm not completely sure what it did, so I'll leave it until we get around to implementing message-translation and decide whether the functionality that this is trying to support makes any sense. --ben */ Lisp_Object Qdefer_gettext; DEFUN ("ignore-defer-gettext", Fignore_defer_gettext, 1, 1, 0, /* If OBJECT is of the form (defer-gettext "string"), return the string. The purpose of the defer-gettext symbol is to identify strings which are translated when they are referenced instead of when they are defined. */ (object)) { if (CONSP (object) && SYMBOLP (Fcar (object)) && EQ (Fcar (object), Qdefer_gettext)) return Fcar (Fcdr (object)); else return object; } #endif /* 0 */ DEFUN ("gettext", Fgettext, 1, 1, 0, /* Look up STRING in the default message domain and return its translation. This function does nothing if I18N3 was not enabled when Emacs was compiled. */ (string)) { #ifdef I18N3 /* #### What should happen here is: 1) If the string has no `string-translatable' property or its value is nil, no translation takes place. The `string-translatable' property only gets added when a constant string is read in from a .el or .elc file, to avoid excessive translation. (The user can also explicitly add this property to a string.) 2) If the string's `string-translatable' property is a string, that string should be returned. `format' add this property. This allows translation to take place at the proper time but avoids excessive translation if the string is not destined for a translating stream. (See print_internal().) 3) If gettext() returns the same string, then Fgettext() should return the same object, minus the 'string-translatable' property. */ #endif return string; } #ifdef I18N3 /* #### add the function `force-gettext', perhaps in Lisp. This ignores the `string-translatable' property and simply calls gettext() on the string. Add the functions `set-string-translatable' and `set-stream-translating'. */ #endif /************************************************************************/ /* initialization */ /************************************************************************/ void init_intl (void) { /* This function can GC */ if (initialized) { int count = begin_gc_forbidden (); Lisp_Object args[2]; specbind (Qinhibit_quit, Qt); args[0] = Qreally_early_error_handler; args[1] = intern ("init-locale-at-early-startup"); Fcall_with_condition_handler (2, args); /* Should be calling this here, but problems with `data-directory' and locating the files. See comment in mule-cmds.el:`init-mule-at-startup'. args[1] = intern ("init-unicode-at-early-startup"); Fcall_with_condition_handler (2, args); */ unbind_to (count); } } void syms_of_intl (void) { DEFSUBR (Fgettext); DEFSUBR (Fset_current_locale); DEFSUBR (Fcurrent_locale); } void vars_of_intl (void) { #ifdef I18N3 Fprovide (intern ("i18n3")); #endif #ifdef MULE Fprovide (intern ("mule")); #endif /* MULE */ }