
4 May
2008
4 May
'08
1:58 a.m.
Anders Broman wrote:
Hi, I normally don't have a full Cygwin installation only the tools needed to build wireshark ( flex, bison wget etc ) and no *nix system. As it's possible to build libsmi with the same set of tools e.g not using autogen I thought it useful to do the changes...
I just built everything with the attached patches against SVN HEAD. The diff has been editted to remove my personal customisations, so it might not be perfect.
I don't like putting the OTHERTOOLS at the head of PATH, but I have incompatible versions of bison & flex in my normal PATH.
Maybe the PATH could be built as TOOLS32, then OTHERTOOLS, then the original PATH.
--
There's no point in being grown up if you can't be childish sometimes.
-- Dr. Who
Index: win/config.nmake
===================================================================
--- win/config.nmake (revision 8207)
+++ win/config.nmake (working copy)
@@ -114,6 +114,20 @@
MKDIR = md
##
+## Other tools
+##
+#OTHERTOOLS=C:\cygwin
+OTHERTOOLS="C:\Program Files\GnuWin32"
+PATH=$(OTHERTOOLS)\bin;$(PATH)
+
+AWK = awk
+BISON = bison
+CAT = cat
+FLEX = flex
+GREP = grep
+SED = sed
+
+##
## Definitions:
##
# DEBUG = -W3 -Zi -Od /Yd
Index: win/makefile
===================================================================
--- win/makefile (revision 8207)
+++ win/makefile (working copy)
@@ -113,6 +113,33 @@
libs: $(SMILIB)
!ENDIF
+$(ROOT)\lib\parser-smi.c $(ROOT)\lib\parser-smi.tab.h: $(ROOT)\lib\parser-smi.y \
+ $(ROOT)\lib\scanner-smi.h $(ROOT)\lib\parser-smi.h
+ $(BISON) --defines=$(ROOT)\lib\parser-smi.tab.h -t -psmi \
+ -o $(ROOT)\lib\parser-smi.c $(ROOT)\lib\parser-smi.y
+
+$(ROOT)\lib\parser-sming.c: $(ROOT)\lib\parser-sming.y $(ROOT)\lib\scanner-sming.h \
+ $(ROOT)\lib\parser-sming.h
+ $(BISON) --defines=$(ROOT)\lib\parser-sming.tab.h -t -psming \
+ -o $(ROOT)\lib\parser-sming.c $(ROOT)\lib\parser-sming.y
+
+$(ROOT)\lib\scanner-smi.c: $(ROOT)\lib\scanner-smi.l $(ROOT)\lib\scanner-smi.h \
+ $(ROOT)\lib\parser-smi.tab.h
+ $(FLEX) -Cfe -Psmi -t $(ROOT)\lib\scanner-smi.l > \
+ $(ROOT)\lib\scanner-smi.c
+
+$(ROOT)\lib\scanner-sming.c: $(ROOT)\lib\scanner-sming.l \
+ $(ROOT)\lib\scanner-sming.h $(ROOT)\lib\parser-sming.tab.h
+ $(FLEX) -Cfe -Psming -t $(ROOT)\lib\scanner-sming.l > \
+ $(ROOT)\lib\scanner-sming.c
+
+$(ROOT)\lib\error.h $(TMPDIR)\data.obj: $(ROOT)\lib\errormacros.h
+
+$(ROOT)\lib\errormacros.h: $(ROOT)\lib\error.c
+ $(CAT) $(ROOT)\lib\error.c | $(GREP) ERR_ | \
+ $(SED) -e "s/^.*(ERR_[a-zA-Z0-9_]*).*$$/\1/" | \
+ $(AWK) "{printf "#define %-50s %d\n", $$1, NR-1}" > $(ROOT)\lib\errormacros.h
+
# special compilation rules
# (flex-src avoids missing unistd.h if _Win32 defined)
Index: tools/dump-sming.c
===================================================================
--- tools/dump-sming.c (revision 8207)
+++ tools/dump-sming.c (working copy)
@@ -696,30 +696,30 @@
static void fprintImports(FILE *f, SmiModule *smiModule)
{
- SmiImport *import;
+ Import **import;
char *lastModuleName = NULL;
int pos = 0, len, maxlen = 0;
createImportList(smiModule);
- for (import = smiGetFirstImport(smiModule); import; import = smiGetNextImport(import)) {
- len = strlen(import->module);
+ for (import = &importList; *import; import = &(*import)->nextPtr) {
+ len = strlen((*import)->module);
maxlen = (len > maxlen) ? len : maxlen;
}
- for (import = smiGetFirstImport(smiModule); import; import = smiGetNextImport(import)) {
- int yaba = !lastModuleName || strcmp(import->module, lastModuleName);
+ for (import = &importList; *import; import = &(*import)->nextPtr) {
+ int yaba = !lastModuleName || strcmp((*import)->module, lastModuleName);
if (yaba) {
if (lastModuleName) {
fprint(f, ");\n");
}
fprintSegment(f, INDENT, "", 0);
- fprint(f, "import %-*s (", maxlen, import->module);
+ fprint(f, "import %-*s (", maxlen, (*import)->module);
pos = INDENT + 12 + maxlen;
} else {
fprint(f, ", ");
}
- len = strlen(import->name);
+ len = strlen((*import)->name);
if (len + pos > INDENTMAX) {
fprint(f, "\n");
fprintSegment(f, INDENT, "", 0);
@@ -727,9 +727,9 @@
fprint(f, " %-*s ", maxlen, "");
pos = INDENT + 12 + maxlen;
}
- fprint(f, "%s", import->name);
+ fprint(f, "%s", (*import)->name);
pos += len;
- lastModuleName = import->module;
+ lastModuleName = (*import)->module;
}
if (lastModuleName) {
Index: lib/smi.h.in
===================================================================
--- lib/smi.h.in (revision 8207)
+++ lib/smi.h.in (working copy)
@@ -37,6 +37,7 @@
#define SMI_VERSION_MINOR @LIBSMI_MINOR@
#define SMI_VERSION_PATCHLEVEL @LIBSMI_PATCHLEVEL@
#define SMI_VERSION_STRING "@VERSION_STRING@"
+#define SMI_Version (SMI_VERSION_MAJOR * 10000 + SMI_VERSION_MINOR * 100 + SMI_VERSION_PATCHLEVEL)
extern const char *smi_version_string;
Index: lib/util.c
===================================================================
--- lib/util.c (revision 8207)
+++ lib/util.c (working copy)
@@ -19,6 +19,10 @@
#include <string.h>
#include <time.h>
+#if defined(HAVE_WIN_H)
+#include "win.h"
+#endif
+
#include "util.h"
#include "snprintf.h"