public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Gaius Mulley <gaius.mulley@southwales.ac.uk>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Segher Boessenkool <segher@kernel.crashing.org>,
	Matthias Klose <doko@ubuntu.com>,
	gcc-patches@gcc.gnu.org, Richard Biener <rguenther@suse.de>,
	dje.gcc@gmail.com
Subject: Re: [PATCH] Modula-2 into the GCC tree on master
Date: Tue, 22 Jun 2021 23:29:27 +0100	[thread overview]
Message-ID: <87lf71r0s8.fsf@j228-gm.comp.glam.ac.uk> (raw)
In-Reply-To: <20210621224127.GZ7746@tucnak> (Jakub Jelinek's message of "Tue,  22 Jun 2021 00:41:27 +0200")

Jakub Jelinek <jakub@redhat.com> writes:

>
> On Mon, Jun 21, 2021 at 11:36:48PM +0100, Gaius Mulley via Gcc-patches wrote:
>> > <built-in>: error: the file containing the definition module <E2><80><98>M2RTS
>> > <E2><80><99> cannot be found
>> > compiler exited with status 1
>> > output is:
>> > <built-in>: error: the file containing the definition module <E2><80><98>M2RTS
>> > <E2><80><99> cannot be found
>>
>> ah yes, it would be good to make it autoconf locale utf-8
>
> No, whether gcc is configured on an UTF-8 capable terminal or using UTF-8
> locale doesn't imply whether it will actually be used in such a terminal
> later on.
> See e.g. gcc/intl.c (gcc_init_libintl) how it decides whether to use UTF-8
> or normal quotes.

thank you for the steer - and to avoid a mistake of confusing host and
build.  I've generated a small patch which works using gcc/intl.c
open_quote/close_quote.  Hopefully it improves the aesthetics on host
machines.

diff --git a/gcc-versionno/gcc/m2/ChangeLog b/gcc-versionno/gcc/m2/ChangeLog
index 25cee8ed..86a95270 100644
--- a/gcc-versionno/gcc/m2/ChangeLog
+++ b/gcc-versionno/gcc/m2/ChangeLog
@@ -1,3 +1,16 @@
+2021-06-22       Gaius Mulley <gaius.mulley@southwales.ac.uk>
+
+	* m2/gm2-compiler/M2ColorString.mod:  import open_quote and
+	close_quote from m2color.
+	* m2/gm2-gcc/m2color.c:  (open_quote) New function implemented.
+	(close_quote) New function implemented, both functions import
+	open and close quotes from gcc/intl.c to pick up whether the
+	host has utf-8 capability.
+	* m2/gm2-gcc/m2color.def:  (open_quote) New function defined.
+	(close_quote) New function defined.
+	* m2/gm2-gcc/m2color.h:  (open_quote) and (close_quote) provide C
+	prototypes for external	functions.
+
 2021-06-21       Gaius Mulley <gaius.mulley@southwales.ac.uk>
 
 	* tools-src/calcpath:  (New file).
diff --git a/gcc-versionno/gcc/m2/gm2-compiler/M2ColorString.mod b/gcc-versionno/gcc/m2/gm2-compiler/M2ColorString.mod
index cecee131..f32ef88c 100644
--- a/gcc-versionno/gcc/m2/gm2-compiler/M2ColorString.mod
+++ b/gcc-versionno/gcc/m2/gm2-compiler/M2ColorString.mod
@@ -21,7 +21,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 
 IMPLEMENTATION MODULE M2ColorString ;
 
-FROM m2color IMPORT colorize_start, colorize_stop ;
+FROM m2color IMPORT colorize_start, colorize_stop, open_quote, close_quote ;
 FROM DynamicStrings IMPORT InitString, InitStringCharStar,
                            ConCat, ConCatChar, Mark, string, KillString,
                            Dup, char, Length, Mult ;
@@ -70,7 +70,7 @@ END append ;
 
 PROCEDURE quoteOpen (s: String) : String ;
 BEGIN
-   RETURN ConCat (append (s, "quote"), Mark (InitString ("‘")))
+   RETURN ConCat (append (s, "quote"), Mark (InitStringCharStar (open_quote ())))
 END quoteOpen ;
 
 
@@ -82,7 +82,7 @@ PROCEDURE quoteClose (s: String) : String ;
 BEGIN
    s := endColor (s) ;
    s := append (s, "quote") ;
-   s := ConCat (s, Mark (InitString ("’"))) ;
+   s := ConCat (s, Mark (InitStringCharStar (close_quote ()))) ;
    s := endColor (s) ;
    RETURN s
 END quoteClose ;
diff --git a/gcc-versionno/gcc/m2/gm2-gcc/m2color.c b/gcc-versionno/gcc/m2/gm2-gcc/m2color.c
index ec58a4b7..72299e34 100644
--- a/gcc-versionno/gcc/m2/gm2-gcc/m2color.c
+++ b/gcc-versionno/gcc/m2/gm2-gcc/m2color.c
@@ -38,6 +38,18 @@ const char *m2color_colorize_stop (bool show_color)
 }
 
 
