File: t_4_003.cpp

package info (click to toggle)
boost1.88 1.88.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 576,932 kB
  • sloc: cpp: 4,149,234; xml: 136,789; ansic: 35,092; python: 33,910; asm: 5,698; sh: 4,604; ada: 1,681; makefile: 1,633; pascal: 1,139; perl: 1,124; sql: 640; yacc: 478; ruby: 271; java: 77; lisp: 24; csh: 6
file content (100 lines) | stat: -rw-r--r-- 2,266 bytes parent folder | download | duplicates (14)
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
89
90
91
92
93
94
95
96
97
98
99
100
/*=============================================================================
    Boost.Wave: A Standard compliant C++ preprocessor library
    http://www.boost.org/

    Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
    Software License, Version 1.0. (See accompanying file
    LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/

// Tests simple expression arithmetics

# define CAT(a, b) PRIMITIVE_CAT(a, b)
# define PRIMITIVE_CAT(a, b) a ## b

# define OFFSET(n) OFFSET_ ## n

# define OFFSET_1 OFFSET_2 % 10
# define OFFSET_2 OFFSET_3 % 100
# define OFFSET_3 OFFSET_4 % 1000
# define OFFSET_4

# define FACTOR(n) FACTOR_ ## n

# define FACTOR_1 / 1
# define FACTOR_2 CAT(FACTOR_1, 0)
# define FACTOR_3 CAT(FACTOR_2, 0)
# define FACTOR_4 CAT(FACTOR_3, 0)

# define DIGIT(n) OFFSET(n) FACTOR(n)

# define x 987

# if (x) DIGIT(3) == 0
#    define D3 0
# elif (x) DIGIT(3) == 1
#    define D3 1
# elif (x) DIGIT(3) == 2
#    define D3 2
# elif (x) DIGIT(3) == 3
#    define D3 3
# elif (x) DIGIT(3) == 4
#    define D3 4
# elif (x) DIGIT(3) == 5
#    define D3 5
# elif (x) DIGIT(3) == 6
#    define D3 6
# elif (x) DIGIT(3) == 7
#    define D3 7
# elif (x) DIGIT(3) == 8
#    define D3 8
# elif (x) DIGIT(3) == 9
#    define D3 9
# endif

# if (x) DIGIT(2) == 0
#    define D2 0
# elif (x) DIGIT(2) == 1
#    define D2 1
# elif (x) DIGIT(2) == 2
#    define D2 2
# elif (x) DIGIT(2) == 3
#    define D2 3
# elif (x) DIGIT(2) == 4
#    define D2 4
# elif (x) DIGIT(2) == 5
#    define D2 5
# elif (x) DIGIT(2) == 6
#    define D2 6
# elif (x) DIGIT(2) == 7
#    define D2 7
# elif (x) DIGIT(2) == 8
#    define D2 8
# elif (x) DIGIT(2) == 9
#    define D2 9
# endif

# if (x) DIGIT(1) == 0
#    define D1 0
# elif (x) DIGIT(1) == 1
#    define D1 1
# elif (x) DIGIT(1) == 2
#    define D1 2
# elif (x) DIGIT(1) == 3
#    define D1 3
# elif (x) DIGIT(1) == 4
#    define D1 4
# elif (x) DIGIT(1) == 5
#    define D1 5
# elif (x) DIGIT(1) == 6
#    define D1 6
# elif (x) DIGIT(1) == 7
#    define D1 7
# elif (x) DIGIT(1) == 8
#    define D1 8
# elif (x) DIGIT(1) == 9
#    define D1 9
# endif

//R #line 100 "t_4_003.cpp"
D3 D2 D1      //R 9 8 7