Bugs item #1711240, was opened at 2007-05-02 14:27
Message generated for change (Comment added) made by helly
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=616200&aid=1711240&group_id=96864

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Marcus Börger (helly)
Summary: problem with '"' and 7F on EBCDIC plattforms

Initial Comment:
Hello Peter,

first on:
   I only recently discovered re2c in the web. It's a great tool that provides
   all the things I've been missing when using flex.
I found out a little problem when using the generated code on ebcdic-platforms.

re2c produces the following code in a switch-statement:
switch(yych)
   {
    ...
    case '"':
    ...
    case 0x07F:
    ...
   }

this code can not be compiled on EBCDIC-platforms, because there the
code of '"' is actually 0x07F. So the compiler complains about duplicate
case-labels.
I temporarily fixed the problem in my version of re2c by changing prtChOrHex in
dfa.cc so that it always prints only the Hex-Value like:

void prtChOrHex(std::ostream& o, uint c, bool useTalx)
{
 int oc = (int)(re2c::wFlag || !useTalx ? c : re2c::talx[c]);
//
//  if ((oc < 256) && isprint(oc))
//  {
//      o << '\'';
//      prtCh(o, oc);
//      o << '\'';
//  }
//  else
   {
       prtHex(o, c);
   }
}

Now it is compiling and the result of the code-genration should accept the same 
expressions.

Many Greetings
   Thomas

[EMAIL PROTECTED]

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

>Comment By: Marcus Börger (helly)
Date: 2007-05-03 13:26

Message:
Logged In: YES 
user_id=271023
Originator: NO

Manual verification successful. If you have any additional issues please
report them. However I would like to have more testcases. If you could
provide any please send them directly to me.

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

Comment By: Marcus Börger (helly)
Date: 2007-05-02 22:48

Message:
Logged In: YES 
user_id=271023
Originator: NO

Oops, forgot tosay that the .c was generated using switches -e -i and -s.

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

Comment By: Marcus Börger (helly)
Date: 2007-05-02 22:39

Message:
Logged In: YES 
user_id=271023
Originator: NO

Please apply the patch or download either 0.12.1 or head from subversion.
Then grap the testfile 'bug1711240.eis.re' and verify itagainst the
expected result 'bug1711240.eis.c'. Actually thismeansyou should verify
that the output is correct.

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

Comment By: Marcus Börger (helly)
Date: 2007-05-02 22:35

Message:
Logged In: YES 
user_id=271023
Originator: NO

File Added: bug1711240.eis.c

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

Comment By: Marcus Börger (helly)
Date: 2007-05-02 22:34

Message:
Logged In: YES 
user_id=271023
Originator: NO

File Added: bug1711240.eis.re

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

Comment By: Marcus Börger (helly)
Date: 2007-05-02 18:21

Message:
Logged In: YES 
user_id=271023
Originator: NO

On a quick look without verification it looks that the code indeed is
wrong. However your fix is wrong as well. The function in question should
look like this:
void prtChOrHex(std::ostream& o, uint c, bool useTalx)
{
        int oc = (int)(re2c::wFlag || !useTalx ? c : re2c::talx[c]);

        if ((oc < 256) && isprint(oc))
        {
                o << '\'';
                prtCh(o, oc);
                o << '\'';
        }
        else
        {
                prtHex(o, c);
        }
}

That is the the following diff:
--- dfa.cc      2007-04-16 23:22:28.000000000 +0200
+++ dfa.cc.new  2007-05-02 18:12:18.000000000 +0200
@@ -15,7 +15,7 @@
        if ((oc < 256) && isprint(oc))
        {
                o << '\'';
-               prtCh(o, oc);
+               prtCh(o, c);
                o << '\'';
        }
        else

See attached diff file (against 0.12.0) and try it please.
File Added: dfa.cc.diff.txt

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

Comment By: Marcus Börger (helly)
Date: 2007-05-02 17:52

Message:
Logged In: YES 
user_id=271023
Originator: NO

To be able to help you with your bug i would need to get a reproducing .re
file. Also I'd like to know if you used the -e switch for the generation or
not. The best thing would be if you could generate some small test cases
along with expected correct results. Those we could add to the test
system.

marcus

p.s.: There is no Peter here. He started the tool and left it several
years ago unmaintained.

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=616200&aid=1711240&group_id=96864

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Re2c-general mailing list
Re2c-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/re2c-general

Reply via email to