From patchwork Thu Jul 28 10:56:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Geissler X-Patchwork-Id: 107242 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 49BFBB6F00 for ; Thu, 28 Jul 2011 20:57:22 +1000 (EST) Received: (qmail 21782 invoked by alias); 28 Jul 2011 10:57:20 -0000 Received: (qmail 21765 invoked by uid 22791); 28 Jul 2011 10:57:17 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-ew0-f47.google.com (HELO mail-ew0-f47.google.com) (209.85.215.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 28 Jul 2011 10:57:01 +0000 Received: by ewy5 with SMTP id 5so2163037ewy.20 for ; Thu, 28 Jul 2011 03:56:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.14.15.31 with SMTP id e31mr399806eee.201.1311850619335; Thu, 28 Jul 2011 03:56:59 -0700 (PDT) Received: by 10.14.37.140 with HTTP; Thu, 28 Jul 2011 03:56:59 -0700 (PDT) Date: Thu, 28 Jul 2011 12:56:59 +0200 Message-ID: Subject: [MELT] split_string_* functions now take a value From: Romain Geissler To: gcc-melt@googlegroups.com, gcc-patches@gcc.gnu.org, Pierre Vittet X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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. From 41290f00ee0cb6bdeaf2254b0d6a25ebddf23a65 Mon Sep 17 00:00:00 2001 From: Romain Geissler 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