Mercurial > hg > xemacs-beta
changeset 4983:fbcf988fbb33
Automatic merge
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Fri, 05 Feb 2010 11:53:57 -0600 |
parents | 3c3c1d139863 (diff) 931aaa7a6b37 (current diff) |
children | 358aa3bb603f 97c45e3ad810 |
files | |
diffstat | 58 files changed, 785 insertions(+), 713 deletions(-) [+] |
line wrap: on
line diff
--- a/modules/ChangeLog Fri Feb 05 10:50:06 2010 -0700 +++ b/modules/ChangeLog Fri Feb 05 11:53:57 2010 -0600 @@ -1,3 +1,30 @@ +2010-02-05 Ben Wing <ben@xemacs.org> + + * postgresql/postgresql.c: + * postgresql/postgresql.c (CHECK_LIVE_CONNECTION): + * postgresql/postgresql.c (Fpq_connectdb): + * postgresql/postgresql.c (Fpq_connect_start): + * postgresql/postgresql.c (Fpq_lo_import): + * postgresql/postgresql.c (Fpq_lo_export): + * ldap/eldap.c (Fldap_open): + * ldap/eldap.c (Fldap_search_basic): + * ldap/eldap.c (Fldap_add): + * ldap/eldap.c (Fldap_modify): + * ldap/eldap.c (Fldap_delete): + * canna/canna_api.c (Fcanna_initialize): + * canna/canna_api.c (Fcanna_store_yomi): + * canna/canna_api.c (Fcanna_parse): + * canna/canna_api.c (Fcanna_henkan_begin): + EXTERNAL_TO_C_STRING returns its argument instead of storing it + in a parameter, and is renamed to EXTERNAL_TO_ITEXT. Similar + things happen to related macros. See entry in src/ChangeLog. + + More Mule-izing of postgresql.c. Extract out common code + between `pq-connectdb' and `pq-connect-start'. Fix places + that signal an error string using a formatted string to instead + follow the standard and have a fixed reason followed by the + particular error message stored as one of the frobs. + 2010-01-27 Ben Wing <ben@xemacs.org> * postgresql/postgresql.c (print_pgconn):
--- a/modules/canna/canna_api.c Fri Feb 05 10:50:06 2010 -0700 +++ b/modules/canna/canna_api.c Fri Feb 05 11:53:57 2010 -0600 @@ -390,7 +390,7 @@ CHECK_STRING (server); jrKanjiControl (0, KC_SETSERVERNAME, /* !!#### Check encoding */ - NEW_LISP_STRING_TO_EXTERNAL (server, Qnative)); + LISP_STRING_TO_EXTERNAL (server, Qnative)); } if (NILP (rcfile)) @@ -401,7 +401,7 @@ { CHECK_STRING (rcfile); jrKanjiControl (0, KC_SETINITFILENAME, - NEW_LISP_STRING_TO_EXTERNAL (rcfile, Qfile_name)); + LISP_STRING_TO_EXTERNAL (rcfile, Qfile_name)); } { @@ -561,7 +561,7 @@ Extbyte *ext; CHECK_STRING (yomi); - LISP_STRING_TO_EXTERNAL (yomi, ext, Qeuc_jp); + ext = LISP_STRING_TO_EXTERNAL (yomi, Qeuc_jp); strncpy (key_buffer, ext, sizeof (key_buffer)); key_buffer[sizeof (key_buffer) - 1] = '\0'; ks.length = strlen (key_buffer); @@ -573,7 +573,7 @@ else { CHECK_STRING (roma); - LISP_STRING_TO_EXTERNAL (roma, ext, Qeuc_jp); + ext = LISP_STRING_TO_EXTERNAL (roma, Qeuc_jp); ks.mode = (unsigned char *) (key_buffer + ks.length + 1); strncpy (key_buffer + ks.length + 1, ext, sizeof (key_buffer) - ks.length - 1); @@ -629,7 +629,7 @@ Extbyte *ext; CHECK_STRING (str); - LISP_STRING_TO_EXTERNAL (str, ext, Qeuc_jp); + ext = LISP_STRING_TO_EXTERNAL (str, Qeuc_jp); strncpy (key_buffer, ext, sizeof (key_buffer)); key_buffer[sizeof (key_buffer) - 1] = '\0'; p = (Extbyte **) key_buffer; @@ -716,7 +716,7 @@ return Qnil; } - LISP_STRING_TO_EXTERNAL (yomi, ext, Qeuc_jp); + ext = LISP_STRING_TO_EXTERNAL (yomi, Qeuc_jp); strncpy ((char *) yomibuf, ext, sizeof (yomibuf)); yomibuf[sizeof (yomibuf) - 1] = '\0';
--- a/modules/ldap/eldap.c Fri Feb 05 10:50:06 2010 -0700 +++ b/modules/ldap/eldap.c Fri Feb 05 11:53:57 2010 -0600 @@ -263,13 +263,13 @@ else if (EQ (keyword, Qbinddn)) { CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, ldap_binddn, Qnative); + ldap_binddn = LISP_STRING_TO_EXTERNAL (value, Qnative); } /* Password */ else if (EQ (keyword, Qpasswd)) { CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, ldap_password, Qnative); + ldap_password = LISP_STRING_TO_EXTERNAL (value, Qnative); } /* Deref */ else if (EQ (keyword, Qderef)) @@ -307,7 +307,7 @@ /* Connect to the server and bind */ slow_down_interrupts (); - ld = ldap_open (NEW_LISP_STRING_TO_EXTERNAL (host, Qnative), ldap_port); + ld = ldap_open (LISP_STRING_TO_EXTERNAL (host, Qnative), ldap_port); speed_up_interrupts (); if (ld == NULL ) @@ -486,7 +486,7 @@ EXTERNAL_LIST_LOOP_2 (current, attrs) { CHECK_STRING (current); - LISP_STRING_TO_EXTERNAL (current, ldap_attributes[i], Qnative); + ldap_attributes[i] = LISP_STRING_TO_EXTERNAL (current, Qnative); ++i; } } @@ -498,9 +498,9 @@ /* Perform the search */ bs = NILP (base) ? (Extbyte *) "" : - NEW_LISP_STRING_TO_EXTERNAL (base, Qnative); + LISP_STRING_TO_EXTERNAL (base, Qnative); filt = NILP (filter) ? (Extbyte *) "" : - NEW_LISP_STRING_TO_EXTERNAL (filter, Qnative); + LISP_STRING_TO_EXTERNAL (filter, Qnative); if (ldap_search (ld, bs, ldap_scope, filt, ldap_attributes, NILP (attrsonly) ? 0 : 1) == -1) @@ -646,8 +646,8 @@ CHECK_CONS (current); CHECK_STRING (XCAR (current)); ldap_mods_ptrs[i] = &(ldap_mods[i]); - LISP_STRING_TO_EXTERNAL (XCAR (current), ldap_mods[i].mod_type, - Qnative); + ldap_mods[i].mod_type = + LISP_STRING_TO_EXTERNAL (XCAR (current), Qnative); ldap_mods[i].mod_op = LDAP_MOD_ADD | LDAP_MOD_BVALUES; values = XCDR (current); if (CONSP (values)) @@ -688,7 +688,7 @@ } } ldap_mods_ptrs[i] = NULL; - rc = ldap_add_s (ld, NEW_LISP_STRING_TO_EXTERNAL (dn, Qnative), + rc = ldap_add_s (ld, LISP_STRING_TO_EXTERNAL (dn, Qnative), ldap_mods_ptrs); if (rc != LDAP_SUCCESS) signal_ldap_error (ld, NULL, rc); @@ -756,8 +756,8 @@ invalid_constant ("Invalid LDAP modification type", mod_op); current = XCDR (current); CHECK_STRING (XCAR (current)); - LISP_STRING_TO_EXTERNAL (XCAR (current), ldap_mods[i].mod_type, - Qnative); + ldap_mods[i].mod_type = + LISP_STRING_TO_EXTERNAL (XCAR (current), Qnative); values = XCDR (current); len = (Elemcount) XINT (Flength (values)); bervals = alloca_array (struct berval, len); @@ -781,7 +781,7 @@ } } ldap_mods_ptrs[i] = NULL; - rc = ldap_modify_s (ld, NEW_LISP_STRING_TO_EXTERNAL (dn, Qnative), + rc = ldap_modify_s (ld, LISP_STRING_TO_EXTERNAL (dn, Qnative), ldap_mods_ptrs); if (rc != LDAP_SUCCESS) signal_ldap_error (ld, NULL, rc); @@ -806,7 +806,7 @@ ld = XLDAP (ldap)->ld; CHECK_STRING (dn); - rc = ldap_delete_s (ld, NEW_LISP_STRING_TO_EXTERNAL (dn, Qnative)); + rc = ldap_delete_s (ld, LISP_STRING_TO_EXTERNAL (dn, Qnative)); if (rc != LDAP_SUCCESS) signal_ldap_error (ld, NULL, rc);
--- a/modules/postgresql/postgresql.c Fri Feb 05 10:50:06 2010 -0700 +++ b/modules/postgresql/postgresql.c Fri Feb 05 11:53:57 2010 -0600 @@ -97,7 +97,6 @@ /* #define POSTGRES_LO_IMPORT_IS_VOID 1 */ #include "lisp.h" -#include "sysdep.h" #include "buffer.h" #include "postgresql.h" @@ -105,6 +104,8 @@ #ifdef HAVE_SHLIB # include "emodules.h" #endif +#include "sysdep.h" +#include "sysfile.h" #ifdef RUNNING_XEMACS_21_1 /* handle interface changes */ #define PG_OS_CODING FORMAT_FILENAME @@ -123,13 +124,13 @@ { \ if (!P || (PQstatus (P) != CONNECTION_OK)) \ { \ - const Ibyte *err; \ + Lisp_Object err; \ \ if (P) \ - err = NEW_EXTERNAL_TO_C_STRING (PQerrorMessage (P), PG_OS_CODING); \ + err = build_extstring (PQerrorMessage (P), PG_OS_CODING); \ else \ - err = (const Ibyte *) "bad value"; \ - signal_ferror (Qprocess_error, "dead connection [%s]", err); \ + err = build_msg_string ("Bad value"); \ + signal_error (Qprocess_error, "Dead connection", err); \ } \ } \ while (0) @@ -137,10 +138,18 @@ #define PUKE_IF_NULL(p) \ do \ { \ - if (!p) signal_error (Qinvalid_argument, "bad value", Qunbound); \ + if (!p) signal_error (Qinvalid_argument, "Bad value", Qunbound); \ } \ while (0) +#define SIGNAL_ERROR(p, reason) \ +do \ +{ \ + signal_error (Qprocess_error, reason, \ + build_extstring (PQerrorMessage (p), PG_OS_CODING)); \ +} \ +while (0) + static Lisp_Object VXPGHOST; static Lisp_Object VXPGUSER; static Lisp_Object VXPGOPTIONS; @@ -479,24 +488,29 @@ PGconn *PQconnectdb(const char *conninfo) */ -/* ###autoload */ -DEFUN ("pq-connectdb", Fpq_connectdb, 1, 1, 0, /* -Make a new connection to a PostgreSQL backend. -*/ - (conninfo)) +#ifdef HAVE_POSTGRESQLV7 +#define USED_IF_V7(x) x +#else +#define USED_IF_V7(x) UNUSED (x) +#endif + +static Lisp_Object +postgresql_connect (Lisp_Object conninfo, int USED_IF_V7 (async)) { PGconn *P; Lisp_PGconn *lisp_pgconn; - const Ascbyte *error_message = "Out of Memory?"; - Extbyte *c_conninfo; CHECK_STRING (conninfo); - LISP_STRING_TO_EXTERNAL (conninfo, c_conninfo, PG_OS_CODING); - P = PQconnectdb (c_conninfo); + P = ( +#ifdef HAVE_POSTGRESQLV7 + async ? PQconnectStart : +#endif + PQconnectdb) + (LISP_STRING_TO_EXTERNAL (conninfo, PG_OS_CODING)); if (P && (PQstatus (P) == CONNECTION_OK)) { - (void)PQsetNoticeProcessor (P, xemacs_notice_processor, NULL); + (void) PQsetNoticeProcessor (P, xemacs_notice_processor, NULL); lisp_pgconn = allocate_pgconn (); lisp_pgconn->pgconn = P; return make_pgconn (lisp_pgconn); @@ -504,19 +518,29 @@ else { /* Connection failed. Destroy the connection and signal an error. */ - Ibyte *errmsg = (Ibyte *) error_message; + + Lisp_Object errmsg; if (P) { - /* storage for the error message gets erased when call PQfinish */ - /* so we must temporarily stash it somewhere -- make alloca() copy */ - errmsg = NEW_EXTERNAL_TO_C_STRING (PQerrorMessage (P), PG_OS_CODING); - IBYTE_STRING_TO_ALLOCA (errmsg, errmsg); + errmsg = build_extstring (PQerrorMessage (P), PG_OS_CODING); PQfinish (P); } - signal_ferror (Qprocess_error, "libpq: %s", errmsg); + else + errmsg = build_msg_string ("Out of Memory?"); + signal_error (Qprocess_error, "Connecting to PostGreSQL backend", + errmsg); } } +/* ###autoload */ +DEFUN ("pq-connectdb", Fpq_connectdb, 1, 1, 0, /* +Make a new connection to a PostgreSQL backend. +*/ + (conninfo)) +{ + return postgresql_connect (conninfo, 0); +} + /* PQconnectStart Makes a new asynchronous connection to a backend. PGconn *PQconnectStart(const char *conninfo) */ @@ -528,37 +552,7 @@ */ (conninfo)) { - PGconn *P; - Lisp_PGconn *lisp_pgconn; - const Ascbyte *error_message = "Out of Memory?"; - Extbyte *c_conninfo; - - CHECK_STRING (conninfo); - - LISP_STRING_TO_EXTERNAL (conninfo, c_conninfo, PG_OS_CODING); - P = PQconnectStart (c_conninfo); - - if (P && (PQstatus (P) != CONNECTION_BAD)) - { - (void)PQsetNoticeProcessor (P, xemacs_notice_processor, NULL); - lisp_pgconn = allocate_pgconn (); - lisp_pgconn->pgconn = P; - - return make_pgconn (lisp_pgconn); - } - else - { - /* capture the error message before destroying the object */ - char buf[BLCKSZ]; - strcpy (buf, error_message); - if (P) - { - strncpy (buf, PQerrorMessage (P), sizeof (buf)); - buf[sizeof (buf) - 1] = '\0'; - PQfinish (P); - } - signal_ferror (Qprocess_error, "libpq: %s", buf); - } + return postgresql_connect (conninfo, 1); } DEFUN ("pq-connect-poll", Fpq_connect_poll, 1, 1, 0, /* @@ -579,10 +573,7 @@ { case PGRES_POLLING_FAILED: /* Something Bad has happened */ - { - char *e = PQerrorMessage (P); - signal_ferror (Qprocess_error, "libpq: %s", e); - } + SIGNAL_ERROR (P, "Polling asynchronous connection"); case PGRES_POLLING_OK: return Qpgres_polling_ok; case PGRES_POLLING_READING: @@ -745,10 +736,7 @@ CHECK_LIVE_CONNECTION (P); if (PQresetStart (P)) return Qt; - { - char *e = PQerrorMessage (P); - signal_ferror (Qprocess_error, "libpq: %s", e); - } + SIGNAL_ERROR (P, "Resetting connection"); } DEFUN ("pq-reset-poll", Fpq_reset_poll, 1, 1, 0, /* @@ -768,11 +756,7 @@ switch (polling_status) { case PGRES_POLLING_FAILED: - /* Something Bad has happened */ - { - char *e = PQerrorMessage (P); - signal_ferror (Qprocess_error, "libpq: %s", e); - } + SIGNAL_ERROR (P, "Polling asynchronous reset"); case PGRES_POLLING_OK: return Qpgres_polling_ok; case PGRES_POLLING_READING: @@ -984,7 +968,7 @@ C_STRING_ALLOCA, c_query, Qnative); if (PQsendQuery (P, c_query)) return Qt; - else signal_ferror (Qprocess_error, "async query: %s", PQerrorMessage (P)); + else SIGNAL_ERROR (P, "Sending asynchronous query"); } DEFUN ("pq-get-result", Fpq_get_result, 1, 1, 0, /* @@ -1422,9 +1406,7 @@ P = (XPGCONN (conn))->pgconn; CHECK_LIVE_CONNECTION (P); - TO_EXTERNAL_FORMAT (LISP_STRING, filename, - C_STRING_ALLOCA, c_filename, - Qfile_name); + LISP_PATHNAME_CONVERT_OUT (filename, c_filename); return make_int ((int)lo_import (P, c_filename)); } @@ -1443,8 +1425,7 @@ P = (XPGCONN (conn))->pgconn; CHECK_LIVE_CONNECTION (P); - TO_EXTERNAL_FORMAT (LISP_STRING, filename, - C_STRING_ALLOCA, c_filename, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (filename, c_filename); return make_int ((int)lo_export (P, XINT (oid), c_filename)); }
--- a/src/ChangeLog Fri Feb 05 10:50:06 2010 -0700 +++ b/src/ChangeLog Fri Feb 05 11:53:57 2010 -0600 @@ -1,3 +1,256 @@ +2010-02-05 Ben Wing <ben@xemacs.org> + + * console-msw.c (write_string_to_mswindows_debugging_output): + * console-msw.c (Fmswindows_message_box): + * console-x.c (x_perhaps_init_unseen_key_defaults): + * console.c: + * database.c (dbm_get): + * database.c (dbm_put): + * database.c (dbm_remove): + * database.c (berkdb_get): + * database.c (berkdb_put): + * database.c (berkdb_remove): + * database.c (Fopen_database): + * device-gtk.c (gtk_init_device): + * device-msw.c (msprinter_init_device_internal): + * device-msw.c (msprinter_default_printer): + * device-msw.c (msprinter_init_device): + * device-msw.c (sync_printer_with_devmode): + * device-msw.c (Fmsprinter_select_settings): + * device-x.c (sanity_check_geometry_resource): + * device-x.c (Dynarr_add_validified_lisp_string): + * device-x.c (x_init_device): + * device-x.c (Fx_put_resource): + * device-x.c (Fx_valid_keysym_name_p): + * device-x.c (Fx_set_font_path): + * dialog-msw.c (push_lisp_string_as_unicode): + * dialog-msw.c (handle_directory_dialog_box): + * dialog-msw.c (handle_file_dialog_box): + * dialog-x.c (dbox_descriptor_to_widget_value): + * editfns.c (Fformat_time_string): + * editfns.c (Fencode_time): + * editfns.c (Fset_time_zone_rule): + * emacs.c (make_argc_argv): + * emacs.c (Fdump_emacs): + * emodules.c (emodules_load): + * eval.c: + * eval.c (maybe_signal_error_1): + * event-msw.c (Fdde_alloc_advise_item): + * event-msw.c (mswindows_dde_callback): + * event-msw.c (mswindows_wnd_proc): + * fileio.c (report_error_with_errno): + * fileio.c (Fsysnetunam): + * fileio.c (Fdo_auto_save): + * font-mgr.c (extract_fcapi_string): + * font-mgr.c (Ffc_config_app_font_add_file): + * font-mgr.c (Ffc_config_app_font_add_dir): + * font-mgr.c (Ffc_config_filename): + * frame-gtk.c (gtk_set_frame_text_value): + * frame-gtk.c (gtk_create_widgets): + * frame-msw.c (mswindows_init_frame_1): + * frame-msw.c (mswindows_set_title_from_ibyte): + * frame-msw.c (msprinter_init_frame_3): + * frame-x.c (x_set_frame_text_value): + * frame-x.c (x_set_frame_properties): + * frame-x.c (start_drag_internal_1): + * frame-x.c (x_cde_transfer_callback): + * frame-x.c (x_create_widgets): + * glyphs-eimage.c (my_jpeg_output_message): + * glyphs-eimage.c (jpeg_instantiate): + * glyphs-eimage.c (gif_instantiate): + * glyphs-eimage.c (png_instantiate): + * glyphs-eimage.c (tiff_instantiate): + * glyphs-gtk.c (xbm_instantiate_1): + * glyphs-gtk.c (gtk_xbm_instantiate): + * glyphs-gtk.c (gtk_xpm_instantiate): + * glyphs-gtk.c (gtk_xface_instantiate): + * glyphs-gtk.c (cursor_font_instantiate): + * glyphs-gtk.c (gtk_redisplay_widget): + * glyphs-gtk.c (gtk_widget_instantiate_1): + * glyphs-gtk.c (gtk_add_tab_item): + * glyphs-msw.c (mswindows_xpm_instantiate): + * glyphs-msw.c (bmp_instantiate): + * glyphs-msw.c (mswindows_resource_instantiate): + * glyphs-msw.c (xbm_instantiate_1): + * glyphs-msw.c (mswindows_xbm_instantiate): + * glyphs-msw.c (mswindows_xface_instantiate): + * glyphs-msw.c (mswindows_redisplay_widget): + * glyphs-msw.c (mswindows_widget_instantiate): + * glyphs-msw.c (add_tree_item): + * glyphs-msw.c (add_tab_item): + * glyphs-msw.c (mswindows_combo_box_instantiate): + * glyphs-msw.c (mswindows_widget_query_string_geometry): + * glyphs-x.c (x_locate_pixmap_file): + * glyphs-x.c (xbm_instantiate_1): + * glyphs-x.c (x_xbm_instantiate): + * glyphs-x.c (extract_xpm_color_names): + * glyphs-x.c (x_xpm_instantiate): + * glyphs-x.c (x_xface_instantiate): + * glyphs-x.c (autodetect_instantiate): + * glyphs-x.c (safe_XLoadFont): + * glyphs-x.c (cursor_font_instantiate): + * glyphs-x.c (x_redisplay_widget): + * glyphs-x.c (Fchange_subwindow_property): + * glyphs-x.c (x_widget_instantiate): + * glyphs-x.c (x_tab_control_redisplay): + * glyphs.c (pixmap_to_lisp_data): + * gui-x.c (menu_separator_style_and_to_external): + * gui-x.c (add_accel_and_to_external): + * gui-x.c (button_item_to_widget_value): + * hpplay.c (player_error_internal): + * hpplay.c (play_sound_file): + * hpplay.c (play_sound_data): + * intl.c (Fset_current_locale): + * lisp.h: + * menubar-gtk.c (gtk_xemacs_set_accel_keys): + * menubar-msw.c (populate_menu_add_item): + * menubar-msw.c (populate_or_checksum_helper): + * menubar-x.c (menu_item_descriptor_to_widget_value_1): + * nt.c (init_user_info): + * nt.c (get_long_basename): + * nt.c (nt_get_resource): + * nt.c (init_mswindows_environment): + * nt.c (get_cached_volume_information): + * nt.c (mswindows_readdir): + * nt.c (read_unc_volume): + * nt.c (mswindows_stat): + * nt.c (mswindows_getdcwd): + * nt.c (mswindows_executable_type): + * nt.c (Fmswindows_short_file_name): + * ntplay.c (nt_play_sound_file): + * objects-gtk.c: + * objects-gtk.c (gtk_valid_color_name_p): + * objects-gtk.c (gtk_initialize_font_instance): + * objects-gtk.c (gtk_font_list): + * objects-msw.c (font_enum_callback_2): + * objects-msw.c (parse_font_spec): + * objects-x.c (x_parse_nearest_color): + * objects-x.c (x_valid_color_name_p): + * objects-x.c (x_initialize_font_instance): + * objects-x.c (x_font_instance_truename): + * objects-x.c (x_font_list): + * objects-xlike-inc.c (XFUN): + * objects-xlike-inc.c (xft_find_charset_font): + * process-nt.c (mswindows_report_winsock_error): + * process-nt.c (nt_create_process): + * process-nt.c (get_internet_address): + * process-nt.c (nt_open_network_stream): + * process-unix.c: + * process-unix.c (allocate_pty): + * process-unix.c (get_internet_address): + * process-unix.c (unix_canonicalize_host_name): + * process-unix.c (unix_open_network_stream): + * realpath.c: + * select-common.h (lisp_data_to_selection_data): + * select-gtk.c (symbol_to_gtk_atom): + * select-gtk.c (atom_to_symbol): + * select-msw.c (symbol_to_ms_cf): + * select-msw.c (mswindows_register_selection_data_type): + * select-x.c (symbol_to_x_atom): + * select-x.c (x_atom_to_symbol): + * select-x.c (hack_motif_clipboard_selection): + * select-x.c (Fx_store_cutbuffer_internal): + * sound.c (Fplay_sound_file): + * sound.c (Fplay_sound): + * sound.h (sound_perror): + * sysdep.c: + * sysdep.c (qxe_allocating_getcwd): + * sysdep.c (qxe_execve): + * sysdep.c (copy_in_passwd): + * sysdep.c (qxe_getpwnam): + * sysdep.c (qxe_ctime): + * sysdll.c (dll_open): + * sysdll.c (dll_function): + * sysdll.c (dll_variable): + * sysdll.c (search_linked_libs): + * sysdll.c (dll_error): + * sysfile.h: + * sysfile.h (PATHNAME_CONVERT_OUT_TSTR): + * sysfile.h (PATHNAME_CONVERT_OUT_UTF_8): + * sysfile.h (PATHNAME_CONVERT_OUT): + * sysfile.h (LISP_PATHNAME_CONVERT_OUT): + * syswindows.h (ITEXT_TO_TSTR): + * syswindows.h (LOCAL_FILE_FORMAT_TO_TSTR): + * syswindows.h (TSTR_TO_LOCAL_FILE_FORMAT): + * syswindows.h (LOCAL_FILE_FORMAT_TO_INTERNAL_MSWIN): + * syswindows.h (LISP_LOCAL_FILE_FORMAT_MAYBE_URL_TO_TSTR): + * text.h: + * text.h (eicpy_ext_len): + * text.h (enum new_dfc_src_type): + * text.h (EXTERNAL_TO_ITEXT): + * text.h (GET_STRERROR): + * tooltalk.c (check_status): + * tooltalk.c (Fadd_tooltalk_message_arg): + * tooltalk.c (Fadd_tooltalk_pattern_attribute): + * tooltalk.c (Fadd_tooltalk_pattern_arg): + * win32.c (tstr_to_local_file_format): + * win32.c (mswindows_lisp_error_1): + * win32.c (mswindows_report_process_error): + * win32.c (Fmswindows_shell_execute): + * win32.c (mswindows_read_link_1): + + Changes involving external/internal format conversion, + mostly code cleanup and renaming. + + 1. Eliminate the previous macros like LISP_STRING_TO_EXTERNAL + that stored its result in a parameter. The new version of + LISP_STRING_TO_EXTERNAL returns its result through the + return value, same as the previous NEW_LISP_STRING_TO_EXTERNAL. + Use the new-style macros throughout the code. + 2. Rename C_STRING_TO_EXTERNAL and friends to ITEXT_TO_EXTERNAL, + in keeping with overall naming rationalization involving + Itext and related types. + + Macros involved in previous two: + + EXTERNAL_TO_C_STRING -> EXTERNAL_TO_ITEXT + EXTERNAL_TO_C_STRING_MALLOC -> EXTERNAL_TO_ITEXT_MALLOC + SIZED_EXTERNAL_TO_C_STRING -> SIZED_EXTERNAL_TO_ITEXT + SIZED_EXTERNAL_TO_C_STRING_MALLOC -> SIZED_EXTERNAL_TO_ITEXT_MALLOC + C_STRING_TO_EXTERNAL -> ITEXT_TO_EXTERNAL + C_STRING_TO_EXTERNAL_MALLOC -> ITEXT_TO_EXTERNAL_MALLOC + LISP_STRING_TO_EXTERNAL + LISP_STRING_TO_EXTERNAL_MALLOC + LISP_STRING_TO_TSTR + C_STRING_TO_TSTR -> ITEXT_TO_TSTR + TSTR_TO_C_STRING -> TSTR_TO_ITEXT + + The following four still return their values through parameters, + since they have more than one value to return: + + C_STRING_TO_SIZED_EXTERNAL -> ITEXT_TO_SIZED_EXTERNAL + LISP_STRING_TO_SIZED_EXTERNAL + C_STRING_TO_SIZED_EXTERNAL_MALLOC -> ITEXT_TO_SIZED_EXTERNAL_MALLOC + LISP_STRING_TO_SIZED_EXTERNAL_MALLOC + + Sometimes additional casts had to be inserted, since the old + macros played strange games and completely defeated the type system + of the store params. + 3. Rewrite many places where direct calls to TO_EXTERNAL_FORMAT + occurred with calls to one of the convenience macros listed above, + or to make_extstring(). + 4. Eliminate SIZED_C_STRING macros (they were hardly used, anyway) + and use a direct call to TO_EXTERNAL_FORMAT or TO_INTERNAL_FORMAT. + 4. Use LISP_PATHNAME_CONVERT_OUT in many places instead of something + like LISP_STRING_TO_EXTERNAL(..., Qfile_name). + 5. Eliminate some temporary variables that are no longer necessary + now that we return a value rather than storing it into a variable. + 6. Some Mule-izing in database.c. + 7. Error functions: + -- A bit of code cleanup in maybe_signal_error_1. + -- Eliminate report_file_type_error; it's just an alias for + signal_error_2 with params in a different order. + -- Fix some places in the hostname-handling code that directly + inserted externally-retrieved error strings into the + supposed ASCII "reason" param instead of doing the right thing + and sticking text descriptive of what was going on in "reason" + and putting the external message in a frob. + 8. Use Ascbyte instead of CIbyte in process-unix.c and maybe one + or two other places. + 9. Some code cleanup in copy_in_passwd() in sysdep.c. + 10. Fix a real bug due to accidental variable shadowing in + tstr_to_local_file_format() in win32.c. + 2010-02-05 Ben Wing <ben@xemacs.org> * lisp.h:
--- a/src/console-msw.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/console-msw.c Fri Feb 05 11:53:57 2010 -0600 @@ -347,8 +347,7 @@ if (initialized && !inhibit_non_essential_conversion_operations) { TO_EXTERNAL_FORMAT (DATA, (str, len), - C_STRING_ALLOCA, extptr, - Qmswindows_tstr); + C_STRING_ALLOCA, extptr, Qmswindows_tstr); qxeOutputDebugString (extptr); } else @@ -578,12 +577,12 @@ } CHECK_STRING (message_); - LISP_STRING_TO_TSTR (message_, msgout); + msgout = LISP_STRING_TO_TSTR (message_); if (!NILP (title)) { CHECK_STRING (title); - LISP_STRING_TO_TSTR (title, titleout); + titleout = LISP_STRING_TO_TSTR (title); } {
--- a/src/console-x.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/console-x.c Fri Feb 05 11:53:57 2010 -0600 @@ -347,7 +347,7 @@ return Qnil; } - LISP_STRING_TO_EXTERNAL (key_name, keysym_ext, Qctext); + keysym_ext = LISP_STRING_TO_EXTERNAL (key_name, Qctext); xkeysym = XStringToKeysym(keysym_ext); if (NoSymbol == xkeysym) {
--- a/src/console.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/console.c Fri Feb 05 11:53:57 2010 -0600 @@ -1007,9 +1007,7 @@ Bytecount count; Extbyte *p; - TO_EXTERNAL_FORMAT (LISP_STRING, stuffstring, - ALLOCA, (p, count), - Qkeyboard); + LISP_STRING_TO_SIZED_EXTERNAL (stuffstring, p, count, Qkeyboard); while (count-- > 0) stuff_char (XCONSOLE (Vcontrolling_terminal), *p++); stuff_char (XCONSOLE (Vcontrolling_terminal), '\n');
--- a/src/database.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/database.c Fri Feb 05 11:53:57 2010 -0600 @@ -340,9 +340,8 @@ { datum keydatum, valdatum; - TO_EXTERNAL_FORMAT (LISP_STRING, key, - ALLOCA, (keydatum.dptr, keydatum.dsize), - db->coding_system); + LISP_STRING_TO_SIZED_EXTERNAL (key, keydatum.dptr, keydatum.dsize, + db->coding_system); valdatum = dbm_fetch (db->dbm_handle, keydatum); return (valdatum.dptr @@ -357,12 +356,10 @@ { datum keydatum, valdatum; - TO_EXTERNAL_FORMAT (LISP_STRING, val, - ALLOCA, (valdatum.dptr, valdatum.dsize), - db->coding_system); - TO_EXTERNAL_FORMAT (LISP_STRING, key, - ALLOCA, (keydatum.dptr, keydatum.dsize), - db->coding_system); + LISP_STRING_TO_SIZED_EXTERNAL (val, valdatum.dptr, valdatum.dsize, + db->coding_system); + LISP_STRING_TO_SIZED_EXTERNAL (key, keydatum.dptr, keydatum.dsize, + db->coding_system); return !dbm_store (db->dbm_handle, keydatum, valdatum, NILP (replace) ? DBM_INSERT : DBM_REPLACE); @@ -373,9 +370,8 @@ { datum keydatum; - TO_EXTERNAL_FORMAT (LISP_STRING, key, - ALLOCA, (keydatum.dptr, keydatum.dsize), - db->coding_system); + LISP_STRING_TO_SIZED_EXTERNAL (key, keydatum.dptr, keydatum.dsize, + db->coding_system); return dbm_delete (db->dbm_handle, keydatum); } @@ -462,9 +458,8 @@ xzero (keydatum); xzero (valdatum); - TO_EXTERNAL_FORMAT (LISP_STRING, key, - ALLOCA, (keydatum.data, keydatum.size), - db->coding_system); + LISP_STRING_TO_SIZED_EXTERNAL (key, keydatum.data, keydatum.size, + db->coding_system); #if DB_VERSION_MAJOR == 1 status = db->db_handle->get (db->db_handle, &keydatum, &valdatum, 0); @@ -498,12 +493,10 @@ xzero (keydatum); xzero (valdatum); - TO_EXTERNAL_FORMAT (LISP_STRING, key, - ALLOCA, (keydatum.data, keydatum.size), - db->coding_system); - TO_EXTERNAL_FORMAT (LISP_STRING, val, - ALLOCA, (valdatum.data, valdatum.size), - db->coding_system); + LISP_STRING_TO_SIZED_EXTERNAL (key, keydatum.data, keydatum.size, + db->coding_system); + LISP_STRING_TO_SIZED_EXTERNAL (val, valdatum.data, valdatum.size, + db->coding_system); #if DB_VERSION_MAJOR == 1 status = db->db_handle->put (db->db_handle, &keydatum, &valdatum, NILP (replace) ? R_NOOVERWRITE : 0); @@ -526,9 +519,8 @@ /* DB Version 2 requires DBT's to be zeroed before use. */ xzero (keydatum); - TO_EXTERNAL_FORMAT (LISP_STRING, key, - ALLOCA, (keydatum.data, keydatum.size), - db->coding_system); + LISP_STRING_TO_SIZED_EXTERNAL (key, keydatum.data, keydatum.size, + db->coding_system); #if DB_VERSION_MAJOR == 1 status = db->db_handle->del (db->db_handle, &keydatum, 0); @@ -653,7 +645,7 @@ int modemask; int accessmask = 0; Lisp_Database *db = NULL; - char *filename; + Extbyte *filename; struct gcpro gcpro1, gcpro2; CHECK_STRING (file); @@ -661,9 +653,7 @@ file = Fexpand_file_name (file, Qnil); UNGCPRO; - TO_EXTERNAL_FORMAT (LISP_STRING, file, - C_STRING_ALLOCA, filename, - Qfile_name); + LISP_PATHNAME_CONVERT_OUT (file, filename); if (NILP (access_)) { @@ -671,16 +661,16 @@ } else { - char *acc; + Ibyte *acc; CHECK_STRING (access_); - acc = (char *) XSTRING_DATA (access_); + acc = XSTRING_DATA (access_); - if (strchr (acc, '+')) + if (qxestrchr (acc, '+')) accessmask |= O_CREAT; { - char *rp = strchr (acc, 'r'); - char *wp = strchr (acc, 'w'); + int rp = !!qxestrchr (acc, 'r'); + int wp = !!qxestrchr (acc, 'w'); if (rp && wp) accessmask |= O_RDWR; else if (wp) accessmask |= O_WRONLY; else accessmask |= O_RDONLY;
--- a/src/device-gtk.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/device-gtk.c Fri Feb 05 11:53:57 2010 -0600 @@ -250,7 +250,7 @@ new_rc_files = xnew_array_and_zero (gchar *, num_files + 3); - LISP_STRING_TO_EXTERNAL (gtkrc, new_rc_files[0], Qfile_name); + LISP_PATHNAME_CONVERT_OUT (gtkrc, new_rc_files[0]); for (ctr = 1; default_files[ctr-1]; ctr++) new_rc_files[ctr] = g_strdup (default_files[ctr-1]);
--- a/src/device-msw.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/device-msw.c Fri Feb 05 11:53:57 2010 -0600 @@ -446,7 +446,7 @@ DEVICE_MSPRINTER_NAME (d) = printer_name; - LISP_STRING_TO_TSTR (printer_name, printer_ext); + printer_ext = LISP_STRING_TO_TSTR (printer_name); if (!qxeOpenPrinter (printer_ext, &DEVICE_MSPRINTER_HPRINTER (d), NULL)) { @@ -498,7 +498,7 @@ if (qxeGetProfileString (XETEXT ("windows"), XETEXT ("device"), NULL, name, sizeof (name) / XETCHAR_SIZE) <= 0) return Qnil; - TSTR_TO_C_STRING (name, nameint); + nameint = TSTR_TO_ITEXT (name); if (nameint[0] == '\0') return Qnil; @@ -545,7 +545,7 @@ if (!msprinter_init_device_internal (d, DEVICE_CONNECTION (d))) signal_open_printer_error (d); - LISP_STRING_TO_TSTR (DEVICE_CONNECTION (d), printer_name); + printer_name = LISP_STRING_TO_TSTR (DEVICE_CONNECTION (d)); /* Determine DEVMODE size and store the default DEVMODE */ dm_size = qxeDocumentProperties (NULL, DEVICE_MSPRINTER_HPRINTER (d), printer_name, NULL, NULL, 0); @@ -687,7 +687,7 @@ { Extbyte *nameext; - LISP_STRING_TO_TSTR (DEVICE_MSPRINTER_NAME (d), nameext); + nameext = LISP_STRING_TO_TSTR (DEVICE_MSPRINTER_NAME (d)); /* Apply the new devmode to the printer */ qxeDocumentProperties (NULL, DEVICE_MSPRINTER_HPRINTER (d), @@ -1043,7 +1043,7 @@ Extbyte *nameext; LONG dm_size; - LISP_STRING_TO_TSTR (DEVICE_MSPRINTER_NAME (d), nameext); + nameext = LISP_STRING_TO_TSTR (DEVICE_MSPRINTER_NAME (d)); dm_size = qxeDocumentProperties (NULL, DEVICE_MSPRINTER_HPRINTER (d), nameext, NULL, NULL, 0); if (dm_size <= 0)
--- a/src/device-x.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/device-x.c Fri Feb 05 11:53:57 2010 -0600 @@ -265,9 +265,9 @@ { Ibyte *app_name_int, *app_class_int, *value_addr_int; Lisp_Object codesys = coding_system_of_xrm_database (XtDatabase (dpy)); - EXTERNAL_TO_C_STRING (app_name, app_name_int, codesys); - EXTERNAL_TO_C_STRING (app_class, app_class_int, codesys); - EXTERNAL_TO_C_STRING (value.addr, value_addr_int, codesys); + app_name_int = EXTERNAL_TO_ITEXT (app_name, codesys); + app_class_int = EXTERNAL_TO_ITEXT (app_class, codesys); + value_addr_int = EXTERNAL_TO_ITEXT (value.addr, codesys); warn_when_safe (Qgeometry, Qerror, "\n" @@ -389,7 +389,7 @@ Bytecount len; Extbyte *data; - TO_EXTERNAL_FORMAT (LISP_STRING, str, ALLOCA, (data, len), Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (str, data, len, Qbinary); Dynarr_add_many (cda, data, len); validify_resource_component (Dynarr_atp (cda, Dynarr_length (cda) - len), len); @@ -624,7 +624,7 @@ make_argc_argv (Vx_initial_argv_list, &argc, &argv); - LISP_STRING_TO_EXTERNAL (display, disp_name, Qctext); + disp_name = LISP_STRING_TO_EXTERNAL (display, Qctext); /* * Break apart the old XtOpenDisplay call into XOpenDisplay and @@ -648,7 +648,7 @@ if (STRINGP (Vx_emacs_application_class) && XSTRING_LENGTH (Vx_emacs_application_class) > 0) - LISP_STRING_TO_EXTERNAL (Vx_emacs_application_class, app_class, Qctext); + app_class = LISP_STRING_TO_EXTERNAL (Vx_emacs_application_class, Qctext); else { if (egetenv ("USE_EMACS_AS_DEFAULT_APPLICATION_CLASS")) @@ -697,14 +697,13 @@ if (STRINGP (Vx_app_defaults_directory) && XSTRING_LENGTH (Vx_app_defaults_directory) > 0) { - LISP_STRING_TO_EXTERNAL (Vx_app_defaults_directory, data_dir, - Qfile_name); + LISP_PATHNAME_CONVERT_OUT (Vx_app_defaults_directory, data_dir); path = alloca_extbytes (strlen (data_dir) + strlen (locale) + 7); format = "%s%s/Emacs"; } else if (STRINGP (Vdata_directory) && XSTRING_LENGTH (Vdata_directory) > 0) { - LISP_STRING_TO_EXTERNAL (Vdata_directory, data_dir, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (Vdata_directory, data_dir); path = alloca_extbytes (strlen (data_dir) + 13 + strlen (locale) + 7); format = "%sapp-defaults/%s/Emacs"; } @@ -1692,8 +1691,8 @@ Extbyte *str, *colon_pos; CHECK_STRING (resource_line); - LISP_STRING_TO_EXTERNAL (resource_line, str, - coding_system_of_xrm_database (db)); + str = LISP_STRING_TO_EXTERNAL (resource_line, + coding_system_of_xrm_database (db)); if (!(colon_pos = strchr (str, ':')) || strchr (str, '\n')) invalid: syntax_error ("Invalid resource line", resource_line); @@ -1832,7 +1831,7 @@ const Extbyte *keysym_ext; CHECK_STRING (keysym); - LISP_STRING_TO_EXTERNAL (keysym, keysym_ext, Qctext); + keysym_ext = LISP_STRING_TO_EXTERNAL (keysym, Qctext); return XStringToKeysym (keysym_ext) ? Qt : Qnil; } @@ -2090,10 +2089,7 @@ { EXTERNAL_LIST_LOOP_2 (path_entry, font_path) - { - LISP_STRING_TO_EXTERNAL (path_entry, directories[i++], - Qfile_name); - } + LISP_PATHNAME_CONVERT_OUT (path_entry, directories[i++]); } expect_x_error (dpy);
--- a/src/dialog-msw.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/dialog-msw.c Fri Feb 05 11:53:57 2010 -0600 @@ -250,9 +250,8 @@ int length; Extbyte *uni_string; - TO_EXTERNAL_FORMAT (LISP_STRING, string, - ALLOCA, (uni_string, length), - Qmswindows_unicode); + LISP_STRING_TO_SIZED_EXTERNAL (string, uni_string, length, + Qmswindows_unicode); Dynarr_add_many (dynarr, uni_string, length); Dynarr_add (dynarr, '\0'); Dynarr_add (dynarr, '\0'); @@ -403,7 +402,7 @@ if (EQ (key, Q_title)) { CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, bi.lpszTitle, Qmswindows_tstr); + bi.lpszTitle = (XELPTSTR) LISP_STRING_TO_TSTR (value); } else if (EQ (key, Q_initial_directory)) LISP_LOCAL_FILE_FORMAT_TO_TSTR (Fexpand_file_name (value, Qnil), @@ -468,8 +467,9 @@ ofn.nMaxFile = sizeof (fnbuf) / XETCHAR_SIZE; qxetcscpy (fnbuf, XETEXT ("")); - LISP_LOCAL_FILE_FORMAT_TO_TSTR (Fexpand_file_name (build_ascstring (""), Qnil), - ofn.lpstrInitialDir); + LISP_LOCAL_FILE_FORMAT_TO_TSTR (Fexpand_file_name (build_ascstring (""), + Qnil), + ofn.lpstrInitialDir); { EXTERNAL_PROPERTY_LIST_LOOP_3 (key, value, keys) @@ -485,11 +485,11 @@ else if (EQ (key, Q_title)) { CHECK_STRING (value); - LISP_STRING_TO_TSTR (value, ofn.lpstrTitle); + ofn.lpstrTitle = (XELPTSTR) LISP_STRING_TO_TSTR (value); } else if (EQ (key, Q_initial_directory)) LISP_LOCAL_FILE_FORMAT_TO_TSTR (Fexpand_file_name (value, Qnil), - ofn.lpstrInitialDir); + ofn.lpstrInitialDir); else if (EQ (key, Q_file_must_exist)) { if (!NILP (value))
--- a/src/dialog-x.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/dialog-x.c Fri Feb 05 11:53:57 2010 -0600 @@ -171,7 +171,7 @@ wv_closure = make_opaque_ptr (kids); record_unwind_protect (widget_value_unwind, wv_closure); prev->name = xstrdup ("message"); - LISP_STRING_TO_EXTERNAL_MALLOC (question, prev->value, Qlwlib_encoding); + prev->value = LISP_STRING_TO_EXTERNAL_MALLOC (question, Qlwlib_encoding); prev->enabled = 1; {
--- a/src/editfns.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/editfns.c Fri Feb 05 11:53:57 2010 -0600 @@ -1068,14 +1068,14 @@ Extbyte *buf = alloca_extbytes (size); Extbyte *formext; /* make a copy of the static buffer returned by localtime() */ - struct tm tm = * localtime(&value); + struct tm tm = *localtime (&value); *buf = 1; /* !!#### this use of external here is not totally safe, and potentially data lossy. */ - LISP_STRING_TO_EXTERNAL (format_string, formext, - Qtime_function_encoding); + formext = LISP_STRING_TO_EXTERNAL (format_string, + Qtime_function_encoding); if (emacs_strftime (buf, size, formext, &tm) || !*buf) return build_extstring (buf, Qtime_function_encoding); @@ -1188,7 +1188,7 @@ Extbyte **oldenv = environ, **newenv; if (STRINGP (zone)) - LISP_STRING_TO_EXTERNAL (zone, tzstring, Qtime_zone_encoding); + tzstring = LISP_STRING_TO_EXTERNAL (zone, Qtime_zone_encoding); else if (INTP (zone)) { int abszone = abs (XINT (zone)); @@ -1434,7 +1434,7 @@ else { CHECK_STRING (tz); - LISP_STRING_TO_EXTERNAL (tz, tzstring, Qtime_zone_encoding); + tzstring = LISP_STRING_TO_EXTERNAL (tz, Qtime_zone_encoding); } set_time_zone_rule (tzstring);
--- a/src/emacs.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/emacs.c Fri Feb 05 11:53:57 2010 -0600 @@ -747,8 +747,8 @@ { CHECK_STRING (XCAR (next)); - LISP_STRING_TO_EXTERNAL_MALLOC (XCAR (next), (*argv) [i], - Qcommand_argument_encoding); + (*argv)[i] = LISP_STRING_TO_EXTERNAL_MALLOC (XCAR (next), + Qcommand_argument_encoding); } (*argv) [n] = 0; *argc = i; @@ -3010,15 +3010,15 @@ run_temacs_argc = nargs + 1; run_temacs_argv = xnew_array (Wexttext *, nargs + 2); - LISP_STRING_TO_EXTERNAL_MALLOC (Fcar (Vcommand_line_args), - run_temacs_argv[0], - Qcommand_argument_encoding); + run_temacs_argv[0] = + LISP_STRING_TO_EXTERNAL_MALLOC (Fcar (Vcommand_line_args), + Qcommand_argument_encoding); for (i = 0; i < nargs; i++) { CHECK_STRING (args[i]); - LISP_STRING_TO_EXTERNAL_MALLOC (args[i], run_temacs_argv[i + 1], - Qcommand_argument_encoding); + run_temacs_argv[i + 1] = + LISP_STRING_TO_EXTERNAL_MALLOC (args[i], Qcommand_argument_encoding); } run_temacs_argv[nargs + 1] = 0; @@ -3295,10 +3295,10 @@ Extbyte *filename_ext; Extbyte *symfile_ext; - LISP_STRING_TO_EXTERNAL (filename, filename_ext, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (filename, filename_ext); if (STRINGP (symfile)) - LISP_STRING_TO_EXTERNAL (symfile, symfile_ext, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (symfile, symfile_ext); else symfile_ext = 0;
--- a/src/emodules.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/emodules.c Fri Feb 05 11:53:57 2010 -0600 @@ -387,7 +387,7 @@ if (f == NULL || *f == NULL) signal_error (Qdll_error, "Invalid dynamic module: Missing symbol `emodule_name'", Qunbound); - mname = NEW_EXTERNAL_TO_C_STRING (f, Qemodule_string_encoding); + mname = EXTERNAL_TO_ITEXT (f, Qemodule_string_encoding); /* #### Not obvious we have to force an alloca copy here, but the old code did so */ IBYTE_STRING_TO_ALLOCA (mname, mname); @@ -400,7 +400,7 @@ if (f == NULL || *f == NULL) signal_error (Qdll_error, "Missing symbol `emodule_version': Invalid dynamic module", Qunbound); - mver = NEW_EXTERNAL_TO_C_STRING (f, Qemodule_string_encoding); + mver = EXTERNAL_TO_ITEXT (f, Qemodule_string_encoding); /* #### Not obvious we have to force an alloca copy here, but the old code did so */ IBYTE_STRING_TO_ALLOCA (mver, mver); @@ -410,7 +410,7 @@ if (f == NULL || *f == NULL) signal_error (Qdll_error, "Invalid dynamic module: Missing symbol `emodule_title'", Qunbound); - mtitle = NEW_EXTERNAL_TO_C_STRING (f, Qemodule_string_encoding); + mtitle = EXTERNAL_TO_ITEXT (f, Qemodule_string_encoding); /* #### Not obvious we have to force an alloca copy here, but the old code did so */ IBYTE_STRING_TO_ALLOCA (mtitle, mtitle);
--- a/src/eval.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/eval.c Fri Feb 05 11:53:57 2010 -0600 @@ -1,7 +1,7 @@ /* Evaluator for XEmacs Lisp interpreter. Copyright (C) 1985-1987, 1992-1994 Free Software Foundation, Inc. Copyright (C) 1995 Sun Microsystems, Inc. - Copyright (C) 2000, 2001, 2002, 2003, 2004 Ben Wing. + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2010 Ben Wing. This file is part of XEmacs. @@ -2610,8 +2610,7 @@ else if (ERRB_EQ (errb, ERROR_ME_WARN)) warn_when_safe_lispobj (class_, Qwarning, Fcons (sig, data)); else - for (;;) - Fsignal (sig, data); + signal_error_1 (sig, data); } /* Signal a continuable error or display a warning or do nothing, @@ -2674,6 +2673,13 @@ signal_error_1 (type, build_error_data (reason, frob)); } +/* NOTE NOTE NOTE: If you feel you need signal_ierror() or something + similar when reason is a non-ASCII message, you're probably doing + something wrong. When you have an error message from an external + source, you should put the error message as the first item in FROB and + put a string in REASON indicating what you were doing when the error + message occurred. Use signal_error_2() for such a case. */ + void maybe_signal_error (Lisp_Object type, const Ascbyte *reason, Lisp_Object frob, Lisp_Object class_,
--- a/src/event-msw.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/event-msw.c Fri Feb 05 11:53:57 2010 -0600 @@ -1811,7 +1811,6 @@ (name)) { Lisp_Object token; - Extbyte *str; HSZ hsz; struct gcpro gcpro1, gcpro2; @@ -1829,9 +1828,8 @@ token = Qnil; GCPRO2 (name, token); token = Fmake_symbol (name); - TO_EXTERNAL_FORMAT (LISP_STRING, name, C_STRING_ALLOCA, str, - Qmswindows_tstr); - hsz = qxeDdeCreateStringHandle (mswindows_dde_mlid, str, + hsz = qxeDdeCreateStringHandle (mswindows_dde_mlid, + LISP_STRING_TO_TSTR (name), XEUNICODE_P ? CP_WINUNICODE : CP_WINANSI); Fput(token, QHSZ, make_float ((int)hsz)); @@ -2020,10 +2018,10 @@ UNGCPRO; bytes = (uFmt == CF_TEXT ? 1 : 2) * (XSTRING_LENGTH (res) + 1); - TO_EXTERNAL_FORMAT (LISP_STRING, res, - C_STRING_ALLOCA, result, - uFmt == CF_TEXT ? Qmswindows_multibyte - : Qmswindows_unicode); + result = + LISP_STRING_TO_EXTERNAL (res, + uFmt == CF_TEXT ? Qmswindows_multibyte + : Qmswindows_unicode); /* If we cannot create the data handle, this passes the null * return back to the client, which signals an error as we wish. @@ -2045,9 +2043,7 @@ /* Grab a pointer to the raw data supplied */ extcmd = DdeAccessData (hdata, &len); - TO_INTERNAL_FORMAT (DATA, (extcmd, len), - LISP_STRING, tmp, - Qmswindows_tstr); + tmp = make_extstring ((Extbyte *) extcmd, len, Qmswindows_tstr); /* Release and free the data handle */ DdeUnaccessData (hdata); @@ -2078,9 +2074,7 @@ DdeGetData (hdata, (LPBYTE) extcmd, len, 0); DdeFreeDataHandle (hdata); - TO_INTERNAL_FORMAT (DATA, (extcmd, len), - C_STRING_ALLOCA, cmd, - Qmswindows_tstr); + cmd = SIZED_EXTERNAL_TO_ITEXT (extcmd, len, Qmswindows_tstr); /* Check syntax & that it's an [Open("foo")] command, which we * treat like a file drop */ @@ -2734,9 +2728,8 @@ if (XEUNICODE_P) { length = unicode_char_to_text (tranmsg.wParam, extchar); - TO_INTERNAL_FORMAT (DATA, (extchar, length), - C_STRING_ALLOCA, (intchar), - Qmswindows_unicode); + intchar = SIZED_EXTERNAL_TO_ITEXT (extchar, length, + Qmswindows_unicode); ch = itext_ichar (intchar); } else @@ -2850,10 +2843,9 @@ { Ibyte *intchar; - TO_INTERNAL_FORMAT - (DATA, - (received_keys + (tounret - 1) * 2, 2), - C_STRING_ALLOCA, intchar, + intchar = + SIZED_EXTERNAL_TO_ITEXT + (received_keys + (tounret - 1) * 2, 2, Qmswindows_unicode); XSET_EVENT_KEY_ALT_KEYCHARS (lastev, i, itext_ichar (intchar)); @@ -3199,7 +3191,7 @@ tttextw->hinst = NULL; if (!NILP (btext)) - LISP_STRING_TO_TSTR (btext, btextext); + btextext = LISP_STRING_TO_TSTR (btext); if (btextext) {
--- a/src/fileio.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/fileio.c Fri Feb 05 11:53:57 2010 -0600 @@ -138,28 +138,11 @@ EXFUN (Frunning_temacs_p, 0); -/* DATA can be anything acceptable to signal_error (). - */ - -DOESNT_RETURN -report_file_type_error (Lisp_Object errtype, Lisp_Object oserrmess, - const Ascbyte *reason, Lisp_Object data) -{ - struct gcpro gcpro1; - Lisp_Object errdata = build_error_data (NULL, data); - - GCPRO1 (errdata); - errdata = Fcons (build_msg_string (reason), - Fcons (oserrmess, errdata)); - signal_error_1 (errtype, errdata); - /* UNGCPRO; not reached */ -} - DOESNT_RETURN report_error_with_errno (Lisp_Object errtype, const Ascbyte *reason, Lisp_Object data) { - report_file_type_error (errtype, lisp_strerror (errno), reason, data); + signal_error_2 (errtype, reason, lisp_strerror (errno), data); } /* signal a file error when errno contains a meaningful value. */ @@ -2270,8 +2253,8 @@ /* netunam, being a strange-o system call only used once, is not encapsulated. */ - LISP_STRING_TO_EXTERNAL (path, path_ext, Qfile_name); - LISP_STRING_TO_EXTERNAL (login, login_ext, Quser_name_encoding); + LISP_PATHNAME_CONVERT_OUT (path, path_ext); + login_ext = LISP_STRING_TO_EXTERNAL (login, Quser_name_encoding); netresult = netunam (path_ext, login_ext); @@ -4249,19 +4232,19 @@ const Extbyte *auto_save_file_name_ext; Bytecount auto_save_file_name_ext_len; - TO_EXTERNAL_FORMAT (LISP_STRING, b->auto_save_file_name, - ALLOCA, (auto_save_file_name_ext, - auto_save_file_name_ext_len), - Qescape_quoted); + LISP_STRING_TO_SIZED_EXTERNAL (b->auto_save_file_name, + auto_save_file_name_ext, + auto_save_file_name_ext_len, + Qescape_quoted); if (!NILP (b->filename)) { const Extbyte *filename_ext; Bytecount filename_ext_len; - TO_EXTERNAL_FORMAT (LISP_STRING, b->filename, - ALLOCA, (filename_ext, - filename_ext_len), - Qescape_quoted); + LISP_STRING_TO_SIZED_EXTERNAL (b->filename, + filename_ext, + filename_ext_len, + Qescape_quoted); retry_write (listdesc, filename_ext, filename_ext_len); } retry_write (listdesc, "\n", 1);
--- a/src/font-mgr.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/font-mgr.c Fri Feb 05 11:53:57 2010 -0600 @@ -46,6 +46,8 @@ #include "hash.h" #include "font-mgr.h" +#include "sysfile.h" + /* #### TO DO #### . The "x-xft-*" and "x_xft_*" nomenclature is mostly redundant, especially if we separate X fonts from Xft fonts, and use fontconfig more generally. @@ -159,7 +161,7 @@ is a Lisp string. */ #define extract_fcapi_string(str) \ - (NEW_LISP_STRING_TO_EXTERNAL ((str), Qfc_font_name_encoding)) + (LISP_STRING_TO_EXTERNAL ((str), Qfc_font_name_encoding)) #define build_fcapi_string(str) \ (build_extstring ((Extbyte *) (str), Qfc_font_name_encoding)) @@ -782,7 +784,7 @@ if (FcConfigAppFontAddFile (XFCCONFIG_PTR (config), /* #### FIXME! is Qfile_name right? */ - (FcChar8 *) NEW_LISP_STRING_TO_EXTERNAL (file, Qfile_name)) == FcFalse) + (FcChar8 *) LISP_STRING_TO_EXTERNAL (file, Qfile_name)) == FcFalse) return Qnil; else return Qt; @@ -801,7 +803,7 @@ if (FcConfigAppFontAddDir (XFCCONFIG_PTR (config), /* #### FIXME! is Qfile_name right? */ - (FcChar8 *) NEW_LISP_STRING_TO_EXTERNAL (dir, Qfile_name)) == FcFalse) + (FcChar8 *) LISP_STRING_TO_EXTERNAL (dir, Qfile_name)) == FcFalse) return Qnil; else return Qt; @@ -844,7 +846,7 @@ { CHECK_STRING (name); /* #### FIXME! is Qfile_name right? */ - fcname = NEW_LISP_STRING_TO_EXTERNAL (name, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (name, fcname); } return (build_fcapi_string (FcConfigFilename ((FcChar8 *) fcname))); }
--- a/src/frame-gtk.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/frame-gtk.c Fri Feb 05 11:53:57 2010 -0600 @@ -332,8 +332,7 @@ for (ptr = value; *ptr; ptr++) if (!byte_ascii_p (*ptr)) { - char *tmp; - C_STRING_TO_EXTERNAL (value, tmp, Qctext); + char *tmp = ITEXT_TO_EXTERNAL (value, Qctext); the_text = tmp; break; } @@ -812,7 +811,7 @@ #endif if (STRINGP (f->name)) - TO_EXTERNAL_FORMAT (LISP_STRING, f->name, C_STRING_ALLOCA, name, Qctext); + name = LISP_STRING_TO_EXTERNAL (f->name, Qctext); else name = "emacs";
--- a/src/frame-msw.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/frame-msw.c Fri Feb 05 11:53:57 2010 -0600 @@ -252,9 +252,9 @@ const Extbyte *nameext = 0; if (STRINGP (f->name)) - LISP_STRING_TO_TSTR (f->name, nameext); + nameext = LISP_STRING_TO_TSTR (f->name); else if (STRINGP (name)) - LISP_STRING_TO_TSTR (name, nameext); + nameext = LISP_STRING_TO_TSTR (name); else nameext = XETEXT (XEMACS_CLASS); hwnd = qxeCreateWindowEx (exstyle, @@ -596,7 +596,7 @@ Extbyte *title_ext; FRAME_MSWINDOWS_TITLE_CHECKSUM (f) = new_checksum; - C_STRING_TO_TSTR (title, title_ext); + title_ext = ITEXT_TO_TSTR (title); qxeSetWindowText (FRAME_MSWINDOWS_HANDLE (f), title_ext); } } @@ -999,7 +999,7 @@ const Extbyte *nameext; if (STRINGP (f->name)) - LISP_STRING_TO_TSTR (f->name, nameext); + nameext = LISP_STRING_TO_TSTR (f->name); else nameext = XETEXT ("XEmacs print document"); di.lpszDocName = (XELPTSTR) nameext;
--- a/src/frame-x.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/frame-x.c Fri Feb 05 11:53:57 2010 -0600 @@ -651,10 +651,8 @@ for (ptr = value; *ptr; ptr++) if (!byte_ascii_p (*ptr)) { - const Extbyte *tmp; encoding = DEVICE_XATOM_COMPOUND_TEXT (XDEVICE (FRAME_DEVICE (f))); - C_STRING_TO_EXTERNAL (value, tmp, Qctext); - new_XtValue = (String) tmp; + new_XtValue = (String) ITEXT_TO_EXTERNAL (value, Qctext); break; } #endif /* MULE */ @@ -762,7 +760,7 @@ if (XSTRING_LENGTH (prop) == 0) continue; - LISP_STRING_TO_EXTERNAL (prop, extprop, Qxt_widget_arg_encoding); + extprop = LISP_STRING_TO_EXTERNAL (prop, Qxt_widget_arg_encoding); if (STRINGP (val)) { const Extbyte *extval; @@ -772,9 +770,8 @@ for the value of a widget argument; it depends on the semantics of the argument. So use of Qxt_widget_arg_encoding is totally bogus. --ben */ - TO_EXTERNAL_FORMAT (LISP_STRING, val, - ALLOCA, (extval, extvallen), - Qxt_widget_arg_encoding); + LISP_STRING_TO_SIZED_EXTERNAL (val, extval, extvallen, + Qxt_widget_arg_encoding); XtVaSetValues (w, XtVaTypedArg, extprop, /* !!#### Verify this + 1 and document as zero-termination */ @@ -854,7 +851,7 @@ internal_border_width_specified = True; } - LISP_STRING_TO_EXTERNAL (str, strext, Qxt_widget_arg_encoding); + strext = LISP_STRING_TO_EXTERNAL (str, Qxt_widget_arg_encoding); if (int_p) { CHECK_INT (val); @@ -874,9 +871,8 @@ Bytecount extvallen; CHECK_STRING (val); - TO_EXTERNAL_FORMAT (LISP_STRING, val, - ALLOCA, (extval, extvallen), - Qxt_widget_arg_encoding); + LISP_STRING_TO_SIZED_EXTERNAL (val, extval, extvallen, + Qxt_widget_arg_encoding); XtVaSetValues (w, XtVaTypedArg, /* XtN... */ strext, @@ -1037,9 +1033,9 @@ (*num_items_out)++; } eicat_ch (ei, '\0'); - SIZED_C_STRING_TO_SIZED_EXTERNAL_MALLOC (eidata (ei), eilen (ei), - dnd_data, *len_out, - encoding); + TO_EXTERNAL_FORMAT (DATA, (eidata (ei), eilen (ei)), + MALLOC, (dnd_data, *len_out), + encoding); } else { @@ -1270,8 +1266,9 @@ Ibyte *fileint; Ibyte *hurl; - EXTERNAL_TO_C_STRING (transferInfo->dropData->data.files[ii], - fileint, Qfile_name); + fileint = + EXTERNAL_TO_ITEXT (transferInfo->dropData->data.files[ii], + Qfile_name); hurl = dnd_url_hexify_string (fileint, "file:"); l_data = Fcons (build_istring (hurl), l_data); @@ -1771,7 +1768,7 @@ #endif if (STRINGP (f->name)) - LISP_STRING_TO_EXTERNAL (f->name, name, Qctext); + name = LISP_STRING_TO_EXTERNAL (f->name, Qctext); else name = "emacs";
--- a/src/glyphs-eimage.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/glyphs-eimage.c Fri Feb 05 11:53:57 2010 -0600 @@ -321,7 +321,7 @@ /* Create the message */ (*cinfo->err->format_message) (cinfo, buffer); - EXTERNAL_TO_C_STRING (buffer, intbuf, Qjpeg_error_message_encoding); + intbuf = EXTERNAL_TO_ITEXT (buffer, Qjpeg_error_message_encoding); warn_when_safe (Qjpeg, Qinfo, "%s", intbuf); } @@ -396,7 +396,7 @@ /* #### This is a definite problem under Mule due to the amount of stack data it might allocate. Need to be able to convert and write out to a file. */ - TO_EXTERNAL_FORMAT (LISP_STRING, data, ALLOCA, (bytes, len), Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (data, bytes, len, Qbinary); jpeg_memory_src (&cinfo, (JOCTET *) bytes, len); } @@ -660,7 +660,7 @@ assert (!NILP (data)); - TO_EXTERNAL_FORMAT (LISP_STRING, data, ALLOCA, (bytes, len), Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (data, bytes, len, Qbinary); mem_struct.bytes = bytes; mem_struct.len = len; mem_struct.index = 0; @@ -943,7 +943,7 @@ /* #### This is a definite problem under Mule due to the amount of stack data it might allocate. Need to think about using Lstreams */ - TO_EXTERNAL_FORMAT (LISP_STRING, data, ALLOCA, (bytes, len), Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (data, bytes, len, Qbinary); tbr.bytes = bytes; tbr.len = len; tbr.index = 0; @@ -1320,9 +1320,7 @@ /* #### This is a definite problem under Mule due to the amount of stack data it might allocate. Think about Lstreams... */ - TO_EXTERNAL_FORMAT (LISP_STRING, data, - ALLOCA, (bytes, len), - Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (data, bytes, len, Qbinary); mem_struct.bytes = bytes; mem_struct.len = len; mem_struct.index = 0;
--- a/src/glyphs-gtk.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/glyphs-gtk.c Fri Feb 05 11:53:57 2010 -0600 @@ -1089,9 +1089,9 @@ if (!NILP (mask_data)) { - TO_EXTERNAL_FORMAT (LISP_STRING, XCAR (XCDR (XCDR (mask_data))), - C_STRING_ALLOCA, gcc_may_you_rot_in_hell, - Qfile_name); + gcc_may_you_rot_in_hell = + LISP_STRING_TO_EXTERNAL (XCAR (XCDR (XCDR (mask_data))), + Qfile_name); mask = pixmap_from_xbm_inline (IMAGE_INSTANCE_DEVICE (ii), XINT (XCAR (mask_data)), @@ -1116,9 +1116,7 @@ assert (!NILP (data)); - TO_EXTERNAL_FORMAT (LISP_STRING, XCAR (XCDR (XCDR (data))), - C_STRING_ALLOCA, gcc_go_home, - Qbinary); + gcc_go_home = LISP_STRING_TO_EXTERNAL (XCAR (XCDR (XCDR (data))), Qbinary); xbm_instantiate_1 (image_instance, instantiator, pointer_fg, pointer_bg, dest_mask, XINT (XCAR (data)), @@ -1256,7 +1254,7 @@ &nsymbols); assert (!NILP (data)); - LISP_STRING_TO_EXTERNAL(data, dstring, Qbinary); + dstring = LISP_STRING_TO_EXTERNAL (data, Qbinary); /* * GTK only uses the 'c' color entry of an XPM and doesn't use the symbolic @@ -1383,7 +1381,7 @@ assert (!NILP (data)); - LISP_STRING_TO_EXTERNAL (data, dstring, Qbinary); + dstring = LISP_STRING_TO_EXTERNAL (data, Qbinary); if ((p = strchr (dstring, ':'))) { @@ -1930,9 +1928,7 @@ if (!(dest_mask & IMAGE_POINTER_MASK)) incompatible_image_types (instantiator, dest_mask, IMAGE_POINTER_MASK); - TO_EXTERNAL_FORMAT (LISP_STRING, data, - C_STRING_ALLOCA, name_ext, - Qfile_name); + name_ext = LISP_STRING_TO_EXTERNAL (data, Qfile_name); if ((i = cursor_name_to_index (name_ext)) == -1) invalid_argument ("Unrecognized cursor-font name", data); @@ -2131,7 +2127,7 @@ { char* str; Lisp_Object val = IMAGE_INSTANCE_WIDGET_TEXT (p); - LISP_STRING_TO_EXTERNAL (val, str, Qnative); + str = LISP_STRING_TO_EXTERNAL (val, Qnative); /* #### Need to special case each type of GtkWidget here! */ } @@ -2279,7 +2275,7 @@ if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii))) { - LISP_STRING_TO_EXTERNAL (IMAGE_INSTANCE_WIDGET_TEXT (ii), nm, Qnative); + nm = LISP_STRING_TO_EXTERNAL (IMAGE_INSTANCE_WIDGET_TEXT (ii), Qnative); } ii->data = xnew_and_zero (struct gtk_subwindow_data); @@ -2534,9 +2530,7 @@ name = item; } - TO_EXTERNAL_FORMAT (LISP_STRING, name, - C_STRING_ALLOCA, c_name, - Qctext); + c_name = LISP_STRING_TO_EXTERNAL (name, Qctext); /* Dummy widget that the notbook wants to display when a tab is selected. */ box = gtk_vbox_new (FALSE, 3);
--- a/src/glyphs-msw.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/glyphs-msw.c Fri Feb 05 11:53:57 2010 -0600 @@ -968,9 +968,7 @@ assert (!NILP (data)); - TO_EXTERNAL_FORMAT (LISP_STRING, data, - ALLOCA, (bytes, len), - Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (data, bytes, len, Qbinary); /* in case we have color symbols */ color_symbols = extract_xpm_color_names (device, domain, @@ -1055,9 +1053,7 @@ assert (!NILP (data)); - TO_EXTERNAL_FORMAT (LISP_STRING, data, - ALLOCA, (bytes, len), - Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (data, bytes, len, Qbinary); /* Then slurp the image into memory, decoding along the way. The result is the image in a simple one-byte-per-pixel @@ -1254,7 +1250,7 @@ type)); if (!resid) - LISP_STRING_TO_TSTR (resource_id, resid); + resid = LISP_STRING_TO_TSTR (resource_id); } } else if (!(resid = MAKEINTRESOURCE (resource_name_to_resource (resource_id, @@ -1573,9 +1569,9 @@ { Binbyte *ext_data; - TO_EXTERNAL_FORMAT (LISP_STRING, XCAR (XCDR (XCDR (mask_data))), - C_STRING_ALLOCA, ext_data, - Qbinary); + ext_data = + (Binbyte *) LISP_STRING_TO_EXTERNAL (XCAR (XCDR (XCDR (mask_data))), + Qbinary); mask = xbm_create_bitmap_from_data (hdc, ext_data, XINT (XCAR (mask_data)), @@ -1603,9 +1599,9 @@ assert (!NILP (data)); - TO_EXTERNAL_FORMAT (LISP_STRING, XCAR (XCDR (XCDR (data))), - C_STRING_ALLOCA, ext_data, - Qbinary); + ext_data = + (const Binbyte *) LISP_STRING_TO_EXTERNAL (XCAR (XCDR (XCDR (data))), + Qbinary); xbm_instantiate_1 (image_instance, instantiator, pointer_fg, pointer_bg, dest_mask, XINT (XCAR (data)), @@ -1650,9 +1646,7 @@ assert (!NILP (data)); - TO_EXTERNAL_FORMAT (LISP_STRING, data, - C_STRING_ALLOCA, dstring, - Qbinary); + dstring = (const Binbyte *) LISP_STRING_TO_EXTERNAL (data, Qbinary); if ((p = (Binbyte *) strchr ((char *) dstring, ':'))) { @@ -2032,7 +2026,7 @@ && !NILP (IMAGE_INSTANCE_WIDGET_TEXT (p))) { Extbyte *lparam = 0; - LISP_STRING_TO_TSTR (IMAGE_INSTANCE_WIDGET_TEXT (p), lparam); + lparam = LISP_STRING_TO_TSTR (IMAGE_INSTANCE_WIDGET_TEXT (p)); qxeSendMessage (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p), WM_SETTEXT, 0, (LPARAM) lparam); } @@ -2250,7 +2244,7 @@ } if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii))) - LISP_STRING_TO_TSTR (IMAGE_INSTANCE_WIDGET_TEXT (ii), nm); + nm = LISP_STRING_TO_TSTR (IMAGE_INSTANCE_WIDGET_TEXT (ii)); /* allocate space for the clip window and then allocate the clip window */ ii->data = xnew_and_zero (struct mswindows_subwindow_data); @@ -2272,7 +2266,7 @@ gui_error ("window creation failed with code", make_int (GetLastError())); - C_STRING_TO_TSTR (class_, classext); + classext = ITEXT_TO_TSTR (class_); if ((wnd = qxeCreateWindowEx (exflags /* | WS_EX_NOPARENTNOTIFY*/, classext, @@ -2486,10 +2480,11 @@ tvitem.item.lParam = mswindows_register_gui_item (image_instance, item, domain); tvitem.item.mask |= TVIF_PARAM; - LISP_STRING_TO_TSTR (XGUI_ITEM (item)->name, tvitem.item.pszText); + tvitem.item.pszText = + (LPWSTR) LISP_STRING_TO_TSTR (XGUI_ITEM (item)->name); } else - LISP_STRING_TO_TSTR (item, tvitem.item.pszText); + tvitem.item.pszText = (LPWSTR) LISP_STRING_TO_TSTR (item); tvitem.item.cchTextMax = qxetcslen ((Extbyte *) tvitem.item.pszText); @@ -2602,12 +2597,12 @@ tcitem.lParam = mswindows_register_gui_item (image_instance, item, domain); tcitem.mask |= TCIF_PARAM; - LISP_STRING_TO_TSTR (XGUI_ITEM (item)->name, tcitem.pszText); + tcitem.pszText = (XELPTSTR) LISP_STRING_TO_TSTR (XGUI_ITEM (item)->name); } else { CHECK_STRING (item); - LISP_STRING_TO_TSTR (item, tcitem.pszText); + tcitem.pszText = (XELPTSTR) LISP_STRING_TO_TSTR (item); } tcitem.cchTextMax = qxetcslen ((Extbyte *) tcitem.pszText); @@ -2813,7 +2808,7 @@ LIST_LOOP (rest, items) { Extbyte *lparam; - LISP_STRING_TO_TSTR (XCAR (rest), lparam); + lparam = LISP_STRING_TO_TSTR (XCAR (rest)); if (qxeSendMessage (wnd, CB_ADDSTRING, 0, (LPARAM)lparam) == CB_ERR) gui_error ("error adding combo entries", instantiator); } @@ -2930,8 +2925,7 @@ SIZE size; SelectObject (hdc, mswindows_widget_hfont (face, domain, string)); - TO_EXTERNAL_FORMAT (LISP_STRING, string, ALLOCA, (str, len), - Qmswindows_tstr); + LISP_STRING_TO_SIZED_EXTERNAL (string, str, len, Qmswindows_tstr); qxeGetTextExtentPoint32 (hdc, str, len / XETCHAR_SIZE, &size); *width = size.cx; }
--- a/src/glyphs-x.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/glyphs-x.c Fri Feb 05 11:53:57 2010 -0600 @@ -594,8 +594,8 @@ Extbyte *pathext; SubstitutionRec subs[1]; subs[0].match = 'B'; - LISP_STRING_TO_EXTERNAL (name, subs[0].substitution, Qfile_name); - C_STRING_TO_EXTERNAL (path, pathext, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (name, subs[0].substitution); + pathext = ITEXT_TO_EXTERNAL (path, Qfile_name); /* #### Motif uses a big hairy default if $XBMLANGPATH isn't set. We don't. If you want it used, set it. */ if (pathext && @@ -620,7 +620,7 @@ { Ibyte *path; - EXTERNAL_TO_C_STRING (value.addr, path, Qfile_name); + path = EXTERNAL_TO_ITEXT (value.addr, Qfile_name); Vx_bitmap_file_path = split_env_path (0, path); } Vx_bitmap_file_path = nconc2 (Vx_bitmap_file_path, @@ -1228,8 +1228,8 @@ { CBinbyte *ext_data; - LISP_STRING_TO_EXTERNAL (XCAR (XCDR (XCDR (mask_data))), ext_data, - Qbinary); + ext_data = LISP_STRING_TO_EXTERNAL (XCAR (XCDR (XCDR (mask_data))), + Qbinary); mask = pixmap_from_xbm_inline (IMAGE_INSTANCE_DEVICE (ii), XINT (XCAR (mask_data)), XINT (XCAR (XCDR (mask_data))), @@ -1253,7 +1253,7 @@ assert (!NILP (data)); - LISP_STRING_TO_EXTERNAL (XCAR (XCDR (XCDR (data))), ext_data, Qbinary); + ext_data = LISP_STRING_TO_EXTERNAL (XCAR (XCDR (XCDR (data))), Qbinary); xbm_instantiate_1 (image_instance, instantiator, pointer_fg, pointer_bg, dest_mask, XINT (XCAR (data)), @@ -1338,8 +1338,8 @@ if (! XAllocColor (dpy, cmap, &color)) ABORT (); /* it must be allocable since we're just duplicating it */ - TO_EXTERNAL_FORMAT (LISP_STRING, XCAR (cons), C_STRING_MALLOC, - symbols[i].name, Qctext); + + symbols[i].name = LISP_STRING_TO_EXTERNAL_MALLOC (XCAR (cons), Qctext); symbols[i].pixel = color.pixel; symbols[i].value = 0; free_cons (cons); @@ -1460,7 +1460,7 @@ { Extbyte *dataext; - LISP_STRING_TO_EXTERNAL (data, dataext, Qctext); + dataext = LISP_STRING_TO_EXTERNAL (data, Qctext); result = XpmCreatePixmapFromBuffer (dpy, @@ -1612,9 +1612,7 @@ assert (!NILP (data)); - TO_EXTERNAL_FORMAT (LISP_STRING, data, - C_STRING_ALLOCA, dstring, - Qbinary); + dstring = (const Binbyte *) LISP_STRING_TO_EXTERNAL (data, Qbinary); if ((p = (Binbyte *) strchr ((char *) dstring, ':'))) { @@ -1787,7 +1785,7 @@ if (dest_mask & IMAGE_POINTER_MASK) { const char *name_ext; - LISP_STRING_TO_EXTERNAL (data, name_ext, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (data, name_ext); if (XmuCursorNameToIndex (name_ext) != -1) { result = alist_to_tagged_vector (Qcursor_font, alist); @@ -1851,13 +1849,11 @@ { Font font; int (*old_handler) (Display *, XErrorEvent *); - Extbyte *nameext; XLoadFont_got_error = 0; XSync (dpy, 0); old_handler = XSetErrorHandler (XLoadFont_error_handler); - C_STRING_TO_EXTERNAL (name, nameext, Qfile_name); - font = XLoadFont (dpy, nameext); + font = XLoadFont (dpy, ITEXT_TO_EXTERNAL (name, Qfile_name)); XSync (dpy, 0); XSetErrorHandler (old_handler); if (XLoadFont_got_error) return 0; @@ -1990,7 +1986,7 @@ if (!(dest_mask & IMAGE_POINTER_MASK)) incompatible_image_types (instantiator, dest_mask, IMAGE_POINTER_MASK); - LISP_STRING_TO_EXTERNAL (data, name_ext, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (data, name_ext); if ((i = XmuCursorNameToIndex (name_ext)) == -1) invalid_argument ("Unrecognized cursor-font name", data); @@ -2201,7 +2197,7 @@ { Extbyte* str; Lisp_Object val = IMAGE_INSTANCE_WIDGET_TEXT (p); - LISP_STRING_TO_EXTERNAL (val, str, Qlwlib_encoding); + str = LISP_STRING_TO_EXTERNAL (val, Qlwlib_encoding); wv->value = str; } @@ -2333,8 +2329,7 @@ (FRAME_DEVICE (XFRAME (sw->frame)))); LISP_TO_EXTERNAL (property, propext, Qctext); - TO_EXTERNAL_FORMAT (LISP_STRING, data, - ALLOCA, (dataext, datalen), Qctext); + LISP_STRING_TO_SIZED_EXTERNAL (data, dataext, datalen, Qctext); property_atom = XInternAtom (dpy, propext, False); XChangeProperty (dpy, sw->subwindow, property_atom, XA_STRING, 8, PropModeReplace, dataext, datalen); @@ -2469,8 +2464,8 @@ IMAGE_INSTANCE_TYPE (ii) = IMAGE_WIDGET; if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii))) - LISP_STRING_TO_EXTERNAL (IMAGE_INSTANCE_WIDGET_TEXT (ii), nm, - Qlwlib_encoding); + nm = LISP_STRING_TO_EXTERNAL (IMAGE_INSTANCE_WIDGET_TEXT (ii), + Qlwlib_encoding); ii->data = xnew_and_zero (struct x_subwindow_data); @@ -2776,8 +2771,9 @@ unsigned int num_children, i; Widget* children; - LISP_STRING_TO_EXTERNAL (XGUI_ITEM (XCAR (rest))->name, - name, Qlwlib_encoding); + name = + LISP_STRING_TO_EXTERNAL (XGUI_ITEM (XCAR (rest))->name, + Qlwlib_encoding); /* The name may contain a `.' which confuses XtNameToWidget, so we do it ourselves. */ children =
--- a/src/glyphs.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/glyphs.c Fri Feb 05 11:53:57 2010 -0600 @@ -2951,7 +2951,7 @@ Ibyte *resolved; LISP_PATHNAME_RESOLVE_LINKS (name, resolved); - C_STRING_TO_EXTERNAL (resolved, fname, Qfile_name); + fname = ITEXT_TO_EXTERNAL (resolved, Qfile_name); result = XpmReadFileToData (fname, &data); if (result == XpmSuccess)
--- a/src/gui-x.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/gui-x.c Fri Feb 05 11:53:57 2010 -0600 @@ -360,10 +360,7 @@ : xstrdup ("shadowDoubleEtchedIn")); else if (*p == ':') { - Extbyte *retval; - - C_STRING_TO_EXTERNAL_MALLOC (p + 1, retval, Qlwlib_encoding); - return retval; + return ITEXT_TO_EXTERNAL_MALLOC (p + 1, Qlwlib_encoding); } return NULL; @@ -385,7 +382,7 @@ } if (found_accel) - LISP_STRING_TO_EXTERNAL_MALLOC (string, retval, Qlwlib_encoding); + retval = LISP_STRING_TO_EXTERNAL_MALLOC (string, Qlwlib_encoding); else { Bytecount namelen = XSTRING_LENGTH (string); @@ -393,7 +390,7 @@ chars[0] = '%'; chars[1] = '_'; memcpy (chars + 2, name, namelen + 1); - C_STRING_TO_EXTERNAL_MALLOC (chars, retval, Qlwlib_encoding); + retval = ITEXT_TO_EXTERNAL_MALLOC (chars, Qlwlib_encoding); } return retval; @@ -417,7 +414,7 @@ if (accel_p) wv->name = add_accel_and_to_external (gui_item); else - LISP_STRING_TO_EXTERNAL_MALLOC (gui_item, wv->name, Qlwlib_encoding); + wv->name = LISP_STRING_TO_EXTERNAL_MALLOC (gui_item, Qlwlib_encoding); return 1; } else if (!GUI_ITEMP (gui_item)) @@ -447,7 +444,7 @@ } else { - LISP_STRING_TO_EXTERNAL_MALLOC (pgui->name, wv->name, Qlwlib_encoding); + wv->name = LISP_STRING_TO_EXTERNAL_MALLOC (pgui->name, Qlwlib_encoding); wv->accel = LISP_TO_VOID (Qnil); } @@ -464,7 +461,7 @@ CHECK_STRING (suffix2); } - LISP_STRING_TO_EXTERNAL_MALLOC (suffix2, wv->value, Qlwlib_encoding); + wv->value = LISP_STRING_TO_EXTERNAL_MALLOC (suffix2, Qlwlib_encoding); } wv_set_evalable_slot (wv->enabled, pgui->active); @@ -486,7 +483,7 @@ CHECK_STRING (pgui->keys); pgui->keys = Fsubstitute_command_keys (pgui->keys); if (XSTRING_LENGTH (pgui->keys) > 0) - LISP_STRING_TO_EXTERNAL_MALLOC (pgui->keys, wv->key, Qlwlib_encoding); + wv->key = LISP_STRING_TO_EXTERNAL_MALLOC (pgui->keys, Qlwlib_encoding); else wv->key = 0; } @@ -496,7 +493,7 @@ /* #### Warning, dependency here on current_buffer and point */ where_is_to_char (pgui->callback, buf); if (eilen (buf) > 0) - C_STRING_TO_EXTERNAL_MALLOC (eidata (buf), wv->key, Qlwlib_encoding); + wv->key = ITEXT_TO_EXTERNAL_MALLOC (eidata (buf), Qlwlib_encoding); else wv->key = 0; eifree (buf);
--- a/src/hpplay.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/hpplay.c Fri Feb 05 11:53:57 2010 -0600 @@ -73,7 +73,7 @@ Ibyte *interr; AGetErrorText (audio, errorCode, errorbuff, 131); - EXTERNAL_TO_C_STRING (errorbuf, interr, Qerror_message_encoding); + interr = EXTERNAL_TO_ITEXT (errorbuf, Qerror_message_encoding); signal_error (Qsound_error, text, build_istring (interr)); } @@ -148,8 +148,8 @@ Extbyte *server; if (STRINGP (Vhp_play_server)) - LISP_STRING_TO_EXTERNAL (Vhp_play_server, server, - Qunix_host_name_encoding); + server = LISP_STRING_TO_EXTERNAL (Vhp_play_server, + Qunix_host_name_encoding); else server = ""; @@ -202,8 +202,8 @@ if (STRINGP (Vhp_play_server)) - LISP_STRING_TO_EXTERNAL (Vhp_play_server, server, - Qunix_host_name_encoding); + server = LISP_STRING_TO_EXTERNAL (Vhp_play_server, + Qunix_host_name_encoding); else server = "";
--- a/src/intl.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/intl.c Fri Feb 05 11:53:57 2010 -0600 @@ -75,7 +75,7 @@ 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 = LISP_STRING_TO_EXTERNAL (locale, Qctext); loc = setlocale (LC_ALL, loc); if (!loc) return Qnil;
--- a/src/lisp.h Fri Feb 05 10:50:06 2010 -0700 +++ b/src/lisp.h Fri Feb 05 11:53:57 2010 -0600 @@ -5181,10 +5181,6 @@ DECLARE_DOESNT_RETURN (report_error_with_errno (Lisp_Object errtype, const Ascbyte *reason, Lisp_Object data)); -DECLARE_DOESNT_RETURN (report_file_type_error (Lisp_Object errtype, - Lisp_Object oserrmess, - const Ascbyte *reason, - Lisp_Object data)); DECLARE_DOESNT_RETURN (report_file_error (const Ascbyte *, Lisp_Object)); Lisp_Object lisp_strerror (int); Lisp_Object expand_and_dir_to_file (Lisp_Object, Lisp_Object);
--- a/src/menubar-gtk.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/menubar-gtk.c Fri Feb 05 11:53:57 2010 -0600 @@ -260,9 +260,7 @@ /* Set the string straight from the object. */ if (STRINGP (keys) && XSTRING_LENGTH (keys)) { - C_STRING_TO_EXTERNAL_MALLOC(XSTRING_DATA (keys), - l->label.accel_string, - Qctext); + l->label.accel_string = ITEXT_TO_EXTERNAL_MALLOC (XSTRING_DATA (keys), Qctext); } else {
--- a/src/menubar-msw.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/menubar-msw.c Fri Feb 05 11:53:57 2010 -0600 @@ -241,12 +241,9 @@ item_info.fType = MFT_SEPARATOR; else { - Extbyte *itemext; - item_info.fType = MFT_STRING; item_info.fState = MFS_DISABLED; - LISP_STRING_TO_TSTR (item, itemext); - item_info.dwTypeData = (XELPTSTR) itemext; + item_info.dwTypeData = (XELPTSTR) LISP_STRING_TO_TSTR (item); } } else if (CONSP (item)) @@ -257,7 +254,6 @@ Lisp_Gui_Item *pgui_item = XGUI_ITEM (gui_item); struct gcpro gcpro1, gcpro2, gcpro3; Ichar accel; - Extbyte *itemext; GCPRO3 (gui_item, path, *accel_list); @@ -281,9 +277,8 @@ submenu = create_empty_popup_menu (); item_info.fMask |= MIIM_SUBMENU; - LISP_STRING_TO_TSTR (displayable_menu_item (gui_item, bar_p, &accel), - itemext); - item_info.dwTypeData = (XELPTSTR) itemext; + item_info.dwTypeData = (XELPTSTR) + LISP_STRING_TO_TSTR (displayable_menu_item (gui_item, bar_p, &accel)); item_info.hSubMenu = submenu; if (accel && bar_p) @@ -315,7 +310,6 @@ Lisp_Gui_Item *pgui_item = XGUI_ITEM (gui_item); struct gcpro gcpro1, gcpro2; Ichar accel; - Extbyte *itemext; GCPRO2 (gui_item, *accel_list); @@ -348,9 +342,8 @@ item_info.wID = (UINT) XINT (id); item_info.fType |= MFT_STRING; - LISP_STRING_TO_TSTR (displayable_menu_item (gui_item, bar_p, &accel), - itemext); - item_info.dwTypeData = (XELPTSTR) itemext; + item_info.dwTypeData = (XELPTSTR) + LISP_STRING_TO_TSTR (displayable_menu_item (gui_item, bar_p, &accel)); if (accel && bar_p) *accel_list = Fcons (make_char (accel), *accel_list); @@ -449,12 +442,9 @@ two separators in X... In Windows this looks ugly, anyways.) */ if (!bar_p && !deep_p && popup_menu_titles && !NILP (pgui_item->name)) { - Extbyte *nameext; - - LISP_STRING_TO_TSTR (displayable_menu_item (gui_item, bar_p, NULL), - nameext); qxeInsertMenu (menu, 0, MF_BYPOSITION | MF_STRING | MF_DISABLED, - 0, nameext); + 0, LISP_STRING_TO_TSTR (displayable_menu_item + (gui_item, bar_p, NULL))); qxeInsertMenu (menu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); SetMenuDefaultItem (menu, 0, MF_BYPOSITION); }
--- a/src/menubar-x.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/menubar-x.c Fri Feb 05 11:53:57 2010 -0600 @@ -122,7 +122,7 @@ } else { - LISP_STRING_TO_EXTERNAL_MALLOC (desc, wv->name, Qlwlib_encoding); + wv->name = LISP_STRING_TO_EXTERNAL_MALLOC (desc, Qlwlib_encoding); wv->enabled = 1; /* dverna Dec. 98: command_builder_operate_menu_accelerator will manipulate the accel as a Lisp_Object if the widget has a name.
--- a/src/nt.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/nt.c Fri Feb 05 11:53:57 2010 -0600 @@ -158,7 +158,7 @@ && qxeLookupAccountSid (NULL, sidinfo.User.Sid, name, &length, domain, &dlength, &user_type)) { - TSTR_TO_C_STRING_MALLOC (name, the_passwd.pw_name); + the_passwd.pw_name = TSTR_TO_ITEXT_MALLOC (name); /* Determine a reasonable uid value. */ if (qxestrcasecmp ("administrator", the_passwd.pw_name) == 0) { @@ -202,7 +202,7 @@ are running under Windows 95), fallback to this. */ else if (qxeGetUserName (name, &length)) { - TSTR_TO_C_STRING_MALLOC (name, the_passwd.pw_name); + the_passwd.pw_name = TSTR_TO_ITEXT_MALLOC (name); if (qxestrcasecmp ("administrator", the_passwd.pw_name) == 0) the_passwd.pw_uid = 0; else @@ -223,7 +223,7 @@ DWORD length = UNLEN + 1; Extbyte name[MAX_XETCHAR_SIZE * (UNLEN + 1)]; if (qxeGetUserName (name, &length)) - TSTR_TO_C_STRING_MALLOC (name, the_passwd.pw_name); + the_passwd.pw_name = TSTR_TO_ITEXT_MALLOC (name); else the_passwd.pw_name = "unknown"; #endif @@ -301,7 +301,7 @@ { Ibyte *fileint; - TSTR_TO_C_STRING_MALLOC (find_data.cFileName, fileint); + fileint = TSTR_TO_ITEXT_MALLOC (find_data.cFileName); FindClose (dir_handle); return fileint; } @@ -377,7 +377,7 @@ DWORD cbData; Extbyte *keyext; - C_STRING_TO_TSTR (key, keyext); + keyext = ITEXT_TO_TSTR (key); /* Check both the current user and the local machine to see if we have any resources. */ @@ -488,14 +488,14 @@ cch = qxeExpandEnvironmentStrings ((Extbyte *) lpval, buf, 0); buf = alloca_extbytes (cch * XETCHAR_SIZE); qxeExpandEnvironmentStrings ((Extbyte *) lpval, buf, cch); - TSTR_TO_C_STRING (buf, envval); + envval = TSTR_TO_ITEXT (buf); eputenv (env_vars[i], (CIbyte *) envval); } else if (dwType == REG_SZ) { Ibyte *envval; - TSTR_TO_C_STRING (lpval, envval); + envval = TSTR_TO_ITEXT (lpval); eputenv (env_vars[i], (CIbyte *) envval); } @@ -635,7 +635,7 @@ rootext = alloca_extbytes (nchars * XETCHAR_SIZE); if (!qxeGetCurrentDirectory (nchars, rootext)) return NULL; - TSTR_TO_C_STRING (rootext, default_root); + default_root = TSTR_TO_ITEXT (rootext); parse_root (default_root, &root_dir); *root_dir = 0; root_dir = default_root; @@ -709,11 +709,11 @@ xfree (info->type); } - TSTR_TO_C_STRING_MALLOC (name, info->name); + info->name = TSTR_TO_ITEXT_MALLOC (name); info->serialnum = serialnum; info->maxcomp = maxcomp; info->flags = flags; - TSTR_TO_C_STRING_MALLOC (type, info->type); + info->type = TSTR_TO_ITEXT_MALLOC (type); info->timestamp = GetTickCount (); } @@ -885,13 +885,13 @@ if (dir_find_handle == INVALID_HANDLE_VALUE) return NULL; - TSTR_TO_C_STRING (dir_find_data.cFileName, val); + val = TSTR_TO_ITEXT (dir_find_data.cFileName); } else { if (!qxeFindNextFile (dir_find_handle, &dir_find_data)) return NULL; - TSTR_TO_C_STRING (dir_find_data.cFileName, val); + val = TSTR_TO_ITEXT (dir_find_data.cFileName); } /* XEmacs never uses this value, so don't bother making it match @@ -998,7 +998,7 @@ return NULL; /* WNetEnumResource returns \\resource\share...skip forward to "share". */ - TSTR_TO_C_STRING (((LPNETRESOURCEW) buf)->lpRemoteName, ptr); + ptr = TSTR_TO_ITEXT (((LPNETRESOURCEW) buf)->lpRemoteName); INC_IBYTEPTR (ptr); INC_IBYTEPTR (ptr); while (*ptr && !IS_DIRECTORY_SEP (itext_ichar (ptr))) @@ -1564,7 +1564,7 @@ qxestrcat (name, (Ibyte *) "\\"); /* File has already been resolved and we don't want to do it again in case of lstat() */ - C_STRING_TO_TSTR (name, nameext); + nameext = ITEXT_TO_TSTR (name); if (qxeGetDriveType (nameext) < 2) { SetErrorMode (errm); @@ -1605,7 +1605,7 @@ } else { - C_STRING_TO_TSTR (name, nameext); + nameext = ITEXT_TO_TSTR (name); fh = qxeFindFirstFile (nameext, &wfd); if (fh == INVALID_HANDLE_VALUE) { @@ -1630,7 +1630,7 @@ if (!NILP (Vmswindows_get_true_file_attributes)) /* File has already been resolved and we don't want to do it again in case of lstat() */ - C_STRING_TO_TSTR (name, nameext); + nameext = ITEXT_TO_TSTR (name); if (!NILP (Vmswindows_get_true_file_attributes) /* No access rights required to get info. */ && (fh = qxeCreateFile (nameext, 0, 0, NULL, OPEN_EXISTING, 0, NULL)) @@ -1841,7 +1841,7 @@ else cwdext = _getdcwd (drivelet, NULL, 0); if (cwdext == NULL) return NULL; - TSTR_TO_C_STRING_MALLOC (cwdext, cwd); + cwd = TSTR_TO_ITEXT_MALLOC (cwdext); xfree (cwdext); return cwd; } @@ -2052,7 +2052,7 @@ (Extbyte *) RVA_TO_PTR (imports->Name, section, executable); Ibyte *dllname; - EXTERNAL_TO_C_STRING (dllname_ext, dllname, Qbinary); + dllname = EXTERNAL_TO_ITEXT (dllname_ext, Qbinary); /* The exact name of the cygwin dll has changed with various releases, but hopefully this will be reasonably @@ -2106,7 +2106,7 @@ sizeof (shortname) / XETCHAR_SIZE) == 0) return Qnil; - TSTR_TO_C_STRING (shortname, shortint); + shortint = TSTR_TO_ITEXT (shortname); MSWINDOWS_NORMALIZE_FILENAME (shortint); return build_istring (shortint);
--- a/src/ntplay.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/ntplay.c Fri Feb 05 11:53:57 2010 -0600 @@ -41,7 +41,7 @@ Lisp_Object fname = Ffile_name_nondirectory (path); Extbyte *fnameext; - LISP_STRING_TO_TSTR (fname, fnameext); + fnameext = LISP_STRING_TO_TSTR (fname); if (qxeSearchPath (NULL, fnameext, NULL, 0, NULL, NULL) == 0) {
--- a/src/objects-gtk.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/objects-gtk.c Fri Feb 05 11:53:57 2010 -0600 @@ -208,7 +208,7 @@ GdkColor c; const char *extname; - TO_EXTERNAL_FORMAT (LISP_STRING, color, C_STRING_ALLOCA, extname, Qctext); + extname = LISP_STRING_TO_EXTERNAL (color, Qctext); if (gdk_color_parse (extname, &c) != TRUE) return(0); @@ -237,7 +237,7 @@ XFontStruct *xf; const char *extname; - TO_EXTERNAL_FORMAT (LISP_STRING, f->name, C_STRING_ALLOCA, extname, Qctext); + extname = LISP_STRING_TO_EXTERNAL (f->name, Qctext); gf = gdk_font_load (extname); @@ -383,7 +383,7 @@ { const char *patternext; - TO_EXTERNAL_FORMAT (LISP_STRING, pattern, C_STRING_ALLOCA, patternext, Qbinary); + patternext = LISP_STRING_TO_EXTERNAL (pattern, Qbinary); return (__gtk_font_list_internal (patternext)); }
--- a/src/objects-msw.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/objects-msw.c Fri Feb 05 11:53:57 2010 -0600 @@ -1109,7 +1109,7 @@ * weights unspecified. This means that we have to weed out duplicates of * those fonts that do get enumerated with different weights. */ - TSTR_TO_C_STRING (lpelfe->elfLogFont.lfFaceName, facename); + facename = TSTR_TO_ITEXT (lpelfe->elfLogFont.lfFaceName); if (itext_ichar (facename) == '@') /* This is a font for writing vertically. We ignore it. */ return 1; @@ -1489,7 +1489,7 @@ { Extbyte *extfontname; - C_STRING_TO_TSTR (fontname, extfontname); + extfontname = ITEXT_TO_TSTR (fontname); if (logfont) { qxetcsncpy ((Extbyte *) logfont->lfFaceName, extfontname,
--- a/src/objects-x.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/objects-x.c Fri Feb 05 11:53:57 2010 -0600 @@ -67,7 +67,7 @@ { const Extbyte *extname; - LISP_STRING_TO_EXTERNAL (name, extname, Qx_color_name_encoding); + extname = LISP_STRING_TO_EXTERNAL (name, Qx_color_name_encoding); result = XParseColor (dpy, cmap, extname, color); } if (!result) @@ -194,7 +194,7 @@ Colormap cmap = DEVICE_X_COLORMAP (d); const Extbyte *extname; - LISP_STRING_TO_EXTERNAL (color, extname, Qx_color_name_encoding); + extname = LISP_STRING_TO_EXTERNAL (color, Qx_color_name_encoding); return XParseColor (dpy, cmap, extname, &c); } @@ -232,10 +232,10 @@ The problem is that the fontconfig/Xft functions work much too hard to ensure that something is returned; but that something need not be at all close to what we asked for. */ - LISP_STRING_TO_EXTERNAL (f->name, extname, Qfc_font_name_encoding); + extname = LISP_STRING_TO_EXTERNAL (f->name, Qfc_font_name_encoding); rf = xft_open_font_by_name (dpy, extname); #endif - LISP_STRING_TO_EXTERNAL (f->name, extname, Qx_font_name_encoding); + extname = LISP_STRING_TO_EXTERNAL (f->name, Qx_font_name_encoding); /* With XFree86 4.0's fonts, XListFonts returns an entry for -isas-fangsong ti-medium-r-normal--16-160-72-72-c-160-gb2312.1980-0 but an XLoadQueryFont on the corresponding XLFD returns NULL. @@ -785,7 +785,7 @@ if (NILP (FONT_INSTANCE_TRUENAME (f)) && FONT_INSTANCE_X_FONT (f)) { - nameext = NEW_LISP_STRING_TO_EXTERNAL (f->name, Qx_font_name_encoding); + nameext = LISP_STRING_TO_EXTERNAL (f->name, Qx_font_name_encoding); FONT_INSTANCE_TRUENAME (f) = x_font_truename (dpy, nameext, FONT_INSTANCE_X_FONT (f)); } @@ -880,7 +880,7 @@ Lisp_Object result = Qnil; const Extbyte *patternext; - LISP_STRING_TO_EXTERNAL (pattern, patternext, Qx_font_name_encoding); + patternext = LISP_STRING_TO_EXTERNAL (pattern, Qx_font_name_encoding); if (!NILP(maxnumber) && INTP(maxnumber)) {
--- a/src/objects-xlike-inc.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/objects-xlike-inc.c Fri Feb 05 11:53:57 2010 -0600 @@ -116,7 +116,7 @@ if (!NILP(reloc)) { the_nonreloc = XSTRING_DATA (reloc); - LISP_STRING_TO_EXTERNAL (reloc, extname, Qx_font_name_encoding); + extname = LISP_STRING_TO_EXTERNAL (reloc, Qx_font_name_encoding); rf = xft_open_font_by_name (dpy, extname); return 0; /* #### maybe this will compile and run ;) */ /* Jesus, Stephen, what the fuck? */ @@ -425,7 +425,7 @@ DECLARE_EISTRING (eistr_longname); /* omit FC_LANG and FC_CHARSET */ DECLARE_EISTRING (eistr_fullname); /* everything */ - LISP_STRING_TO_EXTERNAL (font, patternext, Qfc_font_name_encoding); + patternext = LISP_STRING_TO_EXTERNAL (font, Qfc_font_name_encoding); fcc = FcConfigGetCurrent (); /* parse the name, do the substitutions, and match the font */
--- a/src/process-nt.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/process-nt.c Fri Feb 05 11:53:57 2010 -0600 @@ -696,8 +696,7 @@ mswindows_report_winsock_error (const Ascbyte *reason, Lisp_Object data, int errnum) { - report_file_type_error (Qnetwork_error, mswindows_lisp_error (errnum), - reason, data); + signal_error_2 (Qnetwork_error, reason, mswindows_lisp_error (errnum), data); } static void @@ -861,7 +860,7 @@ args_or_ret); /* #### What about path names, which may be links? */ - LISP_STRING_TO_TSTR (args_or_ret, command_line); + command_line = LISP_STRING_TO_TSTR (args_or_ret); UNGCPRO; /* args_or_ret */ } @@ -1237,7 +1236,7 @@ Extbyte *hostext; unsigned long inaddr; - LISP_STRING_TO_EXTERNAL (host, hostext, Qmswindows_host_name_encoding); + hostext = LISP_STRING_TO_EXTERNAL (host, Qmswindows_host_name_encoding); inaddr = inet_addr (hostext); if (inaddr != INADDR_NONE) { @@ -1255,7 +1254,7 @@ { Extbyte *hostext; - LISP_STRING_TO_EXTERNAL (host, hostext, Qmswindows_host_name_encoding); + hostext = LISP_STRING_TO_EXTERNAL (host, Qmswindows_host_name_encoding); hasync = WSAAsyncGetHostByName (hwnd, XM_SOCKREPLY, hostext, buf, sizeof (buf)); @@ -1349,8 +1348,8 @@ Extbyte *servext; CHECK_STRING (service); - LISP_STRING_TO_EXTERNAL (service, servext, - Qmswindows_service_name_encoding); + servext = LISP_STRING_TO_EXTERNAL (service, + Qmswindows_service_name_encoding); svc_info = getservbyname (servext, "tcp"); if (svc_info == 0)
--- a/src/process-unix.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/process-unix.c Fri Feb 05 11:53:57 2010 -0600 @@ -222,8 +222,8 @@ grovelling code in allocate_pty_the_old_fashioned_way(). */ int master_fd = -1; const Extbyte *slave_name = NULL; - const CIbyte *clone = NULL; - static const CIbyte * const clones[] = + const Ascbyte *clone = NULL; + static const Ascbyte * const clones[] = /* Different pty master clone devices */ { "/dev/ptmx", /* Various systems */ @@ -307,7 +307,7 @@ { Ibyte *slaveint; - EXTERNAL_TO_C_STRING (slave_name, slaveint, Qfile_name); + slaveint = EXTERNAL_TO_ITEXT (slave_name, Qfile_name); qxestrncpy (pty_name, slaveint, sizeof (pty_name)); } @@ -334,9 +334,7 @@ struct group *tty_group = getgrnam ("tty"); if (tty_group != NULL) { - Extbyte *ptyout; - - C_STRING_TO_EXTERNAL (pty_name, ptyout, Qfile_name); + Extbyte *ptyout = ITEXT_TO_EXTERNAL (pty_name, Qfile_name); chown (ptyout, (uid_t) -1, tty_group->gr_gid); } } @@ -458,7 +456,7 @@ h_errno = 0; #endif - LISP_STRING_TO_EXTERNAL (host, hostext, Qunix_host_name_encoding); + hostext = LISP_STRING_TO_EXTERNAL (host, Qunix_host_name_encoding); /* Some systems can't handle SIGIO/SIGALARM in gethostbyname. */ slow_down_interrupts (); @@ -482,7 +480,7 @@ Extbyte *hostext; /* Attempt to interpret host as numeric inet address */ - LISP_STRING_TO_EXTERNAL (host, hostext, Qunix_host_name_encoding); + hostext = LISP_STRING_TO_EXTERNAL (host, Qunix_host_name_encoding); numeric_addr = inet_addr (hostext); if (NUMERIC_ADDR_ERROR) { @@ -524,10 +522,9 @@ Extbyte *tailportext; CHECK_STRING (tail_port); - TO_EXTERNAL_FORMAT (LISP_STRING, tail_port, C_STRING_ALLOCA, - tailportext, Qunix_service_name_encoding); - - svc_info = getservbyname (tailportext, proto); + svc_info = getservbyname (LISP_STRING_TO_EXTERNAL + (tail_port, Qunix_service_name_encoding), + proto); if ((svc_info != 0) && (svc_info->s_port == port)) break; else @@ -1816,16 +1813,14 @@ #endif hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = 0; - LISP_STRING_TO_EXTERNAL (host, ext_host, Qunix_host_name_encoding); + ext_host = LISP_STRING_TO_EXTERNAL (host, Qunix_host_name_encoding); retval = getaddrinfo (ext_host, NULL, &hints, &res); if (retval != 0) { - CIbyte *gai_err; - - EXTERNAL_TO_C_STRING (gai_strerror (retval), gai_err, - Qstrerror_encoding); - maybe_signal_error (Qio_error, gai_err, host, - Qprocess, ERROR_ME_DEBUG_WARN); + maybe_signal_error_2 (Qio_error, "Canonicalizing host name", + build_extstring (gai_strerror (retval), + Qstrerror_encoding), + host, Qprocess, ERROR_ME_DEBUG_WARN); canonname = host; } else @@ -1901,8 +1896,8 @@ else { CHECK_STRING (service); - LISP_STRING_TO_EXTERNAL (service, portstring, - Qunix_service_name_encoding); + portstring = LISP_STRING_TO_EXTERNAL (service, + Qunix_service_name_encoding); port = 0; } @@ -1914,15 +1909,14 @@ else /* EQ (protocol, Qudp) */ hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = 0; - LISP_STRING_TO_EXTERNAL (host, ext_host, Qunix_host_name_encoding); + ext_host = LISP_STRING_TO_EXTERNAL (host, Qunix_host_name_encoding); retval = getaddrinfo (ext_host, portstring, &hints, &res); if (retval != 0) { - CIbyte *gai_err; - - EXTERNAL_TO_C_STRING (gai_strerror (retval), gai_err, - Qstrerror_encoding); - signal_error (Qio_error, gai_err, list2 (host, service)); + signal_error_2 (Qio_error, "Converting host name to IP address", + build_extstring (gai_strerror (retval), + Qstrerror_encoding), + list2 (host, service)); } /* address loop */ @@ -1941,8 +1935,8 @@ Extbyte *servext; CHECK_STRING (service); - LISP_STRING_TO_EXTERNAL (service, servext, - Qunix_service_name_encoding); + servext = LISP_STRING_TO_EXTERNAL (service, + Qunix_service_name_encoding); if (EQ (protocol, Qtcp)) svc_info = getservbyname (servext, "tcp");
--- a/src/realpath.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/realpath.c Fri Feb 05 11:53:57 2010 -0600 @@ -218,7 +218,7 @@ Extbyte *nameext; HANDLE dir_handle; - C_STRING_TO_TSTR (name, nameext); + nameext = ITEXT_TO_TSTR (name); dir_handle = qxeFindFirstFile (nameext, &find_data); if (dir_handle == INVALID_HANDLE_VALUE) {
--- a/src/select-common.h Fri Feb 05 10:50:06 2010 -0700 +++ b/src/select-common.h Fri Feb 05 11:53:57 2010 -0600 @@ -199,9 +199,8 @@ const Extbyte *extval; Bytecount extvallen; - TO_EXTERNAL_FORMAT (LISP_STRING, obj, - ALLOCA, (extval, extvallen), - (NILP (type) ? Qctext : Qbinary)); + LISP_STRING_TO_SIZED_EXTERNAL (obj, extval, extvallen, + (NILP (type) ? Qctext : Qbinary)); *format_ret = 8; *size_ret = extvallen; *data_ret = xnew_rawbytes (*size_ret);
--- a/src/select-gtk.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/select-gtk.c Fri Feb 05 11:53:57 2010 -0600 @@ -59,7 +59,7 @@ { const Extbyte *nameext; - LISP_STRING_TO_EXTERNAL (Fsymbol_name (sym), nameext, Qctext); + nameext = LISP_STRING_TO_EXTERNAL (Fsymbol_name (sym), Qctext); return gdk_atom_intern (nameext, only_if_exists ? TRUE : FALSE); } } @@ -76,7 +76,7 @@ if (! str) return Qnil; - EXTERNAL_TO_C_STRING (str, intstr, Qctext); + intstr = EXTERNAL_TO_ITEXT (str, Qctext); g_free (str); return intern_istring (intstr); }
--- a/src/select-msw.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/select-msw.c Fri Feb 05 11:53:57 2010 -0600 @@ -109,7 +109,7 @@ if (STRINGP (value)) { Extbyte *valext; - LISP_STRING_TO_TSTR (value, valext); + valext = LISP_STRING_TO_TSTR (value); return qxeRegisterClipboardFormat (valext); } @@ -438,7 +438,7 @@ Extbyte *nameext; UINT format; - LISP_STRING_TO_TSTR (type_name, nameext); + nameext = LISP_STRING_TO_TSTR (type_name); format = qxeRegisterClipboardFormat (nameext); if (format)
--- a/src/select-x.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/select-x.c Fri Feb 05 11:53:57 2010 -0600 @@ -139,7 +139,7 @@ { const Extbyte *nameext; - LISP_STRING_TO_EXTERNAL (Fsymbol_name (sym), nameext, Qctext); + nameext = LISP_STRING_TO_EXTERNAL (Fsymbol_name (sym), Qctext); return XInternAtom (display, nameext, only_if_exists ? True : False); } } @@ -188,9 +188,7 @@ if (! str) return Qnil; - TO_INTERNAL_FORMAT (C_STRING, str, - C_STRING_ALLOCA, intstr, - Qctext); + intstr = EXTERNAL_TO_ITEXT (str, Qctext); XFree (str); return intern_istring (intstr); } @@ -339,14 +337,12 @@ } if (chartypes == LATIN_1) - TO_EXTERNAL_FORMAT (LISP_STRING, selection_value, - ALLOCA, (data, bytes), - Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (selection_value, data, bytes, + Qbinary); else if (chartypes == WORLD) { - TO_EXTERNAL_FORMAT (LISP_STRING, selection_value, - ALLOCA, (data, bytes), - Qctext); + LISP_STRING_TO_SIZED_EXTERNAL (selection_value, data, bytes, + Qctext); encoding = "COMPOUND_TEXT"; } } @@ -1442,13 +1438,9 @@ } if (chartypes == LATIN_1) - TO_EXTERNAL_FORMAT (LISP_STRING, string, - ALLOCA, (data, bytes), - Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (string, data, bytes, Qbinary); else if (chartypes == WORLD) - TO_EXTERNAL_FORMAT (LISP_STRING, string, - ALLOCA, (data, bytes), - Qctext); + LISP_STRING_TO_SIZED_EXTERNAL (string, data, bytes, Qctext); #endif /* MULE */ bytes_remaining = bytes;
--- a/src/sound.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/sound.c Fri Feb 05 11:53:57 2010 -0600 @@ -158,7 +158,7 @@ { Extbyte *fileext; - LISP_STRING_TO_EXTERNAL (file, fileext, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (file, fileext); /* #### ALSA code should allow specification of a device. */ if (alsa_play_sound_file (fileext, vol)) return Qnil; @@ -170,7 +170,7 @@ { Extbyte *fileext; - LISP_STRING_TO_EXTERNAL (file, fileext, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (file, fileext); /* #### NAS code should allow specification of a device. */ if (nas_play_sound_file (fileext, vol)) return Qnil; @@ -183,7 +183,7 @@ Extbyte *fileext; int result; - LISP_STRING_TO_EXTERNAL (file, fileext, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (file, fileext); /* #### ESD uses alarm(). But why should we also stop SIGIO? */ stop_interrupts (); @@ -382,9 +382,7 @@ Binbyte *soundext; Bytecount soundextlen; - TO_EXTERNAL_FORMAT (LISP_STRING, sound, - ALLOCA, (soundext, soundextlen), - Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (sound, soundext, soundextlen, Qbinary); if (alsa_play_sound_data (soundext, soundextlen, vol)) return Qnil; } @@ -396,9 +394,7 @@ Binbyte *soundext; Bytecount soundextlen; - TO_EXTERNAL_FORMAT (LISP_STRING, sound, - ALLOCA, (soundext, soundextlen), - Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (sound, soundext, soundextlen, Qbinary); if (nas_play_sound_data (soundext, soundextlen, vol)) return Qnil; } @@ -411,8 +407,7 @@ Bytecount soundextlen; int succes; - TO_EXTERNAL_FORMAT (LISP_STRING, sound, ALLOCA, (soundext, soundextlen), - Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (sound, soundext, soundextlen, Qbinary); /* #### ESD uses alarm(). But why should we also stop SIGIO? */ stop_interrupts (); @@ -432,9 +427,7 @@ Bytecount soundextlen; int succes; - TO_EXTERNAL_FORMAT (LISP_STRING, sound, - ALLOCA, (soundext, soundextlen), - Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (sound, soundext, soundextlen, Qbinary); /* The sound code doesn't like getting SIGIO interrupts. Unix sucks! */ stop_interrupts (); succes = play_sound_data (soundext, soundextlen, vol);
--- a/src/sound.h Fri Feb 05 10:50:06 2010 -0700 +++ b/src/sound.h Fri Feb 05 11:53:57 2010 -0600 @@ -35,13 +35,12 @@ Ibyte *errmess; \ Ibyte *string_int; \ GET_STRERROR (errmess, errno); \ - EXTERNAL_TO_C_STRING (string, string_int, Qerror_message_encoding); \ + string_int = EXTERNAL_TO_ITEXT (string, Qerror_message_encoding); \ warn_when_safe (Qsound, Qerror, "audio: %s, %s", string_int, errmess); \ } while (0) # define sound_warn(string) \ do { \ Ibyte *string_int; \ - EXTERNAL_TO_C_STRING (GETTEXT (string), string_int, \ - Qerror_message_encoding); \ + string_int = EXTERNAL_TO_ITEXT (GETTEXT (string), Qerror_message_encoding); \ warn_when_safe (Qsound, Qwarning, "audio: %s", string_int); \ } while (0)
--- a/src/sysdep.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/sysdep.c Fri Feb 05 11:53:57 2010 -0600 @@ -2833,7 +2833,7 @@ if (ret) { Ibyte *retin; - TSTR_TO_C_STRING_MALLOC (ret, retin); + retin = TSTR_TO_ITEXT_MALLOC (ret); xfree (cwd); return retin; } @@ -2842,7 +2842,7 @@ if (ret) { Ibyte *retin; - EXTERNAL_TO_C_STRING_MALLOC (ret, retin, Qfile_name); + retin = EXTERNAL_TO_ITEXT_MALLOC (ret, Qfile_name); xfree (cwd); return retin; } @@ -2865,7 +2865,7 @@ if (!getwd (chingame_limitos_arbitrarios)) return 0; - EXTERNAL_TO_C_STRING_MALLOC (chingame_limitos_arbitrarios, ret2, Qfile_name); + ret2 = EXTERNAL_TO_ITEXT_MALLOC (chingame_limitos_arbitrarios, Qfile_name); return ret2; #endif /* HAVE_GETCWD */ } @@ -3090,15 +3090,14 @@ ; new_argv = alloca_array (Extbyte *, argc + 1); for (i = 0; i < argc; i++) - C_STRING_TO_EXTERNAL (argv[i], new_argv[i], Qcommand_argument_encoding); + new_argv[i] = ITEXT_TO_EXTERNAL (argv[i], Qcommand_argument_encoding); new_argv[argc] = NULL; for (envc = 0; envp[envc]; envc++) ; new_envp = alloca_array (Extbyte *, envc + 1); for (i = 0; i < envc; i++) - C_STRING_TO_EXTERNAL (envp[i], new_envp[i], - Qenvironment_variable_encoding); + new_envp[i] = ITEXT_TO_EXTERNAL (envp[i], Qenvironment_variable_encoding); new_envp[envc] = NULL; #if defined (WIN32_NATIVE) @@ -3143,24 +3142,21 @@ xfree (cached_pwd.pw_shell); cached_pwd = *pwd; - if (cached_pwd.pw_name) - TO_INTERNAL_FORMAT (C_STRING, cached_pwd.pw_name, - C_STRING_MALLOC, cached_pwd.pw_name, - Quser_name_encoding); - if (cached_pwd.pw_passwd) - TO_INTERNAL_FORMAT (C_STRING, cached_pwd.pw_passwd, - C_STRING_MALLOC, cached_pwd.pw_passwd, - Quser_name_encoding); - if (cached_pwd.pw_gecos) - TO_INTERNAL_FORMAT (C_STRING, cached_pwd.pw_gecos, - C_STRING_MALLOC, cached_pwd.pw_gecos, - Quser_name_encoding); - if (cached_pwd.pw_dir) - TO_INTERNAL_FORMAT (C_STRING, cached_pwd.pw_dir, - C_STRING_MALLOC, cached_pwd.pw_dir, Qfile_name); - if (cached_pwd.pw_shell) - TO_INTERNAL_FORMAT (C_STRING, cached_pwd.pw_shell, - C_STRING_MALLOC, cached_pwd.pw_shell, Qfile_name); + +#define FROB(field, encoding) \ +do \ +{ \ + if (cached_pwd.field) \ + cached_pwd.field = (CIbyte *) \ + EXTERNAL_TO_ITEXT_MALLOC (cached_pwd.field, encoding); \ +} while (0) + + FROB (pw_name, Quser_name_encoding); + FROB (pw_passwd, Quser_name_encoding); + FROB (pw_gecos, Quser_name_encoding); + FROB (pw_dir, Qfile_name); + FROB (pw_shell, Qfile_name); +#undef FROB return &cached_pwd; } @@ -3171,8 +3167,7 @@ /* Synthetic versions are defined in nt.c and already do conversion. */ return getpwnam (name); #else - Extbyte *nameext; - C_STRING_TO_EXTERNAL (name, nameext, Quser_name_encoding); + Extbyte *nameext = ITEXT_TO_EXTERNAL (name, Quser_name_encoding); return copy_in_passwd (getpwnam (nameext)); #endif /* WIN32_NATIVE */ @@ -3212,7 +3207,7 @@ return (Ibyte *) "Sun Jan 01 00:00:00 1970"; if (ctime_static) xfree (ctime_static); - EXTERNAL_TO_C_STRING_MALLOC (str, ctime_static, Qtime_function_encoding); + ctime_static = EXTERNAL_TO_ITEXT_MALLOC (str, Qtime_function_encoding); return ctime_static; } @@ -3387,14 +3382,14 @@ Extbyte *filename; utb.actime = EMACS_SECS (atime); utb.modtime = EMACS_SECS (mtime); - LISP_STRING_TO_EXTERNAL (path, filename, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (path, filename); return utime (filename, &utb); #elif defined (HAVE_UTIMES) struct timeval tv[2]; Extbyte *filename; tv[0] = atime; tv[1] = mtime; - LISP_STRING_TO_EXTERNAL (path, filename, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (path, filename); return utimes (filename, tv); #else /* No file times setting function available. */
--- a/src/sysdll.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/sysdll.c Fri Feb 05 11:53:57 2010 -0600 @@ -77,7 +77,7 @@ } else { - LISP_STRING_TO_EXTERNAL (fname, soname, Qdll_filename_encoding); + soname = LISP_STRING_TO_EXTERNAL (fname, Qdll_filename_encoding); } return (dll_handle) dlopen (soname, RTLD_NOW); } @@ -93,7 +93,7 @@ { Extbyte *next; MAYBE_PREPEND_UNDERSCORE (n); - C_STRING_TO_EXTERNAL (n, next, Qdll_function_name_encoding); + next = ITEXT_TO_EXTERNAL (n, Qdll_function_name_encoding); return (dll_func) dlsym ((void *) h, next); } @@ -102,7 +102,7 @@ { Extbyte *next; MAYBE_PREPEND_UNDERSCORE (n); - C_STRING_TO_EXTERNAL (n, next, Qdll_variable_name_encoding); + next = ITEXT_TO_EXTERNAL (n, Qdll_variable_name_encoding); return (dll_var)dlsym ((void *)h, next); } @@ -134,7 +134,7 @@ } else { - LISP_STRING_TO_EXTERNAL (fname, soname, Qdll_filename_encoding); + soname = LISP_STRING_TO_EXTERNAL (fname, Qdll_filename_encoding); } return (dll_handle) shl_load (soname, BIND_DEFERRED, 0L); } @@ -205,14 +205,14 @@ dll_func dll_function (dll_handle h, const Ibyte *n) { - Extbyte *next = NEW_C_STRING_TO_EXTERNAL (n, Qmswindows_multibyte); + Extbyte *next = ITEXT_TO_EXTERNAL (n, Qmswindows_multibyte); return (dll_func) GetProcAddress ((HINSTANCE) h, next); } dll_func dll_variable (dll_handle h, const Ibyte *n) { - Extbyte *next = NEW_C_STRING_TO_EXTERNAL (n, Qmswindows_multibyte); + Extbyte *next = ITEXT_TO_EXTERNAL (n, Qmswindows_multibyte); return (dll_func) GetProcAddress ((HINSTANCE) h, next); } @@ -250,7 +250,7 @@ } else { - LISP_STRING_TO_EXTERNAL (fname, soname, Qdll_filename_encoding); + soname = LISP_STRING_TO_EXTERNAL (fname, Qdll_filename_encoding); } ret = NSCreateObjectFileImageFromFile (soname, &file); if (ret != NSObjectFileImageSuccess) @@ -373,7 +373,7 @@ dylib.name.offset + (Rawbyte *) lc)))) { Extbyte *symext = - NEW_C_STRING_TO_EXTERNAL (symbol, Qdll_symbol_encoding); + ITEXT_TO_EXTERNAL (symbol, Qdll_symbol_encoding); if (NSIsSymbolNameDefinedInImage (wh, symext)) { nssym = @@ -398,7 +398,7 @@ Extbyte *next; MAYBE_PREPEND_UNDERSCORE (n); - C_STRING_TO_EXTERNAL (n, next, Qdll_function_name_encoding); + next = ITEXT_TO_EXTERNAL (n, Qdll_function_name_encoding); /* NULL means the program image and shared libraries, not bundles. */ @@ -440,7 +440,7 @@ Extbyte *next; MAYBE_PREPEND_UNDERSCORE (n); - C_STRING_TO_EXTERNAL (n, next, Qdll_variable_name_encoding); + next = ITEXT_TO_EXTERNAL (n, Qdll_variable_name_encoding); sym = NSLookupSymbolInModule ((NSModule) h, n); if (sym == 0) return 0; @@ -471,7 +471,7 @@ } else { - LISP_STRING_TO_EXTERNAL (fname, soname, Qdll_filename_encoding); + soname = LISP_STRING_TO_EXTERNAL (fname, Qdll_filename_encoding); } return (dll_handle) lt_dlopen (soname); } @@ -487,7 +487,7 @@ { Extbyte *next; MAYBE_PREPEND_UNDERSCORE (n); - C_STRING_TO_EXTERNAL (n, next, Qdll_function_name_encoding); + next = ITEXT_TO_EXTERNAL (n, Qdll_function_name_encoding); return (dll_func) lt_dlsym ((lt_dlhandle) h, next); } @@ -496,7 +496,7 @@ { Extbyte *next; MAYBE_PREPEND_UNDERSCORE (n); - C_STRING_TO_EXTERNAL (n, next, Qdll_variable_name_encoding); + next = ITEXT_TO_EXTERNAL (n, Qdll_variable_name_encoding); return (dll_var) lt_dlsym ((lt_dlhandle) h, next); }
--- a/src/sysfile.h Fri Feb 05 10:50:06 2010 -0700 +++ b/src/sysfile.h Fri Feb 05 11:53:57 2010 -0600 @@ -91,7 +91,7 @@ /* # include <sys/fcntl.h> */ #endif /* WIN32_NATIVE */ -/* Needed for C_STRING_TO_TSTR, MAX_XETCHAR_SIZE below; but syswindows.h +/* Needed for ITEXT_TO_TSTR, MAX_XETCHAR_SIZE below; but syswindows.h depends on lisp.h being previously included. */ #if defined (WIN32_ANY) && defined (emacs) # include "syswindows.h" @@ -597,23 +597,26 @@ { \ const Ibyte *_pco_path_; \ PATHNAME_RESOLVE_LINKS (path, _pco_path_); \ - C_STRING_TO_TSTR (_pco_path_, pathout); \ + (pathout) = ITEXT_TO_TSTR (_pco_path_); \ } while (0) -#define PATHNAME_CONVERT_OUT_UTF_8(path, pathout) \ -do \ -{ \ - const Ibyte *_pco_path_; \ - PATHNAME_RESOLVE_LINKS (path, _pco_path_); \ - C_STRING_TO_EXTERNAL (_pco_path_, pathout, Qutf_8); \ +#define PATHNAME_CONVERT_OUT_UTF_8(path, pathout) \ +do \ +{ \ + const Ibyte *_pco_path_; \ + PATHNAME_RESOLVE_LINKS (path, _pco_path_); \ + (pathout) = ITEXT_TO_EXTERNAL (_pco_path_, Qutf_8); \ } while (0) #ifdef WIN32_NATIVE #define PATHNAME_CONVERT_OUT(path, pathout) \ PATHNAME_CONVERT_OUT_TSTR (path, pathout) #else -# define PATHNAME_CONVERT_OUT(path, pathout) \ - C_STRING_TO_EXTERNAL (path, pathout, Qfile_name) +# define PATHNAME_CONVERT_OUT(path, pathout) \ +do \ +{ \ + (pathout) = ITEXT_TO_EXTERNAL (path, Qfile_name); \ +} while (0) #endif #define LISP_PATHNAME_CONVERT_OUT(path, pathout) \
--- a/src/syswindows.h Fri Feb 05 10:50:06 2010 -0700 +++ b/src/syswindows.h Fri Feb 05 11:53:57 2010 -0600 @@ -844,14 +844,11 @@ (XEUNICODE_P ? (char *) wcsdup ((wchar_t *) s) \ : xstrdup (s)) -#define C_STRING_TO_TSTR(in, out) \ - C_STRING_TO_EXTERNAL (in, out, Qmswindows_tstr) -#define LISP_STRING_TO_TSTR(in, out) \ - LISP_STRING_TO_EXTERNAL (in, out, Qmswindows_tstr) -#define TSTR_TO_C_STRING(in, out) \ - EXTERNAL_TO_C_STRING (in, out, Qmswindows_tstr) -#define TSTR_TO_C_STRING_MALLOC(in, out) \ - EXTERNAL_TO_C_STRING_MALLOC (in, out, Qmswindows_tstr) +#define ITEXT_TO_TSTR(in) ITEXT_TO_EXTERNAL (in, Qmswindows_tstr) +#define LISP_STRING_TO_TSTR(in) LISP_STRING_TO_EXTERNAL (in, Qmswindows_tstr) +#define TSTR_TO_ITEXT(in) EXTERNAL_TO_ITEXT (in, Qmswindows_tstr) +#define TSTR_TO_ITEXT_MALLOC(in) \ + EXTERNAL_TO_ITEXT_MALLOC (in, Qmswindows_tstr) #define build_tstr_string(in) \ make_extstring (in, qxetcsbytelen ((Extbyte *) in), Qmswindows_tstr) @@ -952,8 +949,9 @@ #define LOCAL_FILE_FORMAT_TO_TSTR(path, out) \ do { \ const Ibyte *lfftt = (path); \ + const Extbyte **lffttout = (const Extbyte **) &(out); \ if (isalpha (lfftt[0]) && (IS_DEVICE_SEP (lfftt[1]))) \ - PATHNAME_CONVERT_OUT_TSTR (lfftt, out); \ + PATHNAME_CONVERT_OUT_TSTR (lfftt, *lffttout); \ else \ { \ int lfftt_size; \ @@ -966,7 +964,7 @@ lfftt_tstr_path = alloca_extbytes (lfftt_size); \ cygwin_conv_path (CCP_POSIX_TO_WIN_T | CCP_RELATIVE, \ lfftt_utf8_path, lfftt_tstr_path, lfftt_size); \ - * (const Extbyte **) &(out) = lfftt_tstr_path; \ + *lffttout = lfftt_tstr_path; \ } \ } while (0) #define TSTR_TO_LOCAL_FILE_FORMAT(path, out) \ @@ -980,7 +978,7 @@ ttlff_utf8_path = alloca_extbytes (ttlff_size); \ cygwin_conv_path (CCP_WIN_T_TO_POSIX | CCP_RELATIVE, \ ttlff, ttlff_utf8_path, ttlff_size); \ - EXTERNAL_TO_C_STRING (ttlff_utf8_path, out, Qutf_8); \ + (out) = EXTERNAL_TO_ITEXT (ttlff_utf8_path, Qutf_8); \ } while (0) #else /* not HAVE_CYGWIN_CONV_PATH */ #define LOCAL_FILE_FORMAT_TO_TSTR(path, out) \ @@ -994,7 +992,7 @@ do { \ const Ibyte *ttlff; \ \ - TSTR_TO_C_STRING (path, ttlff); \ + ttlff = TSTR_TO_ITEXT (path); \ INTERNAL_MSWIN_TO_LOCAL_FILE_FORMAT (ttlff, out); \ } while (0) #endif /* (not) HAVE_CYGWIN_CONV_PATH */ @@ -1023,13 +1021,13 @@ const Extbyte *lfftiwp; \ \ LOCAL_FILE_FORMAT_TO_TSTR (path, lfftiwp); \ - TSTR_TO_C_STRING (lfftiwp, pathout); \ + (pathout) = TSTR_TO_ITEXT (lfftiwp); \ } \ while (0) #define INTERNAL_MSWIN_TO_LOCAL_FILE_FORMAT(path, pathout) \ do { \ const Extbyte *iwtlffp; \ - C_STRING_TO_TSTR (path, iwtlffp); \ + iwtlffp = ITEXT_TO_TSTR (path); \ TSTR_TO_LOCAL_FILE_FORMAT (iwtlffp, pathout); \ } while (0) #elif defined (CYGWIN) @@ -1041,15 +1039,15 @@ conversion functions are *NOT* localized, and will fail if they \ get 7-bit ISO2022-encoded data. We know that our internal format \ is ASCII-compatible, and so these functions will work fine with \ - this data. */ \ + this data (maybe ... not when Cygwin uses UTF-8) */ \ const Ibyte *lfftiwp = (path); \ if (isalpha (lfftiwp[0]) && (IS_DEVICE_SEP (lfftiwp[1]))) \ - pathout = lfftiwp; \ + (pathout) = lfftiwp; \ else \ { \ int lfftiw2 = \ cygwin_posix_to_win32_path_list_buf_size ((char *) lfftiwp); \ - pathout = alloca_ibytes (lfftiw2); \ + (pathout) = alloca_ibytes (lfftiw2); \ cygwin_posix_to_win32_path_list ((char *) lfftiwp, (char *) pathout); \ } \ } while (0) @@ -1106,11 +1104,11 @@ qxestrncpy (lffmutt_path2, lffmutt_pathint, 7); \ qxestrcpy (lffmutt_path2 + 7, lffmutt_path1); \ } \ - C_STRING_TO_TSTR (lffmutt_path2, pathout); \ + (pathout) = ITEXT_TO_TSTR (lffmutt_path2); \ } \ else \ /* A straight URL, just convert */ \ - LISP_STRING_TO_TSTR (lispstr, pathout); \ + (pathout) = LISP_STRING_TO_TSTR (lispstr); \ } \ else \ /* Not URL-style, must be a straight filename. */ \
--- a/src/text.h Fri Feb 05 10:50:06 2010 -0700 +++ b/src/text.h Fri Feb 05 11:53:57 2010 -0600 @@ -1936,14 +1936,15 @@ eicpy_ext_len (ei, ei6, ei6len, Qbinary); \ } while (0) -#define eicpy_ext_len(ei, extdata, extlen, codesys) \ -do { \ - const Extbyte *ei7 = (extdata); \ - int ei7len = (extlen); \ - \ - SIZED_EXTERNAL_TO_SIZED_C_STRING (ei7, ei7len, (ei)->data_, \ - (ei)->bytelen_, codesys); \ - (ei)->max_size_allocated_ = (ei)->bytelen_ + 1; \ +#define eicpy_ext_len(ei, extdata, extlen, codesys) \ +do { \ + const Extbyte *ei7 = (extdata); \ + int ei7len = (extlen); \ + \ + TO_INTERNAL_FORMAT (DATA, (ei7, ei7len), \ + ALLOCA, ((ei)->data_, (ei)->bytelen_), \ + codesys); \ + (ei)->max_size_allocated_ = (ei)->bytelen_ + 1; \ (ei)->charlen_ = bytecount_to_charcount ((ei)->data_, (ei)->bytelen_); \ } while (0) @@ -2811,96 +2812,6 @@ #define DFC_LISP_BUFFER_USE_CONVERTED_DATA(sink) \ Lstream_delete (XLSTREAM (dfc_sink.lisp_object)) -/* #define TEST_NEW_DFC */ - -/* Convenience macros for extremely common invocations */ -#ifdef TEST_NEW_DFC -#define C_STRING_TO_EXTERNAL(in, out, codesys) \ - do { * (Extbyte **) &(out) = \ - NEW_C_STRING_TO_EXTERNAL (in, codesys); } while (0) -#define SIZED_C_STRING_TO_EXTERNAL(in, inlen, out, codesys) \ - do { * (Extbyte **) &(out) = \ - NEW_SIZED_C_STRING_TO_EXTERNAL (in, inlen, codesys); } while (0) -#define EXTERNAL_TO_C_STRING(in, out, codesys) \ - do { * (Ibyte **) &(out) = \ - NEW_EXTERNAL_TO_C_STRING (in, codesys); } while (0) -#define SIZED_EXTERNAL_TO_C_STRING(in, inlen, out, codesys) \ - do { * (Ibyte **) &(out) = \ - NEW_SIZED_EXTERNAL_TO_C_STRING (in, inlen, codesys); } while (0) -#define LISP_STRING_TO_EXTERNAL(in, out, codesys) \ - do { * (Extbyte **) &(out) = \ - NEW_LISP_STRING_TO_EXTERNAL (in, codesys); } while (0) -#else -#define C_STRING_TO_EXTERNAL(in, out, codesys) \ - TO_EXTERNAL_FORMAT (C_STRING, in, C_STRING_ALLOCA, out, codesys) -#define SIZED_C_STRING_TO_EXTERNAL(in, inlen, out, codesys) \ - TO_EXTERNAL_FORMAT (DATA, (in, inlen), C_STRING_ALLOCA, out, codesys) -#define EXTERNAL_TO_C_STRING(in, out, codesys) \ - TO_INTERNAL_FORMAT (C_STRING, in, C_STRING_ALLOCA, out, codesys) -#define SIZED_EXTERNAL_TO_C_STRING(in, inlen, out, codesys) \ - TO_INTERNAL_FORMAT (DATA, (in, inlen), C_STRING_ALLOCA, out, codesys) -#define LISP_STRING_TO_EXTERNAL(in, out, codesys) \ - TO_EXTERNAL_FORMAT (LISP_STRING, in, C_STRING_ALLOCA, out, codesys) -#endif /* TEST_NEW_DFC */ - -#define C_STRING_TO_SIZED_EXTERNAL(in, out, outlen, codesys) \ - TO_EXTERNAL_FORMAT (C_STRING, in, ALLOCA, (out, outlen), codesys) -#define SIZED_C_STRING_TO_SIZED_EXTERNAL(in, inlen, out, outlen, codesys) \ - TO_EXTERNAL_FORMAT (DATA, (in, inlen), ALLOCA, (out, outlen), codesys) -#define EXTERNAL_TO_SIZED_C_STRING(in, out, outlen, codesys) \ - TO_INTERNAL_FORMAT (C_STRING, in, ALLOCA, (out, outlen), codesys) -#define SIZED_EXTERNAL_TO_SIZED_C_STRING(in, inlen, out, outlen, codesys) \ - TO_INTERNAL_FORMAT (DATA, (in, inlen), ALLOCA, (out, outlen), codesys) -#define LISP_STRING_TO_SIZED_EXTERNAL(in, out, outlen, codesys) \ - TO_EXTERNAL_FORMAT (LISP_STRING, in, ALLOCA, (out, outlen), codesys) - -/* In place of EXTERNAL_TO_LISP_STRING(), use build_extstring() and/or - make_extstring(). */ - -#ifdef TEST_NEW_DFC -#define C_STRING_TO_EXTERNAL_MALLOC(in, out, codesys) \ - do { * (Extbyte **) &(out) = \ - NEW_C_STRING_TO_EXTERNAL_MALLOC (in, codesys); } while (0) -#define SIZED_C_STRING_TO_EXTERNAL_MALLOC(in, inlen, out, codesys) \ - do { * (Extbyte **) &(out) = \ - NEW_SIZED_C_STRING_TO_EXTERNAL_MALLOC (in, inlen, codesys); } \ - while (0) -#define EXTERNAL_TO_C_STRING_MALLOC(in, out, codesys) \ - do { * (Ibyte **) &(out) = \ - NEW_EXTERNAL_TO_C_STRING_MALLOC (in, codesys); } while (0) -#define SIZED_EXTERNAL_TO_C_STRING_MALLOC(in, inlen, out, codesys) \ - do { * (Ibyte **) &(out) = \ - NEW_SIZED_EXTERNAL_TO_C_STRING_MALLOC (in, inlen, codesys); } \ - while (0) -#define LISP_STRING_TO_EXTERNAL_MALLOC(in, out, codesys) \ - do { * (Extbyte **) &(out) = \ - NEW_LISP_STRING_TO_EXTERNAL_MALLOC (in, codesys); } while (0) -#else -#define C_STRING_TO_EXTERNAL_MALLOC(in, out, codesys) \ - TO_EXTERNAL_FORMAT (C_STRING, in, C_STRING_MALLOC, out, codesys) -#define SIZED_C_STRING_TO_EXTERNAL_MALLOC(in, inlen, out, codesys) \ - TO_EXTERNAL_FORMAT (DATA, (in, inlen), C_STRING_MALLOC, out, codesys) -#define EXTERNAL_TO_C_STRING_MALLOC(in, out, codesys) \ - TO_INTERNAL_FORMAT (C_STRING, in, C_STRING_MALLOC, out, codesys) -#define SIZED_EXTERNAL_TO_C_STRING_MALLOC(in, inlen, out, codesys) \ - TO_INTERNAL_FORMAT (DATA, (in, inlen), C_STRING_MALLOC, out, codesys) -#define LISP_STRING_TO_EXTERNAL_MALLOC(in, out, codesys) \ - TO_EXTERNAL_FORMAT (LISP_STRING, in, C_STRING_MALLOC, out, codesys) -#endif /* TEST_NEW_DFC */ - -#define C_STRING_TO_SIZED_EXTERNAL_MALLOC(in, out, outlen, codesys) \ - TO_EXTERNAL_FORMAT (C_STRING, in, MALLOC, (out, outlen), codesys) -#define SIZED_C_STRING_TO_SIZED_EXTERNAL_MALLOC(in, inlen, out, outlen, \ - codesys) \ - TO_EXTERNAL_FORMAT (DATA, (in, inlen), MALLOC, (out, outlen), codesys) -#define EXTERNAL_TO_SIZED_C_STRING_MALLOC(in, out, outlen, codesys) \ - TO_INTERNAL_FORMAT (C_STRING, in, MALLOC, (out, outlen), codesys) -#define SIZED_EXTERNAL_TO_SIZED_C_STRING_MALLOC(in, inlen, out, outlen, \ - codesys) \ - TO_INTERNAL_FORMAT (DATA, (in, inlen), MALLOC, (out, outlen), codesys) -#define LISP_STRING_TO_SIZED_EXTERNAL_MALLOC(in, out, outlen, codesys) \ - TO_EXTERNAL_FORMAT (LISP_STRING, in, MALLOC, (out, outlen), codesys) - enum new_dfc_src_type { DFC_EXTERNAL, @@ -2923,7 +2834,7 @@ END_C_DECLS -/* Version of EXTERNAL_TO_C_STRING that *RETURNS* the translated string, +/* Version of EXTERNAL_TO_ITEXT that *RETURNS* the translated string, still in alloca() space. Requires some trickiness to do this, but gets it done! */ @@ -2945,28 +2856,36 @@ (#src, ALLOCA_FUNCALL_OK (new_dfc_convert_size (#src, src, src_size, \ type, codesys))) -#define NEW_EXTERNAL_TO_C_STRING(src, codesys) \ - (Ibyte *) NEW_DFC_CONVERT_1_ALLOCA (src, -1, DFC_EXTERNAL, codesys) -#define NEW_EXTERNAL_TO_C_STRING_MALLOC(src, codesys) \ - (Ibyte *) new_dfc_convert_malloc (src, -1, DFC_EXTERNAL, codesys) -#define NEW_SIZED_EXTERNAL_TO_C_STRING(src, len, codesys) \ - (Ibyte *) NEW_DFC_CONVERT_1_ALLOCA (src, len, DFC_SIZED_EXTERNAL, codesys) -#define NEW_SIZED_EXTERNAL_TO_C_STRING_MALLOC(src, len, codesys) \ - (Ibyte *) new_dfc_convert_malloc (src, len, DFC_SIZED_EXTERNAL, codesys) -#define NEW_C_STRING_TO_EXTERNAL(src, codesys) \ - (Extbyte *) NEW_DFC_CONVERT_1_ALLOCA (src, -1, DFC_INTERNAL, codesys) -#define NEW_C_STRING_TO_EXTERNAL_MALLOC(src, codesys) \ - (Extbyte *) new_dfc_convert_malloc (src, -1, DFC_INTERNAL, codesys) -#define NEW_SIZED_C_STRING_TO_EXTERNAL(src, len, codesys) \ - (Extbyte *) NEW_DFC_CONVERT_1_ALLOCA (src, len, DFC_SIZED_INTERNAL, codesys) -#define NEW_SIZED_C_STRING_TO_EXTERNAL_MALLOC(src, len, codesys) \ - (Extbyte *) new_dfc_convert_malloc (src, len, DFC_SIZED_INTERNAL, codesys) -#define NEW_LISP_STRING_TO_EXTERNAL(src, codesys) \ - (Extbyte *) NEW_DFC_CONVERT_1_ALLOCA (LISP_TO_VOID (src), -1, \ - DFC_LISP_STRING, codesys) -#define NEW_LISP_STRING_TO_EXTERNAL_MALLOC(src, codesys) \ - (Extbyte *) new_dfc_convert_malloc (LISP_TO_VOID (src), -1, \ - DFC_LISP_STRING, codesys) +#define EXTERNAL_TO_ITEXT(src, codesys) \ + ((Ibyte *) NEW_DFC_CONVERT_1_ALLOCA (src, -1, DFC_EXTERNAL, codesys)) +#define EXTERNAL_TO_ITEXT_MALLOC(src, codesys) \ + ((Ibyte *) new_dfc_convert_malloc (src, -1, DFC_EXTERNAL, codesys)) +#define SIZED_EXTERNAL_TO_ITEXT(src, len, codesys) \ + ((Ibyte *) NEW_DFC_CONVERT_1_ALLOCA (src, len, DFC_SIZED_EXTERNAL, codesys)) +#define SIZED_EXTERNAL_TO_ITEXT_MALLOC(src, len, codesys) \ + ((Ibyte *) new_dfc_convert_malloc (src, len, DFC_SIZED_EXTERNAL, codesys)) +#define ITEXT_TO_EXTERNAL(src, codesys) \ + ((Extbyte *) NEW_DFC_CONVERT_1_ALLOCA (src, -1, DFC_INTERNAL, codesys)) +#define ITEXT_TO_EXTERNAL_MALLOC(src, codesys) \ + ((Extbyte *) new_dfc_convert_malloc (src, -1, DFC_INTERNAL, codesys)) +#define LISP_STRING_TO_EXTERNAL(src, codesys) \ + ((Extbyte *) NEW_DFC_CONVERT_1_ALLOCA (LISP_TO_VOID (src), -1, \ + DFC_LISP_STRING, codesys)) +#define LISP_STRING_TO_EXTERNAL_MALLOC(src, codesys) \ + ((Extbyte *) new_dfc_convert_malloc (LISP_TO_VOID (src), -1, \ + DFC_LISP_STRING, codesys)) +/* In place of EXTERNAL_TO_LISP_STRING(), use build_extstring() and/or + make_extstring(). */ + +/* The next four have two outputs, so we make both of them be parameters */ +#define ITEXT_TO_SIZED_EXTERNAL(in, out, outlen, codesys) \ + TO_EXTERNAL_FORMAT (C_STRING, in, ALLOCA, (out, outlen), codesys) +#define LISP_STRING_TO_SIZED_EXTERNAL(in, out, outlen, codesys) \ + TO_EXTERNAL_FORMAT (LISP_STRING, in, ALLOCA, (out, outlen), codesys) +#define ITEXT_TO_SIZED_EXTERNAL_MALLOC(in, out, outlen, codesys) \ + TO_EXTERNAL_FORMAT (C_STRING, in, MALLOC, (out, outlen), codesys) +#define LISP_STRING_TO_SIZED_EXTERNAL_MALLOC(in, out, outlen, codesys) \ + TO_EXTERNAL_FORMAT (LISP_STRING, in, MALLOC, (out, outlen), codesys) /* Wexttext functions. The type of Wexttext is selected at compile time and will sometimes be wchar_t, sometimes char. */ @@ -3146,11 +3065,11 @@ \ if (!__gserr__) \ { \ - var = alloca_ibytes (99); \ + var = alloca_ibytes (99); \ qxesprintf (var, "Unknown error %d", __gsnum__); \ } \ else \ - EXTERNAL_TO_C_STRING (__gserr__, var, Qstrerror_encoding); \ + var = EXTERNAL_TO_ITEXT (__gserr__, Qstrerror_encoding); \ } while (0) #endif /* INCLUDED_text_h_ */
--- a/src/tooltalk.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/tooltalk.c Fri Feb 05 11:53:57 2010 -0600 @@ -312,7 +312,7 @@ { CIbyte *err; - EXTERNAL_TO_C_STRING (tt_status_message (st), err, Qtooltalk_encoding); + err = EXTERNAL_TO_ITEXT (tt_status_message (st), Qtooltalk_encoding); signal_error (Qtooltalk_error, err, Qunbound); } } @@ -773,9 +773,8 @@ Extbyte *value_ext; Bytecount value_ext_len; CHECK_STRING (value); - TO_EXTERNAL_FORMAT (LISP_STRING, value, - ALLOCA, (value_ext, value_ext_len), - Qtooltalk_encoding); + LISP_STRING_TO_SIZED_EXTERNAL (value, value_ext, value_ext_len, + Qtooltalk_encoding); tt_message_arg_bval_set (m, n, (unsigned char *) value_ext, value_ext_len); } else if (EQ (attribute, Qtt_arg_ival)) @@ -787,7 +786,7 @@ { const char *value_ext; CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, value_ext, Qtooltalk_encoding); + value_ext = LISP_STRING_TO_EXTERNAL (value, Qtooltalk_encoding); tt_message_arg_val_set (m, n, value_ext); } else if (EQ (attribute, Qtt_status)) @@ -812,7 +811,7 @@ { const char *value_ext; CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, value_ext, Qtooltalk_encoding); + value_ext = LISP_STRING_TO_EXTERNAL (value, Qtooltalk_encoding); (*fun_str) (m, value_ext); } @@ -928,13 +927,13 @@ { const char *vtype_ext; - LISP_STRING_TO_EXTERNAL (vtype, vtype_ext, Qtooltalk_encoding); + vtype_ext = LISP_STRING_TO_EXTERNAL (vtype, Qtooltalk_encoding); if (NILP (value)) tt_message_arg_add (m, n, vtype_ext, NULL); else if (STRINGP (value)) { const char *value_ext; - LISP_STRING_TO_EXTERNAL (value, value_ext, Qtooltalk_encoding); + value_ext = LISP_STRING_TO_EXTERNAL (value, Qtooltalk_encoding); tt_message_arg_add (m, n, vtype_ext, value_ext); } else if (INTP (value)) @@ -1039,28 +1038,28 @@ { const char *value_ext; CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, value_ext, Qtooltalk_encoding); + value_ext = LISP_STRING_TO_EXTERNAL (value, Qtooltalk_encoding); tt_pattern_file_add (p, value_ext); } else if (EQ (attribute, Qtt_object)) { const char *value_ext; CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, value_ext, Qtooltalk_encoding); + value_ext = LISP_STRING_TO_EXTERNAL (value, Qtooltalk_encoding); tt_pattern_object_add (p, value_ext); } else if (EQ (attribute, Qtt_op)) { const char *value_ext; CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, value_ext, Qtooltalk_encoding); + value_ext = LISP_STRING_TO_EXTERNAL (value, Qtooltalk_encoding); tt_pattern_op_add (p, value_ext); } else if (EQ (attribute, Qtt_otype)) { const char *value_ext; CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, value_ext, Qtooltalk_encoding); + value_ext = LISP_STRING_TO_EXTERNAL (value, Qtooltalk_encoding); tt_pattern_otype_add (p, value_ext); } else if (EQ (attribute, Qtt_scope)) @@ -1072,21 +1071,21 @@ { const char *value_ext; CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, value_ext, Qtooltalk_encoding); + value_ext = LISP_STRING_TO_EXTERNAL (value, Qtooltalk_encoding); tt_pattern_sender_add (p, value_ext); } else if (EQ (attribute, Qtt_sender_ptype)) { const char *value_ext; CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, value_ext, Qtooltalk_encoding); + value_ext = LISP_STRING_TO_EXTERNAL (value, Qtooltalk_encoding); tt_pattern_sender_ptype_add (p, value_ext); } else if (EQ (attribute, Qtt_session)) { const char *value_ext; CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, value_ext, Qtooltalk_encoding); + value_ext = LISP_STRING_TO_EXTERNAL (value, Qtooltalk_encoding); tt_pattern_session_add (p, value_ext); } else if (EQ (attribute, Qtt_state)) @@ -1127,13 +1126,13 @@ { const char *vtype_ext; - LISP_STRING_TO_EXTERNAL (vtype, vtype_ext, Qtooltalk_encoding); + vtype_ext = LISP_STRING_TO_EXTERNAL (vtype, Qtooltalk_encoding); if (NILP (value)) tt_pattern_arg_add (p, n, vtype_ext, NULL); else if (STRINGP (value)) { const char *value_ext; - LISP_STRING_TO_EXTERNAL (value, value_ext, Qtooltalk_encoding); + value_ext = LISP_STRING_TO_EXTERNAL (value, Qtooltalk_encoding); tt_pattern_arg_add (p, n, vtype_ext, value_ext); } else if (INTP (value))
--- a/src/win32.c Fri Feb 05 10:50:06 2010 -0700 +++ b/src/win32.c Fri Feb 05 11:53:57 2010 -0600 @@ -90,12 +90,10 @@ Lisp_Object tstr_to_local_file_format (Extbyte *path) { - Ibyte *ttlff; + Ibyte *pathint = TSTR_TO_ITEXT (path); + INTERNAL_MSWIN_TO_LOCAL_FILE_FORMAT (pathint, pathint); - TSTR_TO_C_STRING (path, ttlff); - INTERNAL_MSWIN_TO_LOCAL_FILE_FORMAT (ttlff, ttlff); - - return build_istring (ttlff); + return build_istring (pathint); } /* Normalize filename by converting all path separators to the specified @@ -271,7 +269,7 @@ break; } - TSTR_TO_C_STRING (lpMsgBuf, inres); + inres = TSTR_TO_ITEXT (lpMsgBuf); len = qxestrlen (inres); /* Messages tend to end with a period and newline */ if (len >= 3 && !qxestrcmp_ascii (inres + len - 3, ".\r\n")) @@ -302,8 +300,7 @@ mswindows_report_process_error (const Ascbyte *reason, Lisp_Object data, int errnum) { - report_file_type_error (Qprocess_error, mswindows_lisp_error (errnum), - reason, data); + signal_error_2 (Qprocess_error, reason, mswindows_lisp_error (errnum), data); } DEFUN ("mswindows-shell-execute", Fmswindows_shell_execute, 2, 4, 0, /* @@ -345,10 +342,10 @@ Extbyte *doc = NULL; if (STRINGP (operation)) - LISP_STRING_TO_TSTR (operation, opext); + opext = LISP_STRING_TO_TSTR (operation); /* #### What about path names, which may be links? */ if (STRINGP (parameters)) - LISP_STRING_TO_TSTR (parameters, parmext); + parmext = LISP_STRING_TO_TSTR (parameters); if (STRINGP (current_dir)) LISP_LOCAL_FILE_FORMAT_TO_TSTR (current_dir, path); if (STRINGP (document)) @@ -435,7 +432,7 @@ if (!mswindows_read_link_hash) mswindows_read_link_hash = make_string_hash_table (1000); - C_STRING_TO_TSTR (fname, fnameext); + fnameext = ITEXT_TO_TSTR (fname); /* See if we can find a cached value. */ @@ -552,7 +549,7 @@ PATH_MAX_TCHAR, &wfd, 0) #endif == S_OK) - TSTR_TO_C_STRING_MALLOC (resolved, retval); + retval = TSTR_TO_ITEXT_MALLOC (resolved); XECOMCALL0 (ppf, Release); } @@ -584,15 +581,14 @@ /* Always Unicode. Not obvious from the IPersistFile documentation, but look under "Shell Link" for example code. */ - C_STRING_TO_EXTERNAL (fname, fname_unicode, - Qmswindows_unicode); + fname_unicode = ITEXT_TO_EXTERNAL (fname, Qmswindows_unicode); if (XECOMCALL2 (ppf, Load, (LPWSTR) fname_unicode, STGM_READ) == S_OK && XECOMCALL4 (psl, GetPath, resolved, PATH_MAX_TCHAR, &wfd, 0) == S_OK) - TSTR_TO_C_STRING_MALLOC (resolved, retval); + retval = TSTR_TO_ITEXT_MALLOC (resolved); XECOMCALL0 (ppf, Release); }