JPRED-2 Add alscript to the Git repository
[jpred.git] / sources / alscript / src / gjutil.h
1 #ifndef GJ_UTIL_H
2 #define GJ_UTIL_H
3
4 /*
5 $Id: gjutil.h,v 1.2 1998/09/17 16:55:02 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 #define STD_FILES extern FILE *std_in,*std_out,*std_err
35
36 /* utility.h function definitions */
37
38 void *GJmalloc(size_t);
39 void *GJrealloc(void *,size_t);
40 void *GJmallocNQ(size_t);
41 void *GJreallocNQ(void *,size_t);
42 void GJfree(void *);
43 void GJerror(const char *);
44 char *GJstrdup(const char *);
45 char *GJstoupper(const char *);
46 char *GJstolower(const char *);
47 char *GJstoup(char *);
48 char *GJstolo(char *);
49
50 FILE *GJfopen(const char *, const char *,int);
51 int  GJfclose(FILE *,int);
52 GJFILE *GJfilemake(const char *name,const char *type,int action);
53 GJFILE *GJfilerename(GJFILE *ret_val, const char *name);
54 GJFILE *GJfileclose(GJFILE *ret_val,int action);
55 GJFILE *GJfileopen(GJFILE *ret_val,const char *type,int action);
56 GJFILE *GJfileclean(GJFILE *fval,int action);
57 void GJinitfile(void);
58
59 char *GJfnonnull(char *);
60 char *GJstrappend(char *,char *);
61 char *GJremovechar(char *,char);
62 char *GJremovechar2(char *string,char c);
63 char *GJstrcreate(size_t, char *);
64 char *GJstrlocate(char *,char *);
65 char *GJsubchar(char *,char,char);
66 char *GJstrtok(char *,const char *);
67 void error(const char *, int);
68 unsigned char **uchararr(int,int);
69 void ucharfree(unsigned char **array,int i);
70 signed   char **chararr(int,int);
71 void GJCinit(signed char **,int ,int ,char );
72 void mcheck(void *, char *);
73 char *GJstrblank(char *, int);
74 void GJUCinit(unsigned char **,int ,int ,unsigned char );
75 char *GJcat(int N,...);
76 struct tokens *GJgettokens(const char *delims, char *buff);
77 void GJfreetokens(struct tokens *tok);
78 char * GJtoktostr(struct tokens *tok, char delim, int s, int e);
79 void GJ_start_clock(void);
80 void GJ_stop_clock(FILE *fp);
81 char *GJstrrename(char *old,const char *new);
82 void GJindexx(int *arrin,int n,int *indx);
83
84 void GJpline(FILE *fp,char c,int n);
85 char *GJlocaltime(void);
86 void GJpstring(FILE *fp,char *s,int n);
87
88 IRANGE *irange(int *ivec, int n);
89
90 /*
91 $Log: gjutil.h,v $
92 Revision 1.2  1998/09/17 16:55:02  geoff
93 Check consistency with archive
94
95 Revision 1.5  1997/06/27 07:17:32  gjb
96 Added rlic.c linfo.h and
97 changes to gjutil.c to give better support for
98 token manipulation
99
100 Revision 1.4  1997/05/12 11:10:54  gjb
101 Re-added gjutil.c and gjutil.h to repository
102 after deleting them
103
104 Revision 1.2  1997/05/12 10:47:52  gjb
105 Modified CVS header and log position
106
107 */
108 #endif  /* GJ_UTIL_H */
109