next up previous
Next: Decoding Functions Up: The UUDeview Decoding Library Previous: Options

General Functions

After describing all the framework in the previous chapters, it is time to mention some function calls. Still, the functions presented here don't actually do anything, they just query and modify the behavior of the core functions.

int UUInitialize (void)

This function initializes the library and must be called before any other decoding or encoding function. During initialization, several arrays are allocated. If memory is exhausted, UURET-_NOMEM is returned, otherwise the initialization will return successfully with UURET-_OK.
int UUCleanUp (void)

Cleans up all resources that have been allocated during a program run: memory structures, temporary files and everything. No library function may be called afterwards, with the exception of UUInitialize to start another run.
int UUGetOption (int opt, int *ival, char *cval, int len)

Retrieves the configuration option (see section 6) opt. If the option is integer, it is stored in ival (only if ival!=NULL) and also returned as return value. String options are copied to cval. Including the final nullbyte, at most len characters are written to cval. If the progress information is queried with UUOPT-_PROGRESS, cval must point to a uuprogress structure and len must equal sizeof(uuprogress).

For integer options, cval may be NULL and len 0 and vice versa: for string options, ival is not evaluated.

int UUSetOption (int opt, int ival, char *cval)

Sets one of the configuration options. Integer options are set via ival (cval may be NULL), and string options are copied from the null-terminated string cval (ival may be 0). Returns UURET-_ILLVAL if you try to set a read-only value, or UURET_OK otherwise.
char *UUstrerror (int errcode)

Maps the return values UURET_* into error messages:
UURET_OK
``OK''
UURET_IOERR
``File I/O Error''
UURET_NOMEM
``Not Enough Memory''
UURET_ILLVAL
``Illegal Value''
UURET_NODATA
``No Data found''
UURET_NOEND
``Unexpected End of File''
UURET_UNSUP
``Unsupported function''
UURET_EXISTS
``File exists''
int UUSetMsgCallback (void *opaque, void (*func) ())

Sets the Message Callback function to func (see section 3.2). opaque is the opaque data pointer that is passed untouched to the callback whenever it is called. To prevent compiler warnings, a prototype of the callback should appear before this line. Always returns UURET-_OK. If func==NULL, the callback is disabled.
int UUSetBusyCallback (void *, void (*func) (), long msecs)

Sets the Busy Callback function to func (see section 3.3). msecs gives a timespan in milliseconds; the library will try to call the callback after this timespan has passed. On some systems, the time can only be queried with second resolution - in that case, timing will be quite inaccurate. The semantics for the other two parameters are the same as in the previous function. If func==NULL, the busy callback is disabled.
int UUSetFileCallback (void *opaque, int (*func) ())

Sets the File Callback function to func (see section 3.4). Semantics identical to the previous two functions. There is no need to install a file callback if this feature isn't used.
int UUSetFNameFilter (void *opaque, char * (*func) ())

Sets the Filename Filter function to func (see section 3.5). Semantics identical to the previous three functions. If no filename filter is installed, any filename is accepted. This may result in failures to write a file because of an invalid filename.
char * UUFNameFilter (char *fname)

Calls the current filename filter on fname. This function is provided so that certain parts of applications do not need to know which filter is currently installed. This is handy for applications that are supposed to run on more than one system. If no filename filter is installed, the string itself is returned. Since a filename filter may return a pointer to static memory or a pointer into the parameter, the result from this function must not be written to.


next up previous
Next: Decoding Functions Up: The UUDeview Decoding Library Previous: Options
2002-04-15