~ubuntu-branches/ubuntu/precise/lilypond/precise

« back to all changes in this revision

Viewing changes to flower/warn.cc

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Bushnell, BSG
  • Date: 2006-12-19 10:18:12 UTC
  • mfrom: (3.1.4 feisty)
  • Revision ID: james.westby@ubuntu.com-20061219101812-7awtjkp0i393wxty
Tags: 2.8.7-3
scripts/midi2ly.py: When setting DATADIR, find Lilypond python files
in the @TOPLEVEL_VERSION@ directory, not 'current'.  Patch thanks to
Chris Lamb (chris@chris-lamb.co.uk).  (Closes: #400550)

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
  source file of the Flower Library
5
5
 
6
 
  (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 
6
  (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
7
7
*/
8
8
 
9
 
#include <stdlib.h>
10
 
#include <stdio.h>
11
 
 
12
9
#include "warn.hh"
13
10
 
14
 
 
 
11
#include <cstdlib>
 
12
#include <cstdio>
 
13
 
 
14
#include "international.hh"
 
15
 
 
16
using namespace std;
 
17
 
 
18
/* Is progress indication at NEWLINE?  */
 
19
static bool progress_newline = true;
 
20
 
 
21
/* Display user information that is not a full message.  */
15
22
void
16
 
message (String s)
 
23
progress_indication (string s)
17
24
{
18
 
  fputs (s.to_str0 (), stderr);
 
25
  /* Test if all silly progress_indication ("\n") can be dropped now.  */
 
26
  if (s == "\n")
 
27
    return;
 
28
 
 
29
  fputs (s.c_str (), stderr);
19
30
  fflush (stderr);
20
 
}
21
 
 
22
 
void
23
 
warning (String s)
24
 
{
25
 
  message (_f ("warning: %s", s.to_str0 ()) + "\n");
26
 
}
27
 
 
28
 
void
29
 
non_fatal_error (String s)
30
 
{
31
 
  message (_f ("error: %s", s.to_str0 ()) + "\n");
32
 
}
33
 
 
34
 
void
35
 
error (String s)
 
31
  if (s.length ())
 
32
    progress_newline = s[s.length () - 1] == '\n';
 
33
}
 
34
 
 
35
/* Display a single user message.  Always starts on a new line.  */
 
36
void
 
37
message (string s)
 
38
{
 
39
  if (!progress_newline)
 
40
    fputc ('\n', stderr);
 
41
  progress_indication (s);
 
42
}
 
43
 
 
44
/* Display a warning message.  Always starts on a new line.  */
 
45
void
 
46
warning (string s)
 
47
{
 
48
  message (_f ("warning: %s", s.c_str ()) + "\n");
 
49
}
 
50
 
 
51
void
 
52
non_fatal_error (string s)
 
53
{
 
54
  message (_f ("error: %s", s.c_str ()) + "\n");
 
55
}
 
56
 
 
57
/* Display an error message.  Always starts on a new line.  */
 
58
void
 
59
error (string s)
36
60
{
37
61
  non_fatal_error (s);
38
62
  exit (1);
39
63
}
40
64
 
41
65
void
42
 
programming_error (String s)
 
66
programming_error (string s)
43
67
{
44
68
  message (_f ("programming error: %s", s) + "\n");
45
 
  message (_ ("Continuing; crossing fingers") + "\n");
 
69
  message (_ ("continuing, cross fingers") + "\n");
46
70
}
47
71