Patchwork [GCC-MELT-137] Re: [MELT] split_string_* functions now take a value

login
register
mail settings
Submitter Romain Geissler
Date Aug. 2, 2011, 10:31 a.m.
Message ID <CAF+LTeeXvSKUA+riEUybq03ObD38HowA6Uami6syNbyde0Sj7Q@mail.gmail.com>
Download mbox | patch
Permalink /patch/107885/
State New
Headers show

Comments

Romain Geissler - Aug. 2, 2011, 10:31 a.m.
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} ***
>

Patch

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