gnupic: Thread: some question about the directive GLOBAL in the source code.


[<<] [<] Page 1 of 2 [>] [>>]
Subject: some question about the directive GLOBAL in the source code.
From: feqin fan ####@####.####
Date: 14 Aug 2012 10:35:38 -0000
Message-Id: <CAOfAq_oR-SQUA5HOwAeZbutm9Gy3ztYZEr-7FFXfqeSEg0Ji_Q@mail.gmail.com>

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..
Subject: Re: some question about the directive GLOBAL in the source code.
From: Holger Oehm ####@####.####
Date: 15 Aug 2012 18:01:51 -0000
Message-Id: <502BE3D2.2070308@holger-oehm.de>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 14.08.2012 12:35, feqin fan wrote:
> 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,

And why exactly should s be NULL after the assignment in line 7???
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlAr48sACgkQHdk+97UOUanAAgCfYSdqul+vqfA3ARzB38GScQGT
8lUAoIVHttJ6BOx1WLJCph25B4ak3+dN
=N8FO
-----END PGP SIGNATURE-----
Subject: Re: some question about the directive GLOBAL in the source code.
From: feqin fan ####@####.####
Date: 16 Aug 2012 02:50:49 -0000
Message-Id: <CAOfAq_prYedFfHaXKn0LQD2XmZS938M1CNuprbv4NECE6ijksQ@mail.gmail.com>

because the symbol_table stTop have nothing about symbol "var", the source
line "global var" is first line executed by assembler.

all of this are my inferences.

:-)

THX..

2012/8/16 Holger Oehm ####@####.####

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 14.08.2012 12:35, feqin fan wrote:
> > 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,
>
> And why exactly should s be NULL after the assignment in line 7???
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAlAr48sACgkQHdk+97UOUanAAgCfYSdqul+vqfA3ARzB38GScQGT
> 8lUAoIVHttJ6BOx1WLJCph25B4ak3+dN
> =N8FO
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ####@####.####
> For additional commands, e-mail: ####@####.####
>
>
Subject: Re: some question about the directive GLOBAL in the source code.
From: Tamas Rudnai ####@####.####
Date: 17 Aug 2012 05:25:33 -0000
Message-Id: <CAJLb5+QNA0KUpgHUUUEDwPVRUOwC7hVaTetHHfCWgOiMSBnpUQ@mail.gmail.com>

The "global var" will never be "executed" as that is not an instruction but
a directive. But that is not important right now.

What is important that although I have never looked at the full source code
and therefore not sure what are those functions and macros doing there, but
following your logic in the comments, the "p will point to var" in line 5.
Now if var is unknown at that stage, then maybe p will be NULL, right? So
because of the condition at line 6, the compiler will never make it to the
line 7... Just my cents.

Tamas



On 15 August 2012 19:50, feqin fan ####@####.#### wrote:

> because the symbol_table stTop have nothing about symbol "var", the source
> line "global var" is first line executed by assembler.
>
> all of this are my inferences.
>
> :-)
>
> THX..
>
> 2012/8/16 Holger Oehm ####@####.####
>
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > On 14.08.2012 12:35, feqin fan wrote:
> > > 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,
> >
> > And why exactly should s be NULL after the assignment in line 7???
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.11 (GNU/Linux)
> > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> >
> > iEYEARECAAYFAlAr48sACgkQHdk+97UOUanAAgCfYSdqul+vqfA3ARzB38GScQGT
> > 8lUAoIVHttJ6BOx1WLJCph25B4ak3+dN
> > =N8FO
> > -----END PGP SIGNATURE-----
> >
> > ---------------------------------------------------------------------
> > 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); }
Subject: Re: some question about the directive GLOBAL in the source code.
From: feqin fan ####@####.####
Date: 17 Aug 2012 06:24:42 -0000
Message-Id: <CAOfAq_oRiZxMM1mCGwn2G_1032JJqZatgGLCTrFUAdvZ7MQyag@mail.gmail.com>

My english writing is poor, Maybe it misled you, Sorry , It’s my fault.



I’m here discussing the assembler source code’s behavior, Not CPU’s
behavior.

the directive “global var” must be executed by assembler.

and in line 5,the function maybe_evaluate_concat() does not to query symbol
table, it just do some macro process, and must be return the string “var”.


Thanks for you letter..

:-)



2012/8/17 Tamas Rudnai ####@####.####

