LSPack 1.50 Compression Library - Linder Software

by Tom Hebenstreit, Review Editor

Published 1998-04-01    Printer-friendly version

Have you ever wanted to be able to compress and archive files from within your programs? Maybe to backup files or prepare multiple files as an attachment to email? Without having to shell out for PkZip, WinZip or some other external program? I have. I also looked into the cost of purchasing the Pkware ZIP compression libraries for 16 and 32-bit Windows (a cool $595 for the pair- and that's after the 15% discount for buying both versions). Gulp!

Granted, one could probably shop around and find them for a bit less, but one would still be faced with the usual pain of figuring out how to prototype them, etc., for use with Clarion. Aaargh. Shelling out to WinZip didn't sound so bad after all… until I heard of a product called LSPack from Linder Software.

Hmmm. Written for Clarion (no painful prototype conversions) – sounds good. Both 16 and 32-bit versions available for $99 US. Sounds even better. The big question, though, is always the same – how well does it work?

Let's take a look at the most recent version of LSPack - version 1.50 – and see how it stacks up…

Major Features

LSPack has an extensive array of features that pretty much cover all of the standard requirements for archiving, compressing and decompressing files or data. They include:

  • Support for both 16-bit and 32-bit Windows (Win 3.x, 95, NT).
  • Full support for multi-file archives.
  • Full support for long file names (LFN) under Windows 95 and NT.
  • Automatic LFN conversion if a file with a long name is unpacked under a version of Windows which doesn't support long file names (3.1, WFG, etc.). For example, "C:\My application\ Spiffy Program.exe" is automatically converted to a legal 8.3 filename according to the standard Windows 95 conventions like this: "C:\MYAPPL~1\SPIFFY~1.EXE".
  • Multiple options for storing the path along with a compressed file, including no path, absolute path and relative paths.
  • Five levels of compression from NONE (just stores the file) to MAXIMUM (squeezes out the last drop of extra space). You can mix and match the compression levels depending on the type of files you are compressing and how much speed you need (more compression always means more work for the libraries, hence slower performance).
  • Functions to add, update, delete and extract files from an archive. Flags can be set to simply perform the requested action or to prompt the user in case of a clash (if a file already exists, for example).
  • Data integrity support includes options for using temporary files when updating an archive, functions for testing the integrity of individual files, and the internal use of a CRC-32 function when storing and retrieving files to ensure the accuracy of the data.
  • Bonus functions are provided for creating directories, checking if a file or directory exists, temporary file handling, converting DOS file dates and times to Clarion, and more.
  • A real time 'message pump' can be used to update a progress bar and/or interrupt the library (i.e., cancel an action). This is a great feature, as it keeps the user from thinking your program has locked up, etc., when the library is compressing large files.
  • Highly optimized code, with critical sections coded in assembler for maximum speed and efficiency.
  • The pack and unpack libraries themselves are very small. In 16-bit, for example, the pack and unpack DLL's are only 40K and 36K respectively.
  • A free Visual Archiver is included. This is a very handy full-featured WinZip-like utility for creating, updating and otherwise manipulating LSPack archives. It also integrates with the Linder Software SFX Builder product that creates self-extracting archives AND complete, self-contained mini-installation programs.
  • The LSP Shell-Demo is also included (this one with source code). This program demonstrates a broad range of LSP functions and lets you manipulate LSPack archives. Consider it a sort of Visual Archiver Lite.

Unlike most Clarion third-party products, the LSPack libraries can also be used with any language that can call a DLL, such as Visual Basic, C++, Delphi and others. Linder Software does make the point, though, that LSPack was designed from the ground up for use with Clarion so there aren't the usual hassles with converting prototypes and so forth.

Finally, there are no runtime royalties required with LSPack.

What about ZIP?

Probably the most common question I have seen in regards to LSPack is whether or not the archive files it creates are compatible with the popular ZIP file format. In a word, the answer right now is no, they are not. The key phrase, though, is 'right now'. Linder Software says that they have already laid the groundwork for supporting ZIP files in a future version (probably to be sold separately from LSPack).

Personally, I like the fact that I can create archives that are NOT compatible with ZIP files. It provides a simple layer of protection for my archives from every wahoo with WinZip or a similar utility, without having to worry about encryption and passwords. If needed, I can always give selected users or administrators the LSP Visual Archiver, which is provided free with LSPack (more on the Visual Archiver later). This gives them easy to use, complete access while still keeping the files in a less common format.

Installation

LSPack is provided as a single-file, self-contained installation program which just happens to have been built with Linder Software's LSP SFX Builder. It is smart enough to sniff out the location of your Clarion installation (which in my case is on E drive) and make it the default. The LSPack help file, Visual Archiver and an uninstall option are automatically added to the Win 95 Programs menu, and the help file is automatically displayed once the installation is complete. All very nice touches.

An LSPACK directory structure is created which contains various portions of the product: Docs, Library, Samples (16 and 32-bit), etc. It does not, however place the LIB and DLLs in the usual places (your \Clarion4\BIN and \Clarion4\LIB directories). This means you either need to copy the files manually or add the LSPack\Library directory to your Clarion redirection (RED) file. On the plus side, the help file contains clear instructions and examples for both methods, so you can choose which one suits your style the best.

The LSPack templates, however, are correctly installed into your Clarion \Template directory and, as usual, you must register whichever versions you want to use (both Clarion and C4 ABC versions are provided).

Implementation

Depending on what your requirements are and which version of Clarion you are using, adding LSPack to an application can be either as easy as dropping in a template or an exercise in pure hand code.

Let's run through a few scenarios in order to give you a feel for what can be involved.

Clarion 2.x or C4 with the Clarion Templates

For these environments, LSPack is essentially all hand code. There is a global extension template that adds the LSPack libraries to your application, but other than that, you must write all of the file and archive handling code yourself. It is not difficult, and examples are provided, but it is definitely not a plug and play proposition.

To illustrate, here is a snippet of sample code that shows how to add a file to an archive:

!-- These variables are the file to add and the LSPack
! archive we want to add it to. By passing it an empty
! temp path, it will use the default temp directory.
  FileName = 'mytest.txt'
  ArchiveName = 'testing.lsp'
  TempPath = ''
!-- These are flags to tell LSPack how to handle the file.
! Here, we set flags to suppress messages, and to update
! the file in the archive if it already exists.
  CompressMode = LSP_SUPERIOR_COMPRESSION
  Flags = LSP_QUIET_MODE + LSP_UPDATE_ARCHIVE
!-- Now we make the actual call to LS_Pack to do the deed
  RetValue = LSP_Pack(FileName,ArchiveName,TempPath,|
                      CompressMode,Flags)
!-- Test the return code to see if it succeeded
  IF RetValue = 0 THEN
    MESSAGE('File: ' & FileName & ' has been added to: ' |
            & ArchiveName, 'LSPack Sample')
  ELSE
    MESSAGE('LSPack Error','Error Code: ' & RetValue)
  END

To process multiple files, you could use the standard Clarion Directory functions to retrieve a queue of filenames. By putting the above code into a routine or other procedure, you would call that code once for each file in the queue. To extract files from an archive, the LSPack library has a function similar to Directory, which you can use to step through the contents of the archive one file at a time.

As you can see, this isn't exactly rocket science, but it does require that you be comfortable with calling external functions and writing hand code.

Clarion 4 and the ABC Templates

For C4 and ABC, LSPack provides several control templates in addition to the ABC global extension. What do they do? How about:

  • Add a preformatted list box to display the contents of an archive
  • Add buttons to create, open and close an archive file whose contents are displayed in the list box
  • Add buttons to manipulate individual files in the open archive (Add, Delete, Extract and Test)
  • Add a button which brings up a screen where you can set most of the LSPack parameters (preferences) such as the type of compression, whether or not to prompt when files exist, file paths and much more.

Together, these four templates allow you to create pretty much a complete user-controlled archive system without writing a single line of code. Here is an example where I created an archive, added four files and had just pressed the 'Test File' button to verify the integrity of the highlighted file:

R_TH0501.GIF

create this procedure))

