JPRED-2 Add sources of all binaries (except alscript) to Git
[jpred.git] / sources / oc / gjutil.h
1 #ifndef GJ_UTIL_H
2 #define GJ_UTIL_H
3
4 /*
5 $Id: gjutil.h,v 1.1 2002/08/04 19:06:18 geoff Exp $
6 */
7
8 #include <stdio.h>
9
10
11 typedef int GJ_LIM;              /* type for limits - e.g. max buffer length */
12 typedef int GJ_PEN;              /* type for gap penalties */
13 typedef int GJ_FLG;              /* Flag type - usually just 1 or 0 */
14 typedef float GJ_FLOAT;          /* Single precision floating point type */
15 typedef double GJ_DBL;           /* a double precision floating point type */
16 typedef int GJ_S_COUNT;          /* small counter */
17 typedef long GJ_L_COUNT;         /* long counter */
18
19 typedef struct {                    /* structure to hold a filename and */
20   char *name;                    /* associated handle */
21   FILE *handle;
22 } GJFILE;
23
24 struct tokens {                  /* structure to hold tokens parsed from */
25   int ntok;                      /* string with strtok */
26   char **tok;
27 };
28
29 typedef struct {
30   int min;
31   int max;
32 } IRANGE;
33
34 typedef struct {
35   char *val;
36   int i;
37 } CWORK;
38
39 int Sworkcomp(const void *left, const void *right);
40 void GJindexxS(char **arrin,int n,int *indx);
41
42 #define STD_FILES extern FILE *std_in,*std_out,*std_err
43
44 /* utility.h function definitions */
45
46 void *GJmalloc(size_t);
47 void *GJrealloc(void *,size_t);
48 void *GJmallocNQ(size_t);
49 void *GJreallocNQ(void *,size_t);
50 void GJfree(void *);
51 void GJerror(const char *);
52 char *GJstrdup(const char *);
53 char *GJstoupper(const char *);
54 char *GJstolower(const char *);
55 char *GJstoup(char *);
56 char *GJstolo(char *);
57
58 FILE *GJfopen(const char *, const char *,int);
59 int  GJfclose(FILE *,int);
60 GJFILE *GJfilemake(const char *name,const char *type,int action);
61 GJFILE *GJfilerename(GJFILE *ret_val, const char *name);
62 GJFILE *GJfileclose(GJFILE *ret_val,int action);
63 GJFILE *GJfileopen(GJFILE *ret_val,const char *type,int action);
64 GJFILE *GJfileclean(GJFILE *fval,int action);
65 void GJinitfile(void);
66
67 char *GJfnonnull(char *);
68 char *GJstrappend(char *,char *);
69 char *GJremovechar(char *,char);
70 char *GJremovechar2(char *string,char c);
71 char *GJstrcreate(size_t, char *);
72 char *GJstrlocate(char *,char *);
73 char *GJsubchar(char *,char,char);
74 char *GJstrtok(char *,const char *);
75 void error(const char *, int);
76 unsigned char **uchararr(int,int);
77 void ucharfree(unsigned char **array,int i);
78 signed   char **chararr(int,int);
79 void GJCinit(signed char **,int ,int ,char );
80 void mcheck(void *, char *);
81 char *GJstrblank(char *, int);
82 void GJUCinit(unsigned char **,int ,int ,unsigned char );
83 char *GJcat(int N,...);
84 struct tokens *GJgettokens(const char *delims, char *buff);
85 void GJfreetokens(struct tokens *tok);
86 char * GJtoktostr(struct tokens *tok, char delim, int s, int e);
87 void GJ_start_clock(void);
88 void GJ_stop_clock(FILE *fp);
89 char *GJstrrename(char *old,const char *new);
90 void GJindexx(int *arrin,int n,int *indx);
91 void GJindexxD(double *arrin,int n,int *indx);
92 void GJindexxS(char **arrin,int n,int *indx);
93 int GJbsearchINXS(char **cod, int n, char *query);
94 int GJbsearchINX_IS(char **cod, int *inx, int n, char *query);
95
96 void GJpline(FILE *fp,char c,int n);
97 char *GJlocaltime(void);
98 void GJpstring(FILE *fp,char *s,int n);
99
100 IRANGE *irange(int *ivec, int n);
101
102 /*
103 $Log: gjutil.h,v $
104 Revision 1.1  2002/08/04 19:06:18  geoff
105 Add the gjutil programs to oc archive
106
107 Revision 1.1.1.1  2002/06/25 22:30:32  geoff
108 Import of gjnoc routines
109
110
111 Revision 1.7  2000/12/21 17:25:44  geoff
112 Add the option to output the sequence fragments from the multiple alignment
113 output option in fasta or pir format.  Unlike the block file output, these
114 fragments contain the complete sequence between the start and end points, including
115 any parts deleted in the alignment process.
116 Add appropriate commands to scanps_alias.dat, getpars and getcmd.
117
118 Revision 1.6  1999/11/17 21:06:47  geoff
119 Add setup_caleb and other changes to swpp2 and so on.
120
121 Revision 1.5  1997/06/27 07:17:32  gjb
122 Added rlic.c linfo.h and
123 changes to gjutil.c to give better support for
124 token manipulation
125
126 Revision 1.4  1997/05/12 11:10:54  gjb
127 Re-added gjutil.c and gjutil.h to repository
128 after deleting them
129
130 Revision 1.2  1997/05/12 10:47:52  gjb
131 Modified CVS header and log position
132
133 */
134 #endif  /* GJ_UTIL_H */
135