[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: gaf.git: branch: master updated (1.7.0-20110116-118-g09c6613)



The branch, master has been updated
       via  09c6613f93b65d3f9193e7dbc65bd696cf8a6b06 (commit)
       via  f6d4725e307e27ec4dce3c080202a454a42c4ca8 (commit)
       via  3dbc8982a4e598a3435dfa7857c48c1b64fbe721 (commit)
       via  2986092b4301a2d4c501b322aa169fa351153ca0 (commit)
      from  259dc82a4115df0595b65542f8ab69add1946881 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 Makefile.am                    |    2 +-
 configure.ac                   |    3 -
 gnetlist/src/g_netlist.c       |   47 +++++++++++-----------
 gnetlist/src/gnetlist.c        |    7 ++-
 gnetlist/src/parsecmd.c        |   11 +++--
 gnetlist/src/s_net.c           |    3 +-
 gnetlist/src/s_rename.c        |    5 +-
 gnetlist/src/s_traverse.c      |    3 +-
 gnetlist/src/vams_misc.c       |    3 +-
 gschem/src/g_funcs.c           |    5 +-
 gschem/src/gschem.c            |    7 ++-
 gschem/src/parsecmd.c          |   13 +++---
 gschem/src/x_dialog.c          |    1 +
 gschem/src/x_window.c          |    5 +-
 libgeda/src/g_basic.c          |   11 +++--
 libgeda/src/g_rc.c             |   37 +++++++++---------
 libgeda/src/g_register.c       |    9 ++--
 libgeda/src/g_smob.c           |   21 +++++-----
 libgeda/src/o_attrib.c         |    1 +
 libgeda/src/o_text_basic.c     |    1 +
 libgeda/src/s_clib.c           |    7 ++-
 libgeda/src/s_color.c          |   15 ++++---
 m4/geda-guile-display-error.m4 |   60 -----------------------------
 m4/geda-guile.m4               |   83 ++++++++++++++++++++++++++++++++++++++-
 missing.h                      |   39 +++++++++++++++++++
 25 files changed, 236 insertions(+), 163 deletions(-)
 delete mode 100644 m4/geda-guile-display-error.m4
 create mode 100644 missing.h


=================
 Commit Messages
=================

commit 09c6613f93b65d3f9193e7dbc65bd696cf8a6b06
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>

    libgeda: Use UTF-8 instead of locale Scheme string functions.
    
    Note that there are several places where locale string functions are
    still used, because the input depends on the current locale
    (e.g. strings obtained from command-line options or from the
    filesystem).
    
    There are still a lot of places where we're still treating
    locale-dependent strings as UTF-8 strings (and probably vice-versa).
    Enough bugs for everybody to share!

:100644 100644 01cdeb1... d150f4b... M	gnetlist/src/g_netlist.c
:100644 100644 cb6ff50... b60c265... M	gnetlist/src/gnetlist.c
:100644 100644 9664349... 0e27ab1... M	gnetlist/src/parsecmd.c
:100644 100644 8aca89f... 91378ec... M	gnetlist/src/s_net.c
:100644 100644 b8adbb2... 149a1e1... M	gnetlist/src/s_rename.c
:100644 100644 42abd42... 01307c1... M	gnetlist/src/s_traverse.c
:100644 100644 6292346... 75a6f9a... M	gnetlist/src/vams_misc.c
:100644 100644 6b21abd... 73bb9db... M	gschem/src/g_funcs.c
:100644 100644 ea98861... a95ed99... M	gschem/src/gschem.c
:100644 100644 2fbb729... 074e41c... M	gschem/src/parsecmd.c
:100644 100644 3b2b4be... 047a288... M	gschem/src/x_dialog.c
:100644 100644 3e75a03... cb587ce... M	gschem/src/x_window.c
:100644 100644 2cfef97... 59bac07... M	libgeda/src/g_basic.c
:100644 100644 206290a... 65c3778... M	libgeda/src/g_rc.c
:100644 100644 b40f250... aa3cd31... M	libgeda/src/g_register.c
:100644 100644 73d49f6... 816c35b... M	libgeda/src/g_smob.c
:100644 100644 01c6b8a... cd2cb19... M	libgeda/src/o_attrib.c
:100644 100644 d40288d... a46137c... M	libgeda/src/o_text_basic.c
:100644 100644 b23f53f... ccdee58... M	libgeda/src/s_clib.c
:100644 100644 731173e... 5dcb070... M	libgeda/src/s_color.c

commit f6d4725e307e27ec4dce3c080202a454a42c4ca8
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>

    Provide scm_{to,from}_utf8_string() if not available.
    
    If libguile doesn't have functions for converting Scheme strings
    to/from UTF-8 strings, provide them.
    
    Fortunately, in Guile 1.8 (which doesn't have these functions) we can
    use scm_{to,from}_locale_string() as a direct substitute, since it
    just treats C strings as byte arrays and doesn't attempt to decode
    them.

:100644 100644 35e07e2... 49af23d... M	Makefile.am
:000000 100644 0000000... 1d4666a... A	missing.h

commit 3dbc8982a4e598a3435dfa7857c48c1b64fbe721
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>

    build-sys: Test for scm_{to,from}_utf8_string().
    
    In gEDA, we use UTF-8 strings, but Guile doesn't.  The behaviour of
    scm_{to,from}_locale_string() functions depends on the current locale,
    and may not be the right thing if the user has set a non-UTF-8 locale.
    This patch adds a configure test for the availability of the
    scm_{to,from}_utf8_string() functions, which will do the right thing
    with strings passed from gEDA to Guile independently of the locale.

:100644 100644 6c5db68... 085aa66... M	m4/geda-guile.m4

commit 2986092b4301a2d4c501b322aa169fa351153ca0
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>

    build-sys: Consolidate Guile-related Autoconf functions.
    
    Put all Guile-related Autoconf functions into one file, since there
    are getting to be a lot of them.

:100644 100644 29653a1... bb6f33a... M	configure.ac
:100644 000000 05faa12... 0000000... D	m4/geda-guile-display-error.m4
:100644 100644 abde61b... 6c5db68... M	m4/geda-guile.m4

=========
 Changes
=========

commit 09c6613f93b65d3f9193e7dbc65bd696cf8a6b06
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>

    libgeda: Use UTF-8 instead of locale Scheme string functions.
    
    Note that there are several places where locale string functions are
    still used, because the input depends on the current locale
    (e.g. strings obtained from command-line options or from the
    filesystem).
    
    There are still a lot of places where we're still treating
    locale-dependent strings as UTF-8 strings (and probably vice-versa).
    Enough bugs for everybody to share!

diff --git a/gnetlist/src/g_netlist.c b/gnetlist/src/g_netlist.c
index 01cdeb1..d150f4b 100644
--- a/gnetlist/src/g_netlist.c
+++ b/gnetlist/src/g_netlist.c
@@ -19,6 +19,7 @@
  */
 
 #include <config.h>
+#include <missing.h>
 
 #include <stdio.h> 
 #ifdef HAVE_STRING_H
@@ -76,7 +77,7 @@ SCM g_get_packages(SCM level)
         if (g_hash_table_lookup (ht, nl_current->component_uref) == NULL) {
           g_hash_table_insert (ht, nl_current->component_uref,
                                    nl_current->component_uref);
-          list = scm_cons (scm_from_locale_string (nl_current->component_uref),
+          list = scm_cons (scm_from_utf8_string (nl_current->component_uref),
                            list);
         }
       }
@@ -98,7 +99,7 @@ SCM g_get_non_unique_packages(SCM level)
     for (nl_current = netlist_head; nl_current != NULL;
          nl_current = nl_current->next) {
       if (nl_current->component_uref != NULL) {
-        list = scm_cons (scm_from_locale_string (nl_current->component_uref),
+        list = scm_cons (scm_from_utf8_string (nl_current->component_uref),
                          list);
       }
     }
@@ -128,7 +129,7 @@ SCM g_get_pins(SCM uref)
 		pl_current = nl_current->cpins;
 		while (pl_current != NULL) {
 		    if (pl_current->pin_number) {
-              list = scm_cons (scm_from_locale_string (pl_current->pin_number),
+              list = scm_cons (scm_from_utf8_string (pl_current->pin_number),
                                list);
 		    }
 		    pl_current = pl_current->next;
@@ -172,7 +173,7 @@ SCM g_get_all_nets(SCM scm_level)
 		    printf("Got net: `%s'\n", net_name);
 		    printf("pin %s\n", pl_current->pin_number);
 #endif
-		    list = scm_cons (scm_from_locale_string (net_name),
+		    list = scm_cons (scm_from_utf8_string (net_name),
                                      list);
 		}
 	    }
@@ -213,7 +214,7 @@ SCM g_get_all_unique_nets(SCM scm_level)
 		    /* add the net name to the list */
 		    /*printf("Got net: `%s'\n",net_name); */
 
-		    x = scm_from_locale_string (net_name);
+		    x = scm_from_utf8_string (net_name);
 		    if (scm_is_false (scm_member (x, list))) {
               list = scm_cons (x, list);
 		    }
@@ -291,8 +292,8 @@ SCM g_get_all_connections(SCM scm_netname)
 			    sscanf(n_current->connected_to,
 				   "%s %s", uref, pin);
 
-			    pairlist = scm_list_n (scm_from_locale_string (uref),
-                                       scm_from_locale_string (pin),
+			    pairlist = scm_list_n (scm_from_utf8_string (uref),
+                                       scm_from_utf8_string (pin),
                                        SCM_UNDEFINED);
 
 			    x = pairlist;
@@ -384,8 +385,8 @@ SCM g_get_nets(SCM scm_uref, SCM scm_pin)
 				    sscanf(n_current->connected_to,
 					   "%s %s", uref, pin);
 
-				    pairlist = scm_list_n (scm_from_locale_string (uref),
-                                           scm_from_locale_string (pin),
+				    pairlist = scm_list_n (scm_from_utf8_string (uref),
+                                           scm_from_utf8_string (pin),
                                            SCM_UNDEFINED);
 
 				    pinslist = scm_cons (pairlist, pinslist);
@@ -405,9 +406,9 @@ SCM g_get_nets(SCM scm_uref, SCM scm_pin)
     }
 
     if (net_name != NULL) {
-      outerlist = scm_cons (scm_from_locale_string (net_name), pinslist);
+      outerlist = scm_cons (scm_from_utf8_string (net_name), pinslist);
     } else {
-      outerlist = scm_cons (scm_from_locale_string ("ERROR_INVALID_PIN"),
+      outerlist = scm_cons (scm_from_utf8_string ("ERROR_INVALID_PIN"),
                             outerlist);
 	fprintf(stderr, "Invalid wanted_pin passed to get-nets [%s]\n",
 		wanted_pin);
@@ -455,8 +456,8 @@ SCM g_get_pins_nets(SCM scm_uref)
 			    pin = pl_current->pin_number;
 			    net_name = pl_current->net_name;
 
-			    pairlist = scm_cons (scm_from_locale_string (pin),
-                                                 scm_from_locale_string (net_name));
+			    pairlist = scm_cons (scm_from_utf8_string (pin),
+                                                 scm_from_utf8_string (net_name));
 			    pinslist = scm_cons (pairlist, pinslist);
 			}
 
@@ -502,8 +503,8 @@ SCM g_get_all_package_attributes(SCM scm_uref, SCM scm_wanted_attrib)
     SCM_ASSERT(scm_is_string (scm_wanted_attrib),
 	       scm_wanted_attrib, SCM_ARG2, "gnetlist:get-all-package-attributes");
 
-    uref          = scm_to_locale_string (scm_uref);
-    wanted_attrib = scm_to_locale_string (scm_wanted_attrib);
+    uref          = scm_to_utf8_string (scm_uref);
+    wanted_attrib = scm_to_utf8_string (scm_wanted_attrib);
 
     /* here is where you make it multi page aware */
     nl_current = netlist_head;
@@ -517,7 +518,7 @@ SCM g_get_all_package_attributes(SCM scm_uref, SCM scm_wanted_attrib)
 		    o_attrib_search_object_attribs_by_name (nl_current->object_ptr,
 		                                            wanted_attrib, 0);
 
-		ret = scm_cons (value ? scm_from_locale_string (value) : SCM_BOOL_F, ret);
+		ret = scm_cons (value ? scm_from_utf8_string (value) : SCM_BOOL_F, ret);
 
 		g_free (value);
 	    }
@@ -595,9 +596,9 @@ SCM g_get_attribute_by_pinseq(SCM scm_uref, SCM scm_pinseq,
   }
 
   if (return_value) {
-    scm_return_value = scm_from_locale_string (return_value);
+    scm_return_value = scm_from_utf8_string (return_value);
   } else {
-    scm_return_value = scm_from_locale_string ("unknown");
+    scm_return_value = scm_from_utf8_string ("unknown");
   }
 
 #if DEBUG
@@ -680,9 +681,9 @@ SCM g_get_attribute_by_pinnumber(SCM scm_uref, SCM scm_pin, SCM
     }
 
     if (return_value) {
-      scm_return_value = scm_from_locale_string (return_value);
+      scm_return_value = scm_from_utf8_string (return_value);
     } else {
-      scm_return_value = scm_from_locale_string ("unknown");
+      scm_return_value = scm_from_utf8_string ("unknown");
     }
 
     return (scm_return_value);
@@ -719,10 +720,10 @@ SCM g_get_toplevel_attribute(SCM scm_wanted_attrib)
   }
 
   if (attrib_value != NULL) {
-    scm_return_value = scm_from_locale_string (attrib_value);
+    scm_return_value = scm_from_utf8_string (attrib_value);
     g_free (attrib_value);
   } else {
-    scm_return_value = scm_from_locale_string ("not found");
+    scm_return_value = scm_from_utf8_string ("not found");
   }
 
   return (scm_return_value);
@@ -833,7 +834,7 @@ SCM g_graphical_objs_in_net_with_attrib_get_attrib (SCM scm_netname, SCM scm_has
 		        o_attrib_search_object_attribs_by_name (nl_current->object_ptr,
 		                                                wanted_attrib, 0);
 		      if (attrib_value) {
-			list = scm_cons (scm_from_locale_string (attrib_value), list);
+			list = scm_cons (scm_from_utf8_string (attrib_value), list);
 		      }
 		      g_free (attrib_value);
 		    }
diff --git a/gnetlist/src/gnetlist.c b/gnetlist/src/gnetlist.c
index cb6ff50..b60c265 100644
--- a/gnetlist/src/gnetlist.c
+++ b/gnetlist/src/gnetlist.c
@@ -20,6 +20,7 @@
 
 #include <config.h>
 #include <version.h>
+#include <missing.h>
 
 #include <stdio.h>
 #include <sys/param.h>
@@ -86,7 +87,7 @@ gnetlist_backends (TOPLEVEL *pr_current)
     /* Get directory name from Scheme */
     g_assert (scm_is_true (scm_list_p (s_load_path))); /* Sanity check */
     g_assert (scm_is_string (scm_car (s_load_path))); /* Sanity check */
-    dir_name = scm_to_locale_string (s_dir_name);
+    dir_name = scm_to_utf8_string (s_dir_name);
 
     /* Open directory */
     dptr = opendir (dir_name);
@@ -259,7 +260,7 @@ void main_prog(void *closure, int argc, char *argv[])
 #endif
 
     /* Load basic gnetlist functions */
-    scm_primitive_load_path (scm_from_locale_string ("gnetlist.scm"));
+    scm_primitive_load_path (scm_from_utf8_string ("gnetlist.scm"));
 
     if (guile_proc) {
       SCM s_backend_path;
@@ -298,7 +299,7 @@ void main_prog(void *closure, int argc, char *argv[])
     g_free(cwd);
 
     /* Run post-traverse code. */
-    scm_primitive_load_path (scm_from_locale_string ("gnetlist-post.scm"));
+    scm_primitive_load_path (scm_from_utf8_string ("gnetlist-post.scm"));
 
     if (guile_proc) {
         /* check size here hack */
diff --git a/gnetlist/src/parsecmd.c b/gnetlist/src/parsecmd.c
index 9664349..0e27ab1 100644
--- a/gnetlist/src/parsecmd.c
+++ b/gnetlist/src/parsecmd.c
@@ -20,6 +20,7 @@
 
 #include <config.h>
 #include <version.h>
+#include <missing.h>
 
 #include <stdio.h>
 #ifdef HAVE_STRING_H
@@ -127,11 +128,11 @@ int
 parse_commandline (int argc, char *argv[])
 {
   int ch;
-  SCM sym_begin = scm_from_locale_symbol ("begin");
-  SCM sym_cons = scm_from_locale_symbol ("cons");
-  SCM sym_load = scm_from_locale_symbol ("load");
-  SCM sym_set_x = scm_from_locale_symbol ("set!");
-  SCM sym_load_path = scm_from_locale_symbol ("%load-path");
+  SCM sym_begin = scm_from_utf8_symbol ("begin");
+  SCM sym_cons = scm_from_utf8_symbol ("cons");
+  SCM sym_load = scm_from_utf8_symbol ("load");
+  SCM sym_set_x = scm_from_utf8_symbol ("set!");
+  SCM sym_load_path = scm_from_utf8_symbol ("%load-path");
 
 #ifdef HAVE_GETOPT_LONG
   /* int option_index = 0; */
diff --git a/gnetlist/src/s_net.c b/gnetlist/src/s_net.c
index 8aca89f..91378ec 100644
--- a/gnetlist/src/s_net.c
+++ b/gnetlist/src/s_net.c
@@ -19,6 +19,7 @@
  */
 
 #include <config.h>
+#include <missing.h>
 
 #include <stdio.h>
 #include <ctype.h>
@@ -162,7 +163,7 @@ char *s_net_return_connected_string(TOPLEVEL * pr_current, OBJECT * object,
     scm_uref = g_scm_c_get_uref(pr_current, o_current->parent);
 
     if (scm_is_string( scm_uref )) {
-      temp_uref = scm_to_locale_string( scm_uref );
+      temp_uref = scm_to_utf8_string (scm_uref);
     }
 
     if (hierarchy_tag) {
diff --git a/gnetlist/src/s_rename.c b/gnetlist/src/s_rename.c
index b8adbb2..149a1e1 100644
--- a/gnetlist/src/s_rename.c
+++ b/gnetlist/src/s_rename.c
@@ -25,6 +25,7 @@
   */
   
 #include <config.h>
+#include <missing.h>
 
 #include <stdio.h>
 #include <ctype.h>
@@ -323,8 +324,8 @@ SCM g_get_renamed_nets(SCM scm_level)
     {
         for (temp_rename = temp_set->first_rename; temp_rename; temp_rename = temp_rename->next)
         {
-            pairlist = scm_list_n (scm_from_locale_string (temp_rename->src),
-                                   scm_from_locale_string (temp_rename->dest),
+            pairlist = scm_list_n (scm_from_utf8_string (temp_rename->src),
+                                   scm_from_utf8_string (temp_rename->dest),
                                    SCM_UNDEFINED);
             outerlist = scm_cons (pairlist, outerlist);
         }
diff --git a/gnetlist/src/s_traverse.c b/gnetlist/src/s_traverse.c
index 42abd42..01307c1 100644
--- a/gnetlist/src/s_traverse.c
+++ b/gnetlist/src/s_traverse.c
@@ -19,6 +19,7 @@
  */
 
 #include <config.h>
+#include <missing.h>
 
 #include <stdio.h>
 #ifdef HAVE_STRING_H
@@ -196,7 +197,7 @@ s_traverse_sheet (TOPLEVEL * pr_current, const GList *obj_list, char *hierarchy_
       scm_uref = g_scm_c_get_uref(pr_current, o_current);
 
       if (scm_is_string( scm_uref )) {
-        temp_uref = scm_to_locale_string( scm_uref );
+        temp_uref = scm_to_utf8_string (scm_uref);
         netlist->component_uref =
           s_hierarchy_create_uref(pr_current, temp_uref, hierarchy_tag);
         g_free(temp_uref);
diff --git a/gnetlist/src/vams_misc.c b/gnetlist/src/vams_misc.c
index 6292346..75a6f9a 100644
--- a/gnetlist/src/vams_misc.c
+++ b/gnetlist/src/vams_misc.c
@@ -19,6 +19,7 @@
  */
 
 #include <config.h>
+#include <missing.h>
 
 #include <stdio.h>
 #ifdef HAVE_STRING_H
@@ -55,7 +56,7 @@ vams_get_attribs_list (OBJECT *object)
       val = o_attrib_get_name_value (a_current, &found_name, NULL);
 
       if (val) {
-        list = scm_cons (scm_from_locale_string (found_name), list);
+        list = scm_cons (scm_from_utf8_string (found_name), list);
       }
 
       g_free (found_name);
diff --git a/gschem/src/g_funcs.c b/gschem/src/g_funcs.c
index 6b21abd..73bb9db 100644
--- a/gschem/src/g_funcs.c
+++ b/gschem/src/g_funcs.c
@@ -18,6 +18,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <config.h>
+#include <missing.h>
 
 #include <stdio.h>
 #include <sys/stat.h>
@@ -224,7 +225,7 @@ SCM g_funcs_filesel(SCM msg, SCM templ, SCM flags)
 			      c_flags
 			      );
 
-  v = scm_from_locale_string (r);
+  v = scm_from_utf8_string (r);
   g_free (r);
 
   return v;
@@ -259,7 +260,7 @@ hash_table_2_list (gpointer key,
                    gpointer user_data)
 {
   SCM *plist = (SCM*)user_data;
-  *plist = scm_cons (scm_from_locale_string ((char*)value), *plist);
+  *plist = scm_cons (scm_from_utf8_string ((char*)value), *plist);
 }
 
 /*! \todo Finish function documentation!!!
diff --git a/gschem/src/gschem.c b/gschem/src/gschem.c
index ea98861..a95ed99 100644
--- a/gschem/src/gschem.c
+++ b/gschem/src/gschem.c
@@ -19,6 +19,7 @@
  */
 #include <config.h>
 #include <version.h>
+#include <missing.h>
 
 #include <stdio.h>
 #ifdef HAVE_STRING_H
@@ -237,11 +238,11 @@ void main_prog(void *closure, int argc, char *argv[])
 
   /* By this point, libgeda should have setup the Guile load path, so
    * we can take advantage of that.  */
-  scm_tmp = scm_sys_search_load_path (scm_from_locale_string ("gschem.scm"));
+  scm_tmp = scm_sys_search_load_path (scm_from_utf8_string ("gschem.scm"));
   if (scm_is_false (scm_tmp)) {
     s_log_message (_("Couldn't find init scm file [%s]\n"), "gschem.scm");
   }
-  input_str = scm_to_locale_string (scm_tmp);
+  input_str = scm_to_utf8_string (scm_tmp);
   if (g_read_file(w_current->toplevel, input_str, NULL)) {
     s_log_message(_("Read init scm file [%s]\n"), input_str);
   } else {
@@ -250,7 +251,7 @@ void main_prog(void *closure, int argc, char *argv[])
     s_log_message(_("Failed to read init scm file [%s]\n"),
                   input_str);
   }
-  free (input_str); /* M'allocated by scm_to_locale_string() */
+  free (input_str); /* M'allocated by scm_to_utf8_string() */
   scm_remember_upto_here_1 (scm_tmp);
 
   /* Set default icon */
diff --git a/gschem/src/parsecmd.c b/gschem/src/parsecmd.c
index 2fbb729..074e41c 100644
--- a/gschem/src/parsecmd.c
+++ b/gschem/src/parsecmd.c
@@ -19,6 +19,7 @@
  */
 #include <config.h>
 #include <version.h>
+#include <missing.h>
 
 #include <stdio.h>
 #include <ctype.h>
@@ -135,12 +136,12 @@ int
 parse_commandline(int argc, char *argv[])
 {
   int ch;
-  SCM sym_cons = scm_from_locale_symbol ("cons");
-  SCM sym_set_x = scm_from_locale_symbol ("set!");
-  SCM sym_load_path = scm_from_locale_symbol ("%load-path");
-  SCM sym_begin = scm_from_locale_symbol ("begin");
-  SCM sym_load = scm_from_locale_symbol ("load");
-  SCM sym_eval_string = scm_from_locale_symbol ("eval-string");
+  SCM sym_cons = scm_from_utf8_symbol ("cons");
+  SCM sym_set_x = scm_from_utf8_symbol ("set!");
+  SCM sym_load_path = scm_from_utf8_symbol ("%load-path");
+  SCM sym_begin = scm_from_utf8_symbol ("begin");
+  SCM sym_load = scm_from_utf8_symbol ("load");
+  SCM sym_eval_string = scm_from_utf8_symbol ("eval-string");
 
 #ifdef HAVE_GETOPT_LONG
   while ((ch = getopt_long (argc, argv, GETOPT_OPTIONS, long_options, NULL)) != -1) {
diff --git a/gschem/src/x_dialog.c b/gschem/src/x_dialog.c
index 3b2b4be..047a288 100644
--- a/gschem/src/x_dialog.c
+++ b/gschem/src/x_dialog.c
@@ -20,6 +20,7 @@
 /*! \todo STILL NEED to clean up line lengths in aa and tr */
 #include <config.h>
 #include <version.h>
+#include <missing.h>
 
 #include <stdio.h>
 #ifdef HAVE_STDLIB_H
diff --git a/gschem/src/x_window.c b/gschem/src/x_window.c
index 3e75a03..cb587ce 100644
--- a/gschem/src/x_window.c
+++ b/gschem/src/x_window.c
@@ -18,6 +18,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <config.h>
+#include <missing.h>
 
 #include <stdio.h>
 
@@ -226,8 +227,8 @@ static void x_window_invoke_macro(GtkEntry *entry, void *userdata)
   GSCHEM_TOPLEVEL *w_current = userdata;
   SCM interpreter;
 
-  interpreter = scm_list_2(scm_from_locale_symbol("invoke-macro"),
-			   scm_from_locale_string(gtk_entry_get_text(entry)));
+  interpreter = scm_list_2(scm_from_utf8_symbol("invoke-macro"),
+			   scm_from_utf8_string(gtk_entry_get_text(entry)));
 
   g_scm_eval_protected(interpreter, SCM_UNDEFINED);
 
diff --git a/libgeda/src/g_basic.c b/libgeda/src/g_basic.c
index 2cfef97..59bac07 100644
--- a/libgeda/src/g_basic.c
+++ b/libgeda/src/g_basic.c
@@ -18,6 +18,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <config.h>
+#include <missing.h>
 
 #include <stdio.h>
 #include <sys/stat.h>
@@ -131,7 +132,7 @@ SCM g_scm_eval_protected (SCM exp, SCM module_or_state)
 SCM g_scm_c_eval_string_protected (const gchar *str) {
   SCM s_str;
   g_return_val_if_fail ((str != NULL), SCM_BOOL_F);
-  s_str = scm_from_locale_string (str);
+  s_str = scm_from_utf8_string (str);
   return g_scm_eval_string_protected (s_str);
 }
 
@@ -150,7 +151,7 @@ SCM g_scm_c_eval_string_protected (const gchar *str) {
  */
 SCM g_scm_eval_string_protected (SCM str)
 {
-  SCM expr = scm_list_2 (scm_from_locale_symbol ("eval-string"),
+  SCM expr = scm_list_2 (scm_from_utf8_symbol ("eval-string"),
                          str);
 
   return g_scm_eval_protected (expr, SCM_UNDEFINED);
@@ -210,7 +211,7 @@ g_read_file(TOPLEVEL *toplevel, const gchar *filename, GError **err)
   g_return_val_if_fail ((filename != NULL), FALSE);
 
   data.stack = SCM_BOOL_F;
-  data.filename = scm_from_locale_string (filename);
+  data.filename = scm_from_utf8_string (filename);
   data.err = NULL;
 
   scm_c_catch (SCM_BOOL_T,
@@ -248,7 +249,7 @@ process_error_stack (SCM s_stack, SCM s_key, SCM s_args, GError **err) {
   /* Capture short error message */
   s_port = scm_open_output_string ();
   scm_display_error_message (s_message, s_message_args, s_port);
-  short_message = scm_to_locale_string (scm_get_output_string (s_port));
+  short_message = scm_to_utf8_string (scm_get_output_string (s_port));
   scm_close_output_port (s_port);
 
   /* Capture long error message (including possible backtrace) */
@@ -271,7 +272,7 @@ process_error_stack (SCM s_stack, SCM s_key, SCM s_args, GError **err) {
   scm_display_error (s_location, s_port, s_subr,
                      s_message, s_message_args, s_rest);
 
-  long_message = scm_to_locale_string (scm_get_output_string (s_port));
+  long_message = scm_to_utf8_string (scm_get_output_string (s_port));
   scm_close_output_port (s_port);
 
   /* Send long message to log */
diff --git a/libgeda/src/g_rc.c b/libgeda/src/g_rc.c
index 206290a..65c3778 100644
--- a/libgeda/src/g_rc.c
+++ b/libgeda/src/g_rc.c
@@ -18,6 +18,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <config.h>
+#include <missing.h>
 
 #include <errno.h>
 #include <stdio.h>
@@ -85,7 +86,7 @@ SCM g_rc_mode_general(SCM scmmode,
   SCM_ASSERT (scm_is_string (scmmode), scmmode,
               SCM_ARG1, rc_name);
   
-  mode = scm_to_locale_string (scmmode);
+  mode = scm_to_utf8_string (scmmode);
   
   index = vstbl_lookup_str(table, table_size, mode);
   /* no match? */
@@ -408,11 +409,11 @@ SCM g_rc_component_library(SCM path, SCM name)
   if (name != SCM_UNDEFINED) {
     SCM_ASSERT (scm_is_string (name), name,
 		SCM_ARG2, "component-library");
-    namestr = scm_to_locale_string (name);
+    namestr = scm_to_utf8_string (name);
   }
   
   /* take care of any shell variables */
-  temp = scm_to_locale_string (path);
+  temp = scm_to_utf8_string (path);
   string = s_expand_env_variables (temp);
   free (temp);
 
@@ -474,17 +475,17 @@ SCM g_rc_component_library_command (SCM listcmd, SCM getcmd,
 
   /* take care of any shell variables */
   /*! \bug this may be a security risk! */
-  tmp_str = scm_to_locale_string (listcmd);
+  tmp_str = scm_to_utf8_string (listcmd);
   lcmdstr = s_expand_env_variables (tmp_str);
   free (tmp_str); /* this should stay as free (allocated from guile) */
 
   /* take care of any shell variables */
   /*! \bug this may be a security risk! */
-  tmp_str = scm_to_locale_string (getcmd);
+  tmp_str = scm_to_utf8_string (getcmd);
   gcmdstr = s_expand_env_variables (tmp_str);
   free (tmp_str); /* this should stay as free (allocated from guile) */
 
-  namestr = scm_to_locale_string (name);
+  namestr = scm_to_utf8_string (name);
 
   src = s_clib_add_command (lcmdstr, gcmdstr, namestr);
 
@@ -525,7 +526,7 @@ SCM g_rc_component_library_funcs (SCM listfunc, SCM getfunc, SCM name)
   SCM_ASSERT (scm_is_string (name), name, SCM_ARG1, 
 	      "component-library-funcs");
 
-  namestr = scm_to_locale_string (name);
+  namestr = scm_to_utf8_string (name);
 
   if (s_clib_add_scm (listfunc, getfunc, namestr) != NULL) {
     result = SCM_BOOL_T;
@@ -553,7 +554,7 @@ SCM g_rc_component_library_search(SCM path)
               SCM_ARG1, "component-library-search");
 
   /* take care of any shell variables */
-  temp = scm_to_locale_string (path);
+  temp = scm_to_utf8_string (path);
   string = s_expand_env_variables (temp);
   free (temp);
 
@@ -620,7 +621,7 @@ SCM g_rc_source_library(SCM path)
               SCM_ARG1, "source-library");
 
   /* take care of any shell variables */
-  temp = scm_to_locale_string (path);
+  temp = scm_to_utf8_string (path);
   string = s_expand_env_variables (temp);
   free (temp);
   
@@ -667,7 +668,7 @@ SCM g_rc_source_library_search(SCM path)
               SCM_ARG1, "source-library-search");
 
   /* take care of any shell variables */
-  temp = scm_to_locale_string (path);
+  temp = scm_to_utf8_string (path);
   string = s_expand_env_variables (temp);
   free (temp);
 
@@ -777,7 +778,7 @@ SCM g_rc_untitled_name(SCM name)
 
   g_free(default_untitled_name);
 
-  temp = scm_to_locale_string (name);
+  temp = scm_to_utf8_string (name);
   default_untitled_name = g_strdup (temp);
   free (temp);
 
@@ -804,9 +805,9 @@ SCM g_rc_scheme_directory(SCM s_path)
               SCM_ARG1, "scheme-directory");
 
   /* take care of any shell variables */
-  temp = scm_to_locale_string (s_path);
+  temp = scm_to_utf8_string (s_path);
   expanded = s_expand_env_variables (temp);
-  s_path = scm_from_locale_string (expanded);
+  s_path = scm_from_utf8_string (expanded);
   free (temp);
   g_free (expanded);
 
@@ -836,7 +837,7 @@ SCM g_rc_bitmap_directory(SCM path)
               SCM_ARG1, "bitmap-directory");
   
   /* take care of any shell variables */
-  temp = scm_to_locale_string (path);
+  temp = scm_to_utf8_string (path);
   string = s_expand_env_variables (temp);
   free (temp);
 
@@ -871,7 +872,7 @@ SCM g_rc_bus_ripper_symname(SCM scmsymname)
 
   g_free(default_bus_ripper_symname);
 
-  temp = scm_to_locale_string (scmsymname);
+  temp = scm_to_utf8_string (scmsymname);
   default_bus_ripper_symname = g_strdup (temp);
   free (temp);
 
@@ -895,7 +896,7 @@ SCM g_rc_postscript_prolog(SCM scmsymname)
   g_free(default_postscript_prolog);
 
   /* take care of any shell variables */
-  temp = scm_to_locale_string (scmsymname);
+  temp = scm_to_utf8_string (scmsymname);
   default_postscript_prolog =
     s_expand_env_variables (temp);
   free (temp);
@@ -1005,7 +1006,7 @@ SCM g_rc_always_promote_attributes(SCM attrlist)
 		    " is deprecated. Use a list of strings instead\n"));
 
     /* convert the space separated strings into a GList */
-    temp = scm_to_locale_string (attrlist);
+    temp = scm_to_utf8_string (attrlist);
     attr2 = g_strsplit(temp," ", 0);
     free (temp);
 
@@ -1024,7 +1025,7 @@ SCM g_rc_always_promote_attributes(SCM attrlist)
       SCM_ASSERT(scm_is_string(scm_list_ref(attrlist, scm_from_int(i))), 
 		 scm_list_ref(attrlist, scm_from_int(i)), SCM_ARG1, 
 		 "always-promote-attribute: list element is not a string");
-      temp = scm_to_locale_string (scm_list_ref (attrlist, scm_from_int (i)));
+      temp = scm_to_utf8_string (scm_list_ref (attrlist, scm_from_int (i)));
       attr = g_strdup(temp);
       free (temp);
       list = g_list_prepend(list, attr);
diff --git a/libgeda/src/g_register.c b/libgeda/src/g_register.c
index b40f250..aa3cd31 100644
--- a/libgeda/src/g_register.c
+++ b/libgeda/src/g_register.c
@@ -19,6 +19,7 @@
  */
 
 #include <config.h>
+#include <missing.h>
 
 #include <stdio.h>
 #include <sys/stat.h>
@@ -97,11 +98,11 @@ void g_register_libgeda_funcs (void)
 void g_register_libgeda_vars (void)
 {
   scm_c_define("geda-rc-path", 
-	       scm_from_locale_string (s_path_sys_config ()));
+	       scm_from_utf8_string (s_path_sys_config ()));
   scm_c_define("geda-data-path",
-	       scm_from_locale_string (s_path_sys_data ()));
+	       scm_from_utf8_string (s_path_sys_data ()));
   scm_c_define("path-sep", 
-	       scm_from_locale_string(G_DIR_SEPARATOR_S));
+	       scm_from_utf8_string(G_DIR_SEPARATOR_S));
 
   scm_c_define("OBJ_LINE", SCM_MAKE_CHAR((unsigned char) OBJ_LINE));
   scm_c_define("OBJ_BOX", SCM_MAKE_CHAR((unsigned char) OBJ_BOX));
@@ -128,6 +129,6 @@ g_register_libgeda_dirs (void)
   char *scheme_dir;
 
   scheme_dir = g_build_filename (s_path_sys_data (), "scheme", NULL);
-  g_rc_scheme_directory (scm_from_locale_string (scheme_dir));
+  g_rc_scheme_directory (scm_from_utf8_string (scheme_dir));
   g_free (scheme_dir);
 }
diff --git a/libgeda/src/g_smob.c b/libgeda/src/g_smob.c
index 73d49f6..816c35b 100644
--- a/libgeda/src/g_smob.c
+++ b/libgeda/src/g_smob.c
@@ -18,6 +18,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <config.h>
+#include <missing.h>
 
 #include <math.h>
 #include <stdio.h>
@@ -72,7 +73,7 @@ static int g_print_attrib_smob(SCM attrib_smob, SCM port,
       attribute->attribute->text &&
       attribute->attribute->text->string ) {
     scm_puts("#<attribute ", port);
-    scm_display (scm_from_locale_string (attribute->attribute->text->string),
+    scm_display (scm_from_utf8_string (attribute->attribute->text->string),
                  port);
     scm_puts(">", port);
   }
@@ -127,8 +128,8 @@ SCM g_get_attrib_name_value(SCM attrib_smob)
   if (attribute != NULL &&
       attribute->attribute != NULL &&
       o_attrib_get_name_value (attribute->attribute, &name, &value)) {
-    returned = scm_cons (scm_from_locale_string (name),
-                         scm_from_locale_string (value));
+    returned = scm_cons (scm_from_utf8_string (name),
+                         scm_from_utf8_string (value));
     g_free(name);
     g_free(value);
   }
@@ -164,7 +165,7 @@ SCM g_set_attrib_value_internal(SCM attrib_smob, SCM scm_value,
 	      "set-attribute-value!");
 
   attribute = (struct st_attrib_smob *) SCM_SMOB_DATA (attrib_smob);
-  value = scm_to_locale_string (scm_value);
+  value = scm_to_utf8_string (scm_value);
 
   if (attribute != NULL &&
       attribute->attribute != NULL) {
@@ -242,7 +243,7 @@ SCM g_calcule_new_attrib_bounds (SCM attrib_smob, SCM scm_alignment,
   x = scm_to_int(scm_x);
   y = scm_to_int(scm_y);
   
-  alignment_string = scm_to_locale_string (scm_alignment);
+  alignment_string = scm_to_utf8_string (scm_alignment);
 
   if (strlen(alignment_string) == 0) {
     alignment = -1;
@@ -485,7 +486,7 @@ static int g_print_object_smob(SCM object_smob, SCM port,
       object->object &&
       object->object->name) {
     scm_puts("#<object ", port);
-    scm_display (scm_from_locale_string (object->object->name),
+    scm_display (scm_from_utf8_string (object->object->name),
                  port);
     scm_puts(">", port);
   }
@@ -583,7 +584,7 @@ SCM g_get_attrib_value_by_attrib_name(SCM object_smob, SCM scm_attrib_name)
 
   /* Get parameters */
   object = (struct st_object_smob *)SCM_CDR(object_smob);
-  attrib_name = scm_to_locale_string (scm_attrib_name);
+  attrib_name = scm_to_utf8_string (scm_attrib_name);
 
   if (object && object->object) {
 
@@ -594,7 +595,7 @@ SCM g_get_attrib_value_by_attrib_name(SCM object_smob, SCM scm_attrib_name)
       if (a_current != NULL &&
           o_attrib_get_name_value (a_current, &name, &value)) {
         if (strcmp(name, attrib_name) == 0)
-          returned = scm_cons (scm_from_locale_string (value), returned);
+          returned = scm_cons (scm_from_utf8_string (value), returned);
         g_free (name);
         g_free (value);
       }
@@ -749,7 +750,7 @@ static int g_print_page_smob(SCM page_smob, SCM port,
       page->page &&
       page->page->page_filename) {
     scm_puts("#<page ", port);
-    scm_display (scm_from_locale_string (page->page->page_filename),
+    scm_display (scm_from_utf8_string (page->page->page_filename),
                  port);
     scm_puts(">", port);
   }
@@ -874,7 +875,7 @@ SCM g_get_page_filename(SCM page_smob)
     (((struct st_page_smob *) SCM_SMOB_DATA (page_smob))->page);
 
   if (page->page_filename) 
-    returned = scm_from_locale_string (page->page_filename);
+    returned = scm_from_utf8_string (page->page_filename);
 
   return (returned);
 }
diff --git a/libgeda/src/o_attrib.c b/libgeda/src/o_attrib.c
index 01c6b8a..cd2cb19 100644
--- a/libgeda/src/o_attrib.c
+++ b/libgeda/src/o_attrib.c
@@ -41,6 +41,7 @@
  */
 
 #include <config.h>
+#include <missing.h>
 
 #include <stdio.h>
 #ifdef HAVE_STRING_H
diff --git a/libgeda/src/o_text_basic.c b/libgeda/src/o_text_basic.c
index d40288d..a46137c 100644
--- a/libgeda/src/o_text_basic.c
+++ b/libgeda/src/o_text_basic.c
@@ -60,6 +60,7 @@
  */
 
 #include <config.h>
+#include <missing.h>
 
 #include <stdio.h>
 #include <math.h>
diff --git a/libgeda/src/s_clib.c b/libgeda/src/s_clib.c
index b23f53f..ccdee58 100644
--- a/libgeda/src/s_clib.c
+++ b/libgeda/src/s_clib.c
@@ -111,6 +111,7 @@
  */
 
 #include <config.h>
+#include <missing.h>
 
 #include <stdio.h>
 #include <glib.h>
@@ -746,7 +747,7 @@ static void refresh_scm (CLibSource *source)
 
       /* Need to make sure that the correct free() function is called
        * on strings allocated by Guile. */
-      tmp = scm_to_locale_string (symname);
+      tmp = scm_to_utf8_string (symname);
       symbol->name = g_strdup(tmp);
       free (tmp);
 
@@ -1136,7 +1137,7 @@ static gchar *get_data_scm (const CLibSymbol *symbol)
   g_return_val_if_fail ((symbol->source->type == CLIB_SCM), NULL);
 
   symdata = scm_call_1 (symbol->source->get_fn, 
-			scm_from_locale_string (symbol->name));
+			scm_from_utf8_string (symbol->name));
 
   if (!scm_is_string (symdata)) {
     s_log_message (_("Failed to load symbol data [%s] from source [%s]\n"),
@@ -1146,7 +1147,7 @@ static gchar *get_data_scm (const CLibSymbol *symbol)
 
   /* Need to make sure that the correct free() function is called
    * on strings allocated by Guile. */
-  tmp = scm_to_locale_string (symdata);
+  tmp = scm_to_utf8_string (symdata);
   result = g_strdup(tmp);
   free (tmp);
 
diff --git a/libgeda/src/s_color.c b/libgeda/src/s_color.c
index 731173e..5dcb070 100644
--- a/libgeda/src/s_color.c
+++ b/libgeda/src/s_color.c
@@ -18,6 +18,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <config.h>
+#include <missing.h>
 
 #include <stdio.h>
 #include <math.h>
@@ -229,7 +230,7 @@ s_color_map_to_scm (const COLOR *map)
     if (map[i].enabled) {
       COLOR c = map[i];
       gchar *rgba = s_color_rgba_encode (c.r, c.g, c.b, c.a);
-      color_val = scm_from_locale_string (rgba);
+      color_val = scm_from_utf8_string (rgba);
       g_free (rgba);
     }
     result = scm_cons (scm_list_2 (scm_from_int (i), color_val), result);
@@ -244,8 +245,8 @@ void
 s_color_map_from_scm (COLOR *map, SCM lst, const char *scheme_proc_name)
 {
   SCM curr = lst;
-  SCM wrong_type_arg_sym = scm_from_locale_symbol ("wrong-type-arg");
-  SCM proc_name = scm_from_locale_string (scheme_proc_name);
+  SCM wrong_type_arg_sym = scm_from_utf8_symbol ("wrong-type-arg");
+  SCM proc_name = scm_from_utf8_string (scheme_proc_name);
   while (curr != SCM_EOL) {
     int i;
     char *rgba;
@@ -258,7 +259,7 @@ s_color_map_from_scm (COLOR *map, SCM lst, const char *scheme_proc_name)
     if (!scm_is_true (scm_list_p (entry))
         || (scm_to_int (scm_length (entry)) != 2)) {
       scm_error_scm (wrong_type_arg_sym, proc_name,
-                     scm_from_locale_string (_("Color map entry must be a two-element list")),
+                     scm_from_utf8_string (_("Color map entry must be a two-element list")),
                      SCM_EOL, scm_list_1 (entry));
     }
 
@@ -266,7 +267,7 @@ s_color_map_from_scm (COLOR *map, SCM lst, const char *scheme_proc_name)
     s = scm_car (entry);
     if (!scm_is_integer (s)) {
       scm_error_scm (wrong_type_arg_sym, proc_name,
-                     scm_from_locale_string (_("Index in color map entry must be an integer")),
+                     scm_from_utf8_string (_("Index in color map entry must be an integer")),
                      SCM_EOL, scm_list_1 (s));
     }
     i = scm_to_int (s);
@@ -292,10 +293,10 @@ s_color_map_from_scm (COLOR *map, SCM lst, const char *scheme_proc_name)
     s = scm_cadr (entry);
     if (!scm_is_string (s)) {
       scm_error_scm (wrong_type_arg_sym, proc_name,
-                     scm_from_locale_string (_("Value in color map entry must be #f or a string")),
+                     scm_from_utf8_string (_("Value in color map entry must be #f or a string")),
                      SCM_EOL, scm_list_1 (s));
     }
-    rgba = scm_to_locale_string (s);
+    rgba = scm_to_utf8_string (s);
 
     result = s_color_rgba_decode (rgba, &c.r, &c.g, &c.b, &c.a);
 

commit f6d4725e307e27ec4dce3c080202a454a42c4ca8
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>

    Provide scm_{to,from}_utf8_string() if not available.
    
    If libguile doesn't have functions for converting Scheme strings
    to/from UTF-8 strings, provide them.
    
    Fortunately, in Guile 1.8 (which doesn't have these functions) we can
    use scm_{to,from}_locale_string() as a direct substitute, since it
    just treats C strings as byte arrays and doesn't attempt to decode
    them.

diff --git a/Makefile.am b/Makefile.am
index 35e07e2..49af23d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -18,7 +18,7 @@ DISTCHECK_CONFIGURE_FLAGS = \
 	--disable-update-xdg-database
 
 BUILT_SOURCES = version.h
-EXTRA_DIST = autogen.sh version.h version.h.in README.Cygwin HACKING \
+EXTRA_DIST = autogen.sh version.h version.h.in missing.h README.Cygwin HACKING \
 	COPYING.LGPL
 
 # Generate version.h. This works by looking at any git repository that
diff --git a/missing.h b/missing.h
new file mode 100644
index 0000000..1d4666a
--- /dev/null
+++ b/missing.h
@@ -0,0 +1,39 @@
+
+/* This file contains preprocessor macros which provide substitutes
+ * for missing functions or other definitions based on the results of
+ * configure. */
+
+/* We need to be able to pass UTF-8 strings to and from libguile.  The
+ * most forward-compatible way to do this is to explicitly use the
+ * "utf8" API for doing so, but this API is only available from Guile
+ * 2.0 onwards.
+ *
+ * In Guile 2.0 there is a similar "locale" API which encodes/decodes
+ * strings differently based on the locale, so we need to avoid it in
+ * case the user decides to set a non-UTF-8 locale.  However, the
+ * "locale" API *is* present in Guile 1.8, in which it doesn't attempt
+ * to encode/decode the strings its passed, so we can use it as a
+ * direct replacement for the "utf8" API.
+ *
+ * Confused yet?
+ */
+
+#ifndef HAVE_SCM_FROM_UTF8_STRINGN
+#  define scm_from_utf8_stringn scm_from_locale_stringn
+#endif
+#ifndef HAVE_SCM_FROM_UTF8_STRING
+#  define scm_from_utf8_string(x) scm_from_utf8_stringn ((x), -1)
+#endif
+#ifndef HAVE_SCM_TO_UTF8_STRINGN
+#  define scm_to_utf8_stringn scm_to_locale_stringn
+#endif
+#ifndef HAVE_SCM_TO_UTF8_STRING
+#  define scm_to_utf8_string(x) scm_to_utf8_stringn ((x), NULL)
+#endif
+
+#ifndef HAVE_SCM_FROM_UTF8_SYMBOLN
+#  define scm_from_utf8_symboln scm_from_locale_symboln
+#endif
+#ifndef HAVE_SCM_FROM_UTF8_SYMBOL
+#  define scm_from_utf8_symbol scm_from_locale_symbol
+#endif

commit 3dbc8982a4e598a3435dfa7857c48c1b64fbe721
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>

    build-sys: Test for scm_{to,from}_utf8_string().
    
    In gEDA, we use UTF-8 strings, but Guile doesn't.  The behaviour of
    scm_{to,from}_locale_string() functions depends on the current locale,
    and may not be the right thing if the user has set a non-UTF-8 locale.
    This patch adds a configure test for the availability of the
    scm_{to,from}_utf8_string() functions, which will do the right thing
    with strings passed from gEDA to Guile independently of the locale.

diff --git a/m4/geda-guile.m4 b/m4/geda-guile.m4
index 6c5db68..085aa66 100644
--- a/m4/geda-guile.m4
+++ b/m4/geda-guile.m4
@@ -161,4 +161,25 @@ configure.])
     fi
   fi
 
+  # Check for functions in `libguile'
+  # ---------------------------------
+
+  # Save build-related variables
+  save_CFLAGS="${CFLAGS}"
+  save_LIBS="${LIBS}"
+
+  CFLAGS="${GUILE_CFLAGS} ${CFLAGS}"
+  LIBS="${GUILE_LIBS}"
+
+  AC_CHECK_FUNCS([scm_from_utf8_string])
+  AC_CHECK_FUNCS([scm_from_utf8_stringn])
+  AC_CHECK_FUNCS([scm_to_utf8_string])
+  AC_CHECK_FUNCS([scm_to_utf8_stringn])
+  AC_CHECK_FUNCS([scm_from_utf8_symbol])
+  AC_CHECK_FUNCS([scm_from_utf8_symboln])
+
+  # Restore build-related variables
+  CFLAGS="${save_CFLAGS}"
+  LIBS="${save_LIBS}"
+
 ])dnl AX_CHECK_GUILE

commit 2986092b4301a2d4c501b322aa169fa351153ca0
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>

    build-sys: Consolidate Guile-related Autoconf functions.
    
    Put all Guile-related Autoconf functions into one file, since there
    are getting to be a lot of them.

diff --git a/configure.ac b/configure.ac
index 29653a1..bb6f33a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -131,9 +131,6 @@ AC_SEARCH_LIBS([getopt_long], [gnugetopt],
 # Check for misc features of awk
 AX_AWK_FEATURES
 
-# Check Guile features
-AX_GUILE_DISPLAY_ERROR
-
 #####################################################################
 # Optional things
 #####################################################################
diff --git a/m4/geda-guile-display-error.m4 b/m4/geda-guile-display-error.m4
deleted file mode 100644
index 05faa12..0000000
--- a/m4/geda-guile-display-error.m4
+++ /dev/null
@@ -1,60 +0,0 @@
-# geda-guile-display-error.m4                             -*-Autoconf-*-
-# serial 1
-
-dnl Check for behaviour of scm_display_error().
-dnl Copyright (C) 2011  Peter Brett <peter@xxxxxxxxxxxxx>
-dnl
-dnl This program is free software; you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program; if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-AC_DEFUN([AX_GUILE_DISPLAY_ERROR],
-[
-  AC_PREREQ([2.60])dnl
-  AC_REQUIRE([AX_CHECK_GUILE])dnl
-
-  AC_ARG_VAR([GUILE], [Path to guile executable])
-  AC_CHECK_PROG([GUILE], [guile], [guile], [no])
-
-  if test "X$GUILE" != "Xno"; then
-
-    AC_MSG_CHECKING([whether scm_display_error expects a stack argument])
-    if $GUILE -c \
-"(exit
-   (false-if-exception
-     (begin
-       (display-error (make-stack #t) (current-output-port) \"a\" \"b\" '() '())
-       #t)))" > /dev/null; then
-      AC_MSG_RESULT([yes])
-      AC_DEFINE([HAVE_SCM_DISPLAY_ERROR_STACK], 1,
-                [Define to 1 if scm_display_error expects a stack as first argument.])
-    else
-      AC_MSG_RESULT([no])
-    fi
-
-    AC_MSG_CHECKING([whether scm_display_error expects a frame argument])
-    if $GUILE -c \
-"(exit
-   (false-if-exception
-     (begin
-       (display-error (stack-ref (make-stack #t) 0)
-                      (current-output-port) \"a\" \"b\" '() '())
-       #t)))" > /dev/null; then
-      AC_MSG_RESULT([yes])
-      AC_DEFINE([HAVE_SCM_DISPLAY_ERROR_FRAME], 1,
-                [Define to 1 if scm_display_error expects a frame as first argument.])
-    else
-      AC_MSG_RESULT([no])
-    fi
-  fi
-])dnl AX_GUILE_DISPLAY_ERROR
diff --git a/m4/geda-guile.m4 b/m4/geda-guile.m4
index abde61b..6c5db68 100644
--- a/m4/geda-guile.m4
+++ b/m4/geda-guile.m4
@@ -1,8 +1,9 @@
 # geda-guile.m4                                           -*-Autoconf-*-
-# serial 1
+# serial 2
 
 dnl Check for guile
 dnl Copyright (C) 2009  Dan McMahill <dan@xxxxxxxxxxxx>
+dnl Copyright (C) 2010-2011  Peter Brett <peter@xxxxxxxxxxxxx>
 dnl
 dnl This program is free software; you can redistribute it and/or modify
 dnl it under the terms of the GNU General Public License as published by
@@ -22,6 +23,9 @@ AC_DEFUN([AX_CHECK_GUILE],
 [
   AC_PREREQ([2.60])dnl
 
+  # First check for the libguile library
+  # ------------------------------------
+
   # Argument is the minimum guile version.  For example
   # AX_CHECK_GUILE([1.8.0]) makes sure we have at least version 1.8.0
   GUILE_MIN_VER=[$1]
@@ -103,6 +107,58 @@ AC_DEFUN([AX_CHECK_GUILE],
     AC_SUBST(GUILE_LIBS)
   fi
 
+  # Check for the `guile' executable
+  # --------------------------------
+  AC_ARG_VAR([GUILE], [Path to guile executable])
+  AC_CHECK_PROG([GUILE], [guile], [guile], [no])
+  if test "X$GUILE" = "Xno"; then
+    AC_MSG_WARN([The `guile' interpreter could not be found. Some configuration checks
+will not be able to be carried out.])
+  fi
+
+  # Check for the `guile-snarf' build tool
+  # --------------------------------------
+  AC_ARG_VAR([GUILE_SNARF], [path to guile-snarf utility])
+
+  AC_CHECK_PROGS([GUILE_SNARF], [guile-snarf guile-1.8-snarf], [no])
+  if test "x$GUILE_SNARF" = xno ; then
+    AC_MSG_ERROR([The `guile-snarf' tool could not be found. Please ensure that the
+Guile development headers and tools are correctly installed, and rerun
+configure.])
+  fi
+
+  # Check for behaviour of `scm_display_error'
+  # ------------------------------------------
+  if test "X$GUILE" != "Xno"; then
+
+    AC_MSG_CHECKING([whether scm_display_error expects a stack argument])
+    if $GUILE -c \
+"(exit
+   (false-if-exception
+     (begin
+       (display-error (make-stack #t) (current-output-port) \"a\" \"b\" '() '())
+       #t)))" > /dev/null; then
+      AC_MSG_RESULT([yes])
+      AC_DEFINE([HAVE_SCM_DISPLAY_ERROR_STACK], 1,
+                [Define to 1 if scm_display_error expects a stack as first argument.])
+    else
+      AC_MSG_RESULT([no])
+    fi
+
+    AC_MSG_CHECKING([whether scm_display_error expects a frame argument])
+    if $GUILE -c \
+"(exit
+   (false-if-exception
+     (begin
+       (display-error (stack-ref (make-stack #t) 0)
+                      (current-output-port) \"a\" \"b\" '() '())
+       #t)))" > /dev/null; then
+      AC_MSG_RESULT([yes])
+      AC_DEFINE([HAVE_SCM_DISPLAY_ERROR_FRAME], 1,
+                [Define to 1 if scm_display_error expects a frame as first argument.])
+    else
+      AC_MSG_RESULT([no])
+    fi
+  fi
 
-]
-)
+])dnl AX_CHECK_GUILE




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs