]> git.donarmstrong.com Git - lilypond.git/commitdiff
*** empty log message ***
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 7 Jan 2005 13:36:42 +0000 (13:36 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 7 Jan 2005 13:36:42 +0000 (13:36 +0000)
lily/grob-interface-scheme.cc
lily/include/kpath-private.hh [new file with mode: 0644]
lily/input-scheme.cc [new file with mode: 0644]
lily/input-smob.cc
lily/kpath-scheme.cc [new file with mode: 0644]
lily/kpath.cc
lily/score-scheme.cc
lily/score.cc

index 466c4bbcbb7c984b4077f8b7093ef03bb9caa39e..9eccbd906e624818216f8a3415542035d7d67ffe 100644 (file)
@@ -8,6 +8,8 @@
 */
 
 #include "lily-guile.hh"
+#include "protected-scm.hh"
+#include "string.hh"
 
 Protected_scm all_ifaces;
 
diff --git a/lily/include/kpath-private.hh b/lily/include/kpath-private.hh
new file mode 100644 (file)
index 0000000..d8fa199
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+  kpath-private.hh -- declare
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+#ifndef KPATH_PRIVATE_HH
+#define KPATH_PRIVATE_HH
+
+kpse_file_format_type kpathsea_find_format (String name);
+
+#endif /* KPATH_PRIVATE_HH */
+
+
+
diff --git a/lily/input-scheme.cc b/lily/input-scheme.cc
new file mode 100644 (file)
index 0000000..2478bc9
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+  input-scheme.cc --  implement Input bindings.
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+#include "string.hh"
+#include "input-smob.hh"
+
+/* We don't use IMPLEMENT_TYPE_P, since the smobification part is
+   implemented separately from the class.  */
+LY_DEFINE (ly_input, "ly:input-location?", 1, 0, 0,
+          (SCM x),
+          "Return #t if @var{x} is an input location.")
+{
+  return unsmob_input (x) ? SCM_BOOL_T : SCM_BOOL_F;
+}
+
+LY_DEFINE (ly_input_message, "ly:input-message", 2, 0, 0, (SCM sip, SCM msg),
+         "Print @var{msg} as a GNU compliant error message, pointing to the"
+          "location in @var{sip}.\n")
+{
+  Input *ip = unsmob_input (sip);
+  SCM_ASSERT_TYPE (ip, sip, SCM_ARG1, __FUNCTION__, "input location");
+  SCM_ASSERT_TYPE (scm_is_string (msg), msg, SCM_ARG2, __FUNCTION__, "string");
+
+  String m = ly_scm2string (msg);
+  ip->message (m);
+
+  return SCM_UNSPECIFIED;
+}
+
+/*
+  TODO: rename this function. ly:input-location? vs ly:input-location
+ */
+LY_DEFINE (ly_input_location, "ly:input-location", 1, 0, 0, (SCM sip),
+         "Return input location in @var{sip} as (file-name line column).")
+{
+  Input *ip = unsmob_input (sip);
+  SCM_ASSERT_TYPE (ip, sip, SCM_ARG1, __FUNCTION__, "input location");
+  return scm_list_3 (scm_makfrom0str (ip->file_string ().to_str0 ()),
+                    scm_int2num (ip->line_number ()),
+                    scm_int2num (ip->column_number ()));
+}
index 0dd973956f70b15bc411fc27673e6302ab7f6fa5..8dbf4d87f987ca3e2b17500e45557f5ae5ea4086 100644 (file)
@@ -71,41 +71,6 @@ unsmob_input (SCM s)
     return 0;                                  
 }
 
