+
+
+/* 1.3.146 == removal of ; */
+Lilypond_version oldest_version ("1.3.146");
+
+
+bool
+valid_version_b (String s)
+{
+ Lilypond_version current ( MAJOR_VERSION "." MINOR_VERSION "." PATCH_LEVEL );
+ Lilypond_version ver (s);
+ if (! ((ver >= oldest_version) && (ver <= current)))
+ {
+ non_fatal_error (_f ("Incorrect lilypond version: %s (%s, %s)", ver.to_string (), oldest_version.to_string (), current.to_string ()));
+ non_fatal_error (_ ("Consider updating the input with the convert-ly script"));
+ return false;
+ }
+ return true;
+}
+
+
+/*
+ substittute _ adn \,
+*/
+String
+lyric_fudge (String s)
+{
+ char * chars =s.get_copy_str0 ();
+
+ for (char * p = chars; *p ; p++)
+ {
+ if (*p == '_' && (p == chars || *(p-1) != '\\'))
+ *p = ' ';
+ }
+
+ s = String (chars);
+ delete[] chars;
+
+ int i =0;
+ if ((i=s.index ("\\,")) != -1) // change "\," to TeX's "\c "
+ {
+ * (s.get_str0 () + i + 1) = 'c';
+ s = s.left_string (i+2) + " " + s.right_string (s.length ()-i-2);
+ }
+
+ return s;
+}
+
+/*
+Convert "NUM/DEN" into a '(NUM . DEN) cons.
+*/
+SCM
+scan_fraction (String frac)
+{
+ int i = frac.index ('/');
+ int l = frac.length ();
+ String left = frac.left_string (i);
+ String right = frac.right_string (l - i - 1);
+
+ int n = String_convert::dec2int (left);
+ int d = String_convert::dec2int (right);
+ return gh_cons (gh_int2scm (n), gh_int2scm (d));
+}
+
+// Breaks for flex 2.5.31
+#if 0
+/* avoid silly flex induced gcc warnings */
+static void yy_push_state (int) {;}
+static void yy_pop_state () {;}
+static int yy_top_state () { return 0; }
+
+static void
+avoid_silly_flex_induced_gcc_warnings ()
+{
+ (void)yy_start_stack_ptr;
+ (void)yy_start_stack_depth;
+ (void)yy_start_stack;
+ yy_push_state (0);
+ yy_pop_state ();
+ yy_top_state ();
+ avoid_silly_flex_induced_gcc_warnings ();
+}
+#endif
+
+SCM
+lookup_markup_command (String s)
+{
+ static SCM proc ;
+ if (!proc)
+ proc = scm_c_eval_string ("lookup-markup-command");
+
+ return scm_call_1 (proc, scm_makfrom0str (s.to_str0 ()));
+}