Index: src/Kernel/Types/string.cpp
===================================================================
--- src/Kernel/Types/string.cpp	(revision 7657)
+++ src/Kernel/Types/string.cpp	(working copy)
@@ -72,7 +72,7 @@
 ******************************************************************************/
 
 bool
-string::operator == (const char* s) {
+string::operator == (const char* s) const {
   register int i, n= rep->n;
   register char* S= rep->a;
   for (i=0; i<n; i++) {
@@ -83,7 +83,7 @@
 }
 
 bool
-string::operator != (const char* s) {
+string::operator != (const char* s) const {
   register int i, n= rep->n;
   register char* S= rep->a;
   for (i=0; i<n; i++) {
@@ -94,7 +94,7 @@
 }
 
 bool
-string::operator == (string a) {
+string::operator == (const string& a) const {
   register int i;
   if (rep->n!=a->n) return false;
   for (i=0; i<rep->n; i++)
@@ -103,7 +103,7 @@
 }
 
 bool
-string::operator != (string a) {
+string::operator != (const string& a) const {
   register int i;
   if (rep->n!=a->n) return true;
   for (i=0; i<rep->n; i++)
@@ -112,7 +112,7 @@
 }
 
 string
-string::operator () (int begin, int end) {
+string::operator () (int begin, int end) const {
   register int i;
   string r (end-begin);
   for (i=begin; i<end; i++) r[i-begin]=rep->a[i];
@@ -120,7 +120,7 @@
 }
 
 string
-copy (string s) {
+copy (const string& s) {
   register int i, n=N(s);
   string r (n);
   for (i=0; i<n; i++) r[i]=s[i];
@@ -135,7 +135,7 @@
 }
 
 string&
-operator << (string& a, string b) {
+operator << (string& a, const string& b) {
   register int i, k1= N(a), k2=N(b);
   a->resize (k1+k2);
   for (i=0; i<k2; i++) a[i+k1]= b[i];
@@ -143,7 +143,7 @@
 }
 
 string
-operator * (string a, string b) {
+operator * (const string& a, const string& b) {
   register int i, n1=N(a), n2=N(b);
   string c(n1+n2);
   for (i=0; i<n1; i++) c[i]=a[i];
@@ -152,17 +152,17 @@
 }
 
 string
-operator * (const char* a, string b) {
+operator * (const char* a, const string& b) {
   return string (a) * b;
 }
 
 string
-operator * (string a, const char* b) {
+operator * (const string& a, const char* b) {
   return a * string (b);
 }
 
 bool
-operator <= (string s1, string s2) {
+operator <= (const string& s1, const string& s2) {
   register int i;
   for (i=0; i<N(s1); i++) {
     if (i>=N(s2)) return false;
@@ -173,7 +173,7 @@
 }
 
 tm_ostream&
-operator << (tm_ostream& out, string a) {
+operator << (tm_ostream& out, const string& a) {
   int i, n=N(a);
   if (n==0) return out;
   for (i=0; i<n; i++) out << a[i];
@@ -181,7 +181,7 @@
 }
 
 int
-hash (string s) {
+hash (const string& s) {
   register int i, h=0, n=N(s);
   for (i=0; i<n; i++) {
     h=(h<<9)+(h>>23);
@@ -195,12 +195,12 @@
 ******************************************************************************/
 
 bool
-as_bool (string s) {
+as_bool (const string& s) {
   return (s == "true" || s == "#t");
 }
 
 int
-as_int (string s) {
+as_int (const string& s) {
   int i=0, n=N(s), val=0;
   if (n==0) return 0;
   if (s[0]=='-') i++;
@@ -217,7 +217,7 @@
 
 
 long int
-as_long_int (string s) {
+as_long_int (const string& s) {
   int i=0, n=N(s);
   long int val=0;
   if (n==0) return 0;
@@ -234,7 +234,7 @@
 }
 
 double
-as_double (string s) {
+as_double (const string& s) {
   double x= 0.0;
   {
     int i, n= N(s);
@@ -248,7 +248,7 @@
 }
 
 char*
-as_charp (string s) {
+as_charp (const string& s) {
   int i, n= N(s);
   char *s2= tm_new_array<char> (n+1);
   for (i=0; i<n; i++) s2[i]=s[i];
@@ -316,12 +316,12 @@
 }
 
 bool
-is_bool (string s) {
+is_bool (const string& s) {
   return (s == "true") || (s == "false");
 }
 
 bool
-is_int (string s) {
+is_int (const string& s) {
   int i=0, n=N(s);
   if (n==0) return false;
   if (s[i]=='+') i++;
@@ -333,7 +333,7 @@
 }
 
 bool
-is_double (string s) {
+is_double (const string& s) {
   int i=0, n=N(s);
   if (n==0) return false;
   if (s[i]=='+') i++;
@@ -359,17 +359,17 @@
 }
 
 bool
-is_charp (string s) { (void) s;
+is_charp (const string& s) { (void) s;
   return true;
 }
 
 bool
-is_quoted (string s) {
+is_quoted (const string& s) {
   return (N(s)>=2) && (s[0]=='\042') && (s[N(s)-1]=='\042');
 }
 
 bool
-is_id (string s) {
+is_id (const string& s) {
   int i=0, n=N(s);
   if (n==0) return false;
   for (i=0; i< n; i++) {
@@ -386,17 +386,17 @@
 * Error messages
 ******************************************************************************/
 
-static void (*the_info_handler) (string, string, int) = NULL;
-static void (*the_wait_handler) (string, string, int) = NULL;
-static void (*the_warning_handler) (string, string, int) = NULL;
-static void (*the_error_handler) (string, string, int) = NULL;
+static void (*the_info_handler) (const string&, const string&, int) = NULL;
+static void (*the_wait_handler) (const string&, const string&, int) = NULL;
+static void (*the_warning_handler) (const string&, const string&, int) = NULL;
+static void (*the_error_handler) (const string&, const string&, int) = NULL;
 
 void
-set_info_handler (void (*routine) (string, string, int)) {
+set_info_handler (void (*routine) (const string&, const string&, int)) {
   the_info_handler= routine; }
 
 void
-system_info (string message, string argument, int level) {
+system_info (const string& message, const string& argument, int level) {
   if (DEBUG_AUTO)
     cout << "TeXmacs] " << message << " " << argument << LF;
   if (the_info_handler != NULL)
@@ -404,11 +404,11 @@
 }
 
 void
-set_wait_handler (void (*routine) (string, string, int)) {
+set_wait_handler (void (*routine) (const string&, const string&, int)) {
   the_wait_handler= routine; }
 
 void
-system_wait (string message, string argument, int level) {
+system_wait (const string& message, const string& argument, int level) {
   if (the_wait_handler == NULL) {
     if (DEBUG_AUTO) {
       if (message == "") cout << "TeXmacs] Done" << LF;
@@ -423,11 +423,11 @@
 }
 
 void
-set_warning_handler (void (*routine) (string, string, int)) {
+set_warning_handler (void (*routine) (const string&, const string&, int)) {
   the_warning_handler= routine; }
 
 void
-system_warning (string message, string argument, int level) {
+system_warning (const string& message, const string& argument, int level) {
   if (DEBUG_AUTO)
     cout << "TeXmacs] Warning: " << message << " " << argument << LF;
   if (the_info_handler != NULL)
@@ -435,11 +435,11 @@
 }
 
 void
-set_error_handler (void (*routine) (string, string, int)) {
+set_error_handler (void (*routine) (const string&, const string&, int)) {
   the_error_handler= routine; }
 
 void
-system_error (string message, string argument, int level) {
+system_error (const string& message, const string& argument, int level) {
   if (DEBUG_AUTO)
     cout << "TeXmacs] Error: " << message << " " << argument << LF;
   if (the_info_handler != NULL)
Index: src/Kernel/Types/string.hpp
===================================================================
--- src/Kernel/Types/string.hpp	(revision 7657)
+++ src/Kernel/Types/string.hpp	(working copy)
@@ -26,7 +26,7 @@
   void resize (int n);
 
   friend class string;
-  friend inline int N (string a);
+  friend inline int N (const string& a);
 };
 
 class string {
@@ -36,31 +36,31 @@
   string (char c);
   string (const char *s);
   string (const char *s, int n);
-  inline char& operator [] (int i) { return rep->a[i]; }
-  bool operator == (const char* s);
-  bool operator != (const char* s);
-  bool operator == (string s);
-  bool operator != (string s);
-  string operator () (int start, int end);
+  inline char& operator [] (int i) const { return rep->a[i]; }
+  bool operator == (const char* s) const;
+  bool operator != (const char* s) const;
+  bool operator == (const string& s) const;
+  bool operator != (const string& s) const;
+  string operator () (int start, int end) const;
 };
 CONCRETE_CODE(string);
 
-extern inline int N (string a) { return a->n; }
-string   copy (string a);
-tm_ostream& operator << (tm_ostream& out, string a);
+extern inline int N (const string& a) { return a->n; }
+string   copy (const string& a);
+tm_ostream& operator << (tm_ostream& out, const string& a);
 string&  operator << (string& a, char);
-string&  operator << (string& a, string b);
-string   operator * (const char* a, string b);
-string   operator * (string a, string b);
-string   operator * (string a, const char* b);
-bool     operator <= (string a, string b);
-int      hash (string s);
+string&  operator << (string& a, const string& b);
+string   operator * (const char* a, const string& b);
+string   operator * (const string& a, const string& b);
+string   operator * (const string& a, const char* b);
+bool     operator <= (const string& a, const string& b);
+int      hash (const string& s);
 
-bool     as_bool   (string s);
-int      as_int    (string s);
-long int as_long_int (string s);
-double   as_double (string s);
-char*    as_charp  (string s);
+bool     as_bool   (const string& s);
+int      as_int    (const string& s);
+long int as_long_int (const string& s);
+double   as_double (const string& s);
+char*    as_charp  (const string& s);
 string   as_string_bool (bool f);
 string   as_string (int i);
 string   as_string (unsigned int i);
@@ -69,22 +69,22 @@
 string   as_string (unsigned long int i);
 string   as_string (double x);
 string   as_string (const char* s);
-bool     is_bool   (string s);
-bool     is_int    (string s);
-bool     is_double (string s);
-bool     is_charp  (string s);
+bool     is_bool   (const string& s);
+bool     is_int    (const string& s);
+bool     is_double (const string& s);
+bool     is_charp  (const string& s);
 
-bool  is_quoted (string s);
-bool  is_id     (string s);
+bool  is_quoted (const string& s);
+bool  is_id     (const string& s);
 
-void  set_info_handler (void (*) (string, string, int));
-void  set_wait_handler (void (*) (string, string, int));
-void  set_warning_handler (void (*) (string, string, int));
-void  set_error_handler (void (*) (string, string, int));
-void  system_info (string message, string argument= "", int level= 0);
-void  system_wait (string message, string argument= "", int level= 0);
-void  system_warning (string message, string argument= "", int level= 0);
-void  system_error (string message, string argument= "", int level= 0);
+void  set_info_handler (void (*) (const string&, const string&, int));
+void  set_wait_handler (void (*) (const string&, const string&, int));
+void  set_warning_handler (void (*) (const string&, const string&, int));
+void  set_error_handler (void (*) (const string&, const string&, int));
+void  system_info (const string& msg, const string& arg= "", int level= 0);
+void  system_wait (const string& msg, const string& arg= "", int level= 0);
+void  system_warning (const string& msg, const string& arg= "", int level= 0);
+void  system_error (const string& msg, const string& arg= "", int level= 0);
 
 /******************************************************************************
 * C-style strings with automatic memory management
@@ -95,9 +95,9 @@
   char* value;
   
 private:
-  inline c_string_rep (c_string_rep &): concrete_struct () {};
+  inline c_string_rep (const c_string_rep &): concrete_struct () {}
     // disable copy constructor
-  inline c_string_rep& operator=(c_string_rep&) {};
+  inline c_string_rep& operator= (const c_string_rep&) { return *this; }
     // disable assignment
   
 public:
@@ -113,7 +113,7 @@
     rep (tm_new<c_string_rep> ()) {}
   inline c_string (int len):
     rep (tm_new<c_string_rep> (tm_new_array<char> (len))) {}
-  inline c_string (string s):
+  inline c_string (const string& s):
     rep (tm_new<c_string_rep> (as_charp (s))) {}
   inline operator char* () const { return rep->value; }
 };
Index: src/Kernel/Containers/array.hpp
===================================================================
--- src/Kernel/Containers/array.hpp	(revision 7657)
+++ src/Kernel/Containers/array.hpp	(working copy)
@@ -44,6 +44,7 @@
   array (T x1, T x2, T x3, T x4);
   array (T x1, T x2, T x3, T x4, T x5);
   inline T& operator [] (int i) { return rep->a[i]; }
+  inline const T& operator [] (int i) const { return rep->a[i]; }
   operator tree (); // defined in tree.hpp
 };
 CONCRETE_TEMPLATE_CODE(array,class,T);
Index: src/Kernel/Abstractions/basic.hpp
===================================================================
--- src/Kernel/Abstractions/basic.hpp	(revision 7657)
+++ src/Kernel/Abstractions/basic.hpp	(working copy)
@@ -166,6 +166,7 @@
   inline PTR (const PTR&);          \
   inline ~PTR ();                   \
   inline PTR##_rep* operator -> (); \
+  inline const PTR##_rep* operator -> () const; \
   inline PTR& operator = (PTR x)
 #define CONCRETE_CODE(PTR)                       \
   inline PTR::PTR (const PTR& x):                \
@@ -173,6 +174,8 @@
   inline PTR::~PTR () { DEC_COUNT (this->rep); } \
   inline PTR##_rep* PTR::operator -> () {        \
     return rep; }                                \
+  inline const PTR##_rep* PTR::operator -> () const { \
+    return rep; }                                \
   inline PTR& PTR::operator = (PTR x) {          \
     INC_COUNT (x.rep); DEC_COUNT (this->rep);    \
     this->rep=x.rep; return *this; }
Index: src/Plugins/Bibtex/bibtex_functions.cpp
===================================================================
--- src/Plugins/Bibtex/bibtex_functions.cpp	(revision 7657)
+++ src/Plugins/Bibtex/bibtex_functions.cpp	(working copy)
@@ -287,7 +287,7 @@
 */
 
 void
-bib_change_case (tree& t, string (*change_case) (string)) {
+bib_change_case (tree& t, string (*change_case) (const string&)) {
   //cout << "Change case " << t << "\n";
   if (is_atomic (t) && change_case) t->label= change_case (t->label);
   else if (is_compound (t, "verbatim"));
Index: src/Texmacs/Server/tm_server.cpp
===================================================================
--- src/Texmacs/Server/tm_server.cpp	(revision 7657)
+++ src/Texmacs/Server/tm_server.cpp	(working copy)
@@ -48,7 +48,7 @@
 }
 
 void
-texmacs_wait_handler (string message, string arg, int level) {
+texmacs_wait_handler (const string& message, const string& arg, int level) {
   (void) level;
   if (texmacs_started && the_server != NULL)
     (*the_server)->wait_handler (message, arg);
Index: src/Data/String/analyze.cpp
===================================================================
--- src/Data/String/analyze.cpp	(revision 7657)
+++ src/Data/String/analyze.cpp	(working copy)
@@ -77,7 +77,7 @@
 ******************************************************************************/
 
 bool
-is_alpha (string s) {
+is_alpha (const string& s) {
   int i;
   if (N(s)==0) return false;
   for (i=0; i<N(s); i++)
@@ -86,7 +86,7 @@
 }
 
 bool
-is_locase_alpha (string s) {
+is_locase_alpha (const string& s) {
   int i;
   if (N(s)==0) return false;
   for (i=0; i<N(s); i++)
@@ -95,7 +95,7 @@
 }
 
 bool
-is_iso_alpha (string s) {
+is_iso_alpha (const string& s) {
   int i;
   if (N(s)==0) return false;
   for (i=0; i<N(s); i++)
@@ -104,7 +104,7 @@
 }
 
 bool
-is_numeric (string s) {
+is_numeric (const string& s) {
   int i;
   if (N(s)==0) return false;
   for (i=0; i<N(s); i++)
@@ -139,19 +139,19 @@
 }
 
 string
-upcase_first (string s) {
+upcase_first (const string& s) {
   if ((N(s)==0) || (!is_locase (s[0]))) return s;
   return string ((char) (((int) ((unsigned char) s[0]))-32)) * s (1, N(s));
 }
 
 string
-locase_first (string s) {
+locase_first (const string& s) {
   if ((N(s)==0) || (!is_upcase (s[0]))) return s;
   return string ((char) (((int) ((unsigned char) s[0]))+32)) * s (1, N(s));
 }
 
 string
-upcase_all (string s) {
+upcase_all (const string& s) {
   int i;
   string r (N(s));
   for (i=0; i<N(s); i++)
@@ -161,7 +161,7 @@
 }
 
 string
-locase_all (string s) {
+locase_all (const string& s) {
   int i;
   string r (N(s));
   for (i=0; i<N(s); i++)
@@ -175,12 +175,12 @@
 ******************************************************************************/
 
 string
-string_union (string s1, string s2) {
+string_union (const string& s1, const string& s2) {
   return string_minus (s1, s2) * s2;
 }
 
 string
-string_minus (string s1, string s2) {
+string_minus (const string& s1, const string& s2) {
   string r;
   int i1, n1= N(s1), i2, n2= N(s2);
   for (i1=0; i1<n1; i1++) {
@@ -196,7 +196,7 @@
 ******************************************************************************/
 
 string
-ispanish_to_spanish (string s) {
+ispanish_to_spanish (const string& s) {
   int i, n= N(s);
   string r;
   for (i=0; i<n; i++)
@@ -225,7 +225,7 @@
 }
 
 string
-spanish_to_ispanish (string s) {
+spanish_to_ispanish (const string& s) {
   int i, n= N(s);
   string r;
   for (i=0; i<n; i++)
@@ -250,7 +250,7 @@
 }
 
 string
-igerman_to_german (string s) {
+igerman_to_german (const string& s) {
   int i, n= N(s);
   string r;
   for (i=0; i<n; i++)
@@ -260,7 +260,7 @@
 }
 
 string
-german_to_igerman (string s) {
+german_to_igerman (const string& s) {
   int i, n= N(s);
   string r;
   for (i=0; i<n; i++)
@@ -293,7 +293,7 @@
 }
 
 string
-il2_to_cork (string s) {
+il2_to_cork (const string& s) {
   int i, n= N(s);
   string r (n);
   for (i=0; i<n; i++)
@@ -302,7 +302,7 @@
 }
 
 string
-cork_to_il2 (string s) {
+cork_to_il2 (const string& s) {
   int i, n= N(s);
   string r (n);
   for (i=0; i<n; i++)
@@ -366,7 +366,7 @@
 }
 
 string
-koi8_to_iso (string s) {
+koi8_to_iso (const string& s) {
   int i, n= N(s);
   string r (n);
   for (i=0; i<n; i++)
@@ -375,7 +375,7 @@
 }
 
 string
-iso_to_koi8 (string s) {
+iso_to_koi8 (const string& s) {
   int i, n= N(s);
   string r (n);
   for (i=0; i<n; i++)
@@ -384,7 +384,7 @@
 }
 
 string
-koi8uk_to_iso (string s) {
+koi8uk_to_iso (const string& s) {
   int i, n= N(s);
   string r (n);
   for (i=0; i<n; i++)
@@ -393,7 +393,7 @@
 }
 
 string
-iso_to_koi8uk (string s) {
+iso_to_koi8uk (const string& s) {
   int i, n= N(s);
   string r (n);
   for (i=0; i<n; i++)
@@ -413,7 +413,7 @@
 }
 
 string
-tm_to_xml_name (string s) {
+tm_to_xml_name (const string& s) {
   string r;
   int i, n= N(s);
   for (i=0; i<n; i++)
@@ -423,7 +423,7 @@
 }
 
 string
-xml_name_to_tm (string s) {
+xml_name_to_tm (const string& s) {
   string r;
   int i, n= N(s);
   for (i=0; i<n; i++)
@@ -437,7 +437,7 @@
 }
 
 string
-old_tm_to_xml_cdata (string s) {
+old_tm_to_xml_cdata (const string& s) {
   string r;
   int i, n= N(s);
   for (i=0; i<n; i++)
@@ -453,7 +453,7 @@
 }
 
 object
-tm_to_xml_cdata (string s) {
+tm_to_xml_cdata (const string& s) {
   array<object> a;
   a << symbol_object ("!concat");
   string r;
@@ -485,7 +485,7 @@
 }
 
 string
-old_xml_cdata_to_tm (string s) {
+old_xml_cdata_to_tm (const string& s) {
   string r;
   int i, n= N(s);
   for (i=0; i<n; i++)
@@ -503,7 +503,7 @@
 }
 
 string
-xml_unspace (string s, bool first, bool last) {
+xml_unspace (const string& s, bool first, bool last) {
   string r;
   int i= 0, n= N(s);
   if (first) while ((i<n) && is_space (s[i])) i++;
@@ -517,7 +517,7 @@
 }
 
 bool
-contains_unicode_char (string s) {
+contains_unicode_char (const string& s) {
   int i= 0, n= N(s);
   while (i+1<n) {
     if (s[i] == '<' && s[i+1] == '#') return true;
@@ -612,7 +612,7 @@
 }
 
 int
-from_hexadecimal (string s) {
+from_hexadecimal (const string& s) {
   int i, n= N(s), res= 0;
   if ((n>0) && (s[0]=='-'))
     return -from_hexadecimal (s (1, n));
@@ -630,7 +630,7 @@
 ******************************************************************************/
 
 string
-tm_encode (string s) {
+tm_encode (const string& s) {
   // verbatim to TeXmacs encoding
   register int i;
   string r;
@@ -643,7 +643,7 @@
 }
 
 string
-tm_decode (string s) {
+tm_decode (const string& s) {
   // TeXmacs encoding to verbatim
   register int i;
   string r;
@@ -664,7 +664,7 @@
 }
 
 string
-tm_var_encode (string s) {
+tm_var_encode (const string& s) {
   register int i, n= N(s);
   string r;
   for (i=0; i<n; i++) {
@@ -682,7 +682,7 @@
 }
 
 string
-tm_correct (string s) {
+tm_correct (const string& s) {
   register int i;
   string r;
   for (i=0; i<N(s); i++) {
@@ -703,7 +703,7 @@
 }
 
 void
-tm_char_forwards (string s, int& pos) {
+tm_char_forwards (const string& s, int& pos) {
   ASSERT (pos >= 0 && pos <= N(s), "out of range");
   int n= N(s);
   if (pos == n);
@@ -715,7 +715,7 @@
 }
 
 void
-tm_char_backwards (string s, int& pos) {
+tm_char_backwards (const string& s, int& pos) {
   ASSERT (pos >= 0 && pos <= N(s), "out of range");
   if (pos == 0);
   else if (s[pos-1] != '>') pos--;
@@ -726,19 +726,19 @@
 }
 
 int
-tm_char_next (string s, int pos) {
+tm_char_next (const string& s, int pos) {
   tm_char_forwards (s, pos);
   return pos;
 }
 
 int
-tm_char_previous (string s, int pos) {
+tm_char_previous (const string& s, int pos) {
   tm_char_backwards (s, pos);
   return pos;
 }
 
 string
-tm_forward_access (string s, int k) {
+tm_forward_access (const string& s, int k) {
   int pos= 0;
   for (int i=0; i<k; i++)
     tm_char_forwards (s, pos);
@@ -748,7 +748,7 @@
 }
 
 string
-tm_backward_access (string s, int k) {
+tm_backward_access (const string& s, int k) {
   int pos= N(s);
   for (int i=0; i<k; i++)
     tm_char_backwards (s, pos);
@@ -758,7 +758,7 @@
 }
 
 int
-tm_string_length (string s) {
+tm_string_length (const string& s) {
   int i= 0, pos= 0;
   while (pos < N(s)) {
     tm_char_forwards (s, pos);
@@ -768,7 +768,7 @@
 }
 
 array<string>
-tm_tokenize (string s) {
+tm_tokenize (const string& s) {
   array<string> r;
   int pos= 0;
   while (pos < N(s)) {
@@ -780,7 +780,7 @@
 }
 
 string
-tm_recompose (array<string> a) {
+tm_recompose (const array<string>& a) {
   string r;
   for (int i=0; i<N(a); i++)
     r << a[i];
@@ -792,7 +792,7 @@
 ******************************************************************************/
 
 string
-scm_quote (string s) {
+scm_quote (const string& s) {
   // R5RS compliant external string representation.
   int i, n= N(s);
   string r;
@@ -811,7 +811,7 @@
 }
 
 string
-scm_unquote (string s) {
+scm_unquote (const string& s) {
   if ((N(s)>=2) && (s[0]=='\"') && (s[N(s)-1]=='\"')) {
     int i, n= N(s);
     string r;
@@ -825,13 +825,13 @@
 }
 
 string
-raw_quote (string s) {
+raw_quote (const string& s) {
   // Mark the label of a STRING tree as representing a string and not a symbol.
   return "\"" * s * "\"";
 }
  
 string
-raw_unquote (string s) {
+raw_unquote (const string& s) {
   // Get the string value of a STRING tree label representing a string.
   if ((N(s)>=2) && (s[0]=='\"') && (s[N(s)-1]=='\"'))
     return s (1, N(s)-1);
@@ -843,7 +843,7 @@
 ******************************************************************************/
 
 string
-escape_sh (string s) {
+escape_sh (const string& s) {
 #if defined (__MINGW__) || defined (__MINGW32__) || defined (OS_WIN32)
   return raw_quote (s);
 #else
@@ -870,7 +870,7 @@
 }
 
 string
-escape_generic (string s) {
+escape_generic (const string& s) {
   int i, n= N(s);
   string r;
   for (i=0; i<n; i++) {
@@ -881,7 +881,7 @@
 }
 
 string
-escape_verbatim (string s) {
+escape_verbatim (const string& s) {
   int i, n= N(s);
   string r;
   for (i=0; i<n; i++) {
@@ -893,7 +893,7 @@
 }
 
 string
-escape_spaces (string s) {
+escape_spaces (const string& s) {
   int i, n= N(s);
   string r;
   for (i=0; i<n; i++) {
@@ -905,7 +905,7 @@
 }
 
 string
-dos_to_better (string s) {
+dos_to_better (const string& s) {
   int i, n= N(s);
   string r;
   for (i=0; i<n; i++)
@@ -915,7 +915,7 @@
 }
 
 string
-unescape_guile (string s) {
+unescape_guile (const string& s) {
   int i, n= N(s);
   string r;
   for (i=0; i<n; i++) {
@@ -940,7 +940,7 @@
 ******************************************************************************/
 
 bool
-test (string s, int i, const char* test) {
+test (const string& s, int i, const char* test) {
   int n= N(s), j=0;
   while (test[j]!='\0') {
     if (i>=n) return false;
@@ -951,7 +951,7 @@
 }
 
 bool
-test (string s, int i, string test) {
+test (const string& s, int i, const string& test) {
   int n= N(s), m= N(test), j=0;
   while (j<m) {
     if (i>=n) return false;
@@ -962,30 +962,30 @@
 }
 
 bool
-starts (string s, const char* what) {
+starts (const string& s, const char* what) {
   return test (s, 0, what);
 }
 
 bool
-starts (string s, const string what) {
+starts (const string& s, const string& what) {
   return test (s, 0, what);
 }
 
 bool
-ends (string s, const char* what) {
+ends (const string& s, const char* what) {
   string r (what);
   if (N(r) > N(s)) return false;
   return s (N(s)-N(r), N(s)) == r;
 }
 
 bool
-ends (string s, const string r) {
+ends (const string& s, const string& r) {
   if (N(r) > N(s)) return false;
   return s (N(s)-N(r), N(s)) == r;
 }
 
 bool
-read (string s, int& i, const char* test) {
+read (const string& s, int& i, const char* test) {
   int n= N(s), j=0, k=i;
   while (test[j]!='\0') {
     if (k>=n) return false;
@@ -997,13 +997,13 @@
 }
 
 bool
-read (string s, string test) {
+read (const string& s, const string& test) {
   int i = 0;
   return read (s, i, test);
 }
 
 bool
-read (string s, int& i, string test) {
+read (const string& s, int& i, const string& test) {
   int n= N(s), m= N(test), j=0, k=i;
   while (j<m) {
     if (k>=n) return false;
@@ -1015,7 +1015,7 @@
 }
 
 bool
-read_line (string s, int& i, string& result) {
+read_line (const string& s, int& i, string& result) {
   int start= i;
   for (; i<N(s); i++) {
     if (s[i]=='\n') {
@@ -1028,7 +1028,7 @@
 }
 
 bool
-read_int (string s, int& i, int& result) {
+read_int (const string& s, int& i, int& result) {
   int n= N(s), start= i;
   result= 0;
   if (i==n) return false;
@@ -1044,7 +1044,7 @@
 }
 
 bool
-read_double (string s, int& i, double& result) {
+read_double (const string& s, int& i, double& result) {
   int n= N(s), start= i;
   result= 0.0;
   if (i==n) return false;
@@ -1068,20 +1068,20 @@
 }
 
 void
-skip_spaces (string s, int& i) {
+skip_spaces (const string& s, int& i) {
   int n=N(s);
   while ((i<n) && ((s[i]==' ') || (s[i]=='\t'))) i++;
 }
 
 void
-skip_line (string s, int& i) {
+skip_line (const string& s, int& i) {
   int n=N(s);
   while ((i<n) && (s[i]!='\n')) i++;
   if (i<n) i++;
 }
 
 void
-skip_symbol (string s, int& i) {
+skip_symbol (const string& s, int& i) {
   int n=N(s);
   if (i<n) {
     if (s[i]=='<') {
@@ -1097,31 +1097,31 @@
 ******************************************************************************/
 
 void
-parse (string s, int& pos, QI& ret) {
+parse (const string& s, int& pos, QI& ret) {
   ret= (QI) s[pos++];
 }
 
 void
-parse (string s, int& pos, QN& ret) {
+parse (const string& s, int& pos, QN& ret) {
   ret= (QN) s[pos++];
 }
 
 void
-parse (string s, int& pos, HI& ret) {
+parse (const string& s, int& pos, HI& ret) {
   QI c1= (QI) s[pos++];
   QN c2= (QN) s[pos++];
   ret= (((HI) c1)<<8)+ c2;
 }
 
 void
-parse (string s, int& pos, HN& ret) {
+parse (const string& s, int& pos, HN& ret) {
   QN c1= (QN) s[pos++];
   QN c2= (QN) s[pos++];
   ret= (((HN) c1)<<8)+ c2;
 }
 
 void
-parse (string s, int& pos, SI& ret) {
+parse (const string& s, int& pos, SI& ret) {
   QI c1= (QI) s[pos++];
   QN c2= (QN) s[pos++];
   QN c3= (QN) s[pos++];
@@ -1130,7 +1130,7 @@
 }
 
 void
-parse (string s, int& pos, SI*& a, int len) {
+parse (const string& s, int& pos, SI*& a, int len) {
   int i;
   a= tm_new_array<int> (len);
   for (i=0; i<len; i++) parse (s, pos, a[i]);
@@ -1141,7 +1141,7 @@
 ******************************************************************************/
 
 int
-search_forwards (array<string> a, int pos, string in) {
+search_forwards (const array<string>& a, int pos, const string& in) {
   int n= N(in), na= N(a);
   while (pos <= n) {
     for (int i=0; i<na; i++)
@@ -1152,7 +1152,7 @@
 }
 
 int
-search_forwards (string s, int pos, string in) {
+search_forwards (const string& s, int pos, const string& in) {
   int k= N(s), n= N(in);
   if (k == 0) return pos;
   char c= s[0];
@@ -1164,17 +1164,17 @@
 }
 
 int
-search_forwards (string s, string in) {
+search_forwards (const string& s, const string& in) {
   return search_forwards (s, 0, in);
 }
 
 bool
-occurs (string what, string in) {
+occurs (const string& what, const string& in) {
   return search_forwards (what, 0, in) >= 0;
 }
 
 int
-search_backwards (string s, int pos, string in) {
+search_backwards (const string& s, int pos, const string& in) {
   while (pos >= 0) {
     if (test (in, pos, s)) return pos;
     pos--;
@@ -1183,12 +1183,12 @@
 }
 
 int
-search_backwards (string s, string in) {
+search_backwards (const string& s, const string& in) {
   return search_backwards (s, N(in)-N(s), in);
 }
 
 int
-count_occurrences (string s, string in) {
+count_occurrences (const string& s, const string& in) {
   int count= 0;
   int i=0, next, n= N(s);
   while (i<n) {
@@ -1201,7 +1201,7 @@
 }
 
 string
-replace (string s, string what, string by) {
+replace (const string& s, const string& what, const string& by) {
   int i, n= N(s);
   string r;
   for (i=0; i<n; )
@@ -1217,7 +1217,7 @@
 }
 
 static bool
-match_wildcard (string s, int spos, string w, int wpos) {
+match_wildcard (const string& s, int spos, const string& w, int wpos) {
   if (wpos == N(w)) return spos == N(s);
   if (w[wpos] != '*')
     return (spos < N(s)) && (s[spos] == w[wpos]) &&
@@ -1231,12 +1231,12 @@
 }
 
 bool
-match_wildcard (string s, string w) {
+match_wildcard (const string& s, const string& w) {
   return match_wildcard (s, 0, w, 0);
 }
 
 array<string>
-tokenize (string s, string sep) {
+tokenize (const string& s, const string& sep) {
   int start=0;
   array<string> a;
   for (int i=0; i<N(s); )
@@ -1251,7 +1251,7 @@
 }
 
 string
-recompose (array<string> a, string sep) {
+recompose (const array<string>& a, const string& sep) {
   string r;
   for (int i=0; i<N(a); i++) {
     if (i != 0) r << sep;
@@ -1261,7 +1261,7 @@
 }
 
 string
-trim_spaces (string s) {
+trim_spaces (const string& s) {
   int start, end;
   for (start=0; start<N(s) && is_space (s[start]); start++) ;
   for (end=N(s)-1; end > start && is_space (s[end]); end--) ;
@@ -1269,7 +1269,7 @@
 }
 
 array<string>
-trim_spaces (array<string> a) {
+trim_spaces (const array<string>& a) {
   array<string> b (N(a));
   for (int i=0; i<N(a); i++)
     b[i]= trim_spaces (a[i]);
@@ -1346,7 +1346,7 @@
 }
 
 array<string>
-strip_completions (array<string> a, string prefix) {
+strip_completions (const array<string>& a, const string& prefix) {
   int i, n= N(a);
   array<string> b;
   for (i=0; i<n; i++)
Index: src/Data/String/converter.cpp
===================================================================
--- src/Data/String/converter.cpp	(revision 7657)
+++ src/Data/String/converter.cpp	(working copy)
@@ -48,8 +48,8 @@
 ******************************************************************************/
  
 converter
-load_converter (string from, string to) {
-  string name= from * "-" * to;
+load_converter (const string& from, const string& to) {
+  const string& name= from * "-" * to;
   if (converter::instances -> contains (name))
     return converter (name);
   converter conv = tm_new<converter_rep> (from, to);
@@ -194,7 +194,7 @@
 ******************************************************************************/
 
 bool
-check_encoding (string input, string encoding) {
+check_encoding (const string& input, const string& encoding) {
   if (encoding == "Cork") return true;
 #ifdef USE_ICONV
   else return check_using_iconv (input, encoding);
@@ -205,7 +205,7 @@
 }
 
 string 
-convert (string input, string from, string to) {
+convert (const string& input, const string& from, const string& to) {
   if (from == "Cork")
     return convert_from_cork (input, to);
   else if (to == "Cork")
@@ -221,13 +221,13 @@
 }
 
 string 
-convert_to_cork (string input, string from) {
+convert_to_cork (const string& input, const string& from) {
   if (from == "UTF-8")
     return utf8_to_cork (input);
   else if (from == "SourceCode")
     return sourcecode_to_cork (input);
 #ifdef USE_ICONV
-  string str= convert_using_iconv (input, from, "UTF-8");
+  const string& str= convert_using_iconv (input, from, "UTF-8");
   return utf8_to_cork (str);
 #else
   return input; // can't do anything.
@@ -235,13 +235,13 @@
 }
 
 string 
-convert_from_cork (string input, string to) {
+convert_from_cork (const string& input, const string& to) {
   if (to == "UTF-8")
     return cork_to_utf8 (input);
   else if (to == "SourceCode")
     return cork_to_sourcecode (input);
 #ifdef USE_ICONV
-  string str = cork_to_utf8 (input);
+  const string& str = cork_to_utf8 (input);
   return convert_using_iconv (str, "UTF-8", to);
 #else
   return input; // can't do anything.
@@ -249,7 +249,7 @@
 }
 
 string
-convert_utf8_to_LaTeX (string input) {
+convert_utf8_to_LaTeX (const string& input) {
   converter conv= load_converter ("UTF-8", "LaTeX");
   int i, start, n= N(input);
   string output, r;
@@ -261,7 +261,7 @@
     else {
       start = i;
       unsigned int code= decode_from_utf8 (input, i);
-      string unicode= input (start, i);
+      const string& unicode= input (start, i);
       r = apply (conv, unicode);
       output << r;
       if (r == unicode) {
@@ -274,14 +274,14 @@
 }
 
 string
-utf8_to_cork (string input) {
+utf8_to_cork (const string& input) {
   converter conv= load_converter ("UTF-8", "Cork");
   int start, i, n= N(input);
   string output;
   for (i=0; i<n; ) {
     start= i;
     unsigned int code= decode_from_utf8 (input, i);
-    string s= input (start, i);
+    const string& s= input (start, i);
     string r= apply (conv, s);
     if (r == s && code >= 256)
       r= "<#" * as_hexadecimal (code) * ">";
@@ -291,14 +291,14 @@
 }
 
 string
-sourcecode_to_cork (string input) {
+sourcecode_to_cork (const string& input) {
   converter conv= load_converter ("SourceCode", "Cork");
   int start, i, n= N(input);
   string output;
   for (i=0; i<n; ) {
     start= i;
     unsigned int code= decode_from_utf8 (input, i);
-    string s= input (start, i);
+    const string& s= input (start, i);
     string r= apply (conv, s);
     if (r == s && code >= 256)
       r= "<#" * as_hexadecimal (code) * ">";
@@ -308,7 +308,7 @@
 }
 
 string
-cork_to_utf8 (string input) {
+cork_to_utf8 (const string& input) {
   converter conv= load_converter ("Cork", "UTF-8");
   int start= 0, i, n= N(input);
   string r;
@@ -325,7 +325,7 @@
 }
 
 string
-cork_to_sourcecode (string input) {
+cork_to_sourcecode (const string& input) {
   converter conv= load_converter ("Cork", "SourceCode");
   int start= 0, i, n= N(input);
   string r;
@@ -342,14 +342,14 @@
 }
 
 string
-utf8_to_t2a (string input) {
+utf8_to_t2a (const string& input) {
   converter conv= load_converter ("UTF-8", "T2A");
   int start, i, n= N(input);
   string output;
   for (i=0; i<n; ) {
     start= i;
     unsigned int code= decode_from_utf8 (input, i);
-    string s= input (start, i);
+    const string& s= input (start, i);
     string r= apply (conv, s);
     if (r == s && code >= 256)
       r= "<#" * as_hexadecimal (code) * ">";
@@ -359,7 +359,7 @@
 }
 
 string
-cyrillic_subset_in_t2a_to_code_point (string input) {
+cyrillic_subset_in_t2a_to_code_point (const string& input) {
   converter conv= load_converter ("T2A.CY", "CODEPOINT");
   string r, tmp;
   int i, j, n = N(input);
@@ -380,7 +380,7 @@
 }
 
 string
-code_point_to_cyrillic_subset_in_t2a (string input) {
+code_point_to_cyrillic_subset_in_t2a (const string& input) {
   converter conv= load_converter ("CODEPOINT", "T2A.CY");
   string r, tmp;
   int i = 0, n = N(input);
@@ -392,7 +392,7 @@
       while (i < n && input[i] != '>') i++;
     }
     i++;
-    string s= apply (conv, input (start, i));
+    const string& s= apply (conv, input (start, i));
     if (N(s) == 5 && s[0] == '<' && s[1] == '#' && s[4] == '>')
       r << string ((char) from_hexadecimal (s (2, 4)));
     else r << s;
@@ -401,7 +401,7 @@
 }
 
 string
-t2a_to_utf8 (string input) {
+t2a_to_utf8 (const string& input) {
   converter conv= load_converter ("T2A", "UTF-8");
   int start= 0, i, n= N(input);
   string r;
@@ -418,14 +418,14 @@
 }
 
 string
-utf8_to_html (string input) {
+utf8_to_html (const string& input) {
   converter conv = load_converter ("UTF-8", "HTML");
-  string s = apply (conv, input);
+  const string& s = apply (conv, input);
   return utf8_to_hex_entities(s);
 }
 
 string
-cork_to_ascii (string input) {
+cork_to_ascii (const string& input) {
   converter conv = load_converter ("Cork", "ASCII");
   return apply (conv, input);
 }
@@ -439,15 +439,16 @@
   bool show_errors;
   bool successful;
 public:
-  iconv_converter (string from, string to, bool errors=true);
+  iconv_converter (const string& from, const string& to, bool errors=true);
   ~iconv_converter ();
   inline bool is_valid () { return cd != (iconv_t)-1; }
   inline bool is_successful () { return successful; }
-  friend string apply (iconv_converter &conv, string input);
+  friend string apply (iconv_converter &conv, const string& input);
 };
 
-iconv_converter::iconv_converter (string from2, string to2, bool errors):
-  from (from2), to (to2), show_errors (errors), successful (false)
+iconv_converter::iconv_converter (const string& from2, const string& to2,
+                                  bool errors)
+  : from (from2), to (to2), show_errors (errors), successful (false)
 {
   c_string from_cp (from);
   c_string to_cp   (to);
@@ -472,7 +473,7 @@
 		     outbuf, outbytesleft);
 }
 
-string apply (iconv_converter &conv, string input) {
+string apply (iconv_converter &conv, const string& input) {
   if (! conv.is_valid()) {
     conv.successful= false;
     system_error ("Conversion concelled.");
@@ -509,7 +510,7 @@
 
 #endif // defined USE_ICONV
 
-bool check_using_iconv (string input, string encoding) {
+bool check_using_iconv (const string& input, const string& encoding) {
 #ifdef USE_ICONV
   iconv_converter conv (encoding, encoding, false);
   apply (conv, input);
@@ -523,7 +524,7 @@
 }
 
 string
-convert_using_iconv (string input, string from, string to) {
+convert_using_iconv (const string& input, const string& from, const string& to) {
   if (from == to) return input;
 #ifdef USE_ICONV
   iconv_converter conv (from, to, true);
@@ -542,7 +543,8 @@
 ******************************************************************************/
 
 void
-put_prefix_code (string key, string value, hashtree<char,string> tree) {
+put_prefix_code (const string& key, const string& value,
+                 hashtree<char,string> tree) {
   /*
   if (DEBUG_STD) {
     hashtree<char,string> ht= find_node (key,tree);
@@ -554,7 +556,7 @@
 }
 
 hashtree<char,string>
-find_node (string key, hashtree<char,string> ht) {
+find_node (const string& key, hashtree<char,string> ht) {
   int i;
   for(i = 0; i < N(key); i++)
     ht = ht(key[i]);
@@ -562,7 +564,7 @@
 }
 
 static string
-str_unquote (string s) {
+str_unquote (const string& s) {
   int start, end;
   for (start=0; start<N(s) && s[start] != '"'; start++) ;
   for (end=N(s)-1; end > start && s[end] != '"'; end--) ;
@@ -571,19 +573,19 @@
 
 void
 hashtree_from_dictionary (
-  hashtree<char,string> dic, string file_name, escape_type key_escape,
+  hashtree<char,string> dic, const string& file_name, escape_type key_escape,
   escape_type val_escape, bool reverse)
 {
   system_info ("Loading",file_name);
   string key_string, val_string, file;
-  file_name = file_name * ".scm";
-  if (load_string (url ("$TEXMACS_PATH/langs/encoding", file_name), file, false)) {
-    system_error ("Couldn't open encoding dictionary", file_name);
+  const string& fname = file_name * ".scm";
+  if (load_string (url ("$TEXMACS_PATH/langs/encoding", fname), file, false)) {
+    system_error ("Couldn't open encoding dictionary", fname);
     return;
   }
   tree t = block_to_scheme_tree (file);
   if (!is_tuple (t)) {
-    system_error ("Malformed encoding dictionary", file_name);
+    system_error ("Malformed encoding dictionary", fname);
     return;
   }
   for (int i=0; i<N(t); i++) {
@@ -626,7 +628,7 @@
     (97 <= c && c <= 102);
 }
 
-int hex_digit_to_int(unsigned char c) {
+int hex_digit_to_int (unsigned char c) {
   if (48 <= c && c <= 57)
     return c - 0x30;
   else if (65 <= c && c <= 70)
@@ -638,7 +640,7 @@
 }
 
 string
-convert_escapes (string in, bool utf8) {
+convert_escapes (const string& in, bool utf8) {
   // cout << "converting " << in ;
   string result;
   int i = 0;
@@ -660,7 +662,7 @@
 }
 
 string
-convert_char_entities (string s) {
+convert_char_entities (const string& s) {
   int i, n=N(s);
   string r;
   for (i=0; i<n; /* noop */) {
@@ -677,7 +679,7 @@
 }
 
 static unsigned int
-as_unsigned_int (string s) {
+as_unsigned_int (const string& s) {
   int i=0, n=N(s);
   unsigned int val=0;
   if (n==0) return 0;
@@ -692,7 +694,7 @@
 }
 
 string
-convert_char_entity (string s, int& start, bool& success) {
+convert_char_entity (const string& s, int& start, bool& success) {
   // start: position in s after the character entity marker "&#".
   success = false;
   int i= start;
@@ -761,7 +763,7 @@
 }
 
 unsigned int
-decode_from_utf8 (string s, int& i) {
+decode_from_utf8 (const string& s, int& i) {
   unsigned char c = s[i];
   if ((0x80 & c) == 0) {
     // 0x0ddddddd
@@ -809,7 +811,7 @@
 }
 
 string
-utf8_to_hex_entities (string s) {
+utf8_to_hex_entities (const string& s) {
   string result;
   int i, n= N(s);
   for (i=0; i<n; ) {
Index: src/Data/String/analyze.hpp
===================================================================
--- src/Data/String/analyze.hpp	(revision 7657)
+++ src/Data/String/analyze.hpp	(working copy)
@@ -25,41 +25,41 @@
 bool is_numeric (char c);
 bool is_punctuation (char c);
 bool is_space (char s);
-bool is_alpha (string s);
-bool is_locase_alpha (string s);
-bool is_iso_alpha (string s);
-bool is_numeric (string s);
+bool is_alpha (const string& s);
+bool is_locase_alpha (const string& s);
+bool is_iso_alpha (const string& s);
+bool is_numeric (const string& s);
 
 char   upcase (char s);
 char   locase (char s);
 char   closing_delimiter (char c);
-string upcase_first (string s);
-string locase_first (string s);
-string upcase_all (string s);
-string locase_all (string s);
-string string_union (string s1, string s2);
-string string_minus (string s1, string s2);
-string utf8_to_t2a (string s);
-string t2a_to_utf8 (string s);
-string utf8_to_cork (string s);
-string cork_to_utf8 (string s);
-string iso_to_koi8 (string s);
-string koi8_to_iso (string s);
-string iso_to_koi8uk (string s);
-string koi8uk_to_iso (string s);
-string il2_to_cork (string s);
-string cork_to_il2 (string s);
-string ispanish_to_spanish (string s);
-string spanish_to_ispanish (string s);
-string igerman_to_german (string s);
-string german_to_igerman (string s);
-string old_tm_to_xml_cdata (string s);
-object tm_to_xml_cdata (string s);
-string old_xml_cdata_to_tm (string s);
-string tm_to_xml_name (string s);
-string xml_name_to_tm (string s);
-string xml_unspace (string s, bool first, bool last);
-bool   contains_unicode_char (string s);
+string upcase_first (const string& s);
+string locase_first (const string& s);
+string upcase_all (const string& s);
+string locase_all (const string& s);
+string string_union (const string& s1, const string& s2);
+string string_minus (const string& s1, const string& s2);
+string utf8_to_t2a (const string& s);
+string t2a_to_utf8 (const string& s);
+string utf8_to_cork (const string& s);
+string cork_to_utf8 (const string& s);
+string iso_to_koi8 (const string& s);
+string koi8_to_iso (const string& s);
+string iso_to_koi8uk (const string& s);
+string koi8uk_to_iso (const string& s);
+string il2_to_cork (const string& s);
+string cork_to_il2 (const string& s);
+string ispanish_to_spanish (const string& s);
+string spanish_to_ispanish (const string& s);
+string igerman_to_german (const string& s);
+string german_to_igerman (const string& s);
+string old_tm_to_xml_cdata (const string& s);
+object tm_to_xml_cdata (const string& s);
+string old_xml_cdata_to_tm (const string& s);
+string tm_to_xml_name (const string& s);
+string xml_name_to_tm (const string& s);
+string xml_unspace (const string& s, bool first, bool last);
+bool   contains_unicode_char (const string& s);
 
 string roman_nr (int nr);
 string Roman_nr (int nr);
@@ -70,74 +70,74 @@
 string as_hexadecimal (int i);
 string as_hexadecimal (pointer ptr);
 string as_hexadecimal (int i, int length);
-int    from_hexadecimal (string s);
+int    from_hexadecimal (const string& s);
 
-string tm_encode (string s);
-string tm_decode (string s);
-string tm_var_encode (string s);
-string tm_correct (string s);
-void   tm_char_forwards (string s, int& pos);
-void   tm_char_backwards (string s, int& pos);
-int    tm_char_next (string s, int pos);
-int    tm_char_previous (string s, int pos);
-string tm_forward_access (string s, int i);
-string tm_backward_access (string s, int i);
-int    tm_string_length (string s);
-array<string> tm_tokenize (string s);
-string tm_recompose (array<string> a);
+string tm_encode (const string& s);
+string tm_decode (const string& s);
+string tm_var_encode (const string& s);
+string tm_correct (const string& s);
+void   tm_char_forwards (const string& s, int& pos);
+void   tm_char_backwards (const string& s, int& pos);
+int    tm_char_next (const string& s, int pos);
+int    tm_char_previous (const string& s, int pos);
+string tm_forward_access (const string& s, int i);
+string tm_backward_access (const string& s, int i);
+int    tm_string_length (const string& s);
+array<string> tm_tokenize (const string& s);
+string tm_recompose (const array<string>& a);
 
-string scm_quote (string s);
-string scm_unquote (string s);
-string raw_quote (string s);
-string raw_unquote (string s);
-string escape_sh (string s);
-string escape_generic (string s);
-string escape_verbatim (string s);
-string escape_spaces (string s);
-string unescape_guile (string s);
-string dos_to_better (string s);
+string scm_quote (const string& s);
+string scm_unquote (const string& s);
+string raw_quote (const string& s);
+string raw_unquote (const string& s);
+string escape_sh (const string& s);
+string escape_generic (const string& s);
+string escape_verbatim (const string& s);
+string escape_spaces (const string& s);
+string unescape_guile (const string& s);
+string dos_to_better (const string& s);
 
-bool test (string s, int i, const char* test);
-bool test (string s, int i, string test);
-bool starts (string s, const char* test);
-bool starts (string s, const string test);
-bool ends (string s, const char* test);
-bool ends (string s, const string test);
-bool read (string s, int& i, const char* test);
-bool read (string s, int& i, string test);
-bool read (string s, string test);
-bool read_line (string s, int& i, string& result);
-bool read_int (string s, int& i, int& result);
-bool read_double (string s, int& i, double& result);
-void skip_spaces (string s, int& i);
-void skip_line (string s, int& i);
-void skip_symbol (string s, int& i);
+bool test (const string& s, int i, const char* test);
+bool test (const string& s, int i, const string& test);
+bool starts (const string& s, const char* test);
+bool starts (const string& s, const string& test);
+bool ends (const string& s, const char* test);
+bool ends (const string& s, const string& test);
+bool read (const string& s, int& i, const char* test);
+bool read (const string& s, int& i, const string& test);
+bool read (const string& s, const string& test);
+bool read_line (const string& s, int& i, string& result);
+bool read_int (const string& s, int& i, int& result);
+bool read_double (const string& s, int& i, double& result);
+void skip_spaces (const string& s, int& i);
+void skip_line (const string& s, int& i);
+void skip_symbol (const string& s, int& i);
 
-void parse (string s, int& pos, QI& ret);
-void parse (string s, int& pos, QN& ret);
-void parse (string s, int& pos, HI& ret);
-void parse (string s, int& pos, HN& ret);
-void parse (string s, int& pos, SI& ret);
-void parse (string s, int& pos, SI*& a, int len);
+void parse (const string& s, int& pos, QI& ret);
+void parse (const string& s, int& pos, QN& ret);
+void parse (const string& s, int& pos, HI& ret);
+void parse (const string& s, int& pos, HN& ret);
+void parse (const string& s, int& pos, SI& ret);
+void parse (const string& s, int& pos, SI*& a, int len);
 
-int    search_forwards (string what, string in);
-int    search_forwards (string what, int pos, string in);
-int    search_forwards (array<string> what_list, int pos, string in);
-int    search_backwards (string what, string in);
-int    search_backwards (string what, int pos, string in);
-int    count_occurrences (string what, string in);
-int    count_occurrences (string what, string in);
-bool   occurs (string what, string in);
-string replace (string s, string what, string by);
-bool   match_wildcard (string s, string w);
-array<string> tokenize (string s, string sep);
-string recompose (array<string> a, string sep);
-string trim_spaces (string s);
+int search_forwards (const string& what, const string& in);
+int search_forwards (const string& what, int pos, const string& in);
+int search_forwards (const array<string>& what_list, int pos, const string& in);
+int search_backwards (const string& what, const string& in);
+int search_backwards (const string& what, int pos, const string& in);
+int count_occurrences (const string& what, const string& in);
+int count_occurrences (const string& what, const string& in);
+bool occurs (const string& what, const string& in);
+string replace (const string& s, const string& what, const string& by);
+bool match_wildcard (const string& s, const string& w);
+array<string> tokenize (const string& s, const string& sep);
+string recompose (const array<string>& a, const string& sep);
+string trim_spaces (const string& s);
 tree   trim_spaces (tree t);
-array<string> trim_spaces (array<string> a);
+array<string> trim_spaces (const array<string>& a);
 
 array<string> as_completions (hashset<string> h);
 array<string> close_completions (array<string> a);
-array<string> strip_completions (array<string> a, string prefix);
+array<string> strip_completions (array<string> a, const string& prefix);
 
 #endif // defined ANALYZE_H
Index: src/Data/String/converter.hpp
===================================================================
--- src/Data/String/converter.hpp	(revision 7657)
+++ src/Data/String/converter.hpp	(working copy)
@@ -34,7 +34,7 @@
   void load ();
 
 public:
-  inline converter_rep(string from2, string to2) : 
+  inline converter_rep(const string& from2, const string& to2) : 
     rep<converter>(from2*"-"*to2), ht(), output(), 
     nil_string(), from(from2), to(to2), copy_unmatched(true) { load(); }
 
@@ -71,23 +71,24 @@
 // converts the input string from one encoding to the other
 // recognized encodings are "Cork", "UTF-8" and all those recognized by iconv.
 
-bool check_encoding (string input, string encoding);
-string convert (string input, string from, string to);
-string convert_to_cork (string input, string from); 
-string convert_from_cork (string input, string to); 
-string utf8_to_cork (string input); 
-string cork_to_utf8 (string input); 
-string cork_to_sourcecode (string input);
-string sourcecode_to_cork (string input);
-string convert_utf8_to_LaTeX (string input);
-string utf8_to_html (string input);
-string utf8_to_t2a (string input);
-string t2a_to_utf8 (string input);
-string cyrillic_subset_in_t2a_to_code_point (string input);
-string code_point_to_cyrillic_subset_in_t2a (string input);
-string cork_to_ascii (string input);
-bool check_using_iconv (string input, string encoding);
-string convert_using_iconv (string input, string from, string to); 
+bool check_encoding (const string& input, const string& encoding);
+string convert (const string& input, const string& from, const string& to);
+string convert_to_cork (const string& input, const string& from); 
+string convert_from_cork (const string& input, const string& to); 
+string utf8_to_cork (const string& input); 
+string cork_to_utf8 (const string& input); 
+string cork_to_sourcecode (const string& input);
+string sourcecode_to_cork (const string& input);
+string convert_utf8_to_LaTeX (const string& input);
+string utf8_to_html (const string& input);
+string utf8_to_t2a (const string& input);
+string t2a_to_utf8 (const string& input);
+string cyrillic_subset_in_t2a_to_code_point (const string& input);
+string code_point_to_cyrillic_subset_in_t2a (const string& input);
+string cork_to_ascii (const string& input);
+bool check_using_iconv (const string& input, const string& encoding);
+string convert_using_iconv (const string& input,
+                            const string& from, const string& to);
 
 /**************************************************************************
 * Functions for hashtree handling
@@ -95,16 +96,18 @@
 
 // find_node("test",tree) means tree('t')('e')('s')('t')
 // might modify hashtree!
-hashtree<char,string> find_node (string key, hashtree<char,string> ht);
+hashtree<char,string> find_node (const string& key, hashtree<char,string> ht);
 
 // finds a node and assigns it a value
-void put_prefix_code (string key, string value, hashtree<char,string> ht);
+void put_prefix_code (const string& key, const string& value,
+                      hashtree<char,string> ht);
 
 // reads a dictionary from a file
 
 void hashtree_from_dictionary (
-  hashtree<char,string> dic, string file_name, escape_type key_escape=BIT2BIT,
-  escape_type val_escape=UTF8, bool reverse=false);
+  hashtree<char,string> dic, const string& file_name,
+  escape_type key_escape = BIT2BIT, escape_type val_escape = UTF8,
+  bool reverse=false);
 
 /***************************************************************************
 * Functions for UTF-8 handling
@@ -115,10 +118,10 @@
 bool is_hex_digit (char c);
 int hex_digit_to_int (unsigned char c);
 string encode_as_utf8 (unsigned int code);
-unsigned int decode_from_utf8 (string s, int& i);
-string convert_escapes (string in, bool utf8);
-string convert_char_entities (string s);
-string convert_char_entity (string s, int& start, bool& success);
-string utf8_to_hex_entities (string s);
+unsigned int decode_from_utf8 (const string& s, int& i);
+string convert_escapes (const string& in, bool utf8);
+string convert_char_entities (const string& s);
+string convert_char_entity (const string& s, int& start, bool& success);
+string utf8_to_hex_entities (const string& s);
 
 #endif // CONVERTER_H