+const char *m2color_open_quote (void)
+{
+  return open_quote;
+}
+
+
+const char *m2color_close_quote (void)
+{
+  return close_quote;
+}
+
+
 void _M2_m2color_init ()
 {
 }
diff --git a/gcc-versionno/gcc/m2/gm2-gcc/m2color.def b/gcc-versionno/gcc/m2/gm2-gcc/m2color.def
index 6fa48d2a..a6e96e21 100644
--- a/gcc-versionno/gcc/m2/gm2-gcc/m2color.def
+++ b/gcc-versionno/gcc/m2/gm2-gcc/m2color.def
@@ -39,4 +39,16 @@ PROCEDURE colorize_start (show_color: BOOLEAN;
 PROCEDURE colorize_stop (show_color: BOOLEAN) : ADDRESS ;
 
 
+(* open_quote - return a C string containing the open quote character which
+   might be a UTF-8 character if on a UTF-8 supporting host.  *)
+
+PROCEDURE open_quote () : ADDRESS ;
+
+
+(* close_quote - return a C string containing the close quote character which
+   might be a UTF-8 character if on a UTF-8 supporting host.  *)
+
+PROCEDURE close_quote () : ADDRESS ;
+
+
 END m2color.
diff --git a/gcc-versionno/gcc/m2/gm2-gcc/m2color.h b/gcc-versionno/gcc/m2/gm2-gcc/m2color.h
index 08ef9e72..1b9be66b 100644
--- a/gcc-versionno/gcc/m2/gm2-gcc/m2color.h
+++ b/gcc-versionno/gcc/m2/gm2-gcc/m2color.h
@@ -37,9 +37,11 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 
 
 EXTERN const char *m2color_colorize_start (bool show_color, char *name, unsigned int name_len);
-
 EXTERN const char *m2color_colorize_stop (bool show_color);
 
+EXTERN const char *m2color_open_quote (void);
+EXTERN const char *m2color_close_quote (void);
+
 EXTERN void _M2_m2color_init ();
 EXTERN void _M2_m2color_finish ();


regards,
Gaius

  reply	other threads:[~2021-06-22 22:29 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17 22:26 Gaius Mulley
2021-06-18 10:19 ` Matthias Klose
2021-06-18 21:14   ` Gaius Mulley
2021-06-19  7:53   ` Gaius Mulley
2021-06-19 10:32     ` Matthias Klose
2021-06-18 10:52 ` Richard Biener
2021-06-18 12:50   ` Segher Boessenkool
2021-06-18 15:10   ` Gaius Mulley
2021-06-18 12:32 ` Segher Boessenkool
2021-06-18 21:00   ` Gaius Mulley
2021-06-19 14:09     ` Segher Boessenkool
2021-06-19 16:06       ` Segher Boessenkool
2021-06-21 22:36         ` Gaius Mulley
2021-06-21 22:41           ` Jakub Jelinek
2021-06-22 22:29             ` Gaius Mulley [this message]
2021-06-23 16:34             ` Segher Boessenkool
2021-06-20 11:57       ` Gaius Mulley
2021-06-21 11:20       ` Gaius Mulley
  -- strict thread matches above, loose matches on Subject: below --
2021-01-18  1:09 Gaius Mulley
2021-01-18 10:19 ` Richard Biener
2021-01-18 13:55   ` Gaius Mulley
2021-05-27 12:02     ` Matthias Klose
2021-05-27 14:00       ` Gaius Mulley
2021-06-10 15:00       ` Gaius Mulley
2021-01-18 12:26 ` Matthias Klose
2021-01-18 19:16   ` Gaius Mulley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lf71r0s8.fsf@j228-gm.comp.glam.ac.uk \
    --to=gaius.mulley@southwales.ac.uk \
    --cc=dje.gcc@gmail.com \
    --cc=doko@ubuntu.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=rguenther@suse.de \
    --cc=segher@kernel.crashing.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).