File: mapping.c

package info (click to toggle)
libticables3 3.9.6-10
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,656 kB
  • ctags: 2,184
  • sloc: ansic: 15,996; sh: 9,298; makefile: 526; yacc: 288; awk: 145; sed: 16
file content (90 lines) | stat: -rw-r--r-- 2,396 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/* Hey EMACS -*- linux-c -*- */
/* $Id: mapping.c 691 2004-05-09 20:36:24Z roms $ */

/*  libticables - Ti Link Cable library, a part of the TiLP project
 *  Copyright (C) 1999-2004  Romain Lievin
 *
 *  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.
 */

/* Resources mapping wrapper */

/*
  This unit compiles cable type and resources to determine the best way to use
  the link cable:
  - I/O method
  - cable access.  
  It also permforms link cable (un)registering.
*/

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#if defined(__LINUX__)
#include "linux/linux_mapping.c"
#elif defined(__MACOSX__)
#include "macos/macos_mapping.c"
#elif defined(__BSD__)
#include "bsd/bsd_mapping.c"
#elif defined(__WIN32__)
#include "win32/win32_mapping.c"
#else
#include "none.h"
#endif


int mapping_get_method(TicableType type, int resources, TicableMethod *method)
{
	int ret;
	
#if defined(__LINUX__)
	ret = linux_get_method(type, resources, method);
#elif defined(__BSD__)
	ret = bsd_get_method(type, resources, method);
#elif defined(__WIN32__)
	ret = win32_get_method(type, resources, method);
#elif defined(__MACOSX__)
	ret = macos_get_method(type, resources, method);
#else
	ret = 0;
#endif
  	return ret;
}

int mapping_register_cable(TicableType type, TicableLinkCable *lc)
{
	int ret;
	
#if defined(__LINUX__)
	ret = linux_register_cable(type, lc);
#elif defined(__BSD__)
	ret = bsd_register_cable(type, lc);
#elif defined(__WIN32__)
	ret = win32_register_cable(type, lc);
#elif defined(__MACOSX__)
	ret = macos_register_cable(type, lc);
#else
	ret = 0;
#endif
  	return ret;
}

int nul_register_cable(TicableLinkCable * lc);

int mapping_unregister_cable(TicableLinkCable *lc)
{
	return nul_register_cable(lc);	
}