aboutsummaryrefslogtreecommitdiffstats
path: root/doc/info/chap/macros.texinfo
blob: 2d4a947870878aa7a5e690636607fc715fb916d5 (plain) (blame)
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
@node Macros
@chapter Macros

@file{<libred.h>} defines a small set of macros
suitable for using a @code{#if} preprocessing directives.

@table @code
@item LIBRED_IS_TWILIGHT(const double)
Evaluates to 1 if the given expression is between @math{-18.0}
and 0.0 (this is, between
@code{LIBRED_SOLAR_ELEVATION_ASTRONOMICAL_DUSK_DAWN} and
@code{LIBRED_SOLAR_ELEVATION_SUNSET_SUNRISE}), inclusively,
otherwise, this macro evaluates to 0. The input should be
the Sun's apparent elevation, and the macro evaluates to 1
if it is currently twilight. The given expression is evaluted
either once or twice, therefore, it must not have side-effects.

@item LIBRED_IS_CIVIL_TWILIGHT(const double)
Evaluates to 1 if the given expression is between @math{-6.0}
and 0.0 (this is, between
@code{LIBRED_SOLAR_ELEVATION_CIVIL_DUSK_DAWN} and
@code{LIBRED_SOLAR_ELEVATION_SUNSET_SUNRISE}), inclusively,
otherwise, this macro evaluates to 0. The input should be
the Sun's apparent elevation, and the macro evaluates to 1
if it is currently civil twilight. The given expression is
evaluted either once or twice, therefore, it must not have
side-effects.

@item LIBRED_IS_NAUTICAL_TWILIGHT(const double)
Evaluates to 1 if the given expression is between @math{-12.0}
and @math{-6.0} (this is, between
@code{LIBRED_SOLAR_ELEVATION_NAUTICAL_DUSK_DAWN} and
@code{LIBRED_SOLAR_ELEVATION_CIVIL_DUSK_DAWN}), inclusively,
otherwise, this macro evaluates to 0. The input should be the
Sun's apparent elevation, and the macro evaluates to 1 if it
is currently nautical twilight. The given expression is evaluted
either once or twice, therefore, it must not have side-effects.

@item LIBRED_IS_ASTRONOMICAL_TWILIGHT(const double)
Evaluates to 1 if the given expression is between @math{-18.0}
and @math{-12.0} (this is, between
@code{LIBRED_SOLAR_ELEVATION_ASTRONOMICAL_DUSK_DAWN} and
@code{LIBRED_SOLAR_ELEVATION_NAUTICAL_DUSK_DAWN}), inclusively,
otherwise, this macro evaluates to 0. The input should be the
Sun's apparent elevation, and the macro evaluates to 1 if it is
currently astronomical twilight. The given expression is evaluted
either once or twice, therefore, it must not have side-effects.
@end table