s = get_property ("instrumentName");
if (!scm_is_string (s))
- s = scm_from_locale_string ("piano");
+ s = scm_from_ascii_string ("piano");
SCM eq = get_property ("instrumentEqualizer");
if (ly_is_procedure (eq))
#ifndef NDEBUG
if (ly_is_procedure (creation_callback))
scm_apply_0 (creation_callback,
- scm_list_n (grob->self_scm (), scm_from_locale_string (file),
- scm_from_int (line), scm_from_locale_string (fun), SCM_UNDEFINED));
+ scm_list_n (grob->self_scm (), scm_from_utf8_string (file),
+ scm_from_int (line), scm_from_ascii_string (fun), SCM_UNDEFINED));
#endif
return grob;
pat = FcFontMatch (NULL, pat, &result);
FcChar8 *str = 0;
if (FcPatternGetString (pat, FC_FILE, 0, &str) == FcResultMatch)
- scm_result = scm_from_locale_string ((char const *)str);
+ scm_result = scm_from_utf8_string ((char const *)str);
FcPatternDestroy (pat);
}
string contents = gulp_file_to_string (ly_scm2string (name), true, sz);
- return scm_from_locale_stringn (contents.c_str (), contents.length ());
+ return scm_from_latin1_stringn (contents.c_str (), contents.length ());
}
LY_DEFINE (ly_dir_p, "ly:dir?",
else
snprintf (str, sizeof (str), "%d", int (scm_to_int (s)));
- return scm_from_locale_string (str);
+ return scm_from_ascii_string (str);
}
LY_DEFINE (ly_version, "ly:version", 0, 0, 0, (),
LY_DEFINE (ly_unit, "ly:unit", 0, 0, 0, (),
"Return the unit used for lengths as a string.")
{
- return scm_from_locale_string (INTERNAL_UNIT);
+ return scm_from_ascii_string (INTERNAL_UNIT);
}
LY_DEFINE (ly_dimension_p, "ly:dimension?", 1, 0, 0, (SCM d),
}
*p = 0;
- return scm_from_locale_string (buf);
+ return scm_from_utf8_string (buf);
}
LY_DEFINE (ly_effective_prefix, "ly:effective-prefix",
return (ly_symbol2string (arg));
else
{
- ly_progress (scm_from_locale_string ("\nUnsupported SCM value for format: ~a"),
+ ly_progress (scm_from_ascii_string ("\nUnsupported SCM value for format: ~a"),
scm_list_1 (arg));
}
lispy_name += suffix;
SCM s = ly_symbol2scm (lispy_name.c_str ());
- SCM d = scm_from_locale_string (descr);
+ SCM d = scm_from_utf8_string (descr);
SCM l = parse_symbol_list (vars);
internal_add_interface (s, d, l);
scm_list_n (self_scm (),
scm_from_locale_string (file),
scm_from_int (line),
- scm_from_locale_string (fun),
+ scm_from_ascii_string (fun),
sym, v, SCM_UNDEFINED));
#else
(void) file;
debug_output ("]\n", false);
}
- scm_primitive_load_path (scm_from_locale_string ("lily.scm"));
+ scm_primitive_load_path (scm_from_ascii_string ("lily.scm"));
}
SCM global_lily_module;
#include "config.hh"
+#if GUILEV2
+// if Guile's internal representation switches to utf8, this should be
+// changed accordingly for efficiency's sake. This is used for
+// strings known to be in ASCII entirely, including any string
+// constants in the C code.
+#define scm_from_ascii_string scm_from_latin1_string
+#define scm_from_ascii_stringn scm_from_latin1_stringn
+#define scm_from_ascii_symbol scm_from_latin1_symbol
+#else
+#define scm_from_ascii_string scm_from_locale_string
+#define scm_from_ascii_stringn scm_from_locale_stringn
+#define scm_from_ascii_symbol scm_from_locale_symbol
+#define scm_from_latin1_string scm_from_locale_string
+#define scm_from_latin1_stringn scm_from_locale_stringn
+#define scm_from_utf8_string scm_from_locale_string
+#define scm_from_utf8_symbol scm_from_locale_symbol
+#define scm_to_utf8_string scm_to_locale_string
+#endif
+
#ifndef SMOB_FREE_RETURN_VAL
#define SMOB_FREE_RETURN_VAL(CL) 0
#endif
/* this lets us "overload" macros such as get_property to take
symbols as well as strings */
inline SCM
-scm_or_str2symbol (char const *c) { return scm_from_locale_symbol (c); }
+scm_or_str2symbol (char const *c) { return scm_from_utf8_symbol (c); }
inline SCM
scm_or_str2symbol (SCM s)
value; \
})
#else
-inline SCM ly_symbol2scm (char const *x) { return scm_from_locale_symbol ((x)); }
+inline SCM ly_symbol2scm (char const *x) { return scm_from_utf8_symbol ((x)); }
#endif
/*
<chords,notes,figures>{RESTNAME}/[-_] | // pseudo backup rule
<chords,notes,figures>{RESTNAME} {
char const *s = YYText ();
- yylval = scm_from_locale_string (s);
+ yylval = scm_from_ascii_string (s);
return RESTNAME;
}
<chords,notes,figures>q/[-_] | // pseudo backup rule
<quote,commandquote>{
\\{ESCAPED} {
char c = escaped_char (YYText ()[1]);
- yylval = scm_cons (scm_from_locale_stringn (&c, 1),
+ yylval = scm_cons (scm_from_ascii_stringn (&c, 1),
yylval);
}
[^\\""]+ {
- yylval = scm_cons (scm_from_locale_string (YYText_utf8 ()),
+ yylval = scm_cons (scm_from_utf8_string (YYText_utf8 ()),
yylval);
}
\" {
return STRING;
}
\\ {
- yylval = scm_cons (scm_from_locale_string (YYText ()),
+ yylval = scm_cons (scm_from_ascii_string (YYText ()),
yylval);
}
}
char *
ly_scm2str0 (SCM str)
{
- return scm_to_locale_string (str);
+ return scm_to_utf8_string (str);
}
/*
SCM *tail = &l;
for (vsize i = 0; i < keytable_->table_.size (); i++)
{
- *tail = scm_acons (scm_from_locale_string (keytable_->table_[i].name_),
+ *tail = scm_acons (scm_from_utf8_string (keytable_->table_[i].name_),
scm_from_int (keytable_->table_[i].tokcode_),
SCM_EOL);
Stencil
Lookup::blank (Box b)
{
- return Stencil (b, scm_from_locale_string (""));
+ return Stencil (b, scm_string (SCM_EOL));
}
Stencil
{
SCM text = event_->get_property ("text");
- if (ly_is_equal (text, scm_from_locale_string (" ")))
+ if (ly_is_equal (text, scm_from_ascii_string (" ")))
{
if (last_text_)
last_text_->set_property ("self-alignment-X",
// " \"" + lilypond_datadir + "/scm/out\")";
//scm_c_eval_string (scm_pct_set_fallback.c_str() );
scm_primitive_eval
- (scm_list_3 (scm_from_locale_symbol ("set!"),
- scm_from_locale_symbol ("%compile-fallback-path"),
+ (scm_list_3 (scm_from_latin1_symbol ("set!"),
+ scm_from_latin1_symbol ("%compile-fallback-path"),
scm_from_locale_string (ly_scm_go_dir.c_str())));
#endif
string tab = otf->get_otf_table (string (ctag));
- return scm_from_locale_stringn ((char const *) tab.data (), tab.length ());
+ return scm_from_latin1_stringn ((char const *) tab.data (), tab.length ());
}
LY_DEFINE (ly_otf_font_p, "ly:otf-font?", 1, 0, 0,
string contents ((char const *)buffer, length);
contents = "(quote (" + contents + "))";
+#if GUILEV2
+ tab = scm_eval_string (scm_from_utf8_string (contents.c_str ()));
+#else
tab = scm_c_eval_string (contents.c_str ());
+#endif
free (buffer);
}
return tab;
warning (_f ("FT_Get_Glyph_Name () error: %s",
freetype_error_string (code).c_str ()));
- *tail = scm_cons (scm_from_locale_string (name), SCM_EOL);
+ *tail = scm_cons (scm_from_ascii_string (name), SCM_EOL);
tail = SCM_CDRLOC (*tail);
}
char_id = scm_from_uint32 (pg);
}
else
- char_id = scm_from_locale_string (glyph_name);
+ char_id = scm_from_utf8_string (glyph_name);
PangoRectangle logical_sub_rect;
PangoRectangle ink_sub_rect;
script_abbreviation:
'^' {
- $$ = scm_from_locale_string ("Hat");
+ $$ = scm_from_ascii_string ("Hat");
}
| '+' {
- $$ = scm_from_locale_string ("Plus");
+ $$ = scm_from_ascii_string ("Plus");
}
| '-' {
- $$ = scm_from_locale_string ("Dash");
+ $$ = scm_from_ascii_string ("Dash");
}
| '!' {
- $$ = scm_from_locale_string ("Bang");
+ $$ = scm_from_ascii_string ("Bang");
}
| ANGLE_CLOSE {
- $$ = scm_from_locale_string ("Larger");
+ $$ = scm_from_ascii_string ("Larger");
}
| '.' {
- $$ = scm_from_locale_string ("Dot");
+ $$ = scm_from_ascii_string ("Dot");
}
| '_' {
- $$ = scm_from_locale_string ("Underscore");
+ $$ = scm_from_ascii_string ("Underscore");
}
;
SCM
get_next_unique_context_id ()
{
- return scm_from_locale_string ("$uniqueContextId");
+ return scm_from_ascii_string ("$uniqueContextId");
}
static int new_context_count;
char s[128];
snprintf (s, sizeof (s)-1, "uniqueContext%d", new_context_count++);
- return scm_from_locale_string (s);
+ return scm_from_ascii_string (s);
}
// check_scheme_arg checks one argument with a given predicate for use
vector<char> pfb_string = gulp_file (file_name, 0);
char *pfa = pfb2pfa ((Byte *) &pfb_string[0], pfb_string.size ());
- SCM pfa_scm = scm_from_locale_string (pfa);
+ SCM pfa_scm = scm_from_latin1_string (pfa);
free (pfa);
debug_output ("]", false);
FT_Face face = open_ft_face (file_name, 0 /* index */);
string table = get_otf_table (face, "CFF ");
- SCM asscm = scm_from_locale_stringn ((char *) table.data (),
+ SCM asscm = scm_from_latin1_stringn ((char *) table.data (),
table.length ());
debug_output ("]", false);
be careful, as we don't want to loose references to the _sym_ members.
*/
Pedal_type_info info;
- info.event_class_sym_ = scm_from_locale_symbol ((base_ident + "-event").c_str ());
- info.style_sym_ = scm_from_locale_symbol (("pedal" + base_name + "Style").c_str ());
- info.strings_sym_ = scm_from_locale_symbol (("pedal" + base_name + "Strings").c_str ());
+ info.event_class_sym_ = scm_from_ascii_symbol ((base_ident + "-event").c_str ());
+ info.style_sym_ = scm_from_ascii_symbol (("pedal" + base_name + "Style").c_str ());
+ info.strings_sym_ = scm_from_ascii_symbol (("pedal" + base_name + "Strings").c_str ());
info.base_name_ = name;
info.pedal_c_str_ = strdup ((base_name + "Pedal").c_str ());
void
Source_file::init_port ()
{
- SCM str = scm_from_locale_string (c_str ());
+ // This is somewhat icky: the string will in general be in utf8, but
+ // we do our own utf8 encoding and verification in the parser, so we
+ // use the no-conversion equivalent of latin1
+ SCM str = scm_from_latin1_string (c_str ());
str_port_ = scm_mkstrport (SCM_INUM0, str, SCM_OPN | SCM_RDNG, __FUNCTION__);
scm_set_port_filename_x (str_port_, ly_string2scm (name_));
}
// the static translator_listener_record chains while garbage
// collecting.
- SCM class_sym = scm_permanent_object (scm_from_locale_symbol (name.c_str ()));
+ SCM class_sym = scm_permanent_object (scm_from_ascii_symbol (name.c_str ()));
r->event_class_ = class_sym;
r->get_listener_ = get_listener;
parse_symbol_list (grobs), static_properties);
static_properties = scm_acons (ly_symbol2scm ("description"),
- scm_from_locale_string (desc), static_properties);
+ scm_from_utf8_string (desc), static_properties);
SCM list = SCM_EOL;
for (; listener_list; listener_list = listener_list->next_)
Memory_out_stream stream;
create_type42_font (&stream, file_name, i);
- SCM asscm = scm_from_locale_stringn (stream.get_string (),
+ SCM asscm = scm_from_latin1_stringn (stream.get_string (),
stream.get_length ());
debug_output ("]", false);
if (scm_is_symbol (scm_caaar (s)))
{
if (SCM_UNBNDP (grobname))
- grobname = scm_from_locale_symbol
+ grobname = scm_from_utf8_symbol
(info.grob ()->name ().c_str ());
if (scm_is_eq (scm_caaar (s), grobname))
{