[Toxine-cvs] CVS: toxine/src errors.c,NONE,1.1 errors.h,NONE,1.1
Brought to you by:
f1rmb
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-27 00:43:05
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv837 Added Files: errors.c errors.h Log Message: oops, forgotten files --- NEW FILE: errors.c --- /* ** Copyright (C) 2002-2004 Daniel Caujolle-Bert <seg...@cl...> ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <stdio.h> #include <stdlib.h> #include "common.h" static struct error_codes_s { char *descr; toxine_error_code_t code; } error_codes[] = { #warning Write real description { "TOX_ERR_SUCCESS", TOX_ERR_SUCCESS }, { "TOX_ERR_DEADLOCK", TOX_ERR_DEADLOCK }, { "TOX_ERR_SEGFAULT", TOX_ERR_SEGFAULT }, { "TOX_ERR_SIGINT", TOX_ERR_SIGINT }, { "TOX_ERR_SIGTERM", TOX_ERR_SIGTERM }, { "TOX_ERR_SIGQUIT", TOX_ERR_SIGQUIT }, { "TOX_ERR_INTERNAL", TOX_ERR_INTERNAL }, { "TOX_ERR_BAD_CMDLINE", TOX_ERR_BAD_CMDLINE }, { "TOX_ERR_UNKNOWN_CMD", TOX_ERR_UNKNOWN_CMD }, { "TOX_ERR_WRONG_SYNTAX", TOX_ERR_WRONG_SYNTAX }, { "TOX_ERR_MISSING_STEP", TOX_ERR_MISSING_STEP }, { "TOX_ERR_SURNUM_STEP", TOX_ERR_SURNUM_STEP }, { "TOX_ERR_NO_VOP", TOX_ERR_NO_VOP }, { "TOX_ERR_VOP_FAILURE", TOX_ERR_VOP_FAILURE }, { "TOX_ERR_AOP_FAILURE", TOX_ERR_AOP_FAILURE }, { "TOX_ERR_WRONG_VERSION", TOX_ERR_WRONG_VERSION }, { "TOX_ERR_XINE_GET_ERROR", TOX_ERR_XINE_GET_ERROR }, /* xine API */ { "TOX_ERR_XINE_OPEN_VIDEO_DRIVER", TOX_ERR_XINE_OPEN_VIDEO_DRIVER }, { "TOX_ERR_XINE_OPEN_AUDIO_DRIVER", TOX_ERR_XINE_OPEN_AUDIO_DRIVER }, { "TOX_ERR_XINE_STREAM_NEW", TOX_ERR_XINE_STREAM_NEW }, { "TOX_ERR_XINE_OPEN", TOX_ERR_XINE_OPEN }, { "TOX_ERR_XINE_PLAY", TOX_ERR_XINE_PLAY }, { "TOX_ERR_XINE_TRICK_MODE", TOX_ERR_XINE_TRICK_MODE }, { "TOX_ERR_XINE_GET_AUDIO_LANG", TOX_ERR_XINE_GET_AUDIO_LANG }, { "TOX_ERR_XINE_GET_SPU_LANG", TOX_ERR_XINE_GET_SPU_LANG }, { "TOX_ERR_XINE_GET_POS_LENGTH", TOX_ERR_XINE_GET_POS_LENGTH }, { "TOX_ERR_XINE_GET_LOG_NAMES", TOX_ERR_XINE_GET_LOG_NAMES }, { "TOX_ERR_XINE_CONFIG_GET_FIRST_ENTRY", TOX_ERR_XINE_CONFIG_GET_FIRST_ENTRY }, { "TOX_ERR_XINE_CONFIG_GET_NEXT_ENTRY", TOX_ERR_XINE_CONFIG_GET_NEXT_ENTRY }, { "TOX_ERR_XINE_CONFIG_LOOKUP_ENTRY", TOX_ERR_XINE_CONFIG_LOOKUP_ENTRY }, { "TOX_ERR_XINE_GET_VERSION_STRING", TOX_ERR_XINE_GET_VERSION_STRING }, { "TOX_ERR_XINE_CHECK_VERSION", TOX_ERR_XINE_CHECK_VERSION }, { "TOX_ERR_XINE_GET_CURRENT_FRAME", TOX_ERR_XINE_GET_CURRENT_FRAME }, { NULL, 0 } }; void toxine_print_error_codes(toxine_t *tox) { int i; pout("Return codes are:\n"); for(i = 0; error_codes[i].descr; i++) pout("%3d => \t%s\n", error_codes[i].code, error_codes[i].descr); pout("--\n"); } const char *toxine_get_error_description(toxine_t *tox, toxine_error_code_t err) { int i; for(i = 0; error_codes[i].descr; i++) { if(error_codes[i].code == err) { return error_codes[i].descr; } } return NULL; } --- NEW FILE: errors.h --- /* ** Copyright (C) 2002-2004 Daniel Caujolle-Bert <seg...@cl...> ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** */ #ifndef __TOXINE_ERRORS_H__ #define __TOXINE_ERRORS_H_ #include "common.h" typedef enum { TOX_ERR_SUCCESS, /* Everything was fine */ TOX_ERR_DEADLOCK, /* Deadlock happened */ TOX_ERR_SEGFAULT, /* SEGFAULT received */ TOX_ERR_SIGINT, /* SIGINT received */ TOX_ERR_SIGTERM, /* SIGTERM received */ TOX_ERR_SIGQUIT, /* SIGQUIT received */ TOX_ERR_INTERNAL, /* Toxine internal error */ TOX_ERR_BAD_CMDLINE, /* Wrong command line option passed */ TOX_ERR_UNKNOWN_CMD, /* Unknown command */ TOX_ERR_WRONG_SYNTAX, /* Wrong syntax */ TOX_ERR_MISSING_STEP, /* One step is missing in commands execution */ TOX_ERR_SURNUM_STEP, /* One step is already done, and can't be twice */ TOX_ERR_NO_VOP, /* No output plugins found */ TOX_ERR_VOP_FAILURE, /* Video Ouput Plugin failed to initialize */ TOX_ERR_AOP_FAILURE, /* Audio Output Plugin failed to initialize */ TOX_ERR_WRONG_VERSION, /* Wrong version of xine-lib */ TOX_ERR_XINE_GET_ERROR = 100, /* xine_get_error returned != XINE_ERROR_NONE */ /* xine's fonctions error code, self explanatory */ TOX_ERR_XINE_OPEN_VIDEO_DRIVER, TOX_ERR_XINE_OPEN_AUDIO_DRIVER, TOX_ERR_XINE_STREAM_NEW, TOX_ERR_XINE_OPEN, TOX_ERR_XINE_PLAY, TOX_ERR_XINE_TRICK_MODE, TOX_ERR_XINE_GET_AUDIO_LANG, TOX_ERR_XINE_GET_SPU_LANG, TOX_ERR_XINE_GET_POS_LENGTH, TOX_ERR_XINE_GET_LOG_NAMES, TOX_ERR_XINE_CONFIG_GET_FIRST_ENTRY, TOX_ERR_XINE_CONFIG_GET_NEXT_ENTRY, TOX_ERR_XINE_CONFIG_LOOKUP_ENTRY, TOX_ERR_XINE_GET_VERSION_STRING, TOX_ERR_XINE_CHECK_VERSION, TOX_ERR_XINE_GET_CURRENT_FRAME, } toxine_error_code_t; void toxine_print_error_codes(toxine_t *tox); const char *toxine_get_error_description(toxine_t *tox, toxine_error_code_t err); #endif |