Skip to content

Instantly share code, notes, and snippets.

@amagura
Last active August 29, 2015 14:13
Show Gist options
  • Save amagura/a0cc34743c0a9e4b718b to your computer and use it in GitHub Desktop.
Save amagura/a0cc34743c0a9e4b718b to your computer and use it in GitHub Desktop.
C Preprocessor - 99 bottles of beer song
#if 0
Recursive C Preprocessor 99 Bottles
by Alexej Magura
NOTE
run like so:
`cpp -Wp,-nostdinc,-w,-P 99.h'
or
`gcc -E -Wp,-nostdinc,-w,-P 99.h'
#endif
#ifndef NUM
#define NUM 99
#endif
#ifndef NUM_
#define NUM_ 98
#endif
#if NUM > 1
NUM bottles of beer on the wall, NUM bottles of beer.
Take one down and pass it around, NUM_ bottles of beer on the wall.
#elif NUM < 1
No more bottles of beer on the wall, no more bottles of beer.
Go to the store and buy some more, NUM_ bottles of beer on the wall.
#else
NUM bottle of beer on the wall, NUM bottle of beer.
Take one down and pass it around, no more bottles of beer on the wall.
#endif
EOL
#define EOL
#ifndef NOP98
#define NOP98 1
#endif
#if NOP98
#define NUM 98
#define NUM_ 97
#define NOP98 0
#include "99.h"
#endif
#ifndef NOP97
#define NOP97 1
#endif
#if NOP97
#define NUM 97
#define NUM_ 96
#define NOP97 0
#include "99.h"
#endif
#ifndef NOP96
#define NOP96 1
#endif
#if NOP96
#define NUM 96
#define NUM_ 95
#define NOP96 0
#include "99.h"
#endif
#ifndef NOP95
#define NOP95 1
#endif
#if NOP95
#define NUM 95
#define NUM_ 94
#define NOP95 0
#include "99.h"
#endif
#ifndef NOP94
#define NOP94 1
#endif
#if NOP94
#define NUM 94
#define NUM_ 93
#define NOP94 0
#include "99.h"
#endif
#ifndef NOP93
#define NOP93 1
#endif
#if NOP93
#define NUM 93
#define NUM_ 92
#define NOP93 0
#include "99.h"
#endif
#ifndef NOP92
#define NOP92 1
#endif
#if NOP92
#define NUM 92
#define NUM_ 91
#define NOP92 0
#include "99.h"
#endif
#ifndef NOP91
#define NOP91 1
#endif
#if NOP91
#define NUM 91
#define NUM_ 90
#define NOP91 0
#include "99.h"
#endif
#ifndef NOP90
#define NOP90 1
#endif
#if NOP90
#define NUM 90
#define NUM_ 89
#define NOP90 0
#include "99.h"
#endif
#ifndef NOP89
#define NOP89 1
#endif
#if NOP89
#define NUM 89
#define NUM_ 88
#define NOP89 0
#include "99.h"
#endif
#ifndef NOP88
#define NOP88 1
#endif
#if NOP88
#define NUM 88
#define NUM_ 87
#define NOP88 0
#include "99.h"
#endif
#ifndef NOP87
#define NOP87 1
#endif
#if NOP87
#define NUM 87
#define NUM_ 86
#define NOP87 0
#include "99.h"
#endif
#ifndef NOP86
#define NOP86 1
#endif
#if NOP86
#define NUM 86
#define NUM_ 85
#define NOP86 0
#include "99.h"
#endif
#ifndef NOP85
#define NOP85 1
#endif
#if NOP85
#define NUM 85
#define NUM_ 84
#define NOP85 0
#include "99.h"
#endif
#ifndef NOP84
#define NOP84 1
#endif
#if NOP84
#define NUM 84
#define NUM_ 83
#define NOP84 0
#include "99.h"
#endif
#ifndef NOP83
#define NOP83 1
#endif
#if NOP83
#define NUM 83
#define NUM_ 82
#define NOP83 0
#include "99.h"
#endif
#ifndef NOP82
#define NOP82 1
#endif
#if NOP82
#define NUM 82
#define NUM_ 81
#define NOP82 0
#include "99.h"
#endif
#ifndef NOP81
#define NOP81 1
#endif
#if NOP81
#define NUM 81
#define NUM_ 80
#define NOP81 0
#include "99.h"
#endif
#ifndef NOP80
#define NOP80 1
#endif
#if NOP80
#define NUM 80
#define NUM_ 79
#define NOP80 0
#include "99.h"
#endif
#ifndef NOP79
#define NOP79 1
#endif
#if NOP79
#define NUM 79
#define NUM_ 78
#define NOP79 0
#include "99.h"
#endif
#ifndef NOP78
#define NOP78 1
#endif
#if NOP78
#define NUM 78
#define NUM_ 77
#define NOP78 0
#include "99.h"
#endif
#ifndef NOP77
#define NOP77 1
#endif
#if NOP77
#define NUM 77
#define NUM_ 76
#define NOP77 0
#include "99.h"
#endif
#ifndef NOP76
#define NOP76 1
#endif
#if NOP76
#define NUM 76
#define NUM_ 75
#define NOP76 0
#include "99.h"
#endif
#ifndef NOP75
#define NOP75 1
#endif
#if NOP75
#define NUM 75
#define NUM_ 74
#define NOP75 0
#include "99.h"
#endif
#ifndef NOP74
#define NOP74 1
#endif
#if NOP74
#define NUM 74
#define NUM_ 73
#define NOP74 0
#include "99.h"
#endif
#ifndef NOP73
#define NOP73 1
#endif
#if NOP73
#define NUM 73
#define NUM_ 72
#define NOP73 0
#include "99.h"
#endif
#ifndef NOP72
#define NOP72 1
#endif
#if NOP72
#define NUM 72
#define NUM_ 71
#define NOP72 0
#include "99.h"
#endif
#ifndef NOP71
#define NOP71 1
#endif
#if NOP71
#define NUM 71
#define NUM_ 70
#define NOP71 0
#include "99.h"
#endif
#ifndef NOP70
#define NOP70 1
#endif
#if NOP70
#define NUM 70
#define NUM_ 69
#define NOP70 0
#include "99.h"
#endif
#ifndef NOP69
#define NOP69 1
#endif
#if NOP69
#define NUM 69
#define NUM_ 68
#define NOP69 0
#include "99.h"
#endif
#ifndef NOP68
#define NOP68 1
#endif
#if NOP68
#define NUM 68
#define NUM_ 67
#define NOP68 0
#include "99.h"
#endif
#ifndef NOP67
#define NOP67 1
#endif
#if NOP67
#define NUM 67
#define NUM_ 66
#define NOP67 0
#include "99.h"
#endif
#ifndef NOP66
#define NOP66 1
#endif
#if NOP66
#define NUM 66
#define NUM_ 65
#define NOP66 0
#include "99.h"
#endif
#ifndef NOP65
#define NOP65 1
#endif
#if NOP65
#define NUM 65
#define NUM_ 64
#define NOP65 0
#include "99.h"
#endif
#ifndef NOP64
#define NOP64 1
#endif
#if NOP64
#define NUM 64
#define NUM_ 63
#define NOP64 0
#include "99.h"
#endif
#ifndef NOP63
#define NOP63 1
#endif
#if NOP63
#define NUM 63
#define NUM_ 62
#define NOP63 0
#include "99.h"
#endif
#ifndef NOP62
#define NOP62 1
#endif
#if NOP62
#define NUM 62
#define NUM_ 61
#define NOP62 0
#include "99.h"
#endif
#ifndef NOP61
#define NOP61 1
#endif
#if NOP61
#define NUM 61
#define NUM_ 60
#define NOP61 0
#include "99.h"
#endif
#ifndef NOP60
#define NOP60 1
#endif
#if NOP60
#define NUM 60
#define NUM_ 59
#define NOP60 0
#include "99.h"
#endif
#ifndef NOP59
#define NOP59 1
#endif
#if NOP59
#define NUM 59
#define NUM_ 58
#define NOP59 0
#include "99.h"
#endif
#ifndef NOP58
#define NOP58 1
#endif
#if NOP58
#define NUM 58
#define NUM_ 57
#define NOP58 0
#include "99.h"
#endif
#ifndef NOP57
#define NOP57 1
#endif
#if NOP57
#define NUM 57
#define NUM_ 56
#define NOP57 0
#include "99.h"
#endif
#ifndef NOP56
#define NOP56 1
#endif
#if NOP56
#define NUM 56
#define NUM_ 55
#define NOP56 0
#include "99.h"
#endif
#ifndef NOP55
#define NOP55 1
#endif
#if NOP55
#define NUM 55
#define NUM_ 54
#define NOP55 0
#include "99.h"
#endif
#ifndef NOP54
#define NOP54 1
#endif
#if NOP54
#define NUM 54
#define NUM_ 53
#define NOP54 0
#include "99.h"
#endif
#ifndef NOP53
#define NOP53 1
#endif
#if NOP53
#define NUM 53
#define NUM_ 52
#define NOP53 0
#include "99.h"
#endif
#ifndef NOP52
#define NOP52 1
#endif
#if NOP52
#define NUM 52
#define NUM_ 51
#define NOP52 0
#include "99.h"
#endif
#ifndef NOP51
#define NOP51 1
#endif
#if NOP51
#define NUM 51
#define NUM_ 50
#define NOP51 0
#include "99.h"
#endif
#ifndef NOP50
#define NOP50 1
#endif
#if NOP50
#define NUM 50
#define NUM_ 49
#define NOP50 0
#include "99.h"
#endif
#ifndef NOP49
#define NOP49 1
#endif
#if NOP49
#define NUM 49
#define NUM_ 48
#define NOP49 0
#include "99.h"
#endif
#ifndef NOP48
#define NOP48 1
#endif
#if NOP48
#define NUM 48
#define NUM_ 47
#define NOP48 0
#include "99.h"
#endif
#ifndef NOP47
#define NOP47 1
#endif
#if NOP47
#define NUM 47
#define NUM_ 46
#define NOP47 0
#include "99.h"
#endif
#ifndef NOP46
#define NOP46 1
#endif
#if NOP46
#define NUM 46
#define NUM_ 45
#define NOP46 0
#include "99.h"
#endif
#ifndef NOP45
#define NOP45 1
#endif
#if NOP45
#define NUM 45
#define NUM_ 44
#define NOP45 0
#include "99.h"
#endif
#ifndef NOP44
#define NOP44 1
#endif
#if NOP44
#define NUM 44
#define NUM_ 43
#define NOP44 0
#include "99.h"
#endif
#ifndef NOP43
#define NOP43 1
#endif
#if NOP43
#define NUM 43
#define NUM_ 42
#define NOP43 0
#include "99.h"
#endif
#ifndef NOP42
#define NOP42 1
#endif
#if NOP42
#define NUM 42
#define NUM_ 41
#define NOP42 0
#include "99.h"
#endif
#ifndef NOP41
#define NOP41 1
#endif
#if NOP41
#define NUM 41
#define NUM_ 40
#define NOP41 0
#include "99.h"
#endif
#ifndef NOP40
#define NOP40 1
#endif
#if NOP40
#define NUM 40
#define NUM_ 39
#define NOP40 0
#include "99.h"
#endif
#ifndef NOP39
#define NOP39 1
#endif
#if NOP39
#define NUM 39
#define NUM_ 38
#define NOP39 0
#include "99.h"
#endif
#ifndef NOP38
#define NOP38 1
#endif
#if NOP38
#define NUM 38
#define NUM_ 37
#define NOP38 0
#include "99.h"
#endif
#ifndef NOP37
#define NOP37 1
#endif
#if NOP37
#define NUM 37
#define NUM_ 36
#define NOP37 0
#include "99.h"
#endif
#ifndef NOP36
#define NOP36 1
#endif
#if NOP36
#define NUM 36
#define NUM_ 35
#define NOP36 0
#include "99.h"
#endif
#ifndef NOP35
#define NOP35 1
#endif
#if NOP35
#define NUM 35
#define NUM_ 34
#define NOP35 0
#include "99.h"
#endif
#ifndef NOP34
#define NOP34 1
#endif
#if NOP34
#define NUM 34
#define NUM_ 33
#define NOP34 0
#include "99.h"
#endif
#ifndef NOP33
#define NOP33 1
#endif
#if NOP33
#define NUM 33
#define NUM_ 32
#define NOP33 0
#include "99.h"
#endif
#ifndef NOP32
#define NOP32 1
#endif
#if NOP32
#define NUM 32
#define NUM_ 31
#define NOP32 0
#include "99.h"
#endif
#ifndef NOP31
#define NOP31 1
#endif
#if NOP31
#define NUM 31
#define NUM_ 30
#define NOP31 0
#include "99.h"
#endif
#ifndef NOP30
#define NOP30 1
#endif
#if NOP30
#define NUM 30
#define NUM_ 29
#define NOP30 0
#include "99.h"
#endif
#ifndef NOP29
#define NOP29 1
#endif
#if NOP29
#define NUM 29
#define NUM_ 28
#define NOP29 0
#include "99.h"
#endif
#ifndef NOP28
#define NOP28 1
#endif
#if NOP28
#define NUM 28
#define NUM_ 27
#define NOP28 0
#include "99.h"
#endif
#ifndef NOP27
#define NOP27 1
#endif
#if NOP27
#define NUM 27
#define NUM_ 26
#define NOP27 0
#include "99.h"
#endif
#ifndef NOP26
#define NOP26 1
#endif
#if NOP26
#define NUM 26
#define NUM_ 25
#define NOP26 0
#include "99.h"
#endif
#ifndef NOP25
#define NOP25 1
#endif
#if NOP25
#define NUM 25
#define NUM_ 24
#define NOP25 0
#include "99.h"
#endif
#ifndef NOP24
#define NOP24 1
#endif
#if NOP24
#define NUM 24
#define NUM_ 23
#define NOP24 0
#include "99.h"
#endif
#ifndef NOP23
#define NOP23 1
#endif
#if NOP23
#define NUM 23
#define NUM_ 22
#define NOP23 0
#include "99.h"
#endif
#ifndef NOP22
#define NOP22 1
#endif
#if NOP22
#define NUM 22
#define NUM_ 21
#define NOP22 0
#include "99.h"
#endif
#ifndef NOP21
#define NOP21 1
#endif
#if NOP21
#define NUM 21
#define NUM_ 20
#define NOP21 0
#include "99.h"
#endif
#ifndef NOP20
#define NOP20 1
#endif
#if NOP20
#define NUM 20
#define NUM_ 19
#define NOP20 0
#include "99.h"
#endif
#ifndef NOP19
#define NOP19 1
#endif
#if NOP19
#define NUM 19
#define NUM_ 18
#define NOP19 0
#include "99.h"
#endif
#ifndef NOP18
#define NOP18 1
#endif
#if NOP18
#define NUM 18
#define NUM_ 17
#define NOP18 0
#include "99.h"
#endif
#ifndef NOP17
#define NOP17 1
#endif
#if NOP17
#define NUM 17
#define NUM_ 16
#define NOP17 0
#include "99.h"
#endif
#ifndef NOP16
#define NOP16 1
#endif
#if NOP16
#define NUM 16
#define NUM_ 15
#define NOP16 0
#include "99.h"
#endif
#ifndef NOP15
#define NOP15 1
#endif
#if NOP15
#define NUM 15
#define NUM_ 14
#define NOP15 0
#include "99.h"
#endif
#ifndef NOP14
#define NOP14 1
#endif
#if NOP14
#define NUM 14
#define NUM_ 13
#define NOP14 0
#include "99.h"
#endif
#ifndef NOP13
#define NOP13 1
#endif
#if NOP13
#define NUM 13
#define NUM_ 12
#define NOP13 0
#include "99.h"
#endif
#ifndef NOP12
#define NOP12 1
#endif
#if NOP12
#define NUM 12
#define NUM_ 11
#define NOP12 0
#include "99.h"
#endif
#ifndef NOP11
#define NOP11 1
#endif
#if NOP11
#define NUM 11
#define NUM_ 10
#define NOP11 0
#include "99.h"
#endif
#ifndef NOP10
#define NOP10 1
#endif
#if NOP10
#define NUM 10
#define NUM_ 9
#define NOP10 0
#include "99.h"
#endif
#ifndef NOP9
#define NOP9 1
#endif
#if NOP9
#define NUM 9
#define NUM_ 8
#define NOP9 0
#include "99.h"
#endif
#ifndef NOP8
#define NOP8 1
#endif
#if NOP8
#define NUM 8
#define NUM_ 7
#define NOP8 0
#include "99.h"
#endif
#ifndef NOP7
#define NOP7 1
#endif
#if NOP7
#define NUM 7
#define NUM_ 6
#define NOP7 0
#include "99.h"
#endif
#ifndef NOP6
#define NOP6 1
#endif
#if NOP6
#define NUM 6
#define NUM_ 5
#define NOP6 0
#include "99.h"
#endif
#ifndef NOP5
#define NOP5 1
#endif
#if NOP5
#define NUM 5
#define NUM_ 4
#define NOP5 0
#include "99.h"
#endif
#ifndef NOP4
#define NOP4 1
#endif
#if NOP4
#define NUM 4
#define NUM_ 3
#define NOP4 0
#include "99.h"
#endif
#ifndef NOP3
#define NOP3 1
#endif
#if NOP3
#define NUM 3
#define NUM_ 2
#define NOP3 0
#include "99.h"
#endif
#ifndef NOP2
#define NOP2 1
#endif
#if NOP2
#define NUM 2
#define NUM_ 1
#define NOP2 0
#include "99.h"
#endif
#ifndef NOP1
#define NOP1 1
#endif
#if NOP1
#define NUM 1
#define NUM_ 0
#define NOP1 0
#include "99.h"
#endif
#ifndef NOP0
#define NOP0 1
#endif
#if NOP0
#define NUM 0
#define NUM_ 99
#define NOP0 0
#include "99.h"
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment