commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r834822 - in /commons/sandbox/runtime/trunk/src/main/native: Makefile.in configure include/acr_string.h modules/network/ssl/openssl.c shared/string.c
Date Wed, 11 Nov 2009 09:49:51 GMT
Author: mturk
Date: Wed Nov 11 09:49:50 2009
New Revision: 834822

URL: http://svn.apache.org/viewvc?rev=834822&view=rev
Log:
Add string tokenizer

Modified:
    commons/sandbox/runtime/trunk/src/main/native/Makefile.in
    commons/sandbox/runtime/trunk/src/main/native/configure
    commons/sandbox/runtime/trunk/src/main/native/include/acr_string.h
    commons/sandbox/runtime/trunk/src/main/native/modules/network/ssl/openssl.c
    commons/sandbox/runtime/trunk/src/main/native/shared/string.c

Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.in
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.in?rev=834822&r1=834821&r2=834822&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/Makefile.in (original)
+++ commons/sandbox/runtime/trunk/src/main/native/Makefile.in Wed Nov 11 09:49:50 2009
@@ -43,6 +43,7 @@
 CPP=@cpp@
 CXX=@cxx@
 CFLAGS=@ccflags@
+CSFLAGS=@ccshare@
 EXLFLAGS=@exflags@
 CPPFLAGS=@cppopts@
 CXXFLAGS=@cxxopts@
@@ -320,37 +321,37 @@
 all: $(STATICLIB) $(SHAREDLIB) @modules@
 
 $(SRCDIR)/port/%.$(OBJ) : $(SRCDIR)/port/%.c
-	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CSFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o $@ $<
 
 $(SRCDIR)/shared/%.$(OBJ) : $(SRCDIR)/shared/%.c
-	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CSFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o $@ $<
 
 $(SRCDIR)/os/unix/%.$(OBJ) : $(SRCDIR)/os/unix/%.c
-	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CSFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o $@ $<
 
 $(SRCDIR)/os/$(HOST)/%.$(OBJ) : $(SRCDIR)/os/$(HOST)/%.c
-	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CSFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o $@ $<
 
 $(SRCDIR)/os/$(HOST)/%.$(OBJ) : $(SRCDIR)/os/$(HOST)/%.S
 	$(AS) $(ASFLAGS) -o $@ $<
 
 $(SRCDIR)/srclib/bzip2/%.$(OBJ) : $(SRCDIR)/srclib/bzip2/%.c
-	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CSFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o $@ $<
 
 $(SRCDIR)/srclib/regex/%.$(OBJ) : $(SRCDIR)/srclib/regex/%.c
-	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CSFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o $@ $<
 
 $(SRCDIR)/srclib/zlib/%.$(OBJ) : $(SRCDIR)/srclib/zlib/%.c
-	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CSFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o $@ $<
 
 $(SRCDIR)/modules/network/ssl/%.$(OBJ) : $(SRCDIR)/modules/network/ssl/%.c
-	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CSFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o $@ $<
 
 $(SRCDIR)/test/%.$(OBJ) : $(SRCDIR)/test/%.c
-	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CSFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o $@ $<
 
 .cpp.$(OBJ):
-	$(CXX) $(CFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c -o $@ $<
+	$(CXX) $(CFLAGS) $(CSFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c -o $@ $<
 
 $(STATICLIB): $(PPORT_OBJS) $(COMMON_OBJS) $(@platform@_OBJS) $(REGEX_OBJS) $(BZIP2_OBJS)
$(ZLIB_OBJS) @testobjs@
 	$(AR) $(ARFLAGS) $@ $(PPORT_OBJS) $(COMMON_OBJS) $(@platform@_OBJS) $(REGEX_OBJS) $(BZIP2_OBJS)
$(ZLIB_OBJS) @testobjs@

Modified: commons/sandbox/runtime/trunk/src/main/native/configure
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/configure?rev=834822&r1=834821&r2=834822&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/configure (original)
+++ commons/sandbox/runtime/trunk/src/main/native/configure Wed Nov 11 09:49:50 2009
@@ -433,7 +433,8 @@
     linux-gcc )
         varadds cppopts -DLINUX=2 -D_GNU_SOURCE -D$mcpu -D__CC$bits
         varadds cppopts -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED
-        varadds ccflags -fPIC -O3 -Wall -g
+        varadds ccflags -O3 -Wall
+        varadds ccshare -fPIC -g
         if [ ".$mach" = .i386 ]; then
             varadds ccflags -march=i686
         fi
@@ -451,6 +452,7 @@
         varadds cppopts -D_LINUX=2 -D_GNU_SOURCE -D$mcpu -D__CC$bits
         varadds cppopts -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED
         varadds ccflags -xstrconst -xdepend -O -Xa -KPIC
+        varadds ccshare -KPIC
         varadds asflags -c -KPIC -D$mcpu
         varadds ldflags -lpthread -ldl
         varadds shflags -G -KPIC -dy
@@ -463,7 +465,8 @@
     darwin-gcc )
         r="`uname -r | sed 's/\.//g'`"
         varadds cppopts -DDARWIN=$r -D$mcpu -D__CC$bits
-        varadds ccflags -fPIC -O3 -g
+        varadds ccflags -O3
+        varadds ccshare -fPIC -g
         varadds asflags -c -fPIC -g -D$mcpu
         varadds ldflags -lpthread -ldl
         varadds exflags '-Wl,-rpath,??(PREFIX)/??(LIBDIR):.'
@@ -487,7 +490,8 @@
         else
             varadds cppopts -D_POSIX_PTHREAD_SEMANTICS
         fi
