NVBIO
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
open_trace_file.h
Go to the documentation of this file.
1 /*
2 Author: James Bonfield
3 
4 Copyright (c) 2000-2001 MEDICAL RESEARCH COUNCIL
5 All rights reserved
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10  . Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer.
12 
13  . Redistributions in binary form must reproduce the above copyright notice,
14 this list of conditions and the following disclaimer in the documentation
15 and/or other materials provided with the distribution.
16 
17  . Neither the name of the MEDICAL RESEARCH COUNCIL, THE LABORATORY OF
18 MOLECULAR BIOLOGY nor the names of its contributors may be used to endorse or
19 promote products derived from this software without specific prior written
20 permission.
21 
22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
23 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
26 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
29 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33 
34 /*
35 Copyright (c) 2008, 2009, 2013 Genome Research Ltd.
36 Author: James Bonfield <jkb@sanger.ac.uk>
37 
38 Redistribution and use in source and binary forms, with or without
39 modification, are permitted provided that the following conditions are met:
40 
41  1. Redistributions of source code must retain the above copyright notice,
42 this list of conditions and the following disclaimer.
43 
44  2. Redistributions in binary form must reproduce the above copyright notice,
45 this list of conditions and the following disclaimer in the documentation
46 and/or other materials provided with the distribution.
47 
48  3. Neither the names Genome Research Ltd and Wellcome Trust Sanger
49 Institute nor the names of its contributors may be used to endorse or promote
50 products derived from this software without specific prior written permission.
51 
52 THIS SOFTWARE IS PROVIDED BY GENOME RESEARCH LTD AND CONTRIBUTORS "AS IS" AND
53 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
54 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
55 DISCLAIMED. IN NO EVENT SHALL GENOME RESEARCH LTD OR CONTRIBUTORS BE LIABLE
56 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
58 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
59 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
60 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
61 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62 */
63 
64 #ifndef _OPEN_TRACE_FILE_H_
65 #define _OPEN_TRACE_FILE_H_
66 
67 #include "cram/mFILE.h"
68 
69 #ifdef __cplusplus
70 extern "C" {
71 #endif
72 
73 /*
74  * Tokenises the search path splitting on colons (unix) or semicolons
75  * (windows).
76  * We also explicitly add a "./" to the end of the search path
77  *
78  * Returns: A new search path with items separated by nul chars. Two nul
79  * chars in a row represent the end of the tokenised path.
80  * Returns NULL for a failure.
81  *
82  * The returned data has been malloced. It is up to the caller to free this
83  * memory.
84  */
85 char *tokenise_search_path(char *searchpath);
86 
87 /*
88  * Opens a trace file named 'file'. This is initially looked for as a
89  * pathname relative to a file named "relative_to". This may (for
90  * example) be the name of an experiment file referencing the trace
91  * file. In this case by passing relative_to as the experiment file
92  * filename the trace file will be picked up in the same directory as
93  * the experiment file. Relative_to may be supplied as NULL.
94  *
95  * 'file' is looked for at relative_to, then the current directory, and then
96  * all of the locations listed in 'path' (which is a colon separated list).
97  * If 'path' is NULL it uses the RAWDATA environment variable instead.
98  *
99  * Returns a mFILE pointer when found.
100  * NULL otherwise.
101  */
102 mFILE *open_path_mfile(char *file, char *path, char *relative_to);
103 
104 /*
105  * Returns a mFILE containing the entire contents of the url;
106  * NULL on failure.
107  */
108 mFILE *find_file_url(char *file, char *url);
109 
110 
111 #ifdef __cplusplus
112 }
113 #endif
114 
115 #endif /* _OPEN_TRACE_FILE_H_ */