2010-08-08 Dan Nicolaescu <dann@ics.uci.edu>
+ Use const char* instead of char*.
+ * xterm.c (x_create_toolkit_scroll_bar):
+ * xfont.c (xfont_list_pattern):
+ * xfns.c (x_default_scroll_bar_color_parameter)
+ (xic_create_fontsetname, x_default_font_parameter)
+ (x_screen_planes):
+ * xdisp.c (c_string_pos, number_of_chars, reseat_to_string)
+ (store_mode_line_string, decode_mode_spec, display_string):
+ * menu.c (digest_single_submenu):
+ * keymap.h (initial_define_key, initial_define_lispy_key):
+ * keymap.c (initial_define_key, initial_define_lispy_key):
+ * image.c (image_error, image_keyword):
+ * gtkutil.h (xg_create_widget, xg_create_scroll_bar):
+ * gtkutil.c (xg_create_widget, xg_create_scroll_bar):
+ * ftfont.c (struct fc_charset_table, ftfont_spec_pattern)
+ (ftfont_list, ftfont_match):
+ * frame.c (frame_parm_table):
+ * font.h (font_intern_prop, font_parse_xlfd, font_parse_fcname)
+ (font_unparse_fcname, font_unparse_fcname, font_open_by_name)
+ (font_add_log, font_deferred_log):
+ * font.c (font_intern_prop, font_parse_xlfd, font_parse_fcname)
+ (font_unparse_fcname, font_unparse_fcname, font_open_by_name)
+ (font_add_log, font_deferred_log):
+ * emacs.c (argmatch):
+ * dispextern.h (struct it):
+ * coding.c (ENCODE_DESIGNATION):
+ * charset.c (define_charset_internal): Use const.
+
* s/freebsd.h (DECLARE_GETPWUID_WITH_UID_T): Remove, unused.
* xrdb.c: Remove include guard. Remove
static int
define_charset_internal (Lisp_Object name,
int dimension,
- unsigned char *code_space,
+ const unsigned char *code_space,
unsigned min_code, unsigned max_code,
int iso_final, int iso_revision, int emacs_mule_id,
int ascii_compatible, int supplementary,
#define ENCODE_DESIGNATION(charset, reg, coding) \
do { \
unsigned char final_char = CHARSET_ISO_FINAL (charset); \
- char *intermediate_char_94 = "()*+"; \
- char *intermediate_char_96 = ",-./"; \
+ const char *intermediate_char_94 = "()*+"; \
+ const char *intermediate_char_96 = ",-./"; \
int revision = -1; \
int c; \
\
/* C string to iterate over. Non-null means get characters from
this string, otherwise characters are read from current_buffer
or it->string. */
- unsigned char *s;
+ const unsigned char *s;
/* Number of characters in the string (s, or it->string) we iterate
over. */
enough information to do it right. */
static int
-argmatch (char **argv, int argc, char *sstr, char *lstr, int minlen, char **valptr, int *skipptr)
+argmatch (char **argv, int argc, const char *sstr, const char *lstr, int minlen, char **valptr, int *skipptr)
{
char *p = NULL;
int arglen;
STR. */
Lisp_Object
-font_intern_prop (char *str, int len, int force_symbol)
+font_intern_prop (const char *str, int len, int force_symbol)
{
int i;
Lisp_Object tem;
a fully specified XLFD. */
int
-font_parse_xlfd (char *name, Lisp_Object font)
+font_parse_xlfd (const char *name, Lisp_Object font)
{
int len = strlen (name);
int i, j, n;
This function tries to guess which format it is. */
int
-font_parse_fcname (char *name, Lisp_Object font)
+font_parse_fcname (const char *name, Lisp_Object font)
{
char *p, *q;
char *size_beg = NULL, *size_end = NULL;
FONT_SIZE_INDEX of FONT is 0, use PIXEL_SIZE instead. */
int
-font_unparse_fcname (Lisp_Object font, int pixel_size, char *name, int nbytes)
+font_unparse_fcname (Lisp_Object font, int pixel_size, const char *name, int nbytes)
{
Lisp_Object family, foundry;
Lisp_Object tail, val;
int i, len = 1;
char *p;
Lisp_Object styles[3];
- char *style_names[3] = { "weight", "slant", "width" };
+ const char *style_names[3] = { "weight", "slant", "width" };
char work[256];
family = AREF (font, FONT_FAMILY_INDEX);
found, return Qnil. */
Lisp_Object
-font_open_by_name (FRAME_PTR f, char *name)
+font_open_by_name (FRAME_PTR f, const char *name)
{
Lisp_Object args[2];
Lisp_Object spec, ret;
opening), ARG is the argument for the action, and RESULT is the
result of the action. */
void
-font_add_log (char *action, Lisp_Object arg, Lisp_Object result)
+font_add_log (const char *action, Lisp_Object arg, Lisp_Object result)
{
Lisp_Object tail, val;
int i;
as font_add_log. */
void
-font_deferred_log (char *action, Lisp_Object arg, Lisp_Object result)
+font_deferred_log (const char *action, Lisp_Object arg, Lisp_Object result)
{
if (EQ (Vfont_log, Qt))
return;
extern void font_done_for_face (FRAME_PTR f, struct face *face);
extern Lisp_Object font_open_by_spec (FRAME_PTR f, Lisp_Object spec);
-extern Lisp_Object font_open_by_name (FRAME_PTR f, char *name);
+extern Lisp_Object font_open_by_name (FRAME_PTR f, const char *name);
extern void font_close_object (FRAME_PTR f, Lisp_Object font_object);
-extern Lisp_Object font_intern_prop (char *str, int len, int force_symbol);
+extern Lisp_Object font_intern_prop (const char *str, int len, int force_symbol);
extern void font_update_sort_order (int *order);
extern void font_parse_family_registry (Lisp_Object family,
extern Lisp_Object font_spec_from_family_registry (Lisp_Object family,
Lisp_Object registry);
-extern int font_parse_xlfd (char *name, Lisp_Object font);
+extern int font_parse_xlfd (const char *name, Lisp_Object font);
extern int font_unparse_xlfd (Lisp_Object font, int pixel_size,
char *name, int bytes);
-extern int font_parse_fcname (char *name, Lisp_Object font);
+extern int font_parse_fcname (const char *name, Lisp_Object font);
extern int font_unparse_fcname (Lisp_Object font, int pixel_size,
- char *name, int bytes);
+ const char *name, int bytes);
extern int font_unparse_gtkname (Lisp_Object, struct frame *, char *, int);
extern void register_font_driver (struct font_driver *driver, FRAME_PTR f);
extern void free_font_driver_list (FRAME_PTR f);
extern Lisp_Object QCfoundry, QCadstyle, QCregistry;
extern Lisp_Object Vfont_log;
-extern void font_add_log (char *, Lisp_Object, Lisp_Object);
-extern void font_deferred_log (char *, Lisp_Object, Lisp_Object);
+extern void font_add_log (const char *, Lisp_Object, Lisp_Object);
+extern void font_deferred_log (const char *, Lisp_Object, Lisp_Object);
#define FONT_ADD_LOG(ACTION, ARG, RESULT) \
do { \
that is an index in this table. */
struct frame_parm_table {
- char *name;
+ const char *name;
Lisp_Object *variable;
};
static struct
{
/* registry name */
- char *name;
+ const char *name;
/* characters to distinguish the charset from the others */
int uniquifier[6];
/* additional constraint by language */
- char *lang;
+ const char *lang;
/* set on demand */
FcCharSet *fc_charset;
} fc_charset_table[] =
return spec;
}
-static FcPattern *ftfont_spec_pattern (Lisp_Object, char *,
- struct OpenTypeSpec **,
- char **langname);
-
static FcPattern *
-ftfont_spec_pattern (Lisp_Object spec, char *otlayout, struct OpenTypeSpec **otspec, char **langname)
+ftfont_spec_pattern (Lisp_Object spec, char *otlayout, struct OpenTypeSpec **otspec, const char **langname)
{
Lisp_Object tmp, extra;
FcPattern *pattern = NULL;
char otlayout[15]; /* For "otlayout:XXXX" */
struct OpenTypeSpec *otspec = NULL;
int spacing = -1;
- char *langname = NULL;
+ const char *langname = NULL;
if (! fc_initialized)
{
FcResult result;
char otlayout[15]; /* For "otlayout:XXXX" */
struct OpenTypeSpec *otspec = NULL;
- char *langname = NULL;
+ const char *langname = NULL;
if (! fc_initialized)
{
if (strcmp (ftfont_booleans[i], keystr) == 0)
{
- char *str = SYMBOLP (val) ? SDATA (SYMBOL_NAME (val)) : NULL;
+ const char *str = SYMBOLP (val) ? SDATA (SYMBOL_NAME (val)) : NULL;
if (INTEGERP (val)) str = XINT (val) != 0 ? "true" : "false";
if (str == NULL) str = "true";
Returns the widget created. */
GtkWidget *
-xg_create_widget (char *type, char *name, FRAME_PTR f, widget_value *val,
+xg_create_widget (const char *type, const char *name, FRAME_PTR f, widget_value *val,
GCallback select_cb, GCallback deactivate_cb,
GCallback highlight_cb)
{
struct scroll_bar *bar,
GCallback scroll_callback,
GCallback end_callback,
- char *scroll_bar_name)
+ const char *scroll_bar_name)
{
GtkWidget *wscroll;
GtkWidget *webox;
extern char *xg_get_font_name (FRAME_PTR f, char *);
-extern GtkWidget *xg_create_widget (char *type,
- char *name,
+extern GtkWidget *xg_create_widget (const char *type,
+ const char *name,
FRAME_PTR f,
widget_value *val,
GCallback select_cb,
struct scroll_bar *bar,
GCallback scroll_callback,
GCallback end_callback,
- char *scroll_bar_name);
+ const char *scroll_bar_name);
extern void xg_remove_scroll_bar (FRAME_PTR f, int scrollbar_id);
extern void xg_update_scrollbar_pos (FRAME_PTR f,
static Lisp_Object define_image_type (struct image_type *type, int loaded);
static struct image_type *lookup_image_type (Lisp_Object symbol);
-static void image_error (char *format, Lisp_Object, Lisp_Object);
+static void image_error (const char *format, Lisp_Object, Lisp_Object);
static void x_laplace (struct frame *, struct image *);
static void x_emboss (struct frame *, struct image *);
static int x_build_heuristic_mask (struct frame *, struct image *,
therefore simply displays a message. */
static void
-image_error (char *format, Lisp_Object arg1, Lisp_Object arg2)
+image_error (const char *format, Lisp_Object arg1, Lisp_Object arg2)
{
add_to_log (format, arg1, arg2);
}
struct image_keyword
{
/* Name of keyword. */
- char *name;
+ const char *name;
/* The type of value allowed. */
enum image_value_type type;
initial_define_key (control_x_map, Ctl('X'), "exchange-point-and-mark"); */
void
-initial_define_key (Lisp_Object keymap, int key, char *defname)
+initial_define_key (Lisp_Object keymap, int key, const char *defname)
{
store_in_keymap (keymap, make_number (key), intern_c_string (defname));
}
void
-initial_define_lispy_key (Lisp_Object keymap, char *keyname, char *defname)
+initial_define_lispy_key (Lisp_Object keymap, const char *keyname, const char *defname)
{
store_in_keymap (keymap, intern_c_string (keyname), intern_c_string (defname));
}
extern void describe_map_tree (Lisp_Object, int, Lisp_Object, Lisp_Object,
char *, int, int, int, int);
extern int current_minor_maps (Lisp_Object **, Lisp_Object **);
-extern void initial_define_key (Lisp_Object, int, char *);
-extern void initial_define_lispy_key (Lisp_Object, char *, char *);
+extern void initial_define_key (Lisp_Object, int, const char *);
+extern void initial_define_lispy_key (Lisp_Object, const char *, const char *);
extern void syms_of_keymap (void);
extern void keys_of_keymap (void);
{
/* Create a new pane. */
Lisp_Object pane_name, prefix;
- char *pane_string;
+ const char *pane_string;
panes_seen++;
Lisp_Object Qrect, Qcircle, Qpoly;
/* Tool bar styles */
-Lisp_Object Qtext, Qboth, Qboth_horiz, Qtext_image_horiz;
+Lisp_Object Qboth, Qboth_horiz, Qtext_image_horiz;
/* Non-zero means print newline to stdout before next mini-buffer
message. */
static int display_mode_lines (struct window *);
static int display_mode_line (struct window *, enum face_id, Lisp_Object);
static int display_mode_element (struct it *, int, int, int, Lisp_Object, Lisp_Object, int);
-static int store_mode_line_string (char *, Lisp_Object, int, int, int, Lisp_Object);
-static char *decode_mode_spec (struct window *, int, int, int,
- Lisp_Object *);
+static int store_mode_line_string (const char *, Lisp_Object, int, int, int, Lisp_Object);
+static const char *decode_mode_spec (struct window *, int, int, int,
+ Lisp_Object *);
static void display_menu_bar (struct window *);
static int display_count_lines (int, int, int, int, int *);
-static int display_string (unsigned char *, Lisp_Object, Lisp_Object,
+static int display_string (const unsigned char *, Lisp_Object, Lisp_Object,
EMACS_INT, EMACS_INT, struct it *, int, int, int, int);
static void compute_line_metrics (struct it *);
static void run_redisplay_end_trigger_hook (struct it *);
static void load_overlay_strings (struct it *, int);
static int init_from_display_pos (struct it *, struct window *,
struct display_pos *);
-static void reseat_to_string (struct it *, unsigned char *,
+static void reseat_to_string (struct it *, const unsigned char *,
Lisp_Object, int, int, int, int);
static enum move_it_result
move_it_in_display_line_to (struct it *, EMACS_INT, int,
static struct text_pos string_pos_nchars_ahead (struct text_pos,
Lisp_Object, int);
static struct text_pos string_pos (int, Lisp_Object);
-static struct text_pos c_string_pos (int, unsigned char *, int);
-static int number_of_chars (unsigned char *, int);
+static struct text_pos c_string_pos (int, const unsigned char *, int);
+static int number_of_chars (const unsigned char *, int);
static void compute_stop_pos (struct it *);
static void compute_string_pos (struct text_pos *, struct text_pos,
Lisp_Object);
means recognize multibyte characters. */
static struct text_pos
-c_string_pos (int charpos, unsigned char *s, int multibyte_p)
+c_string_pos (int charpos, const unsigned char *s, int multibyte_p)
{
struct text_pos pos;
non-zero means recognize multibyte characters. */
static int
-number_of_chars (unsigned char *s, int multibyte_p)
+number_of_chars (const unsigned char *s, int multibyte_p)
{
int nchars;
calling this function. */
static void
-reseat_to_string (struct it *it, unsigned char *s, Lisp_Object string,
+reseat_to_string (struct it *it, const unsigned char *s, Lisp_Object string,
int charpos, int precision, int field_width, int multibyte)
{
/* No region in strings. */
{
int multibyte;
int bytepos, charpos;
- unsigned char *spec;
+ const unsigned char *spec;
Lisp_Object string;
bytepos = percent_position;
*/
static int
-store_mode_line_string (char *string, Lisp_Object lisp_string, int copy_string,
+store_mode_line_string (const char *string, Lisp_Object lisp_string, int copy_string,
int field_width, int precision, Lisp_Object props)
{
int len;
static char lots_of_dashes[] = "--------------------------------------------------------------------------------------------------------------------------------------------";
-static char *
+static const char *
decode_mode_spec (struct window *w, register int c, int field_width,
int precision, Lisp_Object *string)
{
Value is the number of columns displayed. */
static int
-display_string (unsigned char *string, Lisp_Object lisp_string, Lisp_Object face_string,
+display_string (const unsigned char *string, Lisp_Object lisp_string, Lisp_Object face_string,
EMACS_INT face_string_pos, EMACS_INT start, struct it *it,
int field_width, int precision, int max_x, int multibyte)
{
static Lisp_Object x_default_scroll_bar_color_parameter (struct frame *,
Lisp_Object,
Lisp_Object,
- char *, char *,
+ const char *, const char *,
int);
\f
static Lisp_Object
x_default_scroll_bar_color_parameter (struct frame *f,
Lisp_Object alist, Lisp_Object prop,
- char *xprop, char *xclass,
+ const char *xprop, const char *xclass,
int foreground_p)
{
struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
}
if (! xfs)
{
- char *last_resort = "-*-*-*-r-normal--*-*-*-*-*-*";
+ const char *last_resort = "-*-*-*-r-normal--*-*-*-*-*-*";
missing_list = NULL;
xfs = XCreateFontSet (FRAME_X_DISPLAY (f), last_resort,
if (! FONTP (font) && ! STRINGP (font))
{
- char *names[]
+ const char *names[]
= {
#ifdef HAVE_XFT
/* This will find the normal Xft font. */
(Lisp_Object terminal)
{
struct x_display_info *dpyinfo = check_x_display_info (terminal);
- char *vendor = ServerVendor (dpyinfo->display);
+ const char *vendor = ServerVendor (dpyinfo->display);
if (! vendor) vendor = "";
return build_string (vendor);
static struct visual_class
{
- char *name;
+ const char *name;
int class;
}
visual_classes[] =
}
static Lisp_Object
-xfont_list_pattern (Display *display, char *pattern,
+xfont_list_pattern (Display *display, const char *pattern,
Lisp_Object registry, Lisp_Object script)
{
Lisp_Object list = Qnil;
/* Xt features made by Fred Pierresteguy. */
#include <config.h>
-
-/* On 4.3 these lose if they come after xterm.h. */
-/* Putting these at the beginning seems to be standard for other .c files. */
#include <signal.h>
-
#include <stdio.h>
#include <setjmp.h>
#include "../lwlib/xlwmenu.h"
#endif
-#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
-
-extern void free_frame_menubar (struct frame *);
-#endif
-
#ifdef USE_X_TOOLKIT
#if !defined(NO_EDITRES)
#define HACK_EDITRES
static void
x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar)
{
- char *scroll_bar_name = SCROLL_BAR_NAME;
+ const char *scroll_bar_name = SCROLL_BAR_NAME;
BLOCK_INPUT;
xg_create_scroll_bar (f, bar, G_CALLBACK (xg_scroll_callback),