-        varadds ccflags -xstrconst -xdepend -O -Xa -KPIC
+        varadds ccflags -xstrconst -xdepend -O -Xa
+        varadds ccshare -KPIC
         varadds ldflags -lrt -ldl -lthread -lsendfile -lsocket -lnsl
         varadds shflags -G -KPIC -dy
         varadds exflags '-R:??(PREFIX)/??(LIBDIR):.'
@@ -499,7 +503,8 @@
     hpux-cc    )
         r="`uname -r | sed 's/[A-Z].[0-9]*.//'`"
         varadds cppopts -D_HPUX_SOURCE -DHPUX11=$r -D$mcpu -D__CC$bits
-        varadds ccflags -Ae +O2 -z +Z
+        varadds ccflags -Ae +O2 -z
+        varadds ccshare +Z
         varadds asflags -c +Z -D$mcpu
         varadds ldflags -lrt -lpthread -ldld -lm
         varadds shflags +Z -b
@@ -511,6 +516,7 @@
     windows-cl )
         varadds asflags -nologo -DWIN32 -DWINNT -D_WIN32 -D$mcpu
         varadds ccflags -nologo -O2 -Ob2 -Oy- -Zi -D_MD -MD -W3
+        varadds ccshare -D_DLL
         varadds cppopts -DWIN32 -DWINNT -D_WIN32 -D_WINDOWS -D_WINNT
         varadds cppopts -D_WIN32_WINNT=0x0501 -D_WIN32_IE=0x0600 -D$mcpu -D__CC$bits
         varadds cxxopts -TP
@@ -533,7 +539,8 @@
     aix-gcc    )
         r="`uname -v``uname -r`"
         varadds cppopts -DAIX=$r -U__STR__ -D_THREAD_SAFE -D_USE_IRS -D$mcpu -D__CC$bits
-        varadds ccflags -fPIC -O2 -g -pthread
+        varadds ccflags -O2 -pthread
+        varadds ccshare -fPIC -g
         varadds ldflags -lrt -lpthreads -lnsl
         varadds shflags -shared -fPIC -Wl,-soname '-Wl,??@' -Wl,-brtl
         varadds exflags '-Wl,-rpath,??(PREFIX)/??(LIBDIR):????ORIGIN'
@@ -1117,6 +1124,7 @@
     -e 's|@topdir@|'"$topdir"'|g' \
     -e 's|@asflags@|'"$asflags"'|g' \
     -e 's|@ccflags@|'"$ccflags"'|g' \
+    -e 's|@ccshare@|'"$ccshare"'|g' \
     -e 's|@exflags@|'"$exflags"'|g' \
     -e 's|@cppopts@|'"$cppopts"'|g' \
     -e 's|@cxxopts@|'"$cxxopts"'|g' \

Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_string.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_string.h?rev=834822&r1=834821&r2=834822&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_string.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_string.h Wed Nov 11 09:49:50
2009
@@ -407,6 +407,18 @@
  */
 ACR_DECLARE(wchar_t *) ACR_wcsqtab2ss(wchar_t *str);
 
+/**
+ * Convert string sparated by isspace chars to array.
+ * Single quotes allow embedded spaces.
+ * @param s String to use.
+ * @param args Output token array.
+ * @param maxargs Maximum size of the token array.
+ * @return number of tokens.
+ * @note If the maxargs is not large enough to hold all the tokens returned
+ *       value is >= to maxargs.
+ */
+ACR_DECLARE(size_t) ACR_StrTokenize(char *s, char **args, size_t maxargs);
+
 #ifdef __cplusplus
 }
 #endif

Modified: commons/sandbox/runtime/trunk/src/main/native/modules/network/ssl/openssl.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/modules/network/ssl/openssl.c?rev=834822&r1=834821&r2=834822&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/modules/network/ssl/openssl.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/modules/network/ssl/openssl.c Wed Nov 11
09:49:50 2009
@@ -15,6 +15,7 @@
  */
 
 #include "acr.h"
+#include "acr_arch.h"
 #include "acr_private.h"
 #include "acr_string.h"
 #include "acr_memory.h"

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/string.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/string.c?rev=834822&r1=834821&r2=834822&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/string.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/string.c Wed Nov 11 09:49:50 2009
@@ -1931,3 +1931,55 @@
     }
     return ptr;
 }
+
+static char *_qtoken(char *s)
+{
+    int   quoting = 0;
+    char *t = s;
+
+    while (*t && (quoting || !acr_isspace(*t))) {
+        if (*t != '\'') {
+            *s++ = *t++;
+            continue;
+        }
+        t++;
+        if (!quoting) {
+            quoting = 1;
+            continue;
+        }
+        /* Check for double quotes */
+        if (*t != '\'') {
+            /* end of quoted section; absorb closing quote */
+            quoting = 0;
+            continue;
+        }
+        /* doubled quote; fold one quote into two */
+        *s++ = *t++;
+    }
+    if (*s) {
+        /* Terminate the token */
+        *s = '\0';
+        if (t == s) {
+            /* More tokens to follow */
+            t++;
+        }
+    }
+    return t;
+}
+
+ACR_DECLARE(size_t) ACR_StrTokenize(char *s, char **args, size_t maxargs)
+{
+    size_t nargs;
+
+    for (nargs = 0; nargs < maxargs; nargs++) {
+        /* Skip leading spaces */
+        while (*s && acr_isspace(*s))
+            s++;
+        if (*s == '\0')
+            break;
+        args[nargs] = s;
+        s = _qtoken(s);
+    }
+
+    return nargs;
+}



Mime
View raw message