File indexing completed on 2024-05-05 04:56:15

0001 #ifndef WM_HELPERS_H
0002 #define WM_HELPERS_H
0003 /*
0004  * This file is part of WorkMan, the civilized CD player library
0005  * Copyright (C) 1991-1997 by Steven Grimm <koreth@midwinter.com>
0006  * Copyright (C) by Dirk Försterling <milliByte@DeathsDoor.com>
0007  *
0008  * This library is free software; you can redistribute it and/or
0009  * modify it under the terms of the GNU Library General Public
0010  * License as published by the Free Software Foundation; either
0011  * version 2 of the License, or (at your option) any later version.
0012  *
0013  * This library is distributed in the hope that it will be useful,
0014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016  * Library General Public License for more details.
0017  *
0018  * You should have received a copy of the GNU Library General Public
0019  * License along with this library; if not, write to the Free
0020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0021  *
0022  * Here to be found: Prototypes. Including variable names to be easier
0023  * to read.
0024  * This is just one more step to a more modular and understandable code.
0025  *
0026  */
0027 
0028 /*
0029  * LibWorkMan message levels. I'm not sure how to call them all and which
0030  * use they should fulfill. This is not very urgent now, because there
0031  * aren't many messages in LibWorkMan now.
0032  */
0033 #define WM_MSG_LEVEL_NONE   0   /**/
0034 #define WM_MSG_LEVEL_ERROR  1   /**/
0035 #define WM_MSG_LEVEL_TWO    2
0036 #define WM_MSG_LEVEL_THREE  3
0037 #define WM_MSG_LEVEL_FOUR   4
0038 #define WM_MSG_LEVEL_INFO   5   /**/
0039 #define WM_MSG_LEVEL_SIX    6
0040 #define WM_MSG_LEVEL_VERB   7   /**/
0041 #define WM_MSG_LEVEL_EIGHT  8
0042 #define WM_MSG_LEVEL_DEBUG  9   /**/
0043 
0044 #define WM_MSG_LEVEL_ALL    0xf /**/
0045 /*
0046  * Message classes. This is somehow a definition of
0047  * the message's source.
0048  */
0049 
0050 #define WM_MSG_CLASS_PLATFORM   0x010
0051 #define WM_MSG_CLASS_SCSI   0x020
0052 #define WM_MSG_CLASS_CDROM      0x040
0053 #define WM_MSG_CLASS_DB     0x080
0054 #define WM_MSG_CLASS_MISC   0x100
0055 
0056 #define WM_MSG_CLASS_ALL    0xff0
0057 
0058 /*
0059  * I did not know any better place...
0060  */
0061 #ifdef DEBUG
0062 #define CHECKPOINT(t) fprintf(stderr, "%s (%d): %s\n", __FILE__, __LINE__, t );
0063 #else
0064 #define CHECKPOINT(t)
0065 #endif
0066 
0067 #ifdef __linux__
0068 #include <signal.h>
0069 /* Linux doesn't have a SIGEMT */
0070 #if !defined( SIGEMT )
0071 #  define SIGEMT SIGUNUSED
0072 #endif
0073 #endif /* linux */
0074 
0075 void        freeup( char **x );
0076 void        wm_strmcat( char **t, const char *s);
0077 void        wm_strmcpy( char **t, const char *s );
0078 char *      wm_strdup( char *s );
0079 /* Somebody's version query unsatisfied? */
0080 int     wm_libver_major( void );    /* return major internal version number */
0081 int     wm_libver_minor( void );    /* return minor internal version number */
0082 int     wm_libver_pl( void );       /* return internal patchlevel number */
0083 char *      wm_libver_name( void );     /* return internal name (LibWorkMan) */
0084 char *      wm_libver_number( void );   /* returns string: "<major>.<minor>.<pl>" */
0085 char *      wm_libver_string( void );   /* returns string: "<name> <number>" */
0086 char *      wm_libver_date( void );     /* returns string: date of compilation */
0087 void        wm_lib_set_verbosity( int level ); /* set verbosity level */
0088 int         wm_lib_get_verbosity( void );      /* get verbosity level */
0089 
0090 void        wm_lib_message( unsigned int level, const char *format, ... )
0091 #ifdef __GNUC__
0092     __attribute__ ((format(printf,2,3)))
0093 #endif
0094     ; /* put out a message on stderr */
0095 int     wm_susleep( int usec );
0096 
0097 #endif /* WM_HELPERS_H */