Differences From Artifact [fa861b42bd4162aa]:
- File
jim.c
-
2008-06-15 21:03:26
- part of checkin
[abec96405a]
on branch trunk
-
* ChangeLog, jim.c, jim.h, jim-aio.c: Support for eCos.
(user: oharboe
-
2008-06-15 21:03:26
- part of checkin
[abec96405a]
on branch trunk
-
To Artifact [a8b39b2a5a3f432a]:
- File
jim.c
- 2008-06-16 14:03:10 - part of checkin [20a8db794c] on branch trunk - * ChangeLog, jim.c: fixed parsing in "expr 0x1234". (user: oharboe
1 1 /* Jim - A small embeddable Tcl interpreter
2 2 * Copyright 2005 Salvatore Sanfilippo <antirez@invece.org>
3 3 * Copyright 2005 Clemens Hintze <c.hintze@gmx.net>
4 4 *
5 - * $Id: jim.c,v 1.173 2008/06/15 21:03:26 oharboe Exp $
5 + * $Id: jim.c,v 1.174 2008/06/16 14:03:10 oharboe Exp $
6 6 *
7 7 * Licensed under the Apache License, Version 2.0 (the "License");
8 8 * you may not use this file except in compliance with the License.
9 9 * You may obtain a copy of the License at
10 10 *
11 11 * http://www.apache.org/licenses/LICENSE-2.0
12 12 *
................................................................................
5968 5968 }
5969 5969 return JIM_OK;
5970 5970 }
5971 5971
5972 5972 int JimParseExprNumber(struct JimParserCtx *pc)
5973 5973 {
5974 5974 int allowdot = 1;
5975 + int allowhex = 0;
5975 5976
5976 5977 pc->tstart = pc->p;
5977 5978 pc->tline = pc->linenr;
5978 5979 if (*pc->p == '-') {
5979 5980 pc->p++; pc->len--;
5980 5981 }
5981 - while (isdigit((int)*pc->p) || (allowdot && *pc->p == '.') ||
5982 - (pc->p-pc->tstart == 1 && *pc->tstart == '0' &&
5983 - (*pc->p == 'x' || *pc->p == 'X')))
5982 + while ( isdigit((int)*pc->p)
5983 + || (allowhex && isxdigit((int)*pc->p) )
5984 + || (allowdot && *pc->p == '.')
5985 + || (pc->p-pc->tstart == 1 && *pc->tstart == '0' &&
5986 + (*pc->p == 'x' || *pc->p == 'X'))
5987 + )
5984 5988 {
5989 + if ((*pc->p == 'x') || (*pc->p == 'X')) {
5990 + allowhex = 1;
5991 + allowdot = 0;
5992 + }
5985 5993 if (*pc->p == '.')
5986 5994 allowdot = 0;
5987 5995 pc->p++; pc->len--;
5988 5996 if (!allowdot && *pc->p == 'e' && *(pc->p+1) == '-') {
5989 5997 pc->p += 2; pc->len -= 2;
5990 5998 }
5991 5999 }
................................................................................
11766 11774 int retcode = JIM_OK;
11767 11775 Jim_Obj *scriptObjPtr;
11768 11776
11769 11777 fprintf(interp->stdout_, "Welcome to Jim version %d.%d, "
11770 11778 "Copyright (c) 2005 Salvatore Sanfilippo" JIM_NL,
11771 11779 JIM_VERSION / 100, JIM_VERSION % 100);
11772 11780 fprintf(interp->stdout_,
11773 - "CVS ID: $Id: jim.c,v 1.173 2008/06/15 21:03:26 oharboe Exp $"
11781 + "CVS ID: $Id: jim.c,v 1.174 2008/06/16 14:03:10 oharboe Exp $"
11774 11782 JIM_NL);
11775 11783 Jim_SetVariableStrWithStr(interp, "jim_interactive", "1");
11776 11784 while (1) {
11777 11785 char buf[1024];
11778 11786 const char *result;
11779 11787 const char *retcodestr[] = {
11780 11788 "ok", "error", "return", "break", "continue", "eval", "exit"