-/* We don't use IMPLEMENT_TYPE_P, since the smobification part is
-   implemented separately from the class.  */
-LY_DEFINE (ly_input, "ly:input-location?", 1, 0, 0,
-          (SCM x),
-          "Return #t if @var{x} is an input location.")
-{
-  return unsmob_input (x) ? SCM_BOOL_T : SCM_BOOL_F;
-}
-
-LY_DEFINE (ly_input_message, "ly:input-message", 2, 0, 0, (SCM sip, SCM msg),
-         "Print @var{msg} as a GNU compliant error message, pointing to the"
-          "location in @var{sip}.\n")
-{
-  Input *ip = unsmob_input (sip);
-  SCM_ASSERT_TYPE (ip, sip, SCM_ARG1, __FUNCTION__, "input location");
-  SCM_ASSERT_TYPE (scm_is_string (msg), msg, SCM_ARG2, __FUNCTION__, "string");
-
-  String m = ly_scm2string (msg);
-  ip->message (m);
-
-  return SCM_UNSPECIFIED;
-}
-
-/*
-  TODO: rename this function. ly:input-location? vs ly:input-location
- */
-LY_DEFINE (ly_input_location, "ly:input-location", 1, 0, 0, (SCM sip),
-         "Return input location in @var{sip} as (file-name line column).")
-{
-  Input *ip = unsmob_input (sip);
-  SCM_ASSERT_TYPE (ip, sip, SCM_ARG1, __FUNCTION__, "input location");
-  return scm_list_3 (scm_makfrom0str (ip->file_string ().to_str0 ()),
-                    scm_int2num (ip->line_number ()),
-                    scm_int2num (ip->column_number ()));
-}
 
 ADD_SCM_INIT_FUNC (input, start_input_smobs);
 
