gnupic: Thread: some problem in source code--scan.l


[<<] [<] Page 1 of 1 [>] [>>]
Subject: some problem in source code--scan.l
From: feqin fan ####@####.####
Date: 10 Jul 2012 01:50:15 -0000
Message-Id: <CAOfAq_oxw+cfxyPxuKfa35Jy42mGCFi8dZTeOn5hyLa6M5csNA@mail.gmail.com>

Hello, everyone..

I have some problem need your help, THX..

at the beginning of scan.l LINE 97

#define YY_INPUT(buf,result,max_size) \
  { \
    GP_INPUT(buf,result,max_size); \
    if (result) \
      { \
        state.src->last_char_is_nl = (buf[result - 1] == '\n'); \
      } \
    else if (!state.src->last_char_is_nl) \
      { \
        *buf = '\n'; \
        result = 1; \
        state.src->last_char_is_nl = true; \
      } \
  }

BUT,state.src->last_char_is_nl = true, WHERE is the number
*last_char_is_nl* in struct state.src ?

--------------------------------------------

Another problem, the pattern   ^{IDENT}#v\(   match what?
someone Please give me a example..

Thank you, guys..

:-)



------------------------------------

live long and prosper..
Subject: Re: some problem in source code--scan.l
From: Byron Jeff ####@####.####
Date: 10 Jul 2012 02:48:25 -0000
Message-Id: <20120710024814.GA8392@mail.clayton.edu>

On Tue, Jul 10, 2012 at 09:50:13AM +0800, feqin fan wrote:
> Hello, everyone..
> 
> I have some problem need your help, THX..
> 
> at the beginning of scan.l LINE 97
> 
> #define YY_INPUT(buf,result,max_size) \
>   { \
>     GP_INPUT(buf,result,max_size); \
>     if (result) \
>       { \
>         state.src->last_char_is_nl = (buf[result - 1] == '\n'); \
>       } \
>     else if (!state.src->last_char_is_nl) \
>       { \
>         *buf = '\n'; \
>         result = 1; \
>         state.src->last_char_is_nl = true; \
>       } \
>   }
> 
> BUT,state.src->last_char_is_nl = true, WHERE is the number
> *last_char_is_nl* in struct state.src ?
> 
> --------------------------------------------
> 
> Another problem, the pattern   ^{IDENT}#v\(   match what?
> someone Please give me a example..

Can't answer the first one. But can on the second. The #v notation is
described in the MPASM manual on page 67. Here's a link:

http://courses.washington.edu/phys335/datasheets/mpasm-usersguide.pdf

Primary usage is to create unique labels in macros. The document gives the
example:

define_table 	macro
		local a = 0

		while a < 3
entry#v(a) 	dw 0
		a += 1
		endw

		endm

each entry#v(a) would generate a unique label with the string entry and the
current value of the a variable when the macro is invoked..

entry0 dw0
entry1 dw0
entry2 dw0
entry3 dw0

Hope this helps.

BAJ

> 
> Thank you, guys..
> 
> :-)
> 
> 
> 
> ------------------------------------
> 
> live long and prosper..

-- 
Byron A. Jeff
Department Chair: IT/CS/CNET
College of Information and Mathematical Sciences
Clayton State University
http://cims.clayton.edu/bjeff
Subject: Re: some problem in source code--scan.l
From: feqin fan ####@####.####
Date: 10 Jul 2012 05:27:16 -0000
Message-Id: <CAOfAq_p_JJrCWFU0Jxs=cncfLC=eCTZ9N-O=S2EGxLjifpeu7A@mail.gmail.com>

Thanks two guys.

  Byron Jeff and Joe Pfeiffer

  You answers are just what i want.
  Forgive my poor English writing.

  finally, I found the reason, I read the scan.l from version 0.14.2, BUT
the gpasm.h is from older version or had been changed.
  My job is porting gputils to our own chip that has different instruction
set.

  I will be very glad if I can do something for the community.





2012/7/10 Joe Pfeiffer ####@####.####

> feqin fan writes:
>
> >BUT,state.src->last_char_is_nl = true, WHERE is the number
> >*last_char_is_nl* in struct state.src ?
>
> I'm not sure I understand the question -- do you mean where is it
> defined?  If so:
>
> state is a global variable of type struct gpasm_state, declared on line
> 35 of gpasm.c.  It's defined in gpasm.h.in, starting on line 80.
>
> state.src is a field in state, of type struct *source_context.
>
> state.src->last_char_is_nl is a field in *state.src.  It's defined in
> gpasm.h.in, on line  299.
>
> >--------------------------------------------
> >
> >Another problem, the pattern   ^{IDENT}#v\(   match what?
> >someone Please give me a example..
> >
> >Thank you, guys..
> >
> >:-)
> >
> >
> >
> >------------------------------------
> >
> >live long and prosper..
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ####@####.####
> For additional commands, e-mail: ####@####.####
>
>
Subject: Re: some problem in source code--scan.l
From: Tamas Rudnai ####@####.####
Date: 10 Jul 2012 15:51:26 -0000
Message-Id: <CAJLb5+S12Mf8iezBJuy9kniW7Zp3mxJhbs5twiLXVvB3FobFPA@mail.gmail.com>

On 9 July 2012 22:27, feqin fan ####@####.#### wrote:

>   My job is porting gputils to our own chip that has different instruction
> set.
>

That is a nice challenge! Which chip is that btw?

Tamas



>
>   I will be very glad if I can do something for the community.
>
>
>
>
>
> 2012/7/10 Joe Pfeiffer ####@####.####
>
> > feqin fan writes:
> >
> > >BUT,state.src->last_char_is_nl = true, WHERE is the number
> > >*last_char_is_nl* in struct state.src ?
> >
> > I'm not sure I understand the question -- do you mean where is it
> > defined?  If so:
> >
> > state is a global variable of type struct gpasm_state, declared on line
> > 35 of gpasm.c.  It's defined in gpasm.h.in, starting on line 80.
> >
> > state.src is a field in state, of type struct *source_context.
> >
> > state.src->last_char_is_nl is a field in *state.src.  It's defined in
> > gpasm.h.in, on line  299.
> >
> > >--------------------------------------------
> > >
> > >Another problem, the pattern   ^{IDENT}#v\(   match what?
> > >someone Please give me a example..
> > >
> > >Thank you, guys..
> > >
> > >:-)
> > >
> > >
> > >
> > >------------------------------------
> > >
> > >live long and prosper..
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ####@####.####
> > For additional commands, e-mail: ####@####.####
> >
> >
>



-- 
int main() { char *a,*s,*q; printf(s="int main() { char *a,*s,*q;
printf(s=%s%s%s, q=%s%s%s%s,s,q,q,a=%s%s%s%s,q,q,q,a,a,q); }",
q="\"",s,q,q,a="\\",q,q,q,a,a,q); }
[<<] [<] Page 1 of 1 [>] [>>]


Powered by ezmlm-browse 0.20.