pxlib is shared C library to read various Paradox files.

WWW: http://pxlib.sourceforge.net
This commit is contained in:
Sergey Matveychuk 2005-12-11 10:33:44 +00:00
parent 37079e6393
commit 29a419d4a6
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=150863
7 changed files with 178 additions and 0 deletions

View File

@ -319,6 +319,7 @@
SUBDIR += postgresql81-server
SUBDIR += postgresql_autodoc
SUBDIR += puredb
SUBDIR += pxlib
SUBDIR += pxtools
SUBDIR += py-MySQL
SUBDIR += py-MySQLdb

61
databases/pxlib/Makefile Normal file
View File

@ -0,0 +1,61 @@
# New ports collection makefile for: pxlib
# Date created: 10 December 2005
# Whom: Sergey Matveychuk <sem@FreeBSD.org>
#
# $FreeBSD$
#
PORTNAME= pxlib
PORTVERSION= 0.5.1
CATEGORIES= databases
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}
MAINTAINER= sem@FreeBSD.org
COMMENT= C library to read various Paradox files
BUILD_DEPENDS= ${SITE_PERL}/${PERL_ARCH}/XML/Parser.pm:${PORTSDIR}/textproc/p5-XML-Parser
USE_GMAKE= yes
USE_AUTOTOOLS= libtool:15
INSTALLS_SHLIB= yes
USE_ICONV= yes
USE_GETTEXT= yes
USE_REINPLACE= yes
GNU_CONFIGURE= yes
CONFIGURE_ENV= CPPFLAGS=-I${LOCALBASE}/include LDFLAGS=-L${LOCALBASE}/lib
CONFIGURE_TARGET= --build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
OPTIONS= DOCS "Build and install documentation" off
.include <bsd.port.pre.mk>
.if defined(WITH_DOCS)
BUILD_DEPENDS= docbook-to-man:${PORTSDIR}/textproc/docbook-to-man \
docbook2man:${PORTSDIR}/textproc/docbook-utils
MAN3= PX_add_primary_index.3 PX_close.3 PX_close_blob.3 \
PX_create_blob_file.3 PX_create_file.3 PX_create_fp.3 \
PX_delete.3 PX_get_data_alpha.3 PX_get_data_bcd.3 \
PX_get_data_blob.3 PX_get_data_byte.3 PX_get_data_bytes.3 \
PX_get_data_double.3 PX_get_data_graphic.3 PX_get_data_long.3 \
PX_get_data_short.3 PX_get_field.3 PX_get_fields.3 \
PX_get_majorversion.3 PX_get_minorversion.3 PX_get_num_fields.3 \
PX_get_num_records.3 PX_get_opaque.3 PX_get_parameter.3 \
PX_get_record.3 PX_get_record2.3 PX_get_recordsize.3 \
PX_get_subminorversion.3 PX_get_value.3 PX_new.3 \
PX_new2.3 PX_new3.3 PX_new_blob.3 PX_open_blob_file.3 \
PX_open_blob_fp.3 PX_open_file.3 PX_open_fp.3 PX_open_gsf.3 \
PX_put_data_alpha.3 PX_put_data_bcd.3 PX_put_data_byte.3 \
PX_put_data_bytes.3 PX_put_data_double.3 PX_put_data_long.3 \
PX_put_data_short.3 PX_put_record.3 PX_put_recordn.3 \
PX_read_blobdata.3 PX_read_primary_index.3 PX_set_blob_file.3 \
PX_set_inputencoding.3 PX_set_parameter.3 PX_set_tablename.3 \
PX_set_targetencoding.3 PX_set_value.3 PX_strdup.3 \
PX_timestamp2string.3 PX_write_primary_index.3 pxlib.3
.else
pre-build:
${REINPLACE_CMD} -e 's/^DOCDIR =.*/DOCDIR =/' ${WRKSRC}/Makefile
.endif
.include <bsd.port.post.mk>

3
databases/pxlib/distinfo Normal file
View File

@ -0,0 +1,3 @@
MD5 (pxlib-0.5.1.tar.gz) = 38f049b2ffe9370f98e1cf755d18a3fb
SHA256 (pxlib-0.5.1.tar.gz) = 21b6c7355fb4ba82a4f002b0f931d8798268932c44797216e5ec6dedbbf6f540
SIZE (pxlib-0.5.1.tar.gz) = 463159

View File

