File: stdinc.h

package info (click to toggle)
glam2 1064-9
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 956 kB
  • sloc: ansic: 6,925; xml: 757; asm: 74; makefile: 54; sh: 11
file content (65 lines) | stat: -rw-r--r-- 2,062 bytes parent folder | download | duplicates (4)
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
/* tlb 11/10/06; changes made to NEW functions to comply with ANSII standard;
  changed MIN, MAX to remove conflicts with macros of same names elsewhere
*/
/* defines.h - generic codes and constants for afn biosequence programs. */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include <float.h>
#include <math.h>

/* VALUES */
#define NIL    		-1
#define FALSE		0	
#define TRUE		1	

#define ILLEGAL		-1.0
#define BELL		((char) 7)	

#define FILE_BEGIN	0
#define FILE_CURRENT	1
#define FILE_END	2

#define Boolean		char

/* CONSTANTS */
#define MAX_INTEGER		LONG_MAX

/* MACROS - standard macro definitions and static types */
#define	MEW(x,n,t)	if ( (x=(t*) malloc(((n)*sizeof(t))))==NULL) { \
			  fprintf(stderr,"Out of Memory."); exit(1); }

#define	NEW(x,n,t)	if ( (x=(t*) calloc(n,sizeof(t)))==NULL ) { \
			  fprintf(stderr,"Out of Memory."); exit(1); }

#define	NEWP(x,n,t)	if ( (x=(t**) calloc(n,sizeof(t*)))==NULL) { \
			  fprintf(stderr,"Out of Memory."); exit(1); }

#define	NEWPP(x,n,t)	(( (x=(t***) calloc(n,sizeof(t**)))==NULL) ? \
			(t***) (fprintf(stderr,"Out of Memory."),exit(1),0):x)

#define	NEWP3(x,n,t)	(( (x=(t****) calloc(n,sizeof(t***)))==NULL) ? \
			(t****) (fprintf(stderr,"Out of Memory."),exit(1),0):x)

#define	GETCHAR(m,C)	do{ fprintf(stderr,"%s ", m); \
			  if(fscanf(stdin,"%c",(C)) == 1) { \
                	    while(getchar()!='\n') if(feof(stdin)) exit(1);\
			    break;\
 			  } while(getchar()!='\n') if(feof(stdin)) exit(1);\
			} while(TRUE);

#define	GETINT(m,i)	do{ fprintf(stderr,"%s ",m); \
			  if(fscanf(stdin,"%d",(i)) == 1) { \
                	    while(getchar()!='\n') if(feof(stdin)) exit(1);\
			    break;\
 			  } while(getchar()!='\n') if(feof(stdin)) exit(1);\
			} while(TRUE);

#define print_error(str) for(fprintf(stderr,"%s\n",str); TRUE; exit(1))
#define DIGIT2INT(c)    ((int)(c - 48))
#define tMIN(t,x,y)	(((t)(x) < (t)(y)) ? (t)(x) : (t)(y))
#define tMAX(t,x,y)	(((t)(x) > (t)(y)) ? (t)(x) : (t)(y))
#define SUM(x)		(((x) * (x+1)) / 2)