> The "global var" will never be "executed" as that is not an instruction but
> a directive. But that is not important right now.
>
> What is important that although I have never looked at the full source code
> and therefore not sure what are those functions and macros doing there, but
> following your logic in the comments, the "p will point to var" in line 5.
> Now if var is unknown at that stage, then maybe p will be NULL, right? So
> because of the condition at line 6, the compiler will never make it to the
> line 7... Just my cents.
>
> Tamas
>
>
>
> On 15 August 2012 19:50, feqin fan ####@####.#### wrote:
>
> > because the symbol_table stTop have nothing about symbol "var", the
> source
> > line "global var" is first line executed by assembler.
> >
> > all of this are my inferences.
> >
> > :-)
> >
> > THX..
> >
> > 2012/8/16 Holger Oehm ####@####.####
> >
> > > -----BEGIN PGP SIGNED MESSAGE-----
> > > Hash: SHA1
> > >
> > > On 14.08.2012 12:35, feqin fan wrote:
> > > > 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,
> > >
> > > And why exactly should s be NULL after the assignment in line 7???
> > > -----BEGIN PGP SIGNATURE-----
> > > Version: GnuPG v1.4.11 (GNU/Linux)
> > > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> > >
> > > iEYEARECAAYFAlAr48sACgkQHdk+97UOUanAAgCfYSdqul+vqfA3ARzB38GScQGT
> > > 8lUAoIVHttJ6BOx1WLJCph25B4ak3+dN
> > > =N8FO
> > > -----END PGP SIGNATURE-----
> > >
> > > ---------------------------------------------------------------------
> > > 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); }
>
Subject: Re: some question about the directive GLOBAL in the source code.
From: Tamas Rudnai ####@####.####
Date: 17 Aug 2012 07:12:09 -0000
Message-Id: <CAJLb5+R-ueNq4HXk0phGh1Ln2VM=xKe3uGXbbsSqEcW0+kK4vg@mail.gmail.com>

No worries with your English :-) So you mean must be processed by the
assembler (compiler), right?

I think I got you. Are you claiming that the compiler is not working
properly and when a 'global' directive is used before declaring the
variable, it should create the symbol in the symbol table as opposed to
return with 'no symbol' ? In this case I think you are right.

How it works in gpuitls -- I do not know, I have not looked at the source
code yet. Hope someone is seeing this who does and can help you with
debugging the compiler's source.

Tamas




On 16 August 2012 23:24, feqin fan ####@####.#### wrote:

> My english writing is poor, Maybe it misled you, Sorry , It’s my fault.
>
>
>
> I’m here discussing the assembler source code’s behavior, Not CPU’s
> behavior.
>
> the directive “global var” must be executed by assembler.
>
> and in line 5,the function maybe_evaluate_concat() does not to query symbol
> table, it just do some macro process, and must be return the string “var”.
>
>
> Thanks for you letter..
>
> :-)
>
>
>
> 2012/8/17 Tamas Rudnai ####@####.####
>
> > The "global var" will never be "executed" as that is not an instruction
> but
> > a directive. But that is not important right now.
> >
> > What is important that although I have never looked at the full source
> code
> > and therefore not sure what are those functions and macros doing there,
> but
> > following your logic in the comments, the "p will point to var" in line
> 5.
> > Now if var is unknown at that stage, then maybe p will be NULL, right? So
> > because of the condition at line 6, the compiler will never make it to
> the
> > line 7... Just my cents.
> >
> > Tamas
> >
> >
> >
> > On 15 August 2012 19:50, feqin fan ####@####.#### wrote:
> >
> > > because the symbol_table stTop have nothing about symbol "var", the
> > source
> > > line "global var" is first line executed by assembler.
> > >
> > > all of this are my inferences.
> > >
> > > :-)
> > >
> > > THX..
> > >
> > > 2012/8/16 Holger Oehm ####@####.####
> > >
> > > > -----BEGIN PGP SIGNED MESSAGE-----
> > > > Hash: SHA1
> > > >
> > > > On 14.08.2012 12:35, feqin fan wrote:
> > > > > 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,
> > > >
> > > > And why exactly should s be NULL after the assignment in line 7???
> > > > -----BEGIN PGP SIGNATURE-----
> > > > Version: GnuPG v1.4.11 (GNU/Linux)
> > > > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> > > >
> > > > iEYEARECAAYFAlAr48sACgkQHdk+97UOUanAAgCfYSdqul+vqfA3ARzB38GScQGT
> > > > 8lUAoIVHttJ6BOx1WLJCph25B4ak3+dN
> > > > =N8FO
> > > > -----END PGP SIGNATURE-----
> > > >
> > > > ---------------------------------------------------------------------
> > > > 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); }
> >
>



