]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/main.cc (setup_paths)[__MINGW32__]: Normalize LILYPONDPREFIX.
authorJan Nieuwenhuizen <janneke@gnu.org>
Mon, 23 May 2005 19:18:58 +0000 (19:18 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Mon, 23 May 2005 19:18:58 +0000 (19:18 +0000)
* lily/general-scheme.cc (ly:stderr-redirect): Rename from
ly:port-move.  Needs to be stderr-specific on mingw.
Run fixcc.

* lily/general-scheme.cc (ly:port-move): Remove.

* scm/backend-library.scm (postscript->pdf): Remove -dSAFER in
windows.

* lily/main.cc (setup_paths) [ARGV0_RELOCATION]: Reinstate GS_*
variables.  This eliminates the need for a gs.bat wrapper, which
opens a console.

* scripts/lilypond-invoke-editor.scm (running-from-gui?):
* scm/lily.scm (running-from-gui?):
* lily/main.cc[MINGW]: Remove isatty inversion, this is an
artifact of not compiling with -mwindows.

* scm/editor.scm: Define PLATFORM.

ChangeLog
Documentation/user/advanced-notation.itely
lily/general-scheme.cc
lily/main.cc
scm/backend-library.scm
scm/editor.scm
scm/lily.scm
scripts/lilypond-invoke-editor.scm

index f4b14dec2180252dc13dc1b3bb76a0025eb65ecf..387ec86374da109e511069f0308465cf3553472b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+2005-05-23  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+       * lily/main.cc (setup_paths)[__MINGW32__]: Normalize LILYPONDPREFIX.
+
+2005-05-21  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+       * lily/general-scheme.cc (ly:stderr-redirect): Rename from
+       ly:port-move.  Needs to be stderr-specific on mingw.
+       Run fixcc.
+
+2005-05-20  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+       * lily/general-scheme.cc (ly:port-move): Remove.
+
+       * scm/backend-library.scm (postscript->pdf): Remove -dSAFER in
+       windows.
+
+       * lily/main.cc (setup_paths) [ARGV0_RELOCATION]: Reinstate GS_*
+       variables.  This eliminates the need for a gs.bat wrapper, which
+       opens a console.
+
+       * scripts/lilypond-invoke-editor.scm (running-from-gui?): 
+       * scm/lily.scm (running-from-gui?): 
+       * lily/main.cc[MINGW]: Remove isatty inversion, this is an
+       artifact of not compiling with -mwindows.
+
+       * scm/editor.scm: Define PLATFORM.
+
 2005-05-23  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
        * scripts/lilypond-book.py (PREAMBLE_LY): add marker, where people
 
 2005-05-18  Jan Nieuwenhuizen  <janneke@gnu.org>
 
+       * Documentation/user/advanced-notation.itely (Text scripts):
+       Change nonexisting @internalsref{Text markup} to @ref{Text
+       markup}.  Change @internalsref{Text script} to
+       @internalsref{TextScript}.
+
        * lily/main.cc (setup_paths): Bugfix: pangorc is not pango.modules.
 
 2005-05-17  Graham Percival  <gperlist@shaw.ca>
index 74b1457d374912964a2eaa26cea58894703c71aa..c936755fa51c43fe17fc2813a73b09e59cc25c87 100644 (file)
@@ -49,11 +49,10 @@ your scores.
 @cindex text items, non-empty
 @cindex non-empty texts
 
-It is possible to place arbitrary strings of text or
-@internalsref{Text markup} above or below notes by using a string
-@code{c^"text"}.  By default, these indications do not influence the
-note spacing, but by using the command @code{\fatText}, the widths
-will be taken into account
+It is possible to place arbitrary strings of text or @ref{Text markup}
+above or below notes by using a string @code{c^"text"}.  By default,
+these indications do not influence the note spacing, but by using the
+command @code{\fatText}, the widths will be taken into account
 
 @lilypond[quote,fragment,raggedright,verbatim,relative=1]
 c4^"longtext" \fatText c4_"longlongtext" c4
@@ -66,7 +65,7 @@ c'4^\markup { bla \bold bla }
 @end lilypond
 
 The @code{\markup} is described in more detail in
-@internalsref{Text markup}.
+@ref{Text markup}.
 
 
 @refcommands
@@ -200,7 +199,7 @@ c1^\markup { hi \bold there, is \italic anyone home? }
 @end lilypond
 
 @noindent
-@code{\markup} is primarily used for @internalsref{Text scripts},
+@code{\markup} is primarily used for @internalsref{TextScript}s,
 but it can also be used anywhere text is called in lilypond
 
 @lilypond[quote,verbatim]
@@ -474,7 +473,7 @@ R1*2 | R1*5 | R1*9
 @cindex fermata on multi-measure rest
 
 Texts can be added to multi-measure rests by using the
-@var{note}-@code{markup} syntax @internalsref{Text markup}.
+@var{note}-@code{markup} syntax @ref{Text markup}.
 A variable (@code{\fermataMarkup}) is provided for
 adding fermatas
 
index 11fb65790f4846027bcf7e134f99d54236777593..fe3327880266f684bc0ac190f51a90890808a9d0 100644 (file)
@@ -143,8 +143,7 @@ LY_DEFINE (ly_assoc_get, "ly:assoc-get",
 
   if (scm_is_pair (handle))
     return scm_cdr (handle);
-  else
-    return default_value;
+  return default_value;
 }
 
 LY_DEFINE (ly_number2string, "ly:number->string",
@@ -166,7 +165,7 @@ LY_DEFINE (ly_number2string, "ly:number->string",
          {
            programming_error (_ ("infinity or NaN encountered while converting Real number"));
            programming_error (_ ("setting to zero"));
-                              
+
            r = 0.0;
          }
 
@@ -248,28 +247,35 @@ LY_DEFINE (ly_wchar_to_utf_8, "ly:wide-char->utf-8",
 
   SCM_ASSERT_TYPE (scm_is_integer (wc), wc, SCM_ARG1, __FUNCTION__, "integer");
   unsigned wide_char = (unsigned) scm_to_int (wc);
-  char * p = buf;
-
-  if (wide_char < 0x0080) {
-    *p++ = (char)wide_char;
-  } else if (wide_char < 0x0800) {
-    *p++ = (char)(((wide_char >>  6)       ) | 0xC0);
-    *p++ = (char)(((wide_char      ) & 0x3F) | 0x80);
-  } else if (wide_char < 0x10000) {
-    *p++ = (char)(((wide_char >> 12)       ) | 0xE0);
-    *p++ = (char)(((wide_char >>  6) & 0x3F) | 0x80);
-    *p++ = (char)(((wide_char      ) & 0x3F) | 0x80);
-  } else {
-    *p++ = (char)(((wide_char >> 18)       ) | 0xF0);
-    *p++ = (char)(((wide_char >> 12) & 0x3F) | 0x80);
-    *p++ = (char)(((wide_char >>  6) & 0x3F) | 0x80);
-    *p++ = (char)(((wide_char      ) & 0x3F) | 0x80);
-  }
+  char *p = buf;
+
+  if (wide_char < 0x0080)
+    {
+      *p++ = (char)wide_char;
+    }
+  else if (wide_char < 0x0800)
+    {
+      *p++ = (char) (((wide_char >> 6)) | 0xC0);
+      *p++ = (char) (((wide_char) & 0x3F) | 0x80);
+    }
+  else if (wide_char < 0x10000)
+    {
+      *p++ = (char) (((wide_char >> 12)) | 0xE0);
+      *p++ = (char) (((wide_char >> 6) & 0x3F) | 0x80);
+      *p++ = (char) (((wide_char) & 0x3F) | 0x80);
+    }
+  else
+    {
+      *p++ = (char) (((wide_char >> 18)) | 0xF0);
+      *p++ = (char) (((wide_char >> 12) & 0x3F) | 0x80);
+      *p++ = (char) (((wide_char >> 6) & 0x3F) | 0x80);
+      *p++ = (char) (((wide_char) & 0x3F) | 0x80);
+    }
   *p = 0;
 
   return scm_makfrom0str (buf);
 }
-         
+
 LY_DEFINE (ly_effective_prefix, "ly:effective-prefix",
           0, 0, 0, (),
           "Return effective prefix.")
@@ -279,8 +285,9 @@ LY_DEFINE (ly_effective_prefix, "ly:effective-prefix",
 
 LY_DEFINE (ly_chain_assoc_get, "ly:chain-assoc-get",
           2, 1, 0, (SCM key, SCM achain, SCM dfault),
-          "Return value for @var{key} from a list of alists @var{achain}. Return @var{dfault} "
-          "if no entry is found, or #f if not specified. ")
+          "Return value for @var{key} from a list of alists @var{achain}.  "
+          "If no if no entry is found, return DFAULT, "
+          "or #f if no DFAULT not specified.")
 {
   if (scm_is_pair (achain))
     {
@@ -290,17 +297,20 @@ LY_DEFINE (ly_chain_assoc_get, "ly:chain-assoc-get",
       else
        return ly_chain_assoc_get (key, scm_cdr (achain), dfault);
     }
-  else
-    return dfault == SCM_UNDEFINED ? SCM_BOOL_F : dfault;
+  return dfault == SCM_UNDEFINED ? SCM_BOOL_F : dfault;
 }
 
-LY_DEFINE (ly_port_move, "ly:port-move",
-          2, 0, 0, (SCM fd, SCM port),
-          "Move file descriptor FD to PORT.")
+LY_DEFINE (ly_stderr_redirect, "ly:stderr-redirect",
+          1, 1, 0, (SCM file_name, SCM mode),
+          "Redirect stderr to FILE-NAME, opened with MODE.")
 {
-  SCM_ASSERT_TYPE (scm_port_p (port), port, SCM_ARG1, __FUNCTION__, "port");
-  SCM_ASSERT_TYPE (scm_integer_p (fd), fd, SCM_ARG1, __FUNCTION__, "fd");
-  freopen (ly_scm2newstr (scm_port_filename (port), 0), "a",
-          fdopen (scm_to_int (fd), "a"));
+  SCM_ASSERT_TYPE (scm_string_p (file_name), file_name, SCM_ARG1,
+                  __FUNCTION__, "file_name");
+  char const* m = "w";
+  if (mode != SCM_UNDEFINED && scm_string_p (mode))
+    m = ly_scm2newstr (mode, 0);
+  /* dup2 and (fileno (current-error-port)) do not work with mingw'c
+     gcc -mwindows.  */
+  freopen (ly_scm2newstr (file_name, 0), m, stderr);
   return SCM_UNSPECIFIED;
 }
index da1a508ab676602eca5415426eea4257de092620..4c8af368e029313221c75ffd203486b2e93d508b 100644 (file)
@@ -190,6 +190,8 @@ dir_info (FILE *out)
 #if ARGV0_RELOCATION
   env_var_info (out, "FONTCONFIG_FILE");
   env_var_info (out, "FONTCONFIG_PATH");
+  env_var_info (out, "GS_FONTPATH");
+  env_var_info (out, "GS_LIB");
   env_var_info (out, "GUILE_LOAD_PATH");
   env_var_info (out, "PANGO_RC_FILE");
   env_var_info (out, "PATH");
@@ -285,6 +287,10 @@ dir_name (String const file_name)
 }
 #endif
 
+#ifdef __MINGW32__
+#  include <winbase.h>
+#endif
+
 static void
 setup_paths (char const* argv0)
 {
@@ -305,6 +311,14 @@ setup_paths (char const* argv0)
       prefix_directory = datadir + "/lilypond/" TOPLEVEL_VERSION;
 
       sane_putenv ("FONTCONFIG_FILE", sysconfdir + "/fonts/fonts.conf", false);
+#ifdef __MINGW32__
+      char font_dir[PATH_MAX];
+      ExpandEnvironmentStrings ("%windir%/fonts", font_dir, sizeof (font_dir));
+      prepend_env_path ("GS_FONTPATH", font_dir);
+#endif
+      prepend_env_path ("GS_FONTPATH", datadir + "/gs/fonts");
+      prepend_env_path ("GS_LIB", datadir + "/gs/Resource");
+      prepend_env_path ("GS_LIB", datadir + "/gs/lib");
       prepend_env_path ("GUILE_LOAD_PATH", datadir
                        + to_string ("/guile/%d.%d",
                                     SCM_MAJOR_VERSION, SCM_MINOR_VERSION));
@@ -316,7 +330,13 @@ setup_paths (char const* argv0)
 #endif /* ARGV0_RELOCATION */
     
   if (char const *env = getenv ("LILYPONDPREFIX"))
-    prefix_directory = env;
+    {
+#ifdef __MINGW32__
+      /* Normalize file name.  */
+      env = File_name (env).to_string ().get_copy_str0 ();
+#endif
+      prefix_directory = env;
+    }
 
   global_path.append ("");
 
@@ -659,12 +679,6 @@ parse_argv (int argc, char **argv)
     }
 }
 
-#ifdef __MINGW32__
-/* If no TTY and not using safe, assume running from GUI.
-   For mingw, the test must be inverted.  */
-#  define isatty(x) (!isatty (x))
-#endif
-
 int
 main (int argc, char **argv)
 {
index 47b6a208955361e5688864ac4efa8c8c694d7212..e0170fb433e217dc3754c1268a4161da64f04e93 100644 (file)
@@ -53,7 +53,9 @@
     ;; The wrapper on windows cannot handle `=' signs,
     ;; gs has a workaround with #.
     (if (eq? PLATFORM 'windows)
-       (set! cmd (string-regexp-substitute "=" "#" cmd)))
+       (begin
+         (set! cmd (string-regexp-substitute "=" "#" cmd))
+         (set! cmd (string-regexp-substitute "-dSAFER " "" cmd))))
 
     (if (access? pdf-name W_OK)
        (delete-file pdf-name))
index 2491e0c4cad452315eb186484d52f05a232b73ae..cde166fbfdf72d53440187c9b05ed21d0b043cd7 100644 (file)
@@ -6,16 +6,16 @@
 
 (define-module (scm editor))
 
+;; Also for standalone use, so cannot include any lily modules.
 (use-modules
- (ice-9 regex))
+ (ice-9 regex)
+  (srfi srfi-13)
+  (srfi srfi-14))
 
-(define editor-command-template-alist
-  '(("emacs" .  "emacsclient --no-wait +%(line)s:%(column)s %(file)s")
-    ("gvim" . "gvim --remote +:%(line)s:norm%(column)s %(file)s")
-    ("nedit" . "nc -noask +%(line)s %(file)s")
-    ("gedit" . "gedit +%(line)s %(file)s")
-    ("jedit" . "jedit %(file)s +line:%(line)s")
-    ("lilypad" . "lilypad +%(line)s:%(column)s %(file)s")))
+(define PLATFORM
+  (string->symbol
+   (string-downcase
+    (car (string-tokenize (vector-ref (uname) 0) char-set:letter)))))
 
 (define (get-editor)
   (or (getenv "LYEDITOR")
        (else
         "emacs"))))
 
+(define editor-command-template-alist
+  '(("emacs" .  "emacsclient --no-wait +%(line)s:%(column)s %(file)s")
+    ("gvim" . "gvim --remote +:%(line)s:norm%(column)s %(file)s")
+    ("nedit" . "nc -noask +%(line)s %(file)s")
+    ("gedit" . "gedit +%(line)s %(file)s")
+    ("jedit" . "jedit %(file)s +line:%(line)s")
+    ("lilypad" . "lilypad +%(line)s:%(column)s %(file)s")))
+
 (define (get-command-template alist editor)
   (define (get-command-template-helper)
     (if (null? alist)
index 2584e13f8c4aa8cd398261af4d9008c3e2ebc76f..46035c4f0057cb33d77b17badd1b2a223d3d1648 100644 (file)
@@ -375,12 +375,12 @@ The syntax is the same as `define*-public'."
 
 (define (running-from-gui?)
   (let ((have-tty? (isatty? (current-input-port))))
-    
     ;; If no TTY and not using safe, assume running from GUI.
-    ;; For mingw, the test must be inverted.
-
     (cond
-     ((eq? PLATFORM 'windows) have-tty?)
+     ((eq? PLATFORM 'windows)
+      ;; This only works for i586-mingw32msvc-gcc -mwindows
+      (not (string-match "standard input"
+                        (format #f "~S" (current-input-port)))))
      ((eq? PLATFORM 'darwin) #f)
      (else
       (not have-tty?)))))
@@ -388,11 +388,10 @@ The syntax is the same as `define*-public'."
 (define-public (gui-main files)
   (if (null? files) (gui-no-files-handler))
   (let* ((base (basename (car files) ".ly"))
-        (log-name (string-append base ".log"))
-        (log-file (open-file log-name "w")))
+        (log-name (string-append base ".log")))
     (if (not (running-from-gui?))
        (ly:message (_ "Redirecting output to ~a...") log-name))
-    (ly:port-move (fileno (current-error-port)) log-file)
+    (ly:stderr-redirect log-name "w")
     (ly:message "# -*-compilation-*-")
     (let ((failed (lilypond-all files)))
       (if (pair? failed)
index e61d10f779ff5f4574c2210023da68a8219456d7..a9cf32c2497c28543d69acef4879ff10f529fb95 100755 (executable)
@@ -106,9 +106,7 @@ Options:
 (define (running-from-gui?)
   (let ((have-tty? (isatty? (current-input-port))))
     ;; If no TTY and not using safe, assume running from GUI.
-    ;; for mingw, the test must be inverted.
-    (if (eq? PLATFORM 'windows)
-       have-tty? (not have-tty?))))
+    (not have-tty?)))
 
 (define (main args)
   (let ((files (parse-options args)))