Debian Codegraph @

Xkw/make-cards-svg

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2
3 dir=`dirnamescip-shell system . . dirname. $0`
4
5 case $# in
6 2)
7 ;;
8 *)
9 echoscip-shell system . . echo. "usage: $0 cards.c cards.h"
10 exit 1
11 ;;
12 esac
13
14 (
15 echoscip-shell system . . echo. '#include "'"$2"'"'
16 for suit in C D H S; do
17 for rank in A 2 3 4 5 6 7 8 9 T J Q K; do
18 file="$dir"/cards/"$rank""$suit".svg
19 echoscip-shell system . . echo. "const char svg_card_$rank$suit[]" =
20 sedscip-shell system . . sed. -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/ "/' -e 's/$/\\n"/' "$file"
21 echoscip-shell system . . echo. " ;";
22 echoscip-shell system . . echo. ""
23 done
24 done
25
26 file="$dir"/cards/kgames.svg
27 echoscip-shell system . . echo. "const char svg_card_game[]" =
28 sedscip-shell system . . sed. -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/ "/' -e 's/$/\\n"/' "$file"
29 echoscip-shell system . . echo. " ;";
30 echoscip-shell system . . echo. ""
31
32 echoscip-shell system . . echo. "const char *const svg_cards[52] = {"
33 for suit in C D H S; do
34 for rank in A 2 3 4 5 6 7 8 9 T J Q K; do
35 echoscip-shell system . . echo. " svg_card_$rank$suit,";
36 done
37 done
38 echoscip-shell system . . echo. "};"
39 echoscip-shell system . . echo. ""
40 ) > "$1"
41
42 (
43 echoscip-shell system . . echo. '#define svg_card_width 270'
44 echoscip-shell system . . echo. '#define svg_card_height 420'
45 echoscip-shell system . . echo. "extern const char *const svg_cards[52];"
46 echoscip-shell system . . echo. "extern const char svg_card_game[];"
47 ) > "$2"