@ -0,0 +1,11 @@
--- Makefile.in.orig Sat Dec 10 22:27:50 2005
+++ Makefile.in Sat Dec 10 22:29:15 2005
@@ -250,7 +250,7 @@
EXTRA_DIST = intltool-extract.in intltool-merge.in intltool-update.in $(spec) $(spec).in autogen.sh pxlib.pc.in
#all-local: $(spec)
-pkgconfigdir = $(libdir)/pkgconfig
+pkgconfigdir = @prefix@/libdata/pkgconfig
pkgconfig_DATA = pxlib.pc
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive

View File

@ -0,0 +1,85 @@
--- src/px_io.c.orig Sun Dec 11 13:12:58 2005
+++ src/px_io.c Sun Dec 11 13:13:26 2005
@@ -346,82 +346,6 @@
*/
size_t px_mb_write(pxblob_t *p, pxstream_t *dummy, size_t len, void *buffer) {
return(p->mb_stream->write(p->pxdoc, p->mb_stream, len, buffer));
- pxdoc_t *pxdoc;
- pxhead_t *pxh;
- pxstream_t *pxs;
- long pos;
- int ret;
- unsigned char *tmpbuf = NULL;
- unsigned int blockslen, blockoffset;
-
- pxdoc = p->pxdoc;
- pxh = pxdoc->px_head;
- pxs = p->mb_stream;
-
- if (pxh->px_encryption == 0)
- return pxs->write(pxdoc, pxs, len, buffer);
-
- pos = pxs->tell(pxdoc, pxs);
- if (pos < 0) {
- return pos;
- }
-
- blockoffset = (pos >> BLOCKSIZEEXP) << BLOCKSIZEEXP;
- /* We need to read at least chunk from the blockoffset till the
- * desired postion and the data itself which has len bytes.
- * e.g. if we want to read 20 bytes starting at position 300 in the
- * file, we will need to read 44+20 bytes starting at position 256.
- */
- blockslen = len + pos - blockoffset;
- /* Check if the end of the data is within a 2^BLOCKSIZEEXP bytes block.
- * If that is the case, we will need to read the remainder of the
- * 2^BLOCKSIZEEXP bytes block as well. In the above example, we
- * will have to read 256 bytes instead of just 64.
- */
- if(blockslen & 0xff)
- blockslen = ((blockslen >> BLOCKSIZEEXP) + 1) << BLOCKSIZEEXP;
-
- assert(blockslen >= len);
- assert(blockoffset <= (unsigned long)pos);
- assert((blockoffset+blockslen) >= (pos+len));
-
- ret = pxs->seek(pxdoc, pxs, blockoffset, SEEK_SET);
- if (ret < 0) {
- return ret;
- }
-
- tmpbuf = (unsigned char *) malloc(blockslen);
- if (tmpbuf == NULL) {
- return -ENOMEM;
- }
-
- ret = pxs->read(pxdoc, pxs, blockslen, tmpbuf);
- if (ret < 0) {
- goto end;
- }
-
- px_decrypt_mb_block(tmpbuf, tmpbuf, pxh->px_encryption, blockslen);
- memcpy(tmpbuf + (pos - blockoffset), buffer, len);
- px_encrypt_mb_block(tmpbuf, tmpbuf, pxh->px_encryption, blockslen);
-
- ret = pxs->seek(pxdoc, pxs, blockoffset, SEEK_SET);
- if (ret < 0) {
- return ret;
- }
- ret = pxs->write(pxdoc, pxs, blockslen, tmpbuf);
- if (ret < 0) {
- goto end;
- }
-
- ret = pxs->seek(pxdoc, pxs, pos + len, SEEK_SET);
- if (ret < 0) {
- goto end;
- }
-
- ret = len;
-end:
- free(tmpbuf);
- return ret;
}
/* }}} */

View File

@ -0,0 +1,7 @@
pxlib is shared C library to read various Paradox files. Currently .DB
files are best supported. pxlib provides a very simple api to read the
header and the data records of Paradox files. I also provides functions
to convert the data into the hosts data format (little or big endian).
WWW: http://pxlib.sourceforge.net
Author: Uwe Steinmann <uwe@steinmann.cx>

10
databases/pxlib/pkg-plist Normal file
View File

@ -0,0 +1,10 @@
include/paradox-gsf.h
include/paradox-mp.h
include/paradox.h
include/pxversion.h
lib/libpx.a
lib/libpx.so
lib/libpx.so.5
libdata/pkgconfig/pxlib.pc
share/locale/de/LC_MESSAGES/pxlib.mo
share/locale/es/LC_MESSAGES/pxlib.mo