-- 
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); }
Subject: Re: some question about the directive GLOBAL in the source code.
From: feqin fan ####@####.####
Date: 17 Aug 2012 11:37:16 -0000
Message-Id: <CAOfAq_rOnBbK3DRL3=TEup1NNWQGLeRzvP=N5RevwrUt-vEPzQ@mail.gmail.com>

THX..

:-)


2012/8/17 Tamas Rudnai ####@####.####

> No worries with your English :-) So you mean must be processed by the
> assembler (compiler), right?
>
> I think I got you. Are you claiming that the compiler is not working
> properly and when a 'global' directive is used before declaring the
> variable, it should create the symbol in the symbol table as opposed to
> return with 'no symbol' ? In this case I think you are right.
>
> How it works in gpuitls -- I do not know, I have not looked at the source
> code yet. Hope someone is seeing this who does and can help you with
> debugging the compiler's source.
>
> Tamas
>
>
>
>
> On 16 August 2012 23:24, feqin fan ####@####.#### wrote:
>
> > My english writing is poor, Maybe it misled you, Sorry , It’s my fault.
> >
> >
> >
> > I’m here discussing the assembler source code’s behavior, Not CPU’s
> > behavior.
> >
> > the directive “global var” must be executed by assembler.
> >
> > and in line 5,the function maybe_evaluate_concat() does not to query
> symbol
> > table, it just do some macro process, and must be return the string
> “var”.
> >
> >
> > Thanks for you letter..
> >
> > :-)
> >
> >
> >
> > 2012/8/17 Tamas Rudnai ####@####.####
> >
> > > The "global var" will never be "executed" as that is not an instruction
> > but
> > > a directive. But that is not important right now.
> > >
> > > What is important that although I have never looked at the full source
> > code
> > > and therefore not sure what are those functions and macros doing there,
> > but
> > > following your logic in the comments, the "p will point to var" in line
> > 5.
> > > Now if var is unknown at that stage, then maybe p will be NULL, right?
> So
> > > because of the condition at line 6, the compiler will never make it to
> > the
> > > line 7... Just my cents.
> > >
> > > Tamas
> > >
> > >
> > >
> > > On 15 August 2012 19:50, feqin fan ####@####.#### wrote:
> > >
> > > > because the symbol_table stTop have nothing about symbol "var", the
> > > source
> > > > line "global var" is first line executed by assembler.
> > > >
> > > > all of this are my inferences.
> > > >
> > > > :-)
> > > >
> > > > THX..
> > > >
> > > > 2012/8/16 Holger Oehm ####@####.####
> > > >
> > > > > -----BEGIN PGP SIGNED MESSAGE-----
> > > > > Hash: SHA1
> > > > >
> > > > > On 14.08.2012 12:35, feqin fan wrote:
> > > > > > 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,
> > > > >
> > > > > And why exactly should s be NULL after the assignment in line 7???
> > > > > -----BEGIN PGP SIGNATURE-----
> > > > > Version: GnuPG v1.4.11 (GNU/Linux)
> > > > > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> > > > >
> > > > > iEYEARECAAYFAlAr48sACgkQHdk+97UOUanAAgCfYSdqul+vqfA3ARzB38GScQGT
> > > > > 8lUAoIVHttJ6BOx1WLJCph25B4ak3+dN
> > > > > =N8FO
> > > > > -----END PGP SIGNATURE-----
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > 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); }
> > >
> >
>
>
>
> --
> 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); }
>
Subject: Re: some question about the directive GLOBAL in the source code.
From: Marko Kohtala ####@####.####
Date: 17 Aug 2012 18:53:20 -0000
Message-Id: <CAJ0yFazXHWg15ABL8di5LoC9H733c=R_K1PYkjQtpQwwr0i8zw@mail.gmail.com>

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..
>
Subject: Re: some question about the directive GLOBAL in the source code.
From: feqin fan ####@####.####
Date: 18 Aug 2012 01:15:32 -0000
Message-Id: <CAOfAq_pR5kNQkbG6dWG3XD8BwLFY=KzUm5Q=xcPk3RHRjh=g9g@mail.gmail.com>

(⊙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..
> >
>
Subject: Re: some question about the directive GLOBAL in the source code.
From: Marko Kohtala ####@####.####
Date: 18 Aug 2012 09:32:49 -0000
Message-Id: <CAJ0yFawboxH4XHmwLCnggJAf_WoFu_Kr_A7y+UiJhobrwQtd=g@mail.gmail.com>

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..
> > >
> >
>
[<<] [<] Page 1 of 2 [>] [>>]


Powered by ezmlm-browse 0.20.