[Gambas-devel] Re: [Gambas-user] Zlib and BZlib

Benoit Minisini gambas at ...1...
Tue Mar 9 22:08:31 CET 2004


On Sunday 22 February 2004 19:42, Daniel Campos wrote:
> Hi all!
>
> These are the final versions of Zlib and BZLib components,
> that allows to compress data using zlib and bzlib2 libraries.
>
> I've implemented the bzlib component today, and made some changes
> in zlib component.
>
> Their interfaces are quite similar, however there are some differences:
>
> ZEngine has two methods to compress strings directly :
>
> 'DeflateString' and 'InflateString', that uses an algorithm a little
> different from Gzip one.
>
> BZEngine provides:
>
> 'BzipString'and 'BuzipString' which works exatly using the same bzip2
> format.
>
> This is due to the capabilities of both libraries.
>
> To compile these libraries:
>
> 0) You need gambas-0.84 or newer
> 1) Copy both 'zlib' and 'bzlib' folders to {gambas sources}/src/lib
> 2) Copy the attached configure.in to {gambas sources} instead of the
> original configure.in
> 3) Type : ./reconf
> 4) Type : ./configure (with your options)
> 5) Go to {gambas sources}/src/lib/zlib, then 'make' and 'make install'
> 6) Go to {gambas sources}/src/lib/bzlib, then 'make' and 'make install'
> 7) OK, done
>
> Regards,

Hi, Daniel,

Sorry for my late answer, I'm very busy these days...

I want to include the compression libraries in Gambas, but... :-)

I saw that BZEngine and ZEngine have actually the same interface, even if the
method names are not exactly the same. Maybe things can be unified there...

I suggest the following... Be careful ;-)

1) Create a component named gb.compress with two classes: Compress and
Uncompress. With the following methods:

Compress.File: compress a file
Compress.String: compress a string

Uncompress.File: uncompress a file
Uncompress.String: uncompress a string

Compress.Open: creates a stream.

Possibly a Compress.Type (a string) for the default library to use with the
previous functions...

And all the constants of course.

This component creates an internal interface named GB_COMPRESS_1 with a
gb.compress.h header. This interface allow registering drivers.

Look in the database component, it is exactly the same design.

2) Create two driver components, gb.compress.zlib and gb.compress.bzlib that
register drivers allowing Compress and Uncompress methods to call the real
functions.

I will modify the GB_STREAM declaration in gambas.h so that there is a place
in the structure for a private pointer. This way, your bzstream_ADD and
bzstream_FIND will become useless. Actually, there IS a place, I stupidely
forgot to declare it (all the structure except the two first longs).

Waiting for your comments,

Best regards,

--
Benoit Minisini
mailto:gambas at ...1...


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Gambas-user mailing list
Gambas-user at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user




More information about the Devel mailing list