File: misc.h

package info (click to toggle)
sim4 0.0.20121010-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,744 kB
  • ctags: 505
  • sloc: ansic: 5,807; makefile: 23; sh: 15
file content (48 lines) | stat: -rw-r--r-- 1,223 bytes parent folder | download | duplicates (6)
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
#ifndef SIM_MISC_H
#define SIM_MISC_H
/* $Id: misc.h,v 1.1 2000/06/05 22:25:12 florea Exp $ */

#ifdef __GNUC__
#define NORETURN __attribute__((__noreturn__))
#else
#define NORETURN /* */
#endif

#define CLEN(s) (sizeof((s))-1)

/*@exits@*/ void fatal(const char *msg) NORETURN;
/*@exits@*/ void fatalf(const char *fmt, ...) NORETURN;
/*@exits@*/ void fatalfr(const char *fmt, ...) NORETURN;
void debugf(const char *fmt, ...);
void debugff(const char *fmt, ...);

FILE *ckpopen(const char *name, const char *mode);
void ckpclose(FILE*);

FILE *ckopen(const char *name, const char *mode);
/*@only@*/ void *ckalloc(size_t amount);
/*@only@*/ void *ckallocz(size_t amount);
void *ckfree(void *p);
bool same_string(const char *s, const char *t);
char *copy_string(const char *s);
char *copy_substring(const char *s, int n);
long ckftell(FILE*);
int ckfseek(FILE*,long,int);
void *ckrealloc(void *, size_t);

#define ZFREE(p) /*CONSTCOND*/do{free(p);(p)=0;}while(0)

#ifndef RCSID
#define RCSID(id) static const char rcsid[] = id
#endif

#undef MAX
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#undef MIN
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#undef ICEIL
#define ICEIL(x,y) ((((x)-1)/(y))+1)

extern int psublast_debug;

#endif