File: zmisc.h

package info (click to toggle)
libzia 4.36-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,320 kB
  • sloc: ansic: 24,172; sh: 4,408; makefile: 211
file content (88 lines) | stat: -rw-r--r-- 1,731 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
    Misc functions
    Copyright (C) 2012-2014 Ladislav Vaiz <ok1zia@nagano.cz>

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    version 2 as published by the Free Software Foundation.

*/

#ifndef __ZMISC_H
#define __ZMISC_H

#include <libziaint.h>
#include <glib.h>

#ifdef Z_HAVE_TERMIOS
#ifdef Z_CYGWIN
void cfmakeraw (struct termios *);
#endif
#endif

#ifdef Z_MSC_MINGW
#include <windows.h>
#include <process.h>
#endif


char *z_strdup_home(void);

#ifdef Z_MSC_MINGW
int setenv(const char *name, const char *value, int overwrite);
#endif

char *z_username(char *buf, int buflen);
void z_get_settings(GString *gs);

double z_min3_d(double a, double b, double c);
double z_max3_d(double a, double b, double c);

static inline double z_sqr(double x){
	return x * x;
}

#ifdef Z_MSC_MINGW
#define z_finite(a) _finite(a)
#else
#define z_finite(a) isfinite(a)
#endif

// argument is fftw_complex
#define Z_CABS(x) (sqrt( (x)[0]*(x)[0]  + (x)[1]*(x)[1]))

// arguments are fftw_complex
#define Z_CMUL(out, x, y) {\
	double r = (x)[0] * (y)[0] - (x)[1] * (y)[1]; \
    (out)[1] = (x)[1] * (y)[0] + (x)[0] * (y)[1]; \
	(out)[0] = r; \
}



#ifdef Z_MSC_MINGW
int zreg_getint(HKEY hSecKey, const char *section, const char *entry);
char *zreg_getstr(HKEY hSecKey, const char *section, const char *entry);
#endif

int z_browser(char *url);

#define Z_CLR 0
#define Z_SET 1
#define Z_XOR 2


#if _MSC_VER < 1700 /* 2012 */
double round(double number);
#endif

#ifdef Z_MSC_MINGW
#define getpid _getpid
#endif

#ifdef Z_MSC
typedef int ssize_t;
#endif


#endif