+++ /dev/null
-#include <ctype.h>
-#include "dimension.hh"
-#include "debug.hh"
-#include "string.hh"
-
-Real
-parse_dimen (String dim)
-{
- int i=dim.length_i()-1;
- char const *s = dim.ch_C ();
- while (i > 0 && (isspace (s[i]) || isalpha (s[i])))
- {
- i--;
- }
- String unit (s + i+1);
- return convert_dimen (dim.value_f(), unit);
-}
-
-
-Real
-convert_dimen (Real quant, String unit)
-{
- if (unit == "cm")
- return quant * CM_TO_PT;
- if (unit == "pt")
- return quant;
- if (unit == "mm")
- return quant*CM_TO_PT/10;
- if (unit == "in")
- return quant * INCH_TO_PT;
- error (_f ("unknown length unit: `%s\'", unit));
-}
-
-String
-print_dimen (Real r)
-{
- String s = to_str (r, "%.3f");
- if (s.index_i ("NaN") != -1)
- {
- warning (_ ("NaN"));
- s = "0.0";
- }
- s += "pt";
- return s;
-}
-
+++ /dev/null
-#ifndef DIMEN_HH
-#define DIMEN_HH
-
-#include "real.hh"
-#include "string.hh"
-
-const Real INCH_TO_PT=72.270;
-const Real CM_TO_PT=INCH_TO_PT/2.54;
-const Real MM_TO_PT=CM_TO_PT/10;
-const Real PT_TO_PT =1.0;
-
-#define PT *PT_TO_PT
-#define MM *MM_TO_PT
-#define CM *CM_TO_PT
-#define INCH *INCH_TO_PT
-
-Real parse_dimen (String);
-String print_dimen (Real);
-Real convert_dimen (Real, String);
-#endif
-
+++ /dev/null
-/*
- tex.hh -- declare various functions for TeX output
-
- source file of the LilyPond music typesetter
-
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-
-#ifndef TEX_HH
-#define TEX_HH
-
-#include "string.hh"
-#include "box.hh"
-#include "scalar.hh"
-
-/** paratime_signature substitution in TeX_strings.
- this function provides a simple macro mechanism:
-
- if source == "tex%bla%", then
- substitute_args (source, {"X","Y"}) == "texXblaY"
- */
-String
-substitute_args (String source, Array<String> args);
-
-/// paratime_signature substitution in TeX_strings
-String
-substitute_args (String source, Array<Scalar> args);
-
-/// #h# is in points
-String vstrut (Real h);
-
-
-#endif
+++ /dev/null
-/*
- tex.cc -- implement TeX related misc functions
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-#include "dimension.hh"
-#include "tex.hh"
-#include "atom.hh"
-#include "array.hh"
-
-String
-vstrut (Real h)
-{
- return String ("\\vrule height ") + print_dimen (h) + "depth 0pt width 0pt";
-}
-
-
-static void
-substitute_arg (String& r, String arg)
-{
- int p = r.index_i ('%');
- if (p < 0)
- return ;
-
- r = r.left_str (p) + arg + r.right_str (r.length_i() - p -1);
-}
-
-
-String
-substitute_args (String source, Array<String> args)
-{
- String retval (source);
- for (int i = 0 ; i < args.size(); i++)
- substitute_arg (retval, args[i]);
- return retval;
-}
-
-String
-substitute_args (String source, Array<Scalar> args)
-{
- Array<String> sv;
- for (int i = 0 ; i < args.size(); i++)
- sv.push (args[i]);
-
- return substitute_args (source, sv);
-}