├── .gitignore
├── Dockerfile
├── Passage_v4_UnixSource
├── cleanEverything
├── gamma256
│ ├── build
│ │ ├── macOSX
│ │ │ ├── Passage.app
│ │ │ │ └── Contents
│ │ │ │ │ ├── Info.plist
│ │ │ │ │ ├── MacOS
│ │ │ │ │ └── dummy.txt
│ │ │ │ │ ├── PkgInfo
│ │ │ │ │ └── Resources
│ │ │ │ │ ├── Passage.icns
│ │ │ │ │ └── Passage.rsrc
│ │ │ ├── iconColor.png
│ │ │ └── iconMask.png
│ │ ├── makeDistributionMacOSX
│ │ ├── makeDistributions
│ │ ├── source
│ │ │ ├── cleanSrc
│ │ │ ├── exportSrc
│ │ │ └── runToBuild
│ │ └── win32
│ │ │ ├── Passage.ico
│ │ │ ├── SDL.dll
│ │ │ └── iconSource.png
│ ├── documentation
│ │ ├── Readme.txt
│ │ └── changeLog.txt
│ ├── gameSource
│ │ ├── Envelope.cpp
│ │ ├── Envelope.h
│ │ ├── HashTable.h
│ │ ├── Makefile
│ │ ├── Makefile.GnuLinux
│ │ ├── Makefile.MacOSX
│ │ ├── Makefile.MinGW
│ │ ├── Makefile.all
│ │ ├── Timbre.cpp
│ │ ├── Timbre.h
│ │ ├── World.cpp
│ │ ├── World.h
│ │ ├── blowUp.cpp
│ │ ├── blowUp.h
│ │ ├── characterSprite.png
│ │ ├── characterSpriteSad.png
│ │ ├── chest.png
│ │ ├── chestDust.png
│ │ ├── chestPrize.png
│ │ ├── common.cpp
│ │ ├── common.h
│ │ ├── configure
│ │ ├── game.cpp
│ │ ├── graphics
│ │ │ ├── characterSprite.tga
│ │ │ ├── characterSpriteSad.tga
│ │ │ ├── chest.tga
│ │ │ ├── chestDust.tga
│ │ │ ├── chestPrize.tga
│ │ │ ├── heart.tga
│ │ │ ├── numerals.tga
│ │ │ ├── spouseSprite.tga
│ │ │ ├── tileSet.tga
│ │ │ └── title.tga
│ │ ├── heart.png
│ │ ├── iPhone
│ │ │ ├── Icon.png
│ │ │ ├── Info.plist
│ │ │ ├── LargeIcon.png
│ │ │ ├── MainWindow.xib
│ │ │ ├── arrows.png
│ │ │ ├── arrows.tga
│ │ │ ├── blowUp.cpp
│ │ │ ├── blowUp.h
│ │ │ ├── common.cpp
│ │ │ ├── drawIntoScreen.h
│ │ │ ├── game.cpp
│ │ │ ├── gameWindowApp.xcodeproj
│ │ │ │ ├── jasonrohrer.mode1v3
│ │ │ │ ├── jasonrohrer.pbxuser
│ │ │ │ └── project.pbxproj
│ │ │ ├── gameWindowAppDelegate.h
│ │ │ ├── gameWindowAppDelegate.mm
│ │ │ ├── gameWindowApp_Prefix.pch
│ │ │ ├── main.m
│ │ │ ├── musicPlayer.cpp
│ │ │ ├── reports
│ │ │ │ ├── S_D_80075145_999998_20081223_20081229154951691.txt
│ │ │ │ ├── S_D_80075145_999998_20081224_20081229155013664.txt
│ │ │ │ ├── S_D_80075145_999998_20081225_20081229155019662.txt
│ │ │ │ ├── S_D_80075145_999998_20081226_2008122915502587.txt
│ │ │ │ ├── S_D_80075145_999998_20081227_20081229155031472.txt
│ │ │ │ ├── S_D_80075145_999998_20081228_20081229155036881.txt
│ │ │ │ ├── S_D_80075145_999998_20081229_20090102170456173.txt
│ │ │ │ ├── S_D_80075145_999998_20081230_2009010217055919.txt
│ │ │ │ ├── S_D_80075145_999998_20081231_2009010217062259.txt
│ │ │ │ ├── S_D_80075145_999998_20090101_20090102170648169.txt
│ │ │ │ ├── S_D_80075145_999998_20090102_2009010615085482.txt
│ │ │ │ ├── S_D_80075145_999998_20090103_20090106150905023.txt
│ │ │ │ ├── S_D_80075145_999998_20090104_20090106150910384.txt
│ │ │ │ ├── S_D_80075145_999998_20090105_20090106150917837.txt
│ │ │ │ ├── S_D_80075145_999998_20090107_20090114175227209.txt
│ │ │ │ ├── S_D_80075145_999998_20090108_20090114175235627.txt
│ │ │ │ ├── S_D_80075145_999998_20090109_20090114175240828.txt
│ │ │ │ ├── S_D_80075145_999998_20090110_20090114175246221.txt
│ │ │ │ ├── S_D_80075145_999998_20090111_20090114175250853.txt
│ │ │ │ ├── S_D_80075145_999998_20090112_200901141752552.txt
│ │ │ │ └── S_D_80075145_999998_20090113_20090114175300581.txt
│ │ │ ├── screenShot.png
│ │ │ ├── storeDescription.txt
│ │ │ └── testScreenDrawer.cpp
│ │ ├── landscape.cpp
│ │ ├── landscape.h
│ │ ├── mac
│ │ │ ├── SDLMain.h
│ │ │ └── SDLMain.m
│ │ ├── map.cpp
│ │ ├── map.h
│ │ ├── music.png
│ │ ├── music
│ │ │ └── music.tga
│ │ ├── musicPlayer.cpp
│ │ ├── musicPlayer.h
│ │ ├── numerals.png
│ │ ├── numerals3.png
│ │ ├── score.cpp
│ │ ├── score.h
│ │ ├── settings
│ │ │ ├── fullscreen.ini
│ │ │ ├── screenHeight.ini
│ │ │ └── screenWidth.ini
│ │ ├── spouseSprite.png
│ │ ├── testMusicPlayer.cpp
│ │ ├── testNoise.cpp
│ │ ├── tileSet.png
│ │ ├── tileTemplate.png
│ │ └── title.png
│ └── prototypes
│ │ └── screenCompress
│ │ ├── Makefile
│ │ ├── characterSprite.png
│ │ ├── characterSprite.tga
│ │ ├── compile
│ │ ├── landscape.cpp
│ │ ├── landscape.h
│ │ ├── mapTile.tga
│ │ ├── screenCompress.cpp
│ │ ├── sdlTest.cpp
│ │ ├── tileSet.png
│ │ ├── tileSet.tga
│ │ ├── tileTemplate.png
│ │ └── tileTemplate.tga
├── minorGems
│ ├── .emacs
│ ├── build
│ │ ├── Makefile.minorGems
│ │ └── Makefile.minorGems_targets
│ ├── common.h
│ ├── crypto
│ │ └── hashes
│ │ │ ├── sha1.cpp
│ │ │ ├── sha1.h
│ │ │ ├── sha1Test.cpp
│ │ │ ├── sha1TestCompile
│ │ │ ├── sha1sum.cpp
│ │ │ └── sha1sumCompile
│ ├── formats
│ │ ├── encodingUtils.cpp
│ │ ├── encodingUtils.h
│ │ ├── encodingUtilsTest.cpp
│ │ ├── encodingUtilsTestCompile
│ │ ├── html
│ │ │ ├── HTMLUtils.cpp
│ │ │ └── HTMLUtils.h
│ │ └── xml
│ │ │ ├── XMLUtils.cpp
│ │ │ └── XMLUtils.h
│ ├── graphics
│ │ ├── 3d
│ │ │ ├── LandscapePrimitive3D.h
│ │ │ ├── LathePrimitive3D.h
│ │ │ ├── Object3D.h
│ │ │ ├── Object3DFactory.h
│ │ │ ├── Primitive3D.h
│ │ │ └── Primitive3DFactory.h
│ │ ├── ChannelFilter.h
│ │ ├── Color.h
│ │ ├── GraphicBuffer.h
│ │ ├── IconMap.h
│ │ ├── Image.h
│ │ ├── ImageColorConverter.h
│ │ ├── ImageConverter.h
│ │ ├── RGBAImage.h
│ │ ├── ScreenGraphics.h
│ │ ├── converters
│ │ │ ├── BMPImageConverter.h
│ │ │ ├── BigEndianImageConverter.h
│ │ │ ├── JPEGImageConverter.h
│ │ │ ├── LittleEndianImageConverter.h
│ │ │ ├── PNGImageConverter.cpp
│ │ │ ├── PNGImageConverter.h
│ │ │ ├── TGAImageConverter.h
│ │ │ ├── bmpConverterTest.cpp
│ │ │ ├── bmpformat.txt
│ │ │ ├── compileTestPNG
│ │ │ ├── jpegConverterTest.cpp
│ │ │ ├── jpegConverterTestCompile
│ │ │ ├── libpngSample.cpp
│ │ │ ├── lodepng.cpp
│ │ │ ├── lodepng.h
│ │ │ ├── testPNG.cpp
│ │ │ └── unix
│ │ │ │ └── JPEGImageConverterUnix.cpp
│ │ ├── filters
│ │ │ ├── BoxBlurFilter.h
│ │ │ ├── InvertFilter.h
│ │ │ ├── MedianFilter.h
│ │ │ ├── MultiFilter.h
│ │ │ ├── SeamlessFilter.h
│ │ │ ├── ThresholdFilter.h
│ │ │ └── quickselect.h
│ │ ├── getKey.h
│ │ ├── getMouse.h
│ │ ├── keyCodes.h
│ │ ├── linux
│ │ │ ├── SDLTest.cpp
│ │ │ ├── ScreenGraphicsLinux.cpp
│ │ │ └── graphixCommonDefs.h
│ │ ├── loadFile.cpp
│ │ ├── loadfile.h
│ │ ├── mac
│ │ │ ├── graphixCommonDefs.h
│ │ │ └── graphixFramework.cpp
│ │ ├── swapBuffers.h
│ │ ├── test
│ │ │ ├── rgb2yiq.cpp
│ │ │ ├── rgb2yiqCompile
│ │ │ ├── tgaConverter.cpp
│ │ │ ├── tgaConverterCompile
│ │ │ ├── yiq2rgb.cpp
│ │ │ └── yiq2rgbCompile
│ │ └── win32
│ │ │ ├── graphixCommonDefs.h
│ │ │ └── graphixFramework.cpp
│ ├── io
│ │ ├── InputStream.h
│ │ ├── OutputStream.h
│ │ ├── PipedStream.h
│ │ ├── Serializable.h
│ │ ├── Stream.h
│ │ ├── TypeIO.h
│ │ ├── file
│ │ │ ├── Directory.h
│ │ │ ├── File.h
│ │ │ ├── FileInputStream.h
│ │ │ ├── FileOutputStream.h
│ │ │ ├── Path.h
│ │ │ ├── UniversalFileIO.h
│ │ │ ├── linux
│ │ │ │ └── PathLinux.cpp
│ │ │ ├── test
│ │ │ │ ├── testChildFiles.cpp
│ │ │ │ └── testPath.cpp
│ │ │ ├── testPath.cpp
│ │ │ ├── unix
│ │ │ │ └── DirectoryUnix.cpp
│ │ │ └── win32
│ │ │ │ ├── DirectoryWin32.cpp
│ │ │ │ ├── PathWin32.cpp
│ │ │ │ ├── dirent.cpp
│ │ │ │ └── dirent.h
│ │ ├── linux
│ │ │ └── TypeIOLinux.cpp
│ │ ├── pipedStreamTest.cpp
│ │ ├── serialPort
│ │ │ ├── SerialPort.h
│ │ │ ├── SerialPortFromFile.cpp
│ │ │ ├── linux
│ │ │ │ └── SerialPortLinux.cpp
│ │ │ ├── testSerialPort.cpp
│ │ │ ├── testSerialPortCompile
│ │ │ └── win32
│ │ │ │ ├── COMPort.cpp
│ │ │ │ ├── COMPort.h
│ │ │ │ └── SerialPortWin32.cpp
│ │ └── win32
│ │ │ └── TypeIOWin32.cpp
│ ├── numtest.cpp
│ ├── protocol
│ │ └── p2p
│ │ │ ├── anonymousPublishing.txt
│ │ │ ├── genericProtocol.txt
│ │ │ ├── motivationEmail.txt
│ │ │ ├── notes.tex
│ │ │ └── resourceSpecifications.txt
│ ├── system
│ │ ├── BinarySemaphore.h
│ │ ├── FinishedSignalThread.cpp
│ │ ├── FinishedSignalThread.h
│ │ ├── FinishedSignalThreadManager.cpp
│ │ ├── FinishedSignalThreadManager.h
│ │ ├── Launcher.h
│ │ ├── MutexLock.h
│ │ ├── Semaphore.h
│ │ ├── StopSignalThread.cpp
│ │ ├── StopSignalThread.h
│ │ ├── TestThread.cpp
│ │ ├── TestThread.h
│ │ ├── Thread.h
│ │ ├── ThreadSafePrinter.h
│ │ ├── Time.h
│ │ ├── endian.h
│ │ ├── linux
│ │ │ ├── BinarySemaphoreLinux.cpp
│ │ │ ├── MutexLockLinux.cpp
│ │ │ └── ThreadLinux.cpp
│ │ ├── semaphoreTest.cpp
│ │ ├── unix
│ │ │ ├── LauncherUnix.cpp
│ │ │ └── TimeUnix.cpp
│ │ └── win32
│ │ │ ├── BinarySemaphoreWin32.cpp
│ │ │ ├── LauncherWin32.cpp
│ │ │ ├── MutexLockWin32.cpp
│ │ │ ├── ThreadWin32.cpp
│ │ │ └── TimeWin32.cpp
│ ├── ui
│ │ ├── GUIComponent.h
│ │ ├── Keyboard.h
│ │ ├── Mouse.h
│ │ ├── Plot.cpp
│ │ ├── Plot.h
│ │ ├── ProgressBar.cpp
│ │ ├── ProgressBar.h
│ │ ├── SetMouse.h
│ │ ├── SetMouseMac.cpp
│ │ ├── SetMouseWin32.cpp
│ │ ├── event
│ │ │ ├── ActionListener.h
│ │ │ └── ActionListenerList.h
│ │ └── linux
│ │ │ ├── KeyboardLinux.cpp
│ │ │ └── MouseLinux.cpp
│ └── util
│ │ ├── CircularBuffer.h
│ │ ├── SettingsManager.cpp
│ │ ├── SettingsManager.h
│ │ ├── SimpleVector.h
│ │ ├── StringBufferOutputStream.cpp
│ │ ├── StringBufferOutputStream.h
│ │ ├── TranslationManager.cpp
│ │ ├── TranslationManager.h
│ │ ├── development
│ │ ├── fortify
│ │ │ ├── FORTIFY.DOC
│ │ │ ├── Makefile
│ │ │ ├── fortify.cpp
│ │ │ ├── fortify.h
│ │ │ ├── test.c
│ │ │ ├── test2.cpp
│ │ │ ├── test3.cpp
│ │ │ └── ufortify.h
│ │ ├── leakTracer
│ │ │ ├── LeakCheck
│ │ │ ├── LeakCheckAnalyze
│ │ │ ├── LeakTracer.cc
│ │ │ ├── Makefile
│ │ │ ├── README
│ │ │ ├── README.html
│ │ │ ├── VERSION
│ │ │ ├── leak-analyze
│ │ │ └── test.cc
│ │ └── memory
│ │ │ ├── MemoryTrack.cpp
│ │ │ ├── MemoryTrack.h
│ │ │ ├── compileTestDebugMemory
│ │ │ ├── debugMemory.cpp
│ │ │ ├── debugMemory.h
│ │ │ └── testDebugMemory.cpp
│ │ ├── log
│ │ ├── AppLog.cpp
│ │ ├── AppLog.h
│ │ ├── FileLog.cpp
│ │ ├── FileLog.h
│ │ ├── Log.cpp
│ │ ├── Log.h
│ │ ├── Makefile
│ │ ├── PrintLog.cpp
│ │ ├── PrintLog.h
│ │ └── testLog.cpp
│ │ ├── printUtils.cpp
│ │ ├── printUtils.h
│ │ ├── random
│ │ ├── CustomRandomSource.h
│ │ ├── Noise.cpp
│ │ ├── Noise.h
│ │ ├── RandomSource.h
│ │ ├── StdRandomSource.h
│ │ └── testRandom.cpp
│ │ ├── stringUtils.cpp
│ │ ├── stringUtils.h
│ │ ├── test
│ │ ├── testSnprintf.cpp
│ │ └── testSnprintf.mingw.out
│ │ └── vectorTest.cpp
├── runToBuild
└── www
│ └── index.html
├── README.md
├── dist
├── Passage.data
├── Passage.html
├── Passage.html.mem
├── Passage.js
└── index.html
├── docker-compose.yml
└── entrypoint.sh
/.gitignore:
--------------------------------------------------------------------------------
1 | *.o
2 | Passage.*
3 | Passage_v4_UnixSource/www/Readme.txt
4 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM java:jre
2 |
3 | RUN apt-get update
4 | RUN apt-get install -y cmake nodejs
5 | RUN apt-get install -y python2.7
6 | RUN apt-get install -y git build-essential
7 |
8 | RUN ln -s /usr/bin/nodejs /usr/bin/node && \
9 | ln -s /usr/bin/python2.7 /usr/bin/python
10 |
11 | RUN curl https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz > /root/emsdk-portable.tar.gz && \
12 | cd /root && tar -zxvf emsdk-portable.tar.gz && \
13 | cd emsdk_portable && \
14 | ./emsdk update && \
15 | ./emsdk install latest
16 |
17 | RUN cd /root/emsdk_portable && \
18 | ./emsdk activate latest && \
19 | ln -s /usr/bin/python /usr/bin/python2
20 |
21 | COPY entrypoint.sh /root/
22 |
23 | ENTRYPOINT ["/bin/bash", "/root/entrypoint.sh"]
24 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/cleanEverything:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | find . -name '*.o' -print0 | xargs -0 rm -f
4 | rm -f ./gamma256/gameSource/Passage.* ./www/Passage.* ./www/Readme.txt
5 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/build/macOSX/Passage.app/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleInfoDictionaryVersion
6 | 6.0
7 | CFBundleIdentifier
8 | org.passage
9 | CFBundleDevelopmentRegion
10 | English
11 | CFBundleExecutable
12 | Passage
13 | CFBundleIconFile
14 | Passage.icns
15 | CFBundleName
16 | Passage
17 | CFBundlePackageType
18 | APPL
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 0
23 | CFBundleShortVersionString
24 | 0
25 | CFBundleGetInfoString
26 | Passage
27 | CFBundleLongVersionString
28 | 0
29 | NSHumanReadableCopyright
30 | Public Domain, 2007
31 | LSRequiresCarbon
32 |
33 | CSResourcesFileMapped
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/build/macOSX/Passage.app/Contents/MacOS/dummy.txt:
--------------------------------------------------------------------------------
1 | A placeholder file so that "cvs export" will include this otherwise empty
2 | directory.
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/build/macOSX/Passage.app/Contents/PkgInfo:
--------------------------------------------------------------------------------
1 | APPL????
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/build/macOSX/Passage.app/Contents/Resources/Passage.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/build/macOSX/Passage.app/Contents/Resources/Passage.icns
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/build/macOSX/Passage.app/Contents/Resources/Passage.rsrc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/build/macOSX/Passage.app/Contents/Resources/Passage.rsrc
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/build/macOSX/iconColor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/build/macOSX/iconColor.png
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/build/macOSX/iconMask.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/build/macOSX/iconMask.png
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/build/makeDistributionMacOSX:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Modification History
5 | #
6 | # 2007-November-12 Jason Rohrer
7 | # Copied from Cultivation build.
8 | #
9 |
10 |
11 | if [ $# -lt 3 ] ; then
12 | echo "Usage: $0 release_name unix_platform_name path_to_SDL.framework"
13 | exit 1
14 | fi
15 |
16 |
17 | rm -rf mac
18 |
19 | mkdir mac
20 |
21 | mkdir mac/Passage
22 | mkdir mac/Passage/graphics
23 | mkdir mac/Passage/music
24 | mkdir mac/Passage/settings
25 |
26 | cp ../documentation/Readme.txt mac/Passage/
27 |
28 | cp ../gameSource/graphics/*.tga mac/Passage/graphics
29 | cp ../gameSource/music/*.tga mac/Passage/music
30 | cp ../gameSource/settings/*.ini mac/Passage/settings
31 |
32 |
33 |
34 |
35 | cp -r macOSX/Passage.app mac/Passage/Passage.app
36 | cp ../gameSource/Passage mac/Passage/Passage.app/Contents/MacOS
37 |
38 | rm -r mac/Passage/Passage.app/CVS
39 | rm -r mac/Passage/Passage.app/Contents/CVS
40 | rm -r mac/Passage/Passage.app/Contents/MacOS/CVS
41 | rm -r mac/Passage/Passage.app/Contents/Resources/CVS
42 | rm -r mac/Passage/Passage.app/Contents/Frameworks/CVS
43 |
44 | # install SDL framework
45 | cp -r $3 mac/Passage/Passage.app/Contents/Frameworks/
46 |
47 | cd mac
48 | tar cf "Passage_$1_$2.tar" Passage
49 | gzip "Passage_$1_$2.tar"
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/build/makeDistributions:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Modification History
5 | #
6 | # 2007-November-12 Jason Rohrer
7 | # Copied from Cultivation build.
8 | #
9 |
10 |
11 | if [ $# -lt 2 ] ; then
12 | echo "Usage: $0 release_name unix_platform_name"
13 | exit 1
14 | fi
15 |
16 |
17 | rm -rf unix
18 | rm -rf windows
19 |
20 | mkdir windows
21 | mkdir unix
22 |
23 |
24 | # work on unix tree first
25 | mkdir unix/Passage
26 | mkdir unix/Passage/graphics
27 | mkdir unix/Passage/music
28 | mkdir unix/Passage/settings
29 |
30 | cp ../documentation/Readme.txt unix/Passage/
31 |
32 | cp ../gameSource/graphics/*.tga unix/Passage/graphics
33 | cp ../gameSource/music/*.tga unix/Passage/music
34 | cp ../gameSource/settings/*.ini unix/Passage/settings
35 |
36 |
37 | # duplicate unix tree so far to make windows tree
38 | cp -r unix/Passage windows/
39 |
40 | cp ../gameSource/Passage unix/Passage/
41 |
42 | cp win32/Passage.exe win32/*.dll windows/Passage/
43 |
44 | cd unix
45 | tar cf "Passage_$1_$2.tar" Passage
46 | gzip "Passage_$1_$2.tar"
47 |
48 |
49 |
50 | cd ../windows
51 | zip -r "Passage_$1_Windows.zip" Passage
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/build/source/cleanSrc:
--------------------------------------------------------------------------------
1 | rm -r minorGems/ai
2 | rm -r minorGems/bench
3 | rm -r minorGems/doc
4 | rm -r minorGems/examples
5 | rm -r minorGems/sound
6 | rm -r minorGems/temp
7 | rm -r minorGems/graphics/openGL
8 | rm -r minorGems/network
9 | rm -r minorGems/math
10 |
11 |
12 |
13 | rm -r gamma256/documentation/concept
14 | rm -r gamma256/documentation/html
15 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/build/source/exportSrc:
--------------------------------------------------------------------------------
1 | cvs -z3 -d:ext:jcr13@minorgems.cvs.sourceforge.net:/cvsroot/minorgems export -r HEAD minorGems
2 | cvs -z3 -d:ext:jcr13@hcsoftware.cvs.sourceforge.net:/cvsroot/hcsoftware export -r HEAD gamma256
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/build/source/runToBuild:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #
4 | # Modification History
5 | #
6 | # 2007-November-12 Jason Rohrer
7 | # Copied from Cultivation.
8 | #
9 |
10 |
11 | cd gamma256/gameSource
12 | chmod u+x ./configure
13 | ./configure
14 |
15 |
16 |
17 | echo "Building Passage..."
18 |
19 | make
20 |
21 |
22 |
23 | cd ../..
24 |
25 | mkdir graphics
26 | mkdir music
27 | mkdir settings
28 |
29 | cp gamma256/gameSource/Passage ./Passage
30 | cp gamma256/documentation/Readme.txt .
31 | cp gamma256/gameSource/graphics/* ./graphics
32 | cp gamma256/gameSource/music/* ./music
33 | cp gamma256/gameSource/settings/* ./settings
34 |
35 | echo "Run Passage to play."
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/build/win32/Passage.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/build/win32/Passage.ico
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/build/win32/SDL.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/build/win32/SDL.dll
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/build/win32/iconSource.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/build/win32/iconSource.png
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/documentation/Readme.txt:
--------------------------------------------------------------------------------
1 | For instructions, please see: http://hcsoftware.sf.net/passage
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/documentation/changeLog.txt:
--------------------------------------------------------------------------------
1 | Version 4 2010-May-24
2 |
3 | --Fixed error in application of patch for older SDL versions.
4 |
5 | --Fixed random number generation so that it works on 64-bit platforms (thanks
6 | to Kevin Fan).
7 |
8 | --Fixed chest gem selection behavior on certain platforms (like iPhone).
9 |
10 | --Fixed unsafe use of pointers into vector (triggered a bug with new shorter
11 | default vector size).
12 |
13 | --Fixed string warnings that are caught by certain GCC versions.
14 |
15 |
16 |
17 |
18 | Version 3 2007-December-13
19 |
20 | --Switched to analog stick on 360 controller for much smoother play.
21 |
22 | --Added patch for older SDL versions provided by Jarno van der Kolk.
23 |
24 | --Added ESC in addition to Q to quit.
25 |
26 | --Added settings files for controlling screen size and fullscreen mode.
27 |
28 |
29 |
30 | Version 2 2007-November-13
31 |
32 | --Added chiptune music soundtrack.
33 |
34 | --Improved star sprite.
35 |
36 | --Fixed bug with window sizing (manifested by title being set too low).
37 |
38 | --Improved behavior of screen blow-up/blow-down keys.
39 |
40 | --Fixed bug in game reset that can result in artifacts during subsequent plays.
41 |
42 | --Fixed artifacts after screen blow-up factor change on double-buffered
43 | platforms.
44 |
45 | --Fixed problem with screen pitch.
46 |
47 | --Now builds for MacOSX 10.2 and higher (using MinGW and SDL).
48 |
49 | --Unix source distribution now available (compiles against SDL developer
50 | library).
51 |
52 |
53 |
54 | Version 1 2007-November-1
55 |
56 | --Initial release (Gamma256 submission)
57 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/Envelope.h:
--------------------------------------------------------------------------------
1 |
2 |
3 | class Envelope {
4 | public:
5 |
6 |
7 | /**
8 | * Constructs an envelope.
9 | *
10 | * All parameters are in range 0..1, and sum of the three time
11 | * parameters must be <= 1.
12 | *
13 | * @param inMaxNoteLengthInGridSteps the maximum note length to
14 | * cover. Exact envelopes will be generated for notes up
15 | * to this length.
16 | * @param inGridStepDurationInSamples the number of samples
17 | * per grid step.
18 | */
19 | Envelope( double inAttackTime, double inDecayTime,
20 | double inSustainLevel, double inReleaseTime,
21 | int inMaxNoteLengthInGridSteps,
22 | int inGridStepDurationInSamples );
23 |
24 | ~Envelope();
25 |
26 |
27 |
28 | /**
29 | * Gets an evenlope for a given note length.
30 | *
31 | * @return an evelope of values in [0,1] that can be indexed by
32 | * sample number. Will be destroyed when this class is destroyed.
33 | */
34 | double *getEnvelope( int inNoteLengthInGridSteps );
35 |
36 |
37 |
38 | private:
39 |
40 | int mNumComputedEnvelopes;
41 |
42 | int *mEvelopeLengths;
43 |
44 | double **mComputedEnvelopes;
45 | };
46 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/Makefile.GnuLinux:
--------------------------------------------------------------------------------
1 | PLATFORM_PATH = linux
2 | PLATFORM_NAME = Linux
3 | TIME_PLATFORM_PATH = unix
4 | TIME_PLATFORM_NAME = Unix
5 |
6 | PLATFORM_COMPILE_FLAGS =
7 |
8 | PLATFORM_LINK_FLAGS = -lSDL -lpthread
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/Makefile.MacOSX:
--------------------------------------------------------------------------------
1 | PLATFORM_PATH = linux
2 | PLATFORM_NAME = Linux
3 | TIME_PLATFORM_PATH = unix
4 | TIME_PLATFORM_NAME = Unix
5 |
6 |
7 | PLATFORM_COMPILE_FLAGS = -DBSD -D__mac__
8 |
9 |
10 | # need to compile and link SDLMain.m
11 | PLATFORM_LINK_FLAGS = -framework SDL -framework Cocoa mac/SDLMain.m
12 |
13 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/Makefile.MinGW:
--------------------------------------------------------------------------------
1 | PLATFORM_PATH = win32
2 | PLATFORM_NAME = Win32
3 | TIME_PLATFORM_PATH = win32
4 | TIME_PLATFORM_NAME = Win32
5 |
6 | PLATFORM_COMPILE_FLAGS =
7 |
8 | # -mwindows hides the command window on app launch
9 | PLATFORM_LINK_FLAGS = -lmingw32 -lSDLmain -lSDL -mwindows
10 |
11 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/Timbre.h:
--------------------------------------------------------------------------------
1 | #include
2 | typedef int16_t Sint16;
3 |
4 |
5 |
6 | class Timbre {
7 | public:
8 |
9 | /**
10 | * Constructs a timbre and fills its wavetables.
11 | *
12 | * @param inSampleRate number of samples per second.
13 | * @param inLoudness a scale factor in [0,1].
14 | * @param inBaseFrequency the lowest note in the wave table, in Hz.
15 | * This is also the key for the major scale held in the wave table.
16 | * @param inNumWaveTableEntries the number of wavetable entries.
17 | * @param inWaveFunction a function mapping a double parameter t
18 | * to a wave height in [-1,1]. Must have a period of 2pi.
19 | */
20 | Timbre( int inSampleRate,
21 | double inLoudness,
22 | double inBaseFrequency,
23 | int inNumWaveTableEntries,
24 | double( *inWaveFunction )( double ) );
25 |
26 | ~Timbre();
27 |
28 |
29 |
30 | int mNumWaveTableEntries;
31 | // mWaveTable[x] corresponds to a wave with frequency of
32 | // getFrequency(x)
33 | Sint16 **mWaveTable;
34 | int *mWaveTableLengths;
35 | };
36 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/World.h:
--------------------------------------------------------------------------------
1 | #include
2 | typedef uint32_t Uint32;
3 |
4 |
5 | // these can be called once at beginning and end of app execution
6 | // since loaded graphics can be reused for multiple games
7 | void loadWorldGraphics();
8 | void destroyWorldGraphics();
9 |
10 |
11 | // these should be called at the beginning and end of each new game
12 | void initWorld();
13 | void destroyWorld();
14 |
15 |
16 | Uint32 sampleFromWorld( int inX, int inY, double inWeight = 1.0 );
17 |
18 |
19 | void startPrizeAnimation( int inX, int inY );
20 | void startDustAnimation( int inX, int inY );
21 |
22 | void setPlayerPosition( int inX, int inY );
23 | void setPlayerSpriteFrame( int inFrame );
24 |
25 |
26 | void getSpousePosition( int *outX, int *outY );
27 |
28 | char haveMetSpouse();
29 |
30 | void meetSpouse();
31 |
32 | void startHeartAnimation( int inX, int inY );
33 |
34 | void diePlayer();
35 |
36 | void dieSpouse();
37 |
38 | char isSpouseDead();
39 |
40 | char isPlayerDead();
41 |
42 |
43 |
44 | // age in range 0..1
45 | void setCharacterAges( double inAge );
46 |
47 |
48 |
49 |
50 | // push animations forward one step
51 | void stepAnimations();
52 |
53 |
54 |
55 |
56 | int getTileWidth();
57 |
58 |
59 | int getTileHeight();
60 |
61 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/blowUp.h:
--------------------------------------------------------------------------------
1 |
2 | #include
3 | #include
4 |
5 |
6 | /**
7 | * Blows an image up onto the screen using nearest neighbor (pixelated)
8 | * interpolation.
9 | */
10 | void blowupOntoScreen( Uint32 *inImage, int inWidth, int inHeight,
11 | int inBlowFactor, SDL_Surface *inScreen );
12 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/characterSprite.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/characterSprite.png
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/characterSpriteSad.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/characterSpriteSad.png
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/chest.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/chest.png
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/chestDust.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/chestDust.png
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/chestPrize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/chestPrize.png
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/common.cpp:
--------------------------------------------------------------------------------
1 | #include "common.h"
2 |
3 | #include "minorGems/graphics/converters/TGAImageConverter.h"
4 |
5 | #include "minorGems/io/file/File.h"
6 |
7 | #include "minorGems/io/file/FileInputStream.h"
8 |
9 |
10 |
11 | Image *readTGA( const char *inFileName ) {
12 | return readTGA( "graphics", inFileName );
13 | }
14 |
15 |
16 |
17 | Image *readTGA( const char *inFolderName, const char *inFileName ) {
18 | File tgaFile( new Path( inFolderName ), inFileName );
19 | FileInputStream tgaStream( &tgaFile );
20 |
21 | TGAImageConverter converter;
22 |
23 | return converter.deformatImage( &tgaStream );
24 | }
25 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/common.h:
--------------------------------------------------------------------------------
1 | #ifndef COMMON_INCLUDED
2 | #define COMMON_INCLUDED
3 |
4 |
5 |
6 | #include "minorGems/graphics/Image.h"
7 |
8 |
9 | // reads a TGA file from the default ("graphics") folder
10 | Image *readTGA( const char *inFileName );
11 |
12 |
13 | Image *readTGA( const char *inFolderName, const char *inFileName );
14 |
15 |
16 |
17 | #endif
18 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/configure:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #
4 | # Modification History
5 | #
6 | # 2007-November-12 Jason Rohrer
7 | # Copied/modified from Cultivation (game2) project.
8 | #
9 |
10 |
11 | while [ -z "$platformSelection" ]
12 | do
13 | echo "select platform:"
14 |
15 | echo " 1 -- GNU/Linux"
16 | echo " 2 -- MacOSX"
17 | echo " 3 -- Win32 using MinGW"
18 | echo " q -- quit"
19 |
20 | echo ""
21 | echo -n "> "
22 |
23 | read platformSelection
24 |
25 |
26 | if [ "$platformSelection" = "q" ]
27 | then
28 | exit
29 | fi
30 |
31 |
32 | # use ASCII comparison.
33 |
34 | if [[ "$platformSelection" > "3" ]]
35 | then
36 | platformSelection=""
37 | fi
38 |
39 | if [[ "$platformSelection" < "1" ]]
40 | then
41 | platformSelection=""
42 | fi
43 |
44 | done
45 |
46 |
47 |
48 | platformName="Generic"
49 | platformMakefile="generic"
50 |
51 |
52 |
53 | case "$platformSelection" in
54 |
55 |
56 | "1" )
57 | platformName="GNU/Linux"
58 | platformMakefile="Makefile.GnuLinux"
59 | ;;
60 |
61 |
62 | "2" )
63 | platformName="MacOSX"
64 | platformMakefile="Makefile.MacOSX"
65 | ;;
66 |
67 |
68 | "3" )
69 | platformName="Win32 MinGW"
70 | platformMakefile="Makefile.MinGW"
71 | ;;
72 |
73 |
74 | esac
75 |
76 |
77 |
78 | rm -f Makefile.temp
79 | echo "# Auto-generated by gamma256/gameSource/configure for the $platformName platform. Do not edit manually." > Makefile.temp
80 |
81 | rm -f Makefile
82 | cat Makefile.temp $platformMakefile Makefile.all > Makefile
83 |
84 |
85 | rm Makefile.temp
86 |
87 |
88 |
89 | exit
90 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/graphics/characterSprite.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/graphics/characterSprite.tga
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/graphics/characterSpriteSad.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/graphics/characterSpriteSad.tga
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/graphics/chest.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/graphics/chest.tga
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/graphics/chestDust.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/graphics/chestDust.tga
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/graphics/chestPrize.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/graphics/chestPrize.tga
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/graphics/heart.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/graphics/heart.tga
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/graphics/numerals.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/graphics/numerals.tga
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/graphics/spouseSprite.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/graphics/spouseSprite.tga
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/graphics/tileSet.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/graphics/tileSet.tga
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/graphics/title.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/graphics/title.tga
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/heart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/heart.png
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/iPhone/Icon.png
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIconFile
12 | Icon.png
13 | CFBundleIdentifier
14 | net.sf.hcsoftware.${PRODUCT_NAME}
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | ${PRODUCT_NAME}
19 | CFBundlePackageType
20 | APPL
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 3.1
25 | LSRequiresIPhoneOS
26 |
27 | NSMainNibFile
28 | MainWindow
29 | UIStatusBarHidden
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/LargeIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/iPhone/LargeIcon.png
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/arrows.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/iPhone/arrows.png
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/arrows.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/iPhone/arrows.tga
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/blowUp.h:
--------------------------------------------------------------------------------
1 | #include "drawIntoScreen.h"
2 |
3 |
4 | /**
5 | * Blows an image up onto the screen using nearest neighbor (pixelated)
6 | * interpolation.
7 | */
8 | void blowupOntoScreen( Uint32 *inImage, int inWidth, int inHeight,
9 | int inBlowFactor, Uint32 *inScreenPixels,
10 | int inScreenWidth, int inScreenHeight );
11 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/common.cpp:
--------------------------------------------------------------------------------
1 | #include "common.h"
2 |
3 | #include "minorGems/graphics/converters/TGAImageConverter.h"
4 |
5 | #include "minorGems/io/file/File.h"
6 |
7 | #include "minorGems/io/file/FileInputStream.h"
8 |
9 |
10 |
11 | Image *readTGA( char *inFileName ) {
12 | return readTGA( "graphics", inFileName );
13 | }
14 |
15 |
16 |
17 | Image *readTGA( char *inFolderName, char *inFileName ) {
18 | // ignore passed-in path (use bundle root)
19 | File tgaFile( NULL, inFileName );
20 | FileInputStream tgaStream( &tgaFile );
21 |
22 | TGAImageConverter converter;
23 |
24 | return converter.deformatImage( &tgaStream );
25 | }
26 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/drawIntoScreen.h:
--------------------------------------------------------------------------------
1 | // interface for generic screen drawing framework
2 |
3 | #include
4 |
5 | typedef uint32_t Uint32;
6 |
7 |
8 | void initScreenDrawer( Uint32 *inScreenBuffer, int inWidth, int inHeight );
9 |
10 | // each pixel is 4 characters
11 | void drawIntoScreen( Uint32 *inScreenBuffer, int inWidth, int inHeight );
12 |
13 | // set device orientation from accelerometer
14 | void setOrientation( float inX, float inY );
15 |
16 | void touchStartPoint( float inX, float inY );
17 |
18 | void touchMovePoint( float inX, float inY );
19 |
20 | void touchEndPoint( float inX, float inY );
21 |
22 | void freeScreenDrawer();
23 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/gameWindowAppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // testWindowAppAppDelegate.h
3 | // testWindowApp
4 | //
5 | // Created by Jason Rohrer on 12/14/08.
6 | // Copyright __MyCompanyName__ 2008. All rights reserved.
7 | //
8 |
9 | #include "drawIntoScreen.h"
10 |
11 | #import
12 | #import
13 | #import
14 | #import
15 |
16 | @interface MyView : UIView {
17 | @private
18 | NSTimer *animationTimer;
19 |
20 | /* The pixel dimensions of the backbuffer */
21 | GLint backingWidth;
22 | GLint backingHeight;
23 |
24 | EAGLContext *context;
25 |
26 | /* OpenGL names for the renderbuffer and framebuffers used to render to this view */
27 | GLuint viewRenderbuffer, viewFramebuffer;
28 |
29 | /* OpenGL name for the depth buffer that is attached to viewFramebuffer, if it exists (0 if it does not exist) */
30 | GLuint depthRenderbuffer;
31 |
32 | GLuint textureID;
33 |
34 |
35 |
36 | Uint32 *screenBitmap;
37 | int bitmapW;
38 | int bitmapH;
39 | int bitmapBytes;
40 |
41 | // for old DrawImage version
42 | // CGDataProviderRef provider;
43 | // CGColorSpaceRef colorSpaceRef;
44 | // CGImageRef imageRef;
45 | }
46 |
47 | @property NSTimer *animationTimer;
48 | @property (nonatomic, retain) EAGLContext *context;
49 |
50 | - (void)startAnimation;
51 | - (void)stopAnimation;
52 | - (void)drawFrame;
53 | - (BOOL) createFramebuffer;
54 | - (void) destroyFramebuffer;
55 |
56 | @end
57 |
58 |
59 | @interface gameWindowAppDelegate : NSObject {
60 | UIWindow *window;
61 | MyView *view;
62 | // used for low-pass filtering
63 | UIAccelerationValue accelerationBuffer[3];
64 | }
65 |
66 | @property (nonatomic, retain) IBOutlet UIWindow *window;
67 | @property (nonatomic, retain) IBOutlet MyView *view;
68 |
69 |
70 |
71 | @end
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/gameWindowApp_Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'testWindowApp' target in the 'testWindowApp' project
3 | //
4 |
5 | #ifdef __OBJC__
6 | #import
7 | #import
8 | #endif
9 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // testWindowApp
4 | //
5 | // Created by Jason Rohrer on 12/14/08.
6 | // Copyright __MyCompanyName__ 2008. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 |
12 |
13 | int main(int argc, char *argv[]) {
14 |
15 | //printf( "Arg 0 = %s\n", argv[0] );
16 |
17 | // arg 0 is the path to the app executable
18 | char *appDirectoryPath = strdup( argv[ 0 ] );
19 |
20 | //printf( "Mac: app path %s\n", appDirectoryPath );
21 |
22 | char *bundleName = "Passage.app";
23 |
24 | char *appNamePointer = strstr( appDirectoryPath, bundleName );
25 |
26 | if( appNamePointer != NULL ) {
27 | // terminate full app path to get bundle directory
28 | appNamePointer[ strlen( bundleName ) ] = '\0';
29 |
30 | printf( "Mac: changing working dir to %s\n", appDirectoryPath );
31 | chdir( appDirectoryPath );
32 | }
33 |
34 | free( appDirectoryPath );
35 |
36 |
37 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
38 | int retVal = UIApplicationMain(argc, argv, nil, nil);
39 | [pool release];
40 | return retVal;
41 | }
42 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/reports/S_D_80075145_999998_20081223_20081229154951691.txt:
--------------------------------------------------------------------------------
1 | Provider Provider Country Vendor Identifier UPC ISRC Artist / Show Title / Episode / Season Label/Studio/Network Product Type Identifier Units Royalty Price Begin Date End Date Customer Currency Country Code Royalty Currency Preorder Season Pass ISAN Apple Identifier Customer Price CMA Asset/Content Flavor
2 | APPLE US 1001 Jason Rohrer Passage 1 1 .7 12/23/2008 12/23/2008 CAD CA CAD 300702040 .99
3 | APPLE US 1001 Jason Rohrer Passage 1 3 .7 12/23/2008 12/23/2008 USD US USD 300702040 .99
4 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/reports/S_D_80075145_999998_20081224_20081229155013664.txt:
--------------------------------------------------------------------------------
1 | Provider Provider Country Vendor Identifier UPC ISRC Artist / Show Title / Episode / Season Label/Studio/Network Product Type Identifier Units Royalty Price Begin Date End Date Customer Currency Country Code Royalty Currency Preorder Season Pass ISAN Apple Identifier Customer Price CMA Asset/Content Flavor
2 | APPLE US 1001 Jason Rohrer Passage 1 8 .36 12/24/2008 12/24/2008 GBP GB GBP 300702040 .59
3 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/24/2008 12/24/2008 EUR BE EUR 300702040 .79
4 | APPLE US 1001 Jason Rohrer Passage 1 1 81 12/24/2008 12/24/2008 JPY JP JPY 300702040 115
5 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/24/2008 12/24/2008 EUR DE EUR 300702040 .79
6 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/24/2008 12/24/2008 SEK SE EUR 300702040 7
7 | APPLE US 1001 Jason Rohrer Passage 1 162 .7 12/24/2008 12/24/2008 USD US USD 300702040 .99
8 | APPLE US 1001 Jason Rohrer Passage 1 2 .48 12/24/2008 12/24/2008 EUR FI EUR 300702040 .79
9 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/24/2008 12/24/2008 EUR ES EUR 300702040 .79
10 | APPLE US 1001 Jason Rohrer Passage 1 2 .48 12/24/2008 12/24/2008 EUR FR EUR 300702040 .79
11 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/24/2008 12/24/2008 EUR NL EUR 300702040 .79
12 | APPLE US 1001 Jason Rohrer Passage 1 1 0 12/24/2008 12/24/2008 USD US USD 300702040 .99
13 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/24/2008 12/24/2008 EUR IE EUR 300702040 .79
14 | APPLE US 1001 Jason Rohrer Passage 1 11 .7 12/24/2008 12/24/2008 CAD CA CAD 300702040 .99
15 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/reports/S_D_80075145_999998_20081225_20081229155019662.txt:
--------------------------------------------------------------------------------
1 | Provider Provider Country Vendor Identifier UPC ISRC Artist / Show Title / Episode / Season Label/Studio/Network Product Type Identifier Units Royalty Price Begin Date End Date Customer Currency Country Code Royalty Currency Preorder Season Pass ISAN Apple Identifier Customer Price CMA Asset/Content Flavor
2 | APPLE US 1001 Jason Rohrer Passage 1 99 .7 12/25/2008 12/25/2008 USD US USD 300702040 .99
3 | APPLE US 1001 Jason Rohrer Passage 1 3 .48 12/25/2008 12/25/2008 EUR FR EUR 300702040 .79
4 | APPLE US 1001 Jason Rohrer Passage 1 5 .48 12/25/2008 12/25/2008 EUR DE EUR 300702040 .79
5 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/25/2008 12/25/2008 EUR PT EUR 300702040 .79
6 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/25/2008 12/25/2008 EUR IE EUR 300702040 .79
7 | APPLE US 1001 Jason Rohrer Passage 1 4 .48 12/25/2008 12/25/2008 EUR NL EUR 300702040 .79
8 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/25/2008 12/25/2008 EUR ES EUR 300702040 .79
9 | APPLE US 1001 Jason Rohrer Passage 1 5 .48 12/25/2008 12/25/2008 SEK SE EUR 300702040 7
10 | APPLE US 1001 Jason Rohrer Passage 1 4 .48 12/25/2008 12/25/2008 DKK DK EUR 300702040 6
11 | APPLE US 1001 Jason Rohrer Passage 1 1 .76 12/25/2008 12/25/2008 NZD NZ AUD 300702040 1.29
12 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/25/2008 12/25/2008 EUR BE EUR 300702040 .79
13 | APPLE US 1001 Jason Rohrer Passage 1 6 .7 12/25/2008 12/25/2008 CAD CA CAD 300702040 .99
14 | APPLE US 1001 Jason Rohrer Passage 1 8 .76 12/25/2008 12/25/2008 AUD AU AUD 300702040 1.19
15 | APPLE US 1001 Jason Rohrer Passage 1 32 .36 12/25/2008 12/25/2008 GBP GB GBP 300702040 .59
16 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/25/2008 12/25/2008 EUR IT EUR 300702040 .79
17 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/reports/S_D_80075145_999998_20081226_2008122915502587.txt:
--------------------------------------------------------------------------------
1 | Provider Provider Country Vendor Identifier UPC ISRC Artist / Show Title / Episode / Season Label/Studio/Network Product Type Identifier Units Royalty Price Begin Date End Date Customer Currency Country Code Royalty Currency Preorder Season Pass ISAN Apple Identifier Customer Price CMA Asset/Content Flavor
2 | APPLE US 1001 Jason Rohrer Passage 1 -1 .7 12/26/2008 12/26/2008 USD US USD 300702040 -.99
3 | APPLE US 1001 Jason Rohrer Passage 1 2 .7 12/26/2008 12/26/2008 USD SG USD 300702040 .99
4 | APPLE US 1001 Jason Rohrer Passage 1 1 .7 12/26/2008 12/26/2008 USD AR USD 300702040 .99
5 | APPLE US 1001 Jason Rohrer Passage 1 2 .48 12/26/2008 12/26/2008 EUR FR EUR 300702040 .79
6 | APPLE US 1001 Jason Rohrer Passage 1 2 .48 12/26/2008 12/26/2008 EUR AT EUR 300702040 .79
7 | APPLE US 1001 Jason Rohrer Passage 1 3 .48 12/26/2008 12/26/2008 DKK DK EUR 300702040 6
8 | APPLE US 1001 Jason Rohrer Passage 1 31 .36 12/26/2008 12/26/2008 GBP GB GBP 300702040 .59
9 | APPLE US 1001 Jason Rohrer Passage 1 25 .7 12/26/2008 12/26/2008 CAD CA CAD 300702040 .99
10 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/26/2008 12/26/2008 NOK NO EUR 300702040 6
11 | APPLE US 1001 Jason Rohrer Passage 1 2 .48 12/26/2008 12/26/2008 EUR NL EUR 300702040 .79
12 | APPLE US 1001 Jason Rohrer Passage 1 254 .7 12/26/2008 12/26/2008 USD US USD 300702040 .99
13 | APPLE US 1001 Jason Rohrer Passage 1 9 .48 12/26/2008 12/26/2008 EUR DE EUR 300702040 .79
14 | APPLE US 1001 Jason Rohrer Passage 1 6 .76 12/26/2008 12/26/2008 AUD AU AUD 300702040 1.19
15 | APPLE US 1001 Jason Rohrer Passage 1 1 81 12/26/2008 12/26/2008 JPY JP JPY 300702040 115
16 | APPLE US 1001 Jason Rohrer Passage 1 2 .48 12/26/2008 12/26/2008 EUR PL EUR 300702040 .79
17 | APPLE US 1001 Jason Rohrer Passage 1 2 .48 12/26/2008 12/26/2008 EUR BE EUR 300702040 .79
18 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/26/2008 12/26/2008 EUR IT EUR 300702040 .79
19 | APPLE US 1001 Jason Rohrer Passage 1 5 .48 12/26/2008 12/26/2008 SEK SE EUR 300702040 7
20 | APPLE US 1001 Jason Rohrer Passage 1 2 .48 12/26/2008 12/26/2008 CHF CH EUR 300702040 1.1
21 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/reports/S_D_80075145_999998_20081228_20081229155036881.txt:
--------------------------------------------------------------------------------
1 | Provider Provider Country Vendor Identifier UPC ISRC Artist / Show Title / Episode / Season Label/Studio/Network Product Type Identifier Units Royalty Price Begin Date End Date Customer Currency Country Code Royalty Currency Preorder Season Pass ISAN Apple Identifier Customer Price CMA Asset/Content Flavor
2 | APPLE US 1001 Jason Rohrer Passage 1 14 .36 12/28/2008 12/28/2008 GBP GB GBP 300702040 .59
3 | APPLE US 1001 Jason Rohrer Passage 1 7 .7 12/28/2008 12/28/2008 CAD CA CAD 300702040 .99
4 | APPLE US 1001 Jason Rohrer Passage 1 79 .7 12/28/2008 12/28/2008 USD US USD 300702040 .99
5 | APPLE US 1001 Jason Rohrer Passage 1 2 .48 12/28/2008 12/28/2008 EUR FI EUR 300702040 .79
6 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/28/2008 12/28/2008 EUR ES EUR 300702040 .79
7 | APPLE US 1001 Jason Rohrer Passage 1 2 .48 12/28/2008 12/28/2008 CHF CH EUR 300702040 1.1
8 | APPLE US 1001 Jason Rohrer Passage 1 5 .76 12/28/2008 12/28/2008 AUD AU AUD 300702040 1.19
9 | APPLE US 1001 Jason Rohrer Passage 1 1 .76 12/28/2008 12/28/2008 NZD NZ AUD 300702040 1.29
10 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/28/2008 12/28/2008 EUR IE EUR 300702040 .79
11 | APPLE US 1001 Jason Rohrer Passage 1 1 81 12/28/2008 12/28/2008 JPY JP JPY 300702040 115
12 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/28/2008 12/28/2008 EUR PL EUR 300702040 .79
13 | APPLE US 1001 Jason Rohrer Passage 1 2 .48 12/28/2008 12/28/2008 EUR FR EUR 300702040 .79
14 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/28/2008 12/28/2008 EUR IT EUR 300702040 .79
15 | APPLE US 1001 Jason Rohrer Passage 1 3 .48 12/28/2008 12/28/2008 SEK SE EUR 300702040 7
16 | APPLE US 1001 Jason Rohrer Passage 1 8 .48 12/28/2008 12/28/2008 EUR DE EUR 300702040 .79
17 | APPLE US 1001 Jason Rohrer Passage 1 1 .7 12/28/2008 12/28/2008 USD SG USD 300702040 .99
18 | APPLE US 1001 Jason Rohrer Passage 1 3 .48 12/28/2008 12/28/2008 EUR NL EUR 300702040 .79
19 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/reports/S_D_80075145_999998_20081229_20090102170456173.txt:
--------------------------------------------------------------------------------
1 | Provider Provider Country Vendor Identifier UPC ISRC Artist / Show Title / Episode / Season Label/Studio/Network Product Type Identifier Units Royalty Price Begin Date End Date Customer Currency Country Code Royalty Currency Preorder Season Pass ISAN Apple Identifier Customer Price CMA Asset/Content Flavor
2 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/29/2008 12/29/2008 EUR AT EUR 300702040 .79
3 | APPLE US 1001 Jason Rohrer Passage 1 6 .48 12/29/2008 12/29/2008 EUR DE EUR 300702040 .79
4 | APPLE US 1001 Jason Rohrer Passage 1 3 .48 12/29/2008 12/29/2008 EUR FR EUR 300702040 .79
5 | APPLE US 1001 Jason Rohrer Passage 1 5 .7 12/29/2008 12/29/2008 CAD CA CAD 300702040 .99
6 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/29/2008 12/29/2008 CHF CH EUR 300702040 1.1
7 | APPLE US 1001 Jason Rohrer Passage 1 90 .7 12/29/2008 12/29/2008 USD US USD 300702040 .99
8 | APPLE US 1001 Jason Rohrer Passage 1 13 .36 12/29/2008 12/29/2008 GBP GB GBP 300702040 .59
9 | APPLE US 1001 Jason Rohrer Passage 1 1 .7 12/29/2008 12/29/2008 USD SG USD 300702040 .99
10 | APPLE US 1001 Jason Rohrer Passage 1 7 .48 12/29/2008 12/29/2008 EUR NL EUR 300702040 .79
11 | APPLE US 1001 Jason Rohrer Passage 1 7 .76 12/29/2008 12/29/2008 AUD AU AUD 300702040 1.19
12 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/29/2008 12/29/2008 EUR HU EUR 300702040 .79
13 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/29/2008 12/29/2008 EUR FI EUR 300702040 .79
14 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/29/2008 12/29/2008 SEK SE EUR 300702040 7
15 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/reports/S_D_80075145_999998_20081230_2009010217055919.txt:
--------------------------------------------------------------------------------
1 | Provider Provider Country Vendor Identifier UPC ISRC Artist / Show Title / Episode / Season Label/Studio/Network Product Type Identifier Units Royalty Price Begin Date End Date Customer Currency Country Code Royalty Currency Preorder Season Pass ISAN Apple Identifier Customer Price CMA Asset/Content Flavor
2 | APPLE US 1001 Jason Rohrer Passage 1 2 .48 12/30/2008 12/30/2008 NOK NO EUR 300702040 6
3 | APPLE US 1001 Jason Rohrer Passage 1 3 .76 12/30/2008 12/30/2008 NZD NZ AUD 300702040 1.29
4 | APPLE US 1001 Jason Rohrer Passage 1 2 .48 12/30/2008 12/30/2008 EUR FI EUR 300702040 .79
5 | APPLE US 1001 Jason Rohrer Passage 1 1 .7 12/30/2008 12/30/2008 USD IN USD 300702040 .99
6 | APPLE US 1001 Jason Rohrer Passage 1 2 .48 12/30/2008 12/30/2008 EUR FR EUR 300702040 .79
7 | APPLE US 1001 Jason Rohrer Passage 1 3 .48 12/30/2008 12/30/2008 EUR NL EUR 300702040 .79
8 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/30/2008 12/30/2008 EUR IT EUR 300702040 .79
9 | APPLE US 1001 Jason Rohrer Passage 1 2 .48 12/30/2008 12/30/2008 EUR DE EUR 300702040 .79
10 | APPLE US 1001 Jason Rohrer Passage 1 54 .7 12/30/2008 12/30/2008 USD US USD 300702040 .99
11 | APPLE US 1001 Jason Rohrer Passage 1 12 .36 12/30/2008 12/30/2008 GBP GB GBP 300702040 .59
12 | APPLE US 1001 Jason Rohrer Passage 1 3 .48 12/30/2008 12/30/2008 SEK SE EUR 300702040 7
13 | APPLE US 1001 Jason Rohrer Passage 1 4 .76 12/30/2008 12/30/2008 AUD AU AUD 300702040 1.19
14 | APPLE US 1001 Jason Rohrer Passage 1 6 .7 12/30/2008 12/30/2008 CAD CA CAD 300702040 .99
15 | APPLE US 1001 Jason Rohrer Passage 1 2 .7 12/30/2008 12/30/2008 USD SG USD 300702040 .99
16 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/reports/S_D_80075145_999998_20081231_2009010217062259.txt:
--------------------------------------------------------------------------------
1 | Provider Provider Country Vendor Identifier UPC ISRC Artist / Show Title / Episode / Season Label/Studio/Network Product Type Identifier Units Royalty Price Begin Date End Date Customer Currency Country Code Royalty Currency Preorder Season Pass ISAN Apple Identifier Customer Price CMA Asset/Content Flavor
2 | APPLE US 1001 Jason Rohrer Passage 1 4 .7 12/31/2008 12/31/2008 CAD CA CAD 300702040 .99
3 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/31/2008 12/31/2008 EUR DE EUR 300702040 .79
4 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/31/2008 12/31/2008 EUR FI EUR 300702040 .79
5 | APPLE US 1001 Jason Rohrer Passage 1 1 81 12/31/2008 12/31/2008 JPY JP JPY 300702040 115
6 | APPLE US 1001 Jason Rohrer Passage 1 32 .7 12/31/2008 12/31/2008 USD US USD 300702040 .99
7 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/31/2008 12/31/2008 EUR IE EUR 300702040 .79
8 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 12/31/2008 12/31/2008 SEK SE EUR 300702040 7
9 | APPLE US 1001 Jason Rohrer Passage 1 10 .36 12/31/2008 12/31/2008 GBP GB GBP 300702040 .59
10 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/reports/S_D_80075145_999998_20090101_20090102170648169.txt:
--------------------------------------------------------------------------------
1 | Provider Provider Country Vendor Identifier UPC ISRC Artist / Show Title / Episode / Season Label/Studio/Network Product Type Identifier Units Royalty Price Begin Date End Date Customer Currency Country Code Royalty Currency Preorder Season Pass ISAN Apple Identifier Customer Price CMA Asset/Content Flavor
2 | APPLE US 1001 Jason Rohrer Passage 1 3 .76 01/01/2009 01/01/2009 AUD AU AUD 300702040 1.19
3 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 01/01/2009 01/01/2009 EUR LU EUR 300702040 .79
4 | APPLE US 1001 Jason Rohrer Passage 1 1 81 01/01/2009 01/01/2009 JPY JP JPY 300702040 115
5 | APPLE US 1001 Jason Rohrer Passage 1 1 .7 01/01/2009 01/01/2009 CAD CA CAD 300702040 .99
6 | APPLE US 1001 Jason Rohrer Passage 1 1 .76 01/01/2009 01/01/2009 NZD NZ AUD 300702040 1.29
7 | APPLE US 1001 Jason Rohrer Passage 1 33 .7 01/01/2009 01/01/2009 USD US USD 300702040 .99
8 | APPLE US 1001 Jason Rohrer Passage 1 6 .36 01/01/2009 01/01/2009 GBP GB GBP 300702040 .59
9 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 01/01/2009 01/01/2009 EUR FR EUR 300702040 .79
10 | APPLE US 1001 Jason Rohrer Passage 1 4 .48 01/01/2009 01/01/2009 SEK SE EUR 300702040 7
11 | APPLE US 1001 Jason Rohrer Passage 1 2 .48 01/01/2009 01/01/2009 EUR DE EUR 300702040 .79
12 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/reports/S_D_80075145_999998_20090102_2009010615085482.txt:
--------------------------------------------------------------------------------
1 | Provider Provider Country Vendor Identifier UPC ISRC Artist / Show Title / Episode / Season Label/Studio/Network Product Type Identifier Units Royalty Price Begin Date End Date Customer Currency Country Code Royalty Currency Preorder Season Pass ISAN Apple Identifier Customer Price CMA Asset/Content Flavor
2 | APPLE US 1001 Jason Rohrer Passage 1 26 .7 01/02/2009 01/02/2009 USD US USD 300702040 .99
3 | APPLE US 1001 Jason Rohrer Passage 1 2 .48 01/02/2009 01/02/2009 EUR DE EUR 300702040 .79
4 | APPLE US 1001 Jason Rohrer Passage 1 1 81 01/02/2009 01/02/2009 JPY JP JPY 300702040 115
5 | APPLE US 1001 Jason Rohrer Passage 1 8 .36 01/02/2009 01/02/2009 GBP GB GBP 300702040 .59
6 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 01/02/2009 01/02/2009 EUR NL EUR 300702040 .79
7 | APPLE US 1001 Jason Rohrer Passage 1 5 .7 01/02/2009 01/02/2009 CAD CA CAD 300702040 .99
8 | APPLE US 1001 Jason Rohrer Passage 1 3 .48 01/02/2009 01/02/2009 EUR FR EUR 300702040 .79
9 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 01/02/2009 01/02/2009 SEK SE EUR 300702040 7
10 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/reports/S_D_80075145_999998_20090103_20090106150905023.txt:
--------------------------------------------------------------------------------
1 | Provider Provider Country Vendor Identifier UPC ISRC Artist / Show Title / Episode / Season Label/Studio/Network Product Type Identifier Units Royalty Price Begin Date End Date Customer Currency Country Code Royalty Currency Preorder Season Pass ISAN Apple Identifier Customer Price CMA Asset/Content Flavor
2 | APPLE US 1001 Jason Rohrer Passage 1 29 .7 01/03/2009 01/03/2009 USD US USD 300702040 .99
3 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 01/03/2009 01/03/2009 EUR IE EUR 300702040 .79
4 | APPLE US 1001 Jason Rohrer Passage 7 15 0 01/03/2009 01/03/2009 CAD CA CAD 300702040 0
5 | APPLE US 1001 Jason Rohrer Passage 1 2 81 01/03/2009 01/03/2009 JPY JP JPY 300702040 115
6 | APPLE US 1001 Jason Rohrer Passage 7 183 0 01/03/2009 01/03/2009 USD US USD 300702040 0
7 | APPLE US 1001 Jason Rohrer Passage 1 1 .76 01/03/2009 01/03/2009 AUD AU AUD 300702040 1.19
8 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 01/03/2009 01/03/2009 EUR ES EUR 300702040 .79
9 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 01/03/2009 01/03/2009 EUR FR EUR 300702040 .79
10 | APPLE US 1001 Jason Rohrer Passage 1 2 .7 01/03/2009 01/03/2009 CAD CA CAD 300702040 .99
11 | APPLE US 1001 Jason Rohrer Passage 1 6 .36 01/03/2009 01/03/2009 GBP GB GBP 300702040 .59
12 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/reports/S_D_80075145_999998_20090107_20090114175227209.txt:
--------------------------------------------------------------------------------
1 | Provider Provider Country Vendor Identifier UPC ISRC Artist / Show Title / Episode / Season Label/Studio/Network Product Type Identifier Units Royalty Price Begin Date End Date Customer Currency Country Code Royalty Currency Preorder Season Pass ISAN Apple Identifier Customer Price CMA Asset/Content Flavor
2 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 01/07/2009 01/07/2009 SEK SE EUR 300702040 7
3 | APPLE US 1001 Jason Rohrer Passage 7 2 0 01/07/2009 01/07/2009 AUD AU AUD 300702040 0
4 | APPLE US 1001 Jason Rohrer Passage 7 42 0 01/07/2009 01/07/2009 USD US USD 300702040 0
5 | APPLE US 1001 Jason Rohrer Passage 7 4 0 01/07/2009 01/07/2009 EUR DE EUR 300702040 0
6 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 01/07/2009 01/07/2009 EUR ES EUR 300702040 .79
7 | APPLE US 1001 Jason Rohrer Passage 1 3 .48 01/07/2009 01/07/2009 EUR DE EUR 300702040 .79
8 | APPLE US 1001 Jason Rohrer Passage 1 1 .7 01/07/2009 01/07/2009 CAD CA CAD 300702040 .99
9 | APPLE US 1001 Jason Rohrer Passage 1 2 .76 01/07/2009 01/07/2009 AUD AU AUD 300702040 1.19
10 | APPLE US 1001 Jason Rohrer Passage 1 3 .48 01/07/2009 01/07/2009 EUR FR EUR 300702040 .79
11 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/07/2009 01/07/2009 EUR IT EUR 300702040 0
12 | APPLE US 1001 Jason Rohrer Passage 7 3 0 01/07/2009 01/07/2009 CAD CA CAD 300702040 0
13 | APPLE US 1001 Jason Rohrer Passage 7 3 0 01/07/2009 01/07/2009 SEK SE EUR 300702040 0
14 | APPLE US 1001 Jason Rohrer Passage 7 2 0 01/07/2009 01/07/2009 DKK DK EUR 300702040 0
15 | APPLE US 1001 Jason Rohrer Passage 1 25 .7 01/07/2009 01/07/2009 USD US USD 300702040 .99
16 | APPLE US 1001 Jason Rohrer Passage 7 2 0 01/07/2009 01/07/2009 EUR FR EUR 300702040 0
17 | APPLE US 1001 Jason Rohrer Passage 7 10 0 01/07/2009 01/07/2009 GBP GB GBP 300702040 0
18 | APPLE US 1001 Jason Rohrer Passage 1 2 .36 01/07/2009 01/07/2009 GBP GB GBP 300702040 .59
19 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 01/07/2009 01/07/2009 EUR NL EUR 300702040 .79
20 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/reports/S_D_80075145_999998_20090108_20090114175235627.txt:
--------------------------------------------------------------------------------
1 | Provider Provider Country Vendor Identifier UPC ISRC Artist / Show Title / Episode / Season Label/Studio/Network Product Type Identifier Units Royalty Price Begin Date End Date Customer Currency Country Code Royalty Currency Preorder Season Pass ISAN Apple Identifier Customer Price CMA Asset/Content Flavor
2 | APPLE US 1001 Jason Rohrer Passage 7 32 0 01/08/2009 01/08/2009 USD US USD 300702040 0
3 | APPLE US 1001 Jason Rohrer Passage 7 3 0 01/08/2009 01/08/2009 CAD CA CAD 300702040 0
4 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/08/2009 01/08/2009 NZD NZ AUD 300702040 0
5 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/08/2009 01/08/2009 JPY JP JPY 300702040 0
6 | APPLE US 1001 Jason Rohrer Passage 1 1 .36 01/08/2009 01/08/2009 GBP GB GBP 300702040 .59
7 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/08/2009 01/08/2009 EUR AT EUR 300702040 0
8 | APPLE US 1001 Jason Rohrer Passage 1 1 .7 01/08/2009 01/08/2009 USD HK USD 300702040 .99
9 | APPLE US 1001 Jason Rohrer Passage 7 4 0 01/08/2009 01/08/2009 GBP GB GBP 300702040 0
10 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/08/2009 01/08/2009 EUR ES EUR 300702040 0
11 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/08/2009 01/08/2009 EUR BE EUR 300702040 0
12 | APPLE US 1001 Jason Rohrer Passage 1 2 81 01/08/2009 01/08/2009 JPY JP JPY 300702040 115
13 | APPLE US 1001 Jason Rohrer Passage 1 26 .7 01/08/2009 01/08/2009 USD US USD 300702040 .99
14 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 01/08/2009 01/08/2009 EUR FR EUR 300702040 .79
15 | APPLE US 1001 Jason Rohrer Passage 7 2 0 01/08/2009 01/08/2009 EUR FI EUR 300702040 0
16 | APPLE US 1001 Jason Rohrer Passage 7 3 0 01/08/2009 01/08/2009 EUR DE EUR 300702040 0
17 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/08/2009 01/08/2009 CHF CH EUR 300702040 0
18 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/reports/S_D_80075145_999998_20090109_20090114175240828.txt:
--------------------------------------------------------------------------------
1 | Provider Provider Country Vendor Identifier UPC ISRC Artist / Show Title / Episode / Season Label/Studio/Network Product Type Identifier Units Royalty Price Begin Date End Date Customer Currency Country Code Royalty Currency Preorder Season Pass ISAN Apple Identifier Customer Price CMA Asset/Content Flavor
2 | APPLE US 1001 Jason Rohrer Passage 1 16 .7 01/09/2009 01/09/2009 USD US USD 300702040 .99
3 | APPLE US 1001 Jason Rohrer Passage 7 23 0 01/09/2009 01/09/2009 USD US USD 300702040 0
4 | APPLE US 1001 Jason Rohrer Passage 1 2 .48 01/09/2009 01/09/2009 EUR FR EUR 300702040 .79
5 | APPLE US 1001 Jason Rohrer Passage 7 3 0 01/09/2009 01/09/2009 CAD CA CAD 300702040 0
6 | APPLE US 1001 Jason Rohrer Passage 1 1 81 01/09/2009 01/09/2009 JPY JP JPY 300702040 115
7 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/09/2009 01/09/2009 EUR HU EUR 300702040 0
8 | APPLE US 1001 Jason Rohrer Passage 7 2 0 01/09/2009 01/09/2009 GBP GB GBP 300702040 0
9 | APPLE US 1001 Jason Rohrer Passage 1 2 .36 01/09/2009 01/09/2009 GBP GB GBP 300702040 .59
10 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 01/09/2009 01/09/2009 SEK SE EUR 300702040 7
11 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/09/2009 01/09/2009 JPY JP JPY 300702040 0
12 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 01/09/2009 01/09/2009 EUR IE EUR 300702040 .79
13 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/09/2009 01/09/2009 EUR IT EUR 300702040 0
14 | APPLE US 1001 Jason Rohrer Passage 1 2 .7 01/09/2009 01/09/2009 CAD CA CAD 300702040 .99
15 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/09/2009 01/09/2009 EUR CZ EUR 300702040 0
16 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/09/2009 01/09/2009 EUR FR EUR 300702040 0
17 | APPLE US 1001 Jason Rohrer Passage 7 2 0 01/09/2009 01/09/2009 DKK DK EUR 300702040 0
18 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/reports/S_D_80075145_999998_20090110_20090114175246221.txt:
--------------------------------------------------------------------------------
1 | Provider Provider Country Vendor Identifier UPC ISRC Artist / Show Title / Episode / Season Label/Studio/Network Product Type Identifier Units Royalty Price Begin Date End Date Customer Currency Country Code Royalty Currency Preorder Season Pass ISAN Apple Identifier Customer Price CMA Asset/Content Flavor
2 | APPLE US 1001 Jason Rohrer Passage 7 17 0 01/10/2009 01/10/2009 USD US USD 300702040 0
3 | APPLE US 1001 Jason Rohrer Passage 1 1 .7 01/10/2009 01/10/2009 USD SG USD 300702040 .99
4 | APPLE US 1001 Jason Rohrer Passage 1 1 .36 01/10/2009 01/10/2009 GBP GB GBP 300702040 .59
5 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/10/2009 01/10/2009 CHF CH EUR 300702040 0
6 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/10/2009 01/10/2009 EUR DE EUR 300702040 0
7 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/10/2009 01/10/2009 EUR NL EUR 300702040 0
8 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/10/2009 01/10/2009 EUR FI EUR 300702040 0
9 | APPLE US 1001 Jason Rohrer Passage 1 1 .7 01/10/2009 01/10/2009 CAD CA CAD 300702040 .99
10 | APPLE US 1001 Jason Rohrer Passage 1 1 81 01/10/2009 01/10/2009 JPY JP JPY 300702040 115
11 | APPLE US 1001 Jason Rohrer Passage 1 16 .7 01/10/2009 01/10/2009 USD US USD 300702040 .99
12 | APPLE US 1001 Jason Rohrer Passage 7 2 0 01/10/2009 01/10/2009 AUD AU AUD 300702040 0
13 | APPLE US 1001 Jason Rohrer Passage 1 2 .76 01/10/2009 01/10/2009 AUD AU AUD 300702040 1.19
14 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/10/2009 01/10/2009 GBP GB GBP 300702040 0
15 | APPLE US 1001 Jason Rohrer Passage 7 2 0 01/10/2009 01/10/2009 CAD CA CAD 300702040 0
16 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/reports/S_D_80075145_999998_20090111_20090114175250853.txt:
--------------------------------------------------------------------------------
1 | Provider Provider Country Vendor Identifier UPC ISRC Artist / Show Title / Episode / Season Label/Studio/Network Product Type Identifier Units Royalty Price Begin Date End Date Customer Currency Country Code Royalty Currency Preorder Season Pass ISAN Apple Identifier Customer Price CMA Asset/Content Flavor
2 | APPLE US 1001 Jason Rohrer Passage 7 2 0 01/11/2009 01/11/2009 GBP GB GBP 300702040 0
3 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/11/2009 01/11/2009 EUR FR EUR 300702040 0
4 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/11/2009 01/11/2009 CAD CA CAD 300702040 0
5 | APPLE US 1001 Jason Rohrer Passage 1 1 .7 01/11/2009 01/11/2009 USD AR USD 300702040 .99
6 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 01/11/2009 01/11/2009 EUR FI EUR 300702040 .79
7 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/11/2009 01/11/2009 AUD AU AUD 300702040 0
8 | APPLE US 1001 Jason Rohrer Passage 1 1 .76 01/11/2009 01/11/2009 AUD AU AUD 300702040 1.19
9 | APPLE US 1001 Jason Rohrer Passage 7 24 0 01/11/2009 01/11/2009 USD US USD 300702040 0
10 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 01/11/2009 01/11/2009 SEK SE EUR 300702040 7
11 | APPLE US 1001 Jason Rohrer Passage 1 29 .7 01/11/2009 01/11/2009 USD US USD 300702040 .99
12 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 01/11/2009 01/11/2009 EUR DE EUR 300702040 .79
13 | APPLE US 1001 Jason Rohrer Passage 1 2 81 01/11/2009 01/11/2009 JPY JP JPY 300702040 115
14 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 01/11/2009 01/11/2009 EUR FR EUR 300702040 .79
15 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/reports/S_D_80075145_999998_20090112_200901141752552.txt:
--------------------------------------------------------------------------------
1 | Provider Provider Country Vendor Identifier UPC ISRC Artist / Show Title / Episode / Season Label/Studio/Network Product Type Identifier Units Royalty Price Begin Date End Date Customer Currency Country Code Royalty Currency Preorder Season Pass ISAN Apple Identifier Customer Price CMA Asset/Content Flavor
2 | APPLE US 1001 Jason Rohrer Passage 1 3 .36 01/12/2009 01/12/2009 GBP GB GBP 300702040 .59
3 | APPLE US 1001 Jason Rohrer Passage 7 2 0 01/12/2009 01/12/2009 AUD AU AUD 300702040 0
4 | APPLE US 1001 Jason Rohrer Passage 1 1 .7 01/12/2009 01/12/2009 USD SG USD 300702040 .99
5 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 01/12/2009 01/12/2009 EUR SK EUR 300702040 .79
6 | APPLE US 1001 Jason Rohrer Passage 7 10 0 01/12/2009 01/12/2009 USD US USD 300702040 0
7 | APPLE US 1001 Jason Rohrer Passage 1 20 .7 01/12/2009 01/12/2009 USD US USD 300702040 .99
8 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 01/12/2009 01/12/2009 EUR PT EUR 300702040 .79
9 | APPLE US 1001 Jason Rohrer Passage 1 2 .7 01/12/2009 01/12/2009 CAD CA CAD 300702040 .99
10 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/12/2009 01/12/2009 EUR AT EUR 300702040 0
11 | APPLE US 1001 Jason Rohrer Passage 7 3 0 01/12/2009 01/12/2009 GBP GB GBP 300702040 0
12 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/12/2009 01/12/2009 SEK SE EUR 300702040 0
13 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/reports/S_D_80075145_999998_20090113_20090114175300581.txt:
--------------------------------------------------------------------------------
1 | Provider Provider Country Vendor Identifier UPC ISRC Artist / Show Title / Episode / Season Label/Studio/Network Product Type Identifier Units Royalty Price Begin Date End Date Customer Currency Country Code Royalty Currency Preorder Season Pass ISAN Apple Identifier Customer Price CMA Asset/Content Flavor
2 | APPLE US 1001 Jason Rohrer Passage 1 7 .7 01/13/2009 01/13/2009 USD US USD 300702040 .99
3 | APPLE US 1001 Jason Rohrer Passage 1 2 .36 01/13/2009 01/13/2009 GBP GB GBP 300702040 .59
4 | APPLE US 1001 Jason Rohrer Passage 1 2 .76 01/13/2009 01/13/2009 AUD AU AUD 300702040 1.19
5 | APPLE US 1001 Jason Rohrer Passage 7 12 0 01/13/2009 01/13/2009 USD US USD 300702040 0
6 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/13/2009 01/13/2009 EUR FR EUR 300702040 0
7 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/13/2009 01/13/2009 EUR IE EUR 300702040 0
8 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/13/2009 01/13/2009 AUD AU AUD 300702040 0
9 | APPLE US 1001 Jason Rohrer Passage 1 1 .7 01/13/2009 01/13/2009 USD SG USD 300702040 .99
10 | APPLE US 1001 Jason Rohrer Passage 1 3 .48 01/13/2009 01/13/2009 EUR DE EUR 300702040 .79
11 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 01/13/2009 01/13/2009 SEK SE EUR 300702040 7
12 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 01/13/2009 01/13/2009 NOK NO EUR 300702040 6
13 | APPLE US 1001 Jason Rohrer Passage 7 1 0 01/13/2009 01/13/2009 SEK SE EUR 300702040 0
14 | APPLE US 1001 Jason Rohrer Passage 1 2 81 01/13/2009 01/13/2009 JPY JP JPY 300702040 115
15 | APPLE US 1001 Jason Rohrer Passage 1 1 .48 01/13/2009 01/13/2009 EUR ES EUR 300702040 .79
16 | APPLE US 1001 Jason Rohrer Passage 7 2 0 01/13/2009 01/13/2009 GBP GB GBP 300702040 0
17 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/screenShot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/iPhone/screenShot.png
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/storeDescription.txt:
--------------------------------------------------------------------------------
1 | The critically-acclaimed breakout-hit from art game designer Jason Rohrer. Passage is a tiny, touching, five-minute game about life.
2 |
3 | "More than any game I've ever played, it illustrates how a game can be a fantastically expressive, artistic vehicle for exploring the human condition." -- Clive Thompson, Wired
4 |
5 | "Passage may look primitive but it's an absolute pinnacle of videogame development." --Andy Chalk, The Escapist
6 |
7 | "Portal is a fine game---nothing less than excellent... Passage is even better." --Nick Montfort, MIT
8 |
9 | You can read an in-depth profile of Jason Rohrer, along with an extensive discussion of Passage, in Esquire Magazine's December 2008 "Genius" issue.
10 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/iPhone/testScreenDrawer.cpp:
--------------------------------------------------------------------------------
1 |
2 |
3 | #include "drawIntoScreen.h"
4 |
5 | #include
6 |
7 | void drawIntoScreen( Uint32 *inScreenBuffer, int inWidth, int inHeight ) {
8 | // add dot at random spot
9 | int x = rand() % inWidth;
10 | int y = rand() % inHeight;
11 |
12 | int i = y * inWidth + x;
13 |
14 | inScreenBuffer[ i ] = 0xFFFFFFFF;
15 | }
16 |
17 | void initScreenDrawer( Uint32 *inScreenBuffer, int inWidth, int inHeight ) {
18 | }
19 |
20 | void freeScreenDrawer() {
21 | }
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/mac/SDLMain.h:
--------------------------------------------------------------------------------
1 | /* SDLMain.m - main entry point for our Cocoa-ized SDL app
2 | Initial Version: Darrell Walisser
3 | Non-NIB-Code & other changes: Max Horn
4 |
5 | Feel free to customize this file to suit your needs
6 | */
7 |
8 | #import
9 |
10 | @interface SDLMain : NSObject
11 | @end
12 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/map.h:
--------------------------------------------------------------------------------
1 | // checks if position is blocked by wall
2 | char isBlocked( int inX, int inY );
3 |
4 |
5 | // checks if chest is present
6 | // assumes position is not blocked
7 | #define CHEST_NONE 0
8 | #define CHEST_CLOSED 1
9 | #define CHEST_OPEN 2
10 | char isChest( int inX, int inY );
11 |
12 |
13 | // 8-bit binary indicating which of six external chest gems are present
14 | #define CHEST_RED_GEM 0x01
15 | #define CHEST_GREEN_GEM 0x02
16 | #define CHEST_ORANGE_GEM 0x04
17 | #define CHEST_BLUE_GEM 0x08
18 | #define CHEST_YELLOW_GEM 0x10
19 | #define CHEST_MAGENTA_GEM 0x20
20 |
21 | // assumes a chest is present
22 | unsigned char getChestCode( int inX, int inY );
23 |
24 | void getChestCenter( int inX, int inY, int *outCenterX, int *outCenterY );
25 |
26 | void openChest( int inX, int inY );
27 |
28 |
29 | // resets map to a fresh state
30 | void resetMap();
31 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/music.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/music.png
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/music/music.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/music/music.tga
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/musicPlayer.h:
--------------------------------------------------------------------------------
1 |
2 |
3 | // starts playing music, reading notes from a TGA graphics file
4 | // the file must be in the "music" directory
5 | void startMusic( const char *inTGAFileName );
6 |
7 |
8 |
9 | // set loudness in range [0.0,1.0]
10 | void setMusicLoudness( double inLoudness );
11 |
12 |
13 |
14 | // causes music to jump back to beginning
15 | void restartMusic();
16 |
17 |
18 |
19 | void stopMusic();
20 |
21 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/numerals.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/numerals.png
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/numerals3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/numerals3.png
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/score.h:
--------------------------------------------------------------------------------
1 | #include
2 | typedef uint32_t Uint32;
3 |
4 |
5 |
6 | void initScore();
7 |
8 |
9 |
10 | int getScoreHeight();
11 |
12 |
13 |
14 | // draws score in upper-right corner of image
15 | void drawScore( Uint32 *inImage, int inWidth, int inHeight, int inScore );
16 |
17 |
18 |
19 | void destroyScore();
20 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/settings/fullscreen.ini:
--------------------------------------------------------------------------------
1 | 1
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/settings/screenHeight.ini:
--------------------------------------------------------------------------------
1 | 480
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/settings/screenWidth.ini:
--------------------------------------------------------------------------------
1 | 640
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/spouseSprite.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/spouseSprite.png
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/testMusicPlayer.cpp:
--------------------------------------------------------------------------------
1 | #include "musicPlayer.h"
2 |
3 | #include "minorGems/system/Thread.h"
4 |
5 | #include
6 |
7 |
8 | extern void loadMusicImage( char *inTGAFileName );
9 |
10 | extern void audioCallback( void *inUserData, Uint8 *inStream,
11 | int inLengthToFill );
12 |
13 |
14 | int main() {
15 | // don't actually start SDL loop, because profiler can't pick
16 | // up callbacks (why not?)
17 |
18 | loadMusicImage( "music.tga" );
19 |
20 | int length = 512;
21 |
22 | Uint8 *fakeStream = new Uint8[ length ];
23 |
24 |
25 | for( int i=0; i<20000; i++ ) {
26 |
27 | int x = 5 + 1;
28 | x ++;
29 |
30 | audioCallback( NULL, fakeStream, length );
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/testNoise.cpp:
--------------------------------------------------------------------------------
1 | #include "landscape.h"
2 |
3 | #include
4 |
5 | void printBinary( unsigned char inVal ) {
6 | for( int b=7; b>=0; b-- ) {
7 | if( ( inVal >> b ) & 0x01 == 1 ) {
8 | printf( "1" );
9 | }
10 | else {
11 | printf( "0" );
12 | }
13 | }
14 | }
15 |
16 | int main() {
17 |
18 | int numAllZeroOrig = 0;
19 | int numAllZeroNew = 0;
20 |
21 | for( int i=0; i<20; i++ ) {
22 | double value = noise3d( 37462 * i, 1747 * i, i * 3748147 );
23 |
24 |
25 |
26 | printf( "%d ... %f .... ", i, value );
27 |
28 |
29 |
30 | unsigned char castedChar = (unsigned char)( value * 15 );
31 |
32 | unsigned char chestVal = (unsigned char)( value * 15 ) & 0x3F;
33 |
34 | // show in binary
35 | printf( "casted char = %d ... original val = ", castedChar );
36 | printBinary( chestVal );
37 |
38 | printf( "\n" );
39 |
40 | /*
41 | if( chestVal == 0 ) {
42 | numAllZeroOrig ++;
43 | }
44 |
45 | value += 1;
46 | value /= 2;
47 |
48 | unsigned char newVal = (unsigned char)( value * 63 ) & 0x3F;
49 |
50 | printf( "\n ... new value = %f .... ", value );
51 | printBinary( newVal );
52 | printf( "\n\n" );
53 |
54 | if( newVal == 0 ) {
55 | numAllZeroNew ++;
56 | }
57 | */
58 |
59 |
60 | }
61 |
62 | printf( "Num all zero, orig = %d, new = %d \n",
63 | numAllZeroOrig, numAllZeroNew );
64 |
65 | return 0;
66 | }
67 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/tileSet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/tileSet.png
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/tileTemplate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/tileTemplate.png
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/gameSource/title.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/gameSource/title.png
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/prototypes/screenCompress/Makefile:
--------------------------------------------------------------------------------
1 |
2 |
3 | ROOT_PATH = ../../..
4 |
5 | COMPILE = g++ -g -I${ROOT_PATH} -c
6 | LINK = g++ -I${ROOT_PATH}
7 |
8 |
9 |
10 | MINOR_GEMS_SOURCES = \
11 | ${ROOT_PATH}/minorGems/io/file/linux/PathLinux.cpp \
12 | #${ROOT_PATH}/minorGems/graphics/linux/ScreenGraphicsLinux.cpp \
13 | #${ROOT_PATH}/minorGems/system/win32/ThreadWin32.cpp \
14 | #${ROOT_PATH}/minorGems/system/linux/ThreadLinux.cpp \
15 |
16 | MINOR_GEMS_OBJECTS = ${MINOR_GEMS_SOURCES:.cpp=.o}
17 |
18 | LIBRARIES = -lSDL
19 |
20 |
21 | all: screenCompress tileSet.tga characterSprite.tga
22 |
23 | screenCompress: screenCompress.o landscape.o ${MINOR_GEMS_OBJECTS}
24 | ${LINK} -o screenCompress screenCompress.o landscape.o ${MINOR_GEMS_OBJECTS} ${LIBRARIES}
25 |
26 |
27 | sdlTest: sdlTest.o
28 | ${LINK} -o sdlTest sdlTest.o ${MINOR_GEMS_OBJECTS} ${LIBRARIES} -lSDLmain
29 |
30 |
31 | screenCompress.o: screenCompress.cpp landscape.h
32 |
33 | landscape.o: landscape.cpp landscape.h
34 |
35 | tileSet.tga: tileSet.png
36 | convert tileSet.png tileSet.tga
37 |
38 | characterSprite.tga: characterSprite.png
39 | convert characterSprite.png characterSprite.tga
40 |
41 |
42 | #
43 | # Generic:
44 | #
45 | # Map all .cpp C++ and C files into .o object files
46 | #
47 | # $@ represents the name.o file
48 | # $< represents the name.cpp file
49 | #
50 | .cpp.o:
51 | ${COMPILE} -o $@ $<
52 | .c.o:
53 | ${COMPILE} -o $@ $<
54 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/prototypes/screenCompress/characterSprite.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/prototypes/screenCompress/characterSprite.png
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/prototypes/screenCompress/characterSprite.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/prototypes/screenCompress/characterSprite.tga
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/prototypes/screenCompress/compile:
--------------------------------------------------------------------------------
1 | g++ -I../../.. -o screenCompress screenCompress.cpp ../../../minorGems/graphics/linux/ScreenGraphicsLinux.cpp ../../../minorGems/io/file/linux/PathLinux.cpp landscape.o -lSDL
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/prototypes/screenCompress/mapTile.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/prototypes/screenCompress/mapTile.tga
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/prototypes/screenCompress/tileSet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/prototypes/screenCompress/tileSet.png
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/prototypes/screenCompress/tileSet.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/prototypes/screenCompress/tileSet.tga
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/prototypes/screenCompress/tileTemplate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/prototypes/screenCompress/tileTemplate.png
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/gamma256/prototypes/screenCompress/tileTemplate.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/gamma256/prototypes/screenCompress/tileTemplate.tga
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/common.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2002-October-18 Jason Rohrer
5 | * Created.
6 | */
7 |
8 |
9 |
10 | #ifndef MINOR_GEMS_COMMON_INCLUDED
11 | #define MINOR_GEMS_COMMON_INCLUDED
12 |
13 |
14 |
15 | #include "minorGems/util/development/memory/debugMemory.h"
16 |
17 |
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/crypto/hashes/sha1TestCompile:
--------------------------------------------------------------------------------
1 | g++ -I../../.. -o sha1Test sha1Test.cpp sha1.cpp ../../formats/encodingUtils.cpp
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/crypto/hashes/sha1sum.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2004-May-20 Jason Rohrer
5 | * Created.
6 | */
7 |
8 |
9 |
10 | #include "sha1.h"
11 | #include "minorGems/formats/encodingUtils.h"
12 |
13 |
14 | #include
15 | #include
16 |
17 |
18 | /**
19 | * Prints usage message and exits.
20 | *
21 | * @param inAppName the name of the app.
22 | */
23 | void usage( char *inAppName );
24 |
25 |
26 |
27 | int main( int inNumArgs, char **inArgs ) {
28 |
29 |
30 | if( inNumArgs != 2 ) {
31 | usage( inArgs[0] );
32 | }
33 |
34 |
35 | FILE *file = fopen( inArgs[1], "rb" );
36 |
37 | if( file == NULL ) {
38 | printf( "Failed to open file %s for reading\n\n", inArgs[1] );
39 |
40 | usage( inArgs[0] );
41 | }
42 |
43 |
44 | SHA_CTX shaContext;
45 |
46 | SHA1_Init( &shaContext );
47 |
48 |
49 | int bufferSize = 5000;
50 | unsigned char *buffer = new unsigned char[ bufferSize ];
51 |
52 | int numRead = bufferSize;
53 |
54 | char error = false;
55 |
56 | // read bytes from file until we run out
57 | while( numRead == bufferSize && !error ) {
58 |
59 | numRead = fread( buffer, 1, bufferSize, file );
60 |
61 | if( numRead > 0 ) {
62 | SHA1_Update( &shaContext, buffer, numRead );
63 | }
64 | else{
65 | error = true;
66 | }
67 | }
68 |
69 | fclose( file );
70 | delete [] buffer;
71 |
72 |
73 | if( error ) {
74 | printf( "Error reading from file %s\n", inArgs[1] );
75 | }
76 | else {
77 | unsigned char *rawDigest = new unsigned char[ SHA1_DIGEST_LENGTH ];
78 |
79 | SHA1_Final( rawDigest, &shaContext );
80 |
81 | // else hash is correct
82 | char *digestHexString = hexEncode( rawDigest, SHA1_DIGEST_LENGTH );
83 |
84 | printf( "%s %s\n", digestHexString, inArgs[1] );
85 |
86 | delete [] rawDigest;
87 | delete [] digestHexString;
88 | }
89 |
90 | return 0;
91 | }
92 |
93 |
94 |
95 | void usage( char *inAppName ) {
96 |
97 | printf( "Usage:\n\n" );
98 | printf( "\t%s file_to_sum\n", inAppName );
99 |
100 | printf( "example:\n" );
101 |
102 | printf( "\t%s test.txt\n", inAppName );
103 |
104 | exit( 1 );
105 | }
106 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/crypto/hashes/sha1sumCompile:
--------------------------------------------------------------------------------
1 | g++ -I../../.. -o sha1sum sha1sum.cpp sha1.cpp ../../formats/encodingUtils.cpp
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/formats/encodingUtilsTest.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2003-September-22 Jason Rohrer
5 | * Created.
6 | */
7 |
8 |
9 | #include "encodingUtils.h"
10 |
11 | #include
12 | #include
13 |
14 |
15 |
16 | int main() {
17 |
18 | const char *dataString =
19 | "*#$&$(@KFI#*$(SDBM@#*!(@%"
20 | "*#$&$(@KFI#*$(SDBM@#*!(@%"
21 | "*#$&$(@KFI#*$(SDBM@#*!(@F"
22 | "*#$&$(@KFI#*$(SDBM@#*!(@F"
23 | "*#$&$(@KFI#*$(SDBM@#*!(@F"
24 | "*#$&$(@KFI#*$(SDBM@#*!(@%a";
25 |
26 | printf( "base64 encoding the string: %s\n", dataString );
27 |
28 | char *encoding = base64Encode( (unsigned char *)dataString,
29 | strlen( dataString ),
30 | true );
31 |
32 | printf( "Encoded as:\n%s\n", encoding );
33 |
34 |
35 | int decodedLength;
36 | unsigned char *decoding = base64Decode( encoding, &decodedLength );
37 |
38 | char *buffer = new char[ decodedLength + 1 ];
39 | memcpy( (void *)buffer, (void *)decoding, decodedLength );
40 |
41 | buffer[ decodedLength ] = '\0';
42 |
43 | printf( "Decoded as: %s\n", buffer );
44 |
45 | if( strcmp( buffer, dataString ) == 0 ) {
46 | printf( "Test passed\n" );
47 | }
48 | else {
49 | printf( "Test failed\n" );
50 | }
51 |
52 | delete [] buffer;
53 | delete [] decoding;
54 | delete [] encoding;
55 |
56 | return 0;
57 | }
58 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/formats/encodingUtilsTestCompile:
--------------------------------------------------------------------------------
1 | g++ -g -I../.. -o encodingUtilsTest encodingUtilsTest.cpp encodingUtils.cpp ../util/stringUtils.cpp ../util/StringBufferOutputStream.cpp
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/formats/html/HTMLUtils.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2002-September-12 Jason Rohrer
5 | * Created.
6 | */
7 |
8 |
9 |
10 | #include "HTMLUtils.h"
11 |
12 | #include "minorGems/util/stringUtils.h"
13 | #include "minorGems/util/SimpleVector.h"
14 |
15 | #include
16 |
17 |
18 |
19 | char *HTMLUtils::removeAllTags( char *inString ) {
20 |
21 | SimpleVector *returnStringVector = new SimpleVector();
22 |
23 |
24 | int stringLength = strlen( inString );
25 |
26 | int i = 0;
27 |
28 | while( i < stringLength ) {
29 | if( inString[i] == '<' ) {
30 | // the start of a tag
31 |
32 | // skip all until (and including) close of tag
33 | while( i < stringLength && inString[i] != '>' ) {
34 | // do nothing
35 | i++;
36 | }
37 | }
38 | else {
39 | returnStringVector->push_back( inString[i] );
40 | }
41 | i++;
42 | }
43 |
44 |
45 | int numChars = returnStringVector->size();
46 | char *returnString = new char[ numChars + 1 ];
47 |
48 | for( i=0; igetElement( i ) );
50 | }
51 |
52 | returnString[ numChars ] = '\0';
53 |
54 | delete returnStringVector;
55 |
56 | return returnString;
57 | }
58 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/formats/html/HTMLUtils.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2002-September-12 Jason Rohrer
5 | * Created.
6 | */
7 |
8 |
9 |
10 | #ifndef HTML_UTILS_INCLUDED
11 | #define HTML_UTILS_INCLUDED
12 |
13 |
14 |
15 | /**
16 | * Utilities for processing HTML.
17 | *
18 | * @author Jason Rohrer
19 | */
20 | class HTMLUtils {
21 |
22 |
23 |
24 | public:
25 |
26 |
27 |
28 | /**
29 | * Removes all HTML tags from an HTML string.
30 | *
31 | * @param the HTML data as a \0-terminated string.
32 | * Must be destroyed by caller if non-const.
33 | *
34 | * @return data with all HTML tags removed as a newly allocated
35 | * \0-terminated string.
36 | * Must be destroyed by caller.
37 | */
38 | static char *removeAllTags( char *inString );
39 |
40 |
41 |
42 | };
43 |
44 |
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/formats/xml/XMLUtils.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2002-September-12 Jason Rohrer
5 | * Created.
6 | */
7 |
8 |
9 |
10 | #ifndef XML_UTILS_INCLUDED
11 | #define XML_UTILS_INCLUDED
12 |
13 |
14 |
15 | /**
16 | * Utilities for processing XML.
17 | *
18 | * @author Jason Rohrer
19 | */
20 | class XMLUtils {
21 |
22 |
23 |
24 | public:
25 |
26 |
27 |
28 | /**
29 | * Escapes characters disallowed in XML character data.
30 | *
31 | * @param the string to escape as a \0-terminated string.
32 | * Must be destroyed by caller if non-const.
33 | *
34 | * @return string with characters escaped as a newly allocated
35 | * \0-terminated string.
36 | * Must be destroyed by caller.
37 | */
38 | static char *escapeDisallowedCharacters( char *inString );
39 |
40 |
41 |
42 | };
43 |
44 |
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/graphics/ChannelFilter.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2000-December-21 Jason Rohrer
5 | * Created.
6 | *
7 | * 2006-October-14 Jason Rohrer
8 | * Added virtual destructor.
9 | */
10 |
11 |
12 | #ifndef CHANNEL_FILTER_INCLUDED
13 | #define CHANNEL_FILTER_INCLUDED
14 |
15 |
16 | /**
17 | * Interface for a class that can filter a 2D channel.
18 | *
19 | * @author Jason Rohrer
20 | */
21 | class ChannelFilter {
22 |
23 | public:
24 | virtual void apply( double *inChannel, int inWidth, int inHeight ) = 0;
25 |
26 |
27 | // ensure proper destruction of subclasses
28 | virtual ~ChannelFilter() {
29 | }
30 |
31 | };
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/graphics/ImageConverter.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2001-February-19 Jason Rohrer
5 | * Created.
6 | *
7 | * 2001-April-28 Jason Rohrer
8 | * Updated comments to deal with a failed deformatting operation.
9 | *
10 | * 2007-October-30 Jason Rohrer
11 | * Added virtual destructor.
12 | */
13 |
14 |
15 | #ifndef IMAGE_CONVERTER_INCLUDED
16 | #define IMAGE_CONVERTER_INCLUDED
17 |
18 |
19 | #include "Image.h"
20 | #include "minorGems/io/InputStream.h"
21 | #include "minorGems/io/OutputStream.h"
22 |
23 | /**
24 | * Interface for a class that can convert Images to and from
25 | * various image formats.
26 | *
27 | * @author Jason Rohrer
28 | */
29 | class ImageConverter {
30 |
31 | public:
32 |
33 | /**
34 | * Sends an image out to a stream as a particular
35 | * format.
36 | *
37 | * None of the parameters are destroyed by this call.
38 | *
39 | * @param inImage the image to convert.
40 | * @param inStream the stream to write the formatted image to.
41 | */
42 | virtual void formatImage( Image *inImage,
43 | OutputStream *inStream ) = 0;
44 |
45 | /**
46 | * Reads an image in from a stream as a particular
47 | * format.
48 | *
49 | * None of the parameters are destroyed by this call.
50 | *
51 | * @param inStream the stream to read the formatted image.
52 | *
53 | * @return the deformatted image, or NULL if the deformatting
54 | * operation fails. Must be destroyed by caller.
55 | */
56 | virtual Image *deformatImage( InputStream *inStream ) = 0;
57 |
58 |
59 |
60 | // to ensure proper destruction of implementing classes
61 | virtual ~ImageConverter() {};
62 |
63 |
64 | };
65 |
66 |
67 | #endif
68 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/graphics/converters/JPEGImageConverter.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2001-April-27 Jason Rohrer
5 | * Created.
6 | */
7 |
8 |
9 | #ifndef JPEG_IMAGE_CONVERTER_INCLUDED
10 | #define JPEG_IMAGE_CONVERTER_INCLUDED
11 |
12 |
13 | #include "minorGems/graphics/ImageConverter.h"
14 |
15 |
16 | /**
17 | * JPEG implementation of the image conversion interface.
18 | *
19 | * Implementations are platform dependent.
20 | *
21 | * @author Jason Rohrer
22 | */
23 | class JPEGImageConverter : public ImageConverter {
24 |
25 | public:
26 |
27 | /**
28 | * Constructs a JPEGImageConverter.
29 | *
30 | * @param inQuality a quality value in [0,100] for compression.
31 | * 100 specifies highest quality.
32 | */
33 | JPEGImageConverter( int inQuality );
34 |
35 |
36 | /**
37 | * Sets the compression quality.
38 | *
39 | * @param inQuality a quality value in [0,100]. 100
40 | * specifies highest quality.
41 | */
42 | void setQuality( int inQuality );
43 |
44 |
45 | /**
46 | * Gets the compression quality.
47 | *
48 | * @return a quality value in [0,100]. 100
49 | * indicates highest quality.
50 | */
51 | int getQuality();
52 |
53 |
54 | // implement the ImageConverter interface
55 | virtual void formatImage( Image *inImage,
56 | OutputStream *inStream );
57 |
58 | virtual Image *deformatImage( InputStream *inStream );
59 |
60 |
61 | private:
62 | int mQuality;
63 | };
64 |
65 |
66 |
67 | inline JPEGImageConverter::JPEGImageConverter( int inQuality )
68 | : mQuality( inQuality ) {
69 |
70 | if( mQuality > 100 || mQuality < 0 ) {
71 | printf( "JPEG quality must be in [0,100]\n" );
72 | mQuality = 50;
73 | }
74 | }
75 |
76 |
77 |
78 | inline void JPEGImageConverter::setQuality( int inQuality ) {
79 | mQuality = inQuality;
80 |
81 | if( mQuality > 100 || mQuality < 0 ) {
82 | printf( "JPEG quality must be in [0,100]\n" );
83 | mQuality = 50;
84 | }
85 | }
86 |
87 |
88 |
89 | inline int JPEGImageConverter::getQuality() {
90 | return mQuality;
91 | }
92 |
93 |
94 |
95 | #endif
96 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/graphics/converters/bmpConverterTest.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2001-February-19 Jason Rohrer
5 | * Created.
6 | *
7 | * 2001-February-24 Jason Rohrer
8 | * Fixed incorrect delete usage.
9 | *
10 | * 2001-April-12 Jason Rohrer
11 | * Changed to comply with new FileInput/OutputStream interface
12 | * (underlying File must be destroyed explicitly).
13 | */
14 |
15 | #include
16 |
17 | #include "minorGems/graphics/Image.h"
18 | #include "BMPImageConverter.h"
19 |
20 | #include "minorGems/io/file/File.h"
21 | #include "minorGems/io/file/FileOutputStream.h"
22 | #include "minorGems/io/file/FileInputStream.h"
23 |
24 | // test function for the BMPImageConverter class
25 | int main( char inNumArgs, char**inArgs ) {
26 | if( inNumArgs != 2 ) {
27 | printf( "must pass in a file name to write to\n" );
28 | return 1;
29 | }
30 |
31 | int length = 0;
32 | while( inArgs[1][length] != '\0' ) {
33 | length++;
34 | }
35 |
36 | File *file = new File( NULL, inArgs[1], length );
37 |
38 |
39 | // read image in
40 | FileInputStream *stream = new FileInputStream( file );
41 | BMPImageConverter *converter = new BMPImageConverter();
42 | Image *image = converter->deformatImage( stream );
43 |
44 | if( image != NULL ) {
45 | // write image back out
46 | File *fileOut = new File( NULL, "testOut.bmp", 11 );
47 | FileOutputStream *outStream = new FileOutputStream( fileOut );
48 |
49 | converter->formatImage( image, outStream );
50 |
51 | delete outStream;
52 | delete image;
53 | }
54 |
55 | delete stream;
56 | delete file;
57 | delete converter;
58 |
59 |
60 | /*
61 | FileOutputStream *stream = new FileOutputStream( file );
62 |
63 | BMPImageConverter *converter = new BMPImageConverter();
64 |
65 | Image *image = new Image( 256, 256, 3 );
66 |
67 | double *red = image->getChannel( 0 );
68 | double *green = image->getChannel( 1 );
69 |
70 | for( int y=0; ygetHeight(); y++ ) {
71 | for( int x=0; xgetWidth(); x++ ) {
72 | long index = y * image->getWidth() + x;
73 |
74 | red[index] = (double)y / (double)( image->getHeight() );
75 | green[index] = (double)x / (double)( image->getWidth() );
76 | //red[index] = 1.0;
77 | }
78 | }
79 |
80 | converter->formatImage( image, stream );
81 |
82 |
83 | delete stream;
84 | // delete file explicitly
85 | delete file;
86 | delete converter;
87 | delete image;
88 | */
89 | return 0;
90 | }
91 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/graphics/converters/compileTestPNG:
--------------------------------------------------------------------------------
1 | g++ -g -Wall -o testPNG -I../../.. testPNG.cpp PNGImageConverter.cpp ../../io/file/linux/PathLinux.cpp ../../system/unix/TimeUnix.cpp -lz -lpng
2 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/graphics/converters/jpegConverterTest.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2001-April-27 Jason Rohrer
5 | * Created.
6 | *
7 | * 2001-April-29 Jason Rohrer
8 | * Completed initial version and used to test JPEGImageConverter
9 | * successfully.
10 | */
11 |
12 |
13 | #include
14 |
15 | #include "minorGems/graphics/Image.h"
16 | #include "JPEGImageConverter.h"
17 |
18 | #include "minorGems/io/file/File.h"
19 | #include "minorGems/io/file/FileOutputStream.h"
20 | #include "minorGems/io/file/FileInputStream.h"
21 |
22 | // test function for the BMPImageConverter class
23 | int main( char inNumArgs, char**inArgs ) {
24 | if( inNumArgs != 2 ) {
25 | printf( "must pass in a file name to write to\n" );
26 | return 1;
27 | }
28 |
29 | int length = 0;
30 | while( inArgs[1][length] != '\0' ) {
31 | length++;
32 | }
33 |
34 | File *file = new File( NULL, inArgs[1], length );
35 |
36 |
37 | // read image in
38 | FileInputStream *stream = new FileInputStream( file );
39 | JPEGImageConverter *converter = new JPEGImageConverter( 50 );
40 | Image *image = converter->deformatImage( stream );
41 |
42 | if( image != NULL ) {
43 | // write image back out
44 | File *fileOut = new File( NULL, "testOut.jpg", 11 );
45 | FileOutputStream *outStream = new FileOutputStream( fileOut );
46 |
47 | converter->formatImage( image, outStream );
48 |
49 | delete outStream;
50 | delete fileOut;
51 | delete image;
52 | }
53 |
54 |
55 | delete stream;
56 | delete converter;
57 | delete file;
58 |
59 | /*
60 | FileOutputStream *stream = new FileOutputStream( file );
61 |
62 | JPEGImageConverter *converter = new JPEGImageConverteonverter( 50 );
63 |
64 | Image *image = new Image( 256, 256, 3 );
65 |
66 | double *red = image->getChannel( 0 );
67 | double *green = image->getChannel( 1 );
68 |
69 | for( int y=0; ygetHeight(); y++ ) {
70 | for( int x=0; xgetWidth(); x++ ) {
71 | long index = y * image->getWidth() + x;
72 |
73 | red[index] = (double)y / (double)( image->getHeight() );
74 | green[index] = (double)x / (double)( image->getWidth() );
75 | //red[index] = 1.0;
76 | }
77 | }
78 |
79 | converter->formatImage( image, stream );
80 |
81 |
82 | delete stream;
83 | // delete file explicitly
84 | delete file;
85 | delete converter;
86 | delete image;
87 | */
88 |
89 | return 0;
90 | }
91 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/graphics/converters/jpegConverterTestCompile:
--------------------------------------------------------------------------------
1 | g++ -I../../.. -ljpeg -o jpegConverterTest jpegConverterTest.cpp unix/JPEGImageConverterUnix.cpp ../../io/file/linux/PathLinux.cpp
2 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/graphics/converters/testPNG.cpp:
--------------------------------------------------------------------------------
1 | #include "PNGImageConverter.h"
2 |
3 | #include "minorGems/graphics/Image.h"
4 |
5 | #include "minorGems/io/file/FileOutputStream.h"
6 |
7 | #include "minorGems/system/Time.h"
8 |
9 |
10 | int main() {
11 |
12 | int imageSize = 640;
13 | Image testImage( imageSize, imageSize, 3, false );
14 |
15 |
16 | // red fades toward bottom
17 | // green fades toward right
18 | double *red = testImage.getChannel( 0 );
19 | double *green = testImage.getChannel( 1 );
20 |
21 | for( int y=0; y *mFilterVector;
57 |
58 | };
59 |
60 |
61 |
62 | inline MultiFilter::MultiFilter()
63 | : mFilterVector( new SimpleVector() ) {
64 |
65 | }
66 |
67 |
68 |
69 | inline MultiFilter::~MultiFilter() {
70 | delete mFilterVector;
71 | }
72 |
73 |
74 |
75 | inline void MultiFilter::apply( double *inChannel,
76 | int inWidth, int inHeight ) {
77 |
78 | int numFilters = mFilterVector->size();
79 | for( int i=0; igetElement( i ) );
81 | thisFilter->apply( inChannel, inWidth, inHeight );
82 | }
83 | }
84 |
85 |
86 |
87 | #endif
88 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/graphics/filters/ThresholdFilter.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2000-December-21 Jason Rohrer
5 | * Created.
6 | */
7 |
8 |
9 | #ifndef THRESHOLD_FILTER_INCLUDED
10 | #define THRESHOLD_FILTER_INCLUDED
11 |
12 | #include "minorGems/graphics/ChannelFilter.h"
13 |
14 | /**
15 | * Threshold filter.
16 | *
17 | * @author Jason Rohrer
18 | */
19 | class ThresholdFilter : public ChannelFilter {
20 |
21 | public:
22 |
23 | /**
24 | * Constructs a threshold filter.
25 | *
26 | * @param inThreshold threshold value. Channel values
27 | * above or equal to inThreshold are set to 1, while
28 | * all other values are set to 0.
29 | */
30 | ThresholdFilter( double inThreshold );
31 |
32 |
33 | /**
34 | * Sets the threshold.
35 | *
36 | * @param inThreshold threshold value. Channel values
37 | * above or equal to inThreshold are set to 1, while
38 | * all other values are set to 0.
39 | */
40 | void setThreshold( double inThreshold );
41 |
42 |
43 | // implements the ChannelFilter interface
44 | void apply( double *inChannel, int inWidth, int inHeight );
45 |
46 | private:
47 | double mThreshold;
48 | };
49 |
50 |
51 |
52 | inline ThresholdFilter::ThresholdFilter( double inThreshold )
53 | : mThreshold( inThreshold ) {
54 |
55 | }
56 |
57 |
58 |
59 | inline void ThresholdFilter::setThreshold( double inThreshold ) {
60 | mThreshold = inThreshold;
61 | }
62 |
63 |
64 |
65 | inline void ThresholdFilter::apply( double *inChannel,
66 | int inWidth, int inHeight ) {
67 |
68 | int numPixels = inWidth * inHeight;
69 | for( int i=0; i= mThreshold ) {
71 | inChannel[i] = 1.0;
72 | }
73 | else {
74 | inChannel[i] = 0.0;
75 | }
76 | }
77 | }
78 |
79 | #endif
80 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/graphics/filters/quickselect.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This Quickselect routine is based on the algorithm described in
3 | * "Numerical recipies in C", Second Edition,
4 | * Cambridge University Press, 1992, Section 8.5, ISBN 0-521-43108-5
5 | */
6 |
7 | #define ELEM_SWAP(a,b) { register int t=(a);(a)=(b);(b)=t; }
8 |
9 | int quick_select(int arr[], int n)
10 | {
11 | int low, high;
12 | int median;
13 | int middle, ll, hh; low = 0 ; high = n-1 ; median = (low + high) / 2;
14 | for (;;) {
15 | if (high <= low) /* One element only */
16 | return arr[median] ; if (high == low + 1) { /* Two elements only */
17 | if (arr[low] > arr[high])
18 | ELEM_SWAP(arr[low], arr[high]) ;
19 | return arr[median] ;
20 | } /* Find median of low, middle and high items; swap into position low */
21 | middle = (low + high) / 2;
22 | if (arr[middle] > arr[high]) ELEM_SWAP(arr[middle], arr[high]) ;
23 | if (arr[low] > arr[high]) ELEM_SWAP(arr[low], arr[high]) ;
24 | if (arr[middle] > arr[low]) ELEM_SWAP(arr[middle], arr[low]) ; /* Swap low item (now in position middle) into position (low+1) */
25 | ELEM_SWAP(arr[middle], arr[low+1]) ; /* Nibble from each end towards middle, swapping items when stuck */
26 | ll = low + 1;
27 | hh = high;
28 | for (;;) {
29 | do ll++; while (arr[low] > arr[ll]) ;
30 | do hh--; while (arr[hh] > arr[low]) ; if (hh < ll)
31 | break; ELEM_SWAP(arr[ll], arr[hh]) ;
32 | } /* Swap middle item (in position low) back into correct position */
33 | ELEM_SWAP(arr[low], arr[hh]) ; /* Re-set active partition */
34 | if (hh <= median)
35 | low = ll;
36 | if (hh >= median)
37 | high = hh - 1;
38 | }
39 | }
40 |
41 | #undef ELEM_SWAP
42 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/graphics/getKey.h:
--------------------------------------------------------------------------------
1 | // Jason Rohrer
2 | // getKey.h
3 |
4 | /**
5 | *
6 | * general interface for getting current key depressed
7 | * Implemented by a graphix framework on a particular platform
8 | *
9 | *
10 | * Created 12-15-99
11 | * Mods:
12 | *
13 | */
14 |
15 |
16 | // returns true if key represented by given key code is down
17 | char getKeyDown( int vKeyCode );
18 |
19 | // returns true if key is up
20 | char getKeyUp( int vKeyCode );
21 |
22 |
23 |
24 |
25 |
26 | /**
27 |
28 |
29 | Sample PC implementation
30 |
31 | #include
32 |
33 | getKeyDown( int vKeyCode ) {
34 | return ((GetAsyncKeyState(vKeyCode) & 0x8000) ? true : false);
35 | }
36 | getKeyUp( int vKeyCode ) {
37 | return ((GetAsyncKeyState(vKeyCode) & 0x8000) ? false : true);
38 | }
39 |
40 |
41 |
42 | Sample Mac implementation
43 |
44 |
45 | #include
46 |
47 | getKeyDown( int vKeyCode ) {
48 | KeyMapByteArray keyArray;
49 | GetKeys( keyArray );
50 |
51 | int arrayInd = vKeyCode >> 3; // divide by 8 to get start array index of key code
52 |
53 | unsigned char neededByte = keyArray[ arrayInd ];
54 |
55 | return (neededByte >> vKeyCode % 8) && 0x01; // trim off bit needed
56 | }
57 |
58 | getKeyUp( int vKeyCode ) {
59 | KeyMapByteArray keyArray;
60 | GetKeys( keyArray );
61 |
62 | int arrayInd = vKeyCode >> 3; // divide by 8 to get start array index of key code
63 |
64 | unsigned char neededByte = keyArray[ arrayInd ];
65 |
66 | return !((neededByte >> vKeyCode % 8) && 0x01); // trim off bit needed, and invert
67 | }
68 |
69 |
70 |
71 | */
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/graphics/getMouse.h:
--------------------------------------------------------------------------------
1 | // Jason Rohrer
2 | // getMouse.h
3 |
4 | /**
5 | *
6 | * general interface for getting current mouse position
7 | * Implemented by a graphix framework on a particular platform
8 | *
9 | *
10 | * Created 3-21-2000
11 | * Mods:
12 | *
13 | */
14 |
15 |
16 | void getMouse( int *x, int *y );
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/graphics/keyCodes.h:
--------------------------------------------------------------------------------
1 | // Jason Rohrer
2 | // keyCodes.h
3 |
4 | /**
5 | *
6 | * Header for defining key codes for various platforms
7 | *
8 | *
9 | * Created 12-15-99
10 | * Mods:
11 | * Jason Rohrer 3-23-2000 Added more key codes
12 | *
13 | */
14 |
15 |
16 | #ifdef WINDOWS_KEY_CODES
17 |
18 | #define M_KEY 0x4D
19 | #define N_KEY 0x4E
20 |
21 | #define S_KEY 0x53
22 |
23 | #define Q_KEY 0x51
24 |
25 | #define L_KEY 0x4C
26 |
27 | #define R_KEY 0x52
28 |
29 | #define T_KEY 0x54
30 |
31 | #endif
32 |
33 |
34 |
35 |
36 | #ifdef MAC_KEY_CODES
37 |
38 | #define M_KEY 0x2E
39 | #define N_KEY 0x2D
40 |
41 | #define S_KEY 0x01
42 |
43 | #define Q_KEY 0x0C
44 |
45 |
46 | #define L_KEY 0x25
47 |
48 | #define R_KEY 0x0F
49 |
50 | #define T_KEY 0x11
51 |
52 | #endif
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/graphics/linux/graphixCommonDefs.h:
--------------------------------------------------------------------------------
1 | // ALifeGUICommonDefs.h
2 |
3 |
4 | // common definitions for ALifeGui
5 |
6 |
7 |
8 | #define LINUX_KEY_CODES
9 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/graphics/loadFile.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "loadFile.h"
4 |
5 | // loads any file into the dest ptr.
6 |
7 |
8 | void loadFile( const char* fileName, long sizeInBytes, unsigned char* byteDestPtr) {
9 |
10 |
11 |
12 | FILE *f;
13 |
14 | int numBytesRead;
15 |
16 |
17 | f = fopen( fileName, "rb"); // open the file
18 |
19 | // don't load if file failed to open
20 | if( f == NULL ) {
21 | return;
22 | }
23 |
24 | numBytesRead = fread( (void*)byteDestPtr, sizeof(char), sizeInBytes, f);
25 |
26 | fclose(f);
27 |
28 | }
29 |
30 |
31 |
32 |
33 |
34 |
35 | // loads a photoshop RAW image file, 32-bit
36 |
37 | // NOTE:
38 | // This function exists because photoshop swaps the red and blue channels when
39 | // it saves a file as raw. Thus, the file stream doesn't match the way a video
40 | // card deals with 32-bit color.
41 |
42 | // This function loads the file and then swaps the appropriate bytes
43 |
44 | void loadRawFile( const char* fileName, long sizeInBytes, unsigned char* byteDestPtr) {
45 |
46 | //unsigned char tempChannel;
47 |
48 |
49 | long byteCount;
50 |
51 | FILE *f;
52 |
53 | int numBytesRead;
54 |
55 |
56 | f = fopen( fileName, "rb"); // open the file
57 |
58 | // don't load if file failed to open
59 | if( f == NULL ) {
60 | return;
61 | }
62 |
63 | numBytesRead = fread( (void*)byteDestPtr, sizeof(char), sizeInBytes, f);
64 |
65 |
66 | // now that file read, swap the red and blue channels:
67 |
68 | for( byteCount = 0; byteCount< sizeInBytes; byteCount=byteCount+4) {
69 |
70 | unsigned char alpha = byteDestPtr[byteCount+3];
71 |
72 | byteDestPtr[byteCount+3] = byteDestPtr[byteCount+2];
73 | byteDestPtr[byteCount+2] = byteDestPtr[byteCount+1];
74 | byteDestPtr[byteCount+1] = byteDestPtr[byteCount];
75 |
76 | byteDestPtr[byteCount] = alpha;
77 |
78 | /* tempChannel = byteDestPtr[byteCount]; // currently in red position
79 | byteDestPtr[byteCount] = byteDestPtr[byteCount+3]; // currently set to what's in alpha position
80 | byteDestPtr[byteCount+2] = tempChannel;
81 | */
82 |
83 | }
84 |
85 | fclose(f);
86 | }
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/graphics/loadfile.h:
--------------------------------------------------------------------------------
1 | void loadFile( const char* fileName, long sizeInBytes, unsigned char* byteDestPtr);
2 |
3 | void loadRawFile( const char* fileName, long sizeInBytes, unsigned char* byteDestPtr);
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/graphics/mac/graphixCommonDefs.h:
--------------------------------------------------------------------------------
1 | // ALifeGUICommonDefs.h
2 |
3 |
4 | // common definitions for ALifeGui
5 |
6 |
7 |
8 | #define MAC_KEY_CODES
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/graphics/mac/graphixFramework.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/minorGems/graphics/mac/graphixFramework.cpp
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/graphics/swapBuffers.h:
--------------------------------------------------------------------------------
1 | #include "GraphicBuffer.h"
2 |
3 | // function that swaps bufferB to the screen (32 bit version)
4 | // returns new back buffer
5 | //unsigned long *swapBuffers32( unsigned long *bufferPtrB, short bufferHigh, short bufferWide);
6 |
7 | // now replaces "buffer" in bufferB with the new double buffer after swap
8 | // no need to pass back the new buffer
9 | void swapBuffers32( GraphicBuffer &bufferB );
10 |
11 |
12 |
13 |
14 | // swap bufferB to the screen (8 bit version)
15 | // returns new back buffer
16 | unsigned char *swapBuffers8( unsigned char *bufferPtrB, short bufferHigh, short bufferWide );
17 |
18 |
19 |
20 |
21 |
22 | // NOTE: the bodies of these functions must occur in the body of the main DDraw code file
23 | // i.e., in the file where all the directDraw objects are instantiated.
24 | // these functions assume the ddraw ojects are declared globally
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/graphics/test/rgb2yiqCompile:
--------------------------------------------------------------------------------
1 | g++ -o rgb2yiq -I../../.. rgb2yiq.cpp ../../../minorGems/io/file/linux/PathLinux.cpp
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/graphics/test/tgaConverterCompile:
--------------------------------------------------------------------------------
1 | g++ -g -o tgaConverter -I../../.. tgaConverter.cpp ../../../minorGems/io/file/linux/PathLinux.cpp
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/graphics/test/yiq2rgbCompile:
--------------------------------------------------------------------------------
1 | g++ -g -o yiq2rgb -I../../.. yiq2rgb.cpp ../../../minorGems/io/file/linux/PathLinux.cpp
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/graphics/win32/graphixCommonDefs.h:
--------------------------------------------------------------------------------
1 | // ALifeGUICommonDefs.h
2 |
3 |
4 | // common definitions for ALifeGui
5 |
6 |
7 |
8 | #define WINDOWS_KEY_CODES
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/io/Serializable.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2001-January-10 Jason Rohrer
5 | * Created.
6 | * Added untility functions for converting integers to and from byte arrays.
7 | *
8 | * 2001-January-15 Jason Rohrer
9 | * Made utility functions static.
10 | * Fixed a major bug in the longToBytes function.
11 | *
12 | * 2001-February-3 Jason Rohrer
13 | * Removed the long io functions, which are now contained in the
14 | * input- and outputStream classes.
15 | *
16 | * 2005-November-21 Jason Rohrer
17 | * Fixed a warning by adding a virtual destructor.
18 | */
19 |
20 | #include "minorGems/common.h"
21 |
22 |
23 | #ifndef SERIALIZABLE_CLASS_INCLUDED
24 | #define SERIALIZABLE_CLASS_INCLUDED
25 |
26 | #include "InputStream.h"
27 | #include "OutputStream.h"
28 |
29 | /**
30 | * Interface for an object that can be serialized to and deserialized
31 | * from a stream.
32 | *
33 | * Note that the deserialize function is meant to be called from an already
34 | * constructed object (to set object parameters using data read from the
35 | * stream), and is not a method of obtaining an object.
36 | *
37 | * All multi-byte data members should be encoded in using a big endian format.
38 | *
39 | * @author Jason Rohrer
40 | */
41 | class Serializable {
42 |
43 | public:
44 |
45 | /**
46 | * Writes this object out to a stream.
47 | *
48 | * @param inOutputStream the stream to write to.
49 | *
50 | * @return the number of bytes written successfully,
51 | * or -1 for a stream error.
52 | */
53 | virtual int serialize( OutputStream *inOutputStream ) = 0;
54 |
55 |
56 | /**
57 | * Reads this object in from a stream.
58 | *
59 | * @param inInputStream the stream to read from.
60 | *
61 | * @return the number of bytes read successfully,
62 | * or -1 for a stream error.
63 | */
64 | virtual int deserialize( InputStream *inInputStream ) = 0;
65 |
66 |
67 |
68 | virtual ~Serializable();
69 |
70 | };
71 |
72 |
73 |
74 | inline Serializable::~Serializable() {
75 | // does nothing
76 | // exists to ensure that subclass destructors are called
77 | }
78 |
79 |
80 |
81 | #endif
82 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/io/file/Directory.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2003-January-23 Jason Rohrer
5 | * Created.
6 | *
7 | *
8 | * 2003-November-10 Jason Rohrer
9 | * Added makeDirectory function.
10 | */
11 |
12 |
13 |
14 | #include "minorGems/common.h"
15 | #include "minorGems/io/file/File.h"
16 |
17 |
18 |
19 | #ifndef DIRECTORY_INCLUDED
20 | #define DIRECTORY_INCLUDED
21 |
22 |
23 |
24 | /**
25 | * Class of static directory functions.
26 | *
27 | * This class exists because most directory operations are
28 | * platform-dependent, and a large body of existing code
29 | * depends on a platform-independent File.h.
30 | *
31 | * @author Jason Rohrer.
32 | */
33 | class Directory {
34 |
35 | public:
36 |
37 |
38 |
39 | /**
40 | * Removes a directory.
41 | *
42 | * The directory must be empty for this call to succeed.
43 | *
44 | * @param inFile the file representing the directory.
45 | * Must be destroyed by caller.
46 | *
47 | * @return true if the directory is removed successfully, or
48 | * false otherwise (for example, if the directory is not empy).
49 | */
50 | static char removeDirectory( File *inFile );
51 |
52 |
53 |
54 | /**
55 | * Makes a directory.
56 | *
57 | * @param inFile the file representing the directory.
58 | * Must be destroyed by caller.
59 | *
60 | * @return true if the directory is removed successfully, or
61 | * false otherwise (for example, if the directory is not empy).
62 | */
63 | static char makeDirectory( File *inFile );
64 |
65 |
66 |
67 | };
68 |
69 |
70 |
71 | #endif
72 |
73 |
74 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/io/file/linux/PathLinux.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2001-February-12 Jason Rohrer
5 | * Created.
6 | *
7 | * 2001-August-1 Jason Rohrer
8 | * Added missing length return value.
9 | *
10 | * 2003-June-2 Jason Rohrer
11 | * Added support for new path checking functions.
12 | *
13 | * 2010-May-18 Jason Rohrer
14 | * String parameters as const to fix warnings.
15 | */
16 |
17 | #include "minorGems/io/file/Path.h"
18 | #include "minorGems/util/stringUtils.h"
19 |
20 |
21 |
22 | /*
23 | * Linux-specific path implementation. May be compatible
24 | * with other posix-complient systems.
25 | */
26 |
27 |
28 |
29 | char Path::getDelimeter() {
30 | return '/';
31 | }
32 |
33 |
34 |
35 | char *Path::getAbsoluteRoot( int *outLength ) {
36 | char *returnString = new char[1];
37 | returnString[0] = '/';
38 |
39 | *outLength = 1;
40 |
41 | return returnString;
42 | }
43 |
44 |
45 |
46 | char Path::isAbsolute( const char *inPathString ) {
47 | if( inPathString[0] == '/' ) {
48 | return true;
49 | }
50 | else {
51 | return false;
52 | }
53 | }
54 |
55 |
56 |
57 | char *Path::extractRoot( const char *inPathString ) {
58 | if( isAbsolute( inPathString ) ){
59 | return stringDuplicate( "/" );
60 | }
61 | else {
62 | return NULL;
63 | }
64 | }
65 |
66 |
67 |
68 | char Path::isRoot( const char *inPathString ) {
69 | if( strcmp( inPathString, "/" ) == 0 ) {
70 | return true;
71 | }
72 | else {
73 | return false;
74 | }
75 | }
76 |
77 |
78 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/io/file/test/testChildFiles.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2004-January-4 Jason Rohrer
5 | * Created.
6 | */
7 |
8 |
9 | /**
10 | * A test program for the various child file functions in File.h
11 | *
12 | * @author Jason Rohrer.
13 | */
14 |
15 |
16 |
17 | #include "minorGems/io/file/File.h"
18 |
19 |
20 |
21 | int main( int inNumArgs, char **inArgs ) {
22 |
23 | char *fileName = "linux";
24 |
25 | if( inNumArgs > 1 ) {
26 | fileName = inArgs[1];
27 | }
28 |
29 | File *testFile = new File( NULL, fileName );
30 |
31 | int numChildren;
32 |
33 | File **childFiles = testFile->getChildFiles( &numChildren );
34 |
35 |
36 | printf( "child files:\n" );
37 | for( int i=0; igetFullFileName();
40 |
41 | printf( " %s\n", fullName );
42 |
43 | delete [] fullName;
44 |
45 | delete childFiles[i];
46 | }
47 |
48 | delete [] childFiles;
49 |
50 |
51 |
52 | childFiles = testFile->getChildFilesRecursive( 10, &numChildren );
53 |
54 |
55 | printf( "recursive child files:\n" );
56 | for( int i=0; igetFullFileName();
59 |
60 | printf( " %s\n", fullName );
61 |
62 | delete [] fullName;
63 |
64 | delete childFiles[i];
65 | }
66 |
67 | delete [] childFiles;
68 |
69 |
70 | delete testFile;
71 |
72 | return 0;
73 | }
74 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/io/file/test/testPath.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2002-August-1 Jason Rohrer
5 | * Created.
6 | */
7 |
8 |
9 | #include "Path.h"
10 |
11 | #include
12 |
13 |
14 |
15 | int main() {
16 |
17 | char *pathString = "/test/this/thing";
18 |
19 | printf( "using path string = %s\n", pathString );
20 |
21 | printf( "Constructing path.\n" );
22 | Path *path = new Path( pathString );
23 |
24 |
25 | printf( "Extracting path string.\n" );
26 | char *extractedPathString = path->getPathStringTerminated();
27 |
28 | printf( "extracted path string = %s\n", extractedPathString );
29 |
30 |
31 |
32 | delete [] extractedPathString;
33 |
34 | delete path;
35 |
36 | return 1;
37 | }
38 |
39 |
40 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/io/file/testPath.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2002-August-1 Jason Rohrer
5 | * Created.
6 | */
7 |
8 |
9 | #include "Path.h"
10 |
11 | #include
12 |
13 |
14 |
15 | int main() {
16 |
17 | char *pathString = "/test/this/thing";
18 |
19 | printf( "using path string = %s\n", pathString );
20 |
21 | printf( "Constructing path.\n" );
22 | Path *path = new Path( pathString );
23 |
24 |
25 | printf( "Extracting path string.\n" );
26 | char *extractedPathString = path->getPathStringTerminated();
27 |
28 | printf( "extracted path string = %s\n", extractedPathString );
29 |
30 |
31 |
32 | delete [] extractedPathString;
33 |
34 | delete path;
35 |
36 | return 1;
37 | }
38 |
39 |
40 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/io/file/unix/DirectoryUnix.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2003-January-23 Jason Rohrer
5 | * Created.
6 | *
7 | * 2003-November-10 Jason Rohrer
8 | * Added makeDirectory function.
9 | */
10 |
11 |
12 |
13 | #include "minorGems/io/file/Directory.h"
14 |
15 |
16 | #include
17 |
18 |
19 |
20 | char Directory::removeDirectory( File *inFile ) {
21 | char *fileName = inFile->getFullFileName();
22 |
23 | int result = rmdir( fileName );
24 |
25 | delete [] fileName;
26 |
27 | if( result == 0 ) {
28 | return true;
29 | }
30 | else {
31 | return false;
32 | }
33 | }
34 |
35 |
36 |
37 | char Directory::makeDirectory( File *inFile ) {
38 | char *stringName = inFile->getFullFileName();
39 |
40 | int result = mkdir( stringName, 0xFFFF );
41 |
42 | delete [] stringName;
43 |
44 | if( 0 == result ) {
45 | return true;
46 | }
47 | else {
48 | return false;
49 | }
50 | }
51 |
52 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/io/file/win32/DirectoryWin32.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2003-January-23 Jason Rohrer
5 | * Created.
6 | *
7 | * 2003-November-10 Jason Rohrer
8 | * Added makeDirectory function.
9 | */
10 |
11 |
12 |
13 | #include "minorGems/io/file/Directory.h"
14 |
15 |
16 |
17 | #include
18 |
19 |
20 |
21 | char Directory::removeDirectory( File *inFile ) {
22 | char *fileName = inFile->getFullFileName();
23 |
24 | int result = _rmdir( fileName );
25 |
26 | delete [] fileName;
27 |
28 | if( result == 0 ) {
29 | return true;
30 | }
31 | else {
32 | return false;
33 | }
34 | }
35 |
36 |
37 |
38 | char Directory::makeDirectory( File *inFile ) {
39 | char *stringName = inFile->getFullFileName();
40 |
41 | int result = mkdir( stringName );
42 |
43 | delete [] stringName;
44 |
45 | if( 0 == result ) {
46 | return true;
47 | }
48 | else {
49 | return false;
50 | }
51 | }
52 |
53 |
54 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/io/file/win32/PathWin32.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2001-February-12 Jason Rohrer
5 | * Created.
6 | *
7 | * 2001-March-4 Jason Rohrer
8 | * Fixed delimeter constants.
9 | *
10 | * 2001-August-1 Jason Rohrer
11 | * Added missing length return value.
12 | *
13 | * 2003-June-2 Jason Rohrer
14 | * Added support for new path checking functions.
15 | *
16 | * 2010-May-14 Jason Rohrer
17 | * String parameters as const to fix warnings.
18 | */
19 |
20 | #include "minorGems/io/file/Path.h"
21 | #include "minorGems/util/stringUtils.h"
22 |
23 |
24 | /*
25 | * Windows-specific path implementation.
26 | */
27 |
28 |
29 |
30 | char Path::getDelimeter() {
31 | return '\\';
32 | }
33 |
34 |
35 |
36 | char *Path::getAbsoluteRoot( int *outLength) {
37 | // C:\ is the only root we can generically return
38 |
39 | char *returnString = new char[3];
40 |
41 | returnString[0] = 'C';
42 | returnString[1] = ':';
43 | returnString[2] = '\\';
44 |
45 | *outLength = 3;
46 |
47 | return returnString;
48 | }
49 |
50 |
51 |
52 | char Path::isAbsolute( const char *inPathString ) {
53 | // ignore first character, which will be drive letter
54 | if( inPathString[1] == ':' && inPathString[2] == '\\' ) {
55 | return true;
56 | }
57 | else {
58 | return false;
59 | }
60 | }
61 |
62 |
63 |
64 | char *Path::extractRoot( const char *inPathString ) {
65 | if( isAbsolute( inPathString ) ){
66 | // copy path, then trim to only three characters
67 |
68 | char *pathCopy = stringDuplicate( inPathString );
69 | pathCopy[ 3 ] = '\0';
70 |
71 | char *trimmedCopy = stringDuplicate( pathCopy );
72 | delete [] pathCopy;
73 |
74 | return trimmedCopy;
75 | }
76 | else {
77 | return NULL;
78 | }
79 | }
80 |
81 |
82 |
83 | char Path::isRoot( const char *inPathString ) {
84 | // must be of form "c:\"
85 | if( strlen( inPathString ) == 3 &&
86 | inPathString[1] == ':' &&
87 | inPathString[2] == '\\' ) {
88 | return true;
89 | }
90 | else {
91 | return false;
92 | }
93 | }
94 |
95 |
96 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/io/file/win32/dirent.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2002-April-7 Jason Rohrer
5 | * Added a mkdir wrapper for CodeWarrior.
6 | *
7 | * 2002-April-11 Jason Rohrer
8 | * Changed type of mode parameter to work with Visual C++.
9 | * Added missing macros.
10 | *
11 | * 2002-July-22 Jason Rohrer
12 | * Commented out mkdir replacement function to work with new MSL.
13 | *
14 | * 2002-October-13 Jason Rohrer
15 | * Re-added mkdir wrapper function, since both CW4 and VC++ need it.
16 | */
17 |
18 | #include "minorGems/common.h"
19 |
20 |
21 |
22 | /*
23 |
24 | Declaration of POSIX directory browsing functions and types for Win32.
25 |
26 | Kevlin Henney (mailto:kevlin@acm.org), March 1997.
27 |
28 | Copyright Kevlin Henney, 1997. All rights reserved.
29 |
30 | Permission to use, copy, modify, and distribute this software and its
31 | documentation for any purpose is hereby granted without fee, provided
32 | that this copyright and permissions notice appear in all copies and
33 | derivatives, and that no charge may be made for the software and its
34 | documentation except to cover cost of distribution.
35 |
36 | */
37 |
38 | #ifndef DIRENT_INCLUDED
39 | #define DIRENT_INCLUDED
40 |
41 | typedef struct DIR DIR;
42 |
43 | struct dirent
44 | {
45 | char *d_name;
46 | };
47 |
48 | DIR *opendir(const char *);
49 | int closedir(DIR *);
50 | struct dirent *readdir(DIR *);
51 | void rewinddir(DIR *);
52 |
53 |
54 |
55 | #include
56 | /**
57 | * The Metrowerks Standard Library seems
58 | * to have only a 1-parameter mkdir command in sys/stat.h.
59 | */
60 | int mkdir( const char *pathname, unsigned int mode );
61 |
62 |
63 | // make sure our needed macros are defined
64 | // S_IFMT and S_IFDIR seem to be defined everywhere
65 |
66 | #ifndef __S_ISTYPE
67 | #define __S_ISTYPE(mode, mask) (((mode) & S_IFMT) == (mask))
68 | #endif
69 |
70 |
71 | #ifndef S_ISDIR
72 | #define S_ISDIR(mode) __S_ISTYPE((mode), S_IFDIR)
73 | #endif
74 |
75 |
76 |
77 | #endif
78 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/io/pipedStreamTest.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2001-February-19 Jason Rohrer
5 | * Created.
6 | */
7 |
8 | #include
9 |
10 | #include "PipedStream.h"
11 |
12 | #include "minorGems/util/random/StdRandomSource.h"
13 |
14 | // test function for piped streams
15 | int main() {
16 |
17 | PipedStream *stream = new PipedStream;
18 | InputStream *inStream = stream;
19 | OutputStream *outStream = stream;
20 |
21 | StdRandomSource *randSource = new StdRandomSource();
22 |
23 | unsigned char *bufferA = new unsigned char[10];
24 | unsigned char *bufferB = new unsigned char[15];
25 |
26 | int i;
27 |
28 | printf( "bufferA = \n" );
29 | for( i=0; i<10; i++ ) {
30 | bufferA[i] = (unsigned char)(
31 | randSource->getRandomBoundedInt(0, 255) );
32 | printf( "%d\n", bufferA[i] );
33 | }
34 | printf( "bufferB = \n" );
35 | for( i=0; i<15; i++ ) {
36 | bufferB[i] = (unsigned char)(
37 | randSource->getRandomBoundedInt(0, 255) );
38 | printf( "%d\n", bufferB[i] );
39 | }
40 |
41 | unsigned char *bufferC = new unsigned char[ 10 + 15];
42 |
43 |
44 | outStream->write( bufferA, 10 );
45 | outStream->write( bufferB, 15 );
46 |
47 | inStream->read( bufferC, 10 + 10 );
48 |
49 | char *error = inStream->getLastError();
50 | if( error != NULL ) {
51 | printf( "Stream error %s\n", error );
52 | delete [] error;
53 | }
54 | printf( "bufferc = \n" );
55 | for( i=0; i<10 + 15; i++ ) {
56 | printf( "%d\n", bufferC[i] );
57 | }
58 |
59 | inStream->read( bufferC, 10 );
60 |
61 | error = inStream->getLastError();
62 | if( error != NULL ) {
63 | printf( "Stream error %s\n", error );
64 | delete [] error;
65 | }
66 | printf( "bufferc = \n" );
67 | for( i=0; i<10 + 15; i++ ) {
68 | printf( "%d\n", bufferC[i] );
69 | }
70 |
71 |
72 | delete [] bufferA;
73 | delete [] bufferB;
74 | delete [] bufferC;
75 |
76 | delete randSource;
77 | delete stream;
78 | }
79 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/io/serialPort/SerialPortFromFile.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2003-March-28 Jason Rohrer
5 | * Created.
6 | */
7 |
8 |
9 |
10 | #include "minorGems/io/serialPort/SerialPort.h"
11 | #include "minorGems/util/stringUtils.h"
12 |
13 |
14 |
15 | #include
16 |
17 |
18 |
19 | SerialPort::SerialPort( int inBaud, int inParity, int inDataBits,
20 | int inStopBits ) {
21 |
22 | FILE *file = fopen( "gpscap.txt", "r" );
23 |
24 | mNativeObjectPointer = file;
25 | }
26 |
27 |
28 |
29 | SerialPort::~SerialPort() {
30 |
31 | if( mNativeObjectPointer != NULL ) {
32 | FILE *file = (FILE *)mNativeObjectPointer;
33 |
34 | fclose( file );
35 | }
36 | }
37 |
38 |
39 |
40 | int SerialPort::sendLine( char *inLine ) {
41 | return 1;
42 | }
43 |
44 |
45 |
46 | char *SerialPort::receiveLine() {
47 | if( mNativeObjectPointer != NULL ) {
48 | FILE *file = (FILE *)mNativeObjectPointer;
49 |
50 | char *buffer = new char[500];
51 |
52 | // read up to first newline
53 | int index = 0;
54 |
55 | char lastCharRead = (char)getc( file );
56 |
57 | while( lastCharRead != '\n' && index < 499 ) {
58 | buffer[index] = lastCharRead;
59 | lastCharRead = (char)getc( file );
60 | index++;
61 | }
62 |
63 |
64 | char *returnString;
65 |
66 | if( index > 0 ) {
67 | buffer[ index ] = '\0';
68 |
69 | returnString = stringDuplicate( buffer );
70 | }
71 | else {
72 | returnString = NULL;
73 | }
74 |
75 | delete [] buffer;
76 | return returnString;
77 | }
78 | else {
79 | return NULL;
80 | }
81 | }
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/io/serialPort/testSerialPort.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "SerialPort.h"
3 |
4 | #include
5 |
6 | int main() {
7 |
8 | printf( "Constructing serial port.\n" );
9 | SerialPort *port = new SerialPort( 4800, SerialPort::PARITY_NONE, 8, 1 );
10 |
11 | char *line = port->receiveLine();
12 |
13 | // specific to GPS unit
14 | port->sendLine( "ASTRAL" );
15 |
16 | while( line != NULL ) {
17 | printf( "received: %s\n", line );
18 |
19 | delete [] line;
20 | line = port->receiveLine();
21 | }
22 |
23 | printf( "Deleting serial port.\n" );
24 | delete port;
25 |
26 | return 0;
27 | }
28 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/io/serialPort/testSerialPortCompile:
--------------------------------------------------------------------------------
1 | g++ -o testSerialPort -I../../.. linux/SerialPortLinux.cpp testSerialPort.cpp
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/io/win32/TypeIOWin32.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2001-February-3 Jason Rohrer
5 | * Created.
6 | * Fixed parameter names to match convention.
7 | *
8 | * 2001-February-4 Jason Rohrer
9 | * Fixed a byte-order bug.
10 | */
11 |
12 |
13 | #include "minorGems/io/TypeIO.h"
14 |
15 |
16 | /*
17 | * Win32-specific type input and output.
18 | * Note that all types are output in the order that
19 | * a big-endian linux machine outputs them with no conversion.
20 | */
21 |
22 | // windows machines are all little-endian
23 |
24 | void TypeIO::doubleToBytes( double inDouble, unsigned char *outBytes ) {
25 |
26 | unsigned char *doubleBuffer = (unsigned char*)( &inDouble );
27 |
28 | // output second word first
29 | outBytes[0] = doubleBuffer[7];
30 | outBytes[1] = doubleBuffer[6];
31 | outBytes[2] = doubleBuffer[5];
32 | outBytes[3] = doubleBuffer[4];
33 |
34 | outBytes[4] = doubleBuffer[3];
35 | outBytes[5] = doubleBuffer[2];
36 | outBytes[6] = doubleBuffer[1];
37 | outBytes[7] = doubleBuffer[0];
38 | }
39 |
40 |
41 |
42 | double TypeIO::bytesToDouble( unsigned char *inBytes ) {
43 |
44 | double returnValue;
45 |
46 | unsigned char *doubleBuffer = (unsigned char*)( &returnValue );
47 |
48 | // put first word at the end of this double
49 | doubleBuffer[7] = inBytes[0];
50 | doubleBuffer[6] = inBytes[1];
51 | doubleBuffer[5] = inBytes[2];
52 | doubleBuffer[4] = inBytes[3];
53 |
54 | doubleBuffer[3] = inBytes[4];
55 | doubleBuffer[2] = inBytes[5];
56 | doubleBuffer[1] = inBytes[6];
57 | doubleBuffer[0] = inBytes[7];
58 |
59 | return returnValue;
60 | }
61 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/numtest.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2001-February-3 Jason Rohrer
5 | * Created.
6 | *
7 | * 2001-February-4 Jason Rohrer
8 | * Fixed a bug that made this test not compatible with TypeIO.
9 | * Fixed comment.
10 | */
11 |
12 | #include
13 |
14 | // function for testing how doubles are stored
15 |
16 | /*
17 | * The output from a big-endian linux is as follows:
18 | *
19 | * size of double = 8
20 | * byte 0 = 63
21 | * byte 1 = 255
22 | * byte 2 = 189
23 | * byte 3 = 137
24 | * byte 4 = 176
25 | * byte 5 = 126
26 | * byte 6 = 158
27 | * byte 7 = 168
28 | *
29 | */
30 |
31 | int main() {
32 | printf( "size of double = %d\n", sizeof( double ) );
33 |
34 |
35 |
36 |
37 |
38 | double x = 1.983773889;
39 |
40 |
41 | unsigned char *doubleBuffer = (unsigned char*)( &x );
42 |
43 | for( int i=0; i<8; i++ ) {
44 |
45 | printf( "byte %d = %d\n", i, doubleBuffer[i] );
46 | }
47 |
48 | return 0;
49 | }
50 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/protocol/p2p/genericProtocol.txt:
--------------------------------------------------------------------------------
1 | Generic peer-to-peer protocol.
2 |
3 | White space:
4 | All white space is equivalent (tabs, line breaks, spaces, etc.)
5 |
6 |
7 | Two types of commands, GET and PUT.
8 |
9 | Command form:
10 | GET return_address id_number resource_descriptor
11 | PUT id_number resource
12 |
13 |
14 | return_address = {xxx.xxx.xxx.xxx | hostname}:port_number
15 |
16 | resource_descriptor = resource_type [description]
17 |
18 |
19 | description = resource specific description data may be optional for certain resource types
20 |
21 |
22 | resource = resource_type resource_data
23 |
24 |
25 | A PUT command corresponding to a GET command (in other words, a put command sharing the same ID as the GET command) can be of one of three types:
26 |
27 | 1. A resource matching the resource descriptor specified by the GET command.
28 | 2. A GET_REQUEST_FAILURE resource.
29 | 3. A MORE_KNOWLEDGEABLE_HOSTS resource.
30 |
31 |
32 |
33 | Examples:
34 |
35 | See resourceSpecifications.txt for information about the resource types used in these examples.
36 |
37 |
38 | A GET request for a server list:
39 |
40 | GET myhost.mydomain.com:5157 1 SERVER_LIST
41 |
42 |
43 | The corresponding PUT command:
44 |
45 | PUT 1 SERVER_LIST 3 server1.domain1.com:5157 server2.domain2.com:5157 server3.domain3.com:5157
46 |
47 |
48 |
49 | A GET request for a search:
50 |
51 | GET myhost.mydomain.com:5157 2 SEARCH 1 FILE 3 termA termB termC
52 |
53 |
54 | A PUT command from a successful search:
55 |
56 | PUT 2 SEARCH 2 FILE filehost1.domain1.com:5157 c:/files/termAtermBtermC.txt FILE filehost2.domain2.com:5157 /home/john/myfiles/termAtermBtermC.txt
57 |
58 |
59 | A PUT command for a failed search:
60 |
61 | PUT 2 GET_REQUEST_FAILED SEARCH 1 FILE 3 termA termB termC
62 |
63 |
64 | A PUT command informing us of a more knowledgeable search host:
65 |
66 | PUT 2 MORE_KNOWLEDGEABLE_HOSTS 1 searchhost.domain.com:5157
67 |
68 |
69 |
70 | We can request more knowlegeable hosts explicitly:
71 |
72 | GET myhost.mydomain.com:5157 3 MORE_KNOWLEDGEABLE_HOSTS SEARCH 1 FILE 3 termA termB termC
73 |
74 |
75 | The corresponding PUT command:
76 |
77 | PUT 3 MORE_KNOWLEDGEABLE_HOSTS 1 searchhost.domain.com:5157
78 |
79 |
80 |
81 | A GET request for a file
82 |
83 | GET myhost.mydomain.com:5157 4 FILE filehost1.domain1.com:5157 c:/files/termAtermBtermC.txt
84 |
85 |
86 | The corresponding PUT command:
87 |
88 | PUT 4 FILE c:/files/termAtermBtermC.txt 19 ###this is a text file
89 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/protocol/p2p/resourceSpecifications.txt:
--------------------------------------------------------------------------------
1 | This file contains specifications for resource types. For each type, we give a specification for the resource descriptor and then the resource. Newlines in this specification can be replaced by any kind of white space.
2 |
3 |
4 |
5 | GET_REQUEST_FAILURE
6 | [no description]
7 |
8 | GET_REQUEST_FAILURE
9 | resource_descriptor
10 |
11 |
12 | (Note that a GET_REQUEST_FAILURE resource contains the descriptor from the failed request. The PUT request for a GET_REQUEST_FAILURE resource should use the ID number from the original resource request.)
13 |
14 |
15 |
16 | MORE_KNOWLEGEABLE_HOSTS
17 | resource_descriptor
18 |
19 | MORE_KNOWLEDGEABLE_HOSTS
20 | num_hosts
21 | address_1:port_1
22 | address_2:port_2
23 | ...
24 | address_N:port_N
25 |
26 |
27 |
28 | SERVER_LIST
29 | [no description]
30 |
31 | SERVER_LIST
32 | num_servers
33 | address_1:port_1
34 | address_2:port_2
35 | ...
36 | address_N:port_N
37 |
38 |
39 |
40 | SEARCH
41 | num_allowed_resource_types
42 | allowed_type_1
43 | allowed_type_2
44 | ...
45 | allowed_type_N
46 | num_search_terms
47 | search_term_1
48 | search_term_2
49 | ...
50 | search_term_N
51 |
52 | SEARCH
53 | num_results
54 | result_descriptor_1
55 | result_descriptor_2
56 | ...
57 | result_descriptor_N
58 |
59 |
60 |
61 | FILE
62 | host_address:host_port
63 | file_path
64 |
65 | FILE
66 | file_path
67 | file_length_bytes
68 | ###file_data
69 |
70 |
71 | (Note that for the FILE type, the ### must occur immediately before the file data (no whitespace must separate ### from the start of the file).
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/system/BinarySemaphore.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2001-January-11 Jason Rohrer
5 | * Created.
6 | *
7 | * 2001-January-27 Jason Rohrer
8 | * Fixed a bug in the precompiler directives.
9 | *
10 | * 2003-August-26 Jason Rohrer
11 | * Added support for timeouts on wait.
12 | */
13 |
14 | #include "minorGems/common.h"
15 |
16 |
17 |
18 | #ifndef BINARY_SEMAPHORE_CLASS_INCLUDED
19 | #define BINARY_SEMAPHORE_CLASS_INCLUDED
20 |
21 | #include "MutexLock.h"
22 |
23 | /**
24 | * Binary semaphore class. Semaphore starts out with a value of 0.
25 | *
26 | * Note: Implementation for the functions defined here is provided
27 | * separately for each platform (in the mac/ linux/ and win32/
28 | * subdirectories).
29 | *
30 | * @author Jason Rohrer
31 | */
32 | class BinarySemaphore {
33 |
34 | public:
35 |
36 | /**
37 | * Constructs a binary semaphore.
38 | */
39 | BinarySemaphore();
40 |
41 | ~BinarySemaphore();
42 |
43 |
44 | /**
45 | * Blocks on this semaphore until signal() is called by another thread.
46 | * Note that if signal() has already been called before wait() is
47 | * called, then this call will return immediately, though the semaphore
48 | * is reset to 0 by this call.
49 | *
50 | * @param inTimeoutInMilliseconds the maximum time to wait in
51 | * milliseconds, or -1 to wait forever. Defaults to -1.
52 | *
53 | * @return 1 if the semaphore was signaled, or 0 if it timed out.
54 | */
55 | int wait( int inTimeoutInMilliseconds = -1 );
56 |
57 |
58 | /**
59 | * Signals the semaphore, allowing a waiting thread to return from
60 | * its call to wait(). (The semaphore is set to 1 by this call if
61 | * no thread is waiting on the semaphore currently.)
62 | */
63 | void signal();
64 |
65 |
66 | private:
67 |
68 | // starts at 0
69 | int mSemaphoreValue;
70 |
71 | /**
72 | * Used by platform-specific implementations.
73 | */
74 | void *mNativeObjectPointerA;
75 | void *mNativeObjectPointerB;
76 | };
77 |
78 |
79 | #endif
80 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/system/FinishedSignalThread.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2002-March-9 Jason Rohrer
5 | * Created.
6 | *
7 | * 2002-March-11 Jason Rohrer
8 | * Changed so that destructor joins thread.
9 | *
10 | * 2002-April-4 Jason Rohrer
11 | * Changed name of lock to avoid confusion with subclass-provided locks.
12 | *
13 | * 2002-August-5 Jason Rohrer
14 | * Fixed member initialization order to match declaration order.
15 | *
16 | * 2004-April-1 Jason Rohrer
17 | * Moved from konspire2b into minorGems.
18 | * Changed so that destructor does not join the thread.
19 | */
20 |
21 |
22 |
23 | #include "FinishedSignalThread.h"
24 |
25 |
26 | #include
27 |
28 |
29 |
30 | FinishedSignalThread::FinishedSignalThread()
31 | : mFinishedLock( new MutexLock() ), mFinished( false ) {
32 |
33 | }
34 |
35 |
36 |
37 | FinishedSignalThread::~FinishedSignalThread() {
38 |
39 | delete mFinishedLock;
40 | }
41 |
42 |
43 |
44 | char FinishedSignalThread::isFinished() {
45 | mFinishedLock->lock();
46 | char finished = mFinished;
47 | mFinishedLock->unlock();
48 |
49 | return finished;
50 | }
51 |
52 |
53 |
54 | void FinishedSignalThread::setFinished() {
55 | mFinishedLock->lock();
56 | mFinished = true;
57 | mFinishedLock->unlock();
58 | }
59 |
60 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/system/FinishedSignalThread.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2002-March-9 Jason Rohrer
5 | * Created.
6 | *
7 | * 2002-March-10 Jason Rohrer
8 | * Made destructor public.
9 | *
10 | * 2002-March-11 Jason Rohrer
11 | * Changed so that destructor joins thread.
12 | *
13 | * 2002-April-4 Jason Rohrer
14 | * Changed name of lock to avoid confusion with subclass-provided locks.
15 | *
16 | * 2004-April-1 Jason Rohrer
17 | * Moved from konspire2b into minorGems.
18 | * Changed so that destructor does not join the thread.
19 | *
20 | * 2004-November-19 Jason Rohrer
21 | * Changed to virtual inheritance from Thread class.
22 | */
23 |
24 |
25 |
26 | #ifndef FINISHED_SIGNAL_THREAD_INCLUDED
27 | #define FINISHED_SIGNAL_THREAD_INCLUDED
28 |
29 |
30 |
31 | #include "minorGems/system/Thread.h"
32 | #include "minorGems/system/MutexLock.h"
33 |
34 |
35 |
36 | /**
37 | * Abstract subclass if thread that has a
38 | * synchronized finished signal.
39 | *
40 | * @author Jason Rohrer
41 | */
42 | class FinishedSignalThread : public virtual Thread {
43 |
44 |
45 |
46 | public:
47 |
48 |
49 | /**
50 | * Only destroys this thread.
51 | * Does not join.
52 | */
53 | virtual ~FinishedSignalThread();
54 |
55 |
56 |
57 | /**
58 | * Gets whether this thread is finished and
59 | * ready to be destroyed.
60 | *
61 | * @return true iff this thread is finished.
62 | */
63 | char isFinished();
64 |
65 |
66 |
67 |
68 |
69 | protected:
70 |
71 |
72 |
73 | FinishedSignalThread();
74 |
75 |
76 |
77 | /**
78 | * Sets that this thread is finished and
79 | * ready to be destroyed.
80 | *
81 | * For this class to work properly, the subclass
82 | * MUST call this function at the end of its run method.
83 | */
84 | void setFinished();
85 |
86 |
87 |
88 | private:
89 |
90 | MutexLock *mFinishedLock;
91 |
92 | char mFinished;
93 |
94 |
95 |
96 | };
97 |
98 |
99 |
100 | #endif
101 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/system/FinishedSignalThreadManager.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2004-November-9 Jason Rohrer
5 | * Created.
6 | * Modified from MUTE's ChannelReceivingThreadManager.
7 | *
8 | * 2005-January-9 Jason Rohrer
9 | * Changed to sleep on a semaphore to allow sleep to be interrupted.
10 | */
11 |
12 |
13 |
14 | #ifndef FINISHED_SIGNAL_THREAD_MANAGER_INCLUDED
15 | #define FINISHED_SIGNAL_THREAD_MANAGER_INCLUDED
16 |
17 |
18 |
19 | #include "minorGems/system/FinishedSignalThread.h"
20 |
21 | #include "minorGems/util/SimpleVector.h"
22 | #include "minorGems/system/Thread.h"
23 | #include "minorGems/system/MutexLock.h"
24 | #include "minorGems/system/BinarySemaphore.h"
25 |
26 |
27 |
28 | /**
29 | * A thread that manages the destruction of FinishedSignalThreads.
30 | *
31 | * @author Jason Rohrer.
32 | */
33 | class FinishedSignalThreadManager : public Thread {
34 |
35 |
36 |
37 | public:
38 |
39 | /**
40 | * Constructs and starts this manager.
41 | */
42 | FinishedSignalThreadManager();
43 |
44 |
45 |
46 | /**
47 | * Stops and destroys this manager.
48 | */
49 | ~FinishedSignalThreadManager();
50 |
51 |
52 |
53 | /**
54 | * Adds a thread to this manager.
55 | *
56 | * @param inThread the thread to add.
57 | * Will be destroyed by this class.
58 | */
59 | void addThread( FinishedSignalThread *inThread );
60 |
61 |
62 |
63 | // implements the Thread interface
64 | void run();
65 |
66 |
67 |
68 | protected:
69 | MutexLock *mLock;
70 |
71 | SimpleVector *mThreadVector;
72 |
73 | char mStopSignal;
74 |
75 | BinarySemaphore *mSleepSemaphore;
76 |
77 | };
78 |
79 |
80 |
81 |
82 | #endif
83 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/system/Launcher.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2003-January-10 Jason Rohrer
5 | * Created.
6 | */
7 |
8 |
9 |
10 | #include "minorGems/common.h"
11 |
12 |
13 |
14 | #ifndef LAUNCHER_INCLUDED
15 | #define LAUNCHER_INCLUDED
16 |
17 |
18 |
19 | /**
20 | * Interface for launching processes.
21 | *
22 | * @author Jason Rohrer
23 | */
24 | class Launcher {
25 | public:
26 |
27 |
28 |
29 | /**
30 | * Launches a command in a new process.
31 | *
32 | * @param inCommandName the name of the command to launch.
33 | * Must be destroyed by caller if non-const.
34 | * @param inArguments an array of argument strings for the command.
35 | * This array must be terminated by a NULL pointer.
36 | * Note that by convention, the first argument should be the
37 | * command name.
38 | * Must be destroyed by caller.
39 | */
40 | static void launchCommand( char *inCommandName,
41 | char **inArguments );
42 |
43 |
44 |
45 | };
46 |
47 |
48 |
49 | #endif
50 |
51 |
52 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/system/MutexLock.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2000-December-13 Jason Rohrer
5 | * Created.
6 | *
7 | * 2002-March-29 Jason Rohrer
8 | * Added Fortify inclusion.
9 | *
10 | * 2002-October-18 Jason Rohrer
11 | * Moved common include out of header and into platform-specific cpp files,
12 | * since MemoryTrack uses a mutex lock.
13 | */
14 |
15 |
16 |
17 | #ifndef MUTEX_LOCK_CLASS_INCLUDED
18 | #define MUTEX_LOCK_CLASS_INCLUDED
19 |
20 |
21 |
22 | #ifdef FORTIFY
23 | #include "minorGems/util/development/fortify/fortify.h"
24 | #endif
25 |
26 |
27 |
28 | /**
29 | * Mutex lock class.
30 | *
31 | * Note: Implementation for the functions defined here is provided
32 | * separately for each platform (in the mac/ linux/ and win32/
33 | * subdirectories).
34 | *
35 | * @author Jason Rohrer
36 | */
37 | class MutexLock {
38 |
39 | public:
40 |
41 | /**
42 | * Constructs a mutex lock;
43 | */
44 | MutexLock();
45 |
46 | ~MutexLock();
47 |
48 |
49 | /**
50 | * Locks the mutex. Blocks until mutex available if it's
51 | * already locked by another thread.
52 | */
53 | void lock();
54 |
55 | /**
56 | * Unlocks the mutex.
57 | */
58 | void unlock();
59 |
60 |
61 | private:
62 |
63 | /**
64 | * Used by platform-specific implementations.
65 | */
66 | void *mNativeObjectPointer;
67 |
68 | };
69 |
70 |
71 | #endif
72 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/system/StopSignalThread.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2002-April-4 Jason Rohrer
5 | * Created.
6 | * Changed to reflect the fact that the base class
7 | * destructor is called *after* the derived class destructor.
8 | *
9 | * 2002-August-5 Jason Rohrer
10 | * Fixed member initialization order to match declaration order.
11 | *
12 | * 2003-September-5 Jason Rohrer
13 | * Moved into minorGems.
14 | *
15 | * 2005-January-9 Jason Rohrer
16 | * Changed to sleep on a semaphore to make sleep interruptable by stop.
17 | */
18 |
19 |
20 |
21 | #include "StopSignalThread.h"
22 |
23 |
24 |
25 | StopSignalThread::StopSignalThread()
26 | : mStopLock( new MutexLock() ), mStopped( false ),
27 | mSleepSemaphore( new BinarySemaphore() ) {
28 |
29 | }
30 |
31 |
32 |
33 | StopSignalThread::~StopSignalThread() {
34 |
35 | delete mStopLock;
36 | delete mSleepSemaphore;
37 | }
38 |
39 |
40 |
41 | void StopSignalThread::sleep( unsigned long inTimeInMilliseconds ) {
42 | mSleepSemaphore->wait( inTimeInMilliseconds );
43 | }
44 |
45 |
46 |
47 | char StopSignalThread::isStopped() {
48 | mStopLock->lock();
49 | char stoped = mStopped;
50 | mStopLock->unlock();
51 |
52 | return stoped;
53 | }
54 |
55 |
56 |
57 | void StopSignalThread::stop() {
58 | mStopLock->lock();
59 | mStopped = true;
60 | mStopLock->unlock();
61 |
62 | // signal the semaphore to wake up the thread, if it is sleeping
63 | mSleepSemaphore->signal();
64 | }
65 |
66 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/system/StopSignalThread.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2002-April-4 Jason Rohrer
5 | * Created.
6 | * Changed to reflect the fact that the base class
7 | * destructor is called *after* the derived class destructor.
8 | *
9 | * 2003-September-5 Jason Rohrer
10 | * Moved into minorGems.
11 | *
12 | * 2004-November-19 Jason Rohrer
13 | * Changed to virtual inheritance from Thread class.
14 | *
15 | * 2005-January-9 Jason Rohrer
16 | * Changed to sleep on a semaphore to make sleep interruptable by stop.
17 | */
18 |
19 |
20 |
21 | #ifndef STOP_SIGNAL_THREAD_INCLUDED
22 | #define STOP_SIGNAL_THREAD_INCLUDED
23 |
24 |
25 |
26 | #include "minorGems/system/Thread.h"
27 | #include "minorGems/system/MutexLock.h"
28 | #include "minorGems/system/BinarySemaphore.h"
29 |
30 |
31 |
32 | /**
33 | * Abstract subclass of thread that has a stop signal.
34 | *
35 | * Note that subclasses MUST check the isStopped() function
36 | * periodically in their run() function for this class to work
37 | * properly.
38 | *
39 | * @author Jason Rohrer
40 | */
41 | class StopSignalThread : public virtual Thread {
42 |
43 |
44 |
45 | public:
46 |
47 |
48 |
49 | /**
50 | * Only destroys this thread.
51 | * Does not stop or join.
52 | */
53 | virtual ~StopSignalThread();
54 |
55 |
56 |
57 | protected:
58 |
59 |
60 |
61 | StopSignalThread();
62 |
63 |
64 |
65 | // overrides Thread::sleep to make it interruptable by our stop call
66 | virtual void sleep( unsigned long inTimeInMilliseconds );
67 |
68 |
69 |
70 | /**
71 | * Signals this thread to stop, interrupting it if it is sleeping.
72 | *
73 | * Thread safe.
74 | *
75 | * Thread must be joined after this call returns.
76 | */
77 | void stop();
78 |
79 |
80 |
81 | /**
82 | * Gets whether this thread has been signaled to stop.
83 | *
84 | * Thread safe.
85 | *
86 | * @return true if this thread should stop.
87 | */
88 | char isStopped();
89 |
90 |
91 |
92 | private:
93 |
94 | MutexLock *mStopLock;
95 | char mStopped;
96 |
97 | BinarySemaphore *mSleepSemaphore;
98 |
99 |
100 | };
101 |
102 |
103 |
104 | #endif
105 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/system/TestThread.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2000-December-13 Jason Rohrer
5 | * Created.
6 | *
7 | * 2002-November-14 Jason Rohrer
8 | * Added more verbose printouts.
9 | *
10 | * 2004-March-31 Jason Rohrer
11 | * Added test of detached threads.
12 | */
13 |
14 | #include "TestThread.h"
15 |
16 | int numToCount = 1000;
17 |
18 |
19 | /**
20 | * Main method that spawns two TestThreads.
21 | *
22 | * @author Jason Rohrer
23 | */
24 | int main() {
25 |
26 | TestThread *thread1 = new TestThread( 1, numToCount );
27 | TestThread *thread2 = new TestThread( 2, numToCount );
28 | TestThread *thread3 = new TestThread( 3, numToCount );
29 |
30 |
31 | ThreadSafePrinter::printf( "Starting thread 1\n" );
32 | thread1->start();
33 | ThreadSafePrinter::printf( "Starting thread 2\n" );
34 | thread2->start();
35 | ThreadSafePrinter::printf( "Starting thread 3 in detached mode\n" );
36 | thread3->start( true );
37 |
38 | Thread::sleep( 5000 );
39 |
40 | ThreadSafePrinter::printf( "Joining thread 1\n" );
41 | thread1->join();
42 | ThreadSafePrinter::printf( "Joining thread 2\n" );
43 | thread2->join();
44 |
45 | ThreadSafePrinter::printf( "Destroying thread 1\n" );
46 | delete thread1;
47 | ThreadSafePrinter::printf( "Destroying thread 2\n" );
48 | delete thread2;
49 |
50 | ThreadSafePrinter::printf(
51 | "Thread 3 should handle its own destruction.\n" );
52 |
53 | return 0;
54 | }
55 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/system/TestThread.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2000-December-13 Jason Rohrer
5 | * Created.
6 | *
7 | * 2001-January-27 Jason Rohrer
8 | * Switched to a ThreadSafePrinter in attempt to get it to work on Win32.
9 | * Changed print call to printf.
10 | *
11 | * 2002-November-14 Jason Rohrer
12 | * Added missing destructor.
13 | */
14 |
15 | #include "minorGems/common.h"
16 |
17 |
18 |
19 | #ifndef TEST_THREAD_CLASS_INCLUDED
20 | #define TEST_THREAD_CLASS_INCLUDED
21 |
22 | #include "Thread.h"
23 |
24 | #include "ThreadSafePrinter.h"
25 |
26 | #include
27 |
28 | /**
29 | * Test subclass of Thread class. Useful for testing if platform-specific
30 | * thread implmentations are working.
31 | *
32 | * @author Jason Rohrer
33 | */
34 | class TestThread : public Thread {
35 |
36 | public:
37 | /**
38 | * Constructs a test thread and tells it how high to count to.
39 | *
40 | * @param inID id number thread will print along with count.
41 | * @param inNumToCount thread will count from 0 to this number.
42 | */
43 | TestThread( int inID, int inNumToCount );
44 |
45 | ~TestThread();
46 |
47 | // override the run method from PThread
48 | void run();
49 |
50 | private:
51 | int mID;
52 | int mNumToCount;
53 |
54 | };
55 |
56 |
57 |
58 | inline TestThread::TestThread( int inID, int inNumToCount )
59 | : mID( inID ), mNumToCount( inNumToCount ) {
60 |
61 | }
62 |
63 |
64 |
65 | inline TestThread::~TestThread() {
66 |
67 | }
68 |
69 |
70 |
71 | inline void TestThread::run() {
72 | for( int i=0; i<=mNumToCount; i++ ) {
73 | ThreadSafePrinter::printf( "Thread %d counting %d.\n", mID, i );
74 | }
75 | }
76 |
77 | #endif
78 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/system/ThreadSafePrinter.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2000-October-14 Jason Rohrer
5 | * Created.
6 | *
7 | * 2001-January-27 Jason Rohrer
8 | * Converted to use MutexLock and added to minorGems source tree.
9 | * Changed tprintf to be static (the mutexes don't work otherwise).
10 | * Now we're closing the argument list.
11 | * Fixed so that it works with any number of arguments.
12 | * Changed name of print function to printf.
13 | *
14 | * 2004-March-31 Jason Rohrer
15 | * Fixed static memory leak.
16 | */
17 |
18 | #include "minorGems/common.h"
19 |
20 |
21 |
22 | #ifndef THREAD_SAFE_PRINTER_INCLUDED
23 | #define THREAD_SAFE_PRINTER_INCLUDED
24 |
25 | #include "MutexLock.h"
26 | #include
27 |
28 | // for variable argument lists
29 | #include
30 |
31 | /**
32 | * Thread safe printf function. Note that printf is actually thread safe
33 | * anyway, so this is just to demonstrate and test locks. It seems as
34 | * though printf _isn't_ thread safe on certain platforms, so this class
35 | * may be useful.
36 | *
37 | * @author Jason Rohrer
38 | */
39 | class ThreadSafePrinter {
40 |
41 | public:
42 |
43 | static int printf( const char* inFormatString, ... );
44 |
45 | private:
46 | static MutexLock sLock;
47 |
48 | };
49 |
50 | // initialize static members
51 | MutexLock ThreadSafePrinter::sLock;
52 |
53 | inline int ThreadSafePrinter::printf( const char*inFormatString, ... ) {
54 |
55 | va_list argList;
56 | va_start( argList, inFormatString );
57 |
58 | sLock.lock();
59 |
60 | int returnVal = vprintf( inFormatString, argList );
61 | fflush( stdout );
62 |
63 | sLock.unlock();
64 |
65 | va_end( argList );
66 |
67 | return returnVal;
68 | }
69 |
70 |
71 | #endif
72 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/system/endian.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2002-May-25 Jason Rohrer
5 | * Created.
6 | *
7 | * 2004-January-12 Jason Rohrer
8 | * Added support for metrowerks win32 compiler.
9 | *
10 | * 2009-April-3 Jason Rohrer
11 | * OpenBSD support.
12 | */
13 |
14 | #include "minorGems/common.h"
15 |
16 |
17 |
18 | /**
19 | * Include this file to define __BYTE_ORDER
20 | *
21 | * After this has been included, __BYTE_ORDER will be either
22 | * __LITTLE_ENDIAN or
23 | * __BIG_ENDIAN
24 | */
25 |
26 |
27 |
28 | #ifdef __FreeBSD__
29 | #include
30 |
31 |
32 | #elif defined(__NetBSD__)
33 | #include
34 |
35 |
36 | #elif defined(__OpenBSD__)
37 | #include
38 | #include
39 |
40 |
41 | // default BSD case
42 | #elif defined(BSD)
43 | #include
44 |
45 |
46 |
47 | #elif defined(SOLARIS)
48 | // Code for Solaris defs adapted from:
49 | // MD5 message-digest algorithm.
50 | // by Colin Plumb in 1993, no copyright is claimed.
51 |
52 | //each solaris is different -- this won't work on 2.6 or 2.7
53 | # include
54 |
55 | #define __LITTLE_ENDIAN 1234
56 | #define __BIG_ENDIAN 4321
57 |
58 | #ifdef _LITTLE_ENDIAN
59 | #define __BYTE_ORDER __LITTLE_ENDIAN
60 |
61 | #else // default to big endian
62 | #define __BYTE_ORDER __BIG_ENDIAN
63 | #endif
64 |
65 | // end solaris case
66 |
67 |
68 |
69 | #elif defined(WIN_32) || \
70 | ( defined(__MWERKS__) && defined(__INTEL__) ) // windows case
71 | #define __LITTLE_ENDIAN 1234
72 | #define __BYTE_ORDER __LITTLE_ENDIAN
73 |
74 | // end windows case
75 |
76 |
77 |
78 | #else
79 | // linux case
80 | #include
81 |
82 | // end linux case
83 |
84 |
85 |
86 | #endif
87 | // end of all system-specific cases
88 |
89 |
90 |
91 |
92 |
93 | // BSD calls it BYTE_ORDER, linux calls it __BYTE_ORDER
94 | #ifndef __BYTE_ORDER
95 | #define __BYTE_ORDER BYTE_ORDER
96 | #endif
97 |
98 | #ifndef __LITTLE_ENDIAN
99 | #define __LITTLE_ENDIAN LITTLE_ENDIAN
100 | #endif
101 |
102 | #ifndef __BIG_ENDIAN
103 | #define __BIG_ENDIAN BIG_ENDIAN
104 | #endif
105 |
106 |
107 |
108 |
109 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/system/linux/MutexLockLinux.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2000-December-13 Jason Rohrer
5 | * Created.
6 | *
7 | * 2002-October-18 Jason Rohrer
8 | * Moved common include out of header and into platform-specific cpp files,
9 | * since MemoryTrack uses a mutex lock.
10 | * Changed to use malloc instead of new internally to work with debugMemory.
11 | * Made use of mNativeObjectPointer a bit cleaner.
12 | */
13 |
14 | #include "minorGems/common.h"
15 |
16 |
17 |
18 | #include
19 | #include
20 | #include
21 |
22 | /**
23 | * Linux-specific implementation of the MutexLock class member functions.
24 | *
25 | * May also be compatible with other POSIX-like systems.
26 | *
27 | * To compile:
28 | * g++ -lpthread
29 | */
30 |
31 |
32 | MutexLock::MutexLock() {
33 | // allocate a mutex structure on the heap
34 | mNativeObjectPointer = malloc( sizeof( pthread_mutex_t ) );
35 |
36 | // get a pointer to the mutex
37 | pthread_mutex_t *mutexPointer =
38 | (pthread_mutex_t *)mNativeObjectPointer;
39 |
40 | // init the mutex
41 | pthread_mutex_init( mutexPointer, NULL );
42 | }
43 |
44 |
45 |
46 | MutexLock::~MutexLock() {
47 | // get a pointer to the mutex
48 | pthread_mutex_t *mutexPointer =
49 | (pthread_mutex_t *)mNativeObjectPointer;
50 |
51 | // destroy the mutex
52 | pthread_mutex_destroy( mutexPointer );
53 |
54 | // de-allocate the mutex structure from the heap
55 | free( mNativeObjectPointer );
56 | }
57 |
58 |
59 |
60 | void MutexLock::lock() {
61 | // get a pointer to the mutex
62 | pthread_mutex_t *mutexPointer =
63 | (pthread_mutex_t *)mNativeObjectPointer;
64 |
65 | pthread_mutex_lock( mutexPointer );
66 | }
67 |
68 |
69 |
70 | void MutexLock::unlock() {
71 | // get a pointer to the mutex
72 | pthread_mutex_t *mutexPointer =
73 | (pthread_mutex_t *)mNativeObjectPointer;
74 |
75 | pthread_mutex_unlock( mutexPointer );
76 | }
77 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/system/unix/LauncherUnix.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2003-January-10 Jason Rohrer
5 | * Created.
6 | */
7 |
8 |
9 |
10 | #include "minorGems/system/Launcher.h"
11 |
12 | #include
13 | #include
14 |
15 |
16 | void Launcher::launchCommand( char *inCommandName,
17 | char **inArguments ) {
18 |
19 |
20 | int forkValue = fork();
21 |
22 | if( forkValue == 0 ) {
23 | // we're in child process, so exec command
24 |
25 | execvp( inCommandName, inArguments );
26 |
27 | // we'll never return from this call
28 | }
29 |
30 | }
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/system/unix/TimeUnix.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2001-October-29 Jason Rohrer
5 | * Created.
6 | *
7 | * 2002-March-13 Jason Rohrer
8 | * Added include of time.h so that FreeBSD compile will work.
9 | * Changed to use newer gettimeofday that should work on all unix platforms.
10 | * Fixed a conversion bug.
11 | */
12 |
13 |
14 | #include "minorGems/system/Time.h"
15 |
16 |
17 | #include
18 |
19 | #include
20 |
21 | #include
22 |
23 | #include
24 |
25 |
26 |
27 | void Time::getCurrentTime( unsigned long *outSeconds,
28 | unsigned long *outMilliseconds ) {
29 |
30 | struct timeval currentTime;
31 |
32 | gettimeofday( ¤tTime, NULL );
33 |
34 |
35 | *outMilliseconds = currentTime.tv_usec / 1000;
36 | *outSeconds = currentTime.tv_sec;
37 |
38 | }
39 |
40 |
41 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/system/win32/BinarySemaphoreWin32.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2001-January-27 Jason Rohrer
5 | * Created.
6 | *
7 | * 2001-March-4 Jason Rohrer
8 | * Replaced include of and with
9 | * to fix compile bugs encountered with newer windows compilers.
10 | *
11 | * 2003-August-26 Jason Rohrer
12 | * Added support for timeouts on wait.
13 | */
14 |
15 | #include "minorGems/system/BinarySemaphore.h"
16 |
17 | #include
18 |
19 |
20 | /**
21 | * Win32-specific implementation of the BinarySemaphore class member functions.
22 | */
23 |
24 |
25 | /**
26 | * Native object pointer A is the semaphore handle.
27 | * Pointer B is not used.
28 | */
29 |
30 |
31 | BinarySemaphore::BinarySemaphore() :
32 | mSemaphoreValue( 0 ) {
33 |
34 | // allocate a handle on the heap
35 | mNativeObjectPointerA = (void *)( new HANDLE[1] );
36 |
37 | // retrieve handle from the heap
38 | HANDLE *semaphorePointer = (HANDLE *)mNativeObjectPointerA;
39 |
40 |
41 | semaphorePointer[0] = CreateSemaphore(
42 | (LPSECURITY_ATTRIBUTES) NULL, // no attributes
43 | 0, // initial count
44 | 1, // maximum count
45 | (LPCTSTR) NULL ); // no name
46 |
47 | }
48 |
49 | BinarySemaphore::~BinarySemaphore() {
50 |
51 | // retrieve handle from the heap
52 | HANDLE *semaphorePointer = (HANDLE *)mNativeObjectPointerA;
53 |
54 | // destroy the semaphore
55 | CloseHandle( semaphorePointer[0] );
56 |
57 | // de-allocate the handle from the heap
58 | delete [] semaphorePointer;
59 | }
60 |
61 |
62 |
63 | int BinarySemaphore::wait( int inTimeoutInMilliseconds ) {
64 |
65 | // retrieve handle from the heap
66 | HANDLE *semaphorePointer = (HANDLE *)mNativeObjectPointerA;
67 |
68 | if( inTimeoutInMilliseconds == -1 ) {
69 | WaitForSingleObject( semaphorePointer[0], INFINITE );
70 | return 1;
71 | }
72 | else {
73 | // timeout
74 | int result = WaitForSingleObject( semaphorePointer[0],
75 | inTimeoutInMilliseconds );
76 |
77 | if( result == WAIT_TIMEOUT ) {
78 | return 0;
79 | }
80 | else {
81 | return 1;
82 | }
83 | }
84 | }
85 |
86 |
87 |
88 | void BinarySemaphore::signal() {
89 |
90 | // retrieve handle from the heap
91 | HANDLE *semaphorePointer = (HANDLE *)mNativeObjectPointerA;
92 |
93 | ReleaseSemaphore( semaphorePointer[0], 1, (LPLONG) NULL );
94 | }
95 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/system/win32/LauncherWin32.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2003-January-10 Jason Rohrer
5 | * Created.
6 | *
7 | * 2003-March-24 Jason Rohrer
8 | * Fixed a syntax typo.
9 | */
10 |
11 |
12 |
13 | #include "minorGems/system/Launcher.h"
14 |
15 | #include
16 | #include
17 |
18 |
19 |
20 | void Launcher::launchCommand( char *inCommandName,
21 | char **inArguments ) {
22 |
23 | _spawnvp( _P_NOWAIT,
24 | inCommandName,
25 | inArguments );
26 | }
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/system/win32/MutexLockWin32.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2001-January-27 Jason Rohrer
5 | * Created.
6 | *
7 | * 2001-March-4 Jason Rohrer
8 | * Replaced include of and with
9 | * to fix compile bugs encountered with newer windows compilers.
10 | *
11 | * 2002-October-18 Jason Rohrer
12 | * Moved common include out of header and into platform-specific cpp files,
13 | * since MemoryTrack uses a mutex lock.
14 | *
15 | * 2002-October-19 Jason Rohrer
16 | * Changed to use malloc instead of new internally to work with debugMemory.
17 | * Made use of mNativeObjectPointer a bit cleaner.
18 | * Fixed a few bugs with new use of mNativeObjectPointer.
19 | */
20 |
21 | #include "minorGems/common.h"
22 |
23 |
24 |
25 | #include "minorGems/system/MutexLock.h"
26 |
27 | #include
28 | #include
29 |
30 |
31 |
32 | /**
33 | * Win32-specific implementation of the MutexLock class member functions.
34 | */
35 |
36 |
37 | MutexLock::MutexLock() {
38 | // allocate a handle on the heap
39 | mNativeObjectPointer = malloc( sizeof( HANDLE ) );
40 |
41 | // retrieve handle from the heap
42 | HANDLE *mutexPointer = (HANDLE *)mNativeObjectPointer;
43 |
44 | // create the mutex
45 | *mutexPointer = CreateMutex(
46 | (LPSECURITY_ATTRIBUTES) NULL, // no attributes
47 | (BOOL) false, // not initially locked
48 | (LPCTSTR) NULL ); // no name
49 | }
50 |
51 |
52 |
53 | MutexLock::~MutexLock() {
54 | // retrieve handle from the heap
55 | HANDLE *mutexPointer = (HANDLE *)mNativeObjectPointer;
56 |
57 | // destroy the mutex
58 | CloseHandle( *mutexPointer );
59 |
60 | // de-allocate the mutex structure from the heap
61 | free( mutexPointer );
62 | }
63 |
64 |
65 |
66 | void MutexLock::lock() {
67 | // retrieve handle from the heap
68 | HANDLE *mutexPointer = (HANDLE *)mNativeObjectPointer;
69 |
70 | WaitForSingleObject( *mutexPointer, INFINITE );
71 | }
72 |
73 |
74 |
75 | void MutexLock::unlock() {
76 | // retrieve handle from the heap
77 | HANDLE *mutexPointer = (HANDLE *)mNativeObjectPointer;
78 |
79 | ReleaseMutex( *mutexPointer );
80 | }
81 |
82 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/ui/GUIComponent.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2001-September-15 Jason Rohrer
5 | * Created.
6 | */
7 |
8 |
9 | #ifndef GUI_COMPONENT_INCLUDED
10 | #define GUI_COMPONENT_INCLUDED
11 |
12 |
13 | #include "minorGems/ui/GUIComponent.h"
14 |
15 |
16 | /**
17 | * An generic superclass for all gui components.
18 | * Allows for easy event source determination during event passing.
19 | *
20 | * @author Jason Rohrer
21 | */
22 | class GUIComponent {
23 |
24 | };
25 |
26 |
27 |
28 | #endif
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/ui/Keyboard.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2000-December-7 Jason Rohrer
5 | * Created.
6 | *
7 | * 2000-December-8 Jason Rohrer
8 | * Changed so that key state functions take a string instead of
9 | * an integer vkey code.
10 | *
11 | * 2006-June-26 Jason Rohrer
12 | * Added function to get events that are waiting in the queue.
13 | */
14 |
15 | #ifndef KEYBOARD_INCLUDED
16 | #define KEYBOARD_INCLUDED
17 |
18 |
19 |
20 | /**
21 | * Interface for accessing keyboard input.
22 | *
23 | * Note:
24 | * Certain implementations may require a ScreenGraphics object to
25 | * be constructed before accessing the keyboard (i.e., to give the
26 | * keyboard input a context).
27 | */
28 | class Keyboard {
29 |
30 | public:
31 |
32 | /*
33 | * Key descriptions:
34 | *
35 | * For the standard ascii characters, pass in the string containing
36 | * the lower case character, for example, "a" for the character A.
37 | *
38 | * For other keys, the descriptors have not been defined yet.
39 | */
40 |
41 |
42 | /**
43 | * Gets whether a key is down.
44 | *
45 | * @param inKeyDescription string describing the queried key.
46 | *
47 | * @return true if key represented by given key code is down.
48 | */
49 | //char getKeyDown( int vKeyCode );
50 | char getKeyDown( const char *inKeyDescription );
51 |
52 |
53 | /**
54 | * Gets whether a key is up.
55 | *
56 | * @param inKeyDescription string describing the queried key.
57 | *
58 | * @return true if key represented by given key code is up.
59 | */
60 | //char getKeyUp( int vKeyCode );
61 | char getKeyUp( const char *inKeyDescription );
62 |
63 |
64 |
65 | /**
66 | * Gets the next keyboard event.
67 | *
68 | * @return the ASCII encoding of the pressed key, or -1 if no
69 | * keyboard events are waiting.
70 | */
71 | int getKeyPressedEvent();
72 |
73 |
74 | };
75 |
76 |
77 | #endif
78 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/ui/Mouse.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2000-November-28 Jason Rohrer
5 | * Created.
6 | */
7 |
8 | #ifndef MOUSE_INCLUDED
9 | #define MOUSE_INCLUDED
10 |
11 |
12 |
13 | /**
14 | * Interface for accessing mouse input.
15 | *
16 | * Note:
17 | * Certain implementations may require a ScreenGraphics object to
18 | * be constructed before accessing the mouse (i.e., to give the
19 | * mouse coordinates a context).
20 | */
21 | class Mouse {
22 |
23 | public:
24 |
25 |
26 | /**
27 | * Constructs a Mouse.
28 | *
29 | * @param inNumButtons the number of buttons on the mouse that should
30 | * be monitored. Default = 1.
31 | */
32 | Mouse( int inNumButtons );
33 |
34 | ~Mouse();
35 |
36 |
37 | /**
38 | * Gets the location of the mouse.
39 | *
40 | * @param outX pointer to location where x component will be returned.
41 | * @param outY pointer to location where y component will be returned.
42 | */
43 | void getLocation( int *outX, int *outY );
44 |
45 |
46 | /**
47 | * Gets whether the main mouse button is down.
48 | *
49 | * @return true if the main mouse button is down.
50 | */
51 | char isButtonDown();
52 |
53 |
54 | /**
55 | * Gets whether a specified mouse button is down.
56 | *
57 | * @param inButtonNumber the number of the button to check for
58 | * (0 is the main mouse button).
59 | *
60 | * @return true if the specified mouse button is down.
61 | */
62 | char isButtonDown( int inButtonNumber );
63 |
64 |
65 | private:
66 | int mXLocation;
67 | int mYLocation;
68 |
69 | int mNumButtons;
70 |
71 | // array of booleans that represent the current
72 | // (or last known) state of each button
73 | char *mButtonDown;
74 | };
75 |
76 |
77 |
78 | inline Mouse::Mouse( int inNumButtons = 1 )
79 | : mNumButtons( inNumButtons ),
80 | mButtonDown( new char[inNumButtons] ) {
81 |
82 | }
83 |
84 |
85 |
86 | inline Mouse::~Mouse() {
87 | delete [] mButtonDown;
88 | }
89 |
90 |
91 |
92 | inline char Mouse::isButtonDown() {
93 | return isButtonDown( 0 );
94 | }
95 |
96 |
97 | #endif
98 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/ui/Plot.h:
--------------------------------------------------------------------------------
1 | // Jason Rohrer
2 | // Plot.h
3 |
4 | /**
5 | *
6 | * Scrolling Plot Gui element
7 | *
8 | *
9 | * Created 11-7-99
10 | * Mods:
11 | * Jason Rohrer 11-8-99 Changed to use GraphicBuffer object as screen buffer
12 | *
13 | */
14 |
15 |
16 |
17 | #ifndef PLOT_INCLUDED
18 | #define PLOT_INCLUDED
19 |
20 |
21 | #include
22 | #include "Color.h"
23 | #include "GraphicBuffer.h"
24 |
25 | class Plot {
26 |
27 | public:
28 | // construct a plot in a specific location with
29 | // specific border, background, and line colors
30 | Plot( int x, int y, int w, int h, Color bordC, Color bC, Color lnC );
31 | ~Plot();
32 |
33 | // add a point to the right of plot, cause plot to scroll left
34 | void addPoint( float p );
35 |
36 | // draw plot into a graphic buffer
37 | void draw( GraphicBuffer &buff );
38 |
39 | // erase plot from buffer
40 | void erase( GraphicBuffer &buff, Color &bgColor );
41 |
42 | private:
43 |
44 | unsigned long *imageMap;
45 |
46 | int startX;
47 | int startY;
48 | int high;
49 | int wide;
50 |
51 | int innerHigh; // width and heigth of area inside borders
52 | int innerWide;
53 |
54 | int *mapYOffset;
55 |
56 | Color borderC; // color of border
57 | Color bgC; // color of progress bar max
58 |
59 | Color lineC; // color of plot line
60 |
61 |
62 |
63 | static const int borderWide = 2;
64 |
65 |
66 | float *plotVals; // values of plot line
67 |
68 | };
69 |
70 |
71 |
72 |
73 | inline void Plot::draw( GraphicBuffer &buff ) {
74 | buff.drawImage(imageMap, mapYOffset, startX, startY, wide, high);
75 | }
76 |
77 | inline void Plot::erase( GraphicBuffer &buff, Color &bgColor ) {
78 | buff.eraseImage(startX, startY, wide, high, bgColor);
79 | }
80 |
81 |
82 |
83 | #endif
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/ui/ProgressBar.h:
--------------------------------------------------------------------------------
1 | // Jason Rohrer
2 | // ProgressBar.h
3 |
4 | /**
5 | *
6 | * ProgressBar Gui element
7 | *
8 | *
9 | * Created 11-6-99
10 | * Mods:
11 | * Jason Rohrer 11-8-99 Changed to use GraphicBuffer object as screen buffer
12 | *
13 | */
14 |
15 |
16 |
17 | #ifndef PROGRESS_BAR_INCLUDED
18 | #define PROGRESS_BAR_INCLUDED
19 |
20 | #include "Color.h"
21 | #include "GraphicBuffer.h"
22 |
23 | class ProgressBar {
24 |
25 | public:
26 | // construct a progress bar in a specific location with
27 | // specific border and maximum colors
28 | ProgressBar( int x, int y, int w, int h, Color bordC, Color hC, Color tipC );
29 | ~ProgressBar();
30 |
31 | void setProgress( float fractionFull );
32 |
33 | // draw progress bar into a graphic buffer
34 | void draw( GraphicBuffer &buff );
35 |
36 | // erase progress bar from buffer
37 | void erase( GraphicBuffer &buff, Color &bgColor );
38 |
39 | private:
40 |
41 | unsigned long *imageMap;
42 |
43 | int startX;
44 | int startY;
45 | int high;
46 | int wide;
47 |
48 | int barHigh; // width and heigth of area inside borders
49 | int barWide;
50 |
51 | int *mapYOffset;
52 |
53 | Color borderC; // color of border
54 | Color highC; // color of progress bar max
55 |
56 | Color barTipC;
57 |
58 | static const int borderWide = 2;
59 |
60 | float lastProgress; // fraction of last progress
61 |
62 | };
63 |
64 |
65 |
66 | inline void ProgressBar::draw( GraphicBuffer &buff ) {
67 | buff.drawImage(imageMap, mapYOffset, startX, startY, wide, high);
68 | }
69 |
70 | inline void ProgressBar::erase( GraphicBuffer &buff, Color &bgColor ) {
71 | buff.eraseImage(startX, startY, wide, high, bgColor);
72 | }
73 |
74 |
75 | #endif
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/ui/SetMouse.h:
--------------------------------------------------------------------------------
1 | // Jason Rohrer
2 | // SetMouse.h
3 |
4 | /**
5 | *
6 | * Interface for force-setting mouse cursor position
7 | *
8 | * Created 1-14-2000
9 | * Mods:
10 | * Jason Rohrer 1-18-2000 Added capture and release mouse functions to help Win32
11 | */
12 |
13 | void SetMouse( int x, int y);
14 | void CaptureMouse();
15 | void ReleaseMouse();
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/ui/SetMouseMac.cpp:
--------------------------------------------------------------------------------
1 | // Jason Rohrer
2 | // SetMouseMac.cpp
3 |
4 | /**
5 | *
6 | * implementation of SetMouse on Mac
7 | * This uses a hack that may not be supported in later OSs (e.g., OSX)
8 | *
9 | * Created 1-14-2000
10 | * Mods:
11 | */
12 |
13 |
14 |
15 | #include
16 | #include "SetMouse.h"
17 |
18 | void SetMouse (int x, int y) {
19 | Point base;
20 | // This routine donated to MacMAME by John Stiles
21 | // Picked up for RadiosGL from the Mac GLQuake site
22 | Point *RawMouse = (Point*) 0x82C;
23 | Point *MTemp = (Point*) 0x828;
24 | Ptr CrsrNew = (Ptr) 0x8CE;
25 | Ptr CrsrCouple = (Ptr) 0x8CF;
26 |
27 | base.v = y;
28 | base.h = x;
29 | LocalToGlobal(&base);
30 |
31 | *RawMouse = base;
32 | *MTemp = base;
33 | *CrsrNew = *CrsrCouple;
34 | }
35 |
36 | // do nothing, these are needed in windows only
37 | void CaptureMouse() {
38 | }
39 | void ReleaseMouse() {
40 | }
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/ui/SetMouseWin32.cpp:
--------------------------------------------------------------------------------
1 | // Jason Rohrer
2 | // SetMouseWin32.cpp
3 |
4 | /**
5 | *
6 | * implementation of SetMouse on Win32
7 | * This uses an "official" os feature (unlike the hacked mac version
8 | *
9 | * Created 1-16-2000
10 | * Mods:
11 | * Jason Rohrer 1-18-2000 Added conversion from client to screen coords.
12 | * GLUT tracks mouse motion relative to window
13 | * Windows can only set the cursor position using
14 | * screen coordinates.
15 | */
16 |
17 |
18 |
19 | #include
20 |
21 | #include "SetMouse.h"
22 |
23 | char captured = false;
24 |
25 | void SetMouse( int x, int y ) {
26 |
27 | POINT p;
28 | p.x = x;
29 | p.y = y;
30 |
31 | HWND window = GetActiveWindow();
32 |
33 | ClientToScreen( window, &p );
34 |
35 | SetCursorPos( p.x, p.y );
36 |
37 | //SetCursorPos( x, y );
38 |
39 | }
40 |
41 |
42 | // send all mouse movements to our window, even those outside the border
43 | void CaptureMouse() {
44 | HWND window = GetActiveWindow();
45 | SetCapture( window );
46 | }
47 |
48 | void ReleaseMouse() {
49 | ReleaseCapture();
50 | }
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/ui/event/ActionListener.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2001-September-15 Jason Rohrer
5 | * Created.
6 | *
7 | * 2006-July-3 Jason Rohrer
8 | * Fixed warnings.
9 | */
10 |
11 |
12 | #ifndef ACTION_LISTENER_INCLUDED
13 | #define ACTION_LISTENER_INCLUDED
14 |
15 |
16 | #include "minorGems/ui/GUIComponent.h"
17 |
18 |
19 | /**
20 | * An interface for a class that can handle a GUI action.
21 | *
22 | * @author Jason Rohrer
23 | */
24 | class ActionListener {
25 |
26 |
27 | public:
28 |
29 |
30 | virtual ~ActionListener();
31 |
32 |
33 | /**
34 | * Tells this class that an action has been performed.
35 | *
36 | * @param inTarget the GUI component on which the action
37 | * is being performed.
38 | */
39 | virtual void actionPerformed( GUIComponent *inTarget ) = 0;
40 |
41 |
42 | };
43 |
44 |
45 |
46 | inline ActionListener::~ActionListener() {
47 | }
48 |
49 |
50 |
51 | #endif
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/ui/linux/MouseLinux.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2000-November-28 Jason Rohrer
5 | * Created.
6 | *
7 | * 2001-May-2 Jason Rohrer
8 | * Changed to use more standard SDL include location.
9 | */
10 |
11 | #include "minorGems/ui/Mouse.h"
12 |
13 | #include
14 |
15 | /**
16 | * Note: Linux implementation:
17 | * Requires that a ScreenGraphics be constructed before accessing the mouse.
18 | */
19 |
20 |
21 |
22 | void Mouse::getLocation( int *outX, int *outY ) {
23 | SDL_PumpEvents();
24 | SDL_GetMouseState( outX, outY );
25 | /*
26 | SDL_PumpEvents( void );
27 |
28 | int numEventsToGet = 99;
29 |
30 | SDL_Event *events = new SDL_Event[numEventsToGet];
31 |
32 | // get events from the queue
33 | int numEventsRetrieved = SDL_PeepEvents( events, numEventsToGet,
34 | SDL_GETEVENT, SDL_MOUSEMOTIONMASK );
35 |
36 | // for mouse motion, we only care about the last event
37 | SDL_Event lastEvent = events[ numEventsRetrieved - 1 ];
38 |
39 | delete [] events;
40 | */
41 | }
42 |
43 |
44 | char Mouse::isButtonDown( int inButtonNumber ) {
45 | SDL_PumpEvents();
46 |
47 | int x, y;
48 |
49 | Uint8 buttonState = SDL_GetMouseState( &x, &y );
50 |
51 | if( inButtonNumber == 0 ) {
52 | return( buttonState & SDL_BUTTON_LMASK );
53 | }
54 |
55 | if( mNumButtons >=3 ) {
56 | // if we care about 3 buttons, then count the middle button
57 | // as button 1
58 | if( inButtonNumber == 1 ) {
59 | return( buttonState & SDL_BUTTON_MMASK );
60 | }
61 | if( inButtonNumber == 2 ) {
62 | return( buttonState & SDL_BUTTON_RMASK );
63 | }
64 | }
65 | else {
66 | // we care about 2 or fewer buttons
67 | if( inButtonNumber == 1 ) {
68 | return( buttonState & SDL_BUTTON_RMASK );
69 | }
70 | }
71 |
72 | return false;
73 | }
74 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/util/StringBufferOutputStream.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2002-August-1 Jason Rohrer
5 | * Created.
6 | *
7 | * 2004-May-9 Jason Rohrer
8 | * Added function for getting data as a byte array.
9 | */
10 |
11 |
12 |
13 | #include "minorGems/util/StringBufferOutputStream.h"
14 |
15 |
16 |
17 | StringBufferOutputStream::StringBufferOutputStream()
18 | : mCharacterVector( new SimpleVector() ) {
19 |
20 | }
21 |
22 |
23 |
24 | StringBufferOutputStream::~StringBufferOutputStream() {
25 |
26 | delete mCharacterVector;
27 | }
28 |
29 |
30 |
31 | char *StringBufferOutputStream::getString() {
32 |
33 | int numChars = mCharacterVector->size();
34 |
35 | char *returnArray = new char[ numChars + 1 ];
36 |
37 | for( int i=0; igetElement( i ) ) );
39 | }
40 | returnArray[ numChars ] = '\0';
41 |
42 | return returnArray;
43 | }
44 |
45 |
46 |
47 | unsigned char *StringBufferOutputStream::getBytes( int *outNumBytes ) {
48 | *outNumBytes = mCharacterVector->size();
49 |
50 | return mCharacterVector->getElementArray();
51 | }
52 |
53 |
54 |
55 | long StringBufferOutputStream::write( unsigned char *inBuffer,
56 | long inNumBytes ) {
57 |
58 | for( int i=0; ipush_back( inBuffer[ i ] );
60 | }
61 |
62 | return inNumBytes;
63 | }
64 |
65 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/util/StringBufferOutputStream.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2002-August-1 Jason Rohrer
5 | * Created.
6 | *
7 | * 2004-May-9 Jason Rohrer
8 | * Added function for getting data as a byte array.
9 | */
10 |
11 | #include "minorGems/common.h"
12 |
13 |
14 |
15 | #ifndef STRING_BUFFER_OUTPUT_STREAM_INCLUDED
16 | #define STRING_BUFFER_OUTPUT_STREAM_INCLUDED
17 |
18 |
19 |
20 | #include "minorGems/util/SimpleVector.h"
21 | #include "minorGems/io/OutputStream.h"
22 |
23 |
24 |
25 | /**
26 | * An output stream that fills a string buffer.
27 | *
28 | * @author Jason Rohrer
29 | */
30 | class StringBufferOutputStream : public OutputStream {
31 |
32 |
33 |
34 | public:
35 |
36 |
37 |
38 | StringBufferOutputStream();
39 |
40 | ~StringBufferOutputStream();
41 |
42 |
43 |
44 | /**
45 | * Gets the data writen to this stream since construction as a
46 | * \0-terminated string.
47 | *
48 | * @return a string containing all data written to this stream.
49 | * Must be destroyed by caller.
50 | */
51 | char *getString();
52 |
53 |
54 |
55 | /**
56 | * Gets the data writen to this stream since construction as a
57 | * byte array.
58 | *
59 | * @param outNumBytes pointer to where the array length should be
60 | * returned.
61 | *
62 | * @return an array containingdata written to this stream.
63 | * Must be destroyed by caller.
64 | */
65 | unsigned char *getBytes( int *outNumBytes );
66 |
67 |
68 |
69 | // implements the OutputStream interface
70 | long write( unsigned char *inBuffer, long inNumBytes );
71 |
72 |
73 |
74 | protected:
75 |
76 |
77 |
78 | SimpleVector *mCharacterVector;
79 |
80 |
81 |
82 | };
83 |
84 |
85 |
86 | #endif
87 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/util/development/fortify/FORTIFY.DOC:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toolness/passage-emscripten/3ee2abea4b0ed97a84ea4699a24fe3893ded54af/Passage_v4_UnixSource/minorGems/util/development/fortify/FORTIFY.DOC
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/util/development/fortify/Makefile:
--------------------------------------------------------------------------------
1 | #
2 | # Modification History
3 | #
4 | # 2002-March-29 Jason Rohrer
5 | # Added include path to make minorGems reachable.
6 | # Added pthread linking and debug compile flag.
7 | #
8 |
9 |
10 | #
11 | # GCC makefile for Fortify's test applications
12 | # Disable -DFORTIFY to compile without Fortify
13 | #
14 | # To build both of the testers, it should simply be
15 | # a matter of
16 | #
17 | # make all
18 | #
19 | #
20 |
21 | .SUFFIXES: .cxx .cpp
22 |
23 | CC = g++
24 | CCFLAGS = -g -Wall -DFORTIFY -Wformat -pedantic -I../../../..
25 | LN = g++
26 | LNFLAGS = -lpthread #-lm #-liostream
27 |
28 | .c.o:
29 | @echo ---- $*.c ----
30 | @$(CC) -c $(CCFLAGS) $*.c
31 |
32 | .cpp.o:
33 | @echo ---- $*.cpp ----
34 | @$(CC) -c $(CCFLAGS) $*.cpp
35 |
36 | #.cpp.o:
37 | # @echo ---- $*.cpp ----
38 | # @$(CC) -c $(CCFLAGS) $*.cpp
39 |
40 | all: test test2 test3
41 |
42 |
43 |
44 |
45 |
46 | OBJS= test.o fortify.o
47 | test: $(OBJS)
48 | @echo Linking test
49 | @$(LN) -o test $(OBJS) $(CCFLAGS) $(LNFLAGS)
50 |
51 | OBJS2 = test2.o fortify.o
52 | test2: $(OBJS2)
53 | @echo Linking test2
54 | @$(LN) -o test2 $(OBJS2) $(CCFLAGS) $(LNFLAGS)
55 |
56 | OBJS3 = test3.o fortify.o
57 | test3: $(OBJS3)
58 | @echo Linking test3
59 | @$(LN) -o test3 $(OBJS3) $(CCFLAGS) $(LNFLAGS)
60 |
61 |
62 | clean:
63 | rm -f test test2 test3 $(OBJS) $(OBJS2) $(OBJS3)
64 |
65 |
66 |
67 | fortify.o: fortify.cpp fortify.h ufortify.h
68 |
69 | test.o: test.c fortify.h ufortify.h
70 |
71 | test2.o: test2.cpp fortify.h ufortify.h
72 |
73 | test3.o: test3.cpp fortify.h ufortify.h
74 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/util/development/fortify/test.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "fortify.h"
4 |
5 | /*
6 | * NOTE: The Fortify routines will compile away to nothing
7 | * if FORTIFY isn't defined in the makefile.
8 | *
9 | * DO NOT insert #define FORTIFY here. It Will Not Work.
10 | * All files (including fortify.cxx) need FORTIFY to be
11 | * defined. The correct place for this is the makefile.
12 | */
13 |
14 |
15 | int
16 | main(int argc, char **argv)
17 | {
18 | char *foo, *bar;
19 |
20 | Fortify_EnterScope();
21 |
22 | /* note that we never free this memory */
23 | foo = malloc(123);
24 |
25 | Fortify_LabelPointer(foo, "we never free this memory!");
26 |
27 | /* note that we read this memory after it's been freed */
28 | foo = malloc(124);
29 | *foo = 'X';
30 | free(foo);
31 | printf("Should be X: '%c'\n", *foo);
32 |
33 | /* note we've already freed this memory */
34 | free(foo);
35 |
36 | /* note we write to memory that's been realloc'd, using the old pointer */
37 | foo = malloc(125);
38 | bar = realloc(foo, 126);
39 | *foo = 'X';
40 | free(bar);
41 |
42 | /* note we write before the block */
43 | foo = malloc(127);
44 | Fortify_LabelPointer(foo, "we write before this block!");
45 | *(foo-1) = 'Z';
46 | free(foo);
47 |
48 | /* note we write after the block */
49 | bar = "I'm going to eat you little fishie!";
50 | foo = malloc(strlen(bar));
51 | strcpy(foo, bar);
52 | free(foo);
53 |
54 | /* we never allocated this memory */
55 | free(bar);
56 |
57 | Fortify_LeaveScope();
58 | Fortify_OutputStatistics();
59 |
60 | return 42;
61 | }
62 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/util/development/fortify/test2.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include "fortify.h"
5 |
6 | /*
7 | * NOTE: The Fortify routines will compile away to nothing
8 | * if FORTIFY isn't defined in the makefile.
9 | *
10 | * DO NOT insert #define FORTIFY here. It Will Not Work.
11 | * All files (including fortify.cxx) need FORTIFY to be
12 | * defined. The correct place for this is the makefile.
13 | */
14 |
15 | class A
16 | {
17 | public:
18 | ~A() { delete (char*)123; }
19 | };
20 |
21 | int
22 | main(int argc, char **argv)
23 | {
24 | char *foo;
25 |
26 | Fortify_EnterScope();
27 |
28 | /* zero size test */
29 | foo =(char*) malloc(0);
30 | printf("malloc(0) %s\n", foo ? "succeeded" : "failed");
31 |
32 | /* zero size test */
33 | foo = new char[0];
34 | printf("new char[0] %s\n", foo ? "succeeded" : "failed");
35 |
36 |
37 | foo = new char;
38 |
39 | /* note we use the incorrect deallocator */
40 | /* note this will only be detected if FORTIFY_PROVIDE_ARRAY_NEW
41 | * and FORTIFY_PROVIDE_ARRAY_DELETE are both turned on
42 | * (and your compiler supports them) */
43 | delete[] foo;
44 | *foo = 'Z';
45 |
46 | foo = new char;
47 | Fortify_LabelPointer(foo, "we use the wrong deallocator on this one");
48 |
49 | /* note we use the incorrect dealocator */
50 | free(foo);
51 |
52 | /* the destructor of this class does an illegal delete -
53 | * demonstrates the delete-stack
54 | */
55 | delete new A;
56 |
57 | Fortify_LeaveScope();
58 |
59 | return 1;
60 | }
61 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/util/development/fortify/test3.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include "fortify.h"
5 |
6 |
7 | int main() {
8 | //Fortify_EnterScope();
9 |
10 | int *a = new int[ 10 ];
11 |
12 | int i;
13 | for( i=0; i<10; i++ ) {
14 |
15 | a[i] = i;
16 |
17 | }
18 |
19 | for( i=0; i<10; i++ ) {
20 |
21 | printf( "a[i] = %d\n", a[i] );
22 |
23 | }
24 |
25 |
26 | delete [] a;
27 |
28 | for( i=0; i<10; i++ ) {
29 |
30 | printf( "a[i] = %d\n", a[i] );
31 |
32 | }
33 | //Fortify_CheckAllMemory();
34 |
35 | for( i=0; i<10; i++ ) {
36 |
37 | a[i] = i;
38 |
39 | }
40 | for( i=0; i<10; i++ ) {
41 |
42 | printf( "a[i] = %d\n", a[i] );
43 |
44 | }
45 |
46 | //Fortify_CheckAllMemory();
47 |
48 | int *b = new int[5];
49 |
50 | delete [] b;
51 |
52 | delete [] a;
53 |
54 | //Fortify_LeaveScope();
55 |
56 | return 0;
57 | }
58 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/util/development/leakTracer/LeakCheck:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | if [ $# -lt 1 ] ; then
3 | echo "Usage: $0 "
4 | exit 1
5 | fi
6 |
7 | # this looks in the same directory, this
8 | # LeakCheck script resides; modify to your
9 | # needs:
10 | SHLIB=`dirname $0`/LeakTracer.so
11 | if [ ! -x $SHLIB ] ; then
12 | echo "$SHLIB not found"
13 | exit 1
14 | fi
15 |
16 | if [ -z "$LEAKTRACE_FILE" ] ; then
17 | rm -f leak.out
18 | else
19 | rm -f "$LEAKTRACE_FILE"
20 | fi
21 | export LD_PRELOAD=$SHLIB
22 | exec $@
23 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/util/development/leakTracer/LeakCheckAnalyze:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | CHECKER=`dirname $0`/LeakCheck" $@"
4 | ANALYZER=`dirname $0`/leak-analyze" $1 leak.out"
5 |
6 | echo "Checking with: $CHECKER"
7 | echo ""
8 | $CHECKER
9 |
10 | echo ""
11 | echo "Analyzing with: $ANALYZER"
12 | echo ""
13 | $ANALYZER 2>&1 | more
14 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/util/development/leakTracer/Makefile:
--------------------------------------------------------------------------------
1 | #
2 | # Modification History
3 | #
4 | # 2004-January-16 Jason Rohrer
5 | # Switched to use minorGems platform-independed mutexes.
6 | #
7 |
8 |
9 | CC = g++
10 |
11 | # Source files
12 | SRC := LeakTracer.cc
13 |
14 | ROOT_PATH = ../../../..
15 |
16 | # Switch comment to select a platform
17 | # PLATFORM_MUTEX = $(ROOT_PATH)/minorGems/system/win32/MutexLockWin32.cpp
18 | PLATFORM_MUTEX = $(ROOT_PATH)/minorGems/system/linux/MutexLockLinux.cpp -pthread
19 |
20 | # Comment both of these out to disable thread safetly
21 | C_THREAD=-DTHREAD_SAVE -D_REENTRANT -D_THREAD_SAFE
22 | O_THREAD = $(PLATFORM_MUTEX)
23 |
24 |
25 | # Common flags
26 | C_FLAGS = -g -pipe -Wall -W -I$(ROOT_PATH) $(C_THREAD)
27 | O_FLAGS = $(C_FLAGS) $(O_THREAD)
28 |
29 | # Object files
30 | OBJ_DIR = .
31 | OBJ := $(patsubst %.cc,$(OBJ_DIR)/%.o,$(SRC))
32 | SHOBJ := $(patsubst %.o,$(OBJ_DIR)/%.so,$(OBJ))
33 |
34 | .PHONY: all clean tidy distrib test
35 |
36 | all: $(OBJ) $(SHOBJ)
37 |
38 | clean: tidy
39 | rm -f $(OBJ) leak.out
40 |
41 | tidy:
42 | rm -f *~ *orig *bak *rej
43 |
44 | tags: $(SRC) $(INCL)
45 | ctags $(SRC) $(INCL)
46 |
47 | distrib: clean all README.html
48 | (cd .. && tar cvfz /root/drylock/LeakTracer/LeakTracer.tar.gz --exclude LeakTracer/CVS --exclude LeakTracer/old --exclude LeakTracer/test LeakTracer/)
49 |
50 | $(OBJ_DIR)/%.o: %.cc
51 | $(CC) -fPIC -c $(C_FLAGS) $< -o $@
52 |
53 | $(OBJ_DIR)/%.so : $(OBJ_DIR)/%.o
54 | $(CC) $(O_FLAGS) -shared -o $@ $<
55 |
56 | README.html: README
57 | /root/ed/mcl/util/htmlize.pl README
58 |
59 | test:
60 | $(CC) $(C_FLAGS) test.cc -o test
61 | ./test
62 | ./LeakCheck ./test
63 | ./leak-analyze ./test
64 | # ./compare-test test.template test.result
65 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/util/development/leakTracer/VERSION:
--------------------------------------------------------------------------------
1 | 2.3
2 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/util/development/leakTracer/test.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2002-March-31 Jason Rohrer
5 | * Added test of strdup support.
6 | */
7 |
8 |
9 | #include
10 |
11 | // Small leaky test program
12 |
13 | void foo() {
14 | int *x = new int;
15 | }
16 |
17 | int main() {
18 | char *str = strdup( "Test String" );
19 |
20 | int *z = new int[10];
21 | foo();
22 | foo();
23 | delete z;
24 | delete z; // delete value twice
25 |
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/util/development/memory/compileTestDebugMemory:
--------------------------------------------------------------------------------
1 | g++ -Wall -g -DDEBUG_MEMORY -o testDebugMemory -I../../../.. debugMemory.cpp MemoryTrack.cpp testDebugMemory.cpp ../../../../minorGems/system/linux/MutexLockLinux.cpp
2 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/util/development/memory/testDebugMemory.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2002-October-17 Jason Rohrer
5 | * Created.
6 | *
7 | * 2002-October-18 Jason Rohrer
8 | * Added static initialization counting class for MemoryTrack.
9 | *
10 | * 2002-October-19 Jason Rohrer
11 | * Removed call to debugMemoryPrintLeaksAndStopTracking.
12 | * Made test cases more interesting.
13 | * Added test cases for deleting NULL pointers.
14 | */
15 |
16 |
17 | #include "minorGems/util/development/memory/debugMemory.h"
18 |
19 |
20 | #include
21 |
22 |
23 | class TestClass {
24 | public:
25 | TestClass() {
26 | mX = new int[5];
27 | }
28 |
29 | ~TestClass() {
30 | delete [] mX;
31 | }
32 |
33 | int *mX;
34 | };
35 |
36 |
37 |
38 | int main() {
39 |
40 | int *x = new int[5];
41 |
42 | printf( "array contents before initializing elements:\n"
43 | "%d, %d, %d, %d, %d\n\n",
44 | x[0], x[1], x[2], x[3], x[4] );
45 |
46 | x[0] = 1;
47 | x[1] = 2;
48 | x[2] = 3;
49 | x[3] = 4;
50 | x[4] = 5;
51 |
52 | printf( "array contents before deleting:\n"
53 | "%d, %d, %d, %d, %d\n\n",
54 | x[0], x[1], x[2], x[3], x[4] );
55 |
56 | delete [] x;
57 |
58 | printf( "array contents after deleting:\n"
59 | "%d, %d, %d, %d, %d\n\n",
60 | x[0], x[1], x[2], x[3], x[4] );
61 |
62 |
63 | int *y = new int[4];
64 | y[0] = 1;
65 |
66 | TestClass *t = new TestClass();
67 |
68 | delete t;
69 |
70 | int *z = new int[7];
71 | delete z;
72 |
73 | //delete t;
74 |
75 | int *badPointer = NULL;
76 | delete badPointer;
77 |
78 | int *badPointer2 = NULL;
79 | delete [] badPointer2;
80 |
81 | return 0;
82 | }
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/util/log/FileLog.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2002-February-25 Jason Rohrer
5 | * Created.
6 | *
7 | * 2002-November-5 Jason Rohrer
8 | * Added support for backing up logs and deleting old log data.
9 | *
10 | * 2010-May-14 Jason Rohrer
11 | * String parameters as const to fix warnings.
12 | */
13 |
14 |
15 | #include "minorGems/common.h"
16 |
17 |
18 |
19 | #ifndef FILE_LOG_INCLUDED
20 | #define FILE_LOG_INCLUDED
21 |
22 |
23 |
24 | #include "PrintLog.h"
25 |
26 | #include
27 |
28 |
29 | /**
30 | * A file-based implementation of the Log interface.
31 | *
32 | * @author Jason Rohrer
33 | */
34 | class FileLog : public PrintLog {
35 |
36 |
37 |
38 | public:
39 |
40 |
41 |
42 | /**
43 | * Constructs a file log.
44 | *
45 | * @param inFileName the name of the file to write log messages to.
46 | * Must be destroyed by caller.
47 | * @param inSecondsBetweenBackups the number of seconds to wait
48 | * before making a backup of the current log file (deleting any
49 | * old backups), clearing the current log file, and starting
50 | * a fresh log in the current log file. Defaults to 3600
51 | * seconds (one hour). Backup logs are saved to inFileName.bakup
52 | */
53 | FileLog( const char *inFileName,
54 | unsigned long inSecondsBetweenBackups = 3600 );
55 |
56 |
57 |
58 | virtual ~FileLog();
59 |
60 |
61 |
62 | /**
63 | * Makes a backup of the current log file, deletes old backups,
64 | * and clears the current log file.
65 | */
66 | void makeBackup();
67 |
68 |
69 |
70 | // overrides PrintLog::logString
71 | virtual void logString( const char *inLoggerName, const char *inString,
72 | int inLevel );
73 |
74 |
75 |
76 |
77 | protected:
78 |
79 | FILE *mLogFile;
80 |
81 | char *mLogFileName;
82 |
83 | unsigned long mSecondsBetweenBackups;
84 |
85 | unsigned long mTimeOfLastBackup;
86 |
87 |
88 | static const char *mDefaultLogFileName;
89 |
90 |
91 | };
92 |
93 |
94 |
95 | #endif
96 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/util/log/Log.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2002-February-25 Jason Rohrer
5 | * Created.
6 | */
7 |
8 |
9 |
10 | #include "Log.h"
11 |
12 |
13 |
14 | const int Log::DEACTIVATE_LEVEL = 0;
15 |
16 | const int Log::CRITICAL_ERROR_LEVEL = 1;
17 |
18 | const int Log::ERROR_LEVEL = 2;
19 |
20 | const int Log::WARNING_LEVEL = 3;
21 |
22 | const int Log::INFO_LEVEL = 4;
23 |
24 | const int Log::DETAIL_LEVEL = 5;
25 |
26 | const int Log::TRACE_LEVEL = 6;
27 |
28 |
29 |
30 | Log::~Log() {
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/util/log/Makefile:
--------------------------------------------------------------------------------
1 | #
2 | # Modification History
3 | #
4 | # 2002-February-25 Jason Rohrer
5 | # Created.
6 | # Changed to be more succinct.
7 | #
8 |
9 |
10 | GXX=g++
11 |
12 | ROOT_PATH = ../../..
13 |
14 | DEBUG_ON_FLAG = -g
15 | DEBUG_OFF_FLAG =
16 |
17 | DEBUG_FLAG = ${DEBUG_OFF_FLAG}
18 |
19 | TIME_PLATFORM_PATH = unix
20 | TIME_PLATFORM = Unix
21 |
22 |
23 |
24 | TIME_O = ${ROOT_PATH}/minorGems/system/${TIME_PLATFORM_PATH}/Time${TIME_PLATFORM}.o
25 | TIME_H = ${ROOT_PATH}/minorGems/system/Time.h
26 | TIME_CPP = ${ROOT_PATH}/minorGems/system/${TIME_PLATFORM_PATH}/Time${TIME_PLATFORM}.cpp
27 |
28 |
29 |
30 |
31 | testLog: AppLog.o FileLog.o PrintLog.o Log.o testLog.o ${TIME_O}
32 | ${GXX} ${DEBUG_FLAG} -o testLog AppLog.o FileLog.o PrintLog.o Log.o testLog.o ${TIME_O}
33 |
34 |
35 |
36 | clean:
37 | rm -f *.o ${TIME_O}
38 |
39 |
40 | testLog.o: testLog.cpp AppLog.h FileLog.h Log.h
41 | ${GXX} ${DEBUG_FLAG} -o testLog.o -c testLog.cpp
42 |
43 | AppLog.o: AppLog.h AppLog.cpp Log.h PrintLog.h
44 | ${GXX} ${DEBUG_FLAG} -o AppLog.o -c AppLog.cpp
45 |
46 | PrintLog.o: PrintLog.h PrintLog.cpp Log.h PrintLog.h ${TIME_H}
47 | ${GXX} ${DEBUG_FLAG} -I${ROOT_PATH} -o PrintLog.o -c PrintLog.cpp
48 |
49 | FileLog.o: PrintLog.h FileLog.cpp FileLog.h Log.h
50 | ${GXX} ${DEBUG_FLAG} -o FileLog.o -c FileLog.cpp
51 |
52 | Log.o: Log.h Log.cpp
53 | ${GXX} ${DEBUG_FLAG} -o Log.o -c Log.cpp
54 |
55 | ${TIME_O}: ${TIME_H} ${TIME_CPP}
56 | ${GXX} ${DEBUG_FLAG} -I${ROOT_PATH} -o ${TIME_O} -c ${TIME_CPP}
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/util/log/testLog.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2002-February-25 Jason Rohrer
5 | * Created.
6 | */
7 |
8 |
9 | #include "AppLog.h"
10 | #include "FileLog.h"
11 |
12 | #include "Log.h"
13 |
14 |
15 | int main() {
16 |
17 | AppLog::warning( "A test warning" );
18 | AppLog::warning( "Another test warning" );
19 | AppLog::warning( "mainApp", "And Another test warning" );
20 |
21 | AppLog::setLoggingLevel( Log::ERROR_LEVEL );
22 |
23 | AppLog::warning( "Yet Another test warning" );
24 | AppLog::error( "mainApp", "A test error" );
25 |
26 |
27 | AppLog::setLog( new FileLog( "test.log" ) );
28 |
29 | // this should be skipped
30 | AppLog::warning( "A second test warning" );
31 | // this should not be
32 | AppLog::criticalError( "A critical error" );
33 |
34 |
35 | AppLog::setLog( new FileLog( "test2.log" ) );
36 |
37 | // this should be skipped
38 | AppLog::warning( "A third test warning" );
39 |
40 |
41 | return 0;
42 | }
43 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/util/printUtils.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2002-April-8 Jason Rohrer
5 | * Created.
6 | *
7 | * 2002-April-11 Jason Rohrer
8 | * Added a missing return value.
9 | */
10 |
11 |
12 |
13 | #include "printUtils.h"
14 | #include "minorGems/system/MutexLock.h"
15 |
16 |
17 |
18 | #include
19 |
20 | // for variable argument lists
21 | #include
22 |
23 |
24 |
25 | MutexLock threadPrintFLock;
26 |
27 |
28 |
29 | int threadPrintF( const char* inFormatString, ... ) {
30 | threadPrintFLock.lock();
31 |
32 | va_list argList;
33 | va_start( argList, inFormatString );
34 |
35 | int returnVal = vprintf( inFormatString, argList );
36 |
37 | threadPrintFLock.unlock();
38 |
39 | return returnVal;
40 | }
41 |
42 |
43 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/util/printUtils.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2002-April-8 Jason Rohrer
5 | * Created.
6 | */
7 |
8 | #include "minorGems/common.h"
9 |
10 |
11 |
12 | #ifndef PRINT_UTILS_INCLUDED
13 | #define PRINT_UTILS_INCLUDED
14 |
15 |
16 |
17 | /**
18 | * A thread-safe version of printf.
19 | *
20 | * Note that printf is already thread-safe on certain platforms,
21 | * but does not seem to be thread-safe on Win32.
22 | *
23 | * @param inFormatString the format string to use.
24 | * @param ... a variable argument list, with the same usage
25 | * pattern as printf.
26 | */
27 | int threadPrintF( const char* inFormatString, ... );
28 |
29 |
30 |
31 | #endif
32 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/util/random/RandomSource.h:
--------------------------------------------------------------------------------
1 | // Jason Rohrer
2 | // RandomSource.h
3 |
4 | /**
5 | *
6 | * abstract interface for random number generation
7 | *
8 | * Can be implemented by:
9 | * --stdlib rand() function calls
10 | * --seed file full of random numbers
11 | *
12 | * Created 12-7-99
13 | * Mods:
14 | * Jason Rohrer 9-28-2000 Added a getRandomBoundedInt()
15 | * interface to faciliate retrieving
16 | * an integer in a given range [a,b]
17 | * where each integer in the range
18 | * has the same probability of being
19 | * returned.
20 | * Jason Rohrer 12-16-2000 Added a getRandomDouble() interface.
21 | * Jason Rohrer 11-21-2005 Added a virtual destructor.
22 | * Jason Rohrer 07-09-2006 Added a getRandomBoundedDouble interface.
23 | * Jason Rohrer 07-27-2006 Added a getRandomBoolean interface.
24 | */
25 |
26 | #include "minorGems/common.h"
27 |
28 |
29 |
30 | #ifndef RANDOM_SOURCE_INCLUDED
31 | #define RANDOM_SOURCE_INCLUDED
32 |
33 |
34 | class RandomSource {
35 |
36 | public:
37 | // pure virtual functions implemented by inheriting classes
38 |
39 | virtual float getRandomFloat() = 0; // in interval [0,1.0]
40 | virtual double getRandomDouble() = 0; // in interval [0,1.0]
41 | virtual unsigned int getRandomInt() = 0; // in interval [0,MAX]
42 | virtual unsigned int getIntMax() = 0; // returns MAX
43 |
44 | /**
45 | * Returns a random integer in [rangeStart,rangeEnd]
46 | * where each integer in the range has an equal
47 | * probability of occuring.
48 | */
49 | virtual int getRandomBoundedInt( int inRangeStart,
50 | int inRangeEnd ) = 0;
51 |
52 |
53 | /**
54 | * Returns a random double in [rangeStart,rangeEnd].
55 | */
56 | virtual double getRandomBoundedDouble( double inRangeStart,
57 | double inRangeEnd ) = 0;
58 |
59 |
60 |
61 | /**
62 | * Gets a random true/false value.
63 | */
64 | virtual char getRandomBoolean() = 0;
65 |
66 |
67 |
68 | virtual ~RandomSource();
69 |
70 |
71 | protected:
72 | unsigned int MAX; // maximum integer random number
73 | float invMAX; // floating point inverse of MAX
74 | double invDMAX; // double invers of MAX
75 | };
76 |
77 |
78 |
79 | inline RandomSource::~RandomSource() {
80 | // does nothing
81 | // exists to ensure that subclass destructors are called
82 | }
83 |
84 |
85 |
86 | #endif
87 |
--------------------------------------------------------------------------------
/Passage_v4_UnixSource/minorGems/util/test/testSnprintf.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Modification History
3 | *
4 | * 2004-January-15 Jason Rohrer
5 | * Created.
6 | */
7 |
8 | /**
9 | * A test program for snprintf behavior.
10 | */
11 |
12 |
13 | #include
14 | #include
15 | #include
16 |
17 |
18 |
19 | int main() {
20 | int numStrings = 3;
21 |
22 | // test strings of length 3, 4, and 5
23 | const char *testStrings[3] = { "tst", "test", "testt" };
24 |
25 | int result;
26 |
27 | // a buffer of length 4, which IS NOT large
28 | // enough to hold the last two testStrings
29 | char *buffer = (char*)( malloc( 4 ) );
30 |
31 | int i;
32 |
33 | for( i=0; i /dev/null
4 |
5 | $@
6 |
--------------------------------------------------------------------------------