avoid println with its extra CR on Windows;
authorwenzelm
Sun Dec 10 20:29:00 2017 +0100 (17 months ago)
changeset 6717870576478bda9
parent 67177 af5b89bc065c
child 67179 35a4bf0f13b3
avoid println with its extra CR on Windows;
src/Pure/Admin/isabelle_cronjob.scala
src/Pure/General/output.scala
src/Pure/System/getopts.scala
src/Pure/System/isabelle_process.scala
src/Pure/System/options.scala
src/Pure/System/progress.scala
src/Pure/Tools/doc.scala
src/Pure/Tools/server.scala
src/Tools/jEdit/src/scala_console.scala
     1.1 --- a/src/Pure/Admin/isabelle_cronjob.scala	Sun Dec 10 18:43:08 2017 +0100
     1.2 +++ b/src/Pure/Admin/isabelle_cronjob.scala	Sun Dec 10 20:29:00 2017 +0100
     1.3 @@ -346,7 +346,7 @@
     1.4          res match {
     1.5            case Exn.Res(_) => None
     1.6            case Exn.Exn(exn) =>
     1.7 -            System.err.println("Exception trace for " + quote(task.name) + ":")
     1.8 +            Output.writeln("Exception trace for " + quote(task.name) + ":")
     1.9              exn.printStackTrace()
    1.10              val first_line = split_lines(Exn.message(exn)).headOption getOrElse "exception"
    1.11              Some(first_line)
     2.1 --- a/src/Pure/General/output.scala	Sun Dec 10 18:43:08 2017 +0100
     2.2 +++ b/src/Pure/General/output.scala	Sun Dec 10 20:29:00 2017 +0100
     2.3 @@ -24,24 +24,24 @@
     2.4    def writeln(msg: String, stdout: Boolean = false)
     2.5    {
     2.6      if (msg != "") {
     2.7 -      if (stdout) Console.println(writeln_text(msg))
     2.8 -      else Console.err.println(writeln_text(msg))
     2.9 +      if (stdout) Console.print(writeln_text(msg) + "\n")
    2.10 +      else Console.err.print(writeln_text(msg) + "\n")
    2.11      }
    2.12    }
    2.13  
    2.14    def warning(msg: String, stdout: Boolean = false)
    2.15    {
    2.16      if (msg != "") {
    2.17 -      if (stdout) Console.println(warning_text(msg))
    2.18 -      else Console.err.println(warning_text(msg))
    2.19 +      if (stdout) Console.print(warning_text(msg) + "\n")
    2.20 +      else Console.err.print(warning_text(msg) + "\n")
    2.21      }
    2.22    }
    2.23  
    2.24    def error_message(msg: String, stdout: Boolean = false)
    2.25    {
    2.26      if (msg != "") {
    2.27 -      if (stdout) Console.println(error_message_text(msg))
    2.28 -      else Console.err.println(error_message_text(msg))
    2.29 +      if (stdout) Console.print(error_message_text(msg) + "\n")
    2.30 +      else Console.err.print(error_message_text(msg) + "\n")
    2.31      }
    2.32    }
    2.33  }
     3.1 --- a/src/Pure/System/getopts.scala	Sun Dec 10 18:43:08 2017 +0100
     3.2 +++ b/src/Pure/System/getopts.scala	Sun Dec 10 20:29:00 2017 +0100
     3.3 @@ -29,7 +29,7 @@
     3.4  {
     3.5    def usage(): Nothing =
     3.6    {
     3.7 -    Console.println(usage_text)
     3.8 +    Output.writeln(usage_text, stdout = true)
     3.9      sys.exit(1)
    3.10    }
    3.11  
     4.1 --- a/src/Pure/System/isabelle_process.scala	Sun Dec 10 18:43:08 2017 +0100
     4.2 +++ b/src/Pure/System/isabelle_process.scala	Sun Dec 10 20:29:00 2017 +0100
     4.3 @@ -41,7 +41,7 @@
     4.4      modes: List[String] = Nil,
     4.5      cwd: JFile = null,
     4.6      env: Map[String, String] = Isabelle_System.settings(),
     4.7 -    receiver: Prover.Receiver = Console.println(_),
     4.8 +    receiver: Prover.Receiver = (msg: Prover.Message) => Output.writeln(msg.toString, stdout = true),
     4.9      xml_cache: XML.Cache = new XML.Cache(),
    4.10      sessions: Option[Sessions.Structure] = None,
    4.11      store: Sessions.Store = Sessions.store()): Prover =
     5.1 --- a/src/Pure/System/options.scala	Sun Dec 10 18:43:08 2017 +0100
     5.2 +++ b/src/Pure/System/options.scala	Sun Dec 10 20:29:00 2017 +0100
     5.3 @@ -185,13 +185,13 @@
     5.4      }
     5.5  
     5.6      if (get_option != "")
     5.7 -      Console.println(options.check_name(get_option).value)
     5.8 +      Output.writeln(options.check_name(get_option).value, stdout = true)
     5.9  
    5.10      if (export_file != "")
    5.11        File.write(Path.explode(export_file), YXML.string_of_body(options.encode))
    5.12  
    5.13      if (get_option == "" && export_file == "")
    5.14 -      Console.println(options.print)
    5.15 +      Output.writeln(options.print, stdout = true)
    5.16    })
    5.17  }
    5.18  
     6.1 --- a/src/Pure/System/progress.scala	Sun Dec 10 18:43:08 2017 +0100
     6.2 +++ b/src/Pure/System/progress.scala	Sun Dec 10 20:29:00 2017 +0100
     6.3 @@ -45,7 +45,7 @@
     6.4  {
     6.5    override def echo(msg: String)
     6.6    {
     6.7 -    if (stderr) Console.err.println(msg) else Console.println(msg)
     6.8 +    Output.writeln(msg, stdout = !stderr)
     6.9    }
    6.10  
    6.11    override def theory(session: String, theory: String): Unit =
     7.1 --- a/src/Pure/Tools/doc.scala	Sun Dec 10 18:43:08 2017 +0100
     7.2 +++ b/src/Pure/Tools/doc.scala	Sun Dec 10 20:29:00 2017 +0100
     7.3 @@ -82,7 +82,7 @@
     7.4  
     7.5    def view(path: Path)
     7.6    {
     7.7 -    if (path.is_file) Console.println(Library.trim_line(File.read(path)))
     7.8 +    if (path.is_file) Output.writeln(Library.trim_line(File.read(path)), stdout = true)
     7.9      else {
    7.10        val pdf = path.ext("pdf")
    7.11        if (pdf.is_file) Isabelle_System.pdf_viewer(pdf)
    7.12 @@ -103,7 +103,7 @@
    7.13      val docs = getopts(args)
    7.14  
    7.15      val entries = contents()
    7.16 -    if (docs.isEmpty) Console.println(cat_lines(contents_lines().map(_._2)))
    7.17 +    if (docs.isEmpty) Output.writeln(cat_lines(contents_lines().map(_._2)), stdout = true)
    7.18      else {
    7.19        docs.foreach(doc =>
    7.20          entries.collectFirst { case Doc(name, _, path) if doc == name => path } match {
     8.1 --- a/src/Pure/Tools/server.scala	Sun Dec 10 18:43:08 2017 +0100
     8.2 +++ b/src/Pure/Tools/server.scala	Sun Dec 10 20:29:00 2017 +0100
     8.3 @@ -134,11 +134,11 @@
     8.4  
     8.5        if (operation_list) {
     8.6          for (entry <- using(SQLite.open_database(Data.database))(list(_)) if entry.active)
     8.7 -          Console.println(entry.print)
     8.8 +          Output.writeln(entry.print, stdout = true)
     8.9        }
    8.10        else {
    8.11          val (entry, thread) = start(name, port)
    8.12 -        Console.println(entry.print)
    8.13 +        Output.writeln(entry.print, stdout = true)
    8.14          thread.foreach(_.join)
    8.15        }
    8.16      })
     9.1 --- a/src/Tools/jEdit/src/scala_console.scala	Sun Dec 10 18:43:08 2017 +0100
     9.2 +++ b/src/Tools/jEdit/src/scala_console.scala	Sun Dec 10 20:29:00 2017 +0100
     9.3 @@ -110,7 +110,7 @@
     9.4  
     9.5    private def report_error(str: String)
     9.6    {
     9.7 -    if (global_console == null || global_err == null) System.err.println(str)
     9.8 +    if (global_console == null || global_err == null) isabelle.Output.writeln(str)
     9.9      else GUI_Thread.later { global_err.print(global_console.getErrorColor, str) }
    9.10    }
    9.11