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
101
102
103
104
105
106
#[macro_export]
macro_rules! tcod_print {
    // ABW
    ($con: expr, At($x: expr, $y: expr), Align($alignment: expr),
     Bg($bg: expr), Wrap($width: expr, $height: expr), $($arg: tt)*) => (
        $con.print_rect_ex($x, $y, $width, $height, $bg, $alignment, format!($($arg)*));
    );

    // AWB
    ($con: expr, At($x: expr, $y: expr), Align($alignment: expr),
     Wrap($width: expr, $height: expr), Bg($bg: expr), $($arg: tt)*) => (
        $con.print_rect_ex($x, $y, $width, $height, $bg, $alignment, format!($($arg)*));
    );

    // BAW
    ($con: expr, At($x: expr, $y: expr), Bg($bg: expr),
     Align($alignment: expr), Wrap($width: expr, $height: expr), $($arg: tt)*) => (
        $con.print_rect_ex($x, $y, $width, $height, $bg, $alignment, format!($($arg)*));
    );

    // BWA
    ($con: expr, At($x: expr, $y: expr), Bg($bg: expr),
     Wrap($width: expr, $height: expr), Align($alignment: expr), $($arg: tt)*) => (
        $con.print_rect_ex($x, $y, $width, $height, $bg, $alignment, format!($($arg)*));
    );

    // WAB
    ($con: expr, At($x: expr, $y: expr), Wrap($width: expr, $height: expr),
     Align($alignment: expr), Bg($bg: expr), $($arg: tt)*) => (
        $con.print_rect_ex($x, $y, $width, $height, $bg, $alignment, format!($($arg)*));
    );

    // WBA
    ($con: expr, At($x: expr, $y: expr), Wrap($width: expr, $height: expr),
     Bg($bg: expr), Align($alignment: expr), $($arg: tt)*) => (
        $con.print_rect_ex($x, $y, $width, $height, $bg, $alignment, format!($($arg)*));
    );

    // AB
    ($con: expr, At($x: expr, $y: expr), Align($bg: expr), Bg($alignment: expr), $($arg: tt)*) => (
        $con.print_ex($x, $y, $bg, $alignment, format!($($arg)*));
    );

    // AW
    ($con: expr, At($x: expr, $y: expr), Align($alignment: expr), Wrap($width: expr, $height: expr), $($arg: tt)*) => (
        {
            let bg = $con.get_background_flag();
            $con.print_rect_ex($x, $y, $width, $height, bg, $alignment, format!($($arg)*));
        }
    );

    // BA
    ($con: expr, At($x: expr, $y: expr), Bg($bg: expr), Align($alignment: expr), $($arg: tt)*) => (
        $con.print_ex($x, $y, $bg, $alignment, format!($($arg)*));
    );

    // BW
    ($con: expr, At($x: expr, $y: expr), Bg($bg: expr), Wrap($width: expr, $height: expr), $($arg: tt)*) => (
        {
            let alignment = $con.get_alignment();
            $con.print_rect_ex($x, $y, $width, $height, $bg, alignment, format!($($arg)*));
        }
    );

    // WA
    ($con: expr, At($x: expr, $y: expr), Wrap($width: expr, $height: expr), Align($alignment: expr), $($arg: tt)*) => (
        {
            let bg = $con.get_background_flag();
            $con.print_rect_ex($x, $y, $width, $height, bg, $alignment, format!($($arg)*));
        }
    );

    // WB
    ($con: expr, At($x: expr, $y: expr), Wrap($width: expr, $height: expr), Bg($bg: expr), $($arg: tt)*) => (
        {
            let alignment = $con.get_alignment();
            $con.print_rect_ex($x, $y, $width, $height, $bg, alignment, format!($($arg)*));
        }
    );

    // A
    ($con: expr, At($x: expr, $y: expr), Align($alignment: expr), $($arg: tt)*) => (
        {
            let bg = $con.get_background_flag();
            $con.print_ex($x, $y, bg, $alignment, format!($($arg)*));
        }
    );

    // B
    ($con: expr, At($x: expr, $y: expr), Bg($bg: expr), $($arg: tt)*) => (
        {
            let alignment = $con.get_alignment();
            $con.print_ex($x, $y, $bg, alignment, format!($($arg)*));
        }
    );

    // W
    ($con: expr, At($x: expr, $y: expr), Wrap($width: expr, $height: expr), $($arg: tt)*) => (
        $con.print_rect($x, $y, $width, $height, format!($($arg)*));
    );

    // None
    ($con: expr, At($x: expr, $y: expr), $($arg: tt)*) => (
        $con.print($x, $y, format!($($arg)*));
    );
}