gnupic: some question about the directive GLOBAL in the source code.
Subject:
Re: some question about the directive GLOBAL in the source code.
From:
feqin fan ####@####.####
Date:
18 Aug 2012 09:47:41 -0000
Message-Id: <CAOfAq_rXG+PX-9zVJ8FQKn6qdnPTiBt1feAodu3he1EUscsexg@mail.gmail.com>
Thanks
:-)
2012/8/18 Marko Kohtala ####@####.####
> The source being parsed comes from files and macros. Need to know what is
> being parsed.
>
> Marko
>
> 2012/8/18 feqin fan ####@####.####
>
> > (⊙o⊙)…
> > Thank you.
> >
> > Can you tell me why so many struct file_context and struct
> source_context?
> > struct file_context and struct source_context do what..??
> >
> > THX..
> >
> > 2012/8/18 Marko Kohtala ####@####.####
> >
> > > I think you are missing the read of gperror. It wont print the error on
> > > first pass, and on second pass the symbol is already defined.
> > >
> > > Marko
> > >
> > > 2012/8/14 feqin fan ####@####.####
> > >
> > > > Hello, everybody, I'm sorry to trouble you again.
> > > > I have read most of the source code of gputils. I have a query
> > about
> > > > the implementation of the directive GLOBAL.
> > > > for example, Have this code:
> > > >
> > > > global var
> > > >
> > > > udata
> > > > var res 1
> > > >
> > > > the assembler deal with the first line "global var",
> > > > the calling sequence is like this : yyparse() -
> do_or_append_insn(char
> > *,
> > > > struct pnode *) - do_insn(char *, struct pnode *) - do_global()
> > > > the function do_global() source code :
> > > >
> > > > 1, if (state.mode == absolute) {
> > > > 2, gperror(GPE_OBJECT_ONLY, NULL);
> > > > 3, } else {
> > > > 4, for (; parms; parms = TAIL(parms)) {
> > > > 5, p = maybe_evaluate_concat(HEAD(parms)); //p will
> point
> > > to
> > > > "var".
> > > > 6, if (p) {
> > > > 7, s = get_symbol(state.stTop, p); //s will be NULL
> > > > 8, if (s == NULL) {
> > > > 9, snprintf(buf,
> > > > 10, sizeof(buf),
> > > > 11 "Symbol not previously defined (%s).",
> > > > 12, p);
> > > > 13, gperror(GPE_NOSYM, buf);
> > > >
> > > >
> > > >
> > > > the line 4 must be first executed, in line 5 the p will point to
> "var".
> > > and
> > > > in line 7, because the source code "global var" is the first line of
> > the
> > > > being assembled code.
> > > > So. in the function do_global() line 7, the s will be NULL,so the
> error
> > > > will be print..
> > > >
> > > > Please tell what's wring in my analyses..??
> > > > :-)
> > > >
> > > > THX, Guys..
> > > >
> > >
> >
>