├── .gitignore ├── Doxyfile ├── LICENSE ├── Makefile ├── README.md ├── config ├── Makecommon.mk ├── Makedebian.mk ├── Makedeps.mk ├── Makelib.mk ├── Makeplatform.mk ├── Makeprog.mk ├── Makeulamfile.mk ├── Makevars.mk └── Makeversion.mk ├── doc ├── VERSIONS.txt ├── dox │ ├── bibliography.dox │ ├── description.dox │ ├── developernotes.dox │ ├── license.dox │ └── mainpage.dox ├── gpl.txt └── lgpl.txt ├── res ├── elements │ └── README-elements.txt ├── fonts │ ├── Inconsolata.ttf │ ├── Mate-Regular.ttf │ ├── MateSC-Regular.ttf │ ├── OFL.txt │ ├── UbuntuMono-B.ttf │ ├── UbuntuMono-R.ttf │ └── tiny.ttf ├── images │ ├── mfms-icons-ZSHEET.png │ └── t2viz-icons-ZSHEET.png └── mfs │ ├── T2-12-13-start.mfs │ ├── dreg-480x320.mfs │ ├── start-3.0.1.mfs │ ├── start-3.0.2.mfs │ ├── start-3.0.3.mfs │ ├── start-3.0.4-1366x768.mfs │ ├── start-3.0.4.mfs │ ├── start-3.0.5.mfs │ ├── start-3.0.6-1366x768.mfs │ ├── start-3.0.6.mfs │ ├── start-3.1.0-1366x768.mfs │ ├── start-3.1.0.mfs │ ├── start-3.1.1-1366x768.mfs │ ├── start-3.1.1.mfs │ ├── start-3.1.2-1366x768.mfs │ ├── start-3.1.2.mfs │ ├── start-3.1.3-1366x768.mfs │ ├── start-3.1.3.mfs │ ├── start-3.2.0.mfs │ ├── start-3.2.1.mfs │ ├── start-3.2.2.mfs │ ├── start-3.3.0.mfs │ ├── start-4.0.0.mfs │ ├── start-5.0.0.mfs │ ├── start-5.0.5.mfs │ └── start-5.1.0.mfs ├── spikes ├── connection │ ├── Connection.h │ └── ConnectionTest.cpp ├── thdque │ ├── Makefile │ ├── itype.h │ ├── que.h │ ├── que.tcc │ ├── spiketests.h │ ├── thdque │ └── thdque.cpp └── video │ ├── Makefile │ ├── video │ └── video.c ├── src ├── Makefile ├── core │ ├── Makefile │ ├── include │ │ ├── AbstractChannel.h │ │ ├── Atom.h │ │ ├── AtomConfig.h │ │ ├── AtomSerializer.h │ │ ├── Base.h │ │ ├── BitField.h │ │ ├── BitStorage.h │ │ ├── BitStorage.tcc │ │ ├── BitVector.h │ │ ├── BitVector.tcc │ │ ├── ByteSerializable.h │ │ ├── ByteSink.h │ │ ├── ByteSink.tcc │ │ ├── ByteSource.h │ │ ├── CacheProcessor.h │ │ ├── CacheProcessor.tcc │ │ ├── CastOps.h │ │ ├── ChannelEnd.h │ │ ├── CharBufferByteSink.h │ │ ├── CharBufferByteSource.h │ │ ├── ColorMap.h │ │ ├── ColorMaps.h │ │ ├── Dirs.h │ │ ├── Drawable.h │ │ ├── Element.h │ │ ├── Element.tcc │ │ ├── ElementTable.h │ │ ├── ElementTable.tcc │ │ ├── ElementTypeNumberMap.h │ │ ├── ElementTypeNumberMap.tcc │ │ ├── ElementUtils.h │ │ ├── ElementUtils.tcc │ │ ├── Element_Empty.h │ │ ├── EventConfig.h │ │ ├── EventHistoryBuffer.h │ │ ├── EventHistoryBuffer.tcc │ │ ├── EventHistoryItem.h │ │ ├── EventHistoryItem.tcc │ │ ├── EventWindow.h │ │ ├── EventWindow.tcc │ │ ├── EventWindowRenderer.h │ │ ├── EventWindowRenderer.tcc │ │ ├── ExperimentValues.h │ │ ├── FXP.h │ │ ├── Fail.h │ │ ├── FailCodes.h │ │ ├── Format.h │ │ ├── GlobalHooks.h │ │ ├── IsLocal.h │ │ ├── LineCountingByteSource.h │ │ ├── LineTailByteSink.h │ │ ├── Logger.h │ │ ├── LonglivedLock.h │ │ ├── MDist.h │ │ ├── MDist.tcc │ │ ├── MFMSTile.h │ │ ├── MFMSTile.tcc │ │ ├── Mutex.h │ │ ├── OverflowableCharBufferByteSink.h │ │ ├── P3Atom.h │ │ ├── PSym.h │ │ ├── Packet.h │ │ ├── PacketIO.h │ │ ├── PacketIO.tcc │ │ ├── Parameter.h │ │ ├── Parameter.tcc │ │ ├── Parity2D_4x4.h │ │ ├── Point.h │ │ ├── Point.tcc │ │ ├── RandMT.h │ │ ├── Random.h │ │ ├── Rect.h │ │ ├── Sense.h │ │ ├── Site.h │ │ ├── SizedTile.h │ │ ├── StdEventConfig.h │ │ ├── TeeByteSink.h │ │ ├── Tile.h │ │ ├── Tile.tcc │ │ ├── UUID.h │ │ ├── UlamByteWrappers.h │ │ ├── UlamClass.h │ │ ├── UlamClass.tcc │ │ ├── UlamClassRegistry.h │ │ ├── UlamClassRegistry.tcc │ │ ├── UlamContext.h │ │ ├── UlamContext.tcc │ │ ├── UlamContextEvent.h │ │ ├── UlamContextEvent.tcc │ │ ├── UlamContextRestricted.h │ │ ├── UlamContextRestricted.tcc │ │ ├── UlamDefs.h │ │ ├── UlamElement.h │ │ ├── UlamElement.tcc │ │ ├── UlamQuark.h │ │ ├── UlamQuark.tcc │ │ ├── UlamRef.h │ │ ├── UlamRef.tcc │ │ ├── UlamRefMutable.h │ │ ├── UlamRefMutable.tcc │ │ ├── UlamTransient.h │ │ ├── UlamTransient.tcc │ │ ├── UlamTypeInfo.h │ │ ├── UlamTypeInfo.tcc │ │ ├── UlamVTableEntry.h │ │ ├── Util.h │ │ ├── VD.h │ │ ├── VD.tcc │ │ ├── Version.h │ │ ├── WindowScanner.h │ │ ├── WindowScanner.tcc │ │ ├── ZStringByteSource.h │ │ └── itype.h │ └── src │ │ ├── AbstractChannel.cpp │ │ ├── Atom.cpp │ │ ├── AtomConfig.cpp │ │ ├── AtomSerializer.cpp │ │ ├── Base.cpp │ │ ├── BitField.cpp │ │ ├── BitStorage.cpp │ │ ├── BitVector.cpp │ │ ├── ByteSerializable.cpp │ │ ├── ByteSink.cpp │ │ ├── ByteSource.cpp │ │ ├── CacheProcessor.cpp │ │ ├── CastOps.cpp │ │ ├── ChannelEnd.cpp │ │ ├── CharBufferByteSink.cpp │ │ ├── CharBufferByteSource.cpp │ │ ├── ColorMap.cpp │ │ ├── Dirs.cpp │ │ ├── Drawable.cpp │ │ ├── Element.cpp │ │ ├── ElementTable.cpp │ │ ├── ElementTypeNumberMap.cpp │ │ ├── ElementUtils.cpp │ │ ├── Element_Empty.cpp │ │ ├── EventConfig.cpp │ │ ├── EventHistoryBuffer.cpp │ │ ├── EventHistoryItem.cpp │ │ ├── EventWindow.cpp │ │ ├── EventWindowRenderer.cpp │ │ ├── FXP.cpp │ │ ├── Fail.cpp │ │ ├── FailCodes.cpp │ │ ├── Format.cpp │ │ ├── GlobalHooks.cpp │ │ ├── LineCountingByteSource.cpp │ │ ├── LineTailByteSink.cpp │ │ ├── Logger.cpp │ │ ├── LonglivedLock.cpp │ │ ├── MDist.cpp │ │ ├── MFMSTile.cpp │ │ ├── Mutex.cpp │ │ ├── OverflowableCharBufferByteSink.cpp │ │ ├── P3Atom.cpp │ │ ├── PSym.cpp │ │ ├── Packet.cpp │ │ ├── PacketIO.cpp │ │ ├── Parameter.cpp │ │ ├── Parity2D_4x4.cpp │ │ ├── Parity2D_4x4_tables.src │ │ ├── Point.cpp │ │ ├── Random.cpp │ │ ├── Rect.cpp │ │ ├── Sense.cpp │ │ ├── Site.cpp │ │ ├── SizedTile.cpp │ │ ├── StdEventConfig.cpp │ │ ├── TeeByteSink.cpp │ │ ├── Tile.cpp │ │ ├── UUID.cpp │ │ ├── UlamClass.cpp │ │ ├── UlamClassRegistry.cpp │ │ ├── UlamContext.cpp │ │ ├── UlamContextEvent.cpp │ │ ├── UlamContextRestricted.cpp │ │ ├── UlamDefs.cpp │ │ ├── UlamElement.cpp │ │ ├── UlamQuark.cpp │ │ ├── UlamRef.cpp │ │ ├── UlamRefMutable.cpp │ │ ├── UlamTransient.cpp │ │ ├── UlamTypeInfo.cpp │ │ ├── UlamVTableEntry.cpp │ │ ├── Util.cpp │ │ ├── VD.cpp │ │ ├── Version.cpp │ │ ├── WindowScanner.cpp │ │ ├── ZStringByteSource.cpp │ │ ├── itype.cpp │ │ ├── randmt.cpp │ │ └── readme-mt.txt ├── drivers │ ├── Makefile │ ├── mfmbigtile │ │ ├── Makefile │ │ ├── include │ │ │ └── main.h │ │ └── src │ │ │ └── main.cpp │ ├── mfmc │ │ ├── Makefile │ │ ├── Makefile-CL.mk │ │ ├── Makefile-GUI.mk │ │ ├── include │ │ │ ├── TileSizes.inc │ │ │ └── main.h │ │ └── src │ │ │ └── main.cpp │ ├── mfmdha │ │ ├── Makefile │ │ ├── include │ │ │ ├── Element_Bar.h │ │ │ ├── Element_Boids.cpp │ │ │ ├── Element_Boids.h │ │ │ ├── Element_Boids1.cpp │ │ │ ├── Element_Boids1.h │ │ │ ├── Element_Boids2.cpp │ │ │ ├── Element_Boids2.h │ │ │ ├── Element_DBar.h │ │ │ ├── Element_MQBar.h │ │ │ ├── Element_Mover.h │ │ │ ├── Element_Pair.h │ │ │ ├── Element_QBar.h │ │ │ ├── Element_SBar.h │ │ │ ├── Vector.h │ │ │ └── main.h │ │ └── src │ │ │ ├── Element_Bar.cpp │ │ │ ├── Element_DBar.cpp │ │ │ ├── Element_MQBar.cpp │ │ │ ├── Element_QBar.cpp │ │ │ ├── Element_SBar.cpp │ │ │ ├── Vector.cpp │ │ │ └── main.cpp │ ├── mfmheadless │ │ ├── Makefile │ │ ├── include │ │ │ └── main.h │ │ └── src │ │ │ └── main.cpp │ ├── mfmsim │ │ ├── Makefile │ │ ├── include │ │ │ └── main.h │ │ └── src │ │ │ └── main.cpp │ ├── mfmt2-old │ │ ├── Makefile │ │ ├── Makefile-CL.mk │ │ ├── Makefile-GUI.mk │ │ ├── include │ │ │ ├── FlashTraffic.h │ │ │ ├── ITCLocks.h │ │ │ ├── MFMIO.h │ │ │ ├── MFMT2Constants.h │ │ │ ├── PacketFIFO.h │ │ │ ├── TileSizes.inc │ │ │ └── main.h │ │ ├── notes │ │ │ ├── 201906240220-hack-mouse-notes.txt │ │ │ ├── 201906240312-tslib-support-new-attempt.txt │ │ │ ├── 201907131241-status-display-notes.txt │ │ │ ├── 201907261108-real-lock-notes.txt │ │ │ ├── 201908121746-real-packet-notes.txt │ │ │ └── 201908241146-closed-cxns-notes.txt │ │ └── src │ │ │ ├── FlashTraffic.cpp │ │ │ ├── ITCLocks.cpp │ │ │ ├── MFMIO.cpp │ │ │ ├── MFMT2Constants.cpp │ │ │ ├── PacketFIFO.cpp │ │ │ └── main.cpp │ ├── mfmt2 │ │ ├── Makefile │ │ ├── include │ │ │ ├── ADCCtl.h │ │ │ ├── CPUFreq.h │ │ │ ├── ChooserPanel.h │ │ │ ├── Circuit.h │ │ │ ├── EWSet.h │ │ │ ├── Engine.h │ │ │ ├── FlashCommands.h │ │ │ ├── FlashTraffic.h │ │ │ ├── ITCIcons.h │ │ │ ├── ITCIterator.h │ │ │ ├── ITCStatus.h │ │ │ ├── ITCStatusPanel.h │ │ │ ├── IWeave.h │ │ │ ├── LogPanel.h │ │ │ ├── Menu.h │ │ │ ├── SDLI.h │ │ │ ├── SimLogPanel.h │ │ │ ├── Sites.h │ │ │ ├── T2CDMPanel.h │ │ │ ├── T2DrawConfigPanel.h │ │ │ ├── T2EventWindow.h │ │ │ ├── T2FlashTrafficManager.h │ │ │ ├── T2GridPanel.h │ │ │ ├── T2ITC.h │ │ │ ├── T2InfoPanel.h │ │ │ ├── T2RadioButton.h │ │ │ ├── T2RootPanel.h │ │ │ ├── T2Tile.h │ │ │ ├── T2TileStats.h │ │ │ ├── T2TimeQueuePanel.h │ │ │ ├── T2TitleCard.h │ │ │ ├── T2TracePanel.h │ │ │ ├── T2UIComponents.h │ │ │ ├── T2VizConstants.h │ │ │ ├── Trace.h │ │ │ ├── TraceLogInfo.h │ │ │ ├── TraceTypes.h │ │ │ ├── UlamEventSystem.h │ │ │ ├── Utils12.h │ │ │ ├── VizConfig.h │ │ │ ├── Weaver.h │ │ │ ├── WrappedText.h │ │ │ └── main.h │ │ ├── notes │ │ │ ├── 202006120116-notes.txt │ │ │ ├── 202009231447-flash-traffic-notes.txt │ │ │ ├── 202010261444-trace-to-mem-notes.txt │ │ │ ├── 202012120105-intertile-evts-debug-notes.txt │ │ │ ├── 202012290413-ulam-intertile-notes.txt │ │ │ ├── 202202171236-inject-flash-traffic-notes.txt │ │ │ └── 202302050932-mfzid-redux-notes.txt │ │ ├── src │ │ │ ├── ADCCtl.cpp │ │ │ ├── CPUFreq.cpp │ │ │ ├── ChooserPanel.cpp │ │ │ ├── Circuit.cpp │ │ │ ├── EWSet.cpp │ │ │ ├── Engine.cpp │ │ │ ├── FlashCommands.cpp │ │ │ ├── FlashTraffic.cpp │ │ │ ├── ITCIcons.cpp │ │ │ ├── ITCIterator.cpp │ │ │ ├── ITCStatus.cpp │ │ │ ├── ITCStatusPanel.cpp │ │ │ ├── IWeave.cpp │ │ │ ├── LogPanel.cpp │ │ │ ├── Menu.cpp │ │ │ ├── SDLI.cpp │ │ │ ├── SimLogPanel.cpp │ │ │ ├── Sites.cpp │ │ │ ├── T2CDMPanel.cpp │ │ │ ├── T2DrawConfigPanel.cpp │ │ │ ├── T2EventWindow.cpp │ │ │ ├── T2FlashTrafficManager.cpp │ │ │ ├── T2GridPanel.cpp │ │ │ ├── T2ITC.cpp │ │ │ ├── T2InfoPanel.cpp │ │ │ ├── T2RadioButton.cpp │ │ │ ├── T2RootPanel.cpp │ │ │ ├── T2Tile.cpp │ │ │ ├── T2TileStats.cpp │ │ │ ├── T2TimeQueuePanel.cpp │ │ │ ├── T2TitleCard.cpp │ │ │ ├── T2TracePanel.cpp │ │ │ ├── T2UIComponents.cpp │ │ │ ├── T2VizConstants.cpp │ │ │ ├── Trace.cpp │ │ │ ├── TraceLogInfo.cpp │ │ │ ├── TraceTypes.cpp │ │ │ ├── UlamEventSystem.cpp │ │ │ ├── VizConfig.cpp │ │ │ ├── Weaver.cpp │ │ │ ├── WrappedText.cpp │ │ │ └── main.cpp │ │ └── wconfig.pl │ ├── mfmtest │ │ ├── Makefile │ │ ├── include │ │ │ └── main.h │ │ └── src │ │ │ └── main.cpp │ ├── mfzrun │ │ ├── Makefile │ │ ├── common.pl.inc │ │ ├── mfm-config.tmpl │ │ ├── mfzmake.tmpl │ │ └── mfzrun.tmpl │ ├── stub │ │ ├── Makefile │ │ ├── include │ │ │ ├── Stub.h │ │ │ └── main.h │ │ └── src │ │ │ ├── Stub.cpp │ │ │ └── main.cpp │ └── ulamtest │ │ ├── Makefile │ │ ├── include │ │ └── main.h │ │ └── src │ │ └── main.cpp ├── elements │ ├── Makefile │ ├── include │ │ ├── AbstractElement_ForkBomb.h │ │ ├── AbstractElement_Reprovert.h │ │ ├── AbstractElement_WaPat.h │ │ ├── AbstractElement_Wanderer.h │ │ ├── AbstractElement_Xtal.h │ │ ├── CityConstants.h │ │ ├── Element_AntiForkBomb.h │ │ ├── Element_Block.h │ │ ├── Element_CheckerForkBlue.h │ │ ├── Element_CheckerForkBlue.tcc │ │ ├── Element_CheckerForkRed.h │ │ ├── Element_CheckerForkRed.tcc │ │ ├── Element_City_Building.h │ │ ├── Element_City_Building.tcc │ │ ├── Element_City_Car.h │ │ ├── Element_City_Car.tcc │ │ ├── Element_City_Intersection.h │ │ ├── Element_City_Intersection.tcc │ │ ├── Element_City_Park.h │ │ ├── Element_City_Sidewalk.h │ │ ├── Element_City_Sidewalk.tcc │ │ ├── Element_City_Street.h │ │ ├── Element_City_Street.tcc │ │ ├── Element_Collector.h │ │ ├── Element_Consumer.h │ │ ├── Element_Creg.h │ │ ├── Element_Data.h │ │ ├── Element_Dmover.h │ │ ├── Element_Dreg.h │ │ ├── Element_Emitter.h │ │ ├── Element_Fish.h │ │ ├── Element_ForkBomb1.h │ │ ├── Element_ForkBomb2.h │ │ ├── Element_ForkBomb3.h │ │ ├── Element_Indexed.h │ │ ├── Element_MQBar.h │ │ ├── Element_Mover.h │ │ ├── Element_Res.h │ │ ├── Element_Rocket.h │ │ ├── Element_Shark.h │ │ ├── Element_Sorter.h │ │ ├── Element_Template.h │ │ ├── Element_Wall.h │ │ ├── Element_Wanderer_Cyan.h │ │ ├── Element_Wanderer_Magenta.h │ │ ├── Element_Xtal_General.h │ │ ├── Element_Xtal_L12.h │ │ ├── Element_Xtal_R12.h │ │ ├── Element_Xtal_Sq1.h │ │ ├── StdElements.h │ │ └── StdElements.tcc │ └── src │ │ ├── AbstractElement_ForkBomb.cpp │ │ ├── AbstractElement_Reprovert.cpp │ │ ├── AbstractElement_WaPat.cpp │ │ ├── AbstractElement_Wanderer.cpp │ │ ├── AbstractElement_Xtal.cpp │ │ ├── Element_AntiForkBomb.cpp │ │ ├── Element_Block.cpp │ │ ├── Element_CheckerForkBlue.cpp │ │ ├── Element_CheckerForkRed.cpp │ │ ├── Element_Collector.cpp │ │ ├── Element_Consumer.cpp │ │ ├── Element_Data.cpp │ │ ├── Element_Dmover.cpp │ │ ├── Element_Dreg.cpp │ │ ├── Element_Emitter.cpp │ │ ├── Element_Fish.cpp │ │ ├── Element_ForkBomb1.cpp │ │ ├── Element_ForkBomb2.cpp │ │ ├── Element_ForkBomb3.cpp │ │ ├── Element_Indexed.cpp │ │ ├── Element_MQBar.cpp │ │ ├── Element_Mover.cpp │ │ ├── Element_Res.cpp │ │ ├── Element_Rocket.cpp │ │ ├── Element_Shark.cpp │ │ ├── Element_Sorter.cpp │ │ ├── Element_Wall.cpp │ │ ├── Element_Wanderer_Cyan.cpp │ │ ├── Element_Wanderer_Magenta.cpp │ │ ├── Element_Xtal_General.cpp │ │ ├── Element_Xtal_L12.cpp │ │ ├── Element_Xtal_R12.cpp │ │ ├── Element_Xtal_Sq1.cpp │ │ └── StdElements.cpp ├── gui │ ├── Makefile │ ├── include │ │ ├── AbstractButton.h │ │ ├── AbstractCheckbox.h │ │ ├── AbstractGUIDriver.h │ │ ├── AbstractGUIDriverButtons.h │ │ ├── AbstractGUIDriverTools.h │ │ ├── AbstractRadioButton.h │ │ ├── AssetManager.h │ │ ├── AtomViewPanel.h │ │ ├── AtomViewPanel.tcc │ │ ├── Camera.h │ │ ├── CloseWindowButton.h │ │ ├── DrawableSDL.h │ │ ├── Drawing.h │ │ ├── DriverButtonPanel.h │ │ ├── EditingTool.h │ │ ├── EventWindowRendererGUI.h │ │ ├── ExternalConfigSectionGUI.h │ │ ├── ExternalConfigSectionGUI.tcc │ │ ├── GUIConstants.h │ │ ├── GridPanel.h │ │ ├── GridPanel.tcc │ │ ├── GridTool.h │ │ ├── GridTool.tcc │ │ ├── HelpPanel.h │ │ ├── Keyboard.h │ │ ├── Label.h │ │ ├── Mouse.h │ │ ├── MovablePanel.h │ │ ├── NeighborSelectPanel.h │ │ ├── Panel.h │ │ ├── ParameterController.h │ │ ├── ParameterControllerBool.h │ │ ├── ReplayPanel.h │ │ ├── ReplayPanel.tcc │ │ ├── RootPanel.h │ │ ├── Slider.h │ │ ├── StatisticsPanel.h │ │ ├── StatisticsPanel.tcc │ │ ├── StdPanel.h │ │ ├── TextPanel.h │ │ ├── TileRenderer.h │ │ ├── TileRenderer.tcc │ │ ├── ToolboxPanel.h │ │ └── TreeViewPanel.h │ └── src │ │ ├── AbstractButton.cpp │ │ ├── AbstractCheckbox.cpp │ │ ├── AbstractGUIDriver.cpp │ │ ├── AbstractGUIDriverButtons.cpp │ │ ├── AbstractGUIDriverTools.cpp │ │ ├── AbstractRadioButton.cpp │ │ ├── AssetManager.cpp │ │ ├── AtomViewPanel.cpp │ │ ├── Camera.cpp │ │ ├── DrawableSDL.cpp │ │ ├── Drawing.cpp │ │ ├── DriverButtonPanel.cpp │ │ ├── EditingTool.cpp │ │ ├── ExternalConfigSectionGUI.cpp │ │ ├── GUIConstants.cpp │ │ ├── GridPanel.cpp │ │ ├── GridTool.cpp │ │ ├── HelpPanel.cpp │ │ ├── Keyboard.cpp │ │ ├── Label.cpp │ │ ├── Mouse.cpp │ │ ├── MovablePanel.cpp │ │ ├── NeighborSelectPanel.cpp │ │ ├── Panel.cpp │ │ ├── ParameterController.cpp │ │ ├── ParameterControllerBool.cpp │ │ ├── ReplayPanel.cpp │ │ ├── RootPanel.cpp │ │ ├── Slider.cpp │ │ ├── StatisticsPanel.cpp │ │ ├── StdPanel.cpp │ │ ├── TextPanel.cpp │ │ ├── TileRenderer.cpp │ │ ├── ToolboxPanel.cpp │ │ └── TreeViewPanel.cpp ├── images │ ├── Makefile │ └── icons │ │ ├── Makefile │ │ ├── generateT2VizZSheetFromMasterRowSVG.pl │ │ ├── generateZSheetFromMasterRowSVG.pl │ │ ├── mfms-icons.svg │ │ └── t2viz-icons.svg ├── platform-linux │ ├── MakePlatform.mk │ ├── Makefile │ ├── include │ │ ├── FailPlatformSpecific.h │ │ └── IsLocalPlatformSpecific.h │ └── src │ │ ├── FailPlatformSpecific.cpp │ │ └── IsLocalPlatformSpecific.cpp ├── platform-tile │ ├── MakePlatform.mk │ ├── Makefile │ ├── include │ │ ├── FailPlatformSpecific.h │ │ └── IsLocalPlatformSpecific.h │ └── src │ │ ├── FailPlatformSpecific.cpp │ │ └── IsLocalPlatformSpecific.cpp ├── sim │ ├── Makefile │ ├── include │ │ ├── AbstractDriver.h │ │ ├── AbstractDualDriver.h │ │ ├── AbstractHeadlessDriver.h │ │ ├── ConfigFunctionCall.h │ │ ├── ConfigFunctionCall.tcc │ │ ├── DateTimeStamp.h │ │ ├── DebugTools.h │ │ ├── DebugTools.tcc │ │ ├── ElementLibrary.h │ │ ├── ElementLibraryLoader.h │ │ ├── ElementRegistry.h │ │ ├── ElementRegistry.tcc │ │ ├── ExternalConfig.h │ │ ├── ExternalConfig.tcc │ │ ├── ExternalConfigSection.h │ │ ├── ExternalConfigSection.tcc │ │ ├── ExternalConfigSectionDriver.h │ │ ├── ExternalConfigSectionDriver.tcc │ │ ├── ExternalConfigSectionGrid.h │ │ ├── ExternalConfigSectionGrid.tcc │ │ ├── FileByteSink.h │ │ ├── FileByteSource.h │ │ ├── Grid.h │ │ ├── Grid.tcc │ │ ├── GridConfig.h │ │ ├── GridTransceiver.h │ │ ├── Utils.h │ │ └── VArguments.h │ └── src │ │ ├── AbstractDriver.cpp │ │ ├── AbstractDualDriver.cpp │ │ ├── ConfigFunctionCall.cpp │ │ ├── DateTimeStamp.cpp │ │ ├── DebugTools.cpp │ │ ├── ElementLibrary.cpp │ │ ├── ElementLibraryLoader.cpp │ │ ├── ElementRegistry.cpp │ │ ├── ExternalConfig.cpp │ │ ├── ExternalConfigSection.cpp │ │ ├── ExternalConfigSectionGrid.cpp │ │ ├── FileByteSink.cpp │ │ ├── FileByteSource.cpp │ │ ├── Grid.cpp │ │ ├── GridConfig.cpp │ │ ├── GridTransceiver.cpp │ │ ├── Utils.cpp │ │ └── VArguments.cpp ├── t2lib │ ├── Makefile │ ├── include │ │ ├── RectIterator.h │ │ ├── SHA256ish.h │ │ ├── T2Constants.h │ │ ├── T2Main.h │ │ ├── T2PacketBuffer.h │ │ ├── T2Types.h │ │ ├── T2Utils.h │ │ ├── TimeQueue.h │ │ ├── TimeoutAble.h │ │ └── UniqueTime.h │ └── src │ │ ├── RectIterator.cpp │ │ ├── SHA256ish.cpp │ │ ├── T2Constants.cpp │ │ ├── T2Main.cpp │ │ ├── T2PacketBuffer.cpp │ │ ├── T2Types.cpp │ │ ├── T2Utils.cpp │ │ ├── TimeQueue.cpp │ │ ├── TimeoutAble.cpp │ │ └── UniqueTime.cpp └── test │ ├── Makefile │ ├── include │ ├── BitRef_Test.h │ ├── BitVector_Test.h │ ├── ByteSink_Test.h │ ├── ByteSource_Test.h │ ├── ColorMap_Test.h │ ├── ElementRegistry_Test.h │ ├── EventWindow_Test.h │ ├── ExternalConfig_Test.h │ ├── FXP_Test.h │ ├── Fail_Test.h │ ├── GridTransceiver_Test.h │ ├── Grid_Test.h │ ├── LineTailByteSink_Test.h │ ├── Logger_Test.h │ ├── MDist_Test.h │ ├── OverflowableCharBufferByteSink_Test.h │ ├── PSym_Test.h │ ├── Parity2D_4x4_Test.h │ ├── Point_Test.h │ ├── Random_Test.h │ ├── Test_Common.h │ ├── Tests.h │ ├── Tile_Test.h │ ├── UUID_Test.h │ ├── UlamElement_Test.h │ ├── UlamRef_Test.h │ └── VArguments_Test.h │ └── src │ ├── BitRef_Test.cpp │ ├── BitVector_Test.cpp │ ├── ByteSink_Test.cpp │ ├── ByteSource_Test.cpp │ ├── ColorMap_Test.cpp │ ├── ElementRegistry_Test.cpp │ ├── EventWindow_Test.cpp │ ├── ExternalConfig_Test.cpp │ ├── FXP_Test.cpp │ ├── Fail_Test.cpp │ ├── GridTransceiver_Test.cpp │ ├── Grid_Test.cpp │ ├── LineTailByteSink_Test.cpp │ ├── Logger_Test.cpp │ ├── MDist_test.cpp │ ├── OverflowableCharBufferByteSink_Test.cpp │ ├── PSym_Test.cpp │ ├── Parity2D_4x4_Test.cpp │ ├── Point_Test.cpp │ ├── Random_Test.cpp │ ├── Test_Common.cpp │ ├── Tile_Test.cpp │ ├── UUID_Test.cpp │ ├── UlamElement_Test.cpp │ ├── UlamRef_Test.cpp │ └── VArguments_Test.cpp └── tools ├── README.txt ├── RenderPNGsCenteredToHD ├── img_converter.sh └── splotter ├── 2x1x40x10k-dreg ├── samplingbias2.pdf └── sfc.plot ├── 2x1x40x20k-dreg ├── Makefile ├── ppmToGnuPlot.pl ├── samplingbias-grid.plt └── samplingbias2.plt ├── 2x2x40x20k-dreg ├── Makefile ├── ppmToGnuPlot.pl ├── samplingbias-grid.plt └── samplingbias2.plt ├── 2x3x40x20k-dreg ├── Makefile ├── ppmToGnuPlot.pl ├── samplingbias-grid.plt └── samplingbias2.plt ├── 2x4x40x20k-dreg ├── Makefile ├── ppmToGnuPlot.pl ├── samplingbias-grid.plt └── samplingbias2.plt ├── 2x5x40x20k-dreg ├── Makefile ├── ppmToGnuPlot.pl ├── samplingbias-grid.plt └── samplingbias2.plt ├── 2x6x40x20k-dreg ├── Makefile ├── ppmToGnuPlot.pl ├── samplingbias-grid.plt └── samplingbias2.plt ├── 2x7x40x20k-dreg ├── Makefile ├── ppmToGnuPlot.pl ├── samplingbias-grid.plt └── samplingbias2.plt ├── 3x5x40x10k-dreg ├── samplingbias2.pdf └── sfc.plot ├── 3x5x40x20k-dreg ├── Makefile ├── average.pdf ├── grid.pdf ├── ppmToGnuPlot.pl ├── samplingbias-grid.plt ├── samplingbias2.plt ├── sfc-grid.plot └── sfc.plot ├── ppmToGnuPlot.pl ├── samplingbias-grid.plt └── samplingbias2.plt /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | 6 | # Compiled Dynamic libraries 7 | *.so 8 | *.dylib 9 | 10 | # Compiled Static libraries 11 | *.lai 12 | *.la 13 | *.a 14 | 15 | # Ignore emacs backup files 16 | *~ 17 | 18 | # Ignore executables 19 | bin/* 20 | 21 | # Ignore build and lib dirs 22 | build 23 | lib/* 24 | 25 | # Ignore doxygen-generated output 26 | doc/ref 27 | 28 | # Ignore the code log 29 | codelog.txt 30 | 31 | # We don't want ppms 32 | *.ppm 33 | 34 | # Don't track spikes for now 35 | spikes/ 36 | 37 | # Don't need the generated *.inc files 38 | src/elements/include/StdElements.inc 39 | src/elements/include/StdElementsHeaders.inc 40 | 41 | # Other generated files 42 | res/elements/demos.dat 43 | res/mfmt2/wconfig.txt 44 | 45 | # Using Google's lint but don't want to commit it. 46 | tools/cpplint.py 47 | 48 | # Leave out unofficially '-held' files 49 | *-hold 50 | 51 | # Ignore the version file made for non-git builds 52 | *TREEVERSION.mk 53 | 54 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | MFM codebase 2 | ============ 3 | 4 | C++ implementation of the Movable Feast Machine computer architecture 5 | 6 | This code library, and its associated programs, examples, and 7 | documentation---collectively described as the "MFM codebase"---is 8 | free software; you can redistribute it and/or modify it under the 9 | terms of the GNU Lesser General Public License as published by the 10 | Free Software Foundation; either version 3 of the License, or (at your 11 | option) any later version. 12 | -------------------------------------------------------------------------------- /config/Makedebian.mk: -------------------------------------------------------------------------------- 1 | # Extra stuff for debian, only on 'make install' 2 | #DEB_PROGRAMS_TO_INSTALL += mfmcl mfmcl_s mfmcl_m mfmcl_l 3 | #DEB_PROGRAMS_TO_INSTALL += mfms mfms_s mfms_m mfms_l 4 | ifeq ($(PLATFORM), linux) 5 | DEB_PROGRAMS_TO_INSTALL += mfms 6 | endif 7 | ifeq ($(PLATFORM), tile) 8 | DEB_PROGRAMS_TO_INSTALL += mfmt2 9 | endif 10 | #DEB_PROGRAMS_TO_INSTALL += mfmtest 11 | DEB_PROGRAMS_TO_INSTALL += mfzmake mfzrun 12 | DEB_PROGRAMS_TO_INSTALL += mfm-config 13 | DEB_PROGRAMS_PATHS_TO_INSTALL := $(DEB_PROGRAMS_TO_INSTALL:%=bin/%) 14 | DEB_MFM_BINDIR := $(DESTDIR)/usr/bin 15 | DEB_MFM_RESDIR := $(DESTDIR)/usr/share/mfm/res 16 | 17 | # For mfm-config 18 | export DEB_MFM_BINDIR 19 | export DEB_MFM_RESDIR 20 | 21 | # We're recursing rather than depending on 'all' so that the 22 | # $(PLATFORMS) mechanism doesn't need to know about install. 23 | install: FORCE 24 | @COMMANDS=1 make -k all 25 | @#COMMANDS=1 make -k -C src/drivers/mfzrun all 26 | mkdir -p $(DEB_MFM_BINDIR) 27 | cp -a $(DEB_PROGRAMS_PATHS_TO_INSTALL) $(DEB_MFM_BINDIR) 28 | mkdir -p $(DEB_MFM_RESDIR) 29 | cp -r res/* $(DEB_MFM_RESDIR) 30 | @# MAN AND DOC? 31 | 32 | version: FORCE 33 | @echo $(MFM_VERSION_NUMBER) 34 | -------------------------------------------------------------------------------- /config/Makedeps.mk: -------------------------------------------------------------------------------- 1 | # We need a kickstart rule to get .d files going, before their first 2 | # real compile-time generation. So make empty .d's, if they don't 3 | # already exist. 4 | $(BUILDDIR)/%.d: $(BUILDDIR) 5 | @[ -e $@ ] || >$@ 6 | 7 | $(BUILDDIR): 8 | @mkdir -p $@ 9 | 10 | # After we make .d's, let's keep them 11 | .PRECIOUS: $(BUILDDIR)/%.d 12 | 13 | # Suck in generated autodependencies 14 | AUTODEPS:=$(wildcard $(BUILDDIR)/*.d) 15 | -include $(AUTODEPS) 16 | -------------------------------------------------------------------------------- /config/Makelib.mk: -------------------------------------------------------------------------------- 1 | # This makefile to build an archive file from a single directory of source 2 | include $(BASEDIR)/config/Makecommon.mk 3 | 4 | CSOURCES := $(wildcard src/*.c) 5 | COBJECTS := $(patsubst src/%.c,$(BUILDDIR)/%.o,$(CSOURCES)) 6 | 7 | CPPSOURCES := $(wildcard src/*.cpp) 8 | CPPOBJECTS := $(patsubst src/%.cpp,$(BUILDDIR)/%.o,$(CPPSOURCES)) 9 | 10 | SSOURCES := $(wildcard src/*.S) 11 | SOBJECTS := $(patsubst src/%.S,$(BUILDDIR)/%.o,$(SSOURCES)) 12 | 13 | SOURCES := $(CSOURCES) $(CPPSOURCES) $(SSOURCES) 14 | OBJECTS := $(COBJECTS) $(CPPOBJECTS) $(SOBJECTS) 15 | 16 | HEADERS := $(wildcard include/*) 17 | 18 | ALLDEP += $(HEADERS) 19 | 20 | all: $(ARCHIVEPATH) commondeps 21 | 22 | 23 | commondeps: FORCE 24 | mkdir -p $(BASEDIR)/res/elements 25 | 26 | $(ARCHIVEPATH): $(BUILDDIR) $(OBJECTS) 27 | $(AR) ruc "$@" $(OBJECTS) 28 | 29 | clean: 30 | rm -f $(OBJECTS) 31 | 32 | include $(BASEDIR)/config/Makedeps.mk 33 | 34 | realclean: clean 35 | rm -f $(AUTODEPS) # AUTODEPS 36 | rm -f $(ARCHIVEPATH) 37 | rm -f src/*~ include/*~ *~ 38 | rm -f $(BUILDDIR)/* 39 | 40 | .PHONY: clean realclean FORCE 41 | 42 | -------------------------------------------------------------------------------- /config/Makeplatform.mk: -------------------------------------------------------------------------------- 1 | # This needs to be reworked, but for now (heh), we're saying that 2 | # the x86's are platform 'linux' and armv7l (+ nodename beaglebone) 3 | # is platform 'tile' (need nodename else generic armhf build fails 4 | # on launchpad) 5 | 6 | ifdef FORCE_MACHINE_TYPE 7 | MACHINE_TYPE:=$(FORCE_MACHINE_TYPE) 8 | else 9 | MACHINE_TYPE:=$(shell uname -m) 10 | endif 11 | 12 | PLATFORM:= 13 | ifeq ($(MACHINE_TYPE), x86_64) 14 | PLATFORM:=linux 15 | endif 16 | ifeq ($(MACHINE_TYPE), x86) 17 | PLATFORM:=linux 18 | endif 19 | ifeq ($(MACHINE_TYPE), i386) 20 | PLATFORM:=linux 21 | endif 22 | ifeq ($(MACHINE_TYPE), i586) 23 | PLATFORM:=linux 24 | endif 25 | ifeq ($(MACHINE_TYPE), i686) 26 | PLATFORM:=linux 27 | endif 28 | ifeq ($(MACHINE_TYPE), armv7l) 29 | NODE_NAME:=$(shell uname -n) 30 | ifeq ($(NODE_NAME), beaglebone) 31 | PLATFORM:=tile 32 | else 33 | PLATFORM:=linux 34 | endif 35 | endif 36 | 37 | $(info MACHINE TYPE: $(MACHINE_TYPE) / PLATFORM: $(PLATFORM)) 38 | 39 | ifeq ($(PLATFORM),) 40 | $(error unrecognized platform '$(MACHINE_TYPE)') 41 | endif 42 | -------------------------------------------------------------------------------- /config/Makeprog.mk: -------------------------------------------------------------------------------- 1 | # This makefile to build programs from a bunch of libraries 2 | 3 | BINDIR:=$(BASEDIR)/bin 4 | 5 | all: program 6 | 7 | # Our ultimate goal 8 | program: $(BINDIR)/$(COMPONENTNAME) 9 | @cd $(BINDIR); for i in $(COMPONENTALIASES); do ln -f -s $(COMPONENTNAME) $$i; done 10 | 11 | # Get rules to build our main.o 12 | include $(BASEDIR)/config/Makelib.mk 13 | 14 | # We don't have functioning interlibrary dependency tracking because 15 | # we're losers. For now say that if any .a files are touched, we need 16 | # to relink 17 | 18 | ARCHIVES := $(wildcard $(BASEDIR)/build/*/*.a) 19 | 20 | # Aaand don't forget to make our own archive before trying to build 21 | # our program. Given the above, after a 'realclean' $(ARCHIVES) is 22 | # empty. 23 | 24 | ARCHIVES += $(ARCHIVEPATH) 25 | 26 | $(BUILDDIR)/$(COMPONENTNAME).o: src/main.cpp $(ALLDEP) $(BUILDDIR)/%.d 27 | $(GPP) $(OPTS) $(DEBUGS) $(CPPFLAGS) $(DEFINES) -c -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -MT"$(@:%.o=%.d)" -o"$@" "$<" 28 | 29 | $(BINDIR)/$(COMPONENTNAME): $(BUILDDIR)/$(COMPONENTNAME).o $(ALLDEP) $(ARCHIVES) 30 | mkdir -p $(BINDIR) 31 | $(GPP) $(LDFLAGS) $(BUILDDIR)/$(COMPONENTNAME).o $(LIBS) -o $@ 32 | -------------------------------------------------------------------------------- /config/Makeversion.mk: -------------------------------------------------------------------------------- 1 | #### 2 | # THE MFM SYSTEM VERSION IS DEFINED HERE 3 | # 4 | # Changes to this file should be committed alone and last, just prior 5 | # to release, and then HEAD should be tagged appropriately: 6 | # git tag -a -m "Tagging v3.0.5" v3.0.5 7 | # git push origin v3.0.5 8 | 9 | MFM_VERSION_MAJOR:=5 10 | MFM_VERSION_MINOR:=1 11 | MFM_VERSION_REV:=1 12 | 13 | ################## NOTHING BELOW HERE SHOULD NEED TO CHANGE ################## 14 | 15 | MFM_VERSION_NUMBER:=$(MFM_VERSION_MAJOR).$(MFM_VERSION_MINOR).$(MFM_VERSION_REV) 16 | 17 | # Suck in a git rep marker if it's been cached 18 | MFM_TREE_VERSION:=unknown-rev 19 | -include $(BASEDIR)/MFM_TREEVERSION.mk 20 | 21 | # If our dir is writable, and we have git, and there's a repo tag, 22 | # that means we are in the MFM_REPO_BUILD_TIME era, so we should cache 23 | # the tag for use in later eras. 24 | SHOULD_CACHE_REPO_TAG_MFM:=$(shell test -w $(BASEDIR) && which git >/dev/null && cd $(BASEDIR) && git describe >/dev/null 2>&1 && echo YES) 25 | #${info AT<<$(realpath $(BASEDIR))>>=($(SHOULD_CACHE_REPO_TAG_MFM))} 26 | ifeq ($(SHOULD_CACHE_REPO_TAG_MFM),YES) 27 | MFM_TREE_VERSION:=$(shell cd $(BASEDIR) && git describe) 28 | $(shell echo "MFM_TREE_VERSION:=$(MFM_TREE_VERSION)" > $(BASEDIR)/MFM_TREEVERSION.mk) 29 | else 30 | endif 31 | export MFM_TREE_VERSION 32 | -------------------------------------------------------------------------------- /doc/dox/bibliography.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \page bibliography Bibliography 3 | 4 | Links to additional material. 5 | 6 | \section bibPapers Papers 7 | 8 | [Five-page intro from 2011](http://www.cs.unm.edu/~ackley/papers/hotos-11.pdf) 9 | 10 | [Longer 2013 paper](http://comjnl.oxfordjournals.org/content/56/12/1450.full.pdf+html) 11 | (winner of [2014 Wilkes Award](http://www.oxfordjournals.org/our_journals/computer_journal/previouswinners.html)) 12 | 13 | \section bibVideos Videos 14 | 15 | Demos built using (various versions of) the MFM simulator: 16 | 17 | [Distributed city generation](https://www.youtube.com/watch?v=XkSXERxucPc) 18 | 19 | [Abstract plant-herbivore coevolutionary model](https://www.youtube.com/watch?v=jQaXtbrVNaU) 20 | 21 | [Eight particles random walking](https://www.youtube.com/watch?v=mhNuB_U-VTs) 22 | 23 | \section bibTuts Tutorials 24 | 25 | [ULAM programming language tutorial](https://github.com/elenasa/ULAM/wiki/Ulam-Programming-Language) 26 | 27 | \cond 28 | \section bibMisc Miscellaneous 29 | 30 | misc1, misc2 31 | \endcond 32 | */ 33 | 34 | -------------------------------------------------------------------------------- /doc/dox/description.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \page description Overview: Best-effort computing 3 | 4 | This codebase implements a simulator—and, hopefully one day 5 | soon, board support for actual hardware—for a computer 6 | architecture known as the "Movable Feast Machine" (MFM). The MFM 7 | is an indefinitely scalable computer architecture, meaning 8 | that the underlying hardware is organized as a tile that can 9 | be duplicated and plugged together to form an arbitrarily large 10 | machine, without ever running into any a priori design 11 | limit such as running out of addresses. 12 | 13 | Only a very brief overview is provided here; for more information, 14 | see the links in \ref bibliography. 15 | 16 | \section rant-intro Moving beyond traditional computer architecture 17 | 18 | Traditional computing is based on a particular division of labor, 19 | an implicit contract, between hardware and software: Hardware 20 | starts from unruly physical reality and produces automated logic; 21 | software starts from automated logic and produces behavior that is 22 | valuable to pay for the hardware and the software both. 23 | 24 | Traditional computing in a nutshell: Hardware provides \em 25 | reliability while software provides \em desirability. 26 | 27 | */ 28 | 29 | -------------------------------------------------------------------------------- /doc/dox/developernotes.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \page developernotes Notes for developers 3 | 4 | So far, this page is a relatively unstructured list of notes, 5 | warnings, gotchas, etc, targetted for source code developers. 6 | 7 | \section naming Naming issues 8 | 9 | \li With very few exceptions, all names defined in this codebase are 10 | (and shall remain) C++ mangled and in the MFM namespace. 11 | 12 | \li \em All exceptions to the previous point --- any and all names 13 | introduced by this codebase that are not C++ mangled or are outside 14 | the MFM namespace --- begin and must begin with 'MFM'. 15 | 16 | \li Most of the known exceptions to date deal with the failure 17 | handling system, which uses C names for several internal entities, 18 | including: 19 | MFMErrorEnvironment, 20 | MFMFailCodeReason, 21 | MFMFailHere, 22 | MFMFailureCodes, 23 | MFMLongJmpHere, 24 | MFMPrintError, 25 | MFMPrintErrorEnvironment, 26 | MFMPtrToErrEnvStackPtr. 27 | 28 | \section debugging Debugging tips 29 | 30 | \li Put a breakpoint at MFMLongJmpHere to break on every FAIL call 31 | \e before the longjmp has occurred, so you can look around in the 32 | context of the failure with the stack intact. 33 | 34 | 35 | 36 | */ 37 | 38 | -------------------------------------------------------------------------------- /doc/dox/license.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \page license License 3 | 4 | The MFMv2 codebase is 5 | \copyright © 2009--2014 The Regents of the University of New Mexico 6 | 7 | This code library, and its associated programs, examples, and 8 | documentation -- collectively described as the "MFMv2 codebase" -- 9 | is free software; you can redistribute it and/or modify it under the 10 | terms of the GNU Lesser General Public License as published by the 11 | Free Software Foundation; either version 3 of the License, or (at 12 | your option) any later version. 13 | 14 | This library is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | Lesser General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with this library; if not, write to the Free Software 21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 22 | USA 23 | 24 | */ 25 | 26 | -------------------------------------------------------------------------------- /doc/dox/mainpage.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \mainpage Movable Feast Machine Version 2 Reference Manual 3 |
4 | \section pageTOC Content 5 | -# \ref description 6 | -# \ref license 7 | -# \ref developernotes 8 | -# \ref bibliography 9 | 10 | */ 11 | -------------------------------------------------------------------------------- /res/elements/README-elements.txt: -------------------------------------------------------------------------------- 1 | This directory for any dynamically-loadable element .so's that live in 2 | the tree but, for whatever reason, aren't built by MFM. 3 | 4 | Sat Jul 11 17:36:24 2015 Which, at present, means 'libuecore.so', the 5 | standard ulam element library, and 'libuedemos.so', a bunch of ulam 6 | element demos. They are built by ULAM but then stuffed in here, so 7 | they're in the MFM distribution and available even if ULAM itself is 8 | not installed on any particular machine. 9 | -------------------------------------------------------------------------------- /res/fonts/Inconsolata.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaveAckley/MFM/873d7ed412f5343ebcbbb0c0d47a6b061aa901f5/res/fonts/Inconsolata.ttf -------------------------------------------------------------------------------- /res/fonts/Mate-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaveAckley/MFM/873d7ed412f5343ebcbbb0c0d47a6b061aa901f5/res/fonts/Mate-Regular.ttf -------------------------------------------------------------------------------- /res/fonts/MateSC-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaveAckley/MFM/873d7ed412f5343ebcbbb0c0d47a6b061aa901f5/res/fonts/MateSC-Regular.ttf -------------------------------------------------------------------------------- /res/fonts/UbuntuMono-B.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaveAckley/MFM/873d7ed412f5343ebcbbb0c0d47a6b061aa901f5/res/fonts/UbuntuMono-B.ttf -------------------------------------------------------------------------------- /res/fonts/UbuntuMono-R.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaveAckley/MFM/873d7ed412f5343ebcbbb0c0d47a6b061aa901f5/res/fonts/UbuntuMono-R.ttf -------------------------------------------------------------------------------- /res/fonts/tiny.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaveAckley/MFM/873d7ed412f5343ebcbbb0c0d47a6b061aa901f5/res/fonts/tiny.ttf -------------------------------------------------------------------------------- /res/images/mfms-icons-ZSHEET.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaveAckley/MFM/873d7ed412f5343ebcbbb0c0d47a6b061aa901f5/res/images/mfms-icons-ZSHEET.png -------------------------------------------------------------------------------- /res/images/t2viz-icons-ZSHEET.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaveAckley/MFM/873d7ed412f5343ebcbbb0c0d47a6b061aa901f5/res/images/t2viz-icons-ZSHEET.png -------------------------------------------------------------------------------- /spikes/connection/Connection.h: -------------------------------------------------------------------------------- 1 | #ifndef CONNECTION_H 2 | #define CONNECTION_H 3 | 4 | #include "../thdque/que.h" 5 | #include "../thdque/itype.h" 6 | 7 | class Connection 8 | { 9 | private: 10 | pthread_mutex_t m_lock; 11 | 12 | ThreadSpike::ThreadQueue m_outbuffer, m_inbuffer; 13 | 14 | public: 15 | 16 | Connection() 17 | { 18 | pthread_mutex_init(&m_lock, NULL); 19 | } 20 | 21 | ~Connection() 22 | { 23 | pthread_mutex_destroy(&m_lock); 24 | } 25 | 26 | bool Lock() 27 | { 28 | return !pthread_mutex_trylock(&m_lock); 29 | } 30 | 31 | void Unlock() 32 | { 33 | pthread_mutex_unlock(&m_lock); 34 | } 35 | 36 | /** 37 | * Reads from the corresponding underlying queue. 38 | * 39 | * @param child This should be true if the calling thread is not 40 | * the owner of this Connection. 41 | * 42 | * @param buffer The location to read bytes into. 43 | * 44 | * @param length The number of bytes to read from the underlying buffer. 45 | * Use 0 if wanting to read as many as possible. 46 | @sa Write 47 | */ 48 | u32 Read(bool child, u8* buffer, u32 length) 49 | { 50 | ThreadSpike::ThreadQueue& queue = child ? m_outbuffer : m_inbuffer; 51 | 52 | return queue.Read(buffer, length); 53 | } 54 | 55 | void Write(bool child, u8* buffer, u32 length) 56 | { 57 | ThreadSpike::ThreadQueue& queue = !child ? m_outbuffer : m_inbuffer; 58 | 59 | queue.Write(buffer, length); 60 | } 61 | 62 | }; 63 | 64 | #endif /* CONNECTION_H */ 65 | -------------------------------------------------------------------------------- /spikes/thdque/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | g++ -g -o thdque thdque.cpp -lpthread 3 | 4 | clean: 5 | rm *.o -------------------------------------------------------------------------------- /spikes/thdque/itype.h: -------------------------------------------------------------------------------- 1 | #ifndef ITYPE_H 2 | #define ITYPE_H 3 | 4 | typedef unsigned int u32; 5 | typedef unsigned short u16; 6 | typedef unsigned char u8; 7 | 8 | typedef signed int s32; 9 | typedef signed short s16; 10 | typedef signed char s8; 11 | 12 | #endif /* ITYPE_H */ 13 | -------------------------------------------------------------------------------- /spikes/thdque/thdque: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaveAckley/MFM/873d7ed412f5343ebcbbb0c0d47a6b061aa901f5/spikes/thdque/thdque -------------------------------------------------------------------------------- /spikes/thdque/thdque.cpp: -------------------------------------------------------------------------------- 1 | #include "spiketests.h" 2 | 3 | int main(int argc, char** argv) 4 | { 5 | return !( 6 | 7 | TestNonBlockingRead() && 8 | TestBlockingRead() 9 | 10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /spikes/video/Makefile: -------------------------------------------------------------------------------- 1 | # Not much to do here 2 | all: 3 | g++ video.c -o video -lpng -lz -lSDL -------------------------------------------------------------------------------- /spikes/video/video: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaveAckley/MFM/873d7ed412f5343ebcbbb0c0d47a6b061aa901f5/spikes/video/video -------------------------------------------------------------------------------- /src/Makefile: -------------------------------------------------------------------------------- 1 | # SUBDIRS are listed in 'likely precedence' order.. If we get that 2 | # right, we ought to be able to build everything in a single pass from 3 | # a realclean start.. 4 | # 5 | # (Note that images/ is not built automatically. We're going to 6 | # commit the results in res/images instead, since the image build 7 | # stuff is rickety and depends on more tools.) 8 | 9 | ifeq ($(PLATFORM),tile) 10 | SUBDIRS=platform-$(MFM_TARGET) core sim gui t2lib drivers 11 | else 12 | SUBDIRS=platform-$(MFM_TARGET) core elements sim gui test drivers 13 | endif 14 | 15 | .PHONY: $(SUBDIRS) all clean realclean 16 | 17 | all: $(SUBDIRS) 18 | 19 | clean: $(SUBDIRS) 20 | @rm -f *~ 21 | 22 | realclean: clean $(SUBDIRS) 23 | 24 | $(SUBDIRS): 25 | $(MAKE) -C $@ $(MAKECMDGOALS) 26 | -------------------------------------------------------------------------------- /src/core/Makefile: -------------------------------------------------------------------------------- 1 | # Who we are 2 | COMPONENTNAME:=core 3 | 4 | # Where's the top 5 | BASEDIR:=../.. 6 | 7 | # What we need from outside 8 | override INCLUDES += 9 | 10 | # Do the library thing 11 | include $(BASEDIR)/config/Makelib.mk 12 | -------------------------------------------------------------------------------- /src/core/include/ByteSink.tcc: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | 3 | namespace MFM { 4 | 5 | template 6 | void ByteSink::PrintInBase(UNSIGNED_TYPE n, u32 base, s32 width, u8 pad) { 7 | MFM_API_ASSERT_ARG(base >= 2 && base <= 36); 8 | 9 | u8 buf[8 * sizeof(UNSIGNED_TYPE)]; // Worst case is binary at 8 u8's per byte 10 | u32 i = 0; 11 | 12 | do { 13 | buf[i++] = (u8) (n % base); 14 | n /= base; 15 | } while (n > 0); 16 | 17 | if (width >= 0) { 18 | u32 uwidth = (u32) width; 19 | while (uwidth > i) { 20 | WriteByte(pad); 21 | --uwidth; 22 | } 23 | } /* XXX Left justified field widths NYI */ 24 | 25 | for (; i > 0; i--) 26 | WriteByte(buf[i - 1] < 10 ? 27 | '0' + buf[i - 1] : 28 | 'A' + buf[i - 1] - 10); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/core/include/Element.tcc: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #include "Fail.h" 3 | #include "Dirs.h" 4 | 5 | namespace MFM 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /src/core/include/EventHistoryItem.tcc: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | 3 | namespace MFM { 4 | 5 | } /* namespace MFM */ 6 | -------------------------------------------------------------------------------- /src/core/include/EventWindowRenderer.tcc: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | 3 | 4 | namespace MFM { 5 | 6 | 7 | } /* namespace MFM */ 8 | -------------------------------------------------------------------------------- /src/core/include/ExperimentValues.h: -------------------------------------------------------------------------------- 1 | #ifndef EXPERIMENT_VALUES_H 2 | #define EXPERIMENT_VALUES_H 3 | 4 | #define EXPERIMENT_WIDTH 400 5 | #define EXPERIMENT_HEIGHT 240 6 | 7 | #endif /* EXPERIMENT_VALUES_H */ 8 | -------------------------------------------------------------------------------- /src/core/include/IsLocal.h: -------------------------------------------------------------------------------- 1 | /* -*- mode:C++ -*- 2 | IsLocal.h See if an address is in the local vars of the current stack frame 3 | Copyright (C) 2017 The Regents of the University of New Mexico. All rights reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 18 | USA 19 | */ 20 | 21 | /** 22 | \file IsLocal.h See if an address is in the local vars of the current stack frame 23 | \author David H. Ackley. 24 | \date (C) 2017 All rights reserved. 25 | \lgpl 26 | */ 27 | #ifndef ISLOCAL_H 28 | #define ISLOCAL_H 29 | 30 | #include "IsLocalPlatformSpecific.h" /* For _IsLocal */ 31 | 32 | #endif /* ISLOCAL_H */ 33 | -------------------------------------------------------------------------------- /src/core/include/MFMSTile.tcc: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #include "MDist.h" 3 | 4 | #include "Util.h" 5 | 6 | namespace MFM 7 | { 8 | 9 | template 10 | MFMSTile::~MFMSTile() {/* defined to avoid inline error */} 11 | 12 | template 13 | bool MFMSTile::IsCacheSitePossibleEventCenter(const SPoint & location) const 14 | { 15 | MFM_API_ASSERT_ARG(this->IsInCache(location)); 16 | THREEDIR cnCacheDirs; 17 | u32 count = this->CacheAt(location, cnCacheDirs, YESCHKCONNECT); 18 | bool isInANeighborsShared = false; 19 | for(u32 i = 0; i < count; i++) 20 | { 21 | Dir dir = cnCacheDirs[i]; 22 | const CacheProcessor& cp = this->GetCacheProcessor(dir); 23 | SPoint remoteloc = cp.LocalToRemote(location); 24 | isInANeighborsShared |= ! this->IsInCache(remoteloc); //all tiles same size 25 | } 26 | return isInANeighborsShared; 27 | } 28 | 29 | template 30 | bool MFMSTile::IsConnected(Dir dir) const 31 | { 32 | const CacheProcessor & cxn = this->GetCacheProcessor(dir); 33 | //return cxn.IsConnected(); 34 | return !cxn.IsUnclaimed() && cxn.IsConnected(); 35 | } 36 | 37 | 38 | } /* namespace MFM */ 39 | -------------------------------------------------------------------------------- /src/core/include/StdEventConfig.h: -------------------------------------------------------------------------------- 1 | /* -*- mode:C++ -*- 2 | StdEventConfig.h Default compile-time parameters up to the event level 3 | Copyright (C) 2014, 2015 The Regents of the University of New Mexico. All rights reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 18 | USA 19 | */ 20 | 21 | /** 22 | \file StdEventConfig.h Default compile-time parameters up to the event level 23 | \author David H. Ackley. 24 | \date (C) 2014, 2015 All rights reserved. 25 | \lgpl 26 | */ 27 | #ifndef STDEVENTCONFIG_H 28 | #define STDEVENTCONFIG_H 29 | 30 | #include "AtomConfig.h" 31 | #include "EventConfig.h" 32 | #include "Site.h" 33 | #include "P3Atom.h" 34 | 35 | namespace MFM { 36 | typedef P3Atom StdAtom; 37 | typedef Site StdSite; 38 | typedef EventConfig StdEventConfig; 39 | } 40 | 41 | #endif /* STDEVENTCONFIG_H */ 42 | -------------------------------------------------------------------------------- /src/core/include/UlamContext.tcc: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #include "Fail.h" 3 | #include "Tile.h" 4 | #include "Random.h" 5 | #include "EventWindow.h" 6 | #include "ElementTable.h" 7 | #include "UlamClassRegistry.h" 8 | 9 | namespace MFM { 10 | 11 | template class UlamElement; //forward 12 | template class UlamClass; //forward 13 | 14 | template 15 | UlamContext::UlamContext(const UlamContext& cxref) 16 | : m_elementTable(cxref.m_elementTable) { } 17 | 18 | template 19 | const Element * UlamContext::LookupElementTypeFromContext(u32 etype) const 20 | { 21 | return m_elementTable.Lookup(etype); 22 | } //LookupElementTypeFromContext 23 | 24 | template 25 | const UlamClass * UlamContext::LookupUlamElementTypeFromContext(u32 etype) const 26 | { 27 | const Element * eltptr = this->LookupElementTypeFromContext(etype); 28 | if (!eltptr) return NULL; 29 | const UlamElement * ueltptr = eltptr->AsUlamElement(); 30 | return ueltptr; //might be NULL 31 | } //LookupUlamElementTypeFromContext 32 | 33 | } //MFM 34 | -------------------------------------------------------------------------------- /src/core/include/UlamContextEvent.tcc: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #include "Tile.h" 3 | #include "Random.h" 4 | #include "EventWindow.h" 5 | #include "Base.h" 6 | #include "Site.h" 7 | //#include "UlamClass.h" 8 | //#include "UlamElement.h" 9 | 10 | namespace MFM { 11 | 12 | template class UlamElement; //forward 13 | template class UlamClass; //forward 14 | 15 | template 16 | UlamContextEvent::UlamContextEvent(const UlamContextEvent& cxref) 17 | : UlamContext(cxref.m_elementTable) 18 | , m_tile(cxref.m_tile) 19 | { } 20 | 21 | template 22 | void UlamContextEvent::SetTile(Tile & t) 23 | { 24 | MFM_API_ASSERT_STATE(!m_tile); 25 | m_tile = & t; 26 | } 27 | 28 | template 29 | void UlamContextEvent::AssertTile() const 30 | { 31 | MFM_API_ASSERT_STATE(m_tile); 32 | } 33 | 34 | template 35 | Tile & UlamContextEvent::GetTile() 36 | { 37 | AssertTile(); 38 | return * m_tile; 39 | } 40 | 41 | template 42 | const Tile & UlamContextEvent::GetTile() const 43 | { 44 | AssertTile(); 45 | return * m_tile; 46 | } 47 | 48 | } //MFM 49 | -------------------------------------------------------------------------------- /src/core/include/UlamContextRestricted.tcc: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #include "Tile.h" 3 | #include "Random.h" 4 | #include "EventWindow.h" 5 | #include "Base.h" 6 | #include "Site.h" 7 | //#include "UlamClass.h" 8 | //#include "UlamElement.h" 9 | 10 | namespace MFM { 11 | 12 | template class UlamElement; //forward 13 | template class UlamClass; //forward 14 | 15 | template 16 | UlamContextRestricted::UlamContextRestricted(const UlamContextRestricted& cxref) 17 | : UlamContext(cxref.m_elementTable) 18 | , m_ucr(cxref.m_ucr) 19 | { } 20 | 21 | } //MFM 22 | -------------------------------------------------------------------------------- /src/core/include/UlamQuark.tcc: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #include "Fail.h" 3 | #include "Tile.h" 4 | #include "Random.h" 5 | #include "EventWindow.h" 6 | #include "Base.h" 7 | 8 | namespace MFM { 9 | 10 | } //MFM 11 | -------------------------------------------------------------------------------- /src/core/include/UlamRefMutable.tcc: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | 3 | namespace MFM { 4 | 5 | template 6 | UlamRefMutable::UlamRefMutable() 7 | : m_ucptr(NULL) 8 | , m_effSelf(NULL) 9 | , m_stgptr(NULL) 10 | , m_prevur(NULL) 11 | , m_pos(0) 12 | , m_len(0) 13 | , m_usage(UlamRef::PRIMITIVE) 14 | , m_posToEff(0) 15 | , m_vtableclassid(0) 16 | , m_dmOffsetInStg(0) 17 | { } 18 | 19 | template 20 | UlamRefMutable& UlamRefMutable::operator=(const UlamRef& rhs) 21 | { 22 | m_ucptr = rhs.GetContextAsPointer(); 23 | m_effSelf = rhs.GetEffectiveSelfPointer(); 24 | m_stgptr = & rhs.GetStorage(); 25 | m_prevur = rhs.GetPreviousUlamRefPtr(); 26 | m_pos = rhs.GetPos(); 27 | m_len = rhs.GetLen(); 28 | m_usage = rhs.GetUsage(); 29 | m_posToEff = rhs.GetPosToEffectiveSelf(); 30 | m_vtableclassid = rhs.GetVTableClassId(); 31 | return *this; 32 | } 33 | 34 | } //MFM 35 | -------------------------------------------------------------------------------- /src/core/include/UlamTransient.tcc: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #include "Fail.h" 3 | #include "Tile.h" 4 | #include "Random.h" 5 | #include "EventWindow.h" 6 | #include "Base.h" 7 | 8 | namespace MFM { 9 | 10 | } //MFM 11 | -------------------------------------------------------------------------------- /src/core/src/AbstractChannel.cpp: -------------------------------------------------------------------------------- 1 | #include "AbstractChannel.h" 2 | -------------------------------------------------------------------------------- /src/core/src/Atom.cpp: -------------------------------------------------------------------------------- 1 | #include "Atom.h" 2 | 3 | namespace MFM { 4 | } /* namespace MFM */ 5 | -------------------------------------------------------------------------------- /src/core/src/AtomConfig.cpp: -------------------------------------------------------------------------------- 1 | #include "AtomConfig.h" 2 | -------------------------------------------------------------------------------- /src/core/src/AtomSerializer.cpp: -------------------------------------------------------------------------------- 1 | #include "AtomSerializer.h" 2 | -------------------------------------------------------------------------------- /src/core/src/Base.cpp: -------------------------------------------------------------------------------- 1 | #include "Base.h" 2 | -------------------------------------------------------------------------------- /src/core/src/BitField.cpp: -------------------------------------------------------------------------------- 1 | #include "BitField.h" 2 | -------------------------------------------------------------------------------- /src/core/src/BitStorage.cpp: -------------------------------------------------------------------------------- 1 | #include "BitStorage.h" 2 | -------------------------------------------------------------------------------- /src/core/src/BitVector.cpp: -------------------------------------------------------------------------------- 1 | #include "BitVector.h" 2 | -------------------------------------------------------------------------------- /src/core/src/ByteSerializable.cpp: -------------------------------------------------------------------------------- 1 | #include "ByteSerializable.h" 2 | 3 | namespace MFM { 4 | NullByteSerializable NullSerializable; 5 | } 6 | -------------------------------------------------------------------------------- /src/core/src/CacheProcessor.cpp: -------------------------------------------------------------------------------- 1 | #include "CacheProcessor.h" 2 | -------------------------------------------------------------------------------- /src/core/src/ChannelEnd.cpp: -------------------------------------------------------------------------------- 1 | #include "ChannelEnd.h" 2 | #include "PacketIO.h" 3 | 4 | namespace MFM 5 | { 6 | void ChannelEnd::ReportChannelEndStatus(Logger::Level level) 7 | { 8 | LOG.Log(level," ==ChannelEnd %p [chn %p] ==", 9 | (void*) this, 10 | (void*) m_channel); 11 | LOG.Log(level," PacketLength: %d", m_packetLength); 12 | LOG.Log(level," Pending length: %d", m_packetBuffer.GetLength()); 13 | } 14 | 15 | PacketBuffer * ChannelEnd::ReceivePacket() 16 | { 17 | // Step 1: If a packet has not been started, try to start it 18 | if (m_packetLength < 0) 19 | { 20 | s32 byte = ReadByte(); 21 | if (byte < 0) 22 | { 23 | return 0; // Nothing there.. 24 | } 25 | m_packetLength = byte; // OK, packet started! 26 | m_packetBuffer.Reset(); 27 | } 28 | 29 | // Step 2: If a packet is not yet finished, try to read enough to finish it 30 | while (m_packetBuffer.GetLength() < (u32) m_packetLength) 31 | { 32 | s32 byte = ReadByte(); 33 | if (byte < 0) 34 | { 35 | return 0; // Split packet. Well damn. Later. 36 | } 37 | m_packetBuffer.Print((u32) byte, Format::BYTE); 38 | } 39 | 40 | // Step 3: Privately mark packet done; let caller see what we got 41 | m_packetLength = -1; 42 | return & m_packetBuffer; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/core/src/CharBufferByteSink.cpp: -------------------------------------------------------------------------------- 1 | #include "CharBufferByteSink.h" 2 | -------------------------------------------------------------------------------- /src/core/src/CharBufferByteSource.cpp: -------------------------------------------------------------------------------- 1 | #include "CharBufferByteSource.h" 2 | -------------------------------------------------------------------------------- /src/core/src/Element.cpp: -------------------------------------------------------------------------------- 1 | #include "Element.h" 2 | -------------------------------------------------------------------------------- /src/core/src/ElementTable.cpp: -------------------------------------------------------------------------------- 1 | #include "ElementTable.h" 2 | -------------------------------------------------------------------------------- /src/core/src/ElementTypeNumberMap.cpp: -------------------------------------------------------------------------------- 1 | #include "ElementTypeNumberMap.h" 2 | -------------------------------------------------------------------------------- /src/core/src/ElementUtils.cpp: -------------------------------------------------------------------------------- 1 | #include "ElementUtils.h" 2 | 3 | namespace MFM 4 | { 5 | namespace ElementUtils 6 | { 7 | const SPoint VNNeighbors[4] = 8 | { 9 | SPoint(-1, 0), SPoint(1, 0), SPoint(0, -1), SPoint(0, 1) 10 | }; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/core/src/Element_Empty.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Empty.h" 2 | -------------------------------------------------------------------------------- /src/core/src/EventConfig.cpp: -------------------------------------------------------------------------------- 1 | #include "EventConfig.h" 2 | -------------------------------------------------------------------------------- /src/core/src/EventHistoryBuffer.cpp: -------------------------------------------------------------------------------- 1 | #include "EventHistoryBuffer.h" 2 | -------------------------------------------------------------------------------- /src/core/src/EventHistoryItem.cpp: -------------------------------------------------------------------------------- 1 | #include "EventHistoryItem.h" 2 | 3 | namespace MFM { 4 | 5 | void EventHistoryItem::Print(ByteSink & bs) const 6 | { 7 | bs.Printf("[EHI-%s",GetTypeName()); 8 | if (IsHeader()) 9 | { 10 | bs.Printf(",count=%d,site=(%d,%d),event#=%d", 11 | mHeaderItem.m_count, 12 | mHeaderItem.m_siteInTileX, 13 | mHeaderItem.m_siteInTileY, 14 | mHeaderItem.m_eventNumber); 15 | 16 | } 17 | else if (IsDelta()) 18 | { 19 | bs.Printf(",#=%d,code=%d,word=%d,old=%08x,new=%08x", 20 | mDeltaItem.m_count, 21 | mDeltaItem.m_site, 22 | mDeltaItem.m_word, 23 | mDeltaItem.m_oldValue, 24 | mDeltaItem.m_newValue); 25 | } 26 | bs.Printf("]"); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/core/src/EventWindow.cpp: -------------------------------------------------------------------------------- 1 | #include "EventWindow.h" 2 | -------------------------------------------------------------------------------- /src/core/src/EventWindowRenderer.cpp: -------------------------------------------------------------------------------- 1 | #include "EventWindowRenderer.h" 2 | -------------------------------------------------------------------------------- /src/core/src/Fail.cpp: -------------------------------------------------------------------------------- 1 | extern "C" { 2 | #include "Fail.h" 3 | 4 | static const char * FailStrings[] = { 5 | "zero unused", 6 | #define XX(x) #x, 7 | #include "FailCodes.h" 8 | #undef XX 9 | "max failure code" 10 | }; 11 | 12 | const char * MFMFailCodeReason(int failCode) { 13 | if (failCode < 0 || failCode >= (int) (sizeof(FailStrings)/sizeof(FailStrings[0]))) 14 | return 0; 15 | return FailStrings[failCode]; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/core/src/FailCodes.cpp: -------------------------------------------------------------------------------- 1 | /* Note: failCodes.h is included by fail.h and fail.cpp. This file 2 | should always remain empty except for this message */ 3 | -------------------------------------------------------------------------------- /src/core/src/Format.cpp: -------------------------------------------------------------------------------- 1 | #include "Format.h" 2 | -------------------------------------------------------------------------------- /src/core/src/GlobalHooks.cpp: -------------------------------------------------------------------------------- 1 | #include "GlobalHooks.h" 2 | 3 | namespace MFM { 4 | GlobalHooks & GlobalHooks::getSingleton() { 5 | static GlobalHooks theDisgustingGlobalHooks; 6 | return theDisgustingGlobalHooks; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/core/src/LineCountingByteSource.cpp: -------------------------------------------------------------------------------- 1 | #include "LineCountingByteSource.h" 2 | -------------------------------------------------------------------------------- /src/core/src/LineTailByteSink.cpp: -------------------------------------------------------------------------------- 1 | #include "LineTailByteSink.h" 2 | -------------------------------------------------------------------------------- /src/core/src/Logger.cpp: -------------------------------------------------------------------------------- 1 | #include "Logger.h" 2 | 3 | namespace MFM { 4 | 5 | Logger LOG(DevNullByteSink, Logger::ERROR); 6 | } 7 | -------------------------------------------------------------------------------- /src/core/src/LonglivedLock.cpp: -------------------------------------------------------------------------------- 1 | #include "LonglivedLock.h" 2 | -------------------------------------------------------------------------------- /src/core/src/MDist.cpp: -------------------------------------------------------------------------------- 1 | #include "MDist.h" 2 | 3 | 4 | namespace MFM { 5 | } /* namespace MFM */ 6 | 7 | -------------------------------------------------------------------------------- /src/core/src/MFMSTile.cpp: -------------------------------------------------------------------------------- 1 | #include "MFMSTile.h" 2 | -------------------------------------------------------------------------------- /src/core/src/Mutex.cpp: -------------------------------------------------------------------------------- 1 | #include "Mutex.h" 2 | #include "Logger.h" 3 | 4 | namespace MFM 5 | { 6 | void Mutex::ReportMutexStatus(int ilevel) 7 | { 8 | Logger::Level level = (Logger::Level) ilevel; 9 | if (m_locked) 10 | { 11 | LOG.Log(level," Mutex %p is locked by thread %p", 12 | (void*) this, 13 | (void*) m_threadId); 14 | } 15 | else 16 | { 17 | LOG.Log(level," Mutex %p is unlocked", 18 | (void*) this); 19 | } 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/core/src/OverflowableCharBufferByteSink.cpp: -------------------------------------------------------------------------------- 1 | #include "OverflowableCharBufferByteSink.h" 2 | -------------------------------------------------------------------------------- /src/core/src/P3Atom.cpp: -------------------------------------------------------------------------------- 1 | #include "P3Atom.h" 2 | -------------------------------------------------------------------------------- /src/core/src/PSym.cpp: -------------------------------------------------------------------------------- 1 | #include "PSym.h" 2 | -------------------------------------------------------------------------------- /src/core/src/Packet.cpp: -------------------------------------------------------------------------------- 1 | #include "Packet.h" 2 | -------------------------------------------------------------------------------- /src/core/src/PacketIO.cpp: -------------------------------------------------------------------------------- 1 | #include "PacketIO.h" 2 | -------------------------------------------------------------------------------- /src/core/src/Parameter.cpp: -------------------------------------------------------------------------------- 1 | #include "Parameter.h" 2 | 3 | -------------------------------------------------------------------------------- /src/core/src/Point.cpp: -------------------------------------------------------------------------------- 1 | #include "Point.h" 2 | 3 | namespace MFM 4 | { 5 | UPoint MakeUnsigned(const SPoint & spoint) 6 | { 7 | MFM_API_ASSERT_ARG(CanMakeUnsigned(spoint)); 8 | return UPoint((u32) spoint.GetX(), (u32) spoint.GetY()); 9 | } 10 | 11 | SPoint MakeSigned(const UPoint & upoint) 12 | { 13 | MFM_API_ASSERT_ARG(CanMakeSigned(upoint)); 14 | return SPoint((s32) upoint.GetX(), (s32) upoint.GetY()); 15 | } 16 | 17 | } /* namespace MFM */ 18 | -------------------------------------------------------------------------------- /src/core/src/Random.cpp: -------------------------------------------------------------------------------- 1 | #include "Random.h" 2 | 3 | namespace MFM { 4 | } /* namespace MFM */ 5 | -------------------------------------------------------------------------------- /src/core/src/Rect.cpp: -------------------------------------------------------------------------------- 1 | #include "Rect.h" 2 | 3 | namespace MFM 4 | { 5 | 6 | void Rect::IntersectWith(const Rect & other) 7 | { 8 | SPoint startInt = max(this->m_position, other.m_position); 9 | 10 | SPoint endThis = m_position + MakeSigned(m_size); 11 | SPoint endOthr = other.m_position + MakeSigned(other.m_size); 12 | SPoint endInt = max(startInt, min(endThis,endOthr)); 13 | 14 | m_position = startInt; 15 | m_size = MakeUnsigned(endInt-startInt); 16 | } 17 | 18 | } /* namespace MFM */ 19 | -------------------------------------------------------------------------------- /src/core/src/Sense.cpp: -------------------------------------------------------------------------------- 1 | #include "Sense.h" 2 | -------------------------------------------------------------------------------- /src/core/src/Site.cpp: -------------------------------------------------------------------------------- 1 | #include "Site.h" 2 | -------------------------------------------------------------------------------- /src/core/src/SizedTile.cpp: -------------------------------------------------------------------------------- 1 | #include "SizedTile.h" 2 | -------------------------------------------------------------------------------- /src/core/src/StdEventConfig.cpp: -------------------------------------------------------------------------------- 1 | #include "StdEventConfig.h" 2 | -------------------------------------------------------------------------------- /src/core/src/TeeByteSink.cpp: -------------------------------------------------------------------------------- 1 | #include "TeeByteSink.h" 2 | -------------------------------------------------------------------------------- /src/core/src/Tile.cpp: -------------------------------------------------------------------------------- 1 | #include "Tile.h" 2 | -------------------------------------------------------------------------------- /src/core/src/UlamClass.cpp: -------------------------------------------------------------------------------- 1 | #include "UlamClass.h" 2 | 3 | namespace MFM { 4 | 5 | } //MFM 6 | -------------------------------------------------------------------------------- /src/core/src/UlamClassRegistry.cpp: -------------------------------------------------------------------------------- 1 | #include "UlamClassRegistry.h" 2 | 3 | namespace MFM { 4 | 5 | } //MFM 6 | -------------------------------------------------------------------------------- /src/core/src/UlamContext.cpp: -------------------------------------------------------------------------------- 1 | #include "UlamContext.h" 2 | 3 | namespace MFM 4 | { 5 | } //MFM 6 | -------------------------------------------------------------------------------- /src/core/src/UlamContextEvent.cpp: -------------------------------------------------------------------------------- 1 | #include "UlamContextEvent.h" 2 | 3 | namespace MFM 4 | { 5 | } //MFM 6 | -------------------------------------------------------------------------------- /src/core/src/UlamContextRestricted.cpp: -------------------------------------------------------------------------------- 1 | #include "UlamContextRestricted.h" 2 | 3 | namespace MFM 4 | { 5 | } //MFM 6 | -------------------------------------------------------------------------------- /src/core/src/UlamDefs.cpp: -------------------------------------------------------------------------------- 1 | #include "UlamDefs.h" 2 | -------------------------------------------------------------------------------- /src/core/src/UlamElement.cpp: -------------------------------------------------------------------------------- 1 | #include "UlamElement.h" 2 | 3 | namespace MFM 4 | { 5 | } //MFM 6 | -------------------------------------------------------------------------------- /src/core/src/UlamQuark.cpp: -------------------------------------------------------------------------------- 1 | #include "UlamQuark.h" 2 | 3 | 4 | namespace MFM 5 | { 6 | 7 | } //MFM 8 | -------------------------------------------------------------------------------- /src/core/src/UlamRef.cpp: -------------------------------------------------------------------------------- 1 | #include "UlamRef.h" 2 | -------------------------------------------------------------------------------- /src/core/src/UlamRefMutable.cpp: -------------------------------------------------------------------------------- 1 | #include "UlamRefMutable.h" 2 | -------------------------------------------------------------------------------- /src/core/src/UlamTransient.cpp: -------------------------------------------------------------------------------- 1 | #include "UlamTransient.h" 2 | 3 | 4 | namespace MFM 5 | { 6 | 7 | } //MFM 8 | -------------------------------------------------------------------------------- /src/core/src/UlamVTableEntry.cpp: -------------------------------------------------------------------------------- 1 | #include "UlamVTableEntry.h" 2 | -------------------------------------------------------------------------------- /src/core/src/VD.cpp: -------------------------------------------------------------------------------- 1 | #include "VD.h" 2 | 3 | namespace MFM 4 | { 5 | const char *(VD::m_typeNames[TYPE_COUNT]) = 6 | { 7 | "INVALID", 8 | "U32", 9 | "S32", 10 | "BOOL", 11 | "UNARY", 12 | "BITS" 13 | }; 14 | } 15 | -------------------------------------------------------------------------------- /src/core/src/Version.cpp: -------------------------------------------------------------------------------- 1 | #include "Version.h" 2 | 3 | #define xstr(s) str(s) 4 | #define str(s) #s 5 | 6 | namespace MFM { 7 | const char * MFM_VERSION_STRING_SHORT = 8 | "MFM-" 9 | xstr(MFM_VERSION_MAJOR) "." 10 | xstr(MFM_VERSION_MINOR) "." 11 | xstr(MFM_VERSION_REV); 12 | const char * MFM_VERSION_STRING_LONG = 13 | "MFM-" xstr(MFM_VERSION_MAJOR) "." xstr(MFM_VERSION_MINOR) "." xstr(MFM_VERSION_REV) 14 | " on " xstr(MFM_BUILD_DATE) "+" xstr(MFM_BUILD_TIME) 15 | " by " xstr(MFM_BUILT_BY) "@" xstr(MFM_BUILT_ON) 16 | " of " xstr(MFM_TREE_VERSION) 17 | ; 18 | const char * MFM_TREE_VERSION_STRING = 19 | "MFM-" 20 | xstr(MFM_TREE_VERSION); 21 | } 22 | -------------------------------------------------------------------------------- /src/core/src/WindowScanner.cpp: -------------------------------------------------------------------------------- 1 | #include "WindowScanner.h" 2 | -------------------------------------------------------------------------------- /src/core/src/ZStringByteSource.cpp: -------------------------------------------------------------------------------- 1 | #include "ZStringByteSource.h" 2 | -------------------------------------------------------------------------------- /src/core/src/itype.cpp: -------------------------------------------------------------------------------- 1 | #include "itype.h" 2 | -------------------------------------------------------------------------------- /src/drivers/Makefile: -------------------------------------------------------------------------------- 1 | # SUBDIRS here are expected to be independent of each other 2 | ifeq ($(PLATFORM),tile) 3 | SUBDIRS= mfmt2 mfzrun stub 4 | else 5 | SUBDIRS= mfmc mfmtest mfzrun # ulamtest # mfmdha mfmsim mfmbigtile mfmcity #mfmheadless 6 | endif 7 | 8 | .PHONY: $(SUBDIRS) all clean realclean 9 | 10 | all: $(SUBDIRS) 11 | 12 | clean: $(SUBDIRS) 13 | @rm -f *~ 14 | 15 | realclean: clean $(SUBDIRS) 16 | 17 | $(SUBDIRS): 18 | $(MAKE) -C $@ $(MAKECMDGOALS) 19 | -------------------------------------------------------------------------------- /src/drivers/mfmbigtile/Makefile: -------------------------------------------------------------------------------- 1 | # Who we are 2 | COMPONENTNAME:=mfmbigtile 3 | 4 | # Where's the top 5 | BASEDIR:=../../.. 6 | 7 | # What we need to build 8 | override INCLUDES += -I $(BASEDIR)/src/core/include -I $(BASEDIR)/src/elements/include -I $(BASEDIR)/src/sim/include -I $(BASEDIR)/src/gui/include 9 | override INCLUDES += $(shell sdl-config --cflags) 10 | 11 | # What we need to link 12 | override LIBS += -L $(BASEDIR)/build/core/ -L $(BASEDIR)/build/sim/ -L $(BASEDIR)/build/gui/ 13 | override LIBS += -lmfmgui -lmfmsim -lmfmcore -lSDL -lSDL_ttf -lSDL_image -lpng -lm 14 | 15 | # Do the program thing 16 | include $(BASEDIR)/config/Makeprog.mk 17 | -------------------------------------------------------------------------------- /src/drivers/mfmbigtile/include/main.h: -------------------------------------------------------------------------------- 1 | #ifndef MAIN_H 2 | #define MAIN_H 3 | 4 | #include "AbstractGUIDriver.h" 5 | #include "P1Atom.h" 6 | 7 | #include "EventWindow.h" 8 | #include "Element_Empty.h" 9 | #include "Element_Dreg.h" 10 | #include "Element_Res.h" 11 | #include "Element_Sorter.h" 12 | #include "Element_Emitter.h" 13 | #include "Element_Consumer.h" 14 | #include "Element_Data.h" 15 | #include "Element_Wall.h" 16 | 17 | #endif /* MAIN_H */ 18 | -------------------------------------------------------------------------------- /src/drivers/mfmc/Makefile: -------------------------------------------------------------------------------- 1 | all program clean realclean: FORCE 2 | #make -k -f Makefile-CL.mk $(MAKECMDGOALS) 3 | make -k -f Makefile-GUI.mk $(MAKECMDGOALS) 4 | 5 | .PHONY: FORCE 6 | -------------------------------------------------------------------------------- /src/drivers/mfmc/Makefile-CL.mk: -------------------------------------------------------------------------------- 1 | # Who we are 2 | COMPONENTNAME:=mfmcl 3 | 4 | # Our aliases 5 | COMPONENTALIASES:= $(COMPONENTNAME)_s $(COMPONENTNAME)_m $(COMPONENTNAME)_l 6 | 7 | # Where's the top 8 | BASEDIR:=../../.. 9 | 10 | # Depend on us too 11 | ALLDEP += $(BASEDIR)/src/drivers/mfmc/Makefile-CL.mk 12 | 13 | # What we need to build 14 | override INCLUDES += -I $(BASEDIR)/src/core/include -I $(BASEDIR)/src/elements/include -I $(BASEDIR)/src/sim/include 15 | 16 | # What we need to link 17 | override LIBS += -L $(BASEDIR)/build/core/ -L $(BASEDIR)/build/elements/ -L $(BASEDIR)/build/sim/ 18 | override LIBS += -lmfmsim -lmfmelements -Wl,--whole-archive -lmfmcore -Wl,--no-whole-archive -lm 19 | 20 | # Do the program thing 21 | include $(BASEDIR)/config/Makeprog.mk 22 | -------------------------------------------------------------------------------- /src/drivers/mfmc/Makefile-GUI.mk: -------------------------------------------------------------------------------- 1 | # Who we are 2 | COMPONENTNAME:=mfms 3 | 4 | # Our aliases 5 | COMPONENTALIASES:= $(COMPONENTNAME)_s $(COMPONENTNAME)_m $(COMPONENTNAME)_l 6 | 7 | # Where's the top 8 | BASEDIR:=../../.. 9 | 10 | # Depend on us too 11 | ALLDEP += $(BASEDIR)/src/drivers/mfmc/Makefile-GUI.mk 12 | 13 | # What we need to build 14 | override INCLUDES += -I $(BASEDIR)/src/core/include -I $(BASEDIR)/src/elements/include -I $(BASEDIR)/src/sim/include -I $(BASEDIR)/src/gui/include 15 | override INCLUDES += $(shell sdl-config --cflags) 16 | override DEFINES += -D MFM_GUI_DRIVER 17 | 18 | # What we need to link 19 | override LIBS += -L $(BASEDIR)/build/core/ -L $(BASEDIR)/build/elements/ -L $(BASEDIR)/build/sim/ -L $(BASEDIR)/build/gui/ 20 | override LIBS += -lmfmgui -lmfmsim -lmfmelements -Wl,--whole-archive -lmfmcore -Wl,--no-whole-archive -lSDL -lSDL_ttf -lSDL_image -lpng -lm 21 | 22 | # Do the program thing 23 | include $(BASEDIR)/config/Makeprog.mk 24 | -------------------------------------------------------------------------------- /src/drivers/mfmc/include/TileSizes.inc: -------------------------------------------------------------------------------- 1 | 2 | /* Tile codes don't have to start with A, but whatever tiles sizes are 3 | configured must have consecutive letter codes! Here we support A-J 4 | by default, or A-M if EXTRA_TILE_SIZES is defined. Every tile size 5 | that is included implies another huge pile of templates for g++ to 6 | instantiate, slowing the MFM build time. 7 | Width,Height values may be different (H-J); 8 | Usage: ./bin/mfms {ctr}|{{ctr}} 9 | where c is number of columns, t is Tile code, r is number of rows, 10 | and double braces is for a staggered grid layout 11 | */ 12 | 13 | #ifdef EXTRA_TILE_SIZES 14 | #endif /*EXTRA_TILE_SIZES*/ 15 | 16 | XX(A,48+8,32+8) /* T2 tile size doh! */ 17 | XX(B,32,32) 18 | XX(C,40,40) 19 | XX(D,54,54) 20 | XX(E,72,72) 21 | XX(F,98,98) 22 | XX(G,136,136) 23 | XX(H,60,40) 24 | XX(I,80,40) 25 | XX(J,128,76) 26 | 27 | 28 | #ifdef EXTRA_TILE_SIZES 29 | XX(K,188,188) 30 | XX(L,264,264) 31 | XX(M,370,370) 32 | #endif /*EXTRA_TILE_SIZES*/ 33 | -------------------------------------------------------------------------------- /src/drivers/mfmc/include/main.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef MAIN_H 3 | #define MAIN_H 4 | 5 | #include "itype.h" 6 | #include "AbstractDualDriver.h" 7 | #include "P3Atom.h" 8 | #include "GridConfig.h" 9 | #include "DateTimeStamp.h" 10 | #include "Element_Dreg.h" 11 | #include "Element_Res.h" 12 | #include "Element_Creg.h" 13 | 14 | #include "Element_City_Building.h" 15 | #include "Element_City_Car.h" 16 | #include "Element_City_Intersection.h" 17 | #include "Element_City_Park.h" 18 | #include "Element_City_Sidewalk.h" 19 | #include "Element_City_Street.h" 20 | 21 | #endif /* MAIN_H */ 22 | -------------------------------------------------------------------------------- /src/drivers/mfmdha/Makefile: -------------------------------------------------------------------------------- 1 | # Who we are 2 | COMPONENTNAME:=mfmdha 3 | 4 | # Where's the top 5 | BASEDIR:=../../.. 6 | 7 | # What we need to build 8 | override INCLUDES += -I $(BASEDIR)/src/core/include -I $(BASEDIR)/src/elements/include -I $(BASEDIR)/src/sim/include -I $(BASEDIR)/src/gui/include 9 | override INCLUDES += $(shell sdl-config --cflags) 10 | 11 | # What we need to link 12 | override LIBS += -L $(BASEDIR)/build/core/ -L $(BASEDIR)/build/sim/ -L $(BASEDIR)/build/gui/ 13 | override LIBS += -lmfmgui -lmfmsim -lmfmcore -lSDL_ttf -lSDL_image -lSDL -lpng -lm 14 | 15 | # Do the program thing 16 | include $(BASEDIR)/config/Makeprog.mk 17 | 18 | #### TESTING: Build $(BINDIR)/qbar.so for dlopen 19 | 20 | ## Main executable needs -rdynamic to expose its symbols to dlopen'd stuff 21 | LDFLAGS += -rdynamic 22 | 23 | # Add dependency to make the plugin 24 | $(BINDIR)/$(COMPONENTNAME): $(BINDIR)/Element_MQBar-Plugin.so 25 | 26 | $(BINDIR)/Element_MQBar-Plugin.so: src/Element_MQBar.cpp include/Element_MQBar.h 27 | $(GPP) -shared -fPIC -DELEMENT_PLUG_IN $(OPTS) $(DEBUGS) $(CPPFLAGS) $(DEFINES) -o"$@" "$<" 28 | -------------------------------------------------------------------------------- /src/drivers/mfmdha/include/Element_Boids.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Boids.h" 2 | 3 | -------------------------------------------------------------------------------- /src/drivers/mfmdha/include/Element_Boids1.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Boids1.h" 2 | 3 | -------------------------------------------------------------------------------- /src/drivers/mfmdha/include/Element_Boids1.h: -------------------------------------------------------------------------------- 1 | #ifndef ELEMENT_BOIDS1_H /* -*- C++ -*- */ 2 | #define ELEMENT_BOIDS1_H 3 | 4 | #include "Element_Boids.h" 5 | 6 | namespace MFM 7 | { 8 | 9 | template 10 | class Element_Boids1 : public Element_Boids 11 | { 12 | // Extract short names for parameter types 13 | typedef typename CC::ATOM_TYPE T; 14 | typedef typename CC::PARAM_CONFIG P; 15 | 16 | public: 17 | 18 | const char* GetName() const { return "B1"; } 19 | 20 | static Element_Boids1 THE_INSTANCE; 21 | static const u32 SUB_TYPE = 1; 22 | static const u32 TYPE = Element_Boids::TYPE|(SUB_TYPE<::TYPE_BITS); 23 | 24 | Element_Boids1() { } 25 | 26 | virtual const T & GetDefaultAtom() const 27 | { 28 | static T defaultAtom(TYPE,0,0,Element_Boids::STATE_BITS); 29 | return defaultAtom; 30 | } 31 | 32 | virtual u32 GetElementColor() const 33 | { 34 | return 0xff00f0f0; 35 | } 36 | }; 37 | 38 | template 39 | Element_Boids1 Element_Boids1::THE_INSTANCE; 40 | 41 | } 42 | 43 | #endif /* ELEMENT_BOIDS1_H */ 44 | -------------------------------------------------------------------------------- /src/drivers/mfmdha/include/Element_Boids2.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Boids.h" 2 | 3 | -------------------------------------------------------------------------------- /src/drivers/mfmdha/include/Element_Boids2.h: -------------------------------------------------------------------------------- 1 | #ifndef ELEMENT_BOIDS2_H /* -*- C++ -*- */ 2 | #define ELEMENT_BOIDS2_H 3 | 4 | #include "Element_Boids.h" 5 | 6 | namespace MFM 7 | { 8 | 9 | template 10 | class Element_Boids2 : public Element_Boids 11 | { 12 | // Extract short names for parameter types 13 | typedef typename CC::ATOM_TYPE T; 14 | typedef typename CC::PARAM_CONFIG P; 15 | public: 16 | const char* GetName() const { return "B2"; } 17 | 18 | static Element_Boids2 THE_INSTANCE; 19 | static const u32 SUB_TYPE = 2; 20 | static const u32 TYPE = Element_Boids::TYPE|(SUB_TYPE<::TYPE_BITS); 21 | 22 | Element_Boids2() { } 23 | 24 | virtual const T & GetDefaultAtom() const 25 | { 26 | static T defaultAtom(TYPE,0,0,Element_Boids::STATE_BITS); 27 | return defaultAtom; 28 | } 29 | 30 | virtual u32 GetElementColor() const 31 | { 32 | return 0xfff00000; 33 | } 34 | }; 35 | 36 | template 37 | Element_Boids2 Element_Boids2::THE_INSTANCE; 38 | 39 | } 40 | 41 | #endif /* ELEMENT_BOIDS2_H */ 42 | -------------------------------------------------------------------------------- /src/drivers/mfmdha/include/main.h: -------------------------------------------------------------------------------- 1 | #ifndef MAIN_H 2 | #define MAIN_H 3 | 4 | #include "AbstractGUIDriver.h" 5 | #include "P3Atom.h" 6 | 7 | #include "itype.h" 8 | 9 | #include "Element_Boids1.h" 10 | #include "Element_Boids2.h" 11 | #include "Element_Res.h" 12 | #include "Element_Dreg.h" 13 | 14 | #endif /* MAIN_H */ 15 | -------------------------------------------------------------------------------- /src/drivers/mfmdha/src/Element_Bar.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Bar.h" 2 | -------------------------------------------------------------------------------- /src/drivers/mfmdha/src/Element_DBar.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_DBar.h" 2 | -------------------------------------------------------------------------------- /src/drivers/mfmdha/src/Element_MQBar.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_MQBar.h" 2 | 3 | #ifdef ELEMENT_PLUG_IN 4 | 5 | #include "StdEventConfig.h" 6 | #include "ElementLibrary.h" 7 | 8 | extern "C" { 9 | static MFM::CPPElementLibraryStub _cppels10(MFM::Element_MQBar::THE_INSTANCE); 10 | 11 | static MFM::ElementLibraryStub * (_elementStubPtrArray_[]) = { 12 | &_cppels10 13 | }; 14 | static MFM::ElementLibrary el = { 15 | MFM::ELEMENT_LIBRARY_MAGIC, 16 | MFM::ELEMENT_LIBRARY_VERSION, 17 | 0, 18 | 1, 19 | MFM_BUILD_DATE, 20 | MFM_BUILD_TIME, 21 | _elementStubPtrArray_ 22 | }; 23 | void * MFM_ELEMENT_LIBRARY_LOADER_SYMBOL = ⪙ 24 | } 25 | 26 | #endif /* ELEMENT_PLUG_IN */ 27 | -------------------------------------------------------------------------------- /src/drivers/mfmdha/src/Element_QBar.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_QBar.h" 2 | 3 | #ifdef ELEMENT_PLUG_IN 4 | 5 | #include "StdEventConfig.h" 6 | 7 | extern "C" { 8 | static void * getref() { 9 | return (void *) & (MFM::Element_QBar::THE_INSTANCE); 10 | } 11 | typedef void* (*FuncPtr)(); 12 | FuncPtr get_static_element_library_pointer[] = { getref }; 13 | } 14 | 15 | #endif /* ELEMENT_PLUG_IN */ 16 | -------------------------------------------------------------------------------- /src/drivers/mfmdha/src/Element_SBar.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_SBar.h" 2 | -------------------------------------------------------------------------------- /src/drivers/mfmdha/src/Vector.cpp: -------------------------------------------------------------------------------- 1 | #include "Vector.h" 2 | -------------------------------------------------------------------------------- /src/drivers/mfmheadless/Makefile: -------------------------------------------------------------------------------- 1 | # Who we are 2 | COMPONENTNAME:=mfmheadless 3 | 4 | # Where's the top 5 | BASEDIR:=../../.. 6 | 7 | # What we need to build 8 | override INCLUDES += -I $(BASEDIR)/src/core/include -I $(BASEDIR)/src/elements/include -I $(BASEDIR)/src/sim/include -I $(BASEDIR)/src/gui/include 9 | 10 | # What we need to link 11 | override LIBS += -L $(BASEDIR)/build/core/ -L $(BASEDIR)/build/sim/ -L $(BASEDIR)/build/gui/ 12 | override LIBS += -lmfmgui -lmfmsim -lmfmcore -lSDL -lSDL_ttf -lSDL_image -lpng -lm 13 | 14 | # Do the program thing 15 | include $(BASEDIR)/config/Makeprog.mk 16 | -------------------------------------------------------------------------------- /src/drivers/mfmheadless/include/main.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef MAIN_H 3 | #define MAIN_H 4 | 5 | #include "itype.h" 6 | #include "AbstractDualDriver.h" 7 | #include "P3Atom.h" 8 | #include "ParamConfig.h" 9 | #include "Element_Dreg.h" 10 | #include "Element_Res.h" 11 | 12 | #endif /* MAIN_H */ 13 | -------------------------------------------------------------------------------- /src/drivers/mfmsim/Makefile: -------------------------------------------------------------------------------- 1 | # Who we are 2 | COMPONENTNAME:=mfmsim 3 | 4 | # Where's the top 5 | BASEDIR:=../../.. 6 | 7 | # What we need to build 8 | override INCLUDES += -I $(BASEDIR)/src/core/include -I $(BASEDIR)/src/elements/include -I $(BASEDIR)/src/sim/include -I $(BASEDIR)/src/gui/include 9 | override INCLUDES += $(shell sdl-config --cflags) 10 | 11 | # What we need to link 12 | override LIBS += -L $(BASEDIR)/build/core/ -L $(BASEDIR)/build/sim/ -L $(BASEDIR)/build/gui/ 13 | override LIBS += -lmfmgui -lmfmsim -lmfmcore -lSDL -lSDL_ttf -lSDL_image -lpng -lm 14 | 15 | # Do the program thing 16 | include $(BASEDIR)/config/Makeprog.mk 17 | -------------------------------------------------------------------------------- /src/drivers/mfmsim/include/main.h: -------------------------------------------------------------------------------- 1 | #ifndef MAIN_H 2 | #define MAIN_H 3 | 4 | #include "AbstractGUIDriver.h" 5 | #include "AbstractButton.h" 6 | #include "P1Atom.h" 7 | 8 | #include "EventWindow.h" 9 | #include "Element_Empty.h" 10 | #include "Element_Dreg.h" 11 | #include "Element_Res.h" 12 | #include "Element_Sorter.h" 13 | #include "Element_Emitter.h" 14 | #include "Element_Consumer.h" 15 | #include "Element_Data.h" 16 | #include "Element_Wall.h" 17 | 18 | #endif /* MAIN_H */ 19 | -------------------------------------------------------------------------------- /src/drivers/mfmt2-old/Makefile: -------------------------------------------------------------------------------- 1 | all program clean realclean: FORCE 2 | #make -k -f Makefile-CL.mk $(MAKECMDGOALS) 3 | make -k -f Makefile-GUI.mk $(MAKECMDGOALS) 4 | 5 | .PHONY: FORCE 6 | -------------------------------------------------------------------------------- /src/drivers/mfmt2-old/Makefile-CL.mk: -------------------------------------------------------------------------------- 1 | # Who we are 2 | COMPONENTNAME:=mfmcl 3 | 4 | # Our aliases 5 | COMPONENTALIASES:= $(COMPONENTNAME)_s $(COMPONENTNAME)_m $(COMPONENTNAME)_l 6 | 7 | # Where's the top 8 | BASEDIR:=../../.. 9 | 10 | # Depend on us too 11 | ALLDEP += $(BASEDIR)/src/drivers/mfmc/Makefile-CL.mk 12 | 13 | # What we need to build 14 | override INCLUDES += -I $(BASEDIR)/src/core/include -I $(BASEDIR)/src/elements/include -I $(BASEDIR)/src/sim/include 15 | 16 | # What we need to link 17 | override LIBS += -L $(BASEDIR)/build/core/ -L $(BASEDIR)/build/elements/ -L $(BASEDIR)/build/sim/ 18 | override LIBS += -lmfmsim -lmfmelements -Wl,--whole-archive -lmfmcore -Wl,--no-whole-archive -lm 19 | 20 | # Do the program thing 21 | include $(BASEDIR)/config/Makeprog.mk 22 | -------------------------------------------------------------------------------- /src/drivers/mfmt2-old/Makefile-GUI.mk: -------------------------------------------------------------------------------- 1 | # Who we are 2 | COMPONENTNAME:=mfmt2 3 | 4 | # Our aliases 5 | COMPONENTALIASES:= $(COMPONENTNAME)_s $(COMPONENTNAME)_m $(COMPONENTNAME)_l 6 | 7 | # Where's the top 8 | BASEDIR:=../../.. 9 | 10 | # Depend on us too 11 | ALLDEP += $(BASEDIR)/src/drivers/mfmc/Makefile-GUI.mk 12 | 13 | # What we need to build 14 | override INCLUDES += -I $(BASEDIR)/src/core/include -I $(BASEDIR)/src/elements/include -I $(BASEDIR)/src/sim/include -I $(BASEDIR)/src/gui/include 15 | override INCLUDES += $(shell sdl-config --cflags) 16 | override DEFINES += -D MFM_GUI_DRIVER 17 | 18 | # What we need to link 19 | override LIBS += -L $(BASEDIR)/build/core/ -L $(BASEDIR)/build/elements/ -L $(BASEDIR)/build/sim/ -L $(BASEDIR)/build/gui/ 20 | override LIBS += -lmfmgui -lmfmsim -lmfmelements -Wl,--whole-archive -lmfmcore -Wl,--no-whole-archive -lSDL -lSDL_ttf -lSDL_image -lpng -lm 21 | 22 | # Do the program thing 23 | include $(BASEDIR)/config/Makeprog.mk 24 | -------------------------------------------------------------------------------- /src/drivers/mfmt2-old/include/MFMT2Constants.h: -------------------------------------------------------------------------------- 1 | #ifndef MFMT2CONSTANTS_H 2 | #define MFMT2CONSTANTS_H 3 | 4 | #define MFM_DEV_PATH "/dev/itc/mfm" 5 | 6 | namespace MFM 7 | { 8 | enum { 9 | MENU_WIDTH = 480, 10 | MENU_HEIGHT = 320, 11 | 12 | ITC_LENGTH = 200, 13 | ITC_WIDTH = 2, 14 | ITC_RIGHT_INDENT = 5 15 | }; 16 | 17 | enum DriverOp { 18 | DRIVER_OP_MIN = 0x80, 19 | CANCEL_OP = 0x80, // Dismiss driver op menu 20 | RESET_OP = 0x81, // Reload MFMT2 initial state 21 | QUIT_OP = 0x82, // Quit MFMT2 22 | REBOOT_OP = 0x83, // Reboot tile 23 | SHUTDOWN_OP = 0x84, // Turn off tile power 24 | GLOBAL_OP = 0x85, // Broadcast next op to grid 25 | CLEAR_OP = 0x86, // Set all sites to empty 26 | T2VIZ_OP = 0x87, // Start t2viz stats displayer 27 | MHZ300_OP = 0x88, // Set CPU frequency to 300MHz 28 | MHZ600_OP = 0x89, // Set CPU frequency to 600MHz 29 | MHZ720_OP = 0x8a, // Set CPU frequency to 720MHz 30 | MHZ800_OP = 0x8b, // Set CPU frequency to 800MHz 31 | MHZ1000_OP = 0x8c, // Set CPU frequency to 1Gz 32 | STATSON_OP = 0x8d, // Show stats panel 33 | STATSOFF_OP = 0x8e, // Don't show stats panel 34 | DRIVER_NO_OP = 0x8f, // No op, do nothing 35 | DRIVER_OP_MAX = 0x8f 36 | }; 37 | 38 | enum { 39 | EVENT_HISTORY_SIZE = 100000, 40 | SECS_PER_STATUS = 5, 41 | FLASH_TRAFFIC_TTL = 30, 42 | DRIVER_OP_DELAY = 2 43 | }; 44 | } 45 | 46 | #endif /* MFMT2CONSTANTS_H */ 47 | -------------------------------------------------------------------------------- /src/drivers/mfmt2-old/include/TileSizes.inc: -------------------------------------------------------------------------------- 1 | 2 | /* Tile codes don't have to start with A, but whatever tiles sizes are 3 | configured must have consecutive letter codes! Here we support B-J 4 | by default, or A-M if EXTRA_TILE_SIZES is defined. Every tile size 5 | that is included implies another huge pile of templates for g++ to 6 | instantiate, slowing the MFM build time. 7 | Width,Height values may be different (H-J); 8 | Usage: ./bin/mfms {ctr}|{{ctr}} 9 | where c is number of columns, t is Tile code, r is number of rows, 10 | and double braces is for a staggered grid layout 11 | */ 12 | 13 | XX(G,48,32) 14 | XX(H,60,40) 15 | XX(I,75,50) 16 | -------------------------------------------------------------------------------- /src/drivers/mfmt2-old/include/main.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef MAIN_H 3 | #define MAIN_H 4 | 5 | #include "itype.h" 6 | #include "AbstractDualDriver.h" 7 | #include "P3Atom.h" 8 | #include "GridConfig.h" 9 | #include "DateTimeStamp.h" 10 | 11 | #endif /* MAIN_H */ 12 | -------------------------------------------------------------------------------- /src/drivers/mfmt2-old/src/FlashTraffic.cpp: -------------------------------------------------------------------------------- 1 | #include "FlashTraffic.h" 2 | -------------------------------------------------------------------------------- /src/drivers/mfmt2-old/src/MFMIO.cpp: -------------------------------------------------------------------------------- 1 | #include "MFMIO.h" 2 | -------------------------------------------------------------------------------- /src/drivers/mfmt2-old/src/MFMT2Constants.cpp: -------------------------------------------------------------------------------- 1 | #include "MFMT2Constants.h" 2 | -------------------------------------------------------------------------------- /src/drivers/mfmt2-old/src/PacketFIFO.cpp: -------------------------------------------------------------------------------- 1 | #include "PacketFIFO.h" 2 | 3 | namespace MFM { 4 | bool PacketFIFO::addPacket(const u8 * packet, u32 len) { 5 | if (!packet 6 | || len == 0 7 | || len >= MAX_PACKET_SIZE 8 | || len >= bytesAvailable()) { 9 | ++mPacketsRejected; 10 | return false; 11 | } 12 | storeByte((u8) len); 13 | for (u32 i = 0; i < len; ++i) storeByte(packet[i]); 14 | ++mPacketsAdded; 15 | return true; 16 | } 17 | 18 | bool PacketFIFO::peekFrontPacketType(u8 & type) { 19 | if (bytesUsed() < 2) return false; 20 | type = mBuffer[(mReadPtr+1) & PACKET_FIFO_MASK]; 21 | return true; 22 | } 23 | 24 | bool PacketFIFO::removePacket(u8 (&buffer)[MAX_PACKET_SIZE], u8 & len) { 25 | u8 plen = frontPacketLen(); 26 | if (plen == 0) return false; 27 | for (u32 i = 0; i < plen; ++i) 28 | buffer[i] = getFrontPacketByte(i); 29 | dropFrontPacket(); 30 | len = plen; 31 | return true; 32 | } 33 | 34 | bool PacketFIFO::removePacketBuffer(PacketBuffer & pb) { 35 | u8 plen = frontPacketLen(); 36 | if (plen == 0) return false; 37 | pb.Reset(); 38 | for (u32 i = 0; i < plen; ++i) 39 | pb.WriteByte(getFrontPacketByte(i)); 40 | dropFrontPacket(); 41 | return true; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/include/CPUFreq.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef CPUFREQ_H 3 | #define CPUFREQ_H 4 | 5 | #include "T2Constants.h" 6 | 7 | namespace MFM { 8 | 9 | enum CPUSpeed { 10 | CPUSpeed_300MHz = 300, 11 | CPUSpeed_600MHz = 600, 12 | CPUSpeed_720MHz = 720, 13 | CPUSpeed_800MHz = 800, 14 | CPUSpeed_1000MHz = 1000, 15 | 16 | CPUSpeed_Slowest = CPUSpeed_300MHz, 17 | CPUSpeed_Slower = CPUSpeed_300MHz, 18 | CPUSpeed_Slow = CPUSpeed_600MHz, 19 | CPUSpeed_Fast = CPUSpeed_720MHz, 20 | CPUSpeed_Faster = CPUSpeed_800MHz, 21 | CPUSpeed_Fastest = CPUSpeed_1000MHz, 22 | 23 | CPUSpeed_UNKNOWN=0 24 | }; 25 | 26 | struct CPUFreq { 27 | CPUFreq() 28 | : mLastSet(CPUSpeed_UNKNOWN) 29 | { } 30 | 31 | CPUFreq(CPUSpeed speed) : CPUFreq() 32 | { 33 | setSpeed(speed); 34 | } 35 | 36 | CPUSpeed getLastSetSpeed() const { return mLastSet; } 37 | CPUSpeed getFaster(CPUSpeed than) const ; 38 | CPUSpeed getSlower(CPUSpeed than) const ; 39 | void setSpeed(CPUSpeed to) ; 40 | 41 | CPUSpeed mLastSet; 42 | }; 43 | } 44 | 45 | #endif /* CPUFREQ_H */ 46 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/include/ChooserPanel.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef CHOOSERPANEL_H 3 | #define CHOOSERPANEL_H 4 | 5 | #include "itype.h" 6 | #include "Panel.h" 7 | #include "Menu.h" 8 | 9 | namespace MFM { 10 | struct ChooserPanel : public MenuMakerPanel { 11 | 12 | ChooserPanel() ; 13 | virtual ~ChooserPanel() { } 14 | 15 | bool choose(int kidnum) ; 16 | 17 | virtual void configureItem(MenuItem& menu) ; 18 | 19 | virtual void addItems(Menu& menu) ; 20 | 21 | }; 22 | } 23 | #endif /* CHOOSERPANEL_H */ 24 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/include/EWSet.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef EWSET_H 3 | #define EWSET_H 4 | 5 | #include "itype.h" 6 | #include "Dirs.h" 7 | 8 | #include 9 | #include 10 | 11 | namespace MFM { 12 | 13 | struct T2EventWindow; // FORWARD 14 | struct T2Tile; // FORWARD 15 | struct EWSet; 16 | 17 | struct EWLinks { 18 | 19 | bool isInSet() const { return mInSet != 0; } 20 | 21 | EWSet * inSet() const { return mInSet; } 22 | 23 | u32 getIndexInSet() const { 24 | assert(isInSet()); 25 | return mIdxInSet; 26 | } 27 | 28 | virtual T2EventWindow * asEventWindow() { return 0; } 29 | 30 | template 31 | EW * as() { return dynamic_cast(this); } 32 | 33 | EWLinks() 34 | : mInSet(0) 35 | , mIdxInSet(U32_MAX) 36 | { } 37 | 38 | virtual ~EWLinks() { 39 | if (isInSet()) removeFromEWSet(); 40 | } 41 | 42 | void insertInEWSet(EWSet * ews) ; 43 | 44 | bool removeFromEWSet() ; 45 | 46 | private: 47 | friend EWSet; 48 | EWSet * mInSet; 49 | u32 mIdxInSet; 50 | }; 51 | 52 | struct EWSet { 53 | T2Tile & mTile; 54 | std::vector mMembers; 55 | u32 mInUse; 56 | 57 | bool isEmpty() const ; 58 | void rawInsert(EWLinks * l) ; 59 | void rawRemove(EWLinks * l) ; 60 | 61 | EWLinks * removeRandom() ; 62 | 63 | EWSet(T2Tile& tile) 64 | : mTile(tile) 65 | , mInUse(0) 66 | { } 67 | 68 | ~EWSet() ; // EWSet DOES NOT own its EWs 69 | 70 | }; 71 | } 72 | #endif /* EWSET_H */ 73 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/include/Engine.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef ENGINE_H 3 | #define ENGINE_H 4 | 5 | #include "SDLI.h" 6 | 7 | namespace MFM { 8 | struct SDLI; // Forward 9 | 10 | struct Event { 11 | SDL_Event m_sdlEvent; 12 | }; 13 | 14 | struct Engine { 15 | virtual void input(SDLI&, Event&) = 0; 16 | virtual void update(SDLI&) = 0; 17 | virtual void output(SDLI&) = 0; 18 | virtual ~Engine() { } 19 | }; 20 | } 21 | #endif /* ENGINE_H */ 22 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/include/ITCIcons.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef ITCICONS_H 3 | #define ITCICONS_H 4 | 5 | #include "SDL_image.h" 6 | #include "SDL.h" 7 | #include "SDL_ttf.h" 8 | 9 | #include "itype.h" 10 | #include "Point.h" 11 | 12 | namespace MFM { 13 | struct ITCIcons { 14 | enum { 15 | ICON_DIR_WEST_IDX = 0, 16 | ICON_DIR_NORTH_IDX, 17 | ICON_DIR_EAST_IDX, 18 | ICON_DIR_SOUTH_IDX, 19 | ICON_DIR_IDX_COUNT, 20 | 21 | ICON_FUNC_RECV_IDX = 0, 22 | ICON_FUNC_SEND_IDX, 23 | ICON_FUNC_CLOSED_IDX, 24 | ICON_FUNC_ERROR_IDX, 25 | ICON_FUNC_EMPTY_IDX, 26 | ICON_FUNC_IDX_COUNT, 27 | 28 | ICON_SIZE_IDX_COUNT = 16 29 | }; 30 | 31 | bool getIconPosAndSize(const u32 dirIdx, const u32 funcIdx, const u32 sizeIdx, UPoint & pos, UPoint & size) ; 32 | 33 | ITCIcons() ; 34 | // We don't use screen it's just a reminder to set up SDL before coming here.. 35 | void init(SDL_Surface * screen) ; 36 | SDL_Surface* mZSheet; 37 | 38 | SDL_Surface * getZSheet() { return mZSheet; } 39 | }; 40 | } 41 | 42 | #endif /* ITCICONS_H */ 43 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/include/ITCStatusPanel.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef ITCSTATUSPANEL_H 3 | #define ITCSTATUSPANEL_H 4 | 5 | #include "Panel.h" 6 | 7 | namespace MFM { 8 | class ITCStatus; // FORWARD 9 | class ITCIcons; // FORWARD 10 | 11 | struct ITCStatusPanel : public Panel { 12 | void init(ITCStatus & status, ITCIcons & icons) ; 13 | ITCStatus * mStatus; 14 | ITCIcons * mIcons; 15 | 16 | const u32 getWidth() const ; 17 | const u32 getHeight() const ; 18 | 19 | virtual void PaintComponent(Drawing & config) ; 20 | }; 21 | 22 | } 23 | 24 | #endif /* ITCSTATUSPANEL_H */ 25 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/include/IWeave.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef IWEAVE_H 3 | #define IWEAVE_H 4 | 5 | #include "Point.h" 6 | #include "OverflowableCharBufferByteSink.h" 7 | 8 | namespace MFM { 9 | struct Weaver; // FORWARD 10 | struct IWeavePrivate; // FORWARD 11 | 12 | struct IWeave { 13 | Weaver & mWeaver; 14 | IWeavePrivate * mIWeavePrivatePtr; 15 | 16 | IWeave(Weaver& w) ; 17 | ~IWeave() ; 18 | void runInteractive() ; 19 | bool doCommand() ; 20 | private: 21 | }; 22 | 23 | } 24 | #endif /* IWEAVE_H */ 25 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/include/LogPanel.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef LOGPANEL_H 3 | #define LOGPANEL_H 4 | 5 | #include "SDL.h" 6 | 7 | #include "TextPanel.h" 8 | 9 | namespace MFM { 10 | 11 | typedef TextPanel<128,10> TextPanelForLogging; 12 | 13 | struct LogPanel : public TextPanelForLogging { 14 | const char * mFilePathToTrack; 15 | FILE * mFilePtr; 16 | u32 mBytesToSkip; 17 | u32 mBytesInLine; 18 | 19 | void setPathToTrack(const char * path) { 20 | mFilePathToTrack = path; 21 | } 22 | 23 | void setBytesToSkipPerLine(u32 skipbytes) { 24 | mBytesToSkip = skipbytes; 25 | } 26 | 27 | LogPanel(const char * path = 0, u32 skipbytes = 0) 28 | : mFilePathToTrack(0) 29 | , mFilePtr(0) 30 | , mBytesToSkip(0) 31 | , mBytesInLine(0) 32 | { 33 | setPathToTrack(path); 34 | setBytesToSkipPerLine(skipbytes); 35 | } 36 | 37 | void update() ; 38 | 39 | virtual ~LogPanel() { } 40 | }; 41 | } 42 | 43 | #endif /* LOGPANEL_H */ 44 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/include/SimLogPanel.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef SIMLOGPANEL_H 3 | #define SIMLOGPANEL_H 4 | 5 | #include "TextPanel.h" 6 | #include "TeeByteSink.h" 7 | #include "Logger.h" 8 | 9 | namespace MFM { 10 | 11 | typedef TextPanel<80,40> SimLogTextPanel; 12 | struct SimLogPanel : public SimLogTextPanel { 13 | 14 | SimLogPanel() { 15 | ByteSink * old = LOG.SetByteSink(m_logSplitter); 16 | m_logSplitter.SetSink1(old); 17 | m_logSplitter.SetSink2(&GetByteSink()); 18 | } 19 | 20 | virtual ~SimLogPanel() { } 21 | 22 | TeeByteSink m_logSplitter; 23 | }; 24 | } 25 | 26 | #endif /* SIMLOGPANEL_H */ 27 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/include/Sites.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef SITES_H 3 | #define SITES_H 4 | 5 | #include "itype.h" 6 | #include "Dirs.h" 7 | #include "Site.h" 8 | #include "T2Constants.h" 9 | #include "T2Types.h" 10 | 11 | namespace MFM { 12 | struct Sites { 13 | 14 | OurT2Site * getSiteArray() { return &mTheSites[0][0]; } 15 | 16 | OurT2Site& get(UPoint at) { 17 | MFM_API_ASSERT_ARG(at.BoundedAbove(UPoint(T2TILE_WIDTH-1,T2TILE_HEIGHT-1))); 18 | return mTheSites[at.GetY()][at.GetX()]; 19 | } 20 | 21 | const OurT2Site& get(UPoint at) const { 22 | MFM_API_ASSERT_ARG(at.BoundedAbove(UPoint(T2TILE_WIDTH-1,T2TILE_HEIGHT-1))); 23 | return mTheSites[at.GetY()][at.GetX()]; 24 | } 25 | 26 | Sites() ; 27 | 28 | private: 29 | typedef OurT2Site OurT2Sites[T2TILE_HEIGHT][T2TILE_WIDTH]; 30 | OurT2Sites mTheSites; 31 | }; 32 | } 33 | #endif /* SITES_H */ 34 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/include/T2CDMPanel.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef T2CDMPANEL_H 3 | #define T2CDMPANEL_H 4 | 5 | #include "TextPanel.h" 6 | #include "TimeoutAble.h" 7 | #include "SDLI.h" 8 | #include "ITCStatus.h" 9 | #include "T2ADCs.h" 10 | #include "Menu.h" 11 | 12 | namespace MFM { 13 | 14 | typedef TextPanel<48,14> CDMText; 15 | 16 | struct T2CDMPanel : public CDMText, public TimeoutAble, public SDLIConfigurable { 17 | typedef CDMText Super; 18 | 19 | T2CDMPanel() 20 | { 21 | this->setKeepNewest(false); 22 | } 23 | void configure(SDLI & sdli) ; 24 | 25 | virtual void onTimeout(TimeQueue& srcTQ) ; 26 | virtual const char * getName() const { return "T2CDMPanel"; } 27 | 28 | virtual ~T2CDMPanel() { } 29 | 30 | virtual void addItems(Menu& menu) { 31 | DIE_UNIMPLEMENTED(); 32 | } 33 | 34 | private: 35 | }; 36 | } 37 | 38 | #endif /* T2CDMPANEL_H */ 39 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/include/T2DrawConfigPanel.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef T2DRAWCONFIGPANEL_H 3 | #define T2DRAWCONFIGPANEL_H 4 | 5 | #include "TextPanel.h" 6 | #include "TimeoutAble.h" 7 | #include "SDLI.h" 8 | #include "Menu.h" 9 | 10 | namespace MFM { 11 | 12 | typedef TextPanel<48,23> DrawConfigText; 13 | 14 | struct T2DrawConfigPanel : public DrawConfigText, public TimeoutAble, public SDLIConfigurable { 15 | typedef DrawConfigText Super; 16 | 17 | T2DrawConfigPanel() 18 | { 19 | this->setKeepNewest(false); 20 | } 21 | void configure(SDLI & sdli) ; 22 | 23 | virtual void onTimeout(TimeQueue& srcTQ) ; 24 | virtual const char * getName() const { return "T2DrawConfigPanel"; } 25 | 26 | virtual ~T2DrawConfigPanel() { } 27 | 28 | virtual void addItems(Menu& menu) { 29 | DIE_UNIMPLEMENTED(); 30 | } 31 | 32 | void refreshDrawConfigText() ; 33 | private: 34 | }; 35 | } 36 | 37 | #endif /* T2DRAWCONFIGPANEL_H */ 38 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/include/T2GridPanel.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef T2GRIDPANEL_H 3 | #define T2GRIDPANEL_H 4 | 5 | #include "itype.h" 6 | #include "Panel.h" 7 | #include "T2Tile.h" 8 | 9 | namespace MFM { 10 | struct T2GridPanel : public Panel { 11 | typedef Panel Super; 12 | 13 | // Handle mouse button action inside our walls 14 | virtual bool Handle(MouseButtonEvent & event) ; 15 | 16 | T2GridPanel() ; 17 | virtual ~T2GridPanel() { } 18 | 19 | // Make border sections reflect ITC status 20 | void PaintBorder(Drawing & drawing) ; 21 | 22 | virtual void PaintComponent(Drawing & config) ; 23 | 24 | void paintSite(Drawing & config, DrawSiteType dtype, DrawSiteShape dshape, OurT2Site & s, u32 x, u32 y) ; 25 | 26 | void paintCustomTile(Drawing & config) ; 27 | 28 | void CallRenderGraphics(OurUlamContextEvent & ucs, 29 | const OurUlamElement & uelt, 30 | OurAtomBitStorage & abs) ; 31 | 32 | void paintInsane(Drawing & config, u32 atx, u32 aty) ; 33 | }; 34 | } 35 | #endif /* T2GRIDPANEL_H */ 36 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/include/T2TileStats.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef T2TILESTATS_H 3 | #define T2TILESTATS_H 4 | 5 | #include "UniqueTime.h" 6 | 7 | #define ALL_TILE_STAT_U64S() \ 8 | XX(EventsConsidered,"whether or not an aEW launched") \ 9 | XX(EmptyEventsCommitted,"by doing nothing") \ 10 | XX(NonemptyEventsStarted,"#aEWs launched, w or w/o transition") \ 11 | XX(NonemptyTransitionsStarted,"#executeEvent entries") \ 12 | XX(NonemptyEventsCommitted,"w/o failure during transition") \ 13 | 14 | namespace MFM { 15 | struct T2TileStats { 16 | void saveRaw(ByteSink& bs) ; 17 | bool loadRaw(ByteSource& bs) ; 18 | void reset() ; 19 | u32 getResetSeconds() const { return mResetSeconds; } 20 | u32 getAgeSeconds() const ; 21 | double getEstAER(u32 duration=0) const ; 22 | T2TileStats operator-(const T2TileStats & rhs) ; 23 | 24 | u32 mResetSeconds; // When stats were last reset 25 | #define XX(NM,CM) \ 26 | u64 m##NM; /* CM */ \ 27 | u64 get##NM() const { return m##NM; } \ 28 | void incr##NM() { ++m##NM; } \ 29 | 30 | ALL_TILE_STAT_U64S() 31 | #undef XX 32 | }; 33 | 34 | } 35 | 36 | #endif /* T2TILESTATS_H */ 37 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/include/T2TimeQueuePanel.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef T2TIMEQUEUEPANEL_H 3 | #define T2TIMEQUEUEPANEL_H 4 | 5 | #include "TextPanel.h" 6 | #include "TimeoutAble.h" 7 | #include "SDLI.h" 8 | #include "ITCStatus.h" 9 | #include "T2ADCs.h" 10 | #include "Menu.h" 11 | 12 | namespace MFM { 13 | 14 | typedef TextPanel<48,23> TimeQueueText; 15 | 16 | struct T2TimeQueuePanel : public TimeQueueText, public TimeoutAble, public SDLIConfigurable { 17 | typedef TimeQueueText Super; 18 | 19 | T2TimeQueuePanel() 20 | { 21 | this->setKeepNewest(false); 22 | } 23 | void configure(SDLI & sdli) ; 24 | 25 | virtual void onTimeout(TimeQueue& srcTQ) ; 26 | virtual const char * getName() const { return "T2TimeQueuePanel"; } 27 | 28 | virtual ~T2TimeQueuePanel() { } 29 | 30 | virtual void addItems(Menu& menu) { 31 | DIE_UNIMPLEMENTED(); 32 | } 33 | 34 | void refreshTimeQueueText() ; 35 | private: 36 | }; 37 | } 38 | 39 | #endif /* T2TIMEQUEUEPANEL_H */ 40 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/include/T2TitleCard.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef T2TITLECARD_H 3 | #define T2TITLECARD_H 4 | 5 | #include "TimeoutAble.h" 6 | #include "SDLI.h" 7 | #include "Menu.h" 8 | #include "WrappedText.h" 9 | 10 | namespace MFM { 11 | 12 | struct T2TitleCard : public MenuMakerPanel, public TimeoutAble, public SDLIConfigurable { 13 | typedef MenuMakerPanel Super; 14 | 15 | //>> API TimeoutAble 16 | virtual void onTimeout(TimeQueue& srcTq) ; 17 | //<< API TimeoutAble 18 | 19 | //>>API MenuMakerPanel(Panel) 20 | virtual void PaintComponent(Drawing & config) ; 21 | 22 | virtual bool Handle(MouseButtonEvent & event) ; 23 | //< TraceText; 14 | 15 | struct T2TraceCtlButton; // FORWARD 16 | 17 | struct T2TracePanel : public TraceText, public TimeoutAble, public SDLIConfigurable { 18 | typedef TraceText Super; 19 | 20 | T2TracePanel() 21 | { 22 | this->setKeepNewest(false); 23 | } 24 | void configure(SDLI & sdli) ; 25 | 26 | virtual void onTimeout(TimeQueue& srcTQ) ; 27 | virtual const char * getName() const { return "T2TracePanel"; } 28 | 29 | virtual ~T2TracePanel() { } 30 | 31 | virtual void addItems(Menu& menu) { 32 | DIE_UNIMPLEMENTED(); 33 | } 34 | 35 | u32 changeSelection(s32 incr) ; 36 | void requestSelection() ; 37 | void deleteSelection() ; 38 | void confirmAction() ; 39 | void cancelAction() ; 40 | const TraceLogInfo & getSelected() ; 41 | 42 | T2TraceCtlButton & getActionButton() ; 43 | 44 | void setLogToRequest(const TraceLogInfo & tli) ; 45 | void clearLogToRequest() ; 46 | 47 | private: 48 | TraceLogInfo mTLIToRequest; 49 | u32 mRows; 50 | u32 mSelectedRow; 51 | u32 mDisplayedSeqs[TraceLogDirManager::MAX_TRACE_SEQ_TO_KEEP]; 52 | }; 53 | } 54 | 55 | #endif /* T2TRACEPANEL_H */ 56 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/include/TraceLogInfo.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef TRACELOGINFO_H 3 | #define TRACELOGINFO_H 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "itype.h" 11 | #include "T2Types.h" /*for BPoint */ 12 | #include "ByteSink.h" 13 | 14 | #define TRACE_DUMP_FILENAME_FMT "%08x-%08x-%02x%02x%02x.dat" 15 | #define TRACE_DUMP_FILENAME_MATCHES 5 16 | #define TRACE_DUMP_FILENAME_MATCH_LEN 28 17 | 18 | namespace MFM { 19 | struct TraceLogInfo { 20 | bool tryInitFromDir(DIR * dir, struct dirent * ent) ; 21 | u32 mSeq; 22 | u32 mTag; 23 | u8 mRange; 24 | BPoint mOffset; 25 | u32 mBytes; 26 | void formatInfo(ByteSink & bs) const ; 27 | void reset() ; 28 | void tryMoveLog() const ; 29 | }; 30 | 31 | struct TraceLogDirManager { 32 | static const u32 MAX_TRACE_SEQ_TO_KEEP = 10; 33 | 34 | TraceLogDirManager() ; 35 | const char * getTraceDir() { return "/home/t2/mfmTraces"; } 36 | u32 initAndManageTraceDir() ; // returns nextseq 37 | void tryMoveLog(u32 tag, u32 range, BPoint offset) ; 38 | const TraceLogInfo * getTraceLogInfoFromSeq(u32 seq) const ; 39 | const TraceLogInfo * getTraceLogInfoByIndex(u32 index) const ; 40 | TraceLogInfo mFileInfos[MAX_TRACE_SEQ_TO_KEEP]; 41 | }; 42 | 43 | 44 | 45 | } 46 | #endif /* TRACELOGINFO_H */ 47 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/include/TraceTypes.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef TRACETYPES_H 3 | #define TRACETYPES_H 4 | 5 | #include 6 | 7 | #include "dirdatamacro.h" 8 | 9 | #include "itype.h" 10 | #include "T2Types.h" 11 | #include "Trace.h" 12 | #include "Logger.h" 13 | 14 | #define TLOG(LOGLVL,FORMAT,...) \ 15 | TLOGLEV(Logger::LOGLVL,FORMAT , ## __VA_ARGS__) 16 | 17 | #define TLOGLEV(LVL,FORMAT, ...) \ 18 | do { \ 19 | if (LOG.IfLog(LVL)) \ 20 | TRACEPrintf(LVL, FORMAT , ## __VA_ARGS__ ); \ 21 | } while (0) \ 22 | 23 | 24 | namespace MFM { 25 | 26 | const char * getTraceTypeType(TraceTypeCode ttc) ; 27 | const char * getTraceTypeBrief(TraceTypeCode ttc) ; 28 | const char * getTraceTypeName(TraceTypeCode ttc) ; 29 | 30 | struct T2Tile; // FORWARD 31 | struct T2ITC; // FORWARD 32 | 33 | bool TRACEPrintf(Logger::Level level, const char * format, ...) ; 34 | 35 | } 36 | 37 | #endif /* TRACETYPES_H */ 38 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/include/UlamEventSystem.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef ULAMEVENTSYSTEM_H 3 | #define ULAMEVENTSYSTEM_H 4 | 5 | #include 6 | 7 | #include "T2Types.h" 8 | #include "ElementRegistry.h" 9 | #include "UlamClassRegistry.h" 10 | #include "T2EventWindow.h" 11 | 12 | namespace MFM { 13 | struct T2Tile; // FORWARD 14 | 15 | struct UlamEventSystem { 16 | enum { ELEMENT_EMPTY_TYPE = OurT2EventConfig::ATOM_CONFIG::ATOM_EMPTY_TYPE }; 17 | 18 | UlamEventSystem(T2Tile &) ; 19 | 20 | /** \return null if good else static error message */ 21 | const char * setUlamLibraryPath(const char * path) ; 22 | 23 | OurUlamClassRegistry & getUlamClassRegistry() ; 24 | 25 | OurElementRegistry & getElementRegistry() { 26 | return mElementRegistry; 27 | } 28 | 29 | const OurElement * getSeedElementIfExists() ; 30 | 31 | void initUlamClasses() ; 32 | 33 | void getUlamLibDigest(ByteSink & out) const ; 34 | 35 | bool doUlamEvent(T2ActiveEventWindow & aew) ; 36 | 37 | const OurElement * getElementIfAny(u32 type) ; 38 | 39 | T2Tile & mTile; 40 | 41 | OurElementRegistry mElementRegistry; 42 | 43 | OurEventWindow & mOurEventWindow; 44 | 45 | void loadOurEventWindow(T2ActiveEventWindow & aew) ; 46 | 47 | void saveOurEventWindow(T2ActiveEventWindow & aew) ; 48 | 49 | OString64 mUlamLibDigest; 50 | }; 51 | 52 | } 53 | 54 | #endif /* ULAMEVENTSYSTEM_H */ 55 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/include/Utils12.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef UTILS_H 3 | #define UTILS_H 4 | 5 | #include "itype.h" 6 | #include "Dirs.h" 7 | #include "DateTimeStamp.h" 8 | 9 | // LKM files 10 | #include "itcpktevent.h" 11 | 12 | // Spike files 13 | #include "T2EventWindow.h" 14 | #include "T2Tile.h" 15 | 16 | #endif /* UTILS_H */ 17 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/include/VizConfig.h: -------------------------------------------------------------------------------- 1 | #ifndef VIZCONFIG_H 2 | #define VIZCONFIG_H 3 | 4 | #include "Panel.h" 5 | #include "ByteSource.h" 6 | 7 | namespace MFM { 8 | 9 | struct VizConfig { 10 | static Panel * parseAndBuildFromPath(const char * path) ; 11 | static Panel * parseAndBuild(ByteSource & bs) ; 12 | }; 13 | 14 | } 15 | 16 | #endif /*VIZCONFIG_H*/ 17 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/include/main.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef MAIN_H 3 | #define MAIN_H 4 | 5 | #include "itype.h" 6 | #include "Dirs.h" 7 | #include "DateTimeStamp.h" 8 | #include "Logger.h" 9 | #include "FileByteSink.h" 10 | 11 | // Spike files 12 | #include "T2EventWindow.h" 13 | #include "T2Tile.h" 14 | 15 | #endif /* MAIN_H */ 16 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/src/CPUFreq.cpp: -------------------------------------------------------------------------------- 1 | #include /* For snprintf */ 2 | #include /* For system */ 3 | 4 | #include "CPUFreq.h" 5 | 6 | namespace MFM { 7 | CPUSpeed CPUFreq::getFaster(CPUSpeed than) const { 8 | if (than < CPUSpeed_300MHz) return CPUSpeed_300MHz; 9 | if (than < CPUSpeed_600MHz) return CPUSpeed_600MHz; 10 | if (than < CPUSpeed_720MHz) return CPUSpeed_720MHz; 11 | if (than < CPUSpeed_800MHz) return CPUSpeed_800MHz; 12 | if (than < CPUSpeed_1000MHz) return CPUSpeed_1000MHz; 13 | return CPUSpeed_UNKNOWN; 14 | } 15 | 16 | CPUSpeed CPUFreq::getSlower(CPUSpeed than) const { 17 | if (than > CPUSpeed_1000MHz) return CPUSpeed_1000MHz; 18 | if (than > CPUSpeed_800MHz) return CPUSpeed_800MHz; 19 | if (than > CPUSpeed_720MHz) return CPUSpeed_720MHz; 20 | if (than > CPUSpeed_600MHz) return CPUSpeed_600MHz; 21 | if (than > CPUSpeed_300MHz) return CPUSpeed_300MHz; 22 | return CPUSpeed_UNKNOWN; 23 | } 24 | 25 | void CPUFreq::setSpeed(CPUSpeed newspeed) { 26 | if (newspeed == mLastSet) return; 27 | switch (newspeed) { 28 | case CPUSpeed_300MHz: 29 | case CPUSpeed_600MHz: 30 | case CPUSpeed_720MHz: 31 | case CPUSpeed_800MHz: 32 | case CPUSpeed_1000MHz: 33 | break; 34 | default: 35 | LOG.Error("Illegal CPUSpeed value %d ignored", newspeed); 36 | return; 37 | } 38 | char buff[100]; 39 | snprintf(buff,100,"cpufreq-set -f %dMHz",(u32) newspeed); 40 | system(buff); 41 | 42 | LOG.Message("CPU Frequency -> %dMHz", newspeed); 43 | mLastSet = newspeed; 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/src/ChooserPanel.cpp: -------------------------------------------------------------------------------- 1 | #include "ChooserPanel.h" 2 | 3 | namespace MFM { 4 | 5 | ChooserPanel::ChooserPanel() 6 | { 7 | } 8 | 9 | void ChooserPanel::addItems(Menu& menu) { 10 | DIE_UNIMPLEMENTED(); 11 | } 12 | 13 | void ChooserPanel::configureItem(MenuItem& menu) { 14 | DIE_UNIMPLEMENTED(); 15 | } 16 | 17 | 18 | #if 0 19 | void ChooserPanel::configureMenu(Menu& menu) { 20 | // First, count entries from parents 21 | u32 entries = 0; 22 | Panel * p; 23 | for (p = this; p != 0; p = p->GetParent()) { 24 | MenuMakerPanel * mm = dynamic_cast(p); 25 | if (!mm) continue; 26 | ++entries; 27 | } 28 | u32 i = entries; 29 | // Second, configure parent entries 30 | for (p = this; p != 0; p = p->GetParent()) { 31 | MenuMakerPanel * mm = dynamic_cast(p); 32 | if (!mm) continue; 33 | mm->configureItem(menu.getMenuItem(--i)); 34 | } 35 | 36 | } 37 | #endif 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/src/Engine.cpp: -------------------------------------------------------------------------------- 1 | #include "Engine.h" 2 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/src/FlashCommands.cpp: -------------------------------------------------------------------------------- 1 | #include "FlashCommands.h" 2 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/src/ITCIterator.cpp: -------------------------------------------------------------------------------- 1 | #include "ITCIterator.h" 2 | 3 | namespace MFM { 4 | 5 | ITCIterator ITCIteration::begin() { 6 | ITCIterator ret(*this); 7 | return ret; 8 | } 9 | 10 | ITCIteration::~ITCIteration() { 11 | MFM_API_ASSERT_STATE(mIteratorsActive==0); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/src/ITCStatusPanel.cpp: -------------------------------------------------------------------------------- 1 | #include "ITCStatusPanel.h" 2 | #include "ITCStatus.h" 3 | #include "ITCIcons.h" 4 | 5 | namespace MFM { 6 | const u32 ITCStatusPanel::getWidth() const { return mStatus->isVertical() ? ITC_IN_PIXELS : ITC_ACROSS_PIXELS; } 7 | const u32 ITCStatusPanel::getHeight() const { return mStatus->isVertical() ? ITC_ACROSS_PIXELS : ITC_IN_PIXELS; } 8 | 9 | void ITCStatusPanel::init(ITCStatus & status, ITCIcons & icons) { 10 | mStatus = &status; 11 | mIcons = &icons; 12 | SetName(status.getAbbr()); 13 | SetVisible(true); 14 | s32 w = getWidth(), h = getHeight(); 15 | SetDimensions(w,h); 16 | SetDesiredSize(w,h); 17 | SPoint pos(MakeSigned(mStatus->getScreenPos())); 18 | SetRenderPoint(pos); 19 | SetForeground(Drawing::YELLOW); 20 | SetBackground(Drawing::BLACK); 21 | SetBorder(Drawing::BLACK); 22 | } 23 | 24 | void ITCStatusPanel::PaintComponent(Drawing & draw) { 25 | MFM_API_ASSERT_STATE(mStatus != 0 && mIcons != 0); 26 | mStatus->drawStatus(draw, *mIcons); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/src/LogPanel.cpp: -------------------------------------------------------------------------------- 1 | #include "LogPanel.h" 2 | 3 | namespace MFM { 4 | void LogPanel::update() { 5 | if (mFilePathToTrack == 0) return; 6 | if (mFilePtr == 0) { 7 | mFilePtr = fopen(mFilePathToTrack, "r"); 8 | // if (mFilePtr != 0) fseek(mFilePtr, 0, SEEK_END); 9 | } 10 | 11 | if (mFilePtr != 0) { 12 | ByteSink & bs = GetByteSink(); 13 | s32 ch; 14 | 15 | while ((ch = fgetc(mFilePtr)) >= 0) { 16 | if (mBytesInLine >= mBytesToSkip) 17 | bs.WriteByte((u8) ch); 18 | if (ch == '\n') mBytesInLine = 0; else ++mBytesInLine; 19 | } 20 | 21 | if (ferror(mFilePtr)) { 22 | fclose(mFilePtr); 23 | mFilePtr = 0; 24 | mBytesInLine = 0; 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/src/SimLogPanel.cpp: -------------------------------------------------------------------------------- 1 | #include "SimLogPanel.h" 2 | 3 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/src/Sites.cpp: -------------------------------------------------------------------------------- 1 | #include "Sites.h" 2 | 3 | namespace MFM { 4 | Sites::Sites() 5 | { 6 | LOG.Message("ctor Sites %p", this); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/src/T2CDMPanel.cpp: -------------------------------------------------------------------------------- 1 | #include "T2CDMPanel.h" 2 | 3 | #include "TimeQueue.h" 4 | #include "T2Utils.h" 5 | #include "T2Tile.h" 6 | 7 | namespace MFM { 8 | void T2CDMPanel::configure(SDLI & sdli) { 9 | /* Nothing to do so far */ 10 | } 11 | 12 | static void reportCDMInfo(ByteSink & bs) { 13 | static u32 prevmodtime; 14 | static u32 lastchangems; 15 | T2Main & m = T2Main::get(); 16 | u32 nowms = m.now(); 17 | const char * PATH = "/mnt/T2TMP/cdmStatus.txt"; // "/home/t2/T2-12/apps/cdm/cdm/cdmDEBUG/log/status.txt" 18 | u32 curmodtime = getModTimeOfFile(PATH); 19 | const u32 DOWN_TIME_SEC = 30; 20 | if (curmodtime != prevmodtime) { 21 | prevmodtime = curmodtime; 22 | lastchangems = nowms; 23 | } 24 | u32 diffms = nowms - lastchangems; 25 | if (diffms > DOWN_TIME_SEC*1000) { 26 | bs.Printf("CDM STATUS: DOWN?\n"); 27 | return; 28 | } 29 | if (diffms > 10 * 1000) { 30 | u32 sec = diffms/1000; 31 | bs.Printf("[%ds stale]",sec); 32 | } 33 | if (!readWholeFile(PATH,bs)) { 34 | bs.Printf("CDM STATUS: UNAVAILABLE\n"); 35 | } 36 | } 37 | 38 | void T2CDMPanel::onTimeout(TimeQueue& srcTQ) { 39 | 40 | insert(srcTQ,1024); // Otherwise update at about ~1HZ 41 | 42 | ResettableByteSink & rbs = this->GetByteSink(); 43 | rbs.Reset(); 44 | reportCDMInfo(rbs); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/src/T2DrawConfigPanel.cpp: -------------------------------------------------------------------------------- 1 | #include "T2DrawConfigPanel.h" 2 | 3 | #include "TimeQueue.h" 4 | #include "T2Utils.h" 5 | #include "SimLogPanel.h" 6 | #include "T2Tile.h" 7 | 8 | namespace MFM { 9 | void T2DrawConfigPanel::configure(SDLI & sdli) { 10 | /* Nothing to do so far */ 11 | } 12 | 13 | void T2DrawConfigPanel::onTimeout(TimeQueue& srcTQ) { 14 | T2Tile & tile = T2Tile::get(); 15 | const SiteRenderConfig & src = tile.getSiteRenderConfig(); 16 | 17 | ResettableByteSink & rbs = this->GetByteSink(); 18 | const char * typenames[] = 19 | { 20 | DrawPanelManager::getSuffixFromDrawSiteType(src.mBackType), 21 | DrawPanelManager::getSuffixFromDrawSiteType(src.mMidType), 22 | DrawPanelManager::getSuffixFromDrawSiteType(src.mFrontType) 23 | }; 24 | const int FLEN=11; 25 | char buf[50]; 26 | rbs.Reset(); 27 | for (u32 i = 0; i < sizeof(typenames)/sizeof(typenames[0]);++i) { 28 | const char * type = typenames[i]; 29 | int blen = strlen(type); 30 | int lside = (FLEN-blen)/2; 31 | int rside = FLEN-blen-lside; 32 | snprintf(buf,50,"%*s%s%*s", 33 | lside,"", 34 | typenames[i], 35 | rside,""); 36 | rbs.Printf("%s",buf); 37 | } 38 | rbs.Printf("\n\n\n\n\n\n\n\n\n\n\n"); 39 | insert(srcTQ,1024); // Otherwise update at about ~1HZ 40 | 41 | /* 42 | ResettableByteSink & rbs = this->GetByteSink(); 43 | rbs.Reset(); 44 | srcTQ.dumpQueue(rbs); 45 | */ 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/src/T2RadioButton.cpp: -------------------------------------------------------------------------------- 1 | #include "T2RadioButton.h" 2 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/src/T2RootPanel.cpp: -------------------------------------------------------------------------------- 1 | #include "T2RootPanel.h" 2 | #include "T2Constants.h" 3 | #include "T2Tile.h" 4 | #include "SDLI.h" 5 | #include "Point.h" 6 | 7 | namespace MFM { 8 | void T2RootPanel::addItems(Menu& menu) { 9 | DIE_UNIMPLEMENTED(); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/src/T2TimeQueuePanel.cpp: -------------------------------------------------------------------------------- 1 | #include "T2TimeQueuePanel.h" 2 | 3 | #include "TimeQueue.h" 4 | #include "T2Utils.h" 5 | #include "SimLogPanel.h" 6 | #include "T2Tile.h" 7 | 8 | namespace MFM { 9 | void T2TimeQueuePanel::configure(SDLI & sdli) { 10 | /* Nothing to do so far */ 11 | } 12 | 13 | void T2TimeQueuePanel::onTimeout(TimeQueue& srcTQ) { 14 | 15 | insert(srcTQ,1024); // Otherwise update at about ~1HZ 16 | 17 | ResettableByteSink & rbs = this->GetByteSink(); 18 | rbs.Reset(); 19 | srcTQ.dumpQueue(rbs); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/src/T2VizConstants.cpp: -------------------------------------------------------------------------------- 1 | #include "T2VizConstants.h" 2 | -------------------------------------------------------------------------------- /src/drivers/mfmt2/src/VizConfig.cpp: -------------------------------------------------------------------------------- 1 | #include "VizConfig.h" 2 | #include "T2Constants.h" 3 | 4 | #include "FileByteSource.h" 5 | 6 | namespace MFM { 7 | Panel * VizConfig::parseAndBuildFromPath(const char * path) { 8 | FileByteSource fbs(path); 9 | return parseAndBuild(fbs); 10 | } 11 | 12 | Panel * VizConfig::parseAndBuild(ByteSource & bs) { 13 | DIE_UNIMPLEMENTED(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/drivers/mfmtest/Makefile: -------------------------------------------------------------------------------- 1 | # Who we are 2 | COMPONENTNAME:=mfmtest 3 | 4 | # Where's the top 5 | BASEDIR:=../../.. 6 | 7 | # What we need to build 8 | override INCLUDES += -I $(BASEDIR)/src/core/include -I $(BASEDIR)/src/elements/include -I $(BASEDIR)/src/sim/include -I $(BASEDIR)/src/gui/include -I $(BASEDIR)/src/test/include 9 | 10 | # What we need to link 11 | override LIBS += -L $(BASEDIR)/build/core/ -L $(BASEDIR)/build/test/ -L $(BASEDIR)/build/sim/ -L $(BASEDIR)/build/gui/ 12 | override LIBS += -lmfmtest -lmfmsim -lmfmcore -lmfmgui 13 | 14 | # Do the program thing 15 | include $(BASEDIR)/config/Makeprog.mk 16 | -------------------------------------------------------------------------------- /src/drivers/mfmtest/include/main.h: -------------------------------------------------------------------------------- 1 | #ifndef MAIN_H 2 | #define MAIN_H 3 | 4 | #include "Tests.h" 5 | 6 | #endif /* MAIN_H */ 7 | -------------------------------------------------------------------------------- /src/drivers/mfzrun/Makefile: -------------------------------------------------------------------------------- 1 | BASEDIR:=../../.. 2 | COMPONENTNAME:=mfzrun 3 | DRIVER_NAME:=mfzrun 4 | BIN_DIR:=$(BASEDIR)/bin 5 | SRCS:=$(wildcard *.tmpl) 6 | TARGETS:=$(patsubst %.tmpl, $(BIN_DIR)/%, $(SRCS)) 7 | ALLDEP+=./Makefile 8 | 9 | include $(BASEDIR)/config/Makeplatform.mk 10 | MFM_TARGET:=$(PLATFORM) 11 | MFM_ROOT_DIR:=$(shell realpath $(BASEDIR)) 12 | include $(BASEDIR)/config/Makelib.mk 13 | 14 | all: $(TARGETS) $(MOD_TARGETS) 15 | 16 | $(BIN_DIR): FORCE 17 | mkdir -p $(BIN_DIR) 18 | 19 | $(BUILD_DIR): 20 | mkdir -p $(BUILD_DIR) 21 | 22 | $(BIN_DIR)/%: ./%.tmpl *.inc FORCE | $(BIN_DIR) 23 | perl -e 'while(<>){if($$_=~/<<>>/){system("cat $$1")} else {print}}' $< | \ 24 | sed \ 25 | -e "s|@DEBIAN_PACKAGE_NAME@|$(DEBIAN_PACKAGE_NAME)|" \ 26 | -e "s|@DEB_MFM_BINDIR@|$(DEB_MFM_BINDIR)|" \ 27 | -e "s|@DEB_MFM_RESDIR@|$(DEB_MFM_RESDIR)|" \ 28 | -e "s|@MFM_ROOT_DIR@|$(MFM_ROOT_DIR)|" \ 29 | -e "s|@MFM_VERSION_NUMBER@|$(MFM_VERSION_NUMBER)|" \ 30 | -e "s|@MFM_TREE_VERSION@|$(MFM_TREE_VERSION)|" \ 31 | -e "s|@MFM_CFLAGS@|$(CFLAGS)|" \ 32 | -e "s|@MFM_CPPFLAGS@|$(CPPFLAGS)|" \ 33 | -e "s|@MFM_LDFLAGS@|$(LDFLAGS)|" \ 34 | >$@ 35 | chmod 755 $@ 36 | 37 | # clean: FORCE 38 | # @rm -f *~ 39 | # @rm -f ${OBJS} 40 | 41 | # realclean: clean 42 | # @rm -f ${TARGET} 43 | 44 | .PHONY: FORCE 45 | -------------------------------------------------------------------------------- /src/drivers/mfzrun/mfm-config.tmpl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # -*- mode:perl -*- 3 | 4 | use strict; 5 | use warnings; 6 | 7 | my %VARS = ( 8 | DEBIAN_PACKAGE_NAME => q{@DEBIAN_PACKAGE_NAME@}, 9 | DEB_MFM_BINDIR => q{@DEB_MFM_BINDIR@}, 10 | DEB_MFM_RESDIR => q{@DEB_MFM_RESDIR@}, 11 | MFM_ROOT_DIR => q{@MFM_ROOT_DIR@}, 12 | MFM_VERSION_NUMBER => q{@MFM_VERSION_NUMBER@}, 13 | MFM_TREE_VERSION => q{@MFM_TREE_VERSION@}, 14 | MFM_CFLAGS => q{@MFM_CFLAGS@}, 15 | MFM_CPPFLAGS => q{@MFM_CPPFLAGS@}, 16 | MFM_LDFLAGS => q{@MFM_LDFLAGS@} 17 | ); 18 | 19 | my @alts = qw(sh perl make echo); 20 | 21 | sub UDie { 22 | print STDERR shift."\n"; 23 | print STDERR "Usage: $0 [help|[".join("|",@alts)."] VARNAME..]\n"; 24 | exit 1; 25 | } 26 | 27 | my $regex = '^('.join('|',@alts).')$'; 28 | 29 | UDie("At least one argument required") unless $#ARGV >= 0; 30 | 31 | my $cmd = shift @ARGV; 32 | 33 | UDie("") if lc($cmd) eq 'help'; 34 | 35 | if (lc($cmd) =~ /$regex/) { 36 | my $fmt = $1; 37 | my @allkeys = sort keys %VARS; 38 | my @requestedkeys = @ARGV; 39 | @requestedkeys = @allkeys unless @requestedkeys; 40 | for my $key (@requestedkeys) { 41 | print "$key=$VARS{$key}\n" if $fmt eq "sh"; 42 | print "use constant $key => q\{$VARS{$key}\};\n" if $fmt eq "perl"; 43 | print "$key:=$VARS{$key}\n" if $fmt eq "make"; 44 | print "$VARS{$key}\n" if $fmt eq "echo"; 45 | } 46 | exit 0; 47 | } 48 | 49 | UDie("Unrecognized '$cmd'"); 50 | -------------------------------------------------------------------------------- /src/drivers/stub/include/Stub.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef STUB_H 3 | #define STUB_H 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "itype.h" 14 | #include "Dirs.h" 15 | #include "DateTimeStamp.h" 16 | #include "Random.h" 17 | 18 | #include "T2Constants.h" 19 | #include "T2Main.h" 20 | 21 | namespace MFM { 22 | 23 | struct Stub : public T2Main { 24 | 25 | // Get the T2Main singleton set up; 26 | static void initInstance() { new Stub(); } 27 | 28 | static Stub & get() { 29 | T2Main * o = &T2Main::get(); 30 | Stub * c = dynamic_cast(o); 31 | MFM_API_ASSERT_NONNULL(c); 32 | return (Stub&) *c; 33 | } 34 | 35 | void initEverything(int argc, char ** argv) ; 36 | void main() ; 37 | 38 | protected: 39 | Stub() ; 40 | virtual ~Stub() ; 41 | 42 | }; 43 | } 44 | #endif /* STUB_H */ 45 | -------------------------------------------------------------------------------- /src/drivers/stub/include/main.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef MAIN_H 3 | #define MAIN_H 4 | 5 | #include "itype.h" 6 | #include "Dirs.h" 7 | #include "DateTimeStamp.h" 8 | #include "Logger.h" 9 | #include "FileByteSink.h" 10 | 11 | #include "Stub.h" 12 | 13 | #endif /* MAIN_H */ 14 | -------------------------------------------------------------------------------- /src/drivers/stub/src/Stub.cpp: -------------------------------------------------------------------------------- 1 | #include "Stub.h" 2 | 3 | namespace MFM { 4 | Stub::Stub() 5 | : T2Main() 6 | { } 7 | 8 | void Stub::initEverything(int argc, char ** argv) { 9 | FAIL(INCOMPLETE_CODE); 10 | } 11 | 12 | void Stub::main() { 13 | FAIL(INCOMPLETE_CODE); 14 | } 15 | 16 | Stub::~Stub() { } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/drivers/stub/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "TimeQueue.h" 9 | #include "T2Utils.h" 10 | 11 | namespace MFM { 12 | 13 | int MainDispatch(int argc, char** argv) 14 | { 15 | // Early early logging 16 | LOG.SetByteSink(STDERR); 17 | LOG.SetLevel(LOG.MESSAGE); 18 | 19 | // MAKE THE SINGLETON 20 | Stub::initInstance(); 21 | 22 | Stub & cdm = Stub::get(); 23 | cdm.initEverything(argc,argv); 24 | 25 | unwind_protect({ 26 | const char * file = (const char *) unwindProtect_FailException.mFile; 27 | int line = unwindProtect_FailException.mLine; 28 | int code = unwindProtect_FailException.mCode; 29 | //const char * msg = MFMFailCodeReason(code); 30 | 31 | MFMPrintError(stderr,file,line,code); 32 | fprintf(stderr,"Failed out of top-level\n"); 33 | exit(99); 34 | },{ 35 | cdm.main(); 36 | }); 37 | 38 | return 0; 39 | } 40 | } 41 | 42 | 43 | int main(int argc, char** argv) 44 | { 45 | unwind_protect({ 46 | const char * file = (const char *) unwindProtect_FailException.mFile; 47 | int line = unwindProtect_FailException.mLine; 48 | int code = unwindProtect_FailException.mCode; 49 | //const char * msg = MFMFailCodeReason(code); 50 | 51 | MFMPrintError(stderr,file,line,code); 52 | fprintf(stderr,"Failed out of main\n"); 53 | exit(99); 54 | },{ 55 | return MFM::MainDispatch(argc,argv); 56 | }); 57 | } 58 | -------------------------------------------------------------------------------- /src/drivers/ulamtest/Makefile: -------------------------------------------------------------------------------- 1 | # Who we are 2 | COMPONENTNAME:=ulamtest 3 | 4 | # Where's the top 5 | BASEDIR:=../../.. 6 | 7 | # What we need to build 8 | override INCLUDES += -I $(BASEDIR)/src/core/include -I $(BASEDIR)/src/elements/include -I $(BASEDIR)/src/sim/include -I $(BASEDIR)/src/gui/include -I $(BASEDIR)/src/test/include 9 | 10 | # What we need to link 11 | override LIBS += -L $(BASEDIR)/build/core/ -L $(BASEDIR)/build/test/ -L $(BASEDIR)/build/sim/ -L $(BASEDIR)/build/gui/ 12 | override LIBS += -lmfmtest -lmfmsim -lmfmcore -lmfmgui 13 | 14 | # Do the program thing 15 | include $(BASEDIR)/config/Makeprog.mk 16 | -------------------------------------------------------------------------------- /src/drivers/ulamtest/include/main.h: -------------------------------------------------------------------------------- 1 | #ifndef MAIN_H 2 | #define MAIN_H 3 | 4 | #include "Tests.h" 5 | 6 | #endif /* MAIN_H */ 7 | -------------------------------------------------------------------------------- /src/drivers/ulamtest/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | using namespace MFM; 4 | 5 | #define TEST(className) \ 6 | do { \ 7 | MFM::LOG.Message("Starting " # className); \ 8 | className::Test_RunTests(); \ 9 | MFM::LOG.Message("Done " # className); \ 10 | } while (0) 11 | 12 | int main(int argc, char** argv) 13 | { 14 | if (argc > 1) 15 | { 16 | MFM::LOG.SetByteSink(MFM::STDERR); 17 | MFM::LOG.SetLevel(MFM::LOG.ALL); 18 | } 19 | 20 | TEST(UlamElement_Test); 21 | 22 | TEST(GridTransceiver_Test); 23 | TEST(ElementRegistry_Test); 24 | TEST(ByteSource_Test); 25 | TEST(LineTailByteSink_Test); 26 | TEST(OverflowableCharBufferByteSink_Test); 27 | TEST(VArguments_Test); 28 | TEST(Logger_Test); 29 | TEST(UUID_Test); 30 | TEST(ByteSink_Test); 31 | TEST(Parity2D_4x4_Test); 32 | TEST(PSym_Test); 33 | 34 | TEST(Fail_Test); 35 | TEST(FXP_Test); 36 | TEST(ColorMap_Test); 37 | TEST(Random_Test); 38 | TEST(BitVector_Test); 39 | 40 | Point_Test::Test_pointAdd(); 41 | Point_Test::Test_pointMultiply(); 42 | 43 | MDist_Test::Test_MDistConversion(); 44 | 45 | #if 0 /* DEPRECATED */ 46 | P1Atom_Test::Test_p1atomState(); 47 | P1Atom_Test::Test_p1atomLBCount(); 48 | P1Atom_Test::Test_p1atomReadBody(); 49 | P1Atom_Test::Test_p1atomAddLB(); 50 | P1Atom_Test::Test_p1atomAddSB(); 51 | #endif 52 | 53 | TEST(EventWindow_Test); 54 | TEST(Tile_Test); 55 | 56 | Grid_Test::Test_gridPlaceAtom(); 57 | 58 | TEST(ExternalConfig_Test); 59 | 60 | return 0; 61 | } 62 | -------------------------------------------------------------------------------- /src/elements/Makefile: -------------------------------------------------------------------------------- 1 | # Who we are 2 | COMPONENTNAME:=elements 3 | 4 | # Where's the top 5 | BASEDIR:=../.. 6 | 7 | # What we need from outside 8 | override INCLUDES += -I $(BASEDIR)/src/core/include 9 | 10 | # Magic def to put newlines in patsubst results 11 | define \n 12 | 13 | 14 | endef 15 | 16 | ELEMENTS:=$(wildcard src/Element_*.cpp) 17 | HASH:=\# 18 | ELEMENT_HEADER_INCLUDES:=$(patsubst src/%.cpp,$(HASH)include "%.h"\n,$(ELEMENTS)) 19 | #${warning EHI $(ELEMENT_HEADER_INCLUDES) iha} 20 | ELEMENT_MACRO_INVOKES:=$(patsubst src/%.cpp,XX(%);\n,$(ELEMENTS)) 21 | UNUSED1:=${shell printf %b '$(ELEMENT_HEADER_INCLUDES)' > include/StdElementsHeaders.inc} 22 | UNUSED2:=${shell printf %b '$(ELEMENT_MACRO_INVOKES)' > include/StdElements.inc} 23 | 24 | # Do the library thing 25 | include $(BASEDIR)/config/Makelib.mk 26 | 27 | # Extra dependencies for StdElements 28 | $(BASEDIR)/build/$(COMPONENTNAME)/StdElements.o: include/StdElements.inc 29 | $(BASEDIR)/build/$(COMPONENTNAME)/StdElements.o: include/StdElements.tcc 30 | $(BASEDIR)/build/$(COMPONENTNAME)/StdElements.o: include/StdElementsHeaders.inc 31 | $(BASEDIR)/build/$(COMPONENTNAME)/StdElements.o: src/StdElements.cpp 32 | -------------------------------------------------------------------------------- /src/elements/include/CityConstants.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef CITY_CONSTANTS_H 3 | #define CITY_CONSTANTS_H 4 | 5 | namespace MFM 6 | { 7 | class CityConstants 8 | { 9 | public: 10 | enum 11 | { 12 | CITY_BUILDING_COUNT = 20, /*! MAKE SURE TO CHANGE BOTH !*/ 13 | CITY_BUILDING_COUNT_LOG2 = 5 14 | }; 15 | }; 16 | } 17 | 18 | #endif /* CITY_CONSTANTS_H */ 19 | -------------------------------------------------------------------------------- /src/elements/include/Element_CheckerForkBlue.tcc: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #include "Element_CheckerForkRed.h" 3 | 4 | namespace MFM 5 | { 6 | template 7 | void Element_CheckerForkBlue::Behavior(EventWindow& window) const 8 | { 9 | SPoint pt; 10 | int i = 0; 11 | 12 | for(Dir d = Dirs::NORTH; i < 4; d = Dirs::CWDir(Dirs::CWDir(d)), i++) 13 | { 14 | Dirs::FillDir(pt, d, false); 15 | pt /= 2; 16 | if(window.IsLiveSiteSym(pt)) 17 | { 18 | window.SetRelativeAtomSym(pt, Element_CheckerForkRed::THE_INSTANCE.GetDefaultAtom()); 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/elements/include/Element_CheckerForkRed.tcc: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #include "Element_CheckerForkBlue.h" 3 | 4 | namespace MFM 5 | { 6 | template 7 | void Element_CheckerForkRed::Behavior(EventWindow& window) const 8 | { 9 | SPoint pt; 10 | int i = 0; 11 | 12 | for(Dir d = Dirs::NORTH; i < 4; d = Dirs::CWDir(Dirs::CWDir(d)), i++) 13 | { 14 | Dirs::FillDir(pt, d, false); 15 | pt /= 2; 16 | if(window.IsLiveSiteSym(pt)) 17 | { 18 | window.SetRelativeAtomSym(pt, Element_CheckerForkBlue::THE_INSTANCE.GetDefaultAtom()); 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/elements/include/StdElements.tcc: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #include "StdElementsHeaders.inc" 3 | 4 | namespace MFM { 5 | template 6 | StdElements::StdElements() : m_stdElements(0) { 7 | #define XX(eltName) \ 8 | LOG.Debug("StdElement #%d: %@",++m_stdElements, & eltName::THE_INSTANCE.GetUUID()) 9 | #include "StdElements.inc" 10 | #undef XX 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/elements/src/AbstractElement_ForkBomb.cpp: -------------------------------------------------------------------------------- 1 | #include "AbstractElement_ForkBomb.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/AbstractElement_Reprovert.cpp: -------------------------------------------------------------------------------- 1 | #include "AbstractElement_Reprovert.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/AbstractElement_WaPat.cpp: -------------------------------------------------------------------------------- 1 | #include "AbstractElement_WaPat.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/AbstractElement_Wanderer.cpp: -------------------------------------------------------------------------------- 1 | #include "AbstractElement_Wanderer.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/AbstractElement_Xtal.cpp: -------------------------------------------------------------------------------- 1 | #include "AbstractElement_Xtal.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_AntiForkBomb.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_AntiForkBomb.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_Block.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Block.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_CheckerForkBlue.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_CheckerForkBlue.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_CheckerForkRed.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_CheckerForkRed.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_Collector.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Collector.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_Consumer.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Consumer.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_Data.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Data.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_Dmover.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Dmover.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_Dreg.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Dreg.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_Emitter.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Emitter.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_Fish.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Fish.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_ForkBomb1.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_ForkBomb1.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_ForkBomb2.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_ForkBomb2.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_ForkBomb3.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_ForkBomb3.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_Indexed.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Indexed.h" 2 | 3 | namespace MFM { 4 | } 5 | -------------------------------------------------------------------------------- /src/elements/src/Element_MQBar.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_MQBar.h" 2 | 3 | #if 0 // Sun Feb 1 05:27:33 2015 UNREIMPLEMENTED AS YET IN v3 4 | #ifdef ELEMENT_PLUG_IN 5 | 6 | #include "StdEventConfig.h" 7 | 8 | extern "C" { 9 | static void * getref() { 10 | return (void *) & (MFM::Element_MQBar::THE_INSTANCE); 11 | } 12 | typedef void* (*FuncPtr)(); 13 | FuncPtr get_static_element_pointer[] = { getref }; 14 | } 15 | 16 | #endif /* ELEMENT_PLUG_IN */ 17 | #endif // UNREIMPLEMENTED 18 | -------------------------------------------------------------------------------- /src/elements/src/Element_Mover.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Mover.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_Res.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Res.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_Rocket.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Rocket.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_Shark.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Shark.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_Sorter.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Sorter.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_Wall.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Wall.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_Wanderer_Cyan.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Wanderer_Cyan.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_Wanderer_Magenta.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Wanderer_Magenta.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_Xtal_General.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Xtal_General.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_Xtal_L12.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Xtal_L12.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_Xtal_R12.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Xtal_R12.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/Element_Xtal_Sq1.cpp: -------------------------------------------------------------------------------- 1 | #include "Element_Xtal_Sq1.h" 2 | -------------------------------------------------------------------------------- /src/elements/src/StdElements.cpp: -------------------------------------------------------------------------------- 1 | #include "StdElements.h" 2 | -------------------------------------------------------------------------------- /src/gui/Makefile: -------------------------------------------------------------------------------- 1 | # Who we are 2 | COMPONENTNAME:=gui 3 | 4 | # Where's the top 5 | BASEDIR:=../.. 6 | 7 | # What we need from outside 8 | override INCLUDES += -I $(BASEDIR)/src/core/include -I $(BASEDIR)/src/elements/include -I $(BASEDIR)/src/sim/include 9 | override INCLUDES += $(shell sdl-config --cflags) 10 | 11 | # Do the library thing 12 | include $(BASEDIR)/config/Makelib.mk 13 | -------------------------------------------------------------------------------- /src/gui/include/AtomViewPanel.tcc: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #include "GridPanel.h" 3 | 4 | namespace MFM { 5 | 6 | template 7 | bool AtomViewPanel::Handle(MouseButtonEvent& mbe) 8 | { 9 | SDL_MouseButtonEvent & event = mbe.m_event.button; 10 | bool isLeft = event.button == SDL_BUTTON_LEFT; 11 | bool isRight = event.button == SDL_BUTTON_RIGHT; 12 | if ((mbe.m_keyboardModifiers == 0) && (isLeft || isRight)) 13 | { 14 | if(event.type == SDL_MOUSEBUTTONDOWN) 15 | GetGridPanel().SelectAtomViewPanel(*this); 16 | return true; // Eat all no-mod mouse L and R actions inside us 17 | } 18 | 19 | return Super::Handle(mbe); 20 | } 21 | 22 | template 23 | bool AtomViewPanel::Handle(MouseMotionEvent& mme) 24 | { 25 | if ((mme.m_keyboardModifiers == 0) && GridPanel::IsLeftOrRightSetInButtonMask(mme.m_buttonMask)) 26 | { 27 | return true; // Eat all no-mod motion L and R actions inside us 28 | } 29 | 30 | return Super::Handle(mme); 31 | } 32 | 33 | template 34 | bool AtomViewPanel::Handle(KeyboardEvent& kbe) 35 | { 36 | SDL_KeyboardEvent & key = kbe.m_event; 37 | if(key.type == SDL_KEYUP) 38 | { 39 | if (key.keysym.sym == SDLK_ESCAPE) 40 | { 41 | GetGridPanel().UnselectAtomViewPanel(*this); 42 | this->ClearAtomCoord(); 43 | this->SetVisible(false); 44 | return true; 45 | } 46 | } 47 | return Super::Handle(kbe); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/gui/include/EditingTool.h: -------------------------------------------------------------------------------- 1 | /* -*- mode:C++ -*- 2 | EditingTool.h Enumeration of all editing tool types 3 | Copyright (C) 2014 The Regents of the University of New Mexico. All rights reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 18 | USA 19 | */ 20 | 21 | /** 22 | \file EditingTool.h Enumeration of all editing tool types 23 | \author Trent R. Small 24 | \date (C) 2014 All rights reserved. 25 | \lgpl 26 | */ 27 | 28 | #ifndef EDITINGTOOL_H 29 | #define EDITINGTOOL_H 30 | 31 | namespace MFM 32 | { 33 | enum EditingTool 34 | { 35 | TOOL_SELECTOR, 36 | TOOL_ATOM_SELECTOR, 37 | TOOL_PENCIL, 38 | TOOL_BUCKET, 39 | TOOL_ERASER, 40 | TOOL_BRUSH, 41 | TOOL_XRAY, 42 | TOOL_CLONE, 43 | TOOL_AIRBRUSH 44 | }; 45 | } 46 | 47 | #endif /* EDITINGTOOL_H */ 48 | -------------------------------------------------------------------------------- /src/gui/include/GridPanel.tcc: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | 3 | namespace MFM { 4 | 5 | template 6 | const char * GridPanel::GetEventHistoryStrategyName(EventHistoryStrategy t) 7 | { 8 | switch (t) 9 | { 10 | default: 11 | FAIL(ILLEGAL_ARGUMENT); 12 | case EVENT_HISTORY_STRATEGY_NONE: return "Off"; 13 | case EVENT_HISTORY_STRATEGY_SELECTED: return "Tile"; 14 | case EVENT_HISTORY_STRATEGY_ALL: return "On"; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/gui/include/GridTool.tcc: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #include "GridPanel.h" 3 | #include "ToolboxPanel.h" 4 | #include "Fail.h" 5 | 6 | namespace MFM { 7 | template 8 | void GridToolShapeUpdater::SaveDetails(ByteSink & sink) const 9 | { 10 | const char * tag = this->GetTag(); 11 | sink.Printf(" PP(%s_trad=%d)\n", tag, m_toolRadius); 12 | sink.Printf(" PP(%s_tshp=%d)\n", tag, m_toolShape); 13 | } 14 | 15 | template 16 | bool GridToolShapeUpdater::LoadDetails(const char * key, LineCountingByteSource & source) 17 | { 18 | const char * tag = this->GetTag(); 19 | CharBufferByteSource cbbs(key, strlen(key)); 20 | 21 | cbbs.Reset(); 22 | if (6 == cbbs.Scanf("%z_trad",tag)) 23 | return 1 == source.Scanf("%?d", sizeof m_toolRadius, &m_toolRadius); 24 | 25 | cbbs.Reset(); 26 | if (6 == cbbs.Scanf("%z_tshp",tag)) 27 | return 1 == source.Scanf("%?d", sizeof m_toolShape, &m_toolShape); 28 | 29 | return false; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/gui/include/ReplayPanel.tcc: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | 3 | #include "GridPanel.h" 4 | 5 | namespace MFM { 6 | 7 | template 8 | void ReplayPanel::TransportButton::UpdateEnabling() 9 | { 10 | this->SetEnabled(m_replayPanel.GetGridPanel().AreAnyTilesSelected()); 11 | } 12 | 13 | template 14 | void ReplayPanel::TransportButton::OnClick(u8 button) 15 | { 16 | OurGridPanel& gridPanel = this->m_replayPanel.GetGridPanel(); 17 | OurGrid& grid = gridPanel.GetGrid(); 18 | for (u32 tx = 0; tx < grid.GetWidth(); ++tx) 19 | { 20 | for (u32 ty = 0; ty < grid.GetHeight(); ++ty) 21 | { 22 | UPoint utc(tx,ty); 23 | if (gridPanel.IsTileSelected(utc)) 24 | { 25 | OurTile & tile = grid.GetTile(MakeSigned(utc)); 26 | OurEventHistoryBuffer & ehb = tile.GetEventHistoryBuffer(); 27 | ehb.MoveCursor(m_delta); 28 | } 29 | } 30 | } 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/gui/include/RootPanel.h: -------------------------------------------------------------------------------- 1 | /* -*- mode:C++ -*- 2 | RootPanel.h - A panel with special actions for being at the top 3 | Copyright (C) 2021 Living Computation Foundation 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 18 | USA 19 | */ 20 | 21 | /** 22 | \file RootPanel.h Hierarchical rendering system 23 | \author David H. Ackley. 24 | \date (C) 2021 All rights reserved. 25 | \lgpl 26 | */ 27 | #ifndef ROOTPANEL_H 28 | #define ROOTPANEL_H 29 | 30 | #include "Panel.h" 31 | 32 | namespace MFM 33 | { 34 | 35 | struct RootPanel : public Panel 36 | { 37 | typedef Panel Super; 38 | 39 | /** Override Paint to establish an error context */ 40 | virtual void Paint(Drawing & config); 41 | }; 42 | 43 | } /* namespace MFM */ 44 | #endif /*ROOTPANEL_H*/ 45 | -------------------------------------------------------------------------------- /src/gui/src/AbstractCheckbox.cpp: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #include "AbstractCheckbox.h" 3 | -------------------------------------------------------------------------------- /src/gui/src/AbstractGUIDriver.cpp: -------------------------------------------------------------------------------- 1 | #include "AbstractGUIDriver.h" 2 | 3 | -------------------------------------------------------------------------------- /src/gui/src/AbstractGUIDriverButtons.cpp: -------------------------------------------------------------------------------- 1 | #include "AbstractGUIDriverButtons.h" 2 | -------------------------------------------------------------------------------- /src/gui/src/AbstractGUIDriverTools.cpp: -------------------------------------------------------------------------------- 1 | #include "AbstractGUIDriverTools.h" 2 | -------------------------------------------------------------------------------- /src/gui/src/AssetManager.cpp: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #include "AssetManager.h" 3 | 4 | namespace MFM 5 | { 6 | SDL_Surface* AssetManager::surfaces[IMAGE_ASSET_COUNT] = { NULL }; 7 | 8 | TTF_Font* AssetManager::fonts[FONT_ASSET_COUNT] = { NULL }; 9 | 10 | TTF_Font* AssetManager::zfonts[ZFONT_HEIGHT_COUNT][2] = { NULL }; 11 | 12 | bool AssetManager::initialized = false; 13 | } 14 | -------------------------------------------------------------------------------- /src/gui/src/AtomViewPanel.cpp: -------------------------------------------------------------------------------- 1 | #include "AtomViewPanel.h" 2 | -------------------------------------------------------------------------------- /src/gui/src/DrawableSDL.cpp: -------------------------------------------------------------------------------- 1 | #include "DrawableSDL.h" 2 | -------------------------------------------------------------------------------- /src/gui/src/DriverButtonPanel.cpp: -------------------------------------------------------------------------------- 1 | #include "DriverButtonPanel.h" 2 | -------------------------------------------------------------------------------- /src/gui/src/EditingTool.cpp: -------------------------------------------------------------------------------- 1 | #include "EditingTool.h" 2 | -------------------------------------------------------------------------------- /src/gui/src/ExternalConfigSectionGUI.cpp: -------------------------------------------------------------------------------- 1 | #include "ExternalConfigSectionGUI.h" 2 | -------------------------------------------------------------------------------- /src/gui/src/GUIConstants.cpp: -------------------------------------------------------------------------------- 1 | #include "GUIConstants.h" 2 | -------------------------------------------------------------------------------- /src/gui/src/GridPanel.cpp: -------------------------------------------------------------------------------- 1 | #include "GridPanel.h" 2 | 3 | -------------------------------------------------------------------------------- /src/gui/src/GridTool.cpp: -------------------------------------------------------------------------------- 1 | #include "GridTool.h" 2 | -------------------------------------------------------------------------------- /src/gui/src/HelpPanel.cpp: -------------------------------------------------------------------------------- 1 | #include "HelpPanel.h" 2 | -------------------------------------------------------------------------------- /src/gui/src/Mouse.cpp: -------------------------------------------------------------------------------- 1 | #include "Mouse.h" 2 | 3 | namespace MFM { 4 | 5 | void Mouse::HandleButtonEvent(SDL_MouseButtonEvent* e) 6 | { 7 | if(e->state == SDL_PRESSED) 8 | { 9 | Press(e->button); 10 | } 11 | else if(e->state == SDL_RELEASED) 12 | { 13 | Release(e->button); 14 | } 15 | } 16 | 17 | void Mouse::HandleMotionEvent(SDL_MouseMotionEvent* e) 18 | { 19 | m_x = e->x; 20 | m_y = e->y; 21 | } 22 | 23 | void Mouse::Press(u8 button) 24 | { 25 | m_current.insert(button); 26 | } 27 | 28 | void Mouse::Release(u8 button) 29 | { 30 | m_current.erase(button); 31 | } 32 | 33 | bool Mouse::IsDown(u8 button) 34 | { 35 | return m_current.count(button) > 0; 36 | } 37 | 38 | bool Mouse::IsUp(u8 button) 39 | { 40 | return m_current.count(button) == 0; 41 | } 42 | 43 | bool Mouse::SemiAuto(u8 button) 44 | { 45 | return m_current.count(button) > 0 && 46 | m_prev.count(button) == 0; 47 | } 48 | 49 | void Mouse::FillPoint(SPoint* out) 50 | { 51 | out->Set(m_x, m_y); 52 | } 53 | 54 | void Mouse::Flip() 55 | { 56 | m_prev = m_current; 57 | } 58 | } /* namespace MFM */ 59 | 60 | -------------------------------------------------------------------------------- /src/gui/src/MovablePanel.cpp: -------------------------------------------------------------------------------- 1 | #include "MovablePanel.h" 2 | -------------------------------------------------------------------------------- /src/gui/src/NeighborSelectPanel.cpp: -------------------------------------------------------------------------------- 1 | #include "NeighborSelectPanel.h" 2 | -------------------------------------------------------------------------------- /src/gui/src/ParameterController.cpp: -------------------------------------------------------------------------------- 1 | #include "ParameterController.h" 2 | -------------------------------------------------------------------------------- /src/gui/src/ParameterControllerBool.cpp: -------------------------------------------------------------------------------- 1 | #include "ParameterControllerBool.h" 2 | -------------------------------------------------------------------------------- /src/gui/src/ReplayPanel.cpp: -------------------------------------------------------------------------------- 1 | #include "ReplayPanel.h" 2 | -------------------------------------------------------------------------------- /src/gui/src/RootPanel.cpp: -------------------------------------------------------------------------------- 1 | #include "RootPanel.h" 2 | #include "Drawing.h" 3 | #include "Logger.h" 4 | 5 | 6 | namespace MFM { 7 | 8 | // Offer an easy place to breakpoint on, outside the unwind_protect 9 | static void rootPanelFailMessage() { 10 | LOG.Message("Painting failed to the root panel: Drawing incomplete"); 11 | } 12 | 13 | void RootPanel::Paint(Drawing & drawing) 14 | { 15 | Rect wdw; 16 | drawing.GetWindow(wdw); 17 | u32 bg = drawing.GetBackground(); 18 | u32 fg = drawing.GetForeground(); 19 | 20 | unwind_protect( 21 | { 22 | LogBacktrace(MFMThrownBacktraceArray, MFMThrownBacktraceSize); 23 | rootPanelFailMessage(); 24 | }, 25 | { 26 | this->Super::Paint(drawing); // Dish to regular panel 27 | }); 28 | 29 | drawing.SetWindow(wdw); // FWIW 30 | drawing.SetBackground(bg); 31 | drawing.SetForeground(fg); 32 | } 33 | 34 | } /* namespace MFM */ 35 | -------------------------------------------------------------------------------- /src/gui/src/Slider.cpp: -------------------------------------------------------------------------------- 1 | #include "Slider.h" 2 | -------------------------------------------------------------------------------- /src/gui/src/StatisticsPanel.cpp: -------------------------------------------------------------------------------- 1 | #include "StatisticsPanel.h" 2 | -------------------------------------------------------------------------------- /src/gui/src/StdPanel.cpp: -------------------------------------------------------------------------------- 1 | #include "StdPanel.h" 2 | 3 | namespace MFM 4 | { 5 | bool StdPanel::Handle(SDL_MouseButtonEvent & event) 6 | { 7 | const SPoint at(event.x, event.y); 8 | switch (event.type) { 9 | case SDL_MOUSEBUTTONUP: { 10 | switch (event.button) { 11 | case SDL_BUTTON_WHEELUP: 12 | return ScrollUp(); 13 | case SDL_BUTTON_WHEELDOWN: 14 | return ScrollDown(); 15 | default: 16 | return Click(at, event.button, 0); // XXX Get modifiers 17 | } 18 | break; 19 | } 20 | case SDL_MOUSEBUTTONDOWN: 21 | FAIL(INCOMPLETE_CODE); 22 | default: 23 | FAIL(INCOMPLETE_CODE); 24 | } 25 | return false; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/gui/src/TextPanel.cpp: -------------------------------------------------------------------------------- 1 | #include "TextPanel.h" 2 | -------------------------------------------------------------------------------- /src/gui/src/TileRenderer.cpp: -------------------------------------------------------------------------------- 1 | #include "TileRenderer.h" 2 | 3 | namespace MFM { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/gui/src/ToolboxPanel.cpp: -------------------------------------------------------------------------------- 1 | #include "ToolboxPanel.h" 2 | -------------------------------------------------------------------------------- /src/gui/src/TreeViewPanel.cpp: -------------------------------------------------------------------------------- 1 | #include "TreeViewPanel.h" 2 | 3 | namespace MFM { 4 | void TreeViewPanel::PaintComponent(Drawing& d) 5 | { 6 | d.SetBackground(Panel::GetBackground()); 7 | d.SetForeground(Panel::GetForeground()); 8 | d.FillRect(Rect(SPoint(0, 0), Panel::GetDimensions())); 9 | 10 | FAIL(INCOMPLETE_CODE); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/images/Makefile: -------------------------------------------------------------------------------- 1 | all: icons 2 | make -C icons 3 | -------------------------------------------------------------------------------- /src/images/icons/Makefile: -------------------------------------------------------------------------------- 1 | DESTDIR:=../../../res/images 2 | ZSHEET_FILE:=mfms-icons-ZSHEET.png 3 | ZSHEET_PATH:=$(DESTDIR)/$(ZSHEET_FILE) 4 | ZSHEET_FILE_T2:=t2viz-icons-ZSHEET.png 5 | ZSHEET_PATH_T2:=$(DESTDIR)/$(ZSHEET_FILE_T2) 6 | 7 | all: $(ZSHEET_PATH) $(ZSHEET_PATH_T2) 8 | 9 | $(ZSHEET_PATH): generateZSheetFromMasterRowSVG.pl mfms-icons.svg Makefile 10 | ./generateZSheetFromMasterRowSVG.pl ./mfms-icons.svg 11 | mv -f $(ZSHEET_FILE) $(ZSHEET_PATH) 12 | 13 | $(ZSHEET_PATH_T2): generateT2VizZSheetFromMasterRowSVG.pl t2viz-icons.svg Makefile 14 | ./generateT2VizZSheetFromMasterRowSVG.pl ./t2viz-icons.svg 15 | mv -f $(ZSHEET_FILE_T2) $(ZSHEET_PATH_T2) 16 | 17 | -------------------------------------------------------------------------------- /src/platform-linux/MakePlatform.mk: -------------------------------------------------------------------------------- 1 | # Platform-specific definitions needed by builds of all components, 2 | # not just us 3 | 4 | override INCLUDES += -I $(BASEDIR)/src/platform-linux/include 5 | 6 | # Gah, relink core after ourselves -- we need to get MFMFailCodeReason 7 | # from libcore, and usually nobody but us uses that. 8 | 9 | override LIBS += -L $(BASEDIR)/build/platform-linux -l mfmplatform-linux -l mfmcore 10 | -------------------------------------------------------------------------------- /src/platform-linux/Makefile: -------------------------------------------------------------------------------- 1 | # Who we are 2 | COMPONENTNAME:=platform-linux 3 | 4 | # Where's the top 5 | BASEDIR:=../.. 6 | 7 | # What we need from outside 8 | override INCLUDES += 9 | 10 | # Do the library thing 11 | include $(BASEDIR)/config/Makelib.mk 12 | -------------------------------------------------------------------------------- /src/platform-linux/src/IsLocalPlatformSpecific.cpp: -------------------------------------------------------------------------------- 1 | #include "IsLocalPlatformSpecific.h" 2 | -------------------------------------------------------------------------------- /src/platform-tile/MakePlatform.mk: -------------------------------------------------------------------------------- 1 | # Platform-specific definitions needed by builds of all components, 2 | # not just us 3 | 4 | override INCLUDES += -I $(BASEDIR)/src/platform-tile/include 5 | 6 | # Gah, relink core after ourselves -- we need to get MFMFailCodeReason 7 | # from libcore, and usually nobody but us uses that. 8 | 9 | override LIBS += -L $(BASEDIR)/build/platform-tile -l mfmplatform-tile -l mfmcore 10 | -------------------------------------------------------------------------------- /src/platform-tile/Makefile: -------------------------------------------------------------------------------- 1 | # Who we are 2 | COMPONENTNAME:=platform-tile 3 | 4 | # Where's the top 5 | BASEDIR:=../.. 6 | 7 | # What we need from outside 8 | override INCLUDES += 9 | 10 | # Special dispensation for IsLocalPlatformSpecific.. 11 | CPPFLAGS += -Wno-return-local-addr 12 | 13 | # Do the library thing 14 | include $(BASEDIR)/config/Makelib.mk 15 | -------------------------------------------------------------------------------- /src/platform-tile/src/IsLocalPlatformSpecific.cpp: -------------------------------------------------------------------------------- 1 | #include "IsLocalPlatformSpecific.h" 2 | 3 | /* At least with gcc-5_5.4.0 on ubuntu xenial, gcc sees through the 4 | 'void * ret = &local; return ret;' code with a return-local-addr 5 | warning, which we promote to an error, which then kills the build. 6 | 7 | So ../Makefile is now compiling the files in this directory with 8 | '-Wno-error=return-local-addr'.. 9 | */ 10 | 11 | void * __attribute__ ((noinline)) getStackBound() 12 | { 13 | return __builtin_frame_address(0); // This seems tailor-made, no? 14 | } 15 | -------------------------------------------------------------------------------- /src/sim/Makefile: -------------------------------------------------------------------------------- 1 | # Who we are 2 | COMPONENTNAME:=sim 3 | 4 | # Where's the top 5 | BASEDIR:=../.. 6 | 7 | # What we need from outside 8 | override INCLUDES += -I $(BASEDIR)/src/core/include -I $(BASEDIR)/src/elements/include 9 | 10 | # Do the library thing 11 | include $(BASEDIR)/config/Makelib.mk 12 | -------------------------------------------------------------------------------- /src/sim/include/ConfigFunctionCall.tcc: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | 3 | namespace MFM 4 | { 5 | template 6 | bool ConfigFunctionCall::SkipToNextExistingArg(LineCountingByteSource & in, const char * description) 7 | { 8 | s32 ret = this->SkipToNextArg(in); 9 | if (ret < 0) 10 | { 11 | return false; // Message already issued 12 | } 13 | 14 | if (ret == 0) 15 | { 16 | if (description) 17 | { 18 | return in.Msg(Logger::ERROR, "Missing argument, expected %s", description); 19 | } 20 | else 21 | { 22 | return in.Msg(Logger::ERROR, "Missing argument"); 23 | } 24 | 25 | } 26 | 27 | return true; 28 | } 29 | 30 | template 31 | s32 ConfigFunctionCall::SkipToNextArg(LineCountingByteSource & in) 32 | { 33 | in.SkipWhitespace(); 34 | s32 ch = in.Read(); 35 | if (ch == ')') return 0; 36 | if (ch == ',') { 37 | in.SkipWhitespace(); 38 | return 1; 39 | } 40 | if (ch < 0) { 41 | if (ch == -1) 42 | in.Msg(Logger::ERROR, "Unexpected EOF while looking for ',' or ')'"); 43 | else 44 | in.Msg(Logger::ERROR, "I/O error (%d)", ch); 45 | } else 46 | in.Msg(Logger::ERROR, "Expected ',' or ')', not '%c'",ch); 47 | return -1; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/sim/src/AbstractDriver.cpp: -------------------------------------------------------------------------------- 1 | #include "AbstractDriver.h" 2 | -------------------------------------------------------------------------------- /src/sim/src/AbstractDualDriver.cpp: -------------------------------------------------------------------------------- 1 | #include "AbstractDualDriver.h" 2 | -------------------------------------------------------------------------------- /src/sim/src/ConfigFunctionCall.cpp: -------------------------------------------------------------------------------- 1 | #include "ConfigFunctionCall.h" 2 | 3 | namespace MFM { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/sim/src/DateTimeStamp.cpp: -------------------------------------------------------------------------------- 1 | #include "DateTimeStamp.h" 2 | -------------------------------------------------------------------------------- /src/sim/src/DebugTools.cpp: -------------------------------------------------------------------------------- 1 | #include "DebugTools.h" 2 | 3 | -------------------------------------------------------------------------------- /src/sim/src/ElementLibrary.cpp: -------------------------------------------------------------------------------- 1 | #include "ElementLibrary.h" 2 | -------------------------------------------------------------------------------- /src/sim/src/ElementLibraryLoader.cpp: -------------------------------------------------------------------------------- 1 | #include "ElementLibraryLoader.h" 2 | -------------------------------------------------------------------------------- /src/sim/src/ElementRegistry.cpp: -------------------------------------------------------------------------------- 1 | #include "ElementRegistry.h" 2 | -------------------------------------------------------------------------------- /src/sim/src/ExternalConfig.cpp: -------------------------------------------------------------------------------- 1 | #include "ExternalConfig.h" 2 | -------------------------------------------------------------------------------- /src/sim/src/ExternalConfigSection.cpp: -------------------------------------------------------------------------------- 1 | #include "ExternalConfigSection.h" 2 | -------------------------------------------------------------------------------- /src/sim/src/ExternalConfigSectionGrid.cpp: -------------------------------------------------------------------------------- 1 | #include "ExternalConfigSectionGrid.h" 2 | -------------------------------------------------------------------------------- /src/sim/src/FileByteSink.cpp: -------------------------------------------------------------------------------- 1 | #include "FileByteSink.h" 2 | #include 3 | 4 | namespace MFM { 5 | FileByteSink STDOUT(stdout); 6 | FileByteSink STDERR(stderr); 7 | } 8 | -------------------------------------------------------------------------------- /src/sim/src/FileByteSource.cpp: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #include "FileByteSource.h" 3 | -------------------------------------------------------------------------------- /src/sim/src/Grid.cpp: -------------------------------------------------------------------------------- 1 | #include "Grid.h" 2 | 3 | namespace MFM { 4 | } /* namespace MFM */ 5 | 6 | -------------------------------------------------------------------------------- /src/sim/src/GridConfig.cpp: -------------------------------------------------------------------------------- 1 | #include "GridConfig.h" 2 | -------------------------------------------------------------------------------- /src/t2lib/Makefile: -------------------------------------------------------------------------------- 1 | # Who we are 2 | MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) 3 | CURRENT_DIR := $(notdir $(patsubst %/,%,$(dir $(MKFILE_PATH)))) 4 | COMPONENTNAME:=$(CURRENT_DIR) 5 | 6 | # We only run on tile 7 | MFM_TARGET:=tile 8 | 9 | # Where's the top 10 | BASEDIR:=../.. 11 | 12 | # What we need from outside 13 | override INCLUDES += -I $(BASEDIR)/src/core/include -I $(BASEDIR)/src/sim/include 14 | 15 | HOME_T2_DIR:=/home/t2 16 | LKM_INCLUDE_DIR:=$(HOME_T2_DIR)/T2-12/low/lkms/include 17 | ITC_PKT_INCLUDE_DIR:=$(HOME_T2_DIR)/T2-12/low/pru/itcio/module 18 | override INCLUDES += -I $(LKM_INCLUDE_DIR) 19 | override INCLUDES += -I $(ITC_PKT_INCLUDE_DIR) 20 | 21 | include $(BASEDIR)/config/Makevars.mk 22 | COMMON_CPPFLAGS+=-std=c++11 23 | COMMON_CPPFLAGS+=-Wno-psabi 24 | override COMMON_CPPFLAGS:=$(filter-out -pedantic,$(COMMON_CPPFLAGS)) 25 | 26 | # Do the library thing 27 | include $(BASEDIR)/config/Makelib.mk 28 | -------------------------------------------------------------------------------- /src/t2lib/include/RectIterator.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef RECTITERATOR_H 3 | #define RECTITERATOR_H 4 | 5 | #include "Rect.h" 6 | 7 | namespace MFM { 8 | struct RectIterator { 9 | RectIterator() ; 10 | Rect mRect; 11 | UPoint mSize; 12 | UPoint mCurr; 13 | 14 | const Rect & getRect() const { return mRect; } 15 | void begin(const Rect rect) ; 16 | bool hasNext() const ; 17 | SPoint next() ; 18 | }; 19 | 20 | } 21 | #endif /* RECTITERATOR_H */ 22 | -------------------------------------------------------------------------------- /src/t2lib/include/T2Main.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef T2MAIN_H 3 | #define T2MAIN_H 4 | 5 | #include "itype.h" 6 | #include "Dirs.h" 7 | #include "DateTimeStamp.h" 8 | #include "Logger.h" 9 | #include "FileByteSink.h" 10 | 11 | #include "TimeQueue.h" 12 | 13 | namespace MFM { 14 | /// Base class of all T2 main programs, supplying basic services such as random numbers and time queues 15 | 16 | struct T2Main { 17 | 18 | u32 now() const { return mTimeQueue.now(); } 19 | TimeQueue & getTQ() { return mTimeQueue; } 20 | Random & getRandom() { return mRandom; } 21 | 22 | static inline T2Main & get() { 23 | static bool underConstruction; 24 | if (underConstruction) { 25 | // Go bare lib: LOG etc may not be available yet 26 | fprintf(stderr,"%s Reentry during construction\n",__PRETTY_FUNCTION__); 27 | FAIL(ILLEGAL_STATE); 28 | } 29 | underConstruction = true; 30 | { 31 | if (!mTheInstance) initInstance(); 32 | underConstruction = false; 33 | return * mTheInstance; 34 | } 35 | } 36 | 37 | protected: 38 | static void initInstance() { new T2Main(); } 39 | 40 | T2Main() 41 | : mRandom() 42 | , mTimeQueue(this->getRandom()) 43 | { 44 | MFM_API_ASSERT_NULL(mTheInstance); 45 | mTheInstance = this; 46 | } 47 | virtual ~T2Main(); 48 | 49 | Random mRandom; 50 | TimeQueue mTimeQueue; 51 | 52 | private: 53 | static T2Main * mTheInstance; 54 | }; 55 | } 56 | 57 | #endif /* T2MAIN_H */ 58 | -------------------------------------------------------------------------------- /src/t2lib/include/T2Utils.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef T2UTILS_H 3 | #define T2UTILS_H 4 | 5 | #include /*for strlen*/ 6 | #include /*for std::string*/ 7 | #include "FileByteSource.h" 8 | #include "CharBufferByteSource.h" 9 | #include "OverflowableCharBufferByteSink.h" 10 | 11 | namespace MFM { 12 | u32 getModTimeOfFile(const char* path) ; 13 | bool readWholeFile(const char* path, ByteSink &to) ; 14 | bool readOneLinerFile(const char* path, ByteSink &to) ; 15 | bool readOneDecimalNumberFile(const char* path, s32 &to) ; 16 | bool readFloatsFromFile(const char* path, double * floats, u32 floatCount) ; 17 | 18 | u64 digestWholeFile64(const char* path) ; 19 | bool digestWholeFile(const char* path, ByteSink& digestout, bool ashex) ; 20 | 21 | bool writeWholeFile(const char* path, ByteSource &from) ; 22 | bool writeWholeFile(const char* path, const char * data) ; 23 | 24 | bool readWholeProcessOutput(const char* cmd, ByteSink &to) ; 25 | 26 | u32 findPidOfProgram(const char * progname) ; 27 | 28 | void printComma(u32 num, ByteSink & to) ; 29 | void printComma(u64 num, ByteSink & to) ; 30 | 31 | const char * formatSize(u32 usize, bool trimwhite) ; 32 | 33 | bool endsWith(const std::string& str, const std::string& suffix) ; 34 | } 35 | 36 | #endif /* T2UTILS_H */ 37 | -------------------------------------------------------------------------------- /src/t2lib/include/TimeQueue.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef TIMEQUEUE_H 3 | #define TIMEQUEUE_H 4 | 5 | #include 6 | #include 7 | 8 | // Core files 9 | #include "Random.h" 10 | 11 | // Spike files 12 | #include "TimeoutAble.h" 13 | 14 | namespace MFM { 15 | struct TimeoutAblePtrComparator { 16 | bool operator()(const TimeoutAble * lhs, const TimeoutAble * rhs) const { 17 | assert(lhs != 0 && rhs != 0); 18 | return (*lhs) < (*rhs); 19 | } 20 | }; 21 | 22 | typedef std::set SetOfTimeoutAble; 23 | 24 | struct TimeQueue { 25 | TimeQueue(Random & r) 26 | : mRandom(r) 27 | , mExpiredCount(0) 28 | { } 29 | 30 | u32 getExpiredCount() const { return mExpiredCount; } 31 | void dumpQueue() ; 32 | void dumpQueue(ByteSink& bs) ; 33 | u32 size() const { return mPQ.size(); } 34 | bool isEmpty() const { return size() == 0; } 35 | u32 now() const ; 36 | TimeoutAble * getEarliestExpired() ; 37 | void insertRaw(TimeoutAble& ta) ; 38 | void removeRaw(TimeoutAble& ta) ; 39 | SetOfTimeoutAble mPQ; 40 | Random & getRandom() { return mRandom; } 41 | Random & mRandom; 42 | u32 mExpiredCount; 43 | }; 44 | } 45 | #endif /* TIMEQUEUE_H */ 46 | -------------------------------------------------------------------------------- /src/t2lib/src/RectIterator.cpp: -------------------------------------------------------------------------------- 1 | #include "RectIterator.h" 2 | 3 | namespace MFM { 4 | RectIterator::RectIterator() 5 | : mRect() 6 | , mSize() 7 | , mCurr(0,0) 8 | { } 9 | 10 | void RectIterator::begin(const Rect rect) { 11 | mRect = rect; 12 | mSize = mRect.GetSize(); 13 | mCurr = UPoint(0,0); 14 | } 15 | 16 | bool RectIterator::hasNext() const { 17 | return mCurr.GetX() < mSize.GetX()-1 || mCurr.GetY() < mSize.GetY()-1; 18 | } 19 | 20 | SPoint RectIterator::next() { 21 | if (!hasNext()) FAIL(ARRAY_INDEX_OUT_OF_BOUNDS); 22 | UPoint cur = mCurr; 23 | mCurr.SetX(1+mCurr.GetX()); 24 | if (mCurr.GetX() >= mSize.GetX()) { 25 | mCurr.SetX(0); 26 | mCurr.SetY(1+mCurr.GetY()); 27 | } 28 | return mRect.GetPosition()+MakeSigned(cur); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/t2lib/src/T2Main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "T2Main.h" 7 | 8 | namespace MFM { 9 | T2Main* T2Main::mTheInstance = 0; 10 | T2Main::~T2Main() { } 11 | } 12 | -------------------------------------------------------------------------------- /src/t2lib/src/T2Types.cpp: -------------------------------------------------------------------------------- 1 | #include "T2Types.h" 2 | -------------------------------------------------------------------------------- /src/t2lib/src/UniqueTime.cpp: -------------------------------------------------------------------------------- 1 | #include "UniqueTime.h" 2 | namespace MFM { 3 | UniqueTime UniqueTime::mStaticLast; 4 | 5 | void UniqueTime::printRelativePretty(ByteSink& bs, const UniqueTime & relativeto) const 6 | { 7 | UniqueTime diff = *this - relativeto; 8 | diff.printPretty(bs); 9 | } 10 | 11 | void UniqueTime::printPretty(ByteSink& bs) const { 12 | printPretty(mLocalTimestamp.tv_sec, mLocalTimestamp.tv_nsec, bs); 13 | } 14 | 15 | void UniqueTime::printPretty(u32 tv_sec, u32 tv_nsec, ByteSink& bs) { 16 | const u32 SEC_PER_MIN = 60; 17 | const u32 SEC_PER_HOUR = 60*60; 18 | const u32 SEC_PER_DAY = 60*60*24; 19 | if ((u32) tv_sec > SEC_PER_DAY) { 20 | u32 days = tv_sec/SEC_PER_DAY; 21 | tv_sec %= SEC_PER_DAY; 22 | bs.Printf("%dd ",days); 23 | } 24 | 25 | if ((u32) tv_sec > SEC_PER_HOUR) { 26 | u32 hours = tv_sec/SEC_PER_HOUR; 27 | tv_sec %= SEC_PER_HOUR; 28 | bs.Printf("%dh ",hours); 29 | } 30 | 31 | if ((u32) tv_sec > SEC_PER_MIN) { 32 | u32 mins = tv_sec/SEC_PER_MIN; 33 | tv_sec %= SEC_PER_MIN; 34 | bs.Printf("%dm ",mins); 35 | } 36 | 37 | if ((u32) tv_sec > 0) { 38 | bs.Printf("%ds ",tv_sec); 39 | } 40 | 41 | u32 msecs = (u32) (tv_nsec/1000000.0); 42 | bs.Printf("%dms",msecs); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/test/Makefile: -------------------------------------------------------------------------------- 1 | # Who we are 2 | COMPONENTNAME:=test 3 | 4 | # Where's the top 5 | BASEDIR:=../.. 6 | 7 | # What we need from outside 8 | override INCLUDES += -I $(BASEDIR)/src/core/include -I $(BASEDIR)/src/elements/include -I $(BASEDIR)/src/gui/include -I $(BASEDIR)/src/sim/include 9 | 10 | # Do the library thing 11 | include $(BASEDIR)/config/Makelib.mk 12 | -------------------------------------------------------------------------------- /src/test/include/BitRef_Test.h: -------------------------------------------------------------------------------- 1 | #ifndef BITREF_TEST_H /* -*- C++ -*- */ 2 | #define BITREF_TEST_H 3 | 4 | #include "Test_Common.h" 5 | #include "UlamRef.h" 6 | 7 | namespace MFM { 8 | 9 | class BitRef_Test 10 | { 11 | private: 12 | static TestAtom setup(); 13 | 14 | public: 15 | static void Test_RunTests(); 16 | 17 | static void Test_BitRefCtors(); 18 | 19 | static void Test_BitRefRead(); 20 | 21 | static void Test_BitRefReadLong(); 22 | 23 | static void Test_BitRefWrite(); 24 | 25 | static void Test_BitRefWriteLong(); 26 | 27 | }; 28 | } /* namespace MFM */ 29 | #endif /*BITREF_TEST_H*/ 30 | -------------------------------------------------------------------------------- /src/test/include/BitVector_Test.h: -------------------------------------------------------------------------------- 1 | #ifndef BITVECTOR_TEST_H /* -*- C++ -*- */ 2 | #define BITVECTOR_TEST_H 3 | 4 | #include "BitVector.h" 5 | 6 | namespace MFM { 7 | 8 | class BitVector_Test 9 | { 10 | private: 11 | static BitVector<256>* setup(); 12 | 13 | public: 14 | static void Test_RunTests(); 15 | 16 | static void Test_bitVectorCtors(); 17 | 18 | static void Test_bitVectorAllocate(); 19 | 20 | static void Test_bitVectorRead(); 21 | 22 | static void Test_bitVectorSize(); 23 | 24 | static void Test_bitVectorWrite(); 25 | 26 | static void Test_bitVectorSplitWrites(); 27 | 28 | static void Test_bitVectorSetAndClearBits(); 29 | 30 | static void Test_bitVectorStoreBits(); 31 | 32 | static void Test_bitVectorLong(); 33 | 34 | static void Test_bitVectorReadWriteBV(); 35 | 36 | static void Test_bitVectorPopulationCount(); 37 | 38 | }; 39 | } /* namespace MFM */ 40 | #endif /*BITVECTOR_TEST_H*/ 41 | -------------------------------------------------------------------------------- /src/test/include/ByteSink_Test.h: -------------------------------------------------------------------------------- 1 | #ifndef BYTESINK_TEST_H /* -*- C++ -*- */ 2 | #define BYTESINK_TEST_H 3 | 4 | #include "ByteSink.h" 5 | 6 | namespace MFM { 7 | 8 | /** 9 | * Tests for the ByteSink interface 10 | */ 11 | class ByteSink_Test 12 | { 13 | private: 14 | 15 | public: 16 | static void Test_RunTests(); 17 | 18 | }; 19 | } /* namespace MFM */ 20 | #endif /*BYTESINK_TEST_H*/ 21 | 22 | -------------------------------------------------------------------------------- /src/test/include/ByteSource_Test.h: -------------------------------------------------------------------------------- 1 | #ifndef BYTESOURCE_TEST_H /* -*- C++ -*- */ 2 | #define BYTESOURCE_TEST_H 3 | 4 | #include "ByteSource.h" 5 | 6 | namespace MFM { 7 | 8 | /** 9 | * Tests of the ByteSource interface 10 | */ 11 | class ByteSource_Test 12 | { 13 | private: 14 | 15 | public: 16 | static void Test_RunTests(); 17 | 18 | }; 19 | } /* namespace MFM */ 20 | #endif /*BYTESOURCE_TEST_H*/ 21 | 22 | -------------------------------------------------------------------------------- /src/test/include/ColorMap_Test.h: -------------------------------------------------------------------------------- 1 | #ifndef COLORMAP_TEST_H /* -*- C++ -*- */ 2 | #define COLORMAP_TEST_H 3 | 4 | #include "ColorMap.h" 5 | 6 | namespace MFM { 7 | 8 | /** 9 | * Tests of ColorMap 10 | */ 11 | class ColorMap_Test 12 | { 13 | private: 14 | static void Test_colorMapSelected(); 15 | static void Test_colorMapInterpolated(); 16 | 17 | public: 18 | static void Test_RunTests(); 19 | }; 20 | 21 | } /* namespace MFM */ 22 | #endif /*COLORMAP_TEST_H*/ 23 | -------------------------------------------------------------------------------- /src/test/include/ElementRegistry_Test.h: -------------------------------------------------------------------------------- 1 | #ifndef ELEMENTREGISTRY_TEST_H /* -*- C++ -*- */ 2 | #define ELEMENTREGISTRY_TEST_H 3 | 4 | #include "ElementRegistry.h" 5 | 6 | namespace MFM { 7 | class ElementRegistry_Test 8 | { 9 | private: 10 | 11 | public: 12 | static void Test_RunTests(); 13 | 14 | }; 15 | } /* namespace MFM */ 16 | #endif /*ELEMENTREGISTRY_TEST_H*/ 17 | 18 | -------------------------------------------------------------------------------- /src/test/include/EventWindow_Test.h: -------------------------------------------------------------------------------- 1 | #ifndef EVENTWINDOW_TEST_H /* -*- C++ -*- */ 2 | #define EVENTWINDOW_TEST_H 3 | 4 | #include "Test_Common.h" 5 | 6 | namespace MFM { 7 | 8 | class EventWindow_Test 9 | { 10 | 11 | public: 12 | 13 | static void Test_EventWindowConstruction(); 14 | 15 | static void Test_EventWindowNoLockOpen(); 16 | 17 | static void Test_EventWindowWrite(); 18 | 19 | static void Test_RunTests(); 20 | }; 21 | } /* namespace MFM */ 22 | #endif /*EVENTWINDOW_TEST_H*/ 23 | -------------------------------------------------------------------------------- /src/test/include/ExternalConfig_Test.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef EXTERNALCONFIG_TEST_H 3 | #define EXTERNALCONFIG_TEST_H 4 | 5 | #include "ExternalConfig.h" 6 | #include "Grid.h" 7 | 8 | namespace MFM 9 | { 10 | class ExternalConfig_Test 11 | { 12 | public: 13 | 14 | static void Test_RunTests(); 15 | 16 | }; 17 | } 18 | 19 | #endif /* EXTERNALCONFIG_TEST_H */ 20 | -------------------------------------------------------------------------------- /src/test/include/FXP_Test.h: -------------------------------------------------------------------------------- 1 | #ifndef FXP_TEST_H /* -*- C++ -*- */ 2 | #define FXP_TEST_H 3 | 4 | #include "FXP.h" 5 | 6 | namespace MFM { 7 | 8 | class FXP_Test 9 | { 10 | private: 11 | template 12 | static void assertTolerance(const char * file, const int lineno, const int ulp, FXP

