Only in sdcc_2.9.0/as/link: getline.c
Only in sdcc_2.9.0/as/link: getline.h
diff -ruP sdcc_2.9.0/as/link/hc08/Makefile.in sdcc_2.9.0_new/as/link/hc08/Makefile.in
--- sdcc_2.9.0/as/link/hc08/Makefile.in 2009-01-10 00:04:14.000000000 +0100
+++ sdcc_2.9.0_new/as/link/hc08/Makefile.in 2009-05-03 09:33:59.920935155 +0200
@@ -46,7 +46,7 @@
ASXXLIBSRC = strcmpi.c
-LKLIBSRC = getline.c lkaomf51.c lkar.c lkdata.c lkeval.c \
+LKLIBSRC = lk_readnl.c lkaomf51.c lkar.c lkdata.c lkeval.c \
lkhead.c lklex.c lklib.c lklibr.c lklist.c \
lknoice.c lkrel.c lksdcclib.c lkstore.c lksym.c
diff -ruP sdcc_2.9.0/as/link/lklib.c sdcc_2.9.0_new/as/link/lklib.c
--- sdcc_2.9.0/as/link/lklib.c 2009-02-05 23:15:19.000000000 +0100
+++ sdcc_2.9.0_new/as/link/lklib.c 2009-05-03 09:33:53.032847214 +0200
@@ -31,7 +31,7 @@
#include <string.h>
-#include "getline.h"
+#include "lk_readnl.h"
#include "aslink.h"
#include "lklibr.h"
#include "lkrel.h"
@@ -51,7 +51,7 @@
{
char relfil[NINPUT];
- while (getline (relfil, sizeof (relfil), libfp) != NULL)
+ while (lk_readnl (relfil, sizeof (relfil), libfp) != NULL)
{
FILE *fp;
char str[PATH_MAX];
@@ -126,7 +126,7 @@
D ("Searching symbol: %s\n", name);
- while (getline (relfil, sizeof (relfil), libfp) != NULL)
+ while (lk_readnl (relfil, sizeof (relfil), libfp) != NULL)
{
char str[PATH_MAX];
FILE *fp;
@@ -206,7 +206,7 @@
*
* functions called:
* int fclose() c_library
- * char *getline() getline.c
+ * char *lk_readnl() lk_readnl.c
* FILE * fopen() c_library
* VOID link_main() lkmain.c
* int strlen() c_library
diff -ruP sdcc_2.9.0/as/link/lk_readnl.c sdcc_2.9.0_new/as/link/lk_readnl.c
--- sdcc_2.9.0/as/link/lk_readnl.c 1970-01-01 01:00:00.000000000 +0100
+++ sdcc_2.9.0_new/as/link/lk_readnl.c 2009-05-03 09:31:37.874839633 +0200
@@ -0,0 +1,93 @@
+/*
+ lk_readnl.c - read a line from file into a buffer
+ version 1.0.0, April 25th, 2008
+
+ Copyright (c) 2008 Borut Razem
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ Borut Razem
+ borut.razem@siol.net
+*/
+
+#include "lk_readnl.h"
+
+/*******************************************************************************
+
+ lk_readnl
+
+lk_readnl() reads in at most one less than size characters from stream and stores
+them into the buffer pointed to by s. Reading stops after an EOF or a newline.
+The newline character is not stored into the buffer. A '\0' is stored after the
+last character in the buffer. All the characters between size and the newline or
+EOF are skipped.
+
+lk_readnl() return s on success, and NULL on error or when end of file occurs
+while no characters have been read.
+
+*******************************************************************************/
+
+char *
+lk_readnl (char *s, int size, FILE * stream)
+{
+ static char eof_f = 0;
+ int c = '\0';
+ char *s_o;
+ char prev_c;
+
+ if (eof_f)
+ {
+ eof_f = 0;
+ return NULL;
+ }
+
+ s_o = s;
+ --size; /* for null terminator */
+ while (size > 0)
+ {
+ prev_c = c;
+ if ((c = getc (stream)) == '\n' || c == EOF)
+ break;
+
+ if (prev_c == '\r')
+ {
+ *s++ = prev_c;
+ if (--size <= 0)
+ break;
+ }
+
+ if (c != '\r')
+ {
+ *s++ = c;
+ --size;
+ }
+ }
+ *s = '\0';
+
+ while (c != '\n' && c != EOF)
+ c = getc (stream);
+
+ if (c == EOF)
+ {
+ if (s == s_o)
+ return NULL;
+
+ eof_f = 1;
+ }
+
+ return s_o;
+}
diff -ruP sdcc_2.9.0/as/link/lk_readnl.h sdcc_2.9.0_new/as/link/lk_readnl.h
--- sdcc_2.9.0/as/link/lk_readnl.h 1970-01-01 01:00:00.000000000 +0100
+++ sdcc_2.9.0_new/as/link/lk_readnl.h 2009-05-03 09:31:32.383875928 +0200
@@ -0,0 +1,44 @@
+/*
+ lk_readnl.h - read a line from file into a buffer
+ version 1.0.0, Aprile 25th, 2008
+
+ Copyright (c) 2008 Borut Razem
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ Borut Razem
+ borut.razem@siol.net
+*/
+
+
+#ifndef __LK_READNL_H
+#define __LK_READNL_H
+
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ char *lk_readnl (char *s, int size, FILE * stream);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __LK_READNL_H */
diff -ruP sdcc_2.9.0/as/link/lkrel.c sdcc_2.9.0_new/as/link/lkrel.c
--- sdcc_2.9.0/as/link/lkrel.c 2009-02-05 23:15:19.000000000 +0100
+++ sdcc_2.9.0_new/as/link/lkrel.c 2009-05-03 09:34:27.455805185 +0200
@@ -32,7 +32,7 @@
#include <string.h>
#include <assert.h>
-#include "getline.h"
+#include "lk_readnl.h"
#include "aslink.h"
#include "lkrel.h"
@@ -79,7 +79,7 @@
end = (size >= 0) ? ftell (libfp) + size : -1;
- while ((end < 0 || ftell (libfp) < end) && getline (str, sizeof (str), libfp) != NULL)
+ while ((end < 0 || ftell (libfp) < end) && lk_readnl (str, sizeof (str), libfp) != NULL)
{
if (0 == strcmp (str, "</REL>"))
return 1;
@@ -110,7 +110,7 @@
* our object file and don't go into the next one.
*/
- while ((end < 0 || ftell (fp) < end) && getline (buf, sizeof (buf), fp) != NULL)
+ while ((end < 0 || ftell (fp) < end) && lk_readnl (buf, sizeof (buf), fp) != NULL)
{
char symname[NINPUT];
char c;
diff -ruP sdcc_2.9.0/as/link/lksdcclib.c sdcc_2.9.0_new/as/link/lksdcclib.c
--- sdcc_2.9.0/as/link/lksdcclib.c 2009-02-05 23:15:19.000000000 +0100
+++ sdcc_2.9.0_new/as/link/lksdcclib.c 2009-05-03 09:35:29.888085514 +0200
@@ -32,13 +32,13 @@
#include <stdlib.h>
#include <string.h>
-#include "getline.h"
+#include "lk_readnl.h"
#include "aslink.h"
#include "lklibr.h"
#include "lkrel.h"
#define EQ(A,B) !strcmp((A),(B))
-#define MAXLINE 254 /*when using getline */
+#define MAXLINE 254 /* when using lk_readnl */
static int
@@ -72,14 +72,14 @@
char str[NINPUT];
int state = 0;
- while (getline (str, sizeof (str), libfp) != NULL)
+ while (lk_readnl (str, sizeof (str), libfp) != NULL)
{
switch (state)
{
case 0:
if (EQ (str, "<FILE>"))
{
- if (NULL != getline (str, sizeof (str), libfp) && EQ (str, ModName))
+ if (NULL != lk_readnl (str, sizeof (str), libfp) && EQ (str, ModName))
state = 1;
else
return 0;
@@ -105,7 +105,7 @@
long IndexOffset = 0;
pmlibrarysymbol ThisSym = NULL;
- while (getline (FLine, sizeof (FLine), libfp))
+ while (lk_readnl (FLine, sizeof (FLine), libfp))
{
switch (state)
{
@@ -113,7 +113,7 @@
if (EQ (FLine, "<INDEX>"))
{
/*The next line has the size of the index */
- getline (FLine, sizeof (FLine), libfp);
+ lk_readnl (FLine, sizeof (FLine), libfp);
IndexOffset = atol (FLine);
state = 1;
}
@@ -128,7 +128,7 @@
/* The next line has the name of the module and the offset
of the corresponding embedded file in the library */
- getline (FLine, sizeof (FLine), libfp);
+ lk_readnl (FLine, sizeof (FLine), libfp);
sscanf (FLine, "%s %ld", ModName, &FileOffset);
state = 2;
@@ -205,7 +205,7 @@
int state = 0;
int ret = 0;
- while (getline (str, sizeof (str), libfp) != NULL)
+ while (lk_readnl (str, sizeof (str), libfp) != NULL)
{
switch (state)
{
@@ -239,7 +239,7 @@
int state = 0;
long IndexOffset = 0, FileOffset;
- while (getline (FLine, sizeof (FLine), libfp))
+ while (lk_readnl (FLine, sizeof (FLine), libfp))
{
char filspc[PATH_MAX];
@@ -260,7 +260,7 @@
if (EQ (FLine, "<INDEX>"))
{
/* The next line has the size of the index */
- getline (FLine, sizeof (FLine), libfp);
+ lk_readnl (FLine, sizeof (FLine), libfp);
IndexOffset = atol (FLine);
state = 1;
}
@@ -271,7 +271,7 @@
{
/* The next line has the name of the module and the offset
of the corresponding embedded file in the library */
- getline (FLine, sizeof (FLine), libfp);
+ lk_readnl (FLine, sizeof (FLine), libfp);
sscanf (FLine, "%s %ld", ModName, &FileOffset);
state = 2;
}
diff -ruP sdcc_2.9.0/as/link/mcs51/Makefile.in sdcc_2.9.0_new/as/link/mcs51/Makefile.in
--- sdcc_2.9.0/as/link/mcs51/Makefile.in 2009-01-10 00:04:14.000000000 +0100
+++ sdcc_2.9.0_new/as/link/mcs51/Makefile.in 2009-05-03 09:33:58.180806351 +0200
@@ -46,7 +46,7 @@
ASXXLIBSRC = strcmpi.c
-LKLIBSRC = getline.c lkaomf51.c lkar.c lkdata.c lkeval.c \
+LKLIBSRC = lk_readnl.c lkaomf51.c lkar.c lkdata.c lkeval.c \
lkhead.c lklex.c lklib.c lklibr.c lklist.c \
lknoice.c lkrel.c lksdcclib.c lkstore.c lksym.c
diff -ruP sdcc_2.9.0/as/link/z80/Makefile.in sdcc_2.9.0_new/as/link/z80/Makefile.in
--- sdcc_2.9.0/as/link/z80/Makefile.in 2009-01-10 00:04:14.000000000 +0100
+++ sdcc_2.9.0_new/as/link/z80/Makefile.in 2009-05-03 09:33:56.000806236 +0200
@@ -13,7 +13,7 @@
LKLIB = $(srcdir)/..
-LKLIBSRC = getline.c lkaomf51.c lkar.c lkdata.c lkeval.c \
+LKLIBSRC = lk_readnl.c lkaomf51.c lkar.c lkdata.c lkeval.c \
lkhead.c lklex.c lklib.c lklibr.c lklist.c \
lknoice.c lkrel.c lksdcclib.c lkstore.c lksym.c
diff -ruP sdcc_2.9.0/ChangeLog sdcc_2.9.0_new/ChangeLog
--- sdcc_2.9.0/ChangeLog 2009-03-15 14:30:34.000000000 +0100
+++ sdcc_2.9.0_new/ChangeLog 2009-05-03 14:22:47.139942135 +0200
@@ -1,3 +1,35 @@
+2009-05-03 Borut Razem <borut.razem AT siol.net>
+
+ * as/link/hc08/Makefile.in, as/link/mcs51/Makefile.in,
+ as/link/z80/Makefile.in, as/link/lk_readnl.c, as/link/lklib.c,
+ as/link/lk_readnl.h, as/link/lk_readnl.h, as/link/lkrel.c,
+ as/link/lksdcclib.c: getline renamed to lk_readln to prevent
+ conflicts with Fedora 11 glibc-2.9.90-19 getline
+
+2009-04-28 Borut Razem <borut.razem AT siol.net>
+
+ * fixed GCC 4.4.0 mingw compilation:
+ sim/ucsim/cmd.src/cmdlex.cc: regenerated - added #include <stdio.h>
+ * src/SDCCsymt.c: fixed warning:
+ suggest parentheses around operand of '!' or change '&' to '&&' or
+ '!' to '~'
+ * support/scripts/sdcc_mingw32: sync with sdcc-build
+
+2009-04-27 Borut Razem <borut.razem AT siol.net>
+
+ * fixed GCC 4.4.0 mingw compilation:
+ * sim/ucsim/cmd.src/cmdlex.l: added #include <stdio.h>
+ * support/cpp/sdcpp-opts.c: fixed warning:
+ unknown conversion type character 'm' in format,
+ use strerror(errno) instead of %m glibc extension format specifier
+ * src/SDCCsymt.c: fixed warning:
+ suggest parentheses around operand of '!' or change '&' to '&&' or
+ '!' to '~'
+ * src/pic16/pcode.c, src/pic16/glue.c: fixed warning:
+ unknown conversion type character 'h' in format,
+ replaced hh printf format specifier with parameter casting to
+ unsigned char
+
2009-03-15 Borut Razem <borut.razem AT siol.net>
* support/scripts/repack_release.sh: added
diff -ruP sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.cc sdcc_2.9.0_new/sim/ucsim/cmd.src/cmdlex.cc
--- sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.cc 2004-07-16 18:32:30.000000000 +0200
+++ sdcc_2.9.0_new/sim/ucsim/cmd.src/cmdlex.cc 2009-05-03 09:56:34.837824283 +0200
@@ -1,6 +1,6 @@
-#line 2 "cmdlex.cc"
+#line 2 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.cc"
-#line 4 "cmdlex.cc"
+#line 4 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.cc"
#define YY_INT_ALIGNED short int
@@ -9,13 +9,16 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 31
+#define YY_FLEX_SUBMINOR_VERSION 35
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
/* The c++ scanner is a mess. The FlexLexer.h header file relies on the
- * following macro.
+ * following macro. This is required in order to pass the c++-multiple-scanners
+ * test in the regression suite. We get reports that it breaks inheritance.
+ * We will address this in a future release of flex, or omit the C++ scanner
+ * altogether.
*/
#define yyFlexLexer yyFlexLexer
@@ -32,7 +35,15 @@
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
-#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types.
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
#include <inttypes.h>
typedef int8_t flex_int8_t;
typedef uint8_t flex_uint8_t;
@@ -83,6 +94,7 @@
/* begin standard C++ headers. */
#include <iostream>
#include <errno.h>
+#include <cstdio>
#include <cstdlib>
#include <cstring>
/* end standard C++ headers. */
@@ -94,11 +106,12 @@
#else /* ! __cplusplus */
-#if __STDC__
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
#define YY_USE_CONST
-#endif /* __STDC__ */
+#endif /* defined (__STDC__) */
#endif /* ! __cplusplus */
#ifdef YY_USE_CONST
@@ -143,6 +156,10 @@
#define YY_BUF_SIZE 16384
#endif
+/* The state buf must be large enough to hold one state per character in the main buffer.
+ */
+#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
#define YY_TYPEDEF_YY_BUFFER_STATE
typedef struct yy_buffer_state *YY_BUFFER_STATE;
@@ -172,14 +189,9 @@
#define unput(c) yyunput( c, (yytext_ptr) )
-/* The following is because we cannot portably get our hands on size_t
- * (without autoconf's help, which isn't available because we want
- * flex-generated scanners to compile on their own).
- */
-
#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
-typedef unsigned int yy_size_t;
+typedef size_t yy_size_t;
#endif
#ifndef YY_STRUCT_YY_BUFFER_STATE
@@ -405,8 +417,9 @@
#define yymore() yymore_used_but_not_detected
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
-#line 1 "cmdlex.l"
-#line 2 "cmdlex.l"
+#line 1 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.l"
+#line 2 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.l"
+#include <stdio.h>
#include "cmdlexcl.h"
#include "cmdpars.h"
@@ -417,7 +430,7 @@
#define tok(x) (YY_cl_ucsim_parser_CLASS::x)
#define lexer_obj (dynamic_cast<class cl_ucsim_lexer *>(this))
-#line 421 "cmdlex.cc"
+#line 434 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.cc"
#define INITIAL 0
@@ -517,14 +530,14 @@
register char *yy_cp, *yy_bp;
register int yy_act;
-#line 14 "cmdlex.l"
+#line 15 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.l"
-#line 524 "cmdlex.cc"
+#line 537 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.cc"
- if ( (yy_init) )
+ if ( !(yy_init) )
{
- (yy_init) = 0;
+ (yy_init) = 1;
#ifdef YY_USER_INIT
YY_USER_INIT;
@@ -605,67 +618,67 @@
case 1:
YY_RULE_SETUP
-#line 16 "cmdlex.l"
+#line 17 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.l"
;
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 18 "cmdlex.l"
+#line 19 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.l"
return(tok(PTOK_PLUS));
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 19 "cmdlex.l"
+#line 20 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.l"
return(tok(PTOK_MINUS));
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 20 "cmdlex.l"
+#line 21 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.l"
return(tok(PTOK_ASTERIX));
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 21 "cmdlex.l"
+#line 22 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.l"
return(tok(PTOK_SLASH));
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 22 "cmdlex.l"
+#line 23 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.l"
return(tok(PTOK_LEFT_PAREN));
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 23 "cmdlex.l"
+#line 24 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.l"
return(tok(PTOK_RIGHT_PAREN));
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 24 "cmdlex.l"
+#line 25 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.l"
return(tok(PTOK_LEFT_BRACKET));
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 25 "cmdlex.l"
+#line 26 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.l"
return(tok(PTOK_RIGHT_BRACKET));
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 26 "cmdlex.l"
+#line 27 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.l"
return(tok(PTOK_EQUAL));
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 27 "cmdlex.l"
+#line 28 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.l"
return(tok(PTOK_DOT));
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 28 "cmdlex.l"
+#line 29 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.l"
return(tok(PTOK_AMPERSAND));
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 30 "cmdlex.l"
+#line 31 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.l"
{
yylval->number= strtol(yytext, 0, 0);
return(YY_cl_ucsim_parser_CLASS::PTOK_NUMBER);
@@ -673,20 +686,20 @@
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 35 "cmdlex.l"
+#line 36 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.l"
return(lexer_obj->check_id(yytext));
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 37 "cmdlex.l"
+#line 38 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.l"
;
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 39 "cmdlex.l"
+#line 40 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.l"
ECHO;
YY_BREAK
-#line 690 "cmdlex.cc"
+#line 703 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.cc"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -819,12 +832,14 @@
} /* end of scanning one token */
} /* end of yylex */
+/* The contents of this function are C++ specific, so the () macro is not used.
+ */
yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
{
yyin = arg_yyin;
yyout = arg_yyout;
yy_c_buf_p = 0;
- yy_init = 1;
+ yy_init = 0;
yy_start = 0;
yy_flex_debug = 0;
yylineno = 1; // this will only get updated if %option yylineno
@@ -837,23 +852,28 @@
yy_more_offset = yy_prev_more_offset = 0;
yy_start_stack_ptr = yy_start_stack_depth = 0;
- yy_start_stack = 0;
+ yy_start_stack = NULL;
- (yy_buffer_stack) = 0;
- (yy_buffer_stack_top) = 0;
- (yy_buffer_stack_max) = 0;
+ yy_buffer_stack = 0;
+ yy_buffer_stack_top = 0;
+ yy_buffer_stack_max = 0;
yy_state_buf = 0;
}
+/* The contents of this function are C++ specific, so the () macro is not used.
+ */
yyFlexLexer::~yyFlexLexer()
{
delete [] yy_state_buf;
yyfree(yy_start_stack );
yy_delete_buffer( YY_CURRENT_BUFFER );
+ yyfree(yy_buffer_stack );
}
+/* The contents of this function are C++ specific, so the () macro is not used.
+ */
void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
{
if ( new_in )
@@ -954,7 +974,7 @@
else
{
- size_t num_to_read =
+ int num_to_read =
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
while ( num_to_read <= 0 )
@@ -999,7 +1019,7 @@
/* Read in more data. */
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
- (yy_n_chars), num_to_read );
+ (yy_n_chars), (size_t) num_to_read );
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
}
@@ -1023,6 +1043,14 @@
else
ret_val = EOB_ACT_CONTINUE_SCAN;
+ if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+ /* Extend the array by 50%, plus the number we really need. */
+ yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
+ if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+ }
+
(yy_n_chars) += number_to_move;
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
@@ -1428,7 +1456,9 @@
(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
(num_to_alloc * sizeof(struct yy_buffer_state*)
);
-
+ if ( ! (yy_buffer_stack) )
+ YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
(yy_buffer_stack_max) = num_to_alloc;
@@ -1446,6 +1476,8 @@
((yy_buffer_stack),
num_to_alloc * sizeof(struct yy_buffer_state*)
);
+ if ( ! (yy_buffer_stack) )
+ YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
/* zero only the new slots.*/
memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
@@ -1469,8 +1501,7 @@
(yy_start_stack) = (int *) yyrealloc((void *) (yy_start_stack),new_size );
if ( ! (yy_start_stack) )
- YY_FATAL_ERROR(
- "out of memory expanding start-condition stack" );
+ YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
}
(yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
@@ -1528,7 +1559,7 @@
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
{
register int i;
- for ( i = 0; i < n; ++i )
+ for ( i = 0; i < n; ++i )
s1[i] = s2[i];
}
#endif
@@ -1537,7 +1568,7 @@
static int yy_flex_strlen (yyconst char * s )
{
register int n;
- for ( n = 0; s[n]; ++n )
+ for ( n = 0; s[n]; ++n )
;
return n;
@@ -1568,19 +1599,7 @@
#define YYTABLES_NAME "yytables"
-#undef YY_NEW_FILE
-#undef YY_FLUSH_BUFFER
-#undef yy_set_bol
-#undef yy_new_buffer
-#undef yy_set_interactive
-#undef yytext_ptr
-#undef YY_DO_BEFORE_ACTION
-
-#ifdef YY_DECL_IS_OURS
-#undef YY_DECL_IS_OURS
-#undef YY_DECL
-#endif
-#line 39 "cmdlex.l"
+#line 40 "../../../../sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.l"
diff -ruP sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.l sdcc_2.9.0_new/sim/ucsim/cmd.src/cmdlex.l
--- sdcc_2.9.0/sim/ucsim/cmd.src/cmdlex.l 2004-07-16 18:32:30.000000000 +0200
+++ sdcc_2.9.0_new/sim/ucsim/cmd.src/cmdlex.l 2009-05-03 09:48:14.354802912 +0200
@@ -1,4 +1,5 @@
%{
+#include <stdio.h>
#include "cmdlexcl.h"
#include "cmdpars.h"
diff -ruP sdcc_2.9.0/src/pic16/glue.c sdcc_2.9.0_new/src/pic16/glue.c
--- sdcc_2.9.0/src/pic16/glue.c 2008-12-07 00:31:13.000000000 +0100
+++ sdcc_2.9.0_new/src/pic16/glue.c 2009-05-03 13:50:18.000000000 +0200
@@ -1399,9 +1399,9 @@
for(i=0;i<=(pic16->cwInfo.confAddrEnd-pic16->cwInfo.confAddrStart);i++)
if(pic16->cwInfo.crInfo[i].emit) //mask != -1)
- fprintf (of, "\t__config 0x%x, 0x%hhx\n",
+ fprintf (of, "\t__config 0x%x, 0x%02x\n",
pic16->cwInfo.confAddrStart+i,
- pic16->cwInfo.crInfo[i].value);
+ (unsigned char) pic16->cwInfo.crInfo[i].value);
}
void pic16_emitIDRegs(FILE *of)
@@ -1410,9 +1410,9 @@
for(i=0;i<=(pic16->idInfo.idAddrEnd-pic16->idInfo.idAddrStart);i++)
if(pic16->idInfo.irInfo[i].emit)
- fprintf (of, "\t__idlocs 0x%06x, 0x%hhx\n",
+ fprintf (of, "\t__idlocs 0x%06x, 0x%02x\n",
pic16->idInfo.idAddrStart+i,
- pic16->idInfo.irInfo[i].value);
+ (unsigned char) pic16->idInfo.irInfo[i].value);
}
diff -ruP sdcc_2.9.0/src/pic16/pcode.c sdcc_2.9.0_new/src/pic16/pcode.c
--- sdcc_2.9.0/src/pic16/pcode.c 2009-03-10 02:29:02.000000000 +0100
+++ sdcc_2.9.0_new/src/pic16/pcode.c 2009-05-03 13:50:18.000000000 +0200
@@ -3977,7 +3977,7 @@
pcop->name = NULL;
//if(lit>=0)
- sprintf(s,"0x%02hhx", (unsigned char)lit);
+ sprintf(s,"0x%02x", (unsigned char) lit);
//else
// sprintf(s, "%i", lit);
diff -ruP sdcc_2.9.0/src/SDCCsymt.c sdcc_2.9.0_new/src/SDCCsymt.c
--- sdcc_2.9.0/src/SDCCsymt.c 2008-11-15 15:13:47.000000000 +0100
+++ sdcc_2.9.0_new/src/SDCCsymt.c 2009-05-03 13:50:32.000000000 +0200
@@ -2324,7 +2324,7 @@
srcScls = SPEC_SCLS (src);
/* Compensate for const to const code change in checkSClass() */
- if (!level & port->mem.code_ro && SPEC_CONST (dest))
+ if (((!level) & port->mem.code_ro) && SPEC_CONST (dest))
{
if (srcScls == S_CODE && destScls == S_FIXED)
destScls = S_CODE;
diff -ruP sdcc_2.9.0/support/cpp/sdcpp-opts.c sdcc_2.9.0_new/support/cpp/sdcpp-opts.c
--- sdcc_2.9.0/support/cpp/sdcpp-opts.c 2008-03-31 20:10:22.000000000 +0200
+++ sdcc_2.9.0_new/support/cpp/sdcpp-opts.c 2009-05-03 13:57:25.445053848 +0200
@@ -564,7 +564,7 @@
if (out_stream == NULL)
{
- fatal_error ("opening output file %s: %m", out_fname);
+ fatal_error ("opening output file %s: %s", out_fname, strerror(errno));
return false;
}
@@ -641,7 +641,7 @@
{
deps_stream = fopen (deps_file, deps_append ? "a": "w");
if (!deps_stream)
- fatal_error ("opening dependency file %s: %m", deps_file);
+ fatal_error ("opening dependency file %s: %s", deps_file, strerror(errno));
}
}
@@ -651,10 +651,10 @@
if (deps_stream && deps_stream != out_stream
&& (ferror (deps_stream) || fclose (deps_stream)))
- fatal_error ("closing dependency file %s: %m", deps_file);
+ fatal_error ("closing dependency file %s: %s", deps_file, strerror(errno));
if (out_stream && (ferror (out_stream) || fclose (out_stream)))
- fatal_error ("when writing output to %s: %m", out_fname);
+ fatal_error ("when writing output to %s: %s", out_fname, strerror(errno));
}
/* Either of two environment variables can specify output of