precompiled header Carbon.h. */
#undef max
#undef min
+#undef init_process
#include <Carbon/Carbon.h>
#undef Z
#define Z (current_buffer->text->z)
#define min(a, b) ((a) < (b) ? (a) : (b))
#undef max
#define max(a, b) ((a) > (b) ? (a) : (b))
-#else /* not MAC_OSX */
+#undef init_process
+#define init_process emacs_init_process
+#else /* not MAC_OSX */
#include <Windows.h>
#include <Gestalt.h>
#include <TextUtils.h>
{
if (dpyinfo->bitmaps[id].refcount
&& dpyinfo->bitmaps[id].file
- && !strcmp (dpyinfo->bitmaps[id].file, (char *) XSTRING (file)->data))
+ && !strcmp (dpyinfo->bitmaps[id].file, (char *) SDATA (file)))
{
++dpyinfo->bitmaps[id].refcount;
return id + 1;
return -1;
emacs_close (fd);
- filename = (char *) XSTRING (found)->data;
+ filename = (char *) SDATA (found);
hinst = LoadLibraryEx (filename, NULL, LOAD_LIBRARY_AS_DATAFILE);
id = x_allocate_bitmap_record (f);
dpyinfo->bitmaps[id - 1].pixmap = bitmap;
dpyinfo->bitmaps[id - 1].refcount = 1;
- dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (XSTRING (file)->size + 1);
+ dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (SCHARS (file) + 1);
dpyinfo->bitmaps[id - 1].depth = 1;
dpyinfo->bitmaps[id - 1].height = height;
dpyinfo->bitmaps[id - 1].width = width;
- strcpy (dpyinfo->bitmaps[id - 1].file, XSTRING (file)->data);
+ strcpy (dpyinfo->bitmaps[id - 1].file, SDATA (file));
return id;
#endif /* MAC_TODO */
CHECK_STRING (arg);
- if (strcmp (XSTRING (arg)->data, "black") == 0)
+ if (strcmp (SDATA (arg), "black") == 0)
return BLACK_PIX_DEFAULT (f);
- else if (strcmp (XSTRING (arg)->data, "white") == 0)
+ else if (strcmp (SDATA (arg), "white") == 0)
return WHITE_PIX_DEFAULT (f);
#if 0
return def;
#endif
- if (mac_defined_color (f, XSTRING (arg)->data, &cdef, 1))
+ if (mac_defined_color (f, SDATA (arg), &cdef, 1))
return cdef.pixel;
/* defined_color failed; return an ultimate default. */
BLOCK_INPUT;
result = x_text_icon (f,
- (char *) XSTRING ((!NILP (f->icon_name)
- ? f->icon_name
- : !NILP (f->title)
- ? f->title
- : f->name))->data);
+ (char *) SDATA ((!NILP (f->icon_name)
+ ? f->icon_name
+ : !NILP (f->title)
+ ? f->title
+ : f->name)));
if (result)
{
BLOCK_INPUT;
result = (STRINGP (fontset_name)
- ? x_new_fontset (f, XSTRING (fontset_name)->data)
- : x_new_font (f, XSTRING (arg)->data));
+ ? x_new_fontset (f, SDATA (fontset_name))
+ : x_new_font (f, SDATA (arg)));
UNBLOCK_INPUT;
if (EQ (result, Qnil))
- error ("Font `%s' is not defined", XSTRING (arg)->data);
+ error ("Font `%s' is not defined", SDATA (arg));
else if (EQ (result, Qt))
error ("The characters of the given font have varying widths");
else if (STRINGP (result))
/* Check for no change needed in this very common case
before we do any consing. */
if (!strcmp (FRAME_MAC_DISPLAY_INFO (f)->mac_id_name,
- XSTRING (f->name)->data))
+ SDATA (f->name)))
return;
name = build_string (FRAME_MAC_DISPLAY_INFO (f)->mac_id_name);
}
{
Str255 windowTitle;
- if (strlen (XSTRING (name)->data) < 255)
+ if (strlen (SDATA (name)) < 255)
{
- strcpy (windowTitle, XSTRING (name)->data);
+ strcpy (windowTitle, SDATA (name));
c2pstr (windowTitle);
SetWTitle (FRAME_MAC_WINDOW (f), windowTitle);
}
{
Str255 windowTitle;
- if (strlen (XSTRING (name)->data) < 255)
+ if (strlen (SDATA (name)) < 255)
{
- strcpy (windowTitle, XSTRING (name)->data);
+ strcpy (windowTitle, SDATA (name));
c2pstr (windowTitle);
SetWTitle (FRAME_MAC_WINDOW (f), windowTitle);
}
if (STRINGP (Vx_resource_name))
{
- unsigned char *p = XSTRING (Vx_resource_name)->data;
+ unsigned char *p = SDATA (Vx_resource_name);
int i;
- len = STRING_BYTES (XSTRING (Vx_resource_name));
+ len = SBYTES (Vx_resource_name);
/* Only letters, digits, - and _ are valid in resource names.
Count the valid characters and count the invalid ones. */
for (i = 0; i < len; i++)
{
- int c = XSTRING (new)->data[i];
+ int c = SREF (new, i);
if (! ((c >= 'a' && c <= 'z')
|| (c >= 'A' && c <= 'Z')
|| (c >= '0' && c <= '9')
|| c == '-' || c == '_'))
- XSTRING (new)->data[i] = '_';
+ SSET (new, i, '_');
}
}
/* Allocate space for the components, the dots which separate them,
and the final '\0'. Make them big enough for the worst case. */
- name_key = (char *) alloca (STRING_BYTES (XSTRING (Vx_resource_name))
+ name_key = (char *) alloca (SBYTES (Vx_resource_name)
+ (STRINGP (component)
- ? STRING_BYTES (XSTRING (component)) : 0)
- + STRING_BYTES (XSTRING (attribute))
+ ? SBYTES (component) : 0)
+ + SBYTES (attribute)
+ 3);
class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
- + STRING_BYTES (XSTRING (class))
+ + SBYTES (class)
+ (STRINGP (subclass)
- ? STRING_BYTES (XSTRING (subclass)) : 0)
+ ? SBYTES (subclass) : 0)
+ 3);
/* Start with emacs.FRAMENAME for the name (the specific one)
and with `Emacs' for the class key (the general one). */
- strcpy (name_key, XSTRING (Vx_resource_name)->data);
+ strcpy (name_key, SDATA (Vx_resource_name));
strcpy (class_key, EMACS_CLASS);
strcat (class_key, ".");
- strcat (class_key, XSTRING (class)->data);
+ strcat (class_key, SDATA (class));
if (!NILP (component))
{
strcat (class_key, ".");
- strcat (class_key, XSTRING (subclass)->data);
+ strcat (class_key, SDATA (subclass));
strcat (name_key, ".");
- strcat (name_key, XSTRING (component)->data);
+ strcat (name_key, SDATA (component));
}
strcat (name_key, ".");
- strcat (name_key, XSTRING (attribute)->data);
+ strcat (name_key, SDATA (attribute));
value = x_get_string_resource (Qnil,
name_key, class_key);
/* Allocate space for the components, the dots which separate them,
and the final '\0'. */
- name_key = (char *) alloca (STRING_BYTES (XSTRING (Vinvocation_name))
+ name_key = (char *) alloca (SBYTES (Vinvocation_name)
+ strlen (attribute) + 2);
class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
+ strlen (class) + 2);
sprintf (name_key, "%s.%s",
- XSTRING (Vinvocation_name)->data,
+ SDATA (Vinvocation_name),
attribute);
sprintf (class_key, "%s.%s", EMACS_CLASS, class);
switch (type)
{
case RES_TYPE_NUMBER:
- return make_number (atoi (XSTRING (tem)->data));
+ return make_number (atoi (SDATA (tem)));
case RES_TYPE_FLOAT:
- return make_float (atof (XSTRING (tem)->data));
+ return make_float (atof (SDATA (tem)));
case RES_TYPE_BOOLEAN:
tem = Fdowncase (tem);
- if (!strcmp (XSTRING (tem)->data, "on")
- || !strcmp (XSTRING (tem)->data, "true"))
+ if (!strcmp (SDATA (tem), "on")
+ || !strcmp (SDATA (tem), "true"))
return Qt;
else
return Qnil;
{
Lisp_Object lower;
lower = Fdowncase (tem);
- if (!strcmp (XSTRING (lower)->data, "on")
- || !strcmp (XSTRING (lower)->data, "true"))
+ if (!strcmp (SDATA (lower), "on")
+ || !strcmp (SDATA (lower), "true"))
return Qt;
- else if (!strcmp (XSTRING (lower)->data, "off")
- || !strcmp (XSTRING (lower)->data, "false"))
+ else if (!strcmp (SDATA (lower), "off")
+ || !strcmp (SDATA (lower), "false"))
return Qnil;
else
return Fintern (tem, Qnil);
CHECK_STRING (string);
- geometry = XParseGeometry ((char *) XSTRING (string)->data,
+ geometry = XParseGeometry ((char *) SDATA (string),
&x, &y, &width, &height);
result = Qnil;
Elsewhere we specify the window name for the window manager. */
{
- char *str = (char *) XSTRING (Vx_resource_name)->data;
+ char *str = (char *) SDATA (Vx_resource_name);
f->namebuf = (char *) xmalloc (strlen (str) + 1);
strcpy (f->namebuf, str);
}
? IconicState
: NormalState));
- x_text_icon (f, (char *) XSTRING ((!NILP (f->icon_name)
+ x_text_icon (f, (char *) SDATA ((!NILP (f->icon_name)
? f->icon_name
- : f->name))->data);
+ : f->name)));
#endif
UNBLOCK_INPUT;
int minibuffer_only = 0;
long window_prompting = 0;
int width, height;
- int count = BINDING_STACK_SIZE ();
+ int count = SPECPDL_INDEX ();
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
Lisp_Object display;
struct mac_display_info *dpyinfo = NULL;
{
tem = Fquery_fontset (font, Qnil);
if (STRINGP (tem))
- font = x_new_fontset (f, XSTRING (tem)->data);
+ font = x_new_fontset (f, SDATA (tem));
else
- font = x_new_font (f, XSTRING (font)->data);
+ font = x_new_font (f, SDATA (font));
}
/* Try out a font which we hope has bold and italic variations. */
if (! STRINGP (font))
CHECK_STRING (color);
- if (mac_defined_color (f, XSTRING (color)->data, &foo, 0))
+ if (mac_defined_color (f, SDATA (color), &foo, 0))
return Qt;
else
return Qnil;
CHECK_STRING (color);
- if (mac_defined_color (f, XSTRING (color)->data, &foo, 0))
+ if (mac_defined_color (f, SDATA (color), &foo, 0))
{
Lisp_Object rgb[3];
}
#endif /* 0 */
- error ("Display has an unknown visual class");
+ return (intern ("true-color"));
}
DEFUN ("x-display-save-under", Fx_display_save_under,
validate_x_resource_name ();
dpyinfo = mac_term_init (name, (unsigned char *) 0,
- (char *) XSTRING (Vx_resource_name)->data);
+ (char *) SDATA (Vx_resource_name));
if (dpyinfo == 0)
- error ("Cannot connect to server %s", XSTRING (name)->data);
+ error ("Cannot connect to server %s", SDATA (name));
mac_in_use = 1;
XSETFASTINT (Vwindow_system_version, 3);
error ("Not using Mac OS");
if (! NILP (xrm_string))
- xrm_option = (unsigned char *) XSTRING (xrm_string)->data;
+ xrm_option = (unsigned char *) SDATA (xrm_string);
else
xrm_option = (unsigned char *) 0;
/* This is what opens the connection and sets x_current_display.
This also initializes many symbols, such as those used for input. */
dpyinfo = mac_term_init (display, xrm_option,
- (char *) XSTRING (Vx_resource_name)->data);
+ (char *) SDATA (Vx_resource_name));
if (dpyinfo == 0)
{
if (!NILP (must_succeed))
fatal ("Cannot connect to server %s.\n",
- XSTRING (display)->data);
+ SDATA (display));
else
- error ("Cannot connect to server %s", XSTRING (display)->data);
+ error ("Cannot connect to server %s", SDATA (display));
}
mac_in_use = 1;
/* Find key in KEYWORDS. Error if not found. */
for (i = 0; i < nkeywords; ++i)
- if (strcmp (keywords[i].name, XSTRING (SYMBOL_NAME (key))->data) == 0)
+ if (strcmp (keywords[i].name, SDATA (SYMBOL_NAME (key))) == 0)
break;
if (i == nkeywords)
xassert (STRINGP (color_name));
- if (w32_defined_color (f, XSTRING (color_name)->data, &color, 1))
+ if (w32_defined_color (f, SDATA (color_name), &color, 1))
{
/* This isn't called frequently so we get away with simply
reallocating the color vector to the needed size, here. */
if (STRINGP (elt))
{
- if (XSTRING (elt)->size
+ if (SCHARS (elt)
< (width + BITS_PER_CHAR - 1) / BITS_PER_CHAR)
return 0;
}
}
else if (STRINGP (data))
{
- if (XSTRING (data)->size
+ if (SCHARS (data)
< (width + BITS_PER_CHAR - 1) / BITS_PER_CHAR * height)
return 0;
}
return 0;
}
- rc = xbm_read_bitmap_file_data (XSTRING (file)->data, &img->width,
+ rc = xbm_read_bitmap_file_data (SDATA (file), &img->width,
&img->height, &data);
if (rc)
{
{
Lisp_Object line = XVECTOR (data)->contents[i];
if (STRINGP (line))
- bcopy (XSTRING (line)->data, p, nbytes);
+ bcopy (SDATA (line), p, nbytes);
else
bcopy (XBOOL_VECTOR (line)->data, p, nbytes);
}
}
else if (STRINGP (data))
- bits = XSTRING (data)->data;
+ bits = SDATA (data);
else
bits = XBOOL_VECTOR (data)->data;
{
Lisp_Object name = XCAR (XCAR (tail));
Lisp_Object color = XCDR (XCAR (tail));
- xpm_syms[i].name = (char *) alloca (XSTRING (name)->size + 1);
- strcpy (xpm_syms[i].name, XSTRING (name)->data);
- xpm_syms[i].value = (char *) alloca (XSTRING (color)->size + 1);
- strcpy (xpm_syms[i].value, XSTRING (color)->data);
+ xpm_syms[i].name = (char *) alloca (SCHARS (name) + 1);
+ strcpy (xpm_syms[i].name, SDATA (name));
+ xpm_syms[i].value = (char *) alloca (SCHARS (color) + 1);
+ strcpy (xpm_syms[i].value, SDATA (color));
}
}
}
rc = XpmReadFileToPixmap (NULL, FRAME_W32_WINDOW (f),
- XSTRING (file)->data, &img->pixmap, &img->mask,
+ SDATA (file), &img->pixmap, &img->mask,
&attrs);
}
else
{
Lisp_Object buffer = image_spec_value (img->spec, QCdata, NULL);
rc = XpmCreatePixmapFromBuffer (NULL, FRAME_W32_WINDOW (f),
- XSTRING (buffer)->data,
+ SDATA (buffer),
&img->pixmap, &img->mask,
&attrs);
}
/* Read FILE into memory. Value is a pointer to a buffer allocated
with xmalloc holding FILE's contents. Value is null if an error
- occured. *SIZE is set to the size of the file. */
+ occurred. *SIZE is set to the size of the file. */
static char *
pbm_read_file (file, size)
char *buf = NULL;
struct stat st;
- if (stat (XSTRING (file)->data, &st) == 0
- && (fp = fopen (XSTRING (file)->data, "r")) != NULL
+ if (stat (SDATA (file), &st) == 0
+ && (fp = fopen (SDATA (file), "r")) != NULL
&& (buf = (char *) xmalloc (st.st_size),
fread (buf, 1, st.st_size, fp) == st.st_size))
{
{
Lisp_Object data;
data = image_spec_value (img->spec, QCdata, NULL);
- p = XSTRING (data)->data;
- end = p + STRING_BYTES (XSTRING (data));
+ p = SDATA (data);
+ end = p + SBYTES (data);
}
/* Check magic number. */
}
/* Open the image file. */
- fp = fopen (XSTRING (file)->data, "rb");
+ fp = fopen (SDATA (file), "rb");
if (!fp)
{
image_error ("Cannot open image file `%s'", file, Qnil);
else
{
/* Read from memory. */
- tbr.bytes = XSTRING (specified_data)->data;
- tbr.len = STRING_BYTES (XSTRING (specified_data));
+ tbr.bytes = SDATA (specified_data);
+ tbr.len = SBYTES (specified_data);
tbr.index = 0;
/* Check PNG signature. */
return 0;
}
- fp = fopen (XSTRING (file)->data, "r");
+ fp = fopen (SDATA (file), "r");
if (fp == NULL)
{
image_error ("Cannot open `%s'", file, Qnil);
if (NILP (specified_data))
jpeg_stdio_src (&cinfo, fp);
else
- jpeg_memory_src (&cinfo, XSTRING (specified_data)->data,
- STRING_BYTES (XSTRING (specified_data)));
+ jpeg_memory_src (&cinfo, SDATA (specified_data),
+ SBYTES (specified_data));
jpeg_read_header (&cinfo, TRUE);
}
/* Try to open the image file. */
- tiff = TIFFOpen (XSTRING (file)->data, "r");
+ tiff = TIFFOpen (SDATA (file), "r");
if (tiff == NULL)
{
image_error ("Cannot open `%s'", file, Qnil);
else
{
/* Memory source! */
- memsrc.bytes = XSTRING (specified_data)->data;
- memsrc.len = STRING_BYTES (XSTRING (specified_data));
+ memsrc.bytes = SDATA (specified_data);
+ memsrc.len = SBYTES (specified_data);
memsrc.index = 0;
tiff = TIFFClientOpen ("memory_source", "r", &memsrc,
}
/* Open the GIF file. */
- gif = DGifOpenFileName (XSTRING (file)->data);
+ gif = DGifOpenFileName (SDATA (file));
if (gif == NULL)
{
image_error ("Cannot open `%s'", file, Qnil);
{
/* Read from memory! */
current_gif_memory_src = &memsrc;
- memsrc.bytes = XSTRING (specified_data)->data;
- memsrc.len = STRING_BYTES (XSTRING (specified_data));
+ memsrc.bytes = SDATA (specified_data);
+ memsrc.len = SBYTES (specified_data);
memsrc.index = 0;
gif = DGifOpen(&memsrc, gif_read_from_memory);
CHECK_STRING (value);
BLOCK_INPUT;
- prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), XSTRING (prop)->data, False);
+ prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False);
XChangeProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
prop_atom, XA_STRING, 8, PropModeReplace,
- XSTRING (value)->data, XSTRING (value)->size);
+ SDATA (value), SCHARS (value));
/* Make sure the property is set when we return. */
XFlush (FRAME_W32_DISPLAY (f));
CHECK_STRING (prop);
BLOCK_INPUT;
- prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), XSTRING (prop)->data, False);
+ prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False);
XDeleteProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), prop_atom);
/* Make sure the property is removed when we return. */
CHECK_STRING (prop);
BLOCK_INPUT;
- prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), XSTRING (prop)->data, False);
+ prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False);
rc = XGetWindowProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
prop_atom, 0, 0, False, XA_STRING,
&actual_type, &actual_format, &actual_size,
Lisp_Object name;
long window_prompting = 0;
int width, height;
- int count = specpdl_ptr - specpdl;
+ int count = SPECPDL_INDEX ();
struct gcpro gcpro1, gcpro2, gcpro3;
struct kboard *kb;
{
tem = Fquery_fontset (font, Qnil);
if (STRINGP (tem))
- font = x_new_fontset (f, XSTRING (tem)->data);
+ font = x_new_fontset (f, SDATA (tem));
else
- font = x_new_font (f, XSTRING (font)->data);
+ font = x_new_font (f, SDATA (font));
}
/* Try out a font which we hope has bold and italic variations. */
unsigned pmask;
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
int old_windows_or_buffers_changed = windows_or_buffers_changed;
- int count = specpdl_ptr - specpdl;
+ int count = SPECPDL_INDEX ();
specbind (Qinhibit_redisplay, Qt);
GCPRO2 (frame, timer);
tip_frame = tip_timer = deleted = Qnil;
- count = BINDING_STACK_SIZE ();
+ count = SPECPDL_INDEX ();
specbind (Qinhibit_redisplay, Qt);
specbind (Qinhibit_quit, Qt);
{
struct frame *f = SELECTED_FRAME ();
Lisp_Object file = Qnil;
- int count = specpdl_ptr - specpdl;
+ int count = SPECPDL_INDEX ();
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
char filename[MAX_PATH + 1];
char init_dir[MAX_PATH + 1];
/* Create the dialog with PROMPT as title, using DIR as initial
directory and using "*" as pattern. */
dir = Fexpand_file_name (dir, Qnil);
- strncpy (init_dir, XSTRING (dir)->data, MAX_PATH);
+ strncpy (init_dir, SDATA (dir), MAX_PATH);
init_dir[MAX_PATH] = '\0';
unixtodos_filename (init_dir);
if (STRINGP (default_filename))
{
char *file_name_only;
- char *full_path_name = XSTRING (default_filename)->data;
+ char *full_path_name = SDATA (default_filename);
unixtodos_filename (full_path_name);
file_details.lpstrFile = filename;
file_details.nMaxFile = sizeof (filename);
file_details.lpstrInitialDir = init_dir;
- file_details.lpstrTitle = XSTRING (prompt)->data;
+ file_details.lpstrTitle = SDATA (prompt);
file_details.Flags = OFN_HIDEREADONLY | OFN_NOCHANGEDIR;
if (!NILP (mustmatch))