Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Repository created.

  • Loading branch information...
commit 2700bd0743cb3d885550d1c29d8adae8afbebba6 0 parents
@wilkie wilkie authored
Showing with 27,342 additions and 0 deletions.
  1. +21 −0 README
  2. +99 −0 audio.d
  3. +28 −0 bin/README
  4. BIN  bin/archive1.dll
  5. BIN  bin/bsdtar.exe
  6. BIN  bin/bzip2.dll
  7. BIN  bin/curl.exe
  8. BIN  bin/dsss.exe
  9. BIN  bin/intl3_svn.dll
  10. BIN  bin/libapr.dll
  11. BIN  bin/libapriconv.dll
  12. BIN  bin/libaprutil.dll
  13. BIN  bin/libcharset1.dll
  14. BIN  bin/libdb44.dll
  15. BIN  bin/libeay32.dll
  16. BIN  bin/libiconv2.dll
  17. BIN  bin/libintl-2.dll
  18. BIN  bin/libintl3.dll
  19. BIN  bin/libssl32.dll
  20. BIN  bin/patch.exe
  21. BIN  bin/popt1.dll
  22. BIN  bin/rebuild.exe
  23. BIN  bin/rebuild_choosedc.exe
  24. BIN  bin/ssleay32.dll
  25. BIN  bin/svn.exe
  26. BIN  bin/unix2dos.exe
  27. BIN  bin/zlib1.dll
  28. +18 −0 dsss.conf
  29. +18 −0 dsss.last
  30. BIN  dsss_objs/G/_audio.o
  31. BIN  dsss_objs/G/_font.o
  32. BIN  dsss_objs/G/_main.o
  33. BIN  dsss_objs/G/_shape.o
  34. BIN  dsss_objs/G/_timer.o
  35. BIN  dsss_objs/G/_video.o
  36. BIN  dsss_objs/G/nmd_gcstats.o
  37. +2 −0  etc/dsss/list.list
  38. +1 −0  etc/rebuild/default
  39. +66 −0 etc/rebuild/dmd-posix
  40. +67 −0 etc/rebuild/dmd-posix-tango
  41. +71 −0 etc/rebuild/dmd-win
  42. +72 −0 etc/rebuild/dmd-win-tango
  43. +76 −0 etc/rebuild/gdc-posix
  44. +77 −0 etc/rebuild/gdc-posix-tango
  45. +69 −0 etc/rebuild/gdc-win
  46. +70 −0 etc/rebuild/gdc-win-tango
  47. +1 −0  etc/rebuild/native
  48. +1 −0  etc/rebuild/phobos
  49. +1 −0  etc/rebuild/tango
  50. +64 −0 font.d
  51. BIN  font.ttf
  52. BIN  graphics/ENDSHAPE.png
  53. BIN  graphics/LINE.png
  54. BIN  graphics/LLSHAPE.png
  55. BIN  graphics/LSHAPE.png
  56. BIN  graphics/LZSHAPE.png
  57. BIN  graphics/SQUARE.png
  58. BIN  graphics/TSHAPE.png
  59. BIN  graphics/ZSHAPE.png
  60. BIN  graphics/endScreen.png
  61. BIN  graphics/level1.png
  62. BIN  graphics/level10.png
  63. BIN  graphics/level11.png
  64. BIN  graphics/level12.png
  65. BIN  graphics/level2.png
  66. BIN  graphics/level3.png
  67. BIN  graphics/level4.png
  68. BIN  graphics/level5.png
  69. BIN  graphics/level6.png
  70. BIN  graphics/level7.png
  71. BIN  graphics/level8.png
  72. BIN  graphics/level9.png
  73. BIN  graphics/startScreen.png
  74. BIN  graphics/winScreen.png
  75. +12,534 −0 include/d/bcd/windows/windows.d
  76. +73 −0 include/d/hcf/env.d
  77. +242 −0 include/d/hcf/path.d
  78. +340 −0 include/d/hcf/process.d
  79. +461 −0 include/d/sss/build.d
  80. +173 −0 include/d/sss/clean.d
  81. +1,351 −0 include/d/sss/conf.d
  82. +43 −0 include/d/sss/genconfig.d
  83. +260 −0 include/d/sss/install.d
  84. +683 −0 include/d/sss/net.d
  85. +41 −0 include/d/sss/platform.d
  86. 0  include/d/sss/stub.d
  87. +69 −0 include/d/sss/system.d
  88. +96 −0 include/d/sss/uninstall.d
  89. +485 −0 include/d/util/booltype.d
  90. +490 −0 include/d/util/fdt.d
  91. +80 −0 include/d/util/file2.d
  92. +391 −0 include/d/util/fileex.d
  93. +309 −0 include/d/util/linetoken.d
  94. +528 −0 include/d/util/pathex.d
  95. +59 −0 include/d/util/series.d
  96. +1,458 −0 include/d/util/str.d
  97. BIN  level1.png
  98. BIN  main
  99. +186 −0 main.d
  100. +475 −0 shape.d
  101. +9 −0 share/doc/dsss/README
  102. +71 −0 share/doc/dsss/README.overview
  103. +474 −0 share/doc/dsss/README.software_engineers
  104. +151 −0 share/doc/dsss/README.technical
  105. +75 −0 share/doc/dsss/README.use
  106. BIN  share/dsss/candydoc.tar.gz
  107. +46 −0 share/dsss/dsss_lib_test.d
  108. +89 −0 share/dsss/manifest/dsss.manifest
  109. 0  share/dsss/sources/EMPTY
  110. +1 −0  share/dsss/sources/mirror
  111. +1 −0  share/dsss/sources/mirrors.list
  112. +4,292 −0 share/dsss/sources/pkgs.list
  113. +98 −0 share/dsss/sources/source.list
  114. +48 −0 share/man/man1/dsss.1
  115. +107 −0 share/man/man1/rebuild.1
  116. +4 −0 share/rebuild/testtango.d
  117. BIN  sounds/boom.wav
  118. BIN  sounds/boop.wav
  119. BIN  sounds/ghosts.ogg
  120. BIN  sounds/itsover.wav
  121. BIN  sounds/line.wav
  122. BIN  sounds/rotate.wav
  123. BIN  sounds/tetris.wav
  124. +117 −0 timer.d
  125. +4 −0 tmp/DSSS_derelict/trunk/DerelictGL/files.tmp
  126. +106 −0 video.d