num, double toThis); 13 | 14 | static void Test_FXPCtors(); 15 | static void Test_FXPOps(); 16 | static void Test_FXPCloser(); 17 | static void Test_FXPFarther(); 18 | 19 | public: 20 | static void Test_RunTests(); 21 | }; 22 | 23 | } /* namespace MFM */ 24 | #endif /*FXP_TEST_H*/ 25 | -------------------------------------------------------------------------------- /src/test/include/Fail_Test.h: -------------------------------------------------------------------------------- 1 | #ifndef FAIL_TEST_H /* -*- C++ -*- */ 2 | #define FAIL_TEST_H 3 | 4 | #include "Fail.h" 5 | 6 | namespace MFM { 7 | 8 | class Fail_Test 9 | { 10 | private: 11 | 12 | public: 13 | static void Test_NoFail(); 14 | static void Test_SimpleFail(); 15 | static void Test_FailAndNot(); 16 | static void Test_FailWithCode(); 17 | static void Test_NestedFail(); 18 | static void Test_UnsafeModification(); 19 | 20 | static void Test_RunTests(); 21 | }; 22 | } /* namespace MFM */ 23 | #endif /*FAIL_TEST_H*/ 24 | -------------------------------------------------------------------------------- /src/test/include/GridTransceiver_Test.h: -------------------------------------------------------------------------------- 1 | #ifndef GRIDTRANSCEIVER_TEST_H /* -*- C++ -*- */ 2 | #define GRIDTRANSCEIVER_TEST_H 3 | 4 | #include "GridTransceiver.h" 5 | 6 | namespace MFM { 7 | 8 | class GridTransceiver_Test 9 | { 10 | private: 11 | 12 | public: 13 | static void Test_Basic(); 14 | static void Test_DataRates(); 15 | 16 | static void Test_RunTests(); 17 | 18 | }; 19 | } /* namespace MFM */ 20 | #endif /*GRIDTRANSCEIVER_TEST_H*/ 21 | -------------------------------------------------------------------------------- /src/test/include/Grid_Test.h: -------------------------------------------------------------------------------- 1 | #ifndef GRID_TEST_H /* -*- C++ -*- */ 2 | #define GRID_TEST_H 3 | 4 | #include "Test_Common.h" 5 | 6 | #include "Dirs.h" 7 | #include "MDist.h" 8 | 9 | namespace MFM { 10 | 11 | /** 12 | * Tests for the Grid class 13 | */ 14 | class Grid_Test 15 | { 16 | public: 17 | static void Test_gridPlaceAtom(); 18 | }; 19 | } /* namespace MFM */ 20 | #endif /*GRID_TEST_H*/ 21 | -------------------------------------------------------------------------------- /src/test/include/LineTailByteSink_Test.h: -------------------------------------------------------------------------------- 1 | #ifndef LINETAILBYTESINK_TEST_H /* -*- C++ -*- */ 2 | #define LINETAILBYTESINK_TEST_H 3 | 4 | #include "LineTailByteSink.h" 5 | 6 | namespace MFM { 7 | 8 | class LineTailByteSink_Test 9 | { 10 | private: 11 | 12 | public: 13 | static void Test_RunTests(); 14 | 15 | }; 16 | } /* namespace MFM */ 17 | #endif /*LINETAILBYTESINK_TEST_H*/ 18 | 19 | -------------------------------------------------------------------------------- /src/test/include/Logger_Test.h: -------------------------------------------------------------------------------- 1 | #ifndef LOGGER_TEST_H /* -*- C++ -*- */ 2 | #define LOGGER_TEST_H 3 | 4 | #include "Logger.h" 5 | 6 | namespace MFM { 7 | 8 | class Logger_Test 9 | { 10 | private: 11 | 12 | public: 13 | static void Test_RunTests(); 14 | 15 | }; 16 | } /* namespace MFM */ 17 | #endif /*LOGGER_TEST_H*/ 18 | 19 | -------------------------------------------------------------------------------- /src/test/include/MDist_Test.h: -------------------------------------------------------------------------------- 1 | #ifndef MANHATTANDIR_TEST_H /* -*- C++ -*- */ 2 | #define MANHATTANDIR_TEST_H 3 | 4 | #include "MDist.h" 5 | 6 | namespace MFM { 7 | 8 | /** 9 | * Tests for the MDist class 10 | */ 11 | class MDist_Test 12 | { 13 | public: 14 | static void Test_MDistConversion(); 15 | }; 16 | } /* namespace MFM */ 17 | #endif /*MDIST_TEST_H*/ 18 | -------------------------------------------------------------------------------- /src/test/include/OverflowableCharBufferByteSink_Test.h: -------------------------------------------------------------------------------- 1 | #ifndef OVERFLOWABLECHARBUFFERBYTESINK_TEST_H /* -*- C++ -*- */ 2 | #define OVERFLOWABLECHARBUFFERBYTESINK_TEST_H 3 | 4 | #include "OverflowableCharBufferByteSink.h" 5 | 6 | namespace MFM { 7 | 8 | /** 9 | * Tests of OverflowableCharBufferByteSink 10 | */ 11 | class OverflowableCharBufferByteSink_Test 12 | { 13 | private: 14 | 15 | public: 16 | static void Test_RunTests(); 17 | 18 | }; 19 | } /* namespace MFM */ 20 | #endif /*OVERFLOWABLECHARBUFFERBYTESINK_TEST_H*/ 21 | 22 | -------------------------------------------------------------------------------- /src/test/include/PSym_Test.h: -------------------------------------------------------------------------------- 1 | #ifndef PSYM_TEST_H /* -*- C++ -*- */ 2 | #define PSYM_TEST_H 3 | 4 | #include "PSym.h" 5 | 6 | namespace MFM { 7 | 8 | class PSym_Test 9 | { 10 | private: 11 | 12 | public: 13 | static void Test_RunTests(); 14 | 15 | static void Test_PSymMap(); 16 | 17 | static void Test_PSymTemplates(); 18 | 19 | static void Test_PSymInverse(); 20 | }; 21 | } /* namespace MFM */ 22 | #endif /*PSYM_TEST_H*/ 23 | -------------------------------------------------------------------------------- /src/test/include/Parity2D_4x4_Test.h: -------------------------------------------------------------------------------- 1 | #ifndef PARITY2D_4X4_TEST_H /* -*- C++ -*- */ 2 | #define PARITY2D_4X4_TEST_H 3 | 4 | #include "Parity2D_4x4.h" 5 | 6 | namespace MFM { 7 | 8 | class Parity2D_4x4_Test 9 | { 10 | private: 11 | 12 | public: 13 | static void Test_RunTests(); 14 | 15 | }; 16 | } /* namespace MFM */ 17 | #endif /*PARITY2D_4X4_TEST_H*/ 18 | 19 | -------------------------------------------------------------------------------- /src/test/include/Point_Test.h: -------------------------------------------------------------------------------- 1 | #ifndef POINT_TEST_H /* -*- C++ -*- */ 2 | #define POINT_TEST_H 3 | 4 | namespace MFM { 5 | 6 | class Point_Test 7 | { 8 | public: 9 | static void Test_pointAdd(); 10 | 11 | static void Test_pointMultiply(); 12 | }; 13 | } /* namespace MFM */ 14 | #endif /*POINT_TEST_H*/ 15 | -------------------------------------------------------------------------------- /src/test/include/Random_Test.h: -------------------------------------------------------------------------------- 1 | #ifndef RANDOM_TEST_H /* -*- C++ -*- */ 2 | #define RANDOM_TEST_H 3 | 4 | #include "Random.h" 5 | 6 | namespace MFM { 7 | class Random_Test 8 | { 9 | private: 10 | static Random & setup(); 11 | static void Test_randomSetSeed(); 12 | static void Test_randomDeterministics(); 13 | 14 | public: 15 | static void Test_RunTests(); 16 | }; 17 | } 18 | #endif /*RANDOM_TEST_H*/ 19 | -------------------------------------------------------------------------------- /src/test/include/Test_Common.h: -------------------------------------------------------------------------------- 1 | #ifndef TEST_COMMON_H /* -*- C++ -*- */ 2 | #define TEST_COMMON_H 3 | 4 | #include "Grid.h" 5 | #include "EventConfig.h" 6 | #include "P3Atom.h" 7 | #include "ElementTable.h" 8 | #include "EventWindow.h" 9 | #include "SizedTile.h" 10 | 11 | namespace MFM { 12 | 13 | /* Some types for us to test */ 14 | // Deprecating P1Atom Sun Jul 27 18:00:05 2014 15 | // typedef P1Atom TestAtom; 16 | // Deprecating P0Atom for MFMv3 Fri Jan 30 13:45:35 2015 17 | // typedef P0Atom TestAtom; 18 | typedef P3Atom TestAtom; 19 | typedef Site TestSite; 20 | typedef EventConfig TestEventConfig; 21 | 22 | typedef GridConfig TestGridConfig; 23 | typedef Grid TestGrid; 24 | typedef TestGrid::GridTile TestTile; 25 | 26 | typedef ElementTable TestElementTable; 27 | typedef EventWindow TestEventWindow; 28 | 29 | } /* namespace MFM */ 30 | 31 | #endif /*TEST_COMMON_H*/ 32 | -------------------------------------------------------------------------------- /src/test/include/Tests.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTS_H /* -*- C++ -*- */ 2 | #define TESTS_H 3 | 4 | /* Get some types for us to test */ 5 | #include "Test_Common.h" 6 | 7 | #include "UlamRef_Test.h" 8 | #include "BitRef_Test.h" 9 | #include "UlamElement_Test.h" 10 | #include "GridTransceiver_Test.h" 11 | #include "ElementRegistry_Test.h" 12 | #include "ByteSource_Test.h" 13 | #include "LineTailByteSink_Test.h" 14 | #include "OverflowableCharBufferByteSink_Test.h" 15 | #include "VArguments_Test.h" 16 | #include "Logger_Test.h" 17 | #include "UUID_Test.h" 18 | #include "ByteSink_Test.h" 19 | #include "Parity2D_4x4_Test.h" 20 | #include "PSym_Test.h" 21 | #include "Fail_Test.h" 22 | #include "MDist_Test.h" 23 | #include "BitVector_Test.h" 24 | #include "Point_Test.h" 25 | //XXX Deprecated #include "P1Atom_Test.h" 26 | #include "Tile_Test.h" 27 | #include "Grid_Test.h" 28 | #include "EventWindow_Test.h" 29 | #include "Random_Test.h" 30 | #include "ColorMap_Test.h" 31 | #include "FXP_Test.h" 32 | #include "ExternalConfig_Test.h" 33 | 34 | #endif /*TESTS_H*/ 35 | -------------------------------------------------------------------------------- /src/test/include/Tile_Test.h: -------------------------------------------------------------------------------- 1 | #ifndef TILE_TEST_H /* -*- C++ -*- */ 2 | #define TILE_TEST_H 3 | 4 | #include "Test_Common.h" 5 | 6 | namespace MFM { 7 | 8 | /** 9 | * Tests for the Tile class 10 | */ 11 | class Tile_Test 12 | { 13 | public: 14 | static void Test_RunTests(); 15 | 16 | static void Test_tilePlaceAtom(); 17 | static void Test_tileSquareDistances(); 18 | }; 19 | } /* namespace MFM */ 20 | 21 | #endif /*TILE_TEST_H*/ 22 | -------------------------------------------------------------------------------- /src/test/include/UUID_Test.h: -------------------------------------------------------------------------------- 1 | #ifndef UUID_TEST_H /* -*- C++ -*- */ 2 | #define UUID_TEST_H 3 | 4 | #include "UUID.h" 5 | 6 | namespace MFM { 7 | 8 | /** 9 | * Tests for UUIDs. 10 | */ 11 | class UUID_Test 12 | { 13 | private: 14 | 15 | public: 16 | static void Test_RunTests(); 17 | 18 | }; 19 | } /* namespace MFM */ 20 | #endif /*UUID_TEST_H*/ 21 | 22 | -------------------------------------------------------------------------------- /src/test/include/UlamElement_Test.h: -------------------------------------------------------------------------------- 1 | #ifndef ULAMELEMENT_TEST_H /* -*- C++ -*- */ 2 | #define ULAMELEMENT_TEST_H 3 | 4 | #include "UlamElement.h" 5 | 6 | namespace MFM { 7 | 8 | class UlamElement_Test 9 | { 10 | private: 11 | 12 | public: 13 | static void Test_RunTests(); 14 | 15 | static void Test_UlamElementCtors(); 16 | 17 | static void Test_UlamElementAllocate(); 18 | 19 | static void Test_UlamElementRead(); 20 | 21 | static void Test_UlamElementSize(); 22 | 23 | static void Test_UlamElementWrite(); 24 | 25 | static void Test_UlamElementSplitWrites(); 26 | 27 | static void Test_UlamElementSetAndClearBits(); 28 | 29 | static void Test_UlamElementStoreBits(); 30 | 31 | static void Test_UlamElementLong(); 32 | 33 | }; 34 | } /* namespace MFM */ 35 | #endif /*ULAMELEMENT_TEST_H*/ 36 | -------------------------------------------------------------------------------- /src/test/include/UlamRef_Test.h: -------------------------------------------------------------------------------- 1 | #ifndef ULAMREF_TEST_H /* -*- C++ -*- */ 2 | #define ULAMREF_TEST_H 3 | 4 | #include "Test_Common.h" 5 | #include "UlamRef.h" 6 | 7 | namespace MFM { 8 | 9 | class UlamRef_Test 10 | { 11 | private: 12 | static TestAtom setup(); 13 | 14 | public: 15 | static void Test_RunTests(); 16 | 17 | static void Test_UlamRefCtors(); 18 | 19 | static void Test_UlamRefRead(); 20 | 21 | static void Test_UlamRefReadLong(); 22 | 23 | static void Test_UlamRefWrite(); 24 | 25 | static void Test_UlamRefWriteLong(); 26 | 27 | static void Test_UlamRefEffSelf(); 28 | 29 | static void Test_UlamRefReadBV(); 30 | 31 | static void Test_UlamRefWriteBV(); 32 | 33 | }; 34 | } /* namespace MFM */ 35 | #endif /*ULAMREF_TEST_H*/ 36 | -------------------------------------------------------------------------------- /src/test/include/VArguments_Test.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- */ 2 | #ifndef VARGUMENTS_TEST_H 3 | #define VARGUMENTS_TEST_H 4 | 5 | #include "VArguments.h" 6 | 7 | namespace MFM { 8 | 9 | class VArguments_Test 10 | { 11 | private: 12 | 13 | public: 14 | static void Test_RunTests(); 15 | 16 | }; 17 | } /* namespace MFM */ 18 | #endif /*VARGUMENTS_TEST_H*/ 19 | -------------------------------------------------------------------------------- /src/test/src/ElementRegistry_Test.cpp: -------------------------------------------------------------------------------- 1 | #include "assert.h" 2 | #include "Fail.h" 3 | #include "Test_Common.h" 4 | #include "ElementRegistry_Test.h" 5 | 6 | namespace MFM { 7 | 8 | static void Test_Basic() { 9 | ElementTypeNumberMap etnm; 10 | ElementRegistry er; 11 | UUID u1("Sorter",1,2,3,4); 12 | assert(!er.IsRegistered(u1)); 13 | assert(!er.IsLoaded(u1)); 14 | Element_Empty::THE_INSTANCE.AllocateType(etnm); 15 | er.RegisterElement(Element_Empty::THE_INSTANCE); 16 | 17 | assert(!er.IsRegistered(u1)); 18 | assert(!er.IsLoaded(u1)); 19 | 20 | UUID eu = Element_Empty::THE_INSTANCE.GetUUID(); 21 | assert(er.IsRegistered(eu)); 22 | assert(er.IsLoaded(eu)); 23 | 24 | assert(!er.IsRegistered(u1)); 25 | assert(!er.IsLoaded(u1)); 26 | 27 | er.RegisterUUID(u1); 28 | assert(er.IsRegistered(u1)); 29 | assert(!er.IsLoaded(u1)); 30 | 31 | const Element * ee = er.Lookup(eu); 32 | assert(ee != 0); 33 | } 34 | 35 | void ElementRegistry_Test::Test_RunTests() { 36 | Test_Basic(); 37 | } 38 | 39 | } /* namespace MFM */ 40 | -------------------------------------------------------------------------------- /src/test/src/Grid_Test.cpp: -------------------------------------------------------------------------------- 1 | #include "assert.h" 2 | #include "Grid.h" 3 | #include "Grid_Test.h" 4 | #include "Element_Res.h" 5 | 6 | namespace MFM { 7 | 8 | void Grid_Test::Test_gridPlaceAtom() 9 | { 10 | 11 | ElementRegistry ereg; 12 | TestGrid grid(ereg,4,3, (GridLayoutPattern) GRID_LAYOUT_CHECKERBOARD); 13 | 14 | grid.SetSeed(1); 15 | grid.Init(); 16 | 17 | grid.Needed(Element_Res::THE_INSTANCE); 18 | 19 | TestAtom atom(Element_Res::THE_INSTANCE.GetDefaultAtom()); 20 | 21 | SPoint gloc(5, 10); 22 | 23 | grid.PlaceAtom(atom, gloc); 24 | 25 | const TestAtom* out = grid.GetAtom(gloc); 26 | 27 | assert(out->GetType() == atom.GetType()); 28 | 29 | } 30 | } /* namespace MFM */ 31 | -------------------------------------------------------------------------------- /src/test/src/MDist_test.cpp: -------------------------------------------------------------------------------- 1 | #include "assert.h" 2 | #include "MDist_Test.h" 3 | 4 | namespace MFM { 5 | 6 | void MDist_Test::Test_MDistConversion() 7 | { 8 | SPoint longPt(2, 2); 9 | SPoint shortPt(1, -1); 10 | 11 | u8 longBits = MDist<4>::get().FromPoint(longPt, MANHATTAN_TABLE_LONG); 12 | u8 shortBits = MDist<4>::get().FromPoint(shortPt, MANHATTAN_TABLE_SHORT); 13 | 14 | SPoint out(0, 0); 15 | 16 | MDist<4>::get().FillFromBits(out, longBits, MANHATTAN_TABLE_LONG); 17 | 18 | assert(out.GetX() == 2); 19 | assert(out.GetY() == 2); 20 | 21 | MDist<4>::get().FillFromBits(out, shortBits, MANHATTAN_TABLE_SHORT); 22 | 23 | assert(out.GetX() == 1); 24 | assert(out.GetY() == -1); 25 | } 26 | } /* namespace MFM */ 27 | -------------------------------------------------------------------------------- /src/test/src/OverflowableCharBufferByteSink_Test.cpp: -------------------------------------------------------------------------------- 1 | #include "assert.h" 2 | #include "OverflowableCharBufferByteSink_Test.h" 3 | #include "OverflowableCharBufferByteSink.h" 4 | #include /* For strtol */ 5 | 6 | namespace MFM { 7 | typedef OverflowableCharBufferByteSink<10> OCBS10; 8 | typedef OverflowableCharBufferByteSink<20> OCBS20; 9 | 10 | static OCBS10 buf10; 11 | static OCBS20 buf20; 12 | 13 | static void Test_Overflows() { 14 | buf10.Reset(); 15 | assert(buf10.Equals("")); 16 | 17 | buf10.Reset(); 18 | buf10.Print(10); 19 | assert(buf10.Equals("10")); 20 | 21 | buf10.Reset(); 22 | buf10.Print(19); 23 | assert(buf10.Equals("19")); 24 | 25 | buf10.Reset(); 26 | buf10.Print("01234567"); 27 | assert(buf10.Equals("01234567")); 28 | 29 | buf10.Print("8"); 30 | assert(buf10.Equals("01234567X")); 31 | 32 | buf10.Print("snorg gobble"); 33 | assert(buf10.Equals("01234567X")); 34 | 35 | buf10.Print("clams"); 36 | assert(buf10.Equals("01234567X")); 37 | 38 | buf10.Reset(); 39 | buf10.Print("Blow it in one go man"); 40 | assert(buf10.Equals("Blow it X")); 41 | 42 | buf20.Reset(); 43 | assert(buf20.Equals("")); 44 | 45 | buf20.Print("0123456789"); 46 | assert(buf20.Equals("0123456789")); 47 | 48 | buf20.Print("Blew it in one go man"); 49 | assert(buf20.Equals("0123456789Blew it X")); 50 | } 51 | 52 | void OverflowableCharBufferByteSink_Test::Test_RunTests() { 53 | Test_Overflows(); 54 | } 55 | 56 | } /* namespace MFM */ 57 | 58 | -------------------------------------------------------------------------------- /src/test/src/Point_Test.cpp: -------------------------------------------------------------------------------- 1 | #include "assert.h" 2 | #include "Point_Test.h" 3 | #include "Point.h" 4 | 5 | namespace MFM { 6 | 7 | void Point_Test::Test_pointAdd() 8 | { 9 | SPoint iPointA(20, 30); 10 | SPoint iPointB(30, 20); 11 | 12 | iPointA.Add(iPointB); 13 | 14 | assert(iPointA.GetX() == 50); 15 | assert(iPointA.GetY() == 50); 16 | 17 | Point fPointA(30.0f, 50.0f); 18 | Point fPointB(50.0f, 30.0f); 19 | 20 | fPointA.Add(fPointB); 21 | 22 | assert(fPointA.GetX() == 30.0f + 50.0f); 23 | } 24 | 25 | void Point_Test::Test_pointMultiply() 26 | { 27 | SPoint iPoint(20, 100); 28 | Point dPoint(100.0, 20.25); 29 | 30 | iPoint.Multiply(30); 31 | 32 | dPoint.Multiply(2.0); 33 | 34 | assert(iPoint.GetX() == 600); 35 | assert(iPoint.GetY() == 3000); 36 | 37 | assert(dPoint.GetX() == 100.0 * 2.0); 38 | assert(dPoint.GetY() == 20.25 * 2.0); 39 | } 40 | } /* namespace MFM */ 41 | -------------------------------------------------------------------------------- /src/test/src/Test_Common.cpp: -------------------------------------------------------------------------------- 1 | #include "Test_Common.h" 2 | -------------------------------------------------------------------------------- /src/test/src/VArguments_Test.cpp: -------------------------------------------------------------------------------- 1 | #include "assert.h" 2 | #include "VArguments_Test.h" 3 | #include "Fail.h" 4 | 5 | #include /* for strcmp */ 6 | 7 | namespace MFM { 8 | 9 | static const char* handlerArg; 10 | static void handler(const char* arg, void* not_used) 11 | { 12 | handlerArg = arg; 13 | } 14 | 15 | static void Test_Register() 16 | { 17 | VArguments args; 18 | 19 | args.RegisterArgument("test description", "-t|--test", 0, 0, false); 20 | 21 | assert(!args.Get("-t")); 22 | 23 | bool unwound = false; 24 | 25 | unwind_protect({ 26 | 27 | unwound = true; 28 | }, 29 | { 30 | args.Get("--foo"); 31 | }); 32 | 33 | assert(unwound); 34 | 35 | args.RegisterArgument("test handler", "-f|--foo", &handler, 0, true); 36 | 37 | const char* argv[] = 38 | { 39 | "program name", 40 | "-t", 41 | "--foo", 42 | "bar", 43 | 0 44 | }; 45 | u32 argc = sizeof(argv) / sizeof(argv[0]) - 1; 46 | 47 | args.ProcessArguments(argc, argv); 48 | 49 | assert(args.Appeared("-t")); 50 | assert(args.Appeared("--test")); 51 | assert(args.Appeared("-f")); 52 | assert(args.Appeared("--foo")); 53 | 54 | assert(!strcmp(args.Get("-f"), handlerArg)); 55 | assert(!strcmp(args.Get("--foo"), handlerArg)); 56 | assert(!strcmp(args.Get("--foo"), "bar")); 57 | assert(!strcmp("bar", handlerArg)); 58 | } 59 | 60 | void VArguments_Test::Test_RunTests() { 61 | Test_Register(); 62 | } 63 | 64 | } /* namespace MFM */ 65 | -------------------------------------------------------------------------------- /tools/README.txt: -------------------------------------------------------------------------------- 1 | Unsupported scripts etc, for inspiration only 2 | -------------------------------------------------------------------------------- /tools/RenderPNGsCenteredToHD: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | dirname=$1 3 | ffmpeg -f image2 -r 30 -vf pad="1920:1080:(ow-iw)/2:(oh-ih)/2:0x0f0f0f" -i $dirname/%08d.png -vcodec libx264 -r 30 -pix_fmt yuv420p /tmp/$dirname.mp4 4 | -------------------------------------------------------------------------------- /tools/img_converter.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | FILES=../res/images/* 4 | 5 | for f in $FILES 6 | do 7 | 8 | echo "Resizing to 32x32: $f" 9 | convert $f -resize 32x32\! $f 10 | 11 | done 12 | -------------------------------------------------------------------------------- /tools/splotter/2x1x40x10k-dreg/samplingbias2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaveAckley/MFM/873d7ed412f5343ebcbbb0c0d47a6b061aa901f5/tools/splotter/2x1x40x10k-dreg/samplingbias2.pdf -------------------------------------------------------------------------------- /tools/splotter/2x1x40x20k-dreg/Makefile: -------------------------------------------------------------------------------- 1 | all: grid.pdf average.pdf 2 | 3 | clean: 4 | rm *.pdf *.plot 5 | 6 | grid.pdf: sfc-grid.plot 7 | gnuplot samplingbias-grid.plt 8 | 9 | average.pdf: sfc.plot 10 | gnuplot samplingbias2.plt 11 | 12 | sfc-grid.plot: 0000020000.ppm 13 | ./ppmToGnuPlot.pl 0000020000.ppm > sfc-grid.plot 14 | 15 | sfc.plot: 0000020000-average.ppm 16 | ./ppmToGnuPlot.pl 0000020000-average.ppm > sfc.plot -------------------------------------------------------------------------------- /tools/splotter/2x1x40x20k-dreg/ppmToGnuPlot.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -Tw 2 | 3 | my $file = shift @ARGV; 4 | defined $file or die "Usage:\n$0 PPMFILE\n"; 5 | open(FILE,"<$file") or die "Can't read '$file': $!\n"; 6 | binmode FILE; 7 | my ($count,$data); 8 | $count = read (FILE, $data, 999999999); 9 | close FILE or die; 10 | 11 | $data =~ /\s*#\s*Max site events = (\d+)\n\s*(\d+)\s+(\d+)\s+(\d+)\s*\n(.+)$/ 12 | or die "Can't find header info"; 13 | my ($eventmax,$wid,$hei,$max,$bytes) = ($1,$2,$3,$4,$5); 14 | my @pixels = split(//,$bytes); 15 | 16 | my $bpp = 1; 17 | my ($x,$y) = (0,0); 18 | for (my $i = 0; $i < $hei*$wid*$bpp; $i += $bpp) { 19 | printf("%d ", (ord($pixels[$i]) * $eventmax / 255) / 200); 20 | $x++; 21 | if(!(($x + 1) % ($wid + 1))) 22 | { 23 | $y++; 24 | $x = 0; 25 | printf("\n"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tools/splotter/2x1x40x20k-dreg/samplingbias-grid.plt: -------------------------------------------------------------------------------- 1 | # set terminal postscript eps enhanced color size 3.5,2.75 "NimbusSanL-Regu,17" fontfile "/usr/share/texmf-texlive/fonts/type1/urw/helvetic/uhvr8a.pfb" 2 | set terminal pdf 3 | set output 'grid.pdf' 4 | set samples 32 5 | set isosamples 32 6 | set hidden3d 7 | set title "Event rate vs site position\nDreg and Res, P1 Atom, N=32, R=4" 8 | set key title "" 9 | unset key 10 | set xlabel "x_c" 11 | set xtics 0,8 12 | set ytics 0,8 13 | # set xrange [0:32] 14 | set ylabel "y_c" 15 | # set yrange [0:32] 16 | set zlabel "Events/sec (15 tile average)" rotate offset -1.3,0,0 17 | # set zrange [80:120] 18 | set xyplane 0 19 | #set ztics ("to" 4000,"come" 5000, "soon" 6000, "now" 7000) 20 | set ztics 0,10 21 | set view 68,37 22 | splot "sfc-grid.plot" matrix with l lt 0 23 | -------------------------------------------------------------------------------- /tools/splotter/2x1x40x20k-dreg/samplingbias2.plt: -------------------------------------------------------------------------------- 1 | # set terminal postscript eps enhanced color size 3.5,2.75 "NimbusSanL-Regu,17" fontfile "/usr/share/texmf-texlive/fonts/type1/urw/helvetic/uhvr8a.pfb" 2 | set terminal pdf 3 | set output 'average.pdf' 4 | set samples 32 5 | set isosamples 32 6 | set hidden3d 7 | set title "Event rate vs site position\nDreg and Res, P1 Atom, N=32, R=4" 8 | set key title "" 9 | unset key 10 | set xlabel "x_c" 11 | set xtics 0,8 12 | set ytics 0,8 13 | # set xrange [0:32] 14 | set ylabel "y_c" 15 | # set yrange [0:32] 16 | set zlabel "Events/sec (15 tile average)" rotate offset -1.3,0,0 17 | # set zrange [80:120] 18 | set xyplane 0 19 | #set ztics ("to" 4000,"come" 5000, "soon" 6000, "now" 7000) 20 | set ztics 0,10 21 | set view 68,37 22 | splot "sfc.plot" matrix with l lt 0 23 | -------------------------------------------------------------------------------- /tools/splotter/2x2x40x20k-dreg/Makefile: -------------------------------------------------------------------------------- 1 | all: grid.pdf average.pdf 2 | 3 | clean: 4 | rm *.pdf *.plot 5 | 6 | grid.pdf: sfc-grid.plot 7 | gnuplot samplingbias-grid.plt 8 | 9 | average.pdf: sfc.plot 10 | gnuplot samplingbias2.plt 11 | 12 | sfc-grid.plot: 0000020000.ppm 13 | ./ppmToGnuPlot.pl 0000020000.ppm > sfc-grid.plot 14 | 15 | sfc.plot: 0000020000-average.ppm 16 | ./ppmToGnuPlot.pl 0000020000-average.ppm > sfc.plot -------------------------------------------------------------------------------- /tools/splotter/2x2x40x20k-dreg/ppmToGnuPlot.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -Tw 2 | 3 | my $file = shift @ARGV; 4 | defined $file or die "Usage:\n$0 PPMFILE\n"; 5 | open(FILE,"<$file") or die "Can't read '$file': $!\n"; 6 | binmode FILE; 7 | my ($count,$data); 8 | $count = read (FILE, $data, 999999999); 9 | close FILE or die; 10 | 11 | $data =~ /\s*#\s*Max site events = (\d+)\n\s*(\d+)\s+(\d+)\s+(\d+)\s*\n(.+)$/ 12 | or die "Can't find header info"; 13 | my ($eventmax,$wid,$hei,$max,$bytes) = ($1,$2,$3,$4,$5); 14 | my @pixels = split(//,$bytes); 15 | 16 | my $bpp = 1; 17 | my ($x,$y) = (0,0); 18 | for (my $i = 0; $i < $hei*$wid*$bpp; $i += $bpp) { 19 | printf("%d ", (ord($pixels[$i]) * $eventmax / 255) / 200); 20 | $x++; 21 | if(!(($x + 1) % ($wid + 1))) 22 | { 23 | $y++; 24 | $x = 0; 25 | printf("\n"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tools/splotter/2x2x40x20k-dreg/samplingbias-grid.plt: -------------------------------------------------------------------------------- 1 | # set terminal postscript eps enhanced color size 3.5,2.75 "NimbusSanL-Regu,17" fontfile "/usr/share/texmf-texlive/fonts/type1/urw/helvetic/uhvr8a.pfb" 2 | set terminal pdf 3 | set output 'grid.pdf' 4 | set samples 32 5 | set isosamples 32 6 | set hidden3d 7 | set title "Event rate vs site position\nDreg and Res, P1 Atom, N=32, R=4" 8 | set key title "" 9 | unset key 10 | set xlabel "x_c" 11 | set xtics 0,8 12 | set ytics 0,8 13 | # set xrange [0:32] 14 | set ylabel "y_c" 15 | # set yrange [0:32] 16 | set zlabel "Events/sec (15 tile average)" rotate offset -1.3,0,0 17 | # set zrange [80:120] 18 | set xyplane 0 19 | #set ztics ("to" 4000,"come" 5000, "soon" 6000, "now" 7000) 20 | set ztics 0,10 21 | set view 68,37 22 | splot "sfc-grid.plot" matrix with l lt 0 23 | -------------------------------------------------------------------------------- /tools/splotter/2x2x40x20k-dreg/samplingbias2.plt: -------------------------------------------------------------------------------- 1 | # set terminal postscript eps enhanced color size 3.5,2.75 "NimbusSanL-Regu,17" fontfile "/usr/share/texmf-texlive/fonts/type1/urw/helvetic/uhvr8a.pfb" 2 | set terminal pdf 3 | set output 'average.pdf' 4 | set samples 32 5 | set isosamples 32 6 | set hidden3d 7 | set title "Event rate vs site position\nDreg and Res, P1 Atom, N=32, R=4" 8 | set key title "" 9 | unset key 10 | set xlabel "x_c" 11 | set xtics 0,8 12 | set ytics 0,8 13 | # set xrange [0:32] 14 | set ylabel "y_c" 15 | # set yrange [0:32] 16 | set zlabel "Events/sec (15 tile average)" rotate offset -1.3,0,0 17 | # set zrange [80:120] 18 | set xyplane 0 19 | #set ztics ("to" 4000,"come" 5000, "soon" 6000, "now" 7000) 20 | set ztics 0,10 21 | set view 68,37 22 | splot "sfc.plot" matrix with l lt 0 23 | -------------------------------------------------------------------------------- /tools/splotter/2x3x40x20k-dreg/Makefile: -------------------------------------------------------------------------------- 1 | all: grid.pdf average.pdf 2 | 3 | clean: 4 | rm *.pdf *.plot 5 | 6 | grid.pdf: sfc-grid.plot 7 | gnuplot samplingbias-grid.plt 8 | 9 | average.pdf: sfc.plot 10 | gnuplot samplingbias2.plt 11 | 12 | sfc-grid.plot: 0000020000.ppm 13 | ./ppmToGnuPlot.pl 0000020000.ppm > sfc-grid.plot 14 | 15 | sfc.plot: 0000020000-average.ppm 16 | ./ppmToGnuPlot.pl 0000020000-average.ppm > sfc.plot -------------------------------------------------------------------------------- /tools/splotter/2x3x40x20k-dreg/ppmToGnuPlot.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -Tw 2 | 3 | my $file = shift @ARGV; 4 | defined $file or die "Usage:\n$0 PPMFILE\n"; 5 | open(FILE,"<$file") or die "Can't read '$file': $!\n"; 6 | binmode FILE; 7 | my ($count,$data); 8 | $count = read (FILE, $data, 999999999); 9 | close FILE or die; 10 | 11 | $data =~ /\s*#\s*Max site events = (\d+)\n\s*(\d+)\s+(\d+)\s+(\d+)\s*\n(.+)$/ 12 | or die "Can't find header info"; 13 | my ($eventmax,$wid,$hei,$max,$bytes) = ($1,$2,$3,$4,$5); 14 | my @pixels = split(//,$bytes); 15 | 16 | my $bpp = 1; 17 | my ($x,$y) = (0,0); 18 | for (my $i = 0; $i < $hei*$wid*$bpp; $i += $bpp) { 19 | printf("%d ", (ord($pixels[$i]) * $eventmax / 255) / 200); 20 | $x++; 21 | if(!(($x + 1) % ($wid + 1))) 22 | { 23 | $y++; 24 | $x = 0; 25 | printf("\n"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tools/splotter/2x3x40x20k-dreg/samplingbias-grid.plt: -------------------------------------------------------------------------------- 1 | # set terminal postscript eps enhanced color size 3.5,2.75 "NimbusSanL-Regu,17" fontfile "/usr/share/texmf-texlive/fonts/type1/urw/helvetic/uhvr8a.pfb" 2 | set terminal pdf 3 | set output 'grid.pdf' 4 | set samples 32 5 | set isosamples 32 6 | set hidden3d 7 | set title "Event rate vs site position\nDreg and Res, P1 Atom, N=32, R=4" 8 | set key title "" 9 | unset key 10 | set xlabel "x_c" 11 | set xtics 0,8 12 | set ytics 0,8 13 | # set xrange [0:32] 14 | set ylabel "y_c" 15 | # set yrange [0:32] 16 | set zlabel "Events/sec (15 tile average)" rotate offset -1.3,0,0 17 | # set zrange [80:120] 18 | set xyplane 0 19 | #set ztics ("to" 4000,"come" 5000, "soon" 6000, "now" 7000) 20 | set ztics 0,10 21 | set view 68,37 22 | splot "sfc-grid.plot" matrix with l lt 0 23 | -------------------------------------------------------------------------------- /tools/splotter/2x3x40x20k-dreg/samplingbias2.plt: -------------------------------------------------------------------------------- 1 | # set terminal postscript eps enhanced color size 3.5,2.75 "NimbusSanL-Regu,17" fontfile "/usr/share/texmf-texlive/fonts/type1/urw/helvetic/uhvr8a.pfb" 2 | set terminal pdf 3 | set output 'average.pdf' 4 | set samples 32 5 | set isosamples 32 6 | set hidden3d 7 | set title "Event rate vs site position\nDreg and Res, P1 Atom, N=32, R=4" 8 | set key title "" 9 | unset key 10 | set xlabel "x_c" 11 | set xtics 0,8 12 | set ytics 0,8 13 | # set xrange [0:32] 14 | set ylabel "y_c" 15 | # set yrange [0:32] 16 | set zlabel "Events/sec (15 tile average)" rotate offset -1.3,0,0 17 | # set zrange [80:120] 18 | set xyplane 0 19 | #set ztics ("to" 4000,"come" 5000, "soon" 6000, "now" 7000) 20 | set ztics 0,10 21 | set view 68,37 22 | splot "sfc.plot" matrix with l lt 0 23 | -------------------------------------------------------------------------------- /tools/splotter/2x4x40x20k-dreg/Makefile: -------------------------------------------------------------------------------- 1 | all: grid.pdf average.pdf 2 | 3 | clean: 4 | rm *.pdf *.plot 5 | 6 | grid.pdf: sfc-grid.plot 7 | gnuplot samplingbias-grid.plt 8 | 9 | average.pdf: sfc.plot 10 | gnuplot samplingbias2.plt 11 | 12 | sfc-grid.plot: 0000020000.ppm 13 | ./ppmToGnuPlot.pl 0000020000.ppm > sfc-grid.plot 14 | 15 | sfc.plot: 0000020000-average.ppm 16 | ./ppmToGnuPlot.pl 0000020000-average.ppm > sfc.plot -------------------------------------------------------------------------------- /tools/splotter/2x4x40x20k-dreg/ppmToGnuPlot.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -Tw 2 | 3 | my $file = shift @ARGV; 4 | defined $file or die "Usage:\n$0 PPMFILE\n"; 5 | open(FILE,"<$file") or die "Can't read '$file': $!\n"; 6 | binmode FILE; 7 | my ($count,$data); 8 | $count = read (FILE, $data, 999999999); 9 | close FILE or die; 10 | 11 | $data =~ /\s*#\s*Max site events = (\d+)\n\s*(\d+)\s+(\d+)\s+(\d+)\s*\n(.+)$/ 12 | or die "Can't find header info"; 13 | my ($eventmax,$wid,$hei,$max,$bytes) = ($1,$2,$3,$4,$5); 14 | my @pixels = split(//,$bytes); 15 | 16 | my $bpp = 1; 17 | my ($x,$y) = (0,0); 18 | for (my $i = 0; $i < $hei*$wid*$bpp; $i += $bpp) { 19 | printf("%d ", (ord($pixels[$i]) * $eventmax / 255) / 200); 20 | $x++; 21 | if(!(($x + 1) % ($wid + 1))) 22 | { 23 | $y++; 24 | $x = 0; 25 | printf("\n"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tools/splotter/2x4x40x20k-dreg/samplingbias-grid.plt: -------------------------------------------------------------------------------- 1 | # set terminal postscript eps enhanced color size 3.5,2.75 "NimbusSanL-Regu,17" fontfile "/usr/share/texmf-texlive/fonts/type1/urw/helvetic/uhvr8a.pfb" 2 | set terminal pdf 3 | set output 'grid.pdf' 4 | set samples 32 5 | set isosamples 32 6 | set hidden3d 7 | set title "Event rate vs site position\nDreg and Res, P1 Atom, N=32, R=4" 8 | set key title "" 9 | unset key 10 | set xlabel "x_c" 11 | set xtics 0,8 12 | set ytics 0,8 13 | # set xrange [0:32] 14 | set ylabel "y_c" 15 | # set yrange [0:32] 16 | set zlabel "Events/sec (15 tile average)" rotate offset -1.3,0,0 17 | # set zrange [80:120] 18 | set xyplane 0 19 | #set ztics ("to" 4000,"come" 5000, "soon" 6000, "now" 7000) 20 | set ztics 0,10 21 | set view 68,37 22 | splot "sfc-grid.plot" matrix with l lt 0 23 | -------------------------------------------------------------------------------- /tools/splotter/2x4x40x20k-dreg/samplingbias2.plt: -------------------------------------------------------------------------------- 1 | # set terminal postscript eps enhanced color size 3.5,2.75 "NimbusSanL-Regu,17" fontfile "/usr/share/texmf-texlive/fonts/type1/urw/helvetic/uhvr8a.pfb" 2 | set terminal pdf 3 | set output 'average.pdf' 4 | set samples 32 5 | set isosamples 32 6 | set hidden3d 7 | set title "Event rate vs site position\nDreg and Res, P1 Atom, N=32, R=4" 8 | set key title "" 9 | unset key 10 | set xlabel "x_c" 11 | set xtics 0,8 12 | set ytics 0,8 13 | # set xrange [0:32] 14 | set ylabel "y_c" 15 | # set yrange [0:32] 16 | set zlabel "Events/sec (15 tile average)" rotate offset -1.3,0,0 17 | # set zrange [80:120] 18 | set xyplane 0 19 | #set ztics ("to" 4000,"come" 5000, "soon" 6000, "now" 7000) 20 | set ztics 0,10 21 | set view 68,37 22 | splot "sfc.plot" matrix with l lt 0 23 | -------------------------------------------------------------------------------- /tools/splotter/2x5x40x20k-dreg/Makefile: -------------------------------------------------------------------------------- 1 | all: grid.pdf average.pdf 2 | 3 | clean: 4 | rm *.pdf *.plot 5 | 6 | grid.pdf: sfc-grid.plot 7 | gnuplot samplingbias-grid.plt 8 | 9 | average.pdf: sfc.plot 10 | gnuplot samplingbias2.plt 11 | 12 | sfc-grid.plot: 0000020000.ppm 13 | ./ppmToGnuPlot.pl 0000020000.ppm > sfc-grid.plot 14 | 15 | sfc.plot: 0000020000-average.ppm 16 | ./ppmToGnuPlot.pl 0000020000-average.ppm > sfc.plot -------------------------------------------------------------------------------- /tools/splotter/2x5x40x20k-dreg/ppmToGnuPlot.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -Tw 2 | 3 | my $file = shift @ARGV; 4 | defined $file or die "Usage:\n$0 PPMFILE\n"; 5 | open(FILE,"<$file") or die "Can't read '$file': $!\n"; 6 | binmode FILE; 7 | my ($count,$data); 8 | $count = read (FILE, $data, 999999999); 9 | close FILE or die; 10 | 11 | $data =~ /\s*#\s*Max site events = (\d+)\n\s*(\d+)\s+(\d+)\s+(\d+)\s*\n(.+)$/ 12 | or die "Can't find header info"; 13 | my ($eventmax,$wid,$hei,$max,$bytes) = ($1,$2,$3,$4,$5); 14 | my @pixels = split(//,$bytes); 15 | 16 | my $bpp = 1; 17 | my ($x,$y) = (0,0); 18 | for (my $i = 0; $i < $hei*$wid*$bpp; $i += $bpp) { 19 | printf("%d ", (ord($pixels[$i]) * $eventmax / 255) / 200); 20 | $x++; 21 | if(!(($x + 1) % ($wid + 1))) 22 | { 23 | $y++; 24 | $x = 0; 25 | printf("\n"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tools/splotter/2x5x40x20k-dreg/samplingbias-grid.plt: -------------------------------------------------------------------------------- 1 | # set terminal postscript eps enhanced color size 3.5,2.75 "NimbusSanL-Regu,17" fontfile "/usr/share/texmf-texlive/fonts/type1/urw/helvetic/uhvr8a.pfb" 2 | set terminal pdf 3 | set output 'grid.pdf' 4 | set samples 32 5 | set isosamples 32 6 | set hidden3d 7 | set title "Event rate vs site position\nDreg and Res, P1 Atom, N=32, R=4" 8 | set key title "" 9 | unset key 10 | set xlabel "x_c" 11 | set xtics 0,8 12 | set ytics 0,8 13 | # set xrange [0:32] 14 | set ylabel "y_c" 15 | # set yrange [0:32] 16 | set zlabel "Events/sec (15 tile average)" rotate offset -1.3,0,0 17 | # set zrange [80:120] 18 | set xyplane 0 19 | #set ztics ("to" 4000,"come" 5000, "soon" 6000, "now" 7000) 20 | set ztics 0,10 21 | set view 68,37 22 | splot "sfc-grid.plot" matrix with l lt 0 23 | -------------------------------------------------------------------------------- /tools/splotter/2x5x40x20k-dreg/samplingbias2.plt: -------------------------------------------------------------------------------- 1 | # set terminal postscript eps enhanced color size 3.5,2.75 "NimbusSanL-Regu,17" fontfile "/usr/share/texmf-texlive/fonts/type1/urw/helvetic/uhvr8a.pfb" 2 | set terminal pdf 3 | set output 'average.pdf' 4 | set samples 32 5 | set isosamples 32 6 | set hidden3d 7 | set title "Event rate vs site position\nDreg and Res, P1 Atom, N=32, R=4" 8 | set key title "" 9 | unset key 10 | set xlabel "x_c" 11 | set xtics 0,8 12 | set ytics 0,8 13 | # set xrange [0:32] 14 | set ylabel "y_c" 15 | # set yrange [0:32] 16 | set zlabel "Events/sec (15 tile average)" rotate offset -1.3,0,0 17 | # set zrange [80:120] 18 | set xyplane 0 19 | #set ztics ("to" 4000,"come" 5000, "soon" 6000, "now" 7000) 20 | set ztics 0,10 21 | set view 68,37 22 | splot "sfc.plot" matrix with l lt 0 23 | -------------------------------------------------------------------------------- /tools/splotter/2x6x40x20k-dreg/Makefile: -------------------------------------------------------------------------------- 1 | all: grid.pdf average.pdf 2 | 3 | clean: 4 | rm *.pdf *.plot 5 | 6 | grid.pdf: sfc-grid.plot 7 | gnuplot samplingbias-grid.plt 8 | 9 | average.pdf: sfc.plot 10 | gnuplot samplingbias2.plt 11 | 12 | sfc-grid.plot: 0000020000.ppm 13 | ./ppmToGnuPlot.pl 0000020000.ppm > sfc-grid.plot 14 | 15 | sfc.plot: 0000020000-average.ppm 16 | ./ppmToGnuPlot.pl 0000020000-average.ppm > sfc.plot -------------------------------------------------------------------------------- /tools/splotter/2x6x40x20k-dreg/ppmToGnuPlot.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -Tw 2 | 3 | my $file = shift @ARGV; 4 | defined $file or die "Usage:\n$0 PPMFILE\n"; 5 | open(FILE,"<$file") or die "Can't read '$file': $!\n"; 6 | binmode FILE; 7 | my ($count,$data); 8 | $count = read (FILE, $data, 999999999); 9 | close FILE or die; 10 | 11 | $data =~ /\s*#\s*Max site events = (\d+)\n\s*(\d+)\s+(\d+)\s+(\d+)\s*\n(.+)$/ 12 | or die "Can't find header info"; 13 | my ($eventmax,$wid,$hei,$max,$bytes) = ($1,$2,$3,$4,$5); 14 | my @pixels = split(//,$bytes); 15 | 16 | my $bpp = 1; 17 | my ($x,$y) = (0,0); 18 | for (my $i = 0; $i < $hei*$wid*$bpp; $i += $bpp) { 19 | printf("%d ", (ord($pixels[$i]) * $eventmax / 255) / 200); 20 | $x++; 21 | if(!(($x + 1) % ($wid + 1))) 22 | { 23 | $y++; 24 | $x = 0; 25 | printf("\n"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tools/splotter/2x6x40x20k-dreg/samplingbias-grid.plt: -------------------------------------------------------------------------------- 1 | # set terminal postscript eps enhanced color size 3.5,2.75 "NimbusSanL-Regu,17" fontfile "/usr/share/texmf-texlive/fonts/type1/urw/helvetic/uhvr8a.pfb" 2 | set terminal pdf 3 | set output 'grid.pdf' 4 | set samples 32 5 | set isosamples 32 6 | set hidden3d 7 | set title "Event rate vs site position\nDreg and Res, P1 Atom, N=32, R=4" 8 | set key title "" 9 | unset key 10 | set xlabel "x_c" 11 | set xtics 0,8 12 | set ytics 0,8 13 | # set xrange [0:32] 14 | set ylabel "y_c" 15 | # set yrange [0:32] 16 | set zlabel "Events/sec (15 tile average)" rotate offset -1.3,0,0 17 | # set zrange [80:120] 18 | set xyplane 0 19 | #set ztics ("to" 4000,"come" 5000, "soon" 6000, "now" 7000) 20 | set ztics 0,10 21 | set view 68,37 22 | splot "sfc-grid.plot" matrix with l lt 0 23 | -------------------------------------------------------------------------------- /tools/splotter/2x6x40x20k-dreg/samplingbias2.plt: -------------------------------------------------------------------------------- 1 | # set terminal postscript eps enhanced color size 3.5,2.75 "NimbusSanL-Regu,17" fontfile "/usr/share/texmf-texlive/fonts/type1/urw/helvetic/uhvr8a.pfb" 2 | set terminal pdf 3 | set output 'average.pdf' 4 | set samples 32 5 | set isosamples 32 6 | set hidden3d 7 | set title "Event rate vs site position\nDreg and Res, P1 Atom, N=32, R=4" 8 | set key title "" 9 | unset key 10 | set xlabel "x_c" 11 | set xtics 0,8 12 | set ytics 0,8 13 | # set xrange [0:32] 14 | set ylabel "y_c" 15 | # set yrange [0:32] 16 | set zlabel "Events/sec (15 tile average)" rotate offset -1.3,0,0 17 | # set zrange [80:120] 18 | set xyplane 0 19 | #set ztics ("to" 4000,"come" 5000, "soon" 6000, "now" 7000) 20 | set ztics 0,10 21 | set view 68,37 22 | splot "sfc.plot" matrix with l lt 0 23 | -------------------------------------------------------------------------------- /tools/splotter/2x7x40x20k-dreg/Makefile: -------------------------------------------------------------------------------- 1 | all: grid.pdf average.pdf 2 | 3 | clean: 4 | rm *.pdf *.plot 5 | 6 | grid.pdf: sfc-grid.plot 7 | gnuplot samplingbias-grid.plt 8 | 9 | average.pdf: sfc.plot 10 | gnuplot samplingbias2.plt 11 | 12 | sfc-grid.plot: 0000020000.ppm 13 | ./ppmToGnuPlot.pl 0000020000.ppm > sfc-grid.plot 14 | 15 | sfc.plot: 0000020000-average.ppm 16 | ./ppmToGnuPlot.pl 0000020000-average.ppm > sfc.plot -------------------------------------------------------------------------------- /tools/splotter/2x7x40x20k-dreg/ppmToGnuPlot.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -Tw 2 | 3 | my $file = shift @ARGV; 4 | defined $file or die "Usage:\n$0 PPMFILE\n"; 5 | open(FILE,"<$file") or die "Can't read '$file': $!\n"; 6 | binmode FILE; 7 | my ($count,$data); 8 | $count = read (FILE, $data, 999999999); 9 | close FILE or die; 10 | 11 | $data =~ /\s*#\s*Max site events = (\d+)\n\s*(\d+)\s+(\d+)\s+(\d+)\s*\n(.+)$/ 12 | or die "Can't find header info"; 13 | my ($eventmax,$wid,$hei,$max,$bytes) = ($1,$2,$3,$4,$5); 14 | my @pixels = split(//,$bytes); 15 | 16 | my $bpp = 1; 17 | my ($x,$y) = (0,0); 18 | for (my $i = 0; $i < $hei*$wid*$bpp; $i += $bpp) { 19 | printf("%d ", (ord($pixels[$i]) * $eventmax / 255) / 200); 20 | $x++; 21 | if(!(($x + 1) % ($wid + 1))) 22 | { 23 | $y++; 24 | $x = 0; 25 | printf("\n"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tools/splotter/2x7x40x20k-dreg/samplingbias-grid.plt: -------------------------------------------------------------------------------- 1 | # set terminal postscript eps enhanced color size 3.5,2.75 "NimbusSanL-Regu,17" fontfile "/usr/share/texmf-texlive/fonts/type1/urw/helvetic/uhvr8a.pfb" 2 | set terminal pdf 3 | set output 'grid.pdf' 4 | set samples 32 5 | set isosamples 32 6 | set hidden3d 7 | set title "Event rate vs site position\nDreg and Res, P1 Atom, N=32, R=4" 8 | set key title "" 9 | unset key 10 | set xlabel "x_c" 11 | set xtics 0,8 12 | set ytics 0,8 13 | # set xrange [0:32] 14 | set ylabel "y_c" 15 | # set yrange [0:32] 16 | set zlabel "Events/sec (15 tile average)" rotate offset -1.3,0,0 17 | # set zrange [80:120] 18 | set xyplane 0 19 | #set ztics ("to" 4000,"come" 5000, "soon" 6000, "now" 7000) 20 | set ztics 0,10 21 | set view 68,37 22 | splot "sfc-grid.plot" matrix with l lt 0 23 | -------------------------------------------------------------------------------- /tools/splotter/2x7x40x20k-dreg/samplingbias2.plt: -------------------------------------------------------------------------------- 1 | # set terminal postscript eps enhanced color size 3.5,2.75 "NimbusSanL-Regu,17" fontfile "/usr/share/texmf-texlive/fonts/type1/urw/helvetic/uhvr8a.pfb" 2 | set terminal pdf 3 | set output 'average.pdf' 4 | set samples 32 5 | set isosamples 32 6 | set hidden3d 7 | set title "Event rate vs site position\nDreg and Res, P1 Atom, N=32, R=4" 8 | set key title "" 9 | unset key 10 | set xlabel "x_c" 11 | set xtics 0,8 12 | set ytics 0,8 13 | # set xrange [0:32] 14 | set ylabel "y_c" 15 | # set yrange [0:32] 16 | set zlabel "Events/sec (15 tile average)" rotate offset -1.3,0,0 17 | # set zrange [80:120] 18 | set xyplane 0 19 | #set ztics ("to" 4000,"come" 5000, "soon" 6000, "now" 7000) 20 | set ztics 0,10 21 | set view 68,37 22 | splot "sfc.plot" matrix with l lt 0 23 | -------------------------------------------------------------------------------- /tools/splotter/3x5x40x10k-dreg/samplingbias2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaveAckley/MFM/873d7ed412f5343ebcbbb0c0d47a6b061aa901f5/tools/splotter/3x5x40x10k-dreg/samplingbias2.pdf -------------------------------------------------------------------------------- /tools/splotter/3x5x40x20k-dreg/Makefile: -------------------------------------------------------------------------------- 1 | all: grid.pdf average.pdf 2 | 3 | clean: 4 | rm *.pdf *.plot 5 | 6 | grid.pdf: sfc-grid.plot 7 | gnuplot samplingbias-grid.plt 8 | 9 | average.pdf: sfc.plot 10 | gnuplot samplingbias2.plt 11 | 12 | sfc-grid.plot: 0000020000.ppm 13 | ./ppmToGnuPlot.pl 0000020000.ppm > sfc-grid.plot 14 | 15 | sfc.plot: 0000020000-average.ppm 16 | ./ppmToGnuPlot.pl 0000020000-average.ppm > sfc.plot -------------------------------------------------------------------------------- /tools/splotter/3x5x40x20k-dreg/average.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaveAckley/MFM/873d7ed412f5343ebcbbb0c0d47a6b061aa901f5/tools/splotter/3x5x40x20k-dreg/average.pdf -------------------------------------------------------------------------------- /tools/splotter/3x5x40x20k-dreg/grid.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaveAckley/MFM/873d7ed412f5343ebcbbb0c0d47a6b061aa901f5/tools/splotter/3x5x40x20k-dreg/grid.pdf -------------------------------------------------------------------------------- /tools/splotter/3x5x40x20k-dreg/ppmToGnuPlot.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -Tw 2 | 3 | my $file = shift @ARGV; 4 | defined $file or die "Usage:\n$0 PPMFILE\n"; 5 | open(FILE,"<$file") or die "Can't read '$file': $!\n"; 6 | binmode FILE; 7 | my ($count,$data); 8 | $count = read (FILE, $data, 999999999); 9 | close FILE or die; 10 | 11 | $data =~ /\s*#\s*Max site events = (\d+)\n\s*(\d+)\s+(\d+)\s+(\d+)\s*\n(.+)$/ 12 | or die "Can't find header info"; 13 | my ($eventmax,$wid,$hei,$max,$bytes) = ($1,$2,$3,$4,$5); 14 | my @pixels = split(//,$bytes); 15 | 16 | my $bpp = 1; 17 | my ($x,$y) = (0,0); 18 | for (my $i = 0; $i < $hei*$wid*$bpp; $i += $bpp) { 19 | printf("%d ", (ord($pixels[$i]) * $eventmax / 255) / 200); 20 | $x++; 21 | if(!(($x + 1) % ($wid + 1))) 22 | { 23 | $y++; 24 | $x = 0; 25 | printf("\n"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tools/splotter/3x5x40x20k-dreg/samplingbias-grid.plt: -------------------------------------------------------------------------------- 1 | # set terminal postscript eps enhanced color size 3.5,2.75 "NimbusSanL-Regu,17" fontfile "/usr/share/texmf-texlive/fonts/type1/urw/helvetic/uhvr8a.pfb" 2 | set terminal pdf 3 | set output 'grid.pdf' 4 | set samples 32 5 | set isosamples 32 6 | set hidden3d 7 | set title "Event rate vs site position\nDreg and Res, P1 Atom, N=32, R=4" 8 | set key title "" 9 | unset key 10 | set xlabel "x_c" 11 | set xtics 0,8 12 | set ytics 0,8 13 | # set xrange [0:32] 14 | set ylabel "y_c" 15 | # set yrange [0:32] 16 | set zlabel "Events/sec (15 tile average)" rotate offset -1.3,0,0 17 | # set zrange [80:120] 18 | set xyplane 0 19 | #set ztics ("to" 4000,"come" 5000, "soon" 6000, "now" 7000) 20 | set ztics 0,10 21 | set view 68,37 22 | splot "sfc-grid.plot" matrix with l lt 0 23 | -------------------------------------------------------------------------------- /tools/splotter/3x5x40x20k-dreg/samplingbias2.plt: -------------------------------------------------------------------------------- 1 | # set terminal postscript eps enhanced color size 3.5,2.75 "NimbusSanL-Regu,17" fontfile "/usr/share/texmf-texlive/fonts/type1/urw/helvetic/uhvr8a.pfb" 2 | set terminal pdf 3 | set output 'average.pdf' 4 | set samples 32 5 | set isosamples 32 6 | set hidden3d 7 | set title "Event rate vs site position\nDreg and Res, P1 Atom, N=32, R=4" 8 | set key title "" 9 | unset key 10 | set xlabel "x_c" 11 | set xtics 0,8 12 | set ytics 0,8 13 | # set xrange [0:32] 14 | set ylabel "y_c" 15 | # set yrange [0:32] 16 | set zlabel "Events/sec (15 tile average)" rotate offset -1.3,0,0 17 | # set zrange [80:120] 18 | set xyplane 0 19 | #set ztics ("to" 4000,"come" 5000, "soon" 6000, "now" 7000) 20 | set ztics 0,10 21 | set view 68,37 22 | splot "sfc.plot" matrix with l lt 0 23 | -------------------------------------------------------------------------------- /tools/splotter/ppmToGnuPlot.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -Tw 2 | 3 | my $file = shift @ARGV; 4 | defined $file or die "Usage:\n$0 PPMFILE\n"; 5 | open(FILE,"<$file") or die "Can't read '$file': $!\n"; 6 | binmode FILE; 7 | my ($count,$data); 8 | $count = read (FILE, $data, 999999999); 9 | close FILE or die; 10 | 11 | $data =~ /\s*#\s*Max site events = (\d+)\n\s*(\d+)\s+(\d+)\s+(\d+)\s*\n(.+)$/ 12 | or die "Can't find header info"; 13 | my ($eventmax,$wid,$hei,$max,$bytes) = ($1,$2,$3,$4,$5); 14 | my @pixels = split(//,$bytes); 15 | 16 | my $bpp = 1; 17 | my ($x,$y) = (0,0); 18 | for (my $i = 0; $i < $hei*$wid*$bpp; $i += $bpp) { 19 | printf("%d ", (ord($pixels[$i]) * $eventmax / 255) / 200); 20 | $x++; 21 | if(!(($x + 1) % ($wid + 1))) 22 | { 23 | $y++; 24 | $x = 0; 25 | printf("\n"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tools/splotter/samplingbias-grid.plt: -------------------------------------------------------------------------------- 1 | # set terminal postscript eps enhanced color size 3.5,2.75 "NimbusSanL-Regu,17" fontfile "/usr/share/texmf-texlive/fonts/type1/urw/helvetic/uhvr8a.pfb" 2 | set terminal pdf 3 | set output 'samplingbias-grid.pdf' 4 | set samples 32 5 | set isosamples 32 6 | set hidden3d 7 | set title "Event rate vs site position\nDreg and Res, P1 Atom, N=32, R=4" 8 | set key title "" 9 | unset key 10 | set xlabel "x_c" 11 | set xtics 0,8 12 | set ytics 0,8 13 | # set xrange [0:32] 14 | set ylabel "y_c" 15 | # set yrange [0:32] 16 | set zlabel "Events/sec (15 tile average)" rotate offset -1.3,0,0 17 | # set zrange [80:120] 18 | set xyplane 0 19 | #set ztics ("to" 4000,"come" 5000, "soon" 6000, "now" 7000) 20 | set ztics 0,10 21 | set view 68,37 22 | splot "sfc-grid.plot" matrix with l lt 0 23 | -------------------------------------------------------------------------------- /tools/splotter/samplingbias2.plt: -------------------------------------------------------------------------------- 1 | # set terminal postscript eps enhanced color size 3.5,2.75 "NimbusSanL-Regu,17" fontfile "/usr/share/texmf-texlive/fonts/type1/urw/helvetic/uhvr8a.pfb" 2 | set terminal pdf 3 | set output 'samplingbias2.pdf' 4 | set samples 32 5 | set isosamples 32 6 | set hidden3d 7 | set title "Event rate vs site position\nDreg and Res, P1 Atom, N=32, R=4" 8 | set key title "" 9 | unset key 10 | set xlabel "x_c" 11 | set xtics 0,8 12 | set ytics 0,8 13 | # set xrange [0:32] 14 | set ylabel "y_c" 15 | # set yrange [0:32] 16 | set zlabel "Events/sec (15 tile average)" rotate offset -1.3,0,0 17 | # set zrange [80:120] 18 | set xyplane 0 19 | #set ztics ("to" 4000,"come" 5000, "soon" 6000, "now" 7000) 20 | set ztics 0,10 21 | set view 68,37 22 | splot "sfc.plot" matrix with l lt 0 23 | --------------------------------------------------------------------------------