home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
util
/
pplib-1.6.lha
/
PPlib
/
doc
/
pplib.doc
Wrap
Text File
|
1993-12-21
|
23KB
|
679 lines
TABLE OF CONTENTS
powerpacker.library/ppAllocCrunchInfo
powerpacker.library/ppCalcChecksum
powerpacker.library/ppCalcPasskey
powerpacker.library/ppCrunchBuffer
powerpacker.library/ppCrunchBufferDest
powerpacker.library/ppDecrunchBuffer
powerpacker.library/ppDecrypt
powerpacker.library/ppEnterPassword
powerpacker.library/ppErrorMessage
powerpacker.library/ppFreeCrunchInfo
powerpacker.library/ppGetPassword
powerpacker.library/ppLoadData
powerpacker.library/ppWriteDataHeader
powerpacker.library/ppAllocCrunchInfo powerpacker.library/ppAllocCrunchInfo
NAME ppAllocCrunchInfo() (V35)
crunchinfo = ppAllocCrunchInfo (efficiency, speedup, function, userdata);
APTR ppAllocCrunchInfo (ULONG, ULONG, BOOL (*)(), APTR);
D0 D0 D1 A0 A1
DESCRIPTION
Allocate all the necessary memory needed to crunch a buffer. This
function must be called before using ppCrunchBuffer. You must pass
the crunching efficiency and the size of the speedup buffer.
You can pass a callback function to be called during crunching. Use this
type of function:
BOOL __stdargs myFunction (ULONG lensofar, ULONG crunlen,
ULONG totlen, APTR userdata);
If you do not wish to use this feature pass a NULL. The function can be
used for two things:
o to display the percentage crunched and gain so far.
o to allow the user to abort crunching.
Your function will be passed four arguments (on the stack, normal C
conventions):
lensofar - length of part crunched so far.
crunlen - crunched length of lensofar.
totlen - total length of buffer.
userdata - the userdata you provided to ppAllocCrunchInfo().
If your function returns a non-zero value the crunching will continue,
returning zero will abort crunching.
SAS/C users shouldn't forget __saveds if they compiled their program with
the small data model and wish to use global data in their function.
If you write your function in assembly please preserve all registers.
Example:
BOOL __stdargs __saveds myfunc (ULONG sofar, ULONG crunlen,
ULONG totlen, APTR userdata)
{
struct IntuiMessage *msg;
UWORD code;
if (sofar) {
sprintf (buff, "%ld%% crunched. (%ld%% gain) ",
(sofar * 100) / totlen, 100 - (100 * crunlen) / sofar);
PrtMsg (buff, BLACK|AT_START);
}
while (msg = (struct IntuiMessage *)GetMsg (win->UserPort)) {
code = msg->Code;
ReplyMsg ((struct Message *)msg);
if (code == 0x3 /* CTRL-C */) return (FALSE);
}
return (TRUE);
}
Finally note that you may scratch the A4 register. This is made possible
to help people who wish to use 'userdata' to pass A4 (C data pointer).
INPUTS
efficiency - the efficiency of the crunching. One of the
following (defined in "libraries/ppbase.[hi]"):
CRUN_FAST
CRUN_MEDIOCRE
CRUN_GOOD
CRUN_VERYGOOD
CRUN_BEST
speedup - size of speedup buffer to be used. One of the
following (defined in "libraries/ppbase.[hi]"):
SPEEDUP_BUFFSMALL - from 3K (fast) to 33K (best)
SPEEDUP_BUFFMEDIUM - from 5K (fast) to 65K (best)
SPEEDUP_BUFFLARGE - from 196K (fast) to 256K (best)
function - callback function to be called every so often during
crunching. Can be used to display percentage crunched
so far and to abort crunching.
userdata - anything you wish. Will be passed to your callback function.
RESULT
crunchinfo - pointer to private crunchinfo structure to be passed to
ppCrunchBuffer (use ppFreeCrunchInfo to deallocate).
NOTE
'crunchinfo' may be re-used to crunch several buffers.
BUGS
none known
SEE ALSO
ppFreeCrunchInfo(), ppCrunchBuffer()
powerpacker.library/ppCalcChecksum powerpacker.library/ppCalcChecksum
NAME ppCalcChecksum()
sum = ppCalcChecksum (string);
ULONG ppCalcChecksum (char *);
D0:16 A0
DESCRIPTION
This function calculates a 16 bit checksum of a given string of
characters.
INPUTS
string - pointer to a null terminated character string.
RESULT
sum - checksum of 'string'.
NOTE
Function used to check if a password is correct.
Upper 16 bits of checksum are 0.
BUGS
none
SEE ALSO
ppLoadData()
ppDecrunchBuffer()
ppDecrypt()
ppCalcPasskey()
powerpacker.library/ppCalcPasskey powerpacker.library/ppCalcPasskey
NAME ppCalcPasskey()
key = ppCalcPasskey (password);
ULONG ppCalcPasskey (char *);
D0 A0
DESCRIPTION
This function calculates the 32 bit key associated with the given
password to encrypt/decrypt crunched files with.
INPUTS
string - pointer to a null terminated character string.
RESULT
key - passkey corresponding to the given password.
NOTE
Function used to decrypt encrypted files.
BUGS
none
SEE ALSO
ppDecrunchBuffer()
ppDecrypt()
ppCalcChecksum()
powerpacker.library/ppCrunchBuffer powerpacker.library/ppCrunchBuffer
NAME ppCrunchBuffer() (V35)
crunchedlen = ppCrunchBuffer (crunchinfo, buffer, len);
ULONG ppCrunchBuffer (APTR, UBYTE *, ULONG);
D0 A0 A1 D0
DESCRIPTION
Crunch the buffer pointed to by 'buffer' and of length (in bytes) 'len'.
'crunchinfo' must have been previously allocated by ppAllocCrunchInfo().
During crunching your callback function will be called (if you have
provided one). See the autodoc for ppAllocCrunchInfo() for more
information.
The value returned is the length of the crunched buffer. If you wish to
save this crunched buffer as a PowerPacker data file you should first
write the data header using ppWriteDataHeader() en then write the
crunched buffer.
INPUTS
crunchinfo - pointer to private crunchinfo structure returned by
ppAllocCrunchInfo().
buffer - pointer to buffer to be crunched.
len - length of buffer to be crunched.
RESULT
crunchedlen - length of crunched buffer. In case of an error
'crunchedlen' may also equal PP_CRUNCHABORTED or
PP_BUFFEROVERFLOW. Be sure to check this!
NOTE
Be sure you know what you are doing when you intend to use this function.
You can easily crash your Amiga by passing wrong arguments or by writing
a faulty callback function.
BUGS
none known
SEE ALSO
ppCrunchBufferDest(), ppAllocCrunchInfo(), ppFreeCrunchInfo()
powerpacker.library/ppCrunchBufferDest powerpacker.library/ppCrunchBufferDest
NAME ppCrunchBufferDest() (V36)
crunchedlen = ppCrunchBufferDest (crunchinfo, buffer, dest, len);
ULONG ppCrunchBufferDest (APTR, UBYTE *, UBYTE *, ULONG);
D0 A0 A1 A2 D0
DESCRIPTION
Crunch the buffer pointed to by 'buffer' and of length (in bytes) 'len'.
'crunchinfo' must have been previously allocated by ppAllocCrunchInfo().
The buffer will be crunched to the destination buffer you must provide.
The destination buffer must be at least as large as the original buffer.
During crunching your callback function will be called (if you have
provided one). See the autodoc for ppAllocCrunchInfo() for more
information.
The value returned is the length of the crunched buffer. If you wish to
save this crunched buffer as a PowerPacker data file you should first
write the data header using ppWriteDataHeader() en then write the
crunched destination buffer.
INPUTS
crunchinfo - pointer to private crunchinfo structure returned by
ppAllocCrunchInfo().
buffer - pointer to buffer to be crunched.
dest - pointer to buffer to store crunched data in.
len - length of buffer