diff --git a/lily/kpath-scheme.cc b/lily/kpath-scheme.cc
new file mode 100644 (file)
index 0000000..8275c8b
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+  kpath-scheme.cc --  implement kpathsea bindings
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+#include "kpath.hh"
+
+#include <cstdio>
+#include <cstring>
+
+/*
+
+The problem, as far as I can tell, is that MacOS X has its getopt
+prototype in <unistd.h>, while I think other operating systems have it
+in other places. <unistd.h> is included by kpathsea.h, so you end up
+renaming both conflicting prototypes to YAKLUDGE.
+
+I found a somewhat more elegant patch for this: Just #include
+<unistd.h> before defining YAKLUDGE.
+
+*/
+
+#include <unistd.h>    
+
+#include "config.hh"
+
+#define popen REALLYUGLYKLUDGE
+#define pclose ANOTHERREALLYUGLYKLUDGE
+#define getopt YAKLUDGE
+
+#if HAVE_KPATHSEA_KPATHSEA_H
+extern "C" {
+#include <kpathsea/kpathsea.h>
+#include <kpathsea/tex-file.h>
+}
+#endif
+
+#include "file-path.hh"
+#include "main.hh"
+#include "source-file.hh"
+#include "warn.hh"
+#include "kpath-private.hh"
+
+LY_DEFINE (ly_find_file, "ly:find-file",
+          1, 0, 0, (SCM name),
+          "Return the absolute file name of @var{name},"
+          "or @code{#f} if not found.")
+{
+  SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG1, __FUNCTION__, "string");
+
+  String nm = ly_scm2string (name);
+  String file_name = global_path.find (nm);
+  if (file_name.is_empty ())
+    return SCM_BOOL_F;
+  
+  return scm_makfrom0str (file_name.to_str0 ());
+}
+
+LY_DEFINE (ly_kpathsea_find_file, "ly:kpathsea-find-file",
+          1, 0, 0, (SCM name),
+          "Return the absolute file name of @var{name},"
+          "or @code{#f} if not found.")
+{
+  SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG1, __FUNCTION__, "string");
+
+  String nm = ly_scm2string (name);
+  String file_name = global_path.find (nm);
+  if (file_name.is_empty ())
+    {
+      if (char *p = kpse_find_file (nm.to_str0 (), kpathsea_find_format (nm),
+                                   true))
+       return scm_makfrom0str (p);
+      return SCM_BOOL_F;
+    }
+  return scm_makfrom0str (file_name.to_str0 ());
+}
+
+LY_DEFINE (ly_kpathsea_expand_variable, "ly:kpathsea-expand-variable",
+          1, 0, 0, (SCM var),
+          "Return the expanded version  @var{var}.")
+{
+  SCM_ASSERT_TYPE (scm_is_string (var), var, SCM_ARG1, __FUNCTION__, "string");
+
+  String nm = ly_scm2string (var);
+  char *result =  kpse_var_expand (nm.to_str0 ());
+  SCM ret =  scm_makfrom0str (result);
+  delete[] result;
+
+  return ret;
+}
index 592d70d09a3a20d2295c12631dc1a13122ee767e..2757cf3508ca691450a62a60136021e3702e460e 100644 (file)
@@ -42,6 +42,7 @@ extern "C" {
 #include "main.hh"
 #include "source-file.hh"
 #include "warn.hh"
+#include "kpath-private.hh"
 
 String
 kpathsea_find_afm (char const *name)
@@ -85,7 +86,7 @@ kpathsea_find_tfm (char const *name)
 #if KPATHSEA
 /* FIXME: this should be part of kpathsea */
 
-static kpse_file_format_type
+kpse_file_format_type
 kpathsea_find_format (String name)
 {
   for (int i = 0; i < kpse_last_format; i++)
@@ -142,53 +143,6 @@ kpathsea_gulp_file_to_string (String name)
 }
 
 
-LY_DEFINE (ly_find_file, "ly:find-file",
-          1, 0, 0, (SCM name),
-          "Return the absolute file name of @var{name},"
-          "or @code{#f} if not found.")
-{
-  SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG1, __FUNCTION__, "string");
-
-  String nm = ly_scm2string (name);
-  String file_name = global_path.find (nm);
-  if (file_name.is_empty ())
-    return SCM_BOOL_F;
-  
-  return scm_makfrom0str (file_name.to_str0 ());
-}
-
-LY_DEFINE (ly_kpathsea_find_file, "ly:kpathsea-find-file",
-          1, 0, 0, (SCM name),
-          "Return the absolute file name of @var{name},"
-          "or @code{#f} if not found.")
-{
-  SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG1, __FUNCTION__, "string");
-
-  String nm = ly_scm2string (name);
-  String file_name = global_path.find (nm);
-  if (file_name.is_empty ())
-    {
-      if (char *p = kpse_find_file (nm.to_str0 (), kpathsea_find_format (nm),
-                                   true))
-       return scm_makfrom0str (p);
-      return SCM_BOOL_F;
-    }
-  return scm_makfrom0str (file_name.to_str0 ());
-}
-
-LY_DEFINE (ly_kpathsea_expand_variable, "ly:kpathsea-expand-variable",
-          1, 0, 0, (SCM var),
-          "Return the expanded version  @var{var}.")
-{
-  SCM_ASSERT_TYPE (scm_is_string (var), var, SCM_ARG1, __FUNCTION__, "string");
-
-  String nm = ly_scm2string (var);
-  char *result =  kpse_var_expand (nm.to_str0 ());
-  SCM ret =  scm_makfrom0str (result);
-  delete[] result;
-
-  return ret;
-}
 
 void
 initialize_kpathsea (char *av0)
index 63d82b425c55785d8c34228a69aed70cad35c230..f5b4369971ef58845a670116d4972c0ffdf84ed0 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  score-scheme.cc --  implement
+  score-scheme.cc --  implement Score bindings.
 
   source file of the GNU LilyPond music typesetter
 
@@ -10,6 +10,8 @@
 
 #include "score.hh"
 #include "music.hh"
