[prev in list] [next in list] [prev in thread] [next in thread]
List: gcc-fortran
Subject: Re: [fortran, patch] Enable Hollerith constant and character array in format tag.
From: Feng Wang <wf_cs () yahoo ! com>
Date: 2005-03-29 0:22:50
Message-ID: 20050329002250.72859.qmail () web15602 ! mail ! cnb ! yahoo ! com
[Download RAW message or body]
--- Steve Kargl <sgk@troutmask.apl.washington.edu> wrote:
> On Tue, Mar 29, 2005 at 01:34:40AM +0200, Steven Bosscher wrote:
> > On Monday 28 March 2005 16:17, Feng Wang wrote:
> > > * arith.c (gfc_hollerith2int, gfc_hollerith2real,
> > > gfc_hollerith2complex, gfc_hollerith2character): New functions.
> >
>
> I don't think he's storing the Hollerith in the integer's mpz_t,
> the real's single mpfr_t, or complex's 2 mpfr_t. A closer
> look shows that he is storing the KIND number of bytes in the
> result's string field.
>
> gfc_expr *
> gfc_hollerith2int (gfc_expr * src, int kind)
> {
> gfc_expr *result;
> int len;
>
> len = src->value.character.length;
>
> result = gfc_get_expr ();
>
> The next few lines set the type and kind for integer, but
> also sets the from_H bit to true.
>
> result->expr_type = EXPR_CONSTANT;
> result->ts.type = BT_INTEGER;
> result->ts.kind = kind;
> result->where = src->where;
> result->from_H = 1;
>
> This if () now determines the total number of bytes to use
>
> if (len > kind)
> {
> gfc_warning ();
> len = kind;
> }
>
> Here he is saving the KIND number of bytes into result's
> value.character.string field. In essences, he isn't doing
> a conversion.
>
> result->value.character.string = gfc_getmem (len + 1);
> memcpy (result->value.character.string, src->value.character.string, len);
> result->value.character.string[len] = '\0';
> result->value.character.length = len;
>
> return result;
> }
>
Yes. Thanks for reviewing carefully.
The real conversion to trees is in gfc_conv_constant_to_tree. I build string
constant and use VIEW_CONVERT_EXPR to convert the string to other type.
Best Regards,
Feng Wang
_________________________________________________________
Do You Yahoo!?
150万曲MP3疯狂搜,带您闯入音乐殿堂
http://music.yisou.com/
美女明星应有尽有,搜遍美图、艳图和酷图
http://image.yisou.com
1G就是1000兆,雅虎电邮自助扩容!
http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/event/mail_1g/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic