Update of /cvsroot/monetdb/buildtools/burg
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv31037/burg
Modified Files:
b.h be.c burs.c closure.c delta.c fe.c gram.y item.c lex.c
list.c main.c nonterminal.c operator.c pattern.c plank.c
queue.c rule.c string.c symtab.c table.c trim.c winconfig.h
zalloc.c
Log Message:
propagated changes of Tuesday Nov 27 2007 - Wednesday Nov 28 2007
from the MonetDB_1-20 branch to the development trunk
Index: trim.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/trim.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- trim.c 26 Jul 2005 13:47:33 -0000 1.1.1.1
+++ trim.c 28 Nov 2007 14:44:51 -0000 1.2
@@ -1,5 +1,6 @@
char rcsid_trim[] = "$Id$";
+#include "burg_config.h"
#include <stdio.h>
#include "b.h"
#include "fe.h"
Index: pattern.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/pattern.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- pattern.c 26 Jul 2005 13:47:33 -0000 1.1.1.1
+++ pattern.c 28 Nov 2007 14:44:48 -0000 1.2
@@ -1,5 +1,6 @@
char rcsid_pattern[] = "$Id$";
+#include "burg_config.h"
#include <stdio.h>
#include "b.h"
Index: zalloc.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/zalloc.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- zalloc.c 20 Jul 2007 08:25:08 -0000 1.3
+++ zalloc.c 28 Nov 2007 14:44:52 -0000 1.4
@@ -1,5 +1,6 @@
char rcsid_zalloc[] = "$Id$";
+#include "burg_config.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
Index: table.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/table.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- table.c 26 Jul 2005 13:47:34 -0000 1.1.1.1
+++ table.c 28 Nov 2007 14:44:51 -0000 1.2
@@ -1,5 +1,6 @@
char rcsid_table[] = "$Id$";
+#include "burg_config.h"
#include "b.h"
#include <string.h>
#include <stdio.h>
Index: plank.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/plank.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- plank.c 21 Jun 2007 20:39:18 -0000 1.2
+++ plank.c 28 Nov 2007 14:44:48 -0000 1.3
@@ -1,11 +1,20 @@
char rcsid_plank[] = "$Id$";
+#include "burg_config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "b.h"
#include "fe.h"
+#ifdef NATIVE_WIN32
+/* The POSIX name for this item is deprecated. Instead, use the ISO
+ C++ conformant name: _strdup. See online help for details. */
+#define strdup _strdup
+
+#define snprintf _snprintf
+#endif
+
#define ERROR_VAL 0
int speedflag = 0;
@@ -52,9 +61,13 @@
static int num = 0;
p = (Plank) zalloc(sizeof(struct plank));
- sprintf(buf, "%s_plank_%d", prefix, num++);
+ snprintf(buf, sizeof(buf), "%s_plank_%d", prefix, num++);
+#ifdef HAVE_STRDUP
+ p->name = strdup(buf);
+#else
p->name = (char *) zalloc(strlen(buf)+1);
strcpy(p->name, buf);
+#endif
return p;
}
@@ -77,9 +90,13 @@
StateMap sm;
sm = (StateMap) zalloc(sizeof(struct stateMap));
- sprintf(buf, "f%d", num++);
+ snprintf(buf, sizeof(buf), "f%d", num++);
+#ifdef HAVE_STRDUP
+ sm->fieldname = strdup(buf);
+#else
sm->fieldname = (char *) zalloc(strlen(buf)+1);
strcpy(sm->fieldname, buf);
+#endif
return sm;
}
@@ -675,10 +692,10 @@
} else {
assert(im0->offset == 0);
assert(im1->offset == 0);
- sprintf(buf, "l = %s[l].%s",
+ snprintf(buf, sizeof(buf), "l = %s[l].%s",
im0->values->plank->name,
im0->values->fieldname);
exceptionSwitch(im0->exceptions, "l", "l =", "break;",
0, buf);
- sprintf(buf, "r = %s[r].%s",
+ snprintf(buf, sizeof(buf), "r = %s[r].%s",
im1->values->plank->name,
im1->values->fieldname);
exceptionSwitch(im1->exceptions, "r", "r =", "break;",
0, buf);
@@ -787,10 +804,10 @@
assert(im0->offset == 0);
assert(im1->offset == 0);
/*
- sprintf(buf, "l = %s[l].%s",
+ snprintf(buf, sizeof(buf), "l = %s[l].%s",
im0->values->plank->name,
im0->values->fieldname);
exceptionSwitch(im0->exceptions, "l", "l =", "break;",
0, buf);
- sprintf(buf, "r = %s[r].%s",
+ snprintf(buf, sizeof(buf), "r = %s[r].%s",
im1->values->plank->name,
im1->values->fieldname);
exceptionSwitch(im1->exceptions, "r", "r =", "break;",
0, buf);
Index: nonterminal.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/nonterminal.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- nonterminal.c 26 Jul 2005 13:47:33 -0000 1.1.1.1
+++ nonterminal.c 28 Nov 2007 14:44:47 -0000 1.2
@@ -1,5 +1,6 @@
char rcsid_nonterminal[] = "$Id$";
+#include "burg_config.h"
#include "b.h"
#include <stdio.h>
#include <string.h>
@@ -10,7 +11,7 @@
List nonterminals;
NonTerminal
-newNonTerminal(name) char *name;
+newNonTerminal(char *name)
{
NonTerminal nt;
@@ -27,7 +28,7 @@
}
int
-nonTerminalName(buf, i) char *buf; int i;
+nonTerminalName(char *buf, size_t len, int i)
{
List l;
/* extern char *strcpy ARGS((char *, char *)); */
@@ -35,16 +36,16 @@
for (l = nonterminals; l; l = l->next) {
NonTerminal nt = (NonTerminal) l->x;
if (nt->num == i) {
- strcpy(buf, nt->name);
+ strncpy(buf, nt->name, len);
return 1;
}
}
- strcpy(buf, "(Unknown NonTerminal)");
+ strncpy(buf, "(Unknown NonTerminal)", len);
return 0;
}
void
-dumpNonTerminal(n) NonTerminal n;
+dumpNonTerminal(NonTerminal n)
{
printf("%s(%d)", n->name, n->num);
}
Index: symtab.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/symtab.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- symtab.c 26 Jul 2005 13:47:33 -0000 1.1.1.1
+++ symtab.c 28 Nov 2007 14:44:50 -0000 1.2
@@ -1,5 +1,6 @@
char rcsid_symtab[] = "$Id$";
+#include "burg_config.h"
#include <stdio.h>
#include <string.h>
#include "b.h"
Index: list.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/list.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- list.c 26 Jul 2005 13:47:33 -0000 1.1.1.1
+++ list.c 28 Nov 2007 14:44:46 -0000 1.2
@@ -1,5 +1,6 @@
char rcsid_list[] = "$Id$";
+#include "burg_config.h"
#include "b.h"
IntList
Index: gram.y
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/gram.y,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- gram.y 9 Feb 2007 22:58:02 -0000 1.2
+++ gram.y 28 Nov 2007 14:44:45 -0000 1.3
@@ -1,6 +1,7 @@
%{
char rcsid_gram[] = "$Id$";
+#include "burg_config.h"
#include <stdio.h>
#include "b.h"
#include "fe.h"
Index: operator.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/operator.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- operator.c 26 Jul 2005 13:47:33 -0000 1.1.1.1
+++ operator.c 28 Nov 2007 14:44:47 -0000 1.2
@@ -1,5 +1,6 @@
char rcsid_operator[] = "$Id$";
+#include "burg_config.h"
#include "b.h"
#include <stdio.h>
Index: item.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/item.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- item.c 26 Jul 2005 13:47:33 -0000 1.1.1.1
+++ item.c 28 Nov 2007 14:44:45 -0000 1.2
@@ -1,5 +1,6 @@
char rcsid_item[] = "$Id$";
+#include "burg_config.h"
#include "b.h"
#include <stdio.h>
#include <string.h>
Index: queue.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/queue.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- queue.c 26 Jul 2005 13:47:33 -0000 1.1.1.1
+++ queue.c 28 Nov 2007 14:44:49 -0000 1.2
@@ -1,5 +1,6 @@
char rcsid_queue[] = "$Id$";
+#include "burg_config.h"
#include "b.h"
#include <stdio.h>
Index: closure.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/closure.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- closure.c 26 Jul 2005 13:47:33 -0000 1.1.1.1
+++ closure.c 28 Nov 2007 14:44:44 -0000 1.2
@@ -1,5 +1,6 @@
char rcsid_closure[] = "$Id$";
+#include "burg_config.h"
#include <stdio.h>
#include "b.h"
Index: winconfig.h
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/winconfig.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- winconfig.h 24 Jan 2007 23:34:19 -0000 1.2
+++ winconfig.h 28 Nov 2007 14:44:52 -0000 1.3
@@ -24,6 +24,7 @@
/* Visual Studio 8 has deprecated lots of stuff: suppress warnings */
#define _CRT_SECURE_NO_DEPRECATE 1
+#define _CRT_SECURE_NO_WARNINGS 1
/* Define to 1 if you have the <inttypes.h> header file. */
/* #undef HAVE_INTTYPES_H */
Index: be.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/be.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- be.c 21 Jun 2007 20:39:18 -0000 1.4
+++ be.c 28 Nov 2007 14:44:43 -0000 1.5
@@ -1,6 +1,6 @@
char rcsid_be[] = "$Id$";
-#include <burg_config.h>
+#include "burg_config.h"
#include <stdio.h>
Index: rule.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/rule.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- rule.c 26 Jul 2005 13:47:33 -0000 1.1.1.1
+++ rule.c 28 Nov 2007 14:44:49 -0000 1.2
@@ -1,5 +1,6 @@
char rcsid_rule[] = "$Id$";
+#include "burg_config.h"
#include "b.h"
#include <stdio.h>
Index: lex.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/lex.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- lex.c 20 Jul 2007 08:25:07 -0000 1.5
+++ lex.c 28 Nov 2007 14:44:46 -0000 1.6
@@ -1,5 +1,6 @@
char rcsid_lex[] = "$Id$";
+#include "burg_config.h"
#include <ctype.h>
#include <stdio.h>
#include <string.h>
Index: main.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/main.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- main.c 26 Jul 2005 14:22:29 -0000 1.2
+++ main.c 28 Nov 2007 14:44:47 -0000 1.3
@@ -22,6 +22,12 @@
#if HAVE_STRING_H && HAVE_STRDUP
#include <string.h>
+
+#ifdef NATIVE_WIN32
+/* The POSIX name for this item is deprecated. Instead, use the ISO
+ C++ conformant name: _strdup. See online help for details. */
+#define strdup _strdup
+#endif
#else
static char *strdup (const char *);
#endif
@@ -215,7 +221,7 @@
strdup (const char *s) {
int len = strlen (s);
- char *ret = malloc (len);
+ char *ret = malloc (len + 1);
if (!ret)
return NULL;
Index: string.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/string.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- string.c 26 Jul 2005 13:47:33 -0000 1.1.1.1
+++ string.c 28 Nov 2007 14:44:50 -0000 1.2
@@ -1,10 +1,17 @@
char rcsid_string[] = "$Id$";
+#include "burg_config.h"
#include <stdio.h>
#include <string.h>
#include "b.h"
#include "fe.h"
+#ifdef NATIVE_WIN32
+/* The POSIX name for this item is deprecated. Instead, use the ISO
+ C++ conformant name: _strdup. See online help for details. */
+#define strdup _strdup
+#endif
+
static StrTableElement newStrTableElement ARGS((void));
StrTable
@@ -57,8 +64,12 @@
}
ste = newStrTableElement();
ste->erulenos = newIntList(eruleno, 0);
+#ifdef HAVE_STRDUP
+ ste->str = strdup(s);
+#else
ste->str = (char *) zalloc(strlen(s) + 1);
strcpy(ste->str, s);
+#endif
t->elems = newList(ste, t->elems);
*new = 1;
return ste;
Index: fe.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/fe.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- fe.c 17 Jul 2007 11:17:32 -0000 1.2
+++ fe.c 28 Nov 2007 14:44:45 -0000 1.3
@@ -1,10 +1,19 @@
char rcsid_fe[] = "$Id$";
+#include "burg_config.h"
#include <stdio.h>
#include <string.h>
#include "b.h"
#include "fe.h"
+#ifdef NATIVE_WIN32
+/* The POSIX name for this item is deprecated. Instead, use the ISO
+ C++ conformant name: _strdup. See online help for details. */
+#define strdup _strdup
+
+#define snprintf _snprintf
+#endif
+
int grammarflag;
static int arity;
@@ -69,9 +78,13 @@
return x->normalizer;
}
}
- sprintf(buf, "n%%%d", tcount++);
+ snprintf(buf, sizeof(buf), "n%%%d", tcount++);
+#ifdef HAVE_STRDUP
+ s = strdup(buf);
+#else
s = (char *) zalloc(strlen(buf)+1);
strcpy(s, buf);
+#endif
n = newNonTerminal(s);
p->normalizer = n;
xpatterns = newList(p, xpatterns);
Index: delta.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/delta.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- delta.c 26 Jul 2005 13:47:33 -0000 1.1.1.1
+++ delta.c 28 Nov 2007 14:44:44 -0000 1.2
@@ -1,5 +1,6 @@
char rcsid_delta[] = "$Id$";
+#include "burg_config.h"
#include <stdio.h>
#include "b.h"
#include "fe.h"
@@ -115,8 +116,8 @@
if (c[i] > prevent_divergence) {
char ntname[100];
char basename[100];
- nonTerminalName(ntname, nt);
- nonTerminalName(basename, base);
+ nonTerminalName(ntname, sizeof(ntname), nt);
+ nonTerminalName(basename, sizeof(basename),
base);
fprintf(stderr, "ERROR: The grammar appears to
diverge\n");
fprintf(stderr, "\tRelative Costs: %s(0),
%s(%d)\n", basename, ntname, c[i]);
fprintf(stderr, "\tOffending Operator: %s\n",
its->op->name);
@@ -130,8 +131,8 @@
} else if (PRINCIPLECOST(c) > prevent_divergence) {
char ntname[100];
char basename[100];
- nonTerminalName(ntname, nt);
- nonTerminalName(basename, base);
+ nonTerminalName(ntname, sizeof(ntname), nt);
+ nonTerminalName(basename, sizeof(basename), base);
fprintf(stderr, "ERROR: The grammar appears to diverge\n");
fprintf(stderr, "\tRelative Costs: %s(0), %s(%d)\n", basename,
ntname, PRINCIPLECOST(c));
fprintf(stderr, "\tOffending Operator: %s\n", its->op->name);
Index: burs.c
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/burs.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- burs.c 26 Jul 2005 13:47:34 -0000 1.1.1.1
+++ burs.c 28 Nov 2007 14:44:43 -0000 1.2
@@ -1,5 +1,6 @@
char rcsid_burs[] = "$Id$";
+#include "burg_config.h"
#include "b.h"
Item_Set errorState;
Index: b.h
===================================================================
RCS file: /cvsroot/monetdb/buildtools/burg/b.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- b.h 5 Sep 2007 21:08:15 -0000 1.7
+++ b.h 28 Nov 2007 14:44:42 -0000 1.8
@@ -216,7 +216,7 @@
extern void freeItem_Set ARGS((Item_Set));
extern Mapping newMapping ARGS((int));
extern NonTerminal newNonTerminal ARGS((char *));
-extern int nonTerminalName ARGS((char *, int));
+extern int nonTerminalName ARGS((char *, size_t, int));
extern Operator newOperator ARGS((char *, OperatorNum, ArityNum));
extern Pattern newPattern ARGS((Operator));
extern Rule newRule ARGS((DeltaPtr, ERuleNum, NonTerminal, Pattern));
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins