diff options
Diffstat (limited to '')
| -rw-r--r-- | opcode.c | 9 |
1 files changed, 4 insertions, 5 deletions
| @@ -3,7 +3,7 @@ | |||
| 3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | char *rcs_opcode="$Id: opcode.c,v 2.6 1994/09/08 16:51:49 celes Exp $"; | 6 | char *rcs_opcode="$Id: opcode.c,v 2.7 1994/09/20 15:11:11 celes Exp celes $"; |
| 7 | 7 | ||
| 8 | #include <stdio.h> | 8 | #include <stdio.h> |
| 9 | #include <stdlib.h> | 9 | #include <stdlib.h> |
| @@ -92,10 +92,9 @@ static char *lua_strconc (char *l, char *r) | |||
| 92 | 92 | ||
| 93 | static int ToReal (char* s, float* f) | 93 | static int ToReal (char* s, float* f) |
| 94 | { | 94 | { |
| 95 | int n; | 95 | char c; |
| 96 | float t; | 96 | float t; |
| 97 | sscanf(s,"%f %n",&t,&n); | 97 | if (sscanf(s,"%f %c",&t,&c) == 1) { *f=t; return 1; } else return 0; |
| 98 | if (s[n]==0) { *f=t; return 1; } else return 0; | ||
| 99 | } | 98 | } |
| 100 | 99 | ||
| 101 | /* | 100 | /* |
| @@ -132,7 +131,7 @@ static Object *lua_convtonumber (Object *obj) | |||
| 132 | return &cvt; | 131 | return &cvt; |
| 133 | } | 132 | } |
| 134 | 133 | ||
| 135 | if (tag(obj) == T_STRING && ToReal(svalue(obj), &nvalue(obj))) | 134 | if (tag(obj) == T_STRING && ToReal(svalue(obj), &nvalue(&cvt))) |
| 136 | tag(&cvt) = T_NUMBER; | 135 | tag(&cvt) = T_NUMBER; |
| 137 | else | 136 | else |
| 138 | tag(&cvt) = T_NIL; | 137 | tag(&cvt) = T_NIL; |
