Permalink
Browse files

added doc files

fixed warnings for some c printfs
*	modified:   Makefile.am
*	modified:   configure.ac
*	modified:   doc/Makefile.am
*	new file:   doc/index.php.in
*	new file:   doc/mainpage.c
*	modified:   ghfcns.c
*	modified:   ghfcns.h
  • Loading branch information...
1 parent 13d3458 commit ea3a1e6894e067c5e103ef1bf8807f1c2d970903 raw committed Mar 22, 2013
Showing with 232 additions and 10 deletions.
  1. +19 −5 Makefile.am
  2. +1 −1 configure.ac
  3. +1 −1 doc/Makefile.am
  4. +52 −0 doc/index.php.in
  5. +155 −0 doc/mainpage.c
  6. +2 −2 ghfcns.c
  7. +2 −1 ghfcns.h
View
@@ -5,18 +5,30 @@ AUTOMAKE_OPTIONS = foreign
lib_LTLIBRARIES = lib_mysqludf_preg.la
-lib_mysqludf_preg_la_SOURCES = \
- preg.c preg.h \
- ghmysql.c ghmysql.h \
- ghfcns.c ghfcns.h \
- from_php.c from_php.h \
+CFILES= \
+ preg.c \
+ ghmysql.c \
+ ghfcns.c \
+ from_php.c \
lib_mysqludf_preg_capture.c \
lib_mysqludf_preg_check.c \
lib_mysqludf_preg_info.c \
lib_mysqludf_preg_position.c \
lib_mysqludf_preg_replace.c \
lib_mysqludf_preg_rlike.c
+HFILES = \
+ preg.h \
+ ghmysql.h \
+ ghfcns.h \
+ from_php.h
+
+lib_mysqludf_preg_la_SOURCES = \
+ $(CFILES) \
+ $(HFILES)
+
+DLL_OBJS=$(CFILES:%.c=.libs/lib_mysqludf_preg_la-%.o)
+
SUBDIRS=test doc
DIFFPROGRAM:=kompare -
@@ -59,3 +71,5 @@ maintainer-dist:
maintainer-diff:
git diff "$(PACKAGE)-$(DIFFVERSION)" . | $(DIFFPROGRAM)
+lib_mysqludf_preg.dll: $(DLL_OBJS)
+ $(CC) -shared -o lib_mysqludf_preg.dll -Wl,"--strip-all" -Wl,"--export-all-symbols" $(DLL_OBJS) /opt/mingw/pcre/lib/libpcre.a
View
@@ -1,6 +1,6 @@
AC_PREREQ(2.59)
-AC_INIT(lib_mysqludf_preg,1.1,raw@goodhumans.net)
+AC_INIT(lib_mysqludf_preg,1.2,raw@goodhumans.net)
AC_CONFIG_AUX_DIR(config)
View
@@ -13,7 +13,7 @@ all:
doc:
$(DOXYGEN) Doxyfile
cat html/index.html | awk '/<body>/,/<hr/ { print }' |grep -v '<body>' | sed 's/<hr.*//' | sed 's/<h2>/<h1>/g' | sed 's/<\/h2>/<\/h1>/g' | sed 's/index.html/index.php/g' > lib_mysqludf_preg.frag
- cat index.php.in | sed 's/<DISTFILE>/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).tar.gz/g' | sed 's/<WINBINFILE>/$(PACKAGE)-$(PACKAGE_VERSION)-bin.zip/g' >index.php
+ cat index.php.in | sed 's/<DISTFILE>/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).tar.gz/g'| sed 's/<__VERSION__>/$(PACKAGE_VERSION)/g' | sed 's/<WINBINFILE>/$(PACKAGE)-$(PACKAGE_VERSION)-bin.zip/g' >index.php
$(UDF_DOCS_HTML_D):doc
View
@@ -0,0 +1,52 @@
+<?php
+ require_once('../include.php');
+?>
+
+<?php OutputHandler::current()->mark('column1'); ?>
+<div class="sidebaritem">
+ <div class="sbihead">
+ <h1>Download</h1>
+ </div>
+ <div class="sbilinks">
+ <h2>Version <__VERSION__></h2>
+ <ul>
+ <li><a href="<DISTFILE>">Source Archive</a></li>
+ <li><a href="<WINBINFILE>">Windows DLLs</a></li>
+ </ul>
+ </div>
+</div>
+<div class="sidebaritem">
+ <div class="sbihead">
+ <h1>Information</h1>
+ </div>
+ <div class="sbicontent">
+ <p>
+A library of functions that add support for perl compatible regular expressions to MySQL.
+ </p>
+ </div>
+</div>
+<?php OutputHandler::current()->endmark(); ?>
+
+<?php XMLMenu::placeCornerBlocks(); ?>
+
+<?php OutputHandler::current()->mark('column1'); ?>
+<div class="sidebaritem">
+ <div class="sbihead">
+ <h1>See also</h1>
+ </div>
+ <div class="sbicontent">
+ <ul class="menu">
+ </ul>
+ </div>
+</div>
+<?php OutputHandler::current()->endmark(); ?>
+<?php include( 'lib_mysqludf_preg.frag' ) ;?>
+<hr size="1" />
+<p>&nbsp;</p>
+<dl compact="compact">
+ <dt>&nbsp;</dt>
+</dl>
+</body>
+</html>
+
+
View
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2008 Rich Waters <raw@goodhumans.com>
+ *
+ * This file is part of lib_mysqludf_preg.
+ *
+ * lib_mysqudf_preg is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * lib_mysqludf_preg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+// This file contains comments intended to help doxygen generate the
+// main page of the documentation.
+
+
+/** @mainpage lib_mysqludf_preg
+ *
+ * @section intro_sec Introduction
+ *
+ * lib_mysqludf_preg is a library of mysql UDFs
+ * (user-defined-functions) that provide access to the PCRE (perl
+ * compatible-regular-expressions) library for pattern matching. The
+ * PCRE library is a set of functions that implement regular
+ * expression pattern matching using the same syntax and semantics as
+ * Perl 5. This syntax can often handle more complex expressions and
+ * capturing than standard regular expression implementations. For
+ * more information about PCRE, please see: http://www.pcre.org/
+ *
+ * @n lib_mysqludf_preg is a useful performance optimization for those
+ * applications that are already performing these regular expression
+ * matches in a high level language (ie. PHP) on the client side. It
+ * is also helpful when there is a need to capture a parenthesized
+ * subexpression from a regular expression, or simply as a slight
+ * performance boost over the builtin RLIKE/REGEXP functions.
+ *
+ * @section Installation
+ *
+ * lib_mysqludf_preg is distributed as a source package. (Binaries are
+ * available for the Windows version.) The instructions below provide some
+ * information about how to configure and compile the library. Please
+ * consult the INSTALL file included with the source package for
+ * more details. If installing from source for Windows please consult
+ * the doc/INSTALL.win file.
+ *
+ * @subsection FromSource From Source
+ *
+ * @subsubsection Prerequisites
+ *
+ * These UDFs require that the libpcre headers and library are
+ * installed. For debian/ubuntu type systems, installing libpcre3-dev
+ * should be sufficient. (<em>apt-get install libpcre3-dev</em>).
+ *
+ * @subsubsection Compilation
+ *
+ * Most users should be able to simply type:
+ * <em>./configure ; make install</em>
+ *
+ * If mysql is an unusual place, you might need to
+ * add --with-mysql=&lt;mysql directory&gt;/bin/mysql_config.
+ *
+ * Similarly, if licpcre is in an unusual place, --with-pcre can be added.
+ *
+ * Example (for osx using fink): ./configure --with-pcre=/sw --with-mysql=/sw/bin/mysql_config
+ *
+ * Also, version 1.1 changes the way NULLs are handled. To restore the legacy NULL handling, add
+ * --enable-legacy-nulls to the configure line
+ *
+ * @subsubsection "Installing the functions"
+ *
+ * Provided the library has been installled into a directory that
+ * mysql server already has in its LD_LIBRARY_PATH, installation of
+ * the functions should be as easy as typing: <em>make
+ * installdb</em>. Any problems encountered are likely related to the
+ * server's environment and the installation directory. If no problems
+ * are encountered, type
+ * <em>make test</em>
+ * to perform some basic
+ * tests.
+ *
+ *
+ * @subsection WindowsBinaries Windows Binaries
+ *
+ * There is a zip file, downloadable from this site, that contains the
+ * necessary dll files to run this UDF on windows. One of these dll files
+ * is the UDF, itself, and the other required dll file is the PCRE library.
+ * These files both need to be installed in directories where the MySQL server
+ * can find them. For the 5.0 series of mysql server, this should be the
+ * bin directory directly under the Mysql\ Server installation. For the
+ * 5.1 MySQL servers this is the directory as specified by the
+ * 'plugin_dir' MySQL variable. After copying the files and restarting
+ * the server, the 3rd file in the archive can be used to create
+ * the functions.
+ *
+ * For more information, please consult the doc/INSTALL.windows file in
+ * the source package.
+ *
+ * @n
+ * @section Functions
+ * lib_mysqludf_preg provides the following functions that interface with
+ * the PCRE library.
+ *
+ * @li @ref PREG_CAPTURE_SECTION "preg_capture"
+ * capture a parenthesized subexpression from a PCRE pattern
+ *
+ * @li @ref PREG_CHECK_SECTION "preg_check"
+ * check if a string is a valid perl-compatible regular expression
+ *
+ * @li @ref PREG_POSITION_SECTION "preg_position"
+ * get position of the of a regular expression capture group in a string
+
+ * @li @ref PREG_REPLACE_SECTION "preg_replace"
+ * perform regular expression search & replace using PCRE.
+ *
+ * @li @ref PREG_RLIKE_SECTION "preg_rlike"
+ * test if a string matches a perl-compatible regular expression
+ *
+ * @li @ref LIB_MYSQLUDF_PREG_INFO_SECTION "lib_mysqludf_preg_info"
+ * get information about the installed lib_mysqludf_preg library
+ *
+ *
+ * @n
+ * @section PREG_CAPTURE_SECTION preg_capture
+ * @copydoc PREG_CAPTURE
+ *
+ * @n
+ * @section PREG_CHECK_SECTION preg_check
+ * @copydoc PREG_CHECK
+ *
+ * @n
+ * @section PREG_POSITION_SECTION preg_position
+ * @copydoc PREG_POSITION
+ *
+ * @n
+ * @section PREG_REPLACE_SECTION preg_replace
+ * @copydoc PREG_REPLACE
+ *
+ * @n
+ * @section PREG_RLIKE_SECTION preg_rlike
+ * @copydoc PREG_RLIKE
+ *
+ * @n
+ * @section LIB_MYSQLUDF_PREG_INFO_SECTION lib_mysqludf_preg_info
+ * @copydoc LIB_MYSQLUDF_PREG_INFO
+ *
+ */
+
+
View
@@ -30,14 +30,14 @@
* null-termination instead of lengths, this creates things that can be
* passed to those functions safely.
*/
-char *ghstrndup( char *s , int l )
+char *ghstrndup( char *s , size_t l )
{
char *colval = NULL ;
colval = malloc( l + 1 ) ;
if( !colval )
{
- fprintf( stderr , "Not enough memory: %d\n" , l ) ;
+ fprintf( stderr , "Not enough memory: %zu\n" , l ) ;
return NULL ;
}
memcpy( colval , s , l ) ;
View
@@ -7,4 +7,5 @@
*
*/
-char *ghstrndup( char *s , int l );
+char *ghstrndup( char *s , size_t l );
+

0 comments on commit ea3a1e6

Please sign in to comment.