# -*- Makefile -*- # # This is a make+ file. Make+ is a set of scripts which enhance GNU # make and let you build RPMs, and other package types with just one # control file. To build this package you will need to download make+ # from this site: http://www.annexia.org/freeware/makeplus/ PACKAGE := c2lib VERSION_MAJOR := 1 VERSION_MINOR := 4.2 VERSION := $(VERSION_MAJOR).$(VERSION_MINOR) SUMMARY := A library of useful functions for C. COPYRIGHT := GNU LGPL (see http://www.gnu.org/) AUTHOR := Richard Jones define DESCRIPTION c2lib is a library of useful functions which augment those found in the standard libc. It contains a pool allocator, many string functions, STL-like vector and hash types and miscellaneous utilities. endef RPM_REQUIRES := pcre >= 3.9 RPM_GROUP := Development/Libraries CFLAGS += -Wall -Werror -g -O2 -D_GNU_SOURCE ifneq ($(shell uname), SunOS) # Avoid a warning about reordering system include paths. CFLAGS += $(shell pcre-config --cflags) endif LIBS += $(shell pcre-config --libs) -lm OBJS := hash.o matvec.o pool.o pre.o pstring.o tree.o vector.o LOBJS := $(OBJS:.o=.lo) HEADERS := $(srcdir)/hash.h $(srcdir)/matvec.h \ $(srcdir)/pool.h $(srcdir)/pre.h $(srcdir)/pstring.h \ $(srcdir)/tree.h $(srcdir)/vector.h all: static dynamic manpages syms # Configure the system. configure: $(MP_CONFIGURE_START) $(MP_REQUIRE_PROG) pcre-config $(MP_CHECK_HEADERS) alloca.h assert.h ctype.h fcntl.h string.h unistd.h $(MP_CHECK_FUNCS) vasprintf $(MP_CONFIGURE_END) # Build the static library. static: libc2lib.a libc2lib.a: $(OBJS) $(MP_LINK_STATIC) $@ $^ # Build the dynamic library. dynamic: libc2lib.so libc2lib.so: $(LOBJS) $(MP_LINK_DYNAMIC) $@ $^ $(LIBS) # Build the manual pages. manpages: $(srcdir)/*.h if cdoc; then \ rm -f *.3; \ cdoc \ --author '$(AUTHOR)' \ --license '$(COPYRIGHT)' \ --version '$(PACKAGE)-$(VERSION)' \ $^; \ fi # Build the symbols table. syms: libc2lib.syms libc2lib.syms: libc2lib.so nm $< | sort | grep -i '^[0-9a-f]' | awk '{print $$1 " " $$3}' > $@ # Test. test: test_hash test_matvec test_pool test_pre test_pstring test_sash \ test_shash test_tree test_vector LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(MP_RUN_TESTS) $^ test_hash: test_hash.o $(CC) $(CFLAGS) $^ -o $@ -L. -lc2lib $(LIBS) test_matvec: test_matvec.o $(CC) $(CFLAGS) $^ -o $@ -L. -lc2lib $(LIBS) test_pool: test_pool.o $(CC) $(CFLAGS) $^ -o $@ $(LIBS) test_pre: test_pre.o $(CC) $(CFLAGS) $^ -o $@ -L. -lc2lib $(LIBS) test_pstring: test_pstring.o $(CC) $(CFLAGS) $^ -o $@ -L. -lc2lib $(LIBS) test_sash: test_sash.o $(CC) $(CFLAGS) $^ -o $@ -L. -lc2lib $(LIBS) test_shash: test_shash.o $(CC) $(CFLAGS) $^ -o $@ -L. -lc2lib $(LIBS) test_tree: test_tree.o $(CC) $(CFLAGS) $^ -o $@ -L. -lc2lib $(LIBS) test_vector: test_vector.o $(CC) $(CFLAGS) $^ -o $@ -L. -lc2lib $(LIBS) # Install. install: install -d $(DESTDIR)$(libdir) install -d $(DESTDIR)$(pkgincludedir) install -d $(DESTDIR)$(man3dir) install -d $(DESTDIR)$(datadir)/rws/symtabs/ $(MP_INSTALL_STATIC_LIB) libc2lib.a $(MP_INSTALL_DYNAMIC_LIB) libc2lib.so install -m 0644 $(HEADERS) $(DESTDIR)$(pkgincludedir) install -m 0644 *.3 $(DESTDIR)$(man3dir) install -m 0644 *.syms $(DESTDIR)$(datadir)/rws/symtabs/ force: define WEBSITE <% include page_header.msp %>

c2lib - a Perl/STL-like library of basics for C

c2lib is a library of basic tools for use by C programmers. It contains features heavily influenced by both Perl's string handling and C++'s Standard Template Library (STL). The library has been designed to be very easy to use and is fully documented in manual pages.

There is extensive documentation and a tutorial here.

Download

File Format Contents
$(PACKAGE)-$(VERSION).tar.gz tar.gz Latest source distribution
$(PACKAGE)-$(VERSION)-1.i686.rpm i686 binary RPM Binary development libraries, header files, man pages for Red Hat Linux
$(PACKAGE)-$(VERSION)-1.src.rpm source RPM Source files for Red Hat Linux

