public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [MELT] split_string_* functions now take a value
@ 2011-07-28 12:42 Romain Geissler
  2011-08-02  8:12 ` Romain Geissler
  2011-08-02  8:37 ` Basile Starynkevitch
  0 siblings, 2 replies; 6+ messages in thread
From: Romain Geissler @ 2011-07-28 12:42 UTC (permalink / raw)
  To: gcc-melt, gcc-patches, Pierre Vittet

[-- Attachment #1: Type: text/plain, Size: 410 bytes --]

Hi,

I changed the argument type for the cs argument in split_string functions.
Indeed, there is no way to access the boxed string from a value, and sometimes
we can't avoid working with boxed strings. As we can box a :cstring in a value,
split_string_* functions are usable in all cases.

Find attach the patch. Please note that it is a git patch, thus it should be
applied with git-apply or git-am.

Romain.

[-- Attachment #2: 0001-split_string_-functions-now-require-a-value-string-i.Changelog --]
[-- Type: application/octet-stream, Size: 364 bytes --]

2011-07-28  Romain Geissler  <romain.geissler@gmail.com>

	* melt/warmelt-base.melt (split_string_space): Argument cs
	is now a (string) value.
	(split_string_comma): Likewise.
	(split_string_colon): Likewise.
	(split_string_equal): Likewise.
	* melt/warmelt-outobj (translateinit_docmd): Box string before
	calling split_string_comma.
	(makedoc_docmd): Likewise.

[-- Attachment #3: 0001-split_string_-functions-now-require-a-value-string-i.patch --]
[-- Type: text/x-patch, Size: 3206 bytes --]

From 41290f00ee0cb6bdeaf2254b0d6a25ebddf23a65 Mon Sep 17 00:00:00 2001
From: Romain Geissler <romain.geissler@st.com>
Date: Thu, 28 Jul 2011 12:43:59 +0200
Subject: [PATCH] split_string_* functions now require a value string instead
 of a :cstring.

---
 gcc/melt/warmelt-base.melt   |   16 ++++++++--------
 gcc/melt/warmelt-outobj.melt |    4 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/gcc/melt/warmelt-base.melt b/gcc/melt/warmelt-base.melt
index 8a6ff9d..c7eca3e 100644
--- a/gcc/melt/warmelt-base.melt
+++ b/gcc/melt/warmelt-base.melt
@@ -570,25 +570,25 @@ an integer $I if $I is lower than $N.}#
   #{(meltgc_string_hex_md5sum_file_sequence ((melt_ptr_t) $PATHSEQ))}#)
 
 
-(defprimitive split_string_space (dis :cstring cs) :value
+(defprimitive split_string_space (dis cs) :value
   :doc #{Split a cstring $CS into a list of space separated strings of
 discriminant $DIS.}#
-#{meltgc_new_split_string($cs, ' ', (melt_ptr_t) $dis)}#)
+#{meltgc_new_split_string(melt_string_str($cs), ' ', (melt_ptr_t) $dis)}#)
 
-(defprimitive split_string_comma (dis :cstring cs) :value
+(defprimitive split_string_comma (dis cs) :value
   :doc #{Split a cstring $CS into a list of comma separated strings of
 discriminant $DIS.}#
-#{meltgc_new_split_string($cs, ',', (melt_ptr_t) $dis)}#)
+#{meltgc_new_split_string(melt_string_str($cs), ',', (melt_ptr_t) $dis)}#)
 
-(defprimitive split_string_colon (dis :cstring cs) :value
+(defprimitive split_string_colon (dis cs) :value
   :doc #{Split a cstring $CS into a list of colon separated strings of
 discriminant $DIS.}#
-#{meltgc_new_split_string($cs, ':', (melt_ptr_t)$dis)}#)
+#{meltgc_new_split_string(melt_string_str($cs), ':', (melt_ptr_t)$dis)}#)
 
-(defprimitive split_string_equal (dis :cstring cs) :value
+(defprimitive split_string_equal (dis cs) :value
   :doc #{Split a cstring $CS into a list of equal separated strings of
 discriminant $DIS.}#
-#{meltgc_new_split_string($cs, '=', (melt_ptr_t)$dis)}#)
+#{meltgc_new_split_string(melt_string_str($cs), '=', (melt_ptr_t)$dis)}#)
 
 ;;; convert a strbuf into a string
 (defprimitive strbuf2string (dis sbuf) :value
diff --git a/gcc/melt/warmelt-outobj.melt b/gcc/melt/warmelt-outobj.melt
index dd1cdde..df4cf06 100644
--- a/gcc/melt/warmelt-outobj.melt
+++ b/gcc/melt/warmelt-outobj.melt
@@ -4671,7 +4671,7 @@ has basic debug support thru debug_msg, assert_msg..."
 	 (inarg (cond ( progarg 
 			(make_stringconst discr_string progarg))
 		      ( progarglist
-			 (split_string_comma discr_string progarglist)
+			 (split_string_comma discr_string (make_stringconst discr_string progarglist))
 			)
 		      (:else
 		       (errormsg_plain "invalid arg or arglist to translateinit mode")
@@ -5800,7 +5800,7 @@ has basic debug support thru debug_msg, assert_msg..."
   (let ( 
 	(parmodenv (parent_module_environment))
 	(curenv (if moduldata moduldata initial_environment))
-	(arglist (split_string_comma discr_string (melt_argument "arglist")))
+	(arglist (split_string_comma discr_string (make_stringconst discr_string (melt_argument "arglist"))))
 	(outarg (make_stringconst discr_string (melt_argument "output")))
 	(rlist (make_list discr_list))
 	(mdinfo 
-- 
1.7.6


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [MELT] split_string_* functions now take a value
  2011-07-28 12:42 [MELT] split_string_* functions now take a value Romain Geissler
@ 2011-08-02  8:12 ` Romain Geissler
  2011-08-02  8:37 ` Basile Starynkevitch
  1 sibling, 0 replies; 6+ messages in thread
From: Romain Geissler @ 2011-08-02  8:12 UTC (permalink / raw)
  To: gcc-melt, gcc-patches, Pierre Vittet

Ping for Pierre !

2011/7/28 Romain Geissler <romain.geissler@gmail.com>:
> Hi,
>
> I changed the argument type for the cs argument in split_string functions.
> Indeed, there is no way to access the boxed string from a value, and sometimes
> we can't avoid working with boxed strings. As we can box a :cstring in a value,
> split_string_* functions are usable in all cases.
>
> Find attach the patch. Please note that it is a git patch, thus it should be
> applied with git-apply or git-am.
>
> Romain.
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [MELT] split_string_* functions now take a value
  2011-07-28 12:42 [MELT] split_string_* functions now take a value Romain Geissler
  2011-08-02  8:12 ` Romain Geissler
@ 2011-08-02  8:37 ` Basile Starynkevitch
  2011-08-02  8:46   ` [GCC-MELT-136] " Romain Geissler
  1 sibling, 1 reply; 6+ messages in thread
From: Basile Starynkevitch @ 2011-08-02  8:37 UTC (permalink / raw)
  To: Romain Geissler; +Cc: gcc-melt, gcc-patches, Pierre Vittet

On Thu, 28 Jul 2011 12:56:59 +0200
Romain Geissler <romain.geissler@gmail.com> wrote:
> 
> I changed the argument type for the cs argument in split_string functions.
> Indeed, there is no way to access the boxed string from a value, and sometimes
> we can't avoid working with boxed strings. As we can box a :cstring in a value,
> split_string_* functions are usable in all cases.


The :doc strings are wrong. Please use capitals for macrovariables in
macrostrings and try using appropriate C style or indentation so 

+#{meltgc_new_split_string (melt_string_str ($CS), ' ', (melt_ptr_t) $DIS)}#)
instead of
+#{meltgc_new_split_string(melt_string_str($cs), ' ', (melt_ptr_t) $dis)}#)


Cheers.
-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [GCC-MELT-136] Re: [MELT] split_string_* functions now take a value
  2011-08-02  8:37 ` Basile Starynkevitch
@ 2011-08-02  8:46   ` Romain Geissler
  2011-08-02  8:53     ` [GCC-MELT-137] " Basile Starynkevitch
  0 siblings, 1 reply; 6+ messages in thread
From: Romain Geissler @ 2011-08-02  8:46 UTC (permalink / raw)
  To: gcc-melt; +Cc: gcc-patches, Pierre Vittet

2011/8/2 Basile Starynkevitch <basile@starynkevitch.net>:
> Please use capitals for macrovariables in
> macrostrings

Ok.

Can i have more details about that: is it just a Melt convention or is
it an implementation requirement (in other word, does melt awaits
macrovariables to be upper case ?)

Romain

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [GCC-MELT-137] Re: [MELT] split_string_* functions now take a value
  2011-08-02  8:46   ` [GCC-MELT-136] " Romain Geissler
@ 2011-08-02  8:53     ` Basile Starynkevitch
  2011-08-02 10:31       ` Romain Geissler
  0 siblings, 1 reply; 6+ messages in thread
From: Basile Starynkevitch @ 2011-08-02  8:53 UTC (permalink / raw)
  To: gcc-melt; +Cc: Romain Geissler, gcc-patches, Pierre Vittet

On Tue, 2 Aug 2011 10:46:38 +0200
Romain Geissler <romain.geissler@gmail.com> wrote:

> 2011/8/2 Basile Starynkevitch <basile@starynkevitch.net>:
> > Please use capitals for macrovariables in
> > macrostrings
> 
> Ok.
> 
> Can i have more details about that: is it just a Melt convention or is
> it an implementation requirement (in other word, does melt awaits
> macrovariables to be upper case ?)


Just a coding (social) convention. Macrovariables are very important, and my editor
(emacs) and mode (lisp-mode) don't highlight them.

Since macrovariables are really MELT symbols, their case don't matter (the MELT reader
force them to upper cases). But they are more human-readable in upper cases.

Cheers.

-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [GCC-MELT-137] Re: [MELT] split_string_* functions now take a value
  2011-08-02  8:53     ` [GCC-MELT-137] " Basile Starynkevitch
@ 2011-08-02 10:31       ` Romain Geissler
  0 siblings, 0 replies; 6+ messages in thread
From: Romain Geissler @ 2011-08-02 10:31 UTC (permalink / raw)
  To: Basile Starynkevitch; +Cc: gcc-melt, gcc-patches, Pierre Vittet

[-- Attachment #1: Type: text/plain, Size: 1112 bytes --]

Here is the fix git patch.


2011/8/2 Basile Starynkevitch <basile@starynkevitch.net>:
> On Tue, 2 Aug 2011 10:46:38 +0200
> Romain Geissler <romain.geissler@gmail.com> wrote:
>
>> 2011/8/2 Basile Starynkevitch <basile@starynkevitch.net>:
>> > Please use capitals for macrovariables in
>> > macrostrings
>>
>> Ok.
>>
>> Can i have more details about that: is it just a Melt convention or is
>> it an implementation requirement (in other word, does melt awaits
>> macrovariables to be upper case ?)
>
>
> Just a coding (social) convention. Macrovariables are very important, and my editor
> (emacs) and mode (lisp-mode) don't highlight them.
>
> Since macrovariables are really MELT symbols, their case don't matter (the MELT reader
> force them to upper cases). But they are more human-readable in upper cases.
>
> Cheers.
>
> --
> Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
> email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
> 8, rue de la Faiencerie, 92340 Bourg La Reine, France
> *** opinions {are only mine, sont seulement les miennes} ***
>

[-- Attachment #2: 0001-split_string_-functions-now-require-a-value-string-i.patch --]
[-- Type: text/x-patch, Size: 3520 bytes --]

From 3e9b3fbbc25634a1f2e0b2b2e1a13c0e3927be31 Mon Sep 17 00:00:00 2001
From: Romain Geissler <romain.geissler@st.com>
Date: Thu, 28 Jul 2011 12:43:59 +0200
Subject: [PATCH] split_string_* functions now require a value string instead
 of a :cstring.

---
 gcc/melt/warmelt-base.melt   |   24 ++++++++++++------------
 gcc/melt/warmelt-outobj.melt |    4 ++--
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/gcc/melt/warmelt-base.melt b/gcc/melt/warmelt-base.melt
index 8a6ff9d..3b068db 100644
--- a/gcc/melt/warmelt-base.melt
+++ b/gcc/melt/warmelt-base.melt
@@ -570,25 +570,25 @@ an integer $I if $I is lower than $N.}#
   #{(meltgc_string_hex_md5sum_file_sequence ((melt_ptr_t) $PATHSEQ))}#)
 
 
-(defprimitive split_string_space (dis :cstring cs) :value
-  :doc #{Split a cstring $CS into a list of space separated strings of
+(defprimitive split_string_space (dis s) :value
+  :doc #{Split a string value $S into a list of space separated strings of
 discriminant $DIS.}#
-#{meltgc_new_split_string($cs, ' ', (melt_ptr_t) $dis)}#)
+#{meltgc_new_split_string (melt_string_str ($S), ' ', (melt_ptr_t) $DIS)}#)
 
-(defprimitive split_string_comma (dis :cstring cs) :value
-  :doc #{Split a cstring $CS into a list of comma separated strings of
+(defprimitive split_string_comma (dis s) :value
+  :doc #{Split a string value $S into a list of comma separated strings of
 discriminant $DIS.}#
-#{meltgc_new_split_string($cs, ',', (melt_ptr_t) $dis)}#)
+#{meltgc_new_split_string (melt_string_str ($S), ',', (melt_ptr_t) $DIS)}#)
 
-(defprimitive split_string_colon (dis :cstring cs) :value
-  :doc #{Split a cstring $CS into a list of colon separated strings of
+(defprimitive split_string_colon (dis s) :value
+  :doc #{Split a string value $S into a list of colon separated strings of
 discriminant $DIS.}#
-#{meltgc_new_split_string($cs, ':', (melt_ptr_t)$dis)}#)
+#{meltgc_new_split_string (melt_string_str ($S), ':', (melt_ptr_t) $DIS)}#)
 
-(defprimitive split_string_equal (dis :cstring cs) :value
-  :doc #{Split a cstring $CS into a list of equal separated strings of
+(defprimitive split_string_equal (dis s) :value
+  :doc #{Split a string value $S into a list of equal separated strings of
 discriminant $DIS.}#
-#{meltgc_new_split_string($cs, '=', (melt_ptr_t)$dis)}#)
+#{meltgc_new_split_string (melt_string_str ($S), '=', (melt_ptr_t) $DIS)}#)
 
 ;;; convert a strbuf into a string
 (defprimitive strbuf2string (dis sbuf) :value
diff --git a/gcc/melt/warmelt-outobj.melt b/gcc/melt/warmelt-outobj.melt
index dd1cdde..df4cf06 100644
--- a/gcc/melt/warmelt-outobj.melt
+++ b/gcc/melt/warmelt-outobj.melt
@@ -4671,7 +4671,7 @@ has basic debug support thru debug_msg, assert_msg..."
 	 (inarg (cond ( progarg 
 			(make_stringconst discr_string progarg))
 		      ( progarglist
-			 (split_string_comma discr_string progarglist)
+			 (split_string_comma discr_string (make_stringconst discr_string progarglist))
 			)
 		      (:else
 		       (errormsg_plain "invalid arg or arglist to translateinit mode")
@@ -5800,7 +5800,7 @@ has basic debug support thru debug_msg, assert_msg..."
   (let ( 
 	(parmodenv (parent_module_environment))
 	(curenv (if moduldata moduldata initial_environment))
-	(arglist (split_string_comma discr_string (melt_argument "arglist")))
+	(arglist (split_string_comma discr_string (make_stringconst discr_string (melt_argument "arglist"))))
 	(outarg (make_stringconst discr_string (melt_argument "output")))
 	(rlist (make_list discr_list))
 	(mdinfo 
-- 
1.7.6


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-08-02 10:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-28 12:42 [MELT] split_string_* functions now take a value Romain Geissler
2011-08-02  8:12 ` Romain Geissler
2011-08-02  8:37 ` Basile Starynkevitch
2011-08-02  8:46   ` [GCC-MELT-136] " Romain Geissler
2011-08-02  8:53     ` [GCC-MELT-137] " Basile Starynkevitch
2011-08-02 10:31       ` Romain Geissler

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).