]> git.sesse.net Git - vlc/blob - src/misc/tests.c
dc406cf7a3cbaaecd8b9d84bef3e4df3eb71b440
[vlc] / src / misc / tests.c
1 /*****************************************************************************
2  * tests.c: several test functions needed by the plugins
3  * Functions are prototyped in tests.h.
4  *****************************************************************************
5  * Copyright (C) 2000 VideoLAN
6  * $Id: tests.c,v 1.6 2001/04/06 09:15:48 sam Exp $
7  *
8  * Authors: Samuel Hocevar <sam@via.ecp.fr>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  * 
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
23  *****************************************************************************/
24
25 /*****************************************************************************
26  * Preamble
27  *****************************************************************************/
28 #include "defs.h"
29
30 #include <string.h>                                    /* memcpy(), memset() */
31
32 #include "config.h"
33 #include "common.h"
34
35 #include "intf_msg.h"
36 #include "tests.h"
37
38 #include "main.h"
39
40 /*****************************************************************************
41  * TestVersion: tests if the given string equals the current version
42  *****************************************************************************/
43 int TestVersion( char * psz_version )
44 {
45     return( !strcmp( psz_version, VERSION ) );
46 }
47
48 /*****************************************************************************
49  * TestProgram: tests if the given string equals the program name
50  *****************************************************************************/
51 int TestProgram( char * psz_program )
52 {
53     return( !strcmp( psz_program, p_main->psz_arg0 ) );
54 }
55
56 /*****************************************************************************
57  * TestMethod: tests if the given method was requested
58  *****************************************************************************/
59 int TestMethod( char * psz_var, char * psz_method )
60 {
61     return( !strcmp( psz_method, main_GetPszVariable( psz_var, "" ) ) );
62 }
63
64 /*****************************************************************************
65  * TestCPU: tests if the processor has MMX support and other capabilities
66  *****************************************************************************/
67 int TestCPU( int i_capabilities )
68 {
69     return( (i_capabilities & p_main->i_cpu_capabilities) == i_capabilities );
70 }
71