21 README
@@ -0,0 +1,21 @@
+Tetris - OSGCC2
+Steve Klabnik, Chuck Davis, Marylou Kunkle
+
+Requirements for building:
+
+DSSS (http://www.dsource.org/projects/dsss)
+DMD (http://www.digitalmars.com/d/download.html)
+SDL, SDL_Mixer, SDL_Image, SDL_ttf
+
+To build: (all in the root directory)
+
+- First install derelict using dsss
+dsss net install derelict
+
+- Build using dsss
+dsss build
+
+To Run:
+
+./main (linux, osx)
+main.exe (windows)
99 audio.d
@@ -0,0 +1,99 @@
+module audio;
+
+import derelict.sdl.mixer;
+import derelict.sdl.sdl;
+import std.stdio;
+import std.string;
+
+class Audio{
+Mix_Music *music;
+Mix_Chunk *effect1;
+Mix_Chunk *effect2;
+Mix_Chunk *effect3;
+Mix_Chunk *effect4;
+Mix_Chunk *effect5;
+Mix_Chunk *effect6;
+
+this(){
+ music = null;
+}
+
+public void lowerMusicVolume(){Mix_VolumeMusic(MIX_MAX_VOLUME/8);}
+
+public void init(){
+ DerelictSDLMixer.load();
+ DerelictSDL.load();
+ Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 4096);
+}
+
+public void loadMusic(char* filename){
+ music = Mix_LoadMUS(filename);
+}
+
+public void playMusic(){
+ if(Mix_PlayingMusic() == 0){
+ Mix_PlayMusic(music, -1);
+ }
+}
+
+public void pauseMusic(){
+ if(Mix_PlayingMusic() == 1){
+ Mix_PauseMusic();
+ }
+}
+
+public void unpauseMusic(){
+ if(Mix_PausedMusic() == 1){
+ Mix_ResumeMusic();
+ }
+}
+
+public void stopMusic(){
+ Mix_HaltMusic();
+}
+
+public void playBoom(){
+ Mix_PlayChannel(-1, effect1, 0);
+}
+
+public void playBoop(){
+ Mix_PlayChannel(-1, effect2, 0);
+}
+
+public void playLine(){
+ Mix_PlayChannel(-1, effect3, 0);
+}
+
+public void playRotate(){
+ Mix_PlayChannel(-1, effect4, 0);
+}
+
+public void playTetris(){
+ Mix_PlayChannel(-1, effect5, 0);
+}
+
+public void playItsOver(){
+ Mix_PlayChannel(-1, effect6, 0);
+}
+
+public void loadEffects(){
+ effect1 = Mix_LoadWAV("sounds/boom.wav");
+ effect2 = Mix_LoadWAV("sounds/boop.wav");
+ effect3 = Mix_LoadWAV("sounds/line.wav");
+ effect4 = Mix_LoadWAV("sounds/rotate.wav");
+ effect5 = Mix_LoadWAV("sounds/tetris.wav");
+ effect6 = Mix_LoadWAV("sounds/itsover.wav");
+}
+
+public void cleanUp(){
+ Mix_FreeChunk(effect1);
+ Mix_FreeChunk(effect2);
+ Mix_FreeChunk(effect3);
+ Mix_FreeChunk(effect4);
+ Mix_FreeChunk(effect5);
+ Mix_FreeChunk(effect6);
+ Mix_FreeMusic(music);
+ Mix_CloseAudio();
+}
+
+}
28 bin/README
@@ -0,0 +1,28 @@
+These are binaries required for Windows, not necessary on other systems.
+
+Most of these are from http://gnuwin32.sourceforge.net/, namely these packages:
+
+bsdtar-1.2.38-bin.zip
+bzip2-1.0.3-1-bin.zip
+cygutils-1.2.9-bin.zip [just unix2dos.exe]
+libarchive-1.2.38-bin.zip
+libiconv-1.9.2-1-bin.zip
+libintl-0.11.5-2-bin.zip
+libintl-0.14.4-bin.zip
+openssl-0.9.7c-bin.zip
+patch-2.5.9-6-bin.zip
+popt-1.8-1-bin.zip
+zlib-1.2.3-bin.zip
+
+
+The sources are available from the same site.
+
+
+Also included is curl.exe and its dependencies, from:
+
+http://curl.haxx.se/download/curl-7.16.0-win32-ssl.zip
+
+
+Also included is svn.exe and dependencies, from:
+
+http://subversion.tigris.org/downloads/svn-win32-1.4.0.zip
BIN  bin/archive1.dll
Binary file not shown
BIN  bin/bsdtar.exe
Binary file not shown
BIN  bin/bzip2.dll
Binary file not shown
BIN  bin/curl.exe
Binary file not shown
BIN  bin/dsss.exe
Binary file not shown
BIN  bin/intl3_svn.dll
Binary file not shown
BIN  bin/libapr.dll
Binary file not shown
BIN  bin/libapriconv.dll
Binary file not shown
BIN  bin/libaprutil.dll
Binary file not shown
BIN  bin/libcharset1.dll
Binary file not shown
BIN  bin/libdb44.dll
Binary file not shown
BIN  bin/libeay32.dll
Binary file not shown
BIN  bin/libiconv2.dll
Binary file not shown
BIN  bin/libintl-2.dll
Binary file not shown
BIN  bin/libintl3.dll
Binary file not shown
BIN  bin/libssl32.dll
Binary file not shown
BIN  bin/patch.exe
Binary file not shown
BIN  bin/popt1.dll
Binary file not shown
BIN  bin/rebuild.exe
Binary file not shown
BIN  bin/rebuild_choosedc.exe
Binary file not shown
BIN  bin/ssleay32.dll
Binary file not shown
BIN  bin/svn.exe
Binary file not shown
BIN  bin/unix2dos.exe
Binary file not shown
BIN  bin/zlib1.dll
Binary file not shown
18 dsss.conf
@@ -0,0 +1,18 @@
+[main.d]
+target=main
+buildflags=-full -lldl
+
+[video.d]
+buildflags=-full -lldl -c
+
+[audio.d]
+buildflags=-full -lldl -c
+
+[shape.d]
+buildflags=-full -lldl -c
+
+[font.d]
+buildflags=-full -lldl -c
+
+[timer.d]
+buildflags=-full -lldl -c
18 dsss.last
@@ -0,0 +1,18 @@
+[main.d]
+target=main
+buildflags=-full -lldl
+
+[video.d]
+buildflags=-full -lldl -c
+
+[audio.d]
+buildflags=-full -lldl -c
+
+[shape.d]
+buildflags=-full -lldl -c
+
+[font.d]
+buildflags=-full -lldl -c
+
+[timer.d]
+buildflags=-full -lldl -c
BIN  dsss_objs/G/_audio.o
Binary file not shown
BIN  dsss_objs/G/_font.o
Binary file not shown
BIN  dsss_objs/G/_main.o
Binary file not shown
BIN  dsss_objs/G/_shape.o
Binary file not shown
BIN  dsss_objs/G/_timer.o
Binary file not shown
BIN  dsss_objs/G/_video.o
Binary file not shown
BIN  dsss_objs/G/nmd_gcstats.o
Binary file not shown
2  etc/dsss/list.list
@@ -0,0 +1,2 @@
+http://svn.dsource.org/projects/dsss/sources
+http://dsss.brainsware.org/sources
1  etc/rebuild/default
@@ -0,0 +1 @@
+profile=dmd-win
66 etc/rebuild/dmd-posix
@@ -0,0 +1,66 @@
+profile=phobos
+
+compiler=dmd
+inifile=dmd.conf
+
+exeext=
+objext=o
+
+
+version=DigitalMars
+noversion=GNU
+version=linux
+noversion=Unix
+version=Posix
+noversion=Windows
+noversion=Win32
+noversion=Win64
+version=X86
+noversion=PPC
+noversion=X86_64
+version=D_InlineAsm
+version=D_InlineAsm_X86
+noversion=D_InlineAsm_PPC
+noversion=D_InlineAsm_X86_64
+version=LittleEndian
+noversion=BigEndian
+
+
+[compile]
+cmd=dmd -version=Posix -c $i
+
+flag=$i
+incdir=-I$i
+libdir=-L-L$i
+optimize=-O
+version=-version=$i
+
+
+[link]
+oneatatime=yes
+cmd=dmd -L--start-group -L-lphobos $i -of$o
+
+libdir=-L-L$i
+lib=-L-l$i
+flag=-L$i
+
+
+[liblink]
+safe=yes
+oneatatime=yes
+cmd=ar rc $o $i
+
+libdir=
+lib=
+flag=
+
+
+[postliblink]
+cmd=ranlib $i
+
+
+[shliblink]
+shlibs=no
+
+[dyliblink]
+dylibs=no
67 etc/rebuild/dmd-posix-tango
@@ -0,0 +1,67 @@
+profile=tango
+
+compiler=dmd
+inifile=dmd.conf
+
+exeext=
+objext=o
+
+
+version=DigitalMars
+noversion=GNU
+version=linux
+noversion=Unix
+version=Posix
+noversion=Windows
+noversion=Win32
+noversion=Win64
+version=X86
+noversion=PPC
+noversion=X86_64
+version=D_InlineAsm
+version=D_InlineAsm_X86
+noversion=D_InlineAsm_PPC
+noversion=D_InlineAsm_X86_64
+version=LittleEndian
+noversion=BigEndian
+version=Tango
+
+
+[compile]
+cmd=dmd -version=Posix -version=Tango -c $i
+
+flag=$i
+incdir=-I$i
+libdir=-L-L$i
+optimize=-O
+version=-version=$i
+
+
+[link]
+oneatatime=yes
+cmd=dmd -L--start-group -L-ltango-base-dmd $i -of$o
+
+libdir=-L-L$i
+lib=-L-l$i
+flag=-L$i
+
+
+[liblink]
+safe=yes
+oneatatime=yes
+cmd=ar rc $o $i
+
+libdir=
+lib=
+flag=
+
+
+[postliblink]
+cmd=ranlib $i
+
+
+[shliblink]
+shlibs=no
+
+[dyliblink]
+dylibs=no
71 etc/rebuild/dmd-win
@@ -0,0 +1,71 @@
+profile=phobos
+
+compiler=dmd
+inifile=sc.ini
+
+exeext=.exe
+objext=obj
+objmodsep=-
+
+
+version=DigitalMars
+noversion=GNU
+noversion=linux
+noversion=Unix
+noversion=Posix
+version=Windows
+testversion=Win32
+testversion=Win64
+version=X86
+noversion=PPC
+noversion=X86_64
+version=D_InlineAsm
+version=D_InlineAsm_X86
+noversion=D_InlineAsm_PPC
+noversion=D_InlineAsm_X86_64
+version=LittleEndian
+noversion=BigEndian
+
+
+[compile]
+cmd=dmd -c $i
+response=@
+
+flag=$i
+incdir=-I$i
+libdir=-L-L$i
+optimize=-O
+version=-version=$i
+
+
+[link]
+oneatatime=yes
+cmd=dmd $i -of$o
+response=@
+
+libdir=-L+$i\
+lib=-L+$i.lib
+flag=-L$i
+gui=-L/subsystem:windows
+
+
+[liblink]
+safe=yes
+oneatatime=yes
+cmd=lib -c -p512 $o $i
+response=@
+
+libdir=
+lib=
+flag=
+
+
+[postliblink]
+cmd=echo $i
+
+
+[shliblink]
+shlibs=no
+
+[dyliblink]
+dylibs=no
72 etc/rebuild/dmd-win-tango
@@ -0,0 +1,72 @@
+profile=tango
+
+compiler=dmd
+inifile=sc.ini
+
+exeext=.exe
+objext=obj
+objmodsep=-
+
+
+version=DigitalMars
+noversion=GNU
+noversion=linux
+noversion=Unix
+noversion=Posix
+version=Windows
+testversion=Win32
+testversion=Win64
+version=X86
+noversion=PPC
+noversion=X86_64
+version=D_InlineAsm
+version=D_InlineAsm_X86
+noversion=D_InlineAsm_PPC
+noversion=D_InlineAsm_X86_64
+version=LittleEndian
+noversion=BigEndian
+version=Tango
+
+
+[compile]
+cmd=dmd -version=Tango -c $i
+response=@
+
+flag=$i
+incdir=-I$i
+libdir=-L-L$i
+optimize=-O
+version=-version=$i
+
+
+[link]
+oneatatime=yes
+cmd=dmd $i -of$o
+response=@
+
+libdir=-L+$i\
+lib=-L+$i.lib
+flag=-L$i
+gui=-L/subsystem:windows
+
+
+[liblink]
+safe=yes
+oneatatime=yes
+cmd=lib -c -p512 $o $i
+response=@
+
+libdir=
+lib=
+flag=
+
+
+[postliblink]
+cmd=echo $i
+
+
+[shliblink]
+shlibs=no
+
+[dyliblink]
+dylibs=no
76 etc/rebuild/gdc-posix
@@ -0,0 +1,76 @@
+profile=phobos
+
+compiler=gdc
+
+exeext=
+objext=o
+
+
+noversion=DigitalMars
+version=GNU
+testversion=linux
+testversion=darwin
+version=Unix
+version=Posix
+noversion=Windows
+noversion=Win32
+noversion=Win64
+testversion=X86
+testversion=PPC
+testversion=X86_64
+testversion=D_InlineAsm
+testversion=D_InlineAsm_X86
+testversion=D_InlineAsm_PPC
+testversion=D_InlineAsm_X86_64
+testversion=LittleEndian
+testversion=BigEndian
+
+
+[compile]
+cmd=gdmd -version=Posix -c $i
+
+flag=$i
+incdir=-I$i
+libdir=-L-L$i
+circular=-fall-sources
+optimize=-O
+version=-version=$i
+
+
+[link]
+cmd=gdmd $i -of$o
+export_dynamic=-q,-rdynamic
+
+libdir=-L-L$i
+lib=-L-l$i
+flag=-L$i
+
+
+[liblink]
+safe=yes
+cmd=ar rc $o $i
+
+libdir=
+lib=
+flag=
+
+
+[postliblink]
+cmd=ranlib $i
+
+
+[shliblink]
+shlibs=yes
+cmd=gdmd -q,-shared -q,-nodefaultlibs $i -of$o
+
+libdir=-L-L$i
+lib=-L-l$i
+flag=-L$i
+
+[dyliblink]
+dylibs=yes
+cmd=gdmd -q,-shared -q,-nodefaultlibs $i $l/dymoduleinit.d -of$o
+
+libdir=-L-L$i
+lib=-L-l$i
+flag=-L$i
77 etc/rebuild/gdc-posix-tango
@@ -0,0 +1,77 @@
+profile=tango
+
+compiler=gdc
+
+exeext=
+objext=o
+
+
+noversion=DigitalMars
+version=GNU
+testversion=linux
+testversion=darwin
+version=Unix
+version=Posix
+noversion=Windows
+noversion=Win32
+noversion=Win64
+testversion=X86
+testversion=PPC
+testversion=X86_64
+testversion=D_InlineAsm
+testversion=D_InlineAsm_X86
+testversion=D_InlineAsm_PPC
+testversion=D_InlineAsm_X86_64
+testversion=LittleEndian
+testversion=BigEndian
+version=Tango
+
+
+[compile]
+cmd=gdmd -version=Posix -version=Tango -c $i
+
+flag=$i
+incdir=-I$i
+libdir=-L-L$i
+circular=-fall-sources
+optimize=-O
+version=-version=$i
+
+
+[link]
+cmd=gdmd $i -of$o
+export_dynamic=-q,-rdynamic
+
+libdir=-L-L$i
+lib=-L-l$i
+flag=-L$i
+
+
+[liblink]
+safe=yes
+cmd=ar rc $o $i
+
+libdir=
+lib=
+flag=
+
+
+[postliblink]
+cmd=ranlib $i
+
+
+[shliblink]
+shlibs=yes
+cmd=gdmd -q,-shared -q,-nodefaultlibs $i -of$o
+
+libdir=-L-L$i
+lib=-L-l$i
+flag=-L$i
+
+[dyliblink]
+dylibs=yes
+cmd=gdmd -q,-shared -q,-nodefaultlibs $i $l/dymoduleinit.d -of$o
+
+libdir=-L-L$i
+lib=-L-l$i
+flag=-L$i
69 etc/rebuild/gdc-win
@@ -0,0 +1,69 @@
+profile=phobos
+
+compiler=gdc
+
+exeext=.exe
+objext=o
+
+
+version=DigitalMars
+noversion=GNU
+noversion=linux
+noversion=Unix
+noversion=Posix
+version=Windows
+testversion=Win32
+testversion=Win64
+version=X86
+noversion=PPC
+noversion=X86_64
+testversion=D_InlineAsm
+testversion=D_InlineAsm_X86
+noversion=D_InlineAsm_PPC
+noversion=D_InlineAsm_X86_64
+version=LittleEndian
+noversion=BigEndian
+
+
+[compile]
+cmd=gdmd -c $i
+
+flag=$i
+incdir=-I$i
+libdir=-L-L$i
+circular=-fall-sources
+optimize=-O
+version=-version=$i
+
+
+[link]
+cmd=gdmd $i -of$o
+
+libdir=-L-L$i
+lib=-L-l$i
+flag=-L$i
+
+
+[liblink]
+safe=yes
+cmd=ar rc $o $i
+
+libdir=
+lib=
+flag=
+
+
+[postliblink]
+cmd=ranlib $i
+
+
+[shliblink]
+shlibs=yes
+cmd=gdmd -q,-shared -q,-nodefaultlibs $i -of$o
+
+libdir=-L-L$i
+lib=-L-l$i
+flag=-L$i
+
+[dyliblink]
+dylibs=no
70 etc/rebuild/gdc-win-tango
@@ -0,0 +1,70 @@
+profile=tango
+
+compiler=gdc
+
+exeext=.exe
+objext=o
+
+
+version=DigitalMars
+noversion=GNU
+noversion=linux
+noversion=Unix
+noversion=Posix
+version=Windows
+testversion=Win32
+testversion=Win64
+version=X86
+noversion=PPC
+noversion=X86_64
+testversion=D_InlineAsm
+testversion=D_InlineAsm_X86
+noversion=D_InlineAsm_PPC
+noversion=D_InlineAsm_X86_64
+version=LittleEndian
+noversion=BigEndian
+version=Tango
+
+
+[compile]
+cmd=gdmd -version=Tango -c $i
+
+flag=$i
+incdir=-I$i
+libdir=-L-L$i
+circular=-fall-sources
+optimize=-O
+version=-version=$i
+
+
+[link]
+cmd=gdmd $i -of$o
+
+libdir=-L-L$i
+lib=-L-l$i
+flag=-L$i
+
+
+[liblink]
+safe=yes
+cmd=ar rc $o $i
+
+libdir=
+lib=
+flag=
+
+
+[postliblink]
+cmd=ranlib $i
+
+
+[shliblink]
+shlibs=yes
+cmd=gdmd -q,-shared -q,-nodefaultlibs $i -of$o
+
+libdir=-L-L$i
+lib=-L-l$i
+flag=-L$i
+
+[dyliblink]
+dylibs=no
1  etc/rebuild/native
@@ -0,0 +1 @@
+profile=default
1  etc/rebuild/phobos
@@ -0,0 +1 @@
+ignore=crc32 gcc. gcstats object std.
1  etc/rebuild/tango
@@ -0,0 +1 @@
+ignore=gcc. object
64 font.d
@@ -0,0 +1,64 @@
+module font;
+
+import std.stdio;
+import std.string;
+import derelict.sdl.sdl;
+import derelict.sdl.ttf;
+import derelict.sdl.image;
+import video;
+
+class Font{
+TTF_Font *font;
+SDL_Color textColor;
+SDL_Surface *message;
+Video graphics;
+int x, y;
+
+this(char* filename, Video grph){
+ DerelictSDLImage.load();
+ DerelictSDL.load();
+ DerelictSDLttf.load();
+ TTF_Init();
+ graphics = grph;
+
+ SDL_Init(SDL_INIT_EVERYTHING);
+ textColor.r = 192;
+ textColor.g = 192;
+ textColor.b = 192;
+ font = TTF_OpenFont("font.ttf", 24);
+ if(font == null){writefln("font is null");}
+ message = null;
+}
+
+public void displayMessage(int quadrant, char *theMsg){
+ message = TTF_RenderText_Solid(font, theMsg, textColor);
+ //if(message == null){writefln("message is null");}
+
+ if(quadrant == 1){
+ x = 575;
+ y = 25;
+ }else if(quadrant == 2){
+ x = 25;
+ y = 25;
+ }else if(quadrant == 3){
+ x = 25;
+ y = 470;
+ }else if(quadrant == 4){
+ x = 575;
+ y = 470;
+ }else{
+ x = 575;
+ y = 20;
+ }
+ //writefln("inside display Message");
+ graphics.applySurface(x,y,message);
+
+}
+
+ public void cleanUp(){
+ TTF_CloseFont(font);
+ TTF_Quit();
+ }
+
+
+}
BIN  font.ttf
Binary file not shown
BIN  graphics/ENDSHAPE.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  graphics/LINE.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  graphics/LLSHAPE.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  graphics/LSHAPE.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  graphics/LZSHAPE.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  graphics/SQUARE.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  graphics/TSHAPE.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  graphics/ZSHAPE.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  graphics/endScreen.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  graphics/level1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  graphics/level10.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  graphics/level11.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  graphics/level12.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  graphics/level2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  graphics/level3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  graphics/level4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  graphics/level5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  graphics/level6.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  graphics/level7.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  graphics/level8.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  graphics/level9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  graphics/startScreen.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  graphics/winScreen.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12,534 include/d/bcd/windows/windows.d
12,534 additions, 0 deletions not shown
73 include/d/hcf/env.d
@@ -0,0 +1,73 @@
+/**
+ * Helpful environment functions
+ *
+ * Authors:
+ * Gregor Richards
+ *
+ * License:
+ * Copyright (c) 2006 Gregor Richards
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+module hcf.env;
+
+import std.string;
+
+import std.c.stdlib;
+
+version (Windows) {
+ import bcd.windows.windows;
+}
+
+/** Get an environment variable D-ly */
+char[] getEnvVar(char[] var)
+{
+ version (Posix) {
+ return toString(
+ getenv(toStringz(var)));
+ } else version (Windows) {
+ // CyberShadow 2007.02.22: enlarging buffer tenfold for people with huge PATHs (like me)
+ char[10240] buffer;
+ buffer[0] = '\0';
+ GetEnvironmentVariableA(
+ toStringz(var),
+ buffer.ptr,
+ 10240);
+ return toString(buffer.ptr);
+ } else {
+ static assert(0);
+ }
+}
+
+/** Set an environment variable D-ly */
+void setEnvVar(char[] var, char[] val)
+{
+ version (Posix) {
+ setenv(toStringz(var),
+ toStringz(val),
+ 1);
+ } else version(Windows) {
+ SetEnvironmentVariableA(
+ toStringz(var),
+ toStringz(val));
+ } else {
+ static assert(0);
+ }
+}
242 include/d/hcf/path.d
@@ -0,0 +1,242 @@
+/**
+ * Helpful path functions
+ *
+ * Authors:
+ * Gregor Richards
+ *
+ * License:
+ * Copyright (c) 2006 Gregor Richards
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+module hcf.path;
+
+public import std.path;
+
+import std.stdio;
+import std.file;
+import std.string;
+
+import std.c.stdlib;
+
+version (Windows) {
+ import bcd.windows.windows;
+}
+
+/** Get the system PATH */
+char[][] getPath()
+{
+ return split(toString(getenv("PATH")), std.path.pathsep);
+}
+
+/** From args[0], figure out our path. Returns 'false' on failure */
+bool whereAmI(char[] argvz, inout char[] dir, inout char[] bname)
+{
+ // split it
+ bname = getBaseName(argvz);
+ dir = getDirName(argvz);
+
+ // on Windows, this is a .exe
+ version (Windows) {
+ bname = defaultExt(bname, "exe");
+ }
+
+ // is this a directory?
+ if (dir != "") {
+ if (!std.path.isabs(dir)) {
+ // make it absolute
+ dir = getcwd() ~ std.path.sep ~ dir;
+ }
+ return true;
+ }
+
+ version (Windows) {
+ // is it in cwd?
+ char[] cwd = getcwd();
+ if (exists(cwd ~ std.path.sep ~ bname)) {
+ dir = cwd;
+ return true;
+ }
+ }
+
+ // rifle through the path
+ char[][] path = getPath();
+ foreach (pe; path) {
+ char[] fullname = pe ~ std.path.sep ~ bname;
+ if (exists(fullname)) {
+ version (Windows) {
+ dir = pe;
+ return true;
+ } else {
+ if (getAttributes(fullname) & 0100) {
+ dir = pe;
+ return true;
+ }
+ }
+ }
+ }
+
+ // bad
+ return false;
+}
+
+/// Return a canonical pathname
+char[] canonPath(char[] origpath)
+{
+ char[] ret;
+
+ version (Windows) {
+ // replace any altsep with sep
+ if (altsep.length) {
+ ret = replace(origpath, altsep, sep);
+ } else {
+ ret = origpath.dup;
+ }
+ } else {
+ ret = origpath.dup;
+ }
+
+ // expand tildes
+ ret = expandTilde(ret);
+
+ // get rid of any duplicate separators
+ for (int i = 0; i < ret.length; i++) {
+ if (ret[i .. (i + 1)] == sep) {
+ // drop the duplicate separator
+ i++;
+ while (i < ret.length &&
+ ret[i .. (i + 1)] == sep) {
+ ret = ret[0 .. i] ~ ret[(i + 1) .. $];
+ }
+ }
+ }
+
+ // make sure we don't miss a .. element
+ if (ret.length > 3 && ret[($-3) .. $] == std.path.sep ~ "..") {
+ ret ~= std.path.sep;
+ }
+
+ // or a . element
+ if (ret.length > 2 && ret[($-2) .. $] == std.path.sep ~ ".") {
+ ret ~= std.path.sep;
+ }
+
+ // search for .. elements
+ for (int i = 0; ret.length > 4 && i <= ret.length - 4; i++) {
+ if (ret[i .. (i + 4)] == std.path.sep ~ ".." ~ std.path.sep) {
+ // drop the previous path element
+ int j;
+ for (j = i - 1; j > 0 && ret[j..(j+1)] != std.path.sep; j--) {}
+ if (j > 0) {
+ // cut
+ if (ret[j..j+2] == "/.") {
+ j = i + 2; // skip it
+ } else {
+ ret = ret[0..j] ~ ret[(i + 3) .. $];
+ }
+ } else {
+ // can't cut
+ j = i + 2;
+ }
+ i = j - 1;
+ }
+ }
+
+ // search for . elements
+ for (int i = 0; ret.length > 2 && i <= ret.length - 3; i++) {
+ if (ret[i .. (i + 3)] == std.path.sep ~ "." ~ std.path.sep) {
+ // drop this path element
+ ret = ret[0..i] ~ ret[(i + 2) .. $];
+ i--;
+ }
+ }
+
+ // get rid of any introductory ./'s
+ while (ret.length > 2 && ret[0..2] == "." ~ std.path.sep) {
+ ret = ret[2..$];
+ }
+
+ // finally, get rid of any trailing separators
+ while (ret.length &&
+ ret[($ - 1) .. $] == sep) {
+ ret = ret[0 .. ($ - 1)];
+ }
+
+ return ret;
+}
+
+/** Make a directory and all parent directories */
+void mkdirP(char[] dir)
+{
+ dir = canonPath(dir);
+ version (Windows) {
+ dir = std.string.replace(dir, "/", "\\");
+ }
+
+ // split it into elements
+ char[][] dires = split(dir, sep);
+
+ char[] curdir;
+
+ // check for root dir
+ if (dires.length &&
+ dires[0] == "") {
+ curdir = std.path.sep;
+ dires = dires[1..$];
+ }
+
+ // then go piece-by-piece, making directories
+ foreach (dire; dires) {
+ if (curdir.length) {
+ curdir ~= sep ~ dire;
+ } else {
+ curdir ~= dire;
+ }
+
+ if (!exists(curdir)) {
+ mkdir(curdir);
+ }
+ }
+}
+
+/** Remove a file or directory and all of its children */
+void rmRecursive(char[] name)
+{
+ // can only delete writable files on Windows
+ version (Windows) {
+ SetFileAttributesA(toStringz(name),
+ GetFileAttributesA(toStringz(name)) &
+ ~FILE_ATTRIBUTE_READONLY);
+ }
+
+ if (isdir(name)) {
+ foreach (elem; listdir(name)) {
+ // don't delete . or ..
+ if (elem == "." ||
+ elem == "..") continue;
+ rmRecursive(name ~ std.path.sep ~ elem);
+ }
+
+ // remove the directory itself
+ rmdir(name);
+ } else {
+ std.file.remove(name);
+ }
+}
340 include/d/hcf/process.d
@@ -0,0 +1,340 @@
+/**
+ * Helpful process functions
+ *
+ * Authors:
+ * Gregor Richards
+ *
+ * License:
+ * Copyright (c) 2006, 2007 Gregor Richards
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+module hcf.process;
+
+public import std.process;
+alias std.process.system system;
+
+import std.stdio;
+import std.string;
+import std.stream;
+
+import std.c.stdio;
+import std.c.stdlib;
+
+private {
+ version (Windows) {
+ import bcd.windows.windows;
+ } else {
+ extern (C) int dup2(int, int);
+ extern (C) int fork();
+ extern (C) int pipe(int[2]);
+ extern (C) int read(int, void*, size_t);
+ extern (C) int write(int, void*, size_t);
+ extern (C) int close(int);
+ extern (C) size_t waitpid(size_t, int*, int);
+ }
+}
+
+class PStream : Stream {
+ /** First init step: this, then start the process based on its result */
+ void init1()
+ {
+ readable = true;
+ writeable = true;
+ seekable = false;
+
+ version (Posix) {
+ // get our pipes
+ pipe(ip);
+ pipe(op);
+
+ // fork
+ pid = fork();
+ if (pid == 0) {
+ // dup2 in our stdin/out
+ dup2(ip[0], 0);
+ hcf.process.close(ip[1]);
+ dup2(op[1], 1);
+ dup2(op[1], 2);
+ hcf.process.close(op[0]);
+ } else if (pid == -1) {
+ // boom!
+ throw new StreamException("Failed to fork");
+ } else {
+ hcf.process.close(ip[0]);
+ hcf.process.close(op[1]);
+ }
+ } else version (Windows) {
+ // get our pipes
+ _SECURITY_ATTRIBUTES sa;
+ sa.nLength = _SECURITY_ATTRIBUTES.sizeof;
+ sa.bInheritHandle = 1;
+ CreatePipe(&ipr, &ipw, &sa, 0);
+ CreatePipe(&opr, &opw, &sa, 0);
+
+ // don't fork yet - it'll have to be done by the next step
+ }
+ }
+
+ /** Use system */
+ this(char[] command)
+ {
+ init1();
+
+ version (Posix) {
+ if (pid == 0) {
+ exit(std.process.system(command));
+ }
+ } else version (Windows) {
+ _STARTUPINFOA si;
+ si.cb = _STARTUPINFOA.sizeof;
+ si.hStdInput = ipr;
+ si.hStdOutput = opw;
+ si.hStdError = opw;
+ si.dwFlags = STARTF_USESTDHANDLES;
+
+ _PROCESS_INFORMATION pi;
+
+ CreateProcessA(null, toStringz(command), null, null,
+ 1, 0, null, null, &si, &pi);
+ CloseHandle(ipr);
+ CloseHandle(opw);
+ CloseHandle(pi.hThread);
+ phnd = pi.hProcess;
+ }
+
+ init2();
+ }
+
+ /** Use execvp */
+ this(char[] pathname, char[][] argv)
+ {
+ init1();
+
+ version (Posix) {
+ if (pid == 0) {
+ execvp(pathname, argv);
+ exit(1);
+ }
+ } else version(Windows) {
+ assert(0);
+ }
+
+ init2();
+ }
+
+ /** The second init part */
+ void init2()
+ {
+ isopen = true;
+ }
+
+ override size_t readBlock(void* buffer, size_t size)
+ {
+ version (Posix) {
+ int rd = hcf.process.read(op[0], buffer, size);
+ if (rd == -1) {
+ readEOF = true;
+ return 0;
+ } else {
+ readEOF = false;
+ }
+ return rd;
+ } else version (Windows) {
+ uint rd;
+ if (!ReadFile(opr, buffer, size, &rd, null)) {
+ readEOF = true;
+ return 0;
+ } else {
+ readEOF = false;
+ }
+ return rd;
+ }
+ }
+
+ override size_t writeBlock(void* buffer, size_t size)
+ {
+ version (Posix) {
+ int wt = hcf.process.write(ip[1], buffer, size);
+ if (wt == -1) {
+ throw new StreamException("Process closed");
+ }
+ return wt;
+ } else version (Windows) {
+ uint wt;
+ if (!WriteFile(opr, buffer, size, &wt, null)) {
+ readEOF = true;
+ return 0;
+ } else {
+ readEOF = false;
+ }
+ return wt;
+ }
+ }
+
+ override ulong seek(long offset, SeekPos whence)
+ {
+ throw new StreamException("Cannot seek in PStreams");
+ }
+
+ /** Close the process, return the result */
+ void close()
+ {
+ if (isopen) {
+ isopen = false;
+ version (Posix) {
+ waitpid(pid, &eval, 0);
+ hcf.process.close(ip[1]);
+ hcf.process.close(op[0]);
+ } else version (Windows) {
+ GetExitCodeProcess(phnd, &eval);
+ CloseHandle(phnd);
+ CloseHandle(ipw);
+ CloseHandle(opr);
+ }
+ }
+ }
+
+ version (Posix) {
+ /** Get the exit value */
+ int exitValue()
+ {
+ return eval;
+ }
+ } else version (Windows) {
+ /** Get the exit value */
+ uint exitValue()
+ {
+ return eval;
+ }
+ }
+
+ private:
+
+ version (Posix) {
+ /** The pid */
+ int pid;
+
+ /** The exit value */
+ int eval;
+
+ /** The input pipe */
+ int[2] ip;
+
+ /** The output pipe */
+ int[2] op;
+ } else version (Windows) {
+ /** The process handle */
+ HANDLE phnd;
+
+ /** The exit value */
+ uint eval;
+
+ /** The input pipe */
+ HANDLE ipr, ipw;
+
+ /** The output pipe */
+ HANDLE opr, opw;
+ }
+}
+
+/** Exception to be thrown when a command called dies */
+class ProcessDeathException : Exception {
+ this(char[] smsg)
+ {
+ super(smsg);
+ }
+}
+
+/** system + guarantee success */
+void systemOrDie(char[] cmd)
+{
+ int res;
+ fflush(stdout); fflush(stderr);
+ res = system(cmd);
+ if (res) // CyberShadow 2007.02.22: Display a message before exiting
+ {
+ int p = cmd.find(' ');
+ if(p!=-1) cmd=cmd[0..p];
+ writefln("Command " ~ cmd ~ " returned with code ", res, ", aborting.");
+ throw new ProcessDeathException("Command failed, aborting.");
+ }
+}
+
+/** system + output */
+int sayAndSystem(char[] cmd)
+{
+ writefln("+ %s", cmd);
+ fflush(stdout); fflush(stderr);
+ return system(cmd);
+}
+
+/** systemOrDie + output */
+void saySystemDie(char[] cmd)
+{
+ writefln("+ %s", cmd);
+ systemOrDie(cmd);
+}
+
+/** system + use a response file */
+int systemResponse(char[] cmd, char[] rflag, char[] rfile, bool deleteRFile)
+{
+ int ret;
+ char[][] elems = std.string.split(cmd, " ");
+
+ /* the output is elems past 1 joined with \n */
+ char[] resp = std.string.join(elems[1..$], "\n");
+ std.file.write(rfile, resp);
+
+ fflush(stdout); fflush(stderr);
+ ret = system(elems[0] ~ " " ~ rflag ~ rfile);
+
+ if (deleteRFile) std.file.remove(rfile);
+
+ return ret;
+}
+
+/** systemResponse + guarantee success */
+void systemROrDie(char[] cmd, char[] rflag, char[] rfile, bool deleteRFile)
+{
+ int res;
+ res = systemResponse(cmd, rflag, rfile, deleteRFile);
+ if (res) // CyberShadow 2007.02.22: Display a message before exiting
+ {
+ int p = cmd.find(' ');
+ if(p!=-1) cmd=cmd[0..p];
+ writefln("Command " ~ cmd ~ " returned with code ", res, ", aborting.");
+ throw new ProcessDeathException("Command failed, aborting.");
+ }
+}
+
+/** systemResponse + output */
+int sayAndSystemR(char[] cmd, char[] rflag, char[] rfile, bool deleteRFile)
+{
+ writefln("+ %s", cmd);
+ return systemResponse(cmd, rflag, rfile, deleteRFile);
+}
+
+/** systemROrDie + output */
+void saySystemRDie(char[] cmd, char[] rflag, char[] rfile, bool deleteRFile)
+{
+ writefln("+ %s", cmd);
+ systemROrDie(cmd, rflag, rfile, deleteRFile);
+}
461 include/d/sss/build.d
@@ -0,0 +1,461 @@
+/**
+ * DSSS command "build"
+ *
+ * Authors:
+ * Gregor Richards
+ *
+ * License:
+ * Copyright (c) 2006, 2007 Gregor Richards
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+module sss.build;
+
+import std.file;
+import std.process;
+import std.stdio;
+import std.string;
+
+import std.c.stdlib;
+
+import hcf.path;
+import hcf.process;
+
+import sss.conf;
+import sss.system;
+
+/** The entry function to the DSSS "build" command */
+int build(char[][] buildElems, DSSSConf conf = null, char[] forceFlags = "") {
+ // get the configuration
+ if (conf is null)
+ conf = readConfig(buildElems);
+
+ // buildElems are by either soure or target, so we need one by source only
+ char[][] buildSources;
+
+ // get the sources
+ buildSources = sourcesByElems(buildElems, conf);
+
+ // also get a complete list, since some steps need it
+ char[][] allSources = sourcesByElems(null, conf);
+
+ /* building is fairly complicated, involves these steps:
+ * 1) Make .di files
+ * (so that you link against your own libraries)
+ * 2) Make fake shared libraries
+ * (they need to exist so that other libraries can link against them)
+ * 3) Make real shared libraries
+ * 4) Make binaries
+ */
+
+ // make the basic build line
+ char[] bl = dsss_build ~ forceFlags ~ " ";
+
+ // add -oq if we don't have such a setting
+ if (find(forceFlags, "-o") == -1) {
+ mkdirP("dsss_objs" ~ std.path.sep ~ compilerShort());
+ bl ~= "-oqdsss_objs" ~ std.path.sep ~ compilerShort() ~ " ";
+ }
+
+ // 1) Make .di files for everything
+ foreach (build; allSources) {
+ char[][char[]] settings = conf.settings[build];
+
+ // basic info
+ char[] type = settings["type"];
+ char[] target = settings["target"];
+
+ if (type == "library" && libsSafe()) {
+ writefln("Creating imports for %s", target);
+
+ // do the predigen
+ if ("predigen" in settings) {
+ dsssScriptedStep(conf, settings["predigen"]);
+ }
+
+ // this is a library, so make .di files
+ char[][] srcFiles = targetToFiles(build, conf);
+
+ // generate .di files
+ foreach (file; srcFiles) {
+ char[] ifile = "dsss_imports" ~ std.path.sep ~ file ~ "i";
+ if (!exists(ifile) ||
+ fileNewer(file, ifile)) {
+ /* BIG FAT NOTE slash FIXME:
+ * .di files do NOT include interfaces! So, we need to just
+ * cast .d files as .di until that's fixed */
+ mkdirP(getDirName(ifile));
+
+ // now edit the .di file to reference the appropriate library
+
+ // usname = name_with_underscores
+ char[] usname = replace(build, std.path.sep, "_");
+
+ // if we aren't building a debug library, the debug conditional will fall through
+ char[] debugPrefix = null;
+ if (buildDebug)
+ debugPrefix = "debug-";
+
+ /* generate the pragmas (FIXME: this should be done in a
+ * nicer way) */
+ char[] defaultLibName = libraryName(build);
+ if (defaultLibName == target) {
+ std.file.write(ifile, std.file.read(file) ~ `
+version (build) {
+ debug {
+ version (GNU) {
+ pragma(link, "` ~ debugPrefix ~ `DG` ~ target[2..$] ~ `");
+ } else version (DigitalMars) {
+ pragma(link, "` ~ debugPrefix ~ `DD` ~ target[2..$] ~ `");
+ } else {
+ pragma(link, "` ~ debugPrefix ~ `DO` ~ target[2..$] ~ `");
+ }
+ } else {
+ version (GNU) {
+ pragma(link, "DG` ~ target[2..$] ~ `");
+ } else version (DigitalMars) {
+ pragma(link, "DD` ~ target[2..$] ~ `");
+ } else {
+ pragma(link, "DO` ~ target[2..$] ~ `");
+ }
+ }
+}
+`);
+ } else {
+ std.file.write(ifile, std.file.read(file) ~ `
+version (build) {
+ debug {
+ pragma(link, "` ~ debugPrefix ~ target ~ `");
+ } else {
+ pragma(link, "` ~ target ~ `");
+ }
+}
+`);
+ }
+ }
+ }
+
+ // do the postdigen
+ if ("postdigen" in settings) {
+ dsssScriptedStep(conf, settings["postdigen"]);
+ }
+
+ writefln("");
+
+ }
+ }
+
+ // 2) Make fake shared libraries
+ if (shLibSupport()) {
+ foreach (build; allSources) {
+ char[][char[]] settings = conf.settings[build];
+
+ // ignore this if we're not building a shared library
+ if (!("shared" in settings)) continue;
+
+ // basic info
+ char[] type = settings["type"];
+ char[] target = settings["target"];
+
+ if (type == "library" && libsSafe()) {
+ char[] shlibname = getShLibName(settings);
+ char[][] shortshlibnames = getShortShLibNames(settings);
+ char[] shlibflag = getShLibFlag(settings);
+
+ if (exists(shlibname)) continue;
+
+ writefln("Building stub shared library for %s", target);
+
+ // make the stub
+ if (targetGNUOrPosix()) {
+ char[] stubbl = bl ~ "-fPIC -shlib " ~ stubDLoc ~ " -of" ~ shlibname ~
+ " " ~ shlibflag;
+ vSaySystemRDie(stubbl, "-rf", shlibname ~ "_stub.rf", deleteRFiles);
+ if (targetVersion("Posix")) {
+ foreach (ssln; shortshlibnames) {
+ vSaySystemDie("ln -sf " ~ shlibname ~ " " ~ ssln);
+ }
+ }
+ } else {
+ assert(0);
+ }
+
+ writefln("");
+ }
+ }
+ }
+
+ char[] docbl = "";
+ /// A function to prepare for creating documentation for this build
+ void prepareDocs(char[] build, bool doc) {
+ // prepare for documentation
+ docbl = "";
+ if (doc) {
+ char[] docdir = "dsss_docs" ~ std.path.sep ~ build;
+ mkdirP(docdir);
+ docbl ~= "-full -Dq" ~ docdir ~ " -candydoc ";
+
+ // now extract candydoc there
+ char[] origcwd = getcwd();
+ chdir(docdir);
+
+ version (Windows) {
+ vSayAndSystem("bsdtar -xf " ~ candyDocPrefix);
+ } else {
+ vSayAndSystem("gunzip -c " ~ candyDocPrefix ~ " | tar -xf -");
+ }
+
+ chdir(origcwd);
+ }
+ }
+
+ // 3) Make real libraries and do special steps and subdirs
+ foreach (build; buildSources) {
+ char[][char[]] settings = conf.settings[build];
+
+ // basic info
+ char[] type = settings["type"];
+ char[] target = settings["target"];
+
+ if (type == "library" || type == "sourcelibrary") {
+ char[] dotname = std.string.replace(build, std.path.sep, ".");
+
+ // get the list of files
+ char[][] files = targetToFiles(build, conf);
+
+ // and other necessary data
+ char[] bflags, debugflags, releaseflags;
+ if ("buildflags" in settings) {
+ bflags = settings["buildflags"] ~ " ";
+ }
+ if ("debugflags" in settings) {
+ debugflags = settings["debugflags"] ~ " ";
+ } else {
+ debugflags = "-debug -gc ";
+ }
+ if ("releaseflags" in settings) {
+ releaseflags = settings["releaseflags"] ~ " ";
+ }
+
+ // output what we're building
+ writefln("%s => %s", build, target);
+ if (files.length == 0) {
+ writefln("WARNING: Section %s has no files.", build);
+ continue;
+ }
+
+ // prepare to do documentation
+ prepareDocs(build, doDocs);
+
+ // do the prebuild
+ if ("prebuild" in settings) {
+ dsssScriptedStep(conf, settings["prebuild"]);
+ }
+
+ // get the file list
+ char[] fileList = std.string.join(targetToFiles(build, conf), " ");
+
+ // if we should, build the library
+ if ((type == "library" && libsSafe()) ||
+ doDocs /* need to build the library to get docs */ ||
+ testLibs /* need to build the ilbrary to test it */) {
+
+ if (buildDebug)
+ buildLibrary("debug-" ~ target, bl, bflags ~ debugflags, docbl, fileList, settings);
+ buildLibrary(target, bl, bflags ~ releaseflags, docbl, fileList, settings);
+ }
+
+ // do the postbuild
+ if ("postbuild" in settings) {
+ dsssScriptedStep(conf, settings["postbuild"]);
+ }
+
+ // an extra line for clarity
+ writefln("");
+
+ } else if (type == "special") {
+ // special type, do pre/post
+ writefln("%s", target);
+ if ("prebuild" in settings) {
+ dsssScriptedStep(conf, settings["prebuild"]);
+ }
+
+ if ("postbuild" in settings) {
+ dsssScriptedStep(conf, settings["postbuild"]);
+ }
+ writefln("");
+
+ } else if (type == "subdir") {
+ // recurse
+ char[] origcwd = getcwd();
+ chdir(build);
+
+ // the one thing that's passed in is build flags
+ char[] orig_dsss_build = dsss_build.dup;
+ if ("buildflags" in settings) {
+ dsss_build ~= settings["buildflags"] ~ " ";
+ }
+
+ int buildret = sss.build.build(null);
+ chdir(origcwd);
+
+ dsss_build = orig_dsss_build;
+
+ }
+ }
+
+ // 4) Binaries
+ foreach (build; buildSources) {
+ char[][char[]] settings = conf.settings[build];
+
+ // basic info
+ char[] bfile = build;
+ char[] type = settings["type"];
+ char[] target = settings["target"];
+ int bfileplus = std.string.find(bfile, '+');
+ if (bfileplus != -1) {
+ bfile = bfile[0..bfileplus];
+ }
+
+ if (type == "binary") {
+ // our binary build line
+ char[] bflags;
+ if ("buildflags" in settings) {
+ bflags = settings["buildflags"];
+ }
+ if (buildDebug) {
+ if ("debugflags" in settings) {
+ bflags ~= " " ~ settings["debugflags"];
+ } else {
+ bflags ~= " -debug -gc";
+ }
+ } else {
+ if ("releaseflags" in settings) {
+ bflags ~= " " ~ settings["releaseflags"];
+ }
+ }
+
+ char[] bbl = bl ~ bflags ~ " ";
+
+ // output what we're building
+ writefln("%s => %s", bfile, target);
+
+ // prepare for documentation
+ prepareDocs(build, doDocs && doDocBinaries);
+ bbl ~= docbl;
+
+ // do the prebuild
+ if ("prebuild" in settings) {
+ dsssScriptedStep(conf, settings["prebuild"]);
+ }
+
+ // build a build line
+ char[] ext = std.string.tolower(getExt(bfile));
+ if (ext == "d") {
+ bbl ~= bfile ~ " -of" ~ target ~ " ";
+ } else if (ext == "brf") {
+ bbl ~= "@" ~ getName(bfile) ~ " ";
+ } else {
+ writefln("ERROR: I don't know how to build something with extension %s", ext);
+ return 1;
+ }
+
+ // then do it
+ vSaySystemRDie(bbl, "-rf", target ~ ".rf", deleteRFiles);
+
+ // do the postbuild
+ if ("postbuild" in settings) {
+ dsssScriptedStep(conf, settings["postbuild"]);
+ }
+
+ // an extra line for clarity
+ writefln("");
+
+ }
+ }
+
+ return 0;
+}
+
+/**
+ * Helper function to build libraries
+ *
+ * Params:
+ * target = target file name (minus platform-specific parts)
+ * bl = the base build line
+ * bflags = build flags
+ * docbl = build flags for documentation ("" for no docs)
+ * fileList = list of files to be compiled into the library
+ * settings = settings for this section from DSSSConf
+ */
+void buildLibrary(char[] target, char[] bl, char[] bflags, char[] docbl,
+ char[] fileList, char[][char[]] settings)
+{
+ char[] shlibname = getShLibName(settings);
+ char[][] shortshlibnames = getShortShLibNames(settings);
+ char[] shlibflag = getShLibFlag(settings);
+
+ if (targetGNUOrPosix()) {
+ // first do a static library
+ if (exists("lib" ~ target ~ ".a")) std.file.remove("lib" ~ target ~ ".a");
+ char[] stbl = bl ~ docbl ~ bflags ~ " -explicit -lib " ~ fileList ~ " -oflib" ~ target ~ ".a";
+ if (testLibs || (shLibSupport() && ("shared" in settings)))
+ stbl ~= " -full";
+ vSaySystemRDie(stbl, "-rf", target ~ "_static.rf", deleteRFiles);
+
+ // perhaps test the static library
+ if (testLibs) {
+ writefln("Testing %s", target);
+ char[] tbl = bl ~ bflags ~ " -unittest -full " ~ fileList ~ " " ~ dsssLibTestDPrefix ~ " -oftest_" ~ target;
+ vSaySystemRDie(tbl, "-rf", target ~ "_test.rf", deleteRFiles);
+ vSaySystemDie("./test_" ~ target);
+ }
+
+ if (shLibSupport() &&
+ ("shared" in settings)) {
+ // then make the shared library
+ if (exists(shlibname)) std.file.remove(shlibname);
+ char[] shbl = bl ~ bflags ~ " -fPIC -explicit -shlib -full " ~ fileList ~ " -of" ~ shlibname ~
+ " " ~ shlibflag;
+
+ // finally, the shared compile
+ vSaySystemRDie(shbl, "-rf", target ~ "_shared.rf", deleteRFiles);
+ }
+
+ } else if (targetVersion("Windows")) {
+ // for the moment, only do a static library
+ if (exists(target ~ ".lib")) std.file.remove(target ~ ".lib");
+ char[] stbl = bl ~ docbl ~ bflags ~ " -explicit -lib " ~ fileList ~ " -of" ~ target ~ ".lib";
+ if (testLibs)
+ stbl ~= " -full";
+ vSaySystemRDie(stbl, "-rf", target ~ "_static.rf", deleteRFiles);
+
+ // perhaps test the static library
+ if (testLibs) {
+ writefln("Testing %s", target);
+ char[] tbl = bl ~ bflags ~ " -unittest -full " ~ fileList ~ " " ~ dsssLibTestDPrefix ~ " -oftest_" ~ target ~ ".exe";
+ vSaySystemRDie(tbl, "-rf", target ~ "_test.rf", deleteRFiles);
+ vSaySystemDie("test_" ~ target ~ ".exe");
+ }
+
+ } else {
+ assert(0);
+ }
+}
173 include/d/sss/clean.d
@@ -0,0 +1,173 @@
+/**
+ * DSSS commands "clean" an "distclean"
+ *
+ * Authors:
+ * Gregor Richards
+ *
+ * License:
+ * Copyright (c) 2006, 2007 Gregor Richards
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+module sss.clean;
+
+import std.file;
+import std.path;
+import std.stdio;
+import std.string;
+
+import sss.conf;
+
+import hcf.path;
+
+/** A utility function to attempt removal of a file but not fail on error */
+void tryRemove(char[] fn)
+{
+ try {
+ std.file.remove(fn);
+ } catch (Exception e) {
+ // ignored
+ }
+}
+
+/** Clean a tree: Remove all empty directories in the tree */
+void cleanTree(char[] dirn)
+{
+ try {
+ rmdir(dirn);
+ cleanTree(getDirName(dirn));
+ } catch (Exception e) {
+ // ignored
+ }
+}
+
+/** The entry function to the DSSS "clean" command */
+int clean(DSSSConf conf = null) {
+ // fairly simple, get rid of easy things - dsss_objs and dsss_imports
+ if (exists("dsss_objs"))
+ rmRecursive("dsss_objs");
+ if (exists("dsss_imports"))
+ rmRecursive("dsss_imports");
+ if (exists("dsss_docs"))
+ rmRecursive("dsss_docs");
+ return 0;
+}
+
+/** The entry function to the DSSS "distclean" command */
+int distclean(DSSSConf conf = null)
+{
+ // get the configuration
+ if (conf is null)
+ conf = readConfig(null);
+
+ // distclean implies clean
+ int res = clean(conf);
+ if (res) return res;
+ writefln("");
+
+ // get the sources
+ char[][] buildSources = sourcesByElems(null, conf);
+
+ // then go through and delete actual files
+ foreach (build; buildSources) {
+ char[][char[]] settings = conf.settings[build];
+
+ // basic info
+ char[] type = settings["type"];
+ char[] target = settings["target"];
+
+ // tell what we're doing
+ writefln("Removing %s", target);
+
+ // do the preclean step
+ if ("preclean" in settings) {
+ dsssScriptedStep(conf, settings["preclean"]);
+ }
+
+ if (type == "library" || type == "sourcelibrary") {
+ if (targetGNUOrPosix()) {
+ // first remove the static library
+ tryRemove("lib" ~ target ~ ".a");
+
+ // then any testing binary
+ tryRemove("test_" ~ target);
+
+ // then remove the shared libraries
+ char[] shlibname = getShLibName(settings);
+ char[][] shortshlibnames = getShortShLibNames(settings);
+
+ tryRemove(shlibname);
+ foreach (ssln; shortshlibnames) {
+ tryRemove(ssln);
+ }
+
+ } else if (targetVersion("Windows")) {
+ // first remove the static library
+ tryRemove(target ~ ".lib");
+
+ // then any testing binary
+ tryRemove("test_" ~ target);
+
+ // then remove the shared libraries
+ char[] shlibname = getShLibName(settings);
+ char[][] shortshlibnames = getShortShLibNames(settings);
+
+ tryRemove(shlibname);
+ foreach (ssln; shortshlibnames) {
+ tryRemove(ssln);
+ }
+ } else {
+ assert(0);
+ }
+
+ } else if (type == "binary") {
+ if (targetVersion("Posix")) {
+ tryRemove(target);
+ } else if (targetVersion("Windows")) {
+ tryRemove(target ~ ".exe");
+ } else {
+ assert(0);
+ }
+
+ } else if (type == "subdir") {
+ // recurse
+ char[] origcwd = getcwd();
+ chdir(build);
+ int cleanret = distclean();
+ if (cleanret) return cleanret;
+ chdir(origcwd);
+
+ }
+
+ // do the postclean step
+ if ("postclean" in settings) {
+ dsssScriptedStep(conf, settings["postclean"]);
+ }
+
+ writefln("");
+ }
+
+ // and the lastbuild file if it exists
+ if (exists(configLBName)) {
+ tryRemove(configLBName);
+ }
+
+ return 0;
+}
1,351 include/d/sss/conf.d
<
@@ -0,0 +1,1351 @@
+/**
+ * DSSS configuration stuff
+ *
+ * Authors:
+ * Gregor Richards
+ *
+ * License:
+ * Copyright (c) 2006, 2007 Gregor Richards
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING