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