Skip to content

Instantly share code, notes, and snippets.

@DavidLudwig
Last active May 13, 2016 17:26
Show Gist options
  • Save DavidLudwig/6969e7573b8aeab09e80346be5d7edbd to your computer and use it in GitHub Desktop.
Save DavidLudwig/6969e7573b8aeab09e80346be5d7edbd to your computer and use it in GitHub Desktop.
SDL2 backend(s), line-counts (via 'cloc')
#!/bin/bash
SRC="$1"
if [ "$SRC" == "" ]; then
SRC="src/video"
fi
HG_REV="$(hg summary | grep parent | awk '{print $2}')"
HG_REV_DATE="$(hg log -r $HG_REV | grep date | perl -pne 's/^[^:]*:\W*//')"
HG_CHANGESET="$(echo $HG_REV | perl -pne 's/.*://')"
HG_URL="https://hg.libsdl.org/SDL/rev/$HG_CHANGESET"
if ! wget -q "$HG_URL" -O /dev/null; then
HG_URL=""
fi
echo "#"
echo "# SDL backends in $SRC, run through cloc"
echo "#"
echo "# Recent as of hg revision $HG_REV ($HG_REV_DATE; $HG_URL )"
echo "#"
echo "" > cloc_temp.txt
for DIR in `find "$SRC" -depth 1 -type d`; do
LINE_COUNT="$(cloc --sum-one $DIR | grep SUM | awk '{print $5}')"
PRETTY_DIR="$(echo $DIR | perl -pne 's/.*\///')"
printf "%-12s %s\n" $PRETTY_DIR $LINE_COUNT >> cloc_temp.txt
done
cat cloc_temp.txt | sort -n -k2 -r
#
# SDL backends in src/atomic, run through cloc
#
# Recent as of hg revision 10170:ccdb4d0934e9 (Wed May 11 21:11:12 2016 +0200; https://hg.libsdl.org/SDL/rev/ccdb4d0934e9 )
#
#
# SDL backends in src/audio, run through cloc
#
# Recent as of hg revision 10170:ccdb4d0934e9 (Wed May 11 21:11:12 2016 +0200; https://hg.libsdl.org/SDL/rev/ccdb4d0934e9 )
#
xaudio2 737
qsa 624
alsa 614
pulseaudio 561
coreaudio 560
directsound 423
paudio 380
sun 332
nas 332
arts 300
winmm 284
bsd 281
fusionsound 268
esd 266
sndio 259
dsp 239
emscripten 212
haiku 175
disk 130
psp 128
android 128
nacl 106
dummy 32
#
# SDL backends in src/core, run through cloc
#
# Recent as of hg revision 10170:ccdb4d0934e9 (Wed May 11 21:11:12 2016 +0200; https://hg.libsdl.org/SDL/rev/ccdb4d0934e9 )
#
linux 1945
android 1246
winrt 724
windows 379
#
# SDL backends in src/cpuinfo, run through cloc
#
# Recent as of hg revision 10170:ccdb4d0934e9 (Wed May 11 21:11:12 2016 +0200; https://hg.libsdl.org/SDL/rev/ccdb4d0934e9 )
#
#
# SDL backends in src/dynapi, run through cloc
#
# Recent as of hg revision 10170:ccdb4d0934e9 (Wed May 11 21:11:12 2016 +0200; https://hg.libsdl.org/SDL/rev/ccdb4d0934e9 )
#
#
# SDL backends in src/events, run through cloc
#
# Recent as of hg revision 10170:ccdb4d0934e9 (Wed May 11 21:11:12 2016 +0200; https://hg.libsdl.org/SDL/rev/ccdb4d0934e9 )
#
#
# SDL backends in src/file, run through cloc
#
# Recent as of hg revision 10170:ccdb4d0934e9 (Wed May 11 21:11:12 2016 +0200; https://hg.libsdl.org/SDL/rev/ccdb4d0934e9 )
#
cocoa 30
#
# SDL backends in src/filesystem, run through cloc
#
# Recent as of hg revision 10170:ccdb4d0934e9 (Wed May 11 21:11:12 2016 +0200; https://hg.libsdl.org/SDL/rev/ccdb4d0934e9 )
#
unix 163
winrt 159
windows 118
cocoa 68
haiku 55
emscripten 34
android 29
nacl 17
dummy 17
#
# SDL backends in src/haptic, run through cloc
#
# Recent as of hg revision 10170:ccdb4d0934e9 (Wed May 11 21:11:12 2016 +0200; https://hg.libsdl.org/SDL/rev/ccdb4d0934e9 )
#
windows 1707
darwin 977
linux 716
dummy 122
#
# SDL backends in src/joystick, run through cloc
#
# Recent as of hg revision 10170:ccdb4d0934e9 (Wed May 11 21:11:12 2016 +0200; https://hg.libsdl.org/SDL/rev/ccdb4d0934e9 )
#
windows 1860
linux 720
darwin 674
bsd 590
iphoneos 494
android 463
emscripten 324
haiku 177
psp 172
dummy 65
#
# SDL backends in src/libm, run through cloc
#
# Recent as of hg revision 10170:ccdb4d0934e9 (Wed May 11 21:11:12 2016 +0200; https://hg.libsdl.org/SDL/rev/ccdb4d0934e9 )
#
#
# SDL backends in src/loadso, run through cloc
#
# Recent as of hg revision 10170:ccdb4d0934e9 (Wed May 11 21:11:12 2016 +0200; https://hg.libsdl.org/SDL/rev/ccdb4d0934e9 )
#
windows 42
dlopen 41
haiku 39
dummy 22
#
# SDL backends in src/main, run through cloc
#
# Recent as of hg revision 10170:ccdb4d0934e9 (Wed May 11 21:11:12 2016 +0200; https://hg.libsdl.org/SDL/rev/ccdb4d0934e9 )
#
haiku 361
windows 173
nacl 48
android 44
psp 43
winrt 21
dummy 18
#
# SDL backends in src/power, run through cloc
#
# Recent as of hg revision 10170:ccdb4d0934e9 (Wed May 11 21:11:12 2016 +0200; https://hg.libsdl.org/SDL/rev/ccdb4d0934e9 )
#
linux 409
macosx 134
haiku 84
uikit 61
windows 43
psp 36
android 34
emscripten 29
winrt 12
#
# SDL backends in src/render, run through cloc
#
# Recent as of hg revision 10170:ccdb4d0934e9 (Wed May 11 21:11:12 2016 +0200; https://hg.libsdl.org/SDL/rev/ccdb4d0934e9 )
#
software 2855
opengles2 2581
direct3d11 2465
opengl 2114
direct3d 1606
opengles 1045
psp 771
#
# SDL backends in src/stdlib, run through cloc
#
# Recent as of hg revision 10170:ccdb4d0934e9 (Wed May 11 21:11:12 2016 +0200; https://hg.libsdl.org/SDL/rev/ccdb4d0934e9 )
#
#
# SDL backends in src/test, run through cloc
#
# Recent as of hg revision 10170:ccdb4d0934e9 (Wed May 11 21:11:12 2016 +0200; https://hg.libsdl.org/SDL/rev/ccdb4d0934e9 )
#
#
# SDL backends in src/thread, run through cloc
#
# Recent as of hg revision 10170:ccdb4d0934e9 (Wed May 11 21:11:12 2016 +0200; https://hg.libsdl.org/SDL/rev/ccdb4d0934e9 )
#
pthread 629
generic 434
windows 381
psp 371
stdcpp 287
#
# SDL backends in src/timer, run through cloc
#
# Recent as of hg revision 10170:ccdb4d0934e9 (Wed May 11 21:11:12 2016 +0200; https://hg.libsdl.org/SDL/rev/ccdb4d0934e9 )
#
unix 168
windows 126
psp 55
haiku 44
dummy 42
#
# SDL backends in src/video, run through cloc
#
# Recent as of hg revision 10170:ccdb4d0934e9 (Wed May 11 21:11:12 2016 +0200; https://hg.libsdl.org/SDL/rev/ccdb4d0934e9 )
#
x11 8071
windows 6796
directfb 4032
cocoa 4004
uikit 2300
wayland 1932
haiku 1612
winrt 1610
mir 1385
emscripten 1113
android 924
nacl 697
pandora 695
psp 681
raspberry 595
vivante 409
dummy 148
#
# SDL backends in src/video, run through cloc
#
# Recent as of hg revision 10170:ccdb4d0934e9 (Wed May 11 21:11:12 2016 +0200; https://hg.libsdl.org/SDL/rev/ccdb4d0934e9 )
#
x11 8071
windows 6796
directfb 4032
cocoa 4004
uikit 2300
wayland 1932
haiku 1612
winrt 1610
mir 1385
emscripten 1113
android 924
nacl 697
pandora 695
psp 681
raspberry 595
vivante 409
dummy 148
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment