summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit52
-rw-r--r--src/ChangeLog99
-rw-r--r--src/callproc.c6
-rw-r--r--src/emacs.c4
-rw-r--r--src/gtkutil.c58
-rw-r--r--src/keymap.c4
-rw-r--r--src/mac.c221
-rw-r--r--src/macfns.c31
-rw-r--r--src/process.c162
-rw-r--r--src/window.h3
10 files changed, 412 insertions, 228 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index 4120b1e10bf..3c77720a49a 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -765,21 +765,39 @@ show environment TERM
#set args -geometry 80x40+0+0
# People get bothered when they see messages about non-existent functions...
-echo \n
-echo If you see messages below about functions not being defined,\n
-echo don\'t worry about them. Nothing is wrong.\n
-echo \n
-
-# Don't let abort actually run, as it will make
-# stdio stop working and therefore the `pr' command above as well.
-break abort
-
-# The MS-Windows build replaces abort with its own function.
-break w32_abort
-
-# If we are running in synchronous mode, we want a chance to look around
-# before Emacs exits. Perhaps we should put the break somewhere else
-# instead...
-break x_error_quitter
-
+xgetptr Vsystem_type
+set $tem = (struct Lisp_Symbol *) $ptr
+xgetptr $tem->xname
+set $tem = (struct Lisp_String *) $ptr
+set $tem = (char *) $tem->data
+
+# Don't let abort actually run, as it will make stdio stop working and
+# therefore the `pr' command above as well.
+if $tem[0] == 'w' && $tem[1] == 'i' && $tem[2] == 'n' && $tem[3] == 'd'
+ # The windows-nt build replaces abort with its own function.
+ break w32_abort
+else
+ break abort
+end
+
+# x_error_quitter is defined only on X. But window-system is set up
+# only at run time, during Emacs startup, so we need to defer setting
+# the breakpoint. init_sys_modes is the first function called on
+# every platform after init_display, where window-system is set.
+tbreak init_sys_modes
+commands
+ silent
+ xgetptr Vwindow_system
+ set $tem = (struct Lisp_Symbol *) $ptr
+ xgetptr $tem->xname
+ set $tem = (struct Lisp_String *) $ptr
+ set $tem = (char *) $tem->data
+ # If we are running in synchronous mode, we want a chance to look
+ # around before Emacs exits. Perhaps we should put the break
+ # somewhere else instead...
+ if $tem[0] == 'x' && $tem[1] == '\0'
+ break x_error_quitter
+ end
+ continue
+end
# arch-tag: 12f34321-7bfa-4240-b77a-3cd3a1696dfe
diff --git a/src/ChangeLog b/src/ChangeLog
index 6ad7c939bce..54c41d66413 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,74 @@
+2006-01-06 Nick Roberts <nickrob@snap.net.nz>
+
+ * .gdbinit: Fix typo.
+
+2006-01-05 Eli Zaretskii <eliz@gnu.org>
+
+ * .gdbinit: Fix last change.
+
+2006-01-05 Kim F. Storm <storm@cua.dk>
+
+ * process.c (Fmake_network_process): Use AF_INET instead of
+ AF_UNSPEC when AF_INET6 is not defined.
+
+2006-01-05 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
+
+ * mac.c (mac_coerce_file_name_ptr, mac_coerce_file_name_desc):
+ Don't check that the other type is known file-related one.
+
+ * macfns.c (Fx_server_version): Use gestaltSystemVersionMajor,
+ gestaltSystemVersionMinor, and gestaltSystemVersionBugFix on Mac
+ OS X 10.4 and later.
+
+2006-01-04 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
+
+ * gtkutil.c (xg_get_image_for_pixmap): If the image is from a file,
+ let GTK do all image processing. Importing Emacs own pixmaps to GTK
+ looks bad for inactive tool bar items with some Gnome themes.
+
+2006-01-04 Eli Zaretskii <eliz@gnu.org>
+
+ * .gdbinit: Avoid a warning message when x_error_quitter is not
+ compiled in.
+
+ * process.c [WINDOWSNT]: Undef AF_INET6 to disable IPv6 support
+ for w32.
+
+2006-01-04 Kim F. Storm <storm@cua.dk>
+
+ * process.c: Add IPv6 support.
+ (Qipv4, Qipv6): New vars.
+ (syms_of_process): Intern and staticpro them.
+ (Fformat_network_address): Handle 9 or 8 element vector as IPv6 address
+ with or without port number. Handle 4 element vector as IPv4 address
+ without port number.
+ (conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
+ (conv_lisp_to_sockaddr): Handle IPv6 addresses.
+ (Fmake_network_process): Use :family 'ipv4 and 'ipv6 to explicitly
+ request that address family only. :family nil or omitted means to
+ determine address family from the specified :host and :service.
+ (ifflag_table): Add missing OpenBSD IFF_ flags.
+ (server_accept_connection): Handle IPv6 addresses.
+ (init_process): Add (:family ipv4) and (:family ipv6) sub-features.
+
+ * .gdbinit: Undo last change. Instead, look at Vsystem_type to
+ determine which breakpoints to set.
+
+2006-01-03 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * keymap.c (describe_map_compare): Yet another int/Lisp_Object mixup.
+
+ * window.h (Fwindow_minibuffer_p): Declare (for use in minibuf.c).
+
+2006-01-03 Romain Francoise <romain@orebokech.com>
+
+ * emacs.c (main): Update copyright year.
+
+2006-01-03 Ken Raeburn <raeburn@gnu.org>
+
+ * callproc.c (delete_temp_file): Bind file-name-handler-alist to
+ nil for the call to internal_delete_file.
+
2006-01-01 Ken Raeburn <raeburn@gnu.org>
* callproc.c (Fcall_process_region): Bind file-name-handler-alist
@@ -48,7 +119,7 @@
2005-12-28 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
- * gtkutil.c (xg_get_file_with_chooser): Changed message shown
+ * gtkutil.c (xg_get_file_with_chooser): Change message shown
in file chooser.
2005-12-27 Richard M. Stallman <rms@gnu.org>
@@ -122,8 +193,8 @@
* macterm.h (TYPE_FILE_NAME): New define.
(posix_pathname_to_fsspec, fsspec_to_posix_pathname): Remove externs.
- * mac.c (posix_pathname_to_fsspec, fsspec_to_posix_pathname): Add
- prototypes. Make static.
+ * mac.c (posix_pathname_to_fsspec, fsspec_to_posix_pathname):
+ Add prototypes. Make static.
(mac_aedesc_to_lisp): Initialize err to noErr.
(mac_coerce_file_name_ptr, mac_coerce_file_name_desc)
(init_coercion_handler): New functions.
@@ -167,8 +238,8 @@
* macgui.h (XCharStruct): Remove member `valid_p'.
(STORE_XCHARSTRUCT): Don't set member `valid_p'.
(XCharStructRow): New typedef.
- (XCHARSTRUCTROW_CHAR_VALID_P, XCHARSTRUCTROW_SET_CHAR_VALID): New
- macros.
+ (XCHARSTRUCTROW_CHAR_VALID_P, XCHARSTRUCTROW_SET_CHAR_VALID):
+ New macros.
(struct MacFontStruct): Add member `bounds'. Remove member
`per_char'. All uses for QuichDraw Text fonts are changed to
`bounds.per_char'. ATSUI font bounds are represented as an array
@@ -180,8 +251,8 @@
(mac_query_char_extents): New function.
(x_per_char_metric): Use it.
(XLoadQueryFont): Likewise. Consolidate min/max_bounds calculations.
- [USE_CG_TEXT_DRAWING] (mac_draw_string_cg): Use
- mac_per_char_metric instead of x_per_char_metric.
+ [USE_CG_TEXT_DRAWING] (mac_draw_string_cg):
+ Use mac_per_char_metric instead of x_per_char_metric.
(mac_text_extents_16): New function.
(mac_compute_glyph_string_overhangs): Use it.
(mac_unload_font): Free member `bounds' in struct MacFontStruct.
@@ -435,11 +506,11 @@
[MAC_OS8] (main): Call init_apple_event_handler instead of
init_required_apple_events.
(mac_initialize) [MAC_OSX]: Likewise.
- [!USE_CARBON_EVENTS] (mac_wait_next_event): Use
- mac_ready_for_apple_events instead of Qmac_ready_for_drag_n_drop.
+ [!USE_CARBON_EVENTS] (mac_wait_next_event):
+ Use mac_ready_for_apple_events instead of Qmac_ready_for_drag_n_drop.
- * macterm.h (mac_make_lispy_event_code, mac_aedesc_to_lisp): Add
- externs.
+ * macterm.h (mac_make_lispy_event_code, mac_aedesc_to_lisp):
+ Add externs.
(create_apple_event_from_event_ref) [TARGET_API_MAC_CARBON]: Likewise.
(Fmac_get_preference): Add EXFUN.
@@ -479,11 +550,9 @@
2005-12-06 Ken Raeburn <raeburn@gnu.org>
- * buffer.c (Fkill_buffer): Avoid dangerous side effects in NILP
- argument.
+ * buffer.c (Fkill_buffer): Avoid dangerous side effects in NILP args.
* bytecode.c (Fbyte_code): Likewise.
- * fileio.c (internal_delete_file, Fread_file_name_internal):
- Likewise.
+ * fileio.c (internal_delete_file, Fread_file_name_internal): Likewise.
* minibuf.c (Fminibuffer_complete_and_exit): Likewise.
* undo.c (truncate_undo_list): Likewise.
diff --git a/src/callproc.c b/src/callproc.c
index c7804b485c7..eebbabb2739 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1020,9 +1020,11 @@ static Lisp_Object
delete_temp_file (name)
Lisp_Object name;
{
- /* Use Fdelete_file (indirectly) because that runs a file name handler.
- We did that when writing the file, so we should do so when deleting. */
+ /* Suppress jka-compr handling, etc. */
+ int count = SPECPDL_INDEX ();
+ specbind (intern ("file-name-handler-alist"), Qnil);
internal_delete_file (name);
+ unbind_to (count, Qnil);
return Qnil;
}
diff --git a/src/emacs.c b/src/emacs.c
index d38cf4379bf..e9fb4e3cb85 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1,6 +1,6 @@
/* Fully extensible Emacs, running on Unix, intended for GNU.
Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 1998, 1999,
- 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -900,7 +900,7 @@ main (argc, argv
else
{
printf ("GNU Emacs %s\n", SDATA (tem));
- printf ("Copyright (C) 2005 Free Software Foundation, Inc.\n");
+ printf ("Copyright (C) 2006 Free Software Foundation, Inc.\n");
printf ("GNU Emacs comes with ABSOLUTELY NO WARRANTY.\n");
printf ("You may redistribute copies of Emacs\n");
printf ("under the terms of the GNU General Public License.\n");
diff --git a/src/gtkutil.c b/src/gtkutil.c
index cb8e5a21860..ce66c5de35e 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -322,43 +322,43 @@ xg_get_image_for_pixmap (f, img, widget, old_widget)
GdkPixmap *gmask;
GdkDisplay *gdpy;
- /* If we are on a one bit display, let GTK do all the image handling.
+ /* If we have a file, let GTK do all the image handling.
This seems to be the only way to make insensitive and activated icons
- look good. */
- if (x_screen_planes (f) == 1)
- {
- Lisp_Object specified_file = Qnil;
- Lisp_Object tail;
- extern Lisp_Object QCfile;
-
- for (tail = XCDR (img->spec);
- NILP (specified_file) && CONSP (tail) && CONSP (XCDR (tail));
- tail = XCDR (XCDR (tail)))
- if (EQ (XCAR (tail), QCfile))
- specified_file = XCAR (XCDR (tail));
+ look good in all cases. */
+ Lisp_Object specified_file = Qnil;
+ Lisp_Object tail;
+ extern Lisp_Object QCfile;
- if (STRINGP (specified_file))
- {
+ for (tail = XCDR (img->spec);
+ NILP (specified_file) && CONSP (tail) && CONSP (XCDR (tail));
+ tail = XCDR (XCDR (tail)))
+ if (EQ (XCAR (tail), QCfile))
+ specified_file = XCAR (XCDR (tail));
- Lisp_Object file = Qnil;
- struct gcpro gcpro1;
- GCPRO1 (file);
+ if (STRINGP (specified_file))
+ {
+ Lisp_Object file = Qnil;
+ struct gcpro gcpro1;
+ GCPRO1 (file);
- file = x_find_image_file (specified_file);
- /* We already loaded the image once before calling this
- function, so this should not fail. */
- xassert (STRINGP (file) != 0);
+ file = x_find_image_file (specified_file);
+ /* We already loaded the image once before calling this
+ function, so this should not fail. */
+ xassert (STRINGP (file) != 0);
- if (! old_widget)
- old_widget = GTK_IMAGE (gtk_image_new_from_file (SSDATA (file)));
- else
- gtk_image_set_from_file (old_widget, SSDATA (file));
+ if (! old_widget)
+ old_widget = GTK_IMAGE (gtk_image_new_from_file (SSDATA (file)));
+ else
+ gtk_image_set_from_file (old_widget, SSDATA (file));
- UNGCPRO;
- return GTK_WIDGET (old_widget);
- }
+ UNGCPRO;
+ return GTK_WIDGET (old_widget);
}
+ /* No file, do the image handling ourselves. This will look very bad
+ on a monochrome display, and sometimes bad on all displays with
+ certain themes. */
+
gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f));
gpix = gdk_pixmap_foreign_new_for_display (gdpy, img->pixmap);
gmask = img->mask ? gdk_pixmap_foreign_new_for_display (gdpy, img->mask) : 0;
diff --git a/src/keymap.c b/src/keymap.c
index 64069ca4deb..b09358dbbcb 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -3189,8 +3189,8 @@ describe_map_compare (aa, bb)
if (INTEGERP (a->event) && !INTEGERP (b->event))
return -1;
if (SYMBOLP (a->event) && SYMBOLP (b->event))
- return (Fstring_lessp (a->event, b->event) ? -1
- : Fstring_lessp (b->event, a->event) ? 1
+ return (!NILP (Fstring_lessp (a->event, b->event)) ? -1
+ : !NILP (Fstring_lessp (b->event, a->event)) ? 1
: 0);
return 0;
}
diff --git a/src/mac.c b/src/mac.c
index 7c3e495f3a9..5a56bd57817 100644
--- a/src/mac.c
+++ b/src/mac.c
@@ -411,91 +411,73 @@ mac_coerce_file_name_ptr (type_code, data_ptr, data_size,
{
OSErr err;
- if (type_code == TYPE_FILE_NAME)
+ if (type_code == typeNull)
+ err = errAECoercionFail;
+ else if (type_code == to_type || to_type == typeWildCard)
+ err = AECreateDesc (TYPE_FILE_NAME, data_ptr, data_size, result);
+ else if (type_code == TYPE_FILE_NAME)
/* Coercion from undecoded file name. */
- switch (to_type)
- {
- case typeAlias:
- case typeFSS:
- case typeFSRef:
-#ifdef MAC_OSX
- case typeFileURL:
-#endif
- {
+ {
#ifdef MAC_OSX
- CFStringRef str;
- CFURLRef url = NULL;
- CFDataRef data = NULL;
+ CFStringRef str;
+ CFURLRef url = NULL;
+ CFDataRef data = NULL;
- str = CFStringCreateWithBytes (NULL, data_ptr, data_size,
- kCFStringEncodingUTF8, false);
- if (str)
- {
- url = CFURLCreateWithFileSystemPath (NULL, str,
- kCFURLPOSIXPathStyle, false);
- CFRelease (str);
- }
- if (url)
- {
- data = CFURLCreateData (NULL, url, kCFStringEncodingUTF8, true);
- CFRelease (url);
- }
- if (data)
- {
- err = AECoercePtr (typeFileURL, CFDataGetBytePtr (data),
- CFDataGetLength (data), to_type, result);
- CFRelease (data);
- }
- else
- err = memFullErr;
+ str = CFStringCreateWithBytes (NULL, data_ptr, data_size,
+ kCFStringEncodingUTF8, false);
+ if (str)
+ {
+ url = CFURLCreateWithFileSystemPath (NULL, str,
+ kCFURLPOSIXPathStyle, false);
+ CFRelease (str);
+ }
+ if (url)
+ {
+ data = CFURLCreateData (NULL, url, kCFStringEncodingUTF8, true);
+ CFRelease (url);
+ }
+ if (data)
+ {
+ err = AECoercePtr (typeFileURL, CFDataGetBytePtr (data),
+ CFDataGetLength (data), to_type, result);
+ CFRelease (data);
+ }
+ else
+ err = memFullErr;
#else
- FSSpec fs;
- char *buf;
+ FSSpec fs;
+ char *buf;
- buf = xmalloc (data_size + 1);
- if (buf)
- {
- memcpy (buf, data_ptr, data_size);
- buf[data_size] = '\0';
- err = posix_pathname_to_fsspec (buf, &fs);
- xfree (buf);
- }
- else
- err = memFullErr;
- if (err == noErr)
- err = AECoercePtr (typeFSS, &fs, sizeof (FSSpec),
- to_type, result);
-#endif
+ buf = xmalloc (data_size + 1);
+ if (buf)
+ {
+ memcpy (buf, data_ptr, data_size);
+ buf[data_size] = '\0';
+ err = posix_pathname_to_fsspec (buf, &fs);
+ xfree (buf);
}
- break;
-
- case TYPE_FILE_NAME:
- case typeWildCard:
- err = AECreateDesc (TYPE_FILE_NAME, data_ptr, data_size, result);
- break;
-
- default:
- err = errAECoercionFail;
- break;
- }
+ else
+ err = memFullErr;
+ if (err == noErr)
+ err = AECoercePtr (typeFSS, &fs, sizeof (FSSpec), to_type, result);
+#endif
+ }
else if (to_type == TYPE_FILE_NAME)
/* Coercion to undecoded file name. */
- switch (type_code)
- {
- case typeAlias:
- case typeFSS:
- case typeFSRef:
+ {
#ifdef MAC_OSX
- case typeFileURL:
-#endif
+ CFURLRef url = NULL;
+ CFStringRef str = NULL;
+ CFDataRef data = NULL;
+
+ if (type_code == typeFileURL)
+ url = CFURLCreateWithBytes (NULL, data_ptr, data_size,
+ kCFStringEncodingUTF8, NULL);
+ else
{
AEDesc desc;
-#ifdef MAC_OSX
Size size;
char *buf;
- CFURLRef url = NULL;
- CFStringRef str = NULL;
- CFDataRef data = NULL;
err = AECoercePtr (type_code, data_ptr, data_size,
typeFileURL, &desc);
@@ -513,33 +495,37 @@ mac_coerce_file_name_ptr (type_code, data_ptr, data_size,
}
AEDisposeDesc (&desc);
}
- if (url)
- {
- str = CFURLCopyFileSystemPath (url, kCFURLPOSIXPathStyle);
- CFRelease (url);
- }
- if (str)
- {
- data =
- CFStringCreateExternalRepresentation (NULL, str,
- kCFStringEncodingUTF8,
- '\0');
- CFRelease (str);
- }
- if (data)
- {
- err = AECreateDesc (TYPE_FILE_NAME, CFDataGetBytePtr (data),
- CFDataGetLength (data), result);
- CFRelease (data);
- }
- else
- err = memFullErr;
+ }
+ if (url)
+ {
+ str = CFURLCopyFileSystemPath (url, kCFURLPOSIXPathStyle);
+ CFRelease (url);
+ }
+ if (str)
+ {
+ data = CFStringCreateExternalRepresentation (NULL, str,
+ kCFStringEncodingUTF8,
+ '\0');
+ CFRelease (str);
+ }
+ if (data)
+ {
+ err = AECreateDesc (TYPE_FILE_NAME, CFDataGetBytePtr (data),
+ CFDataGetLength (data), result);
+ CFRelease (data);
+ }
#else
+ char file_name[MAXPATHLEN];
+
+ if (type_code == typeFSS && data_size == sizeof (FSSpec))
+ err = fsspec_to_posix_pathname (data_ptr, file_name,
+ sizeof (file_name) - 1);
+ else
+ {
+ AEDesc desc;
FSSpec fs;
- char file_name[MAXPATHLEN];
- err = AECoercePtr (type_code, data_ptr, data_size,
- typeFSS, &desc);
+ err = AECoercePtr (type_code, data_ptr, data_size, typeFSS, &desc);
if (err == noErr)
{
#if TARGET_API_MAC_CARBON
@@ -550,19 +536,14 @@ mac_coerce_file_name_ptr (type_code, data_ptr, data_size,
if (err == noErr)
err = fsspec_to_posix_pathname (&fs, file_name,
sizeof (file_name) - 1);
- if (err == noErr)
- err = AECreateDesc (TYPE_FILE_NAME, file_name,
- strlen (file_name), result);
AEDisposeDesc (&desc);
}
-#endif
}
- break;
-
- default:
- err = errAECoercionFail;
- break;
- }
+ if (err == noErr)
+ err = AECreateDesc (TYPE_FILE_NAME, file_name,
+ strlen (file_name), result);
+#endif
+ }
else
abort ();
@@ -581,31 +562,9 @@ mac_coerce_file_name_desc (from_desc, to_type, handler_refcon, result)
OSErr err = noErr;
DescType from_type = from_desc->descriptorType;
- if (from_type == TYPE_FILE_NAME)
- {
- if (to_type != TYPE_FILE_NAME && to_type != typeWildCard
- && to_type != typeAlias && to_type != typeFSS
- && to_type != typeFSRef
-#ifdef MAC_OSX
- && to_type != typeFileURL
-#endif
- )
- return errAECoercionFail;
- }
- else if (to_type == TYPE_FILE_NAME)
- {
- if (from_type != typeAlias && from_type != typeFSS
- && from_type != typeFSRef
-#ifdef MAC_OSX
- && from_type != typeFileURL
-#endif
- )
- return errAECoercionFail;
- }
- else
- abort ();
-
- if (from_type == to_type || to_type == typeWildCard)
+ if (from_type == typeNull)
+ err = errAECoercionFail;
+ else if (from_type == to_type || to_type == typeWildCard)
err = AEDuplicateDesc (from_desc, result);
else
{
diff --git a/src/macfns.c b/src/macfns.c
index 4ede8b7971b..110b697ce5e 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -2880,24 +2880,37 @@ If omitted or nil, that stands for the selected frame's display. */)
(display)
Lisp_Object display;
{
- int mac_major_version;
- SInt32 response;
+ UInt32 response, major, minor, bugfix;
OSErr err;
BLOCK_INPUT;
err = Gestalt (gestaltSystemVersion, &response);
+ if (err == noErr)
+ if (response >= 0x00001040)
+ {
+ err = Gestalt ('sys1', &major); /* gestaltSystemVersionMajor */
+ if (err == noErr)
+ err = Gestalt ('sys2', &minor); /* gestaltSystemVersionMinor */
+ if (err == noErr)
+ err = Gestalt ('sys3', &bugfix); /* gestaltSystemVersionBugFix */
+ }
+ else
+ {
+ bugfix = response & 0xf;
+ response >>= 4;
+ minor = response & 0xf;
+ response >>= 4;
+ /* convert BCD to int */
+ major = response - (response >> 4) * 6;
+ }
UNBLOCK_INPUT;
if (err != noErr)
error ("Cannot get Mac OS version");
- mac_major_version = (response >> 8) & 0xff;
- /* convert BCD to int */
- mac_major_version -= (mac_major_version >> 4) * 6;
-
- return Fcons (make_number (mac_major_version),
- Fcons (make_number ((response >> 4) & 0xf),
- Fcons (make_number (response & 0xf),
+ return Fcons (make_number (major),
+ Fcons (make_number (minor),
+ Fcons (make_number (bugfix),
Qnil)));
}
diff --git a/src/process.c b/src/process.c
index e869456e5c8..05ea7c863b0 100644
--- a/src/process.c
+++ b/src/process.c
@@ -118,6 +118,14 @@ Boston, MA 02110-1301, USA. */
#include <sys/wait.h>
#endif
+/* Disable IPv6 support for w32 until someone figures out how to do it
+ properly. */
+#ifdef WINDOWSNT
+# ifdef AF_INET6
+# undef AF_INET6
+# endif
+#endif
+
#include "lisp.h"
#include "systime.h"
#include "systty.h"
@@ -140,7 +148,10 @@ Boston, MA 02110-1301, USA. */
Lisp_Object Qprocessp;
Lisp_Object Qrun, Qstop, Qsignal;
Lisp_Object Qopen, Qclosed, Qconnect, Qfailed, Qlisten;
-Lisp_Object Qlocal, Qdatagram;
+Lisp_Object Qlocal, Qipv4, Qdatagram;
+#ifdef AF_INET6
+Lisp_Object Qipv6;
+#endif
Lisp_Object QCname, QCbuffer, QChost, QCservice, QCtype;
Lisp_Object QClocal, QCremote, QCcoding;
Lisp_Object QCserver, QCnowait, QCnoquery, QCstop;
@@ -1195,9 +1206,11 @@ a socket connection. */)
DEFUN ("format-network-address", Fformat_network_address, Sformat_network_address,
1, 2, 0,
doc: /* Convert network ADDRESS from internal format to a string.
+A 4 or 5 element vector represents an IPv4 address (with port number).
+An 8 or 9 element vector represents an IPv6 address (with port number).
If optional second argument OMIT-PORT is non-nil, don't include a port
-number in the string; in this case, interpret a 4 element vector as an
-IP address. Returns nil if format of ADDRESS is invalid. */)
+number in the string, even when present in ADDRESS.
+Returns nil if format of ADDRESS is invalid. */)
(address, omit_port)
Lisp_Object address, omit_port;
{
@@ -1207,13 +1220,13 @@ IP address. Returns nil if format of ADDRESS is invalid. */)
if (STRINGP (address)) /* AF_LOCAL */
return address;
- if (VECTORP (address)) /* AF_INET */
+ if (VECTORP (address)) /* AF_INET or AF_INET6 */
{
register struct Lisp_Vector *p = XVECTOR (address);
Lisp_Object args[6];
int nargs, i;
- if (!NILP (omit_port) && (p->size == 4 || p->size == 5))
+ if (p->size == 4 || (p->size == 5 && !NILP (omit_port)))
{
args[0] = build_string ("%d.%d.%d.%d");
nargs = 4;
@@ -1223,6 +1236,16 @@ IP address. Returns nil if format of ADDRESS is invalid. */)
args[0] = build_string ("%d.%d.%d.%d:%d");
nargs = 5;
}
+ else if (p->size == 8 || (p->size == 9 && !NILP (omit_port)))
+ {
+ args[0] = build_string ("%x:%x:%x:%x:%x:%x:%x:%x");
+ nargs = 8;
+ }
+ else if (p->size == 9)
+ {
+ args[0] = build_string ("[%x:%x:%x:%x:%x:%x:%x:%x]:%d");
+ nargs = 9;
+ }
else
return Qnil;
@@ -2212,6 +2235,20 @@ conv_sockaddr_to_lisp (sa, len)
cp = (unsigned char *)&sin->sin_addr;
break;
}
+#ifdef AF_INET6
+ case AF_INET6:
+ {
+ struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) sa;
+ uint16_t *ip6 = (uint16_t *)&sin6->sin6_addr;
+ len = sizeof (sin6->sin6_addr)/2 + 1;
+ address = Fmake_vector (make_number (len), Qnil);
+ p = XVECTOR (address);
+ p->contents[--len] = make_number (ntohs (sin6->sin6_port));
+ for (i = 0; i < len; i++)
+ p->contents[i] = make_number (ntohs (ip6[i]));
+ return address;
+ }
+#endif
#ifdef HAVE_LOCAL_SOCKETS
case AF_LOCAL:
{
@@ -2256,6 +2293,13 @@ get_lisp_to_sockaddr_size (address, familyp)
*familyp = AF_INET;
return sizeof (struct sockaddr_in);
}
+#ifdef AF_INET6
+ else if (p->size == 9)
+ {
+ *familyp = AF_INET6;
+ return sizeof (struct sockaddr_in6);
+ }
+#endif
}
#ifdef HAVE_LOCAL_SOCKETS
else if (STRINGP (address))
@@ -2302,6 +2346,23 @@ conv_lisp_to_sockaddr (family, address, sa, len)
sin->sin_port = htons (i);
cp = (unsigned char *)&sin->sin_addr;
}
+#ifdef AF_INET6
+ else if (family == AF_INET6)
+ {
+ struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) sa;
+ uint16_t *ip6 = (uint16_t *)&sin6->sin6_addr;
+ len = sizeof (sin6->sin6_addr) + 1;
+ i = XINT (p->contents[--len]);
+ sin6->sin6_port = htons (i);
+ for (i = 0; i < len; i++)
+ if (INTEGERP (p->contents[i]))
+ {
+ int j = XFASTINT (p->contents[i]) & 0xffff;
+ ip6[i] = ntohs (j);
+ }
+ return;
+ }
+#endif
}
else if (STRINGP (address))
{
@@ -2595,10 +2656,13 @@ a random port number is selected for the server.
stream type connection, `datagram' creates a datagram type connection.
:family FAMILY -- FAMILY is the address (and protocol) family for the
-service specified by HOST and SERVICE. The default address family is
-Inet (or IPv4) for the host and port number specified by HOST and
-SERVICE. Other address families supported are:
+service specified by HOST and SERVICE. The default (nil) is to use
+whatever address family (IPv4 or IPv6) that is defined for the host
+and port number specified by HOST and SERVICE. Other address families
+supported are:
local -- for a local (i.e. UNIX) address specified by SERVICE.
+ ipv4 -- use IPv4 address family only.
+ ipv6 -- use IPv6 address family only.
:local ADDRESS -- ADDRESS is the local address used for the connection.
This parameter is ignored when opening a client process. When specified
@@ -2715,8 +2779,8 @@ usage: (make-network-process &rest ARGS) */)
struct Lisp_Process *p;
#ifdef HAVE_GETADDRINFO
struct addrinfo ai, *res, *lres;
- struct addrinfo hints;
- char *portstring, portbuf[128];
+ struct addrinfo hints;
+ char *portstring, portbuf[128];
#else /* HAVE_GETADDRINFO */
struct _emacs_addrinfo
{
@@ -2855,19 +2919,29 @@ usage: (make-network-process &rest ARGS) */)
/* :family FAMILY -- nil (for Inet), local, or integer. */
tem = Fplist_get (contact, QCfamily);
- if (INTEGERP (tem))
- family = XINT (tem);
- else
+ if (NILP (tem))
{
- if (NILP (tem))
- family = AF_INET;
-#ifdef HAVE_LOCAL_SOCKETS
- else if (EQ (tem, Qlocal))
- family = AF_LOCAL;
+#if defined(HAVE_GETADDRINFO) && defined(AF_INET6)
+ family = AF_UNSPEC;
+#else
+ family = AF_INET;
#endif
}
- if (family < 0)
+#ifdef HAVE_LOCAL_SOCKETS
+ else if (EQ (tem, Qlocal))
+ family = AF_LOCAL;
+#endif
+#ifdef AF_INET6
+ else if (EQ (tem, Qipv6))
+ family = AF_INET6;
+#endif
+ else if (EQ (tem, Qipv4))
+ family = AF_INET;
+ else if (INTEGERP (tem))
+ family = XINT (tem);
+ else
error ("Unknown address family");
+
ai.ai_family = family;
/* :service SERVICE -- string, integer (port number), or t (random port). */
@@ -2933,7 +3007,7 @@ usage: (make-network-process &rest ARGS) */)
QUIT;
memset (&hints, 0, sizeof (hints));
hints.ai_flags = 0;
- hints.ai_family = NILP (Fplist_member (contact, QCfamily)) ? AF_UNSPEC : family;
+ hints.ai_family = family;
hints.ai_socktype = socktype;
hints.ai_protocol = 0;
ret = getaddrinfo (SDATA (host), portstring, &hints, &res);
@@ -3522,6 +3596,21 @@ static struct ifflag_def ifflag_table[] = {
#ifdef IFF_DYNAMIC
{ IFF_DYNAMIC, "dynamic" },
#endif
+#ifdef IFF_OACTIV
+ { IFF_OACTIV, "oactiv" }, /* OpenBSD: transmission in progress */
+#endif
+#ifdef IFF_SIMPLEX
+ { IFF_SIMPLEX, "simplex" }, /* OpenBSD: can't hear own transmissions */
+#endif
+#ifdef IFF_LINK0
+ { IFF_LINK0, "link0" }, /* OpenBSD: per link layer defined bit */
+#endif
+#ifdef IFF_LINK1
+ { IFF_LINK1, "link1" }, /* OpenBSD: per link layer defined bit */
+#endif
+#ifdef IFF_LINK2
+ { IFF_LINK2, "link2" }, /* OpenBSD: per link layer defined bit */
+#endif
{ 0, 0 }
};
@@ -3816,6 +3905,9 @@ server_accept_connection (server, channel)
union u_sockaddr {
struct sockaddr sa;
struct sockaddr_in in;
+#ifdef AF_INET6
+ struct sockaddr_in6 in6;
+#endif
#ifdef HAVE_LOCAL_SOCKETS
struct sockaddr_un un;
#endif
@@ -3872,6 +3964,26 @@ server_accept_connection (server, channel)
}
break;
+#ifdef AF_INET6
+ case AF_INET6:
+ {
+ Lisp_Object args[9];
+ uint16_t *ip6 = (uint16_t *)&saddr.in6.sin6_addr;
+ int i;
+ args[0] = build_string ("%x:%x:%x:%x:%x:%x:%x:%x");
+ for (i = 0; i < 8; i++)
+ args[i+1] = make_number (ntohs(ip6[i]));
+ host = Fformat (9, args);
+ service = make_number (ntohs (saddr.in.sin_port));
+
+ args[0] = build_string (" <[%s]:%d>");
+ args[1] = host;
+ args[2] = service;
+ caller = Fformat (3, args);
+ }
+ break;
+#endif
+
#ifdef HAVE_LOCAL_SOCKETS
case AF_LOCAL:
#endif
@@ -6721,6 +6833,10 @@ init_process ()
#ifdef HAVE_LOCAL_SOCKETS
ADD_SUBFEATURE (QCfamily, Qlocal);
#endif
+ ADD_SUBFEATURE (QCfamily, Qipv4);
+#ifdef AF_INET6
+ ADD_SUBFEATURE (QCfamily, Qipv6);
+#endif
#ifdef HAVE_GETSOCKNAME
ADD_SUBFEATURE (QCservice, Qt);
#endif
@@ -6779,6 +6895,12 @@ syms_of_process ()
staticpro (&Qlisten);
Qlocal = intern ("local");
staticpro (&Qlocal);
+ Qipv4 = intern ("ipv4");
+ staticpro (&Qipv4);
+#ifdef AF_INET6
+ Qipv6 = intern ("ipv6");
+ staticpro (&Qipv6);
+#endif
Qdatagram = intern ("datagram");
staticpro (&Qdatagram);
diff --git a/src/window.h b/src/window.h
index cb819990258..03f416aa9bc 100644
--- a/src/window.h
+++ b/src/window.h
@@ -1,6 +1,6 @@
/* Window definitions for GNU Emacs.
Copyright (C) 1985, 1986, 1993, 1995, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -865,6 +865,7 @@ extern Lisp_Object Vwindow_list;
EXFUN (Fwindow_end, 2);
EXFUN (Fselected_window, 0);
+EXFUN (Fwindow_minibuffer_p, 1);
EXFUN (Fdelete_window, 1);
EXFUN (Fwindow_buffer, 1);
EXFUN (Fget_buffer_window, 2);