Additionally, there is another control template that can be used with the LSPack list box template, which you can use to create a simple backup system. Two buttons are placed - one to allow the user to select a directory to backup and another to restore a specific archive back to that directory.

You can, of course, also write as much hand code as you please to implement whatever exact functionality you need from the LSPack library.

Adding LSPack to Sterling Data's BackFlash Backup utility

Linder Software and Sterling Data have worked together to provide support for the LSPack library from within Sterling's nifty BackFlash file backup utility (see the February 98 issue of Clarion Online for a full review of BackFlash 3.1). In this case, utilizing the superior performance of LSPack is as easy as checking a box in the BackFlash templates.

Performance

Linder Software claims average compression of 50-80%, with text and database files sometimes compressing over 90%. If you look back at figure 1, you can see that the Clarion DAT file compressed about 70% while a similarly sized TPS format file compressed at a bit over 50%.

Why the 20% difference? In this case, it results from the fact that the TopSpeed driver already employs basic data compression natively. In contrast, the fixed record size of a DAT file tends to have a fair amount of space in it since all fields are sized to accommodate the largest possible piece of data. For example, a last name field may be 40 characters long, but the vast majority of names will take up a lot less space than that.

I mainly tested LSPack's performance by creating various sizes and types of LSP archives with the LSP Visual Archiver. This is, by the way, a great tool for working with LSP archives, and is a really nice addition to the LSPack package.

 Figure 2: LSPack Visual Archiver
