Search the web
Sign In
New User? Sign Up
wcalc · Wcalc Users
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
\eng segmentation fault   Message List  
Reply | Forward Message #104 of 114 |
Re: [wcalc] \eng segmentation fault

On Monday, February 4 at 10:15 AM, quoth Daniele:
>Hi,
>when wcalc starts and I type twice \eng it crashes:
>
>Enter an expression to evaluate, q to quit, or ? for help:
>-> \eng
>Engineering notation is enabled
> = 0
>-> \eng
>Segmentation Fault

Ahh, I see the error. Attached is the patch to fix it. I've committed
the fix to CVS, and also added a few more bits to be a little more
careful in other places where wcalc does something similar.

~Kyle
--
You never truly understand a thing until you can explain it to your
grandmother.
-- Albert Einstein


Mon Feb 4, 2008 8:02 pm

m3m0ryh0l3
Offline Offline
Send Email Send Email

Index: scanner.l
===================================================================
RCS file: /cvsroot/w-calc/Wcalc/scanner.l,v
retrieving revision 1.93
diff -u -3 -p -r1.93 scanner.l
--- scanner.l 5 Dec 2007 18:07:03 -0000 1.93
+++ scanner.l 4 Feb 2008 19:58:20 -0000
@@ -97,9 +97,12 @@ SPACE [ ]
}
\\e(ng(ineering)?)?{WHITESPACE}*{DIGIT}* {
int i = 2;
- while (! isdigit((int)(yytext[i]))) ++i;
- if (yytext[i] != 0) YYLVALAC->integer = strtoul(yytext+i, NULL, 0);
- else YYLVALAC->integer = -1;
+ while (yytext[i] != 0 && ! isdigit((int)(yytext[i]))) ++i;
+ if (yytext[i] != 0 && yytext[i] != '\n') {
+ YYLVALAC->integer = strtoul(yytext+i, NULL, 0);
+ } else {
+ YYLVALAC->integer = -1;
+ }
line_is_a_command = 1;
POS_STR();
return(ENG_CMD);


Attachment
attachment
Type:
application/pgp-signature
Forward
Message #104 of 114 |
Expand Messages Author Sort by Date

Hi, when wcalc starts and I type twice \eng it crashes: Enter an expression to evaluate, q to quit, or ? for help: -> \eng Engineering notation is enabled = 0 ...
Daniele
scrows@...
Send Email
Feb 4, 2008
8:48 am

more on \eng: Enter an expression to evaluate, q to quit, or ? for help: -> 10^-2.63 = 0.00234423 -> \e Engineering notation is enabled = 0.00234423 ->...
Daniele
scrows@...
Send Email
Feb 4, 2008
9:08 am

... The previous fix I posted fixes the toggle between enabled and disabled. As for converting to engineering notation, it does not (currently) do anything...
Kyle Wheeler
m3m0ryh0l3
Offline Send Email
Feb 4, 2008
8:26 pm

... I agree, I think this would be nice. Cheers, Daniele...
Daniele
scrows@...
Send Email
Feb 5, 2008
8:10 pm

... Committed to CVS. The logic for some of the output formatting gets kinda convoluted, so if someone could test it for me (it seems to work right to me),...
Kyle Wheeler
m3m0ryh0l3
Offline Send Email
Feb 8, 2008
7:43 pm

... Ahh, I see the error. Attached is the patch to fix it. I've committed the fix to CVS, and also added a few more bits to be a little more careful in other...
Kyle Wheeler
m3m0ryh0l3
Offline Send Email
Feb 4, 2008
8:02 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help