]> git.sesse.net Git - vlc/blob - src/misc/tests.c
* Header cleaning: filled all empty authors fields, added CVS $Id stuff.
[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.5 2001/03/21 13:42:34 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 "config.h"
31 #include "common.h"
32
33 #include "intf_msg.h"
34 #include "tests.h"
35
36 #include "main.h"
37
38 /*****************************************************************************
39  * TestVersion: tests if the given string equals the current version
40  *****************************************************************************/
41 int TestVersion( char * psz_version )
42 {
43     return( !strcmp( psz_version, VERSION ) );
44 }
45
46 /*****************************************************************************
47  * TestProgram: tests if the given string equals the program name
48  *****************************************************************************/
49 int TestProgram( char * psz_program )
50 {
51     return( !strcmp( psz_program, p_main->psz_arg0 ) );
52 }
53
54 /*****************************************************************************
55  * TestMethod: tests if the given method was requested
56  *****************************************************************************/
57 int TestMethod( char * psz_var, char * psz_method )
58 {
59     return( !strcmp( psz_method, main_GetPszVariable( psz_var, "" ) ) );
60 }
61
62 /*****************************************************************************
63  * TestCPU: tests if the processor has MMX support and other capabilities
64  *****************************************************************************/
65 int TestCPU( int i_capabilities )
66 {
67     return( (i_capabilities & p_main->i_cpu_capabilities) == i_capabilities );
68 }
69