From f4c5e0df26399eb354fb909aef19045645007715 Mon Sep 17 00:00:00 2001 From: fcolin Date: Mon, 23 Jun 2008 12:57:35 +0000 Subject: Mise a jour pour compilation MinGW --- src/Makefile.mingw | 10 +++++++--- src/ivybind.c | 19 ++++++++++++++----- src/ivysocket.c | 2 ++ 3 files changed, 23 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/Makefile.mingw b/src/Makefile.mingw index 6dd2168..40ae777 100644 --- a/src/Makefile.mingw +++ b/src/Makefile.mingw @@ -29,9 +29,11 @@ GLUTLIB = -L. TCLINCL = -I/usr/include/tcl8.4 TCLLIB = -ltcl84 +REGCOMP_OPT=REG_ICASE + TOOLS_DIR = ../tools CC=gcc -CFLAGS = -g +CFLAGS = -g -DREGCOMP_OPT=$(REGCOMP_OPT) # IVY full debug #CFLAGS = -g -DDEBUG OBJ = ivyloop.o timer.o ivysocket.o ivy.o ivybuffer.o ivyfifo.o ivybind.o intervalRegexp.o @@ -48,10 +50,12 @@ TCLOBJ = ivytcl.o timer.o ivysocket.o givy.o ivybuffer.o ivyfifo.o ivybind.o in all: static-libs shared-libs -static-libs: libivy.a libgivy.a libtclivy.a +static-libs: libivy.a libgivy.a +#static-libs: libivy.a libgivy.a libtclivy.a # not yiet libxtivy.a libgtkivy.a need Modified Glut libglutivy.a -shared-libs: libivy.so.$(MAJOR).$(MINOR) libgivy.so.$(MAJOR).$(MINOR) libtclivy.so.$(MAJOR).$(MINOR) +shared-libs: libivy.so.$(MAJOR).$(MINOR) libgivy.so.$(MAJOR).$(MINOR) +#shared-libs: libivy.so.$(MAJOR).$(MINOR) libgivy.so.$(MAJOR).$(MINOR) libtclivy.so.$(MAJOR).$(MINOR) # not yiet libxtivy.so.$(MAJOR).$(MINOR) libgtkivy.so.$(MAJOR).$(MINOR) need Modified Glut libglutivy.so.$(MAJOR).$(MINOR) ivytcl.o: ivytcl.c diff --git a/src/ivybind.c b/src/ivybind.c index 60be1ba..d9bebb2 100644 --- a/src/ivybind.c +++ b/src/ivybind.c @@ -24,8 +24,10 @@ #include #ifdef WIN32 +#ifndef __MINGW32__ #include #endif +#endif #ifdef USE_PCRE_REGEX @@ -105,9 +107,13 @@ IvyBinding IvyBindingCompile( const char * expression, int *erroffset, const ch if ( reg == 0 ) { bind = (IvyBinding)malloc( sizeof( struct _binding )); + if ( ! bind ) + { + perror( "IvyBindingCompile malloc error: "); + exit(-1); + } memset( bind, 0, sizeof(*bind ) ); bind->regexp = regexp; - bind->next = NULL; } else { @@ -132,7 +138,7 @@ void IvyBindingFree( IvyBinding bind ) pcre_free(bind->inspect); pcre_free(bind->regexp); #else /* we don't USE_PCRE_REGEX */ - free( bind->regexp ); + regfree( &bind->regexp ); #endif /* USE_PCRE_REGEX */ free ( bind ); } @@ -155,15 +161,18 @@ int IvyBindingExec( IvyBinding bind, const char * message ) if (nb_match<1) return 0; /* no match */ bind->nb_match = nb_match; #else /* we don't USE_PCRE_REGEX */ + { + int index; memset( bind->match, -1, sizeof(bind->match )); /* work around bug !!!*/ - nb_match = regexec (&bind->regexp, message, MAX_MSG_FIELDS, bind->match, 0) + nb_match = regexec (&bind->regexp, message, MAX_MSG_FIELDS, bind->match, 0); if (nb_match == REG_NOMATCH) return 0; - for ( index = 1; index < MAX_MSG_FIELDS; index++ ) + for (index = 1; index < MAX_MSG_FIELDS; index++ ) { - if ( bind->match[i].rm_so != -1 ) + if ( bind->match[index].rm_so != -1 ) nb_match++; } + } #endif /* USE_PCRE_REGEX */ return nb_match; } diff --git a/src/ivysocket.c b/src/ivysocket.c index cc9a54b..10bceae 100644 --- a/src/ivysocket.c +++ b/src/ivysocket.c @@ -29,7 +29,9 @@ #include #ifdef WIN32 +#ifndef __MINGW32__ typedef int ssize_t; +#endif #define close closesocket /*#define perror (a ) printf(a" error=%d\n",WSAGetLastError());*/ #else -- cgit v1.1