Mercurial > repos > dawe > srf2fastq
comparison srf2fastq/io_lib-1.12.2/io_lib/misc.h @ 0:d901c9f41a6a default tip
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
author | dawe |
---|---|
date | Tue, 07 Jun 2011 17:48:05 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:d901c9f41a6a |
---|---|
1 #ifndef _misc_h | |
2 #define _misc_h | |
3 | |
4 #include <stdio.h> | |
5 #include <stdarg.h> /* varargs needed for v*printf() prototypes */ | |
6 #include <sys/types.h> | |
7 | |
8 #include "io_lib/os.h" | |
9 #include "io_lib/xalloc.h" | |
10 | |
11 #ifdef __cplusplus | |
12 extern "C" { | |
13 #endif | |
14 | |
15 extern int is_directory(char * fn); | |
16 extern int is_file(char * fn); | |
17 extern int file_exists(char * fn); | |
18 extern int compressed_file_exists(char *fname); | |
19 extern int file_size(char * fn); | |
20 extern FILE *open_fofn(char *files); | |
21 extern char *read_fofn(FILE *fp); | |
22 extern void close_fofn(FILE *fp); | |
23 extern int fstrlen(char *f, int max_f); | |
24 extern void f2cstr(char *f, int max_f, char *c, int max_c); | |
25 extern void c2fstr(char *c, int max_c, char *f, int max_f); | |
26 extern char *mystrtok(char *s, char *ct); | |
27 extern char *myfind(char *file, char* searchpath, int (*found) (char *) ); | |
28 extern void crash (char* format,...); | |
29 extern void str_tolower (char *s); | |
30 extern void str_toupper (char *s); | |
31 extern char *fn_tail (char *s); | |
32 extern void fn_tolower (char *s); | |
33 extern void fn_toupper (char *s); | |
34 extern void shell_call(char *command, char *output, int len); | |
35 extern char *date_str(void); | |
36 #ifdef NOSTRDUP | |
37 extern char *strdup(const char *s); | |
38 #endif | |
39 #ifdef NOSTRSTR | |
40 extern char *strstr(char *cs, char *ct); | |
41 #endif | |
42 | |
43 #ifdef NOMEMMOVE | |
44 #define memmove(d,s,l) bcopy(s,d,l) | |
45 #endif | |
46 extern int myusleep(unsigned int useconds); | |
47 | |
48 extern void errout(char *fmt, ...); | |
49 extern void messout(char *fmt, ...); | |
50 | |
51 /* | |
52 * Useful macros | |
53 */ | |
54 #define findfile(F,S) myfind((F),(S),file_exists) | |
55 /*is_file fails for symbolic links*/ | |
56 /*#define findfile(F,S) myfind((F),(S),is_file)*/ | |
57 | |
58 #if defined(min) | |
59 #undef min | |
60 #undef max | |
61 #endif | |
62 | |
63 #define min(A,B) ( ( (A) < (B) ) ? (A) : (B) ) | |
64 #define max(A,B) ( ( (A) > (B) ) ? (A) : (B) ) | |
65 #define sgn(A) ( (A) ? ( ( (A) < 0 ) ? -1 : 1 ) : 0 ) | |
66 | |
67 #ifdef MIN | |
68 #undef MIN | |
69 #endif | |
70 #define MIN(A,B) ( ( (A) < (B) ) ? (A) : (B) ) | |
71 #ifdef MAX | |
72 #undef MAX | |
73 #endif | |
74 #define MAX(A,B) ( ( (A) > (B) ) ? (A) : (B) ) | |
75 #define SGN(A) ( (A) ? ( ( (A) < 0 ) ? -1 : 1 ) : 0 ) | |
76 #define ABS(A) ( (A) < 0 ? -(A) : (A) ) | |
77 | |
78 /* Number of elements in array */ | |
79 #define Number(A) ( sizeof(A) / sizeof((A)[0]) ) | |
80 | |
81 /* | |
82 * Things taken from the new gap text_output.h. They'll be used globally | |
83 * across all the programs in the end. | |
84 */ | |
85 | |
86 /* | |
87 * Usage: verror(priority, format, args...); | |
88 * NB: don't pass more than 8K per call | |
89 */ | |
90 #define ERR_WARN 0 | |
91 #define ERR_FATAL 1 | |
92 void verror(int priority, char *name, char *fmt, ...); | |
93 | |
94 /* | |
95 * Usage: vmessage(format, args...); | |
96 * NB: don't pass more than 8K per call | |
97 */ | |
98 void vmessage(char *fmt, ...); | |
99 | |
100 /* | |
101 * Adds a new header to the text output window. | |
102 */ | |
103 void vfuncheader(char *fmt, ...); | |
104 | |
105 /* | |
106 * As vfuncheader, but only outputting when necessary. | |
107 */ | |
108 void vfuncgroup(int group, char *fmt, ...); | |
109 | |
110 #ifdef __cplusplus | |
111 } | |
112 #endif | |
113 | |
114 #endif /*_misc_h*/ |