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

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