Dependencies:

Patches between versions ...

News

Sat Mar 1 2003: Created README and INSTALL files (thanks to David Chappell). Updated Makefile+ to work with the new version of make+. NB: The RPMs were built on Debian and may not work on Red Hat Linux.

Sat Feb 8 17:00:47 GMT 2003: Ported to Solaris, OpenBSD and FreeBSD (thanks to Jeremy Sowden and Richard Baker for help and equipment). Don't link c2lib itself into the test_pool program. Link test programs correctly with pcre.

Attn: Solaris has a library called libc2. I have had to rename this library to libc2lib, so you will need to link your programs against -lc2lib. I have also moved the header files into the c2lib/ subdirectory of includedir, so you may need to specify -I/usr/include/c2lib when building.

Sat Dec 7 17:18:02 GMT 2002: Updated to use the make+ build system.

Mon Nov 25 09:31:37 GMT 2002: Added symbols file for full symbol resolution in monolith.

Sun Nov 17 23:31:32 GMT 2002: Debian packages. Added MSP files. pmalloc now initialises memory to 0xefefefef so we can catch uninitialised memory problems. Further fixes to compile on RH 7.3. Added vector_push_back_vector etc.

Tue Oct 15 23:40:42 BST 2002: Multiple bug fixes.

Sun Oct 13 12:55:08 BST 2002: Added pmap and pgrep functions.

Tue Oct 8 16:18:02 BST 2002: Fix issues with building on Red Hat Linux 7.3 (thanks to Adam Monsen). The supplied RPM should now install on Red Hat Linux systems.

Sun Oct 6 18:07:39 BST 2002: Completely rewrote the pstr*split functions so they produce the same results as the Perl equivalents in all the corner cases. Added pstr*split2 functions (see the manual pages).

Sun Oct 6 13:00:39 BST 2002: Added a tree type (required by monolith). Removed the old pmatch* and psubst* functions. These were badly thought out and implemented. Replaced with precomp, prematch, presubst functions which are wrappers around the Perl Compatible Regular Expressions (PCRE) library. pstrresplit has also changed to use PCRE.

Sat Sep 7 15:24:32 BST 2002: Packages are now available as i686 binary RPMs and source RPMs.

Old news and old versions

Fri May 2 19:49:25 BST 2002

c2lib-1.2.14.tar.gz released. Added an extensive tutorial and online manual pages.

Thu Jun 21 23:12:26 BST 2001

c2lib-1.2.12.tar.gz released. Fixed psort function and updated documentation.

Fri Jun 15 15:40:35 BST 2001

c2lib-1.2.11.tar.gz released. Profiling support. Added pstrncat, psubst and psubstx functions. Fixed a memory leak and did rigorous memory leak checking -- I\'m pretty sure there are none left now. Removed arbitrary limit on number of substring matches in pmatch function. Documentation updates.

Mon Apr 9 17:18:38 BST 2001

c2lib-1.2.8.tar.gz released. Documentation fixes.

Wed Mar 28 14:25:42 BST 2001

c2lib-1.2.7.tar.gz released. Fixed a problem with calling isspace on Solaris (thanks to Tomonori Manome again).

Mon Mar 26 12:59:15 BST 2001

c2lib-1.2.6.tar.gz released. pstrresplit fixed. pvector and pvectora functions added: use these to quickly build vectors from lists of strings. ptrimfront, ptrimback and ptrim functions added for trimming whitespace from strings. pgetline* and pmatch* functions added which make it trivial to read in configuration files. new_subvector added for creating sub-vectors of existing vectors. Some minor const-correctness changes. Documentation updates. Test suite updates.

Mon Mar 19 11:40:34 GMT 2001

c2lib-1.2.3.tar.gz released. This adds the shash type: a mapping of strings to anything (another specialized hash). Port to Solaris/Intel and Solaris/Sparc (thanks to Tomonori Manome for this).

Mon Mar 12 12:12:49 GMT 2001

c2lib-1.2.1.tar.gz released. This fixes a bug in the way the library was calling pstrcat. Upgrading is highly recommended.

Fri Mar 9 17:26:45 GMT 2001

c2lib-1.2.0.tar.gz released. The pool allocator has been completely rewritten for this release, and is much more efficient.

Wed Mar 7 14:56:43 GMT 2001

c2lib-1.1.12.tar.gz released. Added pchrs and pstrs string functions. Added pvsprintf. Changed psprintf to make it much more memory efficient (it uses vasprintf(3) if available). Const-correctness fixes.

Fri Feb 16 17:46:41 GMT 2001

c2lib-1.1.10.tar.gz released. All functions are documented in manual pages.

<% include page_footer.msp %> endef upload_website: scp $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)-1.*.rpm \ $(PACKAGE)-$(VERSION).bin.tar.gz \ 10.0.0.248:annexia.org/freeware/$(PACKAGE)/ scp index.html \ 10.0.0.248:annexia.org/freeware/$(PACKAGE)/index.msp .PHONY: static dynamic manpages syms