/* MS-DOS specific C utilities. -*- coding: raw-text -*-
- Copyright (C) 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
- Free Software Foundation, Inc.
+
+Copyright (C) 1993-1997, 1999-2011 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include <signal.h>
#include "syssignal.h"
+#include "careadlinkat.h"
+#include "allocator.h"
+
#ifndef SYSTEM_MALLOC
#ifdef GNU_MALLOC
void
mouse_get_pos (FRAME_PTR *f, int insist, Lisp_Object *bar_window,
enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y,
- unsigned long *time)
+ Time *time)
{
int ix, iy;
Lisp_Object frame, tail;
/* Segment and offset of the virtual screen. If 0, DOS/V is NOT loaded. */
static unsigned short screen_virtual_segment = 0;
static unsigned short screen_virtual_offset = 0;
-/* A flag to control how to display unibyte 8-bit characters. */
-extern int unibyte_display_via_language_environment;
-
extern Lisp_Object Qcursor_type;
extern Lisp_Object Qbar, Qhbar;
if (current_rows != *rows || current_cols != *cols)
{
struct frame *f = SELECTED_FRAME();
- struct tty_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
- Lisp_Object window = dpyinfo->mouse_face_window;
+ Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
+ Lisp_Object window = hlinfo->mouse_face_window;
if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f)
{
- dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1;
- dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1;
- dpyinfo->mouse_face_window = Qnil;
+ hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
+ hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
+ hlinfo->mouse_face_window = Qnil;
}
}
/* According to RBIL (INTERRUP.A, V-1000), 160 is the maximum possible
width of a DOS display in any known text mode. We multiply by 2 to
- accomodate the screen attribute byte. */
+ accommodate the screen attribute byte. */
#define MAX_SCREEN_BUF 160*2
-Lisp_Object Vdos_unsupported_char_glyph;
extern unsigned char *encode_terminal_code (struct glyph *, int,
struct coding_system *);
+
static void
IT_write_glyphs (struct frame *f, struct glyph *str, int str_len)
{
}
/* Draw TEXT_AREA glyphs between START and END of glyph row ROW on
- window W, starting at x-position X. X is relative to TEXT_AREA
- in W. HL is a face override for drawing the glyphs. */
+ window W. X is relative to TEXT_AREA in W. HL is a face override
+ for drawing the glyphs. */
void
-draw_row_with_mouse_face (struct window *w, int x, struct glyph_row *row,
- int start_hpos, int end_hpos,
- enum draw_glyphs_face hl)
+tty_draw_row_with_mouse_face (struct window *w, struct glyph_row *row,
+ int start_hpos, int end_hpos,
+ enum draw_glyphs_face hl)
{
struct frame *f = XFRAME (WINDOW_FRAME (w));
struct tty_display_info *tty = FRAME_TTY (f);
+ Mouse_HLInfo *hlinfo = &tty->mouse_highlight;
if (hl == DRAW_MOUSE_FACE)
{
kstart, kstart + nglyphs - 1, vpos);
mouse_off ();
- IT_set_face (tty->mouse_face_face_id);
+ IT_set_face (hlinfo->mouse_face_face_id);
/* Since we are going to change only the _colors_ of already
displayed text, there's no need to go through all the pain of
generating and encoding the text from the glyphs. Instead,
IT_update_begin (struct frame *f)
{
struct tty_display_info *display_info = FRAME_X_DISPLAY_INFO (f);
- struct frame *mouse_face_frame = display_info->mouse_face_mouse_frame;
+ Mouse_HLInfo *hlinfo = &display_info->mouse_highlight;
+ struct frame *mouse_face_frame = hlinfo->mouse_face_mouse_frame;
if (display_info->termscript)
fprintf (display_info->termscript, "\n\n<UPDATE_BEGIN");
if (f && f == mouse_face_frame)
{
/* Don't do highlighting for mouse motion during the update. */
- display_info->mouse_face_defer = 1;
+ hlinfo->mouse_face_defer = 1;
/* If F needs to be redrawn, simply forget about any prior mouse
highlighting. */
if (FRAME_GARBAGED_P (f))
- display_info->mouse_face_window = Qnil;
+ hlinfo->mouse_face_window = Qnil;
/* Can we tell that this update does not affect the window
where the mouse highlight is? If so, no need to turn off.
Likewise, don't do anything if none of the enabled rows
contains glyphs highlighted in mouse face. */
- if (!NILP (display_info->mouse_face_window)
- && WINDOWP (display_info->mouse_face_window))
+ if (!NILP (hlinfo->mouse_face_window)
+ && WINDOWP (hlinfo->mouse_face_window))
{
- struct window *w = XWINDOW (display_info->mouse_face_window);
+ struct window *w = XWINDOW (hlinfo->mouse_face_window);
int i;
/* If the mouse highlight is in the window that was deleted
(e.g., if it was popped by completion), clear highlight
unconditionally. */
if (NILP (w->buffer))
- display_info->mouse_face_window = Qnil;
+ hlinfo->mouse_face_window = Qnil;
else
{
for (i = 0; i < w->desired_matrix->nrows; ++i)
}
if (NILP (w->buffer) || i < w->desired_matrix->nrows)
- clear_mouse_face (display_info);
+ clear_mouse_face (hlinfo);
}
}
else if (mouse_face_frame && !FRAME_LIVE_P (mouse_face_frame))
{
/* If the frame with mouse highlight was deleted, invalidate the
highlight info. */
- display_info->mouse_face_beg_row = display_info->mouse_face_beg_col = -1;
- display_info->mouse_face_end_row = display_info->mouse_face_end_col = -1;
- display_info->mouse_face_window = Qnil;
- display_info->mouse_face_deferred_gc = 0;
- display_info->mouse_face_mouse_frame = NULL;
+ hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
+ hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
+ hlinfo->mouse_face_window = Qnil;
+ hlinfo->mouse_face_deferred_gc = 0;
+ hlinfo->mouse_face_mouse_frame = NULL;
}
UNBLOCK_INPUT;
if (dpyinfo->termscript)
fprintf (dpyinfo->termscript, "\n<UPDATE_END\n");
- dpyinfo->mouse_face_defer = 0;
+ dpyinfo->mouse_highlight.mouse_face_defer = 0;
}
static void
IT_frame_up_to_date (struct frame *f)
{
- struct tty_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+ Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
Lisp_Object new_cursor, frame_desired_cursor;
struct window *sw;
- if (dpyinfo->mouse_face_deferred_gc
- || (f && f == dpyinfo->mouse_face_mouse_frame))
+ if (hlinfo->mouse_face_deferred_gc
+ || (f && f == hlinfo->mouse_face_mouse_frame))
{
BLOCK_INPUT;
- if (dpyinfo->mouse_face_mouse_frame)
- note_mouse_highlight (dpyinfo->mouse_face_mouse_frame,
- dpyinfo->mouse_face_mouse_x,
- dpyinfo->mouse_face_mouse_y);
- dpyinfo->mouse_face_deferred_gc = 0;
+ if (hlinfo->mouse_face_mouse_frame)
+ note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
+ hlinfo->mouse_face_mouse_x,
+ hlinfo->mouse_face_mouse_y);
+ hlinfo->mouse_face_deferred_gc = 0;
UNBLOCK_INPUT;
}
{
struct buffer *b = XBUFFER (sw->buffer);
- if (EQ (b->cursor_type, Qt))
+ if (EQ (BVAR (b,cursor_type), Qt))
new_cursor = frame_desired_cursor;
- else if (NILP (b->cursor_type)) /* nil means no cursor */
+ else if (NILP (BVAR (b, cursor_type))) /* nil means no cursor */
new_cursor = Fcons (Qbar, make_number (0));
else
- new_cursor = b->cursor_type;
+ new_cursor = BVAR (b, cursor_type);
}
IT_set_cursor_type (f, new_cursor);
void
x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
{
- extern void set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
-
set_menu_bar_lines (f, value, oldval);
}
}
tty = FRAME_TTY (sf);
- current_kboard->Vwindow_system = Qpc;
+ KVAR (current_kboard, Vwindow_system) = Qpc;
sf->output_method = output_msdos_raw;
if (init_needed)
{
if (colors[1] >= 0 && colors[1] < 16)
FRAME_BACKGROUND_PIXEL (SELECTED_FRAME ()) = colors[1];
}
- the_only_display_info.mouse_face_mouse_frame = NULL;
- the_only_display_info.mouse_face_deferred_gc = 0;
- the_only_display_info.mouse_face_beg_row =
- the_only_display_info.mouse_face_beg_col = -1;
- the_only_display_info.mouse_face_end_row =
- the_only_display_info.mouse_face_end_col = -1;
- the_only_display_info.mouse_face_face_id = DEFAULT_FACE_ID;
- the_only_display_info.mouse_face_window = Qnil;
- the_only_display_info.mouse_face_mouse_x =
- the_only_display_info.mouse_face_mouse_y = 0;
- the_only_display_info.mouse_face_defer = 0;
- the_only_display_info.mouse_face_hidden = 0;
+ the_only_display_info.mouse_highlight.mouse_face_mouse_frame = NULL;
+ the_only_display_info.mouse_highlight.mouse_face_deferred_gc = 0;
+ the_only_display_info.mouse_highlight.mouse_face_beg_row =
+ the_only_display_info.mouse_highlight.mouse_face_beg_col = -1;
+ the_only_display_info.mouse_highlight.mouse_face_end_row =
+ the_only_display_info.mouse_highlight.mouse_face_end_col = -1;
+ the_only_display_info.mouse_highlight.mouse_face_face_id = DEFAULT_FACE_ID;
+ the_only_display_info.mouse_highlight.mouse_face_window = Qnil;
+ the_only_display_info.mouse_highlight.mouse_face_mouse_x =
+ the_only_display_info.mouse_highlight.mouse_face_mouse_y = 0;
+ the_only_display_info.mouse_highlight.mouse_face_defer = 0;
+ the_only_display_info.mouse_highlight.mouse_face_hidden = 0;
if (have_mouse) /* detected in dos_ttraw, which see */
{
{
struct input_event event;
union REGS regs;
- struct tty_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (SELECTED_FRAME());
+ Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (SELECTED_FRAME());
EVENT_INIT (event);
#ifndef HAVE_X_WINDOWS
if (code == 0)
continue;
- if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight))
+ if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight))
{
- clear_mouse_face (dpyinfo);
- dpyinfo->mouse_face_hidden = 1;
+ clear_mouse_face (hlinfo);
+ hlinfo->mouse_face_hidden = 1;
}
if (code >= 0x100)
might need to update mouse highlight. */
if (mouse_last_x != mouse_prev_x || mouse_last_y != mouse_prev_y)
{
- if (dpyinfo->mouse_face_hidden)
+ if (hlinfo->mouse_face_hidden)
{
- dpyinfo->mouse_face_hidden = 0;
- clear_mouse_face (dpyinfo);
+ hlinfo->mouse_face_hidden = 0;
+ clear_mouse_face (hlinfo);
}
/* Generate SELECT_WINDOW_EVENTs when needed. */
mouse_window = window_from_coordinates (SELECTED_FRAME(),
mouse_last_x,
mouse_last_y,
- 0, 0, 0, 0);
+ 0, 0);
/* A window will be selected only when it is not
selected now, and the last mouse movement event was
not in it. A minibuffer window will be selected iff
/* If the contents of the global variable help_echo has
changed, generate a HELP_EVENT. */
if (!NILP (help_echo_string) || !NILP (previous_help_echo_string))
- {
- event.kind = HELP_EVENT;
- event.frame_or_window = selected_frame;
- event.arg = help_echo_object;
- event.x = WINDOWP (help_echo_window)
- ? help_echo_window : selected_frame;
- event.y = help_echo_string;
- event.timestamp = event_timestamp ();
- event.code = help_echo_pos;
- kbd_buffer_store_event (&event);
- }
+ gen_help_event (help_echo_string, selected_frame, help_echo_window,
+ help_echo_object, help_echo_pos);
}
for (but = 0; but < NUM_MOUSE_BUTTONS; but++)
left), but I don't think it's worth the effort. */
/* These hold text of the current and the previous menu help messages. */
-static char *menu_help_message, *prev_menu_help_message;
+static const char *menu_help_message, *prev_menu_help_message;
/* Pane number and item number of the menu item which generated the
last menu help message. */
static int menu_help_paneno, menu_help_itemno;
menu->text = (char **) xmalloc (count * sizeof (char *));
menu->submenu = (XMenu **) xmalloc (count * sizeof (XMenu *));
menu->panenumber = (int *) xmalloc (count * sizeof (int));
- menu->help_text = (char **) xmalloc (count * sizeof (char *));
+ menu->help_text = (const char **) xmalloc (count * sizeof (char *));
}
else if (menu->allocated == menu->count)
{
menu->panenumber
= (int *) xrealloc (menu->panenumber, count * sizeof (int));
menu->help_text
- = (char **) xrealloc (menu->help_text, count * sizeof (char *));
+ = (const char **) xrealloc (menu->help_text, count * sizeof (char *));
}
}
to do. */
int
-XMenuAddPane (Display *foo, XMenu *menu, char *txt, int enable)
+XMenuAddPane (Display *foo, XMenu *menu, const char *txt, int enable)
{
int len;
- char *p;
+ const char *p;
if (!enable)
abort ();
IT_menu_make_room (menu);
menu->submenu[menu->count] = IT_menu_create ();
- menu->text[menu->count] = txt;
+ menu->text[menu->count] = (char *)txt;
menu->panenumber[menu->count] = ++menu->panecount;
menu->help_text[menu->count] = NULL;
menu->count++;
int
XMenuAddSelection (Display *bar, XMenu *menu, int pane,
- int foo, char *txt, int enable, char *help_text)
+ int foo, char *txt, int enable, char const *help_text)
{
int len;
char *p;
int
XMenuActivate (Display *foo, XMenu *menu, int *pane, int *selidx,
int x0, int y0, unsigned ButtonMask, char **txt,
- void (*help_callback)(char *, int, int))
+ void (*help_callback)(char const *, int, int))
{
struct IT_menu_state *state;
int statecount, x, y, i, b, screensize, leave, result, onepane;
*/
int setpgrp (void) {return 0; }
int setpriority (int x, int y, int z) { return 0; }
+
+#if __DJGPP__ == 2 && __DJGPP_MINOR__ < 4
+ssize_t
+readlink (const char *name, char *dummy1, size_t dummy2)
+{
+ /* `access' is much faster than `stat' on MS-DOS. */
+ if (access (name, F_OK) == 0)
+ errno = EINVAL;
+ return -1;
+}
+#endif
+
+char *
+careadlinkat (int fd, char const *filename,
+ char *buffer, size_t buffer_size,
+ struct allocator const *alloc,
+ ssize_t (*preadlinkat) (int, char const *, char *, size_t))
+{
+ if (!buffer)
+ {
+ /* We don't support the fancy auto-allocation feature. */
+ if (!buffer_size)
+ errno = ENOSYS;
+ else
+ errno = EINVAL;
+ buffer = NULL;
+ }
+ else
+ {
+ ssize_t len = preadlinkat (fd, filename, buffer, buffer_size);
+
+ if (len < 0 || len == buffer_size)
+ buffer = NULL;
+ else
+ buffer[len + 1] = '\0';
+ }
+ return buffer;
+}
+
+ssize_t
+careadlinkatcwd (int fd, char const *filename, char *buffer,
+ size_t buffer_size)
+{
+ (void) fd;
+ return readlink (filename, buffer, buffer_size);
+}
+
\f
#if __DJGPP__ == 2 && __DJGPP_MINOR__ < 2
Qreverse = intern_c_string ("reverse");
staticpro (&Qreverse);
- DEFVAR_LISP ("dos-unsupported-char-glyph", &Vdos_unsupported_char_glyph,
+ DEFVAR_LISP ("dos-unsupported-char-glyph", Vdos_unsupported_char_glyph,
doc: /* *Glyph to display instead of chars not supported by current codepage.
This variable is used only by MS-DOS terminals. */);
Vdos_unsupported_char_glyph = make_number ('\177');
}
#endif /* MSDOS */
-
-/* arch-tag: db404e92-52a5-475f-9eb2-1cb78dd05f30
- (do not change this comment) */