+#include "output-def.hh"
+#include "global-context.hh"
 
 LY_DEFINE (ly_music_scorify, "ly:music-scorify",
           2, 0, 0,
@@ -26,3 +28,49 @@ LY_DEFINE (ly_music_scorify, "ly:music-scorify",
   scm_gc_unprotect_object (score->self_scm ());
   return score->self_scm ();
 }
+
+LY_DEFINE (ly_score_embedded_format, "ly:score-embedded-format",
+          2, 1, 0, (SCM score, SCM layout, SCM key),
+          "Run @var{score} through @var{layout}, an output definition, "
+          "scaled to correct outputscale already, "
+          "return a list of layout-lines. "
+          "\nTake optional Object_key argument."
+          )
+{
+  Score * sc = unsmob_score (score);
+  Output_def *od = unsmob_output_def (layout);
+
+  if (sc->error_found_)
+    {
+      return SCM_EOL;
+    }
+  
+  SCM_ASSERT_TYPE (sc, score, SCM_ARG1, __FUNCTION__, "Score");
+  SCM_ASSERT_TYPE (od, layout, SCM_ARG2, __FUNCTION__, "Output_def");
+
+  Output_def * score_def  = 0;
+
+  /* UGR, FIXME, these are default \layout blocks once again.  They
+     suck. */
+  for (int i = 0; !score_def && i < sc->defs_.size (); i++)
+    if (sc->defs_[i]->c_variable ("is-layout") == SCM_BOOL_T)
+      score_def = sc->defs_[i];
+
+  if (!score_def)
+    return scm_c_make_vector (0, SCM_EOL);
+      
+  score_def = score_def->clone ();
+  SCM prot = score_def->self_scm ();
+  scm_gc_unprotect_object (prot);
+
+  /* TODO: SCORE_DEF should be scaled according to OD->parent_ or OD
+     itself. */
+  score_def->parent_ = od;
+  
+  SCM context = ly_run_translator (sc->get_music (), score_def->self_scm (),
+                                  key);
+  SCM lines = ly_format_output (context, scm_makfrom0str ("<embedded>"));
+  
+  scm_remember_upto_here_1 (prot);
+  return lines;
+}
index d94bd14b5fa4e0fe2df8f6ecb132cbb8a5e2a4f7..cadb817b44f2ee43876cfe8b5b854150157812ea 100644 (file)
@@ -210,51 +210,6 @@ Score::book_rendering (String outname,
 
 
 
-LY_DEFINE (ly_score_embedded_format, "ly:score-embedded-format",
-          2, 1, 0, (SCM score, SCM layout, SCM key),
-          "Run @var{score} through @var{layout}, an output definition, "
-          "scaled to correct outputscale already, "
-          "return a list of layout-lines. "
-          "\nTake optional Object_key argument."
-          )
-{
-  Score * sc = unsmob_score (score);
-  Output_def *od = unsmob_output_def (layout);
-
-  if (sc->error_found_)
-    {
-      return SCM_EOL;
-    }
-  
-  SCM_ASSERT_TYPE (sc, score, SCM_ARG1, __FUNCTION__, "Score");
-  SCM_ASSERT_TYPE (od, layout, SCM_ARG2, __FUNCTION__, "Output_def");
-
-  Output_def * score_def  = 0;
-
-  /* UGR, FIXME, these are default \layout blocks once again.  They
-     suck. */
-  for (int i = 0; !score_def && i < sc->defs_.size (); i++)
-    if (sc->defs_[i]->c_variable ("is-layout") == SCM_BOOL_T)
-      score_def = sc->defs_[i];
-
-  if (!score_def)
-    return scm_c_make_vector (0, SCM_EOL);
-      
-  score_def = score_def->clone ();
-  SCM prot = score_def->self_scm ();
-  scm_gc_unprotect_object (prot);
-
-  /* TODO: SCORE_DEF should be scaled according to OD->parent_ or OD
-     itself. */
-  score_def->parent_ = od;
-  
-  SCM context = ly_run_translator (sc->get_music (), score_def->self_scm (),
-                                  key);
-  SCM lines = ly_format_output (context, scm_makfrom0str ("<embedded>"));
-  
-  scm_remember_upto_here_1 (prot);
-  return lines;
-}
 
 void
 Score::set_music (SCM music, SCM parser)