LSPack Visual Archiver

Naturally, your mileage will vary depending on the types of files you are compressing and the amount of 'air' (blank or repetitive information) in them. Keep in mind that certain file formats (such as GIF images) are already very compressed and will hardly compress at all. In some cases, the processed file may end up larger than the original file since all you will have done is add the overhead of the compression method (this is true of PKZip as well, not just LSPack). For this type of file, LSPack provides a simple 'Store' option which doesn't even try to compress the file.

In any case, in my admittedly unscientific testing , LSPack's speed and compression abilities seemed quite comparable to the industry standard ZIP libraries. Most impressive.

Documentation

Documentation is provided in the form of an extensive Windows help file. The file includes complete documentation of all LSPack equates, structures, functions and classes, as well as other helpful sections such as questions and answers. Example code is included for most of the high level functions such as LSP_Pack() and LSP_UnPack().

The only confusing aspect of the documentation that I found was in Linder Software's use of the term 'low-level function' for what turned out to be the equates used in calls to the high level functions. I think it would be much clearer to simply call them what they are: Equated flags that are combined to turn off and on the various capabilities of the pack and unpack libraries.

A dozen or so example programs are provided, with separate versions for both 16 and 32 bit. In keeping with the current hand code nature of the product, about two thirds of the examples are pure source code with project files while the remainder are APP files.

As mentioned in a previous section, the source code for the LS Pack Shell-Demo is also included in the package and it is a great resource for seeing how virtually every capability of the LS Pack library is used in a real world program. Once again, though, no APP file - just pure source code.

No printed or printable documentation is provided. When I converted the help file to a Word document for printing, however, it came out to a very respectable 91 pages.

Technical Support

Technical support was excellent. Questions were answered promptly via email and Linder Software is very receptive to suggestions, often incorporating them into the next build of the product. One really gets the impression that they are totally dedicated to providing quality in their products and excellence in their support.

Summary

LSPack is a very impressive piece of work - small, fast, flexible and robust - for a very reasonable price. In its current form, it is definitely not a product for beginners, but Linder Software informed me that they plan to expand the templates which they provide in future versions of LSPack. This includes providing CW 2.x and C4 Clarion versions of the new C4 ABC templates which appeared in version 1.50. A good move, in my opinion, as that will go a long way towards making the product more accessible to a broader range of Clarion developers.

As an aside, the next version of the product is projected for mid-April, and will support the new features found in the just released v2.5 of the Visual Archiver, such as encryption and archive splitting/recombining (disk spanning). With the addition of these features, I would probably bump the 'Ability to do the task' score up to Excellent - it is close already.

Bottom line - if you have any need or interest in using archive and compression technology in your applications, definitely take a look at the LSPack compression libraries!

Category

Product Score

Ability to do the task

Very Good

Ease of use

ABC - Good
CW 2.x - Fair

Ease of Installation

Good

Documentation

Very Good

Technical Support

Excellent

Modifies Shipping Templates

No

Black-Box DLLs/LIBs

Yes

The LSPack libraries can be purchased for 16-bit only ($59 US), 32-bit only ($70 US) or in a bundle containing both the 16 and 32-bit versions ($99 US).

The $99 bundle is available through the TopSpeed Accessories program (1-800-354-5444). Linder Software also offers the various packages via CompuServe SWREG, email or via secure server through an online store (www.alberts.com).

Complete information and demos are available at the Linder Software web site: www.lindersoftware.com

Note: A demo of LSPack was provided to TopSpeed for inclusion on the C4 final CD-ROM, but it seems to have been damaged in the process (the files are all 0 bytes on the CD-ROM). Check out the Linder Software web site for the most current demos of all their products.

Review Comments from Linder Software
As the reviewer mentioned, we are working on LSP 1.60. The new version will include disk spanning (multiple volume archives) and data en-/decryption. LSP 1.60 is scheduled for release on April 15 and is free for current LSP users. We are also working on printable documentation, more APP example files, expanded templates and of course on ZIP compatibility.

Printer-friendly version

 
 

Search

 

Advanced Search
Topical Index

Related Articles

Subscribe to
ClarionMag

One year: $184

(includes all back issues since '99)

Renewals from $134

Two years: $274

Renewals from $224

More Info

Subscribe Now!

ClarionMag Blog

RSS Feeds

Updates via Email

Enter your Email


Powered by FeedBlitz

Quick Links