From 73eaee7c6db1b241b242820ad76e0f6e4559beaf Mon Sep 17 00:00:00 2001 From: Reimar Date: Sat, 23 Mar 2024 14:40:50 +0100 Subject: [PATCH] Fix font and rename folder to Wb --- public/{src => Wb}/Adam/ABlkDev/ADskA.HC | 0 public/{src => Wb}/Adam/ABlkDev/ADskB.HC | 0 public/{src => Wb}/Adam/ABlkDev/DskChk.HC | 0 public/{src => Wb}/Adam/ABlkDev/DskPrt.HC | 0 public/{src => Wb}/Adam/ABlkDev/FileMgr.HC | 0 .../{src => Wb}/Adam/ABlkDev/MakeABlkDev.HC | 0 public/{src => Wb}/Adam/ABlkDev/Mount.HC | 0 public/{src => Wb}/Adam/ADbg.HC | 0 public/{src => Wb}/Adam/ADefine.HC | 0 public/{src => Wb}/Adam/AExts.HC | 0 public/{src => Wb}/Adam/AHash.HC | 0 public/{src => Wb}/Adam/AMath.HC | 0 public/{src => Wb}/Adam/AMathODE.HC | 0 public/{src => Wb}/Adam/AMem.HC | 0 public/{src => Wb}/Adam/AMouse.HC | Bin public/{src => Wb}/Adam/ARegistry.HC | 0 public/{src => Wb}/Adam/ASnd.HC | 0 .../Adam/AutoComplete/ACDictGen.HC | 0 .../{src => Wb}/Adam/AutoComplete/ACFill.HC | 0 .../{src => Wb}/Adam/AutoComplete/ACInit.HC | 0 .../{src => Wb}/Adam/AutoComplete/ACTask.HC | 0 .../{src => Wb}/Adam/AutoComplete/MakeAC.HC | 0 public/{src => Wb}/Adam/CPURep.HC | 0 public/{src => Wb}/Adam/Ctrls/CtrlsA.HC | 0 public/{src => Wb}/Adam/Ctrls/CtrlsBttn.HC | 0 public/{src => Wb}/Adam/Ctrls/CtrlsSlider.HC | 0 public/{src => Wb}/Adam/Ctrls/MakeCtrls.HC | 0 public/{src => Wb}/Adam/DevInfo.HC | 0 public/{src => Wb}/Adam/DolDoc/DocBin.HC | 0 public/{src => Wb}/Adam/DolDoc/DocChar.HC | 0 .../{src => Wb}/Adam/DolDoc/DocClipBoard.HC | 0 .../{src => Wb}/Adam/DolDoc/DocCodeTools.HC | 0 public/{src => Wb}/Adam/DolDoc/DocDblBuf.HC | 0 public/{src => Wb}/Adam/DolDoc/DocEd.HC | 0 public/{src => Wb}/Adam/DolDoc/DocExt.HC | 0 public/{src => Wb}/Adam/DolDoc/DocFile.HC | 0 public/{src => Wb}/Adam/DolDoc/DocFind.HC | 0 public/{src => Wb}/Adam/DolDoc/DocForm.HC | 0 public/{src => Wb}/Adam/DolDoc/DocGet.HC | 0 public/{src => Wb}/Adam/DolDoc/DocGr.HC | 0 .../{src => Wb}/Adam/DolDoc/DocHighlight.HC | 0 public/{src => Wb}/Adam/DolDoc/DocInit.HC | 0 public/{src => Wb}/Adam/DolDoc/DocLink.HC | 0 public/{src => Wb}/Adam/DolDoc/DocMacro.HC | 0 public/{src => Wb}/Adam/DolDoc/DocNew.HC | 0 public/{src => Wb}/Adam/DolDoc/DocPlain.HC | 0 public/{src => Wb}/Adam/DolDoc/DocPopUp.HC | 0 public/{src => Wb}/Adam/DolDoc/DocPutKey.HC | 0 public/{src => Wb}/Adam/DolDoc/DocPutS.HC | 0 public/{src => Wb}/Adam/DolDoc/DocRecalc.HC | 0 .../{src => Wb}/Adam/DolDoc/DocRecalcLib.HC | 0 public/{src => Wb}/Adam/DolDoc/DocRun.HC | 0 public/{src => Wb}/Adam/DolDoc/DocTerm.HC | 0 public/{src => Wb}/Adam/DolDoc/DocTree.HC | 0 .../{src => Wb}/Adam/DolDoc/DocWidgetWiz.HC | 0 public/{src => Wb}/Adam/DolDoc/MakeDoc.HC | 0 public/{src => Wb}/Adam/God/GodBible.HC | 0 public/{src => Wb}/Adam/God/GodDoodle.HC | 0 public/{src => Wb}/Adam/God/GodExt.HC | 0 public/{src => Wb}/Adam/God/GodSong.HC | 0 public/{src => Wb}/Adam/God/HSNotes.DD.HTML | 2 +- public/{src => Wb}/Adam/God/HolySpirit.HC | 0 public/{src => Wb}/Adam/God/MakeGod.HC | 0 public/{src => Wb}/Adam/God/Vocab.DD.HTML | 2 +- public/{src => Wb}/Adam/Gr/GrAsm.HC | 0 public/{src => Wb}/Adam/Gr/GrBitMap.HC | 0 public/{src => Wb}/Adam/Gr/GrComposites.HC | 0 public/{src => Wb}/Adam/Gr/GrDC.HC | 0 public/{src => Wb}/Adam/Gr/GrEnd.HC | 0 public/{src => Wb}/Adam/Gr/GrExt.HC | 0 public/{src => Wb}/Adam/Gr/GrGlbls.HC | 0 public/{src => Wb}/Adam/Gr/GrInitA.HC | 0 public/{src => Wb}/Adam/Gr/GrInitB.HC | 0 public/{src => Wb}/Adam/Gr/GrMath.HC | 0 public/{src => Wb}/Adam/Gr/GrPalette.HC | 0 public/{src => Wb}/Adam/Gr/GrPrimatives.HC | 0 public/{src => Wb}/Adam/Gr/GrScrn.HC | 0 public/{src => Wb}/Adam/Gr/GrSpritePlot.HC | 0 public/{src => Wb}/Adam/Gr/GrTextBase.HC | 0 public/{src => Wb}/Adam/Gr/MakeGr.HC | 0 public/{src => Wb}/Adam/Gr/ScrnCast.HC | 0 public/{src => Wb}/Adam/Gr/SpriteBitMap.HC | 0 public/{src => Wb}/Adam/Gr/SpriteCode.HC | 0 public/{src => Wb}/Adam/Gr/SpriteEd.HC | 0 public/{src => Wb}/Adam/Gr/SpriteMain.HC | 0 public/{src => Wb}/Adam/Gr/SpriteMesh.HC | 0 public/{src => Wb}/Adam/Gr/SpriteNew.HC | 0 public/{src => Wb}/Adam/Gr/SpriteSideBar.HC | 0 public/{src => Wb}/Adam/Host.HC | 0 public/{src => Wb}/Adam/InFile.HC | 0 public/{src => Wb}/Adam/InsReg.HC | 0 public/{src => Wb}/Adam/MakeAdam.HC | 0 public/{src => Wb}/Adam/Menu.HC | 0 public/{src => Wb}/Adam/Opt/Boot/BootDVD.HC | 0 .../{src => Wb}/Adam/Opt/Boot/BootDVDIns.HC | 0 public/{src => Wb}/Adam/Opt/Boot/BootHD.HC | 0 public/{src => Wb}/Adam/Opt/Boot/BootHDIns.HC | 0 public/{src => Wb}/Adam/Opt/Boot/BootMHD.HC | 0 public/{src => Wb}/Adam/Opt/Boot/BootMHD2.HC | 0 .../{src => Wb}/Adam/Opt/Boot/BootMHDIns.HC | 0 public/{src => Wb}/Adam/Opt/Boot/BootRAM.HC | 0 .../{src => Wb}/Adam/Opt/Boot/DskISORedSea.HC | 0 public/{src => Wb}/Adam/Opt/Boot/MakeBoot.HC | 0 public/{src => Wb}/Adam/Opt/Utils/Diff.HC | 0 public/{src => Wb}/Adam/Opt/Utils/DocUtils.HC | 0 public/{src => Wb}/Adam/Opt/Utils/Find.HC | 0 public/{src => Wb}/Adam/Opt/Utils/HeapLog.HC | 0 public/{src => Wb}/Adam/Opt/Utils/LineRep.HC | 0 public/{src => Wb}/Adam/Opt/Utils/LinkChk.HC | 0 .../{src => Wb}/Adam/Opt/Utils/MakeUtils.HC | 0 public/{src => Wb}/Adam/Opt/Utils/MemRep.HC | 0 public/{src => Wb}/Adam/Opt/Utils/Merge.HC | 0 public/{src => Wb}/Adam/Opt/Utils/Profiler.HC | 0 public/{src => Wb}/Adam/Opt/Utils/StrUtils.HC | 0 public/{src => Wb}/Adam/Opt/Utils/TOS.HC | 0 public/{src => Wb}/Adam/Opt/Utils/ToDolDoc.HC | 0 public/{src => Wb}/Adam/Opt/Utils/ToTXT.HC | 0 public/{src => Wb}/Adam/TaskRep.HC | 0 public/{src => Wb}/Adam/TaskSettings.HC | 0 public/{src => Wb}/Adam/Training.HC | 0 public/{src => Wb}/Adam/WallPaper.HC | Bin public/{src => Wb}/Adam/Win.HC | 0 public/{src => Wb}/Adam/WinMgr.HC | 0 public/{src => Wb}/Apps/Budget/Accts.DD.HTML | 2 +- public/{src => Wb}/Apps/Budget/BgtAccts.HC | 0 public/{src => Wb}/Apps/Budget/BgtEntry.HC | 0 public/{src => Wb}/Apps/Budget/BgtFile.HC | 0 public/{src => Wb}/Apps/Budget/BgtMain.HC | 0 public/{src => Wb}/Apps/Budget/BgtStrs.HC | 0 public/{src => Wb}/Apps/Budget/BgtTemplate.HC | 0 public/{src => Wb}/Apps/Budget/Budget.HC | 0 public/{src => Wb}/Apps/Budget/Install.HC | 0 public/{src => Wb}/Apps/Budget/Load.HC | 0 public/{src => Wb}/Apps/Budget/Run.HC | 0 public/{src => Wb}/Apps/GrModels/BallGen.HC | 0 public/{src => Wb}/Apps/GrModels/Load.HC | 0 public/{src => Wb}/Apps/GrModels/ManGen.HC | 0 public/{src => Wb}/Apps/GrModels/Models.HC | 0 public/{src => Wb}/Apps/GrModels/Run.HC | 0 public/{src => Wb}/Apps/KeepAway/KeepAway.HC | 0 public/{src => Wb}/Apps/KeepAway/Load.HC | 0 public/{src => Wb}/Apps/KeepAway/Run.HC | 0 public/{src => Wb}/Apps/Logic/Load.HC | 0 public/{src => Wb}/Apps/Logic/Logic.HC | 0 public/{src => Wb}/Apps/Logic/Run.HC | 0 .../Apps/Psalmody/Examples/childish.HC | 0 .../Apps/Psalmody/Examples/night.HC | Bin .../Apps/Psalmody/Examples/prosper.HC | Bin public/{src => Wb}/Apps/Psalmody/Help.DD.HTML | 16 +- public/{src => Wb}/Apps/Psalmody/Install.HC | 0 public/{src => Wb}/Apps/Psalmody/JukeBox.HC | 0 .../{src => Wb}/Apps/Psalmody/JukePuppet.HC | 0 public/{src => Wb}/Apps/Psalmody/Load.HC | 0 public/{src => Wb}/Apps/Psalmody/Psalmody.HC | 0 .../Apps/Psalmody/PsalmodyCtrls.HC | 0 .../{src => Wb}/Apps/Psalmody/PsalmodyDraw.HC | 0 .../{src => Wb}/Apps/Psalmody/PsalmodyFile.HC | 0 .../{src => Wb}/Apps/Psalmody/PsalmodyMain.HC | 0 public/{src => Wb}/Apps/Psalmody/Run.HC | 0 public/{src => Wb}/Apps/Span/Install.HC | 0 public/{src => Wb}/Apps/Span/Load.HC | 0 public/{src => Wb}/Apps/Span/Run.HC | 0 public/{src => Wb}/Apps/Span/SpanBridge.HC | 0 public/{src => Wb}/Apps/Span/SpanDerive.HC | 0 public/{src => Wb}/Apps/Span/SpanMain.HC | 0 public/{src => Wb}/Apps/Span/SpanNew.HC | 0 public/{src => Wb}/Apps/Strut/Load.HC | 0 public/{src => Wb}/Apps/Strut/Run.HC | 0 public/{src => Wb}/Apps/Strut/Strut.HC | 0 public/{src => Wb}/Apps/TimeClock/Install.HC | 0 public/{src => Wb}/Apps/TimeClock/Load.HC | 0 public/{src => Wb}/Apps/TimeClock/TimeClk.HC | 0 public/{src => Wb}/Apps/Titanium/Load.HC | 0 public/{src => Wb}/Apps/Titanium/Run.HC | 0 public/{src => Wb}/Apps/Titanium/Titanium.HC | 0 .../{src => Wb}/Apps/ToTheFront/AIs/Human.HC | 0 .../Apps/ToTheFront/AIs/SimpleAI.HC | 0 public/{src => Wb}/Apps/ToTheFront/Install.HC | 0 public/{src => Wb}/Apps/ToTheFront/Load.HC | 0 public/{src => Wb}/Apps/ToTheFront/Run.HC | 0 public/{src => Wb}/Apps/ToTheFront/TTFDraw.HC | Bin public/{src => Wb}/Apps/ToTheFront/TTFFire.HC | 0 .../{src => Wb}/Apps/ToTheFront/TTFGlbls.HC | 0 public/{src => Wb}/Apps/ToTheFront/TTFInit.HC | 0 public/{src => Wb}/Apps/ToTheFront/TTFLib.HC | 0 public/{src => Wb}/Apps/ToTheFront/TTFMove.HC | 0 public/{src => Wb}/Apps/ToTheFront/TTFVis.HC | 0 .../{src => Wb}/Apps/ToTheFront/ToTheFront.HC | 0 public/{src => Wb}/Apps/Vocabulary/Load.HC | 0 public/{src => Wb}/Apps/Vocabulary/Run.HC | 0 .../{src => Wb}/Apps/Vocabulary/VocabQuiz.HC | 0 public/{src => Wb}/Apps/X-Caliber/Load.HC | 0 public/{src => Wb}/Apps/X-Caliber/Run.HC | 0 .../{src => Wb}/Apps/X-Caliber/X-Caliber.HC | 0 public/{src => Wb}/Apps/X-Caliber/XCCtrls.HC | 0 public/{src => Wb}/Compiler/Asm.HC | 0 public/{src => Wb}/Compiler/AsmInit.HC | 0 public/{src => Wb}/Compiler/AsmLib.HC | 0 public/{src => Wb}/Compiler/AsmResolve.HC | 0 public/{src => Wb}/Compiler/BackA.HC | 0 public/{src => Wb}/Compiler/BackB.HC | 0 public/{src => Wb}/Compiler/BackC.HC | 0 public/{src => Wb}/Compiler/BackFA.HC | 0 public/{src => Wb}/Compiler/BackFB.HC | 0 public/{src => Wb}/Compiler/BackLib.HC | 0 public/{src => Wb}/Compiler/CExcept.HC | 0 public/{src => Wb}/Compiler/CExts.HC | 0 public/{src => Wb}/Compiler/CHash.HC | 0 public/{src => Wb}/Compiler/CInit.HC | 0 public/{src => Wb}/Compiler/CMain.HC | 0 public/{src => Wb}/Compiler/CMisc.HC | 0 public/{src => Wb}/Compiler/Lex.HC | 0 public/{src => Wb}/Compiler/LexLib.HC | 0 public/{src => Wb}/Compiler/OpCodes.DD.HTML | 4 +- public/{src => Wb}/Compiler/OptLib.HC | 0 public/{src => Wb}/Compiler/OptPass012.HC | 0 public/{src => Wb}/Compiler/OptPass3.HC | 0 public/{src => Wb}/Compiler/OptPass4.HC | 0 public/{src => Wb}/Compiler/OptPass5.HC | 0 public/{src => Wb}/Compiler/OptPass6.HC | 0 public/{src => Wb}/Compiler/OptPass789A.HC | 0 public/{src => Wb}/Compiler/PrsExp.HC | 0 public/{src => Wb}/Compiler/PrsLib.HC | 0 public/{src => Wb}/Compiler/PrsStmt.HC | 0 public/{src => Wb}/Compiler/PrsVar.HC | 0 public/{src => Wb}/Compiler/Templates.HC | 0 public/{src => Wb}/Compiler/UAsm.HC | 0 .../Demo/AcctExample/HomeKeyPlugIns.HC | 0 .../Demo/AcctExample/HomeLocalize.HC | 0 .../{src => Wb}/Demo/AcctExample/HomeSys.HC | 0 .../Demo/AcctExample/HomeWrappers.HC | 0 .../{src => Wb}/Demo/AcctExample/MakeHome.HC | 0 public/{src => Wb}/Demo/AcctExample/Once.HC | 0 .../Demo/AcctExample/PersonalMenu.DD.HTML | 2 +- .../Demo/AcctExample/PersonalNotes.DD.HTML | 212 +- .../{src => Wb}/Demo/AcctExample/Registry.HC | 0 .../Demo/AcctExample/TOS/MakeTOS.HC | 0 .../Demo/AcctExample/TOS/TOSCfg.HC | 0 .../Demo/AcctExample/TOS/TOSDistro.HC | 0 .../Demo/AcctExample/TOS/TOSExt.HC | 0 .../Demo/AcctExample/TOS/TOSMisc.HC | 0 .../Demo/AcctExample/TOS/TOSTheme.HC | Bin public/{src => Wb}/Demo/Asm/AsmAndC1.HC | 0 public/{src => Wb}/Demo/Asm/AsmAndC2.HC | 0 public/{src => Wb}/Demo/Asm/AsmAndC3.HC | 0 public/{src => Wb}/Demo/Asm/AsmHelloWorld.HC | 0 public/{src => Wb}/Demo/Asm/BuzzFizz.HC | 0 public/{src => Wb}/Demo/Asm/DivByHand.HC | 0 public/{src => Wb}/Demo/Asm/MulByHand.HC | 0 public/{src => Wb}/Demo/Asm/PutDec.HC | 0 public/{src => Wb}/Demo/Carry.HC | 0 public/{src => Wb}/Demo/ClassMeta.HC | 0 public/{src => Wb}/Demo/CompileDemo.HC | 0 public/{src => Wb}/Demo/DateTime.HC | 0 public/{src => Wb}/Demo/DbgDemo.HC | 0 public/{src => Wb}/Demo/Define.HC | 0 public/{src => Wb}/Demo/Directives.HC | 0 public/{src => Wb}/Demo/DolDoc/CallBack.HC | 0 .../{src => Wb}/Demo/DolDoc/ClickCallBack.HC | 0 public/{src => Wb}/Demo/DolDoc/CursorMove.HC | 0 public/{src => Wb}/Demo/DolDoc/Data.HC | 0 public/{src => Wb}/Demo/DolDoc/DefineStr.HC | 0 .../{src => Wb}/Demo/DolDoc/DemoDoc.DD.HTML | 2 +- public/{src => Wb}/Demo/DolDoc/FileRead.HC | 0 public/{src => Wb}/Demo/DolDoc/Form.HC | 0 public/{src => Wb}/Demo/DolDoc/MenuBttn.HC | 0 public/{src => Wb}/Demo/DolDoc/MenuSprite.HC | Bin public/{src => Wb}/Demo/DolDoc/NumBible.HC | 0 public/{src => Wb}/Demo/DolDoc/TextDemo.HC | 0 public/{src => Wb}/Demo/DolDoc/TreeDemo.HC | 0 .../{src => Wb}/Demo/DolDoc/UnusedDefine.HC | 0 public/{src => Wb}/Demo/Dsk/BlkDevRep.HC | 0 public/{src => Wb}/Demo/Dsk/DataBase.HC | 0 public/{src => Wb}/Demo/Dsk/DskRaw.HC | 0 public/{src => Wb}/Demo/Dsk/FPrintF.HC | 0 public/{src => Wb}/Demo/Dsk/SerializeTree.HC | 0 public/{src => Wb}/Demo/Dsk/UnusedSpaceRep.HC | 0 public/{src => Wb}/Demo/Exceptions.HC | 0 public/{src => Wb}/Demo/ExtChars.HC | 0 public/{src => Wb}/Demo/Games/BattleLines.HC | Bin public/{src => Wb}/Demo/Games/BigGuns.HC | Bin public/{src => Wb}/Demo/Games/BlackDiamond.HC | Bin public/{src => Wb}/Demo/Games/BomberGolf.HC | Bin .../Demo/Games/CastleFrankenstein.HC | 0 public/{src => Wb}/Demo/Games/CharDemo.HC | 0 public/{src => Wb}/Demo/Games/CircleTrace.HC | 0 public/{src => Wb}/Demo/Games/Collision.HC | Bin public/{src => Wb}/Demo/Games/Digits.HC | 0 public/{src => Wb}/Demo/Games/DunGen.HC | 0 public/{src => Wb}/Demo/Games/ElephantWalk.HC | Bin public/{src => Wb}/Demo/Games/FlapBat.HC | Bin public/{src => Wb}/Demo/Games/FlatTops.HC | 0 public/{src => Wb}/Demo/Games/Halogen.HC | 0 public/{src => Wb}/Demo/Games/MassSpring.HC | 0 public/{src => Wb}/Demo/Games/Maze.HC | 0 public/{src => Wb}/Demo/Games/RainDrops.HC | 0 public/{src => Wb}/Demo/Games/RawHide.HC | 0 public/{src => Wb}/Demo/Games/Rocket.HC | Bin .../{src => Wb}/Demo/Games/RocketScience.HC | Bin public/{src => Wb}/Demo/Games/Squirt.HC | Bin .../{src => Wb}/Demo/Games/Stadium/Stadium.HC | Bin .../Demo/Games/Stadium/StadiumBG.DD.HTML | 2 +- .../Demo/Games/Stadium/StadiumGen.HC | 0 public/{src => Wb}/Demo/Games/Talons.HC | 0 public/{src => Wb}/Demo/Games/TheDead.HC | Bin public/{src => Wb}/Demo/Games/TicTacToe.HC | 0 public/{src => Wb}/Demo/Games/TreeCheckers.HC | 0 public/{src => Wb}/Demo/Games/Varoom.HC | 0 public/{src => Wb}/Demo/Games/Wenceslas.HC | 0 public/{src => Wb}/Demo/Games/Whap.HC | 0 public/{src => Wb}/Demo/Games/Zing.HC | Bin public/{src => Wb}/Demo/Games/ZoneOut.HC | Bin public/{src => Wb}/Demo/GlblVars.HC | 0 public/{src => Wb}/Demo/Graphics/3DPoly.HC | 0 public/{src => Wb}/Demo/Graphics/BSpline.HC | 0 public/{src => Wb}/Demo/Graphics/Balloon.HC | 0 public/{src => Wb}/Demo/Graphics/Blot.HC | 0 public/{src => Wb}/Demo/Graphics/Bounce.HC | 0 public/{src => Wb}/Demo/Graphics/Box.HC | 0 public/{src => Wb}/Demo/Graphics/Cartesian.HC | 0 .../Demo/Graphics/CharAnimation.HC | 0 public/{src => Wb}/Demo/Graphics/Collision.HC | Bin .../Demo/Graphics/CommonAncestor.HC | 0 public/{src => Wb}/Demo/Graphics/Doodle.HC | 0 public/{src => Wb}/Demo/Graphics/EdSprite.HC | Bin public/{src => Wb}/Demo/Graphics/Elephant.HC | Bin public/{src => Wb}/Demo/Graphics/Extents.HC | Bin public/{src => Wb}/Demo/Graphics/FontEd.HC | 0 public/{src => Wb}/Demo/Graphics/Grid.HC | 0 public/{src => Wb}/Demo/Graphics/Hanoi.HC | 0 public/{src => Wb}/Demo/Graphics/Lattice.HC | 0 public/{src => Wb}/Demo/Graphics/Life.HC | 0 .../{src => Wb}/Demo/Graphics/LightTable.HC | 0 public/{src => Wb}/Demo/Graphics/Lines.HC | 0 .../Demo/Graphics/LowPassFilter.HC | 0 .../Demo/Graphics/MathAudioDemo.HC | 0 public/{src => Wb}/Demo/Graphics/MouseDemo.HC | 0 public/{src => Wb}/Demo/Graphics/NetOfDots.HC | 0 public/{src => Wb}/Demo/Graphics/Palette.HC | 0 public/{src => Wb}/Demo/Graphics/PanText.HC | 0 public/{src => Wb}/Demo/Graphics/Pick.HC | Bin public/{src => Wb}/Demo/Graphics/Pick3D.HC | Bin public/{src => Wb}/Demo/Graphics/PoleZeros.HC | 0 .../{src => Wb}/Demo/Graphics/PredatorPrey.HC | 0 .../{src => Wb}/Demo/Graphics/RotateTank.HC | Bin .../{src => Wb}/Demo/Graphics/ScrnCapture.HC | 0 .../{src => Wb}/Demo/Graphics/ScrollBars.HC | Bin public/{src => Wb}/Demo/Graphics/Shading.HC | 0 public/{src => Wb}/Demo/Graphics/Shadow.HC | Bin public/{src => Wb}/Demo/Graphics/Slider.HC | 0 public/{src => Wb}/Demo/Graphics/Speedline.HC | 0 .../{src => Wb}/Demo/Graphics/SpritePlot.HC | Bin .../{src => Wb}/Demo/Graphics/SpritePlot3D.HC | Bin public/{src => Wb}/Demo/Graphics/SpritePut.HC | Bin .../{src => Wb}/Demo/Graphics/SpritePutExt.HC | 0 public/{src => Wb}/Demo/Graphics/SpriteRaw.HC | 0 .../{src => Wb}/Demo/Graphics/SpriteText.HC | Bin public/{src => Wb}/Demo/Graphics/SunMoon.HC | 0 public/{src => Wb}/Demo/Graphics/Symmetry.HC | 0 public/{src => Wb}/Demo/Graphics/Transform.HC | Bin .../Demo/Graphics/WallPaperCtrl.HC | 0 .../Demo/Graphics/WallPaperFish.HC | Bin public/{src => Wb}/Demo/Graphics/WinZBuf.HC | 0 public/{src => Wb}/Demo/InFile/InEd.DD.HTML | 2 +- public/{src => Wb}/Demo/InFile/InPopUp.HC | 0 public/{src => Wb}/Demo/InFile/InSetIP.HC | 0 public/{src => Wb}/Demo/KeyBitMap.HC | Bin public/{src => Wb}/Demo/LastClass.HC | 0 .../Demo/Lectures/64BitAsmQuiz.DD.HTML | 8 +- public/{src => Wb}/Demo/Lectures/AndNotMod.HC | 0 .../{src => Wb}/Demo/Lectures/FixedPoint.HC | 0 .../Demo/Lectures/FixedPointAdvanced.HC | 0 .../Demo/Lectures/GraphicsCPULoad.HC | 0 .../Demo/Lectures/InterruptDemo.HC | 0 .../{src => Wb}/Demo/Lectures/MiniCompiler.HC | 0 public/{src => Wb}/Demo/Lectures/MiniGrLib.HC | 0 public/{src => Wb}/Demo/Lectures/NegDisp.HC | 0 .../{src => Wb}/Demo/Lectures/Optimization.HC | 0 .../Demo/Lectures/PCIInterrupts.HC | 0 public/{src => Wb}/Demo/Lectures/Ring3.HC | 0 .../{src => Wb}/Demo/Lectures/ScrnMemory.HC | 0 public/{src => Wb}/Demo/MagicPairs.HC | 0 public/{src => Wb}/Demo/MemDemo.HC | 0 public/{src => Wb}/Demo/MsgLoop.HC | 0 .../{src => Wb}/Demo/MultiCore/Interrupts.HC | 0 public/{src => Wb}/Demo/MultiCore/LoadTest.HC | 0 public/{src => Wb}/Demo/MultiCore/Lock.HC | 0 public/{src => Wb}/Demo/MultiCore/MPAdd.HC | 0 public/{src => Wb}/Demo/MultiCore/MPPrint.HC | 0 public/{src => Wb}/Demo/MultiCore/MPRadix.HC | 0 .../{src => Wb}/Demo/MultiCore/Palindrome.HC | 0 public/{src => Wb}/Demo/MultiCore/Primes.HC | 0 public/{src => Wb}/Demo/NullCase.HC | 0 public/{src => Wb}/Demo/OnceDemo.HC | 0 public/{src => Wb}/Demo/ParenWarn.HC | 0 public/{src => Wb}/Demo/PhoneNumWords.HC | 0 public/{src => Wb}/Demo/Print.HC | 0 public/{src => Wb}/Demo/Progress.HC | 0 public/{src => Wb}/Demo/Prompt.HC | 0 public/{src => Wb}/Demo/PullDownMenu.HC | 0 public/{src => Wb}/Demo/RadixSort.HC | 0 public/{src => Wb}/Demo/RandDemo.HC | 0 public/{src => Wb}/Demo/RegistryDemo.HC | 0 .../Demo/RevFileDemo/DemoPoemBwd.DD.HTML | 2 +- public/{src => Wb}/Demo/RevFileDemo/Rev.HC | 0 public/{src => Wb}/Demo/ScrnCodes.HC | 0 public/{src => Wb}/Demo/Snd/ASCIIOrgan.HC | Bin public/{src => Wb}/Demo/Snd/MorseCode.HC | 0 public/{src => Wb}/Demo/Snd/OhGreat.HC | 0 public/{src => Wb}/Demo/Snd/WaterFowl.HC | Bin .../Demo/SortFileDemo/F64FileGen.HC | 0 .../Demo/SortFileDemo/F64FileSort.HC | 0 public/{src => Wb}/Demo/Spy.HC | 0 public/{src => Wb}/Demo/StkGrow.HC | 0 public/{src => Wb}/Demo/SubIntAccess.HC | 0 public/{src => Wb}/Demo/SubSwitch.HC | 0 public/{src => Wb}/Demo/SuggestSpelling.HC | 0 public/{src => Wb}/Demo/Templates/Game1.HC | 0 public/{src => Wb}/Demo/Templates/Lex1.HC | 0 .../{src => Wb}/Demo/Templates/MultiCore1.HC | 0 public/{src => Wb}/Demo/Templates/ODE1.HC | 0 .../{src => Wb}/Demo/Templates/Registry1.HC | 0 public/{src => Wb}/Demo/Templates/Util1.HC | 0 public/{src => Wb}/Demo/Templates/Util2.HC | 0 public/{src => Wb}/Demo/TimeIns.HC | 0 .../Demo/ToHtmlToTXTDemo/DemoInPage.DD.HTML | 2 +- .../Demo/ToHtmlToTXTDemo/HtmlGen.HC | 0 .../Demo/ToHtmlToTXTDemo/TXTGen.HC | 0 .../Demo/ToHtmlToTXTDemo/ToHtml.HC | 0 .../{src => Wb}/Demo/WebLogDemo/WebLogRep.HC | 0 .../Demo/WebLogDemo/WebLogScramble.HC | 0 public/{src => Wb}/Demo/WordSearch.HC | 0 public/{src => Wb}/Doc/AboutTempleOS.DD.HTML | 4 +- public/{src/Home => Wb}/Doc/Asm.DD.HTML | 10 +- .../{src/Home => Wb}/Doc/AutoComplete.DD.HTML | 10 +- public/{src/Home => Wb}/Doc/Bit.DD.HTML | 2 +- public/{src/Home => Wb}/Doc/BlkChain.DD.HTML | 16 +- public/{src/Home => Wb}/Doc/Boot.DD.HTML | 38 +- .../{src/Home => Wb}/Doc/CharOverview.DD.HTML | 14 +- public/{src/Home => Wb}/Doc/Charter.DD.HTML | 6 +- .../Home => Wb}/Doc/CmdLineOverview.DD.HTML | 16 +- public/{src => Wb}/Doc/Comm.HC | 0 .../{src => Wb}/Doc/CompilerOverview.DD.HTML | 14 +- public/{src => Wb}/Doc/Credits.DD.HTML | 22 +- public/{src/Home => Wb}/Doc/Ctrls.DD.HTML | 6 +- public/{src/Home => Wb}/Doc/Customize.DD.HTML | 8 +- .../{src/Home => Wb}/Doc/CutCorners.DD.HTML | 16 +- public/{src => Wb}/Doc/D3.DD.HTML | 2 +- public/{src => Wb}/Doc/Date.DD.HTML | 2 +- public/{src/Home => Wb}/Doc/DbgFunSeg.DD.HTML | 2 +- public/Wb/Doc/DbgOverview.DD.HTML | 101 + public/{src => Wb}/Doc/Define.DD.HTML | 12 +- public/{src/Home => Wb}/Doc/Demands.DD.HTML | 36 +- public/{src => Wb}/Doc/DemoIndex.DD.HTML | 4 +- .../{src/Home => Wb}/Doc/Directives.DD.HTML | 4 +- public/{src/Home => Wb}/Doc/DolDoc.DD.HTML | 8 +- .../Home => Wb}/Doc/DolDocOverview.DD.HTML | 20 +- .../{src/Home => Wb}/Doc/EdPullDown.DD.HTML | 2 +- public/{src/Home => Wb}/Doc/FAQ.DD.HTML | 2 +- public/{src/Home => Wb}/Doc/Features.DD.HTML | 16 +- .../{src/Home => Wb}/Doc/FileLowLevel.DD.HTML | 4 +- public/{src => Wb}/Doc/FileMgr.DD.HTML | 18 +- .../{src => Wb}/Doc/FileMgrPullDown.DD.HTML | 2 +- public/Wb/Doc/FileUtils.DD.HTML | 59 + public/{src/Home => Wb}/Doc/Frame.DD.HTML | 4 +- public/{src/Home => Wb}/Doc/GRFiles.DD.HTML | 6 +- public/{src/Home => Wb}/Doc/Glossary.DD.HTML | 10 +- public/{src => Wb}/Doc/God.DD.HTML | 4 +- public/Wb/Doc/GraphicsOverview.DD.HTML | 147 ++ public/{src => Wb}/Doc/GuideLines.DD.HTML | 72 +- public/{src/Home => Wb}/Doc/Hash.DD.HTML | 18 +- public/{src/Home => Wb}/Doc/HeapDbg.DD.HTML | 4 +- .../{src/Home => Wb}/Doc/HelloWorld.DD.HTML | 2 +- public/Wb/Doc/HelpIndex.DD.HTML | 123 + public/{src => Wb}/Doc/HelpSystem.DD.HTML | 6 +- public/{src/Home => Wb}/Doc/HolyC.DD.HTML | 72 +- public/{src/Home => Wb}/Doc/InFile.DD.HTML | 16 +- public/{src/Home => Wb}/Doc/Install.DD.HTML | 28 +- public/Wb/Doc/Job.DD.HTML | 70 + public/{src/Home => Wb}/Doc/KeyAlloc.DD.HTML | 16 +- public/{src => Wb}/Doc/KeyDev.DD.HTML | 18 +- public/{src/Home => Wb}/Doc/Lex.DD.HTML | 6 +- .../{src/Home => Wb}/Doc/MemOverview.DD.HTML | 42 +- public/{src/Home => Wb}/Doc/Menus.DD.HTML | 12 +- public/{src/Home => Wb}/Doc/Mouse.DD.HTML | 12 +- public/{src/Home => Wb}/Doc/Msgs.DD.HTML | 4 +- public/{src => Wb}/Doc/MultiCore.DD.HTML | 20 +- public/{src/Home => Wb}/Doc/NewASCII.DD.HTML | 2 +- public/{src/Home => Wb}/Doc/ODE.DD.HTML | 10 +- public/Wb/Doc/Once.DD.HTML | 46 + public/{src/Home => Wb}/Doc/Options.DD.HTML | 20 +- public/{src => Wb}/Doc/Pags.DD.HTML | 6 +- .../{src/Home => Wb}/Doc/PreProcessor.DD.HTML | 10 +- public/{src => Wb}/Doc/Print.DD.HTML | 64 +- public/{src => Wb}/Doc/Profiler.DD.HTML | 8 +- public/{src => Wb}/Doc/Que.DD.HTML | 4 +- public/{src/Home => Wb}/Doc/Quirks.DD.HTML | 24 +- public/{src => Wb}/Doc/RedSea.DD.HTML | 16 +- public/{src => Wb}/Doc/Reliability.DD.HTML | 4 +- .../{src/Home => Wb}/Doc/Requirements.DD.HTML | 2 +- public/{src => Wb}/Doc/Resource.DD.HTML | 6 +- .../Home => Wb}/Doc/ScopingLinkage.DD.HTML | 28 +- public/{src => Wb}/Doc/Snd.DD.HTML | 4 +- public/{src/Home => Wb}/Doc/Sprite.DD.HTML | 10 +- .../{src/Home => Wb}/Doc/SpriteBitMap.DD.HTML | 2 +- public/{src => Wb}/Doc/SpriteEd.DD.HTML | 4 +- public/{src => Wb}/Doc/SpriteEdText.DD.HTML | 4 +- .../{src/Home => Wb}/Doc/SpriteMain.DD.HTML | 2 +- .../Home => Wb}/Doc/SpriteSideBar.DD.HTML | 2 +- public/{src => Wb}/Doc/StandBy.DD.HTML | 6 +- public/{src/Home => Wb}/Doc/Start.DD.HTML | 4 +- public/{src => Wb}/Doc/StdOutTask.DD.HTML | 6 +- .../Home => Wb}/Doc/StdTempleOSPC.DD.HTML | 4 +- public/{src/Home => Wb}/Doc/Strategy.DD.HTML | 14 +- public/{src => Wb}/Doc/Streams.DD.HTML | 12 +- public/{src => Wb}/Doc/TOSZ.DD.HTML | 2 +- public/Wb/Doc/TextBase.DD.HTML | 49 + public/{src => Wb}/Doc/TimeCycles.DD.HTML | 4 +- public/{src/Home => Wb}/Doc/TimeDate.DD.HTML | 8 +- public/{src => Wb}/Doc/TimeHPET.DD.HTML | 6 +- public/{src => Wb}/Doc/TimeJiffy.DD.HTML | 10 +- public/{src/Home => Wb}/Doc/Tips.DD.HTML | 124 +- public/Wb/Doc/Transform.DD.HTML | 55 + public/{src => Wb}/Doc/Welcome.DD.HTML | 142 +- .../{src/Home => Wb}/Doc/WhyNotMore.DD.HTML | 24 +- public/{src => Wb}/Doc/Widget.DD.HTML | 10 +- public/{src => Wb}/Doc/Windows.DD.HTML | 2 +- .../TSheikhs/171207SerialPort.DD.HTML | 2 +- public/{src => Wb}/Home/DoDistro.HC | 0 .../Home/Doc/AboutTempleOS.DD.HTML | 4 +- public/{src => Wb/Home}/Doc/Asm.DD.HTML | 10 +- .../{src => Wb/Home}/Doc/AutoComplete.DD.HTML | 10 +- public/{src => Wb/Home}/Doc/Bit.DD.HTML | 2 +- public/{src => Wb/Home}/Doc/BlkChain.DD.HTML | 16 +- public/{src => Wb/Home}/Doc/Boot.DD.HTML | 38 +- .../{src => Wb/Home}/Doc/CharOverview.DD.HTML | 14 +- public/{src => Wb/Home}/Doc/Charter.DD.HTML | 6 +- .../Home}/Doc/CmdLineOverview.DD.HTML | 16 +- public/{src => Wb}/Home/Doc/Comm.HC | 0 .../Home/Doc/CompilerOverview.DD.HTML | 14 +- public/{src => Wb}/Home/Doc/Credits.DD.HTML | 22 +- public/{src => Wb/Home}/Doc/Ctrls.DD.HTML | 6 +- public/{src => Wb/Home}/Doc/Customize.DD.HTML | 8 +- .../{src => Wb/Home}/Doc/CutCorners.DD.HTML | 16 +- public/{src => Wb}/Home/Doc/D3.DD.HTML | 2 +- public/{src => Wb}/Home/Doc/Date.DD.HTML | 2 +- public/{src => Wb/Home}/Doc/DbgFunSeg.DD.HTML | 2 +- public/Wb/Home/Doc/DbgOverview.DD.HTML | 101 + public/{src => Wb}/Home/Doc/Define.DD.HTML | 12 +- public/{src => Wb/Home}/Doc/Demands.DD.HTML | 36 +- public/{src => Wb}/Home/Doc/DemoIndex.DD.HTML | 4 +- .../{src => Wb/Home}/Doc/Directives.DD.HTML | 4 +- public/{src => Wb/Home}/Doc/DolDoc.DD.HTML | 8 +- .../Home}/Doc/DolDocOverview.DD.HTML | 20 +- .../{src => Wb/Home}/Doc/EdPullDown.DD.HTML | 2 +- public/{src => Wb/Home}/Doc/FAQ.DD.HTML | 2 +- public/{src => Wb/Home}/Doc/Features.DD.HTML | 16 +- .../{src => Wb/Home}/Doc/FileLowLevel.DD.HTML | 4 +- public/{src => Wb}/Home/Doc/FileMgr.DD.HTML | 18 +- .../Home/Doc/FileMgrPullDown.DD.HTML | 2 +- public/Wb/Home/Doc/FileUtils.DD.HTML | 59 + public/{src => Wb/Home}/Doc/Frame.DD.HTML | 4 +- public/{src => Wb/Home}/Doc/GRFiles.DD.HTML | 6 +- public/{src => Wb/Home}/Doc/Glossary.DD.HTML | 10 +- public/{src => Wb}/Home/Doc/God.DD.HTML | 4 +- public/Wb/Home/Doc/GraphicsOverview.DD.HTML | 147 ++ .../{src => Wb}/Home/Doc/GuideLines.DD.HTML | 72 +- public/{src => Wb/Home}/Doc/Hash.DD.HTML | 18 +- public/{src => Wb/Home}/Doc/HeapDbg.DD.HTML | 4 +- .../{src => Wb/Home}/Doc/HelloWorld.DD.HTML | 2 +- public/Wb/Home/Doc/HelpIndex.DD.HTML | 123 + .../{src => Wb}/Home/Doc/HelpSystem.DD.HTML | 6 +- public/{src => Wb/Home}/Doc/HolyC.DD.HTML | 72 +- public/{src => Wb/Home}/Doc/InFile.DD.HTML | 16 +- public/{src => Wb/Home}/Doc/Install.DD.HTML | 28 +- public/Wb/Home/Doc/Job.DD.HTML | 70 + public/{src => Wb/Home}/Doc/KeyAlloc.DD.HTML | 16 +- public/{src => Wb}/Home/Doc/KeyDev.DD.HTML | 18 +- public/{src => Wb/Home}/Doc/Lex.DD.HTML | 6 +- .../{src => Wb/Home}/Doc/MemOverview.DD.HTML | 42 +- public/{src => Wb/Home}/Doc/Menus.DD.HTML | 12 +- public/{src => Wb/Home}/Doc/Mouse.DD.HTML | 12 +- public/{src => Wb/Home}/Doc/Msgs.DD.HTML | 4 +- public/{src => Wb}/Home/Doc/MultiCore.DD.HTML | 20 +- public/{src => Wb/Home}/Doc/NewASCII.DD.HTML | 2 +- public/{src => Wb/Home}/Doc/ODE.DD.HTML | 10 +- public/Wb/Home/Doc/Once.DD.HTML | 46 + public/{src => Wb/Home}/Doc/Options.DD.HTML | 20 +- public/{src => Wb}/Home/Doc/Pags.DD.HTML | 6 +- .../{src => Wb/Home}/Doc/PreProcessor.DD.HTML | 10 +- public/{src => Wb}/Home/Doc/Print.DD.HTML | 64 +- public/{src => Wb}/Home/Doc/Profiler.DD.HTML | 8 +- public/{src => Wb}/Home/Doc/Que.DD.HTML | 4 +- public/{src => Wb/Home}/Doc/Quirks.DD.HTML | 24 +- public/{src => Wb}/Home/Doc/RedSea.DD.HTML | 16 +- .../{src => Wb}/Home/Doc/Reliability.DD.HTML | 4 +- .../{src => Wb/Home}/Doc/Requirements.DD.HTML | 2 +- public/{src => Wb}/Home/Doc/Resource.DD.HTML | 6 +- .../Home}/Doc/ScopingLinkage.DD.HTML | 28 +- public/{src => Wb}/Home/Doc/Snd.DD.HTML | 4 +- public/{src => Wb/Home}/Doc/Sprite.DD.HTML | 10 +- .../{src => Wb/Home}/Doc/SpriteBitMap.DD.HTML | 2 +- public/{src => Wb}/Home/Doc/SpriteEd.DD.HTML | 4 +- .../{src => Wb}/Home/Doc/SpriteEdText.DD.HTML | 4 +- .../{src => Wb/Home}/Doc/SpriteMain.DD.HTML | 2 +- .../Home}/Doc/SpriteSideBar.DD.HTML | 2 +- public/{src => Wb}/Home/Doc/StandBy.DD.HTML | 6 +- public/{src => Wb/Home}/Doc/Start.DD.HTML | 4 +- .../{src => Wb}/Home/Doc/StdOutTask.DD.HTML | 6 +- .../Home}/Doc/StdTempleOSPC.DD.HTML | 4 +- public/{src => Wb/Home}/Doc/Strategy.DD.HTML | 14 +- public/{src => Wb}/Home/Doc/Streams.DD.HTML | 12 +- public/{src => Wb}/Home/Doc/TOSZ.DD.HTML | 2 +- public/Wb/Home/Doc/TextBase.DD.HTML | 49 + .../{src => Wb}/Home/Doc/TimeCycles.DD.HTML | 4 +- public/{src => Wb/Home}/Doc/TimeDate.DD.HTML | 8 +- public/{src => Wb}/Home/Doc/TimeHPET.DD.HTML | 6 +- public/{src => Wb}/Home/Doc/TimeJiffy.DD.HTML | 10 +- public/{src => Wb/Home}/Doc/Tips.DD.HTML | 124 +- public/Wb/Home/Doc/Transform.DD.HTML | 55 + public/{src => Wb}/Home/Doc/Welcome.DD.HTML | 142 +- .../{src => Wb/Home}/Doc/WhyNotMore.DD.HTML | 24 +- public/{src => Wb}/Home/Doc/Widget.DD.HTML | 10 +- public/{src => Wb}/Home/Doc/Windows.DD.HTML | 2 +- public/{src => Wb}/Home/MakeHome.HC | 0 public/{src => Wb}/Home/Registry.HC | 0 public/{src => Wb}/HomeKeyPlugIns.HC | 0 public/{src => Wb}/HomeLocalize.HC | 0 public/{src => Wb}/HomeSys.HC | 0 public/{src => Wb}/HomeWrappers.HC | 0 public/{src => Wb}/Kernel/BlkDev/DskATA.HC | 0 public/{src => Wb}/Kernel/BlkDev/DskATAId.HC | 0 public/{src => Wb}/Kernel/BlkDev/DskAddDev.HC | 0 public/{src => Wb}/Kernel/BlkDev/DskBlk.HC | 0 public/{src => Wb}/Kernel/BlkDev/DskBlkDev.HC | 0 public/{src => Wb}/Kernel/BlkDev/DskCDDVD.HC | 0 public/{src => Wb}/Kernel/BlkDev/DskCFile.HC | 0 public/{src => Wb}/Kernel/BlkDev/DskCache.HC | 0 public/{src => Wb}/Kernel/BlkDev/DskClus.HC | 0 public/{src => Wb}/Kernel/BlkDev/DskCopy.HC | 0 public/{src => Wb}/Kernel/BlkDev/DskDirA.HC | 0 public/{src => Wb}/Kernel/BlkDev/DskDirB.HC | 0 .../Kernel/BlkDev/DskDirContext.HC | 0 public/{src => Wb}/Kernel/BlkDev/DskDrv.HC | 0 public/{src => Wb}/Kernel/BlkDev/DskFile.HC | 0 public/{src => Wb}/Kernel/BlkDev/DskFind.HC | 0 public/{src => Wb}/Kernel/BlkDev/DskFmt.HC | 0 public/{src => Wb}/Kernel/BlkDev/DskStrA.HC | 0 public/{src => Wb}/Kernel/BlkDev/DskStrB.HC | 0 .../{src => Wb}/Kernel/BlkDev/FileSysFAT.HC | 0 .../Kernel/BlkDev/FileSysRedSea.HC | 0 .../{src => Wb}/Kernel/BlkDev/MakeBlkDev.HC | 0 public/{src => Wb}/Kernel/Compress.HC | 0 public/{src => Wb}/Kernel/Display.HC | 0 public/{src => Wb}/Kernel/EdLite.HC | 0 public/{src => Wb}/Kernel/FontCyrillic.HC | 0 public/{src => Wb}/Kernel/FontStd.HC | 0 public/{src => Wb}/Kernel/FunSeg.HC | 0 public/{src => Wb}/Kernel/Job.HC | 0 public/{src => Wb}/Kernel/KCfg.HC | 0 public/{src => Wb}/Kernel/KDataTypes.HC | 0 public/{src => Wb}/Kernel/KDate.HC | 0 public/{src => Wb}/Kernel/KDbg.HC | 0 public/{src => Wb}/Kernel/KDefine.HC | 0 public/{src => Wb}/Kernel/KExcept.HC | 0 public/{src => Wb}/Kernel/KExts.HC | 0 public/{src => Wb}/Kernel/KGlbls.HC | 0 public/{src => Wb}/Kernel/KHashA.HC | 0 public/{src => Wb}/Kernel/KHashB.HC | 0 public/{src => Wb}/Kernel/KInts.HC | 0 public/{src => Wb}/Kernel/KLoad.HC | 0 public/{src => Wb}/Kernel/KMain.HC | 0 public/{src => Wb}/Kernel/KMathA.HC | 0 public/{src => Wb}/Kernel/KMathB.HC | 0 public/{src => Wb}/Kernel/KMisc.HC | 0 public/{src => Wb}/Kernel/KStart16.HC | 0 public/{src => Wb}/Kernel/KStart32.HC | 0 public/{src => Wb}/Kernel/KStart64.HC | 0 public/{src => Wb}/Kernel/KTask.HC | 0 public/{src => Wb}/Kernel/KUtils.HC | 0 public/{src => Wb}/Kernel/KeyDev.HC | 0 public/{src => Wb}/Kernel/Mem/BlkPool.HC | 0 public/{src => Wb}/Kernel/Mem/HeapCtrl.HC | 0 public/{src => Wb}/Kernel/Mem/MAllocFree.HC | 0 public/{src => Wb}/Kernel/Mem/MakeMem.HC | 0 public/{src => Wb}/Kernel/Mem/MemPag.HC | 0 public/{src => Wb}/Kernel/Mem/MemPhysical.HC | 0 public/{src => Wb}/Kernel/Mem/PageTables.HC | 0 public/{src => Wb}/Kernel/MultiProc.HC | 0 public/{src => Wb}/Kernel/PCIBIOS.HC | 0 public/{src => Wb}/Kernel/QSort.HC | 0 public/{src => Wb}/Kernel/Sched.HC | 0 .../{src => Wb}/Kernel/SerialDev/Keyboard.HC | 0 .../Kernel/SerialDev/MakeSerialDev.HC | 0 .../{src => Wb}/Kernel/SerialDev/Message.HC | 0 public/{src => Wb}/Kernel/SerialDev/Mouse.HC | 0 public/{src => Wb}/Kernel/StrA.HC | 0 public/{src => Wb}/Kernel/StrB.HC | 0 public/{src => Wb}/Kernel/StrPrint.HC | 0 public/{src => Wb}/Kernel/StrScan.HC | 0 public/{src => Wb}/MakeHome.HC | 0 public/{src => Wb}/Misc/DoDistro.HC | 0 public/{src => Wb}/Misc/OSInstall.HC | 0 public/{src => Wb}/Misc/OSTestSuite.HC | 0 public/{src => Wb}/Misc/PCIDevices.DD.HTML | 2 +- public/{src => Wb}/Once.HC | 0 public/{src => Wb}/PersonalMenu.DD.HTML | 10 +- public/{src => Wb}/PersonalNotes.DD.HTML | 2 +- public/{src => Wb}/StartOS.HC | 0 public/index.html | 6 +- public/script/templeos.js | 16 +- public/src/Adam/ABlkDev/ADskA.HC.HTML | 264 --- public/src/Adam/ABlkDev/ADskB.HC.HTML | 203 -- public/src/Adam/ABlkDev/DskChk.HC.HTML | 12 - public/src/Adam/ABlkDev/DskPrt.HC.HTML | 179 -- public/src/Adam/ABlkDev/FileMgr.HC.HTML | 803 ------- public/src/Adam/ABlkDev/MakeABlkDev.HC.HTML | 20 - public/src/Adam/ABlkDev/Mount.HC.HTML | 171 -- public/src/Adam/ADbg.HC.HTML | 282 --- public/src/Adam/ADefine.HC.HTML | 50 - public/src/Adam/AExts.HC.HTML | 107 - public/src/Adam/AHash.HC.HTML | 443 ---- public/src/Adam/AMath.HC.HTML | 12 - public/src/Adam/AMathODE.HC.HTML | 700 ------ public/src/Adam/AMem.HC.HTML | 191 -- public/src/Adam/AMouse.HC.HTML | 12 - public/src/Adam/ARegistry.HC.HTML | 215 -- public/src/Adam/ASnd.HC.HTML | 421 ---- .../src/Adam/AutoComplete/ACDictGen.HC.HTML | 12 - public/src/Adam/AutoComplete/ACFill.HC.HTML | 238 -- public/src/Adam/AutoComplete/ACInit.HC.HTML | 181 -- public/src/Adam/AutoComplete/ACTask.HC.HTML | 295 --- public/src/Adam/AutoComplete/MakeAC.HC.HTML | 18 - public/src/Adam/CPURep.HC.HTML | 84 - public/src/Adam/Ctrls/CtrlsA.HC.HTML | 12 - public/src/Adam/Ctrls/CtrlsBttn.HC.HTML | 103 - public/src/Adam/Ctrls/CtrlsSlider.HC.HTML | 226 -- public/src/Adam/Ctrls/MakeCtrls.HC.HTML | 20 - public/src/Adam/DevInfo.HC.HTML | 232 -- public/src/Adam/DolDoc/DocBin.HC.HTML | 154 -- public/src/Adam/DolDoc/DocChar.HC.HTML | 664 ------ public/src/Adam/DolDoc/DocClipBoard.HC.HTML | 137 -- public/src/Adam/DolDoc/DocCodeTools.HC.HTML | 670 ------ public/src/Adam/DolDoc/DocDblBuf.HC.HTML | 122 - public/src/Adam/DolDoc/DocEd.HC.HTML | 12 - public/src/Adam/DolDoc/DocExt.HC.HTML | 26 - public/src/Adam/DolDoc/DocFile.HC.HTML | 369 --- public/src/Adam/DolDoc/DocFind.HC.HTML | 596 ----- public/src/Adam/DolDoc/DocForm.HC.HTML | 356 --- public/src/Adam/DolDoc/DocGet.HC.HTML | 255 -- public/src/Adam/DolDoc/DocGr.HC.HTML | 12 - public/src/Adam/DolDoc/DocHighlight.HC.HTML | 172 -- public/src/Adam/DolDoc/DocInit.HC.HTML | 124 - public/src/Adam/DolDoc/DocLink.HC.HTML | 370 --- public/src/Adam/DolDoc/DocMacro.HC.HTML | 223 -- public/src/Adam/DolDoc/DocNew.HC.HTML | 397 ---- public/src/Adam/DolDoc/DocPlain.HC.HTML | 623 ----- public/src/Adam/DolDoc/DocPopUp.HC.HTML | 329 --- public/src/Adam/DolDoc/DocPutKey.HC.HTML | 741 ------ public/src/Adam/DolDoc/DocPutS.HC.HTML | 348 --- public/src/Adam/DolDoc/DocRecalc.HC.HTML | 1336 ----------- public/src/Adam/DolDoc/DocRecalcLib.HC.HTML | 225 -- public/src/Adam/DolDoc/DocRun.HC.HTML | 115 - public/src/Adam/DolDoc/DocTerm.HC.HTML | 225 -- public/src/Adam/DolDoc/DocTree.HC.HTML | 255 -- public/src/Adam/DolDoc/DocWidgetWiz.HC.HTML | 1175 ---------- public/src/Adam/DolDoc/MakeDoc.HC.HTML | 81 - public/src/Adam/God/GodBible.HC.HTML | 360 --- public/src/Adam/God/GodDoodle.HC.HTML | 204 -- public/src/Adam/God/GodExt.HC.HTML | 38 - public/src/Adam/God/GodSong.HC.HTML | 183 -- public/src/Adam/God/HolySpirit.HC.HTML | 171 -- public/src/Adam/God/MakeGod.HC.HTML | 21 - public/src/Adam/Gr/GrAsm.HC.HTML | 422 ---- public/src/Adam/Gr/GrBitMap.HC.HTML | 2066 ----------------- public/src/Adam/Gr/GrComposites.HC.HTML | 356 --- public/src/Adam/Gr/GrDC.HC.HTML | 446 ---- public/src/Adam/Gr/GrEnd.HC.HTML | 41 - public/src/Adam/Gr/GrExt.HC.HTML | 20 - public/src/Adam/Gr/GrGlbls.HC.HTML | 67 - public/src/Adam/Gr/GrInitA.HC.HTML | 33 - public/src/Adam/Gr/GrInitB.HC.HTML | 221 -- public/src/Adam/Gr/GrMath.HC.HTML | 12 - public/src/Adam/Gr/GrPalette.HC.HTML | 105 - public/src/Adam/Gr/GrPrimatives.HC.HTML | 12 - public/src/Adam/Gr/GrScrn.HC.HTML | 435 ---- public/src/Adam/Gr/GrSpritePlot.HC.HTML | 12 - public/src/Adam/Gr/GrTextBase.HC.HTML | 375 --- public/src/Adam/Gr/MakeGr.HC.HTML | 45 - public/src/Adam/Gr/ScrnCast.HC.HTML | 108 - public/src/Adam/Gr/SpriteBitMap.HC.HTML | 682 ------ public/src/Adam/Gr/SpriteCode.HC.HTML | 12 - public/src/Adam/Gr/SpriteEd.HC.HTML | 12 - public/src/Adam/Gr/SpriteMain.HC.HTML | 12 - public/src/Adam/Gr/SpriteMesh.HC.HTML | 12 - public/src/Adam/Gr/SpriteNew.HC.HTML | 201 -- public/src/Adam/Gr/SpriteSideBar.HC.HTML | 107 - public/src/Adam/Host.HC.HTML | 82 - public/src/Adam/InFile.HC.HTML | 152 -- public/src/Adam/InsReg.HC.HTML | 76 - public/src/Adam/MakeAdam.HC.HTML | 44 - public/src/Adam/Menu.HC.HTML | 255 -- public/src/Adam/Opt/Boot/BootDVD.HC.HTML | 200 -- public/src/Adam/Opt/Boot/BootDVDIns.HC.HTML | 44 - public/src/Adam/Opt/Boot/BootHD.HC.HTML | 105 - public/src/Adam/Opt/Boot/BootHDIns.HC.HTML | 72 - public/src/Adam/Opt/Boot/BootMHD.HC.HTML | 119 - public/src/Adam/Opt/Boot/BootMHD2.HC.HTML | 135 -- public/src/Adam/Opt/Boot/BootMHDIns.HC.HTML | 164 -- public/src/Adam/Opt/Boot/BootRAM.HC.HTML | 72 - public/src/Adam/Opt/Boot/DskISORedSea.HC.HTML | 200 -- public/src/Adam/Opt/Boot/MakeBoot.HC.HTML | 18 - public/src/Adam/Opt/Utils/Diff.HC.HTML | 365 --- public/src/Adam/Opt/Utils/DocUtils.HC.HTML | 168 -- public/src/Adam/Opt/Utils/Find.HC.HTML | 269 --- public/src/Adam/Opt/Utils/HeapLog.HC.HTML | 223 -- public/src/Adam/Opt/Utils/LineRep.HC.HTML | 121 - public/src/Adam/Opt/Utils/LinkChk.HC.HTML | 91 - public/src/Adam/Opt/Utils/MakeUtils.HC.HTML | 27 - public/src/Adam/Opt/Utils/MemRep.HC.HTML | 243 -- public/src/Adam/Opt/Utils/Merge.HC.HTML | 89 - public/src/Adam/Opt/Utils/Profiler.HC.HTML | 114 - public/src/Adam/Opt/Utils/StrUtils.HC.HTML | 218 -- public/src/Adam/Opt/Utils/TOS.HC.HTML | 88 - public/src/Adam/Opt/Utils/ToDolDoc.HC.HTML | 31 - public/src/Adam/Opt/Utils/ToTXT.HC.HTML | 12 - public/src/Adam/TaskRep.HC.HTML | 42 - public/src/Adam/TaskSettings.HC.HTML | 132 -- public/src/Adam/Training.HC.HTML | 196 -- public/src/Adam/WallPaper.HC.HTML | Bin 6142 -> 0 bytes public/src/Adam/Win.HC.HTML | 554 ----- public/src/Adam/WinMgr.HC.HTML | 875 ------- public/src/Apps/Budget/BgtAccts.HC.HTML | 95 - public/src/Apps/Budget/BgtEntry.HC.HTML | 95 - public/src/Apps/Budget/BgtFile.HC.HTML | 152 -- public/src/Apps/Budget/BgtMain.HC.HTML | 242 -- public/src/Apps/Budget/BgtStrs.HC.HTML | 144 -- public/src/Apps/Budget/BgtTemplate.HC.HTML | 194 -- public/src/Apps/Budget/Budget.HC.HTML | 89 - public/src/Apps/Budget/Install.HC.HTML | 17 - public/src/Apps/Budget/Load.HC.HTML | 24 - public/src/Apps/Budget/Run.HC.HTML | 16 - public/src/Apps/GrModels/BallGen.HC.HTML | 12 - public/src/Apps/GrModels/Load.HC.HTML | 20 - public/src/Apps/GrModels/ManGen.HC.HTML | 12 - public/src/Apps/GrModels/Models.HC.HTML | 37 - public/src/Apps/GrModels/Run.HC.HTML | 14 - public/src/Apps/KeepAway/KeepAway.HC.HTML | 12 - public/src/Apps/KeepAway/Load.HC.HTML | 18 - public/src/Apps/KeepAway/Run.HC.HTML | 14 - public/src/Apps/Logic/Load.HC.HTML | 18 - public/src/Apps/Logic/Logic.HC.HTML | 12 - public/src/Apps/Logic/Run.HC.HTML | 14 - .../Apps/Psalmody/Examples/childish.HC.HTML | 36 - .../src/Apps/Psalmody/Examples/night.HC.HTML | 12 - .../Apps/Psalmody/Examples/prosper.HC.HTML | 12 - public/src/Apps/Psalmody/Install.HC.HTML | 14 - public/src/Apps/Psalmody/JukeBox.HC.HTML | 212 -- public/src/Apps/Psalmody/JukePuppet.HC.HTML | 107 - public/src/Apps/Psalmody/Load.HC.HTML | 24 - public/src/Apps/Psalmody/Psalmody.HC.HTML | 75 - .../src/Apps/Psalmody/PsalmodyCtrls.HC.HTML | 101 - public/src/Apps/Psalmody/PsalmodyDraw.HC.HTML | 12 - public/src/Apps/Psalmody/PsalmodyFile.HC.HTML | 439 ---- public/src/Apps/Psalmody/PsalmodyMain.HC.HTML | 810 ------- public/src/Apps/Psalmody/Run.HC.HTML | 15 - public/src/Apps/Span/Install.HC.HTML | 13 - public/src/Apps/Span/Load.HC.HTML | 22 - public/src/Apps/Span/Run.HC.HTML | 15 - public/src/Apps/Span/SpanBridge.HC.HTML | 12 - public/src/Apps/Span/SpanDerive.HC.HTML | 59 - public/src/Apps/Span/SpanMain.HC.HTML | 480 ---- public/src/Apps/Span/SpanNew.HC.HTML | 138 -- public/src/Apps/Strut/Load.HC.HTML | 18 - public/src/Apps/Strut/Run.HC.HTML | 15 - public/src/Apps/Strut/Strut.HC.HTML | 12 - public/src/Apps/TimeClock/Install.HC.HTML | 20 - public/src/Apps/TimeClock/Load.HC.HTML | 19 - public/src/Apps/TimeClock/TimeClk.HC.HTML | 163 -- public/src/Apps/Titanium/Load.HC.HTML | 18 - public/src/Apps/Titanium/Run.HC.HTML | 14 - public/src/Apps/Titanium/Titanium.HC.HTML | 12 - public/src/Apps/ToTheFront/AIs/Human.HC.HTML | 178 -- .../src/Apps/ToTheFront/AIs/SimpleAI.HC.HTML | 91 - public/src/Apps/ToTheFront/Install.HC.HTML | 14 - public/src/Apps/ToTheFront/Load.HC.HTML | 25 - public/src/Apps/ToTheFront/Run.HC.HTML | 14 - public/src/Apps/ToTheFront/TTFDraw.HC.HTML | 12 - public/src/Apps/ToTheFront/TTFFire.HC.HTML | 12 - public/src/Apps/ToTheFront/TTFGlbls.HC.HTML | 12 - public/src/Apps/ToTheFront/TTFInit.HC.HTML | 12 - public/src/Apps/ToTheFront/TTFLib.HC.HTML | 133 -- public/src/Apps/ToTheFront/TTFMove.HC.HTML | 12 - public/src/Apps/ToTheFront/TTFVis.HC.HTML | 235 -- public/src/Apps/ToTheFront/ToTheFront.HC.HTML | 226 -- public/src/Apps/Vocabulary/Load.HC.HTML | 18 - public/src/Apps/Vocabulary/Run.HC.HTML | 14 - public/src/Apps/Vocabulary/VocabQuiz.HC.HTML | 69 - public/src/Apps/X-Caliber/Load.HC.HTML | 19 - public/src/Apps/X-Caliber/Run.HC.HTML | 14 - public/src/Apps/X-Caliber/X-Caliber.HC.HTML | 12 - public/src/Apps/X-Caliber/XCCtrls.HC.HTML | 166 -- public/src/Compiler/Asm.HC.HTML | 1126 --------- public/src/Compiler/AsmInit.HC.HTML | 221 -- public/src/Compiler/AsmLib.HC.HTML | 187 -- public/src/Compiler/AsmResolve.HC.HTML | 229 -- public/src/Compiler/BackA.HC.HTML | 670 ------ public/src/Compiler/BackB.HC.HTML | 731 ------ public/src/Compiler/BackC.HC.HTML | 783 ------- public/src/Compiler/BackFA.HC.HTML | 619 ----- public/src/Compiler/BackFB.HC.HTML | 643 ----- public/src/Compiler/BackLib.HC.HTML | 12 - public/src/Compiler/CExcept.HC.HTML | 265 --- public/src/Compiler/CExts.HC.HTML | 58 - public/src/Compiler/CHash.HC.HTML | 153 -- public/src/Compiler/CInit.HC.HTML | 342 --- public/src/Compiler/CMain.HC.HTML | 714 ------ public/src/Compiler/CMisc.HC.HTML | 181 -- public/src/Compiler/Lex.HC.HTML | 1207 ---------- public/src/Compiler/LexLib.HC.HTML | 287 --- public/src/Compiler/OptLib.HC.HTML | 577 ----- public/src/Compiler/OptPass012.HC.HTML | 1300 ----------- public/src/Compiler/OptPass3.HC.HTML | 634 ----- public/src/Compiler/OptPass4.HC.HTML | 701 ------ public/src/Compiler/OptPass5.HC.HTML | 102 - public/src/Compiler/OptPass6.HC.HTML | 197 -- public/src/Compiler/OptPass789A.HC.HTML | 1164 ---------- public/src/Compiler/PrsExp.HC.HTML | 1190 ---------- public/src/Compiler/PrsLib.HC.HTML | 335 --- public/src/Compiler/PrsStmt.HC.HTML | 1234 ---------- public/src/Compiler/PrsVar.HC.HTML | 733 ------ public/src/Compiler/Templates.HC.HTML | 524 ----- public/src/Compiler/UAsm.HC.HTML | 694 ------ .../Demo/AcctExample/HomeKeyPlugIns.HC.HTML | 12 - .../src/Demo/AcctExample/HomeLocalize.HC.HTML | 33 - public/src/Demo/AcctExample/HomeSys.HC.HTML | 59 - .../src/Demo/AcctExample/HomeWrappers.HC.HTML | 47 - public/src/Demo/AcctExample/MakeHome.HC.HTML | 28 - public/src/Demo/AcctExample/Once.HC.HTML | 51 - public/src/Demo/AcctExample/Registry.HC.HTML | 93 - .../src/Demo/AcctExample/TOS/MakeTOS.HC.HTML | 20 - .../src/Demo/AcctExample/TOS/TOSCfg.HC.HTML | 73 - .../Demo/AcctExample/TOS/TOSDistro.HC.HTML | 399 ---- .../src/Demo/AcctExample/TOS/TOSExt.HC.HTML | 322 --- .../src/Demo/AcctExample/TOS/TOSMisc.HC.HTML | 175 -- .../src/Demo/AcctExample/TOS/TOSTheme.HC.HTML | 12 - public/src/Demo/Asm/AsmAndC1.HC.HTML | 87 - public/src/Demo/Asm/AsmAndC2.HC.HTML | 97 - public/src/Demo/Asm/AsmAndC3.HC.HTML | 35 - public/src/Demo/Asm/AsmHelloWorld.HC.HTML | 62 - public/src/Demo/Asm/BuzzFizz.HC.HTML | 196 -- public/src/Demo/Asm/DivByHand.HC.HTML | 33 - public/src/Demo/Asm/MulByHand.HC.HTML | 81 - public/src/Demo/Asm/PutDec.HC.HTML | 61 - public/src/Demo/Carry.HC.HTML | 57 - public/src/Demo/ClassMeta.HC.HTML | 92 - public/src/Demo/CompileDemo.HC.HTML | 12 - public/src/Demo/DateTime.HC.HTML | 23 - public/src/Demo/DbgDemo.HC.HTML | 38 - public/src/Demo/Define.HC.HTML | 48 - public/src/Demo/Directives.HC.HTML | 25 - public/src/Demo/DolDoc/CallBack.HC.HTML | 76 - public/src/Demo/DolDoc/ClickCallBack.HC.HTML | 59 - public/src/Demo/DolDoc/CursorMove.HC.HTML | 50 - public/src/Demo/DolDoc/Data.HC.HTML | 75 - public/src/Demo/DolDoc/DefineStr.HC.HTML | 34 - public/src/Demo/DolDoc/FileRead.HC.HTML | 92 - public/src/Demo/DolDoc/Form.HC.HTML | 63 - public/src/Demo/DolDoc/MenuBttn.HC.HTML | 87 - public/src/Demo/DolDoc/MenuSprite.HC.HTML | 12 - public/src/Demo/DolDoc/NumBible.HC.HTML | 40 - public/src/Demo/DolDoc/TextDemo.HC.HTML | 34 - public/src/Demo/DolDoc/TreeDemo.HC.HTML | 51 - public/src/Demo/DolDoc/UnusedDefine.HC.HTML | 94 - public/src/Demo/Dsk/BlkDevRep.HC.HTML | 25 - public/src/Demo/Dsk/DataBase.HC.HTML | 76 - public/src/Demo/Dsk/DskRaw.HC.HTML | 53 - public/src/Demo/Dsk/FPrintF.HC.HTML | 61 - public/src/Demo/Dsk/SerializeTree.HC.HTML | 47 - public/src/Demo/Dsk/UnusedSpaceRep.HC.HTML | 24 - public/src/Demo/Exceptions.HC.HTML | 59 - public/src/Demo/ExtChars.HC.HTML | 12 - public/src/Demo/Games/BattleLines.HC.HTML | 12 - public/src/Demo/Games/BigGuns.HC.HTML | 12 - public/src/Demo/Games/BlackDiamond.HC.HTML | 12 - public/src/Demo/Games/BomberGolf.HC.HTML | 12 - .../src/Demo/Games/CastleFrankenstein.HC.HTML | 12 - public/src/Demo/Games/CharDemo.HC.HTML | 12 - public/src/Demo/Games/CircleTrace.HC.HTML | 12 - public/src/Demo/Games/Collision.HC.HTML | 12 - public/src/Demo/Games/Digits.HC.HTML | 92 - public/src/Demo/Games/DunGen.HC.HTML | 12 - public/src/Demo/Games/ElephantWalk.HC.HTML | 12 - public/src/Demo/Games/FlapBat.HC.HTML | 12 - public/src/Demo/Games/FlatTops.HC.HTML | 12 - public/src/Demo/Games/Halogen.HC.HTML | 174 -- public/src/Demo/Games/MassSpring.HC.HTML | 181 -- public/src/Demo/Games/Maze.HC.HTML | 124 - public/src/Demo/Games/RainDrops.HC.HTML | 201 -- public/src/Demo/Games/RawHide.HC.HTML | 12 - public/src/Demo/Games/Rocket.HC.HTML | 12 - public/src/Demo/Games/RocketScience.HC.HTML | 12 - public/src/Demo/Games/Squirt.HC.HTML | 12 - public/src/Demo/Games/Stadium/Stadium.HC.HTML | 12 - .../src/Demo/Games/Stadium/StadiumGen.HC.HTML | 45 - public/src/Demo/Games/Talons.HC.HTML | 12 - public/src/Demo/Games/TheDead.HC.HTML | 12 - public/src/Demo/Games/TicTacToe.HC.HTML | 137 -- public/src/Demo/Games/TreeCheckers.HC.HTML | 369 --- public/src/Demo/Games/Varoom.HC.HTML | 12 - public/src/Demo/Games/Wenceslas.HC.HTML | 12 - public/src/Demo/Games/Whap.HC.HTML | 185 -- public/src/Demo/Games/Zing.HC.HTML | 12 - public/src/Demo/Games/ZoneOut.HC.HTML | 12 - public/src/Demo/GlblVars.HC.HTML | 88 - public/src/Demo/Graphics/3DPoly.HC.HTML | 12 - public/src/Demo/Graphics/BSpline.HC.HTML | 47 - public/src/Demo/Graphics/Balloon.HC.HTML | 50 - public/src/Demo/Graphics/Blot.HC.HTML | 53 - public/src/Demo/Graphics/Bounce.HC.HTML | 12 - public/src/Demo/Graphics/Box.HC.HTML | 12 - public/src/Demo/Graphics/Cartesian.HC.HTML | 60 - .../src/Demo/Graphics/CharAnimation.HC.HTML | 42 - public/src/Demo/Graphics/Collision.HC.HTML | 12 - .../src/Demo/Graphics/CommonAncestor.HC.HTML | 132 -- public/src/Demo/Graphics/Doodle.HC.HTML | 59 - public/src/Demo/Graphics/EdSprite.HC.HTML | 12 - public/src/Demo/Graphics/Elephant.HC.HTML | 12 - public/src/Demo/Graphics/Extents.HC.HTML | 12 - public/src/Demo/Graphics/FontEd.HC.HTML | 164 -- public/src/Demo/Graphics/Grid.HC.HTML | 42 - public/src/Demo/Graphics/Hanoi.HC.HTML | 166 -- public/src/Demo/Graphics/Lattice.HC.HTML | 12 - public/src/Demo/Graphics/Life.HC.HTML | 110 - public/src/Demo/Graphics/LightTable.HC.HTML | 12 - public/src/Demo/Graphics/Lines.HC.HTML | 38 - .../src/Demo/Graphics/LowPassFilter.HC.HTML | 95 - .../src/Demo/Graphics/MathAudioDemo.HC.HTML | 12 - public/src/Demo/Graphics/MouseDemo.HC.HTML | 23 - public/src/Demo/Graphics/NetOfDots.HC.HTML | 28 - public/src/Demo/Graphics/Palette.HC.HTML | 39 - public/src/Demo/Graphics/PanText.HC.HTML | 47 - public/src/Demo/Graphics/Pick.HC.HTML | 12 - public/src/Demo/Graphics/Pick3D.HC.HTML | 12 - public/src/Demo/Graphics/PoleZeros.HC.HTML | 12 - public/src/Demo/Graphics/PredatorPrey.HC.HTML | 93 - public/src/Demo/Graphics/RotateTank.HC.HTML | 12 - public/src/Demo/Graphics/ScrnCapture.HC.HTML | 27 - public/src/Demo/Graphics/ScrollBars.HC.HTML | 12 - public/src/Demo/Graphics/Shading.HC.HTML | 12 - public/src/Demo/Graphics/Shadow.HC.HTML | 12 - public/src/Demo/Graphics/Slider.HC.HTML | 122 - public/src/Demo/Graphics/Speedline.HC.HTML | 62 - public/src/Demo/Graphics/SpritePlot.HC.HTML | 12 - public/src/Demo/Graphics/SpritePlot3D.HC.HTML | 12 - public/src/Demo/Graphics/SpritePut.HC.HTML | 12 - public/src/Demo/Graphics/SpritePutExt.HC.HTML | 38 - public/src/Demo/Graphics/SpriteRaw.HC.HTML | 50 - public/src/Demo/Graphics/SpriteText.HC.HTML | 12 - public/src/Demo/Graphics/SunMoon.HC.HTML | 12 - public/src/Demo/Graphics/Symmetry.HC.HTML | 74 - public/src/Demo/Graphics/Transform.HC.HTML | 12 - .../src/Demo/Graphics/WallPaperCtrl.HC.HTML | 120 - .../src/Demo/Graphics/WallPaperFish.HC.HTML | 12 - public/src/Demo/Graphics/WinZBuf.HC.HTML | 35 - public/src/Demo/InFile/InPopUp.HC.HTML | 24 - public/src/Demo/InFile/InSetIP.HC.HTML | 25 - public/src/Demo/KeyBitMap.HC.HTML | 12 - public/src/Demo/LastClass.HC.HTML | 45 - public/src/Demo/Lectures/AndNotMod.HC.HTML | 56 - public/src/Demo/Lectures/FixedPoint.HC.HTML | 108 - .../Demo/Lectures/FixedPointAdvanced.HC.HTML | 185 -- .../src/Demo/Lectures/GraphicsCPULoad.HC.HTML | 46 - .../src/Demo/Lectures/InterruptDemo.HC.HTML | 12 - public/src/Demo/Lectures/MiniCompiler.HC.HTML | 248 -- public/src/Demo/Lectures/MiniGrLib.HC.HTML | 12 - public/src/Demo/Lectures/NegDisp.HC.HTML | 68 - public/src/Demo/Lectures/Optimization.HC.HTML | 120 - .../src/Demo/Lectures/PCIInterrupts.HC.HTML | 85 - public/src/Demo/Lectures/Ring3.HC.HTML | 87 - public/src/Demo/Lectures/ScrnMemory.HC.HTML | 61 - public/src/Demo/MagicPairs.HC.HTML | 387 --- public/src/Demo/MemDemo.HC.HTML | 76 - public/src/Demo/MsgLoop.HC.HTML | 35 - public/src/Demo/MultiCore/Interrupts.HC.HTML | 35 - public/src/Demo/MultiCore/LoadTest.HC.HTML | 60 - public/src/Demo/MultiCore/Lock.HC.HTML | 64 - public/src/Demo/MultiCore/MPAdd.HC.HTML | 97 - public/src/Demo/MultiCore/MPPrint.HC.HTML | 29 - public/src/Demo/MultiCore/MPRadix.HC.HTML | 154 -- public/src/Demo/MultiCore/Palindrome.HC.HTML | 108 - public/src/Demo/MultiCore/Primes.HC.HTML | 87 - public/src/Demo/NullCase.HC.HTML | 31 - public/src/Demo/OnceDemo.HC.HTML | 24 - public/src/Demo/ParenWarn.HC.HTML | 29 - public/src/Demo/PhoneNumWords.HC.HTML | 75 - public/src/Demo/Print.HC.HTML | 45 - public/src/Demo/Progress.HC.HTML | 92 - public/src/Demo/Prompt.HC.HTML | 37 - public/src/Demo/PullDownMenu.HC.HTML | 101 - public/src/Demo/RadixSort.HC.HTML | 74 - public/src/Demo/RandDemo.HC.HTML | 76 - public/src/Demo/RegistryDemo.HC.HTML | 39 - public/src/Demo/RevFileDemo/Rev.HC.HTML | 34 - public/src/Demo/ScrnCodes.HC.HTML | 39 - public/src/Demo/Snd/ASCIIOrgan.HC.HTML | 12 - public/src/Demo/Snd/MorseCode.HC.HTML | 188 -- public/src/Demo/Snd/OhGreat.HC.HTML | 53 - public/src/Demo/Snd/WaterFowl.HC.HTML | 12 - .../src/Demo/SortFileDemo/F64FileGen.HC.HTML | 38 - .../src/Demo/SortFileDemo/F64FileSort.HC.HTML | 84 - public/src/Demo/Spy.HC.HTML | 74 - public/src/Demo/StkGrow.HC.HTML | 65 - public/src/Demo/SubIntAccess.HC.HTML | 41 - public/src/Demo/SubSwitch.HC.HTML | 33 - public/src/Demo/SuggestSpelling.HC.HTML | 104 - public/src/Demo/Templates/Game1.HC.HTML | 102 - public/src/Demo/Templates/Lex1.HC.HTML | 28 - public/src/Demo/Templates/MultiCore1.HC.HTML | 41 - public/src/Demo/Templates/ODE1.HC.HTML | 55 - public/src/Demo/Templates/Registry1.HC.HTML | 22 - public/src/Demo/Templates/Util1.HC.HTML | 26 - public/src/Demo/Templates/Util2.HC.HTML | 66 - public/src/Demo/TimeIns.HC.HTML | 47 - .../src/Demo/ToHtmlToTXTDemo/HtmlGen.HC.HTML | 32 - .../src/Demo/ToHtmlToTXTDemo/TXTGen.HC.HTML | 20 - .../src/Demo/ToHtmlToTXTDemo/ToHtml.HC.HTML | 12 - public/src/Demo/WebLogDemo/WebLogRep.HC.HTML | 540 ----- .../Demo/WebLogDemo/WebLogScramble.HC.HTML | 81 - public/src/Demo/WordSearch.HC.HTML | 165 -- public/src/Doc/Comm.HC.HTML | 144 -- public/src/Doc/DbgOverview.DD.HTML | 101 - public/src/Doc/FileUtils.DD.HTML | 59 - public/src/Doc/GraphicsOverview.DD.HTML | 147 -- public/src/Doc/HelpIndex.DD.HTML | 123 - public/src/Doc/Job.DD.HTML | 70 - public/src/Doc/Once.DD.HTML | 46 - public/src/Doc/TextBase.DD.HTML | 49 - public/src/Doc/Transform.DD.HTML | 55 - public/src/Home/DoDistro.HC.HTML | 61 - public/src/Home/Doc/DbgOverview.DD.HTML | 101 - public/src/Home/Doc/FileUtils.DD.HTML | 59 - public/src/Home/Doc/GraphicsOverview.DD.HTML | 147 -- public/src/Home/Doc/HelpIndex.DD.HTML | 123 - public/src/Home/Doc/Job.DD.HTML | 70 - public/src/Home/Doc/Once.DD.HTML | 46 - public/src/Home/Doc/TextBase.DD.HTML | 49 - public/src/Home/Doc/Transform.DD.HTML | 55 - public/src/Home/MakeHome.HC.HTML | 25 - public/src/Home/Registry.HC.HTML | 38 - public/src/HomeKeyPlugIns.HC.HTML | 12 - public/src/HomeLocalize.HC.HTML | 31 - public/src/HomeSys.HC.HTML | 50 - public/src/HomeWrappers.HC.HTML | 38 - public/src/Kernel/BlkDev/DskATA.HC.HTML | 623 ----- public/src/Kernel/BlkDev/DskATAId.HC.HTML | 305 --- public/src/Kernel/BlkDev/DskAddDev.HC.HTML | 252 -- public/src/Kernel/BlkDev/DskBlk.HC.HTML | 121 - public/src/Kernel/BlkDev/DskBlkDev.HC.HTML | 199 -- public/src/Kernel/BlkDev/DskCDDVD.HC.HTML | 255 -- public/src/Kernel/BlkDev/DskCFile.HC.HTML | 277 --- public/src/Kernel/BlkDev/DskCache.HC.HTML | 157 -- public/src/Kernel/BlkDev/DskClus.HC.HTML | 157 -- public/src/Kernel/BlkDev/DskCopy.HC.HTML | 115 - public/src/Kernel/BlkDev/DskDirA.HC.HTML | 223 -- public/src/Kernel/BlkDev/DskDirB.HC.HTML | 206 -- .../src/Kernel/BlkDev/DskDirContext.HC.HTML | 99 - public/src/Kernel/BlkDev/DskDrv.HC.HTML | 378 --- public/src/Kernel/BlkDev/DskFile.HC.HTML | 130 -- public/src/Kernel/BlkDev/DskFind.HC.HTML | 163 -- public/src/Kernel/BlkDev/DskFmt.HC.HTML | 104 - public/src/Kernel/BlkDev/DskStrA.HC.HTML | 355 --- public/src/Kernel/BlkDev/DskStrB.HC.HTML | 101 - public/src/Kernel/BlkDev/FileSysFAT.HC.HTML | 971 -------- .../src/Kernel/BlkDev/FileSysRedSea.HC.HTML | 647 ------ public/src/Kernel/BlkDev/MakeBlkDev.HC.HTML | 35 - public/src/Kernel/Compress.HC.HTML | 320 --- public/src/Kernel/Display.HC.HTML | 133 -- public/src/Kernel/EdLite.HC.HTML | 367 --- public/src/Kernel/FontCyrillic.HC.HTML | 12 - public/src/Kernel/FontStd.HC.HTML | 12 - public/src/Kernel/FunSeg.HC.HTML | 372 --- public/src/Kernel/Job.HC.HTML | 514 ---- public/src/Kernel/KCfg.HC.HTML | 185 -- public/src/Kernel/KDataTypes.HC.HTML | 335 --- public/src/Kernel/KDate.HC.HTML | 208 -- public/src/Kernel/KDbg.HC.HTML | 12 - public/src/Kernel/KDefine.HC.HTML | 230 -- public/src/Kernel/KExcept.HC.HTML | 161 -- public/src/Kernel/KExts.HC.HTML | 121 - public/src/Kernel/KGlbls.HC.HTML | 47 - public/src/Kernel/KHashA.HC.HTML | 277 --- public/src/Kernel/KHashB.HC.HTML | 262 --- public/src/Kernel/KInts.HC.HTML | 227 -- public/src/Kernel/KLoad.HC.HTML | 262 --- public/src/Kernel/KMain.HC.HTML | 12 - public/src/Kernel/KMathA.HC.HTML | 660 ------ public/src/Kernel/KMathB.HC.HTML | 12 - public/src/Kernel/KMisc.HC.HTML | 12 - public/src/Kernel/KStart16.HC.HTML | 218 -- public/src/Kernel/KStart32.HC.HTML | 129 - public/src/Kernel/KStart64.HC.HTML | 112 - public/src/Kernel/KTask.HC.HTML | 557 ----- public/src/Kernel/KUtils.HC.HTML | 483 ---- public/src/Kernel/KeyDev.HC.HTML | 231 -- public/src/Kernel/Mem/BlkPool.HC.HTML | 85 - public/src/Kernel/Mem/HeapCtrl.HC.HTML | 45 - public/src/Kernel/Mem/MAllocFree.HC.HTML | 476 ---- public/src/Kernel/Mem/MakeMem.HC.HTML | 20 - public/src/Kernel/Mem/MemPag.HC.HTML | 179 -- public/src/Kernel/Mem/MemPhysical.HC.HTML | 193 -- public/src/Kernel/Mem/PageTables.HC.HTML | 217 -- public/src/Kernel/MultiProc.HC.HTML | 401 ---- public/src/Kernel/PCIBIOS.HC.HTML | 301 --- public/src/Kernel/QSort.HC.HTML | 116 - public/src/Kernel/Sched.HC.HTML | 337 --- public/src/Kernel/SerialDev/Keyboard.HC.HTML | 504 ---- .../Kernel/SerialDev/MakeSerialDev.HC.HTML | 17 - public/src/Kernel/SerialDev/Message.HC.HTML | 12 - public/src/Kernel/SerialDev/Mouse.HC.HTML | 379 --- public/src/Kernel/StrA.HC.HTML | 698 ------ public/src/Kernel/StrB.HC.HTML | 199 -- public/src/Kernel/StrPrint.HC.HTML | 12 - public/src/Kernel/StrScan.HC.HTML | 12 - public/src/MakeHome.HC.HTML | 25 - public/src/Misc/DoDistro.HC.HTML | 61 - public/src/Misc/OSInstall.HC.HTML | 231 -- public/src/Misc/OSTestSuite.HC.HTML | 1735 -------------- public/src/Once.HC.HTML | 67 - public/src/StartOS.HC.HTML | 58 - 1230 files changed, 2749 insertions(+), 85468 deletions(-) rename public/{src => Wb}/Adam/ABlkDev/ADskA.HC (100%) rename public/{src => Wb}/Adam/ABlkDev/ADskB.HC (100%) rename public/{src => Wb}/Adam/ABlkDev/DskChk.HC (100%) rename public/{src => Wb}/Adam/ABlkDev/DskPrt.HC (100%) rename public/{src => Wb}/Adam/ABlkDev/FileMgr.HC (100%) rename public/{src => Wb}/Adam/ABlkDev/MakeABlkDev.HC (100%) rename public/{src => Wb}/Adam/ABlkDev/Mount.HC (100%) rename public/{src => Wb}/Adam/ADbg.HC (100%) rename public/{src => Wb}/Adam/ADefine.HC (100%) rename public/{src => Wb}/Adam/AExts.HC (100%) rename public/{src => Wb}/Adam/AHash.HC (100%) rename public/{src => Wb}/Adam/AMath.HC (100%) rename public/{src => Wb}/Adam/AMathODE.HC (100%) rename public/{src => Wb}/Adam/AMem.HC (100%) rename public/{src => Wb}/Adam/AMouse.HC (100%) rename public/{src => Wb}/Adam/ARegistry.HC (100%) rename public/{src => Wb}/Adam/ASnd.HC (100%) rename public/{src => Wb}/Adam/AutoComplete/ACDictGen.HC (100%) rename public/{src => Wb}/Adam/AutoComplete/ACFill.HC (100%) rename public/{src => Wb}/Adam/AutoComplete/ACInit.HC (100%) rename public/{src => Wb}/Adam/AutoComplete/ACTask.HC (100%) rename public/{src => Wb}/Adam/AutoComplete/MakeAC.HC (100%) rename public/{src => Wb}/Adam/CPURep.HC (100%) rename public/{src => Wb}/Adam/Ctrls/CtrlsA.HC (100%) rename public/{src => Wb}/Adam/Ctrls/CtrlsBttn.HC (100%) rename public/{src => Wb}/Adam/Ctrls/CtrlsSlider.HC (100%) rename public/{src => Wb}/Adam/Ctrls/MakeCtrls.HC (100%) rename public/{src => Wb}/Adam/DevInfo.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocBin.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocChar.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocClipBoard.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocCodeTools.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocDblBuf.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocEd.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocExt.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocFile.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocFind.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocForm.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocGet.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocGr.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocHighlight.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocInit.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocLink.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocMacro.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocNew.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocPlain.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocPopUp.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocPutKey.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocPutS.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocRecalc.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocRecalcLib.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocRun.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocTerm.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocTree.HC (100%) rename public/{src => Wb}/Adam/DolDoc/DocWidgetWiz.HC (100%) rename public/{src => Wb}/Adam/DolDoc/MakeDoc.HC (100%) rename public/{src => Wb}/Adam/God/GodBible.HC (100%) rename public/{src => Wb}/Adam/God/GodDoodle.HC (100%) rename public/{src => Wb}/Adam/God/GodExt.HC (100%) rename public/{src => Wb}/Adam/God/GodSong.HC (100%) rename public/{src => Wb}/Adam/God/HSNotes.DD.HTML (99%) mode change 100644 => 100755 rename public/{src => Wb}/Adam/God/HolySpirit.HC (100%) rename public/{src => Wb}/Adam/God/MakeGod.HC (100%) rename public/{src => Wb}/Adam/God/Vocab.DD.HTML (99%) mode change 100644 => 100755 rename public/{src => Wb}/Adam/Gr/GrAsm.HC (100%) rename public/{src => Wb}/Adam/Gr/GrBitMap.HC (100%) rename public/{src => Wb}/Adam/Gr/GrComposites.HC (100%) rename public/{src => Wb}/Adam/Gr/GrDC.HC (100%) rename public/{src => Wb}/Adam/Gr/GrEnd.HC (100%) rename public/{src => Wb}/Adam/Gr/GrExt.HC (100%) rename public/{src => Wb}/Adam/Gr/GrGlbls.HC (100%) rename public/{src => Wb}/Adam/Gr/GrInitA.HC (100%) rename public/{src => Wb}/Adam/Gr/GrInitB.HC (100%) rename public/{src => Wb}/Adam/Gr/GrMath.HC (100%) rename public/{src => Wb}/Adam/Gr/GrPalette.HC (100%) rename public/{src => Wb}/Adam/Gr/GrPrimatives.HC (100%) rename public/{src => Wb}/Adam/Gr/GrScrn.HC (100%) rename public/{src => Wb}/Adam/Gr/GrSpritePlot.HC (100%) rename public/{src => Wb}/Adam/Gr/GrTextBase.HC (100%) rename public/{src => Wb}/Adam/Gr/MakeGr.HC (100%) rename public/{src => Wb}/Adam/Gr/ScrnCast.HC (100%) rename public/{src => Wb}/Adam/Gr/SpriteBitMap.HC (100%) rename public/{src => Wb}/Adam/Gr/SpriteCode.HC (100%) rename public/{src => Wb}/Adam/Gr/SpriteEd.HC (100%) rename public/{src => Wb}/Adam/Gr/SpriteMain.HC (100%) rename public/{src => Wb}/Adam/Gr/SpriteMesh.HC (100%) rename public/{src => Wb}/Adam/Gr/SpriteNew.HC (100%) rename public/{src => Wb}/Adam/Gr/SpriteSideBar.HC (100%) rename public/{src => Wb}/Adam/Host.HC (100%) rename public/{src => Wb}/Adam/InFile.HC (100%) rename public/{src => Wb}/Adam/InsReg.HC (100%) rename public/{src => Wb}/Adam/MakeAdam.HC (100%) rename public/{src => Wb}/Adam/Menu.HC (100%) rename public/{src => Wb}/Adam/Opt/Boot/BootDVD.HC (100%) rename public/{src => Wb}/Adam/Opt/Boot/BootDVDIns.HC (100%) rename public/{src => Wb}/Adam/Opt/Boot/BootHD.HC (100%) rename public/{src => Wb}/Adam/Opt/Boot/BootHDIns.HC (100%) rename public/{src => Wb}/Adam/Opt/Boot/BootMHD.HC (100%) rename public/{src => Wb}/Adam/Opt/Boot/BootMHD2.HC (100%) rename public/{src => Wb}/Adam/Opt/Boot/BootMHDIns.HC (100%) rename public/{src => Wb}/Adam/Opt/Boot/BootRAM.HC (100%) rename public/{src => Wb}/Adam/Opt/Boot/DskISORedSea.HC (100%) rename public/{src => Wb}/Adam/Opt/Boot/MakeBoot.HC (100%) rename public/{src => Wb}/Adam/Opt/Utils/Diff.HC (100%) rename public/{src => Wb}/Adam/Opt/Utils/DocUtils.HC (100%) rename public/{src => Wb}/Adam/Opt/Utils/Find.HC (100%) rename public/{src => Wb}/Adam/Opt/Utils/HeapLog.HC (100%) rename public/{src => Wb}/Adam/Opt/Utils/LineRep.HC (100%) rename public/{src => Wb}/Adam/Opt/Utils/LinkChk.HC (100%) rename public/{src => Wb}/Adam/Opt/Utils/MakeUtils.HC (100%) rename public/{src => Wb}/Adam/Opt/Utils/MemRep.HC (100%) rename public/{src => Wb}/Adam/Opt/Utils/Merge.HC (100%) rename public/{src => Wb}/Adam/Opt/Utils/Profiler.HC (100%) rename public/{src => Wb}/Adam/Opt/Utils/StrUtils.HC (100%) rename public/{src => Wb}/Adam/Opt/Utils/TOS.HC (100%) rename public/{src => Wb}/Adam/Opt/Utils/ToDolDoc.HC (100%) rename public/{src => Wb}/Adam/Opt/Utils/ToTXT.HC (100%) rename public/{src => Wb}/Adam/TaskRep.HC (100%) rename public/{src => Wb}/Adam/TaskSettings.HC (100%) rename public/{src => Wb}/Adam/Training.HC (100%) rename public/{src => Wb}/Adam/WallPaper.HC (100%) rename public/{src => Wb}/Adam/Win.HC (100%) rename public/{src => Wb}/Adam/WinMgr.HC (100%) rename public/{src => Wb}/Apps/Budget/Accts.DD.HTML (95%) mode change 100644 => 100755 rename public/{src => Wb}/Apps/Budget/BgtAccts.HC (100%) rename public/{src => Wb}/Apps/Budget/BgtEntry.HC (100%) rename public/{src => Wb}/Apps/Budget/BgtFile.HC (100%) rename public/{src => Wb}/Apps/Budget/BgtMain.HC (100%) rename public/{src => Wb}/Apps/Budget/BgtStrs.HC (100%) rename public/{src => Wb}/Apps/Budget/BgtTemplate.HC (100%) rename public/{src => Wb}/Apps/Budget/Budget.HC (100%) rename public/{src => Wb}/Apps/Budget/Install.HC (100%) rename public/{src => Wb}/Apps/Budget/Load.HC (100%) rename public/{src => Wb}/Apps/Budget/Run.HC (100%) rename public/{src => Wb}/Apps/GrModels/BallGen.HC (100%) rename public/{src => Wb}/Apps/GrModels/Load.HC (100%) rename public/{src => Wb}/Apps/GrModels/ManGen.HC (100%) rename public/{src => Wb}/Apps/GrModels/Models.HC (100%) rename public/{src => Wb}/Apps/GrModels/Run.HC (100%) rename public/{src => Wb}/Apps/KeepAway/KeepAway.HC (100%) rename public/{src => Wb}/Apps/KeepAway/Load.HC (100%) rename public/{src => Wb}/Apps/KeepAway/Run.HC (100%) rename public/{src => Wb}/Apps/Logic/Load.HC (100%) rename public/{src => Wb}/Apps/Logic/Logic.HC (100%) rename public/{src => Wb}/Apps/Logic/Run.HC (100%) rename public/{src => Wb}/Apps/Psalmody/Examples/childish.HC (100%) rename public/{src => Wb}/Apps/Psalmody/Examples/night.HC (100%) rename public/{src => Wb}/Apps/Psalmody/Examples/prosper.HC (100%) rename public/{src => Wb}/Apps/Psalmody/Help.DD.HTML (60%) mode change 100644 => 100755 rename public/{src => Wb}/Apps/Psalmody/Install.HC (100%) rename public/{src => Wb}/Apps/Psalmody/JukeBox.HC (100%) rename public/{src => Wb}/Apps/Psalmody/JukePuppet.HC (100%) rename public/{src => Wb}/Apps/Psalmody/Load.HC (100%) rename public/{src => Wb}/Apps/Psalmody/Psalmody.HC (100%) rename public/{src => Wb}/Apps/Psalmody/PsalmodyCtrls.HC (100%) rename public/{src => Wb}/Apps/Psalmody/PsalmodyDraw.HC (100%) rename public/{src => Wb}/Apps/Psalmody/PsalmodyFile.HC (100%) rename public/{src => Wb}/Apps/Psalmody/PsalmodyMain.HC (100%) rename public/{src => Wb}/Apps/Psalmody/Run.HC (100%) rename public/{src => Wb}/Apps/Span/Install.HC (100%) rename public/{src => Wb}/Apps/Span/Load.HC (100%) rename public/{src => Wb}/Apps/Span/Run.HC (100%) rename public/{src => Wb}/Apps/Span/SpanBridge.HC (100%) rename public/{src => Wb}/Apps/Span/SpanDerive.HC (100%) rename public/{src => Wb}/Apps/Span/SpanMain.HC (100%) rename public/{src => Wb}/Apps/Span/SpanNew.HC (100%) rename public/{src => Wb}/Apps/Strut/Load.HC (100%) rename public/{src => Wb}/Apps/Strut/Run.HC (100%) rename public/{src => Wb}/Apps/Strut/Strut.HC (100%) rename public/{src => Wb}/Apps/TimeClock/Install.HC (100%) rename public/{src => Wb}/Apps/TimeClock/Load.HC (100%) rename public/{src => Wb}/Apps/TimeClock/TimeClk.HC (100%) rename public/{src => Wb}/Apps/Titanium/Load.HC (100%) rename public/{src => Wb}/Apps/Titanium/Run.HC (100%) rename public/{src => Wb}/Apps/Titanium/Titanium.HC (100%) rename public/{src => Wb}/Apps/ToTheFront/AIs/Human.HC (100%) rename public/{src => Wb}/Apps/ToTheFront/AIs/SimpleAI.HC (100%) rename public/{src => Wb}/Apps/ToTheFront/Install.HC (100%) rename public/{src => Wb}/Apps/ToTheFront/Load.HC (100%) rename public/{src => Wb}/Apps/ToTheFront/Run.HC (100%) rename public/{src => Wb}/Apps/ToTheFront/TTFDraw.HC (100%) rename public/{src => Wb}/Apps/ToTheFront/TTFFire.HC (100%) rename public/{src => Wb}/Apps/ToTheFront/TTFGlbls.HC (100%) rename public/{src => Wb}/Apps/ToTheFront/TTFInit.HC (100%) rename public/{src => Wb}/Apps/ToTheFront/TTFLib.HC (100%) rename public/{src => Wb}/Apps/ToTheFront/TTFMove.HC (100%) rename public/{src => Wb}/Apps/ToTheFront/TTFVis.HC (100%) rename public/{src => Wb}/Apps/ToTheFront/ToTheFront.HC (100%) rename public/{src => Wb}/Apps/Vocabulary/Load.HC (100%) rename public/{src => Wb}/Apps/Vocabulary/Run.HC (100%) rename public/{src => Wb}/Apps/Vocabulary/VocabQuiz.HC (100%) rename public/{src => Wb}/Apps/X-Caliber/Load.HC (100%) rename public/{src => Wb}/Apps/X-Caliber/Run.HC (100%) rename public/{src => Wb}/Apps/X-Caliber/X-Caliber.HC (100%) rename public/{src => Wb}/Apps/X-Caliber/XCCtrls.HC (100%) rename public/{src => Wb}/Compiler/Asm.HC (100%) rename public/{src => Wb}/Compiler/AsmInit.HC (100%) rename public/{src => Wb}/Compiler/AsmLib.HC (100%) rename public/{src => Wb}/Compiler/AsmResolve.HC (100%) rename public/{src => Wb}/Compiler/BackA.HC (100%) rename public/{src => Wb}/Compiler/BackB.HC (100%) rename public/{src => Wb}/Compiler/BackC.HC (100%) rename public/{src => Wb}/Compiler/BackFA.HC (100%) rename public/{src => Wb}/Compiler/BackFB.HC (100%) rename public/{src => Wb}/Compiler/BackLib.HC (100%) rename public/{src => Wb}/Compiler/CExcept.HC (100%) rename public/{src => Wb}/Compiler/CExts.HC (100%) rename public/{src => Wb}/Compiler/CHash.HC (100%) rename public/{src => Wb}/Compiler/CInit.HC (100%) rename public/{src => Wb}/Compiler/CMain.HC (100%) rename public/{src => Wb}/Compiler/CMisc.HC (100%) rename public/{src => Wb}/Compiler/Lex.HC (100%) rename public/{src => Wb}/Compiler/LexLib.HC (100%) rename public/{src => Wb}/Compiler/OpCodes.DD.HTML (99%) mode change 100644 => 100755 rename public/{src => Wb}/Compiler/OptLib.HC (100%) rename public/{src => Wb}/Compiler/OptPass012.HC (100%) rename public/{src => Wb}/Compiler/OptPass3.HC (100%) rename public/{src => Wb}/Compiler/OptPass4.HC (100%) rename public/{src => Wb}/Compiler/OptPass5.HC (100%) rename public/{src => Wb}/Compiler/OptPass6.HC (100%) rename public/{src => Wb}/Compiler/OptPass789A.HC (100%) rename public/{src => Wb}/Compiler/PrsExp.HC (100%) rename public/{src => Wb}/Compiler/PrsLib.HC (100%) rename public/{src => Wb}/Compiler/PrsStmt.HC (100%) rename public/{src => Wb}/Compiler/PrsVar.HC (100%) rename public/{src => Wb}/Compiler/Templates.HC (100%) rename public/{src => Wb}/Compiler/UAsm.HC (100%) rename public/{src => Wb}/Demo/AcctExample/HomeKeyPlugIns.HC (100%) rename public/{src => Wb}/Demo/AcctExample/HomeLocalize.HC (100%) rename public/{src => Wb}/Demo/AcctExample/HomeSys.HC (100%) rename public/{src => Wb}/Demo/AcctExample/HomeWrappers.HC (100%) rename public/{src => Wb}/Demo/AcctExample/MakeHome.HC (100%) rename public/{src => Wb}/Demo/AcctExample/Once.HC (100%) rename public/{src => Wb}/Demo/AcctExample/PersonalMenu.DD.HTML (99%) mode change 100644 => 100755 rename public/{src => Wb}/Demo/AcctExample/PersonalNotes.DD.HTML (57%) mode change 100644 => 100755 rename public/{src => Wb}/Demo/AcctExample/Registry.HC (100%) rename public/{src => Wb}/Demo/AcctExample/TOS/MakeTOS.HC (100%) rename public/{src => Wb}/Demo/AcctExample/TOS/TOSCfg.HC (100%) rename public/{src => Wb}/Demo/AcctExample/TOS/TOSDistro.HC (100%) rename public/{src => Wb}/Demo/AcctExample/TOS/TOSExt.HC (100%) rename public/{src => Wb}/Demo/AcctExample/TOS/TOSMisc.HC (100%) rename public/{src => Wb}/Demo/AcctExample/TOS/TOSTheme.HC (100%) rename public/{src => Wb}/Demo/Asm/AsmAndC1.HC (100%) rename public/{src => Wb}/Demo/Asm/AsmAndC2.HC (100%) rename public/{src => Wb}/Demo/Asm/AsmAndC3.HC (100%) rename public/{src => Wb}/Demo/Asm/AsmHelloWorld.HC (100%) rename public/{src => Wb}/Demo/Asm/BuzzFizz.HC (100%) rename public/{src => Wb}/Demo/Asm/DivByHand.HC (100%) rename public/{src => Wb}/Demo/Asm/MulByHand.HC (100%) rename public/{src => Wb}/Demo/Asm/PutDec.HC (100%) rename public/{src => Wb}/Demo/Carry.HC (100%) rename public/{src => Wb}/Demo/ClassMeta.HC (100%) rename public/{src => Wb}/Demo/CompileDemo.HC (100%) rename public/{src => Wb}/Demo/DateTime.HC (100%) rename public/{src => Wb}/Demo/DbgDemo.HC (100%) rename public/{src => Wb}/Demo/Define.HC (100%) rename public/{src => Wb}/Demo/Directives.HC (100%) rename public/{src => Wb}/Demo/DolDoc/CallBack.HC (100%) rename public/{src => Wb}/Demo/DolDoc/ClickCallBack.HC (100%) rename public/{src => Wb}/Demo/DolDoc/CursorMove.HC (100%) rename public/{src => Wb}/Demo/DolDoc/Data.HC (100%) rename public/{src => Wb}/Demo/DolDoc/DefineStr.HC (100%) rename public/{src => Wb}/Demo/DolDoc/DemoDoc.DD.HTML (99%) mode change 100644 => 100755 rename public/{src => Wb}/Demo/DolDoc/FileRead.HC (100%) rename public/{src => Wb}/Demo/DolDoc/Form.HC (100%) rename public/{src => Wb}/Demo/DolDoc/MenuBttn.HC (100%) rename public/{src => Wb}/Demo/DolDoc/MenuSprite.HC (100%) rename public/{src => Wb}/Demo/DolDoc/NumBible.HC (100%) rename public/{src => Wb}/Demo/DolDoc/TextDemo.HC (100%) rename public/{src => Wb}/Demo/DolDoc/TreeDemo.HC (100%) rename public/{src => Wb}/Demo/DolDoc/UnusedDefine.HC (100%) rename public/{src => Wb}/Demo/Dsk/BlkDevRep.HC (100%) rename public/{src => Wb}/Demo/Dsk/DataBase.HC (100%) rename public/{src => Wb}/Demo/Dsk/DskRaw.HC (100%) rename public/{src => Wb}/Demo/Dsk/FPrintF.HC (100%) rename public/{src => Wb}/Demo/Dsk/SerializeTree.HC (100%) rename public/{src => Wb}/Demo/Dsk/UnusedSpaceRep.HC (100%) rename public/{src => Wb}/Demo/Exceptions.HC (100%) rename public/{src => Wb}/Demo/ExtChars.HC (100%) rename public/{src => Wb}/Demo/Games/BattleLines.HC (100%) rename public/{src => Wb}/Demo/Games/BigGuns.HC (100%) rename public/{src => Wb}/Demo/Games/BlackDiamond.HC (100%) rename public/{src => Wb}/Demo/Games/BomberGolf.HC (100%) rename public/{src => Wb}/Demo/Games/CastleFrankenstein.HC (100%) rename public/{src => Wb}/Demo/Games/CharDemo.HC (100%) rename public/{src => Wb}/Demo/Games/CircleTrace.HC (100%) rename public/{src => Wb}/Demo/Games/Collision.HC (100%) rename public/{src => Wb}/Demo/Games/Digits.HC (100%) rename public/{src => Wb}/Demo/Games/DunGen.HC (100%) rename public/{src => Wb}/Demo/Games/ElephantWalk.HC (100%) rename public/{src => Wb}/Demo/Games/FlapBat.HC (100%) rename public/{src => Wb}/Demo/Games/FlatTops.HC (100%) rename public/{src => Wb}/Demo/Games/Halogen.HC (100%) rename public/{src => Wb}/Demo/Games/MassSpring.HC (100%) rename public/{src => Wb}/Demo/Games/Maze.HC (100%) rename public/{src => Wb}/Demo/Games/RainDrops.HC (100%) rename public/{src => Wb}/Demo/Games/RawHide.HC (100%) rename public/{src => Wb}/Demo/Games/Rocket.HC (100%) rename public/{src => Wb}/Demo/Games/RocketScience.HC (100%) rename public/{src => Wb}/Demo/Games/Squirt.HC (100%) rename public/{src => Wb}/Demo/Games/Stadium/Stadium.HC (100%) rename public/{src => Wb}/Demo/Games/Stadium/StadiumBG.DD.HTML (94%) mode change 100644 => 100755 rename public/{src => Wb}/Demo/Games/Stadium/StadiumGen.HC (100%) rename public/{src => Wb}/Demo/Games/Talons.HC (100%) rename public/{src => Wb}/Demo/Games/TheDead.HC (100%) rename public/{src => Wb}/Demo/Games/TicTacToe.HC (100%) rename public/{src => Wb}/Demo/Games/TreeCheckers.HC (100%) rename public/{src => Wb}/Demo/Games/Varoom.HC (100%) rename public/{src => Wb}/Demo/Games/Wenceslas.HC (100%) rename public/{src => Wb}/Demo/Games/Whap.HC (100%) rename public/{src => Wb}/Demo/Games/Zing.HC (100%) rename public/{src => Wb}/Demo/Games/ZoneOut.HC (100%) rename public/{src => Wb}/Demo/GlblVars.HC (100%) rename public/{src => Wb}/Demo/Graphics/3DPoly.HC (100%) rename public/{src => Wb}/Demo/Graphics/BSpline.HC (100%) rename public/{src => Wb}/Demo/Graphics/Balloon.HC (100%) rename public/{src => Wb}/Demo/Graphics/Blot.HC (100%) rename public/{src => Wb}/Demo/Graphics/Bounce.HC (100%) rename public/{src => Wb}/Demo/Graphics/Box.HC (100%) rename public/{src => Wb}/Demo/Graphics/Cartesian.HC (100%) rename public/{src => Wb}/Demo/Graphics/CharAnimation.HC (100%) rename public/{src => Wb}/Demo/Graphics/Collision.HC (100%) rename public/{src => Wb}/Demo/Graphics/CommonAncestor.HC (100%) rename public/{src => Wb}/Demo/Graphics/Doodle.HC (100%) rename public/{src => Wb}/Demo/Graphics/EdSprite.HC (100%) rename public/{src => Wb}/Demo/Graphics/Elephant.HC (100%) rename public/{src => Wb}/Demo/Graphics/Extents.HC (100%) rename public/{src => Wb}/Demo/Graphics/FontEd.HC (100%) rename public/{src => Wb}/Demo/Graphics/Grid.HC (100%) rename public/{src => Wb}/Demo/Graphics/Hanoi.HC (100%) rename public/{src => Wb}/Demo/Graphics/Lattice.HC (100%) rename public/{src => Wb}/Demo/Graphics/Life.HC (100%) rename public/{src => Wb}/Demo/Graphics/LightTable.HC (100%) rename public/{src => Wb}/Demo/Graphics/Lines.HC (100%) rename public/{src => Wb}/Demo/Graphics/LowPassFilter.HC (100%) rename public/{src => Wb}/Demo/Graphics/MathAudioDemo.HC (100%) rename public/{src => Wb}/Demo/Graphics/MouseDemo.HC (100%) rename public/{src => Wb}/Demo/Graphics/NetOfDots.HC (100%) rename public/{src => Wb}/Demo/Graphics/Palette.HC (100%) rename public/{src => Wb}/Demo/Graphics/PanText.HC (100%) rename public/{src => Wb}/Demo/Graphics/Pick.HC (100%) rename public/{src => Wb}/Demo/Graphics/Pick3D.HC (100%) rename public/{src => Wb}/Demo/Graphics/PoleZeros.HC (100%) rename public/{src => Wb}/Demo/Graphics/PredatorPrey.HC (100%) rename public/{src => Wb}/Demo/Graphics/RotateTank.HC (100%) rename public/{src => Wb}/Demo/Graphics/ScrnCapture.HC (100%) rename public/{src => Wb}/Demo/Graphics/ScrollBars.HC (100%) rename public/{src => Wb}/Demo/Graphics/Shading.HC (100%) rename public/{src => Wb}/Demo/Graphics/Shadow.HC (100%) rename public/{src => Wb}/Demo/Graphics/Slider.HC (100%) rename public/{src => Wb}/Demo/Graphics/Speedline.HC (100%) rename public/{src => Wb}/Demo/Graphics/SpritePlot.HC (100%) rename public/{src => Wb}/Demo/Graphics/SpritePlot3D.HC (100%) rename public/{src => Wb}/Demo/Graphics/SpritePut.HC (100%) rename public/{src => Wb}/Demo/Graphics/SpritePutExt.HC (100%) rename public/{src => Wb}/Demo/Graphics/SpriteRaw.HC (100%) rename public/{src => Wb}/Demo/Graphics/SpriteText.HC (100%) rename public/{src => Wb}/Demo/Graphics/SunMoon.HC (100%) rename public/{src => Wb}/Demo/Graphics/Symmetry.HC (100%) rename public/{src => Wb}/Demo/Graphics/Transform.HC (100%) rename public/{src => Wb}/Demo/Graphics/WallPaperCtrl.HC (100%) rename public/{src => Wb}/Demo/Graphics/WallPaperFish.HC (100%) rename public/{src => Wb}/Demo/Graphics/WinZBuf.HC (100%) rename public/{src => Wb}/Demo/InFile/InEd.DD.HTML (99%) mode change 100644 => 100755 rename public/{src => Wb}/Demo/InFile/InPopUp.HC (100%) rename public/{src => Wb}/Demo/InFile/InSetIP.HC (100%) rename public/{src => Wb}/Demo/KeyBitMap.HC (100%) rename public/{src => Wb}/Demo/LastClass.HC (100%) rename public/{src => Wb}/Demo/Lectures/64BitAsmQuiz.DD.HTML (91%) mode change 100644 => 100755 rename public/{src => Wb}/Demo/Lectures/AndNotMod.HC (100%) rename public/{src => Wb}/Demo/Lectures/FixedPoint.HC (100%) rename public/{src => Wb}/Demo/Lectures/FixedPointAdvanced.HC (100%) rename public/{src => Wb}/Demo/Lectures/GraphicsCPULoad.HC (100%) rename public/{src => Wb}/Demo/Lectures/InterruptDemo.HC (100%) rename public/{src => Wb}/Demo/Lectures/MiniCompiler.HC (100%) rename public/{src => Wb}/Demo/Lectures/MiniGrLib.HC (100%) rename public/{src => Wb}/Demo/Lectures/NegDisp.HC (100%) rename public/{src => Wb}/Demo/Lectures/Optimization.HC (100%) rename public/{src => Wb}/Demo/Lectures/PCIInterrupts.HC (100%) rename public/{src => Wb}/Demo/Lectures/Ring3.HC (100%) rename public/{src => Wb}/Demo/Lectures/ScrnMemory.HC (100%) rename public/{src => Wb}/Demo/MagicPairs.HC (100%) rename public/{src => Wb}/Demo/MemDemo.HC (100%) rename public/{src => Wb}/Demo/MsgLoop.HC (100%) rename public/{src => Wb}/Demo/MultiCore/Interrupts.HC (100%) rename public/{src => Wb}/Demo/MultiCore/LoadTest.HC (100%) rename public/{src => Wb}/Demo/MultiCore/Lock.HC (100%) rename public/{src => Wb}/Demo/MultiCore/MPAdd.HC (100%) rename public/{src => Wb}/Demo/MultiCore/MPPrint.HC (100%) rename public/{src => Wb}/Demo/MultiCore/MPRadix.HC (100%) rename public/{src => Wb}/Demo/MultiCore/Palindrome.HC (100%) rename public/{src => Wb}/Demo/MultiCore/Primes.HC (100%) rename public/{src => Wb}/Demo/NullCase.HC (100%) rename public/{src => Wb}/Demo/OnceDemo.HC (100%) rename public/{src => Wb}/Demo/ParenWarn.HC (100%) rename public/{src => Wb}/Demo/PhoneNumWords.HC (100%) rename public/{src => Wb}/Demo/Print.HC (100%) rename public/{src => Wb}/Demo/Progress.HC (100%) rename public/{src => Wb}/Demo/Prompt.HC (100%) rename public/{src => Wb}/Demo/PullDownMenu.HC (100%) rename public/{src => Wb}/Demo/RadixSort.HC (100%) rename public/{src => Wb}/Demo/RandDemo.HC (100%) rename public/{src => Wb}/Demo/RegistryDemo.HC (100%) rename public/{src => Wb}/Demo/RevFileDemo/DemoPoemBwd.DD.HTML (97%) mode change 100644 => 100755 rename public/{src => Wb}/Demo/RevFileDemo/Rev.HC (100%) rename public/{src => Wb}/Demo/ScrnCodes.HC (100%) rename public/{src => Wb}/Demo/Snd/ASCIIOrgan.HC (100%) rename public/{src => Wb}/Demo/Snd/MorseCode.HC (100%) rename public/{src => Wb}/Demo/Snd/OhGreat.HC (100%) rename public/{src => Wb}/Demo/Snd/WaterFowl.HC (100%) rename public/{src => Wb}/Demo/SortFileDemo/F64FileGen.HC (100%) rename public/{src => Wb}/Demo/SortFileDemo/F64FileSort.HC (100%) rename public/{src => Wb}/Demo/Spy.HC (100%) rename public/{src => Wb}/Demo/StkGrow.HC (100%) rename public/{src => Wb}/Demo/SubIntAccess.HC (100%) rename public/{src => Wb}/Demo/SubSwitch.HC (100%) rename public/{src => Wb}/Demo/SuggestSpelling.HC (100%) rename public/{src => Wb}/Demo/Templates/Game1.HC (100%) rename public/{src => Wb}/Demo/Templates/Lex1.HC (100%) rename public/{src => Wb}/Demo/Templates/MultiCore1.HC (100%) rename public/{src => Wb}/Demo/Templates/ODE1.HC (100%) rename public/{src => Wb}/Demo/Templates/Registry1.HC (100%) rename public/{src => Wb}/Demo/Templates/Util1.HC (100%) rename public/{src => Wb}/Demo/Templates/Util2.HC (100%) rename public/{src => Wb}/Demo/TimeIns.HC (100%) rename public/{src => Wb}/Demo/ToHtmlToTXTDemo/DemoInPage.DD.HTML (97%) mode change 100644 => 100755 rename public/{src => Wb}/Demo/ToHtmlToTXTDemo/HtmlGen.HC (100%) rename public/{src => Wb}/Demo/ToHtmlToTXTDemo/TXTGen.HC (100%) rename public/{src => Wb}/Demo/ToHtmlToTXTDemo/ToHtml.HC (100%) rename public/{src => Wb}/Demo/WebLogDemo/WebLogRep.HC (100%) rename public/{src => Wb}/Demo/WebLogDemo/WebLogScramble.HC (100%) rename public/{src => Wb}/Demo/WordSearch.HC (100%) rename public/{src => Wb}/Doc/AboutTempleOS.DD.HTML (94%) mode change 100644 => 100755 rename public/{src/Home => Wb}/Doc/Asm.DD.HTML (83%) rename public/{src/Home => Wb}/Doc/AutoComplete.DD.HTML (84%) rename public/{src/Home => Wb}/Doc/Bit.DD.HTML (97%) rename public/{src/Home => Wb}/Doc/BlkChain.DD.HTML (71%) rename public/{src/Home => Wb}/Doc/Boot.DD.HTML (64%) rename public/{src/Home => Wb}/Doc/CharOverview.DD.HTML (75%) rename public/{src/Home => Wb}/Doc/Charter.DD.HTML (96%) rename public/{src/Home => Wb}/Doc/CmdLineOverview.DD.HTML (79%) rename public/{src => Wb}/Doc/Comm.HC (100%) rename public/{src => Wb}/Doc/CompilerOverview.DD.HTML (62%) mode change 100644 => 100755 rename public/{src => Wb}/Doc/Credits.DD.HTML (78%) mode change 100644 => 100755 rename public/{src/Home => Wb}/Doc/Ctrls.DD.HTML (63%) rename public/{src/Home => Wb}/Doc/Customize.DD.HTML (73%) rename public/{src/Home => Wb}/Doc/CutCorners.DD.HTML (75%) rename public/{src => Wb}/Doc/D3.DD.HTML (96%) mode change 100644 => 100755 rename public/{src => Wb}/Doc/Date.DD.HTML (94%) mode change 100644 => 100755 rename public/{src/Home => Wb}/Doc/DbgFunSeg.DD.HTML (95%) create mode 100755 public/Wb/Doc/DbgOverview.DD.HTML rename public/{src => Wb}/Doc/Define.DD.HTML (63%) mode change 100644 => 100755 rename public/{src/Home => Wb}/Doc/Demands.DD.HTML (77%) rename public/{src => Wb}/Doc/DemoIndex.DD.HTML (90%) mode change 100644 => 100755 rename public/{src/Home => Wb}/Doc/Directives.DD.HTML (94%) rename public/{src/Home => Wb}/Doc/DolDoc.DD.HTML (58%) rename public/{src/Home => Wb}/Doc/DolDocOverview.DD.HTML (69%) rename public/{src/Home => Wb}/Doc/EdPullDown.DD.HTML (98%) rename public/{src/Home => Wb}/Doc/FAQ.DD.HTML (98%) rename public/{src/Home => Wb}/Doc/Features.DD.HTML (78%) rename public/{src/Home => Wb}/Doc/FileLowLevel.DD.HTML (83%) rename public/{src => Wb}/Doc/FileMgr.DD.HTML (79%) mode change 100644 => 100755 rename public/{src => Wb}/Doc/FileMgrPullDown.DD.HTML (96%) mode change 100644 => 100755 create mode 100755 public/Wb/Doc/FileUtils.DD.HTML rename public/{src/Home => Wb}/Doc/Frame.DD.HTML (75%) rename public/{src/Home => Wb}/Doc/GRFiles.DD.HTML (90%) rename public/{src/Home => Wb}/Doc/Glossary.DD.HTML (80%) rename public/{src => Wb}/Doc/God.DD.HTML (82%) mode change 100644 => 100755 create mode 100755 public/Wb/Doc/GraphicsOverview.DD.HTML rename public/{src => Wb}/Doc/GuideLines.DD.HTML (67%) mode change 100644 => 100755 rename public/{src/Home => Wb}/Doc/Hash.DD.HTML (67%) rename public/{src/Home => Wb}/Doc/HeapDbg.DD.HTML (84%) rename public/{src/Home => Wb}/Doc/HelloWorld.DD.HTML (99%) create mode 100755 public/Wb/Doc/HelpIndex.DD.HTML rename public/{src => Wb}/Doc/HelpSystem.DD.HTML (85%) mode change 100644 => 100755 rename public/{src/Home => Wb}/Doc/HolyC.DD.HTML (75%) rename public/{src/Home => Wb}/Doc/InFile.DD.HTML (62%) rename public/{src/Home => Wb}/Doc/Install.DD.HTML (71%) create mode 100755 public/Wb/Doc/Job.DD.HTML rename public/{src/Home => Wb}/Doc/KeyAlloc.DD.HTML (79%) rename public/{src => Wb}/Doc/KeyDev.DD.HTML (53%) mode change 100644 => 100755 rename public/{src/Home => Wb}/Doc/Lex.DD.HTML (72%) rename public/{src/Home => Wb}/Doc/MemOverview.DD.HTML (71%) rename public/{src/Home => Wb}/Doc/Menus.DD.HTML (60%) rename public/{src/Home => Wb}/Doc/Mouse.DD.HTML (73%) rename public/{src/Home => Wb}/Doc/Msgs.DD.HTML (84%) rename public/{src => Wb}/Doc/MultiCore.DD.HTML (52%) mode change 100644 => 100755 rename public/{src/Home => Wb}/Doc/NewASCII.DD.HTML (96%) rename public/{src/Home => Wb}/Doc/ODE.DD.HTML (54%) create mode 100755 public/Wb/Doc/Once.DD.HTML rename public/{src/Home => Wb}/Doc/Options.DD.HTML (57%) rename public/{src => Wb}/Doc/Pags.DD.HTML (78%) mode change 100644 => 100755 rename public/{src/Home => Wb}/Doc/PreProcessor.DD.HTML (85%) rename public/{src => Wb}/Doc/Print.DD.HTML (54%) mode change 100644 => 100755 rename public/{src => Wb}/Doc/Profiler.DD.HTML (72%) mode change 100644 => 100755 rename public/{src => Wb}/Doc/Que.DD.HTML (84%) mode change 100644 => 100755 rename public/{src/Home => Wb}/Doc/Quirks.DD.HTML (70%) rename public/{src => Wb}/Doc/RedSea.DD.HTML (77%) mode change 100644 => 100755 rename public/{src => Wb}/Doc/Reliability.DD.HTML (94%) mode change 100644 => 100755 rename public/{src/Home => Wb}/Doc/Requirements.DD.HTML (97%) rename public/{src => Wb}/Doc/Resource.DD.HTML (75%) mode change 100644 => 100755 rename public/{src/Home => Wb}/Doc/ScopingLinkage.DD.HTML (84%) rename public/{src => Wb}/Doc/Snd.DD.HTML (82%) mode change 100644 => 100755 rename public/{src/Home => Wb}/Doc/Sprite.DD.HTML (57%) rename public/{src/Home => Wb}/Doc/SpriteBitMap.DD.HTML (96%) rename public/{src => Wb}/Doc/SpriteEd.DD.HTML (91%) mode change 100644 => 100755 rename public/{src => Wb}/Doc/SpriteEdText.DD.HTML (85%) mode change 100644 => 100755 rename public/{src/Home => Wb}/Doc/SpriteMain.DD.HTML (97%) rename public/{src/Home => Wb}/Doc/SpriteSideBar.DD.HTML (96%) rename public/{src => Wb}/Doc/StandBy.DD.HTML (89%) mode change 100644 => 100755 rename public/{src/Home => Wb}/Doc/Start.DD.HTML (80%) rename public/{src => Wb}/Doc/StdOutTask.DD.HTML (77%) mode change 100644 => 100755 rename public/{src/Home => Wb}/Doc/StdTempleOSPC.DD.HTML (98%) rename public/{src/Home => Wb}/Doc/Strategy.DD.HTML (86%) rename public/{src => Wb}/Doc/Streams.DD.HTML (66%) mode change 100644 => 100755 rename public/{src => Wb}/Doc/TOSZ.DD.HTML (96%) mode change 100644 => 100755 create mode 100755 public/Wb/Doc/TextBase.DD.HTML rename public/{src => Wb}/Doc/TimeCycles.DD.HTML (83%) mode change 100644 => 100755 rename public/{src/Home => Wb}/Doc/TimeDate.DD.HTML (74%) rename public/{src => Wb}/Doc/TimeHPET.DD.HTML (73%) mode change 100644 => 100755 rename public/{src => Wb}/Doc/TimeJiffy.DD.HTML (55%) mode change 100644 => 100755 rename public/{src/Home => Wb}/Doc/Tips.DD.HTML (58%) create mode 100755 public/Wb/Doc/Transform.DD.HTML rename public/{src => Wb}/Doc/Welcome.DD.HTML (60%) mode change 100644 => 100755 rename public/{src/Home => Wb}/Doc/WhyNotMore.DD.HTML (75%) rename public/{src => Wb}/Doc/Widget.DD.HTML (88%) mode change 100644 => 100755 rename public/{src => Wb}/Doc/Windows.DD.HTML (95%) mode change 100644 => 100755 rename public/{src => Wb}/Downloads/TemplarLetters/TSheikhs/171207SerialPort.DD.HTML (97%) mode change 100644 => 100755 rename public/{src => Wb}/Home/DoDistro.HC (100%) rename public/{src => Wb}/Home/Doc/AboutTempleOS.DD.HTML (94%) rename public/{src => Wb/Home}/Doc/Asm.DD.HTML (83%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/AutoComplete.DD.HTML (84%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/Bit.DD.HTML (97%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/BlkChain.DD.HTML (71%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/Boot.DD.HTML (64%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/CharOverview.DD.HTML (75%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/Charter.DD.HTML (96%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/CmdLineOverview.DD.HTML (79%) mode change 100644 => 100755 rename public/{src => Wb}/Home/Doc/Comm.HC (100%) rename public/{src => Wb}/Home/Doc/CompilerOverview.DD.HTML (62%) rename public/{src => Wb}/Home/Doc/Credits.DD.HTML (78%) rename public/{src => Wb/Home}/Doc/Ctrls.DD.HTML (63%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/Customize.DD.HTML (73%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/CutCorners.DD.HTML (75%) mode change 100644 => 100755 rename public/{src => Wb}/Home/Doc/D3.DD.HTML (96%) rename public/{src => Wb}/Home/Doc/Date.DD.HTML (94%) rename public/{src => Wb/Home}/Doc/DbgFunSeg.DD.HTML (95%) mode change 100644 => 100755 create mode 100755 public/Wb/Home/Doc/DbgOverview.DD.HTML rename public/{src => Wb}/Home/Doc/Define.DD.HTML (63%) rename public/{src => Wb/Home}/Doc/Demands.DD.HTML (77%) mode change 100644 => 100755 rename public/{src => Wb}/Home/Doc/DemoIndex.DD.HTML (90%) rename public/{src => Wb/Home}/Doc/Directives.DD.HTML (94%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/DolDoc.DD.HTML (58%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/DolDocOverview.DD.HTML (69%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/EdPullDown.DD.HTML (98%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/FAQ.DD.HTML (98%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/Features.DD.HTML (78%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/FileLowLevel.DD.HTML (83%) mode change 100644 => 100755 rename public/{src => Wb}/Home/Doc/FileMgr.DD.HTML (79%) rename public/{src => Wb}/Home/Doc/FileMgrPullDown.DD.HTML (96%) create mode 100755 public/Wb/Home/Doc/FileUtils.DD.HTML rename public/{src => Wb/Home}/Doc/Frame.DD.HTML (75%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/GRFiles.DD.HTML (90%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/Glossary.DD.HTML (80%) mode change 100644 => 100755 rename public/{src => Wb}/Home/Doc/God.DD.HTML (82%) create mode 100755 public/Wb/Home/Doc/GraphicsOverview.DD.HTML rename public/{src => Wb}/Home/Doc/GuideLines.DD.HTML (67%) rename public/{src => Wb/Home}/Doc/Hash.DD.HTML (67%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/HeapDbg.DD.HTML (84%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/HelloWorld.DD.HTML (99%) mode change 100644 => 100755 create mode 100755 public/Wb/Home/Doc/HelpIndex.DD.HTML rename public/{src => Wb}/Home/Doc/HelpSystem.DD.HTML (85%) rename public/{src => Wb/Home}/Doc/HolyC.DD.HTML (75%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/InFile.DD.HTML (62%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/Install.DD.HTML (71%) mode change 100644 => 100755 create mode 100755 public/Wb/Home/Doc/Job.DD.HTML rename public/{src => Wb/Home}/Doc/KeyAlloc.DD.HTML (79%) mode change 100644 => 100755 rename public/{src => Wb}/Home/Doc/KeyDev.DD.HTML (53%) rename public/{src => Wb/Home}/Doc/Lex.DD.HTML (72%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/MemOverview.DD.HTML (71%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/Menus.DD.HTML (60%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/Mouse.DD.HTML (73%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/Msgs.DD.HTML (84%) mode change 100644 => 100755 rename public/{src => Wb}/Home/Doc/MultiCore.DD.HTML (52%) rename public/{src => Wb/Home}/Doc/NewASCII.DD.HTML (96%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/ODE.DD.HTML (54%) mode change 100644 => 100755 create mode 100755 public/Wb/Home/Doc/Once.DD.HTML rename public/{src => Wb/Home}/Doc/Options.DD.HTML (57%) mode change 100644 => 100755 rename public/{src => Wb}/Home/Doc/Pags.DD.HTML (78%) rename public/{src => Wb/Home}/Doc/PreProcessor.DD.HTML (85%) mode change 100644 => 100755 rename public/{src => Wb}/Home/Doc/Print.DD.HTML (54%) rename public/{src => Wb}/Home/Doc/Profiler.DD.HTML (72%) rename public/{src => Wb}/Home/Doc/Que.DD.HTML (84%) rename public/{src => Wb/Home}/Doc/Quirks.DD.HTML (70%) mode change 100644 => 100755 rename public/{src => Wb}/Home/Doc/RedSea.DD.HTML (77%) rename public/{src => Wb}/Home/Doc/Reliability.DD.HTML (94%) rename public/{src => Wb/Home}/Doc/Requirements.DD.HTML (97%) mode change 100644 => 100755 rename public/{src => Wb}/Home/Doc/Resource.DD.HTML (75%) rename public/{src => Wb/Home}/Doc/ScopingLinkage.DD.HTML (84%) mode change 100644 => 100755 rename public/{src => Wb}/Home/Doc/Snd.DD.HTML (82%) rename public/{src => Wb/Home}/Doc/Sprite.DD.HTML (57%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/SpriteBitMap.DD.HTML (96%) mode change 100644 => 100755 rename public/{src => Wb}/Home/Doc/SpriteEd.DD.HTML (91%) rename public/{src => Wb}/Home/Doc/SpriteEdText.DD.HTML (85%) rename public/{src => Wb/Home}/Doc/SpriteMain.DD.HTML (97%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/SpriteSideBar.DD.HTML (96%) mode change 100644 => 100755 rename public/{src => Wb}/Home/Doc/StandBy.DD.HTML (89%) rename public/{src => Wb/Home}/Doc/Start.DD.HTML (80%) mode change 100644 => 100755 rename public/{src => Wb}/Home/Doc/StdOutTask.DD.HTML (77%) rename public/{src => Wb/Home}/Doc/StdTempleOSPC.DD.HTML (98%) mode change 100644 => 100755 rename public/{src => Wb/Home}/Doc/Strategy.DD.HTML (86%) mode change 100644 => 100755 rename public/{src => Wb}/Home/Doc/Streams.DD.HTML (66%) rename public/{src => Wb}/Home/Doc/TOSZ.DD.HTML (96%) create mode 100755 public/Wb/Home/Doc/TextBase.DD.HTML rename public/{src => Wb}/Home/Doc/TimeCycles.DD.HTML (83%) rename public/{src => Wb/Home}/Doc/TimeDate.DD.HTML (74%) mode change 100644 => 100755 rename public/{src => Wb}/Home/Doc/TimeHPET.DD.HTML (73%) rename public/{src => Wb}/Home/Doc/TimeJiffy.DD.HTML (55%) rename public/{src => Wb/Home}/Doc/Tips.DD.HTML (58%) mode change 100644 => 100755 create mode 100755 public/Wb/Home/Doc/Transform.DD.HTML rename public/{src => Wb}/Home/Doc/Welcome.DD.HTML (60%) rename public/{src => Wb/Home}/Doc/WhyNotMore.DD.HTML (75%) mode change 100644 => 100755 rename public/{src => Wb}/Home/Doc/Widget.DD.HTML (88%) rename public/{src => Wb}/Home/Doc/Windows.DD.HTML (95%) rename public/{src => Wb}/Home/MakeHome.HC (100%) rename public/{src => Wb}/Home/Registry.HC (100%) rename public/{src => Wb}/HomeKeyPlugIns.HC (100%) rename public/{src => Wb}/HomeLocalize.HC (100%) rename public/{src => Wb}/HomeSys.HC (100%) rename public/{src => Wb}/HomeWrappers.HC (100%) rename public/{src => Wb}/Kernel/BlkDev/DskATA.HC (100%) rename public/{src => Wb}/Kernel/BlkDev/DskATAId.HC (100%) rename public/{src => Wb}/Kernel/BlkDev/DskAddDev.HC (100%) rename public/{src => Wb}/Kernel/BlkDev/DskBlk.HC (100%) rename public/{src => Wb}/Kernel/BlkDev/DskBlkDev.HC (100%) rename public/{src => Wb}/Kernel/BlkDev/DskCDDVD.HC (100%) rename public/{src => Wb}/Kernel/BlkDev/DskCFile.HC (100%) rename public/{src => Wb}/Kernel/BlkDev/DskCache.HC (100%) rename public/{src => Wb}/Kernel/BlkDev/DskClus.HC (100%) rename public/{src => Wb}/Kernel/BlkDev/DskCopy.HC (100%) rename public/{src => Wb}/Kernel/BlkDev/DskDirA.HC (100%) rename public/{src => Wb}/Kernel/BlkDev/DskDirB.HC (100%) rename public/{src => Wb}/Kernel/BlkDev/DskDirContext.HC (100%) rename public/{src => Wb}/Kernel/BlkDev/DskDrv.HC (100%) rename public/{src => Wb}/Kernel/BlkDev/DskFile.HC (100%) rename public/{src => Wb}/Kernel/BlkDev/DskFind.HC (100%) rename public/{src => Wb}/Kernel/BlkDev/DskFmt.HC (100%) rename public/{src => Wb}/Kernel/BlkDev/DskStrA.HC (100%) rename public/{src => Wb}/Kernel/BlkDev/DskStrB.HC (100%) rename public/{src => Wb}/Kernel/BlkDev/FileSysFAT.HC (100%) rename public/{src => Wb}/Kernel/BlkDev/FileSysRedSea.HC (100%) rename public/{src => Wb}/Kernel/BlkDev/MakeBlkDev.HC (100%) rename public/{src => Wb}/Kernel/Compress.HC (100%) rename public/{src => Wb}/Kernel/Display.HC (100%) rename public/{src => Wb}/Kernel/EdLite.HC (100%) rename public/{src => Wb}/Kernel/FontCyrillic.HC (100%) rename public/{src => Wb}/Kernel/FontStd.HC (100%) rename public/{src => Wb}/Kernel/FunSeg.HC (100%) rename public/{src => Wb}/Kernel/Job.HC (100%) rename public/{src => Wb}/Kernel/KCfg.HC (100%) rename public/{src => Wb}/Kernel/KDataTypes.HC (100%) rename public/{src => Wb}/Kernel/KDate.HC (100%) rename public/{src => Wb}/Kernel/KDbg.HC (100%) rename public/{src => Wb}/Kernel/KDefine.HC (100%) rename public/{src => Wb}/Kernel/KExcept.HC (100%) rename public/{src => Wb}/Kernel/KExts.HC (100%) rename public/{src => Wb}/Kernel/KGlbls.HC (100%) rename public/{src => Wb}/Kernel/KHashA.HC (100%) rename public/{src => Wb}/Kernel/KHashB.HC (100%) rename public/{src => Wb}/Kernel/KInts.HC (100%) rename public/{src => Wb}/Kernel/KLoad.HC (100%) rename public/{src => Wb}/Kernel/KMain.HC (100%) rename public/{src => Wb}/Kernel/KMathA.HC (100%) rename public/{src => Wb}/Kernel/KMathB.HC (100%) rename public/{src => Wb}/Kernel/KMisc.HC (100%) rename public/{src => Wb}/Kernel/KStart16.HC (100%) rename public/{src => Wb}/Kernel/KStart32.HC (100%) rename public/{src => Wb}/Kernel/KStart64.HC (100%) rename public/{src => Wb}/Kernel/KTask.HC (100%) rename public/{src => Wb}/Kernel/KUtils.HC (100%) rename public/{src => Wb}/Kernel/KeyDev.HC (100%) rename public/{src => Wb}/Kernel/Mem/BlkPool.HC (100%) rename public/{src => Wb}/Kernel/Mem/HeapCtrl.HC (100%) rename public/{src => Wb}/Kernel/Mem/MAllocFree.HC (100%) rename public/{src => Wb}/Kernel/Mem/MakeMem.HC (100%) rename public/{src => Wb}/Kernel/Mem/MemPag.HC (100%) rename public/{src => Wb}/Kernel/Mem/MemPhysical.HC (100%) rename public/{src => Wb}/Kernel/Mem/PageTables.HC (100%) rename public/{src => Wb}/Kernel/MultiProc.HC (100%) rename public/{src => Wb}/Kernel/PCIBIOS.HC (100%) rename public/{src => Wb}/Kernel/QSort.HC (100%) rename public/{src => Wb}/Kernel/Sched.HC (100%) rename public/{src => Wb}/Kernel/SerialDev/Keyboard.HC (100%) rename public/{src => Wb}/Kernel/SerialDev/MakeSerialDev.HC (100%) rename public/{src => Wb}/Kernel/SerialDev/Message.HC (100%) rename public/{src => Wb}/Kernel/SerialDev/Mouse.HC (100%) rename public/{src => Wb}/Kernel/StrA.HC (100%) rename public/{src => Wb}/Kernel/StrB.HC (100%) rename public/{src => Wb}/Kernel/StrPrint.HC (100%) rename public/{src => Wb}/Kernel/StrScan.HC (100%) rename public/{src => Wb}/MakeHome.HC (100%) rename public/{src => Wb}/Misc/DoDistro.HC (100%) rename public/{src => Wb}/Misc/OSInstall.HC (100%) rename public/{src => Wb}/Misc/OSTestSuite.HC (100%) rename public/{src => Wb}/Misc/PCIDevices.DD.HTML (99%) mode change 100644 => 100755 rename public/{src => Wb}/Once.HC (100%) rename public/{src => Wb}/PersonalMenu.DD.HTML (88%) mode change 100644 => 100755 rename public/{src => Wb}/PersonalNotes.DD.HTML (94%) mode change 100644 => 100755 rename public/{src => Wb}/StartOS.HC (100%) delete mode 100644 public/src/Adam/ABlkDev/ADskA.HC.HTML delete mode 100644 public/src/Adam/ABlkDev/ADskB.HC.HTML delete mode 100644 public/src/Adam/ABlkDev/DskChk.HC.HTML delete mode 100644 public/src/Adam/ABlkDev/DskPrt.HC.HTML delete mode 100644 public/src/Adam/ABlkDev/FileMgr.HC.HTML delete mode 100644 public/src/Adam/ABlkDev/MakeABlkDev.HC.HTML delete mode 100644 public/src/Adam/ABlkDev/Mount.HC.HTML delete mode 100644 public/src/Adam/ADbg.HC.HTML delete mode 100644 public/src/Adam/ADefine.HC.HTML delete mode 100644 public/src/Adam/AExts.HC.HTML delete mode 100644 public/src/Adam/AHash.HC.HTML delete mode 100644 public/src/Adam/AMath.HC.HTML delete mode 100644 public/src/Adam/AMathODE.HC.HTML delete mode 100644 public/src/Adam/AMem.HC.HTML delete mode 100644 public/src/Adam/AMouse.HC.HTML delete mode 100644 public/src/Adam/ARegistry.HC.HTML delete mode 100644 public/src/Adam/ASnd.HC.HTML delete mode 100644 public/src/Adam/AutoComplete/ACDictGen.HC.HTML delete mode 100644 public/src/Adam/AutoComplete/ACFill.HC.HTML delete mode 100644 public/src/Adam/AutoComplete/ACInit.HC.HTML delete mode 100644 public/src/Adam/AutoComplete/ACTask.HC.HTML delete mode 100644 public/src/Adam/AutoComplete/MakeAC.HC.HTML delete mode 100644 public/src/Adam/CPURep.HC.HTML delete mode 100644 public/src/Adam/Ctrls/CtrlsA.HC.HTML delete mode 100644 public/src/Adam/Ctrls/CtrlsBttn.HC.HTML delete mode 100644 public/src/Adam/Ctrls/CtrlsSlider.HC.HTML delete mode 100644 public/src/Adam/Ctrls/MakeCtrls.HC.HTML delete mode 100644 public/src/Adam/DevInfo.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocBin.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocChar.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocClipBoard.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocCodeTools.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocDblBuf.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocEd.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocExt.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocFile.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocFind.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocForm.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocGet.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocGr.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocHighlight.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocInit.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocLink.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocMacro.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocNew.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocPlain.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocPopUp.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocPutKey.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocPutS.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocRecalc.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocRecalcLib.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocRun.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocTerm.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocTree.HC.HTML delete mode 100644 public/src/Adam/DolDoc/DocWidgetWiz.HC.HTML delete mode 100644 public/src/Adam/DolDoc/MakeDoc.HC.HTML delete mode 100644 public/src/Adam/God/GodBible.HC.HTML delete mode 100644 public/src/Adam/God/GodDoodle.HC.HTML delete mode 100644 public/src/Adam/God/GodExt.HC.HTML delete mode 100644 public/src/Adam/God/GodSong.HC.HTML delete mode 100644 public/src/Adam/God/HolySpirit.HC.HTML delete mode 100644 public/src/Adam/God/MakeGod.HC.HTML delete mode 100644 public/src/Adam/Gr/GrAsm.HC.HTML delete mode 100644 public/src/Adam/Gr/GrBitMap.HC.HTML delete mode 100644 public/src/Adam/Gr/GrComposites.HC.HTML delete mode 100644 public/src/Adam/Gr/GrDC.HC.HTML delete mode 100644 public/src/Adam/Gr/GrEnd.HC.HTML delete mode 100644 public/src/Adam/Gr/GrExt.HC.HTML delete mode 100644 public/src/Adam/Gr/GrGlbls.HC.HTML delete mode 100644 public/src/Adam/Gr/GrInitA.HC.HTML delete mode 100644 public/src/Adam/Gr/GrInitB.HC.HTML delete mode 100644 public/src/Adam/Gr/GrMath.HC.HTML delete mode 100644 public/src/Adam/Gr/GrPalette.HC.HTML delete mode 100644 public/src/Adam/Gr/GrPrimatives.HC.HTML delete mode 100644 public/src/Adam/Gr/GrScrn.HC.HTML delete mode 100644 public/src/Adam/Gr/GrSpritePlot.HC.HTML delete mode 100644 public/src/Adam/Gr/GrTextBase.HC.HTML delete mode 100644 public/src/Adam/Gr/MakeGr.HC.HTML delete mode 100644 public/src/Adam/Gr/ScrnCast.HC.HTML delete mode 100644 public/src/Adam/Gr/SpriteBitMap.HC.HTML delete mode 100644 public/src/Adam/Gr/SpriteCode.HC.HTML delete mode 100644 public/src/Adam/Gr/SpriteEd.HC.HTML delete mode 100644 public/src/Adam/Gr/SpriteMain.HC.HTML delete mode 100644 public/src/Adam/Gr/SpriteMesh.HC.HTML delete mode 100644 public/src/Adam/Gr/SpriteNew.HC.HTML delete mode 100644 public/src/Adam/Gr/SpriteSideBar.HC.HTML delete mode 100644 public/src/Adam/Host.HC.HTML delete mode 100644 public/src/Adam/InFile.HC.HTML delete mode 100644 public/src/Adam/InsReg.HC.HTML delete mode 100644 public/src/Adam/MakeAdam.HC.HTML delete mode 100644 public/src/Adam/Menu.HC.HTML delete mode 100644 public/src/Adam/Opt/Boot/BootDVD.HC.HTML delete mode 100644 public/src/Adam/Opt/Boot/BootDVDIns.HC.HTML delete mode 100644 public/src/Adam/Opt/Boot/BootHD.HC.HTML delete mode 100644 public/src/Adam/Opt/Boot/BootHDIns.HC.HTML delete mode 100644 public/src/Adam/Opt/Boot/BootMHD.HC.HTML delete mode 100644 public/src/Adam/Opt/Boot/BootMHD2.HC.HTML delete mode 100644 public/src/Adam/Opt/Boot/BootMHDIns.HC.HTML delete mode 100644 public/src/Adam/Opt/Boot/BootRAM.HC.HTML delete mode 100644 public/src/Adam/Opt/Boot/DskISORedSea.HC.HTML delete mode 100644 public/src/Adam/Opt/Boot/MakeBoot.HC.HTML delete mode 100644 public/src/Adam/Opt/Utils/Diff.HC.HTML delete mode 100644 public/src/Adam/Opt/Utils/DocUtils.HC.HTML delete mode 100644 public/src/Adam/Opt/Utils/Find.HC.HTML delete mode 100644 public/src/Adam/Opt/Utils/HeapLog.HC.HTML delete mode 100644 public/src/Adam/Opt/Utils/LineRep.HC.HTML delete mode 100644 public/src/Adam/Opt/Utils/LinkChk.HC.HTML delete mode 100644 public/src/Adam/Opt/Utils/MakeUtils.HC.HTML delete mode 100644 public/src/Adam/Opt/Utils/MemRep.HC.HTML delete mode 100644 public/src/Adam/Opt/Utils/Merge.HC.HTML delete mode 100644 public/src/Adam/Opt/Utils/Profiler.HC.HTML delete mode 100644 public/src/Adam/Opt/Utils/StrUtils.HC.HTML delete mode 100644 public/src/Adam/Opt/Utils/TOS.HC.HTML delete mode 100644 public/src/Adam/Opt/Utils/ToDolDoc.HC.HTML delete mode 100644 public/src/Adam/Opt/Utils/ToTXT.HC.HTML delete mode 100644 public/src/Adam/TaskRep.HC.HTML delete mode 100644 public/src/Adam/TaskSettings.HC.HTML delete mode 100644 public/src/Adam/Training.HC.HTML delete mode 100644 public/src/Adam/WallPaper.HC.HTML delete mode 100644 public/src/Adam/Win.HC.HTML delete mode 100644 public/src/Adam/WinMgr.HC.HTML delete mode 100644 public/src/Apps/Budget/BgtAccts.HC.HTML delete mode 100644 public/src/Apps/Budget/BgtEntry.HC.HTML delete mode 100644 public/src/Apps/Budget/BgtFile.HC.HTML delete mode 100644 public/src/Apps/Budget/BgtMain.HC.HTML delete mode 100644 public/src/Apps/Budget/BgtStrs.HC.HTML delete mode 100644 public/src/Apps/Budget/BgtTemplate.HC.HTML delete mode 100644 public/src/Apps/Budget/Budget.HC.HTML delete mode 100644 public/src/Apps/Budget/Install.HC.HTML delete mode 100644 public/src/Apps/Budget/Load.HC.HTML delete mode 100644 public/src/Apps/Budget/Run.HC.HTML delete mode 100644 public/src/Apps/GrModels/BallGen.HC.HTML delete mode 100644 public/src/Apps/GrModels/Load.HC.HTML delete mode 100644 public/src/Apps/GrModels/ManGen.HC.HTML delete mode 100644 public/src/Apps/GrModels/Models.HC.HTML delete mode 100644 public/src/Apps/GrModels/Run.HC.HTML delete mode 100644 public/src/Apps/KeepAway/KeepAway.HC.HTML delete mode 100644 public/src/Apps/KeepAway/Load.HC.HTML delete mode 100644 public/src/Apps/KeepAway/Run.HC.HTML delete mode 100644 public/src/Apps/Logic/Load.HC.HTML delete mode 100644 public/src/Apps/Logic/Logic.HC.HTML delete mode 100644 public/src/Apps/Logic/Run.HC.HTML delete mode 100644 public/src/Apps/Psalmody/Examples/childish.HC.HTML delete mode 100644 public/src/Apps/Psalmody/Examples/night.HC.HTML delete mode 100644 public/src/Apps/Psalmody/Examples/prosper.HC.HTML delete mode 100644 public/src/Apps/Psalmody/Install.HC.HTML delete mode 100644 public/src/Apps/Psalmody/JukeBox.HC.HTML delete mode 100644 public/src/Apps/Psalmody/JukePuppet.HC.HTML delete mode 100644 public/src/Apps/Psalmody/Load.HC.HTML delete mode 100644 public/src/Apps/Psalmody/Psalmody.HC.HTML delete mode 100644 public/src/Apps/Psalmody/PsalmodyCtrls.HC.HTML delete mode 100644 public/src/Apps/Psalmody/PsalmodyDraw.HC.HTML delete mode 100644 public/src/Apps/Psalmody/PsalmodyFile.HC.HTML delete mode 100644 public/src/Apps/Psalmody/PsalmodyMain.HC.HTML delete mode 100644 public/src/Apps/Psalmody/Run.HC.HTML delete mode 100644 public/src/Apps/Span/Install.HC.HTML delete mode 100644 public/src/Apps/Span/Load.HC.HTML delete mode 100644 public/src/Apps/Span/Run.HC.HTML delete mode 100644 public/src/Apps/Span/SpanBridge.HC.HTML delete mode 100644 public/src/Apps/Span/SpanDerive.HC.HTML delete mode 100644 public/src/Apps/Span/SpanMain.HC.HTML delete mode 100644 public/src/Apps/Span/SpanNew.HC.HTML delete mode 100644 public/src/Apps/Strut/Load.HC.HTML delete mode 100644 public/src/Apps/Strut/Run.HC.HTML delete mode 100644 public/src/Apps/Strut/Strut.HC.HTML delete mode 100644 public/src/Apps/TimeClock/Install.HC.HTML delete mode 100644 public/src/Apps/TimeClock/Load.HC.HTML delete mode 100644 public/src/Apps/TimeClock/TimeClk.HC.HTML delete mode 100644 public/src/Apps/Titanium/Load.HC.HTML delete mode 100644 public/src/Apps/Titanium/Run.HC.HTML delete mode 100644 public/src/Apps/Titanium/Titanium.HC.HTML delete mode 100644 public/src/Apps/ToTheFront/AIs/Human.HC.HTML delete mode 100644 public/src/Apps/ToTheFront/AIs/SimpleAI.HC.HTML delete mode 100644 public/src/Apps/ToTheFront/Install.HC.HTML delete mode 100644 public/src/Apps/ToTheFront/Load.HC.HTML delete mode 100644 public/src/Apps/ToTheFront/Run.HC.HTML delete mode 100644 public/src/Apps/ToTheFront/TTFDraw.HC.HTML delete mode 100644 public/src/Apps/ToTheFront/TTFFire.HC.HTML delete mode 100644 public/src/Apps/ToTheFront/TTFGlbls.HC.HTML delete mode 100644 public/src/Apps/ToTheFront/TTFInit.HC.HTML delete mode 100644 public/src/Apps/ToTheFront/TTFLib.HC.HTML delete mode 100644 public/src/Apps/ToTheFront/TTFMove.HC.HTML delete mode 100644 public/src/Apps/ToTheFront/TTFVis.HC.HTML delete mode 100644 public/src/Apps/ToTheFront/ToTheFront.HC.HTML delete mode 100644 public/src/Apps/Vocabulary/Load.HC.HTML delete mode 100644 public/src/Apps/Vocabulary/Run.HC.HTML delete mode 100644 public/src/Apps/Vocabulary/VocabQuiz.HC.HTML delete mode 100644 public/src/Apps/X-Caliber/Load.HC.HTML delete mode 100644 public/src/Apps/X-Caliber/Run.HC.HTML delete mode 100644 public/src/Apps/X-Caliber/X-Caliber.HC.HTML delete mode 100644 public/src/Apps/X-Caliber/XCCtrls.HC.HTML delete mode 100644 public/src/Compiler/Asm.HC.HTML delete mode 100644 public/src/Compiler/AsmInit.HC.HTML delete mode 100644 public/src/Compiler/AsmLib.HC.HTML delete mode 100644 public/src/Compiler/AsmResolve.HC.HTML delete mode 100644 public/src/Compiler/BackA.HC.HTML delete mode 100644 public/src/Compiler/BackB.HC.HTML delete mode 100644 public/src/Compiler/BackC.HC.HTML delete mode 100644 public/src/Compiler/BackFA.HC.HTML delete mode 100644 public/src/Compiler/BackFB.HC.HTML delete mode 100644 public/src/Compiler/BackLib.HC.HTML delete mode 100644 public/src/Compiler/CExcept.HC.HTML delete mode 100644 public/src/Compiler/CExts.HC.HTML delete mode 100644 public/src/Compiler/CHash.HC.HTML delete mode 100644 public/src/Compiler/CInit.HC.HTML delete mode 100644 public/src/Compiler/CMain.HC.HTML delete mode 100644 public/src/Compiler/CMisc.HC.HTML delete mode 100644 public/src/Compiler/Lex.HC.HTML delete mode 100644 public/src/Compiler/LexLib.HC.HTML delete mode 100644 public/src/Compiler/OptLib.HC.HTML delete mode 100644 public/src/Compiler/OptPass012.HC.HTML delete mode 100644 public/src/Compiler/OptPass3.HC.HTML delete mode 100644 public/src/Compiler/OptPass4.HC.HTML delete mode 100644 public/src/Compiler/OptPass5.HC.HTML delete mode 100644 public/src/Compiler/OptPass6.HC.HTML delete mode 100644 public/src/Compiler/OptPass789A.HC.HTML delete mode 100644 public/src/Compiler/PrsExp.HC.HTML delete mode 100644 public/src/Compiler/PrsLib.HC.HTML delete mode 100644 public/src/Compiler/PrsStmt.HC.HTML delete mode 100644 public/src/Compiler/PrsVar.HC.HTML delete mode 100644 public/src/Compiler/Templates.HC.HTML delete mode 100644 public/src/Compiler/UAsm.HC.HTML delete mode 100644 public/src/Demo/AcctExample/HomeKeyPlugIns.HC.HTML delete mode 100644 public/src/Demo/AcctExample/HomeLocalize.HC.HTML delete mode 100644 public/src/Demo/AcctExample/HomeSys.HC.HTML delete mode 100644 public/src/Demo/AcctExample/HomeWrappers.HC.HTML delete mode 100644 public/src/Demo/AcctExample/MakeHome.HC.HTML delete mode 100644 public/src/Demo/AcctExample/Once.HC.HTML delete mode 100644 public/src/Demo/AcctExample/Registry.HC.HTML delete mode 100644 public/src/Demo/AcctExample/TOS/MakeTOS.HC.HTML delete mode 100644 public/src/Demo/AcctExample/TOS/TOSCfg.HC.HTML delete mode 100644 public/src/Demo/AcctExample/TOS/TOSDistro.HC.HTML delete mode 100644 public/src/Demo/AcctExample/TOS/TOSExt.HC.HTML delete mode 100644 public/src/Demo/AcctExample/TOS/TOSMisc.HC.HTML delete mode 100644 public/src/Demo/AcctExample/TOS/TOSTheme.HC.HTML delete mode 100644 public/src/Demo/Asm/AsmAndC1.HC.HTML delete mode 100644 public/src/Demo/Asm/AsmAndC2.HC.HTML delete mode 100644 public/src/Demo/Asm/AsmAndC3.HC.HTML delete mode 100644 public/src/Demo/Asm/AsmHelloWorld.HC.HTML delete mode 100644 public/src/Demo/Asm/BuzzFizz.HC.HTML delete mode 100644 public/src/Demo/Asm/DivByHand.HC.HTML delete mode 100644 public/src/Demo/Asm/MulByHand.HC.HTML delete mode 100644 public/src/Demo/Asm/PutDec.HC.HTML delete mode 100644 public/src/Demo/Carry.HC.HTML delete mode 100644 public/src/Demo/ClassMeta.HC.HTML delete mode 100644 public/src/Demo/CompileDemo.HC.HTML delete mode 100644 public/src/Demo/DateTime.HC.HTML delete mode 100644 public/src/Demo/DbgDemo.HC.HTML delete mode 100644 public/src/Demo/Define.HC.HTML delete mode 100644 public/src/Demo/Directives.HC.HTML delete mode 100644 public/src/Demo/DolDoc/CallBack.HC.HTML delete mode 100644 public/src/Demo/DolDoc/ClickCallBack.HC.HTML delete mode 100644 public/src/Demo/DolDoc/CursorMove.HC.HTML delete mode 100644 public/src/Demo/DolDoc/Data.HC.HTML delete mode 100644 public/src/Demo/DolDoc/DefineStr.HC.HTML delete mode 100644 public/src/Demo/DolDoc/FileRead.HC.HTML delete mode 100644 public/src/Demo/DolDoc/Form.HC.HTML delete mode 100644 public/src/Demo/DolDoc/MenuBttn.HC.HTML delete mode 100644 public/src/Demo/DolDoc/MenuSprite.HC.HTML delete mode 100644 public/src/Demo/DolDoc/NumBible.HC.HTML delete mode 100644 public/src/Demo/DolDoc/TextDemo.HC.HTML delete mode 100644 public/src/Demo/DolDoc/TreeDemo.HC.HTML delete mode 100644 public/src/Demo/DolDoc/UnusedDefine.HC.HTML delete mode 100644 public/src/Demo/Dsk/BlkDevRep.HC.HTML delete mode 100644 public/src/Demo/Dsk/DataBase.HC.HTML delete mode 100644 public/src/Demo/Dsk/DskRaw.HC.HTML delete mode 100644 public/src/Demo/Dsk/FPrintF.HC.HTML delete mode 100644 public/src/Demo/Dsk/SerializeTree.HC.HTML delete mode 100644 public/src/Demo/Dsk/UnusedSpaceRep.HC.HTML delete mode 100644 public/src/Demo/Exceptions.HC.HTML delete mode 100644 public/src/Demo/ExtChars.HC.HTML delete mode 100644 public/src/Demo/Games/BattleLines.HC.HTML delete mode 100644 public/src/Demo/Games/BigGuns.HC.HTML delete mode 100644 public/src/Demo/Games/BlackDiamond.HC.HTML delete mode 100644 public/src/Demo/Games/BomberGolf.HC.HTML delete mode 100644 public/src/Demo/Games/CastleFrankenstein.HC.HTML delete mode 100644 public/src/Demo/Games/CharDemo.HC.HTML delete mode 100644 public/src/Demo/Games/CircleTrace.HC.HTML delete mode 100644 public/src/Demo/Games/Collision.HC.HTML delete mode 100644 public/src/Demo/Games/Digits.HC.HTML delete mode 100644 public/src/Demo/Games/DunGen.HC.HTML delete mode 100644 public/src/Demo/Games/ElephantWalk.HC.HTML delete mode 100644 public/src/Demo/Games/FlapBat.HC.HTML delete mode 100644 public/src/Demo/Games/FlatTops.HC.HTML delete mode 100644 public/src/Demo/Games/Halogen.HC.HTML delete mode 100644 public/src/Demo/Games/MassSpring.HC.HTML delete mode 100644 public/src/Demo/Games/Maze.HC.HTML delete mode 100644 public/src/Demo/Games/RainDrops.HC.HTML delete mode 100644 public/src/Demo/Games/RawHide.HC.HTML delete mode 100644 public/src/Demo/Games/Rocket.HC.HTML delete mode 100644 public/src/Demo/Games/RocketScience.HC.HTML delete mode 100644 public/src/Demo/Games/Squirt.HC.HTML delete mode 100644 public/src/Demo/Games/Stadium/Stadium.HC.HTML delete mode 100644 public/src/Demo/Games/Stadium/StadiumGen.HC.HTML delete mode 100644 public/src/Demo/Games/Talons.HC.HTML delete mode 100644 public/src/Demo/Games/TheDead.HC.HTML delete mode 100644 public/src/Demo/Games/TicTacToe.HC.HTML delete mode 100644 public/src/Demo/Games/TreeCheckers.HC.HTML delete mode 100644 public/src/Demo/Games/Varoom.HC.HTML delete mode 100644 public/src/Demo/Games/Wenceslas.HC.HTML delete mode 100644 public/src/Demo/Games/Whap.HC.HTML delete mode 100644 public/src/Demo/Games/Zing.HC.HTML delete mode 100644 public/src/Demo/Games/ZoneOut.HC.HTML delete mode 100644 public/src/Demo/GlblVars.HC.HTML delete mode 100644 public/src/Demo/Graphics/3DPoly.HC.HTML delete mode 100644 public/src/Demo/Graphics/BSpline.HC.HTML delete mode 100644 public/src/Demo/Graphics/Balloon.HC.HTML delete mode 100644 public/src/Demo/Graphics/Blot.HC.HTML delete mode 100644 public/src/Demo/Graphics/Bounce.HC.HTML delete mode 100644 public/src/Demo/Graphics/Box.HC.HTML delete mode 100644 public/src/Demo/Graphics/Cartesian.HC.HTML delete mode 100644 public/src/Demo/Graphics/CharAnimation.HC.HTML delete mode 100644 public/src/Demo/Graphics/Collision.HC.HTML delete mode 100644 public/src/Demo/Graphics/CommonAncestor.HC.HTML delete mode 100644 public/src/Demo/Graphics/Doodle.HC.HTML delete mode 100644 public/src/Demo/Graphics/EdSprite.HC.HTML delete mode 100644 public/src/Demo/Graphics/Elephant.HC.HTML delete mode 100644 public/src/Demo/Graphics/Extents.HC.HTML delete mode 100644 public/src/Demo/Graphics/FontEd.HC.HTML delete mode 100644 public/src/Demo/Graphics/Grid.HC.HTML delete mode 100644 public/src/Demo/Graphics/Hanoi.HC.HTML delete mode 100644 public/src/Demo/Graphics/Lattice.HC.HTML delete mode 100644 public/src/Demo/Graphics/Life.HC.HTML delete mode 100644 public/src/Demo/Graphics/LightTable.HC.HTML delete mode 100644 public/src/Demo/Graphics/Lines.HC.HTML delete mode 100644 public/src/Demo/Graphics/LowPassFilter.HC.HTML delete mode 100644 public/src/Demo/Graphics/MathAudioDemo.HC.HTML delete mode 100644 public/src/Demo/Graphics/MouseDemo.HC.HTML delete mode 100644 public/src/Demo/Graphics/NetOfDots.HC.HTML delete mode 100644 public/src/Demo/Graphics/Palette.HC.HTML delete mode 100644 public/src/Demo/Graphics/PanText.HC.HTML delete mode 100644 public/src/Demo/Graphics/Pick.HC.HTML delete mode 100644 public/src/Demo/Graphics/Pick3D.HC.HTML delete mode 100644 public/src/Demo/Graphics/PoleZeros.HC.HTML delete mode 100644 public/src/Demo/Graphics/PredatorPrey.HC.HTML delete mode 100644 public/src/Demo/Graphics/RotateTank.HC.HTML delete mode 100644 public/src/Demo/Graphics/ScrnCapture.HC.HTML delete mode 100644 public/src/Demo/Graphics/ScrollBars.HC.HTML delete mode 100644 public/src/Demo/Graphics/Shading.HC.HTML delete mode 100644 public/src/Demo/Graphics/Shadow.HC.HTML delete mode 100644 public/src/Demo/Graphics/Slider.HC.HTML delete mode 100644 public/src/Demo/Graphics/Speedline.HC.HTML delete mode 100644 public/src/Demo/Graphics/SpritePlot.HC.HTML delete mode 100644 public/src/Demo/Graphics/SpritePlot3D.HC.HTML delete mode 100644 public/src/Demo/Graphics/SpritePut.HC.HTML delete mode 100644 public/src/Demo/Graphics/SpritePutExt.HC.HTML delete mode 100644 public/src/Demo/Graphics/SpriteRaw.HC.HTML delete mode 100644 public/src/Demo/Graphics/SpriteText.HC.HTML delete mode 100644 public/src/Demo/Graphics/SunMoon.HC.HTML delete mode 100644 public/src/Demo/Graphics/Symmetry.HC.HTML delete mode 100644 public/src/Demo/Graphics/Transform.HC.HTML delete mode 100644 public/src/Demo/Graphics/WallPaperCtrl.HC.HTML delete mode 100644 public/src/Demo/Graphics/WallPaperFish.HC.HTML delete mode 100644 public/src/Demo/Graphics/WinZBuf.HC.HTML delete mode 100644 public/src/Demo/InFile/InPopUp.HC.HTML delete mode 100644 public/src/Demo/InFile/InSetIP.HC.HTML delete mode 100644 public/src/Demo/KeyBitMap.HC.HTML delete mode 100644 public/src/Demo/LastClass.HC.HTML delete mode 100644 public/src/Demo/Lectures/AndNotMod.HC.HTML delete mode 100644 public/src/Demo/Lectures/FixedPoint.HC.HTML delete mode 100644 public/src/Demo/Lectures/FixedPointAdvanced.HC.HTML delete mode 100644 public/src/Demo/Lectures/GraphicsCPULoad.HC.HTML delete mode 100644 public/src/Demo/Lectures/InterruptDemo.HC.HTML delete mode 100644 public/src/Demo/Lectures/MiniCompiler.HC.HTML delete mode 100644 public/src/Demo/Lectures/MiniGrLib.HC.HTML delete mode 100644 public/src/Demo/Lectures/NegDisp.HC.HTML delete mode 100644 public/src/Demo/Lectures/Optimization.HC.HTML delete mode 100644 public/src/Demo/Lectures/PCIInterrupts.HC.HTML delete mode 100644 public/src/Demo/Lectures/Ring3.HC.HTML delete mode 100644 public/src/Demo/Lectures/ScrnMemory.HC.HTML delete mode 100644 public/src/Demo/MagicPairs.HC.HTML delete mode 100644 public/src/Demo/MemDemo.HC.HTML delete mode 100644 public/src/Demo/MsgLoop.HC.HTML delete mode 100644 public/src/Demo/MultiCore/Interrupts.HC.HTML delete mode 100644 public/src/Demo/MultiCore/LoadTest.HC.HTML delete mode 100644 public/src/Demo/MultiCore/Lock.HC.HTML delete mode 100644 public/src/Demo/MultiCore/MPAdd.HC.HTML delete mode 100644 public/src/Demo/MultiCore/MPPrint.HC.HTML delete mode 100644 public/src/Demo/MultiCore/MPRadix.HC.HTML delete mode 100644 public/src/Demo/MultiCore/Palindrome.HC.HTML delete mode 100644 public/src/Demo/MultiCore/Primes.HC.HTML delete mode 100644 public/src/Demo/NullCase.HC.HTML delete mode 100644 public/src/Demo/OnceDemo.HC.HTML delete mode 100644 public/src/Demo/ParenWarn.HC.HTML delete mode 100644 public/src/Demo/PhoneNumWords.HC.HTML delete mode 100644 public/src/Demo/Print.HC.HTML delete mode 100644 public/src/Demo/Progress.HC.HTML delete mode 100644 public/src/Demo/Prompt.HC.HTML delete mode 100644 public/src/Demo/PullDownMenu.HC.HTML delete mode 100644 public/src/Demo/RadixSort.HC.HTML delete mode 100644 public/src/Demo/RandDemo.HC.HTML delete mode 100644 public/src/Demo/RegistryDemo.HC.HTML delete mode 100644 public/src/Demo/RevFileDemo/Rev.HC.HTML delete mode 100644 public/src/Demo/ScrnCodes.HC.HTML delete mode 100644 public/src/Demo/Snd/ASCIIOrgan.HC.HTML delete mode 100644 public/src/Demo/Snd/MorseCode.HC.HTML delete mode 100644 public/src/Demo/Snd/OhGreat.HC.HTML delete mode 100644 public/src/Demo/Snd/WaterFowl.HC.HTML delete mode 100644 public/src/Demo/SortFileDemo/F64FileGen.HC.HTML delete mode 100644 public/src/Demo/SortFileDemo/F64FileSort.HC.HTML delete mode 100644 public/src/Demo/Spy.HC.HTML delete mode 100644 public/src/Demo/StkGrow.HC.HTML delete mode 100644 public/src/Demo/SubIntAccess.HC.HTML delete mode 100644 public/src/Demo/SubSwitch.HC.HTML delete mode 100644 public/src/Demo/SuggestSpelling.HC.HTML delete mode 100644 public/src/Demo/Templates/Game1.HC.HTML delete mode 100644 public/src/Demo/Templates/Lex1.HC.HTML delete mode 100644 public/src/Demo/Templates/MultiCore1.HC.HTML delete mode 100644 public/src/Demo/Templates/ODE1.HC.HTML delete mode 100644 public/src/Demo/Templates/Registry1.HC.HTML delete mode 100644 public/src/Demo/Templates/Util1.HC.HTML delete mode 100644 public/src/Demo/Templates/Util2.HC.HTML delete mode 100644 public/src/Demo/TimeIns.HC.HTML delete mode 100644 public/src/Demo/ToHtmlToTXTDemo/HtmlGen.HC.HTML delete mode 100644 public/src/Demo/ToHtmlToTXTDemo/TXTGen.HC.HTML delete mode 100644 public/src/Demo/ToHtmlToTXTDemo/ToHtml.HC.HTML delete mode 100644 public/src/Demo/WebLogDemo/WebLogRep.HC.HTML delete mode 100644 public/src/Demo/WebLogDemo/WebLogScramble.HC.HTML delete mode 100644 public/src/Demo/WordSearch.HC.HTML delete mode 100644 public/src/Doc/Comm.HC.HTML delete mode 100644 public/src/Doc/DbgOverview.DD.HTML delete mode 100644 public/src/Doc/FileUtils.DD.HTML delete mode 100644 public/src/Doc/GraphicsOverview.DD.HTML delete mode 100644 public/src/Doc/HelpIndex.DD.HTML delete mode 100644 public/src/Doc/Job.DD.HTML delete mode 100644 public/src/Doc/Once.DD.HTML delete mode 100644 public/src/Doc/TextBase.DD.HTML delete mode 100644 public/src/Doc/Transform.DD.HTML delete mode 100644 public/src/Home/DoDistro.HC.HTML delete mode 100755 public/src/Home/Doc/DbgOverview.DD.HTML delete mode 100755 public/src/Home/Doc/FileUtils.DD.HTML delete mode 100755 public/src/Home/Doc/GraphicsOverview.DD.HTML delete mode 100755 public/src/Home/Doc/HelpIndex.DD.HTML delete mode 100755 public/src/Home/Doc/Job.DD.HTML delete mode 100755 public/src/Home/Doc/Once.DD.HTML delete mode 100755 public/src/Home/Doc/TextBase.DD.HTML delete mode 100755 public/src/Home/Doc/Transform.DD.HTML delete mode 100644 public/src/Home/MakeHome.HC.HTML delete mode 100644 public/src/Home/Registry.HC.HTML delete mode 100644 public/src/HomeKeyPlugIns.HC.HTML delete mode 100644 public/src/HomeLocalize.HC.HTML delete mode 100644 public/src/HomeSys.HC.HTML delete mode 100644 public/src/HomeWrappers.HC.HTML delete mode 100644 public/src/Kernel/BlkDev/DskATA.HC.HTML delete mode 100644 public/src/Kernel/BlkDev/DskATAId.HC.HTML delete mode 100644 public/src/Kernel/BlkDev/DskAddDev.HC.HTML delete mode 100644 public/src/Kernel/BlkDev/DskBlk.HC.HTML delete mode 100644 public/src/Kernel/BlkDev/DskBlkDev.HC.HTML delete mode 100644 public/src/Kernel/BlkDev/DskCDDVD.HC.HTML delete mode 100644 public/src/Kernel/BlkDev/DskCFile.HC.HTML delete mode 100644 public/src/Kernel/BlkDev/DskCache.HC.HTML delete mode 100644 public/src/Kernel/BlkDev/DskClus.HC.HTML delete mode 100644 public/src/Kernel/BlkDev/DskCopy.HC.HTML delete mode 100644 public/src/Kernel/BlkDev/DskDirA.HC.HTML delete mode 100644 public/src/Kernel/BlkDev/DskDirB.HC.HTML delete mode 100644 public/src/Kernel/BlkDev/DskDirContext.HC.HTML delete mode 100644 public/src/Kernel/BlkDev/DskDrv.HC.HTML delete mode 100644 public/src/Kernel/BlkDev/DskFile.HC.HTML delete mode 100644 public/src/Kernel/BlkDev/DskFind.HC.HTML delete mode 100644 public/src/Kernel/BlkDev/DskFmt.HC.HTML delete mode 100644 public/src/Kernel/BlkDev/DskStrA.HC.HTML delete mode 100644 public/src/Kernel/BlkDev/DskStrB.HC.HTML delete mode 100644 public/src/Kernel/BlkDev/FileSysFAT.HC.HTML delete mode 100644 public/src/Kernel/BlkDev/FileSysRedSea.HC.HTML delete mode 100644 public/src/Kernel/BlkDev/MakeBlkDev.HC.HTML delete mode 100644 public/src/Kernel/Compress.HC.HTML delete mode 100644 public/src/Kernel/Display.HC.HTML delete mode 100644 public/src/Kernel/EdLite.HC.HTML delete mode 100644 public/src/Kernel/FontCyrillic.HC.HTML delete mode 100644 public/src/Kernel/FontStd.HC.HTML delete mode 100644 public/src/Kernel/FunSeg.HC.HTML delete mode 100644 public/src/Kernel/Job.HC.HTML delete mode 100644 public/src/Kernel/KCfg.HC.HTML delete mode 100644 public/src/Kernel/KDataTypes.HC.HTML delete mode 100644 public/src/Kernel/KDate.HC.HTML delete mode 100644 public/src/Kernel/KDbg.HC.HTML delete mode 100644 public/src/Kernel/KDefine.HC.HTML delete mode 100644 public/src/Kernel/KExcept.HC.HTML delete mode 100644 public/src/Kernel/KExts.HC.HTML delete mode 100644 public/src/Kernel/KGlbls.HC.HTML delete mode 100644 public/src/Kernel/KHashA.HC.HTML delete mode 100644 public/src/Kernel/KHashB.HC.HTML delete mode 100644 public/src/Kernel/KInts.HC.HTML delete mode 100644 public/src/Kernel/KLoad.HC.HTML delete mode 100644 public/src/Kernel/KMain.HC.HTML delete mode 100644 public/src/Kernel/KMathA.HC.HTML delete mode 100644 public/src/Kernel/KMathB.HC.HTML delete mode 100644 public/src/Kernel/KMisc.HC.HTML delete mode 100644 public/src/Kernel/KStart16.HC.HTML delete mode 100644 public/src/Kernel/KStart32.HC.HTML delete mode 100644 public/src/Kernel/KStart64.HC.HTML delete mode 100644 public/src/Kernel/KTask.HC.HTML delete mode 100644 public/src/Kernel/KUtils.HC.HTML delete mode 100644 public/src/Kernel/KeyDev.HC.HTML delete mode 100644 public/src/Kernel/Mem/BlkPool.HC.HTML delete mode 100644 public/src/Kernel/Mem/HeapCtrl.HC.HTML delete mode 100644 public/src/Kernel/Mem/MAllocFree.HC.HTML delete mode 100644 public/src/Kernel/Mem/MakeMem.HC.HTML delete mode 100644 public/src/Kernel/Mem/MemPag.HC.HTML delete mode 100644 public/src/Kernel/Mem/MemPhysical.HC.HTML delete mode 100644 public/src/Kernel/Mem/PageTables.HC.HTML delete mode 100644 public/src/Kernel/MultiProc.HC.HTML delete mode 100644 public/src/Kernel/PCIBIOS.HC.HTML delete mode 100644 public/src/Kernel/QSort.HC.HTML delete mode 100644 public/src/Kernel/Sched.HC.HTML delete mode 100644 public/src/Kernel/SerialDev/Keyboard.HC.HTML delete mode 100644 public/src/Kernel/SerialDev/MakeSerialDev.HC.HTML delete mode 100644 public/src/Kernel/SerialDev/Message.HC.HTML delete mode 100644 public/src/Kernel/SerialDev/Mouse.HC.HTML delete mode 100644 public/src/Kernel/StrA.HC.HTML delete mode 100644 public/src/Kernel/StrB.HC.HTML delete mode 100644 public/src/Kernel/StrPrint.HC.HTML delete mode 100644 public/src/Kernel/StrScan.HC.HTML delete mode 100644 public/src/MakeHome.HC.HTML delete mode 100644 public/src/Misc/DoDistro.HC.HTML delete mode 100644 public/src/Misc/OSInstall.HC.HTML delete mode 100644 public/src/Misc/OSTestSuite.HC.HTML delete mode 100644 public/src/Once.HC.HTML delete mode 100644 public/src/StartOS.HC.HTML diff --git a/public/src/Adam/ABlkDev/ADskA.HC b/public/Wb/Adam/ABlkDev/ADskA.HC similarity index 100% rename from public/src/Adam/ABlkDev/ADskA.HC rename to public/Wb/Adam/ABlkDev/ADskA.HC diff --git a/public/src/Adam/ABlkDev/ADskB.HC b/public/Wb/Adam/ABlkDev/ADskB.HC similarity index 100% rename from public/src/Adam/ABlkDev/ADskB.HC rename to public/Wb/Adam/ABlkDev/ADskB.HC diff --git a/public/src/Adam/ABlkDev/DskChk.HC b/public/Wb/Adam/ABlkDev/DskChk.HC similarity index 100% rename from public/src/Adam/ABlkDev/DskChk.HC rename to public/Wb/Adam/ABlkDev/DskChk.HC diff --git a/public/src/Adam/ABlkDev/DskPrt.HC b/public/Wb/Adam/ABlkDev/DskPrt.HC similarity index 100% rename from public/src/Adam/ABlkDev/DskPrt.HC rename to public/Wb/Adam/ABlkDev/DskPrt.HC diff --git a/public/src/Adam/ABlkDev/FileMgr.HC b/public/Wb/Adam/ABlkDev/FileMgr.HC similarity index 100% rename from public/src/Adam/ABlkDev/FileMgr.HC rename to public/Wb/Adam/ABlkDev/FileMgr.HC diff --git a/public/src/Adam/ABlkDev/MakeABlkDev.HC b/public/Wb/Adam/ABlkDev/MakeABlkDev.HC similarity index 100% rename from public/src/Adam/ABlkDev/MakeABlkDev.HC rename to public/Wb/Adam/ABlkDev/MakeABlkDev.HC diff --git a/public/src/Adam/ABlkDev/Mount.HC b/public/Wb/Adam/ABlkDev/Mount.HC similarity index 100% rename from public/src/Adam/ABlkDev/Mount.HC rename to public/Wb/Adam/ABlkDev/Mount.HC diff --git a/public/src/Adam/ADbg.HC b/public/Wb/Adam/ADbg.HC similarity index 100% rename from public/src/Adam/ADbg.HC rename to public/Wb/Adam/ADbg.HC diff --git a/public/src/Adam/ADefine.HC b/public/Wb/Adam/ADefine.HC similarity index 100% rename from public/src/Adam/ADefine.HC rename to public/Wb/Adam/ADefine.HC diff --git a/public/src/Adam/AExts.HC b/public/Wb/Adam/AExts.HC similarity index 100% rename from public/src/Adam/AExts.HC rename to public/Wb/Adam/AExts.HC diff --git a/public/src/Adam/AHash.HC b/public/Wb/Adam/AHash.HC similarity index 100% rename from public/src/Adam/AHash.HC rename to public/Wb/Adam/AHash.HC diff --git a/public/src/Adam/AMath.HC b/public/Wb/Adam/AMath.HC similarity index 100% rename from public/src/Adam/AMath.HC rename to public/Wb/Adam/AMath.HC diff --git a/public/src/Adam/AMathODE.HC b/public/Wb/Adam/AMathODE.HC similarity index 100% rename from public/src/Adam/AMathODE.HC rename to public/Wb/Adam/AMathODE.HC diff --git a/public/src/Adam/AMem.HC b/public/Wb/Adam/AMem.HC similarity index 100% rename from public/src/Adam/AMem.HC rename to public/Wb/Adam/AMem.HC diff --git a/public/src/Adam/AMouse.HC b/public/Wb/Adam/AMouse.HC similarity index 100% rename from public/src/Adam/AMouse.HC rename to public/Wb/Adam/AMouse.HC diff --git a/public/src/Adam/ARegistry.HC b/public/Wb/Adam/ARegistry.HC similarity index 100% rename from public/src/Adam/ARegistry.HC rename to public/Wb/Adam/ARegistry.HC diff --git a/public/src/Adam/ASnd.HC b/public/Wb/Adam/ASnd.HC similarity index 100% rename from public/src/Adam/ASnd.HC rename to public/Wb/Adam/ASnd.HC diff --git a/public/src/Adam/AutoComplete/ACDictGen.HC b/public/Wb/Adam/AutoComplete/ACDictGen.HC similarity index 100% rename from public/src/Adam/AutoComplete/ACDictGen.HC rename to public/Wb/Adam/AutoComplete/ACDictGen.HC diff --git a/public/src/Adam/AutoComplete/ACFill.HC b/public/Wb/Adam/AutoComplete/ACFill.HC similarity index 100% rename from public/src/Adam/AutoComplete/ACFill.HC rename to public/Wb/Adam/AutoComplete/ACFill.HC diff --git a/public/src/Adam/AutoComplete/ACInit.HC b/public/Wb/Adam/AutoComplete/ACInit.HC similarity index 100% rename from public/src/Adam/AutoComplete/ACInit.HC rename to public/Wb/Adam/AutoComplete/ACInit.HC diff --git a/public/src/Adam/AutoComplete/ACTask.HC b/public/Wb/Adam/AutoComplete/ACTask.HC similarity index 100% rename from public/src/Adam/AutoComplete/ACTask.HC rename to public/Wb/Adam/AutoComplete/ACTask.HC diff --git a/public/src/Adam/AutoComplete/MakeAC.HC b/public/Wb/Adam/AutoComplete/MakeAC.HC similarity index 100% rename from public/src/Adam/AutoComplete/MakeAC.HC rename to public/Wb/Adam/AutoComplete/MakeAC.HC diff --git a/public/src/Adam/CPURep.HC b/public/Wb/Adam/CPURep.HC similarity index 100% rename from public/src/Adam/CPURep.HC rename to public/Wb/Adam/CPURep.HC diff --git a/public/src/Adam/Ctrls/CtrlsA.HC b/public/Wb/Adam/Ctrls/CtrlsA.HC similarity index 100% rename from public/src/Adam/Ctrls/CtrlsA.HC rename to public/Wb/Adam/Ctrls/CtrlsA.HC diff --git a/public/src/Adam/Ctrls/CtrlsBttn.HC b/public/Wb/Adam/Ctrls/CtrlsBttn.HC similarity index 100% rename from public/src/Adam/Ctrls/CtrlsBttn.HC rename to public/Wb/Adam/Ctrls/CtrlsBttn.HC diff --git a/public/src/Adam/Ctrls/CtrlsSlider.HC b/public/Wb/Adam/Ctrls/CtrlsSlider.HC similarity index 100% rename from public/src/Adam/Ctrls/CtrlsSlider.HC rename to public/Wb/Adam/Ctrls/CtrlsSlider.HC diff --git a/public/src/Adam/Ctrls/MakeCtrls.HC b/public/Wb/Adam/Ctrls/MakeCtrls.HC similarity index 100% rename from public/src/Adam/Ctrls/MakeCtrls.HC rename to public/Wb/Adam/Ctrls/MakeCtrls.HC diff --git a/public/src/Adam/DevInfo.HC b/public/Wb/Adam/DevInfo.HC similarity index 100% rename from public/src/Adam/DevInfo.HC rename to public/Wb/Adam/DevInfo.HC diff --git a/public/src/Adam/DolDoc/DocBin.HC b/public/Wb/Adam/DolDoc/DocBin.HC similarity index 100% rename from public/src/Adam/DolDoc/DocBin.HC rename to public/Wb/Adam/DolDoc/DocBin.HC diff --git a/public/src/Adam/DolDoc/DocChar.HC b/public/Wb/Adam/DolDoc/DocChar.HC similarity index 100% rename from public/src/Adam/DolDoc/DocChar.HC rename to public/Wb/Adam/DolDoc/DocChar.HC diff --git a/public/src/Adam/DolDoc/DocClipBoard.HC b/public/Wb/Adam/DolDoc/DocClipBoard.HC similarity index 100% rename from public/src/Adam/DolDoc/DocClipBoard.HC rename to public/Wb/Adam/DolDoc/DocClipBoard.HC diff --git a/public/src/Adam/DolDoc/DocCodeTools.HC b/public/Wb/Adam/DolDoc/DocCodeTools.HC similarity index 100% rename from public/src/Adam/DolDoc/DocCodeTools.HC rename to public/Wb/Adam/DolDoc/DocCodeTools.HC diff --git a/public/src/Adam/DolDoc/DocDblBuf.HC b/public/Wb/Adam/DolDoc/DocDblBuf.HC similarity index 100% rename from public/src/Adam/DolDoc/DocDblBuf.HC rename to public/Wb/Adam/DolDoc/DocDblBuf.HC diff --git a/public/src/Adam/DolDoc/DocEd.HC b/public/Wb/Adam/DolDoc/DocEd.HC similarity index 100% rename from public/src/Adam/DolDoc/DocEd.HC rename to public/Wb/Adam/DolDoc/DocEd.HC diff --git a/public/src/Adam/DolDoc/DocExt.HC b/public/Wb/Adam/DolDoc/DocExt.HC similarity index 100% rename from public/src/Adam/DolDoc/DocExt.HC rename to public/Wb/Adam/DolDoc/DocExt.HC diff --git a/public/src/Adam/DolDoc/DocFile.HC b/public/Wb/Adam/DolDoc/DocFile.HC similarity index 100% rename from public/src/Adam/DolDoc/DocFile.HC rename to public/Wb/Adam/DolDoc/DocFile.HC diff --git a/public/src/Adam/DolDoc/DocFind.HC b/public/Wb/Adam/DolDoc/DocFind.HC similarity index 100% rename from public/src/Adam/DolDoc/DocFind.HC rename to public/Wb/Adam/DolDoc/DocFind.HC diff --git a/public/src/Adam/DolDoc/DocForm.HC b/public/Wb/Adam/DolDoc/DocForm.HC similarity index 100% rename from public/src/Adam/DolDoc/DocForm.HC rename to public/Wb/Adam/DolDoc/DocForm.HC diff --git a/public/src/Adam/DolDoc/DocGet.HC b/public/Wb/Adam/DolDoc/DocGet.HC similarity index 100% rename from public/src/Adam/DolDoc/DocGet.HC rename to public/Wb/Adam/DolDoc/DocGet.HC diff --git a/public/src/Adam/DolDoc/DocGr.HC b/public/Wb/Adam/DolDoc/DocGr.HC similarity index 100% rename from public/src/Adam/DolDoc/DocGr.HC rename to public/Wb/Adam/DolDoc/DocGr.HC diff --git a/public/src/Adam/DolDoc/DocHighlight.HC b/public/Wb/Adam/DolDoc/DocHighlight.HC similarity index 100% rename from public/src/Adam/DolDoc/DocHighlight.HC rename to public/Wb/Adam/DolDoc/DocHighlight.HC diff --git a/public/src/Adam/DolDoc/DocInit.HC b/public/Wb/Adam/DolDoc/DocInit.HC similarity index 100% rename from public/src/Adam/DolDoc/DocInit.HC rename to public/Wb/Adam/DolDoc/DocInit.HC diff --git a/public/src/Adam/DolDoc/DocLink.HC b/public/Wb/Adam/DolDoc/DocLink.HC similarity index 100% rename from public/src/Adam/DolDoc/DocLink.HC rename to public/Wb/Adam/DolDoc/DocLink.HC diff --git a/public/src/Adam/DolDoc/DocMacro.HC b/public/Wb/Adam/DolDoc/DocMacro.HC similarity index 100% rename from public/src/Adam/DolDoc/DocMacro.HC rename to public/Wb/Adam/DolDoc/DocMacro.HC diff --git a/public/src/Adam/DolDoc/DocNew.HC b/public/Wb/Adam/DolDoc/DocNew.HC similarity index 100% rename from public/src/Adam/DolDoc/DocNew.HC rename to public/Wb/Adam/DolDoc/DocNew.HC diff --git a/public/src/Adam/DolDoc/DocPlain.HC b/public/Wb/Adam/DolDoc/DocPlain.HC similarity index 100% rename from public/src/Adam/DolDoc/DocPlain.HC rename to public/Wb/Adam/DolDoc/DocPlain.HC diff --git a/public/src/Adam/DolDoc/DocPopUp.HC b/public/Wb/Adam/DolDoc/DocPopUp.HC similarity index 100% rename from public/src/Adam/DolDoc/DocPopUp.HC rename to public/Wb/Adam/DolDoc/DocPopUp.HC diff --git a/public/src/Adam/DolDoc/DocPutKey.HC b/public/Wb/Adam/DolDoc/DocPutKey.HC similarity index 100% rename from public/src/Adam/DolDoc/DocPutKey.HC rename to public/Wb/Adam/DolDoc/DocPutKey.HC diff --git a/public/src/Adam/DolDoc/DocPutS.HC b/public/Wb/Adam/DolDoc/DocPutS.HC similarity index 100% rename from public/src/Adam/DolDoc/DocPutS.HC rename to public/Wb/Adam/DolDoc/DocPutS.HC diff --git a/public/src/Adam/DolDoc/DocRecalc.HC b/public/Wb/Adam/DolDoc/DocRecalc.HC similarity index 100% rename from public/src/Adam/DolDoc/DocRecalc.HC rename to public/Wb/Adam/DolDoc/DocRecalc.HC diff --git a/public/src/Adam/DolDoc/DocRecalcLib.HC b/public/Wb/Adam/DolDoc/DocRecalcLib.HC similarity index 100% rename from public/src/Adam/DolDoc/DocRecalcLib.HC rename to public/Wb/Adam/DolDoc/DocRecalcLib.HC diff --git a/public/src/Adam/DolDoc/DocRun.HC b/public/Wb/Adam/DolDoc/DocRun.HC similarity index 100% rename from public/src/Adam/DolDoc/DocRun.HC rename to public/Wb/Adam/DolDoc/DocRun.HC diff --git a/public/src/Adam/DolDoc/DocTerm.HC b/public/Wb/Adam/DolDoc/DocTerm.HC similarity index 100% rename from public/src/Adam/DolDoc/DocTerm.HC rename to public/Wb/Adam/DolDoc/DocTerm.HC diff --git a/public/src/Adam/DolDoc/DocTree.HC b/public/Wb/Adam/DolDoc/DocTree.HC similarity index 100% rename from public/src/Adam/DolDoc/DocTree.HC rename to public/Wb/Adam/DolDoc/DocTree.HC diff --git a/public/src/Adam/DolDoc/DocWidgetWiz.HC b/public/Wb/Adam/DolDoc/DocWidgetWiz.HC similarity index 100% rename from public/src/Adam/DolDoc/DocWidgetWiz.HC rename to public/Wb/Adam/DolDoc/DocWidgetWiz.HC diff --git a/public/src/Adam/DolDoc/MakeDoc.HC b/public/Wb/Adam/DolDoc/MakeDoc.HC similarity index 100% rename from public/src/Adam/DolDoc/MakeDoc.HC rename to public/Wb/Adam/DolDoc/MakeDoc.HC diff --git a/public/src/Adam/God/GodBible.HC b/public/Wb/Adam/God/GodBible.HC similarity index 100% rename from public/src/Adam/God/GodBible.HC rename to public/Wb/Adam/God/GodBible.HC diff --git a/public/src/Adam/God/GodDoodle.HC b/public/Wb/Adam/God/GodDoodle.HC similarity index 100% rename from public/src/Adam/God/GodDoodle.HC rename to public/Wb/Adam/God/GodDoodle.HC diff --git a/public/src/Adam/God/GodExt.HC b/public/Wb/Adam/God/GodExt.HC similarity index 100% rename from public/src/Adam/God/GodExt.HC rename to public/Wb/Adam/God/GodExt.HC diff --git a/public/src/Adam/God/GodSong.HC b/public/Wb/Adam/God/GodSong.HC similarity index 100% rename from public/src/Adam/God/GodSong.HC rename to public/Wb/Adam/God/GodSong.HC diff --git a/public/src/Adam/God/HSNotes.DD.HTML b/public/Wb/Adam/God/HSNotes.DD.HTML old mode 100644 new mode 100755 similarity index 99% rename from public/src/Adam/God/HSNotes.DD.HTML rename to public/Wb/Adam/God/HSNotes.DD.HTML index 238a4ab..672c233 --- a/public/src/Adam/God/HSNotes.DD.HTML +++ b/public/Wb/Adam/God/HSNotes.DD.HTML @@ -25,7 +25,7 @@ -
+
                               The Purpose of Life
 
 The Catholic purpose of life is to know God, love God and obey God.  However, 
diff --git a/public/src/Adam/God/HolySpirit.HC b/public/Wb/Adam/God/HolySpirit.HC
similarity index 100%
rename from public/src/Adam/God/HolySpirit.HC
rename to public/Wb/Adam/God/HolySpirit.HC
diff --git a/public/src/Adam/God/MakeGod.HC b/public/Wb/Adam/God/MakeGod.HC
similarity index 100%
rename from public/src/Adam/God/MakeGod.HC
rename to public/Wb/Adam/God/MakeGod.HC
diff --git a/public/src/Adam/God/Vocab.DD.HTML b/public/Wb/Adam/God/Vocab.DD.HTML
old mode 100644
new mode 100755
similarity index 99%
rename from public/src/Adam/God/Vocab.DD.HTML
rename to public/Wb/Adam/God/Vocab.DD.HTML
index cbce3ce..ec2534e
--- a/public/src/Adam/God/Vocab.DD.HTML
+++ b/public/Wb/Adam/God/Vocab.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
 a
 abandon
 abandoned
diff --git a/public/src/Adam/Gr/GrAsm.HC b/public/Wb/Adam/Gr/GrAsm.HC
similarity index 100%
rename from public/src/Adam/Gr/GrAsm.HC
rename to public/Wb/Adam/Gr/GrAsm.HC
diff --git a/public/src/Adam/Gr/GrBitMap.HC b/public/Wb/Adam/Gr/GrBitMap.HC
similarity index 100%
rename from public/src/Adam/Gr/GrBitMap.HC
rename to public/Wb/Adam/Gr/GrBitMap.HC
diff --git a/public/src/Adam/Gr/GrComposites.HC b/public/Wb/Adam/Gr/GrComposites.HC
similarity index 100%
rename from public/src/Adam/Gr/GrComposites.HC
rename to public/Wb/Adam/Gr/GrComposites.HC
diff --git a/public/src/Adam/Gr/GrDC.HC b/public/Wb/Adam/Gr/GrDC.HC
similarity index 100%
rename from public/src/Adam/Gr/GrDC.HC
rename to public/Wb/Adam/Gr/GrDC.HC
diff --git a/public/src/Adam/Gr/GrEnd.HC b/public/Wb/Adam/Gr/GrEnd.HC
similarity index 100%
rename from public/src/Adam/Gr/GrEnd.HC
rename to public/Wb/Adam/Gr/GrEnd.HC
diff --git a/public/src/Adam/Gr/GrExt.HC b/public/Wb/Adam/Gr/GrExt.HC
similarity index 100%
rename from public/src/Adam/Gr/GrExt.HC
rename to public/Wb/Adam/Gr/GrExt.HC
diff --git a/public/src/Adam/Gr/GrGlbls.HC b/public/Wb/Adam/Gr/GrGlbls.HC
similarity index 100%
rename from public/src/Adam/Gr/GrGlbls.HC
rename to public/Wb/Adam/Gr/GrGlbls.HC
diff --git a/public/src/Adam/Gr/GrInitA.HC b/public/Wb/Adam/Gr/GrInitA.HC
similarity index 100%
rename from public/src/Adam/Gr/GrInitA.HC
rename to public/Wb/Adam/Gr/GrInitA.HC
diff --git a/public/src/Adam/Gr/GrInitB.HC b/public/Wb/Adam/Gr/GrInitB.HC
similarity index 100%
rename from public/src/Adam/Gr/GrInitB.HC
rename to public/Wb/Adam/Gr/GrInitB.HC
diff --git a/public/src/Adam/Gr/GrMath.HC b/public/Wb/Adam/Gr/GrMath.HC
similarity index 100%
rename from public/src/Adam/Gr/GrMath.HC
rename to public/Wb/Adam/Gr/GrMath.HC
diff --git a/public/src/Adam/Gr/GrPalette.HC b/public/Wb/Adam/Gr/GrPalette.HC
similarity index 100%
rename from public/src/Adam/Gr/GrPalette.HC
rename to public/Wb/Adam/Gr/GrPalette.HC
diff --git a/public/src/Adam/Gr/GrPrimatives.HC b/public/Wb/Adam/Gr/GrPrimatives.HC
similarity index 100%
rename from public/src/Adam/Gr/GrPrimatives.HC
rename to public/Wb/Adam/Gr/GrPrimatives.HC
diff --git a/public/src/Adam/Gr/GrScrn.HC b/public/Wb/Adam/Gr/GrScrn.HC
similarity index 100%
rename from public/src/Adam/Gr/GrScrn.HC
rename to public/Wb/Adam/Gr/GrScrn.HC
diff --git a/public/src/Adam/Gr/GrSpritePlot.HC b/public/Wb/Adam/Gr/GrSpritePlot.HC
similarity index 100%
rename from public/src/Adam/Gr/GrSpritePlot.HC
rename to public/Wb/Adam/Gr/GrSpritePlot.HC
diff --git a/public/src/Adam/Gr/GrTextBase.HC b/public/Wb/Adam/Gr/GrTextBase.HC
similarity index 100%
rename from public/src/Adam/Gr/GrTextBase.HC
rename to public/Wb/Adam/Gr/GrTextBase.HC
diff --git a/public/src/Adam/Gr/MakeGr.HC b/public/Wb/Adam/Gr/MakeGr.HC
similarity index 100%
rename from public/src/Adam/Gr/MakeGr.HC
rename to public/Wb/Adam/Gr/MakeGr.HC
diff --git a/public/src/Adam/Gr/ScrnCast.HC b/public/Wb/Adam/Gr/ScrnCast.HC
similarity index 100%
rename from public/src/Adam/Gr/ScrnCast.HC
rename to public/Wb/Adam/Gr/ScrnCast.HC
diff --git a/public/src/Adam/Gr/SpriteBitMap.HC b/public/Wb/Adam/Gr/SpriteBitMap.HC
similarity index 100%
rename from public/src/Adam/Gr/SpriteBitMap.HC
rename to public/Wb/Adam/Gr/SpriteBitMap.HC
diff --git a/public/src/Adam/Gr/SpriteCode.HC b/public/Wb/Adam/Gr/SpriteCode.HC
similarity index 100%
rename from public/src/Adam/Gr/SpriteCode.HC
rename to public/Wb/Adam/Gr/SpriteCode.HC
diff --git a/public/src/Adam/Gr/SpriteEd.HC b/public/Wb/Adam/Gr/SpriteEd.HC
similarity index 100%
rename from public/src/Adam/Gr/SpriteEd.HC
rename to public/Wb/Adam/Gr/SpriteEd.HC
diff --git a/public/src/Adam/Gr/SpriteMain.HC b/public/Wb/Adam/Gr/SpriteMain.HC
similarity index 100%
rename from public/src/Adam/Gr/SpriteMain.HC
rename to public/Wb/Adam/Gr/SpriteMain.HC
diff --git a/public/src/Adam/Gr/SpriteMesh.HC b/public/Wb/Adam/Gr/SpriteMesh.HC
similarity index 100%
rename from public/src/Adam/Gr/SpriteMesh.HC
rename to public/Wb/Adam/Gr/SpriteMesh.HC
diff --git a/public/src/Adam/Gr/SpriteNew.HC b/public/Wb/Adam/Gr/SpriteNew.HC
similarity index 100%
rename from public/src/Adam/Gr/SpriteNew.HC
rename to public/Wb/Adam/Gr/SpriteNew.HC
diff --git a/public/src/Adam/Gr/SpriteSideBar.HC b/public/Wb/Adam/Gr/SpriteSideBar.HC
similarity index 100%
rename from public/src/Adam/Gr/SpriteSideBar.HC
rename to public/Wb/Adam/Gr/SpriteSideBar.HC
diff --git a/public/src/Adam/Host.HC b/public/Wb/Adam/Host.HC
similarity index 100%
rename from public/src/Adam/Host.HC
rename to public/Wb/Adam/Host.HC
diff --git a/public/src/Adam/InFile.HC b/public/Wb/Adam/InFile.HC
similarity index 100%
rename from public/src/Adam/InFile.HC
rename to public/Wb/Adam/InFile.HC
diff --git a/public/src/Adam/InsReg.HC b/public/Wb/Adam/InsReg.HC
similarity index 100%
rename from public/src/Adam/InsReg.HC
rename to public/Wb/Adam/InsReg.HC
diff --git a/public/src/Adam/MakeAdam.HC b/public/Wb/Adam/MakeAdam.HC
similarity index 100%
rename from public/src/Adam/MakeAdam.HC
rename to public/Wb/Adam/MakeAdam.HC
diff --git a/public/src/Adam/Menu.HC b/public/Wb/Adam/Menu.HC
similarity index 100%
rename from public/src/Adam/Menu.HC
rename to public/Wb/Adam/Menu.HC
diff --git a/public/src/Adam/Opt/Boot/BootDVD.HC b/public/Wb/Adam/Opt/Boot/BootDVD.HC
similarity index 100%
rename from public/src/Adam/Opt/Boot/BootDVD.HC
rename to public/Wb/Adam/Opt/Boot/BootDVD.HC
diff --git a/public/src/Adam/Opt/Boot/BootDVDIns.HC b/public/Wb/Adam/Opt/Boot/BootDVDIns.HC
similarity index 100%
rename from public/src/Adam/Opt/Boot/BootDVDIns.HC
rename to public/Wb/Adam/Opt/Boot/BootDVDIns.HC
diff --git a/public/src/Adam/Opt/Boot/BootHD.HC b/public/Wb/Adam/Opt/Boot/BootHD.HC
similarity index 100%
rename from public/src/Adam/Opt/Boot/BootHD.HC
rename to public/Wb/Adam/Opt/Boot/BootHD.HC
diff --git a/public/src/Adam/Opt/Boot/BootHDIns.HC b/public/Wb/Adam/Opt/Boot/BootHDIns.HC
similarity index 100%
rename from public/src/Adam/Opt/Boot/BootHDIns.HC
rename to public/Wb/Adam/Opt/Boot/BootHDIns.HC
diff --git a/public/src/Adam/Opt/Boot/BootMHD.HC b/public/Wb/Adam/Opt/Boot/BootMHD.HC
similarity index 100%
rename from public/src/Adam/Opt/Boot/BootMHD.HC
rename to public/Wb/Adam/Opt/Boot/BootMHD.HC
diff --git a/public/src/Adam/Opt/Boot/BootMHD2.HC b/public/Wb/Adam/Opt/Boot/BootMHD2.HC
similarity index 100%
rename from public/src/Adam/Opt/Boot/BootMHD2.HC
rename to public/Wb/Adam/Opt/Boot/BootMHD2.HC
diff --git a/public/src/Adam/Opt/Boot/BootMHDIns.HC b/public/Wb/Adam/Opt/Boot/BootMHDIns.HC
similarity index 100%
rename from public/src/Adam/Opt/Boot/BootMHDIns.HC
rename to public/Wb/Adam/Opt/Boot/BootMHDIns.HC
diff --git a/public/src/Adam/Opt/Boot/BootRAM.HC b/public/Wb/Adam/Opt/Boot/BootRAM.HC
similarity index 100%
rename from public/src/Adam/Opt/Boot/BootRAM.HC
rename to public/Wb/Adam/Opt/Boot/BootRAM.HC
diff --git a/public/src/Adam/Opt/Boot/DskISORedSea.HC b/public/Wb/Adam/Opt/Boot/DskISORedSea.HC
similarity index 100%
rename from public/src/Adam/Opt/Boot/DskISORedSea.HC
rename to public/Wb/Adam/Opt/Boot/DskISORedSea.HC
diff --git a/public/src/Adam/Opt/Boot/MakeBoot.HC b/public/Wb/Adam/Opt/Boot/MakeBoot.HC
similarity index 100%
rename from public/src/Adam/Opt/Boot/MakeBoot.HC
rename to public/Wb/Adam/Opt/Boot/MakeBoot.HC
diff --git a/public/src/Adam/Opt/Utils/Diff.HC b/public/Wb/Adam/Opt/Utils/Diff.HC
similarity index 100%
rename from public/src/Adam/Opt/Utils/Diff.HC
rename to public/Wb/Adam/Opt/Utils/Diff.HC
diff --git a/public/src/Adam/Opt/Utils/DocUtils.HC b/public/Wb/Adam/Opt/Utils/DocUtils.HC
similarity index 100%
rename from public/src/Adam/Opt/Utils/DocUtils.HC
rename to public/Wb/Adam/Opt/Utils/DocUtils.HC
diff --git a/public/src/Adam/Opt/Utils/Find.HC b/public/Wb/Adam/Opt/Utils/Find.HC
similarity index 100%
rename from public/src/Adam/Opt/Utils/Find.HC
rename to public/Wb/Adam/Opt/Utils/Find.HC
diff --git a/public/src/Adam/Opt/Utils/HeapLog.HC b/public/Wb/Adam/Opt/Utils/HeapLog.HC
similarity index 100%
rename from public/src/Adam/Opt/Utils/HeapLog.HC
rename to public/Wb/Adam/Opt/Utils/HeapLog.HC
diff --git a/public/src/Adam/Opt/Utils/LineRep.HC b/public/Wb/Adam/Opt/Utils/LineRep.HC
similarity index 100%
rename from public/src/Adam/Opt/Utils/LineRep.HC
rename to public/Wb/Adam/Opt/Utils/LineRep.HC
diff --git a/public/src/Adam/Opt/Utils/LinkChk.HC b/public/Wb/Adam/Opt/Utils/LinkChk.HC
similarity index 100%
rename from public/src/Adam/Opt/Utils/LinkChk.HC
rename to public/Wb/Adam/Opt/Utils/LinkChk.HC
diff --git a/public/src/Adam/Opt/Utils/MakeUtils.HC b/public/Wb/Adam/Opt/Utils/MakeUtils.HC
similarity index 100%
rename from public/src/Adam/Opt/Utils/MakeUtils.HC
rename to public/Wb/Adam/Opt/Utils/MakeUtils.HC
diff --git a/public/src/Adam/Opt/Utils/MemRep.HC b/public/Wb/Adam/Opt/Utils/MemRep.HC
similarity index 100%
rename from public/src/Adam/Opt/Utils/MemRep.HC
rename to public/Wb/Adam/Opt/Utils/MemRep.HC
diff --git a/public/src/Adam/Opt/Utils/Merge.HC b/public/Wb/Adam/Opt/Utils/Merge.HC
similarity index 100%
rename from public/src/Adam/Opt/Utils/Merge.HC
rename to public/Wb/Adam/Opt/Utils/Merge.HC
diff --git a/public/src/Adam/Opt/Utils/Profiler.HC b/public/Wb/Adam/Opt/Utils/Profiler.HC
similarity index 100%
rename from public/src/Adam/Opt/Utils/Profiler.HC
rename to public/Wb/Adam/Opt/Utils/Profiler.HC
diff --git a/public/src/Adam/Opt/Utils/StrUtils.HC b/public/Wb/Adam/Opt/Utils/StrUtils.HC
similarity index 100%
rename from public/src/Adam/Opt/Utils/StrUtils.HC
rename to public/Wb/Adam/Opt/Utils/StrUtils.HC
diff --git a/public/src/Adam/Opt/Utils/TOS.HC b/public/Wb/Adam/Opt/Utils/TOS.HC
similarity index 100%
rename from public/src/Adam/Opt/Utils/TOS.HC
rename to public/Wb/Adam/Opt/Utils/TOS.HC
diff --git a/public/src/Adam/Opt/Utils/ToDolDoc.HC b/public/Wb/Adam/Opt/Utils/ToDolDoc.HC
similarity index 100%
rename from public/src/Adam/Opt/Utils/ToDolDoc.HC
rename to public/Wb/Adam/Opt/Utils/ToDolDoc.HC
diff --git a/public/src/Adam/Opt/Utils/ToTXT.HC b/public/Wb/Adam/Opt/Utils/ToTXT.HC
similarity index 100%
rename from public/src/Adam/Opt/Utils/ToTXT.HC
rename to public/Wb/Adam/Opt/Utils/ToTXT.HC
diff --git a/public/src/Adam/TaskRep.HC b/public/Wb/Adam/TaskRep.HC
similarity index 100%
rename from public/src/Adam/TaskRep.HC
rename to public/Wb/Adam/TaskRep.HC
diff --git a/public/src/Adam/TaskSettings.HC b/public/Wb/Adam/TaskSettings.HC
similarity index 100%
rename from public/src/Adam/TaskSettings.HC
rename to public/Wb/Adam/TaskSettings.HC
diff --git a/public/src/Adam/Training.HC b/public/Wb/Adam/Training.HC
similarity index 100%
rename from public/src/Adam/Training.HC
rename to public/Wb/Adam/Training.HC
diff --git a/public/src/Adam/WallPaper.HC b/public/Wb/Adam/WallPaper.HC
similarity index 100%
rename from public/src/Adam/WallPaper.HC
rename to public/Wb/Adam/WallPaper.HC
diff --git a/public/src/Adam/Win.HC b/public/Wb/Adam/Win.HC
similarity index 100%
rename from public/src/Adam/Win.HC
rename to public/Wb/Adam/Win.HC
diff --git a/public/src/Adam/WinMgr.HC b/public/Wb/Adam/WinMgr.HC
similarity index 100%
rename from public/src/Adam/WinMgr.HC
rename to public/Wb/Adam/WinMgr.HC
diff --git a/public/src/Apps/Budget/Accts.DD.HTML b/public/Wb/Apps/Budget/Accts.DD.HTML
old mode 100644
new mode 100755
similarity index 95%
rename from public/src/Apps/Budget/Accts.DD.HTML
rename to public/Wb/Apps/Budget/Accts.DD.HTML
index 0fa14e0..e404ab6
--- a/public/src/Apps/Budget/Accts.DD.HTML
+++ b/public/Wb/Apps/Budget/Accts.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
 JOB
 BANK
 CREDIT
diff --git a/public/src/Apps/Budget/BgtAccts.HC b/public/Wb/Apps/Budget/BgtAccts.HC
similarity index 100%
rename from public/src/Apps/Budget/BgtAccts.HC
rename to public/Wb/Apps/Budget/BgtAccts.HC
diff --git a/public/src/Apps/Budget/BgtEntry.HC b/public/Wb/Apps/Budget/BgtEntry.HC
similarity index 100%
rename from public/src/Apps/Budget/BgtEntry.HC
rename to public/Wb/Apps/Budget/BgtEntry.HC
diff --git a/public/src/Apps/Budget/BgtFile.HC b/public/Wb/Apps/Budget/BgtFile.HC
similarity index 100%
rename from public/src/Apps/Budget/BgtFile.HC
rename to public/Wb/Apps/Budget/BgtFile.HC
diff --git a/public/src/Apps/Budget/BgtMain.HC b/public/Wb/Apps/Budget/BgtMain.HC
similarity index 100%
rename from public/src/Apps/Budget/BgtMain.HC
rename to public/Wb/Apps/Budget/BgtMain.HC
diff --git a/public/src/Apps/Budget/BgtStrs.HC b/public/Wb/Apps/Budget/BgtStrs.HC
similarity index 100%
rename from public/src/Apps/Budget/BgtStrs.HC
rename to public/Wb/Apps/Budget/BgtStrs.HC
diff --git a/public/src/Apps/Budget/BgtTemplate.HC b/public/Wb/Apps/Budget/BgtTemplate.HC
similarity index 100%
rename from public/src/Apps/Budget/BgtTemplate.HC
rename to public/Wb/Apps/Budget/BgtTemplate.HC
diff --git a/public/src/Apps/Budget/Budget.HC b/public/Wb/Apps/Budget/Budget.HC
similarity index 100%
rename from public/src/Apps/Budget/Budget.HC
rename to public/Wb/Apps/Budget/Budget.HC
diff --git a/public/src/Apps/Budget/Install.HC b/public/Wb/Apps/Budget/Install.HC
similarity index 100%
rename from public/src/Apps/Budget/Install.HC
rename to public/Wb/Apps/Budget/Install.HC
diff --git a/public/src/Apps/Budget/Load.HC b/public/Wb/Apps/Budget/Load.HC
similarity index 100%
rename from public/src/Apps/Budget/Load.HC
rename to public/Wb/Apps/Budget/Load.HC
diff --git a/public/src/Apps/Budget/Run.HC b/public/Wb/Apps/Budget/Run.HC
similarity index 100%
rename from public/src/Apps/Budget/Run.HC
rename to public/Wb/Apps/Budget/Run.HC
diff --git a/public/src/Apps/GrModels/BallGen.HC b/public/Wb/Apps/GrModels/BallGen.HC
similarity index 100%
rename from public/src/Apps/GrModels/BallGen.HC
rename to public/Wb/Apps/GrModels/BallGen.HC
diff --git a/public/src/Apps/GrModels/Load.HC b/public/Wb/Apps/GrModels/Load.HC
similarity index 100%
rename from public/src/Apps/GrModels/Load.HC
rename to public/Wb/Apps/GrModels/Load.HC
diff --git a/public/src/Apps/GrModels/ManGen.HC b/public/Wb/Apps/GrModels/ManGen.HC
similarity index 100%
rename from public/src/Apps/GrModels/ManGen.HC
rename to public/Wb/Apps/GrModels/ManGen.HC
diff --git a/public/src/Apps/GrModels/Models.HC b/public/Wb/Apps/GrModels/Models.HC
similarity index 100%
rename from public/src/Apps/GrModels/Models.HC
rename to public/Wb/Apps/GrModels/Models.HC
diff --git a/public/src/Apps/GrModels/Run.HC b/public/Wb/Apps/GrModels/Run.HC
similarity index 100%
rename from public/src/Apps/GrModels/Run.HC
rename to public/Wb/Apps/GrModels/Run.HC
diff --git a/public/src/Apps/KeepAway/KeepAway.HC b/public/Wb/Apps/KeepAway/KeepAway.HC
similarity index 100%
rename from public/src/Apps/KeepAway/KeepAway.HC
rename to public/Wb/Apps/KeepAway/KeepAway.HC
diff --git a/public/src/Apps/KeepAway/Load.HC b/public/Wb/Apps/KeepAway/Load.HC
similarity index 100%
rename from public/src/Apps/KeepAway/Load.HC
rename to public/Wb/Apps/KeepAway/Load.HC
diff --git a/public/src/Apps/KeepAway/Run.HC b/public/Wb/Apps/KeepAway/Run.HC
similarity index 100%
rename from public/src/Apps/KeepAway/Run.HC
rename to public/Wb/Apps/KeepAway/Run.HC
diff --git a/public/src/Apps/Logic/Load.HC b/public/Wb/Apps/Logic/Load.HC
similarity index 100%
rename from public/src/Apps/Logic/Load.HC
rename to public/Wb/Apps/Logic/Load.HC
diff --git a/public/src/Apps/Logic/Logic.HC b/public/Wb/Apps/Logic/Logic.HC
similarity index 100%
rename from public/src/Apps/Logic/Logic.HC
rename to public/Wb/Apps/Logic/Logic.HC
diff --git a/public/src/Apps/Logic/Run.HC b/public/Wb/Apps/Logic/Run.HC
similarity index 100%
rename from public/src/Apps/Logic/Run.HC
rename to public/Wb/Apps/Logic/Run.HC
diff --git a/public/src/Apps/Psalmody/Examples/childish.HC b/public/Wb/Apps/Psalmody/Examples/childish.HC
similarity index 100%
rename from public/src/Apps/Psalmody/Examples/childish.HC
rename to public/Wb/Apps/Psalmody/Examples/childish.HC
diff --git a/public/src/Apps/Psalmody/Examples/night.HC b/public/Wb/Apps/Psalmody/Examples/night.HC
similarity index 100%
rename from public/src/Apps/Psalmody/Examples/night.HC
rename to public/Wb/Apps/Psalmody/Examples/night.HC
diff --git a/public/src/Apps/Psalmody/Examples/prosper.HC b/public/Wb/Apps/Psalmody/Examples/prosper.HC
similarity index 100%
rename from public/src/Apps/Psalmody/Examples/prosper.HC
rename to public/Wb/Apps/Psalmody/Examples/prosper.HC
diff --git a/public/src/Apps/Psalmody/Help.DD.HTML b/public/Wb/Apps/Psalmody/Help.DD.HTML
old mode 100644
new mode 100755
similarity index 60%
rename from public/src/Apps/Psalmody/Help.DD.HTML
rename to public/Wb/Apps/Psalmody/Help.DD.HTML
index fba8bec..f08e448
--- a/public/src/Apps/Psalmody/Help.DD.HTML
+++ b/public/Wb/Apps/Psalmody/Help.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                                  Psalmody Help
 
 * The keyboard can be used as an organ by typing letter keys or clicking the 
@@ -35,23 +35,23 @@
 
 * The clip can be used to cut and paste.
 
-* Psalmody uses HolyC files as the song format!  See 
-::/Apps/Psalmody/Examples/prosper.HC.  The Psalmody program does not fully parse 
+* Psalmody uses HolyC files as the song format!  See 
+::/Apps/Psalmody/Examples/prosper.HC.  The Psalmody program does not fully parse 
 the songs when loading them back in, so changes made outside Psalmody will be 
 lost, like if you add graphics.
 
-* The first line of the HolyC song files is a comment with a category recognized 
-by JukeBox().  The categories are "no nothing", "has words", "has graphics", or 
+* The first line of the HolyC song files is a comment with a category recognized 
+by JukeBox().  The categories are "no nothing", "has words", "has graphics", or 
 "special".  The third character in the song comment is a digit rating number, 
-shown in JukeBox().  You can set the song rating in JukeBox() by pressing 0-9.  
+shown in JukeBox().  You can set the song rating in JukeBox() by pressing 0-9.  
 You can request your reward from God by pressing r.  You can press <DEL> to 
 delete songs.
 
-* You can take the Play() stmts out of a song file and place them in your 
+* You can take the Play() stmts out of a song file and place them in your 
 programs.  You can also add a song to a document with <CTRL-l>, but you should 
 do it after pressing <CTRL-t> because the clip-insert in <CTRL-l> is screwy.  
 See this <Song> after pressing <CTRL-t>, now.
 
-* You can call JukeBox("~/Psalmody"); to play your songs.
+* You can call JukeBox("~/Psalmody"); to play your songs.
 
diff --git a/public/src/Apps/Psalmody/Install.HC b/public/Wb/Apps/Psalmody/Install.HC similarity index 100% rename from public/src/Apps/Psalmody/Install.HC rename to public/Wb/Apps/Psalmody/Install.HC diff --git a/public/src/Apps/Psalmody/JukeBox.HC b/public/Wb/Apps/Psalmody/JukeBox.HC similarity index 100% rename from public/src/Apps/Psalmody/JukeBox.HC rename to public/Wb/Apps/Psalmody/JukeBox.HC diff --git a/public/src/Apps/Psalmody/JukePuppet.HC b/public/Wb/Apps/Psalmody/JukePuppet.HC similarity index 100% rename from public/src/Apps/Psalmody/JukePuppet.HC rename to public/Wb/Apps/Psalmody/JukePuppet.HC diff --git a/public/src/Apps/Psalmody/Load.HC b/public/Wb/Apps/Psalmody/Load.HC similarity index 100% rename from public/src/Apps/Psalmody/Load.HC rename to public/Wb/Apps/Psalmody/Load.HC diff --git a/public/src/Apps/Psalmody/Psalmody.HC b/public/Wb/Apps/Psalmody/Psalmody.HC similarity index 100% rename from public/src/Apps/Psalmody/Psalmody.HC rename to public/Wb/Apps/Psalmody/Psalmody.HC diff --git a/public/src/Apps/Psalmody/PsalmodyCtrls.HC b/public/Wb/Apps/Psalmody/PsalmodyCtrls.HC similarity index 100% rename from public/src/Apps/Psalmody/PsalmodyCtrls.HC rename to public/Wb/Apps/Psalmody/PsalmodyCtrls.HC diff --git a/public/src/Apps/Psalmody/PsalmodyDraw.HC b/public/Wb/Apps/Psalmody/PsalmodyDraw.HC similarity index 100% rename from public/src/Apps/Psalmody/PsalmodyDraw.HC rename to public/Wb/Apps/Psalmody/PsalmodyDraw.HC diff --git a/public/src/Apps/Psalmody/PsalmodyFile.HC b/public/Wb/Apps/Psalmody/PsalmodyFile.HC similarity index 100% rename from public/src/Apps/Psalmody/PsalmodyFile.HC rename to public/Wb/Apps/Psalmody/PsalmodyFile.HC diff --git a/public/src/Apps/Psalmody/PsalmodyMain.HC b/public/Wb/Apps/Psalmody/PsalmodyMain.HC similarity index 100% rename from public/src/Apps/Psalmody/PsalmodyMain.HC rename to public/Wb/Apps/Psalmody/PsalmodyMain.HC diff --git a/public/src/Apps/Psalmody/Run.HC b/public/Wb/Apps/Psalmody/Run.HC similarity index 100% rename from public/src/Apps/Psalmody/Run.HC rename to public/Wb/Apps/Psalmody/Run.HC diff --git a/public/src/Apps/Span/Install.HC b/public/Wb/Apps/Span/Install.HC similarity index 100% rename from public/src/Apps/Span/Install.HC rename to public/Wb/Apps/Span/Install.HC diff --git a/public/src/Apps/Span/Load.HC b/public/Wb/Apps/Span/Load.HC similarity index 100% rename from public/src/Apps/Span/Load.HC rename to public/Wb/Apps/Span/Load.HC diff --git a/public/src/Apps/Span/Run.HC b/public/Wb/Apps/Span/Run.HC similarity index 100% rename from public/src/Apps/Span/Run.HC rename to public/Wb/Apps/Span/Run.HC diff --git a/public/src/Apps/Span/SpanBridge.HC b/public/Wb/Apps/Span/SpanBridge.HC similarity index 100% rename from public/src/Apps/Span/SpanBridge.HC rename to public/Wb/Apps/Span/SpanBridge.HC diff --git a/public/src/Apps/Span/SpanDerive.HC b/public/Wb/Apps/Span/SpanDerive.HC similarity index 100% rename from public/src/Apps/Span/SpanDerive.HC rename to public/Wb/Apps/Span/SpanDerive.HC diff --git a/public/src/Apps/Span/SpanMain.HC b/public/Wb/Apps/Span/SpanMain.HC similarity index 100% rename from public/src/Apps/Span/SpanMain.HC rename to public/Wb/Apps/Span/SpanMain.HC diff --git a/public/src/Apps/Span/SpanNew.HC b/public/Wb/Apps/Span/SpanNew.HC similarity index 100% rename from public/src/Apps/Span/SpanNew.HC rename to public/Wb/Apps/Span/SpanNew.HC diff --git a/public/src/Apps/Strut/Load.HC b/public/Wb/Apps/Strut/Load.HC similarity index 100% rename from public/src/Apps/Strut/Load.HC rename to public/Wb/Apps/Strut/Load.HC diff --git a/public/src/Apps/Strut/Run.HC b/public/Wb/Apps/Strut/Run.HC similarity index 100% rename from public/src/Apps/Strut/Run.HC rename to public/Wb/Apps/Strut/Run.HC diff --git a/public/src/Apps/Strut/Strut.HC b/public/Wb/Apps/Strut/Strut.HC similarity index 100% rename from public/src/Apps/Strut/Strut.HC rename to public/Wb/Apps/Strut/Strut.HC diff --git a/public/src/Apps/TimeClock/Install.HC b/public/Wb/Apps/TimeClock/Install.HC similarity index 100% rename from public/src/Apps/TimeClock/Install.HC rename to public/Wb/Apps/TimeClock/Install.HC diff --git a/public/src/Apps/TimeClock/Load.HC b/public/Wb/Apps/TimeClock/Load.HC similarity index 100% rename from public/src/Apps/TimeClock/Load.HC rename to public/Wb/Apps/TimeClock/Load.HC diff --git a/public/src/Apps/TimeClock/TimeClk.HC b/public/Wb/Apps/TimeClock/TimeClk.HC similarity index 100% rename from public/src/Apps/TimeClock/TimeClk.HC rename to public/Wb/Apps/TimeClock/TimeClk.HC diff --git a/public/src/Apps/Titanium/Load.HC b/public/Wb/Apps/Titanium/Load.HC similarity index 100% rename from public/src/Apps/Titanium/Load.HC rename to public/Wb/Apps/Titanium/Load.HC diff --git a/public/src/Apps/Titanium/Run.HC b/public/Wb/Apps/Titanium/Run.HC similarity index 100% rename from public/src/Apps/Titanium/Run.HC rename to public/Wb/Apps/Titanium/Run.HC diff --git a/public/src/Apps/Titanium/Titanium.HC b/public/Wb/Apps/Titanium/Titanium.HC similarity index 100% rename from public/src/Apps/Titanium/Titanium.HC rename to public/Wb/Apps/Titanium/Titanium.HC diff --git a/public/src/Apps/ToTheFront/AIs/Human.HC b/public/Wb/Apps/ToTheFront/AIs/Human.HC similarity index 100% rename from public/src/Apps/ToTheFront/AIs/Human.HC rename to public/Wb/Apps/ToTheFront/AIs/Human.HC diff --git a/public/src/Apps/ToTheFront/AIs/SimpleAI.HC b/public/Wb/Apps/ToTheFront/AIs/SimpleAI.HC similarity index 100% rename from public/src/Apps/ToTheFront/AIs/SimpleAI.HC rename to public/Wb/Apps/ToTheFront/AIs/SimpleAI.HC diff --git a/public/src/Apps/ToTheFront/Install.HC b/public/Wb/Apps/ToTheFront/Install.HC similarity index 100% rename from public/src/Apps/ToTheFront/Install.HC rename to public/Wb/Apps/ToTheFront/Install.HC diff --git a/public/src/Apps/ToTheFront/Load.HC b/public/Wb/Apps/ToTheFront/Load.HC similarity index 100% rename from public/src/Apps/ToTheFront/Load.HC rename to public/Wb/Apps/ToTheFront/Load.HC diff --git a/public/src/Apps/ToTheFront/Run.HC b/public/Wb/Apps/ToTheFront/Run.HC similarity index 100% rename from public/src/Apps/ToTheFront/Run.HC rename to public/Wb/Apps/ToTheFront/Run.HC diff --git a/public/src/Apps/ToTheFront/TTFDraw.HC b/public/Wb/Apps/ToTheFront/TTFDraw.HC similarity index 100% rename from public/src/Apps/ToTheFront/TTFDraw.HC rename to public/Wb/Apps/ToTheFront/TTFDraw.HC diff --git a/public/src/Apps/ToTheFront/TTFFire.HC b/public/Wb/Apps/ToTheFront/TTFFire.HC similarity index 100% rename from public/src/Apps/ToTheFront/TTFFire.HC rename to public/Wb/Apps/ToTheFront/TTFFire.HC diff --git a/public/src/Apps/ToTheFront/TTFGlbls.HC b/public/Wb/Apps/ToTheFront/TTFGlbls.HC similarity index 100% rename from public/src/Apps/ToTheFront/TTFGlbls.HC rename to public/Wb/Apps/ToTheFront/TTFGlbls.HC diff --git a/public/src/Apps/ToTheFront/TTFInit.HC b/public/Wb/Apps/ToTheFront/TTFInit.HC similarity index 100% rename from public/src/Apps/ToTheFront/TTFInit.HC rename to public/Wb/Apps/ToTheFront/TTFInit.HC diff --git a/public/src/Apps/ToTheFront/TTFLib.HC b/public/Wb/Apps/ToTheFront/TTFLib.HC similarity index 100% rename from public/src/Apps/ToTheFront/TTFLib.HC rename to public/Wb/Apps/ToTheFront/TTFLib.HC diff --git a/public/src/Apps/ToTheFront/TTFMove.HC b/public/Wb/Apps/ToTheFront/TTFMove.HC similarity index 100% rename from public/src/Apps/ToTheFront/TTFMove.HC rename to public/Wb/Apps/ToTheFront/TTFMove.HC diff --git a/public/src/Apps/ToTheFront/TTFVis.HC b/public/Wb/Apps/ToTheFront/TTFVis.HC similarity index 100% rename from public/src/Apps/ToTheFront/TTFVis.HC rename to public/Wb/Apps/ToTheFront/TTFVis.HC diff --git a/public/src/Apps/ToTheFront/ToTheFront.HC b/public/Wb/Apps/ToTheFront/ToTheFront.HC similarity index 100% rename from public/src/Apps/ToTheFront/ToTheFront.HC rename to public/Wb/Apps/ToTheFront/ToTheFront.HC diff --git a/public/src/Apps/Vocabulary/Load.HC b/public/Wb/Apps/Vocabulary/Load.HC similarity index 100% rename from public/src/Apps/Vocabulary/Load.HC rename to public/Wb/Apps/Vocabulary/Load.HC diff --git a/public/src/Apps/Vocabulary/Run.HC b/public/Wb/Apps/Vocabulary/Run.HC similarity index 100% rename from public/src/Apps/Vocabulary/Run.HC rename to public/Wb/Apps/Vocabulary/Run.HC diff --git a/public/src/Apps/Vocabulary/VocabQuiz.HC b/public/Wb/Apps/Vocabulary/VocabQuiz.HC similarity index 100% rename from public/src/Apps/Vocabulary/VocabQuiz.HC rename to public/Wb/Apps/Vocabulary/VocabQuiz.HC diff --git a/public/src/Apps/X-Caliber/Load.HC b/public/Wb/Apps/X-Caliber/Load.HC similarity index 100% rename from public/src/Apps/X-Caliber/Load.HC rename to public/Wb/Apps/X-Caliber/Load.HC diff --git a/public/src/Apps/X-Caliber/Run.HC b/public/Wb/Apps/X-Caliber/Run.HC similarity index 100% rename from public/src/Apps/X-Caliber/Run.HC rename to public/Wb/Apps/X-Caliber/Run.HC diff --git a/public/src/Apps/X-Caliber/X-Caliber.HC b/public/Wb/Apps/X-Caliber/X-Caliber.HC similarity index 100% rename from public/src/Apps/X-Caliber/X-Caliber.HC rename to public/Wb/Apps/X-Caliber/X-Caliber.HC diff --git a/public/src/Apps/X-Caliber/XCCtrls.HC b/public/Wb/Apps/X-Caliber/XCCtrls.HC similarity index 100% rename from public/src/Apps/X-Caliber/XCCtrls.HC rename to public/Wb/Apps/X-Caliber/XCCtrls.HC diff --git a/public/src/Compiler/Asm.HC b/public/Wb/Compiler/Asm.HC similarity index 100% rename from public/src/Compiler/Asm.HC rename to public/Wb/Compiler/Asm.HC diff --git a/public/src/Compiler/AsmInit.HC b/public/Wb/Compiler/AsmInit.HC similarity index 100% rename from public/src/Compiler/AsmInit.HC rename to public/Wb/Compiler/AsmInit.HC diff --git a/public/src/Compiler/AsmLib.HC b/public/Wb/Compiler/AsmLib.HC similarity index 100% rename from public/src/Compiler/AsmLib.HC rename to public/Wb/Compiler/AsmLib.HC diff --git a/public/src/Compiler/AsmResolve.HC b/public/Wb/Compiler/AsmResolve.HC similarity index 100% rename from public/src/Compiler/AsmResolve.HC rename to public/Wb/Compiler/AsmResolve.HC diff --git a/public/src/Compiler/BackA.HC b/public/Wb/Compiler/BackA.HC similarity index 100% rename from public/src/Compiler/BackA.HC rename to public/Wb/Compiler/BackA.HC diff --git a/public/src/Compiler/BackB.HC b/public/Wb/Compiler/BackB.HC similarity index 100% rename from public/src/Compiler/BackB.HC rename to public/Wb/Compiler/BackB.HC diff --git a/public/src/Compiler/BackC.HC b/public/Wb/Compiler/BackC.HC similarity index 100% rename from public/src/Compiler/BackC.HC rename to public/Wb/Compiler/BackC.HC diff --git a/public/src/Compiler/BackFA.HC b/public/Wb/Compiler/BackFA.HC similarity index 100% rename from public/src/Compiler/BackFA.HC rename to public/Wb/Compiler/BackFA.HC diff --git a/public/src/Compiler/BackFB.HC b/public/Wb/Compiler/BackFB.HC similarity index 100% rename from public/src/Compiler/BackFB.HC rename to public/Wb/Compiler/BackFB.HC diff --git a/public/src/Compiler/BackLib.HC b/public/Wb/Compiler/BackLib.HC similarity index 100% rename from public/src/Compiler/BackLib.HC rename to public/Wb/Compiler/BackLib.HC diff --git a/public/src/Compiler/CExcept.HC b/public/Wb/Compiler/CExcept.HC similarity index 100% rename from public/src/Compiler/CExcept.HC rename to public/Wb/Compiler/CExcept.HC diff --git a/public/src/Compiler/CExts.HC b/public/Wb/Compiler/CExts.HC similarity index 100% rename from public/src/Compiler/CExts.HC rename to public/Wb/Compiler/CExts.HC diff --git a/public/src/Compiler/CHash.HC b/public/Wb/Compiler/CHash.HC similarity index 100% rename from public/src/Compiler/CHash.HC rename to public/Wb/Compiler/CHash.HC diff --git a/public/src/Compiler/CInit.HC b/public/Wb/Compiler/CInit.HC similarity index 100% rename from public/src/Compiler/CInit.HC rename to public/Wb/Compiler/CInit.HC diff --git a/public/src/Compiler/CMain.HC b/public/Wb/Compiler/CMain.HC similarity index 100% rename from public/src/Compiler/CMain.HC rename to public/Wb/Compiler/CMain.HC diff --git a/public/src/Compiler/CMisc.HC b/public/Wb/Compiler/CMisc.HC similarity index 100% rename from public/src/Compiler/CMisc.HC rename to public/Wb/Compiler/CMisc.HC diff --git a/public/src/Compiler/Lex.HC b/public/Wb/Compiler/Lex.HC similarity index 100% rename from public/src/Compiler/Lex.HC rename to public/Wb/Compiler/Lex.HC diff --git a/public/src/Compiler/LexLib.HC b/public/Wb/Compiler/LexLib.HC similarity index 100% rename from public/src/Compiler/LexLib.HC rename to public/Wb/Compiler/LexLib.HC diff --git a/public/src/Compiler/OpCodes.DD.HTML b/public/Wb/Compiler/OpCodes.DD.HTML old mode 100644 new mode 100755 similarity index 99% rename from public/src/Compiler/OpCodes.DD.HTML rename to public/Wb/Compiler/OpCodes.DD.HTML index b8c5fc5..11e4342 --- a/public/src/Compiler/OpCodes.DD.HTML +++ b/public/Wb/Compiler/OpCodes.DD.HTML @@ -25,8 +25,8 @@ -
-/* See AsmHashLoad().
+
+/* See AsmHashLoad().
 
 '!'= IEF_DONT_SWITCH_MODES
 '&'= IEF_DFT
diff --git a/public/src/Compiler/OptLib.HC b/public/Wb/Compiler/OptLib.HC
similarity index 100%
rename from public/src/Compiler/OptLib.HC
rename to public/Wb/Compiler/OptLib.HC
diff --git a/public/src/Compiler/OptPass012.HC b/public/Wb/Compiler/OptPass012.HC
similarity index 100%
rename from public/src/Compiler/OptPass012.HC
rename to public/Wb/Compiler/OptPass012.HC
diff --git a/public/src/Compiler/OptPass3.HC b/public/Wb/Compiler/OptPass3.HC
similarity index 100%
rename from public/src/Compiler/OptPass3.HC
rename to public/Wb/Compiler/OptPass3.HC
diff --git a/public/src/Compiler/OptPass4.HC b/public/Wb/Compiler/OptPass4.HC
similarity index 100%
rename from public/src/Compiler/OptPass4.HC
rename to public/Wb/Compiler/OptPass4.HC
diff --git a/public/src/Compiler/OptPass5.HC b/public/Wb/Compiler/OptPass5.HC
similarity index 100%
rename from public/src/Compiler/OptPass5.HC
rename to public/Wb/Compiler/OptPass5.HC
diff --git a/public/src/Compiler/OptPass6.HC b/public/Wb/Compiler/OptPass6.HC
similarity index 100%
rename from public/src/Compiler/OptPass6.HC
rename to public/Wb/Compiler/OptPass6.HC
diff --git a/public/src/Compiler/OptPass789A.HC b/public/Wb/Compiler/OptPass789A.HC
similarity index 100%
rename from public/src/Compiler/OptPass789A.HC
rename to public/Wb/Compiler/OptPass789A.HC
diff --git a/public/src/Compiler/PrsExp.HC b/public/Wb/Compiler/PrsExp.HC
similarity index 100%
rename from public/src/Compiler/PrsExp.HC
rename to public/Wb/Compiler/PrsExp.HC
diff --git a/public/src/Compiler/PrsLib.HC b/public/Wb/Compiler/PrsLib.HC
similarity index 100%
rename from public/src/Compiler/PrsLib.HC
rename to public/Wb/Compiler/PrsLib.HC
diff --git a/public/src/Compiler/PrsStmt.HC b/public/Wb/Compiler/PrsStmt.HC
similarity index 100%
rename from public/src/Compiler/PrsStmt.HC
rename to public/Wb/Compiler/PrsStmt.HC
diff --git a/public/src/Compiler/PrsVar.HC b/public/Wb/Compiler/PrsVar.HC
similarity index 100%
rename from public/src/Compiler/PrsVar.HC
rename to public/Wb/Compiler/PrsVar.HC
diff --git a/public/src/Compiler/Templates.HC b/public/Wb/Compiler/Templates.HC
similarity index 100%
rename from public/src/Compiler/Templates.HC
rename to public/Wb/Compiler/Templates.HC
diff --git a/public/src/Compiler/UAsm.HC b/public/Wb/Compiler/UAsm.HC
similarity index 100%
rename from public/src/Compiler/UAsm.HC
rename to public/Wb/Compiler/UAsm.HC
diff --git a/public/src/Demo/AcctExample/HomeKeyPlugIns.HC b/public/Wb/Demo/AcctExample/HomeKeyPlugIns.HC
similarity index 100%
rename from public/src/Demo/AcctExample/HomeKeyPlugIns.HC
rename to public/Wb/Demo/AcctExample/HomeKeyPlugIns.HC
diff --git a/public/src/Demo/AcctExample/HomeLocalize.HC b/public/Wb/Demo/AcctExample/HomeLocalize.HC
similarity index 100%
rename from public/src/Demo/AcctExample/HomeLocalize.HC
rename to public/Wb/Demo/AcctExample/HomeLocalize.HC
diff --git a/public/src/Demo/AcctExample/HomeSys.HC b/public/Wb/Demo/AcctExample/HomeSys.HC
similarity index 100%
rename from public/src/Demo/AcctExample/HomeSys.HC
rename to public/Wb/Demo/AcctExample/HomeSys.HC
diff --git a/public/src/Demo/AcctExample/HomeWrappers.HC b/public/Wb/Demo/AcctExample/HomeWrappers.HC
similarity index 100%
rename from public/src/Demo/AcctExample/HomeWrappers.HC
rename to public/Wb/Demo/AcctExample/HomeWrappers.HC
diff --git a/public/src/Demo/AcctExample/MakeHome.HC b/public/Wb/Demo/AcctExample/MakeHome.HC
similarity index 100%
rename from public/src/Demo/AcctExample/MakeHome.HC
rename to public/Wb/Demo/AcctExample/MakeHome.HC
diff --git a/public/src/Demo/AcctExample/Once.HC b/public/Wb/Demo/AcctExample/Once.HC
similarity index 100%
rename from public/src/Demo/AcctExample/Once.HC
rename to public/Wb/Demo/AcctExample/Once.HC
diff --git a/public/src/Demo/AcctExample/PersonalMenu.DD.HTML b/public/Wb/Demo/AcctExample/PersonalMenu.DD.HTML
old mode 100644
new mode 100755
similarity index 99%
rename from public/src/Demo/AcctExample/PersonalMenu.DD.HTML
rename to public/Wb/Demo/AcctExample/PersonalMenu.DD.HTML
index 81ef1d8..ed6f9f8
--- a/public/src/Demo/AcctExample/PersonalMenu.DD.HTML
+++ b/public/Wb/Demo/AcctExample/PersonalMenu.DD.HTML
@@ -26,7 +26,7 @@
 
 
 
-
+
 Cd      DrvC    DrvD    /       Home    TOS     ChgDskT MergeD  MergeT  
 MakeC   BootC   Regen   PreRegenMakeD   BootD   CopyDrv 
 Adam    Kernel  CompilerBlkDev  Mem     Serial  
diff --git a/public/src/Demo/AcctExample/PersonalNotes.DD.HTML b/public/Wb/Demo/AcctExample/PersonalNotes.DD.HTML
old mode 100644
new mode 100755
similarity index 57%
rename from public/src/Demo/AcctExample/PersonalNotes.DD.HTML
rename to public/Wb/Demo/AcctExample/PersonalNotes.DD.HTML
index 9d8012c..aa9adab
--- a/public/src/Demo/AcctExample/PersonalNotes.DD.HTML
+++ b/public/Wb/Demo/AcctExample/PersonalNotes.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                                       TODO
 
 * Get rid of niggerlicious name "binary".
@@ -40,7 +40,7 @@
 
 * DskChk CDROM
 
-* Compiler Bug: AUWrite() dst->cdt=t0_now+ToI64(CDATE_FREQ*(tmpsd->tS-t0_tS));
+* Compiler Bug: AUWrite() dst->cdt=t0_now+ToI64(CDATE_FREQ*(tmpsd->tS-t0_tS));
 
 * Make MV files combine disjoint rects for same frame.
 
@@ -50,14 +50,14 @@
 
 * Does entire tool chain support super/sub script?
 
-* 170624 DskChk() showed extra alloced clus for FAT32, Sup1Hymns.  ClusNum was 
+* 170624 DskChk() showed extra alloced clus for FAT32, Sup1Hymns.  ClusNum was 
 '.'+1 and clus was zero.
 
-* ::/Apps/X-Caliber/X-Caliber.HC
+* ::/Apps/X-Caliber/X-Caliber.HC
 * Add asteroid harbor defense.
 * Afterburner thruster.
 
-* ::/Apps/Titanium/Titanium.HC
+* ::/Apps/Titanium/Titanium.HC
 * Lead-in at start of game with no enemy.
 * Have highway of death.
 * Fix straight shooting.
@@ -66,20 +66,20 @@
 
 * 64-Bit Device Memory is not implemented.
 
-* Investigate why packet loss Training Sleep(1).
+* Investigate why packet loss Training Sleep(1).
 
 * Add AVL or red/black binary tree library support.  We have fixed-size stack.  
 Auto-balancing binary tree is very needed.  I've done everything myself.  I 
 don't want to ruin a perfect record.  I'm in no hurry.
 
-* SpriteEd shift pts, Ctrl pt for ellipse/polygon w,h is off when rotated.
+* SpriteEd shift pts, Ctrl pt for ellipse/polygon w,h is off when rotated.
 
-* God said this is bad.  FL:::/Adam/DolDoc/DocFind.HC,41
+* God said this is bad.  FL:::/Adam/DolDoc/DocFind.HC,41
 * Backward <SHIFT-F3> is broken?
 
-* Find() search sprite text?
+* Find() search sprite text?
 
-* Cannot include ':' in Document Links search string.
+* Cannot include ':' in Document Links search string.
 * $DA fixed width string: <Del> or <BACKSPACE> permanently shortens.
 
 * 11/19/16 editor took long time after copying old testament onto clip and 
@@ -92,13 +92,13 @@
 * Editor overstrike mode at cmd line with menu macro?  Probably, many other 
 overstrike issues.
 
-* DOCT_HEX_ED with odd size, ASCII cannot be edited.
+* DOCT_HEX_ED with odd size, ASCII cannot be edited.
 
-* FL:::/Adam/Gr/SpriteEd.HC,789 Resize bitmap?
+* FL:::/Adam/Gr/SpriteEd.HC,789 Resize bitmap?
 
-* DOCEF_REMALLOC_DATA HexEdit Remalloc.
+* DOCEF_REMALLOC_DATA HexEdit Remalloc.
 
-* DOCF_DBL_DOLLARS in Reindention.
+* DOCF_DBL_DOLLARS in Reindention.
 
 * Compiler Optimization: Local array vars --> reg.  Might exist.
 
@@ -111,30 +111,30 @@
 * 12/25/2015 Copy-Paste index.html glitch if source window 40 columns.
 * 01/06/2016 Editor filter "str" applied to output from LineRep looks broken.
 
-* Document, perhaps with video, GetStr() all the way down into PutKey() code.
+* Document, perhaps with video, GetStr() all the way down into PutKey() code.
 
 * Better dictionary.
 * Good spell checker.
 * Good Bible search.
 
-* Can MEM_EXTRA_HASH2_PAGS be just one?
+* Can MEM_EXTRA_HASH2_PAGS be just one?
 
-* Bible ranges in BibleVerse(). 
+* Bible ranges in BibleVerse(). 
 
-* ::/Demo/Games/FlatTops.HC is torpedo, not bombs.
+* ::/Demo/Games/FlatTops.HC is torpedo, not bombs.
 
-* Reset MPs with Core0StartMP() after boot.  Free old task memory?
+* Reset MPs with Core0StartMP() after boot.  Free old task memory?
 
 * Use thick and pen_height when clipping with thick>1.
 
-* ~/Sup1/Sup1Games/Rocks.HC.
+* ~/Sup1/Sup1Games/Rocks.HC.
 
 * Asm LIST NOLIST bugs.
 
-* Review writing to same cache-line from multicore.  Do CTask->task_flags and 
+* Review writing to same cache-line from multicore.  Do CTask->task_flags and 
 others need to be in separate cache lines?
 
-* Fix KbdLEDsSet().
+* Fix KbdLEDsSet().
 * NumLock comes on with break key.
 
 * Hymns: mightest, finger
@@ -142,14 +142,14 @@
 * Get rid of JIFFY and HPET and just use tS.
 
 * Use "Rosetta Stone" in documentaion pointing to this: 
-::/Demo/ToHtmlToTXTDemo/ToHtml.HC.
+::/Demo/ToHtmlToTXTDemo/ToHtml.HC.
 
 * Change %h*c so the character is not a arg?
 
-* GrLineFat3() needs a little work.
+* GrLineFat3() needs a little work.
 
-* GrFillTri0() with both GrHLine() and GrVLine() don't match in 
-::/Demo/Games/CastleFrankenstein.HC causing wall spot pixels.
+* GrFillTri0() with both GrHLine() and GrVLine() don't match in 
+::/Demo/Games/CastleFrankenstein.HC causing wall spot pixels.
 
 
                                    TODO? Meh
@@ -159,20 +159,20 @@
 
 * Asm could support R4u8 by adding 0x40 byte.
 
-* Mem32DevAlloc() is broken.  Devices should be in free spot of E820 report.
+* Mem32DevAlloc() is broken.  Devices should be in free spot of E820 report.
 
-* SpriteEd: Strip SPT_SHIFT origin cmds?
+* SpriteEd: Strip SPT_SHIFT origin cmds?
 
 * Clean-up ASCII #127 delete char?  (No. Maybe, we want a new usage for 127 in 
 future centuries.)
 
-* Compiler: Exceptions don't free CCmpCtrl stuff.
+* Compiler: Exceptions don't free CCmpCtrl stuff.
 
-* ::/Adam/DolDoc/DocHighlight.HC for code comments at top of documents.
+* ::/Adam/DolDoc/DocHighlight.HC for code comments at top of documents.
 
 * Unhandled exception msgs from MP's get overwritten by WinMgr.
 
-* Diff("C:/Misc/Bible.TXT","D:/Misc/Bible.TXT"); Takes too long.
+* Diff("C:/Misc/Bible.TXT","D:/Misc/Bible.TXT"); Takes too long.
 
 * Finish Pilgrim game.
 
@@ -183,22 +183,22 @@
 
 
                       TODO: Too Hard, or Not Worth Doing.
-* AutoComplete/Man() Jmp for user code.
+* AutoComplete/Man() Jmp for user code.
 
-* Bible sized nodes
+* Bible sized nodes
 
-* FileMgr() is bad with lots of files.  
+* FileMgr() is bad with lots of files.  
 
 * Would be nice to have a routine telling how much free memory, so apps can plan 
 a big alloc.  This is doable, depending on how.
 
 * Log-to-file is inefficient because we load and save whole file.
 
-* ICMov() PUSH_CMP and MDf_STK?  Perhaps, it's okay.
+* ICMov() PUSH_CMP and MDf_STK?  Perhaps, it's okay.
 
 * Short FAT32 ~ names.
 
-* Find() search text in sprites.
+* Find() search text in sprites.
 
 * Links in text in sprites. 
 
@@ -210,56 +210,56 @@
        U0 (*fp_old_draw_ms)(CDC *dc,I64 x,I64 y)=gr.fp_draw_ms;
      }
 
-* Compiler: Get rid of 0x20000 limit.
+* Compiler: Get rid of 0x20000 limit.
 
-* GrFloodFillRay: Get rid of 0x80000 limit.
+* GrFloodFillRay: Get rid of 0x80000 limit.
 
 
                                       Bugs
-* 1/28/16 ::/Demo/Graphics/Pick3D.HC crashed in TestSuite.
+* 1/28/16 ::/Demo/Graphics/Pick3D.HC crashed in TestSuite.
 
 * 1/12/16 make RAM drive 2288 blks, CopyTree("C:/Home","B:/Home");   Disk 
 runs-out of space and hangs instead of reporting errors.
 
-* Bug introduced around 11/1/15.  Changed ::/Kernel/Sched.HC and now WinToTop is 
+* Bug introduced around 11/1/15.  Changed ::/Kernel/Sched.HC and now WinToTop is 
 called on Adam task at start-up, sometimes.  Might be user's fault because of 
 bad keys pressed during VMware power-on init.  Might be fixed by 
-ACf_INIT_IN_PROGRESS.
+ACf_INIT_IN_PROGRESS.
 
-* 1/12/16 ATARepEntry shows corrupted bttns.  Weird.  Perhaps, my imagination.
+* 1/12/16 ATARepEntry shows corrupted bttns.  Weird.  Perhaps, my imagination.
 
 
                                  3rd Party Bugs
 * VMware: Stretch to full scrn
 * VMware: PC speaker sound distorted.
 * VMware: 8/2/2015 start-up. Probably multicore.
-* VMware: CtrlAltDel on <CTRL-ALT-INS>
+* VMware: CtrlAltDel on <CTRL-ALT-INS>
 * VMware: Size zero files don't copy out of mounted disk?  (Might be fixed.)
 
 
                              Bugs? Not really sure.
-* Mount() crashes on bad drive.
+* Mount() crashes on bad drive.
 
 * Graphics clipping: scrn y+top<0 for top<0?
 
 * 1/1/2015 Bug messing-up keyboard, like no CTRL key.  Was working on Sprites.
 
-* 4/13/14 Strut or RawHide crashed when sys_var_init_flag was set during 
+* 4/13/14 Strut or RawHide crashed when sys_var_init_flag was set during 
 testsuite.  Perhaps, floodfill?
 
-* DskChk alloc unalloced.  I don't know if I fixed this.
+* DskChk alloc unalloced.  I don't know if I fixed this.
 
 * 1/?/2015,8/10/2015 Macro sel in Menu did not go to shell?  No, I think just 
 <CTRL-m> twice.  Not a bug.
 
-* 5/7/14:Something like InSetMs caused hang, then reboot in TestSuite.
-* 5/7/14:#63 Maybe, ::/Demo/Graphics/Pick3D.HC crashed in TestSuite.
+* 5/7/14:Something like InSetMs caused hang, then reboot in TestSuite.
+* 5/7/14:#63 Maybe, ::/Demo/Graphics/Pick3D.HC crashed in TestSuite.
 
-* StrPrintJoin(,st); With st="\n\\"; (Forgot what this is talking about.)
+* StrPrintJoin(,st); With st="\n\\"; (Forgot what this is talking about.)
 
 
                          TODO? Not really, just angst.
-* Should these be moved into CHashClass from CMemberLst and CHashGlblVar?
+* Should these be moved into CHashClass from CMemberLst and CHashGlblVar?
      CArrayDim dim;
      CHashFun *fun_ptr;
 
@@ -269,19 +269,19 @@
 
 * Might want to warn switch[] dup case numbers.
 
-* Make Clamp(), Min(), Max() into asm routines?
+* Make Clamp(), Min(), Max() into asm routines?
 
-* Add local vars to sym table in Dbg()?
+* Add local vars to sym table in Dbg()?
 
 * Compiler: Prints two error messages for expressions in stmts.
 
-* U() negative byte displacement, neg 32-bit disp.
+* U() negative byte displacement, neg 32-bit disp.
 
-* Race condition in ::/Demo/Games/FlatTops.HC torpedo.
+* Race condition in ::/Demo/Games/FlatTops.HC torpedo.
 
-* Links to self document if empty file name? Document Links
+* Links to self document if empty file name? Document Links
 
-* FUF_RECURSE would be nice if capital "+R".
+* FUF_RECURSE would be nice if capital "+R".
 
 * Sprites in cmd line code.
 
@@ -292,9 +292,9 @@
 * Compiler: Type for either F64 or I64, like Print -- no conversion.
 * Compiler: Arg type ... that did do conversion, if we have one that doesn't.
 
-* R("char_bmp_","set_");
+* R("char_bmp_","set_");
 
-* Clean-up code FileNameAbs(), does it need so many local var names?  I guess no 
+* Clean-up code FileNameAbs(), does it need so many local var names?  I guess no 
 choice.
 
 
@@ -305,41 +305,41 @@
 
 * Should we get rid of drive mapping.  It's ugly.
 
-* Can we get rid of MSG_CMD?
+* Can we get rid of MSG_CMD?
 
 * Make so just CdRom; command to copy entire disk to ::/CdRom directory? 
 
-* MP DepthBuf is a kludge because of dc->depth_buf=NULL in various graphics 
+* MP DepthBuf is a kludge because of dc->depth_buf=NULL in various graphics 
 routines.
 
 * Improve editor undo, add redo.
 
 * Compiler: F32?
 
-* International Date output: MPrintDate().  Every country make own version?
-* International Date input: Str2Date().
+* International Date output: MPrintDate().  Every country make own version?
+* International Date input: Str2Date().
 
-* DCF_SYMMETRY before transformation? (Currently, it's after.) 
+* DCF_SYMMETRY before transformation? (Currently, it's after.) 
 
-* TRANSPARENT does not work with ROPF_DITHER.
+* TRANSPARENT does not work with ROPF_DITHER.
 
-* ROP_XOR with thick>1 is broken.
+* ROP_XOR with thick>1 is broken.
 
-* GrPutChar3() with depth buf?
+* GrPutChar3() with depth buf?
 
-* Eliminate?  ::/Adam/Ctrls/CtrlsA.HC?
-* Eliminate?  ::/Adam/AMathODE.HC?
-* Eliminate?  Complex?
-* Eliminate?  CDC.brush?
-* Eliminate?  Mat4x4MulXYZ() change to 3x3?
-* Eliminate?  ROP_XOR?
+* Eliminate?  ::/Adam/Ctrls/CtrlsA.HC?
+* Eliminate?  ::/Adam/AMathODE.HC?
+* Eliminate?  Complex?
+* Eliminate?  CDC.brush?
+* Eliminate?  Mat4x4MulXYZ() change to 3x3?
+* Eliminate?  ROP_XOR?
 
-* WinMgrTask needs to do doc operations on PostMsg() msgs for ms_hard.  Already 
-works for MsSet()?
+* WinMgrTask needs to do doc operations on PostMsg() msgs for ms_hard.  Already 
+works for MsSet()?
 
 * Should Msgs in PopUp queue get fwded to parent when task dies?
 
-* Import Intel datasheets so we can use links in Code for documentation.  I 
+* Import Intel datasheets so we can use links in Code for documentation.  I 
 tried a PDF-to-text convertor and it wasn't acceptible.
 
 * Switch stmt with sparse cases?  Maybe, ban sparse switch stmts.
@@ -349,26 +349,26 @@
 
 * Compiler: Local var array/struct initialization.
 
-* Compiler Optimization: Bools use r,rm in ICCmp() like in ICCmpAndBranch()?
+* Compiler Optimization: Bools use r,rm in ICCmp() like in ICCmpAndBranch()?
 
 * Compiler: !F64 ~F64
 
 * Compiler: &=, |= can overflow with Bts Btr on small data types?
 
-* Implement RS_ATTR_FIXED fixed pos files?
+* Implement RS_ATTR_FIXED fixed pos files?
 
-* SIMD in Mat4x4MulXYZ?
+* SIMD in Mat4x4MulXYZ?
 
-* I use fixed-point in Circle(), Ellipse(), Mat4x4MulXYZ(), Mat4x4MulMat4x4New() 
+* I use fixed-point in Circle(), Ellipse(), Mat4x4MulXYZ(), Mat4x4MulMat4x4New() 
 and others.  God says I might want to change to float.  
-::/Demo/Lectures/FixedPoint.HC ::/Demo/Lectures/FixedPointAdvanced.HC.
+::/Demo/Lectures/FixedPoint.HC ::/Demo/Lectures/FixedPointAdvanced.HC.
 
-* Note: We will never put multiple Keyboard Tables.  Each country must make 
-their own version of TempleOS.  The Intel Factory ROM will have just English.  
-Our Charter bans multiple country or architectures in the same version.
+* Note: We will never put multiple Keyboard Tables.  Each country must make 
+their own version of TempleOS.  The Intel Factory ROM will have just English.  
+Our Charter bans multiple country or architectures in the same version.
 
-* 12 border chars in scrn font codes 0x02-0x0D.  TextBorder() RawDr() 
-::/Demo/Games/CharDemo.HC. LineFeed shows-up in <CTRL-m> PersonalMenu.
+* 12 border chars in scrn font codes 0x02-0x0D.  TextBorder() RawDr() 
+::/Demo/Games/CharDemo.HC. LineFeed shows-up in <CTRL-m> PersonalMenu.
 
 * Super-simple high speed serial needs flow control.  <CTRL-s> and <CTRL-q>?
 
@@ -393,10 +393,10 @@
 
 * New editor widgets.
 
-* Make use of flag potential in FilesFind() and possibly DirContextNew().
-* Sort options for FilesFind()?
+* Make use of flag potential in FilesFind() and possibly DirContextNew().
+* Sort options for FilesFind()?
 
-* New HolyC language features?
+* New HolyC language features?
 
 * Better Debugging?
 
@@ -406,7 +406,7 @@
 
 * Ticketmaster format stmts? Overflow "t='*'" and padding character?
 
-* Move stuff out of Kernel module.
+* Move stuff out of Kernel module.
 
 * $LK,L="FL:D:/Kernel/File.HC"$ instead of A=
 * $SP,B=1$ instead of $SP,BI=1$
@@ -415,13 +415,13 @@
 * DCF_TRANSFORMATION|DCF_SYMMETRY|DCF_JUST_MIRROR -- maybe not both needed at 
 once.
 
-* More Controls?
+* More Controls?
 
 * Compiler: More use of more floating-point stk?
 
-* Compiler: More aggressive in CmpF2PushPop() with types besides MOV and F64. 
+* Compiler: More aggressive in CmpF2PushPop() with types besides MOV and F64. 
 
-* Playing with ::/Demo/Lectures/NegDisp.HC on CTask?
+* Playing with ::/Demo/Lectures/NegDisp.HC on CTask?
      $=-CTASK_NEG_OFFSET
      offset(CTask.addr)==0
      Spawn(): CAlloc()
@@ -433,46 +433,46 @@
 
 
                                       Test
-* SpriteBitMap: Grabscroll? 
+* SpriteBitMap: Grabscroll? 
 
-* DrvMap() in MountFile().
+* DrvMap() in MountFile().
 
-* Return ress for GrBlot, GrRect, GrPutChar?
-* Collision cnts for GrBlot, GrRect, GrPutChar?
+* Return ress for GrBlot, GrRect, GrPutChar?
+* Collision cnts for GrBlot, GrRect, GrPutChar?
 
-* GetStr() or GetChar() in OSInstall didn't like focus change.
+* GetStr() or GetChar() in OSInstall didn't like focus change.
 
 * Test on Dad's computer or other people's?
 
-* ICDivEqu() assumes RBX.  Is it okay?
+* ICDivEqu() assumes RBX.  Is it okay?
 
 * InFile PopUp of PopUp?
 
-* FileMgr() help link scrolls out of window.
+* FileMgr() help link scrolls out of window.
 
-* MsHardDrvrInstall() throws exceptions?  Doesn't work?  Why mouse 0x9FC30?
+* MsHardDrvrInstall() throws exceptions?  Doesn't work?  Why mouse 0x9FC30?
 
 * VirtualBox MP reboot?
 
 * Compiler: Err/Warn line nums?
 * Asm branch-out-of-range warn by one line?
 
-* Make sure queue links safe in one direction.  Task QueIns and QueRem for 
+* Make sure queue links safe in one direction.  Task QueIns and QueRem for 
 multicore cycling fwd through tasks.
 
-* Test removable media id and RS_ATTR_RESIDENT.  Touch("","+T");
+* Test removable media id and RS_ATTR_RESIDENT.  Touch("","+T");
 
 
                                  Uncategorized
-* DiskCache during FileRead. <CTRL-ALT-c>, Kill().  
+* DiskCache during FileRead. <CTRL-ALT-c>, Kill().  
 
 * MOV U8 [RSP+RCX],DL
 
-* gr.scrn_image
+* gr.scrn_image
   >Might want to do ZOOM in U8 graphics and convert scrn capture to U8
   >Might want to rev bit order
 
-* This Fs->catch_except=TRUE causes problems because it
+* This Fs->catch_except=TRUE causes problems because it
 catches divide and out-of-mem.  Not sure what to do, yet.
 
 * Release semaphores or break lock sema,usb_td
@@ -480,7 +480,7 @@
 * Might make CSprite flood fill operate on a separate bitmap
 and blotted at the end.
 * <CTRL-r> delete subsprite in menu near others
-* make better heapwalk, do something with _CFG_HEAP_DBG.
+* make better heapwalk, do something with _CFG_HEAP_DBG.
 
 * static var off of data heap.
 * could add "const" to not set CCF_NOT_CONST flag for trig, etc.
diff --git a/public/src/Demo/AcctExample/Registry.HC b/public/Wb/Demo/AcctExample/Registry.HC
similarity index 100%
rename from public/src/Demo/AcctExample/Registry.HC
rename to public/Wb/Demo/AcctExample/Registry.HC
diff --git a/public/src/Demo/AcctExample/TOS/MakeTOS.HC b/public/Wb/Demo/AcctExample/TOS/MakeTOS.HC
similarity index 100%
rename from public/src/Demo/AcctExample/TOS/MakeTOS.HC
rename to public/Wb/Demo/AcctExample/TOS/MakeTOS.HC
diff --git a/public/src/Demo/AcctExample/TOS/TOSCfg.HC b/public/Wb/Demo/AcctExample/TOS/TOSCfg.HC
similarity index 100%
rename from public/src/Demo/AcctExample/TOS/TOSCfg.HC
rename to public/Wb/Demo/AcctExample/TOS/TOSCfg.HC
diff --git a/public/src/Demo/AcctExample/TOS/TOSDistro.HC b/public/Wb/Demo/AcctExample/TOS/TOSDistro.HC
similarity index 100%
rename from public/src/Demo/AcctExample/TOS/TOSDistro.HC
rename to public/Wb/Demo/AcctExample/TOS/TOSDistro.HC
diff --git a/public/src/Demo/AcctExample/TOS/TOSExt.HC b/public/Wb/Demo/AcctExample/TOS/TOSExt.HC
similarity index 100%
rename from public/src/Demo/AcctExample/TOS/TOSExt.HC
rename to public/Wb/Demo/AcctExample/TOS/TOSExt.HC
diff --git a/public/src/Demo/AcctExample/TOS/TOSMisc.HC b/public/Wb/Demo/AcctExample/TOS/TOSMisc.HC
similarity index 100%
rename from public/src/Demo/AcctExample/TOS/TOSMisc.HC
rename to public/Wb/Demo/AcctExample/TOS/TOSMisc.HC
diff --git a/public/src/Demo/AcctExample/TOS/TOSTheme.HC b/public/Wb/Demo/AcctExample/TOS/TOSTheme.HC
similarity index 100%
rename from public/src/Demo/AcctExample/TOS/TOSTheme.HC
rename to public/Wb/Demo/AcctExample/TOS/TOSTheme.HC
diff --git a/public/src/Demo/Asm/AsmAndC1.HC b/public/Wb/Demo/Asm/AsmAndC1.HC
similarity index 100%
rename from public/src/Demo/Asm/AsmAndC1.HC
rename to public/Wb/Demo/Asm/AsmAndC1.HC
diff --git a/public/src/Demo/Asm/AsmAndC2.HC b/public/Wb/Demo/Asm/AsmAndC2.HC
similarity index 100%
rename from public/src/Demo/Asm/AsmAndC2.HC
rename to public/Wb/Demo/Asm/AsmAndC2.HC
diff --git a/public/src/Demo/Asm/AsmAndC3.HC b/public/Wb/Demo/Asm/AsmAndC3.HC
similarity index 100%
rename from public/src/Demo/Asm/AsmAndC3.HC
rename to public/Wb/Demo/Asm/AsmAndC3.HC
diff --git a/public/src/Demo/Asm/AsmHelloWorld.HC b/public/Wb/Demo/Asm/AsmHelloWorld.HC
similarity index 100%
rename from public/src/Demo/Asm/AsmHelloWorld.HC
rename to public/Wb/Demo/Asm/AsmHelloWorld.HC
diff --git a/public/src/Demo/Asm/BuzzFizz.HC b/public/Wb/Demo/Asm/BuzzFizz.HC
similarity index 100%
rename from public/src/Demo/Asm/BuzzFizz.HC
rename to public/Wb/Demo/Asm/BuzzFizz.HC
diff --git a/public/src/Demo/Asm/DivByHand.HC b/public/Wb/Demo/Asm/DivByHand.HC
similarity index 100%
rename from public/src/Demo/Asm/DivByHand.HC
rename to public/Wb/Demo/Asm/DivByHand.HC
diff --git a/public/src/Demo/Asm/MulByHand.HC b/public/Wb/Demo/Asm/MulByHand.HC
similarity index 100%
rename from public/src/Demo/Asm/MulByHand.HC
rename to public/Wb/Demo/Asm/MulByHand.HC
diff --git a/public/src/Demo/Asm/PutDec.HC b/public/Wb/Demo/Asm/PutDec.HC
similarity index 100%
rename from public/src/Demo/Asm/PutDec.HC
rename to public/Wb/Demo/Asm/PutDec.HC
diff --git a/public/src/Demo/Carry.HC b/public/Wb/Demo/Carry.HC
similarity index 100%
rename from public/src/Demo/Carry.HC
rename to public/Wb/Demo/Carry.HC
diff --git a/public/src/Demo/ClassMeta.HC b/public/Wb/Demo/ClassMeta.HC
similarity index 100%
rename from public/src/Demo/ClassMeta.HC
rename to public/Wb/Demo/ClassMeta.HC
diff --git a/public/src/Demo/CompileDemo.HC b/public/Wb/Demo/CompileDemo.HC
similarity index 100%
rename from public/src/Demo/CompileDemo.HC
rename to public/Wb/Demo/CompileDemo.HC
diff --git a/public/src/Demo/DateTime.HC b/public/Wb/Demo/DateTime.HC
similarity index 100%
rename from public/src/Demo/DateTime.HC
rename to public/Wb/Demo/DateTime.HC
diff --git a/public/src/Demo/DbgDemo.HC b/public/Wb/Demo/DbgDemo.HC
similarity index 100%
rename from public/src/Demo/DbgDemo.HC
rename to public/Wb/Demo/DbgDemo.HC
diff --git a/public/src/Demo/Define.HC b/public/Wb/Demo/Define.HC
similarity index 100%
rename from public/src/Demo/Define.HC
rename to public/Wb/Demo/Define.HC
diff --git a/public/src/Demo/Directives.HC b/public/Wb/Demo/Directives.HC
similarity index 100%
rename from public/src/Demo/Directives.HC
rename to public/Wb/Demo/Directives.HC
diff --git a/public/src/Demo/DolDoc/CallBack.HC b/public/Wb/Demo/DolDoc/CallBack.HC
similarity index 100%
rename from public/src/Demo/DolDoc/CallBack.HC
rename to public/Wb/Demo/DolDoc/CallBack.HC
diff --git a/public/src/Demo/DolDoc/ClickCallBack.HC b/public/Wb/Demo/DolDoc/ClickCallBack.HC
similarity index 100%
rename from public/src/Demo/DolDoc/ClickCallBack.HC
rename to public/Wb/Demo/DolDoc/ClickCallBack.HC
diff --git a/public/src/Demo/DolDoc/CursorMove.HC b/public/Wb/Demo/DolDoc/CursorMove.HC
similarity index 100%
rename from public/src/Demo/DolDoc/CursorMove.HC
rename to public/Wb/Demo/DolDoc/CursorMove.HC
diff --git a/public/src/Demo/DolDoc/Data.HC b/public/Wb/Demo/DolDoc/Data.HC
similarity index 100%
rename from public/src/Demo/DolDoc/Data.HC
rename to public/Wb/Demo/DolDoc/Data.HC
diff --git a/public/src/Demo/DolDoc/DefineStr.HC b/public/Wb/Demo/DolDoc/DefineStr.HC
similarity index 100%
rename from public/src/Demo/DolDoc/DefineStr.HC
rename to public/Wb/Demo/DolDoc/DefineStr.HC
diff --git a/public/src/Demo/DolDoc/DemoDoc.DD.HTML b/public/Wb/Demo/DolDoc/DemoDoc.DD.HTML
old mode 100644
new mode 100755
similarity index 99%
rename from public/src/Demo/DolDoc/DemoDoc.DD.HTML
rename to public/Wb/Demo/DolDoc/DemoDoc.DD.HTML
index 83c8a9f..b811e28
--- a/public/src/Demo/DolDoc/DemoDoc.DD.HTML
+++ b/public/Wb/Demo/DolDoc/DemoDoc.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
 
 
 
diff --git a/public/src/Demo/DolDoc/FileRead.HC b/public/Wb/Demo/DolDoc/FileRead.HC
similarity index 100%
rename from public/src/Demo/DolDoc/FileRead.HC
rename to public/Wb/Demo/DolDoc/FileRead.HC
diff --git a/public/src/Demo/DolDoc/Form.HC b/public/Wb/Demo/DolDoc/Form.HC
similarity index 100%
rename from public/src/Demo/DolDoc/Form.HC
rename to public/Wb/Demo/DolDoc/Form.HC
diff --git a/public/src/Demo/DolDoc/MenuBttn.HC b/public/Wb/Demo/DolDoc/MenuBttn.HC
similarity index 100%
rename from public/src/Demo/DolDoc/MenuBttn.HC
rename to public/Wb/Demo/DolDoc/MenuBttn.HC
diff --git a/public/src/Demo/DolDoc/MenuSprite.HC b/public/Wb/Demo/DolDoc/MenuSprite.HC
similarity index 100%
rename from public/src/Demo/DolDoc/MenuSprite.HC
rename to public/Wb/Demo/DolDoc/MenuSprite.HC
diff --git a/public/src/Demo/DolDoc/NumBible.HC b/public/Wb/Demo/DolDoc/NumBible.HC
similarity index 100%
rename from public/src/Demo/DolDoc/NumBible.HC
rename to public/Wb/Demo/DolDoc/NumBible.HC
diff --git a/public/src/Demo/DolDoc/TextDemo.HC b/public/Wb/Demo/DolDoc/TextDemo.HC
similarity index 100%
rename from public/src/Demo/DolDoc/TextDemo.HC
rename to public/Wb/Demo/DolDoc/TextDemo.HC
diff --git a/public/src/Demo/DolDoc/TreeDemo.HC b/public/Wb/Demo/DolDoc/TreeDemo.HC
similarity index 100%
rename from public/src/Demo/DolDoc/TreeDemo.HC
rename to public/Wb/Demo/DolDoc/TreeDemo.HC
diff --git a/public/src/Demo/DolDoc/UnusedDefine.HC b/public/Wb/Demo/DolDoc/UnusedDefine.HC
similarity index 100%
rename from public/src/Demo/DolDoc/UnusedDefine.HC
rename to public/Wb/Demo/DolDoc/UnusedDefine.HC
diff --git a/public/src/Demo/Dsk/BlkDevRep.HC b/public/Wb/Demo/Dsk/BlkDevRep.HC
similarity index 100%
rename from public/src/Demo/Dsk/BlkDevRep.HC
rename to public/Wb/Demo/Dsk/BlkDevRep.HC
diff --git a/public/src/Demo/Dsk/DataBase.HC b/public/Wb/Demo/Dsk/DataBase.HC
similarity index 100%
rename from public/src/Demo/Dsk/DataBase.HC
rename to public/Wb/Demo/Dsk/DataBase.HC
diff --git a/public/src/Demo/Dsk/DskRaw.HC b/public/Wb/Demo/Dsk/DskRaw.HC
similarity index 100%
rename from public/src/Demo/Dsk/DskRaw.HC
rename to public/Wb/Demo/Dsk/DskRaw.HC
diff --git a/public/src/Demo/Dsk/FPrintF.HC b/public/Wb/Demo/Dsk/FPrintF.HC
similarity index 100%
rename from public/src/Demo/Dsk/FPrintF.HC
rename to public/Wb/Demo/Dsk/FPrintF.HC
diff --git a/public/src/Demo/Dsk/SerializeTree.HC b/public/Wb/Demo/Dsk/SerializeTree.HC
similarity index 100%
rename from public/src/Demo/Dsk/SerializeTree.HC
rename to public/Wb/Demo/Dsk/SerializeTree.HC
diff --git a/public/src/Demo/Dsk/UnusedSpaceRep.HC b/public/Wb/Demo/Dsk/UnusedSpaceRep.HC
similarity index 100%
rename from public/src/Demo/Dsk/UnusedSpaceRep.HC
rename to public/Wb/Demo/Dsk/UnusedSpaceRep.HC
diff --git a/public/src/Demo/Exceptions.HC b/public/Wb/Demo/Exceptions.HC
similarity index 100%
rename from public/src/Demo/Exceptions.HC
rename to public/Wb/Demo/Exceptions.HC
diff --git a/public/src/Demo/ExtChars.HC b/public/Wb/Demo/ExtChars.HC
similarity index 100%
rename from public/src/Demo/ExtChars.HC
rename to public/Wb/Demo/ExtChars.HC
diff --git a/public/src/Demo/Games/BattleLines.HC b/public/Wb/Demo/Games/BattleLines.HC
similarity index 100%
rename from public/src/Demo/Games/BattleLines.HC
rename to public/Wb/Demo/Games/BattleLines.HC
diff --git a/public/src/Demo/Games/BigGuns.HC b/public/Wb/Demo/Games/BigGuns.HC
similarity index 100%
rename from public/src/Demo/Games/BigGuns.HC
rename to public/Wb/Demo/Games/BigGuns.HC
diff --git a/public/src/Demo/Games/BlackDiamond.HC b/public/Wb/Demo/Games/BlackDiamond.HC
similarity index 100%
rename from public/src/Demo/Games/BlackDiamond.HC
rename to public/Wb/Demo/Games/BlackDiamond.HC
diff --git a/public/src/Demo/Games/BomberGolf.HC b/public/Wb/Demo/Games/BomberGolf.HC
similarity index 100%
rename from public/src/Demo/Games/BomberGolf.HC
rename to public/Wb/Demo/Games/BomberGolf.HC
diff --git a/public/src/Demo/Games/CastleFrankenstein.HC b/public/Wb/Demo/Games/CastleFrankenstein.HC
similarity index 100%
rename from public/src/Demo/Games/CastleFrankenstein.HC
rename to public/Wb/Demo/Games/CastleFrankenstein.HC
diff --git a/public/src/Demo/Games/CharDemo.HC b/public/Wb/Demo/Games/CharDemo.HC
similarity index 100%
rename from public/src/Demo/Games/CharDemo.HC
rename to public/Wb/Demo/Games/CharDemo.HC
diff --git a/public/src/Demo/Games/CircleTrace.HC b/public/Wb/Demo/Games/CircleTrace.HC
similarity index 100%
rename from public/src/Demo/Games/CircleTrace.HC
rename to public/Wb/Demo/Games/CircleTrace.HC
diff --git a/public/src/Demo/Games/Collision.HC b/public/Wb/Demo/Games/Collision.HC
similarity index 100%
rename from public/src/Demo/Games/Collision.HC
rename to public/Wb/Demo/Games/Collision.HC
diff --git a/public/src/Demo/Games/Digits.HC b/public/Wb/Demo/Games/Digits.HC
similarity index 100%
rename from public/src/Demo/Games/Digits.HC
rename to public/Wb/Demo/Games/Digits.HC
diff --git a/public/src/Demo/Games/DunGen.HC b/public/Wb/Demo/Games/DunGen.HC
similarity index 100%
rename from public/src/Demo/Games/DunGen.HC
rename to public/Wb/Demo/Games/DunGen.HC
diff --git a/public/src/Demo/Games/ElephantWalk.HC b/public/Wb/Demo/Games/ElephantWalk.HC
similarity index 100%
rename from public/src/Demo/Games/ElephantWalk.HC
rename to public/Wb/Demo/Games/ElephantWalk.HC
diff --git a/public/src/Demo/Games/FlapBat.HC b/public/Wb/Demo/Games/FlapBat.HC
similarity index 100%
rename from public/src/Demo/Games/FlapBat.HC
rename to public/Wb/Demo/Games/FlapBat.HC
diff --git a/public/src/Demo/Games/FlatTops.HC b/public/Wb/Demo/Games/FlatTops.HC
similarity index 100%
rename from public/src/Demo/Games/FlatTops.HC
rename to public/Wb/Demo/Games/FlatTops.HC
diff --git a/public/src/Demo/Games/Halogen.HC b/public/Wb/Demo/Games/Halogen.HC
similarity index 100%
rename from public/src/Demo/Games/Halogen.HC
rename to public/Wb/Demo/Games/Halogen.HC
diff --git a/public/src/Demo/Games/MassSpring.HC b/public/Wb/Demo/Games/MassSpring.HC
similarity index 100%
rename from public/src/Demo/Games/MassSpring.HC
rename to public/Wb/Demo/Games/MassSpring.HC
diff --git a/public/src/Demo/Games/Maze.HC b/public/Wb/Demo/Games/Maze.HC
similarity index 100%
rename from public/src/Demo/Games/Maze.HC
rename to public/Wb/Demo/Games/Maze.HC
diff --git a/public/src/Demo/Games/RainDrops.HC b/public/Wb/Demo/Games/RainDrops.HC
similarity index 100%
rename from public/src/Demo/Games/RainDrops.HC
rename to public/Wb/Demo/Games/RainDrops.HC
diff --git a/public/src/Demo/Games/RawHide.HC b/public/Wb/Demo/Games/RawHide.HC
similarity index 100%
rename from public/src/Demo/Games/RawHide.HC
rename to public/Wb/Demo/Games/RawHide.HC
diff --git a/public/src/Demo/Games/Rocket.HC b/public/Wb/Demo/Games/Rocket.HC
similarity index 100%
rename from public/src/Demo/Games/Rocket.HC
rename to public/Wb/Demo/Games/Rocket.HC
diff --git a/public/src/Demo/Games/RocketScience.HC b/public/Wb/Demo/Games/RocketScience.HC
similarity index 100%
rename from public/src/Demo/Games/RocketScience.HC
rename to public/Wb/Demo/Games/RocketScience.HC
diff --git a/public/src/Demo/Games/Squirt.HC b/public/Wb/Demo/Games/Squirt.HC
similarity index 100%
rename from public/src/Demo/Games/Squirt.HC
rename to public/Wb/Demo/Games/Squirt.HC
diff --git a/public/src/Demo/Games/Stadium/Stadium.HC b/public/Wb/Demo/Games/Stadium/Stadium.HC
similarity index 100%
rename from public/src/Demo/Games/Stadium/Stadium.HC
rename to public/Wb/Demo/Games/Stadium/Stadium.HC
diff --git a/public/src/Demo/Games/Stadium/StadiumBG.DD.HTML b/public/Wb/Demo/Games/Stadium/StadiumBG.DD.HTML
old mode 100644
new mode 100755
similarity index 94%
rename from public/src/Demo/Games/Stadium/StadiumBG.DD.HTML
rename to public/Wb/Demo/Games/Stadium/StadiumBG.DD.HTML
index 0aaef0f..b73c614
--- a/public/src/Demo/Games/Stadium/StadiumBG.DD.HTML
+++ b/public/Wb/Demo/Games/Stadium/StadiumBG.DD.HTML
@@ -26,6 +26,6 @@
 
 
 
-
+
 /* Graphics Not Rendered in HTML */
diff --git a/public/src/Demo/Games/Stadium/StadiumGen.HC b/public/Wb/Demo/Games/Stadium/StadiumGen.HC similarity index 100% rename from public/src/Demo/Games/Stadium/StadiumGen.HC rename to public/Wb/Demo/Games/Stadium/StadiumGen.HC diff --git a/public/src/Demo/Games/Talons.HC b/public/Wb/Demo/Games/Talons.HC similarity index 100% rename from public/src/Demo/Games/Talons.HC rename to public/Wb/Demo/Games/Talons.HC diff --git a/public/src/Demo/Games/TheDead.HC b/public/Wb/Demo/Games/TheDead.HC similarity index 100% rename from public/src/Demo/Games/TheDead.HC rename to public/Wb/Demo/Games/TheDead.HC diff --git a/public/src/Demo/Games/TicTacToe.HC b/public/Wb/Demo/Games/TicTacToe.HC similarity index 100% rename from public/src/Demo/Games/TicTacToe.HC rename to public/Wb/Demo/Games/TicTacToe.HC diff --git a/public/src/Demo/Games/TreeCheckers.HC b/public/Wb/Demo/Games/TreeCheckers.HC similarity index 100% rename from public/src/Demo/Games/TreeCheckers.HC rename to public/Wb/Demo/Games/TreeCheckers.HC diff --git a/public/src/Demo/Games/Varoom.HC b/public/Wb/Demo/Games/Varoom.HC similarity index 100% rename from public/src/Demo/Games/Varoom.HC rename to public/Wb/Demo/Games/Varoom.HC diff --git a/public/src/Demo/Games/Wenceslas.HC b/public/Wb/Demo/Games/Wenceslas.HC similarity index 100% rename from public/src/Demo/Games/Wenceslas.HC rename to public/Wb/Demo/Games/Wenceslas.HC diff --git a/public/src/Demo/Games/Whap.HC b/public/Wb/Demo/Games/Whap.HC similarity index 100% rename from public/src/Demo/Games/Whap.HC rename to public/Wb/Demo/Games/Whap.HC diff --git a/public/src/Demo/Games/Zing.HC b/public/Wb/Demo/Games/Zing.HC similarity index 100% rename from public/src/Demo/Games/Zing.HC rename to public/Wb/Demo/Games/Zing.HC diff --git a/public/src/Demo/Games/ZoneOut.HC b/public/Wb/Demo/Games/ZoneOut.HC similarity index 100% rename from public/src/Demo/Games/ZoneOut.HC rename to public/Wb/Demo/Games/ZoneOut.HC diff --git a/public/src/Demo/GlblVars.HC b/public/Wb/Demo/GlblVars.HC similarity index 100% rename from public/src/Demo/GlblVars.HC rename to public/Wb/Demo/GlblVars.HC diff --git a/public/src/Demo/Graphics/3DPoly.HC b/public/Wb/Demo/Graphics/3DPoly.HC similarity index 100% rename from public/src/Demo/Graphics/3DPoly.HC rename to public/Wb/Demo/Graphics/3DPoly.HC diff --git a/public/src/Demo/Graphics/BSpline.HC b/public/Wb/Demo/Graphics/BSpline.HC similarity index 100% rename from public/src/Demo/Graphics/BSpline.HC rename to public/Wb/Demo/Graphics/BSpline.HC diff --git a/public/src/Demo/Graphics/Balloon.HC b/public/Wb/Demo/Graphics/Balloon.HC similarity index 100% rename from public/src/Demo/Graphics/Balloon.HC rename to public/Wb/Demo/Graphics/Balloon.HC diff --git a/public/src/Demo/Graphics/Blot.HC b/public/Wb/Demo/Graphics/Blot.HC similarity index 100% rename from public/src/Demo/Graphics/Blot.HC rename to public/Wb/Demo/Graphics/Blot.HC diff --git a/public/src/Demo/Graphics/Bounce.HC b/public/Wb/Demo/Graphics/Bounce.HC similarity index 100% rename from public/src/Demo/Graphics/Bounce.HC rename to public/Wb/Demo/Graphics/Bounce.HC diff --git a/public/src/Demo/Graphics/Box.HC b/public/Wb/Demo/Graphics/Box.HC similarity index 100% rename from public/src/Demo/Graphics/Box.HC rename to public/Wb/Demo/Graphics/Box.HC diff --git a/public/src/Demo/Graphics/Cartesian.HC b/public/Wb/Demo/Graphics/Cartesian.HC similarity index 100% rename from public/src/Demo/Graphics/Cartesian.HC rename to public/Wb/Demo/Graphics/Cartesian.HC diff --git a/public/src/Demo/Graphics/CharAnimation.HC b/public/Wb/Demo/Graphics/CharAnimation.HC similarity index 100% rename from public/src/Demo/Graphics/CharAnimation.HC rename to public/Wb/Demo/Graphics/CharAnimation.HC diff --git a/public/src/Demo/Graphics/Collision.HC b/public/Wb/Demo/Graphics/Collision.HC similarity index 100% rename from public/src/Demo/Graphics/Collision.HC rename to public/Wb/Demo/Graphics/Collision.HC diff --git a/public/src/Demo/Graphics/CommonAncestor.HC b/public/Wb/Demo/Graphics/CommonAncestor.HC similarity index 100% rename from public/src/Demo/Graphics/CommonAncestor.HC rename to public/Wb/Demo/Graphics/CommonAncestor.HC diff --git a/public/src/Demo/Graphics/Doodle.HC b/public/Wb/Demo/Graphics/Doodle.HC similarity index 100% rename from public/src/Demo/Graphics/Doodle.HC rename to public/Wb/Demo/Graphics/Doodle.HC diff --git a/public/src/Demo/Graphics/EdSprite.HC b/public/Wb/Demo/Graphics/EdSprite.HC similarity index 100% rename from public/src/Demo/Graphics/EdSprite.HC rename to public/Wb/Demo/Graphics/EdSprite.HC diff --git a/public/src/Demo/Graphics/Elephant.HC b/public/Wb/Demo/Graphics/Elephant.HC similarity index 100% rename from public/src/Demo/Graphics/Elephant.HC rename to public/Wb/Demo/Graphics/Elephant.HC diff --git a/public/src/Demo/Graphics/Extents.HC b/public/Wb/Demo/Graphics/Extents.HC similarity index 100% rename from public/src/Demo/Graphics/Extents.HC rename to public/Wb/Demo/Graphics/Extents.HC diff --git a/public/src/Demo/Graphics/FontEd.HC b/public/Wb/Demo/Graphics/FontEd.HC similarity index 100% rename from public/src/Demo/Graphics/FontEd.HC rename to public/Wb/Demo/Graphics/FontEd.HC diff --git a/public/src/Demo/Graphics/Grid.HC b/public/Wb/Demo/Graphics/Grid.HC similarity index 100% rename from public/src/Demo/Graphics/Grid.HC rename to public/Wb/Demo/Graphics/Grid.HC diff --git a/public/src/Demo/Graphics/Hanoi.HC b/public/Wb/Demo/Graphics/Hanoi.HC similarity index 100% rename from public/src/Demo/Graphics/Hanoi.HC rename to public/Wb/Demo/Graphics/Hanoi.HC diff --git a/public/src/Demo/Graphics/Lattice.HC b/public/Wb/Demo/Graphics/Lattice.HC similarity index 100% rename from public/src/Demo/Graphics/Lattice.HC rename to public/Wb/Demo/Graphics/Lattice.HC diff --git a/public/src/Demo/Graphics/Life.HC b/public/Wb/Demo/Graphics/Life.HC similarity index 100% rename from public/src/Demo/Graphics/Life.HC rename to public/Wb/Demo/Graphics/Life.HC diff --git a/public/src/Demo/Graphics/LightTable.HC b/public/Wb/Demo/Graphics/LightTable.HC similarity index 100% rename from public/src/Demo/Graphics/LightTable.HC rename to public/Wb/Demo/Graphics/LightTable.HC diff --git a/public/src/Demo/Graphics/Lines.HC b/public/Wb/Demo/Graphics/Lines.HC similarity index 100% rename from public/src/Demo/Graphics/Lines.HC rename to public/Wb/Demo/Graphics/Lines.HC diff --git a/public/src/Demo/Graphics/LowPassFilter.HC b/public/Wb/Demo/Graphics/LowPassFilter.HC similarity index 100% rename from public/src/Demo/Graphics/LowPassFilter.HC rename to public/Wb/Demo/Graphics/LowPassFilter.HC diff --git a/public/src/Demo/Graphics/MathAudioDemo.HC b/public/Wb/Demo/Graphics/MathAudioDemo.HC similarity index 100% rename from public/src/Demo/Graphics/MathAudioDemo.HC rename to public/Wb/Demo/Graphics/MathAudioDemo.HC diff --git a/public/src/Demo/Graphics/MouseDemo.HC b/public/Wb/Demo/Graphics/MouseDemo.HC similarity index 100% rename from public/src/Demo/Graphics/MouseDemo.HC rename to public/Wb/Demo/Graphics/MouseDemo.HC diff --git a/public/src/Demo/Graphics/NetOfDots.HC b/public/Wb/Demo/Graphics/NetOfDots.HC similarity index 100% rename from public/src/Demo/Graphics/NetOfDots.HC rename to public/Wb/Demo/Graphics/NetOfDots.HC diff --git a/public/src/Demo/Graphics/Palette.HC b/public/Wb/Demo/Graphics/Palette.HC similarity index 100% rename from public/src/Demo/Graphics/Palette.HC rename to public/Wb/Demo/Graphics/Palette.HC diff --git a/public/src/Demo/Graphics/PanText.HC b/public/Wb/Demo/Graphics/PanText.HC similarity index 100% rename from public/src/Demo/Graphics/PanText.HC rename to public/Wb/Demo/Graphics/PanText.HC diff --git a/public/src/Demo/Graphics/Pick.HC b/public/Wb/Demo/Graphics/Pick.HC similarity index 100% rename from public/src/Demo/Graphics/Pick.HC rename to public/Wb/Demo/Graphics/Pick.HC diff --git a/public/src/Demo/Graphics/Pick3D.HC b/public/Wb/Demo/Graphics/Pick3D.HC similarity index 100% rename from public/src/Demo/Graphics/Pick3D.HC rename to public/Wb/Demo/Graphics/Pick3D.HC diff --git a/public/src/Demo/Graphics/PoleZeros.HC b/public/Wb/Demo/Graphics/PoleZeros.HC similarity index 100% rename from public/src/Demo/Graphics/PoleZeros.HC rename to public/Wb/Demo/Graphics/PoleZeros.HC diff --git a/public/src/Demo/Graphics/PredatorPrey.HC b/public/Wb/Demo/Graphics/PredatorPrey.HC similarity index 100% rename from public/src/Demo/Graphics/PredatorPrey.HC rename to public/Wb/Demo/Graphics/PredatorPrey.HC diff --git a/public/src/Demo/Graphics/RotateTank.HC b/public/Wb/Demo/Graphics/RotateTank.HC similarity index 100% rename from public/src/Demo/Graphics/RotateTank.HC rename to public/Wb/Demo/Graphics/RotateTank.HC diff --git a/public/src/Demo/Graphics/ScrnCapture.HC b/public/Wb/Demo/Graphics/ScrnCapture.HC similarity index 100% rename from public/src/Demo/Graphics/ScrnCapture.HC rename to public/Wb/Demo/Graphics/ScrnCapture.HC diff --git a/public/src/Demo/Graphics/ScrollBars.HC b/public/Wb/Demo/Graphics/ScrollBars.HC similarity index 100% rename from public/src/Demo/Graphics/ScrollBars.HC rename to public/Wb/Demo/Graphics/ScrollBars.HC diff --git a/public/src/Demo/Graphics/Shading.HC b/public/Wb/Demo/Graphics/Shading.HC similarity index 100% rename from public/src/Demo/Graphics/Shading.HC rename to public/Wb/Demo/Graphics/Shading.HC diff --git a/public/src/Demo/Graphics/Shadow.HC b/public/Wb/Demo/Graphics/Shadow.HC similarity index 100% rename from public/src/Demo/Graphics/Shadow.HC rename to public/Wb/Demo/Graphics/Shadow.HC diff --git a/public/src/Demo/Graphics/Slider.HC b/public/Wb/Demo/Graphics/Slider.HC similarity index 100% rename from public/src/Demo/Graphics/Slider.HC rename to public/Wb/Demo/Graphics/Slider.HC diff --git a/public/src/Demo/Graphics/Speedline.HC b/public/Wb/Demo/Graphics/Speedline.HC similarity index 100% rename from public/src/Demo/Graphics/Speedline.HC rename to public/Wb/Demo/Graphics/Speedline.HC diff --git a/public/src/Demo/Graphics/SpritePlot.HC b/public/Wb/Demo/Graphics/SpritePlot.HC similarity index 100% rename from public/src/Demo/Graphics/SpritePlot.HC rename to public/Wb/Demo/Graphics/SpritePlot.HC diff --git a/public/src/Demo/Graphics/SpritePlot3D.HC b/public/Wb/Demo/Graphics/SpritePlot3D.HC similarity index 100% rename from public/src/Demo/Graphics/SpritePlot3D.HC rename to public/Wb/Demo/Graphics/SpritePlot3D.HC diff --git a/public/src/Demo/Graphics/SpritePut.HC b/public/Wb/Demo/Graphics/SpritePut.HC similarity index 100% rename from public/src/Demo/Graphics/SpritePut.HC rename to public/Wb/Demo/Graphics/SpritePut.HC diff --git a/public/src/Demo/Graphics/SpritePutExt.HC b/public/Wb/Demo/Graphics/SpritePutExt.HC similarity index 100% rename from public/src/Demo/Graphics/SpritePutExt.HC rename to public/Wb/Demo/Graphics/SpritePutExt.HC diff --git a/public/src/Demo/Graphics/SpriteRaw.HC b/public/Wb/Demo/Graphics/SpriteRaw.HC similarity index 100% rename from public/src/Demo/Graphics/SpriteRaw.HC rename to public/Wb/Demo/Graphics/SpriteRaw.HC diff --git a/public/src/Demo/Graphics/SpriteText.HC b/public/Wb/Demo/Graphics/SpriteText.HC similarity index 100% rename from public/src/Demo/Graphics/SpriteText.HC rename to public/Wb/Demo/Graphics/SpriteText.HC diff --git a/public/src/Demo/Graphics/SunMoon.HC b/public/Wb/Demo/Graphics/SunMoon.HC similarity index 100% rename from public/src/Demo/Graphics/SunMoon.HC rename to public/Wb/Demo/Graphics/SunMoon.HC diff --git a/public/src/Demo/Graphics/Symmetry.HC b/public/Wb/Demo/Graphics/Symmetry.HC similarity index 100% rename from public/src/Demo/Graphics/Symmetry.HC rename to public/Wb/Demo/Graphics/Symmetry.HC diff --git a/public/src/Demo/Graphics/Transform.HC b/public/Wb/Demo/Graphics/Transform.HC similarity index 100% rename from public/src/Demo/Graphics/Transform.HC rename to public/Wb/Demo/Graphics/Transform.HC diff --git a/public/src/Demo/Graphics/WallPaperCtrl.HC b/public/Wb/Demo/Graphics/WallPaperCtrl.HC similarity index 100% rename from public/src/Demo/Graphics/WallPaperCtrl.HC rename to public/Wb/Demo/Graphics/WallPaperCtrl.HC diff --git a/public/src/Demo/Graphics/WallPaperFish.HC b/public/Wb/Demo/Graphics/WallPaperFish.HC similarity index 100% rename from public/src/Demo/Graphics/WallPaperFish.HC rename to public/Wb/Demo/Graphics/WallPaperFish.HC diff --git a/public/src/Demo/Graphics/WinZBuf.HC b/public/Wb/Demo/Graphics/WinZBuf.HC similarity index 100% rename from public/src/Demo/Graphics/WinZBuf.HC rename to public/Wb/Demo/Graphics/WinZBuf.HC diff --git a/public/src/Demo/InFile/InEd.DD.HTML b/public/Wb/Demo/InFile/InEd.DD.HTML old mode 100644 new mode 100755 similarity index 99% rename from public/src/Demo/InFile/InEd.DD.HTML rename to public/Wb/Demo/InFile/InEd.DD.HTML index 9ea3499..26ff49e --- a/public/src/Demo/InFile/InEd.DD.HTML +++ b/public/Wb/Demo/InFile/InEd.DD.HTML @@ -25,7 +25,7 @@ -
+
 //Intermediate compiler codes
 #define IC_END                  0x00
 #define IC_START                0x01
diff --git a/public/src/Demo/InFile/InPopUp.HC b/public/Wb/Demo/InFile/InPopUp.HC
similarity index 100%
rename from public/src/Demo/InFile/InPopUp.HC
rename to public/Wb/Demo/InFile/InPopUp.HC
diff --git a/public/src/Demo/InFile/InSetIP.HC b/public/Wb/Demo/InFile/InSetIP.HC
similarity index 100%
rename from public/src/Demo/InFile/InSetIP.HC
rename to public/Wb/Demo/InFile/InSetIP.HC
diff --git a/public/src/Demo/KeyBitMap.HC b/public/Wb/Demo/KeyBitMap.HC
similarity index 100%
rename from public/src/Demo/KeyBitMap.HC
rename to public/Wb/Demo/KeyBitMap.HC
diff --git a/public/src/Demo/LastClass.HC b/public/Wb/Demo/LastClass.HC
similarity index 100%
rename from public/src/Demo/LastClass.HC
rename to public/Wb/Demo/LastClass.HC
diff --git a/public/src/Demo/Lectures/64BitAsmQuiz.DD.HTML b/public/Wb/Demo/Lectures/64BitAsmQuiz.DD.HTML
old mode 100644
new mode 100755
similarity index 91%
rename from public/src/Demo/Lectures/64BitAsmQuiz.DD.HTML
rename to public/Wb/Demo/Lectures/64BitAsmQuiz.DD.HTML
index 2c027e7..3cbe4df
--- a/public/src/Demo/Lectures/64BitAsmQuiz.DD.HTML
+++ b/public/Wb/Demo/Lectures/64BitAsmQuiz.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                               64-Bit Assembly Quiz
 
 1) In 64-bit mode, how many bytes are always pushed?
@@ -101,12 +101,12 @@
 2) The upper 32-bits are set to zero.
 
 3) To set FS or GS, you use WRMSR to write a model specific reg.  See 
-IA32_FS_BASE and SET_FS_BASE.
+IA32_FS_BASE and SET_FS_BASE.
 
 4) Displacement addressing is now RIP relative, so RIP would be added to 
 TSS_SOME_MEMBER.  (Useless)
 
-5) The R13 instruction takes one more byte because it is like REG_RBP in the 
+5) The R13 instruction takes one more byte because it is like REG_RBP in the 
 ModR.
 
 6) The R8 instruction needs a REX byte prefix to specify upper-8 reg.
@@ -117,7 +117,7 @@
 8) To call a subroutine farther than 2Gig away, you put the address into RAX, 
 then CALL RAX.
 
-9) CALL REL32 is significantly faster.  See ::/Demo/Lectures/InterruptDemo.HC.
+9) CALL REL32 is significantly faster.  See ::/Demo/Lectures/InterruptDemo.HC.
 
 10) IN or OUT instructions happen at a fixed speed based on the original ISA bus 
 clock.
diff --git a/public/src/Demo/Lectures/AndNotMod.HC b/public/Wb/Demo/Lectures/AndNotMod.HC
similarity index 100%
rename from public/src/Demo/Lectures/AndNotMod.HC
rename to public/Wb/Demo/Lectures/AndNotMod.HC
diff --git a/public/src/Demo/Lectures/FixedPoint.HC b/public/Wb/Demo/Lectures/FixedPoint.HC
similarity index 100%
rename from public/src/Demo/Lectures/FixedPoint.HC
rename to public/Wb/Demo/Lectures/FixedPoint.HC
diff --git a/public/src/Demo/Lectures/FixedPointAdvanced.HC b/public/Wb/Demo/Lectures/FixedPointAdvanced.HC
similarity index 100%
rename from public/src/Demo/Lectures/FixedPointAdvanced.HC
rename to public/Wb/Demo/Lectures/FixedPointAdvanced.HC
diff --git a/public/src/Demo/Lectures/GraphicsCPULoad.HC b/public/Wb/Demo/Lectures/GraphicsCPULoad.HC
similarity index 100%
rename from public/src/Demo/Lectures/GraphicsCPULoad.HC
rename to public/Wb/Demo/Lectures/GraphicsCPULoad.HC
diff --git a/public/src/Demo/Lectures/InterruptDemo.HC b/public/Wb/Demo/Lectures/InterruptDemo.HC
similarity index 100%
rename from public/src/Demo/Lectures/InterruptDemo.HC
rename to public/Wb/Demo/Lectures/InterruptDemo.HC
diff --git a/public/src/Demo/Lectures/MiniCompiler.HC b/public/Wb/Demo/Lectures/MiniCompiler.HC
similarity index 100%
rename from public/src/Demo/Lectures/MiniCompiler.HC
rename to public/Wb/Demo/Lectures/MiniCompiler.HC
diff --git a/public/src/Demo/Lectures/MiniGrLib.HC b/public/Wb/Demo/Lectures/MiniGrLib.HC
similarity index 100%
rename from public/src/Demo/Lectures/MiniGrLib.HC
rename to public/Wb/Demo/Lectures/MiniGrLib.HC
diff --git a/public/src/Demo/Lectures/NegDisp.HC b/public/Wb/Demo/Lectures/NegDisp.HC
similarity index 100%
rename from public/src/Demo/Lectures/NegDisp.HC
rename to public/Wb/Demo/Lectures/NegDisp.HC
diff --git a/public/src/Demo/Lectures/Optimization.HC b/public/Wb/Demo/Lectures/Optimization.HC
similarity index 100%
rename from public/src/Demo/Lectures/Optimization.HC
rename to public/Wb/Demo/Lectures/Optimization.HC
diff --git a/public/src/Demo/Lectures/PCIInterrupts.HC b/public/Wb/Demo/Lectures/PCIInterrupts.HC
similarity index 100%
rename from public/src/Demo/Lectures/PCIInterrupts.HC
rename to public/Wb/Demo/Lectures/PCIInterrupts.HC
diff --git a/public/src/Demo/Lectures/Ring3.HC b/public/Wb/Demo/Lectures/Ring3.HC
similarity index 100%
rename from public/src/Demo/Lectures/Ring3.HC
rename to public/Wb/Demo/Lectures/Ring3.HC
diff --git a/public/src/Demo/Lectures/ScrnMemory.HC b/public/Wb/Demo/Lectures/ScrnMemory.HC
similarity index 100%
rename from public/src/Demo/Lectures/ScrnMemory.HC
rename to public/Wb/Demo/Lectures/ScrnMemory.HC
diff --git a/public/src/Demo/MagicPairs.HC b/public/Wb/Demo/MagicPairs.HC
similarity index 100%
rename from public/src/Demo/MagicPairs.HC
rename to public/Wb/Demo/MagicPairs.HC
diff --git a/public/src/Demo/MemDemo.HC b/public/Wb/Demo/MemDemo.HC
similarity index 100%
rename from public/src/Demo/MemDemo.HC
rename to public/Wb/Demo/MemDemo.HC
diff --git a/public/src/Demo/MsgLoop.HC b/public/Wb/Demo/MsgLoop.HC
similarity index 100%
rename from public/src/Demo/MsgLoop.HC
rename to public/Wb/Demo/MsgLoop.HC
diff --git a/public/src/Demo/MultiCore/Interrupts.HC b/public/Wb/Demo/MultiCore/Interrupts.HC
similarity index 100%
rename from public/src/Demo/MultiCore/Interrupts.HC
rename to public/Wb/Demo/MultiCore/Interrupts.HC
diff --git a/public/src/Demo/MultiCore/LoadTest.HC b/public/Wb/Demo/MultiCore/LoadTest.HC
similarity index 100%
rename from public/src/Demo/MultiCore/LoadTest.HC
rename to public/Wb/Demo/MultiCore/LoadTest.HC
diff --git a/public/src/Demo/MultiCore/Lock.HC b/public/Wb/Demo/MultiCore/Lock.HC
similarity index 100%
rename from public/src/Demo/MultiCore/Lock.HC
rename to public/Wb/Demo/MultiCore/Lock.HC
diff --git a/public/src/Demo/MultiCore/MPAdd.HC b/public/Wb/Demo/MultiCore/MPAdd.HC
similarity index 100%
rename from public/src/Demo/MultiCore/MPAdd.HC
rename to public/Wb/Demo/MultiCore/MPAdd.HC
diff --git a/public/src/Demo/MultiCore/MPPrint.HC b/public/Wb/Demo/MultiCore/MPPrint.HC
similarity index 100%
rename from public/src/Demo/MultiCore/MPPrint.HC
rename to public/Wb/Demo/MultiCore/MPPrint.HC
diff --git a/public/src/Demo/MultiCore/MPRadix.HC b/public/Wb/Demo/MultiCore/MPRadix.HC
similarity index 100%
rename from public/src/Demo/MultiCore/MPRadix.HC
rename to public/Wb/Demo/MultiCore/MPRadix.HC
diff --git a/public/src/Demo/MultiCore/Palindrome.HC b/public/Wb/Demo/MultiCore/Palindrome.HC
similarity index 100%
rename from public/src/Demo/MultiCore/Palindrome.HC
rename to public/Wb/Demo/MultiCore/Palindrome.HC
diff --git a/public/src/Demo/MultiCore/Primes.HC b/public/Wb/Demo/MultiCore/Primes.HC
similarity index 100%
rename from public/src/Demo/MultiCore/Primes.HC
rename to public/Wb/Demo/MultiCore/Primes.HC
diff --git a/public/src/Demo/NullCase.HC b/public/Wb/Demo/NullCase.HC
similarity index 100%
rename from public/src/Demo/NullCase.HC
rename to public/Wb/Demo/NullCase.HC
diff --git a/public/src/Demo/OnceDemo.HC b/public/Wb/Demo/OnceDemo.HC
similarity index 100%
rename from public/src/Demo/OnceDemo.HC
rename to public/Wb/Demo/OnceDemo.HC
diff --git a/public/src/Demo/ParenWarn.HC b/public/Wb/Demo/ParenWarn.HC
similarity index 100%
rename from public/src/Demo/ParenWarn.HC
rename to public/Wb/Demo/ParenWarn.HC
diff --git a/public/src/Demo/PhoneNumWords.HC b/public/Wb/Demo/PhoneNumWords.HC
similarity index 100%
rename from public/src/Demo/PhoneNumWords.HC
rename to public/Wb/Demo/PhoneNumWords.HC
diff --git a/public/src/Demo/Print.HC b/public/Wb/Demo/Print.HC
similarity index 100%
rename from public/src/Demo/Print.HC
rename to public/Wb/Demo/Print.HC
diff --git a/public/src/Demo/Progress.HC b/public/Wb/Demo/Progress.HC
similarity index 100%
rename from public/src/Demo/Progress.HC
rename to public/Wb/Demo/Progress.HC
diff --git a/public/src/Demo/Prompt.HC b/public/Wb/Demo/Prompt.HC
similarity index 100%
rename from public/src/Demo/Prompt.HC
rename to public/Wb/Demo/Prompt.HC
diff --git a/public/src/Demo/PullDownMenu.HC b/public/Wb/Demo/PullDownMenu.HC
similarity index 100%
rename from public/src/Demo/PullDownMenu.HC
rename to public/Wb/Demo/PullDownMenu.HC
diff --git a/public/src/Demo/RadixSort.HC b/public/Wb/Demo/RadixSort.HC
similarity index 100%
rename from public/src/Demo/RadixSort.HC
rename to public/Wb/Demo/RadixSort.HC
diff --git a/public/src/Demo/RandDemo.HC b/public/Wb/Demo/RandDemo.HC
similarity index 100%
rename from public/src/Demo/RandDemo.HC
rename to public/Wb/Demo/RandDemo.HC
diff --git a/public/src/Demo/RegistryDemo.HC b/public/Wb/Demo/RegistryDemo.HC
similarity index 100%
rename from public/src/Demo/RegistryDemo.HC
rename to public/Wb/Demo/RegistryDemo.HC
diff --git a/public/src/Demo/RevFileDemo/DemoPoemBwd.DD.HTML b/public/Wb/Demo/RevFileDemo/DemoPoemBwd.DD.HTML
old mode 100644
new mode 100755
similarity index 97%
rename from public/src/Demo/RevFileDemo/DemoPoemBwd.DD.HTML
rename to public/Wb/Demo/RevFileDemo/DemoPoemBwd.DD.HTML
index 8899461..b4996b6
--- a/public/src/Demo/RevFileDemo/DemoPoemBwd.DD.HTML
+++ b/public/Wb/Demo/RevFileDemo/DemoPoemBwd.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
 Will lead my steps aright.
 In the long way that I must tread alone,
 Guides through the boundless sky thy certain flight,
diff --git a/public/src/Demo/RevFileDemo/Rev.HC b/public/Wb/Demo/RevFileDemo/Rev.HC
similarity index 100%
rename from public/src/Demo/RevFileDemo/Rev.HC
rename to public/Wb/Demo/RevFileDemo/Rev.HC
diff --git a/public/src/Demo/ScrnCodes.HC b/public/Wb/Demo/ScrnCodes.HC
similarity index 100%
rename from public/src/Demo/ScrnCodes.HC
rename to public/Wb/Demo/ScrnCodes.HC
diff --git a/public/src/Demo/Snd/ASCIIOrgan.HC b/public/Wb/Demo/Snd/ASCIIOrgan.HC
similarity index 100%
rename from public/src/Demo/Snd/ASCIIOrgan.HC
rename to public/Wb/Demo/Snd/ASCIIOrgan.HC
diff --git a/public/src/Demo/Snd/MorseCode.HC b/public/Wb/Demo/Snd/MorseCode.HC
similarity index 100%
rename from public/src/Demo/Snd/MorseCode.HC
rename to public/Wb/Demo/Snd/MorseCode.HC
diff --git a/public/src/Demo/Snd/OhGreat.HC b/public/Wb/Demo/Snd/OhGreat.HC
similarity index 100%
rename from public/src/Demo/Snd/OhGreat.HC
rename to public/Wb/Demo/Snd/OhGreat.HC
diff --git a/public/src/Demo/Snd/WaterFowl.HC b/public/Wb/Demo/Snd/WaterFowl.HC
similarity index 100%
rename from public/src/Demo/Snd/WaterFowl.HC
rename to public/Wb/Demo/Snd/WaterFowl.HC
diff --git a/public/src/Demo/SortFileDemo/F64FileGen.HC b/public/Wb/Demo/SortFileDemo/F64FileGen.HC
similarity index 100%
rename from public/src/Demo/SortFileDemo/F64FileGen.HC
rename to public/Wb/Demo/SortFileDemo/F64FileGen.HC
diff --git a/public/src/Demo/SortFileDemo/F64FileSort.HC b/public/Wb/Demo/SortFileDemo/F64FileSort.HC
similarity index 100%
rename from public/src/Demo/SortFileDemo/F64FileSort.HC
rename to public/Wb/Demo/SortFileDemo/F64FileSort.HC
diff --git a/public/src/Demo/Spy.HC b/public/Wb/Demo/Spy.HC
similarity index 100%
rename from public/src/Demo/Spy.HC
rename to public/Wb/Demo/Spy.HC
diff --git a/public/src/Demo/StkGrow.HC b/public/Wb/Demo/StkGrow.HC
similarity index 100%
rename from public/src/Demo/StkGrow.HC
rename to public/Wb/Demo/StkGrow.HC
diff --git a/public/src/Demo/SubIntAccess.HC b/public/Wb/Demo/SubIntAccess.HC
similarity index 100%
rename from public/src/Demo/SubIntAccess.HC
rename to public/Wb/Demo/SubIntAccess.HC
diff --git a/public/src/Demo/SubSwitch.HC b/public/Wb/Demo/SubSwitch.HC
similarity index 100%
rename from public/src/Demo/SubSwitch.HC
rename to public/Wb/Demo/SubSwitch.HC
diff --git a/public/src/Demo/SuggestSpelling.HC b/public/Wb/Demo/SuggestSpelling.HC
similarity index 100%
rename from public/src/Demo/SuggestSpelling.HC
rename to public/Wb/Demo/SuggestSpelling.HC
diff --git a/public/src/Demo/Templates/Game1.HC b/public/Wb/Demo/Templates/Game1.HC
similarity index 100%
rename from public/src/Demo/Templates/Game1.HC
rename to public/Wb/Demo/Templates/Game1.HC
diff --git a/public/src/Demo/Templates/Lex1.HC b/public/Wb/Demo/Templates/Lex1.HC
similarity index 100%
rename from public/src/Demo/Templates/Lex1.HC
rename to public/Wb/Demo/Templates/Lex1.HC
diff --git a/public/src/Demo/Templates/MultiCore1.HC b/public/Wb/Demo/Templates/MultiCore1.HC
similarity index 100%
rename from public/src/Demo/Templates/MultiCore1.HC
rename to public/Wb/Demo/Templates/MultiCore1.HC
diff --git a/public/src/Demo/Templates/ODE1.HC b/public/Wb/Demo/Templates/ODE1.HC
similarity index 100%
rename from public/src/Demo/Templates/ODE1.HC
rename to public/Wb/Demo/Templates/ODE1.HC
diff --git a/public/src/Demo/Templates/Registry1.HC b/public/Wb/Demo/Templates/Registry1.HC
similarity index 100%
rename from public/src/Demo/Templates/Registry1.HC
rename to public/Wb/Demo/Templates/Registry1.HC
diff --git a/public/src/Demo/Templates/Util1.HC b/public/Wb/Demo/Templates/Util1.HC
similarity index 100%
rename from public/src/Demo/Templates/Util1.HC
rename to public/Wb/Demo/Templates/Util1.HC
diff --git a/public/src/Demo/Templates/Util2.HC b/public/Wb/Demo/Templates/Util2.HC
similarity index 100%
rename from public/src/Demo/Templates/Util2.HC
rename to public/Wb/Demo/Templates/Util2.HC
diff --git a/public/src/Demo/TimeIns.HC b/public/Wb/Demo/TimeIns.HC
similarity index 100%
rename from public/src/Demo/TimeIns.HC
rename to public/Wb/Demo/TimeIns.HC
diff --git a/public/src/Demo/ToHtmlToTXTDemo/DemoInPage.DD.HTML b/public/Wb/Demo/ToHtmlToTXTDemo/DemoInPage.DD.HTML
old mode 100644
new mode 100755
similarity index 97%
rename from public/src/Demo/ToHtmlToTXTDemo/DemoInPage.DD.HTML
rename to public/Wb/Demo/ToHtmlToTXTDemo/DemoInPage.DD.HTML
index 219eac0..1ea3d88
--- a/public/src/Demo/ToHtmlToTXTDemo/DemoInPage.DD.HTML
+++ b/public/Wb/Demo/ToHtmlToTXTDemo/DemoInPage.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                           The Temple Operating System
 
 TempleOS File Downloads (100% Public Domain)
diff --git a/public/src/Demo/ToHtmlToTXTDemo/HtmlGen.HC b/public/Wb/Demo/ToHtmlToTXTDemo/HtmlGen.HC
similarity index 100%
rename from public/src/Demo/ToHtmlToTXTDemo/HtmlGen.HC
rename to public/Wb/Demo/ToHtmlToTXTDemo/HtmlGen.HC
diff --git a/public/src/Demo/ToHtmlToTXTDemo/TXTGen.HC b/public/Wb/Demo/ToHtmlToTXTDemo/TXTGen.HC
similarity index 100%
rename from public/src/Demo/ToHtmlToTXTDemo/TXTGen.HC
rename to public/Wb/Demo/ToHtmlToTXTDemo/TXTGen.HC
diff --git a/public/src/Demo/ToHtmlToTXTDemo/ToHtml.HC b/public/Wb/Demo/ToHtmlToTXTDemo/ToHtml.HC
similarity index 100%
rename from public/src/Demo/ToHtmlToTXTDemo/ToHtml.HC
rename to public/Wb/Demo/ToHtmlToTXTDemo/ToHtml.HC
diff --git a/public/src/Demo/WebLogDemo/WebLogRep.HC b/public/Wb/Demo/WebLogDemo/WebLogRep.HC
similarity index 100%
rename from public/src/Demo/WebLogDemo/WebLogRep.HC
rename to public/Wb/Demo/WebLogDemo/WebLogRep.HC
diff --git a/public/src/Demo/WebLogDemo/WebLogScramble.HC b/public/Wb/Demo/WebLogDemo/WebLogScramble.HC
similarity index 100%
rename from public/src/Demo/WebLogDemo/WebLogScramble.HC
rename to public/Wb/Demo/WebLogDemo/WebLogScramble.HC
diff --git a/public/src/Demo/WordSearch.HC b/public/Wb/Demo/WordSearch.HC
similarity index 100%
rename from public/src/Demo/WordSearch.HC
rename to public/Wb/Demo/WordSearch.HC
diff --git a/public/src/Doc/AboutTempleOS.DD.HTML b/public/Wb/Doc/AboutTempleOS.DD.HTML
old mode 100644
new mode 100755
similarity index 94%
rename from public/src/Doc/AboutTempleOS.DD.HTML
rename to public/Wb/Doc/AboutTempleOS.DD.HTML
index d7a2629..c2240ad
--- a/public/src/Doc/AboutTempleOS.DD.HTML
+++ b/public/Wb/Doc/AboutTempleOS.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                                     TempleOS
 
 
@@ -65,7 +65,7 @@
 so they could be refilled. 
 
 Credits:
-See ::/Doc/Credits.DD.
+See ::/Doc/Credits.DD.
 
 
diff --git a/public/src/Home/Doc/Asm.DD.HTML b/public/Wb/Doc/Asm.DD.HTML similarity index 83% rename from public/src/Home/Doc/Asm.DD.HTML rename to public/Wb/Doc/Asm.DD.HTML index e545555..8d93faa 100755 --- a/public/src/Home/Doc/Asm.DD.HTML +++ b/public/Wb/Doc/Asm.DD.HTML @@ -25,10 +25,10 @@ -
+
                                    Assembler
 
-See ::/Compiler/OpCodes.DD for opcodes.  They're not standard.  Some invalid 
+See ::/Compiler/OpCodes.DD for opcodes.  They're not standard.  Some invalid 
 insts are not flagged and some valid insts are not implemented. 16-bit asm 
 support is limited.
 
@@ -72,12 +72,12 @@
   Align to num boundary and fill with fill_byte.
 
 ORG num
-  Set code addr for JIT or set module Load() addr -- has 16-byte CBinFile header 
+  Set code addr for JIT or set module Load() addr -- has 16-byte CBinFile header 
 and patch table trailing.
 
 BINFILE "FileName.BIN";
 
-See Assembly Language, ::/Demo/Asm/AsmAndC1.HC, ::/Demo/Asm/AsmAndC2.HC and 
-::/Demo/Asm/AsmAndC3.HC.
+See Assembly Language, ::/Demo/Asm/AsmAndC1.HC, ::/Demo/Asm/AsmAndC2.HC and 
+::/Demo/Asm/AsmAndC3.HC.
 
diff --git a/public/src/Home/Doc/AutoComplete.DD.HTML b/public/Wb/Doc/AutoComplete.DD.HTML similarity index 84% rename from public/src/Home/Doc/AutoComplete.DD.HTML rename to public/Wb/Doc/AutoComplete.DD.HTML index ebe9186..6063d1e 100755 --- a/public/src/Home/Doc/AutoComplete.DD.HTML +++ b/public/Wb/Doc/AutoComplete.DD.HTML @@ -25,10 +25,10 @@ -
-AutoComplete is the LTGRAY window on the right of the scrn.  ACInit() collects 
-words from all text files in subdirectories.  Normally, the call to ACInit() is 
-in HomeSys.HC.  It provides auto-complete for typing, jump-to-code and 
+
+AutoComplete is the LTGRAY window on the right of the scrn.  ACInit() collects 
+words from all text files in subdirectories.  Normally, the call to ACInit() is 
+in HomeSys.HC.  It provides auto-complete for typing, jump-to-code and 
 jump-to-dictionary functionality.
 
 <ALT-SHIFT-A>   Closes the LTGRAY AutoComplete window.
@@ -49,6 +49,6 @@
 
 If you have the raw Project Gutenberg dictionary file, you can generate the 
 TempleOS processed dictionary files with the stand-alone program 
-::/Adam/AutoComplete/ACDictGen.HC.
+::/Adam/AutoComplete/ACDictGen.HC.
 
diff --git a/public/src/Home/Doc/Bit.DD.HTML b/public/Wb/Doc/Bit.DD.HTML similarity index 97% rename from public/src/Home/Doc/Bit.DD.HTML rename to public/Wb/Doc/Bit.DD.HTML index b94e738..9c99f59 100755 --- a/public/src/Home/Doc/Bit.DD.HTML +++ b/public/Wb/Doc/Bit.DD.HTML @@ -25,7 +25,7 @@ -
+
 
 These take a pointer to a bit field.
 Bt:     Bit Test
diff --git a/public/src/Home/Doc/BlkChain.DD.HTML b/public/Wb/Doc/BlkChain.DD.HTML
similarity index 71%
rename from public/src/Home/Doc/BlkChain.DD.HTML
rename to public/Wb/Doc/BlkChain.DD.HTML
index 716b9ff..897aa44 100755
--- a/public/src/Home/Doc/BlkChain.DD.HTML
+++ b/public/Wb/Doc/BlkChain.DD.HTML
@@ -25,14 +25,14 @@
 
 
 
-
+
                                   Block Chain
 
 There was a technique on the Commodore 64 where disk blocks were chained 
 together with a block pointer at the end of each block.  This is far inferior to 
 having a file allocation table, as in FAT32.
 
-The RedSea file system does not allow files to grow because it only has an 
+The RedSea file system does not allow files to grow because it only has an 
 allocation bitmap and not a FAT table.  This "flaw" is by design.  I am 
 intentionally crippling this operating system, making it a toy with the wisdom 
 that this will prevent commercialization and corruption.  The toy spirit of the 
@@ -50,21 +50,21 @@
 for allocations in the range under a Meg (with occasional larger ones).
 
 The file compression scheme in TempleOS only works on whole file operations and 
-the DolDoc format cannot have text tacked onto the end, since binary data is at 
+the DolDoc format cannot have text tacked onto the end, since binary data is at 
 the end.
 
 I don't want to spoil fun, so of course I offer a way to get awesome performance 
-that is, ironically, superior.  FBlkRead() and FBlkWrite() allow you to read a 
+that is, ironically, superior.  FBlkRead() and FBlkWrite() allow you to read a 
 block offset from the start of a file.  Since files are all contiguous, this is 
 incredibly efficient.  You just have to declare the desired file size when you 
-create it with FOpen() and cannot change it.  See ::/Demo/Dsk/DataBase.HC.
+create it with FOpen() and cannot change it.  See ::/Demo/Dsk/DataBase.HC.
 
-If you like, you are encouraged to to do raw BlkRead() and BlkWrite() directly 
-on a drive.  Just get a pointer to a CDrv with Let2Drv() and you are on your 
+If you like, you are encouraged to to do raw BlkRead() and BlkWrite() directly 
+on a drive.  Just get a pointer to a CDrv with Let2Drv() and you are on your 
 way!  Your computer is supposed to be a fun toy!  You can make an entire 
 partition used for a database, or invent a file system.
 
-On the whole, the RedSea file system with its whole-file-only limitation bring 
+On the whole, the RedSea file system with its whole-file-only limitation bring 
 beautiful harmony.  It beautifully captures the spirit of TempleOS with 
 simplicity and, ironic speed, since contiguous is fastest.
 
diff --git a/public/src/Home/Doc/Boot.DD.HTML b/public/Wb/Doc/Boot.DD.HTML
similarity index 64%
rename from public/src/Home/Doc/Boot.DD.HTML
rename to public/Wb/Doc/Boot.DD.HTML
index d2591f4..de8e746 100755
--- a/public/src/Home/Doc/Boot.DD.HTML
+++ b/public/Wb/Doc/Boot.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                                   Booting A PC
 
 TempleOS only supports traditional BIOS booting, not the newer technique, UEFI.  
@@ -46,48 +46,48 @@
 This means they usually can't just load the whole operating system and start it 
 running.  Some boot loaders, like Grub, have a capability of switching modes 
 before handing-off control to the operating system.  The operating system must 
-load the rest of itself.  With TempleOS, the ::/Kernel.BIN.C file is loaded by 
-the boot sector.  I try to put a minimum in the Kernel Module, so that it will 
+load the rest of itself.  With TempleOS, the ::/Kernel.BIN.C file is loaded by 
+the boot sector.  I try to put a minimum in the Kernel Module, so that it will 
 always fit in 640K.  When Kernel.BIN runs, it switches to 32-bit mode, then, to 
 64-bit mode allowing access to more memory.  Then, it loads in the rest of 
-TempleOS by executing ::/StartOS.HC.
+TempleOS by executing ::/StartOS.HC.
 
 All the boot related code for TempleOS is in the /Adam/Opt/Boot directory.
 
-BootDVD.HC      CD/DVD boot sector.
-BootDVDIns.HC   Prep for CD/DVD install by creating /0000Boot/0000Kernel.BIN.C.
-If you are curious about CD/DVDs, see DskISORedSea.HC.  To make a custom 
-bootable CD/DVD, look here Bootable CD.
+BootDVD.HC      CD/DVD boot sector.
+BootDVDIns.HC   Prep for CD/DVD install by creating /0000Boot/0000Kernel.BIN.C.
+If you are curious about CD/DVDs, see DskISORedSea.HC.  To make a custom 
+bootable CD/DVD, look here Bootable CD.
 
-BootMHD.HC      Stage 1 Master HD boot loader.
-BootMHD2.HC     Stage 2 Master HD boot loader.
-BootMHDIns.HC   Installs Master HD boot loader.
+BootMHD.HC      Stage 1 Master HD boot loader.
+BootMHD2.HC     Stage 2 Master HD boot loader.
+BootMHDIns.HC   Installs Master HD boot loader.
 BootMHD goes on block zero.  /0000Boot/BootMHD2.BIN.C is stored as a file in a 
 partition, risky and unusual, since most master boot loaders place stage 2 in a 
 gap that's not in any partition.  BootMHD2 displays a menu and boots a 
 partition.
 
-BootHD.HC       HD partition boot record.
-BootHDIns.HC    Installs HD partition boot record.
+BootHD.HC       HD partition boot record.
+BootHDIns.HC    Installs HD partition boot record.
 BootHD is the boot record for a TempleOS partition.  Each partition has its own 
 partition boot record, the first block of the partition.
 
 My boot records don't access directories because that would make them too big 
 for one block and would make them depend on a file system layout.  Instead, they 
 get patched with the LBA, logical block addresses, to load files.  To update 
-with a new TempleOS kernel, you must create a ::/Kernel.BIN.C binary file and 
+with a new TempleOS kernel, you must create a ::/Kernel.BIN.C binary file and 
 patch the boot loader so it knows the LBA blocks to load.  Therefore, you 
 usually recompile the kernel and update the boot sector at the same time with  
-BootHDIns().  BootMHDIns() will install a master boot loader.
+BootHDIns().  BootMHDIns() will install a master boot loader.
 
-With TempleOS, ::/Kernel.BIN.C loads ::/Compiler/Compiler.BIN so it can work 
+With TempleOS, ::/Kernel.BIN.C loads ::/Compiler/Compiler.BIN so it can work 
 with source code from then on.  It compiles start-up scripts beginning with 
-::/StartOS.HC into the Adam Task's memory including the code in the /Adam and /H
+::/StartOS.HC into the Adam Task's memory including the code in the /Adam and /H
 ome directories.
 
 It is possible to do a fast reboot without doing a hardware reset.  You might do 
-this when working on ::/Kernel.BIN.C or your start-up scripts when you want to 
-compile them effect.  See BootRAM().
+this when working on ::/Kernel.BIN.C or your start-up scripts when you want to 
+compile them effect.  See BootRAM().
 
 
 /* Graphics Not Rendered in HTML */
diff --git a/public/src/Home/Doc/CharOverview.DD.HTML b/public/Wb/Doc/CharOverview.DD.HTML
similarity index 75%
rename from public/src/Home/Doc/CharOverview.DD.HTML
rename to public/Wb/Doc/CharOverview.DD.HTML
index 6fd4b8a..51e85db 100755
--- a/public/src/Home/Doc/CharOverview.DD.HTML
+++ b/public/Wb/Doc/CharOverview.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                                  Char Overview
 
 A Character is a single byte holding an ASCII code for a letter, num or sym.  
@@ -33,7 +33,7 @@
 
 Standard ASCII values range from 0 to 127.  Values below 32 are ctrl key's.  So, 
 an ASCII #3 is a <CTRL-c>.  TempleOS uses a few nonstandard values below 32.  
-See Char Definitions.
+See Char Definitions.
 
 ASCII #5  is the cursor location in a saved file.
 ASCII #28 is <SHIFT-ESC>.
@@ -45,20 +45,20 @@
 
 A Key is typically specified with a scan code.  TempleOS scan codes contain the 
 key value in the lowest U8, and flags in the upper 3 bytes.  See 
-Scan Code Flags and Scan Codes.
+Scan Code Flags and Scan Codes.
 
 TempleOS stores scan codes in 8 bytes.
   Byte 0   is the code.  NumPad keys, SHIFT, ALT, CTRL and GUI keys combined.
-  Byte 1-3 are flags
+  Byte 1-3 are flags
 
 The upper 4-bytes are copied from lower 4-bytes.
   Byte 4   is the code.  Left, Right and NumPad keys distinct.
-  Byte 5-7 are flags
+  Byte 5-7 are flags
 
-Run the program ::/Demo/MsgLoop.HC to examine scan code.  Press <CTRL-SHIFT-l> 
+Run the program ::/Demo/MsgLoop.HC to examine scan code.  Press <CTRL-SHIFT-l> 
 and "Insert ASCII/ScanCode".
 
-See Key Allocations and CKbdStateGlbls.
+See Key Allocations and CKbdStateGlbls.
 
 A String is a bunch of ASCII characters terminated with a zero.
 
diff --git a/public/src/Home/Doc/Charter.DD.HTML b/public/Wb/Doc/Charter.DD.HTML similarity index 96% rename from public/src/Home/Doc/Charter.DD.HTML rename to public/Wb/Doc/Charter.DD.HTML index 8097eed..5d17315 100755 --- a/public/src/Home/Doc/Charter.DD.HTML +++ b/public/Wb/Doc/Charter.DD.HTML @@ -25,7 +25,7 @@ -
+
                                 TempleOS Charter
 
 Why did they make Solomon's Temple?  It was a direction to look, to focus on, a 
@@ -94,9 +94,9 @@
 libraries creates a hell that is no longer blissful.
 
 * The metric for resolving all TempleOS code governance issues is how fast the 
-compiler compiles itself and the kernel with BootHDIns().  The HolyC language 
+compiler compiles itself and the kernel with BootHDIns().  The HolyC language 
 should be changed to optimize this metric, as I did when I changed type casting 
-from prefix standard C to postfix HolyC, but we need a rule to prevent 
+from prefix standard C to postfix HolyC, but we need a rule to prevent 
 degenerating into a brainfuck language.
  
 * Minimal abstraction is a goal.  Sheep are fools.  They always respect a design 
diff --git a/public/src/Home/Doc/CmdLineOverview.DD.HTML b/public/Wb/Doc/CmdLineOverview.DD.HTML
similarity index 79%
rename from public/src/Home/Doc/CmdLineOverview.DD.HTML
rename to public/Wb/Doc/CmdLineOverview.DD.HTML
index 3f6e138..8cea25f 100755
--- a/public/src/Home/Doc/CmdLineOverview.DD.HTML
+++ b/public/Wb/Doc/CmdLineOverview.DD.HTML
@@ -25,16 +25,16 @@
 
 
 
-
+
                              Command Line Overview
 
-The cmd line feeds into the HolyC compiler line-by-line as you type.  A stmt 
+The cmd line feeds into the HolyC compiler line-by-line as you type.  A stmt 
 outside a function executes immediately.  Remember to add a semicolon.
 
 Look-up the function headers with AutoComplete by hitting <CTRL-SHIFT-F1> after 
 typing the first few letters.
 
-Click Here to see the directory cmd header.  It accepts default args from C++.
+Click Here to see the directory cmd header.  It accepts default args from C++.
 
 >Dir("*.DD.Z");
 
@@ -47,7 +47,7 @@
 shortcuts for #includeing files.  Right-click or hit <ENTER> on a directory 
 listing or press <F5> while editing.
 
->Ed("NewFile.HC.Z");    Invokes the editor. See Doc Link Type.
+>Ed("NewFile.HC.Z");    Invokes the editor. See Doc Link Type.
 
 Most filenames end in .Z because they are stored compressed.
 
@@ -56,22 +56,22 @@
 
 >Drv('B');      B drive
 
-The drive can be specified in a Cd() command as in:
+The drive can be specified in a Cd() command as in:
 
 >Cd("B:/Tmp");  B drive
 >Cd("::/Demo"); Boot drive
 
 The home directory is specified with a '~'.
 
->Cd("~/Psalmody");      See ::/Home dir.
+>Cd("~/Psalmody");      See ::/Home dir.
 
 If a file is not found, .Z is added or removed and a search is done, again.  If 
 a file is still not found, all parent directories are searched.
 
-You can place macros in your PersonalMenu for Cd() commands.  <CTRL-m> to access 
+You can place macros in your PersonalMenu for Cd() commands.  <CTRL-m> to access 
 your menu.
 
->Find("needle","/Demo/*.HC.Z;*.DD.Z;"); See File Utils.
+>Find("needle","/Demo/*.HC.Z;*.DD.Z;"); See File Utils.
 
 Cmd Line Routines
 
diff --git a/public/src/Doc/Comm.HC b/public/Wb/Doc/Comm.HC
similarity index 100%
rename from public/src/Doc/Comm.HC
rename to public/Wb/Doc/Comm.HC
diff --git a/public/src/Doc/CompilerOverview.DD.HTML b/public/Wb/Doc/CompilerOverview.DD.HTML
old mode 100644
new mode 100755
similarity index 62%
rename from public/src/Doc/CompilerOverview.DD.HTML
rename to public/Wb/Doc/CompilerOverview.DD.HTML
index e774ecc..9f80bfa
--- a/public/src/Doc/CompilerOverview.DD.HTML
+++ b/public/Wb/Doc/CompilerOverview.DD.HTML
@@ -25,19 +25,19 @@
 
 
 
-
+
                                  Compiler Index
 
-::/Doc/Asm.DD
+::/Doc/Asm.DD
 
-::/Doc/Directives.DD
+::/Doc/Directives.DD
 
-::/Doc/Options.DD
+::/Doc/Options.DD
 
-::/Doc/PreProcessor.DD
+::/Doc/PreProcessor.DD
 
-::/Doc/ScopingLinkage.DD
+::/Doc/ScopingLinkage.DD
 
-See Hello World.
+See Hello World.
 
diff --git a/public/src/Doc/Credits.DD.HTML b/public/Wb/Doc/Credits.DD.HTML old mode 100644 new mode 100755 similarity index 78% rename from public/src/Doc/Credits.DD.HTML rename to public/Wb/Doc/Credits.DD.HTML index 71b91a2..dde0b82 --- a/public/src/Doc/Credits.DD.HTML +++ b/public/Wb/Doc/Credits.DD.HTML @@ -25,7 +25,7 @@ -
+
                                     Credits
 
 I, Terry A. Davis, wrote all of TempleOS over the past 20.6 years (full-time).  
@@ -36,20 +36,20 @@
 the src code is including on all distro's, from the kernel to the compiler to 
 the boot loaders!  It is public domain, not GPL.
 
-*) ::/Kernel/FontStd.HC, is taken from FreeDOS.  It's public domain.
+*) ::/Kernel/FontStd.HC, is taken from FreeDOS.  It's public domain.
 
-*) ::/Kernel/FontCyrillic.HC, is taken from OrientDisplay without permission.
+*) ::/Kernel/FontCyrillic.HC, is taken from OrientDisplay without permission.
 
-*) ATA Reg and Cmd Definitions are originally from Linux.  Later, I got the 
+*) ATA Reg and Cmd Definitions are originally from Linux.  Later, I got the 
 spec.
 
-*) The heap algorithm, ::/Kernel/Mem/MAllocFree.HC, is adapted from one I saw at 
+*) The heap algorithm, ::/Kernel/Mem/MAllocFree.HC, is adapted from one I saw at 
 Ticketmaster when I worked on their VAX operating system.
 
-*) The LZW compression algorithm, ::/Kernel/Compress.HC, came from a magazine 
+*) The LZW compression algorithm, ::/Kernel/Compress.HC, came from a magazine 
 and I implemented it when I worked for Ticketmaster.
 
-*) The adaptive-step-size-Runge-Kutta algorithm, ::/Adam/AMathODE.HC, is adapted 
+*) The adaptive-step-size-Runge-Kutta algorithm, ::/Adam/AMathODE.HC, is adapted 
 from the book, Numeric Recipies in C.
 
 *) The mountain in some games is from http://www.public-domain-photos.com.  The 
@@ -65,7 +65,7 @@
 *) I included PCIDevice Lst File.
 
 *) Thanks to whoever wrote this CppHtml.HC.Z.  I'm a novice on web stuff and you 
-helped me with html.  See ::/Demo/ToHtmlToTXTDemo/ToHtml.HC.
+helped me with html.  See ::/Demo/ToHtmlToTXTDemo/ToHtml.HC.
 
 *) I looked at bootable CD boot sects, but didn't learn anything, finding it 
 easier to make my own.
@@ -82,13 +82,13 @@
 windows like Windows.  Instead, I made one window per task with no child 
 windows.  He also guided my progress, very obviously.
 
-*) I got Webster's Dictionary and The King James Bible from Project Gutenberg.
+*) I got Webster's Dictionary and The King James Bible from Project Gutenberg.
 
-*) John Carmack inspired me to use "Clamp" as a name instead of "Limit".  He 
+*) John Carmack inspired me to use "Clamp" as a name instead of "Limit".  He 
 inspired me to use "needle" and "haystack" as names.  He inspired me to simplify 
 my Frames-Per-Second code.
 
-*) Bill Gates inspired me to add comments to my Help & Index.
+*) Bill Gates inspired me to add comments to my Help & Index.
 
 *) I hired an artist, Cody Rigby, for $3,000 worth of pixel art.
 
diff --git a/public/src/Home/Doc/Ctrls.DD.HTML b/public/Wb/Doc/Ctrls.DD.HTML
similarity index 63%
rename from public/src/Home/Doc/Ctrls.DD.HTML
rename to public/Wb/Doc/Ctrls.DD.HTML
index 1e0a788..9409f49 100755
--- a/public/src/Home/Doc/Ctrls.DD.HTML
+++ b/public/Wb/Doc/Ctrls.DD.HTML
@@ -25,10 +25,10 @@
 
 
 
-
+
 To create a TempleOS graphic ctrl, you define callback functions and insert a 
-CCtrl structure in the CTask queue.  See ::/Demo/Graphics/Slider.HC, 
-::/Demo/Graphics/ScrollBars.HC and TermBttnNew.  There is a template-code ctrl 
+CCtrl structure in the CTask queue.  See ::/Demo/Graphics/Slider.HC, 
+::/Demo/Graphics/ScrollBars.HC and TermBttnNew.  There is a template-code ctrl 
 generator, if you press <CTRL-SHIFT-L>.
 
diff --git a/public/src/Home/Doc/Customize.DD.HTML b/public/Wb/Doc/Customize.DD.HTML similarity index 73% rename from public/src/Home/Doc/Customize.DD.HTML rename to public/Wb/Doc/Customize.DD.HTML index 4743a64..87446c1 100755 --- a/public/src/Home/Doc/Customize.DD.HTML +++ b/public/Wb/Doc/Customize.DD.HTML @@ -25,14 +25,14 @@ -
+
 
 * You can adjust the mouse movement rate by setting global vars in your start-up 
-file.  See mouse scale.
+file.  See mouse scale.
 
 * You can set your local time zone by setting the local_time_offset global var 
-in a start-up file.  It's units are CDATE_FREQ.  See local time.
+in a start-up file.  It's units are CDATE_FREQ.  See local time.
 
-* Get rid of this msg here.
+* Get rid of this msg here.
 
diff --git a/public/src/Home/Doc/CutCorners.DD.HTML b/public/Wb/Doc/CutCorners.DD.HTML similarity index 75% rename from public/src/Home/Doc/CutCorners.DD.HTML rename to public/Wb/Doc/CutCorners.DD.HTML index cd7d759..4f4f808 100755 --- a/public/src/Home/Doc/CutCorners.DD.HTML +++ b/public/Wb/Doc/CutCorners.DD.HTML @@ -25,7 +25,7 @@ -
+
                                   Cut Corners
 
 There are a few places where I cut corners in the interest of not junking-up 
@@ -35,19 +35,19 @@
 * I made my type-casting operator post-fix because it makes the compiler way 
 cleaner.
 
-* TempleOS does not figure-out FAT32 short name alias numbers.  FAT32DirNew().  
+* TempleOS does not figure-out FAT32 short name alias numbers.  FAT32DirNew().  
 It can cause hard drive corruption, so I might have to do it.  It would really 
 take a lot of junky code for this hatefully, detestable, legacy issue.  "Please 
 don't make me ruin my beautiful shiny-new TempleOS with that!"  I am also not 
 enthused about FAT32 because it is in patent limbo.  FAT32 might get removed 
-from TempleOS.  There is the RedSea  64-bit file system that works perfectly 
+from TempleOS.  There is the RedSea  64-bit file system that works perfectly 
 well.  FAT32 is useful, however, because it assists in transferring between dual 
 booted operating systems.
 
-* I changed the asm opcodes names to remove the ambiguity between insts with 
-different numbers of arguments, making my assembler simpler and I did minimal 
+* I changed the asm opcodes names to remove the ambiguity between insts with 
+different numbers of arguments, making my assembler simpler and I did minimal 
 16-bit asm support, since 64-bit is what you should be using, unless you're 
-doing a boot loader.
+doing a boot loader.
 
 * There are no user-controlled file-sharing locks.  However, the drive and file 
 system have locks and concurrent operations should be fine. 
@@ -61,8 +61,8 @@
 * Even if a local function variable is declared less than 64 bits, the compiler 
 does calculations with 64-bit.
 
-* Print() uses StrPrintJoin().  You cannot use vastly over-sized fields for %f.
+* Print() uses StrPrintJoin().  You cannot use vastly over-sized fields for %f.
 
-* GrEllipse3() is broken on transformations.
+* GrEllipse3() is broken on transformations.
  
diff --git a/public/src/Doc/D3.DD.HTML b/public/Wb/Doc/D3.DD.HTML old mode 100644 new mode 100755 similarity index 96% rename from public/src/Doc/D3.DD.HTML rename to public/Wb/Doc/D3.DD.HTML index 8e54596..6716a51 --- a/public/src/Doc/D3.DD.HTML +++ b/public/Wb/Doc/D3.DD.HTML @@ -25,7 +25,7 @@ -
+
 TempleOS has a class for 3 dimensional points consisting of F64s.  HolyC is not 
 C++ -- it does not support passing or returning values from functions which are 
 not 64-bits, therefore, it can't be implemented with operator overloading.  
diff --git a/public/src/Doc/Date.DD.HTML b/public/Wb/Doc/Date.DD.HTML
old mode 100644
new mode 100755
similarity index 94%
rename from public/src/Doc/Date.DD.HTML
rename to public/Wb/Doc/Date.DD.HTML
index 205e55e..a773211
--- a/public/src/Doc/Date.DD.HTML
+++ b/public/Wb/Doc/Date.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
 Dates are 32-bit signed ints representing the number of days since the birth of 
 Christ.  Negative values represent B.C.E. dates.
 
diff --git a/public/src/Home/Doc/DbgFunSeg.DD.HTML b/public/Wb/Doc/DbgFunSeg.DD.HTML similarity index 95% rename from public/src/Home/Doc/DbgFunSeg.DD.HTML rename to public/Wb/Doc/DbgFunSeg.DD.HTML index d6f71fb..f7b0857 100755 --- a/public/src/Home/Doc/DbgFunSeg.DD.HTML +++ b/public/Wb/Doc/DbgFunSeg.DD.HTML @@ -25,7 +25,7 @@ -
+
 Use %p to print a pointer with FunSeg+Offset or use %P to print a link to a 
 FunSeg+Offset.
  
diff --git a/public/Wb/Doc/DbgOverview.DD.HTML b/public/Wb/Doc/DbgOverview.DD.HTML new file mode 100755 index 0000000..3b03ccd --- /dev/null +++ b/public/Wb/Doc/DbgOverview.DD.HTML @@ -0,0 +1,101 @@ + + + + + + + + + + +
+                               Debugging Overview
+
+* You can enter the debugger with Dbg() or <CTRL-ALT-d>.  You might enter the 
+debugger through a fault.  Enter G() or G2() to continue execution.  Place a 
+call to Dbg() in your code at fatal error points to enter the debugger.  If you 
+see a stk dump, record the label+offset and unassemble, U(). U(_RIP); 
+
+* U(&FunName+offset) to unassemble mem or Uf("FunName") to unassemble a 
+function. U(_RIP-16);
+
+* While debugging, you specify addresses of assembly routines with just the 
+label, as in _MALLOC+0x20.  You specify HolyC function names with & before 
+functions as in &Print+0x10.
+
+* I use progress1-progress4 for debugging because they show on the wallpaper.  
+They're just global int vars.
+
+* You can use AdamLog() to send text to the Adam Task window.  It works like 
+Print().  I never use that.  Instead, I use RawPrint().
+
+* D(), DocD(), RawD() to do 16 column hex dump mem with numbering from zero.  
+With DocD the values are updated continually and you can alter mem by editing.
+
+* Dm(), DocDm(), RawDm() to do 16 column hex dump mem with addresses showing.
+
+* Da() to do one column address dump (for stk, etc.) with symbolic addresses.
+
+* Dr() dumps regs.  You can display and modify regs in the debugger with 
+var-like labels, _RAX, _RBX, etc.
+
+* ClassRep() and the dynamic version ClassRepD() can be used to dump structures.
+
+* Prof() and ProfRep() provide code profiling.  See ::/Demo/InFile/InProfile.IN 
+(This is an InFile.)
+
+* Use RawPrint() to print debug info bypassing the window framework.  You pass 
+these routines a count in milliseconds for how long it should be displayed.  You 
+can use Raw(TRUE) to make all output bypass the window framework.  The WinMgr 
+runs on Core0 and will overwrite raw text from other cores when it updates the 
+scrn.
+
+* Use SysDbg() to set a flag which you can read with IsSysDbg() when you wish to 
+trigger some debug activity.  It's just a handy simple flag, nothing fancy.
+
+* There are flags for various trace options that can help debugging when there 
+are compiler bugs.  Often, you place them in #exe{} blocks.
+  
+  Echo() turns on or off raw data going into the lexical analyzer.
+  
+  Trace() unassembles code generated from the HolyC compiler.
+  
+  PassTrace() shows intermediate code coming-out after optimization.  The bits 
+  ctrl which passes are displayed.
+
+
+* There is a heap check utility which can find leaks.  Use HeapLog(), 
+HeapLogAddrRep() and HeapLogSizeRep().  It's a really simple program which 
+intercepts MAlloc() and Free().  You can customize the code to find other heap 
+issues.
+
+* You can define hndlr functions for <CTRL-ALT-letter> keys with CtrlAltCBSet(). 
+ They operate either in a interrupt environment or in the window mgr when it 
+queues kbd msgs.  You can do Raw() output.  <CTRL-ALT-letter> hndlrs take a 
+scan_code as an arg.
+
+* If you recompile Kernel with BootHDIns(), you can set the MemInit, option to 
+initialize memory to a value at boot, the HeapInit option to cause mem alloced 
+off the heap to be initialized or VarInit option so both global and local vars 
+will be initialized to a value, but global AOT variables are always zero if not 
+initialized.  Pick a non-zero value to discover uninitialized var bugs.  You can 
+set sys_var_init_flag, and sys_heap_init_flag directly after booting.
+
+ diff --git a/public/src/Doc/Define.DD.HTML b/public/Wb/Doc/Define.DD.HTML old mode 100644 new mode 100755 similarity index 63% rename from public/src/Doc/Define.DD.HTML rename to public/Wb/Doc/Define.DD.HTML index f7baa2e..710b483 --- a/public/src/Doc/Define.DD.HTML +++ b/public/Wb/Doc/Define.DD.HTML @@ -25,11 +25,11 @@ -
+
 TempleOS has a string indirection feature implemented with the same hash symbol 
-table entry as #define macros, HTT_DEFINE_STR.  Support for string lists is also 
+table entry as #define macros, HTT_DEFINE_STR.  Support for string lists is also 
 provided, but it's not very efficient, though, you can make a hash table with a 
-list using HashDefineLstAdd().  See ::/Adam/DolDoc/DocInit.HC.
+list using HashDefineLstAdd().  See ::/Adam/DolDoc/DocInit.HC.
 
 If you have an @ as the first char of a define list entry, it is an alias for 
 the prev entry num.
@@ -37,10 +37,10 @@
 Each task can load its own Define strings.  Remember, when a Hash table is 
 searched for a string, if it is not found, the parent task's table is searched.
 
-The DolDoc framework supports text that changes based on entries in the task's 
+The DolDoc framework supports text that changes based on entries in the task's 
 symbol table.  Set a text entry with a D= arg, as in $TX,"",D="DD_MYSTRING"$.  
-See ::/Demo/DolDoc/DefineStr.HC, ::/Adam/ADefine.HC and ::/Doc/MemOverview.DD.
+See ::/Demo/DolDoc/DefineStr.HC, ::/Adam/ADefine.HC and ::/Doc/MemOverview.DD.
 
-See ::/Demo/Define.HC.
+See ::/Demo/Define.HC.
 
diff --git a/public/src/Home/Doc/Demands.DD.HTML b/public/Wb/Doc/Demands.DD.HTML similarity index 77% rename from public/src/Home/Doc/Demands.DD.HTML rename to public/Wb/Doc/Demands.DD.HTML index 49e5e9b..6e32882 100755 --- a/public/src/Home/Doc/Demands.DD.HTML +++ b/public/Wb/Doc/Demands.DD.HTML @@ -25,7 +25,7 @@ -
+
                                     Demands
 
 I, Terry Davis, am high priest of God's official third temple, TempleOS.  
@@ -40,16 +40,16 @@
 
 
 
-* Windows, Linux and VMware (because of mounted drives) must support RedSea file 
+* Windows, Linux and VMware (because of mounted drives) must support RedSea file 
 system when mounting partition, so I can get rid of 1,000 lines of redundant, 
 blemished code -- FAT32.  God's temple must be perfect.  Redundant code for 
 multiple file systems is bad and imperfect.  For this operating system, we want 
 low line count.  More than one driver for the same type of device is also bad.
 
-See ::/Kernel/BlkDev/FileSysRedSea.HC and ::/Adam/Opt/Boot/DskISORedSea.HC.
+See ::/Kernel/BlkDev/FileSysRedSea.HC and ::/Adam/Opt/Boot/DskISORedSea.HC.
 
-::/Kernel/BlkDev/FileSysFAT.HC  :974 lines for FAT32 gets eliminated.
-::/Kernel/BlkDev/DskClus.HC     :152 All the clus operations become blk.
+::/Kernel/BlkDev/FileSysFAT.HC  :974 lines for FAT32 gets eliminated.
+::/Kernel/BlkDev/DskClus.HC     :152 All the clus operations become blk.
 
 * Microsoft must cancel SecureBoot because it makes dual booting impossible.  
 TempleOS is an additional operating system that must be used along-side Windows 
@@ -82,8 +82,8 @@
 secondary master 170/376.  Currently, the wicked CIA plays musical chairs with 
 controllers each time you make an install.  With tons of ugly code, I do my 
 best.
-/Kernel/BlkDev/DskATAId.HC      :286 lines to figure-out I/O ports is gone.
-/Kernel/PCIBIOS.HC              :290 could be eliminated, but maybe we will keep 
+/Kernel/BlkDev/DskATAId.HC      :286 lines to figure-out I/O ports is gone.
+/Kernel/PCIBIOS.HC              :290 could be eliminated, but maybe we will keep 
 it so people can play with PCI devices.
 
 * Until super-simple serial ports are available, PS/2 emulated keyboard and 
@@ -92,13 +92,13 @@
 devices in the same way PS/2 mouse is emulated.  All mice will be two button, 
 one wheel.  No more HID insanity, no more multi-end point, just simple tx rx 
 fifos with soft/hard flowcontrol that can jump the queue.  People with special 
-needs can buy PCI cards.  Our kids deserve code this simple ::/Doc/Comm.HC.  The 
+needs can buy PCI cards.  Our kids deserve code this simple ::/Doc/Comm.HC.  The 
 right to do your own port banging is what the C64 being our God given ancestral 
 land means.
 
 * The x86 IN/OUT port instructions, normally have a delay.  Perhaps, VMware & 
 Intel can enable faster x86 IN/OUT instruction timing for ATA/ATAPI PIO, so 
-bandwidth isn't as bad when doing port I/O.  See ATAGetRes().  We don't want to 
+bandwidth isn't as bad when doing port I/O.  See ATAGetRes().  We don't want to 
 do DMA.  Perhaps, x86 CPU chips need a new TempleOS mode for fast IN/OUT 
 instructions?  I think VMware already does something to speed disk I/O to faster 
 than native speed.
@@ -110,7 +110,7 @@
 
 * Since I don't use paging (for anything), Intel should have an option for  
 no-paging long mode, and optimize it!
-::/Kernel/Mem/PageTables.HC     :135 lines to identity-map gets eliminated.
+::/Kernel/Mem/PageTables.HC     :135 lines to identity-map gets eliminated.
 
 * Desktop computers must have a reset switch and a fast reboot option, skipping 
 diagnostics.  I recommend booting TempleOS from a ROM when the reset bttn is 
@@ -119,28 +119,28 @@
 for all desktop x86 CPUs to ensure tamper-proof trust in the oracle and because 
 God deserves the glory.  There will be just an English version.  A new ROM 
 version is released every seven years.  The ROM should boot like the DVD boots, 
-but with BOOT_SRC_ROM.
+but with BOOT_SRC_ROM.
 
 * We do not want UTF, just 8-bit characters.  <CTRL-ALT-f> toggles between 
-Cyrillic and Std Fonts.  We need the twelve window TextBorder characters added 
+Cyrillic and Std Fonts.  We need the twelve window TextBorder characters added 
 to the VGA font 0x02-0x0D.  Japan, China and Korea must switch to alphabets.  
 Maybe, the United States will change to metric, out of good will.  I am 
-beginning to plan fresh ASCII replacement, ::/Doc/NewASCII.DD.
+beginning to plan fresh ASCII replacement, ::/Doc/NewASCII.DD.
 
-* Microsoft Paint and Linux's Gimp must support TempleOS GR Files.  They are 
+* Microsoft Paint and Linux's Gimp must support TempleOS GR Files.  They are 
 blemish free, unlike BMP files.  The TOSZ Linux utility can be used to make 
-screencasts from TempleOS exported GR Files and AU Files.
+screencasts from TempleOS exported GR Files and AU Files.
 
-* We must have a nice dictionary.  Someone needs to do a Spell Checker, too.
+* We must have a nice dictionary.  Someone needs to do a Spell Checker, too.
 
-* Intel needs to make DolDoc versions of its x86 CPU data sheets documenting all 
+* Intel needs to make DolDoc versions of its x86 CPU data sheets documenting all 
 hardware relevant to TempleOS. 
 
 * We must have the ultimate Bible search engine.  Currently, all we have is     
 filter search.  In the end, it should be a low line-count technique.  Maybe, I 
 allocate 500 lines out of the 20,000 reserve.
 
-* We will make a Standard TempleOS PC.
+* We will make a Standard TempleOS PC.
 
 * "VMware" is a trademark owned by VMware, Inc.
 * "Linux" is a trademark owned by Linus Torvalds.
diff --git a/public/src/Doc/DemoIndex.DD.HTML b/public/Wb/Doc/DemoIndex.DD.HTML
old mode 100644
new mode 100755
similarity index 90%
rename from public/src/Doc/DemoIndex.DD.HTML
rename to public/Wb/Doc/DemoIndex.DD.HTML
index 93dbccb..9415e8b
--- a/public/src/Doc/DemoIndex.DD.HTML
+++ b/public/Wb/Doc/DemoIndex.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                               TempleOS Demo Index
 
 These are arranged in increasing order of difficulty, more or less.  This can be 
@@ -33,7 +33,7 @@
 
 <SPACE> to edit a file and <F5> to run it.
 
-::/Doc/HelloWorld.DD
+::/Doc/HelloWorld.DD
 
 +] Games: Beginner
 +] Games: Intermediate
diff --git a/public/src/Home/Doc/Directives.DD.HTML b/public/Wb/Doc/Directives.DD.HTML
similarity index 94%
rename from public/src/Home/Doc/Directives.DD.HTML
rename to public/Wb/Doc/Directives.DD.HTML
index 90828dd..ccefd24 100755
--- a/public/src/Home/Doc/Directives.DD.HTML
+++ b/public/Wb/Doc/Directives.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
 #define __DATE__ #exe{StreamPrint("\"%D\"",Now);}
 #define __TIME__ #exe{StreamPrint("\"%T\"",Now);}
 #define __LINE__ #exe{StreamPrint("%d",Fs->last_cc->lex_include_stk->line_num);}
@@ -33,6 +33,6 @@
 #define __FILE__ #exe{StreamPrint("\"%s\"",Fs->last_cc->lex_include_stk->full_name);}
 #define __DIR__  #exe{StreamDir;}
 
-See ::/Demo/Directives.HC.
+See ::/Demo/Directives.HC.
 
diff --git a/public/src/Home/Doc/DolDoc.DD.HTML b/public/Wb/Doc/DolDoc.DD.HTML similarity index 58% rename from public/src/Home/Doc/DolDoc.DD.HTML rename to public/Wb/Doc/DolDoc.DD.HTML index 6c375d5..4962ef2 100755 --- a/public/src/Home/Doc/DolDoc.DD.HTML +++ b/public/Wb/Doc/DolDoc.DD.HTML @@ -25,10 +25,10 @@ -
-A DolDoc in memory is a Circular Queue of cmds and graphics.  See CDocEntry for 
-the entry structure.  See TipOfDay() for a nice example.
+
+A DolDoc in memory is a Circular Queue of cmds and graphics.  See CDocEntry for 
+the entry structure.  See TipOfDay() for a nice example.
 
-DolDoc's are used for the editor, viewer, browser, and cmd line.
+DolDoc's are used for the editor, viewer, browser, and cmd line.
 
diff --git a/public/src/Home/Doc/DolDocOverview.DD.HTML b/public/Wb/Doc/DolDocOverview.DD.HTML similarity index 69% rename from public/src/Home/Doc/DolDocOverview.DD.HTML rename to public/Wb/Doc/DolDocOverview.DD.HTML index 71944d3..90f9a62 100755 --- a/public/src/Home/Doc/DolDocOverview.DD.HTML +++ b/public/Wb/Doc/DolDocOverview.DD.HTML @@ -26,7 +26,7 @@ -
+
                                 DolDoc Overview
 
 DolDoc is a TempleOS document type supported by DolDoc Routines.  In a document, 
@@ -35,22 +35,22 @@
 
 Here is the grammar:
 
-<DolDocCmd> := $<TwoLetterCmd>[<FlagList>][,<ArgList>]$ | $ColorName$
+<DolDocCmd> := $<TwoLetterCmd>[<FlagList>][,<ArgList>]$ | $ColorName$
 
-<FlagList> := +|- <FlagCode>[<FlagList>]
+<FlagList> := +|- <FlagCode>[<FlagList>]
 
-<ArgList> := <ArgCode>=<ArgExpression>[,<ArgList>]
+<ArgList> := <ArgCode>=<ArgExpression>[,<ArgList>]
 
 
 The format of DolDoc cmds is a two character code, +/-flags, a comma and args 
 separated by commas.  Some commands have mandatory args.  Optional args are 
-indicated with <ArgCode>=.  A ColorName bracked by dollars, will change the 
+indicated with <ArgCode>=.  A ColorName bracked by dollars, will change the 
 foreground color.
 
-See ::/Doc/Widget.DD, ::/Demo/DolDoc/DemoDoc.DD, and 
-::/Demo/ToHtmlToTXTDemo/ToHtml.HC.
+See ::/Doc/Widget.DD, ::/Demo/DolDoc/DemoDoc.DD, and 
+::/Demo/ToHtmlToTXTDemo/ToHtml.HC.
 
-<TwoLetterCmd>  See Type Defines and PrsDollarCmd().
+<TwoLetterCmd>  See Type Defines and PrsDollarCmd().
 +] TX Text
 +] CR Hard New Line
 +] SR Soft New Line
@@ -91,7 +91,7 @@
 +] HC html
 +] ER Error
 
-<FlagCode>  See Flag Defines and Simple Flags.
+<FlagCode>  See Flag Defines and Simple Flags.
 +] +H Hold
 +] +L Link
 +] +TR Tree
@@ -107,7 +107,7 @@
 +] +LC Left CallBack
 +] +RC Right CallBack
 
-<ArgCode>  See Arg Defines.
+<ArgCode>  See Arg Defines.
 +] T="" Tag Str
 +] LEN="" Field Length
 +] A="" Auxilliary Str
diff --git a/public/src/Home/Doc/EdPullDown.DD.HTML b/public/Wb/Doc/EdPullDown.DD.HTML
similarity index 98%
rename from public/src/Home/Doc/EdPullDown.DD.HTML
rename to public/Wb/Doc/EdPullDown.DD.HTML
index 62b6ddb..7d12cd0 100755
--- a/public/src/Home/Doc/EdPullDown.DD.HTML
+++ b/public/Wb/Doc/EdPullDown.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
 File
 {
   Save(,CH_CTRLS);
diff --git a/public/src/Home/Doc/FAQ.DD.HTML b/public/Wb/Doc/FAQ.DD.HTML
similarity index 98%
rename from public/src/Home/Doc/FAQ.DD.HTML
rename to public/Wb/Doc/FAQ.DD.HTML
index d4de69c..68f3b90 100755
--- a/public/src/Home/Doc/FAQ.DD.HTML
+++ b/public/Wb/Doc/FAQ.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                            Frequently Asked Questions
 
 +] How come it is public domain, not GPL?
diff --git a/public/src/Home/Doc/Features.DD.HTML b/public/Wb/Doc/Features.DD.HTML
similarity index 78%
rename from public/src/Home/Doc/Features.DD.HTML
rename to public/Wb/Doc/Features.DD.HTML
index f99d376..6030f81 100755
--- a/public/src/Home/Doc/Features.DD.HTML
+++ b/public/Wb/Doc/Features.DD.HTML
@@ -25,10 +25,10 @@
 
 
 
-
+
                                TempleOS' Features
 
-* Oracle in with <F7> for words or <SHIFT-F7> for passages.  See tongues.
+* Oracle in with <F7> for words or <SHIFT-F7> for passages.  See tongues.
 
 * x86_64, ring-0-only, single-address-map (identity), multitasking kernel with 
 multicore support.
@@ -37,7 +37,7 @@
 
 * Free, public domain, 100% open source.
 
-* 64-bit compiler/assembler for HolyC.  Truly compiles, doesn't interpret.  Just
+* 64-bit compiler/assembler for HolyC.  Truly compiles, doesn't interpret.  Just
 -in-Time and Ahead-of-Time compilation.  With JIT, no need for object or exe 
 files.
 
@@ -47,15 +47,15 @@
 
 * Keyboard & Mouse support.
 
-* ATA PIO Hard drives, support for FAT32 and RedSea file systems with file 
+* ATA PIO Hard drives, support for FAT32 and RedSea file systems with file 
 compression.
 
 * ATAPI PIO CD/DVD support with RedSea file system.  Can make bootable ISO files 
 so you can roll-your-own distro's.
 
-* Partitioning tool, installer, boot loaders for CD/DVD and hard disk.
+* Partitioning tool, installer, boot loaders for CD/DVD and hard disk.
 
-* Editor/Browser for a new Document Format.  Source files and the command line 
+* Editor/Browser for a new Document Format.  Source files and the command line 
 window can have graphics, links, icons, trees, colors, super/sub scripts, 
 margins.  Everything is seamless through-out the tool chain.  No need for 
 separate resource files.
@@ -83,13 +83,13 @@
 
 * File Manager, <CTRL-d>.
 
-* Code profiler, merge, diff utils.
+* Code profiler, merge, diff utils.
 
 * PC Speaker support with many hymns.
 
 * Music composing tool.
 
-* Many games, demos and documentation.
+* Many games, demos and documentation.
 
 * All source code included.  Only compiles with the included TempleOS compiler 
 and assembler.
diff --git a/public/src/Home/Doc/FileLowLevel.DD.HTML b/public/Wb/Doc/FileLowLevel.DD.HTML
similarity index 83%
rename from public/src/Home/Doc/FileLowLevel.DD.HTML
rename to public/Wb/Doc/FileLowLevel.DD.HTML
index 6e06c43..e096ecc 100755
--- a/public/src/Home/Doc/FileLowLevel.DD.HTML
+++ b/public/Wb/Doc/FileLowLevel.DD.HTML
@@ -26,7 +26,7 @@
 
 
 
-
+
 /* Graphics Not Rendered in HTML */
 
                        CFile
@@ -37,7 +37,7 @@
 
 
 
-    BlkRead()         BlkWrite()
+    BlkRead()         BlkWrite()
 
 
 
diff --git a/public/src/Doc/FileMgr.DD.HTML b/public/Wb/Doc/FileMgr.DD.HTML
old mode 100644
new mode 100755
similarity index 79%
rename from public/src/Doc/FileMgr.DD.HTML
rename to public/Wb/Doc/FileMgr.DD.HTML
index dc3a339..a452251
--- a/public/src/Doc/FileMgr.DD.HTML
+++ b/public/Wb/Doc/FileMgr.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                                   File Manager
 
 <SHIFT CURSOR>
@@ -77,30 +77,30 @@
   Unmount drive(s).
 
 'm'
-  Make CD/DVD ISO.C file.  This creates a RedSea ISO file image of the dir the 
+  Make CD/DVD ISO.C file.  This creates a RedSea ISO file image of the dir the 
   cursor is on.  The name of the ISO file is "::/Tmp/CDDVD.ISO.C" 
-  blkdev.dft_iso_c_filename and can be redefined in your start-up scripts.  You 
+  blkdev.dft_iso_c_filename and can be redefined in your start-up scripts.  You 
   may wish to place it on a different drive.
 
 'B'
   Burn CD/DVD ISO file.  This burns a CD/DVD using the image file, 
-  "::/Tmp/CDDVD.ISO" blkdev.dft_iso_filename to the drive the cursor is on.
+  "::/Tmp/CDDVD.ISO" blkdev.dft_iso_filename to the drive the cursor is on.
 
 
 Instructions on Using CD/DVD's
   If you have not recompiled Kernel and defined your CD/DVD drive, exit the 
-  FileMgr and use Mount to define your CD/DVD drive.  Place a CD/DVD in the 
+  FileMgr and use Mount to define your CD/DVD drive.  Place a CD/DVD in the 
   drive and press 'c' when on top of the CD/DVD drive letter to mount the drive. 
-   It will call DskChg(), the TempleOS cmd to mount removable media.
+   It will call DskChg(), the TempleOS cmd to mount removable media.
 
 
 Instructions on Burning CD/DVD's
   Create a temporary dir to hold files and copy files into the holding dir.  
   Make an ISO image of the dir by pressing 'M' when on top of the dir.  Press 'B
   ' when on top of the CD/DVD ROM drive to burn the ISO, "::/Tmp/CDDVD.ISO" 
-  blkdev.dft_iso_filename, to disk.  If you have not recompiled Kernel and 
-  defined your CD/DVD drive, exit the FileMgr and use Mount.
+  blkdev.dft_iso_filename, to disk.  If you have not recompiled Kernel and 
+  defined your CD/DVD drive, exit the FileMgr and use Mount.
   
-  Making Your Own Distro
+  Making Your Own Distro
   
diff --git a/public/src/Doc/FileMgrPullDown.DD.HTML b/public/Wb/Doc/FileMgrPullDown.DD.HTML old mode 100644 new mode 100755 similarity index 96% rename from public/src/Doc/FileMgrPullDown.DD.HTML rename to public/Wb/Doc/FileMgrPullDown.DD.HTML index 896d539..3fa7213 --- a/public/src/Doc/FileMgrPullDown.DD.HTML +++ b/public/Wb/Doc/FileMgrPullDown.DD.HTML @@ -25,7 +25,7 @@ -
+
 File
 {
   Rename(,'r');
diff --git a/public/Wb/Doc/FileUtils.DD.HTML b/public/Wb/Doc/FileUtils.DD.HTML
new file mode 100755
index 0000000..4c10cf9
--- /dev/null
+++ b/public/Wb/Doc/FileUtils.DD.HTML
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+                                   File Utils
+
+File util FilesFind() wildcard mask consists of a single base dir with multiple 
+file masks separated by ';'.  The '*' and '?' wildcard chars are accepted.  The 
+'~' is your home directory and '!' indicates an exclusion mask.
+
+ 
+"/Kernel/*"             BaseDir: /Kernel        Mask: *
+"/Demo/*.BMP*;*.GR*"    BaseDir: /Demo          Mask: *.BMP* | *.GR*
+"/*.DD*;!*/Bible*"      BaseDir: Root           Mask: *.DD* but not */Bible*
+
+See FilesFindMatch().
+
+Flags are either text or int values.
+
+  FUF_RECURSE           +r Recurse
+  FUF_SINGLE            +s Single File (Optimization for one file in mask.)
+  FUF_FLATTEN_TREE      +f use with '+F'.  Just use +F, probably.
+  FUF_JUST_DIRS         +D just directories
+  FUF_JUST_FILES        +F just files (Flattens trees)
+  FUF_CLUS_ORDER        +O sort by clus (move head one direction)
+  FUF_JUST_TXT          +T just text files      : FILEMASK_TXT
+  FUF_JUST_DD           +$ just DolDoc files    : FILEMASK_DD
+  FUF_JUST_SRC          +S just src files       : FILEMASK_SRC
+  FUF_JUST_AOT          +A just aot files       : FILEMASK_AOT
+  FUF_JUST_JIT          +J just jit files       : FILEMASK_JIT
+  FUF_JUST_GR           +G just graphic files   : FILEMASK_GR
+
+See ST_FILE_UTIL_FLAGS when used in calling program taking text flags.
+
+ diff --git a/public/src/Home/Doc/Frame.DD.HTML b/public/Wb/Doc/Frame.DD.HTML similarity index 75% rename from public/src/Home/Doc/Frame.DD.HTML rename to public/Wb/Doc/Frame.DD.HTML index 7565176..a62c722 100755 --- a/public/src/Home/Doc/Frame.DD.HTML +++ b/public/Wb/Doc/Frame.DD.HTML @@ -25,8 +25,8 @@ -
+
 If you require separate global vars for multiple instances of a routine, you can 
-use Frames.  See SpriteMeshEd(), ::/Demo/Graphics/Pick3D.HC or Noise().
+use Frames.  See SpriteMeshEd(), ::/Demo/Graphics/Pick3D.HC or Noise().
 
diff --git a/public/src/Home/Doc/GRFiles.DD.HTML b/public/Wb/Doc/GRFiles.DD.HTML similarity index 90% rename from public/src/Home/Doc/GRFiles.DD.HTML rename to public/Wb/Doc/GRFiles.DD.HTML index b824269..65cdd18 100755 --- a/public/src/Home/Doc/GRFiles.DD.HTML +++ b/public/Wb/Doc/GRFiles.DD.HTML @@ -25,7 +25,7 @@ -
+
 GR graphics files are 8-bits-per-pixels but only 4-bits of color, with 
 transparency and no palette.  Compression is the standard TempleOS LZW 
 compression.
@@ -67,11 +67,11 @@
   I32   width;
   I32   width_internal; //Rounded-up to multiple of 8.
   I32   height;
-  I32   flags;          //DCF_COMPRESSED? See ::/Kernel/Compress.HC.
+  I32   flags;          //DCF_COMPRESSED? See ::/Kernel/Compress.HC.
   CBGR48 palette[16];   //Included if DCF_PALETTE.
   U8    body[];
 };
 
-See DCSave(), GRWrite(), DCLoad(), and GRRead().
+See DCSave(), GRWrite(), DCLoad(), and GRRead().
 
diff --git a/public/src/Home/Doc/Glossary.DD.HTML b/public/Wb/Doc/Glossary.DD.HTML similarity index 80% rename from public/src/Home/Doc/Glossary.DD.HTML rename to public/Wb/Doc/Glossary.DD.HTML index e7d61b9..3e0ff47 100755 --- a/public/src/Home/Doc/Glossary.DD.HTML +++ b/public/Wb/Doc/Glossary.DD.HTML @@ -25,7 +25,7 @@ -
+
                                     Glossery
 
 +] Abbreviations
@@ -42,14 +42,14 @@
 
 Bt, Bts, Btr, Btc, BEqu
 Define
-DolDoc
-Editor Link Types
-files_find_mask
+DolDoc
+Editor Link Types
+files_find_mask
 Hash Table
 InFile
 Ona
 Pag
-RedSea File System
+RedSea File System
 Sprite
 
 +] CLI, STI, PUSHFD, POPFD
diff --git a/public/src/Doc/God.DD.HTML b/public/Wb/Doc/God.DD.HTML
old mode 100644
new mode 100755
similarity index 82%
rename from public/src/Doc/God.DD.HTML
rename to public/Wb/Doc/God.DD.HTML
index 9ff1f99..ac66234
--- a/public/src/Doc/God.DD.HTML
+++ b/public/Wb/Doc/God.DD.HTML
@@ -25,8 +25,8 @@
 
 
 
-
-The Holy Spirit can puppet you.
+
+The Holy Spirit can puppet you.
 
 
diff --git a/public/Wb/Doc/GraphicsOverview.DD.HTML b/public/Wb/Doc/GraphicsOverview.DD.HTML new file mode 100755 index 0000000..357c77b --- /dev/null +++ b/public/Wb/Doc/GraphicsOverview.DD.HTML @@ -0,0 +1,147 @@ + + + + + + + + + + +
+                               Graphics Overview
+
+Dive into Demo Index to learn.
+
+The order layers are drawn on top of each other is:
+
+
+
+
+
+
+
+
+
+
+
+/* Graphics Not Rendered in HTML */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+* See GrUpdateScrn(), GrUpdateTasks() and GrUpdateTaskWin() called by the WinMgr 
+task 30fps.  Notice the task's draw_it() callback being called.  Only tasks on C
+ore0 are allowed to have windows.  There is one window per task, no child 
+windows.  You can have pop-up child tasks.
+
+* CDCs (device contexts) are a data type for controlling graphics on the scrn or 
+graphics in mem.  The device context structure has thick and color.  You use 
+DCAlias() to create your own structure, with its own color and thick.  Free it 
+with DCDel() when finished.
+
+* gr.dc is a device context for persistent data on the scrn, not needing to be 
+redrawn.  You create an alias for this by using DCAlias() and work with that.  
+See ::/Demo/Graphics/NetOfDots.HC.
+
+* There are various flavors of line and point plotting routines.  GrLine() and 
+GrPlot() are the simplest.  The others allow 3D graphics and rotations.
+
+* See ::/Doc/Transform.DD for adding a transformation.
+
+* You change the Fs->draw_it var to point to your DrawIt() function which gets 
+called each scrn refresh (30 fps).  You draw everything in the window over and 
+over again.  See ::/Demo/Graphics/Box.HC.
+
+* Use the graphic sprite resource editor, <CTRL-r>, to create a sprite that can 
+be plotted with Sprite3() or output to the cmd line with Sprite().  Use $IB,"",B
+I=1$ in a src program to insert the addr of sprite binary data item #1.  To 
+learn how the numbers work, after creating a sprite with <CTRL-r>, toggle to 
+plain text with <CTRL-t> and check its num.  Make an assignment to a ptr var or 
+pass to Sprite3() with $IB,"",BI=n$.  Use <CTRL-r>'s "Pointer to Sprite" to make 
+a $IB...$ entry.  See ::/Demo/Graphics/SpritePlot.HC and 
+::/Demo/Graphics/SpritePlot3D.HC.  The origin (zero point) for a sprite is 
+defined by the cursor location when you pressed <CTRL-r> to make it.  You can 
+edit a sprite by clicking the cursor on it and pressing <CTRL-r> again.
+
+* Set DCF_SYMMETRY in the CDC.flags and call DCSymmetrySet() or DCSymmetry3Set()
+.  This will plot a mirror image in addition to the primary image.  Set 
+DCF_JUST_MIRROR to plot just the image, but this required DCF_SYMMETRY to be set 
+at the same time.  Note: You can only have one symmetry active at a time 
+including in CSprites.
+
+* Use DCNew() to create a mem bitmap which can be used to work off-scrn and 
+which can be GrBloted onto the scrn.  If you set brush member of CDC to another 
+CDC, all the graphic routines will GrBlot() the brush instead of GrPlot().  See 
+::/Demo/Graphics/Blot.HC.
+
+* There are a few raster operations available.  They go in bits 8-11 of the dc->
+color member var which is a CColorROPU32.  ROP_COLLISION is special.  It counts 
+the num of pixs drawn on non-background locations.  Using ROP_COLLISION with 
+vector CSprite's is tricky because overlapping pixs from lines in the CSprite 
+reg as collisions.  You can either work with a nonzero count or convert your 
+CSprite to a bitmap if your subelements draw on top of each other.  Be sure to 
+set ->bkcolor before using ROP_COLLISION.  See ::/Demo/Graphics/Collision.HC and 
+Titanium.
+ 
+* The ->dither_probability_u16 member of CDC is a U16 used to statistically sel 
+between two colors to get something resembling more shades of color.  See 
+::/Demo/Graphics/SunMoon.HC and ::/Demo/Graphics/Shading.HC.  It works with many 
+graphic routines, but not those with pens.
+
+* There is a mechanism built-in for generating motion based on differential 
+equations, which allows realistic physics.  You create an CMathODE struct with 
+ODENew(), passing it the num of vars in the state vect.  For realistic physics, 
+you usually have 2 state vars for each dimension (for each mass) because motion 
+is governed by F=mA which is a 2nd order equation.  The two states are pos and 
+velocity and to solve these you need to supply the derivative of pos and 
+velocity.  The derivative of pos is usually simply the current velocity and the 
+derivative of velocity is the acceleration (the sum of forces on a mass divided 
+by mass).  To help provide meaningful names for values in the state vect, you 
+can create an COrder2D3 ptr and point it to a mass in the state vect.  Six 
+elements in the state vect are required for each mass.
+
+See Math/CMathODE.
+See ::/Demo/Games/Rocket.HC.
+
+ diff --git a/public/src/Doc/GuideLines.DD.HTML b/public/Wb/Doc/GuideLines.DD.HTML old mode 100644 new mode 100755 similarity index 67% rename from public/src/Doc/GuideLines.DD.HTML rename to public/Wb/Doc/GuideLines.DD.HTML index f6d32c9..f85c42f --- a/public/src/Doc/GuideLines.DD.HTML +++ b/public/Wb/Doc/GuideLines.DD.HTML @@ -25,7 +25,7 @@ -
+
                               Directory Structure
 
 /Home All your user data should be placed in here to ease backing-up your data.  
@@ -45,19 +45,19 @@
 
 /Kernel The core of the operating system is found here.  Since priviledge levels 
 are not used, calling it a kernel is deceptive.  It is AOT compiled by 
-BootHDIns().  It is loaded by the boot loader and must fit in 640K.
+BootHDIns().  It is loaded by the boot loader and must fit in 640K.
 
 /Compiler The compiler module src code is found here.  The compiler is AOT 
 compiled to produce a binary file which is loaded at boot.  It, too, is AOT 
-compiled by BootHDIns().
+compiled by BootHDIns().
 
 /Adam The non-kernel part of the operating system is found here.  It is JIT 
-compiled during boot.  The Adam Task is the father of all tasks, like Adam and 
+compiled during boot.  The Adam Task is the father of all tasks, like Adam and 
 Eve.
 
 /0000Boot Boot files go here.  Stage 2 of the TempleOS hard drive master boot 
 loader, the old hard drive master boot record which is just blk#0, and the 
-CD/DVD 0000Kernel.BIN.C file go here.  ASCII 0000 is near the top, 
+CD/DVD 0000Kernel.BIN.C file go here.  ASCII 0000 is near the top, 
 alphabetically, in case you use MagicISO.
 
 
@@ -65,22 +65,22 @@
                                  ::/Home Files
 
 The home dir is specified with '~'.  The home dir is ::/Home unless you change 
-it with HomeSet() or compile the kernel with a cfg option.  An empty /Home dir 
+it with HomeSet() or compile the kernel with a cfg option.  An empty /Home dir 
 should be valid because it will get default files from the root dir. 
 
-~/PersonalMenu.DD a menu viewed with the <CTRL-m> key or by clicking "MENU" in 
+~/PersonalMenu.DD a menu viewed with the <CTRL-m> key or by clicking "MENU" in 
 the upper left border area of a window.
 
-~/PersonalNotes.DD a personal note file viewed with the <CTRL-SHIFT-M> key.
+~/PersonalNotes.DD a personal note file viewed with the <CTRL-SHIFT-M> key.
 
-~/MakeHome.HC a file compiled by the Adam Task during StartOS.
+~/MakeHome.HC a file compiled by the Adam Task during StartOS.
 
 ~/Home* Copy Home* files from the root into ~ and customize them.  These files 
-are invoked when the Adam Task starts-up.
+are invoked when the Adam Task starts-up.
 
-~/Once.HC a file invoked at the start-up of the first user.  Customize this!
+~/Once.HC a file invoked at the start-up of the first user.  Customize this!
 
-~/Registry.HC can be edited by hand or deleted to reset to defaults.  Takes 
+~/Registry.HC can be edited by hand or deleted to reset to defaults.  Takes 
 affect next boot.
 
 
@@ -96,7 +96,7 @@
 
 * Place user data in a subdirectory of /Home, preferably naming the subdirectory 
 the same as the /Apps subdirectory.  Or, place data in the Registry.HC.Z file.  
-See ::/Demo/RegistryDemo.HC.
+See ::/Demo/RegistryDemo.HC.
 
 * If the app needs files in the /Home directory, make an /Apps file called Insta
 ll.HC.Z or Install.IN.Z to create the /Home subdirectory.
@@ -106,17 +106,17 @@
                              Programming Guidelines
 
 * Virtual mem/Paging is not used -- it is identity mapped in x86_64 mode.  The 
-stk does not grow, so alloc enough when the task (process) is Spawned and use 
-the heap for most things.  (The heap refers to MAlloc() and Free().)
+stk does not grow, so alloc enough when the task (process) is Spawned and use 
+the heap for most things.  (The heap refers to MAlloc() and Free().)
 
-* You can Free(NULL).
+* You can Free(NULL).
 
-* See Naming Convention and Abbreviations.
+* See Naming Convention and Abbreviations.
 
-* There are two modes of compiling, AOT Compile Mode and JIT Compile Mode.  
-Compilation is done in both -- neither is "interpreted".  Use JIT Mode.
+* There are two modes of compiling, AOT Compile Mode and JIT Compile Mode.  
+Compilation is done in both -- neither is "interpreted".  Use JIT Mode.
 
-* HolyC
+* HolyC
 
 * Use I64 instead of smaller int sizes because the compiler converts everything 
 to 64-bit.  Don't use unsigned unless it actually breaks.  A policy of signed 
@@ -136,7 +136,7 @@
 
 * Avoid boolean expression assignments.  Boolean assignments don't have short 
 circuit logic and are not compiled efficiently.  The Bool type is just an alias 
-for a 1 byte signed int -- nothing forces it to 1 or 0.  There is a ToBool() 
+for a 1 byte signed int -- nothing forces it to 1 or 0.  There is a ToBool() 
 function that will for to 1 ot 0, however.
 
 * Glbl vars in AOT BIN modules are initialized to zero.  They occupy space in 
@@ -147,13 +147,13 @@
 locked semaphore.  I think semiphores need to be in their own cache line, but 
 I'm not sure.  I use lock bits in a lot of places not aligned.
 
-* SysDbg() and IsSysDbg() are really handy when working on the compiler or 
+* SysDbg() and IsSysDbg() are really handy when working on the compiler or 
 kernel.  It's just a bit you can set and test.
 
 * I don't use U0 * because the size is zero for ptr arithmetic.
 
-* Use CH_SHIFT_SPACE for spaces in quotes in source code because I run 
-Spaces-to-Tabs on source code.
+* Use CH_SHIFT_SPACE for spaces in quotes in source code because I run 
+Spaces-to-Tabs on source code.
 
 * Do not use #if or #ifdef
 
@@ -161,11 +161,11 @@
 
                                 Hash Sym Tables
 
-* See ::/Adam/AHash.HC for examples of how the hash tables are set-up.  
+* See ::/Adam/AHash.HC for examples of how the hash tables are set-up.  
 Basically, syms are placed into hash tables and child process hash tables are 
 chained to parents.  This provides scopes for vars and functions.
 
-* adam_task->hash_table holds the HolyC syms loaded in on start-up.
+* adam_task->hash_table holds the HolyC syms loaded in on start-up.
 
 * Fs->hash_table holds user HolyC syms and if a sym is not found, it checks 
 parents.  When a duplicate sym is added to the table, it overshadows the prev 
@@ -173,30 +173,30 @@
 prompt, make changes and reinclude it.  Old syms are overshadowed but they are 
 still there.  Periodically, kill the TASK and start fresh when mem is low.  If 
 you wish your applications to free themselves instead of staying in mem, spawn 
-or PopUp() a task to run the application and kill it when it's done.
+or PopUp() a task to run the application and kill it when it's done.
 
-* To display the contents of a hash table, use the Who() routine or the 
-varients.  HashDepthRep() gives a histogram  of how long the chains are, in case 
+* To display the contents of a hash table, use the Who() routine or the 
+varients.  HashDepthRep() gives a histogram  of how long the chains are, in case 
 you wish to make hash table sizes bigger.
 
 
 
                                Assembly Language
 
-See ::/Doc/Asm.DD.
+See ::/Doc/Asm.DD.
 
-* FS must always point to the cur CTask.
+* FS must always point to the cur CTask.
 
-* GS must always point to the cur CCPU.
+* GS must always point to the cur CCPU.
 
 * Don't change the segment regs unless interrupts are off.  It's hard to do, 
-anyway.  SET_FS_BASE and SET_GS_BASE.
+anyway.  SET_FS_BASE and SET_GS_BASE.
 
-* When interacting with HolyC compiled code, preserve RBP, RSI, RDI, R10-R15 
+* When interacting with HolyC compiled code, preserve RBP, RSI, RDI, R10-R15 
 because the compiler uses these for reg vars.  You are free to clobber RAX, RBX, 
-RCX, RDX, R8 and R9.  See Compiler Reg Masks, PUSH_C_REGS and POP_C_REGS
+RCX, RDX, R8 and R9.  See Compiler Reg Masks, PUSH_C_REGS and POP_C_REGS
 
-* I recommend using the standard stk frame for functions because Caller() is 
+* I recommend using the standard stk frame for functions because Caller() is 
 used to display the call stk, such as for the wallpaper.
         PUSH    RBP
         MOV     RBP,RSP
diff --git a/public/src/Home/Doc/Hash.DD.HTML b/public/Wb/Doc/Hash.DD.HTML
similarity index 67%
rename from public/src/Home/Doc/Hash.DD.HTML
rename to public/Wb/Doc/Hash.DD.HTML
index 33915f3..e9d7069 100755
--- a/public/src/Home/Doc/Hash.DD.HTML
+++ b/public/Wb/Doc/Hash.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
 /* Graphics Not Rendered in HTML */
 
 
@@ -57,22 +57,22 @@
 parent task's sym table is checked.  All tasks chain back to the Adam task.
 
 TempleOS sym tables are implemented with an array of linked-lists.  A num is 
-generated from a string by HashStr() to index into the array of linked-lists.  
+generated from a string by HashStr() to index into the array of linked-lists.  
 Multiple strings can generate the same num, so linked-lists are built.  Newer 
 entries overshadow older ones.
 
-There are various types of entries.  See Hash Entry Types.
+There are various types of entries.  See Hash Entry Types.
 
-Symbol Look-up (Used many places including the JIT Compiler and Loader.)
-1) Symbol name is hashed by adding and shifting the ASCII of all chars.
-2) hash table->body[] array is indexed.
+Symbol Look-up (Used many places including the JIT Compiler and Loader.)
+1) Symbol name is hashed by adding and shifting the ASCII of all chars.
+2) hash table->body[] array is indexed.
 3) Linked-lst is traversed until match of text and type of entry.
-4) If not found, hash table->next table is searched.
+4) If not found, hash table->next table is searched.
 
 Duplicate entries are allowed -- they overshadow old entries.
 
 Address-to-Symbol Look-up (Slow because not important. We could use trees.)
-1) FunSeg Cache is scanned.
-2) Hash Tables are scanned.
+1) FunSeg Cache is scanned.
+2) Hash Tables are scanned.
 
diff --git a/public/src/Home/Doc/HeapDbg.DD.HTML b/public/Wb/Doc/HeapDbg.DD.HTML similarity index 84% rename from public/src/Home/Doc/HeapDbg.DD.HTML rename to public/Wb/Doc/HeapDbg.DD.HTML index e938dce..05fadca 100755 --- a/public/src/Home/Doc/HeapDbg.DD.HTML +++ b/public/Wb/Doc/HeapDbg.DD.HTML @@ -25,8 +25,8 @@ -
-Recompile the kernel with _CFG_HEAP_DBG=TRUE if you want more heap debugging.  
+
+Recompile the kernel with _CFG_HEAP_DBG=TRUE if you want more heap debugging.  
 You are on your own.
 
diff --git a/public/src/Home/Doc/HelloWorld.DD.HTML b/public/Wb/Doc/HelloWorld.DD.HTML similarity index 99% rename from public/src/Home/Doc/HelloWorld.DD.HTML rename to public/Wb/Doc/HelloWorld.DD.HTML index f8e17c7..e488016 100755 --- a/public/src/Home/Doc/HelloWorld.DD.HTML +++ b/public/Wb/Doc/HelloWorld.DD.HTML @@ -25,7 +25,7 @@ -
+
 //Press F5 in the editor to compile and run.
 
 --------Hello.HC.Z---------
diff --git a/public/Wb/Doc/HelpIndex.DD.HTML b/public/Wb/Doc/HelpIndex.DD.HTML
new file mode 100755
index 0000000..4a238bf
--- /dev/null
+++ b/public/Wb/Doc/HelpIndex.DD.HTML
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+                                      Help
+
++] Keyboard Ctrls
++] Mouse Ctrls
++] Keyboard-Mouse Ctrls
+
+Welcome         About TempleOS
+Command Line    Take Tour
+Demo Index      Key Map
+Features        Requirements
+Charter         Strategic Decisions
+F.A.Q.          Glossary
+HolyC           Compiler Index
+Why Not More?   Demands
+The Std TempleOS PC
+        
++] User Help
++] Admin Help
++] Programmer help
++] System Programmer Help
+
+
+                                     Index
+AutoComplete
+Bit
+Boot
+Call
+Char Overview
+Char Routines
+Circular Queue
+Cmd Line Overview
+Cmd Line Routines
+Compiler Overview
+Compiler Routines
+Compression
+Ctrls
+Data Types
+Date
+Debugging Overview
+Debugging Routines
+Define
+Devices
+Disk
+Doc Overview
+Doc Routines
+Exceptions
+File
+File Utils
+Frames
+God
+Graphics Overview
+Graphics Routines
+Hash
+Help System
+HolyC
+InFile
+Info
+Install
+I/O
+Job
+Key Allocations
+Keyboard Devices
+Link Types
+Math
+Memory Overview
+Memory Routines
+Menus
+Messages
+Misc
+Mouse
+MultiCore
+OpCodes
+Operator Precedences
+PCI
+Print("") Fmt Strings
+Processor
+Profiler
+RedSea
+Registry
+Scan Codes
+ScrnCast
+Sound
+Sprites
+StdIn
+StdOut
+String
+Task
+TextBase Layer
+Time
+Training
+TOSZ
+Utils
+Windows
+
+ diff --git a/public/src/Doc/HelpSystem.DD.HTML b/public/Wb/Doc/HelpSystem.DD.HTML old mode 100644 new mode 100755 similarity index 85% rename from public/src/Doc/HelpSystem.DD.HTML rename to public/Wb/Doc/HelpSystem.DD.HTML index 90c0bf3..adc4eb4 --- a/public/src/Doc/HelpSystem.DD.HTML +++ b/public/Wb/Doc/HelpSystem.DD.HTML @@ -25,16 +25,16 @@ -
+
 #help_index "Topic/SubTopic;OtherTopic"
 The help index preprocessor compiler directive sets the topics for syms 
 subsequently defined.  You specify subtopics with a '/' tree hierarchy and 
-separate multiple topics with a ';'.  The index ctrls HI:index links.
+separate multiple topics with a ';'.  The index ctrls HI:index links.
 
 public causes a sym to appear in help_index reports.
 
 #help_file "filename[.DD.Z]"
 The help file preprocessor directive makes a file into the heading of a 
-HI:index report for the current help index.
+HI:index report for the current help index.
 
diff --git a/public/src/Home/Doc/HolyC.DD.HTML b/public/Wb/Doc/HolyC.DD.HTML similarity index 75% rename from public/src/Home/Doc/HolyC.DD.HTML rename to public/Wb/Doc/HolyC.DD.HTML index a3e77a1..7f1632c 100755 --- a/public/src/Home/Doc/HolyC.DD.HTML +++ b/public/Wb/Doc/HolyC.DD.HTML @@ -25,12 +25,12 @@ -
+
                                      HolyC
 
-* See ::/Doc/CompilerOverview.DD.
+* See ::/Doc/CompilerOverview.DD.
 
-* See Scoping and Linkage for details on extern, import, _extern, _import, etc.
+* See Scoping and Linkage for details on extern, import, _extern, _import, etc.
 
 * Built-in types include I0,I8,I16,I32,I64 for signed 0-8 byte ints and U0,U8,U1
 6,U32,U64 for unsigned 0-8 byte ints and F64 for 8 byte floats.
@@ -61,8 +61,8 @@
   
   Test(,3);
 
-* A char const all alone is sent to PutChars().  A string with or without args 
-is sent to Print().  An empty string literal signals a variable fmt_str follows.
+* A char const all alone is sent to PutChars().  A string with or without args 
+is sent to Print().  An empty string literal signals a variable fmt_str follows.
 
   void DemoC(char drv,char *fmt,char *name,int age)
   {
@@ -85,8 +85,8 @@
 * When dealing with function addresses such as for callbacks, precede the name 
 with "&".
 
-* Type casting is postfix.  To typecast int or F64, use ToI64(), ToBool() or 
-ToF64(). (TempleOS follows normal C float<-->int conversion, but sometimes you 
+* Type casting is postfix.  To typecast int or F64, use ToI64(), ToBool() or 
+ToF64(). (TempleOS follows normal C float<-->int conversion, but sometimes you 
 want to override.  These functions are better than multiplying by "1.0" to 
 convert to float.) 
 
@@ -94,7 +94,7 @@
 start-up, in order.
 
 * There are no bit fields, but there are bit access routines and you can access 
-bytes or words within any int.  See I64 declaration.  A class can be accessed as 
+bytes or words within any int.  See I64 declaration.  A class can be accessed as 
 a whole are subints, if you put a type in front of the class declaration.
   
   public I64i union I64         //"I64i" is intrinsic.  We are defining "I64".
@@ -127,8 +127,8 @@
   
   public U0 GrPrint(CDC *dc,I64 x,I64 y,U8 *fmt,...)
   {
-    U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);//SPrintF() with MAlloc()ed string.
-    GrPutS(dc,x,y,buf); //Plot string at x,y pixels. GrPutS is not public.
+    U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);//SPrintF() with MAlloc()ed string.
+    GrPutS(dc,x,y,buf); //Plot string at x,y pixels. GrPutS is not public.
     Free(buf);
   }
   
@@ -153,7 +153,7 @@
 * Allows ranges like "case 4...7:" in switch stmts.
 
 * A no case number causes next higher int case in switch stmts.  See 
-::/Demo/NullCase.HC.
+::/Demo/NullCase.HC.
 
   I64 i;
   for (i=0;i<20;i++) 
@@ -169,7 +169,7 @@
 * Switch statements can be nestled with a single switch expression!  This is 
 known as a "sub_switch" statement.  start/end are used to group cases.  Don't 
 goto out of, throw an exception out of, or return out of the start front porch 
-area.  See ::/Demo/SubSwitch.HC.
+area.  See ::/Demo/SubSwitch.HC.
 
   I64 i;
   for (i=0;i<10;i++)
@@ -199,7 +199,7 @@
 
   U0 Main()
   {
-    //Only use REGG_LOCAL_VARS or REGG_LOCAL_NON_PTR_VARS for reg vars or else 
+    //Only use REGG_LOCAL_VARS or REGG_LOCAL_NON_PTR_VARS for reg vars or else 
   clobbered.
     I64 reg R15 i=5, noreg j=4;
     no_warn i;
@@ -216,10 +216,10 @@
   }
 
 * interrupt, haserrcode, public, argpop or noargpop are function flags. See 
-IRQKbd().
+IRQKbd().
 
 * A single quote can encompass multiple characters.  'ABC' is equ to 0x434241.  
-PutChars() takes multiple characters.
+PutChars() takes multiple characters.
 
   asm {
   HELLO_WORLD::
@@ -240,7 +240,7 @@
 
 * There is no question-colon operator.
 
-* TempleOS operator precedence
+* TempleOS operator precedence
   `,>>,<<
   *,/,%
   &
@@ -254,15 +254,15 @@
   ||
   =,<<=,>>=,*=,/=,&=,|=,^=,+=,-=
 
-* You can use Option(OPTf_WARN_PAREN,ON) to find unnecessary parentheses in 
+* You can use Option(OPTf_WARN_PAREN,ON) to find unnecessary parentheses in 
 code.
 
-* You can use Option(OPTf_WARN_DUP_TYPES,ON) to find dup local var type stmts.
+* You can use Option(OPTf_WARN_DUP_TYPES,ON) to find dup local var type stmts.
 
 * With the #exe{} feature in your src code, you can place programs that insert 
-text into the stream of code being compiled.  See #exe {} for an example where 
+text into the stream of code being compiled.  See #exe {} for an example where 
 the date/time and compile-time prompting for cfguration data is placed into a 
-program.  StreamPrint() places text into a src program stream following the 
+program.  StreamPrint() places text into a src program stream following the 
 conclusion of the #exe{} blk.
 
 * No #define functions exist (I'm not a fan)
@@ -274,27 +274,27 @@
 * Can't use <> with #include, use "".
 
 * "$" is an escape character.  Two dollar signs signify an ordinary $.  See 
-DolDoc.  In asm or HolyC code, it also refers to the inst's address or the 
+DolDoc.  In asm or HolyC code, it also refers to the inst's address or the 
 offset in a class definition. 
 
 * union is more like a class, so you don't reference it with a union label after 
-you define it.  Some common unions are declared in KernelA.HH for 1,2,4 and 8 
+you define it.  Some common unions are declared in KernelA.HH for 1,2,4 and 8 
 byte objects.  If you place a type in front of a union declaration, that is the 
-type when used by itself.  See ::/Demo/SubIntAccess.HC. 
+type when used by itself.  See ::/Demo/SubIntAccess.HC. 
 
 * class member vars can have meta data. format and data are two meta data types 
 now used.  All compiler structures are saved and you can access the compiler's 
-info about classes and vars.  See ::/Demo/ClassMeta.HC and  DocForm().
+info about classes and vars.  See ::/Demo/ClassMeta.HC and  DocForm().
 
 * There is a keyword lastclass you use as a dft arg.  It is set to the class 
-name of the prev arg.  See ::/Demo/LastClass.HC, ClassRep(), DocForm()  and 
-::/Demo/Dsk/BlkDevRep.HC.
+name of the prev arg.  See ::/Demo/LastClass.HC, ClassRep(), DocForm()  and 
+::/Demo/Dsk/BlkDevRep.HC.
 
-* See ::/Demo/Exceptions.HC.  try{} catch{} and throw are different from C++. th
+* See ::/Demo/Exceptions.HC.  try{} catch{} and throw are different from C++. th
 row is a function with an 8-byte or less char arg.  The char string passed in th
 row() can be accessed from within a catch{} using the Fs->except_ch.  Within a c
 atch {} blk, set the var Fs->catch_except to TRUE if you want to terminate the 
-search for a hndlr.  Use PutExcept() as a hndlr, if you like.
+search for a hndlr.  Use PutExcept() as a hndlr, if you like.
 
 * A function is available similar to sizeof which provides the offset of a 
 member of a class.  It's called offset.  You place the class name and member 
@@ -307,25 +307,25 @@
 * lock{} can be used to apply asm LOCK prefixes to code for safe multicore 
 read-modify-write accesses.  The code bracked with have LOCK asm prefix's 
 applied to relevant insts within.  It's a little shoddy.  See 
-::/Demo/MultiCore/Lock.HC.
+::/Demo/MultiCore/Lock.HC.
 
-* There is a function called MSize() which gives the size of an object alloced 
+* There is a function called MSize() which gives the size of an object alloced 
 off the heap.  For larger size allocations, the system rounds-up to a power of 
 two, so MSize() lets you know the real size and you can take full advantage of 
 it.
 
-* You CAN Free() a NULL ptr.  Useful variants of MAlloc() can be found Here.  
+* You CAN Free() a NULL ptr.  Useful variants of MAlloc() can be found Here.  
 Each task has a heap and you can MAlloc and Free off-of other task's heaps, or 
-make an independent heap with HeapCtrlInit().  See HeapLog() for an example.
+make an independent heap with HeapCtrlInit().  See HeapLog() for an example.
 
 * The stk does not grow because virtual mem is not used.  I recommend allocating 
-large local vars from the heap.  You can change MEM_DFT_STK and recompile Kernel 
-or request more when doing a Spawn().  You can use CallStkGrow(), but it's odd.  
-See ::/Demo/StkGrow.HC. 
+large local vars from the heap.  You can change MEM_DFT_STK and recompile Kernel 
+or request more when doing a Spawn().  You can use CallStkGrow(), but it's odd.  
+See ::/Demo/StkGrow.HC. 
 
 * Only one base class is allowed.
 
-* printf() has new codes.  See Print("") Fmt Strings.
+* printf() has new codes.  See Print("") Fmt Strings.
 
 * All values are extended to 64-bit when accessed.  Intermediate calculations 
 are done with 64-bit values.
diff --git a/public/src/Home/Doc/InFile.DD.HTML b/public/Wb/Doc/InFile.DD.HTML
similarity index 62%
rename from public/src/Home/Doc/InFile.DD.HTML
rename to public/Wb/Doc/InFile.DD.HTML
index 5490485..4ab98ac 100755
--- a/public/src/Home/Doc/InFile.DD.HTML
+++ b/public/Wb/Doc/InFile.DD.HTML
@@ -25,24 +25,24 @@
 
 
 
-
+
 InFiles are used to generate user input to automate operations.  The TempleOS 
 tour is done with an InFile.  It reminds me of a Unix pipe because StdOut of one 
 gets chained into StdIn of another.
 
-When an InFile runs, a child task is Spawn()ed which intercepts real user input 
-and generates fake input.  InFiles are HolyC programs run by the child whose 
-stdout goes to the parent's input buffer.  Msg() can be included in an InFile to 
+When an InFile runs, a child task is Spawn()ed which intercepts real user input 
+and generates fake input.  InFiles are HolyC programs run by the child whose 
+stdout goes to the parent's input buffer.  Msg() can be included in an InFile to 
 send special keys or mouse cmds to the parent.  While an InFile is running, the 
 normal input gets diverted to the InFile task and can be filtered and sent back 
 to the parent task.  Unless you are driving functions which prompt for data, you 
 can probably use an #include file in place of an InFile.
 
-See ::/Demo/InFile/InDir.IN.
+See ::/Demo/InFile/InDir.IN.
 
-Note: In("") can be used if all you need is to send ASCII characters.  It 
-differs from InStr().  You'll probably use In() a lot and not InStr().  With In(
+Note: In("") can be used if all you need is to send ASCII characters.  It 
+differs from InStr().  You'll probably use In() a lot and not InStr().  With In(
 ), for example, you can place answers to the prompts for recompiling the Kernel 
-module during BootHDIns().
+module during BootHDIns().
 
diff --git a/public/src/Home/Doc/Install.DD.HTML b/public/Wb/Doc/Install.DD.HTML similarity index 71% rename from public/src/Home/Doc/Install.DD.HTML rename to public/Wb/Doc/Install.DD.HTML index 5edb7e3..6d47c2b 100755 --- a/public/src/Home/Doc/Install.DD.HTML +++ b/public/Wb/Doc/Install.DD.HTML @@ -25,7 +25,7 @@ -
+
                               Installing TempleOS
 
 Burn a CD with software that supports ISO files.  Then, boot it.  It's a live 
@@ -38,10 +38,10 @@
 connecting a spare additional hard drive and using the BIOS to select which 
 drive to boot.
 
-The ::/Misc/OSInstall.HC script will automate much of this.  It runs if you boot 
+The ::/Misc/OSInstall.HC script will automate much of this.  It runs if you boot 
 the CD/DVD-ROM.
 
-See Boot.DD for an overview of booting.  See Requirements for supported 
+See Boot.DD for an overview of booting.  See Requirements for supported 
 hardware.
 
 Two TempleOS partitions are highly recommended, so you can boot to a back-up and 
@@ -49,7 +49,7 @@
 for your TempleOS partitions.
 
 1)
-  Mount() use if the drive is partitioned.
+  Mount() use if the drive is partitioned.
     This command mounts a drive making it accessible.  For simplicity, sel 'C' 
     as the first drive letter for your hard drive.  The first partition will be 
     'C', second, 'D', etc.  TempleOS needs 3 numbers to utilize a hard drive -- 
@@ -57,9 +57,9 @@
     C with a 0x prefix.  If the probe was successful, you can just enter the 
     number in the probe box instead of base0.
   
-  DskPrt('C') use if drive is not partitioned
+  DskPrt('C') use if drive is not partitioned
   
-    This will perform a special Mount() automatically.
+    This will perform a special Mount() automatically.
     
     WARNING:  This command erases everything on a hard drive.  It repartitions a 
     whole drive and formats the partitions.  This command should be skipped if 
@@ -67,28 +67,28 @@
     
     
     WARNING:  This command doesn't play well with other operating systems.  
-    You'll need to do a BootMHDZero() to restore your drive to a state where 
+    You'll need to do a BootMHDZero() to restore your drive to a state where 
     other operating systems can partition it.
   
-2) Fmt('D',TRUE,FALSE,FSt_FAT32)
-  This command formats a drive with FAT32 or the RedSea file system type.  Use 
+2) Fmt('D',TRUE,FALSE,FSt_FAT32)
+  This command formats a drive with FAT32 or the RedSea file system type.  Use 
   the drive letter of the partition in place of 'D'.
   
   WARNING:  If you are upgrading, be sure not to lose the file, /0000Boot/OldMBR
   .BIN.C.
   
-3) CopyTree("T:/","D:/")
+3) CopyTree("T:/","D:/")
   This command is used to copy files onto a hard drive partition from the 
   CD/DVD.  Use the drive letter of the partition in place of 'D'.
   
-4) BootHDIns('D')
+4) BootHDIns('D')
   This command recompiles the source code on a drive and writes to the drive's 
-  boot record.  You'll need to reenter the Mount information so it can be stored 
+  boot record.  You'll need to reenter the Mount information so it can be stored 
   in the kernel.
   
-5) Use Linux's Grub or TempleOS' BootMHDIns('D')
+5) Use Linux's Grub or TempleOS' BootMHDIns('D')
   
-  The BootMHDIns() command places a boot loader on a drive.  It saves the old 
+  The BootMHDIns() command places a boot loader on a drive.  It saves the old 
   master boot record to /0000Boot/OldMBR.BIN.C and replaces it.  When you boot, 
   you will have the option of booting the old master boot record.  This command 
   can be skipped if you already have a boot loader.  Be sure not to lose the 
diff --git a/public/Wb/Doc/Job.DD.HTML b/public/Wb/Doc/Job.DD.HTML
new file mode 100755
index 0000000..9035261
--- /dev/null
+++ b/public/Wb/Doc/Job.DD.HTML
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+/* Graphics Not Rendered in HTML */
+               PopUpPrint                         User          ExePrint
+
+
+
+                  PopUp                                          ExePutS
+
+
+
+ Core0 AdamTask  SrvCmdLine   AP SethTask       UserCmdLine
+
+
+
+
+
+
+         SrvTaskCont                          UserTaskCont
+
+
+
+        JobsHndlr
+
+
+
+         JobRunOne           JobRunOne         ExeCmdLine      ExeCmdLine
+
+
+
+
+CJob nodes are one of five types.  User applications deal with text or msgs.  
+JobRunOne() will call a function, spawn a task or execute some text src code.
+
+#define JOBT_TEXT_INPUT         0 //TaskText()  Feed StdIn 
+#define JOBT_MSG                1 //TaskMsg()   Post msg 
+#define JOBT_EXE_STR            2 //TaskExe()   Compile & execute src code text
+#define JOBT_CALL               3 //JobQue()    Tell MP to call function
+#define JOBT_SPAWN_TASK         4 //Spawn()     Tell MP to spawn task
+
+Several other routines include a call to JobsHndlr() that gives them powerful 
+ability to execute servant cmds.
+
+ diff --git a/public/src/Home/Doc/KeyAlloc.DD.HTML b/public/Wb/Doc/KeyAlloc.DD.HTML similarity index 79% rename from public/src/Home/Doc/KeyAlloc.DD.HTML rename to public/Wb/Doc/KeyAlloc.DD.HTML index 8010d5e..d5e6df0 100755 --- a/public/src/Home/Doc/KeyAlloc.DD.HTML +++ b/public/Wb/Doc/KeyAlloc.DD.HTML @@ -25,7 +25,7 @@ -
+
                                 Key Allocations
 
 See Char for definition of scan codes.
@@ -33,19 +33,19 @@
 See Key Map for a detailed list of key commands.
 
 When you are at the cmd line, editing documents, browsing documentation and 
-help, entering items in forms or in menu's, the DolDoc editor handles keys.  It 
-allows you to define your own key hndlrs in a MyPutKey() function.  If you 
-choose, you can catch keys, overriding the default hndlrs.  See DocPutKey().  
+help, entering items in forms or in menu's, the DolDoc editor handles keys.  It 
+allows you to define your own key hndlrs in a MyPutKey() function.  If you 
+choose, you can catch keys, overriding the default hndlrs.  See DocPutKey().  
 The following is an overview of key allocations.
 
-<ALT-keys> and <ALT-SHIFT-keys>  Free for user configurations in your MyPutKey() 
+<ALT-keys> and <ALT-SHIFT-keys>  Free for user configurations in your MyPutKey() 
 hndlr, except for ALT-BACKSPACE (undo).  There are a few examples pre-defined, 
 but you can change them if you wish.
 
 <CTRL-ALT-keys> and <CTRL-ALT-SHIFT-keys>  Handled at a system level, NOT by the 
-CDoc editor.  I reserve the right to alloc these, but in the mean time, you can 
-define your own hndlrs with CtrlAltCBSet().  They operate either in a interrupt 
-environment or in the window mgr when it queues kbd msgs.  You can do Raw() 
+CDoc editor.  I reserve the right to alloc these, but in the mean time, you can 
+define your own hndlrs with CtrlAltCBSet().  They operate either in a interrupt 
+environment or in the window mgr when it queues kbd msgs.  You can do Raw() 
 output.  <CTRL-ALT-letter> hndlrs take a scan_code as an arg.
 
 <CTRL-function key>  Auto-completes local words.
diff --git a/public/src/Doc/KeyDev.DD.HTML b/public/Wb/Doc/KeyDev.DD.HTML
old mode 100644
new mode 100755
similarity index 53%
rename from public/src/Doc/KeyDev.DD.HTML
rename to public/Wb/Doc/KeyDev.DD.HTML
index edf2c32..ec4707d
--- a/public/src/Doc/KeyDev.DD.HTML
+++ b/public/Wb/Doc/KeyDev.DD.HTML
@@ -25,27 +25,27 @@
 
 
 
-
-The editor mostly stays in a GetKey()/PutKey() loop.  The putkey portion is 
+
+The editor mostly stays in a GetKey()/PutKey() loop.  The putkey portion is 
 where keys are acted-upon.  TempleOS has a chain of putkey hndlrs in a 
 Circular Queue with priorities.  The highest priority hndlrs can choose to 
 terminate handling, otherwise, the keys get sent on down the chain.
 
-KeyDevAdd() defines a putkey device with a priority.  "Device" might be a 
+KeyDevAdd() defines a putkey device with a priority.  "Device" might be a 
 misnomer.  Currently, the following are defined:
 
 Priority    Hndlr
 ---------- ---------
-0x20000000 MyPutKey() user hndlr
-0x40000000 KDInputFilterPutKey() for In(), InStr(), and InFile() handling.
-0x60000000 KDRawPutKey() nonwindowed direct to video mem debug output. 
-0x80000000 KDDocPutKey() standard document cmds
+0x20000000 MyPutKey() user hndlr
+0x40000000 KDInputFilterPutKey() for In(), InStr(), and InFile() handling.
+0x60000000 KDRawPutKey() nonwindowed direct to video mem debug output. 
+0x80000000 KDDocPutKey() standard document cmds
 
 Since handling individual keys is slow, TempleOS supports PutS() as well.  If no 
 puts hndlr is defined, individual keys are sent.
 
-CDoc.user_put_key and CDoc.user_put_s are call back routines which offer some 
-neat tricks.  See ::/Apps/Psalmody/JukeBox.HC.  There is a var CDoc.user_put_dat
+CDoc.user_put_key and CDoc.user_put_s are call back routines which offer some 
+neat tricks.  See ::/Apps/Psalmody/JukeBox.HC.  There is a var CDoc.user_put_dat
 a which gets passed to them.
 
diff --git a/public/src/Home/Doc/Lex.DD.HTML b/public/Wb/Doc/Lex.DD.HTML similarity index 72% rename from public/src/Home/Doc/Lex.DD.HTML rename to public/Wb/Doc/Lex.DD.HTML index 2616967..4705278 100755 --- a/public/src/Home/Doc/Lex.DD.HTML +++ b/public/Wb/Doc/Lex.DD.HTML @@ -25,10 +25,10 @@ -
+
 The compiler's lexical analyzer can be used in your programs to simplify 
-parsing.  See Doc Parsing or Parse Opcode File.
+parsing.  See Doc Parsing or Parse Opcode File.
 
-See Tokens.
+See Tokens.
 
diff --git a/public/src/Home/Doc/MemOverview.DD.HTML b/public/Wb/Doc/MemOverview.DD.HTML similarity index 71% rename from public/src/Home/Doc/MemOverview.DD.HTML rename to public/Wb/Doc/MemOverview.DD.HTML index 8e0e3f8..884c565 100755 --- a/public/src/Home/Doc/MemOverview.DD.HTML +++ b/public/Wb/Doc/MemOverview.DD.HTML @@ -25,7 +25,7 @@ -
+
                                 Memory Overview
 
 Paging is practically not used.  64-bit mode requires paging, however, so it is 
@@ -40,42 +40,42 @@
 2Gig memory addresses including what would normally be called "the kernel".  Two 
 Gig is plenty for code, don't worry.
 
-You can create new, independent heaps using HeapCtrlInit().  Then, use the 
-CHeapCtrl as the 2nd arg to MAlloc().  See HeapLog() for an example.
+You can create new, independent heaps using HeapCtrlInit().  Then, use the 
+CHeapCtrl as the 2nd arg to MAlloc().  See HeapLog() for an example.
 
-Memory alloced by a task will be freed when the task is killed.  The Adam Task 
+Memory alloced by a task will be freed when the task is killed.  The Adam Task 
 is a task that never dies.  His memory is like kernel memory in other operating 
-systems.  See ACAlloc(), AMAlloc(), AMAllocIdent() and AStrNew().
+systems.  See ACAlloc(), AMAlloc(), AMAllocIdent() and AStrNew().
 
 All of the regular page tables are marked, "cached".  When accessing hardware, 
 however, you need uncached page table.  The lowest 4Gig addresses have an alias 
 to access hardware located toward the top of mapped space, 0x10000000000.  See 
-dev.uncached_alias.
+dev.uncached_alias.
 
 During an extended powered-on session of TempleOS, in theory, memory will become 
 fragmented, requiring a reboot.  It has never happens to me.
 
-See MemRep() and ::/Demo/MemDemo.HC.
+See MemRep() and ::/Demo/MemDemo.HC.
 
 
                            Single System-wide Mem Map
 
  0x0000007C00- 0x000003616F
-  Kernel module, placed here by the boot-loader, BOOT_RAM_BASE.
+  Kernel module, placed here by the boot-loader, BOOT_RAM_BASE.
 
  0x0000096600- 0x0000096FFF
-  Boot block relocated here before loading the Kernel module, BootDVD & BootHD.
+  Boot block relocated here before loading the Kernel module, BootDVD & BootHD.
 
- 0x0000097000- 0x0000097030 Multicore start-up vect code, MPN_VECT.
+ 0x0000097000- 0x0000097030 Multicore start-up vect code, MPN_VECT.
 ~0x000009F000- 0x000009FFFF Extended BIOS data area.
- 0x00000A0000- 0x00000BFFFF VGA graphics mem with alias at text.vga_alias.
- 0x0000100000- 0x0000101FFF CSysFixedArea for misc.
+ 0x00000A0000- 0x00000BFFFF VGA graphics mem with alias at text.vga_alias.
+ 0x0000100000- 0x0000101FFF CSysFixedArea for misc.
  0x000050A000- 0x001FFDFFFF Code Heap mem.
 
  0x00E0000000- 0x00FFFFFFFF
   32-bit devices could alloc memory at 0xF0000000 going up, but this is wrong, 
   since some PCs already have devices at 0xF0000000.  No PCI devices are 
-  supported, so Mem32DevAlloc() flaws are not an issue.
+  supported, so Mem32DevAlloc() flaws are not an issue.
 
  0x0080000000-~0x00DFFFFFFF
  0x0100000000-~0xFFFFFFFFFF
@@ -85,19 +85,19 @@
   Uncached alias of first 4Gig.  (For 32-bit device access.)
 
              - 0x100FFFFFFFF
-  64-bit devices are alloced with Mem64DevAlloc() counting bwd, but no PCI 
+  64-bit devices are alloced with Mem64DevAlloc() counting bwd, but no PCI 
   devices are actually supported.
 
 
 
 * Note: There is a break in the data-heap block pool.  This has no effect except 
-the obvious effect that fragmentation has on contiguous requests.  I can MAlloc(
-) an 8Gig chunk on my 12Gig machine.  I can MAlloc() an 32Gig chunk on my 64Gig 
+the obvious effect that fragmentation has on contiguous requests.  I can MAlloc(
+) an 8Gig chunk on my 12Gig machine.  I can MAlloc() an 32Gig chunk on my 64Gig 
 machine.  
 
 * Note: For systems with less than 2Gig RAM, the code and data heap block pools 
 are the same.  For systems with 2-4Gig of RAM, the code heap is 1/4 of the 
-total.  See BlkPoolsInit().
+total.  See BlkPoolsInit().
 
 
                                     History
@@ -123,20 +123,20 @@
 In 2016, I came-up with an alternate idea.  I double mapped the lowest memory 
 with an alias that was uncached.  Accessing the lowest 2Meg area directly was 
 cached but the alias I created up at the top of address space was uncached.  See 
-UncachedAliasAlloc().  Unfortunately, I could no longer boast of the simplicity 
+UncachedAliasAlloc().  Unfortunately, I could no longer boast of the simplicity 
 of identity mapping everything.  Since many of my users are familiar with 
 A0000-BFFFF, it is actually pretty seriously unfortunate that they cannot use 
 the easy-to-understand numbers of A0000-BFFFF, but must access the relocated 
-alias location.  See text.vga_alias.  I also no longer cause a fault when 
+alias location.  See text.vga_alias.  I also no longer cause a fault when 
 dereferencing NULL.
 
 Then, I switched to 1Gig page sizes.  For the lowest 4Gig, I set-up an alias up 
-at the top of address space.  See UncachedAliasAlloc().  Not all computers 
+at the top of address space.  See UncachedAliasAlloc().  Not all computers 
 support 1Gig page tables, however, so I also support 2Meg.
 
 My original plan was to allow changing the page tables as needed, so I had code 
 for taking control of 2Meg pages and marking them uncached or whatever.  When I 
 did a HDAudio driver, I requested some 32-bit address space as uncached.  Today, 
-all of the first 4Gig can be accessed without caching at the dev.uncached_alias.
+all of the first 4Gig can be accessed without caching at the dev.uncached_alias.
 
diff --git a/public/src/Home/Doc/Menus.DD.HTML b/public/Wb/Doc/Menus.DD.HTML similarity index 60% rename from public/src/Home/Doc/Menus.DD.HTML rename to public/Wb/Doc/Menus.DD.HTML index e369b0f..c279afe 100755 --- a/public/src/Home/Doc/Menus.DD.HTML +++ b/public/Wb/Doc/Menus.DD.HTML @@ -25,9 +25,9 @@ -
+
 A pull-down menu appears when you move the mouse to the top of the scrn.  Menus 
-are created with MenuPush(), MenuFilePush(), MenuNew() or MenuFile() and 
+are created with MenuPush(), MenuFilePush(), MenuNew() or MenuFile() and 
 assigned to Fs->cur_menu.  The format is:
 
 
@@ -52,12 +52,12 @@
 }
 
 The first arg is the msg code and it is optional with the default being 
-MSG_KEY_DOWN_UP.  The second arg is the msg arg1 value which is ASCII of the key 
-in the case of MSG_KEY_DOWN.  The third arg is the msg arg2 value which is the 
-scan_code of the key in the case of MSG_KEY_DOWN.
+MSG_KEY_DOWN_UP.  The second arg is the msg arg1 value which is ASCII of the key 
+in the case of MSG_KEY_DOWN.  The third arg is the msg arg2 value which is the 
+scan_code of the key in the case of MSG_KEY_DOWN.
 
 Press <CTRL-SHIFT-l> and "Insert ASCII/ScanCode".
 
-See ::/Demo/PullDownMenu.HC.
+See ::/Demo/PullDownMenu.HC.
 
diff --git a/public/src/Home/Doc/Mouse.DD.HTML b/public/Wb/Doc/Mouse.DD.HTML similarity index 73% rename from public/src/Home/Doc/Mouse.DD.HTML rename to public/Wb/Doc/Mouse.DD.HTML index 4e1caf9..fcb31f0 100755 --- a/public/src/Home/Doc/Mouse.DD.HTML +++ b/public/Wb/Doc/Mouse.DD.HTML @@ -25,15 +25,15 @@ -
-ms.pos.x and ms.pos.y can be used to access the x and y coordinates of the 
+
+ms.pos.x and ms.pos.y can be used to access the x and y coordinates of the 
 mouse.  They are relative to the scrn, not window.  These can be used if you 
-don't want to use msg passing.  ms.pos.z is the wheel.
+don't want to use msg passing.  ms.pos.z is the wheel.
 
-ms.pos_text.x and ms.pos_text.y are the text column and row.  See 
-::/Demo/Games/Maze.HC.
+ms.pos_text.x and ms.pos_text.y are the text column and row.  See 
+::/Demo/Games/Maze.HC.
 
-See CMsStateGlbls and CMsHardStateGlbls.
+See CMsStateGlbls and CMsHardStateGlbls.
 
 The hard designation, as in ms_hard, represents hardware layer items before the 
 application of an abstraction layer.
diff --git a/public/src/Home/Doc/Msgs.DD.HTML b/public/Wb/Doc/Msgs.DD.HTML
similarity index 84%
rename from public/src/Home/Doc/Msgs.DD.HTML
rename to public/Wb/Doc/Msgs.DD.HTML
index d9c2199..0c7e08b 100755
--- a/public/src/Home/Doc/Msgs.DD.HTML
+++ b/public/Wb/Doc/Msgs.DD.HTML
@@ -25,8 +25,8 @@
 
 
 
-
+
 There are a maximum of 63 message types, so a bitmask can be passed.  Messages 
-have two args.  See Message Codes.
+have two args.  See Message Codes.
 
diff --git a/public/src/Doc/MultiCore.DD.HTML b/public/Wb/Doc/MultiCore.DD.HTML old mode 100644 new mode 100755 similarity index 52% rename from public/src/Doc/MultiCore.DD.HTML rename to public/Wb/Doc/MultiCore.DD.HTML index 7e7a99a..385fa15 --- a/public/src/Doc/MultiCore.DD.HTML +++ b/public/Wb/Doc/MultiCore.DD.HTML @@ -25,28 +25,28 @@ -
+
 TempleOS does master-slave multicore instead of SMP.  Core0 is the master.  The 
 master core's applications explicitly assign computational jobs to other cores 
 and the TempleOS scheduler does not move tasks between cores.
 
 There are multicore safe locks for file access and heap allocations, however, so 
-TempleOS is symmetrical in some sense.  See ::/Demo/MultiCore/LoadTest.HC.
+TempleOS is symmetrical in some sense.  See ::/Demo/MultiCore/LoadTest.HC.
 
 Only tasks on Core0 can have windows, but other cores can help render them.
 
-Each core has an executive Seth Task which is the father of all tasks on that 
-core.  Adam is the Seth Task on Core0.
+Each core has an executive Seth Task which is the father of all tasks on that 
+core.  Adam is the Seth Task on Core0.
 
-You give a job to a Seth Task with JobQue() and get the result with JobResGet(). 
- You spawn a task on any core with Spawn().
+You give a job to a Seth Task with JobQue() and get the result with JobResGet(). 
+ You spawn a task on any core with Spawn().
 
 Note: You must use the LOCK asm prefix when changing shared structures in a 
-multicore environment.  The LBts(), LBtr() and LBtc() insts have LOCK prefixes.  
+multicore environment.  The LBts(), LBtr() and LBtc() insts have LOCK prefixes.  
 The compiler has a lock{} feature but it doesn't work well.  See 
-::/Demo/MultiCore/Lock.HC.
+::/Demo/MultiCore/Lock.HC.
 
-See ::/Demo/Graphics/Transform.HC.
-See ::/Kernel/MultiProc.HC.
+See ::/Demo/Graphics/Transform.HC.
+See ::/Kernel/MultiProc.HC.
 
diff --git a/public/src/Home/Doc/NewASCII.DD.HTML b/public/Wb/Doc/NewASCII.DD.HTML similarity index 96% rename from public/src/Home/Doc/NewASCII.DD.HTML rename to public/Wb/Doc/NewASCII.DD.HTML index 765666c..f817d82 100755 --- a/public/src/Home/Doc/NewASCII.DD.HTML +++ b/public/Wb/Doc/NewASCII.DD.HTML @@ -25,7 +25,7 @@ -
+
                                    New ASCII
 
 
diff --git a/public/src/Home/Doc/ODE.DD.HTML b/public/Wb/Doc/ODE.DD.HTML
similarity index 54%
rename from public/src/Home/Doc/ODE.DD.HTML
rename to public/Wb/Doc/ODE.DD.HTML
index 06f7db6..3bef5df 100755
--- a/public/src/Home/Doc/ODE.DD.HTML
+++ b/public/Wb/Doc/ODE.DD.HTML
@@ -25,15 +25,15 @@
 
 
 
-
+
 TempleOS has an advanced algorithm for integrating ordinary differential 
 equations suitable for use in video games.  (Not scientific work.)  It also has 
 some support for systems of masses and springs, to save you some work.
 
-See CMathODE and ODEsUpdate for an overview.
-See ODECallDerivative to see what support there is for masses and springs.
+See CMathODE and ODEsUpdate for an overview.
+See ODECallDerivative to see what support there is for masses and springs.
 
-See ::/Demo/Games/Whap.HC, ::/Demo/Games/Rocket.HC, ::/Demo/Games/MassSpring.HC, 
-::/Apps/Span/SpanMain.HC or ::/Apps/X-Caliber/X-Caliber.HC.
+See ::/Demo/Games/Whap.HC, ::/Demo/Games/Rocket.HC, ::/Demo/Games/MassSpring.HC, 
+::/Apps/Span/SpanMain.HC or ::/Apps/X-Caliber/X-Caliber.HC.
 
diff --git a/public/Wb/Doc/Once.DD.HTML b/public/Wb/Doc/Once.DD.HTML new file mode 100755 index 0000000..fb68008 --- /dev/null +++ b/public/Wb/Doc/Once.DD.HTML @@ -0,0 +1,46 @@ + + + + + + + + + + +
+KMain()
+  includes ::/StartOS.HC
+    includes ~/MakeHome.HC
+      includes ~/HomeSys.HC
+        calls StartUpTasks()
+          includes ~/Once.HC
+            calls OnceExe().
+
+AOnce() appends src code to ~/Registry.HC Once/Adam tree, executed at next boot 
+by Adam.
+
+Once()  appends src code to ~/Registry.HC Once/User tree, executed at next boot 
+by first User term.
+
+At boot, OnceExe(), executes Once/Adam tree, AOnceFlush()s it,
+executes Once/User tree and OnceFlush()s.
+
+ diff --git a/public/src/Home/Doc/Options.DD.HTML b/public/Wb/Doc/Options.DD.HTML similarity index 57% rename from public/src/Home/Doc/Options.DD.HTML rename to public/Wb/Doc/Options.DD.HTML index c7a42b9..581d475 100755 --- a/public/src/Home/Doc/Options.DD.HTML +++ b/public/Wb/Doc/Options.DD.HTML @@ -25,33 +25,33 @@ -
+
                                 Compiler Options
 
-Use Option().  You might need to do #exe {Option();}.
+Use Option().  You might need to do #exe {Option();}.
 
-OPTf_GLBLS_ON_DATA_HEAP without this option, global vars are placed in the code 
+OPTf_GLBLS_ON_DATA_HEAP without this option, global vars are placed in the code 
 heap which is limited to 2Gig.  In AOT modules, global vars take-up room in the 
 .BIN file, so you might want to use this option, instead.  You might wish to 
 turn it on and off around specific vars.  A disadvantage of data heap global 
 vars in AOT modules is they can't be initialized.
 
-OPTf_EXTERNS_TO_IMPORTS and OPTf_KEEP_PRIVATE are strange options, you'll never 
+OPTf_EXTERNS_TO_IMPORTS and OPTf_KEEP_PRIVATE are strange options, you'll never 
 need.  They're to allow the same header file for Kernel to act as externs when 
 compiling itself and imports when compiled by AOT modules.
 
-OPTf_WARN_UNUSED_VAR    warning if unused var.  It is applied to functions.
+OPTf_WARN_UNUSED_VAR    warning if unused var.  It is applied to functions.
 
-OPTf_WARN_PAREN         warning if parenthesis are not needed.
+OPTf_WARN_PAREN         warning if parenthesis are not needed.
 
-OPTf_WARN_DUP_TYPES     warning if dup local var type stmts.
+OPTf_WARN_DUP_TYPES     warning if dup local var type stmts.
 
-OPTf_WARN_HEADER_MISMATCH warning if fun header does not match.
+OPTf_WARN_HEADER_MISMATCH warning if fun header does not match.
 
-OPTf_NO_REG_VAR forces all function local vars to the stk not regs.  Applied to 
+OPTf_NO_REG_VAR forces all function local vars to the stk not regs.  Applied to 
 functions.
 
-OPTf_NO_BUILTIN_CONST Disable 10-byte float consts for pi, log2_10, log10_2, 
+OPTf_NO_BUILTIN_CONST Disable 10-byte float consts for pi, log2_10, log10_2, 
 loge_2.  Applied to functions.
 
diff --git a/public/src/Doc/Pags.DD.HTML b/public/Wb/Doc/Pags.DD.HTML old mode 100644 new mode 100755 similarity index 78% rename from public/src/Doc/Pags.DD.HTML rename to public/Wb/Doc/Pags.DD.HTML index 6fde2fd..4714e73 --- a/public/src/Doc/Pags.DD.HTML +++ b/public/Wb/Doc/Pags.DD.HTML @@ -25,10 +25,10 @@ -
-The word Pag refers to an arbitrilly created MEM_PAG_SIZE unit of heap 
+
+The word Pag refers to an arbitrilly created MEM_PAG_SIZE unit of heap 
 allocation.  TempleOS does not alter the CPU page tables after setting them up 
-at boot in SYS_INIT_PAGE_TABLES, so the CPU hardware page size is rarely 
+at boot in SYS_INIT_PAGE_TABLES, so the CPU hardware page size is rarely 
 important.
 
diff --git a/public/src/Home/Doc/PreProcessor.DD.HTML b/public/Wb/Doc/PreProcessor.DD.HTML similarity index 85% rename from public/src/Home/Doc/PreProcessor.DD.HTML rename to public/Wb/Doc/PreProcessor.DD.HTML index e480e5e..49eb541 100755 --- a/public/src/Home/Doc/PreProcessor.DD.HTML +++ b/public/Wb/Doc/PreProcessor.DD.HTML @@ -25,10 +25,10 @@ -
+
                                   PreProcessor
 
-There is no separate preprocessor pass.  The parser front-end calls Lex() which 
+There is no separate preprocessor pass.  The parser front-end calls Lex() which 
 has the preprocessor built-in.  The compiler looks ahead a token, most of the 
 time, so you might throw an extra semicolon after a directive if it's not taking 
 affect right away.
@@ -37,7 +37,7 @@
 
 #include ""     There is no angle bracket <> form of this directive.
 #exe {}         Will execute code at compile-time and can be used to insert code 
-into the stream being compiled using StreamPrint().
+into the stream being compiled using StreamPrint().
 #define         Define string const
 #assert         Print a warning during compilation if an expression is not true. 
 #if             Include code if an expresion is true.
@@ -46,8 +46,8 @@
 #ifdef,#ifndef  Include code if a sym is defined.
 #ifaot,#ifjit   Include code if in AOT compiler mode.
 defined()       Is a function that can be used in expressions.
-#help_index, #help_file See Help System.
+#help_index, #help_file See Help System.
 
-See PreProcessor.
+See PreProcessor.
 
diff --git a/public/src/Doc/Print.DD.HTML b/public/Wb/Doc/Print.DD.HTML old mode 100644 new mode 100755 similarity index 54% rename from public/src/Doc/Print.DD.HTML rename to public/Wb/Doc/Print.DD.HTML index d83a24d..207e3c2 --- a/public/src/Doc/Print.DD.HTML +++ b/public/Wb/Doc/Print.DD.HTML @@ -25,12 +25,12 @@ -
+
                                  Print Fmt Strs
 
 <fmt_arg> := %[-][0][<width>][.<decimals>][<flags>][h<aux_fmt_num>]<fmt_code>
 
-See StrPrintJoin().
+See StrPrintJoin().
 
 <flags>:
 
@@ -44,7 +44,7 @@
   For "%n", "%d" or "%u", the <aux_fmt_num> causes thousands mode.  "%h?n" will 
   pick a var exponent multiples of three unit, while "%h-3n" will display milli 
   units or "%h6n" will display mega units.  The 'k' flag is always on for "%n".  
-  See ::/Demo/Print.HC.
+  See ::/Demo/Print.HC.
   
 For "%c" or "%C", the <aux_fmt_num> repeats the char that many times.
 
@@ -53,9 +53,9 @@
   "%n" floating point in engineering notation, exponents being multiples of 
   three.  If it has a <aux_fmt> code, it will display scientific units letters.
   
-  "%S" Define() entry.
+  "%S" Define() entry.
   
-  "%C" ToUpper() character.
+  "%C" ToUpper() character.
   
   "%h25c",'\n'; 25 new-lines.
   
@@ -63,7 +63,7 @@
   
   "%F" text file by filename.
   
-  "%$F" DolDoc file in memory.
+  "%$F" DolDoc file in memory.
   
   "%p" ptr. 
   
@@ -73,14 +73,14 @@
   
   "%,P" link to ptr with no offset.
   
-  "%D" date.  Pass a CDate.
+  "%D" date.  Pass a CDate.
   
-  "%T" time.  Pass a CDate.
+  "%T" time.  Pass a CDate.
   
-  "%z" sub_entry of an enumerated list of text entries.  See LstSub().  Pass 
+  "%z" sub_entry of an enumerated list of text entries.  See LstSub().  Pass 
   sub_entry_num first, list second.
   
-  "%Z" DefineLstLoad() subentry.  Pass sub_entry_num first, define_name second.
+  "%Z" DefineLstLoad() subentry.  Pass sub_entry_num first, define_name second.
   
   "%Q" convert "\" to "\\" and quote to backslash quote. (For use in creating 
   strs in strs.)
@@ -90,53 +90,53 @@
 
                                   Print Family
 
-MStrPrint(U8 *fmt,...) is like StrPrint(U8 *dst,U8 *fmt,...) but it returns a 
-MAllocated str.  It is vary handy because you don't have to worry about 
+MStrPrint(U8 *fmt,...) is like StrPrint(U8 *dst,U8 *fmt,...) but it returns a 
+MAllocated str.  It is vary handy because you don't have to worry about 
 overflow.
 
-CatPrint(U8 *_dst,U8 *fmt,...) concatenates a formated string.
+CatPrint(U8 *_dst,U8 *fmt,...) concatenates a formated string.
 
-In(U8 *fmt,...) sends text to the current task's input buffer.
-InStr(U8 *fmt,...) sends text of an InFile to the keyboard stream of the current 
+In(U8 *fmt,...) sends text to the current task's input buffer.
+InStr(U8 *fmt,...) sends text of an InFile to the keyboard stream of the current 
 TASK but can also do mouse cmds.
 
-XTalk(CTask *task,U8 *fmt,...) and text to another task's input buffer.
-XTalkStr(CTask *task,U8 *fmt,...) sends text of an InFile to the keyboard stream 
+XTalk(CTask *task,U8 *fmt,...) and text to another task's input buffer.
+XTalkStr(CTask *task,U8 *fmt,...) sends text of an InFile to the keyboard stream 
 of another TASK but can also do mouse cmds.
 
-DocPrint(CDoc *doc,U8 *fmt,...) sends text to a document.  You can buffer to a 
+DocPrint(CDoc *doc,U8 *fmt,...) sends text to a document.  You can buffer to a 
 Doc and save it, providing the functionality of fprintf.  See 
-::/Demo/Dsk/FPrintF.HC.
+::/Demo/Dsk/FPrintF.HC.
 
-Adam(U8 *fmt,...) sends text to the Adam Task to be compiled and run.
-AdamLog(U8 *fmt,...) and AdamErr(U8 *fmt,...) send text to the Adam Task to be 
+Adam(U8 *fmt,...) sends text to the Adam Task to be compiled and run.
+AdamLog(U8 *fmt,...) and AdamErr(U8 *fmt,...) send text to the Adam Task to be 
 displayed.
 
-StreamPrint(U8 *fmt,...) sends text to the stream of code being compiled and 
+StreamPrint(U8 *fmt,...) sends text to the stream of code being compiled and 
 must reside in a #exe{} blk.
 
-GrPrint(CDC *dc,I64 x,I64 y,U8 *fmt,...) and GrVPrint() plots text in graphics 
+GrPrint(CDC *dc,I64 x,I64 y,U8 *fmt,...) and GrVPrint() plots text in graphics 
 mode.
 
-TextPrint(CTask *task,I64 x,I64 y,I64 attr,U8 *fmt,...) plots to gr.text_base.
+TextPrint(CTask *task,I64 x,I64 y,I64 attr,U8 *fmt,...) plots to gr.text_base.
 
-ExePrint(U8 *fmt,...) compiles and execute a string.  Note: It returns the res 
+ExePrint(U8 *fmt,...) compiles and execute a string.  Note: It returns the res 
 of the last executed expression.
 
-Once(U8 *fmt,...) Writes User code to Registry to be executed next boot.
+Once(U8 *fmt,...) Writes User code to Registry to be executed next boot.
 
-AOnce(U8 *fmt,...) Writes Adam code to Registry to be executed next boot.
+AOnce(U8 *fmt,...) Writes Adam code to Registry to be executed next boot.
 
-InPrint(I64 mS,U8 *fmt,...) PutChars()s one at a time with a delay.
+InPrint(I64 mS,U8 *fmt,...) PutChars()s one at a time with a delay.
 
-RawPrint(I64 mS,U8 *fmt,...) sends direct to scrn memory, bypassing window 
+RawPrint(I64 mS,U8 *fmt,...) sends direct to scrn memory, bypassing window 
 manager.
 
-User(U8 *fmt,...) Spawns a user and execute a string on start-up.
+User(U8 *fmt,...) Spawns a user and execute a string on start-up.
 
-PopUpPrint(U8 *fmt,...) compiles and execute a string in a pop-up win.  Note: It 
+PopUpPrint(U8 *fmt,...) compiles and execute a string in a pop-up win.  Note: It 
 returns the res of the last executed expression.
-PopUpViewPrint(U8 *fmt,...) creates a pop-up window and views text.
+PopUpViewPrint(U8 *fmt,...) creates a pop-up window and views text.
 
 Note: Use Print("%s",src) if you need an unmodified string.
 
diff --git a/public/src/Doc/Profiler.DD.HTML b/public/Wb/Doc/Profiler.DD.HTML old mode 100644 new mode 100755 similarity index 72% rename from public/src/Doc/Profiler.DD.HTML rename to public/Wb/Doc/Profiler.DD.HTML index 649b9db..b188d11 --- a/public/src/Doc/Profiler.DD.HTML +++ b/public/Wb/Doc/Profiler.DD.HTML @@ -25,15 +25,15 @@ -
+
 The profiler records where the CPU was executing when the 1000Hz timer interrupt 
 occured, so you can learn where time is spent.
 
-Use the Prof() depth argument to record a hit in the N routines which called the 
+Use the Prof() depth argument to record a hit in the N routines which called the 
 current routine, as well.
 
-When done collecting statistics, use ProfRep() for a report.  You might need a 
-DocMax() to expand the command line window buffer to fit it all.
+When done collecting statistics, use ProfRep() for a report.  You might need a 
+DocMax() to expand the command line window buffer to fit it all.
 
 Study the code.  The profiler is very simple.  You might want to enhance it or 
 modify it to debug something in particular.
diff --git a/public/src/Doc/Que.DD.HTML b/public/Wb/Doc/Que.DD.HTML
old mode 100644
new mode 100755
similarity index 84%
rename from public/src/Doc/Que.DD.HTML
rename to public/Wb/Doc/Que.DD.HTML
index bcb44eb..f1d37ac
--- a/public/src/Doc/Que.DD.HTML
+++ b/public/Wb/Doc/Que.DD.HTML
@@ -25,8 +25,8 @@
 
 
 
-
-A Queue is a bunch of MAlloc()ed chunks of mem linked together in a circle with 
+
+A Queue is a bunch of MAlloc()ed chunks of mem linked together in a circle with 
 one ptr to the next value and another ptr to the last value.  These ptrs must be 
 stored in the first locations in the structure.
 
diff --git a/public/src/Home/Doc/Quirks.DD.HTML b/public/Wb/Doc/Quirks.DD.HTML similarity index 70% rename from public/src/Home/Doc/Quirks.DD.HTML rename to public/Wb/Doc/Quirks.DD.HTML index ffd4f68..350a8d6 100755 --- a/public/src/Home/Doc/Quirks.DD.HTML +++ b/public/Wb/Doc/Quirks.DD.HTML @@ -25,7 +25,7 @@ -
+
                                      Quirks
 
 * You run a risk of problems if you do file operations on the same files 
@@ -35,31 +35,31 @@
 * When using FAT32, TempleOS does not generate unique short-entry names, the 
 ones with the ~s.  Not all FAT32 filenames are valid TempleOS names and it will 
 complain.  Do not access FAT32 drives not dedicated to TempleOS.  Disable them 
-with DrvEnable(OFF), or they will generate error messages.  FAT32 involves a 
+with DrvEnable(OFF), or they will generate error messages.  FAT32 involves a 
 long and short name for each file.
 
 * The stk does not grow because virtual mem is not used.  I recommend allocating 
-large local vars from the heap.  You can change MEM_DFT_STK and recompile Kernel 
-or request more when doing a Spawn().
+large local vars from the heap.  You can change MEM_DFT_STK and recompile Kernel 
+or request more when doing a Spawn().
 
 * The syntax highlighting occassionally glitches.  The compiler doesn't.
 
-* Call DskChg() when you insert a new removable media.
+* Call DskChg() when you insert a new removable media.
 
-* Accessing CD/DVD's is flacky.  Try Drv() or DskChg() twice.
+* Accessing CD/DVD's is flacky.  Try Drv() or DskChg() twice.
 
 * You can only extern something once.  There is a varient called _extern which 
 binds a HolyC definition to a asm sym.  This, too, can only be done once.
 
-* A terminal task has a CDoc document structure that remains active even when 
-you change Fs->draw_it.  To prevent links in the CDoc from being activated when 
+* A terminal task has a CDoc document structure that remains active even when 
+you change Fs->draw_it.  To prevent links in the CDoc from being activated when 
 the user clicks in the window, do one of three things:
   
-  A) DocBottom() followed by DocClear() to clear the CDoc so it has no active 
+  A) DocBottom() followed by DocClear() to clear the CDoc so it has no active 
   widgets.
   
   B) Disable window mgr bttn click checking with Fs->win_inhibit set to mask 
-  WIF_SELF_MS_L|WIF_FOCUS_TASK_MS_L_D|WIF_SELF_MS_R|WIF_FOCUS_TASK_MS_R_D.  This 
+  WIF_SELF_MS_L|WIF_FOCUS_TASK_MS_L_D|WIF_SELF_MS_R|WIF_FOCUS_TASK_MS_R_D.  This 
   inhibits window mgr operations but still generates messages from bttn clicks.
 
 * switch/case stmts alloc a single jump table--do not use with wide, sparse 
@@ -70,9 +70,9 @@
 * A goto label name must not match a global scope object's name.  (It's not 
 worth slowing-down the compiler to handle this case.)
 
-* MemCpy() only goes fwd.
+* MemCpy() only goes fwd.
 
-* A Cd() cmd must be followed by two semicolons if a #include is after it.  This 
+* A Cd() cmd must be followed by two semicolons if a #include is after it.  This 
 is because the preprocessor processes the next token ahead.
 
 * The assembler's error msgs are often off by a line and undefines are cryptic.
diff --git a/public/src/Doc/RedSea.DD.HTML b/public/Wb/Doc/RedSea.DD.HTML
old mode 100644
new mode 100755
similarity index 77%
rename from public/src/Doc/RedSea.DD.HTML
rename to public/Wb/Doc/RedSea.DD.HTML
index 90060ce..bbebbbf
--- a/public/src/Doc/RedSea.DD.HTML
+++ b/public/Wb/Doc/RedSea.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                                RedSea File System
 
 The RedSea file system is a simple, 64-bit, file system which is similar to 
@@ -44,11 +44,11 @@
 
 public class CDirEntry //64-byte fixed-size
 {
-  U16 attr;     //See RS_ATTR_DIR.  I would like to change these.
-  U8 name[CDIR_FILENAME_LEN]; //See char_bmp_filename, FileNameChk
+  U16 attr;     //See RS_ATTR_DIR.  I would like to change these.
+  U8 name[CDIR_FILENAME_LEN]; //See char_bmp_filename, FileNameChk
   I64 clus; (blk) //One sector per clus.
   I64 size;     //In bytes
-  CDate datetime; //See  DateTime, Implementation of DateTime
+  CDate datetime; //See  DateTime, Implementation of DateTime
 };
 
 public class CRedSeaBoot //RedSea is type FAT32 in partition table to fool BIOS.
@@ -64,9 +64,9 @@
   U16 signature2;       //0xAA55
 };
 
-See ::/Kernel/BlkDev/FileSysRedSea.HC and ::/Adam/Opt/Boot/DskISORedSea.HC.
+See ::/Kernel/BlkDev/FileSysRedSea.HC and ::/Adam/Opt/Boot/DskISORedSea.HC.
 
-Files with names ending in .Z are compressed.  See ::/Kernel/Compress.HC.
+Files with names ending in .Z are compressed.  See ::/Kernel/Compress.HC.
 
 To replace ISO9660, make hard-drive partition image of a measured size and copy 
 onto a CD/DVD starting at about sector 20, with EL TORITO booting.  512-byte 
@@ -75,8 +75,8 @@
 
 RedSea file system has no bad block table and no redundant allocation table.
 
-See Block Chain for RedSea allocation bitmap discussion.
+See Block Chain for RedSea allocation bitmap discussion.
 
-See Reliability for RedSea reliability discussion.
+See Reliability for RedSea reliability discussion.
 
diff --git a/public/src/Doc/Reliability.DD.HTML b/public/Wb/Doc/Reliability.DD.HTML old mode 100644 new mode 100755 similarity index 94% rename from public/src/Doc/Reliability.DD.HTML rename to public/Wb/Doc/Reliability.DD.HTML index d1ba7e4..474c946 --- a/public/src/Doc/Reliability.DD.HTML +++ b/public/Wb/Doc/Reliability.DD.HTML @@ -25,7 +25,7 @@ -
+
                                RedSea Reliability
 
 TempleOS is like the 1040EZ tax form compared to the full 1040 form.  Obviously, 
@@ -43,7 +43,7 @@
 Obviously, we don't do bad block tables, or redundant FATs.
 
 We use the simplest possible technique, a contiguous-file-only allocation 
-bitmap, not Block Chains or FAT tables.
+bitmap, not Block Chains or FAT tables.
 
 You can be a good toy or you can be a good professional tool, but not both.  
 TempleOS's file manager will start too slowly once a few thousand files exist 
diff --git a/public/src/Home/Doc/Requirements.DD.HTML b/public/Wb/Doc/Requirements.DD.HTML
similarity index 97%
rename from public/src/Home/Doc/Requirements.DD.HTML
rename to public/Wb/Doc/Requirements.DD.HTML
index 6889589..0844f62 100755
--- a/public/src/Home/Doc/Requirements.DD.HTML
+++ b/public/Wb/Doc/Requirements.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                            Requirements for TempleOS
 
 User Skills Required
diff --git a/public/src/Doc/Resource.DD.HTML b/public/Wb/Doc/Resource.DD.HTML
old mode 100644
new mode 100755
similarity index 75%
rename from public/src/Doc/Resource.DD.HTML
rename to public/Wb/Doc/Resource.DD.HTML
index 1ba3dda..c2c19e5
--- a/public/src/Doc/Resource.DD.HTML
+++ b/public/Wb/Doc/Resource.DD.HTML
@@ -25,15 +25,15 @@
 
 
 
-
+
                           Graphic Sprite Resource Help
 
 A sprite is an ordered list of elements such as lines, rectangles, bitmaps and 
 color changes.  In a program's source code, you first make a sprite somewhere 
 outside a function.  Then, you insert a pointer to the sprite as an "*elems" arg 
-when calling Sprite() or Sprite3().  See Sprites.
+when calling Sprite() or Sprite3().  See Sprites.
 
-You can create a sprite macro on your PersonalMenu with a payload of HolyC 
+You can create a sprite macro on your PersonalMenu with a payload of HolyC 
 source code to execute when it ESC's back to the cmd line.  If you check 
 "Pop-Up", it will spawn a new task and run the payload.  A pop-up macro can be 
 placed in any document.
diff --git a/public/src/Home/Doc/ScopingLinkage.DD.HTML b/public/Wb/Doc/ScopingLinkage.DD.HTML
similarity index 84%
rename from public/src/Home/Doc/ScopingLinkage.DD.HTML
rename to public/Wb/Doc/ScopingLinkage.DD.HTML
index 0904578..053709e 100755
--- a/public/src/Home/Doc/ScopingLinkage.DD.HTML
+++ b/public/Wb/Doc/ScopingLinkage.DD.HTML
@@ -25,10 +25,10 @@
 
 
 
-
+
                               Scoping and Linkage
 
-JIT Compile Mode makes use of the current task's hash sym table and its parent 
+JIT Compile Mode makes use of the current task's hash sym table and its parent 
 tasks' tables.  It fetches syms from parent tasks' tables if not found locally 
 in the current task's table and it places new syms in the current task's table.  
 Conceptually, syms are at the scope of environment vars in other operating 
@@ -39,25 +39,25 @@
 especially in asm blks.  Dupicates are allowed, by design in other cases, so 
 that you can repeatedly #include the same file from the cmd line while 
 developing it.  Or, so you can repeatedly declare a function with a standard 
-name, like DrawIt().  This case might occur when the Adam Task is starting-up 
+name, like DrawIt().  This case might occur when the Adam Task is starting-up 
 loading-in many little utilities.
 
-extern binds a new HTT_FUN or HTT_GLBL_VAR sym to an existing sym of the same 
+extern binds a new HTT_FUN or HTT_GLBL_VAR sym to an existing sym of the same 
 name if it exists in the sym table (just in just-in-time code).  It also can be 
 used to generate a fwd reference.
 
-import binds a new HTT_FUN or HTT_GLBL_VAR sym to a sym of the same name 
-imported from the task's sym table at Load() time.  If no sym exists to bind to 
-at Load() time, the code using this sym will be left incomplete until the sym is 
+import binds a new HTT_FUN or HTT_GLBL_VAR sym to a sym of the same name 
+imported from the task's sym table at Load() time.  If no sym exists to bind to 
+at Load() time, the code using this sym will be left incomplete until the sym is 
 defined.
 
 
-_extern binds a new HTT_FUN or HTT_GLBL_VAR sym to an existing sym, of a differe
+_extern binds a new HTT_FUN or HTT_GLBL_VAR sym to an existing sym, of a differe
 nt name.  It must exists in the sym table.  Basically, this binds C to asm.
 
-_import binds a new HTT_FUN or HTT_GLBL_VAR sym to a sym, of a different name 
-imported from the task's sym table at Load() time.  If no sym exists to bind to 
-at Load() time, the code using this sym will be left incomplete until the sym is 
+_import binds a new HTT_FUN or HTT_GLBL_VAR sym to a sym, of a different name 
+imported from the task's sym table at Load() time.  If no sym exists to bind to 
+at Load() time, the code using this sym will be left incomplete until the sym is 
 defined.  Basically, this binds C to asm from elsewhere.
 
 
@@ -162,16 +162,16 @@
 
 * The sizeof() and HolyC structure members can be used in asm blks.
 
-* Using &i in HolyC or i.u8[2] on a local var, i, will force it to noreg.
+* Using &i in HolyC or i.u8[2] on a local var, i, will force it to noreg.
 
 * Using try/catch in a function will force all local vars to noreg.
 
 * An unused gap on the stk is left for reg vars.
 
 * Note: static function vars do not go on the data heap, no matter the setting 
-of the OPTf_GLBLS_ON_DATA_HEAP.  They may in the future.
+of the OPTf_GLBLS_ON_DATA_HEAP.  They may in the future.
 
-* OPTf_EXTERNS_TO_IMPORTS will treat _extern as _import and extern as import.  
+* OPTf_EXTERNS_TO_IMPORTS will treat _extern as _import and extern as import.  
 This allows a header to be used either as a JIT compiled or AOT compiled header.
 
diff --git a/public/src/Doc/Snd.DD.HTML b/public/Wb/Doc/Snd.DD.HTML old mode 100644 new mode 100755 similarity index 82% rename from public/src/Doc/Snd.DD.HTML rename to public/Wb/Doc/Snd.DD.HTML index 60e28d8..aa0e6f0 --- a/public/src/Doc/Snd.DD.HTML +++ b/public/Wb/Doc/Snd.DD.HTML @@ -25,9 +25,9 @@ -
+
 Sound is generated with I8 vals called ona's, which are 88 piano key nums, with 
-0 as a rest.  See Note2Ona() and Ona2Freq().  God does not want death screams, 
+0 as a rest.  See Note2Ona() and Ona2Freq().  God does not want death screams, 
 perhaps, because God has PTSD or soldiers have PTSD.  (Imagine wounded on 
 battlefields.)  Ona's will allow elegant wave files for export and will allow 
 the creation of simple hardware over the next centuries.
diff --git a/public/src/Home/Doc/Sprite.DD.HTML b/public/Wb/Doc/Sprite.DD.HTML
similarity index 57%
rename from public/src/Home/Doc/Sprite.DD.HTML
rename to public/Wb/Doc/Sprite.DD.HTML
index eb0d77c..3c914b6 100755
--- a/public/src/Home/Doc/Sprite.DD.HTML
+++ b/public/Wb/Doc/Sprite.DD.HTML
@@ -25,18 +25,18 @@
 
 
 
-
-A CSprite is an ordered list of these elements, created with <CTRL-r>.  
+
+A CSprite is an ordered list of these elements, created with <CTRL-r>.  
 Normally, they are packed together in a list and the address of the first is 
 passed to routines.
 
-See ::/Demo/Graphics/SpritePlot.HC, ::/Demo/Graphics/SpritePlot3D.HC, 
-::/Demo/Graphics/SpritePut.HC, ::/Demo/Graphics/SpriteRaw.HC and SpriteMeshEd().
+See ::/Demo/Graphics/SpritePlot.HC, ::/Demo/Graphics/SpritePlot3D.HC, 
+::/Demo/Graphics/SpritePut.HC, ::/Demo/Graphics/SpriteRaw.HC and SpriteMeshEd().
 
 Be aware that copying SP, IB, or IS entries with the clip results in duplicate 
 entries with different nums.  You can manually remove dups by editing with <CTRL
 -t> and setting to the original num.
 
-See ::/Adam/Gr/GrSpritePlot.HC for how CSprite are stored.
+See ::/Adam/Gr/GrSpritePlot.HC for how CSprite are stored.
 
diff --git a/public/src/Home/Doc/SpriteBitMap.DD.HTML b/public/Wb/Doc/SpriteBitMap.DD.HTML similarity index 96% rename from public/src/Home/Doc/SpriteBitMap.DD.HTML rename to public/Wb/Doc/SpriteBitMap.DD.HTML index 0c39dff..1c9cfe9 100755 --- a/public/src/Home/Doc/SpriteBitMap.DD.HTML +++ b/public/Wb/Doc/SpriteBitMap.DD.HTML @@ -25,7 +25,7 @@ -
+
                             Sprite BitMap Menu Help
 
 BitMaps have a background color.  If you delete to the clip, what's left will be 
diff --git a/public/src/Doc/SpriteEd.DD.HTML b/public/Wb/Doc/SpriteEd.DD.HTML
old mode 100644
new mode 100755
similarity index 91%
rename from public/src/Doc/SpriteEd.DD.HTML
rename to public/Wb/Doc/SpriteEd.DD.HTML
index 674190a..ce88b30
--- a/public/src/Doc/SpriteEd.DD.HTML
+++ b/public/Wb/Doc/SpriteEd.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                              Sprite Edit Menu Help
 
 Order of elements matters.  They are executed in the order they appear in the 
@@ -37,6 +37,6 @@
 
 Insert Shift Suborigin is an element which shifts subsequent elements.  Perhaps, 
 you inserted a sprite's elements from the clip and want to shift it around?  
-This command is also useful if you call SpriteInterpolate() in programs.
+This command is also useful if you call SpriteInterpolate() in programs.
 
diff --git a/public/src/Doc/SpriteEdText.DD.HTML b/public/Wb/Doc/SpriteEdText.DD.HTML old mode 100644 new mode 100755 similarity index 85% rename from public/src/Doc/SpriteEdText.DD.HTML rename to public/Wb/Doc/SpriteEdText.DD.HTML index be7be7b..702299a --- a/public/src/Doc/SpriteEdText.DD.HTML +++ b/public/Wb/Doc/SpriteEdText.DD.HTML @@ -25,9 +25,9 @@ -
+
                             Sprite Edit as Text Help
 
-See the format for CSprites.
+See the format for CSprites.
 
diff --git a/public/src/Home/Doc/SpriteMain.DD.HTML b/public/Wb/Doc/SpriteMain.DD.HTML similarity index 97% rename from public/src/Home/Doc/SpriteMain.DD.HTML rename to public/Wb/Doc/SpriteMain.DD.HTML index 1eb63e1..97d928a 100755 --- a/public/src/Home/Doc/SpriteMain.DD.HTML +++ b/public/Wb/Doc/SpriteMain.DD.HTML @@ -25,7 +25,7 @@ -
+
                              Sprite Main Menu Help
 
 Order of elements matters.  They are executed in the order they appear in the 
diff --git a/public/src/Home/Doc/SpriteSideBar.DD.HTML b/public/Wb/Doc/SpriteSideBar.DD.HTML
similarity index 96%
rename from public/src/Home/Doc/SpriteSideBar.DD.HTML
rename to public/Wb/Doc/SpriteSideBar.DD.HTML
index 3f12be9..fefacdc 100755
--- a/public/src/Home/Doc/SpriteSideBar.DD.HTML
+++ b/public/Wb/Doc/SpriteSideBar.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                               Sprite SideBar Help
 
 You can cut and paste elements in this side-bar to reorder, delete or 
diff --git a/public/src/Doc/StandBy.DD.HTML b/public/Wb/Doc/StandBy.DD.HTML
old mode 100644
new mode 100755
similarity index 89%
rename from public/src/Doc/StandBy.DD.HTML
rename to public/Wb/Doc/StandBy.DD.HTML
index 9fc6b37..ad3d3a8
--- a/public/src/Doc/StandBy.DD.HTML
+++ b/public/Wb/Doc/StandBy.DD.HTML
@@ -25,10 +25,10 @@
 
 
 
-
+
                            AutoComplete is in StandBy
 
-                            System Keys Quick Guide
+                            System Keys Quick Guide
                                (Works Everywhere)
   <SPACE>   Left-Click  
   <ENTER>   Right-Click  
@@ -38,7 +38,7 @@
 <SHIFT-ESC> Abort & Exit
  <WINDOWS>  Pull-Down Menu
 
-                                    Tongues
+                                    Tongues
                                (Works Everywhere)
    <F7>     God Word
 <SHIFT-F7>  God Passage
diff --git a/public/src/Home/Doc/Start.DD.HTML b/public/Wb/Doc/Start.DD.HTML
similarity index 80%
rename from public/src/Home/Doc/Start.DD.HTML
rename to public/Wb/Doc/Start.DD.HTML
index 546c5a4..d4a6557 100755
--- a/public/src/Home/Doc/Start.DD.HTML
+++ b/public/Wb/Doc/Start.DD.HTML
@@ -25,11 +25,11 @@
 
 
 
-
+
                                  TempleOS V5.03
 
                          Public Domain Operating System
 
-Help & Index, Quick Start: Cmd line
+Help & Index, Quick Start: Cmd line
 
diff --git a/public/src/Doc/StdOutTask.DD.HTML b/public/Wb/Doc/StdOutTask.DD.HTML old mode 100644 new mode 100755 similarity index 77% rename from public/src/Doc/StdOutTask.DD.HTML rename to public/Wb/Doc/StdOutTask.DD.HTML index f5d070d..7fd357d --- a/public/src/Doc/StdOutTask.DD.HTML +++ b/public/Wb/Doc/StdOutTask.DD.HTML @@ -25,10 +25,10 @@ -
-There is one CDoc for the task's border: Fs->border_doc.  There is a pair for 
+
+There is one CDoc for the task's border: Fs->border_doc.  There is a pair for 
 the task's client area: Fs->put_doc and Fs->display_doc.  You can, optionally, 
 do double buffering, otherwise Fs->put_doc is the same as Fs->display_doc.  See 
-::/Demo/Spy.HC.
+::/Demo/Spy.HC.
 
diff --git a/public/src/Home/Doc/StdTempleOSPC.DD.HTML b/public/Wb/Doc/StdTempleOSPC.DD.HTML similarity index 98% rename from public/src/Home/Doc/StdTempleOSPC.DD.HTML rename to public/Wb/Doc/StdTempleOSPC.DD.HTML index 8662b53..e1d76bc 100755 --- a/public/src/Home/Doc/StdTempleOSPC.DD.HTML +++ b/public/Wb/Doc/StdTempleOSPC.DD.HTML @@ -25,12 +25,12 @@ -
+
                             The Standard TempleOS PC
 
 All desktop PCs will have 8-channel OCTART super-simple high speed serial ports 
 to replace USB.  They are simpler because the driver is as simple as old school 
-RS232 Serial, they have no USB end-points and they have no USB human interface 
+RS232 Serial, they have no USB end-points and they have no USB human interface 
 device reports.  Computer mice will all have exactly two bttns and one wheel.  
 Game controllers will all be the standard deluxe game console controllers that 
 are popular today.  It will have 8 big TX and 8 big RX fifos that allow flow 
diff --git a/public/src/Home/Doc/Strategy.DD.HTML b/public/Wb/Doc/Strategy.DD.HTML
similarity index 86%
rename from public/src/Home/Doc/Strategy.DD.HTML
rename to public/Wb/Doc/Strategy.DD.HTML
index f81b2a1..b184253 100755
--- a/public/src/Home/Doc/Strategy.DD.HTML
+++ b/public/Wb/Doc/Strategy.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                         Decisions Making TempleOS Simple
 
 Everybody is obsessed, Jedi mind-tricked, by the notion that when you scale-up, 
@@ -58,7 +58,7 @@
 Linux and Windows are general purpose operating systems.  They attempt to do any 
 task you want.  TempleOS cherry-picks tasks and is designed to do the same 
 things a C64 did.  This saves and order of magnitude complexity.  For example, 
-the RedSea file system allocates just contiguous files -- you load and save 
+the RedSea file system allocates just contiguous files -- you load and save 
 whole files at once.  A benefit is this allows compression.  Also, TempleOS does 
 not do networking or multimedia.  In theory, memory will fragment with lots of 
 big files.  The system would fall to pieces with multimedia, but God said 
@@ -103,7 +103,7 @@
 
 * Whole files are processed almost exclusively, allowing compression.
 
-* One language and compiler for command-line, scripts, songs, automations and 
+* One language and compiler for command-line, scripts, songs, automations and 
 code.
 
 * One editor/word processor/browser for the command-line window, source code, 
@@ -114,10 +114,10 @@
 
 * No distinction between thread, process or task.
 
-* The Scheduler is for home systems.  It is not preemptiove.  Disk requests are 
+* The Scheduler is for home systems.  It is not preemptiove.  Disk requests are 
 not broken-up, so sharing is bad.  It's wonderfully simple.
 
-* MultiCore is done master/slave, instead of SMP.  Core0 applications explicitly 
+* MultiCore is done master/slave, instead of SMP.  Core0 applications explicitly 
 assigns jobs.  Locks are present allowing multicore file, heap, and hardware 
 access, though.
 
@@ -130,8 +130,8 @@
 you'll need waiting in it's table.  No need to #include headers.
 
 * No need for namespaces -- scoping occurs automatically based on task symbol 
-table hierarchy with the Adam Task's symbol system-wide global.
+table hierarchy with the Adam Task's symbol system-wide global.
 
-* Sometimes, I cut corners in the interest of keeping the code beautiful.
+* Sometimes, I cut corners in the interest of keeping the code beautiful.
 
diff --git a/public/src/Doc/Streams.DD.HTML b/public/Wb/Doc/Streams.DD.HTML old mode 100644 new mode 100755 similarity index 66% rename from public/src/Doc/Streams.DD.HTML rename to public/Wb/Doc/Streams.DD.HTML index 3a4aecf..fbcfea4 --- a/public/src/Doc/Streams.DD.HTML +++ b/public/Wb/Doc/Streams.DD.HTML @@ -25,23 +25,23 @@ -
+
 There are no streams in the traditional sense.  The cmd line output gets sent to 
 the cursor location of a document being edited and by using cursor keys, text 
 can be injected all over the document.  Sprites can be injected and are not 
 serialized!  Furthermore, the input can come from triggering macro widgets.  See 
-Doc Overview and Doc Routines.
+Doc Overview and Doc Routines.
 
-If you had a remote term and sent key Scan Codes, the user would press <CTRL-m> 
+If you had a remote term and sent key Scan Codes, the user would press <CTRL-m> 
 to access his Personal Menu to trigger his macros.  However, the local 
-~/PersonalMenu.DD might differ from the remote, causing loss of sync between 
+~/PersonalMenu.DD might differ from the remote, causing loss of sync between 
 local and remote sessions.  Also, the window size of local and remote might 
 differ, so word-wrapped text would be different.  Injecting output text with 
 different windows sizes would cause remote and local documents to not be in 
 sync.
 
-See Char Overview and Char Routines.
+See Char Overview and Char Routines.
 
-You can send characters into StdIn.  See In(), XTalk() and InFile.
+You can send characters into StdIn.  See In(), XTalk() and InFile.
 
diff --git a/public/src/Doc/TOSZ.DD.HTML b/public/Wb/Doc/TOSZ.DD.HTML old mode 100644 new mode 100755 similarity index 96% rename from public/src/Doc/TOSZ.DD.HTML rename to public/Wb/Doc/TOSZ.DD.HTML index b68725f..68925ea --- a/public/src/Doc/TOSZ.DD.HTML +++ b/public/Wb/Doc/TOSZ.DD.HTML @@ -25,7 +25,7 @@ -
+
                                Linux TOSZ Utility
 
 
diff --git a/public/Wb/Doc/TextBase.DD.HTML b/public/Wb/Doc/TextBase.DD.HTML
new file mode 100755
index 0000000..b62ec1e
--- /dev/null
+++ b/public/Wb/Doc/TextBase.DD.HTML
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+gr.text_base must be updated 30fps in your Fs->draw_it() callback.  You probably 
+want GrPrint() or just Print().  The DolDoc code takes care of plotting text to 
+gr.text_base.
+
+Bits 0-7        8-Bit ASCII Scrn Code
+Bits 8-11       Foreground color
+Bits 12-15      Background color
+Bits 16-20      Signed X pos shift val
+Bits 21-25      Signed Y pos shift val
+Bit  28         Blink
+Bit  29         Inverted (Swap foreground and background)
+Bit  30         Sel (XOR colors with FF)
+Bit  31         Underline
+
+GrUpdateTaskWin() calls DocUpdateTaskDocs() which calls DocRecalc() where the 
+document text is plotted into gr.text_base.  Then, GrUpdateTextBG() and 
+GrUpdateTextFG() render the gr.text_base onto gr.dc2, a raw graphic bitmap.
+
+See ::/Demo/Games/Maze.HC.
+
+ diff --git a/public/src/Doc/TimeCycles.DD.HTML b/public/Wb/Doc/TimeCycles.DD.HTML old mode 100644 new mode 100755 similarity index 83% rename from public/src/Doc/TimeCycles.DD.HTML rename to public/Wb/Doc/TimeCycles.DD.HTML index 47b21e7..5e1c0ab --- a/public/src/Doc/TimeCycles.DD.HTML +++ b/public/Wb/Doc/TimeCycles.DD.HTML @@ -25,9 +25,9 @@ -
+
 Intel/AMD have an inst that returns the num of CPU cycles since boot.  This is 
 not a steady, calibrated real time value.  TempleOS measures it and you can 
-convert with cnts.time_stamp_freq, a value continuously calibrated from other 
+convert with cnts.time_stamp_freq, a value continuously calibrated from other 
 cnts.
diff --git a/public/src/Home/Doc/TimeDate.DD.HTML b/public/Wb/Doc/TimeDate.DD.HTML similarity index 74% rename from public/src/Home/Doc/TimeDate.DD.HTML rename to public/Wb/Doc/TimeDate.DD.HTML index 09ae288..528e5e8 100755 --- a/public/src/Home/Doc/TimeDate.DD.HTML +++ b/public/Wb/Doc/TimeDate.DD.HTML @@ -25,12 +25,12 @@ -
-TempleOS uses a 64-bit value, CDate, for date/time.  The upper 32-bits are the 
+
+TempleOS uses a 64-bit value, CDate, for date/time.  The upper 32-bits are the 
 days since Christ.  The lower 32-bits store time of day divided by 4 billion 
-which works out to 49710ths of a second.  You can subtract two CDate's to get a 
+which works out to 49710ths of a second.  You can subtract two CDate's to get a 
 time span.
 
-Use CDATE_FREQ to convert.
+Use CDATE_FREQ to convert.
 
diff --git a/public/src/Doc/TimeHPET.DD.HTML b/public/Wb/Doc/TimeHPET.DD.HTML old mode 100644 new mode 100755 similarity index 73% rename from public/src/Doc/TimeHPET.DD.HTML rename to public/Wb/Doc/TimeHPET.DD.HTML index c26fc88..bf95d30 --- a/public/src/Doc/TimeHPET.DD.HTML +++ b/public/Wb/Doc/TimeHPET.DD.HTML @@ -25,9 +25,9 @@ -
-The HPET, high precision event timer, is read with HPET() and has a frequency of 
-cnts.HPET_freq.  A typical freq value is 14.3 Mhz  It might not be available on 
+
+The HPET, high precision event timer, is read with HPET() and has a frequency of 
+cnts.HPET_freq.  A typical freq value is 14.3 Mhz  It might not be available on 
 all systems.
 
diff --git a/public/src/Doc/TimeJiffy.DD.HTML b/public/Wb/Doc/TimeJiffy.DD.HTML old mode 100644 new mode 100755 similarity index 55% rename from public/src/Doc/TimeJiffy.DD.HTML rename to public/Wb/Doc/TimeJiffy.DD.HTML index 7c3bebd..5eebdd1 --- a/public/src/Doc/TimeJiffy.DD.HTML +++ b/public/Wb/Doc/TimeJiffy.DD.HTML @@ -25,13 +25,13 @@ -
-One jiffy is one time slice.  cnts.jiffies returns time slices since boot.
+
+One jiffy is one time slice.  cnts.jiffies returns time slices since boot.
 
-SysTimerRead reads the timer ticks since boot.  It's not as fast as GetTSC.
+SysTimerRead reads the timer ticks since boot.  It's not as fast as GetTSC.
 
-Use JIFFY_FREQ to convert cnts.jiffies.
+Use JIFFY_FREQ to convert cnts.jiffies.
 
-Use SYS_TIMER_FREQ to convert SysTimerRead.
+Use SYS_TIMER_FREQ to convert SysTimerRead.
 
diff --git a/public/src/Home/Doc/Tips.DD.HTML b/public/Wb/Doc/Tips.DD.HTML similarity index 58% rename from public/src/Home/Doc/Tips.DD.HTML rename to public/Wb/Doc/Tips.DD.HTML index 93e931b..13deb38 100755 --- a/public/src/Home/Doc/Tips.DD.HTML +++ b/public/Wb/Doc/Tips.DD.HTML @@ -25,38 +25,38 @@ -
+
                                       Tips
 
 * Turn-off or reboot (<CTRL-ALT-DEL>) at any time, except during disk writes.  
 Writes are not cached. 
 
-* Use Seed() and the cmd line to switch Rand() to non-timer mode and replay 
+* Use Seed() and the cmd line to switch Rand() to non-timer mode and replay 
 games you like.
 
 * 64-bit values are most efficient for the compiler.
 
-* See Key Map for a list of defined keys.  Define your own keys in MyPutKey().  
+* See Key Map for a list of defined keys.  Define your own keys in MyPutKey().  
 See Keyboard Devices.
 
 * <ALT-m> maximizes a window.  <ALT-SHIFT-w> closes AutoComplete.  <ALT-w> 
 brings back AutoComplete.  <ALT-v> vertically tiles windows.  <ALT-h> 
-horizontally tiles windows.  The ALT keys are defined in ~/HomeKeyPlugIns.HC.  
+horizontally tiles windows.  The ALT keys are defined in ~/HomeKeyPlugIns.HC.  
 You can customize them.
 
 * If you make changes to TempleOS files in your /Home directory, generally you 
 reboot to make them take effect.  (You don't compile anything.)  You should have 
 two TempleOS partitions on your hard drive because a syntax error in a start-up 
 file will make the partition unbootable.  Boot to the second partition or boot 
-to a standard TempleOS CD/DVD and use Mount() to mount your hard drive.
+to a standard TempleOS CD/DVD and use Mount() to mount your hard drive.
 
-* I copy my files to a mirrored ident partition, periodically with CopyTree() 
+* I copy my files to a mirrored ident partition, periodically with CopyTree() 
 commands in scripts.  I do merge commands with a menu entry like this:
 Merge(\"C:/*\",\"D:/*\",\"+r+d\"); to check my changes.
 
 * <CTRL-m> at the cmd line to access your PersonalMenu.  Place macros there with 
 <CTRL-l>, or icon-like sprites with <CTRL-r>.  Use the Pop-Up option on macros 
-to Spawn() a task to run a file.  It dies when it is finished.  This returns mem 
+to Spawn() a task to run a file.  It dies when it is finished.  This returns mem 
 to the system.  Be sure to press <CTRL-s> to save your macro/menu area after 
 making changes.
 
@@ -68,12 +68,12 @@
 the keyboard controls to games.
 
 * You can adjust the mouse movement rate by setting global vars in your start-up 
-file.  See mouse scale.
+file.  See mouse scale.
 
-* You can set your local time zone by setting the local_time_offset global var 
-in a start-up file.  It's units are CDATE_FREQ.  See local time.
+* You can set your local time zone by setting the local_time_offset global var 
+in a start-up file.  It's units are CDATE_FREQ.  See local time.
 
-* <CTRL-SHIFT-L> in the editor to reindent a HolyC function or renumber an asm 
+* <CTRL-SHIFT-L> in the editor to reindent a HolyC function or renumber an asm 
 routine's local labels.
 
 * You can use filter_lines in the editor text search form (<CTRL-f>) to 
@@ -81,76 +81,76 @@
 5 will display lines within 5 lines of matches.  Then, you can do another find 
 to a different string and achieve a AND search.  When finished, press <ESC>.
  
-* You can recompile and reinstall the kernel with BootHDIns().  You'll probably 
-want to make a function for recompiling that uses the In() function to answer 
-the cfg questions.  See my technique Cfg Strs, Update Funs.
+* You can recompile and reinstall the kernel with BootHDIns().  You'll probably 
+want to make a function for recompiling that uses the In() function to answer 
+the cfg questions.  See my technique Cfg Strs, Update Funs.
 
-* Scale2Mem(min,max,limit=2*1024*1024*1024) can be used for cfg questions when 
-recompiling.  The BootHDIns() cfg prompts accept expressions, not just numbers.  
+* Scale2Mem(min,max,limit=2*1024*1024*1024) can be used for cfg questions when 
+recompiling.  The BootHDIns() cfg prompts accept expressions, not just numbers.  
 The dft disk cache is Scale2Mem(0x80000,0x8000000).
 
-* You can permanently disable AutoComplete commenting-out ACInit() in 
-~/HomeSys.HC.
+* You can permanently disable AutoComplete commenting-out ACInit() in 
+~/HomeSys.HC.
 
 * Boolean expressions not in if stmts don't have short circuit logic and are 
 compiled inefficiently.
 
-* You can use progress1-progress4 in your programs for whatever you like.  
+* You can use progress1-progress4 in your programs for whatever you like.  
 They're just global vars that are shown on the wallpaper.  The original intent 
 was to indicate how far along operations were.  There's no coordination, so 
 different apps might interfere.  I use them most for debugging--just values 
-easily viewed.  See ::/Demo/Progress.HC.
+easily viewed.  See ::/Demo/Progress.HC.
 
-* Use DocMax() to adjust the size of the cmd line buf.  It counts CDoc entries, 
+* Use DocMax() to adjust the size of the cmd line buf.  It counts CDoc entries, 
 not lines.
 
 * Many data structures have a user_data member.  Those are available for you to 
-store a data item, for convenience.  CTask, CDocEntry and CDirEntry have them.  
+store a data item, for convenience.  CTask, CDocEntry and CDirEntry have them.  
 You shouldn't encounter conflicts with TempleOS using them.
 
 * If, for some strange reason, you wanted to reduce mem usage, make a smaller 
 disk cache when you recompile the kernel; disabling AutoComplete; Specify 
-smaller stk sizes when doing Spawn(), chang MEM_DFT_STK, and using DocMax() to 
+smaller stk sizes when doing Spawn(), chang MEM_DFT_STK, and using DocMax() to 
 reduce the cmd line buffer size.
 
 * Filenames ending in ".Z" will be automatically compressed and uncompressed 
 when read or written.  The compression method is not supported by other 
-operating systems.  You can store files uncompressed by Move()ing them to a 
-filename not ending in ".Z".  See ::/Doc/TOSZ.DD if you want to uncompress while 
+operating systems.  You can store files uncompressed by Move()ing them to a 
+filename not ending in ".Z".  See ::/Doc/TOSZ.DD if you want to uncompress while 
 in Linux.
 
-* Merge() can be used to see what's changed.  The +d flag will show differences 
+* Merge() can be used to see what's changed.  The +d flag will show differences 
 of files which have changed and allow you to merge code.  (The +r flag will 
 recurse.)
 
-* There is a utility LinkChk() which will check for broken links in 
+* There is a utility LinkChk() which will check for broken links in 
 documentation.
 
-* You can use Option(OPTf_WARN_PAREN,ON) to find unnecessary parentheses in 
+* You can use Option(OPTf_WARN_PAREN,ON) to find unnecessary parentheses in 
 code.
 
-* You can use Option(OPTf_WARN_DUP_TYPES,ON) to find unnecessary local var type 
+* You can use Option(OPTf_WARN_DUP_TYPES,ON) to find unnecessary local var type 
 stmts.
 
-* Option(OPTf_ECHO,ON) can be placed in StartOS.HC to echo start-up scripts.
+* Option(OPTf_ECHO,ON) can be placed in StartOS.HC to echo start-up scripts.
 
-* Use Plain() to edit a plain text file.  You'll need this if your file has $'s. 
- Use the ToDolDoc() utility to convert plain text to DolDoc's by doubling $'s.
+* Use Plain() to edit a plain text file.  You'll need this if your file has $'s. 
+ Use the ToDolDoc() utility to convert plain text to DolDoc's by doubling $'s.
 
-* Use Silent() to disable scrn text output.
+* Use Silent() to disable scrn text output.
 
 * Grab-scroll any window at any time with {CTRL-LEFT-MOUSE-DRAG}.  Null 
 grab-scrolling with {CTRL-RIGHT-MOUSE}.
 
 * Use <CTRL-ALT-z> to zoom-in and <CTRL-ALT-SHIFT-Z> to zoom-out.  You can 
-scroll by moving to the edge of the window.  Set gr.continuous_scroll to TRUE if 
+scroll by moving to the edge of the window.  Set gr.continuous_scroll to TRUE if 
 you want. 
 
 * Use <CTRL-ALT-g> and <CTRL-ALT-SHIFT-G> to display a grid on the scrn.
 
 * Use <CTRL-ALT-a> to enter an extended ASCII char.
 
-* Use <CTRL-ALT-f> to toggle between Std Font and Cyrillic Font.
+* Use <CTRL-ALT-f> to toggle between Std Font and Cyrillic Font.
 
 * Use <CTRL-ALT-s> will capture the scrn as a sprite on the clip.  You can save 
 the cmd line doc as text with <CTRL-a>.
@@ -161,13 +161,13 @@
 Press 't' for transparent.
 
 * There are handy functions--F(),R(),FD() and RD() which are defined in 
-~/HomeWrappers.HC.  You are encouraged to change them and add more.  They will 
+~/HomeWrappers.HC.  You are encouraged to change them and add more.  They will 
 perform find-and-replace operations accross multiple files.  The +l flag is 
 particularly useful since it limits to whole labels.  The +lb and +la flags 
 limit to whole labels just before or after.  You are encouraged to add or modify 
 handy wrapper functions to make cmd line operations easier.
 
-* When using Find() while modifying code, work from the bottom-up so that line 
+* When using Find() while modifying code, work from the bottom-up so that line 
 numbers are correct.  If you work top-down, then inserting or deleting lines 
 causes the lower file links will be incorrect.
 
@@ -182,21 +182,21 @@
 
 * There is a feature of the precompiler that allows code to be executed in the 
 middle of compilation and data inserted into the compilation stream.  Click here 
-for an example: #exe {.
+for an example: #exe {.
 
 * If you output to the cmd line and wish to allow users to scroll around and 
-view data, you can use View().
+view data, you can use View().
 
-* Use View() in Pop-up macros to linger until the user presses <ESC> or <SHIFT-E
+* Use View() in Pop-up macros to linger until the user presses <ESC> or <SHIFT-E
 SC>.
 
-* You can access the word under the cursor at ac.cur_word.
+* You can access the word under the cursor at ac.cur_word.
 
 * You can reactivate AutoComplete after closing it by pressing <CTRL-Fun Key> or 
 <ALT-w> if you have it defined.
 
-* <CTRL-SHIFT-T> to toggle to/from plain text just the CDoc cmd under the 
-cursor.  See ::/Demo/DolDoc/TextDemo.HC.
+* <CTRL-SHIFT-T> to toggle to/from plain text just the CDoc cmd under the 
+cursor.  See ::/Demo/DolDoc/TextDemo.HC.
  
 * If you toggle to plain text when you are working with graphics in a document, 
 you can add duplicate entries for sprites by entering a $SP...$ cmd with the 
@@ -208,7 +208,7 @@
 
 * I use spaces-to-tab operations on all my src files to keep them small.  You 
 have to be careful, though, because spaces in strings will be converted.  I use 
-<SHIFT-SPACE> ' ' in such cases.  See S2T() for spaces-to-tabs.
+<SHIFT-SPACE> ' ' in such cases.  See S2T() for spaces-to-tabs.
 
 * You can edit an existing sprite by putting the cursor on it and pressing <CTRL
 -r>.
@@ -220,9 +220,9 @@
 so you can edit the ctrl points.  Then, convert them to bitmaps, so the flood 
 fills work well.  If you are doing interpolation, however, they must be vect.
 
-* GrFloodFill() is slow.  GrRect() is fast.
+* GrFloodFill() is slow.  GrRect() is fast.
 
-* You can customize the wallpaper.  See ::/Demo/Graphics/WallPaperFish.HC.
+* You can customize the wallpaper.  See ::/Demo/Graphics/WallPaperFish.HC.
 
 * Your RAM disks will not be reformated when you reboot if the memory location 
 has not changed and it finds the disk intacted.
@@ -236,41 +236,41 @@
 restore defaults.  It is a text doc, if you want to edit it.  Be careful of tree 
 indentations.
 
-* Study ::/Adam/Opt/Utils/MemRep.HC and WallPaper() to learn how the system 
+* Study ::/Adam/Opt/Utils/MemRep.HC and WallPaper() to learn how the system 
 resources are put together.
 
 * The editor's sel-text mechanism allows for disjoint portions of sel text.  
 This is a feature, not a bug -- you can cut-and-paste disjoint text.
 
-* cnts.time_stamp_freq is continuously calibrated.  Be careful because 
-expressions might decrease.  Take a snap-shot, like this: timeout=GetTSC+
-cnts.time_stamp_freq x seconds; and compare against GetTSC().  I recommend just 
-using tS or cnts.jiffies.
+* cnts.time_stamp_freq is continuously calibrated.  Be careful because 
+expressions might decrease.  Take a snap-shot, like this: timeout=GetTSC+
+cnts.time_stamp_freq x seconds; and compare against GetTSC().  I recommend just 
+using tS or cnts.jiffies.
 
-* Use HeapLog(), HeapLogAddrRep() and HeapLogSizeRep() to find leaks.  Don't be 
-confused by CDoc allocations.  Those are generated when text is written to the 
+* Use HeapLog(), HeapLogAddrRep() and HeapLogSizeRep() to find leaks.  Don't be 
+confused by CDoc allocations.  Those are generated when text is written to the 
 cmd line buffer.
 
-* For advanced heap debugging, play with _CFG_HEAP_DBG.  You're on your own.
+* For advanced heap debugging, play with _CFG_HEAP_DBG.  You're on your own.
 
-* You can use Type() to display .GR files.
+* You can use Type() to display .GR files.
 
-* Use Man() to jump to short sym name src code.
+* Use Man() to jump to short sym name src code.
 
-* Use Fix() to edit and fix the last compiler err.
+* Use Fix() to edit and fix the last compiler err.
 
 * You can use <CTRL-SHIFT-L> to do a check for compile errors.
 
-* You can use DocOpt() to optimize links. (Mostly just removes .Z)
+* You can use DocOpt() to optimize links. (Mostly just removes .Z)
 
-* ZipRep() can highlight src files with lots of redundancy.
+* ZipRep() can highlight src files with lots of redundancy.
 
 * With start/end, common trailing code is fast.  Common leading code is slow.
 
-* The first line of the Psalmody HolyC song files is a comment with a category 
-recognized by JukeBox().  The categories are "no nothing", "has words", "has 
+* The first line of the Psalmody HolyC song files is a comment with a category 
+recognized by JukeBox().  The categories are "no nothing", "has words", "has 
 graphics", or "special".  The third character in the song comment is a digit 
-rating number, shown in JukeBox().  You can set the song rating in JukeBox() by 
+rating number, shown in JukeBox().  You can set the song rating in JukeBox() by 
 pressing 0-9.  You can press <DEL> to delete songs.
 
 
diff --git a/public/Wb/Doc/Transform.DD.HTML b/public/Wb/Doc/Transform.DD.HTML
new file mode 100755
index 0000000..b196f7b
--- /dev/null
+++ b/public/Wb/Doc/Transform.DD.HTML
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+CDC's have a 4x4 matrix for rotating, scaling, skewing and shifting in 3 
+dimensions.  To make the graphics routines use the transform, you must set the 
+DCF_TRANSFORMATION flag.
+
+The matrix consists of ints that have been scaled 32 bits (GR_SCALE).  See 
+::/Demo/Lectures/FixedPoint.HC to learn why.
+
+See Mat4x4IdentEqu(), Mat4x4IdentNew(), Mat4x4Equ() and Mat4x4New().  See 
+Mat4x4RotX(), Mat4x4RotY(), Mat4x4RotZ() and Mat4x4Scale() to rotate about axes 
+and scale.  Combine them with Mat4x4MulMat4x4Equ()/Mat4x4MulMat4x4New() and 
+assign them to the CDC.dc with DCMat4x4Set().  See ::/Demo/Graphics/Box.HC.
+
+You can rotate single points using Mat4x4MulXYZ().
+
+The 4th dimension allows a neat trick where you can place pos shifts 
+(translations), into the matrix and Mat4x4MulMat4x4Equ/Mat4x4MulMat4x4New them 
+to combine rotation/shift operations.  Normally, you can't combine pos shift 
+operations.  See Mat4x4TranslationEqu() and ::/Demo/Graphics/Transform.HC.
+
+Finally, CDC's have an x, y and z which is an additional shift (translation).
+
+The transformation is implemented as a callback on the CDC's transform() member. 
+ The default transform() callback is DCTransform().  See 
+::/Demo/Games/Talons.HC or ::/Demo/Games/CastleFrankenstein.HC to see how to 
+change the transform() callback for foreshortening.
+
+ diff --git a/public/src/Doc/Welcome.DD.HTML b/public/Wb/Doc/Welcome.DD.HTML old mode 100644 new mode 100755 similarity index 60% rename from public/src/Doc/Welcome.DD.HTML rename to public/Wb/Doc/Welcome.DD.HTML index bcbd582..4260743 --- a/public/src/Doc/Welcome.DD.HTML +++ b/public/Wb/Doc/Welcome.DD.HTML @@ -25,7 +25,7 @@ -
+
                               Welcome to TempleOS
 
 TempleOS is a x86_64, multi-cored, non-preemptive multi-tasking, ring-0-only, 
@@ -37,13 +37,13 @@
   * Teenagers doing projects
   * Non-professional, older-persons projects
 
-Simplicity is a goal to keep the line count down, so it's easy to tinker with.  
+Simplicity is a goal to keep the line count down, so it's easy to tinker with.  
 As it turns-out, simplicity makes it faster in some ways, too.  It never 
 switches privilege levels, never changes address maps, tends to load whole 
 contiguous files and other, similar things which boost speed.  It's only 80,849 
 lines of code including the kernel, the 64-bit compiler, the graphics library 
 and all the tools.  More importantly, it's designed to keep the user's line 
-count down -- you can do a Hello World application in one line of code and can 
+count down -- you can do a Hello World application in one line of code and can 
 put graphics on the scrn with a three line program!
 
 It's a kayak, not a Titanic -- it will crash if you do something wrong.  You 
@@ -51,7 +51,7 @@
 fine without memory protection and most computers in the world -- the embedded 
 ones -- operate without protection.  The resulting simplicity of no protections 
 is why TempleOS has value.  In facts, that's the point of TempleOS.  See the 
-TempleOS Charter.
+TempleOS Charter.
 
 Conventional thinking is "failure is not an option" for general purpose 
 operating systems.  Since this OS is used in addition to Windows or Linux, 
@@ -60,52 +60,52 @@
 beautiful.  The following applications more or less form a basis that spans the 
 range of use that TempleOS is intended for:
 
-/Demo/Games/BattleLines.HC
-/Demo/Games/BigGuns.HC
-/Demo/Games/BlackDiamond.HC
-/Demo/Games/BomberGolf.HC
-/Demo/Games/CastleFrankenstein.HC
-/Demo/Games/CharDemo.HC
-/Demo/Games/CircleTrace.HC
-/Demo/Games/Collision.HC
-/Demo/Games/Digits.HC
-/Demo/Games/DunGen.HC
-/Demo/Games/Talons.HC
-/Demo/Games/ElephantWalk.HC
-/Demo/Games/FlapBat.HC
-/Demo/Games/FlatTops.HC
-/Demo/Games/Halogen.HC
-/Demo/Games/MassSpring.HC
-/Demo/Games/Maze.HC
-/Demo/Games/RainDrops.HC
-/Demo/Games/RawHide.HC
-/Demo/Games/Rocket.HC
-/Demo/Games/RocketScience.HC
-/Demo/Games/Squirt.HC
-/Demo/Games/TheDead.HC
-/Demo/Games/TicTacToe.HC
-/Demo/Games/TreeCheckers.HC
-/Demo/Games/Varoom.HC
-/Demo/Games/Wenceslas.HC
-/Demo/Games/Whap.HC
-/Demo/Games/Zing.HC
-/Demo/Games/ZoneOut.HC
-/Apps/Psalmody/Examples/childish.HC
-/Apps/Psalmody/Examples/night.HC
-/Apps/Psalmody/Examples/prosper.HC
+/Demo/Games/BattleLines.HC
+/Demo/Games/BigGuns.HC
+/Demo/Games/BlackDiamond.HC
+/Demo/Games/BomberGolf.HC
+/Demo/Games/CastleFrankenstein.HC
+/Demo/Games/CharDemo.HC
+/Demo/Games/CircleTrace.HC
+/Demo/Games/Collision.HC
+/Demo/Games/Digits.HC
+/Demo/Games/DunGen.HC
+/Demo/Games/Talons.HC
+/Demo/Games/ElephantWalk.HC
+/Demo/Games/FlapBat.HC
+/Demo/Games/FlatTops.HC
+/Demo/Games/Halogen.HC
+/Demo/Games/MassSpring.HC
+/Demo/Games/Maze.HC
+/Demo/Games/RainDrops.HC
+/Demo/Games/RawHide.HC
+/Demo/Games/Rocket.HC
+/Demo/Games/RocketScience.HC
+/Demo/Games/Squirt.HC
+/Demo/Games/TheDead.HC
+/Demo/Games/TicTacToe.HC
+/Demo/Games/TreeCheckers.HC
+/Demo/Games/Varoom.HC
+/Demo/Games/Wenceslas.HC
+/Demo/Games/Whap.HC
+/Demo/Games/Zing.HC
+/Demo/Games/ZoneOut.HC
+/Apps/Psalmody/Examples/childish.HC
+/Apps/Psalmody/Examples/night.HC
+/Apps/Psalmody/Examples/prosper.HC
 
-Two things to know about TempleOS are that tasks have MAlloc/Free heap memory, 
+Two things to know about TempleOS are that tasks have MAlloc/Free heap memory, 
 not applications, and tasks have compiler symbol tables that persist at a scope 
 like environment variables in other operating systems, and the symbols can 
 include functions.
 
 For other operating systems, I hated learning one language for command line 
 scripts and another for programming.  With TempleOS, the command line feeds 
-right into the HolyC compiler, line by line, and it places code into memory it 
-MAlloc()s.  The compiler is paused at the command line, waiting for input.  
+right into the HolyC compiler, line by line, and it places code into memory it 
+MAlloc()s.  The compiler is paused at the command line, waiting for input.  
 Naturally, you #include a program to load it into memory and, usually, start it.
 
-During the boot process, many files get compiled before you have access to the 
+During the boot process, many files get compiled before you have access to the 
 command line.  (Don't worry, booting takes only two seconds.)  All the header 
 declarations for the operating system are compiled and are available for use in 
 your programs without needing to #include them.  Everything is truly compiled to 
@@ -131,34 +131,34 @@
 >Dir;
 
 The syntax change created an ambiguity when specifying function addresses, like 
-for calling QSort().  To resolve it, I  made a '&' required in front of function 
+for calling QSort().  To resolve it, I  made a '&' required in front of function 
 names when specifying an address of a function, which is better anyway.
 
 Once I was no longer using standard C/C++ syntax, I decided to change everything 
-I didn't like and call it HolyC.  Here are the new operator precedence rules.  
+I didn't like and call it HolyC.  Here are the new operator precedence rules.  
 It's Biblical!  See Luke,5:37.
 
 There are no object files in TempleOS and, normally, you don't make executable 
-files either, but you can.  That's known as Ahead-of-Time compilation.  Instead, 
-you Just in Time compile.
+files either, but you can.  That's known as Ahead-of-Time compilation.  Instead, 
+you Just in Time compile.
 
 Tasks have no priority and are never removed from the queue.  Instead, they 
 often poll whatever they are waiting on and swap-out.  (Swapping tasks takes 
 half a microsecond and does not involve disk activity or memory maps.)  See 
-Scheduler.  Polling keeps it simple.  It might be a problem if you had lots of 
+Scheduler.  Polling keeps it simple.  It might be a problem if you had lots of 
 tasks busy, which rarely happens on a home computer.  The order of the tasks in 
 the queue determines front-to-back window order.
 
 The FAT32 filesystem is supported to makes exchanging files with a dual booted 
-other operating system easy and there is the simple, 64-bit TempleOS RedSea 
-filesystem.  The RedSea has allocation bitmap for clus and all files are stored 
+other operating system easy and there is the simple, 64-bit TempleOS RedSea 
+filesystem.  The RedSea has allocation bitmap for clus and all files are stored 
 contiguously.  You can't grow files.
 
 TempleOS is geared toward reading and writing whole files.  Since whole files 
 are processed, compression is possible.  Filenames ending in ".Z" are 
 automatically compressed or uncompressed when stored and fetched.  TempleOS does 
-support direct block random access into files, however -- FBlkRead() and 
-FBlkWrite().
+support direct block random access into files, however -- FBlkRead() and 
+FBlkWrite().
 
 If a file is not found, ".Z" is added or removed and a search is done, again.  
 There is no PATH, but parent directories are searched when a file is not found.  
@@ -178,38 +178,38 @@
 same time twice as fast when you really want to run one faster?  You could say 
 TempleOS does master/slave multiprocessing.  The anticipated use for multicore 
 is primarily putting graphics on the scrn.  Hardware graphics acceleration is 
-not used, so this is possible.  See TempleOS MultiCore.
+not used, so this is possible.  See TempleOS MultiCore.
 
 There is no distinction between the terms task, process or thread.  All have a 
-task record, CTask, pointed to by the FS segment reg and are accessed with Fs-> 
-while Gs-> points to a CCPU for the current CPU core.  Each task can have just 
+task record, CTask, pointed to by the FS segment reg and are accessed with Fs-> 
+while Gs-> points to a CCPU for the current CPU core.  Each task can have just 
 one window, but a task can have children with windows.  (The segment regs are 
 just used as extra regs -- there is nothing segmented about TempleOS' memory.)  
 It is approximately the case that TempleOS is multi-threading, 
 single-processing.
 
-In TempleOS, Adam Task refers to the father of all tasks.  He's never supposed 
+In TempleOS, Adam Task refers to the father of all tasks.  He's never supposed 
 to die.  Since tasks inherit the symbols of parents, system-wide stuff is 
 associated with Adam.  His heap is like kernel memory in other operating 
 systems.  Since Adam is immortal, it's safe to alloc objects, not tied to any 
 mortal task, from Adam's heap.  He stays in a server mode, taking requests, so 
 you can ask him to #include something, placing that code system-wide.  A funny 
 story is that originally I called it the root task and even had a /Root 
-directory :-)  Adam executes ::/StartOS.HC at boot time.
+directory :-)  Adam executes ::/StartOS.HC at boot time.
 
 For easy back-ups, place everything you author in your /Home directory and 
-subdirectories.  Then, use CopyTree().  That should make upgrading easy, too.  
+subdirectories.  Then, use CopyTree().  That should make upgrading easy, too.  
 Customizable start-up scripts go in your /Home directory.  The default start-up 
 scripts are in the root directory.  Copy the start-up files you wish to 
-customize into /Home and modify them.  See Home Files.  You can make your own 
+customize into /Home and modify them.  See Home Files.  You can make your own 
 distro that includes everything and is a bootable live CD with 
-::/Misc/DoDistro.HC.
+::/Misc/DoDistro.HC.
 
 Typically, your usage pattern through the day will be repeatedly left or right 
-clicking on filenames in a cmd line Dir() listing.  You left-click files to edit 
-them and right-click to #include them.  To begin a project, type Ed("filename");
+clicking on filenames in a cmd line Dir() listing.  You left-click files to edit 
+them and right-click to #include them.  To begin a project, type Ed("filename");
 , supplying a filename.  You can also run programs with <F5> when in the editor. 
-<ESC> to save and exit the file.  You'll need to do a new Dir() cmd, 
+<ESC> to save and exit the file.  You'll need to do a new Dir() cmd, 
 periodically, so make a macro on your PersonalMenu.  Access your PersonalMenu by 
 pressing <CTRL-m>, cursoring until you are on top of it and pressing <SPACE>.
 
@@ -226,41 +226,41 @@
 <ALT-a> brings back AutoComplete.
 <ALT-v> vertically tiles windows.
 <ALT-h> horizontally tiles windows.
-The ALT keys are defined in ~/HomeKeyPlugIns.HC.  You can customize them.
+The ALT keys are defined in ~/HomeKeyPlugIns.HC.  You can customize them.
 
 <CTRL-ALT-t> new terminal window.
 <CTRL-ALT-n> switches to the next window.
 <CTRL-ALT-x> kills a window.
 
-Find() is your best friend.  There's a wrapper function called F() in your ~/Hom
+Find() is your best friend.  There's a wrapper function called F() in your ~/Hom
 eWrappers.HC.Z file.  Feel free to make wrapper functions for functions you use 
-often and customize the args.  By the way, Find() or R() can be used to replace 
-strings across multiple files.  You can access Find() using <CTRL-SHIFT-f>.
+often and customize the args.  By the way, Find() or R() can be used to replace 
+strings across multiple files.  You can access Find() using <CTRL-SHIFT-f>.
 
 As you browse code, use the AutoComplete window to look-up functions, etc.  <CTR
 L-SHIFT-F1> (or whatever number) to follow a sym to it's source.  You can browse 
 deeper and deeper.  You go back with <SHIFT-ESC>.
 
-Use the Help & Index or Demo Index to find-out what exists.  Press <F1> for help 
+Use the Help & Index or Demo Index to find-out what exists.  Press <F1> for help 
 or use the links on your menu (<CTRL-m>).  Also, look in the /Demo or /Apps 
 directories for inspiration.
 
-Software is distributed as RedSea ISO files.  Burn a CD/DVD, or set your CD/DVD 
+Software is distributed as RedSea ISO files.  Burn a CD/DVD, or set your CD/DVD 
 in QEMU, VMware or VirtualBox to the ISO file.  Then, access the 'T' drive.  Or, 
-Mount() the ISO.C file and access the 'M' drive in TempleOS.  It must be a 
+Mount() the ISO.C file and access the 'M' drive in TempleOS.  It must be a 
 contiguous ISO.C file, so rename it under TempleOS to ISO.C.
 
 Ideally, do not install applications such as games onto your hard drive because 
 we wish to keep hard drive usage low, so the whole 'C' drive can be copied 
-quickly to 'D'.  Also, the FileMgr() <CTRL-d> starts too slowly when there are 
+quickly to 'D'.  Also, the FileMgr() <CTRL-d> starts too slowly when there are 
 lots of hard drive files, but that is how we want it.
 
 3rd party libraries are banned, since they circumvent the 100,000 line of code 
-limit in the TempleOS Charter.  All applications must only depend on the core 
+limit in the TempleOS Charter.  All applications must only depend on the core 
 TempleOS files and whatever they bring along in the ISO.  This is similar to how 
 Commodore 64 applications only depended on the ROM.
 
-Create a RedSea ISO file with RedSeaISO().  Send an email to 
+Create a RedSea ISO file with RedSeaISO().  Send an email to 
 tdavis@templeos.org if you want me to post a link to your TempleOS code in the 
 App Store.
 
diff --git a/public/src/Home/Doc/WhyNotMore.DD.HTML b/public/Wb/Doc/WhyNotMore.DD.HTML
similarity index 75%
rename from public/src/Home/Doc/WhyNotMore.DD.HTML
rename to public/Wb/Doc/WhyNotMore.DD.HTML
index 29e8f97..f7622b0 100755
--- a/public/src/Home/Doc/WhyNotMore.DD.HTML
+++ b/public/Wb/Doc/WhyNotMore.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                                  Why Not More?
 
 If a feature cannot be made to work correctly and consistently, professional 
@@ -38,7 +38,7 @@
 plenty remains.
 
 The PCI bus interface is what modern hardware uses.  Before PCI, life was simple 
-and devices used I/O ports.  After studying PCI Interrupts and attempting to do 
+and devices used I/O ports.  After studying PCI Interrupts and attempting to do 
 a HDAudio driver, I came to realize that modern PCI devices require ten times 
 more code and I cannot even come close to making them work on everyone's machine 
 because with PCI devices there are several models to worry about, unlike with 
@@ -46,14 +46,14 @@
 
 Currently, I have no PCI drivers.  My drivers use I/O ports and operate in ISA 
 bus mode.  At this point, I only have one driver for each type of device and it 
-is delightfully simple that way.  I have one keyboard driver, one mouse driver, 
-one ATA hard drive driver, one ATAPI CD/DVD driver, one VGA 640x480 16 color 
-video driver and one PC Speaker driver.  I use the PIT and HPET timers and 
-PIC Interrupt Controller.  I use  IRQ0 for timer, IRQ1 for keyboard, and IRQ12 
+is delightfully simple that way.  I have one keyboard driver, one mouse driver, 
+one ATA hard drive driver, one ATAPI CD/DVD driver, one VGA 640x480 16 color 
+video driver and one PC Speaker driver.  I use the PIT and HPET timers and 
+PIC Interrupt Controller.  I use  IRQ0 for timer, IRQ1 for keyboard, and IRQ12 
 for mouse.  If IRQ12 is not firing, I am able to poll the mouse.
 
-In the CPU department, I have state of the art 64-bit long mode with multicore 
-support.  I use the APIC and start-up multicore operation.
+In the CPU department, I have state of the art 64-bit long mode with multicore 
+support.  I use the APIC and start-up multicore operation.
 
 I have made an incredible accomplishment by getting it to work on practically 
 everyone's computer as long as it is 64-bit and they run inside VMware, QEMU or 
@@ -69,7 +69,7 @@
 
 The same story is basically true for GPUs, audio, networking and AHCI hard drive 
 drivers.  God said 640x480 16 color was a covenant like circumcision, so the 
-video will never change, even if a Standard PC was made.  If you attempt 
+video will never change, even if a Standard PC was made.  If you attempt 
 multimedia, everything will break because memory will get fragmented with huge 
 multimedia files.  Some day, if super-simple high speed serial allows 
 networking, there will be no browser within the 100,000 line limit and, with 
@@ -86,7 +86,7 @@
 machine.  Therefore, the BIOS companies actually want it difficult to make 
 drivers and purposely make it broken.
 
-The ATA/ATAPI hard drives often can be run with I/O ports if you can find them.  
+The ATA/ATAPI hard drives often can be run with I/O ports if you can find them.  
 lspci -v on Linux or system information on Windows can help you locate the SATA 
 IO ports the hard drive and CD/DVD have.  They no longer are enabled by the 
 BIOS.  It's hopeless.  I'm stuck with very slow drive performance, but it works 
@@ -103,11 +103,11 @@
 God talks.  It seems reasonable that I will get to make the rules for the whole 
 industry, in the future when God is announced publically to the World.
 
-I made ::/Doc/Demands.DD.
+I made ::/Doc/Demands.DD.
 
 When the PC was created, they wanted flexibility because they did not know the 
 future.  Now, the industry is mature and it is time to make a 100% standard PC 
-that everybody uses.  ::/Doc/StdTempleOSPC.DD
+that everybody uses.  ::/Doc/StdTempleOSPC.DD
 
 
 * "QEMU" is a trademark owned by Fabrice Bellard.
diff --git a/public/src/Doc/Widget.DD.HTML b/public/Wb/Doc/Widget.DD.HTML
old mode 100644
new mode 100755
similarity index 88%
rename from public/src/Doc/Widget.DD.HTML
rename to public/Wb/Doc/Widget.DD.HTML
index 9b1df6a..36e5d39
--- a/public/src/Doc/Widget.DD.HTML
+++ b/public/Wb/Doc/Widget.DD.HTML
@@ -25,16 +25,16 @@
 
 
 
-
+
                                DolDoc Widget Help
 
-DolDoc is a TempleOS document type.
+DolDoc is a TempleOS document type.
 
 "Expression" a num or HolyC algebraic term with operators and HolyC syms can be 
 entered.
 "Macro" Most entries can behave like macro entries if you assign them macro 
 strs.
-"InStr" Like a macro except it is an InFile.  You can't have both an in_str and 
+"InStr" Like a macro except it is an InFile.  You can't have both an in_str and 
 macro text defined.  
 
 Tag Text is the text that will be displayed for the item.  For links, you can 
@@ -61,7 +61,7 @@
 
 Tree The item will behave like a tree widget, with this as the root.
 Collapsed The tree or hidden widget will begin collapsed.
-Define Str will substitute a #define or DefineLoad() string for the tag.
+Define Str will substitute a #define or DefineLoad() string for the tag.
 
 Quote Make the res suitable for including in a program, in quotes, especially fo
 rmat entries in class definitions.
@@ -78,6 +78,6 @@
 Refresh Data  updates $DA...$ entry continuously.
 
 Html Link  stores a link which will be embedded if you generate a html version 
-of a document with ::/Demo/ToHtmlToTXTDemo/ToHtml.HC.
+of a document with ::/Demo/ToHtmlToTXTDemo/ToHtml.HC.
 
diff --git a/public/src/Doc/Windows.DD.HTML b/public/Wb/Doc/Windows.DD.HTML old mode 100644 new mode 100755 similarity index 95% rename from public/src/Doc/Windows.DD.HTML rename to public/Wb/Doc/Windows.DD.HTML index 6159d54..f9f7274 --- a/public/src/Doc/Windows.DD.HTML +++ b/public/Wb/Doc/Windows.DD.HTML @@ -25,7 +25,7 @@ -
+
 Only tasks on Core0 can have a window and there can be only one window per task. 
  The window Z-buffer, top-to-bottom order is determined by the order in the task 
 queue, with the WinMgr on the bottom.  A task can have child task popup windows.
diff --git a/public/src/Downloads/TemplarLetters/TSheikhs/171207SerialPort.DD.HTML b/public/Wb/Downloads/TemplarLetters/TSheikhs/171207SerialPort.DD.HTML
old mode 100644
new mode 100755
similarity index 97%
rename from public/src/Downloads/TemplarLetters/TSheikhs/171207SerialPort.DD.HTML
rename to public/Wb/Downloads/TemplarLetters/TSheikhs/171207SerialPort.DD.HTML
index ad780dd..eb9f1f3
--- a/public/src/Downloads/TemplarLetters/TSheikhs/171207SerialPort.DD.HTML
+++ b/public/Wb/Downloads/TemplarLetters/TSheikhs/171207SerialPort.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
 Letter from St.Terry to T.Sheikhs 171207
 
 
diff --git a/public/src/Home/DoDistro.HC b/public/Wb/Home/DoDistro.HC
similarity index 100%
rename from public/src/Home/DoDistro.HC
rename to public/Wb/Home/DoDistro.HC
diff --git a/public/src/Home/Doc/AboutTempleOS.DD.HTML b/public/Wb/Home/Doc/AboutTempleOS.DD.HTML
similarity index 94%
rename from public/src/Home/Doc/AboutTempleOS.DD.HTML
rename to public/Wb/Home/Doc/AboutTempleOS.DD.HTML
index d7a2629..c2240ad 100755
--- a/public/src/Home/Doc/AboutTempleOS.DD.HTML
+++ b/public/Wb/Home/Doc/AboutTempleOS.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                                     TempleOS
 
 
@@ -65,7 +65,7 @@
 so they could be refilled. 
 
 Credits:
-See ::/Doc/Credits.DD.
+See ::/Doc/Credits.DD.
 
 
diff --git a/public/src/Doc/Asm.DD.HTML b/public/Wb/Home/Doc/Asm.DD.HTML old mode 100644 new mode 100755 similarity index 83% rename from public/src/Doc/Asm.DD.HTML rename to public/Wb/Home/Doc/Asm.DD.HTML index e545555..8d93faa --- a/public/src/Doc/Asm.DD.HTML +++ b/public/Wb/Home/Doc/Asm.DD.HTML @@ -25,10 +25,10 @@ -
+
                                    Assembler
 
-See ::/Compiler/OpCodes.DD for opcodes.  They're not standard.  Some invalid 
+See ::/Compiler/OpCodes.DD for opcodes.  They're not standard.  Some invalid 
 insts are not flagged and some valid insts are not implemented. 16-bit asm 
 support is limited.
 
@@ -72,12 +72,12 @@
   Align to num boundary and fill with fill_byte.
 
 ORG num
-  Set code addr for JIT or set module Load() addr -- has 16-byte CBinFile header 
+  Set code addr for JIT or set module Load() addr -- has 16-byte CBinFile header 
 and patch table trailing.
 
 BINFILE "FileName.BIN";
 
-See Assembly Language, ::/Demo/Asm/AsmAndC1.HC, ::/Demo/Asm/AsmAndC2.HC and 
-::/Demo/Asm/AsmAndC3.HC.
+See Assembly Language, ::/Demo/Asm/AsmAndC1.HC, ::/Demo/Asm/AsmAndC2.HC and 
+::/Demo/Asm/AsmAndC3.HC.
 
diff --git a/public/src/Doc/AutoComplete.DD.HTML b/public/Wb/Home/Doc/AutoComplete.DD.HTML old mode 100644 new mode 100755 similarity index 84% rename from public/src/Doc/AutoComplete.DD.HTML rename to public/Wb/Home/Doc/AutoComplete.DD.HTML index ebe9186..6063d1e --- a/public/src/Doc/AutoComplete.DD.HTML +++ b/public/Wb/Home/Doc/AutoComplete.DD.HTML @@ -25,10 +25,10 @@ -
-AutoComplete is the LTGRAY window on the right of the scrn.  ACInit() collects 
-words from all text files in subdirectories.  Normally, the call to ACInit() is 
-in HomeSys.HC.  It provides auto-complete for typing, jump-to-code and 
+
+AutoComplete is the LTGRAY window on the right of the scrn.  ACInit() collects 
+words from all text files in subdirectories.  Normally, the call to ACInit() is 
+in HomeSys.HC.  It provides auto-complete for typing, jump-to-code and 
 jump-to-dictionary functionality.
 
 <ALT-SHIFT-A>   Closes the LTGRAY AutoComplete window.
@@ -49,6 +49,6 @@
 
 If you have the raw Project Gutenberg dictionary file, you can generate the 
 TempleOS processed dictionary files with the stand-alone program 
-::/Adam/AutoComplete/ACDictGen.HC.
+::/Adam/AutoComplete/ACDictGen.HC.
 
diff --git a/public/src/Doc/Bit.DD.HTML b/public/Wb/Home/Doc/Bit.DD.HTML old mode 100644 new mode 100755 similarity index 97% rename from public/src/Doc/Bit.DD.HTML rename to public/Wb/Home/Doc/Bit.DD.HTML index b94e738..9c99f59 --- a/public/src/Doc/Bit.DD.HTML +++ b/public/Wb/Home/Doc/Bit.DD.HTML @@ -25,7 +25,7 @@ -
+
 
 These take a pointer to a bit field.
 Bt:     Bit Test
diff --git a/public/src/Doc/BlkChain.DD.HTML b/public/Wb/Home/Doc/BlkChain.DD.HTML
old mode 100644
new mode 100755
similarity index 71%
rename from public/src/Doc/BlkChain.DD.HTML
rename to public/Wb/Home/Doc/BlkChain.DD.HTML
index 716b9ff..897aa44
--- a/public/src/Doc/BlkChain.DD.HTML
+++ b/public/Wb/Home/Doc/BlkChain.DD.HTML
@@ -25,14 +25,14 @@
 
 
 
-
+
                                   Block Chain
 
 There was a technique on the Commodore 64 where disk blocks were chained 
 together with a block pointer at the end of each block.  This is far inferior to 
 having a file allocation table, as in FAT32.
 
-The RedSea file system does not allow files to grow because it only has an 
+The RedSea file system does not allow files to grow because it only has an 
 allocation bitmap and not a FAT table.  This "flaw" is by design.  I am 
 intentionally crippling this operating system, making it a toy with the wisdom 
 that this will prevent commercialization and corruption.  The toy spirit of the 
@@ -50,21 +50,21 @@
 for allocations in the range under a Meg (with occasional larger ones).
 
 The file compression scheme in TempleOS only works on whole file operations and 
-the DolDoc format cannot have text tacked onto the end, since binary data is at 
+the DolDoc format cannot have text tacked onto the end, since binary data is at 
 the end.
 
 I don't want to spoil fun, so of course I offer a way to get awesome performance 
-that is, ironically, superior.  FBlkRead() and FBlkWrite() allow you to read a 
+that is, ironically, superior.  FBlkRead() and FBlkWrite() allow you to read a 
 block offset from the start of a file.  Since files are all contiguous, this is 
 incredibly efficient.  You just have to declare the desired file size when you 
-create it with FOpen() and cannot change it.  See ::/Demo/Dsk/DataBase.HC.
+create it with FOpen() and cannot change it.  See ::/Demo/Dsk/DataBase.HC.
 
-If you like, you are encouraged to to do raw BlkRead() and BlkWrite() directly 
-on a drive.  Just get a pointer to a CDrv with Let2Drv() and you are on your 
+If you like, you are encouraged to to do raw BlkRead() and BlkWrite() directly 
+on a drive.  Just get a pointer to a CDrv with Let2Drv() and you are on your 
 way!  Your computer is supposed to be a fun toy!  You can make an entire 
 partition used for a database, or invent a file system.
 
-On the whole, the RedSea file system with its whole-file-only limitation bring 
+On the whole, the RedSea file system with its whole-file-only limitation bring 
 beautiful harmony.  It beautifully captures the spirit of TempleOS with 
 simplicity and, ironic speed, since contiguous is fastest.
 
diff --git a/public/src/Doc/Boot.DD.HTML b/public/Wb/Home/Doc/Boot.DD.HTML
old mode 100644
new mode 100755
similarity index 64%
rename from public/src/Doc/Boot.DD.HTML
rename to public/Wb/Home/Doc/Boot.DD.HTML
index d2591f4..de8e746
--- a/public/src/Doc/Boot.DD.HTML
+++ b/public/Wb/Home/Doc/Boot.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                                   Booting A PC
 
 TempleOS only supports traditional BIOS booting, not the newer technique, UEFI.  
@@ -46,48 +46,48 @@
 This means they usually can't just load the whole operating system and start it 
 running.  Some boot loaders, like Grub, have a capability of switching modes 
 before handing-off control to the operating system.  The operating system must 
-load the rest of itself.  With TempleOS, the ::/Kernel.BIN.C file is loaded by 
-the boot sector.  I try to put a minimum in the Kernel Module, so that it will 
+load the rest of itself.  With TempleOS, the ::/Kernel.BIN.C file is loaded by 
+the boot sector.  I try to put a minimum in the Kernel Module, so that it will 
 always fit in 640K.  When Kernel.BIN runs, it switches to 32-bit mode, then, to 
 64-bit mode allowing access to more memory.  Then, it loads in the rest of 
-TempleOS by executing ::/StartOS.HC.
+TempleOS by executing ::/StartOS.HC.
 
 All the boot related code for TempleOS is in the /Adam/Opt/Boot directory.
 
-BootDVD.HC      CD/DVD boot sector.
-BootDVDIns.HC   Prep for CD/DVD install by creating /0000Boot/0000Kernel.BIN.C.
-If you are curious about CD/DVDs, see DskISORedSea.HC.  To make a custom 
-bootable CD/DVD, look here Bootable CD.
+BootDVD.HC      CD/DVD boot sector.
+BootDVDIns.HC   Prep for CD/DVD install by creating /0000Boot/0000Kernel.BIN.C.
+If you are curious about CD/DVDs, see DskISORedSea.HC.  To make a custom 
+bootable CD/DVD, look here Bootable CD.
 
-BootMHD.HC      Stage 1 Master HD boot loader.
-BootMHD2.HC     Stage 2 Master HD boot loader.
-BootMHDIns.HC   Installs Master HD boot loader.
+BootMHD.HC      Stage 1 Master HD boot loader.
+BootMHD2.HC     Stage 2 Master HD boot loader.
+BootMHDIns.HC   Installs Master HD boot loader.
 BootMHD goes on block zero.  /0000Boot/BootMHD2.BIN.C is stored as a file in a 
 partition, risky and unusual, since most master boot loaders place stage 2 in a 
 gap that's not in any partition.  BootMHD2 displays a menu and boots a 
 partition.
 
-BootHD.HC       HD partition boot record.
-BootHDIns.HC    Installs HD partition boot record.
+BootHD.HC       HD partition boot record.
+BootHDIns.HC    Installs HD partition boot record.
 BootHD is the boot record for a TempleOS partition.  Each partition has its own 
 partition boot record, the first block of the partition.
 
 My boot records don't access directories because that would make them too big 
 for one block and would make them depend on a file system layout.  Instead, they 
 get patched with the LBA, logical block addresses, to load files.  To update 
-with a new TempleOS kernel, you must create a ::/Kernel.BIN.C binary file and 
+with a new TempleOS kernel, you must create a ::/Kernel.BIN.C binary file and 
 patch the boot loader so it knows the LBA blocks to load.  Therefore, you 
 usually recompile the kernel and update the boot sector at the same time with  
-BootHDIns().  BootMHDIns() will install a master boot loader.
+BootHDIns().  BootMHDIns() will install a master boot loader.
 
-With TempleOS, ::/Kernel.BIN.C loads ::/Compiler/Compiler.BIN so it can work 
+With TempleOS, ::/Kernel.BIN.C loads ::/Compiler/Compiler.BIN so it can work 
 with source code from then on.  It compiles start-up scripts beginning with 
-::/StartOS.HC into the Adam Task's memory including the code in the /Adam and /H
+::/StartOS.HC into the Adam Task's memory including the code in the /Adam and /H
 ome directories.
 
 It is possible to do a fast reboot without doing a hardware reset.  You might do 
-this when working on ::/Kernel.BIN.C or your start-up scripts when you want to 
-compile them effect.  See BootRAM().
+this when working on ::/Kernel.BIN.C or your start-up scripts when you want to 
+compile them effect.  See BootRAM().
 
 
 /* Graphics Not Rendered in HTML */
diff --git a/public/src/Doc/CharOverview.DD.HTML b/public/Wb/Home/Doc/CharOverview.DD.HTML
old mode 100644
new mode 100755
similarity index 75%
rename from public/src/Doc/CharOverview.DD.HTML
rename to public/Wb/Home/Doc/CharOverview.DD.HTML
index 6fd4b8a..51e85db
--- a/public/src/Doc/CharOverview.DD.HTML
+++ b/public/Wb/Home/Doc/CharOverview.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                                  Char Overview
 
 A Character is a single byte holding an ASCII code for a letter, num or sym.  
@@ -33,7 +33,7 @@
 
 Standard ASCII values range from 0 to 127.  Values below 32 are ctrl key's.  So, 
 an ASCII #3 is a <CTRL-c>.  TempleOS uses a few nonstandard values below 32.  
-See Char Definitions.
+See Char Definitions.
 
 ASCII #5  is the cursor location in a saved file.
 ASCII #28 is <SHIFT-ESC>.
@@ -45,20 +45,20 @@
 
 A Key is typically specified with a scan code.  TempleOS scan codes contain the 
 key value in the lowest U8, and flags in the upper 3 bytes.  See 
-Scan Code Flags and Scan Codes.
+Scan Code Flags and Scan Codes.
 
 TempleOS stores scan codes in 8 bytes.
   Byte 0   is the code.  NumPad keys, SHIFT, ALT, CTRL and GUI keys combined.
-  Byte 1-3 are flags
+  Byte 1-3 are flags
 
 The upper 4-bytes are copied from lower 4-bytes.
   Byte 4   is the code.  Left, Right and NumPad keys distinct.
-  Byte 5-7 are flags
+  Byte 5-7 are flags
 
-Run the program ::/Demo/MsgLoop.HC to examine scan code.  Press <CTRL-SHIFT-l> 
+Run the program ::/Demo/MsgLoop.HC to examine scan code.  Press <CTRL-SHIFT-l> 
 and "Insert ASCII/ScanCode".
 
-See Key Allocations and CKbdStateGlbls.
+See Key Allocations and CKbdStateGlbls.
 
 A String is a bunch of ASCII characters terminated with a zero.
 
diff --git a/public/src/Doc/Charter.DD.HTML b/public/Wb/Home/Doc/Charter.DD.HTML old mode 100644 new mode 100755 similarity index 96% rename from public/src/Doc/Charter.DD.HTML rename to public/Wb/Home/Doc/Charter.DD.HTML index 8097eed..5d17315 --- a/public/src/Doc/Charter.DD.HTML +++ b/public/Wb/Home/Doc/Charter.DD.HTML @@ -25,7 +25,7 @@ -
+
                                 TempleOS Charter
 
 Why did they make Solomon's Temple?  It was a direction to look, to focus on, a 
@@ -94,9 +94,9 @@
 libraries creates a hell that is no longer blissful.
 
 * The metric for resolving all TempleOS code governance issues is how fast the 
-compiler compiles itself and the kernel with BootHDIns().  The HolyC language 
+compiler compiles itself and the kernel with BootHDIns().  The HolyC language 
 should be changed to optimize this metric, as I did when I changed type casting 
-from prefix standard C to postfix HolyC, but we need a rule to prevent 
+from prefix standard C to postfix HolyC, but we need a rule to prevent 
 degenerating into a brainfuck language.
  
 * Minimal abstraction is a goal.  Sheep are fools.  They always respect a design 
diff --git a/public/src/Doc/CmdLineOverview.DD.HTML b/public/Wb/Home/Doc/CmdLineOverview.DD.HTML
old mode 100644
new mode 100755
similarity index 79%
rename from public/src/Doc/CmdLineOverview.DD.HTML
rename to public/Wb/Home/Doc/CmdLineOverview.DD.HTML
index 3f6e138..8cea25f
--- a/public/src/Doc/CmdLineOverview.DD.HTML
+++ b/public/Wb/Home/Doc/CmdLineOverview.DD.HTML
@@ -25,16 +25,16 @@
 
 
 
-
+
                              Command Line Overview
 
-The cmd line feeds into the HolyC compiler line-by-line as you type.  A stmt 
+The cmd line feeds into the HolyC compiler line-by-line as you type.  A stmt 
 outside a function executes immediately.  Remember to add a semicolon.
 
 Look-up the function headers with AutoComplete by hitting <CTRL-SHIFT-F1> after 
 typing the first few letters.
 
-Click Here to see the directory cmd header.  It accepts default args from C++.
+Click Here to see the directory cmd header.  It accepts default args from C++.
 
 >Dir("*.DD.Z");
 
@@ -47,7 +47,7 @@
 shortcuts for #includeing files.  Right-click or hit <ENTER> on a directory 
 listing or press <F5> while editing.
 
->Ed("NewFile.HC.Z");    Invokes the editor. See Doc Link Type.
+>Ed("NewFile.HC.Z");    Invokes the editor. See Doc Link Type.
 
 Most filenames end in .Z because they are stored compressed.
 
@@ -56,22 +56,22 @@
 
 >Drv('B');      B drive
 
-The drive can be specified in a Cd() command as in:
+The drive can be specified in a Cd() command as in:
 
 >Cd("B:/Tmp");  B drive
 >Cd("::/Demo"); Boot drive
 
 The home directory is specified with a '~'.
 
->Cd("~/Psalmody");      See ::/Home dir.
+>Cd("~/Psalmody");      See ::/Home dir.
 
 If a file is not found, .Z is added or removed and a search is done, again.  If 
 a file is still not found, all parent directories are searched.
 
-You can place macros in your PersonalMenu for Cd() commands.  <CTRL-m> to access 
+You can place macros in your PersonalMenu for Cd() commands.  <CTRL-m> to access 
 your menu.
 
->Find("needle","/Demo/*.HC.Z;*.DD.Z;"); See File Utils.
+>Find("needle","/Demo/*.HC.Z;*.DD.Z;"); See File Utils.
 
 Cmd Line Routines
 
diff --git a/public/src/Home/Doc/Comm.HC b/public/Wb/Home/Doc/Comm.HC
similarity index 100%
rename from public/src/Home/Doc/Comm.HC
rename to public/Wb/Home/Doc/Comm.HC
diff --git a/public/src/Home/Doc/CompilerOverview.DD.HTML b/public/Wb/Home/Doc/CompilerOverview.DD.HTML
similarity index 62%
rename from public/src/Home/Doc/CompilerOverview.DD.HTML
rename to public/Wb/Home/Doc/CompilerOverview.DD.HTML
index e774ecc..9f80bfa 100755
--- a/public/src/Home/Doc/CompilerOverview.DD.HTML
+++ b/public/Wb/Home/Doc/CompilerOverview.DD.HTML
@@ -25,19 +25,19 @@
 
 
 
-
+
                                  Compiler Index
 
-::/Doc/Asm.DD
+::/Doc/Asm.DD
 
-::/Doc/Directives.DD
+::/Doc/Directives.DD
 
-::/Doc/Options.DD
+::/Doc/Options.DD
 
-::/Doc/PreProcessor.DD
+::/Doc/PreProcessor.DD
 
-::/Doc/ScopingLinkage.DD
+::/Doc/ScopingLinkage.DD
 
-See Hello World.
+See Hello World.
 
diff --git a/public/src/Home/Doc/Credits.DD.HTML b/public/Wb/Home/Doc/Credits.DD.HTML similarity index 78% rename from public/src/Home/Doc/Credits.DD.HTML rename to public/Wb/Home/Doc/Credits.DD.HTML index 71b91a2..dde0b82 100755 --- a/public/src/Home/Doc/Credits.DD.HTML +++ b/public/Wb/Home/Doc/Credits.DD.HTML @@ -25,7 +25,7 @@ -
+
                                     Credits
 
 I, Terry A. Davis, wrote all of TempleOS over the past 20.6 years (full-time).  
@@ -36,20 +36,20 @@
 the src code is including on all distro's, from the kernel to the compiler to 
 the boot loaders!  It is public domain, not GPL.
 
-*) ::/Kernel/FontStd.HC, is taken from FreeDOS.  It's public domain.
+*) ::/Kernel/FontStd.HC, is taken from FreeDOS.  It's public domain.
 
-*) ::/Kernel/FontCyrillic.HC, is taken from OrientDisplay without permission.
+*) ::/Kernel/FontCyrillic.HC, is taken from OrientDisplay without permission.
 
-*) ATA Reg and Cmd Definitions are originally from Linux.  Later, I got the 
+*) ATA Reg and Cmd Definitions are originally from Linux.  Later, I got the 
 spec.
 
-*) The heap algorithm, ::/Kernel/Mem/MAllocFree.HC, is adapted from one I saw at 
+*) The heap algorithm, ::/Kernel/Mem/MAllocFree.HC, is adapted from one I saw at 
 Ticketmaster when I worked on their VAX operating system.
 
-*) The LZW compression algorithm, ::/Kernel/Compress.HC, came from a magazine 
+*) The LZW compression algorithm, ::/Kernel/Compress.HC, came from a magazine 
 and I implemented it when I worked for Ticketmaster.
 
-*) The adaptive-step-size-Runge-Kutta algorithm, ::/Adam/AMathODE.HC, is adapted 
+*) The adaptive-step-size-Runge-Kutta algorithm, ::/Adam/AMathODE.HC, is adapted 
 from the book, Numeric Recipies in C.
 
 *) The mountain in some games is from http://www.public-domain-photos.com.  The 
@@ -65,7 +65,7 @@
 *) I included PCIDevice Lst File.
 
 *) Thanks to whoever wrote this CppHtml.HC.Z.  I'm a novice on web stuff and you 
-helped me with html.  See ::/Demo/ToHtmlToTXTDemo/ToHtml.HC.
+helped me with html.  See ::/Demo/ToHtmlToTXTDemo/ToHtml.HC.
 
 *) I looked at bootable CD boot sects, but didn't learn anything, finding it 
 easier to make my own.
@@ -82,13 +82,13 @@
 windows like Windows.  Instead, I made one window per task with no child 
 windows.  He also guided my progress, very obviously.
 
-*) I got Webster's Dictionary and The King James Bible from Project Gutenberg.
+*) I got Webster's Dictionary and The King James Bible from Project Gutenberg.
 
-*) John Carmack inspired me to use "Clamp" as a name instead of "Limit".  He 
+*) John Carmack inspired me to use "Clamp" as a name instead of "Limit".  He 
 inspired me to use "needle" and "haystack" as names.  He inspired me to simplify 
 my Frames-Per-Second code.
 
-*) Bill Gates inspired me to add comments to my Help & Index.
+*) Bill Gates inspired me to add comments to my Help & Index.
 
 *) I hired an artist, Cody Rigby, for $3,000 worth of pixel art.
 
diff --git a/public/src/Doc/Ctrls.DD.HTML b/public/Wb/Home/Doc/Ctrls.DD.HTML
old mode 100644
new mode 100755
similarity index 63%
rename from public/src/Doc/Ctrls.DD.HTML
rename to public/Wb/Home/Doc/Ctrls.DD.HTML
index 1e0a788..9409f49
--- a/public/src/Doc/Ctrls.DD.HTML
+++ b/public/Wb/Home/Doc/Ctrls.DD.HTML
@@ -25,10 +25,10 @@
 
 
 
-
+
 To create a TempleOS graphic ctrl, you define callback functions and insert a 
-CCtrl structure in the CTask queue.  See ::/Demo/Graphics/Slider.HC, 
-::/Demo/Graphics/ScrollBars.HC and TermBttnNew.  There is a template-code ctrl 
+CCtrl structure in the CTask queue.  See ::/Demo/Graphics/Slider.HC, 
+::/Demo/Graphics/ScrollBars.HC and TermBttnNew.  There is a template-code ctrl 
 generator, if you press <CTRL-SHIFT-L>.
 
diff --git a/public/src/Doc/Customize.DD.HTML b/public/Wb/Home/Doc/Customize.DD.HTML old mode 100644 new mode 100755 similarity index 73% rename from public/src/Doc/Customize.DD.HTML rename to public/Wb/Home/Doc/Customize.DD.HTML index 4743a64..87446c1 --- a/public/src/Doc/Customize.DD.HTML +++ b/public/Wb/Home/Doc/Customize.DD.HTML @@ -25,14 +25,14 @@ -
+
 
 * You can adjust the mouse movement rate by setting global vars in your start-up 
-file.  See mouse scale.
+file.  See mouse scale.
 
 * You can set your local time zone by setting the local_time_offset global var 
-in a start-up file.  It's units are CDATE_FREQ.  See local time.
+in a start-up file.  It's units are CDATE_FREQ.  See local time.
 
-* Get rid of this msg here.
+* Get rid of this msg here.
 
diff --git a/public/src/Doc/CutCorners.DD.HTML b/public/Wb/Home/Doc/CutCorners.DD.HTML old mode 100644 new mode 100755 similarity index 75% rename from public/src/Doc/CutCorners.DD.HTML rename to public/Wb/Home/Doc/CutCorners.DD.HTML index cd7d759..4f4f808 --- a/public/src/Doc/CutCorners.DD.HTML +++ b/public/Wb/Home/Doc/CutCorners.DD.HTML @@ -25,7 +25,7 @@ -
+
                                   Cut Corners
 
 There are a few places where I cut corners in the interest of not junking-up 
@@ -35,19 +35,19 @@
 * I made my type-casting operator post-fix because it makes the compiler way 
 cleaner.
 
-* TempleOS does not figure-out FAT32 short name alias numbers.  FAT32DirNew().  
+* TempleOS does not figure-out FAT32 short name alias numbers.  FAT32DirNew().  
 It can cause hard drive corruption, so I might have to do it.  It would really 
 take a lot of junky code for this hatefully, detestable, legacy issue.  "Please 
 don't make me ruin my beautiful shiny-new TempleOS with that!"  I am also not 
 enthused about FAT32 because it is in patent limbo.  FAT32 might get removed 
-from TempleOS.  There is the RedSea  64-bit file system that works perfectly 
+from TempleOS.  There is the RedSea  64-bit file system that works perfectly 
 well.  FAT32 is useful, however, because it assists in transferring between dual 
 booted operating systems.
 
-* I changed the asm opcodes names to remove the ambiguity between insts with 
-different numbers of arguments, making my assembler simpler and I did minimal 
+* I changed the asm opcodes names to remove the ambiguity between insts with 
+different numbers of arguments, making my assembler simpler and I did minimal 
 16-bit asm support, since 64-bit is what you should be using, unless you're 
-doing a boot loader.
+doing a boot loader.
 
 * There are no user-controlled file-sharing locks.  However, the drive and file 
 system have locks and concurrent operations should be fine. 
@@ -61,8 +61,8 @@
 * Even if a local function variable is declared less than 64 bits, the compiler 
 does calculations with 64-bit.
 
-* Print() uses StrPrintJoin().  You cannot use vastly over-sized fields for %f.
+* Print() uses StrPrintJoin().  You cannot use vastly over-sized fields for %f.
 
-* GrEllipse3() is broken on transformations.
+* GrEllipse3() is broken on transformations.
  
diff --git a/public/src/Home/Doc/D3.DD.HTML b/public/Wb/Home/Doc/D3.DD.HTML similarity index 96% rename from public/src/Home/Doc/D3.DD.HTML rename to public/Wb/Home/Doc/D3.DD.HTML index 8e54596..6716a51 100755 --- a/public/src/Home/Doc/D3.DD.HTML +++ b/public/Wb/Home/Doc/D3.DD.HTML @@ -25,7 +25,7 @@ -
+
 TempleOS has a class for 3 dimensional points consisting of F64s.  HolyC is not 
 C++ -- it does not support passing or returning values from functions which are 
 not 64-bits, therefore, it can't be implemented with operator overloading.  
diff --git a/public/src/Home/Doc/Date.DD.HTML b/public/Wb/Home/Doc/Date.DD.HTML
similarity index 94%
rename from public/src/Home/Doc/Date.DD.HTML
rename to public/Wb/Home/Doc/Date.DD.HTML
index 205e55e..a773211 100755
--- a/public/src/Home/Doc/Date.DD.HTML
+++ b/public/Wb/Home/Doc/Date.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
 Dates are 32-bit signed ints representing the number of days since the birth of 
 Christ.  Negative values represent B.C.E. dates.
 
diff --git a/public/src/Doc/DbgFunSeg.DD.HTML b/public/Wb/Home/Doc/DbgFunSeg.DD.HTML old mode 100644 new mode 100755 similarity index 95% rename from public/src/Doc/DbgFunSeg.DD.HTML rename to public/Wb/Home/Doc/DbgFunSeg.DD.HTML index d6f71fb..f7b0857 --- a/public/src/Doc/DbgFunSeg.DD.HTML +++ b/public/Wb/Home/Doc/DbgFunSeg.DD.HTML @@ -25,7 +25,7 @@ -
+
 Use %p to print a pointer with FunSeg+Offset or use %P to print a link to a 
 FunSeg+Offset.
  
diff --git a/public/Wb/Home/Doc/DbgOverview.DD.HTML b/public/Wb/Home/Doc/DbgOverview.DD.HTML new file mode 100755 index 0000000..3b03ccd --- /dev/null +++ b/public/Wb/Home/Doc/DbgOverview.DD.HTML @@ -0,0 +1,101 @@ + + + + + + + + + + +
+                               Debugging Overview
+
+* You can enter the debugger with Dbg() or <CTRL-ALT-d>.  You might enter the 
+debugger through a fault.  Enter G() or G2() to continue execution.  Place a 
+call to Dbg() in your code at fatal error points to enter the debugger.  If you 
+see a stk dump, record the label+offset and unassemble, U(). U(_RIP); 
+
+* U(&FunName+offset) to unassemble mem or Uf("FunName") to unassemble a 
+function. U(_RIP-16);
+
+* While debugging, you specify addresses of assembly routines with just the 
+label, as in _MALLOC+0x20.  You specify HolyC function names with & before 
+functions as in &Print+0x10.
+
+* I use progress1-progress4 for debugging because they show on the wallpaper.  
+They're just global int vars.
+
+* You can use AdamLog() to send text to the Adam Task window.  It works like 
+Print().  I never use that.  Instead, I use RawPrint().
+
+* D(), DocD(), RawD() to do 16 column hex dump mem with numbering from zero.  
+With DocD the values are updated continually and you can alter mem by editing.
+
+* Dm(), DocDm(), RawDm() to do 16 column hex dump mem with addresses showing.
+
+* Da() to do one column address dump (for stk, etc.) with symbolic addresses.
+
+* Dr() dumps regs.  You can display and modify regs in the debugger with 
+var-like labels, _RAX, _RBX, etc.
+
+* ClassRep() and the dynamic version ClassRepD() can be used to dump structures.
+
+* Prof() and ProfRep() provide code profiling.  See ::/Demo/InFile/InProfile.IN 
+(This is an InFile.)
+
+* Use RawPrint() to print debug info bypassing the window framework.  You pass 
+these routines a count in milliseconds for how long it should be displayed.  You 
+can use Raw(TRUE) to make all output bypass the window framework.  The WinMgr 
+runs on Core0 and will overwrite raw text from other cores when it updates the 
+scrn.
+
+* Use SysDbg() to set a flag which you can read with IsSysDbg() when you wish to 
+trigger some debug activity.  It's just a handy simple flag, nothing fancy.
+
+* There are flags for various trace options that can help debugging when there 
+are compiler bugs.  Often, you place them in #exe{} blocks.
+  
+  Echo() turns on or off raw data going into the lexical analyzer.
+  
+  Trace() unassembles code generated from the HolyC compiler.
+  
+  PassTrace() shows intermediate code coming-out after optimization.  The bits 
+  ctrl which passes are displayed.
+
+
+* There is a heap check utility which can find leaks.  Use HeapLog(), 
+HeapLogAddrRep() and HeapLogSizeRep().  It's a really simple program which 
+intercepts MAlloc() and Free().  You can customize the code to find other heap 
+issues.
+
+* You can define hndlr functions for <CTRL-ALT-letter> keys with CtrlAltCBSet(). 
+ They operate either in a interrupt environment or in the window mgr when it 
+queues kbd msgs.  You can do Raw() output.  <CTRL-ALT-letter> hndlrs take a 
+scan_code as an arg.
+
+* If you recompile Kernel with BootHDIns(), you can set the MemInit, option to 
+initialize memory to a value at boot, the HeapInit option to cause mem alloced 
+off the heap to be initialized or VarInit option so both global and local vars 
+will be initialized to a value, but global AOT variables are always zero if not 
+initialized.  Pick a non-zero value to discover uninitialized var bugs.  You can 
+set sys_var_init_flag, and sys_heap_init_flag directly after booting.
+
+ diff --git a/public/src/Home/Doc/Define.DD.HTML b/public/Wb/Home/Doc/Define.DD.HTML similarity index 63% rename from public/src/Home/Doc/Define.DD.HTML rename to public/Wb/Home/Doc/Define.DD.HTML index f7baa2e..710b483 100755 --- a/public/src/Home/Doc/Define.DD.HTML +++ b/public/Wb/Home/Doc/Define.DD.HTML @@ -25,11 +25,11 @@ -
+
 TempleOS has a string indirection feature implemented with the same hash symbol 
-table entry as #define macros, HTT_DEFINE_STR.  Support for string lists is also 
+table entry as #define macros, HTT_DEFINE_STR.  Support for string lists is also 
 provided, but it's not very efficient, though, you can make a hash table with a 
-list using HashDefineLstAdd().  See ::/Adam/DolDoc/DocInit.HC.
+list using HashDefineLstAdd().  See ::/Adam/DolDoc/DocInit.HC.
 
 If you have an @ as the first char of a define list entry, it is an alias for 
 the prev entry num.
@@ -37,10 +37,10 @@
 Each task can load its own Define strings.  Remember, when a Hash table is 
 searched for a string, if it is not found, the parent task's table is searched.
 
-The DolDoc framework supports text that changes based on entries in the task's 
+The DolDoc framework supports text that changes based on entries in the task's 
 symbol table.  Set a text entry with a D= arg, as in $TX,"",D="DD_MYSTRING"$.  
-See ::/Demo/DolDoc/DefineStr.HC, ::/Adam/ADefine.HC and ::/Doc/MemOverview.DD.
+See ::/Demo/DolDoc/DefineStr.HC, ::/Adam/ADefine.HC and ::/Doc/MemOverview.DD.
 
-See ::/Demo/Define.HC.
+See ::/Demo/Define.HC.
 
diff --git a/public/src/Doc/Demands.DD.HTML b/public/Wb/Home/Doc/Demands.DD.HTML old mode 100644 new mode 100755 similarity index 77% rename from public/src/Doc/Demands.DD.HTML rename to public/Wb/Home/Doc/Demands.DD.HTML index 49e5e9b..6e32882 --- a/public/src/Doc/Demands.DD.HTML +++ b/public/Wb/Home/Doc/Demands.DD.HTML @@ -25,7 +25,7 @@ -
+
                                     Demands
 
 I, Terry Davis, am high priest of God's official third temple, TempleOS.  
@@ -40,16 +40,16 @@
 
 
 
-* Windows, Linux and VMware (because of mounted drives) must support RedSea file 
+* Windows, Linux and VMware (because of mounted drives) must support RedSea file 
 system when mounting partition, so I can get rid of 1,000 lines of redundant, 
 blemished code -- FAT32.  God's temple must be perfect.  Redundant code for 
 multiple file systems is bad and imperfect.  For this operating system, we want 
 low line count.  More than one driver for the same type of device is also bad.
 
-See ::/Kernel/BlkDev/FileSysRedSea.HC and ::/Adam/Opt/Boot/DskISORedSea.HC.
+See ::/Kernel/BlkDev/FileSysRedSea.HC and ::/Adam/Opt/Boot/DskISORedSea.HC.
 
-::/Kernel/BlkDev/FileSysFAT.HC  :974 lines for FAT32 gets eliminated.
-::/Kernel/BlkDev/DskClus.HC     :152 All the clus operations become blk.
+::/Kernel/BlkDev/FileSysFAT.HC  :974 lines for FAT32 gets eliminated.
+::/Kernel/BlkDev/DskClus.HC     :152 All the clus operations become blk.
 
 * Microsoft must cancel SecureBoot because it makes dual booting impossible.  
 TempleOS is an additional operating system that must be used along-side Windows 
@@ -82,8 +82,8 @@
 secondary master 170/376.  Currently, the wicked CIA plays musical chairs with 
 controllers each time you make an install.  With tons of ugly code, I do my 
 best.
-/Kernel/BlkDev/DskATAId.HC      :286 lines to figure-out I/O ports is gone.
-/Kernel/PCIBIOS.HC              :290 could be eliminated, but maybe we will keep 
+/Kernel/BlkDev/DskATAId.HC      :286 lines to figure-out I/O ports is gone.
+/Kernel/PCIBIOS.HC              :290 could be eliminated, but maybe we will keep 
 it so people can play with PCI devices.
 
 * Until super-simple serial ports are available, PS/2 emulated keyboard and 
@@ -92,13 +92,13 @@
 devices in the same way PS/2 mouse is emulated.  All mice will be two button, 
 one wheel.  No more HID insanity, no more multi-end point, just simple tx rx 
 fifos with soft/hard flowcontrol that can jump the queue.  People with special 
-needs can buy PCI cards.  Our kids deserve code this simple ::/Doc/Comm.HC.  The 
+needs can buy PCI cards.  Our kids deserve code this simple ::/Doc/Comm.HC.  The 
 right to do your own port banging is what the C64 being our God given ancestral 
 land means.
 
 * The x86 IN/OUT port instructions, normally have a delay.  Perhaps, VMware & 
 Intel can enable faster x86 IN/OUT instruction timing for ATA/ATAPI PIO, so 
-bandwidth isn't as bad when doing port I/O.  See ATAGetRes().  We don't want to 
+bandwidth isn't as bad when doing port I/O.  See ATAGetRes().  We don't want to 
 do DMA.  Perhaps, x86 CPU chips need a new TempleOS mode for fast IN/OUT 
 instructions?  I think VMware already does something to speed disk I/O to faster 
 than native speed.
@@ -110,7 +110,7 @@
 
 * Since I don't use paging (for anything), Intel should have an option for  
 no-paging long mode, and optimize it!
-::/Kernel/Mem/PageTables.HC     :135 lines to identity-map gets eliminated.
+::/Kernel/Mem/PageTables.HC     :135 lines to identity-map gets eliminated.
 
 * Desktop computers must have a reset switch and a fast reboot option, skipping 
 diagnostics.  I recommend booting TempleOS from a ROM when the reset bttn is 
@@ -119,28 +119,28 @@
 for all desktop x86 CPUs to ensure tamper-proof trust in the oracle and because 
 God deserves the glory.  There will be just an English version.  A new ROM 
 version is released every seven years.  The ROM should boot like the DVD boots, 
-but with BOOT_SRC_ROM.
+but with BOOT_SRC_ROM.
 
 * We do not want UTF, just 8-bit characters.  <CTRL-ALT-f> toggles between 
-Cyrillic and Std Fonts.  We need the twelve window TextBorder characters added 
+Cyrillic and Std Fonts.  We need the twelve window TextBorder characters added 
 to the VGA font 0x02-0x0D.  Japan, China and Korea must switch to alphabets.  
 Maybe, the United States will change to metric, out of good will.  I am 
-beginning to plan fresh ASCII replacement, ::/Doc/NewASCII.DD.
+beginning to plan fresh ASCII replacement, ::/Doc/NewASCII.DD.
 
-* Microsoft Paint and Linux's Gimp must support TempleOS GR Files.  They are 
+* Microsoft Paint and Linux's Gimp must support TempleOS GR Files.  They are 
 blemish free, unlike BMP files.  The TOSZ Linux utility can be used to make 
-screencasts from TempleOS exported GR Files and AU Files.
+screencasts from TempleOS exported GR Files and AU Files.
 
-* We must have a nice dictionary.  Someone needs to do a Spell Checker, too.
+* We must have a nice dictionary.  Someone needs to do a Spell Checker, too.
 
-* Intel needs to make DolDoc versions of its x86 CPU data sheets documenting all 
+* Intel needs to make DolDoc versions of its x86 CPU data sheets documenting all 
 hardware relevant to TempleOS. 
 
 * We must have the ultimate Bible search engine.  Currently, all we have is     
 filter search.  In the end, it should be a low line-count technique.  Maybe, I 
 allocate 500 lines out of the 20,000 reserve.
 
-* We will make a Standard TempleOS PC.
+* We will make a Standard TempleOS PC.
 
 * "VMware" is a trademark owned by VMware, Inc.
 * "Linux" is a trademark owned by Linus Torvalds.
diff --git a/public/src/Home/Doc/DemoIndex.DD.HTML b/public/Wb/Home/Doc/DemoIndex.DD.HTML
similarity index 90%
rename from public/src/Home/Doc/DemoIndex.DD.HTML
rename to public/Wb/Home/Doc/DemoIndex.DD.HTML
index 93dbccb..9415e8b 100755
--- a/public/src/Home/Doc/DemoIndex.DD.HTML
+++ b/public/Wb/Home/Doc/DemoIndex.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                               TempleOS Demo Index
 
 These are arranged in increasing order of difficulty, more or less.  This can be 
@@ -33,7 +33,7 @@
 
 <SPACE> to edit a file and <F5> to run it.
 
-::/Doc/HelloWorld.DD
+::/Doc/HelloWorld.DD
 
 +] Games: Beginner
 +] Games: Intermediate
diff --git a/public/src/Doc/Directives.DD.HTML b/public/Wb/Home/Doc/Directives.DD.HTML
old mode 100644
new mode 100755
similarity index 94%
rename from public/src/Doc/Directives.DD.HTML
rename to public/Wb/Home/Doc/Directives.DD.HTML
index 90828dd..ccefd24
--- a/public/src/Doc/Directives.DD.HTML
+++ b/public/Wb/Home/Doc/Directives.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
 #define __DATE__ #exe{StreamPrint("\"%D\"",Now);}
 #define __TIME__ #exe{StreamPrint("\"%T\"",Now);}
 #define __LINE__ #exe{StreamPrint("%d",Fs->last_cc->lex_include_stk->line_num);}
@@ -33,6 +33,6 @@
 #define __FILE__ #exe{StreamPrint("\"%s\"",Fs->last_cc->lex_include_stk->full_name);}
 #define __DIR__  #exe{StreamDir;}
 
-See ::/Demo/Directives.HC.
+See ::/Demo/Directives.HC.
 
diff --git a/public/src/Doc/DolDoc.DD.HTML b/public/Wb/Home/Doc/DolDoc.DD.HTML old mode 100644 new mode 100755 similarity index 58% rename from public/src/Doc/DolDoc.DD.HTML rename to public/Wb/Home/Doc/DolDoc.DD.HTML index 6c375d5..4962ef2 --- a/public/src/Doc/DolDoc.DD.HTML +++ b/public/Wb/Home/Doc/DolDoc.DD.HTML @@ -25,10 +25,10 @@ -
-A DolDoc in memory is a Circular Queue of cmds and graphics.  See CDocEntry for 
-the entry structure.  See TipOfDay() for a nice example.
+
+A DolDoc in memory is a Circular Queue of cmds and graphics.  See CDocEntry for 
+the entry structure.  See TipOfDay() for a nice example.
 
-DolDoc's are used for the editor, viewer, browser, and cmd line.
+DolDoc's are used for the editor, viewer, browser, and cmd line.
 
diff --git a/public/src/Doc/DolDocOverview.DD.HTML b/public/Wb/Home/Doc/DolDocOverview.DD.HTML old mode 100644 new mode 100755 similarity index 69% rename from public/src/Doc/DolDocOverview.DD.HTML rename to public/Wb/Home/Doc/DolDocOverview.DD.HTML index 71944d3..90f9a62 --- a/public/src/Doc/DolDocOverview.DD.HTML +++ b/public/Wb/Home/Doc/DolDocOverview.DD.HTML @@ -26,7 +26,7 @@ -
+
                                 DolDoc Overview
 
 DolDoc is a TempleOS document type supported by DolDoc Routines.  In a document, 
@@ -35,22 +35,22 @@
 
 Here is the grammar:
 
-<DolDocCmd> := $<TwoLetterCmd>[<FlagList>][,<ArgList>]$ | $ColorName$
+<DolDocCmd> := $<TwoLetterCmd>[<FlagList>][,<ArgList>]$ | $ColorName$
 
-<FlagList> := +|- <FlagCode>[<FlagList>]
+<FlagList> := +|- <FlagCode>[<FlagList>]
 
-<ArgList> := <ArgCode>=<ArgExpression>[,<ArgList>]
+<ArgList> := <ArgCode>=<ArgExpression>[,<ArgList>]
 
 
 The format of DolDoc cmds is a two character code, +/-flags, a comma and args 
 separated by commas.  Some commands have mandatory args.  Optional args are 
-indicated with <ArgCode>=.  A ColorName bracked by dollars, will change the 
+indicated with <ArgCode>=.  A ColorName bracked by dollars, will change the 
 foreground color.
 
-See ::/Doc/Widget.DD, ::/Demo/DolDoc/DemoDoc.DD, and 
-::/Demo/ToHtmlToTXTDemo/ToHtml.HC.
+See ::/Doc/Widget.DD, ::/Demo/DolDoc/DemoDoc.DD, and 
+::/Demo/ToHtmlToTXTDemo/ToHtml.HC.
 
-<TwoLetterCmd>  See Type Defines and PrsDollarCmd().
+<TwoLetterCmd>  See Type Defines and PrsDollarCmd().
 +] TX Text
 +] CR Hard New Line
 +] SR Soft New Line
@@ -91,7 +91,7 @@
 +] HC html
 +] ER Error
 
-<FlagCode>  See Flag Defines and Simple Flags.
+<FlagCode>  See Flag Defines and Simple Flags.
 +] +H Hold
 +] +L Link
 +] +TR Tree
@@ -107,7 +107,7 @@
 +] +LC Left CallBack
 +] +RC Right CallBack
 
-<ArgCode>  See Arg Defines.
+<ArgCode>  See Arg Defines.
 +] T="" Tag Str
 +] LEN="" Field Length
 +] A="" Auxilliary Str
diff --git a/public/src/Doc/EdPullDown.DD.HTML b/public/Wb/Home/Doc/EdPullDown.DD.HTML
old mode 100644
new mode 100755
similarity index 98%
rename from public/src/Doc/EdPullDown.DD.HTML
rename to public/Wb/Home/Doc/EdPullDown.DD.HTML
index 62b6ddb..7d12cd0
--- a/public/src/Doc/EdPullDown.DD.HTML
+++ b/public/Wb/Home/Doc/EdPullDown.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
 File
 {
   Save(,CH_CTRLS);
diff --git a/public/src/Doc/FAQ.DD.HTML b/public/Wb/Home/Doc/FAQ.DD.HTML
old mode 100644
new mode 100755
similarity index 98%
rename from public/src/Doc/FAQ.DD.HTML
rename to public/Wb/Home/Doc/FAQ.DD.HTML
index d4de69c..68f3b90
--- a/public/src/Doc/FAQ.DD.HTML
+++ b/public/Wb/Home/Doc/FAQ.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                            Frequently Asked Questions
 
 +] How come it is public domain, not GPL?
diff --git a/public/src/Doc/Features.DD.HTML b/public/Wb/Home/Doc/Features.DD.HTML
old mode 100644
new mode 100755
similarity index 78%
rename from public/src/Doc/Features.DD.HTML
rename to public/Wb/Home/Doc/Features.DD.HTML
index f99d376..6030f81
--- a/public/src/Doc/Features.DD.HTML
+++ b/public/Wb/Home/Doc/Features.DD.HTML
@@ -25,10 +25,10 @@
 
 
 
-
+
                                TempleOS' Features
 
-* Oracle in with <F7> for words or <SHIFT-F7> for passages.  See tongues.
+* Oracle in with <F7> for words or <SHIFT-F7> for passages.  See tongues.
 
 * x86_64, ring-0-only, single-address-map (identity), multitasking kernel with 
 multicore support.
@@ -37,7 +37,7 @@
 
 * Free, public domain, 100% open source.
 
-* 64-bit compiler/assembler for HolyC.  Truly compiles, doesn't interpret.  Just
+* 64-bit compiler/assembler for HolyC.  Truly compiles, doesn't interpret.  Just
 -in-Time and Ahead-of-Time compilation.  With JIT, no need for object or exe 
 files.
 
@@ -47,15 +47,15 @@
 
 * Keyboard & Mouse support.
 
-* ATA PIO Hard drives, support for FAT32 and RedSea file systems with file 
+* ATA PIO Hard drives, support for FAT32 and RedSea file systems with file 
 compression.
 
 * ATAPI PIO CD/DVD support with RedSea file system.  Can make bootable ISO files 
 so you can roll-your-own distro's.
 
-* Partitioning tool, installer, boot loaders for CD/DVD and hard disk.
+* Partitioning tool, installer, boot loaders for CD/DVD and hard disk.
 
-* Editor/Browser for a new Document Format.  Source files and the command line 
+* Editor/Browser for a new Document Format.  Source files and the command line 
 window can have graphics, links, icons, trees, colors, super/sub scripts, 
 margins.  Everything is seamless through-out the tool chain.  No need for 
 separate resource files.
@@ -83,13 +83,13 @@
 
 * File Manager, <CTRL-d>.
 
-* Code profiler, merge, diff utils.
+* Code profiler, merge, diff utils.
 
 * PC Speaker support with many hymns.
 
 * Music composing tool.
 
-* Many games, demos and documentation.
+* Many games, demos and documentation.
 
 * All source code included.  Only compiles with the included TempleOS compiler 
 and assembler.
diff --git a/public/src/Doc/FileLowLevel.DD.HTML b/public/Wb/Home/Doc/FileLowLevel.DD.HTML
old mode 100644
new mode 100755
similarity index 83%
rename from public/src/Doc/FileLowLevel.DD.HTML
rename to public/Wb/Home/Doc/FileLowLevel.DD.HTML
index 6e06c43..e096ecc
--- a/public/src/Doc/FileLowLevel.DD.HTML
+++ b/public/Wb/Home/Doc/FileLowLevel.DD.HTML
@@ -26,7 +26,7 @@
 
 
 
-
+
 /* Graphics Not Rendered in HTML */
 
                        CFile
@@ -37,7 +37,7 @@
 
 
 
-    BlkRead()         BlkWrite()
+    BlkRead()         BlkWrite()
 
 
 
diff --git a/public/src/Home/Doc/FileMgr.DD.HTML b/public/Wb/Home/Doc/FileMgr.DD.HTML
similarity index 79%
rename from public/src/Home/Doc/FileMgr.DD.HTML
rename to public/Wb/Home/Doc/FileMgr.DD.HTML
index dc3a339..a452251 100755
--- a/public/src/Home/Doc/FileMgr.DD.HTML
+++ b/public/Wb/Home/Doc/FileMgr.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                                   File Manager
 
 <SHIFT CURSOR>
@@ -77,30 +77,30 @@
   Unmount drive(s).
 
 'm'
-  Make CD/DVD ISO.C file.  This creates a RedSea ISO file image of the dir the 
+  Make CD/DVD ISO.C file.  This creates a RedSea ISO file image of the dir the 
   cursor is on.  The name of the ISO file is "::/Tmp/CDDVD.ISO.C" 
-  blkdev.dft_iso_c_filename and can be redefined in your start-up scripts.  You 
+  blkdev.dft_iso_c_filename and can be redefined in your start-up scripts.  You 
   may wish to place it on a different drive.
 
 'B'
   Burn CD/DVD ISO file.  This burns a CD/DVD using the image file, 
-  "::/Tmp/CDDVD.ISO" blkdev.dft_iso_filename to the drive the cursor is on.
+  "::/Tmp/CDDVD.ISO" blkdev.dft_iso_filename to the drive the cursor is on.
 
 
 Instructions on Using CD/DVD's
   If you have not recompiled Kernel and defined your CD/DVD drive, exit the 
-  FileMgr and use Mount to define your CD/DVD drive.  Place a CD/DVD in the 
+  FileMgr and use Mount to define your CD/DVD drive.  Place a CD/DVD in the 
   drive and press 'c' when on top of the CD/DVD drive letter to mount the drive. 
-   It will call DskChg(), the TempleOS cmd to mount removable media.
+   It will call DskChg(), the TempleOS cmd to mount removable media.
 
 
 Instructions on Burning CD/DVD's
   Create a temporary dir to hold files and copy files into the holding dir.  
   Make an ISO image of the dir by pressing 'M' when on top of the dir.  Press 'B
   ' when on top of the CD/DVD ROM drive to burn the ISO, "::/Tmp/CDDVD.ISO" 
-  blkdev.dft_iso_filename, to disk.  If you have not recompiled Kernel and 
-  defined your CD/DVD drive, exit the FileMgr and use Mount.
+  blkdev.dft_iso_filename, to disk.  If you have not recompiled Kernel and 
+  defined your CD/DVD drive, exit the FileMgr and use Mount.
   
-  Making Your Own Distro
+  Making Your Own Distro
   
diff --git a/public/src/Home/Doc/FileMgrPullDown.DD.HTML b/public/Wb/Home/Doc/FileMgrPullDown.DD.HTML similarity index 96% rename from public/src/Home/Doc/FileMgrPullDown.DD.HTML rename to public/Wb/Home/Doc/FileMgrPullDown.DD.HTML index 896d539..3fa7213 100755 --- a/public/src/Home/Doc/FileMgrPullDown.DD.HTML +++ b/public/Wb/Home/Doc/FileMgrPullDown.DD.HTML @@ -25,7 +25,7 @@ -
+
 File
 {
   Rename(,'r');
diff --git a/public/Wb/Home/Doc/FileUtils.DD.HTML b/public/Wb/Home/Doc/FileUtils.DD.HTML
new file mode 100755
index 0000000..4c10cf9
--- /dev/null
+++ b/public/Wb/Home/Doc/FileUtils.DD.HTML
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+                                   File Utils
+
+File util FilesFind() wildcard mask consists of a single base dir with multiple 
+file masks separated by ';'.  The '*' and '?' wildcard chars are accepted.  The 
+'~' is your home directory and '!' indicates an exclusion mask.
+
+ 
+"/Kernel/*"             BaseDir: /Kernel        Mask: *
+"/Demo/*.BMP*;*.GR*"    BaseDir: /Demo          Mask: *.BMP* | *.GR*
+"/*.DD*;!*/Bible*"      BaseDir: Root           Mask: *.DD* but not */Bible*
+
+See FilesFindMatch().
+
+Flags are either text or int values.
+
+  FUF_RECURSE           +r Recurse
+  FUF_SINGLE            +s Single File (Optimization for one file in mask.)
+  FUF_FLATTEN_TREE      +f use with '+F'.  Just use +F, probably.
+  FUF_JUST_DIRS         +D just directories
+  FUF_JUST_FILES        +F just files (Flattens trees)
+  FUF_CLUS_ORDER        +O sort by clus (move head one direction)
+  FUF_JUST_TXT          +T just text files      : FILEMASK_TXT
+  FUF_JUST_DD           +$ just DolDoc files    : FILEMASK_DD
+  FUF_JUST_SRC          +S just src files       : FILEMASK_SRC
+  FUF_JUST_AOT          +A just aot files       : FILEMASK_AOT
+  FUF_JUST_JIT          +J just jit files       : FILEMASK_JIT
+  FUF_JUST_GR           +G just graphic files   : FILEMASK_GR
+
+See ST_FILE_UTIL_FLAGS when used in calling program taking text flags.
+
+ diff --git a/public/src/Doc/Frame.DD.HTML b/public/Wb/Home/Doc/Frame.DD.HTML old mode 100644 new mode 100755 similarity index 75% rename from public/src/Doc/Frame.DD.HTML rename to public/Wb/Home/Doc/Frame.DD.HTML index 7565176..a62c722 --- a/public/src/Doc/Frame.DD.HTML +++ b/public/Wb/Home/Doc/Frame.DD.HTML @@ -25,8 +25,8 @@ -
+
 If you require separate global vars for multiple instances of a routine, you can 
-use Frames.  See SpriteMeshEd(), ::/Demo/Graphics/Pick3D.HC or Noise().
+use Frames.  See SpriteMeshEd(), ::/Demo/Graphics/Pick3D.HC or Noise().
 
diff --git a/public/src/Doc/GRFiles.DD.HTML b/public/Wb/Home/Doc/GRFiles.DD.HTML old mode 100644 new mode 100755 similarity index 90% rename from public/src/Doc/GRFiles.DD.HTML rename to public/Wb/Home/Doc/GRFiles.DD.HTML index b824269..65cdd18 --- a/public/src/Doc/GRFiles.DD.HTML +++ b/public/Wb/Home/Doc/GRFiles.DD.HTML @@ -25,7 +25,7 @@ -
+
 GR graphics files are 8-bits-per-pixels but only 4-bits of color, with 
 transparency and no palette.  Compression is the standard TempleOS LZW 
 compression.
@@ -67,11 +67,11 @@
   I32   width;
   I32   width_internal; //Rounded-up to multiple of 8.
   I32   height;
-  I32   flags;          //DCF_COMPRESSED? See ::/Kernel/Compress.HC.
+  I32   flags;          //DCF_COMPRESSED? See ::/Kernel/Compress.HC.
   CBGR48 palette[16];   //Included if DCF_PALETTE.
   U8    body[];
 };
 
-See DCSave(), GRWrite(), DCLoad(), and GRRead().
+See DCSave(), GRWrite(), DCLoad(), and GRRead().
 
diff --git a/public/src/Doc/Glossary.DD.HTML b/public/Wb/Home/Doc/Glossary.DD.HTML old mode 100644 new mode 100755 similarity index 80% rename from public/src/Doc/Glossary.DD.HTML rename to public/Wb/Home/Doc/Glossary.DD.HTML index e7d61b9..3e0ff47 --- a/public/src/Doc/Glossary.DD.HTML +++ b/public/Wb/Home/Doc/Glossary.DD.HTML @@ -25,7 +25,7 @@ -
+
                                     Glossery
 
 +] Abbreviations
@@ -42,14 +42,14 @@
 
 Bt, Bts, Btr, Btc, BEqu
 Define
-DolDoc
-Editor Link Types
-files_find_mask
+DolDoc
+Editor Link Types
+files_find_mask
 Hash Table
 InFile
 Ona
 Pag
-RedSea File System
+RedSea File System
 Sprite
 
 +] CLI, STI, PUSHFD, POPFD
diff --git a/public/src/Home/Doc/God.DD.HTML b/public/Wb/Home/Doc/God.DD.HTML
similarity index 82%
rename from public/src/Home/Doc/God.DD.HTML
rename to public/Wb/Home/Doc/God.DD.HTML
index 9ff1f99..ac66234 100755
--- a/public/src/Home/Doc/God.DD.HTML
+++ b/public/Wb/Home/Doc/God.DD.HTML
@@ -25,8 +25,8 @@
 
 
 
-
-The Holy Spirit can puppet you.
+
+The Holy Spirit can puppet you.
 
 
diff --git a/public/Wb/Home/Doc/GraphicsOverview.DD.HTML b/public/Wb/Home/Doc/GraphicsOverview.DD.HTML new file mode 100755 index 0000000..357c77b --- /dev/null +++ b/public/Wb/Home/Doc/GraphicsOverview.DD.HTML @@ -0,0 +1,147 @@ + + + + + + + + + + +
+                               Graphics Overview
+
+Dive into Demo Index to learn.
+
+The order layers are drawn on top of each other is:
+
+
+
+
+
+
+
+
+
+
+
+/* Graphics Not Rendered in HTML */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+* See GrUpdateScrn(), GrUpdateTasks() and GrUpdateTaskWin() called by the WinMgr 
+task 30fps.  Notice the task's draw_it() callback being called.  Only tasks on C
+ore0 are allowed to have windows.  There is one window per task, no child 
+windows.  You can have pop-up child tasks.
+
+* CDCs (device contexts) are a data type for controlling graphics on the scrn or 
+graphics in mem.  The device context structure has thick and color.  You use 
+DCAlias() to create your own structure, with its own color and thick.  Free it 
+with DCDel() when finished.
+
+* gr.dc is a device context for persistent data on the scrn, not needing to be 
+redrawn.  You create an alias for this by using DCAlias() and work with that.  
+See ::/Demo/Graphics/NetOfDots.HC.
+
+* There are various flavors of line and point plotting routines.  GrLine() and 
+GrPlot() are the simplest.  The others allow 3D graphics and rotations.
+
+* See ::/Doc/Transform.DD for adding a transformation.
+
+* You change the Fs->draw_it var to point to your DrawIt() function which gets 
+called each scrn refresh (30 fps).  You draw everything in the window over and 
+over again.  See ::/Demo/Graphics/Box.HC.
+
+* Use the graphic sprite resource editor, <CTRL-r>, to create a sprite that can 
+be plotted with Sprite3() or output to the cmd line with Sprite().  Use $IB,"",B
+I=1$ in a src program to insert the addr of sprite binary data item #1.  To 
+learn how the numbers work, after creating a sprite with <CTRL-r>, toggle to 
+plain text with <CTRL-t> and check its num.  Make an assignment to a ptr var or 
+pass to Sprite3() with $IB,"",BI=n$.  Use <CTRL-r>'s "Pointer to Sprite" to make 
+a $IB...$ entry.  See ::/Demo/Graphics/SpritePlot.HC and 
+::/Demo/Graphics/SpritePlot3D.HC.  The origin (zero point) for a sprite is 
+defined by the cursor location when you pressed <CTRL-r> to make it.  You can 
+edit a sprite by clicking the cursor on it and pressing <CTRL-r> again.
+
+* Set DCF_SYMMETRY in the CDC.flags and call DCSymmetrySet() or DCSymmetry3Set()
+.  This will plot a mirror image in addition to the primary image.  Set 
+DCF_JUST_MIRROR to plot just the image, but this required DCF_SYMMETRY to be set 
+at the same time.  Note: You can only have one symmetry active at a time 
+including in CSprites.
+
+* Use DCNew() to create a mem bitmap which can be used to work off-scrn and 
+which can be GrBloted onto the scrn.  If you set brush member of CDC to another 
+CDC, all the graphic routines will GrBlot() the brush instead of GrPlot().  See 
+::/Demo/Graphics/Blot.HC.
+
+* There are a few raster operations available.  They go in bits 8-11 of the dc->
+color member var which is a CColorROPU32.  ROP_COLLISION is special.  It counts 
+the num of pixs drawn on non-background locations.  Using ROP_COLLISION with 
+vector CSprite's is tricky because overlapping pixs from lines in the CSprite 
+reg as collisions.  You can either work with a nonzero count or convert your 
+CSprite to a bitmap if your subelements draw on top of each other.  Be sure to 
+set ->bkcolor before using ROP_COLLISION.  See ::/Demo/Graphics/Collision.HC and 
+Titanium.
+ 
+* The ->dither_probability_u16 member of CDC is a U16 used to statistically sel 
+between two colors to get something resembling more shades of color.  See 
+::/Demo/Graphics/SunMoon.HC and ::/Demo/Graphics/Shading.HC.  It works with many 
+graphic routines, but not those with pens.
+
+* There is a mechanism built-in for generating motion based on differential 
+equations, which allows realistic physics.  You create an CMathODE struct with 
+ODENew(), passing it the num of vars in the state vect.  For realistic physics, 
+you usually have 2 state vars for each dimension (for each mass) because motion 
+is governed by F=mA which is a 2nd order equation.  The two states are pos and 
+velocity and to solve these you need to supply the derivative of pos and 
+velocity.  The derivative of pos is usually simply the current velocity and the 
+derivative of velocity is the acceleration (the sum of forces on a mass divided 
+by mass).  To help provide meaningful names for values in the state vect, you 
+can create an COrder2D3 ptr and point it to a mass in the state vect.  Six 
+elements in the state vect are required for each mass.
+
+See Math/CMathODE.
+See ::/Demo/Games/Rocket.HC.
+
+ diff --git a/public/src/Home/Doc/GuideLines.DD.HTML b/public/Wb/Home/Doc/GuideLines.DD.HTML similarity index 67% rename from public/src/Home/Doc/GuideLines.DD.HTML rename to public/Wb/Home/Doc/GuideLines.DD.HTML index f6d32c9..f85c42f 100755 --- a/public/src/Home/Doc/GuideLines.DD.HTML +++ b/public/Wb/Home/Doc/GuideLines.DD.HTML @@ -25,7 +25,7 @@ -
+
                               Directory Structure
 
 /Home All your user data should be placed in here to ease backing-up your data.  
@@ -45,19 +45,19 @@
 
 /Kernel The core of the operating system is found here.  Since priviledge levels 
 are not used, calling it a kernel is deceptive.  It is AOT compiled by 
-BootHDIns().  It is loaded by the boot loader and must fit in 640K.
+BootHDIns().  It is loaded by the boot loader and must fit in 640K.
 
 /Compiler The compiler module src code is found here.  The compiler is AOT 
 compiled to produce a binary file which is loaded at boot.  It, too, is AOT 
-compiled by BootHDIns().
+compiled by BootHDIns().
 
 /Adam The non-kernel part of the operating system is found here.  It is JIT 
-compiled during boot.  The Adam Task is the father of all tasks, like Adam and 
+compiled during boot.  The Adam Task is the father of all tasks, like Adam and 
 Eve.
 
 /0000Boot Boot files go here.  Stage 2 of the TempleOS hard drive master boot 
 loader, the old hard drive master boot record which is just blk#0, and the 
-CD/DVD 0000Kernel.BIN.C file go here.  ASCII 0000 is near the top, 
+CD/DVD 0000Kernel.BIN.C file go here.  ASCII 0000 is near the top, 
 alphabetically, in case you use MagicISO.
 
 
@@ -65,22 +65,22 @@
                                  ::/Home Files
 
 The home dir is specified with '~'.  The home dir is ::/Home unless you change 
-it with HomeSet() or compile the kernel with a cfg option.  An empty /Home dir 
+it with HomeSet() or compile the kernel with a cfg option.  An empty /Home dir 
 should be valid because it will get default files from the root dir. 
 
-~/PersonalMenu.DD a menu viewed with the <CTRL-m> key or by clicking "MENU" in 
+~/PersonalMenu.DD a menu viewed with the <CTRL-m> key or by clicking "MENU" in 
 the upper left border area of a window.
 
-~/PersonalNotes.DD a personal note file viewed with the <CTRL-SHIFT-M> key.
+~/PersonalNotes.DD a personal note file viewed with the <CTRL-SHIFT-M> key.
 
-~/MakeHome.HC a file compiled by the Adam Task during StartOS.
+~/MakeHome.HC a file compiled by the Adam Task during StartOS.
 
 ~/Home* Copy Home* files from the root into ~ and customize them.  These files 
-are invoked when the Adam Task starts-up.
+are invoked when the Adam Task starts-up.
 
-~/Once.HC a file invoked at the start-up of the first user.  Customize this!
+~/Once.HC a file invoked at the start-up of the first user.  Customize this!
 
-~/Registry.HC can be edited by hand or deleted to reset to defaults.  Takes 
+~/Registry.HC can be edited by hand or deleted to reset to defaults.  Takes 
 affect next boot.
 
 
@@ -96,7 +96,7 @@
 
 * Place user data in a subdirectory of /Home, preferably naming the subdirectory 
 the same as the /Apps subdirectory.  Or, place data in the Registry.HC.Z file.  
-See ::/Demo/RegistryDemo.HC.
+See ::/Demo/RegistryDemo.HC.
 
 * If the app needs files in the /Home directory, make an /Apps file called Insta
 ll.HC.Z or Install.IN.Z to create the /Home subdirectory.
@@ -106,17 +106,17 @@
                              Programming Guidelines
 
 * Virtual mem/Paging is not used -- it is identity mapped in x86_64 mode.  The 
-stk does not grow, so alloc enough when the task (process) is Spawned and use 
-the heap for most things.  (The heap refers to MAlloc() and Free().)
+stk does not grow, so alloc enough when the task (process) is Spawned and use 
+the heap for most things.  (The heap refers to MAlloc() and Free().)
 
-* You can Free(NULL).
+* You can Free(NULL).
 
-* See Naming Convention and Abbreviations.
+* See Naming Convention and Abbreviations.
 
-* There are two modes of compiling, AOT Compile Mode and JIT Compile Mode.  
-Compilation is done in both -- neither is "interpreted".  Use JIT Mode.
+* There are two modes of compiling, AOT Compile Mode and JIT Compile Mode.  
+Compilation is done in both -- neither is "interpreted".  Use JIT Mode.
 
-* HolyC
+* HolyC
 
 * Use I64 instead of smaller int sizes because the compiler converts everything 
 to 64-bit.  Don't use unsigned unless it actually breaks.  A policy of signed 
@@ -136,7 +136,7 @@
 
 * Avoid boolean expression assignments.  Boolean assignments don't have short 
 circuit logic and are not compiled efficiently.  The Bool type is just an alias 
-for a 1 byte signed int -- nothing forces it to 1 or 0.  There is a ToBool() 
+for a 1 byte signed int -- nothing forces it to 1 or 0.  There is a ToBool() 
 function that will for to 1 ot 0, however.
 
 * Glbl vars in AOT BIN modules are initialized to zero.  They occupy space in 
@@ -147,13 +147,13 @@
 locked semaphore.  I think semiphores need to be in their own cache line, but 
 I'm not sure.  I use lock bits in a lot of places not aligned.
 
-* SysDbg() and IsSysDbg() are really handy when working on the compiler or 
+* SysDbg() and IsSysDbg() are really handy when working on the compiler or 
 kernel.  It's just a bit you can set and test.
 
 * I don't use U0 * because the size is zero for ptr arithmetic.
 
-* Use CH_SHIFT_SPACE for spaces in quotes in source code because I run 
-Spaces-to-Tabs on source code.
+* Use CH_SHIFT_SPACE for spaces in quotes in source code because I run 
+Spaces-to-Tabs on source code.
 
 * Do not use #if or #ifdef
 
@@ -161,11 +161,11 @@
 
                                 Hash Sym Tables
 
-* See ::/Adam/AHash.HC for examples of how the hash tables are set-up.  
+* See ::/Adam/AHash.HC for examples of how the hash tables are set-up.  
 Basically, syms are placed into hash tables and child process hash tables are 
 chained to parents.  This provides scopes for vars and functions.
 
-* adam_task->hash_table holds the HolyC syms loaded in on start-up.
+* adam_task->hash_table holds the HolyC syms loaded in on start-up.
 
 * Fs->hash_table holds user HolyC syms and if a sym is not found, it checks 
 parents.  When a duplicate sym is added to the table, it overshadows the prev 
@@ -173,30 +173,30 @@
 prompt, make changes and reinclude it.  Old syms are overshadowed but they are 
 still there.  Periodically, kill the TASK and start fresh when mem is low.  If 
 you wish your applications to free themselves instead of staying in mem, spawn 
-or PopUp() a task to run the application and kill it when it's done.
+or PopUp() a task to run the application and kill it when it's done.
 
-* To display the contents of a hash table, use the Who() routine or the 
-varients.  HashDepthRep() gives a histogram  of how long the chains are, in case 
+* To display the contents of a hash table, use the Who() routine or the 
+varients.  HashDepthRep() gives a histogram  of how long the chains are, in case 
 you wish to make hash table sizes bigger.
 
 
 
                                Assembly Language
 
-See ::/Doc/Asm.DD.
+See ::/Doc/Asm.DD.
 
-* FS must always point to the cur CTask.
+* FS must always point to the cur CTask.
 
-* GS must always point to the cur CCPU.
+* GS must always point to the cur CCPU.
 
 * Don't change the segment regs unless interrupts are off.  It's hard to do, 
-anyway.  SET_FS_BASE and SET_GS_BASE.
+anyway.  SET_FS_BASE and SET_GS_BASE.
 
-* When interacting with HolyC compiled code, preserve RBP, RSI, RDI, R10-R15 
+* When interacting with HolyC compiled code, preserve RBP, RSI, RDI, R10-R15 
 because the compiler uses these for reg vars.  You are free to clobber RAX, RBX, 
-RCX, RDX, R8 and R9.  See Compiler Reg Masks, PUSH_C_REGS and POP_C_REGS
+RCX, RDX, R8 and R9.  See Compiler Reg Masks, PUSH_C_REGS and POP_C_REGS
 
-* I recommend using the standard stk frame for functions because Caller() is 
+* I recommend using the standard stk frame for functions because Caller() is 
 used to display the call stk, such as for the wallpaper.
         PUSH    RBP
         MOV     RBP,RSP
diff --git a/public/src/Doc/Hash.DD.HTML b/public/Wb/Home/Doc/Hash.DD.HTML
old mode 100644
new mode 100755
similarity index 67%
rename from public/src/Doc/Hash.DD.HTML
rename to public/Wb/Home/Doc/Hash.DD.HTML
index 33915f3..e9d7069
--- a/public/src/Doc/Hash.DD.HTML
+++ b/public/Wb/Home/Doc/Hash.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
 /* Graphics Not Rendered in HTML */
 
 
@@ -57,22 +57,22 @@
 parent task's sym table is checked.  All tasks chain back to the Adam task.
 
 TempleOS sym tables are implemented with an array of linked-lists.  A num is 
-generated from a string by HashStr() to index into the array of linked-lists.  
+generated from a string by HashStr() to index into the array of linked-lists.  
 Multiple strings can generate the same num, so linked-lists are built.  Newer 
 entries overshadow older ones.
 
-There are various types of entries.  See Hash Entry Types.
+There are various types of entries.  See Hash Entry Types.
 
-Symbol Look-up (Used many places including the JIT Compiler and Loader.)
-1) Symbol name is hashed by adding and shifting the ASCII of all chars.
-2) hash table->body[] array is indexed.
+Symbol Look-up (Used many places including the JIT Compiler and Loader.)
+1) Symbol name is hashed by adding and shifting the ASCII of all chars.
+2) hash table->body[] array is indexed.
 3) Linked-lst is traversed until match of text and type of entry.
-4) If not found, hash table->next table is searched.
+4) If not found, hash table->next table is searched.
 
 Duplicate entries are allowed -- they overshadow old entries.
 
 Address-to-Symbol Look-up (Slow because not important. We could use trees.)
-1) FunSeg Cache is scanned.
-2) Hash Tables are scanned.
+1) FunSeg Cache is scanned.
+2) Hash Tables are scanned.
 
diff --git a/public/src/Doc/HeapDbg.DD.HTML b/public/Wb/Home/Doc/HeapDbg.DD.HTML old mode 100644 new mode 100755 similarity index 84% rename from public/src/Doc/HeapDbg.DD.HTML rename to public/Wb/Home/Doc/HeapDbg.DD.HTML index e938dce..05fadca --- a/public/src/Doc/HeapDbg.DD.HTML +++ b/public/Wb/Home/Doc/HeapDbg.DD.HTML @@ -25,8 +25,8 @@ -
-Recompile the kernel with _CFG_HEAP_DBG=TRUE if you want more heap debugging.  
+
+Recompile the kernel with _CFG_HEAP_DBG=TRUE if you want more heap debugging.  
 You are on your own.
 
diff --git a/public/src/Doc/HelloWorld.DD.HTML b/public/Wb/Home/Doc/HelloWorld.DD.HTML old mode 100644 new mode 100755 similarity index 99% rename from public/src/Doc/HelloWorld.DD.HTML rename to public/Wb/Home/Doc/HelloWorld.DD.HTML index f8e17c7..e488016 --- a/public/src/Doc/HelloWorld.DD.HTML +++ b/public/Wb/Home/Doc/HelloWorld.DD.HTML @@ -25,7 +25,7 @@ -
+
 //Press F5 in the editor to compile and run.
 
 --------Hello.HC.Z---------
diff --git a/public/Wb/Home/Doc/HelpIndex.DD.HTML b/public/Wb/Home/Doc/HelpIndex.DD.HTML
new file mode 100755
index 0000000..4a238bf
--- /dev/null
+++ b/public/Wb/Home/Doc/HelpIndex.DD.HTML
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+                                      Help
+
++] Keyboard Ctrls
++] Mouse Ctrls
++] Keyboard-Mouse Ctrls
+
+Welcome         About TempleOS
+Command Line    Take Tour
+Demo Index      Key Map
+Features        Requirements
+Charter         Strategic Decisions
+F.A.Q.          Glossary
+HolyC           Compiler Index
+Why Not More?   Demands
+The Std TempleOS PC
+        
++] User Help
++] Admin Help
++] Programmer help
++] System Programmer Help
+
+
+                                     Index
+AutoComplete
+Bit
+Boot
+Call
+Char Overview
+Char Routines
+Circular Queue
+Cmd Line Overview
+Cmd Line Routines
+Compiler Overview
+Compiler Routines
+Compression
+Ctrls
+Data Types
+Date
+Debugging Overview
+Debugging Routines
+Define
+Devices
+Disk
+Doc Overview
+Doc Routines
+Exceptions
+File
+File Utils
+Frames
+God
+Graphics Overview
+Graphics Routines
+Hash
+Help System
+HolyC
+InFile
+Info
+Install
+I/O
+Job
+Key Allocations
+Keyboard Devices
+Link Types
+Math
+Memory Overview
+Memory Routines
+Menus
+Messages
+Misc
+Mouse
+MultiCore
+OpCodes
+Operator Precedences
+PCI
+Print("") Fmt Strings
+Processor
+Profiler
+RedSea
+Registry
+Scan Codes
+ScrnCast
+Sound
+Sprites
+StdIn
+StdOut
+String
+Task
+TextBase Layer
+Time
+Training
+TOSZ
+Utils
+Windows
+
+ diff --git a/public/src/Home/Doc/HelpSystem.DD.HTML b/public/Wb/Home/Doc/HelpSystem.DD.HTML similarity index 85% rename from public/src/Home/Doc/HelpSystem.DD.HTML rename to public/Wb/Home/Doc/HelpSystem.DD.HTML index 90c0bf3..adc4eb4 100755 --- a/public/src/Home/Doc/HelpSystem.DD.HTML +++ b/public/Wb/Home/Doc/HelpSystem.DD.HTML @@ -25,16 +25,16 @@ -
+
 #help_index "Topic/SubTopic;OtherTopic"
 The help index preprocessor compiler directive sets the topics for syms 
 subsequently defined.  You specify subtopics with a '/' tree hierarchy and 
-separate multiple topics with a ';'.  The index ctrls HI:index links.
+separate multiple topics with a ';'.  The index ctrls HI:index links.
 
 public causes a sym to appear in help_index reports.
 
 #help_file "filename[.DD.Z]"
 The help file preprocessor directive makes a file into the heading of a 
-HI:index report for the current help index.
+HI:index report for the current help index.
 
diff --git a/public/src/Doc/HolyC.DD.HTML b/public/Wb/Home/Doc/HolyC.DD.HTML old mode 100644 new mode 100755 similarity index 75% rename from public/src/Doc/HolyC.DD.HTML rename to public/Wb/Home/Doc/HolyC.DD.HTML index a3e77a1..7f1632c --- a/public/src/Doc/HolyC.DD.HTML +++ b/public/Wb/Home/Doc/HolyC.DD.HTML @@ -25,12 +25,12 @@ -
+
                                      HolyC
 
-* See ::/Doc/CompilerOverview.DD.
+* See ::/Doc/CompilerOverview.DD.
 
-* See Scoping and Linkage for details on extern, import, _extern, _import, etc.
+* See Scoping and Linkage for details on extern, import, _extern, _import, etc.
 
 * Built-in types include I0,I8,I16,I32,I64 for signed 0-8 byte ints and U0,U8,U1
 6,U32,U64 for unsigned 0-8 byte ints and F64 for 8 byte floats.
@@ -61,8 +61,8 @@
   
   Test(,3);
 
-* A char const all alone is sent to PutChars().  A string with or without args 
-is sent to Print().  An empty string literal signals a variable fmt_str follows.
+* A char const all alone is sent to PutChars().  A string with or without args 
+is sent to Print().  An empty string literal signals a variable fmt_str follows.
 
   void DemoC(char drv,char *fmt,char *name,int age)
   {
@@ -85,8 +85,8 @@
 * When dealing with function addresses such as for callbacks, precede the name 
 with "&".
 
-* Type casting is postfix.  To typecast int or F64, use ToI64(), ToBool() or 
-ToF64(). (TempleOS follows normal C float<-->int conversion, but sometimes you 
+* Type casting is postfix.  To typecast int or F64, use ToI64(), ToBool() or 
+ToF64(). (TempleOS follows normal C float<-->int conversion, but sometimes you 
 want to override.  These functions are better than multiplying by "1.0" to 
 convert to float.) 
 
@@ -94,7 +94,7 @@
 start-up, in order.
 
 * There are no bit fields, but there are bit access routines and you can access 
-bytes or words within any int.  See I64 declaration.  A class can be accessed as 
+bytes or words within any int.  See I64 declaration.  A class can be accessed as 
 a whole are subints, if you put a type in front of the class declaration.
   
   public I64i union I64         //"I64i" is intrinsic.  We are defining "I64".
@@ -127,8 +127,8 @@
   
   public U0 GrPrint(CDC *dc,I64 x,I64 y,U8 *fmt,...)
   {
-    U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);//SPrintF() with MAlloc()ed string.
-    GrPutS(dc,x,y,buf); //Plot string at x,y pixels. GrPutS is not public.
+    U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);//SPrintF() with MAlloc()ed string.
+    GrPutS(dc,x,y,buf); //Plot string at x,y pixels. GrPutS is not public.
     Free(buf);
   }
   
@@ -153,7 +153,7 @@
 * Allows ranges like "case 4...7:" in switch stmts.
 
 * A no case number causes next higher int case in switch stmts.  See 
-::/Demo/NullCase.HC.
+::/Demo/NullCase.HC.
 
   I64 i;
   for (i=0;i<20;i++) 
@@ -169,7 +169,7 @@
 * Switch statements can be nestled with a single switch expression!  This is 
 known as a "sub_switch" statement.  start/end are used to group cases.  Don't 
 goto out of, throw an exception out of, or return out of the start front porch 
-area.  See ::/Demo/SubSwitch.HC.
+area.  See ::/Demo/SubSwitch.HC.
 
   I64 i;
   for (i=0;i<10;i++)
@@ -199,7 +199,7 @@
 
   U0 Main()
   {
-    //Only use REGG_LOCAL_VARS or REGG_LOCAL_NON_PTR_VARS for reg vars or else 
+    //Only use REGG_LOCAL_VARS or REGG_LOCAL_NON_PTR_VARS for reg vars or else 
   clobbered.
     I64 reg R15 i=5, noreg j=4;
     no_warn i;
@@ -216,10 +216,10 @@
   }
 
 * interrupt, haserrcode, public, argpop or noargpop are function flags. See 
-IRQKbd().
+IRQKbd().
 
 * A single quote can encompass multiple characters.  'ABC' is equ to 0x434241.  
-PutChars() takes multiple characters.
+PutChars() takes multiple characters.
 
   asm {
   HELLO_WORLD::
@@ -240,7 +240,7 @@
 
 * There is no question-colon operator.
 
-* TempleOS operator precedence
+* TempleOS operator precedence
   `,>>,<<
   *,/,%
   &
@@ -254,15 +254,15 @@
   ||
   =,<<=,>>=,*=,/=,&=,|=,^=,+=,-=
 
-* You can use Option(OPTf_WARN_PAREN,ON) to find unnecessary parentheses in 
+* You can use Option(OPTf_WARN_PAREN,ON) to find unnecessary parentheses in 
 code.
 
-* You can use Option(OPTf_WARN_DUP_TYPES,ON) to find dup local var type stmts.
+* You can use Option(OPTf_WARN_DUP_TYPES,ON) to find dup local var type stmts.
 
 * With the #exe{} feature in your src code, you can place programs that insert 
-text into the stream of code being compiled.  See #exe {} for an example where 
+text into the stream of code being compiled.  See #exe {} for an example where 
 the date/time and compile-time prompting for cfguration data is placed into a 
-program.  StreamPrint() places text into a src program stream following the 
+program.  StreamPrint() places text into a src program stream following the 
 conclusion of the #exe{} blk.
 
 * No #define functions exist (I'm not a fan)
@@ -274,27 +274,27 @@
 * Can't use <> with #include, use "".
 
 * "$" is an escape character.  Two dollar signs signify an ordinary $.  See 
-DolDoc.  In asm or HolyC code, it also refers to the inst's address or the 
+DolDoc.  In asm or HolyC code, it also refers to the inst's address or the 
 offset in a class definition. 
 
 * union is more like a class, so you don't reference it with a union label after 
-you define it.  Some common unions are declared in KernelA.HH for 1,2,4 and 8 
+you define it.  Some common unions are declared in KernelA.HH for 1,2,4 and 8 
 byte objects.  If you place a type in front of a union declaration, that is the 
-type when used by itself.  See ::/Demo/SubIntAccess.HC. 
+type when used by itself.  See ::/Demo/SubIntAccess.HC. 
 
 * class member vars can have meta data. format and data are two meta data types 
 now used.  All compiler structures are saved and you can access the compiler's 
-info about classes and vars.  See ::/Demo/ClassMeta.HC and  DocForm().
+info about classes and vars.  See ::/Demo/ClassMeta.HC and  DocForm().
 
 * There is a keyword lastclass you use as a dft arg.  It is set to the class 
-name of the prev arg.  See ::/Demo/LastClass.HC, ClassRep(), DocForm()  and 
-::/Demo/Dsk/BlkDevRep.HC.
+name of the prev arg.  See ::/Demo/LastClass.HC, ClassRep(), DocForm()  and 
+::/Demo/Dsk/BlkDevRep.HC.
 
-* See ::/Demo/Exceptions.HC.  try{} catch{} and throw are different from C++. th
+* See ::/Demo/Exceptions.HC.  try{} catch{} and throw are different from C++. th
 row is a function with an 8-byte or less char arg.  The char string passed in th
 row() can be accessed from within a catch{} using the Fs->except_ch.  Within a c
 atch {} blk, set the var Fs->catch_except to TRUE if you want to terminate the 
-search for a hndlr.  Use PutExcept() as a hndlr, if you like.
+search for a hndlr.  Use PutExcept() as a hndlr, if you like.
 
 * A function is available similar to sizeof which provides the offset of a 
 member of a class.  It's called offset.  You place the class name and member 
@@ -307,25 +307,25 @@
 * lock{} can be used to apply asm LOCK prefixes to code for safe multicore 
 read-modify-write accesses.  The code bracked with have LOCK asm prefix's 
 applied to relevant insts within.  It's a little shoddy.  See 
-::/Demo/MultiCore/Lock.HC.
+::/Demo/MultiCore/Lock.HC.
 
-* There is a function called MSize() which gives the size of an object alloced 
+* There is a function called MSize() which gives the size of an object alloced 
 off the heap.  For larger size allocations, the system rounds-up to a power of 
 two, so MSize() lets you know the real size and you can take full advantage of 
 it.
 
-* You CAN Free() a NULL ptr.  Useful variants of MAlloc() can be found Here.  
+* You CAN Free() a NULL ptr.  Useful variants of MAlloc() can be found Here.  
 Each task has a heap and you can MAlloc and Free off-of other task's heaps, or 
-make an independent heap with HeapCtrlInit().  See HeapLog() for an example.
+make an independent heap with HeapCtrlInit().  See HeapLog() for an example.
 
 * The stk does not grow because virtual mem is not used.  I recommend allocating 
-large local vars from the heap.  You can change MEM_DFT_STK and recompile Kernel 
-or request more when doing a Spawn().  You can use CallStkGrow(), but it's odd.  
-See ::/Demo/StkGrow.HC. 
+large local vars from the heap.  You can change MEM_DFT_STK and recompile Kernel 
+or request more when doing a Spawn().  You can use CallStkGrow(), but it's odd.  
+See ::/Demo/StkGrow.HC. 
 
 * Only one base class is allowed.
 
-* printf() has new codes.  See Print("") Fmt Strings.
+* printf() has new codes.  See Print("") Fmt Strings.
 
 * All values are extended to 64-bit when accessed.  Intermediate calculations 
 are done with 64-bit values.
diff --git a/public/src/Doc/InFile.DD.HTML b/public/Wb/Home/Doc/InFile.DD.HTML
old mode 100644
new mode 100755
similarity index 62%
rename from public/src/Doc/InFile.DD.HTML
rename to public/Wb/Home/Doc/InFile.DD.HTML
index 5490485..4ab98ac
--- a/public/src/Doc/InFile.DD.HTML
+++ b/public/Wb/Home/Doc/InFile.DD.HTML
@@ -25,24 +25,24 @@
 
 
 
-
+
 InFiles are used to generate user input to automate operations.  The TempleOS 
 tour is done with an InFile.  It reminds me of a Unix pipe because StdOut of one 
 gets chained into StdIn of another.
 
-When an InFile runs, a child task is Spawn()ed which intercepts real user input 
-and generates fake input.  InFiles are HolyC programs run by the child whose 
-stdout goes to the parent's input buffer.  Msg() can be included in an InFile to 
+When an InFile runs, a child task is Spawn()ed which intercepts real user input 
+and generates fake input.  InFiles are HolyC programs run by the child whose 
+stdout goes to the parent's input buffer.  Msg() can be included in an InFile to 
 send special keys or mouse cmds to the parent.  While an InFile is running, the 
 normal input gets diverted to the InFile task and can be filtered and sent back 
 to the parent task.  Unless you are driving functions which prompt for data, you 
 can probably use an #include file in place of an InFile.
 
-See ::/Demo/InFile/InDir.IN.
+See ::/Demo/InFile/InDir.IN.
 
-Note: In("") can be used if all you need is to send ASCII characters.  It 
-differs from InStr().  You'll probably use In() a lot and not InStr().  With In(
+Note: In("") can be used if all you need is to send ASCII characters.  It 
+differs from InStr().  You'll probably use In() a lot and not InStr().  With In(
 ), for example, you can place answers to the prompts for recompiling the Kernel 
-module during BootHDIns().
+module during BootHDIns().
 
diff --git a/public/src/Doc/Install.DD.HTML b/public/Wb/Home/Doc/Install.DD.HTML old mode 100644 new mode 100755 similarity index 71% rename from public/src/Doc/Install.DD.HTML rename to public/Wb/Home/Doc/Install.DD.HTML index 5edb7e3..6d47c2b --- a/public/src/Doc/Install.DD.HTML +++ b/public/Wb/Home/Doc/Install.DD.HTML @@ -25,7 +25,7 @@ -
+
                               Installing TempleOS
 
 Burn a CD with software that supports ISO files.  Then, boot it.  It's a live 
@@ -38,10 +38,10 @@
 connecting a spare additional hard drive and using the BIOS to select which 
 drive to boot.
 
-The ::/Misc/OSInstall.HC script will automate much of this.  It runs if you boot 
+The ::/Misc/OSInstall.HC script will automate much of this.  It runs if you boot 
 the CD/DVD-ROM.
 
-See Boot.DD for an overview of booting.  See Requirements for supported 
+See Boot.DD for an overview of booting.  See Requirements for supported 
 hardware.
 
 Two TempleOS partitions are highly recommended, so you can boot to a back-up and 
@@ -49,7 +49,7 @@
 for your TempleOS partitions.
 
 1)
-  Mount() use if the drive is partitioned.
+  Mount() use if the drive is partitioned.
     This command mounts a drive making it accessible.  For simplicity, sel 'C' 
     as the first drive letter for your hard drive.  The first partition will be 
     'C', second, 'D', etc.  TempleOS needs 3 numbers to utilize a hard drive -- 
@@ -57,9 +57,9 @@
     C with a 0x prefix.  If the probe was successful, you can just enter the 
     number in the probe box instead of base0.
   
-  DskPrt('C') use if drive is not partitioned
+  DskPrt('C') use if drive is not partitioned
   
-    This will perform a special Mount() automatically.
+    This will perform a special Mount() automatically.
     
     WARNING:  This command erases everything on a hard drive.  It repartitions a 
     whole drive and formats the partitions.  This command should be skipped if 
@@ -67,28 +67,28 @@
     
     
     WARNING:  This command doesn't play well with other operating systems.  
-    You'll need to do a BootMHDZero() to restore your drive to a state where 
+    You'll need to do a BootMHDZero() to restore your drive to a state where 
     other operating systems can partition it.
   
-2) Fmt('D',TRUE,FALSE,FSt_FAT32)
-  This command formats a drive with FAT32 or the RedSea file system type.  Use 
+2) Fmt('D',TRUE,FALSE,FSt_FAT32)
+  This command formats a drive with FAT32 or the RedSea file system type.  Use 
   the drive letter of the partition in place of 'D'.
   
   WARNING:  If you are upgrading, be sure not to lose the file, /0000Boot/OldMBR
   .BIN.C.
   
-3) CopyTree("T:/","D:/")
+3) CopyTree("T:/","D:/")
   This command is used to copy files onto a hard drive partition from the 
   CD/DVD.  Use the drive letter of the partition in place of 'D'.
   
-4) BootHDIns('D')
+4) BootHDIns('D')
   This command recompiles the source code on a drive and writes to the drive's 
-  boot record.  You'll need to reenter the Mount information so it can be stored 
+  boot record.  You'll need to reenter the Mount information so it can be stored 
   in the kernel.
   
-5) Use Linux's Grub or TempleOS' BootMHDIns('D')
+5) Use Linux's Grub or TempleOS' BootMHDIns('D')
   
-  The BootMHDIns() command places a boot loader on a drive.  It saves the old 
+  The BootMHDIns() command places a boot loader on a drive.  It saves the old 
   master boot record to /0000Boot/OldMBR.BIN.C and replaces it.  When you boot, 
   you will have the option of booting the old master boot record.  This command 
   can be skipped if you already have a boot loader.  Be sure not to lose the 
diff --git a/public/Wb/Home/Doc/Job.DD.HTML b/public/Wb/Home/Doc/Job.DD.HTML
new file mode 100755
index 0000000..9035261
--- /dev/null
+++ b/public/Wb/Home/Doc/Job.DD.HTML
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+/* Graphics Not Rendered in HTML */
+               PopUpPrint                         User          ExePrint
+
+
+
+                  PopUp                                          ExePutS
+
+
+
+ Core0 AdamTask  SrvCmdLine   AP SethTask       UserCmdLine
+
+
+
+
+
+
+         SrvTaskCont                          UserTaskCont
+
+
+
+        JobsHndlr
+
+
+
+         JobRunOne           JobRunOne         ExeCmdLine      ExeCmdLine
+
+
+
+
+CJob nodes are one of five types.  User applications deal with text or msgs.  
+JobRunOne() will call a function, spawn a task or execute some text src code.
+
+#define JOBT_TEXT_INPUT         0 //TaskText()  Feed StdIn 
+#define JOBT_MSG                1 //TaskMsg()   Post msg 
+#define JOBT_EXE_STR            2 //TaskExe()   Compile & execute src code text
+#define JOBT_CALL               3 //JobQue()    Tell MP to call function
+#define JOBT_SPAWN_TASK         4 //Spawn()     Tell MP to spawn task
+
+Several other routines include a call to JobsHndlr() that gives them powerful 
+ability to execute servant cmds.
+
+ diff --git a/public/src/Doc/KeyAlloc.DD.HTML b/public/Wb/Home/Doc/KeyAlloc.DD.HTML old mode 100644 new mode 100755 similarity index 79% rename from public/src/Doc/KeyAlloc.DD.HTML rename to public/Wb/Home/Doc/KeyAlloc.DD.HTML index 8010d5e..d5e6df0 --- a/public/src/Doc/KeyAlloc.DD.HTML +++ b/public/Wb/Home/Doc/KeyAlloc.DD.HTML @@ -25,7 +25,7 @@ -
+
                                 Key Allocations
 
 See Char for definition of scan codes.
@@ -33,19 +33,19 @@
 See Key Map for a detailed list of key commands.
 
 When you are at the cmd line, editing documents, browsing documentation and 
-help, entering items in forms or in menu's, the DolDoc editor handles keys.  It 
-allows you to define your own key hndlrs in a MyPutKey() function.  If you 
-choose, you can catch keys, overriding the default hndlrs.  See DocPutKey().  
+help, entering items in forms or in menu's, the DolDoc editor handles keys.  It 
+allows you to define your own key hndlrs in a MyPutKey() function.  If you 
+choose, you can catch keys, overriding the default hndlrs.  See DocPutKey().  
 The following is an overview of key allocations.
 
-<ALT-keys> and <ALT-SHIFT-keys>  Free for user configurations in your MyPutKey() 
+<ALT-keys> and <ALT-SHIFT-keys>  Free for user configurations in your MyPutKey() 
 hndlr, except for ALT-BACKSPACE (undo).  There are a few examples pre-defined, 
 but you can change them if you wish.
 
 <CTRL-ALT-keys> and <CTRL-ALT-SHIFT-keys>  Handled at a system level, NOT by the 
-CDoc editor.  I reserve the right to alloc these, but in the mean time, you can 
-define your own hndlrs with CtrlAltCBSet().  They operate either in a interrupt 
-environment or in the window mgr when it queues kbd msgs.  You can do Raw() 
+CDoc editor.  I reserve the right to alloc these, but in the mean time, you can 
+define your own hndlrs with CtrlAltCBSet().  They operate either in a interrupt 
+environment or in the window mgr when it queues kbd msgs.  You can do Raw() 
 output.  <CTRL-ALT-letter> hndlrs take a scan_code as an arg.
 
 <CTRL-function key>  Auto-completes local words.
diff --git a/public/src/Home/Doc/KeyDev.DD.HTML b/public/Wb/Home/Doc/KeyDev.DD.HTML
similarity index 53%
rename from public/src/Home/Doc/KeyDev.DD.HTML
rename to public/Wb/Home/Doc/KeyDev.DD.HTML
index edf2c32..ec4707d 100755
--- a/public/src/Home/Doc/KeyDev.DD.HTML
+++ b/public/Wb/Home/Doc/KeyDev.DD.HTML
@@ -25,27 +25,27 @@
 
 
 
-
-The editor mostly stays in a GetKey()/PutKey() loop.  The putkey portion is 
+
+The editor mostly stays in a GetKey()/PutKey() loop.  The putkey portion is 
 where keys are acted-upon.  TempleOS has a chain of putkey hndlrs in a 
 Circular Queue with priorities.  The highest priority hndlrs can choose to 
 terminate handling, otherwise, the keys get sent on down the chain.
 
-KeyDevAdd() defines a putkey device with a priority.  "Device" might be a 
+KeyDevAdd() defines a putkey device with a priority.  "Device" might be a 
 misnomer.  Currently, the following are defined:
 
 Priority    Hndlr
 ---------- ---------
-0x20000000 MyPutKey() user hndlr
-0x40000000 KDInputFilterPutKey() for In(), InStr(), and InFile() handling.
-0x60000000 KDRawPutKey() nonwindowed direct to video mem debug output. 
-0x80000000 KDDocPutKey() standard document cmds
+0x20000000 MyPutKey() user hndlr
+0x40000000 KDInputFilterPutKey() for In(), InStr(), and InFile() handling.
+0x60000000 KDRawPutKey() nonwindowed direct to video mem debug output. 
+0x80000000 KDDocPutKey() standard document cmds
 
 Since handling individual keys is slow, TempleOS supports PutS() as well.  If no 
 puts hndlr is defined, individual keys are sent.
 
-CDoc.user_put_key and CDoc.user_put_s are call back routines which offer some 
-neat tricks.  See ::/Apps/Psalmody/JukeBox.HC.  There is a var CDoc.user_put_dat
+CDoc.user_put_key and CDoc.user_put_s are call back routines which offer some 
+neat tricks.  See ::/Apps/Psalmody/JukeBox.HC.  There is a var CDoc.user_put_dat
 a which gets passed to them.
 
diff --git a/public/src/Doc/Lex.DD.HTML b/public/Wb/Home/Doc/Lex.DD.HTML old mode 100644 new mode 100755 similarity index 72% rename from public/src/Doc/Lex.DD.HTML rename to public/Wb/Home/Doc/Lex.DD.HTML index 2616967..4705278 --- a/public/src/Doc/Lex.DD.HTML +++ b/public/Wb/Home/Doc/Lex.DD.HTML @@ -25,10 +25,10 @@ -
+
 The compiler's lexical analyzer can be used in your programs to simplify 
-parsing.  See Doc Parsing or Parse Opcode File.
+parsing.  See Doc Parsing or Parse Opcode File.
 
-See Tokens.
+See Tokens.
 
diff --git a/public/src/Doc/MemOverview.DD.HTML b/public/Wb/Home/Doc/MemOverview.DD.HTML old mode 100644 new mode 100755 similarity index 71% rename from public/src/Doc/MemOverview.DD.HTML rename to public/Wb/Home/Doc/MemOverview.DD.HTML index 8e0e3f8..884c565 --- a/public/src/Doc/MemOverview.DD.HTML +++ b/public/Wb/Home/Doc/MemOverview.DD.HTML @@ -25,7 +25,7 @@ -
+
                                 Memory Overview
 
 Paging is practically not used.  64-bit mode requires paging, however, so it is 
@@ -40,42 +40,42 @@
 2Gig memory addresses including what would normally be called "the kernel".  Two 
 Gig is plenty for code, don't worry.
 
-You can create new, independent heaps using HeapCtrlInit().  Then, use the 
-CHeapCtrl as the 2nd arg to MAlloc().  See HeapLog() for an example.
+You can create new, independent heaps using HeapCtrlInit().  Then, use the 
+CHeapCtrl as the 2nd arg to MAlloc().  See HeapLog() for an example.
 
-Memory alloced by a task will be freed when the task is killed.  The Adam Task 
+Memory alloced by a task will be freed when the task is killed.  The Adam Task 
 is a task that never dies.  His memory is like kernel memory in other operating 
-systems.  See ACAlloc(), AMAlloc(), AMAllocIdent() and AStrNew().
+systems.  See ACAlloc(), AMAlloc(), AMAllocIdent() and AStrNew().
 
 All of the regular page tables are marked, "cached".  When accessing hardware, 
 however, you need uncached page table.  The lowest 4Gig addresses have an alias 
 to access hardware located toward the top of mapped space, 0x10000000000.  See 
-dev.uncached_alias.
+dev.uncached_alias.
 
 During an extended powered-on session of TempleOS, in theory, memory will become 
 fragmented, requiring a reboot.  It has never happens to me.
 
-See MemRep() and ::/Demo/MemDemo.HC.
+See MemRep() and ::/Demo/MemDemo.HC.
 
 
                            Single System-wide Mem Map
 
  0x0000007C00- 0x000003616F
-  Kernel module, placed here by the boot-loader, BOOT_RAM_BASE.
+  Kernel module, placed here by the boot-loader, BOOT_RAM_BASE.
 
  0x0000096600- 0x0000096FFF
-  Boot block relocated here before loading the Kernel module, BootDVD & BootHD.
+  Boot block relocated here before loading the Kernel module, BootDVD & BootHD.
 
- 0x0000097000- 0x0000097030 Multicore start-up vect code, MPN_VECT.
+ 0x0000097000- 0x0000097030 Multicore start-up vect code, MPN_VECT.
 ~0x000009F000- 0x000009FFFF Extended BIOS data area.
- 0x00000A0000- 0x00000BFFFF VGA graphics mem with alias at text.vga_alias.
- 0x0000100000- 0x0000101FFF CSysFixedArea for misc.
+ 0x00000A0000- 0x00000BFFFF VGA graphics mem with alias at text.vga_alias.
+ 0x0000100000- 0x0000101FFF CSysFixedArea for misc.
  0x000050A000- 0x001FFDFFFF Code Heap mem.
 
  0x00E0000000- 0x00FFFFFFFF
   32-bit devices could alloc memory at 0xF0000000 going up, but this is wrong, 
   since some PCs already have devices at 0xF0000000.  No PCI devices are 
-  supported, so Mem32DevAlloc() flaws are not an issue.
+  supported, so Mem32DevAlloc() flaws are not an issue.
 
  0x0080000000-~0x00DFFFFFFF
  0x0100000000-~0xFFFFFFFFFF
@@ -85,19 +85,19 @@
   Uncached alias of first 4Gig.  (For 32-bit device access.)
 
              - 0x100FFFFFFFF
-  64-bit devices are alloced with Mem64DevAlloc() counting bwd, but no PCI 
+  64-bit devices are alloced with Mem64DevAlloc() counting bwd, but no PCI 
   devices are actually supported.
 
 
 
 * Note: There is a break in the data-heap block pool.  This has no effect except 
-the obvious effect that fragmentation has on contiguous requests.  I can MAlloc(
-) an 8Gig chunk on my 12Gig machine.  I can MAlloc() an 32Gig chunk on my 64Gig 
+the obvious effect that fragmentation has on contiguous requests.  I can MAlloc(
+) an 8Gig chunk on my 12Gig machine.  I can MAlloc() an 32Gig chunk on my 64Gig 
 machine.  
 
 * Note: For systems with less than 2Gig RAM, the code and data heap block pools 
 are the same.  For systems with 2-4Gig of RAM, the code heap is 1/4 of the 
-total.  See BlkPoolsInit().
+total.  See BlkPoolsInit().
 
 
                                     History
@@ -123,20 +123,20 @@
 In 2016, I came-up with an alternate idea.  I double mapped the lowest memory 
 with an alias that was uncached.  Accessing the lowest 2Meg area directly was 
 cached but the alias I created up at the top of address space was uncached.  See 
-UncachedAliasAlloc().  Unfortunately, I could no longer boast of the simplicity 
+UncachedAliasAlloc().  Unfortunately, I could no longer boast of the simplicity 
 of identity mapping everything.  Since many of my users are familiar with 
 A0000-BFFFF, it is actually pretty seriously unfortunate that they cannot use 
 the easy-to-understand numbers of A0000-BFFFF, but must access the relocated 
-alias location.  See text.vga_alias.  I also no longer cause a fault when 
+alias location.  See text.vga_alias.  I also no longer cause a fault when 
 dereferencing NULL.
 
 Then, I switched to 1Gig page sizes.  For the lowest 4Gig, I set-up an alias up 
-at the top of address space.  See UncachedAliasAlloc().  Not all computers 
+at the top of address space.  See UncachedAliasAlloc().  Not all computers 
 support 1Gig page tables, however, so I also support 2Meg.
 
 My original plan was to allow changing the page tables as needed, so I had code 
 for taking control of 2Meg pages and marking them uncached or whatever.  When I 
 did a HDAudio driver, I requested some 32-bit address space as uncached.  Today, 
-all of the first 4Gig can be accessed without caching at the dev.uncached_alias.
+all of the first 4Gig can be accessed without caching at the dev.uncached_alias.
 
diff --git a/public/src/Doc/Menus.DD.HTML b/public/Wb/Home/Doc/Menus.DD.HTML old mode 100644 new mode 100755 similarity index 60% rename from public/src/Doc/Menus.DD.HTML rename to public/Wb/Home/Doc/Menus.DD.HTML index e369b0f..c279afe --- a/public/src/Doc/Menus.DD.HTML +++ b/public/Wb/Home/Doc/Menus.DD.HTML @@ -25,9 +25,9 @@ -
+
 A pull-down menu appears when you move the mouse to the top of the scrn.  Menus 
-are created with MenuPush(), MenuFilePush(), MenuNew() or MenuFile() and 
+are created with MenuPush(), MenuFilePush(), MenuNew() or MenuFile() and 
 assigned to Fs->cur_menu.  The format is:
 
 
@@ -52,12 +52,12 @@
 }
 
 The first arg is the msg code and it is optional with the default being 
-MSG_KEY_DOWN_UP.  The second arg is the msg arg1 value which is ASCII of the key 
-in the case of MSG_KEY_DOWN.  The third arg is the msg arg2 value which is the 
-scan_code of the key in the case of MSG_KEY_DOWN.
+MSG_KEY_DOWN_UP.  The second arg is the msg arg1 value which is ASCII of the key 
+in the case of MSG_KEY_DOWN.  The third arg is the msg arg2 value which is the 
+scan_code of the key in the case of MSG_KEY_DOWN.
 
 Press <CTRL-SHIFT-l> and "Insert ASCII/ScanCode".
 
-See ::/Demo/PullDownMenu.HC.
+See ::/Demo/PullDownMenu.HC.
 
diff --git a/public/src/Doc/Mouse.DD.HTML b/public/Wb/Home/Doc/Mouse.DD.HTML old mode 100644 new mode 100755 similarity index 73% rename from public/src/Doc/Mouse.DD.HTML rename to public/Wb/Home/Doc/Mouse.DD.HTML index 4e1caf9..fcb31f0 --- a/public/src/Doc/Mouse.DD.HTML +++ b/public/Wb/Home/Doc/Mouse.DD.HTML @@ -25,15 +25,15 @@ -
-ms.pos.x and ms.pos.y can be used to access the x and y coordinates of the 
+
+ms.pos.x and ms.pos.y can be used to access the x and y coordinates of the 
 mouse.  They are relative to the scrn, not window.  These can be used if you 
-don't want to use msg passing.  ms.pos.z is the wheel.
+don't want to use msg passing.  ms.pos.z is the wheel.
 
-ms.pos_text.x and ms.pos_text.y are the text column and row.  See 
-::/Demo/Games/Maze.HC.
+ms.pos_text.x and ms.pos_text.y are the text column and row.  See 
+::/Demo/Games/Maze.HC.
 
-See CMsStateGlbls and CMsHardStateGlbls.
+See CMsStateGlbls and CMsHardStateGlbls.
 
 The hard designation, as in ms_hard, represents hardware layer items before the 
 application of an abstraction layer.
diff --git a/public/src/Doc/Msgs.DD.HTML b/public/Wb/Home/Doc/Msgs.DD.HTML
old mode 100644
new mode 100755
similarity index 84%
rename from public/src/Doc/Msgs.DD.HTML
rename to public/Wb/Home/Doc/Msgs.DD.HTML
index d9c2199..0c7e08b
--- a/public/src/Doc/Msgs.DD.HTML
+++ b/public/Wb/Home/Doc/Msgs.DD.HTML
@@ -25,8 +25,8 @@
 
 
 
-
+
 There are a maximum of 63 message types, so a bitmask can be passed.  Messages 
-have two args.  See Message Codes.
+have two args.  See Message Codes.
 
diff --git a/public/src/Home/Doc/MultiCore.DD.HTML b/public/Wb/Home/Doc/MultiCore.DD.HTML similarity index 52% rename from public/src/Home/Doc/MultiCore.DD.HTML rename to public/Wb/Home/Doc/MultiCore.DD.HTML index 7e7a99a..385fa15 100755 --- a/public/src/Home/Doc/MultiCore.DD.HTML +++ b/public/Wb/Home/Doc/MultiCore.DD.HTML @@ -25,28 +25,28 @@ -
+
 TempleOS does master-slave multicore instead of SMP.  Core0 is the master.  The 
 master core's applications explicitly assign computational jobs to other cores 
 and the TempleOS scheduler does not move tasks between cores.
 
 There are multicore safe locks for file access and heap allocations, however, so 
-TempleOS is symmetrical in some sense.  See ::/Demo/MultiCore/LoadTest.HC.
+TempleOS is symmetrical in some sense.  See ::/Demo/MultiCore/LoadTest.HC.
 
 Only tasks on Core0 can have windows, but other cores can help render them.
 
-Each core has an executive Seth Task which is the father of all tasks on that 
-core.  Adam is the Seth Task on Core0.
+Each core has an executive Seth Task which is the father of all tasks on that 
+core.  Adam is the Seth Task on Core0.
 
-You give a job to a Seth Task with JobQue() and get the result with JobResGet(). 
- You spawn a task on any core with Spawn().
+You give a job to a Seth Task with JobQue() and get the result with JobResGet(). 
+ You spawn a task on any core with Spawn().
 
 Note: You must use the LOCK asm prefix when changing shared structures in a 
-multicore environment.  The LBts(), LBtr() and LBtc() insts have LOCK prefixes.  
+multicore environment.  The LBts(), LBtr() and LBtc() insts have LOCK prefixes.  
 The compiler has a lock{} feature but it doesn't work well.  See 
-::/Demo/MultiCore/Lock.HC.
+::/Demo/MultiCore/Lock.HC.
 
-See ::/Demo/Graphics/Transform.HC.
-See ::/Kernel/MultiProc.HC.
+See ::/Demo/Graphics/Transform.HC.
+See ::/Kernel/MultiProc.HC.
 
diff --git a/public/src/Doc/NewASCII.DD.HTML b/public/Wb/Home/Doc/NewASCII.DD.HTML old mode 100644 new mode 100755 similarity index 96% rename from public/src/Doc/NewASCII.DD.HTML rename to public/Wb/Home/Doc/NewASCII.DD.HTML index 765666c..f817d82 --- a/public/src/Doc/NewASCII.DD.HTML +++ b/public/Wb/Home/Doc/NewASCII.DD.HTML @@ -25,7 +25,7 @@ -
+
                                    New ASCII
 
 
diff --git a/public/src/Doc/ODE.DD.HTML b/public/Wb/Home/Doc/ODE.DD.HTML
old mode 100644
new mode 100755
similarity index 54%
rename from public/src/Doc/ODE.DD.HTML
rename to public/Wb/Home/Doc/ODE.DD.HTML
index 06f7db6..3bef5df
--- a/public/src/Doc/ODE.DD.HTML
+++ b/public/Wb/Home/Doc/ODE.DD.HTML
@@ -25,15 +25,15 @@
 
 
 
-
+
 TempleOS has an advanced algorithm for integrating ordinary differential 
 equations suitable for use in video games.  (Not scientific work.)  It also has 
 some support for systems of masses and springs, to save you some work.
 
-See CMathODE and ODEsUpdate for an overview.
-See ODECallDerivative to see what support there is for masses and springs.
+See CMathODE and ODEsUpdate for an overview.
+See ODECallDerivative to see what support there is for masses and springs.
 
-See ::/Demo/Games/Whap.HC, ::/Demo/Games/Rocket.HC, ::/Demo/Games/MassSpring.HC, 
-::/Apps/Span/SpanMain.HC or ::/Apps/X-Caliber/X-Caliber.HC.
+See ::/Demo/Games/Whap.HC, ::/Demo/Games/Rocket.HC, ::/Demo/Games/MassSpring.HC, 
+::/Apps/Span/SpanMain.HC or ::/Apps/X-Caliber/X-Caliber.HC.
 
diff --git a/public/Wb/Home/Doc/Once.DD.HTML b/public/Wb/Home/Doc/Once.DD.HTML new file mode 100755 index 0000000..fb68008 --- /dev/null +++ b/public/Wb/Home/Doc/Once.DD.HTML @@ -0,0 +1,46 @@ + + + + + + + + + + +
+KMain()
+  includes ::/StartOS.HC
+    includes ~/MakeHome.HC
+      includes ~/HomeSys.HC
+        calls StartUpTasks()
+          includes ~/Once.HC
+            calls OnceExe().
+
+AOnce() appends src code to ~/Registry.HC Once/Adam tree, executed at next boot 
+by Adam.
+
+Once()  appends src code to ~/Registry.HC Once/User tree, executed at next boot 
+by first User term.
+
+At boot, OnceExe(), executes Once/Adam tree, AOnceFlush()s it,
+executes Once/User tree and OnceFlush()s.
+
+ diff --git a/public/src/Doc/Options.DD.HTML b/public/Wb/Home/Doc/Options.DD.HTML old mode 100644 new mode 100755 similarity index 57% rename from public/src/Doc/Options.DD.HTML rename to public/Wb/Home/Doc/Options.DD.HTML index c7a42b9..581d475 --- a/public/src/Doc/Options.DD.HTML +++ b/public/Wb/Home/Doc/Options.DD.HTML @@ -25,33 +25,33 @@ -
+
                                 Compiler Options
 
-Use Option().  You might need to do #exe {Option();}.
+Use Option().  You might need to do #exe {Option();}.
 
-OPTf_GLBLS_ON_DATA_HEAP without this option, global vars are placed in the code 
+OPTf_GLBLS_ON_DATA_HEAP without this option, global vars are placed in the code 
 heap which is limited to 2Gig.  In AOT modules, global vars take-up room in the 
 .BIN file, so you might want to use this option, instead.  You might wish to 
 turn it on and off around specific vars.  A disadvantage of data heap global 
 vars in AOT modules is they can't be initialized.
 
-OPTf_EXTERNS_TO_IMPORTS and OPTf_KEEP_PRIVATE are strange options, you'll never 
+OPTf_EXTERNS_TO_IMPORTS and OPTf_KEEP_PRIVATE are strange options, you'll never 
 need.  They're to allow the same header file for Kernel to act as externs when 
 compiling itself and imports when compiled by AOT modules.
 
-OPTf_WARN_UNUSED_VAR    warning if unused var.  It is applied to functions.
+OPTf_WARN_UNUSED_VAR    warning if unused var.  It is applied to functions.
 
-OPTf_WARN_PAREN         warning if parenthesis are not needed.
+OPTf_WARN_PAREN         warning if parenthesis are not needed.
 
-OPTf_WARN_DUP_TYPES     warning if dup local var type stmts.
+OPTf_WARN_DUP_TYPES     warning if dup local var type stmts.
 
-OPTf_WARN_HEADER_MISMATCH warning if fun header does not match.
+OPTf_WARN_HEADER_MISMATCH warning if fun header does not match.
 
-OPTf_NO_REG_VAR forces all function local vars to the stk not regs.  Applied to 
+OPTf_NO_REG_VAR forces all function local vars to the stk not regs.  Applied to 
 functions.
 
-OPTf_NO_BUILTIN_CONST Disable 10-byte float consts for pi, log2_10, log10_2, 
+OPTf_NO_BUILTIN_CONST Disable 10-byte float consts for pi, log2_10, log10_2, 
 loge_2.  Applied to functions.
 
diff --git a/public/src/Home/Doc/Pags.DD.HTML b/public/Wb/Home/Doc/Pags.DD.HTML similarity index 78% rename from public/src/Home/Doc/Pags.DD.HTML rename to public/Wb/Home/Doc/Pags.DD.HTML index 6fde2fd..4714e73 100755 --- a/public/src/Home/Doc/Pags.DD.HTML +++ b/public/Wb/Home/Doc/Pags.DD.HTML @@ -25,10 +25,10 @@ -
-The word Pag refers to an arbitrilly created MEM_PAG_SIZE unit of heap 
+
+The word Pag refers to an arbitrilly created MEM_PAG_SIZE unit of heap 
 allocation.  TempleOS does not alter the CPU page tables after setting them up 
-at boot in SYS_INIT_PAGE_TABLES, so the CPU hardware page size is rarely 
+at boot in SYS_INIT_PAGE_TABLES, so the CPU hardware page size is rarely 
 important.
 
diff --git a/public/src/Doc/PreProcessor.DD.HTML b/public/Wb/Home/Doc/PreProcessor.DD.HTML old mode 100644 new mode 100755 similarity index 85% rename from public/src/Doc/PreProcessor.DD.HTML rename to public/Wb/Home/Doc/PreProcessor.DD.HTML index e480e5e..49eb541 --- a/public/src/Doc/PreProcessor.DD.HTML +++ b/public/Wb/Home/Doc/PreProcessor.DD.HTML @@ -25,10 +25,10 @@ -
+
                                   PreProcessor
 
-There is no separate preprocessor pass.  The parser front-end calls Lex() which 
+There is no separate preprocessor pass.  The parser front-end calls Lex() which 
 has the preprocessor built-in.  The compiler looks ahead a token, most of the 
 time, so you might throw an extra semicolon after a directive if it's not taking 
 affect right away.
@@ -37,7 +37,7 @@
 
 #include ""     There is no angle bracket <> form of this directive.
 #exe {}         Will execute code at compile-time and can be used to insert code 
-into the stream being compiled using StreamPrint().
+into the stream being compiled using StreamPrint().
 #define         Define string const
 #assert         Print a warning during compilation if an expression is not true. 
 #if             Include code if an expresion is true.
@@ -46,8 +46,8 @@
 #ifdef,#ifndef  Include code if a sym is defined.
 #ifaot,#ifjit   Include code if in AOT compiler mode.
 defined()       Is a function that can be used in expressions.
-#help_index, #help_file See Help System.
+#help_index, #help_file See Help System.
 
-See PreProcessor.
+See PreProcessor.
 
diff --git a/public/src/Home/Doc/Print.DD.HTML b/public/Wb/Home/Doc/Print.DD.HTML similarity index 54% rename from public/src/Home/Doc/Print.DD.HTML rename to public/Wb/Home/Doc/Print.DD.HTML index d83a24d..207e3c2 100755 --- a/public/src/Home/Doc/Print.DD.HTML +++ b/public/Wb/Home/Doc/Print.DD.HTML @@ -25,12 +25,12 @@ -
+
                                  Print Fmt Strs
 
 <fmt_arg> := %[-][0][<width>][.<decimals>][<flags>][h<aux_fmt_num>]<fmt_code>
 
-See StrPrintJoin().
+See StrPrintJoin().
 
 <flags>:
 
@@ -44,7 +44,7 @@
   For "%n", "%d" or "%u", the <aux_fmt_num> causes thousands mode.  "%h?n" will 
   pick a var exponent multiples of three unit, while "%h-3n" will display milli 
   units or "%h6n" will display mega units.  The 'k' flag is always on for "%n".  
-  See ::/Demo/Print.HC.
+  See ::/Demo/Print.HC.
   
 For "%c" or "%C", the <aux_fmt_num> repeats the char that many times.
 
@@ -53,9 +53,9 @@
   "%n" floating point in engineering notation, exponents being multiples of 
   three.  If it has a <aux_fmt> code, it will display scientific units letters.
   
-  "%S" Define() entry.
+  "%S" Define() entry.
   
-  "%C" ToUpper() character.
+  "%C" ToUpper() character.
   
   "%h25c",'\n'; 25 new-lines.
   
@@ -63,7 +63,7 @@
   
   "%F" text file by filename.
   
-  "%$F" DolDoc file in memory.
+  "%$F" DolDoc file in memory.
   
   "%p" ptr. 
   
@@ -73,14 +73,14 @@
   
   "%,P" link to ptr with no offset.
   
-  "%D" date.  Pass a CDate.
+  "%D" date.  Pass a CDate.
   
-  "%T" time.  Pass a CDate.
+  "%T" time.  Pass a CDate.
   
-  "%z" sub_entry of an enumerated list of text entries.  See LstSub().  Pass 
+  "%z" sub_entry of an enumerated list of text entries.  See LstSub().  Pass 
   sub_entry_num first, list second.
   
-  "%Z" DefineLstLoad() subentry.  Pass sub_entry_num first, define_name second.
+  "%Z" DefineLstLoad() subentry.  Pass sub_entry_num first, define_name second.
   
   "%Q" convert "\" to "\\" and quote to backslash quote. (For use in creating 
   strs in strs.)
@@ -90,53 +90,53 @@
 
                                   Print Family
 
-MStrPrint(U8 *fmt,...) is like StrPrint(U8 *dst,U8 *fmt,...) but it returns a 
-MAllocated str.  It is vary handy because you don't have to worry about 
+MStrPrint(U8 *fmt,...) is like StrPrint(U8 *dst,U8 *fmt,...) but it returns a 
+MAllocated str.  It is vary handy because you don't have to worry about 
 overflow.
 
-CatPrint(U8 *_dst,U8 *fmt,...) concatenates a formated string.
+CatPrint(U8 *_dst,U8 *fmt,...) concatenates a formated string.
 
-In(U8 *fmt,...) sends text to the current task's input buffer.
-InStr(U8 *fmt,...) sends text of an InFile to the keyboard stream of the current 
+In(U8 *fmt,...) sends text to the current task's input buffer.
+InStr(U8 *fmt,...) sends text of an InFile to the keyboard stream of the current 
 TASK but can also do mouse cmds.
 
-XTalk(CTask *task,U8 *fmt,...) and text to another task's input buffer.
-XTalkStr(CTask *task,U8 *fmt,...) sends text of an InFile to the keyboard stream 
+XTalk(CTask *task,U8 *fmt,...) and text to another task's input buffer.
+XTalkStr(CTask *task,U8 *fmt,...) sends text of an InFile to the keyboard stream 
 of another TASK but can also do mouse cmds.
 
-DocPrint(CDoc *doc,U8 *fmt,...) sends text to a document.  You can buffer to a 
+DocPrint(CDoc *doc,U8 *fmt,...) sends text to a document.  You can buffer to a 
 Doc and save it, providing the functionality of fprintf.  See 
-::/Demo/Dsk/FPrintF.HC.
+::/Demo/Dsk/FPrintF.HC.
 
-Adam(U8 *fmt,...) sends text to the Adam Task to be compiled and run.
-AdamLog(U8 *fmt,...) and AdamErr(U8 *fmt,...) send text to the Adam Task to be 
+Adam(U8 *fmt,...) sends text to the Adam Task to be compiled and run.
+AdamLog(U8 *fmt,...) and AdamErr(U8 *fmt,...) send text to the Adam Task to be 
 displayed.
 
-StreamPrint(U8 *fmt,...) sends text to the stream of code being compiled and 
+StreamPrint(U8 *fmt,...) sends text to the stream of code being compiled and 
 must reside in a #exe{} blk.
 
-GrPrint(CDC *dc,I64 x,I64 y,U8 *fmt,...) and GrVPrint() plots text in graphics 
+GrPrint(CDC *dc,I64 x,I64 y,U8 *fmt,...) and GrVPrint() plots text in graphics 
 mode.
 
-TextPrint(CTask *task,I64 x,I64 y,I64 attr,U8 *fmt,...) plots to gr.text_base.
+TextPrint(CTask *task,I64 x,I64 y,I64 attr,U8 *fmt,...) plots to gr.text_base.
 
-ExePrint(U8 *fmt,...) compiles and execute a string.  Note: It returns the res 
+ExePrint(U8 *fmt,...) compiles and execute a string.  Note: It returns the res 
 of the last executed expression.
 
-Once(U8 *fmt,...) Writes User code to Registry to be executed next boot.
+Once(U8 *fmt,...) Writes User code to Registry to be executed next boot.
 
-AOnce(U8 *fmt,...) Writes Adam code to Registry to be executed next boot.
+AOnce(U8 *fmt,...) Writes Adam code to Registry to be executed next boot.
 
-InPrint(I64 mS,U8 *fmt,...) PutChars()s one at a time with a delay.
+InPrint(I64 mS,U8 *fmt,...) PutChars()s one at a time with a delay.
 
-RawPrint(I64 mS,U8 *fmt,...) sends direct to scrn memory, bypassing window 
+RawPrint(I64 mS,U8 *fmt,...) sends direct to scrn memory, bypassing window 
 manager.
 
-User(U8 *fmt,...) Spawns a user and execute a string on start-up.
+User(U8 *fmt,...) Spawns a user and execute a string on start-up.
 
-PopUpPrint(U8 *fmt,...) compiles and execute a string in a pop-up win.  Note: It 
+PopUpPrint(U8 *fmt,...) compiles and execute a string in a pop-up win.  Note: It 
 returns the res of the last executed expression.
-PopUpViewPrint(U8 *fmt,...) creates a pop-up window and views text.
+PopUpViewPrint(U8 *fmt,...) creates a pop-up window and views text.
 
 Note: Use Print("%s",src) if you need an unmodified string.
 
diff --git a/public/src/Home/Doc/Profiler.DD.HTML b/public/Wb/Home/Doc/Profiler.DD.HTML similarity index 72% rename from public/src/Home/Doc/Profiler.DD.HTML rename to public/Wb/Home/Doc/Profiler.DD.HTML index 649b9db..b188d11 100755 --- a/public/src/Home/Doc/Profiler.DD.HTML +++ b/public/Wb/Home/Doc/Profiler.DD.HTML @@ -25,15 +25,15 @@ -
+
 The profiler records where the CPU was executing when the 1000Hz timer interrupt 
 occured, so you can learn where time is spent.
 
-Use the Prof() depth argument to record a hit in the N routines which called the 
+Use the Prof() depth argument to record a hit in the N routines which called the 
 current routine, as well.
 
-When done collecting statistics, use ProfRep() for a report.  You might need a 
-DocMax() to expand the command line window buffer to fit it all.
+When done collecting statistics, use ProfRep() for a report.  You might need a 
+DocMax() to expand the command line window buffer to fit it all.
 
 Study the code.  The profiler is very simple.  You might want to enhance it or 
 modify it to debug something in particular.
diff --git a/public/src/Home/Doc/Que.DD.HTML b/public/Wb/Home/Doc/Que.DD.HTML
similarity index 84%
rename from public/src/Home/Doc/Que.DD.HTML
rename to public/Wb/Home/Doc/Que.DD.HTML
index bcb44eb..f1d37ac 100755
--- a/public/src/Home/Doc/Que.DD.HTML
+++ b/public/Wb/Home/Doc/Que.DD.HTML
@@ -25,8 +25,8 @@
 
 
 
-
-A Queue is a bunch of MAlloc()ed chunks of mem linked together in a circle with 
+
+A Queue is a bunch of MAlloc()ed chunks of mem linked together in a circle with 
 one ptr to the next value and another ptr to the last value.  These ptrs must be 
 stored in the first locations in the structure.
 
diff --git a/public/src/Doc/Quirks.DD.HTML b/public/Wb/Home/Doc/Quirks.DD.HTML old mode 100644 new mode 100755 similarity index 70% rename from public/src/Doc/Quirks.DD.HTML rename to public/Wb/Home/Doc/Quirks.DD.HTML index ffd4f68..350a8d6 --- a/public/src/Doc/Quirks.DD.HTML +++ b/public/Wb/Home/Doc/Quirks.DD.HTML @@ -25,7 +25,7 @@ -
+
                                      Quirks
 
 * You run a risk of problems if you do file operations on the same files 
@@ -35,31 +35,31 @@
 * When using FAT32, TempleOS does not generate unique short-entry names, the 
 ones with the ~s.  Not all FAT32 filenames are valid TempleOS names and it will 
 complain.  Do not access FAT32 drives not dedicated to TempleOS.  Disable them 
-with DrvEnable(OFF), or they will generate error messages.  FAT32 involves a 
+with DrvEnable(OFF), or they will generate error messages.  FAT32 involves a 
 long and short name for each file.
 
 * The stk does not grow because virtual mem is not used.  I recommend allocating 
-large local vars from the heap.  You can change MEM_DFT_STK and recompile Kernel 
-or request more when doing a Spawn().
+large local vars from the heap.  You can change MEM_DFT_STK and recompile Kernel 
+or request more when doing a Spawn().
 
 * The syntax highlighting occassionally glitches.  The compiler doesn't.
 
-* Call DskChg() when you insert a new removable media.
+* Call DskChg() when you insert a new removable media.
 
-* Accessing CD/DVD's is flacky.  Try Drv() or DskChg() twice.
+* Accessing CD/DVD's is flacky.  Try Drv() or DskChg() twice.
 
 * You can only extern something once.  There is a varient called _extern which 
 binds a HolyC definition to a asm sym.  This, too, can only be done once.
 
-* A terminal task has a CDoc document structure that remains active even when 
-you change Fs->draw_it.  To prevent links in the CDoc from being activated when 
+* A terminal task has a CDoc document structure that remains active even when 
+you change Fs->draw_it.  To prevent links in the CDoc from being activated when 
 the user clicks in the window, do one of three things:
   
-  A) DocBottom() followed by DocClear() to clear the CDoc so it has no active 
+  A) DocBottom() followed by DocClear() to clear the CDoc so it has no active 
   widgets.
   
   B) Disable window mgr bttn click checking with Fs->win_inhibit set to mask 
-  WIF_SELF_MS_L|WIF_FOCUS_TASK_MS_L_D|WIF_SELF_MS_R|WIF_FOCUS_TASK_MS_R_D.  This 
+  WIF_SELF_MS_L|WIF_FOCUS_TASK_MS_L_D|WIF_SELF_MS_R|WIF_FOCUS_TASK_MS_R_D.  This 
   inhibits window mgr operations but still generates messages from bttn clicks.
 
 * switch/case stmts alloc a single jump table--do not use with wide, sparse 
@@ -70,9 +70,9 @@
 * A goto label name must not match a global scope object's name.  (It's not 
 worth slowing-down the compiler to handle this case.)
 
-* MemCpy() only goes fwd.
+* MemCpy() only goes fwd.
 
-* A Cd() cmd must be followed by two semicolons if a #include is after it.  This 
+* A Cd() cmd must be followed by two semicolons if a #include is after it.  This 
 is because the preprocessor processes the next token ahead.
 
 * The assembler's error msgs are often off by a line and undefines are cryptic.
diff --git a/public/src/Home/Doc/RedSea.DD.HTML b/public/Wb/Home/Doc/RedSea.DD.HTML
similarity index 77%
rename from public/src/Home/Doc/RedSea.DD.HTML
rename to public/Wb/Home/Doc/RedSea.DD.HTML
index 90060ce..bbebbbf 100755
--- a/public/src/Home/Doc/RedSea.DD.HTML
+++ b/public/Wb/Home/Doc/RedSea.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                                RedSea File System
 
 The RedSea file system is a simple, 64-bit, file system which is similar to 
@@ -44,11 +44,11 @@
 
 public class CDirEntry //64-byte fixed-size
 {
-  U16 attr;     //See RS_ATTR_DIR.  I would like to change these.
-  U8 name[CDIR_FILENAME_LEN]; //See char_bmp_filename, FileNameChk
+  U16 attr;     //See RS_ATTR_DIR.  I would like to change these.
+  U8 name[CDIR_FILENAME_LEN]; //See char_bmp_filename, FileNameChk
   I64 clus; (blk) //One sector per clus.
   I64 size;     //In bytes
-  CDate datetime; //See  DateTime, Implementation of DateTime
+  CDate datetime; //See  DateTime, Implementation of DateTime
 };
 
 public class CRedSeaBoot //RedSea is type FAT32 in partition table to fool BIOS.
@@ -64,9 +64,9 @@
   U16 signature2;       //0xAA55
 };
 
-See ::/Kernel/BlkDev/FileSysRedSea.HC and ::/Adam/Opt/Boot/DskISORedSea.HC.
+See ::/Kernel/BlkDev/FileSysRedSea.HC and ::/Adam/Opt/Boot/DskISORedSea.HC.
 
-Files with names ending in .Z are compressed.  See ::/Kernel/Compress.HC.
+Files with names ending in .Z are compressed.  See ::/Kernel/Compress.HC.
 
 To replace ISO9660, make hard-drive partition image of a measured size and copy 
 onto a CD/DVD starting at about sector 20, with EL TORITO booting.  512-byte 
@@ -75,8 +75,8 @@
 
 RedSea file system has no bad block table and no redundant allocation table.
 
-See Block Chain for RedSea allocation bitmap discussion.
+See Block Chain for RedSea allocation bitmap discussion.
 
-See Reliability for RedSea reliability discussion.
+See Reliability for RedSea reliability discussion.
 
diff --git a/public/src/Home/Doc/Reliability.DD.HTML b/public/Wb/Home/Doc/Reliability.DD.HTML similarity index 94% rename from public/src/Home/Doc/Reliability.DD.HTML rename to public/Wb/Home/Doc/Reliability.DD.HTML index d1ba7e4..474c946 100755 --- a/public/src/Home/Doc/Reliability.DD.HTML +++ b/public/Wb/Home/Doc/Reliability.DD.HTML @@ -25,7 +25,7 @@ -
+
                                RedSea Reliability
 
 TempleOS is like the 1040EZ tax form compared to the full 1040 form.  Obviously, 
@@ -43,7 +43,7 @@
 Obviously, we don't do bad block tables, or redundant FATs.
 
 We use the simplest possible technique, a contiguous-file-only allocation 
-bitmap, not Block Chains or FAT tables.
+bitmap, not Block Chains or FAT tables.
 
 You can be a good toy or you can be a good professional tool, but not both.  
 TempleOS's file manager will start too slowly once a few thousand files exist 
diff --git a/public/src/Doc/Requirements.DD.HTML b/public/Wb/Home/Doc/Requirements.DD.HTML
old mode 100644
new mode 100755
similarity index 97%
rename from public/src/Doc/Requirements.DD.HTML
rename to public/Wb/Home/Doc/Requirements.DD.HTML
index 6889589..0844f62
--- a/public/src/Doc/Requirements.DD.HTML
+++ b/public/Wb/Home/Doc/Requirements.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                            Requirements for TempleOS
 
 User Skills Required
diff --git a/public/src/Home/Doc/Resource.DD.HTML b/public/Wb/Home/Doc/Resource.DD.HTML
similarity index 75%
rename from public/src/Home/Doc/Resource.DD.HTML
rename to public/Wb/Home/Doc/Resource.DD.HTML
index 1ba3dda..c2c19e5 100755
--- a/public/src/Home/Doc/Resource.DD.HTML
+++ b/public/Wb/Home/Doc/Resource.DD.HTML
@@ -25,15 +25,15 @@
 
 
 
-
+
                           Graphic Sprite Resource Help
 
 A sprite is an ordered list of elements such as lines, rectangles, bitmaps and 
 color changes.  In a program's source code, you first make a sprite somewhere 
 outside a function.  Then, you insert a pointer to the sprite as an "*elems" arg 
-when calling Sprite() or Sprite3().  See Sprites.
+when calling Sprite() or Sprite3().  See Sprites.
 
-You can create a sprite macro on your PersonalMenu with a payload of HolyC 
+You can create a sprite macro on your PersonalMenu with a payload of HolyC 
 source code to execute when it ESC's back to the cmd line.  If you check 
 "Pop-Up", it will spawn a new task and run the payload.  A pop-up macro can be 
 placed in any document.
diff --git a/public/src/Doc/ScopingLinkage.DD.HTML b/public/Wb/Home/Doc/ScopingLinkage.DD.HTML
old mode 100644
new mode 100755
similarity index 84%
rename from public/src/Doc/ScopingLinkage.DD.HTML
rename to public/Wb/Home/Doc/ScopingLinkage.DD.HTML
index 0904578..053709e
--- a/public/src/Doc/ScopingLinkage.DD.HTML
+++ b/public/Wb/Home/Doc/ScopingLinkage.DD.HTML
@@ -25,10 +25,10 @@
 
 
 
-
+
                               Scoping and Linkage
 
-JIT Compile Mode makes use of the current task's hash sym table and its parent 
+JIT Compile Mode makes use of the current task's hash sym table and its parent 
 tasks' tables.  It fetches syms from parent tasks' tables if not found locally 
 in the current task's table and it places new syms in the current task's table.  
 Conceptually, syms are at the scope of environment vars in other operating 
@@ -39,25 +39,25 @@
 especially in asm blks.  Dupicates are allowed, by design in other cases, so 
 that you can repeatedly #include the same file from the cmd line while 
 developing it.  Or, so you can repeatedly declare a function with a standard 
-name, like DrawIt().  This case might occur when the Adam Task is starting-up 
+name, like DrawIt().  This case might occur when the Adam Task is starting-up 
 loading-in many little utilities.
 
-extern binds a new HTT_FUN or HTT_GLBL_VAR sym to an existing sym of the same 
+extern binds a new HTT_FUN or HTT_GLBL_VAR sym to an existing sym of the same 
 name if it exists in the sym table (just in just-in-time code).  It also can be 
 used to generate a fwd reference.
 
-import binds a new HTT_FUN or HTT_GLBL_VAR sym to a sym of the same name 
-imported from the task's sym table at Load() time.  If no sym exists to bind to 
-at Load() time, the code using this sym will be left incomplete until the sym is 
+import binds a new HTT_FUN or HTT_GLBL_VAR sym to a sym of the same name 
+imported from the task's sym table at Load() time.  If no sym exists to bind to 
+at Load() time, the code using this sym will be left incomplete until the sym is 
 defined.
 
 
-_extern binds a new HTT_FUN or HTT_GLBL_VAR sym to an existing sym, of a differe
+_extern binds a new HTT_FUN or HTT_GLBL_VAR sym to an existing sym, of a differe
 nt name.  It must exists in the sym table.  Basically, this binds C to asm.
 
-_import binds a new HTT_FUN or HTT_GLBL_VAR sym to a sym, of a different name 
-imported from the task's sym table at Load() time.  If no sym exists to bind to 
-at Load() time, the code using this sym will be left incomplete until the sym is 
+_import binds a new HTT_FUN or HTT_GLBL_VAR sym to a sym, of a different name 
+imported from the task's sym table at Load() time.  If no sym exists to bind to 
+at Load() time, the code using this sym will be left incomplete until the sym is 
 defined.  Basically, this binds C to asm from elsewhere.
 
 
@@ -162,16 +162,16 @@
 
 * The sizeof() and HolyC structure members can be used in asm blks.
 
-* Using &i in HolyC or i.u8[2] on a local var, i, will force it to noreg.
+* Using &i in HolyC or i.u8[2] on a local var, i, will force it to noreg.
 
 * Using try/catch in a function will force all local vars to noreg.
 
 * An unused gap on the stk is left for reg vars.
 
 * Note: static function vars do not go on the data heap, no matter the setting 
-of the OPTf_GLBLS_ON_DATA_HEAP.  They may in the future.
+of the OPTf_GLBLS_ON_DATA_HEAP.  They may in the future.
 
-* OPTf_EXTERNS_TO_IMPORTS will treat _extern as _import and extern as import.  
+* OPTf_EXTERNS_TO_IMPORTS will treat _extern as _import and extern as import.  
 This allows a header to be used either as a JIT compiled or AOT compiled header.
 
diff --git a/public/src/Home/Doc/Snd.DD.HTML b/public/Wb/Home/Doc/Snd.DD.HTML similarity index 82% rename from public/src/Home/Doc/Snd.DD.HTML rename to public/Wb/Home/Doc/Snd.DD.HTML index 60e28d8..aa0e6f0 100755 --- a/public/src/Home/Doc/Snd.DD.HTML +++ b/public/Wb/Home/Doc/Snd.DD.HTML @@ -25,9 +25,9 @@ -
+
 Sound is generated with I8 vals called ona's, which are 88 piano key nums, with 
-0 as a rest.  See Note2Ona() and Ona2Freq().  God does not want death screams, 
+0 as a rest.  See Note2Ona() and Ona2Freq().  God does not want death screams, 
 perhaps, because God has PTSD or soldiers have PTSD.  (Imagine wounded on 
 battlefields.)  Ona's will allow elegant wave files for export and will allow 
 the creation of simple hardware over the next centuries.
diff --git a/public/src/Doc/Sprite.DD.HTML b/public/Wb/Home/Doc/Sprite.DD.HTML
old mode 100644
new mode 100755
similarity index 57%
rename from public/src/Doc/Sprite.DD.HTML
rename to public/Wb/Home/Doc/Sprite.DD.HTML
index eb0d77c..3c914b6
--- a/public/src/Doc/Sprite.DD.HTML
+++ b/public/Wb/Home/Doc/Sprite.DD.HTML
@@ -25,18 +25,18 @@
 
 
 
-
-A CSprite is an ordered list of these elements, created with <CTRL-r>.  
+
+A CSprite is an ordered list of these elements, created with <CTRL-r>.  
 Normally, they are packed together in a list and the address of the first is 
 passed to routines.
 
-See ::/Demo/Graphics/SpritePlot.HC, ::/Demo/Graphics/SpritePlot3D.HC, 
-::/Demo/Graphics/SpritePut.HC, ::/Demo/Graphics/SpriteRaw.HC and SpriteMeshEd().
+See ::/Demo/Graphics/SpritePlot.HC, ::/Demo/Graphics/SpritePlot3D.HC, 
+::/Demo/Graphics/SpritePut.HC, ::/Demo/Graphics/SpriteRaw.HC and SpriteMeshEd().
 
 Be aware that copying SP, IB, or IS entries with the clip results in duplicate 
 entries with different nums.  You can manually remove dups by editing with <CTRL
 -t> and setting to the original num.
 
-See ::/Adam/Gr/GrSpritePlot.HC for how CSprite are stored.
+See ::/Adam/Gr/GrSpritePlot.HC for how CSprite are stored.
 
diff --git a/public/src/Doc/SpriteBitMap.DD.HTML b/public/Wb/Home/Doc/SpriteBitMap.DD.HTML old mode 100644 new mode 100755 similarity index 96% rename from public/src/Doc/SpriteBitMap.DD.HTML rename to public/Wb/Home/Doc/SpriteBitMap.DD.HTML index 0c39dff..1c9cfe9 --- a/public/src/Doc/SpriteBitMap.DD.HTML +++ b/public/Wb/Home/Doc/SpriteBitMap.DD.HTML @@ -25,7 +25,7 @@ -
+
                             Sprite BitMap Menu Help
 
 BitMaps have a background color.  If you delete to the clip, what's left will be 
diff --git a/public/src/Home/Doc/SpriteEd.DD.HTML b/public/Wb/Home/Doc/SpriteEd.DD.HTML
similarity index 91%
rename from public/src/Home/Doc/SpriteEd.DD.HTML
rename to public/Wb/Home/Doc/SpriteEd.DD.HTML
index 674190a..ce88b30 100755
--- a/public/src/Home/Doc/SpriteEd.DD.HTML
+++ b/public/Wb/Home/Doc/SpriteEd.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                              Sprite Edit Menu Help
 
 Order of elements matters.  They are executed in the order they appear in the 
@@ -37,6 +37,6 @@
 
 Insert Shift Suborigin is an element which shifts subsequent elements.  Perhaps, 
 you inserted a sprite's elements from the clip and want to shift it around?  
-This command is also useful if you call SpriteInterpolate() in programs.
+This command is also useful if you call SpriteInterpolate() in programs.
 
diff --git a/public/src/Home/Doc/SpriteEdText.DD.HTML b/public/Wb/Home/Doc/SpriteEdText.DD.HTML similarity index 85% rename from public/src/Home/Doc/SpriteEdText.DD.HTML rename to public/Wb/Home/Doc/SpriteEdText.DD.HTML index be7be7b..702299a 100755 --- a/public/src/Home/Doc/SpriteEdText.DD.HTML +++ b/public/Wb/Home/Doc/SpriteEdText.DD.HTML @@ -25,9 +25,9 @@ -
+
                             Sprite Edit as Text Help
 
-See the format for CSprites.
+See the format for CSprites.
 
diff --git a/public/src/Doc/SpriteMain.DD.HTML b/public/Wb/Home/Doc/SpriteMain.DD.HTML old mode 100644 new mode 100755 similarity index 97% rename from public/src/Doc/SpriteMain.DD.HTML rename to public/Wb/Home/Doc/SpriteMain.DD.HTML index 1eb63e1..97d928a --- a/public/src/Doc/SpriteMain.DD.HTML +++ b/public/Wb/Home/Doc/SpriteMain.DD.HTML @@ -25,7 +25,7 @@ -
+
                              Sprite Main Menu Help
 
 Order of elements matters.  They are executed in the order they appear in the 
diff --git a/public/src/Doc/SpriteSideBar.DD.HTML b/public/Wb/Home/Doc/SpriteSideBar.DD.HTML
old mode 100644
new mode 100755
similarity index 96%
rename from public/src/Doc/SpriteSideBar.DD.HTML
rename to public/Wb/Home/Doc/SpriteSideBar.DD.HTML
index 3f12be9..fefacdc
--- a/public/src/Doc/SpriteSideBar.DD.HTML
+++ b/public/Wb/Home/Doc/SpriteSideBar.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                               Sprite SideBar Help
 
 You can cut and paste elements in this side-bar to reorder, delete or 
diff --git a/public/src/Home/Doc/StandBy.DD.HTML b/public/Wb/Home/Doc/StandBy.DD.HTML
similarity index 89%
rename from public/src/Home/Doc/StandBy.DD.HTML
rename to public/Wb/Home/Doc/StandBy.DD.HTML
index 9fc6b37..ad3d3a8 100755
--- a/public/src/Home/Doc/StandBy.DD.HTML
+++ b/public/Wb/Home/Doc/StandBy.DD.HTML
@@ -25,10 +25,10 @@
 
 
 
-
+
                            AutoComplete is in StandBy
 
-                            System Keys Quick Guide
+                            System Keys Quick Guide
                                (Works Everywhere)
   <SPACE>   Left-Click  
   <ENTER>   Right-Click  
@@ -38,7 +38,7 @@
 <SHIFT-ESC> Abort & Exit
  <WINDOWS>  Pull-Down Menu
 
-                                    Tongues
+                                    Tongues
                                (Works Everywhere)
    <F7>     God Word
 <SHIFT-F7>  God Passage
diff --git a/public/src/Doc/Start.DD.HTML b/public/Wb/Home/Doc/Start.DD.HTML
old mode 100644
new mode 100755
similarity index 80%
rename from public/src/Doc/Start.DD.HTML
rename to public/Wb/Home/Doc/Start.DD.HTML
index 546c5a4..d4a6557
--- a/public/src/Doc/Start.DD.HTML
+++ b/public/Wb/Home/Doc/Start.DD.HTML
@@ -25,11 +25,11 @@
 
 
 
-
+
                                  TempleOS V5.03
 
                          Public Domain Operating System
 
-Help & Index, Quick Start: Cmd line
+Help & Index, Quick Start: Cmd line
 
diff --git a/public/src/Home/Doc/StdOutTask.DD.HTML b/public/Wb/Home/Doc/StdOutTask.DD.HTML similarity index 77% rename from public/src/Home/Doc/StdOutTask.DD.HTML rename to public/Wb/Home/Doc/StdOutTask.DD.HTML index f5d070d..7fd357d 100755 --- a/public/src/Home/Doc/StdOutTask.DD.HTML +++ b/public/Wb/Home/Doc/StdOutTask.DD.HTML @@ -25,10 +25,10 @@ -
-There is one CDoc for the task's border: Fs->border_doc.  There is a pair for 
+
+There is one CDoc for the task's border: Fs->border_doc.  There is a pair for 
 the task's client area: Fs->put_doc and Fs->display_doc.  You can, optionally, 
 do double buffering, otherwise Fs->put_doc is the same as Fs->display_doc.  See 
-::/Demo/Spy.HC.
+::/Demo/Spy.HC.
 
diff --git a/public/src/Doc/StdTempleOSPC.DD.HTML b/public/Wb/Home/Doc/StdTempleOSPC.DD.HTML old mode 100644 new mode 100755 similarity index 98% rename from public/src/Doc/StdTempleOSPC.DD.HTML rename to public/Wb/Home/Doc/StdTempleOSPC.DD.HTML index 8662b53..e1d76bc --- a/public/src/Doc/StdTempleOSPC.DD.HTML +++ b/public/Wb/Home/Doc/StdTempleOSPC.DD.HTML @@ -25,12 +25,12 @@ -
+
                             The Standard TempleOS PC
 
 All desktop PCs will have 8-channel OCTART super-simple high speed serial ports 
 to replace USB.  They are simpler because the driver is as simple as old school 
-RS232 Serial, they have no USB end-points and they have no USB human interface 
+RS232 Serial, they have no USB end-points and they have no USB human interface 
 device reports.  Computer mice will all have exactly two bttns and one wheel.  
 Game controllers will all be the standard deluxe game console controllers that 
 are popular today.  It will have 8 big TX and 8 big RX fifos that allow flow 
diff --git a/public/src/Doc/Strategy.DD.HTML b/public/Wb/Home/Doc/Strategy.DD.HTML
old mode 100644
new mode 100755
similarity index 86%
rename from public/src/Doc/Strategy.DD.HTML
rename to public/Wb/Home/Doc/Strategy.DD.HTML
index f81b2a1..b184253
--- a/public/src/Doc/Strategy.DD.HTML
+++ b/public/Wb/Home/Doc/Strategy.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                         Decisions Making TempleOS Simple
 
 Everybody is obsessed, Jedi mind-tricked, by the notion that when you scale-up, 
@@ -58,7 +58,7 @@
 Linux and Windows are general purpose operating systems.  They attempt to do any 
 task you want.  TempleOS cherry-picks tasks and is designed to do the same 
 things a C64 did.  This saves and order of magnitude complexity.  For example, 
-the RedSea file system allocates just contiguous files -- you load and save 
+the RedSea file system allocates just contiguous files -- you load and save 
 whole files at once.  A benefit is this allows compression.  Also, TempleOS does 
 not do networking or multimedia.  In theory, memory will fragment with lots of 
 big files.  The system would fall to pieces with multimedia, but God said 
@@ -103,7 +103,7 @@
 
 * Whole files are processed almost exclusively, allowing compression.
 
-* One language and compiler for command-line, scripts, songs, automations and 
+* One language and compiler for command-line, scripts, songs, automations and 
 code.
 
 * One editor/word processor/browser for the command-line window, source code, 
@@ -114,10 +114,10 @@
 
 * No distinction between thread, process or task.
 
-* The Scheduler is for home systems.  It is not preemptiove.  Disk requests are 
+* The Scheduler is for home systems.  It is not preemptiove.  Disk requests are 
 not broken-up, so sharing is bad.  It's wonderfully simple.
 
-* MultiCore is done master/slave, instead of SMP.  Core0 applications explicitly 
+* MultiCore is done master/slave, instead of SMP.  Core0 applications explicitly 
 assigns jobs.  Locks are present allowing multicore file, heap, and hardware 
 access, though.
 
@@ -130,8 +130,8 @@
 you'll need waiting in it's table.  No need to #include headers.
 
 * No need for namespaces -- scoping occurs automatically based on task symbol 
-table hierarchy with the Adam Task's symbol system-wide global.
+table hierarchy with the Adam Task's symbol system-wide global.
 
-* Sometimes, I cut corners in the interest of keeping the code beautiful.
+* Sometimes, I cut corners in the interest of keeping the code beautiful.
 
diff --git a/public/src/Home/Doc/Streams.DD.HTML b/public/Wb/Home/Doc/Streams.DD.HTML similarity index 66% rename from public/src/Home/Doc/Streams.DD.HTML rename to public/Wb/Home/Doc/Streams.DD.HTML index 3a4aecf..fbcfea4 100755 --- a/public/src/Home/Doc/Streams.DD.HTML +++ b/public/Wb/Home/Doc/Streams.DD.HTML @@ -25,23 +25,23 @@ -
+
 There are no streams in the traditional sense.  The cmd line output gets sent to 
 the cursor location of a document being edited and by using cursor keys, text 
 can be injected all over the document.  Sprites can be injected and are not 
 serialized!  Furthermore, the input can come from triggering macro widgets.  See 
-Doc Overview and Doc Routines.
+Doc Overview and Doc Routines.
 
-If you had a remote term and sent key Scan Codes, the user would press <CTRL-m> 
+If you had a remote term and sent key Scan Codes, the user would press <CTRL-m> 
 to access his Personal Menu to trigger his macros.  However, the local 
-~/PersonalMenu.DD might differ from the remote, causing loss of sync between 
+~/PersonalMenu.DD might differ from the remote, causing loss of sync between 
 local and remote sessions.  Also, the window size of local and remote might 
 differ, so word-wrapped text would be different.  Injecting output text with 
 different windows sizes would cause remote and local documents to not be in 
 sync.
 
-See Char Overview and Char Routines.
+See Char Overview and Char Routines.
 
-You can send characters into StdIn.  See In(), XTalk() and InFile.
+You can send characters into StdIn.  See In(), XTalk() and InFile.
 
diff --git a/public/src/Home/Doc/TOSZ.DD.HTML b/public/Wb/Home/Doc/TOSZ.DD.HTML similarity index 96% rename from public/src/Home/Doc/TOSZ.DD.HTML rename to public/Wb/Home/Doc/TOSZ.DD.HTML index b68725f..68925ea 100755 --- a/public/src/Home/Doc/TOSZ.DD.HTML +++ b/public/Wb/Home/Doc/TOSZ.DD.HTML @@ -25,7 +25,7 @@ -
+
                                Linux TOSZ Utility
 
 
diff --git a/public/Wb/Home/Doc/TextBase.DD.HTML b/public/Wb/Home/Doc/TextBase.DD.HTML
new file mode 100755
index 0000000..b62ec1e
--- /dev/null
+++ b/public/Wb/Home/Doc/TextBase.DD.HTML
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+gr.text_base must be updated 30fps in your Fs->draw_it() callback.  You probably 
+want GrPrint() or just Print().  The DolDoc code takes care of plotting text to 
+gr.text_base.
+
+Bits 0-7        8-Bit ASCII Scrn Code
+Bits 8-11       Foreground color
+Bits 12-15      Background color
+Bits 16-20      Signed X pos shift val
+Bits 21-25      Signed Y pos shift val
+Bit  28         Blink
+Bit  29         Inverted (Swap foreground and background)
+Bit  30         Sel (XOR colors with FF)
+Bit  31         Underline
+
+GrUpdateTaskWin() calls DocUpdateTaskDocs() which calls DocRecalc() where the 
+document text is plotted into gr.text_base.  Then, GrUpdateTextBG() and 
+GrUpdateTextFG() render the gr.text_base onto gr.dc2, a raw graphic bitmap.
+
+See ::/Demo/Games/Maze.HC.
+
+ diff --git a/public/src/Home/Doc/TimeCycles.DD.HTML b/public/Wb/Home/Doc/TimeCycles.DD.HTML similarity index 83% rename from public/src/Home/Doc/TimeCycles.DD.HTML rename to public/Wb/Home/Doc/TimeCycles.DD.HTML index 47b21e7..5e1c0ab 100755 --- a/public/src/Home/Doc/TimeCycles.DD.HTML +++ b/public/Wb/Home/Doc/TimeCycles.DD.HTML @@ -25,9 +25,9 @@ -
+
 Intel/AMD have an inst that returns the num of CPU cycles since boot.  This is 
 not a steady, calibrated real time value.  TempleOS measures it and you can 
-convert with cnts.time_stamp_freq, a value continuously calibrated from other 
+convert with cnts.time_stamp_freq, a value continuously calibrated from other 
 cnts.
diff --git a/public/src/Doc/TimeDate.DD.HTML b/public/Wb/Home/Doc/TimeDate.DD.HTML old mode 100644 new mode 100755 similarity index 74% rename from public/src/Doc/TimeDate.DD.HTML rename to public/Wb/Home/Doc/TimeDate.DD.HTML index 09ae288..528e5e8 --- a/public/src/Doc/TimeDate.DD.HTML +++ b/public/Wb/Home/Doc/TimeDate.DD.HTML @@ -25,12 +25,12 @@ -
-TempleOS uses a 64-bit value, CDate, for date/time.  The upper 32-bits are the 
+
+TempleOS uses a 64-bit value, CDate, for date/time.  The upper 32-bits are the 
 days since Christ.  The lower 32-bits store time of day divided by 4 billion 
-which works out to 49710ths of a second.  You can subtract two CDate's to get a 
+which works out to 49710ths of a second.  You can subtract two CDate's to get a 
 time span.
 
-Use CDATE_FREQ to convert.
+Use CDATE_FREQ to convert.
 
diff --git a/public/src/Home/Doc/TimeHPET.DD.HTML b/public/Wb/Home/Doc/TimeHPET.DD.HTML similarity index 73% rename from public/src/Home/Doc/TimeHPET.DD.HTML rename to public/Wb/Home/Doc/TimeHPET.DD.HTML index c26fc88..bf95d30 100755 --- a/public/src/Home/Doc/TimeHPET.DD.HTML +++ b/public/Wb/Home/Doc/TimeHPET.DD.HTML @@ -25,9 +25,9 @@ -
-The HPET, high precision event timer, is read with HPET() and has a frequency of 
-cnts.HPET_freq.  A typical freq value is 14.3 Mhz  It might not be available on 
+
+The HPET, high precision event timer, is read with HPET() and has a frequency of 
+cnts.HPET_freq.  A typical freq value is 14.3 Mhz  It might not be available on 
 all systems.
 
diff --git a/public/src/Home/Doc/TimeJiffy.DD.HTML b/public/Wb/Home/Doc/TimeJiffy.DD.HTML similarity index 55% rename from public/src/Home/Doc/TimeJiffy.DD.HTML rename to public/Wb/Home/Doc/TimeJiffy.DD.HTML index 7c3bebd..5eebdd1 100755 --- a/public/src/Home/Doc/TimeJiffy.DD.HTML +++ b/public/Wb/Home/Doc/TimeJiffy.DD.HTML @@ -25,13 +25,13 @@ -
-One jiffy is one time slice.  cnts.jiffies returns time slices since boot.
+
+One jiffy is one time slice.  cnts.jiffies returns time slices since boot.
 
-SysTimerRead reads the timer ticks since boot.  It's not as fast as GetTSC.
+SysTimerRead reads the timer ticks since boot.  It's not as fast as GetTSC.
 
-Use JIFFY_FREQ to convert cnts.jiffies.
+Use JIFFY_FREQ to convert cnts.jiffies.
 
-Use SYS_TIMER_FREQ to convert SysTimerRead.
+Use SYS_TIMER_FREQ to convert SysTimerRead.
 
diff --git a/public/src/Doc/Tips.DD.HTML b/public/Wb/Home/Doc/Tips.DD.HTML old mode 100644 new mode 100755 similarity index 58% rename from public/src/Doc/Tips.DD.HTML rename to public/Wb/Home/Doc/Tips.DD.HTML index 93e931b..13deb38 --- a/public/src/Doc/Tips.DD.HTML +++ b/public/Wb/Home/Doc/Tips.DD.HTML @@ -25,38 +25,38 @@ -
+
                                       Tips
 
 * Turn-off or reboot (<CTRL-ALT-DEL>) at any time, except during disk writes.  
 Writes are not cached. 
 
-* Use Seed() and the cmd line to switch Rand() to non-timer mode and replay 
+* Use Seed() and the cmd line to switch Rand() to non-timer mode and replay 
 games you like.
 
 * 64-bit values are most efficient for the compiler.
 
-* See Key Map for a list of defined keys.  Define your own keys in MyPutKey().  
+* See Key Map for a list of defined keys.  Define your own keys in MyPutKey().  
 See Keyboard Devices.
 
 * <ALT-m> maximizes a window.  <ALT-SHIFT-w> closes AutoComplete.  <ALT-w> 
 brings back AutoComplete.  <ALT-v> vertically tiles windows.  <ALT-h> 
-horizontally tiles windows.  The ALT keys are defined in ~/HomeKeyPlugIns.HC.  
+horizontally tiles windows.  The ALT keys are defined in ~/HomeKeyPlugIns.HC.  
 You can customize them.
 
 * If you make changes to TempleOS files in your /Home directory, generally you 
 reboot to make them take effect.  (You don't compile anything.)  You should have 
 two TempleOS partitions on your hard drive because a syntax error in a start-up 
 file will make the partition unbootable.  Boot to the second partition or boot 
-to a standard TempleOS CD/DVD and use Mount() to mount your hard drive.
+to a standard TempleOS CD/DVD and use Mount() to mount your hard drive.
 
-* I copy my files to a mirrored ident partition, periodically with CopyTree() 
+* I copy my files to a mirrored ident partition, periodically with CopyTree() 
 commands in scripts.  I do merge commands with a menu entry like this:
 Merge(\"C:/*\",\"D:/*\",\"+r+d\"); to check my changes.
 
 * <CTRL-m> at the cmd line to access your PersonalMenu.  Place macros there with 
 <CTRL-l>, or icon-like sprites with <CTRL-r>.  Use the Pop-Up option on macros 
-to Spawn() a task to run a file.  It dies when it is finished.  This returns mem 
+to Spawn() a task to run a file.  It dies when it is finished.  This returns mem 
 to the system.  Be sure to press <CTRL-s> to save your macro/menu area after 
 making changes.
 
@@ -68,12 +68,12 @@
 the keyboard controls to games.
 
 * You can adjust the mouse movement rate by setting global vars in your start-up 
-file.  See mouse scale.
+file.  See mouse scale.
 
-* You can set your local time zone by setting the local_time_offset global var 
-in a start-up file.  It's units are CDATE_FREQ.  See local time.
+* You can set your local time zone by setting the local_time_offset global var 
+in a start-up file.  It's units are CDATE_FREQ.  See local time.
 
-* <CTRL-SHIFT-L> in the editor to reindent a HolyC function or renumber an asm 
+* <CTRL-SHIFT-L> in the editor to reindent a HolyC function or renumber an asm 
 routine's local labels.
 
 * You can use filter_lines in the editor text search form (<CTRL-f>) to 
@@ -81,76 +81,76 @@
 5 will display lines within 5 lines of matches.  Then, you can do another find 
 to a different string and achieve a AND search.  When finished, press <ESC>.
  
-* You can recompile and reinstall the kernel with BootHDIns().  You'll probably 
-want to make a function for recompiling that uses the In() function to answer 
-the cfg questions.  See my technique Cfg Strs, Update Funs.
+* You can recompile and reinstall the kernel with BootHDIns().  You'll probably 
+want to make a function for recompiling that uses the In() function to answer 
+the cfg questions.  See my technique Cfg Strs, Update Funs.
 
-* Scale2Mem(min,max,limit=2*1024*1024*1024) can be used for cfg questions when 
-recompiling.  The BootHDIns() cfg prompts accept expressions, not just numbers.  
+* Scale2Mem(min,max,limit=2*1024*1024*1024) can be used for cfg questions when 
+recompiling.  The BootHDIns() cfg prompts accept expressions, not just numbers.  
 The dft disk cache is Scale2Mem(0x80000,0x8000000).
 
-* You can permanently disable AutoComplete commenting-out ACInit() in 
-~/HomeSys.HC.
+* You can permanently disable AutoComplete commenting-out ACInit() in 
+~/HomeSys.HC.
 
 * Boolean expressions not in if stmts don't have short circuit logic and are 
 compiled inefficiently.
 
-* You can use progress1-progress4 in your programs for whatever you like.  
+* You can use progress1-progress4 in your programs for whatever you like.  
 They're just global vars that are shown on the wallpaper.  The original intent 
 was to indicate how far along operations were.  There's no coordination, so 
 different apps might interfere.  I use them most for debugging--just values 
-easily viewed.  See ::/Demo/Progress.HC.
+easily viewed.  See ::/Demo/Progress.HC.
 
-* Use DocMax() to adjust the size of the cmd line buf.  It counts CDoc entries, 
+* Use DocMax() to adjust the size of the cmd line buf.  It counts CDoc entries, 
 not lines.
 
 * Many data structures have a user_data member.  Those are available for you to 
-store a data item, for convenience.  CTask, CDocEntry and CDirEntry have them.  
+store a data item, for convenience.  CTask, CDocEntry and CDirEntry have them.  
 You shouldn't encounter conflicts with TempleOS using them.
 
 * If, for some strange reason, you wanted to reduce mem usage, make a smaller 
 disk cache when you recompile the kernel; disabling AutoComplete; Specify 
-smaller stk sizes when doing Spawn(), chang MEM_DFT_STK, and using DocMax() to 
+smaller stk sizes when doing Spawn(), chang MEM_DFT_STK, and using DocMax() to 
 reduce the cmd line buffer size.
 
 * Filenames ending in ".Z" will be automatically compressed and uncompressed 
 when read or written.  The compression method is not supported by other 
-operating systems.  You can store files uncompressed by Move()ing them to a 
-filename not ending in ".Z".  See ::/Doc/TOSZ.DD if you want to uncompress while 
+operating systems.  You can store files uncompressed by Move()ing them to a 
+filename not ending in ".Z".  See ::/Doc/TOSZ.DD if you want to uncompress while 
 in Linux.
 
-* Merge() can be used to see what's changed.  The +d flag will show differences 
+* Merge() can be used to see what's changed.  The +d flag will show differences 
 of files which have changed and allow you to merge code.  (The +r flag will 
 recurse.)
 
-* There is a utility LinkChk() which will check for broken links in 
+* There is a utility LinkChk() which will check for broken links in 
 documentation.
 
-* You can use Option(OPTf_WARN_PAREN,ON) to find unnecessary parentheses in 
+* You can use Option(OPTf_WARN_PAREN,ON) to find unnecessary parentheses in 
 code.
 
-* You can use Option(OPTf_WARN_DUP_TYPES,ON) to find unnecessary local var type 
+* You can use Option(OPTf_WARN_DUP_TYPES,ON) to find unnecessary local var type 
 stmts.
 
-* Option(OPTf_ECHO,ON) can be placed in StartOS.HC to echo start-up scripts.
+* Option(OPTf_ECHO,ON) can be placed in StartOS.HC to echo start-up scripts.
 
-* Use Plain() to edit a plain text file.  You'll need this if your file has $'s. 
- Use the ToDolDoc() utility to convert plain text to DolDoc's by doubling $'s.
+* Use Plain() to edit a plain text file.  You'll need this if your file has $'s. 
+ Use the ToDolDoc() utility to convert plain text to DolDoc's by doubling $'s.
 
-* Use Silent() to disable scrn text output.
+* Use Silent() to disable scrn text output.
 
 * Grab-scroll any window at any time with {CTRL-LEFT-MOUSE-DRAG}.  Null 
 grab-scrolling with {CTRL-RIGHT-MOUSE}.
 
 * Use <CTRL-ALT-z> to zoom-in and <CTRL-ALT-SHIFT-Z> to zoom-out.  You can 
-scroll by moving to the edge of the window.  Set gr.continuous_scroll to TRUE if 
+scroll by moving to the edge of the window.  Set gr.continuous_scroll to TRUE if 
 you want. 
 
 * Use <CTRL-ALT-g> and <CTRL-ALT-SHIFT-G> to display a grid on the scrn.
 
 * Use <CTRL-ALT-a> to enter an extended ASCII char.
 
-* Use <CTRL-ALT-f> to toggle between Std Font and Cyrillic Font.
+* Use <CTRL-ALT-f> to toggle between Std Font and Cyrillic Font.
 
 * Use <CTRL-ALT-s> will capture the scrn as a sprite on the clip.  You can save 
 the cmd line doc as text with <CTRL-a>.
@@ -161,13 +161,13 @@
 Press 't' for transparent.
 
 * There are handy functions--F(),R(),FD() and RD() which are defined in 
-~/HomeWrappers.HC.  You are encouraged to change them and add more.  They will 
+~/HomeWrappers.HC.  You are encouraged to change them and add more.  They will 
 perform find-and-replace operations accross multiple files.  The +l flag is 
 particularly useful since it limits to whole labels.  The +lb and +la flags 
 limit to whole labels just before or after.  You are encouraged to add or modify 
 handy wrapper functions to make cmd line operations easier.
 
-* When using Find() while modifying code, work from the bottom-up so that line 
+* When using Find() while modifying code, work from the bottom-up so that line 
 numbers are correct.  If you work top-down, then inserting or deleting lines 
 causes the lower file links will be incorrect.
 
@@ -182,21 +182,21 @@
 
 * There is a feature of the precompiler that allows code to be executed in the 
 middle of compilation and data inserted into the compilation stream.  Click here 
-for an example: #exe {.
+for an example: #exe {.
 
 * If you output to the cmd line and wish to allow users to scroll around and 
-view data, you can use View().
+view data, you can use View().
 
-* Use View() in Pop-up macros to linger until the user presses <ESC> or <SHIFT-E
+* Use View() in Pop-up macros to linger until the user presses <ESC> or <SHIFT-E
 SC>.
 
-* You can access the word under the cursor at ac.cur_word.
+* You can access the word under the cursor at ac.cur_word.
 
 * You can reactivate AutoComplete after closing it by pressing <CTRL-Fun Key> or 
 <ALT-w> if you have it defined.
 
-* <CTRL-SHIFT-T> to toggle to/from plain text just the CDoc cmd under the 
-cursor.  See ::/Demo/DolDoc/TextDemo.HC.
+* <CTRL-SHIFT-T> to toggle to/from plain text just the CDoc cmd under the 
+cursor.  See ::/Demo/DolDoc/TextDemo.HC.
  
 * If you toggle to plain text when you are working with graphics in a document, 
 you can add duplicate entries for sprites by entering a $SP...$ cmd with the 
@@ -208,7 +208,7 @@
 
 * I use spaces-to-tab operations on all my src files to keep them small.  You 
 have to be careful, though, because spaces in strings will be converted.  I use 
-<SHIFT-SPACE> ' ' in such cases.  See S2T() for spaces-to-tabs.
+<SHIFT-SPACE> ' ' in such cases.  See S2T() for spaces-to-tabs.
 
 * You can edit an existing sprite by putting the cursor on it and pressing <CTRL
 -r>.
@@ -220,9 +220,9 @@
 so you can edit the ctrl points.  Then, convert them to bitmaps, so the flood 
 fills work well.  If you are doing interpolation, however, they must be vect.
 
-* GrFloodFill() is slow.  GrRect() is fast.
+* GrFloodFill() is slow.  GrRect() is fast.
 
-* You can customize the wallpaper.  See ::/Demo/Graphics/WallPaperFish.HC.
+* You can customize the wallpaper.  See ::/Demo/Graphics/WallPaperFish.HC.
 
 * Your RAM disks will not be reformated when you reboot if the memory location 
 has not changed and it finds the disk intacted.
@@ -236,41 +236,41 @@
 restore defaults.  It is a text doc, if you want to edit it.  Be careful of tree 
 indentations.
 
-* Study ::/Adam/Opt/Utils/MemRep.HC and WallPaper() to learn how the system 
+* Study ::/Adam/Opt/Utils/MemRep.HC and WallPaper() to learn how the system 
 resources are put together.
 
 * The editor's sel-text mechanism allows for disjoint portions of sel text.  
 This is a feature, not a bug -- you can cut-and-paste disjoint text.
 
-* cnts.time_stamp_freq is continuously calibrated.  Be careful because 
-expressions might decrease.  Take a snap-shot, like this: timeout=GetTSC+
-cnts.time_stamp_freq x seconds; and compare against GetTSC().  I recommend just 
-using tS or cnts.jiffies.
+* cnts.time_stamp_freq is continuously calibrated.  Be careful because 
+expressions might decrease.  Take a snap-shot, like this: timeout=GetTSC+
+cnts.time_stamp_freq x seconds; and compare against GetTSC().  I recommend just 
+using tS or cnts.jiffies.
 
-* Use HeapLog(), HeapLogAddrRep() and HeapLogSizeRep() to find leaks.  Don't be 
-confused by CDoc allocations.  Those are generated when text is written to the 
+* Use HeapLog(), HeapLogAddrRep() and HeapLogSizeRep() to find leaks.  Don't be 
+confused by CDoc allocations.  Those are generated when text is written to the 
 cmd line buffer.
 
-* For advanced heap debugging, play with _CFG_HEAP_DBG.  You're on your own.
+* For advanced heap debugging, play with _CFG_HEAP_DBG.  You're on your own.
 
-* You can use Type() to display .GR files.
+* You can use Type() to display .GR files.
 
-* Use Man() to jump to short sym name src code.
+* Use Man() to jump to short sym name src code.
 
-* Use Fix() to edit and fix the last compiler err.
+* Use Fix() to edit and fix the last compiler err.
 
 * You can use <CTRL-SHIFT-L> to do a check for compile errors.
 
-* You can use DocOpt() to optimize links. (Mostly just removes .Z)
+* You can use DocOpt() to optimize links. (Mostly just removes .Z)
 
-* ZipRep() can highlight src files with lots of redundancy.
+* ZipRep() can highlight src files with lots of redundancy.
 
 * With start/end, common trailing code is fast.  Common leading code is slow.
 
-* The first line of the Psalmody HolyC song files is a comment with a category 
-recognized by JukeBox().  The categories are "no nothing", "has words", "has 
+* The first line of the Psalmody HolyC song files is a comment with a category 
+recognized by JukeBox().  The categories are "no nothing", "has words", "has 
 graphics", or "special".  The third character in the song comment is a digit 
-rating number, shown in JukeBox().  You can set the song rating in JukeBox() by 
+rating number, shown in JukeBox().  You can set the song rating in JukeBox() by 
 pressing 0-9.  You can press <DEL> to delete songs.
 
 
diff --git a/public/Wb/Home/Doc/Transform.DD.HTML b/public/Wb/Home/Doc/Transform.DD.HTML
new file mode 100755
index 0000000..b196f7b
--- /dev/null
+++ b/public/Wb/Home/Doc/Transform.DD.HTML
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+CDC's have a 4x4 matrix for rotating, scaling, skewing and shifting in 3 
+dimensions.  To make the graphics routines use the transform, you must set the 
+DCF_TRANSFORMATION flag.
+
+The matrix consists of ints that have been scaled 32 bits (GR_SCALE).  See 
+::/Demo/Lectures/FixedPoint.HC to learn why.
+
+See Mat4x4IdentEqu(), Mat4x4IdentNew(), Mat4x4Equ() and Mat4x4New().  See 
+Mat4x4RotX(), Mat4x4RotY(), Mat4x4RotZ() and Mat4x4Scale() to rotate about axes 
+and scale.  Combine them with Mat4x4MulMat4x4Equ()/Mat4x4MulMat4x4New() and 
+assign them to the CDC.dc with DCMat4x4Set().  See ::/Demo/Graphics/Box.HC.
+
+You can rotate single points using Mat4x4MulXYZ().
+
+The 4th dimension allows a neat trick where you can place pos shifts 
+(translations), into the matrix and Mat4x4MulMat4x4Equ/Mat4x4MulMat4x4New them 
+to combine rotation/shift operations.  Normally, you can't combine pos shift 
+operations.  See Mat4x4TranslationEqu() and ::/Demo/Graphics/Transform.HC.
+
+Finally, CDC's have an x, y and z which is an additional shift (translation).
+
+The transformation is implemented as a callback on the CDC's transform() member. 
+ The default transform() callback is DCTransform().  See 
+::/Demo/Games/Talons.HC or ::/Demo/Games/CastleFrankenstein.HC to see how to 
+change the transform() callback for foreshortening.
+
+ diff --git a/public/src/Home/Doc/Welcome.DD.HTML b/public/Wb/Home/Doc/Welcome.DD.HTML similarity index 60% rename from public/src/Home/Doc/Welcome.DD.HTML rename to public/Wb/Home/Doc/Welcome.DD.HTML index bcbd582..4260743 100755 --- a/public/src/Home/Doc/Welcome.DD.HTML +++ b/public/Wb/Home/Doc/Welcome.DD.HTML @@ -25,7 +25,7 @@ -
+
                               Welcome to TempleOS
 
 TempleOS is a x86_64, multi-cored, non-preemptive multi-tasking, ring-0-only, 
@@ -37,13 +37,13 @@
   * Teenagers doing projects
   * Non-professional, older-persons projects
 
-Simplicity is a goal to keep the line count down, so it's easy to tinker with.  
+Simplicity is a goal to keep the line count down, so it's easy to tinker with.  
 As it turns-out, simplicity makes it faster in some ways, too.  It never 
 switches privilege levels, never changes address maps, tends to load whole 
 contiguous files and other, similar things which boost speed.  It's only 80,849 
 lines of code including the kernel, the 64-bit compiler, the graphics library 
 and all the tools.  More importantly, it's designed to keep the user's line 
-count down -- you can do a Hello World application in one line of code and can 
+count down -- you can do a Hello World application in one line of code and can 
 put graphics on the scrn with a three line program!
 
 It's a kayak, not a Titanic -- it will crash if you do something wrong.  You 
@@ -51,7 +51,7 @@
 fine without memory protection and most computers in the world -- the embedded 
 ones -- operate without protection.  The resulting simplicity of no protections 
 is why TempleOS has value.  In facts, that's the point of TempleOS.  See the 
-TempleOS Charter.
+TempleOS Charter.
 
 Conventional thinking is "failure is not an option" for general purpose 
 operating systems.  Since this OS is used in addition to Windows or Linux, 
@@ -60,52 +60,52 @@
 beautiful.  The following applications more or less form a basis that spans the 
 range of use that TempleOS is intended for:
 
-/Demo/Games/BattleLines.HC
-/Demo/Games/BigGuns.HC
-/Demo/Games/BlackDiamond.HC
-/Demo/Games/BomberGolf.HC
-/Demo/Games/CastleFrankenstein.HC
-/Demo/Games/CharDemo.HC
-/Demo/Games/CircleTrace.HC
-/Demo/Games/Collision.HC
-/Demo/Games/Digits.HC
-/Demo/Games/DunGen.HC
-/Demo/Games/Talons.HC
-/Demo/Games/ElephantWalk.HC
-/Demo/Games/FlapBat.HC
-/Demo/Games/FlatTops.HC
-/Demo/Games/Halogen.HC
-/Demo/Games/MassSpring.HC
-/Demo/Games/Maze.HC
-/Demo/Games/RainDrops.HC
-/Demo/Games/RawHide.HC
-/Demo/Games/Rocket.HC
-/Demo/Games/RocketScience.HC
-/Demo/Games/Squirt.HC
-/Demo/Games/TheDead.HC
-/Demo/Games/TicTacToe.HC
-/Demo/Games/TreeCheckers.HC
-/Demo/Games/Varoom.HC
-/Demo/Games/Wenceslas.HC
-/Demo/Games/Whap.HC
-/Demo/Games/Zing.HC
-/Demo/Games/ZoneOut.HC
-/Apps/Psalmody/Examples/childish.HC
-/Apps/Psalmody/Examples/night.HC
-/Apps/Psalmody/Examples/prosper.HC
+/Demo/Games/BattleLines.HC
+/Demo/Games/BigGuns.HC
+/Demo/Games/BlackDiamond.HC
+/Demo/Games/BomberGolf.HC
+/Demo/Games/CastleFrankenstein.HC
+/Demo/Games/CharDemo.HC
+/Demo/Games/CircleTrace.HC
+/Demo/Games/Collision.HC
+/Demo/Games/Digits.HC
+/Demo/Games/DunGen.HC
+/Demo/Games/Talons.HC
+/Demo/Games/ElephantWalk.HC
+/Demo/Games/FlapBat.HC
+/Demo/Games/FlatTops.HC
+/Demo/Games/Halogen.HC
+/Demo/Games/MassSpring.HC
+/Demo/Games/Maze.HC
+/Demo/Games/RainDrops.HC
+/Demo/Games/RawHide.HC
+/Demo/Games/Rocket.HC
+/Demo/Games/RocketScience.HC
+/Demo/Games/Squirt.HC
+/Demo/Games/TheDead.HC
+/Demo/Games/TicTacToe.HC
+/Demo/Games/TreeCheckers.HC
+/Demo/Games/Varoom.HC
+/Demo/Games/Wenceslas.HC
+/Demo/Games/Whap.HC
+/Demo/Games/Zing.HC
+/Demo/Games/ZoneOut.HC
+/Apps/Psalmody/Examples/childish.HC
+/Apps/Psalmody/Examples/night.HC
+/Apps/Psalmody/Examples/prosper.HC
 
-Two things to know about TempleOS are that tasks have MAlloc/Free heap memory, 
+Two things to know about TempleOS are that tasks have MAlloc/Free heap memory, 
 not applications, and tasks have compiler symbol tables that persist at a scope 
 like environment variables in other operating systems, and the symbols can 
 include functions.
 
 For other operating systems, I hated learning one language for command line 
 scripts and another for programming.  With TempleOS, the command line feeds 
-right into the HolyC compiler, line by line, and it places code into memory it 
-MAlloc()s.  The compiler is paused at the command line, waiting for input.  
+right into the HolyC compiler, line by line, and it places code into memory it 
+MAlloc()s.  The compiler is paused at the command line, waiting for input.  
 Naturally, you #include a program to load it into memory and, usually, start it.
 
-During the boot process, many files get compiled before you have access to the 
+During the boot process, many files get compiled before you have access to the 
 command line.  (Don't worry, booting takes only two seconds.)  All the header 
 declarations for the operating system are compiled and are available for use in 
 your programs without needing to #include them.  Everything is truly compiled to 
@@ -131,34 +131,34 @@
 >Dir;
 
 The syntax change created an ambiguity when specifying function addresses, like 
-for calling QSort().  To resolve it, I  made a '&' required in front of function 
+for calling QSort().  To resolve it, I  made a '&' required in front of function 
 names when specifying an address of a function, which is better anyway.
 
 Once I was no longer using standard C/C++ syntax, I decided to change everything 
-I didn't like and call it HolyC.  Here are the new operator precedence rules.  
+I didn't like and call it HolyC.  Here are the new operator precedence rules.  
 It's Biblical!  See Luke,5:37.
 
 There are no object files in TempleOS and, normally, you don't make executable 
-files either, but you can.  That's known as Ahead-of-Time compilation.  Instead, 
-you Just in Time compile.
+files either, but you can.  That's known as Ahead-of-Time compilation.  Instead, 
+you Just in Time compile.
 
 Tasks have no priority and are never removed from the queue.  Instead, they 
 often poll whatever they are waiting on and swap-out.  (Swapping tasks takes 
 half a microsecond and does not involve disk activity or memory maps.)  See 
-Scheduler.  Polling keeps it simple.  It might be a problem if you had lots of 
+Scheduler.  Polling keeps it simple.  It might be a problem if you had lots of 
 tasks busy, which rarely happens on a home computer.  The order of the tasks in 
 the queue determines front-to-back window order.
 
 The FAT32 filesystem is supported to makes exchanging files with a dual booted 
-other operating system easy and there is the simple, 64-bit TempleOS RedSea 
-filesystem.  The RedSea has allocation bitmap for clus and all files are stored 
+other operating system easy and there is the simple, 64-bit TempleOS RedSea 
+filesystem.  The RedSea has allocation bitmap for clus and all files are stored 
 contiguously.  You can't grow files.
 
 TempleOS is geared toward reading and writing whole files.  Since whole files 
 are processed, compression is possible.  Filenames ending in ".Z" are 
 automatically compressed or uncompressed when stored and fetched.  TempleOS does 
-support direct block random access into files, however -- FBlkRead() and 
-FBlkWrite().
+support direct block random access into files, however -- FBlkRead() and 
+FBlkWrite().
 
 If a file is not found, ".Z" is added or removed and a search is done, again.  
 There is no PATH, but parent directories are searched when a file is not found.  
@@ -178,38 +178,38 @@
 same time twice as fast when you really want to run one faster?  You could say 
 TempleOS does master/slave multiprocessing.  The anticipated use for multicore 
 is primarily putting graphics on the scrn.  Hardware graphics acceleration is 
-not used, so this is possible.  See TempleOS MultiCore.
+not used, so this is possible.  See TempleOS MultiCore.
 
 There is no distinction between the terms task, process or thread.  All have a 
-task record, CTask, pointed to by the FS segment reg and are accessed with Fs-> 
-while Gs-> points to a CCPU for the current CPU core.  Each task can have just 
+task record, CTask, pointed to by the FS segment reg and are accessed with Fs-> 
+while Gs-> points to a CCPU for the current CPU core.  Each task can have just 
 one window, but a task can have children with windows.  (The segment regs are 
 just used as extra regs -- there is nothing segmented about TempleOS' memory.)  
 It is approximately the case that TempleOS is multi-threading, 
 single-processing.
 
-In TempleOS, Adam Task refers to the father of all tasks.  He's never supposed 
+In TempleOS, Adam Task refers to the father of all tasks.  He's never supposed 
 to die.  Since tasks inherit the symbols of parents, system-wide stuff is 
 associated with Adam.  His heap is like kernel memory in other operating 
 systems.  Since Adam is immortal, it's safe to alloc objects, not tied to any 
 mortal task, from Adam's heap.  He stays in a server mode, taking requests, so 
 you can ask him to #include something, placing that code system-wide.  A funny 
 story is that originally I called it the root task and even had a /Root 
-directory :-)  Adam executes ::/StartOS.HC at boot time.
+directory :-)  Adam executes ::/StartOS.HC at boot time.
 
 For easy back-ups, place everything you author in your /Home directory and 
-subdirectories.  Then, use CopyTree().  That should make upgrading easy, too.  
+subdirectories.  Then, use CopyTree().  That should make upgrading easy, too.  
 Customizable start-up scripts go in your /Home directory.  The default start-up 
 scripts are in the root directory.  Copy the start-up files you wish to 
-customize into /Home and modify them.  See Home Files.  You can make your own 
+customize into /Home and modify them.  See Home Files.  You can make your own 
 distro that includes everything and is a bootable live CD with 
-::/Misc/DoDistro.HC.
+::/Misc/DoDistro.HC.
 
 Typically, your usage pattern through the day will be repeatedly left or right 
-clicking on filenames in a cmd line Dir() listing.  You left-click files to edit 
-them and right-click to #include them.  To begin a project, type Ed("filename");
+clicking on filenames in a cmd line Dir() listing.  You left-click files to edit 
+them and right-click to #include them.  To begin a project, type Ed("filename");
 , supplying a filename.  You can also run programs with <F5> when in the editor. 
-<ESC> to save and exit the file.  You'll need to do a new Dir() cmd, 
+<ESC> to save and exit the file.  You'll need to do a new Dir() cmd, 
 periodically, so make a macro on your PersonalMenu.  Access your PersonalMenu by 
 pressing <CTRL-m>, cursoring until you are on top of it and pressing <SPACE>.
 
@@ -226,41 +226,41 @@
 <ALT-a> brings back AutoComplete.
 <ALT-v> vertically tiles windows.
 <ALT-h> horizontally tiles windows.
-The ALT keys are defined in ~/HomeKeyPlugIns.HC.  You can customize them.
+The ALT keys are defined in ~/HomeKeyPlugIns.HC.  You can customize them.
 
 <CTRL-ALT-t> new terminal window.
 <CTRL-ALT-n> switches to the next window.
 <CTRL-ALT-x> kills a window.
 
-Find() is your best friend.  There's a wrapper function called F() in your ~/Hom
+Find() is your best friend.  There's a wrapper function called F() in your ~/Hom
 eWrappers.HC.Z file.  Feel free to make wrapper functions for functions you use 
-often and customize the args.  By the way, Find() or R() can be used to replace 
-strings across multiple files.  You can access Find() using <CTRL-SHIFT-f>.
+often and customize the args.  By the way, Find() or R() can be used to replace 
+strings across multiple files.  You can access Find() using <CTRL-SHIFT-f>.
 
 As you browse code, use the AutoComplete window to look-up functions, etc.  <CTR
 L-SHIFT-F1> (or whatever number) to follow a sym to it's source.  You can browse 
 deeper and deeper.  You go back with <SHIFT-ESC>.
 
-Use the Help & Index or Demo Index to find-out what exists.  Press <F1> for help 
+Use the Help & Index or Demo Index to find-out what exists.  Press <F1> for help 
 or use the links on your menu (<CTRL-m>).  Also, look in the /Demo or /Apps 
 directories for inspiration.
 
-Software is distributed as RedSea ISO files.  Burn a CD/DVD, or set your CD/DVD 
+Software is distributed as RedSea ISO files.  Burn a CD/DVD, or set your CD/DVD 
 in QEMU, VMware or VirtualBox to the ISO file.  Then, access the 'T' drive.  Or, 
-Mount() the ISO.C file and access the 'M' drive in TempleOS.  It must be a 
+Mount() the ISO.C file and access the 'M' drive in TempleOS.  It must be a 
 contiguous ISO.C file, so rename it under TempleOS to ISO.C.
 
 Ideally, do not install applications such as games onto your hard drive because 
 we wish to keep hard drive usage low, so the whole 'C' drive can be copied 
-quickly to 'D'.  Also, the FileMgr() <CTRL-d> starts too slowly when there are 
+quickly to 'D'.  Also, the FileMgr() <CTRL-d> starts too slowly when there are 
 lots of hard drive files, but that is how we want it.
 
 3rd party libraries are banned, since they circumvent the 100,000 line of code 
-limit in the TempleOS Charter.  All applications must only depend on the core 
+limit in the TempleOS Charter.  All applications must only depend on the core 
 TempleOS files and whatever they bring along in the ISO.  This is similar to how 
 Commodore 64 applications only depended on the ROM.
 
-Create a RedSea ISO file with RedSeaISO().  Send an email to 
+Create a RedSea ISO file with RedSeaISO().  Send an email to 
 tdavis@templeos.org if you want me to post a link to your TempleOS code in the 
 App Store.
 
diff --git a/public/src/Doc/WhyNotMore.DD.HTML b/public/Wb/Home/Doc/WhyNotMore.DD.HTML
old mode 100644
new mode 100755
similarity index 75%
rename from public/src/Doc/WhyNotMore.DD.HTML
rename to public/Wb/Home/Doc/WhyNotMore.DD.HTML
index 29e8f97..f7622b0
--- a/public/src/Doc/WhyNotMore.DD.HTML
+++ b/public/Wb/Home/Doc/WhyNotMore.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
                                  Why Not More?
 
 If a feature cannot be made to work correctly and consistently, professional 
@@ -38,7 +38,7 @@
 plenty remains.
 
 The PCI bus interface is what modern hardware uses.  Before PCI, life was simple 
-and devices used I/O ports.  After studying PCI Interrupts and attempting to do 
+and devices used I/O ports.  After studying PCI Interrupts and attempting to do 
 a HDAudio driver, I came to realize that modern PCI devices require ten times 
 more code and I cannot even come close to making them work on everyone's machine 
 because with PCI devices there are several models to worry about, unlike with 
@@ -46,14 +46,14 @@
 
 Currently, I have no PCI drivers.  My drivers use I/O ports and operate in ISA 
 bus mode.  At this point, I only have one driver for each type of device and it 
-is delightfully simple that way.  I have one keyboard driver, one mouse driver, 
-one ATA hard drive driver, one ATAPI CD/DVD driver, one VGA 640x480 16 color 
-video driver and one PC Speaker driver.  I use the PIT and HPET timers and 
-PIC Interrupt Controller.  I use  IRQ0 for timer, IRQ1 for keyboard, and IRQ12 
+is delightfully simple that way.  I have one keyboard driver, one mouse driver, 
+one ATA hard drive driver, one ATAPI CD/DVD driver, one VGA 640x480 16 color 
+video driver and one PC Speaker driver.  I use the PIT and HPET timers and 
+PIC Interrupt Controller.  I use  IRQ0 for timer, IRQ1 for keyboard, and IRQ12 
 for mouse.  If IRQ12 is not firing, I am able to poll the mouse.
 
-In the CPU department, I have state of the art 64-bit long mode with multicore 
-support.  I use the APIC and start-up multicore operation.
+In the CPU department, I have state of the art 64-bit long mode with multicore 
+support.  I use the APIC and start-up multicore operation.
 
 I have made an incredible accomplishment by getting it to work on practically 
 everyone's computer as long as it is 64-bit and they run inside VMware, QEMU or 
@@ -69,7 +69,7 @@
 
 The same story is basically true for GPUs, audio, networking and AHCI hard drive 
 drivers.  God said 640x480 16 color was a covenant like circumcision, so the 
-video will never change, even if a Standard PC was made.  If you attempt 
+video will never change, even if a Standard PC was made.  If you attempt 
 multimedia, everything will break because memory will get fragmented with huge 
 multimedia files.  Some day, if super-simple high speed serial allows 
 networking, there will be no browser within the 100,000 line limit and, with 
@@ -86,7 +86,7 @@
 machine.  Therefore, the BIOS companies actually want it difficult to make 
 drivers and purposely make it broken.
 
-The ATA/ATAPI hard drives often can be run with I/O ports if you can find them.  
+The ATA/ATAPI hard drives often can be run with I/O ports if you can find them.  
 lspci -v on Linux or system information on Windows can help you locate the SATA 
 IO ports the hard drive and CD/DVD have.  They no longer are enabled by the 
 BIOS.  It's hopeless.  I'm stuck with very slow drive performance, but it works 
@@ -103,11 +103,11 @@
 God talks.  It seems reasonable that I will get to make the rules for the whole 
 industry, in the future when God is announced publically to the World.
 
-I made ::/Doc/Demands.DD.
+I made ::/Doc/Demands.DD.
 
 When the PC was created, they wanted flexibility because they did not know the 
 future.  Now, the industry is mature and it is time to make a 100% standard PC 
-that everybody uses.  ::/Doc/StdTempleOSPC.DD
+that everybody uses.  ::/Doc/StdTempleOSPC.DD
 
 
 * "QEMU" is a trademark owned by Fabrice Bellard.
diff --git a/public/src/Home/Doc/Widget.DD.HTML b/public/Wb/Home/Doc/Widget.DD.HTML
similarity index 88%
rename from public/src/Home/Doc/Widget.DD.HTML
rename to public/Wb/Home/Doc/Widget.DD.HTML
index 9b1df6a..36e5d39 100755
--- a/public/src/Home/Doc/Widget.DD.HTML
+++ b/public/Wb/Home/Doc/Widget.DD.HTML
@@ -25,16 +25,16 @@
 
 
 
-
+
                                DolDoc Widget Help
 
-DolDoc is a TempleOS document type.
+DolDoc is a TempleOS document type.
 
 "Expression" a num or HolyC algebraic term with operators and HolyC syms can be 
 entered.
 "Macro" Most entries can behave like macro entries if you assign them macro 
 strs.
-"InStr" Like a macro except it is an InFile.  You can't have both an in_str and 
+"InStr" Like a macro except it is an InFile.  You can't have both an in_str and 
 macro text defined.  
 
 Tag Text is the text that will be displayed for the item.  For links, you can 
@@ -61,7 +61,7 @@
 
 Tree The item will behave like a tree widget, with this as the root.
 Collapsed The tree or hidden widget will begin collapsed.
-Define Str will substitute a #define or DefineLoad() string for the tag.
+Define Str will substitute a #define or DefineLoad() string for the tag.
 
 Quote Make the res suitable for including in a program, in quotes, especially fo
 rmat entries in class definitions.
@@ -78,6 +78,6 @@
 Refresh Data  updates $DA...$ entry continuously.
 
 Html Link  stores a link which will be embedded if you generate a html version 
-of a document with ::/Demo/ToHtmlToTXTDemo/ToHtml.HC.
+of a document with ::/Demo/ToHtmlToTXTDemo/ToHtml.HC.
 
diff --git a/public/src/Home/Doc/Windows.DD.HTML b/public/Wb/Home/Doc/Windows.DD.HTML similarity index 95% rename from public/src/Home/Doc/Windows.DD.HTML rename to public/Wb/Home/Doc/Windows.DD.HTML index 6159d54..f9f7274 100755 --- a/public/src/Home/Doc/Windows.DD.HTML +++ b/public/Wb/Home/Doc/Windows.DD.HTML @@ -25,7 +25,7 @@ -
+
 Only tasks on Core0 can have a window and there can be only one window per task. 
  The window Z-buffer, top-to-bottom order is determined by the order in the task 
 queue, with the WinMgr on the bottom.  A task can have child task popup windows.
diff --git a/public/src/Home/MakeHome.HC b/public/Wb/Home/MakeHome.HC
similarity index 100%
rename from public/src/Home/MakeHome.HC
rename to public/Wb/Home/MakeHome.HC
diff --git a/public/src/Home/Registry.HC b/public/Wb/Home/Registry.HC
similarity index 100%
rename from public/src/Home/Registry.HC
rename to public/Wb/Home/Registry.HC
diff --git a/public/src/HomeKeyPlugIns.HC b/public/Wb/HomeKeyPlugIns.HC
similarity index 100%
rename from public/src/HomeKeyPlugIns.HC
rename to public/Wb/HomeKeyPlugIns.HC
diff --git a/public/src/HomeLocalize.HC b/public/Wb/HomeLocalize.HC
similarity index 100%
rename from public/src/HomeLocalize.HC
rename to public/Wb/HomeLocalize.HC
diff --git a/public/src/HomeSys.HC b/public/Wb/HomeSys.HC
similarity index 100%
rename from public/src/HomeSys.HC
rename to public/Wb/HomeSys.HC
diff --git a/public/src/HomeWrappers.HC b/public/Wb/HomeWrappers.HC
similarity index 100%
rename from public/src/HomeWrappers.HC
rename to public/Wb/HomeWrappers.HC
diff --git a/public/src/Kernel/BlkDev/DskATA.HC b/public/Wb/Kernel/BlkDev/DskATA.HC
similarity index 100%
rename from public/src/Kernel/BlkDev/DskATA.HC
rename to public/Wb/Kernel/BlkDev/DskATA.HC
diff --git a/public/src/Kernel/BlkDev/DskATAId.HC b/public/Wb/Kernel/BlkDev/DskATAId.HC
similarity index 100%
rename from public/src/Kernel/BlkDev/DskATAId.HC
rename to public/Wb/Kernel/BlkDev/DskATAId.HC
diff --git a/public/src/Kernel/BlkDev/DskAddDev.HC b/public/Wb/Kernel/BlkDev/DskAddDev.HC
similarity index 100%
rename from public/src/Kernel/BlkDev/DskAddDev.HC
rename to public/Wb/Kernel/BlkDev/DskAddDev.HC
diff --git a/public/src/Kernel/BlkDev/DskBlk.HC b/public/Wb/Kernel/BlkDev/DskBlk.HC
similarity index 100%
rename from public/src/Kernel/BlkDev/DskBlk.HC
rename to public/Wb/Kernel/BlkDev/DskBlk.HC
diff --git a/public/src/Kernel/BlkDev/DskBlkDev.HC b/public/Wb/Kernel/BlkDev/DskBlkDev.HC
similarity index 100%
rename from public/src/Kernel/BlkDev/DskBlkDev.HC
rename to public/Wb/Kernel/BlkDev/DskBlkDev.HC
diff --git a/public/src/Kernel/BlkDev/DskCDDVD.HC b/public/Wb/Kernel/BlkDev/DskCDDVD.HC
similarity index 100%
rename from public/src/Kernel/BlkDev/DskCDDVD.HC
rename to public/Wb/Kernel/BlkDev/DskCDDVD.HC
diff --git a/public/src/Kernel/BlkDev/DskCFile.HC b/public/Wb/Kernel/BlkDev/DskCFile.HC
similarity index 100%
rename from public/src/Kernel/BlkDev/DskCFile.HC
rename to public/Wb/Kernel/BlkDev/DskCFile.HC
diff --git a/public/src/Kernel/BlkDev/DskCache.HC b/public/Wb/Kernel/BlkDev/DskCache.HC
similarity index 100%
rename from public/src/Kernel/BlkDev/DskCache.HC
rename to public/Wb/Kernel/BlkDev/DskCache.HC
diff --git a/public/src/Kernel/BlkDev/DskClus.HC b/public/Wb/Kernel/BlkDev/DskClus.HC
similarity index 100%
rename from public/src/Kernel/BlkDev/DskClus.HC
rename to public/Wb/Kernel/BlkDev/DskClus.HC
diff --git a/public/src/Kernel/BlkDev/DskCopy.HC b/public/Wb/Kernel/BlkDev/DskCopy.HC
similarity index 100%
rename from public/src/Kernel/BlkDev/DskCopy.HC
rename to public/Wb/Kernel/BlkDev/DskCopy.HC
diff --git a/public/src/Kernel/BlkDev/DskDirA.HC b/public/Wb/Kernel/BlkDev/DskDirA.HC
similarity index 100%
rename from public/src/Kernel/BlkDev/DskDirA.HC
rename to public/Wb/Kernel/BlkDev/DskDirA.HC
diff --git a/public/src/Kernel/BlkDev/DskDirB.HC b/public/Wb/Kernel/BlkDev/DskDirB.HC
similarity index 100%
rename from public/src/Kernel/BlkDev/DskDirB.HC
rename to public/Wb/Kernel/BlkDev/DskDirB.HC
diff --git a/public/src/Kernel/BlkDev/DskDirContext.HC b/public/Wb/Kernel/BlkDev/DskDirContext.HC
similarity index 100%
rename from public/src/Kernel/BlkDev/DskDirContext.HC
rename to public/Wb/Kernel/BlkDev/DskDirContext.HC
diff --git a/public/src/Kernel/BlkDev/DskDrv.HC b/public/Wb/Kernel/BlkDev/DskDrv.HC
similarity index 100%
rename from public/src/Kernel/BlkDev/DskDrv.HC
rename to public/Wb/Kernel/BlkDev/DskDrv.HC
diff --git a/public/src/Kernel/BlkDev/DskFile.HC b/public/Wb/Kernel/BlkDev/DskFile.HC
similarity index 100%
rename from public/src/Kernel/BlkDev/DskFile.HC
rename to public/Wb/Kernel/BlkDev/DskFile.HC
diff --git a/public/src/Kernel/BlkDev/DskFind.HC b/public/Wb/Kernel/BlkDev/DskFind.HC
similarity index 100%
rename from public/src/Kernel/BlkDev/DskFind.HC
rename to public/Wb/Kernel/BlkDev/DskFind.HC
diff --git a/public/src/Kernel/BlkDev/DskFmt.HC b/public/Wb/Kernel/BlkDev/DskFmt.HC
similarity index 100%
rename from public/src/Kernel/BlkDev/DskFmt.HC
rename to public/Wb/Kernel/BlkDev/DskFmt.HC
diff --git a/public/src/Kernel/BlkDev/DskStrA.HC b/public/Wb/Kernel/BlkDev/DskStrA.HC
similarity index 100%
rename from public/src/Kernel/BlkDev/DskStrA.HC
rename to public/Wb/Kernel/BlkDev/DskStrA.HC
diff --git a/public/src/Kernel/BlkDev/DskStrB.HC b/public/Wb/Kernel/BlkDev/DskStrB.HC
similarity index 100%
rename from public/src/Kernel/BlkDev/DskStrB.HC
rename to public/Wb/Kernel/BlkDev/DskStrB.HC
diff --git a/public/src/Kernel/BlkDev/FileSysFAT.HC b/public/Wb/Kernel/BlkDev/FileSysFAT.HC
similarity index 100%
rename from public/src/Kernel/BlkDev/FileSysFAT.HC
rename to public/Wb/Kernel/BlkDev/FileSysFAT.HC
diff --git a/public/src/Kernel/BlkDev/FileSysRedSea.HC b/public/Wb/Kernel/BlkDev/FileSysRedSea.HC
similarity index 100%
rename from public/src/Kernel/BlkDev/FileSysRedSea.HC
rename to public/Wb/Kernel/BlkDev/FileSysRedSea.HC
diff --git a/public/src/Kernel/BlkDev/MakeBlkDev.HC b/public/Wb/Kernel/BlkDev/MakeBlkDev.HC
similarity index 100%
rename from public/src/Kernel/BlkDev/MakeBlkDev.HC
rename to public/Wb/Kernel/BlkDev/MakeBlkDev.HC
diff --git a/public/src/Kernel/Compress.HC b/public/Wb/Kernel/Compress.HC
similarity index 100%
rename from public/src/Kernel/Compress.HC
rename to public/Wb/Kernel/Compress.HC
diff --git a/public/src/Kernel/Display.HC b/public/Wb/Kernel/Display.HC
similarity index 100%
rename from public/src/Kernel/Display.HC
rename to public/Wb/Kernel/Display.HC
diff --git a/public/src/Kernel/EdLite.HC b/public/Wb/Kernel/EdLite.HC
similarity index 100%
rename from public/src/Kernel/EdLite.HC
rename to public/Wb/Kernel/EdLite.HC
diff --git a/public/src/Kernel/FontCyrillic.HC b/public/Wb/Kernel/FontCyrillic.HC
similarity index 100%
rename from public/src/Kernel/FontCyrillic.HC
rename to public/Wb/Kernel/FontCyrillic.HC
diff --git a/public/src/Kernel/FontStd.HC b/public/Wb/Kernel/FontStd.HC
similarity index 100%
rename from public/src/Kernel/FontStd.HC
rename to public/Wb/Kernel/FontStd.HC
diff --git a/public/src/Kernel/FunSeg.HC b/public/Wb/Kernel/FunSeg.HC
similarity index 100%
rename from public/src/Kernel/FunSeg.HC
rename to public/Wb/Kernel/FunSeg.HC
diff --git a/public/src/Kernel/Job.HC b/public/Wb/Kernel/Job.HC
similarity index 100%
rename from public/src/Kernel/Job.HC
rename to public/Wb/Kernel/Job.HC
diff --git a/public/src/Kernel/KCfg.HC b/public/Wb/Kernel/KCfg.HC
similarity index 100%
rename from public/src/Kernel/KCfg.HC
rename to public/Wb/Kernel/KCfg.HC
diff --git a/public/src/Kernel/KDataTypes.HC b/public/Wb/Kernel/KDataTypes.HC
similarity index 100%
rename from public/src/Kernel/KDataTypes.HC
rename to public/Wb/Kernel/KDataTypes.HC
diff --git a/public/src/Kernel/KDate.HC b/public/Wb/Kernel/KDate.HC
similarity index 100%
rename from public/src/Kernel/KDate.HC
rename to public/Wb/Kernel/KDate.HC
diff --git a/public/src/Kernel/KDbg.HC b/public/Wb/Kernel/KDbg.HC
similarity index 100%
rename from public/src/Kernel/KDbg.HC
rename to public/Wb/Kernel/KDbg.HC
diff --git a/public/src/Kernel/KDefine.HC b/public/Wb/Kernel/KDefine.HC
similarity index 100%
rename from public/src/Kernel/KDefine.HC
rename to public/Wb/Kernel/KDefine.HC
diff --git a/public/src/Kernel/KExcept.HC b/public/Wb/Kernel/KExcept.HC
similarity index 100%
rename from public/src/Kernel/KExcept.HC
rename to public/Wb/Kernel/KExcept.HC
diff --git a/public/src/Kernel/KExts.HC b/public/Wb/Kernel/KExts.HC
similarity index 100%
rename from public/src/Kernel/KExts.HC
rename to public/Wb/Kernel/KExts.HC
diff --git a/public/src/Kernel/KGlbls.HC b/public/Wb/Kernel/KGlbls.HC
similarity index 100%
rename from public/src/Kernel/KGlbls.HC
rename to public/Wb/Kernel/KGlbls.HC
diff --git a/public/src/Kernel/KHashA.HC b/public/Wb/Kernel/KHashA.HC
similarity index 100%
rename from public/src/Kernel/KHashA.HC
rename to public/Wb/Kernel/KHashA.HC
diff --git a/public/src/Kernel/KHashB.HC b/public/Wb/Kernel/KHashB.HC
similarity index 100%
rename from public/src/Kernel/KHashB.HC
rename to public/Wb/Kernel/KHashB.HC
diff --git a/public/src/Kernel/KInts.HC b/public/Wb/Kernel/KInts.HC
similarity index 100%
rename from public/src/Kernel/KInts.HC
rename to public/Wb/Kernel/KInts.HC
diff --git a/public/src/Kernel/KLoad.HC b/public/Wb/Kernel/KLoad.HC
similarity index 100%
rename from public/src/Kernel/KLoad.HC
rename to public/Wb/Kernel/KLoad.HC
diff --git a/public/src/Kernel/KMain.HC b/public/Wb/Kernel/KMain.HC
similarity index 100%
rename from public/src/Kernel/KMain.HC
rename to public/Wb/Kernel/KMain.HC
diff --git a/public/src/Kernel/KMathA.HC b/public/Wb/Kernel/KMathA.HC
similarity index 100%
rename from public/src/Kernel/KMathA.HC
rename to public/Wb/Kernel/KMathA.HC
diff --git a/public/src/Kernel/KMathB.HC b/public/Wb/Kernel/KMathB.HC
similarity index 100%
rename from public/src/Kernel/KMathB.HC
rename to public/Wb/Kernel/KMathB.HC
diff --git a/public/src/Kernel/KMisc.HC b/public/Wb/Kernel/KMisc.HC
similarity index 100%
rename from public/src/Kernel/KMisc.HC
rename to public/Wb/Kernel/KMisc.HC
diff --git a/public/src/Kernel/KStart16.HC b/public/Wb/Kernel/KStart16.HC
similarity index 100%
rename from public/src/Kernel/KStart16.HC
rename to public/Wb/Kernel/KStart16.HC
diff --git a/public/src/Kernel/KStart32.HC b/public/Wb/Kernel/KStart32.HC
similarity index 100%
rename from public/src/Kernel/KStart32.HC
rename to public/Wb/Kernel/KStart32.HC
diff --git a/public/src/Kernel/KStart64.HC b/public/Wb/Kernel/KStart64.HC
similarity index 100%
rename from public/src/Kernel/KStart64.HC
rename to public/Wb/Kernel/KStart64.HC
diff --git a/public/src/Kernel/KTask.HC b/public/Wb/Kernel/KTask.HC
similarity index 100%
rename from public/src/Kernel/KTask.HC
rename to public/Wb/Kernel/KTask.HC
diff --git a/public/src/Kernel/KUtils.HC b/public/Wb/Kernel/KUtils.HC
similarity index 100%
rename from public/src/Kernel/KUtils.HC
rename to public/Wb/Kernel/KUtils.HC
diff --git a/public/src/Kernel/KeyDev.HC b/public/Wb/Kernel/KeyDev.HC
similarity index 100%
rename from public/src/Kernel/KeyDev.HC
rename to public/Wb/Kernel/KeyDev.HC
diff --git a/public/src/Kernel/Mem/BlkPool.HC b/public/Wb/Kernel/Mem/BlkPool.HC
similarity index 100%
rename from public/src/Kernel/Mem/BlkPool.HC
rename to public/Wb/Kernel/Mem/BlkPool.HC
diff --git a/public/src/Kernel/Mem/HeapCtrl.HC b/public/Wb/Kernel/Mem/HeapCtrl.HC
similarity index 100%
rename from public/src/Kernel/Mem/HeapCtrl.HC
rename to public/Wb/Kernel/Mem/HeapCtrl.HC
diff --git a/public/src/Kernel/Mem/MAllocFree.HC b/public/Wb/Kernel/Mem/MAllocFree.HC
similarity index 100%
rename from public/src/Kernel/Mem/MAllocFree.HC
rename to public/Wb/Kernel/Mem/MAllocFree.HC
diff --git a/public/src/Kernel/Mem/MakeMem.HC b/public/Wb/Kernel/Mem/MakeMem.HC
similarity index 100%
rename from public/src/Kernel/Mem/MakeMem.HC
rename to public/Wb/Kernel/Mem/MakeMem.HC
diff --git a/public/src/Kernel/Mem/MemPag.HC b/public/Wb/Kernel/Mem/MemPag.HC
similarity index 100%
rename from public/src/Kernel/Mem/MemPag.HC
rename to public/Wb/Kernel/Mem/MemPag.HC
diff --git a/public/src/Kernel/Mem/MemPhysical.HC b/public/Wb/Kernel/Mem/MemPhysical.HC
similarity index 100%
rename from public/src/Kernel/Mem/MemPhysical.HC
rename to public/Wb/Kernel/Mem/MemPhysical.HC
diff --git a/public/src/Kernel/Mem/PageTables.HC b/public/Wb/Kernel/Mem/PageTables.HC
similarity index 100%
rename from public/src/Kernel/Mem/PageTables.HC
rename to public/Wb/Kernel/Mem/PageTables.HC
diff --git a/public/src/Kernel/MultiProc.HC b/public/Wb/Kernel/MultiProc.HC
similarity index 100%
rename from public/src/Kernel/MultiProc.HC
rename to public/Wb/Kernel/MultiProc.HC
diff --git a/public/src/Kernel/PCIBIOS.HC b/public/Wb/Kernel/PCIBIOS.HC
similarity index 100%
rename from public/src/Kernel/PCIBIOS.HC
rename to public/Wb/Kernel/PCIBIOS.HC
diff --git a/public/src/Kernel/QSort.HC b/public/Wb/Kernel/QSort.HC
similarity index 100%
rename from public/src/Kernel/QSort.HC
rename to public/Wb/Kernel/QSort.HC
diff --git a/public/src/Kernel/Sched.HC b/public/Wb/Kernel/Sched.HC
similarity index 100%
rename from public/src/Kernel/Sched.HC
rename to public/Wb/Kernel/Sched.HC
diff --git a/public/src/Kernel/SerialDev/Keyboard.HC b/public/Wb/Kernel/SerialDev/Keyboard.HC
similarity index 100%
rename from public/src/Kernel/SerialDev/Keyboard.HC
rename to public/Wb/Kernel/SerialDev/Keyboard.HC
diff --git a/public/src/Kernel/SerialDev/MakeSerialDev.HC b/public/Wb/Kernel/SerialDev/MakeSerialDev.HC
similarity index 100%
rename from public/src/Kernel/SerialDev/MakeSerialDev.HC
rename to public/Wb/Kernel/SerialDev/MakeSerialDev.HC
diff --git a/public/src/Kernel/SerialDev/Message.HC b/public/Wb/Kernel/SerialDev/Message.HC
similarity index 100%
rename from public/src/Kernel/SerialDev/Message.HC
rename to public/Wb/Kernel/SerialDev/Message.HC
diff --git a/public/src/Kernel/SerialDev/Mouse.HC b/public/Wb/Kernel/SerialDev/Mouse.HC
similarity index 100%
rename from public/src/Kernel/SerialDev/Mouse.HC
rename to public/Wb/Kernel/SerialDev/Mouse.HC
diff --git a/public/src/Kernel/StrA.HC b/public/Wb/Kernel/StrA.HC
similarity index 100%
rename from public/src/Kernel/StrA.HC
rename to public/Wb/Kernel/StrA.HC
diff --git a/public/src/Kernel/StrB.HC b/public/Wb/Kernel/StrB.HC
similarity index 100%
rename from public/src/Kernel/StrB.HC
rename to public/Wb/Kernel/StrB.HC
diff --git a/public/src/Kernel/StrPrint.HC b/public/Wb/Kernel/StrPrint.HC
similarity index 100%
rename from public/src/Kernel/StrPrint.HC
rename to public/Wb/Kernel/StrPrint.HC
diff --git a/public/src/Kernel/StrScan.HC b/public/Wb/Kernel/StrScan.HC
similarity index 100%
rename from public/src/Kernel/StrScan.HC
rename to public/Wb/Kernel/StrScan.HC
diff --git a/public/src/MakeHome.HC b/public/Wb/MakeHome.HC
similarity index 100%
rename from public/src/MakeHome.HC
rename to public/Wb/MakeHome.HC
diff --git a/public/src/Misc/DoDistro.HC b/public/Wb/Misc/DoDistro.HC
similarity index 100%
rename from public/src/Misc/DoDistro.HC
rename to public/Wb/Misc/DoDistro.HC
diff --git a/public/src/Misc/OSInstall.HC b/public/Wb/Misc/OSInstall.HC
similarity index 100%
rename from public/src/Misc/OSInstall.HC
rename to public/Wb/Misc/OSInstall.HC
diff --git a/public/src/Misc/OSTestSuite.HC b/public/Wb/Misc/OSTestSuite.HC
similarity index 100%
rename from public/src/Misc/OSTestSuite.HC
rename to public/Wb/Misc/OSTestSuite.HC
diff --git a/public/src/Misc/PCIDevices.DD.HTML b/public/Wb/Misc/PCIDevices.DD.HTML
old mode 100644
new mode 100755
similarity index 99%
rename from public/src/Misc/PCIDevices.DD.HTML
rename to public/Wb/Misc/PCIDevices.DD.HTML
index 3a12972..1bfb4ca
--- a/public/src/Misc/PCIDevices.DD.HTML
+++ b/public/Wb/Misc/PCIDevices.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
 0033    Paradyne Corp.
         002F    MAIAM Spitfire VGA Accelerator
         00333   OTI107 Spitfire VGA Accelerator
diff --git a/public/src/Once.HC b/public/Wb/Once.HC
similarity index 100%
rename from public/src/Once.HC
rename to public/Wb/Once.HC
diff --git a/public/src/PersonalMenu.DD.HTML b/public/Wb/PersonalMenu.DD.HTML
old mode 100644
new mode 100755
similarity index 88%
rename from public/src/PersonalMenu.DD.HTML
rename to public/Wb/PersonalMenu.DD.HTML
index 9f54f8b..0a13440
--- a/public/src/PersonalMenu.DD.HTML
+++ b/public/Wb/PersonalMenu.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
 Copy this file to your /Home directory and modify it.  This version is the 
 default. 
 
@@ -52,22 +52,22 @@
 Cd("::/Apps");Dir;
 
 
-Run TOSStdIns() if you wish to
+Run TOSStdIns() if you wish to
 use the official staff /Home files.
 Cd("::/Demo/AcctExample");Dir;
 
 
-Make all with BootHDIns().
+Make all with BootHDIns().
 Cd("::/Kernel");Dir;
 
 Cd("::/Compiler");Dir;
 
 
-The ::/StartOS.HC file is compiled every time you boot.
+The ::/StartOS.HC file is compiled every time you boot.
 Cd("::/Adam");Dir;
     
 
-Welcome   Help & Index  Demo Index
+Welcome   Help & Index  Demo Index
 FastReboot Take Tour    Key Map
 
 
diff --git a/public/src/PersonalNotes.DD.HTML b/public/Wb/PersonalNotes.DD.HTML
old mode 100644
new mode 100755
similarity index 94%
rename from public/src/PersonalNotes.DD.HTML
rename to public/Wb/PersonalNotes.DD.HTML
index 3df8474..8a35e7c
--- a/public/src/PersonalNotes.DD.HTML
+++ b/public/Wb/PersonalNotes.DD.HTML
@@ -25,7 +25,7 @@
 
 
 
-
+
 Place your notes or TODO here.
 <CTRL-SHIFT-M>
 
diff --git a/public/src/StartOS.HC b/public/Wb/StartOS.HC
similarity index 100%
rename from public/src/StartOS.HC
rename to public/Wb/StartOS.HC
diff --git a/public/index.html b/public/index.html
index b7b1690..6b41cd6 100644
--- a/public/index.html
+++ b/public/index.html
@@ -6,8 +6,10 @@
 	
 	
 		

TempleOS

-

Documentation

- Welcome to TempleOS +

Documentation

+ Welcome to TempleOS
+ Documentation files
+ View source
diff --git a/public/script/templeos.js b/public/script/templeos.js index cb0fcf7..3b3a2e7 100644 --- a/public/script/templeos.js +++ b/public/script/templeos.js @@ -1,6 +1,10 @@ -// Blink elements -[].forEach.call(document.getElementsByClassName("blink"), function (elem) { - setInterval(function () { - elem.classList.toggle("invert"); - }, 200); -}); +window.onload = function () { + // Blink elements + [].forEach.call(document.getElementsByTagName("blink"), function (elem) { + setTimeout(function () { + var match = getComputedStyle(elem).color.match(/\((\d+), (\d+), (\d+)/); + elem.style.color = "rgb(" + (255 - parseInt(match[1])) + ", " + (255 - parseInt(match[2])) + ", " + (255 - parseInt(match[3])) + ")"; + }, 200); + }); +} + diff --git a/public/src/Adam/ABlkDev/ADskA.HC.HTML b/public/src/Adam/ABlkDev/ADskA.HC.HTML deleted file mode 100644 index 9ae0de2..0000000 --- a/public/src/Adam/ABlkDev/ADskA.HC.HTML +++ /dev/null @@ -1,264 +0,0 @@ - - - - - ADskA.HC - - - - - #help_index "File/Cmd Line (Typically);Cmd Line (Typically)"
-public U8 *DBlk(I64 blk,Bool write=FALSE)
-{//Dump disk block. Optionally, write.
-//If you set write to TRUE, the block will
- //be written when you press <ESC>.
- //See /Demo/Dsk/DskRaw.HC.
- U8 *buf=MAlloc(BLK_SIZE);
-
- BlkRead(Fs->cur_dv,buf,blk,1);
- DocD(buf,BLK_SIZE);
- if (write) {
- "Edit and press <ESC> to write or <SHIFT-ESC>\n";
- if (View) {
- "Write\n";
- BlkWrite(Fs->cur_dv,buf,blk,1);
- }
- }
- return buf;
-}
-
-public U8 *DClus(I64 c,Bool write=FALSE,I64 num=0)
-{//Dump disk clus. Optionally, write.
-//If you set write to TRUE, the clus will
- //be written when you press <ESC>.
- //See /Demo/Dsk/DskRaw.HC.
- //Do Dir("*",TRUE); to get clus numbers of files.
- U8 *buf=MAlloc(Fs->cur_dv->spc<<BLK_SIZE_BITS);
- c=ClusNumNext(Fs->cur_dv,c,num);
- ClusRead(Fs->cur_dv,buf,c,1);
- "Clus:%X\n",c;
- DocD(buf,Fs->cur_dv->spc<<BLK_SIZE_BITS);
- if (write) {
- "Edit and press <ESC> to write or <SHIFT-ESC>\n";
- if (View) {
- "Write\n";
- ClusWrite(Fs->cur_dv,buf,c,1);
- }
- }
- return buf;
-}
-
-public U8 *Dump(U8 *filename,Bool write=FALSE)
-{//Dump file. Optionally, write.
-//If you set write to TRUE, the file will
- //be written when you press <ESC>.
- U8 *buf;
- I64 size;
- if (buf=FileRead(filename,&size)) {
- DocD(buf,size);
- if (write) {
- "Edit and press <ESC> to write or <SHIFT-ESC>\n";
- if (View) {
- "Write\n";
- FileWrite(filename,buf,size);
- }
- }
- }
- return buf;
-}
-
-public Bool Copy(U8 *src_files_find_mask,U8 *dst_files_find_mask=".")
-{//Copy files.
-//If the name ends in ".Z", it will
- //be stored compressed. If not ".Z"
- //it will be stored uncompressed.
- Bool res=TRUE;
- CDirContext *dirc;
- CDirEntry *tmpde,*tmpde1;
- U8 *st;
- if (!(tmpde1=FilesFind(src_files_find_mask,FUF_CLUS_ORDER)))
- return FALSE;
- if (IsDir(dst_files_find_mask)) {
- if (dirc=DirContextNew(dst_files_find_mask,TRUE)) {
- tmpde=tmpde1;
- while (tmpde) {
- if (!(tmpde->attr & RS_ATTR_DIR)) {
- st=FileNameAbs(tmpde->name);
- if (!CopySingle(tmpde->full_name,st))
- res=FALSE;
- Free(st);
- }
- tmpde=tmpde->next;
- }
- DirContextDel(dirc);
- }
- DirTreeDel(tmpde1);
- return res;
- } else {
- DirTreeDel(tmpde1);
- return CopySingle(src_files_find_mask,dst_files_find_mask);
- }
-}
-
-public Bool Move(U8 *f1,U8 *f2)
-{//Move files from one location to another or rename.
- if (Copy(f1,f2)) {
- Del(f1);
- return TRUE;
- }
- return FALSE;
-}
-
-I64 CopyTree2(CDirEntry *tmpde,I64 src_dir_len,I64 dst_dir_len,U8 *dst_dir)
-{
- U8 *st;
- I64 res=1;
- while (tmpde) {
- st=MAlloc(StrLen(tmpde->full_name)+dst_dir_len+2);
- MemCpy(st,dst_dir,dst_dir_len);
- StrCpy(st+dst_dir_len,tmpde->full_name+src_dir_len);
- if (tmpde->attr & RS_ATTR_DIR) {
- DirMk(st,LinkedLstCnt(tmpde->sub));
- res+=CopyTree2(tmpde->sub,src_dir_len,dst_dir_len,dst_dir);
- } else
- if (CopySingle(tmpde->full_name,st))
- res++;
- Free(st);
- tmpde=tmpde->next;
- }
- return res;
-}
-public I64 CopyTree(U8 *src_files_find_mask,U8 *dst_files_find_mask,
- Bool no_mask=TRUE)
-{//Copy directory tree.
-//Returns the count of copied files (not dirs).
- CDirContext *dirc;
- CDirEntry *tmpde=NULL;
- I64 res=0,i1,i2;
- U8 *st1,*st2;
-
- st1=DirNameAbs(src_files_find_mask);
- st2=DirNameAbs(dst_files_find_mask);
- i1=StrLen(st1);
- if (!StrNCmp(st1,st2,i1) && (st2[i1]=='/' || !st2[i1]) ) {
- Free(st1);
- Free(st2);
- return 0;
- }
- Free(st1);
- Free(st2);
- if (dirc=DirContextNew(src_files_find_mask,TRUE,,no_mask)) {
- tmpde=FilesFind(dirc->mask,FUF_RECURSE);
- st1=DirCur;
- DirContextDel(dirc);
- i1=StrLen(st1);
- if (i1==3) i1--;
- if (dirc=DirContextNew(dst_files_find_mask,TRUE,TRUE)) {
- st2=DirCur;
- i2=StrLen(st2);
- if (i2==3) i2--;
- res=CopyTree2(tmpde,i1,i2,st2);
- DirContextDel(dirc);
- Free(st2);
- }
- DirTreeDel(tmpde);
- Free(st1);
- }
- return res;
-}
-
-I64 DelTreeDirs(CDirEntry *tmpde1)
-{
- I64 res=0;
- CDirEntry *tmpde2;
- while (tmpde1) {
- tmpde2=tmpde1->next;
- if (tmpde1->attr & RS_ATTR_DIR) {
- if (tmpde1->sub)
- res+=DelTreeDirs(tmpde1->sub);
- res+=Del(tmpde1->full_name,TRUE,TRUE);
- }
- DirEntryDel(tmpde1);
- tmpde1=tmpde2;
- }
- return res;
-}
-I64 DelTreeFiles(CDirEntry *tmpde1)
-{
- I64 res=0;
- CDirEntry *tmpde2;
- while (tmpde1) {
- tmpde2=tmpde1->next;
- if (tmpde1->attr & RS_ATTR_DIR) {
- if (tmpde1->sub)
- res+=DelTreeFiles(tmpde1->sub);
- } else
- res+=Del(tmpde1->full_name,FALSE,TRUE);
- DirEntryDel(tmpde1);
- tmpde1=tmpde2;
- }
- return res;
-}
-public I64 DelTree(U8 *files_find_mask,U8 *fu_flags=NULL)
-{//Delete directory tree.
- I64 res=0,fuf_flags=0;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
- if (IsDir(files_find_mask)) {
- res=DelTreeDirs(FilesFind(files_find_mask,fuf_flags));
- res+=Del(files_find_mask,TRUE,TRUE);
- res+=Del(files_find_mask,FALSE,TRUE);
- } else
- res=DelTreeFiles(FilesFind(files_find_mask,fuf_flags));
- return res;
-}
-
-U0 TouchFile(U8 *filename,U8 *attr,CDate cdt=I64_MIN)
-{
- CDrv *dv=Let2Drv(*filename);
- CDirEntry de;
- U8 *cur_dir=StrNew(filename),buf[STR_LEN];
- if (FileFind(filename,&de,FUF_JUST_FILES)) {
- Free(de.full_name);
- if (!StrCmp(attr,"+?"))
- "%-48ts%s\n",filename,StrPrintFlags(buf,Define("ST_FILE_ATTRS"),de.attr);
- else {
- StrFirstRem(cur_dir,":");
- StrLastRem(cur_dir,"/");
- if (!*cur_dir)
- StrCpy(cur_dir,"/");
- ScanFlags(&de.attr,Define("ST_FILE_ATTRS"),attr);
- if (cdt==I64_MIN)
- de.datetime=Now;
- else
- de.datetime=cdt;
- DirNew(dv,cur_dir,&de,FALSE);
- }
- } else
- PrintErr("File not found: \"%s\".\n",filename);
- Free(cur_dir);
-}
-public U0 Touch(U8 *files_find_mask="*",U8 *attr="+?",
- U8 *fu_flags=NULL,CDate cdt=I64_MIN)
-{/*Touch file attributes and DateTime.
-Default lists attributes.
-attr: "+?" =show current
-"+T" =resident
-RS_ATTR_READ_ONLY ST_FILE_ATTRS
-To Set DateL:
-Touch(filename,"",,datetime);
-*/
- I64 fuf_flags=0;
- CDirEntry *tmpde,*tmpde1;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+f+F");
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
- tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
- while (tmpde) {
- TouchFile(tmpde->full_name,attr,cdt);
- tmpde=tmpde->next;
- }
- DirTreeDel(tmpde1);
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/ABlkDev/ADskB.HC.HTML b/public/src/Adam/ABlkDev/ADskB.HC.HTML deleted file mode 100644 index a305176..0000000 --- a/public/src/Adam/ABlkDev/ADskB.HC.HTML +++ /dev/null @@ -1,203 +0,0 @@ - - - - - ADskB.HC - - - - - #help_index "File/Internal"
-I64 DirTreeSerializeSize(CDirEntry *tmpde)
-{
- I64 res=0;
- while (tmpde) {
- res+=CDIR_SIZE+1;
- if (tmpde->attr & RS_ATTR_DIR)
- res+=DirTreeSerializeSize(tmpde->sub);
- tmpde=tmpde->next;
- }
- return res+1;
-}
-I64 DirTreeSerializeFill(CDirEntry *tmpde,U8 *dst)
-{
- I64 res=0,i;
- while (tmpde) {
- *dst++=1;
- res++;
- MemCpy(dst,&tmpde->start,CDIR_SIZE);
- dst+=CDIR_SIZE;
- res+=CDIR_SIZE;
- if (tmpde->attr & RS_ATTR_DIR) {
- i=DirTreeSerializeFill(tmpde->sub,dst);
- dst+=i;
- res+=i;
- }
- tmpde=tmpde->next;
- }
- *dst=0;
- return res+1;
-}
-public U8 *DirTreeSerialize(CDirEntry *tmpde,I64 *_size=NULL)
-{//Serialize tree returned from FilesFind() into a one contiguous U8 array.
- I64 size=DirTreeSerializeSize(tmpde);
- U8 *buf=MAlloc(size);
- DirTreeSerializeFill(tmpde,buf);
- if (_size) *_size=size;
- return buf;
-}
-
-U8 *DirTreeUnserialize2(U8 *src,CDirEntry **tmpde)
-{
- CDirEntry *tmpde1;
- if (*src++) {
- tmpde1=CAlloc(sizeof(CDirEntry));
- *tmpde=tmpde1;
- MemCpy(&tmpde1->start,src,CDIR_SIZE);
- src+=CDIR_SIZE;
- if (tmpde1->attr & RS_ATTR_DIR)
- src=DirTreeUnserialize2(src,&tmpde1->sub);
- src=DirTreeUnserialize2(src,&tmpde1->next);
- } else
- *tmpde=NULL;
- return src;
-}
-public CDirEntry *DirTreeUnserialize(U8 *src)
-{//Unserialize tree to make it like a tree returned from FilesFind().
- CDirEntry *tmpde=NULL;
- DirTreeUnserialize2(src,&tmpde);
- return tmpde;
-}
-
-#help_index "File/Program Routines"
-U0 FOFlatten(CDirEntry *tmpde,CDirEntry **a,I64 *i)
-{
- CDirEntry *tmpde1;
- while (tmpde) {
- tmpde1=tmpde->next;
- if (tmpde->attr&RS_ATTR_DIR) {
- FOFlatten(tmpde->sub,a,i);
- DirEntryDel(tmpde);
- } else {
- a[*i]=tmpde;
- *i=*i+1;
- }
- tmpde=tmpde1;
- }
-}
-
-I64 Size1(CDirEntry *tmpde,I64 *_fuf_flags,I64 round_to)
-{
- U8 buf[BLK_SIZE];
- I64 res=0,i;
- CDrv *dv;
- while (tmpde) {
- if ((i=tmpde->size) && Bt(_fuf_flags,FUf_EXPAND) &&
- !(tmpde->attr&RS_ATTR_DIR) &&
- FileAttr(tmpde->name)&RS_ATTR_COMPRESSED) {
- dv=Let2Drv(*tmpde->full_name);
- BlkRead(dv,buf,Clus2Blk(dv,tmpde->clus),1);
- i=(&buf)(CArcCompress *)->expanded_size;
- }
- if (round_to)
- i=CeilU64(tmpde->size,round_to);
- if (tmpde->attr&RS_ATTR_DIR)
- i+=Size1(tmpde->sub,_fuf_flags,round_to);
- tmpde->user_data=i;
- res+=i;
- tmpde=tmpde->next;
- }
- return res;
-}
-public I64 Size(U8 *files_find_mask="/*",U8 *fu_flags=NULL,I64 round_to=0)
-{//Total size of files in mask. "+x" for expanded size.
-//Does not include directory size of base directory, but
- //does include size of sub directories.
- I64 fuf_flags=0,res=0;
- CDirEntry *tmpde1=NULL;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
- if (tmpde1=FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND)) {
- fuf_flags&=FUF_EXPAND;
- res=Size1(tmpde1,&fuf_flags,round_to);
- DirTreeDel(tmpde1);
- }
- return res;
-}
-
-public I64 FileCnt(CDirEntry *tmpde)
-{//Cnt of files in CDirEntry tree.
- I64 cnt=0;
- while (tmpde) {
- if (tmpde->attr&RS_ATTR_DIR)
- cnt+=FileCnt(tmpde->sub);
- else
- cnt++;
- tmpde=tmpde->next;
- }
- return cnt;
-}
-
-#help_index "File/Cmd Line (Typically);Cmd Line (Typically)"
-public I64 FF(U8 *files_find_mask,U8 *fu_flags=NULL)
-{//Files find. List files matching mask.
- I64 cnt=0,fuf_flags=0;
- CDirEntry *tmpde,*tmpde1;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F");
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
- tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
- while (tmpde) {
- PutFileLink(tmpde->full_name);
- '\n';
- cnt++;
- tmpde=tmpde->next;
- }
- DirTreeDel(tmpde1);
- return cnt;
-}
-
-public I64 Zip(U8 *files_find_mask="*",U8 *fu_flags=NULL)
-{//Compress files by moving to .Z filename.
- U8 *st;
- CDirEntry *tmpde,*tmpde1;
- I64 res=0,fuf_flags=0;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F+O");
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
- tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
- while (tmpde) {
- if (!IsDotZ(tmpde->full_name)) {
- st=MStrPrint("%s.Z",tmpde->full_name);
- res+=Move(tmpde->full_name,st);
- Free(st);
- }
- tmpde=tmpde->next;
- }
- DirTreeDel(tmpde1);
- return res;
-}
-
-public I64 Unzip(U8 *files_find_mask="*.Z",U8 *fu_flags=NULL)
-{//Uncompress files by moving to not .Z filename.
-//You don't have to do this for normal operation.
- //It automatically unzips ".Z" files.
- U8 *st;
- CDirEntry *tmpde,*tmpde1;
- I64 res=0,fuf_flags=0;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F+O");
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
- tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
- while (tmpde) {
- if (IsDotZ(tmpde->full_name)) {
- st=StrNew(tmpde->full_name);
- StrLastRem(st,".");
- res+=Move(tmpde->full_name,st);
- Free(st);
- }
- tmpde=tmpde->next;
- }
- DirTreeDel(tmpde1);
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/ABlkDev/DskChk.HC.HTML b/public/src/Adam/ABlkDev/DskChk.HC.HTML deleted file mode 100644 index 13ed663..0000000 --- a/public/src/Adam/ABlkDev/DskChk.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - DskChk.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Adam/ABlkDev/DskPrt.HC.HTML b/public/src/Adam/ABlkDev/DskPrt.HC.HTML deleted file mode 100644 index a88eecc..0000000 --- a/public/src/Adam/ABlkDev/DskPrt.HC.HTML +++ /dev/null @@ -1,179 +0,0 @@ - - - - - DskPrt.HC - - - - - #help_index "Install;File/Cmd Line (Typically);Cmd Line (Typically)"
-
-#define ROUND_DRV_TO (63*255)
-#define DRV_HEADER 63
-
-class CPlannedDrv
-{
- CPlannedDrv *next,*last;
- I64 size;
- Bool pri;
-};
-
-public I64 DskPrt(U8 drv_let=0,...)
-{/*Partition the disk containing partition drv_let.
-
-drv_let=0 means add new drive that is not already mounted.
-
->DskPrt('C',0.5,0.25,0.25); //Make three. 50% C, 25% D, 25% E, round-up to blk.
-
-*/
- CBlkDev *bd;
- CPlannedDrv head,*tmppp;
- CMasterBoot mbr;
- Bool pri=TRUE;
- I64 ext_base,drv_let2,pri_cnt=0,i,start_offset,offset,
- total,remaining,cur_arg=0;
- "This command does not play well\n"
- "with other operating systems.\n"
- "You really should use another\n"
- "operating system's partitioner.\n"
- "If you use this, it may, in fact,\n"
- "make your hard drive impossible\n"
- "to repartition with other operating\n"
- "until you set block zero to zero\n"
- "with $LK,\"BootMHDZero\",\"MN:BootMHDZero\"$()\n\n\n"
- "Continue";
- if (argc<=cur_arg && !YorN)
- return 0;
- '\n';
-
- if (drv_let && !Let2BlkDev(drv_let,FALSE))
- drv_let=0;
- if (!drv_let && !(drv_let=Mount(TRUE)) ||
- !(bd=Let2BlkDev(drv_let,FALSE)) || bd->type!=BDT_ATA)
- return 0;
-
- total=bd->max_blk+1;
- QueInit(&head);
- drv_let2=bd->first_drv_let;
- remaining=FloorU64(bd->max_blk+1,ROUND_DRV_TO);
- while (FloorU64(remaining,ROUND_DRV_TO)>=ROUND_DRV_TO) {
- tmppp=MAlloc(sizeof(CPlannedDrv));
- do {
- "$RED$Partition %C$FG$\n",drv_let2;
- tmppp->pri=FALSE;
- if (pri) {
- "Primary Partition";
- if (argc>cur_arg || YorN) {
- pri_cnt++;
- tmppp->pri=TRUE;
- if (pri_cnt==3)
- pri=FALSE;
- } else
- pri=FALSE;
- }
- "\nBlocks Remaining:%d (0x%X)\n",
- remaining-DRV_HEADER,remaining-DRV_HEADER;
- if (argc>cur_arg)
- tmppp->size=MinI64(CeilU64(MaxI64(remaining,DRV_HEADER),ROUND_DRV_TO),
- CeilU64(argv[cur_arg++](F64)*total,ROUND_DRV_TO));
- else
- tmppp->size=CeilU64(GetI64("Size in Blocks:",
- remaining-DRV_HEADER)+DRV_HEADER,ROUND_DRV_TO);
- } while (!(ROUND_DRV_TO<=tmppp->size<=FloorU64(remaining,ROUND_DRV_TO)));
- QueIns(tmppp,head.last);
- remaining-=tmppp->size;
- drv_let2++;
- }
-
- "\n\n!!! Repartition Drive !!!\n\n";
- tmppp=head.next;
- drv_let2=bd->first_drv_let;
- while (tmppp!=&head) {
- "Drive %C:%08X ",drv_let2,tmppp->size;
- if (tmppp->pri)
- "Primary\n";
- else
- "Logical\n";
- tmppp=tmppp->next;
- drv_let2++;
- }
- if (!argc && !AreYouSure)
- goto pd_done;
-
- remaining=FloorU64(bd->max_blk+1,ROUND_DRV_TO)-ROUND_DRV_TO;
- tmppp=head.next;
- MemSet(&mbr,0,BLK_SIZE);
- mbr.signature=0xAA55;
- offset=0;
- for (i=0;i<pri_cnt;i++) {
- mbr.p[i].active=0x80;
- mbr.p[i].start_head=0;
- mbr.p[i].start_cyl=0x101;
- mbr.p[i].type=1; //Will get set different.
- mbr.p[i].end_head=0xFE;
- mbr.p[i].end_cyl=0xFFFF;
- mbr.p[i].offset=DRV_HEADER+offset;
- mbr.p[i].size=tmppp->size-DRV_HEADER;
- offset+=tmppp->size;
- remaining-=tmppp->size;
- tmppp=tmppp->next;
- }
- if (!i) i++;
- if (tmppp!=&head) {
- mbr.p[i].active=0x80;
- mbr.p[i].start_head=0;
- mbr.p[i].start_cyl=0x101;
- mbr.p[i].type=0xF;
- mbr.p[i].end_head=0xFE;
- mbr.p[i].end_cyl=0xFFFF;
- mbr.p[i].offset=offset;
- mbr.p[i].size=remaining;
- ext_base=offset;
- }
- ATAWriteBlks(bd,&mbr,0,1);
-
- while (tmppp!=&head) {
- start_offset=offset;
- MemSet(&mbr,0,BLK_SIZE);
- mbr.signature=0xAA55;
-
- mbr.p[0].active=0x80;
- mbr.p[0].start_head=1;
- mbr.p[0].start_cyl=0x101;
- mbr.p[0].type=1; //Will get set different.
- mbr.p[0].end_head=0xFE;
- mbr.p[0].end_cyl=0xFFFF;
- mbr.p[0].offset=DRV_HEADER;
- mbr.p[0].size=tmppp->size-DRV_HEADER;
- offset+=tmppp->size;
- tmppp=tmppp->next;
- if (tmppp!=&head) {
- mbr.p[1].active=0x80;
- mbr.p[1].start_head=0;
- mbr.p[1].start_cyl=0x101;
- mbr.p[1].type=5;
- mbr.p[1].end_head=0xFE;
- mbr.p[1].end_cyl=0xFFFF;
- mbr.p[1].offset=offset-ext_base;
- mbr.p[1].size=tmppp->size;
- }
- ATAWriteBlks(bd,&mbr,start_offset,1);
- }
-
- bd->flags&=~(BDF_INITIALIZED | BDF_INIT_IN_PROGRESS);
- BlkDevAdd(bd,,FALSE,TRUE);
- for (i=bd->first_drv_let;i<drv_let2;i++)
- Fmt(i,,FALSE);
-
- pd_done:
- while (head.next!=&head) {
- tmppp=head.next;
- QueRem(tmppp);
- Free(tmppp);
- }
- return total;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/ABlkDev/FileMgr.HC.HTML b/public/src/Adam/ABlkDev/FileMgr.HC.HTML deleted file mode 100644 index e1306be..0000000 --- a/public/src/Adam/ABlkDev/FileMgr.HC.HTML +++ /dev/null @@ -1,803 +0,0 @@ - - - - - FileMgr.HC - - - - - #help_index "DolDoc/Output;StdOut/DolDoc"
-U0 DirFileDoc(CDoc *doc,CDirEntry *tmpde)
-{
- while (tmpde) {
- if (tmpde->attr & RS_ATTR_DIR) {
- tmpde->user_data=DocPrint(doc,"$TR,\"%s\",U=0x%X$",tmpde->name,tmpde);
- DocPrint(doc,"\n$ID,+2$");
- if (tmpde->sub)
- DirFileDoc(doc,tmpde->sub);
- DocPrint(doc,"$ID,-2$");
- } else {
- tmpde->user_data=DocPrint(doc,"$MU,\"%s\",U=0x%X$",tmpde->name,tmpde);
- DocPrint(doc,"\n");
- }
- tmpde=tmpde->next;
- }
-}
-
-#help_index "File/Cmd Line (Typically);Cmd Line (Typically)"
-
-#define FM_NORMAL 0
-#define FM_PICK_FILE 1
-#define FM_PICK_DIR 2
-
-class CFMUncollapsedLst
-{
- CFMUncollapsedLst *next;
- U8 *name;
-};
-
-CFMUncollapsedLst *FMCollectUncollapsedLst(CDoc *doc)
-{
- CDocEntry *doc_e=doc->head.next;
- CFMUncollapsedLst *res=NULL,*tmpc;
- CDirEntry *tmpde;
- while (doc_e!=doc) {
- if (doc_e->type_u8==DOCT_TREE) {
- if (!(doc_e->de_flags&DOCEF_CHECKED_COLLAPSED)) {
- if (tmpde=doc_e->user_data) {
- tmpc=MAlloc(sizeof(CFMUncollapsedLst));
- tmpc->next=res;
- res=tmpc;
- tmpc->name=StrNew(tmpde->full_name);
- }
- }
- }
- doc_e=doc_e->next;
- }
- return res;
-}
-
-U0 FMMarkUncollapsed(CDoc *doc,CFMUncollapsedLst *tmpc,
- U8 *cur_entry,U8 *next_entry)
-{
- CDocEntry *doc_e=doc->head.next;
- CFMUncollapsedLst *tmpc1;
- CDirEntry *tmpde;
- while (doc_e!=doc) {
- if (doc_e->type_u8==DOCT_TREE) {
- tmpde=doc_e->user_data;
- tmpc1=tmpc;
- while (tmpc1) {
- if (!StrCmp(tmpc1->name,tmpde->full_name)) {
- doc_e->de_flags&=~DOCEF_CHECKED_COLLAPSED;
- break;
- }
- tmpc1=tmpc1->next;
- }
- if (cur_entry) {
- if (!StrNCmp(cur_entry,tmpde->full_name,StrLen(tmpde->full_name))) {
- doc->cur_entry=doc_e;
- if (StrLen(tmpde->full_name)==StrLen(cur_entry))
- cur_entry=NULL;
- } else if (next_entry) {
- if (!StrNCmp(next_entry,
- tmpde->full_name,StrLen(tmpde->full_name))) {
- doc->cur_entry=doc_e;
- if (StrLen(tmpde->full_name)==StrLen(next_entry))
- cur_entry=NULL;
- }
- }
- }
- } else if (doc_e->type_u8==DOCT_MENU_VAL) {
- tmpde=doc_e->user_data;
- if (cur_entry) {
- if (!StrNCmp(cur_entry,tmpde->full_name,StrLen(tmpde->full_name))) {
- doc->cur_entry=doc_e;
- if (StrLen(tmpde->full_name)==StrLen(cur_entry))
- cur_entry=NULL;
- } else if (next_entry) {
- if (!StrNCmp(next_entry,
- tmpde->full_name,StrLen(tmpde->full_name))) {
- doc->cur_entry=doc_e;
- if (StrLen(tmpde->full_name)==StrLen(next_entry))
- cur_entry=NULL;
- }
- }
- }
- }
- doc_e=doc_e->next;
- }
-}
-
-U0 FMDelUncollapsedLst(CFMUncollapsedLst *tmpc)
-{
- CFMUncollapsedLst *tmpc1;
- while (tmpc) {
- tmpc1=tmpc->next;
- Free(tmpc->name);
- Free(tmpc);
- tmpc=tmpc1;
- }
-}
-
-CDirEntry *FMRebuildDocDrv(U8 drv_let,CDoc *doc,CDirEntry **_head,Bool init)
-{
- CDirEntry *tmpde,*tmpde1;
- U8 *st;
- tmpde=CAlloc(sizeof(CDirEntry));
- tmpde->full_name=MStrPrint("%C:/",drv_let);
- tmpde->attr=RS_ATTR_DIR;
- st=MStrPrint("%c:/*",drv_let);
- if (init)
- tmpde->sub=tmpde1=FilesFind(st,FUF_RECURSE);
- else
- tmpde1=NULL;
- Free(st);
- tmpde->user_data=DocPrint(doc,"$TR,\"%s\",U=0x%X$",tmpde->full_name,tmpde);
- tmpde->next=*_head;
- *_head=tmpde;
- DocPrint(doc,"\n$ID,+2$");
- DocBottom(doc);
- if (init) {
- DirFileDoc(doc,tmpde1);
- while (tmpde1) {
- tmpde1->parent=tmpde;
- tmpde1=tmpde1->next;
- }
- }
- DocPrint(doc,"$ID,-2$");
- return tmpde;
-}
-
-#define DEF2_PROCESSED 1
-#define DEF2_NOT_INITIALIZED 2
-
-U0 FMRebuildDoc(CDoc **_doc,CDirEntry **_head,I64 mode)
-{
- CDrv *dv;
- I64 i;
- CDoc *doc=*_doc,*doc2=sys_clip_doc,*parent_doc;
- CFMUncollapsedLst *tmpc=NULL;
- U8 *cur_entry=NULL,*next_entry=NULL;
- CDocEntry *doc_ce;
- CDirEntry *tmpde,*tmpde1,*cur_tree_entry;
- if (!doc)
- parent_doc=DocPut;
- else {
- parent_doc=doc->parent_doc;
- Fs->put_doc=Fs->display_doc=NULL;
- DocUnlock(doc);
- Refresh;
- DocLock(doc);
- cur_tree_entry=NULL;
- doc_ce=doc->cur_entry;
- if (doc_ce->type_u8==DOCT_TREE || doc_ce->type_u8==DOCT_MENU_VAL)
- cur_tree_entry=doc_ce->user_data;
- if (cur_tree_entry)
- cur_entry=StrNew(cur_tree_entry->full_name);
- tmpde=NULL;
- if (doc_ce!=doc)
- doc_ce=doc_ce->next;
- while (doc_ce!=doc) {
- if (doc_ce->type_u8==DOCT_TREE || doc_ce->type_u8==DOCT_MENU_VAL)
- tmpde=doc_ce->user_data;
- else
- tmpde=NULL;
- if (tmpde) {
- tmpde1=tmpde->parent;
- while (tmpde1) {
- if (tmpde1==cur_tree_entry) {
- tmpde=NULL;
- break;
- } else
- tmpde1=tmpde1->parent;
- }
- if (tmpde)
- break;
- }
- doc_ce=doc_ce->next;
- }
- if (tmpde)
- next_entry=StrNew(tmpde->full_name);
-
- tmpc=FMCollectUncollapsedLst(doc);
- DocDel(doc);
- }
- if (*_head) {
- DirTreeDel(*_head);
- *_head=NULL;
- }
- doc=DocNew;
- doc->desc='FileMan';
- doc->parent_doc=parent_doc;
- doc->flags|=DOCF_FORM;
- switch (mode) {
- case FM_NORMAL:
- DocPrint(doc,"$PURPLE$File Manager\n\n"
- "$LK,\"Click for Help\",A=\"FI:::/Doc/FileMgr.DD\"$\n\n");
- break;
- case FM_PICK_FILE:
- DocPrint(doc,"$PURPLE$Pick file and press <ESC>\n\n");
- doc->flags|=DOCF_SIZE_MIN;
- break;
- case FM_PICK_DIR:
- DocPrint(doc,"$PURPLE$Pick directory and press <ESC>\n\n");
- doc->flags|=DOCF_SIZE_MIN;
- break;
- }
- DocPrint(doc,"$LTBLUE$");
- for (i=0;i<DRVS_NUM;i++) {
- dv=&blkdev.drvs[i];
- if (dv->bd->type==BDT_ATAPI) {
- if (dv->bd->flags&BDF_INITIALIZED)
- tmpde=FMRebuildDocDrv(Drv2Let(dv),doc,_head,TRUE);
- else {
- tmpde=FMRebuildDocDrv(Drv2Let(dv),doc,_head,FALSE);
- tmpde->user_data2|=DEF2_NOT_INITIALIZED;
- }
- } else if (dv->fs_type==FSt_REDSEA || dv->fs_type==FSt_FAT32)
- FMRebuildDocDrv(Drv2Let(dv),doc,_head,TRUE);
- }
- DocTop(doc);
- FMMarkUncollapsed(doc,tmpc,cur_entry,next_entry);
- DocCenter(doc);
- DocRst(doc2,TRUE);
- FMDelUncollapsedLst(tmpc);
- Free(cur_entry);
- Free(next_entry);
- *_doc=doc;
- DocLock(doc);
- Fs->put_doc=Fs->display_doc=doc;
-}
-
-U0 FMRename(CDoc *doc)
-{
- CEdFileName fn;
- CDocEntry *doc_e=doc->cur_entry;
- CDirEntry *tmpde=NULL,*parent;
- if (doc_e->type_u8==DOCT_MENU_VAL) {
- tmpde=doc_e->user_data;
- if (parent=tmpde->parent) {
- Cd(parent->full_name);
- StrCpy(fn.name,tmpde->name);
- if (DocForm(&fn)) {
- Silent;
- Move(tmpde->name,fn.name);
- Silent(OFF);
- }
- }
- } else if (doc_e->type_u8==DOCT_TREE) {
- tmpde=doc_e->user_data;
- if (parent=tmpde->parent) {
- Cd(parent->full_name);
- StrCpy(fn.name,tmpde->name);
- if (DocForm(&fn)) {
- if (StrCmp(tmpde->name,fn.name)) {
- Silent;
- if (CopyTree(tmpde->name,fn.name))
- DelTree(tmpde->name);
- Silent(OFF);
- }
- }
- }
- }
-}
-
-U0 FMMkDir(CDoc *doc)
-{
- CEdFileName fn;
- CDocEntry *doc_e=doc->cur_entry;
- CDirEntry *tmpde=NULL,*parent;
- *fn.name=0;
- if (doc_e->type_u8==DOCT_MENU_VAL) {
- tmpde=doc_e->user_data;
- if (parent=tmpde->parent) {
- Cd(parent->full_name);
- if (DocForm(&fn)) {
- Silent;
- DirMk(fn.name);
- Silent(OFF);
- }
- }
- } else if (doc_e->type_u8==DOCT_TREE) {
- tmpde=doc_e->user_data;
- Cd(tmpde->full_name);
- if (DocForm(&fn)) {
- Silent;
- DirMk(fn.name);
- Silent(OFF);
- }
- }
-}
-
-U0 FMDelete(CDoc *doc)
-{
- U8 *st;
- CDocEntry *doc_ce=doc->cur_entry;
- CDirEntry *tmpde;
- if (doc_ce->type_u8==DOCT_MENU_VAL) {
- tmpde=doc_ce->user_data;
- Silent;
- st=MStrPrint("Delete: %s",tmpde->full_name);
- if (PopUpCancelOk(st))
- Del(tmpde->full_name);
- Free(st);
- Silent(OFF);
- } else if (doc_ce->type_u8==DOCT_TREE) {
- tmpde=doc_ce->user_data;
- Silent;
- st=MStrPrint("Delete: %s",tmpde->full_name);
- if (PopUpCancelOk(st))
- DelTree(tmpde->full_name);
- Free(st);
- Silent(OFF);
- }
-}
-
-U0 FMChgDsk(CDoc *doc)
-{
- CDocEntry *doc_ce=doc->cur_entry;
- CDirEntry *tmpde;
- if (doc_ce->type_u8==DOCT_TREE || doc_ce->type_u8==DOCT_MENU_VAL)
- tmpde=doc_ce->user_data;
- else
- tmpde=NULL;
- if (tmpde) {
- while (tmpde->parent)
- tmpde=tmpde->parent;
- Silent;
- DskChg(*tmpde->full_name);
- Silent(OFF);
- }
-}
-
-U0 FMMountISO(CDoc *doc)
-{
- CDocEntry *doc_ce=doc->cur_entry;
- CDirEntry *tmpde;
- if (doc_ce->type_u8==DOCT_MENU_VAL && (tmpde=doc_ce->user_data))
- MountFile(tmpde->full_name);
-}
-
-U0 FMUnmount(CDoc *doc)
-{
- CDocEntry *doc_ce=doc->cur_entry;
- CDirEntry *tmpde;
- I64 drv_let;
- if (doc_ce->type_u8==DOCT_TREE || doc_ce->type_u8==DOCT_MENU_VAL)
- tmpde=doc_ce->user_data;
- else
- tmpde=NULL;
- if (tmpde) {
- while (tmpde->parent)
- tmpde=tmpde->parent;
- drv_let=*tmpde->full_name;
- if (Let2BlkDev(drv_let)!=Let2BlkDev(':'))
- Unmount(drv_let);
- }
-}
-
-U0 FMFmtDrv(CDoc *doc)
-{
- CDocEntry *doc_ce=doc->cur_entry;
- CDirEntry *tmpde;
- U8 *st=NULL;
- if (doc_ce->type_u8==DOCT_TREE || doc_ce->type_u8==DOCT_MENU_VAL)
- tmpde=doc_ce->user_data;
- else
- tmpde=NULL;
- if (tmpde) {
- while (tmpde->parent)
- tmpde=tmpde->parent;
- st=MStrPrint("Format Drive '%c'?\nAre You Sure?\n",*tmpde->full_name);
- if (PopUpCancelOk(st)) {
- Silent;
- Fmt(*tmpde->full_name,,FALSE);
- Silent(OFF);
- }
- }
- Free(st);
-}
-
-U0 FMMakeISO(CDoc *doc)
-{
- CDocEntry *doc_ce=doc->cur_entry;
- CDirEntry *tmpde;
- if (doc_ce->type_u8==DOCT_TREE || doc_ce->type_u8==DOCT_MENU_VAL)
- tmpde=doc_ce->user_data;
- else
- tmpde=NULL;
- if (tmpde) {
- if (doc_ce->type_u8==DOCT_MENU_VAL)
- tmpde=tmpde->parent;
- if (tmpde && *tmpde->full_name) {
- Silent;
- RedSeaISO(,tmpde->full_name);
- Silent(OFF);
- }
- }
-}
-
-U0 FMBurnISO(CDoc *doc)
-{
- CDocEntry *doc_ce=doc->cur_entry;
- CDirEntry *tmpde;
- if (doc_ce->type_u8==DOCT_TREE || doc_ce->type_u8==DOCT_MENU_VAL)
- tmpde=doc_ce->user_data;
- else
- tmpde=NULL;
- if (tmpde) {
- while (tmpde->parent)
- tmpde=tmpde->parent;
- Silent;
- DVDImageWrite(*tmpde->full_name);
- Silent(OFF);
- }
-}
-
-U0 FMCopy(CDoc *doc)
-{
- CDoc *doc2=sys_clip_doc;
- U8 *st;
- CDocEntry *doc_ce=doc->cur_entry,*doc_e;
- CDirEntry *tmpde,*tmpde1=NULL,*tmpde2;
- Bool unlock_doc2=DocLock(doc2);
- doc_e=doc2->head.next;
-
- tmpde1=doc_ce->user_data;
- if (doc_ce->type_u8==DOCT_MENU_VAL)
- tmpde1=tmpde1->parent;
- else if (doc_ce->type_u8!=DOCT_TREE)
- tmpde1=NULL;
- if (tmpde1) {
- while (doc_e!=doc2) {
- if (doc_e->type_u8==DOCT_MENU_VAL) {
- tmpde=doc_e->user_data;
- tmpde->user_data2|=DEF2_PROCESSED;
- tmpde2=tmpde->parent;
- if (!tmpde2 || !(tmpde2->user_data2&DEF2_PROCESSED)) {
- Silent;
- Copy(tmpde->full_name,tmpde1->full_name);
- Silent(OFF);
- }
- } else if (doc_e->type_u8==DOCT_TREE) {
- tmpde=doc_e->user_data;
- tmpde->user_data2|=DEF2_PROCESSED;
- tmpde2=tmpde->parent;
- if (!tmpde2 || !(tmpde2->user_data2&DEF2_PROCESSED)) {
- Silent;
- if (*tmpde1->name)
- st=MStrPrint("%s/%s",tmpde1->full_name,tmpde->name);
- else
- st=MStrPrint("%s%s",tmpde1->full_name,tmpde->name);
- CopyTree(tmpde->full_name,st);
- Free(st);
- Silent(OFF);
- }
- }
- doc_e=doc_e->next;
- }
- }
- if (unlock_doc2)
- DocUnlock(doc2);
-}
-
-#define FMR_INCLUDE 0
-#define FMR_ADAM_INCLUDE 1
-#define FMR_DELETE 2
-#define FMR_RENAME 3
-#define FMR_MKDIR 4
-#define FMR_PLAIN 5
-#define FMR_PASTE 6
-#define FMR_CHG_DSK 7
-#define FMR_FORMAT 8
-#define FMR_MOUNT_REDSEA_ISO_C 9
-#define FMR_UNMOUNT 10
-#define FMR_MAKE_REDSEA_ISO_C 11
-#define FMR_BURN_ISO 12
-#define FMR_HELP 13
-
-I64 PopUpFMRight(U8 *header=NULL,U8 *footer=NULL)
-{
- I64 i;
- CDoc *doc=DocNew;
- if (header) DocPrint(doc,"%s",header);
- DocPrint(doc,"$CM+LX,1,1 $$BT,\"INCLUDE\",LE=FMR_INCLUDE$"
- "$CM+LX,29,0$$BT,\"ADAMINCLUDE\",LE=FMR_ADAM_INCLUDE$"
- "$CM+LX,1,3 $$BT,\"DELETE\",LE=FMR_DELETE$"
- "$CM+LX,29,0$$BT,\"RENAME\",LE=FMR_RENAME$"
- "$CM+LX,1,3 $$BT,\"MAKEDIRECTORY\",LE=FMR_MKDIR$"
- "$CM+LX,29,0$$BT,\"PLAIN-TEXTEDIT\",LE=FMR_PLAIN$"
- "$CM+LX,1,3 $$BT,\"PASTECLIPFILES\",LE=FMR_PASTE$"
- "$CM+LX,29,0$$BT,\"CHANGEDISK(MOUNTIT)\",LE=FMR_CHG_DSK$"
- "$CM+LX,1,3 $$BT,\"FORMAT\",LE=FMR_FORMAT$"
- "$CM+LX,1,3 $$BT,\"MOUNTISO.CFILE\","
- "LE=FMR_MOUNT_REDSEA_ISO_C$"
- "$CM+LX,29,0$$BT,\"UNMOUNT\",LE=FMR_UNMOUNT$"
- "$CM+LX,1,3 $$BT,\"MAKEISO.C(CD/DVD)FILE\",LE=FMR_MAKE_REDSEA_ISO_C$"
- "$CM+LX,29,0$$BT,\"BURNISO(CD/DVD)FILE\",LE=FMR_BURN_ISO$"
- "$CM+LX,1,3 $$BT,\"HELP\",LE=FMR_HELP$"
- "$CM+LX,29,0$$BT,\"CANCEL\",LE=DOCM_CANCEL$\n");
- if (footer) DocPrint(doc,"%s",footer);
- i=PopUpMenu(doc);
- DocDel(doc);
- return i;
-}
-
-U0 FMRightClick()
-{
- switch (PopUpFMRight) {
- case FMR_INCLUDE:
- Msg(MSG_KEY_DOWN,0,0x3F0000003F);
- break;
- case FMR_ADAM_INCLUDE:
- Msg(MSG_KEY_DOWN,0,0x23F0000023F);
- break;
- case FMR_DELETE:
- Msg(MSG_KEY_DOWN,CH_CTRLY,0);
- break;
- case FMR_RENAME:
- Msg(MSG_KEY_DOWN,'r',0);
- break;
- case FMR_MKDIR:
- Msg(MSG_KEY_DOWN,'d',0);
- break;
- case FMR_PLAIN:
- Msg(MSG_KEY_DOWN,CH_SHIFT_SPACE,0);
- break;
- case FMR_PASTE:
- Msg(MSG_KEY_DOWN,0,SC_INS+SCF_SHIFT);
- break;
- case FMR_CHG_DSK:
- Msg(MSG_KEY_DOWN,'c',0);
- break;
- case FMR_FORMAT:
- Msg(MSG_KEY_DOWN,'f',0);
- break;
- case FMR_MOUNT_REDSEA_ISO_C:
- Msg(MSG_KEY_DOWN,'i',0);
- break;
- case FMR_UNMOUNT:
- Msg(MSG_KEY_DOWN,'u',0);
- break;
- case FMR_MAKE_REDSEA_ISO_C:
- Msg(MSG_KEY_DOWN,'m',0);
- break;
- case FMR_BURN_ISO:
- Msg(MSG_KEY_DOWN,'B',0);
- break;
- case FMR_HELP:
- Msg(MSG_KEY_DOWN,CH_CTRLM,0x43200000432);
- break;
- }
-}
-
-U8 *fm_ms_str=NULL;
-U0 (*fp_old_final_scrn_update)(CDC *dc);
-
-U0 FMFinalScrnUpdate(CDC *dc)
-{
- if (fm_ms_str) {
- dc->color=LTRED;
- GrPrint(dc,ms.pos.x,ms.pos.y,"%s",fm_ms_str);
- }
- (*fp_old_final_scrn_update)(dc);
-}
-
-public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
-{//File manager. Also, used to choose files and dirs.
- CDirEntry *head=NULL,*tmpde,*tmpde1,*tmpde2;
- I64 sc,ch,arg1,arg2,msg_code;
- CDoc *doc=NULL,*old_put_doc=DocPut,*old_display_doc=DocDisplay;
- U8 *res=NULL,*st,*st2,*old_cur_dir=DirCur;
- CDocEntry *doc_ce=NULL,*doc_e;
- Bool okay;
-
- SettingsPush; //See SettingsPush
- fp_old_final_scrn_update=gr.fp_final_scrn_update;
- MenuFilePush("::/Doc/FileMgrPullDown.DD");
- FMRebuildDoc(&doc,&head,mode);
- if (tmpde1=Cd2DirEntry(head,old_cur_dir))
- doc->cur_entry=tmpde1->user_data;
- while (tmpde1) {
- if (tmpde1->attr&RS_ATTR_DIR)
- tmpde1->user_data(CDocEntry *)->de_flags&=~DOCEF_CHECKED_COLLAPSED;
- tmpde1=tmpde1->parent;
- }
- do {
- DocUnlock(doc);
- do msg_code=GetMsg(&arg1,&arg2,
- 1<<MSG_KEY_DOWN|1<<MSG_MS_L_DOWN|1<<MSG_MS_L_UP|1<<MSG_MS_R_UP);
- while (Fs!=sys_focus_task);
- DocLock(doc);
- switch (msg_code) {
- case MSG_MS_R_UP:
- DocUnlock(doc);
- FMRightClick;
- DocLock(doc);
- break;
- case MSG_MS_L_DOWN:
- doc_ce=doc->cur_entry;
- fm_ms_str=doc_ce->tag;
- gr.fp_final_scrn_update=&FMFinalScrnUpdate;
- break;
- case MSG_MS_L_UP:
- if (doc_ce) {
- gr.fp_final_scrn_update=fp_old_final_scrn_update;
- if (WinCursorPosSet(Fs,arg1+Fs->pix_left+Fs->scroll_x,
- arg2+Fs->pix_top+Fs->scroll_y,TRUE)) {
- doc_e=doc->cur_entry;
- if (doc_e!=doc_ce) {
- st2=NULL;
- if (doc_e->type_u8==DOCT_MENU_VAL) {
- tmpde1=doc_e->user_data;
- if (tmpde1=tmpde1->parent)
- st2=StrNew(tmpde1->full_name);
- } else if (doc_e->type_u8==DOCT_TREE) {
- tmpde1=doc_e->user_data;
- st2=StrNew(tmpde1->full_name);
- }
- if (st2 && doc_ce->type_u8==DOCT_MENU_VAL) {
- tmpde=doc_ce->user_data;
- Silent;
- Move(tmpde->full_name,st2);
- Silent(OFF);
- FMRebuildDoc(&doc,&head,mode);
- } else if (st2 && doc_ce->type_u8==DOCT_TREE) {
- tmpde=doc_ce->user_data;
- okay=TRUE;
- tmpde2=tmpde1;
- while (tmpde2) {
- if (tmpde2!=tmpde)
- tmpde2=tmpde2->parent;
- else {
- okay=FALSE;
- break;
- }
- }
- if (okay) {
- if (*tmpde1->name)
- st=MStrPrint("%s/%s",tmpde1->full_name,tmpde->name);
- else
- st=MStrPrint("%s%s",tmpde1->full_name,tmpde->name);
- if (StrCmp(tmpde->full_name,st)) {
- Silent;
- CopyTree(tmpde->full_name,st);
- DelTree(tmpde->full_name);
- Silent(OFF);
- FMRebuildDoc(&doc,&head,mode);
- }
- Free(st);
- }
- }
- Free(st2);
- FlushMsgs;
- } else
- if (doc_e->type_u8==DOCT_MENU_VAL) {
- DocUnlock(doc);
- Ed(doc_e->user_data(CDirEntry *)->full_name);
- DocLock(doc);
- }
- doc_ce=NULL;
- }
- }
- break;
- case MSG_KEY_DOWN:
- doc_ce=NULL;
- ch=arg1; sc=arg2;
- if (sc.u8[0]==SC_DELETE && !(sc&(SCF_SHIFT|SCF_CTRL)))
- ch=CH_CTRLY;
- if (ch && sc&SCF_ALT) goto fm_regular_key;
- switch (ch) {
- case '\n':
- DocUnlock(doc);
- FMRightClick;
- DocLock(doc);
- break;
- start:
- DocUnlock(doc);
- case CH_CTRLV:
- FMCopy(doc);
- break;
- case 'r':
- FMRename(doc);
- break;
- case 'd':
- FMMkDir(doc);
- break;
- case CH_CTRLY:
- FMDelete(doc);
- break;
- case 'c':
- FMChgDsk(doc);
- break;
- case 'i':
- FMMountISO(doc);
- break;
- case 'u':
- FMUnmount(doc);
- break;
- case 'm':
- FMMakeISO(doc);
- break;
- case 'B':
- FMBurnISO(doc);
- break;
- case 'f':
- FMFmtDrv(doc);
- break;
- end:
- FMRebuildDoc(&doc,&head,mode);
- break;
- case CH_SHIFT_ESC:
- break;
- case CH_SPACE:
- if (doc->cur_entry->type_u8==DOCT_MENU_VAL) {
- DocUnlock(doc);
- Ed(doc->cur_entry->user_data(CDirEntry *)->full_name);
- DocLock(doc);
- } else
- goto fm_regular_key;
- break;
- case CH_SHIFT_SPACE:
- if (doc->cur_entry->type_u8==DOCT_MENU_VAL) {
- DocUnlock(doc);
- Plain(doc->cur_entry->user_data(CDirEntry *)->full_name);
- DocLock(doc);
- } else
- goto fm_regular_key;
- break;
- case CH_ESC:
- doc_ce=doc->cur_entry;
- tmpde=doc_ce->user_data;
- if (mode==FM_PICK_FILE && doc_ce->type_u8==DOCT_MENU_VAL)
- res=StrNew(tmpde->full_name,mem_task);
- else if (mode==FM_PICK_DIR) {
- if (doc_ce->type_u8==DOCT_TREE)
- res=StrNew(tmpde->full_name,mem_task);
- else if (doc_ce->type_u8==DOCT_MENU_VAL &&
- (tmpde=tmpde->parent))
- res=StrNew(tmpde->full_name,mem_task);
- }
- break;
- default:
- if (sc.u8[0]==SC_INS && sc&SCF_SHIFT && !(sc&SCF_CTRL)) {
- FMCopy(doc);
- FMRebuildDoc(&doc,&head,mode);
- } else if (sc.u8[0]==SC_F5) {
- if (doc->cur_entry->type_u8==DOCT_MENU_VAL) {
- tmpde=doc->cur_entry->user_data;
- DocUnlock(doc);
- if (sc&SCF_SHIFT)
- AdamFile(tmpde->full_name);
- else
- PopUpFile(tmpde->full_name);
- DocLock(doc);
- }
- } else {
-fm_regular_key:
- DocUnlock(doc);
- PutKey(ch,sc);
- DocLock(doc);
- }
- }
- break;
- }
- } while (ch!=CH_ESC && ch!=CH_SHIFT_ESC);
- gr.fp_final_scrn_update=fp_old_final_scrn_update;
- Fs->put_doc =old_put_doc;
- Fs->display_doc=old_display_doc;
- SettingsPop;
- DocDel(doc);
- DirTreeDel(head);
- Cd(old_cur_dir);
- Free(old_cur_dir);
- if (mode!=FM_NORMAL && !res)
- res=StrNew("",mem_task);
- MenuPop;
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/ABlkDev/MakeABlkDev.HC.HTML b/public/src/Adam/ABlkDev/MakeABlkDev.HC.HTML deleted file mode 100644 index f47112c..0000000 --- a/public/src/Adam/ABlkDev/MakeABlkDev.HC.HTML +++ /dev/null @@ -1,20 +0,0 @@ - - - - - MakeABlkDev.HC - - - - - Cd(__DIR__);;
-#include "ADskA"
-#include "ADskB"
-#include "DskPrt"
-#include "Mount"
-#include "DskChk"
-#include "FileMgr"
-Cd("..");;
- - - \ No newline at end of file diff --git a/public/src/Adam/ABlkDev/Mount.HC.HTML b/public/src/Adam/ABlkDev/Mount.HC.HTML deleted file mode 100644 index fad3fa3..0000000 --- a/public/src/Adam/ABlkDev/Mount.HC.HTML +++ /dev/null @@ -1,171 +0,0 @@ - - - - - Mount.HC - - - - - #help_index "Install;File/Cmd Line (Typically);Cmd Line (Typically);"
-U8 Mount2(U8 boot_drv_let,CDoc *_doc,Bool _caller_is_prtdsk)
-{//If _doc, called by /Kernel/KCfg.HC else called by Mount().
- I64 cnt,total=0,num_hints,drv_let,type,unit,prt_num;
- U8 blks_buf[STR_LEN],addr_buf[STR_LEN],base0_buf[STR_LEN],base1_buf[STR_LEN],
- *filename=NULL,*filename2=NULL,res=0;
- CATARep *head=NULL,*tmpha;
- Bool whole_drv,make_free;
- CDoc *doc;
- if (boot_drv_let)
- boot_drv_let=Let2Let(boot_drv_let);
- do {
- cnt=0;
- if (!_doc)
- DrvRep;
- "\n****** Mount Drives ******\n"
- "$GREEN$A$FG$-$GREEN$B$FG$ are RAM drives.\n"
- "$GREEN$C$FG$-$GREEN$L$FG$ are ATA hard drives.\n"
- "$GREEN$M$FG$-$GREEN$P$FG$ are ISO file read drives.\n"
- "$GREEN$Q$FG$-$GREEN$S$FG$ are ISO file write drives.\n"
- "$GREEN$T$FG$-$GREEN$Z$FG$ are ATAPI CD/DVD drives.\n"
- "\nDrive Letter ($PURPLE$<ENTER>$FG$ to exit):";
- drv_let=Let2Let(GetChar);
- '\n';
- if (type=Let2BlkDevType(drv_let)) {
- whole_drv=FALSE;
- if (_doc) { //Called by /Kernel/KCfg.HC
- doc=_doc;
- make_free=FALSE;
- } else { //Called by Mount()
- doc=DocNew;
- DocPrint(doc,"CBlkDev *bd;\n");
- make_free=TRUE;
- }
- unit=0;
- prt_num=I64_MIN;
- switch (type) {
- case BDT_RAM:
- "Addr of RAM disk ($PURPLE$<ENTER>$FG$ to MAlloc):";
- GetS(addr_buf,STR_LEN);
- case BDT_ISO_FILE_WRITE:
- "Blks of 512 bytes:";
- GetS(blks_buf,STR_LEN);
- break;
- case BDT_ISO_FILE_READ:
- filename=GetStr("File Name:");
- break;
- case BDT_ATA:
- prt_num=GetI64("Partition Num (Default=All):",prt_num);
- case BDT_ATAPI:
- num_hints=ATARep(,,&head);
- if (type==BDT_ATAPI && boot_drv_let)
- "<ENTER> to use booted CD/DVD\n"; //Only /Kernel/KCfg.HC
- do {
- if (num_hints)
- "Enter dev number or\nport with $PURPLE$0x$FG$ prefix.\n"
- "I/O Port Base0:\n";
- else
- "Include $PURPLE$0x$FG$ prefix.\nI/O Port Base0:\n";
- GetS(base0_buf,STR_LEN);
- } while (!Str2I64(base0_buf) && (type!=BDT_ATAPI || !boot_drv_let));
- if (1<=Str2I64(base0_buf)<=num_hints) {
- tmpha=ATARepFind(head,Str2I64(base0_buf));
- StrPrint(base0_buf,"0x%X",tmpha->base0);
- StrPrint(base1_buf,"0x%X",tmpha->base1);
- unit=tmpha->unit;
- } else if (type!=BDT_ATAPI || *base0_buf) {
- if (type==BDT_ATAPI)
- StrCpy(base1_buf,"0");
- else
- do {
- "I/O Port Base1:\n";
- GetS(base1_buf,STR_LEN);
- } while (!Str2I64(base1_buf));
- do {
- "\t$PURPLE$0$FG$=Master\n\t$PURPLE$1$FG$=Slave\nUnit:";
- unit=GetChar-'0';
- } while (!(0<=unit<=1));
- '\n';
- }
- LinkedLstDel(head);
- break;
- }
- DocPrint(doc,"bd=BlkDevNextFreeSlot(\'%C\',%d);bd->unit=%d;\n",
- drv_let,type,unit);
- switch (type) {
- case BDT_RAM:
- if (!*addr_buf) StrCpy(addr_buf,"0");
- DocPrint(doc,"bd->RAM_dsk=%s;\n",addr_buf);
- case BDT_ISO_FILE_WRITE:
- if (!*blks_buf) StrCpy(blks_buf,"0");
- DocPrint(doc,"bd->max_blk=(%s)-1;\n",blks_buf);
- DocPrint(doc,"bd->drv_offset=19<<2+"
- "(DVD_BLK_SIZE*2+DVD_BOOT_LOADER_SIZE)/BLK_SIZE;\n");
- break;
- case BDT_ISO_FILE_READ:
- filename2=FileNameAbs(filename);
- DocPrint(doc,"bd->file_dsk_name=AStrNew(\"%s\");\n",filename2);
- DocPrint(doc,"bd->drv_offset=19<<2+"
- "(DVD_BLK_SIZE*2+DVD_BOOT_LOADER_SIZE)/BLK_SIZE;\n");
- break;
- case BDT_ATA:
- case BDT_ATAPI:
- if (type==BDT_ATAPI && !*base0_buf) {
- DocPrint(doc,"GetBaseUnit(bd);\n"); //Only /Kernel/KCfg.HC
- if (drv_let==boot_drv_let)
- make_free=TRUE;
- } else
- DocPrint(doc,"bd->base0=%s;bd->base1=%s;\n",base0_buf,base1_buf);
- if (type==BDT_ATA && _caller_is_prtdsk) {
- "\nReformat WHOLE drive!";
- whole_drv=YorN;
- }
- break;
- }
- DocPrint(doc,"BlkDevAdd(bd,%d,%d,%d);\n",prt_num,whole_drv,make_free);
- if (_doc) //Called by /Kernel/KCfg.HC
- cnt++;
- else { //Called by Mount()
- if ((cnt=ExeDoc(doc)) && whole_drv) {
- if (_caller_is_prtdsk) {
- res=drv_let;
- DskPrt(drv_let,1.0); //First mount whole drive.
- } else
- DskPrt(drv_let);
- }
- DocDel(doc);
- }
- }
- total+=cnt;
- } while (cnt && !_caller_is_prtdsk ||
- !total && _doc); //At least 1 if Called by /Kernel/KCfg.HC
- Free(filename);
- Free(filename2);
- return res;
-}
-
-public U8 Mount(Bool caller_is_prtdsk=FALSE)
-{//Mount drives. Called from DskPrt(Mount).
- return Mount2(0,NULL,caller_is_prtdsk);
-}
-
-public U0 Unmount(U8 drv_let=0)
-{//Unmount drive(s).
- BlkDevDel(Let2BlkDev(drv_let));
-}
-
-public U8 MountFile(U8 *filename)
-{//Mount ISO.C file.
- U8 *filename2=ExtDft(filename,"ISO.C"),*filename3=FileNameAbs(filename2);
- CDrv *dv=DrvMakeFreeSlot(DrvNextFreeLet('M')); //First BDT_ISO_FILE_READ
- CBlkDev *bd=BlkDevNextFreeSlot(dv->drv_let,BDT_ISO_FILE_READ);
- bd->drv_offset=19<<2+(DVD_BLK_SIZE*2+DVD_BOOT_LOADER_SIZE)/BLK_SIZE;
- bd->file_dsk_name=AStrNew(filename3);
- BlkDevAdd(bd,,TRUE,TRUE);
- Free(filename3);
- Free(filename2);
- return dv->drv_let;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/ADbg.HC.HTML b/public/src/Adam/ADbg.HC.HTML deleted file mode 100644 index 1053118..0000000 --- a/public/src/Adam/ADbg.HC.HTML +++ /dev/null @@ -1,282 +0,0 @@ - - - - - ADbg.HC - - - - - #help_index "Debugging/Dump"
-Bool ClassRep2(CDoc *doc,U8 *_d,U8 *class_name=lastclass,
- I64 depth,I64 max_depth,Bool dynamic,I64 types=HTT_CLASS,I64 offset=0)
-{//See /Demo/LastClass.HC.
- I64 i,j,stars,*ptr;
- CMemberLst *ml;
- CDocEntry *doc_e;
- Bool unlock;
- CHashClass *tmpc,*tmpc2;
- if (depth>=max_depth) return TRUE;
- if (!(tmpc=HashFind(class_name,Fs->hash_table,types))) {
- DocPrint(doc,"Class Not Found.\n");
- return FALSE;
- }
- if (!ChkPtr(_d) || !ChkPtr(_d(U8 *)+tmpc->size)) {
- DocPrint(doc,"Bad Ptr:%016X\n",_d);
- return FALSE;
- }
- if (tmpc->base_class && !ClassRep2(doc,_d,tmpc->base_class->str,
- depth,max_depth,dynamic,types,offset))
- return FALSE;
- unlock=DocLock(doc);
- DocPrint(doc,"Class:\"%s\"\n",class_name);
- ml=tmpc->member_lst_and_root;
- while (ml) {
- tmpc2=ml->member_class;
- ptr=_d(U8 *)+ml->offset;
- DocPrint(doc,"%08X ",ptr(U8 *)+offset);
- stars=tmpc2->ptr_stars_cnt;
- tmpc2=OptClassFwd(tmpc2);
- tmpc2-=tmpc2->ptr_stars_cnt;
- if (tmpc2->type & HTT_INTERNAL_TYPE) {
- DocPrint(doc,"$GREEN$%-20ts:$FG$",ml->str);
- if (stars==1 && (tmpc2->raw_type==RT_I8 || tmpc2->raw_type==RT_U8)) {
- ptr=*ptr;
- if (ChkPtr(ptr)) {
- if (dynamic) {
- doc_e=DocPrint(doc,"$DA-TRM-P+RD,LEN=64,A=\"%%40ts\"$\n");
- doc_e->data=ptr;
- DocDataFmt(doc,doc_e);
- } else
- DocPrint(doc,"%40ts\n",ptr);
- }
- } else if (!stars) {
- j=MinI64(ml->dim.total_cnt,32);
- if (tmpc2->raw_type==RT_I8 || tmpc2->raw_type==RT_U8) {
- if (j==1) {
- if (dynamic) {
- doc_e=DocPrint(doc,"$DA-TRM+RD+UD,RT=U8,A=\"%%c\"$\n");
- doc_e->data=ptr;
- } else
- DocPrint(doc,"%c\n",*ptr(U8 *));
- } else {
- if (dynamic) {
- doc_e=DocPrint(doc,"$DA-TRM-P+RD,LEN=64,A=\"%%40ts\"$\n");
- doc_e->data=ptr;
- DocDataFmt(doc,doc_e);
- } else
- DocPrint(doc,"%40ts\n",ptr);
- }
- }
- for (i=0;i<j;i++) {
- switch (tmpc2->raw_type) {
- case RT_I0:
- case RT_U0:
- break;
- case RT_I8:
- if (dynamic) {
- doc_e=DocPrint(doc,"$DA-TRM+RD+UD,RT=I8,A=\"%%02X\"$ ");
- doc_e->data=ptr(I8 *)++;
- } else
- DocPrint(doc,"%02X ",*ptr(I8 *)++);
- break;
- case RT_U8:
- if (dynamic) {
- doc_e=DocPrint(doc,"$DA-TRM+RD+UD,RT=U8,A=\"%%02X\"$ ");
- doc_e->data=ptr(U8 *)++;
- } else
- DocPrint(doc,"%02X ",*ptr(U8 *)++);
- break;
- case RT_I16:
- if (dynamic) {
- doc_e=DocPrint(doc,"$DA-TRM+RD+UD,RT=I16,A=\"%%04X\"$ ");
- doc_e->data=ptr(I16 *)++;
- } else
- DocPrint(doc,"%04X ",*ptr(I16 *)++);
- break;
- case RT_U16:
- if (dynamic) {
- doc_e=DocPrint(doc,"$DA-TRM+RD+UD,RT=U16,A=\"%%04X\"$ ");
- doc_e->data=ptr(U16 *)++;
- } else
- DocPrint(doc,"%04X ",*ptr(U16 *)++);
- break;
- case RT_I32:
- if (dynamic) {
- doc_e=DocPrint(doc,"$DA-TRM+RD+UD,RT=I32,A=\"%%08X\"$ ");
- doc_e->data=ptr(I32 *)++;
- } else
- DocPrint(doc,"%08X ",*ptr(I32 *)++);
- break;
- case RT_U32:
- if (dynamic) {
- doc_e=DocPrint(doc,"$DA-TRM+RD+UD,RT=U32,A=\"%%08X\"$ ");
- doc_e->data=ptr(U32 *)++;
- } else
- DocPrint(doc,"%08X ",*ptr(U32 *)++);
- break;
- case RT_U64:
- if (dynamic) {
- doc_e=DocPrint(doc,"$DA-TRM+RD+UD,RT=U64,A=\"%%08X\"$ ");
- doc_e->data=ptr(U64 *)++;
- } else
- DocPrint(doc,"%08X ",*ptr(U64 *)++);
- break;
- case RT_F64:
- if (dynamic) {
- doc_e=DocPrint(doc,"$DA-TRM+RD+UD,RT=F64,A=\"%%16g\"$ ");
- doc_e->data=ptr(F64 *)++;
- } else
- DocPrint(doc,"%16g ",*ptr(I64 *)++);
- break;
- default:
- if (dynamic) {
- doc_e=DocPrint(doc,"$DA-TRM+RD+UD,A=\"%%016X\"$ ");
- doc_e->data=ptr(I64 *)++;
- } else
- DocPrint(doc,"%016X ",*ptr(I64 *)++);
- }
- if (dynamic)
- DocDataFmt(doc,doc_e);
- }
- if (j<ml->dim.total_cnt)
- DocPrint(doc,"...");
- } else
- DocPrint(doc,"%016X",*ptr);
- DocPrint(doc,"\n");
- } else {
- if (depth<2) {
- if (stars==1 && !ChkPtr(*ptr))
- DocPrint(doc,"%-20ts:%016X\n",ml->str,*ptr);
- else {
- DocPrint(doc,"$TR,\"%s\"$\n",ml->str);
- DocPrint(doc,"$
$");
- if (!stars)
- ClassRep2(doc,ptr,tmpc2->str,depth+1,max_depth,dynamic);
- else if (stars==1)
- ClassRep2(doc,*ptr,tmpc2->str,depth+1,max_depth,dynamic);
- DocPrint(doc,"$
$");
- }
- } else
- DocPrint(doc,"%-20ts\n",ml->str);
- }
- ml=ml->next;
- }
- if (unlock)
- DocUnlock(doc);
- return TRUE;
-}
-
-public U0 ClassRep(U8 *_d,U8 *class_name=lastclass,
- I64 max_depth=2,Bool fun=FALSE,I64 offset=0)
-{//Displays members of a record by using the compiler's info.
- CDoc *doc;
- if (IsRaw)
- doc=DocNew;
- else {
- DocMax;
- doc=DocPut;
- }
- if (fun)
- ClassRep2(doc,_d,class_name,0,max_depth,FALSE,HTT_FUN,offset);
- else
- ClassRep2(doc,_d,class_name,0,max_depth,FALSE,HTT_CLASS,offset);
- DocPrint(doc,"\n");
- DocRecalc(doc);
- if (IsRaw) {
- DocDump(doc,100000);
- DocDel(doc);
- }
-}
-
-public U0 ClassRepD(U8 *_d,U8 *class_name=lastclass,
- I64 max_depth=2,Bool fun=FALSE,I64 offset=0)
-{//Dynamic ClassRep. Uses hex_ed widgit for live changes.
- CDoc *doc;
- if (IsRaw)
- doc=DocNew;
- else {
- DocMax;
- doc=DocPut;
- }
- if (fun)
- ClassRep2(doc,_d,class_name,0,max_depth,TRUE,HTT_FUN,offset);
- else
- ClassRep2(doc,_d,class_name,0,max_depth,TRUE,HTT_CLASS,offset);
- DocPrint(doc,"\n");
- DocRecalc(doc);
- if (IsRaw) {
- DocDump(doc,100000);
- DocDel(doc);
- }
-}
-
-U0 UpdateRegVarImg(CHashFun *tmpf,U8 *_b,CTask *task)
-{
- CMemberLst *ml;
- CHashClass *tmpc;
- ml=tmpf->member_lst_and_root;
- while (ml) {
- if (ml->reg!=REG_NONE) {
- tmpc=OptClassFwd(ml->member_class);
- MemCpy(_b+ml->offset,TaskRegAddr(task,ml->reg),tmpc->size);
- }
- ml=ml->next;
- }
-}
-
-public U0 FunRep(U8 *st,U8 *rbp=NULL,I64 max_depth=2,CTask *task=NULL)
-{//Shows names and vals of a fun's local vars using compiler's info.
- I64 size;
- U8 *img;
- CHashFun *tmpf=HashFind(st,Fs->hash_table,HTT_FUN);
- CMemberLst *tmpm;
- if (tmpf) {
- if (rbp) {
- if (task) {
-//tmpf->size is negative.It's the bottom
- //of the fun local var space relative to RBP .
- size=tmpf->arg_cnt*8-tmpf->size+16;
-
- img=MAlloc(size);
- MemCpy(img,rbp+tmpf->size,size);
- UpdateRegVarImg(tmpf,img-tmpf->size,task);
- ClassRep(img-tmpf->size,st,max_depth,TRUE,rbp-img+tmpf->size);
- Free(img);
- } else
- ClassRep(rbp,st,max_depth,TRUE);
- } else {
- tmpm=tmpf->member_lst_and_root;
- while (tmpm) {
- if (0<=tmpm->reg<REG_REGS_NUM)
- "%08Z %s\n",tmpm->reg,"ST_U64_REGS",tmpm->str;
- else
- "%08tX %s\n",tmpm->offset,tmpm->str;
- tmpm=tmpm->next;
- }
- "%08tX Stk Size\n",tmpf->size;
- }
- }
-}
-
-#help_index "Debugging/Unassemble"
-public U0 Uf(U8 *st)
-{//Unassembles a named fun
- I64 i;
- CHashSrcSym *tmpf;
- CDbgInfo *dbg_info;
- if (tmpf=HashFind(st,Fs->hash_table,HTT_FUN|HTT_EXPORT_SYS_SYM)) {
- if (tmpf->type&HTT_FUN)
- FunRep(st);
- if (dbg_info=tmpf->dbg_info) {
- i=dbg_info->body[dbg_info->max_line+1-dbg_info->min_line]
- -dbg_info->body[0];
- Un(dbg_info->body[0],i);
- "Code Size:%04X\n",i;
- } else
- U(HashVal(tmpf));
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/ADefine.HC.HTML b/public/src/Adam/ADefine.HC.HTML deleted file mode 100644 index 12b5817..0000000 --- a/public/src/Adam/ADefine.HC.HTML +++ /dev/null @@ -1,50 +0,0 @@ - - - - - ADefine.HC - - - - - #help_index "Define;Char/Define"
-
-U0 LoadDocDefines()
-{
- CBinFile *bfh=mem_boot_base-sizeof(CBinFile);
-
- DefinePrint("DD_OS_NAME_VERSION","TempleOS V%0.2f",sys_os_version);
- DefinePrint("DD_TEMPLEOS_AGE","%0.1f",
- (Now-Str2Date("8/1/2003"))/ToF64(1<<32)/CDATE_YEAR_DAYS);
-
- DefinePrint("DD_KERNEL","%08X",bfh);
- bfh(I64)+=bfh->file_size-1;
- DefinePrint("DD_KERNEL_END","%08X",bfh);
-
- //DD_BOOT_HIGH_LOC_DVD
-
-$TR,"LineRep"$
-
DefinePrint("DD_TEMPLEOS_LOC","80,849");
-

- DefinePrint("DD_MP_VECT","%08X",MP_VECT_ADDR);
- DefinePrint("DD_MP_VECT_END","%08X",
- MP_VECT_ADDR+COREAP_16BIT_INIT_END-COREAP_16BIT_INIT-1);
-
- DefinePrint("DD_SYS_FIXED_AREA_BASE","%08X",SYS_FIXED_AREA);
- DefinePrint("DD_SYS_FIXED_AREA_END","%08X",
- SYS_FIXED_AREA+sizeof(CSysFixedArea)-1);
- DefinePrint("DD_MEM_HEAP_BASE","%08X",mem_heap_base);
- DefinePrint("DD_MEM_HEAP_LIMIT","%08X",mem_heap_limit);
- DefinePrint("DD_MEM_MIN_MEG","%dMeg",MEM_MIN_MEG);
- DefinePrint("DD_UNCACHED_ALIAS","%010X",dev.uncached_alias);
- DefinePrint("DD_PHYSICAL_SPACE_END","%010X",
- mem_physical_space-1);
- DefinePrint("DD_MAPPED_SPACE_END","%010X",
- mem_mapped_space-1);
- DefinePrint("DD_JIFFY_HZ","%dHz",JIFFY_FREQ);
-}
-
-LoadDocDefines;
- - - \ No newline at end of file diff --git a/public/src/Adam/AExts.HC.HTML b/public/src/Adam/AExts.HC.HTML deleted file mode 100644 index c418eba..0000000 --- a/public/src/Adam/AExts.HC.HTML +++ /dev/null @@ -1,107 +0,0 @@ - - - - - AExts.HC - - - - - extern U0 ACDDef(I64 n,CTask *parent=NULL);
-extern U0 ACDDefsPut(CDoc *doc=NULL,U8 *st,I64 num=-1);
-extern U0 ACDFillin(I64 n);
-extern U0 ACFillIn(I64 n);
-extern U0 ACMan(I64 n,CTask *parent_task=NULL);
-extern I64 AdamFile(U8 *filename,Bool warn_ext=TRUE);
-extern Bool AutoComplete(Bool val=OFF);
-extern U0 ClipDel();
-extern CCtrl *CtrlFindUnique(CTask *haystack_task,I64 needle_type);
-extern Bool CtrlInside(CCtrl *c,I64 x,I64 y);
-extern U8 *DC2Sprite(CDC *tmpb);
-extern U0 DocBinDel(CDoc *doc,CDocBin *b);
-extern U0 DocBinsValidate(CDoc *doc);
-extern U0 DocBottom(CDoc *doc=NULL);
-extern U0 DocCenter(CDoc *doc=NULL,I64 recalc_flags=RECALCt_NORMAL);
-extern U0 DocClear(CDoc *doc=NULL,Bool clear_holds=FALSE);
-extern Bool DocCursor(Bool show=OFF,CDoc *doc=NULL);
-extern U0 DocD(U8 *buf,I64 cnt=0x80);
-extern U0 DocDataFmt(CDoc *doc,CDocEntry *doc_e,I64 d=DOCM_CANCEL);
-extern U0 DocDel(CDoc *doc);
-extern CDoc *DocDisplay(CTask *task=NULL);
-extern U0 DocDump(CDoc *doc,I64 uS_delay=0);
-extern CDocEntry *DocEntryCopy(CDoc *doc,CDocEntry *doc_e);
-extern U0 DocEntryDel(CDoc *doc,CDocEntry *doc_e);
-extern Bool DocForm(U8 *_d,U8 *class_name=lastclass,
- I64 dof_flags=0,U8 *header=NULL,U8 *footer=NULL);
-extern U0 DocHelpIdx(CDoc *doc,U8 *idx);
-extern Bool DocHighlightCursor(Bool show=OFF,CDoc *doc=NULL);
-extern U0 DocInsDoc(CDoc *doc=NULL,CDoc *doc2);
-extern U0 DocInsEntry(CDoc *doc,CDocEntry *doc_e);
-extern Bool DocLock(CDoc *doc);
-extern I64 DocMax(I64 i=I64_MAX);
-extern CDoc *DocNew(U8 *filename=NULL,CTask *task=NULL);
-extern CDocEntry *DocPrint(CDoc *doc=NULL,U8 *fmt,...);
-extern CDoc *DocPut(CTask *task=NULL);
-extern CDoc *DocRead(U8 *name=NULL,I64 flags=0);
-extern Bool DocRecalc(CDoc *doc,I64 recalc_flags=RECALCt_NORMAL);
-extern U0 DocRst(CDoc *doc,Bool is_old);
-extern CDocEntry *DocSprite(CDoc *doc=NULL,U8 *elems,U8 *fmt=NULL);
-extern U0 DocTop(CDoc *doc=NULL);
-extern Bool DocUnlock(CDoc *doc);
-extern U0 DocUpdateTaskDocs(CTask *task);
-extern U0 DrawCtrls(CTask *task);
-extern Bool Ed(U8 *link_st,I64 edf_dof_flags=0);
-extern U0 EdCodeTools(CDoc *doc);
-extern U8 *EdSprite(I64 bin_num);
-extern I64 ExeDoc(CDoc *doc,I64 ccf_flags=0);
-extern I64 FindWiz();
-extern I64 GetI64(U8 *msg=NULL,I64 dft=0,I64 lo=I64_MIN,I64 hi=I64_MAX);
-extern Bool GrPlot0(CDC *dc,I64 x,I64 y);
-extern CMenuEntry *MenuEntryFind(CMenu *haystack_menu,U8 *needle_full_name);
-extern CMenu *MenuFilePush(U8 *filename);
-extern U0 MenuPop();
-extern CMenu *MenuPush(U8 *st);
-extern U8 Mount(Bool caller_is_prtdsk=FALSE);
-extern CTask *Noise(I64 mS,F64 min_ona,F64 max_ona);
-extern Bool Plain(U8 *filename,I64 edf_dof_flags=0);
-extern Bool PopUpCancelOk(U8 *header=NULL,U8 *footer=NULL);
-extern I64 PopUpColor(U8 *header=NULL,
- Bool allow_transparent=TRUE,Bool allow_dft=TRUE);
-extern I64 PopUpColorDither(U8 *header=NULL);
-extern I64 PopUpColorLighting(U8 *header=NULL);
-extern I64 PopUpFile(U8 *filename,
- Bool warn_ext=TRUE,CTask *parent=NULL,CTask **_pu_task=NULL);
-extern Bool PopUpForm(U8 *_d,U8 *class_name=lastclass,
- I64 dof_flags=DOF_SIZE_MIN,U8 *header=NULL,U8 *footer=NULL);
-extern I64 PopUpGetI64(U8 *msg,I64 dft,I64 lo=I64_MIN,I64 hi=I64_MAX);
-extern U8 *PopUpGetStr(U8 *header=NULL);
-extern I64 PopUpMenu(CDoc *doc,I64 dof_flags=0);
-extern Bool PopUpNoYes(U8 *header=NULL,U8 *footer=NULL);
-extern Bool PopUpOk(U8 *header=NULL,U8 *footer=NULL);
-extern I64 PopUpRangeI64(
- I64 lo,I64 hi,I64 step=1,U8 *header=NULL,U8 *footer=NULL);
-extern Bool PopUpTransform(I64 *r);
-extern I64 RedSeaISO(U8 *_iso_filename=NULL,U8 *_src_dir,
- U8 *_stage2_filename=NULL);
-extern U0 Refresh(I64 cnt=1,Bool force=FALSE);
-extern U0 RegOneTimePopUp(I64 flag_num,U8 *msg);
-extern Bool RegWrite(U8 *path,U8 *fmt,...);
-extern U0 SettingsPop(CTask *task=NULL,I64 flags=0);
-extern CTaskSettings *SettingsPush(CTask *task=NULL,I64 flags=0);
-extern U0 TemplateCtrlSlider(CDoc *doc);
-extern Bool View();
-extern U0 ViewAnglesDel(CTask *task=NULL);
-extern CCtrl *ViewAnglesNew(CTask *task=NULL);
-extern Bool WinBorder(Bool val=OFF,CTask *task=NULL);
-extern CDoc *WinCursorPosSet(CTask *task,I64 msx,I64 msy,Bool set_cursor=TRUE);
-extern Bool WinHorz(I64 left,I64 right,CTask *task=NULL);
-extern U0 WinMax(CTask *task=NULL);
-extern U0 WinScrollNull(CTask *task,CD3I64 *s);
-extern U0 WinScrollRestore(CTask *task,CD3I64 *s);
-extern U0 WinScrollsInit(CTask *task);
-extern I64 WinToTop(CTask *task=NULL,Bool update_z_buf=TRUE);
-extern Bool WinVert(I64 top,I64 bottom,CTask *task=NULL);
-extern CWinMgrGlbls winmgr;
- - - \ No newline at end of file diff --git a/public/src/Adam/AHash.HC.HTML b/public/src/Adam/AHash.HC.HTML deleted file mode 100644 index 83a49e2..0000000 --- a/public/src/Adam/AHash.HC.HTML +++ /dev/null @@ -1,443 +0,0 @@ - - - - - AHash.HC - - - - - #help_index "Info;Hash/System;Cmd Line (Typically)"
-class CWho
-{
- CHashGeneric *h;
- U8 *idx;
-};
-
-I64 HashEntriesCompare(CWho *h1,CWho *h2)
-{
- I64 i1,i2;
- if (i1=StrCmp(h1->h->str,h2->h->str))
- return i1;
- i1=HashTypeNum(h1->h);
- i2=HashTypeNum(h2->h);
- return i1-i2;
-}
-
-I64 HashEntriesCompare2(CWho *h1,CWho *h2)
-{
- CHashFun *tmpf1=h1->h,*tmpf2=h2->h;
- I64 i1=HashVal(tmpf1),i2=HashVal(tmpf2);
- if (i1==i2) {
- i1=HashTypeNum(tmpf1);
- i2=HashTypeNum(tmpf2);
- if (i1==i2)
- return StrCmp(tmpf1->str,tmpf2->str);
- }
- return i1-i2;
-}
-
-I64 HelpIndexCnt(U8 *ptr,U8 *idx)
-{
- I64 cnt=0,ch,idx_len=StrLen(idx);
- while (*ptr) {
- if (!StrNCmp(ptr,idx,idx_len))
- cnt++;
- while (ch=*ptr++)
- if (ch==';')
- break;
- if (!ch)
- ptr--;
- }
- return cnt;
-}
-
-U8 *HelpIndexStr(U8 **_ptr,U8 *idx)
-{
- U8 *ptr=*_ptr,*ptr2,*res;
- I64 ch,idx_len=StrLen(idx);
- while (*ptr) {
- ptr2=ptr;
- while (ch=*ptr++)
- if (ch==';')
- break;
- if (!ch)
- ptr--;
- *_ptr=ptr;
- if (!StrNCmp(ptr2,idx,idx_len)) {
- if (ch==';')
- ptr--;
- *ptr=0;
- res=StrNew(ptr2);
- *ptr=ch;
- return res;
- }
- }
- return NULL;
-}
-
-U8 *HelpComment(CTask *task,CHash *tmph,U8 *_src_link)
-{
- CDoc *doc;
- CDocEntry *doc_e;
- U8 *res=NULL,*ptr,*ptr2,*src_link=StrNew(_src_link);
-
- if (*src_link=='F' && src_link[2]==':')
- *src_link='P';
- XTalkWait(task,"Ed(0x%X,DOF_DONT_WINMGR_SYNC|DOF_DONT_SHOW);\n",src_link);
- Free(src_link);
-
- doc=DocPut(task);
- doc_e=doc->cur_entry;
- if (tmph->type&HTT_FUN) {
- if (Bt(&tmph(CHashFun *)->flags,Ff__EXTERN) ||
- Bt(&tmph(CHashFun *)->flags,Ff_INTERNAL))
- while (doc_e!=doc &&
- (!(doc_e->de_flags&DOCEF_TAG)||!StrOcc(doc_e->tag,';')))
- doc_e=doc_e->next;
- else
- while (doc_e!=doc &&
- (!(doc_e->de_flags&DOCEF_TAG)||!StrOcc(doc_e->tag,'{')))
- doc_e=doc_e->next;
- }
- if (doc_e!=doc) {
- if (doc_e->de_flags&DOCEF_TAG) {
- ptr=doc_e->tag;
- if (ptr2=StrMatch("//",ptr))
- ptr=ptr2+2;
- else if (ptr2=StrMatch("/*",ptr))
- ptr=ptr2+2;
- else if (!StrNCmp(ptr,"public",6))
- ptr+=6;
- while (*ptr==CH_SPACE)
- ptr++;
- res=StrNew(ptr);
- doc_e=doc_e->next;
- }
- while (doc_e!=doc && doc_e->type_u8!=DOCT_NEW_LINE) {
- if (doc_e->type_u8==DOCT_TAB) {
- ptr=MStrPrint("%s",res);
- Free(res);
- res=ptr;
- } else if (doc_e->de_flags&DOCEF_TAG) {
- ptr=MStrPrint("%s%s",res,doc_e->tag);
- Free(res);
- res=ptr;
- }
- doc_e=doc_e->next;
- }
- }
- XTalkWait(task,"%c",CH_SHIFT_ESC);
- if (res) {
- ptr=MStrUtil(res,SUF_REM_TRAILING|SUF_REM_LEADING|SUF_SINGLE_SPACE);
- Free(res);
- res=ptr;
- }
- return res;
-}
-
-I64 HashEntriesCompare3(CWho *h1,CWho *h2)
-{
- I64 i,i1=0,i2=0;
- i=StrCmp(h1->idx,h2->idx);
- if (i)
- return i;
- else {
- if (h1->h->type&HTT_HELP_FILE)
- i1=1;
- if (h2->h->type&HTT_HELP_FILE)
- i2=1;
- i=i2-i1;
- if (i)
- return i;
- else
- return StrCmp(h1->h->str,h2->h->str);
- }
-}
-
-public U0 Who(U8 *fu_flags=NULL,CHashTable *h=NULL,
-U8 *idx=NULL,CDoc *doc=NULL)
-{//Dump hash symbol table.
-// "+p" for only public symbols
- // "+m" to order by number (normally alphabetical)
- // "-r" just local hash table
- CHashTable *table;
- CHashSrcSym *tmph;
- CHashGeneric *ptr;
- CWho *lst;
- I64 cnt,i,j,k,f=0;
- U8 buf[512],*last_idx=StrNew(""),*cur_idx,*comment;
- Bool recurse,publics,map;
- CTask *task;
-
- ScanFlags(&f,Define("ST_FILE_UTIL_FLAGS"),"+r");
- ScanFlags(&f,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
- if (f&~(FUF_RECURSE|FUF_PUBLIC|FUF_MAP))
- throw('FUF');
- recurse=Bt(&f,FUf_RECURSE);
- publics=Bt(&f,FUf_PUBLIC);
- map =Bt(&f,FUf_MAP);
-
- if (!h) h=Fs->hash_table;
-
- if (idx) {
- task=User;
- TaskWait(task);
- LBtr(&task->display_flags,DISPLAYf_SHOW);
- } else
- task=NULL;
-
- cnt=0;
- table=h;
- while (table) {
- for (i=0;i<=table->mask;i++) {
- tmph=table->body[i];
- while (tmph) {
- if (!(tmph->type & (HTF_IMPORT | HTF_PRIVATE)) &&
- (tmph->type & HTF_PUBLIC || !publics)) {
- if (!idx)
- cnt++;
- else if (tmph->type&HTG_SRC_SYM && (cur_idx=tmph->idx))
- cnt+=HelpIndexCnt(cur_idx,idx);
- }
- tmph=tmph->next;
- }
- }
- if (recurse)
- table=table->next;
- else
- break;
- }
- if (!cnt) goto wh_done;
-
- lst=CAlloc(cnt*sizeof(CWho));
- j=0;
- table=h;
- while (table) {
- for (i=0;i<=table->mask;i++) {
- tmph=table->body[i];
- while (tmph) {
- if (!(tmph->type & (HTF_IMPORT | HTF_PRIVATE)) &&
- (tmph->type & HTF_PUBLIC || !publics))
- if (!idx)
- lst[j++].h=tmph;
- else if (tmph->type&HTG_SRC_SYM && (cur_idx=tmph->idx) &&
- (k=HelpIndexCnt(cur_idx,idx)))
- while (k--) {
- lst[j].idx=HelpIndexStr(&cur_idx,idx);
- lst[j++].h=tmph;
- }
- tmph=tmph->next;
- }
- }
- if (recurse)
- table=table->next;
- else
- break;
- }
-
- if (map)
- QSort(lst,cnt,sizeof(CWho),&HashEntriesCompare2);
- else if (idx)
- QSort(lst,cnt,sizeof(CWho),&HashEntriesCompare3);
- else
- QSort(lst,cnt,sizeof(CWho),&HashEntriesCompare);
-
- if (idx) {
- progress1_max=cnt;
- progress1=0;
- }
- for (i=0;i<cnt;i++) {
- comment=NULL;
- ptr=lst[i].h;
- if (idx)
- if (cur_idx=lst[i].idx) {
- if (StrCmp(cur_idx,last_idx)) {
- Free(last_idx);
- last_idx=StrNew(cur_idx);
- if (i)
- DocPrint(doc,"\n\n");
- DocPrint(doc,"$WW,0$$PURPLE$$TX+CX,\"%$Q\"$$FG$\n",cur_idx);
- }
- }
-
- if (idx && ptr->type & HTT_HELP_FILE) {
- DocPrint(doc,"$WW,1$");
- DocType(doc,ptr->str);
- DocPrint(doc,"$WW,0$");
- } else {
- if (ptr->type&HTG_SRC_SYM && ptr(CHashSrcSym *)->src_link) {
- DocPrint(doc,"$LK,\"%-20s\",A=\"%s\"$",
- ptr->str,ptr(CHashSrcSym *)->src_link);
- if (idx)
- comment=HelpComment(task,ptr,ptr(CHashSrcSym *)->src_link);
- } else
- DocPrint(doc,"%-20s",ptr->str);
-
- if (!idx) {
- if (ptr->type & HTT_DEFINE_STR) {
- j=ptr(CHashDefineStr *)->cnt;
- if (j==-1)
- StrPrint(buf,"%-10t$Q",ptr(CHashDefineStr *)->data);
- else
- StrPrint(buf,"%-10t$Q %02X",ptr(CHashDefineStr *)->data,j);
- } else if (ptr->type & HTT_GLBL_VAR)
- StrPrint(buf,"%010X",ptr(CHashGlblVar *)->data_addr);
- else
- StrPrint(buf,"%010X",HashVal(ptr));
- j=HashEntrySize(ptr);
- if (j==-1)
- CatPrint(buf," %04X  ",ptr->use_cnt);
- else
- CatPrint(buf," %04X %010X ",ptr->use_cnt,j);
- } else
- *buf=0;
-
- k=ptr->type;
- if (publics)
- k&=~HTF_PUBLIC;
- if (!(k&HTG_TYPE_MASK))
- CatPrint(buf,"NULL ");
- while (k) {
- j=Bsf(k);
- if (j<0)
- break;
- Btr(&k,j);
- CatPrint(buf,"%Z ",j,"ST_HTT_TYPES");
- }
- DocPrint(doc,"%s",buf);
- if (comment) {
- DocPrint(doc,"$GREEN$%s$FG$",comment);
- Free(comment);
- }
- DocPrint(doc,"\n");
- }
- Free(lst[i].idx);
- if (idx)
- progress1++;
- }
- Free(lst);
- if (idx)
- progress1=progress1_max=0;
-
-wh_done:
- if (doc) {
- if (doc->head.next==doc)
- DocPrint(doc,"No Match");
- else
- DocRecalc(doc);
- }
- Free(last_idx);
- Kill(task);
-}
-
-#help_index "Info;Hash;Cmd Line (Typically)"
-
-#define HDR_NUM 16
-public I64 HashDepthRep(CHashTable *table=NULL)
-{//Hash table linked-list chain depth report.
-//Histogram of collision count.
- I64 i,j,longest=0,cnt=0,a[HDR_NUM];
- CHash *tmph;
- if (!table) table=Fs->hash_table;
- MemSet(a,0,sizeof(a));
- for (i=0;i<=table->mask;i++) {
- tmph=table->body[i];
- if (tmph) {
- j=LinkedLstCnt(tmph);
- if (j<HDR_NUM)
- a[j]++;
- cnt+=j;
- if (j>longest)
- longest=j;
- }
- }
- "Histogram\n";
- for (i=0;i<HDR_NUM;i++)
- if (a[i])
- "%02d:%d\n",i,a[i];
- "Size:%dCount:%dLongest:%d\n",
- table->mask+1,cnt,longest;
- return longest;
-}
-
-#help_index "Help System"
-#help_file "::/Doc/HelpSystem"
-
-public U0 DocHelpIdx(CDoc *doc,U8 *idx)
-{//Put to doc report for given help idx.
- Who("+p",,idx,doc);
-}
-
-public U0 PopUpHelpIndex(U8 *idx,CTask *parent=NULL)
-{//PopUp win report for given help idx.
- U8 *buf;
- buf=MStrPrint("DocHelpIdx(DocPut,\"%s\");View;",idx);
- PopUp(buf,parent);
- Free(buf);
-}
-
-#help_index "Hash/System"
-public U0 MapFileLoad(U8 *filename)
-{//Load map file so we have src line info.
- U8 *st,*ptr,*name=ExtDft(filename,"MAP.Z"),
- *absname=FileNameAbs(name);
- CDoc *doc=DocRead(name);
- CDocEntry *doc_e;
- CHashSrcSym *tmph;
- I64 i,j,base=0;
- CDbgInfo *dbg_info;
-
- FileExtRem(absname);
- if (absname[1]==':' && StrLen(absname)>2 &&
- (tmph=HashSingleTableFind(absname+2,Fs->hash_table,HTT_MODULE)))
- base=tmph(CHashGeneric *)->user_data0+sizeof(CBinFile);
-
- if (!doc) return;
- doc_e=doc->head.next;
- while (doc_e!=doc) {
- if (doc_e->type_u8==DOCT_LINK) {
- if (*doc_e->tag)
- st=MStrUtil(doc_e->tag,SUF_REM_TRAILING);
- else
- st=MStrUtil(doc_e->aux_str,SUF_REM_TRAILING);
- if (tmph=HashSingleTableFind(st,Fs->hash_table,HTG_SRC_SYM)) {
- if (*doc_e->tag) {
- Free(tmph->src_link);
- tmph->src_link=doc_e->aux_str;
- ptr=tmph->src_link;
- if (ptr[0] && ptr[1] && ptr[2]==':') {
- if (ptr[3]==':')
- ptr[3]=blkdev.boot_drv_let;
- else if (ptr[3]=='~')
- ptr[3]=*blkdev.home_dir;
- }
- doc_e->aux_str=NULL;
- }
- if (tmph->type&(HTT_FUN|HTT_EXPORT_SYS_SYM) &&
- !(dbg_info=tmph->dbg_info) && doc_e->bin_data &&
- (dbg_info=doc_e->bin_data->data)) {
- if (doc_e->bin_data->size>MSize(dbg_info))
- "Corrupt Map Entry\n";
- else {
- doc_e->bin_data->data=NULL;
- tmph->dbg_info=dbg_info;
- for (i=dbg_info->min_line;i<=dbg_info->max_line+1;i++) {
- j=i-dbg_info->min_line;
- if (dbg_info->body[j])
- dbg_info->body[j]=dbg_info->body[j]+base;
- }
- }
- }
- }
- Free(st);
- }
- doc_e=doc_e->next;
- }
- DocDel(doc);
- Free(name);
- Free(absname);
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/AMath.HC.HTML b/public/src/Adam/AMath.HC.HTML deleted file mode 100644 index 703c9df..0000000 --- a/public/src/Adam/AMath.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - AMath.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Adam/AMathODE.HC.HTML b/public/src/Adam/AMathODE.HC.HTML deleted file mode 100644 index 75b5f4c..0000000 --- a/public/src/Adam/AMathODE.HC.HTML +++ /dev/null @@ -1,700 +0,0 @@ - - - - - AMathODE.HC - - - - - #help_index "Math/ODE"
-#help_file "::/Doc/ODE"
-
-//See /Doc/Credits.DD.
-
-F64 LowPass1(F64 a,F64 y0,F64 y,F64 dt=1.0)
-{//First order low pass filter
- dt=Exp(-a*dt);
- return y0*dt+y*(1.0-dt);
-}
-
-U0 ODERstPtrs(CMathODE *ode)
-{
- I64 s=ode->n_internal*sizeof(F64);
- F64 *ptr=ode->array_base;
- ode->state_internal=ptr; ptr(I64)+=s;
- ode->state_scale=ptr; ptr(I64)+=s;
- ode->DstateDt=ptr; ptr(I64)+=s;
- ode->initial_state=ptr; ptr(I64)+=s;
- ode->tmp0=ptr; ptr(I64)+=s;
- ode->tmp1=ptr; ptr(I64)+=s;
- ode->tmp2=ptr; ptr(I64)+=s;
- ode->tmp3=ptr; ptr(I64)+=s;
- ode->tmp4=ptr; ptr(I64)+=s;
- ode->tmp5=ptr; ptr(I64)+=s;
- ode->tmp6=ptr; ptr(I64)+=s;
- ode->tmp7=ptr;
-}
-
-public CMathODE *ODENew(I64 n,F64 max_tolerance=1e-6,I64 flags=0)
-{//Make differential equation ctrl struct. See flags.
- //The tolerance is not precise.
- //You can min_tolerance and it will
- //dynamically adjust tolerance to utilize
- //the CPU.
- I64 s=n*sizeof(F64);
- CMathODE *ode=CAlloc(sizeof(CMathODE));
- ode->t_scale=1.0;
- ode->flags=flags;
- ode->n_internal=ode->n=n;
- ode->h=1e-6;
- ode->h_min=1e-64;
- ode->h_max=1e32;
- ode->max_tolerance=ode->min_tolerance=ode->tolerance_internal=max_tolerance;
- ode->win_task=ode->mem_task=Fs;
- QueInit(&ode->next_mass);
- QueInit(&ode->next_spring);
- ode->state=CAlloc(s);
- ode->array_base=MAlloc(12*s);
- ODERstPtrs(ode);
- return ode;
-}
-
-
-public Bool ODEPause(CMathODE *ode,Bool val=ON)
-{//Pause ODE.
- Bool res;
- if (!ode) return OFF;
- res=LBEqu(&ode->flags,ODEf_PAUSED,val);
- if (val)
- while (Bt(&ode->flags,ODEf_BUSY))
- Yield;
- return res;
-}
-
-public U0 ODEDel(CMathODE *ode)
-{//Free ODE node, but not masses or springs.
- I64 i;
- if (!ode) return;
- ODEPause(ode);
- Free(ode->state);
- Free(ode->array_base);
- if (ode->slave_tasks) {
- for (i=0;i<mp_cnt;i++)
- Kill(ode->slave_tasks[i]);
- Free(ode->slave_tasks);
- }
- Free(ode);
-}
-
-public I64 ODESize(CMathODE *ode)
-{//Mem size of ode ctrl, but not masses and springs.
- if (!ode)
- return 0;
- else
- return MSize2(ode->state)+MSize2(ode->array_base)+MSize2(ode);
-}
-
-U0 ODESetMassesPtrs(CMathODE *ode,F64 *state,F64 *DstateDt)
-{
- COrder2D3 *ptr1=state(F64 *)+ode->n,
- *ptr2=DstateDt(F64 *)+ode->n;
- CMass *tmpm=ode->next_mass;
- while (tmpm!=&ode->next_mass) {
- tmpm->state=ptr1++;
- tmpm->DstateDt=ptr2++;
- tmpm=tmpm->next;
- }
-}
-
-U0 ODEState2Internal(CMathODE *ode)
-{
- CMass *tmpm;
- F64 *old_array_base;
- I64 mass_cnt;
-
- if (ode->flags&ODEF_HAS_MASSES) {
- mass_cnt=0;
- tmpm=ode->next_mass;
- while (tmpm!=&ode->next_mass) {
- mass_cnt++;
- tmpm=tmpm->next;
- }
- old_array_base=ode->array_base;
- ode->n_internal=ode->n+6*mass_cnt;
- ode->array_base=MAlloc(12*ode->n_internal*sizeof(F64),ode->mem_task);
- Free(old_array_base);
- ODERstPtrs(ode);
-
- ODESetMassesPtrs(ode,ode->state_internal,ode->state_internal);
- tmpm=ode->next_mass;
- while (tmpm!=&ode->next_mass) {
- MemCpy(tmpm->state,&tmpm->saved_state,sizeof(COrder2D3));
- tmpm=tmpm->next;
- }
- }
- MemCpy(ode->state_internal,ode->state,ode->n*sizeof(F64));
-}
-
-U0 ODEInternal2State(CMathODE *ode)
-{
- CMass *tmpm;
- MemCpy(ode->state,ode->state_internal,ode->n*sizeof(F64));
- if (ode->flags&ODEF_HAS_MASSES) {
- ODESetMassesPtrs(ode,ode->state_internal,ode->state_internal);
- tmpm=ode->next_mass;
- while (tmpm!=&ode->next_mass) {
- MemCpy(&tmpm->saved_state,tmpm->state,sizeof(COrder2D3));
- tmpm=tmpm->next;
- }
- }
-}
-
-public U0 ODERenum(CMathODE *ode)
-{//Renumber masses and springs.
- I64 i;
- CSpring *tmps;
- CMass *tmpm;
-
- i=0;
- tmpm=ode->next_mass;
- while (tmpm!=&ode->next_mass) {
- tmpm->num=i++;
- tmpm=tmpm->next;
- }
-
- i=0;
- tmps=ode->next_spring;
- while (tmps!=&ode->next_spring) {
- tmps->num=i++;
- tmps->end1_num=tmps->end1->num;
- tmps->end2_num=tmps->end2->num;
- tmps=tmps->next;
- }
-}
-
-public CMass *MassFind(CMathODE *ode,F64 x,F64 y,F64 z=0)
-{//Search for mass nearest to x,y,z.
- CMass *tmpm,*best_mass=NULL;
- F64 dd,best_dd=F64_MAX;
-
- tmpm=ode->next_mass;
- while (tmpm!=&ode->next_mass) {
- dd=Sqr(tmpm->x-x)+Sqr(tmpm->y-y)+Sqr(tmpm->z-z);
- if (dd<best_dd) {
- best_dd=dd;
- best_mass=tmpm;
- }
- tmpm=tmpm->next;
- }
- return best_mass;
-}
-
-public CSpring *SpringFind(CMathODE *ode,F64 x,F64 y,F64 z=0)
-{//Find spring midpoint nearest x,y,z.
- CSpring *tmps,*best_spring=NULL;
- F64 dd,best_dd=F64_MAX;
-
- tmps=ode->next_spring;
- while (tmps!=&ode->next_spring) {
- dd=Sqr((tmps->end1->x+tmps->end2->x)/2-x)+
- Sqr((tmps->end1->y+tmps->end2->y)/2-y)+
- Sqr((tmps->end1->z+tmps->end2->z)/2-z);
- if (dd<best_dd) {
- best_dd=dd;
- best_spring=tmps;
- }
- tmps=tmps->next;
- }
- return best_spring;
-}
-
-public U0 MassOrSpringFind(
- CMathODE *ode,CMass **res_mass,CSpring **res_spring,
- F64 x,F64 y,F64 z=0)
-{//Find spring or mass nearest x,y,z.
- CMass *tmpm,*best_mass=NULL;
- CSpring *tmps,*best_spring=NULL;
- F64 dd,best_dd=F64_MAX;
-
- tmpm=ode->next_mass;
- while (tmpm!=&ode->next_mass) {
- dd=Sqr(tmpm->x-x)+Sqr(tmpm->y-y)+Sqr(tmpm->z-z);
- if (dd<best_dd) {
- best_dd=dd;
- best_mass=tmpm;
- }
- tmpm=tmpm->next;
- }
-
- tmps=ode->next_spring;
- while (tmps!=&ode->next_spring) {
- dd=Sqr((tmps->end1->x+tmps->end2->x)/2-x)+
- Sqr((tmps->end1->y+tmps->end2->y)/2-y)+
- Sqr((tmps->end1->z+tmps->end2->z)/2-z);
- if (dd<best_dd) {
- best_dd=dd;
- best_spring=tmps;
- best_mass=NULL;
- }
- tmps=tmps->next;
- }
- if (res_mass) *res_mass =best_mass;
- if (res_spring) *res_spring=best_spring;
-}
-
-public CMass *MassFindNum(CMathODE *ode,I64 num)
-{//Return mass number N.
- CMass *tmpm=ode->next_mass;
- while (tmpm!=&ode->next_mass) {
- if (tmpm->num==num)
- return tmpm;
- tmpm=tmpm->next;
- }
- return NULL;
-}
-
-public U0 ODERstInactive(CMathODE *ode)
-{//Set all masses and springs to ACTIVE for new trial.
- CMass *tmpm;
- CSpring *tmps;
- tmpm=ode->next_mass;
- while (tmpm!=&ode->next_mass) {
- tmpm->flags&=~MSF_INACTIVE;
- tmpm=tmpm->next;
- }
- tmps=ode->next_spring;
- while (tmps!=&ode->next_spring) {
- tmps->flags&=~SSF_INACTIVE;
- tmps=tmps->next;
- }
-}
-
-U0 ODECalcSprings(CMathODE *ode)
-{
- CSpring *tmps=ode->next_spring;
- CMass *e1,*e2;
- F64 d;
- CD3 p;
- while (tmps!=&ode->next_spring) {
- if (tmps->flags&SSF_INACTIVE) {
- tmps->displacement=0;
- tmps->f=0;
- } else {
- e1=tmps->end1;
- e2=tmps->end2;
- d=D3Norm(D3Sub(&p,&e2->state->x,&e1->state->x));
- tmps->displacement=d-tmps->rest_len;
- tmps->f=tmps->displacement*tmps->const;
- if (tmps->f>0 && tmps->flags&SSF_NO_TENSION)
- tmps->f=0;
- else if (tmps->f<0 && tmps->flags&SSF_NO_COMPRESSION)
- tmps->f=0;
- if (d>0) {
- D3MulEqu(&p,tmps->f/d);
- D3AddEqu(&e1->DstateDt->DxDt,&p);
- D3SubEqu(&e2->DstateDt->DxDt,&p);
- }
- }
- tmps=tmps->next;
- }
-}
-
-U0 ODECalcDrag(CMathODE *ode)
-{
- CMass *tmpm;
- F64 d,dd;
- CD3 p;
- if (ode->drag_v || ode->drag_v2 || ode->drag_v3) {
- tmpm=ode->next_mass;
- while (tmpm!=&ode->next_mass) {
- if (!(tmpm->flags & MSF_INACTIVE) &&
- tmpm->drag_profile_factor &&
- (dd=D3NormSqr(&tmpm->state->DxDt))) {
- d=ode->drag_v;
- if (ode->drag_v2)
- d+=ode->drag_v2*Sqrt(dd);
- if (ode->drag_v3)
- d+=dd*ode->drag_v3;
- D3SubEqu(&tmpm->DstateDt->DxDt,
- D3Mul(&p,d*tmpm->drag_profile_factor,&tmpm->state->DxDt));
- }
- tmpm=tmpm->next;
- }
- }
-}
-
-U0 ODEApplyAccelerationLimit(CMathODE *ode)
-{
- CMass *tmpm;
- F64 d;
- if (ode->acceleration_limit) {
- tmpm=ode->next_mass;
- while (tmpm!=&ode->next_mass) {
- if (!(tmpm->flags & MSF_INACTIVE) &&
- (d=D3Norm(&tmpm->DstateDt->DxDt))>ode->acceleration_limit)
- D3MulEqu(&tmpm->DstateDt->DxDt,ode->acceleration_limit/d);
- tmpm=tmpm->next;
- }
- }
-}
-
-U0 ODEMPTask(CMathODE *ode)
-{
- while (TRUE) {
- while (!Bt(&ode->mp_not_done_flags,Gs->num))
- Yield;
- if (ode->mp_derive)
- (*ode->mp_derive)(ode,ode->mp_t,
- Gs->num,ode->mp_state,ode->mp_DstateDt);
- LBtr(&ode->mp_not_done_flags,Gs->num);
- }
-}
-
-U0 ODEMPWake(CMathODE *ode)
-{
- I64 i;
- if (!ode->slave_tasks) {
- ode->slave_tasks=CAlloc(mp_cnt*sizeof(CTask *));
- for (i=0;i<mp_cnt;i++)
- ode->slave_tasks[i]=Spawn(&ODEMPTask,ode,"ODE Slave",i);
- }
- for (i=0;i<mp_cnt;i++) {
- Suspend(ode->slave_tasks[i],FALSE);
- MPInt(I_WAKE,i);
- }
-}
-
-U0 ODEMPSleep(CMathODE *ode)
-{
- I64 i;
- if (ode->slave_tasks) {
- while (ode->mp_not_done_flags)
- Yield;
- for (i=0;i<mp_cnt;i++)
- Suspend(ode->slave_tasks[i]);
- }
-}
-
-U0 ODECallMPDerivative(CMathODE *ode,F64 t,F64 *state,F64 *DstateDt)
-{
- ode->mp_t=t;
- ode->mp_state=state;
- ode->mp_DstateDt=DstateDt;
- ode->mp_not_done_flags=1<<mp_cnt-1;
- do Yield;
- while (ode->mp_not_done_flags);
-}
-
-U0 ODECallDerivative(CMathODE *ode,F64 t,F64 *state,F64 *DstateDt)
-{
- CMass *tmpm;
- if (ode->flags&ODEF_HAS_MASSES) {
- ODESetMassesPtrs(ode,state,DstateDt);
- tmpm=ode->next_mass;
- while (tmpm!=&ode->next_mass) {
- if (!(tmpm->flags&MSF_INACTIVE)) {
- D3Zero(&tmpm->DstateDt->DxDt);
- D3Copy(&tmpm->DstateDt->x,&tmpm->state->DxDt);
- }
- tmpm=tmpm->next;
- }
- ODECalcSprings(ode);
- ODECalcDrag(ode);
- if (ode->mp_derive)
- ODECallMPDerivative(ode,t,state,DstateDt);
- if (ode->derive)
- (*ode->derive)(ode,t,state,DstateDt);
- tmpm=ode->next_mass;
- while (tmpm!=&ode->next_mass) {
- if (!(tmpm->flags&MSF_INACTIVE)) {
- if (tmpm->flags&MSF_FIXED) {
- D3Zero(&tmpm->DstateDt->DxDt);
- D3Zero(&tmpm->DstateDt->x);
- } else if (tmpm->mass)
- D3DivEqu(&tmpm->DstateDt->DxDt,tmpm->mass);
- }
- tmpm=tmpm->next;
- }
- ODEApplyAccelerationLimit(ode);
- } else {
- if (ode->mp_derive)
- ODECallMPDerivative(ode,t,state,DstateDt);
- if (ode->derive)
- (*ode->derive)(ode,t,state,DstateDt);
- }
-}
-
-U0 ODEOneStep(CMathODE *ode)
-{
- I64 i;
- ODECallDerivative(ode,ode->t,ode->state_internal,ode->DstateDt);
- for (i=0;i<ode->n_internal;i++)
- ode->state_internal[i]+=ode->h*ode->DstateDt[i];
- ode->t+=ode->h;
-}
-
-U0 ODERK4OneStep(CMathODE *ode)
-{
- I64 i,n=ode->n_internal;
- F64 xh,hh,h6,*dym,*dyt,*yt,*DstateDt;
-
- dym =ode->tmp0;
- dyt =ode->tmp1;
- yt =ode->tmp2;
- DstateDt=ode->tmp3;
- hh =0.5*ode->h;
- h6 =ode->h / 6.0;
- xh =ode->t + hh;
-
- ODECallDerivative(ode,ode->t,ode->state_internal,ode->DstateDt);
- for (i=0;i<n;i++)
- yt[i]=ode->state_internal[i]+hh*DstateDt[i];
- ODECallDerivative(ode,xh,yt,dyt);
- for (i=0;i<n;i++)
- yt[i]=ode->state_internal[i]+hh*dyt[i];
- ODECallDerivative(ode,xh,yt,dym);
- for (i=0;i<n;i++) {
- yt[i]=ode->state_internal[i]+ode->h*dym[i];
- dym[i]+=dyt[i];
- }
- ode->t+=ode->h;
- ODECallDerivative(ode,ode->t,yt,dyt);
- for (i=0;i<n;i++)
- ode->state_internal[i]+=h6*(DstateDt[i]+dyt[i]+2.0*dym[i]);
-}
-
-#define ODEa2 0.2
-#define ODEa3 0.3
-#define ODEa4 0.6
-#define ODEa5 1.0
-#define ODEa6 0.875
-#define ODEb21 0.2
-#define ODEb31 (3.0/40.0)
-#define ODEb32 (9.0/40.0)
-#define ODEb41 0.3
-#define ODEb42 (-0.9)
-#define ODEb43 1.2
-#define ODEb51 (-11.0/54.0)
-#define ODEb52 2.5
-#define ODEb53 (-70.0/27.0)
-#define ODEb54 (35.0/27.0)
-#define ODEb61 (1631.0/55296.0)
-#define ODEb62 (175.0/512.0)
-#define ODEb63 (575.0/13824.0)
-#define ODEb64 (44275.0/110592.0)
-#define ODEb65 (253.0/4096.0)
-#define ODEc1 (37.0/378.0)
-#define ODEc3 (250.0/621.0)
-#define ODEc4 (125.0/594.0)
-#define ODEc6 (512.0/1771.0)
-#define ODEdc1 (37.0/378.0-2825.0/27648.0)
-#define ODEdc3 (250.0/621.0-18575.0/48384.0)
-#define ODEdc4 (125.0/594.0-13525.0/55296.0)
-#define ODEdc5 (-277.0/14336.0)
-#define ODEdc6 (512.0/1771.0-0.25)
-
-U0 ODECashKarp(CMathODE *ode)
-{
- I64 i,n=ode->n_internal;
- F64 h=ode->h,*state=ode->state_internal,
- *DstateDt=ode->DstateDt,*ak2,*ak3,*ak4,*ak5,*ak6,
- *tmpstate,*stateerr,*outstate;
-
- ak2=ode->tmp0;
- ak3=ode->tmp1;
- ak4=ode->tmp2;
- ak5=ode->tmp3;
- ak6=ode->tmp4;
- tmpstate=ode->tmp5;
- outstate=ode->tmp6;
- stateerr=ode->tmp7;
-
- for (i=0;i<n;i++)
- tmpstate[i]=state[i]+ODEb21*h*DstateDt[i];
- ODECallDerivative(ode,ode->t+ODEa2*h,tmpstate,ak2);
- for (i=0;i<n;i++)
- tmpstate[i]=state[i]+h*(ODEb31*DstateDt[i]+ODEb32*ak2[i]);
- ODECallDerivative(ode,ode->t+ODEa3*h,tmpstate,ak3);
- for (i=0;i<n;i++)
- tmpstate[i]=state[i]+h*(ODEb41*DstateDt[i]+ODEb42*ak2[i]+ODEb43*ak3[i]);
- ODECallDerivative(ode,ode->t+ODEa4*h,tmpstate,ak4);
- for (i=0;i<n;i++)
- tmpstate[i]=state[i]+h*(ODEb51*DstateDt[i]+
- ODEb52*ak2[i]+ODEb53*ak3[i]+ODEb54*ak4[i]);
- ODECallDerivative(ode,ode->t+ODEa5*h,tmpstate,ak5);
- for (i=0;i<n;i++)
- tmpstate[i]=state[i]+h*(ODEb61*DstateDt[i]+
- ODEb62*ak2[i]+ODEb63*ak3[i]+ODEb64*ak4[i]+ODEb65*ak5[i]);
- ODECallDerivative(ode,ode->t+ODEa6*h,tmpstate,ak6);
-
- for (i=0;i<n;i++)
- outstate[i]=state[i]+h*(ODEc1*DstateDt[i]+
- ODEc3*ak3[i]+ODEc4*ak4[i]+ODEc6*ak6[i]);
- for (i=0;i<n;i++)
- stateerr[i]=h*(ODEdc1*DstateDt[i]+ODEdc3*ak3[i]+
- ODEdc4*ak4[i]+ODEdc5*ak5[i]+ODEdc6*ak6[i]);
-}
-
-#define SAFETY 0.9
-#define PGROW (-0.2)
-#define PSHRNK (-0.25)
-#define ERRCON 1.89e-4
-
-U0 ODERK5OneStep(CMathODE *ode)
-{
- I64 i;
- F64 errmax,tmp,*tmpstate=ode->tmp6,*stateerr=ode->tmp7;
- while (TRUE) {
- ode->h=Clamp(ode->h,ode->h_min,ode->h_max);
- ODECashKarp(ode);
- errmax=0.0;
- for (i=0;i<ode->n_internal;i++) {
- tmp=Abs(stateerr[i]/ode->state_scale[i]);
- if (tmp>errmax)
- errmax=tmp;
- }
- errmax/=ode->tolerance_internal;
- if (errmax<=1.0 || ode->h==ode->h_min) break;
- tmp=ode->h*SAFETY*errmax`PSHRNK;
- if (tmp<0.1*ode->h)
- ode->h*=0.1;
- else
- ode->h=tmp;
- }
- ode->t+=ode->h;
- if (errmax>ERRCON)
- ode->h*=SAFETY*errmax`PGROW;
- else
- ode->h*=5.0;
- ode->h=Clamp(ode->h,ode->h_min,ode->h_max);
- MemCpy(ode->state_internal,tmpstate,sizeof(F64)*ode->n_internal);
-}
-
-F64 ode_alloced_factor=0.75;
-
-U0 ODEsUpdate(CTask *task)
-{/* This routine is called by the window mgron a continuous
-basis to allow real-time simulation.It is intended
-to provide ress good enough for games.It uses a runge-kutta
-integrator which is a better algorithm than doing it with Euler.
-
-It is adaptive step-sized, so it slows down when an important
-event is taking place to improve accuracy, but in my implementation
-it has a timeout.
-*/
- I64 i;
- F64 d,start_time,timeout_time,t_desired,t_initial,interpolation;
- CMathODE *ode;
-
- if (task->next_ode==&task->next_ode)
- task->last_ode_time=0;
- else if (!Bt(&task->win_inhibit,WIf_SELF_ODE)) {
-//See GrUpdateTasks() and GrUpdateTaskODEs().
- //We will not pick a time limit based on
- //how busy the CPU is, what percent of the
- //last refresh cycle was spent on ODE's
- //and what the refresh cycle rate was.
- start_time=tS;
- d=1.0/winmgr.fps;
- timeout_time=start_time+
- (task->last_ode_time/d+0.1)/(winmgr.last_ode_time/d+0.1)*
- ode_alloced_factor*d;
- ode=task->next_ode;
- while (ode!=&task->next_ode) {
- t_initial=ode->t;
- d=tS;
- if (!(ode->flags&ODEF_STARTED)) {
- ode->base_t=d;
- ode->flags|=ODEF_STARTED;
- }
- d-=ode->base_t+t_initial;
- t_desired=ode->t_scale*d+t_initial;
- if (ode->flags&ODEF_PAUSED)
- ode->base_t+=t_desired-ode->t; //Slip
- else {
- ode->flags|=ODEF_BUSY;
- if (ode->flags&ODEF_PAUSED)
- ode->base_t+=t_desired-ode->t; //Slip
- else {
- if (ode->derive || ode->mp_derive) {
- if (ode->mp_derive)
- ODEMPWake(ode);
- ODEState2Internal(ode);
- MemCpy(ode->initial_state,ode->state_internal,
- ode->n_internal*sizeof(F64));
- while (ode->t<t_desired) {
- ode->h_max=t_desired-ode->t;
- ODECallDerivative(ode,ode->t,ode->state_internal,ode->DstateDt);
- for (i=0;i<ode->n_internal;i++)
- ode->state_scale[i]=Abs(ode->state_internal[i])+
- Abs(ode->DstateDt[i]*ode->h)+ode->tolerance_internal;
- ODERK5OneStep(ode);
- if (tS>timeout_time) {
- ode->base_t+=t_desired-ode->t; //Slip
- goto ode_done;
-
- }
- }
-
- //Interpolate if end time was not exact.
- if (ode->t!=t_desired) {
- if (interpolation=ode->t-t_initial) {
- interpolation=(t_desired-t_initial)/interpolation;
- if (interpolation!=1.0)
- for (i=0;i<ode->n_internal;i++)
- ode->state_internal[i]=(ode->state_internal[i]-
- ode->initial_state[i])*interpolation+
- ode->initial_state[i];
- }
- ode->t=t_desired;
- }
-ode_done:
- ODEInternal2State(ode);
-
- //Convenience call to set vals
- ODECallDerivative(ode,ode->t,ode->state_internal,ode->DstateDt);
-
- if (ode->mp_derive)
- ODEMPSleep(ode);
- }
- }
- ode->flags&=~ODEF_BUSY;
- }
- ode->base_t+=(1.0-ode->t_scale)*d;
- ode=ode->next;
- }
-
- //Now, we will dynamically adjust tolerances.
-
- //We will regulate the tolerances
- //to fill the time we decided was
- //okay to devote to ODE's.
- //Since we might have multiple ODE's
- //active we scale them by the same factor.
-
- //This algorithm is probably not stable or very good, but it's something.
-
- //Target is 75% of alloced time.
- d=(tS-start_time)/(timeout_time-start_time)-0.75;
-
- ode=task->next_ode;
- while (ode!=&task->next_ode) {
- if (!(ode->flags&ODEF_PAUSED) && ode->derive) {
- if (ode->min_tolerance!=ode->max_tolerance) {
- if (d>0)
- ode->tolerance_internal*=10.0`d;
- else
- ode->tolerance_internal*=2.0`d;
- }
- ode->tolerance_internal=Clamp(ode->tolerance_internal,
- ode->min_tolerance,ode->max_tolerance);
- }
- ode=ode->next;
- }
- winmgr.ode_time+=task->last_ode_time=tS-start_time;
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/AMem.HC.HTML b/public/src/Adam/AMem.HC.HTML deleted file mode 100644 index 0b08740..0000000 --- a/public/src/Adam/AMem.HC.HTML +++ /dev/null @@ -1,191 +0,0 @@ - - - - - AMem.HC - - - - - #help_index "Memory/Task"
-public I64 TaskMemAlloced(CTask *task=NULL,Bool override_validate=FALSE)
-{//Count of bytes alloced to a task, used+unused.
- I64 res;
- if (!task) task=Fs;
- if (override_validate || TaskValidate(task)) {
- res=task->code_heap->alloced_u8s;
- if (task->code_heap!=task->data_heap)
- res+=task->data_heap->alloced_u8s;
- return res;
- } else
- return 0;
-}
-
-public I64 TaskMemUsed(CTask *task=NULL,Bool override_validate=FALSE)
-{//Count of bytes alloced to a task and in use.
- I64 res;
- if (!task) task=Fs;
- if (override_validate || TaskValidate(task)) {
- res=task->code_heap->used_u8s;
- if (task->data_heap!=task->code_heap)
- res+=task->data_heap->used_u8s;
- return res;
- } else
- return 0;
-}
-
-#help_index "Memory/Task;Debugging/Heap;Memory/Debugging"
-public Bool HeapRep(CTask *task)
-{//Report status of task's heap.
- I64 i,cnt;
- CMemUnused *uum;
-
- if (!task || task==Fs) {
- "Task can't HeapRep on self.\n";
- return FALSE;
- }
- if (!TaskValidate(task)) return FALSE;
-
- PUSHFD
- CLI
- while (LBts(&task->code_heap->locked_flags,HClf_LOCKED))
- PAUSE
- if (task->data_heap!=task->code_heap)
- while (LBts(&task->data_heap->locked_flags,HClf_LOCKED))
- PAUSE
-
- for (i=0;i<MEM_HEAP_HASH_SIZE>>3;i++) {
- cnt=0;
- uum=task->code_heap->heap_hash[i];
- while (uum) {
- cnt+=uum->size;
- uum=uum->next;
- }
- if (task->data_heap!=task->code_heap) {
- uum=task->data_heap->heap_hash[i];
- while (uum) {
- cnt+=uum->size;
- uum=uum->next;
- }
- }
- if (cnt)
- "%03X:%08X\n",i<<3,cnt;
- }
- '\n';
-
- uum=task->code_heap->malloc_free_lst;
- while (uum) {
- "%X, ",uum->size;
- uum=uum->next;
- }
- if (task->data_heap!=task->code_heap) {
- uum=task->data_heap->malloc_free_lst;
- while (uum) {
- "%X, ",uum->size;
- uum=uum->next;
- }
- }
-
- if (task->data_heap!=task->code_heap)
- LBtr(&task->data_heap->locked_flags,HClf_LOCKED);
- LBtr(&task->code_heap->locked_flags,HClf_LOCKED);
- POPFD
-
- '\n';
-}
-
-#help_index "Memory/HeapCtrl;Debugging/Heap;Memory/Debugging"
-public Bool IsInHeapCtrl(U8 *a,CHeapCtrl *hc,Bool lock=TRUE)
-{//Check addr if in HeapCtrl.
- CMemBlk *m;
- PUSHFD
- CLI
- if (lock)
- while (LBts(&hc->locked_flags,HClf_LOCKED))
- PAUSE
- m=hc->next_mem_blk;
- while (m!=&hc->next_mem_blk) {
- if (a>=m && a<m(U8 *)+m->pags<<MEM_PAG_BITS) {
- if (lock)
- LBtr(&hc->locked_flags,HClf_LOCKED);
- POPFD
- return TRUE;
- }
- m=m->next;
- }
- if (lock)
- LBtr(&hc->locked_flags,HClf_LOCKED);
- POPFD
- return FALSE;
-}
-
-public Bool HeapCtrlWalk(CHeapCtrl *hc)
-{//Check integrity of HeapCtrl.
- I64 i;
- CMemUnused *uum;
-
- PUSHFD
- CLI
- while (LBts(&hc->locked_flags,HClf_LOCKED))
- PAUSE
-
- for (i=0;i<MEM_HEAP_HASH_SIZE>>3;i++) {
- uum=hc->heap_hash[i];
- while (uum) {
- if (!IsInHeapCtrl(uum,hc,FALSE))
- goto hc_false;
- uum=uum->next;
- }
- }
- uum=hc->malloc_free_lst;
- while (uum) {
- if (!IsInHeapCtrl(uum,hc,FALSE))
- goto hc_false;
- uum=uum->next;
- }
-
- #if _CFG_HEAP_DBG
- CMemUsed *um,*um1;
- um1=(&hc->next_um)(U8 *)-offset(CMemUsed.next);
- um=um1->next;
- while (um!=um1) {
- if (!IsInHeapCtrl(um,hc,FALSE))
- goto hc_false;
- um=um->next;
- }
-#endif
-
- LBtr(&hc->locked_flags,HClf_LOCKED);
- POPFD
- return TRUE;
-
- hc_false:
- LBtr(&hc->locked_flags,HClf_LOCKED);
- POPFD
- return FALSE;
-}
-
-#help_index "Memory/Task;Debugging/Heap;Memory/Debugging"
-public Bool IsInHeap(U8 *a,CTask *task=NULL,Bool lock=TRUE)
-{//Check addr if in task's heaps.
- if (!task) task=Fs;
- if (TaskValidate(task) && (IsInHeapCtrl(a,task->code_heap,lock)||
- task->data_heap!=task->code_heap &&
- IsInHeapCtrl(a,task->data_heap,lock)))
- return TRUE;
- else
- return FALSE;
-}
-
-public Bool HeapWalk(CTask *task=NULL)
-{//Check integrity of task's heaps.
- if (!task) task=Fs;
- if (!TaskValidate(task) || !HeapCtrlWalk(task->code_heap) ||
- task->data_heap!=task->code_heap && !HeapCtrlWalk(task->data_heap))
- return FALSE;
- else
- return TRUE;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/AMouse.HC.HTML b/public/src/Adam/AMouse.HC.HTML deleted file mode 100644 index 8b38dc8..0000000 --- a/public/src/Adam/AMouse.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - AMouse.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Adam/ARegistry.HC.HTML b/public/src/Adam/ARegistry.HC.HTML deleted file mode 100644 index fc80e48..0000000 --- a/public/src/Adam/ARegistry.HC.HTML +++ /dev/null @@ -1,215 +0,0 @@ - - - - - ARegistry.HC - - - - - #help_index "Registry"
-#define REGISTRY_FILENAME "~/Registry.HC.Z"
-CDoc *sys_registry_doc=NULL;
-I64 sys_msg_flags[1]={0};
-F64 registry_version;
-
-Bool RegCache()
-{
- Bool old_silent;
- if (!sys_registry_doc) {
- old_silent=Silent;
- sys_registry_doc=DocRead(REGISTRY_FILENAME);
- Silent(old_silent);
- return FALSE;
- } else
- return TRUE;
-}
-
-public Bool RegDft(U8 *path,U8 *val,Bool is_adam_entry=FALSE)
-{//Add code doc tree branch to registry.
- Bool res,unlock_doc;
- RegCache;
- unlock_doc=DocLock(sys_registry_doc);
- if (!DocTreeFind(sys_registry_doc,path)) {
- DocTreeMake(sys_registry_doc,path);
- DocPrint(sys_registry_doc,"%s",val);
- if (is_adam_entry) {
- if (Fs==adam_task)
- ExePrint("%s",val);
- else
- Adam("%s",val);
- }
- if (DrvIsWritable(*sys_registry_doc->filename.name))
- DocWrite(sys_registry_doc);
- res=FALSE;
- } else
- res=TRUE;
- if (unlock_doc)
- DocUnlock(sys_registry_doc);
- return res;
-}
-
-public I64 RegExe(U8 *path)
-{//Execute doc tree branch in registry.
- RegCache;
- return DocTreeExe(sys_registry_doc,path);
-}
-
-public Bool RegWrite(U8 *path,U8 *fmt,...)
-{//Rewrite doc tree branch in registry.
- Bool res;
- RegCache;
- res=DocTreeWriteJoin(sys_registry_doc,path,TRUE,fmt,argc,argv);
- return res;
-}
-
-public I64 RegCnt(U8 *path)
-{//Tree branch cnt in registry.
- I64 res=0;
- CDocEntry *tree_branch,*start_indent,*end_indent;
- Bool unlock_doc=DocLock(sys_registry_doc);
- if (DocTreeFind(sys_registry_doc,path,
- &tree_branch,&start_indent,&end_indent)) {
- end_indent=end_indent->next;
- while (start_indent!=end_indent) {
- res++;
- start_indent=start_indent->next;
- }
- }
- if (unlock_doc)
- DocUnlock(sys_registry_doc);
- return res;
-}
-
-public Bool RegAppend(U8 *path,U8 *fmt,...)
-{//Append to doc tree branch in registry.
- Bool res;
- RegCache;
- res=DocTreeAppendJoin(sys_registry_doc,path,TRUE,fmt,argc,argv);
- return res;
-}
-
-public Bool OneTimePopUp(U8 *_flags,I64 flag_num,U8 *msg)
-{//See /Apps/X-Caliber/X-Caliber.HC.
- Bool res=FALSE;
- CDoc *doc=DocNew;
- CDocEntry *doc_e;
- if (!Bt(_flags,flag_num)) {
- if (msg) DocPrint(doc,"%s",msg);
- doc_e=DocPrint(doc,"\n$CB,\"Do not show this msg again.\",LE=1$");
- DocPrint(doc,"$CM+CX,0,4$$BT,\"OKAY\",LE=1$\n");
- if (PopUpMenu(doc)==1 && doc_e->de_flags&DOCEF_CHECKED_COLLAPSED) {
- LBts(_flags,flag_num);
- res=TRUE;
- }
- DocDel(doc);
- }
- return res;
-}
-
-U0 RegOneTimePopUp(I64 flag_num,U8 *msg)
-{//You're not supposed to make system pop-up flags, only me.
- if (OneTimePopUp(sys_msg_flags,flag_num,msg))
- RegWrite("Adam/SysMsgFlags","sys_msg_flags[0]=0x%X;\n",
- sys_msg_flags[0]);
-}
-
-U0 RegInit()
-{
- U8 buf[STR_LEN];
- Bool version_present;
- RegDft("Adam/SysMsgFlags","sys_msg_flags[0]=0;\n",TRUE);
- StrPrint(buf,"registry_version=%4.3f;\n",sys_os_version);
- version_present=RegDft("Adam/SysRegVer",buf,TRUE);
- RegExe("Adam");
- if (registry_version!=sys_os_version) {
- RegWrite("Adam/SysRegVer",buf);
- RegExe("Adam");
- }
-}
-
-#help_index "Boot/Once;Registry/Once"
-#help_file "::/Doc/Once"
-
-public U0 AOnceFlush()
-{//Flush AOnce() buf.
- RegWrite("Once/Adam","");
-}
-
-public U0 OnceFlush()
-{//Flush Once() buf.
- RegWrite("Once/User","");
-}
-
-public U0 AOnce(U8 *fmt,...)
-{//Add Adam code to $LK,"~/Registry.HC"$, executed next boot.
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
- if (!Bt(&sys_run_level,RLf_ONCE_ADAM))
- AOnceFlush;
- RegAppend("Once/Adam","%s\n",buf);
- Free(buf);
-}
-
-public U0 Once(U8 *fmt,...)
-{//Add User code to $LK,"~/Registry.HC"$, executed next boot.
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
- if (!Bt(&sys_run_level,RLf_ONCE_USER))
- OnceFlush;
- RegAppend("Once/User","%s\n",buf);
- Free(buf);
-}
-
-public U0 AOnceDrv(U8 drv_let=0,U8 *fmt,...)
-{//Add Adam code to drv $LK,"~/Registry.HC"$, executed next boot.
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
- I64 old_drv_let=*sys_registry_doc->filename.name;
- if (drv_let)
- *sys_registry_doc->filename.name=drv_let;
- if (!Bt(&sys_run_level,RLf_ONCE_ADAM))
- AOnceFlush;
- RegAppend("Once/Adam","%s\n",buf);
- Free(buf);
- *sys_registry_doc->filename.name=old_drv_let;
-}
-
-public U0 OnceDrv(U8 drv_let=0,U8 *fmt,...)
-{//Add User code to drv $LK,"~/Registry.HC"$, executed next boot.
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
- I64 old_drv_let=*sys_registry_doc->filename.name;
- if (drv_let)
- *sys_registry_doc->filename.name=drv_let;
- if (!Bt(&sys_run_level,RLf_ONCE_USER))
- OnceFlush;
- RegAppend("Once/User","%s\n",buf);
- Free(buf);
- *sys_registry_doc->filename.name=old_drv_let;
-}
-
-public U0 OnceExe()
-{//Execute Once code. Call goes in $LK,"~/Once.HC"$.
- try {
-
- RegDft("Once/Adam","");
- if (RegCnt("Once/Adam")>2) {
- Adam("RegExe(\"Once/Adam\");");
- AOnceFlush;
- }
- LBts(&sys_run_level,RLf_ONCE_ADAM);
-
- RegDft("Once/User","");
- if (RegCnt("Once/User")>2) {
- RegExe("Once/User");
- OnceFlush;
- }
- LBts(&sys_run_level,RLf_ONCE_USER);
-
- } catch {
- AOnceFlush;
- LBts(&sys_run_level,RLf_ONCE_ADAM);
- OnceFlush;
- LBts(&sys_run_level,RLf_ONCE_USER);
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/ASnd.HC.HTML b/public/src/Adam/ASnd.HC.HTML deleted file mode 100644 index 519bfaa..0000000 --- a/public/src/Adam/ASnd.HC.HTML +++ /dev/null @@ -1,421 +0,0 @@ - - - - - ASnd.HC - - - - - #help_index "Snd"
-public U0 SndTaskEndCB()
-{//Will turn-off snd when a task gets killed.
- Snd;
- Exit;
-}
-
-#help_index "Snd/Math;Math"
-public F64 Saw(F64 t,F64 period)
-{//Sawtooth. 0.0 - 1.0 think "(Sin+1)/2"
- if (period) {
- if (t>=0.0)
- return t%period/period;
- else
- return 1.0+t%period/period;
- } else
- return 0.0;
-}
-
-public F64 FullSaw(F64 t,F64 period)
-{//Plus&Minus Sawtooth. 1.0 - -1.0 think "Sin"
- if (period) {
- if (t>=0.0)
- return 2.0*(t%period/period)-1.0;
- else
- return 2.0*(t%period/period)+1.0;
- } else
- return 0.0;
-}
-
-public F64 Caw(F64 t,F64 period)
-{//Cawtooth. 1.0 - 0.0 think "(Cos+1)/2"
- if (period) {
- if (t>=0.0)
- return 1.0-t%period/period;
- else
- return -(t%period)/period;
- } else
- return 1.0;
-}
-
-public F64 FullCaw(F64 t,F64 period)
-{//Plus&Minus Cawtooth. 1.0 - -1.0 think "Cos"
- if (period) {
- if (t>=0.0)
- return -2.0*(t%period/period)+1.0;
- else
- return -2.0*(t%period/period)-1.0;
- } else
- return 1.0;
-}
-
-public F64 Tri(F64 t,F64 period)
-{//Triangle waveform. 0.0 - 1.0 - 0.0
- if (period) {
- t=2.0*(Abs(t)%period)/period;
- if (t<=1.0)
- return t;
- else
- return 2.0-t;
- } else
- return 0.0;
-}
-
-public F64 FullTri(F64 t,F64 period)
-{//Plus&Minus Triangle waveform. 0.0 - 1.0 - 0.0 - -1.0 -0.0
- if (period) {
- t=4.0*(t%period)/period;
- if (t<=-1.0) {
- if (t<=-3.0)
- return t+4.0;
- else
- return -2.0-t;
- } else {
- if (t<=1.0)
- return t;
- else if (t<=3.0)
- return 2.0-t;
- else
- return t-4.0;
- }
- } else
- return 0.0;
-}
-
-#help_index "Snd/Music"
-
-public class CMusicGlbls
-{
- U8 *cur_song;
- CTask *cur_song_task;
- I64 octave;
- F64 note_len;
- U8 note_map[7];
- Bool mute;
- I64 meter_top,meter_bottom;
- F64 tempo,stacatto_factor;
-
- //If you wish to sync with a
- //note in a Play() string. 0 is the start
- I64 play_note_num;
-
- F64 tM_correction,last_Beat,last_tM;
-} music={NULL,NULL,4,1.0,{0,2,3,5,7,8,10},FALSE,4,4,2.5,0.9,0,0,0,0};
-
-#help_index "Snd/Music;Time/Seconds"
-public F64 tM()
-{//Time in seconds synced to music subsystem.
- return (cnts.jiffies+music.tM_correction)/JIFFY_FREQ;
-}
-
-public F64 Beat()
-{//Time in music beats.
- F64 res,cur_tM;
- PUSHFD
- CLI
- if (mp_cnt>1)
- while (LBts(&sys_semas[SEMA_TMBEAT],0))
- PAUSE
- cur_tM=tM;
- res=music.last_Beat;
- if (music.tempo)
- res+=(cur_tM-music.last_tM)*music.tempo;
- music.last_tM=cur_tM;
- music.last_Beat=res;
- LBtr(&sys_semas[SEMA_TMBEAT],0);
- POPFD
- return res;
-}
-
-#help_index "Snd/Music"
-U8 *MusicSetOctave(U8 *st)
-{
- I64 ch;
- ch=*st++;
- while ('0'<=ch<='9') {
- music.octave=ch-'0';
- ch=*st++;
- }
- return --st;
-}
-
-U8 *MusicSetMeter(U8 *st)
-{
- I64 ch;
- ch=*st++;
- while (ch=='M') {
- ch=*st++;
- if ('0'<=ch<='9') {
- music.meter_top=ch-'0';
- ch=*st++;
- }
- if (ch=='/')
- ch=*st++;
- if ('0'<=ch<='9') {
- music.meter_bottom=ch-'0';
- ch=*st++;
- }
- }
- return --st;
-}
-
-U8 *MusicSetNoteLen(U8 *st)
-{
- Bool cont=TRUE;
- do {
- switch (*st++) {
- case 'w': music.note_len=4.0; break;
- case 'h': music.note_len=2.0; break;
- case 'q': music.note_len=1.0; break;
- case 'e': music.note_len=0.5; break;
- case 's': music.note_len=0.25; break;
- case 't': music.note_len=2.0*music.note_len/3.0; break;
- case '.': music.note_len=1.5*music.note_len; break;
- default:
- st--;
- cont=FALSE;
- }
- } while (cont);
- return st;
-}
-
-public I8 Note2Ona(I64 note,I64 octave=4)
-{//Note to ona. Mid C is ona=51, note=3 and octave=4.
- if (note<3)
- return (octave+1)*12+note;
- else
- return octave*12+note;
-}
-
-public I8 Ona2Note(I8 ona)
-{//Ona to note in octave. Mid C is ona=51, note=3 and octave=4.
- return ona%12;
-}
-
-public I8 Ona2Octave(I8 ona)
-{//Ona to octave. Mid C is ona=51, note=3 and octave=4.
- I64 note=ona%12,octave=ona/12;
- if (note<3)
- return octave-1;
- else
- return octave;
-}
-
-public U0 Play(U8 *st,U8 *words=NULL)
-{/* Notes are entered with a capital letter.
-
-Octaves are entered with a digit and
-stay set until changed. Mid C is octave 4.
-
-Durations are entered with
-'w' whole note
-'h' half note
-'q' quarter note
-'e' eighth note
-'t' sets to 2/3rds the current duration
-'.' sets to 1.5 times the current duration
-durations stay set until changed.
-
-'(' tie, placed before the note to be extended
-
-music.meter_top,music.meter_bottom is set with
-"M3/4"
-"M4/4"
-etc.
-
-Sharp and flat are done with '#' or 'b'.
-
-The var music.stacatto_factor can
-be set to a range from 0.0 to 1.0.
-
-The var music.tempo is quarter-notes
-per second.It defaults to
-2.5 and gets faster when bigger.
-*/
- U8 *word,*last_st;
- I64 note,octave,i=0,ona,timeout_val,timeout_val2;
- Bool tie;
- F64 d,on_jiffies,off_jiffies;
- music.play_note_num=0;
- while (*st) {
- timeout_val=cnts.jiffies;
- tie=FALSE;
-
- do {
- last_st=st;
- if (*st=='(') {
- tie=TRUE;
- st++;
- } else {
- st=MusicSetMeter(st);
- st=MusicSetOctave(st);
- st=MusicSetNoteLen(st);
- }
- } while (st!=last_st);
-
- if (!*st) break;
- note=*st++-'A';
- if (note<7) {
- note=music.note_map[note];
- octave=music.octave;
- if (*st=='b') {
- note--;
- if (note==2)
- octave--;
- st++;
- } else if (*st=='#') {
- note++;
- if (note==3)
- octave++;
- st++;
- }
- ona=Note2Ona(note,octave);
- } else
- ona=0;
- if (words && (word=LstSub(i++,words)) && StrCmp(word,""))
- "%s",word;
-
- d=JIFFY_FREQ*music.note_len/music.tempo;
- on_jiffies =d*music.stacatto_factor;
- off_jiffies =d*(1.0-music.stacatto_factor);
-
- timeout_val+=on_jiffies;
- timeout_val2=timeout_val+off_jiffies;
-
- if (!music.mute)
- Snd(ona);
- SleepUntil(timeout_val);
- music.tM_correction+=on_jiffies-ToI64(on_jiffies);
-
- if (!music.mute && !tie)
- Snd;
- SleepUntil(timeout_val2);
- music.tM_correction+=off_jiffies-ToI64(off_jiffies);
-
- music.play_note_num++;
- }
-}
-
-U0 MusicSettingsRst()
-{
- music.play_note_num=0;
- music.stacatto_factor=0.9;
- music.tempo=2.5;
- music.octave=4;
- music.note_len=1.0;
- music.meter_top=4;
- music.meter_bottom=4;
- SndRst;
- PUSHFD
- CLI
- if (mp_cnt>1)
- while (LBts(&sys_semas[SEMA_TMBEAT],0))
- PAUSE
- music.last_tM=tM;
- music.last_Beat=0.0;
- LBtr(&sys_semas[SEMA_TMBEAT],0);
- POPFD
-}
-
-MusicSettingsRst;
-
-U0 CurSongTask()
-{
- Fs->task_end_cb=&SndTaskEndCB;
- while (TRUE)
- Play(music.cur_song);
-}
-
-#help_index "Snd"
-
-#define SE_NOISE 0
-#define SE_SWEEP 1
-
-class CSoundEffectFrame
-{
- I32 type;
- I8 ona1,ona2;
- F64 duration;
-};
-
-U0 SoundEffectEndTaskCB()
-{
- Free(FramePtr("CSoundEffectFrame"));
- music.mute--;
- SndTaskEndCB;
-}
-
-U0 SoundEffectTask(CSoundEffectFrame *ns)
-{
- I64 i,ona;
- F64 t0=tS,t,timeout=t0+ns->duration;
- FramePtrAdd("CSoundEffectFrame",ns);
- Fs->task_end_cb=&SoundEffectEndTaskCB;
- switch (ns->type) {
- case SE_NOISE:
- i=MaxI64(ns->ona2-ns->ona1,1);
- while (tS<timeout) {
- ona=RandU16%i+ns->ona1;
- Snd(ona);
- t=Clamp(3000.0/Ona2Freq(ona),1.0,50.0);
- if (t+tS>timeout)
- t=timeout-tS;
- Sleep(t);
- }
- break;
- case SE_SWEEP:
- while (tS<timeout) {
- t=(tS-t0)/ns->duration;
- ona=(1.0-t)*ns->ona1+t*ns->ona2;
- Snd(ona);
- t=Clamp(3000.0/Ona2Freq(ona),1.0,50.0);
- if (t+tS>timeout)
- t=timeout-tS;
- Sleep(t);
- }
- break;
- }
-}
-
-public CTask *Noise(I64 mS,F64 min_ona,F64 max_ona)
-{//Make white noise for given number of mS.
- CSoundEffectFrame *ns;
- if (mS>0) {
- ns=MAlloc(sizeof(CSoundEffectFrame));
- ns->type=SE_NOISE;
- ns->duration=mS/1000.0;
- ns->ona1=min_ona;
- ns->ona2=max_ona;
- music.mute++;
- return Spawn(&SoundEffectTask,ns,"Noise",,Fs);
- } else
- return NULL;
-}
-
-public CTask *Sweep(I64 mS,F64 ona1,F64 ona2)
-{//Sweep through freq range in given number of mS.
- CSoundEffectFrame *ns;
- if (mS>0) {
- ns=MAlloc(sizeof(CSoundEffectFrame));
- ns->type=SE_SWEEP;
- ns->duration=mS/1000.0;
- ns->ona1=ona1;
- ns->ona2=ona2;
- music.mute++;
- return Spawn(&SoundEffectTask,ns,"Noise",,Fs);
- } else
- return NULL;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/AutoComplete/ACDictGen.HC.HTML b/public/src/Adam/AutoComplete/ACDictGen.HC.HTML deleted file mode 100644 index 6031ea8..0000000 --- a/public/src/Adam/AutoComplete/ACDictGen.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - ACDictGen.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Adam/AutoComplete/ACFill.HC.HTML b/public/src/Adam/AutoComplete/ACFill.HC.HTML deleted file mode 100644 index a36a368..0000000 --- a/public/src/Adam/AutoComplete/ACFill.HC.HTML +++ /dev/null @@ -1,238 +0,0 @@ - - - - - ACFill.HC - - - - - #help_index "AutoComplete/Dictionary"
-public U8 *ACDDefGet(U8 *st,I64 def_num=1)
-{//MAlloc str holding single dict definition of word.
- CFile *f;
- CHashGeneric *tmph;
- U8 *res=NULL,*buf,*in_ptr,
- *st2=MStrUtil(st,SUF_TO_UPPER);
- tmph=HashFind(st2,ac.hash_table,HTT_DICT_WORD);
- Free(st2);
- if (tmph) {
- if (f=FOpen(ACD_DEF_FILENAME,"r")) {
- buf=MAlloc(ACD_BLK_SIZE*2+1);
- buf[ACD_BLK_SIZE*2]=0; //terminate
- FBlkRead(f,buf,tmph->user_data0*ACD_BLK_SIZE/BLK_SIZE,
- ACD_BLK_SIZE*2/BLK_SIZE);
- FClose(f);
- in_ptr=buf;
- while (in_ptr<buf+ACD_BLK_SIZE*2) {
- while (*in_ptr!=ACD_WORD_CHAR && in_ptr<buf+ACD_BLK_SIZE*2)
- in_ptr++;
- if (*in_ptr++==ACD_WORD_CHAR) {
- if (!StrICmp(st,in_ptr)) {
- while (def_num && *in_ptr!=ACD_WORD_CHAR
- && in_ptr<buf+ACD_BLK_SIZE*2) {
- if (*in_ptr==ACD_DEF_CHAR) {
- if (!--def_num)
- break;
- else
- in_ptr++;
- } else
- in_ptr++;
- }
- if (*in_ptr++==ACD_DEF_CHAR) {
- res=StrNew(in_ptr);
- break;
- }
- }
- }
- }
- Free(buf);
- }
- }
- return res;
-}
-
-public U8 *ACDDefsGet(U8 *st)
-{//MAlloc str with all dict definitions of word.
- CFile *f;
- CHashGeneric *tmph;
- U8 *res=NULL,*buf,*in_ptr,*in_ptr2,
- *st2=MStrUtil(st,SUF_TO_UPPER);
- tmph=HashFind(st2,ac.hash_table,HTT_DICT_WORD);
- Free(st2);
- if (tmph) {
- if (f=FOpen(ACD_DEF_FILENAME,"r")) {
- buf=MAlloc(ACD_BLK_SIZE*2+1);
- buf[ACD_BLK_SIZE*2]=0; //terminate
- FBlkRead(f,buf,tmph->user_data0*ACD_BLK_SIZE/BLK_SIZE,
- ACD_BLK_SIZE*2/BLK_SIZE);
- FClose(f);
- in_ptr=buf;
- while (in_ptr<buf+ACD_BLK_SIZE*2) {
- while (*in_ptr!=ACD_WORD_CHAR && in_ptr<buf+ACD_BLK_SIZE*2)
- in_ptr++;
- if (*in_ptr++==ACD_WORD_CHAR) {
- if (!StrICmp(st,in_ptr)) {
- in_ptr2=in_ptr;
- in_ptr--;
- while (*in_ptr2!=ACD_WORD_CHAR
- && in_ptr2<buf+ACD_BLK_SIZE*2) {
- in_ptr2++;
- }
- res=MAlloc(in_ptr2+1-in_ptr);
- MemCpy(res,in_ptr,in_ptr2-in_ptr);
- res[in_ptr2-in_ptr]=ACD_END_CHAR;
- break;
- }
- }
- }
- Free(buf);
- }
- }
- return res;
-}
-
-/*Fmt of word lst entry:
- U8 ACD_WORD_CHAR
- U8 word[] with terminating zero
- I16 block;
-*/
-public U8 *ACDWordPtAt(U8 *st)
-{//Point to word in word list.
- I64 i;
- U8 *start=acd.word_lst,*r=start,
- *end=acd.word_lst+acd.word_lst_size;
- if (!st || !*st)
- return acd.word_lst;
- if (acd.word_lst_size) {
- while (start+3<end) {
- r=(start+end)>>1;
- while (TRUE) {
- while (*r!=ACD_WORD_CHAR && r>acd.word_lst)
- r--;
- if ((r[2]==ACD_WORD_CHAR||r[1]==ACD_WORD_CHAR)&&r-3>acd.word_lst)
- r--;
- else
- break;
- }
- if (*r==ACD_WORD_CHAR) {
- i=StrICmp(st,r+1);
- if (i<0)
- end=r-1;
- else if (i>0)
- start=r+StrLen(r)+3;
- else
- return r;
- } else
- break;
- }
- r=(start+end)>>1;
- while (TRUE) {
- while (*r!=ACD_WORD_CHAR && r>acd.word_lst)
- r--;
- if ((r[2]==ACD_WORD_CHAR||r[1]==ACD_WORD_CHAR)&&r-3>acd.word_lst)
- r--;
- else
- break;
- }
- if (*r==ACD_WORD_CHAR && StrICmp(st,r+1)>0)
- r+=StrLen(r)+3;
- }
- if (*r==ACD_WORD_CHAR)
- return r;
- else
- return acd.word_lst;
-}
-
-U0 ACDFillin(I64 n)
-{
- U8 *s;
- I64 len;
- if (0<=n<acd.num_fillins) {
- s=acd.fillins[n]+1;
- len=StrLen(s);
- if (len>ac.partial_len)
- In(s+ac.partial_len);
- }
-}
-
-public U0 ACDDefsPut(CDoc *doc=NULL,U8 *st,I64 num=-1)
-{//Put to doc a dictionary definition(s) of a word.
- U8 *st2,*st3;
- I64 ch,i=0;
- if (!st) return;
- if (*st==ACD_WORD_CHAR)
- st++;
- DocPrint(doc,"$WW,1$$RED$%s:$FG$\n\n",st);
- if (num<0) {
- if (st3=ACDDefsGet(st)) {
- st2=st3;
- while (ch=*st2++) {
- switch (ch) {
- case ACD_WORD_CHAR:
- break;
- case ACD_DEF_CHAR:
- DocPrint(doc,"$GREEN$(%d)$FG$ %s\n",
- ++i,st2);
- break;
- case ACD_PRONUNCIATION_CHAR:
- DocPrint(doc,"$LTGREEN$%s$FG$\n",st2);
- break;
- case ACD_POS_CHAR:
- DocPrint(doc,"$BLACK$%s$FG$\n",st2);
- break;
- case ACD_EXTRA_CHAR:
- DocPrint(doc,"$LTBLUE$%s$FG$\n",st2);
- break;
- }
- st2+=StrLen(st2)+1;
- }
- Free(st3);
- }
- } else {
- while (st2=ACDDefGet(st,++i)) {
- if (i==num)
- DocPrint(doc,"$GREEN$(%d)$FG$ %s\n",
- i,st2);
- Free(st2);
- }
- }
-}
-
-U0 ACDPopUpDef(U8 *st,I64 num=-1,CTask *parent=NULL)
-{
- U8 *buf;
- buf=MStrPrint("ACDDefsPut(DocPut,\"%s\",%d);View;",st,num);
- PopUp(buf,parent);
- Free(buf);
-}
-
-U0 ACDDef(I64 n,CTask *parent=NULL)
-{
- if (0<=n<acd.num_fillins)
- ACDPopUpDef(acd.fillins[n],-1,parent);
-}
-
-#help_index "AutoComplete"
-U0 ACFillIn(I64 n)
-{
- U8 *s;
- if (0<=--n<ac.num_fillins) {
- s=ac.fillin_matches[n]->str;
- if (StrLen(s)>ac.partial_len)
- In(s+ac.partial_len);
- }
-}
-
-U0 ACMan(I64 n,CTask *parent_task=NULL)
-{
- CHashAC *tmpw;
- CHashSrcSym *tmph;
- if (0<=--n<ac.num_fillins && (tmpw=ac.fillin_matches[n]) &&
- (tmph=HashFind(tmpw->str,Fs->hash_table,HTG_SRC_SYM)) &&
- tmph->src_link)
- PopUpEd(tmph->src_link,parent_task);
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/AutoComplete/ACInit.HC.HTML b/public/src/Adam/AutoComplete/ACInit.HC.HTML deleted file mode 100644 index 0a9b12e..0000000 --- a/public/src/Adam/AutoComplete/ACInit.HC.HTML +++ /dev/null @@ -1,181 +0,0 @@ - - - - - ACInit.HC - - - - - #help_index "AutoComplete/Dictionary"
-acd.has_words=FileFind(ACD_WORD_FILENAME);
-acd.has_defs =FileFind(ACD_DEF_FILENAME)||FileFind(ACD_DEF_FILENAME_Z);
-
-public U0 ACDWordsLoad()
-{//Put words from word list into hash table.
- I64 size;
- CHashGeneric *tmph;
- U8 *in_ptr,*in_start,*st2;
- U16 *d;
- acd.num_words=0;
- if (in_ptr=FileRead(ACD_WORD_FILENAME,&size)) {
- in_start=in_ptr;
- Free(acd.word_lst);
- acd.word_lst=AMAlloc(size);
- MemCpy(acd.word_lst,in_start,size);
- acd.word_lst_size=size;
-
- while (in_ptr<in_start+size) {
- if (*in_ptr==ACD_WORD_CHAR)
- in_ptr++;
- if (*in_ptr) {
- st2=MStrUtil(in_ptr,SUF_TO_UPPER);
- tmph=ACAlloc(sizeof(CHashGeneric)+StrLen(st2)+1);
- StrCpy(tmph+1,st2);
- Free(st2);
- in_ptr+=StrLen(in_ptr)+1;
- tmph->str=tmph+1;
- tmph->use_cnt=1;
- tmph->type=HTT_DICT_WORD;
- d=in_ptr;
- tmph->user_data0=*d;
- in_ptr+=2;
- HashAdd(tmph,ac.hash_table);
- acd.num_words++;
- } else
- in_ptr+=3;
- }
- Free(in_start);
- }
-}
-
-#help_index "AutoComplete"
-CHashAC *ACHashAdd(U8 *w)
-{
- CHashAC *tmpw=HashFind(w,ac.hash_table,HTT_WORD);
- if (tmpw) {
- tmpw->hits++;
- return tmpw;
- }
- tmpw=ACAlloc(sizeof(CHashAC));
- tmpw->str=AStrNew(w);
- tmpw->type=HTT_WORD;
- tmpw->use_cnt=1;
- tmpw->hits=1;
- HashAdd(tmpw,ac.hash_table);
- ac.num_words++;
- return tmpw;
-}
-
-U0 ACSingleFileAdd(U8 *buf)
-{
- I64 ch;
- U8 *ptr=buf,*ptr2,*ptr3;
- while (TRUE) {
- while (TRUE) {
- if (ch=*ptr++) {
- if (Bt(char_bmp_alpha_numeric,ch))
- break;
- } else
- return;
- }
- ptr3=ptr;
- ptr2=ptr;
- ptr--;
- while (TRUE) {
- if (ch=*ptr2++) {
- if (Bt(char_bmp_alpha_numeric,ch))
- *ptr3++=ch;
- else if (ch!=CH_CURSOR)
- break;
- } else {
- ptr2--;
- break;
- }
- }
- *ptr3=0;
- ACHashAdd(ptr);
- ptr=ptr2;
- }
-}
-
-U0 ACMainFileLstTraverse(U8 *files_find_mask)
-{
- U8 *buf;
- CDirEntry *tmpde,*tmpde1;
- try {
- tmpde=tmpde1=FilesFind(files_find_mask,
- FUF_RECURSE|FUF_JUST_TXT|FUF_JUST_FILES|FUF_CLUS_ORDER);
- while (tmpde) {
- "%s\n",tmpde->full_name;
- buf=FileRead(tmpde->full_name);
- ACSingleFileAdd(buf);
- Free(buf);
- tmpde=tmpde->next;
- }
- } catch
- Fs->catch_except=TRUE;
- DirTreeDel(tmpde1);
-}
-
-U0 ACProgressTask(Bool *_start_flag)
-{
- I64 start=blkdev.write_cnt;
- progress1=0;
- progress1_max=(Size(ACD_DEF_FILENAME_Z,"+x+s")+BLK_SIZE-1)>>BLK_SIZE_BITS;
- StrCpy(progress1_desc,"Uncompressing Dictionary");
- start=blkdev.write_cnt;
- *_start_flag=TRUE;
- while (progress1<progress1_max) {
- progress1=blkdev.write_cnt-start;
- Sleep(10);
- }
- *progress1_desc=progress1=progress1_max=0;
-}
-
-public U0 ACInit(U8 *mask=NULL)
-{//Read files and build AutoComplete statistics.
- Bool start_flag;
- CBlkDev *bd=Let2BlkDev;
-
- LBtr(&sys_run_level,RLf_AUTO_COMPLETE);
- AutoComplete;
- while (LBts(&ac.flags,ACf_INIT_IN_PROGRESS))
- Yield;
- if (DrvIsWritable && FileFind(ACD_DEF_FILENAME_Z) &&
- !FileFind(ACD_DEF_FILENAME)) {
- if (bd->type!=BDT_RAM) {
- start_flag=FALSE;
- Spawn(&ACProgressTask,&start_flag);
- while (!start_flag)
- Yield;
- }
- Move(ACD_DEF_FILENAME_Z,ACD_DEF_FILENAME);
- }
-
- HashTableDel(ac.hash_table);
- ac.hash_table=HashTableNew(2048,adam_task);
-
- ac.num_words=0;
- Free(ac.cur_word);
- ac.cur_word=NULL;
-
- if (mask)
- ACMainFileLstTraverse(mask);
-
- ACDWordsLoad;
- LBtr(&ac.flags,ACf_INIT_IN_PROGRESS);
- LBts(&sys_run_level,RLf_AUTO_COMPLETE);
- AutoComplete(ON);
-}
-
-I64 AutoCompleteSize()
-{
- if (ac.hash_table)
- return HashTableSize2(ac.hash_table)+MSize2(acd.word_lst);
- else
- return 0;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/AutoComplete/ACTask.HC.HTML b/public/src/Adam/AutoComplete/ACTask.HC.HTML deleted file mode 100644 index 1e008a3..0000000 --- a/public/src/Adam/AutoComplete/ACTask.HC.HTML +++ /dev/null @@ -1,295 +0,0 @@ - - - - - ACTask.HC - - - - - #help_index "AutoComplete/Dictionary"
-U0 ACDDictWordsAdd(U8 *st)
-{
- I64 i;
- U8 *ptr;
- if (st && *st && (ptr=ACDWordPtAt(st))) {
- for (i=0;i<ACD_FILLINS_NUM;i++) {
- if (*ptr++!=ACD_WORD_CHAR)
- break;
- if (i) '\n';
- acd.fillins[i]=ptr-1;
- "$GREEN$'%d'$FG$ %-23ts",i,ptr;
- ptr+=StrLen(ptr)+3;
- }
- acd.num_fillins=i;
- }
-}
-
-#help_index "AutoComplete"
-U0 ACDocRst(I64 left,I64 top)
-{
- CDoc *doc=DocPut;
- DocRst(doc,TRUE);
- doc->flags|=DOCF_SIZE_MIN;
- Fs->border_src=BDS_CONST;
- Fs->border_attr=LTGRAY<<4+DrvTextAttrGet(':')&15;
- Fs->text_attr =LTGRAY<<4+BLUE;
- LBtr(&Fs->display_flags,DISPLAYf_SHOW);
- WinHorz(left,Fs->win_right);
- WinVert(top,Fs->win_bottom);
- DocCursor;
-}
-
-I64 ACSkipCrap(U8 *src,I64 len)
-{
- I64 j;
- j=len-1;
- while (j>=0) {
- if (Bt(char_bmp_alpha_numeric,src[j]))
- break;
- else
- j--;
- }
- return j+1;
-}
-
-I64 ACPriorWordInStr(U8 *src,U8 *dst,I64 len,I64 buf_size)
-{
- I64 i,j=0,k;
- i=len-1;
- while (i>=0)
- if (!Bt(char_bmp_alpha_numeric,src[i]))
- break;
- else
- i--;
- if (i>=-1 && len>0)
- for (k=i+1;k<len && j<buf_size-1;k++)
- dst[j++]=src[k];
- dst[j]=0;
- return i+1;
-}
-
-U0 ACFillInAdd(CHashAC *tmpw)
-{
- I64 k;
- if (ac.num_fillins<AC_FILLINS_NUM ||
- tmpw->hits>ac.fillin_hits[ac.num_fillins-1]) {
- for (k=ac.num_fillins-1;k>=0;k--) {
- if (tmpw->hits<=ac.fillin_hits[k])
- break;
- else {
- ac.fillin_matches[k+1]=ac.fillin_matches[k];
- ac.fillin_hits[k+1] =ac.fillin_hits[k];
- }
- }
- ac.fillin_matches[k+1]=tmpw;
- ac.fillin_hits[k+1] =tmpw->hits;
- if (ac.num_fillins<AC_FILLINS_NUM)
- ac.num_fillins++;
- }
-}
-
-U0 ACPutChoices(CDoc *focus_l,CDocEntry *doc_e,CTask *focus_task,
- Bool force_refresh)
-{
- I64 i,data_col;
- U8 *buf,*buf1,*src=NULL,*st;
- CHashAC *tmpw;
- F64 timeout_time=tS+0.5;
- CHashSrcSym *tmph;
-
- src=DocScanLine(focus_l,doc_e,&data_col);
- DocUnlock(focus_l);
- i=StrLen(src);
- buf =MAlloc(MaxI64(i+1,256));
- buf1=MAlloc(MaxI64(i+1,256));
- if (data_col==-1)
- data_col=0;
- data_col=ACPriorWordInStr(src,buf,data_col,256);
- ac.partial_len=StrLen(buf);
- data_col=ACSkipCrap(src,data_col);
- data_col=ACPriorWordInStr(src,buf1,data_col,256);
-
- if (!ac.cur_word || StrCmp(ac.cur_word,buf) || force_refresh) {
- st=ac.cur_word;
- ac.cur_word=AStrNew(buf);
- Free(st);
- ac.num_fillins=0;
- if (*ac.cur_word)
- for (i=0;i<=ac.hash_table->mask && tS<timeout_time;i++) {
- tmpw=ac.hash_table->body[i];
- while (tmpw) {
- if (!MemCmp(ac.cur_word,tmpw->str,StrLen(ac.cur_word)))
- ACFillInAdd(tmpw);
- tmpw=tmpw->next;
- }
- }
- ACDocRst(51,13);
- if (ac.cur_word && *ac.cur_word) {
- "$PURPLE$Word:%s$FG$\n",ac.cur_word;
- for (i=0;i<ac.num_fillins;i++) {
- st=ac.fillin_matches[i]->str;
- "$GREEN$F%02d$FG$ ",i+1;
- if (TaskValidate(focus_task) &&
- (tmph=HashFind(st,focus_task->hash_table,HTG_SRC_SYM)) &&
- tmph->src_link) {
- if (tmph->type&HTF_PUBLIC)
- "$RED$";
- "$TX+UL+L+PU,\"%$Q\",A=\"%s\"$$FG$\n",st,tmph->src_link;
- } else
- "%s\n",st;
- }
- if (acd.has_words)
- ACDDictWordsAdd(ac.cur_word);
- } else if (FileFind("::/Doc/StandBy.DD.Z"))
- Type("::/Doc/StandBy.DD.Z",0);
- }
- Free(src);
- Free(buf);
- Free(buf1);
-}
-
-U0 ACTaskNormal(I64 sc,I64 last_sc,
- CTask *focus_task,CTask *original_focus_task)
-{
- CDoc *doc;
- CDocEntry *doc_e;
- if ((doc=DocPut(focus_task)) &&
- focus_task!=Fs && Bt(&focus_task->display_flags,DISPLAYf_SHOW)) {
- DocLock(doc);
- if (TaskValidate(focus_task) && original_focus_task==sys_focus_task &&
- doc && doc==DocPut(focus_task) && (doc_e=doc->cur_entry)) {
- if (doc_e==doc) doc_e=doc_e->last;
- while (doc_e->last!=doc && (doc_e->type_u8==DOCT_NEW_LINE ||
- doc_e->type_u8==DOCT_SOFT_NEW_LINE))
- doc_e=doc_e->last;
- while (doc_e->last->type_u8!=DOCT_NEW_LINE && doc_e->last!=doc)
- doc_e=doc_e->last;
- ACPutChoices(doc,doc_e,focus_task,ToBool(sc!=last_sc));
- } else
- DocUnlock(doc);
- }
- if (!LBts(&Fs->display_flags,DISPLAYf_SHOW))
- WinZBufUpdate;
-}
-
-U0 ACTaskCtrl(I64 sc,I64 last_sc,
- CTask *focus_task,CTask *original_focus_task)
-{
- if (TaskValidate(focus_task) &&
- (focus_task->scroll_x || focus_task->scroll_y)) {
- if (LBtr(&Fs->display_flags,DISPLAYf_SHOW))
- WinZBufUpdate;
- } else {
- if (sc!=last_sc) {
- if (sc&SCF_ALT) {
- ACDocRst(27,3);
- if (TaskValidate(original_focus_task) &&
- !Bt(&original_focus_task->win_inhibit,WIf_SELF_KEY_DESC))
- KeyMapFamily(original_focus_task,0,
- ToBool(!(sc&SCF_SHIFT)),ToBool(sc&SCF_SHIFT));
- KeyMapCtrlAltFamily(
- ToBool(!(sc&SCF_SHIFT)),ToBool(sc&SCF_SHIFT));
- } else if (TaskValidate(original_focus_task) &&
- !Bt(&original_focus_task->win_inhibit,WIf_SELF_KEY_DESC)) {
- ACDocRst(27,3);
- KeyMapFamily(original_focus_task,SCF_CTRL,
- ToBool(!(sc&SCF_SHIFT)),ToBool(sc&SCF_SHIFT));
- }
- }
- if (!LBts(&Fs->display_flags,DISPLAYf_SHOW))
- WinZBufUpdate;
- }
-}
-
-U0 ACTaskAlt(I64 sc,I64 last_sc,
- CTask *,CTask *original_focus_task)
-{
- if (sc!=last_sc && TaskValidate(original_focus_task) &&
- !Bt(&original_focus_task->win_inhibit,WIf_SELF_KEY_DESC)) {
- ACDocRst(27,3);
- KeyMapFamily(original_focus_task,SCF_ALT,
- ToBool(!(sc&SCF_SHIFT)),ToBool(sc&SCF_SHIFT));
- }
- if (!LBts(&Fs->display_flags,DISPLAYf_SHOW))
- WinZBufUpdate;
-}
-
-U0 ACTaskEndCB()
-{
- ac.task=NULL;
- Exit;
-}
-
-U0 ACTask(I64)
-{
- CTask *focus_task,*original_focus_task;
- I64 ch,scan_code=0,last_scan_code=0;
- CDoc *doc;
- Fs->task_end_cb=&ACTaskEndCB;
- DocTermNew;
- LBts(&Fs->display_flags,DISPLAYf_SHOW);
- WinHorz(51,Fs->win_right);
- LBts(&Fs->display_flags,DISPLAYf_WIN_ON_TOP);
- Fs->win_inhibit=WIG_NO_FOCUS_TASK_DFT;
- Free(ac.cur_word);
- ac.cur_word=NULL;
- while (TRUE) {
- if (scan_code&(SCF_CTRL|SCF_ALT) ||
- GetTSC>KbdMsEvtTime+cnts.time_stamp_freq>>1) {
- last_scan_code=scan_code;
- scan_code=kbd.scan_code;
- }
- original_focus_task=focus_task=sys_focus_task;
- while (TaskValidate(focus_task) &&
- Bt(&focus_task->task_flags,TASKf_INPUT_FILTER_TASK))
- focus_task=focus_task->parent_task;
- if (scan_code&SCF_CTRL)
- ACTaskCtrl(scan_code,last_scan_code,focus_task,original_focus_task);
- else if (TaskValidate(focus_task)) {
- if (scan_code&SCF_ALT)
- ACTaskAlt(scan_code,last_scan_code,focus_task,original_focus_task);
- else
- ACTaskNormal(scan_code,last_scan_code,focus_task,original_focus_task);
- }
- Sleep(333);
- if (ScanMsg(&ch,,1<<MSG_KEY_DOWN) && (ch==CH_ESC||ch==CH_SHIFT_ESC))
- break;
- doc=DocPut;
- DocLock(doc);
- if (doc->cur_entry->de_flags & DOCEF_LINK) {
- '' CH_SPACE;
- doc->cur_entry=doc;
- }
- DocUnlock(doc);
- }
-}
-
-public Bool AutoComplete(Bool val=OFF)
-{//Turn AutoComplete OFF or ON.
- Bool old_val=FALSE;
- while (Bt(&ac.flags,ACf_INIT_IN_PROGRESS))
- Sleep(10);
- if (val) {
- if (Bt(&sys_run_level,RLf_AUTO_COMPLETE)) {
- if (TaskValidate(ac.task))
- old_val=TRUE;
- else {
- ac.task=Spawn(&ACTask,NULL,"AutoComplete");
- TaskWait(ac.task);
- }
- WinToTop(ac.task);
- }
- } else {
- if (TaskValidate(ac.task)) {
- if (Bt(&sys_run_level,RLf_AUTO_COMPLETE))
- old_val=TRUE;
- Kill(ac.task);
- DeathWait(&ac.task);
- }
- }
- return old_val;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/AutoComplete/MakeAC.HC.HTML b/public/src/Adam/AutoComplete/MakeAC.HC.HTML deleted file mode 100644 index 922d5bb..0000000 --- a/public/src/Adam/AutoComplete/MakeAC.HC.HTML +++ /dev/null @@ -1,18 +0,0 @@ - - - - - MakeAC.HC - - - - - //See /Doc/AutoComplete.DD
-Cd(__DIR__);;
-#include "ACFill"
-#include "ACTask"
-#include "ACInit"
-Cd("..");;
- - - \ No newline at end of file diff --git a/public/src/Adam/CPURep.HC.HTML b/public/src/Adam/CPURep.HC.HTML deleted file mode 100644 index 4a6d4f0..0000000 --- a/public/src/Adam/CPURep.HC.HTML +++ /dev/null @@ -1,84 +0,0 @@ - - - - - CPURep.HC - - - - - #help_index "Info;Time/CPU Cycles;Processor"
-class CCPURep
-{
- Bool mp_start,mp_end;
- I64 mp_not_done_flags,
- **swaps,
- **cycles;
-};
-
-U0 MPCPURep(CCPURep *cr)
-{
- I64 swaps=0,cycles_0,cycles_f;
- while (!cr->mp_start)
- Yield;
- cycles_0=GetTSC;
- while (!cr->mp_end) {
- swaps++;
- Yield;
- }
- cycles_f=GetTSC;
- cr->swaps[Gs->num]=swaps;
- cr->cycles[Gs->num]=cycles_f-cycles_0;
- LBtr(&cr->mp_not_done_flags,Gs->num);
-}
-
-public U0 CPURep(Bool full=FALSE)
-{//Report number of cores and clock freq.
- I64 i,total_swaps,total_cycles;
- F64 t0,tf;
- CCPURep cr;
-
- if (!full)
- "%03X Cores %6h?nHz\n",mp_cnt,ToF64(cnts.time_stamp_freq);
- else {
- cr.swaps=CAlloc(sizeof(I64)*mp_cnt);
- cr.cycles=CAlloc(sizeof(I64)*mp_cnt);
- cr.mp_start=cr.mp_end=FALSE;
- cr.mp_not_done_flags=1<<mp_cnt-1;
- for (i=0;i<mp_cnt;i++)
- Spawn(&MPCPURep,&cr,NULL,i);
-
- t0=tS;
- cr.mp_start=TRUE;
- Sleep(2000);
- cr.mp_end=TRUE;
- while (cr.mp_not_done_flags)
- Yield;
- tf=tS;
-
- "\n%03X Cores %6h?nHz\n",mp_cnt,ToF64(cnts.time_stamp_freq);
- "\nContext\n"
- "CPUSwaps/sCycles\n"
- "---------------------------------\n";
- total_swaps=0;
- total_cycles=0;
- for (i=0;i<mp_cnt;i++) {
- "%02X%13,d%17,d\n",i,
- ToI64(cr.swaps[i]/(tf-t0)),ToI64(cr.cycles[i]/(tf-t0));
- total_swaps+=cr.swaps[i];
- total_cycles+=cr.cycles[i];
- }
- "---------------------------------\n";
- "%03X%13,d%17,d\n",i,
- ToI64(total_swaps/(tf-t0)),ToI64(total_cycles/(tf-t0));
- "Avg%13,d%17,d\n\n",
- ToI64(total_swaps/(tf-t0)/i),ToI64(total_cycles/(tf-t0)/i);
- "Avg Cycles/Swap: %12.6f\n",ToF64(total_cycles)/total_swaps;
- "Avg Time/Swap: %12.6fns\n\n",(tf-t0)*1000000000.0*i/total_swaps;
- Free(cr.swaps);
- Free(cr.cycles);
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Ctrls/CtrlsA.HC.HTML b/public/src/Adam/Ctrls/CtrlsA.HC.HTML deleted file mode 100644 index fc07d08..0000000 --- a/public/src/Adam/Ctrls/CtrlsA.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - CtrlsA.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Adam/Ctrls/CtrlsBttn.HC.HTML b/public/src/Adam/Ctrls/CtrlsBttn.HC.HTML deleted file mode 100644 index 1e7d458..0000000 --- a/public/src/Adam/Ctrls/CtrlsBttn.HC.HTML +++ /dev/null @@ -1,103 +0,0 @@ - - - - - CtrlsBttn.HC - - - - - #define BTTN_BORDER 2
-
-#define BTF_DONT_FREE 1
-
-class CCtrlBttnState
-{
- I64 state,num_states,flags;
- U8 *state_texts;
- CColorROPU32 *state_colors;
-};
-
-U0 DrawCtrlBttn(CDC *dc,CCtrl *c)
-{
- CCtrlBttnState *s=c->state;
- I64 l;
- U8 *st;
-
- dc->color=BLACK;
- GrRect(dc,c->left,c->top,c->right-c->left+1,c->bottom-c->top+1);
- if (!(st=LstSub(s->state,s->state_texts)))
- st=s->state_texts;
- dc->color=s->state_colors[s->state];
- l=StrLen(st);
- GrRect(dc,c->left+BTTN_BORDER,c->top+BTTN_BORDER,
- c->right-c->left+1-BTTN_BORDER*2,
- c->bottom-c->top+1-BTTN_BORDER*2);
- dc->color=s->state_colors[s->state]^(WHITE<<16+WHITE);
- GrPrint(dc,(c->left+c->right+1-l*FONT_WIDTH)>>1,
- (c->top+c->bottom+1-FONT_HEIGHT)>>1,"%s",st);
-}
-
-U0 LeftClickCtrlBttn(CCtrl *c,I64,I64,Bool down)
-{
- CCtrlBttnState *s=c->state;
- if (down) {
- s->state++;
- if (s->state==s->num_states)
- s->state=0;
- }
-}
-
-public CCtrl *CtrlBttnNew(I64 x,I64 y,I64 width=-1,I64 height=-1,
- I64 num_states=1,U8 *state_texts,
- I32 *state_colors,CCtrlBttnState *_s=NULL)
-{//Create bttn ctrl. See /Apps/Strut/Strut.HC.
- CCtrl *res;
- CCtrlBttnState *s;
- I64 i,j,l;
- U8 *st;
- if (width<0) {
- l=1;
- for (i=0;i<num_states;i++)
- if (st=LstSub(i,state_texts)) {
- j=StrLen(st);
- if (j>l) l=j;
- }
- width=BTTN_BORDER*4+l*FONT_WIDTH;
- }
- if (height<0) height=BTTN_BORDER*4+FONT_HEIGHT;
- res=CAlloc(sizeof(CCtrl));
- if (_s) {
- s=_s;
- MemSet(s,0,sizeof(CCtrlBttnState));
- } else {
- s=CAlloc(sizeof(CCtrlBttnState));
- s->flags=BTF_DONT_FREE;
- }
- s->num_states=num_states;
- s->state_texts=state_texts;
- s->state_colors=state_colors;
- res->win_task=Fs;
- res->flags=CTRLF_SHOW;
- res->type=CTRLT_GENERIC;
- res->state=s;
- res->draw_it=&DrawCtrlBttn;
- res->left_click=&LeftClickCtrlBttn;
- res->left=x;
- res->top=y;
- res->right=res->left+width-1;
- res->bottom=res->top+height-1;
- QueIns(res,Fs->last_ctrl);
- return res;
-}
-
-public U0 CtrlBttnDel(CCtrl *c)
-{//Free bttn ctrl.
- QueRem(c);
- if (!(c->flags&BTF_DONT_FREE))
- Free(c->state);
- Free(c);
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Ctrls/CtrlsSlider.HC.HTML b/public/src/Adam/Ctrls/CtrlsSlider.HC.HTML deleted file mode 100644 index e66a32e..0000000 --- a/public/src/Adam/Ctrls/CtrlsSlider.HC.HTML +++ /dev/null @@ -1,226 +0,0 @@ - - - - - CtrlsSlider.HC - - - - - class CTemplateCSSlider
-{
- CTemplateCSSlider *next,*last;
- U8 *name;
- I64 num;
-};
-
-class CTemplateCS
-{
- CTemplateCSSlider *next_slider,*last_slider;
- I64 num_sliders,range,spacing,border;
- U8 *glbl_name;
-};
-
-CTemplateCS *CtrlSliderGet()
-{
- CTemplateCSSlider *tmps;
- U8 *st,pmt[STR_LEN];
- CTemplateCS *res=CAlloc(sizeof(CTemplateCS));
-
- "$PURPLE$Ctrl Slider$FG$\n\n";
-
- res->glbl_name=GetStr("Glbl Struct Name (ENTER for No Glbl):");
- res->range=GetI64 ("Range (%4d):",30);
- res->spacing=GetI64("Spacing (%4d):",20);
- res->border=GetI64 ("Border (%4d):",2);
-
- res->next_slider=res->last_slider=&res->next_slider;
- while (TRUE) {
- StrPrint(pmt,"Slider #%d Name:",res->num_sliders+1);
- st=GetStr(pmt);
- if (!*st) {
- Free(st);
- break;
- }
- tmps=CAlloc(sizeof(CTemplateCSSlider));
- tmps->name=st;
- QueIns(tmps,res->last_slider);
- tmps->num=res->num_sliders++;
- }
- return res;
-}
-
-U0 TemplateCtrlSlider(CDoc *doc)
-{
- CTask *task;
- CTemplateCS *m=NULL;
- CTemplateCSSlider *tmps;
- I64 i;
-
- DocUnlock(doc);
- DocRecalc(doc);
- DocCaptureUndo(doc,TRUE);
-
- task=User("CTemplateCS **_m=0x%X;*_m=CtrlSliderGet;\n",&m);
- while (!m)
- Yield;
-
- DocPrint(doc,
-"#define SLIDER_RANGE\t%d
-#define SLIDER_SPACING\t%d
-#define SLIDER_BORDER\t%d
-
-class CSliderState
-{
-",m->range,m->spacing,m->border);
-
- tmps=m->next_slider;
- while (tmps!=&m->next_slider) {
- DocPrint(doc,"I64 %s;\n",tmps->name);
- tmps=tmps->next;
- }
- if (*m->glbl_name)
- DocPrint(doc,"} %s;\n",m->glbl_name);
- else
- DocPrint(doc,"};\n");
-
- DocPrint(doc,
-"
-U0 DrawCtrlSlider(CDC *dc,CCtrl *c)
-{
-CSliderState *s=c->state;
-
-dc->color=LTRED;
-GrRect(dc, c->left,c->top,%d*SLIDER_SPACING+%d,SLIDER_SPACING*2+SLIDER_RANGE);
-dc->color=BLUE;
-GrRect(dc, c->left+SLIDER_BORDER,c->top+SLIDER_BORDER,
-%d*SLIDER_SPACING+%d-2*SLIDER_BORDER,SLIDER_SPACING*2
-+SLIDER_RANGE-2*SLIDER_BORDER);
-dc->color=BLACK;
-",m->num_sliders+1,m->num_sliders,m->num_sliders+1,m->num_sliders);
-
- for (i=0;i<m->num_sliders;i++)
- DocPrint(doc,
-"GrLine(dc,c->left+%d*SLIDER_SPACING+%d,c->top+SLIDER_SPACING,
-c->left+%d*SLIDER_SPACING+%d,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
-",i+1,i,i+1,i);
-
- DocPrint(doc,"dc->color=LTRED;\n");
-
- tmps=m->next_slider;
- while (tmps!=&m->next_slider) {
- DocPrint(doc,
-"GrPrint(dc,c->left+%d*SLIDER_SPACING+%d-FONT_WIDTH/2,
-c->top+SLIDER_SPACING+SLIDER_RANGE+3,
-\"%%d\",s->%s*10/SLIDER_RANGE);\n",
- tmps->num+1,tmps->num,tmps->name);
- tmps=tmps->next;
- }
-
- tmps=m->next_slider;
- while (tmps!=&m->next_slider) {
- DocPrint(doc,
- "GrRect(dc,c->left+%d*SLIDER_SPACING+%d-3,"
- "c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->%s-2,7,5);\n",
- tmps->num+1,tmps->num,tmps->name);
- tmps=tmps->next;
- }
- DocPrint(doc,"dc->color=YELLOW;\n");
-
- tmps=m->next_slider;
- while (tmps!=&m->next_slider) {
- DocPrint(doc,"GrRect(dc,c->left+%d*SLIDER_SPACING+%d-2,"
- "c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->%s-1,5,3);\n",
- tmps->num+1,tmps->num,tmps->name);
- tmps=tmps->next;
- }
- DocPrint(doc,
-"}
-
-U0 UpdateDerivedCtrlSlider(CCtrl *c)
-{
- CSliderState *s=c->state;
- c->left=c->win_task->pix_width/2-(SLIDER_SPACING*3+2)/2;
- c->right=c->left+%d*SLIDER_SPACING+%d;
- c->top=c->win_task->pix_height/2-(SLIDER_SPACING*2+SLIDER_RANGE)/2;
- c->bottom=c->top+SLIDER_SPACING*2+SLIDER_RANGE;
-",m->num_sliders+1,m->num_sliders);
-
- tmps=m->next_slider;
- while (tmps!=&m->next_slider) {
- DocPrint(doc,"s->%s=ClampI64(s->%s,0,SLIDER_RANGE-1);\n",
- tmps->name,tmps->name);
- tmps=tmps->next;
- }
- DocPrint(doc,
-"}
-
-U0 LeftClickSlider(CCtrl *c,I64 x,I64 y,Bool down)
-{
-no_warn down;
-CSliderState *s=c->state;
-");
-
- tmps=m->next_slider;
- while (tmps!=&m->next_slider) {
- DocPrint(doc,"");
- if (tmps!=m->next_slider)
- DocPrint(doc,"else");
- if (tmps->next==&m->next_slider)
- DocPrint(doc,"\n");
- else
- DocPrint(doc,"if (x<c->left+%d*SLIDER_SPACING+%d+SLIDER_SPACING/2)\n",
- tmps->num+1,tmps->num);
- DocPrint(doc,"s->%s=SLIDER_RANGE-1-(y-(c->top+SLIDER_SPACING));\n",
- tmps->name);
- tmps=tmps->next;
- }
-
- DocPrint(doc,
-"if (c->update_derived_vals)
-(*c->update_derived_vals)(c);
-}
-
-CCtrl *SliderNew()
-{
-CCtrl *c=CAlloc(sizeof(CCtrl));
-c->win_task=Fs;
-c->flags=CTRLF_SHOW|CTRLF_CAPTURE_LEFT_MS;
-c->type=CTRLT_GENERIC;
-");
- if (*m->glbl_name)
- DocPrint(doc,"c->state=&%s;\n"
- "MemSet(&%s,0,sizeof(CSliderState));\n",m->glbl_name,m->glbl_name);
- else
- DocPrint(doc, "c->state=CAlloc(sizeof(CSliderState));\n");
- DocPrint(doc,
-"c->draw_it=&DrawCtrlSlider;
-c->left_click=&LeftClickSlider;
-c->update_derived_vals=&UpdateDerivedCtrlSlider;
-QueIns(c,Fs->last_ctrl);
-TaskDerivedValsUpdate;
-return c;
-}
-
-U0 SliderDel(CCtrl *c)
-{
-QueRem(c);
-");
- if (!*m->glbl_name)
- DocPrint(doc,"Free(c->state);\n");
- DocPrint(doc,
-"Free(c);
-}
-");
-
- Kill(task); //This frees memory.
-
- RegOneTimePopUp(ARf_MANAGE_SLIDER,
- "Modify the code to your heart's content.\n"
- "The code is no longer managed.\n");
-
- DocLock(doc);
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Ctrls/MakeCtrls.HC.HTML b/public/src/Adam/Ctrls/MakeCtrls.HC.HTML deleted file mode 100644 index af4fef0..0000000 --- a/public/src/Adam/Ctrls/MakeCtrls.HC.HTML +++ /dev/null @@ -1,20 +0,0 @@ - - - - - MakeCtrls.HC - - - - - Cd(__DIR__);;
-
-#help_index "Ctrls"
-#help_file "::/Doc/Ctrls"
-#include "CtrlsA"
-#include "CtrlsBttn"
-#include "CtrlsSlider"
-Cd("..");;
- - - \ No newline at end of file diff --git a/public/src/Adam/DevInfo.HC.HTML b/public/src/Adam/DevInfo.HC.HTML deleted file mode 100644 index 5c9e3e3..0000000 --- a/public/src/Adam/DevInfo.HC.HTML +++ /dev/null @@ -1,232 +0,0 @@ - - - - - DevInfo.HC - - - - - #help_index "PCI;Processor;Devices;Info"
-
-//The file was downloaded from
-//http://www.pcidatabase.com/reports.php?type=tab-delimeted
-
-#define PCI_DEV_FILE "::/Misc/PCIDevices.DD.Z"
-
-/****
-//1) Download http://www.pcidatabase.com/reports.php?type=tab-delimeted
-//2) Rename to ::/Misc/PCIDevices.DD.Z
-//3) ToDolDoc("::/Misc/PCIDevices.DD.Z");
-//4) Edit and remove file header and tail
-//5) Text find-and-replace "=0A=" with "". (Doesn't seem necessary anmore.)
-//6) Run PCIDevFileGen(). (Doesn't seem necessary anmore.)
-
-public U0 PCIDevFileGen()
-{
- Bool first=TRUE,del=FALSE,del2=FALSE,cont=FALSE;
- CDoc *doc=DocRead(PCI_DEV_FILE,
- DOCF_PLAIN_TEXT|DOCF_DBL_DOLLARS|DOCF_NO_CURSOR);
- CDocEntry *doc_e=doc->head.next,*doc_e2;
- while (doc_e!=doc) {
- doc_e2=doc_e->next;
- if (first) {
- if (doc_e->type_u8==DOCT_TEXT) {
- if (doc_e->tag[0]==';')
- del=TRUE;
- }
- first=FALSE;
- }
- if (doc_e->type_u8==DOCT_TEXT && doc_e->tag[StrLen(doc_e->tag)-1]=='=' &&
- doc_e2->type_u8==DOCT_NEW_LINE) {
- doc_e->tag[StrLen(doc_e->tag)-1]=CH_SPACE;
- cont=TRUE;
- }
- del2=del;
- if (doc_e->type_u8==DOCT_NEW_LINE) {
- first=TRUE;
- del2=FALSE;
- if (cont) {
- del=TRUE;
- cont=FALSE;
- }
- }
- if (del)
- DocEntryDel(doc,doc_e);
- del=del2;
- doc_e=doc_e2;
- }
- DocWrite(doc);
-}
-****/
-
-///Misc/PCIDevices.DD",A="PI:::/Misc/PCIDevices.DD
-U0 PCILookUpSingle(CDoc *doc,I64 m,I64 d,U8 **_vendor,U8 **_dev)
-{
- Bool first=TRUE;
- U8 buf[8],*vendor=NULL,*dev=NULL;
- CDocEntry *doc_e=doc->head.next;
- while (doc_e!=doc) {
- if (first) {
- if (doc_e->type_u8==DOCT_TEXT && doc_e->tag[0]!=';' &&
- StrLen(doc_e->tag)>=4) {
- buf[0](U16)='0x';
- buf[2](U32)=doc_e->tag(U32 *)[0];
- buf[6]=0;
- if (Str2I64(buf)==m) {
- doc_e=doc_e->next->next;
- if (doc_e->type_u8==DOCT_TEXT) {
- vendor=AStrNew(doc_e->tag);
- first=FALSE;
- break;
- }
- }
- }
- first=FALSE;
- }
- if (doc_e->type_u8==DOCT_NEW_LINE)
- first=TRUE;
- doc_e=doc_e->next;
- }
-
- if (vendor) {
- while (doc_e!=doc) {
- if (first) {
- if (doc_e->type_u8==DOCT_TAB) {
- doc_e=doc_e->next;
- if (doc_e->type_u8==DOCT_TEXT && StrLen(doc_e->tag)>=4) {
- buf[0](U16)='0x';
- buf[2](U32)=doc_e->tag(U32 *)[0];
- buf[6]=0;
- if (Str2I64(buf)==d) {
- doc_e=doc_e->next->next;
- if (doc_e->type_u8==DOCT_TEXT) {
- dev=AStrNew(doc_e->tag);
- break;
- }
- }
- }
- } else
- break;
- first=FALSE;
- }
- if (doc_e->type_u8==DOCT_NEW_LINE)
- first=TRUE;
- doc_e=doc_e->next;
- }
- }
-
- if (vendor)
- *_vendor=vendor;
- else
- *_vendor=AStrNew("Unknown");
-
- if (dev)
- *_dev=dev;
- else
- *_dev=AStrNew("Unknown");
-}
-
-U0 PCILookUpDevs()
-{
- CPCIDev *tmppci;
- I64 w1,w2,b,d,f,timeout=32*8*2;
- CDoc *doc;
- if (dev.pci_head.next!=&dev.pci_head)
- return;
- doc=DocRead(PCI_DEV_FILE,DOCF_PLAIN_TEXT|DOCF_NO_CURSOR);
- for (b=0;b<sys_pci_busses;b++)
- for (d=0;d<32;d++)
- for (f=0;f<8;f++) {
- w1=PCIReadU16(b,d,f,0);
- if (w1!=0xFFFF) {
- tmppci=ACAlloc(sizeof(CPCIDev));
- tmppci->bus=b;
- tmppci->dev=d;
- tmppci->fun=f;
- tmppci->vendor=w1;
- tmppci->dev_id=w2=PCIReadU16(b,d,f,2);
- tmppci->sub_code=PCIReadU8(b,d,f,0xA);
- tmppci->base_code=PCIReadU8(b,d,f,0xB);
- PCILookUpSingle(doc,w1,w2,&tmppci->vendor_str,&tmppci->dev_id_str);
- QueIns(tmppci,dev.pci_head.last);
- timeout=32*8*2;
- } else if (sys_pci_busses==256 && --timeout<=0)
- goto lud_done;
- }
-lud_done:
- DocDel(doc);
-}
-
-public U0 PCIRep()
-{//Report description of PCI devices.
- CPCIDev *tmppci;
- "PCI Busses:%d\n",sys_pci_busses;
- if (!FileFind(PCI_DEV_FILE)) {
- "You don't have the PCI device file.\n";
- return;
- }
- PCILookUpDevs;
- tmppci=dev.pci_head.next;
- while (tmppci!=&dev.pci_head) {
- "%02X:%02X:%01X %02X%02X $GREEN$%s $CYAN$%s$FG$\n",
- tmppci->bus,tmppci->dev,tmppci->fun,
- tmppci->base_code,tmppci->sub_code,
- tmppci->vendor_str,tmppci->dev_id_str;
- tmppci=tmppci->next;
- }
-}
-
-#help_index "Info;Memory/Info"
-public U0 MemBIOSRep()
-{//Report the memory ranges reported by the BIOS at boot.
- U16 *m01=MEM_E801;
- CMemE820 *m20=MEM_E820;
- CMemRange *tmpmr;
- "Standard Addresses\n"
- "000A0000-000BFFFF VGA\n"
- "FEE00000-FEE00FFF See $LK,\"APIC\",A=\"MN:LAPIC_BASE\"$\n\n"
- "32 Bit Device Mem\n";
- while (LBts(&sys_semas[SEMA_DEV_MEM],0))
- Yield;
- tmpmr=dev.mem32_head.next;
- while (tmpmr!=&dev.mem32_head) {
- "%02X:%016X-%016X\n",
- tmpmr->type,tmpmr->base,tmpmr->base+tmpmr->size-1;
- tmpmr=tmpmr->next;
- }
- LBtr(&sys_semas[SEMA_DEV_MEM],0);
-
- "\nBIOS Memory Report 15:E801\n"
- "01:0000000000000000-%016X\n",0x100000+m01[0]<<10-1;
- "01:0000000001000000-%016X\n",SYS_16MEG_AREA_LIMIT+m01[1]<<16-1;
-
- if (m20->type) {
- '\n';
- "BIOS Memory Report 15:E820\n";
- while (m20->type) {
- "%02X:%016X-%016X\n",m20->type,m20->base,m20->base+m20->len-1;
- m20++;
- }
- }
-}
-
-public U0 MemPageRep()
-{//Page Table Report.
- "MAPPED\t:%010Xwith",mem_mapped_space;
- if (Bt(&mem_page_size,30))
- "$RED$1GIG$FG$ pages\n";
- else
- "$RED$2MEG$FG$ pages\n";
- "PML2\t:%010X2MEG:%08X\n",
- *MEM_PML2(U64 *),*MEM_2MEG_NUM(U64 *);
- "PML3\t:%010X1GIG:%08X\n",
- *MEM_PML3(U64 *),*MEM_1GIG_NUM(U64 *);
- "PML4\t:%010X512GIG:%08X\n",
- *MEM_PML4(U64 *),*MEM_512GIG_NUM(U64 *);
- "FIXED_AREA:%010X\n",SYS_FIXED_AREA;
- "HEAP_BASE:%010X\nHEAP_LIMIT:%010X\n",mem_heap_base,mem_heap_limit;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocBin.HC.HTML b/public/src/Adam/DolDoc/DocBin.HC.HTML deleted file mode 100644 index 1d8bea5..0000000 --- a/public/src/Adam/DolDoc/DocBin.HC.HTML +++ /dev/null @@ -1,154 +0,0 @@ - - - - - DocBin.HC - - - - - #help_index "DolDoc/Bin"
-
-CDocBin *DocBinFindNum(CDoc *haystack_doc,I64 needle_num)
-{
- CDocBin *b=haystack_doc->bin_head.next;
- while (b!=&haystack_doc->bin_head) {
- if (b->num==needle_num)
- return b;
- b=b->next;
- }
- return NULL;
-}
-
-CDocBin *DocBinFindTag(CDoc *haystack_doc,U8 *needle_tag)
-{
- CDocBin *b;
- if (needle_tag) {
- b=haystack_doc->bin_head.next;
- while (b!=&haystack_doc->bin_head) {
- if (b->tag && !StrCmp(b->tag,needle_tag))
- return b;
- b=b->next;
- }
- }
- return NULL;
-}
-
-U0 DocBinsValidate(CDoc *doc)
-{
- Bool unlock=DocLock(doc);
- CDocBin *b,*b1;
- CDocEntry *doc_e,*doc_e2;
- I64 renum_num=0;
- b=doc->bin_head.next;
- while (b!=&doc->bin_head) {
- b->use_cnt=0;
- b->tmp_use_cnt=0;
- b->renum_num=-1;
- Free(b->tag);
- b->tag=NULL;
- b=b->next;
- }
- doc_e=doc->head.next;
- while (doc_e!=doc) {
- doc_e2=doc_e->next;
- if (doc_e->de_flags & DOCEF_HAS_BIN) {
- if (b=doc_e->bin_data=DocBinFindNum(doc,doc_e->bin_num)) {
- if (doc_e->de_flags & DOCEF_BIN_PTR_LINK)
- b->tmp_use_cnt=I32_MAX;
- if (!b->use_cnt++)
- b->renum_num=++renum_num;
- doc_e->bin_num=b->renum_num;
- if (!b->tag && doc_e->de_flags&DOCEF_TAG && doc_e->tag && *doc_e->tag)
- b->tag=StrNew(doc_e->tag,doc->mem_task);
- } else {
- RawPrint(3000,"Bin Not Found");
- doc_e->type=doc_e->de_flags=0;
- doc_e->type_u8=DOCT_ERROR;
- }
- }
- doc_e=doc_e2;
- }
-
- b=doc->bin_head.next;
- doc->cur_bin_num=1;
- while (b!=&doc->bin_head) {
- b1=b->next;
- if (!b->use_cnt) {
- QueRem(b);
- Free(b->data);
- Free(b);
- } else {
- b->num=b->renum_num;
- if (b->num>=doc->cur_bin_num)
- doc->cur_bin_num=b->num+1;
- }
- b=b1;
- }
- if (unlock)
- DocUnlock(doc);
-}
-
-U0 DocBinDel(CDoc *doc,CDocBin *b)
-{
- if (doc && b && b->use_cnt) {
- b->use_cnt--;
- if (!b->use_cnt) {
- QueRem(b);
- Free(b->tag);
- Free(b->data);
- Free(b);
- }
- } else
- RawPrint(3000,"DocBinDel");
-}
-
-I64 DocBinPtrRst(CDoc *doc,CDocEntry *doc_e)
-{
- U8 *st,*st2;
- CDoc *doc2;
- CDocBin *tmpb,*tmpb2;
- I64 i,bin_num=0;
- if (doc_e->de_flags&DOCEF_HAS_BIN &&
- doc_e->bin_ptr_link && StrLen(doc_e->bin_ptr_link)) {
- bin_num=doc_e->bin_num;
- st=StrNew(doc_e->bin_ptr_link);
- st2=StrNew(st);
- StrLastRem(st,",",st2);
- i=Str2I64(st2);
- if (i>0||*st2) {
- doc2=DocRead(st);
- if (i>0 && (tmpb2=DocBinFindNum(doc2,i)) ||
- i==0 && (tmpb2=DocBinFindTag(doc2,st2))) {
- i=1;
- if (bin_num>0) {
- if (tmpb=DocBinFindNum(doc,bin_num)) {
- i=tmpb->use_cnt;
- DocBinDel(doc,tmpb);
- }
- } else
- bin_num=doc->cur_bin_num++;
- tmpb=MAllocIdent(tmpb2,doc->mem_task);
- tmpb->use_cnt=i;
- tmpb->data=MAllocIdent(tmpb2->data,doc->mem_task);
- tmpb->num=bin_num;
- doc_e->bin_data=tmpb;
- if (doc_e->de_flags&DOCEF_TAG && doc_e->tag && *doc_e->tag)
- tmpb->tag=StrNew(doc_e->tag,doc->mem_task);
- else
- tmpb->tag=NULL;
- QueIns(tmpb,doc->bin_head.last);
- } else
- bin_num=0;
- DocDel(doc2);
- } else
- bin_num=0;
- Free(st2);
- Free(st);
- doc_e->bin_num=bin_num;
- }
- return bin_num;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocChar.HC.HTML b/public/src/Adam/DolDoc/DocChar.HC.HTML deleted file mode 100644 index 6876d8f..0000000 --- a/public/src/Adam/DolDoc/DocChar.HC.HTML +++ /dev/null @@ -1,664 +0,0 @@ - - - - - DocChar.HC - - - - - #help_index "DolDoc/Editor"
-
-public I64 EdCurU8(CDoc *doc)
-{//Return cur U8. See EdRenumAsm for an example.
- Bool unlock=DocLock(doc);
- CDocEntry *doc_ce=doc->cur_entry;
- I64 res=-1;
- if (doc_ce->type_u8==DOCT_TEXT &&
- doc_ce->min_col<=doc->cur_col<doc_ce->max_col)
- res=doc_ce->tag[doc->cur_col];
- else if (doc_ce->type_u8==DOCT_TAB)
- res='\t';
- else if (doc_ce->type_u8==DOCT_NEW_LINE ||
- doc_ce->type_u8==DOCT_SOFT_NEW_LINE)
- res='\n';
- if (unlock)
- DocUnlock(doc);
- return res;
-}
-
-public U0 EdCursorLeft(CDoc *doc,I64 sc=I64_MIN)
-{//Move cursor left. Might need a call to DocRecalc().
-//See EdRenumAsm for an example.
- U8 *dst;
- Bool unlock=DocLock(doc);
- CDocEntry *doc_ce=doc->cur_entry,*original_ce=doc_ce,*doc_ne;
- I64 cc=doc->cur_col,y=doc_ce->y;
- if (sc!=I64_MIN) sc=sc.u32[0];
- if (sc>=0 && sc&SCF_CTRL) {
- while (doc_ce->last!=doc && (doc_ce->last->y==y ||
- doc_ce->de_flags & (DOCEF_SKIP|DOCEF_FILTER_SKIP)))
- doc_ce=doc_ce->last; //TODO: sel? recurse?
- cc=doc_ce->min_col;
- } else {
- if (cc>doc_ce->min_col) {
- if (IsEditableText(doc_ce) && cc<doc_ce->max_col) {
- dst=doc_ce->tag+cc;
- doc_ne=DocEntryNewTag(doc,doc_ce,dst);
- *dst=0;
- doc_ce->max_col=cc;
- QueIns(doc_ne,doc_ce);
- }
- cc--;
- if (IsEditableText(doc_ce) && cc>doc_ce->min_col) {
- dst=doc_ce->tag+cc;
- doc_ne=DocEntryNewTag(doc,doc_ce,dst);
- *dst=0;
- doc_ce->max_col=cc;
- QueIns(doc_ne,doc_ce);
- doc_ce=doc_ne;
- cc=doc_ce->min_col;
- }
- if (sc>=0)
- BEqu(&doc_ce->type,DOCEt_SEL,sc&SCF_SHIFT);
- } else {
- cc=doc_ce->min_col;
- while (doc_ce->last!=doc &&
- (doc_ce->last->type_u8==DOCT_SOFT_NEW_LINE ||
- doc_ce->last->type_u8==DOCT_INDENT ||
- doc_ce->last->de_flags&(DOCEF_SKIP|DOCEF_FILTER_SKIP))) {
- doc_ce=doc_ce->last;
- if (sc>=0)
- BEqu(&doc_ce->type,DOCEt_SEL,sc&SCF_SHIFT);
- }
- if (doc_ce->last!=doc) {
- doc_ce=doc_ce->last;
- if (doc_ce->max_col>doc_ce->min_col) {
- cc=doc_ce->max_col-1;
- if (IsEditableText(doc_ce) && cc>doc_ce->min_col) {
- dst=doc_ce->tag+cc;
- doc_ne=DocEntryNewTag(doc,doc_ce,dst);
- *dst=0;
- doc_ce->max_col=cc;
- QueIns(doc_ne,doc_ce);
- doc_ce=doc_ne;
- cc=doc_ce->min_col;
- }
- } else
- cc=doc_ce->max_col;
- if (sc>=0)
- BEqu(&doc_ce->type,DOCEt_SEL,sc&SCF_SHIFT);
- }
- }
- }
- doc->cur_col=cc;
- doc->cur_entry=doc_ce;
- if (doc_ce!=original_ce)
- DocFormBwd(doc);
- if (unlock)
- DocUnlock(doc);
-}
-
-public U0 EdCursorRight(CDoc *doc,I64 sc=I64_MIN)
-{//Move cursor right. Might need a call to DocRecalc().
-//See EdRenumAsm for an example.
- Bool unlock=DocLock(doc);
- U8 *dst;
- CDocEntry *doc_ce=doc->cur_entry,*original_ce=doc_ce,*doc_ne;
- I64 cc=doc->cur_col,y=doc_ce->y,old_de_flags,old_color;
- if (sc!=I64_MIN) sc=sc.u32[0];
- if (sc>=0 && sc&SCF_CTRL) {
- while (doc_ce!=doc && doc_ce->next->y==y &&
- doc_ce->next->type_u8!=DOCT_SOFT_NEW_LINE && doc_ce->next!=doc &&
- (doc_ce->next->type_u8!=DOCT_NEW_LINE || !(doc->flags & DOCF_FORM)) ||
- doc_ce->de_flags & (DOCEF_SKIP|DOCEF_FILTER_SKIP))
- doc_ce=doc_ce->next;
- if (doc_ce->max_col>doc_ce->min_col)
- cc=doc_ce->max_col-1;
- else
- cc=doc_ce->min_col;
- } else {
- if (cc<doc_ce->max_col) {
- if (IsEditableText(doc_ce) && cc>doc_ce->min_col) {
- dst=doc_ce->tag+cc;
- doc_ne=DocEntryNewTag(doc,doc_ce,dst);
- *dst=0;
- doc_ce->max_col=cc;
- QueIns(doc_ne,doc_ce);
- doc_ce=doc_ne;
- cc=doc_ce->min_col;
- }
- cc++;
- old_de_flags=doc_ce->de_flags;
- old_color=doc_ce->type;
- if (sc>=0)
- BEqu(&doc_ce->type,DOCEt_SEL,sc&SCF_SHIFT);
- if (IsEditableText(doc_ce) && cc<doc_ce->max_col) {
- dst=doc_ce->tag+cc;
- doc_ne=DocEntryNewTag(doc,doc_ce,dst);
- *dst=0;
- doc_ne->type=DOCT_TEXT | old_color & -0x100;
- doc_ne->de_flags=old_de_flags|doldoc.dft_de_flags[DOCT_TEXT];
- doc_ce->max_col=cc;
- QueIns(doc_ne,doc_ce);
- doc_ce=doc_ne;
- cc=doc_ce->min_col;
- } else if (cc>=doc_ce->max_col) {
- doc_ce=doc_ce->next;
- cc=doc_ce->min_col;
- }
- } else {
- if (doc_ce!=doc) {
- if (cc<=doc_ce->min_col && sc>=0)
- BEqu(&doc_ce->type,DOCEt_SEL,sc&SCF_SHIFT);
- doc_ce=doc_ce->next;
- while (doc_ce!=doc && doc_ce->de_flags&(DOCEF_SKIP|DOCEF_FILTER_SKIP)) {
- if (sc>=0)
- BEqu(&doc_ce->type,DOCEt_SEL,sc&SCF_SHIFT);
- doc_ce=doc_ce->next;
- }
- cc=doc_ce->min_col;
- if (doc_ce->type_u8==DOCT_SOFT_NEW_LINE) {
- if (sc>=0)
- BEqu(&doc_ce->type,DOCEt_SEL,sc&SCF_SHIFT);
- doc_ce=doc_ce->next;
- cc=doc_ce->min_col;
- }
- }
- }
- }
- doc->cur_col=cc;
- doc->cur_entry=doc_ce;
- if (doc_ce!=original_ce)
- DocFormFwd(doc);
- if (unlock)
- DocUnlock(doc);
-}
-
-public U0 EdLineUp(CDoc *doc,I64 sc=I64_MIN)
-{//Move cursor up. Might need a call to DocRecalc().
-//See EdRenumAsm for an example.
- Bool unlock=DocLock(doc);
- U8 *dst;
- I64 y,x;
- CDocEntry *doc_ce=doc->cur_entry,*doc_ne;
-
- if (sc!=I64_MIN) sc=sc.u32[0];
- if (doc_ce->type_u8==DOCT_HEX_ED) {
- doc->cur_col=doc->cur_col-doc_ce->hex_ed_width*3;
- if (doc->cur_col>=0) {
- if (unlock)
- DocUnlock(doc);
- return;
- } else
- doc->cur_col=0;
- }
- x=doc->x; y=doc->y;
- if (IsEditableText(doc_ce)) {
- if (doc_ce->min_col<doc->cur_col<doc_ce->max_col-1) {
- dst=doc_ce->tag+doc->cur_col;
- doc_ne=DocEntryNewTag(doc,doc_ce,dst);
- *dst=0;
- doc_ne->x=doc_ce->x+doc->cur_col;
- doc_ce->max_col=doc->cur_col;
- QueIns(doc_ne,doc_ce);
- } else if (doc->cur_col==doc_ce->min_col && doc_ce->last!=doc)
- doc_ce=doc_ce->last;
- } else if (doc_ce->last!=doc)
- doc_ce=doc_ce->last;
- if (sc>=0)
- BEqu(&doc_ce->type,DOCEt_SEL,sc&SCF_SHIFT);
- doc->cur_entry=doc_ce;
- DocFormBwd(doc);
- doc_ce=doc->cur_entry;
- while (doc_ce->last!=doc && (doc_ce->y>=y ||
- doc_ce->de_flags & (DOCEF_SKIP|DOCEF_FILTER_SKIP))) {
- doc_ce=doc_ce->last;
- if (sc>=0)
- BEqu(&doc_ce->type,DOCEt_SEL,sc&SCF_SHIFT);
- }
- y=doc_ce->y;
- doc->y=y;
- while (doc_ce!=doc && (doc_ce->y>=y && doc_ce->x>=x ||
- doc_ce->de_flags & (DOCEF_SKIP|DOCEF_FILTER_SKIP))) {
- if (sc>=0)
- BEqu(&doc_ce->type,DOCEt_SEL,sc&SCF_SHIFT);
- doc_ce=doc_ce->last;
- }
-
- if (doc_ce==doc || doc_ce->y<y)
- doc_ce=doc_ce->next;
- else {
- if (!IsEditableText(doc_ce)) {
- if (sc>=0)
- BEqu(&doc_ce->type,DOCEt_SEL,sc&SCF_SHIFT);
- } else {
- if (doc_ce->next->x==x) {
- doc_ce=doc_ce->next;
- if (doc->flags & DOCF_FORM)
- while (doc_ce->next->x==x &&
- (!Bt(doldoc.type_flags_form,doc_ce->type_u8) &&
- !(doc_ce->de_flags&DOCEF_LINK)||
- doc_ce->de_flags&DOCEF_SKIP_IN_FORM))
- doc_ce=doc_ce->next;
- }
- }
- }
- if (doc_ce->de_flags&DOCEF_TAG) {
- doc->cur_col=x-doc_ce->x;
- if (IsEditableText(doc_ce)) {
- if (doc->cur_col>doc_ce->max_col)
- doc->cur_col=doc_ce->max_col;
- } else if (doc->cur_col>=doc_ce->max_col)
- doc->cur_col=doc_ce->max_col-1;
- if (doc->cur_col<doc_ce->min_col)
- doc->cur_col=doc_ce->min_col;
- } else {
- if (doc_ce->type_u8==DOCT_HEX_ED) {
- doc->cur_col=RoundI64((doc_ce->len-1)*3,doc_ce->hex_ed_width*3);
- if (doc->cur_col<0)
- doc->cur_col=0;
- } else
- doc->cur_col=doc_ce->min_col;
- }
- if (IsEditableText(doc_ce) && doc_ce->x<x) {
- if (doc->cur_col<doc_ce->max_col-1) {
- dst=doc_ce->tag+doc->cur_col;
- doc_ne=DocEntryNewTag(doc,doc_ce,dst);
- *dst=0;
- if (sc>=0) {
- if (sc&SCF_SHIFT)
- doc_ne->type=doc_ce->type | DOCET_SEL;
- else
- doc_ne->type=doc_ce->type & ~DOCET_SEL;
- }
- doc_ne->x=doc_ce->x+doc->cur_col;
- doc_ce->max_col=doc->cur_col;
- QueIns(doc_ne,doc_ce);
- doc_ce=doc_ne;
- doc->cur_col=doc_ce->min_col;
- }
- }
- doc->cur_entry=doc_ce;
- DocFormFwd(doc);
- doc->x=doc->cur_entry->x+doc->cur_col;
- if (unlock)
- DocUnlock(doc);
-}
-
-public U0 EdLineDown(CDoc *doc,I64 sc=I64_MIN)
-{//Move cursor down. Might need a call to DocRecalc().
-//See EdRenumAsm for an example.
- Bool unlock=DocLock(doc);
- U8 *dst;
- I64 y,x,old_de_flags=0,old_color;
- CDocEntry *doc_ce=doc->cur_entry,*doc_ne,*doc_ce2;
- if (sc!=I64_MIN) sc=sc.u32[0];
- if (doc_ce->type_u8==DOCT_HEX_ED) {
- doc->cur_col=doc->cur_col+doc_ce->hex_ed_width*3;
- if (doc->cur_col>=doc_ce->len*3) {
- doc->cur_entry=doc_ce=doc_ce->next;
- doc->cur_col=doc_ce->min_col;
- doc->x=doc_ce->x+doc->cur_col;
- doc->y=doc_ce->y;
- }
- if (unlock)
- DocUnlock(doc);
- return;
- }
- x=doc->x; y=doc->y;
- if (IsEditableText(doc_ce)) {
- if (doc->cur_col>doc_ce->min_col && doc->cur_col<doc_ce->max_col-1) {
- dst=doc_ce->tag+doc->cur_col;
- doc_ne=DocEntryNewTag(doc,doc_ce,dst);
- *dst=0;
- if (sc>=0) {
- if (sc&SCF_SHIFT)
- doc_ne->type=doc_ce->type | DOCET_SEL;
- else
- doc_ne->type=doc_ce->type & ~DOCET_SEL;
- }
- doc_ne->x=doc_ce->x+doc->cur_col;
- doc_ce->max_col=doc->cur_col;
- QueIns(doc_ne,doc_ce);
- doc_ce=doc_ne;
- doc->cur_col=doc_ce->min_col;
- }
- }
- doc_ce2=doc_ce;
- while (doc_ce!=doc && (doc_ce->y<=y ||
- doc_ce->de_flags & (DOCEF_SKIP|DOCEF_FILTER_SKIP)))
- doc_ce=doc_ce->next;
- y=doc_ce->y;
- doc->y=y;
- while (doc_ce!=doc && (doc_ce->y<=y && doc_ce->x<=x ||
- doc_ce->de_flags & (DOCEF_SKIP|DOCEF_FILTER_SKIP))) {
- old_de_flags=doc_ce->de_flags;
- old_color=doc_ce->type;
- doc_ce=doc_ce->next;
- }
- if (doc_ce->last!=doc && (doc_ce->x>x && doc_ce->last->y>=y || doc_ce->y>y)) {
- doc_ce=doc_ce->last;
- doc->cur_entry=doc_ce;
- if (!((doc_ce->type_u8==DOCT_NEW_LINE ||
- doc_ce->type_u8==DOCT_SOFT_NEW_LINE ||
- doc_ce->type_u8==DOCT_INDENT) &&
- (doc_ce->last->type_u8==DOCT_NEW_LINE ||
- doc_ce->last->type_u8==DOCT_SOFT_NEW_LINE ||
- doc_ce->last->type_u8==DOCT_INDENT)))
- DocFormBwd(doc);
- doc_ce=doc->cur_entry;
- }
- while (doc_ce2!=doc && (doc_ce2!=doc_ce || IsEditableText(doc_ce))) {
- if ((doc_ce2->y<y || doc_ce2->x<x ||
- doc_ce2->de_flags & (DOCEF_SKIP|DOCEF_FILTER_SKIP) ||
- doc_ce2->x==x && !doc_ce2->max_col &&
- Bt(doldoc.type_flags_nontag_invis,doc_ce2->type_u8)) && sc>=0)
- BEqu(&doc_ce2->type,DOCEt_SEL,sc&SCF_SHIFT);
- if (doc_ce2==doc_ce) break;
- doc_ce2=doc_ce2->next;
- }
- if (doc_ce->de_flags&DOCEF_TAG) {
- doc->cur_col=x-doc_ce->x;
- if (IsEditableText(doc_ce)) {
- if (doc->cur_col>doc_ce->max_col)
- doc->cur_col=doc_ce->max_col;
- } else if (doc->cur_col>=doc_ce->max_col)
- doc->cur_col=doc_ce->max_col-1;
- if (doc->cur_col<doc_ce->min_col)
- doc->cur_col=doc_ce->min_col;
- } else
- doc->cur_col=doc_ce->min_col;
- if (IsEditableText(doc_ce)&&doc_ce->min_col<doc->cur_col<doc_ce->max_col-1) {
- dst=doc_ce->tag+doc->cur_col;
- doc_ne=DocEntryNewTag(doc,doc_ce,dst);
- *dst=0;
- doc_ne->type=DOCT_TEXT | old_color & -0x100;
- doc_ne->de_flags=old_de_flags|doldoc.dft_de_flags[DOCT_TEXT];
- doc_ce->max_col=doc->cur_col;
- doc_ne->x=doc_ce->x+doc->cur_col;
- QueIns(doc_ne,doc_ce);
- doc_ce=doc_ne;
- doc->cur_col=doc_ce->min_col;
- }
- doc->cur_entry=doc_ce;
- DocFormFwd(doc);
- if (!(doc->flags & DOCF_FORM))
- while (doc_ce!=doc && doc_ce!=doc->cur_entry) {
- if (sc>=0)
- BEqu(&doc_ce->type,DOCEt_SEL,sc&SCF_SHIFT);
- doc_ce=doc_ce->next;
- }
- doc->x=doc->cur_entry->x+doc->cur_col;
- if (unlock)
- DocUnlock(doc);
-}
-
-U0 EdCharDel(CDoc *doc)
-{
- Bool unlock=DocLock(doc);
- CDocEntry *doc_ce=doc->cur_entry;
-
- if (doc_ce==doc) {
- if (unlock)
- DocUnlock(doc);
- return;
- }
- if (doc_ce->max_col!=0 &&
- (IsEditableText(doc_ce)||doc_ce->type_u8==DOCT_DATA)) {
- if (doc_ce->type_u8==DOCT_DATA && doc_ce->de_flags & DOCEF_HAS_TERMINATOR &&
- doc->cur_col==doc_ce->max_col-1) {
- if (unlock)
- DocUnlock(doc);
- return;
- }
- if (doc->cur_col<doc_ce->max_col)
- StrCpy(doc_ce->tag+doc->cur_col,doc_ce->tag+doc->cur_col+1);
- if (doc->cur_col>=doc_ce->max_col-1) {
- doc->cur_entry=doc_ce->next;
- doc->cur_col=doc->cur_entry->min_col;
- }
- DocRemSoftNewLines(doc,doc->cur_entry);
- if (unlock)
- DocUnlock(doc);
- return;
- }
- doc->cur_entry=doc_ce->next;
- doc->cur_col=doc->cur_entry->min_col;
- if (!(doc_ce->de_flags&DOCEF_FILTER_SKIP))
- DocEntryDel(doc,doc_ce);
- DocRemSoftNewLines(doc,doc->cur_entry);
- if (unlock)
- DocUnlock(doc);
-}
-
-U0 ChkDollarBufSize(CDoc *doc)
-{
- U8 *b;
- if (doc->dollar_buf_ptr>=doc->dollar_buf_size-2) {
- doc->dollar_buf_size<<=1;
- b=MAlloc(doc->dollar_buf_size,doc->mem_task);
- MemCpy(b,doc->dollar_buf,doc->dollar_buf_ptr);
- Free(doc->dollar_buf);
- doc->dollar_buf=b;
- }
-}
-
-U0 EdCharIns(I64 ch,I64 sc,CDoc *doc)
-{
- Bool unlock=DocLock(doc);
- U8 *st,*src,*dst;
- CDocEntry *doc_ce=doc->cur_entry,*doc_ne;
- I64 i,j,m,y=doc_ce->y;
-
- if (doc->flags & DOCF_IN_DOLLAR) {
- if (!Bt(char_bmp_printable,ch))
- goto ic_done;
- ChkDollarBufSize(doc);
- doc->dollar_buf[doc->dollar_buf_ptr++]=ch;
- if (ch=='$') {
- if (doc->dollar_buf_ptr==2) {
- doc->flags&=~DOCF_IN_DOLLAR;
- doc->dollar_buf_ptr=0;
- goto ic_cont;
- } else {
- doc->dollar_buf[doc->dollar_buf_ptr]=0;
- doc->flags&=~DOCF_IN_DOLLAR;
- DocPrint(doc,"%s",doc->dollar_buf);
- doc->dollar_buf_ptr=0;
- goto ic_done;
- }
- } else
- goto ic_done;
- }
- if (ch=='$' && !(doc->flags & (DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_TABS))) {
- doc->flags|=DOCF_IN_DOLLAR;
- doc->dollar_buf_ptr=0;
- doc->dollar_buf[doc->dollar_buf_ptr++]=ch;
- goto ic_done;
- }
- if (ch=='\r') goto ic_done;
-
- ic_cont:
- if ((ch==CH_SPACE || ch=='\n') &&
- !(sc & (SCF_CTRL|SCF_SHIFT)) &&
- doc_ce->de_flags &
- (DOCEF_LINK|DOCEF_TREE|DOCEF_LST|DOCEF_CHECK_COLLAPSABLE|
- DOCEF_LEFT_MACRO|DOCEF_LEFT_EXP|DOCEF_LEFT_CB|DOCEF_LEFT_IN_STR |
- DOCEF_RIGHT_MACRO|DOCEF_RIGHT_EXP|DOCEF_RIGHT_CB|DOCEF_RIGHT_IN_STR)) {
- doc->cmd_U8=ch;
- DocEntryRun(doc,doc_ce,FALSE);
- DocLock(doc);
- goto ic_done;
- }
- if (doc_ce->type_u8==DOCT_HEX_ED) {
- if (doc_ce->de_flags&DOCEF_DEREF_DATA &&
- !(doc_ce->de_flags&DOCEF_REMALLOC_DATA))
- st=doc_ce->data;
- else
- st=&doc_ce->data;
- i=doc->cur_col;
- j=i%(doc_ce->hex_ed_width*3);
- m=i/(doc_ce->hex_ed_width*3)*doc_ce->hex_ed_width;
- if (j>=doc_ce->hex_ed_width<<1)
- st[j-doc_ce->hex_ed_width<<1+m]=ch;
- else {
- ch=ToUpper(ch)-'0';
- if (ch>9) {
- ch+='0'-'A'+10;
- if (!(10<=ch<=15))
- goto ic_done;
- }
- m=j>>1+m;
- if (j & 1)
- st[m]=st[m] & 0xF0| ch;
- else
- st[m]=st[m] & 0xF | ch<<4;
- }
- doc->cur_col++;
- goto ic_done;
- }
- if (doc->flags & DOCF_OVERSTRIKE) {
- if (Bt(char_bmp_displayable,ch)) {
-ic_overstrike:
- if (IsEditableText(doc_ce)) {
- if (doc->cur_col<doc_ce->max_col) {
- if (doc_ce->tag[doc->cur_col]) {
- doc_ce->tag[doc->cur_col++]=ch;
- goto ic_done;
- }
- } else {
- doc_ce=doc_ce->next;
- doc->cur_entry=doc_ce;
- doc->cur_col=doc_ce->min_col;
- goto ic_overstrike;
- }
- } else if (doc_ce->type_u8==DOCT_DATA) {
- if (doc_ce->de_flags & DOCEF_HAS_TERMINATOR) {
- if (doc_ce->tag[doc->cur_col] &&
- doc->cur_col<doc_ce->min_col+doc_ce->len) {
- doc_ce->tag[doc->cur_col++]=ch;
- if ( ! doc_ce->tag[doc->cur_col]) {
- doc_ce->tag[doc->cur_col]='_';
- doc_ce->tag[doc->cur_col+1]=0;
- }
- } else if (doc_ce->de_flags & DOCEF_REMALLOC_DATA)
- goto ic_not_overstrike;
- } else if (doc_ce->tag[doc->cur_col])
- doc_ce->tag[doc->cur_col++]=ch;
- goto ic_done;
- }
- doc_ne=DocEntryNewTag(doc,doc_ce,&ch);
- doc_ne->type=DOCT_TEXT | doc->settings_head.dft_text_attr<<8;
- doc_ne->de_flags=doldoc.dft_de_flags[DOCT_TEXT];
- QueIns(doc_ne,doc_ce->last);
- } else if (ch=='\n') {
- while (doc->cur_entry->next!=doc && doc->cur_entry->y==y)
- doc->cur_entry=doc->cur_entry->next;
- doc->cur_col=doc->cur_entry->min_col;
- } else if (ch=='\t') {
- if (doc->flags&DOCF_FORM)
- goto ic_form_tab;
- }
- goto ic_done;
- }
-ic_not_overstrike:
- if (ch=='\n') {
- if (sc&SCF_CTRL && !(sc&SCF_SHIFT)) {
- doc_ne=DocEntryNewBase(doc,
- DOCT_PAGE_BREAK|doc->settings_head.dft_text_attr<<8);
- } else {
- doc_ne=DocEntryNewBase(doc,
- DOCT_NEW_LINE|doc->settings_head.dft_text_attr<<8);
- }
- DocInsEntry(doc,doc_ne);
- } else if (ch=='\t') {
- if (doc->flags&DOCF_FORM &&
- (Bt(doldoc.type_flags_form,doc->cur_entry->type_u8) ||
- doc->cur_entry->de_flags&DOCEF_LINK) &&
- !(doc->cur_entry->de_flags&DOCEF_SKIP_IN_FORM)) {
-ic_form_tab:
- doc->cur_entry=doc->cur_entry->next;
- doc->cur_col=doc->cur_entry->min_col;
- DocFormFwd(doc);
- goto ic_done;
- } else {
- doc_ne=DocEntryNewBase(doc,DOCT_TAB|doc->settings_head.dft_text_attr<<8);
- DocInsEntry(doc,doc_ne);
- }
- } else {
- if (Bt(char_bmp_displayable,ch)) {
- if (doc_ce->type_u8==DOCT_DATA) {
- while (TRUE) {
- i=doc_ce->len+doc_ce->min_col;
- if (doc_ce->de_flags & DOCEF_HAS_TERMINATOR)
- i++;
- if (doc_ce->max_col<i) {
- st=doc_ce->tag;
- doc_ce->max_col++;
- for (i=doc_ce->max_col;i>doc->cur_col;i--)
- st[i]=st[i-1];
- st[doc->cur_col++]=ch;
- break;
- } else if (doc_ce->de_flags & DOCEF_REMALLOC_DATA) {
- st=MAlloc(doc_ce->max_col+8,doc->mem_task);
- MemCpy(st,doc_ce->tag,doc_ce->max_col+1);
- Free(doc_ce->tag);
- doc_ce->tag=st;
- doc_ce->len=MSize(st)-doc_ce->min_col-2; //See $LK,"DataTagWidth",A="FA:::/Adam/DolDoc/DocPlain.HC,DataTagWidth"$
- Free(doc_ce->data);
- doc_ce->data=MAlloc(doc_ce->len+2,doc->mem_task);
- } else
- break;
- }
- } else if (IsEditableText(doc_ce)) {
- dst=st=MAlloc(doc_ce->max_col+2,doc->mem_task);
- src=doc_ce->tag;
- i=doc->cur_col;
- while (i-->0)
- *dst++=*src++;
- *dst++=ch;
- while (*dst++=*src++);
- Free(doc_ce->tag);
- doc_ce->tag=st;
- doc_ce->max_col++;
- doc->cur_col++;
- } else {
- doc_ne=DocEntryNewTag(doc,doc_ce,&ch);
- doc_ne->type=DOCT_TEXT | doc->settings_head.dft_text_attr<<8;
- doc_ne->de_flags=doldoc.dft_de_flags[DOCT_TEXT];
- doc_ne->x=doc_ce->x+1;
- QueIns(doc_ne,doc_ce->last);
- }
- }
- }
-ic_done:
- DocRemSoftNewLines(doc,doc->cur_entry);
- if (doc->cur_entry->de_flags & DOCEF_UPDATE_DATA &&
- (doc->cur_entry->type_u8==DOCT_DATA ||
- doc->cur_entry->type_u8==DOCT_CHECK_BOX))
- DocDataScan(doc,doc->cur_entry);
- if (unlock)
- DocUnlock(doc);
-}
-
-U0 EdLineDel(CDoc *doc)
-{
- CDocEntry *doc_ce=doc->cur_entry,*doc_ce2;
- I64 y;
- y=doc->y;
- while (doc_ce!=doc && doc_ce->y==y)
- doc_ce=doc_ce->next;
- doc->cur_entry=doc_ce;
- doc->cur_col=doc_ce->min_col;
- doc_ce=doc_ce->last;
- while (doc_ce!=doc && doc_ce->y==y) {
- doc_ce2=doc_ce->last;
- if (!(doc_ce->de_flags&DOCEF_FILTER_SKIP))
- DocEntryDel(doc,doc_ce);
- doc_ce=doc_ce2;
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocClipBoard.HC.HTML b/public/src/Adam/DolDoc/DocClipBoard.HC.HTML deleted file mode 100644 index c8dbddc..0000000 --- a/public/src/Adam/DolDoc/DocClipBoard.HC.HTML +++ /dev/null @@ -1,137 +0,0 @@ - - - - - DocClipBoard.HC - - - - - #help_index "DolDoc/Clip"
-
-sys_clip_doc=DocNew;
-
-public U0 ClipDel()
-{//Delete everything on clip.
- DocRst(sys_clip_doc,TRUE);
-}
-
-public U0 ClipCopy(CDoc *doc)
-{//Copy DOCET_SEL flagged entries to clip.
- CDoc *doc2=sys_clip_doc;
- Bool unlock_doc=DocLock(doc),
- unlock_doc2=DocLock(doc2);
- CDocEntry *doc_e=doc->head.next,*doc_ne;
- ClipDel;
- while (doc_e!=doc) {
- if (doc_e->type & DOCET_SEL) {
- doc_e->type&=~DOCET_SEL;
- if (!Bt(doldoc.type_flags_data,doc_e->type_u8)) {
- doc_ne=DocEntryCopy(doc2,doc_e);
- QueIns(doc_ne,doc2->head.last);
- }
- }
- doc_e=doc_e->next;
- }
- if (unlock_doc2)
- DocUnlock(doc2);
- if (unlock_doc)
- DocUnlock(doc);
-}
-
-public U0 ClipCut(CDoc *doc)
-{//Remove sel entries and place on clip.
- CDoc *doc2=sys_clip_doc;
- Bool unlock_doc=DocLock(doc),
- unlock_doc2=DocLock(doc2);
- CDocEntry *doc_e=doc->head.next,*doc_e1,*doc_ne,*doc_e2=NULL;
- ClipDel;
- while (doc_e!=doc) {
- doc_e1=doc_e->next;
- if (doc_e->type & DOCET_SEL) {
- doc_e->type&=~DOCET_SEL;
- if (!Bt(doldoc.type_flags_data,doc_e->type_u8)) {
- doc_ne=DocEntryCopy(doc2,doc_e);
- QueIns(doc_ne,doc2->head.last);
- }
- if (doc_e==doc->cur_entry || doc_e==doc_e2)
- doc_e2=doc_e->next;
- DocEntryDel(doc,doc_e);
- }
- doc_e=doc_e1;
- }
- if (doc_e2) {
- doc->cur_entry=doc_e2;
- doc->cur_col=doc_e2->min_col;
- }
- DocRemSoftNewLines(doc,NULL);
- if (unlock_doc2)
- DocUnlock(doc2);
- if (unlock_doc)
- DocUnlock(doc);
-}
-
-public U0 ClipPaste(CDoc *doc)
-{//Insert copy of clip at insert pt, cur_entry.
- CDoc *doc2=sys_clip_doc;
- Bool unlock_doc=DocLock(doc),
- unlock_doc2=DocLock(doc2);
- CDocEntry *doc_ce=doc->cur_entry,*doc_e;
- if (doc_ce->type_u8==DOCT_DATA) {
- doc_e=doc2->head.next;
- while (doc_e!=doc2) {
- if (doc_e->de_flags&DOCEF_TAG)
- DocPrintPartial(doc,"%s",doc_e->tag);
- doc_e=doc_e->next;
- }
- } else
- DocInsDoc(doc,doc2);
- if (unlock_doc2)
- DocUnlock(doc2);
- if (unlock_doc)
- DocUnlock(doc);
-}
-
-public U0 DocCut(CDoc *doc,CDocEntry *start,CDocEntry *end)
-{//Del start to end entry, including end points.
- Bool unlock_doc=DocLock(doc);
- CDocEntry *doc_e1;
- if (start!=doc && (start->last!=end || end==doc))
- do {
- doc_e1=start->next;
- if (start==doc->cur_entry) {
- doc->cur_entry=start->next;
- doc->cur_col=doc->cur_entry->min_col;
- }
- DocEntryDel(doc,start);
- if (start==end)
- break;
- start=doc_e1;
- } while (start!=doc);
- DocRemSoftNewLines(doc,NULL);
- if (unlock_doc)
- DocUnlock(doc);
-}
-
-public CDoc *DocCopy(CDoc *doc,CDocEntry *start,CDocEntry *end)
-{//Copies start to end entry, including end points.
- CDoc *doc2=DocNew;
- Bool unlock_doc=DocLock(doc);
- CDocEntry *doc_ne;
- if (start!=doc && (start->last!=end || end==doc))
- do {
- if (!Bt(doldoc.type_flags_data,start->type_u8)) {
- doc_ne=DocEntryCopy(doc2,start);
- QueIns(doc_ne,doc2->head.last);
- }
- if (start==end)
- break;
- start=start->next;
- } while (start!=doc);
- if (unlock_doc)
- DocUnlock(doc);
- return doc2;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocCodeTools.HC.HTML b/public/src/Adam/DolDoc/DocCodeTools.HC.HTML deleted file mode 100644 index 33e0b92..0000000 --- a/public/src/Adam/DolDoc/DocCodeTools.HC.HTML +++ /dev/null @@ -1,670 +0,0 @@ - - - - - DocCodeTools.HC - - - - - #help_index "DolDoc/Misc"
-
-U0 EdReplaceTroubleOne(CDoc *doc,U8 *st_original,U8 *st_safe,I64 num,
- Bool to_safe,Bool sel)
-{
- U8 buf[STR_LEN];
- StrPrint(buf,st_safe,num);
- if (to_safe)
- EdReplace(doc,st_original,buf,sel);
- else
- EdReplace(doc,buf,st_original,sel);
-}
-
-U0 EdReplaceTroubleAll(CDoc *doc,Bool to_safe,Bool sel)
-{
- I64 i=0;
- EdReplaceTroubleOne(doc,"#assert" ,"//<@%d@>" ,i++,to_safe,sel);
- EdReplaceTroubleOne(doc,"#define" ,"//<@%d@>" ,i++,to_safe,sel);
- EdReplaceTroubleOne(doc,"#include","//<@%d@>" ,i++,to_safe,sel);
-//#if will match #if,#ifdef,#ifndef,#ifaot and #ifjit
- EdReplaceTroubleOne(doc,"#if" ,"//<@%d@>" ,i++,to_safe,sel);
- EdReplaceTroubleOne(doc,"#endif" ,"//<@%d@>" ,i++,to_safe,sel);
-//Convert #exe to union because we want that indent pattern.
- EdReplaceTroubleOne(doc,"#exe" ,"union@%d@",i++,to_safe,sel);
- EdReplaceTroubleOne(doc,"'{'" ,"'<@%d@>'" ,i++,to_safe,sel);
- EdReplaceTroubleOne(doc,"'}'" ,"'<@%d@>'" ,i++,to_safe,sel);
-}
-
-#define C_INDENT_SPACES 2
-#define ASM_RENUM_SPACING 5
-
-#define EF_REINDENT 0
-#define EF_CMP_CHK 1
-#define EF_RENUM_ASM 2
-#define EF_CTRL_SLIDER 3
-#define EF_CH_SC 4
-
-I64 PopUpEdFmt()
-{
- I64 i;
- CDoc *doc=DocNew;
- DocPrint(doc,"$LTBLUE$$MU,\"Compile Check\",LE=EF_CMP_CHK$\n"
- "$MU,\"Reindent HolyC Fun (Beware braces in strings.)\","
- "LE=EF_REINDENT$\n"
- "$MU,\"Renum Asm Local @@ Labels for Fun\",LE=EF_RENUM_ASM$\n"
- "$MU,\"Insert Template Code: Ctrl Slider\",LE=EF_CTRL_SLIDER$\n"
- "$MU,\"Insert ASCII/Scan Code Hex Codes for key pressed\","
- "LE=EF_CH_SC$\n\n"
- "$MU,\"CANCEL\",LE=DOCM_CANCEL$\n\n"
- "$GREEN$<ALT-BACKSPACE>$FG$ to undo if not happy\n"
- "with the ress.\n");
- i=PopUpMenu(doc);
- DocDel(doc);
- return i;
-}
-
-class CRILex
-{
- CCmpCtrl *cc1,*cc2;
- CQueVectU8 *indent;
- I64 depth,exp_depth,one_shot;
- Bool was_new_line,is_not_cont;
-};
-
-I64 EdRILex(CRILex *rx)
-{
- rx->is_not_cont=FALSE;
- I64 i;
- CLexFile *tmpf;
- do {
- Lex(rx->cc1);
- Lex(rx->cc2);
- i=PrsKeyWord(rx->cc2);
- if (rx->cc1->token=='\n' && rx->cc2->token==';' || rx->cc2->token=='{' ||
- rx->cc2->token=='}' || rx->cc2->token==':' || rx->cc2->token==')' &&
- !rx->exp_depth || i==KW_ELSE || i==KW_CATCH || i==KW_DO)
- rx->is_not_cont=TRUE;
- if (rx->was_new_line && (rx->cc1->token!=':' || i==KW_CASE ||
- i==KW_DFT || i==KW_START || i==KW_END)) {
- tmpf=rx->cc2->lex_include_stk;
- while (tmpf->next)
- tmpf=tmpf->next;
- QueVectU8Put(rx->indent,tmpf->cur_entry->y,rx->depth+rx->one_shot);
- rx->one_shot=0;
- }
- if (rx->cc2->token=='\n')
- rx->was_new_line=TRUE;
- else
- rx->was_new_line=FALSE;
- } while (rx->cc1->token=='\n');
- return rx->cc1->token;
-}
-
-U0 EdRIExp(CRILex *rx)
-{
- if (rx->cc1->token=='(') {
- if (!rx->exp_depth++)
- rx->depth+=3;
- EdRILex(rx);
- while (rx->cc1->token && rx->cc1->token!=')')
- EdRIExp(rx);
- if (!--rx->exp_depth) {
- rx->depth-=3;
- if (rx->depth<0) rx->depth=0;
- }
- } else if (rx->cc1->token=='[') {
- if (!rx->exp_depth++)
- rx->depth+=3;
- EdRILex(rx);
- while (rx->cc1->token && rx->cc1->token!=']')
- EdRIExp(rx);
- if (!--rx->exp_depth) {
- rx->depth-=3;
- if (rx->depth<0) rx->depth=0;
- }
- }
- EdRILex(rx);
-}
-
-U0 EdRIStmt(CRILex *rx,Bool indent)
-{
- I64 i;
- Bool cont;
- if (rx->cc1->token=='{') {
- rx->depth++;
- EdRILex(rx);
- while (rx->cc1->token && rx->cc1->token!='}')
- EdRIStmt(rx,FALSE);
- if (--rx->depth<0) rx->depth=0;
- EdRILex(rx);
- } else {
- if (indent) rx->depth++;
- do {
- cont=FALSE;
- switch (PrsKeyWord(rx->cc1)) {
- case KW_IF:
- EdRILex(rx);
- EdRIExp(rx);
- EdRIStmt(rx,TRUE);
- if (PrsKeyWord(rx->cc1)==KW_ELSE) {
- EdRILex(rx);
- if (PrsKeyWord(rx->cc1)==KW_IF && rx->cc2->token!='\n')
- EdRIStmt(rx,FALSE);
- else
- EdRIStmt(rx,TRUE);
- }
- break;
- case KW_TRY:
- EdRILex(rx);
- EdRIStmt(rx,TRUE);
- if (PrsKeyWord(rx->cc1)==KW_CATCH) {
- EdRILex(rx);
- EdRIStmt(rx,TRUE);
- }
- break;
- case KW_LOCK:
- EdRILex(rx);
- EdRIStmt(rx,TRUE);
- break;
- case KW_FOR:
- case KW_WHILE:
- EdRILex(rx);
- EdRIExp(rx);
- EdRIStmt(rx,TRUE);
- break;
- case KW_ASM:
- case KW_CLASS:
- case KW_UNION:
- if (EdRILex(rx)==TK_IDENT)
- EdRILex(rx);
- EdRIStmt(rx,TRUE);
- break;
- case KW_DO:
- EdRILex(rx);
- EdRIStmt(rx,TRUE);
- if (PrsKeyWord(rx->cc1)==KW_WHILE) {
- EdRILex(rx);
- EdRIExp(rx);
- }
- if (rx->cc1->token==';')
- EdRILex(rx);
- break;
- case KW_SWITCH:
- EdRILex(rx);
- EdRIExp(rx);
- if (rx->cc1->token=='{') {
- rx->depth++;
- EdRILex(rx);
- i=0;
- while (rx->cc1->token && rx->cc1->token!='}') {
- switch (PrsKeyWord(rx->cc1)) {
- case KW_START:
- rx->depth+=i; i=0;
- while (EdRILex(rx) && rx->cc1->token!=':');
- EdRILex(rx);
- i++;
- break;
- case KW_END:
- rx->depth+=i; i=0;
- if (--rx->depth<0) rx->depth=0;
- while (EdRILex(rx) && rx->cc1->token!=':');
- EdRILex(rx);
- break;
- case KW_CASE:
- case KW_DFT:
- rx->depth+=i; i=0;
- while (EdRILex(rx) && rx->cc1->token!=':');
- EdRILex(rx);
- break;
- default:
- if (rx->cc1->token)
- EdRIStmt(rx,TRUE);
- }
- }
- if (--rx->depth<0) rx->depth=0;
- EdRILex(rx);
- }
- break;
- default:
- if (rx->cc1->token==TK_IDENT && rx->cc1->hash_entry &&
- rx->cc1->hash_entry->type&(HTT_OPCODE|HTT_ASM_KEYWORD)) {
-// rx->one_shot=4-rx->depth;
- do EdRILex(rx);
- while (rx->cc2->token && rx->cc2->token!='\n');
- rx->is_not_cont=TRUE;
- } else {
- while (rx->cc1->token && rx->cc1->token!=';' &&
- rx->cc1->token!=':') {
- if (rx->cc2->token=='\n' && !rx->is_not_cont)
- rx->one_shot=3;
- EdRILex(rx);
- }
- if (rx->cc1->token==':')
- cont=TRUE;
- EdRILex(rx);
- }
- }
- } while (cont && rx->cc1->token!='}');
- if (indent && --rx->depth<0)
- rx->depth=0;
- }
-}
-
-CQueVectU8 *EdRICode(CDoc *doc)
-{
- CQueVectU8 *res;
- CRILex *rx=CAlloc(sizeof(CRILex));
-
- rx->cc1=CmpCtrlNew(,CCF_KEEP_NEW_LINES|CCF_DONT_FREE_BUF,doc->filename.name);
- Free(rx->cc1->lex_include_stk->full_name);
- LexAttachDoc(rx->cc1,rx->cc1->lex_include_stk,doc,,
- doc->cur_entry,doc->cur_col);
-
- rx->cc2=CmpCtrlNew(,CCF_KEEP_NEW_LINES|CCF_DONT_FREE_BUF,doc->filename.name);
- Free(rx->cc2->lex_include_stk->full_name);
- LexAttachDoc(rx->cc2,rx->cc2->lex_include_stk,doc,,
- doc->cur_entry,doc->cur_col);
-
- rx->indent=QueVectU8New(doc->cur_entry->y);
-
- Lex(rx->cc1);
- EdRIStmt(rx,FALSE);
-
- CmpCtrlDel(rx->cc1);
- CmpCtrlDel(rx->cc2);
- res=rx->indent;
- Free(rx);
- return res;
-}
-
-U0 EdRemFunLeadingSpace(CDoc *doc)
-{
- Bool unlock=DocLock(doc),
- start_of_line=TRUE;
- U8 *ptr;
- I64 ch,levels=1;
- CDocEntry *doc_e,*doc_e2;
-
- EdGoToFun(doc,FALSE,FALSE);
- doc_e=doc->cur_entry->next;
- do {
- doc_e2=doc_e->next;
- if (doc_e!=doc && doc_e!=doc->cur_entry &&
- !(doc_e->de_flags&(DOCEG_DONT_EDIT-DOCEF_SCROLLING_X)))
- switch (doc_e->type_u8) {
- case DOCT_TEXT:
- ptr=doc_e->tag;
- if (start_of_line) {
- while (*ptr==CH_SPACE)
- ptr++;
- if (*ptr)
- start_of_line=FALSE;
- ptr=StrNew(ptr,doc->mem_task);
- Free(doc_e->tag);
- doc_e->tag=ptr;
- }
- if (!*ptr)
- DocEntryDel(doc,doc_e);
- else {
- while (ch=*ptr++)
- if (ch=='{')
- levels++;
- else if (ch=='}') {
- if (!--levels)
- break;
- }
- if (!levels) goto ls_done;
- }
- break;
- case DOCT_TAB:
- if (start_of_line)
- DocEntryDel(doc,doc_e);
- break;
- case DOCT_NEW_LINE:
- start_of_line=TRUE;
- break;
- default:
- start_of_line=FALSE;
- }
- doc_e=doc_e2;
- } while (doc_e!=doc->cur_entry);
-ls_done:
- DocRecalc(doc);
- DocCenter(doc);
- if (unlock)
- DocUnlock(doc);
-}
-
-class CRenum
-{
- CRenum *next,*last;
- U8 label[sizeof(CEdFindText.find_text)];
-};
-
-I64 EdRAGetU8(CDoc *doc)
-{
- I64 res=-1;
- while (doc->cur_entry!=doc &&
- doc->cur_entry->type&DOCET_SEL && res<0) {
- res=EdCurU8(doc);
- EdCursorRight(doc);
- }
- return res;
-}
-
-U0 EdRACollect(CDoc *doc,CRenum *head)
-{
- I64 ch,i;
- CRenum *tmpr;
- U8 buf[sizeof(CEdFindText.find_text)];
- ch=EdRAGetU8(doc);
- while (ch>=0) {
- if (ch!='@')
- ch=EdRAGetU8(doc);
- else {
- ch=EdRAGetU8(doc);
- if (ch=='@') {
- ch=EdRAGetU8(doc);
- StrCpy(buf,"@@");
- i=2;
- while (ch>=0 && i<sizeof(CEdFindText.find_text)) {
- if (Bt(char_bmp_alpha_numeric,ch))
- buf[i++]=ch;
- else
- break;
- ch=EdRAGetU8(doc);
- }
- if (i<sizeof(CEdFindText.find_text)) {
- buf[i++]=0;
- while (ch>=0 && Bt(char_bmp_white_space,ch))
- ch=EdRAGetU8(doc);
- if (ch==':') {
- ch=EdRAGetU8(doc);
- tmpr=MAlloc(sizeof(CRenum));
- StrCpy(tmpr->label,buf);
- QueIns(tmpr,head->last);
- }
- }
- }
- }
- }
-//This is needed because we moved the
- //cursor and it didn't recalc.
- DocRecalc(doc);
-}
-
-U0 EdRenumAsm(CDoc *doc)
-{
- Bool unlock=DocLock(doc);
- I64 num=0;
- CRenum head,*tmpr,*tmpr1;
- U8 buf[sizeof(CEdFindText.find_text)],
- buf2[sizeof(CEdFindText.find_text)];
-
- QueInit(&head);
- EdSelFun(doc,TRUE);
- EdRACollect(doc,&head);
-
- tmpr=head.next;
- while (tmpr!=&head) {
- tmpr1=tmpr->next;
- num+=ASM_RENUM_SPACING;
- StrPrint(buf,"@#%02d",num);
- EdReplace(doc,tmpr->label,buf,TRUE,TRUE,TRUE);
- Free(tmpr);
- tmpr=tmpr1;
- }
-
- while (num) {
- StrPrint(buf, "@#%02d",num);
- StrPrint(buf2,"@@%02d",num);
- EdReplace(doc,buf,buf2,TRUE,TRUE,TRUE);
- num-=ASM_RENUM_SPACING;
- }
- EdSelAll(doc,FALSE);
- DocRecalc(doc);
- DocCenter(doc);
- if (unlock)
- DocUnlock(doc);
-}
-
-U0 EdCodeTools2(CDoc *doc,I64 tool_action,Bool beep=TRUE)
-{
- Bool okay,unlock=DocLock(doc),start_of_line=TRUE;
- CDocEntry *doc_e,*doc_ne;
- I64 i,start_y,end_y,x,r,goto_line_num;
- U8 *b,*st,*st2,*prj_file;
- CTask *task=NULL;
- CJob *tmpc;
- CQueVectU8 *indent;
-
- DocRecalc(doc);
- goto_line_num=doc->cur_entry->y+1;
-
- DocCaptureUndo(doc,TRUE);
- switch (tool_action) {
- case EF_CMP_CHK:
- okay=FALSE;
- if (doc->flags&DOCF_PLAIN_TEXT)
- DocFlagsToggle(doc,DOCF_PLAIN_TEXT);
- DocWrite(doc);
- task=Spawn(&SrvCmdLine,NULL,"Srv",,Fs);
- st2=DirCur;
- st=MStrPrint("Cd(\"%s\");",st2);
- tmpc=TaskExe(task,Fs,st,1<<JOBf_WAKE_MASTER|1<<JOBf_FOCUS_MASTER);
- Free(st2);
- Free(st);
- WinHorz(Fs->win_left,Fs->win_right, task);
- WinVert(Fs->win_top, Fs->win_bottom,task);
- if (JobResScan(tmpc,&r)) {
- st=DirFile(doc->filename.name,,"PRJ.Z");
- prj_file=FileNameAbs(st,FUF_Z_OR_NOT_Z);
- Free(st);
- if (FileFind(prj_file)) {
- st2=DirFile(prj_file),
- st=MStrPrint("Cd(\"%s\");",st2);
- Free(st2);
- tmpc=TaskExe(task,Fs,st,1<<JOBf_WAKE_MASTER|
- 1<<JOBf_FOCUS_MASTER|1<<JOBf_FREE_ON_COMPLETE);
- Free(st);
- st=MStrPrint("\"$WW,1$\";Cmp(\"%s\",\"SysTmp\",\"SysTmp\");",
- prj_file);
- tmpc=TaskExe(task,Fs,st,1<<JOBf_WAKE_MASTER|1<<JOBf_FOCUS_MASTER);
- Free(st);
- if (JobResScan(tmpc,&r))
- if (!r) {
- tmpc=TaskExe(task,Fs,
- "Load(\"SysTmp\",LDF_JUST_LOAD);",
- 1<<JOBf_WAKE_MASTER|1<<JOBf_FOCUS_MASTER);
- if (JobResScan(tmpc,&r))
- okay=TRUE;
- }
- tmpc=TaskExe(task,Fs,"Del(\"SysTmp.*\");",
- 1<<JOBf_WAKE_MASTER|1<<JOBf_FOCUS_MASTER);
- JobResScan(tmpc,&r);
- } else {
- Free(prj_file);
- st=DirFile(doc->filename.name,"Load","HC.Z");
- prj_file=FileNameAbs(st,FUF_Z_OR_NOT_Z);
- Free(st);
- if (FileFind(prj_file))
- st=MStrPrint("\"$WW,1$\";ExeFile(\"%s\",CCF_JUST_LOAD);",prj_file);
- else
- st=MStrPrint("\"$WW,1$\";ExeFile(\"%s\",CCF_JUST_LOAD);",
- doc->filename.name);
- tmpc=TaskExe(task,Fs,st,1<<JOBf_WAKE_MASTER|1<<JOBf_FOCUS_MASTER);
- Free(st);
- if (JobResScan(tmpc,&r) && r)
- okay=TRUE;
- }
- Free(prj_file);
- }
- if (!okay) {
- PopUpOk("Has Errors");
- while (LBts(&sys_semas[SEMA_FIX],0))
- Yield;
- ToFileLine(dbg.fix_file_line,&st,&i);
- LBtr(&sys_semas[SEMA_FIX],0);
- if (!StrCmp(st,doc->filename.name))
- goto_line_num=i;
- Free(st);
- }
- break;
- case EF_REINDENT:
- start_y=doc->cur_entry->y;
- EdReplaceTroubleAll(doc,TRUE,FALSE);
- DocGoToLine(doc,start_y+1);
- if (EdGoToFun(doc,FALSE,FALSE)) {
- start_y=doc->cur_entry->y;
- indent=EdRICode(doc);
- DocUnlock(doc);
- if (beep) {
- Snd(86); Sleep(150); Snd;
- Sleep(100);
- Snd(86); Sleep(150); Snd;
- }
- DocLock(doc);
- EdRemFunLeadingSpace(doc);
- DocGoToLine(doc,start_y+1);
- doc_e=doc->cur_entry;
- end_y=start_y+indent->total_cnt;
- while (start_y<=doc_e->y<end_y) {
- if (doc_e!=doc && doc_e!=doc->cur_entry &&
- !(doc_e->de_flags&(DOCEG_DONT_EDIT-DOCEF_SCROLLING_X))) {
- if (doc_e->type_u8==DOCT_NEW_LINE||
- doc_e->type_u8==DOCT_SOFT_NEW_LINE)
- start_of_line=TRUE;
- else {
- if (start_of_line) {
- i=QueVectU8Get(indent,doc_e->y)*C_INDENT_SPACES;
- x=doc_e->x+1;
- while (i>8) {
- doc_ne=DocEntryNewBase(doc,
- DOCT_TAB|doc->settings_head.dft_text_attr<<8,,
- x,doc_e->y,doc_e->page_line_num);
- MemCpy(&doc_ne->settings,
- &doc_e->settings,sizeof(CDocSettings));
- QueIns(doc_ne,doc_e->last);
- i-=8;
- x+=8;
- }
- if (i>0) {
- b=MAlloc(i+1,doc->mem_task);
- MemSet(b,CH_SPACE,i);
- b[i]=0;
- doc_ne=DocEntryNewBase(doc,
- DOCT_TEXT|doc->settings_head.dft_text_attr<<8,,
- x,doc_e->y,doc_e->page_line_num);
- doc_ne->tag=b;
- doc_ne->max_col=1;
- MemCpy(&doc_ne->settings,
- &doc_e->settings,sizeof(CDocSettings));
- QueIns(doc_ne,doc_e->last);
- }
- }
- start_of_line=FALSE;
- }
- }
- doc_e=doc_e->next;
- }
- QueVectU8Del(indent);
- }
- start_y=doc->cur_entry->y;
- EdReplaceTroubleAll(doc,FALSE,FALSE);
- DocGoToLine(doc,start_y+1);
- break;
- case EF_RENUM_ASM:
- if (EdGoToFun(doc,FALSE,TRUE)) {
- if (EdCurU8(doc)=='{') {
- EdCursorRight(doc);
- DocRecalc(doc);
- } else if (EdCurU8(doc)==':') {
- EdCursorRight(doc);
- if (EdCurU8(doc)==':')
- EdCursorRight(doc);
- DocRecalc(doc);
- }
- DocUnlock(doc);
- if (beep) {
- Snd(86); Sleep(150); Snd;
- Sleep(100);
- Snd(86); Sleep(150); Snd;
- }
- DocLock(doc);
- EdRenumAsm(doc);
- }
- break;
- }
-
- DocRecalc(doc);
- DocGoToLine(doc,goto_line_num);
-
- DocUnlock(doc);
- if (!unlock)
- DocLock(doc);
- if (task)
- Kill(task,FALSE);
-}
-
-U0 EdPopUpChSC(I64 *_ch,I64 *_sc)
-{
- I64 sc;
- "Press A Key\n";
- DocPut->flags|=DOCF_SIZE_MIN;
- do GetMsg(_ch,&sc,1<<MSG_KEY_DOWN);
- while (sc.u8[0]==SC_SHIFT || sc.u8[0]==SC_CTRL || sc.u8[0]==SC_ALT);
- *_sc=sc;
-}
-
-U0 EdChSC(CDoc *doc)
-{
- I64 ch,sc;
- U8 buf[STR_LEN];
- StrPrint(buf,"EdPopUpChSC(%d,%d);",&ch,&sc);
- PopUp(buf,Fs);
- if (ch==CH_BACKSPACE)
- DocPrint(doc,"CH_BACKSPACE,0x%X",sc);
- else if (ch=='\n')
- DocPrint(doc,"'\n',0x%X",sc);
- else if (CH_CTRLA<=ch<=CH_CTRLZ)
- DocPrint(doc,"CH_CTRL%C,0x%X",ch+'@',sc);
- else if (ch=='$')
- DocPrint(doc,"'$$',0x%X",sc);
- else if (ch=='\\')
- DocPrint(doc,"'\\\\',0x%X",sc);
- else if (ch=='\'')
- DocPrint(doc,"'\\\'',0x%X",sc);
- else if (ch==CH_ESC)
- DocPrint(doc,"CH_ESC,0x%X",sc);
- else if (ch==CH_SHIFT_ESC)
- DocPrint(doc,"CH_SHIFT_ESC,0x%X",sc);
- else if (ch==CH_SPACE)
- DocPrint(doc,"CH_SPACE,0x%X",sc);
- else if (ch==CH_SHIFT_SPACE)
- DocPrint(doc,"CH_SHIFT_SPACE,0x%X",sc);
- else if (Bt(char_bmp_displayable,ch))
- DocPrint(doc,"'%c',0x%X",ch,sc);
- else
- DocPrint(doc,"0x%X,0x%X",ch,sc);
-}
-
-U0 EdCodeTools(CDoc *doc)
-{
- I64 tool_action=PopUpEdFmt;
- switch (tool_action) {
- case EF_CMP_CHK:
- case EF_REINDENT:
- case EF_RENUM_ASM:
- EdCodeTools2(doc,tool_action);
- break;
- case EF_CTRL_SLIDER:
- TemplateCtrlSlider(doc);
- break;
- case EF_CH_SC:
- EdChSC(doc);
- break;
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocDblBuf.HC.HTML b/public/src/Adam/DolDoc/DocDblBuf.HC.HTML deleted file mode 100644 index 589311c..0000000 --- a/public/src/Adam/DolDoc/DocDblBuf.HC.HTML +++ /dev/null @@ -1,122 +0,0 @@ - - - - - DocDblBuf.HC - - - - - #help_index "DolDoc/Task;StdOut/Task"
-public CDoc *DocPut(CTask *task=NULL)
-{//Current document that StdOut Put() goes to.
-//Basically, StdOut unless double buffering.
- CDoc *res;
- if (!task) task=Fs;
- if (Bt(&task->task_flags,TASKf_INPUT_FILTER_TASK))
- task=task->parent_task;
- if ((res=task->put_doc) && res->doc_signature==DOC_SIGNATURE_VAL)
- return res;
- else
- return NULL;
-}
-
-public CDoc *DocDisplay(CTask *task=NULL)
-{//StdOut displayed unless double buffering.
- CDoc *res;
- if (!task) task=Fs;
- if ((res=task->display_doc) && res->doc_signature==DOC_SIGNATURE_VAL)
- return res;
- else
- return NULL;
-}
-
-public CDoc *DocBorder(CTask *task=NULL)
-{//Doc holding border of window text.
- CDoc *res;
- if (!task) task=Fs;
- if ((res=task->border_doc) && res->doc_signature==DOC_SIGNATURE_VAL)
- return res;
- else
- return NULL;
-}
-
-public CDoc *DocDblBufStart(CTask *task=NULL)
-{//See /Demo/Spy.HC
- Bool unlock_ddoc;
- CDoc *pdoc=DocPut(task),*ddoc=DocDisplay(task),*res;
- if (!pdoc || !ddoc || pdoc!=ddoc)
- res=NULL; //Already Double buffering
- else {
- if (!task) task=Fs;
- unlock_ddoc=DocLock(ddoc); //dont change during winupdate, so lock DocPut
- res=DocNew(,task);
- res->win_task =ddoc->win_task;
- res->max_entries =ddoc->max_entries;
- MemCpy(res->find_replace,ddoc->find_replace,sizeof(CEdFindText));
- MemCpy(&res->filename,&ddoc->filename,sizeof(CEdFileName));
- res->left_click_link =ddoc->left_click_link;
- res->right_click_link =ddoc->right_click_link;
- res->user_put_data =ddoc->user_put_data;
- res->user_put_key =ddoc->user_put_key;
- res->user_put_s =ddoc->user_put_s;
- res->parent_doc =ddoc->parent_doc;
- res->desc =ddoc->desc;
- res->user_data =ddoc->user_data;
- res->flags|=ddoc->flags&DOCG_DBL_BUF_FLAGS | DOCF_DONT_SHOW;
- task->put_doc=res;
- if (unlock_ddoc)
- DocUnlock(ddoc);
- }
- return res;
-}
-
-public Bool DocDblBufEnd(CTask *task=NULL)
-{//See /Demo/Spy.HC
- Bool res=FALSE;
- CDoc *pdoc=DocPut(task),*ddoc=DocDisplay(task);
- if (pdoc && ddoc && pdoc!=ddoc) {//Double buffering?
- if (!task) task=Fs;
- ddoc->flags|=DOCF_DONT_SHOW;
- pdoc->flags&=~DOCF_DONT_SHOW;
- DocLock(ddoc);
- task->display_doc=pdoc;
- DocUnlock(ddoc);
- DocDel(ddoc);
- res=TRUE;
- }
- return res;
-}
-
-public Bool DocDblBufSwap(CTask *task=NULL)
-{//See /Demo/Spy.HC
- Bool res=FALSE;
- CDoc *pdoc=DocPut(task),*ddoc=DocDisplay(task);
- if (pdoc && ddoc && pdoc!=ddoc) {//Double buffering?
- if (!task) task=Fs;
- ddoc->flags|=DOCF_DONT_SHOW;
- pdoc->flags&=~DOCF_DONT_SHOW;
- DocLock(ddoc);
- task->display_doc=pdoc;
- DocUnlock(ddoc);
- DocRst(ddoc,TRUE);
- MemCpy(ddoc->find_replace,pdoc->find_replace,sizeof(CEdFindText));
- MemCpy(&ddoc->filename,&pdoc->filename,sizeof(CEdFileName));
- ddoc->max_entries =pdoc->max_entries;
- ddoc->flags =pdoc->flags&DOCG_DBL_BUF_FLAGS |
- ddoc->flags&~DOCG_DBL_BUF_FLAGS;
- ddoc->left_click_link =pdoc->left_click_link;
- ddoc->right_click_link =pdoc->right_click_link;
- ddoc->user_put_data =pdoc->user_put_data;
- ddoc->user_put_key =pdoc->user_put_key;
- ddoc->user_put_s =pdoc->user_put_s;
- ddoc->desc =pdoc->desc;
- ddoc->user_data =pdoc->user_data;
- task->put_doc=ddoc;
- res=TRUE;
- }
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocEd.HC.HTML b/public/src/Adam/DolDoc/DocEd.HC.HTML deleted file mode 100644 index c65584b..0000000 --- a/public/src/Adam/DolDoc/DocEd.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - DocEd.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocExt.HC.HTML b/public/src/Adam/DolDoc/DocExt.HC.HTML deleted file mode 100644 index 916604e..0000000 --- a/public/src/Adam/DolDoc/DocExt.HC.HTML +++ /dev/null @@ -1,26 +0,0 @@ - - - - - DocExt.HC - - - - - #help_index "DolDoc"
-extern Bool DocEd(CDoc *doc,I64 dof_flags=0);
-extern I64 DocEntryRun(CDoc *doc,CDocEntry *doc_e,
- Bool exited,I64 *_has_action=NULL);
-extern U0 DocFormBwd(CDoc *doc,Bool giveup=FALSE);
-extern Bool DocGoToLine(CDoc *doc,I64 line_num);
-extern U0 DocLoad(CDoc *doc,U8 *src2,I64 size);
-extern U0 DocPrintAtomic(CDoc *doc=NULL,U8 *fmt,...);
-extern U0 DocPrintPartial(CDoc *doc=NULL,U8 *fmt,...);
-extern CDocEntry *DocPutS(CDoc *doc,U8 *st);
-extern U8 *DocSave(CDoc *doc,I64 *_size=NULL);
-extern I64 EdLeftClickLink(CDoc *doc,CDocEntry *doc_e);
-extern I64 PopUpPickLst(U8 *lst);
-extern I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e);
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocFile.HC.HTML b/public/src/Adam/DolDoc/DocFile.HC.HTML deleted file mode 100644 index 15561d9..0000000 --- a/public/src/Adam/DolDoc/DocFile.HC.HTML +++ /dev/null @@ -1,369 +0,0 @@ - - - - - DocFile.HC - - - - - #help_index "DolDoc/File"
-
-public U0 DocLoad(CDoc *doc,U8 *src2,I64 size)
-{//Fetch doc from raw mem buf.
- I64 i;
- U8 *src;
- Bool unlock=DocLock(doc);
- CDocBin *tmpb;
- doc->find_replace->filter_lines=0;
- if (src2) {
- DocPutS(doc,src2); //Too big DocPrint() is wasteful.
- src=src2+StrLen(src2)+1;
- i=size-(offset(CDocBin.end)-offset(CDocBin.start));
- while (src<=src2+i) {
- tmpb=CAlloc(sizeof(CDocBin),doc->mem_task);
- MemCpy(&tmpb->start,src,offset(CDocBin.end)-offset(CDocBin.start));
- src+=offset(CDocBin.end)-offset(CDocBin.start);
- tmpb->data=MAlloc(tmpb->size,doc->mem_task);
- if (tmpb->size) {
- MemCpy(tmpb->data,src,tmpb->size);
- src+=tmpb->size;
- }
- QueIns(tmpb,doc->bin_head.last);
- if (tmpb->num>=doc->cur_bin_num)
- doc->cur_bin_num=tmpb->num+1;
- }
- }
- if (!(doc->flags & (DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_TABS)))
- DocBinsValidate(doc);
- DocTop(doc); //Calls DocRecalc(). DOCT_CURSOR will be set.
- if (unlock)
- DocUnlock(doc);
-}
-
-public CDoc *DocRead(U8 *name=NULL,I64 flags=0)
-{//Fetch doc from disk. See flags.
- CDoc *doc=DocNew;
- U8 *src,*name2;
- I64 size=0;
- CDirContext *dirc;
- if (!name) name=blkdev.tmp_filename;
- doc->flags|=flags;
- name2=FileNameAbs(name);
- StrCpy(doc->filename.name,name2);
- if (src=FileRead(name2,&size,&doc->file_attr)) {
- if (dirc=DirContextNew(name2)) {
- DocLoad(doc,src,size);
- DirContextDel(dirc);
- }
- Free(src);
- }
- Free(name2);
- return doc;
-}
-
-public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
-{//Store doc to raw mem buf.
- CDocEntry *doc_e,*doc_e1;
- CDocBin *b;
- Bool unlock=DocLock(doc);
- I64 ch,cnt=1;//terminator
- U8 *st,*res,*dst,*src;
-
- if (!(doc->flags & (DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_TABS)))
- DocBinsValidate(doc);
- if (doc->flags&DOCF_NO_CURSOR)
- DocRecalc(doc);
- else {
- DocRecalc(doc,RECALCF_ADD_CURSOR);
- if (doc->head.next->type_u8==DOCT_CURSOR)
- DocEntryDel(doc,doc->head.next); //If no cursor, DocLoad() puts at top.
- }
- for (doc_e=doc->head.next;doc_e!=doc;doc_e=doc_e->next) {
- if (!Bt(doldoc.type_flags_data,doc_e->type_u8)) {
- switch (doc_e->type_u8) {
- case DOCT_TAB:
- case DOCT_PAGE_BREAK:
- case DOCT_CURSOR:
- cnt++;
- break;
- case DOCT_NEW_LINE:
- if (doc->flags&DOCF_CARRIAGE_RETURN)
- cnt+=2;
- else
- cnt++;
- break;
- case DOCT_SOFT_NEW_LINE:
- break;
- case DOCT_TEXT:
- if (!(doc_e->de_flags & ~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|
- DOCEF_HIGHLIGHT|DOCEF_SKIP|DOCEF_FILTER_SKIP))&&
- !(doc_e->type&DOCG_BL_IV_UL)) {
- cnt+=StrLen(doc_e->tag);
- if (!(doc->flags & (DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_TABS)) ||
- doc->flags&DOCF_DBL_DOLLARS)
- cnt+=StrOcc(doc_e->tag,'$');
- break;
- }
- default:
- st=Doc2PlainText(doc,doc_e);
- cnt+=StrLen(st)+2;
- Free(st);
- }
- }
- }
- for (b=doc->bin_head.next;b!=&doc->bin_head;b=b->next)
- if (b->use_cnt>b->tmp_use_cnt)
- cnt+=offset(CDocBin.end)-offset(CDocBin.start)+b->size;
- res=MAlloc(cnt);
- dst=res;
- doc_e=doc->head.next;
- while (doc_e!=doc) {
- doc_e1=doc_e->next;
- if (!Bt(doldoc.type_flags_data,doc_e->type_u8))
- switch (doc_e->type_u8) {
- case DOCT_CURSOR:
- DocEntryDel(doc,doc_e);
- *dst++=CH_CURSOR;
- break;
- case DOCT_TAB:
- *dst++='\t';
- break;
- case DOCT_NEW_LINE:
- if (doc->flags&DOCF_CARRIAGE_RETURN)
- *dst++='\r';
- *dst++='\n';
- break;
- case DOCT_SOFT_NEW_LINE:
- break;
- case DOCT_TEXT:
- if (!(doc_e->de_flags & ~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|
- DOCEF_HIGHLIGHT|DOCEF_SKIP|DOCEF_FILTER_SKIP)) &&
- !(doc_e->type&DOCG_BL_IV_UL)) {
- src=doc_e->tag;
- while (ch=*src++) {
- *dst++=ch;
- if (ch=='$' && (!(doc->flags & (DOCF_PLAIN_TEXT|
- DOCF_PLAIN_TEXT_TABS)) || doc->flags&DOCF_DBL_DOLLARS))
- *dst++=ch;
- }
- break;
- }
- default:
- *dst++='$';
- st=Doc2PlainText(doc,doc_e);
- StrCpy(dst,st);
- dst+=StrLen(st);
- *dst++='$';
- Free(st);
- }
- doc_e=doc_e1;
- }
- *dst++=0;
- b=doc->bin_head.next;
- if (b!=&doc->bin_head) {
- do {
- if (b->use_cnt>b->tmp_use_cnt) {
- MemCpy(dst,&b->start,offset(CDocBin.end)-offset(CDocBin.start));
- dst+=offset(CDocBin.end)-offset(CDocBin.start);
- MemCpy(dst,b->data,b->size);
- dst+=b->size;
- }
- b=b->next;
- } while (b!=&doc->bin_head);
- } else
- cnt--; //No terminator
- if (_size) *_size=cnt;
- if (unlock)
- DocUnlock(doc);
- return res;
-}
-
-public Bool DocWrite(CDoc *doc,Bool prompt=FALSE)
-{//Store doc to disk.
- I64 size;
- U8 *buf;
- if (prompt && !DocForm(&doc->filename) ||
- doc->filename.name[0]=='A' && doc->filename.name[2]==':')
- return FALSE; //CANCEL || LK_DOC,LK_DOC_ANCHOR,LK_DOC_FIND,LK_DOC_LINE?
- buf=DocSave(doc,&size);
- FileWrite(doc->filename.name,buf,size,0,doc->file_attr);
- Free(buf);
- return TRUE;
-}
-
-#help_index "DolDoc"
-public U0 DocInsDoc(CDoc *doc=NULL,CDoc *doc2)
-{//Insert copy of doc2 into doc at insert pt, cur_entry.
-//TODO: DocRst
- U8 *dst;
- Bool unlock_doc,unlock_doc2=DocLock(doc2);
- CDocEntry *doc_ne,*doc_e=doc2->head.next,*doc_ce;
- if (!doc) doc=DocPut;
- unlock_doc=DocLock(doc),
- DocRemSoftNewLines(doc,NULL);
- doc_ce=doc->cur_entry;
- if (doc_ce->type_u8==DOCT_TEXT && doc->cur_col>doc_ce->min_col) {
- if (doc->cur_col<doc_ce->max_col) {
- dst=doc_ce->tag+doc->cur_col;
- doc_ne=DocEntryNewTag(doc,doc_ce,dst);
- *dst=0;
- doc_ne->type=DOCT_TEXT | doc_ce->type & 0xFFFFFF00;
- doc_ce->max_col=doc->cur_col;
- QueIns(doc_ne,doc_ce);
- doc->cur_entry=doc_ne;
- doc->cur_col=doc_ne->min_col;
- } else
- if (doc_ce!=doc)
- doc->cur_entry=doc_ce->next;
- }
- while (doc_e!=doc2) {
- if (doc_e->type_u8!=DOCT_SOFT_NEW_LINE) {
- doc_ne=DocEntryCopy(doc,doc_e);
- QueIns(doc_ne,doc->cur_entry->last);
- }
- doc_e=doc_e->next;
- }
- DocRecalc(doc);
- if (unlock_doc2)
- DocUnlock(doc2);
- if (unlock_doc)
- DocUnlock(doc);
-}
-
-#help_index "DolDoc/Compiler;Compiler/Directive"
-public U0 StreamDoc(CDoc *doc)
-{//Inject doc into compile stream. Use inside #exe{}.
-//TODO: DocRst
- Bool unlock_doc=DocLock(doc);
- CDocEntry *doc_e=doc->head.next;
- while (doc_e!=doc) {
- if (doc_e->type_u8==DOCT_TEXT)
- StreamPrint("%s",doc_e->tag);
- else if (doc_e->type_u8==DOCT_NEW_LINE)
- StreamPrint("\n");
- else if (doc_e->type_u8==DOCT_TAB)
- StreamPrint("\t");
- doc_e=doc_e->next;
- }
- if (unlock_doc)
- DocUnlock(doc);
-}
-
-#help_index "DolDoc"
-Bool DocCaptureUndo(CDoc *doc,Bool force=FALSE)
-{
- Bool res=FALSE,unlock;
- I64 time_stamp,flags;
- CDocUndo *u;
- if (doc->flags&DOCF_ALLOW_UNDO) {
- unlock=DocLock(doc);
- time_stamp=GetTSC;
- if (doc->flags&DOCF_UNDO_DIRTY &&
- time_stamp>doc->undo_head.last->time_stamp+cnts.time_stamp_freq<<4 ||
- force) {
- u=CAlloc(sizeof(CDocUndo),doc->mem_task);
- u->time_stamp=time_stamp;
- flags=doc->flags;
- doc->flags&=~DOCF_NO_CURSOR;
- u->body=DocSave(doc,&u->size);
- doc->flags=flags;
- QueIns(u,doc->undo_head.last);
- doc->flags&=~DOCF_UNDO_DIRTY;
- doc->undo_cnt++;
- u->doc_flags=doc->flags;
- res=TRUE;
- if (doc->flags&DOCF_AUTO_SAVE)
- DocWrite(doc);
- }
- if (unlock)
- DocUnlock(doc);
- }
- return res;
-}
-
-U0 DocUndoRestore(CDoc *doc)
-{
- Bool unlock=DocLock(doc);
- CDocUndo *u=doc->undo_head.last,*u_next,*u_last;
- if (u!=&doc->undo_head) {
- QueRem(u);
- u_next=doc->undo_head.next;
- u_last=doc->undo_head.last;
- QueInit(&doc->undo_head);
- DocRst(doc,TRUE);
- doc->flags=u->doc_flags&~DOCF_NO_CURSOR;
- DocLoad(doc,u->body,u->size);
- doc->flags=u->doc_flags;
- DocUndoDel(doc,u);
- doc->undo_head.next=u_next;
- doc->undo_head.last=u_last;
- }
- DocUndoCntSet(doc);
- doc->flags&=~DOCF_UNDO_DIRTY;
- if (unlock)
- DocUnlock(doc);
-}
-
-#help_index "Graphics/GR Files;DolDoc/Output;StdOut/DolDoc"
-public Bool DocType(CDoc *doc=NULL,U8 *filename,I64 trailing_new_lines=1)
-{//Output txt or graphic file to document.
- Bool res=FALSE;
- CDoc *doc2;
- if (!doc && !(doc=DocPut) || doc->doc_signature!=DOC_SIGNATURE_VAL)
- return FALSE;
- if (FilesFindMatch(filename,FILEMASK_TXT)) {
- doc2=DocRead(filename);
- DocInsDoc(doc,doc2);
- if (IsRaw)
- DocDump(doc2,100000);
- DocDel(doc2);
- res=TRUE;
- } else if (FilesFindMatch(filename,"*.GR*")) {
- DocGR(doc,filename);
- res=TRUE;
- }
- if (res)
- DocPrint(doc,"%h*c",trailing_new_lines,'\n');
- return res;
-}
-
-#help_index "Graphics/GR Files;"\
- "File/Cmd Line (Typically);DolDoc/Cmd Line (Typically);"\
- "StdOut;Cmd Line (Typically)"
-public Bool Type(U8 *filename,I64 trailing_new_lines=1)
-{//Output txt or graphic file to command line.
- return DocType(,filename,trailing_new_lines);
-}
-
-#help_index "DolDoc/File"
-
-public U8 *DocLineRead(U8 *filename,I64 line,CTask *mem_task=NULL)
-{//Extract line from stored doc file. (Slow.)
- U8 *res=NULL;
- CDoc *doc=DocRead(filename,DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR);
- if (DocGoToLine(doc,line) && doc->cur_entry->type_u8==DOCT_TEXT)
- res=StrNew(doc->cur_entry->tag,mem_task);
- DocDel(doc);
- return res;
-}
-
-public U8 *DocLineWrite(U8 *filename,I64 line,U8 *st)
-{//Write line to stored doc file. (Slow.)
- U8 *res=NULL;
- CDoc *doc=DocRead(filename,DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR);
- if (DocGoToLine(doc,line)) {
- if (doc->cur_entry->type_u8==DOCT_TEXT) {
- Free(doc->cur_entry->tag);
- doc->cur_entry->tag=StrNew(st);
- } else
- DocPrint(doc,"%s",st);
- DocTop(doc);
- DocWrite(doc);
- }
- DocDel(doc);
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocFind.HC.HTML b/public/src/Adam/DolDoc/DocFind.HC.HTML deleted file mode 100644 index ffe0ca1..0000000 --- a/public/src/Adam/DolDoc/DocFind.HC.HTML +++ /dev/null @@ -1,596 +0,0 @@ - - - - - DocFind.HC - - - - - #help_index "DolDoc/Editor"
-
-public Bool DocGoToLine(CDoc *doc,I64 line_num) //one based
-{//Nearest to specified line num. Move cur_entry & center.
- Bool res=FALSE,unlock;
- if (doc) {
- unlock=DocLock(doc);
- doc->x=0;
- doc->y=line_num-1;
- DocRecalc(doc,RECALCt_FIND_CURSOR);
- DocCenter(doc);
- if (doc->cur_entry->y==line_num-1)
- res=TRUE;
- if (unlock)
- DocUnlock(doc);
- }
- return res;
-}
-
-public Bool DocFind(CDoc *haystack_doc,I64 start_line_num=I64_MIN,
-U8 *needle,I64 match=1)
-{//Find str by searching tags. Move cur_entry & center.
- Bool res=FALSE,unlock;
- CDocEntry *doc_e;
- U8 *ptr;
- I64 i;
- if (haystack_doc) {
- unlock=DocLock(haystack_doc);
- if (start_line_num==I64_MIN) {
- res=TRUE;
- doc_e=haystack_doc->head.next;
- } else {
- res=DocGoToLine(haystack_doc,start_line_num);
- doc_e=haystack_doc->cur_entry;
- }
- if (res) {
- if (needle) {
- res=FALSE;
- while (doc_e!=haystack_doc) {
- if (doc_e->de_flags&DOCEF_TAG && doc_e->tag &&
-//TODO: handle multi-DocEntry strs
- (ptr=StrIMatch(needle,doc_e->tag))) {
- i=ptr-doc_e->tag;
- if (!--match) {
- haystack_doc->cur_entry=doc_e;
- if (i<doc_e->min_col) i=doc_e->min_col;
- if (i>doc_e->max_col) i=doc_e->max_col;
- haystack_doc->cur_col=i;
- res=TRUE;
- break;
- }
- }
- doc_e=doc_e->next;
- }
- } else
- res=FALSE;
- }
- if (!res) DocBottom(haystack_doc);
- DocCenter(haystack_doc);
- if (unlock)
- DocUnlock(haystack_doc);
- }
- return res;
-}
-
-public Bool DocAnchorFind(CDoc *haystack_doc,U8 *needle_str)
-{//Find named anchor. Move cur_entry & center.
- Bool res=FALSE,unlock;
- CDocEntry *doc_e;
- if (haystack_doc) {
- unlock=DocLock(haystack_doc);
- doc_e=haystack_doc->head.next;
- if (needle_str)
- while (doc_e!=haystack_doc) {
- if (doc_e->type_u8==DOCT_ANCHOR && doc_e->de_flags & DOCEF_AUX_STR) {
- if (!StrCmp(needle_str,doc_e->aux_str)) {
- haystack_doc->cur_entry=doc_e;
- haystack_doc->cur_col=doc_e->min_col;
- res=TRUE;
- break;
- }
- }
- doc_e=doc_e->next;
- }
- if (!res) DocBottom(haystack_doc);
- DocCenter(haystack_doc);
- if (unlock)
- DocUnlock(haystack_doc);
- }
- return res;
-}
-
-public U0 EdFindNext(CDoc *doc)
-{//Editor F3 find next, possibly doing replaces.
- Bool unlock=DocLock(doc);
- U8 *ptr,*ptr2,*ptr3;
- CDocEntry *doc_ce=doc->cur_entry,*doc_e=doc_ce;
- I64 sf_flags;
- if (doc->find_replace->match_case)
- sf_flags=0;
- else
- sf_flags=SFF_IGNORE_CASE;
- if (doc->find_replace->whole_labels)
- sf_flags|=SFG_WHOLE_LABELS;
- do {
- if (doc_e!=doc) {
- if (doc_e->de_flags&DOCEF_TAG && doc_e->tag &&
- !(doc_e->de_flags&(DOCEG_DONT_EDIT|DOCEF_FILTER_SKIP))) {
- if (doc_e->type & DOCET_SEL ||
- !doc->find_replace->scan_sel_text) {
- if (doc->find_replace->scan_fwd) {
- if (doc_e==doc_ce) {
- ptr=doc_ce->tag+doc->cur_col+1;
- if (ptr-doc_ce->tag>=doc_ce->max_col)
- goto fn_skip;
- if (ptr-doc_ce->tag<doc_ce->min_col)
- ptr=doc_ce->tag+doc_ce->min_col;
- } else
- ptr=doc_e->tag;
- if (ptr=StrFind(doc->find_replace->find_text,ptr,sf_flags)) {
- doc->cur_entry=doc_e;
- doc->cur_col=ptr-doc_e->tag;
- if (doc->cur_col>=doc_e->max_col)
- doc->cur_col=doc_e->max_col-1;
- if (doc->cur_col<doc_e->min_col)
- doc->cur_col=doc_e->min_col;
- DocCenter(doc);
- if (unlock)
- DocUnlock(doc);
- return;
- }
- } else {
- ptr2=NULL;
- ptr=doc_e->tag+doc_e->min_col;
- if (doc_e==doc_ce)
- ptr3=doc_ce->tag+doc->cur_col;
- else
- ptr3=doc_e->tag+doc_e->max_col;
- while (ptr=StrFind(doc->find_replace->find_text,ptr,sf_flags)) {
- if (ptr>=ptr3)
- break;
- ptr2=ptr++;
- }
- if (ptr2 && ptr2<ptr3) {
- doc->cur_entry=doc_e;
- doc->cur_col=ptr2-doc_e->tag;
- if (doc->cur_col>=doc_e->max_col)
- doc->cur_col=doc_e->max_col-1;
- if (doc->cur_col<doc_e->min_col)
- doc->cur_col=doc_e->min_col;
- DocCenter(doc);
- if (unlock)
- DocUnlock(doc);
- return;
- }
- }
- }
- }
- }
-fn_skip:
- if (doc->find_replace->scan_fwd)
- doc_e=doc_e->next;
- else
- doc_e=doc_e->last;
- } while (doc_e!=doc_ce);
- if (unlock)
- DocUnlock(doc);
-}
-
-public U0 EdSelAll(CDoc *doc,Bool sel)
-{//Set state of DOCET_SEL on all entries.
- Bool unlock=DocLock(doc);
- CDocEntry *doc_e=doc->head.next;
- while (doc_e!=doc) {
- BEqu(&doc_e->type,DOCEt_SEL,sel);
- doc_e=doc_e->next;
- }
- if (unlock)
- DocUnlock(doc);
-}
-
-public Bool EdFindPaired(CDoc *doc,U8 plus,U8 minus,
-Bool fwd,Bool abort_on_dbl_colon=FALSE)
-{//Find { } or ( ) pair. Move cur_entry & center.
- Bool unlock=DocLock(doc),res=FALSE;
- U8 *ptr;
- I64 ch,levels=0,colons=0,original_col=doc->cur_col;
- CDocEntry *doc_ce=doc->cur_entry,*doc_e=doc_ce,*original_ce=doc_ce;
- if (abort_on_dbl_colon && EdCurU8(doc)==':')
- colons=1;
- else
- colons=0;
- do {
- if (doc_e!=doc) {
- if (doc_e->de_flags&DOCEF_TAG && doc_e->tag &&
- !(doc_e->de_flags&DOCEF_FILTER_SKIP)) {
- if (fwd) {
- if (doc_e==doc_ce)
- ptr=doc_e->tag+doc->cur_col+1;
- else
- ptr=doc_e->tag;
- if (ptr-doc_e->tag<doc_e->min_col)
- ptr=doc_e->tag+doc_e->min_col;
- if (ptr-doc_e->tag>=doc_e->max_col)
- goto pa_skip;
- while (ch=*ptr++)
- if (abort_on_dbl_colon && ch==':') {
- if (++colons==2) {
- doc->cur_entry=doc_e;
- doc->cur_col=ptr-doc_e->tag-1;
- EdCursorLeft(doc);
- res=FALSE;
- goto pa_done;
- }
- } else {
- colons=0;
- if (ch==plus)
- levels++;
- else if (ch==minus) {
- if (!levels--) {
- doc->cur_entry=doc_e;
- doc->cur_col=ptr-doc_e->tag-1;
- res=doc->cur_entry!=original_ce ||
- doc->cur_col!=original_col;
- goto pa_done;
- }
- }
- }
- } else {
- if (doc_e==doc_ce) {
- ptr=doc_e->tag+doc->cur_col-1;
- if (ptr-doc_e->tag>=doc_e->max_col)
- ptr=doc_e->tag+doc_e->max_col-1;
- } else
- ptr=doc_e->tag+doc_e->max_col-1;
- if (ptr-doc_e->tag<doc_e->min_col)
- goto pa_skip;
- while (ptr>=doc_e->tag+doc_e->min_col) {
- ch=*ptr--;
- if (abort_on_dbl_colon && ch==':') {
- if (++colons==2) {
- doc->cur_entry=doc_e;
- doc->cur_col=ptr-doc_e->tag+1;
- res=FALSE;
- goto pa_done;
- }
- } else {
- colons=0;
- if (ch==plus)
- levels++;
- else if (ch==minus) {
- if (!levels--) {
- doc->cur_entry=doc_e;
- doc->cur_col=ptr-doc_e->tag+1;
- res=doc->cur_entry!=original_ce ||
- doc->cur_col!=original_col;
- goto pa_done;
- }
- }
- }
- }
- }
- }
- }
-pa_skip:
- if (fwd)
- doc_e=doc_e->next;
- else
- doc_e=doc_e->last;
- } while (doc_e!=doc_ce);
-pa_done:
- DocRecalc(doc);
- DocCenter(doc);
- if (unlock)
- DocUnlock(doc);
- return res;
-}
-
-public Bool EdGoToFun(CDoc *doc,Bool fwd,Bool abort_on_dbl_colon)
-{//Move cur_entry to start of cur fun and center.(Shoddy)
- Bool unlock=DocLock(doc),res=FALSE;
- I64 ch,levels,colons;
- if (fwd) {
- levels=0;
- colons=0;
- while (doc->cur_entry!=doc) {
- ch=EdCurU8(doc);
- if (abort_on_dbl_colon && ch==':') {
- if (++colons==2) {
- EdCursorLeft(doc);
- break;
- }
- } else {
- colons=0;
- if (ch=='{')
- levels++;
- else if (ch=='}' && !levels--)
- break;
- }
- EdCursorRight(doc);
- }
- DocRecalc(doc);
- if (doc->cur_entry!=doc)
- res=TRUE;
- } else {
- while (EdFindPaired(doc,'}','{',FALSE,abort_on_dbl_colon));
- if (doc->cur_entry!=doc) {
- ch=EdCurU8(doc);
- if (abort_on_dbl_colon && ch==':')
- res=TRUE;
- else {
- if (ch=='{')
- res=TRUE;
- }
- }
- }
- if (unlock)
- DocUnlock(doc);
- return res;
-}
-
-public U0 EdSelFun(CDoc *doc,Bool abort_on_dbl_colon=FALSE)
-{//Set DOCET_SEL on all entries in cur fun.
- Bool unlock=DocLock(doc);
- U8 *ptr;
- I64 ch,levels=0,colons=0;
- CDocEntry *doc_e;
- EdSelAll(doc,FALSE);
- EdGoToFun(doc,FALSE,abort_on_dbl_colon);
- if (EdCurU8(doc)=='{')
- levels--;
- else if (abort_on_dbl_colon && EdCurU8(doc)==':') {
- EdCursorRight(doc);
- if (EdCurU8(doc)==':')
- EdCursorRight(doc);
- }
- doc_e=doc->cur_entry;
- while (doc_e!=doc) {
- doc_e->type|=DOCET_SEL;
- if (doc_e->de_flags&DOCEF_TAG && doc_e->tag) {
- ptr=doc_e->tag;
- if (doc_e==doc->cur_entry)
- ptr+=doc->cur_col;
- while (ch=*ptr++)
- if (abort_on_dbl_colon && ch==':') {
- if (++colons==2)
- goto sf_done;
- } else {
- colons=0;
- if (ch=='{')
- levels++;
- else if (ch=='}' && !levels--)
- goto sf_done;
- }
- }
- doc_e=doc_e->next;
- }
-sf_done:
- DocRecalc(doc);
- if (unlock)
- DocUnlock(doc);
-}
-
-#define RSAC_REPLACE 0
-#define RSAC_SKIP 1
-#define RSAC_ALL 2
-
-I64 PopUpReplaceSkipAllCancel(U8 *header=NULL,U8 *footer=NULL)
-{
- I64 i;
- CDoc *doc=DocNew;
- if (header) DocPrint(doc,"%s",header);
- DocPrint(doc,"$CM+LX,1,4$$BT,\"REPLACE\",LE=RSAC_REPLACE$"
- "$CM+LX,17,0$$BT,\"SKIP\",LE=RSAC_SKIP$"
- "$CM+LX,1,3$$BT,\"ALL\",LE=RSAC_ALL$"
- "$CM+LX,17,0$$BT,\"CANCEL\",LE=DOCM_CANCEL$\n");
- if (footer) DocPrint(doc,"%s",footer);
- i=PopUpMenu(doc);
- DocDel(doc);
- return i;
-}
-
-I64 EdFindReplace(CDoc *doc)
-{
- Bool found,unlock;
- I64 cmd,i,j,plen,rlen,dlen,res=-1,sf_flags;
- U8 *src,*dst,*dst2;
- CDocEntry *doc_ce,*doc_e,*doc_marker=NULL;
- if (doc->find_replace->pmt)
- cmd=RSAC_REPLACE;
- else
- cmd=RSAC_ALL;
- if (!doc->find_replace->pmt || DocForm(doc->find_replace)) {
- res=0;
- unlock=DocLock(doc);
- if (doc->find_replace->match_case || doc->find_replace->local_var)
- sf_flags=0;
- else
- sf_flags=SFF_IGNORE_CASE;
- if (doc->find_replace->whole_labels || doc->find_replace->local_var)
- sf_flags|=SFG_WHOLE_LABELS;
-
- if (i=doc->find_replace->filter_lines) {
- doc_ce=doc->head.next;
- while (doc_ce!=doc) {
- if (doc_ce->de_flags&DOCEF_TAG && doc_ce->tag &&
- !(doc_ce->de_flags&DOCEF_FILTER_SKIP) &&
- StrFind(doc->find_replace->find_text,doc_ce->tag,sf_flags)) {
- doc_ce->type|=DOCET_SEL;
- res++;
- } else
- doc_ce->type&=~DOCET_SEL;
- doc_ce=doc_ce->next;
- }
-
- doc_ce=doc->head.next;
- while (doc_ce!=doc) {
- if (!(doc_ce->de_flags&DOCEF_FILTER_SKIP)) {
- found=FALSE;
-
- doc_e=doc_ce;
- while (doc_e!=doc && doc_e->y>doc_ce->y-i) {
- if (doc_e->type&DOCET_SEL) {
- found=TRUE;
- break;
- } else
- doc_e=doc_e->last;
- }
-
- if (!found) {
- doc_e=doc_ce;
- while (doc_e!=doc && doc_e->y<doc_ce->y+i) {
- if (doc_e->type&DOCET_SEL) {
- found=TRUE;
- break;
- } else
- doc_e=doc_e->next;
- }
- }
-
- if (!found)
- doc_ce->de_flags|=DOCEF_FILTER_SKIP;
- }
-
- doc_ce=doc_ce->next;
- }
- EdSelAll(doc,FALSE);
- goto fr_unlock_done;
- }
-
- if (doc->find_replace->local_var)
- EdSelFun(doc);
-
- if (!doc->find_replace->replace && !doc->find_replace->local_var) {
- EdFindNext(doc);
- goto fr_unlock_done;
- }
- plen=StrLen(doc->find_replace->find_text);
- if (!plen)
- goto fr_unlock_done;
- rlen=StrLen(doc->find_replace->replace_text);
- if (doc->head.next!=doc) {
- doc_e=doc_marker=DocSplitTag(doc,doc->cur_entry,doc->cur_col,
- doc->cur_entry->x+doc->cur_col,doc->cur_entry->y,DOCT_MARKER);
- do {
- if (doc_e==doc) {
- if (doc->find_replace->scan_fwd)
- doc_e=doc_e->next;
- else
- doc_e=doc_e->last;
- if (doc_e==doc_marker)
- break;
- }
- if (doc_e->type_u8==DOCT_TEXT &&
- !(doc_e->de_flags&(DOCEG_DONT_EDIT|DOCEF_FILTER_SKIP)) &&
- (doc_e->type & DOCET_SEL ||
- !doc->find_replace->scan_sel_text&&
- !doc->find_replace->local_var)) {
- src=doc_e->tag;
- while (src) {
- src=StrFind(doc->find_replace->find_text,src,sf_flags);
- if (src) {
- doc->cur_col=src-doc_e->tag;
- doc->cur_entry=doc_e;
- if (cmd!=RSAC_ALL)
- DocCenter(doc);
- if (cmd!=RSAC_ALL) {
- DocUnlock(doc);
- cmd=PopUpReplaceSkipAllCancel("");
- DocLock(doc);
- if (cmd<0)
- goto fr_unlock_done;
- }
- doc_e=doc->cur_entry;
- src=doc->cur_col+doc_e->tag;
- if (cmd==RSAC_REPLACE || cmd==RSAC_ALL) {
- dlen=StrLen(doc_e->tag);
- doc_e->max_col=dlen+rlen-plen;
- dst=MAlloc(doc_e->max_col+1,doc->mem_task);
- dst2=dst;
- j=src-doc_e->tag;
- for (i=0;i<j;i++)
- *dst++=doc_e->tag[i];
- for (i=0;i<rlen;i++)
- *dst++=doc->find_replace->replace_text[i];
- src=dst;
- for (i=j+plen;i<=dlen;i++)
- *dst++=doc_e->tag[i];
- Free(doc_e->tag);
- doc_e->tag=dst2;
- doc->cur_col=src-doc_e->tag;
- doc->cur_entry=doc_e;
- if (cmd!=RSAC_ALL) {
- DocRemSoftNewLines(doc,doc->cur_entry);
- DocRecalc(doc);
- }
- doc_e=doc->cur_entry;
- src=doc->cur_col+doc_e->tag;
- res++;
- } else
- src++;
- }
- }
- }
- if (doc->find_replace->scan_fwd)
- doc_e=doc_e->next;
- else
- doc_e=doc_e->last;
- } while (doc_e!=doc_marker);
- }
-fr_unlock_done:
- if (doc_marker)
- DocEntryDel(doc,doc_marker);
- DocRemSoftNewLines(doc,NULL);
- DocRecalc(doc);
- DocCenter(doc);
- if (unlock)
- DocUnlock(doc);
- }
- return res;
-}
-
-public I64 EdReplace(CDoc *doc,U8 *find,U8 *replace,
-Bool sel=TRUE,Bool match_case=TRUE,Bool whole_labels=FALSE)
-{//Find & replace using editor's cmd.
- CEdFindText old_find_replace;
- Bool unlock;
- I64 i,res=-1;
- if (!doc) return -1;
- unlock=DocLock(doc);
- MemCpy(&old_find_replace,doc->find_replace,sizeof(CEdFindText));
- MemSet(doc->find_replace,0,sizeof(CEdFindText));
- i=StrLen(find);
- if (i<sizeof(CEdFindText.find_text)) {
- MemCpy(doc->find_replace->find_text,find,i+1);
- i=StrLen(replace);
- if (i<sizeof(CEdFindText.replace_text)) {
- MemCpy(doc->find_replace->replace_text,replace,i+1);
- doc->find_replace->replace=TRUE;
- doc->find_replace->scan_sel_text=sel;
- doc->find_replace->match_case=match_case;
- doc->find_replace->whole_labels=whole_labels;
- doc->find_replace->pmt=FALSE;
- res=EdFindReplace(doc);
- }
- }
- MemCpy(doc->find_replace,&old_find_replace,sizeof(CEdFindText));
- if (unlock)
- DocUnlock(doc);
- return res;
-}
-
-class CEdLineGoTo
-{
- I64 line format "$DA,A=\"Go to Line:%d\"$";
-};
-
-U0 EdGoToLine(CDoc *doc)
-{//Prompt with form and go to line num.
- CEdLineGoTo gtl;
- gtl.line=1;
- if (DocForm(&gtl))
- DocGoToLine(doc,gtl.line);
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocForm.HC.HTML b/public/src/Adam/DolDoc/DocForm.HC.HTML deleted file mode 100644 index 7835341..0000000 --- a/public/src/Adam/DolDoc/DocForm.HC.HTML +++ /dev/null @@ -1,356 +0,0 @@ - - - - - DocForm.HC - - - - - #help_index "DolDoc/Form"
-
-U0 DocFormFwd(CDoc *doc,Bool giveup=FALSE)
-{
- CDocEntry *doc_e=doc->cur_entry,*doc_e2=doc_e;
- if (doc->flags & DOCF_FORM) {
- if (doc_e==doc) goto ff_recover;
- while (!Bt(doldoc.type_flags_form,doc_e->type_u8) &&
- !(doc_e->de_flags&DOCEF_LINK) ||
- doc_e->de_flags&DOCEF_SKIP_IN_FORM) {
- doc_e=doc_e->next;
- if (doc_e==doc) {
-ff_recover:
- doc->cur_col=0;
- if (!giveup) {
- doc->cur_entry=doc_e->last;
- DocFormBwd(doc,TRUE);
- } else
- doc->cur_entry=doc;
- return;
- }
- }
- }
- while (doc_e->type_u8==DOCT_INDENT)
- doc_e=doc_e->next;
- if (doc_e!=doc_e2) {
- doc->cur_col=doc_e->min_col;
- doc->cur_entry=doc_e;
- }
-}
-
-U0 DocFormBwd(CDoc *doc,Bool giveup=FALSE)
-{
- CDocEntry *doc_e=doc->cur_entry,*doc_e2=doc_e;
- if (doc->flags & DOCF_FORM) {
- while (!Bt(doldoc.type_flags_form,doc_e->type_u8) &&
- !(doc_e->de_flags&DOCEF_LINK) ||
- doc_e->de_flags&DOCEF_SKIP_IN_FORM) {
- doc_e=doc_e->last;
- if (doc_e==doc) {
- doc->cur_col=0;
- if (!giveup) {
- doc->cur_entry=doc_e->next;
- DocFormFwd(doc,TRUE);
- } else
- doc->cur_entry=doc;
- return;
- }
- }
- }
- while (doc_e->type_u8==DOCT_INDENT)
- doc_e=doc_e->next;
- if (doc_e!=doc_e2) {
- doc->cur_col=doc_e->min_col;
- doc->cur_entry=doc_e;
- }
-}
-
-U0 DocDataFmt(CDoc *doc,CDocEntry *doc_e,I64 d=DOCM_CANCEL)
-{
- I64 i;
- U8 *ptr,*ptr2;
- CHashDefineStr *tmph;
- if (doc_e->type_u8==DOCT_DATA && doc_e->de_flags&DOCEF_AUX_STR ||
- doc_e->type_u8==DOCT_CHECK_BOX || doc_e->de_flags & DOCEF_LST) {
- if (d==DOCM_CANCEL) {
- if (doc_e->de_flags&DOCEF_DEREF_DATA &&
- !(doc_e->de_flags&DOCEF_REMALLOC_DATA)) {
- if (!(ptr=doc_e->data)) return;
- } else
- ptr=&doc_e->data;
- switch (doc_e->raw_type) {
- case RT_I0:
- case RT_U0: d=0; break;
- case RT_I8: d=*ptr(I8 *); break;
- case RT_U8: d=*ptr(U8 *); break;
- case RT_I16: d=*ptr(I16 *); break;
- case RT_U16: d=*ptr(U16 *); break;
- case RT_I32: d=*ptr(I32 *); break;
- case RT_U32: d=*ptr(U32 *); break;
- default: d=*ptr(I64 *);
- }
- }
- if (doc_e->type_u8==DOCT_DATA) {
- if (doc_e->de_flags & DOCEF_REMALLOC_DATA) {
- ptr=MStrPrint(doc_e->aux_str,d,doc_e->my_fmt_data);
- i=StrLen(ptr);
- if (!doc_e->data) {
- doc_e->data=CAlloc(2,doc->mem_task);
- doc_e->len=MSize(doc_e->data)-2;
- }
- if (doc_e->len+doc_e->min_col>i)
- MemCpy(doc_e->tag,ptr,i+1);
- else {
- ptr2=MAlloc(i+8,doc->mem_task);
- doc_e->len=MSize(ptr2)-doc_e->min_col-2; //See $LK,"DataTagWidth",A="FA:::/Adam/DolDoc/DocPlain.HC,DataTagWidth"$
- MemCpy(ptr2,ptr,i+1);
- Free(doc_e->tag);
- doc_e->tag=ptr2;
- }
- Free(ptr);
- } else {
- StrPrint(doc_e->tag,doc_e->aux_str,d,doc_e->my_fmt_data);
- i=StrLen(doc_e->tag);
- }
- if (doc_e->de_flags & DOCEF_HAS_TERMINATOR) {
- doc_e->tag[i++]='_';
- doc_e->tag[i]=0;
- }
- doc_e->max_col=i;
- } else if (doc_e->de_flags & DOCEF_LST) {
- if (doc_e->de_flags & DOCEF_DEFINE && (tmph=HashFind(doc_e->define_str,
- doc->win_task->hash_table,HTT_DEFINE_STR)) && 0<=d<tmph->cnt) {
- ptr=MStrPrint("[%s]",tmph->sub_idx[d]);
- Free(doc_e->tag);
- doc_e->tag=StrNew(ptr,doc->mem_task);
- Free(ptr);
- } else {
- Free(doc_e->tag);
- doc_e->tag=StrNew("[]",doc->mem_task);
- }
- } else {
- if (d)
- doc_e->de_flags|=DOCEF_CHECKED_COLLAPSED;
- else
- doc_e->de_flags&=~DOCEF_CHECKED_COLLAPSED;
- }
- }
-}
-
-U0 DocDataScan(CDoc *doc,CDocEntry *doc_e)
-{
- I64 i,d;
- U8 *ptr,*ptr1,*ptr2;
- CHashDefineStr *tmph;
- if (doc_e->type_u8==DOCT_DATA && doc_e->de_flags&DOCEF_AUX_STR ||
- doc_e->type_u8==DOCT_CHECK_BOX || doc_e->de_flags & DOCEF_LST) {
- if (doc_e->de_flags&DOCEF_DEREF_DATA &&
- !(doc_e->de_flags&DOCEF_REMALLOC_DATA)) {
- if (!(ptr=doc_e->data)) return;
- } else
- ptr=&doc_e->data;
- if (doc_e->type_u8==DOCT_DATA) {
- i=StrLen(doc_e->tag);
- if (doc_e->de_flags & DOCEF_HAS_TERMINATOR)
- doc_e->tag[--i]=0;
- if (i>doc_e->len+doc_e->min_col)
- doc_e->tag[doc_e->len+doc_e->min_col]=0;
- if (RT_I8<=doc_e->raw_type<=RT_U32) {
- StrScan(doc_e->tag,doc_e->aux_str,&d,doc_e->my_fmt_data);
- if (doc_e->de_flags & DOCEF_HAS_TERMINATOR)
- doc_e->tag[i]='_';
- } else if (RT_I64<=doc_e->raw_type<=RT_UF64) {
- if (doc_e->de_flags & DOCEF_REMALLOC_DATA) {
- ptr=MAlloc(i-doc_e->min_col+8,doc->mem_task);
- MemCpy(ptr,doc_e->tag+doc_e->min_col,i-doc_e->min_col+1);
- Free(doc_e->data);
- doc_e->data=ptr;
- doc_e->len=MSize(ptr)-1;
- } else
- StrScan(doc_e->tag,doc_e->aux_str,ptr,doc_e->my_fmt_data);
- if (doc_e->de_flags & DOCEF_HAS_TERMINATOR)
- doc_e->tag[i]='_';
- return;
- }
- } else if (doc_e->de_flags & DOCEF_LST) {
- d=0;
- if (doc_e->tag && doc_e->de_flags & DOCEF_DEFINE &&
- (tmph=HashFind(doc_e->define_str,
- doc->win_task->hash_table,HTT_DEFINE_STR))) {
- ptr1=ptr2=StrNew(doc_e->tag);
- if (*ptr2=='[') {
- ptr2++;
- i=StrLen(ptr2);
- if (ptr2[i-1]==']')
- ptr2[i-1]=0;
- }
- d=LstMatch(ptr2,tmph->data);
- Free(ptr1);
- }
- } else {
- if (doc_e->de_flags & DOCEF_CHECKED_COLLAPSED)
- d=TRUE;
- else
- d=FALSE;
- }
- switch (doc_e->raw_type) {
- case RT_I8:
- case RT_U8:
- *ptr(U8 *)=d;
- case RT_I0:
- case RT_U0:
- break;
- case RT_I16:
- case RT_U16:
- *ptr(U16 *)=d;
- break;
- case RT_I32:
- case RT_U32:
- *ptr(U32 *)=d;
- break;
- default:
- *ptr(I64 *)=d;
- }
- }
-}
-
-#help_index "DolDoc/Input;StdIn/DolDoc"
-public Bool DocForm(U8 *_d,U8 *class_name=lastclass,
- I64 dof_flags=0,U8 *header=NULL,U8 *footer=NULL)
-{//User input. Supply a class name that has format definitions.
-//See /Demo/DolDoc/Form.HC and /Demo/LastClass.HC.
- CMemberLst *ml;
- CDocEntry *doc_e;
- U8 *format;
- CHashClass *tmpc,*tmpc2;
- CDoc *doc;
- Bool res=FALSE;
- I64 old_border_src=Fs->border_src,has_action;
- if (!(tmpc=HashFind(class_name,Fs->hash_table,HTT_CLASS)))
- return FALSE;
- doc=DocNew;
- doc->desc='Form';
- if (header) DocPrint(doc,"%s",header);
- doc->flags|=DOCF_OVERSTRIKE|DOCF_FORM;
- if (dof_flags&DOF_SIZE_MIN)
- doc->flags|=DOCF_SIZE_MIN;
- ml=tmpc->member_lst_and_root;
- while (ml) {
- if ((format=MemberMetaData("format",ml)) &&
- (doc_e=DocPrint(doc,"%s",format))) {
- tmpc2=ml->member_class;
- if ((doc_e->type_u8==DOCT_DATA || doc_e->type_u8==DOCT_LST ||
- doc_e->type_u8==DOCT_CHECK_BOX) && !tmpc2->ptr_stars_cnt) {
- tmpc2=OptClassFwd(tmpc2);
- tmpc2-=tmpc2->ptr_stars_cnt;
- if (tmpc2->type & HTT_INTERNAL_TYPE) {
- if (ml->dim.next) { //Array
- if (tmpc2->raw_type==RT_U8 &&
- LBtr(&doc_e->de_flags,&DOCEf_DFT_LEN)) {
- doc_e->len=ml->dim.total_cnt;
- if (doc_e->de_flags&DOCEF_HAS_TERMINATOR)
- doc_e->len--;
- Free(doc_e->tag); //See $LK,"DataTagWidth",A="FA:::/Adam/DolDoc/DocPlain.HC,DataTagWidth"$
- doc_e->tag=MAlloc(doc_e->len+doc_e->min_col+2,
- doc->mem_task); //+2 because "_\0"
- }
- } else if (LBtr(&doc_e->de_flags,DOCEf_DFT_RAW_TYPE))
- doc_e->raw_type=tmpc2->raw_type;
- }
- }
- if (doc_e->de_flags&DOCEF_REMALLOC_DATA) {
- doc_e->user_data=_d+ml->offset;
- doc_e->data=*doc_e->user_data(U8 **);
- } else
- doc_e->data=_d+ml->offset;
- doc_e->my_fmt_data=MemberMetaData("data",ml);
- DocDataFmt(doc,doc_e);
- }
- ml=ml->next;
- }
- if (footer) DocPrint(doc,"%s",footer);
- if (doc->head.next!=doc) {
- Fs->border_src=BDS_CONST;
- DocRecalc(doc);
- if (DocEd(doc,dof_flags)) {
- doc_e=doc->cur_entry;
- res=TRUE;
- if (doc_e!=doc) {
- if (DocEntryRun(doc,doc_e,TRUE,&has_action)==DOCM_CANCEL && has_action)
- res=FALSE;
- DocUnlock(doc);
- }
- }
- }
- doc_e=doc->head.next;
- while (doc_e!=doc) {
- if (doc_e->de_flags&DOCEF_REMALLOC_DATA) {
- *doc_e->user_data(U8 **)=doc_e->data;
- doc_e->data=NULL;
- }
- doc_e=doc_e->next;
- }
- DocDel(doc);
- Fs->border_src=old_border_src;
- return res;
-}
-
-U0 DocMenuEndTaskCB()
-{
- WinToTop;
- throw;
-}
-
-public I64 DocMenu(CDoc *m,I64 dof_flags=0)
-{//Run menu chooser doc. Returns menu doc unlocked.
- U8 *old_end_cb=Fs->task_end_cb;
- Bool old_break_shift_esc=LBts(&Fs->task_flags,TASKf_BREAK_TO_SHIFT_ESC);
- CDocEntry *doc_e;
- I64 old_border_src=Fs->border_src,res=DOCM_CANCEL,has_action;
- Fs->task_end_cb=&DocMenuEndTaskCB;
- try {
- if (m) {
- m->desc='Menu';
- Fs->border_src=BDS_CONST;
-dm_restart:
- if (DocEd(m,dof_flags)) {
- doc_e=m->cur_entry;
- if (doc_e!=m) {
- res=DocEntryRun(m,doc_e,TRUE,&has_action);
- DocUnlock(m);
- if (!has_action) {
- res=DOCM_CANCEL;
- dof_flags|=DOF_DONT_HOME;
- goto dm_restart;
- }
- }
- }
- }
- } catch {
- if (!Fs->except_ch) {
- if (!(dof_flags & DOF_INTERCEPT_TASK_END))
- Exit;
- Fs->catch_except=TRUE;
- }
- }
- LBEqu(&Fs->task_flags,TASKf_BREAK_TO_SHIFT_ESC,old_break_shift_esc);
- Fs->border_src=old_border_src;
- Fs->task_end_cb=old_end_cb;
- return res;
-}
-
-public I64 PopUpMenu(CDoc *doc,I64 dof_flags=0)
-{//Run menu chooser doc in PopUp win task.
- doc->flags|=DOCF_SIZE_MIN | DOCF_FORM;
- return PopUpPrint("DocMenu(0x%X,0x%X);",doc,dof_flags);
-}
-
-public Bool PopUpForm(U8 *_d,U8 *class_name=lastclass,
- I64 dof_flags=DOF_SIZE_MIN,U8 *header=NULL,U8 *footer=NULL)
-{//See /Demo/DolDoc/Form.HC and /Demo/LastClass.HC.
- return PopUpPrint("DocForm(0x%X,0x%X,0x%X,0x%X,0x%X);",_d,class_name,
- dof_flags,header,footer);
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocGet.HC.HTML b/public/src/Adam/DolDoc/DocGet.HC.HTML deleted file mode 100644 index 9372a5e..0000000 --- a/public/src/Adam/DolDoc/DocGet.HC.HTML +++ /dev/null @@ -1,255 +0,0 @@ - - - - - DocGet.HC - - - - - #help_index "DolDoc"
-
-U0 EdUndoFilter(CDoc *doc)
-{
- Bool unlock=DocLock(doc);
- CDocEntry *doc_ce=doc->head.next;
- while (doc_ce!=doc) {
- doc_ce->de_flags&=~DOCEF_FILTER_SKIP;
- doc_ce=doc_ce->next;
- }
- doc->find_replace->filter_lines=0;
- if (unlock)
- DocUnlock(doc);
-}
-
-public I64 DocGetKey(I64 *_sc=NULL)
-{//Called by View. You probably don't need this.
- I64 ch,sc;
- Bool cont,old_key_desc;
- do {
- old_key_desc=LBtr(&Fs->win_inhibit,WIf_SELF_KEY_DESC);
- do ch=GetKey(&sc,TRUE);
- while (sc&SCF_KEY_DESC);
- LBEqu(&Fs->win_inhibit,WIf_SELF_KEY_DESC,old_key_desc);
-
- DocRecalc(DocPut);
- cont=FALSE;
- if ((ch==CH_ESC || ch==CH_SHIFT_ESC) && //Check for exit filter mode
- DocPut && DocPut->find_replace->filter_lines) {
- EdUndoFilter(DocPut);
- cont=TRUE;
- }
- } while (cont);
- if (_sc) *_sc=sc;
- return ch;
-}
-
-#help_index "DolDoc/Input;StdIn/DolDoc"
-public U8 *DocScanLine(CDoc *doc,CDocEntry *doc_e,
- I64 *cur_col=NULL,CDocEntry **_do_e_end=NULL)
-{//Start at entry in doc,make and return one line as str.
- CDocEntry *doc_e2=doc_e;
- Bool unlock=DocLock(doc);
- U8 *dst,*src,*start,*res;
- I64 i=0;
- if (cur_col)
- *cur_col=-1;
- while (doc_e2!=doc && doc_e2->type_u8!=DOCT_NEW_LINE) {
- if (doc_e2->de_flags&DOCEF_TAG && doc_e2->tag) {
- src=doc_e2->tag;
- i+=StrLen(src);
- } else if (doc_e2->type_u8==DOCT_TAB)
- i++;
- else if (doc_e2->type_u8==DOCT_SHIFTED_X ||
- doc_e2->type_u8==DOCT_SHIFTED_Y) {
- if (doc_e2->attr<0)
- i++;
- i+=6; //$SY,3$
- }
- doc_e2=doc_e2->next;
- }
- res=MAlloc(i+1);
- dst=res;
- while (doc_e!=doc && doc_e->type_u8!=DOCT_NEW_LINE) {
- start=dst;
- if (doc_e->de_flags&DOCEF_TAG && doc_e->tag) {
- src=doc_e->tag;
- while (*src)
- *dst++=*src++;
- } else if (doc_e->type_u8==DOCT_TAB)
- *dst++='\t';
- else if (doc_e->type_u8==DOCT_SHIFTED_Y) {
- *dst(U32 *)++='$SY,';
- if (doc_e->attr<0)
- *dst++='-';
- *dst++='0'+AbsI64(doc_e->attr); //Supposedly -7 to 7 (single digit)
- *dst++='$';
- } else if (doc_e->type_u8==DOCT_SHIFTED_X) {
- *dst(U32 *)++='$SX,';
- if (doc_e->attr<0)
- *dst++='-';
- *dst++='0'+AbsI64(doc_e->attr); //Supposedly -7 to 7 (single digit)
- *dst++='$';
- }
- if (doc_e==doc->cur_entry && cur_col)
- *cur_col=start-res+doc->cur_col;
- doc_e=doc_e->next;
- }
- if (_do_e_end) *_do_e_end=doc_e;
- *dst=0;
- if (doc_e==doc->cur_entry && cur_col && !doc->cur_col)
- *cur_col=dst-res;
- if (unlock)
- DocUnlock(doc);
- return res;
-}
-
-U8 *DocGetStr2(I64 flags=0)
-{//Flags
- CDoc *doc;
- CDocEntry *doc_e,*doc_e_end;
- U8 *st,*st2,*res;
- I64 ch,sc;
- "$PT$";
- do {
- ch=DocGetKey(&sc);
- if (ch==CH_ESC) {
- if (doc=DocPut) {
- DocLock(doc);
- if (doc->doc_signature==DOC_SIGNATURE_VAL && doc->cur_entry!=doc) {
- doc_e=DocEntryCopy(doc,doc->cur_entry);
- DocBottom(doc);
- DocEntryRun(doc,doc_e,TRUE);
- DocEntryDel(doc,doc_e);
- }
- DocUnlock(doc);
- }
- if (flags&GSF_WITH_NEW_LINE)
- break;
- } if (ch==CH_SHIFT_ESC) {
- if (flags&GSF_SHIFT_ESC_EXIT)
- Exit;
- else {
- res=StrNew("");
- goto gs_done;
- }
- }
-//<CTRL-SHIFT-ENTER> is a blank line without entry
- } while (flags&GSF_WITH_NEW_LINE || ch!='\n' ||
- sc&SCF_CTRL && sc&SCF_SHIFT);
-
- doc=DocPut;
- DocLock(doc);
- if (flags&GSF_WITH_NEW_LINE) {
- doc_e=doc->cur_entry;
- do doc_e=doc_e->last;
- while (doc_e!=doc && doc_e->type_u8!=DOCT_PMT);
- doc_e=doc_e->next;
- if (res=DocScanLine(doc,doc_e,NULL,&doc_e_end)) {
- while (doc_e_end!=doc && doc_e_end->type_u8==DOCT_NEW_LINE) {
- st2=MStrPrint("%s\n",res);
- Free(res);
- res=st2;
- if (st=DocScanLine(doc,doc_e_end->next,NULL,&doc_e_end)) {
- st2=MStrPrint("%s%s",res,st);
- Free(st);
- Free(res);
- res=st2;
- }
- }
- }
- } else {
- doc_e=doc->cur_entry;
- do doc_e=doc_e->last;
- while (doc_e!=doc && doc_e->type_u8!=DOCT_NEW_LINE &&
- doc_e->type_u8!=DOCT_PMT);
- if (doc_e!=doc && doc_e->type_u8!=DOCT_PMT) {
- do doc_e=doc_e->last;
- while (doc_e!=doc && doc_e->type_u8!=DOCT_NEW_LINE &&
- doc_e->type_u8!=DOCT_PMT);
- }
- doc_e=doc_e->next;
- res=DocScanLine(doc,doc_e,NULL);
- }
- DocUnlock(doc);
-gs_done:
- "$PT$$FG$$BG$";
- return res;
-}
-
-#help_index "Keyboard Devices;Char/Input;StdIn"
-public I64 GetI64(U8 *msg=NULL,I64 dft=0,I64 lo=I64_MIN,I64 hi=I64_MAX)
-{//Prompt user for I64 expression.
- Bool okay;
- U8 *st;
- I64 res;
- while (TRUE) {
- if (msg)
- "" msg,dft;
- st=GetStr;
- if (!*st) {
- Free(st);
- return dft;
- }
- try {
- res=ExePrint2("ToI64(%s);",st);
- okay=TRUE;
- } catch {
- Fs->catch_except=TRUE;
- okay=FALSE;
- }
- Free(st);
- if (okay && lo<=res<=hi)
- return res;
- }
-}
-
-public F64 GetF64(U8 *msg=NULL,F64 dft=0,F64 lo=F64_MIN,F64 hi=F64_MAX)
-{//Prompt user for F64 expression.
- Bool okay;
- U8 *st;
- F64 res;
- while (TRUE) {
- if (msg)
- "" msg,dft;
- st=GetStr;
- if (!*st) {
- Free(st);
- return dft;
- }
- try {
- res=ExePrint2("ToF64(%s);",st)(F64);
- okay=TRUE;
- } catch {
- Fs->catch_except=TRUE;
- okay=FALSE;
- }
- Free(st);
- if (okay && lo<=res<=hi)
- return res;
- }
-}
-
-public CDate GetDate(U8 *msg=NULL,CDate dft=I64_MIN,
- CDate lo=I64_MIN,CDate hi=I64_MAX)
-{//Prompt user for date expression. (Use Now() if you want current time.)
- U8 *st;
- CDate res;
- if (dft==I64_MIN) dft=Now;
- while (TRUE) {
- if (msg)
- "" msg,dft,dft;
- st=GetStr;
- if (!*st) {
- Free(st);
- return dft;
- }
- res=Str2Date(st);
- Free(st);
- if (res>=lo && res<=hi)
- return res;
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocGr.HC.HTML b/public/src/Adam/DolDoc/DocGr.HC.HTML deleted file mode 100644 index 9fe9d5a..0000000 --- a/public/src/Adam/DolDoc/DocGr.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - DocGr.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocHighlight.HC.HTML b/public/src/Adam/DolDoc/DocHighlight.HC.HTML deleted file mode 100644 index 4195e24..0000000 --- a/public/src/Adam/DolDoc/DocHighlight.HC.HTML +++ /dev/null @@ -1,172 +0,0 @@ - - - - - DocHighlight.HC - - - - - #help_index "DolDoc/Misc"
-
-CColorROPU32 highlight_hash_type_colors[HTt_TYPES_NUM]=
- DOC_COLOR_EXPORT_SYS_SYM,0,DOC_COLOR_DEFINE_STR,DOC_COLOR_GLBL_VAR,
- DOC_COLOR_CLASS,DOC_COLOR_KEYWORD,DOC_COLOR_FUN,0,0,DOC_COLOR_KEYWORD,
- DOC_COLOR_KEYWORD,DOC_COLOR_KEYWORD,DOC_COLOR_REG,0,0,0,0};
-
-U32 *DocHighlight(CDocEntry *doc_e,U8 *src,I64 len,I64 _tmp_u32_attr)
-{//Be aware of /Demo/ToHtmlToTXTDemo/ToHtml.HC.
- U32 *res=MAlloc((len+1)*sizeof(U32)),*dst=res;
- U8 *ptr;
- CDocSettings *s=&doc_e->settings;
- I64 ch,ch1,last_ch,tmp_u32_attr,mask_tmp_u32_attr=_tmp_u32_attr&0xFFFFF000,
- comment_depth,brace_depth=s->brace_depth,paren_depth=s->paren_depth;
- CHash *tmph;
- switch [s->state] {
- case DOCSS_NORMAL:
-hl_normal:
- while (len) {
- while (len && !Bt(char_bmp_alpha_numeric,*src)) {
- tmp_u32_attr=_tmp_u32_attr;
- ch1=*src++;
- switch (ch1) {
- case '/':
- if (len>=2) {
- if (*src=='/') {
- tmp_u32_attr=DOC_COLOR_COMMENT<<8|mask_tmp_u32_attr;
- *dst++=ch1+tmp_u32_attr;
- *dst++=*src++ +tmp_u32_attr;
- len-=2;
- goto hl_cpp_comment;
- } else if (*src=='*') {
- tmp_u32_attr=DOC_COLOR_COMMENT<<8|mask_tmp_u32_attr;
- *dst++=ch1+tmp_u32_attr;
- *dst++=*src++ +tmp_u32_attr;
- len-=2;
- comment_depth=1;
- goto hl_comment;
- }
- }
- break;
- case '\'':
- tmp_u32_attr=DOC_COLOR_CHAR_CONST<<8|mask_tmp_u32_attr;
- *dst++=ch1+tmp_u32_attr;
- len--;
- goto hl_single_quote;
- case '\"':
- tmp_u32_attr=DOC_COLOR_STR<<8|mask_tmp_u32_attr;
- *dst++=ch1+tmp_u32_attr;
- len--;
- goto hl_dbl_quote;
- case '(':
- if (paren_depth++&1)
- tmp_u32_attr=DOC_COLOR_ALT_TEXT<<8|mask_tmp_u32_attr;
- break;
- case ')':
- if (--paren_depth&1)
- tmp_u32_attr=DOC_COLOR_ALT_TEXT<<8|mask_tmp_u32_attr;
- break;
- case '{':
- if (brace_depth++&1)
- tmp_u32_attr=DOC_COLOR_ALT_TEXT<<8|mask_tmp_u32_attr;
- break;
- case '}':
- if (--brace_depth&1)
- tmp_u32_attr=DOC_COLOR_ALT_TEXT<<8|mask_tmp_u32_attr;
- break;
- }
- *dst++=ch1+tmp_u32_attr;
- if (!--len) goto hl_normal_done;
- }
- ptr=src;
- while (len && Bt(char_bmp_alpha_numeric,*src)) {
- src++;
- len--;
- }
- ch=*src;
- *src=0;
- if (tmph=HashFind(ptr,adam_task->hash_table,
- HTT_EXPORT_SYS_SYM|HTT_DEFINE_STR|HTT_GLBL_VAR|HTT_CLASS|
- HTT_INTERNAL_TYPE|HTT_FUN|HTT_KEYWORD|HTT_ASM_KEYWORD|
- HTT_OPCODE|HTT_REG))
- tmp_u32_attr=highlight_hash_type_colors[HashTypeNum(tmph)]<<8|
- mask_tmp_u32_attr;
- else
- tmp_u32_attr=_tmp_u32_attr;
- while (ch1=*ptr++)
- *dst++=ch1+tmp_u32_attr;
- *src=ch;
- }
-hl_normal_done:
- s->state=DOCSS_NORMAL;
- s->comment_depth=0;
- break;
- case DOCSS_SINGLE_QUOTE:
- tmp_u32_attr=DOC_COLOR_CHAR_CONST<<8|mask_tmp_u32_attr;
-hl_single_quote:
- last_ch=0;
- while (len--) {
- ch1=*src++;
- *dst++=ch1+tmp_u32_attr;
- if (last_ch!='\\' && ch1=='\'')
- goto hl_normal;
- if (last_ch=='\\' && ch1=='\\')
- last_ch=0;
- else
- last_ch=ch1;
- }
- s->state=DOCSS_SINGLE_QUOTE;
- s->comment_depth=0;
- break;
- case DOCSS_DBL_QUOTE:
- tmp_u32_attr=DOC_COLOR_CHAR_CONST<<8|mask_tmp_u32_attr;
-hl_dbl_quote:
- last_ch=0;
- while (len--) {
- ch1=*src++;
- *dst++=ch1+tmp_u32_attr;
- if (last_ch!='\\' && ch1=='\"')
- goto hl_normal;
- if (last_ch=='\\' && ch1=='\\')
- last_ch=0;
- else
- last_ch=ch1;
- }
- s->state=DOCSS_DBL_QUOTE;
- s->comment_depth=0;
- break;
- case DOCSS_COMMENT:
- tmp_u32_attr=DOC_COLOR_COMMENT<<8|mask_tmp_u32_attr;
- comment_depth=s->comment_depth;
-hl_comment:
- last_ch=0;
- while (len--) {
- ch1=*src++;
- *dst++=ch1+tmp_u32_attr;
- if (last_ch=='*' && ch1=='/') {
- if (!--comment_depth)
- goto hl_normal;
- } else if (last_ch=='/' && ch1=='*')
- comment_depth++;
- last_ch=ch1;
- }
- s->state=DOCSS_COMMENT;
- s->comment_depth=comment_depth;
- break;
- case DOCSS_CPP_Z_COMMENT:
- tmp_u32_attr=DOC_COLOR_COMMENT<<8|mask_tmp_u32_attr;
-hl_cpp_comment:
- while (len--)
- *dst++=*src++ +tmp_u32_attr;
- s->state=DOCSS_CPP_Z_COMMENT;
- s->comment_depth=0;
- break;
- }
- s->paren_depth=paren_depth;
- s->brace_depth=brace_depth;
- *dst=0;
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocInit.HC.HTML b/public/src/Adam/DolDoc/DocInit.HC.HTML deleted file mode 100644 index f406d84..0000000 --- a/public/src/Adam/DolDoc/DocInit.HC.HTML +++ /dev/null @@ -1,124 +0,0 @@ - - - - - DocInit.HC - - - - - #help_index "DolDoc"
-
-U0 DocInit()
-{//$LK-UL,"CMD Defines",A="MN:DOCT_TEXT"$
- CCmpCtrl *cc;
- I64 i;
- CHashGeneric *tmph;
-
- DefineLstLoad("ST_DOC_CMDS",
- "TX\0CR\0SR\0TB\0PB\0CU\0MK\0PT\0CL\0PL\0LM\0RM\0HD\0FO\0ID\0FG\0"
- "BG\0FD\0BD\0WW\0HL\0BK\0IV\0UL\0SX\0SY\0CM\0AN\0LK\0BT\0"
- "DA\0CB\0LS\0MA\0MU\0HX\0TR\0SP\0IB\0IS\0SO\0HC\0ER\0");
- DefineLstLoad("ST_DOC_FLAGS",
- "T\0LEN\0A\0D\0HTML\0LE\0LM\0RE\0RM\0BI\0BP\0RT\0SX\0SY\0SCX\0U\0"
- "LC\0LIS\0RC\0RIS\0LX\0CX\0RX\0TY\0CY\0BY\0"
- "HL\0WW\0BK\0IV\0SEL\0UL\0"
- "TC\0PRY\0MRX\0WR\0L\0X\0Q\0FST\0B\0S\0BD\0C\0CA\0RD\0UD\0P\0M\0"
- "TRM\0Z\0H\0TR\0LS\0SK\0PU\0SIF\0FS\0NC\0DD\0DL\0DRT\0");
- DefineLstLoad("ST_LINK_TYPES",
- "FI\0FA\0FF\0FL\0MN\0PI\0PF\0PL\0BF\0DN\0HI\0AD\0AI\0AA\0AF\0AL\0");
-
- doldoc.hash=HashTableNew(512);
- HashDefineLstAdd("ST_DOC_CMDS",DHT_DOC_CMD,doldoc.hash);
- HashDefineLstAdd("ST_DOC_FLAGS",DHT_DOC_FLAG,doldoc.hash);
- HashDefineLstAdd("ST_COLORS",DHT_COLOR,doldoc.hash);
-
- MemSet(doldoc.dft_de_flags, 0,sizeof(doldoc.dft_de_flags));
- MemSet(doldoc.dft_type_flags, 0,sizeof(doldoc.dft_type_flags));
- cc=CmpCtrlNew("TX+T;DA+P+TRM+T+DL+DRT;CM+LE+RE;AN+T;LK+L+UL+T;MA+X+UL+T;"
- "MU+X+UL+T;BT+X+B+T;CB+CA+P+T+DRT;LS+LS+P+T+DRT;HX+P+Z;TR+TR+C+CA+UL+T;"
- "SP+T;IB+T;IS+T;SO+T;HC+T;",CCF_DONT_FREE_BUF);
- cc->htc.hash_table_lst=NULL;
- Lex(cc);
- while (cc->token==TK_IDENT) {
- if (tmph=HashFind(cc->cur_str,doldoc.hash,DHT_DOC_CMD)) {
- i=tmph->user_data0;
- Lex(cc);
- PrsDocFlags(cc,&doldoc.dft_de_flags[i],&doldoc.dft_type_flags[i]);
- }
- if (cc->token==';')
- Lex(cc);
- }
- CmpCtrlDel(cc);
-
- for (i=0;i<DOCT_TYPES_NUM;i++)
- doldoc.dft_de_flags[i]&=~DOCG_BL_IV_UL;
-
- doldoc.type_flags_form[0]=0;
- for (i=0;i<DOCT_TYPES_NUM;i++)
- if (Bt(&doldoc.dft_de_flags[i],DOCEf_TAG) && i!=DOCT_TEXT || i==DOCT_HEX_ED)
- Bts(doldoc.type_flags_form,i);
-
- //Don't forget cmp_type_flags_src_code.
- doldoc.type_flags_nontag_invis[0]=
- 1<<DOCT_PMT|
- 1<<DOCT_PAGE_LEN|
- 1<<DOCT_LEFT_MARGIN|
- 1<<DOCT_RIGHT_MARGIN|
- 1<<DOCT_HEADER|
- 1<<DOCT_FOOTER|
- 1<<DOCT_INDENT|
- 1<<DOCT_FOREGROUND|
- 1<<DOCT_BACKGROUND|
- 1<<DOCT_DFT_FOREGROUND|
- 1<<DOCT_DFT_BACKGROUND|
- 1<<DOCT_WORD_WRAP|
- 1<<DOCT_HIGHLIGHT|
- 1<<DOCT_BLINK|
- 1<<DOCT_INVERT|
- 1<<DOCT_UNDERLINE|
- 1<<DOCT_SHIFTED_X|
- 1<<DOCT_SHIFTED_Y|
- 1<<DOCT_SPRITE;
-
- doldoc.type_flags_data[0]=1<<DOCT_DATA|1<<DOCT_HEX_ED|1<<DOCT_CHECK_BOX;
-
- doldoc.type_flags_chk_dup[0]=
- 1<<DOCT_LEFT_MARGIN|
- 1<<DOCT_RIGHT_MARGIN|
- 1<<DOCT_HEADER|
- 1<<DOCT_FOOTER|
- 1<<DOCT_FOREGROUND|
- 1<<DOCT_BACKGROUND|
- 1<<DOCT_DFT_FOREGROUND|
- 1<<DOCT_DFT_BACKGROUND|
- 1<<DOCT_WORD_WRAP|
- 1<<DOCT_HIGHLIGHT|
- 1<<DOCT_BLINK|
- 1<<DOCT_INVERT|
- 1<<DOCT_UNDERLINE|
- 1<<DOCT_SHIFTED_X|
- 1<<DOCT_SHIFTED_Y;
-
- Bts(doldoc.clean_scan_codes,SC_CURSOR_RIGHT);
- Bts(doldoc.clean_scan_codes,SC_CURSOR_LEFT);
- Bts(doldoc.clean_scan_codes,SC_CURSOR_UP);
- Bts(doldoc.clean_scan_codes,SC_CURSOR_DOWN);
- Bts(doldoc.clean_scan_codes,SC_PAGE_UP);
- Bts(doldoc.clean_scan_codes,SC_PAGE_DOWN);
- Bts(doldoc.clean_scan_codes,SC_ALT);
- Bts(doldoc.clean_scan_codes,SC_CTRL);
- Bts(doldoc.clean_scan_codes,SC_SHIFT);
- Bts(doldoc.clean_scan_codes,SC_CAPS);
- Bts(doldoc.clean_scan_codes,SC_NUM);
- Bts(doldoc.clean_scan_codes,SC_SCROLL);
- Bts(doldoc.clean_scan_codes,SC_HOME);
- Bts(doldoc.clean_scan_codes,SC_END);
- Bts(doldoc.clean_scan_codes,SC_GUI);
- Bts(doldoc.clean_scan_codes,SC_BACKSPACE); //Handled specially
-}
-
-DocInit;
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocLink.HC.HTML b/public/src/Adam/DolDoc/DocLink.HC.HTML deleted file mode 100644 index 7b0fe56..0000000 --- a/public/src/Adam/DolDoc/DocLink.HC.HTML +++ /dev/null @@ -1,370 +0,0 @@ - - - - - DocLink.HC - - - - - #help_index "DolDoc/Link"
-
-/* See TempleOS Link Types.
-"filename"
-"FI:filename"
-"FA:haystack_filename,needle_anchor_str"
-"FF:haystack_filename,needle_str"
-"FF:haystack_filename,needle_str:occurnum"
-"FL:filename,linenum"
-"MN:SymName"
-"PI:filename"
-"PF:haystack_filename,needle_str"
-"PF:haystack_filename,needle_str:occurnum"
-"PL:filename,linenum"
-"BF:haystack_bible_book,needle_str"
-"DN:word"
-"DN:word,defnum"
-"HI:index"
-"AD:code_address_number"
-
-To edit a doc structure already in memory. See SpriteEdText().
-"AI:doc_address"
-"AA:haystack_doc_address,needle_anchor_str"
-"AF:haystack_doc_address,needle_str"
-"AF:haystack_doc_address,needle_str:occurnum"
-"AL:doc_address,linenum"
-*/
-
-#define LK_FILE 0
-#define LK_FILE_ANCHOR 1
-#define LK_FILE_FIND 2
-#define LK_FILE_LINE 3
-#define LK_MAN_PAGE 4
-#define LK_PLAIN 5
-#define LK_PLAIN_FIND 6
-#define LK_PLAIN_LINE 7
-#define LK_BIBLE_FIND 8
-#define LK_DEF 9
-#define LK_HELP_INDEX 10
-#define LK_ADDR 11
-#define LK_DOC 12 //See SpriteEdText()
-#define LK_DOC_ANCHOR 13
-#define LK_DOC_FIND 14
-#define LK_DOC_LINE 15
-#define LK_PLACE_ANCHOR 16
-
-public U8 *DocEntryLink(CDoc *doc,CDocEntry *doc_e)
-{//MAlloc new str, either tag or aux_str if link.
- if (doc_e->de_flags&DOCEF_LINK) {
- if (doc_e->de_flags & DOCEF_AUX_STR)
- return StrNew(doc_e->aux_str,doc->mem_task);
- else if (doc_e->de_flags & DOCEF_TAG)
- return StrNew(doc_e->tag,doc->mem_task);
- }
- return NULL;
-}
-
-Bool DocFileEd(I64 _type,U8 *filename,
- U8 *needle_str,I64 *_num,I64 edf_dof_flags)
-{
- I64 type=_type,flags=0,old_border_src=Fs->border_src;
- CDocEntry *doc_e;
- CDoc *doc;
- Bool old_silent=Bt(&Fs->display_flags,DISPLAYf_SILENT),
- res=FALSE,other_found=FALSE;
- U8 *st1,*st2;
- try {
- switch (type) {
- case LK_PLAIN:
- flags=DOCF_PLAIN_TEXT|DOCF_NO_CURSOR;
- case LK_DOC:
- type=LK_FILE;
- break;
- case LK_DOC_ANCHOR:
- type=LK_FILE_ANCHOR;
- break;
- case LK_PLAIN_FIND:
- flags=DOCF_PLAIN_TEXT|DOCF_NO_CURSOR;
- case LK_DOC_FIND:
- type=LK_FILE_FIND;
- break;
- case LK_PLAIN_LINE:
- flags=DOCF_PLAIN_TEXT|DOCF_NO_CURSOR;
- case LK_DOC_LINE:
- type=LK_FILE_LINE;
- break;
- case LK_BIBLE_FIND:
- flags=DOCF_PLAIN_TEXT|DOCF_NO_CURSOR;
- break;
- }
-
- flags|=DOCF_ALLOW_UNDO;
-
- if (LK_DOC<=_type<=LK_DOC_LINE) {
- doc=Str2I64(filename);//See SpriteEdText()
- res=TRUE;
- } else {
- st1=StrNew(filename);
- st2=StrNew(filename);
- StrLastRem(st1,"/",st2); //st2 is name without dir
- if (!FileNameChk(st2))
- doc=NULL;
- else {
- Silent;
- if (Bt(&edf_dof_flags,EDf_BAIL)) //if bail, scan parents
- res=FileFind(filename,,
- FUF_JUST_FILES|FUF_Z_OR_NOT_Z|FUF_SCAN_PARENTS);
- else if (!(res=FileFind(filename,,FUF_JUST_FILES)))
- other_found=FileFind(filename,,
- FUF_JUST_FILES|FUF_Z_OR_NOT_Z|FUF_SCAN_PARENTS);
- doc=DocRead(filename,flags);
- doc->desc='Edit';
- Silent(old_silent);
- Fs->border_src=BDS_ED_FILENAME_DRV;
- }
- Free(st1);
- Free(st2);
- }
- if (!doc||doc->doc_signature!=DOC_SIGNATURE_VAL)
- res=FALSE;
- else {
- if (Bt(&edf_dof_flags,EDf_COLLAPSE))
- DocCollapse(TRUE,doc);
- else if (Bt(&edf_dof_flags,EDf_UNCOLLAPSE))
- DocCollapse(FALSE,doc);
-
- if (res || other_found)
- switch (type) {
- case LK_FILE_LINE:
- res=DocGoToLine(doc,*_num);
- break;
- case LK_FILE_ANCHOR:
- res=DocAnchorFind(doc,needle_str);
- break;
- case LK_FILE_FIND:
- res=DocFind(doc,,needle_str,*_num);
- break;
- case LK_BIBLE_FIND:
- res=DocFind(doc,*_num,needle_str);
- break;
- default:
- DocCenter(doc);
- }
- *_num=doc->cur_entry->y+1;
-
- if (edf_dof_flags&EDF_WAS_WRITE)
- res=FALSE;
- if (!(edf_dof_flags&EDF_BAIL)) {
- if (*doc->filename.name)
- doc->filename.dirc=DirContextNew(doc->filename.name);
- else
- doc->filename.dirc=NULL;
- if (DocEd(doc,edf_dof_flags|DOF_DONT_HOME)) {
- DocLock(doc);
- doc_e=doc->cur_entry;
- if (doc_e!=doc)
- DocEntryRun(doc,doc_e,TRUE);
- DocUnlock(doc);
- if (!(LK_DOC<=_type<=LK_DOC_LINE)) {
- DocWrite(doc);
- if (edf_dof_flags&EDF_WAS_WRITE)
- res=TRUE;
- }
- }
- DirContextDel(doc->filename.dirc);
- }
- if (!(LK_DOC<=_type<=LK_DOC_LINE))
- DocDel(doc);
- }
- } catch {
- Silent(old_silent);
- res=FALSE;
- }
- Fs->border_src=old_border_src;
- return res;
-}
-
-#define DFT_ADDR_LINK_BIN_SIZE 64
-
-public I64 EdLinkCvt(U8 *link_st,U8 **_filename=NULL,U8 **_needle_str=NULL,
- I64 *_num=NULL,I64 edf_dof_flags=0)
-{//Editor Link--> filename, needle_str and line number.
- U8 *st,*ptr,*src,*filename=NULL,*needle_str=NULL,*filename2;
- I64 res,i,num=1;
- CHashSrcSym *tmph;
- if (!link_st||!*link_st) {
- if (edf_dof_flags&EDF_BAIL)
- return -1;
- link_st=blkdev.tmp_filename;
- }
- st=StrNew(link_st);
- res=LK_FILE;
- if (StrLen(st)>3 && st[2]==':') {
- st[2]=0;
- filename2=st+3;
- switch (res=DefineMatch(st,"ST_LINK_TYPES",LMF_IGNORE_CASE)) {
- case LK_MAN_PAGE:
- if (tmph=HashFind(filename2,Fs->hash_table,HTG_SRC_SYM))
- res=EdLinkCvt(tmph->src_link,&filename,
- &needle_str,&num,edf_dof_flags);
- else
- res=-1;
- goto lc_done;
- case LK_ADDR:
- if (ptr=StrLastOcc(filename2,",")) {
- *ptr=0;
- i=Str2I64(ptr+1);
- } else
- i=DFT_ADDR_LINK_BIN_SIZE;
- if (ptr=SrcEdLink(ExePrint("%s;",filename2),i)) {
- res=EdLinkCvt(ptr,&filename,&needle_str,&num,edf_dof_flags);
- Free(ptr);
- } else
- res=-1;
- goto lc_done;
- case LK_DEF:
- if (ptr=StrLastOcc(filename2,",")) {
- *ptr=0;
- i=Str2I64(ptr+1);
- } else
- i=-1;
- filename=StrNew(filename2);
- num=i;
- goto lc_done;
- case LK_HELP_INDEX:
- filename=StrNew(filename2);
- goto lc_done;
- case LK_BIBLE_FIND:
- if (ptr=StrLastOcc(filename2,",")) {
- *ptr=0;
- src=ptr+1;
- while (*src) { //We do not allow ending verse
- if (*src=='-')
- *src=0;
- src++;
- }
- needle_str=StrNew(ptr+1);
- }
- i=DefineMatch(filename2,"ST_BIBLE_BOOKS",LMF_IGNORE_CASE);
- if (i<0)
- res=-1;
- else {
- num=Str2I64(DefineSub(i,"ST_BIBLE_BOOK_LINES"));
- filename2=BIBLE_FILENAME;
- }
- break;
- case LK_FILE_LINE:
- case LK_PLAIN_LINE:
- case LK_DOC_LINE:
- if (ptr=StrLastOcc(filename2,",")) {
- *ptr=0;
- num=Str2I64(ptr+1);
- }
- break;
- case LK_FILE_ANCHOR:
- case LK_DOC_ANCHOR:
- if (ptr=StrLastOcc(filename2,",")) {
- *ptr=0;
- needle_str=StrNew(ptr+1);
- }
- break;
- case LK_FILE_FIND:
- case LK_PLAIN_FIND:
- case LK_DOC_FIND:
- if (ptr=StrLastOcc(filename2,",")) {
- *ptr=0;
- needle_str=StrNew(ptr+1);
- if (ptr=StrLastOcc(needle_str,":")) {
- *ptr=0;
- num=Str2I64(ptr+1);
- }
- }
- break;
- }
- } else
- filename2=st;
- if (res>=0) {
- if (LK_DOC<=res<=LK_DOC_LINE)
- filename=StrNew(filename2); //Holds document address as number.
- else
- filename=FileNameAbs(filename2,FUF_Z_OR_NOT_Z);
- }
-lc_done:
- Free(st);
- if (_filename)
- *_filename=filename;
- else
- Free(filename);
- if (_needle_str)
- *_needle_str=needle_str;
- else
- Free(needle_str);
- if (_num)
- *_num=num;
- return res;
-}
-
-public Bool DocLinkChk(CDoc *doc,U8 *link_st)
-{//Check for bad Editor Link.
- U8 *filename,*st;
- Bool res=FALSE;
- CDirContext *dirc;
- if (link_st) {
- st=FileNameAbs(doc->filename.name);
- dirc=DirContextNew(st);
- Free(st);
- switch (EdLinkCvt(link_st,&filename)) {
- case -1:
- break;
- case LK_FILE_LINE:
- case LK_PLAIN_LINE:
- case LK_FILE:
-//We don't check line number
- res=FileFind(filename,,
- FUF_JUST_FILES|FUF_Z_OR_NOT_Z|FUF_SCAN_PARENTS);
- break;
- case LK_BIBLE_FIND:
- st=StrNew(link_st+3);
- if (StrOcc(st,','))
- StrLastRem(st,",");
- if (DefineMatch(st,"ST_BIBLE_BOOKS",LMF_IGNORE_CASE)>=0)
- res=TRUE;
- Free(st);
- break;
- default://TODO: Need to validate HI: and DN:
- if (Ed(link_st,EDF_BAIL))
- res=TRUE;
- }
- Free(filename);
- DirContextDel(dirc);
- }
- return res;
-}
-
-public U8 *DocLinkFile(U8 *link_st,CTask *mem_task=NULL)
-{//Return the file for an Editor Link Types.
- U8 *filename=NULL,*st,*res=NULL;
- if (link_st) {
- switch (EdLinkCvt(link_st,&filename)) {
- case LK_FILE:
- case LK_FILE_ANCHOR:
- case LK_FILE_FIND:
- case LK_FILE_LINE:
- case LK_PLAIN:
- case LK_PLAIN_FIND:
- case LK_PLAIN_LINE:
- st=FileNameAbs(filename,FUF_Z_OR_NOT_Z|FUF_SCAN_PARENTS);
- res=StrNew(st);
- Free(st);
- break;
- case LK_BIBLE_FIND:
- res=StrNew(BIBLE_FILENAME,mem_task);
- break;
- }
- Free(filename);
- }
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocMacro.HC.HTML b/public/src/Adam/DolDoc/DocMacro.HC.HTML deleted file mode 100644 index d9ff6c6..0000000 --- a/public/src/Adam/DolDoc/DocMacro.HC.HTML +++ /dev/null @@ -1,223 +0,0 @@ - - - - - DocMacro.HC - - - - - #help_index "DolDoc/Misc"
-
-U8 captured_macro_name[STR_LEN];
-StrCpy(captured_macro_name,"Test");
-
-I64 sys_macro_repeat_n=1;
-
-U0 SysMacroStripKey(CJob *macro_head,I64 arg1,I64 arg2)
-{
- CJob *tmpc,*tmpc1;
- tmpc=macro_head->next;
- while (tmpc!=macro_head) {
- tmpc1=tmpc->next;
- if (tmpc->job_code==JOBT_MSG &&
- (tmpc->msg_code==MSG_KEY_DOWN || tmpc->msg_code==MSG_KEY_UP ||
- tmpc->msg_code==MSG_KEY_DOWN_UP) &&
- arg1 && tmpc->aux1==arg1 || !arg1 && tmpc->aux2==arg2) {
- QueRem(tmpc);
- JobDel(tmpc);
- }
- tmpc=tmpc1;
- }
-}
-
-#define MT_NULL 0
-#define MT_MSG 1
-#define MT_CHAR 2
-
-class CMacroTmp
-{
- CMacroTmp *next,*last;
- I64 type;
- U8 buf[STR_LEN];
-};
-
-CMacroTmp *Cmd2MT(CJob *tmpc)
-{
- U8 buf[8];
- CMacroTmp *tmpmt=CAlloc(sizeof(CMacroTmp));
- if (Bt(char_bmp_macro,tmpc->aux1) && tmpc->msg_code==MSG_KEY_DOWN) {
- tmpmt->type=MT_CHAR;
- buf[0]=tmpc->aux1;
- buf[1]=0;
- StrPrint(tmpmt->buf,"%Q",buf);
- } else {
- tmpmt->type=MT_MSG;
- StrPrint(tmpmt->buf,"Msg(0x%X,0x%X,0x%X);",
- tmpc->msg_code,tmpc->aux1,tmpc->aux2);
- }
- return tmpmt;
-}
-
-U8 *SysMacro2Str(CJob *macro_head)
-{
- CJob *tmpc;
- I64 cnt=1; //terminating zero
- U8 *ptr,*m;
- CMacroTmp *tmpmt,*tmpmt1,head;
- LBtr(&sys_semas[SEMA_RECORD_MACRO],0);
-
- QueInit(&head);
- head.type=MT_NULL;
- tmpc=macro_head->next;
- while (tmpc!=macro_head) {
- tmpmt=Cmd2MT(tmpc);
- QueIns(tmpmt,head.last);
- cnt+=StrLen(tmpmt->buf);
- if (tmpmt->type==MT_CHAR) {
- if (tmpmt->last->type!=MT_CHAR)
- cnt+=StrLen("\"");
- if (tmpmt->next->type!=MT_CHAR)
- cnt+=StrLen("\";");
- }
- tmpc=tmpc->next;
- }
-
- m=MAlloc(cnt);
- ptr=m;
-
- tmpmt=head.next;
- while (tmpmt!=&head) {
- tmpmt1=tmpmt->next;
- if (tmpmt->type==MT_MSG) {
- StrCpy(ptr, tmpmt->buf);
- ptr+=StrLen(tmpmt->buf);
- } else {
- if (tmpmt->last->type!=MT_CHAR) {
- StrCpy(ptr, "\"");
- ptr+=StrLen("\"");
- }
- StrCpy(ptr,tmpmt->buf);
- ptr+=StrLen(tmpmt->buf);
- if (tmpmt->next->type!=MT_CHAR) {
- StrCpy(ptr, "\";");
- ptr+=StrLen("\";");
- }
- }
- Free(tmpmt);
- tmpmt=tmpmt1;
- }
- *ptr=0;
- return m;
-}
-
-U0 PlaySysMacro(I64 n=1)
-{
- CTask *task=sys_focus_task;
- U8 *m;
- if (TaskValidate(task)) {
- LBtr(&sys_semas[SEMA_RECORD_MACRO],0);
- m=SysMacro2Str(&sys_macro_head);
- while (n-- && TaskValidate(task)) {
- if (task==Fs)
- InStr("%s",m);
- else
- XTalkStrWait(task,"%s",m);
- }
- Free(m);
- }
-}
-
-U0 EdInsCapturedMacro()
-{
- U8 *st=SysMacro2Str(&sys_macro_head);
- if (sys_focus_task) {
- XTalk(sys_focus_task,"$MA+LIS,T=\"%s\",LM=\"%$Q\"$",
- captured_macro_name,st);
- Free(st);
- }
-}
-
-#define SM_RECORD 0
-#define SM_INS 1
-#define SM_PLAY 2
-#define SM_REPEAT_N 3
-#define SM_STOP 4
-
-I64 PopUpMacroMenu()
-{
- I64 res=0;
- U8 buf[STR_LEN];
- CJob *tmpc;
- CDoc *doc=DocNew;
- CDocEntry *doc_e=DocPrint(doc,"$DA-P,LEN=STR_LEN-1,A=\"Name:%%s\"$");
- doc_e->data=captured_macro_name;
- DocDataFmt(doc,doc_e);
-
- doc_e=DocPrint(doc,"\n$DA,A=\"Repeat N:%%d\"$");
- doc_e->data=&sys_macro_repeat_n;
- DocDataFmt(doc,doc_e);
-
- DocPrint(doc,"\n"
- "$CM+LX,1,3$$BT,\"RECORD\",LE=SM_RECORD$"
- "$CM+LX,17,0$$BT,\"INSERT\",LE=SM_INS$"
- "$CM+LX,1,3$$BT,\"PLAY\",LE=SM_PLAY$"
- "$CM+LX,17,0$$BT,\"REPEAT N\",LE=SM_REPEAT_N$"
- "$CM+LX,1,3$$BT,\"STOP\",LE=SM_STOP$"
- "$CM+LX,17,0$$BT,\"CANCEL\",LE=DOCM_CANCEL$"
- "\n\n\n$GREEN$SHIFT-F2$FG$ will play macro.\n");
- doc->flags|=DOCF_SIZE_MIN | DOCF_FORM;
- StrPrint(buf,"DocMenu(%d);",doc);
- sys_macro_task=Spawn(&SrvCmdLine,NULL,"Macro Popup",,Fs);
- Fs->popup_task=sys_macro_task;
- LBts(&sys_macro_task->display_flags,DISPLAYf_WIN_ON_TOP);
- tmpc=TaskExe(sys_macro_task,Fs,buf,
- 1<<JOBf_WAKE_MASTER|1<<JOBf_FOCUS_MASTER);
- JobResScan(tmpc,&res);
- Fs->popup_task=NULL;
- Kill(sys_macro_task);
- sys_macro_task=NULL;
- DocDataScan(doc,doc_e);
- DocDel(doc);
- return res;
-}
-
-U0 MacroTask(I64)
-{
- I64 i;
- StrCpy(captured_macro_name,"Click Here");
- sys_macro_repeat_n=1;
- do {
- i=PopUpMacroMenu;
- WinRefocus(sys_focus_task);
- switch (i) {
- case SM_RECORD:
- LBtr(&sys_semas[SEMA_RECORD_MACRO],0);
- QueDel(&sys_macro_head,TRUE);
- LBts(&sys_semas[SEMA_RECORD_MACRO],0);
- break;
- case SM_PLAY:
- PlaySysMacro;
- break;
- case SM_REPEAT_N:
- PlaySysMacro(sys_macro_repeat_n);
- break;
- case SM_STOP:
- LBtr(&sys_semas[SEMA_RECORD_MACRO],0);
- break;
- case SM_INS:
- LBtr(&sys_semas[SEMA_RECORD_MACRO],0);
- EdInsCapturedMacro;
- break;
- }
- } while (i>=0);
-}
-
-U0 EdMacroUtil()
-{
- if (!sys_macro_task)
- Spawn(&MacroTask,NULL,"Macro");
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocNew.HC.HTML b/public/src/Adam/DolDoc/DocNew.HC.HTML deleted file mode 100644 index cbb643e..0000000 --- a/public/src/Adam/DolDoc/DocNew.HC.HTML +++ /dev/null @@ -1,397 +0,0 @@ - - - - - DocNew.HC - - - - - #help_index "DolDoc"
-
-public Bool DocLock(CDoc *doc)
-{//Make this task have exclusive access to this doc.
- if (!Bt(&doc->locked_flags,DOClf_LOCKED) || doc->owning_task!=Fs) {
- while (LBts(&doc->locked_flags,DOClf_LOCKED))
- Yield;
- if (doc->owning_task!=Fs)
- LBEqu(&doc->flags,DOCf_BREAK_UNLOCKED,BreakLock(Fs));
- doc->owning_task=Fs;
- return TRUE;
- } else
- return FALSE;
-}
-
-public Bool DocUnlock(CDoc *doc)
-{//Release exclusive lock on access to doc.
- Bool unlock_break;
- if (Bt(&doc->locked_flags,DOClf_LOCKED) && doc->owning_task==Fs) {
- doc->owning_task=0;
- unlock_break=Bt(&doc->flags,DOCf_BREAK_UNLOCKED);
- LBtr(&doc->locked_flags,DOClf_LOCKED);
- if (unlock_break)
- BreakUnlock(Fs);
- return TRUE;
- } else
- return FALSE;
-}
-
-Bool IsEditableText(CDocEntry *doc_e)
-{
- if (doc_e->type_u8==DOCT_TEXT&&!(doc_e->de_flags&DOCEG_DONT_EDIT))
- return TRUE;
- else
- return FALSE;
-}
-
-CDocEntry *DocEntryNewBase(CDoc *doc,I64 type,I64 de_flags=0,
- I64 x=0,I64 y=0,I64 page_line_num=0)
-{//See also MAllocIdent and $MA-X+PU,"CDocEntry",LM="F(\"sizeof(CDocEntry)\");View;"$.
- CDocEntry *res=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
- res->type=type;
- res->de_flags=de_flags|doldoc.dft_de_flags[type.u8[0]];
- res->x=x;
- res->y=y;
- res->page_line_num=page_line_num;
- return res;
-}
-
-CDocEntry *DocEntryNewTag(CDoc *doc,CDocEntry *doc_ce,U8 *tag)
-{
- I64 l=StrLen(tag);
- CDocEntry *res=DocEntryNewBase(doc,doc_ce->type,doc_ce->de_flags,
- doc_ce->x,doc_ce->y,doc_ce->page_line_num);
- res->de_flags=doc_ce->de_flags; //Override
- res->max_col=l;
- res->tag=MAlloc(l+1,doc->mem_task);
- MemCpy(res->tag,tag,l+1);
- MemCpy(&res->settings,&doc_ce->settings,sizeof(CDocSettings));
- return res;
-}
-
-public U0 DocEntryDel(CDoc *doc,CDocEntry *doc_e)
-{//Free entry and all parts of entry.
- if (!doc || doc==doc_e)
- RawPrint(3000,"DocEntryDel");
- else {
- if (doc->cur_entry==doc_e)
- doc->cur_entry=doc_e->next;
- QueRem(doc_e);
- if (doc_e->de_flags & DOCEF_TAG)
- Free(doc_e->tag);
- if (doc_e->de_flags & DOCEF_AUX_STR)
- Free(doc_e->aux_str);
- if (doc_e->de_flags & DOCEF_DEFINE)
- Free(doc_e->define_str);
- if (doc_e->de_flags & DOCEF_HTML_LINK)
- Free(doc_e->html_link);
- if (doc_e->de_flags & DOCEF_LEFT_MACRO)
- Free(doc_e->left_macro);
- if (doc_e->de_flags & DOCEF_RIGHT_MACRO)
- Free(doc_e->right_macro);
- if (doc_e->de_flags & DOCEF_BIN_PTR_LINK)
- Free(doc_e->bin_ptr_link);
- if (doc_e->de_flags & DOCEF_HAS_BIN)
- DocBinDel(doc,doc_e->bin_data);
- if (doc_e->de_flags & DOCEF_REMALLOC_DATA)
- Free(doc_e->data);
- Free(doc_e);
- }
-}
-
-public I64 DocEntrySize(CDoc *,CDocEntry *doc_e)
-{//Mem size of entry and all parts.
- I64 res;
- if (!doc_e) return 0;
- res=MSize2(doc_e);
- if (doc_e->de_flags & DOCEF_TAG)
- res+=MSize2(doc_e->tag);
- if (doc_e->de_flags & DOCEF_AUX_STR)
- res+=MSize2(doc_e->aux_str);
- if (doc_e->de_flags & DOCEF_DEFINE)
- res+=MSize2(doc_e->define_str);
- if (doc_e->de_flags & DOCEF_HTML_LINK)
- res+=MSize2(doc_e->html_link);
- if (doc_e->de_flags & DOCEF_LEFT_MACRO)
- res+=MSize2(doc_e->left_macro);
- if (doc_e->de_flags & DOCEF_RIGHT_MACRO)
- res+=MSize2(doc_e->right_macro);
- if (doc_e->de_flags & DOCEF_BIN_PTR_LINK)
- res+=MSize2(doc_e->bin_ptr_link);
- if (doc_e->de_flags & DOCEF_REMALLOC_DATA)
- res+=MSize2(doc_e->data);
- return res;
-}
-
-U0 DocUndoDel(CDoc *,CDocUndo *u)
-{
- Free(u->body);
- Free(u);
-}
-
-U0 DocUndoCntSet(CDoc *doc)
-{
- Bool unlock=DocLock(doc);
- CDocUndo *u=doc->undo_head.next;
- doc->undo_cnt=0;
- while (u!=&doc->undo_head) {
- doc->undo_cnt++;
- u=u->next;
- }
- if (unlock)
- DocUnlock(doc);
-}
-
-public CDocEntry *DocEntryCopy(CDoc *doc,CDocEntry *doc_e)
-{//Make copy of entry and all parts of entry.
- CDocEntry *doc_ne;
- CDocBin *tmpb;
- CTask *task=doc->mem_task;
- doc_ne=MAllocIdent(doc_e,task);
- doc_ne->next=doc_ne;
- doc_ne->last=doc_ne;
- if (doc_e->de_flags & DOCEF_TAG)
- doc_ne->tag=MAllocIdent(doc_e->tag,task);
- if (doc_e->de_flags & DOCEF_AUX_STR)
- doc_ne->aux_str=MAllocIdent(doc_e->aux_str,task);
- if (doc_e->de_flags & DOCEF_DEFINE)
- doc_ne->define_str=MAllocIdent(doc_e->define_str,task);
- if (doc_e->de_flags & DOCEF_HTML_LINK)
- doc_ne->html_link=MAllocIdent(doc_e->html_link,task);
- if (doc_e->de_flags & DOCEF_LEFT_MACRO)
- doc_ne->left_macro=MAllocIdent(doc_e->left_macro,task);
- if (doc_e->de_flags & DOCEF_RIGHT_MACRO)
- doc_ne->right_macro=MAllocIdent(doc_e->right_macro,task);
- if (doc_e->de_flags & DOCEF_BIN_PTR_LINK)
- doc_ne->bin_ptr_link=MAllocIdent(doc_e->bin_ptr_link,task);
- if (doc_e->de_flags & DOCEF_HAS_BIN) {
- tmpb=MAllocIdent(doc_e->bin_data,task);
- tmpb->data=MAllocIdent(doc_e->bin_data->data,task);
- doc_ne->bin_num=doc->cur_bin_num;
- tmpb->num=doc->cur_bin_num++;
- doc_ne->bin_data=tmpb;
- if (doc_e->de_flags&DOCEF_TAG && doc_e->tag && *doc_e->tag)
- tmpb->tag=StrNew(doc_e->tag,task);
- else
- tmpb->tag=NULL;
- QueIns(tmpb,doc->bin_head.last);
- }
- if (doc_e->de_flags & DOCEF_REMALLOC_DATA)
- doc_ne->data=MAllocIdent(doc_e->data,task);
- return doc_ne;
-}
-
-U0 DocRemSoftNewLines(CDoc *doc=NULL,CDocEntry *doc_e=NULL)
-{
- CDocEntry *doc_e2,*saved_ll=doc_e;
- Bool unlock;
- if (!doc && !(doc=DocPut))
- return;
- unlock=DocLock(doc);
- if (!doc_e) doc_e=doc->head.next;
- while (doc_e!=doc) {
- doc_e2=doc_e->next;
- if (doc_e->type_u8==DOCT_SOFT_NEW_LINE) {
- if (doc->cur_entry==doc_e) {
- doc->cur_entry=doc_e2;
- doc->cur_col=doc->cur_entry->min_col;
- }
- DocEntryDel(doc,doc_e);
- } else if (saved_ll && doc_e->type_u8==DOCT_NEW_LINE)
- break;
- doc_e=doc_e2;
- }
- if (unlock)
- DocUnlock(doc);
-}
-
-public U0 DocInsEntry(CDoc *doc,CDocEntry *doc_e)
-{//Insert entry into doc, updating its vals.
- U8 *dst;
- Bool unlock=DocLock(doc);
- CDocEntry *doc_ce=doc->cur_entry,*doc_ne;
-
- doc_e->x=doc_ce->x;
- doc_e->y=doc_ce->y;
- doc_e->page_line_num=doc_ce->page_line_num;
- MemCpy(&doc_e->settings,&doc_ce->settings,sizeof(CDocSettings));
- if (doc->cur_col>0 &&
- doc_ce->type_u8==DOCT_TEXT &&
- !(doc_ce->de_flags&(DOCEF_TAG_CB|DOCEF_DEFINE|DOCEF_AUX_STR|
- DOCEF_HTML_LINK|DOCEF_BIN_PTR_LINK)) &&
- doc->cur_col<doc_ce->max_col) {
- dst=doc_ce->tag+doc->cur_col;
- doc_ne=DocEntryNewTag(doc,doc_ce,dst);
- *dst=0;
- doc_ne->type=DOCT_TEXT|doc_ce->type&0xFFFFFF00;
- doc_ce->max_col=doc->cur_col;
- QueIns(doc_ne,doc_ce);
- doc->cur_col=0;
- doc_ce=doc_ne;
- }
- if (doc_ce->type_u8==DOCT_TEXT && doc->cur_col>=doc_ce->max_col) {
- QueIns(doc_e,doc_ce);
- doc->cur_entry=doc_e->next;
- } else {
- QueIns(doc_e,doc_ce->last);
- doc->cur_entry=doc_ce;
- }
- doc->cur_col=doc->cur_entry->min_col;
- DocRemSoftNewLines(doc,doc->cur_entry);
- if (unlock)
- DocUnlock(doc);
-}
-
-public U0 DocRst(CDoc *doc,Bool is_old)
-{//Del all entries and set doc to dfts.
- Bool unlock;
- CDocEntry *doc_e,*doc_e2;
- CDocUndo *u,*u8;
- CDocSettings *s;
- CDocBin *b,*b1;
- if (!doc && !(doc=DocPut))
- return;
- unlock=DocLock(doc);
- if (is_old) {
- doc_e=doc->head.next;
- while (doc_e!=doc) {
- doc_e2=doc_e->next;
- DocEntryDel(doc,doc_e);
- doc_e=doc_e2;
- }
- u=doc->undo_head.next;
- while (u!=&doc->undo_head) {
- u8=u->next;
- DocUndoDel(doc,u);
- u=u8;
- }
- b=doc->bin_head.next;
- while (b!=&doc->bin_head) {
- b1=b->next;
- QueRem(b);
- Free(b->data);
- Free(b);
- b=b1;
- }
- }
-//Check DocInsDoc
- doc->flags&=DOCF_BREAK_UNLOCKED;
- doc->head.next=doc->head.last=doc;
- QueInit(&doc->bin_head);
- QueInit(&doc->undo_head);
- doc->undo_head.time_stamp=0;
- doc->undo_cnt=0;
- doc->cur_bin_num=1;
- doc->dollar_buf_ptr=0;
- doc->cmd_U8=CH_SPACE;
- doc->page_line_num=0;
- doc->best_d=I64_MAX;
-
- s=&doc->settings_head;
- s->left_margin=DOC_DFT;
- s->right_margin=DOC_DFT;
- s->indent=0;
- s->page_len=66;
- s->header=DOC_DFT;
- s->footer=DOC_DFT;
- s->state=DOCSS_NORMAL;
- s->comment_depth=0;
- s->paren_depth=0;
- s->brace_depth=0;
- s->shifted_x=0;
- s->shifted_y=0;
- s->cur_text_attr=s->dft_text_attr=DOC_ATTR_DFT_TEXT;
-
- doc_e=&doc->head;
- doc_e->type=DOCT_ERROR;
- doc_e->de_flags=0;
- doc_e->x=0;
- doc_e->y=0;
- doc_e->min_col=0;
- doc_e->max_col=0;
- doc_e->page_line_num=doc->page_line_num;
- MemCpy(&doc_e->settings,s,sizeof(CDocSettings));
-
- DocTop(doc);
- if (unlock)
- DocUnlock(doc);
-}
-
-public U0 DocDel(CDoc *doc)
-{//Free entire doc and entries.
- if (!doc || doc->doc_signature!=DOC_SIGNATURE_VAL) return;
- DocLock(doc);
- doc->doc_signature=0;
- DocRst(doc,TRUE);
- Free(doc->find_replace);
- Free(doc->dollar_buf);
- DocUnlock(doc);
- Free(doc);
-}
-
-public I64 DocSize(CDoc *doc)
-{//Mem size of doc and all its entries.
- Bool unlock;
- CDocEntry *doc_e;
- CDocUndo *u;
- CDocBin *b;
- I64 res=0;
-
- if (!doc || doc->doc_signature!=DOC_SIGNATURE_VAL) return 0;
- unlock=DocLock(doc);
-
- doc_e=doc->head.next;
- while (doc_e!=doc) {
- res+=DocEntrySize(doc,doc_e);
- doc_e=doc_e->next;
- }
-
- u=doc->undo_head.next;
- while (u!=&doc->undo_head) {
- res+=MSize2(u->body);
- res+=MSize2(u);
- u=u->next;
- }
-
- b=doc->bin_head.next;
- while (b!=&doc->bin_head) {
- res+=MSize2(b->data);
- res+=MSize2(b);
- b=b->next;
- }
-
- res+=MSize2(doc->find_replace);
- res+=MSize2(doc->dollar_buf);
- res+=MSize2(doc);
- if (unlock)
- DocUnlock(doc);
- return res;
-}
-
-#help_index "DolDoc"
-public CDoc *DocNew(U8 *filename=NULL,CTask *task=NULL)
-{//MAlloc new DolDoc. (Begin a new doc.)
- CDoc *doc;
- if (!task) task=Fs;
- doc=CAlloc(sizeof(CDoc),task);
- if (filename)
- StrCpy(doc->filename.name,filename);
- else
- StrCpy(doc->filename.name,blkdev.tmp_filename);
- doc->find_replace=CAlloc(sizeof(CEdFindText),task);
- doc->find_replace->scan_fwd=TRUE;
- doc->find_replace->match_case=TRUE;
- doc->find_replace->pmt=TRUE;
- doc->left_click_link=&EdLeftClickLink;
- doc->dollar_buf_size=84;
- doc->dollar_buf=MAlloc(doc->dollar_buf_size,task);
- doc->max_entries=I64_MAX;
- doc->win_task=task;
- doc->mem_task=task;
- DocRst(doc,FALSE);
- doc->doc_signature=DOC_SIGNATURE_VAL;
- return doc;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocPlain.HC.HTML b/public/src/Adam/DolDoc/DocPlain.HC.HTML deleted file mode 100644 index bf6f1d4..0000000 --- a/public/src/Adam/DolDoc/DocPlain.HC.HTML +++ /dev/null @@ -1,623 +0,0 @@ - - - - - DocPlain.HC - - - - - #help_index "DolDoc"
-
-I64 PrsDocFlagSingle(CCmpCtrl *cc,I64 *_de_flags,U32 *_type,Bool turn_on)
-{
- I64 res=-1;
- CHashGeneric *tmph;
- if (cc->token==TK_IDENT &&
- (tmph=HashFind(cc->cur_str,doldoc.hash,DHT_DOC_FLAG))) {
- res=tmph->user_data0;
- if (res<64) {
- BEqu(_de_flags,res,turn_on);
- switch (res) {
- case DOCEf_BLINK:
- case DOCEf_INVERT:
- case DOCEf_UNDERLINE:
- case DOCEf_SEL:
- BEqu(_type,res,turn_on);
- break;
- }
- }
- Lex(cc); //skip flag
- }
- return res;
-}
-
-I64 PrsDocFlags(CCmpCtrl *cc,I64 *_de_flags,U32 *_type)
-{
- I64 res=-1;
- Bool turn_on;
- while (TRUE) {
- if (cc->token=='+')
- turn_on=TRUE;
- else if (cc->token=='-')
- turn_on=FALSE;
- else
- break;
- Lex(cc);
- res=PrsDocFlagSingle(cc,_de_flags,_type,turn_on);
- }
- return res;
-}
-
-U8 *Doc2PlainText(CDoc *doc,CDocEntry *doc_e)
-{//TODO: break strs
- I64 i,j,attr=doc_e->attr,
- t1,f1,de_flags,type;
- U8 *buf,*buf2;
-
- if (doc_e->type_u8==DOCT_FOREGROUND &&
- doc->flags&DOCF_COLOR_NAMES && 0<=attr<COLORS_NUM) {
- buf=StrNew(DefineSub(attr,"ST_COLORS"));
- attr=DOC_DFT;
- } else
- buf=StrNew(DefineSub(doc_e->type_u8,"ST_DOC_CMDS"));
- if (doc_e->type_u8!=DOCT_ERROR) {
- f1=doldoc.dft_de_flags[doc_e->type_u8];
- t1=doc_e->type_u8|doldoc.dft_type_flags[doc_e->type_u8];
-
- de_flags=doc_e->de_flags&~(DOCG_BL_IV_UL|DOCEF_SEL|
- DOCEF_HIGHLIGHT|DOCEF_WORD_WRAP|DOCEF_SKIP|DOCEF_FILTER_SKIP);
- for (i=0;i<DOCEf_FLAGS_NUM;i++)
- if (Bt(&f1,i)!=Bt(&de_flags,i)) {
- if (Bt(&de_flags,i)) {
- if (!(1<<i&DOCEG_HAS_ARG)) {
- buf2=MStrPrint("%s+%Z",buf,i,"ST_DOC_FLAGS");
- Free(buf); buf=buf2;
- }
- } else {
- buf2=MStrPrint("%s-%Z",buf,i,"ST_DOC_FLAGS");
- Free(buf); buf=buf2;
- }
- }
- type=doc_e->type&~DOCET_SEL;
- for (i=DOCEt_BLINK;i<=DOCEt_UNDERLINE;i++)
- if (Bt(&t1,i)!=Bt(&type,i)) {
- if (Bt(&type,i))
- buf2=MStrPrint("%s+%Z",buf,i,"ST_DOC_FLAGS");
- else
- buf2=MStrPrint("%s-%Z",buf,i,"ST_DOC_FLAGS");
- Free(buf); buf=buf2;
- }
- buf2=MStrPrint("%s,",buf);
- Free(buf); buf=buf2;
- switch [doc_e->type_u8] {
- case DOCT_HEX_ED:
- buf2=MStrPrint("%s%d,",buf,doc_e->len);
- Free(buf); buf=buf2;
- buf2=MStrPrint("%s%d,",buf,doc_e->hex_ed_width);
- Free(buf); buf=buf2;
- break;
- case DOCT_FOREGROUND:
- case DOCT_BACKGROUND:
- case DOCT_DFT_FOREGROUND:
- case DOCT_DFT_BACKGROUND:
- if (doc->flags&DOCF_COLOR_NAMES && 0<=attr<COLORS_NUM) {
- buf2=MStrPrint("%s%Z,",buf,doc_e->attr,"ST_COLORS");
- Free(buf); buf=buf2;
- break;
- }
- case DOCT_PAGE_LEN:
- case DOCT_LEFT_MARGIN:
- case DOCT_RIGHT_MARGIN:
- case DOCT_HEADER:
- case DOCT_FOOTER:
- case DOCT_INDENT:
- case DOCT_WORD_WRAP:
- case DOCT_HIGHLIGHT:
- case DOCT_BLINK:
- case DOCT_INVERT:
- case DOCT_UNDERLINE:
- case DOCT_SHIFTED_X:
- case DOCT_SHIFTED_Y:
- if (attr!=DOC_DFT) {
- buf2=MStrPrint("%s%d,",buf,doc_e->attr);
- Free(buf); buf=buf2;
- }
- case DOCT_TYPES_NUM-1: //nobound switch
- break;
- }
- de_flags=doc_e->de_flags & DOCEG_HAS_ARG;
- while (de_flags) {
- j=Bsf(de_flags);
- Btr(&de_flags,j);
- switch [j] {
- case DOCEf_TAG:
- if (doc_e->type_u8==DOCT_DATA || doc_e->type_u8==DOCT_MACRO &&
- (doc_e->de_flags&DOCEF_LEFT_MACRO &&
- !StrCmp(doc_e->tag,doc_e->left_macro) ||
- doc_e->de_flags&DOCEF_RIGHT_MACRO &&
- !StrCmp(doc_e->tag,doc_e->right_macro)) ||
- doc_e->de_flags&DOCEF_LST && !StrCmp(doc_e->tag,"[]") &&
- doc_e->de_flags&DOCEF_DEFINE) {
- buf2=buf;
- buf=NULL;
- } else {
- if (doc_e->type_u8==DOCT_CHECK_BOX) {
- if (StrLen(doc_e->tag)>=4)
- buf2=doc_e->tag+4;
- else
- buf2="";
- } else if (doc_e->de_flags & DOCEF_TREE) {
- if (StrLen(doc_e->tag)>=3)
- buf2=doc_e->tag+3;
- else
- buf2="";
- } else
- buf2=doc_e->tag;
- if (Bt(&doldoc.dft_de_flags[doc_e->type_u8],DOCEf_TAG))
- buf2=MStrPrint("%s\"%$Q\",",buf,buf2);
- else
- buf2=MStrPrint("%sT=\"%$Q\",",buf,buf2);
- }
- break;
- case DOCEf_LEN:
- buf2=MStrPrint("%sLEN=%d,",buf,doc_e->len);
- break;
- case DOCEf_AUX_STR:
- buf2=MStrPrint("%sA=\"%$Q\",",buf,doc_e->aux_str);
- break;
- case DOCEf_DEFINE:
- buf2=MStrPrint("%sD=\"%$Q\",",buf,doc_e->define_str);
- break;
- case DOCEf_HTML_LINK:
- buf2=MStrPrint("%sHTML=\"%$Q\",",buf,doc_e->html_link);
- break;
- case DOCEf_LEFT_EXP:
- buf2=MStrPrint("%sLE=%d,",buf,doc_e->left_exp);
- break;
- case DOCEf_LEFT_MACRO:
- buf2=MStrPrint("%sLM=\"%$Q\",",buf,doc_e->left_macro);
- break;
- case DOCEf_RIGHT_EXP:
- buf2=MStrPrint("%sRE=%d,",buf,doc_e->right_exp);
- break;
- case DOCEf_RIGHT_MACRO:
- buf2=MStrPrint("%sRM=\"%$Q\",",buf,doc_e->right_macro);
- break;
- case DOCEf_HAS_BIN:
- buf2=MStrPrint("%sBI=%d,",buf,doc_e->bin_num);
- break;
- case DOCEf_BIN_PTR_LINK:
- buf2=MStrPrint("%sBP=\"%$Q\",",buf,doc_e->bin_ptr_link);
- break;
- case DOCEf_RAW_TYPE:
- if (doc_e->type_u8==DOCT_CHECK_BOX&&doc_e->raw_type!=RT_I8 ||
- doc_e->type_u8!=DOCT_CHECK_BOX&&doc_e->raw_type!=RT_I64)
- buf2=MStrPrint("%sRT=%Z,",buf,doc_e->raw_type,"ST_RAW_TYPES");
- break;
- case DOCEf_SHIFTED_X:
- j=doc_e->type.u16[1]&0x1F;
- if (j&0x10) j|=0xFFFFFFF0;
- buf2=MStrPrint("%sSX=%d,",buf,j);
- break;
- case DOCEf_SHIFTED_Y:
- j=doc_e->type>>21 &0x1F;
- if (j&0x10) j|=0xFFFFFFF0;
- buf2=MStrPrint("%sSY=%d,",buf,j);
- break;
- case DOCEf_SCROLLING_X:
- buf2=MStrPrint("%sSCX=%d,",buf,doc_e->scroll_len);
- break;
- case DOCEf_USER_DATA:
- buf2=MStrPrint("%sU=0x%X,",buf,doc_e->user_data);
- break;
- case DOCEf_FLAGS_NUM-1: //nobound switch
- break;
- }
- Free(buf); buf=buf2;
- }
- buf[StrLen(buf)-1]=0; //Kill last comma
- }
- buf2=StrNew(buf,doc->mem_task); //exact allocation
- Free(buf);
- return buf2;
-}
-
-CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
-{//Uses $LK-UL,"Lex",A="MN:Lex"$() to parse a string and make Doc entries.
- I64 i,j,de_flags,processed_flags,attr=DOC_DFT;
- U8 *ptr,*st2;
- CDocEntry *doc_e=NULL;
- CHashGeneric *tmph;
- CCmpCtrl *cc=CmpCtrlNew(st,CCF_DONT_FREE_BUF);
- CHashTable *old_hash_table_lst=cc->htc.hash_table_lst;
- try {
- cc->htc.hash_table_lst=NULL;
- if (Lex(cc)==TK_IDENT) {
- if (tmph=HashFind(cc->cur_str,doldoc.hash,DHT_DOC_CMD|DHT_COLOR)) {
- if (tmph->type&DHT_DOC_CMD)
- i=tmph->user_data0;
- else {//DHT_COLOR
- i=DOCT_FOREGROUND;
- attr=tmph->user_data0;
- }
- } else
- goto pd_err;
- Lex(cc); //skip cmd code
- doc_e=CAlloc(sizeof(CDocEntry),doc->mem_task);
- doc_e->type=i;
- doc_e->de_flags=doldoc.dft_de_flags[i];
- doc_e->type|=doldoc.dft_type_flags[i];
- doc_e->raw_type=RT_I64;
- doc_e->len=DOCE_LEN_DFT;
- j=PrsDocFlags(cc,&doc_e->de_flags,&doc_e->type);
- cc->htc.hash_table_lst=old_hash_table_lst;
- switch [i] {
- case DOCT_CHECK_BOX:
- doc_e->raw_type=RT_I8;
- break;
- case DOCT_HEX_ED:
- while (cc->token==',')
- Lex(cc);
- if (cc->token)
- doc_e->len=LexExpressionI64(cc);
- else
- goto pd_err;
- while (cc->token==',')
- Lex(cc);
- if (cc->token)
- doc_e->hex_ed_width=LexExpressionI64(cc);
- else
- goto pd_err;
- break;
- case DOCT_PAGE_LEN:
- case DOCT_LEFT_MARGIN:
- case DOCT_RIGHT_MARGIN:
- case DOCT_HEADER:
- case DOCT_FOOTER:
- case DOCT_INDENT:
- case DOCT_FOREGROUND:
- case DOCT_BACKGROUND:
- case DOCT_DFT_FOREGROUND:
- case DOCT_DFT_BACKGROUND:
- case DOCT_WORD_WRAP:
- case DOCT_HIGHLIGHT:
- case DOCT_BLINK:
- case DOCT_INVERT:
- case DOCT_UNDERLINE:
- case DOCT_SHIFTED_X:
- case DOCT_SHIFTED_Y:
- while (cc->token==',')
- Lex(cc);
- if (cc->token)
- doc_e->attr=LexExpressionI64(cc);
- else
- doc_e->attr=attr;
- break;
-#assert DOCT_ERROR==DOCT_TYPES_NUM-1
- case DOCT_ERROR:
- goto pd_err;
- }
-
- processed_flags=0;
- while (TRUE) {
- cc->htc.hash_table_lst=NULL;
- while (cc->token==',')
- Lex(cc);
- cc->htc.hash_table_lst=old_hash_table_lst;
- j=PrsDocFlagSingle(cc,&doc_e->de_flags,&doc_e->type,TRUE);
- if (!(de_flags=~processed_flags & doc_e->de_flags & DOCEG_HAS_ARG))
- break;
- if (cc->token=='=')
- Lex(cc);
- else
- j=Bsf(de_flags);
- if (j<0 || Bts(&processed_flags,j))
- goto pd_err;
- switch [j] {//TODO: Might check for expression errors
- case DOCEf_TAG:
- if (!doc_e->tag) {
-//If a $MA,LM=""$, Tag is filled when the LM is processed.
- //if doc_e->df_flags&DOCEF_LST,
- // Tag is filled when the Define is processed.
- //(The dft_flag1.tag calls this after.)
- if (cc->token==TK_STR) {
- st2=LexExtStr(cc);
- if (i==DOCT_CHECK_BOX) {
- st=MStrPrint("[X] %s",st2);
- Free(st2);
- doc_e->min_col=1;
- } else if (doc_e->de_flags & DOCEF_LST) {
- if (*st2!='[') {
- st=MStrPrint("[%s]",st2);
- Free(st2);
- } else
- st=st2;
- doc_e->min_col=1;
- } else if (doc_e->de_flags & DOCEF_TREE) {
- st=MStrPrint("+] %s",st2);
- Free(st2);
- doc_e->min_col=1;
- } else
- st=st2;
- doc_e->tag=StrNew(st,doc->mem_task);
- Free(st);
- } else
- goto pd_err;
- }
- break;
- case DOCEf_LEN:
- if (cc->token) {
- doc_e->len=LexExpression(cc);
- doc_e->de_flags&=~DOCEF_DFT_LEN;
- } else
- goto pd_err;
- break;
- case DOCEf_AUX_STR:
- if (cc->token==TK_STR) {
- st2=LexExtStr(cc);
- doc_e->aux_str=StrNew(st2,doc->mem_task);
- Free(st2);
-//$AN,"Anchor",A="DataTagWidth"$
- if (i==DOCT_DATA) { //See DocForm()
- if (ptr=StrMatch(":",doc_e->aux_str))
- doc_e->min_col=ptr-doc_e->aux_str+1;
- doc_e->tag=MAlloc(doc_e->len+doc_e->min_col+2,
- doc->mem_task); //+2 because "_\0"
- }
- } else
- goto pd_err;
- break;
- case DOCEf_DEFINE:
- if (cc->token==TK_STR) {
- st2=LexExtStr(cc);
- doc_e->define_str=StrNew(st2,doc->mem_task);
- Free(st2);
- if (doc_e->de_flags&DOCEF_LST && !doc_e->tag)
- doc_e->tag=StrNew("[]",doc->mem_task);
- } else
- goto pd_err;
- break;
- case DOCEf_HTML_LINK:
- if (cc->token==TK_STR) {
- st2=LexExtStr(cc);
- doc_e->html_link=StrNew(st2,doc->mem_task);
- Free(st2);
- } else
- goto pd_err;
- break;
- case DOCEf_LEFT_EXP:
- if (cc->token)
- doc_e->left_exp=LexExpression(cc);
- else
- goto pd_err;
- break;
- case DOCEf_LEFT_MACRO:
- if (cc->token==TK_STR) {
- st2=LexExtStr(cc);
- doc_e->left_macro=StrNew(st2,doc->mem_task);
- Free(st2);
- if (i==DOCT_MACRO && !doc_e->tag)
- doc_e->tag=StrNew(doc_e->left_macro,doc->mem_task);
- } else
- goto pd_err;
- break;
- case DOCEf_RIGHT_EXP:
- if (cc->token)
- doc_e->right_exp=LexExpression(cc);
- else
- goto pd_err;
- break;
- case DOCEf_RIGHT_MACRO:
- if (cc->token==TK_STR) {
- st2=LexExtStr(cc);
- doc_e->right_macro=StrNew(st2,doc->mem_task);
- Free(st2);
- if (i==DOCT_MACRO && !doc_e->tag)
- doc_e->tag=StrNew(doc_e->right_macro,doc->mem_task);
- } else
- goto pd_err;
- break;
- case DOCEf_HAS_BIN:
- if (cc->token)
- doc_e->bin_num=LexExpressionI64(cc);
- else
- goto pd_err;
- break;
- case DOCEf_BIN_PTR_LINK:
- if (cc->token==TK_STR) {
- st2=LexExtStr(cc);
- doc_e->bin_ptr_link=StrNew(st2,doc->mem_task);
- Free(st2);
- if (!DocBinPtrRst(doc,doc_e))
- doc_e->type=DOCT_ERROR;
- } else
- goto pd_err;
- break;
- case DOCEf_RAW_TYPE:
- if (cc->token==TK_IDENT) {
- j=DefineMatch(cc->cur_str,"ST_RAW_TYPES");
- if (j<0)
- goto pd_err;
- doc_e->raw_type=j;
- doc_e->de_flags&=~DOCEF_DFT_RAW_TYPE;
- Lex(cc);
- } else
- goto pd_err;
- break;
- case DOCEf_SHIFTED_X:
- if (cc->token)
- doc_e->type|=(LexExpressionI64(cc) & 0x1F)<<16;
- else
- goto pd_err;
- break;
- case DOCEf_SHIFTED_Y:
- if (cc->token)
- doc_e->type|=(LexExpressionI64(cc) & 0x1F)<<21;
- else
- goto pd_err;
- break;
- case DOCEf_SCROLLING_X:
- if (cc->token)
- doc_e->scroll_len=LexExpressionI64(cc);
- else
- goto pd_err;
- break;
- case DOCEf_USER_DATA:
- if (cc->token)
- doc_e->user_data=LexExpression(cc);
- else
- goto pd_err;
- break;
- case DOCEf_FLAGS_NUM-1: //nobound switch
- break;
- }
- }
- } else {
-pd_err:
- if (!doc_e)
- doc_e=CAlloc(sizeof(CDocEntry),doc->mem_task);
- doc_e->type=DOCT_ERROR;
- doc_e->de_flags=0;
- }
- if (doc_e->de_flags&DOCEF_LST && (doc_e->de_flags&DOCEF_REMALLOC_DATA ||
- !(doc_e->de_flags&DOCEF_DEREF_DATA))) {
- DocDataScan(doc,doc_e);
- DocDataFmt(doc,doc_e);
- }
- CmpCtrlDel(cc);
- } catch {
- Fs->catch_except=TRUE;
- if (!doc_e)
- doc_e=CAlloc(sizeof(CDocEntry),doc->mem_task);
- doc_e->type=DOCT_ERROR;
- doc_e->de_flags=0;
- }
- return doc_e;
-}
-
-U0 DocEntryToggle(CDoc *doc)
-{
- Bool unlock=DocLock(doc),old_color_names;
- CDocEntry *doc_ce=doc->cur_entry,*cl1,*doc_ce2;
- U8 ch,*st,*st2;
- I64 i,j,k;
- if (doc_ce!=doc &&
- !(doc->flags&(DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_TABS))) {
- if (doc_ce->type_u8==DOCT_TEXT && !(doc_ce->de_flags &
- ~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT|
- DOCEF_SKIP|DOCEF_FILTER_SKIP)) &&
- !(doc_ce->type&DOCG_BL_IV_UL)) {
- doc_ce2=doc_ce->last;
- for (k=0;k<20;k++) {
- if (doc_ce2!=doc) {
- cl1=doc_ce2->last;
- if (doc_ce2->type_u8==DOCT_TEXT &&
- doc_ce->de_flags==doc_ce2->de_flags &&
- doc_ce->type==doc_ce2->type) {
- i=StrLen(doc_ce2->tag);
- j=StrLen(doc_ce->tag);
- st=MAlloc(i+j+1,doc->mem_task);
- MemCpy(st,doc_ce2->tag,i);
- MemCpy(st+i,doc_ce->tag,j+1);
- Free(doc_ce->tag);
- doc_ce->tag=st;
- doc_ce->max_col=i+j;
- doc->cur_col+=i;
- DocEntryDel(doc,doc_ce2);
- } else if (doc_ce2->type_u8==DOCT_SOFT_NEW_LINE)
- DocEntryDel(doc,doc_ce2);
- else
- break;
- doc_ce2=cl1;
- } else
- break;
- }
- doc_ce2=doc_ce->next;
- for (k=0;k<20;k++) {
- if (doc_ce2!=doc) {
- cl1=doc_ce2->next;
- if (doc_ce2->type_u8==DOCT_TEXT &&
- doc_ce->de_flags==doc_ce2->de_flags &&
- doc_ce->type==doc_ce2->type) {
- i=StrLen(doc_ce->tag);
- j=StrLen(doc_ce2->tag);
- st=MAlloc(i+j+1,doc->mem_task);
- MemCpy(st,doc_ce->tag,i);
- MemCpy(st+i,doc_ce2->tag,j+1);
- Free(doc_ce->tag);
- doc_ce->tag=st;
- doc_ce->max_col=i+j;
- DocEntryDel(doc,doc_ce2);
- } else if (doc_ce2->type_u8==DOCT_SOFT_NEW_LINE)
- DocEntryDel(doc,doc_ce2);
- else
- break;
- doc_ce2=cl1;
- } else
- break;
- }
- i=doc->cur_col;
- while (i>doc_ce->min_col && doc_ce->tag[i]!='$')
- i--;
- j=doc->cur_col+1;
- while (j<doc_ce->max_col && doc_ce->tag[j]!='$')
- j++;
- if (i<j-1 && doc_ce->min_col<=i<j<doc_ce->max_col &&
- doc_ce->tag[i]=='$' && doc_ce->tag[j]=='$') {
- ch=doc_ce->tag[j+1];
- doc_ce->tag[j+1]=0;
- st=StrNew(doc_ce->tag+i);
- doc_ce->tag[j+1]=ch;
- StrCpy(doc_ce->tag+i,doc_ce->tag+j+1);
- doc->cur_col=i;
- st2=MStrPrint("%q",st);
- if (doc_ce=DocPrint(doc,st2)) {
- doc->cur_entry=doc_ce;
- doc->cur_col=doc_ce->min_col;
- }
- Free(st);
- Free(st2);
- }
- } else {
- old_color_names=LBts(&doc->flags,DOCf_COLOR_NAMES);
- st=Doc2PlainText(doc,doc_ce);
- LBEqu(&doc->flags,DOCf_COLOR_NAMES,old_color_names);
- DocEntryDel(doc,doc_ce);
- DocPrint(doc,"$$%$Q$$",st);
- }
- DocRecalc(doc);
- }
- if (unlock)
- DocUnlock(doc);
-}
-
-U0 DocFlagsToggle(CDoc *doc,I64 tog_flags)
-{
- Bool unlock=DocLock(doc);
- I64 size,flags=doc->flags^tog_flags;
- U8 *st;
- CDocUndo *u_next,*u_last;
-
- doc->flags=doc->flags&~DOCF_NO_CURSOR|DOCF_COLOR_NAMES;
- st=DocSave(doc,&size);
-
- u_next=doc->undo_head.next;
- u_last=doc->undo_head.last;
- doc->undo_head.next=doc->undo_head.last=&doc->undo_head;
-
- DocRst(doc,TRUE);
- doc->undo_head.next=u_next;
- doc->undo_head.last=u_last;
- DocUndoCntSet(doc);
- doc->flags=flags&~(DOCF_NO_CURSOR|DOCG_BL_IV_UL|DOCF_WORD_WRAP);
- DocLoad(doc,st,size);
- doc->flags|=flags&DOCF_NO_CURSOR;
- DocCenter(doc);
- if (unlock)
- DocUnlock(doc);
- Free(st);
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocPopUp.HC.HTML b/public/src/Adam/DolDoc/DocPopUp.HC.HTML deleted file mode 100644 index bb6cb67..0000000 --- a/public/src/Adam/DolDoc/DocPopUp.HC.HTML +++ /dev/null @@ -1,329 +0,0 @@ - - - - - DocPopUp.HC - - - - - #help_index "DolDoc/Output;StdOut/DolDoc"
-public CTask *PopUpViewDoc(CDoc *doc,I64 dof_flags=0)
-{//Pass doc to PopUp win task for viewing.
- U8 *buf=MStrPrint("DocEd(0x%X,0x%X);",doc,dof_flags);
- CTask *task=Spawn(&SrvCmdLine,NULL,"View",,Fs);
- TaskExe(task,NULL,buf,1<<JOBf_EXIT_ON_COMPLETE|1<<JOBf_FREE_ON_COMPLETE);
- Free(buf);
- return task;
-}
-
-public CTask *PopUpViewPrint(U8 *fmt,...)
-{//View Print stmt in PopUp win task.
- CTask *task=Spawn(&SrvCmdLine,NULL,"View",,Fs);
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
- CDoc *doc=DocNew(,task);
- DocPrint(doc,buf);
- Free(buf);
- buf=MStrPrint("DocEd(0x%X);",doc);
- TaskExe(task,NULL,buf,1<<JOBf_EXIT_ON_COMPLETE|1<<JOBf_FREE_ON_COMPLETE);
- Free(buf);
- return task;
-}
-
-#help_index "DolDoc/Input;File/FileNames;StdIn/DolDoc"
-public U8 *PopUpPickFile(U8 *dir=NULL)
-{//Filename chooser. Uses FileMgr().
- U8 *res,*st,*st2;
- if (dir)
- st=MStrPrint("Cd(\"%Q\");FileMgr(FM_PICK_FILE,Fs->parent_task);",dir);
- else {
- st2=DirCur;
- st=MStrPrint("Cd(\"%Q\");FileMgr(FM_PICK_FILE,Fs->parent_task);",st2);
- Free(st2);
- }
- res=PopUp(st,Fs);
- Free(st);
- return res;
-}
-
-public U8 *PopUpPickDir(U8 *dir=NULL)
-{//File dir name chooser. Uses FileMgr().
- U8 *res,*st,*st2;
- if (dir)
- st=MStrPrint("Cd(\"%Q\");FileMgr(FM_PICK_DIR,Fs->parent_task);",dir);
- else {
- st2=DirCur;
- st=MStrPrint("Cd(\"%Q\");FileMgr(FM_PICK_DIR,Fs->parent_task);",st2);
- Free(st2);
- }
- res=PopUp(st,Fs);
- Free(st);
- return res;
-}
-
-public U8 *FileNameForm(U8 *dft=NULL,I64 dof_flags=0,CTask *mem_task=NULL)
-{//Text filename form in cur win, not PopUp.
- CEdFileName fn;
- if (dft)
- StrCpy(fn.name,dft);
- else
- *fn.name=0;
- if (DocForm(&fn,,dof_flags))
- return StrNew(fn.name,mem_task);
- else
- return NULL;
-}
-
-public U8 *PopUpFileName(U8 *dft=NULL,I64 dof_flags=0)
-{//Filename chooser. Uses form, not FileMgr().
- U8 *st=MStrPrint("FileNameForm(\"%Q\",0x%X,Fs->parent_task);",
- dft,dof_flags|DOF_SIZE_MIN),*res=PopUp(st,Fs);
- Free(st);
- return res;
-}
-
-#help_index "DolDoc"
-Bool PopUpCd()
-{
- Bool res;
- U8 *st=PopUpPickDir;
- if (st) {
- res=Cd(st);
- Free(st);
- } else
- res=FALSE;
- return res;
-}
-
-#help_index "DolDoc/Input;Char/Lists;StdIn/DolDoc"
-public I64 PopUpPickLst(U8 *lst)
-{//Prompt for lst entry in PopUp win task.
- I64 res,i=0;
- CDoc *doc=DocNew;
- DocPrint(doc,"$LTBLUE$");
- while (*lst) {
- if (*lst=='@') {//Check for '@' alias lst entry
- i--;
- lst++;
- }
- DocPrint(doc,"$MU,\"%s\",LE=%d$\n",lst,i++);
- lst+=StrLen(lst)+1;
- }
- DocPrint(doc,"\n$MU,\"CANCEL\",LE=DOCM_CANCEL$\n");
- res=PopUpMenu(doc);
- DocDel(doc);
- return res;
-}
-
-#help_index "DolDoc/Input;Char/Lists;Char/Define;StdIn/DolDoc"
-public U8 *PopUpPickDefineSub(U8 *dname)
-{//Prompt for Define lst entry in PopUp win task.
- return PopUpPickLst(Define(dname));
-}
-
-#help_index "DolDoc/Input;StdIn/DolDoc"
-public I64 PopUp1(U8 *b1,I64 n1,U8 *header=NULL,U8 *footer=NULL)
-{//Make PopUp win task with one bttn.
- I64 i,l1=StrLen(b1);
- CDoc *doc=DocNew;
- if (header) DocPrint(doc,"%s",header);
- DocPrint(doc,"$CM+CX,%d,4$$BT,\"%s\",LE=%d$\n",-l1/2,b1,n1);
- if (footer) DocPrint(doc,"%s",footer);
- i=PopUpMenu(doc);
- DocDel(doc);
- return i;
-}
-
-public I64 PopUp2(U8 *b1,I64 n1,U8 *b2,I64 n2,U8 *header=NULL,U8 *footer=NULL)
-{//Make PopUp win task with two bttns.
- I64 i,l1=StrLen(b1),l2=StrLen(b2),y;
- CDoc *doc=DocNew;
- if (header) {
- DocPrint(doc,"%s",header);
- y=4;
- } else {
- DocPrint(doc,"%*s\n",l1+l2+10,"");
- y=3;
- }
- DocPrint(doc,"$CM+CX,%d,%d$$BT,\"%s\",LE=%d$",-(l1+l2+3)>>1,y,b1,n1);
- DocPrint(doc,"$CM+CX,%d,0$$BT,\"%s\",LE=%d$\n" ,-(l1+l2+3)>>1+l1+6,b2,n2);
- if (footer) DocPrint(doc,"%s",footer);
- i=PopUpMenu(doc);
- DocDel(doc);
- return i;
-}
-
-public Bool PopUpOk(U8 *header=NULL,U8 *footer=NULL)
-{//Make PopUp win task with OKAY bttn.
- return PopUp1("OKAY",1,header,footer)>0;
-}
-
-public Bool PopUpNoYes(U8 *header=NULL,U8 *footer=NULL)
-{//Make PopUp win task with NO/YES bttns.
- return PopUp2("YES",1,"NO",0,header,footer)>0;
-}
-
-public Bool PopUpCancelOk(U8 *header=NULL,U8 *footer=NULL)
-{//Make PopUp win task CANCEL/OKAY bttns.
- return PopUp2("OKAY",1,"CANCEL",0,header,footer)>0;
-}
-
-U8 *PopUpGetStr2(U8 *header,CTask *mem_task)
-{
- U8 *res,*st;
- if (header)
- "%s",header;
- st=GetStr(,,GSF_WITH_NEW_LINE);
- res=StrNew(st,mem_task);
- Free(st);
- return res;
-}
-
-public U8 *PopUpGetStr(U8 *header=NULL)
-{//Prompt for text str in PopUp win task.
- U8 *st=MStrPrint("PopUpGetStr2(0x%X,0x%X);",header,Fs),
- *res=PopUp(st,Fs);
- Free(st);
- return res;
-}
-
-public I64 PopUpGetI64(U8 *msg,I64 dft,I64 lo=I64_MIN,I64 hi=I64_MAX)
-{//Prompt for I64 text expression in PopUp win task.
- U8 *st=MStrPrint("GetI64(0x%X,0x%X,0x%X,0x%X);",msg,dft,lo,hi);
- I64 res=PopUp(st,Fs);
- Free(st);
- return res;
-}
-
-public F64 PopUpGetF64(U8 *msg,F64 dft,F64 lo=F64_MIN,F64 hi=F64_MAX)
-{//Prompt for F64 text expression in PopUp win task.
- U8 *st=MStrPrint("GetF64(0x%X,0x%X(F64),0x%X(F64),0x%X(F64));",msg,dft,lo,hi);
- F64 res=PopUp(st,Fs)(F64);
- Free(st);
- return res;
-}
-
-public I64 PopUpRangeI64(I64 lo,I64 hi,I64 step=1,
- U8 *header=NULL,U8 *footer=NULL)
-{//Evenly-spaced I64 range chooser in PopUp win task.
- I64 i;
- CDoc *doc=DocNew;
- if (header)
- DocPrint(doc,"%s",header);
- DocPrint(doc,"$LTBLUE$");
- for (i=lo;i<=hi;i+=step)
- DocPrint(doc,"$MU,\"%d\",LE=%d$\n",i,i);
- if (footer)
- DocPrint(doc,"%s",footer);
- i=PopUpMenu(doc);
- DocDel(doc);
- return i;
-}
-
-public F64 PopUpRangeF64(F64 lo,F64 hi,F64 step,
- U8 *fmt="%9.4f",U8 *header=NULL,U8 *footer=NULL)
-{//Evenly-spaced F64 range chooser in PopUp win task.
- F64 d;
- I64 i;
- U8 buf[STR_LEN];
- CDoc *doc=DocNew;
- if (header)
- DocPrint(doc,"%s",header);
- DocPrint(doc,"$LTBLUE$");
- for (d=lo;d<=hi;d+=step) {
- StrPrint(buf,fmt,d);
- DocPrint(doc,"$MU,\"%s\",LE=0x%X$\n",buf,d);
- }
- if (footer)
- DocPrint(doc,"%s",footer);
- i=PopUpMenu(doc);
- DocDel(doc);
- return i(F64);
-}
-
-public F64 PopUpRangeF64Exp(F64 lo,F64 hi,F64 factor,
- U8 *fmt="%9.4f",U8 *header=NULL,U8 *footer=NULL)
-{//Exp-spaced F64 range chooser in PopUp win task.
- F64 d;
- I64 i;
- U8 buf[STR_LEN];
- CDoc *doc=DocNew;
- if (header)
- DocPrint(doc,"%s",header);
- DocPrint(doc,"$LTBLUE$");
- for (d=lo;d<=hi;d*=factor) {
- StrPrint(buf,fmt,d);
- DocPrint(doc,"$MU,\"%s\",LE=0x%X$\n",buf,d);
- }
- if (footer)
- DocPrint(doc,"%s",footer);
- i=PopUpMenu(doc);
- DocDel(doc);
- return i(F64);
-}
-
-public F64 PopUpRangeF64Log(F64 lo,F64 hi,I64 steps,
- U8 *fmt="%9.4f",U8 *header=NULL,U8 *footer=NULL)
-{//Log-spaced F64 range chooser in PopUp win task.
- return PopUpRangeF64Exp(lo,hi,Exp(Ln(hi/lo)/(steps-1)),fmt,header,footer);
-}
-
-#help_index "Job/Exe;Task/Job/Exe;Compiler"
-public I64 AdamFile(U8 *filename,Bool warn_ext=TRUE)
-{//Make adam_task execute file.
- Bool okay=TRUE;
- U8 *name=FileNameAbs(filename),
- *name2=ExtDft(name,"HC.Z");
- I64 res=0;
- if (warn_ext &&
- !FilesFindMatch(name2,FILEMASK_JIT) &&
- !PopUpCancelOk(ST_WARN_ST "Not .HC File\n\n"))
- okay=FALSE;
- if (okay)
- res=Adam("#include \"%s\";",name2);
- Free(name2);
- Free(name);
- return res;
-}
-
-public I64 PopUpFile(U8 *filename,Bool warn_ext=TRUE,
- CTask *parent=NULL,CTask **_pu_task=NULL)
-{//ExeFile2() in PopUp task. Cont as User.
- Bool okay=TRUE;
- U8 *st,*name=FileNameAbs(filename),
- *name2=ExtDft(name,"HC.Z");
- I64 res=0;
- if (warn_ext &&
- !FilesFindMatch(name2,FILEMASK_JIT) &&
- !PopUpCancelOk(ST_WARN_ST "Not .HC File\n\n"))
- okay=FALSE;
- if (okay) {
- st=MStrPrint(
- "\"$$WW+H,1$$\";In(\"ExeFile2(\\\"%s\\\",CCF_CMD_LINE);\\n\");"
- "UserTaskCont;",
- name2);
- res=PopUp(st,parent,_pu_task);
- Free(st);
- }
- Free(name2);
- Free(name);
- return res;
-}
-
-public I64 PopUpRunFile(U8 *filename,I64 ccf_flags=0,...)
-{//ExeFile() with args using LastFun() in PopUp task.
- U8 *st,*name=FileNameAbs(filename),
- *name2=ExtDft(name,"HC.Z");
- I64 res=0;
- st=MStrPrint(
- "\"$$WW+H,1$$\";ExeFile2(\"%s\",0x%X);LastFun(0x%X,0x%X);",
- name2,ccf_flags,argc,argv);
- res=PopUp(st,Fs);
- Free(st);
- Free(name2);
- Free(name);
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocPutKey.HC.HTML b/public/src/Adam/DolDoc/DocPutKey.HC.HTML deleted file mode 100644 index 3a6cc7d..0000000 --- a/public/src/Adam/DolDoc/DocPutKey.HC.HTML +++ /dev/null @@ -1,741 +0,0 @@ - - - - - DocPutKey.HC - - - - - #help_index "DolDoc/Output;StdOut/DolDoc"
-
-public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
-{//PutKey(ch,sc) at doc insert pt, cur_entry.
- I64 i,x,y;
- CDoc *m;
- CDocEntry *doc_ce;
- U8 *st,*st2;
- Bool unlock;
-
- if (!doc && !(doc=DocPut) || doc->doc_signature!=DOC_SIGNATURE_VAL)
- return;
- if (doc->user_put_key && (*doc->user_put_key)(doc,doc->user_put_data,ch,sc))
- return;
- unlock=DocLock(doc);
- if (!Bt(doldoc.clean_scan_codes,sc.u8[0]))
- doc->flags|=DOCF_UNDO_DIRTY;
- DocCaptureUndo(doc);
- if (Bt(char_bmp_printable,ch) && !(sc&(SCF_CTRL|SCF_ALT))) {
- if (sc&SCF_KEY_DESC) {
- st=Char2KeyName(ch,FALSE);
- KeyDescSet("Char/'%s'",st);
- Free(st);
- } else
- EdCharIns(ch,sc,doc);
- } else {
- doc_ce=doc->cur_entry;
- x=doc->x; y=doc->y;
- if (sc&SCF_ALT)
- switch (ch) {
- case CH_BACKSPACE: //<CTRL-H>
- if (!(sc&(SCF_SHIFT|SCF_CTRL))) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Edit/Undo");
- else
- DocUndoRestore(doc);
- }
- break;
- }
- else
- switch (ch) {
- case 0:
- switch (sc.u8[0]) {
- case SC_CURSOR_DOWN:
- if (!(sc&SCF_CTRL)) {
- if (sc&SCF_KEY_DESC) {
- if (sc&SCF_SHIFT)
- KeyDescSet("Edit/Cursor Down, Sel");
- else
- KeyDescSet("Edit/Cursor Down");
- } else
- EdLineDown(doc,sc);
- break;
- } else
- sc&=~SCF_CTRL;
-//Fall Through to SC_END
- case SC_END:
- if (!(sc&SCF_CTRL)) {
- if (sc&SCF_KEY_DESC) {
- if (sc&SCF_SHIFT)
- KeyDescSet("Edit/GoTo Doc End, Sel");
- else
- KeyDescSet("Edit/GoTo Doc End");
- } else {
- while (doc_ce!=doc) {
- BEqu(&doc_ce->type,DOCEt_SEL,sc&SCF_SHIFT);
- doc_ce=doc->cur_entry=doc_ce->next;
- }
- doc->cur_col=doc_ce->min_col;
- DocFormBwd(doc);
- }
- }
- break;
- case SC_CURSOR_UP:
- if (!(sc&SCF_CTRL)) {
- if (sc&SCF_KEY_DESC) {
- if (sc&SCF_SHIFT)
- KeyDescSet("Edit/Cursor Up, Sel");
- else
- KeyDescSet("Edit/Cursor Up");
- } else
- EdLineUp(doc,sc);
- break;
- } else
- sc&=~SCF_CTRL;
-//Fall Through to SC_HOME
- case SC_HOME:
- if (!(sc&SCF_CTRL)) {
- if (sc&SCF_KEY_DESC) {
- if (sc&SCF_SHIFT)
- KeyDescSet("Edit/GoTo Top of Doc, Sel");
- else
- KeyDescSet("Edit/GoTo Top of Doc");
- } else {
- if (doc_ce==doc) doc_ce=doc_ce->last;
- while (doc_ce!=doc) {
- BEqu(&doc_ce->type,DOCEt_SEL,sc&SCF_SHIFT);
- doc_ce=doc->cur_entry=doc_ce->last;
- }
- doc_ce=doc->cur_entry=doc->head.next;
- doc->cur_col=doc_ce->min_col;
- DocFormFwd(doc);
- }
- }
- break;
- case SC_PAGE_DOWN:
- if (!(sc&SCF_CTRL)) {
- if (sc&SCF_KEY_DESC) {
- if (sc&SCF_SHIFT)
- KeyDescSet("Edit/Page Down, Sel");
- else
- KeyDescSet("Edit/Page Down");
- } else {
- i=doc_ce->y+doc->win_task->win_height-1;
- if (doc_ce->type_u8==DOCT_HEX_ED)
- i+=doc->cur_col/3/doc_ce->hex_ed_width;
- while (doc_ce!=doc &&
- (doc_ce->type_u8!=DOCT_HEX_ED && doc_ce->y<i ||
- doc_ce->type_u8==DOCT_HEX_ED &&
- doc_ce->y+doc->cur_col/3/doc_ce->hex_ed_width<i)) {
- EdLineDown(doc,sc);
-//paranoid check for stuck on same node
- if (doc->cur_entry==doc_ce && doc_ce->type_u8!=DOCT_HEX_ED)
- break;
- doc_ce=doc->cur_entry;
- }
- }
- }
- break;
- case SC_PAGE_UP:
- if (!(sc&SCF_CTRL)) {
- if (sc&SCF_KEY_DESC) {
- if (sc&SCF_SHIFT)
- KeyDescSet("Edit/Page Up, Sel");
- else
- KeyDescSet("Edit/Page Up");
- }else {
- i=doc_ce->y-(doc->win_task->win_height-1);
- if (doc_ce->type_u8==DOCT_HEX_ED)
- i+=doc->cur_col/3/doc_ce->hex_ed_width;
- while (doc_ce->last!=doc &&
- (doc_ce->type_u8!=DOCT_HEX_ED && doc_ce->y>i ||
- doc_ce->type_u8==DOCT_HEX_ED &&
- doc_ce->y+doc->cur_col/3/doc_ce->hex_ed_width>i) &&
- doc_ce->y!=doc->head.next->y) {
- EdLineUp(doc,sc);
-//paranoid check for stuck on same node
- if (doc->cur_entry==doc_ce && doc_ce->type_u8!=DOCT_HEX_ED)
- break;
- doc_ce=doc->cur_entry;
- }
- }
- }
- break;
- case SC_CURSOR_LEFT:
- if (sc&SCF_KEY_DESC) {
- if (sc&SCF_CTRL)
- KeyDescSet("Edit/GoTo Start of Line");
- else {
- if (sc&SCF_SHIFT)
- KeyDescSet("Edit/Cursor Left, Sel");
- else
- KeyDescSet("Edit/Cursor Left");
- }
- } else
- EdCursorLeft(doc,sc);
- break;
- case SC_CURSOR_RIGHT:
- if (sc&SCF_KEY_DESC) {
- if (sc&SCF_CTRL)
- KeyDescSet("Edit/GoTo End of Line");
- else {
- if (sc&SCF_SHIFT)
- KeyDescSet("Edit/Cursor Right, Sel");
- else
- KeyDescSet("Edit/Cursor Right");
- }
- } else
- EdCursorRight(doc,sc);
- break;
- case SC_DELETE:
- if (!(sc&SCF_CTRL)) {
- if (sc&SCF_KEY_DESC) {
- if (sc&SCF_SHIFT)
- KeyDescSet("Edit/Cut To Clip");
- else
- KeyDescSet("Char/Delete");
- } else {
- if (sc&SCF_SHIFT)
- ClipCut(doc);
- else
- EdCharDel(doc);
- }
- }
- break;
- case SC_INS:
- if (sc&(SCF_SHIFT|SCF_CTRL)!=(SCF_SHIFT|SCF_CTRL)) {
- if (sc&SCF_KEY_DESC) {
- if (sc&SCF_SHIFT)
- KeyDescSet("Edit/Paste Clip");
- else if (sc&SCF_CTRL)
- KeyDescSet("Edit/Copy to Clip");
- else
- KeyDescSet("Edit/Toggle Overstrike");
- } else {
- if (sc&SCF_SHIFT)
- ClipPaste(doc);
- else if (sc&SCF_CTRL)
- ClipCopy(doc);
- else
- doc->flags^=DOCF_OVERSTRIKE;
- }
- }
- break;
- case SC_F1...SC_F10:
- if (sc&SCF_CTRL) {
- if (sc&SCF_KEY_DESC) {
- if (sc&SCF_SHIFT)
- KeyDescSet("Cmd/Src Code of Sym");
- else
- KeyDescSet("Edit/Autocomplete Sym");
- } else {
- DocUnlock(doc);
- if (AutoComplete(ON)) {
- if (sc&SCF_SHIFT)
- ACMan(sc.u8[0]-SC_F1+1,Fs);
- else
- ACFillIn(sc.u8[0]-SC_F1+1);
- }
- DocLock(doc);
- }
- } else {
- switch (sc.u8[0]) {
- case SC_F1:
- if (sc&SCF_KEY_DESC) {
- if (sc&SCF_SHIFT)
- KeyDescSet("Cmd/About");
- else
- KeyDescSet("Cmd/Help");
- } else {
- if (sc&SCF_SHIFT)
- Ed("::/Doc/AboutTempleOS.DD.Z");
- else
- Ed("::/Doc/HelpIndex.DD.Z");
- }
- break;
- case SC_F2:
- if (sc&SCF_KEY_DESC) {
- if (sc&SCF_SHIFT)
- KeyDescSet("Edit/Play Macro");
- else
- KeyDescSet("Edit/Macro");
- } else {
- DocUnlock(doc);
- if (sc&SCF_SHIFT) {
- if (TaskValidate(sys_macro_task))
- PostMsgWait(sys_macro_task,
- MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- SysMacroStripKey(&sys_macro_head,ch,sc);
- PlaySysMacro;
- } else
- EdMacroUtil;
- DocLock(doc);
- }
- break;
- case SC_F3:
- if (sc&SCF_KEY_DESC) {
- if (sc&SCF_SHIFT)
- KeyDescSet("Edit/Find Last");
- else
- KeyDescSet("Edit/Find Next");
- }else {
- doc->find_replace->scan_fwd=!(sc&SCF_SHIFT);
- EdFindNext(doc);
- }
- break;
- case SC_F4:
- if (sc&SCF_KEY_DESC) {
- if (sc&SCF_SHIFT)
- KeyDescSet("Cmd/Insert Directory Name");
- else
- KeyDescSet("Cmd/Insert FileName");
- } else {
- DocUnlock(doc);
- if (sc&SCF_SHIFT)
- st=PopUpPickDir;
- else
- st=PopUpPickFile;
- DocLock(doc);
- if (st) {
- DocPrintPartial(doc,"%s",st);
- Free(st);
- }
- }
- break;
- case SC_F5:
- if (sc&SCF_KEY_DESC) {
- if (sc&SCF_SHIFT)
- KeyDescSet("Cmd/Adam Include");
- else
- KeyDescSet("Cmd/Run (Execute)");
- } else {
- if (st2=DocEntryLink(doc,doc_ce)) {
- st=DocLinkFile(st2);
- Free(st2);
- } else {
- DocWrite(doc);
- st=StrNew(doc->filename.name);
- }
- if (st2=DirFile(st,"Run","HC.Z")) {
- if (FileFind(st2)) {
- Free(st);
- st=st2;
- } else
- Free(st2);
- }
- if (st) {
- if (sc&SCF_SHIFT)
- AdamFile(st);
- else
- PopUpFile(st);
- Free(st);
- }
- }
- break;
- case SC_F6:
- if (sc&SCF_KEY_DESC) {
- if (sc&SCF_SHIFT)
- KeyDescSet("Cmd/God Doodle");
- else
- KeyDescSet("Cmd/God Song");
- } else {
-///Adam/God/HSNotes.DD
- if (sc&SCF_SHIFT) {
- DocUnlock(doc);
- GodDoodle;
- DocLock(doc);
- } else
- GodSong;
- }
- break;
- case SC_F7:
- if (sc&SCF_KEY_DESC) {
- if (sc&SCF_SHIFT)
- KeyDescSet("Cmd/God Passage");
- else
- KeyDescSet("Cmd/God Word");
- } else {
-///Adam/God/HSNotes.DD
- FifoU8Flush(god.fifo);
- GodBitsIns(GOD_GOOD_BITS,KbdMsEvtTime>>GOD_BAD_BITS);
- if (sc&SCF_SHIFT)
- GodBiblePassage;
- else
- GodWord;
- }
- break;
- }
- }
- break;
- }
- break;
- case CH_CTRLA:
- if (!(sc&SCF_SHIFT)) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Edit/Save As");
- else if (DocWrite(doc,TRUE)&&(st=FileNameAbs(doc->filename.name))) {
- DirContextDel(doc->filename.dirc);
- doc->filename.dirc=DirContextNew(st);
- Free(st);
- }
- }
- break;
- case CH_CTRLB:
- if (!(sc&SCF_SHIFT)) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Cmd/Toggle Border");
- else
- WinBorder(Bt(&doc->win_task->display_flags,
- DISPLAYf_NO_BORDER),doc->win_task);
- }
- break;
- case CH_CTRLC:
- if (!(sc&SCF_SHIFT)) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Edit/Copy to Clip");
- else
- ClipCopy(doc);
- }
- break;
- case CH_CTRLD:
- if (!(sc&SCF_SHIFT)) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Cmd/File Manager");
- else {
- DocUnlock(doc);
- FileMgr;
- DocLock(doc);
- }
- }
- break;
- case CH_CTRLF:
- if (sc&SCF_SHIFT) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Cmd/Search Files");
- else
- FindWiz;
- } else {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Edit/Find & Replace");
- else
- EdFindReplace(doc);
- }
- break;
- case CH_CTRLG:
- if (!(sc&SCF_SHIFT)) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Edit/GoTo Line Num");
- else
- EdGoToLine(doc);
- }
- break;
- case CH_BACKSPACE: //<CTRL-H>
- if (!(sc&SCF_SHIFT)) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Char/Back Space");
- else {
- DocCaptureUndo(doc);
- doc_ce=doc->cur_entry;
- if (doc->cur_col<=doc_ce->min_col) {
- doc_ce=doc->cur_entry=doc_ce->last;
- if (doc_ce!=doc && doc_ce->type_u8==DOCT_SOFT_NEW_LINE)
- doc_ce=doc->cur_entry=doc_ce->last;
- if (doc_ce==doc || doc_ce->type_u8==DOCT_PMT) {
- doc_ce=doc->cur_entry=doc_ce->next;
- doc->cur_col=doc_ce->min_col;
- } else {
- doc->cur_col=doc_ce->max_col;
- if (doc->cur_col>doc_ce->min_col)
- doc->cur_col--;
- EdCharDel(doc);
- }
- } else {
- doc->cur_col--;
- EdCharDel(doc);
- }
- }
- }
- break;
- case CH_CTRLI:
- if (sc.u8[0]!=SC_TAB) {
- if (sc&SCF_SHIFT) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Dol/Unindent 2");
- else
- DocPrint(doc,"$ID,-2$");
- } else {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Dol/Indent 2");
- else
- DocPrint(doc,"$ID,2$");
- }
- }
- break;
- case '\n':
- if (sc&SCF_KEY_DESC) {
- if (sc&SCF_SHIFT)
- KeyDescSet("Char/Return");
- else
- KeyDescSet("Char/Page Break");
- } else
- EdCharIns(ch,sc,doc);
- break;
- case CH_CTRLK:
- if (sc&SCF_SHIFT) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Dol/Blinking Text Off");
- else
- DocPrint(doc,"$BK,0$");
- } else {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Dol/Blinking Text On");
- else
- DocPrint(doc,"$BK,1$");
- }
- break;
- case CH_CTRLL:
- if (sc&SCF_SHIFT) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Cmd/Code Tools");
- else {
- DocUnlock(doc);
- EdCodeTools(doc);
- DocLock(doc);
- }
- } else {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Cmd/Insert Text Widgets Wizard");
- else {
- DocUnlock(doc);
- EdInsWidgetWiz;
- DocLock(doc);
- }
- }
- break;
- case CH_CTRLM:
- if (sc&SCF_SHIFT) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Cmd/Personal Notes");
- else
- Ed("~/PersonalNotes.DD.Z");
- } else {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Cmd/Personal Menu");
- else {
- m=DocRead("~/PersonalMenu.DD.Z");
- DocMenu(m);
- DocDel(m);
- }
- }
- break;
- case CH_CTRLO:
- if (sc&SCF_SHIFT) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Edit/Collapse");
- else
- DocCollapse(TRUE,doc);
- } else {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Edit/Uncolapse");
- else
- DocCollapse(FALSE,doc);
- }
- break;
- case CH_CTRLP:
- if (doc->flags & (DOCF_SUPERSCRIPT_MODE | DOCF_SUBSCRIPT_MODE)) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Dol/Toggle Super or Sub script");
- else {
- DocPrint(doc,"$SY,0$");
- doc->flags&=~(DOCF_SUPERSCRIPT_MODE | DOCF_SUBSCRIPT_MODE);
- }
- } else if (sc&SCF_SHIFT) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Dol/Toggle Subscript");
- else {
- DocPrint(doc,"$SY,3$");
- doc->flags|=DOCF_SUBSCRIPT_MODE;
- }
- } else {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Dol/Toggle Superscript");
- else {
- DocPrint(doc,"$SY,-3$");
- doc->flags|=DOCF_SUPERSCRIPT_MODE;
- }
- }
- break;
- case CH_CTRLQ:
- break;
- case CH_CTRLR:
- if (!(sc&SCF_SHIFT)) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Cmd/Sprite Graphic Resource");
- else
- if (!(doc->flags&DOCF_FORM) &&
- !(doc->flags&(DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_TABS))) {
- DocUnlock(doc);
- if (doc_ce->type_u8==DOCT_SPRITE)
- EdSpriteEd(doc);
- else
- EdSpriteIns(doc);
- DocLock(doc);
- }
- }
- break;
- case CH_CTRLS:
- if (sc&SCF_SHIFT) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Edit/Toggle AutoSave");
- else
- LBtc(&doc->flags,DOCf_AUTO_SAVE);
- } else {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Edit/Save");
- else
- DocWrite(doc);
- }
- break;
- case CH_CTRLT:
- if (sc&SCF_SHIFT) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Edit/Single Entry Toggle Plain Text");
- else if (!(doc->flags&DOCF_FORM))
- DocEntryToggle(doc);
- } else {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Edit/Toggle Plain Text Display");
- else if (!(doc->flags&DOCF_FORM))
- DocFlagsToggle(doc,DOCF_PLAIN_TEXT);
- }
- break;
- case CH_CTRLU:
- if (sc&SCF_SHIFT) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Dol/Underline Off");
- else
- DocPrint(doc,"$UL,0$");
- } else {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Dol/Underline On");
- else
- DocPrint(doc,"$UL,1$");
- }
- break;
- case CH_CTRLV:
- if (!(sc&SCF_SHIFT)) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Edit/Paste Clip");
- else
- ClipPaste(doc);
- }
- break;
- case CH_CTRLW:
- if (sc&SCF_SHIFT) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Dol/Word Wrap Off");
- else
- DocPrint(doc,"$WW,0$");
- } else {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Dol/Word Wrap On");
- else
- DocPrint(doc,"$WW,1$");
- }
- break;
- case CH_CTRLX:
- if (!(sc&SCF_SHIFT)) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Edit/Cut To Clip");
- else
- ClipCut(doc);
- }
- break;
- case CH_CTRLY:
- if (!(sc&SCF_SHIFT)) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Edit/Delete Line");
- else
- EdLineDel(doc);
- }
- break;
- case CH_CTRLZ:
- if (sc&SCF_SHIFT) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Dol/Inverted Text Off");
- else
- DocPrint(doc,"$IV,0$");
- } else {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Dol/Inverted Text On");
- else
- DocPrint(doc,"$IV,1$");
- }
- break;
- case '0'...'9':
- if (sc&SCF_CTRL) {
- if (sc&SCF_KEY_DESC) {
- if (sc&SCF_SHIFT)
- KeyDescSet("Cmd/Word Definition");
- else
- KeyDescSet("Edit/Autocomplete Word");
- } else {
- if (AutoComplete(ON)) {
- DocUnlock(doc);
- if (sc&SCF_SHIFT)
- ACDDef(ch-'0',Fs);
- else
- ACDFillin(ch-'0');
- DocLock(doc);
- }
- }
- }
- break;
- case '[':
- if (sc&SCF_CTRL) {
- if (sc&SCF_SHIFT) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Edit/GoTo matching brace");
- else
- EdFindPaired(doc,'}','{',FALSE);
- } else {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Edit/GoTo matching bracket");
- else
- EdFindPaired(doc,']','[',FALSE);
- }
- }
- break;
- case ']':
- if (sc&SCF_CTRL) {
- if (sc&SCF_SHIFT) {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Edit/GoTo matching brace");
- else
- EdFindPaired(doc,'{','}',TRUE);
- } else {
- if (sc&SCF_KEY_DESC)
- KeyDescSet("Edit/GoTo matching bracket");
- else
- EdFindPaired(doc,'[',']',TRUE);
- }
- }
- break;
- }
- }
- if (unlock)
- DocUnlock(doc);
- if (!(doc->flags&DOCF_DONT_SWAP_OUT))
- Yield;
-}
-
-Bool KDDocPutKey(I64 ch,I64 scan_code)
-{
- CDoc *doc;
- if (doc=DocPut)
- DocPutKey(doc,ch,scan_code);
- return FALSE;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocPutS.HC.HTML b/public/src/Adam/DolDoc/DocPutS.HC.HTML deleted file mode 100644 index 250a7cf..0000000 --- a/public/src/Adam/DolDoc/DocPutS.HC.HTML +++ /dev/null @@ -1,348 +0,0 @@ - - - - - DocPutS.HC - - - - - #help_index "DolDoc/Output;StdOut/DolDoc"
-
-CDocEntry *DocPutS(CDoc *doc,U8 *st)
-{//Don't use this. Use $LK-UL,"DocPrint",A="MN:DocPrint"$().
-//Does not handle partial Doc entries.
- //Returns last newly created dollar-sign CDocEntry or NULL.
- U8 *ptr=st,*ptr2,*st2,*ptr3,*ptr4,*src,
- *char_bmp;
- Bool unlock;
- I64 ch,j;
- CDocEntry *doc_e=NULL,*res=NULL,*doc_ce;
- if (!st || !doc && !(doc=DocPut) || doc->doc_signature!=DOC_SIGNATURE_VAL)
- return NULL;
- unlock=DocLock(doc);
- if (doc->flags & DOCF_PLAIN_TEXT_TABS)
- char_bmp=char_bmp_zero_cr_nl_cursor;
- else if (doc->flags & DOCF_PLAIN_TEXT)
- char_bmp=char_bmp_zero_tab_cr_nl_cursor;
- else
- char_bmp=char_bmp_zero_tab_cr_nl_cursor_dollar;
- doc_ce=doc->cur_entry;
- while (*ptr) {
- ptr2=ptr;
- do ch=*ptr++;
- while (!Bt(char_bmp,ch) || ch==CH_CURSOR && doc->flags&DOCF_NO_CURSOR);
- ptr--;
- if (!ch) {
- if (j=ptr-ptr2) {
- doc_e=DocEntryNewBase(doc,
- DOCT_TEXT|doc->settings_head.dft_text_attr<<8);
- if (doc->flags & DOCF_NO_CURSOR) {
- src=MAlloc(j+1);
- MemCpy(src,ptr2,j+1);
- StrUtil(src,SUF_REM_CTRL_CHARS);
- j=StrLen(src);
- } else
- src=ptr2;
- doc_e->tag=MAlloc(j+1,doc->mem_task);
- MemCpy(doc_e->tag,src,j+1);
- doc_e->max_col=j;
- DocInsEntry(doc,doc_e);
- if (doc->flags & DOCF_NO_CURSOR)
- Free(src);
- }
- } else {
- if (j=ptr-ptr2) {
- *ptr=0;
- doc_e=DocEntryNewBase(doc,
- DOCT_TEXT|doc->settings_head.dft_text_attr<<8);
- if (doc->flags & DOCF_NO_CURSOR) {
- src=MAlloc(j+1);
- MemCpy(src,ptr2,j+1);
- ptr3=src;
- ptr4=src;
- while (*ptr3)
- if (*ptr3!=CH_CURSOR)
- *ptr4++=*ptr3++;
- else
- ptr3++;
- *ptr4=0;
- j=ptr4-src;
- } else
- src=ptr2;
- doc_e->tag=MAlloc(j+1,doc->mem_task);
- MemCpy(doc_e->tag,src,j+1);
- doc_e->max_col=j;
- DocInsEntry(doc,doc_e);
- if (doc->flags & DOCF_NO_CURSOR)
- Free(src);
- *ptr=ch;
- }
- switch (ch) {
- case CH_CURSOR:
- doc_e=DocEntryNewBase(doc,
- DOCT_CURSOR|doc->settings_head.dft_text_attr<<8);
- DocInsEntry(doc,doc_e);
- ptr++;
- break;
- case '\t':
- doc_e=DocEntryNewBase(doc,
- DOCT_TAB|doc->settings_head.dft_text_attr<<8);
- DocInsEntry(doc,doc_e);
- ptr++;
- break;
- case '$':
- ptr++; //skip first dollar
- ptr2=ptr;
- while (*ptr && *ptr!='$')
- ptr++;
- if (*ptr) {
- *ptr=0; //zero second dollar
- if (ptr-1==ptr2 && *ptr2==CH_CURSOR) {
- doc_e=DocEntryNewBase(doc,
- DOCT_CURSOR|doc->settings_head.dft_text_attr<<8);
- DocInsEntry(doc,doc_e);
- ptr2++;
- }
- if (ptr==ptr2) {
- doc_e=DocEntryNewBase(doc,
- DOCT_TEXT|doc->settings_head.dft_text_attr<<8);
- doc_e->max_col=1;
- if (doc->flags & DOCF_DBL_DOLLARS)
- doc_e->tag=StrNew("$$",doc->mem_task);
- else
- doc_e->tag=StrNew("$",doc->mem_task);
- DocInsEntry(doc,doc_e);
- } else {
- st2=MAlloc(ptr-ptr2+1);
- ptr3=ptr2;
- ptr4=st2;
- while (ch=*ptr3++) {
- if (ch==CH_CURSOR) {
- doc_e=DocEntryNewBase(doc,
- DOCT_CURSOR|doc->settings_head.dft_text_attr<<8);
- DocInsEntry(doc,doc_e);
- } else
- *ptr4++=ch;
- }
- *ptr4=0;
- if (doc_e=PrsDollarCmd(doc,st2)) {
- res=doc_e;
- DocInsEntry(doc,doc_e);
- }
- Free(st2);
- }
- *ptr++='$';
- }
- break;
- default:
- doc_e=DocEntryNewBase(doc,
- DOCT_NEW_LINE|doc->settings_head.dft_text_attr<<8);
- DocInsEntry(doc,doc_e);
- if (ch=='\r')
- while (*ptr=='\r')
- ptr++;
- if (*ptr=='\n')
- ptr++;
- while (*ptr=='\r')
- ptr++;
- }
- }
- }
- if (unlock)
- DocUnlock(doc);
- return res;
-}
-
-public CDocEntry *DocPrint(CDoc *doc=NULL,U8 *fmt,...)
-{//You must not print partial doc cmds.
-//Returns last newly created dollar-sign CDocEntry or NULL.
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
- CDocEntry *res=DocPutS(doc,buf);
- Free(buf);
- return res;
-}
-
-public U0 DocPrintPartial(CDoc *doc=NULL,U8 *fmt,...)
-{//Lets you print half a doc cmd, if you like.
- U8 *buf,*st,*src,*dst,*ptr,*ptr2;
- Bool unlock;
- CDocEntry *doc_ce,*doc_ne;
- I64 ch,i,j;
- if (!doc && !(doc=DocPut))
- return;
- buf=StrPrintJoin(NULL,fmt,argc,argv);
- ptr=buf;
- if (doc->user_put_s && (*doc->user_put_s)(doc,doc->user_put_data,buf)) {
- Free(buf);
- return;
- }
- unlock=DocLock(doc);
- if (doc->cur_entry->type_u8==DOCT_DATA)
- while (ch=*ptr++)
- DocPutKey(doc,ch,0);
- else
- while (ch=*ptr) {
- if (!Bt(char_bmp_safe_dollar,ch) ||
- doc->flags & (DOCF_OVERSTRIKE|DOCF_IN_DOLLAR)) {
- DocPutKey(doc,ch,0);
- ptr++;
- } else {
- ptr2=ptr++;
- while (TRUE) {
- ch=*ptr++;
- if (!Bt(char_bmp_safe_dollar,ch))
- break;
- }
- ptr--;
- *ptr=0;
- doc_ce=doc->cur_entry;
- j=ptr-ptr2;
- if (IsEditableText(doc_ce)) {
- dst=st=MAlloc(doc_ce->max_col+j+1,doc->mem_task);
- src=doc_ce->tag;
- i=doc->cur_col;
- doc->cur_col+=j;
- doc_ce->max_col+=j;
- while (i-->0)
- *dst++=*src++;
- while (j-->0)
- *dst++=*ptr2++;
- while (*dst++=*src++);
- Free(doc_ce->tag);
- doc_ce->tag=st;
- } else {
- doc_ne=DocEntryNewTag(doc,doc_ce,ptr2);
- doc_ne->type=DOCT_TEXT|doc->settings_head.dft_text_attr<<8;
- doc_ne->de_flags=doldoc.dft_de_flags[DOCT_TEXT];
- QueIns(doc_ne,doc_ce->last);
- doc->cur_entry=doc_ne;
- doc->cur_col=StrLen(ptr2);
- }
- *ptr=ch;
- DocRemSoftNewLines(doc,doc->cur_entry);
- }
- }
- if (unlock)
- DocUnlock(doc);
- if (!(doc->flags&DOCF_DONT_SWAP_OUT))
- Yield;
- Free(buf);
-}
-
-Bool KDDocPutS(U8 *st)
-{
- CDoc *doc;
- if (doc=DocPut)
- DocPrintPartial(doc,"%s",st);
- return FALSE;
-}
-
-public U0 DocPrintAtomic(CDoc *doc=NULL,U8 *fmt,...)
-{//Prints multiple whole cmds all-at-once. Might need this when printing trees.
- U8 *buf;
- Bool unlock;
- I64 old_flags;
- if (!doc && !(doc=DocPut))
- return;
- buf=StrPrintJoin(NULL,fmt,argc,argv);
- unlock=DocLock(doc);
- old_flags=doc->flags;
- doc->flags|=DOCF_NO_CURSOR;
- DocPrint(doc,"%s",buf);
- DocRecalc(doc);
- doc->flags=old_flags;
- if (unlock)
- DocUnlock(doc);
- Free(buf);
-}
-
-U0 DocDump(CDoc *doc,I64 uS_delay=0)
-{
- U8 *st;
- CDocEntry *doc_e,*doc_e2;
- Bool unlock=DocLock(doc);
- doc_e=doc->head.next;
- while (doc_e!=doc) {
- st=DocScanLine(doc,doc_e,NULL,&doc_e2);
- "%s",st;
- Free(st);
- doc_e=doc_e2;
- if (doc_e->type_u8==DOCT_NEW_LINE) {
- '\n';
- Busy(uS_delay);
- doc_e=doc_e->next;
- }
- }
- if (unlock)
- DocUnlock(doc);
-}
-
-public CDocEntry *DocPutLine(CDoc *doc=NULL,CDocEntry *doc_e)
-{//Send line from other doc to StdOut DocPut.
- I64 ch;
- U8 *ptr,*ptr2;
- Bool unlock;
- if (!doc && !(doc=DocPut) || doc->doc_signature!=DOC_SIGNATURE_VAL)
- return NULL;
- unlock=DocLock(doc);
- while (doc_e!=doc && doc_e->type_u8!=DOCT_NEW_LINE) {
- if (doc_e->de_flags&DOCEF_TAG) {
- ptr=doc_e->tag;
- do {
- ptr2=ptr;
- while (ch=*ptr)
- if (ch=='$')
- break;
- else
- ptr++;
- *ptr=0;
- "%s",ptr2;
- *ptr=ch;
- if (ch=='$') {
- "$$";
- ptr++;
- }
- } while (ch);
- } else if (doc_e->type_u8==DOCT_TAB)
- '\t';
- doc_e=doc_e->next;
- }
- '\n';
- if (doc_e!=doc)
- doc_e=doc_e->next;
- if (unlock)
- DocUnlock(doc);
- return doc_e;
-}
-
-#help_index "Debugging/Dump;DolDoc/Cmd Line (Typically);"\
- "Cmd Line (Typically);DolDoc/Output;StdOut/DolDoc"
-public U0 DocDm(U8 *buf,I64 cnt=0x80)
-{//Dump live chunk of mem showing addresses. Can be edited.
- CDocEntry *doc_e;
- CDoc *doc=DocPut;
- Bool unlock=DocLock(doc);
- doc_e=DocPrint(doc,"$HX-Z,%d,16$",cnt);
- doc_e->data=buf;
- doc->cur_entry=doc_e->next;
- DocRecalc(doc);
- if (unlock)
- DocUnlock(doc);
-}
-
-public U0 DocD(U8 *buf,I64 cnt=0x80)
-{//Dump live chunk of mem showing offsets. Can be edited.
- CDocEntry *doc_e;
- CDoc *doc=DocPut;
- Bool unlock=DocLock(doc);
- doc_e=DocPrint(doc,"$HX,%d,16$",cnt);
- doc_e->data=buf;
- doc->cur_entry=doc_e->next;
- DocRecalc(doc);
- if (unlock)
- DocUnlock(doc);
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocRecalc.HC.HTML b/public/src/Adam/DolDoc/DocRecalc.HC.HTML deleted file mode 100644 index f8adffc..0000000 --- a/public/src/Adam/DolDoc/DocRecalc.HC.HTML +++ /dev/null @@ -1,1336 +0,0 @@ - - - - - DocRecalc.HC - - - - - #help_index "DolDoc"
-
-I64 DocWordWrapDel(CDoc *doc,CDocEntry *doc_e,
- Bool full_refresh,Bool same_win,I64 left_margin,I64 right_margin,
- CDocEntry **_best_doc_e,I64 *_best_col)
-{
- CDocEntry *doc_e2;
- U8 *ptr;
- I64 j,k;
- if (doc_e->de_flags&DOCEF_TAG && doc_e->tag)
- k=StrLen(doc_e->tag);
- else
- k=0;
- if (full_refresh)
- while (TRUE) {
- doc_e2=doc_e->next;
- if (doc_e2->type_u8==DOCT_SOFT_NEW_LINE && !same_win) {
- if (doc->cur_entry==doc_e2) {
- doc->cur_entry=doc_e2->next;
- doc->cur_col=doc->cur_entry->min_col;
- }
- if (*_best_doc_e==doc_e2) {
- *_best_doc_e=doc_e2->next;
- *_best_col=0;
- }
- DocEntryDel(doc,doc_e2);
- } else if (IsEditableText(doc_e) &&
- doc_e->de_flags==doc_e2->de_flags && doc_e->type==doc_e2->type) {
- j=StrLen(doc_e2->tag);
- ptr=MAlloc(k+j+1,doc->mem_task);
- MemCpy(ptr,doc_e->tag,k);
- MemCpy(ptr+k,doc_e2->tag,j+1);
- Free(doc_e->tag);
- doc_e->tag=ptr;
- if (doc->cur_entry==doc_e2) {
- doc->cur_entry=doc_e;
- doc->cur_col+=k;
- }
- if (*_best_doc_e==doc_e2) {
- *_best_doc_e=doc_e;
- *_best_col=0;
- }
- DocEntryDel(doc,doc_e2);
- k+=j;
- if (k>(right_margin-left_margin+1)<<1)
- break;
- } else
- break;
- }
- if (doc_e->de_flags & DOCEF_SCROLLING_X)
- k=doc_e->scroll_len;
- return k;
-}
-
-U0 DocRecalcXY(CDoc *doc,CDocEntry *doc_e,
- I64 k,I64 left,I64 width,I64 height,I64 left_margin,I64 right_margin,
- I64 x0,I64 y0,I64 *_x,I64 *_y)
-{
- I64 i,x=*_x,y=*_y;
- if (doc_e->de_flags & DOCEF_MARGIN_REL_X) {
- if (doc_e->de_flags & DOCEF_LEFT_X)
- x=left_margin-left;
- else if (doc_e->de_flags & DOCEF_RIGHT_X)
- x=right_margin-(k-1)-left;
- else if (doc_e->de_flags & DOCEF_CENTER_X)
- x=(right_margin+left_margin)>>1-k>>1-left;
- } else {
- if (doc_e->de_flags & DOCEF_LEFT_X)
- x=x0;
- else if (doc_e->de_flags & DOCEF_RIGHT_X)
- x=width+x0-k;
- else if (doc_e->de_flags & DOCEF_CENTER_X)
- x=(width+x0-k)>>1;
- }
- i=y;
- if (doc_e->de_flags & DOCEF_PAGE_REL_Y) {
- doc->flags|=DOCF_BWD_MOVEMENT;
- if (doc_e->de_flags & DOCEF_TOP_Y)
- y-=doc_e->page_line_num;
- else if (doc_e->de_flags & DOCEF_BOTTOM_Y)
- y+=doc_e->settings.page_len-doc_e->page_line_num;
- else if (doc_e->de_flags & DOCEF_CENTER_Y)
- y+=doc_e->settings.page_len>>1-doc_e->page_line_num;
- } else {
- doc->flags|=DOCF_BWD_MOVEMENT;
- if (doc_e->de_flags & DOCEF_TOP_Y)
- y=y0;
- else if (doc_e->de_flags & DOCEF_BOTTOM_Y)
- y=height-1+y0;
- else if (doc_e->de_flags & DOCEF_CENTER_Y)
- y=height>>1+y0;
- }
- if (y!=i) {
- doc->page_line_num+=y-i;
- if (doc->page_line_num<0)
- doc->page_line_num=doc_e->settings.page_len+
- doc->page_line_num%doc_e->settings.page_len;
- else
- doc->page_line_num=doc->page_line_num%doc_e->settings.page_len;
- if (doc_e->settings.header!=DOC_DFT &&
- doc->page_line_num<doc_e->settings.header) {
- y+=doc_e->settings.header-doc->page_line_num;
- doc->page_line_num=doc_e->settings.header;
- }
- if (doc_e->settings.footer==DOC_DFT) {
- if (doc->page_line_num>=doc_e->settings.page_len) {
- if (doc_e->settings.header==DOC_DFT)
- doc->page_line_num=0;
- else {
- doc->page_line_num=doc_e->settings.header;
- y+=doc_e->settings.header;
- }
- }
- } else {
- if (doc->page_line_num>=
- doc_e->settings.page_len-doc_e->settings.footer) {
- y+=doc_e->settings.footer;
- if (doc_e->settings.header==DOC_DFT)
- doc->page_line_num=0;
- else {
- doc->page_line_num=doc_e->settings.header;
- y+=doc_e->settings.header;
- }
- }
- }
- }
- *_x=x;
- *_y=y;
-}
-
-CDocEntry *DocSplitTag(CDoc *doc,CDocEntry *doc_e,I64 i,I64 x,I64 y,I64 type_u8)
-{//Split tag at i, insert DOCT_SOFT_NEW_LINE, DOCT_MARKER or DOCT_CURSOR
- U8 *ptr;
- CDocEntry *doc_e2;
- if (doc_e->type_u8==DOCT_TEXT && i) {
- if (i<StrLen(doc_e->tag)) {
- doc_e2=MAllocIdent(doc_e,doc->mem_task);
- doc_e2->tag=StrNew(doc_e->tag+i,doc->mem_task);
- doc_e2->de_flags=doc_e->de_flags&~DOCEG_HAS_ALLOC|DOCEF_TAG;
- QueIns(doc_e2,doc_e);
- if (doc->cur_entry==doc_e && doc->cur_col>=i) {
- doc->cur_entry=doc_e2;
- doc->cur_col=doc->cur_col-i;
- }
- doc_e->tag[i]=0;
- ptr=StrNew(doc_e->tag,doc->mem_task);
- Free(doc_e->tag);
- doc_e->tag=ptr;
- }
- } else
- doc_e=doc_e->last;
- doc_e2=DocEntryNewBase(doc,type_u8|doc_e->type & 0xFFFFFF00,
- doc_e->de_flags&~DOCEG_HAS_ARG,x,y,doc_e->page_line_num);
- MemCpy(&doc_e2->settings,&doc_e->settings,sizeof(CDocSettings));
- QueIns(doc_e2,doc_e);
- return doc_e2;
-}
-
-CDocEntry *DocWordWrapAdd(CDoc *doc,CDocEntry *doc_e,
- I64 *_k,I64 left,I64 right_margin,I64 x,I64 y)
-{
- CDocEntry *doc_e2;
- I64 j,i=right_margin+1-(x+left), //Space left on line
- ii=x+1-doc_e->settings.left_margin;
- if (IsEditableText(doc_e)) {
- if (doc->cur_entry==doc_e->next) {
- if (doc->cur_col==doc_e->next->min_col)
- i--;
- } else {
- if (doc->cur_entry==doc_e && doc->cur_col==i)
- i--;
- }
- if (*_k>i) {
- for (j=i;j>8-ii && j>=0;j--)
- if (doc_e->tag[j]==CH_SPACE || doc_e->tag[j]==CH_SHIFT_SPACE) {
- i=j+1;
- break;
- }
- if (0<i<*_k) {
- DocSplitTag(doc,doc_e,i,x,y,DOCT_SOFT_NEW_LINE);
- *_k=StrLen(doc_e->tag);
- return NULL;
- }
- }
- if (*_k==i)
- return NULL;
- }
- if (*_k>=i) {
- doc_e2=doc_e->last;
- if (doc_e2->type_u8!=DOCT_SOFT_NEW_LINE &&
- doc_e2->type_u8!=DOCT_NEW_LINE &&
- doc_e2->type_u8!=DOCT_CURSOR_MOVEMENT) {
- doc_e2=DocEntryNewBase(doc,DOCT_SOFT_NEW_LINE|doc_e->type&0xFFFFFF00,
- DOCEF_WORD_WRAP|doc_e->de_flags&(DOCEF_HIGHLIGHT|DOCG_BL_IV_UL|
- DOCEF_SKIP|DOCEF_FILTER_SKIP),x,y,doc_e->last->page_line_num);
- MemCpy(&doc_e2->settings,&doc_e->settings,sizeof(CDocSettings));
- QueIns(doc_e2,doc_e->last);
- return doc_e2;
- }
- }
- return NULL;
-}
-
-I64 DocTmpAttr(CDoc *doc,CDocEntry *doc_e,I64 cur_u8_attr)
-{
- I64 tmp_u32_attr;
- doc_e->de_flags=doc->flags& (DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT) |
- doc_e->de_flags&~(DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT);
- tmp_u32_attr=(cur_u8_attr&0xF0)<<8|
- doc->flags&DOCG_BL_IV_UL|(doc_e->settings.shifted_x&0x1F)<<16|
- (doc_e->settings.shifted_y&0x1F)<<21;
- if (doc_e->de_flags & DOCEF_HAS_BIN && *doc_e->tag=='<')
- tmp_u32_attr.u8[1]|=DOC_COLOR_BIN;
- else
- switch (doc_e->type_u8) {
- case DOCT_SPRITE:
- if (doc_e->de_flags & DOCEF_LEFT_EXP)
- tmp_u32_attr.u8[1]|=cur_u8_attr&15;
- else if (doc_e->de_flags & DOCEF_LINK)
- tmp_u32_attr.u8[1]|=DOC_COLOR_LINK;
- else if (doc_e->de_flags & DOCEF_LEFT_MACRO)
- tmp_u32_attr.u8[1]|=DOC_COLOR_MACRO;
- else if (doc_e->de_flags & (DOCEF_TREE|DOCEF_LST))
- tmp_u32_attr.u8[1]|=DOC_COLOR_TREE;
- else
- tmp_u32_attr.u8[1]|=DOC_COLOR_BIN;
- break;
- case DOCT_HTML_CODE:
- tmp_u32_attr.u8[1]|=DOC_COLOR_BIN;
- break;
- case DOCT_LINK:
- tmp_u32_attr.u8[1]|=DOC_COLOR_LINK;
- break;
- case DOCT_MACRO:
- tmp_u32_attr.u8[1]|=DOC_COLOR_MACRO;
- break;
- case DOCT_ANCHOR:
- tmp_u32_attr.u8[1]|=DOC_COLOR_ANCHOR;
- break;
- case DOCT_TREE:
- case DOCT_LST:
- tmp_u32_attr.u8[1]|=DOC_COLOR_TREE;
- break;
- default:
- tmp_u32_attr.u8[1]|=cur_u8_attr&15;
- }
- doc_e->type.u8[1]=tmp_u32_attr.u8[1];
- tmp_u32_attr|=doc_e->type&0xFFFF0000;
- if (doc_e==doc->cur_entry && !(doc->flags&DOCF_DONT_HIGHLIGHT_CURSOR) &&
- doc_e->type_u8!=DOCT_TEXT)
- tmp_u32_attr^=0xFF00;
- doc_e->settings.final_u32_attr=tmp_u32_attr;
- return tmp_u32_attr;
-}
-
-public Bool DocRecalc(CDoc *doc,I64 recalc_flags=RECALCt_NORMAL)
-{//Recalc and fmt. Also used by WinMgr to draw on scrn.
- I64 i,ii,j,k,x,x0,y,y0,D,d2,col,col2,best_col=0,best_d=I64_MAX,xx,yy,zz,
- num_entries=0,i_jif,cur_u8_attr,tmp_u32_attr,
- cursor_y=I64_MIN,left_margin,right_margin,y_plot_top,y_plot_bottom,
- top,left,bottom,right,width,height,scroll_x,scroll_y,pix_top,pix_left;
- CDocEntry reg *doc_e,reg *doc_e2,*best_doc_e,*next_clear_found=NULL,
- *added_cursor=NULL;
- CDocBin *tmpb;
- CDocSettings *s;
- Bool del_doc_e,skipped_update,tree_collapsed,same_win,more=FALSE,
- find_cursor=FALSE,blink_flag,full_refresh=TRUE,unlock,clear_holds;
- CTask *win_task,*mem_task;
- CDC *dc;
- U8 *bptr,*ptr,buf[STR_LEN],ch;
- U32 *u32_ptr,*hl;
- I32 *depth_buf=NULL;
- F64 cur_time=tS;
- CWinScroll *vss,*hss;
- CHashDefineStr *tmph;
-
- if (!doc || doc->doc_signature!=DOC_SIGNATURE_VAL) return FALSE;
-
- //WinMgr updates all wins $TX,"30",D="WINMGR_FPS"$, 33.33333mS
- if (recalc_flags&RECALCG_MASK==RECALCt_TO_SCRN && doc->owning_task!=Fs) {
- i_jif=cnts.jiffies+JIFFY_FREQ/250; //4 ms
- while (Bt(&doc->locked_flags,DOClf_LOCKED)) {
- if (cnts.jiffies>=i_jif)
- return FALSE; //Bail-out if doc locked.
- Yield;
- }
- }
-
- unlock=DocLock(doc);
- if (doc->doc_signature!=DOC_SIGNATURE_VAL) {
- DocUnlock(doc);
- return FALSE;
- }
-
- win_task=doc->win_task;
- mem_task=doc->mem_task;
- blink_flag=Blink;
- dc=NULL;
- switch [recalc_flags&RECALCG_MASK] {
- case RECALCt_FIND_CURSOR:
- find_cursor=TRUE;
- if (win_task)
- dc=DCAlias(gr.dc2,win_task); //Necessary for sprites
- break;
- case RECALCt_TO_SCRN:
- if (doc->updates_cnt++%(ToI64(winmgr.fps/10)+1) &&
- !Bt(&doc->flags,DOCf_DO_FULL_REFRESH) &&
- !(doc->flags&DOCF_BWD_MOVEMENT))
- full_refresh=FALSE;
- if (win_task)
- dc=DCAlias(gr.dc2,win_task);
- break;
- }
-
- PUSHFD
- CLI
- left =win_task->win_left;
- right =win_task->win_right;
- width =win_task->win_width;
- scroll_x=win_task->scroll_x;
- scroll_y=win_task->scroll_y;
- top =win_task->win_top;
- bottom=win_task->win_bottom;
- height=win_task->win_height;
- pix_left =win_task->pix_left;
- pix_top =win_task->pix_top;
- left_margin=left;
- right_margin=right;
- POPFD
- if (doc->flags&DOCF_BORDER_DOC) {
- scroll_x=0;
- scroll_y=0;
- }
- best_doc_e=doc->cur_entry;
-
- if (!(doc->flags&(DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_TABS)) &&
- FilesFindMatch(doc->filename.name,FILEMASK_SRC))
- doc->flags|=DOCF_HIGHLIGHT;
- else
- doc->flags&=~DOCF_HIGHLIGHT;
-
- x=y=0;
- doc->page_line_num=0;
- if (full_refresh && !find_cursor) {
- doc->x=x;
- doc->y=y;
- }
-
- hss=&win_task->horz_scroll;
- vss=&win_task->vert_scroll;
- if (doc->flags&DOCF_BORDER_DOC) {
- doc->top_line_num=0;
- doc->line_start_col=0;
- recalc_flags&=~RECALCF_HAS_CURSOR;
- if (recalc_flags&RECALCG_MASK==RECALCt_TO_SCRN)
- doc->settings_head.cur_text_attr=
- doc->settings_head.dft_text_attr=win_task->border_attr;
- } else {
- if (recalc_flags&RECALCF_HAS_CURSOR && full_refresh) {
- if (Bt(&hss->flags,WSSf_SET_TO_POS)||Bt(&vss->flags,WSSf_SET_TO_POS)) {
- if (!(doc->flags&DOCF_NO_SCROLL_BARS)) {
- if (Bt(&hss->flags,WSSf_SET_TO_POS)) {
- doc->line_start_col=hss->pos;
- LBtr(&hss->flags,WSSf_SET_TO_POS);
- }
- if (Bt(&vss->flags,WSSf_SET_TO_POS)) {
- doc->top_line_num=vss->pos;
- LBtr(&vss->flags,WSSf_SET_TO_POS);
- }
- }
- doc->x=doc->line_start_col+width/2;
- doc->y=doc->top_line_num+height/2;
- find_cursor=TRUE;
- }
- }
- if (recalc_flags&RECALCG_MASK==RECALCt_TO_SCRN)
- doc->settings_head.cur_text_attr=
- doc->settings_head.dft_text_attr=win_task->text_attr;
- }
- x0=doc->line_start_col;
- y0=doc->top_line_num;
- same_win=top ==doc->old_win_top &&
- bottom==doc->old_win_bottom &&
- left ==doc->old_win_left &&
- right ==doc->old_win_right &&
- doc->cur_entry==doc->old_cur_entry &&
- doc->cur_col==doc->old_cur_col;
- if (recalc_flags&RECALCG_MASK==RECALCt_TO_SCRN) {
- y_plot_top=y0-scroll_y/FONT_HEIGHT;
- y_plot_bottom=y0+height-1-scroll_y/FONT_HEIGHT;
- if (!(doc->flags&DOCF_BORDER_DOC) &&
- !Bt(&win_task->display_flags,DISPLAYf_NO_BORDER))
- DocBorderLstDraw(doc);
- }
-
- if (doc->cur_col<=doc->cur_entry->min_col)
- doc->cur_col=doc->cur_entry->min_col;
- doc_e=doc->head.next;
- doc_e->de_flags&=~(DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT);
- if (doc_e==doc->head.next)
- s=&doc->settings_head;
- else
- s=&doc_e->last->settings;
- doc->flags=doc_e->de_flags& (DOCG_BL_IV_UL|DOCEF_WORD_WRAP) |
- doc->flags&~(DOCG_BL_IV_UL|DOCEF_WORD_WRAP);
- cur_u8_attr=s->cur_text_attr;
- if (doc_e==doc->head.next) {
- doc->flags&=~DOCF_BWD_MOVEMENT;
- if (recalc_flags&RECALCG_MASK==RECALCt_TO_SCRN && full_refresh)
- doc->flags&=~DOCF_HAS_SONG;
- } else
- doc->flags=doc_e->de_flags& DOCEF_HIGHLIGHT |
- doc->flags&~DOCEF_HIGHLIGHT;
-
- if (doc->head.next==doc) {
- best_doc_e=doc;
- best_col=0;
- doc->cur_entry=doc;
- doc->cur_col=0;
- doc_e=doc;
- }
- skipped_update= doc_e==doc && doc->head.next!=doc;
-
- if (full_refresh) {
- doc->min_x=I32_MAX; doc->min_y=I32_MAX;
- doc->max_x=I32_MIN; doc->max_y=I32_MIN;
- }
- while (doc_e!=doc) {
- while (TRUE) {
- del_doc_e=FALSE;
- if (doc_e->de_flags & (DOCEF_SKIP|DOCEF_FILTER_SKIP)) {
- doc_e2=doc_e;
- goto rc_skip;
- }
- MemCpy(&doc_e->settings,s,sizeof(CDocSettings));
- s=&doc_e->settings;
- if (doc_e->de_flags & (DOCEF_TAG_CB|DOCEF_DEFINE) &&
- !(doc_e->de_flags & DOCEF_LST)) {
- Free(doc_e->tag);
- if (doc_e->de_flags & DOCEF_TAG_CB) {
- if (doc_e->tag_cb)
- doc_e->tag=(*doc_e->tag_cb)(doc,doc_e,mem_task);
- else
- doc_e->tag=StrNew("",mem_task);
- } else {
- if (tmph=HashFind(doc_e->define_str,
- win_task->hash_table,HTT_DEFINE_STR))
- doc_e->tag=StrNew(tmph->data,mem_task);
- else
- doc_e->tag=CAlloc(1,mem_task);
- }
- doc_e->max_col=StrLen(doc_e->tag);
- if (doc->cur_entry==doc_e && doc->cur_col>=doc_e->max_col) {
- if (doc_e->max_col)
- doc->cur_col=doc_e->max_col-1;
- else
- doc->cur_col=0;
- }
- }
- k=DocWordWrapDel(doc,doc_e,full_refresh,same_win,
- left_margin,right_margin,&best_doc_e,&best_col);
- if (doc_e->de_flags & (DOCEF_LEFT_X|DOCEF_RIGHT_X|DOCEF_CENTER_X|
- DOCEF_TOP_Y|DOCEF_BOTTOM_Y|DOCEF_CENTER_Y))
- DocRecalcXY(doc,doc_e,k,
- left,width,height,left_margin,right_margin,x0,y0,&x,&y);
- if (full_refresh && k>0 && doc->flags & DOCF_WORD_WRAP &&
- (doc_e2=DocWordWrapAdd(doc,doc_e,&k,left,right_margin,x,y)))
- doc_e=doc_e2;
- else
- break;
- }
-
- if (full_refresh) {
- doc_e->x=x;
- doc_e->y=y;
- doc_e->page_line_num=doc->page_line_num;
- if (x<doc->min_x) doc->min_x=x;
- if (y<doc->min_y) doc->min_y=y;
- if (find_cursor) {
- D=DocCharDist(doc,x,y);
- col=0;
- }
- }
- col2=0;
-
- tmp_u32_attr=DocTmpAttr(doc,doc_e,cur_u8_attr);
- if (doc_e==doc->cur_entry) {
- cursor_y=doc_e->y;
- if (recalc_flags&RECALCF_ADD_CURSOR && !added_cursor) {
- if (doc_e->type_u8==DOCT_TEXT && 0<doc->cur_col<k &&
- !(doc_e->de_flags & ~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|
- DOCEF_HIGHLIGHT|DOCEF_SKIP|DOCEF_FILTER_SKIP)) &&
- !(doc_e->type&DOCG_BL_IV_UL)) {
- added_cursor=DocSplitTag(doc,doc_e,doc->cur_col,x,y,DOCT_CURSOR);
- k=StrLen(doc_e->tag);
- } else {
- added_cursor=doc_e2=DocEntryNewBase(doc,
- DOCT_CURSOR|doc_e->type&0xFFFFFF00,
- doc_e->de_flags&~DOCEG_HAS_ARG,x,y,doc->page_line_num);
- MemCpy(&doc_e2->settings,&doc_e->settings,sizeof(CDocSettings));
- if (doc_e->type_u8==DOCT_TEXT && doc->cur_col>=k)
- QueIns(doc_e2,doc_e);
- else
- QueInsRev(doc_e2,doc_e);
- }
- }
- }
-
- if (doc_e->de_flags & DOCEF_REFRESH_DATA &&
- (doc_e->type_u8==DOCT_DATA || doc_e->type_u8==DOCT_CHECK_BOX ||
- doc_e->de_flags & DOCEF_LST)) {
- DocDataFmt(doc,doc_e);
- k=StrLen(doc_e->tag);
- }
- if (doc_e->de_flags&DOCEF_TAG) {
- ptr=doc_e->tag;
- if (doc_e->de_flags & DOCEF_TREE) {
- if (k>=2) {
- if (doc_e->de_flags & DOCEF_CHECKED_COLLAPSED)
- *ptr++='+';
- else
- *ptr++='-';
- *ptr++=']';
- ptr=doc_e->tag;
- }
- } else if (doc_e->de_flags & DOCEF_HAS_BIN) {
- if (*ptr=='<' && full_refresh && '0'<=ptr[1]<='9') {
- ptr=MStrPrint("<%d>",doc_e->bin_num);
- Free(doc_e->tag);
- doc_e->tag=StrNew(ptr,mem_task);
- Free(ptr);
- ptr=doc_e->tag;
- k=StrLen(ptr);
- }
- } else if (doc_e->type_u8==DOCT_CHECK_BOX) {
- if (k>=3) {
- *ptr++='[';
- if (doc_e->de_flags & DOCEF_CHECKED_COLLAPSED)
- *ptr++='X';
- else
- *ptr++=CH_SPACE;
- *ptr++=']';
- ptr=doc_e->tag;
- }
- }
- if (doc_e->de_flags & DOCEF_SCROLLING_X) {
- j=StrLen(doc_e->tag);
- if (j && doc_e->scroll_len) {
- i_jif=ToI64(cur_time*FONT_WIDTH*DOC_SCROLL_SPEED)%(j*FONT_WIDTH);
- tmp_u32_attr=tmp_u32_attr & 0xFFE0FF00|
- (FONT_WIDTH-1-i_jif&(FONT_WIDTH-1))<<16;
-#assert FONT_WIDTH==8
- i_jif>>=3;
- for (k=0;k<doc_e->scroll_len;k++) {
- ch=ptr[(i_jif+k)%j];
- if (!Bt(char_bmp_displayable,ch)) ch='.';
- if (recalc_flags&RECALCG_MASK==RECALCt_TO_SCRN &&
- !(doc_e->de_flags&DOCEF_DONT_DRAW)) {
- if (doc_e->de_flags & DOCEF_BORDER_PLOT &&
- !Bt(&win_task->display_flags,DISPLAYf_NO_BORDER))
- TextChar(win_task,TRUE,x-x0,y-y0,tmp_u32_attr+ch);
- else
- TextChar(win_task,FALSE,x-x0,y-y0,tmp_u32_attr+ch);
- }
- x++;
- }
- }
- if (find_cursor) {
- D=DocCharDist(doc,doc_e->x,doc_e->y);
- col=doc_e->min_col;
- }
- col2=doc_e->scroll_len; //TODO This is flawed
- } else {
- if (doc_e->de_flags & DOCEF_BORDER_PLOT &&
- !Bt(&win_task->display_flags,DISPLAYf_NO_BORDER)) {
- while (ch=*ptr++) {
- if (recalc_flags&RECALCG_MASK==RECALCt_TO_SCRN &&
- !(doc_e->de_flags&DOCEF_DONT_DRAW))
- TextChar(win_task,TRUE,x-x0,y-y0,tmp_u32_attr+ch);
- else
- if (find_cursor) {
- d2=DocCharDist(doc,x,y);
- if (d2<D) {
- D=d2;
- col=col2;
- }
- }
- col2++;
- x++;
- }
- } else {
- if (doc_e->type_u8==DOCT_TEXT && doc_e->de_flags&DOCEF_HIGHLIGHT)
- hl=DocHighlight(doc_e,ptr,k,tmp_u32_attr);
- else
- hl=NULL;
- if (recalc_flags&RECALCG_MASK==RECALCt_TO_SCRN &&
- !(doc_e->de_flags&DOCEF_DONT_DRAW)) {
-//Technically we should do this for scrolling_x, too.
- if (y>y_plot_bottom)
- more=TRUE;
- else if (y>=y_plot_top) {
- if (hl)
- TextLenAttrStr(win_task,x-x0,y-y0,k,hl);
- else
- TextLenStr(win_task,x-x0,y-y0,k,tmp_u32_attr,ptr);
- }
- col2+=k;
- x+=k;
- } else {
- if (find_cursor) {
- while (k--) {
- d2=DocCharDist(doc,x,y);
- if (d2<D) {
- D=d2;
- col=col2;
- }
- col2++;
- x++;
- }
- } else {
- col2+=k;
- x+=k;
- }
- }
- Free(hl);
- }
- }
- }
- switch [doc_e->type_u8] {
- case DOCT_TEXT:
- if (!col2 && !(doc_e->de_flags
- &(DOCEF_TREE|DOCEF_LST|DOCEF_TAG_CB|DOCEF_DEFINE|
- DOCEF_AUX_STR|DOCEF_HTML_LINK|DOCEF_BIN_PTR_LINK)))
- del_doc_e=TRUE;
- break;
- case DOCT_HEX_ED:
- if (doc_e->de_flags&DOCEF_DEREF_DATA &&
- !(doc_e->de_flags&DOCEF_REMALLOC_DATA))
- bptr=doc_e->data;
- else
- bptr=&doc_e->data;
- k=doc_e->hex_ed_width; //columns
- for (i=0;i<doc_e->len;i+=k) {
- if (doc_e->de_flags & DOCEF_ZERO_BASED)
- StrPrint(buf,"%08tX ",i);
- else
- StrPrint(buf,"%08tX ",bptr);
- ptr=buf;
- while (ch=*ptr++) {
- if (recalc_flags&RECALCG_MASK==RECALCt_TO_SCRN &&
- !(doc_e->de_flags&DOCEF_DONT_DRAW)) {
- if (doc_e->de_flags & DOCEF_BORDER_PLOT &&
- !Bt(&win_task->display_flags,DISPLAYf_NO_BORDER))
- TextChar(win_task,TRUE,x-x0,y-y0,tmp_u32_attr+ch);
- else
- TextChar(win_task,FALSE,x-x0,y-y0,tmp_u32_attr+ch);
- }
- if (find_cursor) {
- d2=DocCharDist(doc,x,y);
- if (d2<D) {
- D=d2;
- col=i*3;
- }
- }
- x++;
- }
- if (i+k>doc_e->len) k=doc_e->len-i;
- for (j=0;j<k;j++) {
- StrPrint(buf,"%02tX",*bptr++);
- ptr=buf;
- while (ch=*ptr++) {
- if (recalc_flags&RECALCG_MASK==RECALCt_TO_SCRN &&
- !(doc_e->de_flags&DOCEF_DONT_DRAW)) {
- if (doc_e->de_flags & DOCEF_BORDER_PLOT &&
- !Bt(&win_task->display_flags,DISPLAYf_NO_BORDER))
- TextChar(win_task,TRUE,x-x0,y-y0,tmp_u32_attr+ch);
- else
- TextChar(win_task,FALSE,x-x0,y-y0,tmp_u32_attr+ch);
- }
- if (find_cursor) {
- d2=DocCharDist(doc,x,y);
- if (d2<D) {
- D=d2;
- col=col2;
- }
- }
- col2++;
- x++;
- }
- x++;
- }
- bptr-=j;
- x+=(doc_e->hex_ed_width-k)*3;
- for (j=0;j<k;j++) {
- ch=*bptr++;
- if (!Bt(char_bmp_displayable,ch)) ch='.';
- if (recalc_flags&RECALCG_MASK==RECALCt_TO_SCRN &&
- !(doc_e->de_flags&DOCEF_DONT_DRAW)) {
- if (doc_e->de_flags & DOCEF_BORDER_PLOT &&
- !Bt(&win_task->display_flags,DISPLAYf_NO_BORDER))
- TextChar(win_task,TRUE,x-x0,y-y0,tmp_u32_attr+ch);
- else
- TextChar(win_task,FALSE,x-x0,y-y0,tmp_u32_attr+ch);
- }
- if (find_cursor) {
- d2=DocCharDist(doc,x,y);
- if (d2<D) {
- D=d2;
- col=col2;
- }
- }
- col2++;
- x++;
- }
- y++;
- x-=doc_e->hex_ed_width*3+k+9;
- }
- break;
- case DOCT_NEW_LINE:
- case DOCT_SOFT_NEW_LINE:
- if (recalc_flags&RECALCG_MASK==RECALCt_TO_SCRN &&
- !(doc_e->de_flags&DOCEF_DONT_DRAW)&&
- y_plot_top<=y<=y_plot_bottom)
- TextLenAttr(win_task,x-x0,y-y0,width-(x-x0),cur_u8_attr<<8);
- if (doc_e->de_flags&DOCEF_HIGHLIGHT && s->state==DOCSS_CPP_Z_COMMENT)
- s->state=DOCSS_NORMAL;
- y++;
- doc->page_line_num++;
-rc_start_of_line:
- if (s->left_margin==DOC_DFT)
- x=s->indent;
- else
- x=s->indent+s->left_margin;
-rc_adjust_xy:
- i=s->indent+s->left_margin;
- if (x<i)
- x=i;
- if (doc->page_line_num<0)
- doc->page_line_num=s->page_len+doc->page_line_num%s->page_len;
- else {
- if (doc->page_line_num>=s->page_len) {
- doc->page_line_num-=s->page_len;
- if (doc->page_line_num>=s->page_len) //avoid extra divide
- doc->page_line_num=doc->page_line_num%s->page_len;
- }
- }
- if (s->header!=DOC_DFT) {
- if (doc->page_line_num<s->header) {
- y+=s->header-doc->page_line_num;
- doc->page_line_num=s->header;
- goto rc_start_of_line;
- }
- }
- if (s->footer==DOC_DFT) {
- if (doc->page_line_num>=s->page_len) {
- if (s->header==DOC_DFT)
- doc->page_line_num=0;
- else {
- doc->page_line_num=s->header;
- y+=s->header;
- }
- goto rc_start_of_line;
- }
- } else {
- if (doc->page_line_num>=s->page_len-s->footer) {
- y+=s->footer;
- if (s->header==DOC_DFT)
- doc->page_line_num=0;
- else {
- doc->page_line_num=s->header;
- y+=s->header;
- }
- goto rc_start_of_line;
- }
- }
- break;
- case DOCT_TAB:
- k=(x+8) & ~7;
- if (doc_e->de_flags & DOCEF_BORDER_PLOT &&
- !Bt(&win_task->display_flags,DISPLAYf_NO_BORDER)) {
- while (x<k) {
- if (recalc_flags&RECALCG_MASK==RECALCt_TO_SCRN &&
- !(doc_e->de_flags&DOCEF_DONT_DRAW))
- TextChar(win_task,TRUE,x-x0,y-y0,tmp_u32_attr+CH_SPACE);
- if (find_cursor) {
- d2=DocCharDist(doc,x,y);
- if (d2<D)
- D=d2;
- }
- x++;
- }
- } else {
- k-=x;
- if (recalc_flags&RECALCG_MASK==RECALCt_TO_SCRN &&
- !(doc_e->de_flags&DOCEF_DONT_DRAW)) {
- if (y_plot_top<=y<=y_plot_bottom)
- TextLenStr(win_task,x-x0,y-y0,k,tmp_u32_attr,"");
- x+=k;
- } else {
- if (find_cursor) {
- while (k--) {
- d2=DocCharDist(doc,x,y);
- if (d2<D)
- D=d2;
- x++;
- }
- } else
- x+=k;
- }
- }
- break;
- case DOCT_PAGE_BREAK:
- doc->flags|=DOCF_BWD_MOVEMENT;
- y+=s->page_len-doc_e->page_line_num;
- doc->page_line_num=0;
- goto rc_start_of_line;
- case DOCT_CURSOR:
- if (!find_cursor && !(doc->flags & DOCF_NO_CURSOR)) {
- doc->cur_entry=doc_e->next;
- doc->cur_col=doc->cur_entry->min_col;
- }
- if (doc_e!=added_cursor)
- del_doc_e=TRUE;
- break;
- case DOCT_PMT:
- cur_u8_attr=cur_u8_attr&0xF0|DOC_COLOR_PMT;
- if (y==cursor_y) {
- doc->cur_entry=doc_e->next;
- doc->cur_col=doc->cur_entry->min_col;
- }
- break;
- case DOCT_CLEAR:
- next_clear_found=doc_e;
- if (doc_e->de_flags&DOCEF_HOLD)
- clear_holds=TRUE;
- else
- clear_holds=FALSE;
- break;
- case DOCT_PAGE_LEN:
- s->page_len=doc_e->attr;
- if (doc_e->de_flags & DOCEF_WIN_REL)
- s->page_len+=height;
- goto rc_adjust_xy;
- case DOCT_LEFT_MARGIN:
- i=doc_e->attr;
- left_margin=left+i;
- s->left_margin=i;
- goto rc_start_of_line;
- case DOCT_RIGHT_MARGIN:
- if (doc_e->de_flags & DOCEF_WIN_REL)
- i=width-1-doc_e->attr;
- else
- i=doc_e->attr;
- right_margin=left+i;
- s->right_margin=i;
- goto rc_adjust_xy;
- case DOCT_HEADER:
- s->header=doc_e->attr;
- goto rc_adjust_xy;
- case DOCT_FOOTER:
- s->footer=doc_e->attr;
- goto rc_adjust_xy;
- case DOCT_INDENT:
- if (doc_e->de_flags & DOCEF_LEFT_X)
- i=doc_e->attr;
- else
- i=s->indent+doc_e->attr;
- s->indent=i;
- goto rc_start_of_line;
- case DOCT_FOREGROUND:
- cur_u8_attr&=0xF0;
- if (doc_e->attr==DOC_DFT)
- cur_u8_attr|=s->dft_text_attr&0x0F;
- else
- cur_u8_attr|=doc_e->attr;
- s->cur_text_attr=cur_u8_attr;
- break;
- case DOCT_BACKGROUND:
- cur_u8_attr&=0x0F;
- if (doc_e->attr==DOC_DFT)
- cur_u8_attr|=s->dft_text_attr&0xF0;
- else
- cur_u8_attr|=doc_e->attr<<4;
- s->cur_text_attr=cur_u8_attr;
- break;
- case DOCT_DFT_FOREGROUND:
- cur_u8_attr&=0xF0;
- if (doc_e->attr==DOC_DFT)
- cur_u8_attr|=s->dft_text_attr&0xF;
- else
- cur_u8_attr|=doc_e->attr;
- s->dft_text_attr=s->dft_text_attr&0xF0|cur_u8_attr&0x0F;
- s->cur_text_attr=cur_u8_attr;
- break;
- case DOCT_DFT_BACKGROUND:
- cur_u8_attr&=0x0F;
- if (doc_e->attr==DOC_DFT)
- cur_u8_attr|=s->dft_text_attr&0xF0;
- else
- cur_u8_attr|=doc_e->attr<<4;
- s->dft_text_attr=s->dft_text_attr&0x0F|cur_u8_attr&0xF0;
- s->cur_text_attr=cur_u8_attr;
- break;
- case DOCT_WORD_WRAP:
- if (doc_e->attr)
- doc->flags|=DOCF_WORD_WRAP;
- else
- doc->flags&=~DOCF_WORD_WRAP;
- break;
- case DOCT_HIGHLIGHT:
- if (doc_e->attr)
- doc->flags|=DOCF_HIGHLIGHT;
- else
- doc->flags&=~DOCF_HIGHLIGHT;
- break;
- case DOCT_BLINK:
- if (doc_e->attr)
- doc->flags|=DOCF_BLINK;
- else
- doc->flags&=~DOCF_BLINK;
- break;
- case DOCT_INVERT:
- if (doc_e->attr)
- doc->flags|=DOCF_INVERT;
- else
- doc->flags&=~DOCF_INVERT;
- break;
- case DOCT_UNDERLINE:
- if (doc_e->attr)
- doc->flags|=DOCF_UNDERLINE;
- else
- doc->flags&=~DOCF_UNDERLINE;
- break;
- case DOCT_SHIFTED_X:
- s->shifted_x=doc_e->attr;
- break;
- case DOCT_SHIFTED_Y:
- s->shifted_y=doc_e->attr;
- break;
- case DOCT_CURSOR_MOVEMENT:
- doc->flags|=DOCF_BWD_MOVEMENT;
- x+=doc_e->cursor_x_offset;
- if (doc_e->de_flags & DOCEF_PAGE_REL_Y) {
- i=doc->page_line_num;
- if (doc_e->de_flags & DOCEF_TOP_Y)
- doc->page_line_num=0;
- else if (doc_e->de_flags & DOCEF_BOTTOM_Y)
- doc->page_line_num=s->page_len-1;
- else if (doc_e->de_flags & DOCEF_CENTER_Y)
- doc->page_line_num=s->page_len>>1;
- y+=doc->page_line_num-i;
- }
- y+=doc_e->cursor_y_offset;
- doc->page_line_num+=doc_e->cursor_y_offset;
- goto rc_adjust_xy;
- case DOCT_SPRITE:
- if (!doc_e->bin_data && doc->flags&DOCEF_HAS_BIN)
- doc_e->bin_data=DocBinFindNum(doc,doc_e->bin_num);
- if ((tmpb=doc_e->bin_data) &&
- !tmpb->tag && doc_e->tag && *doc_e->tag)
- tmpb->tag=StrNew(doc_e->tag,mem_task);
- if (tmpb && dc) {
- DCRst(dc);
- dc->flags&=~(DCF_DONT_DRAW|DCF_LOCATE_NEAREST);
- if (recalc_flags&RECALCG_MASK!=RECALCt_TO_SCRN ||
- doc_e->de_flags&DOCEF_DONT_DRAW)
- dc->flags|=DCF_DONT_DRAW;
- bptr=tmpb->data;
- ii=SpriteTypeMask(bptr);
- if (ii&1<<SPT_TYPES_NUM) {
- bptr=gr.empty_sprite;
- ii=SpriteTypeMask(bptr);
- }
- if (ii&(1<<SPT_FLOOD_FILL|1<<SPT_FLOOD_FILL_NOT))
- i=cur_u8_attr>>4 &0xF ^ win_task->text_attr>>4 & 0xF;
- else {
- i=tmp_u32_attr>>12&0xF ^ win_task->text_attr>>4 & 0xF;
- if (tmp_u32_attr & DOCET_SEL)
- i^=0xF;
- if (tmp_u32_attr & DOCET_INVERT)
- i^=0xF;
- if (blink_flag &&
- (doc_e==doc->cur_entry || tmp_u32_attr&DOCET_BLINK))
- i^=0xF;
- }
- dc->color=i;
- if (find_cursor)
- dc->flags|=DCF_LOCATE_NEAREST;
- dc->cur_x=(doc->x-x0)*FONT_WIDTH+pix_left+scroll_x;
- dc->cur_y=(doc->y-y0)*FONT_HEIGHT+pix_top+scroll_y;
- dc->cur_z=0;
- dc->bkcolor=i;
- if (doc_e->de_flags & DOCEF_FROM_START) {
- xx=(x-k-x0)*FONT_WIDTH; //TODO: scrolling text is not length k
- yy=(y-y0)*FONT_HEIGHT;
- zz=0;
- } else {
- xx=(x-x0)*FONT_WIDTH;
- yy=(y-y0)*FONT_HEIGHT;
- zz=0;
- }
- if (ii&(1<<SPT_MESH|1<<SPT_SHIFTABLE_MESH)) {
- if (!depth_buf) {
- DCDepthBufAlloc(dc);
- depth_buf=dc->depth_buf;
- } else
- dc->depth_buf=depth_buf;
- Mat4x4IdentEqu(dc->r);
- Mat4x4RotZ(dc->r,cur_time*3.1);
- Mat4x4RotY(dc->r,cur_time*1.9);
- Mat4x4RotX(dc->r,cur_time);
- dc->flags|=DCF_TRANSFORMATION;
- dc->x=xx;
- dc->y=yy;
- dc->z=GR_Z_ALL;
- xx=0; yy=0; zz=0;
- }
- Sprite3(dc,xx,yy,zz,bptr);
- dc->depth_buf=NULL;
- dc->flags&=~(DCF_LOCATE_NEAREST|DCF_DONT_DRAW|DCF_TRANSFORMATION);
- if (dc->nearest_dist<=D) {
- D=dc->nearest_dist;
- col=doc_e->min_col;
- }
- }
- break;
- case DOCT_SONG:
- if (sys_focus_task==win_task &&
- recalc_flags&RECALCG_MASK==RECALCt_TO_SCRN &&
- !(doc_e->de_flags&DOCEF_DONT_DRAW)) {
- if (doc_e->aux_str &&
- (!music.cur_song || StrCmp(music.cur_song,doc_e->aux_str))) {
- Free(music.cur_song);
- MusicSettingsRst;
- music.cur_song=AStrNew(doc_e->aux_str);
- }
- }
- doc->flags|=DOCF_HAS_SONG;
- break;
- case DOCT_HTML_CODE:
- if (recalc_flags&RECALCF_TO_HTML &&
- doc_e->de_flags&DOCEF_TAG && doc_e->tag)
- x-=StrLen(doc_e->tag);
- break;
- case DOCT_TYPES_NUM-1: //nobound switch
- default:
- break;
- }
-
- if (doc_e->de_flags & DOCEF_HAS_BORDER)
- TextBorder(win_task,doc_e->x-x0,x-x0-1,doc_e->y-y0,y-y0,
- tmp_u32_attr.u8[1],ToBool(doc_e->de_flags & DOCEF_SOLID_BORDER));
- if (full_refresh) {
- switch (doc_e->type_u8) {
- case DOCT_CHECK_BOX:
- doc_e->max_col=2;
- break;
- case DOCT_LST:
- case DOCT_TREE:
- case DOCT_BTTN:
- case DOCT_LINK:
- case DOCT_MENU_VAL:
- case DOCT_MACRO:
- doc_e->max_col=1;
- break;
- default:
- if (doc_e->de_flags & (DOCEF_TREE|DOCEF_LST))
- doc_e->max_col=1;
- else
- doc_e->max_col=col2;
- }
-
- if (x>doc->max_x) doc->max_x=x;
- if (y>doc->max_y) doc->max_y=y;
- if (D<=best_d && !(doc_e->de_flags&DOCEF_NO_CLICK_ON)) {
- best_d=D;
- best_doc_e=doc_e;
- best_col=col;
- }
- if (doc_e->de_flags & DOCEF_TREE) {
- if (doc_e->de_flags & DOCEF_CHECKED_COLLAPSED)
- tree_collapsed=TRUE;
- else
- tree_collapsed=FALSE;
- doc_e2=doc_e->next;
- while (doc_e2!=doc && doc_e2->type_u8!=DOCT_INDENT &&
- !(doc_e2->de_flags & DOCEF_TREE))
- doc_e2=doc_e2->next;
- if (doc_e2->type_u8==DOCT_INDENT) {
- j=i=s->indent;
- do {
- if (tree_collapsed)
- doc_e2->de_flags|=DOCEF_SKIP;
- else
- doc_e2->de_flags&=~DOCEF_SKIP;
- if (doc_e2->type_u8==DOCT_INDENT) {
- if (doc_e2->de_flags & DOCEF_LEFT_X)
- j=doc_e2->attr;
- else
- j+=doc_e2->attr;
- }
- doc_e2=doc_e2->next;
- } while (doc_e2!=doc && j>i);
- }
- }
- }
-
- doc_e2=doc_e->next;
-rc_skip:
- while (doc_e2!=doc && doc_e2->de_flags&(DOCEF_SKIP|DOCEF_FILTER_SKIP)) {
- if (doc_e2==doc->cur_entry) {
- doc->cur_entry=doc_e2->next;
- doc->cur_col=doc->cur_entry->min_col;
- }
- if (full_refresh) {
- doc_e2->x=x;
- doc_e2->y=y;
- doc_e2->page_line_num=doc->page_line_num;
- MemCpy(&doc_e2->settings,s,sizeof(CDocSettings));
- doc_e2->type.u8[1]=cur_u8_attr;
- doc_e2->de_flags=doc->flags
- &(DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT) |
- doc_e2->de_flags&~(DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT);
- }
- doc_e2=doc_e2->next;
- }
-
- if (full_refresh) {
- if (del_doc_e) {
- if (!(doc_e->de_flags & (DOCEF_HOLD|DOCEF_FILTER_SKIP))) {
- if (doc_e==doc->cur_entry) {
- doc->cur_entry=doc_e2;
- doc->cur_col=doc_e2->min_col;
- }
- if (best_doc_e==doc_e) {
- best_doc_e=doc_e2;
- best_col=doc_e2->min_col; //TODO: might be bug
- }
- DocEntryDel(doc,doc_e);
- }
- }
- }
- num_entries++;
- if (!full_refresh && doc_e->y>y_plot_bottom)
- break;
- doc_e=doc_e2;
- }
-
- if (full_refresh) {
- if (doc->cur_entry==doc && recalc_flags&RECALCF_ADD_CURSOR) {
- doc_e2=DocEntryNewBase(doc,DOCT_CURSOR,,x,y,doc->page_line_num);
- MemCpy(&doc_e2->settings,s,sizeof(CDocSettings));
- QueInsRev(doc_e2,doc);
- }
-
- if (doc->min_x>doc->max_x) {
- doc->max_x=0;
- doc->min_x=0;
- }
- if (doc->min_y>doc->max_y) {
- doc->max_y=0;
- doc->min_y=0;
- }
-
- //Update header
- if (!skipped_update) {
- doc_e->x=x;
- doc_e->y=y;
- doc_e->page_line_num=doc->page_line_num;
- MemCpy(&doc_e->settings,s,sizeof(CDocSettings));
- doc_e->type.u8[1]=cur_u8_attr;
- if (find_cursor) {
- D=DocCharDist(doc,x,y);
- if (D<best_d && !(doc_e->de_flags&DOCEF_NO_CLICK_ON)) {
- best_d=D;
- best_doc_e=doc_e;
- best_col=0;
- }
- }
- }
- if (doc->flags & DOCF_SIZE_MIN) {
- if (Bt(&win_task->display_flags,DISPLAYf_NO_BORDER)) {
- if (left<0)
- left=0;
- i=left+doc->max_x-doc->min_x;
- if (i>TEXT_COLS-1)
- i=TEXT_COLS-1;
- WinHorz(left,i,win_task);
- if (top<0)
- top=0;
- i=top+doc->max_y-doc->min_y;
- if (i>TEXT_ROWS-1)
- i=TEXT_ROWS-1;
- WinVert(top,i,win_task);
- } else {
- if (left<1)
- left=1;
- i=left+doc->max_x-doc->min_x;
- if (i>TEXT_COLS-2)
- i=TEXT_COLS-2;
- WinHorz(left,i,win_task);
- if (top<1)
- top=1;
- i=top+doc->max_y-doc->min_y;
- if (i>TEXT_ROWS-2)
- i=TEXT_ROWS-2;
- WinVert(top,i,win_task);
- }
- }
- if (find_cursor) {
- doc->cur_entry=best_doc_e;
- doc->cur_col=best_col;
- DocFormBwd(doc);
-//We need this because text coordinates are used
- if (best_d<FONT_WIDTH)
- best_d=0;
- doc->best_d=best_d;
- }
-
- if (doc->cur_entry->type_u8!=DOCT_HEX_ED) {
- doc->y=doc->cur_entry->y;
- doc->x=doc->cur_entry->x+doc->cur_col;
- } else {
- doc->y=doc->cur_entry->y+doc->cur_col/3/doc->cur_entry->hex_ed_width;
- x=doc->cur_col%(doc->cur_entry->hex_ed_width*3);
- i=x/doc->cur_entry->hex_ed_width;
- doc->x=doc->cur_entry->x+9;
- if (i<2)
- doc->x+=x>>1*3+x&1;
- else
- doc->x+=doc->cur_entry->hex_ed_width*3+
- (x-doc->cur_entry->hex_ed_width<<1);
- }
- doc->line=doc->y+1;
- doc->col=doc->x+1;
-
- if (recalc_flags&RECALCF_HAS_CURSOR) {
- if (recalc_flags&RECALCG_MASK==RECALCt_TO_SCRN) {
- x=0;
- y=0;
- } else {
- x=scroll_x/FONT_WIDTH;
- y=scroll_y/FONT_HEIGHT;
- }
- if (doc->top_line_num-y+height-1>doc->max_y)
- doc->top_line_num=doc->max_y-(height-1)+y;
- if (doc->top_line_num-y<doc->min_y)
- doc->top_line_num=doc->min_y+y;
-
- if (doc->y-doc->top_line_num+y>height-1)
- doc->top_line_num=doc->y-(height-1)+y;
- if (doc->y-doc->top_line_num+y<0)
- doc->top_line_num=doc->y+y;
-
- if (doc->line_start_col-x+width-1>doc->max_x)
- doc->line_start_col=doc->max_x-(width-1)+x;
- if (doc->line_start_col-x<doc->min_x)
- doc->line_start_col=doc->min_x+x;
-
- if (doc->x-doc->line_start_col+x>width-1)
- doc->line_start_col=doc->x-(width-1)+x;
- if (doc->x-doc->line_start_col+x<0)
- doc->line_start_col=doc->x+x;
- }
- }
- if (recalc_flags&RECALCG_MASK==RECALCt_TO_SCRN &&
- recalc_flags&RECALCF_HAS_CURSOR) {
- x=doc->x-doc->line_start_col+left +scroll_x/FONT_WIDTH;
- y=doc->y-doc->top_line_num+top+scroll_y/FONT_HEIGHT;
- if (0<=x<=right && 0<=y<=bottom &&
- x<TEXT_COLS && y<TEXT_ROWS &&
- !(doc->flags&DOCF_HIDE_CURSOR)) {
- u32_ptr=gr.text_base+y*TEXT_COLS+x;
- *u32_ptr|=DOCET_BLINK;
- *u32_ptr^=0xFF00;
- }
- if (full_refresh) {
- if (!(doc->flags&DOCF_NO_SCROLL_BARS)) {
- if (!Bt(&hss->flags,WSSf_SET_TO_POS)) {
- hss->min=doc->min_x;
- if (doc->max_x-width+1<hss->min)
- hss->max=hss->min;
- else
- hss->max=doc->max_x-width+1;
- hss->pos=doc->line_start_col;
- }
- if (!Bt(&vss->flags,WSSf_SET_TO_POS)) {
- vss->min=doc->min_y;
- if (doc->max_y-height+1<vss->min)
- vss->max=vss->min;
- else
- vss->max=doc->max_y-height+1;
- vss->pos=doc->top_line_num;
- }
- }
- LBEqu(&doc->flags,DOCf_MORE,more);
- }
- }
- if (!same_win) {
- doc->old_win_top=top;
- doc->old_win_bottom=bottom;
- doc->old_win_left=left;
- doc->old_win_right=right;
- doc->old_cur_entry=doc->cur_entry;
- doc->old_cur_col=doc->old_cur_col;
- }
- if (doc->flags & DOCF_HAS_SONG)
- LBts(&win_task->task_flags,TASKf_HAS_SONG);
- if (full_refresh) {
- i=num_entries-doc->max_entries;
- if (next_clear_found) {
- DocDelToEntry(doc,next_clear_found,clear_holds);
- DocRecalc(doc,recalc_flags);
- } else if (i>1024) {
- DocDelToNum(doc,i);
- DocRecalc(doc,recalc_flags);
- }
- }
- DCDel(dc);
- Free(depth_buf);
- if (unlock)
- DocUnlock(doc);
- return TRUE;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocRecalcLib.HC.HTML b/public/src/Adam/DolDoc/DocRecalcLib.HC.HTML deleted file mode 100644 index 40329bb..0000000 --- a/public/src/Adam/DolDoc/DocRecalcLib.HC.HTML +++ /dev/null @@ -1,225 +0,0 @@ - - - - - DocRecalcLib.HC - - - - - #help_index "DolDoc"
-
-I64 DocCharDist(CDoc *doc,I64 x,I64 y)
-{
-#assert FONT_WIDTH==FONT_HEIGHT
- return (SqrI64(doc->x-x)+SqrI64(doc->y-y))*FONT_WIDTH*FONT_WIDTH;
-}
-
-U0 DocDelToNum(CDoc *doc,I64 num)
-{
- CDocEntry *doc_e=doc->head.next,*doc_e2;
- while (num-->0 && doc_e!=doc) {
- doc_e2=doc_e->next;
- if (!(doc_e->de_flags & (DOCEF_HOLD|DOCEF_FILTER_SKIP))) {
- if (doc_e==doc->cur_entry) {
- doc->cur_entry=doc_e2;
- doc->cur_col=doc_e2->min_col;
- }
- DocEntryDel(doc,doc_e);
- }
- doc_e=doc_e2;
- }
-}
-
-U0 DocDelToEntry(CDoc *doc,CDocEntry *clear_entry,Bool clear_holds)
-{
- CDocEntry *doc_e=doc->head.next,*doc_e2;
- while (doc_e!=doc) {
- doc_e2=doc_e->next;
- if (!(doc_e->de_flags & (DOCEF_HOLD|DOCEF_FILTER_SKIP))||clear_holds) {
- if (doc_e==doc->cur_entry) {
- doc->cur_entry=doc_e2;
- doc->cur_col=doc_e2->min_col;
- }
- DocEntryDel(doc,doc_e);
- }
- if (doc_e==clear_entry)
- break;
- doc_e=doc_e2;
- }
-}
-
-U0 DocBorderLstDraw(CDoc *doc)
-{
- CTask *win_task=doc->win_task;
- I64 i,y=-1,attr=win_task->border_attr<<8;
- U64 ch;
- CDoc *tmpl=doc;
- CD3I64 saved_scroll;
- while (tmpl && tmpl->doc_signature==DOC_SIGNATURE_VAL) {
- y+=(Bsr(tmpl->desc)+7)>>3+1; //StrLen+1
- tmpl=tmpl->parent_doc;
- }
- tmpl=doc;
- if (y>win_task->win_height)
- y=win_task->win_height;
- WinScrollNull(win_task,&saved_scroll);
- while (tmpl && tmpl->doc_signature==DOC_SIGNATURE_VAL) {
- ch=tmpl->desc;
- i=(Bsr(ch)+7)>>3; //StrLen
- ch=EndianI64(ch<<((8-i)<<3));
- attr=win_task->border_attr<<8;
- while (i-- && y>0) {
- TextChar(win_task,TRUE,-1,--y,attr+ch&0xFF);
- ch>>=8;
- }
- y--;
- tmpl=tmpl->parent_doc;
- }
- WinScrollRestore(win_task,&saved_scroll);
-}
-
-public U0 DocTop(CDoc *doc=NULL)
-{//Move cursor, cur_entry, to top.
- Bool unlock;
- if (!doc && !(doc=DocPut))
- return;
- unlock=DocLock(doc);
- doc->cur_entry=doc->head.next;
- doc->cur_col=doc->cur_entry->min_col;
- doc->x=0;
- doc->y=0;
- doc->line_start_col=0;
- doc->top_line_num=0;
-
- DocFormFwd(doc);
- DocRecalc(doc);
- if (unlock)
- DocUnlock(doc);
-}
-
-public U0 DocCenter(CDoc *doc=NULL,I64 recalc_flags=RECALCt_NORMAL)
-{//Center win on doc cursor, cur_entry.
- Bool unlock;
- CTask *task;
- if (!doc && !(doc=DocPut))
- return;
- unlock=DocLock(doc);
- task=doc->win_task;
- DocRecalc(doc,recalc_flags);
- if (!(doc->flags&DOCF_BORDER_DOC))
- doc->top_line_num=doc->y-(task->win_height+1)>>1;
- if (unlock)
- DocUnlock(doc);
-}
-
-public U0 DocBottom(CDoc *doc=NULL)
-{//Move cursor, cur_entry, to bottom.
- Bool unlock;
- if (!doc && !(doc=DocPut))
- return;
- unlock=DocLock(doc);
- doc->cur_entry=doc;
- doc->cur_col=0;
- DocRecalc(doc);
- if (unlock)
- DocUnlock(doc);
-}
-
-public U0 DocClear(CDoc *doc=NULL,Bool clear_holds=FALSE)
-{//Clear all doc entries, except +H, hold entries.
- Bool unlock;
- if (!doc && !(doc=DocPut))
- return;
- unlock=DocLock(doc);
- DocBottom(doc);
- if (clear_holds)
- DocPrint(doc,"$CL+H$");
- else
- DocPrint(doc,"$CL$");
- DocRecalc(doc);
- if (unlock)
- DocUnlock(doc);
-}
-
-public Bool DocCursor(Bool show=OFF,CDoc *doc=NULL)
-{//Show or hide cursor.
- if (!doc && !(doc=DocPut))
- return FALSE;
- return !LBEqu(&doc->flags,DOCf_HIDE_CURSOR,!show);
-}
-
-public Bool DocHighlightCursor(Bool show=OFF,CDoc *doc=NULL)
-{//Highlight or Don't highlight cursor.
- if (!doc && !(doc=DocPut))
- return FALSE;
- return !LBEqu(&doc->flags,DOCf_DONT_HIGHLIGHT_CURSOR,!show);
-}
-
-public Bool DocScroll(Bool val=OFF,CDoc *doc=NULL)
-{//Turn scroll bars OFF/ON.
- if (!doc && !(doc=DocPut))
- return FALSE;
- return !LBEqu(&doc->flags,DOCf_NO_SCROLL_BARS,!val);
-}
-
-public U0 DocCollapse(Bool collapse=TRUE,CDoc *doc=NULL)
-{//Collapse or uncollapse all tree widgets.
- CDocEntry *doc_e;
- Bool unlock;
- if (!doc && !(doc=DocPut))
- return;
- unlock=DocLock(doc);
- doc_e=doc->head.next;
- while (doc_e!=doc) {
- if (doc_e->de_flags&DOCEF_TREE)
- BEqu(&doc_e->de_flags,DOCEf_CHECKED_COLLAPSED,collapse);
- doc_e=doc_e->next;
- }
- DocRecalc(doc);
- if (unlock)
- DocUnlock(doc);
-}
-
-#help_index "DolDoc/Cmd Line (Typically);Cmd Line (Typically)"
-public I64 DocMax(I64 i=I64_MAX)
-{//Set max document entries. (Cmd line buffer size.)
-//Adjusts the size of the cmd line buf.
- //Normally, the cmd line deletes entries
- //when more are added and the old scroll up.
- //See max_entries.
- I64 res;
- CDoc *doc;
- if (doc=DocPut) {
- res=doc->max_entries;
- doc->max_entries=i;
- return res;
- } else
- return 0;
-}
-
-#help_index "DolDoc/Task;StdOut/Task"
-U0 DocUpdateTaskDocs(CTask *task)
-{//This is called from GrUpdateTaskWin() by the winmgr at 30fps.
- CDoc *doc;
- CD3I64 saved_scroll;
- if (task->border_src==BDS_CUR_DRV && task->cur_dv)
- task->border_attr=DrvTextAttrGet(Drv2Let(task->cur_dv));
- if (task->title_src==TTS_TASK_NAME)
- StrCpy(task->task_title,task->task_name);
- if ((doc=DocDisplay(task)) && !(doc->flags&DOCF_DONT_SHOW)) {
- if (task->border_src==BDS_ED_FILENAME_DRV)
- task->border_attr=DrvTextAttrGet(*doc->filename.name);
- if (task->title_src==TTS_ED_FILENAME)
- MemCpy(task->task_title,doc->filename.name,STR_LEN-1);
- DocRecalc(doc,RECALCt_TO_SCRN|RECALCF_HAS_CURSOR);
- }
- if ((doc=DocBorder(task)) && !(doc->flags&DOCF_DONT_SHOW)) {
- WinScrollNull(task,&saved_scroll);
- DocRecalc(doc,RECALCt_TO_SCRN);
- WinScrollRestore(task,&saved_scroll);
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocRun.HC.HTML b/public/src/Adam/DolDoc/DocRun.HC.HTML deleted file mode 100644 index 3e0de6e..0000000 --- a/public/src/Adam/DolDoc/DocRun.HC.HTML +++ /dev/null @@ -1,115 +0,0 @@ - - - - - DocRun.HC - - - - - #help_index "DolDoc"
-
-public I64 DocEntryRun(CDoc *doc,CDocEntry *doc_e,
- Bool exited,I64 *_has_action=NULL)
-{//Do action on final entry sel by user.
-//Sometimes returns locked, sometimes unlocked
- U8 ch=doc->cmd_U8,*st;
- I64 res=DOCM_CANCEL,has_action=FALSE;
- CHashDefineStr *tmph;
- DocLock(doc);
- if (!exited) {
- if (doc_e->de_flags & DOCEF_ESC) {
- Msg(MSG_KEY_DOWN,CH_ESC,0,1<<JOBf_DONT_FILTER);
- has_action=TRUE;
- goto er_done;
- } if (doc_e->de_flags & DOCEF_QUIT) {
- Msg(MSG_KEY_DOWN,CH_SHIFT_ESC,0,1<<JOBf_DONT_FILTER);
- has_action=TRUE;
- goto er_done;
- } else if (doc_e->de_flags & DOCEF_CHECK_COLLAPSABLE) {
- doc_e->de_flags^=DOCEF_CHECKED_COLLAPSED;
- has_action=TRUE;
- }
- }
- try {
- if (ch==CH_SPACE) {
- if (doc_e->de_flags & DOCEF_LINK && doc->left_click_link) {
- res=(*doc->left_click_link)(doc,doc_e);
- has_action=TRUE;
- }
- if (doc_e->de_flags & DOCEF_LEFT_EXP) {
- res=doc_e->left_exp;
- has_action=TRUE;
- Msg(MSG_CMD,res,0,1<<JOBf_DONT_FILTER);
- }
- if (doc_e->de_flags & DOCEF_LEFT_CB && doc_e->left_cb) {
- DocUnlock(doc);
- res=(*doc_e->left_cb)(doc,doc_e);
- has_action=TRUE;
- Msg(MSG_CMD,res,0,1<<JOBf_DONT_FILTER);
- }
- if (doc_e->de_flags & DOCEF_LEFT_MACRO) {
- if (doc_e->de_flags & DOCEF_POPUP) {
- st=StrNew(doc_e->left_macro);
- DocUnlock(doc);
- PopUp(st,Fs);
- Free(st);
- } else {
- if (doc_e->de_flags & DOCEF_LEFT_IN_STR)
- InStr("%s",doc_e->left_macro);
- else
- In("%s",doc_e->left_macro);
- }
- has_action=TRUE;
- }
- if (!exited && doc_e->de_flags & DOCEF_LST &&
- doc_e->de_flags & DOCEF_DEFINE &&
- (tmph=HashFind(doc_e->define_str,
- doc->win_task->hash_table,HTT_DEFINE_STR)) &&
- (res=PopUpPickLst(tmph->data))!=DOCM_CANCEL) {
- DocDataFmt(doc,doc_e,res);
- DocDataScan(doc,doc_e);
- has_action=TRUE;
- }
- } else if (ch=='\n') {
- if (doc_e->de_flags & DOCEF_LINK && doc->right_click_link) {
- res=(*doc->right_click_link)(doc,doc_e);
- has_action=TRUE;
- }
- if (doc_e->de_flags & DOCEF_RIGHT_EXP) {
- res=doc_e->right_exp;
- has_action=TRUE;
- Msg(MSG_CMD,res,0,1<<JOBf_DONT_FILTER);
- }
- if (doc_e->de_flags & DOCEF_RIGHT_CB && doc_e->right_cb) {
- DocUnlock(doc);
- res=(*doc_e->right_cb)(doc,doc_e);
- has_action=TRUE;
- Msg(MSG_CMD,res,0,1<<JOBf_DONT_FILTER);
- }
- if (doc_e->de_flags & DOCEF_RIGHT_MACRO) {
- if (doc_e->de_flags & DOCEF_POPUP) {
- st=StrNew(doc_e->right_macro);
- DocUnlock(doc);
- PopUp(st,Fs);
- Free(st);
- } else {
- if (doc_e->de_flags & DOCEF_RIGHT_IN_STR)
- InStr("%s",doc_e->right_macro);
- else
- In("%s",doc_e->right_macro);
- }
- has_action=TRUE;
- }
- }
- }
- catch
- DocBottom(doc);
- doc->cmd_U8=CH_SPACE;
-er_done:
- if (_has_action) *_has_action=has_action;
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocTerm.HC.HTML b/public/src/Adam/DolDoc/DocTerm.HC.HTML deleted file mode 100644 index 54c5609..0000000 --- a/public/src/Adam/DolDoc/DocTerm.HC.HTML +++ /dev/null @@ -1,225 +0,0 @@ - - - - - DocTerm.HC - - - - - #help_index "DolDoc/Task;StdOut/Task"
-public CDoc *DocBorderNew(CDoc *pdoc)
-{//Make new std border doc.
- CDocEntry *doc_e;
- CDoc *bdoc;
-
- bdoc=DocNew;
- bdoc->flags|=DOCF_BORDER_DOC;
- if (pdoc) {
- DocPrint(bdoc,"$CM+H+BY+RX+NC,-7,1$");
- doc_e=DocPrint(bdoc,"$TX+H+BD+TC,\" \"$");
- doc_e->user_data=pdoc;
- doc_e->tag_cb=&EdFilterCB;
- doc_e=DocPrint(bdoc,"$TX+H+BD+TC,\" \"$");
- doc_e->user_data=pdoc;
- doc_e->tag_cb=&EdOverStrikeCB;
- doc_e=DocPrint(bdoc,"$TX+H+BD+TC,\" \"$");
- doc_e->user_data=pdoc;
- doc_e->tag_cb=&EdDollarCB;
- DocPrint(bdoc,"$CM+H+BY+RX+NC,-18,1$");
- doc_e=DocPrint(bdoc,"$TX+BD+TC,\" \"$");
- doc_e->user_data=pdoc;
- doc_e->tag_cb=&EdMoreCB;
- doc_e=DocPrint(bdoc,"$TX+H+BD+TC,\" \"$");
- doc_e->user_data=pdoc;
- doc_e->tag_cb=&EdDollarTypeCB;
- }
- DocPrint(bdoc,"$CM+H+TY+NC,0,-1$");
- doc_e=DocPrint(bdoc,"$DA+H-TRM-P+BD+RD+CX+IV,LEN=STR_LEN-1,"
- "A=\"%%s...\",SCX=15$");
- doc_e->data=&Fs->task_title;
- DocDataFmt(bdoc,doc_e);
- DocPrint(bdoc,"$CM+H+NC,1,0$$TX+H+BD+IV,\"%X\"$",Fs);
- DocPrint(bdoc,"$TX+H+RX+BD,\"[X]\"$");
- DocPrint(bdoc,"$BK,1$$TX+H+LX+BD,\"MENU\"$$BK,0$");
- return bdoc;
-}
-
-public U0 DocTermNew()
-{//Make into term win task with Put/Display/Border docs.
- CDoc *pdoc=DocNew;
- pdoc->right_click_link=&TermRightClickLink;
- pdoc->max_entries=4096;
- Fs->border_src=BDS_CUR_DRV;
- pdoc->desc='Term';
- Fs->put_doc=Fs->display_doc=pdoc;
- Fs->border_doc=DocBorderNew(pdoc);
- Fs->cur_menu=MenuFile("::/Doc/EdPullDown.DD");
- WinScrollsInit(Fs);
- Raw(OFF);
-}
-
-#help_index "DolDoc"
-
-#define RIGHT_INCLUDE 0
-#define RIGHT_AINCLUDE 1
-#define RIGHT_COPY 2
-#define RIGHT_MOVE 3
-#define RIGHT_DELETE 4
-#define RIGHT_TYPE 5
-#define RIGHT_ED 6
-#define RIGHT_MOUNT 7
-#define RIGHT_PLAIN 8
-#define RIGHT_INFILE 9
-
-I64 PopUpTermRight(U8 *header)
-{
- I64 i;
- CDoc *doc=DocNew;
- if (header) DocPrint(doc,"%s",header);
- DocPrint(doc,"\n\n"
- "TXT=%s\nDD=%s\nJIT=%s\nGR=%s"
- "$CM+LX,1,3 $$BT,\"IncludeJIT\",LE=RIGHT_INCLUDE$"
- "$CM+LX,25,0$$BT,\"Adam IncludeJIT\",LE=RIGHT_AINCLUDE$"
- "$CM+LX,1,3 $$BT,\"Copy\",LE=RIGHT_COPY$"
- "$CM+LX,25,0$$BT,\"Moveor Rename\",LE=RIGHT_MOVE$"
- "$CM+LX,1,3 $$BT,\"Delete\",LE=RIGHT_DELETE$"
- "$CM+LX,25,0$$BT,\"TypeTXT;GR\",LE=RIGHT_TYPE$"
- "$CM+LX,1,3 $$BT,\"DolDocEditDD\",LE=RIGHT_ED$"
- "$CM+LX,25,0$$BT,\"MountISO.C\",LE=RIGHT_MOUNT$"
- "$CM+LX,1,3 $$BT,\"PlainText EditTXT\",LE=RIGHT_PLAIN$"
- "$CM+LX,25,0$$BT,\"InfileIN\",LE=RIGHT_INFILE$"
- "$CM+LX,1,3 $$BT,\"Cancel\",LE=DOCM_CANCEL$\n",
- FILEMASK_TXT,FILEMASK_DD,FILEMASK_JIT,FILEMASK_GR);
- i=PopUpMenu(doc);
- DocDel(doc);
- return i;
-}
-
-I64 EdLeftClickLink(CDoc *doc,CDocEntry *doc_e)
-{//Called with doc locked, exit unlocked
- Bool res;
- U8 *st;
- if (st=DocEntryLink(doc,doc_e)) {
- DocUnlock(doc);
- if (doc_e->de_flags & DOCEF_POPUP)
- res=PopUpEd(st);
- else
- res=Ed(st);
- Free(st);
- return res;
- }
-}
-
-I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e)
-{//Called with doc locked, exit unlocked
- Bool send_new_line=FALSE,res=FALSE;
- U8 *st,*st2;
- I64 i;
- CEdFileName fn;
- if (st2=DocEntryLink(doc,doc_e)) {
- if (st=DocLinkFile(st2)) {
- DocUnlock(doc);
- if ((i=PopUpTermRight(st))>=0) {
- DocBottom(doc);
- switch (i) {
- case RIGHT_INCLUDE:
- if (FileExtDot(st) && !FilesFindMatch(st,FILEMASK_JIT)) {
- if (!PopUpCancelOk(ST_WARN_ST "Not .HC File\n\n")) {
- send_new_line=TRUE;
- break;
- }
- }
- "#include \"%s\";\n$PT$$FG$$BG$",st;
- WinZBufUpdate;
- ExeFile(st,CCF_CMD_LINE);
- res=TRUE;
- break;
- case RIGHT_AINCLUDE:
- if (FileExtDot(st) && !FilesFindMatch(st,FILEMASK_JIT)) {
- if (!PopUpCancelOk(ST_WARN_ST "Not .HC File\n\n")) {
- send_new_line=TRUE;
- break;
- }
- }
- "Adam(\"#include \\\"%s\\\"\" );\n$PT$$FG$$BG$",st;
- WinZBufUpdate;
- AdamFile(st,FALSE);
- res=TRUE;
- break;
- case RIGHT_COPY:
- StrCpy(fn.name,st);
- if (DocForm(&fn)) {
- res=ToBool(Copy(st,fn.name));
- } else
- send_new_line=TRUE;
- break;
- case RIGHT_MOVE:
- StrCpy(fn.name,st);
- if (DocForm(&fn))
- res=Move(st,fn.name);
- else
- send_new_line=TRUE;
- break;
- case RIGHT_DELETE:
- res=ToBool(Del(st));
- break;
- case RIGHT_TYPE:
- res=Type(st);
- break;
- case RIGHT_ED:
- if (FileExtDot(st) && !FilesFindMatch(st,FILEMASK_DD)) {
- if (!PopUpCancelOk(ST_WARN_ST "Not DolDoc File\n\n")) {
- send_new_line=TRUE;
- break;
- }
- }
- "Ed(\"%s\");\n$PT$$FG$$BG$",st;
- res=Ed(st);
- break;
- case RIGHT_MOUNT:
- if (FileExtDot(st) && !FilesFindMatch(st,"*.ISO.C")) {
- if (!PopUpCancelOk(ST_WARN_ST "Not .ISO.C File\n\n")) {
- send_new_line=TRUE;
- break;
- }
- }
- "MountFile(\"%s\");\n$PT$$FG$$BG$",st;
- WinZBufUpdate;
- MountFile(st);
- res=TRUE;
- break;
- case RIGHT_PLAIN:
- "Plain(\"%s\");\n$PT$$FG$$BG$",st;
- res=Plain(st);
- break;
- case RIGHT_INFILE:
- if (FileExtDot(st) && !FilesFindMatch(st,"*.IN*")) {
- if (!PopUpCancelOk(ST_WARN_ST "Not .IN File\n\n")) {
- send_new_line=TRUE;
- break;
- }
- }
- "InFile(\"%s\");\n$PT$$FG$$BG$",st;
- WinZBufUpdate;
- InFile(st);
- res=TRUE;
- break;
- }
- } else
- send_new_line=TRUE;
- Free(st);
- } else
- send_new_line=TRUE;
- Free(st2);
- } else
- send_new_line=TRUE;
- DocBottom(doc);
- "$PT$$FG$$BG$";
- if (send_new_line)
- '\n';
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocTree.HC.HTML b/public/src/Adam/DolDoc/DocTree.HC.HTML deleted file mode 100644 index 45263cb..0000000 --- a/public/src/Adam/DolDoc/DocTree.HC.HTML +++ /dev/null @@ -1,255 +0,0 @@ - - - - - DocTree.HC - - - - - #help_index "DolDoc/Tree"
-
-public Bool DocTreeFind(CDoc *haystack_doc,U8 *needle_path,
- CDocEntry **_tree_entry=NULL,
- CDocEntry **_start_indent=NULL, CDocEntry **_end_indent=NULL)
-{//Find tree widget start and end.
- I64 i=0,k=0;
- U8 *st1=StrNew(needle_path),*st2=MAlloc(StrLen(needle_path)+1);
- Bool res=FALSE,unlock_doc=DocLock(haystack_doc);
- CDocEntry *doc_e=haystack_doc->head.next;
- if (_tree_entry) *_tree_entry=haystack_doc;
- if (_start_indent) *_start_indent=haystack_doc;
- if (_end_indent) *_end_indent=haystack_doc;
- while (*st1 && doc_e!=haystack_doc) {
- StrFirstRem(st1,"/",st2);
- if (*st2) {
- while (doc_e!=haystack_doc) {
- if (doc_e->type_u8==DOCT_INDENT)
- i+=doc_e->attr;
- else if (i==k && doc_e->de_flags&DOCEF_TREE &&
- !StrCmp(doc_e->tag+3,st2)) {
- if (*st1)
- break;
- else {
- if (_tree_entry) *_tree_entry=doc_e;
- i=0;
- while (doc_e!=haystack_doc && doc_e->type_u8!=DOCT_INDENT)
- doc_e=doc_e->next;
- if (doc_e!=haystack_doc) {
- i=doc_e->attr;
- if (_start_indent) *_start_indent=doc_e;
- doc_e=doc_e->next;
- while (doc_e!=haystack_doc && i>0) {
- if (doc_e->type_u8==DOCT_INDENT) {
- i+=doc_e->attr;
- if (i<=0) {
- if (_end_indent) *_end_indent=doc_e;
- res=TRUE;
- break;
- }
- }
- doc_e=doc_e->next;
- }
- }
- goto ft_done;
- }
- }
- doc_e=doc_e->next;
- }
- k+=2;
- }
- }
-ft_done:
- if (unlock_doc)
- DocUnlock(haystack_doc);
- Free(st1);
- Free(st2);
- return res;
-}
-
-public Bool DocTreeFFind(U8 *name,U8 *path)
-{//Find tree widget in file.
- CDoc *doc=DocRead(name);
- Bool res=DocTreeFind(doc,path);
- DocDel(doc);
- return res;
-}
-
-public Bool DocTreeMake(CDoc *doc,U8 *path)
-{//Make tree widget.
- I64 i=0,j=I64_MIN,k=0;
- U8 *st1=StrNew(path),
- *st2=MAlloc(StrLen(path)+1),
- *st3=StrNew(path);
- Bool res=TRUE,unlock_doc=DocLock(doc);
- CDocEntry *doc_e=doc->head.next;
- doc->cur_entry=doc;
- doc->cur_col=0;
- while (*st1 && doc_e!=doc) {
- StrFirstRem(st1,"/",st2);
- if (*st2) {
- while (doc_e!=doc) {
- if (doc_e->type_u8==DOCT_INDENT) {
- i+=doc_e->attr;
- if (i==j) {
- doc->cur_entry=doc_e;
- doc->cur_col=0;
- goto mt_done;
- }
- } else if (i==k && doc_e->de_flags&DOCEF_TREE &&
- !StrCmp(doc_e->tag+3,st2)) {
- Free(st3);
- st3=StrNew(st1);
- j=i;
- if (!*st1)
- res=FALSE;
- else
- break;
- }
- doc_e=doc_e->next;
- }
- k+=2;
- }
- }
-mt_done:
- if (res) {
- while (*st3) {
- StrFirstRem(st3,"/",st2);
- if (*st2) {
- DocPrint(doc,"$TR+C,\"%s\"$\n$
$",st2);
- doc->cur_entry=DocPrint(doc,"$
$");
- doc->cur_col=0;
- }
- }
- }
- if (unlock_doc)
- DocUnlock(doc);
- Free(st1);
- Free(st2);
- Free(st3);
- return res;
-}
-
-Bool DocTreeWriteJoin(CDoc *doc,U8 *path,Bool write,U8 *fmt,I64 argc,I64 *argv)
-{//Rewrite doc tree branch.
- CDocEntry *tree_branch,*start_indent,*end_indent;
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
- Bool res,unlock_doc=DocLock(doc);
- if (res=DocTreeFind(doc,path,
- &tree_branch,&start_indent,&end_indent)) {
- DocCut(doc,start_indent->next,end_indent->last);
- doc->cur_entry=start_indent->next;
- doc->cur_col=doc->cur_entry->min_col;
- } else
- DocTreeMake(doc,path);
- DocPrint(doc,"%s",buf);
- if (write && DrvIsWritable(*doc->filename.name))
- DocWrite(doc);
- if (unlock_doc)
- DocUnlock(doc);
- Free(buf);
- return res;
-}
-
-Bool DocTreeAppendJoin(CDoc *doc,U8 *path,Bool write,U8 *fmt,I64 argc,I64 *argv)
-{//Append to doc tree branch.
- CDocEntry *tree_branch,*start_indent,*end_indent;
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
- Bool res,unlock_doc=DocLock(doc);
- if (res=DocTreeFind(doc,path,
- &tree_branch,&start_indent,&end_indent)) {
- doc->cur_entry=end_indent;
- doc->cur_col=doc->cur_entry->min_col;
- } else
- DocTreeMake(doc,path);
- DocPrint(doc,"%s",buf);
- if (write && DrvIsWritable(*doc->filename.name))
- DocWrite(doc);
- if (unlock_doc)
- DocUnlock(doc);
- Free(buf);
- return res;
-}
-
-public Bool DocTreeWrite(CDoc *doc,U8 *path,Bool write=TRUE,U8 *fmt,...)
-{//Rewrite doc tree branch.
- return DocTreeWriteJoin(doc,path,write,fmt,argc,argv);
-}
-
-public Bool DocTreeAppend(CDoc *doc,U8 *path,Bool write=TRUE,U8 *fmt,...)
-{//Append to doc tree branch.
- return DocTreeAppendJoin(doc,path,write,fmt,argc,argv);
-}
-
-public Bool DocTreeFWrite(U8 *name,U8 *path,U8 *fmt,...)
-{//Rewrite doc tree branch in file.
- CDoc *doc=DocRead(name);
- Bool res=DocTreeWriteJoin(doc,path,TRUE,fmt,argc,argv);
- DocDel(doc);
- return res;
-}
-
-public Bool DocTreeFAppend(U8 *name,U8 *path,U8 *fmt,...)
-{//Append to doc tree branch in file.
- CDoc *doc=DocRead(name);
- Bool res=DocTreeAppendJoin(doc,path,TRUE,fmt,argc,argv);
- DocDel(doc);
- return res;
-}
-
-#help_index "DolDoc/Compiler;Compiler"
-public I64 ExeDoc(CDoc *doc,I64 ccf_flags=0)
-{//JIT Compile and execute a document.
- I64 res;
- Bool okay=TRUE,unlock_doc=DocLock(doc);
- CCmpCtrl *cc=CmpCtrlNew(,ccf_flags|CCF_DONT_FREE_BUF);
- if (Fs->last_cc!=&Fs->next_cc)
- cc->opts=Fs->last_cc->opts;
- QueIns(cc,Fs->last_cc);
- LexAttachDoc(cc,,doc);
- try {
- Lex(cc);
- res=ExeCmdLine(cc);
- } catch {
- if (Fs->except_ch=='Compiler' || Fs->except_ch=='Break') {
- Fs->catch_except=TRUE;
- okay=FALSE;
- res=0;
- }
- }
- QueRem(cc);
- if (okay)
- CmpCtrlDel(cc); //TODO: can crash
- if (unlock_doc)
- DocUnlock(doc);
- return res;
-}
-
-#help_index "DolDoc/Tree;DolDoc/Compiler;Compiler"
-public I64 DocTreeExe(CDoc *doc,U8 *path)
-{//Execute doc tree branch.
- CDoc *doc2;
- Bool unlock_doc=DocLock(doc);
- CDocEntry *tree_branch,*start_indent,*end_indent;
- I64 res=0;
- if (DocTreeFind(doc,path,&tree_branch,&start_indent,&end_indent)) {
- doc2=DocCopy(doc,tree_branch,end_indent);
- res=ExeDoc(doc2);
- DocDel(doc2);
- }
- if (unlock_doc)
- DocUnlock(doc);
- return res;
-}
-
-public I64 DocTreeFExe(U8 *name,U8 *path)
-{//Execute doc tree branch in file.
- I64 res;
- CDoc *doc=DocRead(name);
- res=DocTreeExe(doc,path);
- DocDel(doc);
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/DocWidgetWiz.HC.HTML b/public/src/Adam/DolDoc/DocWidgetWiz.HC.HTML deleted file mode 100644 index 5658a67..0000000 --- a/public/src/Adam/DolDoc/DocWidgetWiz.HC.HTML +++ /dev/null @@ -1,1175 +0,0 @@ - - - - - DocWidgetWiz.HC - - - - - #help_index "DolDoc/Misc"
-
-U8 *ctrl_L_footer=
- "\n$MU-X+Q,\"Abort\",LE=DOCM_CANCEL$\n"
- "\n\n$LK+PU,\"Click for Help\",A=\"FI:::/Doc/Widget.DD\"$\n";
-
-I64 PopUpLinkType(Bool include_anchor)
-{
- I64 i;
- CDoc *doc=DocNew;
- DocPrint(doc,"$PURPLE$$TX+CX,\"Link Type Menu\"$\n"
- "\n$LTBLUE$$MU,\"To file\",LE=LK_FILE$\n"
- "$MU,\"To anchor in file\",LE=LK_FILE_ANCHOR$\n"
- "$MU,\"To str in file\",LE=LK_FILE_FIND$\n"
- "$MU,\"To line in file\",LE=LK_FILE_LINE$\n"
- "$MU,\"To man page\",LE=LK_MAN_PAGE$\n"
- "$MU,\"To plain-text file\",LE=LK_PLAIN$\n"
- "$MU,\"To str in plain-text file\",LE=LK_PLAIN_FIND$\n"
- "$MU,\"To line in plain-text file\",LE=LK_PLAIN_LINE$\n"
- "$MU,\"To Bible chapter line and verse\",LE=LK_BIBLE_FIND$\n"
- "$MU,\"To Dictionary Definition\",LE=LK_DEF$\n"
- "$MU,\"To Help Index\",LE=LK_HELP_INDEX$\n"
- "$MU,\"To Addr\",LE=LK_ADDR$\n");
- if (include_anchor)
- DocPrint(doc,"$MU,\"Place Anchor\",LE=LK_PLACE_ANCHOR$\n");
- DocPrint(doc,"%s",ctrl_L_footer);
- i=PopUpMenu(doc);
- DocDel(doc);
- return i;
-}
-
-class CEdFileLink
-{
- U8 tag[512] format "$DA-P,A=\"Tag Text:%s\"$\n",
- file[512] format "$DA-P,A=\"File:%s\"$\n";
- I64 book;
- U8 aux[512];
- I64 num;
- U8 html_link[512] format "$DA-P,A=\"Html Link:%s\"$\n";
- Bool pop_up format "$CB,\"PopUp\"$\n",
- quote format "$CB,\"Quote\"$\n",
- hide;
-};
-
-class CEdFileAnchorLink
-{
- U8 tag[512] format "$DA-P,A=\"Tag Text:%s\"$\n",
- file[512] format "$DA-P,A=\"File:%s\"$\n";
- I64 book;
- U8 aux[512] format "$DA-P,A=\"Anchor Label:%s\"$\n";
- I64 num;
- U8 html_link[512] format "$DA-P,A=\"Html Link:%s\"$\n";
- Bool pop_up format "$CB,\"PopUp\"$\n",
- quote format "$CB,\"Quote\"$\n",
- hide;
-};
-
-class CEdFileFindLink
-{
- U8 tag[512] format "$DA-P,A=\"Tag Text:%s\"$\n",
- file[512] format "$DA-P,A=\"File:%s\"$\n";
- I64 book;
- U8 aux[512] format "$DA-P,A=\"Str:%s\"$\n";
- I64 num format "$DA-TRM,A=\"Occurrence Num:%04d\"$\n";
- U8 html_link[512] format "$DA-P,A=\"Html Link:%s\"$\n";
- Bool pop_up format "$CB,\"PopUp\"$\n",
- quote format "$CB,\"Quote\"$\n",
- hide;
-};
-
-class CEdFileLineLink
-{
- U8 tag[512] format "$DA-P,A=\"Tag Text:%s\"$\n",
- file[512] format "$DA-P,A=\"File:%s\"$\n";
- I64 book;
- U8 aux[512];
- I64 num format "$DA-TRM,A=\"Line Num:%04d\"$\n";
- U8 html_link[512] format "$DA-P,A=\"Html Link:%s\"$\n";
- Bool pop_up format "$CB,\"PopUp\"$\n",
- quote format "$CB,\"Quote\"$\n",
- hide;
-};
-
-class CEdManPageLink
-{
- U8 tag[512] format "$DA-P,A=\"Tag Text:%s\"$\n",
- file[512];
- I64 book;
- U8 aux[512] format "$DA-P,A=\"Label:%s\"$\n";
- I64 num;
- U8 html_link[512] format "$DA-P,A=\"Html Link:%s\"$\n";
- Bool pop_up format "$CB,\"PopUp\"$\n",
- quote format "$CB,\"Quote\"$\n",
- hide;
-};
-
-class CEdAddrLink
-{
- U8 tag[512] format "$DA-P,A=\"Tag Text:%s\"$\n",
- file[512];
- I64 book;
- U8 aux[512] format "$DA-P,A=\"Addr Exp:%s\"$\n";
- I64 num format "$DA-TRM,A=\"Bin Size:%04d\"$\n";
- U8 html_link[512] format "$DA-P,A=\"Html Link:%s\"$\n";
- Bool pop_up format "$CB,\"PopUp\"$\n",
- quote format "$CB,\"Quote\"$\n",
- hide;
-};
-
-class CEdPlaceAnchor
-{
- U8 tag[512] format "$DA-P,A=\"Tag Text:%s\"$\n",
- file[512];
- I64 book;
- U8 aux[512] format "$DA-P,A=\"Anchor Label:%s\"$\n";
- I64 num;
- U8 html_link[512] format "$DA-P,A=\"Html Link:%s\"$\n";
- Bool pop_up,
- quote format "$CB,\"Quote\"$\n",
- hide format "$CB,\"Hide\"$\n";
-};
-
-class CEdBibleLink
-{
- U8 tag[512] format "$DA-P,A=\"Tag Text:%s\"$\n",
- file[512];
- I64 book format "$LS,D=\"ST_BIBLE_BOOKS\"$\n";
- U8 aux[512] format "$DA-P,A=\"Chapter Verse:%s\"$\n";
- I64 num;
-
- U8 html_link[512] format "$DA-P,A=\"Html Link:%s\"$\n";
- Bool pop_up format "$CB,\"PopUp\"$\n",
- quote format "$CB,\"Quote\"$\n",
- hide;
-};
-
-class CEdDefLink
-{
- U8 tag[512] format "$DA-P,A=\"Tag Text:%s\"$\n",
- file[512];
- I64 book;
- U8 aux[512] format "$DA-P,A=\"Word:%s\"$\n";
- I64 num format "$DA-TRM,A=\"Def Num:%4d\"$\n";
- U8 html_link[512] format "$DA-P,A=\"Html Link:%s\"$\n";
- Bool pop_up format "$CB,\"PopUp\"$\n",
- quote format "$CB,\"Quote\"$\n",
- hide;
-};
-
-class CEdProject
-{
- U8 tag[512] format "$DA-P,A=\"Tag Text:%s\"$\n",
- file[512] format "$DA-P,A=\"File:%s\"$\n";
- I64 book;
- U8 aux[512];
- I64 num;
- U8 html_link[512] format "$DA-P,A=\"Html Link:%s\"$\n";
- Bool pop_up format "$CB,\"PopUp\"$\n",
- quote format "$CB,\"Quote\"$\n",
- hide;
-};
-
-Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
- Bool *_quote,U8 **_html_link)
-{
- CEdFileLink *e=CAlloc(sizeof(CEdFileLink));
- Bool res=FALSE;
- if (type>=0) {
- e->num=1;
- switch (type) {
- case LK_FILE:
- if (DocForm(e,,,,ctrl_L_footer)) {
- res=TRUE;
- if (!*e->tag)
- *_tag=StrNew(e->file);
- else
- *_tag=StrNew(e->tag);
- *_link=MStrPrint("FI:%s",e->file);
- }
- break;
- case LK_PLAIN:
- if (DocForm(e,,,,ctrl_L_footer)) {
- res=TRUE;
- if (!*e->tag)
- *_tag=StrNew(e->file);
- else
- *_tag=StrNew(e->tag);
- *_link=MStrPrint("PI:%s",e->file);
- }
- break;
- case LK_FILE_ANCHOR:
- if (DocForm(e,"CEdFileAnchorLink",,,ctrl_L_footer)) {
- res=TRUE;
- if (!*e->tag)
- *_tag=StrNew(e->aux);
- else
- *_tag=StrNew(e->tag);
- *_link=MStrPrint("FA:%s,%s",e->file,e->aux);
- }
- break;
- case LK_FILE_FIND:
- if (DocForm(e,"CEdFileFindLink",,,ctrl_L_footer)) {
- res=TRUE;
- if (e->num==1) {
- if (!*e->tag)
- *_tag=StrNew(e->aux);
- else
- *_tag=StrNew(e->tag);
- *_link=MStrPrint("FF:%s,%s",e->file,e->aux);
- } else {
- if (!*e->tag)
- *_tag=StrNew(e->aux);
- else
- *_tag=StrNew(e->tag);
- *_link=MStrPrint("FF:%s,%s:%d",e->file,e->aux,e->num);
- }
- }
- break;
- case LK_PLAIN_FIND:
- if (DocForm(e,"CEdFileFindLink",,,ctrl_L_footer)) {
- res=TRUE;
- if (e->num==1) {
- if (!*e->tag)
- *_tag=StrNew(e->aux);
- else
- *_tag=StrNew(e->tag);
- *_link=MStrPrint("PF:%s,%s",e->file,e->aux);
- } else {
- if (!*e->tag)
- *_tag=StrNew(e->aux);
- else
- *_tag=StrNew(e->tag);
- *_link=MStrPrint("PF:%s,%s:%d",e->file,e->aux,e->num);
- }
- }
- break;
- case LK_FILE_LINE:
- if (DocForm(e,"CEdFileLineLink",,,ctrl_L_footer)) {
- res=TRUE;
- if (!*e->tag)
- *_tag=StrNew(e->file);
- else
- *_tag=StrNew(e->tag);
- *_link=MStrPrint("FL:%s,%d",e->file,e->num);
- }
- break;
- case LK_PLAIN_LINE:
- if (DocForm(e,"CEdFileLineLink",,,ctrl_L_footer)) {
- res=TRUE;
- if (!*e->tag)
- *_tag=StrNew(e->file);
- else
- *_tag=StrNew(e->tag);
- *_link=MStrPrint("PL:%s,%d",e->file,e->num);
- }
- break;
- case LK_MAN_PAGE:
- if (DocForm(e,"CEdManPageLink",,,ctrl_L_footer)) {
- res=TRUE;
- if (!*e->tag)
- *_tag=StrNew(e->aux);
- else
- *_tag=StrNew(e->tag);
- *_link=MStrPrint("MN:%s",e->aux);
- }
- break;
- case LK_PLACE_ANCHOR:
- if (DocForm(e,"CEdPlaceAnchor",,,ctrl_L_footer)) {
- res=TRUE;
- if (!*e->tag) {
- if (e->hide)
- *_tag=StrNew("");
- else
- *_tag=StrNew(e->aux);
- } else
- *_tag=StrNew(e->tag);
- *_link=StrNew(e->aux);
- }
- break;
- case LK_BIBLE_FIND:
- if (DocForm(e,"CEdBibleLink",,,ctrl_L_footer)) {
- res=TRUE;
- if (!*e->tag)
- *_tag=MStrPrint("%Z,%s",e->book,"ST_BIBLE_BOOKS",e->aux);
- else
- *_tag=StrNew(e->tag);
- *_link=MStrPrint("BF:%Z,%s",e->book,"ST_BIBLE_BOOKS",e->aux);
- }
- break;
- case LK_DEF:
- e->num=-1;
- if (DocForm(e,"CEdDefLink",,,ctrl_L_footer)) {
- res=TRUE;
- if (!*e->tag)
- *_tag=StrNew(e->aux);
- else
- *_tag=StrNew(e->tag);
- if (e->num<0)
- *_link=MStrPrint("DN:%s",e->aux);
- else
- *_link=MStrPrint("DN:%s,%d",e->aux,e->num);
-
- }
- break;
- case LK_HELP_INDEX:
- if (DocForm(e,"CEdManPageLink",,,ctrl_L_footer)) {
- res=TRUE;
- if (!*e->tag)
- *_tag=StrNew(e->aux);
- else
- *_tag=StrNew(e->tag);
- *_link=MStrPrint("HI:%s",e->aux);
- }
- break;
- case LK_ADDR:
- e->num=DFT_ADDR_LINK_BIN_SIZE;
- if (DocForm(e,"CEdAddrLink",,,ctrl_L_footer)) {
- res=TRUE;
- if (e->num==DFT_ADDR_LINK_BIN_SIZE) {
- if (!*e->tag)
- *_tag=StrNew(e->aux);
- else
- *_tag=StrNew(e->tag);
- *_link=MStrPrint("AD:%s",e->aux);
- } else {
- if (!*e->tag)
- *_tag=MStrPrint("%s,%d",e->aux,e->num);
- else
- *_tag=StrNew(e->tag);
- *_link=MStrPrint("AD:%s,%d",e->aux,e->num);
- }
- }
- break;
- }
- }
- if (*e->html_link)
- *_html_link=StrNew(e->html_link);
- else
- *_html_link=NULL;
- if (e->pop_up)
- *_pop_up=TRUE;
- else
- *_pop_up=FALSE;
- if (e->quote)
- *_quote=TRUE;
- else
- *_quote=FALSE;
- Free(e);
- return res;
-}
-
-U0 EdInsLink()
-{
- U8 *tag=NULL,*link=NULL,*st=NULL,*html_link=NULL,*pop_up_st;
- Bool pop_up=FALSE,quote=FALSE;
- I64 type=PopUpLinkType(TRUE);
- if (type>=0) {
- if (GetLink(type,&tag,&link,&pop_up,&quote,&html_link)) {
- if (pop_up)
- pop_up_st="+PU";
- else
- pop_up_st="";
- switch (type) {
- case LK_PLACE_ANCHOR:
- if (html_link)
- st=MStrPrint("$AN,\"%$Q\",A=\"%$Q\",HTML=\"%$Q\"$",
- tag,link,html_link);
- else
- st=MStrPrint("$AN,\"%$Q\",A=\"%$Q\"$",tag,link);
- break;
- default:
- if (html_link)
- st=MStrPrint("$LK%s,\"%$Q\",A=\"%$Q\",HTML=\"%$Q\"$",
- pop_up_st,tag,link,html_link);
- else
- st=MStrPrint("$LK%s,\"%$Q\",A=\"%$Q\"$",pop_up_st,tag,link);
- }
- }
- }
- if (st) {
- if (quote)
- "%$Q",st;
- else
- "%s",st;
- }
- Free(tag);
- Free(link);
- Free(html_link);
- Free(st);
-}
-
-I64 PopUpColorType()
-{
- I64 i;
- CDoc *doc=DocNew;
- DocPrint(doc,"$PURPLE$$TX+CX,\"Color Type Menu\"$\n"
- "\n$LTBLUE$$MU,\"Foreground\",LE=DOCT_FOREGROUND$\n"
- "$MU,\"Background\",LE=DOCT_BACKGROUND$\n"
- "$MU,\"Default Foreground\",LE=DOCT_DFT_FOREGROUND$\n"
- "$MU,\"Default Background\",LE=DOCT_DFT_BACKGROUND$\n"
- "%s",ctrl_L_footer);
- i=PopUpMenu(doc);
- DocDel(doc);
- return i;
-}
-
-I64 PopUpPageSettingType()
-{
- I64 i;
- CDoc *doc=DocNew;
- DocPrint(doc,"$PURPLE$$TX+CX,\"Page Setting Menu\"$\n"
- "\n$LTBLUE$$MU,\"Page Length\",LE=DOCT_PAGE_LEN$\n"
- "$MU,\"Page Header\",LE=DOCT_HEADER$\n"
- "$MU,\"Page Footer\",LE=DOCT_FOOTER$\n"
- "$MU,\"Left Margin\",LE=DOCT_LEFT_MARGIN$\n"
- "$MU,\"Right Margin\",LE=DOCT_RIGHT_MARGIN$\n"
- "%s",ctrl_L_footer);
- i=PopUpMenu(doc);
- DocDel(doc);
- return i;
-}
-
-U0 EdInsColor()
-{
- I64 type=PopUpColorType,col=DOC_DFT;
- if (type>=0) {
- col=PopUpColor(,FALSE);
- if (col==DOC_DFT)
- "$%Z$",type,"ST_DOC_CMDS";
- else if (col>=0)
- "$%Z,%d$",type,"ST_DOC_CMDS",col;
- }
-}
-
-class CEdPageSetting1
-{
- U8 val[512] format "$DA-P,A=\"Setting Val:%s\"$\n";
- Bool winrel;
-};
-
-class CEdPageSetting2
-{
- U8 val[512] format "$DA-P,A=\"Setting Val:%s\"$\n";
- Bool winrel format "$CB,\"Win Relative\"$\n";
-};
-
-U0 EdInsPageSetting()
-{
- I64 type=PopUpPageSettingType;
- CEdPageSetting1 *e=CAlloc(sizeof(CEdPageSetting1));
- if (type>=0) {
- if (type==DOCT_RIGHT_MARGIN||type==DOCT_PAGE_LEN) {
- if (DocForm(e(CEdPageSetting2 *))) {
- if (e->winrel) {
- if (*e->val)
- "$%Z+WR,%s$",type,"ST_DOC_CMDS",e->val;
- else
- "$%Z+WR,0$",type,"ST_DOC_CMDS";
- } else {
- if (*e->val)
- "$%Z,%s$",type,"ST_DOC_CMDS",e->val;
- else
- "$%Z$",type,"ST_DOC_CMDS";
- }
- }
- } else {
- if (DocForm(e)) {
- if (*e->val)
- "$%Z,%s$",type,"ST_DOC_CMDS",e->val;
- else
- "$%Z$",type,"ST_DOC_CMDS";
- }
- }
- }
- Free(e);
-}
-
-#define WIZ_HIGHLIGHT_ON (DOCT_ERROR+1)
-#define WIZ_HIGHLIGHT_OFF (DOCT_ERROR+2)
-
-I64 PopUpWidgetType()
-{
- I64 i;
- CDoc *doc=DocNew;
- DocPrint(doc,"$PURPLE$$TX+CX,\"Text Widgets Menu\"$\n"
- "\n$LTBLUE$$MU,\"Link\",LE=DOCT_LINK$\n"
- "$MU,\"Text\",LE=DOCT_TEXT$\n"
- "$MU,\"Tree Branch\",LE=DOCT_TREE$\n"
- "$MU,\"Color\",LE=DOCT_FOREGROUND$\n"
- "$MU,\"Page Settings\",LE=DOCT_PAGE_LEN$\n"
- "$MU,\"Cursor Movement\",LE=DOCT_CURSOR_MOVEMENT$\n"
- "$MU,\"Macro\",LE=DOCT_MACRO$\n"
- "$MU,\"Bttn\",LE=DOCT_BTTN$\n"
- "$MU,\"Check Box\",LE=DOCT_CHECK_BOX$\n"
- "$MU,\"List\",LE=DOCT_LST$\n"
- "$MU,\"Menu Val\",LE=DOCT_MENU_VAL$\n"
- "$MU,\"Data\",LE=DOCT_DATA$\n"
- "$MU,\"Hex Edit\",LE=DOCT_HEX_ED$\n"
- "$MU,\"Syntax Highlight ON\",LE=WIZ_HIGHLIGHT_ON$\n"
- "$MU,\"Syntax Highlight OFF\",LE=WIZ_HIGHLIGHT_OFF$\n"
- "$MU,\"HTML\",LE=DOCT_HTML_CODE$\n"
- "$MU,\"Song\",LE=DOCT_SONG$\n"
- "%s",ctrl_L_footer);
- i=PopUpMenu(doc);
- DocDel(doc);
- return i;
-}
-
-class CEdText
-{
- U8 tag[512] format "$DA-P,A=\"Tag Text:%s\"$\n";
- Bool left_x format "$CB,\"Left X\"$\n",
- center_x format "$CB,\"Center X\"$\n",
- right_x format "$CB,\"Right X\"$\n",
- margin_rel format "$CB,\"Margin Rel X\"$\n",
- blink format "$CB,\"Blink\"$\n",
- invert format "$CB,\"Invert\"$\n",
- underline format "$CB,\"Underline\"$\n",
- tree format "$CB,\"Tree\"$\n",
- collapsed format "$CB,\"Collapsed\"$\n";
- U8 scroll_x [512] format "$DA-P,A=\"Scroll X Length Expression:%s\"$\n",
- shift_x [512] format "$DA-P,A=\"X Offset Expression:%s\"$\n",
- shift_y [512] format "$DA-P,A=\"Y Offset Expression:%s\"$\n",
- define_str[512] format "$DA-P,A=\"Define Str:%s\"$\n",
- html_link[512] format "$DA-P,A=\"Html Link:%s\"$\n";
-};
-
-U0 EdInsText()
-{
- U8 *st,buf[512];
- CEdText *e=CAlloc(sizeof(CEdText));
- if (DocForm(e,,,,ctrl_L_footer)) {
- *buf=0;
- if (e->left_x ) CatPrint(buf,"+LX");
- if (e->center_x) CatPrint(buf,"+CX");
- if (e->right_x ) CatPrint(buf,"+RX");
- if (e->margin_rel) CatPrint(buf,"+MRX");
- if (e->blink) CatPrint(buf,"+BK");
- if (e->invert) CatPrint(buf,"+IV");
- if (e->underline) CatPrint(buf,"+UL");
- if (e->tree) CatPrint(buf,"+TR");
- if (e->collapsed) CatPrint(buf,"+C");
- st=MStrPrint("%q",e->tag);
- "$TX%s,\"%$Q\"",buf,st;
- Free(st);
- if (*e->shift_x)
- ",SX=%s",e->shift_x;
- if (*e->shift_y)
- ",SY=%s",e->shift_y;
- if (*e->scroll_x)
- ",SCX=%s",e->scroll_x;
- if (*e->define_str) {
- st=MStrPrint("%q",e->define_str);
- ",D=\"%$Q\"",st;
- Free(st);
- }
- if (*e->html_link) {
- st=MStrPrint("%q",e->html_link);
- ",HTML=\"%$Q\"",st;
- Free(st);
- }
- "$";
- }
- Free(e);
-}
-
-class CEdSong
-{
- U8 tag[512] format "$DA-P,A=\"Tag Text:%s\"$\n",
- song[512] format "$DA-P,A=\"Song:%s\"$\n";
-};
-
-U0 EdInsSong()
-{
- CEdSong *e=CAlloc(sizeof(CEdSong));
- if (DocForm(e,,,,ctrl_L_footer))
- "$SO,\"%$Q\",A=\"%s\"$",e->tag,e->song;
- Free(e);
-}
-
-class CEdHtmlCode
-{
- U8 tag[512] format "$DA-P,A=\"Html Code:%s\"$\n";
-};
-
-U0 EdInsHtml()
-{
- CEdHtmlCode *e=CAlloc(sizeof(CEdHtmlCode));
- if (DocForm(e,,,,ctrl_L_footer))
- "$HC,\"%$Q\"$",e->tag;
- Free(e);
-}
-
-class CEdMacroMenu
-{
- U8 tag[512] format "$DA-P,A=\"Tag Text:%s\"$\n",
- left_macro[512] format "$DA-P,A=\"Left Click Macro:%s\"$\n",
- left_exp[512] format "$DA-P,A=\"Left Click Expression:%s\"$\n";
- Bool popup format "$CB,\"PopUp\"$\n",
- left_is_in_str format "$CB,\"Left is InStr\"$\n",
- left_x format "$CB,\"Left X \"$\n",
- center_x format "$CB,\"Center X \"$\n",
- right_x format "$CB,\"Right X \"$\n",
- margin_rel format "$CB,\"Margin Rel X\"$\n",
- blink format "$CB,\"Blink\"$\n",
- invert format "$CB,\"Invert\"$\n",
- underline format "$CB,\"Underline\"$\n",
- escape format "$CB,\"Escape\"$\n";
- U8 scroll_x[512] format "$DA-P,A=\"Scroll X Length Expression:%s\"$\n",
- shift_x[512] format "$DA-P,A=\"X Offset Expression:%s\"$\n",
- shift_y[512] format "$DA-P,A=\"Y Offset Expression:%s\"$\n";
-};
-
-U0 EdInsMacroMenu(Bool is_macro)
-{
- U8 *st,buf[512];
- CEdMacroMenu *e=CAlloc(sizeof(CEdMacroMenu));
- e->underline=TRUE;
- e->escape=TRUE;
- if (DocForm(e,,,,ctrl_L_footer)) {
- *buf=0;
- if (e->popup) CatPrint(buf,"+PU-X");
- if (e->left_x ) CatPrint(buf,"+LX");
- if (e->center_x) CatPrint(buf,"+CX");
- if (e->right_x ) CatPrint(buf,"+RX");
- if (e->margin_rel) CatPrint(buf,"+MRX");
- if (e->blink) CatPrint(buf,"+BK");
- if (e->invert) CatPrint(buf,"+IV");
- if (!e->underline) CatPrint(buf,"-UL");
- if (!e->escape) CatPrint(buf,"-X");
- if (e->left_is_in_str) CatPrint(buf,"+LIS");
- if (*e->tag || is_macro) {
- if (is_macro) {
- if (*e->tag) {
- st=MStrPrint("%q",e->tag);
- "$MA%s,\"%$Q\"",buf,st;
- Free(st);
- } else
- "$MA%s",buf;
- } else {
- st=MStrPrint("%q",e->tag);
- "$MU%s,\"%$Q\"",buf,st;
- Free(st);
- }
- if (*e->left_exp)
- ",LE=%s",e->left_exp;
- if (*e->left_macro) {
- st=MStrPrint("%q",e->left_macro);
- ",LM=\"%$Q\"",st;
- Free(st);
- }
- if (*e->shift_x)
- ",SX=%s",e->shift_x;
- if (*e->shift_y)
- ",SY=%s",e->shift_y;
- if (*e->scroll_x)
- ",SCX=%s",e->scroll_x;
- "$";
- }
- }
- Free(e);
-}
-
-class CEdBttn
-{
- U8 tag[512] format "$DA-P,A=\"Tag Text:%s\"$\n";
- Bool popup format "$CB,\"PopUp\"$\n",
- left_x format "$CB,\"Left X \"$\n",
- center_x format "$CB,\"Center X \"$\n",
- right_x format "$CB,\"Right X \"$\n",
- margin_rel format "$CB,\"Margin Rel X\"$\n",
- escape format "$CB,\"Escape\"$\n";
- U8 left_macro[512] format "$DA-P,A=\"Left Click Macro:%s\"$\n";
- Bool left_is_in_str format "$CB,\"Left is InStr\"$\n";
- U8 left_exp[512] format "$DA-P,A=\"Left Click Expression:%s\"$\n";
- Bool quote format "$CB,\"Quote\"$\n";
-};
-
-U0 EdInsBttn()
-{
- U8 *st,buf[512];
- CEdBttn *e=CAlloc(sizeof(CEdBttn));
- e->escape=TRUE;
- if (DocForm(e,,,,ctrl_L_footer)) {
- *buf=0;
- if (e->popup) CatPrint(buf,"+PU-X");
- if (e->left_x ) CatPrint(buf,"+LX");
- if (e->center_x) CatPrint(buf,"+CX");
- if (e->right_x ) CatPrint(buf,"+RX");
- if (e->margin_rel) CatPrint(buf,"+MRX");
- if (!e->escape) CatPrint(buf,"-X");
- if (e->left_is_in_str) CatPrint(buf,"+LIS");
- if (*e->tag) {
- if (e->quote) {
- st=MStrPrint("%q",e->tag);
- "$$BT%s,\\\"%$Q\\\"",buf,st;
- Free(st);
- if (*e->left_exp)
- ",LE=%s",e->left_exp;
- if (*e->left_macro) {
- st=MStrPrint("%q",e->left_macro);
- ",LM=\\\"%$Q\\\"",st;
- Free(st);
- }
- "$$";
- } else {
- st=MStrPrint("%q",e->tag);
- "$BT%s,\"%$Q\"",buf,st;
- Free(st);
- if (*e->left_exp)
- ",LE=%s",e->left_exp;
- if (*e->left_macro) {
- st=MStrPrint("%q",e->left_macro);
- ",LM=\"%$Q\"",st;
- Free(st);
- }
- "$";
- }
- }
- }
- Free(e);
-}
-
-class CEdCursorMovement
-{
- U8 left_exp[512] format "$DA-P,A=\"X Expression(LE):%s\"$\n",
- right_exp[512] format "$DA-P,A=\"Y Expression(RE):%s\"$\n";
- Bool left_x format "$CB,\"LeftX \"$\n",
- center_x format "$CB,\"CenterX \"$\n",
- right_x format "$CB,\"RightX \"$\n",
- margin_rel format "$CB,\"Margin Rel X\"$\n",
- top_y format "$CB,\"TopY \"$\n",
- center_y format "$CB,\"CenterY \"$\n",
- bottom_y format "$CB,\"BottomY \"$\n",
- page_rel format "$CB,\"Page Rel Y\"$\n",
- quote format "$CB,\"Quote\"$\n";
-};
-
-U0 EdInsCursorMovement()
-{
- U8 buf[512];
- CEdCursorMovement *e=CAlloc(sizeof(CEdCursorMovement));
- if (DocForm(e,,,,ctrl_L_footer)) {
- *buf=0;
- if (e->left_x ) CatPrint(buf,"+LX");
- if (e->center_x) CatPrint(buf,"+CX");
- if (e->right_x ) CatPrint(buf,"+RX");
- if (e->margin_rel) CatPrint(buf,"+MRX");
- if (e->top_y ) CatPrint(buf,"+TY");
- if (e->center_y) CatPrint(buf,"+CY");
- if (e->bottom_y) CatPrint(buf,"+BY");
- if (e->page_rel) CatPrint(buf,"+PRY");
- if (!*e->left_exp) CatPrint(buf,"-LE");
- if (!*e->right_exp) CatPrint(buf,"-RE");
- if (e->quote)
- "$";
- "$CM%s",buf;
- if (*e->left_exp)
- ",LE=%s",e->left_exp;
- if (*e->right_exp)
- ",RE=%s",e->right_exp;
- "$";
- if (e->quote)
- "$";
- }
- Free(e);
-}
-
-class CEdDataNum
-{
- U8 fmt_str[512] format "$DA-P,A=\"Format Str:%s\"$\n";
- I64 len;
- Bool term format "$CB,\"Form Field Terminator\"$\n",
- remalloc,
- refresh format "$CB,\"Refresh Data\"$\n",
- update format "$CB,\"Update Data\"$\n";
-};
-
-class CEdDataStr
-{
- U8 fmt_str[512] format "$DA-P,A=\"Format Str:%s\"$\n";
- I64 len format "$DA,A=\"Length:%d\"$\n";
- Bool term format "$CB,\"Zero Terminator\"$\n",
- remalloc format "$CB,\"Remalloc for Unlimited Length\"$\n",
- refresh format "$CB,\"Refresh Data\"$\n",
- update format "$CB,\"Update Data\"$\n";
-};
-
-U0 EdInsData()
-{
- I64 i,type=RT_I64;
- U8 *st,buf[512],raw_type[16];
- CEdDataNum *e=CAlloc(sizeof(CEdDataNum));
- e->term=TRUE;
- e->len=DOCE_LEN_DFT;
- if ((i=PopUpPickDefineSub("ST_NATURAL_TYPES"))>=0) {
- *buf=0;
- i+=RT_I8;
- if (i==RT_F32)
- i=RT_F64;
- if (i==RT_UF32) {//U8 *
- i=DocForm(e(CEdDataStr *),,,,ctrl_L_footer);
- if (e->remalloc) {
- CatPrint(buf,"+M");
- e->term=TRUE;
- } else
- CatPrint(buf,"-P");
- } else {
- type=i;
- i=DocForm(e,,,,ctrl_L_footer);
- }
- if (i) {
- if (type==RT_I64)
- *raw_type=0;
- else
- StrPrint(raw_type,",RT=%Z",type,"ST_RAW_TYPES");
-
- if (!e->term) CatPrint(buf,"-TRM");
- if (e->refresh) CatPrint(buf,"+RD");
- if (e->update) CatPrint(buf,"+UD");
-
- st=MStrPrint("%q",e->fmt_str);
- if (e->remalloc)
- "$$DA%s,A=\\\"%$Q\\\"$$",buf,st;
- else if (e->len==DOCE_LEN_DFT)
- "$$DA%s%s,A=\\\"%$Q\\\"$$",buf,raw_type,st;
- else
- "$$DA%s,LEN=%d%s,A=\\\"%$Q\\\"$$",buf,e->len,raw_type,st;
- Free(st);
- }
- }
- Free(e);
-}
-
-class CEdCheckBox
-{
- U8 tag[512] format "$DA-P,A=\"Tag Text:%s\"$\n";
- Bool refresh format "$CB,\"Refresh Data\"$\n";
- I64 type format "$LS,D=\"ST_INT_SIZE_TYPES\"$\n";
-};
-
-U0 EdInsCheckBox()
-{
- U8 *st,buf[512],raw_type[16];
- CEdCheckBox *e=CAlloc(sizeof(CEdCheckBox));
- e->type=RT_I8-RT_I8;
- if (DocForm(e,,,,ctrl_L_footer)) {
- *buf=0;
- e->type+=RT_I8;
- if (e->type==RT_I8)
- *raw_type=0;
- else
- StrPrint(raw_type,",RT=%Z",e->type,"ST_RAW_TYPES");
- if (e->refresh) CatPrint(buf,"+RD");
- st=MStrPrint("%q",e->tag);
- "$$CB%s%s,\\\"%$Q\\\"$$",buf,raw_type,st;
- Free(st);
- }
- Free(e);
-}
-
-class CEdLst
-{
- U8 tag[512] format "$DA-P,A=\"Dft Sel:%s\"$\n",
- define_str[512] format "$DA-P,A=\"Define Str:%s\"$\n";
- Bool refresh format "$CB,\"Refresh Data\"$\n";
- I64 type format "$LS,D=\"ST_INT_SIZE_TYPES\"$\n";
-};
-
-U0 EdInsLst()
-{
- U8 *st1,*st2,buf[512],raw_type[16];
- CEdLst *e=CAlloc(sizeof(CEdLst));
- e->type=RT_I64-RT_I8;
- if (DocForm(e,,,,ctrl_L_footer)) {
- *buf=0;
- e->type+=RT_I8;
- if (e->type==RT_I64)
- *raw_type=0;
- else
- StrPrint(raw_type,",RT=%Z",e->type,"ST_RAW_TYPES");
- if (e->refresh) CatPrint(buf,"+RD");
- if (!*e->tag)
- st1=NULL;
- else
- st1=MStrPrint("%q",e->tag);
- st2=MStrPrint("%q",e->define_str);
- if (st1)
- "$$LS%s%s,\\\"%$Q\\\",D=\\\"%$Q\\\"$$",buf,raw_type,st1,st2;
- else
- "$$LS%s%s,D=\\\"%$Q\\\"$$",buf,raw_type,st2;
- Free(st1);
- Free(st2);
- }
- Free(e);
-}
-
-class CEdHexEd
-{
- I64 cnt format "$DA,A=\"Count:%d\"$\n",
- cols format "$DA,A=\"Columns:%d\"$\n";
- Bool zero format "$CB,\"Zero Based\"$\n",
- refresh format "$CB,\"Refresh Data\"$\n";
-};
-
-U0 EdInsHexEd()
-{
- U8 buf[512];
- CEdHexEd *e=CAlloc(sizeof(CEdHexEd));
- e->cnt=128;
- e->cols=4;
- e->zero=TRUE;
- if (DocForm(e,,,,ctrl_L_footer)) {
- *buf=0;
- if (!e->zero) CatPrint(buf,"-Z");
- if (e->refresh) CatPrint(buf,"+RD");
- "$$HX%s,%d,%d$$",buf,e->cnt,e->cols;
- }
- Free(e);
-}
-
-class CEdBin
-{
- U8 tag[512] format "$DA-P,A=\"Tag Text:%s\"$\n";
- I64 bin_num format "$DA,A=\"Bin Num:%d\"$\n";
- U8 bin_ptr_link_file[512] format "$DA-P,A=\"File:%s\"$\n";
- I64 bin_ptr_link_bin_num format "$DA,A=\"File Bin Num:%d\"$\n";
- U8 bin_ptr_link_tag[512] format "$DA-P,A=\"File Bin Tag:%s\"$\n";
-};
-
-U0 EdInsBin(I64 bin_num,I64 type)
-{
- CEdBin *e=CAlloc(sizeof(CEdBin));
- StrPrint(e->tag,"<%d>",bin_num);
- e->bin_num=bin_num;
- e->bin_ptr_link_bin_num=1;
- if (DocForm(e,,,
- "Note: Normally, you enter no file,\n"
- "just a bin num.If You enter a\n"
- "file, enter a file bin num or a file\n"
- "bin tag.\n\n",ctrl_L_footer)) {
- if (*e->bin_ptr_link_file) {
- if (*e->bin_ptr_link_tag)
- "$%Z,\"%$Q\",BI=%d,BP=\"%s,%s\"$",type,"ST_DOC_CMDS",e->tag,e->bin_num,
- e->bin_ptr_link_file,e->bin_ptr_link_tag;
- else
- "$%Z,\"%$Q\",BI=%d,BP=\"%s,%d\"$",type,"ST_DOC_CMDS",e->tag,e->bin_num,
- e->bin_ptr_link_file,e->bin_ptr_link_bin_num;
- } else {
- if (DocBinFindNum(DocPut,e->bin_num))
- "$%Z,\"%$Q\",BI=%d$",type,"ST_DOC_CMDS",e->tag,e->bin_num;
- else
- PopUpOk("Invalid Binary Num");
- }
- }
- Free(e);
-}
-
-class CEdTree
-{
- U8 tag[512] format "$DA-P,A=\"Tag Text:%s\"$\n";
- I64 indent format "$DA,A=\"Indention:%d\"$\n";
- Bool collapsed format "$CB,\"Collapsed\"$\n";
-};
-
-U0 EdInsTree()
-{
- U8 *st1,*st2,buf[512];
- CEdTree *e=CAlloc(sizeof(CEdTree));
- e->collapsed=TRUE;
- e->indent=2;
- if (DocForm(e,,,,ctrl_L_footer)) {
- *buf=0;
- if (!e->collapsed) CatPrint(buf,"-C");
- st1=MStrPrint("%q",e->tag);
- st2=MStrPrint("$TR%s,\"%$Q\"$\n$ID,%d$*\n$ID,%d$",
- buf,st1,e->indent,-e->indent);
- DocPrintAtomic(DocPut,"%s",st2);
- Free(st1);
- Free(st2);
- }
- Free(e);
-}
-
-U0 EdInsWidgetWiz()
-{
- I64 type=PopUpWidgetType;
- switch (type) {
- case DOCT_FOREGROUND:
- EdInsColor;
- break;
- case DOCT_PAGE_LEN:
- EdInsPageSetting;
- break;
- case DOCT_LINK:
- EdInsLink;
- break;
- case DOCT_TEXT:
- EdInsText;
- break;
- case DOCT_TREE:
- EdInsTree;
- break;
- case DOCT_MACRO:
- EdInsMacroMenu(TRUE);
- break;
- case DOCT_MENU_VAL:
- EdInsMacroMenu(FALSE);
- break;
- case DOCT_CURSOR_MOVEMENT:
- EdInsCursorMovement;
- break;
- case DOCT_BTTN:
- EdInsBttn;
- break;
- case DOCT_DATA:
- EdInsData;
- break;
- case DOCT_CHECK_BOX:
- EdInsCheckBox;
- break;
- case DOCT_LST:
- EdInsLst;
- break;
- case DOCT_HEX_ED:
- EdInsHexEd;
- break;
- case DOCT_SONG:
- EdInsSong;
- break;
- case WIZ_HIGHLIGHT_ON:
- "$HL,1$";
- break;
- case WIZ_HIGHLIGHT_OFF:
- "$HL,0$";
- break;
- case DOCT_HTML_CODE:
- EdInsHtml;
- }
-}
-
-#define EST_SPRITE 0
-#define EST_SPRITE_PTR 1
-#define EST_DUP_SPRITE 2
-#define EST_SPRITE_SIZE 3
-#define EST_SPRITE_MACRO 4
-#define EST_SPRITE_MENU 5
-#define EST_SPRITE_LINK 6
-
-I64 PopUpSpriteType()
-{
- I64 i;
- CDoc *doc=DocNew;
- DocPrint(doc,"$PURPLE$$TX+CX,\"Graphic Sprite Resource Menu\"$\n"
- "$LK+PU+CX,\"Click for Help\",A=\"FI:::/Doc/Resource.DD.Z\"$\n\n"
- "$LTBLUE$$MU,\"Make Sprite\",LE=EST_SPRITE$$FG$\t"
- "Start by making a sprite.\n"
- "$LTBLUE$$MU,\"Ptr to Sprite\",LE=EST_SPRITE_PTR$$FG$\t"
- "Insert pointer into src code.\n"
- "$LTBLUE$$MU,\"Duplicate Sprite\",LE=EST_DUP_SPRITE$$FG$"
- "Make dup image for in a doc.\n"
- "$LTBLUE$$MU,\"Sprite Size\",LE=EST_SPRITE_SIZE$$FG$\t"
- "Insert size of a sprite into src code.\n"
- "$LTBLUE$$MU,\"Sprite Macro\",LE=EST_SPRITE_MACRO$$FG$\t"
- "Create icon with auto-text payload.\n"
- "$LTBLUE$$MU,\"Sprite Menu Item\",LE=EST_SPRITE_MENU$$FG$"
- "Create icon with numeric payload.\n"
- "$LTBLUE$$MU,\"Sprite Link\",LE=EST_SPRITE_LINK$$FG$\t"
- "Create icon with link payload.\n\n"
- "$LTBLUE$$MU,\"Abort\",LE=DOCM_CANCEL$\n\n");
- i=PopUpMenu(doc);
- DocDel(doc);
- return i;
-}
-
-class CEdMacroSprite
-{
- U8 tag[512] format "$DA-P,A=\"Tag Text:%s\"$\n",
- exp[512] format "$DA-P,A=\"Macro:%s\"$\n";
- Bool escape format "$CB,\"Escape\"$\n",
- popup format "$CB,\"PopUp\"$\n",
- is_in_str format "$CB,\"InStr\"$\n";
-};
-
-class CEdMenuSprite
-{
- U8 tag[512] format "$DA-P,A=\"Tag Text:%s\"$\n",
- exp[512] format "$DA-P,A=\"Expression:%s\"$\n";
- Bool escape format "$CB,\"Escape\"$\n",
- popup,
- is_in_str;
-};
-
-U8 *EdSpriteLink(Bool *_pop_up,U8 **_html_link)
-{
- U8 *res=NULL,*tag=NULL,*link=NULL;
- Bool quote=FALSE;
- I64 type=PopUpLinkType(FALSE);
- *_html_link=NULL;
- if (type>=0 && GetLink(type,&tag,&link,_pop_up,&quote,_html_link))
- res=MStrPrint("\"%$Q\",A=\"%$Q\"",tag,link);
- Free(tag);
- Free(link);
- return res;
-}
-
-U8 *EdSprite(I64 bin_num)
-{
- I64 type=PopUpSpriteType;
- Bool pop_up;
- U8 *st,*st1=NULL,*st2=NULL,buf[1024],*html_link=NULL;
- CEdMacroSprite *e=CAlloc(sizeof(CEdMacroSprite));
- *buf=0;
- switch (type) {
- case EST_SPRITE:
- st1=MStrPrint("\"<%d>\"",bin_num);
- break;
- case EST_SPRITE_MACRO:
- e->escape=TRUE;
- if (DocForm(e,,,,ctrl_L_footer)) {
- CatPrint(buf,"+UL");
- if (e->is_in_str) CatPrint(buf,"+LIS");
- if (e->popup) CatPrint(buf,"+PU");
- if (e->escape) CatPrint(buf,"+X");
- st=MStrPrint("%q",e->exp);
- st1=MStrPrint("\"%$Q\",LM=\"%$Q\"",e->tag,st);
- Free(st);
- }
- break;
- case EST_SPRITE_MENU:
- e->escape=TRUE;
- if (DocForm(e,"CEdMenuSprite",,,ctrl_L_footer)) {
- if (e->escape) CatPrint(buf,"+X");
- st1=MStrPrint("\"%$Q\",LE=%s",e->tag,e->exp);
- }
- break;
- case EST_SPRITE_LINK:
- CatPrint(buf,"+L");
- st1=EdSpriteLink(&pop_up,&html_link);
- if (pop_up)
- CatPrint(buf,"+PU");
- break;
- case EST_SPRITE_PTR:
- EdInsBin(--bin_num,DOCT_INS_BIN);
- break;
- case EST_SPRITE_SIZE:
- EdInsBin(--bin_num,DOCT_INS_BIN_SIZE);
- break;
- case EST_DUP_SPRITE:
- EdInsBin(--bin_num,DOCT_SPRITE);
- break;
- }
- if (st1) {
- if (html_link)
- st2=MStrPrint("$SP%s,%s,HTML=\"%$Q\",BI=%d$",buf,st1,html_link,bin_num);
- else
- st2=MStrPrint("$SP%s,%s,BI=%d$",buf,st1,bin_num);
- Free(st1);
- }
- Free(e);
- Free(html_link);
- return st2;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/DolDoc/MakeDoc.HC.HTML b/public/src/Adam/DolDoc/MakeDoc.HC.HTML deleted file mode 100644 index 6ac8f24..0000000 --- a/public/src/Adam/DolDoc/MakeDoc.HC.HTML +++ /dev/null @@ -1,81 +0,0 @@ - - - - - MakeDoc.HC - - - - - Cd(__DIR__);;
-
-#help_index "DolDoc"
-#help_file "::/Doc/DolDoc"
-
-/*
-TempleOS DolDoc's can have "cursor movement" cmds which can move the cursor up
-the scrn and layer on existing text.It can also have callback funs which
-supply live, changing text.For these reasons, you can't assume you know
-where the vis portion of the document is and must process much
-of the document each time it is placed on the scrn, becoming CPU
-intensive on big documents.
-See /Doc/DolDocOverview.DD
-*/
-
-//Hash Types
-#define DHT_DOC_CMD 1
-#define DHT_DOC_FLAG 2
-#define DHT_COLOR 4
-
-public class CDolDocGlbls
-{
- CHashTable *hash;
- I64 dft_de_flags [DOCT_TYPES_NUM],
- type_flags_nontag_invis [(DOCT_TYPES_NUM+63)/64],
- type_flags_form [(DOCT_TYPES_NUM+63)/64],
- type_flags_data [(DOCT_TYPES_NUM+63)/64],
- type_flags_chk_dup [(DOCT_TYPES_NUM+63)/64],
- clean_scan_codes [4];
- I32 dft_type_flags [DOCT_TYPES_NUM];
-} doldoc;
-MemSet(&doldoc,0,sizeof(CDolDocGlbls));
-
-#help_index "God"
-#define BIBLE_FILENAME "::/Misc/Bible.TXT.Z"
-
-#include "DocExt"
-#include "DocBin"
-#include "DocNew"
-#include "DocForm"
-#include "DocDblBuf"
-#include "DocPlain"
-#include "DocInit"
-#include "DocHighlight"
-#include "DocRecalcLib"
-#include "DocRecalc"
-#include "DocFile"
-#include "DocClipBoard"
-#include "DocRun"
-#include "DocGet"
-#include "DocChar"
-#include "DocFind"
-#include "DocLink"
-#include "DocEd"
-#include "DocPopUp"
-#include "DocGr"
-#include "DocMacro"
-#include "DocWidgetWiz"
-#include "DocPutKey"
-#include "DocPutS"
-#include "DocCodeTools"
-#include "DocTree"
-#include "DocTerm"
-
-KeyDevAdd(&KDDocPutKey,&KDDocPutS,0x80000000,TRUE);
-fp_getstr2=&DocGetStr2;
-fp_doc_put=&DocPut;
-
-Cd("..");;
- - - \ No newline at end of file diff --git a/public/src/Adam/God/GodBible.HC.HTML b/public/src/Adam/God/GodBible.HC.HTML deleted file mode 100644 index d1aa957..0000000 --- a/public/src/Adam/God/GodBible.HC.HTML +++ /dev/null @@ -1,360 +0,0 @@ - - - - - GodBible.HC - - - - - #help_index "God"
-U0 BibleInit()
-{
- DefineLstLoad("ST_BIBLE_BOOKS",
- "Genesis\0"
- "Exodus\0"
- "Leviticus\0"
- "Numbers\0"
- "Deuteronomy\0"
- "Joshua\0"
- "Judges\0"
- "Ruth\0"
- "1 Samuel\0"
- "2 Samuel\0"
- "1 Kings\0"
- "2 Kings\0"
- "1 Chronicles\0"
- "2 Chronicles\0"
- "Ezra\0"
- "Nehemiah\0"
- "Esther\0"
- "Job\0"
- "Psalms\0"
- "Proverbs\0"
- "Ecclesiastes\0"
- "Song of Songs\0"
- "Isaiah\0"
- "Jeremiah\0"
- "Lamentations\0"
- "Ezekiel\0"
- "Daniel\0"
- "Hosea\0"
- "Joel\0"
- "Amos\0"
- "Obadiah\0"
- "Jonah\0"
- "Micah\0"
- "Nahum\0"
- "Habakkuk\0"
- "Zephaniah\0"
- "Haggai\0"
- "Zechariah\0"
- "Malachi\0"
- "Matthew\0"
- "Mark\0"
- "Luke\0"
- "John\0"
- "Acts\0"
- "Romans\0"
- "1 Corinthians\0"
- "2 Corinthians\0"
- "Galatians\0"
- "Ephesians\0"
- "Philippians\0"
- "Colossians\0"
- "1 Thessalonians\0"
- "2 Thessalonians\0"
- "1 Timothy\0"
- "2 Timothy\0"
- "Titus\0"
- "Philemon\0"
- "Hebrews\0"
- "James\0"
- "1 Peter\0"
- "2 Peter\0"
- "1 John\0"
- "2 John\0"
- "3 John\0"
- "Jude\0"
- "Revelation\0");
- DefineLstLoad("ST_BIBLE_BOOK_LINES",
- "297\0"
- "5068\0"
- "9123\0"
- "12005\0"
- "15977\0"
- "19168\0"
- "21329\0"
- "23598\0"
- "23902\0"
- "26892\0"
- "29345\0"
- "32241\0"
- "34961\0"
- "37633\0"
- "40756\0"
- "41671\0"
- "42963\0"
- "43605\0"
- "46190\0"
- "53793\0"
- "56267\0"
- "56966\0"
- "57332\0"
- "61806\0"
- "66736\0"
- "67217\0"
- "71804\0"
- "73189\0"
- "73876\0"
- "74130\0"
- "74615\0"
- "74697\0"
- "74860\0"
- "75241\0"
- "75416\0"
- "75604\0"
- "75806\0"
- "75932\0"
- "76684\0"
- "76908\0"
- "79970\0"
- "81941\0"
- "85266\0"
- "87803\0"
- "90914\0"
- "92110\0"
- "93323\0"
- "94088\0"
- "94514\0"
- "94869\0"
- "95153\0"
- "95402\0"
- "95647\0"
- "95772\0"
- "96090\0"
- "96320\0"
- "96440\0"
- "96500\0"
- "97370\0"
- "97687\0"
- "97976\0"
- "98163\0"
- "98506\0"
- "98552\0"
- "98597\0"
- "98684\0"
- "100111\0");
- DefinePrint("ST_BIBLE_LINES","%d",
- Str2I64(DefineSub(DefineCnt("ST_BIBLE_BOOK_LINES")-1,
- "ST_BIBLE_BOOK_LINES"))-1);
-} BibleInit;
-
-public U8 *BibleLine2Verse(I64 line,I64 separate_ch=CH_SPACE)
-{//Line number to verse str, Malloc()ed.
-//Separate with <SPACE> or ','. If you pass '%', it uses "%20".
- CDoc *doc;
- CDocEntry *doc_e;
- I64 i=0,cnt=DefineCnt("ST_BIBLE_BOOKS"),start=0,last_start=0;
- U8 *ptr=DefineSub(0,"ST_BIBLE_BOOK_LINES"),*ptr2;
- while (i<=cnt) {
- last_start=start;
- start=Str2I64(ptr);
- if (line<start)
- break;
- i++;
- ptr+=StrLen(ptr)+1;
- }
- if (0<=--i<cnt) {
- doc=DocRead(BIBLE_FILENAME,DOCF_PLAIN_TEXT|DOCF_NO_CURSOR);
- DocGoToLine(doc,line); //one based
- doc_e=doc->cur_entry;
- while (doc_e!=doc && (doc_e->type_u8!=DOCT_TEXT || !*doc_e->tag))
- doc_e=doc_e->next;
- if (doc_e->type_u8==DOCT_TEXT && '0'<=*doc_e->tag<='9') {
- ptr=ptr2=doc_e->tag;
- while ('0'<=*ptr2<='9' || *ptr2==':')
- ptr2++;
- *ptr2=0;
- if (separate_ch=='%')
- ptr=MStrPrint("%Z%%20%s",i,"ST_BIBLE_BOOKS",ptr);
- else
- ptr=MStrPrint("%Z%c%s",i,"ST_BIBLE_BOOKS",separate_ch,ptr);
- } else {
- while (TRUE) {
- doc_e=doc_e->last;
- if (doc_e==doc) {
- ptr=NULL;
- break;
- }
- if (doc_e->y+1<last_start) {
- ptr=MStrPrint("%Z",i,"ST_BIBLE_BOOKS");
- break;
- }
- if (doc_e->type_u8==DOCT_TEXT && StrLen(doc_e->tag)>=3) {
- ptr=doc_e->tag+StrLen(doc_e->tag)-1;
- while (ptr>doc_e->tag && (!('0'<=*(ptr-1)<='9') || *ptr!=':' ||
- !('0'<=*(ptr+1)<='9')))
- ptr--;
- ptr--;
- while (ptr>=doc_e->tag && '0'<=*ptr<='9')
- ptr--;
- ptr2=++ptr;
- if ('0'<=*ptr2++<='9') {
- while ('0'<=*ptr2<='9')
- ptr2++;
- if (*ptr2++==':' && '0'<=*ptr2++<='9') {
- while ('0'<=*ptr2<='9')
- ptr2++;
- *ptr2=0;
- if (separate_ch=='%')
- ptr=MStrPrint("%Z%%20%s",i,"ST_BIBLE_BOOKS",ptr);
- else
- ptr=MStrPrint("%Z%c%s",i,"ST_BIBLE_BOOKS",separate_ch,ptr);
- break;
- }
- }
- }
- }
- }
- DocDel(doc);
- return ptr;
- } else
- return NULL;
-}
-
-public U0 BookLines(CDoc *doc_out=NULL,I64 start,I64 lines,
- U8 *book_filename=BIBLE_FILENAME)
-{//Put N line starting at line M into doc.
- CDoc *doc_in;
- CDocEntry *doc_e;
- if (!doc_out) doc_out=DocPut;
- if (doc_out && FileFind(book_filename)) {
- doc_in=DocRead(book_filename,DOCF_PLAIN_TEXT|DOCF_NO_CURSOR);
- DocGoToLine(doc_in,start); //one based
- doc_e=doc_in->cur_entry;
- while (lines>0 && doc_e!=doc_in) {
- if (doc_e->type_u8==DOCT_TEXT)
- DocPrint(doc_out,"%s",doc_e->tag);
- else if (doc_e->type_u8==DOCT_NEW_LINE) {
- DocPutKey(doc_out,'\n');
- lines--;
- }
- doc_e=doc_e->next;
- }
- DocDel(doc_in);
- }
-}
-
-public U0 BibleVerse(CDoc *doc_out=NULL,U8 *verse,I64 lines)
-{//Put N lines starting at verse str into doc.
- I64 i;
- CDoc *doc_in;
- CDocEntry *doc_e;
- U8 *st,*st2;
- if (!doc_out) doc_out=DocPut;
- if (doc_out && FileFind(BIBLE_FILENAME)) {
- st=StrNew(verse);
- st2=StrNew(verse);
- if (StrOcc(st,','))
- StrLastRem(st,",",st2);
- else
- *st2=0;
- i=DefineMatch(st,"ST_BIBLE_BOOKS",LMF_IGNORE_CASE);
- if (i>=0) {
- i=Str2I64(DefineSub(i,"ST_BIBLE_BOOK_LINES"));
- doc_in=DocRead(BIBLE_FILENAME,DOCF_PLAIN_TEXT|DOCF_NO_CURSOR);
- DocGoToLine(doc_in,i); //one based
- if (*st2) {
- StrCpy(doc_in->find_replace->find_text,st2);
- EdFindNext(doc_in);
- }
- doc_e=doc_in->cur_entry;
- while (lines>0 && doc_e!=doc_in) {
- if (doc_e->type_u8==DOCT_TEXT)
- DocPrint(doc_out,"%s",doc_e->tag);
- else if (doc_e->type_u8==DOCT_NEW_LINE) {
- DocPutKey(doc_out,'\n');
- lines--;
- }
- doc_e=doc_e->next;
- }
- DocDel(doc_in);
- }
- Free(st);
- Free(st2);
- }
-}
-
-public CDoc *BibleDoc()
-{//Return Bible as DolDoc with trees.
- CDoc *res=DocRead(BIBLE_FILENAME);
- CDocEntry *doc_e=res->head.next,*doc_e1;
- Bool open_chapter=FALSE;
- U8 *ptr=Define("ST_BIBLE_BOOK_LINES");
- I64 book,book_cnt=DefineCnt("ST_BIBLE_BOOK_LINES")-1,
- chapter,
- line=Str2I64(ptr,,&ptr);
- ptr++;
- for (book=0;book<book_cnt;book++) {
- while (doc_e->y+1<line) {
- doc_e1=doc_e->next;
- DocEntryDel(res,doc_e);
- doc_e=doc_e1;
- }
- res->cur_entry=doc_e;
- res->cur_col=0;
- DocPrint(res,"$TR,\"%Z\"$\n$
$",book,"ST_BIBLE_BOOKS");
- line=Str2I64(ptr,,&ptr);
- ptr++;
- chapter=1;
- while (doc_e->y+1<line) {
- doc_e1=doc_e->next;
- if (doc_e->type_u8==DOCT_TEXT && StrMatch(":1",doc_e->tag)) {
- res->cur_entry=doc_e;
- res->cur_col=0;
- if (open_chapter) {
- DocPrint(res,"$
$");
- open_chapter=FALSE;
- }
- DocPrint(res,"$TR,\"%d\"$\n$
$",chapter++);
- open_chapter=TRUE;
- } else if (chapter==1) {
- doc_e1=doc_e->next;
- DocEntryDel(res,doc_e);
- doc_e=doc_e1;
- }
- doc_e=doc_e1;
- }
- res->cur_entry=doc_e;
- res->cur_col=0;
- if (open_chapter) {
- DocPrint(res,"$
$");
- open_chapter=FALSE;
- }
- DocPrint(res,"$ID,-2$");
- }
- while (doc_e!=res) {
- doc_e1=doc_e->next;
- DocEntryDel(res,doc_e);
- doc_e=doc_e1;
- }
- return res;
-}
-
-public U0 BibleView()
-{//View Bible as DolDoc with trees.
- U8 buf[STR_LEN];
- CDoc *doc=BibleDoc;
- StrPrint(buf,"AL:%d,1",doc);
- Ed(buf);
- DocDel(doc);
-}
-U0 CtrlAltB(I64)
-{
- PopUp("BibleView;");
-}
-CtrlAltCBSet('B',&CtrlAltB,"Cmd/Bible");
- - - \ No newline at end of file diff --git a/public/src/Adam/God/GodDoodle.HC.HTML b/public/src/Adam/God/GodDoodle.HC.HTML deleted file mode 100644 index 93cbc38..0000000 --- a/public/src/Adam/God/GodDoodle.HC.HTML +++ /dev/null @@ -1,204 +0,0 @@ - - - - - GodDoodle.HC - - - - - #help_index "God;Graphics/Sprite;Sprites"
-
-U0 GodDoodleDraw(CTask *task,CDC *dc)
-{
- GrBlot(dc,0,0,god.doodle_dc);
- if (Blink) {
- if (god.doodle_done) {
- dc->color=RED;
- GrPrint(dc,(task->pix_width-FONT_WIDTH*29)>>1,
- (task->pix_height-3*FONT_HEIGHT)>>1,
- "Press <ESC> to insert sprite.");
- GrPrint(dc,(task->pix_width-FONT_WIDTH*39)>>1,
- (task->pix_height-3*FONT_HEIGHT)>>1+2*FONT_HEIGHT,
- "Press <SHIFT-ESC> to throw-away sprite.");
- } else {
- dc->color=GREEN;
- GrPrint(dc,(task->pix_width-FONT_WIDTH*25)>>1,
- (task->pix_height-FONT_HEIGHT)>>1,
- "Press <SPACE> repeatedly.");
- }
- }
-}
-
-U0 GodDoodleSmooth(I64 num)
-{
- CDC *dc=DCExt(god.doodle_dc,0,0,
- god.doodle_dc->width-1,god.doodle_dc->height-1);
- I64 i,x,y,x1,y1,c,histogram[16],best,best_cnt,c_old=god.doodle_dc->color;
- for (y=0;y<god.doodle_dc->height;y++)
- for (x=0;x<god.doodle_dc->width;x++) {
- MemSet(histogram,0,sizeof(histogram));
- for (y1=y-num;y1<=y+num;y1++)
- for (x1=x-num;x1<=x+num;x1++) {
- c=GrPeek(dc,x1,y1);
- if (0<=c<=15)
- histogram[c]++;
- }
- best=BLACK;
- best_cnt=-1;
- for (i=0;i<16;i++)
- if (histogram[i]>best_cnt) {
- best=i;
- best_cnt=histogram[i];
- }
- god.doodle_dc->color=best;
- GrPlot(god.doodle_dc,x,y);
- }
- god.doodle_dc->color=c_old;
- DCDel(dc);
-}
-
-U0 GodDoodleBitsIns(I64 num_bits,I64 n)
-{//Insert bits into God doodle bit fifo.
- I64 i;
- for (i=0;i<num_bits;i++) {
- FifoU8Ins(god.doodle_fifo,n&1);
- n>>=1;
- }
-}
-
-U0 GodDoodleHexIns(U8 *st)
-{//Insert hex record into God doodle bit fifo.
- U8 buf[2];
- if (st) {
- buf[1]=0;
- while (*buf=*st++)
- if (Bt(char_bmp_hex_numeric,*buf))
- GodDoodleBitsIns(4,rev_bits_table[Str2I64(buf,16)]>>4);
- }
-}
-
-I64 GodDoodleBits(I64 num_bits)
-{
- U8 b;
- I64 res=0;
- while (num_bits) {
- if (FifoU8Rem(god.doodle_fifo,&b)) {
- res=res<<1+b;
- num_bits--;
- } else {
- god.doodle_ch=GetChar(,FALSE);
- if (god.doodle_ch==CH_ESC||god.doodle_ch==CH_SHIFT_ESC)
- throw;
- else if (god.doodle_ch=='\n') {
- DCFill(god.doodle_dc,WHITE);
- FifoU8Flush(god.doodle_fifo);
- } else if ('0'<=god.doodle_ch<='9')
- GodDoodleSmooth(god.doodle_ch-'0');
- else
- GodDoodleBitsIns(GOD_GOOD_BITS,KbdMsEvtTime>>GOD_BAD_BITS);
- }
- }
- return res;
-}
-
-public U8 *GodDoodleSprite(U8 *hex=NULL)
-{//Make God draw sprite. $LK+PU,"Holy Spirit Instructions",A="FI:::/Adam/God/HSNotes.DD"$
- I64 i,j,w,h,x,y,ch;
- U8 *elems;
-
- if (god.doodle_dc) return NULL;
- god.doodle_done=FALSE;
- SettingsPush; //See SettingsPush
- AutoComplete;
- WinBorder;
- WinMax;
-
- if (!hex)
- PopUpOk("The $LK+PU,"Holy Spirit",A="FI:::/Adam/God/HSNotes.DD"$ can puppet you.\n\n"
- "Press $GREEN$<SPACE>$FG$ until it finishes.");
-
- god.doodle_ch=0;
- god.doodle_dc=DCNew(Fs->pix_width,Fs->pix_height);
- DCFill(god.doodle_dc,WHITE);
- w=god.doodle_dc->width;
- h=god.doodle_dc->height;
-
- Fs->draw_it=&GodDoodleDraw;
- FifoU8Flush(god.doodle_fifo);
- GodDoodleHexIns(hex);
- try {
- for (i=0;i<3;i++) {
- god.doodle_dc->color=RED;
- for (j=0;j<29;j++)
- switch [GodDoodleBits(3)] {
- case 0:
- GrEllipse3(god.doodle_dc,
- (w-1)*GodDoodleBits(5)/15.5-w/2,
- (h-1)*GodDoodleBits(5)/15.5-h/2,0,
- (w-1)*GodDoodleBits(5)/15.5,(h-1)*GodDoodleBits(5)/15.5);
- break;
- case 1:
- GrCircle3(god.doodle_dc,
- (w-1)*GodDoodleBits(5)/15.5-w/2,
- (h-1)*GodDoodleBits(5)/15.5-h/2,0,
- (w-1)*GodDoodleBits(5)/15.5);
- break;
- case 2:
- GrBorder(god.doodle_dc,
- (w-1)*GodDoodleBits(5)/15.5-w/2,
- (h-1)*GodDoodleBits(5)/15.5-h/2,
- (w-1)*GodDoodleBits(5)/15.5,(h-1)*GodDoodleBits(5)/15.5);
- break;
- case 3...7:
- GrLine3(god.doodle_dc,
- (w-1)*GodDoodleBits(4)/15,(h-1)*GodDoodleBits(4)/15,0,
- (w-1)*GodDoodleBits(4)/15,(h-1)*GodDoodleBits(4)/15,0);
- break;
- }
- for (j=0;j<6;j++) {
- x=(w-1)*GodDoodleBits(5)/31+w/64;
- y=(h-1)*GodDoodleBits(5)/31+h/64;
- switch [GodDoodleBits(2)] {
- case 0: god.doodle_dc->color=BLACK; break;
- case 1: god.doodle_dc->color=DKGRAY; break;
- case 2: god.doodle_dc->color=LTGRAY; break;
- case 3: god.doodle_dc->color=WHITE; break;
- }
- GrFloodFill3(god.doodle_dc,x,y,0);
- }
- GodDoodleSmooth(3);
- }
- god.doodle_done=TRUE;
- if (!hex) {
- do ch=GetChar(,FALSE);
- while (ch!=CH_ESC && ch!=CH_SHIFT_ESC);
- } else
- ch=CH_ESC;
- } catch {
- Fs->catch_except=TRUE;
- ch=CH_SHIFT_ESC;
- }
- DCFill;
- SettingsPop;
- if (ch==CH_ESC)
- elems=DC2Sprite(god.doodle_dc);
- else
- elems=NULL;
- DCDel(god.doodle_dc);
- god.doodle_dc=NULL;
- return elems;
-}
-
-#help_index "God"
-public U0 GodDoodle(U8 *hex=NULL)
-{//Make God draw sprite, insert in doc. $LK+PU,"Holy Spirit Instructions",A="FI:::/Adam/God/HSNotes.DD"$
- U8 *elems;
- if (elems=GodDoodleSprite(hex)) {
- Sprite(elems);
- Free(elems);
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/God/GodExt.HC.HTML b/public/src/Adam/God/GodExt.HC.HTML deleted file mode 100644 index a551bb7..0000000 --- a/public/src/Adam/God/GodExt.HC.HTML +++ /dev/null @@ -1,38 +0,0 @@ - - - - - GodExt.HC - - - - - #help_index "God"
-
-#define GOD_BAD_BITS 4
-#define GOD_GOOD_BITS 24
-
-public class CGodGlbls
-{
- U8 **words,
- *word_file_mask;
- I64 word_fuf_flags,
- num_words;
- CFifoU8 *fifo;
- CDC *doodle_dc;
- I64 doodle_ch;
- CFifoU8 *doodle_fifo;
- Bool doodle_done;
-} god;
-MemSet(&god,0,sizeof(CGodGlbls));
-god.doodle_fifo =FifoU8New(2048*8);
-god.fifo =FifoU8New(2048*8);
-
-extern U0 GodBiblePassage(I64 num_lines=20);
-extern U0 GodBitsIns(I64 num_bits,I64 n);
-extern U0 GodDoodle(U8 *hex=NULL);
-extern U0 GodSong();
-extern U0 GodWord(I64 bits=17);
- - - \ No newline at end of file diff --git a/public/src/Adam/God/GodSong.HC.HTML b/public/src/Adam/God/GodSong.HC.HTML deleted file mode 100644 index 8137c1b..0000000 --- a/public/src/Adam/God/GodSong.HC.HTML +++ /dev/null @@ -1,183 +0,0 @@ - - - - - GodSong.HC - - - - - #help_index "God"
-
-DefineLstLoad("ST_RHYTHM_COMPLEXITY","Simple\0Normal\0Complex\0");
-
-class CMakeSongSettings
-{
- I64 complexity format "$LS,D=\"ST_RHYTHM_COMPLEXITY\"$\n";
- Bool rests format "$CB,\"Rests\"$\n";
- Bool six_eight format "$CB,\"Six Eight\"$\n";
- I64 octave format "$DA-TRM,A=\"Octave:%d\"$\n";
- I64 octave_state;
-};
-
-U0 InsNote(CMakeSongSettings *mss,U8 *buf,I64 k,I64 *j)
-{//k is a random note nibble
- if (!k && mss->rests) {
- buf[*j]='R';
- *j+=1;
- } else {
- k/=2;
- if (k<3) {
- if (mss->octave_state!=mss->octave) {
- mss->octave_state=mss->octave;
- buf[*j]=mss->octave_state+'0';
- *j+=1;
- }
- if (!k)
- buf[*j]='G';
- else
- buf[*j]=k-1+'A';
- *j+=1;
- } else {
- if (mss->octave_state!=mss->octave+1) {
- mss->octave_state=mss->octave+1;
- buf[*j]=mss->octave_state+'0';
- *j+=1;
- }
- buf[*j]=k-1+'A';
- *j+=1;
- }
- }
-}
-
-#define DUR_4 0
-#define DUR_8_8 1
-#define DUR_3_3_3 2
-#define DUR_16_16_16_16 3
-#define DUR_8DOT_16 4
-#define DUR_8_16_16 5
-#define DUR_16_16_8 6
-
-U8 god_simple_songs [5]={DUR_4,DUR_4,DUR_4,DUR_4,DUR_8_8};
-U8 god_normal_songs [5]={DUR_4,DUR_4,DUR_8_8,DUR_3_3_3,DUR_16_16_16_16};
-U8 god_complex_songs[9]={DUR_4,DUR_4,DUR_8_8,DUR_8_8,DUR_8DOT_16,DUR_3_3_3,
-DUR_8_16_16,DUR_16_16_8,DUR_16_16_16_16};
-
-public U8 *GodSongStr()
-{//Make God generate 2 measures of a song. $LK+PU,"Holy Spirit Instructions",A="FI:::/Adam/God/HSNotes.DD"$
- CMakeSongSettings mss;
- U8 *buf;
- I64 i,j=0,k,n,k2,duration,last_duration=-1,len;
-
- MemSet(&mss,0,sizeof(mss));
- mss.complexity=1;
- mss.rests=FALSE;
- mss.octave=music.octave;
-
- if (!PopUpForm(&mss))
- return NULL;
-
- buf=CAlloc(256);
- music.octave=mss.octave=ClampI64(mss.octave,1,7);
- progress4=0;
- if (mss.six_eight)
- progress4_max=6;
- else
- progress4_max=8;
-
- mss.octave_state=mss.octave+1;
- buf[j++]='0'+mss.octave_state;
- if (mss.six_eight) {
- len=6;
- buf[j++]='M';
- buf[j++]='6';
- buf[j++]='/';
- buf[j++]='8';
- } else
- len=8;
- FifoU8Flush(god.fifo);
- for (i=0;i<len;i++) {
- n=GodBits(8);
- if (mss.complexity==2)
- duration=god_complex_songs[n%9];
- else if (mss.complexity==1)
- duration=god_normal_songs[n%5];
- else
- duration=god_simple_songs[n%5];
-
- switch (duration) {
- case DUR_8_8:
- if (last_duration!=DUR_8_8)
- buf[j++]='e';
- InsNote(&mss,buf,GodBits(4),&j);
- InsNote(&mss,buf,GodBits(4),&j);
- break;
- case DUR_8DOT_16:
- buf[j++]='e';
- buf[j++]='.';
- InsNote(&mss,buf,GodBits(4),&j);
- buf[j++]='s';
- InsNote(&mss,buf,GodBits(4),&j);
- duration=DUR_16_16_16_16;
- break;
- case DUR_3_3_3:
- if (last_duration!=DUR_3_3_3) {
- buf[j++]='e';
- buf[j++]='t';
- }
- InsNote(&mss,buf,GodBits(4),&j);
- InsNote(&mss,buf,GodBits(4),&j);
- InsNote(&mss,buf,GodBits(4),&j);
- break;
- case DUR_8_16_16:
- if (last_duration!=DUR_8_8)
- buf[j++]='e';
- InsNote(&mss,buf,GodBits(4),&j);
- buf[j++]='s';
- InsNote(&mss,buf,GodBits(4),&j);
- InsNote(&mss,buf,GodBits(4),&j);
- duration=DUR_16_16_16_16;
- break;
- case DUR_16_16_8:
- if (last_duration!=DUR_16_16_16_16)
- buf[j++]='s';
- InsNote(&mss,buf,GodBits(4),&j);
- InsNote(&mss,buf,GodBits(4),&j);
- buf[j++]='e';
- InsNote(&mss,buf,GodBits(4),&j);
- duration=DUR_8_8;
- break;
- case DUR_16_16_16_16:
- if (last_duration!=DUR_16_16_16_16)
- buf[j++]='s';
- k =GodBits(4);
- k2=GodBits(4);
- InsNote(&mss,buf,k,&j);
- InsNote(&mss,buf,k2,&j);
- InsNote(&mss,buf,k,&j);
- InsNote(&mss,buf,k2,&j);
- break;
- default:
- if (last_duration!=DUR_4)
- buf[j++]='q';
- InsNote(&mss,buf,GodBits(4),&j);
- }
- last_duration=duration;
- progress4++;
- }
- buf[j++]=0;
- progress4=progress4_max=0;
- return buf;
-}
-
-public U0 GodSong()
-{//Make God generate 2measuresx2+2measuresx2. $LK+PU,"Holy Spirit Instructions",A="FI:::/Adam/God/HSNotes.DD"$
- U8 *st1=GodSongStr,*st2=GodSongStr;
- if (st1 && st2)
- DocPrint(DocPut,"$SO,\"<Song>\",A=\"%s%s%s%s\"$",st1,st1,st2,st2);
- Free(st1);
- Free(st2);
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/God/HolySpirit.HC.HTML b/public/src/Adam/God/HolySpirit.HC.HTML deleted file mode 100644 index baf56ac..0000000 --- a/public/src/Adam/God/HolySpirit.HC.HTML +++ /dev/null @@ -1,171 +0,0 @@ - - - - - HolySpirit.HC - - - - - #help_index "God"
-U8 *TimeStampCB(CDoc *,CDocEntry *,CTask *mem_task)
-{
- U8 *st=MAlloc(64,mem_task);
- StrPrint(st,"%X",GetTSC>>GOD_BAD_BITS);
- return st;
-}
-
-U8 *KbdMsTimeCB(CDoc *,CDocEntry *,CTask *mem_task)
-{
- U8 *st=MAlloc(64,mem_task);
- StrPrint(st,"%X",KbdMsEvtTime>>GOD_BAD_BITS);
- return st;
-}
-
-I64 PopUpTimerOk(U8 *header=NULL,U8 *footer=NULL)
-{
- I64 i;
- CDocEntry *doc_e;
- CDoc *doc=DocNew;
- if (header) DocPrint(doc,"%s",header);
- doc_e=DocPrint(doc,"\nTimer:$TX+TC,\"\"$");
- doc_e->tag_cb=&TimeStampCB;
- doc_e=DocPrint(doc,"\nLatch:$TX+TC,\"\"$");
- doc_e->tag_cb=&KbdMsTimeCB;
- DocPrint(doc,"\n$CM+CX,0,4$$BT,\"OKAY\",LE=1$\n");
- if (footer) DocPrint(doc,"%s",footer);
- i=PopUpMenu(doc);
- DocDel(doc);
- return i;
-}
-
-I64 GodPick(U8 *msg=NULL)
-{//GOD_GOOD_BITS
- U8 *st=MStrPrint("%s\n\nPress $GREEN$OKAY$FG$ to generate \n"
- "a random num from a timer.\n",msg);
- PopUpTimerOk(st,"\n\nThe $LK+PU,"Holy Spirit",A="FI:::/Adam/God/HSNotes.DD"$ can puppet you.\n\n");
- Free(st);
- return KbdMsEvtTime>>GOD_BAD_BITS;
-}
-
-public U0 GodBitsIns(I64 num_bits,I64 n)
-{//Insert bits into God bit fifo.
- I64 i;
- for (i=0;i<num_bits;i++) {
- FifoU8Ins(god.fifo,n&1);
- n>>=1;
- }
-}
-
-public U0 GodHexIns(U8 *st)
-{//Insert hex record into God bit fifo.
- U8 buf[2];
- if (st) {
- buf[1]=0;
- while (*buf=*st++)
- if (Bt(char_bmp_hex_numeric,*buf))
- GodBitsIns(4,rev_bits_table[Str2I64(buf,16)]>>4);
- }
-}
-
-public I64 GodBits(I64 num_bits,U8 *msg=NULL)
-{//Return N bits. If low on entropy pop-up okay.
- U8 b;
- I64 res=0;
- while (num_bits) {
- if (FifoU8Rem(god.fifo,&b)) {
- res=res<<1+b;
- num_bits--;
- } else
- GodBitsIns(GOD_GOOD_BITS,GodPick(msg));
- }
- return res;
-}
-
-public I64 GodInit(U8 *files_find_mask="/Adam/God/Vocab.DD*",U8 *fu_flags=NULL)
-{//Read God's vocab file for picking words.
- I64 i,ch,fuf_flags=0;
- U8 *buf,*ptr,*ptr2;
- CDirEntry *tmpde,*tmpde1;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F+T+O");
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
- if (fuf_flags&~FUG_FILES_FIND)
- throw('FUF');
-
- Free(god.word_file_mask);
- god.word_file_mask=StrNew(files_find_mask);
- god.word_fuf_flags=fuf_flags;
-
- tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
- i=0;
- while (tmpde) {
- if (buf=ptr=FileRead(tmpde->full_name)) {
- while (*ptr) {
- while (*ptr && !Bt(char_bmp_word,*ptr))
- ptr++;
- if (*ptr) {
- ptr2=ptr;
- while (*ptr && Bt(char_bmp_word,*ptr))
- ptr++;
- i++;
- }
- }
- Free(buf);
- }
- tmpde=tmpde->next;
- }
-
- Free(god.words);
- god.num_words=i;
- god.words=MAlloc(i*sizeof(U8 *));
-
- tmpde=tmpde1;
- i=0;
- while (tmpde) {
- if (buf=ptr=FileRead(tmpde->full_name)) {
- while (*ptr) {
- while (*ptr && !Bt(char_bmp_word,*ptr))
- ptr++;
- if (*ptr) {
- ptr2=ptr;
- while (*ptr && Bt(char_bmp_word,*ptr))
- ptr++;
- ch=*ptr;
- *ptr=0;
- god.words[i++]=StrNew(ptr2);
- *ptr=ch;
- }
- }
- Free(buf);
- }
- tmpde=tmpde->next;
- }
- DirTreeDel(tmpde1);
- return god.num_words;
-} GodInit;
-
-public U8 *GodWordStr(I64 bits=17)
-{//Make God pick a word. $LK+PU,"Holy Spirit Instructions",A="FI:::/Adam/God/HSNotes.DD"$
- if (god.num_words)
- return god.words[GodBits(bits)%god.num_words];
- else
- return NULL;
-}
-
-public U0 GodWord(I64 bits=17)
-{//Make God pick a word. $LK+PU,"Holy Spirit Instructions",A="FI:::/Adam/God/HSNotes.DD"$
- if (god.num_words)
- "%s ",god.words[GodBits(bits)%god.num_words];
-}
-
-public U0 GodBiblePassage(I64 num_lines=20)
-{//Make God pick a Bible passage. $LK+PU,"Holy Spirit Instructions",A="FI:::/Adam/God/HSNotes.DD"$
- I64 start=GodBits(21)%(ST_BIBLE_LINES-(num_lines-1))+1;
- U8 *verse=BibleLine2Verse(start);
- "%s\n\n",verse;
- Free(verse);
- BookLines(,start,num_lines);
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/God/MakeGod.HC.HTML b/public/src/Adam/God/MakeGod.HC.HTML deleted file mode 100644 index f2f06a5..0000000 --- a/public/src/Adam/God/MakeGod.HC.HTML +++ /dev/null @@ -1,21 +0,0 @@ - - - - - MakeGod.HC - - - - - Cd(__DIR__);;
-
-#help_index "God"
-#help_file "::/Doc/God"
-#include "GodBible"
-#include "HolySpirit"
-#include "GodSong"
-#include "GodDoodle"
-Cd("..");;
- - - \ No newline at end of file diff --git a/public/src/Adam/Gr/GrAsm.HC.HTML b/public/src/Adam/Gr/GrAsm.HC.HTML deleted file mode 100644 index 3576122..0000000 --- a/public/src/Adam/Gr/GrAsm.HC.HTML +++ /dev/null @@ -1,422 +0,0 @@ - - - - - GrAsm.HC - - - - - #help_index "Graphics/Misc"
-asm {
-//************************************
-_GR_UPDATE_LINE64::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
-
- MOV RAX,U64 SF_ARG2[RBP]
- MOV RSI,U64 [RAX] //rsi=src
- MOV RBX,U64 [&rev_bits_table]
- MOV RCX,U64 SF_ARG3[RBP] //rcx=d
- MOV RAX,U64 SF_ARG4[RBP]
- MOV RDI,U64 [RAX] //rdi=image
-
- MOV RAX,U64 SF_ARG1[RBP]
- MOV R8,U64 [RAX] //rbp=vga dst
-
-@@05: LODSQ
- CMP U64 [RDI],RAX
- JE @@10
- MOV U64 [RDI],RAX
- XLATB
- ROR RAX,8
- XLATB
- ROR RAX,8
- XLATB
- ROR RAX,8
- XLATB
- ROR RAX,8
- XLATB
- ROR RAX,8
- XLATB
- ROR RAX,8
- XLATB
- ROR RAX,8
- XLATB
- ROR RAX,8
- MOV U64 [R8],RAX
-@@10: ADD RDI,8
- ADD R8,8
- DEC RCX
- JNZ @@05
-
- MOV RAX,U64 SF_ARG1[RBP]
- MOV U64 [RAX],R8
- MOV RAX,U64 SF_ARG4[RBP]
- MOV U64 [RAX],RDI
- MOV RAX,U64 SF_ARG2[RBP]
- MOV U64 [RAX],RSI
- POP RDI
- POP RSI
- POP RBP
- RET1 32
-//************************************
-_GR_UPDATE_LINE64_FLUSH_CACHE::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
-
- MOV RAX,U64 SF_ARG2[RBP]
- MOV RSI,U64 [RAX] //rsi=src
- MOV RBX,U64 [&rev_bits_table]
- MOV RCX,U64 SF_ARG3[RBP] //rcx=d
- MOV RAX,U64 SF_ARG4[RBP]
- MOV RDI,U64 [RAX] //rdi=image
-
- MOV RAX,U64 SF_ARG1[RBP]
- MOV R8,U64 [RAX] //rbp=vga dst
-
-@@05: LODSQ
- MOV U64 [RDI],RAX
- XLATB
- ROR RAX,8
- XLATB
- ROR RAX,8
- XLATB
- ROR RAX,8
- XLATB
- ROR RAX,8
- XLATB
- ROR RAX,8
- XLATB
- ROR RAX,8
- XLATB
- ROR RAX,8
- XLATB
- ROR RAX,8
- MOV U64 [R8],RAX
- ADD RDI,8
- ADD R8,8
- DEC RCX
- JNZ @@05
-
- MOV RAX,U64 SF_ARG1[RBP]
- MOV U64 [RAX],R8
- MOV RAX,U64 SF_ARG4[RBP]
- MOV U64 [RAX],RDI
- MOV RAX,U64 SF_ARG2[RBP]
- MOV U64 [RAX],RSI
- POP RDI
- POP RSI
- POP RBP
- RET1 32
-//************************************
-_DC_BLOT_COLOR4::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
- PUSH R10
-
- MOV RDI,U64 SF_ARG1[RBP]
- MOV RSI,U64 SF_ARG2[RBP]
- MOV RBX,U64 SF_ARG3[RBP]
- MOV RCX,U64 SF_ARG4[RBP]
-
- MOV R8,RDI
- ADD R8,RCX
- MOV R9,R8
- ADD R9,RCX
- MOV R10,R9
- ADD R10,RCX
-
-@@5: LODSQ
- MOV RDX,U64 [RBX]
- CMP RAX,RDX
- JE I32 @@10
- MOV U64 [RBX],RAX
-
- XOR RDX,RDX
- BT RAX,7*8+0
- ADC RDX,0
- SHL1 RDX
- BT RAX,6*8+0
- ADC RDX,0
- SHL1 RDX
- BT RAX,5*8+0
- ADC RDX,0
- SHL1 RDX
- BT RAX,4*8+0
- ADC RDX,0
- SHL1 RDX
- BT RAX,3*8+0
- ADC RDX,0
- SHL1 RDX
- BT RAX,2*8+0
- ADC RDX,0
- SHL1 RDX
- BT RAX,1*8+0
- ADC RDX,0
- SHL1 RDX
- BT RAX,0*8+0
- ADC RDX,0
- MOV U8 [RDI],DL
-
- XOR RDX,RDX
- BT RAX,7*8+1
- ADC RDX,0
- SHL1 RDX
- BT RAX,6*8+1
- ADC RDX,0
- SHL1 RDX
- BT RAX,5*8+1
- ADC RDX,0
- SHL1 RDX
- BT RAX,4*8+1
- ADC RDX,0
- SHL1 RDX
- BT RAX,3*8+1
- ADC RDX,0
- SHL1 RDX
- BT RAX,2*8+1
- ADC RDX,0
- SHL1 RDX
- BT RAX,1*8+1
- ADC RDX,0
- SHL1 RDX
- BT RAX,0*8+1
- ADC RDX,0
- MOV U8 [R8],DL
-
- XOR RDX,RDX
- BT RAX,7*8+2
- ADC RDX,0
- SHL1 RDX
- BT RAX,6*8+2
- ADC RDX,0
- SHL1 RDX
- BT RAX,5*8+2
- ADC RDX,0
- SHL1 RDX
- BT RAX,4*8+2
- ADC RDX,0
- SHL1 RDX
- BT RAX,3*8+2
- ADC RDX,0
- SHL1 RDX
- BT RAX,2*8+2
- ADC RDX,0
- SHL1 RDX
- BT RAX,1*8+2
- ADC RDX,0
- SHL1 RDX
- BT RAX,0*8+2
- ADC RDX,0
- MOV U8 [R9],DL
-
- XOR RDX,RDX
- BT RAX,7*8+3
- ADC RDX,0
- SHL1 RDX
- BT RAX,6*8+3
- ADC RDX,0
- SHL1 RDX
- BT RAX,5*8+3
- ADC RDX,0
- SHL1 RDX
- BT RAX,4*8+3
- ADC RDX,0
- SHL1 RDX
- BT RAX,3*8+3
- ADC RDX,0
- SHL1 RDX
- BT RAX,2*8+3
- ADC RDX,0
- SHL1 RDX
- BT RAX,1*8+3
- ADC RDX,0
- SHL1 RDX
- BT RAX,0*8+3
- ADC RDX,0
- MOV U8 [R10],DL
-
-@@10: ADD RBX,8
-
- INC RDI
- INC R8
- INC R9
- INC R10
-
- DEC RCX
- JNZ I32 @@5
-
- POP R10
- POP RDI
- POP RSI
- POP RBP
- RET1 32
-//************************************
-_IS_PIX_COVERED0::
- PUSH RBP
- MOV RBP,RSP
-#assert FONT_WIDTH==FONT_HEIGHT==8
- MOV RCX,U64 SF_ARG3[RBP]
- SAR RCX,3
- MOV RAX,U64 SF_ARG2[RBP]
- SAR RAX,3
- MOV RDX,U64 SF_ARG1[RBP]
- IMUL2 RCX,TEXT_COLS
- MOV RBX,U64 [&gr.win_z_buf]
- MOV DX,U16 CTask.win_z_num[RDX]
- ADD RCX,RAX
- XOR RAX,RAX
- CMP DX,U16 [RBX+RCX*2]
- JAE @@05 //Jump not covered
- INC RAX
-@@05: POP RBP
- RET1 24
-//************************************
-_GR_ROP_EQU_U8_NO_CLIPPING::
-//Puts foreground char shape onto gr.dc2.
-//ch.u8[1] is color as a whole byte
-//ch ATTRf_UNDERLINE attr flag is used.
- PUSH RBP
- MOV RBP,RSP
- MOVZX RAX,U8 SF_ARG1[RBP]
- MOV RDX,U64 [&text.font]
- MOV RAX,U64 [RDX+RAX*8] //RAX is 8x8 char font data, 64-bits
- BT U64 SF_ARG1[RBP],ATTRf_UNDERLINE
- JNC @@05
- MOV RBX,0xFF00000000000000
- OR RAX,RBX
-@@05: TEST RAX,RAX
- JZ I32 @@10
-
- PUSH RSI
- PUSH RDI
- MOVZX RBX,U8 SF_ARG1+1[RBP] //Warning color is 8-bit
- MOV RDX,U64 [&gr.to_8_colors]
- MOV R8,U64 [RDX+RBX*8] //R8 is color repeated 8 times.
- MOV R9,U64 SF_ARG3[RBP] //R9 is width_internal
- MOV RDI,U64 SF_ARG2[RBP]
- MOV RSI,U64 [&gr.to_8_bits] //RSI is gr.to_8_bits
-
-// m=my_1_to_8_bits[ch&255];ch>>=8;
-// *dst=*dst&~m|c&m;
-// dst(U8 *)+=w1;
-
- MOVZX RBX,AL
- MOV RDX,U64 [RSI+RBX*8]
- SHR RAX,8
- MOV RBX,U64 [RDI]
- MOV RCX,RDX
- NOT RCX
- AND RDX,R8
- AND RCX,RBX
- OR RCX,RDX
- MOV U64 [RDI],RCX
- ADD RDI,R9
-
- MOVZX RBX,AL
- MOV RDX,U64 [RSI+RBX*8]
- SHR RAX,8
- MOV RBX,U64 [RDI]
- MOV RCX,RDX
- NOT RCX
- AND RDX,R8
- AND RCX,RBX
- OR RCX,RDX
- MOV U64 [RDI],RCX
- ADD RDI,R9
-
- MOVZX RBX,AL
- MOV RDX,U64 [RSI+RBX*8]
- SHR RAX,8
- MOV RBX,U64 [RDI]
- MOV RCX,RDX
- NOT RCX
- AND RDX,R8
- AND RCX,RBX
- OR RCX,RDX
- MOV U64 [RDI],RCX
- ADD RDI,R9
-
- MOVZX RBX,AL
- MOV RDX,U64 [RSI+RBX*8]
- SHR RAX,8
- MOV RBX,U64 [RDI]
- MOV RCX,RDX
- NOT RCX
- AND RDX,R8
- AND RCX,RBX
- OR RCX,RDX
- MOV U64 [RDI],RCX
- ADD RDI,R9
-
- MOVZX RBX,AL
- MOV RDX,U64 [RSI+RBX*8]
- SHR RAX,8
- MOV RBX,U64 [RDI]
- MOV RCX,RDX
- NOT RCX
- AND RDX,R8
- AND RCX,RBX
- OR RCX,RDX
- MOV U64 [RDI],RCX
- ADD RDI,R9
-
- MOVZX RBX,AL
- MOV RDX,U64 [RSI+RBX*8]
- SHR RAX,8
- MOV RBX,U64 [RDI]
- MOV RCX,RDX
- NOT RCX
- AND RDX,R8
- AND RCX,RBX
- OR RCX,RDX
- MOV U64 [RDI],RCX
- ADD RDI,R9
-
- MOVZX RBX,AL
- MOV RDX,U64 [RSI+RBX*8]
- SHR RAX,8
- MOV RBX,U64 [RDI]
- MOV RCX,RDX
- NOT RCX
- AND RDX,R8
- AND RCX,RBX
- OR RCX,RDX
- MOV U64 [RDI],RCX
- ADD RDI,R9
-
- MOV RDX,U64 [RSI+RAX*8]
- MOV RBX,U64 [RDI]
- MOV RCX,RDX
- NOT RCX
- AND RDX,R8
- AND RCX,RBX
- OR RCX,RDX
- MOV U64 [RDI],RCX
-
- POP RDI
- POP RSI
-@@10: POP RBP
- RET1 24
-}
-_extern _GR_ROP_EQU_U8_NO_CLIPPING U0 GrRopEquU8NoClipping(I64 ch,
- U8 *dst,I64 width_internal);
-public _extern _IS_PIX_COVERED0 Bool IsPixCovered0(
- CTask *task,I64 x,I64 y);//No clipping
-
-_extern _GR_UPDATE_LINE64 U0 GrUpdateLine64(
- U64 **_vga,U64 **_src,I64 d,U8 **_dst);
-_extern _GR_UPDATE_LINE64_FLUSH_CACHE U0 GrUpdateLine64FlushCache(
- U64 **_vga,U64 **_src,I64 d,U8 **_dst);
-_extern _DC_BLOT_COLOR4 U0 DCBlotColor4(
- U8 *dst,I64 *img,I64 *img_cache,I64 cnt);
- - - \ No newline at end of file diff --git a/public/src/Adam/Gr/GrBitMap.HC.HTML b/public/src/Adam/Gr/GrBitMap.HC.HTML deleted file mode 100644 index effef65..0000000 --- a/public/src/Adam/Gr/GrBitMap.HC.HTML +++ /dev/null @@ -1,2066 +0,0 @@ - - - - - GrBitMap.HC - - - - - #help_index "Graphics"
-
-Option(OPTf_WARN_HEADER_MISMATCH,OFF);
-public Bool GrPlot0(CDC *dc=gr.dc,I64 x,I64 y)
-{//2D. No clipping or transformation or thick.
- U8 *dst;
- I32 *db;
- I64 d,dist;
- CColorROPU32 c,color=dc->color,bkcolor=dc->bkcolor;
-
- if (dc->flags & DCF_LOCATE_NEAREST) {
- dist=DistSqrI64(x,y,dc->cur_x,dc->cur_y);
- if (dist<=dc->nearest_dist)
- dc->nearest_dist=dist;
- }
- if (dc->flags & DCF_RECORD_EXTENTS) {
- if (x<dc->min_x) dc->min_x=x;
- if (x>dc->max_x) dc->max_x=x;
- if (y<dc->min_y) dc->min_y=y;
- if (y>dc->max_y) dc->max_y=y;
- }
- if (dc->flags & DCF_DONT_DRAW)
- return TRUE;
- d=dc->width_internal*y+x;
- if (db=dc->depth_buf) {
- db+=d;
- if (0<=dc->db_z<=*db)
- *db=dc->db_z;
- else
- return TRUE;
- }
- if (color.c1.rop&(ROPBF_DITHER|ROPBF_PROBABILITY_DITHER)) {
- if (color.c1.rop&ROPBF_PROBABILITY_DITHER) {
- if (RandU16<dc->dither_probability_u16) {
- color.c1.rop=color.c0.rop;
- color.c0=color.c1;
- }
- } else {
- if ((x^y)&1) {
- color.c1.rop=color.c0.rop;
- color.c0=color.c1;
- }
- }
- }
- dst=dc->body+d;
- switch [color.c0.rop] {
- case ROPB_EQU:
- case ROPB_MONO:
- *dst=color.c0.color;
- break;
- case ROPB_COLLISION:
- c=*dst;
- if (c!=TRANSPARENT && c!=bkcolor.c0.color)
- dc->collision_cnt++;
- break;
- case ROPB_XOR:
- *dst^=color.c0.color;
- break;
- }
- return TRUE;
-}
-Option(OPTf_WARN_HEADER_MISMATCH,ON);
-
-public I64 GrPeek0(CDC *dc=gr.dc,I64 x,I64 y)
-{//2D. No clipping or transformation.
- return dc->body[dc->width_internal*y+x];
-}
-
-#help_index "Graphics;Graphics/Device Contexts"
-
-public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
-{//2D. Clipping but not transformation..
- I64 i,j,k,k1,kk,kk1,w1,h1,w2,h2,dist,
- leading_pixels,leading_pixel_mask,whole_I64s,
- trailing_pixels,trailing_pixel_mask,
- reg bit_shift,win_z_buf_line_inc,win_z_buf_line_dec,win_z_num,
- color_mask;
- U8 reg *dst,*src;
- I32 *db;
- U16 reg *win_z_buf_ptr;
- CColorROPU32 color,c,old_color;
- CTask *win_task;
-
- if (dc->flags & DCF_SCRN_BITMAP) {
- win_task=dc->win_task;
- x+=win_task->scroll_x;
- y+=win_task->scroll_y;
- }
- if (x<0)
- w1=-x;
- else
- w1=0;
- if (y<0)
- h1=-y;
- else
- h1=0;
- w2=img->width;
- h2=img->height;
- if (dc->flags & DCF_SCRN_BITMAP) {
- x+=win_task->pix_left;
- y+=win_task->pix_top;
- }
- if (dc->flags & DCF_LOCATE_NEAREST) {
- dist=DistSqrI64(x+img->width>>1,y+img->height>>1,dc->cur_x,dc->cur_y);
- if (dist<=dc->nearest_dist)
- dc->nearest_dist=dist;
- }
- if (dc->flags & DCF_SCRN_BITMAP) {
- if (x+w1<0) w1=-x;
- if (x+w2>win_task->pix_right+1)
- w2=win_task->pix_right+1-x;
-
- if (y+h1<0) h1=-y;
- if (y+h2>win_task->pix_bottom+1)
- h2=win_task->pix_bottom+1-y;
- }
- if (x+w2>dc->width)
- w2=dc->width-x;
- if (y+h2>dc->height)
- h2=dc->height-y;
- if (w1<w2<=img->width && h1<h2<=img->height) {
- if (dc->flags & DCF_RECORD_EXTENTS) {
- if (x+w1<dc->min_x) dc->min_x=x+w1;
- if (x+w2-1>dc->max_x) dc->max_x=x+w2-1;
- if (y+h1<dc->min_y) dc->min_y=y+h1;
- if (y+h2-1>dc->max_y) dc->max_y=y+h2-1;
- }
- if (dc->flags & DCF_DONT_DRAW)
- return 1;
- old_color=dc->color;
- db=dc->depth_buf;
- dc->depth_buf=NULL;
- dc->color&=~ROPF_DITHER;
- color=dc->color;
- leading_pixels=-(w1+x)&7;
- leading_pixel_mask=gr.to_8_bits[0xFF>>leading_pixels];
- bit_shift=-x&7;
- whole_I64s=(w2-w1-leading_pixels)>>3;
- if (whole_I64s<0) whole_I64s=0;
- trailing_pixels=(x+w2)&7;
- trailing_pixel_mask=gr.to_8_bits[0xFF<<trailing_pixels&0xFF];
- if (leading_pixels+trailing_pixels>w2-w1) {
- leading_pixel_mask|=trailing_pixel_mask;
- trailing_pixels=0;
- }
- switch (color.c0.rop) {
- case ROPB_COLLISION: //TODO: Might want to check win_z_buf
- color =dc->bkcolor.c0.color;
- k=h1*img->width_internal;
- k1=(h1+y)*dc->width_internal+x;
- for (j=h2-h1;j;j--) {
- for (i=w1;i<w2;i++) {
- c=dc->body[k1+i];
- if (c!=TRANSPARENT&&c!=color&&img->body[k+i]!=TRANSPARENT)
- dc->collision_cnt++;
- }
- k+=img->width_internal;
- k1+=dc->width_internal;
- }
- break;
- case ROPB_MONO:
- color_mask=gr.to_8_colors[color.c0.color];
- if (img->flags&DCF_NO_TRANSPARENTS) {
- if (!(dc->flags & DCF_SCRN_BITMAP) || dc->flags&DCF_ON_TOP)
- win_z_buf_ptr=NULL;
- else {
- win_z_num=win_task->win_z_num;
- win_z_buf_ptr=gr.win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+
- (w1+x)/FONT_WIDTH)*sizeof(U16);
- win_z_buf_line_dec=whole_I64s;
- if (leading_pixels)
- win_z_buf_line_dec++;
- if (trailing_pixels)
- win_z_buf_line_dec++;
- win_z_buf_line_dec*=sizeof(U16);
- win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
- }
- kk = h1 *img ->width_internal+w1;
- kk1=(h1+y)*dc->width_internal+x+w1;
- kk =(kk-bit_shift)&~7+bit_shift;
- bit_shift*=8;
- if (win_z_buf_ptr)
- for (j=h1;j<h2;j++) {
- src=img->body+kk&~7;
- dst=dc->body+kk1&~7;
- if (leading_pixels) {
- if (win_z_num>=*win_z_buf_ptr++) {
- if (bit_shift)
- *dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
- (*src(U64 *)++>>bit_shift|
- *src(I64 *)<<(64-bit_shift))&
- ~leading_pixel_mask&color_mask;
- else
- *dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
- *src(I64 *)++&~leading_pixel_mask&color_mask;
- } else {
- src(I64 *)++;
- dst(I64 *)++;
- }
- }
- if (bit_shift)
- for (i=0;i<whole_I64s;i++)
- if (win_z_num>=*win_z_buf_ptr++)
- *dst(I64 *)++=(*src(U64 *)++>>bit_shift|
- *src(I64 *)<<(64-bit_shift))&color_mask;
- else {
- src(I64 *)++;
- dst(I64 *)++;
- }
- else
- for (i=0;i<whole_I64s;i++)
- if (win_z_num>=*win_z_buf_ptr++)
- *dst(I64 *)++=*src(I64 *)++&color_mask;
- else {
- src(I64 *)++;
- dst(I64 *)++;
- }
- if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
- if (bit_shift)
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- (*src(U64 *)++>>bit_shift|
- *src(I64 *)<<(64-bit_shift))&
- ~trailing_pixel_mask&color_mask;
- else
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- *src(I64 *)++&~trailing_pixel_mask&color_mask;
- }
- kk +=img->width_internal;
- kk1+=dc->width_internal;
- if ((j+y)&7==7)
- win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
- else
- win_z_buf_ptr(U8 *)-=win_z_buf_line_dec;
- }
- else
- for (j=h2-h1;j;j--) {
- src=img->body+kk&~7;
- dst=dc->body+kk1&~7;
- if (leading_pixels) {
- if (bit_shift)
- *dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
- (*src(U64 *)++>>bit_shift|
- *src(I64 *)<<(64-bit_shift))&
- ~leading_pixel_mask&color_mask;
- else
- *dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
- *src(I64 *)++&~leading_pixel_mask&color_mask;
- }
- if (bit_shift)
- for (i=0;i<whole_I64s;i++)
- *dst(I64 *)++=(*src(U64 *)++>>bit_shift|
- *src(I64 *)<<(64-bit_shift))&color_mask;
- else
- for (i=0;i<whole_I64s;i++)
- *dst(I64 *)++=*src(I64 *)++&color_mask;
-
- if (trailing_pixels) {
- if (bit_shift)
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- (*src(U64 *)++>>bit_shift|
- *src(I64 *)<<(64-bit_shift))&
- ~trailing_pixel_mask&color_mask;
- else
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- *src(I64 *)++&~trailing_pixel_mask&color_mask;
- }
- kk +=img->width_internal;
- kk1+=dc->width_internal;
- }
- } else {
- k=h1*img->width_internal;
- if (!(dc->flags & DCF_SCRN_BITMAP) || dc->flags&DCF_ON_TOP) {
- for (j=h1;j<h2;j++) {
- for (i=w1;i<w2;i++)
- if (img->body[k+i])
- GrPlot0(dc,x+i,y+j);
- k+=img->width_internal;
- }
- } else {
- win_z_num =win_task->win_z_num;
- win_z_buf_ptr =gr.win_z_buf(U8 *)+
- ((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
- win_z_buf_line_dec=whole_I64s;
- if (leading_pixels)
- win_z_buf_line_dec++;
- if (trailing_pixels)
- win_z_buf_line_dec++;
- win_z_buf_line_dec*=sizeof(U16);
- win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
- for (j=h1;j<h2;j++) {
- if (win_z_num>=*win_z_buf_ptr++)
- color_mask=TRUE;
- else
- color_mask=FALSE;
- for (i=w1;i<w2;) {
- if (color_mask)
- if (img->body[k+i])
- GrPlot0(dc,x+i,y+j);
- if (!((++i+x) &7) && i<w2) {
- if (win_z_num>=*win_z_buf_ptr++)
- color_mask=TRUE;
- else
- color_mask=FALSE;
- }
- }
- if ((j+y)&7==7)
- win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
- else
- win_z_buf_ptr(U8 *)-=win_z_buf_line_dec;
- k+=img->width_internal;
- }
- }
- }
- break;
- case ROPB_EQU:
- if (img->flags&DCF_NO_TRANSPARENTS) {
- if (!(dc->flags & DCF_SCRN_BITMAP) || dc->flags&DCF_ON_TOP)
- win_z_buf_ptr=NULL;
- else {
- win_z_num=win_task->win_z_num;
- win_z_buf_ptr=gr.win_z_buf(U8 *)+
- ((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
- win_z_buf_line_dec=whole_I64s;
- if (leading_pixels)
- win_z_buf_line_dec++;
- if (trailing_pixels)
- win_z_buf_line_dec++;
- win_z_buf_line_dec*=sizeof(U16);
- win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
- }
- kk = h1 *img ->width_internal+w1;
- kk1=(h1+y)*dc->width_internal+x+w1;
- kk =(kk-bit_shift)&~7+bit_shift;
- bit_shift*=8;
- if (win_z_buf_ptr)
- for (j=h1;j<h2;j++) {
- src=img->body+kk&~7;
- dst=dc->body+kk1&~7;
- if (leading_pixels) {
- if (win_z_num>=*win_z_buf_ptr++) {
- if (bit_shift)
- *dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
- (*src(U64 *)++>>bit_shift|
- *src(I64 *)<<(64-bit_shift))&~leading_pixel_mask;
- else
- *dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
- *src(I64 *)++&~leading_pixel_mask;
- } else {
- src(I64 *)++;
- dst(I64 *)++;
- }
- }
- if (bit_shift)
- for (i=0;i<whole_I64s;i++)
- if (win_z_num>=*win_z_buf_ptr++)
- *dst(I64 *)++=*src(U64 *)++>>bit_shift|
- *src(I64 *)<<(64-bit_shift);
- else {
- src(I64 *)++;
- dst(I64 *)++;
- }
- else
- for (i=0;i<whole_I64s;i++)
- if (win_z_num>=*win_z_buf_ptr++)
- *dst(I64 *)++=*src(I64 *)++;
- else {
- src(I64 *)++;
- dst(I64 *)++;
- }
- if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
- if (bit_shift)
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- (*src(U64 *)++>>bit_shift|
- *src(I64 *)<<(64-bit_shift))&~trailing_pixel_mask;
- else
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- *src(I64 *)++&~trailing_pixel_mask;
- }
- kk +=img->width_internal;
- kk1+=dc->width_internal;
- if ((j+y)&7==7)
- win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
- else
- win_z_buf_ptr(U8 *)-=win_z_buf_line_dec;
- }
- else
- for (j=h2-h1;j;j--) {
- src=img->body+kk&~7;
- dst=dc->body+kk1&~7;
- if (leading_pixels) {
- if (bit_shift)
- *dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
- (*src(U64 *)++>>bit_shift|
- *src(I64 *)<<(64-bit_shift))&~leading_pixel_mask;
- else
- *dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
- *src(I64 *)++&~leading_pixel_mask;
- }
- if (bit_shift)
- for (i=0;i<whole_I64s;i++)
- *dst(I64 *)++=*src(U64 *)++>>bit_shift|
- *src(I64 *)<<(64-bit_shift);
- else
- for (i=0;i<whole_I64s;i++)
- *dst(I64 *)++=*src(I64 *)++;
-
- if (trailing_pixels) {
- if (bit_shift)
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- (*src(U64 *)++>>bit_shift|
- *src(I64 *)<<(64-bit_shift))&~trailing_pixel_mask;
- else
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- *src(I64 *)++&~trailing_pixel_mask;
- }
- kk +=img->width_internal;
- kk1+=dc->width_internal;
- }
- } else {
-here1a:
- k=h1*img->width_internal;
- if (!(dc->flags & DCF_SCRN_BITMAP) || dc->flags&DCF_ON_TOP) {
- for (j=h1;j<h2;j++) {
- for (i=w1;i<w2;i++) {
- c=img->body[k+i];
- if (c!=TRANSPARENT) {
- dc->color.c0.color=c;
- GrPlot0(dc,x+i,y+j);
- }
- }
- k+=img->width_internal;
- }
- } else {
- win_z_num =win_task->win_z_num;
- win_z_buf_ptr =gr.win_z_buf(U8 *)+
- ((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
- win_z_buf_line_dec=whole_I64s;
- if (leading_pixels)
- win_z_buf_line_dec++;
- if (trailing_pixels)
- win_z_buf_line_dec++;
- win_z_buf_line_dec*=sizeof(U16);
- win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
- for (j=h1;j<h2;j++) {
- if (win_z_num>=*win_z_buf_ptr++)
- color_mask=TRUE;
- else
- color_mask=FALSE;
- for (i=w1;i<w2;) {
- if (color_mask) {
- c=img->body[k+i];
- if (c!=TRANSPARENT) {
- dc->color.c0.color=c;
- GrPlot0(dc,x+i,y+j);
- }
- }
- if (!((++i+x) &7) && i<w2) {
- if (win_z_num>=*win_z_buf_ptr++)
- color_mask=TRUE;
- else
- color_mask=FALSE;
- }
- }
- if ((j+y)&7==7)
- win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
- else
- win_z_buf_ptr(U8 *)-=win_z_buf_line_dec;
- k+=img->width_internal;
- }
- }
- dc->color=color;
- }
- break;
- case ROPB_XOR:
- if (img->flags&DCF_NO_TRANSPARENTS) {
- if (!(dc->flags & DCF_SCRN_BITMAP) || dc->flags&DCF_ON_TOP)
- win_z_buf_ptr=NULL;
- else {
- win_z_num=win_task->win_z_num;
- win_z_buf_ptr=gr.win_z_buf(U8 *)+
- ((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
- win_z_buf_line_dec=whole_I64s;
- if (leading_pixels)
- win_z_buf_line_dec++;
- if (trailing_pixels)
- win_z_buf_line_dec++;
- win_z_buf_line_dec*=sizeof(U16);
- win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
- }
- kk = h1 *img ->width_internal +w1;
- kk1=(h1+y)*dc->width_internal+x+w1;
- kk =(kk-bit_shift)&~7+bit_shift;
- bit_shift*=8;
- if (win_z_buf_ptr)
- for (j=h1;j<h2;j++) {
- src=img->body+kk&~7;
- dst=dc->body+kk1&~7;
- if (leading_pixels) {
- if (win_z_num>=*win_z_buf_ptr++) {
- if (bit_shift)
- *dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
- (*dst(I64 *)^(*src(U64 *)++>>bit_shift|
- *src(I64 *)<<(64-bit_shift)))&~leading_pixel_mask;
- else
- *dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
- (*dst(I64 *)^*src(I64 *)++)&~leading_pixel_mask;
- } else {
- src(I64 *)++;
- dst(I64 *)++;
- }
- }
- if (bit_shift)
- for (i=0;i<whole_I64s;i++)
- if (win_z_num>=*win_z_buf_ptr++)
- *dst(I64 *)++^=*src(U64 *)++>>bit_shift|
- *src(I64 *)<<(64-bit_shift);
- else {
- src(I64 *)++;
- dst(I64 *)++;
- }
- else
- for (i=0;i<whole_I64s;i++)
- if (win_z_num>=*win_z_buf_ptr++)
- *dst(I64 *)++^=*src(I64 *)++;
- else {
- src(I64 *)++;
- dst(I64 *)++;
- }
- if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
- if (bit_shift)
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- (*dst(I64 *)^(*src(U64 *)++>>bit_shift|
- *src(I64 *)<<(64-bit_shift)))&~trailing_pixel_mask;
- else
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- (*dst(I64 *)^*src(I64 *)++)&~trailing_pixel_mask;
- }
- kk +=img->width_internal;
- kk1+=dc->width_internal;
- if ((j+y)&7==7)
- win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
- else
- win_z_buf_ptr(U8 *)-=win_z_buf_line_dec;
- }
- else
- for (j=h2-h1;j;j--) {
- src=img->body+kk&~7;
- dst=dc->body+kk1&~7;
- if (leading_pixels) {
- if (bit_shift)
- *dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
- (*dst(I64 *)^(*src(U64 *)++>>bit_shift|
- *src(I64 *)<<(64-bit_shift)))&~leading_pixel_mask;
- else
- *dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
- (*dst(I64 *)^*src(I64 *)++)&~leading_pixel_mask;
- }
- if (bit_shift)
- for (i=0;i<whole_I64s;i++)
- *dst(I64 *)++^=*src(U64 *)++>>bit_shift|
- *src(I64 *)<<(64-bit_shift);
- else
- for (i=0;i<whole_I64s;i++)
- *dst(I64 *)++^=*src(I64 *)++;
- if (trailing_pixels) {
- if (bit_shift)
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- (*dst(I64 *)^(*src(U64 *)++>>bit_shift|
- *src(I64 *)<<(64-bit_shift)))&~trailing_pixel_mask;
- else
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- (*dst(I64 *)^*src(I64 *)++)&~trailing_pixel_mask;
- }
- kk +=img->width_internal;
- kk1+=dc->width_internal;
- }
- } else
- goto here1a;
- break;
- }
- dc->depth_buf=db;
- dc->color=old_color;
- return 1;
- } else
- return 0;
-}
-
-#help_index "Graphics/Device Contexts"
-
-U8 *GrBitMap4ToBitMap8(U8 *dst,U8 *src,I64 src_size,I64 bkcolor)
-{
- I64 c,k,i=src_size*2,i1=i>>3;
- for (k=0;k<i;k++) {
- c=0;
- if (Bt(src ,k)) c|=1;
- if (Bt(src+i1 ,k)) c|=2;
- if (Bt(src+i1*2,k)) c|=4;
- if (Bt(src+i1*3,k)) c|=8;
- if (c==bkcolor) c=TRANSPARENT;
- *dst++=c;
- }
- return dst;
-}
-
-U8 *GrBitMap1ToBitMap8(U8 *dst,U8 *src,I64 src_size,I64 bkcolor)
-{
- I64 c,k,i=src_size*8;
- for (k=0;k<i;k++) {
- c=0;
- if (Bt(src,k)) c=COLOR_MONO;
- if (c==bkcolor) c=TRANSPARENT;
- *dst++=c;
- }
- return dst;
-}
-
-public CDC *DCExt(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2,
- CTask *task=NULL)
-{//Extract new device context rect from device context.
- CDC *res;
- CTask *win_task;
- if (x1>x2) SwapI64(&x1,&x2);
- if (y1>y2) SwapI64(&y1,&y2);
- if (dc->flags & DCF_SCRN_BITMAP) {
- win_task=dc->win_task;
- x1+=win_task->pix_left+win_task->scroll_x;
- y1+=win_task->pix_top +win_task->scroll_y;
- x2+=win_task->pix_left+win_task->scroll_x;
- y2+=win_task->pix_top +win_task->scroll_y;
- }
- res=DCNew(x2-x1+1,y2-y1+1,task);
- DCFill(res);
- GrBlot(res,-x1,-y1,dc);
- return res;
-}
-
-public CDC *DCDiff(CDC *base,CDC *update)
-{//Trim to win of what has chged.
- I64 i,x1=0,y1=0,x2=update->width-1,y2=update->height-1; //inclusive
- U32 *ptr_base,*ptr_update;
- CDC *res;
- ptr_base =base->body;
- ptr_update=update->body;
- while (y1<=y2) {
- i=update->width>>2;
- while (i--)
- if (*ptr_base++!=*ptr_update++)
- goto df_y2;
- i=update->width&3;
- while (i--)
- if (*ptr_base(U8 *)++!=*ptr_update(U8 *)++)
- goto df_y2;
- y1++;
- }
- return NULL;
-df_y2:
- ptr_base =base->body +base->width_internal *base->height;
- ptr_update=update->body+update->width_internal*update->height;
- while (y1<y2) {
- i=update->width>>2;
- while (i--)
- if (*--ptr_base!=*--ptr_update)
- goto df_x1;
- i=update->width&3;
- while (i--)
- if (*--ptr_base(U8 *)!=*--ptr_update(U8 *))
- goto df_x1;
- y2--;
- }
-df_x1:
- while (x1<x2) {
- for (i=y1;i<=y2;i++)
- if (GrPeek0(base,x1,i)!=GrPeek0(update,x1,i))
- goto df_x2;
- x1++;
- }
-df_x2:
- while (x1<x2) {
- for (i=y1;i<=y2;i++)
- if (GrPeek0(base,x2,i)!=GrPeek0(update,x2,i))
- goto df_done;
- x2--;
- }
-df_done:
- res=DCExt(update,x1,y1,x2,y2);
- res->x0=x1;
- res->y0=y1;
- return res;
-}
-
-#help_index "Graphics/Char;Char/Graphics"
-
-public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
-{//2D. Clipping but not transformation.
- U8 reg *src,reg *dst,*font_ptr;
- I64 i,m,leading_pixels,trailing_pixels,leading_pixel_mask,trailing_pixel_mask,
- j,k1,kk1,w1,h1,w2,h2,reg bit_shift,reg color_mask,dist;
- CColorROPU32 color,c;
- CTask *win_task;
-
- if (dc->flags & DCF_SCRN_BITMAP) {
- win_task=dc->win_task;
- x+=win_task->scroll_x;
- y+=win_task->scroll_y;
- }
-
- if (x<0)
- w1=-x;
- else
- w1=0;
- if (y<0)
- h1=-y;
- else
- h1=0;
- w2=FONT_WIDTH;
- h2=FONT_HEIGHT;
-
- if (dc->flags & DCF_SCRN_BITMAP) {
- x+=win_task->pix_left;
- y+=win_task->pix_top;
- }
- if (dc->flags & DCF_LOCATE_NEAREST) {
- dist=DistSqrI64(x+w2>>1,y+h2>>1,dc->cur_x,dc->cur_y);
- if (dist<=dc->nearest_dist)
- dc->nearest_dist=dist;
- }
- if (dc->flags & DCF_SCRN_BITMAP) {
- if (x+w1<0) w1=-x;
- if (x+w2>win_task->pix_right+1)
- w2=win_task->pix_right+1-x;
-
- if (y+h1<0) h1=-y;
- if (y+h2>win_task->pix_bottom+1)
- h2=win_task->pix_bottom+1-y;
- }
- if (x+w2>dc->width)
- w2=dc->width-x;
- if (y+h2>dc->height)
- h2=dc->height-y;
- if (w1<w2<=FONT_WIDTH && h1<h2<=FONT_HEIGHT) {
- if (dc->flags & DCF_RECORD_EXTENTS) {
- if (x+w1 <dc->min_x) dc->min_x=x+w1;
- if (x+w2-1>dc->max_x) dc->max_x=x+w2-1;
- if (y+h1 <dc->min_y) dc->min_y=y+h1;
- if (y+h2-1>dc->max_y) dc->max_y=y+h2-1;
- }
- if (dc->flags & DCF_DONT_DRAW)
- return 1;
- color=dc->color;
- leading_pixels=-(w1+x)&7;
- if (!leading_pixels) leading_pixels=8;
- leading_pixel_mask=gr.to_8_bits[0xFF>>leading_pixels];
- bit_shift=-x&7;
- trailing_pixels=(x+w2)&7;
- trailing_pixel_mask=gr.to_8_bits[0xFF<<trailing_pixels&0xFF];
- if (leading_pixels+trailing_pixels>w2-w1) {
- leading_pixel_mask|=trailing_pixel_mask;
- trailing_pixels=0;
- }
- font_ptr=&text.font(U8 *)[FONT_HEIGHT*ch+h1];
- if (color.c0.rop==ROPB_COLLISION) {
- m=w1&(FONT_WIDTH-1);
-#assert FONT_WIDTH==8
- color =dc->bkcolor.c0.color;
- for (i=w1;i<w2;i++,m++) {
- k1=(h1+y)*dc->width_internal+x;
- src=font_ptr;
- for (j=h2-h1;j;j--) {
- c=dc->body[k1+i];
- if (c!=TRANSPARENT && c!=color && Bt(src,m))
- dc->collision_cnt++;
- k1+=dc->width_internal;
- src++;
- }
- }
- } else {
- color_mask=gr.to_8_colors[color.c0.color];
- k1=x+w1;
- kk1=(h1+y)*dc->width_internal+k1;
- if (!(dc->flags & DCF_SCRN_BITMAP) || dc->flags&DCF_ON_TOP) {
- if (leading_pixels) {
- dst=dc->body+kk1&~7;
- src=font_ptr;
- if (bit_shift)
- src--;
- switch [color.c0.rop] {
- case ROPB_EQU:
- case ROPB_MONO:
- for (j=h2-h1;j;j--) {
- m=gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF];
- *dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
- (color_mask&m|*dst(I64 *)&~m)&~leading_pixel_mask;
- src++;
- dst+=dc->width_internal;
- }
- break;
- case ROPB_XOR:
- if (color_mask) {
- for (j=h2-h1;j;j--) {
- *dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
- (*dst(I64 *)^gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF])&
- ~leading_pixel_mask;
- src++;
- dst+=dc->width_internal;
- }
- }
- break;
- }
- kk1+=8;
- }
- if (trailing_pixels) {
- dst=dc->body+kk1&~7;
- src=font_ptr+1;
- if (bit_shift)
- src--;
- switch [color.c0.rop] {
- case ROPB_EQU:
- case ROPB_MONO:
- for (j=h2-h1;j;j--) {
- m=gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF];
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- (color_mask&m|*dst(I64 *)&~m)&~trailing_pixel_mask;
- src++;
- dst+=dc->width_internal;
- }
- break;
- case ROPB_XOR:
- if (color_mask)
- for (j=h2-h1;j;j--) {
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- (*dst(I64 *)^gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF])&
- ~trailing_pixel_mask;
- src++;
- dst+=dc->width_internal;
- }
- break;
- }
- }
- } else {
- if (leading_pixels) {
- dst=dc->body+kk1&~7;
- src=font_ptr;
- if (bit_shift)
- src--;
- switch [color.c0.rop] {
- case ROPB_EQU:
- case ROPB_MONO:
- for (j=h1;j<h2;j++) {
- if (!IsPixCovered0(win_task,k1,y+j)) {
- m=gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF];
- *dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
- (color_mask&m|*dst(I64 *)&~m)&~leading_pixel_mask;
- }
- src++;
- dst+=dc->width_internal;
- }
- break;
- case ROPB_XOR:
- if (color_mask)
- for (j=h1;j<h2;j++) {
- if (!IsPixCovered0(win_task,k1,y+j))
- *dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
- (*dst(I64 *)^gr.to_8_bits
- [*src(U16 *)>>bit_shift&0xFF])&
- ~leading_pixel_mask;
- src++;
- dst+=dc->width_internal;
- }
- break;
- }
- k1+=8;
- kk1+=8;
- }
- if (trailing_pixels) {
- dst=dc->body+kk1&~7;
- src=font_ptr+1;
- if (bit_shift)
- src--;
- switch [color.c0.rop] {
- case ROPB_EQU:
- case ROPB_MONO:
- for (j=h1;j<h2;j++) {
- if (!IsPixCovered0(win_task,k1,y+j)) {
- m=gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF];
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- (color_mask&m|*dst(I64 *)&~m)&~trailing_pixel_mask;
- }
- src++;
- dst+=dc->width_internal;
- }
- break;
- case ROPB_XOR:
- if (color_mask)
- for (j=h1;j<h2;j++) {
- if (!IsPixCovered0(win_task,k1,y+j))
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- (*dst(I64 *)^gr.to_8_bits
- [*src(U16 *)>>bit_shift&0xFF])&
- ~trailing_pixel_mask;
- src++;
- dst+=dc->width_internal;
- }
- break;
- }
- }
- }
- }
- return 1;
- } else
- return 0;
-}
-
-I64 GrPutS(CDC *dc=gr.dc,I64 x,I64 y,U8 *_s)
-{//Use GrPrint()
- I64 x0,sx=0,sy=0,res;
- if (!_s) return 0;
- x0=x;
- res=0;
- while (*_s) {
- if (*_s=='\n') {
- x=x0;
- y+=FONT_HEIGHT;
- _s++;
- } else if (*_s=='\t') {
- x=x0+CeilU64(x-x0+FONT_WIDTH,8*FONT_WIDTH);
- _s++;
- } else if (*_s(U32 *)=='$SY,') {
- if (_s[4]=='-') {
- _s++;
- sy='0'-_s[4];
- } else
- sy=_s[4]-'0';
- _s+=6;
- } else if (*_s(U32 *)=='$SX,') {
- if (_s[4]=='-') {
- _s++;
- sx='0'-_s[4];
- } else
- sx=_s[4]-'0';
- _s+=6;
- } else {
- res+=GrPutChar(dc,x+sx,y+sy,*_s);
- x+=FONT_WIDTH;
- _s++;
- }
- }
- return res;
-}
-
-I64 GrVPutS(CDC *dc=gr.dc,I64 x,I64 y,U8 *_s)
-{//Vertical Text. Use GrVPrint()
- I64 y0,sx=0,sy=0,res;
- U8 buf[2];
- if (!_s) return 0;
- y0=y;
- res=0;
- buf[1]=0;
- while (*_s) {
- if (*_s=='\n') {
- y=y0;
- x+=FONT_WIDTH;
- _s++;
- } else if (*_s=='\t') {
- y=y0+CeilU64(y-y0+FONT_HEIGHT,8*FONT_HEIGHT);
- _s++;
- } else if (*_s(U32 *)=='$SY,') {
- if (_s[4]=='-') {
- _s++;
- sx='0'-_s[4];
- } else
- sx=_s[4]-'0';
- _s+=6;
- } else if (*_s(U32 *)=='$SX,') {
- if (_s[4]=='-') {
- _s++;
- sy='0'-_s[4];
- } else
- sy=_s[4]-'0';
- _s+=6;
- } else {
- *buf=*_s++;
- res+=GrPutS(dc,x,y,buf);
- y+=FONT_HEIGHT;
- }
- }
- return res;
-}
-
-public I64 GrPrint(CDC *dc=gr.dc,I64 x,I64 y,U8 *fmt,...)
-{//2D. Clipping but not transformation.
- I64 res;
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
- res=GrPutS(dc,x,y,buf);
- Free(buf);
- return res;
-}
-
-public I64 GrVPrint(CDC *dc=gr.dc,I64 x,I64 y,U8 *fmt,...)
-{//2D. Vertical text. Clipping but not transformation.
- I64 res;
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
- res=GrVPutS(dc,x,y,buf);
- Free(buf);
- return res;
-}
-
-#help_index "Graphics"
-public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
-{//2D. Width Height. Clipping but not transformation.
-//Returns cnt of pixs changed.
- I64 i,res=0,j,k1,kk1,w1,h1,w2,h2,dist,
- leading_pixels,original_leading_pixels,whole_I64s,
- trailing_pixels,leading_pixel_mask,trailing_pixel_mask,
- win_z_buf_line_inc,win_z_buf_line_dec,win_z_num,color_mask;
- U8 reg *dst;
- U16 reg *win_z_buf_ptr;
- CColorROPU32 color,c,dither_colors;
- Bool dither,probability_dither;
- CTask *win_task;
-
- if (dc->flags & DCF_SCRN_BITMAP) {
- win_task=dc->win_task;
- x+=win_task->scroll_x;
- y+=win_task->scroll_y;
- }
-
- if (x<0)
- w1=-x;
- else
- w1=0;
- if (y<0)
- h1=-y;
- else
- h1=0;
- w2=w;
- h2=h;
-
- if (dc->flags & DCF_SCRN_BITMAP) {
- x+=win_task->pix_left;
- y+=win_task->pix_top;
- }
- if (dc->flags & DCF_LOCATE_NEAREST) {//TODO:Untested
- if (x<=dc->cur_x<=x+w && y<=dc->cur_y<=y+h)
- dist=0;
- else
- dist=DistSqrI64(x+w>>1,y+h>>1,dc->cur_x,dc->cur_y);
- if (dist<=dc->nearest_dist)
- dc->nearest_dist=dist;
- }
- if (dc->flags & DCF_SCRN_BITMAP) {
- if (x+w1<0) w1=-x;
- if (x+w2>win_task->pix_right+1)
- w2=win_task->pix_right+1-x;
-
- if (y+h1<0) h1=-y;
- if (y+h2>win_task->pix_bottom+1)
- h2=win_task->pix_bottom+1-y;
- }
- if (x+w2>dc->width)
- w2=dc->width-x;
- if (y+h2>dc->height)
- h2=dc->height-y;
- if (w1<w2<=w && h1<h2<=h) {
- if (dc->flags & DCF_RECORD_EXTENTS) {
- if (x+w1 <dc->min_x) dc->min_x=x+w1;
- if (x+w2-1>dc->max_x) dc->max_x=x+w2-1;
- if (y+h1 <dc->min_y) dc->min_y=y+h1;
- if (y+h2-1>dc->max_y) dc->max_y=y+h2-1;
- }
- if (dc->flags & DCF_DONT_DRAW)
- return TRUE;
- color=dc->color;
- if (color.c1.rop&(ROPBF_DITHER|ROPBF_PROBABILITY_DITHER)) {
- dither=TRUE;
- if (color.c1.rop&ROPBF_PROBABILITY_DITHER) {
- probability_dither=TRUE;
- color.c1.rop=color.c0.rop;
- dither_colors=color;
- } else {
- probability_dither=FALSE;
- color.c1.rop=color.c0.rop;
- }
- } else
- dither=FALSE;
- original_leading_pixels=leading_pixels=-(w1+x)&7;
- leading_pixel_mask=gr.to_8_bits[0xFF>>leading_pixels];
- whole_I64s=(w2-w1-leading_pixels)>>3;
- if (whole_I64s<0) whole_I64s=0;
- trailing_pixels=(x+w2)&7;
- trailing_pixel_mask=gr.to_8_bits[0xFF<<trailing_pixels&0xFF];
- if (leading_pixels+trailing_pixels>w2-w1) {
- leading_pixel_mask|=trailing_pixel_mask;
- leading_pixels=w2-w1; //Correct so it's right for res.
- trailing_pixels=0;
- }
- if (color.c0.rop==ROPB_COLLISION) {//TODO: Might want to check win_z_buf
- color =dc->bkcolor.c0.color;
- k1=(h1+y)*dc->width_internal+x;
- res=-dc->collision_cnt;
- for (j=h2-h1;j;j--) {
- for (i=w1;i<w2;i++) {
- c=dc->body[k1+i];
- if (c!=TRANSPARENT && c!=color)
- dc->collision_cnt++;
- }
- k1+=dc->width_internal;
- }
- res+=dc->collision_cnt;
- } else {
- if (!(dc->flags & DCF_SCRN_BITMAP) || dc->flags&DCF_ON_TOP)
- win_z_buf_ptr=NULL;
- else {
- win_z_num=win_task->win_z_num;
- win_z_buf_ptr=gr.win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+
- (w1+x)/FONT_WIDTH)*sizeof(U16);
- win_z_buf_line_dec=whole_I64s;
- if (leading_pixels)
- win_z_buf_line_dec++;
- if (trailing_pixels)
- win_z_buf_line_dec++;
- win_z_buf_line_dec*=sizeof(U16);
- win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
- }
- kk1=(h1+y)*dc->width_internal+x+w1;
- if (dither) {
- if (probability_dither) {
- if (RandU16<dc->dither_probability_u16)
- color.c0=dither_colors.c1;
- else
- color.c0=dither_colors.c0;
- switch [color.c0.rop] {
- case ROPB_EQU:
- case ROPB_MONO:
- if (win_z_buf_ptr) {
- res=0;
- for (j=h1;j<h2;j++) {
- color_mask=gr.to_8_colors[color.c0.color];
- dst=dc->body+kk1&~7;
- if (leading_pixels) {
- if (win_z_num>=*win_z_buf_ptr++) {
- *dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
- color_mask&~leading_pixel_mask;
- res+=leading_pixels;
- }
- dst(I64 *)++;
- }
- for (i=0;i<whole_I64s;i++,dst(I64 *)++)
- if (win_z_num>=*win_z_buf_ptr++) {
- *dst(I64 *)=color_mask;
- res+=8;
- }
- if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- color_mask&~trailing_pixel_mask;
- res+=trailing_pixels;
- }
- if ((j+y)&7==7)
- win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
- else
- win_z_buf_ptr(U8 *)-=win_z_buf_line_dec;
- kk1+=dc->width_internal;
- if (RandU16<dc->dither_probability_u16)
- color.c0=dither_colors.c1;
- else
- color.c0=dither_colors.c0;
- }
- } else {
- for (j=h2-h1;j;j--) {
- color_mask=gr.to_8_colors[color.c0.color];
- dst=dc->body+kk1&~7;
- if (leading_pixels)
- *dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
- color_mask&~leading_pixel_mask;
- for (i=0;i<whole_I64s;i++,dst(I64 *)++)
- *dst(I64 *)=color_mask;
- if (trailing_pixels)
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- color_mask&~trailing_pixel_mask;
- kk1+=dc->width_internal;
- if (RandU16<dc->dither_probability_u16)
- color.c0=dither_colors.c1;
- else
- color.c0=dither_colors.c0;
- }
- res=(h2-h1)*(w2-w1);
- }
- break;
- case ROPB_XOR:
- if (win_z_buf_ptr) {
- res=0;
- for (j=h1;j<h2;j++) {
- color_mask=gr.to_8_colors[color.c0.color];
- dst=dc->body+kk1&~7;
- if (leading_pixels) {
- if (win_z_num>=*win_z_buf_ptr++) {
- *dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
- *dst(I64 *)^color_mask&~leading_pixel_mask;
- res+=leading_pixels;
- }
- dst(I64 *)++;
- }
- for (i=0;i<whole_I64s;i++,dst(I64 *)++)
- if (win_z_num>=*win_z_buf_ptr++) {
- *dst(I64 *)^=color_mask;
- res+=8;
- }
- if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- *dst(I64 *)^color_mask&~trailing_pixel_mask;
- res+=trailing_pixels;
- }
- if ((j+y)&7==7)
- win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
- else
- win_z_buf_ptr(U8 *)-=win_z_buf_line_dec;
- kk1+=dc->width_internal;
- if (RandU16<dc->dither_probability_u16)
- color.c0=dither_colors.c1;
- else
- color.c0=dither_colors.c0;
- }
- } else {
- for (j=h2-h1;j;j--) {
- color_mask=gr.to_8_colors[color.c0.color];
- dst=dc->body+kk1&~7;
- if (leading_pixels)
- *dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
- *dst(I64 *)^color_mask&~leading_pixel_mask;
- for (i=0;i<whole_I64s;i++,dst(I64 *)++)
- *dst(I64 *)^=color_mask;
- if (trailing_pixels)
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- *dst(I64 *)^color_mask&~trailing_pixel_mask;
- kk1+=dc->width_internal;
- if (RandU16<dc->dither_probability_u16)
- color.c0=dither_colors.c1;
- else
- color.c0=dither_colors.c0;
- }
- res=(h2-h1)*(w2-w1);
- }
- break;
- }
- } else {
- if (((x+w1-original_leading_pixels)^(y+h1))&1)
- SwapU16(&color.c0,&color.c1);
- switch [color.c0.rop] {
- case ROPB_EQU:
- case ROPB_MONO:
- if (win_z_buf_ptr) {
- res=0;
- for (j=h1;j<h2;j++) {
- color_mask=gr.to_8_bits[0x55]&gr.to_8_colors[color.c0.color]|
- gr.to_8_bits[0xAA]&gr.to_8_colors[color.c1.color];
- dst=dc->body+kk1&~7;
- if (leading_pixels) {
- if (win_z_num>=*win_z_buf_ptr++) {
- *dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
- color_mask&~leading_pixel_mask;
- res+=leading_pixels;
- }
- dst(I64 *)++;
- }
- for (i=0;i<whole_I64s;i++,dst(I64 *)++)
- if (win_z_num>=*win_z_buf_ptr++) {
- *dst(I64 *)=color_mask;
- res+=8;
- }
- if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- color_mask&~trailing_pixel_mask;
- res+=trailing_pixels;
- }
- if ((j+y)&7==7)
- win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
- else
- win_z_buf_ptr(U8 *)-=win_z_buf_line_dec;
- kk1+=dc->width_internal;
- SwapU16(&color.c0,&color.c1);
- }
- } else {
- for (j=h2-h1;j;j--) {
- color_mask=gr.to_8_bits[0x55]&gr.to_8_colors[color.c0.color]|
- gr.to_8_bits[0xAA]&gr.to_8_colors[color.c1.color];
- dst=dc->body+kk1&~7;
- if (leading_pixels)
- *dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
- color_mask&~leading_pixel_mask;
- for (i=0;i<whole_I64s;i++,dst(I64 *)++)
- *dst(I64 *)=color_mask;
- if (trailing_pixels)
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- color_mask&~trailing_pixel_mask;
- kk1+=dc->width_internal;
- SwapU16(&color.c0,&color.c1);
- }
- res=(h2-h1)*(w2-w1);
- }
- break;
- case ROPB_XOR:
- if (win_z_buf_ptr) {
- res=0;
- for (j=h1;j<h2;j++) {
- color_mask=gr.to_8_bits[0x55]&gr.to_8_colors[color.c0.color]|
- gr.to_8_bits[0xAA]&gr.to_8_colors[color.c1.color];
- dst=dc->body+kk1&~7;
- if (leading_pixels) {
- if (win_z_num>=*win_z_buf_ptr++) {
- *dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
- *dst(I64 *)^color_mask&~leading_pixel_mask;
- res+=leading_pixels;
- }
- dst(I64 *)++;
- }
- for (i=0;i<whole_I64s;i++,dst(I64 *)++)
- if (win_z_num>=*win_z_buf_ptr++) {
- *dst(I64 *)^=color_mask;
- res+=8;
- }
- if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- *dst(I64 *)^color_mask&~trailing_pixel_mask;
- res+=trailing_pixels;
- }
- if ((j+y)&7==7)
- win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
- else
- win_z_buf_ptr(U8 *)-=win_z_buf_line_dec;
- kk1+=dc->width_internal;
- SwapU16(&color.c0,&color.c1);
- }
- } else {
- for (j=h2-h1;j;j--) {
- color_mask=gr.to_8_bits[0x55]&gr.to_8_colors[color.c0.color]|
- gr.to_8_bits[0xAA]&gr.to_8_colors[color.c1.color];
- dst=dc->body+kk1&~7;
- if (leading_pixels)
- *dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
- *dst(I64 *)^color_mask&~leading_pixel_mask;
- for (i=0;i<whole_I64s;i++,dst(I64 *)++)
- *dst(I64 *)^=color_mask;
- if (trailing_pixels)
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- *dst(I64 *)^color_mask&~trailing_pixel_mask;
- kk1+=dc->width_internal;
- SwapU16(&color.c0,&color.c1);
- }
- res=(h2-h1)*(w2-w1);
- }
- break;
- }
- }
- } else {
- color_mask=gr.to_8_colors[color.c0.color];
- switch [color.c0.rop] {
- case ROPB_EQU:
- case ROPB_MONO:
- if (win_z_buf_ptr) {
- res=0;
- for (j=h1;j<h2;j++) {
- dst=dc->body+kk1&~7;
- if (leading_pixels) {
- if (win_z_num>=*win_z_buf_ptr++) {
- *dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
- color_mask&~leading_pixel_mask;
- res+=leading_pixels;
- }
- dst(I64 *)++;
- }
- for (i=0;i<whole_I64s;i++,dst(I64 *)++)
- if (win_z_num>=*win_z_buf_ptr++) {
- *dst(I64 *)=color_mask;
- res+=8;
- }
- if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- color_mask&~trailing_pixel_mask;
- res+=trailing_pixels;
- }
- if ((j+y)&7==7)
- win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
- else
- win_z_buf_ptr(U8 *)-=win_z_buf_line_dec;
- kk1+=dc->width_internal;
- }
- } else {
- for (j=h2-h1;j;j--) {
- dst(I64 *)=dc->body+kk1&~7;
- if (leading_pixels)
- *dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
- color_mask&~leading_pixel_mask;
- for (i=0;i<whole_I64s;i++,dst(I64 *)++)
- *dst(I64 *)=color_mask;
- if (trailing_pixels)
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- color_mask&~trailing_pixel_mask;
- kk1+=dc->width_internal;
- }
- res=(h2-h1)*(w2-w1);
- }
- break;
- case ROPB_XOR:
- if (win_z_buf_ptr) {
- res=0;
- for (j=h1;j<h2;j++) {
- dst=dc->body+kk1&~7;
- if (leading_pixels) {
- if (win_z_num>=*win_z_buf_ptr++) {
- *dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
- *dst(I64 *)^color_mask&~leading_pixel_mask;
- res+=leading_pixels;
- }
- dst(I64 *)++;
- }
- for (i=0;i<whole_I64s;i++,dst(I64 *)++)
- if (win_z_num>=*win_z_buf_ptr++) {
- *dst(I64 *)^=color_mask;
- res+=8;
- }
- if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- *dst(I64 *)^color_mask&~trailing_pixel_mask;
- res+=trailing_pixels;
- }
- if ((j+y)&7==7)
- win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
- else
- win_z_buf_ptr(U8 *)-=win_z_buf_line_dec;
- kk1+=dc->width_internal;
- }
- } else {
- for (j=h2-h1;j;j--) {
- dst=dc->body+kk1&~7;
- if (leading_pixels)
- *dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
- *dst(I64 *)^color_mask&~leading_pixel_mask;
- for (i=0;i<whole_I64s;i++,dst(I64 *)++)
- *dst(I64 *)^=color_mask;
- if (trailing_pixels)
- *dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
- *dst(I64 *)^color_mask&~trailing_pixel_mask;
- kk1+=dc->width_internal;
- }
- res=(h2-h1)*(w2-w1);
- }
- break;
- }
- }
- }
- }
- return res;
-}
-
-I64 GrRayLenMinus(CDC *dc,I64 x,I64 y)
-{
-//Returns cnt of pixs changed
- I64 res=0,c,x3,y3,d;
- U8 *dst,*dst2;
- Bool not_color=ToBool(dc->flags&DCF_FILL_NOT_COLOR);
- CTask *win_task;
-
- if (dc->flags & DCF_SCRN_BITMAP) {
- win_task=dc->win_task;
- x+=win_task->scroll_x;
- y+=win_task->scroll_y;
- }
- x3=x;
- y3=y;
- if (x3<0 || y3<0)
- goto gr_done;
- if (dc->flags & DCF_SCRN_BITMAP) {
- x3+=win_task->pix_left;
- y3+=win_task->pix_top;
- if (!(0<=x3<=win_task->pix_right) || !(0<=y3<=win_task->pix_bottom) ||
- !(dc->flags&DCF_ON_TOP) && IsPixCovered0(win_task,x3,y3))
- goto gr_done;
- }
- if (x3>=dc->width || y3>=dc->height)
- goto gr_done;
-
- d=y3*dc->width_internal;
- dst2=dc->body+d;
- while (TRUE) {
- x3=x;
- if (x3&(FONT_WIDTH-1)==FONT_WIDTH-1) {
- if (dc->flags & DCF_SCRN_BITMAP) {
- if (x3<0) break;
- x3+=win_task->pix_left;
- if (!(0<=x3<=win_task->pix_right) || x3>=dc->width ||
- !(dc->flags&DCF_ON_TOP) && IsPixCovered0(win_task,x3,y3))
- break;
- } else
- if (!(0<=x3<dc->width))
- break;
- } else if (dc->flags & DCF_SCRN_BITMAP)
- x3+=win_task->pix_left;
- dst=dst2+x3;
- c=*dst;
- if (not_color) {
- if (c!=dc->color2) {
- res++;
- x--;
- } else
- break;
- } else {
- if (c==dc->color2) {
- res++;
- x--;
- } else
- break;
- }
- }
- return res;
-gr_done:
- return 0;
-}
-
-I64 GrRayLen(CDC *dc,I64 *x1,I64 y,I64 z=0,I32 *db=NULL)
-{
-//Returns cnt of pixs changed
- I64 res=0,d,x=*x1,x2,x3,y3,dist;
- Bool plot,dither,probability_dither,
- not_color=ToBool(dc->flags&DCF_FILL_NOT_COLOR);
- U8 *dst,*dst2;
- CColorROPU32 c,c2,color=dc->color,bkcolor=dc->bkcolor;
- I32 *db2;
- CTask *win_task;
-
- if (dc->flags & DCF_SCRN_BITMAP) {
- win_task=dc->win_task;
- x+=win_task->scroll_x;
- y+=win_task->scroll_y;
- z+=win_task->scroll_z;
- }
- x2=x;
- x3=x;
- y3=y;
- if (x3<0 || y3<0)
- goto gr_done;
- if (dc->flags & DCF_SCRN_BITMAP) {
- x3+=win_task->pix_left;
- y3+=win_task->pix_top;
- if (!(0<=x3<=win_task->pix_right) || !(0<=y3<=win_task->pix_bottom) ||
- !(dc->flags&DCF_ON_TOP) && IsPixCovered0(win_task,x3,y3))
- goto gr_done;
- }
- if (x3>=dc->width || y3>=dc->height)
- goto gr_done;
-
- d=dc->width_internal*y3;
- if (db) db+=d;
-
- color=dc->color;
- if (color.c1.rop&(ROPBF_DITHER|ROPBF_PROBABILITY_DITHER)) {
- dither=TRUE;
- if (color.c1.rop&ROPBF_PROBABILITY_DITHER) {
- probability_dither=TRUE;
- color.c1.rop=color.c0.rop;
- } else {
- probability_dither=FALSE;
- color.c1.rop=color.c0.rop;
- }
- } else
- dither=FALSE;
- dst2=dc->body+d;
- while (TRUE) {
- x3=x;
- if (!(x3&(FONT_WIDTH-1))) {
- if (dc->flags & DCF_SCRN_BITMAP) {
- if (x3<0) break;
- x3+=win_task->pix_left;
- if (!(0<=x3<=win_task->pix_right) || x3>=dc->width ||
- !(dc->flags&DCF_ON_TOP) && IsPixCovered0(win_task,x3,y3))
- break;
- } else {
- if (!(0<=x3<dc->width))
- break;
- }
- } else if (dc->flags & DCF_SCRN_BITMAP)
- x3+=win_task->pix_left;
-
- dst=dst2+x3;
-
- c=*dst;
- if (db) {
- db2=db+x3;
- if (0<=z<=*db2) {
- *db2=z;
- plot=TRUE;
- } else
- plot=FALSE;
- } else
- plot=TRUE;
-
- if ((not_color && c!=dc->color2 ||
- !not_color && c==dc->color2) && plot) {
- if (dc->flags & DCF_LOCATE_NEAREST) {
- dist=DistSqrI64(x3,y3,dc->cur_x,dc->cur_y);
- if (dist<=dc->nearest_dist)
- dc->nearest_dist=dist;
- }
- if (dc->flags & DCF_RECORD_EXTENTS) {
- if (x3<dc->min_x) dc->min_x=x3;
- if (x3>dc->max_x) dc->max_x=x3;
- if (y3<dc->min_y) dc->min_y=y3;
- if (y3>dc->max_y) dc->max_y=y3;
- }
- dst=dst2+x3;
-
- c=color.c0.color;
- if (dither) {
- if (probability_dither) {
- if (RandU16<dc->dither_probability_u16)
- c=color.c1.color;
- } else
- if ((x3^y3)&1)
- c=color.c1.color;
- }
- switch [color.c0.rop] {
- case ROPB_EQU:
- case ROPB_MONO:
- *dst=c;
- break;
- case ROPB_COLLISION:
- c2=*dst;
- if (c2!=TRANSPARENT && c2!=bkcolor.c0.color)
- dc->collision_cnt++;
- break;
- case ROPB_XOR:
- *dst^=c;
- break;
- }
- res++;
- x++;
- } else
- break;
- }
- if (dc->flags & DCF_SCRN_BITMAP)
- *x1=x-1-win_task->scroll_x;
- else
- *x1=x-1;
- x=x2-1;
- while (TRUE) {
- x3=x;
- if (x3&(FONT_WIDTH-1)==FONT_WIDTH-1) {
- if (dc->flags & DCF_SCRN_BITMAP) {
- if (x3<0) break;
- x3+=win_task->pix_left;
- if (!(0<=x3<=win_task->pix_right) || x3>=dc->width ||
- !(dc->flags&DCF_ON_TOP) && IsPixCovered0(win_task,x3,y3))
- break;
- } else
- if (!(0<=x3<dc->width))
- break;
- } else if (dc->flags & DCF_SCRN_BITMAP)
- x3+=win_task->pix_left;
-
- dst=dst2+x3;
- c=*dst;
- if (db) {
- db2=db+x3;
- if (0<=z<=*db2) {
- *db2=z;
- plot=TRUE;
- } else
- plot=FALSE;
- } else
- plot=TRUE;
-
- if ((not_color && c!=dc->color2 ||
- !not_color && c==dc->color2) && plot) {
- if (dc->flags & DCF_LOCATE_NEAREST) {
- dist=DistSqrI64(x3,y3,dc->cur_x,dc->cur_y);
- if (dist<=dc->nearest_dist)
- dc->nearest_dist=dist;
- }
- if (dc->flags & DCF_RECORD_EXTENTS) {
- if (x3<dc->min_x) dc->min_x=x3;
- if (x3>dc->max_x) dc->max_x=x3;
- if (y3<dc->min_y) dc->min_y=y3;
- if (y3>dc->max_y) dc->max_y=y3;
- }
- dst=dst2+x3;
-
- c=color.c0.color;
- if (dither) {
- if (probability_dither) {
- if (RandU16<dc->dither_probability_u16)
- c=color.c1.color;
- } else
- if ((x3^y3)&1)
- c=color.c1.color;
- }
- switch [color.c0.rop] {
- case ROPB_EQU:
- case ROPB_MONO:
- *dst=c;
- break;
- case ROPB_COLLISION:
- c2=*dst;
- if (c2!=TRANSPARENT && c2!=bkcolor.c0.color)
- dc->collision_cnt++;
- break;
- case ROPB_XOR:
- *dst^=c;
- break;
- }
- res++;
- x--;
- } else
- break;
- }
- return res;
-gr_done:
- return 0;
-}
-
-public I64 GrHLine(CDC *dc=gr.dc,I64 x1,I64 x2,I64 y,I64 z1=0,I64 z2=0)
-{//3D. No transformation or thick.
-//Returns cnt of pixs changed
- //Uses fixed-point.
- I64 dist,dx,dz,z,res=0,i,j,d;
- U8 *dst;
- CColorROPU32 c,c2,color=dc->color,bkcolor=dc->bkcolor,dither_colors;
- I32 *db;
- Bool plot=TRUE,char_clear,dither,probability_dither;
- CTask *win_task;
-
- if (!dc->depth_buf) {
- if (x2<x1) SwapI64(&x1,&x2);
- return GrRect(dc,x1,y,x2-x1+1,1);
- }
-
- if (dc->flags & DCF_SCRN_BITMAP) {
- win_task=dc->win_task;
- x1+=win_task->scroll_x;
- x2+=win_task->scroll_x;
- y +=win_task->scroll_y;
- z1+=win_task->scroll_z;
- z2+=win_task->scroll_z;
- }
- if (dc->flags & DCF_RECORD_EXTENTS) {
- if (x1<dc->min_x) dc->min_x=x1;
- if (x1>dc->max_x) dc->max_x=x1;
- if (x2<dc->min_x) dc->min_x=x2;
- if (x2>dc->max_x) dc->max_x=x2;
- if (y<dc->min_y) dc->min_y=y;
- if (y>dc->max_y) dc->max_y=y;
- }
- if (y<0) goto gr_done;
- if (x2<x1) {
- SwapI64(&x1,&x2);
- SwapI64(&z1,&z2);
- }
- if (x2<0)
- goto gr_done;
- if (x1<0) {
- i=-x1;
- x1=0;
- } else
- i=0;
- j=0;
- if (dc->flags & DCF_SCRN_BITMAP) {
- x1+=win_task->pix_left;
- x2+=win_task->pix_left;
- if (x1>win_task->pix_right)
- goto gr_done;
- if (x2>win_task->pix_right) {
- j=x2-win_task->pix_right;
- x2=win_task->pix_right;
- }
- y+=win_task->pix_top;
- if (!(0<=y<=win_task->pix_bottom) || x2<0)
- goto gr_done;
- }
- if (x1>=dc->width || y>=dc->height)
- goto gr_done;
- dx=x2+j-(x1-i);
- d=dc->width_internal*y+x1;
- if (db=dc->depth_buf) {
- db+=d;
- if (dx)
- dz=(z2-z1)<<32/dx;
- else
- dz=0;
- z=z1<<32;
- }
- if (i)
- z+=i*dz;
- if (x2>=dc->width)
- x2=dc->width-1;
-
- if (dc->flags & DCF_LOCATE_NEAREST) {
- if (x1<=dc->cur_x<=x2)
- dist=0;
- else if (dc->cur_x<x1)
- dist=SqrI64(x1-dc->cur_x);
- else
- dist=SqrI64(dc->cur_x-x2);
- dist+=SqrI64(y-dc->cur_y);
- if (dist<=dc->nearest_dist)
- dc->nearest_dist=dist;
- }
- if (dc->flags & DCF_DONT_DRAW)
- goto gr_done;
-
- if (!(dc->flags & DCF_SCRN_BITMAP) ||
- win_task->next_task==sys_winmgr_task ||
- dc->flags&DCF_ON_TOP || !IsPixCovered0(win_task,x1,y))
- char_clear=TRUE;
- else
- char_clear=FALSE;
- if (color.c1.rop&(ROPBF_DITHER|ROPBF_PROBABILITY_DITHER)) {
- dither=TRUE;
- if (color.c1.rop&ROPBF_PROBABILITY_DITHER) {
- probability_dither=TRUE;
- color.c1.rop=color.c0.rop;
- dither_colors=color;
- if (RandU16<dc->dither_probability_u16)
- color.c0=dither_colors.c1;
- else
- color.c0=dither_colors.c0;
- } else {
- probability_dither=FALSE;
- color.c1.rop=color.c0.rop;
- if ((x1^y)&1)
- SwapU16(&color.c0,&color.c1);
- }
- } else
- dither=FALSE;
- while (x1<=x2) {
- if (char_clear) {
- if (db) {
- if (0<=z.i32[1]<=*db) {
- *db=z.i32[1];
- plot=TRUE;
- } else
- plot=FALSE;
- }
- if (plot) {
- dst=dc->body+d;
- c=color.c0.color;
- switch [color.c0.rop] {
- case ROPB_EQU:
- case ROPB_MONO:
- *dst=c;
- break;
- case ROPB_COLLISION:
- c2=*dst;
- if (c2!=TRANSPARENT && c2!=bkcolor.c0.color)
- dc->collision_cnt++;
- break;
- case ROPB_XOR:
- *dst^=c;
- break;
- }
- res++;
- }
- }
- if (dither) {
- if (probability_dither) {
- if (RandU16<dc->dither_probability_u16)
- color.c0=dither_colors.c1;
- else
- color.c0=dither_colors.c0;
- } else
- SwapU16(&color.c0,&color.c1);
- }
- d++;
- x1++;
- if (db)
- db++;
- z+=dz;
- if (!(x1&(FONT_WIDTH-1)) && x1<=x2) {
- if (!(dc->flags & DCF_SCRN_BITMAP)||
- win_task->next_task==sys_winmgr_task ||
- dc->flags&DCF_ON_TOP || !IsPixCovered0(win_task,x1,y))
- char_clear=TRUE;
- else
- char_clear=FALSE;
- }
- }
-gr_done:
- return res;
-}
-
-public I64 GrVLine(CDC *dc=gr.dc,I64 x,I64 y1,I64 y2,I64 z1=0,I64 z2=0)
-{//3D. No transformation or thick.
-//Returns cnt of pixs changed
- //Uses fixed-point.
- I64 dist,dy,dz,z,res=0,i,j,d;
- U8 *dst;
- CColorROPU32 c,c2,color=dc->color,bkcolor=dc->bkcolor,dither_colors;
- I32 *db;
- Bool plot=TRUE,char_clear,dither,probability_dither;
- CTask *win_task;
-
- if (!dc->depth_buf) {
- if (y2<y1) SwapI64(&y1,&y2);
- return GrRect(dc,x,y1,1,y2-y1+1);
- }
-
- if (dc->flags & DCF_SCRN_BITMAP) {
- win_task=dc->win_task;
- x +=win_task->scroll_x;
- y1+=win_task->scroll_y;
- y2+=win_task->scroll_y;
- z1+=win_task->scroll_z;
- z2+=win_task->scroll_z;
- }
- if (dc->flags & DCF_RECORD_EXTENTS) {
- if (x<dc->min_x) dc->min_x=x;
- if (x>dc->max_x) dc->max_x=x;
- if (y1<dc->min_y) dc->min_y=y1;
- if (y1>dc->max_y) dc->max_y=y1;
- if (y2<dc->min_y) dc->min_y=y2;
- if (y2>dc->max_y) dc->max_y=y2;
- }
- if (x<0) goto gr_done;
- if (y2<y1) {
- SwapI64(&y1,&y2);
- SwapI64(&z1,&z2);
- }
- if (y2<0)
- goto gr_done;
- if (y1<0) {
- i=-y1;
- y1=0;
- } else
- i=0;
- j=0;
- if (dc->flags & DCF_SCRN_BITMAP) {
- y1+=win_task->pix_top;
- y2+=win_task->pix_top;
- if (y1>win_task->pix_bottom)
- goto gr_done;
- if (y2>win_task->pix_bottom) {
- j=y2-win_task->pix_bottom;
- y2=win_task->pix_bottom;
- }
- x+=win_task->pix_left;
- if (!(0<=x<=win_task->pix_right) || y2<0)
- goto gr_done;
- }
- if (y1>=dc->height || x>=dc->width)
- goto gr_done;
- dy=y2+j-(y1-i);
- d=dc->width_internal*y1+x;
- if (db=dc->depth_buf) {
- db+=d;
- if (dy)
- dz=(z2-z1)<<32/dy;
- else
- dz=0;
- z=z1<<32;
- }
- if (i)
- z+=i*dz;
- if (y2>=dc->height)
- y2=dc->height-1;
-
- if (dc->flags & DCF_LOCATE_NEAREST) {
- if (y1<=dc->cur_y<=y2)
- dist=0;
- else if (dc->cur_y<y1)
- dist=SqrI64(y1-dc->cur_y);
- else
- dist=SqrI64(dc->cur_y-y2);
- dist+=SqrI64(x-dc->cur_x);
- if (dist<=dc->nearest_dist)
- dc->nearest_dist=dist;
- }
- if (dc->flags & DCF_DONT_DRAW)
- goto gr_done;
-
- if (!(dc->flags & DCF_SCRN_BITMAP) ||
- win_task->next_task==sys_winmgr_task ||
- dc->flags&DCF_ON_TOP || !IsPixCovered0(win_task,x,y1))
- char_clear=TRUE;
- else
- char_clear=FALSE;
- if (color.c1.rop&(ROPBF_DITHER|ROPBF_PROBABILITY_DITHER)) {
- dither=TRUE;
- if (color.c1.rop&ROPBF_PROBABILITY_DITHER) {
- probability_dither=TRUE;
- color.c1.rop=color.c0.rop;
- dither_colors=color;
- if (RandU16<dc->dither_probability_u16)
- color.c0=dither_colors.c1;
- else
- color.c0=dither_colors.c0;
- } else {
- probability_dither=FALSE;
- color.c1.rop=color.c0.rop;
- if ((x^y1)&1)
- SwapU16(&color.c0,&color.c1);
- }
- } else
- dither=FALSE;
- while (y1<=y2) {
- if (char_clear) {
- if (db) {
- if (0<=z.i32[1]<=*db) {
- *db=z.i32[1];
- plot=TRUE;
- } else
- plot=FALSE;
- }
- if (plot) {
- dst=dc->body+d;
- c=color.c0.color;
- switch [color.c0.rop] {
- case ROPB_EQU:
- case ROPB_MONO:
- *dst=c;
- break;
- case ROPB_COLLISION:
- c2=*dst;
- if (c2!=TRANSPARENT && c2!=bkcolor.c0.color)
- dc->collision_cnt++;
- break;
- case ROPB_XOR:
- *dst^=c;
- break;
- }
- res++;
- }
- }
- if (dither) {
- if (probability_dither) {
- if (RandU16<dc->dither_probability_u16)
- color.c0=dither_colors.c1;
- else
- color.c0=dither_colors.c0;
- } else
- SwapU16(&color.c0,&color.c1);
- }
- d+=dc->width_internal;
- y1++;
- if (db)
- db+=dc->width_internal;
- z+=dz;
- if (!(y1&(FONT_HEIGHT-1)) && y1<=y2) {
- if (!(dc->flags & DCF_SCRN_BITMAP)||
- win_task->next_task==sys_winmgr_task ||
- dc->flags&DCF_ON_TOP || !IsPixCovered0(win_task,x,y1))
- char_clear=TRUE;
- else
- char_clear=FALSE;
- }
- }
-gr_done:
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Gr/GrComposites.HC.HTML b/public/src/Adam/Gr/GrComposites.HC.HTML deleted file mode 100644 index 5995d90..0000000 --- a/public/src/Adam/Gr/GrComposites.HC.HTML +++ /dev/null @@ -1,356 +0,0 @@ - - - - - GrComposites.HC - - - - - #help_index "Graphics"
-public I64 GrFillPoly3(CDC *dc=gr.dc,I64 n,CD3I32 *poly)
-{//3D. Must be convex.
-//Returns cnt of pixs changed
- CD3I32 tri[3];
- I64 i,j,x,y,z,res=0;
- if (n<3) return 0;
- if (dc->flags & DCF_SYMMETRY) {
- for (i=1;i<n-1;i++) {
- j=i-1;
- if (i==1) {
- x=poly[j].x; y=poly[j].y; z=poly[j].z;
- if (dc->flags&DCF_TRANSFORMATION)
- (*dc->transform)(dc,&x,&y,&z);
- DCReflect(dc,&x,&y,&z);
- tri[0].x=x; tri[0].y=y; tri[0].z=z;
- }
-
- j++;
- if (i==1) {
- x=poly[j].x; y=poly[j].y; z=poly[j].z;
- if (dc->flags&DCF_TRANSFORMATION)
- (*dc->transform)(dc,&x,&y,&z);
- DCReflect(dc,&x,&y,&z);
- }
- tri[1].x=x; tri[1].y=y; tri[1].z=z;
-
- j++;
- x=poly[j].x; y=poly[j].y; z=poly[j].z;
- if (dc->flags&DCF_TRANSFORMATION)
- (*dc->transform)(dc,&x,&y,&z);
- DCReflect(dc,&x,&y,&z);
- tri[2].x=x; tri[2].y=y; tri[2].z=z;
-
- res+=GrFillTri0(dc,&tri[0],&tri[1],&tri[2]);
- }
- }
- if (dc->flags&DCF_JUST_MIRROR)
- return res;
- for (i=1;i<n-1;i++) {
- j=i-1;
- if (i==1) {
- x=poly[j].x; y=poly[j].y; z=poly[j].z;
- if (dc->flags&DCF_TRANSFORMATION)
- (*dc->transform)(dc,&x,&y,&z);
- tri[0].x=x; tri[0].y=y; tri[0].z=z;
- }
-
- j++;
- if (i==1) {
- x=poly[j].x; y=poly[j].y; z=poly[j].z;
- if (dc->flags&DCF_TRANSFORMATION)
- (*dc->transform)(dc,&x,&y,&z);
- }
- tri[1].x=x; tri[1].y=y; tri[1].z=z;
-
- j++;
- x=poly[j].x; y=poly[j].y; z=poly[j].z;
- if (dc->flags&DCF_TRANSFORMATION)
- (*dc->transform)(dc,&x,&y,&z);
- tri[2].x=x; tri[2].y=y; tri[2].z=z;
-
- res+=GrFillTri0(dc,&tri[0],&tri[1],&tri[2]);
- }
- return res;
-}
-
-public I64 GrRectB(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2)
-{//2D. Two point. Clipping but not transformation.
- if (x2<x1) SwapI64(&x1,&x2);
- if (y2<y1) SwapI64(&y1,&y2);
- return GrRect(dc,x1,y1,x2-x1+1,y2-y1+1);
-}
-
-public I64 GrRect3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,I64 w,I64 h)
-{//3D. Width Height. Clipping and transformation.
- CD3I32 poly[4];
- poly[0].x=x;
- poly[0].y=y;
- poly[0].z=z;
- poly[1].x=x+w;
- poly[1].y=y;
- poly[1].z=z;
- poly[2].x=x+w;
- poly[2].y=y+h;
- poly[2].z=z;
- poly[3].x=x;
- poly[3].y=y+h;
- poly[3].z=z;
- return GrFillPoly3(dc,4,poly);
-}
-
-public U0 GrBorder(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2,
- I64 step=1,I64 start=0)
-{//2D. Transformation with thick.
-//Can be used with ROPF_DITHER+WHITE<<16+BLACK for dotted rect.
- GrLine3(dc,x1,y1,0,x2,y1,0,step,start);
- GrLine3(dc,x2,y1,0,x2,y2,0,step,start);
- GrLine3(dc,x2,y2,0,x1,y2,0,step,start);
- GrLine3(dc,x1,y2,0,x1,y1,0,step,start);
-}
-
-public Bool GrArrow3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,
- I64 x2,I64 y2,I64 z2,F64 w=2.75,I64 step=1,I64 start=0)
-{//3D. Transformation with thick.
- I64 _x1,_y1,_z1,_x2,_y2,_z2,dx,dy;
- F64 d;
- Bool res=FALSE,was_transform=FALSE,was_symmetry=FALSE;
- if (dc->flags & DCF_TRANSFORMATION) {
- (*dc->transform)(dc,&x1,&y1,&z1);
- (*dc->transform)(dc,&x2,&y2,&z2);
- dc->flags&=~DCF_TRANSFORMATION;
- was_transform=TRUE;
- }
- if (dc->flags & DCF_SYMMETRY) {
- _x1=x1; _y1=y1; _z1=z1;
- DCReflect(dc,&_x1,&_y1,&_z1);
- _x2=x2; _y2=y2; _z2=z2;
- DCReflect(dc,&_x2,&_y2,&_z2);
- dc->flags&=~DCF_SYMMETRY;
- res=Line(dc,_x1,_y1,_z1,_x2,_y2,_z2,&GrPlot3,step,start);
- dx=_x2-_x1; dy=_y2-_y1;
- if (d=Sqrt(dx*dx+dy*dy)) {
- d=w*dc->thick/d;
- res|=Line(dc,_x2-dx*d+dy*d+0.5,_y2-dy*d-dx*d+0.5,_z2,
- _x2,_y2,_z2,&GrPlot3,step);
- res|=Line(dc,_x2-dx*d-dy*d+0.5,_y2-dy*d+dx*d+0.5,_z2,
- _x2,_y2,_z2,&GrPlot3,step);
- }
- was_symmetry=TRUE;
- if (dc->flags&DCF_JUST_MIRROR)
- goto gr_done;
- }
- res|=Line(dc,x1,y1,z1,x2,y2,z2,&GrPlot3,step,start);
- dx=x2-x1; dy=y2-y1;
- if (d=Sqrt(dx*dx+dy*dy)) {
- d=w*dc->thick/d;
- res|=Line(dc,x2-dx*d+dy*d+0.5,y2-dy*d-dx*d+0.5,z2,
- x2,y2,z2,&GrPlot3,step);
- res|=Line(dc,x2-dx*d-dy*d+0.5,y2-dy*d+dx*d+0.5,z2,
- x2,y2,z2,&GrPlot3,step);
- }
-gr_done:
- if (was_transform)
- dc->flags|=DCF_TRANSFORMATION;
- if (was_symmetry)
- dc->flags|=DCF_SYMMETRY;
- return res;
-}
-
-#help_index "Graphics/Char;Char/Graphics"
-public Bool GrTextBox3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,U8 *s,I64 border=2)
-{//3D. Transformation. DCF_SYMMETRY is silly.
- U8 *ptr;
- I64 ch,res,w,w_max,h;
- if (!s) return FALSE;
- ptr=s;
- w=0; w_max=0; h=FONT_HEIGHT;
-
- if (dc->flags & DCF_TRANSFORMATION)
- (*dc->transform)(dc,&x1,&y1,&z1);
- while (ch=*ptr++) {
- if (ch=='\t')
- w=CeilU64(w+FONT_WIDTH,FONT_WIDTH*8);
- else if (ch=='\n') {
- if (w>w_max) w_max=w;
- w=0;
- h+=FONT_HEIGHT;
- } else
- w+=FONT_WIDTH;
- }
- if (w>w_max) w_max=w;
- res=GrPrint(dc,x1,y1,"%s",s);
- res|=GrLine(dc,x1-border ,y1-border ,x1+w_max+border,y1-border);
- res|=GrLine(dc,x1-border ,y1+h+border,x1+w_max+border,y1+h+border);
- res|=GrLine(dc,x1-border ,y1-border ,x1-border,y1+h+border);
- res|=GrLine(dc,x1+w_max+border,y1-border ,x1+w_max+border,y1+h+border);
- return ToBool(res);
-}
-
-#define DIAMOND_SLOPE_MAX 2.75
-
-public Bool GrTextDiamond3(CDC *dc=gr.dc,
- I64 x1,I64 y1,I64 z1,U8 *_s,I64 border=2)
-{//3D. Transformation. DCF_SYMMETRY is silly.
- Bool first=TRUE;
- U8 ch,*ptr,*ptr_end,*st,*s;
- I64 res=0,y,dx,dy,dx_old,dy_old,w,h=FONT_HEIGHT;
- F64 m;
- if (!_s) return FALSE;
- if (dc->flags & DCF_TRANSFORMATION)
- (*dc->transform)(dc,&x1,&y1,&z1);
-
- ptr=s=StrNew(_s);
- while (ch=*ptr) {
- if (ch=='\r'||ch=='\t')
- *ptr=CH_SPACE;
- if (ch=='\n') {
- *ptr=0;
- h+=FONT_HEIGHT;
- }
- ptr++;
- }
- ptr_end=ptr+1;
-
- y=y1-h>>1;
- dx=FONT_WIDTH +border; //Minimum
- dy=FONT_HEIGHT+border+h>>1; //Minimum
- ptr=s;
- while (ptr!=ptr_end) {
- st=ptr;
- while (*ptr++);
- StrUtil(st,SUF_REM_LEADING|SUF_REM_TRAILING);
-
- w=(StrLen(st)*FONT_WIDTH)>>1;
- if (first) {
- res|=GrPrint(dc,x1-w,y,"%s",st);
- first=FALSE;
- } else
- res|=GrPrint(dc,x1-w,y,"%s",st);
- if (w) {
- w+=border;
- do {
- dx_old=dx; dy_old=dy;
- m=ToF64(dx)/dy;
- if (m<1/DIAMOND_SLOPE_MAX) {
- dy=MaxI64(dy,Ceil(DIAMOND_SLOPE_MAX*dx));
- m=1/DIAMOND_SLOPE_MAX;
- } else if (m>DIAMOND_SLOPE_MAX) {
- dy=MaxI64(dy,Ceil(dx/DIAMOND_SLOPE_MAX));
- m=DIAMOND_SLOPE_MAX;
- }
- dx=MaxI64(dx,w+Ceil(m*AbsI64(y-y1)));
- dx=MaxI64(dx,w+Ceil(m*AbsI64(y+FONT_HEIGHT-y1)));
- } while (dx!=dx_old || dy!=dy_old);
- }
- y+=FONT_HEIGHT;
- }
- Free(s);
-
- res|=GrLine(dc,x1,y1-dy,x1+dx,y1);
- res|=GrLine(dc,x1+dx,y1,x1,y1+dy);
- res|=GrLine(dc,x1,y1+dy,x1-dx,y1);
- res|=GrLine(dc,x1-dx,y1,x1,y1-dy);
- return ToBool(res);
-}
-
-#help_index "Graphics/Mesh"
-public I64 Gr3Mesh(CDC *dc=gr.dc,I64 vertex_cnt,CD3I32 *p,
- I64 tri_cnt,CMeshTri *tri)
-{//Returns cnt of pixs changed.
- CColorROPU32 old_color=dc->color;
- I64 i,x,y,z,res=0;
- CD3I32 *pt,*pt_sym,*p_sym,*dst;
- CMeshTri *tri_sym=tri;
- if (dc->flags&DCF_TRANSFORMATION) {
- dst=pt=MAlloc(sizeof(CD3I32)*vertex_cnt);
- for (i=0;i<vertex_cnt;i++,p++,dst++) {
- x=p->x; y=p->y; z=p->z;
- (*dc->transform)(dc,&x,&y,&z);
- dst->x=x; dst->y=y; dst->z=z;
- }
- p=pt;
- } else
- pt=NULL;
-
- if (dc->flags & DCF_SYMMETRY) {
- dst=pt_sym=MAlloc(sizeof(CD3I32)*vertex_cnt);
- p_sym=p;
- for (i=0;i<vertex_cnt;i++,p_sym++,dst++) {
- x=p_sym->x; y=p_sym->y; z=p_sym->z;
- DCReflect(dc,&x,&y,&z);
- dst->x=x; dst->y=y; dst->z=z;
- }
- p_sym=pt_sym;
- for (i=0;i<tri_cnt;i++,tri_sym++) {
- (*dc->lighting)(dc,&p_sym[tri_sym->nums[0]],&p_sym[tri_sym->nums[2]],
- &p_sym[tri_sym->nums[1]],tri_sym->color);
- res+=GrFillTri0(dc,&p_sym[tri_sym->nums[0]],&p_sym[tri_sym->nums[2]],
- &p_sym[tri_sym->nums[1]]);
- }
- Free(pt_sym);
- if (dc->flags&DCF_JUST_MIRROR)
- goto mesh_done;
- }
- for (i=0;i<tri_cnt;i++,tri++) {
- (*dc->lighting)(dc,&p[tri->nums[0]],&p[tri->nums[1]],
- &p[tri->nums[2]],tri->color);
- res+=GrFillTri0(dc,&p[tri->nums[0]],&p[tri->nums[1]],&p[tri->nums[2]]);
- }
-mesh_done:
- dc->color=old_color;
- Free(pt);
- return res;
-}
-
-#help_index "Graphics/Misc;Mouse/Ptr"
-public U0 DrawStdMs(CDC *dc,I64 x,I64 y)
-{//This is a callback. See /Demo/Graphics/Grid.HC.
-//Called by DrawMs() which is
- //called by WinFinalUpdate().
- dc->thick=1;
- dc->flags&=~(DCF_TRANSFORMATION|DCF_SYMMETRY);
- GrArrow3(dc,x+8,y+8,0,x,y,0);
-}
-
-gr.fp_draw_ms=&DrawStdMs;
-
-public U0 DrawWaitMs(CDC *dc,I64 x,I64 y)
-{//This is a callback. See /Demo/Graphics/Grid.HC.
- I64 old_pen_width=dc->thick;
- CColorROPU32 old_color=dc->color;
- dc->thick=3;
- dc->color=LTRED;
- GrCircle3(dc,x,y,0,7);
- GrLine3(dc,x-6,y+6,0,x+6,y-6,0);
- dc->color=RED;
- GrCircle(dc,x,y,7);
- GrLine(dc,x-6,y+6,x+6,y-6);
- dc->thick=old_pen_width;
- dc->color=old_color;
-}
-
-#help_index "Graphics/GR Files;Graphics/Scrn"
-public Bool GRScrnCaptureRead(U8 *filename,CDC *dc=gr.dc,I64 x=0,I64 y=0)
-{//GrBlot TempleOS GR File to dc,x,y.
- CDC *dc2;
- if (dc2=GRRead(filename)) {
- dc->color=ROP_EQU;
- GrBlot(dc,x,y,dc2);
- DCDel(dc2);
- return TRUE;
- }
- return FALSE;
-}
-
-public I64 GRScrnCaptureWrite(U8 *filename,Bool include_zoom=TRUE)
-{//Capture scrn to a TempleOS GR File.
- I64 size;
- CDC *dc=DCScrnCapture(include_zoom);
- size=GRWrite(filename,dc,DCSF_COMPRESSED|DCSF_PALETTE_GET);
- DCDel(dc);
- return size;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Gr/GrDC.HC.HTML b/public/src/Adam/Gr/GrDC.HC.HTML deleted file mode 100644 index e441dca..0000000 --- a/public/src/Adam/Gr/GrDC.HC.HTML +++ /dev/null @@ -1,446 +0,0 @@ - - - - - GrDC.HC - - - - - #help_index "Graphics/Math/3D Transformation"
-#help_file "::/Doc/Transform"
-
-#define GR_SCALE (1<<32)
-
-public U0 Mat4x4MulXYZ(I64 *r,I64 *_x,I64 *_y,I64 *_z)
-{//Rotate 3D point using 4x4 matrix. Uses fixed-point.
- I64 x1,y1,z1,xx=*_x,yy=*_y,zz=*_z;
- x1=(r[0*4+0]*xx+r[0*4+1]*yy+r[0*4+2]*zz+r[0*4+3])>>32;
- y1=(r[1*4+0]*xx+r[1*4+1]*yy+r[1*4+2]*zz+r[1*4+3])>>32;
- z1=(r[2*4+0]*xx+r[2*4+1]*yy+r[2*4+2]*zz+r[2*4+3])>>32;
- *_x=x1;*_y=y1;*_z=z1;
-}
-
-public U0 DCTransform(CDC *dc,I64 *_x,I64 *_y,I64 *_z)
-{//This is the dft dc->transform() callback.
-//Uses fixed-point.
- Mat4x4MulXYZ(dc->r,_x,_y,_z);
- *_x+=dc->x;
- *_y+=dc->y;
- *_z+=dc->z;
-}
-
-public I64 *Mat4x4IdentEqu(I64 *r)
-{//Set matrix to identity. Uses fixed-point.
- MemSet(r,0,sizeof(I64)*16);
- r[0*4+0].i32[1]=1;
- r[1*4+1].i32[1]=1;
- r[2*4+2].i32[1]=1;
- r[3*4+3].i32[1]=1;
- return r;
-}
-
-public I64 *Mat4x4IdentNew(CTask *mem_task=NULL)
-{//MAlloc an identity matrix. Uses fixed-point.
- return Mat4x4IdentEqu(MAlloc(sizeof(I64)*16,mem_task));
-}
-
-public I64 Mat4x4NormSqr65536(I64 *r)
-{//Norm Squared of r.
-//(1.0/Sqrt(3))*65536=37837.22
- return SqrI64((r[0*4+0]*37838+r[0*4+1]*37838+r[0*4+2]*37838)>>32)+
- SqrI64((r[1*4+0]*37837+r[1*4+1]*37837+r[1*4+2]*37837)>>32)+
- SqrI64((r[2*4+0]*37837+r[2*4+1]*37837+r[2*4+2]*37837)>>32);
-}
-
-public U0 DCMat4x4Set(CDC *dc=NULL,I64 *r)
-{//Set device context's rot matrix. Will be Freed() in DCDel().Uses fixed-point.
-//The main purpose is to set matrix norm for thick scaling.
- //NULL as dc means gr.dc
- if (!dc) dc=gr.dc;
- dc->r=r;
- dc->r_norm=Sqrt(Mat4x4NormSqr65536(r))*65536; //scaled 32 bits
-}
-
-#help_index "Graphics/Mesh"
-public U0 DCLighting(CDC *dc,
- CD3I32 *p1,CD3I32 *p2,CD3I32 *p3,CColorROPU32 color)
-{//This is the dft dc->lighting() callback.
- CD3I32 v1,v2;
- I64 i,vn_x,vn_y,vn_z;
- F64 d;
-
- v1.x=p1->x-p2->x;
- v1.y=p1->y-p2->y;
- v1.z=p1->z-p2->z;
-
- v2.x=p3->x-p2->x;
- v2.y=p3->y-p2->y;
- v2.z=p3->z-p2->z;
-
- //V1 and V2 are vects along two sides
- //of the tri joined at p2.
-
- vn_x=v1.y*v2.z-v1.z*v2.y;
- vn_y=v1.z*v2.x-v1.x*v2.z;
- vn_z=v1.x*v2.y-v1.y*v2.x;
- if (d=Sqrt(SqrI64(vn_x)+SqrI64(vn_y)+SqrI64(vn_z)))
- d=1<<16/d;
- vn_x*=d;
- vn_y*=d;
- vn_z*=d;
-//Vn is the cross product of V1 and V3
- //which means it is perpendicular.It
- //is the normal vect to the surface.
- //It has been scaled to length 65536.
-
- //Light source has been scaled to length 65536.
- i=(vn_x*dc->ls.x+vn_y*dc->ls.y+vn_z*dc->ls.z)>>16;
-//The dot product of the light source
- //vect and the surface normal
- //gives an illumination number.
- //65536*65536>>16=65536
-
- //TempleOS will generate a random U16
- //and compare to dither_probability_u16 and
- //will pick from two colors.
- //Probability dithering does not work with thick>1 at this time.
- if (color.c0.rop&ROPBF_TWO_SIDED) {
- color.c0.rop&=~ROPBF_TWO_SIDED;
- i=AbsI64(i)<<1;
- } else
- i+=65536;
- if (color.c0.rop&ROPBF_HALF_RANGE_COLOR) {
- color.c0.rop&=~ROPBF_HALF_RANGE_COLOR;
- i>>=1;
- if (color>=8) {
- color-=8;
- i+=65536;
- }
- }
- if (i<65536) {
- dc->color=ROPF_PROBABILITY_DITHER+color<<16+BLACK;
- dc->dither_probability_u16=i;
- } else {
- dc->color=ROPF_PROBABILITY_DITHER+(color^8)<<16+color;
- dc->dither_probability_u16=i-65536;
- }
-}
-
-#help_index "Graphics/Device Contexts"
-public U0 DCFill(CDC *dc=NULL,CColorROPU32 val=TRANSPARENT)
-{//Fill entire device context with color.
- if (!dc) dc=gr.dc;
- MemSet(dc->body,val,dc->width_internal*dc->height);
-}
-
-public U0 DCClear(CDC *dc=NULL)
-{//Set entire device context image body to 0 (BLACK).
- if (!dc) dc=gr.dc;
- DCFill(dc,0);
-}
-
-public U0 DCRst(CDC *dc)
-{//Reset CDC structure members but not image body, itself.
- dc->color=BLACK;
- dc->color2=BLACK;
- dc->bkcolor=BLACK;
- dc->collision_cnt=0;
- dc->thick=1;
- dc->ls.x=37837; //1<<16/Sqrt(3)
- dc->ls.y=37837;
- dc->ls.z=37837;
- dc->x=0;
- dc->y=0;
- dc->z=0;
- dc->transform=&DCTransform;
- dc->lighting =&DCLighting;
- Mat4x4IdentEqu(dc->r);
- dc->r_norm=GR_SCALE;
- dc->flags&=~(DCF_SYMMETRY|DCF_TRANSFORMATION|DCF_JUST_MIRROR);
- MemCpy(dc->palette,gr_palette_std,sizeof(CBGR48)*COLORS_NUM);
-}
-
-public U0 DCExtentsInit(CDC *dc=NULL)
-{//Init markers for extent of next newly drawn graphics.
-//NULL means gr.dc
- //See /Demo/Graphics/Extents.HC
- //You should clear the record flag yourself
- if (!dc) dc=gr.dc;
- dc->flags|=DCF_RECORD_EXTENTS;
- dc->min_x=I64_MAX;
- dc->max_x=I64_MIN;
- dc->min_y=I64_MAX;
- dc->max_y=I64_MIN;
-}
-
-public CDC *DCAlias(CDC *dc=NULL,CTask *task=NULL)
-{//Create alias of dc, so can change pen, color, etc.
-//NULL means gr.dc
- CDC *res;
- if (!dc) dc=gr.dc;
- if (!task) task=Fs;
- if (dc->dc_signature!=DCS_SIGNATURE_VAL)
- throw('Graphics');
- res=MAlloc(sizeof(CDC),task);
- MemCpy(res,dc,sizeof(CDC));
- res->win_task=res->mem_task=task;
- res->r=MAlloc(16*sizeof(I64),task);
- DCRst(res);
- res->flags|=DCF_ALIAS;
- res->alias=dc;
- return res;
-}
-
-public CDC *DCNew(I64 width,I64 height,CTask *task=NULL,Bool null_bitmap=FALSE)
-{//Create new width x height device context.
-//Internally only allows widths which are divisible by 8.
- //Don't forget these $MA-X+PU,"sizeof(CDC)",LM="Find(\"sizeof(CDC)\",\"/*\");View;"$.
- CDC *res;
- if (!task) task=Fs;
- res=CAlloc(sizeof(CDC),task);
- res->win_task=task;
- res->mem_task=task;
- res->width=width;
- res->width_internal=(width+7)&~7;
- res->height=height;
- if (null_bitmap)
- res->flags|=DCF_DONT_DRAW;
- else
- res->body=CAlloc(res->width_internal*res->height,task);
- res->r=MAlloc(16*sizeof(I64),task);
- DCRst(res);
- res->dc_signature=DCS_SIGNATURE_VAL;
- return res;
-}
-
-public U0 DCDel(CDC *dc)
-{//Free dc, image body, rot mat and depth buf.
- if (!dc) return;
- if (dc->dc_signature!=DCS_SIGNATURE_VAL)
- throw('Graphics');
- dc->dc_signature=0;
- Free(dc->r);
- if (!(dc->flags & DCF_ALIAS))
- Free(dc->body);
- Free(dc->depth_buf);
- Free(dc);
-}
-
-public I64 DCSize(CDC *dc)
-{//Mem size of header, image body and depth buffer.
- if (dc)
- return MSize2(dc)+MSize2(dc->body)+MSize2(dc->depth_buf);
- else
- return 0;
-}
-
-public I32 *DCDepthBufRst(CDC *dc)
-{//Reset device context depth buf to far away.
- if (dc->depth_buf)
- MemSetU32(dc->depth_buf,I32_MAX,dc->width_internal*dc->height);
- return dc->depth_buf;
-}
-
-public I32 *DCDepthBufAlloc(CDC *dc)
-{//Alloc a 32-bit depth buffer for device context.
- Free(dc->depth_buf);
- dc->depth_buf=MAlloc(dc->width_internal*dc->height*sizeof(I32),dc->mem_task);
- return DCDepthBufRst(dc);
-}
-
-public CDC *DCCopy(CDC *dc,CTask *task=NULL)
-{//Alloc copy of dc, including image body, rot mat and depth buf.
- CDC *res;
- if (!dc) return NULL;
- if (dc->dc_signature!=DCS_SIGNATURE_VAL)
- throw('Graphics');
- res=MAllocIdent(dc,task);
- DCMat4x4Set(res,Mat4x4New(dc->r,task));
- res->mem_task=task;
- res->body=MAllocIdent(dc->body,task);
- res->depth_buf=MAllocIdent(dc->depth_buf,task);
- return res;
-}
-
-public U0 DCMono(CDC *dc,
- I64 quest=TRANSPARENT,I64 true_color=0,I64 false_color=COLOR_MONO)
-{//Set entire device context to one of two colors.
- I64 i;
- U8 *dst;
- dst=dc->body;
- i=dc->width_internal*dc->height;
- while (i--)
- if (*dst==quest)
- *dst++=true_color;
- else
- *dst++=false_color;
-}
-
-public I64 DCColorChg(CDC *dc,I64 src_color,I64 dst_color=TRANSPARENT)
-{//Find and replace src color with dst in device context.
- I64 i,res=0;
- U8 *dst;
- dst=dc->body;
- i=dc->width_internal*dc->height;
- while (i--)
- if (*dst==src_color) {
- *dst++=dst_color;
- res++;
- } else
- dst++;
- return res;
-}
-
-public U8 *DCSave(CDC *dc,I64 *_size=NULL,I64 dcsf_flags=DCSF_COMPRESSED)
-{//Stores device context to mem, perhaps, with compression.
- U8 *res,*ptr,*body;
- CArcCompress *arc;
- I64 body_size=dc->width_internal*dc->height,total_size,flags;
- CBGR48 palette[COLORS_NUM];
-
- if (dcsf_flags&DCSF_COMPRESSED) {
- arc=CompressBuf(dc->body,body_size);
- body_size=arc->compressed_size;
- body=arc;
- } else {
- arc=NULL;
- body=dc->body;
- }
-
- total_size=offset(CDC.end)-offset(CDC.start)+body_size;
- if (dcsf_flags&DCSF_COMPRESSED)
- flags=DCF_COMPRESSED;
- else
- flags=0;
-
- if (dcsf_flags&DCSF_PALETTE_GET)
- GrPaletteGet(palette);
- else
- MemCpy(palette,&dc->palette,COLORS_NUM*sizeof(CBGR48));
- if (MemCmp(palette,gr_palette_std,COLORS_NUM*sizeof(CBGR48))) {
- flags|=DCF_PALETTE;
- total_size+=COLORS_NUM*sizeof(CBGR48);
- }
-
- ptr=res=MAlloc(total_size);
-
-#assert !offset(CDC.start)
- MemCpy(ptr,&dc->start,offset(CDC.end)-offset(CDC.start));
- ptr(CDC *)->flags=flags;
- ptr+=offset(CDC.end)-offset(CDC.start);
-
-#assert offset(CDC.end)==offset(CDC.palette)
- if (flags&DCF_PALETTE) {
- MemCpy(ptr,palette,COLORS_NUM*sizeof(CBGR48));
- ptr+=COLORS_NUM*sizeof(CBGR48);
- }
-
- MemCpy(ptr,body,body_size);
- ptr+=body_size;
-
- Free(arc);
- if (_size) *_size=total_size;
- return res;
-}
-
-public CDC *DCLoad(U8 *src,I64 *_size=NULL,CTask *task=NULL)
-{//Loads device context from mem.
- CDC *res;
- U8 *ptr=src;
- CArcCompress *arc;
- I64 body_size;
- if (!task) task=Fs;
- res=CAlloc(sizeof(CDC),task);
- res->win_task=task;
- res->mem_task=task;
- MemCpy(&res->start,ptr,offset(CDC.end)-offset(CDC.start));
- ptr+=offset(CDC.end)-offset(CDC.start);
-
- if (res->flags&DCF_PALETTE) {
- MemCpy(&res->palette,ptr,COLORS_NUM*sizeof(CBGR48));
- ptr+=COLORS_NUM*sizeof(CBGR48);
- } else
- MemCpy(&res->palette,gr_palette_std,COLORS_NUM*sizeof(CBGR48));
-
- body_size=res->width_internal*res->height;
- if (res->flags&DCF_COMPRESSED) {
- res->flags&=~DCF_COMPRESSED;
- arc=ptr;
- res->body=ExpandBuf(arc,task);
- ptr+=arc->compressed_size;
- } else {
- res->body=MAlloc(body_size,task);
- MemCpy(res->body,ptr,body_size);
- ptr+=body_size;
- }
- res->thick=1;
- res->r=Mat4x4IdentNew(task);
- res->r_norm.u32[1]=1;
- res->dc_signature=DCS_SIGNATURE_VAL;
- if (_size) *_size=ptr-src;
- return res;
-}
-
-#help_index "Graphics/GR Files"
-#help_file "::/Doc/GRFiles"
-#help_index "Graphics/Device Contexts;Graphics/GR Files"
-
-#define GR_FILE_MAX (offset(CDC.end)-offset(CDC.start)+\
- COLORS_NUM*sizeof(CBGR48)+sizeof(CArcCtrl)+GR_WIDTH*GR_HEIGHT)
-
-public I64 GRWrite(U8 *filename,CDC *dc,I64 dcsf_flags=DCSF_COMPRESSED)
-{//TempleOS GR File.
- I64 size;
- U8 *st=ExtDft(filename,"GR.Z"),
- *src=DCSave(dc,&size,dcsf_flags);
- FileWrite(st,src,size);
- Free(st);
- Free(src);
- return size;
-}
-
-public CDC *GRRead(U8 *filename,CTask *task=NULL)
-{//TempleOS GR File.
- CDC *dc=NULL;
- U8 *st=ExtDft(filename,"GR.Z"),
- *src=FileRead(st);
- if (src)
- dc=DCLoad(src,,task);
- Free(src);
- Free(st);
- return dc;
-}
-
-#help_index "Graphics/Sprite;Graphics/GR Files;DolDoc/Output;StdOut/DolDoc"
-public U0 DocGR(CDoc *doc=NULL,U8 *filename)
-{//Put a GR file into a document as asprite.
- CDC *dc=GRRead(filename);
- CSprite *elems=DC2Sprite(dc);
- DocSprite(doc,elems);
- Free(elems);
- DCDel(dc);
-}
-
-#help_index "Graphics/Device Contexts;Graphics/Scrn"
-public CDC *DCScrnCapture(Bool include_zoom=TRUE,CTask *task=NULL)
-{//Capture scrn to a device context.
- CDC *dc;
- U8 *dst;
- Refresh(0,FALSE);
- if (include_zoom)
- dc=DCCopy(gr.scrn_image,task);
- else
- dc=DCCopy(gr.dc1,task);
- dc->flags&=~DCF_SCRN_BITMAP;
- dst=MAlloc(dc->width_internal*dc->height,task);
-//Pick background color that never occurs. COLOR_INVALID
- GrBitMap4ToBitMap8(dst,dc->body,
- (dc->width_internal*dc->height)>>1,COLOR_INVALID);
- Free(dc->body);
- dc->body=dst;
- return dc;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Gr/GrEnd.HC.HTML b/public/src/Adam/Gr/GrEnd.HC.HTML deleted file mode 100644 index 42a2a03..0000000 --- a/public/src/Adam/Gr/GrEnd.HC.HTML +++ /dev/null @@ -1,41 +0,0 @@ - - - - - GrEnd.HC - - - - - #help_index "Graphics/Scrn"
-
-U0 CtrlAltZ(I64 sc)
-{
- if (sc&SCF_SHIFT)
- GrScaleZoom(0.5);
- else
- GrScaleZoom(2.0);
-}
-CtrlAltCBSet('Z',&CtrlAltZ,"Cmd/Zoom In",
- "Cmd/Zoom Out");
-
-U0 Scrn2Clip(I64)
-{
- CDC *dc=DCScrnCapture;
- U8 *elems=DC2Sprite(dc);
- Bool unlock_doc=DocLock(sys_clip_doc);
- ClipDel;
- DocSprite(sys_clip_doc,elems);
- if (unlock_doc)
- DocUnlock(sys_clip_doc);
- Free(elems);
- DCDel(dc);
-}
-U0 CtrlAltS(I64)
-{
- Spawn(&Scrn2Clip);
-}
-CtrlAltCBSet('S',&CtrlAltS,"Cmd/Scrn Shot to Clip");
- - - \ No newline at end of file diff --git a/public/src/Adam/Gr/GrExt.HC.HTML b/public/src/Adam/Gr/GrExt.HC.HTML deleted file mode 100644 index c6ab8b4..0000000 --- a/public/src/Adam/Gr/GrExt.HC.HTML +++ /dev/null @@ -1,20 +0,0 @@ - - - - - GrExt.HC - - - - - #help_index "Graphics"
-extern U8 *GrBitMap4ToBitMap8(U8 *dst,U8 *src,I64 src_size,I64 bkcolor);
-extern I64 GrBlot3(CDC *dc,I64 x1,I64 y1,I64 z1,CDC *img);
-extern I64 *Mat4x4New(I64 *src,CTask *mem_task=NULL);
-extern U8 *SpriteQue2Sprite(CSprite *head,I64 *_size=NULL);
-extern CSprite *SpriteSetSettings(CDC *dc=NULL,CSprite *head,I64 elem_num,
- I64 x=0,I64 y=0,CColorROPU32 *_color=NULL,I64 *_thick=NULL,
- I64 *_xx=NULL,I64 *_yy=NULL);
- - - \ No newline at end of file diff --git a/public/src/Adam/Gr/GrGlbls.HC.HTML b/public/src/Adam/Gr/GrGlbls.HC.HTML deleted file mode 100644 index c284a44..0000000 --- a/public/src/Adam/Gr/GrGlbls.HC.HTML +++ /dev/null @@ -1,67 +0,0 @@ - - - - - GrGlbls.HC - - - - - #help_index "Graphics"
-
-public class CGrGlbls
-{
- I64 *to_8_bits,*to_8_colors;
- CDC *scrn_image, //Read only.
- *dc, //Persistent
- *dc1,
- *dc2, //Updated every refresh
- *dc_cache,
- *zoomed_dc;
- U32 *text_base; //See TextBase Layer. (Similar to 0xB8000 but 32 bits)
- U16 *win_z_buf;
-
- #define SPHT_ELEM_CODE 1
- CHashTable *sprite_hash;
-
- U16 *win_uncovered_bitmap;
- I64 highest_uncovered;
- U16 *vga_text_cache;
- I64 pan_text_x,pan_text_y; //[-7,7]
- U0 (*fp_final_scrn_update)(CDC *dc);//Mouse cursor is handled here.
- U0 (*fp_wall_paper)(CTask *task);
- U0 (*fp_draw_ms)(CDC *dc,I64 x,I64 y);
- U0 (*fp_draw_grab_ms)(CDC *dc,I64 x,I64 y,Bool closed);
- U8 *empty_sprite; //Gets assigned gr.empty_sprite
-
- #define GR_PEN_BRUSHES_NUM 64
- CDC *pen_brushes[GR_PEN_BRUSHES_NUM],
- *collision_pen_brushes[GR_PEN_BRUSHES_NUM],
- *even_pen_brushes[GR_PEN_BRUSHES_NUM],
- *odd_pen_brushes[GR_PEN_BRUSHES_NUM];
- I8 circle_lo[GR_PEN_BRUSHES_NUM][GR_PEN_BRUSHES_NUM],
- circle_hi[GR_PEN_BRUSHES_NUM][GR_PEN_BRUSHES_NUM];
-
- #define GR_SCRN_ZOOM_MAX 8
- U8 *scrn_zoom_tables[GR_SCRN_ZOOM_MAX+1];
- I64 scrn_zoom,sx,sy;
-
- //When zoomed, this keeps the mouse centered.
- Bool continuous_scroll,
- hide_row,hide_col;
-} gr;
-
-//See RLf_VGA
-//See SysGrInit()
-//Allows consts to be used instead of vars.
-HashPublic("GR_WIDTH",HTT_DEFINE_STR);;
-HashPublic("GR_HEIGHT",HTT_DEFINE_STR);;
-
-#help_index "Char;TextBase Layer/Char"
-DefinePrint("TEXT_ROWS","%d",text.rows);;;
-HashPublic("TEXT_ROWS",HTT_DEFINE_STR);;;
-DefinePrint("TEXT_COLS","%d",text.cols);;;
-HashPublic("TEXT_COLS",HTT_DEFINE_STR);;;
- - - \ No newline at end of file diff --git a/public/src/Adam/Gr/GrInitA.HC.HTML b/public/src/Adam/Gr/GrInitA.HC.HTML deleted file mode 100644 index c533a54..0000000 --- a/public/src/Adam/Gr/GrInitA.HC.HTML +++ /dev/null @@ -1,33 +0,0 @@ - - - - - GrInitA.HC - - - - - #help_index "Graphics"
-
-U0 GrInit1()
-{
- DefineLstLoad("ST_SPRITE_ELEM_TYPES",
- "End\0Color\0Dither Color\0"
- "Thick\0Planar Symmetry\0Transform On\0Transform Off\0Shift\0"
- "Point\0PolyPoint\0Line\0PolyLine\0Rect\0Rotated Rect\0"
- "Circle\0Ellipse\0Polygon\0BSpline2\0BSpline2 Closed\0"
- "BSpline3\0BSpline3 Closed\0"
- "Flood Fill\0Flood Fill Not Color\0BitMap\0Mesh\0Shiftable Mesh\0"
- "Arrow\0Text\0Text Box\0Text Diamond\0");
- DefineLstLoad("ST_SPRITE_ELEM_CODES",
- "End\0Color\0Color\0"
- "Thick\0PlanarSymmetry\0Transform\0Transform\0Shift\0"
- "Pt\0PolyPt\0Line\0PolyLine\0Rect\0Rect\0"
- "Circle\0Ellipse\0Polygon\0BSpline2\0BSpline2\0BSpline3\0BSpline3\0"
- "FloodFill\0FloodFill\0BitMap\0Mesh\0Mesh\0"
- "Arrow\0Text\0TextBox\0TextDiamond\0");
-}
-GrInit1;
- - - \ No newline at end of file diff --git a/public/src/Adam/Gr/GrInitB.HC.HTML b/public/src/Adam/Gr/GrInitB.HC.HTML deleted file mode 100644 index 86b0ec4..0000000 --- a/public/src/Adam/Gr/GrInitB.HC.HTML +++ /dev/null @@ -1,221 +0,0 @@ - - - - - GrInitB.HC - - - - - #help_index "Graphics/Scrn"
-
-U0 GrSetUpTables()
-{
- CDC *dc;
- I64 i,j,k,l,m,x,y,rr;
- U8 *dst;
-
- k=0;
- for (i=0;i<256;i++)
- for (j=0;j<8;j++)
- if (Bt(&i,j))
- gr.to_8_bits(U8 *)[k++]=0xFF;
- else
- gr.to_8_bits(U8 *)[k++]=0x00;
- k=0;
- for (i=0;i<256;i++)
- for (j=0;j<8;j++)
- gr.to_8_colors(U8 *)[k++]=i;
-
- for (i=0;i<GR_PEN_BRUSHES_NUM;i++) {
- k=i+1;
-
- rr=k*k;
- for (y=1;y<k;y++)
- for (x=1;x<k;x++)
- if (SqrI64(y*2-k)+SqrI64(x*2-k)<rr) {
- if (x-1-i>>1<gr.circle_lo[i][i-y])
- gr.circle_lo[i][i-y]=x-1-i>>1;
- if (x-1-i>>1>gr.circle_hi[i][i-y])
- gr.circle_hi[i][i-y]=x-1-i>>1;
- }
-
- dc=DCNew(i,i);
- gr.pen_brushes[i]=dc;
- dc->color=COLOR_MONO;
- rr=k*k;
- for (y=1;y<k;y++)
- for (x=1;x<k;x++)
- if (SqrI64(y*2-k)+SqrI64(x*2-k)<rr)
- GrPlot0(dc,x-1,y-1);
-
- dc=DCNew(i,i);
- gr.collision_pen_brushes[i]=dc;
- dc->color=COLOR_INVALID;//Want color that never occurs.
- rr=k*k;
- for (y=1;y<k;y++)
- for (x=1;x<k;x++)
- if (SqrI64(y*2-k)+SqrI64(x*2-k)<rr)
- GrPlot0(dc,x-1,y-1);
-
- dc=DCNew(i,i);
- gr.even_pen_brushes[i]=dc;
- dc->color=COLOR_MONO;
- rr=k*k;
- for (y=1;y<k;y++)
- for (x=1;x<k;x++)
- if (!(((x-1)^(y-1))&1) && SqrI64(y*2-k)+SqrI64(x*2-k)<rr)
- GrPlot0(dc,x-1,y-1);
-
- dc=DCNew(i,i);
- gr.odd_pen_brushes[i]=dc;
- dc->color=COLOR_MONO;
- rr=k*k;
- for (y=1;y<k;y++)
- for (x=1;x<k;x++)
- if (((x-1)^(y-1))&1 && SqrI64(y*2-k)+SqrI64(x*2-k)<rr)
- GrPlot0(dc,x-1,y-1);
- }
- if (!Bt(&sys_run_level,RLf_VGA)) { //if text mode
- MemSet(text.vga_text_alias,0,TEXT_ROWS*TEXT_COLS*sizeof(U16));
- MemSet(gr.vga_text_cache,0,TEXT_ROWS*TEXT_COLS*sizeof(U16));
- } else {
- OutU8(VGAP_IDX,VGAR_MAP_MASK);
- OutU8(VGAP_DATA,0x0F);
-//Virtual Box crashes on the following for some reason.
- // MemSet(text.vga_alias,0,GR_HEIGHT*GR_WIDTH>>3);
- MemSet(gr.scrn_image->body,0,GR_WIDTH*GR_HEIGHT>>1);
- }
- for (i=1;i<=GR_SCRN_ZOOM_MAX;i++) {
- dst=gr.scrn_zoom_tables[i]=MAlloc(256*i);
- for (j=0;j<256;j++) {
- m=0;
- for (k=0;k<8;k++) {
- if (Bt(&j,k)) {
- for (l=0;l<i;l++)
- Bts(&m,l+k*i);
- }
- }
- for (l=0;l<i;l++)
- dst[j+l*256]=m.u8[l];
- }
- }
-}
-
-#help_index "Graphics/Scrn;Windows"
-
-U0 WinZBufFill(CTask *task)
-{//Not public
- I64 y,t,b,l,r,w;
- if (!Bt(&task->display_flags,DISPLAYf_NO_BORDER)) {
- if (task->win_top-1>0)
- t=task->win_top-1;
- else
- t=0;
- if (task->win_bottom+1<TEXT_ROWS)
- b=task->win_bottom+1;
- else
- b=TEXT_ROWS-1;
- if (task->win_left-1>0)
- l=task->win_left-1;
- else
- l=0;
- if (task->win_right+1<TEXT_COLS)
- r=task->win_right+1;
- else
- r=TEXT_COLS-1;
- } else {
- if (task->win_top>0)
- t=task->win_top;
- else
- t=0;
- if (task->win_bottom<TEXT_ROWS)
- b=task->win_bottom;
- else
- b=TEXT_ROWS-1;
- if (task->win_left>0)
- l=task->win_left;
- else
- l=0;
- if (task->win_right<TEXT_COLS)
- r=task->win_right;
- else
- r=TEXT_COLS-1;
- }
- t=ClampI64(t,0,TEXT_ROWS-1);
- b=ClampI64(b,t,TEXT_ROWS-1);
- l=ClampI64(l,0,TEXT_COLS-1);
- r=ClampI64(r,l,TEXT_COLS-1);
- if (w=r-l+1)
- for (y=t;y<=b;y++)
- MemSetU16(gr.win_z_buf(U8 *)+(y*TEXT_COLS+l)*sizeof(U16),
- task->win_z_num,w);
-}
-
-public U0 WinZBufUpdate()
-{//Might have to call if doing graphics outside winmgr callback routines.
-//Call it if, for example, when a pop-up window closes and you need to refresh
- //before graphics.
- I64 i,z=1;
- U16 *ptr;
- CTask *task,*task1;
- if (gr.win_z_buf) {
- LBtr(&sys_semas[SEMA_UPDATE_WIN_Z_BUF],0);
- task1=task=sys_winmgr_task;
- do {
- if (!TaskValidate(task)) break;
- if (Bt(&task->display_flags,DISPLAYf_SHOW)) {
- task->win_z_num=z++;
- WinZBufFill(task);
- }
- task=task->next_task;
- } while (task!=task1 && z<0x10000);
-
- MemSet(gr.win_uncovered_bitmap,0,(gr.highest_uncovered+7)>>3+1);
- gr.highest_uncovered=z-1;
- for (ptr=gr.win_z_buf,i=TEXT_ROWS*TEXT_COLS;i;i--)
- Bts(gr.win_uncovered_bitmap,*ptr++);
- }
-}
-
-#help_index "Graphics"
-U0 GrInit2()
-{
- MemSet(&gr,0,sizeof(CGrGlbls));
- gr.sprite_hash=HashTableNew(512);
- HashDefineLstAdd("ST_SPRITE_ELEM_CODES",SPHT_ELEM_CODE,gr.sprite_hash);
- gr.scrn_zoom=1;
-
- PaletteSetStd;
- fp_set_std_palette=&PaletteSetStd;
- GrPaletteIndicesSet;
-
- gr.to_8_bits =MAlloc(256*sizeof(I64));
- gr.to_8_colors=MAlloc(256*sizeof(I64));
-
- gr.text_base=CAlloc(TEXT_ROWS*TEXT_COLS*sizeof(U32));
- gr.vga_text_cache=MAlloc(TEXT_ROWS*TEXT_COLS*sizeof(U16));
- gr.win_uncovered_bitmap=CAlloc(65536/8);
- gr.highest_uncovered=0;
- gr.win_z_buf=MAlloc(TEXT_ROWS*TEXT_COLS*sizeof(U16));
-
- gr.dc2=DCNew(GR_WIDTH,GR_HEIGHT);
- gr.dc2->flags|=DCF_SCRN_BITMAP;
- gr.dc_cache=DCNew(GR_WIDTH,GR_HEIGHT);
-
- gr.dc=DCNew(GR_WIDTH,GR_HEIGHT);
- gr.dc->flags|=DCF_SCRN_BITMAP|DCF_ON_TOP;
- DCFill;
-
- gr.dc1=DCNew(GR_WIDTH,GR_HEIGHT);
- gr.dc1->flags|=DCF_SCRN_BITMAP;
-
- gr.scrn_image=DCNew(GR_WIDTH,GR_HEIGHT); //4-bit
- gr.zoomed_dc =DCNew(GR_WIDTH,GR_HEIGHT); //4-bit
- gr.zoomed_dc->flags|=DCF_SCRN_BITMAP;
-}
-
-GrInit2;
- - - \ No newline at end of file diff --git a/public/src/Adam/Gr/GrMath.HC.HTML b/public/src/Adam/Gr/GrMath.HC.HTML deleted file mode 100644 index c9e9a6b..0000000 --- a/public/src/Adam/Gr/GrMath.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - GrMath.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Adam/Gr/GrPalette.HC.HTML b/public/src/Adam/Gr/GrPalette.HC.HTML deleted file mode 100644 index 19c7e20..0000000 --- a/public/src/Adam/Gr/GrPalette.HC.HTML +++ /dev/null @@ -1,105 +0,0 @@ - - - - - GrPalette.HC - - - - - #help_index "Graphics/Color"
-public U8 gr_rainbow_10[10]={
- BLACK,BROWN,RED,LTRED,YELLOW,GREEN,BLUE,PURPLE,LTGRAY,WHITE};
-
-DefineLstLoad("ST_RAINBOW_10",
- "BLACK\0BROWN\0RED\0LTRED\0YELLOW\0GREEN\0BLUE\0PURPLE\0LTGRAY\0WHITE\0");
-
-U0 GrPaletteIndicesSet()
-{//There is a level of indirection that we identity map.
-// Set 16-colors to use first 16 DAC BGR entries, so we
-// never need to worry about indexes, just DAC palette settings.
- I64 i;
- if (!Bt(&sys_run_level,RLf_VGA)) return;
- PUSHFD
- CLI
- while (LBts(&sys_semas[SEMA_VGA],0))
- Yield;
- InU8(VGAP_INPUT_STAT); //Rsts attr index/data
- for (i=0;i<COLORS_NUM;i++) {
- OutU8(VGAP_ATTR_INDEX,i);
- OutU8(VGAP_ATTR_DATA_WRITE,i);
- }
- OutU8(VGAP_ATTR_INDEX,0x20);
- OutU8(VGAP_ATTR_DATA_WRITE,0); //Dummy write
- InU8(VGAP_INPUT_STAT); //Rsts attr index/data
- LBtr(&sys_semas[SEMA_VGA],0);
- POPFD
-}
-
-public U0 GrPaletteColorSet(I64 color_num,CBGR48 bgr48)
-{//VGA has 6-bits for blue, for green, and for red.
- if (!Bt(&sys_run_level,RLf_VGA)) return;
- PUSHFD
- CLI
- while (LBts(&sys_semas[SEMA_VGA],0))
- Yield;
- OutU8(VGAP_PALETTE_MASK,0xFF);
- OutU8(VGAP_REG_WRITE,color_num);
- OutU8(VGAP_PALETTE_DATA,bgr48.r>>10);
- OutU8(VGAP_PALETTE_DATA,bgr48.g>>10);
- OutU8(VGAP_PALETTE_DATA,bgr48.b>>10);
- LBtr(&sys_semas[SEMA_VGA],0);
- POPFD
-}
-
-public CBGR48 GrPaletteColorGet(I64 color_num)
-{//VGA has 6-bits for blue, for green, and for red.
- CBGR48 res=0;
- if (!Bt(&sys_run_level,RLf_VGA)) return 0;
- PUSHFD
- CLI
- while (LBts(&sys_semas[SEMA_VGA],0))
- Yield;
- OutU8(VGAP_PALETTE_MASK,0xFF);
- OutU8(VGAP_REG_READ,color_num);
- res.r=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
- res.g=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
- res.b=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
- LBtr(&sys_semas[SEMA_VGA],0);
- POPFD
- return res;
-}
-
-public CBGR48 gr_palette_std[COLORS_NUM]={
-0x000000000000,0x00000000AAAA,0x0000AAAA0000,0x0000AAAAAAAA,
-0xAAAA00000000,0xAAAA0000AAAA,0xAAAA55550000,0xAAAAAAAAAAAA,
-0x555555555555,0x55555555FFFF,0x5555FFFF5555,0x5555FFFFFFFF,
-0xFFFF55555555,0xFFFF5555FFFF,0xFFFFFFFF5555,0xFFFFFFFFFFFF};
-
-public CBGR48 gr_palette_gray[COLORS_NUM]={
-0x000000000000,0x111111111111,0x222222222222,0x333333333333,
-0x444444444444,0x555555555555,0x666666666666,0x777777777777,
-0x888888888888,0x999999999999,0xAAAAAAAAAAAA,0xBBBBBBBBBBBB,
-0xCCCCCCCCCCCC,0xDDDDDDDDDDDD,0xEEEEEEEEEEEE,0xFFFFFFFFFFFF};
-
-public U0 GrPaletteGet(CBGR48 *bgr48)
-{//16 colors
- I64 i;
- for (i=0;i<COLORS_NUM;i++)
- bgr48[i]=GrPaletteColorGet(i);
-}
-
-public U0 GrPaletteSet(CBGR48 *bgr48)
-{//16 colors
- I64 i;
- for (i=0;i<COLORS_NUM;i++)
- GrPaletteColorSet(i,bgr48[i]);
-}
-
-public U0 PaletteSetStd()
-{//Activate std palette.
- GrPaletteSet(gr_palette_std);
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Gr/GrPrimatives.HC.HTML b/public/src/Adam/Gr/GrPrimatives.HC.HTML deleted file mode 100644 index 9c450e2..0000000 --- a/public/src/Adam/Gr/GrPrimatives.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - GrPrimatives.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Adam/Gr/GrScrn.HC.HTML b/public/src/Adam/Gr/GrScrn.HC.HTML deleted file mode 100644 index 9482078..0000000 --- a/public/src/Adam/Gr/GrScrn.HC.HTML +++ /dev/null @@ -1,435 +0,0 @@ - - - - - GrScrn.HC - - - - - #help_index "Graphics/Scrn"
-
-U0 GrUpdateTaskODEs(CTask *task)
-{
- sys_task_being_scrn_updated=task;
- try
- ODEsUpdate(task);
- catch {
- LBts(&task->win_inhibit,WIf_SELF_ODE);
- "Exception in WinMgr: Update Task ODEs\n";
- PutExcept;
- Sleep(3000);
- VGAFlush;
- }
- sys_task_being_scrn_updated=NULL;
-}
-
-U0 GrUpdateTaskWin(CTask *task)
-{ //Draw a win. Only Core0 tasks have a win.
- CDC *dc;
- CD3I64 saved_scroll;
- sys_task_being_scrn_updated=task;
- try {
- if (!Bt(&task->display_flags,DISPLAYf_NO_BORDER))
- TextBorder(Fs,task->win_left,task->win_right,task->win_top,
- task->win_bottom,task->border_attr,task==sys_focus_task);
- TextRect(task->win_left,task->win_right,
- task->win_top,task->win_bottom,task->text_attr<<8);
- if (task==sys_winmgr_task) {
- if (gr.fp_wall_paper)
- (*gr.fp_wall_paper)(task);
- } else if (!(task->win_inhibit&WIF_SELF_DOC))
- DocUpdateTaskDocs(task);
- if (TaskValidate(task)) {
- if (task->draw_it) {
- dc=DCAlias(gr.dc2,task);
- (*task->draw_it)(task,dc);
- DCDel(dc);
- }
- if (TaskValidate(task)) {
- WinScrollNull(task,&saved_scroll);
- DrawCtrls(task);
- WinScrollRestore(task,&saved_scroll);
- }
- }
- } catch {
- if (task!=Fs && TaskValidate(task)) {
- LBtr(&task->display_flags,DISPLAYf_SHOW);
- "Exception in WinMgr: Update Task Win\n";
- PutExcept;
- Sleep(3000);
- VGAFlush;
- }
- }
- sys_task_being_scrn_updated=NULL;
-}
-
-U0 GrUpdateTasks()
-{//Only called by WinMgr
- I64 i;
- CTask *task,*task1;
- try {
- winmgr.ode_time=0;
- if (Bt(&sys_semas[SEMA_UPDATE_WIN_Z_BUF],0))
- WinZBufUpdate;
- task1=task=sys_winmgr_task;
- do { //Loop through Core0 tasks.
- if (!TaskValidate(task)) break;
- if (Bt(&task->display_flags,DISPLAYf_SHOW) &&
- Bt(gr.win_uncovered_bitmap,task->win_z_num))
- GrUpdateTaskWin(task);
- if (!TaskValidate(task)) break;
- task=task->next_task;
- } while (task!=task1);
-
- for (i=0;i<mp_cnt;i++) { //Loop through all cores.
- task1=task=cpu_structs[i].seth_task;
- do {
- if (!TaskValidate(task)) break;
- GrUpdateTaskODEs(task);
- if (!TaskValidate(task)) break;
- task=task->next_task;
- } while (task!=task1);
- }
- } catch {
- PutExcept(FALSE);
- Dbg("Exception in WinMgr");
- }
- winmgr.last_ode_time=winmgr.ode_time;
- ode_alloced_factor=LowPass1(0.1,ode_alloced_factor,
- Clamp(Gs->idle_factor-0.1,0.2,0.8),1/winmgr.fps);
- sys_task_being_scrn_updated=NULL;
-}
-
-U0 GrFixZoomScale()
-{
- gr.scrn_zoom=ClampI64(gr.scrn_zoom,1,GR_SCRN_ZOOM_MAX);
- if (gr.scrn_zoom==1) {
- gr.sx=0;
- gr.sy=0;
- } else {
- gr.sx=ClampI64(gr.sx,0,GR_WIDTH-GR_WIDTH/gr.scrn_zoom)&~7;
- gr.sy=ClampI64(gr.sy,0,GR_HEIGHT-GR_HEIGHT/gr.scrn_zoom);
- }
-}
-
-public U0 GrScaleZoom(F64 scale)
-{//Multiply zoom factor larger or smaller.
- F64 s=gr.scrn_zoom;
- gr.scrn_zoom=gr.scrn_zoom*scale;
- GrFixZoomScale;
- s/=gr.scrn_zoom;
- ms.scale.x*=s;
- ms.scale.y*=s;
- ms.scale.z*=s;
- ms.offset.x=ms.pos.x-(ms.pos.x-ms.offset.x)*s;
- ms.offset.y=ms.pos.y-(ms.pos.y-ms.offset.y)*s;
- ms.offset.z=ms.pos.z-(ms.pos.z-ms.offset.z)*s;
- gr.sx=ms.pos.x-gr.zoomed_dc->width >>1/gr.scrn_zoom;
- gr.sy=ms.pos.y-gr.zoomed_dc->height>>1/gr.scrn_zoom;
- GrFixZoomScale;
-}
-
-U0 GrZoomInScrn()
-{
- GrFixZoomScale;
- I64 plane,row,col,k,l,
- d2=gr.zoomed_dc->width>>3/gr.scrn_zoom,
- d4=gr.zoomed_dc->width_internal>>3,
- d5=d4-d2*gr.scrn_zoom,
- d3=gr.zoomed_dc->height/gr.scrn_zoom,
- d6=(gr.zoomed_dc->height-d3)*gr.dc1->width_internal>>3,
- d7=gr.zoomed_dc->height%gr.scrn_zoom*d4;
- U8 *src,*src2,*dst,*src3,*map=gr.scrn_zoom_tables[gr.scrn_zoom];
-
- src=gr.dc1->body+gr.sx>>3+gr.sy*gr.dc1->width_internal>>3;
- dst=gr.zoomed_dc->body;
- for (plane=1;plane<0x10;plane<<=1) {
- row=d3;
- while (row--) {
- k=gr.scrn_zoom;
- while (k--) {
- src2=src;
- col=d2;
- while (col--) {
- src3=&map[*src2++];
- l=gr.scrn_zoom;
- while (l--) {
- *dst++=*src3;
- src3+=256;
- }
- }
- l=d5;
- while (l--)
- *dst++=0;
- }
- src+=d4;
- }
- l=d7;
- while (l--)
- *dst++=0;
- src+=d6;
- }
-}
-
-U0 GrUpdateTextBG()
-{
- I64 reg RSI *dst=gr.dc2->body,reg R13 c,row,col,
- num_rows=TEXT_ROWS,num_cols=TEXT_COLS,i,j,cur_ch,
- reg R12 w1=gr.dc2->width_internal,w2=-7*w1+8,w3=7*w1,w4=0;
- U32 *src=gr.text_base;
- Bool blink_flag=Blink;
- U8 *dst2=dst;
-
- if (gr.pan_text_x||gr.hide_col) {
- gr.pan_text_x=ClampI64(gr.pan_text_x,-7,7);
- j=AbsI64(gr.pan_text_x)/FONT_WIDTH+1;
- num_cols-=j;
- if (gr.pan_text_x<0) {
- src+=j;
- i=FONT_WIDTH*j+gr.pan_text_x;
- } else
- i=gr.pan_text_x;
- dst2=dst(U8 *)+i;
- w4=j;
- w3+=j*FONT_WIDTH;
-
- j*=FONT_WIDTH;
- dst(U8 *)=gr.dc2->body;
- for (row=num_rows*FONT_HEIGHT;row--;) {
- for (col=i;col--;)
- *dst(U8 *)++=0;
- dst(U8 *)+=w1-i-j;
- for (col=j;col--;)
- *dst(U8 *)++=0;
- }
- }
- dst=dst2;
-
- if (gr.pan_text_y||gr.hide_row) {
- gr.pan_text_y=ClampI64(gr.pan_text_y,-7,7);
- j=AbsI64(gr.pan_text_y)/FONT_HEIGHT+1;
- num_rows-=j;
- if (gr.pan_text_y<0) {
- src+=w1/FONT_WIDTH*j;
- i=w1*(FONT_HEIGHT*j+gr.pan_text_y);
- } else
- i=w1*gr.pan_text_y;
- dst2=dst(U8 *)+i;
-
- j*=w1*FONT_HEIGHT;
- dst(U8 *)=gr.dc2->body;
- for (row=i;row--;)
- *dst(U8 *)++=0;
- dst(U8 *)=gr.dc2->body+TEXT_ROWS*TEXT_COLS*FONT_HEIGHT*FONT_WIDTH-j;
- for (row=j;row--;)
- *dst(U8 *)++=0;
- }
- dst=dst2;
-
- for (row=num_rows;row--;) {
- for (col=num_cols;col--;) {
- cur_ch=*src++;
- if (cur_ch & (ATTRF_SEL|ATTRF_INVERT|ATTRF_BLINK)) {
- if (cur_ch & ATTRF_SEL)
- cur_ch.u8[1]=cur_ch.u8[1]^0xFF;
- if (cur_ch & ATTRF_INVERT)
- cur_ch.u8[1]=cur_ch.u8[1]<<4+cur_ch.u8[1]>>4;
- if (cur_ch & ATTRF_BLINK && blink_flag)
- cur_ch.u8[1]=cur_ch.u8[1]<<4+cur_ch.u8[1]>>4;
- }
- c=gr.to_8_colors[cur_ch.u8[1]>>4];
- MOV U64 [RSI],R13
- ADD RSI,R12
- MOV U64 [RSI],R13
- ADD RSI,R12
- MOV U64 [RSI],R13
- ADD RSI,R12
- MOV U64 [RSI],R13
- ADD RSI,R12
- MOV U64 [RSI],R13
- ADD RSI,R12
- MOV U64 [RSI],R13
- ADD RSI,R12
- MOV U64 [RSI],R13
- ADD RSI,R12
- MOV U64 [RSI],R13
- dst(U8 *)+=w2;
- }
- src+=w4;
- dst(U8 *)+=w3;
- }
-}
-
-U0 GrUpdateTextFG()
-{//See TextBase Layer.
- U32 *src=gr.text_base;
- I64 i,j,cur_ch,*dst=gr.dc2->body,
- w1=gr.dc2->width_internal,w2=7*w1,w4=0,
- num_rows=TEXT_ROWS,num_cols=TEXT_COLS,row,col;
- U8 *dst_start=gr.dc2->body,*dst_end=dst_start+w1*gr.dc2->height-7*w1-8;
- Bool blink_flag=Blink;
-
- if (gr.pan_text_x||gr.hide_col) {
- gr.pan_text_x=ClampI64(gr.pan_text_x,-7,7);
- j=AbsI64(gr.pan_text_x)/FONT_WIDTH+1;
- num_cols-=j;
- if (gr.pan_text_x<0) {
- src+=j;
- dst(U8 *)+=FONT_WIDTH*j;
- }
- w4=j;
- w2+=j*FONT_WIDTH;
- }
-
- if (gr.pan_text_y||gr.hide_row) {
- gr.pan_text_y=ClampI64(gr.pan_text_y,-7,7);
- j=AbsI64(gr.pan_text_y)/FONT_HEIGHT+1;
- num_rows-=j;
- if (gr.pan_text_y<0) {
- src+=w1/FONT_WIDTH*j;
- dst(U8 *)+=w1*FONT_HEIGHT*j;
- }
- }
-
- for (row=num_rows;row--;) {
- for (col=num_cols;col--;) {
- cur_ch=*src++;
- if (cur_ch & (ATTRF_UNDERLINE|ATTRF_SEL|ATTRF_INVERT|ATTRF_BLINK)) {
- if (cur_ch & ATTRF_SEL)
- cur_ch.u8[1]=cur_ch.u8[1]^0xFF;
- if (cur_ch & ATTRF_INVERT)
- cur_ch.u8[1]=cur_ch.u8[1]<<4+cur_ch.u8[1]>>4;
- if (cur_ch & ATTRF_BLINK && blink_flag)
- cur_ch.u8[1]=cur_ch.u8[1]<<4+cur_ch.u8[1]>>4;
- }
- if (i=cur_ch.u16[1]&0x3FF+gr.pan_text_x+gr.pan_text_y<<5) {
- j=i&0x1F;
- if (j&0x10) j|=~0x1F;
- i>>=5;
- if (i&0x10) i|=~0x1F;
- i=w1*i+j;
- if (dst_start<=dst(U8 *)+i<dst_end)
- GrRopEquU8NoClipping(cur_ch&(ATTRF_UNDERLINE+0xFFF),dst(U8 *)+i,w1);
- } else
- GrRopEquU8NoClipping(cur_ch&(ATTRF_UNDERLINE+0xFFF),dst,w1);
- dst(U8 *)+=8;
- }
- src+=w4;
- dst(U8 *)+=w2;
- }
-}
-
-U0 DCBlotColor8(CDC *dc,CDC *img)
-{
- U8 *src=img->body,*b0=dc->body;
- I64 j,k,d0=img->width_internal*img->height;
- for (k=0;k<d0;k++) {
- j=*src++;
- if (j!=TRANSPARENT)
- *b0++=j;
- else
- b0++;
- }
-}
-
-U0 GrUpdateTextModeText()
-{
- U32 *src=gr.text_base;
- I64 cur_ch,i=TEXT_COLS*TEXT_ROWS;
- U16 *dst=text.vga_text_alias,*dst2=gr.vga_text_cache;
- Bool blink_flag=Blink;
- if (LBtr(&sys_semas[SEMA_FLUSH_VGA_IMAGE],0)) {
- while (i--) {
- cur_ch=*src++;
- if (cur_ch & ATTRF_SEL)
- cur_ch.u8[1]=cur_ch.u8[1]^0xFF;
- if (cur_ch & ATTRF_INVERT)
- cur_ch.u8[1]=cur_ch.u8[1]<<4+cur_ch.u8[1]>>4;
- if (cur_ch & ATTRF_BLINK)
- if (blink_flag)
- cur_ch.u8[1]=cur_ch.u8[1]<<4+cur_ch.u8[1]>>4;
- *dst++=*dst2++=cur_ch&0x7FFF;
- }
- } else {
- while (i--) {
- cur_ch=*src++;
- if (cur_ch & ATTRF_SEL)
- cur_ch.u8[1]=cur_ch.u8[1]^0xFF;
- if (cur_ch & ATTRF_INVERT)
- cur_ch.u8[1]=cur_ch.u8[1]<<4+cur_ch.u8[1]>>4;
- if (cur_ch & ATTRF_BLINK)
- if (blink_flag)
- cur_ch.u8[1]=cur_ch.u8[1]<<4+cur_ch.u8[1]>>4;
- cur_ch&=0x7FFF;
- if (*dst2!=cur_ch)
- *dst++=*dst2++=cur_ch;
- else {
- dst++;
- dst2++;
- }
- }
- }
-}
-
-U0 GrUpdateVGAGraphics()
-{//Update Graphic Card
- I64 row,plane,d=gr.zoomed_dc->width_internal>>6;
- U32 *src,*vga,*dst;
- if (gr.scrn_zoom==1)
- src=gr.dc1->body;
- else {
- GrZoomInScrn;
- src=gr.zoomed_dc->body;
- }
- dst=gr.scrn_image->body;
- if (LBtr(&sys_semas[SEMA_FLUSH_VGA_IMAGE],0)) {
- for (plane=1;plane<0x10;plane<<=1) {
- OutU8(VGAP_IDX,VGAR_MAP_MASK);
- OutU8(VGAP_DATA,plane);
- vga=text.vga_alias;
- row=gr.zoomed_dc->height;
- while (row--)
- GrUpdateLine64FlushCache(&vga,&src,d,&dst);
- }
- } else {
- for (plane=1;plane<0x10;plane<<=1) {
- OutU8(VGAP_IDX,VGAR_MAP_MASK);
- OutU8(VGAP_DATA,plane);
- vga=text.vga_alias;
- row=gr.zoomed_dc->height;
- while (row--)
- GrUpdateLine64(&vga,&src,d,&dst);
- }
- }
-}
-
-U0 GrUpdateScrn()
-{//Called by the Window Manager HERE, 30 times a second.
- CDC *dc;
- if (!Bt(&sys_run_level,RLf_VGA)) //if text mode
- GrUpdateTasks;
- else {
- GrUpdateTextBG;
- GrUpdateTextFG;
- GrUpdateTasks;
- DCBlotColor8(gr.dc2,gr.dc);
- }
-
- dc=DCAlias(gr.dc2,Fs);
- dc->flags|=DCF_ON_TOP;
- if (gr.fp_final_scrn_update)
- (*gr.fp_final_scrn_update)(dc);
- DCDel(dc);
-
- if (!Bt(&sys_run_level,RLf_VGA)) //if text mode
- GrUpdateTextModeText;
- else {
- DCBlotColor4(gr.dc1->body,gr.dc2->body,gr.dc_cache->body,
- gr.dc2->height*gr.dc2->width_internal>>3);
- GrUpdateVGAGraphics;
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Gr/GrSpritePlot.HC.HTML b/public/src/Adam/Gr/GrSpritePlot.HC.HTML deleted file mode 100644 index e1e6523..0000000 --- a/public/src/Adam/Gr/GrSpritePlot.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - GrSpritePlot.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Adam/Gr/GrTextBase.HC.HTML b/public/src/Adam/Gr/GrTextBase.HC.HTML deleted file mode 100644 index 6a81961..0000000 --- a/public/src/Adam/Gr/GrTextBase.HC.HTML +++ /dev/null @@ -1,375 +0,0 @@ - - - - - GrTextBase.HC - - - - - #help_index "TextBase Layer;Char/TextBase Layer"
-#help_file "::/Doc/TextBase"
-
-asm {
-//************************************
-_TEXT_CHAR::
-//Bool TextChar(CTask *task,Bool allow_border=FALSE,I64 x,I64 y,I64 d);
-//Must be called 30fps in Fs->draw_it() callback.
- PUSH RBP
- MOV RBP,RSP
- MOV RCX,U64 SF_ARG1[RBP]
- MOV RBX,U64 CTask.scroll_x[RCX]
- SAR RBX,3
- ADD RBX,U64 SF_ARG3[RBP]
- MOV RAX,U64 CTask.scroll_y[RCX]
- SAR RAX,3
- ADD RAX,U64 SF_ARG4[RBP]
-
- TEST U8 SF_ARG2[RBP],0xFF
- JNZ @@10
-
-//Border not allowed
- TEST RBX,RBX //Check X
- JS @@05
- ADD RBX,U64 CTask.win_left[RCX]
- CMP RBX,U64 CTask.win_right[RCX]
- JG @@05
- TEST RBX,RBX
- JS @@05
- CMP RBX,TEXT_COLS
- JGE @@05
- TEST RAX,RAX //Check Y
- JS @@05
- ADD RAX,U64 CTask.win_top[RCX]
- CMP RAX,U64 CTask.win_bottom[RCX]
- JG @@05
- TEST RAX,RAX
- JS @@05
- CMP RAX,TEXT_ROWS
- JGE @@05
- JMP @@15
-
-@@05: XOR RAX,RAX //return FALSE
- POP RBP
- RET1 40
-
-//Border allowed
-@@10: MOV RDX,-1 //Check X
- CMP RBX,RDX
- JL @@05
- ADD RBX,U64 CTask.win_left[RCX]
- MOV RDX,U64 CTask.win_right[RCX]
- INC RDX
- CMP RBX,RDX
- JG @@05
- TEST RBX,RBX
- JS @@05
- CMP RBX,TEXT_COLS
- JGE @@05
- MOV RDX,-1 //Check Y
- CMP RAX,RDX
- JL @@05
- ADD RAX,U64 CTask.win_top[RCX]
- MOV RDX,U64 CTask.win_bottom[RCX]
- INC RDX
- CMP RAX,RDX
- JG @@05
- TEST RAX,RAX
- JS @@05
- CMP RAX,TEXT_ROWS
- JGE @@05
-
-@@15: IMUL2 RAX,TEXT_COLS
- ADD RBX,RAX
- SHL RBX,2
- ADD RBX,U64 [&gr.text_base]
- MOV RAX,U64 SF_ARG5[RBP]
- MOV U32 [RBX],EAX
-
- MOV RAX,TRUE
- POP RBP
- RET1 40
-//************************************
-_TEXT_LEN_STR::
-//Bool TextLenStr(CTask *task,I64 x,I64 y,I64 len,I64 attr,U8 *s)
-//Must be called 30fps in Fs->draw_it() callback.
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
- MOV RBX,U64 SF_ARG1[RBP]
- MOV RSI,U64 SF_ARG6[RBP]
- MOV RDI,U64 CTask.scroll_x[RBX]
- SAR RDI,3
- ADD RDI,U64 SF_ARG2[RBP]
- MOV RCX,U64 SF_ARG4[RBP]
-
- TEST RDI,RDI
- JNS @@05
- ADD RCX,RDI
- SUB RSI,RDI
- XOR RDI,RDI
-@@05: ADD RDI,U64 CTask.win_left[RBX]
- MOV RDX,RCX
- ADD RDX,RDI
- DEC RDX
- CMP RDX,U64 CTask.win_right[RBX]
- JLE @@10
- MOV RAX,RDX
- SUB RAX,U64 CTask.win_right[RBX]
- SUB RDX,RAX
- SUB RCX,RAX
-@@10: TEST RDI,RDI
- JNS @@15
- ADD RCX,RDI
- SUB RSI,RDI
- XOR RDI,RDI
-@@15: INC RDX
- SUB RDX,TEXT_COLS
- JLE @@20
- SUB RCX,RDX
-@@20: CMP RCX,1
- JL @@30
-
- MOV RAX,U64 CTask.scroll_y[RBX]
- SAR RAX,3
- ADD RAX,U64 SF_ARG3[RBP]
- TEST RAX,RAX
- JS @@30
- ADD RAX,U64 CTask.win_top[RBX]
- CMP RAX,U64 CTask.win_bottom[RBX]
- JG @@30
- TEST RAX,RAX
- JS @@30
- CMP RAX,TEXT_ROWS
- JGE @@30
-
- IMUL2 RAX,TEXT_COLS
- ADD RDI,RAX
- SHL RDI,2
- ADD RDI,U64 [&gr.text_base]
- MOV RAX,U64 SF_ARG5[RBP]
-@@25: LODSB
- STOSD
- DEC RCX
- JNZ @@25
-
- POP RDI
- POP RSI
- MOV RAX,TRUE
- POP RBP
- RET1 48
-
-@@30: POP RDI
- POP RSI
- XOR RAX,RAX
- POP RBP
- RET1 48
-//************************************
-_TEXT_LEN_ATTR_STR::
-//Bool TextLenAttrStr(CTask *task,I64 x,I64 y,I64 len,U32 *_attr)
-//Must be called 30fps in Fs->draw_it() callback.
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
- MOV RBX,U64 SF_ARG1[RBP]
- MOV RSI,U64 SF_ARG5[RBP]
- MOV RDI,U64 CTask.scroll_x[RBX]
- SAR RDI,3
- ADD RDI,U64 SF_ARG2[RBP]
- MOV RCX,U64 SF_ARG4[RBP]
-
- TEST RDI,RDI
- JNS @@05
- ADD RCX,RDI
- SHL RDI,2
- SUB RSI,RDI
- XOR RDI,RDI
-@@05: ADD RDI,U64 CTask.win_left[RBX]
- MOV RDX,RCX
- ADD RDX,RDI
- DEC RDX
- CMP RDX,U64 CTask.win_right[RBX]
- JLE @@10
- MOV RAX,RDX
- SUB RAX,U64 CTask.win_right[RBX]
- SUB RDX,RAX
- SUB RCX,RAX
-@@10: TEST RDI,RDI
- JNS @@15
- ADD RCX,RDI
- SHL RDI,2
- SUB RSI,RDI
- XOR RDI,RDI
-@@15: INC RDX
- SUB RDX,TEXT_COLS
- JLE @@20
- SUB RCX,RDX
-@@20: CMP RCX,1
- JL @@30
-
- MOV RAX,U64 CTask.scroll_y[RBX]
- SAR RAX,3
- ADD RAX,U64 SF_ARG3[RBP]
- TEST RAX,RAX
- JS @@30
- ADD RAX,U64 CTask.win_top[RBX]
- CMP RAX,U64 CTask.win_bottom[RBX]
- JG @@30
- TEST RAX,RAX
- JS @@30
- CMP RAX,TEXT_ROWS
- JGE @@30
-
- IMUL2 RAX,TEXT_COLS
- ADD RDI,RAX
- SHL RDI,2
- ADD RDI,U64 [&gr.text_base]
-@@25: MOVSD
- DEC RCX
- JNZ @@25
-
- POP RDI
- POP RSI
- MOV RAX,TRUE
- POP RBP
- RET1 40
-
-@@30: POP RDI
- POP RSI
- XOR RAX,RAX
- POP RBP
- RET1 40
-//************************************
-_TEXT_LEN_ATTR:://Bool TextLenAttr(CTask *task,I64 x,I64 y,I64 len,I64 attr)
-//Must be called 30fps in Fs->draw_it() callback.
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
- MOV RBX,U64 SF_ARG1[RBP]
- MOV RDI,U64 CTask.scroll_x[RBX]
- SAR RDI,3
- ADD RDI,U64 SF_ARG2[RBP]
- MOV RCX,U64 SF_ARG4[RBP]
-
- TEST RDI,RDI
- JNS @@05
- ADD RCX,RDI
- XOR RDI,RDI
-@@05: ADD RDI,U64 CTask.win_left[RBX]
- MOV RDX,RCX
- ADD RDX,RDI
- DEC RDX
- CMP RDX,U64 CTask.win_right[RBX]
- JLE @@10
- MOV RAX,RDX
- SUB RAX,U64 CTask.win_right[RBX]
- SUB RDX,RAX
- SUB RCX,RAX
-@@10: TEST RDI,RDI
- JNS @@15
- ADD RCX,RDI
- XOR RDI,RDI
-@@15: INC RDX
- SUB RDX,TEXT_COLS
- JLE @@20
- SUB RCX,RDX
-@@20: CMP RCX,1
- JL @@35
-
- MOV RAX,U64 CTask.scroll_y[RBX]
- SAR RAX,3
- ADD RAX,U64 SF_ARG3[RBP]
- TEST RAX,RAX
- JS @@35
- ADD RAX,U64 CTask.win_top[RBX]
- CMP RAX,U64 CTask.win_bottom[RBX]
- JG @@35
- TEST RAX,RAX
- JS @@35
- CMP RAX,TEXT_ROWS
- JGE @@35
-
- IMUL2 RAX,TEXT_COLS
- ADD RDI,RAX
- SHL RDI,2
- ADD RDI,U64 [&gr.text_base]
- MOV RBX,U64 SF_ARG5[RBP]
- MOV RSI,RDI
-@@25: LODSD
- TEST AL,AL
- JNZ @@30
- MOV RAX,RBX
- STOSD
- DEC RCX
- JNZ @@25
-
-@@30: POP RDI
- POP RSI
- MOV RAX,TRUE
- POP RBP
- RET1 40
-
-@@35: POP RDI
- POP RSI
- XOR RAX,RAX
- POP RBP
- RET1 40
-}
-public _extern _TEXT_CHAR Bool TextChar(CTask *task,Bool allow_border=FALSE,
-I64 x,I64 y,I64 d); //Plot char. 30fps in Fs->draw_it() callback.
-public _extern _TEXT_LEN_STR Bool TextLenStr(CTask *task,I64 x,I64 y,I64 len,
-I64 attr,U8 *s); //Plot str with len. 30fps in Fs->draw_it() callback.
-public _extern _TEXT_LEN_ATTR_STR Bool TextLenAttrStr(CTask *task,I64 x,I64 y,
-I64 len,U32 *_attr); //Plot attr str with len. 30fps in Fs->draw_it() callback.
-public _extern _TEXT_LEN_ATTR Bool TextLenAttr(CTask *task,I64 x,I64 y,I64 len,
-I64 attr); //Plot attrs with len. 30fps in Fs->draw_it() callback.
-
-public U0 TextPrint(CTask *task,I64 x,I64 y,I64 attr,U8 *fmt,...)
-{//Plot chars. 30fps in Fs->draw_it() callback.
-//You probably want GrPrint() or just Print().
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
- TextLenStr(task,x,y,StrLen(buf),attr<<8,buf);
- Free(buf);
-}
-
-public U0 TextBorder(CTask *task=NULL,
- I64 l,I64 r,I64 t,I64 b,I64 attr,Bool solid)
-{//Plot border square. 30fps in Fs->draw_it() callback.
-//Draws window borders or DolDoc text bttn borders.
- //Set task=sys_winmgr_task for no clipping.
- I64 i;
- if (!task) task=Fs;
- attr<<=8;
- TextChar(task,,l-1,t-1,text.border_chars[6+solid]+attr);
- TextChar(task,,r+1,t-1,text.border_chars[8+solid]+attr);
- TextChar(task,,l-1,b+1,text.border_chars[10+solid]+attr);
- TextChar(task,,r+1,b+1,text.border_chars[12+solid]+attr);
- for (i=l;i<=r;i++) {
- TextChar(task,,i,t-1,text.border_chars[2+solid]+attr);
- TextChar(task,,i,b+1,text.border_chars[2+solid]+attr);
- }
- for (i=t;i<=b;i++) {
- TextChar(task,,l-1,i,text.border_chars[4+solid]+attr);
- TextChar(task,,r+1,i,text.border_chars[4+solid]+attr);
- }
-}
-
-public U0 TextRect(I64 l,I64 r,I64 t,I64 b,I64 d)
-{//Fill text rect. 30fps in Fs->draw_it() callback.
- I64 y,w;
- if (l>r || t>b) return;
- if (t<0) t=0;
- if (b>=TEXT_ROWS) b=TEXT_ROWS-1;
- if (l<0) l=0;
- if (r>=TEXT_COLS) r=TEXT_COLS-1;
- if (w=r-l+1)
- for (y=t;y<=b;y++)
- MemSetU32(gr.text_base(U8 *)+(y*TEXT_COLS+l)*sizeof(U32),d,w);
-}
-
- - - \ No newline at end of file diff --git a/public/src/Adam/Gr/MakeGr.HC.HTML b/public/src/Adam/Gr/MakeGr.HC.HTML deleted file mode 100644 index 77e6c90..0000000 --- a/public/src/Adam/Gr/MakeGr.HC.HTML +++ /dev/null @@ -1,45 +0,0 @@ - - - - - MakeGr.HC - - - - - Cd(__DIR__);;
-
-#include "GrInitA"
-#include "Gr.HH"
-#include "GrExt"
-#include "GrGlbls"
-#include "GrTextBase"
-#include "GrAsm"
-#include "GrPalette"
-#include "GrDC"
-#include "GrInitB"
-#include "GrMath"
-#include "GrScrn"
-#include "GrBitMap"
-#include "GrPrimatives"
-#include "GrComposites"
-#include "ScrnCast"
-
-#define SPE_ABORT (-1)
-#define SPE_EXIT 0
-#define SPE_CONT 1
-#include "SpriteNew"
-#include "GrSpritePlot"
-#include "SpriteMesh"
-#include "SpriteBitMap"
-#include "SpriteCode"
-#include "SpriteSideBar"
-#include "SpriteEd"
-#include "SpriteMain"
-
-#include "GrEnd"
-
-Cd("..");;
- - - \ No newline at end of file diff --git a/public/src/Adam/Gr/ScrnCast.HC.HTML b/public/src/Adam/Gr/ScrnCast.HC.HTML deleted file mode 100644 index c68ff33..0000000 --- a/public/src/Adam/Gr/ScrnCast.HC.HTML +++ /dev/null @@ -1,108 +0,0 @@ - - - - - ScrnCast.HC - - - - - #help_index "ScrnCast;Graphics/Device Contexts;Graphics/GR Files"
-
-#define MV_FILE_MAX 0x007FF000
-
-public I64 GR2MV(U8 *print_fmt="VID%03d.MV",
- U8 *files_find_mask,U8 *fu_flags=NULL)
-{/*Merge GR lst to MV file.
-"+d" will delete GR list files.
-*/
- I64 fuf_flags=0,file_num=0,size;
- CDirEntry *tmpde,*tmpde1;
- U8 *base,*dst,*src,*st;
- CDC *dc,*dc_base=DCNew(GR_WIDTH,GR_HEIGHT);
- CDate cdt;
- Bool old_silent;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+f+F");
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
- tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND);
- if (progress1_max=LinkedLstCnt(tmpde1)) {
- dst=base=MAlloc(MV_FILE_MAX);
- while (tmpde) {
- dc=GRRead(tmpde->full_name);
- GrBlot(dc_base,dc->x0,dc->y0,dc);
- if (dst+GR_FILE_MAX>base+MV_FILE_MAX) {
- st=MStrPrint(print_fmt,file_num++);
- FileWrite(st,base,dst-base);
- Free(st);
- dst=base;
-
- cdt=dc->cdt;
- dc=DCCopy(dc_base);
- dc->cdt=cdt;
- }
- src=DCSave(dc,&size);
- DCDel(dc);
- MemCpy(dst,src,size);
- dst+=size;
- Free(src);
- if (fuf_flags&FUF_DEL) {
- old_silent=Silent;
- Del(tmpde->full_name);
- Silent(old_silent);
- }
- progress1++;
- tmpde=tmpde->next;
- }
- if (dst>base) {
- st=MStrPrint(print_fmt,file_num++);
- FileWrite(st,base,dst-base);
- Free(st);
- }
- Free(base);
- }
- progress1=progress1_max=0;
- DirTreeDel(tmpde1);
- DCDel(dc_base);
- return file_num;
-}
-
-#help_index "ScrnCast;Snd/AU Files"
-public U0 SndShift(CSndData *head,F64 dt=0)
-{//Shift CSndData in time.
- CSndData *tmpsd,*tmpsd1;
- if (dt) {
- tmpsd=head->next;
- while (tmpsd!=head) {
- tmpsd1=tmpsd->next;
- tmpsd->tS-=dt;
- if (tmpsd->tS<tmpsd->last->tS) {
- QueRem(tmpsd);
- Free(tmpsd);
- }
- tmpsd=tmpsd1;
- }
- }
-}
-
-public I64 AUWrite(U8 *filename,CSndData *head,CDate *t0_now,F64 t0_tS)
-{//Write AU file.
- CSndData *tmpsd;
- CAUData *base,*dst;
- I64 size=(1+QueCnt(head))*sizeof(CAUData);
- U8 *st=ExtDft(filename,"AU");
- base=dst=MAlloc(size);
- tmpsd=head;
- do {
- dst->cdt=t0_now(I64)+ToI64(CDATE_FREQ*(tmpsd->tS-t0_tS));
- dst->ona=tmpsd->ona;
- dst++;
- tmpsd=tmpsd->next;
- } while (tmpsd!=head);
- FileWrite(st,base,dst(U8 *)-base(U8 *));
- Free(base);
- Free(st);
- return size;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Gr/SpriteBitMap.HC.HTML b/public/src/Adam/Gr/SpriteBitMap.HC.HTML deleted file mode 100644 index 6800417..0000000 --- a/public/src/Adam/Gr/SpriteBitMap.HC.HTML +++ /dev/null @@ -1,682 +0,0 @@ - - - - - SpriteBitMap.HC - - - - - #help_index "Graphics/Sprite;Sprites"
-
-#define SPBM_EXIT 0
-#define SPBM_MAIN_MENU 1
-#define SPBM_COLOR 2
-#define SPBM_DITHER_COLOR 3
-#define SPBM_WIDTH 4
-#define SPBM_PT 5
-#define SPBM_LINE 6
-#define SPBM_ARROW 7
-#define SPBM_RECT 8
-#define SPBM_CIRCLE 9
-#define SPBM_TEXT 10
-#define SPBM_TEXT_BOX 11
-#define SPBM_TEXT_DIAMOND 12
-#define SPBM_FLOOD_FILL 13
-#define SPBM_FLOOD_FILL_NOT 14
-#define SPBM_POLYLINE 15
-#define SPBM_POLYPT 16
-#define SPBM_COPY 17
-#define SPBM_DELETE 18
-#define SPBM_PASTE 19
-#define SPBM_PASTE_TRANSPARENT 20
-#define SPBM_FIND_AND_REPLACE 21
-#define SPBM_TRIM_TO_EXTENTS 22
-#define SPBM_ADD_OUTLINE 23
-#define SPBM_ETCH 24
-#define SPBM_UNDO 25
-#define SPBM_SAVE_GR 26
-
-U0 GrInit4()
-{
- DefineLstLoad("ST_SPRITE_BITMAP_MENU",
- "Exit\0Main Menu\0Color\0Dither Color\0Width\0Point\0Line\0Arrow\0"
- "Rect\0Circle\0Text\0Text Box\0Text Diamond\0Flood Fill\0"
- "Flood Fill Not Color\0PolyLine\0PolyPoint\0Copy\0Delete\0Paste\0"
- "Paste Transparent\0Find and Replace\0Trim to Extents\0Add Outline\0"
- "Etch\0Undo\0Save GR\0");
-}
-GrInit4;
-
-I64 PopUpSpriteBitMap(CColorROPU32 color,I64 width)
-{
- I64 res;
- U8 *st1,*st2,buf[STR_LEN];
- CDoc *doc=DocNew;
-
- Color2Str(buf,color);
- if (color&ROPF_DITHER) {
- st1="";
- st2=buf;
- } else {
- st1=buf;
- st2="";
- }
- DocPrint(doc,"$PURPLE$$TX+CX,\"Sprite BitMap Menu\"$\n"
- "$LK+PU+CX,\"Click for Help\",A=\"FI:::/Doc/SpriteBitMap.DD.Z\"$\n"
- "\n$LTBLUE$$MU-UL,\"Color%s\",LE=SPBM_COLOR$\n"
- "$MU-UL,\"Dither Color%s\",LE=SPBM_DITHER_COLOR$\n"
- "$MU-UL,\"Width%d\",LE=SPBM_WIDTH$\n"
- "$MU-UL,\"Find & Replace Color\",LE=SPBM_FIND_AND_REPLACE$\n"
- "$MU-UL,\"Trim to Extents\",LE=SPBM_TRIM_TO_EXTENTS$\n"
- "$MU-UL,\"Add Outline\",LE=SPBM_ADD_OUTLINE$\n"
- "$MU-UL,\"Etch\",LE=SPBM_ETCH$\n"
- "\n$MU-UL,\"Point\",LE=SPBM_PT$\n"
- "$MU-UL,\"Line\",LE=SPBM_LINE$\n"
- "$MU-UL,\"Arrow\",LE=SPBM_ARROW$\n"
- "$MU-UL,\"Rect\",LE=SPBM_RECT$\n"
- "$MU-UL,\"Circle\",LE=SPBM_CIRCLE$\n"
- "$MU-UL,\"Text\",LE=SPBM_TEXT$\n"
- "$MU-UL,\"Text Box\",LE=SPBM_TEXT_BOX$\n"
- "$MU-UL,\"Text Diamond\",LE=SPBM_TEXT_DIAMOND$\n"
- "$MU-UL,\"Flood Fill\",LE=SPBM_FLOOD_FILL$\n"
- "$MU-UL,\"Flood Fill Not Color\",LE=SPBM_FLOOD_FILL_NOT$\n"
- "$MU-UL,\"PolyLine\",LE=SPBM_POLYLINE$\n"
- "$MU-UL,\"PolyPoint\",LE=SPBM_POLYPT$\n"
- "\n$MU-UL,\"Copy to Clip\",LE=SPBM_COPY$\n"
- "$MU-UL,\"Delete to Clip\",LE=SPBM_DELETE$\n"
- "$MU-UL,\"Paste Clip\",LE=SPBM_PASTE$\n"
- "$MU-UL,\"Paste Transparent Clip\",LE=SPBM_PASTE_TRANSPARENT$\n"
- "\n$MU-UL,\"Save GR File\",LE=SPBM_SAVE_GR$\n"
- "\n$MU-UL,\"Undo\",LE=SPBM_UNDO$\n"
- "\n$PURPLE$$MU-UL,\"+] Sprite Main Menu\",LE=SPBM_MAIN_MENU$$LTBLUE$\n"
- "$MU-UL,\"ExitSprite\",LE=SPBM_EXIT$\n"
- "$MU-UL,\"Abort Sprite\",LE=DOCM_CANCEL$\n"
- "\nRight-Click to get back to this menu.",st1,st2,width);
- res=PopUpMenu(doc);
- DocDel(doc);
- return res;
-}
-
-U0 GrBitMapEdPrepPersistentDC(CDC *dc,I64 xx1,I64 yy1,CDC *img)
-{
- DCFill(dc);
- GrBlot(dc,xx1,yy1,img);
-}
-
-U0 GrBitMapEdTrimToExtents(CDC **_img,I64 *_xx1,I64 *_yy1,
- I64 *_xx2,I64 *_yy2,CColorROPU32 bkcolor)
-{
- CDC *img=*_img;
- I64 i,c,
- x1=0,y1=0,x2=img->width-1,y2=img->height-1; //inclusive
- while (y1<y2) {
- for (i=x1;i<=x2;i++) {
- c=GrPeek(img,i,y1);
- if (c!=bkcolor&&c!=TRANSPARENT) goto tr_y2;
- }
- y1++;
- }
-
- tr_y2:
- while (y1<y2) {
- for (i=x1;i<=x2;i++) {
- c=GrPeek(img,i,y2);
- if (c!=bkcolor&&c!=TRANSPARENT) goto tr_x1;
- }
- y2--;
- }
-
- tr_x1:
- while (x1<x2) {
- for (i=y1;i<=y2;i++) {
- c=GrPeek(img,x1,i);
- if (c!=bkcolor&&c!=TRANSPARENT) goto tr_x2;
- }
- x1++;
- }
-
- tr_x2:
- while (x1<x2) {
- for (i=y1;i<=y2;i++) {
- c=GrPeek(img,x2,i);
- if (c!=bkcolor&&c!=TRANSPARENT) goto tr_done;
- }
- x2--;
- }
-
- tr_done:
- *_img=DCExt(img,x1,y1,x2,y2);
- *_xx1+=x1; *_yy1+=y1;
- *_xx2+=x2-(img->width-1); *_yy2+=y2-(img->height-1); //not inclusive
- DCDel(img);
-}
-
-U0 GrBitMapEdAddOutline(CDC *img,I64 width,
- CColorROPU32 color,CColorROPU32 bkcolor)
-{
- I64 i,j,k,c;
- CColorROPU32 old_color;
- CDC *src;
- if (img->width && img->height) {
- old_color=img->color;
- img->color=color;
- while (width-->0) {
- src=DCExt(img,0,0,img->width-1,img->height-1);
- for (i=0;i<img->height;i++)
- for (j=0;j<img->width;j++)
- if (GrPeek(src,j,i)==bkcolor)
- for (k=0;k<8;k++) {
- c=GrPeek(src,j+gr_x_offsets[k],i+gr_y_offsets[k]);
- if (c>=0 && c!=bkcolor) {
- GrPlot(img,j,i);
- break;
- }
- }
- DCDel(src);
- }
- img->color=old_color;
- }
-}
-
-U0 GrBitMapEdEtch(CDC *img,I64 width,CColorROPU32 bkcolor)
-{
- I64 i,j,k,c;
- CColorROPU32 old_color;
- CDC *src;
- if (img->width && img->height) {
- old_color=img->color;
- img->color=bkcolor;
- while (width-->0) {
- src=DCExt(img,0,0,img->width-1,img->height-1);
- for (i=0;i<img->height;i++)
- for (j=0;j<img->width;j++)
- if (GrPeek(src,j,i)!=bkcolor)
- for (k=0;k<8;k++) {
- c=GrPeek(src,j+gr_x_offsets[k],i+gr_y_offsets[k]);
- if (c<0 || c==bkcolor) {
- GrPlot(img,j,i);
- break;
- }
- }
- DCDel(src);
- }
- img->color=old_color;
- }
-}
-
-I64 SpriteBitMapEd(CDoc *,CDocEntry *doc_e,CDC *dc,I64 *_xx1,I64 *_yy1,
- I64 *_xx2,I64 *_yy2,CDC **_img,CColorROPU32 bkcolor)
-{
- I64 i,j,mode=SPBM_LINE,color=BLACK,width=1,msg_code,arg1,arg2,x1,y1,x11,y11,
- x22,y22,res,xx1=*_xx1,yy1=*_yy1,xx2=*_xx2,yy2=*_yy2,
- old_de_flags=doc_e->de_flags;
- Bool down=FALSE;
- U8 *st=NULL;
- CEdFileName filename;
- CDC *img=*_img,
- *clip=NULL,*undo=NULL,*dc2;
- SettingsPush; //See SettingsPush
-
- doc_e->de_flags|=DOCEF_DONT_DRAW;
- goto bm_menu;
-
- while (TRUE) {
- if (kbd.scan_code&SCF_CTRL)//grab scroll update?
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
-
- dc->color=ROPF_DITHER+WHITE<<16+BLACK;
- dc->thick=1;
- GrBorder(dc,xx1-1,yy1-1,xx2,yy2);//This is done little bit too often.
-
- while (msg_code=ScanMsg(&arg1,&arg2,1<<MSG_MS_L_DOWN|1<<MSG_MS_L_UP|
- 1<<MSG_MS_R_DOWN|1<<MSG_MS_MOVE|1<<MSG_KEY_DOWN)) {
- switch (msg_code) {
- case MSG_KEY_DOWN:
- switch (arg1) {
- case CH_SHIFT_ESC:
- res=SPE_ABORT;
- goto bm_key_up_done;
- case CH_ESC:
- res=SPE_CONT;
- goto bm_key_up_done;
- case 'c': //eye-dropper
- dc2=DCScrnCapture(FALSE);
- color=GrPeek(dc2,ms.pos.x,ms.pos.y)^15;//Mouse cursor is XORed.
- DCDel(dc2);
- break;
- case 't': //Set to transparent color
- color=TRANSPARENT;
- break;
- }
- break;
-
- case MSG_MS_R_DOWN:
-bm_menu:
- DCFill(dc);
- StrCpy(Fs->task_title,"Sprite BitMap Menu");
- i=PopUpSpriteBitMap(color,width);
- if (i>=0)
- StrCpy(Fs->task_title,DefineSub(i,"ST_SPRITE_BITMAP_MENU"));
- switch (i) {
- case DOCM_CANCEL:
- res=SPE_ABORT;
- goto bm_done;
- case SPBM_EXIT:
- res=SPE_EXIT;
- goto bm_done;
- case SPBM_MAIN_MENU:
- res=SPE_CONT;
- goto bm_done;
- case SPBM_COLOR:
- i=PopUpColor(,,FALSE);
- if (i>=0) color=i;
- goto bm_menu;
- case SPBM_FIND_AND_REPLACE:
- i=PopUpColor("Find Color\n",,FALSE);
- if (i>=0) {
- j=PopUpColor("Replace Color\n",,FALSE);
- if (j>=0) {
- DCColorChg(img,i,j);
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- }
- }
- goto bm_menu;
- case SPBM_TRIM_TO_EXTENTS:
- GrBitMapEdTrimToExtents(&img,&xx1,&yy1,&xx2,&yy2,bkcolor);
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- goto bm_menu;
- case SPBM_ADD_OUTLINE:
- i=PopUpRangeI64(1,16,1,"Outline Width\n");
- if (i>=0) {
- GrBitMapEdAddOutline(img,i,color,bkcolor);
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- }
- goto bm_menu;
- case SPBM_ETCH:
- i=PopUpRangeI64(1,16,1,"Etch Width\n");
- if (i>=0) {
- GrBitMapEdEtch(img,i,bkcolor);
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- }
- goto bm_menu;
- case SPBM_SAVE_GR:
- *filename.name=0;
- if (DocForm(&filename) && *filename.name)
- GRWrite(filename.name,img,DCSF_COMPRESSED|DCSF_PALETTE_GET);
- goto bm_menu;
- case SPBM_DITHER_COLOR:
- i=PopUpColorDither;
- if (i>=0) color=i;
- goto bm_menu;
- case SPBM_WIDTH:
- i=PopUpRangeI64(1,16,1,"Thick\n");
- if (i>=0) width=i;
- goto bm_menu;
- case SPBM_UNDO:
- if (undo) {
- DCFill(img,bkcolor);
- img->color=ROP_EQU;
- GrBlot(img,0,0,undo);
- DCDel(undo);
- undo=NULL;
- }
- goto bm_menu;
- case SPBM_PT:
- case SPBM_LINE:
- case SPBM_ARROW:
- case SPBM_RECT:
- case SPBM_CIRCLE:
- case SPBM_FLOOD_FILL:
- case SPBM_FLOOD_FILL_NOT:
- case SPBM_POLYPT:
- case SPBM_POLYLINE:
- case SPBM_COPY:
- case SPBM_DELETE:
- case SPBM_PASTE:
- case SPBM_PASTE_TRANSPARENT:
- mode=i;
- break;
- case SPBM_TEXT:
- case SPBM_TEXT_BOX:
- case SPBM_TEXT_DIAMOND:
- Free(st);
- st=PopUpGetStr("Enter text and press <ESC>.\n");
- if (st && *st)
- mode=i;
- else
- goto bm_menu;
- break;
- }
- DCDel(undo);
- undo=DCExt(img,0,0,img->width-1,img->height-1);
- undo->bkcolor=bkcolor;
- Refresh(2,TRUE); //Let popup close
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- down=FALSE;
- break;
- case MSG_MS_L_DOWN:
- switch (mode) {
- case SPBM_PT:
- img->color=color;
- img->thick=width;
- GrPlot3(img,arg1-xx1,arg2-yy1,0);
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- break;
- start:
- if (down)
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- x1=arg1; y1=arg2;
- down=TRUE;
- dc->color=color;
- dc->thick=width;
- case SPBM_LINE:
- GrLine3(dc,x1,y1,0,arg1,arg2,0);
- break;
- case SPBM_ARROW:
- GrArrow3(dc,x1,y1,0,arg1,arg2,0);
- break;
- case SPBM_RECT:
- GrRect(dc,x1,y1,1,1);
- break;
- case SPBM_CIRCLE:
- GrCircle3(dc,x1,y1,0,1);
- break;
- case SPBM_COPY:
- case SPBM_DELETE:
- dc->color=ROPF_DITHER+WHITE<<16+BLACK;
- dc->thick=1;
- GrBorder(dc,x1,y1,x1,y1);
- break;
- end:
- break;
- case SPBM_PASTE:
- case SPBM_PASTE_TRANSPARENT:
- if (clip) {
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- if (mode==SPBM_PASTE) {
- clip->flags|=DCF_NO_TRANSPARENTS;
- GrBlot(dc,arg1,arg2,clip);
- clip->flags&=~DCF_NO_TRANSPARENTS;
- } else {
- dc2=DCCopy(clip);
- DCColorChg(dc2,bkcolor);
- GrBlot(dc,arg1,arg2,dc2);
- DCDel(dc2);
- }
- }
- break;
- case SPBM_TEXT:
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- dc->color=color;
- GrPrint(dc,arg1,arg2,"%s",st);
- break;
- case SPBM_TEXT_BOX:
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- dc->color=color;
- GrTextBox3(dc,arg1,arg2,0,st);
- break;
- case SPBM_TEXT_DIAMOND:
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- dc->color=color;
- GrTextDiamond3(dc,arg1,arg2,0,st);
- break;
- case SPBM_FLOOD_FILL:
- img->color=color;
- GrFloodFill(img,arg1-xx1,arg2-yy1);
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- break;
- case SPBM_FLOOD_FILL_NOT:
- img->color=color;
- GrFloodFill(img,arg1-xx1,arg2-yy1,TRUE);
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- break;
- case SPBM_POLYLINE:
- if (!down) {
- x1=arg1; y1=arg2;
- down=TRUE;
- dc->color=color;
- dc->thick=width;
- GrLine3(dc,x1,y1,0,arg1,arg2,0);
- }
- break;
- case SPBM_POLYPT:
- x1=arg1; y1=arg2;
- down=TRUE;
- img->color=color;
- img->thick=width;
- GrLine3(img,x1-xx1,y1-yy1,0,arg1-xx1,arg2-yy1,0);
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- break;
- }
- break;
- case MSG_MS_MOVE:
- switch (mode) {
- case SPBM_LINE:
- case SPBM_ARROW:
- case SPBM_POLYLINE:
- if (down) {
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- dc->color=color;
- dc->thick=width;
- if (mode==SPBM_ARROW)
- GrArrow3(dc,x1,y1,0,arg1,arg2,0);
- else
- GrLine3(dc,x1,y1,0,arg1,arg2,0);
- }
- break;
- case SPBM_RECT:
- if (down) {
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- if (x1<arg1) {
- x11=x1;
- x22=arg1;
- } else {
- x11=arg1;
- x22=x1;
- }
- if (y1<arg2) {
- y11=y1;
- y22=arg2;
- } else {
- y11=arg2;
- y22=y1;
- }
- dc->color=color;
- GrRect(dc,x11,y11,x22-x11+1,y22-y11+1);
- }
- break;
- case SPBM_COPY:
- case SPBM_DELETE:
- if (down) {
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- if (x1<arg1) {
- x11=x1;
- x22=arg1;
- } else {
- x11=arg1;
- x22=x1;
- }
- if (y1<arg2) {
- y11=y1;
- y22=arg2;
- } else {
- y11=arg2;
- y22=y1;
- }
- dc->color=ROPF_DITHER+WHITE<<16+BLACK;
- dc->thick=1;
- GrBorder(dc,x11,y11,x22,y22);
- }
- break;
- case SPBM_CIRCLE:
- if (down) {
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- dc->color=color;
- dc->thick=width;
- GrCircle3(dc,x1,y1,0,Sqrt(SqrI64(arg1-x1)+SqrI64(arg2-y1)));
- }
- break;
- case SPBM_PASTE:
- case SPBM_PASTE_TRANSPARENT:
- if (clip) {
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- if (mode==SPBM_PASTE) {
- clip->flags|=DCF_NO_TRANSPARENTS;
- GrBlot(dc,arg1,arg2,clip);
- clip->flags&=~DCF_NO_TRANSPARENTS;
- } else {
- dc2=DCCopy(clip);
- DCColorChg(dc2,bkcolor);
- GrBlot(dc,arg1,arg2,dc2);
- DCDel(dc2);
- }
- }
- break;
- case SPBM_TEXT:
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- dc->color=color;
- GrPrint(dc,arg1,arg2,"%s",st);
- break;
- case SPBM_TEXT_BOX:
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- dc->color=color;
- GrTextBox3(dc,arg1,arg2,0,st);
- break;
- case SPBM_TEXT_DIAMOND:
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- dc->color=color;
- GrTextDiamond3(dc,arg1,arg2,0,st);
- break;
- case SPBM_POLYPT:
- if (down) {
- img->color=color;
- img->thick=width;
- GrLine3(img,x1-xx1,y1-yy1,0,arg1-xx1,arg2-yy1,0);
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- x1=arg1; y1=arg2;
- }
- break;
- }
- break;
- case MSG_MS_L_UP:
- switch (mode) {
- case SPBM_LINE:
- case SPBM_ARROW:
- case SPBM_POLYPT:
- case SPBM_POLYLINE:
- img->color=color;
- img->thick=width;
- if (mode==SPBM_ARROW)
- GrArrow3(img,x1-xx1,y1-yy1,0,arg1-xx1,arg2-yy1,0);
- else
- GrLine3(img,x1-xx1,y1-yy1,0,arg1-xx1,arg2-yy1,0);
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- if (mode==SPBM_POLYLINE) {
- x1=arg1; y1=arg2;
- } else
- down=FALSE;
- break;
- case SPBM_RECT:
- img->color=color;
- if (x1<arg1) {
- x11=x1;
- x22=arg1;
- } else {
- x11=arg1;
- x22=x1;
- }
- if (y1<arg2) {
- y11=y1;
- y22=arg2;
- } else {
- y11=arg2;
- y22=y1;
- }
- GrRect(img,x11-xx1,y11-yy1,x22-x11+1,y22-y11+1);
- down=FALSE;
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- break;
- case SPBM_COPY:
- case SPBM_DELETE:
- if (x1<arg1) {
- x11=x1;
- x22=arg1;
- } else {
- x11=arg1;
- x22=x1;
- }
- if (y1<arg2) {
- y11=y1;
- y22=arg2;
- } else {
- y11=arg2;
- y22=y1;
- }
- DCDel(clip);
- clip=DCExt(img,x11-xx1,y11-yy1,x22-xx1,y22-yy1);
- clip->bkcolor=bkcolor;
- if (mode==SPBM_DELETE) {
- img->color=bkcolor;
- GrRect(img,x11-xx1,y11-yy1,x22-x11+1,y22-y11+1);
- }
- goto bm_menu;
- case SPBM_CIRCLE:
- img->color=color;
- img->thick=width;
- GrCircle3(img,x1-xx1,y1-yy1,0,
- Sqrt(SqrI64(arg1-x1)+SqrI64(arg2-y1)));
- down=FALSE;
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- break;
- case SPBM_PASTE:
- case SPBM_PASTE_TRANSPARENT:
- if (clip) {
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- if (mode==SPBM_PASTE) {
- clip->flags|=DCF_NO_TRANSPARENTS;
- GrBlot(img,arg1-xx1,arg2-yy1,clip);
- clip->flags&=~DCF_NO_TRANSPARENTS;
- } else {
- dc2=DCCopy(clip);
- DCColorChg(dc2,bkcolor);
- GrBlot(img,arg1-xx1,arg2-yy1,dc2);
- DCDel(dc2);
- }
- GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
- }
- break;
- case SPBM_TEXT:
- img->color=color;
- GrPrint(img,arg1-xx1,arg2-yy1,"%s",st);
- goto bm_menu;
- case SPBM_TEXT_BOX:
- img->color=color;
- GrTextBox3(img,arg1-xx1,arg2-yy1,0,st);
- goto bm_menu;
- case SPBM_TEXT_DIAMOND:
- img->color=color;
- GrTextDiamond3(img,arg1-xx1,arg2-yy1,0,st);
- goto bm_menu;
- }
- break;
- }
- }
- Refresh;
- }
-bm_key_up_done:
- GetMsg(,,1<<MSG_KEY_UP);
-bm_done:
- DCDel(clip);
- DCDel(undo);
- Free(st);
- DCFill(dc);
- SettingsPop;
- doc_e->de_flags=old_de_flags;
- *_img=img;
- *_xx1=xx1,*_yy1=yy1,*_xx2=xx2,*_yy2=yy2;
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Gr/SpriteCode.HC.HTML b/public/src/Adam/Gr/SpriteCode.HC.HTML deleted file mode 100644 index 53991fe..0000000 --- a/public/src/Adam/Gr/SpriteCode.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SpriteCode.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Adam/Gr/SpriteEd.HC.HTML b/public/src/Adam/Gr/SpriteEd.HC.HTML deleted file mode 100644 index 4b5359f..0000000 --- a/public/src/Adam/Gr/SpriteEd.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SpriteEd.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Adam/Gr/SpriteMain.HC.HTML b/public/src/Adam/Gr/SpriteMain.HC.HTML deleted file mode 100644 index f3fbc75..0000000 --- a/public/src/Adam/Gr/SpriteMain.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SpriteMain.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Adam/Gr/SpriteMesh.HC.HTML b/public/src/Adam/Gr/SpriteMesh.HC.HTML deleted file mode 100644 index 516faee..0000000 --- a/public/src/Adam/Gr/SpriteMesh.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SpriteMesh.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Adam/Gr/SpriteNew.HC.HTML b/public/src/Adam/Gr/SpriteNew.HC.HTML deleted file mode 100644 index 82fdd5a..0000000 --- a/public/src/Adam/Gr/SpriteNew.HC.HTML +++ /dev/null @@ -1,201 +0,0 @@ - - - - - SpriteNew.HC - - - - - #help_index "Graphics/Sprite;Sprites"
-#help_file "::/Doc/Sprite"
-
-U8 polypt_map[9]={0,1,2,3,0,4,5,6,7};
-
-I64 sprite_elem_base_sizes[SPT_TYPES_NUM]={
- sizeof(CSpriteBase), //SPT_END
- sizeof(CSpriteColor), //SPT_COLOR
- sizeof(CSpriteDitherColor), //SPT_DITHER_COLOR
- sizeof(CSpriteT), //SPT_THICK
- sizeof(CSpritePtPt), //SPT_PLANAR_SYMMETRY
- sizeof(CSpriteBase), //SPT_TRANSFORM_ON
- sizeof(CSpriteBase), //SPT_TRANSFORM_OFF
- sizeof(CSpritePt), //SPT_SHIFT
- sizeof(CSpritePt), //SPT_PT
- sizeof(CSpriteNumPtU8s), //SPT_POLYPT
- sizeof(CSpritePtPt), //SPT_LINE
- sizeof(CSpriteNumU8s), //SPT_POLYLINE
- sizeof(CSpritePtPt), //SPT_RECT
- sizeof(CSpritePtPtAng), //SPT_ROTATED_RECT
- sizeof(CSpritePtRad), //SPT_CIRCLE
- sizeof(CSpritePtWHAng), //SPT_ELLIPSE
- sizeof(CSpritePtWHAngSides), //SPT_POLYGON
- sizeof(CSpriteNumU8s), //SPT_BSPLINE2
- sizeof(CSpriteNumU8s), //SPT_BSPLINE2_CLOSED
- sizeof(CSpriteNumU8s), //SPT_BSPLINE3
- sizeof(CSpriteNumU8s), //SPT_BSPLINE3_CLOSED
- sizeof(CSpritePt), //SPT_FLOOD_FILL
- sizeof(CSpritePt), //SPT_FLOOD_FILL_NOT
- sizeof(CSpritePtWHU8s), //SPT_BITMAP
- sizeof(CSpriteMeshU8s), //SPT_MESH
- sizeof(CSpritePtMeshU8s), //SPT_SHIFTABLE_MESH
- sizeof(CSpritePtPt), //SPT_ARROW
- sizeof(CSpritePtStr), //SPT_TEXT
- sizeof(CSpritePtStr), //SPT_TEXT_BOX
- sizeof(CSpritePtStr), //SPT_TEXT_DIAMOND
-};
-
-I64 SpriteElemQuedBaseSize(I64 type)
-{
- return sprite_elem_base_sizes[type&SPG_TYPE_MASK]+offset(CSprite.start);
-}
-
-I64 SpriteElemSize(CSprite *tmpg)
-{
- I64 i=sprite_elem_base_sizes[tmpg->type&SPG_TYPE_MASK];
- switch (tmpg->type&SPG_TYPE_MASK) {
- case SPT_POLYLINE:
- i+=tmpg->nu.num*sizeof(CD2I32);
- break;
- case SPT_TEXT:
- case SPT_TEXT_BOX:
- case SPT_TEXT_DIAMOND:
- i+=StrLen(tmpg->ps.st)+1;
- break;
- case SPT_BITMAP:
- i+=((tmpg->pwhu.width+7)&~7)*tmpg->pwhu.height;
- break;
- case SPT_POLYPT:
- i+=(tmpg->npu.num*3+7)>>3;
- break;
- case SPT_BSPLINE2:
- case SPT_BSPLINE3:
- case SPT_BSPLINE2_CLOSED:
- case SPT_BSPLINE3_CLOSED:
- i+=tmpg->nu.num*sizeof(CD3I32);
- break;
- case SPT_MESH:
- i+=tmpg->mu.vertex_cnt*sizeof(CD3I32)+
- tmpg->mu.tri_cnt*sizeof(CMeshTri);
- break;
- case SPT_SHIFTABLE_MESH:
- i+=tmpg->pmu.vertex_cnt*sizeof(CD3I32)+
- tmpg->pmu.tri_cnt*sizeof(CMeshTri);
- break;
- }
- return i;
-}
-
-public I64 SpriteSize(U8 *elems)
-{//Walk sprite elements and return size of sprite as binary data.
- CSprite *tmpg=elems-offset(CSprite.start),*tmpg1=tmpg;
- while (tmpg->type&SPG_TYPE_MASK)
- tmpg(U8 *)+=SpriteElemSize(tmpg);
- return tmpg(U8 *)-tmpg1(U8 *)+sprite_elem_base_sizes[SPT_END];
-}
-
-I64 SpriteTypeMask(U8 *elems)
-{
- I64 res=0;
- CSprite *tmpg=elems-offset(CSprite.start);
- while (tmpg->type&SPG_TYPE_MASK) {
- if (tmpg->type&SPG_TYPE_MASK>=SPT_TYPES_NUM)
- return 1<<SPT_TYPES_NUM;
- Bts(&res,tmpg->type&SPG_TYPE_MASK);
- tmpg(U8 *)+=SpriteElemSize(tmpg);
- }
- return res;
-}
-
-U0 SpriteSelAll(U8 *elems,Bool val)
-{
- CSprite *tmpg=elems-offset(CSprite.start);
- while (tmpg->type&SPG_TYPE_MASK) {
- BEqu(&tmpg->type,SPf_SEL,val);
- tmpg(U8 *)+=SpriteElemSize(tmpg);
- }
-}
-
-public U8 *DC2Sprite(CDC *tmpb)
-{//Convert device context to sprite.
- CSprite *tmpg;
- tmpg=CAlloc(sprite_elem_base_sizes[SPT_BITMAP]+
- tmpb->width_internal*tmpb->height+
- sprite_elem_base_sizes[SPT_END])
- (U8 *)-offset(CSprite.start);
- tmpg->type=SPT_BITMAP;
- tmpg->pwhu.width=tmpb->width;
- tmpg->pwhu.height=tmpb->height;
- tmpg->pwhu.x1=0;
- tmpg->pwhu.y1=0;
- MemCpy(&tmpg->pwhu.u,tmpb->body,tmpb->width_internal*tmpb->height);
- return tmpg(U8 *)+offset(CSprite.start);
-}
-
-public U8 *SpriteElem2Summary(CSprite *tmpg)
-{//Study /Demo/Graphics/SpriteText.HC.
- U8 buf[STR_LEN],buf2[STR_LEN];
- I32 *ptr;
- StrPrint(buf,"%Z",tmpg->type&SPG_TYPE_MASK,"ST_SPRITE_ELEM_TYPES");
- switch (tmpg->type&SPG_TYPE_MASK) {
- case SPT_COLOR:
- CatPrint(buf,"%s",Color2Str(buf2,tmpg->c.color));
- break;
- case SPT_DITHER_COLOR:
- CatPrint(buf,"%s",Color2Str(buf2,ROPF_DITHER|tmpg->d.dither_color.u8[0]|
- tmpg->d.dither_color.u8[1]<<COLORROP_BITS));
- break;
- case SPT_PT:
- case SPT_FLOOD_FILL:
- case SPT_FLOOD_FILL_NOT:
- case SPT_SHIFT:
- CatPrint(buf,"(%d,%d)",tmpg->p.x1,tmpg->p.y1);
- break;
- case SPT_LINE:
- case SPT_ARROW:
- case SPT_PLANAR_SYMMETRY:
- case SPT_RECT:
- case SPT_ROTATED_RECT:
- CatPrint(buf,"(%d,%d),(%d,%d)",tmpg->pp.x1,tmpg->pp.y1,
- tmpg->pp.x2,tmpg->pp.y2);
- break;
- case SPT_CIRCLE:
- CatPrint(buf,"(%d,%d):%dR",tmpg->pr.x1,tmpg->pr.y1,tmpg->pr.radius);
- break;
- case SPT_THICK:
- CatPrint(buf,"%d",tmpg->t.thick);
- break;
- case SPT_TEXT:
- case SPT_TEXT_BOX:
- case SPT_TEXT_DIAMOND:
- CatPrint(buf,"%d,%d:%-16t$Q",tmpg->ps.x1,tmpg->ps.y1,tmpg->ps.st);
- break;
- case SPT_POLYLINE:
- case SPT_POLYPT:
- ptr=&tmpg->npu.x;
- CatPrint(buf,"%d(%d,%d)",tmpg->npu.num,ptr[0],ptr[1]);
- break;
- case SPT_ELLIPSE:
- case SPT_POLYGON:
- case SPT_BITMAP:
- CatPrint(buf,"(%d,%d):%dW,%dH",tmpg->pwhu.x1,tmpg->pwhu.y1,
- tmpg->pwhu.width,tmpg->pwhu.height);
- break;
- case SPT_BSPLINE2:
- case SPT_BSPLINE3:
- case SPT_BSPLINE2_CLOSED:
- case SPT_BSPLINE3_CLOSED:
- CatPrint(buf,"%d",tmpg->nu.num);
- break;
- case SPT_MESH:
- CatPrint(buf,"%dV,%dT",tmpg->mu.vertex_cnt,tmpg->mu.tri_cnt);
- break;
- case SPT_SHIFTABLE_MESH:
- CatPrint(buf,"%dV,%dT",tmpg->pmu.vertex_cnt,tmpg->pmu.tri_cnt);
- break;
- }
- return StrNew(buf);
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Gr/SpriteSideBar.HC.HTML b/public/src/Adam/Gr/SpriteSideBar.HC.HTML deleted file mode 100644 index 484fd01..0000000 --- a/public/src/Adam/Gr/SpriteSideBar.HC.HTML +++ /dev/null @@ -1,107 +0,0 @@ - - - - - SpriteSideBar.HC - - - - - #help_index "Graphics/Sprite;Sprites"
-
-CSprite *SpriteSideBar2SpriteQue(CDoc *doc,CSprite *head,I64 *_cur_elem_num)
-{//For the side-bar
- CSprite *res=CAlloc(sizeof(CSprite)),*tmpg;
- CDocEntry *doc_e=doc->head.next;
- Bool found=FALSE;
- I64 num=0;
- QueInit(res);
- while (doc_e!=doc) {
- if (doc_e->type_u8==DOCT_MENU_VAL && doc_e->left_exp>=0) {
- tmpg=SpriteSetSettings(,head,doc_e->left_exp);
- if (tmpg!=head) {
- tmpg=MAllocIdent(tmpg);
- BEqu(&tmpg->type,SPf_SEL,Bt(&doc_e->type,DOCEt_SEL));
- if (*_cur_elem_num==doc_e->left_exp) {
- *_cur_elem_num=num;
- found=TRUE;
- }
- QueIns(tmpg,res->last);
- num++;
- }
- }
- doc_e=doc_e->next;
- }
- if (!found)
- *_cur_elem_num=num;
- QueDel(head);
- Free(head);
- return res;
-}
-
-U0 SpriteSideBarPickNew(CDoc *doc,CSprite *head,I64 old_num)
-{
- CSprite *tmpg;
- CDocEntry *doc_cur_e=NULL,*doc_e;
- I64 cur_elem_num=0;
- U8 *st;
- DocPrint(doc,"$PURPLE$$TX+CX,\"Sprite SideBar\"$\n"
- "$LK+PU+CX,\"Click for Help\","
- "A=\"FI:::/Doc/SpriteSideBar.DD.Z\"$\n\n");
- tmpg=head->next;
- while (tmpg!=head) {
- st=SpriteElem2Summary(tmpg);
- if (cur_elem_num==old_num)
- doc_cur_e=doc_e=
- DocPrint(doc,"$LTRED$$MU-UL,\"%$Q\",LE=%d$\n",st,cur_elem_num++);
- else
- doc_e=DocPrint(doc,"$LTBLUE$$MU-UL,\"%$Q\",LE=%d$\n",st,cur_elem_num++);
- BEqu(&doc_e->de_flags,DOCEf_SEL,Bt(&tmpg->type,&SPf_SEL));
- BEqu(&doc_e->type,DOCEt_SEL,Bt(&tmpg->type,SPf_SEL));
- Free(st);
- tmpg=tmpg->next;
- }
- if (cur_elem_num==old_num)
- doc_cur_e=DocPrint(doc,"$LTRED$$MU-UL,\"END\",LE=%d$\n",cur_elem_num);
- else
- DocPrint(doc,"$LTBLUE$$MU-UL,\"END\",LE=%d$\n",cur_elem_num);
- if (doc_cur_e)
- doc->cur_entry=doc_cur_e;
-}
-
-U0 SpriteSideBarTask2(CTask *grand_parent)
-{
- I64 w,h;
- CTask *parent=Fs->parent_task,*pu_task;
- while (TRUE) {
- pu_task=grand_parent->popup_task;
- if (TaskValidate(pu_task)) {
- w=parent->win_right-parent->win_left;
- WinHorz(pu_task->win_right+2,pu_task->win_right+2+w,parent);
- h=parent->win_bottom-parent->win_top;
- WinVert(pu_task->win_top,pu_task->win_top+h,parent);
- }
- Refresh;
- }
-}
-
-U0 SpriteSideBarTask(CTask *parent,CSprite **_head,I64 *_cur_elem_num)
-{
- CDocEntry *doc_e;
- CDoc *doc=DocPut;
- Spawn(&SpriteSideBarTask2,parent,"CSpriteTask",,Fs);
- doc->flags|=DOCF_SIZE_MIN|DOCF_FORM;
- while (TRUE) {
- SpriteSideBarPickNew(doc,*_head,*_cur_elem_num);
- DocHighlightCursor(,doc);
- View;
- doc_e=doc->cur_entry;
- if (doc_e->type_u8==DOCT_MENU_VAL)
- *_cur_elem_num=doc_e->left_exp;
- *_head=SpriteSideBar2SpriteQue(doc,*_head,_cur_elem_num);
- DocClear(doc);
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Host.HC.HTML b/public/src/Adam/Host.HC.HTML deleted file mode 100644 index cd0cf48..0000000 --- a/public/src/Adam/Host.HC.HTML +++ /dev/null @@ -1,82 +0,0 @@ - - - - - Host.HC - - - - - #help_index "Misc/Host"
-
-public Bool HostChgDsk(U8 *iso_filename)
-{//Help user change CD/DVD or ISO_file.
- Bool res=FALSE;
- SettingsPush; //See SettingsPush
- try {
- AutoComplete;
- WinBorder;
- WinMax;
- DocClear;
- "$PURPLE$$TX+CX,\"Set to %s\"$$FG$\n\n\n\n",iso_filename;
- switch (ins_reg.host_vm) {
- case VM_VMWARE:
- if (IsDotC(iso_filename))
-"
-Click CDROM Icon in bottom-right border of VMware window.
-
-Click \"Settings\".
-
-Set ISO image to \"%s\"$FG$.
-When browsing, change the file mask from \"*.iso\" to \"All Files\".
-
-",iso_filename;
- else
-"
-Click CDROM Icon in bottom-right border of VMware window.
-
-Click \"Settings\".
-
-Set ISO image to \"%s\"$FG$.
-
-",iso_filename;
- break;
- case VM_QEMU:
-"
-Change to QEMU monitor using <CTRL-ALT-2>
-
-Get the CDROM designation.
-
- >info block
-
-Use the designation.
-
- >eject ide1-cd0
-
-Use the designation.
-
- >change ide1-cd0 %s
-
-Change back to QEMU using <CTRL-ALT-1>
-
-",iso_filename;
- break;
- default:
-"
-Place the CDDVD %s in the drive.
-
-",iso_filename;
- }
- if (PressAKey!=CH_SHIFT_ESC) {
- ">DskChg('T');\n\n";
- DskChg('T');
- res=TRUE;
- }
- } catch
- PutExcept;
- SettingsPop;
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/InFile.HC.HTML b/public/src/Adam/InFile.HC.HTML deleted file mode 100644 index 4695f66..0000000 --- a/public/src/Adam/InFile.HC.HTML +++ /dev/null @@ -1,152 +0,0 @@ - - - - - InFile.HC - - - - - #help_index "InFile;Help System/Training"
-#help_file "::/Doc/InFile"
-
-public U0 InGetStr(U8 *st)
-{//Wait for user to type certain str.
- I64 ch,sc;
- U8 buf[256],*st2;
- while (*st) {
- ch=GetKey(&sc,FALSE);
- if (sc.u8[0]!=SC_SHIFT &&
- sc.u8[0]!=SC_ALT &&
- sc.u8[0]!=SC_CTRL) {
- if (ch==*st) {
- '' ch;
- st++;
- } else {
- st2=Char2KeyName(*st);
- StrPrint(buf,"Press the $GREEN$<%s>$FG$ key.",st2);
- Free(st2);
- PopUpOk(buf);
- }
- }
- }
-}
-
-public U0 InPrint(I64 mS=100,U8 *fmt,...)
-{//Print message with delay after each char.
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv),*st=buf;
- I64 ch;
- while (ch=*st++) {
- '' ch;
- Sleep(mS);
- }
- Free(buf);
-}
-
-public U0 InGetKey(I64 scan_code,I64 sc_mask=0xFF|SCF_SHIFT|SCF_CTRL|SCF_ALT)
-{//Wait for user to press certain key.
- I64 sc,ch;
- U8 buf[STR_LEN],*st;
- do {
- ch=GetKey(&sc);
- if (sc.u8[0]!=SC_PRTSCRN1 &&
- !(sc.u8[0]==SC_SHIFT && scan_code&SCF_SHIFT) &&
- !(sc.u8[0]==SC_CTRL && scan_code&SCF_CTRL) &&
- !(sc.u8[0]==SC_ALT && scan_code&SCF_ALT) ) {
- if (sc&sc_mask!=scan_code&sc_mask) {
- st=ScanCode2KeyName(scan_code);
- StrPrint(buf,"Press the $GREEN$<%s>$FG$ key",st);
- Free(st);
- PopUpOk(buf);
- }
- }
- } while (sc&sc_mask!=scan_code&sc_mask);
- Msg(MSG_KEY_DOWN,ch,sc);
-}
-
-public I64 InGetChar(...)
-{//Wait for user to press one of set of chars.
- I64 i,sc,ch;
- U8 buf[512],*st;
- while (TRUE) {
- ch=GetKey(&sc);
- if (sc.u8[0]!=SC_SHIFT && sc.u8[0]!=SC_ALT && sc.u8[0]!=SC_CTRL) {
- for (i=0;i<argc;i++)
- if (ch==argv[i]) {
- Msg(MSG_KEY_DOWN,ch,sc);
- return ch;
- }
- StrPrint(buf,"Press ");
- for (i=0;i<argc;i++) {
- st=Char2KeyName(argv[i]);
- CatPrint(buf,"$GREEN$<%s>$FG$",st);
- Free(st);
- if (argc==i+1)
- CatPrint(buf,".");
- else if (argc==i+2)
- CatPrint(buf," or ");
- else
- CatPrint(buf,", ");
- }
- PopUpOk(buf);
- }
- }
-}
-
-public U0 InUntilKey(I64 scan_code,I64 sc_mask=0xFF|SCF_SHIFT|SCF_CTRL|SCF_ALT)
-{//Let user type until he presses certain key.
- I64 sc,ch;
- do {
- ch=GetKey(&sc);
- Msg(MSG_KEY_DOWN,ch,sc);
- } while (sc&sc_mask!=scan_code&sc_mask);
-}
-
-public I64 InUntilChar(...)
-{//Let user type until he presses one of set of chars.
- I64 i,sc,ch;
- while (TRUE) {
- ch=GetKey(&sc);
- Msg(MSG_KEY_DOWN,ch,sc);
- for (i=0;i<argc;i++)
- if (ch==argv[i])
- return ch;
- }
-}
-
-public Bool InView()
-{//Let user type until <ESC> or <SHIFT-ESC>.
- Bool res=View;
- DocBottom;
- return res;
-}
-
-#help_index "InFile;Help System/Training;Mouse"
-I64 in_plot_l,in_plot_r;
-
-Bool InSetMsPlot(I64 mS,I64 x,I64 y,I64 z)
-{
- MsSet(x,y,z,in_plot_l,in_plot_r);
- Sleep(mS);
- return TRUE;
-}
-
-public U0 InSetMs(I64 mS=7,I64 x=I64_MAX,I64 y=I64_MAX,I64 z=I64_MAX,
- I64 l=I64_MAX,I64 r=I64_MAX)
-{//Move mouse to spot at certain speed.
- if (!(0<=x<GR_WIDTH))
- x=ms.pos.x;
- if (!(0<=y<GR_HEIGHT))
- y=ms.pos.y;
- if (z==I64_MAX)
- z=ms.pos.z;
- if (!(FALSE<=l<=TRUE))
- l=ms.lb;
- if (!(FALSE<=r<=TRUE))
- r=ms.rb;
- in_plot_l=l; in_plot_r=r;
- Line(mS,ms.pos.x,ms.pos.y,ms.pos.z,x,y,z,&InSetMsPlot);
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/InsReg.HC.HTML b/public/src/Adam/InsReg.HC.HTML deleted file mode 100644 index e47e4f2..0000000 --- a/public/src/Adam/InsReg.HC.HTML +++ /dev/null @@ -1,76 +0,0 @@ - - - - - InsReg.HC - - - - - #help_index "Registry/Install Registration"
-
-public CInsReg ins_reg;
-MemSet(&ins_reg,0,sizeof(CInsReg));
-
-DefineLstLoad("ST_HOST_OSES","Other\0Native\0Linux\0Windows\0");
-DefineLstLoad("ST_HOST_VMS","Other\0Native\0VMware\0QEMU\0VirtualBox\0");
-
-#define RR_UNREGISTER -1
-#define RR_REGISTER 0
-#define RR_REREGISTER 1
-
-public Bool InsReg(U8 drv_let=0,I64 action=RR_REGISTER)
-{//Register this install in local $LK,"Registry.HC",A="FI:~/Registry.HC"$ file.
- CInsReg r;
- I64 old_drv_let;
- Bool res=FALSE;
-
- if (action==RR_UNREGISTER) {
- MemSet(&r,0,sizeof(CInsReg));
- res=TRUE;
- } else if (action==RR_REREGISTER || !ins_reg.registered) {
- MemCpy(&r,&ins_reg,sizeof(CInsReg));
- r.registered=TRUE;
- if (PopUpForm(&r))
- res=TRUE;
- }
-
- if (res) {
- old_drv_let=*sys_registry_doc->filename.name;
- if (drv_let)
- *sys_registry_doc->filename.name=drv_let;
- RegWrite("Adam/InsReg",
- "#help_index \"Registry/Install Registration\"\n"
- "MemSet(&ins_reg,0,sizeof(CInsReg));\n"
- "ins_reg.registered=%d;\n"
- "ins_reg.host_os=%d;\n"
- "ins_reg.host_vm=%d;\n"
- "\n#define INS_REG_PERSONAL_INITIALS \"%s\"\n"
- "StrCpy(ins_reg.initials,\"%s\");\n"
- "HashPublic(\"INS_REG_PERSONAL_INITIALS\",HTT_DEFINE_STR);\n"
- "\n#define INS_REG_MACHINE_NUM %d\n"
- "ins_reg.machine_num=%d;\n"
- "HashPublic(\"INS_REG_MACHINE_NUM\",HTT_DEFINE_STR);\n"
- "\n\"InsReg:%%s:%%d\\n\","
- "INS_REG_PERSONAL_INITIALS,INS_REG_MACHINE_NUM;\n"
- "\n#help_index \"\"\n"
- ,r.registered,r.host_os,r.host_vm,
- r.initials,r.initials,r.machine_num,r.machine_num);
- *sys_registry_doc->filename.name=old_drv_let;
- RegExe("Adam/InsReg");
- }
- return res;
-}
-
-public Bool InsRereg(U8 drv_let=0)
-{//Reregister this install in local $LK,"Registry.HC",A="FI:~/Registry.HC"$ file.
- return InsReg(drv_let,RR_REREGISTER);
-}
-
-public Bool InsUnreg(U8 drv_let=0)
-{//Unregister this install in local $LK,"Registry.HC",A="FI:~/Registry.HC"$ file.
- return InsReg(drv_let,RR_UNREGISTER);
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/MakeAdam.HC.HTML b/public/src/Adam/MakeAdam.HC.HTML deleted file mode 100644 index 42e7c36..0000000 --- a/public/src/Adam/MakeAdam.HC.HTML +++ /dev/null @@ -1,44 +0,0 @@ - - - - - MakeAdam.HC - - - - - Cd(__DIR__);;
-#include "AExts"
-#include "AMath"
-#include "Training"
-#include "AMem"
-#include "TaskRep"
-#include "AMathODE"
-#include "Gr/MakeGr"
-#include "ASnd"
-#include "ABlkDev/MakeABlkDev"
-#include "Menu"
-#include "Win"
-#include "WinMgr"
-#include "ADbg"
-#include "::/Adam/God/GodExt"
-#include "DolDoc/MakeDoc"
-LBts(&sys_run_level,RLf_DOC);
-#include "Ctrls/MakeCtrls"
-#include "InFile"
-#include "ARegistry"
-#include "InsReg"
-#include "AutoComplete/MakeAC"
-#include "God/MakeGod"
-#include "AHash"
-#include "TaskSettings"
-#include "CPURep"
-#include "DevInfo"
-#include "ADefine"
-#include "WallPaper"
-#include "AMouse"
-#include "Host"
-Cd("..");;
- - - \ No newline at end of file diff --git a/public/src/Adam/Menu.HC.HTML b/public/src/Adam/Menu.HC.HTML deleted file mode 100644 index 21eb70e..0000000 --- a/public/src/Adam/Menu.HC.HTML +++ /dev/null @@ -1,255 +0,0 @@ - - - - - Menu.HC - - - - - #help_index "Menus"
-#help_file "::/Doc/Menus"
-
-CTask *MenuTask()
-{
- CTask *res=sys_focus_task;
- while (res && !res->cur_menu)
- res=res->parent_task;
- return res;
-}
-
-CMenuEntry *sys_cur_submenu_entry=NULL;
-
-public CMenuEntry *MenuSubEntryFind(
- CMenuEntry *haystack_first,U8 *needle_entry_name)
-{//You probably don't need this. Use dir / and MenuEntryFind().
- while (haystack_first) {
- if (!StrCmp(haystack_first->name,needle_entry_name))
- return haystack_first;
- haystack_first=haystack_first->next;
- }
- return NULL;
-}
-
-public CMenuEntry *MenuEntryFind(CMenu *haystack_menu,U8 *needle_full_name)
-{//Find pulldown entry. Fs->cur_menu is probably the menu you want.
-//Just 2 levels -- across top and down are valid, currently.
- U8 *st,*st2;
- CMenuEntry *tmpse;
- if (!haystack_menu || !needle_full_name)
- return NULL;
- st=StrNew(needle_full_name);
- st2=StrNew(needle_full_name);
- tmpse=(&haystack_menu->sub)(U8 *)-offset(CMenuEntry.sub);
- while (*st && tmpse) {
- StrFirstRem(st,"/",st2);
- tmpse=MenuSubEntryFind(tmpse->sub,st2);
- }
- Free(st);
- Free(st2);
- return tmpse;
-}
-
-CMenuEntry *MenuNewSub(CCmpCtrl *cc,CTask *task)
-{
- CMenuEntry *tmpme=NULL,*tmpse;
- if (cc->token==TK_IDENT) {
- tmpme=CAlloc(sizeof(CMenuEntry),task);
- if (StrLen(cc->cur_str)>31)
- cc->cur_str[31]=0;
- StrCpy(tmpme->name,cc->cur_str);
- if (Lex(cc)=='(') {
- tmpme->msg_code=MSG_KEY_DOWN_UP;
- if (Lex(cc)!=',' && cc->token!=')')
- tmpme->msg_code=LexExpressionI64(cc);
- if (cc->token==',')
- Lex(cc);
- if (cc->token!=',' && cc->token!=')')
- tmpme->arg1=LexExpressionI64(cc);
- if (cc->token==',')
- Lex(cc);
- if (cc->token!=',' && cc->token!=')')
- tmpme->arg2=LexExpressionI64(cc);
- if (cc->token!=')')
- LexExcept(cc,"Missing ')' at ");
- if (Lex(cc)!=';')
- LexExcept(cc,"Missing ';' at");
- Lex(cc); //Skip ;
- } else if (cc->token=='{') {
- Lex(cc); //Skip {
- tmpme->dir=TRUE;
- tmpse=&tmpme->sub;
- while (tmpse && cc->token!='}')
- tmpse=tmpse->next=MenuNewSub(cc,task);
- if (cc->token!='}')
- LexExcept(cc,"Missing '}' at ");
- else
- Lex(cc); //Skip }
- } else
- LexExcept(cc,"Expecting '{' at ");
- }
- return tmpme;
-}
-
-public CMenu *MenuNew(U8 *st,I64 flags=0,CTask *task=NULL)
-{//Parse a menu. You probably don't need this.
- CMenu *m;
- CMenuEntry *tmpse;
- CCmpCtrl *cc=CmpCtrlNew(st,CCF_DONT_FREE_BUF);
- if (!task) task=Fs;
- Lex(cc);
- m=CAlloc(sizeof(CMenu),task);
- m->task=task;
- m->flags=flags;
- m->attr =BLUE<<4+YELLOW;
- tmpse=&m->sub;
- while (tmpse)
- tmpse=tmpse->next=MenuNewSub(cc,task);
- CmpCtrlDel(cc);
- return m;
-}
-
-public CMenu *MenuFile(U8 *filename,I64 flags=0,CTask *task=NULL)
-{//Parse a pulldown menu file. You probably don't need this.
- CMenu *m;
- U8 *st=MStrPrint("#include \"%s\"",filename);
- m=MenuNew(st,flags,task);
- Free(st);
- return m;
-}
-
-U0 MenuDelSub(CMenuEntry *tmpme)
-{
- CMenuEntry *tmpse,*tmpse1;
- if (tmpme) {
- tmpse=tmpme->sub;
- while (tmpse) {
- tmpse1=tmpse->next;
- MenuDelSub(tmpse);
- tmpse=tmpse1;
- }
- Free(tmpme);
- }
-}
-
-public U0 MenuDel(CMenu *m)
-{//Delete a manu. You probably don't need this.
- CMenuEntry *tmpme,*tmpme1;
- if (!m) return;
- tmpme=m->sub;
- while (tmpme) {
- tmpme1=tmpme->next;
- MenuDelSub(tmpme);
- tmpme=tmpme1;
- }
- Free(m);
-}
-
-I64 MenuEntryWidth(CMenuEntry *tmpme)
-{
- I64 res=StrLen(tmpme->name);
- CMenuEntry *tmpse=tmpme->sub;
- while (tmpse) {
- res=MaxI64(res,StrLen(tmpse->name));
- tmpse=tmpse->next;
- }
- return res+1;
-}
-
-public CMenu *MenuPush(U8 *st)
-{//Save old pulldown menu and replace with new from str.
- CMenu *m=MenuNew(st);
- m->next=Fs->cur_menu;
- Fs->cur_menu=m;
- return m;
-}
-
-public CMenu *MenuFilePush(U8 *filename)
-{//Save old pulldown menu and replace with new from file.
- CMenu *m=MenuFile(filename);
- m->next=Fs->cur_menu;
- Fs->cur_menu=m;
- return m;
-}
-
-public U0 MenuPop()
-{//Restore old pulldown menu. Delete just-deactivated menu.
- CMenu *m=Fs->cur_menu;
- if (!m) return;
- Fs->cur_menu=m->next;
- MenuDel(m);
-}
-
-U0 DrawMenu(CDC *dc)
-{
- CMenu *m;
- CMenuEntry *tmpme,*tmpse,*cur_submenu=NULL;
- U8 *st=NULL;
- CTask *task=MenuTask;
- I64 i,w,x0,y0,x1=ms.pos.x,y1=ms.pos.y;
- if (!TaskValidate(task) || !(m=task->cur_menu)) {
- sys_cur_submenu_entry=NULL;
- return;
- }
- dc->color=m->attr>>4;
- GrRect(dc,0,0,GR_WIDTH,FONT_HEIGHT);
- x0=0;
- tmpme=m->sub;
- while (tmpme) {
- w=MenuEntryWidth(tmpme)*FONT_WIDTH;
- if (x0<=x1<x0+w) {
- if (0<=y1<FONT_HEIGHT) {
- dc->color=m->attr&15;
- GrRect(dc,x0,0,w,FONT_HEIGHT);
- dc->color=m->attr>>4;
- } else
- dc->color=m->attr&15;
- GrPrint(dc,x0,0,"%s",tmpme->name);
- y0=FONT_HEIGHT;
- tmpse=tmpme->sub;
- while (tmpse) {
- if (tmpse->checked)
- i=m->attr^0xFF;
- else
- i=m->attr;
- if (y0<=y1<y0+FONT_HEIGHT) {
- if (tmpse->msg_code==MSG_KEY_DOWN||
- tmpse->msg_code==MSG_KEY_DOWN_UP) {
- if (!tmpse->arg2)
- tmpse->arg2=Char2ScanCode(tmpse->arg1);
- st=ScanCode2KeyName(tmpse->arg2);
- }
- sys_cur_submenu_entry=cur_submenu=tmpse;
- dc->color=i&15;
- GrRect(dc,x0,y0,w,FONT_HEIGHT);
- dc->color=i>>4;
- GrPrint(dc,x0,y0,"%s",tmpse->name);
- if (st) {
- dc->color=i>>4;
- GrRect(dc,x0+w,y0-FONT_HEIGHT,
- (StrLen(st)+1)*FONT_WIDTH,FONT_HEIGHT*3);
- dc->color=i&15;
- GrPrint(dc,x0+w,y0,"%s",st);
- Free(st);
- }
- } else {
- dc->color=i>>4;
- GrRect(dc,x0,y0,w,FONT_HEIGHT);
- dc->color=i&15;
- GrPrint(dc,x0,y0,"%s",tmpse->name);
- }
- y0+=FONT_HEIGHT;
- tmpse=tmpse->next;
- }
- } else {
- dc->color=m->attr&15;
- GrPrint(dc,x0,0,"%s",tmpme->name);
- }
- x0+=w;
- tmpme=tmpme->next;
- }
- sys_cur_submenu_entry=cur_submenu;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Opt/Boot/BootDVD.HC.HTML b/public/src/Adam/Opt/Boot/BootDVD.HC.HTML deleted file mode 100644 index 34d1289..0000000 --- a/public/src/Adam/Opt/Boot/BootDVD.HC.HTML +++ /dev/null @@ -1,200 +0,0 @@ - - - - - BootDVD.HC - - - - - #define BOOT_HIGH_LOC_DVD ((BOOT_RAM_LIMIT-\
- (BOOT_STK_SIZE+DVD_BOOT_LOADER_SIZE))>>4)
-
-DefinePrint(
- "DD_BOOT_HIGH_LOC_DVD","%08X",BOOT_HIGH_LOC_DVD<<4);
-DefinePrint(
- "DD_BOOT_HIGH_LOC_DVD_END","%08X",BOOT_RAM_LIMIT-1);
-
-asm {
-USE16
-BDVD_START::
-//DL is supposed to have the BIOS drive number
- CLD
- MOV AX,BOOT_HIGH_LOC_DVD
- MOV ES,AX
-
- CLI
- MOV SS,AX
- MOV SP,BOOT_STK_SIZE+DVD_BOOT_LOADER_SIZE
- STI
-
- CALL BDVD_GET_RIP
-BDVD_GET_RIP:
- POP BX
- SUB BX,BDVD_GET_RIP-BDVD_START
- SHR BX,4
-//This copies this bootloader's code to 0x$TX,"00096600",D="DD_BOOT_HIGH_LOC_DVD"$
- MOV AX,CS
- ADD AX,BX
- MOV DS,AX
- MOV CX,DVD_BOOT_LOADER_SIZE
- XOR SI,SI
- XOR DI,DI
- REP_MOVSB
-
- MOV AX,BOOT_HIGH_LOC_DVD
- MOV DS,AX
-
-//My assembler doesn't support 16-bit very well.
- DU8 0xEA; //JMP BOOT_HIGH_LOC_DVD:BDVD_MAIN
- DU16 BDVD_MAIN-BDVD_START,BOOT_HIGH_LOC_DVD;
-
-BDVD_BIOS_DRV_NUM: DU8 0;
-BDVD_PAGE: DU8 0;
-
-BDVD_DAP: DU8 16,0,1,0; //One blk at a time
-BDVD_DAP_BUF: DU16 0,0;
-BDVD_DAP_BLK: DU64 0;
-
-BDVD_TEMPLEOS_MSG:
- DU8 "LoadingTempleOS",0;
-
-BDVD_NOT64_MSG:
- DU8 "TempleOS requires a 64-bit capable processor.\n\r",0;
-
-//These get patched.
-BDVD_BLK_LO:: DU16 0;
-BDVD_BLK_HI:: DU16 0;
-BDVD_BLK_CNT:: DU16 0;
-BDVD_SHIFT_BLKS:: DU16 0;
-BDVD_PROGRESS_STEP:: DU32 0;
-BDVD_PROGRESS_VAL:: DU32 0;
-
-BDVD_PUT_CHAR::
- MOV AH,0xE
- MOV BL,7 //Might be foreground color on some BIOS's
- MOV BH,U8 [BDVD_PAGE-BDVD_START]
- INT 0x10
-BDVD_RET::
- RET
-BDVD_PUTS::
-@@1: LODSB
- TEST AL,AL
- JZ BDVD_RET
- CALL BDVD_PUT_CHAR
- JMP @@1
-
-BDVD_MAIN::
- MOV U8 [BDVD_BIOS_DRV_NUM-BDVD_START],DL //Passed in by BIOS
-
- MOV AH,0xF
- INT 0x10
- MOV U8 [BDVD_PAGE-BDVD_START],BH //Video page
-
- MOV EAX,0x80000000
- CPUID
- CMP EAX,0x80000001
- JB @@05
-
- MOV EAX,0x80000001
- CPUID
- BT EDX,29
- JC @@15
-@@05: MOV SI,BDVD_NOT64_MSG-BDVD_START
- CALL BDVD_PUTS
-@@10: JMP @@10
-
-@@15: MOV SI,BDVD_TEMPLEOS_MSG-BDVD_START
- CALL BDVD_PUTS
-
- MOV AX,BOOT_RAM_BASE/16
- MOV ES,AX
- XOR ECX,ECX
- MOV CX,U16 [BDVD_BLK_CNT-BDVD_START]
-
- MOV EAX,(80-7-9)*65536 //80 columns
- XOR EDX,EDX
- DIV ECX
- MOV U32 [BDVD_PROGRESS_STEP-BDVD_START],EAX
- MOV U32 [BDVD_PROGRESS_VAL-BDVD_START],0
-
- MOV AX,U16 [BDVD_BLK_LO-BDVD_START]
- MOV DX,U16 [BDVD_BLK_HI-BDVD_START]
-
-@@20: PUSH CX //Blk cnt
-
-//READ BLK
- PUSH AX //Blk lo
- PUSH DX //Blk hi
- PUSH ES //Buf seg
- MOV U16 [BDVD_DAP_BLK-BDVD_START],AX
- MOV U16 [BDVD_DAP_BLK+2-BDVD_START],DX
- MOV AX,ES
- MOV U16 [BDVD_DAP_BUF+2-BDVD_START],AX //ES:0000
- MOV SI,BDVD_DAP-BDVD_START //DS:SI=DAP
- MOV AH,0x42
- MOV DL,U8 [BDVD_BIOS_DRV_NUM-BDVD_START]
- INT 0x13
-
- POP AX //ES
- ADD AX,DVD_BLK_SIZE/16
- MOV ES,AX
- POP DX
- POP AX
- INC AX
- JNZ @@25
- INC DX
-
-@@25: PUSH AX
- MOV BX,U16 [BDVD_PROGRESS_VAL+2-BDVD_START]
- MOV EAX,U32 [BDVD_PROGRESS_STEP-BDVD_START]
- ADD U32 [BDVD_PROGRESS_VAL-BDVD_START],EAX
- CMP U16 [BDVD_PROGRESS_VAL+2-BDVD_START],BX
- JE @@30
- MOV AL,'.'
- CALL BDVD_PUT_CHAR
-@@30: POP AX
-
- POP CX
- LOOP @@20
-
-//Shift backward to align
- PUSH DS
- MOV BX,U16 [BDVD_SHIFT_BLKS-BDVD_START]
- SHL BX,BLK_SIZE_BITS-4
- MOV CX,U16 [BDVD_BLK_CNT-BDVD_START]
- MOV AX,BOOT_RAM_BASE/16
- MOV ES,AX
- ADD AX,BX
- MOV DS,AX
-@@35: PUSH CX
- XOR SI,SI
- XOR DI,DI
- MOV CX,DVD_BLK_SIZE/4
- REP_MOVSD
- MOV AX,DS
- ADD AX,DVD_BLK_SIZE/16
- MOV DS,AX
- MOV AX,ES
- ADD AX,DVD_BLK_SIZE/16
- MOV ES,AX
- POP CX
- LOOP @@35
- POP DS
-
-//See BootDVDProbe().
- MOV EBX,U32 [BDVD_BLK_LO-BDVD_START]
- MOV AX,U16 [BDVD_SHIFT_BLKS-BDVD_START]
- SHL EAX,16
- MOV AX,BOOT_SRC_DVD //$MA-X+PU,"See sys_boot_src",LM="Find(\"sys_boot_src\",\"/*\");View;\n"$
-
-//My assembler doesn't support 16-bit very well.
- DU8 0xEA; //JMP BOOT_RAM_BASE:0000
- DU16 0,BOOT_RAM_BASE/16;
-//Continues here /Kernel/KStart16.HC",A="FL:::/Kernel/KStart16.HC,1
-BDVD_END::
-#assert BDVD_END-BDVD_START<DVD_BOOT_LOADER_SIZE
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Opt/Boot/BootDVDIns.HC.HTML b/public/src/Adam/Opt/Boot/BootDVDIns.HC.HTML deleted file mode 100644 index 3bef7b3..0000000 --- a/public/src/Adam/Opt/Boot/BootDVDIns.HC.HTML +++ /dev/null @@ -1,44 +0,0 @@ - - - - - BootDVDIns.HC - - - - - //See Install Documentation.
-//Study my account examples: $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOS/TOSCfg.HC,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOS/TOSDistro.HC,1"$
-
-#include "BootDVD"
-#include "DskISORedSea"
-
-#help_index "Install"
-
-#define KERNEL_BIN_C "Kernel.BIN.C"
-#define BOOT_DIR "/0000Boot"
-#define BOOT_DIR_KERNEL_BIN_C BOOT_DIR "/0000" KERNEL_BIN_C
-
-U0 MakeAll()
-{
- if (Cmp("/Compiler/Compiler","Compiler",,':'))
- throw;
- if (Cmp("/Kernel/Kernel","Kernel",,':'))
- throw;
-}
-
-public U0 BootDVDIns(U8 drv_let=0)
-{//See /Misc/DoDistro.HC.
- try {
- if (!Drv(drv_let))
- throw;
- MakeAll;
- Move("/Kernel/Kernel.BIN.Z",BOOT_DIR_KERNEL_BIN_C);
- } catch {
- PutExcept;
- Beep;
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Opt/Boot/BootHD.HC.HTML b/public/src/Adam/Opt/Boot/BootHD.HC.HTML deleted file mode 100644 index 415ddd4..0000000 --- a/public/src/Adam/Opt/Boot/BootHD.HC.HTML +++ /dev/null @@ -1,105 +0,0 @@ - - - - - BootHD.HC - - - - - #define MODULE_SIZE 1*BLK_SIZE
-#define BOOT_HIGH_LOC_HD ((BOOT_RAM_LIMIT-\
- (BOOT_STK_SIZE+MODULE_SIZE))>>4)
-
-DefinePrint(
- "DD_BOOT_HIGH_LOC_HD","%08X",BOOT_HIGH_LOC_HD<<4);
-
-asm {
-USE16
-BHD_CODE::
-
-#define BHD_START (BHD_CODE-offset(CFAT32Boot.code))
-
- CLD
-
- MOV AX,BOOT_HIGH_LOC_HD
- MOV ES,AX
-
- CLI
- MOV SS,AX
- MOV SP,BOOT_STK_SIZE+MODULE_SIZE
- STI
-
- CALL BHD_GET_RIP
-BHD_GET_RIP:
- POP BX
- SUB BX,BHD_GET_RIP-BHD_START
- SHR BX,4
-//This copies this bootloader's code to 0x$TX,"00096C00",D="DD_BOOT_HIGH_LOC_HD"$
- MOV AX,CS
- ADD AX,BX
- MOV DS,AX
- MOV CX,MODULE_SIZE
- XOR SI,SI
- XOR DI,DI
- REP_MOVSB
-
- MOV AX,BOOT_HIGH_LOC_HD
- MOV DS,AX
-
-//My assembler doesn't support 16-bit very well.
- DU8 0xEA; //JMP BOOT_HIGH_LOC_HD:BHD_HISTART
- DU16 BHD_HISTART-BHD_START,BOOT_HIGH_LOC_HD;
-
-BHD_BIOS_DRV_NUM: DU8 0;
-
-//Gets patched by BootHDIns().
-BHD_BLK_CNT:: DU16 0;
-
-BHD_DAP: DU8 16,0,1,0; //One blk at a time
-BHD_DAP_BUF: DU16 0,0;
-//Gets patched by BootHDIns().
-BHD_DAP_BLK:: //64-bit
-BHD_DAP_BLK_LO: DU32 0;
-BHD_DAP_BLK_HI: DU32 0;
-
-BHD_HISTART:
- MOV U8 [BHD_BIOS_DRV_NUM-BHD_START],DL //Passed in by BIOS
- MOV AX,BOOT_RAM_BASE/16
- MOV ES,AX
- XOR ECX,ECX
- MOV CX,U16 [BHD_BLK_CNT-BHD_START]
-
-@@05: PUSH CX //Blk cnt
-
-//READ BLK
- PUSH ES //Buf seg
- MOV AX,ES
- MOV U16 [BHD_DAP_BUF+2-BHD_START],AX //ES:0000
- MOV SI,BHD_DAP-BHD_START //DS:SI=DAP
- MOV AH,0x42
- MOV DL,U8 [BHD_BIOS_DRV_NUM-BHD_START]
- INT 0x13
-
- POP AX //ES
- ADD AX,BLK_SIZE/16
- MOV ES,AX
- INC U32 [BHD_DAP_BLK_LO-BHD_START]
- JNZ @@10
- INC U32 [BHD_DAP_BLK_HI-BHD_START]
-
-@@10: POP CX
- LOOP @@05
-
- XOR EBX,EBX
- MOV EAX,BOOT_SRC_HARDDRV //$MA-X+PU,"See sys_boot_src",LM="Find(\"sys_boot_src\",\"/*\");View;\n"$
-//My assembler doesn't support 16-bit very well.
- DU8 0xEA; //JMP BOOT_RAM_BASE:0000
- DU16 0,BOOT_RAM_BASE/16;
-//Continues here /Kernel/KStart16.HC",A="FL:::/Kernel/KStart16.HC,1
-BHD_END::
-#assert BHD_END-BHD_START<MODULE_SIZE-2
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Opt/Boot/BootHDIns.HC.HTML b/public/src/Adam/Opt/Boot/BootHDIns.HC.HTML deleted file mode 100644 index 8e59431..0000000 --- a/public/src/Adam/Opt/Boot/BootHDIns.HC.HTML +++ /dev/null @@ -1,72 +0,0 @@ - - - - - BootHDIns.HC - - - - - //See Install Documentation.
-//Study my account examples: $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOS/TOSCfg.HC,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOS/TOSDistro.HC,1"$
-
-#include "BootHD"
-
-#help_index "Install"
-
-#define KERNEL_BIN_C "Kernel.BIN.C"
-
-U0 MakeAll()
-{
- if (Cmp("/Compiler/Compiler","Compiler",,':'))
- throw;
- if (Cmp("/Kernel/Kernel","Kernel",,':'))
- throw;
-}
-
-public U0 BootHDIns(U8 drv_let=0)
-{//MakeAll and install new boot-loader.
- CDrv *dv;
- CFAT32Boot br;
- CDirEntry de;
- I64 i;
- try {
- if (!Drv(drv_let))
- throw;
- dv=Fs->cur_dv;
- MakeAll;
- switch (Let2BlkDevType(dv->drv_let)) {
- case BDT_RAM:
- case BDT_ATA:
- Move("/Kernel/Kernel.BIN.Z","/" KERNEL_BIN_C);
- if (!FileFind("/" KERNEL_BIN_C,&de,FUF_JUST_FILES))
- "No Kernel.BIN.C\n";
- else {
- Free(de.full_name);
- "Modifying partition boot record.\n";
- BlkRead(dv,&br,dv->drv_offset,1);
- br.jump_and_nop[0]=OC_JMP_REL8;
- br.jump_and_nop[1]=offset(CFAT32Boot.code)-2;
-#assert offset(CFAT32Boot.code)>=offset(CRedSeaBoot.code)
- br.jump_and_nop[2]=OC_NOP;
- *BHD_BLK_CNT(U16 *)=(de.size+BLK_SIZE-1)>>BLK_SIZE_BITS;
- *BHD_DAP_BLK(I64 *)=Clus2Blk(dv,de.clus);
- for (i=0;i<BHD_END-BHD_CODE;i++)
- br.code[i]=BHD_CODE(U8 *)[i];
-#assert sizeof(CFAT32Boot.code)>=BHD_END-BHD_CODE
- for (;i<sizeof(CFAT32Boot.code);i++)
- br.code[i]=0;
- BlkWrite(dv,&br,dv->drv_offset,1);
- }
- break;
- default:
- throw;
- }
- } catch {
- PutExcept;
- Beep;
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Opt/Boot/BootMHD.HC.HTML b/public/src/Adam/Opt/Boot/BootMHD.HC.HTML deleted file mode 100644 index ae1dc78..0000000 --- a/public/src/Adam/Opt/Boot/BootMHD.HC.HTML +++ /dev/null @@ -1,119 +0,0 @@ - - - - - BootMHD.HC - - - - - #define MODULE_SIZE 1*BLK_SIZE
-#define BOOT_HIGH_LOC_MHD ((BOOT_RAM_LIMIT-\
- (BOOT_STK_SIZE+MODULE_SIZE))>>4)
-
-DefinePrint(
- "DD_BOOT_HIGH_LOC_MHD","%08X",BOOT_HIGH_LOC_MHD<<4);
-
-asm {
-USE16
-BMHD_START::
-BMHD_CODE::
- CLD
-
- MOV AX,BOOT_HIGH_LOC_MHD
-
- CLI
- MOV SS,AX
- MOV SP,BOOT_STK_SIZE+MODULE_SIZE
- STI
-
- PUSHFW
- PUSH DS
- PUSH ES
- PUSH FS
- PUSH GS
- PUSH ECX
- PUSH EBX
- PUSH EDX
- PUSH EBP
-
- MOV ES,AX
-
- CALL BMHD_GET_RIP
-BMHD_GET_RIP:
- POP BX
- SUB BX,BMHD_GET_RIP-BMHD_START
- MOV CX,BX
- SHR BX,4
-//This copies this bootloader's code to 0x$TX,"00096C00",D="DD_BOOT_HIGH_LOC_MHD"$
- MOV AX,CS
- PUSH AX
- ADD AX,BX
- MOV DS,AX
- MOV U16 [BMHD_OLD_CS_RIP-BMHD_START],CX
- POP U16 [BMHD_OLD_CS_RIP+2-BMHD_START]
-
- MOV CX,MODULE_SIZE
- XOR SI,SI
- XOR DI,DI
- REP_MOVSB
-
- MOV AX,BOOT_HIGH_LOC_MHD
- MOV DS,AX
-
-//My assembler doesn't support 16-bit very well.
- DU8 0xEA; //JMP BOOT_HIGH_LOC_MHD:BMHD_HISTART
- DU16 BMHD_HISTART-BMHD_START,BOOT_HIGH_LOC_MHD;
-
-BMHD_BIOS_DRV_NUM: DU8 0;
-BMHD_OLD_CS_RIP: DU16 0,0;
-//Gets patched by BootHDIns().
-BMHD_BLK_CNT:: DU16 0;
-
-BMHD_DAP: DU8 16,0,1,0; //One blk at a time
-BMHD_DAP_BUF: DU16 0,0;
-//Gets patched by BootHDIns().
-BMHD_DAP_BLK:: //64-bit
-BMHD_DAP_BLK_LO: DU32 0;
-BMHD_DAP_BLK_HI: DU32 0;
-
-BMHD_HISTART:
- MOV U8 [BMHD_BIOS_DRV_NUM-BMHD_START],DL //Passed in by BIOS
- MOV AX,BOOT_RAM_BASE/16
- MOV ES,AX
- XOR ECX,ECX
- MOV CX,U16 [BMHD_BLK_CNT-BMHD_START]
-
-@@05: PUSH CX //Blk cnt
-
-//READ BLK
- PUSH ES //Buf seg
- MOV AX,ES
- MOV U16 [BMHD_DAP_BUF+2-BMHD_START],AX //ES:0000
- MOV SI,BMHD_DAP-BMHD_START //DS:SI=DAP
- MOV AH,0x42
- MOV DL,U8 [BMHD_BIOS_DRV_NUM-BMHD_START]
- INT 0x13
-
- POP AX //ES
- ADD AX,BLK_SIZE/16
- MOV ES,AX
- INC U32 [BMHD_DAP_BLK_LO-BMHD_START]
- JNZ @@10
- INC U32 [BMHD_DAP_BLK_HI-BMHD_START]
-
-@@10: POP CX
- LOOP @@05
-
- MOV DL,U8 [BMHD_BIOS_DRV_NUM-BMHD_START]
- MOV EBX,U32 [BMHD_OLD_CS_RIP-BMHD_START]
-//My assembler doesn't support 16-bit very well.
- DU8 0xEA; //JMP BOOT_RAM_BASE:0000
- DU16 0,BOOT_RAM_BASE/16;
-//ContinueshereBMHD2_START
-BMHD_END::
-#assert BMHD_END-BMHD_START<=440
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Opt/Boot/BootMHD2.HC.HTML b/public/src/Adam/Opt/Boot/BootMHD2.HC.HTML deleted file mode 100644 index 6851a6e..0000000 --- a/public/src/Adam/Opt/Boot/BootMHD2.HC.HTML +++ /dev/null @@ -1,135 +0,0 @@ - - - - - BootMHD2.HC - - - - - #define MODULE_SIZE 2*BLK_SIZE
-#define BOOT_HIGH_LOC_MHD2 ((BOOT_RAM_LIMIT-\
- (BOOT_STK_SIZE+MODULE_SIZE))>>4)
-
-DefinePrint(
- "DD_BOOT_HIGH_LOC_MHD2","%08X",BOOT_HIGH_LOC_MHD2<<4);
-
-asm {
-USE16
-BMHD2_START::
- MOV U32 FS:[0],'B'+0x2000+('2'+0x2000)<<16
-
- MOV AX,BOOT_HIGH_LOC_MHD2
- MOV ES,AX
-//This copies this bootloader's code to 0x$TX,"00096A00",D="DD_BOOT_HIGH_LOC_MHD2"$
- MOV AX,CS
- MOV DS,AX
- MOV U32 [BMHD2_OLD_CS_RIP-BMHD2_START],EBX
- MOV U8 [BMHD2_BIOS_DRV_NUM-BMHD2_START],DL
-
- MOV CX,MODULE_SIZE
- XOR SI,SI
- XOR DI,DI
- REP_MOVSB
-
- MOV AX,BOOT_HIGH_LOC_MHD2
- MOV DS,AX
-
-//My assembler doesn't support 16-bit very well.
- DU8 0xEA; //JMP BOOT_HIGH_LOC_MHD2:BMHD2_HISTART
- DU16 BMHD2_HISTART-BMHD2_START,BOOT_HIGH_LOC_MHD2;
-
-BMHD2_BOOT_MSG::
- DU8 256 DUP(0);
-
-BMHD2_BIOS_DRV_NUM: DU8 0;
-BMHD2_PAGE: DU8 0;
-BMHD2_BLK_ARRAY:: DU64 8 DUP(0);
-
-BMHD2_DAP: DU8 16,0,1,0; //One blk at a time
-BMHD2_DAP_BUF: DU16 0,0;
-BMHD2_DAP_BLK:: //64-bit
-BMHD2_DAP_BLK_LO: DU32 0;
-BMHD2_DAP_BLK_HI: DU32 0;
-
-BMHD2_PUT_CHAR::
- MOV AH,0xE
- MOV BL,7 //Might be foreground color on some BIOS's
- MOV BH,U8 [BMHD2_PAGE-BMHD2_START]
- INT 0x10
-BMHD2_RET::
- RET
-BMHD2_PUTS::
-@@1: LODSB
- TEST AL,AL
- JZ BMHD2_RET
- CALL BMHD2_PUT_CHAR
- JMP @@1
-
-BMHD2_GETCHAR:
- XOR AH,AH
- INT 0x16
- PUSH AX
- MOV AH,0x0E
- MOV BX,0x07
- INT 0x10
- POP AX
- RET
-
-BMHD2_HISTART:
- MOV AH,0xF
- INT 0x10
- MOV U8 [BMHD2_PAGE-BMHD2_START],BH //Video page
-
- MOV U32 FS:[0],0
-@@5: MOV SI,BMHD2_BOOT_MSG-BMHD2_START
- CALL BMHD2_PUTS
- CALL BMHD2_GETCHAR
- CMP AL,'0'
- JB @@5
- CMP AL,'8'
- JAE @@5
- AND EAX,7
-
- MOV EBX,U32 BMHD2_BLK_ARRAY-BMHD2_START[EAX*8]
- MOV EAX,U32 BMHD2_BLK_ARRAY+4-BMHD2_START[EAX*8]
-
- TEST EBX,EBX
- JNZ @@10
- TEST EAX,EAX
- JZ @@5
-
-@@10: MOV U32 [BMHD2_DAP_BLK_LO-BMHD2_START],EBX
- MOV U32 [BMHD2_DAP_BLK_HI-BMHD2_START],EAX
-
- MOV AX,U16 [BMHD2_OLD_CS_RIP-BMHD2_START]
- SHR AX,4
- ADD AX,U16 [BMHD2_OLD_CS_RIP+2-BMHD2_START]
- MOV U16 [BMHD2_DAP_BUF+2-BMHD2_START],AX //ES:0000
- MOV SI,BMHD2_DAP-BMHD2_START //DS:SI=DAP
- MOV DL,U8 [BMHD2_BIOS_DRV_NUM-BMHD2_START]
- MOV AH,0x42
- INT 0x13
-
- POP EBP
- POP EDX
- POP EBX
- POP ECX
- XOR EAX,EAX
- POP GS
- POP FS
- POP ES
- POP DS
- POPFW
-
-//My assembler doesn't support 16-bit very well.
- DU8 0xEA; //JMP xxxx:yyyy
-BMHD2_OLD_CS_RIP:
- DU16 0,0;
-BMHD2_END::
-//Continues here ::/Adam/Opt/Boot/BootHD.HC
-#assert BMHD2_END-BMHD2_START<MODULE_SIZE
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Opt/Boot/BootMHDIns.HC.HTML b/public/src/Adam/Opt/Boot/BootMHDIns.HC.HTML deleted file mode 100644 index e3b785b..0000000 --- a/public/src/Adam/Opt/Boot/BootMHDIns.HC.HTML +++ /dev/null @@ -1,164 +0,0 @@ - - - - - BootMHDIns.HC - - - - - //See Install Documentation.
-//Study my account examples: $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOS/TOSCfg.HC,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOS/TOSDistro.HC,1"$
-
-#include "BootMHD"
-#include "BootMHD2"
-
-#help_index "Install"
-
-#define BOOT_DIR "/0000Boot"
-//Stage 2 of master boot loader
-#define BOOT_DIR_BOOTMHD2_BIN_C BOOT_DIR "/BootMHD2.BIN.C"
-//Old master boot record
-#define BOOT_DIR_OLDMBR_BIN_C BOOT_DIR "/OldMBR.BIN.C"
-
-public U0 BootMHDOldRead(U8 src_drv,U8 dst_drv)
-{//Reads MBR from disk drive containing src partition.
-//Writes a single blk file to dst BOOT_DIR.
- CBlkDev *bd=Let2BlkDev(src_drv);
- CDrv *dv;
- CMasterBoot mbr;
- Drv(dst_drv);
- dv=Fs->cur_dv;
- if (dv->fs_type!=FSt_REDSEA && dv->fs_type!=FSt_FAT32)
- PrintErr("File System Not Supported\n");
- else {
-//Bypass partition bounds-checking
- BlkDevLock(bd);
- ATAReadBlks(bd,&mbr,0,1);
- BlkDevUnlock(bd);
-
- Drv(dst_drv);
- DirMk(BOOT_DIR);
- FileWrite(BOOT_DIR_OLDMBR_BIN_C,&mbr,BLK_SIZE);
- }
-}
-
-public U0 BootMHDOldWrite(U8 src_drv,U8 dst_drv)
-{//Reads OldMBR from src drive BOOT_DIR.
-//writes it to the MBR of the drive with dst partition.
- CBlkDev *bd=Let2BlkDev(dst_drv);
- CMasterBoot *mbr;
- Drv(src_drv);
- if (mbr=FileRead(BOOT_DIR_OLDMBR_BIN_C)) {
-//Bypass partition bounds-checking
- BlkDevLock(bd);
- ATAWriteBlks(bd,mbr,0,1);
- BlkDevUnlock(bd);
- }
- Free(mbr);
-}
-
-public U0 BootMHDZero(U8 dst_drv)
-{//Set MBR of disk with dst partition to zero.
-
- //This is dangerous!!
- //The TempleOS partitioner doesn't play well
- //with other operating systems at this time and you need
- //to do this on a drive partitioned by TempleOS
- //if you wish to partition with another operating system.
- CBlkDev *bd=Let2BlkDev(dst_drv);
- CMasterBoot mbr;
- MemSet(&mbr,0,BLK_SIZE);
-//Bypass partition bounds-checking
- BlkDevLock(bd);
- ATAWriteBlks(bd,&mbr,0,1);
- BlkDevUnlock(bd);
-}
-
-public Bool BootMHDIns(U8 drv_let,U8 *drv_lst=NULL)
-{//Create new MBR on the disk that has drv_let as a partition.
-//Puts stage 2 in BOOT_DIR of drv_let.
- CBlkDev *bd,*bd1;
- CDrv *dv,*p1;
- CMasterBoot mbr;
- CDirEntry de;
- I64 i,j,size,*_q;
- U8 *menu_ptr,*ptr,ch,buf[STR_LEN];
- Bool res=FALSE;
-
- try {
- if (drv_lst) {
- StrCpy(buf,drv_lst);
- StrUtil(buf,SUF_TO_UPPER);
- } else {
- j=0;
- for (i='A';i<='Z';i++)
- buf[j++]=i;
- buf[j++]=0;
- }
- Drv(drv_let);
- dv=Fs->cur_dv;
- if (dv->fs_type!=FSt_REDSEA && dv->fs_type!=FSt_FAT32)
- PrintErr("File System Not Supported\n");
- else {
- bd=dv->bd;
- if (!FileFind(BOOT_DIR_OLDMBR_BIN_C,,FUF_JUST_FILES))
- BootMHDOldRead(drv_let,drv_let);
-
- _q=BMHD2_BLK_ARRAY;
- MemSet(_q,0,sizeof(I64)*8);
- menu_ptr=BMHD2_BOOT_MSG;
- StrPrint(menu_ptr,"\n\r\n\rTempleOS Boot Loader\n\r\n\r");
- j=0;
- if (FileFind(BOOT_DIR_OLDMBR_BIN_C,&de,FUF_JUST_FILES)) {
- Free(de.full_name);
- *_q++=Clus2Blk(dv,de.clus);
- CatPrint(menu_ptr,"0. Old Boot Record\n\r");
- j++;
- }
-
- ptr=buf;
- while (ch=*ptr++) {
- if ((p1=Let2Drv(ch,FALSE)) && (bd1=p1->bd) && bd1==bd) {
- *_q=p1->drv_offset;
- "Drive %C:%16X\n",Drv2Let(p1),*_q;
- CatPrint(menu_ptr,"%d. Drive %C\n\r",j++,Drv2Let(p1));
- _q++;
- }
- }
- CatPrint(menu_ptr,"\n\rSelection:");
-
- size=BMHD2_END-BMHD2_START;
- FileWrite(BOOT_DIR_BOOTMHD2_BIN_C,BMHD2_START,size);
-
- if (!FileFind(BOOT_DIR_BOOTMHD2_BIN_C,&de,FUF_JUST_FILES))
- "No Boot Loader Image\n";
- else {
- Free(de.full_name);
- *BMHD_BLK_CNT(U16 *)=(size+BLK_SIZE-1)>>BLK_SIZE_BITS;
- *BMHD_DAP_BLK(I64 *)=Clus2Blk(dv,de.clus);
-//Bypass partition bounds-checking
- BlkDevLock(bd);
- ATAReadBlks(bd,&mbr,0,1);
- for (i=0;i<BMHD_END-BMHD_CODE;i++)
- mbr.code[i]=BMHD_CODE(U8 *)[i];
-#assert sizeof(CMasterBoot.code)>=BMHD_END-BMHD_CODE
- for (;i<sizeof(CMasterBoot.code);i++)
- mbr.code[i]=0;
- if (!mbr.media_id)
- mbr.media_id=RandU32;
- mbr.zero=0;
- mbr.signature=0xAA55;
-
- ATAWriteBlks(bd,&mbr,0,1);
- BlkDevUnlock(bd);
- res=TRUE;
- }
- }
- } catch
- PutExcept;
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Opt/Boot/BootRAM.HC.HTML b/public/src/Adam/Opt/Boot/BootRAM.HC.HTML deleted file mode 100644 index 65fa403..0000000 --- a/public/src/Adam/Opt/Boot/BootRAM.HC.HTML +++ /dev/null @@ -1,72 +0,0 @@ - - - - - BootRAM.HC - - - - - #help_index "Call"
-asm {
-_HI_CALL::
- PUSH RBP
- MOV RBP,RSP
- MOV RAX,U64 16[RBP]
- TEST RAX,RAX
- JZ @@05
- CALL RAX
-@@05: POP RBP
- RET1 8
-//************************************
-_HI_MEMCPY::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
- CLD
- MOV RDI,U64 SF_ARG1[RBP]
- MOV RSI,U64 SF_ARG2[RBP]
- MOV RCX,U64 SF_ARG3[RBP]
- REP_MOVSB
- MOV RAX,RDI
- POP RDI
- POP RSI
- POP RBP
- RET1 24
-}
-_extern _HI_CALL I64 HiCall(U8 *machine_code);
-_extern _HI_MEMCPY U8 *HiMemCpy(U8 *dst,U8 *src,I64 cnt);
-
-#help_index "Boot"
-public U0 BootRAM(U8 *filename=NULL)
-{//Softboot Kernel.BIN file. No hardware reset.
- I64 size;
- CKernel *hi_image,*lo_image=mem_boot_base-sizeof(CBinFile),
- reg *sys_ram_reboot;
- if (!filename)
- filename="::/" KERNEL_BIN_C;
- do if (!(hi_image=FileRead(filename,&size))) return;
- while (hi_image<0x100000); //If alloc from low 640K, just get another copy.
-
- do sys_ram_reboot=MAlloc(SYS_RAM_REBOOT_END-SYS_RAM_REBOOT,Fs->code_heap);
- while (sys_ram_reboot<0x100000);
-
- hi_image->boot_src=BOOT_SRC_RAM;
- hi_image->boot_blk=0;
- hi_image->boot_patch_table_base=lo_image(U8 *)+hi_image->h.patch_table_offset;
- hi_image->sys_run_level =lo_image->sys_run_level&(RLF_VGA|RLF_16BIT);
- MemCpy(&hi_image->start,&lo_image->start,
- sizeof(CKernel)-offset(CKernel.start));
-
- CLI
- if (mp_cnt>1)
- MPHalt;
-
- HiMemCpy(sys_ram_reboot,SYS_RAM_REBOOT,SYS_RAM_REBOOT_END-SYS_RAM_REBOOT);
- HiMemCpy(lo_image,hi_image,size);
- HiCall(sys_ram_reboot);
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Opt/Boot/DskISORedSea.HC.HTML b/public/src/Adam/Opt/Boot/DskISORedSea.HC.HTML deleted file mode 100644 index adfc18c..0000000 --- a/public/src/Adam/Opt/Boot/DskISORedSea.HC.HTML +++ /dev/null @@ -1,200 +0,0 @@ - - - - - DskISORedSea.HC - - - - - #help_index "File/CD DVD"
-
-U0 FillU16Palindrome(CPalindromeU16 *dst,U16 w)
-{
- dst->big=EndianU16(w);
- dst->little=w;
-}
-
-U0 FillU32Palindrome(CPalindromeU32 *dst,I64 d)
-{
- dst->big=EndianU32(d);
- dst->little=d;
-}
-
-class CElTorito
-{
- U16 w[16];
- U8 bootable; //88=bootable 00=not bootable
- U8 media_type; //0=no emulation 4=hard disk
- U16 load_seg; //0000->07C0
- U8 sys_type;
- U8 zero;
- U16 sect_cnt;
- U32 load_rba; //start addr of virtual disk
- U8 zero2[20];
-};
-
-U0 RedSeaISO9660Stage1(U8 *iso_filename,U8 *stage2_filename)
-{
- CDirEntry de;
- CFile *out_file=NULL;
- U8 *stage1_buf=CAlloc(DVD_BOOT_LOADER_SIZE);
- if (FileFind(stage2_filename,&de) && (out_file=FOpen(iso_filename,"wc+"))) {
- MemCpy(stage1_buf,BDVD_START,BDVD_END-BDVD_START);
- *(BDVD_BLK_LO -BDVD_START+stage1_buf)(U32 *)=de.clus>>2;
- *(BDVD_BLK_CNT -BDVD_START+stage1_buf)(U16 *)=
- (de.size+DVD_BLK_SIZE-1)>>(BLK_SIZE_BITS+2);
- *(BDVD_SHIFT_BLKS -BDVD_START+stage1_buf)(U16 *)=de.clus&3;
- if (de.clus&3)
- *(BDVD_BLK_CNT -BDVD_START+stage1_buf)(U16 *)+=1;
- FBlkWrite(out_file,stage1_buf,
- 20<<2+1<<2,DVD_BOOT_LOADER_SIZE/BLK_SIZE);
- FClose(out_file);
- }
- Free(stage1_buf);
-}
-
-U0 RedSeaISO9660(U8 *iso_filename,U8 drv_let)
-{
- CDrv *dv=Let2Drv(drv_let);
- CISOPriDesc *iso_pri=CAlloc(DVD_BLK_SIZE),
- *iso_boot=CAlloc(DVD_BLK_SIZE),
- *iso_sup=CAlloc(DVD_BLK_SIZE),
- *iso_term=CAlloc(DVD_BLK_SIZE);
- I64 iso_size=0,i,j;
- U32 *d;
- CElTorito *et=CAlloc(DVD_BLK_SIZE);
- U8 *zero_buf=CAlloc(DVD_BLK_SIZE);
- CFile *out_file=NULL;
-
- if (out_file=FOpen(iso_filename,"wc+")) {
- iso_size=FSize(out_file)/DVD_BLK_SIZE;
- for (i=0;i<dv->bd->drv_offset;i+=4)
- FBlkWrite(out_file,zero_buf,i,4);
-
- iso_pri->type=ISOT_PRI_VOL_DESC;
- StrCpy(iso_pri->id,"CD001");
- iso_pri->version=1;
- FillU16Palindrome(&iso_pri->vol_set_size,1);
- FillU16Palindrome(&iso_pri->vol_seq_num,1);
- FillU16Palindrome(&iso_pri->log_block_size,DVD_BLK_SIZE);
- FillU32Palindrome(&iso_pri->vol_space_size,iso_size);
- FillU32Palindrome(&iso_pri->root_dir_record,dv->root_clus);
- iso_pri->file_structure_version=1;
- StrCpy(iso_pri->publisher_id,"TempleOS RedSea");
-
- MemCpy(iso_sup,iso_pri,DVD_BLK_SIZE);
- iso_sup->type=ISOT_SUPPLEMENTARY_DESC;
-
- iso_boot->type=ISOT_BOOT_RECORD;
- StrCpy(iso_boot->id,"CD001");
- iso_boot->version=1;
- StrCpy(iso_boot(U8 *)+7,"EL TORITO SPECIFICATION");
-
- FBlkWrite(out_file,iso_pri,16<<2,4);
- iso_term->type=ISOT_TERMINATOR;
- StrCpy(iso_term->id,"CD001");
- iso_term->version=1;
-
- d=iso_boot(U8 *)+0x47;
- *d=20<<2>>2;
- FBlkWrite(out_file,iso_boot,17<<2,4);
-
- FBlkWrite(out_file,iso_sup,18<<2,4);
- FBlkWrite(out_file,iso_term,19<<2,4);
-
- et->w[0]=1;
- StrCpy(&et->w[2],"TempleOS");
- et->w[15]=0xAA55;
- j=0;
- for (i=0;i<16;i++) //Checksum
- j+=et->w[i];
- et->w[14]=-j;
- et->bootable=0x88;
- et->media_type=0;//0=no emu 2=1.44meg 4=hard drive
- et->sect_cnt=4; //5 seems like the limit, 4 is safer
- et->load_rba=20<<2>>2+1;
- FBlkWrite(out_file,et,20<<2,4);
- FClose(out_file);
- }
- Free(zero_buf);
- Free(et);
- Free(iso_pri);
- Free(iso_boot);
- Free(iso_sup);
- Free(iso_term);
-}
-
-I64 RedSeaISOPass1(CDirEntry *tmpde)
-{
- I64 dir_entry_cnt=3+LinkedLstCnt(tmpde),res=0;
- while (tmpde) {
- if (tmpde->attr & RS_ATTR_DIR) {
- if (tmpde->sub)
- res+=RedSeaISOPass1(tmpde->sub);
- else
- res+=BLK_SIZE; //Empty dir
- } else
- res+=CeilU64(tmpde->size,BLK_SIZE);
- tmpde=tmpde->next;
- }
- res+=CeilU64(dir_entry_cnt<<6,BLK_SIZE); //Size in bytes
-#assert CDIR_SIZE==64
- return res;
-}
-public I64 RedSeaISO(U8 *_iso_filename=NULL,U8 *_src_dir,
- U8 *_stage2_filename=NULL)
-{//See /Misc/DoDistro.HC. Must be ISO.C
- I64 i,res,root_cnt,root_dir_blks,bitmap_blks,bitmap_blks1;
- CDirEntry *tmpde;
- U8 buf[STR_LEN],*iso_filename,*src_dir,*stage2_filename;
- CDrv *dv=DrvMakeFreeSlot(DrvNextFreeLet('Q')); //First BDT_ISO_FILE_WRITE
- CBlkDev *bd=BlkDevNextFreeSlot(dv->drv_let,BDT_ISO_FILE_WRITE);
-
- if (!IsDir(_src_dir))
- PrintErr("'%s' is not a dir.\n",_src_dir);
- else {
- if (!_iso_filename)
- _iso_filename=blkdev.dft_iso_c_filename;
- iso_filename=ExtChg(_iso_filename,"ISO.C");
- src_dir=DirNameAbs(_src_dir);
- if (_stage2_filename) {
- stage2_filename=FileNameAbs(_stage2_filename);
- *stage2_filename=dv->drv_let;
- i=StrLen(src_dir);
- if (i!=3) //If not root
- i++; //Skip slash
- StrCpy(stage2_filename+3,stage2_filename+i);
- } else
- stage2_filename=NULL;
- tmpde=FilesFind(src_dir,FUF_RECURSE);
- root_cnt=LinkedLstCnt(tmpde)+3;
- root_dir_blks=CeilU64(root_cnt<<6,BLK_SIZE)>>BLK_SIZE_BITS;
- if (res=RedSeaISOPass1(tmpde)>>BLK_SIZE_BITS) {
- bd->drv_offset=19<<2+(DVD_BLK_SIZE*2+DVD_BOOT_LOADER_SIZE)/BLK_SIZE;
- bitmap_blks=1;
- do {
- bitmap_blks1=bitmap_blks;
- bitmap_blks=(res+bitmap_blks+BLK_SIZE<<3-1)/BLK_SIZE<<3;
- } while (bitmap_blks!=bitmap_blks1);
-
- bd->max_blk=CeilI64(bd->drv_offset+1+bitmap_blks+res,4);
- bd->max_blk--; //Inclusive.
- bd->file_dsk_name=AStrNew(iso_filename);
- bd->init_root_dir_blks=root_dir_blks;
- BlkDevAdd(bd,,TRUE,TRUE);
- StrPrint(buf,"%C:/",dv->drv_let);
- CopyTree(src_dir,buf,TRUE);
- RedSeaISO9660Stage1(iso_filename,stage2_filename);
- DrvDel(dv);
- BlkDevDel(bd);
- }
- Free(stage2_filename);
- Free(src_dir);
- Free(iso_filename);
- }
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Opt/Boot/MakeBoot.HC.HTML b/public/src/Adam/Opt/Boot/MakeBoot.HC.HTML deleted file mode 100644 index 67e9c72..0000000 --- a/public/src/Adam/Opt/Boot/MakeBoot.HC.HTML +++ /dev/null @@ -1,18 +0,0 @@ - - - - - MakeBoot.HC - - - - - Cd(__DIR__);;
-#include "BootDVDIns"
-#include "BootHDIns"
-#include "BootMHDIns"
-#include "BootRAM"
-Cd("..");;
- - - \ No newline at end of file diff --git a/public/src/Adam/Opt/Utils/Diff.HC.HTML b/public/src/Adam/Opt/Utils/Diff.HC.HTML deleted file mode 100644 index 50b1fb9..0000000 --- a/public/src/Adam/Opt/Utils/Diff.HC.HTML +++ /dev/null @@ -1,365 +0,0 @@ - - - - - Diff.HC - - - - - #help_index "Cmd Line (Typically)"
-
-#define DS_USE_FILE1 0
-#define DS_USE_FILE2 1
-#define DS_REMAINDER_1 2
-#define DS_REMAINDER_2 3
-#define DS_ABORT_FILE 4
-
-I64 PopUpDiffMenu()
-{
- I64 i;
- CDoc *doc=DocNew;
- DocPrint(doc,"$CM+LX,2,4$$FG$$BT,\"USE FILE1\",LE=DS_USE_FILE1$"
- "$CM+LX,24,0$$CYAN$$BT,\"USE FILE2\",LE=DS_USE_FILE2$"
- "$CM+LX,2,4$$FG$$BT,\"REMAINDER ALL FILE1\",LE=DS_REMAINDER_1$"
- "$CM+LX,24,0$$CYAN$$BT,\"REMAINDER ALL FILE2\",LE=DS_REMAINDER_2$"
- "$CM+LX,2,4$$FG$$BT,\"ABORT FILE\",LE=DS_ABORT_FILE$"
- "$CM+LX,24,0$$FG$$BT,\"ABORT ALL FILES\",LE=DOCM_CANCEL$\n");
- i=PopUpMenu(doc);
- DocDel(doc);
- return i;
-}
-
-I64 DiffEntriesCompare(CDocEntry *doc_e1,CDocEntry *doc_e2)
-{
- return StrCmp(doc_e1->tag,doc_e2->tag);
-}
-
-#define DF_MODIFIED 0x01
-#define DF_DONT_MODIFIED 0x02
-#define DF_REMAINDER_ALL_FILE1 0x04
-#define DF_REMAINDER_ALL_FILE2 0x08
-#define DF_ABORT_FILE 0x10
-#define DF_ABORT_ALL_FILES 0x20
-#define DF_NO_MORE_PMTS_THIS_FILE 0x40
-
-U0 DiffSel(CDoc *doc,I64 *_df_flags,I64 j1_lo,I64 j1_hi,
- I64 j2_lo,I64 j2_hi,I64 cnt1,I64 cnt2,
- CDocEntry **doc_unsorted1,CDocEntry **doc_unsorted2)
-{
- CDocEntry *doc_e,*doc_e1,*doc_e2;
- Bool use_file1;
- I64 i,old_flags;
- CDoc *cur_l;
- if (!(*_df_flags & (DF_ABORT_FILE|DF_ABORT_ALL_FILES))) {
- "$RED$";
- if (0<=j1_lo<cnt1)
- "%d,",doc_unsorted1[j1_lo]->y+1;
- else if (0<=j1_hi-1<cnt1)
- "%d,",doc_unsorted1[j1_hi-1]->y+1;
- else
- "***,";
- if (0<=j2_lo<cnt2)
- "%d",doc_unsorted2[j2_lo]->y+1;
- else if (0<=j2_hi-1<cnt2)
- "%d",doc_unsorted2[j2_hi-1]->y+1;
- else
- "***";
- "---------------------$FG$\n";
- if (j1_lo<=0)
- i=0;
- else
- i=j1_lo-1;
- while (i<j1_hi) {
- if (cur_l=DocPut) {
- old_flags=cur_l->flags&DOCF_PLAIN_TEXT;
- cur_l->flags|=DOCF_PLAIN_TEXT;
- }
- "%s",doc_unsorted1[i++]->tag;
- if (cur_l)
- cur_l->flags= cur_l->flags&~DOCF_PLAIN_TEXT |old_flags;
- '\n';
- }
- "$CYAN$";
- if (j2_lo<=0)
- i=0;
- else
- i=j2_lo-1;
- while (i<j2_hi) {
- if (cur_l=DocPut) {
- old_flags=cur_l->flags&DOCF_PLAIN_TEXT;
- cur_l->flags|=DOCF_PLAIN_TEXT;
- }
- "%s",doc_unsorted2[i++]->tag;
- if (cur_l)
- cur_l->flags= cur_l->flags&~DOCF_PLAIN_TEXT |old_flags;
- '\n';
- }
- "$FG$";
-
- use_file1=TRUE;
- if (!(*_df_flags & DF_NO_MORE_PMTS_THIS_FILE)) {
- switch (PopUpDiffMenu) {
- case DS_USE_FILE1:
- break;
- case DS_USE_FILE2:
- use_file1=FALSE;
- break;
- case DS_REMAINDER_1:
- *_df_flags=*_df_flags&~DF_REMAINDER_ALL_FILE2|
- DF_REMAINDER_ALL_FILE1|DF_NO_MORE_PMTS_THIS_FILE;
- break;
- case DS_REMAINDER_2:
- *_df_flags=*_df_flags&~DF_REMAINDER_ALL_FILE1|
- DF_REMAINDER_ALL_FILE2|DF_NO_MORE_PMTS_THIS_FILE;
- break;
- case DS_ABORT_FILE:
- *_df_flags|=DF_DONT_MODIFIED|DF_ABORT_FILE|
- DF_NO_MORE_PMTS_THIS_FILE;
- break;
- default:
- *_df_flags|=DF_DONT_MODIFIED|DF_ABORT_ALL_FILES|
- DF_NO_MORE_PMTS_THIS_FILE;
- }
- }
- if (*_df_flags & DF_REMAINDER_ALL_FILE2 &&
- !(*_df_flags & (DF_DONT_MODIFIED|DF_REMAINDER_ALL_FILE1)))
- use_file1=FALSE;
- if (!use_file1) {
- *_df_flags|=DF_MODIFIED;
- doc_e1=doc_unsorted1[j1_lo]->last;
- if (j1_lo<j1_hi) {
- doc_e=doc_unsorted1[j1_lo];
- while (doc_e!=doc_unsorted1[j1_hi]) {
- doc_e2=doc_e->next;
- DocEntryDel(doc,doc_e);
- doc_e=doc_e2;
- }
- }
- if (j2_lo<j2_hi) {
- doc_e=doc_unsorted2[j2_lo];
- while (doc_e!=doc_unsorted2[j2_hi]) {
- doc_e2=DocEntryCopy(doc,doc_e);
- QueIns(doc_e2,doc_e1);
- doc_e1=doc_e2;
- doc_e=doc_e->next;
- }
- }
- }
- }
-}
-
-Bool DiffSub(CDoc *doc,I64 *_df_flags,I64 j1_lo,I64 j1_hi,I64 j2_lo,I64 j2_hi,
- I64 cnt1,I64 cnt2,CDocEntry **doc_sorted1,CDocEntry **doc_sorted2,
- CDocEntry **doc_unsorted1,CDocEntry **doc_unsorted2)
-{
- I64 i,i1=0,i2=0,i2b,j1,j2,n,
- best_j1,best_j2,best_score=0,score;
- Bool res=FALSE;
-
- if (j1_lo>=j1_hi || j2_lo>=j2_hi) {
- if (j1_lo<j1_hi || j2_lo<j2_hi) {
- DiffSel(doc,_df_flags,j1_lo,j1_hi,j2_lo,j2_hi,cnt1,cnt2,
- doc_unsorted1,doc_unsorted2);
- return TRUE;
- } else
- return FALSE;
- }
-
- //Locate longest matching str in intervals
- while (i1<cnt1 && i2<cnt2) {
- if (!(j1_lo<=doc_sorted1[i1]->user_data<j1_hi)) //user_data is the new y
- i1++;
- else if (!(j2_lo<=doc_sorted2[i2]->user_data<j2_hi)) //user_data is new y
- i2++;
- else {
- i=StrCmp(doc_sorted1[i1]->tag,doc_sorted2[i2]->tag);
- if (i>0)
- i2++;
- else if (i<0)
- i1++;
- else {
- i2b=i2;
- while (!StrCmp(doc_sorted1[i1]->tag,doc_sorted2[i2]->tag)) {
- if (j2_lo<=doc_sorted2[i2]->user_data<j2_hi) {//user_data is the new y
- score=0;
- j1=doc_sorted1[i1]->user_data; //user_data is the new y
- j2=doc_sorted2[i2]->user_data; //user_data is the new y
- n=j1_hi-j1;
- if (j2_hi-j2<n)
- n=j2_hi-j2;
- while (score<n) {
- if (!StrCmp(doc_unsorted1[j1+score]->tag,
- doc_unsorted2[j2+score]->tag))
- score++;
- else
- break;
- }
- if (score>best_score) {
- best_score=score;
- best_j1=j1;
- best_j2=j2;
- }
- }
- i2++;
- if (i2>=cnt2)
- break;
- }
- i2=i2b;
- i1++;
- }
- }
- }
- if (!best_score) {
- DiffSel(doc,_df_flags,j1_lo,j1_hi,j2_lo,j2_hi,cnt1,cnt2,
- doc_unsorted1,doc_unsorted2);
- return TRUE;
- } else {
- if (DiffSub(doc,_df_flags,j1_lo,best_j1,j2_lo,best_j2,cnt1,cnt2,
- doc_sorted1,doc_sorted2,doc_unsorted1,doc_unsorted2))
- res=TRUE;
- if (DiffSub(doc,_df_flags,best_j1+best_score,j1_hi,best_j2+best_score,
- j2_hi,cnt1,cnt2,
- doc_sorted1,doc_sorted2,doc_unsorted1,doc_unsorted2))
- res=TRUE;
- return res;
- }
-}
-
-Bool DiffBins(CDoc *doc1,CDoc *doc2)
-{
- CDocBin *tmpb1=doc1->bin_head.next,
- *tmpb2=doc2->bin_head.next;
-
- if (tmpb1->last->last->num!=tmpb2->last->last->num)
- return TRUE;
- while (tmpb1!=&doc1->bin_head) {
- if (tmpb1->size!=tmpb2->size ||
- MemCmp(tmpb1->data,tmpb2->data,tmpb1->size))
- return TRUE;
- tmpb1=tmpb1->next;
- tmpb2=tmpb2->next;
- }
- return FALSE;
-}
-
-public Bool Diff(U8 *dst_file,U8 *src_file,I64 *_df_flags=NULL)
-{//Report differences between two files and merge differences
-//from src_file to dst_file. Don't use _df_flags arg. (Used by Merge().)
- CDoc *doc1=DocRead(dst_file,DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR),
- *doc2=DocRead(src_file,DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR);
- CDocEntry *doc_e,**doc_sorted1,**doc_sorted2,**doc_unsorted1,**doc_unsorted2;
- I64 i,cnt1=0,cnt2=0,df_flags;
- Bool res=FALSE;
-
- if (_df_flags)
- df_flags=*_df_flags;
- else
- df_flags=0;
- df_flags&=DF_ABORT_ALL_FILES;
-
- doc_e=doc1->head.next;
- while (doc_e!=doc1) {
- if (doc_e->type_u8==DOCT_TEXT)
- doc_e->user_data=cnt1++; //user_data is the new y
- doc_e=doc_e->next;
- }
-
- doc_e=doc2->head.next;
- while (doc_e!=doc2) {
- if (doc_e->type_u8==DOCT_TEXT)
- doc_e->user_data=cnt2++; //user_data is the new y
- doc_e=doc_e->next;
- }
-
- doc_sorted1=MAlloc(cnt1*sizeof(CDocEntry *));
- doc_unsorted1=MAlloc((cnt1+1)*sizeof(CDocEntry *));
- i=0;
- doc_e=doc1->head.next;
- while (doc_e!=doc1) {
- if (doc_e->type_u8==DOCT_TEXT) {
- doc_sorted1[i]=doc_e;
- doc_unsorted1[i++]=doc_e;
- }
- doc_e=doc_e->next;
- }
- doc_unsorted1[i]=doc1;
- QSortI64(doc_sorted1,cnt1,&DiffEntriesCompare);
-
- doc_sorted2=MAlloc(cnt2*sizeof(CDocEntry *));
- doc_unsorted2=MAlloc((cnt2+1)*sizeof(CDocEntry *));
- i=0;
- doc_e=doc2->head.next;
- while (doc_e!=doc2) {
- if (doc_e->type_u8==DOCT_TEXT) {
- doc_sorted2[i]=doc_e;
- doc_unsorted2[i++]=doc_e;
- }
- doc_e=doc_e->next;
- }
- doc_unsorted2[i]=doc2;
- QSortI64(doc_sorted2,cnt2,&DiffEntriesCompare);
-
- res=DiffSub(doc1,&df_flags,0,cnt1,0,cnt2,cnt1,cnt2,
- doc_sorted1,doc_sorted2,doc_unsorted1,doc_unsorted2);
- if (df_flags&DF_MODIFIED && !(df_flags&DF_DONT_MODIFIED))
- DocWrite(doc1);
-
- if (DiffBins(doc1,doc2)) {
- "$RED$Bin Data is Different$FG$\n";
- res=TRUE;
- }
-
- DocDel(doc1);
- DocDel(doc2);
- Free(doc_sorted1);
- Free(doc_sorted2);
- Free(doc_unsorted1);
- Free(doc_unsorted2);
- if (_df_flags)
- *_df_flags=df_flags;
- return res;
-}
-
-#help_index "Cmd Line (Typically);Info"
-I64 ZRepCompare(CDirEntry *e1,CDirEntry *e2)
-{
- return SignI64(e2->user_data(F64)-e1->user_data(F64));
-}
-public U0 ZipRep(U8 *files_find_mask="/*",U8 *fu_flags=NULL,
- Bool just_text_not_graphics=TRUE)
-{//Report file compressibility.
-//Dft is just src files. (Used to spot
- //src files with redundancy in them.)
- I64 i=0,cnt,size,fuf_flags=0;
- CDirEntry *tmpde,*tmpde1,**sort_buf;
- U8 *buf;
- CArcCompress *arc;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+F+S");
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
- tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
- cnt=FileCnt(tmpde);
- sort_buf=MAlloc(sizeof(CDirEntry *)*cnt);
- while (tmpde) {
- sort_buf[i++]=tmpde;
- buf=FileRead(tmpde->full_name,&size);
- if (just_text_not_graphics)
- size=StrLen(buf);
- arc=CompressBuf(buf,size);
- Free(buf);
- tmpde->user_data(F64)=100.0*arc->compressed_size/arc->expanded_size;
- Free(arc);
- tmpde=tmpde->next;
- }
- QSortI64(sort_buf,cnt,&ZRepCompare);
- for (i=0;i<cnt;i++) {
- "%4.1f%% %04X ",sort_buf[i]->user_data,sort_buf[i]->size;
- PutFileLink(sort_buf[i]->full_name);
- '\n';
- }
- Free(sort_buf);
- DirTreeDel(tmpde1);
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Opt/Utils/DocUtils.HC.HTML b/public/src/Adam/Opt/Utils/DocUtils.HC.HTML deleted file mode 100644 index 89819f8..0000000 --- a/public/src/Adam/Opt/Utils/DocUtils.HC.HTML +++ /dev/null @@ -1,168 +0,0 @@ - - - - - DocUtils.HC - - - - - #help_index "DolDoc/Cmd Line (Typically)"
-
-U0 CursorRemFile(U8 *filename)
-{//Rem ASCII 5 cursor from one file.
- CDoc *doc=DocRead(filename,DOCF_PLAIN_TEXT|DOCF_NO_CURSOR);
- DocWrite(doc);
- DocDel(doc);
-}
-public U0 CursorRem(U8 *files_find_mask="*")
-{//Rem ASCII 5 cursor.
- I64 fuf_flags=0;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+T+f+F+O");
- CDirEntry *tmpde=FilesFind(files_find_mask,fuf_flags),*tmpde1=tmpde;
- while (tmpde) {
- CursorRemFile(tmpde->full_name);
- Touch(tmpde->full_name,"",,tmpde->datetime);
- tmpde=tmpde->next;
- }
- DirTreeDel(tmpde1);
-}
-
-U0 CollapseFile(U8 *filename,Bool collapse=TRUE)
-{//Collapse DolDoc trees in one file.
- CDoc *doc=DocRead(filename,DOCF_NO_CURSOR);
- DocCollapse(collapse,doc);
- DocWrite(doc);
- DocDel(doc);
-}
-public U0 Collapse(U8 *files_find_mask="*",
- Bool collapse=TRUE,U8 *fu_flags=NULL)
-{//Collapse DolDoc trees.
- I64 fuf_flags=0;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F+$+O");
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
- CDirEntry *tmpde=FilesFind(files_find_mask,fuf_flags),*tmpde1=tmpde;
- while (tmpde && !Bt(&fuf_flags,FUf_CANCEL)) {
- CollapseFile(tmpde->full_name,collapse);
- Touch(tmpde->full_name,"",,tmpde->datetime);
- tmpde=tmpde->next;
- }
- DirTreeDel(tmpde1);
-}
-
-I64 DocOptEntry(CDoc *,CDocEntry *doc_e,I64 fuf_flags)
-{
- U8 *st,*st2,**_dst;
- I64 i,res=0;
-
- if (doc_e->de_flags&DOCEF_LINK && doc_e->de_flags&(DOCEF_AUX_STR|DOCEF_TAG)) {
- if (doc_e->de_flags & DOCEF_AUX_STR && doc_e->de_flags & DOCEF_TAG &&
- !MemCmp(doc_e->aux_str,"FI:",3) &&
- !StrCmp(doc_e->aux_str+3,doc_e->tag)) {
- Free(doc_e->aux_str);
- doc_e->aux_str=NULL;
- doc_e->de_flags&=~DOCEF_AUX_STR;
- res++;
- }
- if (doc_e->de_flags & DOCEF_AUX_STR)
- _dst=&doc_e->aux_str;
- else
- _dst=&doc_e->tag;
- if (StrMatch(".Z",*_dst)) {
- st=DocLinkFile(*_dst);
- if (FileFind(st)) {
- if (IsDotZ(st))
- st[StrLen(st)-2]=0;
- i=StrLen(st);
- if ((st2=StrMatch(st,*_dst)) && st2[i]=='.' && st2[i+1]=='Z') {
- StrCpy(st2+i,st2+i+2);
- res++;
- }
- }
- Free(st);
- }
- if (fuf_flags&FUF_RISKY) {
- if (doc_e->de_flags & DOCEF_AUX_STR) {
- if (st=StrMatch(".Z",doc_e->aux_str)) {
- StrCpy(st,st+2);
- res++;
- }
- }
- if (doc_e->de_flags&DOCEF_TAG) {
- if (st=StrMatch(".Z",doc_e->tag)) {
- StrCpy(st,st+2);
- res++;
- }
- }
- }
- }
- return res;
-}
-I64 DocOptDoc(CDoc *doc,I64 fuf_flags)
-{//Optimize Doc.
- Bool unlock=DocLock(doc);
- I64 res=0;
- CDocEntry *doc_e,*doc_e1,*doc_e_last;
- DocRecalc(doc);
- doc_e_last=NULL;
- doc_e=doc->head.next;
- while (doc_e!=doc) {
- doc_e1=doc_e->next;
- if (res+=DocOptEntry(doc,doc_e,fuf_flags))
- res+=DocOptEntry(doc,doc_e,fuf_flags);
- if (doc_e_last && doc_e_last->type&~0xFF00==doc_e->type&~0xFF00 &&
- doc_e_last->de_flags==doc_e->de_flags &&
- Bt(doldoc.type_flags_chk_dup,doc_e->type_u8) &&
- doc_e_last->attr==doc_e->attr) {
- DocEntryDel(doc,doc_e);
- res++;
- } else
- doc_e_last=doc_e;
- doc_e=doc_e1;
- }
- DocRecalc(doc);
- if (unlock)
- DocUnlock(doc);
- return res;
-}
-I64 DocOptFile(U8 *filename,I64 fuf_flags)
-{//Optimize file.
- I64 res;
- CDoc *doc=DocRead(filename);
- if (res=DocOptDoc(doc,fuf_flags)) {
- "-%d:%s\n",res,doc->filename.name;
- DocWrite(doc);
- }
- DocDel(doc);
- return res;
-}
-I64 DocOptLst(CDirEntry *tmpde,I64 fuf_flags)
-{
- I64 res=0;
- CDirEntry *tmpde1;
- while (tmpde) {
- tmpde1=tmpde->next;
- if (tmpde->attr & RS_ATTR_DIR) {
- if (tmpde->sub) {
- "Scanning Directory: %s\n",tmpde->full_name;
- res+=DocOptLst(tmpde->sub,fuf_flags);
- }
- } else
- res+=DocOptFile(tmpde->full_name,fuf_flags);
- DirEntryDel(tmpde);
- tmpde=tmpde1;
- }
- return res;
-}
-public I64 DocOpt(U8 *files_find_mask="*",U8 *fu_flags=NULL)
-{//Optimize DolDoc files, eliminating aux_str's and .Z's.
-//+R flag for aggressively risky.
- I64 fuf_flags=0;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+$");
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
- return DocOptLst(FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND),
- fuf_flags&~FUG_FILES_FIND);
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Opt/Utils/Find.HC.HTML b/public/src/Adam/Opt/Utils/Find.HC.HTML deleted file mode 100644 index bbfc2c4..0000000 --- a/public/src/Adam/Opt/Utils/Find.HC.HTML +++ /dev/null @@ -1,269 +0,0 @@ - - - - - Find.HC - - - - - #help_index "Cmd Line (Typically)"
-
-#define FND_REPLACE 0
-#define FND_SKIP 1
-#define FND_ALL 2
-#define FND_ED 3
-#define FND_ABORT_FILE 4
-#define FND_SKIP_FILE 5
-
-I64 PopUpFindMenu()
-{
- I64 i;
- CDoc *doc=DocNew;
- DocPrint(doc,"$CM+LX,2,4$$BT,\"REPLACE\",LE=FND_REPLACE$"
- "$CM+LX,22,0$$BT,\"SKIP\",LE=FND_SKIP$"
- "$CM+LX,2,4$$BT,\"ALL\",LE=FND_ALL$"
- "$CM+LX,22,0$$BT,\"ABORT ALL\",LE=DOCM_CANCEL$"
- "$CM+LX,2,4$$BT,\"EDIT\",LE=FND_ED$"
- "$CM+LX,22,0$$BT,\"ABORT FILE\",LE=FND_ABORT_FILE$"
- "$CM+LX,2,4$$BT,\"SKIP FILE\",LE=FND_SKIP_FILE$\n");
- i=PopUpMenu(doc);
- DocDel(doc);
- return i;
-}
-
-I64 FindFile(U8 *needle_str,U8 *haystack_filename,
- I64 *_fuf_flags,U8 *replace_text)
-{//Have you confused with FileFind()?
- Bool first_on_line,write_this_file=FALSE,cont=!Bt(_fuf_flags,FUf_CANCEL);
- U8 *src,*dst,*dst2,*name_buf=NULL;
- I64 i,j,plen,rlen,dlen,cnt=0,old_flags,ss_flags;
- CDoc *cur_l,*doc=DocRead(haystack_filename,
- DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR);
- CDocEntry *doc_e;
-
- if (Bt(_fuf_flags,FUf_IGNORE))
- ss_flags=SFF_IGNORE_CASE;
- else
- ss_flags=0;
- if (Bt(_fuf_flags,FUf_WHOLE_LABELS))
- ss_flags|=SFG_WHOLE_LABELS;
- if (Bt(_fuf_flags,FUf_WHOLE_LABELS_BEFORE))
- ss_flags|=SFF_WHOLE_LABELS_BEFORE;
- if (Bt(_fuf_flags,FUf_WHOLE_LABELS_AFTER))
- ss_flags|=SFF_WHOLE_LABELS_AFTER;
-
- plen=StrLen(needle_str);
- if (replace_text)
- rlen=StrLen(replace_text);
- doc_e=doc->head.next;
- while (doc_e!=doc && cont) {
- if (doc_e->type_u8==DOCT_TEXT) {
- src=doc_e->tag;
- first_on_line=TRUE;
- while (src && cont) {
- if (src=StrFind(needle_str,src,ss_flags)) {
- cnt++;
- if (first_on_line || Bt(_fuf_flags,FUf_REPLACE)) {
- first_on_line=FALSE;
- PutFileLink(haystack_filename,,doc_e->y+1,TRUE);
- name_buf=MStrPrint("%s,%d",haystack_filename,doc_e->y+1);
- if (cur_l=DocPut) {
- old_flags=cur_l->flags&DOCF_PLAIN_TEXT;
- cur_l->flags|=DOCF_PLAIN_TEXT;
- }
- " %s\n",doc_e->tag;
- if (cur_l)
- cur_l->flags= cur_l->flags&~DOCF_PLAIN_TEXT |old_flags;
- }
- if (Bt(_fuf_flags,FUf_REPLACE)) {
- if (Bt(_fuf_flags,FUf_ALL))
- i=FND_ALL;
- else {
- i=PopUpFindMenu;
- if (i<0) {
- LBts(_fuf_flags,FUf_CANCEL);
- cont=FALSE;
- write_this_file=FALSE;
- } else if (i==FND_ALL)
- LBts(_fuf_flags,FUf_ALL);
- else if (i==FND_ABORT_FILE) {
- cont=FALSE;
- write_this_file=FALSE;
- } else if (i==FND_SKIP_FILE)
- cont=FALSE;
- }
- if (i==FND_REPLACE || i==FND_ALL) {
- dlen=StrLen(doc_e->tag);
- dst=MAlloc(dlen+1+rlen-plen);
- dst2=dst;
- j=src-doc_e->tag;
- for (i=0;i<j;i++)
- *dst++=doc_e->tag[i];
- for (i=0;i<rlen;i++)
- *dst++=replace_text[i];
- src=dst;
- for (i=j+plen;i<=dlen;i++)
- *dst++=doc_e->tag[i];
- Free(doc_e->tag);
- doc_e->tag=dst2;
- if (cur_l=DocPut) {
- old_flags=cur_l->flags&DOCF_PLAIN_TEXT;
- cur_l->flags|=DOCF_PLAIN_TEXT;
- }
- "%12s,%04d*%s\n",haystack_filename,doc_e->y+1,dst2;
- if (cur_l)
- cur_l->flags= cur_l->flags&~DOCF_PLAIN_TEXT |old_flags;
- write_this_file=TRUE;
- } else {
- src++;
- if (i==FND_ED) {
- Free(name_buf);
- name_buf=StrNew(doc->filename.name);
- doc->flags&=~DOCF_NO_CURSOR;
- doc->cur_entry=doc_e;
- doc->cur_col=doc_e->min_col;
- DocWrite(doc);
- DocDel(doc);
- "Wrote:%s\n",name_buf;
- Ed(name_buf);
- doc=DocRead(name_buf, DOCF_PLAIN_TEXT_TABS);
- doc_e=doc->cur_entry;
- if (doc_e->last!=doc) doc_e=doc_e->last;
- src=NULL;
- write_this_file=FALSE;
- }
- }
- } else
- src++;
- Free(name_buf);
- name_buf=NULL;
- }
- }
- }
- doc_e=doc_e->next;
- }
- if (write_this_file) {
- DocWrite(doc);
- "Wrote:%s\n",doc->filename.name;
- }
- DocDel(doc);
- return cnt;
-}
-
-public I64 Find(U8 *needle_str,U8 *files_find_mask="*",
- U8 *fu_flags=NULL,U8 *replace_text=NULL)
-{/*Find occurrences of a string in files.
-This does not do regular expressions.
-Anyway, it's good for searching and replacing.
-Let's say it stands for global replace ;-)
-
-"+r" =recurse
-"+i" =ignore case
-"+l" =whole labels only.
-This will check for a nonlabel character before
-and after. If you have a var, "dd" and don't
-want to match words like "Add", you
-set this flag and it will see that the characters
-before or after "dd" are label characters.
-"+lb"=only checks for label chars before.
-"+la"=only checks for label chars after.
-*/
- I64 cnt=0,fuf_flags=0;
- CDirEntry *tmpde,*tmpde1;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+i+f+F+T");
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
- if (fuf_flags&~(FUG_FILES_FIND|FUF_IGNORE|FUF_ALL|
- FUF_WHOLE_LABELS|FUF_WHOLE_LABELS_BEFORE|FUF_WHOLE_LABELS_AFTER))
- throw('FUF');
- LBEqu(&fuf_flags,FUf_REPLACE,replace_text);
- tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND);
- fuf_flags&=FUF_ALL|FUF_REPLACE|FUF_IGNORE|FUF_WHOLE_LABELS|
- FUF_WHOLE_LABELS_BEFORE|FUF_WHOLE_LABELS_AFTER;
- while (tmpde && !Bt(&fuf_flags,FUf_CANCEL)) {
- cnt+=FindFile(needle_str,tmpde->full_name,&fuf_flags,replace_text);
- tmpde=tmpde->next;
- }
- DirTreeDel(tmpde1);
- return cnt;
-}
-
-public I64 FileOcc(U8 *needle_str,
- U8 *files_find_mask="*",U8 *fu_flags="+r+i+l")
-{/*Silently return occurrences of a string in files.
-"+r"=recurse
-"+i"=ignore case
-"+l"=whole labels only.
-"+lb"=only checks for label chars before.
-"+la"=only checks for label chars after.
-*/
- I64 cnt=0;
- Bool old_silent=Silent(TRUE);
- cnt=Find(needle_str,files_find_mask,fu_flags);
- Silent(old_silent);
- return cnt;
-}
-
-class CFind
-{
- U8 find_text[STR_LEN] format "$DA-P,"
- "A=\"FIND:%s\"$\n";
- U8 replace_text[STR_LEN] format "$DA-P,"
- "A=\"REPLACE:%s\"$\n";
- Bool replace format "$CB,\"REPLACE\"$\n";
- Bool match_case format "$CB,\"MATCH CASE\"$\n";
- Bool whole_labels format "$CB,\"WHOLE LABELS\"$\n";
- U8 filemask[STR_LEN] format "$DA-P,A=\"FILE MASK:%s\"$\n";
- Bool recurse format "$CB,\"RECURSE\"$\n";
-};
-
-I64 FindWiz()
-{
- CDoc *doc;
- U8 buf[32],*dir,*st;
- CFind *g=CAlloc(sizeof(CFind));
- I64 res=0;
- g->recurse=TRUE;
- StrCpy(g->filemask,FILEMASK_TXT);
- if (doc=DocPut) {
- StrCpy(g->find_text,doc->find_replace->find_text);
- StrCpy(g->replace_text,doc->find_replace->replace_text);
- g->replace=doc->find_replace->replace;
- g->match_case=doc->find_replace->match_case;
- g->whole_labels=doc->find_replace->whole_labels;
- }
- if (DocForm(g,,0,"$PURPLE$$TX+CX,\"Find\"$\n$FG$")) {
- if (doc) {
- StrCpy(doc->find_replace->find_text,g->find_text);
- StrCpy(doc->find_replace->replace_text,g->replace_text);
- doc->find_replace->replace=g->replace;
- doc->find_replace->match_case=g->match_case;
- doc->find_replace->whole_labels=g->whole_labels;
- }
- dir=PopUpPickDir;
- if (*dir) {
- *buf=0;
- if (g->match_case)
- CatPrint(buf,"-i");
- if (!g->recurse)
- CatPrint(buf,"-r");
- if (g->whole_labels)
- CatPrint(buf,"+l");
- if (g->replace)
- st=MStrPrint("\"$$WW+H,1$$\";Cd(\"%s\");"
- "Find(\"%Q\",\"%Q\",\"%Q\",\"%Q\");UserTaskCont;",
- dir,g->find_text,g->filemask,buf,g->replace_text);
- else
- st=MStrPrint("\"$$WW+H,1$$\";Cd(\"%s\");"
- "Find(\"%Q\",\"%Q\",\"%Q\");UserTaskCont;",
- dir,g->find_text,g->filemask,buf);
- res=PopUp(st);
- }
- Free(dir);
- }
- Free(g);
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Opt/Utils/HeapLog.HC.HTML b/public/src/Adam/Opt/Utils/HeapLog.HC.HTML deleted file mode 100644 index 4a3b922..0000000 --- a/public/src/Adam/Opt/Utils/HeapLog.HC.HTML +++ /dev/null @@ -1,223 +0,0 @@ - - - - - HeapLog.HC - - - - - #help_index "Debugging/Heap;Memory/Debugging"
-#help_file "::/Doc/HeapDbg"
-
-#define HL_CALLER_DEPTH 5 //Feel free to change this.
-#define HL_HASH_SIZE 0x1000
-
-class CHeapLog
-{
- CHeapLog *next,*last;
- union {
- U8 *addr;
- I64 size;
- }
- I64 cnt;
- U8 *caller[HL_CALLER_DEPTH];
-};
-
-class CHeapLogHash
-{
- CHeapLog *next,*last;
-};
-
-CHeapCtrl *heaplog_hc_watched,*heaplog_hc=NULL;
-CHeapLogHash *heaplog_head=NULL;
-
-U0 HeapLogMAlloc(U8 *addr)
-{
- CHeapLog *tmphl;
- I64 i;
- if (MHeapCtrl(addr)==heaplog_hc_watched) {
- tmphl=MAlloc(sizeof(CHeapLog),heaplog_hc);
- tmphl->addr=addr;
- for (i=0;i<HL_CALLER_DEPTH;i++)
- tmphl->caller[i]=Caller(i+2);
- i=addr>>3 &(HL_HASH_SIZE-1);
- PUSHFD
- CLI
- while (LBts(&sys_semas[SEMA_HEAPLOG_LOCK],0))
- PAUSE
- QueIns(tmphl,heaplog_head[i].last);
- LBtr(&sys_semas[SEMA_HEAPLOG_LOCK],0);
- POPFD
- }
-}
-
-U0 HeapLogFree(U8 *addr)
-{
- I64 i;
- CHeapLog *tmphl;
- if (!addr) return;
- if (MHeapCtrl(addr)==heaplog_hc_watched) {
- i=addr>>3 &(HL_HASH_SIZE-1);
- PUSHFD
- CLI
- while (LBts(&sys_semas[SEMA_HEAPLOG_LOCK],0))
- PAUSE
- tmphl=heaplog_head[i].next;
- while (tmphl!=&heaplog_head[i]) {
- if (addr==tmphl->addr) {
- QueRem(tmphl);
- LBtr(&sys_semas[SEMA_HEAPLOG_LOCK],0);
- POPFD
- Free(tmphl);
- return;
- }
- tmphl=tmphl->next;
- }
- LBtr(&sys_semas[SEMA_HEAPLOG_LOCK],0);
- POPFD
- }
-}
-
-public Bool HeapLog(Bool val=ON,CTask *task=NULL)
-{//Turn on. Collect data. Call HeapLogAddrRep() or HeapLogSizeRep().
- I64 i;
- if (val) {
- if (Bt(&sys_semas[SEMA_HEAPLOG_ACTIVE],0)) {
- "HeapLog Already Active\n";
- return TRUE;
- } else {
- if (!task) task=Fs;
- if (TaskValidate(task))
- heaplog_hc_watched=task->data_heap;
- else
- heaplog_hc_watched=task;//Actually, not a task, must be a HeapCtrl.
- PUSHFD
- CLI
- while (LBts(&sys_semas[SEMA_HEAPLOG_LOCK],0))
- PAUSE
- heaplog_hc=HeapCtrlInit(,,sys_data_bp);
- ext[EXT_HEAPLOG_MALLOC]=&HeapLogMAlloc;
- ext[EXT_HEAPLOG_FREE]=&HeapLogFree;
- heaplog_head=MAlloc(sizeof(CHeapLogHash)*HL_HASH_SIZE,heaplog_hc);
- for (i=0;i<HL_HASH_SIZE;i++)
- QueInit(&heaplog_head[i]);
- LBtr(&sys_semas[SEMA_HEAPLOG_LOCK],0);
- POPFD
- LBts(&sys_semas[SEMA_HEAPLOG_ACTIVE],0);
- return FALSE;
- }
- } else {
- if (!LBtr(&sys_semas[SEMA_HEAPLOG_ACTIVE],0)) {
- "HeapLog Not Active\n";
- return FALSE;
- } else {
- HeapCtrlDel(heaplog_hc);
- heaplog_head=heaplog_hc=NULL;
- ext[EXT_HEAPLOG_MALLOC]=NULL;
- ext[EXT_HEAPLOG_FREE]=NULL;
- return TRUE;
- }
- }
-}
-
-public U0 HeapLogAddrRep(Bool leave_it=OFF)
-{//Call HeapLog() first and collect data.
- I64 i,j,total=0;
- CHeapLog *tmphl,hl;
- if (!LBtr(&sys_semas[SEMA_HEAPLOG_ACTIVE],0)) {
- "HeapLog Not Active\n";
- return;
- }
- "$WW,0$";
- while (LBts(&sys_semas[SEMA_HEAPLOG_LOCK],0))
- PAUSE
- for (i=0;i<HL_HASH_SIZE;i++) {
- tmphl=heaplog_head[i].next;
- while (tmphl!=&heaplog_head[i]) {
-//Take snapshot in case modified. (while we work)
- MemCpy(&hl,tmphl,sizeof(CHeapLog));
- "$PURPLE$%08X$FG$%08X",MSize(hl.addr),hl.addr;
- for (j=0;j<HL_CALLER_DEPTH;j++)
- "%P",hl.caller[j];
- '\n';
- total+=MSize(hl.addr);
- tmphl=hl.next;
- }
- }
- LBtr(&sys_semas[SEMA_HEAPLOG_LOCK],0);
- "\n$LTRED$Total:%08X$FG$\n",total;
- LBts(&sys_semas[SEMA_HEAPLOG_ACTIVE],0);
- if (!leave_it)
- HeapLog(OFF);
-}
-
-public U0 HeapLogSizeRep(Bool leave_it=OFF)
-{//Call HeapLog() first and collect data.
- I64 i,j,k,total=0;
- CHeapLog *tmphla,hla,*tmphls,*tmphls1;
- CHeapLogHash *size_head;
- if (!LBtr(&sys_semas[SEMA_HEAPLOG_ACTIVE],0)) {
- "HeapLog Not Active\n";
- return;
- }
-
- size_head=MAlloc(sizeof(CHeapLogHash)*HL_HASH_SIZE,heaplog_hc);
- for (i=0;i<HL_HASH_SIZE;i++)
- QueInit(&size_head[i]);
-
- "$WW,0$";
- while (LBts(&sys_semas[SEMA_HEAPLOG_LOCK],0))
- PAUSE
- for (i=0;i<HL_HASH_SIZE;i++) {
- tmphla=heaplog_head[i].next;
- while (tmphla!=&heaplog_head[i]) {
-//Take snapshot in case modified. (while we work)
- MemCpy(&hla,tmphla,sizeof(CHeapLog));
- k=(MSize(hla.addr)>>3+hla.caller[0])&(HL_HASH_SIZE-1);
- tmphls=size_head[k].next;
- while (tmphls!=&size_head[k]) {
- if (MSize(hla.addr)==tmphls->size) {
- for (j=0;j<HL_CALLER_DEPTH;j++)
- if (hla.caller[j]!=tmphls->caller[j])
- goto hl_next;
- tmphls->cnt++;
- goto hl_found;
- }
-hl_next:
- tmphls=tmphls->next;
- }
- tmphls=MAlloc(sizeof(CHeapLog),heaplog_hc);
- MemCpy(tmphls,&hla,sizeof(CHeapLog));
- tmphls->cnt=1;
- tmphls->size=MSize(hla.addr);
- QueIns(tmphls,size_head[k].last);
-hl_found:
- tmphla=hla.next;
- }
- }
- LBtr(&sys_semas[SEMA_HEAPLOG_LOCK],0);
-
- for (i=0;i<HL_HASH_SIZE;i++) {
- tmphls=size_head[i].next;
- while (tmphls!=&size_head[i]) {
- tmphls1=tmphls->next;
- "%08X*%08X=%08X",tmphls->size,tmphls->cnt,tmphls->size*tmphls->cnt;
- for (j=0;j<HL_CALLER_DEPTH;j++)
- "%P",tmphls->caller[j];
- '\n';
- total+=tmphls->size*tmphls->cnt;
- Free(tmphls);
- tmphls=tmphls1;
- }
- }
- Free(size_head);
-
- "\n$LTRED$Total:%08X$FG$\n",total;
- LBts(&sys_semas[SEMA_HEAPLOG_ACTIVE],0);
- if (!leave_it)
- HeapLog(OFF);
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Opt/Utils/LineRep.HC.HTML b/public/src/Adam/Opt/Utils/LineRep.HC.HTML deleted file mode 100644 index 1ddeca1..0000000 --- a/public/src/Adam/Opt/Utils/LineRep.HC.HTML +++ /dev/null @@ -1,121 +0,0 @@ - - - - - LineRep.HC - - - - - #help_index "Cmd Line (Typically)"
-
-I64 LineRep1(CDirEntry *tmpde)
-{
- CDoc *doc;
- I64 res=0,i;
- while (tmpde) {
- i=0;
- if (tmpde->attr&RS_ATTR_DIR)
- i=LineRep1(tmpde->sub);
- else {
- doc=DocRead(tmpde->full_name);
- if (doc->head.next!=doc)
- i=doc->head.last->y+2;
- DocDel(doc);
- }
- tmpde->user_data=i;
- res+=i;
- tmpde=tmpde->next;
- }
- return res;
-}
-U0 LineRep2(CDoc *doc,CDirEntry *tmpde)
-{
- while (tmpde) {
- if (tmpde->attr&RS_ATTR_DIR) {
- DocPrint(doc,"%8,d $TR+C,\"%s\"$\n$
$",tmpde->user_data,tmpde->name);
- LineRep2(doc,tmpde->sub);
- DocPrint(doc,"$
$");
- } else
- DocPrint(doc,"%8,d $LK,\"%s\",A=\"FI:%s\"$\n",
- tmpde->user_data,tmpde->name,tmpde->full_name);
- tmpde=tmpde->next;
- }
-}
-public I64 LineRep(U8 *files_find_mask="/*",U8 *fu_flags=NULL)
-{//Source line-of-code count report.
- I64 fuf_flags=0,res=0;
- CDoc *doc=DocNew;
- CDirEntry *tmpde1=NULL;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+S");
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
- if (tmpde1=FilesFind(files_find_mask,fuf_flags)) {
- res=LineRep1(tmpde1);
- DocPrint(doc,"%8,d $TR+C,\"%s\"$\n$
$",res,files_find_mask);
- LineRep2(doc,tmpde1);
- DocPrint(doc,"$
$");
- DirTreeDel(tmpde1);
- }
- DocInsDoc(DocPut,doc);
- DocDel(doc);
- return res;
-}
-
-I64 SizeRep1(CDirEntry *tmpde,I64 *_fuf_flags)
-{
- I64 res=0,i;
- U8 buf[BLK_SIZE];
- CDrv *dv;
- while (tmpde) {
- if (tmpde->attr&RS_ATTR_DIR)
- i=SizeRep1(tmpde->sub,_fuf_flags);
- else if ((i=tmpde->size) && Bt(_fuf_flags,FUf_EXPAND) &&
- FileAttr(tmpde->name)&RS_ATTR_COMPRESSED) {
- dv=Let2Drv(*tmpde->full_name);
- BlkRead(dv,buf,Clus2Blk(dv,tmpde->clus),1);
- i=(&buf)(CArcCompress *)->expanded_size;
- }
- tmpde->user_data=i;
- res+=i;
- tmpde=tmpde->next;
- }
- return res;
-}
-U0 SizeRep2(CDoc *doc,CDirEntry *tmpde)
-{
- while (tmpde) {
- if (tmpde->attr&RS_ATTR_DIR) {
- DocPrint(doc,"%10,d $TR+C,\"%s\"$\n$
$",
- tmpde->user_data,tmpde->name);
- SizeRep2(doc,tmpde->sub);
- DocPrint(doc,"$
$");
- } else {
- DocPrint(doc,"%10,d ",tmpde->user_data);
- DocPrint(doc,"$LK,\"%s\",A=\"FI:%s\"$\n",
- tmpde->name,tmpde->full_name);
- }
- tmpde=tmpde->next;
- }
-}
-public I64 SizeRep(U8 *files_find_mask="/*",U8 *fu_flags=NULL)
-{//Report file sizes. "+x" for expanded size of compressed files.
- I64 fuf_flags=0,res=0;
- CDoc *doc=DocNew;
- CDirEntry *tmpde1=NULL;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
- if (tmpde1=FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND)) {
- fuf_flags&=FUF_EXPAND;
- res=SizeRep1(tmpde1,&fuf_flags);
- DocPrint(doc,"%10,d $TR+C,\"%s\"$\n$
$",res,files_find_mask);
- SizeRep2(doc,tmpde1);
- DocPrint(doc,"$
$");
- DirTreeDel(tmpde1);
- }
- DocInsDoc(DocPut,doc);
- DocDel(doc);
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Opt/Utils/LinkChk.HC.HTML b/public/src/Adam/Opt/Utils/LinkChk.HC.HTML deleted file mode 100644 index b263d24..0000000 --- a/public/src/Adam/Opt/Utils/LinkChk.HC.HTML +++ /dev/null @@ -1,91 +0,0 @@ - - - - - LinkChk.HC - - - - - #help_index "Debugging;Cmd Line (Typically)"
-
-I64 LinkChkDoc(CDoc *doc,I64 *_fuf_flags)
-{
- U8 *st;
- Bool found,unlock=DocLock(doc);
- CDoc *old_doc;
- CDocEntry *doc_e=doc->head.next;
- I64 res=0;
- while (doc_e!=doc) {
- if (ScanKey) {
- LBts(_fuf_flags,FUf_CANCEL);
- break;
- }
- if (st=DocEntryLink(doc,doc_e)) {
- old_doc=DocPut;
- DocLock(old_doc);
- Fs->put_doc=doc;
- found=DocLinkChk(doc,st);
- Fs->put_doc=old_doc;
- DocUnlock(old_doc);
- if (!found) {
- PutFileLink(doc->filename.name,,doc_e->y);
- "$RED$ %04d:%s\n$FG$",doc_e->y,st;
- res++;
- }
- Free(st);
- } else if (doc_e->type_u8==DOCT_ERROR) {
- PutFileLink(doc->filename.name,,doc_e->y);
- "$RED$ Doc Error\n$FG$";
- res++;
- }
- doc_e=doc_e->next;
- }
- if (unlock) DocUnlock(doc);
- return res;
-}
-
-I64 LinkChkFile(U8 *filename,I64 *_fuf_flags)
-{
- I64 res;
- CDoc *doc=DocRead(filename,DOCF_NO_CURSOR);
- res=LinkChkDoc(doc,_fuf_flags);
- DocDel(doc);
- return res;
-}
-public I64 LinkChk(U8 *files_find_mask="/*",U8 *fu_flags=NULL)
-{//Check documents for broken file links.
- I64 fuf_flags=0,res=0;
- CDirEntry *tmpde,*tmpde1;
- U8 *st;
- progress2_max=1;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+$+f+F+O");
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
- tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
- while (tmpde && !Bt(&fuf_flags,FUf_CANCEL)) {
-
- st=MStrPrint("Before %s Broke:%d",tmpde->full_name,res);
- if (StrLen(st)>PROGRESS_DESC_LEN-1)
- st[PROGRESS_DESC_LEN-1]=0;
- StrCpy(progress2_desc,st);
- Free(st);
- Yield;
-
- res+=LinkChkFile(tmpde->full_name,&fuf_flags);
-
- st=MStrPrint("After %s Broke:%d",tmpde->full_name,res);
- if (StrLen(st)>PROGRESS_DESC_LEN-1)
- st[PROGRESS_DESC_LEN-1]=0;
- StrCpy(progress2_desc,st);
- Free(st);
- Yield;
-
- tmpde=tmpde->next;
- }
- DirTreeDel(tmpde1);
- progress2_max=0;
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Opt/Utils/MakeUtils.HC.HTML b/public/src/Adam/Opt/Utils/MakeUtils.HC.HTML deleted file mode 100644 index e55c810..0000000 --- a/public/src/Adam/Opt/Utils/MakeUtils.HC.HTML +++ /dev/null @@ -1,27 +0,0 @@ - - - - - MakeUtils.HC - - - - - Cd(__DIR__);;
-#include "Diff"
-#include "Find"
-#include "HeapLog"
-#include "LineRep"
-#include "LinkChk"
-#include "MemRep"
-#include "Merge"
-#include "Profiler"
-#include "StrUtils"
-#include "DocUtils"
-#include "ToDolDoc"
-#include "ToTXT"
-#include "TOS"
-Cd("..");;
- - - \ No newline at end of file diff --git a/public/src/Adam/Opt/Utils/MemRep.HC.HTML b/public/src/Adam/Opt/Utils/MemRep.HC.HTML deleted file mode 100644 index 3c5d620..0000000 --- a/public/src/Adam/Opt/Utils/MemRep.HC.HTML +++ /dev/null @@ -1,243 +0,0 @@ - - - - - MemRep.HC - - - - - #help_index "Info;Memory/Info;Cmd Line (Typically)"
-
-I64 TSSSize(CTSS *tss)
-{
- return MSize2(tss)+MSize2(tss->st0)+MSize2(tss->st1)+MSize2(tss->st2);
-}
-
-I64 PenBrushesSize()
-{
- I64 res=0,i;
- for (i=0;i<GR_PEN_BRUSHES_NUM;i++)
- res+=DCSize(gr.pen_brushes[i])+DCSize(gr.collision_pen_brushes[i])+
- DCSize(gr.even_pen_brushes[i])+DCSize(gr.odd_pen_brushes[i]);
- return res;
-}
-
-I64 ScrnZoomTablesSize()
-{
- I64 res=0,i;
- for (i=1;i<=GR_SCRN_ZOOM_MAX;i++)
- res+=MSize2(gr.scrn_zoom_tables[i]);
- return res;
-}
-
-I64 TaskStkSize(CTask *task)
-{
- CTaskStk *tmps=task->stk;
- I64 res=0;
- while (tmps) {
- res+=MSize2(tmps);
- tmps=tmps->next_stk;
- }
- return res;
-}
-
-I64 TaskQueSize(CTask *task)
-{
- CJob *tmpc,*tmpc1;
- I64 res=0;
- PUSHFD
- CLI
- while (LBts(&task->srv_ctrl.flags,JOBCf_LOCKED))
- PAUSE
-
- tmpc1=&task->srv_ctrl.next_waiting;
- tmpc=tmpc1->next;
- while (tmpc!=tmpc1) {
- res+=MSize2(tmpc)+MSize2(tmpc->aux_str);
- tmpc=tmpc->next;
- }
-
- tmpc1=&task->srv_ctrl.next_done;
- tmpc=tmpc1->next;
- while (tmpc!=tmpc1) {
- res+=MSize2(tmpc)+MSize2(tmpc->aux_str);
- tmpc=tmpc->next;
- }
-
- LBtr(&task->srv_ctrl.flags,JOBCf_LOCKED);
- POPFD
- return res;
-}
-
-I64 BlkDevsSize()
-{
- I64 i,j,res=MSize2(blkdev.blkdevs);
- CBlkDev *bd;
- for (i=0;i<BLKDEVS_NUM;i++) {
- bd=&blkdev.blkdevs[i];
- if (bd->bd_signature==BD_SIGNATURE_VAL) {
- j=(bd->max_blk+1)<<BLK_SIZE_BITS;
- if (bd->type==BDT_RAM)
- "RAMDsk%C\t:%010X/%010X\n",
- bd->first_drv_let,j-DrvUnused(bd->first_drv_let),j;
- res+=MSize2(bd->dev_id_record);
- }
- }
- return res;
-}
-
-I64 DrvsSize()
-{
- I64 i,res=MSize2(blkdev.drvs);
- for (i=0;i<DRVS_NUM;i++)
- res+=MSize2(blkdev.drvs[i].cur_fat_blk)+MSize2(blkdev.drvs[i].fis);
- return res;
-}
-
-Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
-{
- I64 i,j,k,m,n;
- CDoc *pdoc,*ddoc,*bdoc;
- CCmpCtrl *cc;
- CMathODE *o;
- CCPU *c;
- CTask *task1;
-
- if (!override_validate && !TaskValidate(task))
- return FALSE;
- if (task==Fs)
- task->rsp=GetRSP;
- "$BLACK$%-27t$Q#%08X$FG$\n",task->task_title,task;
- "$
$Heap\t:%010X/%010X\n",TaskMemUsed(task,override_validate),
- TaskMemAlloced(task,override_validate);
-
- i=UnusedStk(task);
- j=TaskStkSize(task);
- if (0<=i<=task->stk->stk_size)
- "Stk\t\t:%010X/%010X\n",j-i,j;
- else
- "Stk\t\t:$RED$$BK,1$Overflow$BK,0$$FG$/%010X\n",j;
-
- "HashTable\t:%010X\n",HashTableSize2(task->hash_table);
- "FPU\t\t:%010X\n",MSize2(task->fpu_mmx);
- "DirCur\t:%010X\n",MSize2(task->cur_dir);
-
- if (pdoc=DocPut(task))
- "PutDoc\t:%010X\n",DocSize(pdoc);
- if ((ddoc=DocDisplay(task)) && pdoc!=ddoc)
- "DisplayDoc\t:%010X\n",DocSize(ddoc);
- if (bdoc=DocBorder(task))
- "BorderDoc\t:%010X\n",DocSize(bdoc);
-
- cc=task->next_cc;
- while (cc!=&task->next_cc) {
- "CmpCtrl\t:%010X\n",CmpCtrlSize(cc);
- cc=cc->next;
- }
-
- o=task->next_ode;
- while (o!=&task->next_ode) {
- "CMathODE\t:%010X\n",ODESize(o);
- o=o->next;
- }
-
- if (task==sys_winmgr_task) {
- "gr.pen_brushes\t:%010X\n",PenBrushesSize;
- "gr.scrn_zoom_tbles\t:%010X\n",ScrnZoomTablesSize;
- "scrncast.dc\t:%010X\n",DCSize(scrncast.dc);
- "scrncast.dc2_alias\t:%010X\n",DCSize(scrncast.dc2_alias);
- } else if (task==adam_task) {
- j=0;k=0;m=0;n=0;
- for (i=0;i<mp_cnt;i++) {
- c=&cpu_structs[i];
- k+=TSSSize(c->tss);
- task1=c->seth_task;
- do {
- if (task1!=adam_task) {//adam task located in Kernel mem
- j+=MSize2(task1);
- m+=MSize2(task1->code_heap);
- if (task1->data_heap!=task1->code_heap)
- m+=MSize2(task1->code_heap);
- }
- n+=TaskQueSize(task1);
- task1=task1->next_task;
- } while (task1!=c->seth_task);
- task1=c->idle_task;
- j+=MSize2(task1);
- m+=MSize2(task1->code_heap);
- if (task1->data_heap!=task1->code_heap)
- m+=MSize2(task1->code_heap);
- }
- "TaskStructs\t:%010X\n",j;
- "TSSes\t:%010X\n",k;
- "HeapCtrls\t:%010X\n",m;
- if (n)
- "TaskQues\t:%010X\n",n;
- "BlkDevs\t:%010X\n",BlkDevsSize;
- "Drvs\t:%010X\n",DrvsSize;
- if (blkdev.cache_base)
- "DskCache\t:%010X\n",
- MSize2(blkdev.cache_base)+MSize2(blkdev.cache_hash_table)+
- MSize2(blkdev.cache_ctrl);
- "Clip\t:%010X\n",DocSize(sys_clip_doc);
- "AutoComplete:%010X\n",CallExtStr("AutoCompleteSize");
- "gr.to_8_bits\t:%010X\n",MSize2(gr.to_8_bits);
- "gr.to_8_colors\t:%010X\n",MSize2(gr.to_8_colors);
- "gr.text_base\t:%010X\n",MSize2(gr.text_base);
- "gr.vga_text_cache\t:%010X\n",MSize2(gr.vga_text_cache);
- "gr.win_z_buf\t:%010X\n",MSize2(gr.win_z_buf)+
- MSize2(gr.win_uncovered_bitmap);
- "gr.dc\t\t:%010X\n",DCSize(gr.dc);
- "gr.dc1\t\t:%010X\n",DCSize(gr.dc1);
- "gr.dc2\t\t:%010X\n",DCSize(gr.dc2);
- "gr.dc_cache\t\t:%010X\n",DCSize(gr.dc_cache);
- "gr.scrn_image\t:%010X\n",DCSize(gr.scrn_image);
- "gr.zoomed_dc\t:%010X\n",DCSize(gr.zoomed_dc);
- }
- "$
$";
- return TRUE;
-}
-
-public U0 MemRep()
-{//Memory usage report.
- I64 i;
- CTask *task;
- CCPU *c;
- CBinFile *bfh=mem_boot_base-sizeof(CBinFile);
- bfh(I64)+=bfh->file_size-1;
-
- "$BLACK$Low Memory\t:0000100000$FG$\n$
$";
- "Kernel\t:%010X-%010X\n",mem_boot_base-sizeof(CBinFile),bfh;
-
- "VGA\t\t:00000A0000-00000BFFFF\n";
- "$
$$BLACK$HighMemory\t:0000100000-%010X$FG$\n",
- mem_heap_limit;
- "SYS_FIXED_AREA\t:%010X-%010X\n",
- SYS_FIXED_AREA,SYS_FIXED_AREA+sizeof(CSysFixedArea)-1;
-
- if (sys_data_bp) {
- "$BLACK$Code Heap\t:%010X/%010X$FG$\n",
- sys_code_bp->used_u8s,sys_code_bp->alloced_u8s;
- "$BLACK$Data Heap\t:%010X/%010X$FG$\n",
- sys_data_bp->used_u8s,sys_data_bp->alloced_u8s;
- } else
- "$BLACK$Code/Data Heap\t:%010X/%010X$FG$\n",
- sys_code_bp->used_u8s,sys_code_bp->alloced_u8s;
-
- for (i=0;i<mp_cnt;i++) {
- c=&cpu_structs[i];
- "$PURPLE$CPU%d$FG$\n$
$",i;
- task=c->seth_task;
- do {
- if (!MemRepTask(task))
- break;
- task=task->next_task;
- } while (task!=c->seth_task);
- MemRepTask(c->idle_task,TRUE);
- "$
$";
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Opt/Utils/Merge.HC.HTML b/public/src/Adam/Opt/Utils/Merge.HC.HTML deleted file mode 100644 index 5193ed6..0000000 --- a/public/src/Adam/Opt/Utils/Merge.HC.HTML +++ /dev/null @@ -1,89 +0,0 @@ - - - - - Merge.HC - - - - - #help_index "Cmd Line (Typically)"
-
-CDirEntry MGFind(CDirEntry *needle_entry,CDirEntry *haystack_lst)
-{
- while (haystack_lst) {
- if (!StrCmp(needle_entry->name,haystack_lst->name))
- return haystack_lst;
- haystack_lst=haystack_lst->next;
- }
- return NULL;
-}
-
-U0 Merge2(CDirEntry *tmpde1,CDirEntry *tmpde2,I64 *_fuf_flags,I64 *_df_flags)
-{
- CDirEntry *tmpde;
- while (tmpde1 && !(*_df_flags & DF_ABORT_ALL_FILES)) {
- tmpde=MGFind(tmpde1,tmpde2);
- if (!tmpde)
- "$BROWN$Does Not Exist:%s$FG$\n",tmpde1->full_name;
- else {
- if (tmpde1->attr & RS_ATTR_DIR)
- Merge2(tmpde1->sub,tmpde->sub,_fuf_flags,_df_flags);
- else {
- if (AbsI64(tmpde1->datetime-tmpde->datetime)>CDATE_FREQ*2) {//slop
- "%s",tmpde1->full_name;
- '\n';
- if (Bt(_fuf_flags,FUf_DIFF)) {
- if (FilesFindMatch(tmpde1->full_name,FILEMASK_TXT))
- Diff(tmpde->full_name,tmpde1->full_name,_df_flags);
- }
- }
- }
- }
- tmpde1=tmpde1->next;
- }
-}
-public U0 Merge(U8 *dst_files_find_mask="/*",U8 *src_files_find_mask="/*",
- U8 *fu_flags=NULL)
-{/*Merge text files from one list into another.
-Report files whos date/time is different.
-
-"+d" will do Diff() on files and prompt to
-merge changes from source files into
-destination files.
-*/
- I64 df_flags=0,fuf_flags=0;
- CDirEntry *tmpde1=NULL,*tmpde2=NULL;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
- if (fuf_flags&~(FUG_FILES_FIND|FUF_DIFF))
- throw('FUF');
- PrintWarn("This is based strictly on file dates.\n");
- tmpde1=FilesFind(src_files_find_mask,fuf_flags&FUG_FILES_FIND);
- tmpde2=FilesFind(dst_files_find_mask,fuf_flags&FUG_FILES_FIND);
- fuf_flags&=FUF_DIFF;
- Merge2(tmpde1,tmpde2,&fuf_flags,&df_flags);
- DirTreeDel(tmpde1);
- DirTreeDel(tmpde2);
-}
-
-#help_index "Utils;Cmd Line (Typically)"
-
-public U0 NewFiles(U8 *files_find_mask="/*",CDate cdt=0,U8 *fu_flags=NULL)
-{//Report files newer than a certain date.
- I64 fuf_flags=0;
- CDirEntry *tmpde,*tmpde1;
- if (!cdt) cdt=sys_compile_time;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+F");
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
- tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
- while (tmpde) {
- if (tmpde->datetime>cdt)
- "%s\n",tmpde->full_name;
- tmpde=tmpde->next;
- }
- DirTreeDel(tmpde1);
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Opt/Utils/Profiler.HC.HTML b/public/src/Adam/Opt/Utils/Profiler.HC.HTML deleted file mode 100644 index 8da5e4d..0000000 --- a/public/src/Adam/Opt/Utils/Profiler.HC.HTML +++ /dev/null @@ -1,114 +0,0 @@ - - - - - Profiler.HC - - - - - #help_index "Debugging/Profiler;Profiler;Cmd Line (Typically)/Profiler"
-#help_file "::/Doc/Profiler"
-
-#define PF_ARRAY_CNT 0x100000
-I64 pf_jiffy_start,pf_jiffy_end;
-I64 *pf_array=NULL;
-I64 pf_cpu=0;
-I64 pf_buf_in_ptr=0,pf_depth;
-I64 pf_prof_active=0;
-
-U0 ProfTimerInt(CTask *task)
-{//See profiler_timer_irq.
- I64 i,k;
- if (Bt(&pf_prof_active,0))
- for (k=0;k<=pf_depth;k++) {
- if (task==Gs->idle_task)
- i=SYS_IDLE_PT;
- else
- i=TaskCaller(task,k,TRUE);
- if (pf_buf_in_ptr<PF_ARRAY_CNT) {
- pf_array[pf_buf_in_ptr++]=i;
- pf_jiffy_end=cnts.jiffies;
- }
- }
-}
-
-public U0 Prof(I64 depth=0,I64 cpu_num=0)
-{/*Start collecting profiler statistics.
-Profilers report where time is spent
-by sampling RIP during the $TX,"1000Hz",D="DD_JIFFY_HZ"$
-timer interrupt.
-
-Do a ProfRep(), (profiler report)
-after you have collected data.
-*/
- if (!(0<=cpu_num<mp_cnt))
- ST_ERR_ST "Invalid CPU\n";
- else {
- cpu_structs[pf_cpu].profiler_timer_irq=NULL;
- pf_cpu=cpu_num;
-
- pf_depth=depth;
- pf_buf_in_ptr=0;
- if (!pf_array)
- pf_array=AMAlloc(sizeof(I64)*PF_ARRAY_CNT);
- pf_jiffy_end=pf_jiffy_start=cnts.jiffies;
- LBts(&pf_prof_active,0);
- cpu_structs[pf_cpu].profiler_timer_irq=&ProfTimerInt;
- }
-}
-
-I64 ProfCompare(U8 *i1,U8 *i2)
-{
- return i1-i2;
-}
-
-public U0 ProfRep(I64 filter_cnt=1,Bool leave_it=OFF)
-{//Profiler report. Call Prof() first and collect data.
- I64 i,hits,rip,last_rip=0,routine_total=0;
- F64 total_time;
- U8 buf[256],buf2[256],last_buf[256];
- if (!LBtr(&pf_prof_active,0))
- "Profiler Not Active\n";
- if (!pf_buf_in_ptr)
- "No Profiler Statistic\n";
- else {
- if (!(total_time=pf_jiffy_end-pf_jiffy_start))
- total_time=1;
- QSortI64(pf_array,pf_buf_in_ptr,&ProfCompare);
- *last_buf=0;
- for (i=0;i<pf_buf_in_ptr;i+=hits) {
- rip=pf_array[i];
- hits=0;
- do hits++;
- while (i+hits<pf_buf_in_ptr && pf_array[i+hits]==rip);
-
- StrPrint(buf,"%p",rip);
- StrFirstRem(buf,"+",buf2);
- if (StrCmp(buf2,last_buf)) {
- if (*last_buf && routine_total>=filter_cnt)
- "$GREEN$%6.2f%08X:%s\n$FG$",100*routine_total/total_time,
- routine_total,last_buf;
- StrCpy(last_buf,buf2);
- routine_total=0;
- }
- routine_total+=hits;
- if (hits>=filter_cnt) {
- "%6.2f%08X:%P\n",100*hits/total_time,hits,rip;
- last_rip=rip;
- }
- }
- if (*last_buf && routine_total>=filter_cnt)
- "$GREEN$%6.2f%08X:%s\n$FG$",100*routine_total/total_time,
- routine_total,last_buf;
- "Total Time:%0.6fs\n",total_time/JIFFY_FREQ;
- if (leave_it) {
- cpu_structs[pf_cpu].profiler_timer_irq=&ProfTimerInt;
- LBts(&pf_prof_active,0);
- } else
- cpu_structs[pf_cpu].profiler_timer_irq=NULL;
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Opt/Utils/StrUtils.HC.HTML b/public/src/Adam/Opt/Utils/StrUtils.HC.HTML deleted file mode 100644 index e618c79..0000000 --- a/public/src/Adam/Opt/Utils/StrUtils.HC.HTML +++ /dev/null @@ -1,218 +0,0 @@ - - - - - StrUtils.HC - - - - - #help_index "Cmd Line (Typically)"
-
-I64 DEPtrCompare(CDocEntry **e1,CDocEntry **e2)
-{
- return StrCmp((*e1)->tag,(*e2)->tag);
-}
-
-public I64 Sort(U8 *_in_name,U8 *_out_name=NULL,
- I64 entry_lines=1,Bool unique=FALSE)
-{//Sort lines of a text file. Removes blank lines.
- U8 *in_name,*out_name,*st;
- CDoc *doc;
- CDocEntry *doc_e,*doc_e1,**a;
- I64 i,j,cnt=0,res;
-
- if (!_in_name) return 0;
- in_name=ExtDft(_in_name,"DD.Z");
- if (_out_name)
- out_name=ExtDft(_out_name,"DD.Z");
- else
- out_name=StrNew(in_name);
-
- doc=DocRead(in_name,DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR);
- doc_e=doc->head.next;
- while (doc_e!=doc) {
- if (doc_e->type_u8==DOCT_TEXT)
- cnt++;
- doc_e=doc_e->next;
- }
- a=MAlloc(cnt*sizeof(CDocEntry *));
- doc_e=doc->head.next;
- i=0;
- while (doc_e!=doc) {
- doc_e1=doc_e->next;
- if (doc_e->type_u8==DOCT_TEXT) {
- QueRem(doc_e);
- a[i++]=doc_e;
- } else
- DocEntryDel(doc,doc_e);
- doc_e=doc_e1;
- }
- QSort(a,cnt/entry_lines,entry_lines*sizeof(CDocEntry *),&DEPtrCompare);
-
- res=0;
- st=NULL;
- for (i=0;i<cnt;) {
- if (!unique || !st || StrCmp(a[i]->tag,st)) {
- st=a[i]->tag;
- for (j=0;j<entry_lines && i<cnt;j++,i++) {
- QueIns(a[i],doc->head.last);
- doc->cur_entry=&doc->head;
- doc->cur_col=0;
- DocPrint(doc,"\n");
- }
- res++;
- } else
- for (j=0;j<entry_lines && i<cnt;j++,i++) {
- QueIns(a[i],doc->head.last);
- DocEntryDel(doc,a[i]);
- }
- }
- StrCpy(doc->filename.name,out_name);
- DocWrite(doc);
-
- Free(a);
- DocDel(doc);
- Free(in_name);
- Free(out_name);
- return res; //Num Entries
-}
-
-I64 DocWordsFile(CDoc *doc_out=NULL,U8 *filename,U32 *char_bmp)
-{
- U8 *ptr,*ptr2;
- I64 res=0,ch;
- CDoc *doc_in=DocRead(filename);
- CDocEntry *doc_e=doc_in->head.next;
- while (doc_e!=doc_in) {
- if (doc_e->de_flags & DOCEF_TAG) {
- ptr=doc_e->tag;
- while (*ptr) {
- while (*ptr && !Bt(char_bmp,*ptr))
- ptr++;
-
- ptr2=ptr;
- while (*ptr && Bt(char_bmp,*ptr))
- ptr++;
-
- ch=*ptr;
- *ptr=0;
- if (*ptr2) {
- DocPrint(doc_out,"%s\n",ptr2);
- res++;
- }
- *ptr=ch;
- }
- }
- doc_e=doc_e->next;
- }
- DocDel(doc_in);
- return res;
-}
-public I64 Words(U8 *files_find_mask="*",U32 *char_bmp=char_bmp_alpha,
- U8 *fu_flags=NULL)
-{//Break file into list of not-unique words.
- I64 fuf_flags=0,res=0;
- CDoc *doc_out=DocNew;
- CDirEntry *tmpde,*tmpde1;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F+T");
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
- tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
- while (tmpde) {
- res+=DocWordsFile(doc_out,tmpde->full_name,char_bmp);
- tmpde=tmpde->next;
- }
- DirTreeDel(tmpde1);
- DocInsDoc(NULL,doc_out);
- DocDel(doc_out);
- return res;
-}
-
-I64 LongLinesFile(U8 *filename,I64 cols)
-{
- I64 res=0;
- CDoc *doc=DocRead(filename);
- CDocEntry *doc_e=doc->head.next;
- while (doc_e!=doc) {
- if (doc_e->type_u8==DOCT_NEW_LINE && doc_e->x>=cols+1)
- res++;
- doc_e=doc_e->next;
- }
- DocDel(doc);
- if (res) {
- "%04d ",res;
- PutFileLink(filename);
- '\n';
- }
- return res;
-}
-public I64 LongLines(U8 *files_find_mask="*",I64 cols=80,U8 *fu_flags=NULL)
-{//Report files with lines of too many cols.
- I64 res=0,fuf_flags=0;
- CDirEntry *tmpde,*tmpde1;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F+S");
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
- tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
- while (tmpde) {
- if (LongLinesFile(tmpde->full_name,cols))
- res++;
- tmpde=tmpde->next;
- }
- DirTreeDel(tmpde1);
- return res;
-}
-
-U0 SUFile(U8 *filename,I64 suf_flags,F64 indent_scale_factor)
-{//String utility on a single file
-//See SU Flags
- U8 *dst;
- Bool chged=FALSE;
- I64 reduced=0;
- CDoc *doc=DocRead(filename,DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR);
- CDocEntry *doc_e=doc->head.next;
- while (doc_e!=doc) {
- if (doc_e->type_u8==DOCT_TEXT) {
- dst=MStrUtil(doc_e->tag,suf_flags,indent_scale_factor);
- if (StrCmp(dst,doc_e->tag)) {
- reduced+=StrLen(doc_e->tag)-StrLen(dst);
- chged=TRUE;
- Free(doc_e->tag);
- doc_e->tag=dst;
- } else
- Free(dst);
- }
- doc_e=doc_e->next;
- }
- if (chged) {
- "Reduced %s by %d chars\n",filename,reduced;
- DocWrite(doc);
- }
- DocDel(doc);
-}
-public U0 SU(U8 *files_find_mask,I64 suf_flags,U8 *fu_flags=NULL,
- F64 indent_scale_factor=0)
-{//Apply StrUtil() on files.
-//You can convert spaces to tabs, for example,
- //or removing trailing spaces on lines.
- //See SUF Flags.
- I64 fuf_flags=0;
- CDirEntry *tmpde,*tmpde1;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+f+F+T");
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
- tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
- while (tmpde) {
- SUFile(tmpde->full_name,suf_flags,indent_scale_factor);
- tmpde=tmpde->next;
- }
- DirTreeDel(tmpde1);
-}
-
-public U0 S2T(U8 *files_find_mask,U8 *fu_flags=NULL)
-{//Spaces to tabs.
-//Use "Hard Space" (SHIFT-SPACE) for spaces
- //in string consts in your code.
- SU(files_find_mask,SUF_S2T|SUF_REM_TRAILING,fu_flags);
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Opt/Utils/TOS.HC.HTML b/public/src/Adam/Opt/Utils/TOS.HC.HTML deleted file mode 100644 index 823695c..0000000 --- a/public/src/Adam/Opt/Utils/TOS.HC.HTML +++ /dev/null @@ -1,88 +0,0 @@ - - - - - TOS.HC - - - - - #help_index "Misc/TOS"
-
-U0 TOSStaffIns()
-{//Completes TOS install from TOS_Staff.ISO
- SettingsPush; //See SettingsPush
- AutoComplete;
- WinBorder;
- WinMax;
- DocClear;
- "$PURPLE$$TX+CX,\"Complete TOS install from TOS_Staff.ISO\"$$FG$\n\n\n\n";
- InsRereg;
-
- "\nDownload TOS_Supplemental1.ISO.C\tfrom http://www.templeos.org\n"
- "Download TOS_Supplemental2.ISO.C\tfrom http://www.templeos.org\n"
- "Download TOS_Supplemental3.ISO.C\tfrom http://www.templeos.org\n";
-
- if (PressAKey!=CH_SHIFT_ESC) {
- if (HostChgDsk("/home/tad/Downloads/TOS_Supplemental1.ISO.C"))
- CopyTree("T:/","~/Sup1");
- if (HostChgDsk("/home/tad/Downloads/TOS_Supplemental2.ISO.C"))
- CopyTree("T:/","~/Sup2");
- if (HostChgDsk("/home/tad/Downloads/TOS_Supplemental3.ISO.C"))
- CopyTree("T:/","~/Sup3");
-
- Once("TOSBootHDIns;");
- "\nDo you wish to run >TOSRegen; to generate\n the "
- "distro ISO's ";
- if (YorN) {
- Once("TOSRegen;");
- BootRAM("C:/" KERNEL_BIN_C); //Boot so TOSRegen cmd is available.
- } else {
- "\nReboot ";
- if (YorN)
- Reboot;
- }
- }
- SettingsPop;
-}
-
-public U0 TOSStdIns()
-{//Completes TOS install from TOS_Distro.ISO
- SettingsPush; //See SettingsPush
- AutoComplete;
- WinBorder;
- WinMax;
- DocClear;
- "$PURPLE$$TX+CX,\"Complete TOS install from TOS_Distro.ISO\"$$FG$\n\n\n\n";
- InsRereg;
-
- "\nDownload TOS_Supplemental1.ISO.C\tfrom http://www.templeos.org\n"
- "Download TOS_Supplemental2.ISO.C\tfrom http://www.templeos.org\n"
- "Download TOS_Supplemental3.ISO.C\tfrom http://www.templeos.org\n";
-
- if (PressAKey!=CH_SHIFT_ESC) {
- if (FileFind("/Demo/AcctExample"))
- CopyTree("::/Demo/AcctExample","~");
- if (HostChgDsk("/home/tad/Downloads/TOS_Supplemental1.ISO.C"))
- CopyTree("T:/","~/Sup1");
- if (HostChgDsk("/home/tad/Downloads/TOS_Supplemental2.ISO.C"))
- CopyTree("T:/","~/Sup2");
- if (HostChgDsk("/home/tad/Downloads/TOS_Supplemental3.ISO.C"))
- CopyTree("T:/","~/Sup3");
-
- Once("TOSBootHDIns;");
- "\nDo you wish to run >TOSRegen; to generate\n the distro ISO's ";
- if (YorN) {
- Once("TOSRegen;");
- BootRAM("C:/" KERNEL_BIN_C); //Boot so TOSRegen cmd is available.
- } else {
- "\nReboot ";
- if (YorN)
- Reboot;
- }
- }
- SettingsPop;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Opt/Utils/ToDolDoc.HC.HTML b/public/src/Adam/Opt/Utils/ToDolDoc.HC.HTML deleted file mode 100644 index 2adcce5..0000000 --- a/public/src/Adam/Opt/Utils/ToDolDoc.HC.HTML +++ /dev/null @@ -1,31 +0,0 @@ - - - - - ToDolDoc.HC - - - - - #help_index "Cmd Line (Typically);DolDoc/Conversion;DolDoc/Cmd Line (Typically)"
-
-public U0 ToDolDoc(U8 *files_find_mask,U8 *fu_flags=NULL)
-{//Convert text file to DolDoc by making double $'s.
- CDoc *doc;
- I64 fuf_flags=0;
- CDirEntry *tmpde,*tmpde1;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F");
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
- tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
- while (tmpde) {
- "%s\n",tmpde->full_name;
- doc=DocRead(tmpde->full_name,DOCF_PLAIN_TEXT|DOCF_DBL_DOLLARS);
- DocWrite(doc);
- DocDel(doc);
- tmpde=tmpde->next;
- }
- DirTreeDel(tmpde1);
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Opt/Utils/ToTXT.HC.HTML b/public/src/Adam/Opt/Utils/ToTXT.HC.HTML deleted file mode 100644 index 979aacc..0000000 --- a/public/src/Adam/Opt/Utils/ToTXT.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - ToTXT.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Adam/TaskRep.HC.HTML b/public/src/Adam/TaskRep.HC.HTML deleted file mode 100644 index 93118d2..0000000 --- a/public/src/Adam/TaskRep.HC.HTML +++ /dev/null @@ -1,42 +0,0 @@ - - - - - TaskRep.HC - - - - - #help_index "Info;Task"
-U0 TaskRepTask(CTask *task,I64 indent)
-{
- CTask *task1;
- "%h*c$MA,T=\"%08X\",LM=\"Kill(0x%X);\n\",$ $BLACK$#%d$FG$ "
- "$TX,\"%$Q...\",SCX=16$\n",indent,CH_SPACE,task,task,task->task_num,
- task->task_title;
- "%h*c%08X%04X:%04X:%08X\n",indent+2,CH_SPACE,TaskMemAlloced(task),
- task->task_flags,task->display_flags,task->win_inhibit;
- task1=task->next_child_task;
- while (task1!=(&task->next_child_task)(U8 *)
- -offset(CTask.next_sibling_task)) {
- TaskRepTask(task1,indent+2);
- task1=task1->next_sibling_task;
- }
-}
-
-public U0 TaskRep()
-{//Report current tasks on all cores.
- I64 i;
- CCPU *c;
- PUSHFD
- CLI
- for (i=0;i<mp_cnt;i++) {
- c=&cpu_structs[i];
- "$PURPLE$CPU%02X$FG$\n",i;
- TaskRepTask(c->seth_task,2);
- }
- POPFD
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/TaskSettings.HC.HTML b/public/src/Adam/TaskSettings.HC.HTML deleted file mode 100644 index 018e2c2..0000000 --- a/public/src/Adam/TaskSettings.HC.HTML +++ /dev/null @@ -1,132 +0,0 @@ - - - - - TaskSettings.HC - - - - - #help_index "Task/Settings"
-
-public CTaskSettings *SettingsPush(CTask *task=NULL,I64 flags=0)
-{//Typically, called at start of an application.
-//It saves many settings so they can be restored
- //at the end of the application with SettingsPop().
-
- CTaskSettings *tmpse;
- CDoc *doc;
- if (!task) task=Fs;
- if (!TaskValidate(task)) return NULL;
- tmpse=CAlloc(sizeof(CTaskSettings),task);
- tmpse->cur_dir=DirCur(task,task);
- tmpse->draw_it=task->draw_it;
- GrPaletteGet(tmpse->palette);
- tmpse->task_end_cb=task->task_end_cb;
-
- if (!(flags&TSF_SAME_SONG)) {
- if (tmpse->song_task=task->song_task) {
- Suspend(task->song_task);
- Snd;
- }
- task->song_task=NULL;
- }
-
- if (tmpse->animate_task=task->animate_task)
- Suspend(task->animate_task);
- task->animate_task=NULL;
-
- if (doc=DocPut(task)) {
- tmpse->hide_cursor=!Bt(&doc->flags,DOCf_HIDE_CURSOR);
- tmpse->highlight_cursor=!Bt(&doc->flags,DOCf_DONT_HIGHLIGHT_CURSOR);
- tmpse->scroll=!Bt(&doc->flags,DOCf_NO_SCROLL_BARS);
- }
-
- tmpse->left=task->win_left;
- tmpse->right=task->win_right;
- tmpse->top=task->win_top;
- tmpse->bottom=task->win_bottom;
-
- tmpse->scroll_x=task->scroll_x;
- tmpse->scroll_y=task->scroll_y;
- tmpse->scroll_z=task->scroll_z;
-
- tmpse->win_inhibit=task->win_inhibit;
- tmpse->text_attr=task->text_attr;
- StrCpy(tmpse->task_title,task->task_title);
- tmpse->title_src =task->title_src;
- tmpse->border_attr=task->border_attr;
- tmpse->border_src =task->border_src;
- tmpse->border=!Bt(&task->display_flags,DISPLAYf_NO_BORDER);
- if (TaskValidate(ac.task))
- tmpse->autocomplete=TRUE;
- else
- tmpse->autocomplete=FALSE;
-
- tmpse->next=task->next_settings;
- task->next_settings=tmpse;
- return tmpse;
-}
-
-U0 SettingsPop2(CTask *task,CTaskSettings *tmpse)
-{
- CDoc *doc;
-
- if (doc=DocPut(task)) {
- LBEqu(&doc->flags,DOCf_HIDE_CURSOR,!tmpse->hide_cursor);
- LBEqu(&doc->flags,DOCf_DONT_HIGHLIGHT_CURSOR,!tmpse->highlight_cursor);
- LBEqu(&doc->flags,DOCf_NO_SCROLL_BARS,!tmpse->scroll);
- }
-
- WinBorder(tmpse->border,task);
- WinHorz(tmpse->left,tmpse->right,task);
- WinVert(tmpse->top,tmpse->bottom,task);
- task->scroll_x=tmpse->scroll_x;
- task->scroll_y=tmpse->scroll_y;
- task->scroll_z=tmpse->scroll_z;
- task->win_inhibit=tmpse->win_inhibit;
- task->text_attr=tmpse->text_attr;
- task->border_attr=tmpse->border_attr;
- task->border_src =tmpse->border_src;
- task->title_src =tmpse->title_src;
- StrCpy(task->task_title,tmpse->task_title);
- AutoComplete(tmpse->autocomplete);
- GrPaletteSet(tmpse->palette);
- Snd;
-}
-
-public U0 SettingsPop(CTask *task=NULL,I64 flags=0)
-{//Typically, called at end of an application.
- CTaskSettings *tmpse;
- if (!task) task=Fs;
- if (!TaskValidate(task))
- return;
- if (tmpse=task->next_settings) {
- task->next_settings=tmpse->next;
- Cd(tmpse->cur_dir);
- Free(tmpse->cur_dir);
- task->draw_it=tmpse->draw_it;
- task->task_end_cb=tmpse->task_end_cb;
-
- if (task->animate_task)
- Kill(task->animate_task);
- if (task->animate_task=tmpse->animate_task)
- Suspend(task->animate_task,FALSE);
-
- if (!(flags&TSF_SAME_SONG)) {
- if (task->song_task)
- Kill(task->song_task);
- if (task->song_task=tmpse->song_task)
- Suspend(task->song_task,FALSE);
- }
-
- SettingsPop2(task,tmpse); //Do it to get ress fast
- Refresh(,TRUE);
- SettingsPop2(task,tmpse); //Redo in case was lost by old update
-
- Free(tmpse);
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/Training.HC.HTML b/public/src/Adam/Training.HC.HTML deleted file mode 100644 index 0892e39..0000000 --- a/public/src/Adam/Training.HC.HTML +++ /dev/null @@ -1,196 +0,0 @@ - - - - - Training.HC - - - - - #help_index "Help System"
-
-U8 *KeyMapKeyMStrPrint(I64 sc,U0 (*fp_hndlr)(I64 sc),
- U8 *desc,CTask *task=NULL)
-{
- I64 i=9,k,c;
- U8 *st,*st2,*res,*ptr;
- CHashTable *old_hash=Fs->hash_table;
- st=ScanCode2KeyName(sc);
- if (sc&SCF_CTRL) i+=5;
- if (sc&SCF_ALT) i+=4;
- if (sc&(SCF_SHIFT|SCF_NO_SHIFT)) i+=6;
- if (TaskValidate(task))
- Fs->hash_table=task->hash_table;
- st2=SrcEdLink(fp_hndlr,256);
- Fs->hash_table=old_hash;
-
- k=*desc(U32 *);
- if (k=='Edit') c=BLUE;
- else if (k=='Dol') c=GREEN;
- else if (k=='Cmd') c=RED;
- else c=BLACK;
-
- res=MStrPrint("%-*s$FG,%d$$TX+UL+L+PU,\"%$Q\",A=\"%s\"$$FG$\n",
- i,st,c,desc,st2);
- Free(st);
- Free(st2);
-
- ptr=res;
- while (*ptr) {
- if (*ptr==CH_SPACE)
- *ptr=CH_SHIFT_SPACE;
- ptr++;
- }
-
- return res;
-}
-
-U0 KeyMapKeyPrint(I64 sc,U0 (*fp_hndlr)(I64 sc),U8 *desc,CTask *task=NULL)
-{
- U8 *st=KeyMapKeyMStrPrint(sc,fp_hndlr,desc,task);
- "%s",st;
- Free(st);
-}
-
-U0 KeyMapCtrlAltFamily(Bool no_shift,Bool shift)
-{
- I64 i,no_shift_f;
- if (no_shift && shift)
- no_shift_f=SCF_NO_SHIFT;
- else
- no_shift_f=0;
- if (no_shift) KeyMapKeyPrint(SC_DELETE+SCF_CTRL+SCF_ALT+no_shift_f,
- &Reboot,"Cmd/Reboot");
- if (no_shift) KeyMapKeyPrint(SC_ESC+SCF_CTRL+SCF_ALT+no_shift_f,
- &User,"Cmd/Terminal Window");
- if (no_shift) KeyMapKeyPrint(SC_TAB+SCF_CTRL+SCF_ALT+no_shift_f,
- &WinToTop,"Cmd/Next Focus Task");
-
- for (i=0;i<26;i++)
- if (keydev.fp_ctrl_alt_cbs[i]) {
- if (no_shift && keydev.ctrl_alt_no_shift_descs[i])
- KeyMapKeyPrint(Char2ScanCode(i+'a')+SCF_CTRL+SCF_ALT+no_shift_f,
- keydev.fp_ctrl_alt_cbs[i],keydev.ctrl_alt_no_shift_descs[i]);
- if (shift && keydev.ctrl_alt_shift_descs[i])
- KeyMapKeyPrint(Char2ScanCode(i+'a')+SCF_CTRL+SCF_ALT+SCF_SHIFT,
- keydev.fp_ctrl_alt_cbs[i],keydev.ctrl_alt_shift_descs[i]);
- }
-}
-
-U0 KMComparePrepare(U8 *buf,I64 *src)
-{
- I64 i,*dst=buf;
- U8 *ptr;
- if (src) {
- *dst++=*src++;
- *dst++=*src++;
- *dst++=*src++;
- *dst++=*src++;
- *dst(U8 *)=0;
- if (ptr=StrMatch("SHIFT",buf)) {
- for (i=0;i<5;i++)
- ptr[i]=CH_SHIFT_SPACE;
- if (ptr=StrMatch("$",buf))
- *ptr=255;
- }
- } else
- *buf=0;
-}
-
-I64 KMCompare(U8 *e1,U8 *e2)
-{
- U8 buf1[STR_LEN],buf2[STR_LEN];
- KMComparePrepare(buf1,e1);
- KMComparePrepare(buf2,e2);
- return StrCmp(buf1,buf2);
-}
-
-U0 KeyMapFamily2(U8 **entries,CTask *task,I64 scf)
-{
- I64 i,arg1,arg2;
- for (i=0;i<256;i++) {
- arg2=scf|i|SCF_KEY_DESC;
- arg1=ScanCode2Char(arg2);
- *keydev.desc=0;
- keydev.hndlr=NULL;
- if (TaskValidate(task) && !Bt(&task->win_inhibit,WIf_SELF_KEY_DESC)) {
- if (task==Fs)
- PutKey(arg1,arg2);
- else
- PostMsg(task,MSG_KEY_DOWN,arg1,arg2);
- Refresh(0,TRUE);
- Sleep(1); //Open loop because might be no response. TODO: Drops msgs.
- }
- if (*keydev.desc && StrNCmp(keydev.desc,"Char/",7))
- entries[i]=KeyMapKeyMStrPrint(arg2,keydev.hndlr,keydev.desc,task);
- }
-}
-
-U0 KeyMapFamily(CTask *task,I64 scf,Bool no_shift,Bool shift)
-{
- I64 i,cnt=0;
- U8 **entries=CAlloc(2*256*sizeof(U8 *)),**ptr=entries;
- if (no_shift) {
- if (shift)
- KeyMapFamily2(ptr,task,scf+SCF_NO_SHIFT);
- else
- KeyMapFamily2(ptr,task,scf);
- ptr+=256;
- cnt+=256;
- }
- if (shift) {
- KeyMapFamily2(ptr,task,scf+SCF_SHIFT);
- ptr+=256;
- cnt+=256;
- }
- QSortI64(entries,cnt,&KMCompare);
- for (i=0;i<cnt;i++)
- if (entries[i]) {
- "%s",entries[i];
- Free(entries[i]);
- }
- Free(entries);
-}
-
-public U0 KeyMap(CTask *task=NULL)
-{//Report desc of all keys.
- Bool old_key_desc;
- if (!task) task=Fs;
- old_key_desc=LBtr(&task->win_inhibit,WIf_SELF_KEY_DESC);
- DocMax;
- KeyMapFamily(task,0,TRUE,TRUE);
- KeyMapFamily(task,SCF_CTRL,TRUE,TRUE);
- KeyMapFamily(task,SCF_ALT,TRUE,TRUE);
- KeyMapCtrlAltFamily(TRUE,TRUE);
- LBEqu(&task->win_inhibit,WIf_SELF_KEY_DESC,old_key_desc);
- "\nKeyMap Completed.\n";
-}
-
-#help_index "Help System/Training"
-public U0 TipOfDay(U8 *tip_file="::/Doc/Tips.DD")
-{//Print random tip-of-day from ::/Doc/Tips.DD.
- I64 i=RandU16;
- CDoc *doc=DocRead(tip_file),*doc2=DocNew;
- CDocEntry *doc_e=doc->head.next;
- "$WW,1$\n";
- while (TRUE) {
- if (doc_e->type_u8==DOCT_TEXT && *doc_e->tag=='*')
- if (!i--) break;
- doc_e=doc_e->next;
- }
- if (doc_e->type_u8==DOCT_TEXT && *doc_e->tag=='*') {
- while (doc_e!=doc) {
- if (doc_e->type_u8!=DOCT_ERROR)
- DocInsEntry(doc2,DocEntryCopy(doc2,doc_e));
- doc_e=doc_e->next;
- if (doc_e->type_u8==DOCT_TEXT && *doc_e->tag=='*')
- break;
- }
- }
- DocInsDoc(DocPut,doc2);
- DocDel(doc2);
- DocDel(doc);
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/WallPaper.HC.HTML b/public/src/Adam/WallPaper.HC.HTML deleted file mode 100644 index b5a9d8bb53415a6c1eed4a6f87716d2ee8e55319..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6142 zcmd5ATTkQ4nWOfhIXY@z`cSD44BlmBz#$jtmLBj*OGp467E+QFwyPt{u_wffV_Tld zhMYb7-}`-Y@h!0Isrt}JvBxvteD~YT(ZLHN$$e}(mgZOkp(>F(I4f$*+ zMvum^za(DhGG-gcr}fs~Nbj`XBm(h^DGd`Rh-`#_=8orvo)h>Xb-ajMVu~%?1ixtd;a%V9Ute{)gTdAHz_}c~`}t5I z=&d5~X~Cl08Nei#g|or~_JLhyxbFF?_D=WQ6qp2>n=Xgo119B*w& zL)^1b67Udth>^{@MiOby;6#(McqrNjgVAh<;L4kQtPDoRS@q5jF z{nd-T*N0k&0?AR6WTeavQYPCDhu2n>C<&~OR%j2qw?pUp>Sj=HX^Lta?kY`Xh*1Vm zT;gZTXD*u#-Em0Cb{zW76h7@96UxFdZ~$u=bf-Te+g|nw=;(l_bB`0B>Dkc%*=AgS z2@wQ3P9M1Aa-Q197o+a0kRRfIf9K}xeAw0C!GxG>$s8XTb;ijS`K;W9kRj~vr$NNc z9U)s}Ttu4kYy!V$6(cm9 ziD@|Ehpyn9QHWIWTbHj6icpx9IRUi^>lerwyb<;q7*pdLm#@hUui ztG$YvE!nHM@c*H5RBcJ=>))bWM{BpBTon@EXm_KZ#&;=Y>=-K6kD%Dsw`Aq1qaabR zElZEu*=R2t?PrFb#3?ZYyLlL3FwaEVKMZzuih=9duiRO3=p}PVgqSSYhaf8hgkZ=o zf@pS^?s5@2rHZm)Kb5?pz!a$v@)Tep%RfOUhtPQll&JJOwDyG=YC~IVo**m}#@%ZHxXjfx1oCYAl*!5k$z!FU*cn&V zB2yEIqtQrG>bY|s#F5Uht4MUglCspG63O}ivTH|D)z>oC;kQ|D9q@!a_R{{3LPACb z@jIX{nhH%=%`K}s)!NDu>SH_Ft2_2|HzG(7XQmcAPWo@oFux%x!YNf<8-OBlYo?OBU!z6y!fMuokjv$wKAD)Lj);5uQ~ zH1G(RFGBtonmUG#=(1oMFubrgBQG|a2e+~j!2G9M0~qh$LRxHdd>-5uJpr{LJP8NT zm_mCmGz9%uRfcS$po0P%WlWRMy<-BC!0rbu3EibrnTEsx9r`pF2fSov5rnATXTue# z=Ajm01BO$%eZP>!6q*hql)h0-E(NO3dZ?`51~iDEN+>XGKH1zPofu954}1Uz0@i@y z^AF26tRT}%tJ&ObZky11*JTzI=ZJ~x@i>J5is6u9>TDxx!)pH2>7o9WbiLImFXj~{ z&-{6G>d5>?nI!|@XV3wiPDtl*D^5q^;fbXjz!XG)yYXGW{f6iKxkXG?50TEKC>?4#SWZe+)y07oOm*U zgKfd~fn9BG3qD@2uIZr8oeWtnw9qpB$j}aU1a7D!*zF6htGJ76tGM%=5Bo||XHI5p z?(u&^+_!x=3$%SP!g%+^W4+fO{D|JV4px8}$P4S>#CaC**{%<<8Bd%ArT3OG7&<3! z-w&Lto^#Xf{$yAHFpDF6DLDMnUJ0|)c%BNNKmal7S*j(NB+LpjML*$o&B`f923qFN z`gp9+6ubmHG4kMq4rd52PW@c%CBNR^ukXWYs(g~V?w(l2cHVLRkGi}-cw8&zq;huI z-`@$g+bi6t)PhDbtgohwOqWEQKa?`i)haSSN=Fr0f!;w+!qkT6nc$SjXpf>!o0#@_?(2lhj=dX*xURJTf~c9kT6vR;R<$ z5bhJCLwr{JW4buT%d*^01_>T9_e|I$>qJN=Tn!-rKw~e@k5_q7N-nSroLs=xP8fLi zIXjXK3#yIyAIEVB?erpAr-D45u4qLGrLkYqg;~Y}WXKFk`-3%eAMgp|r5G=D z&eV#r-&U@-kW*c#l)9usuvZY(9uuuhFQrm1p+tjWcZSy&J!f!sb))IYRlZE9SR6X1 z-OKLvd8fSYgAJX4%VR~+pk*+$jpLz)CFF|2CAeZ=nzsAEX~dcNs2MGhHl)hrQ0Oh2 zT`B;WT`H3|8URjabH>S-l3!>Vm$Zc}io#RSlqeoa@BrHL`Lu2do)==?@bX*N!tBsZmqOwwBlddn4hTv9zBo5XyN1RTj(_}~_n53}w-J1OU9bUhK|95}#)gu diff --git a/public/src/Adam/Win.HC.HTML b/public/src/Adam/Win.HC.HTML deleted file mode 100644 index 72a3929..0000000 --- a/public/src/Adam/Win.HC.HTML +++ /dev/null @@ -1,554 +0,0 @@ - - - - - Win.HC - - - - - #help_index "Windows"
-#help_file "::/Doc/Windows"
-
-CMsStateGlbls old_ms={{-1000,-1000,0},{-1000,-1000,0},{-1000,-1000,0},
- {0,0,0},{1.0,1.0,1.0},0.0,GetTSC,0.350,0,0,
- FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE
-};
-
-public CWinMgrGlbls winmgr={0,0,0,WINMGR_FPS,tS,tS,NULL,FALSE,FALSE,FALSE};
-winmgr.t=CAlloc(sizeof(CWinMgrTimingGlbls));
-winmgr.t->last_calc_idle_time=tS;
-
-U0 ProgressBarsRegTf(U8 *path=NULL)
-{
- F64 t,p1,p2,p3,p4;
- if (path) {
- t=tS;
- if (progress1_t0) p1=t-progress1_t0; else p1=0;
- if (progress2_t0) p2=t-progress2_t0; else p2=0;
- if (progress3_t0) p3=t-progress3_t0; else p3=0;
- if (progress4_t0) p4=t-progress4_t0; else p4=0;
- RegWrite(path,"progress1_tf=%0.3f;progress2_tf=%0.3f;\n"
- "progress3_tf=%0.3f;progress4_tf=%0.3f;\n",p1,p2,p3,p4);
- }
-}
-
-#define PROGRESS_BAR_HEIGHT 20
-#define PROGRESS_BAR_WIDTH (3*GR_WIDTH/4)
-U0 DrawProgressBars(CDC *dc)
-{
- I64 i,j,k,n,m;
- U8 *st,*st2;
- for (i=0;i<PROGRESS_BARS_NUM;i++) {
- if (m=sys_progresses[i].max) {
- dc->color=BLACK;
- GrRect(dc,
- (GR_WIDTH-PROGRESS_BAR_WIDTH)/2,
- (GR_HEIGHT-(PROGRESS_BARS_NUM*2-1-i*4)*PROGRESS_BAR_HEIGHT)/2,
- PROGRESS_BAR_WIDTH,PROGRESS_BAR_HEIGHT);
-
- dc->color=LTGREEN;
- n=sys_progresses[i].val;
- if (n>m)
- n=m;
- GrRect(dc,
- (GR_WIDTH-PROGRESS_BAR_WIDTH)/2+2,
- (GR_HEIGHT-(PROGRESS_BARS_NUM*2-1-i*4)*PROGRESS_BAR_HEIGHT)/2+2,
- n*(PROGRESS_BAR_WIDTH-4)/m,
- PROGRESS_BAR_HEIGHT-4);
-
- if (m>1) {
- dc->color=BLACK;
- k=m-1;
- if (k>19) k=19;
- for (j=0;j<=k;j++)
- GrLine(dc,
- (GR_WIDTH-PROGRESS_BAR_WIDTH)/2+1+j*
- (PROGRESS_BAR_WIDTH-4)/ToF64(k+1),
- (GR_HEIGHT-(PROGRESS_BARS_NUM*2-1-i*4)*
- PROGRESS_BAR_HEIGHT)/2+4,
- (GR_WIDTH-PROGRESS_BAR_WIDTH)/2+1+j*
- (PROGRESS_BAR_WIDTH-4)/ToF64(k+1),
- (GR_HEIGHT-(PROGRESS_BARS_NUM*2-3-i*4)*
- PROGRESS_BAR_HEIGHT)/2-4);
- }
-
- dc->color=GREEN;
- if (*sys_progresses[i].desc)
- st=StrNew(sys_progresses[i].desc);
- else
- st=MStrPrint("%d/%d",n,m);
- if (sys_progresses[i].t0) {
- st2=MStrPrint("%s%fs",st,tS-sys_progresses[i].t0);
- Free(st);
- } else
- st2=st;
- if (sys_progresses[i].tf) {
- st=MStrPrint("%s/%fs",st2,sys_progresses[i].tf);
- Free(st2);
- } else
- st=st2;
- GrPrint(dc,(GR_WIDTH-FONT_WIDTH*StrLen(st))/2,(GR_HEIGHT-FONT_HEIGHT-
- (PROGRESS_BARS_NUM*2-2-i*4)*PROGRESS_BAR_HEIGHT)/2,"%s",st);
- Free(st);
- }
- }
-}
-
-U0 DrawWinGrid(CDC *dc)
-{
- F64 d;
- dc->color=BLACK;
- dc->thick=1;
- for (d=ms_grid.x_offset;d<GR_WIDTH; d+=ms_grid.x)
- GrLine(dc,d,0,d,GR_HEIGHT-1);
- for (d=ms_grid.y_offset;d<GR_HEIGHT;d+=ms_grid.y)
- GrLine(dc,0,d,GR_WIDTH-1,d);
-}
-
-U0 WinGrid(Bool val)
-{
- CGridGlbls last_grid;
- MemCpy(&last_grid,&ms_grid,sizeof(CGridGlbls));
- if (!val || PopUpForm(&ms_grid)) {
- if (!val)
- GridInit;
- ms_hard.prescale.x*=last_grid.x_speed/ms_grid.x_speed;
- ms_hard.prescale.y*=last_grid.y_speed/ms_grid.y_speed;
- ms_hard.prescale.z*=last_grid.z_speed/ms_grid.z_speed;
- } else
- MemCpy(&ms_grid,&last_grid,sizeof(CGridGlbls));
-}
-U0 CtrlAltG(I64 sc)
-{
- if (sc&SCF_SHIFT)
- PopUp("WinGrid(OFF);");
- else
- PopUp("WinGrid(ON);");
-}
-CtrlAltCBSet('G',&CtrlAltG,"Cmd/Grid On",
- "Cmd/Grid Off");
-
-CTask *ext_ASCII_task;
-U0 ExtendedASCII()
-{
- I64 i;
- CDoc *doc=DocNew;
- DocPrint(doc,"Sel Char and Press <ESC>\n$LTBLUE$");
- for (i=0;i<256;i++) {
- if (i>=CH_SHIFT_SPACE && i!=0x7F) {
- if (i==CH_SHIFT_SPACE)
- DocPrint(doc,"$MU-UL,\"\\x1F\",LE=%d$",i);
- else if (i=='$')
- DocPrint(doc,"$MU-UL,\"\\x24\",LE=%d$",i);
- else if (i=='\"'||i=='\\')
- DocPrint(doc,"$MU-UL,\"\\%c\",LE=%d$",i,i);
- else
- DocPrint(doc,"$MU-UL,\"%c\",LE=%d$",i,i);
- } else
- DocPrint(doc,"");
- if (i&15==15)
- DocPrint(doc,"\n");
- }
- i=PopUpMenu(doc);
- DocDel(doc);
- if (i>=0)
- PostMsg(ext_ASCII_task,MSG_KEY_DOWN_UP,i,Char2ScanCode(i));
-}
-
-U0 CtrlAltA(I64)
-{
- if (ext_ASCII_task=sys_focus_task)
- Spawn(&ExtendedASCII);
-}
-CtrlAltCBSet('A',&CtrlAltA,"Cmd/Extended ASCII");
-
-public U0 WinScrollNull(CTask *task,CD3I64 *s)
-{//If panning a window has been done, restore to zero.
- s->x=task->scroll_x;
- s->y=task->scroll_y;
- s->z=task->scroll_z;
- task->scroll_x=0;
- task->scroll_y=0;
- task->scroll_z=0;
-}
-
-public U0 WinScrollRestore(CTask *task,CD3I64 *s)
-{//Set window pan value to stored value.
- task->scroll_x=s->x;
- task->scroll_y=s->y;
- task->scroll_z=s->z;
-}
-
-U0 DrawMs(CDC *dc)
-{
- I64 x,y;
- PUSHFD
- CLI
- x=ms.pos.x;
- y=ms.pos.y;
- POPFD
- if (ms.show && ms_hard.installed) {
- if (!Bt(&sys_run_level,RLf_VGA)) //if text mode
- gr.text_base[ms.pos_text.x+ms.pos_text.y*TEXT_COLS]^=0x7F00;
- else {
- if (gr.fp_draw_ms) {
- if (ms.lb)
- dc->color=ROP_XOR+LTPURPLE^TRANSPARENT;
- else if (ms.rb)
- dc->color=ROP_XOR+LTCYAN^TRANSPARENT;
- else
- dc->color=ROP_XOR+BLACK^TRANSPARENT;
- if (winmgr.grab_scroll && gr.fp_draw_grab_ms)
- (*gr.fp_draw_grab_ms)(dc,x,y,winmgr.grab_scroll_closed);
- else
- (*gr.fp_draw_ms)(dc,x,y);
- }
- }
- }
-}
-
-U0 WinFinalUpdate(CDC *dc)
-{
- if (ms_grid.show)
- DrawWinGrid(dc);
- if (ms_grid.coord)
- GrPrint(dc,GR_WIDTH-FONT_WIDTH*10,FONT_HEIGHT*3,
- "(%03d,%03d)",ms.pos.x,ms.pos.y);
- DrawProgressBars(dc);
- if (winmgr.show_menu)
- DrawMenu(dc);
- else
- sys_cur_submenu_entry=NULL;
- DrawMs(dc);
-}
-
-gr.fp_final_scrn_update=&WinFinalUpdate;
-
-U0 WinMsUpdate()
-{
- I64 dd;
- Bool set=FALSE;
- if (ms_hard.installed) {
- ms.has_wheel=ms_hard.has_wheel;
- if (ms_hard.evt) {
- MsUpdate(ms_hard.pos.x,ms_hard.pos.y,ms_hard.pos.z,
- ms_hard.bttns[0],ms_hard.bttns[1]);
- ms_hard.evt=FALSE;
- set=TRUE;
- }
- }
-
- if (set) {
- if (ms_hard.installed) {
- ms.speed=ms_hard.speed;
- ms.timestamp=ms_hard.timestamp;
- }
- } else
- ms.speed*=0.95;
- if (gr.scrn_zoom!=1) {
- if (gr.continuous_scroll)
- GrScaleZoom(1.0);
- else {
- dd=(ms.pos.x-gr.sx)*gr.scrn_zoom;
- if (!(8<=dd<GR_WIDTH-8))
- GrScaleZoom(1.0);
- else {
- dd=(ms.pos.y-gr.sy)*gr.scrn_zoom;
- if (!(8<=dd<GR_HEIGHT-8))
- GrScaleZoom(1.0);
- }
- }
- }
-}
-
-public CTask *WinRefocus(CTask *task=NULL)
-{//Reset the focus task if NULL.
- PUSHFD
- CLI
- if (!task) {
- task=sys_winmgr_task->last_task;
- while (TaskValidate(task) && task!=sys_winmgr_task) {
- if (!Bt(&task->win_inhibit,WIf_SELF_FOCUS)) {
- sys_focus_task=task;
- break;
- }
- task=task->last_task;
- }
- }
- POPFD
- return sys_focus_task;
-}
-
-I64 WinOnTopWindows()
-{
- CTask *task,*task1,*first_moved_fwd=NULL;
- I64 res=0;
- PUSHFD
- CLI //TODO Multiprocessor safe
- task=sys_winmgr_task->next_task;
- while (task!=sys_winmgr_task &&task!=first_moved_fwd) {
- task1=task->next_task;
- if (!TaskValidate(task)) {
- POPFD
- return res;
- }
- if (Bt(&task->display_flags,DISPLAYf_WIN_ON_TOP) &&
- task!=sys_winmgr_task->last_task) {
- TaskQueRem(task);
- TaskQueIns(task,sys_winmgr_task);
- res++;
- if (!first_moved_fwd)
- first_moved_fwd=task;
- }
- task=task1;
- }
- POPFD
- return res;
-}
-
-public I64 WinToTop(CTask *task=NULL,Bool update_z_buf=TRUE)
-{//Put task's win on top of window stack.
- CTask *task1;
- I64 res=0;
- if (!task) task=Fs;
- if (!TaskValidate(task) || task->gs->num)
- return 0;
- TaskDerivedValsUpdate(task,FALSE);
- if (!sys_winmgr_task || task==sys_winmgr_task)
- return 0;
- PUSHFD
- CLI
- if (!TaskValidate(task)) {
- POPFD
- return 0;
- }
- if (task!=sys_winmgr_task->last_task) {
- TaskQueRem(task);
- TaskQueIns(task,sys_winmgr_task);
- res++;
- }
- if (!Bt(&task->win_inhibit,WIf_SELF_FOCUS))
- sys_focus_task=task;
- if (res && !Bt(&task->display_flags,DISPLAYf_CHILDREN_NOT_ON_TOP)) {
- task1=task->next_child_task;
- while (task1!=&task->next_child_task) {
- if (!TaskValidate(task1))
- break;
- res+=WinToTop(task1,FALSE);
- task1=task1->next_sibling_task;
- }
- if (task->popup_task &&
- task->popup_task->parent_task==task)
- res+=WinToTop(task->popup_task,FALSE);
- }
- POPFD
- res+=WinOnTopWindows;
- if (res && update_z_buf)
- WinZBufUpdate;
- return res;
-}
-ext[EXT_WIN_TO_TOP]=&WinToTop;
-
-public CTask *WinFocus(CTask *task=NULL)
-{//Set task as focus task.
- if (!task) task=Fs;
- PUSHFD
- CLI
- if (!TaskValidate(task)||Bt(&task->win_inhibit,WIf_SELF_FOCUS))
- task=WinRefocus(sys_focus_task);
- WinToTop(sys_focus_task=task);
- POPFD
- return sys_focus_task;
-}
-ext[EXT_WIN_FOCUS]=&WinFocus;
-
-public Bool WinHorz(I64 left,I64 right,CTask *task=NULL)
-{//Set task's win left and right columns.
- I64 d=right-left;
- if (!task) task=Fs;
- if (!TaskValidate(task)) return FALSE;
- if (d<0) d=0;
- if (left>=TEXT_COLS) {
- left=TEXT_COLS-1;
- right=left+d;
- }
- if (right<0) {
- right=0;
- left=right-d;
- }
- if (left>right) {
- if (left>0)
- right=left;
- else
- left=right;
- }
- PUSHFD
- CLI //TODO Multiprocessor safe
- if (task->win_left!=left || task->win_right!=right) {
- task->win_left=left;
- task->win_right=right;
- TaskDerivedValsUpdate(task);
- POPFD
- return TRUE;
- } else {
- POPFD
- return FALSE;
- }
-}
-
-public Bool WinVert(I64 top,I64 bottom,CTask *task=NULL)
-{//Set task's win top and bottom rows.
- I64 d=bottom-top;
- if (!task) task=Fs;
- if (!TaskValidate(task)) return FALSE;
- if (d<0) d=0;
- if (top>=TEXT_ROWS) {
- top=TEXT_ROWS-1;
- bottom=top+d;
- }
- if (bottom<=0) {
- bottom=1;
- top=bottom-d;
- }
- if (top>bottom) {
- if (top>=0)
- bottom=top;
- else
- top=bottom;
- }
- PUSHFD
- CLI //TODO Multiprocessor safe
- if (task->win_top!=top || task->win_bottom!=bottom) {
- task->win_top=top;
- task->win_bottom=bottom;
- TaskDerivedValsUpdate(task);
- POPFD
- return TRUE;
- } else {
- POPFD
- return FALSE;
- }
-}
-
-public U0 WinTileHorz()
-{//Tile windows horizontally top-to-bottom.
- CTask *task,*last_task=Fs;
- I64 cnt,c,i,vert_size,no_border;
-
- PUSHFD
- CLI //TODO Multiprocessor safe
- task=sys_winmgr_task;
- cnt=0;
- do {
- if (!Bt(&task->win_inhibit,WIf_SELF_FOCUS))
- cnt++;
- task=task->last_task;
- } while (task!=sys_winmgr_task);
-
- task=sys_winmgr_task;
- i=0;
- do {
- if (!Bt(&task->win_inhibit,WIf_SELF_FOCUS)) {
- no_border=Bt(&task->display_flags,DISPLAYf_NO_BORDER);
- c=cnt- i&~3;
- if (!c)
- c=1;
- else if (c>4)
- c=4;
- vert_size=(TEXT_ROWS-1)/c;
-
- WinHorz(1-no_border,TEXT_COLS-2+no_border,task);
- WinVert((i&3)*vert_size+2-no_border,(i&3+1)*vert_size+no_border,task);
- last_task=task;
- if (i&3==3)
- WinVert(task->win_top,TEXT_ROWS-2,task);
- i++;
- }
- task=task->last_task;
- } while (task!=sys_winmgr_task);
- WinVert(last_task->win_top,TEXT_ROWS-2,last_task);
- POPFD
-}
-
-public U0 WinTileVert()
-{//Tile windows vertically side-by-side.
- CTask *task,*last_task=Fs;
- I64 cnt,c,i,horz_size,no_border;
- PUSHFD
- CLI //TODO Multiprocessor safe
- task=sys_winmgr_task;
- cnt=0;
- do {
- if (!Bt(&task->win_inhibit,WIf_SELF_FOCUS))
- cnt++;
- task=task->last_task;
- } while (task!=sys_winmgr_task);
-
- task=sys_winmgr_task;
- i=0;
- do {
- if (!Bt(&task->win_inhibit,WIf_SELF_FOCUS)) {
- no_border=Bt(&task->display_flags,DISPLAYf_NO_BORDER);
- c=cnt- i&~3;
- if (!c)
- c=1;
- else if (c>4)
- c=4;
- horz_size=TEXT_COLS/c;
- WinHorz((i&3)*horz_size+1-no_border,(i&3+1)*horz_size-1+no_border,task);
- WinVert(2-no_border,TEXT_ROWS-2+no_border,task);
- last_task=task;
- if (i&3==3)
- WinHorz(task->win_left,TEXT_COLS-2,task);
- i++;
- }
- task=task->last_task;
- } while (task!=sys_winmgr_task);
- WinHorz(last_task->win_left,TEXT_COLS-2,last_task);
- POPFD
-}
-
-public U0 WinMax(CTask *task=NULL)
-{//Maximize task's window
- I64 no_border;
- if (!task) task=Fs;
- if (!TaskValidate(task)) return;
- PUSHFD
- CLI //TODO Multiprocessor safe
- no_border=Bt(&task->display_flags,DISPLAYf_NO_BORDER);
- WinHorz(1-no_border,TEXT_COLS-2+no_border,task);
- WinVert(2-no_border,TEXT_ROWS-2+no_border,task);
- WinToTop(task);
- POPFD
-}
-
-public Bool WinBorder(Bool val=OFF,CTask *task=NULL)
-{//Turn off (or on) window border.
- Bool old_has_border;
- if (!task) task=Fs;
- if (!TaskValidate(task)) return FALSE;
- PUSHFD
- CLI //TODO Multiprocessor safe
- old_has_border=!Bt(&task->display_flags,DISPLAYf_NO_BORDER);
- if (val) {
- if (!old_has_border) {
- LBtr(&task->display_flags,DISPLAYf_NO_BORDER);
- task->win_left++; task->win_right--;
- task->win_top++; task->win_bottom--;
- TaskDerivedValsUpdate(task,FALSE);
- }
- } else {
- if (old_has_border) {
- LBts(&task->display_flags,DISPLAYf_NO_BORDER);
- task->win_left--; task->win_right++;
- task->win_top--; task->win_bottom++;
- TaskDerivedValsUpdate(task,FALSE);
- }
- }
- POPFD
- return old_has_border;
-}
- - - \ No newline at end of file diff --git a/public/src/Adam/WinMgr.HC.HTML b/public/src/Adam/WinMgr.HC.HTML deleted file mode 100644 index d6f7f3f..0000000 --- a/public/src/Adam/WinMgr.HC.HTML +++ /dev/null @@ -1,875 +0,0 @@ - - - - - WinMgr.HC - - - - - #help_index "Windows;Task/Delay"
-
-public U0 Refresh(I64 cnt=1,Bool force=FALSE)
-{//Wait for 30fps WinMgr to start & finish scrn refresh.
- //0,FALSE Cnt Sync to WinMgr.
- //0,TRUE Pump Msgs.
- //1 Cnt Wait and Pump Msgs.
- //2 Cnt Make Sure to do a Full Refresh
- //and Set Cur Pos.
- Bool old_full_refresh,
- old_idle=LBts(&Fs->task_flags,TASKf_IDLE);
- CDoc *old_doc=DocPut;
- I64 update_cnt;
- if (!cnt&&force)
- LBts(&sys_semas[SEMA_JUST_PUMP_MSGS],0);
- while (Bt(&sys_semas[SEMA_REFRESH_IN_PROGRESS],0)) {
- if (force && sys_winmgr_task)
- sys_winmgr_task->wake_jiffy=cnts.jiffies;
- Yield;
- }
- if (cnt>1 && old_doc)
- old_full_refresh=LBts(&old_doc->flags,DOCf_DO_FULL_REFRESH);
- update_cnt=winmgr.updates+cnt;
- while (winmgr.updates<update_cnt) {
- if (force && sys_winmgr_task)
- sys_winmgr_task->wake_jiffy=cnts.jiffies;
- Sleep(1);
- }
- if (old_doc)
- LBEqu(&old_doc->flags,DOCf_DO_FULL_REFRESH,old_full_refresh);
- LBEqu(&Fs->task_flags,TASKf_IDLE,old_idle);
-}
-
-#help_index "Windows"
-
-I64 WinQueIPMsgs(Bool que)
-{
- static CD3I64 single_ms={0,0,0};
- F64 time=tS;
- I64 msg_code=0,arg1,arg2,single_arg1,single_arg2;
- CTask *task_focus=sys_focus_task;
-
- if (task_focus && !winmgr.grab_scroll) {
- arg1=ms.pos.x-task_focus->pix_left-task_focus->scroll_x;
- arg2=ms.pos.y-task_focus->pix_top-task_focus->scroll_y;
- single_arg1=single_ms.x-task_focus->pix_left-task_focus->scroll_x;
- single_arg2=single_ms.y-task_focus->pix_top-task_focus->scroll_y;
- if (old_ms.presnap.x!=ms.presnap.x || old_ms.presnap.y!=ms.presnap.y) {
- if (que)
- TaskMsg(task_focus,0,
- MSG_MS_MOVE,arg1,arg2,0);
- msg_code=MSG_MS_MOVE;
- }
-//TODO que msg for ms.pos.z?
- if (ms.left_dbl_time) {
- if (time>ms.left_dbl_time) {
- if (ms.left_dbl) {
- if (!ms.left_down_sent) {
- if (que)
- TaskMsg(task_focus,0,
- MSG_MS_L_D_DOWN,arg1,arg2,0);
- ms.left_down_sent=TRUE;
- msg_code=MSG_MS_L_D_DOWN;
- }
- if (!ms.lb) {
- if (que)
- TaskMsg(task_focus,0,
- MSG_MS_L_D_UP,arg1,arg2,0);
- ms.left_dbl_time=0;
- msg_code=MSG_MS_L_D_UP;
- }
- } else {
- if (!ms.left_down_sent) {
- if (que)
- TaskMsg(task_focus,0,
- MSG_MS_L_DOWN,single_arg1,single_arg2,0);
- ms.left_down_sent=TRUE;
- msg_code=MSG_MS_L_DOWN;
- }
- if (!ms.lb) {
- if (que)
- TaskMsg(task_focus,0,
- MSG_MS_L_UP,arg1,arg2,0);
- ms.left_dbl_time=0;
- msg_code=MSG_MS_L_UP;
- }
- }
- } else {
- if (ms.lb && !ms_last.lb) {
- ms.left_dbl_time=time;
- ms.left_dbl=TRUE;
- }
- }
- } else {
- if (TaskValidate(task_focus) &&
- Bt(&task_focus->win_inhibit,WIf_FOCUS_TASK_MS_L_D)) {
- if (ms.lb && !ms_last.lb) {
- if (que)
- TaskMsg(task_focus,0,
- MSG_MS_L_DOWN,arg1,arg2,0);
- msg_code=MSG_MS_L_DOWN;
- } else if (!ms.lb && ms_last.lb) {
- if (que)
- TaskMsg(task_focus,0,
- MSG_MS_L_UP,arg1,arg2,0);
- msg_code=MSG_MS_L_UP;
- }
- } else {
- if (ms.lb && !ms_last.lb) {
- ms.left_dbl=FALSE;
- ms.left_down_sent=FALSE;
- ms.left_dbl_time=time+ms.dbl_time;
- single_ms.x=ms.pos.x;
- single_ms.y=ms.pos.y;
- }
- }
- }
-
- if (ms.right_dbl_time) {
- if (time>ms.right_dbl_time) {
- if (ms.right_dbl) {
- if (!ms.right_down_sent) {
- if (que)
- TaskMsg(task_focus,0,
- MSG_MS_R_D_DOWN,arg1,arg2,0);
- ms.right_down_sent=TRUE;
- msg_code=MSG_MS_R_D_DOWN;
- }
- if (!ms.rb) {
- if (que)
- TaskMsg(task_focus,0,
- MSG_MS_R_D_UP,arg1,arg2,0);
- ms.right_dbl_time=0;
- msg_code=MSG_MS_R_D_UP;
- }
- } else {
- if (!ms.right_down_sent) {
- if (que)
- TaskMsg(task_focus,0,
- MSG_MS_R_DOWN,single_arg1,single_arg2,0);
- ms.right_down_sent=TRUE;
- msg_code=MSG_MS_R_DOWN;
- }
- if (!ms.rb) {
- if (que)
- TaskMsg(task_focus,0,
- MSG_MS_R_UP,arg1,arg2,0);
- ms.right_dbl_time=0;
- msg_code=MSG_MS_R_UP;
- }
- }
- } else {
- if (ms.rb && !ms_last.rb) {
- ms.right_dbl_time=time;
- ms.right_dbl=TRUE;
- }
- }
- } else {
- if (TaskValidate(task_focus) &&
- Bt(&task_focus->win_inhibit,WIf_FOCUS_TASK_MS_R_D)) {
- if (ms.rb && !ms_last.rb) {
- if (que)
- TaskMsg(task_focus,0,
- MSG_MS_R_DOWN,arg1,arg2,0);
- msg_code=MSG_MS_R_DOWN;
- } else if (!ms.rb && ms_last.rb) {
- if (que)
- TaskMsg(task_focus,0,
- MSG_MS_R_UP,arg1,arg2,0);
- msg_code=MSG_MS_R_UP;
- }
- } else {
- if (ms.rb && !ms_last.rb) {
- ms.right_dbl=FALSE;
- ms.right_down_sent=FALSE;
- ms.right_dbl_time=time+ms.dbl_time;
- single_ms.x=ms.pos.x;
- single_ms.y=ms.pos.y;
- }
- }
- }
-
- MemCpy(&ms_last,&ms,sizeof(CMsStateGlbls));
- MemCpy(&old_ms,&ms,sizeof(CMsStateGlbls));
- }
- return msg_code;
-}
-
-U0 WinCalcIdles()
-{
- F64 calc_idle_time;
- I64 i,k,total_jiffies,total_jiffies_delta,idle_pt_hits[MP_PROCESSORS_NUM];
- CCPU *c;
- CWinMgrTimingGlbls *t=winmgr.t;
-
- if ((t->calc_idle_delta_time=
- (calc_idle_time=tS)-t->last_calc_idle_time)>.25) {
- PUSHFD
- CLI
- total_jiffies=cpu_structs[0].total_jiffies;
- for (i=0;i<mp_cnt;i++)
- idle_pt_hits[i]=cpu_structs[i].idle_pt_hits;
- POPFD
-
- total_jiffies_delta=total_jiffies-t->last_total_jiffies;
- for (i=0;i<mp_cnt;i++) {
- c=&cpu_structs[i];
- if (total_jiffies_delta && (k=idle_pt_hits[i]-t->last_idle_pt_hits[i])>=0)
- c->idle_factor=Clamp(ToF64(k)/total_jiffies_delta,0.01,0.99);
- else
- c->idle_factor=0.01;
- t->last_idle_pt_hits[i]=idle_pt_hits[i];
- }
- t->last_total_jiffies=total_jiffies;
- t->last_calc_idle_time=calc_idle_time;
- t->calc_idle_cnt++;
- }
-}
-
-I64 WinMgrSleep(Bool flush_msgs=FALSE)
-{
- I64 timeout_val,msg_code=0;
- CCtrl *c;
- Bool que;
- F64 t,t_delta;
- U8 *st;
- CDC *diff;
- CDate cdt;
-
- TimeCal;
- if ((t_delta=(t=tS)-winmgr.last_refresh_tS)>0.01)
- winmgr.fps=Max(1.0/t_delta,1);
- else
- winmgr.fps=99;
- winmgr.last_refresh_tS=t;
- WinCalcIdles;
-
- if (flush_msgs)
- FifoI64Flush(kbd.scan_code_fifo);
- else if (TaskValidate(sys_focus_task)) {
- KbdMsgsQue;
-
- que=TRUE;
- if (TaskValidate(sys_focus_task) &&
- !Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_CTRLS)) {
- c=sys_focus_task->next_ctrl;
- while (c!=&sys_focus_task->next_ctrl) {
- if (CtrlInside(c,ms.pos.x,ms.pos.y)) {
- que=FALSE;
- break;
- }
- c=c->next;
- }
- }
- msg_code=WinQueIPMsgs(que);
- } else {
- WinRefocus(sys_focus_task);
- if (!TaskValidate(sys_focus_task))
- FifoI64Flush(kbd.scan_code_fifo);
- }
- if (sys_focus_task)
- LBtr(&sys_focus_task->task_flags,TASKf_HAS_SONG);
- WinMsUpdate;
-
- if (!LBtr(&sys_semas[SEMA_JUST_PUMP_MSGS],0)) {
- t=tS+WINMGR_PERIOD/8;
- while (winmgr.ideal_refresh_tS<t)
- winmgr.ideal_refresh_tS+=WINMGR_PERIOD;
- timeout_val=cnts.jiffies+(winmgr.ideal_refresh_tS-tS)*JIFFY_FREQ;
- LBts(&sys_semas[SEMA_REFRESH_IN_PROGRESS],0);
- GrUpdateScrn;
- LBtr(&sys_semas[SEMA_REFRESH_IN_PROGRESS],0);
- if (scrncast.record && !scrncast.just_audio) {
- cdt=scrncast.t0_now(I64)+ToI64(CDATE_FREQ*(tS-scrncast.t0_tS));
- if (!scrncast.dc) {
- scrncast.dc=DCCopy(scrncast.dc2_alias);
- scrncast.dc->cdt=cdt;
- st=MStrPrint(scrncast.print_fmt,cdt);
- GRWrite(st,scrncast.dc);
- Free(st);
- } else if (MemCmp(scrncast.dc->body,
- scrncast.dc2_alias->body,MSize(scrncast.dc2_alias->body))) {
- diff=DCDiff(scrncast.dc,scrncast.dc2_alias);
- diff->cdt=cdt;
- st=MStrPrint(scrncast.print_fmt,cdt);
- GRWrite(st,diff);
- Free(st);
- DCDel(diff);
- Free(scrncast.dc->body);
- scrncast.dc->body=MAllocIdent(scrncast.dc2_alias->body);
- }
- } else if (scrncast.dc) {
- DCDel(scrncast.dc); //TODO: MemRep can crash.
- scrncast.dc=NULL;
- }
- if (sys_focus_task && !Bt(&sys_focus_task->task_flags,TASKf_HAS_SONG)) {
- Free(music.cur_song);
- music.cur_song=NULL;
- }
- if (music.cur_song) {
- if (!music.cur_song_task)
- music.cur_song_task=Spawn(&CurSongTask,NULL,"Song");
- } else if (music.cur_song_task) {
- Kill(music.cur_song_task);
- music.cur_song_task=NULL;
- }
- winmgr.updates++;
- if (ms_hard.install_attempts) //Don't call before boot mouse install attempt
- KbdMsHndlr(FALSE,TRUE);
- SleepUntil(timeout_val);
- }
- return msg_code;
-}
-
-CDoc *WinCursorPosSet(CTask *task,I64 msx,I64 msy,Bool set_cursor=TRUE)
-{
- CDoc *res=NULL;
- Bool unlock;
- I64 x0,y0;
- if (!task) task=Fs;
- if (WinInside(msx,msy,task)) {
- if ((res=DocDisplay(task)) && res->flags&DOCF_DONT_SHOW)
- res=NULL;
- else if (set_cursor) {
- unlock=DocLock(res);
- if (res->doc_signature!=DOC_SIGNATURE_VAL)
- res=NULL;
- else {
- x0=res->line_start_col;
- y0=res->top_line_num;
- DocRecalc(res,RECALCF_HAS_CURSOR);
- res->x=(msx-task->pix_left-task->scroll_x)/FONT_WIDTH +x0;
- res->y=(msy-task->pix_top -task->scroll_y)/FONT_HEIGHT+y0;
- DocRecalc(res,RECALCt_FIND_CURSOR);
- task->scroll_x=0;
- task->scroll_y=0;
- task->scroll_z=0;
- if (unlock)
- DocUnlock(res);
- }
- }
- WinToTop(task);
- }
- return res;
-}
-
-Bool WinKeyNavMenu()
-{
- I64 i,old_key_cnt;
- CD3I64 old_pos,new_pos;
- CMenu *m;
- CMenuEntry *tmpme;
- CTask *focus=MenuTask;
- if (Bt(kbd.down_bitmap,SC_GUI) && focus && (m=focus->cur_menu)) {
- winmgr.show_menu=TRUE;
- sys_cur_submenu_entry=NULL;
- old_pos.x=ms.pos.x; old_pos.y=ms.pos.y;
- ms.pos.x=new_pos.x=ms.pos.y=new_pos.y=0;
- while (Bt(kbd.down_bitmap,SC_GUI)) {
- old_key_cnt=kbd.cnt;
- if (Bt(kbd.down_bitmap,SC_CURSOR_LEFT)) {
- while (Bt(kbd.down_bitmap,SC_CURSOR_LEFT) && kbd.cnt==old_key_cnt)
- WinMgrSleep(TRUE);
- if (new_pos.x) {
- i=0;
- tmpme=m->sub;
- while (tmpme) {
- if (i+MenuEntryWidth(tmpme)*FONT_WIDTH==new_pos.x) {
- new_pos.x=i;
- break;
- }
- i+=MenuEntryWidth(tmpme)*FONT_WIDTH;
- tmpme=tmpme->next;
- }
- }
- new_pos.y=0;
- } else if (Bt(kbd.down_bitmap,SC_CURSOR_RIGHT)) {
- while (Bt(kbd.down_bitmap,SC_CURSOR_RIGHT) && kbd.cnt==old_key_cnt)
- WinMgrSleep(TRUE);
- i=0;
- tmpme=m->sub;
- while (tmpme) {
- if (i==new_pos.x) {
- if (tmpme->next)
- new_pos.x=i+MenuEntryWidth(tmpme)*FONT_WIDTH;
- break;
- }
- i+=MenuEntryWidth(tmpme)*FONT_WIDTH;
- tmpme=tmpme->next;
- }
- new_pos.y=0;
- } else if (Bt(kbd.down_bitmap,SC_CURSOR_UP)) {
- while (Bt(kbd.down_bitmap,SC_CURSOR_UP) && kbd.cnt==old_key_cnt)
- WinMgrSleep(TRUE);
- new_pos.y-=FONT_HEIGHT;
- } else if (Bt(kbd.down_bitmap,SC_CURSOR_DOWN)) {
- while (Bt(kbd.down_bitmap,SC_CURSOR_DOWN) && kbd.cnt==old_key_cnt)
- WinMgrSleep(TRUE);
- new_pos.y+=FONT_HEIGHT;
- }
- new_pos.x=ClampI64(new_pos.x,0,GR_WIDTH-1);
- new_pos.y=ClampI64(new_pos.y,0,GR_HEIGHT-1);
- ms.pos.x=new_pos.x; ms.pos.y=new_pos.y;
- WinMgrSleep(TRUE);
- if (!sys_cur_submenu_entry)
- ms.pos.y=new_pos.y=0;
- }
- if (sys_cur_submenu_entry)
- TaskMsg(sys_focus_task,0,sys_cur_submenu_entry->msg_code,
- sys_cur_submenu_entry->arg1,sys_cur_submenu_entry->arg2,0);
- winmgr.show_menu=FALSE;
- ms.pos.x=old_pos.x; ms.pos.y=old_pos.y;
- return TRUE;
- }
- return FALSE;
-}
-
-U0 WinMgrTask(I64)
-{
- CTask *task=Fs;
- CDoc *doc;
- CDocEntry *doc_e;
- I64 x,y,z,msg_code,
- my_ms_z=0,left,top,
- old_flags=GetRFlags;
- Bool has_border;
- CCtrl *c;
- WinHorz(0,TEXT_COLS-1);
- WinVert(0,TEXT_ROWS-1);
- LBts(&Fs->display_flags,DISPLAYf_NO_BORDER);
- LBts(&Fs->display_flags,DISPLAYf_SHOW);
- gr.dc->win_task=Fs;
- Fs->win_inhibit&=~WIF_SELF_CTRLS;
- GrSetUpTables;
- scrncast.dc2_alias=DCAlias(gr.dc2);
- WinZBufUpdate;
- LBts(&sys_run_level,RLf_WINMGR);
- while (TRUE) {
- try {
-wmt_start:
- if (Bt(&sys_run_level,RLf_ADAM_SERVER))
- TaskKillDying;
- WinMgrSleep;
-
- task=Fs->last_task;
- while (TRUE) {
- CLI
- if (!TaskValidate(task)) {
- SetRFlags(old_flags);
- goto wmt_start;
- }
- TaskDerivedValsUpdate(task,FALSE);
- task=task->last_task;
- SetRFlags(old_flags);
- if (task==Fs)
- break;
- }
- TaskDerivedValsUpdate(Fs,FALSE);
-
- task=Fs->last_task;
- while (TRUE) {
- CLI
- if (!TaskValidate(task)) {
- SetRFlags(old_flags);
- goto wmt_start;
- }
- if (WinInside(ms.pos.x,ms.pos.y,task,FONT_WIDTH)) {
- SetRFlags(old_flags);
- break;
- }
- if (task==Fs) { //Shouldn't happen
- SetRFlags(old_flags);
- goto wmt_start;
- }
- task=task->last_task;
- SetRFlags(old_flags);
- }
-
- if (Bt(&task->display_flags,DISPLAYf_NO_BORDER))
- has_border=FALSE;
- else
- has_border=TRUE;
-
- winmgr.show_menu=FALSE;
- sys_cur_submenu_entry=NULL;
- if (TaskValidate(sys_focus_task) &&
- !Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_MENU)) {
- if (WinKeyNavMenu)
- goto wmt_start;
- if (task==Fs && 0<=ms.pos.y<FONT_HEIGHT && ms_hard.installed) {
- winmgr.show_menu=TRUE;
- if (ms.lb && !old_ms.lb) {
- winmgr.show_menu=TRUE;
- while (ms.lb)
- WinMgrSleep(TRUE);
- if (sys_cur_submenu_entry)
- TaskMsg(sys_focus_task,0,
- sys_cur_submenu_entry->msg_code,
- sys_cur_submenu_entry->arg1,
- sys_cur_submenu_entry->arg2,0);
- winmgr.show_menu=FALSE;
- old_ms.lb=FALSE;
- goto wmt_start;
- }
- }
- }
-
- //grab scroll
- if (!Bt(&task->win_inhibit,WIf_SELF_GRAB_SCROLL) &&
- (!TaskValidate(sys_focus_task)||
- !Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_GRAB_SCROLL)) &&
- kbd.scan_code&SCF_CTRL && TaskValidate(task)) {
- winmgr.grab_scroll_closed=FALSE;
- winmgr.grab_scroll=TRUE;
- while (kbd.scan_code&SCF_CTRL && TaskValidate(task) && (!ac.task ||
- !WinInside(ms.pos.x,ms.pos.y,ac.task,FONT_WIDTH))) {
- if (ms.lb) {
- winmgr.grab_scroll_closed=TRUE;
- x=ms.pos.x-task->scroll_x;
- y=ms.pos.y-task->scroll_y;
- z=ms.pos.z-task->scroll_z;
- while (ms.lb && kbd.scan_code&SCF_CTRL && TaskValidate(task)) {
- task->scroll_x=(ms.pos.x-x)&~7;
- task->scroll_y=(ms.pos.y-y)&~7;
- task->scroll_z=ms.pos.z-z;
- WinMgrSleep(TRUE);
- }
- winmgr.grab_scroll_closed=FALSE;
- } else if (ms.rb) {
- task->scroll_x=0;
- task->scroll_y=0;
- task->scroll_z=0;
- WinMgrSleep(TRUE);
- } else
- WinMgrSleep;
- }
- winmgr.grab_scroll=FALSE;
- goto wmt_start;
- } else
- winmgr.grab_scroll=FALSE;
-
- if (!Bt(&task->win_inhibit,WIf_SELF_CTRLS) &&
- (!TaskValidate(sys_focus_task)||
- !Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_CTRLS))) {
- if (ms.lb && !old_ms.lb) {
- c=task->next_ctrl;
- while (c!=&task->next_ctrl) {
- if (CtrlInside(c,ms.pos.x,ms.pos.y)) {
- left=task->pix_left;
- top =task->pix_top;
- if (c->flags&CTRLF_BORDER) {
- left-=FONT_WIDTH;
- top -=FONT_HEIGHT;
- }
- if (c->flags&CTRLF_CAPTURE_LEFT_MS) {
- while (ms.lb && TaskValidate(task)) {
- if (c->left_click)
- (*c->left_click)(c,ms.pos.x-left,ms.pos.y-top,TRUE);
- WinMgrSleep;
- }
- if (c->left_click)
- (*c->left_click)(c,ms.pos.x-left,ms.pos.y-top,FALSE);
- old_ms.lb=FALSE;
- goto wmt_start;
- } else {
- if (c->left_click)
- (*c->left_click)(c,ms.pos.x-left,ms.pos.y-top,TRUE);
- old_ms.lb=TRUE;
- goto wmt_start;
- }
- }
- c=c->next;
- }
- }
- if (old_ms.lb && !ms.lb) {
- c=task->next_ctrl;
- while (c!=&task->next_ctrl) {
- if (CtrlInside(c,ms.pos.x,ms.pos.y)) {
- left=task->pix_left;
- top =task->pix_top;
- if (c->flags&CTRLF_BORDER) {
- left-=FONT_WIDTH;
- top -=FONT_HEIGHT;
- }
- if (c->left_click)
- (*c->left_click)(c,ms.pos.x-left,ms.pos.y-top,FALSE);
- old_ms.lb=FALSE;
- goto wmt_start;
- }
- c=c->next;
- }
- }
- if (ms.rb && !old_ms.rb) {
- c=task->next_ctrl;
- while (c!=&task->next_ctrl) {
- if (CtrlInside(c,ms.pos.x,ms.pos.y)) {
- left=task->pix_left;
- top =task->pix_top;
- if (c->flags&CTRLF_BORDER) {
- left-=FONT_WIDTH;
- top -=FONT_HEIGHT;
- }
- if (c->flags&CTRLF_CAPTURE_RIGHT_MS) {
- while (ms.rb && TaskValidate(task)) {
- if (c->right_click)
- (*c->right_click)(c,ms.pos.x-left,ms.pos.y-top,TRUE);
- WinMgrSleep;
- }
- if (c->right_click)
- (*c->right_click)(c,ms.pos.x-left,ms.pos.y-top,FALSE);
- old_ms.rb=FALSE;
- goto wmt_start;
- } else {
- if (c->right_click)
- (*c->right_click)(c,ms.pos.x-left,ms.pos.y-top,TRUE);
- old_ms.rb=TRUE;
- goto wmt_start;
- }
- }
- c=c->next;
- }
- }
- if (old_ms.rb && !ms.rb) {
- c=task->next_ctrl;
- while (c!=&task->next_ctrl) {
- if (CtrlInside(c,ms.pos.x,ms.pos.y)) {
- left=task->pix_left;
- top =task->pix_top;
- if (c->flags&CTRLF_BORDER) {
- left-=FONT_WIDTH;
- top -=FONT_HEIGHT;
- }
- if (c->right_click)
- (*c->right_click)(c,ms.pos.x-left,ms.pos.y-top,FALSE);
- old_ms.rb=FALSE;
- goto wmt_start;
- }
- c=c->next;
- }
- }
- if (ms.has_wheel && my_ms_z!=ms.pos.z) {
- if (task==sys_focus_task) {
- c=task->next_ctrl;
- while (c!=&task->next_ctrl) {
- if (c->wheel_chg) {
- (*c->wheel_chg)(c,ms.pos.z-my_ms_z);
- my_ms_z=ms.pos.z;
- goto wmt_start;
- }
- c=c->next;
- }
- my_ms_z=ms.pos.z;
- } else if (!sys_focus_task)
- my_ms_z=ms.pos.z;
- }
- }
-
- if (task==Fs)
- goto wmt_start;
-
- if (!Bt(&task->win_inhibit,WIf_SELF_MS_L)&&
- (!TaskValidate(sys_focus_task)||
- !Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_MS_L))) {
- if (!old_ms.lb && ms.lb) {
- if (doc=WinCursorPosSet(task,ms.pos.x,ms.pos.y)) {
- DocLock(doc);
- if (doc->doc_signature==DOC_SIGNATURE_VAL) {
- doc_e=doc->cur_entry;
- if (doc_e!=doc) {
- if (doc_e->de_flags & DOCEF_HAS_BORDER)
- doc_e->de_flags|=DOCEF_SOLID_BORDER;
- }
- }
- DocUnlock(doc);
- old_ms.lb=TRUE;
- goto wmt_start;
- }
- }
- }
- if (!Bt(&task->win_inhibit,WIf_SELF_MS_R)&&
- (!TaskValidate(sys_focus_task)||
- !Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_MS_R))) {
- if (!old_ms.rb && ms.rb) {
- if (WinCursorPosSet(task,ms.pos.x,ms.pos.y)) {
- old_ms.rb=TRUE;
- goto wmt_start;
- }
- }
- }
- if (!Bt(&task->win_inhibit,WIf_SELF_BORDER) && has_border &&
- (!TaskValidate(sys_focus_task)||
- !Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_BORDER))) {
- if (old_ms.lb && !ms.lb) {
- if (ms.pos_text.y==task->win_top-1) {
- if (task->win_left<=ms.pos_text.x<task->win_left+4) {
- TaskMsg(task,0,MSG_KEY_DOWN,CH_CTRLM,0x43200000432,0);
- old_ms.lb=FALSE;
- goto wmt_start;
- } else if (task->win_right-2<=ms.pos_text.x<=task->win_right) {
- if (DocPut(task))
- TaskMsg(task,0,MSG_KEY_DOWN,CH_SHIFT_ESC,0,0);
- else
- Kill(task,FALSE);
- old_ms.lb=FALSE;
- goto wmt_start;
- }
- }
- }
- }
- if (!Bt(&task->win_inhibit,WIf_SELF_MS_L)&&
- (!TaskValidate(sys_focus_task)||
- !Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_MS_L))) {
- if (old_ms.lb && !ms.lb) {
- if (doc=WinCursorPosSet(task,ms.pos.x,ms.pos.y,FALSE)) {
- do msg_code=WinMgrSleep;
- while (TaskValidate(task) && (ms.lb || ms.left_dbl_time));
- if (TaskValidate(task)) {
- if (msg_code==MSG_MS_L_UP) {
- if (doc->doc_signature==DOC_SIGNATURE_VAL) {
- DocLock(doc);
- if (TaskValidate(task)) {
- if (doc->doc_signature==DOC_SIGNATURE_VAL) {
- doc_e=doc->cur_entry;
- if (doc_e!=doc) {
- if (doc_e->de_flags & DOCEF_HAS_BORDER)
- doc_e->de_flags&=~DOCEF_SOLID_BORDER;
- if (doc_e->de_flags & (DOCEF_TREE|DOCEF_LST|
- DOCEF_LINK|DOCEF_CHECK_COLLAPSABLE|
- DOCEF_LEFT_CB|DOCEF_LEFT_MACRO|DOCEF_LEFT_EXP))
- TaskMsg(task,0,MSG_KEY_DOWN,CH_SPACE,0,0);
- }
- }
- DocUnlock(doc);
- }
- }
- } else if (msg_code==MSG_MS_L_D_UP)
- TaskMsg(task,0,MSG_KEY_DOWN,CH_ESC,0,0);
- }
- old_ms.lb=FALSE;
- goto wmt_start;
- }
- }
- }
-
- if (!Bt(&task->win_inhibit,WIf_SELF_MS_R)&&
- (!TaskValidate(sys_focus_task)||
- !Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_MS_R))) {
- if (old_ms.rb && !ms.rb) {
- if (doc=WinCursorPosSet(task,ms.pos.x,ms.pos.y,FALSE)) {
- do msg_code=WinMgrSleep;
- while (TaskValidate(task) && (ms.rb || ms.right_dbl_time));
- if (TaskValidate(task)) {
- if (msg_code==MSG_MS_R_UP) {
- if (doc->doc_signature==DOC_SIGNATURE_VAL) {
- DocLock(doc);
- if (TaskValidate(task)) {
- if (doc->doc_signature==DOC_SIGNATURE_VAL) {
- doc_e=doc->cur_entry;
- if (doc_e!=doc) {
- if (doc_e->de_flags&(DOCEF_LINK|
- DOCEF_RIGHT_CB|DOCEF_RIGHT_MACRO|DOCEF_RIGHT_EXP))
- TaskMsg(task,0,MSG_KEY_DOWN,'\n',0,0);
- }
- }
- DocUnlock(doc);
- }
- }
- } else if (msg_code==MSG_MS_R_D_UP)
- TaskMsg(task,0,MSG_KEY_DOWN,CH_SHIFT_ESC,0,0);
- }
- old_ms.rb=FALSE;
- goto wmt_start;
- }
- }
- }
-
- if (!Bt(&task->win_inhibit,WIf_SELF_BORDER) && has_border &&
- (!TaskValidate(sys_focus_task)||
- !Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_BORDER))) {
- if (ms.lb && !old_ms.lb) {
- if (task->win_top==ms.pos_text.y+1 &&
- task->win_left-1<=ms.pos_text.x<=task->win_right+1) {
- if (task->win_left<=ms.pos_text.x<task->win_left+4) {
- old_ms.lb=TRUE;
- goto wmt_start;
- }
- if (task->win_right-2<=ms.pos_text.x<=task->win_right) {
- old_ms.lb=TRUE;
- goto wmt_start;
- }
- x=ms.pos_text.x-task->win_left;
- if (ms.lb) {
- WinToTop(task);
- while (ms.lb && TaskValidate(task)) {
- WinHorz(ms.pos_text.x-x,task->win_width-1+ms.pos_text.x-x,task);
- WinVert(ms.pos_text.y+1,task->win_height+ms.pos_text.y,task);
- WinMgrSleep;
- }
- }
- old_ms.lb=FALSE;
- goto wmt_start;
- }
- if (task->win_left==ms.pos_text.x+1 &&
- task->win_top-1<=ms.pos_text.y<=task->win_bottom+1) {
- y=ms.pos_text.y-task->win_top;
- if (ms.lb) {
- WinToTop(task);
- while (ms.lb && TaskValidate(task)) {
- WinHorz(ms.pos_text.x+1,task->win_width+ms.pos_text.x,task);
- WinVert(ms.pos_text.y-y,
- task->win_height-1+ms.pos_text.y-y,task);
- WinMgrSleep;
- }
- }
- old_ms.lb=FALSE;
- goto wmt_start;
- }
- if (task->win_right+1==ms.pos_text.x &&
- task->win_bottom+1==ms.pos_text.y) {
- if (ms.lb) {
- WinToTop(task);
- while (ms.lb && TaskValidate(task)) {
- WinHorz(task->win_left,ms.pos_text.x-1,task);
- WinVert(task->win_top,ms.pos_text.y-1,task);
- WinMgrSleep;
- }
- }
- old_ms.lb=FALSE;
- goto wmt_start;
- }
- if (task->win_bottom==ms.pos_text.y-1 &&
- task->win_left<=ms.pos_text.x<=task->win_right) {
- if (ms.lb) {
- WinToTop(task);
- while (ms.lb && TaskValidate(task)) {
- WinVert(task->win_top,ms.pos_text.y-1,task);
- WinMgrSleep;
- }
- }
- old_ms.lb=FALSE;
- goto wmt_start;
- }
- if (task->win_right==ms.pos_text.x-1 &&
- task->win_top<=ms.pos_text.y<=task->win_bottom) {
- if (ms.lb) {
- WinToTop(task);
- while (ms.lb && TaskValidate(task)) {
- WinHorz(task->win_left,ms.pos_text.x-1,task);
- WinMgrSleep;
- }
- }
- old_ms.lb=FALSE;
- goto wmt_start;
- }
- }
- }
- } catch {
- Beep;
- Fs->catch_except=TRUE;
- task=Fs;
- }
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Apps/Budget/BgtAccts.HC.HTML b/public/src/Apps/Budget/BgtAccts.HC.HTML deleted file mode 100644 index cbbbfc9..0000000 --- a/public/src/Apps/Budget/BgtAccts.HC.HTML +++ /dev/null @@ -1,95 +0,0 @@ - - - - - BgtAccts.HC - - - - - U0 BgtAcctsUpdate()
-{
- CBgtEntry *tmpb;
- CBgtTemplate *tmpt;
- tmpb=b_head.next;
- while (tmpb!=&b_head) {
- if (tmpb->type!=BE_TEMPLATE_COPY) {
- tmpb->credit_idx=StrFileAdd(tmpb->credit,
- &accts_table_strs,accts_table);
- tmpb->debit_idx =StrFileAdd(tmpb->debit,
- &accts_table_strs,accts_table);
- }
- tmpb=tmpb->next;
- }
- tmpt=t_head.next;
- while (tmpt!=&t_head) {
- tmpt->b.credit_idx=StrFileAdd(tmpt->b.credit,
- &accts_table_strs,accts_table);
- tmpt->b.debit_idx =StrFileAdd(tmpt->b.debit,
- &accts_table_strs,accts_table);
- tmpt=tmpt->next;
- }
-}
-
-U0 BgtAcctsWrite()
-{
- BgtAcctsUpdate;
- StrFileWrite(bgt_accts_file,accts_table,TRUE);
-}
-
-U0 BgtAcctsRead()
-{
- I64 i,max_num;
- U8 *colors,**s=StrFileRead(bgt_accts_file,&max_num,&colors,TRUE);
- StrFileDel(accts_table);
- accts_table=HashTableNew(512);
- accts_table_strs=0;
- for (i=0;i<=max_num;i++)
- if (s[i])
- StrFileAdd(s[i],&accts_table_strs,accts_table,colors[i]);
- StrFileArrDel(s,max_num);
- Free(colors);
-}
-
-I64 BgtAcctColor(U8 *st)
-{
- CHashGeneric *tmph;
- if (tmph=HashFind(st,accts_table,SFT_GENERIC))
- return tmph->user_data1;
- else
- return BLACK;
-}
-
-U8 *BgtPopUpAcct(U8 *header=NULL,U8 *dft=NULL)
-{
- I64 i;
- U8 *res;
- CDoc *doc=DocNew;
- CDocEntry *doc_e,*doc_dft=NULL;
- CHashGeneric *tmph;
-
- if (header)
- DocPrint(doc,"%s",header);
-
- for (i=0;i<=accts_table->mask;i++) {
- tmph=accts_table->body[i];
- while (tmph) {
- doc_e=DocPrint(doc,"$FG,%d$$MU-UL,\"%s\",LE=0x%X$\n",
- tmph->user_data1,tmph->str,tmph->str);
- if (dft && !StrCmp(dft,tmph->str))
- doc_dft=doc_e;
- tmph=tmph->next;
- }
- }
-
- if (doc_dft) {
- doc->cur_entry=doc_dft;
- doc->cur_col=0;
- }
- res=PopUpMenu(doc,DOF_DONT_HOME);
- DocDel(doc);
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Apps/Budget/BgtEntry.HC.HTML b/public/src/Apps/Budget/BgtEntry.HC.HTML deleted file mode 100644 index 03cfa84..0000000 --- a/public/src/Apps/Budget/BgtEntry.HC.HTML +++ /dev/null @@ -1,95 +0,0 @@ - - - - - BgtEntry.HC - - - - - U0 BgtEntryDel2(CBgtEntry *tmpb)
-{
- if (tmpb->type!=BE_TEMPLATE_COPY) {
- Free(tmpb->credit);
- Free(tmpb->debit);
- Free(tmpb->desc);
- }
-}
-
-CBgtEntry *BgtEntryCopy(CBgtEntry *tmpb,Bool periodic_copy)
-{
- CBgtEntry *res=MAlloc(sizeof(CBgtEntry));
- MemCpy(res,tmpb,sizeof(CBgtEntry));
- if (periodic_copy) {
- res->credit=StrNew(tmpb->credit);
- res->debit =StrNew(tmpb->debit);
- res->desc =StrNew(tmpb->desc);
- }
- return res;
-}
-
-U0 BgtEntryDel(CBgtEntry *tmpb)
-{
- BgtEntryDel2(tmpb);
- Free(tmpb);
-}
-
-U0 BgtIns(CBgtEntry *tmpb)
-{
- CBgtEntry *tmpb1=b_head.next;
- while (tmpb1!=&b_head && tmpb1->date<tmpb->date)
- tmpb1=tmpb1->next;
- QueIns(tmpb,tmpb1->last);
-}
-
-class CBgtEntryForm
-{
- U8 date[512] format "$DA-P,A=\"Date:%s\"$\n";
- F64 amount format "Amount$$$DA,A=\"%10.2f\"$\n";
- U8 credit[512] format "$DA-P,A=\"Credit(from)Acct:%s\"$\n";
- U8 debit [512] format "$DA-P,A=\"Debit(to)Acct:%s\"$\n";
- U8 desc [512] format "$DA-P,A=\"Desc:%s\"$\n";
-};
-
-CBgtEntry *BgtEntryPmt(CBgtEntry *dft=NULL)
-{
- CBgtEntryForm b;
- CBgtEntry *tmpb;
- U8 *st;
- MemSet(&b,0,sizeof(CBgtEntryForm));
- StrCpy(&b.date,"*");
- if (dft) {
- StrPrint(b.date,"%D",dft->date);
- b.amount=dft->amount;
- StrCpy(b.credit,dft->credit);
- StrCpy(b.debit ,dft->debit);
- StrCpy(b.desc ,dft->desc);
- }
- while (TRUE)
- if (PopUpForm(&b)) {
- if (!*b.credit) {
- st=BgtPopUpAcct("Credit Acct\n\n");
- if (st!=DOCM_CANCEL)
- StrCpy(b.credit,st);
- } else if (!*b.debit) {
- st=BgtPopUpAcct("Debit Acct\n\n");
- if (st!=DOCM_CANCEL)
- StrCpy(b.debit,st);
- } else {
- tmpb=CAlloc(sizeof(CBgtEntry));
- tmpb->date =Str2Date(b.date);
- tmpb->amount=b.amount;
- tmpb->credit=StrNew(b.credit);
- tmpb->debit =StrNew(b.debit);
- tmpb->desc =StrNew(b.desc);
- tmpb->type =BE_NORMAL;
- StrFileAdd(tmpb->credit,&accts_table_strs,accts_table);
- StrFileAdd(tmpb->debit,&accts_table_strs,accts_table);
- return tmpb;
- }
- } else
- return NULL;
-}
- - - \ No newline at end of file diff --git a/public/src/Apps/Budget/BgtFile.HC.HTML b/public/src/Apps/Budget/BgtFile.HC.HTML deleted file mode 100644 index 163bc24..0000000 --- a/public/src/Apps/Budget/BgtFile.HC.HTML +++ /dev/null @@ -1,152 +0,0 @@ - - - - - BgtFile.HC - - - - - U0 BgtDataRead()
-{
- CBgtEntry *tmpb;
- CBgtTemplate *tmpt;
- I64 i,cnt,size;
- U8 *b,*ptr;
- I64 max_num;
- U8 **s=StrFileRead(bgt_string_file,&max_num);
-
- MemSet(&b_head,0,sizeof(CBgtEntry));
- QueInit(&b_head);
- b_head.date=Now;
- MemSet(&t_head,0,sizeof(CBgtTemplate));
- QueInit(&t_head);
- t_head.b.date=Now;
-
- if (ptr=b=FileRead(bgt_data_file,&size)) {
- cnt=*ptr(I64 *)++;
- for (i=0;i<cnt;i++) {
- tmpb=CAlloc(sizeof(CBgtEntry));
- MemCpy(&tmpb->start,ptr,BE_SIZE);
- tmpb->credit=StrNew(s[tmpb->credit_idx]);
- tmpb->debit =StrNew(s[tmpb->debit_idx]);
- tmpb->desc =StrNew(s[tmpb->desc_idx]);
- QueIns(tmpb,b_head.last);
- ptr+=BE_SIZE;
- }
-
- cnt=*ptr(I64 *)++;
- for (i=0;i<cnt;i++) {
- tmpt=CAlloc(sizeof(CBgtTemplate));
- MemCpy(&tmpt->start,ptr,BT_SIZE);
- ptr+=BT_SIZE;
- MemCpy(&tmpt->b.start,ptr,BE_SIZE);
- ptr+=BE_SIZE;
- tmpt->b.credit=StrNew(s[tmpt->b.credit_idx]);
- tmpt->b.debit =StrNew(s[tmpt->b.debit_idx]);
- tmpt->b.desc =StrNew(s[tmpt->b.desc_idx]);
- QueIns(tmpt,t_head.last);
- }
- }
-
- StrFileArrDel(s,max_num);
- Free(b);
-
- BgtAcctsUpdate;
-}
-
-U0 BgtDataWrite()
-{
- I64 i,num=0,size,cnt1,cnt2;
- CHashTable *table=HashTableNew(1024);
- CBgtEntry *tmpb;
- CBgtTemplate *tmpt;
- CHashGeneric *tmph;
- U8 *buf,*ptr;
-
- for (i=0;i<=accts_table->mask;i++) {
- tmph=accts_table->body[i];
- while (tmph) {
- StrFileAdd(tmph->str,&num,table); //Cosmetics -- make accts appear first.
- tmph=tmph->next;
- }
- }
-
- tmpb=b_head.next;
- cnt1=0;
- while (tmpb!=&b_head) {
- if (tmpb->type!=BE_TEMPLATE_COPY) {
- tmpb->credit_idx =StrFileAdd(tmpb->credit,&num,table);
- tmpb->debit_idx =StrFileAdd(tmpb->debit,&num,table);
- tmpb->desc_idx =StrFileAdd(tmpb->desc,&num,table);
- cnt1++;
- }
- tmpb=tmpb->next;
- }
-
- tmpt=t_head.next;
- cnt2=0;
- while (tmpt!=&t_head) {
- tmpt->b.credit_idx =StrFileAdd(tmpt->b.credit,&num,table);
- tmpt->b.debit_idx =StrFileAdd(tmpt->b.debit,&num,table);
- tmpt->b.desc_idx =StrFileAdd(tmpt->b.desc,&num,table);
- cnt2++;
- tmpt=tmpt->next;
- }
- StrFileWrite(bgt_string_file,table);
- StrFileDel(table);
-
- size=sizeof(I64)*2+cnt1*BE_SIZE+cnt2*(BT_SIZE+BE_SIZE);
- buf=ptr=MAlloc(size);
-
- MemCpy(ptr,&cnt1,sizeof(I64));
- ptr+=sizeof(I64);
- tmpb=b_head.next;
- while (tmpb!=&b_head) {
- if (tmpb->type!=BE_TEMPLATE_COPY) {
- MemCpy(ptr,&tmpb->start,BE_SIZE);
- ptr+=BE_SIZE;
- }
- tmpb=tmpb->next;
- }
-
- MemCpy(ptr,&cnt2,sizeof(I64));
- ptr+=sizeof(I64);
- tmpt=t_head.next;
- while (tmpt!=&t_head) {
- MemCpy(ptr,&tmpt->start,BT_SIZE);
- ptr+=BT_SIZE;
- MemCpy(ptr,&tmpt->b.start,BE_SIZE);
- ptr+=BE_SIZE;
- tmpt=tmpt->next;
- }
-
- FileWrite(bgt_data_file,buf,size);
- Free(buf);
-}
-
-U0 BgtDel()
-{
- CBgtEntry *tmpb,*tmpb1;
- CBgtTemplate *tmpt,*tmpt1;
- tmpb=b_head.next;
- while (tmpb!=&b_head) {
- tmpb1=tmpb->next;
- BgtEntryDel2(tmpb);
- Free(tmpb);
- tmpb=tmpb1;
- }
- tmpt=t_head.next;
- while (tmpt!=&t_head) {
- tmpt1=tmpt->next;
- BgtEntryDel2(&tmpt->b);
- Free(tmpt);
- tmpt=tmpt1;
- }
- StrFileDel(accts_table);
- accts_table=NULL;
- accts_table_strs=0;
-}
- - - \ No newline at end of file diff --git a/public/src/Apps/Budget/BgtMain.HC.HTML b/public/src/Apps/Budget/BgtMain.HC.HTML deleted file mode 100644 index 5604a5f..0000000 --- a/public/src/Apps/Budget/BgtMain.HC.HTML +++ /dev/null @@ -1,242 +0,0 @@ - - - - - BgtMain.HC - - - - - extern U0 BgtRegen();
-
-Bool BgtPutKey(CDoc *doc,U8 *,I64 ch,I64 sc)
-{//ch=ASCII; sc=scan_code
- no_warn sc;
- CBgtEntry *tmpb,*tmpb1;
- CBgtTemplate *tmpt,*tmpt1;
- CDocEntry *doc_ce;
- U8 *st;
- switch (ch) {
- case '\n':
- if ((doc_ce=doc->cur_entry) && doc_ce!=doc &&
- doc_ce->type_u8==DOCT_MENU_VAL) {
- tmpb=doc_ce->user_data;
- if (tmpt=tmpb->template) {
- if (tmpt1=BgtTemplatePmt(tmpt)) {
- QueRem(tmpt);
- BgtTemplatePurge(tmpt);
- BgtEntryDel2(&tmpt->b);
- Free(tmpt);
- QueIns(tmpt1,t_head.last);
- BgtTemplateExpand(tmpt1);
- BgtRegen;
- }
- } else {
- if (tmpb1=BgtEntryPmt(tmpb)) {
- QueRem(tmpb);
- BgtEntryDel(tmpb);
- BgtIns(tmpb1);
- BgtRegen;
- }
- }
- }
- return TRUE;
- case CH_CTRLY:
- if ((doc_ce=doc->cur_entry) && doc_ce!=doc &&
- doc_ce->type_u8==DOCT_MENU_VAL) {
- tmpb=doc_ce->user_data;
- if (tmpt=tmpb->template) {
- QueRem(tmpt);
- BgtTemplateDel(tmpt);
- } else {
- QueRem(tmpb);
- BgtEntryDel(tmpb);
- }
- BgtRegen;
- }
- return TRUE;
- case 'a':
- PopUpOk( "Set the name and color of your accounts.\n"
- "To delete accounts, manually edit\n"
- "$GREEN$~/Budget/Accts.DD.Z$FG$.");
- if (PopUpEd(bgt_accts_file,Fs)) {
- BgtAcctsRead;
- BgtRegen;
- }
- return TRUE;
- case 'v':
- if ((st=BgtPopUpAcct("View Acct\n\n",view_acct))>=0) {
- StrCpy(view_acct,st);
- BgtRegen;
- }
- return TRUE;
- case 'n':
- if (tmpb1=BgtEntryPmt) {
- BgtIns(tmpb1);
- BgtRegen;
- }
- return TRUE;
- case 't':
- if (tmpt1=BgtTemplatePmt) {
- QueIns(tmpt1,t_head.last);
- BgtTemplateExpand(tmpt1);
- BgtRegen;
- }
- return TRUE;
- case 'c':
- if ((doc_ce=doc->cur_entry) && doc_ce!=doc &&
- doc_ce->type_u8==DOCT_MENU_VAL)
- tmpb=doc_ce->user_data;
- else
- tmpb=NULL;
- if (tmpb1=BgtEntryPmt(tmpb)) {
- BgtIns(tmpb1);
- BgtRegen;
- }
- return TRUE;
- case 'p':
- if ((doc_ce=doc->cur_entry) && doc_ce!=doc &&
- doc_ce->type_u8==DOCT_MENU_VAL) {
- tmpb=doc_ce->user_data;
- if (tmpt1=BgtTemplatePmt(,tmpb)) {
- BgtTemplateExpand(tmpt1,TRUE);
- BgtTemplateDel(tmpt1);
- BgtRegen;
- }
- }
- return TRUE;
- }
- return FALSE;
-}
-
-U0 BgtRegen()
-{
- I64 timeout_jiffy,c,color=COLOR_INVALID;
- F64 balance=0;
- CDoc *doc,*pdoc,*ddoc;
- CDocEntry *doc_ce;
- CBgtEntry *tmpb=b_head.next,*tmpb_ce;
- doc=DocNew;
- doc->flags|=DOCF_FORM;
- while (tmpb!=&b_head) {
- if (!StrCmp(view_acct,tmpb->credit))
- balance-=tmpb->amount;
- if (!StrCmp(view_acct,tmpb->debit))
- balance+=tmpb->amount;
- c=BgtAcctColor(tmpb->credit);
- if (c!=color) {
- color=c;
- DocPrint(doc,"$FG,%d$",color);
- }
- tmpb->doc_e=DocPrint(doc,
- "$MU-UL,\"%D %8ts %8ts:%8.2f %8.2f:%$Q\",U=0x%X$\n",
- tmpb->date,tmpb->credit,tmpb->debit,balance,
- tmpb->amount,tmpb->desc,tmpb);
- tmpb=tmpb->next;
- }
- DocRecalc(doc);
-
- if (pdoc=Fs->put_doc) {
- DocLock(pdoc);
-//Now, we want to preserve old position in doc, using ugly brute force.
- //It's tricky -- can't use old line num because of editor filters.
-
- //The price we pay for using the standard document editor is this kludge.
- //When I originally wrote my budget program, I did not have separate budget
- //and line entries, so we never had to resync.
-
- doc_ce=pdoc->cur_entry;
- timeout_jiffy=cnts.jiffies+JIFFY_FREQ; //Max one second.
- while (doc_ce!=pdoc && cnts.jiffies<timeout_jiffy) {
- while (doc_ce->type_u8!=DOCT_MENU_VAL || !(tmpb_ce=doc_ce->user_data)) {
- doc_ce=doc_ce->next;
- if (doc_ce==pdoc) goto br_cont;
- }
- tmpb=b_head.next;
- while (tmpb!=&b_head) {
- if (tmpb==tmpb_ce) {
- doc->cur_entry=tmpb->doc_e;
- doc->cur_col=0;
- DocCenter(doc);
- goto br_cont;
- }
- tmpb=tmpb->next;
- }
- doc_ce=doc_ce->next;
- }
- }
-
- br_cont:
- ddoc=Fs->display_doc;
- Fs->put_doc =doc;
- Fs->display_doc=doc;
- DocDel(pdoc);
- if (pdoc!=ddoc)
- DocDel(ddoc);
- doc->user_put_key=&BgtPutKey;
-}
-
-U0 Budget(U8 *dirname="~/Budget")
-{
- CDoc *pdoc,*ddoc,*old_put,*old_display;
-
- Cd(dirname);
- bgt_string_file =FileNameAbs("Strs.DD.Z");
- bgt_accts_file =FileNameAbs("Accts.DD.Z");
- bgt_data_file =FileNameAbs("Bgt.DATA.Z");
-
- BgtAcctsRead;
- BgtDataRead;
- CBgtTemplatesExpand;
- SettingsPush; //See SettingsPush
- AutoComplete;
- WinBorder;
- WinMax;
- MenuPush(
- "File {"
- " Abort(,CH_SHIFT_ESC);"
- " Exit(,CH_ESC);"
- "}"
- "Edit {"
- " NewEntry(,'n');"
- " CopyEntry(,'c');"
- " PeriodicEntry(,'p');"
- " EditEntry(,'\n');"
- " DeleteEntry(,CH_CTRLY);"
- " NewTemplate(,'t');"
- " AcctsFile(,'a');"
- "}"
- "View {"
- " ViewAcct(,'v');"
- "}"
- );
- StrCpy(view_acct,"BANK");
- DocMax;
- old_put =Fs->put_doc;
- old_display =Fs->display_doc;
- Fs->put_doc =NULL;
- Fs->display_doc=NULL;
- BgtRegen;
- try
- if (View) {
- BgtDataWrite;
- BgtAcctsWrite;
- }
- catch
- PutExcept;
-
- pdoc=Fs->put_doc;
- ddoc=Fs->display_doc;
- Fs->put_doc =old_put;
- Fs->display_doc=old_display;
- DocDel(pdoc);
- if (pdoc!=ddoc)
- DocDel(ddoc);
-
- SettingsPop;
- BgtDel;
- MenuPop;
-}
- - - \ No newline at end of file diff --git a/public/src/Apps/Budget/BgtStrs.HC.HTML b/public/src/Apps/Budget/BgtStrs.HC.HTML deleted file mode 100644 index 95703c6..0000000 --- a/public/src/Apps/Budget/BgtStrs.HC.HTML +++ /dev/null @@ -1,144 +0,0 @@ - - - - - BgtStrs.HC - - - - - #define SFT_GENERIC 1
-
-public U8 **StrFileRead(U8 *name,I64 *_max_num=NULL,
- U8 **_colors=NULL,Bool no_nums=FALSE)
-{
- CDoc *doc=DocRead(name,DOCF_DBL_DOLLARS|DOCF_NO_CURSOR);
- CDocEntry *doc_e=doc->head.next;
- I64 i,max_num=0;
- U8 *ptr,**res,*colors;
-
- while (doc_e!=doc) {
- if (doc_e->type_u8==DOCT_TEXT) {
- if (no_nums)
- i=++max_num;
- else {
- i=Str2I64(doc_e->tag,,&ptr);
- if (i>max_num) max_num=i;
- if (*ptr==',') ptr++;
- ptr=StrNew(ptr);
- Free(doc_e->tag);
- doc_e->tag=ptr;
- }
- doc_e->user_data=i;
- }
- doc_e=doc_e->next;
- }
-
- res=CAlloc(sizeof(U8 *)*(max_num+1));
- colors=CAlloc(sizeof(U8)*(max_num+1));
- doc_e=doc->head.next;
- while (doc_e!=doc) {
- if (doc_e->type_u8==DOCT_TEXT && 0<=doc_e->user_data<=max_num) {
- res[doc_e->user_data]=doc_e->tag;
- doc_e->tag=NULL;
- colors[doc_e->user_data]=doc_e->type.u8[1]&15;
- }
- doc_e=doc_e->next;
- }
-
- DocDel(doc);
- if (_max_num) *_max_num=max_num;
- if (_colors)
- *_colors=colors;
- else
- Free(colors);
- return res;
-}
-
-public U0 StrFileArrDel(U8 **a,I64 max_num)
-{
- I64 i;
- for (i=0;i<=max_num;i++)
- Free(a[i]);
- Free(a);
-}
-
-public I64 StrFileAdd(U8 *st,I64 *_num,
- CHashTable *table,I64 color=COLOR_INVALID)
-{
- CHashGeneric *tmph;
- if (!st) return 0;
- if (!(tmph=HashFind(st,table,SFT_GENERIC))) {
- tmph=CAlloc(sizeof(CHashGeneric));
- tmph->type=SFT_GENERIC;
- tmph->str=StrNew(st);
- tmph->user_data0=(*_num)++;
- HashAdd(tmph,table);
- }
- if (color!=COLOR_INVALID)
- tmph->user_data1=color;
- return tmph->user_data0;
-}
-
-I64 StrEntriesCompare(CHashGeneric *h1,CHashGeneric *h2)
-{
- return h1->user_data0-h2->user_data0;
-}
-
-public U0 StrFileWrite(U8 *name,CHashTable *table,Bool no_nums=FALSE)
-{
- I64 i,j,cnt,color=BLACK;
- CDoc *doc=DocNew(name);
- CHashGeneric *tmph,**a;
- if (table) {
- cnt=0; //Count Strings
- for (i=0;i<=table->mask;i++)
- cnt+=LinkedLstCnt(table->body[i]);
- a=MAlloc(cnt*sizeof(CHashGeneric *));
- j=0; //Load Strings
- for (i=0;i<=table->mask;i++) {
- tmph=table->body[i];
- while (tmph) {
- a[j++]=tmph;
- tmph=tmph->next;
- }
- }
- QSortI64(a,cnt,&StrEntriesCompare);
- for (i=0;i<cnt;i++) {
- tmph=a[i];
- if (tmph->user_data1&15!=color) {
- DocPrint(doc,"$FG,%d$",tmph->user_data1&15);
- color=tmph->user_data1&15;
- }
- if (no_nums)
- DocPrint(doc,"%s\n",tmph->str);
- else
- DocPrint(doc,"%d,%s\n",tmph->user_data0,tmph->str);
- }
- Free(a);
- }
- doc->flags|=DOCF_NO_CURSOR;
- DocWrite(doc);
- DocDel(doc);
-}
-
-public U0 StrFileDel(CHashTable *table)
-{
- I64 i;
- CHashGeneric *tmph,*tmph1;
- if (!table) return;
- for (i=0;i<=table->mask;i++) {
- tmph=table->body[i];
- while (tmph) {
- tmph1=tmph->next;
- Free(tmph->str);
- Free(tmph);
- tmph=tmph1;
- }
- }
- Free(table->body);
- Free(table);
-}
- - - \ No newline at end of file diff --git a/public/src/Apps/Budget/BgtTemplate.HC.HTML b/public/src/Apps/Budget/BgtTemplate.HC.HTML deleted file mode 100644 index a40ba88..0000000 --- a/public/src/Apps/Budget/BgtTemplate.HC.HTML +++ /dev/null @@ -1,194 +0,0 @@ - - - - - BgtTemplate.HC - - - - - U0 BgtTemplatePurge(CBgtTemplate *tmpt)
-{
- CBgtEntry *tmpb,*tmpb1;
- tmpb=b_head.next;
- while (tmpb!=&b_head) {
- tmpb1=tmpb->next;
- if (tmpb->template==tmpt) {
- QueRem(tmpb);
- BgtEntryDel2(tmpb);
- Free(tmpb);
- }
- tmpb=tmpb1;
- }
-}
-
-U0 BgtTemplateDel(CBgtTemplate *tmpt)
-{
- BgtTemplatePurge(tmpt);
- BgtEntryDel2(&tmpt->b);
- Free(tmpt);
-}
-
-U0 BgtTemplateExpand(CBgtTemplate *tmpt,Bool periodic_copy=FALSE)
-{
- CDate d,start,end;
- CDateStruct ds;
- CBgtEntry *tmpb;
- Bool first=TRUE;
-
- start=MyStr2Date(tmpt->start_date);
- end =MyStr2Date(tmpt->end_date);
- tmpt->b.template=tmpt;
- switch (tmpt->type) {
- case BT_INTERVAL:
- d=start;
- while (d<=end) {
- if (!first || !periodic_copy) {
- tmpb=BgtEntryCopy(&tmpt->b,periodic_copy);
- tmpb->date=d;
- if (periodic_copy)
- tmpb->template=NULL;
- else
- tmpb->type=BE_TEMPLATE_COPY;
- BgtIns(tmpb);
- }
- d+=tmpt->period*0x100000000;
- first=FALSE;
- }
- break;
- case BT_MONTHLY:
- Date2Struct(&ds,start);
- while (TRUE) {
- d=Struct2Date(&ds);
- if (d<=end) {
- if (!first || !periodic_copy) {
- tmpb=BgtEntryCopy(&tmpt->b,periodic_copy);
- tmpb->date=d;
- if (periodic_copy)
- tmpb->template=NULL;
- else
- tmpb->type=BE_TEMPLATE_COPY;
- BgtIns(tmpb);
- }
- } else
- break;
- if (++ds.mon>12) {
- ds.mon=1;
- ds.year++;
- }
- first=FALSE;
- }
- break;
- case BT_BIMONTHLY:
- Date2Struct(&ds,start);
- while (TRUE) {
- d=Struct2Date(&ds);
- if (d<=end) {
- if (!first || !periodic_copy) {
- tmpb=BgtEntryCopy(&tmpt->b,periodic_copy);
- tmpb->date=d;
- if (periodic_copy)
- tmpb->template=NULL;
- else
- tmpb->type=BE_TEMPLATE_COPY;
- BgtIns(tmpb);
- }
- } else
- break;
- ds.mon+=2;
- if (ds.mon>12) {
- ds.mon-=12;
- ds.year++;
- }
- first=FALSE;
- }
- break;
- case BT_SEMIANNUAL:
- Date2Struct(&ds,start);
- while (TRUE) {
- d=Struct2Date(&ds);
- if (d<=end) {
- if (!first || !periodic_copy) {
- tmpb=BgtEntryCopy(&tmpt->b,periodic_copy);
- tmpb->date=d;
- if (periodic_copy)
- tmpb->template=NULL;
- else
- tmpb->type=BE_TEMPLATE_COPY;
- BgtIns(tmpb);
- }
- } else
- break;
- ds.mon+=6;
- if (ds.mon>12) {
- ds.mon-=12;
- ds.year++;
- }
- first=FALSE;
- }
- break;
- case BT_ANNUAL:
- Date2Struct(&ds,start);
- while (TRUE) {
- d=Struct2Date(&ds);
- if (d<=end) {
- if (!first || !periodic_copy) {
- tmpb=BgtEntryCopy(&tmpt->b,periodic_copy);
- tmpb->date=d;
- if (periodic_copy)
- tmpb->template=NULL;
- else
- tmpb->type=BE_TEMPLATE_COPY;
- BgtIns(tmpb);
- }
- } else
- break;
- ds.year++;
- first=FALSE;
- }
- break;
- }
-}
-
-U0 CBgtTemplatesExpand()
-{
- CBgtTemplate *tmpt=t_head.next;
- while (tmpt!=&t_head) {
- BgtTemplateExpand(tmpt);
- tmpt=tmpt->next;
- }
-}
-
-CBgtTemplate *BgtTemplatePmt(CBgtTemplate *dft_t=NULL,CBgtEntry *dft_b=NULL)
-{
- CBgtTemplate t,*tmpt;
- CBgtEntry *tmpb;
- MemSet(&t,0,sizeof(CBgtTemplate));
- if (dft_t) {
- MemCpy(&t.start,&dft_t->start,BT_SIZE);
- dft_b=&dft_t->b;
- } else {
- t.type=BT_INTERVAL;
- if (dft_b)
- StrPrint(&t.start_date,"%D",dft_b->date);
- else
- StrCpy(&t.start_date,"[");
- StrCpy(&t.end_date,"]");
- }
- while (TRUE)
- if (PopUpForm(&t) && ((t.type==BT_INTERVAL && t.period>0) ||
- t.type>BT_INTERVAL)) {
- if (tmpb=BgtEntryPmt(dft_b)) {
- tmpt=CAlloc(sizeof(CBgtTemplate));
- MemCpy(&tmpt->start,&t.start,BT_SIZE);
- MemCpy(&tmpt->b,tmpb,sizeof(CBgtEntry));
- Free(tmpb);
- return tmpt;
- }
- } else
- break;
- return NULL;
-}
- - - \ No newline at end of file diff --git a/public/src/Apps/Budget/Budget.HC.HTML b/public/src/Apps/Budget/Budget.HC.HTML deleted file mode 100644 index e4e394d..0000000 --- a/public/src/Apps/Budget/Budget.HC.HTML +++ /dev/null @@ -1,89 +0,0 @@ - - - - - Budget.HC - - - - - U8 *bgt_string_file;
-U8 *bgt_accts_file;
-U8 *bgt_data_file;
-
-#define BE_NORMAL 0
-#define BE_GAS 1
-#define BE_ANNIVERSARY 2
-#define BE_PRICE 3
-#define BE_TEMPLATE_COPY 4
-
-extern class CBgtTemplate;
-
-class CBgtEntry
-{
- CBgtEntry *next,*last;
-
- U0 start;
- CDate date;
- U16 type,flags;
- U32 credit_idx,debit_idx,desc_idx;
- F64 amount;
- U0 end;
-
- U8 *credit,*debit,*desc;
- CBgtTemplate *template;
- CDocEntry *doc_e;
-} b_head;
-#define BE_SIZE (offset(CBgtEntry.end)-offset(CBgtEntry.start))
-
-#define BT_NULL 0
-#define BT_INTERVAL 1
-#define BT_MONTHLY 2
-#define BT_BIMONTHLY 3
-#define BT_SEMIANNUAL 4
-#define BT_ANNUAL 5
-
-DefineLstLoad("ST_BGT_TEMPLATE_TYPES",
- "Null\0Interval\0Monthly\0Bimonthly\0Semiannual\0Annual\0");
-
-class CBgtTemplate
-{
- CBgtTemplate *next,*last;
-
- U0 start;
- U16 type format "$LS,D=\"ST_BGT_TEMPLATE_TYPES\"$\n";
- U16 flags;
- U8 start_date[16] format "$DA-P,A=\"StartDate:%s\"$\n";
- U8 end_date[16] format "$DA-P,A=\"EndDate:%s\"$\n";
- F64 period format "$DA,A=\"Period:%8.2f\"$\n";
- U0 end;
-
- CBgtEntry b;
-} t_head;
-#define BT_SIZE (offset(CBgtTemplate.end)-offset(CBgtTemplate.start))
-
-U8 view_acct[512];
-CHashTable *accts_table=NULL;
-I64 accts_table_strs=0;
-
-CDate MyStr2Date(U8 *st)
-{
- CDateStruct ds;
- CDate res;
- if (st&&*st) {
- if (StrOcc(st,'['))
- res=b_head.next->date;
- else if (StrOcc(st,']'))
- res=b_head.last->date;
- else
- res=Str2Date(st);
- } else
- res=Now;
- Date2Struct(&ds,res);
- if (ds.year>2050)
- ds.year-=100;
- return Struct2Date(&ds);
-}
- - - \ No newline at end of file diff --git a/public/src/Apps/Budget/Install.HC.HTML b/public/src/Apps/Budget/Install.HC.HTML deleted file mode 100644 index 78fd89f..0000000 --- a/public/src/Apps/Budget/Install.HC.HTML +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Install.HC - - - - - Cd(__DIR__);;
-if (!FileFind("~/Budget",,FUF_JUST_DIRS)) {
- DirMk("~/Budget");
- Copy("Accts.DD.Z","~/Budget");
-}
- - - \ No newline at end of file diff --git a/public/src/Apps/Budget/Load.HC.HTML b/public/src/Apps/Budget/Load.HC.HTML deleted file mode 100644 index fba75d8..0000000 --- a/public/src/Apps/Budget/Load.HC.HTML +++ /dev/null @@ -1,24 +0,0 @@ - - - - - Load.HC - - - - - #help_index "Finance"
-
-Cd(__DIR__);;
-#include "BgtStrs"
-#include "Budget"
-#include "BgtAccts"
-#include "BgtEntry"
-#include "BgtTemplate"
-#include "BgtFile"
-#include "BgtMain"
-
-#help_index ""
- - - \ No newline at end of file diff --git a/public/src/Apps/Budget/Run.HC.HTML b/public/src/Apps/Budget/Run.HC.HTML deleted file mode 100644 index fc8549c..0000000 --- a/public/src/Apps/Budget/Run.HC.HTML +++ /dev/null @@ -1,16 +0,0 @@ - - - - - Run.HC - - - - - Cd(__DIR__);;
-#include "Load"
-#include "Install" //Might as well always install
-Budget;
- - - \ No newline at end of file diff --git a/public/src/Apps/GrModels/BallGen.HC.HTML b/public/src/Apps/GrModels/BallGen.HC.HTML deleted file mode 100644 index 9595dae..0000000 --- a/public/src/Apps/GrModels/BallGen.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - BallGen.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Apps/GrModels/Load.HC.HTML b/public/src/Apps/GrModels/Load.HC.HTML deleted file mode 100644 index a3ca94c..0000000 --- a/public/src/Apps/GrModels/Load.HC.HTML +++ /dev/null @@ -1,20 +0,0 @@ - - - - - Load.HC - - - - - #help_index "Misc"
-
-Cd(__DIR__);;
-#include "ManGen"
-#include "BallGen"
-#include "Models"
-
-#help_index ""
- - - \ No newline at end of file diff --git a/public/src/Apps/GrModels/ManGen.HC.HTML b/public/src/Apps/GrModels/ManGen.HC.HTML deleted file mode 100644 index 199524d..0000000 --- a/public/src/Apps/GrModels/ManGen.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - ManGen.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Apps/GrModels/Models.HC.HTML b/public/src/Apps/GrModels/Models.HC.HTML deleted file mode 100644 index 36853fc..0000000 --- a/public/src/Apps/GrModels/Models.HC.HTML +++ /dev/null @@ -1,37 +0,0 @@ - - - - - Models.HC - - - - - #define T_MAN 0
-#define T_BALL 1
-
-U0 Models()
-{
- I64 i;
- Bool old_form=LBts(&(DocPut)->flags,DOCf_FORM);
- DocClear;
- "Make a CSprite model.Then, cut-and-Paste it.\n\n";
- "$LM,4$";
- "\n\n$BT,\"Man\",LE=T_MAN$\n\n";
- "\n\n$BT,\"Ball\",LE=T_BALL$\n\n";
- "$LM,0$";
- i=DocMenu(DocPut);
- LBEqu(&(DocPut)->flags,DOCf_FORM,old_form);
- DocBottom;
- switch (i) {
- case T_MAN:
- ManGen;
- break;
- case T_BALL:
- BallGen;
- break;
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Apps/GrModels/Run.HC.HTML b/public/src/Apps/GrModels/Run.HC.HTML deleted file mode 100644 index 32d0bfa..0000000 --- a/public/src/Apps/GrModels/Run.HC.HTML +++ /dev/null @@ -1,14 +0,0 @@ - - - - - Run.HC - - - - - Cd(__DIR__);;
-#include "Load"
-Models; - - \ No newline at end of file diff --git a/public/src/Apps/KeepAway/KeepAway.HC.HTML b/public/src/Apps/KeepAway/KeepAway.HC.HTML deleted file mode 100644 index 33f8090..0000000 --- a/public/src/Apps/KeepAway/KeepAway.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - KeepAway.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Apps/KeepAway/Load.HC.HTML b/public/src/Apps/KeepAway/Load.HC.HTML deleted file mode 100644 index 322a6a0..0000000 --- a/public/src/Apps/KeepAway/Load.HC.HTML +++ /dev/null @@ -1,18 +0,0 @@ - - - - - Load.HC - - - - - #help_index "Games"
-
-Cd(__DIR__);;
-#include "KeepAway"
-
-#help_index ""
- - - \ No newline at end of file diff --git a/public/src/Apps/KeepAway/Run.HC.HTML b/public/src/Apps/KeepAway/Run.HC.HTML deleted file mode 100644 index 19a8e1c..0000000 --- a/public/src/Apps/KeepAway/Run.HC.HTML +++ /dev/null @@ -1,14 +0,0 @@ - - - - - Run.HC - - - - - Cd(__DIR__);;
-#include "Load"
-KeepAway; - - \ No newline at end of file diff --git a/public/src/Apps/Logic/Load.HC.HTML b/public/src/Apps/Logic/Load.HC.HTML deleted file mode 100644 index 627784f..0000000 --- a/public/src/Apps/Logic/Load.HC.HTML +++ /dev/null @@ -1,18 +0,0 @@ - - - - - Load.HC - - - - - #help_index "Misc"
-
-Cd(__DIR__);;
-#include "Logic"
-
-#help_index ""
- - - \ No newline at end of file diff --git a/public/src/Apps/Logic/Logic.HC.HTML b/public/src/Apps/Logic/Logic.HC.HTML deleted file mode 100644 index be22f60..0000000 --- a/public/src/Apps/Logic/Logic.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Logic.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Apps/Logic/Run.HC.HTML b/public/src/Apps/Logic/Run.HC.HTML deleted file mode 100644 index 985b9b6..0000000 --- a/public/src/Apps/Logic/Run.HC.HTML +++ /dev/null @@ -1,14 +0,0 @@ - - - - - Run.HC - - - - - Cd(__DIR__);;
-#include "Load"
-DigitalLogic; - - \ No newline at end of file diff --git a/public/src/Apps/Psalmody/Examples/childish.HC.HTML b/public/src/Apps/Psalmody/Examples/childish.HC.HTML deleted file mode 100644 index a692230..0000000 --- a/public/src/Apps/Psalmody/Examples/childish.HC.HTML +++ /dev/null @@ -1,36 +0,0 @@ - - - - - childish.HC - - - - - //9 has words
-U0 Song()
-{
- Fs->task_end_cb=&SndTaskEndCB;
- MusicSettingsRst;
- music.tempo= 2.480;
- music.stacatto_factor= 0.902;
- try {
- while (!ScanKey) {
- Play("5qEsCDCDqCDeEGsE4B5E4B5eC4B5sD4A5D4A",
- "Be\0like\0\0a\0\0child\0\0\0\0"
- "some\0\0re\0\0spect.\n\0\0\0\0\0\0");
- Play("5qEsCDCDqCDeEGsE4B5E4B5eC4B5sD4A5D4A",
- "Ma\0tur\0\0i\0\0ty\0\0\0\0don't\0\0"
- "ne\0\0glect.\n\0\0\0\0\0\0");
- Play("4eB5DqF4sGAGAqAAA5etD4AA5sD4B5D4B");
- Play("4eB5DqF4sGAGAqAAA5etD4AA5sD4B5D4B");
- }
- } catch
- PutExcept;
- Snd;
-}
-
-Song;
- - - \ No newline at end of file diff --git a/public/src/Apps/Psalmody/Examples/night.HC.HTML b/public/src/Apps/Psalmody/Examples/night.HC.HTML deleted file mode 100644 index bea9444..0000000 --- a/public/src/Apps/Psalmody/Examples/night.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - night.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Apps/Psalmody/Examples/prosper.HC.HTML b/public/src/Apps/Psalmody/Examples/prosper.HC.HTML deleted file mode 100644 index 4e84083..0000000 --- a/public/src/Apps/Psalmody/Examples/prosper.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - prosper.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Apps/Psalmody/Install.HC.HTML b/public/src/Apps/Psalmody/Install.HC.HTML deleted file mode 100644 index 7b1239c..0000000 --- a/public/src/Apps/Psalmody/Install.HC.HTML +++ /dev/null @@ -1,14 +0,0 @@ - - - - - Install.HC - - - - - if (!FileFind("~/Psalmody",,FUF_JUST_DIRS))
- DirMk("~/Psalmody");
- - - \ No newline at end of file diff --git a/public/src/Apps/Psalmody/JukeBox.HC.HTML b/public/src/Apps/Psalmody/JukeBox.HC.HTML deleted file mode 100644 index 258bbec..0000000 --- a/public/src/Apps/Psalmody/JukeBox.HC.HTML +++ /dev/null @@ -1,212 +0,0 @@ - - - - - JukeBox.HC - - - - - CTask *JukeReward(U8 *msg)
-{
- U8 *buf;
- CDoc *doc;
- CTask *res=Spawn(&SrvCmdLine,NULL,"Reward",,Fs);
- StrCpy(res->task_title,"Reward");
- res->title_src=TTS_LOCKED_CONST;
-
- doc=DocNew(,res);
- DocPrint(doc,"$WW+H,1$$RED$%s",msg);
-
- buf=MStrPrint("DocEd(0x%X);",doc);
- TaskExe(res,NULL,buf,1<<JOBf_EXIT_ON_COMPLETE|1<<JOBf_FREE_ON_COMPLETE);
- Free(buf);
- TaskWait(res);
-
- res->border_src =BDS_CONST;
- res->border_attr=LTGRAY<<4+DrvTextAttrGet(':')&15;
- res->text_attr =LTGRAY<<4+BLUE;
- res->win_inhibit=WIG_NO_FOCUS_TASK_DFT;
- WinHorz(Fs->win_right+2,TEXT_COLS-2,res);
- WinVert(2,TEXT_ROWS-2,res);
-
- WinFocus(Fs->parent_task);
- return res;
-}
-
-CTask *SingleSong(U8 *msg,U8 *name)
-{
- CTask *task=Spawn(&SrvCmdLine,NULL,name,,Fs);
- StrCpy(task->task_title,name);
- task->title_src=TTS_LOCKED_CONST;
- TaskExe(task,Fs,";",1<<JOBf_WAKE_MASTER|1<<JOBf_FREE_ON_COMPLETE);
- WinHorz(task->win_left,task->win_left+50,task);
- WinVert(2,2+8,task);
- task->win_inhibit=WIG_NO_FOCUS_TASK_DFT;
- TaskExe(task,NULL,msg,1<<JOBf_EXIT_ON_COMPLETE|1<<JOBf_FREE_ON_COMPLETE);
- DocPut(task)->max_entries=100;
- return task;
-}
-
-#define JB_RUN_LEVEL_NULL 0
-#define JB_RUN_LEVEL_ONE 1
-#define JB_RUN_LEVEL_TWO 2
-
-Bool JBPutKey(CDoc *doc,U8 *,I64 ch,I64 sc)
-{//ch=ASCII; sc=scan_code
- CDocEntry *doc_ce=doc->cur_entry,*doc_e;
- CDirEntry *tmpde;
- I64 i;
- U8 *st;
- CDoc *doc2;
- if (!(sc&(SCF_ALT|SCF_CTRL|SCF_SHIFT))
- && doc_ce->type_u8==DOCT_MENU_VAL && doc_ce->left_exp>=0) {
- tmpde=doc_ce->left_exp;
- if (sc.u8[0]==SC_DELETE ) {
- Beep;
- Silent;
- Del(tmpde->full_name);
- Silent(OFF);
- } else if ('0'<=ch<='9') {
- if (StrLen(doc_ce->tag)>1)
- doc_ce->tag[0]=ch;
- doc2=DocRead(tmpde->full_name);
- DocGoToLine(doc2,1);
- doc_e=doc2->cur_entry;
- if (doc_e!=doc2 && doc_e->type_u8==DOCT_TEXT && StrLen(doc_e->tag)>=3) {
- doc_e->tag[2]=ch;
- DocWrite(doc2);
- }
- DocDel(doc2);
- return TRUE;
- } else if (ch=='r') {
- if (!DocTreeFFind(tmpde->full_name,"Reward1")) {
- doc2=DocRead(tmpde->full_name);
- DocGoToLine(doc2,2);
- DocPrint(doc2,
- "\n$TR,\"Reward1\"$\n"
- "$
$CallExtStr(\"JukeReward\",\"\"\n"
- "$TR,\"Reward2\"$\n"
- "$ID,2$\n"
- "$
$\n"
- ");\n$ID,-2$\n"
- );
- DocWrite(doc2);
- DocDel(doc2);
- }
- if (DocTreeFFind(tmpde->full_name,"Reward1/Reward2")) {
- for (i=0;i<5;i++) {
- st=MStrPrint("%s %s %s %s ",
- GodWordStr,GodWordStr,GodWordStr,GodWordStr);
- DocTreeFAppend(tmpde->full_name,"Reward1/Reward2",
- "\"%s\"\n",st);
- Free(st);
- }
- In("");
- }
- return TRUE;
- } else if (ch==CH_SPACE||ch==CH_ESC)
- tmpde->user_data++; //JB_RUN_LEVEL++
-//<SPACE> is followed by <ESC> --> JB_RUN_LEVEL_TWO
- //Actual <ESC> just exits--> JB_RUN_LEVEL_ONE
- }
- return FALSE;
-}
-
-public U0 JukeBox(U8 *dirname="~/Psalmody",U8 **_filename=NULL)
-{//_filename is for using this as a song-chooser program.
- I64 i=0,rating;
- U8 *st,*st2;
- CDirEntry *tmpde,*tmpde1;
- CDoc *doc=DocNew,*s;
- CDocEntry *doc_e;
- CTask *task=NULL;
- if (_filename)
- *_filename=NULL;
- SettingsPush; //See SettingsPush
- AutoComplete;
- try {
- dirname=StrNew(dirname);
- st=MStrPrint("%s/*.HC.Z",dirname);
- tmpde=tmpde1=FilesFind(st);
- Free(st);
- Free(dirname);
- doc->user_put_key=&JBPutKey;
- DocPrint(doc,
- "Key: $GREEN$Graphics $BLUE$Words $RED$No Nothing "
- "$BLACK$Incomplete $CYAN$Special$FG$\n\n"
- "$GREEN$<DEL>$FG$\tto delete a song.\n"
- "'$GREEN$0$FG$'-'$GREEN$9$FG$'\tto rate a song.\n"
- "'$GREEN$r$FG$'\tto get your reward from God.\n");
- while (tmpde) {
- if (!(i++%5))
- DocPrint(doc,"\n");
- if (FileOcc("Play(",tmpde->full_name,"")) {
- st=StrNew(tmpde->name);
- FileExtRem(st);
- s=DocRead(tmpde->full_name);
- doc_e=s->head.next;
- while (doc_e!=s && doc_e->type_u8!=DOCT_TEXT)
- doc_e=doc_e->next;
- rating='0';
- if (doc_e!=s && doc_e->type_u8==DOCT_TEXT) {
- if ('0'<=doc_e->tag[2]<='9')
- rating=doc_e->tag[2];
- if (StrMatch("incomplete",doc_e->tag))
- DocPrint(doc,"$BLACK$");
- else if (StrMatch("has graphics",doc_e->tag))
- DocPrint(doc,"$GREEN$");
- else if (StrMatch("has words",doc_e->tag))
- DocPrint(doc,"$BLUE$");
- else if (StrMatch("special",doc_e->tag))
- DocPrint(doc,"$CYAN$");
- else if (StrMatch("no nothing",doc_e->tag)) {
- DocPrint(doc,"$RED$");
- if (FileOcc("\\0",tmpde->full_name,"")) {
- s->cur_entry=doc_e->next;
- s->cur_col=0;
- DocEntryDel(s,doc_e);
- DocPrint(s,"//0 has words\n");
- DocWrite(s);
- }
- }
- DocPrint(doc,"$MU-UL,\"%c%-8ts\",LE=%d$ ",rating,st,tmpde);
- tmpde->user_data=JB_RUN_LEVEL_NULL;
- }
- DocDel(s);
- Free(st);
- }
- tmpde=tmpde->next;
- }
- DocPrint(doc,"\n$CYAN$$MU-UL,\"DONE\",LE=%d$\n",DOCM_CANCEL);
- while (TRUE) {
- if (_filename)
- tmpde=PopUpMenu(doc,DOF_INTERCEPT_TASK_END);
- else
- tmpde=PopUpMenu(doc);
- if (task)
- Kill(task);
- if (tmpde<=0) break;
- st2=StrNew(tmpde->name);
- if (_filename) {
- Free(*_filename);
- *_filename=StrNew(tmpde->full_name);
- }
- if (tmpde->user_data==JB_RUN_LEVEL_ONE) break; //<ESC>
- tmpde->user_data=JB_RUN_LEVEL_NULL; //Rst from <SPACE>
- FileExtRem(st2);
- st=MStrPrint("ExeFile(\"%s\");",tmpde->full_name);
- MusicSettingsRst;
- task=SingleSong(st,st2);
- Free(st2);
- Free(st);
- }
- DocDel(doc);
- DirTreeDel(tmpde1);
- } catch
- PutExcept;
- SettingsPop;
-}
- - - \ No newline at end of file diff --git a/public/src/Apps/Psalmody/JukePuppet.HC.HTML b/public/src/Apps/Psalmody/JukePuppet.HC.HTML deleted file mode 100644 index 8d6aa4c..0000000 --- a/public/src/Apps/Psalmody/JukePuppet.HC.HTML +++ /dev/null @@ -1,107 +0,0 @@ - - - - - JukePuppet.HC - - - - - U0 SongPuppet(CTask *task,I64 passes)
-{
- CDbgInfo *dbg_info;
- I64 i,start,end,rip,last_rip;
- CHashFun *tmpf=NULL;
- for (i=0;i<250 && TaskValidate(task);i++) {
- if (tmpf=HashFind("Song",task->hash_table,HTT_FUN))
- break;
- Sleep(1);
- }
- if (tmpf && (dbg_info=tmpf->dbg_info)) {
- start=dbg_info->body[0];
- end =dbg_info->body[dbg_info->max_line+1-dbg_info->min_line];
- last_rip=0;
- while (TRUE) {
- i=0;
- while (TaskValidate(task) && (rip=TaskCaller(task,i++))) {
- if (start<=rip<end) {
- if (rip<last_rip && --passes<=0)
- return;
- last_rip=rip;
- }
- }
- Sleep(1);
- }
- }
-}
-
-U0 JukeSongPuppet(CTask *juke_task,I64 passes,I64 song_num,U8 *name)
-{
- Bool found;
- CTask *task;
- I64 i;
-
- if (FileExtDot(name))
- FileExtRem(name);
- BirthWait(&juke_task->popup_task);
- TaskWait(juke_task->popup_task);
- PostMsg(juke_task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_UP+SCF_CTRL);
- TaskWait(juke_task->popup_task);
- for (i=0;i<song_num;i++) {
- PostMsg(juke_task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_RIGHT);
- TaskWait(juke_task->popup_task);
- }
-
- PostMsg(juke_task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- TaskWait(juke_task->popup_task);
- Sleep(500);
-
- found=FALSE;
- task=Fs->next_task;
- while (task!=Fs) {
- if (!StrCmp(task->task_title,name)) {
- found=TRUE;
- break;
- }
- task=task->next_task;
- }
-
- if (found) {//Position cursor on song title during song
- TaskWait(juke_task->popup_task);
- PostMsg(juke_task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_UP+SCF_CTRL);
- TaskWait(juke_task->popup_task);
- for (i=0;i<song_num;i++) {
- PostMsg(juke_task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_RIGHT);
- TaskWait(juke_task->popup_task);
- }
- SongPuppet(task,passes);
- }
- Kill(task);
-}
-
-public U0 JukeSongsPuppet(U8 *dirname="~/Psalmody",I64 passes=2,
- I64 start_song=0,I64 end_song=I64_MAX)
-{//Help make music video by puppeting JukeBox task.
- I64 i;
- CDirEntry *tmpde,*tmpde1;
- CTask *juke_task=User("JukeBox(0x%X);\n",dirname);
- F64 t0;
- Cd(dirname);
- tmpde1=FilesFind("*",FUF_RECURSE|FUF_JUST_TXT|FUF_JUST_FILES);
- for (tmpde=tmpde1,i=0;tmpde && i<start_song;i++)
- tmpde=tmpde->next;
- if (scrncast.record)
- t0=scrncast.t0_tS;
- else
- t0=tS;
- for (i=start_song;tmpde && i<end_song;i++) {
- "%12.6fs %s\n",tS-t0,tmpde->full_name;
- JukeSongPuppet(juke_task,passes,i,tmpde->name);
- tmpde=tmpde->next;
- }
- DirTreeDel(tmpde1);
- Kill(juke_task);
-}
- - - \ No newline at end of file diff --git a/public/src/Apps/Psalmody/Load.HC.HTML b/public/src/Apps/Psalmody/Load.HC.HTML deleted file mode 100644 index 760c5e7..0000000 --- a/public/src/Apps/Psalmody/Load.HC.HTML +++ /dev/null @@ -1,24 +0,0 @@ - - - - - Load.HC - - - - - #help_index "Snd/Music/Apps"
-
-Cd(__DIR__);;
-#include "JukeBox"
-#include "JukePuppet"
-#include "Psalmody"
-#include "PsalmodyCtrls"
-#include "PsalmodyDraw"
-#include "PsalmodyFile"
-#include "PsalmodyMain"
-
-#help_index ""
- - - \ No newline at end of file diff --git a/public/src/Apps/Psalmody/Psalmody.HC.HTML b/public/src/Apps/Psalmody/Psalmody.HC.HTML deleted file mode 100644 index 50423af..0000000 --- a/public/src/Apps/Psalmody/Psalmody.HC.HTML +++ /dev/null @@ -1,75 +0,0 @@ - - - - - Psalmody.HC - - - - - /*
-This uses four types of ctrls
-
- 1) The pull-down menu.
-
- 2) The CCtrl type for the tempo/stacatto sliders.
-
- 3) The active CDoc sprite bttns with macros for left/record/play/right.
-
- 4) Hand-made ctrls for the kbdgraphic, notes and staff.
-
-This uses four types of output
-
- 1) The CDoc for the text and bttns and kbdgraphic.
-
- 2) The Fs->draw_it() for the staff region, drawn every refresh.
-
- 3) The gr.dc persistent layer for the note chooser, meter chooser.The persistent layer is used during drag-and-drop.
-
- 4) The Fs->next_ctrl for the tempo/stacatto sliders.
-
-See GrUpdateTaskWin(), GrUpdateTasks() and GrUpdateScrn().
-*/
-
-#define PSMT_HEAD 0
-#define PSMT_NOTE 1
-#define PSMT_METER 2
-
-#define PSMf_SEL 0
-#define PSMF_SEL 1
-#define PSMf_SHARP 1
-#define PSMf_FLAT 2
-#define PSMf_TIE 3
-
-class PsmNote
-{
- PsmNote *next,*last;
- I64 x,y;
- U8 *word;
- I64 type,flags;
- I64 ona,meter_top,meter_bottom;
- I64 duration,width;
- U8 ascii[32];
-};
-
-//Tool types
-#define PSMTT_PTR_TOOL 0
-#define PSMTT_BOX_TOOL 1
-
-class PsmCtrl
-{
- PsmNote head;
- PsmNote clip;
- CMenuEntry *incomplete_entry,*record_entry;
- I64 scrn_x,tool;
- PsmNote *cur_note;
- CDC *dc2;
- Bool playing;
-} psm;
-
-U8 *psm_note_lst="A\0A#\0B\0C\0C#\0D\0D#\0E\0F\0F#\0G\0G#\0";
-U8 psm_note_map[12]={6,6,5,4,4,3,3,2,1,1,0,0};
-U8 psm_note_inverse_map[7]={10,8,7,5,3,2,0};
- - - \ No newline at end of file diff --git a/public/src/Apps/Psalmody/PsalmodyCtrls.HC.HTML b/public/src/Apps/Psalmody/PsalmodyCtrls.HC.HTML deleted file mode 100644 index 0633cd5..0000000 --- a/public/src/Apps/Psalmody/PsalmodyCtrls.HC.HTML +++ /dev/null @@ -1,101 +0,0 @@ - - - - - PsalmodyCtrls.HC - - - - - #define TEMPO_SPACING 15
-#define TEMPO_RANGE 80
-#define TEMPO_BORDER 2
-
-class TempoState
-{
- I64 tempo,stacatto;
-} tempo_state;
-
-U0 DrawTempoCtrl(CDC *dc,CCtrl *c)
-{
- TempoState *s=c->state;
-
- dc->color=LTGREEN;
- GrRect(dc, c->left,c->top,TEMPO_SPACING*3+2,TEMPO_SPACING*2+TEMPO_RANGE);
- dc->color=BLACK;
- GrRect(dc, c->left+TEMPO_BORDER,c->top+TEMPO_BORDER,
- TEMPO_SPACING*3+2-2*TEMPO_BORDER,
- TEMPO_SPACING*2+TEMPO_RANGE-2*TEMPO_BORDER);
- dc->color=WHITE;
- GrLine(dc,c->left+TEMPO_SPACING,c->top+TEMPO_SPACING,
- c->left+TEMPO_SPACING,c->top+TEMPO_SPACING+TEMPO_RANGE-1);
- GrLine(dc,c->left+2*TEMPO_SPACING+1,c->top+TEMPO_SPACING,
- c->left+2*TEMPO_SPACING+1,c->top+TEMPO_SPACING+TEMPO_RANGE-1);
-
- dc->color=LTGREEN;
- GrPrint(dc,c->left+TEMPO_SPACING-FONT_WIDTH/2,
- c->top+TEMPO_SPACING+TEMPO_RANGE+3,"%d",s->tempo*10/TEMPO_RANGE);
- GrPrint(dc,c->left+2*TEMPO_SPACING+1-FONT_WIDTH/2,
- c->top+TEMPO_SPACING+TEMPO_RANGE+3,"%d",
- s->stacatto*10/TEMPO_RANGE);
- GrRect(dc,c->left+TEMPO_SPACING-3,
- c->top+TEMPO_SPACING+TEMPO_RANGE-1-s->tempo-2 ,7,5);
- GrRect(dc,c->left+2*TEMPO_SPACING+1-3,
- c->top+TEMPO_SPACING+TEMPO_RANGE-1-s->stacatto-2,7,5);
- dc->color=YELLOW;
- GrRect(dc,c->left+TEMPO_SPACING-2,
- c->top+TEMPO_SPACING+TEMPO_RANGE-1-s->tempo-1 ,5,3);
- GrRect(dc,c->left+2*TEMPO_SPACING+1-2,
- c->top+TEMPO_SPACING+TEMPO_RANGE-1-s->stacatto-1,5,3);
-
- dc->color=GREEN;
- GrVPrint(dc,c->left+TEMPO_BORDER+2,c->top+TEMPO_SPACING+2,"Tempo");
- GrVPrint(dc,c->right-TEMPO_BORDER-2-FONT_WIDTH,
- c->top+TEMPO_SPACING+2,"Stacatto");
-}
-
-U0 UpdateDerivedTempoCtrl(CCtrl *c)
-{
- TempoState *s=c->state;
- c->right=c->left+TEMPO_SPACING*3+2;
- c->bottom=c->top+TEMPO_SPACING*2+TEMPO_RANGE;
- s->tempo =ClampI64(s->tempo,0,TEMPO_RANGE-1);
- s->stacatto=ClampI64(s->stacatto,0,TEMPO_RANGE-1);
-}
-
-U0 LeftClickTempo(CCtrl *c,I64 x,I64 y,Bool)
-{
- TempoState *s=c->state;
- if (x<(c->right+c->left)/2)
- s->tempo=TEMPO_RANGE-1-(y-(c->top+TEMPO_SPACING));
- else
- s->stacatto=TEMPO_RANGE-1-(y-(c->top+TEMPO_SPACING));
- if (c->update_derived_vals)
- (*c->update_derived_vals)(c);
-}
-
-CCtrl *TempoNew()
-{
- CCtrl *c=CAlloc(sizeof(CCtrl));
- c->win_task=Fs;
- c->flags=CTRLF_SHOW|CTRLF_CAPTURE_LEFT_MS;
- c->type=CTRLT_GENERIC;
- c->state=&tempo_state;
- c->draw_it=&DrawTempoCtrl;
- c->left_click=&LeftClickTempo;
- c->update_derived_vals=&UpdateDerivedTempoCtrl;
- c->left=396;
- c->top=96;
- QueIns(c,Fs->last_ctrl);
- TaskDerivedValsUpdate;
- return c;
-}
-
-U0 TempoDel(CCtrl *c)
-{
- QueRem(c);
- Free(c);
-}
- - - \ No newline at end of file diff --git a/public/src/Apps/Psalmody/PsalmodyDraw.HC.HTML b/public/src/Apps/Psalmody/PsalmodyDraw.HC.HTML deleted file mode 100644 index 0ebb4df..0000000 --- a/public/src/Apps/Psalmody/PsalmodyDraw.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - PsalmodyDraw.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Apps/Psalmody/PsalmodyFile.HC.HTML b/public/src/Apps/Psalmody/PsalmodyFile.HC.HTML deleted file mode 100644 index 73b879e..0000000 --- a/public/src/Apps/Psalmody/PsalmodyFile.HC.HTML +++ /dev/null @@ -1,439 +0,0 @@ - - - - - PsalmodyFile.HC - - - - - U0 PsmNoteDel(PsmNote *tmpn)
-{
- Free(tmpn->word);
- Free(tmpn);
-}
-
-PsmNote *PsmNoteCopy(PsmNote *tmpn)
-{
- PsmNote *tmpn1=MAllocIdent(tmpn);
- if (tmpn->word)
- tmpn1->word=StrNew(tmpn->word);
- else
- tmpn1->word=NULL;
- return tmpn1;
-}
-
-U0 PsmSongDel(PsmNote *head)
-{
- PsmNote *tmpn,*tmpn1;
- tmpn=head->next;
- while (tmpn!=head) {
- tmpn1=tmpn->next;
- PsmNoteDel(tmpn);
- tmpn=tmpn1;
- }
- QueInit(head);
-}
-
-U0 PsmCutToClip()
-{
- PsmNote *tmpn,*tmpn1;
- PsmSongDel(&psm.clip);
- tmpn=psm.head.next;
- while (tmpn!=&psm.head) {
- tmpn1=tmpn->next;
- if (tmpn->flags&PSMF_SEL) {
- if (psm.cur_note==tmpn)
- psm.cur_note=tmpn->next;
- QueRem(tmpn);
- tmpn->flags&=~PSMF_SEL;
- QueIns(tmpn,psm.clip.last);
- }
- tmpn=tmpn1;
- }
-}
-
-U0 PsmPasteClip()
-{
- PsmNote *tmpn,*tmpn1;
- tmpn=psm.clip.next;
- while (tmpn!=&psm.clip) {
- tmpn1=PsmNoteCopy(tmpn);
- QueIns(tmpn1,psm.cur_note->last);
- tmpn=tmpn->next;
- }
-}
-
-U0 PsmCopyToClip()
-{
- PsmNote *tmpn,*tmpn1;
- PsmSongDel(&psm.clip);
- tmpn=psm.head.next;
- while (tmpn!=&psm.head) {
- if (tmpn->flags&PSMF_SEL) {
- tmpn->flags&=~PSMF_SEL;
- tmpn1=PsmNoteCopy(tmpn);
- QueIns(tmpn1,psm.clip.last);
- }
- tmpn=tmpn->next;
- }
-}
-
-PsmNote *PsmFindNote(I64 x,I64)
-{
- PsmNote *tmpn=psm.head.next;
- PsmRecalcNoteXY;
- x+=PSM_NOTE_SPACING/2;
- while (x>tmpn->next->x && tmpn!=&psm.head)
- tmpn=tmpn->next;
- return tmpn;
-}
-
-U8 *PsmMusicSetOctave(U8 *st,I64 *psm_octave)
-{
- while ('0'<=*st<='9')
- *psm_octave=*st++ -'0';
- return st;
-}
-
-U8 *PsmMusicSetNoteLen(U8 *st,F64 *psm_duration)
-{
- Bool cont=TRUE;
- do {
- switch (*st++) {
- case 'w': *psm_duration=4.0; break;
- case 'h': *psm_duration=2.0; break;
- case 'q': *psm_duration=1.0; break;
- case 'e': *psm_duration=0.5; break;
- case 's': *psm_duration=0.25; break;
- case 't': *psm_duration=2.0* *psm_duration/3.0; break;
- case '.': *psm_duration=1.5* *psm_duration; break;
- default:
- st--;
- cont=FALSE;
- }
- } while (cont);
- return st;
-}
-
-U0 PsmLoadSongStr(U8 *st,I64 *psm_octave,F64 *psm_duration)
-{
- PsmNote *tmpn,*tmpn1;
- I64 note,i=0;
- while (*st) {
- tmpn=CAlloc(sizeof(PsmNote));
- while (*st && !('A'<=*st<='G') && *st!='R') {
- if (*st=='M') {
- tmpn1=CAlloc(sizeof(PsmNote));
- tmpn1->type=PSMT_METER;
- st++;
- if ('1'<=*st<='9')
- tmpn1->meter_top=*st++-'0';
- else
- tmpn1->meter_top=4;
- if (*st=='/')
- st++;
- if ('1'<=*st<='9')
- tmpn1->meter_bottom=*st++-'0';
- else
- tmpn1->meter_bottom=4;
- PsmSetWidth(tmpn1);
- QueIns(tmpn1,psm.head.last);
- }
- while (*st=='(') {
- Bts(&tmpn->flags,PSMf_TIE);
- st++;
- }
- st=PsmMusicSetOctave(st,psm_octave);
- st=PsmMusicSetNoteLen(st,psm_duration);
- }
- if (!*st) {
- PsmNoteDel(tmpn);
- break;
- }
- note=*st++-'A';
- if (note<7) {
- note=music.note_map[note];
- if (*st=='b') {
- Bts(&tmpn->flags,PSMf_FLAT);
- note--;
- st++;
- if (note<0) //Ab
- note=11;
- else if (note==2) //Cb
- *psm_octave-=1;
- } else if (*st=='#') {
- Bts(&tmpn->flags,PSMf_SHARP);
- note++;
- st++;
- if (note>11) //G#
- note=0;
- else if (note==3) //B#
- *psm_octave+=1;
- }
- tmpn->ona=Note2Ona(note,*psm_octave);
- } else
- tmpn->ona=0;
- if (*psm_duration<=2*.25/3)
- i=0;
- else if (*psm_duration<=.25)
- i=1;
- else if (*psm_duration<=2*.5/3)
- i=2;
- else if (*psm_duration<=.5)
- i=3;
- else if (*psm_duration<=2.0/3)
- i=4;
- else if (*psm_duration<=.5*1.5)
- i=5;
- else if (*psm_duration<=1.0)
- i=6;
- else if (*psm_duration<=1.5)
- i=7;
- else if (*psm_duration<=2.0)
- i=8;
- else if (*psm_duration<=3.0)
- i=9;
- else if (*psm_duration<=4.0)
- i=10;
- else
- i=11;
- tmpn->duration=i;
- tmpn->type=PSMT_NOTE;
- PsmSetWidth(tmpn);
- QueIns(tmpn,psm.cur_note->last);
- }
-}
-
-U0 PsmLoadSong(U8 *filename,I64 *psm_octave,F64 *psm_duration)
-{
- U8 *st;
- PsmNote *tmpn;
- CCmpCtrl *cc=CmpCtrlNew(MStrPrint("#include \"%s\"",filename));
- if (FileOcc("incomplete",filename,""))
- psm.incomplete_entry->checked=TRUE;
- else
- psm.incomplete_entry->checked=FALSE;
- while (Lex(cc)) {
- if (cc->token==TK_IDENT)
- if (!StrCmp(cc->cur_str,"Play")) {
- if (Lex(cc)=='(')
- if (Lex(cc)==TK_STR) {
- tmpn=psm.head.last;
- st=LexExtStr(cc);
- PsmLoadSongStr(st,psm_octave,psm_duration);
- if (cc->token==',') {
- if (Lex(cc)==TK_STR) {
- st=LexExtStr(cc);
- do {
- do tmpn=tmpn->next;
- while (tmpn!=&psm.head && tmpn->type==PSMT_METER);
- if (tmpn!=&psm.head)
- tmpn->word=StrNew(st);
- st+=StrLen(st)+1;
- } while (*st);
- }
- }
- }
- } else if (!StrCmp(cc->cur_str,"music") &&
- Lex(cc)=='.' && Lex(cc)==TK_IDENT) {
- if (!StrCmp(cc->cur_str,"tempo")) {
- if (Lex(cc)=='=' && Lex(cc)==TK_F64) {
- music.tempo=cc->cur_f64-0.0005;
- tempo_state.tempo=Round(TEMPO_RANGE*(music.tempo-0.5)/4.4);
- }
- } else if (!StrCmp(cc->cur_str,"stacatto_factor")) {
- if (Lex(cc)=='=' && Lex(cc)==TK_F64) {
- music.stacatto_factor=cc->cur_f64-0.0005;
- tempo_state.stacatto=
- Round(TEMPO_RANGE*(music.stacatto_factor-0.12)/0.88);
- }
- }
- }
- }
- CmpCtrlDel(cc);
-}
-
-U8 *PsmCvtSong()
-{
- PsmNote *tmpn;
- U8 *st,*src,*dst;
- I64 i,ona,note,octave,last_octave,last_duration;
-
- i=0;
- tmpn=psm.head.next;
- last_octave=I64_MIN;
- last_duration=-1;
- while (tmpn!=&psm.head) {
- dst=&tmpn->ascii;
- if (tmpn->type==PSMT_METER) {
- *dst++='M';
- *dst++=tmpn->meter_top+'0';
- *dst++='/';
- *dst++=tmpn->meter_bottom+'0';
- } else {
- if (tmpn->ona) {
- ona=tmpn->ona;
- if (Bt(&tmpn->flags,PSMf_SHARP))
- ona--;
- if (Bt(&tmpn->flags,PSMf_FLAT))
- ona++;
- octave=Ona2Octave(ona);
- note =Ona2Note (ona);
- note=music.note_map[*LstSub(note,psm_note_lst)-'A'];
- }
- if (Bt(&tmpn->flags,PSMf_TIE))
- *dst++='(';
- if (octave!=last_octave && tmpn->ona) {
- *dst++=octave+'0';
- last_octave=octave;
- }
- if (tmpn->duration!=last_duration) {
- src=LstSub(tmpn->duration,psm_duration_lst);
- *dst++=src[0];
- if (src[1])
- *dst++=src[1];
- last_duration=tmpn->duration;
- }
- if (tmpn->ona) {
- src=LstSub(note,psm_note_lst);
- *dst++=src[0];
- if (src[1])
- *dst++=src[1];
- else if (Bt(&tmpn->flags,PSMf_FLAT))
- *dst++='b';
- else if (Bt(&tmpn->flags,PSMf_SHARP))
- *dst++='#';
- } else
- *dst++='R';
- }
- *dst++=0;
- i+=StrLen(tmpn->ascii);
- tmpn=tmpn->next;
- }
-
- st=MAlloc(i+1);
- dst=st;
- tmpn=psm.head.next;
- while (tmpn!=&psm.head) {
- StrCpy(dst,tmpn->ascii);
- dst+=StrLen(tmpn->ascii);
- tmpn=tmpn->next;
- }
- *dst++=0;
- return st;
-}
-
-U8 *PsmSaveSong(U8 *dirname,U8 *full_filename)
-{
- CDoc *doc=DocNew(full_filename);
- Bool has_words;
- PsmNote *tmpn,*tmpn1;
- F64 measure_len=4,two_measure_left=2*measure_len;
- I64 ch;
- U8 *ptr;
-
- Free(PsmCvtSong); //set tmpn->ascii;
-
- music.tempo=4.4*tempo_state.tempo/TEMPO_RANGE+0.5;
- music.stacatto_factor=0.88*tempo_state.stacatto/TEMPO_RANGE+0.12;
-
- has_words=FALSE;
- tmpn=psm.head.next;
- while (tmpn!=&psm.head) {
- if (PsmHasWords(tmpn->word)) has_words=TRUE;
- tmpn=tmpn->next;
- }
- if (psm.incomplete_entry->checked)
- DocPrint(doc,"//0 incomplete\n");
- else if (has_words)
- DocPrint(doc,"//0 has words\n");
- else
- DocPrint(doc,"//0 no nothing\n");
-
- DocPrint(doc,
- "U0 Song()\n"
- "{\n"
- "Fs->task_end_cb=&SndTaskEndCB;\n"
- "MusicSettingsRst;\n"
- "music.tempo=%6.3f;\n"
- "music.stacatto_factor=%6.3f;\n"
- "try {\n"
- "while (!ScanKey) {\n"
- "\tPlay(\"",music.tempo+0.0005,music.stacatto_factor+0.0005);
-
- tmpn=psm.head.next;
- tmpn1=tmpn;
- has_words=FALSE;
- while (tmpn!=&psm.head) {
- DocPrint(doc,"%s",tmpn->ascii);
- if (PsmHasWords(tmpn->word)) has_words=TRUE;
- if (tmpn->type==PSMT_METER) {
- measure_len=tmpn->meter_top*4.0/tmpn->meter_bottom;
- two_measure_left=0;
- } else
- two_measure_left-=psm_durations[tmpn->duration];
- tmpn=tmpn->next;
- if (two_measure_left<0.001 && tmpn!=&psm.head) {
- if (has_words) {
- DocPrint(doc,"\",\n\t\t\"");
- while (tmpn1!=tmpn) {
- if (tmpn1->type!=PSMT_METER) {
- if (ptr=tmpn1->word) {
- while (ch=*ptr) {
- if (ch==CH_SPACE)
- *ptr=CH_SHIFT_SPACE;
- ptr++;
- }
- DocPrint(doc,"%Q\\0",tmpn1->word);
- } else
- DocPrint(doc,"%c\\0",CH_SHIFT_SPACE);
- }
- tmpn1=tmpn1->next;
- }
- }
- DocPrint(doc,"\");\n"
- "\tPlay(\"");
- two_measure_left=2*measure_len;
- tmpn1=tmpn;
- has_words=FALSE;
- }
- }
- if (has_words) {
- DocPrint(doc,"\",\n\t\t\"");
- while (tmpn1!=tmpn) {
- if (tmpn1->type!=PSMT_METER) {
- if (ptr=tmpn1->word) {
- while (ch=*ptr) {
- if (ch==CH_SPACE)
- *ptr=CH_SHIFT_SPACE;
- ptr++;
- }
- DocPrint(doc,"%Q\\0",tmpn1->word);
- } else
- DocPrint(doc,"%c\\0",CH_SHIFT_SPACE);
- }
- tmpn1=tmpn1->next;
- }
- }
- DocPrint(doc,"\");\n"
- "}\n"
- "} catch\n"
- "PutExcept;\n"
- "Snd;\n"
- "}\n"
- "\n"
- "Song;\n");
- DocRecalc(doc);
- if (full_filename)
- Free(full_filename);
- else
- StrPrint(doc->filename.name,"%s/Tmp.HC.Z",dirname);
- DocWrite(doc,TRUE);
- full_filename=StrNew(doc->filename.name);
- DocDel(doc);
- return full_filename;
-}
- - - \ No newline at end of file diff --git a/public/src/Apps/Psalmody/PsalmodyMain.HC.HTML b/public/src/Apps/Psalmody/PsalmodyMain.HC.HTML deleted file mode 100644 index eea8ec2..0000000 --- a/public/src/Apps/Psalmody/PsalmodyMain.HC.HTML +++ /dev/null @@ -1,810 +0,0 @@ - - - - - PsalmodyMain.HC - - - - - #define PSMR_FLAT -8
-#define PSMR_SHARP -7
-#define PSMR_TIE -6
-#define PSMR_REST -5
-#define PSMR_INS_NOTE -4
-#define PSMR_DELETE_NOTE -3
-#define PSMR_SET_WORD -2
-
-F64 PopUpDuration()
-{
- I64 i;
- CDoc *doc=DocNew;
- DocPrint(doc,"$GREEN$$MU,\"Set Word\",LE=PSMR_SET_WORD$\n"
- "$MU,\"Toggle Sharp\",LE=PSMR_SHARP$\n"
- "$MU,\"Toggle Flat\",LE=PSMR_FLAT$\n"
- "$MU,\"Toggle Tie\",LE=PSMR_TIE$\n"
- "$MU,\"Make Rest\",LE=PSMR_REST$\n"
- "$MU,\"Insert Note\",LE=PSMR_INS_NOTE$\n"
- "$MU,\"Delete Note\",LE=PSMR_DELETE_NOTE$\n\n");
- for (i=0;i<PSM_DURATIONS_NUM;i++)
- DocPrint(doc,"$MU,\"%7.5f\",LE=%d$\n",psm_durations[i],i);
- DocPrint(doc,"\n$MU,\"CANCEL\",LE=DOCM_CANCEL$\n");
- i=PopUpMenu(doc);
- DocDel(doc);
- return i;
-}
-
-U0 PsmRightClick(I64 x,I64 y)
-{
- U8 *st,*st2;
- PsmNote *tmpn,*tmpn1;
- I64 i,old_doc_flags;
- if (DocPut) old_doc_flags=DocPut->flags;
- psm.cur_note=tmpn=PsmFindNote(x,y);
- if (tmpn!=&psm.head) {
- Fs->win_inhibit=WIG_USER_TASK_DFT;
- i=PopUpDuration;
- if (0<=i<PSM_DURATIONS_NUM) {
- if (tmpn->type==PSMT_NOTE)
- tmpn->duration=i;
- } else {
- switch (i) {
- case PSMR_REST:
- if (tmpn->type==PSMT_NOTE)
- tmpn->ona=0;
- break;
- case PSMR_SHARP:
- if (tmpn->type==PSMT_NOTE && tmpn->ona) {
- if (Btr(&tmpn->flags,PSMf_FLAT))
- tmpn->ona++;
- if (Btc(&tmpn->flags,PSMf_SHARP))
- tmpn->ona--;
- else
- tmpn->ona++;
- }
- break;
- case PSMR_FLAT:
- if (tmpn->type==PSMT_NOTE && tmpn->ona) {
- if (Btr(&tmpn->flags,PSMf_SHARP))
- tmpn->ona--;
- if (Btc(&tmpn->flags,PSMf_FLAT))
- tmpn->ona++;
- else
- tmpn->ona--;
- }
- break;
- case PSMR_TIE:
- if (tmpn->type==PSMT_NOTE)
- Btc(&tmpn->flags,PSMf_TIE);
- break;
- case PSMR_SET_WORD:
- if (tmpn->type==PSMT_NOTE) {
- if (DocPut) DocPut->flags&=~DOCF_FORM;
- if (PsmHasWords(tmpn->word))
- st2=MStrPrint("\nWord(\"%Q\"):",tmpn->word);
- else
- st2=MStrPrint("\nWord(\"\"):");
- DocBottom;
- st=GetStr(st2);
- Free(st2);
- Free(tmpn->word);
- if (*st) {
- tmpn->word=MStrPrint("%q",st);
- Free(st);
- } else
- tmpn->word=StrNew("");
- if (DocPut) DocPut->flags=DocPut->flags&
- ~DOCF_FORM|old_doc_flags&DOCF_FORM;
- }
- break;
- case PSMR_INS_NOTE:
- tmpn1=PsmNoteCopy(tmpn);
- QueIns(tmpn1,tmpn);
- break;
- case PSMR_DELETE_NOTE:
- psm.cur_note=tmpn->next;
- QueRem(tmpn);
- PsmNoteDel(tmpn);
- break;
- }
- }
- PsmSetWidth(psm.cur_note);
- Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS
- -WIF_SELF_BORDER-WIF_FOCUS_TASK_MENU-WIF_SELF_CTRLS;
- }
-}
-
-U0 PsmLeftClickPickNoteBox(I64 duration)
-{
- I64 o,n,msg_code,arg1,arg2;
- PsmNote *tmpn,*tmpn1;
- do {
- msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP|1<<MSG_MS_MOVE);
- if (msg_code==MSG_MS_MOVE) {
- DrawDC2;
- DrawNote(psm.dc2,arg1,arg2,duration);
- }
- } while (msg_code!=MSG_MS_L_UP);
- if (arg2<13*FONT_HEIGHT) {
- if (arg1>psm.head.last->x)
- tmpn1=psm.head.last;
- else if (arg1<psm.head.next->x)
- tmpn1=&psm.head;
- else
- tmpn1=PsmFindNote(arg1-PSM_NOTE_SPACING/2,arg2);
- tmpn=CAlloc(sizeof(PsmNote));
- tmpn->type=PSMT_NOTE;
- arg2=arg2/4-15;
- n=arg2%7;
- o=4+arg2/-7;
- if (n<0) {
- n+=7;
- o++;
- }
- n=psm_note_inverse_map[n];
- if (n<3)
- o--;
- tmpn->ona=Note2Ona(n,o);
- tmpn->duration=duration;
- PsmSetWidth(tmpn);
- QueIns(tmpn,tmpn1);
- psm.cur_note=tmpn->next;
- }
- DrawDC2;
-}
-
-U0 PsmLeftClickPickMeterBox(I64 top,I64 bottom)
-{
- I64 msg_code,arg1,arg2;
- PsmNote *tmpn,*tmpn1;
- do {
- msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP|1<<MSG_MS_MOVE);
- if (msg_code==MSG_MS_MOVE) {
- DrawDC2;
- DrawTimeSignature(psm.dc2,arg1,arg2,top,bottom);
- }
- } while (msg_code!=MSG_MS_L_UP);
- if (arg2<13*FONT_HEIGHT) {
- if (arg1>=psm.head.x)
- tmpn1=psm.head.last;
- else if (arg1<psm.head.next->x)
- tmpn1=&psm.head;
- else
- tmpn1=PsmFindNote(arg1-PSM_NOTE_SPACING/2,arg2);
- tmpn=CAlloc(sizeof(PsmNote));
- tmpn->type=PSMT_METER;
- tmpn->meter_top=top;
- tmpn->meter_bottom=bottom;
- PsmSetWidth(tmpn);
- QueIns(tmpn,tmpn1);
- psm.cur_note=tmpn->next;
- }
- DrawDC2;
-}
-
-U0 PsmLeftClickStaffPtr(I64 x,I64 y)
-{
- PsmNote *tmpn,*tmpn1;
- I64 o,n,msg_code,arg1,arg2,n_original,o_original;
- psm.cur_note=tmpn=PsmFindNote(x,y);
- if (tmpn!=&psm.head) {
- if (tmpn->type==PSMT_NOTE) {
- o_original=Ona2Octave(tmpn->ona);
- n_original=Ona2Note (tmpn->ona);
- do {
- msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP|1<<MSG_MS_MOVE);
- if (msg_code==MSG_MS_L_UP) {
- tmpn1=PsmFindNote(arg1,arg2);
- if (tmpn1==&psm.head || tmpn1==tmpn)
- goto move_note;
- else {
- Free(tmpn1->word);
- tmpn1->word=tmpn->word;
- tmpn->word=NULL;
- tmpn->ona=Note2Ona(n_original,o_original);
- }
- } else {
-move_note:
- arg2=arg2/4-15;
- n=arg2%7;
- o=4+arg2/-7;
- if (n<0) {
- n+=7;
- o++;
- }
- n=psm_note_inverse_map[n];
- if (n<3)
- o--;
- tmpn->ona=Note2Ona(n,o);
- }
- } while (msg_code!=MSG_MS_L_UP);
- PsmSetWidth(tmpn);
- }
- }
-}
-
-U0 PsmLeftClickStaffBox(I64 x,I64 y)
-{
- I64 msg_code,arg1,arg2;
- do {
- msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP|1<<MSG_MS_MOVE);
- DrawDC2;
- psm.dc2->color=ROPF_DITHER+WHITE<<16+BLACK;
- GrBorder(psm.dc2,x,y,arg1,arg2);
- if (msg_code==MSG_MS_L_UP) {
- if (x>arg1) SwapI64(&x,&arg1);
- PsmMarkSel(x,arg1,TRUE);
- }
- } while (msg_code!=MSG_MS_L_UP);
- DrawDC2;
-}
-
-U0 PsmLeftClick(I64 x,I64 y)
-{
- I64 duration,top,bottom;
- if (y<13*FONT_HEIGHT) {
- if (psm.tool==PSMTT_PTR_TOOL)
- PsmLeftClickStaffPtr(x,y);
- else
- PsmLeftClickStaffBox(x,y);
- } else {
- duration=PsmGetPickNoteBoxDuration(x,y);
- if (0<=duration<PSM_DURATIONS_NUM)
- PsmLeftClickPickNoteBox(duration);
- else if (PsmGetPickMeterBox(x,y,&top,&bottom))
- PsmLeftClickPickMeterBox(top,bottom);
- else if (PsmGetPickToolBox(x,y))
- DrawDC2;
- }
-}
-
-U8 PsmCvtDuration(F64 d)
-{
- F64 d1,d2;
- I64 j;
- for (j=0;j<PSM_DURATIONS_NUM;j++) {
- d1=psm_durations[j];
- d2=psm_durations[j+1];
- if (d<d1*d2/(d1+d2))
- return j;
- }
- return 0;
-}
-
-#define PSM_KEYS_NUM 20
-class PsmKey
-{
- U8 x,w,h,ascii;
-};
-
-#define PSM_W_W 16
-#define PSM_W_H 36
-#define PSM_B_W 8
-#define PSM_B_H 20
-
-PsmKey psm_kbd[PSM_KEYS_NUM]={
- { 2*PSM_W_W-4,PSM_B_W,PSM_B_H,'e' },
- { 3*PSM_W_W-4,PSM_B_W,PSM_B_H,'r' },
- { 4*PSM_W_W-4,PSM_B_W,PSM_B_H,'t' },
- { 6*PSM_W_W-4,PSM_B_W,PSM_B_H,'u' },
- { 7*PSM_W_W-4,PSM_B_W,PSM_B_H,'i' },
- { 9*PSM_W_W-4,PSM_B_W,PSM_B_H,'p' },
- {10*PSM_W_W-4,PSM_B_W,PSM_B_H,'[' },
- {11*PSM_W_W-4,PSM_B_W,PSM_B_H,']' },
-
- { 0*PSM_W_W,PSM_W_W,PSM_W_H,'a' },
- { 1*PSM_W_W,PSM_W_W,PSM_W_H,'s' },
- { 2*PSM_W_W,PSM_W_W,PSM_W_H,'d' },
- { 3*PSM_W_W,PSM_W_W,PSM_W_H,'f' },
- { 4*PSM_W_W,PSM_W_W,PSM_W_H,'g' },
- { 5*PSM_W_W,PSM_W_W,PSM_W_H,'h' },
- { 6*PSM_W_W,PSM_W_W,PSM_W_H,'j' },
- { 7*PSM_W_W,PSM_W_W,PSM_W_H,'k' },
- { 8*PSM_W_W,PSM_W_W,PSM_W_H,'l' },
- { 9*PSM_W_W,PSM_W_W,PSM_W_H,';' },
- {10*PSM_W_W,PSM_W_W,PSM_W_H,'\'' },
- {11*PSM_W_W,PSM_W_W,PSM_W_H,'\n'},
-};
-
-U0 PsmDownKey(I64 x,I64 y)
-{
- I64 i;
- PsmKey *o;
- y-=FONT_HEIGHT*13;
- if (0<=y<PSM_W_H) {
- x-=16;
- for (i=0;i<PSM_KEYS_NUM;i++) {
- o=&psm_kbd[i];
- if (o->x<=x<o->x+o->w && y<o->h) {
- Msg(MSG_KEY_DOWN,o->ascii,0);
- return;
- }
- }
- }
-}
-
-U0 PsmUpKey(I64 x,I64 y)
-{
- I64 i;
- PsmKey *o;
- y-=FONT_HEIGHT*13;
- if (0<=y<PSM_W_H) {
- x-=16;
- for (i=0;i<PSM_KEYS_NUM;i++) {
- o=&psm_kbd[i];
- if (o->x<=x<o->x+o->w && y<o->h) {
- Msg(MSG_KEY_UP,o->ascii,0);
- return;
- }
- }
- }
-}
-
-U0 PsmPushMode(I64 psm_octave)
-{
- Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS
- -WIF_SELF_BORDER-WIF_FOCUS_TASK_MENU-WIF_SELF_CTRLS;
- PsmMenu(psm_octave);
-}
-
-U0 PsmPopMode()
-{
- Fs->win_inhibit=WIG_USER_TASK_DFT;
- DCFill;
-}
-
-#define PSMF_CD 1
-#define PSMF_INCOMPLETE 2
-
-U0 Psalmody(U8 *dirname="~/Psalmody")
-{
- Bool was_playing,is_null=TRUE,was_null=TRUE;
- I64 arg1,arg2,msg_code=0,col,ona=0,last_ona=0,
- psm_octave=4,timeout_val,timeout_val2,old_doc_flags;
- U8 *filename=NULL,*st,*st2;
- PsmNote *tmpn;
- F64 psm_duration=1.0,d,evt_time=tS,note_down_time=tS;
- CCtrl *c=TempoNew;
-
- if (DocPut) old_doc_flags=DocPut->flags;
- SettingsPush; //See SettingsPush
-
- MusicSettingsRst;
- tempo_state.tempo=Round(TEMPO_RANGE*(music.tempo-0.5)/4.4);
- tempo_state.stacatto=Round(TEMPO_RANGE*(music.stacatto_factor-0.12)/0.88);
-
- if (DocPut) DocPut->flags|=DOCF_FORM;
-
- MemSet(&psm,0,sizeof(PsmCtrl));
- psm.scrn_x=0;
- psm.head.next=psm.head.last=&psm.head;
- psm.clip.next=psm.clip.last=&psm.clip;
- psm.cur_note=&psm.head;
- psm.dc2=DCAlias;
-
- MenuPush(
- "File {"
- " New(,'.');"
- " ChgDir(MSG_CMD,PSMF_CD);"
- " Open(,CH_CTRLO);"
- " SaveAs(,CH_CTRLA);"
- " Abort(,CH_SHIFT_ESC);"
- " Exit(,CH_ESC);"
- "}"
- "Edit {"
- " Cut(,CH_CTRLX);"
- " Copy(,CH_CTRLC);"
- " Paste(,CH_CTRLV);"
- " RightMenu(,'\n');"
- " BackSpace(,CH_BACKSPACE);"
- " DeleteNote(,,SC_DELETE);"
- " ClearSong(,'.');"
- " Left(,,SC_CURSOR_LEFT);"
- " Right(,,SC_CURSOR_RIGHT);"
- " GoBegin(,,0x4CB0000044B);"
- " GoEnd(,,0x4CD0000044D);"
- "}"
- "Song {"
- " Play(,'x');"
- " Record(,'z');"
- " Random(,',');"
- " MarkIncomplete(MSG_CMD,PSMF_INCOMPLETE);"
- "}"
- "Snd {"
- " Octave1(,'1');"
- " Octave2(,'2');"
- " Octave3(,'3');"
- " Octave4(,'4');"
- " Octave5(,'5');"
- " Octave6(,'6');"
- " Octave7(,'7');"
- "}"
- "Help {"
- " Help(,,SC_F1);"
- "}"
- );
- psm.incomplete_entry=MenuEntryFind(Fs->cur_menu,"Song/MarkIncomplete");
- psm.record_entry=MenuEntryFind(Fs->cur_menu,"Song/Record");
-
- AutoComplete;
- WinBorder;
- WinMax;
-
- dirname=StrNew(dirname);
- PsmPushMode(psm_octave);
- col=0;
- Fs->draw_it=&DrawIt;
-
- try {
- while (TRUE) {
- was_playing=FALSE;
-mo_start:
- if (ms.pos_text.y-Fs->win_top<18)
- msg_code=GetMsg(&arg1,&arg2,1<<MSG_KEY_DOWN|1<<MSG_KEY_UP|
- 1<<MSG_MS_L_DOWN|1<<MSG_MS_L_UP|1<<MSG_MS_R_UP|
- 1<<MSG_MS_MOVE|1<<MSG_CMD);
- else
- msg_code=GetMsg(&arg1,&arg2,1<<MSG_KEY_DOWN|1<<MSG_KEY_UP|
- 1<<MSG_MS_MOVE|1<<MSG_CMD);
-mo_got_msg:
- if (msg_code==MSG_KEY_DOWN && arg1==CH_SPACE && !arg2) {
-//The Window Mgr sets the Doc cur_entry to a bttn
- //and generates a <SPACE> when the Doc Bttns are clicked.
- //This is so that kbd and mouse are the same for Doc's.
- //We must now pass the <SPACE> onto the Doc hndlr.
- PutKey(arg1,arg2);
- goto mo_start;
- }
- if (msg_code!=MSG_MS_MOVE) {
- DocBottom;
- if (was_playing || DocPut->cur_entry->y>=Fs->win_height-2) {
- PsmMenu(psm_octave);
- col=0;
- }
- }
-
- ona=Note2Ona(3,psm_octave+1); //C
- is_null=TRUE;
- switch (msg_code) {
- case MSG_CMD:
- PsmPopMode;
- switch (arg1) {
- case PSMF_CD:
- st2=dirname;
- if (dirname=PopUpPickDir) {
- Free(st2);
- Free(filename);
- filename=NULL;
- } else
- dirname=st2;
- break;
- case PSMF_INCOMPLETE:
- psm.incomplete_entry->checked=!psm.incomplete_entry->checked;
- break;
- }
- PsmPushMode(psm_octave);
- col=0;
- break;
- case MSG_KEY_DOWN:
- evt_time=tS;
- if ('0'<=arg1<='9') {
- psm_octave=arg1-'0';
- PsmMenu(psm_octave);
- col=0;
- } else {
- switch (arg1) {
- start:
- case 'a': ona-=8; break;
- case 's': ona-=7; break;
- case 'e': ona-=6; break;
- case 'd': ona-=5; break;
- case 'r': ona-=4; break;
- case 'f': ona-=3; break;
- case 't': ona-=2; break;
- case 'g': ona--; break;
- case 'h': break;
- case 'u': ona++; break;
- case 'j': ona+=2; break;
- case 'i': ona+=3; break;
- case 'k': ona+=4; break;
- case 'l': ona+=5; break;
- case 'p': ona+=6; break;
- case ';': ona+=7; break;
- case '[': ona+=8; break;
- case '\'': ona+=9; break;
- case ']': ona+=10; break;
- case CH_SPACE: ona=0; break;
- end:
- is_null=FALSE;
- break;
-
- case 0:
- switch (arg2.u8[0]) {
- case SC_CURSOR_LEFT:
- if (arg2&SCF_CTRL) {
- while (psm.cur_note->last!=&psm.head) {
- psm.cur_note=psm.cur_note->last;
- if (psm.cur_note!=&psm.head)
- LBEqu(&psm.cur_note->flags,PSMf_SEL,arg2&SCF_SHIFT);
- }
- } else {
- if (psm.cur_note->last!=&psm.head) {
- psm.cur_note=psm.cur_note->last;
- if (psm.cur_note!=&psm.head)
- LBEqu(&psm.cur_note->flags,PSMf_SEL,arg2&SCF_SHIFT);
- }
- }
- break;
- case SC_CURSOR_RIGHT:
- if (arg2&SCF_CTRL) {
- while (psm.cur_note!=&psm.head) {
- if (psm.cur_note!=&psm.head)
- LBEqu(&psm.cur_note->flags,PSMf_SEL,arg2&SCF_SHIFT);
- psm.cur_note=psm.cur_note->next;
- }
- } else {
- if (psm.cur_note!=&psm.head) {
- if (psm.cur_note!=&psm.head)
- LBEqu(&psm.cur_note->flags,PSMf_SEL,arg2&SCF_SHIFT);
- psm.cur_note=psm.cur_note->next;
- }
- }
- break;
- case SC_DELETE:
- if (arg2&SCF_SHIFT)
- PsmCutToClip;
- else {
- tmpn=psm.cur_note;
- psm.cur_note=tmpn->next;
- if (tmpn!=&psm.head) {
- QueRem(tmpn);
- PsmNoteDel(tmpn);
- }
- }
- break;
- case SC_INS:
- if (arg2&SCF_SHIFT)
- PsmPasteClip;
- else if (arg2&SCF_CTRL)
- PsmCopyToClip;
- break;
- case SC_F1:
- PsmPopMode;
- PopUpEd("::/Apps/Psalmody/Help.DD.Z",Fs);
- PsmPushMode(psm_octave);
- col=0;
- break;
- }
- break;
- case ',':
- Free(filename);
- filename=NULL;
- PsmPopMode;
- music.octave=psm_octave;
- if (st2=GodSongStr) {
- PsmLoadSongStr(st2,&psm_octave,&psm_duration);
- Free(st2);
- }
- PsmPushMode(psm_octave);
- col=0;
- break;
- case CH_CTRLO:
- PsmPopMode;
- RegOneTimePopUp(ARf_PSALMODY_JUKEBOX,
- "Sel a song and preview it.\n"
- "$GREEN$<SHIFT-ESC>$FG$ to load it into Psalmody.\n\n"
- ST_WARN_ST " Graphics and other embelishments\n"
- "will be lost because Psalmody can't\n"
- "parse HolyC programs completely.\n");
- Free(filename);
- filename=NULL;
- JukeBox(dirname,&filename);
- if (filename) {
- psm.scrn_x=0;
- psm_duration=1.0;
- psm_octave=4;
- PsmSongDel(&psm.head);
- psm.cur_note=&psm.head;
- PsmLoadSong(filename,&psm_octave,&psm_duration);
- psm.record_entry->checked=FALSE;
- psm.cur_note=psm.head.next;
- }
- PsmPushMode(psm_octave);
- col=0;
- break;
- case CH_CTRLA:
- PsmPopMode;
- filename=PsmSaveSong(dirname,filename);
- PsmPushMode(psm_octave);
- break;
- case CH_CTRLC:
- PsmCopyToClip;
- break;
- case CH_CTRLV:
- PsmPasteClip;
- break;
- case CH_CTRLX:
- PsmCutToClip;
- break;
- case '.':
- PsmMenu(psm_octave);
- col=0;
- Free(filename);
- filename=NULL;
- psm_duration=1.0;
- psm_octave=4;
- PsmSongDel(&psm.head);
- psm.cur_note=&psm.head;
- psm.scrn_x=0;
- break;
- case '\n':
- if (psm.cur_note!=&psm.head)
- PsmRightClick(psm.cur_note->x,psm.cur_note->y);
- break;
- case 'x':
- if (was_playing)
- break;
- col=0;
- psm.playing=TRUE;
- PsmMenu(psm_octave);
- tmpn=psm.cur_note;
- while (tmpn!=&psm.head) {
- if (tmpn->type!=PSMT_METER) {
- timeout_val=cnts.jiffies;
- if (ms.pos_text.y-Fs->win_top<18)
- msg_code=ScanMsg(&arg1,&arg2,1<<MSG_KEY_DOWN|
- 1<<MSG_MS_L_DOWN|1<<MSG_MS_R_UP|1<<MSG_CMD);
- else
- msg_code=ScanMsg(&arg1,&arg2,1<<MSG_KEY_DOWN|
- 1<<MSG_MS_L_DOWN|1<<MSG_CMD);
- if (msg_code) {
- Snd;
- psm.playing=FALSE;
- was_playing=TRUE;
- if (ms.pos_text.y-Fs->win_top>=18 &&
- msg_code==MSG_MS_L_DOWN)
- goto mo_start;
- else
- goto mo_got_msg;
- }
- psm.cur_note=tmpn;
- psm.scrn_x+=tmpn->x-0.33*GR_WIDTH;
- if (PsmHasWords(tmpn->word))
- "%s",tmpn->word;
- Snd(tmpn->ona);
-
- music.tempo=4.4*tempo_state.tempo/TEMPO_RANGE+0.5;
- music.stacatto_factor=
- 0.88*tempo_state.stacatto/TEMPO_RANGE+0.12;
- d=JIFFY_FREQ*psm_durations[tmpn->duration]/music.tempo;
- if (Bt(&tmpn->flags,PSMf_TIE)) {
- timeout_val+=d;
- timeout_val2=timeout_val;
- } else {
- timeout_val+=d*music.stacatto_factor;
- timeout_val2=timeout_val+
- d*(1.0-music.stacatto_factor);
- }
- SleepUntil(timeout_val);
- Snd;
- SleepUntil(timeout_val2);
- }
- tmpn=tmpn->next;
- }
- psm.cur_note=&psm.head;
- psm.scrn_x+=psm.cur_note->x-GR_WIDTH/2;
- psm.playing=FALSE;
- PsmMenu(psm_octave);
- col=0;
- Snd;
- break;
- case CH_BACKSPACE:
- tmpn=psm.cur_note->last;
- if (tmpn!=&psm.head) {
- QueRem(tmpn);
- PsmNoteDel(tmpn);
- }
- if (col) {
- '' CH_BACKSPACE;
- col--;
- }
- break;
- case 'z':
- if (psm.record_entry->checked)
- psm.record_entry->checked=FALSE;
- else {
- psm.record_entry->checked=TRUE;
- psm_duration=1.0;
- psm_octave=4;
- psm.scrn_x=0;
- }
- PsmMenu(psm_octave);
- col=0;
- break;
- case CH_ESC:
- PsmPopMode;
- filename=PsmSaveSong(dirname,filename);
- PsmPushMode(psm_octave);
- case CH_SHIFT_ESC:
- goto mo_done;
- }
- }
- break;
- case MSG_KEY_UP:
- evt_time=tS;
- break;
- case MSG_MS_MOVE:
- if (arg2>18*FONT_HEIGHT)
- Fs->win_inhibit=WIG_USER_TASK_DFT;
- else
- Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER
- -WIF_FOCUS_TASK_MENU-WIF_SELF_CTRLS;
- break;
- case MSG_MS_L_DOWN:
- PsmDownKey(arg1,arg2);
- PsmLeftClick(arg1,arg2);
- break;
- case MSG_MS_L_UP:
- PsmUpKey(arg1,arg2);
- break;
- default:
- PsmRightClick(arg1,arg2);
- }
- if (is_null)
- ona=0;
- if (ona!=last_ona || is_null!=was_null) {
- if (!ona) {
- if (is_null)
- st="";
- else
- st="R";
- } else
- st=LstSub(Ona2Note(ona),psm_note_lst);
- Snd(ona);
- if (psm.record_entry->checked) {
- if (!was_null) {
- music.tempo=4.4*tempo_state.tempo/TEMPO_RANGE+0.5;
- music.stacatto_factor=0.88*tempo_state.stacatto/TEMPO_RANGE+0.12;
- tmpn->duration=PsmCvtDuration(
- music.tempo*(evt_time-note_down_time));
- PsmSetWidth(tmpn);
- QueIns(tmpn,psm.cur_note->last);
- }
- if (!is_null) {
- note_down_time=tS;
- tmpn=CAlloc(sizeof(PsmNote));
- tmpn->type=PSMT_NOTE;
- tmpn->ona=ona;
- if (st[1]=='#')
- Bts(&tmpn->flags,PSMf_SHARP);
- }
- }
- last_ona=ona;
- was_null=is_null;
- "%s",st;
- col+=StrLen(st);
- if (col>=Fs->win_width-1) {
- '\n';
- col=0;
- }
- }
- }
-mo_done:
- GetMsg(,,1<<MSG_KEY_UP);
- } catch
- PutExcept;
- PsmPopMode;
- PsmSongDel(&psm.head);
- PsmSongDel(&psm.clip);
- TempoDel(c);
- DCFill;
- DCDel(psm.dc2);
- DocClear;
- SettingsPop;
- if (DocPut) DocPut->flags=DocPut->flags&~DOCF_FORM|old_doc_flags&DOCF_FORM;
- Free(dirname);
- MenuPop;
-}
- - - \ No newline at end of file diff --git a/public/src/Apps/Psalmody/Run.HC.HTML b/public/src/Apps/Psalmody/Run.HC.HTML deleted file mode 100644 index fb37c31..0000000 --- a/public/src/Apps/Psalmody/Run.HC.HTML +++ /dev/null @@ -1,15 +0,0 @@ - - - - - Run.HC - - - - - Cd(__DIR__);;
-#include "Load"
-Psalmody;
- - - \ No newline at end of file diff --git a/public/src/Apps/Span/Install.HC.HTML b/public/src/Apps/Span/Install.HC.HTML deleted file mode 100644 index 196d012..0000000 --- a/public/src/Apps/Span/Install.HC.HTML +++ /dev/null @@ -1,13 +0,0 @@ - - - - - Install.HC - - - - - DirMk("~/Span");
- - - \ No newline at end of file diff --git a/public/src/Apps/Span/Load.HC.HTML b/public/src/Apps/Span/Load.HC.HTML deleted file mode 100644 index ef297b3..0000000 --- a/public/src/Apps/Span/Load.HC.HTML +++ /dev/null @@ -1,22 +0,0 @@ - - - - - Load.HC - - - - - #help_index "Games"
-
-Cd(__DIR__);;
-#include "Span.HH"
-#include "SpanDerive"
-#include "SpanBridge"
-#include "SpanNew"
-#include "SpanMain"
-
-#help_index ""
- - - \ No newline at end of file diff --git a/public/src/Apps/Span/Run.HC.HTML b/public/src/Apps/Span/Run.HC.HTML deleted file mode 100644 index 19a476e..0000000 --- a/public/src/Apps/Span/Run.HC.HTML +++ /dev/null @@ -1,15 +0,0 @@ - - - - - Run.HC - - - - - Cd(__DIR__);;
-#include "Load"
-Span;
- - - \ No newline at end of file diff --git a/public/src/Apps/Span/SpanBridge.HC.HTML b/public/src/Apps/Span/SpanBridge.HC.HTML deleted file mode 100644 index 9c9da4d..0000000 --- a/public/src/Apps/Span/SpanBridge.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SpanBridge.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Apps/Span/SpanDerive.HC.HTML b/public/src/Apps/Span/SpanDerive.HC.HTML deleted file mode 100644 index 78a3510..0000000 --- a/public/src/Apps/Span/SpanDerive.HC.HTML +++ /dev/null @@ -1,59 +0,0 @@ - - - - - SpanDerive.HC - - - - - U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
-{
-//The forces due to springs and drag are
- //automatically handled by the
- //ode code.We can add new forces
- //here.
- CTask *task=ode->win_task;
- F64 d,dd;
- CD3 p,p2;
- MyMass *tmpm1,*tmpm2;
-
- //Collisions
- tmpm1=ode->next_mass;
- while (tmpm1!=&ode->next_mass) {
- tmpm2=tmpm1->next;
- while (tmpm2!=&ode->next_mass) {
- D3Sub(&p,&tmpm2->state->x,&tmpm1->state->x);
- dd=D3NormSqr(&p);
- if (dd<=Sqr(tmpm1->radius+tmpm2->radius)) {
- d=Sqrt(dd)+0.0001;
- dd=10.0*Sqr(Sqr(Sqr(tmpm1->radius+tmpm2->radius)-dd));
- D3MulEqu(&p,dd/d);
- D3AddEqu(&tmpm2->DstateDt->DxDt,&p);
- D3SubEqu(&tmpm1->DstateDt->DxDt,&p);
- }
- tmpm2=tmpm2->next;
- }
- tmpm1=tmpm1->next;
- }
-
- tmpm1=ode->next_mass;
- while (tmpm1!=&ode->next_mass) {
- if (!(tmpm1->flags&MSF_FIXED))
- tmpm1->DstateDt->DyDt+=10.0*tmpm1->mass; //Gravity
- tmpm1=tmpm1->next;
- }
-
- if (cursor_mass) {
- p2.x=ms.pos.x-task->pix_left-task->scroll_x;
- p2.y=ms.pos.y-task->pix_top-task->scroll_y;
- p2.z=0;
- D3Sub(&p,&p2,&cursor_mass->state->x);
- d=10.0*D3NormSqr(&p);
- D3MulEqu(&p,d);
- D3AddEqu(&cursor_mass->DstateDt->DxDt,&p);
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Apps/Span/SpanMain.HC.HTML b/public/src/Apps/Span/SpanMain.HC.HTML deleted file mode 100644 index e2a9e6a..0000000 --- a/public/src/Apps/Span/SpanMain.HC.HTML +++ /dev/null @@ -1,480 +0,0 @@ - - - - - SpanMain.HC - - - - - F64 SpanTime()
-{
- if (run_bttn.state)
- return a.elapsed_t+tS-a.start_wall_t;
- else
- return a.elapsed_t;
-}
-
-F64 Cost(CMathODE *ode)
-{
- MyMass *tmpm;
- MySpring *tmps;
- F64 res=0;
- tmpm=ode->next_mass;
- while (tmpm!=&ode->next_mass) {
- res+=tmpm->cost;
- tmpm=tmpm->next;
- }
- tmps=ode->next_spring;
- while (tmps!=&ode->next_spring) {
- res+=tmps->cost;
- tmps=tmps->next;
- }
- return res;
-}
-
-U0 DrawIt(CTask *task,CDC *dc)
-{
- MyMass *tmpm;
- MySpring *tmps;
-
- tmps=ode->next_spring;
- while (tmps!=&ode->next_spring) {
- if (!(tmps->flags&SSF_INACTIVE)) {
- dc->color=tmps->color;
- dc->thick=tmps->thick;
- GrLine3(dc,tmps->end1->x,tmps->end1->y,0,
- tmps->end2->x,tmps->end2->y,0);
- }
- tmps=tmps->next;
- }
-
- if (cursor_mass) {
- dc->color=RED;
- dc->thick=2;
- GrLine3(dc,ms.pos.x-task->pix_left-task->scroll_x,
- ms.pos.y-task->pix_top-task->scroll_y,0,
- cursor_mass->x,cursor_mass->y,0);
- }
-
- tmpm=ode->next_mass;
- while (tmpm!=&ode->next_mass) {
- if (!(tmpm->flags&MSF_INACTIVE)) {
- dc->color=BLACK;
- GrCircle(dc,tmpm->x,tmpm->y,tmpm->radius);
- GrFloodFill(dc,tmpm->x,tmpm->y,TRUE);
- dc->color=tmpm->color;
- GrCircle(dc,tmpm->x,tmpm->y,tmpm->radius);
- GrFloodFill(dc,tmpm->x,tmpm->y,TRUE);
- dc->color=BLACK;
- GrCircle(dc,tmpm->x,tmpm->y,tmpm->radius);
- }
- tmpm=tmpm->next;
- }
-
- dc->color=BLACK;
- GrPrint(dc,90,0,"Cost:%12.2,f",Cost(ode));
- GrPrint(dc,90,FONT_HEIGHT,"Time:%12.2f",SpanTime);
-}
-
-MyMass *PlaceMass(I64 x, I64 y)
-{
- MyMass *tmpm=CAlloc(sizeof(MyMass));
- tmpm->drag_profile_factor=1.0;
- tmpm->x=x;
- tmpm->y=y;
- tmpm->mass=MASS_MASS;
- tmpm->radius=MASS_RADIUS;
- tmpm->cost=25.0*COST_SCALE;
- tmpm->color=YELLOW;
- QueIns(tmpm,ode->last_mass);
- return tmpm;
-}
-
-U0 NullSpring(MySpring *tmps,F64 scale)
-{
- F64 d=D3Dist(&tmps->end1->x,&tmps->end2->x);
- tmps->rest_len=d*scale;
- tmps->compression_strength=
- tmps->base_compression_strength/(tmps->rest_len+1.0);
- tmps->tensile_strength=tmps->base_tensile_strength/(tmps->rest_len+1.0);
- tmps->const=tmps->base_const/(tmps->rest_len+1.0);
- tmps->cost=tmps->base_cost*tmps->rest_len;
-}
-
-U0 MoveMass(MyMass *tmpm,I64 x, I64 y)
-{
- MySpring *tmps;
- tmpm->x=x;
- tmpm->y=y;
- tmpm->DxDt=0;
- tmpm->DyDt=0;
- tmps=ode->next_spring;
- while (tmps!=&ode->next_spring) {
- if (tmps->end1==tmpm || tmps->end2==tmpm) {
- if (tmps->flags&SSF_NO_COMPRESSION)
- NullSpring(tmps,WIRE_PERCENT);
- else
- NullSpring(tmps,1.0);
- }
- tmps=tmps->next;
- }
-}
-
-U0 DelSpring(MySpring *tmps)
-{
- QueRem(tmps);
- Free(tmps);
-}
-
-U0 DelMass(MyMass *tmpm)
-{
- MySpring *tmps,*tmps1;
- tmps=ode->next_spring;
- while (tmps!=&ode->next_spring) {
- tmps1=tmps->next;
- if (tmps->end1==tmpm || tmps->end2==tmpm)
- DelSpring(tmps);
- tmps=tmps1;
- }
- QueRem(tmpm);
- Free(tmpm);
-}
-
-U0 DrawSpring(CDC *dc,MyMass *tmpm,I64 x,I64 y)
-{
- switch (mode_bttn.state) {
- case MD_CONCRETE:
- dc->color=LTGRAY;
- dc->thick=2;
- break;
- case MD_STEEL:
- dc->color=DKGRAY;
- dc->thick=2;
- break;
- case MD_WIRE:
- dc->color=RED;
- dc->thick=1;
- break;
- }
- GrLine3(dc,tmpm->x,tmpm->y,0,x,y,0);
-}
-
-U0 PlaceSpring(MyMass *tmpm1,MyMass *tmpm2)
-{
- MySpring *tmps=CAlloc(sizeof(MySpring));
- tmps->end1=tmpm1;
- tmps->end2=tmpm2;
- switch (mode_bttn.state) {
- case MD_CONCRETE:
- tmps->base_const = 3.00*SPRING_SCALE;
- tmps->base_compression_strength=10.00*STRENGTH_SCALE;
- tmps->base_tensile_strength = 0.35*STRENGTH_SCALE;
- tmps->base_cost = 0.30*COST_SCALE;
- NullSpring(tmps,1.0);
- tmps->color=LTGRAY;
- tmps->thick=2;
- break;
- case MD_STEEL:
- tmps->base_const = 1.00*SPRING_SCALE;
- tmps->base_compression_strength= 1.00*STRENGTH_SCALE;
- tmps->base_tensile_strength = 1.00*STRENGTH_SCALE;
- tmps->base_cost = 1.00*COST_SCALE;
- NullSpring(tmps,1.0);
- tmps->color=DKGRAY;
- tmps->thick=2;
- break;
- case MD_WIRE:
- tmps->base_const = 0.25*SPRING_SCALE;
- tmps->base_compression_strength= 0.00;
- tmps->base_tensile_strength = 0.50*STRENGTH_SCALE;
- tmps->base_cost = 0.10*COST_SCALE;
- NullSpring(tmps,WIRE_PERCENT);
- tmps->color=RED;
- tmps->thick=1;
- tmps->flags|=SSF_NO_COMPRESSION;
- break;
- }
- QueIns(tmps,ode->last_spring);
-}
-
-U0 AnimateTask(SpanAnimateStruct *a)
-{
- MySpring *tmps,*tmps1;
- Bool old_run=FALSE;
- F64 f;
- while (TRUE) {
- tmps=ode->next_spring;
- while (tmps!=&ode->next_spring) {
- tmps1=tmps->next;
- f=tmps->f;
- if (f>0 && f>tmps->compression_strength &&
- !(tmps->flags&SSF_NO_COMPRESSION)||
- f<0 && -f>tmps->tensile_strength &&
- !(tmps->flags&SSF_NO_TENSION))
- tmps->flags|=SSF_INACTIVE;
- tmps=tmps1;
- }
- AdjustLoads(ode);
- Refresh; //CMathODE updated once per refresh.
- if (old_run!=run_bttn.state) {
- if (run_bttn.state) {
- if (!a->elapsed_t || !a->saved_ode) {
- Free(a->saved_ode);
- a->saved_ode=SpanSave(ode);
- }
- a->start_wall_t=tS;
- ODEPause(ode,OFF);
- } else {
- ODEPause(ode);
- a->elapsed_t+=tS-a->start_wall_t;
- }
- old_run=run_bttn.state;
- }
- }
-}
-
-U0 Init(SpanAnimateStruct *a)
-{
- SpanDel(ode);
- ode=SpanNew;
-
- run_bttn.state=0;
- Refresh(2); //Allow stop to reg in animate task.
-
- if (a->saved_ode)
- SpanLoad(ode,a->saved_ode);
- else
- SpanBridge1Init(ode);
- a->elapsed_t=0;
- cursor_mass=NULL;
-}
-
-U0 SongTask(I64)
-{//Song by Terry A. Davis
- Fs->task_end_cb=&SndTaskEndCB;
- MusicSettingsRst;
- music.tempo= 3.636;
- music.stacatto_factor= 0.902;
- while (TRUE) {
- Play("5q.EeDqED4G5DhE");
- Play("5q.EeDqED4G5DhE");
- Play("5q.FeEFEqF4G5EhF");
- Play("5q.FeEFEqF4G5EhF");
- }
-}
-
-U0 Span()
-{
- I64 msg_code,arg1,arg2;
- MyMass *tmpm1=NULL,*tmpm2=NULL;
- MySpring *tmps;
- CCtrl *bt_run,*bt_mode;
- U8 *src;
- CDC *dc=DCAlias;
-
- SettingsPush; //See SettingsPush
- Fs->text_attr=BROWN<<4+BLACK;
- AutoComplete;
- WinBorder;
- WinMax;
- DocCursor;
- Fs->song_task=Spawn(&SongTask,NULL,"Song",,Fs);
-
- bt_run =CtrlBttnNew(0,0, 80,,
- 2,"Stopped\0Running\0",run_colors,&run_bttn);
- bt_mode=CtrlBttnNew(0,3.0*FONT_HEIGHT,80,,
- MD_MODES_NUM,Define("ST_SPAN_MODES"),mode_colors,&mode_bttn);
- a.saved_ode=NULL;
-
- Fs->win_inhibit|=WIG_DBL_CLICK;
-
- MenuPush(
- "File {"
- " New(,CH_CTRLN);"
- " Open(,CH_CTRLO);"
- " SaveAs(,CH_CTRLA);"
- " Abort(,CH_SHIFT_ESC);"
- " Exit(,CH_ESC);"
- "}"
- "Play {"
- " Restart(,'\n');"
- " RunStop(,CH_SPACE);"
- " Mass(,'m');"
- " Concrete(,'c');"
- " Steel(,'s');"
- " Wire(,'w');"
- " Move(,'v');"
- " Delete(,'d');"
- "}"
- );
-
- ode=NULL;
- Init(&a);
- Fs->animate_task=Spawn(&AnimateTask,&a,"Animate",,Fs);
- Fs->draw_it=&DrawIt;
-
- PopUpOk(
- "Build a bridge to hold-up the\n"
- "red masses.Test your design\n"
- "by pressing run/stop.\n\n"
- "The lowest cost bridge that\n"
- "stays standing wins.\n\n"
- "For a variation, try without\n"
- "using the center base point.\n"
- "\n"
- "Use\n"
- "\t$GREEN$'m'$FG$ass\n"
- "\t$GREEN$'c'$FG$oncrete\n"
- "\t$GREEN$'s'$FG$teel\n"
- "\t$GREEN$'w'$FG$ire\n"
- "\nto sel materials.\n");
-
- try {
- while (TRUE) {
- msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_DOWN|1<<MSG_MS_R_DOWN|
- 1<<MSG_MS_L_UP|1<<MSG_KEY_DOWN|1<<MSG_MS_MOVE);
- DCFill(dc);
- switch (msg_code) {
- case MSG_MS_L_DOWN:
- cursor_mass=tmpm1=tmpm2=NULL;
- switch (mode_bttn.state) {
- case MD_MASS:
- PlaceMass(arg1,arg2);
- break;
- case MD_CONCRETE:
- case MD_STEEL:
- case MD_WIRE:
- tmpm1=MassFind(ode,arg1,arg2);
- break;
- case MD_MOVE:
- if (run_bttn.state)
- cursor_mass=MassFind(ode,arg1,arg2);
- else
- if (tmpm1=MassFind(ode,arg1,arg2))
- MoveMass(tmpm1,arg1,arg2);
- break;
- case MD_DELETE:
- MassOrSpringFind(ode,&tmpm1,&tmps,arg1,arg2);
- if (tmpm1)
- DelMass(tmpm1);
- if (tmps)
- DelSpring(tmps);
- break;
- }
- break;
- case MSG_MS_L_UP:
- switch (mode_bttn.state) {
- case MD_CONCRETE:
- case MD_STEEL:
- case MD_WIRE:
- if (tmpm1 && (tmpm2=MassFind(ode,arg1,arg2)) && tmpm1!=tmpm2)
- PlaceSpring(tmpm1,tmpm2);
- break;
- case MD_MOVE:
- if (!run_bttn.state && tmpm1)
- MoveMass(tmpm1,arg1,arg2);
- break;
- }
- cursor_mass=tmpm1=tmpm2=NULL;
- break;
- case MSG_MS_MOVE:
- switch (mode_bttn.state) {
- case MD_MOVE:
- if (!run_bttn.state && tmpm1)
- MoveMass(tmpm1,arg1,arg2);
- break;
- case MD_CONCRETE:
- case MD_STEEL:
- case MD_WIRE:
- if (tmpm1) {
- DrawSpring(dc,tmpm1,arg1,arg2);
- }
- break;
- }
- break;
- case MSG_MS_R_DOWN:
- mode_bttn.state++;
- if (mode_bttn.state>=MD_MODES_NUM)
- mode_bttn.state=0;
- cursor_mass=tmpm1=tmpm2=NULL;
- break;
- case MSG_KEY_DOWN:
- switch (arg1) {
- case '\n':
- if (!SpanTime || !a.saved_ode) {
- Free(a.saved_ode);
- a.saved_ode=SpanSave(ode);
- }
- Init(&a);
- break;
- case CH_CTRLN:
- Free(a.saved_ode);
- a.saved_ode=NULL;
- Init(&a);
- break;
- case CH_CTRLO:
- if (src=SpanRead) {
- Free(a.saved_ode);
- a.saved_ode=src;
- Init(&a);
- }
- break;
- case CH_CTRLA:
- if (!SpanTime || !a.saved_ode) {
- Free(a.saved_ode);
- a.saved_ode=SpanSave(ode);
- }
- Init(&a);
- SpanWrite(ode);
- break;
- case CH_SPACE:
- run_bttn.state=!run_bttn.state;
- break;
- case 'c':
- mode_bttn.state=MD_CONCRETE;
- break;
- case 's':
- mode_bttn.state=MD_STEEL;
- break;
- case 'w':
- mode_bttn.state=MD_WIRE;
- break;
- case 'm':
- mode_bttn.state=MD_MASS;
- break;
- case 'v':
- mode_bttn.state=MD_MOVE;
- break;
- case 'd':
- mode_bttn.state=MD_DELETE;
- break;
- case CH_ESC:
- if (!SpanTime || !a.saved_ode) {
- Free(a.saved_ode);
- a.saved_ode=SpanSave(ode);
- }
- Init(&a);
- SpanWrite(ode);
- case CH_SHIFT_ESC:
- goto span_done;
- }
- break;
- }
- }
-span_done: //Don't goto out of try
- GetMsg(,,1<<MSG_KEY_UP);
- } catch
- PutExcept;
- DocClear;
- SettingsPop;
- CtrlBttnDel(bt_run);
- CtrlBttnDel(bt_mode);
- SpanDel(ode);
- DCFill(dc);
- DCDel(dc);
- MenuPop;
-}
- - - \ No newline at end of file diff --git a/public/src/Apps/Span/SpanNew.HC.HTML b/public/src/Apps/Span/SpanNew.HC.HTML deleted file mode 100644 index 1da6dc5..0000000 --- a/public/src/Apps/Span/SpanNew.HC.HTML +++ /dev/null @@ -1,138 +0,0 @@ - - - - - SpanNew.HC - - - - - CMathODE *SpanNew()
-{
- CMathODE *ode=ODENew(0,1e-4,ODEF_HAS_MASSES|ODEF_PAUSED);
- ode->derive=&MyDerivative;
- ode->drag_v2=0.002;
- ode->drag_v3=0.00001;
- ode->acceleration_limit=5e3;
- QueIns(ode,Fs->last_ode);
- return ode;
-}
-
-U0 SpanDel(CMathODE *ode)
-{
- if (ode) {
- QueRem(ode);
- QueDel(&ode->next_mass,TRUE);
- QueDel(&ode->next_spring,TRUE);
- ODEDel(ode);
- }
-}
-
-#define M_SIZE (sizeof(MyMass) -offset(CMass.start))
-#define S_SIZE (sizeof(MySpring)-offset(CSpring.start))
-
-U8 *SpanSave(CMathODE *ode,I64 *_size=NULL)
-{
- I64 cnt;
- U8 *res,*ptr;
- MyMass *tmpm;
- MySpring *tmps;
- SpanHeader h;
-
- ODERenum(ode);
- h.version=SPAN_VERSION;
- if (ode->next_mass!=&ode->next_mass)
- h.num_masses=ode->last_mass->num+1;
- else
- h.num_masses=0;
- if (ode->next_spring!=&ode->next_spring)
- h.num_springs=ode->last_spring->num+1;
- else
- h.num_springs=0;
-
- cnt=sizeof(SpanHeader)+h.num_masses*M_SIZE+h.num_springs*S_SIZE;
-
- ptr=res=MAlloc(cnt);
- MemCpy(ptr,&h,sizeof(SpanHeader));
- ptr+=sizeof(SpanHeader);
-
- tmpm=ode->next_mass;
- while (tmpm!=&ode->next_mass) {
- MemCpy(ptr,&tmpm->start,M_SIZE);
- ptr+=M_SIZE;
- tmpm=tmpm->next;
- }
-
- tmps=ode->next_spring;
- while (tmps!=&ode->next_spring) {
- MemCpy(ptr,&tmps->start,S_SIZE);
- ptr+=S_SIZE;
- tmps=tmps->next;
- }
- if (_size) *_size=cnt;
- return res;
-}
-
-Bool SpanWrite(CMathODE *ode)
-{
- U8 *name,*buf;
- I64 size;
- Bool res=FALSE,old_silent=Silent;
- DirMk("~/Span");
- Silent(old_silent);
- if (name=PopUpFileName("~/Span/Game.DATA")) {
- if (buf=SpanSave(ode,&size)) {
- FileWrite(name,buf,size);
- Free(buf);
- res=TRUE;
- }
- Free(name);
- }
- return res;
-}
-
-U0 SpanLoad(CMathODE *ode,U8 *src)
-{
- I64 i;
- MyMass *tmpm;
- MySpring *tmps;
- SpanHeader h;
-
- if (!src) return;
-
- MemCpy(&h,src,sizeof(SpanHeader));
- src+=sizeof(SpanHeader);
-
- for (i=0;i<h.num_masses;i++) {
- tmpm=CAlloc(sizeof(MyMass));
- MemCpy(&tmpm->start,src,M_SIZE);
- src+=M_SIZE;
- QueIns(tmpm,ode->last_mass);
- }
-
- for (i=0;i<h.num_springs;i++) {
- tmps=CAlloc(sizeof(MySpring));
- MemCpy(&tmps->start,src,S_SIZE);
- src+=S_SIZE;
- QueIns(tmps,ode->last_spring);
- tmps->end1=MassFindNum(ode,tmps->end1_num);
- tmps->end2=MassFindNum(ode,tmps->end2_num);
- }
-}
-
-U8 *SpanRead()
-{
- U8 *src=NULL,*name;
- Bool old_silent=Silent;
- DirMk("~/Span");
- Silent(old_silent);
- if (name=PopUpPickFile("~/Span")) {
- src=FileRead(name);
- Free(name);
- }
- return src;
-}
-
- - - \ No newline at end of file diff --git a/public/src/Apps/Strut/Load.HC.HTML b/public/src/Apps/Strut/Load.HC.HTML deleted file mode 100644 index 5cd16f8..0000000 --- a/public/src/Apps/Strut/Load.HC.HTML +++ /dev/null @@ -1,18 +0,0 @@ - - - - - Load.HC - - - - - #help_index "Games"
-
-Cd(__DIR__);;
-#include "Strut"
-
-#help_index ""
- - - \ No newline at end of file diff --git a/public/src/Apps/Strut/Run.HC.HTML b/public/src/Apps/Strut/Run.HC.HTML deleted file mode 100644 index 177fac6..0000000 --- a/public/src/Apps/Strut/Run.HC.HTML +++ /dev/null @@ -1,15 +0,0 @@ - - - - - Run.HC - - - - - Cd(__DIR__);;
-#include "Load"
-Strut;
- - - \ No newline at end of file diff --git a/public/src/Apps/Strut/Strut.HC.HTML b/public/src/Apps/Strut/Strut.HC.HTML deleted file mode 100644 index 57ebe98..0000000 --- a/public/src/Apps/Strut/Strut.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Strut.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Apps/TimeClock/Install.HC.HTML b/public/src/Apps/TimeClock/Install.HC.HTML deleted file mode 100644 index 9727392..0000000 --- a/public/src/Apps/TimeClock/Install.HC.HTML +++ /dev/null @@ -1,20 +0,0 @@ - - - - - Install.HC - - - - - if (!FileFind("~/TimeClock",,FUF_JUST_DIRS)) {
- DirMk("~/TimeClock");
- DocClear;
- "After Loading, type $GREEN$PunchIn;$FG$, "
- "$GREEN$PunchOut;$FG$ or $GREEN$TimeRep;$FG$\n"
- "You might want to make PLUGINS for hot keys.\n\n\n";
-}
-
- - - \ No newline at end of file diff --git a/public/src/Apps/TimeClock/Load.HC.HTML b/public/src/Apps/TimeClock/Load.HC.HTML deleted file mode 100644 index edbd21d..0000000 --- a/public/src/Apps/TimeClock/Load.HC.HTML +++ /dev/null @@ -1,19 +0,0 @@ - - - - - Load.HC - - - - - #help_index "Misc"
-
-Cd(__DIR__);;
-#include "TimeClk"
-#include "Install" //Might as well always install
-
-#help_index ""
- - - \ No newline at end of file diff --git a/public/src/Apps/TimeClock/TimeClk.HC.HTML b/public/src/Apps/TimeClock/TimeClk.HC.HTML deleted file mode 100644 index d81b0be..0000000 --- a/public/src/Apps/TimeClock/TimeClk.HC.HTML +++ /dev/null @@ -1,163 +0,0 @@ - - - - - TimeClk.HC - - - - - #define TIME_FILENAME "~/TimeClock/TimeFile.DATA.Z"
-
-#define TET_EOF 0
-#define TET_PUNCH_IN 1
-#define TET_PUNCH_OUT 2
-
-class TimeEntry
-{
- TimeEntry *next,*last;
- U8 type;
- CDate datetime;
- U8 *desc;
-};
-
-U0 TimeFileRead(TimeEntry *header)
-{
- U8 *buf,*ptr;
- I64 type;
- TimeEntry *tmpt;
- buf=FileRead(TIME_FILENAME);
- if (!buf)
- buf=CAlloc(1);
- QueInit(header);
- ptr=buf;
- while (type=*ptr++) {
- tmpt=CAlloc(sizeof(TimeEntry));
- tmpt->type=type;
- tmpt->datetime=*ptr(CDate *)++;
- tmpt->desc=StrNew(ptr);
- ptr+=StrLen(ptr)+1;
- QueIns(tmpt,header->last);
- }
- Free(buf);
-}
-
-U0 TimeFileWrite(TimeEntry *header)
-{
- U8 *buf,*ptr;
- TimeEntry *tmpt;
- I64 size=1; //for EOF
-
- tmpt=header->next;
- while (tmpt!=header) {
- size+=sizeof(U8)+sizeof(CDate)+StrLen(tmpt->desc)+1;
- tmpt=tmpt->next;
- }
- buf=MAlloc(size);
-
- ptr=buf;
- tmpt=header->next;
- while (tmpt!=header) {
- *ptr++=tmpt->type;
- *ptr(CDate *)++=tmpt->datetime;
- StrCpy(ptr,tmpt->desc);
- ptr+=StrLen(tmpt->desc)+1;
- tmpt=tmpt->next;
- }
- *ptr=TET_EOF;
- FileWrite(TIME_FILENAME,buf,size);
- Free(buf);
-}
-
-U0 TimeEntriesDel(TimeEntry *header)
-{
- TimeEntry *tmpt=header->next,*tmpt1;
- while (tmpt!=header) {
- tmpt1=tmpt->next;
- Free(tmpt->desc);
- Free(tmpt);
- tmpt=tmpt1;
- }
- Free(header);
-}
-
-public Bool TimeRep(TimeEntry **_header=NULL)
-{
- Bool is_in=FALSE,first=TRUE;
- I64 week,cur_week=-1,week_total;
- TimeEntry *tmpt,*header=MAlloc(sizeof(TimeEntry));
- if (_header) *_header=header;
- TimeFileRead(header);
- tmpt=header->next;
- while (tmpt!=header) {
- week=tmpt->datetime.date/7; //TODO
- if (week!=cur_week) {
- if (!first) {
- if (is_in)
- week_total+=Now;
- "Week Total:%T\n",week_total-local_time_offset;
- } else
- first=FALSE;
- cur_week=week;
- week_total=0;
- }
- if (tmpt->type==TET_PUNCH_IN) {
- "$RED$IN ";
- if (!is_in)
- week_total-=tmpt->datetime;
- is_in=TRUE;
- } else {
- "$RED$OUT";
- if (is_in)
- week_total+=tmpt->datetime;
- is_in=FALSE;
- }
- " %D %T:$FG$\n%s\n",tmpt->datetime,tmpt->datetime,tmpt->desc;
- tmpt=tmpt->next;
- }
- if (is_in)
- week_total+=Now;
- "$RED$Week Total:%T$FG$\n",week_total-local_time_offset;
- if (!_header)
- TimeEntriesDel(header);
- return is_in;
-}
-
-public U0 PunchOut()
-{
- TimeEntry *tmpt,*header;
- if (!TimeRep(&header))
- "$BK,1$Already Punched-Out$BK,0$\n";
- else {
- tmpt=MAlloc(sizeof(TimeEntry));
- tmpt->type=TET_PUNCH_OUT;
- tmpt->datetime=Now;
- "\nEnter Description.\nPress <ESC> when done.\n";
- if (!(tmpt->desc=GetStr(,,GSF_WITH_NEW_LINE)))
- tmpt->desc=CAlloc(1);
- QueIns(tmpt,header->last);
- TimeFileWrite(header);
- }
- TimeEntriesDel(header);
-}
-
-public U0 PunchIn()
-{
- TimeEntry *tmpt,*header;
- if (TimeRep(&header))
- "$BK,1$Already Punched-In$BK,0$\n";
- else {
- tmpt=MAlloc(sizeof(TimeEntry));
- tmpt->type=TET_PUNCH_IN;
- tmpt->datetime=Now;
- "\nEnter Description.\nPress <ESC> when done.\n";
- if (!(tmpt->desc=GetStr(,,GSF_WITH_NEW_LINE)))
- tmpt->desc=CAlloc(1);
- QueIns(tmpt,header->last);
- TimeFileWrite(header);
- }
- TimeEntriesDel(header);
-}
- - - \ No newline at end of file diff --git a/public/src/Apps/Titanium/Load.HC.HTML b/public/src/Apps/Titanium/Load.HC.HTML deleted file mode 100644 index 84152f8..0000000 --- a/public/src/Apps/Titanium/Load.HC.HTML +++ /dev/null @@ -1,18 +0,0 @@ - - - - - Load.HC - - - - - #help_index "Games"
-
-Cd(__DIR__);;
-#include "Titanium"
-
-#help_index ""
- - - \ No newline at end of file diff --git a/public/src/Apps/Titanium/Run.HC.HTML b/public/src/Apps/Titanium/Run.HC.HTML deleted file mode 100644 index 0d3a6c8..0000000 --- a/public/src/Apps/Titanium/Run.HC.HTML +++ /dev/null @@ -1,14 +0,0 @@ - - - - - Run.HC - - - - - Cd(__DIR__);;
-#include "Load"
-Titanium; - - \ No newline at end of file diff --git a/public/src/Apps/Titanium/Titanium.HC.HTML b/public/src/Apps/Titanium/Titanium.HC.HTML deleted file mode 100644 index bf6ea46..0000000 --- a/public/src/Apps/Titanium/Titanium.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Titanium.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Apps/ToTheFront/AIs/Human.HC.HTML b/public/src/Apps/ToTheFront/AIs/Human.HC.HTML deleted file mode 100644 index 88553c4..0000000 --- a/public/src/Apps/ToTheFront/AIs/Human.HC.HTML +++ /dev/null @@ -1,178 +0,0 @@ - - - - - Human.HC - - - - - U0 PlayerIndirect()
-{
- Unit *tmpu=NULL;
- I64 i,remaining=0,msg_code,arg1,arg2;
- F64 target_x,target_y;
- ViewPlayerSet(cur_player);
- for (i=0;i<UNITS_NUM;i++) {
- tmpu=&units[cur_player][i];
- if (tmpu->life>0 && tmpu->indirect_fire)
- remaining++;
- }
- while (remaining) {
- if (!alive_cnt[0] || !alive_cnt[1])
- throw('GameOver',TRUE);
- msg_code=GetMsg(&arg1,&arg2,1<<MSG_KEY_DOWN|1<<MSG_MS_L_DOWN|1<<MSG_MS_L_UP|
- 1<<MSG_MS_R_UP);
- switch (msg_code) {
- case MSG_KEY_DOWN:
- CharDo(arg1);
- break;
- case MSG_MS_L_DOWN:
- if (CursorInWin(Fs,arg1,arg2)) {
- arg1-=x0; arg2-=y0;
- CursorUpdate(Fs,arg1,arg2);
- if (tmpu=UnitFind(cursor_row,cursor_col)) {
- if (tmpu->player==enemy_player || tmpu->fired ||
- !tmpu->indirect_fire)
- tmpu=NULL;
- else {
- RowCol2XY(&fire_radius_x,&fire_radius_y,tmpu->row,tmpu->col);
- fire_radius=tmpu->range*2*HEX_RADIUS;
- }
- }
- }
- break;
- case MSG_MS_L_UP:
- if (CursorInWin(Fs,arg1,arg2)) {
- arg1-=x0; arg2-=y0;
- CursorUpdate(Fs,arg1,arg2);
- RowCol2XY(&target_x,&target_y,cursor_row,cursor_col);
- if (!tmpu)
- Beep;
- else {
- if (Sqrt(Sqr(fire_radius_x-target_x)+Sqr(fire_radius_y-target_y))>
- fire_radius)
- Beep;
- else {
- IndirectAdd(tmpu,cursor_row,cursor_col);
- remaining--;
- }
- }
- }
- tmpu=NULL;
- fire_radius=0;
- break;
- case MSG_MS_R_UP:
- if (CursorInWin(Fs,arg1,arg2))
- throw('PhaseOvr',TRUE);
- break;
- }
- }
- throw('PhaseOvr',TRUE);
-}
-
-U0 PlayerMove()
-{
- Unit *tmpu=NULL;
- I64 msg_code,arg1,arg2;
- ViewPlayerSet(cur_player);
- while (TRUE) {
- if (!alive_cnt[0] || !alive_cnt[1])
- throw('GameOver',TRUE);
- msg_code=GetMsg(&arg1,&arg2,1<<MSG_KEY_DOWN|1<<MSG_MS_L_DOWN|1<<MSG_MS_L_UP|
- 1<<MSG_MS_R_UP);
- switch (msg_code) {
- case MSG_KEY_DOWN:
- CharDo(arg1);
- break;
- case MSG_MS_L_DOWN:
- if (CursorInWin(Fs,arg1,arg2)) {
- arg1-=x0; arg2-=y0;
- CursorUpdate(Fs,arg1,arg2);
- if (tmpu=UnitFind(cursor_row,cursor_col)) {
- if (tmpu->player==enemy_player || !tmpu->remaining_movement)
- tmpu=NULL;
- }
- }
- break;
- case MSG_MS_L_UP:
- if (CursorInWin(Fs,arg1,arg2)) {
- arg1-=x0; arg2-=y0;
- CursorUpdate(Fs,arg1,arg2);
- if (!tmpu)
- Beep;
- else {
- UnitMove(tmpu,arg1,arg2);
- break;
- }
- }
- tmpu=NULL;
- break;
- case MSG_MS_R_UP:
- if (CursorInWin(Fs,arg1,arg2))
- throw('PhaseOvr',TRUE);
- break;
- }
- }
-}
-
-U0 PlayerDirect()
-{
- Unit *tmpu=NULL,*target;
- I64 msg_code,arg1,arg2;
- ViewPlayerSet(cur_player);
- while (TRUE) {
- if (!alive_cnt[0] || !alive_cnt[1])
- throw('GameOver',TRUE);
- msg_code=GetMsg(&arg1,&arg2,1<<MSG_KEY_DOWN|1<<MSG_MS_L_DOWN|1<<MSG_MS_L_UP|
- 1<<MSG_MS_R_UP);
- switch (msg_code) {
- case MSG_KEY_DOWN:
- CharDo(arg1);
- break;
- case MSG_MS_L_DOWN:
- if (CursorInWin(Fs,arg1,arg2)) {
- arg1-=x0; arg2-=y0;
- CursorUpdate(Fs,arg1,arg2);
- if (tmpu=UnitFind(cursor_row,cursor_col)) {
- if (tmpu->player==enemy_player || tmpu->fired ||
- tmpu->indirect_fire)
- tmpu=NULL;
- else {
- VRSetUp(cur_player);
- RowCol2XY(&fire_radius_x,&fire_radius_y,tmpu->row,tmpu->col);
- fire_radius=tmpu->range*2*HEX_RADIUS;
- VisRecalc(VR_ONE_FRIENDLY_UNIT,tmpu);
- }
- }
- }
- break;
- case MSG_MS_L_UP:
- if (CursorInWin(Fs,arg1,arg2)) {
- arg1-=x0; arg2-=y0;
- CursorUpdate(Fs,arg1,arg2);
- target=UnitFind(cursor_row,cursor_col);
- if (!tmpu)
- Beep;
- else {
- if (!target || target->player!=enemy_player ||
- !Bt(&target->vis,0))
- Beep;
- else
- UnitDirectFire(tmpu,target);
- VisRecalc(VR_UPDATE_FRIENDLY_UNIT,tmpu);
- }
- }
- tmpu=NULL;
- fire_radius=0;
- break;
- case MSG_MS_R_UP:
- if (CursorInWin(Fs,arg1,arg2))
- throw('PhaseOvr',TRUE);
- break;
- }
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Apps/ToTheFront/AIs/SimpleAI.HC.HTML b/public/src/Apps/ToTheFront/AIs/SimpleAI.HC.HTML deleted file mode 100644 index 7a16b0d..0000000 --- a/public/src/Apps/ToTheFront/AIs/SimpleAI.HC.HTML +++ /dev/null @@ -1,91 +0,0 @@ - - - - - SimpleAI.HC - - - - - Unit *UnitNearestFind(I64 row,I64 col,I64 player,Bool in_LOS,F64 range=-1)
-{
- I64 i;
- F64 dd,best_dd=F64_MAX,x1,y1,x2,y2;
- Unit *best=NULL;
-//Sqrt() is slow, so work with squared distances.
- if (range<0)
- range=F64_MAX;
- else
- range*=range;
- RowCol2XY(&x1,&y1,row,col);
- for (i=0;i<UNITS_NUM;i++)
- if (units[player][i].life>0) {
- if (!in_LOS || LOS(row,col,units[player][i].row,units[player][i].col)) {
- RowCol2XY(&x2,&y2,units[player][i].row,units[player][i].col);
- dd=Sqr(x2-x1)+Sqr(y2-y1);
- if (dd<=range && dd<best_dd) {
- best=&units[player][i];
- best_dd=dd;
- }
- }
- }
- return best;
-}
-
-U0 PlayerIndirect()
-{
- Unit *target,*tmpu;
- I64 i;
- for (i=0;i<UNITS_NUM;i++) {
- UserChk;
- tmpu=&units[cur_player][i];
- if (tmpu->life>0 && tmpu->indirect_fire &&
- (target=UnitNearestFind(tmpu->row,tmpu->col,enemy_player,TRUE,
- tmpu->range*2*HEX_RADIUS)))
- IndirectAdd(tmpu,target->row,target->col);
- }
- throw('PhaseOvr',TRUE);
-}
-
-U0 PlayerMove()
-{
- Unit *target,*tmpu;
- I64 i;
- F64 x,y;
- for (i=0;i<UNITS_NUM;i++) {
- UserChk;
- tmpu=&units[cur_player][i];
- if (tmpu->life>0) {
-//Cheats because it violates Line-of-Sight
- if (target=UnitNearestFind(tmpu->row,tmpu->col,enemy_player,FALSE)) {
- RowCol2XY(&x,&y,target->row,target->col);
- if (!UnitMove(tmpu,x,y)) {
- RowCol2XY(&x,&y,tmpu->row,tmpu->col);
- UnitMove(tmpu,x+RandI16,y+RandI16);
- }
- }
- }
- }
- throw('PhaseOvr',TRUE);
-}
-
-U0 PlayerDirect()
-{
- Unit *target,*tmpu;
- I64 i;
- for (i=0;i<UNITS_NUM;i++) {
- UserChk;
- tmpu=&units[cur_player][i];
- if (tmpu->life>0 && !tmpu->indirect_fire &&
- (target=UnitNearestFind(tmpu->row,tmpu->col,enemy_player,TRUE,
- tmpu->range*2*HEX_RADIUS))) {
- UnitDirectFire(tmpu,target);
- Sleep(250*animation_delay);
- }
- }
- throw('PhaseOvr',TRUE);
-}
-
- - - \ No newline at end of file diff --git a/public/src/Apps/ToTheFront/Install.HC.HTML b/public/src/Apps/ToTheFront/Install.HC.HTML deleted file mode 100644 index c8270e2..0000000 --- a/public/src/Apps/ToTheFront/Install.HC.HTML +++ /dev/null @@ -1,14 +0,0 @@ - - - - - Install.HC - - - - - DirMk("~/ToTheFront");
-
- - - \ No newline at end of file diff --git a/public/src/Apps/ToTheFront/Load.HC.HTML b/public/src/Apps/ToTheFront/Load.HC.HTML deleted file mode 100644 index 80dbbe3..0000000 --- a/public/src/Apps/ToTheFront/Load.HC.HTML +++ /dev/null @@ -1,25 +0,0 @@ - - - - - Load.HC - - - - - #help_index "Games"
-
-Cd(__DIR__);;
-#include "TTFGlbls"
-#include "TTFLib"
-#include "TTFInit"
-#include "TTFVis"
-#include "TTFFire"
-#include "TTFMove"
-#include "TTFDraw"
-#include "ToTheFront"
-
-#help_index ""
- - - \ No newline at end of file diff --git a/public/src/Apps/ToTheFront/Run.HC.HTML b/public/src/Apps/ToTheFront/Run.HC.HTML deleted file mode 100644 index 3ad1631..0000000 --- a/public/src/Apps/ToTheFront/Run.HC.HTML +++ /dev/null @@ -1,14 +0,0 @@ - - - - - Run.HC - - - - - Cd(__DIR__);;
-#include "Load"
-ToTheFront; - - \ No newline at end of file diff --git a/public/src/Apps/ToTheFront/TTFDraw.HC.HTML b/public/src/Apps/ToTheFront/TTFDraw.HC.HTML deleted file mode 100644 index 8eabddf..0000000 --- a/public/src/Apps/ToTheFront/TTFDraw.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - TTFDraw.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Apps/ToTheFront/TTFFire.HC.HTML b/public/src/Apps/ToTheFront/TTFFire.HC.HTML deleted file mode 100644 index 9961b16..0000000 --- a/public/src/Apps/ToTheFront/TTFFire.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - TTFFire.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Apps/ToTheFront/TTFGlbls.HC.HTML b/public/src/Apps/ToTheFront/TTFGlbls.HC.HTML deleted file mode 100644 index a95877e..0000000 --- a/public/src/Apps/ToTheFront/TTFGlbls.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - TTFGlbls.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Apps/ToTheFront/TTFInit.HC.HTML b/public/src/Apps/ToTheFront/TTFInit.HC.HTML deleted file mode 100644 index 02c915b..0000000 --- a/public/src/Apps/ToTheFront/TTFInit.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - TTFInit.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Apps/ToTheFront/TTFLib.HC.HTML b/public/src/Apps/ToTheFront/TTFLib.HC.HTML deleted file mode 100644 index 5331c26..0000000 --- a/public/src/Apps/ToTheFront/TTFLib.HC.HTML +++ /dev/null @@ -1,133 +0,0 @@ - - - - - TTFLib.HC - - - - - U0 Toward(I64 *_row,I64 *_col,I64 direction)
-{
- switch (direction) {
- case 0:
- *_row-=2;
- break;
- case 1:
- if (*_row&1) *_col+=1;
- *_row-=1;
- break;
- case 2:
- if (*_row&1) *_col+=1;
- *_row+=1;
- break;
- case 3:
- *_row+=2;
- break;
- case 4:
- if (!(*_row&1)) *_col-=1;
- *_row+=1;
- break;
- case 5:
- if (!(*_row&1)) *_col-=1;
- *_row-=1;
- break;
- }
-}
-
-I64 FacingChg(I64 f1,I64 f2)
-{
- I64 res=(f1+6-f2)%6;
- if (res>=3)
- return 6-res;
- else
- return res;
-}
-
-U0 RowCol2XY(F64 *_x,F64 *_y,I64 row,I64 col)
-{
- Pt *c;
- row=ClampI64(row,0,map_rows);
- col=ClampI64(col,0,map_cols);
- c=&hex_centers[row][col];
- *_x=c->x;
- *_y=c->y;
-}
-
-U0 XY2RowCol(I64 *_row,I64 *_col,F64 x,F64 y)
-{
- *_col=(x-DCOS/2)/(HEX_SIDE+DCOS);
- if (*_col&1)
- *_row=ToI64((y-DSIN)/(2*DSIN))*2+1;
- else
- *_row=ToI64(y/(2*DSIN))*2;
- *_col>>=1;
- *_row=ClampI64(*_row,0,map_rows-1);
- *_col=ClampI64(*_col,0,map_cols-1);
-}
-
-Unit *UnitFind(I64 row,I64 col)
-{//Finds unit in a hexagon.
- I64 i,j;
- for (j=0;j<2;j++)
- for (i=0;i<UNITS_NUM;i++)
- if (units[j][i].life>0 &&
- units[j][i].row==row &&
- units[j][i].col==col)
- return &units[j][i];
- return NULL;
-}
-
-Bool CursorInWin(CTask *task,I64 x,I64 y)
-{
- if (0<=x+task->scroll_x<task->pix_width &&
- 0<=y+task->scroll_y<task->pix_height)
- return TRUE;
- else
- return FALSE;
-}
-
-U0 CursorUpdate(CTask *task,I64 x,I64 y)
-{
- if (CursorInWin(task,x,y))
- XY2RowCol(&cursor_row,&cursor_col,x,y);
-}
-
-class LOSCtrl
-{
- I64 r1,c1,r2,c2,distance;
-};
-
-Bool LOSPlot(LOSCtrl *l,I64 x,I64 y,I64 z)
-{//We got tricky and used z as the distance from the start of the line.
- I64 row,col;
- XY2RowCol(&row,&col,x,y);
- if ((row!=l->r1 || col!=l->c1) &&
- (row!=l->r2 || col!=l->c2) &&
- terrain[row][col]!=PLAINS) {
- if (terrain[l->r1][l->c1]==MOUNTAINS) {
- if (terrain[row][col]==MOUNTAINS || z>l->distance>>1)
- return FALSE;
- } else if (terrain[l->r2][l->c2]==MOUNTAINS) {
- if (terrain[row][col]==MOUNTAINS || z<=l->distance>>1)
- return FALSE;
- } else
- return FALSE;
- }
- return TRUE;
-}
-
-Bool LOS(I64 r1,I64 c1,I64 r2,I64 c2)
-{
- F64 x1,y1,x2,y2;
- LOSCtrl l;
- RowCol2XY(&x1,&y1,r1,c1);
- RowCol2XY(&x2,&y2,r2,c2);
- l.r1=r1; l.c1=c1;
- l.r2=r2; l.c2=c2;
- l.distance=Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2));
- return Line(&l,x1,y1,0,x2,y2,l.distance,&LOSPlot);
-}
- - - \ No newline at end of file diff --git a/public/src/Apps/ToTheFront/TTFMove.HC.HTML b/public/src/Apps/ToTheFront/TTFMove.HC.HTML deleted file mode 100644 index 40359a0..0000000 --- a/public/src/Apps/ToTheFront/TTFMove.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - TTFMove.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Apps/ToTheFront/TTFVis.HC.HTML b/public/src/Apps/ToTheFront/TTFVis.HC.HTML deleted file mode 100644 index 78ded7a..0000000 --- a/public/src/Apps/ToTheFront/TTFVis.HC.HTML +++ /dev/null @@ -1,235 +0,0 @@ - - - - - TTFVis.HC - - - - - #define VR_ONE_FRIENDLY_UNIT 0
-#define VR_UPDATE_FRIENDLY_UNIT 1
-#define VR_FRIENDLY_UNIT_DIED 3
-#define VR_ONE_ENEMY_UNIT 4
-#define VR_ALL_UNITS 5
-
-class MPCtrl1
-{
- I64 mode,lo,hi;
- Unit *tmpu;
-};
-
-class MPCtrl2
-{
- I64 lo,hi,row,col;
-};
-
-
-U0 VRSetUp(I64 player)
-{
- I64 i;
- Unit *ut0,*ut1;
- ut0=&units[player][0];
- ut1=&units[player^1][0];
- for (i=0;i<UNITS_NUM;i++,ut0++,ut1++) {
- LBtr(&ut1->vis[player],0);
- LBEqu(&ut0->vis[player],0,ut0->life>0);
- }
-}
-
-U0 VRMerge(I64 player)
-{
- I64 i,j;
- Unit *ut1;
- U8 *dst,*src,*mask=CAlloc((UNITS_NUM+7)>>3);
- for (j=0;j<UNITS_NUM;j++) {//p0
- src=&vis_unit_bitmap[player][(((UNITS_NUM+7)&~7)*j)>>3];
- dst=mask;
- for (i=0;i<(UNITS_NUM+7)>>3;i++) //player1
- *dst++|=*src++;
- }
- ut1=&units[player^1][0];
- for (j=0;j<UNITS_NUM;j++,ut1++)
- LBEqu(&ut1->vis[player],0,Bt(mask,j) && ut1->life>0);
- Free(mask);
-}
-
-Bool MPVisRecalc(MPCtrl1 *job)
-{
- Bool res=FALSE,seen;
- I64 i,j,row,col;
- F64 x1,y1,x2,y2,dd,range;
- Unit *ut0,*ut1;
- ut0=&units[cur_player][job->lo];
- ut1=&units[enemy_player][job->lo];
- if (job->tmpu) {
- row=job->tmpu->row;
- col=job->tmpu->col;
- range=job->tmpu->range*2*HEX_RADIUS;
- range*=range;
- }
- switch (job->mode) {
- case VR_UPDATE_FRIENDLY_UNIT:
- case VR_ONE_FRIENDLY_UNIT:
- if (job->mode==VR_UPDATE_FRIENDLY_UNIT)
- range=F64_MAX;
- RowCol2XY(&x1,&y1,row,col);
- for (i=job->lo;i<job->hi;i++,ut1++) {
- seen=FALSE;
- if (ut1->life>0 &&
- LOS(row,col,ut1->row,ut1->col)) {
- RowCol2XY(&x2,&y2,ut1->row,ut1->col);
- dd=Sqr(x2-x1)+Sqr(y2-y1);
- if (dd<range) {
- seen=TRUE;
- LBts(&ut1->vis[cur_player],0);
- }
- }
- if (job->mode==VR_UPDATE_FRIENDLY_UNIT)
- LBEqu(&vis_unit_bitmap[cur_player],
- i+job->tmpu->num*((UNITS_NUM+7)&~7),seen);
- }
- break;
- case VR_ONE_ENEMY_UNIT:
- RowCol2XY(&x1,&y1,row,col);
- for (i=job->lo;i<job->hi;i++,ut1++)
- if (ut1->life>0 &&
- LOS(row,col,ut1->row,ut1->col)) {
- LBts(&vis_unit_bitmap[enemy_player],
- job->tmpu->num+i*((UNITS_NUM+7)&~7));
- res=TRUE;
- } else
- LBtr(&vis_unit_bitmap[enemy_player],
- job->tmpu->num+i*((UNITS_NUM+7)&~7));
- break;
- case VR_ALL_UNITS:
- ut0=&units[cur_player][0];
- for (i=0;i<UNITS_NUM;i++,ut0++)
- if (ut0->life>0) {
- RowCol2XY(&x1,&y1,ut0->row,ut0->col);
- ut1=&units[enemy_player][job->lo];
- for (j=job->lo;j<job->hi;j++,ut1++) {
- if (ut1->life>0 &&
- LOS(ut0->row,ut0->col,ut1->row,ut1->col)) {
- LBts(&ut1->vis[cur_player],0);
- LBts(&vis_unit_bitmap[cur_player],j+i*((UNITS_NUM+7)&~7));
- } else
- LBtr(&vis_unit_bitmap[cur_player],j+i*((UNITS_NUM+7)&~7));
- }
- } else
- for (j=job->lo;j<job->hi;j++)
- LBtr(&vis_unit_bitmap[cur_player],j+i*((UNITS_NUM+7)&~7));
- ut0=&units[enemy_player][0];
- for (i=0;i<UNITS_NUM;i++,ut0++)
- if (ut0->life>0) {
- RowCol2XY(&x1,&y1,ut0->row,ut0->col);
- ut1=&units[cur_player][job->lo];
- for (j=job->lo;j<job->hi;j++,ut1++) {
- if (ut1->life>0 &&
- LOS(ut0->row,ut0->col,ut1->row,ut1->col)) {
- LBts(&ut1->vis[enemy_player],0);
- LBts(&vis_unit_bitmap[enemy_player],j+i*((UNITS_NUM+7)&~7));
- } else
- LBtr(&vis_unit_bitmap[enemy_player],j+i*((UNITS_NUM+7)&~7));
- }
- } else
- for (j=job->lo;j<job->hi;j++)
- LBtr(&vis_unit_bitmap[enemy_player],j+i*((UNITS_NUM+7)&~7));
- break;
- }
- return res;
-}
-
-Bool VisRecalc(I64 mode,Unit *tmpu=NULL)
-{
- I64 i,hi,k,cnt;
- Bool res;
-/*The compiler doesn't go out of it's way
-to know if something is const.;-)This
-just compiles with the val at compile
-time, an advantage of just-in-time over
-AOT binaries.TempleOS has a limited
-stk size, so don't get in the habit.
-MAlloc() would probably be the better choice.
-*/
- MPCtrl1 job[mp_cnt];
- CJob *cmd[mp_cnt];
-
- if (mode==VR_FRIENDLY_UNIT_DIED) {
- MemSet((&vis_unit_bitmap[enemy_player])(U8 *)+
- (tmpu->num*((UNITS_NUM+7)&~7))>>3,0,(UNITS_NUM+7)>>3);
- VRMerge(enemy_player);
- return 0; //Return any value--don't care
- }
-
- cnt=mp_cnt; //Cores
- hi=UNITS_NUM;
- if (mode==VR_ONE_ENEMY_UNIT) {
- for (hi--;hi>=0;hi--)
- if (units[enemy_player][hi].life>0)
- break;
- hi++;
- }
- k=hi;
- if (hi/mp_cnt<2)
- cnt=1;
- for (i=0;i<cnt;i++) {
- job[i].mode=mode;
- job[i].tmpu=tmpu;
- job[i].hi=k;
- k-=hi/cnt;
- if (k<0) k=0;
- if (i==cnt-1) k=0;
- job[i].lo=k;
- }
-
- res=FALSE;
- for (i=0;i<cnt;i++)
- cmd[i]=JobQue(&MPVisRecalc,&job[i],i,0);
- for (i=0;i<cnt;i++)
- if (JobResGet(cmd[i]))
- res=TRUE;
- if (mode==VR_UPDATE_FRIENDLY_UNIT)
- VRMerge(cur_player);
- return res;
-}
-
-U0 MPVisRecalcMap(MPCtrl2 *job)
-{
- I64 i,j;
- for (j=job->lo;j<job->hi;j++)
- for (i=0;i<map_cols;i++)
- if (LOS(job->row,job->col,j,i))
- vis_map[j][i]=TRUE;
- else
- vis_map[j][i]=FALSE;
-}
-
-U0 VisRecalcMap(I64 row,I64 col)
-{
- I64 i,hi,k,cnt;
- MPCtrl2 job[mp_cnt];
- CJob *cmd[mp_cnt];
-
- cnt=mp_cnt; //Cores
- hi=map_rows;
- k=hi;
- if (hi/mp_cnt<2)
- cnt=1;
- for (i=0;i<cnt;i++) {
- job[i].row=row;
- job[i].col=col;
- job[i].hi=k;
- k-=hi/cnt;
- if (k<0) k=0;
- if (i==cnt-1) k=0;
- job[i].lo=k;
- }
- for (i=0;i<cnt;i++)
- cmd[i]=JobQue(&MPVisRecalcMap,&job[i],i,0);
- for (i=0;i<cnt;i++)
- JobResGet(cmd[i]);
-}
- - - \ No newline at end of file diff --git a/public/src/Apps/ToTheFront/ToTheFront.HC.HTML b/public/src/Apps/ToTheFront/ToTheFront.HC.HTML deleted file mode 100644 index 425acdf..0000000 --- a/public/src/Apps/ToTheFront/ToTheFront.HC.HTML +++ /dev/null @@ -1,226 +0,0 @@ - - - - - ToTheFront.HC - - - - - U0 AnimationDelaySet()
-{
- animation_delay=PopUpRangeF64(0,100,25,"%3f% %%","Animation Delay\n")/100;
-}
-
-U0 TurnNew()
-{
- I64 i,j;
- for (j=0;j<2;j++)
- for (i=0;i<UNITS_NUM;i++) {
- units[j][i].remaining_movement=units[j][i].movement;
- units[j][i].fired=FALSE;
- }
- phase=PHASE_START;
- moving_unit=NULL;
-
- SleepUntil(msg_off_timeout);
- msg_off_timeout=cnts.jiffies+JIFFY_FREQ*2*animation_delay+1;
- Snd(74);
- StrPrint(msg_buf,"Turn %d",++turn);
- VRSetUp(0);
- VRSetUp(1);
- VisRecalc(VR_ALL_UNITS);
- cur_player=(turn&1)^1;
- enemy_player=cur_player^1;
-}
-
-U0 PhaseNew()
-{
- cur_player^=1;
- enemy_player=cur_player^1;
- if (++phase>=PHASE_END) {
- IndirectResolveAll;
- TurnNew;
- }
-
- SleepUntil(msg_off_timeout);
- msg_off_timeout=cnts.jiffies+JIFFY_FREQ*2*animation_delay+1;
- Snd(74);
- switch (phase) {
- case PHASE_INDIRECT0:
- case PHASE_INDIRECT1:
- StrPrint(msg_buf,"Player %d Artillery Plot",cur_player+1);
- break;
- case PHASE_MOVE0:
- case PHASE_MOVE1:
- StrPrint(msg_buf,"Player %d Move",cur_player+1);
- break;
- case PHASE_DIRECT0:
- case PHASE_DIRECT1:
- StrPrint(msg_buf,"Player %d Fire",cur_player+1);
- break;
- }
-}
-
-U0 CharDo(U8 ch)
-{
- I64 old_inhibit,old_draw_it;
- Bool old_cursor;
- switch (ch) {
- case CH_ESC:
- case CH_SHIFT_ESC:
- throw('ExitGame',TRUE);
- case CH_SPACE:
- throw('PhaseOvr',TRUE);
- case '\n':
- throw('NewGame',TRUE);
- case '1':
- ViewPlayerSet(0);
- break;
- case '2':
- ViewPlayerSet(1);
- break;
- case 'c':
- old_draw_it=Fs->draw_it;
- old_inhibit=Fs->win_inhibit;
- Fs->draw_it=Fs->next_settings->draw_it;
- Fs->win_inhibit=WIG_USER_TASK_DFT;
- old_cursor=DocCursor(ON);
- DocBottom;
- "\n$GREEN$<SHIFT-ESC>$FG$ to return to game.\n";
- View;
- DocBottom;
- DocCursor(old_cursor);
- Fs->win_inhibit=old_inhibit;
- Fs->draw_it=old_draw_it;
- break;
- case 'd':
- AnimationDelaySet;
- break;
- }
-}
-
-U0 UserChk()
-{
- I64 ch;
- if (!alive_cnt[0] || !alive_cnt[1])
- throw('GameOver',TRUE);
- if (ch=ScanChar)
- CharDo(ch);
-}
-
-U0 TaskEndCB()
-{
- Snd;
- progress4=progress4_max=progress1=progress1_max=0;
- Exit;
-}
-
-I64 PhaseDo()
-{
- I64 res='ExitGame';
- PhaseNew;
- try {
- if (phase&~1==PHASE_INDIRECT)
- Call(player_indirect[cur_player]);
- else if (phase&~1==PHASE_MOVE)
- Call(player_move[cur_player]);
- else
- Call(player_direct[cur_player]);
- } catch {
- res=Fs->except_ch;
- Fs->catch_except=TRUE;
- }
- return res;
-}
-
-U0 ToTheFront()
-{
- I64 res,ch;
- map_dc=DCNew(MAP_WIDTH,MAP_HEIGHT);
-
- SettingsPush; //See SettingsPush
- Cd(__DIR__);
- Fs->win_inhibit|=WIF_SELF_MS_L|WIF_SELF_MS_R|WIG_DBL_CLICK;
-
- MenuPush(
- "File {"
- " Abort(,CH_SHIFT_ESC);"
- " Exit(,CH_ESC);"
- "}"
- "Play {"
- " EndPhase(,CH_SPACE);"
- " Restart(,'\n');"
- "}"
- "View {"
- " Player1(,'1');"
- " Player2(,'2');"
- " OddsCalculations(,'c');"
- " LOS(,0,SCF_SHIFT);"
- "}"
- "Settings {"
- " AnimationDelay(,'d');"
- "}"
- );
-
- AutoComplete;
- WinBorder;
- WinMax;
- DocCursor;
- DocMax;
- Init;
- PlayerPick("AIs",0);
- PlayerPick("AIs",1);
-
- PopUpOk("$PURPLE$$TX+CX,\"ToTheFront\"$$FG$\n\n"
- "$GREEN${Left-click}$FG$ to move or fire units.\n"
- "$GREEN$<SPACE>$FG$\tor $GREEN${Right-click}$FG$ to end phase.\n"
- "$GREEN$<SHIFT>$FG$\tto show line-of-sight.\n"
- "$GREEN$<ENTER>$FG$\tto start new game.\n"
- "$GREEN$1$FG$\tPlayer 1 view.\n"
- "$GREEN$2$FG$\tPlayer 2 view.\n"
- "$GREEN$c$FG$\tView odds calculations.\n"
- "$GREEN$d$FG$\tSet animation delay.");
- Fs->task_end_cb=&TaskEndCB; //<CTRL-ALT-x>
- Fs->draw_it=&DrawIt;
- try {
- do {
- res=PhaseDo;
- if (res=='GameOver') {
- while (TRUE) {
- msg_off_timeout=0;
- StrCpy(msg_buf,"Game Over");
- Snd;
- ch=GetChar(,FALSE);
- if (ch=='\n') {
- CleanUp;
- Init;
- break;
- } else if (ch==CH_ESC || ch==CH_SHIFT_ESC) {
- res='ExitGame';
- break;
- } else if (ch=='1')
- ViewPlayerSet(0);
- else if (ch=='2')
- ViewPlayerSet(1);
- else if (ch=='d')
- AnimationDelaySet;
- }
- } else if (res=='NewGame') {
- CleanUp;
- Init;
- }
- } while (res!='ExitGame');
- } catch
- PutExcept;
- ProgressBarsRst;
-
- SettingsPop;
- DCDel(map_dc);
- CleanUp;
- MenuPop;
- Seed;
-}
- - - \ No newline at end of file diff --git a/public/src/Apps/Vocabulary/Load.HC.HTML b/public/src/Apps/Vocabulary/Load.HC.HTML deleted file mode 100644 index f568bff..0000000 --- a/public/src/Apps/Vocabulary/Load.HC.HTML +++ /dev/null @@ -1,18 +0,0 @@ - - - - - Load.HC - - - - - #help_index "Games"
-
-Cd(__DIR__);;
-#include "VocabQuiz"
-
-#help_index ""
- - - \ No newline at end of file diff --git a/public/src/Apps/Vocabulary/Run.HC.HTML b/public/src/Apps/Vocabulary/Run.HC.HTML deleted file mode 100644 index 8f09803..0000000 --- a/public/src/Apps/Vocabulary/Run.HC.HTML +++ /dev/null @@ -1,14 +0,0 @@ - - - - - Run.HC - - - - - Cd(__DIR__);;
-#include "Load"
-VocabQuiz; - - \ No newline at end of file diff --git a/public/src/Apps/Vocabulary/VocabQuiz.HC.HTML b/public/src/Apps/Vocabulary/VocabQuiz.HC.HTML deleted file mode 100644 index 30e988f..0000000 --- a/public/src/Apps/Vocabulary/VocabQuiz.HC.HTML +++ /dev/null @@ -1,69 +0,0 @@ - - - - - VocabQuiz.HC - - - - - U8 *RandVocabWord()
-{
- I64 i;
- U8 *ptr;
- if (!acd.num_words)
- return NULL;
- i=RandU32%acd.num_words;
- ptr=acd.word_lst;
- while (i-- && *ptr==ACD_WORD_CHAR)
- ptr+=StrLen(ptr)+3;
- if (*ptr++!=ACD_WORD_CHAR)
- return NULL;
- else
- return ptr;
-}
-
-U0 VocabQuiz()
-{
- I64 ch,i,num;
- U8 *right_word,*words[4];
- if (!FileFind(ACD_DEF_FILENAME)) {
- "Uncompressed dictionary not present.\n";
- return;
- }
- do {
- right_word=RandVocabWord;
- for (i=0;i<4;i++)
- words[i]=RandVocabWord;
- num=RandU32&3;
- words[num]=right_word;
-
- "$WW,1$$CM-LE,5$$RED$$BK,1$%s$BK,0$:$FG$$LM,4$\n",right_word;
- for (i=0;i<4;i++)
- "\n\n$GREEN$$BT-X,\"%d\",LM=\"%d\"$$FG$"
- "$LM,7$%s\n$LM,4$",i+1,i+1,ACDDefGet(words[i]);
- "\n\n$LTBLUE$Answer:$FG$";
- do {
- ch=GetKey(,TRUE);
- DocBottom;
- if ('1'<=ch<='4') {
- '\n';
- if (ch-'1'==num) {
- "$LTGREEN$Correct\n$FG$";
- Snd(74);
- } else {
- "$LTRED$Incorrect\n$FG$";
- Snd(46);
- }
- Sleep(500);
- Snd;
- ACDPopUpDef(right_word);
- break;
- }
- } while (ch!=CH_SHIFT_ESC && ch!=CH_ESC);
- "$LM,0$\n";
- } while (ch!=CH_SHIFT_ESC && ch!=CH_ESC);
-}
- - - \ No newline at end of file diff --git a/public/src/Apps/X-Caliber/Load.HC.HTML b/public/src/Apps/X-Caliber/Load.HC.HTML deleted file mode 100644 index 7713048..0000000 --- a/public/src/Apps/X-Caliber/Load.HC.HTML +++ /dev/null @@ -1,19 +0,0 @@ - - - - - Load.HC - - - - - #help_index "Games"
-
-Cd(__DIR__);;
-#include "XCCtrls"
-#include "X-Caliber"
-
-#help_index ""
- - - \ No newline at end of file diff --git a/public/src/Apps/X-Caliber/Run.HC.HTML b/public/src/Apps/X-Caliber/Run.HC.HTML deleted file mode 100644 index 516d62f..0000000 --- a/public/src/Apps/X-Caliber/Run.HC.HTML +++ /dev/null @@ -1,14 +0,0 @@ - - - - - Run.HC - - - - - Cd(__DIR__);;
-#include "Load"
-XCaliber; - - \ No newline at end of file diff --git a/public/src/Apps/X-Caliber/X-Caliber.HC.HTML b/public/src/Apps/X-Caliber/X-Caliber.HC.HTML deleted file mode 100644 index 604e942..0000000 --- a/public/src/Apps/X-Caliber/X-Caliber.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - X-Caliber.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Apps/X-Caliber/XCCtrls.HC.HTML b/public/src/Apps/X-Caliber/XCCtrls.HC.HTML deleted file mode 100644 index da162f6..0000000 --- a/public/src/Apps/X-Caliber/XCCtrls.HC.HTML +++ /dev/null @@ -1,166 +0,0 @@ - - - - - XCCtrls.HC - - - - - #define LASER_TEMP_MAX 30.0
-#define LASER_THRESHOLD_TEMP 10.0
-#define MASS_TEMP_MAX 5.0
-
-class CtrlPanelState
-{
- I64 shot_radius,fuse_time;
- F64 laser_temperature;
- Bool spacewalk;
-} ctrl_panel;
-
-#define CTRL_PANEL_SPACING 33
-#define CTRL_PANEL_RANGE 30
-#define CTRL_PANEL_BORDER 2
-#define CTRL_PANEL_BTTN_SIZE 12
-
-#define TMP_Y (+2)
-
-U0 DrawCtrlPanelCtrl(CDC *dc,CCtrl *c)
-{
- CtrlPanelState *s=c->state;
- F64 d,d_range;
-
- dc->color=LTRED;
- GrRect(dc, c->left,c->top,CTRL_PANEL_SPACING*3+2,
- CTRL_PANEL_SPACING*2+CTRL_PANEL_RANGE+CTRL_PANEL_BTTN_SIZE);
- dc->color=DKGRAY;
- GrRect(dc, c->left+CTRL_PANEL_BORDER,c->top+CTRL_PANEL_BORDER,
- CTRL_PANEL_SPACING*3+2-2*CTRL_PANEL_BORDER,
- CTRL_PANEL_SPACING*2+CTRL_PANEL_RANGE+CTRL_PANEL_BTTN_SIZE
- -2*CTRL_PANEL_BORDER);
- dc->color=BLACK;
- GrLine(dc,c->left+CTRL_PANEL_SPACING,(c->top+CTRL_PANEL_BTTN_SIZE)+
- CTRL_PANEL_SPACING,c->left+CTRL_PANEL_SPACING,
- (c->top+CTRL_PANEL_BTTN_SIZE)+CTRL_PANEL_SPACING+CTRL_PANEL_RANGE-1);
- GrLine(dc,c->left+2*CTRL_PANEL_SPACING+1,(c->top+CTRL_PANEL_BTTN_SIZE)+
- CTRL_PANEL_SPACING,c->left+2*CTRL_PANEL_SPACING+1,
- (c->top+CTRL_PANEL_BTTN_SIZE)+CTRL_PANEL_SPACING+CTRL_PANEL_RANGE-1);
-
- dc->color=BLACK;
- GrRect(dc,(c->left+c->right+1)/2-9*FONT_WIDTH/2-3,
- c->top+CTRL_PANEL_BORDER+(CTRL_PANEL_SPACING-FONT_HEIGHT)/2,
- 9*FONT_WIDTH+6,FONT_HEIGHT+6);
-
- if (s->spacewalk)
- dc->color=YELLOW;
- else
- dc->color=DKGRAY;
- GrRect(dc,(c->left+c->right+1)/2-9*FONT_WIDTH/2-2,
- c->top+CTRL_PANEL_BORDER+1+(CTRL_PANEL_SPACING-FONT_HEIGHT)/2,
- 9*FONT_WIDTH+4,FONT_HEIGHT+4);
-
- dc->color=RED;
- GrPrint(dc,(c->left+c->right+1)/2-9*FONT_WIDTH/2,
- c->top+CTRL_PANEL_BORDER+3+
- (CTRL_PANEL_SPACING-FONT_HEIGHT)/2,"SpaceWalk");
- GrPrint(dc,c->left+CTRL_PANEL_SPACING-4*FONT_WIDTH/2,
- (c->top+CTRL_PANEL_BTTN_SIZE)+
- CTRL_PANEL_SPACING-FONT_HEIGHT-2,"Size");
- GrPrint(dc,c->left+2*CTRL_PANEL_SPACING+1-4*FONT_WIDTH/2,
- (c->top+CTRL_PANEL_BTTN_SIZE)+
- CTRL_PANEL_SPACING-FONT_HEIGHT-2,"Fuse");
- dc->color=LTRED;
- GrPrint(dc,c->left+CTRL_PANEL_SPACING-FONT_WIDTH/2,
- (c->top+CTRL_PANEL_BTTN_SIZE)+CTRL_PANEL_SPACING+CTRL_PANEL_RANGE+3,
- "%d",s->shot_radius*10/CTRL_PANEL_RANGE);
- GrPrint(dc,c->left+2*CTRL_PANEL_SPACING+1-FONT_WIDTH/2,
- (c->top+CTRL_PANEL_BTTN_SIZE)+CTRL_PANEL_SPACING+CTRL_PANEL_RANGE+3,
- "%d",s->fuse_time*10/CTRL_PANEL_RANGE);
- GrRect(dc,c->left+CTRL_PANEL_SPACING-3,
- (c->top+CTRL_PANEL_BTTN_SIZE)+CTRL_PANEL_SPACING+
- CTRL_PANEL_RANGE-1-s->shot_radius-2 ,7,5);
- GrRect(dc,c->left+2*CTRL_PANEL_SPACING+1-3,
- (c->top+CTRL_PANEL_BTTN_SIZE)+CTRL_PANEL_SPACING+
- CTRL_PANEL_RANGE-1-s->fuse_time-2,7,5);
- dc->color=YELLOW;
- GrRect(dc,c->left+CTRL_PANEL_SPACING-2,
- (c->top+CTRL_PANEL_BTTN_SIZE)+CTRL_PANEL_SPACING+
- CTRL_PANEL_RANGE-1-s->shot_radius-1 ,5,3);
- GrRect(dc,c->left+2*CTRL_PANEL_SPACING+1-2,
- (c->top+CTRL_PANEL_BTTN_SIZE)+CTRL_PANEL_SPACING+
- CTRL_PANEL_RANGE-1-s->fuse_time-1,5,3);
-
- d_range=c->right-c->left-5-5;
- d=s->laser_temperature*d_range/LASER_TEMP_MAX;
- dc->color=BLACK;
- GrRect(dc,c->left+5-1,c->bottom+TMP_Y-2,d_range+2,2+1+1);
- if (d>1.0) {
- dc->color=GREEN;
- GrRect(dc,c->left+5,c->bottom+TMP_Y-1,Min(d,d_range/3),2);
- if (d>=d_range/3) {
- dc->color=YELLOW;
- GrRect(dc,c->left+5+d_range/3,c->bottom+TMP_Y-1,
- Min(d,2*d_range/3)-d_range/3,2);
- if (d>=2*d_range/3) {
- dc->color=RED;
- GrRect(dc,c->left+5+2*d_range/3,c->bottom+TMP_Y-1,d-2*d_range/3,2);
- }
- }
- }
-}
-
-U0 UpdateDerivedCtrlPanelCtrl(CCtrl *c)
-{
- CtrlPanelState *s=c->state;
- c->left=c->win_task->pix_width-(CTRL_PANEL_SPACING*3+2);
- c->right=c->left+CTRL_PANEL_SPACING*3+2;
- c->top=c->win_task->pix_height-(CTRL_PANEL_SPACING*2+
- CTRL_PANEL_RANGE+CTRL_PANEL_BTTN_SIZE);
- c->bottom=c->top+CTRL_PANEL_SPACING*2+CTRL_PANEL_RANGE;
-
- s->shot_radius=ClampI64(s->shot_radius,0,CTRL_PANEL_RANGE-1);
- s->fuse_time=ClampI64(s->fuse_time,0,CTRL_PANEL_RANGE-1);
-}
-
-U0 LeftClickCtrlPanel(CCtrl *c,I64 x,I64 y,Bool)
-{
- CtrlPanelState *s=c->state;
- if (y<c->top+CTRL_PANEL_BORDER+(CTRL_PANEL_SPACING-FONT_HEIGHT)/2+
- FONT_HEIGHT+6)
- s->spacewalk=TRUE;
- else {
- if (x<(c->right+c->left)/2)
- s->shot_radius=CTRL_PANEL_RANGE-1
- -(y-(c->top+CTRL_PANEL_SPACING+CTRL_PANEL_BTTN_SIZE));
- else
- s->fuse_time=CTRL_PANEL_RANGE-1
- -(y-(c->top+CTRL_PANEL_SPACING+CTRL_PANEL_BTTN_SIZE));
- }
- if (c->update_derived_vals)
- (*c->update_derived_vals)(c);
-}
-
-CCtrl *CtrlPanelNew()
-{
- CCtrl *c=CAlloc(sizeof(CCtrl));
- MemSet(&ctrl_panel,0,sizeof(ctrl_panel));
- c->win_task=Fs;
- c->flags=CTRLF_SHOW|CTRLF_CAPTURE_LEFT_MS;
- c->type=CTRLT_GENERIC;
- c->state=&ctrl_panel;
- c->draw_it=&DrawCtrlPanelCtrl;
- c->left_click=&LeftClickCtrlPanel;
- c->update_derived_vals=&UpdateDerivedCtrlPanelCtrl;
- QueIns(c,Fs->last_ctrl);
- TaskDerivedValsUpdate;
- return c;
-}
-
-U0 CtrlPanelDel(CCtrl *c)
-{
- QueRem(c);
- Free(c);
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/Asm.HC.HTML b/public/src/Compiler/Asm.HC.HTML deleted file mode 100644 index d9ac9af..0000000 --- a/public/src/Compiler/Asm.HC.HTML +++ /dev/null @@ -1,1126 +0,0 @@ - - - - - Asm.HC - - - - - Bool PrsAsmImm(CCmpCtrl *cc,CAsmArg *arg)
-{
- if (arg->imm_or_off_present)
- LexExcept(cc,"Already one immediate at ");
- arg->imm_or_off_present=TRUE;
- arg->num.local_asm_undef_hash=NULL;
- arg->num.glbl_asm_undef_hash=NULL;
- cc->asm_undef_hash=NULL;
- cc->abs_cnts=0;
- cc->flags&=~(CCF_UNRESOLVED+CCF_LOCAL);
- if (!IsLexExpression2Bin(cc,&arg->num.machine_code))
- LexSkipEol(cc);
- else {
- if (cc->abs_cnts.externs)
- LexExcept(cc,"Extern Not Allowed at ");
- if (cc->flags & CCF_UNRESOLVED) {
- if (cc->flags & CCF_LOCAL) {
- arg->num.local_asm_undef_hash=cc->asm_undef_hash;
- cc->asm_undef_hash=NULL;
- } else {
- arg->num.glbl_asm_undef_hash=cc->asm_undef_hash;
- cc->asm_undef_hash=NULL;
- }
- } else {
- arg->num.i=Call(arg->num.machine_code);
- arg->num.glbl_asm_undef_hash=cc->asm_undef_hash;
- cc->asm_undef_hash=NULL;
- Free(arg->num.machine_code);
- arg->num.machine_code=NULL;
- }
- }
- return TRUE;
-}
-
-U0 PrsAsmArg(CCmpCtrl *cc,CAsmArg *arg,Bool rel)
-{
- CHashGeneric *tmph,*tmph1;
- CHashReg *tmpr;
- MemSet(arg,0,sizeof(CAsmArg));
- arg->seg =REG_NONE;
- arg->reg1=REG_NONE;
- arg->reg2=REG_NONE;
- arg->scale=1;
- while (TRUE) {
- if (cc->token==TK_IDENT) {
- if (tmph=cc->hash_entry) {
- if (tmph->type&HTG_TYPE_MASK==HTT_REG) {
- tmpr=tmph;
- arg->reg1_type=tmpr->reg_type;
- switch (tmpr->reg_type) {
- start:
- case REGT_R8:
- arg->size=1;
- break;
- case REGT_R16:
- arg->size=2;
- break;
- case REGT_R32:
- arg->size=4;
- break;
- case REGT_R64:
- arg->size=8;
- break;
- end:
- arg->reg1=tmpr->reg_num;
- Lex(cc);
- return;
- case REGT_SEG:
- arg->seg=tmpr->reg_num;
- if (Lex(cc)!=':') {
- arg->just_seg=TRUE;
- return;
- } else
- Lex(cc); //skip ":"
- break;
- case REGT_FSTK:
- case REGT_MM:
- case REGT_XMM:
- arg->size=8;
- arg->reg1=tmpr->reg_num;
- Lex(cc);
- return;
- }
- } else {
- if ((tmph->type&HTG_TYPE_MASK==HTT_CLASS||
- tmph->type&HTG_TYPE_MASK==HTT_INTERNAL_TYPE) &&
- (tmph1=HashFind(cc->cur_str,cmp.asm_hash,HTT_ASM_KEYWORD)))
- tmph=tmph1;
- if (tmph->type&HTG_TYPE_MASK==HTT_ASM_KEYWORD) {
- switch (tmph->user_data0) {
- case AKW_I8:
- case AKW_U8:
- arg->size=1;
- break;
- case AKW_I16:
- case AKW_U16:
- arg->size=2;
- break;
- case AKW_I32:
- case AKW_U32:
- arg->size=4;
- break;
- case AKW_I64:
- case AKW_U64:
- arg->size=8;
- break;
- default:
- LexExcept(cc,"syntax error at ");
- }
- Lex(cc); //skip keyword
- } else
- goto pa_asm_direct_imm;
- }
- } else {
-pa_asm_direct_imm:
- PrsAsmImm(cc,arg);
- arg->num.abs_cnts=cc->abs_cnts;
- if (arg->size<=1 && !rel && arg->num.abs_cnts&1) {
- if (cc->aotc->seg_size==16)
- arg->size=2;
- else
- arg->size=4;
- }
- if (cc->token!='[')
- return;
- }
- } else if (cc->token=='[') {
- arg->indirect=TRUE;
- Lex(cc); // skip [
- while (cc->token && cc->token!=']') {
- if (cc->token==TK_IDENT) {
- if (tmph=cc->hash_entry) {
- if (tmph->type&HTG_TYPE_MASK==HTT_REG &&
- REGT_R16<=tmph(CHashReg *)->reg_type<=REGT_R64) {
- tmpr=tmph;
- arg->reg2_type=tmpr->reg_type;
- if (arg->reg1==REG_NONE) {
- if (tmpr->reg_num&7==REG_RSP) {
- arg->reg1=4;
- arg->reg2=tmpr->reg_num;
- } else
- arg->reg1=tmpr->reg_num;
- } else
- arg->reg2=tmpr->reg_num;
- Lex(cc);
- } else
- goto pa_asm_indirect_imm;
- } else
- goto pa_asm_indirect_imm;
- } else if (cc->token=='*') {
- Lex(cc);
- if (cc->token!=TK_I64)
- LexExcept(cc,"Expecting scale factor at ");
- arg->scale=cc->cur_i64;
- Lex(cc); //skip scale
- if (arg->reg2!=REG_NONE) {
- SwapI64(&arg->reg1,&arg->reg2);
- SwapI64(&arg->reg1_type,&arg->reg2_type);
- }
- } else if (cc->token=='+') {
- Lex(cc); //skip '+'
- } else {
-pa_asm_indirect_imm:
- PrsAsmImm(cc,arg);
- arg->num.abs_cnts=cc->abs_cnts;
- }
- }
- if (cc->token!=']')
- LexExcept(cc,"Missing ']' at ");
- Lex(cc); //skip ]
- return;
- } else
- goto pa_asm_direct_imm;
- }
-}
-
-I64 AsmMakeArgMask(CCmpCtrl *cc,CAsmArg *arg)
-{
- CAOTCtrl *aotc=cc->aotc;
- I64 res;
- if (arg->just_seg) {
- switch (arg->seg) {
- case 0: res=1<<ARGT_ES|1<<ARGT_SREG; break;
- case 1: res=1<<ARGT_CS|1<<ARGT_SREG; break;
- case 2: res=1<<ARGT_SS|1<<ARGT_SREG; break;
- case 3: res=1<<ARGT_DS|1<<ARGT_SREG; break;
- case 4: res=1<<ARGT_FS|1<<ARGT_SREG; break;
- case 5: res=1<<ARGT_GS|1<<ARGT_SREG; break;
- }
- goto mm_done;
- }
- if (arg->reg1_type==REGT_FSTK) {
- if (arg->reg1)
- res=1<<ARGT_STI;
- else
- res=1<<ARGT_ST0|1<<ARGT_STI;
- goto mm_done;
- }
- res=cmp.size_arg_mask[arg->size];
- if (aotc->seg_size==64)
- res&=0xFF0FFFFFFF;
-
- if (arg->reg1!=REG_NONE && arg->imm_or_off_present && !arg->num.i &&
- !arg->num.glbl_asm_undef_hash && !arg->num.local_asm_undef_hash)
- arg->imm_or_off_present=FALSE; //Zero displacement
-
- if (arg->reg2!=REG_NONE || arg->scale!=1) {
- res&=0x0000FF0000;
- goto mm_done;
- }
-
- if (arg->indirect) {
- if (arg->imm_or_off_present)
- res&=0x00FFFF0000;
- else
- res&=0x000FFF0000;
- } else {
- if (arg->imm_or_off_present)
- res&=0x000F000FFE;
- else
- res&=0x3F0FFFF000;
- }
- if (arg->seg!=REG_NONE)
- res&=0x00FFFF0000;
- if (arg->reg1==REG_NONE) {
- if (arg->indirect)
- res&=0x00FFFF0000;
- else if (arg->num.i<0) {
- if (arg->num.i>=I8_MIN)
- res&=0x8FE;
- else if (arg->num.i>=I16_MIN)
- res&=0x8EE;
- else if (arg->num.i>=I32_MIN)
- res&=0x8CE;
- else
- res&=0x88E;
- } else {
- if (arg->num.i<=I8_MAX)
- res&=0xFFE;
- else if (arg->num.i<=U8_MAX)
- res&=0xFEE;
- else if (arg->num.i<=I16_MAX)
- res&=0xEEE;
- else if (arg->num.i<=U16_MAX)
- res&=0xECE;
- else if (arg->num.i<=I32_MAX)
- res&=0xCCE;
- else if (arg->num.i<=U32_MAX)
- res&=0xC8E;
- else
- res&=0x88E;
- }
- } else {
- res&= 0x3F00FFF000;
- if (!arg->indirect) //M8-M64
- res&=0xFFFF0FFFFF;
- }
- switch (arg->reg1) {
- case REG_RAX: res&=~0x3000000000; break;
- case REG_RCX: res&=~0x2F00000000; break;
- case REG_RDX: res&=~0x1F00000000; break;
- default: res&=~0x3F00000000;
- }
-mm_done:
- return res;
-}
-
-Bool AsmStoreNum(CCmpCtrl *cc,CAsmNum2 *num2,I64 cnt,Bool U8_avail)
-{
- CAOTCtrl *aotc=cc->aotc;
- I64 i;
- CAOTAbsAddr *tmpa;
-
- if (!num2->imm_flag)
- num2->num.i-=num2->rel;
- for (i=0;i<cnt;i++) {
- if (num2->U8_cnt==1) {
- if (num2->num.local_asm_undef_hash||num2->num.glbl_asm_undef_hash)
- AsmUnresolvedAdd(cc,num2->num.machine_code,IET_REL_I8+num2->imm_flag,
- aotc->rip,num2->rel,num2->num.local_asm_undef_hash,
- num2->num.glbl_asm_undef_hash,cc->lex_include_stk->line_num,
- U8_avail);
- else if (!num2->imm_flag && !(I8_MIN<=num2->num.i<=I8_MAX))
- LexExcept(cc,"Branch out of range at ");
- if (num2->imm_flag) {
- if (num2->num.abs_cnts.abs_addres&1) {
- tmpa=CAlloc(sizeof(CAOTAbsAddr));
- tmpa->next=aotc->abss;
- aotc->abss=tmpa;
- tmpa->rip=aotc->rip;
- tmpa->type=AAT_ADD_U8;
- }
- } else {
- if (num2->num.abs_cnts.c_addres&1) {
- tmpa=CAlloc(sizeof(CAOTAbsAddr));
- tmpa->next=aotc->abss;
- aotc->abss=tmpa;
- tmpa->rip=aotc->rip;
- tmpa->type=AAT_SUB_U8;
- }
- }
- AOTStoreCodeU8(cc,num2->num.i);
- } else {
- if (num2->U8_cnt==2) {
- if (num2->num.local_asm_undef_hash||num2->num.glbl_asm_undef_hash)
- AsmUnresolvedAdd(cc,num2->num.machine_code,IET_REL_I16+num2->imm_flag,
- aotc->rip,num2->rel,num2->num.local_asm_undef_hash,
- num2->num.glbl_asm_undef_hash,cc->lex_include_stk->line_num,
- U8_avail);
- else if (!num2->imm_flag && !(I16_MIN<=num2->num.i<=I16_MAX))
- LexExcept(cc,"Branch out of range at ");
- if (num2->imm_flag) {
- if (num2->num.abs_cnts.abs_addres&1) {
- tmpa=CAlloc(sizeof(CAOTAbsAddr));
- tmpa->next=aotc->abss;
- aotc->abss=tmpa;
- tmpa->rip=aotc->rip;
- tmpa->type=AAT_ADD_U16;
- }
- } else {
- if (num2->num.abs_cnts.c_addres&1) {
- tmpa=CAlloc(sizeof(CAOTAbsAddr));
- tmpa->next=aotc->abss;
- aotc->abss=tmpa;
- tmpa->rip=aotc->rip;
- tmpa->type=AAT_SUB_U16;
- }
- }
- AOTStoreCodeU8(cc,num2->num.i.u8[0]);
- AOTStoreCodeU8(cc,num2->num.i.u8[1]);
- } else if (num2->U8_cnt==4) {
- if (num2->num.local_asm_undef_hash||num2->num.glbl_asm_undef_hash)
- AsmUnresolvedAdd(cc,num2->num.machine_code,IET_REL_I32+num2->imm_flag,
- aotc->rip,num2->rel,num2->num.local_asm_undef_hash,
- num2->num.glbl_asm_undef_hash,cc->lex_include_stk->line_num,
- U8_avail);
- else if (!num2->imm_flag && !(I32_MIN<=num2->num.i<=I32_MAX))
- LexExcept(cc,"Branch out of range at ");
- if (num2->imm_flag) {
- if (num2->num.abs_cnts.abs_addres&1) {
- tmpa=CAlloc(sizeof(CAOTAbsAddr));
- tmpa->next=aotc->abss;
- aotc->abss=tmpa;
- tmpa->rip=aotc->rip;
- tmpa->type=AAT_ADD_U32;
- }
- } else {
- if (num2->num.abs_cnts.c_addres&1) {
- tmpa=CAlloc(sizeof(CAOTAbsAddr));
- tmpa->next=aotc->abss;
- aotc->abss=tmpa;
- tmpa->rip=aotc->rip;
- tmpa->type=AAT_SUB_U32;
- }
- }
- AOTStoreCodeU32(cc,num2->num.i);
- } else if (num2->U8_cnt==8) {
- if (num2->num.local_asm_undef_hash||num2->num.glbl_asm_undef_hash)
- AsmUnresolvedAdd(cc,num2->num.machine_code,IET_REL_I64+num2->imm_flag,
- aotc->rip,num2->rel,num2->num.local_asm_undef_hash,
- num2->num.glbl_asm_undef_hash,cc->lex_include_stk->line_num,
- U8_avail);
- if (num2->imm_flag) {
- if (num2->num.abs_cnts.abs_addres&1) {
- tmpa=CAlloc(sizeof(CAOTAbsAddr));
- tmpa->next=aotc->abss;
- aotc->abss=tmpa;
- tmpa->rip=aotc->rip;
- tmpa->type=AAT_ADD_U64;
- }
- } else {
- if (num2->num.abs_cnts.c_addres&1) {
- tmpa=CAlloc(sizeof(CAOTAbsAddr));
- tmpa->next=aotc->abss;
- aotc->abss=tmpa;
- tmpa->rip=aotc->rip;
- tmpa->type=AAT_SUB_U64;
- }
- }
- AOTStoreCodeU64(cc,num2->num.i);
- }
- if (U8_avail && !num2->num.local_asm_undef_hash &&
- !num2->num.glbl_asm_undef_hash &&
- !num2->imm_flag && -124<=num2->num.i<=123) {
- LexWarn(cc,"could use I8 displacement at ");
- return FALSE;
- }
- }
- }
- return TRUE;
-}
-
-U8 asm_seg_prefixes[6]={0x26,0x2E,0x36,0x3E,0x64,0x65};
-
-Bool PrsAsmInst(CCmpCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
-{
- CAOTCtrl *aotc=cc->aotc;
- I64 i,j,arg1,arg2,om,seg,arg1mask,arg2mask;
- CAsmArg *tmpa1,*tmpa2;
- Bool ModrM_complete,U8_avail=FALSE,found_second_possible=FALSE;
- CInst *tmpins;
- CAsmIns cur,best;
-
- best.U8_cnt=255;
- if (argcnt>0)
- arg1mask=AsmMakeArgMask(cc,&aotc->arg1);
- else
- arg1mask=1;
- if (argcnt>1)
- arg2mask=AsmMakeArgMask(cc,&aotc->arg2);
- else
- arg2mask=1;
- for (i=0;i<tmpo->inst_entry_cnt;i++) {
- tmpins=&tmpo->ins[i];
- if (tmpins->arg1==ARGT_REL8 || tmpins->arg2==ARGT_REL8)
- U8_avail=TRUE;
- if (Bt(&arg1mask,tmpins->arg1) && Bt(&arg2mask,tmpins->arg2) &&
- (!(tmpins->flags&IEF_NOT_IN_64_BIT) || aotc->seg_size!=64)) {
- MemSet(&cur,0,sizeof(CAsmIns));
- cur.tmpins=tmpins;
- ModrM_complete=FALSE;
- cur.is_dft=ToBool(tmpins->flags & IEF_DFT);
- if (aotc->seg_size==64) {
- if (tmpins->flags & IEF_48_REX)
- cur.REX=0x48;
- else
- cur.REX=0x40;
- }
- cur.disp.imm_flag=TRUE;
- cur.imm.imm_flag=TRUE;
- om=tmpins->opcode_modifier;
- arg1=tmpins->arg1;
- arg2=tmpins->arg2;
- tmpa1=&aotc->arg1;
- tmpa2=&aotc->arg2;
- cur.last_opcode_U8=tmpins->opcode[tmpins->opcode_cnt-1];
-
- if (tmpins->slash_val<8) {
- cur.ModrM|=tmpins->slash_val<<3;
- cur.has_ModrM=TRUE;
- }
-
- if (aotc->seg_size==16 && tmpins->flags & IEF_OP_SIZE32 ||
- aotc->seg_size!=16 && tmpins->flags & IEF_OP_SIZE16)
- cur.has_operand_prefix=TRUE;
-
- if (om==OM_IB) cur.imm.U8_cnt=1;
- else if (om==OM_IW) cur.imm.U8_cnt=2;
- else if (om==OM_ID) cur.imm.U8_cnt=4;
-
- if (om==OM_CB) {
- cur.imm.U8_cnt=1;
- cur.imm.imm_flag=FALSE;
- } else if (om==OM_CW) {
- cur.imm.U8_cnt=2;
- cur.imm.imm_flag=FALSE;
- } else if (om==OM_CD) {
- cur.imm.U8_cnt=4;
- cur.imm.imm_flag=FALSE;
- }
-
- if (argcnt==1) {
- if (best.U8_cnt!=255 && !found_second_possible && !best.is_dft) {
- found_second_possible=TRUE;
- if (!aotc->arg1.size)
- PrintWarn("no size specified at %s,%04d\n",
- cc->lex_include_stk->full_name,
- cc->lex_include_stk->line_num-1);
- }
- if (tmpins->flags & IEF_PLUS_OPCODE) {
- if (tmpins->slash_val==SV_R_REG) {
- cur.last_opcode_U8|=tmpa1->reg1&7;
- if (tmpa1->reg1&15>7)
- cur.REX|=1;
- if (tmpa1->reg1>=20) //RBPu8,RSPu8,RSIu8,RDIu8?
- cur.has_REX=TRUE;
- } else {//SV_I_REG
- if (tmpa1->reg1_type==REGT_FSTK)
- cur.last_opcode_U8+=tmpa1->reg1;
- }
- }
- if (arg1==ARGT_R64 || arg1==ARGT_RM64 || arg1==ARGT_M64)
- cur.REX|=8;
- if (ARGT_RM8<=arg1<=ARGT_RM64 || ARGT_M8<=arg1<=ARGT_M64) {
- if (aotc->seg_size==16)
- cur.has_addr_prefix=TRUE;
-
- cur.has_ModrM=TRUE;
- if (tmpa1->imm_or_off_present && tmpa1->indirect &&
- tmpa1->reg1==REG_NONE) {
- cur.ModrM=cur.ModrM+5;
- MemCpy(&cur.disp.num,&tmpa1->num,sizeof(CAsmNum));
- cur.disp.U8_cnt=4;
- if (aotc->seg_size==64)
- cur.disp.imm_flag=FALSE;
- } else {
- if (tmpa1->reg2==REG_NONE && tmpa1->scale==1) {
- cur.ModrM|=tmpa1->reg1&7;
- if (tmpa1->reg1&15>7)
- cur.REX|=1;
- if (tmpa1->reg1>=20) //RBPu8,RSPu8,RSIu8,RDIu8?
- cur.has_REX=TRUE;
- } else {
- cur.ModrM|=4;
- cur.has_SIB=TRUE;
- if (tmpa1->scale==1)
- cur.SIB=0;
- else if (tmpa1->scale==2)
- cur.SIB=0x40;
- else if (tmpa1->scale==4)
- cur.SIB=0x80;
- else if (tmpa1->scale==8)
- cur.SIB=0xC0;
- if (tmpa1->reg2==REG_NONE) {
- ModrM_complete=TRUE;
- cur.SIB|=(tmpa1->reg1&7)<<3+REG_RBP;
- if (tmpa1->reg1&15>7)
- cur.REX|=2;
- if (tmpa1->reg1>=20) //RBPu8,RSPu8,RSIu8,RDIu8?
- cur.has_REX=TRUE;
- MemCpy(&cur.disp.num,&tmpa1->num,sizeof(CAsmNum));
- cur.disp.U8_cnt=4;
- } else {
- cur.SIB|=(tmpa1->reg1&7)<<3+tmpa1->reg2&7;
- if (tmpa1->reg1&15>7)
- cur.REX|=2;
- if (tmpa1->reg1>=20) //RBPu8,RSPu8,RSIu8,RDIu8?
- cur.has_REX=TRUE;
- if (tmpa1->reg2&15>7)
- cur.REX|=1;
- if (tmpa1->reg2>=20) //RBPu8,RSPu8,RSIu8,RDIu8?
- cur.has_REX=TRUE;
- if (tmpa1->reg2&7==REG_RBP &&
- !tmpa1->imm_or_off_present && tmpa1->indirect) {
- cur.ModrM|=0x40;
- cur.disp.U8_cnt=1;
- ModrM_complete=TRUE;
- }
- }
- }
- if (!ModrM_complete) {
- if (tmpa1->imm_or_off_present) {
- MemCpy(&cur.disp.num,&tmpa1->num,sizeof(CAsmNum));
- if (!cur.disp.num.machine_code &&
- I8_MIN<=cur.disp.num.i<=I8_MAX) {
- cur.ModrM|=0x40;
- cur.disp.U8_cnt=1;
- } else if (aotc->seg_size==16) {
- cur.ModrM|=0x80;
- cur.disp.U8_cnt=2;
- } else {
- cur.ModrM|=0x80;
- cur.disp.U8_cnt=4;
- }
- } else if (!tmpa1->indirect) {
- cur.has_addr_prefix=FALSE;
- cur.ModrM|=0xC0;
- } else {
- if (tmpa1->reg1&7==REG_RBP) {
- cur.ModrM|=0x40;
- cur.disp.U8_cnt=1;
- }
- }
- }
- }
- } else if (ARGT_REL8<=arg1<=ARGT_REL32 || ARGT_IMM8<=arg1<=ARGT_IMM64 ||
- ARGT_UIMM8<=arg1<=ARGT_UIMM64) {
- if (arg1==ARGT_IMM64 || arg2==ARGT_UIMM64)
- cur.REX|=8;
- MemCpy(&cur.imm.num,&tmpa1->num,sizeof(CAsmNum));
- }
- } else if (argcnt==2) {
- if (best.U8_cnt!=255 && !found_second_possible && !best.is_dft) {
- found_second_possible=TRUE;
- if (!aotc->arg1.size && !aotc->arg2.size)
- PrintWarn("no size specified at %s,%04d\n",
- cc->lex_include_stk->full_name,
- cc->lex_include_stk->line_num-1);
- }
- if (tmpins->flags & IEF_PLUS_OPCODE) {
- if (tmpins->slash_val==SV_R_REG) {
- if (ARGT_AL<=arg1<=ARGT_RAX) {
- cur.last_opcode_U8|=tmpa2->reg1&7;
- if (tmpa2->reg1&15>7)
- cur.REX|=1;
- if (tmpa2->reg1>=20) //RBPu8,RSPu8,RSIu8,RDIu8?
- cur.has_REX=TRUE;
- } else {
- cur.last_opcode_U8|=tmpa1->reg1&7;
- if (tmpa1->reg1&15>7)
- cur.REX|=1;
- if (tmpa1->reg1>=20) //RBPu8,RSPu8,RSIu8,RDIu8?
- cur.has_REX=TRUE;
- }
- } else {//SV_I_REG
- if (tmpa1->reg1_type==REGT_FSTK)
- cur.last_opcode_U8|=tmpa1->reg1;
- if (tmpa2->reg1_type==REGT_FSTK)
- cur.last_opcode_U8|=tmpa2->reg1;
- }
- }
- if (arg1==ARGT_RM64 || arg2==ARGT_RM64 ||
- arg1==ARGT_M64 || arg2==ARGT_M64 ||
- arg1==ARGT_R64 || arg2==ARGT_R64)
- cur.REX|=8;
- if (ARGT_RM8<=arg1<=ARGT_RM64 || ARGT_RM8<=arg2<=ARGT_RM64 ||
- ARGT_M8<=arg1<=ARGT_M64 || ARGT_M8<=arg2<=ARGT_M64) {
- if (aotc->seg_size==16)
- cur.has_addr_prefix=TRUE;
- cur.has_ModrM=TRUE;
- if (ARGT_RM8<=arg2<=ARGT_RM64 || ARGT_M8<=arg2<=ARGT_M64) {
- tmpa1=&aotc->arg2;
- tmpa2=&aotc->arg1;
- }
- if (tmpins->slash_val==SV_R_REG) {
- if (tmpa2->just_seg)
- cur.ModrM|=tmpa2->seg<<3;
- else {
- if (tmpa2->reg1==REG_NONE) {
- cur.ModrM|=(tmpa1->reg1&7)<<3;
- if (tmpa1->reg1&15>7)
- cur.REX|=4;
- if (tmpa1->reg1>=20) //RBPu8,RSPu8,RSIu8,RDIu8?
- cur.has_REX=TRUE;
- } else {
- cur.ModrM|=(tmpa2->reg1&7)<<3;
- if (tmpa2->reg1&15>7)
- cur.REX|=4;
- if (tmpa2->reg1>=20) //RBPu8,RSPu8,RSIu8,RDIu8?
- cur.has_REX=TRUE;
- }
- }
- }
- if (tmpa1->reg2==REG_NONE && tmpa1->scale==1) {
- if (tmpa1->reg1!=REG_NONE) {
- cur.ModrM|=tmpa1->reg1&7;
- if (tmpa1->reg1&15>7)
- cur.REX|=1;
- if (tmpa1->reg1>=20) //RBPu8,RSPu8,RSIu8,RDIu8?
- cur.has_REX=TRUE;
- }
- } else {
- cur.ModrM|=4;
- cur.has_SIB=TRUE;
- if (tmpa1->scale==1)
- cur.SIB=0;
- else if (tmpa1->scale==2)
- cur.SIB=0x40;
- else if (tmpa1->scale==4)
- cur.SIB=0x80;
- else if (tmpa1->scale==8)
- cur.SIB=0xC0;
- if (tmpa1->reg2==REG_NONE) {
- ModrM_complete=TRUE;
- cur.SIB|=(tmpa1->reg1&7)<<3+5;
- if (tmpa1->reg1&15>7)
- cur.REX|=2;
- if (tmpa1->reg1>=20) //RBPu8,RSPu8,RSIu8,RDIu8?
- cur.has_REX=TRUE;
- MemCpy(&cur.disp.num,&tmpa1->num,sizeof(CAsmNum));
- cur.disp.U8_cnt=4;
- } else {
- cur.SIB|=(tmpa1->reg1&7)<<3+tmpa1->reg2&7;
- if (tmpa1->reg1&15>7)
- cur.REX|=2;
- if (tmpa1->reg1>=20) //RBPu8,RSPu8,RSIu8,RDIu8?
- cur.has_REX=TRUE;
- if (tmpa1->reg2&15>7)
- cur.REX|=1;
- if (tmpa1->reg2>=20) //RBPu8,RSPu8,RSIu8,RDIu8?
- cur.has_REX=TRUE;
- if (tmpa1->reg2&7==REG_RBP &&
- !tmpa1->imm_or_off_present && tmpa1->indirect) {
- cur.ModrM|=0x40;
- cur.disp.U8_cnt=1;
- ModrM_complete=TRUE;
- }
- }
- }
- if (!ModrM_complete) {
- if (tmpa1->imm_or_off_present &&
- tmpa1->indirect && tmpa1->reg1==REG_NONE) {
- cur.ModrM=cur.ModrM&0xF8+5;
- MemCpy(&cur.disp.num,&tmpa1->num,sizeof(CAsmNum));
- cur.disp.U8_cnt=4;
- if (aotc->seg_size==64)
- cur.disp.imm_flag=FALSE;
- } else {
- if (tmpa1->imm_or_off_present) {
- MemCpy(&cur.disp.num,&tmpa1->num,sizeof(CAsmNum));
- if (!cur.disp.num.machine_code &&
- I8_MIN<=cur.disp.num.i<=I8_MAX) {
- cur.ModrM|=0x40;
- cur.disp.U8_cnt=1;
- } else if (aotc->seg_size==16) {
- cur.ModrM|=0x80;
- cur.disp.U8_cnt=2;
- } else {
- cur.ModrM|=0x80;
- cur.disp.U8_cnt=4;
- }
- } else if (!tmpa1->indirect) {
- cur.has_addr_prefix=FALSE;
- cur.ModrM|=0xC0;
- } else {
- if (tmpa1->reg1&7==REG_RBP) {
- cur.ModrM|=0x40;
- cur.disp.U8_cnt=1;
- }
- }
- }
- }
- } else if (ARGT_MOFFS8<=arg1<=ARGT_MOFFS64) {
- MemCpy(&cur.disp.num,&tmpa1->num,sizeof(CAsmNum));
- if (aotc->seg_size==16)
- cur.disp.U8_cnt=2;
- else
- cur.disp.U8_cnt=4;
- cur.has_addr_prefix=FALSE;
- } else if (ARGT_MOFFS8<=arg2<=ARGT_MOFFS64) {
- MemCpy(&cur.disp.num,&tmpa2->num,sizeof(CAsmNum));
- if (aotc->seg_size==16)
- cur.disp.U8_cnt=2;
- else
- cur.disp.U8_cnt=4;
- cur.has_addr_prefix=FALSE;
- } else if (ARGT_IMM8<=arg1<=ARGT_IMM64 ||
- ARGT_UIMM8<=arg1<=ARGT_UIMM64) {
- MemCpy(&cur.imm.num,&tmpa1->num,sizeof(CAsmNum));
- if (arg1==ARGT_IMM8 || arg1==ARGT_UIMM8) cur.imm.U8_cnt=1;
- else if (arg1==ARGT_IMM16 || arg1==ARGT_UIMM16) cur.imm.U8_cnt=2;
- else if (arg1==ARGT_IMM32 || arg1==ARGT_UIMM32) cur.imm.U8_cnt=4;
- else {
- cur.imm.U8_cnt=8;
- cur.REX|=8;
- }
- }
- if (ARGT_IMM8<=arg2<=ARGT_IMM64 ||
- ARGT_UIMM8<=arg2<=ARGT_UIMM64) {
- MemCpy(&cur.imm.num,&tmpa2->num,sizeof(CAsmNum));
- if (arg2==ARGT_IMM8 || arg2==ARGT_UIMM8) cur.imm.U8_cnt=1;
- else if (arg2==ARGT_IMM16 || arg2==ARGT_UIMM16) cur.imm.U8_cnt=2;
- else if (arg2==ARGT_IMM32 || arg2==ARGT_UIMM32) {
- cur.imm.U8_cnt=4;
- if (tmpins->flags&IEF_REX_ONLY_R8_R15 && arg2==ARGT_UIMM32)
- cur.REX&=~8;
- } else {
- cur.imm.U8_cnt=8;
- cur.REX|=8;
- }
- }
- }
- cur.U8_cnt=tmpins->opcode_cnt+cur.disp.U8_cnt+cur.imm.U8_cnt;
- if (cur.has_ModrM) cur.U8_cnt++;
- if (cur.has_SIB) cur.U8_cnt++;
- if (aotc->seg_size==64 && cur.REX&0x40==0x40 &&
- (cur.REX!=0x40 || cur.has_REX) &&
- (cur.REX&7 || !(tmpins->flags&IEF_REX_ONLY_R8_R15 ||
- tmpins->flags&IEF_REX_XOR_LIKE && tmpa1->reg1==tmpa2->reg1 &&
- cur.ModrM&0xC0==0xC0)))
- cur.U8_cnt++;
- if (cur.U8_cnt<best.U8_cnt &&
- !(tmpins->flags & IEF_DONT_SWITCH_MODES &&
- (cur.has_addr_prefix || cur.has_operand_prefix)))
- MemCpy(&best,&cur,sizeof(CAsmIns));
- }
- }
- if (best.U8_cnt<255) {
- tmpins=best.tmpins;
- seg=REG_NONE;
- if (argcnt>1 && aotc->arg2.seg!=REG_NONE && !aotc->arg2.just_seg)
- seg=aotc->arg2.seg;
- else if (argcnt>0 && aotc->arg1.seg!=REG_NONE && !aotc->arg1.just_seg)
- seg=aotc->arg1.seg;
- if (seg!=REG_NONE)
- AOTStoreCodeU8(cc,asm_seg_prefixes[seg]);
- if (best.has_operand_prefix)
- AOTStoreCodeU8(cc,OC_OP_SIZE_PREFIX); //Operand size override
- if (best.has_addr_prefix || aotc->seg_size==16 && cur.has_SIB)
- AOTStoreCodeU8(cc,OC_ADDR_SIZE_PREFIX); //Operand size override
- if (aotc->seg_size==64 && best.REX&0x40==0x40 &&
- (best.REX!=0x40 || best.has_REX) &&
- (best.REX&7||!(tmpins->flags&IEF_REX_ONLY_R8_R15 ||
- tmpins->flags&IEF_REX_XOR_LIKE && tmpa1->reg1==tmpa2->reg1 &&
- best.ModrM&0xC0==0xC0)))
- AOTStoreCodeU8(cc,best.REX);
- for (j=0;j<tmpins->opcode_cnt-1;j++)
- AOTStoreCodeU8(cc,tmpins->opcode[j]);
- AOTStoreCodeU8(cc,best.last_opcode_U8);
-
- if (best.has_ModrM)
- AOTStoreCodeU8(cc,best.ModrM);
- if (best.has_SIB)
- AOTStoreCodeU8(cc,best.SIB);
-
- if (best.disp.U8_cnt) {
- best.disp.rel=aotc->rip+best.disp.U8_cnt+best.imm.U8_cnt;
- if (!AsmStoreNum(cc,&best.disp,1,U8_avail))
- return FALSE;
- }
-
- if (best.imm.U8_cnt) {
- best.imm.rel=aotc->rip+best.imm.U8_cnt;
- if (!AsmStoreNum(cc,&best.imm,1,U8_avail))
- return FALSE;
- }
- if (tmpins->flags&IEF_ENDING_ZERO) //ENTER inst
- AOTStoreCodeU8(cc,0);
- return TRUE;
- }
- LexExcept(cc,"Invalid inst at ");
-}
-
-U0 PrsAsmDefine(CCmpCtrl *cc,I64 U8_cnt)
-{
- Bool is_dup;
- I64 i,dup_val;
- U8 *ptr;
- CAsmNum2 num2;
- num2.U8_cnt=U8_cnt;
-
- while (cc->token && cc->token!=';') {
- num2.num.local_asm_undef_hash=NULL;
- num2.num.glbl_asm_undef_hash=NULL;
- if (cc->token==TK_STR) {
- ptr=cc->cur_str;
- i=cc->cur_str_len-1;
- while (i--)
- AOTStoreCodeU8(cc,*ptr++);
- Lex(cc); //Skip Str
- } else {
- is_dup=FALSE;
- cc->abs_cnts=0;
- cc->asm_undef_hash=NULL;
- cc->flags&=~(CCF_UNRESOLVED+CCF_LOCAL);
- if (!IsLexExpression2Bin(cc,&num2.num.machine_code))
- LexSkipEol(cc);
- else {
- if (cc->abs_cnts.externs)
- LexExcept(cc,"Extern Not Allowed at ");
- if (cc->flags & CCF_UNRESOLVED) {
- if (cc->flags & CCF_LOCAL) {
- num2.num.local_asm_undef_hash=cc->asm_undef_hash;
- cc->asm_undef_hash=NULL;
- } else {
- num2.num.glbl_asm_undef_hash=cc->asm_undef_hash;
- cc->asm_undef_hash=NULL;
- }
- } else {
- i=Call(num2.num.machine_code);
- Free(num2.num.machine_code);
- }
- }
- if (cc->token==TK_IDENT && cc->hash_entry) {
- if (cc->hash_entry->type & HTT_ASM_KEYWORD &&
- cc->hash_entry->user_data0==AKW_DUP) {
- is_dup=TRUE;
- if (Lex(cc)!='(')
- LexExcept(cc,"Expecting '(' at ");
- Lex(cc); //skip (
- dup_val=AsmLexExpression(cc);
- if (cc->token!=')')
- LexExcept(cc,"Expecting ')' at ");
- Lex(cc); //SKIP )
- }
- }
- num2.rel=0;
- num2.imm_flag=TRUE;
- num2.num.abs_cnts=cc->abs_cnts;
- if (is_dup) {
- if (num2.num.local_asm_undef_hash || num2.num.glbl_asm_undef_hash)
- LexExcept(cc,"Undefined DUP cnt at ");
- num2.num.i=dup_val;
- AsmStoreNum(cc,&num2,i,FALSE);
- } else {
- num2.num.i=i;
- AsmStoreNum(cc,&num2,1,FALSE);
- }
- }
- if (cc->token==',')
- Lex(cc);
- }
- if (cc->token!=';')
- LexExcept(cc,"Missing ';' at");
- Lex(cc);
-}
-
-U0 PrsBinFile(CCmpCtrl *cc)
-{
- I64 i,size;
- U8 *buf,*st;
- if (cc->token!=TK_STR)
- LexExcept(cc,"Expecting string at ");
- st=ExtDft(cc->cur_str,"BIN");
- buf=FileRead(st,&size);
- Free(st);
- for (i=0;i<size;i++)
- AOTStoreCodeU8(cc,buf[i]);
- if (Lex(cc)!=';')
- LexExcept(cc,"Missing ';' at");
- Lex(cc);
-}
-
-U0 PrsAsmBlk(CCmpCtrl *cc,I64 cmp_flags)
-{
- CAOTCtrl *aotc=cc->aotc;
- I64 i,j,k,argcnt,
- old_flags=cc->flags & CCF_ASM_EXPRESSIONS;
- CHashOpcode *tmpo;
- CHashExport *tmpex;
- U8 *next_last_label;
- CCodeMisc *g_lb;
-
- aotc->seg_size=64;
- cc->flags|=CCF_ASM_EXPRESSIONS;
- if (!(cmp_flags&CMPF_ONE_ASM_INS)) {
- if (cc->token!='{')
- LexExcept(cc,"Expecting '{' at ");
- Lex(cc);
- }
- while (cc->token && cc->token!='}') {
- AsmLineLst(cc);
- if (cc->token==TK_IDENT && cc->hash_entry) {
- if (cc->hash_entry->type&HTT_ASM_KEYWORD) {
- i=cc->hash_entry->user_data0;
- Lex(cc); //skip keyword
- switch (i) {
- case AKW_IMPORT:
- while (cc->token && cc->token!=';') {
- if (cc->token!=TK_IDENT)
- LexExcept(cc,"Expecting identifier at ");
- else {
- tmpex=NULL;
- tmpex=CAlloc(sizeof(CHashExport));
- tmpex->str=cc->cur_str;
- cc->cur_str=0;
- tmpex->type=HTT_EXPORT_SYS_SYM|HTF_UNRESOLVED;
- HashAdd(tmpex,cc->htc.glbl_hash_table);
- tmpex->type|=HTF_IMPORT;
- if (Lex(cc)==',')
- Lex(cc); //skip ','
- }
- }
- if (cc->token!=';')
- LexExcept(cc,"Missing ';' at");
- Lex(cc); //skip ';';
- break;
- case AKW_ORG:
- if (cc->htc.local_var_lst)
- LexExcept(cc,"ORG not allowed in fun asm blk ");
- if (aotc->org!=INVALID_PTR)
- LexExcept(cc,"Just one org allowed ");
- if (aotc->rip)
- LexExcept(cc,"ORG must be at beginning ");
- aotc->org=AsmLexExpression(cc);
- break;
- case AKW_ALIGN:
- if (cc->htc.local_var_lst)
- LexExcept(cc,"ALIGN not allowed in fun asm blk ");
- i=AsmLexExpression(cc);
- j=Bsf(i);
- if (!i || j!=Bsr(i))
- LexExcept(cc,"ALIGN must be power of two at ");
- if (!(cc->flags&CCF_AOT_COMPILE) && i>8)
- LexExcept(cc,"In JIT mode, max ALIGN is 8 ");
- if (j>aotc->max_align_bits) aotc->max_align_bits=j;
- i=CeilU64(aotc->rip,i);
- if (cc->token!=',')
- LexExcept(cc,"Expecting ',' at ");
- Lex(cc);
- k=AsmLexExpression(cc);
- for (j=aotc->rip;j<i;j++)
- AOTStoreCodeU8(cc,k);
- break;
- case AKW_DU8:
- PrsAsmDefine(cc,1);
- break;
- case AKW_DU16:
- PrsAsmDefine(cc,2);
- break;
- case AKW_DU32:
- PrsAsmDefine(cc,4);
- break;
- case AKW_DU64:
- PrsAsmDefine(cc,8);
- break;
- case AKW_BINFILE:
- PrsBinFile(cc);
- break;
- case AKW_LIST:
- aotc->lst=TRUE;
- break;
- case AKW_NOLIST:
- aotc->lst=FALSE;
- break;
- case AKW_USE16:
- aotc->seg_size=16;
- break;
- case AKW_USE32:
- aotc->seg_size=32;
- break;
- case AKW_USE64:
- aotc->seg_size=64;
- break;
- default:
- LexExcept(cc,"Syntax error at ");
- }
- } else if (cc->hash_entry->type & HTT_OPCODE) {
- tmpo=cc->hash_entry;
- Lex(cc); //skip opcode
- argcnt=0;
- if (tmpo->ins[0].arg1) {
- argcnt++;
- if (ARGT_REL8<=tmpo->ins[0].arg1<=ARGT_REL32)
- PrsAsmArg(cc,&aotc->arg1,TRUE);
- else
- PrsAsmArg(cc,&aotc->arg1,FALSE);
- if (tmpo->ins[0].arg2) {
- argcnt++;
- if (cc->token!=',')
- LexExcept(cc,"Expecting ',' at ");
- else {
- Lex(cc); //skip ','
- if (ARGT_REL8<=tmpo->ins[0].arg2<=ARGT_REL32)
- PrsAsmArg(cc,&aotc->arg2,TRUE);
- else
- PrsAsmArg(cc,&aotc->arg2,FALSE);
- }
- }
- }
- PrsAsmInst(cc,tmpo,argcnt);
- } else if (cc->hash_entry->type & HTT_EXPORT_SYS_SYM) {
- if (Btr(&cc->hash_entry->type,HTf_UNRESOLVED)) {
- if (cc->hash_entry->type & HTF_LOCAL) {
- cc->hash_entry(CHashExport *)->val=aotc->rip;
- if (Lex(cc)!=':')
- LexExcept(cc,"Expecting ':' at ");
- Lex(cc);
- } else {
- if (cc->hash_entry->type & HTF_IMPORT)
- LexExcept(cc,"attempt to define import at ");
- cc->hash_entry(CHashExport *)->val=aotc->rip;
- next_last_label=cc->hash_entry->str;
- Lex(cc); //Skip cur_str
- if (cc->token!=':' && cc->token!=TK_DBL_COLON)
- LexExcept(cc,"Expecting ':' at ");
- if (cc->token==TK_DBL_COLON) {
- cc->hash_entry->type|=HTF_EXPORT;
- HashSrcFileSet(cc,cc->hash_entry);
-
- AOTLocalsResolve(cc);
- aotc->last_label=next_last_label;
- }
- Lex(cc);
- }
- } else if (cc->hash_entry(CHashExport *)->val==aotc->rip) {
- Lex(cc); //Skip cur_str
- if (cc->token!=':' && cc->token!=TK_DBL_COLON)
- LexExcept(cc,"Expecting ':' at ");
- Lex(cc);
- } else
- LexExcept(cc,"Redefinition at ");
- } else
- LexExcept(cc,"Syntax error at ");
- } else if (cc->token==TK_IDENT) {
- tmpex=CAlloc(sizeof(CHashExport));
- tmpex->str=cc->cur_str;
- cc->cur_str=0;
- tmpex->type=HTT_EXPORT_SYS_SYM;
- tmpex->val=aotc->rip;
- Lex(cc); //Skip cur_str
- if (cc->token!=':' && cc->token!=TK_DBL_COLON)
- LexExcept(cc,"Expecting ':' at ");
- else {
- if (*tmpex->str=='@' && tmpex->str[1]=='@') {
- if (cc->token==TK_DBL_COLON)
- LexExcept(cc,"No local glbl exports at ");
- HashAdd(tmpex,cc->htc.local_hash_table);
- } else
- HashAdd(tmpex,cc->htc.glbl_hash_table);
- if (cc->htc.local_var_lst) {//AsmBlk in fun? Also add goto-like label.
- if (!(g_lb=COCGoToLabelFind(cc,tmpex->str))) {
- g_lb=COCMiscNew(cc,CMT_ASM_LABEL);
- g_lb->str=StrNew(tmpex->str);
- } else if (g_lb->flags&CMF_DEFINED)
- LexExcept(cc,"Duplicate goto label at ");
- g_lb->type=CMT_ASM_LABEL;
- g_lb->flags|=CMF_DEFINED;
- g_lb->rip=aotc->rip;
- g_lb->use_cnt++; //Disable warning on unused labels.
- ICAdd(cc,IC_LABEL,g_lb,0);
- }
- if (cc->token==TK_DBL_COLON) {
- tmpex->type|=HTF_EXPORT;
- HashSrcFileSet(cc,tmpex);
-
- AOTLocalsResolve(cc);
- aotc->last_label=tmpex->str;
- }
- Lex(cc);
- }
- } else if (cc->token==';')
- Lex(cc);
- else
- LexExcept(cc,"Syntax error at ");
- if (cmp_flags&CMPF_ONE_ASM_INS && (cc->token!=TK_IDENT ||
- !(tmpo=cc->hash_entry) ||
- !(tmpo->type&(HTT_OPCODE|HTT_ASM_KEYWORD))))
- break;
- }
- AOTLocalsResolve(cc);
- aotc->lst=FALSE;
- cc->flags&=cc->flags&~CCF_ASM_EXPRESSIONS|old_flags;
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/AsmInit.HC.HTML b/public/src/Compiler/AsmInit.HC.HTML deleted file mode 100644 index f24a998..0000000 --- a/public/src/Compiler/AsmInit.HC.HTML +++ /dev/null @@ -1,221 +0,0 @@ - - - - - AsmInit.HC - - - - - U0 AsmPrsInsFlags(CCmpCtrl *cc,CInst *tmpins)
-{
- I64 i;
- while (TRUE) {
- switch (cc->token) {
- case TK_IDENT:
- if ((i=LstMatch(cc->cur_str,"NO\0CB\0CW\0CD\0CP\0IB\0IW\0ID\0"))>=0) {
- tmpins->opcode_modifier=i;
- break;
- } else
- return;
- case TK_I64:
- if (cc->cur_i64==16)
- tmpins->flags|=IEF_OP_SIZE16;
- else if (cc->cur_i64==32)
- tmpins->flags|=IEF_OP_SIZE32;
- else
- return;
- break;
- case '+':
- tmpins->flags|=IEF_PLUS_OPCODE;
- case '/':
- if (Lex(cc)==TK_I64 && cc->cur_i64<8)
- tmpins->slash_val=cc->cur_i64;
- else if (cc->token==TK_IDENT) {
- if (!StrCmp(cc->cur_str,"R"))
- tmpins->slash_val=SV_R_REG;
- else if (!StrCmp(cc->cur_str,"I"))
- tmpins->slash_val=SV_I_REG;
- else
- return;
- } else
- return;
- break;
- case '!': tmpins->flags|=IEF_DONT_SWITCH_MODES; break;
- case '&': tmpins->flags|=IEF_DFT; break;
- case '%': tmpins->flags|=IEF_NOT_IN_64_BIT; break;
- case '=': tmpins->flags|=IEF_48_REX; break;
- case '`': tmpins->flags|=IEF_REX_ONLY_R8_R15; break;
- case '^': tmpins->flags|=IEF_REX_XOR_LIKE; break;
- case '*': tmpins->flags|=IEF_STI_LIKE; break;
- case '$': tmpins->flags|=IEF_ENDING_ZERO; break;
- default:
- return;
- }
- Lex(cc);
- }
-}
-
-U0 AsmHashLoad()
-{//See /Compiler/OpCodes.DD.
- I64 i,j,size,size_max;
- CInternalType *tmpit;
- CCmpCtrl *cc;
- CHashGeneric *tmph;
- CHashReg *tmpr;
- CHashOpcode *tmpo,*tmpo2,*tmpo_max;
- CInst *tmpins;
- CHashClass *tmpc;
-
- cmp.size_arg_mask[0]=0x3FF0FFFFFE;
- cmp.size_arg_mask[1]=0x1110111112;
- cmp.size_arg_mask[2]=0x2220222224;
- cmp.size_arg_mask[4]=0x0440444448;
- cmp.size_arg_mask[8]=0x0880888880;
-
- cmp.asm_hash=HashTableNew(1024);
- size_max=offset(CHashOpcode.ins)+sizeof(CInst)<<5;
- tmpo_max=MAlloc(size_max);
-
- cc=CmpCtrlNew(FileRead("OpCodes.DD"),,"OpCodes.DD.Z");
- cc->htc.hash_table_lst=NULL;
- Lex(cc);
- while (cc->token) {
- if (cc->token!=TK_IDENT)
- LexExcept(cc,"Expecting identifier at ");
- i=LstMatch(cc->cur_str,"NONE\0R8\0R16\0R32\0R64\0SEG\0FSTK\0"
- "MM\0XMM\0OPCODE\0KEYWORD\0ASM_KEYWORD\0");
- if (i<=0)
- LexExcept(cc,"Unknown Stmt");
- Lex(cc); //skip keyword
- if (cc->token!=TK_IDENT)
- LexExcept(cc,"Expecting identifier at ");
- switch (i) {
- case REGT_R8...REGT_XMM:
- tmpr=CAlloc(sizeof(CHashReg));
- tmpr->str=cc->cur_str;
- cc->cur_str=NULL;
- Lex(cc); //skip keyword name
- if (cc->token!=TK_I64)
- LexExcept(cc,"Expecting int at ");
- tmpr->type=HTT_REG;
- tmpr->reg_type=i;
- tmpr->reg_num=cc->cur_i64;
- HashAdd(tmpr,cmp.asm_hash);
- Lex(cc); //Skip INT
- break;
- case: //OPCODE
- if (cc->token!=TK_IDENT)
- LexExcept(cc,"Expecting opcode at ");
- MemSet(tmpo_max,0,size_max);
- tmpo_max->type=HTT_OPCODE;
- tmpo_max->inst_entry_cnt=0;
- tmpo_max->str=cc->cur_str;
- cc->cur_str=0;
- Lex(cc); //Skip OPCODE
- while (cc->token && cc->token!=';' && cc->token!=':') {
- tmpins=&tmpo_max->ins[tmpo_max->inst_entry_cnt];
- tmpins->ins_entry_num=tmpo_max->inst_entry_cnt++;
- tmpins->slash_val=SV_NONE; //Not zero!!
- while (cc->token==TK_I64) {
- tmpins->opcode[tmpins->opcode_cnt++]=cc->cur_i64;
- Lex(cc);
- }
- if (cc->token==',')
- Lex(cc);
- else if (cc->token!=';')
- LexExcept(cc,"Expecting ',' at ");
-
- AsmPrsInsFlags(cc,tmpins);
-
- tmpins->uasm_slash_val=tmpins->slash_val;
- if (tmpins->flags&IEF_STI_LIKE && tmpins->slash_val!=SV_I_REG)
- tmpins->uasm_slash_val=SV_STI_LIKE;
-
- tmpins->arg1=tmpins->arg2=tmpins->size1=tmpins->size2=0;
- if (cc->token==TK_IDENT) {
- j=DefineMatch(cc->cur_str,"ST_ARG_TYPES");
- tmpins->arg1=j;
- if (Bt(&cmp.size_arg_mask[1],j))
- tmpins->size1=8;
- else if (Bt(&cmp.size_arg_mask[2],j))
- tmpins->size1=16;
- else if (Bt(&cmp.size_arg_mask[4],j))
- tmpins->size1=32;
- else if (Bt(&cmp.size_arg_mask[8],j))
- tmpins->size1=64;
-
- if (Lex(cc)==TK_IDENT) {
- j=DefineMatch(cc->cur_str,"ST_ARG_TYPES");
- Lex(cc);
- tmpins->arg2=j;
- if (Bt(&cmp.size_arg_mask[1],j))
- tmpins->size2=8;
- else if (Bt(&cmp.size_arg_mask[2],j))
- tmpins->size2=16;
- else if (Bt(&cmp.size_arg_mask[4],j))
- tmpins->size2=32;
- else if (Bt(&cmp.size_arg_mask[8],j))
- tmpins->size2=64;
- }
- }
- }
- size=offset(CHashOpcode.ins)+sizeof(CInst)*tmpo_max->inst_entry_cnt;
- tmpo=MAlloc(size);
- MemCpy(tmpo,tmpo_max,size);
- tmpo->use_cnt=0;
- if (HashFind(tmpo->str,cmp.asm_hash,HTT_OPCODE))
- LexExcept(cc,"Duplicate OPCODE entry ");
- HashAdd(tmpo,cmp.asm_hash);
- //Parse aliases.
- if (cc->token==':') {
- while (Lex(cc)==TK_IDENT) {
- tmpo2=MAllocIdent(tmpo);
- tmpo2->str=cc->cur_str;
- cc->cur_str=0;
- tmpo2->oc_flags|=OCF_ALIAS;
- if (HashFind(tmpo2->str,cmp.asm_hash,HTT_OPCODE))
- LexExcept(cc,"Duplicate OPCODE ALIAS entry ");
- HashAdd(tmpo2,cmp.asm_hash);
- }
- }
- break;
- case: //KEYWORD
- case: //ASM_KEYWORD
- tmph=CAlloc(sizeof(CHashGeneric));
- tmph->str=cc->cur_str;
- cc->cur_str=NULL;
- Lex(cc); //skip keyword name
- if (cc->token!=TK_I64)
- LexExcept(cc,"Expecting int at ");
- tmph->user_data0=cc->cur_i64;
- if (i==10)
- tmph->type=HTT_KEYWORD;
- else
- tmph->type=HTT_ASM_KEYWORD;
- HashAdd(tmph,cmp.asm_hash);
- Lex(cc); //Skip INT
- break;
- }
- if (cc->token!=';')
- LexExcept(cc,"Missing ';' at");
- Lex(cc); //Skip ';'
- }
- Free(tmpo_max);
- CmpCtrlDel(cc);
- for (i=0;i<INTERNAL_TYPES_NUM;i++) {
- tmpit=&internal_types_table[i];
- tmpc=PrsClassNew;
- tmpc->type=HTT_INTERNAL_TYPE;
- tmpc->raw_type=tmpit->type;
- Bts(&tmpc->flags,Cf_INTERNAL_TYPE);
- tmpc->size=tmpit->size;
- tmpc->str=AStrNew(tmpit->name);
- HashAdd(tmpc,cmp.asm_hash);
- cmp.internal_types[tmpc->raw_type]=tmpc;
- }
- adam_task->hash_table->next=cmp.asm_hash;
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/AsmLib.HC.HTML b/public/src/Compiler/AsmLib.HC.HTML deleted file mode 100644 index 7a192b8..0000000 --- a/public/src/Compiler/AsmLib.HC.HTML +++ /dev/null @@ -1,187 +0,0 @@ - - - - - AsmLib.HC - - - - - U0 AOTStoreCodeU8(CCmpCtrl *cc,U8 b)
-{
- CAOTCtrl *aotc=cc->aotc;
- I64 i=aotc->rip>>AOT_BIN_BLK_BITS;
- CAOTBinBlk *tmpbin=aotc->bin;
- while (i--)
- if (!(tmpbin=tmpbin->next)) {
- i=aotc->rip>>AOT_BIN_BLK_BITS+1;
- tmpbin=&aotc->bin;
- while (i--) {
- if (!tmpbin->next)
- tmpbin->next=CAlloc(sizeof(CAOTBinBlk));
- tmpbin=tmpbin->next;
- }
- break;
- }
- tmpbin->body[aotc->rip++ & (AOT_BIN_BLK_SIZE-1)]=b;
- if (aotc->lst) {
- if (aotc->lst_col>=24) {
- '\n';
- aotc->lst_col=0;
- }
- "%02X ",b;
- aotc->lst_col+=3;
- }
- if (aotc->rip>aotc->num_bin_U8s)
- aotc->num_bin_U8s=aotc->rip;
-}
-
-U0 AOTStoreCodeU32(CCmpCtrl *cc,U32 d)
-{
- CAOTCtrl *aotc=cc->aotc;
- I64 i=aotc->rip>>AOT_BIN_BLK_BITS,j=(aotc->rip+sizeof(U32))>>AOT_BIN_BLK_BITS;
- U32 *_d;
- CAOTBinBlk *tmpbin;
- if (i!=j)
- for (i=0;i<sizeof(U32);i++)
- AOTStoreCodeU8(cc,d.u8[i]);
- else {
- tmpbin=aotc->bin;
- while (i--)
- if (!(tmpbin=tmpbin->next)) {
- i=aotc->rip>>AOT_BIN_BLK_BITS+1;
- tmpbin=&aotc->bin;
- while (i--) {
- if (!tmpbin->next)
- tmpbin->next=CAlloc(sizeof(CAOTBinBlk));
- tmpbin=tmpbin->next;
- }
- break;
- }
- _d=tmpbin->body+ aotc->rip&(AOT_BIN_BLK_SIZE-1);
- *_d=d;
- aotc->rip+=sizeof(U32);
- if (aotc->lst) {
- if (aotc->lst_col>=24) {
- '\n';
- aotc->lst_col=0;
- }
- "%08X ",d;
- aotc->lst_col+=9;
- }
- if (aotc->rip>aotc->num_bin_U8s)
- aotc->num_bin_U8s=aotc->rip;
- }
-}
-
-U0 AOTStoreCodeU64(CCmpCtrl *cc,U64 q)
-{
- CAOTCtrl *aotc=cc->aotc;
- I64 i=aotc->rip>>AOT_BIN_BLK_BITS,
- j=(aotc->rip+sizeof(I64))>>AOT_BIN_BLK_BITS, *_q;
- CAOTBinBlk *tmpbin;
- if (i!=j)
- for (i=0;i<sizeof(I64);i++)
- AOTStoreCodeU8(cc,q.u8[i]);
- else {
- tmpbin=aotc->bin;
- while (i--)
- if (!(tmpbin=tmpbin->next)) {
- i=aotc->rip>>AOT_BIN_BLK_BITS+1;
- tmpbin=&aotc->bin;
- while (i--) {
- if (!tmpbin->next)
- tmpbin->next=CAlloc(sizeof(CAOTBinBlk));
- tmpbin=tmpbin->next;
- }
- break;
- }
- _q=tmpbin->body+ aotc->rip&(AOT_BIN_BLK_SIZE-1);
- *_q=q;
- aotc->rip+=sizeof(I64);
- if (aotc->lst) {
- if (aotc->lst_col>=24) {
- '\n';
- aotc->lst_col=0;
- }
- "%016X ",q;
- aotc->lst_col+=17;
- }
- if (aotc->rip>aotc->num_bin_U8s)
- aotc->num_bin_U8s=aotc->rip;
- }
-}
-
-U0 AOTStoreCodeU8At(CCmpCtrl *cc,I64 rip,...)
-{
- CAOTCtrl *aotc=cc->aotc;
- CAOTBinBlk *tmpbin;
- I64 i,j;
- for (j=0;j<argc;j++) {
- i=rip>>AOT_BIN_BLK_BITS+1;
- tmpbin=&aotc->bin;
- while (i--) {
- if (!tmpbin->next) {
- tmpbin->next=CAlloc(sizeof(CAOTBinBlk));
- tmpbin->next->next=NULL;
- }
- tmpbin=tmpbin->next;
- }
- tmpbin->body[rip++ & (AOT_BIN_BLK_SIZE-1)]=argv[j];
- }
- if (rip>aotc->num_bin_U8s)
- aotc->num_bin_U8s=rip;
-}
-
-I64 AsmLexExpression(CCmpCtrl *cc)
-{
- U8 *machine_code;
- I64 res=0;
- cc->asm_undef_hash=NULL;
- cc->flags&=~(CCF_UNRESOLVED+CCF_LOCAL);
- cc->abs_cnts=0;
- if (!IsLexExpression2Bin(cc,&machine_code))
- LexSkipEol(cc);
- else {
- if (cc->abs_cnts.externs)
- LexExcept(cc,"Extern Not Allowed at ");
- if (cc->flags & CCF_UNRESOLVED)
- LexExcept(cc,"Undefined sym at ");
- res=Call(machine_code);
- Free(machine_code);
- }
- return res;
-}
-
-U0 AsmLineLst(CCmpCtrl *cc)
-{
- CAOTCtrl *aotc=cc->aotc;
- CLexFile *tmpf=cc->lex_include_stk;
- CDocEntry *doc_e=tmpf->line_start,*doc_e2;
- if (aotc->lst && aotc->lst_last_lfn==tmpf && doc_e) {
- if (doc_e2=aotc->lst_last_line) {
- if (tmpf->flags& LFSF_DOC) {
- while (doc_e2->y<doc_e->y) {
- "%h*c%08X",24-aotc->lst_col,CH_SPACE,aotc->lst_last_rip;
- aotc->lst_col=0;
- doc_e2=LexPutLine(cc,doc_e2);
- }
- } else {
- while (*doc_e2(U8 *) && doc_e2!=doc_e) {
- "%h*c%08X",24-aotc->lst_col,CH_SPACE,aotc->lst_last_rip;
- aotc->lst_col=0;
- doc_e2=LexPutLine(cc,doc_e2);
- }
- }
- aotc->lst_last_line=doc_e2;
- } else
- aotc->lst_last_line=doc_e;
- } else {
- aotc->lst_last_line=NULL;
- aotc->lst_last_lfn=tmpf;
- }
- aotc->lst_last_rip=aotc->rip;
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/AsmResolve.HC.HTML b/public/src/Compiler/AsmResolve.HC.HTML deleted file mode 100644 index 5f01291..0000000 --- a/public/src/Compiler/AsmResolve.HC.HTML +++ /dev/null @@ -1,229 +0,0 @@ - - - - - AsmResolve.HC - - - - - U0 AsmResolve(CCmpCtrl *cc,CAsmUnresolvedRef *tmpu,U8 *label,Bool undefined)
-{
- CAOTImportExport *tmpie;
- CAsmUndefHash *tmpauh;
- I64 res=Call(tmpu->machine_code);
- if (undefined) {
- tmpauh=tmpu->asm_undef_hash;
- while (tmpauh) {
- if (tmpauh->hash->type & HTF_UNRESOLVED) {
- tmpie=CAlloc(sizeof(CAOTImportExport));
- tmpie->next=tmpauh->hash->ie_lst;
- tmpauh->hash->ie_lst=tmpie;
- tmpie->rip=tmpu->rip;
- tmpie->aot=cc->aot;
- tmpie->type=tmpu->type;
- }
- tmpauh=tmpauh->next; //Technically, more than one won't work.
- }
- } else if (!(tmpu->type&IEF_IMM_NOT_REL)) {
- res-=tmpu->rel_rip;
- if (tmpu->type==IET_REL_I8 && !(I8_MIN<=res<=I8_MAX) ||
- tmpu->type==IET_REL_I16 && !(I16_MIN<=res<=I16_MAX)) {
- PrintErr("Branch out of range at line:%04d %s\n",
- tmpu->line_num,label);
- LexExcept(cc);
- }
- if (tmpu->U8_avail && tmpu->type>IET_IMM_U8 && -124<=res<=123)
- PrintWarn("could use I8 displacement at line:%04d %s %s\n",
- tmpu->line_num,cc->aotc->last_label,label);
- }
- AOTStoreCodeU8At(cc,tmpu->rip,res.u8[0]);
- if (tmpu->type>=IET_REL_I16) {
- AOTStoreCodeU8At(cc,tmpu->rip+1,res.u8[1]);
- if (tmpu->type>=IET_REL_I32) {
- AOTStoreCodeU8At(cc,tmpu->rip+2,res.u8[2],res.u8[3]);
- if (tmpu->type>=IET_REL_I64)
- AOTStoreCodeU8At(cc,tmpu->rip+4,res.u8[4],res.u8[5],
- res.u8[6],res.u8[7]);
- }
- }
-}
-
-U0 AOTLocalsResolve(CCmpCtrl *cc)
-{
- CAOTCtrl *aotc=cc->aotc;
- CAsmUnresolvedRef *tmpu=aotc->local_unresolved,*tmpu1;
- CAsmUndefHash *tmpauh;
- Bool undefined;
- U8 *label=NULL;
-
- while (tmpu) {
- undefined=FALSE;
- tmpu1=tmpu->next;
- tmpauh=tmpu->asm_undef_hash;
- while (tmpauh) {
- if (tmpauh->hash->type & HTF_UNRESOLVED) {
- PrintErr("Undefined sym at line:%04d %s %s\n",
- tmpu->line_num,aotc->last_label,tmpauh->hash->str);
- LexExcept(cc);
- }
- label=tmpauh->hash->str;
- tmpauh=tmpauh->next;
- }
- if (!undefined)
- AsmResolve(cc,tmpu,label,FALSE);
- Free(tmpu->machine_code);
- LinkedLstDel(tmpu->asm_undef_hash);
- Free(tmpu);
- tmpu=tmpu1;
- }
- HashTableDel(cc->htc.local_hash_table);
- cc->htc.hash_table_lst=cc->htc.local_hash_table=HashTableNew(16);
- cc->htc.local_hash_table->next=cc->htc.glbl_hash_table;
- aotc->local_unresolved=NULL;
-}
-
-U0 AOTGlblsResolve(CCmpCtrl *cc,CAOT *tmpaot)
-{
- CAOTCtrl *aotc=cc->aotc;
- CHashFun *tmpf;
- CAsmUnresolvedRef *tmpu=aotc->glbl_unresolved,*tmpu1;
- I64 i,j;
- CAOTImportExport *tmpie,*tmpie1;
- CAsmUndefHash *tmpauh;
- CHashExport *tmpex;
- U8 *label;
- Bool undefined;
- CExternUsage *tmpeu,*tmpeu8;
-
- while (tmpu) {
- label=NULL;
- undefined=FALSE;
- tmpu1=tmpu->next;
- tmpauh=tmpu->asm_undef_hash;
- while (tmpauh) {
- if (tmpauh->hash->type & HTF_UNRESOLVED) {
- tmpex=tmpauh->hash;
- if (tmpex->type & HTT_EXPORT_SYS_SYM&& tmpex->type & HTF_UNRESOLVED &&
- !(tmpex->type & HTF_IMPORT) &&
- (tmpf=HashFind(tmpex->str,cc->htc.hash_table_lst,HTT_FUN)) &&
- !Bt(&tmpf->flags,Cf_EXTERN)) {
- tmpex->val=tmpf->exe_addr;
- tmpex->type&=~HTF_UNRESOLVED;
- label=tmpauh->hash->str;
- } else {
- if (!(tmpex->type & HTF_IMPORT)) {
- if (cc->htc.local_var_lst) {
- tmpex->type|=HTF_GOTO_LABEL;
- tmpex->use_cnt++;
- } else {
- PrintErr("Undefined sym at line:%04d %s\n",
- tmpu->line_num,tmpex->str);
- LexExcept(cc);
- }
- } else if (undefined) {
- PrintErr("Two imports in same expression "
- "not allowed at line:%04d %s\n",
- tmpu->line_num,tmpex->str);
- LexExcept(cc);
- }
- undefined=TRUE;
- }
- } else
- label=tmpauh->hash->str;
- tmpauh=tmpauh->next;
- }
- AsmResolve(cc,tmpu,label,undefined);
- Free(tmpu->machine_code);
- LinkedLstDel(tmpu->asm_undef_hash);
- Free(tmpu);
- tmpu=tmpu1;
- }
-
- for (i=0;i<=cc->htc.glbl_hash_table->mask;i++) {
- tmpex=cc->htc.glbl_hash_table->body[i];
- while (tmpex) {
- if (tmpex->type & (HTF_IMPORT|HTF_GOTO_LABEL)) {
- if (tmpex->use_cnt && (tmpie=tmpex->ie_lst)) {
- if (tmpex->type&HTF_GOTO_LABEL)
- tmpie->flags|=IEF_GOTO_LABEL;
- if (tmpex->import_name)
- tmpie->str=StrNew(tmpex->import_name);
- else
- tmpie->str=StrNew(tmpex->str);
- do {
- tmpie1=tmpie->next;
- QueIns(tmpie,tmpaot->last_ie);
- } while (tmpie=tmpie1);
- tmpex->ie_lst=NULL;
- }
- } else if (tmpex->type & (HTF_EXPORT|HTF_RESOLVE)) {
- if (tmpex->type & HTF_UNRESOLVED) {
- PrintErr("Undefined sym at %s\n",tmpex->str);
- LexExcept(cc);
- }
- if (tmpex->type & HTF_RESOLVE) {
- tmpf=tmpex;
- tmpeu=tmpf->ext_lst;
- while (tmpeu) {
- tmpeu8=tmpeu->next;
- j=tmpf->exe_addr-(tmpeu->rip+4);
- AOTStoreCodeU8At(cc,tmpeu->rip,j.u8[0],j.u8[1],j.u8[2],j.u8[3]);
- Free(tmpeu);
- tmpeu=tmpeu8;
- }
- }
- if (tmpex->type & HTF_EXPORT) {
- tmpie=CAlloc(sizeof(CAOTImportExport));
- tmpie->type=IET_REL32_EXPORT;
- if (tmpex->type & HTT_FUN)
- tmpie->rip=tmpf->exe_addr;
- else if (tmpex->type & HTT_GLBL_VAR)
- tmpie->rip=tmpex(CHashGlblVar *)->data_addr_rip;
- else
- tmpie->rip=tmpex->val;
- tmpie->aot=cc->aot;
- if (tmpex->type & HTF_IMM)
- tmpie->type++;
- tmpie->str=StrNew(tmpex->str);
- tmpie->src_link=StrNew(tmpex->src_link);
- QueIns(tmpie,tmpaot->last_ie);
- }
- }
- tmpex=tmpex->next;
- }
- }
-}
-
-U0 AsmUnresolvedAdd(CCmpCtrl *cc,U8 *machine_code,I64 type,I64 rip,I64 rel_rip,
- CAsmUndefHash *local_asm_undef_hash,CAsmUndefHash *glbl_asm_undef_hash,
- I64 line_num,Bool U8_avail)
-{
- CAsmUnresolvedRef *tmpu=MAlloc(sizeof(CAsmUnresolvedRef));
- tmpu->machine_code=machine_code;
- tmpu->type=type;
- tmpu->rip=rip;
- tmpu->rel_rip=rel_rip;
- tmpu->aot=cc->aot;
- tmpu->imm_flag=FALSE;
- tmpu->line_num=line_num;
- tmpu->U8_avail=U8_avail;
- tmpu->str=NULL;
- if (local_asm_undef_hash) {
- tmpu->asm_undef_hash=local_asm_undef_hash;
- tmpu->next=cc->aotc->local_unresolved;
- cc->aotc->local_unresolved=tmpu;
- } else {
- tmpu->asm_undef_hash=glbl_asm_undef_hash;
- tmpu->next=cc->aotc->glbl_unresolved;
- cc->aotc->glbl_unresolved=tmpu;
- if (glbl_asm_undef_hash->hash->type & HTF_IMPORT) {
- tmpu->str=StrNew(glbl_asm_undef_hash->hash->str);
- if (glbl_asm_undef_hash->hash->type & HTF_IMM)
- tmpu->imm_flag=TRUE;
- }
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/BackA.HC.HTML b/public/src/Compiler/BackA.HC.HTML deleted file mode 100644 index 4110d9c..0000000 --- a/public/src/Compiler/BackA.HC.HTML +++ /dev/null @@ -1,670 +0,0 @@ - - - - - BackA.HC - - - - - U0 ICAddEct(CIntermediateCode *tmpi,CICType t1,I64 r1,I64 d1,
- CICType t2,I64 r2,I64 d2,CICType t3,I64 r3,I64 d3,I64 op,I64 rip)
-{
- I64 i,tmp,res_reg=REG_RAX;
- Bool swap=FALSE;
- if (r3!=res_reg) {
- swap^=TRUE;
- SwapI64(&t2,&t3);
- SwapI64(&r2,&r3);
- SwapI64(&d2,&d3);
- }
- if (t2.raw_type>=RT_I64 && r2!=res_reg && t2&MDG_REG_DISP_SIB_RIP) {
- if (t1&MDF_REG && !(r2==r1 && t2&MDG_REG_DISP_SIB))
- res_reg=r1;
- ICMov(tmpi,MDF_REG+RT_I64,res_reg,0,t3,r3,d3,rip);
- i=ICModr1(res_reg,t2,r2,d2);
- if (tmpi->ic_flags&ICF_LOCK)
- ICU8(tmpi,OC_LOCK_PREFIX);
- ICRex(tmpi,i.u8[1]);
- ICU16(tmpi,i.u8[2]<<8+op);
- ICModr2(tmpi,i,,d2,rip);
- } else {
- if (t2&MDF_REG)
- tmp=r2;
- else
- tmp=REG_RCX;
-
- if (t1&MDF_REG)
- res_reg=r1;
-
- if (tmp==res_reg)
- res_reg=REG_RDX;
- if (swap) {
- if (r3==tmp && t3&MDG_REG_DISP_SIB)
- tmp=REG_RCX;
- ICMov(tmpi,MDF_REG+RT_I64,tmp,0,t2,r2,d2,rip);
- ICMov(tmpi,MDF_REG+RT_I64,res_reg,0,t3,r3,d3,rip);
- } else {
- if (r2==res_reg && t2&MDG_REG_DISP_SIB)
- res_reg=REG_RDX;
- ICMov(tmpi,MDF_REG+RT_I64,res_reg,0,t3,r3,d3,rip);
- ICMov(tmpi,MDF_REG+RT_I64,tmp,0,t2,r2,d2,rip);
- }
- i=0x48;
- if (res_reg>7)
- i+=4;
- if (tmp>7)
- i++;
- if (tmpi->ic_flags&ICF_LOCK)
- ICU8(tmpi,OC_LOCK_PREFIX);
- ICU24(tmpi,0xC00000+i+(tmp&7)<<16+(res_reg&7)<<19+op<<8);
- }
- ICMov(tmpi,t1,r1,d1,MDF_REG+RT_I64,res_reg,0,rip);
-}
-
-U0 ICAddSubEctImm(CIntermediateCode *tmpi,CICType t1,I64 r1,I64 d1,
- CICType t2,I64 r2,I64 d2,I64 d,I64 op,I64 rip)
-{
- I64 i;
- if (op.u8[0]==0x2B) {
- op=0x0003;
- d=-d;
- }
- if (t1&MDF_REG) {
- if (!(t2&MDF_REG)) {
- ICMov(tmpi,t1,r1,d1,t2,r2,d2,rip);
- t2=t1;
- r2=r1;
- d2=d1;
- }
- if (r1==r2) {
- if (r1>7)
- i=0x49;
- else
- i=0x48;
- if (!d &&
- (op.u8[0]==0x03||op.u8[0]==0x2B||op.u8[0]==0x33||op.u8[0]==0x0B))
- return;
- else if (d==1 && op.u8[0]==0x03) {
- ICU24(tmpi,0xC0FF00+op.u8[1]<<19+i+(r1&7)<<16);
- return;
- } else if (d==-1 && op.u8[0]==0x03) {
- ICU24(tmpi,0xC8FF00+i+(r1&7)<<16);
- return;
- } else if (I8_MIN<=d<=I8_MAX) {
- ICU24(tmpi,0xC08300+op.u8[1]<<19+i+(r1&7)<<16);
- ICU8(tmpi,d);
- return;
- } else if (I32_MIN<=d<=I32_MAX) {
- ICU24(tmpi,0xC08100+op.u8[1]<<19+i+(r1&7)<<16);
- ICU32(tmpi,d);
- return;
- }
- }
- if (op.u8[0]==0x03 && I32_MIN<=d<=I32_MAX &&
- !Bt(&cmp.non_ptr_vars_mask,r2)) {
- i=ICModr1(r1,MDF_DISP+RT_I64,r2,d);
- i.u8[1]|=0x48;
- ICU24(tmpi,i.u8[2]<<16+0x8D00+i.u8[1]);
- ICModr2(tmpi,i,,d,rip);
- return;
- }
- }
- switch (Bsr(t1)) {
- case MDf_REG:
- case MDf_DISP:
- case MDf_SIB:
- case MDf_RIP_DISP32:
- if (t1!=t2 || r1!=r2 || d1!=d2) {
- ICMov(tmpi,t1,r1,d1,t2,r2,d2,rip);
- t2=t1;
- r2=r1;
- d2=d1;
- }
-
- if (!d &&(op.u8[0]==0x03||op.u8[0]==0x2B||op.u8[0]==0x33||op.u8[0]==0x0B))
- return;
-
- if (op.u8[0]==0x03 && d==-1) //add -1
- op.u8[1]=1; //Decrement slash val
-
- if (op.u8[0]==0x03 && (d==1 || d==-1)) { //Add
- i=ICModr1(op.u8[1],t1,r1,d1);
- if (!(t1&MDF_REG) && tmpi->ic_flags&ICF_LOCK)
- ICU8(tmpi,OC_LOCK_PREFIX);
- switch (t1.raw_type) {
- case RT_I8:
- case RT_U8:
- ICRex(tmpi,i.u8[1]);
- ICU16(tmpi,i.u8[2]<<8+0xFE);
- break;
- case RT_I16:
- case RT_U16:
- ICOpSizeRex(tmpi,i.u8[1]);
- ICU16(tmpi,i.u8[2]<<8+0xFF);
- break;
- default:
- ICRex(tmpi,i.u8[1]);
- ICU16(tmpi,i.u8[2]<<8+0xFF);
- }
- ICModr2(tmpi,i,,d1,rip);
- return;
- }
- if (I8_MIN<=d<=I8_MAX || t1&(RTG_MASK-RTF_UNSIGNED)==RT_I8) {
- ICSlashOp(tmpi,t1,r1,d1,SLASH_OP_IMM_U8+op.u8[1],rip+1);
- ICU8(tmpi,d);
- return;
- }
- if (I32_MIN<=d<=I32_MAX || t1.raw_type<RT_I64) {
- ICSlashOp(tmpi,t1,r1,d1,SLASH_OP_IMM_U32+op.u8[1],rip);
- if (t1&(RTG_MASK-RTF_UNSIGNED)==RT_I16)
- ICU16(tmpi,d);
- else
- ICU32(tmpi,d);
- return;
- }
- break;
- case MDf_STK:
- ICAddSubEctImm(tmpi,MDF_REG+RT_I64,REG_RAX,0,t2,r2,d2,d,op,rip);
- ICPushRegs(tmpi,1<<REG_RAX);
- return;
- }
- ICAddEct(tmpi,t1,r1,d1,MDF_IMM+RT_I64,0,d,t2,r2,d2,op.u8[0],rip);
-}
-
-U0 ICSub(CIntermediateCode *tmpi,CICType t1,I64 r1,I64 d1,
- CICType t2,I64 r2,I64 d2,CICType t3,I64 r3,I64 d3,I64 rip)
-{
- I64 i=0x48,op=0x2B;
- Bool swap=FALSE;
- if (r3!=REG_RAX) {
- swap=TRUE;
- SwapI64(&t2,&t3);
- SwapI64(&r2,&r3);
- SwapI64(&d2,&d3);
- }
- if (t2.raw_type>=RT_I64 && r2.u8[0]!=REG_RAX &&
- (!(t2&MDF_SIB) || r2.u8[1]&15!=REG_RAX) && t2&MDG_REG_DISP_SIB_RIP) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,t3,r3,d3,rip);
- if (!swap) {
- op=0x03;
- ICU24(tmpi,0xD8F748);
- }
- i=ICModr1(REG_RAX,t2,r2,d2);
- if (tmpi->ic_flags&ICF_LOCK)
- ICU8(tmpi,OC_LOCK_PREFIX);
- ICRex(tmpi,i.u8[1]);
- ICU16(tmpi,i.u8[2]<<8+op);
- ICModr2(tmpi,i,,d2,rip);
- ICMov(tmpi,t1,r1,d1,MDF_REG+RT_I64,REG_RAX,0,rip);
- } else {
- if (!(t3&MDF_REG) || t3.raw_type<RT_I64) {
- if (swap) {
- swap=FALSE;
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,t3,r3,d3,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,t2,r2,d2,rip);
- r2=REG_RAX;
- r3=REG_RCX;
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,t3,r3,d3,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,t2,r2,d2,rip);
- r3=REG_RAX;
- r2=REG_RCX;
- }
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,t2,r2,d2,rip);
- r2=REG_RCX;
- }
- if (swap) {
- op=0x03;
- ICU24(tmpi,0xD9F748);
- }
- if (r3>7)
- i++;
- if (r2>7)
- i+=4;
- if (tmpi->ic_flags&ICF_LOCK)
- ICU8(tmpi,OC_LOCK_PREFIX);
- ICU24(tmpi,0xC00000+i+(r3&7)<<16+(r2&7)<<19+op<<8);
- ICMov(tmpi,t1,r1,d1,MDF_REG+RT_I64,r2,0,rip);
- }
-}
-
-U0 ICMul(CIntermediateCode *tmpi,I64 rip)
-{
- I64 i,r2,r=REG_RAX,j;
- CICArg *arg1,*arg2;
- Bool alt;
- if (tmpi->arg1.type&MDF_IMM) {
- arg1=&tmpi->arg2;
- arg2=&tmpi->arg1;
- alt=TRUE;
- } else {
- arg1=&tmpi->arg1;
- arg2=&tmpi->arg2;
- alt=FALSE;
- }
- i=arg2->disp;
- if (!(tmpi->ic_class->raw_type&RTF_UNSIGNED) &&
- arg2->type&MDF_IMM && I32_MIN<=i<=I32_MAX) {
- if (tmpi->res.type==MDF_REG+RT_I64) {
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- arg1->type,arg1->reg,arg1->disp,rip);
- r=tmpi->res.reg;
- } else
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,arg1->type,arg1->reg,arg1->disp,rip);
- if (r>7)
- j=0xC0004D;
- else
- j=0xC00048;
- if (I8_MIN<=i<=I8_MAX)
- ICU32(tmpi,i<<24+0x6B00+j+(r&7)<<16+(r&7)<<19);
- else {
- ICU24(tmpi,0x6900+j+(r&7)<<16+(r&7)<<19);
- ICU32(tmpi,i);
- }
- } else {
- if (tmpi->ic_class->raw_type&RTF_UNSIGNED)
- i=0xE0F748;
- else
- i=0xE8F748;
- if (alt) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,arg1->type,arg1->reg,arg1->disp,rip);
- r2=REG_RCX;
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,arg2->type,arg2->reg,arg2->disp,rip);
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,arg2->type,arg2->reg,arg2->disp,rip);
- if (!(arg1->type&MDF_REG) || arg1->type.raw_type<RT_I64) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,
- arg1->type,arg1->reg,arg1->disp,rip);
- r2=REG_RCX;
- } else
- r2=arg1->reg;
- }
- if (r2>7) {
- i++;
- r2&=7;
- }
- ICU24(tmpi,i+r2<<16);
- }
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,r,0,rip);
-}
-
-U0 ICMulEqu(CIntermediateCode *tmpi,I64 rip)
-{
- I64 i=tmpi->arg2.disp,r=REG_RAX,j;
- if (!(tmpi->ic_class->raw_type&RTF_UNSIGNED) &&
- tmpi->arg2.type&MDF_IMM && I32_MIN<=i<=I32_MAX) {
- if (tmpi->ic_flags & ICF_BY_VAL) {
- if (tmpi->arg1.type==MDF_REG+RT_I64)
- r=tmpi->arg1.reg;
- else
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
- tmpi->arg1.reg,tmpi->arg1.disp,rip);
- if (r>7)
- j=0xC0004D;
- else
- j=0xC00048;
- if (I8_MIN<=i<=I8_MAX)
- ICU32(tmpi,i<<24+0x6B00+j+(r&7)<<16+(r&7)<<19);
- else {
- ICU24(tmpi,0x6900+j+(r&7)<<16+(r&7)<<19);
- ICU32(tmpi,i);
- }
- ICMov(tmpi,tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
- tmpi->arg1.reg,tmpi->arg1.disp,MDF_REG+RT_I64,r,0,rip);
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RBX,0,
- MDF_DISP+tmpi->arg1_type_pointed_to,REG_RCX,0,rip);
- r=REG_RBX;
- if (I8_MIN<=i<=I8_MAX)
- ICU32(tmpi,i<<24+0xDB6B48);
- else {
- ICU24(tmpi,0xDB6948);
- ICU32(tmpi,i);
- }
- ICMov(tmpi,MDF_DISP+tmpi->arg1_type_pointed_to,REG_RCX,0,
- MDF_REG+RT_I64,REG_RBX,0,rip);
- }
- } else {
- if (tmpi->ic_class->raw_type&RTF_UNSIGNED)
- i=0xE3F748;
- else
- i=0xEBF748;
- if (tmpi->ic_flags & ICF_BY_VAL) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RBX,0,
- tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
- tmpi->arg1.reg,tmpi->arg1.disp,rip);
- ICU24(tmpi,i);
- ICMov(tmpi,tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
- tmpi->arg1.reg,tmpi->arg1.disp,MDF_REG+RT_I64,REG_RAX,0,rip);
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RBX,0,
- MDF_DISP+tmpi->arg1_type_pointed_to,REG_RCX,0,rip);
- ICU24(tmpi,i);
- ICMov(tmpi,MDF_DISP+tmpi->arg1_type_pointed_to,REG_RCX,0,
- MDF_REG+RT_I64,REG_RAX,0,rip);
- }
- }
- if (tmpi->res.type.mode)
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,r,0,rip);
-}
-
-U0 ICDiv(CIntermediateCode *tmpi,I64 rip)
-{
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- if (tmpi->ic_class->raw_type&RTF_UNSIGNED) {
- ICZero(tmpi,REG_RDX);
- ICU24(tmpi,0xF1F748);
- } else {
- ICU16(tmpi,0x9948);
- ICU24(tmpi,0xF9F748);
- }
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip);
-}
-
-U0 ICDivEqu(CIntermediateCode *tmpi,Bool is_mod,I64 rip)
-{
- if (tmpi->ic_flags & ICF_BY_VAL) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
- tmpi->arg1.reg,tmpi->arg1.disp,rip);
- if (tmpi->ic_class->raw_type&RTF_UNSIGNED) {
- ICZero(tmpi,REG_RDX);
- ICU24(tmpi,0xF1F748);
- } else {
- ICU16(tmpi,0x9948);
- ICU24(tmpi,0xF9F748);
- }
- if (is_mod)
- ICMov(tmpi,tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
- tmpi->arg1.reg,tmpi->arg1.disp,MDF_REG+RT_I64,REG_RDX,0,rip);
- else
- ICMov(tmpi,tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
- tmpi->arg1.reg,tmpi->arg1.disp,MDF_REG+RT_I64,REG_RAX,0,rip);
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RBX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
-//dangerous might clobber RBX in Mov, but it doesn't
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,MDF_DISP+tmpi->arg1_type_pointed_to,
- REG_RBX,0,rip);
- if (tmpi->ic_class->raw_type&RTF_UNSIGNED) {
- ICZero(tmpi,REG_RDX);
- ICU24(tmpi,0xF1F748);
- } else {
- ICU16(tmpi,0x9948);
- ICU24(tmpi,0xF9F748);
- }
- if (is_mod)
- ICMov(tmpi,MDF_DISP+tmpi->arg1_type_pointed_to,REG_RBX,0,
- MDF_REG+RT_I64,REG_RDX,0,rip);
- else
- ICMov(tmpi,MDF_DISP+tmpi->arg1_type_pointed_to,REG_RBX,0,
- MDF_REG+RT_I64,REG_RAX,0,rip);
- }
- if (tmpi->res.type.mode) {
- if (is_mod)
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RDX,0,rip);
- else
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip);
- }
-}
-
-U0 ICMod(CIntermediateCode *tmpi,I64 rip)
-{
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- if (tmpi->ic_class->raw_type&RTF_UNSIGNED) {
- ICZero(tmpi,REG_RDX);
- ICU24(tmpi,0xF1F748);
- } else {
- ICU16(tmpi,0x9948);
- ICU24(tmpi,0xF9F748);
- }
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RDX,0,rip);
-}
-
-U0 ICAddSubEctEqu(CIntermediateCode *tmpi,U8 type_pointed_to,
- CICType t1,I64 r1,I64 d1,CICType t2,I64 r2,I64 d2,
- CICType t3,I64 r3,I64 d3,I64 op,I64 rip)
-{
- Bool done;
- I64 res_reg,tmp,i;
- if (tmpi->ic_flags & ICF_BY_VAL) {
- if (t3&MDF_IMM) {
- ICAddSubEctImm(tmpi,t2&MDG_MASK+type_pointed_to,r2,d2,t2&MDG_MASK+
- type_pointed_to,r2,d2,d3,op,rip);
- if (t1.mode)
- ICMov(tmpi,t1,r1,d1,t2&MDG_MASK+type_pointed_to,r2,d2,rip);
- return;
- } else {
- done=FALSE;
- if (type_pointed_to>=RT_I64) {
- if (!t1.mode && t2&MDG_REG_DISP_SIB_RIP) {
- if (t3&MDF_REG)
- tmp=r3;
- else {
- tmp=REG_RCX;
- ICMov(tmpi,MDF_REG+RT_I64,tmp,0,t3,r3,d3,rip);
- }
- i=ICModr1(tmp,t2&MDG_MASK+type_pointed_to,r2,d2);
- if (tmpi->ic_flags&ICF_LOCK)
- ICU8(tmpi,OC_LOCK_PREFIX);
- ICRex(tmpi,i.u8[1]);
- ICU16(tmpi,i.u8[2]<<8+op.u8[5]);
- ICModr2(tmpi,i,,d2,rip);
- return;
- }
- if (t3.raw_type>=RT_I64 && t3&MDG_REG_DISP_SIB_RIP) {
- if (t2&MDF_REG)
- res_reg=r2;
- else {
- res_reg=REG_RCX;
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,t2,r2,d2,rip);
- }
- i=ICModr1(res_reg,t3&MDG_MASK+type_pointed_to,r3,d3);
- if (tmpi->ic_flags&ICF_LOCK)
- ICU8(tmpi,OC_LOCK_PREFIX);
- ICRex(tmpi,i.u8[1]);
- ICU16(tmpi,i.u8[2]<<8+op.u8[0]);
- ICModr2(tmpi,i,,d3,rip);
- ICMov(tmpi,t2&MDG_MASK+type_pointed_to,r2,d2,
- MDF_REG+RT_I64,res_reg,0,rip);
- done=TRUE;
- }
- }
- if (!done) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,t3,r3,d3,rip);
- if (t2&MDF_REG && r2!=REG_RAX)
- res_reg=r2;
- else {
- res_reg=REG_RCX;
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,
- t2&MDG_MASK+type_pointed_to,r2,d2,rip);
- }
- if (tmpi->ic_flags&ICF_LOCK)
- ICU8(tmpi,OC_LOCK_PREFIX);
- if (res_reg>7)
- ICU8(tmpi,0x4C);
- else
- ICU8(tmpi,0x48);
- ICU16(tmpi,0xC000+op.u8[0]+(res_reg&7)<<11);
- ICMov(tmpi,t2&MDG_MASK+type_pointed_to,r2,d2,
- MDF_REG+RT_I64,res_reg,0,rip);
- }
- }
- } else {
- done=FALSE;
- if (t3&MDF_IMM && op.u8[2]) {
- if (!d3.u32[1]) {
- if (tmpi->ic_flags&ICF_RES_NOT_USED &&
- t2&MDF_REG && d3(U64)<=I8_MAX) {
- ICSlashOp(tmpi,MDF_DISP+type_pointed_to,r2,0,0x838000+op.u8[4],rip);
- ICU8(tmpi,d3);
- done=TRUE;
- } else if (op.u8[2]==0x24) {//AND
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,t2,r2,d2,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- MDF_DISP+type_pointed_to,REG_RCX,0,rip);
- res_reg=REG_RAX;
- if (tmpi->ic_flags&ICF_LOCK)
- ICU8(tmpi,OC_LOCK_PREFIX);
- ICU16(tmpi,op.u8[3]<<8+0x40);
- ICU32(tmpi,d3);
- ICMov(tmpi,MDF_DISP+type_pointed_to,REG_RCX,0,
- MDF_REG+RT_I64,res_reg,0,rip);
- done=TRUE;
- } else if (type_pointed_to<RT_I64) {//OR/XOR
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,t2,r2,d2,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- MDF_DISP+type_pointed_to,REG_RCX,0,rip);
- res_reg=REG_RAX;
- if (tmpi->ic_flags&ICF_LOCK)
- ICU8(tmpi,OC_LOCK_PREFIX);
- if (d3.u16[1]) {
- ICU16(tmpi,op.u8[3]<<8+0x40);
- ICU32(tmpi,d3);
- } else if (d3.u8[1]) {
- ICU24(tmpi,op.u8[3]<<16+0x4000+OC_OP_SIZE_PREFIX);
- ICU16(tmpi,d3);
- } else {
- ICU16(tmpi,op.u8[2]<<8+0x40);
- ICU8(tmpi,d3);
- }
- ICMov(tmpi,MDF_DISP+type_pointed_to,REG_RCX,0,
- MDF_REG+RT_I64,res_reg,0,rip);
- done=TRUE;
- }
- }
- }
- if (!done) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,t3,r3,d3,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,t2,r2,d2,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RBX,0,
- MDF_DISP+type_pointed_to,REG_RCX,0,rip);
- res_reg=REG_RBX;
- if (tmpi->ic_flags&ICF_LOCK)
- ICU8(tmpi,OC_LOCK_PREFIX);
- ICU8(tmpi,0x48);
- ICU16(tmpi,0xC000+op.u8[0]+(res_reg&7)<<11);
- ICMov(tmpi,MDF_DISP+type_pointed_to,REG_RCX,0,
- MDF_REG+RT_I64,res_reg,0,rip);
- }
- }
- if (t1.mode)
- ICMov(tmpi,t1,r1,d1,MDF_REG+RT_I64,res_reg,0,rip);
-}
-
-U0 ICShift(CIntermediateCode *tmpi,CICType t1,I64 r1,I64 d1,
- CICType t2,I64 r2,I64 d2,CICType t3,I64 r3,I64 d3,
- I64 us,I64 is,I64 rip)
-{
- I64 i=0x48,res_reg;
- if (tmpi->ic_class->raw_type&RTF_UNSIGNED ||
- tmpi->ic_flags & ICF_USE_UNSIGNED)
- is=us;
- if (t1&MDF_REG) {
- res_reg=r1;
- if (res_reg>7)
- i++;
- } else
- res_reg=REG_RAX;
- if (t3&MDF_IMM) {
- ICMov(tmpi,MDF_REG+RT_I64,res_reg,0,t2,r2,d2,rip);
- if (d3==1)
- ICU24(tmpi,i+is.u16[2]<<8+(res_reg&7)<<16);
- else {
- ICU24(tmpi,i+is.u16[0]<<8+(res_reg&7)<<16);
- ICU8(tmpi,d3);
- }
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,t3,r3,d3,rip);
- ICMov(tmpi,MDF_REG+RT_I64,res_reg,0,t2,r2,d2,rip);
- ICU24(tmpi,i+is.u16[1]<<8+(res_reg&7)<<16);
- }
- ICMov(tmpi,t1,r1,d1,MDF_REG+RT_I64,res_reg,0,rip);
-}
-
-U0 ICShiftEqu(CIntermediateCode *tmpi,U8 type_pointed_to,
- CICType t1,I64 r1,I64 d1,
- CICType t2,I64 r2,I64 d2,
- CICType t3,I64 r3,I64 d3,I64 us,I64 is,I64 rip)
-{
- I64 res_reg;
- if (tmpi->ic_class->raw_type&RTF_UNSIGNED ||
- tmpi->ic_flags & ICF_USE_UNSIGNED)
- is=us;
- if (tmpi->ic_flags & ICF_BY_VAL) {
- if (!(t3&MDF_IMM))
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,t3,r3,d3,rip);
- if (t2&MDF_REG)
- res_reg=r2;
- else {
- res_reg=REG_RAX;
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- t2&MDG_MASK+type_pointed_to,r2,d2,rip);
- }
- if (res_reg>7)
- ICU8(tmpi,0x49);
- else
- ICU8(tmpi,0x48);
- if (t3&MDF_IMM) {
- if (d3==1)
- ICU16(tmpi,is.u16[2]+(res_reg&7)<<8);
- else {
- ICU16(tmpi,is.u16[0]+(res_reg&7)<<8);
- ICU8(tmpi,d3);
- }
- } else
- ICU16(tmpi,is.u16[1]+(res_reg&7)<<8);
- ICMov(tmpi,t2&MDG_MASK+type_pointed_to,r2,d2,
- MDF_REG+RT_I64,res_reg,0,rip);
- } else {
- if (!(t3&MDF_IMM))
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,t3,r3,d3,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,t2,r2,d2,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,MDF_DISP+type_pointed_to,REG_RDX,0,rip);
- res_reg=REG_RAX;
- ICU8(tmpi,0x48);
- if (t3&MDF_IMM) {
- if (d3==1)
- ICU16(tmpi,is.u16[2]+(res_reg&7)<<8);
- else {
- ICU16(tmpi,is.u16[0]+(res_reg&7)<<8);
- ICU8(tmpi,d3);
- }
- } else
- ICU16(tmpi,is.u16[1]+(res_reg&7)<<8);
- ICMov(tmpi,
- MDF_DISP+type_pointed_to,REG_RDX,0,MDF_REG+RT_I64,res_reg,0,rip);
- }
- if (t1.mode)
- ICMov(tmpi,t1,r1,d1,MDF_REG+RT_I64,res_reg,0,rip);
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/BackB.HC.HTML b/public/src/Compiler/BackB.HC.HTML deleted file mode 100644 index 81ab174..0000000 --- a/public/src/Compiler/BackB.HC.HTML +++ /dev/null @@ -1,731 +0,0 @@ - - - - - BackB.HC - - - - - U0 ICUnaries(CIntermediateCode *tmpi,I64 op,I64 rip)
-{
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- ICSlashOp(tmpi,MDF_REG+RT_I64,REG_RAX,0,op,rip);
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip);
-}
-
-U0 ICNot(CIntermediateCode *tmpi,I64 rip)
-{
- I64 i;
- if (tmpi->arg1.type.raw_type<=RT_U8 && tmpi->arg1.type&MDG_DISP_SIB_RIP) {
- i=ICModr1(tmpi,tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp);
- ICRex(tmpi,i.u8[1]);
- ICU16(tmpi,i.u8[2]<<8+0xF6); //TEST ?,0xFF
- ICModr2(tmpi,i,,tmpi->arg1.disp,rip+1);
- ICU8(tmpi,0xFF);
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- ICTest(tmpi,REG_RAX);
- }
- ICU24(tmpi,0xC0940F); //SETZ AL
- ICU32(tmpi,0xC0B60F48); //MOVZX RAX,AL
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_U64,REG_RAX,0,rip);
-}
-
-U0 ICAndAnd(CIntermediateCode *tmpi,I64 rip)
-{
- I64 r2;
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- if (!(tmpi->arg1.type&MDF_REG) || tmpi->arg1.reg==REG_RAX) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- r2=REG_RDX;
- } else
- r2=tmpi->arg1.reg;
- ICZero(tmpi,REG_RAX);
- ICTest(tmpi,r2);
- ICU16(tmpi,0x0874);
- ICTest(tmpi,REG_RCX);
- ICU16(tmpi,0x0374);
- ICU24(tmpi,0xC0FF48);
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip);
-}
-
-U0 ICOrOr(CIntermediateCode *tmpi,I64 rip)
-{
- I64 i=0x48,r2;
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- if (!(tmpi->arg1.type&MDF_REG) || tmpi->arg1.reg==REG_RAX) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- r2=REG_RDX;
- } else
- r2=tmpi->arg1.reg;
-
- if (r2>7) {
- i++;
- r2&=7;
- }
- ICZero(tmpi,REG_RAX);
- ICU24(tmpi,0xC80B00+i+r2<<16);
- ICU16(tmpi,0x0374);
- ICU24(tmpi,0xC0FF48);
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip);
-}
-
-U0 ICXorXor(CIntermediateCode *tmpi,I64 rip)
-{
- I64 r2;
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- if (!(tmpi->arg1.type&MDF_REG)) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- r2=REG_RDX;
- } else
- r2=tmpi->arg1.reg;
- ICZero(tmpi,REG_RBX);
- ICTest(tmpi,r2);
- ICU16(tmpi,0x0374);
- ICU24(tmpi,0xC3FF48);
-
- ICZero(tmpi,REG_RAX);
- ICTest(tmpi,REG_RCX);
- ICU16(tmpi,0x0374);
- ICU24(tmpi,0xC0FF48);
-
- ICU24(tmpi,0xC33348);
-
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip);
-}
-
-U0 ICCmp(CIntermediateCode *tmpi,I64 us,I64 is,I64 rip)
-{
- I64 r1,d1,r2,i=0x48,j=tmpi->arg2.disp;
- if (tmpi->arg2.type&MDF_IMM && I32_MIN<=j<=I32_MAX) {
- if (!(tmpi->ic_flags&(ICF_POP_CMP|ICF_PUSH_CMP)) &&
- tmpi->arg1.type&MDF_DISP && //TODO
- tmpi->arg1.type.raw_type>=RT_I64 && tmpi->arg1.reg!=REG_RAX) {
- r1=tmpi->arg1.reg;
- d1=tmpi->arg1.disp;
- ICZero(tmpi,REG_RAX);
- if (r1>7)
- i++;
- if (I8_MIN<=j<=I8_MAX)
- i+=0x388300;
- else
- i+=0x388100;
- if (!d1) {
- ICU24(tmpi,0x000000+i+(r1&7)<<16);
- } else if (I8_MIN<=d1<=I8_MAX) {
- ICU24(tmpi,0x400000+i+(r1&7)<<16);
- ICU8(tmpi,d1);
- } else {
- ICU24(tmpi,0x800000+i+(r1&7)<<16);
- ICU32(tmpi,d1);
- }
- if (I8_MIN<=j<=I8_MAX)
- ICU8(tmpi,j);
- else
- ICU32(tmpi,j);
- } else {
- if (tmpi->ic_flags & ICF_POP_CMP) {
- ICPopRegs(tmpi,1<<REG_RCX);
- r1=REG_RCX;
- } else {
- if (tmpi->arg1.type&MDF_REG && tmpi->arg1.reg!=REG_RAX)
- r1=tmpi->arg1.reg;
- else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- r1=REG_RCX;
- }
- }
- ICZero(tmpi,REG_RAX);
- if (r1>7)
- i++;
- if (I8_MIN<=j<=I8_MAX) {
- ICU24(tmpi,0xF88300+i+(r1&7)<<16);
- ICU8(tmpi,j);
- } else {
- ICU24(tmpi,0xF88100+i+(r1&7)<<16);
- ICU32(tmpi,j);
- }
- }
- if (tmpi->ic_flags & ICF_PUSH_CMP)
- ICPush(tmpi,MDF_IMM+RT_I64,0,j,rip);
- if (tmpi->ic_class->raw_type&RTF_UNSIGNED ||
- tmpi->ic_flags & ICF_USE_UNSIGNED)
- is=us;
- ICU16(tmpi,0x300+is);
- ICU24(tmpi,0xC0FF48);
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip);
- } else {
- if (tmpi->arg2.type&MDF_REG && tmpi->arg2.reg!=REG_RAX)
- r2=tmpi->arg2.reg;
- else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- r2=REG_RCX;
- }
- if (tmpi->ic_flags & ICF_POP_CMP) {
- ICPopRegs(tmpi,1<<REG_RDX);
- r1=REG_RDX;
- } else {
- if (tmpi->arg1.type&MDF_REG && tmpi->arg1.reg!=REG_RAX)
- r1=tmpi->arg1.reg;
- else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- r1=REG_RDX;
- }
- }
- ICZero(tmpi,REG_RAX);
- if (r2>7)
- i++;
- if (r1>7)
- i+=4;
- if (tmpi->ic_flags & ICF_PUSH_CMP)
- ICPushRegs(tmpi,1<<r2);
- ICU24(tmpi,0xC03B00+i+(r2&7)<<16+(r1&7)<<19);
- if (tmpi->ic_class->raw_type&RTF_UNSIGNED ||
- tmpi->ic_flags & ICF_USE_UNSIGNED)
- is=us;
- ICU16(tmpi,0x300+is);
- ICU24(tmpi,0xC0FF48);
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip);
- }
-}
-
-U0 ICBitOps(CIntermediateCode *tmpi,CICArg *arg1,CICArg *arg2,
- CIntermediateCode *tmpi2,I64 op,I64 op_imm,I64 rip)
-{//TODO:not fully utilizing Modr
- Bool res_not_used=ToBool(tmpi2->ic_flags&ICF_RES_NOT_USED);
- I64 r1,t2,r2,d2,i=0x48;
- if (tmpi->ic_flags & ICF_BY_VAL) {
- t2=arg2->type&MDG_MASK+RT_I64; //TODO: check overflow
- r2=arg2->reg;
- d2=arg2->disp;
- if (!(t2&MDG_REG_DISP_SIB_RIP) || !(r2.u8[0]!=REG_RAX&&(!(t2&MDF_SIB) ||
- r2.u8[1]&15!=REG_RAX) || res_not_used)) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,t2,r2,d2,rip);
- t2=MDF_REG+RT_I64;
- r2=REG_RCX;
- d2=0;
- }
- if (arg1->type&MDF_REG && (arg1->reg!=REG_RAX||res_not_used))
- r1=arg1->reg;
- else if (!(arg1->type&MDF_IMM) || arg1->disp>63) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,arg1->type,arg1->reg,arg1->disp,rip);
- r1=REG_RDX;
- } else
- r1=0;
- } else {
- t2=MDF_DISP+RT_I64;
- d2=0;
- if (arg2->type&MDF_REG && (arg2->reg!=REG_RAX||res_not_used))
- r2=arg2->reg;
- else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,arg2->type,arg2->reg,arg2->disp,rip);
- r2=REG_RCX;
- }
- if (arg1->type&MDF_REG && (arg1->reg!=REG_RAX||res_not_used))
- r1=arg1->reg;
- else if (!(arg1->type&MDF_IMM) || arg1->disp>63) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,arg1->type,arg1->reg,arg1->disp,rip);
- r1=REG_RDX;
- } else
- r1=0;
- }
- if (!res_not_used)
- ICZero(tmpi,REG_RAX);
- if (tmpi->ic_flags&ICF_LOCK && op!=0xA30F)
- ICU8(tmpi,OC_LOCK_PREFIX);
- if (arg1->type&MDF_IMM && arg1->disp<32)
- t2=t2&MDG_MASK+RT_U32;
- i=ICModr1(r1,t2,r2,d2);
- ICRex(tmpi,i.u8[1]);
- if (arg1->type&MDF_IMM && arg1->disp<64) {
- ICU24(tmpi,i.u8[2]<<16+op_imm);
- ICModr2(tmpi,i,,d2,rip+1);
- ICU8(tmpi,arg1->disp);
- } else {
- ICU24(tmpi,i.u8[2]<<16+op);
- ICModr2(tmpi,i,,d2,rip);
- }
- if (!res_not_used) {
- ICU24(tmpi,0xC0920F); //SETC AL
- if (tmpi->res.type.mode)
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip);
- }
-}
-
-U0 ICToUpper(CIntermediateCode *tmpi,I64 rip)
-{
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- ICU32(tmpi,0x61F88348);
- ICU16(tmpi,0x0A7C);
- ICU32(tmpi,0x7AF88348);
- ICU16(tmpi,0x047F);
- ICU32(tmpi,0xE0C08348);
-}
-
-U0 ICToI64(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 rip)
-{
- ICFCvt(cc,tmpi,REG_RAX,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,TRUE,CN_INST,rip);
-}
-
-U0 ICToF64(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 rip)
-{
- ICFCvt(cc,tmpi,REG_RAX,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,FALSE,CN_INST,rip);
-}
-
-U0 ICToBool(CCmpCtrl *,CIntermediateCode *tmpi,I64 rip)
-{
- I64 r;
- if (tmpi->arg1.type&MDF_REG)
- r=tmpi->arg1.reg;
- else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- r=REG_RAX;
- }
- ICTest(tmpi,r);
- ICU24(tmpi,0xC0950F); //SETNZ AL
- ICU32(tmpi,0xC0B60F48); //MOVZX RAX,AL
-}
-
-U0 ICPreIncDec(CIntermediateCode *tmpi,I64 op,I64 rip)
-{
- I64 r;
- CHashClass *tmpc=tmpi->ic_class,*tmpc1=tmpc-1;
- if (tmpi->ic_flags & ICF_BY_VAL) {
- if (tmpc->ptr_stars_cnt && tmpc1->size!=1) {
- ICAddSubEctImm(tmpi,
- tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
- tmpi->arg1.reg,tmpi->arg1.disp,
- tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
- tmpi->arg1.reg,tmpi->arg1.disp,tmpc1->size,op.u16[3],rip);
- } else
- ICSlashOp(tmpi,
- tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
- tmpi->arg1.reg,tmpi->arg1.disp,op,rip);
- if (tmpi->res.type.mode)
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
- tmpi->arg1.reg,tmpi->arg1.disp,rip);
- } else {
- if (tmpi->arg1.type&MDF_REG)
- r=tmpi->arg1.reg;
- else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- r=REG_RCX;
- }
- if (tmpc->ptr_stars_cnt &&
- tmpc1->size!=1) {
- ICAddSubEctImm(tmpi,MDF_DISP+tmpi->arg1_type_pointed_to,r,0,
- MDF_DISP+tmpi->arg1_type_pointed_to,r,0,
- tmpc1->size,op.u16[3],rip);
- } else
- ICSlashOp(tmpi,
- MDF_DISP+tmpi->arg1_type_pointed_to,r,0,op,rip);
- if (tmpi->res.type.mode)
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_DISP+tmpi->arg1_type_pointed_to,r,0,rip);
- }
-}
-
-U0 ICPostIncDec(CIntermediateCode *tmpi,I64 op,I64 rip)
-{
- I64 r;
- CHashClass *tmpc=tmpi->ic_class,*tmpc1=tmpc-1;
- if (tmpi->ic_flags & ICF_BY_VAL) {
- if (tmpi->res.type.mode)
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
- tmpi->arg1.reg,tmpi->arg1.disp,rip);
- if (tmpc->ptr_stars_cnt && tmpc1->size!=1)
- ICAddSubEctImm(tmpi,
- tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
- tmpi->arg1.reg,tmpi->arg1.disp,
- tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
- tmpi->arg1.reg,tmpi->arg1.disp,tmpc1->size,op.u16[3],rip);
- else
- ICSlashOp(tmpi,
- tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
- tmpi->arg1.reg,tmpi->arg1.disp,op,rip);
- } else {
- if (tmpi->arg1.type&MDF_REG &&
- !(tmpi->res.type&MDF_REG && tmpi->res.reg==tmpi->arg1.reg))
- r=tmpi->arg1.reg;
- else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- r=REG_RCX;
- }
- if (tmpi->res.type.mode)
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_DISP+tmpi->arg1_type_pointed_to,r,0,rip);
- if (tmpc->ptr_stars_cnt && tmpc1->size!=1)
- ICAddSubEctImm(tmpi,MDF_DISP+tmpi->arg1_type_pointed_to,r,0,
- MDF_DISP+tmpi->arg1_type_pointed_to,r,0,tmpc1->size,op.u16[3],rip);
- else
- ICSlashOp(tmpi,MDF_DISP+tmpi->arg1_type_pointed_to,r,0,op,rip);
- }
-}
-
-U0 ICDerefPostIncDec(CIntermediateCode *tmpi,I64 op,I64 rip)
-{
- CICType t;
- I64 r;
- CHashClass *tmpc1=tmpi->ic_class;
- t=tmpi->res.type.raw_type;
- if (t>tmpi->arg1_type_pointed_to)
- t=tmpi->arg1_type_pointed_to;
- if (tmpi->ic_flags & ICF_BY_VAL) {
- if (tmpi->arg1.type&MDF_REG)
- r=tmpi->arg1.reg;
- else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
- tmpi->arg1.type&MDG_MASK+RT_I64,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- r=REG_RDX;
- }
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_DISP+t,r,0,rip);
- if (tmpc1->size!=1)
- ICAddSubEctImm(tmpi,
- tmpi->arg1.type&MDG_MASK+RT_I64,tmpi->arg1.reg,tmpi->arg1.disp,
- tmpi->arg1.type&MDG_MASK+RT_I64,tmpi->arg1.reg,tmpi->arg1.disp,
- tmpc1->size,op.u16[3],rip);
- else
- ICSlashOp(tmpi,tmpi->arg1.type&MDG_MASK+RT_I64,
- tmpi->arg1.reg,tmpi->arg1.disp,op,rip);
- } else {
- if (tmpi->arg1.type&MDF_REG)
- r=tmpi->arg1.reg;
- else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,
- tmpi->arg1.type&MDG_MASK+RT_I64,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- r=REG_RCX;
- }
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,MDF_DISP+RT_I64,r,0,rip);
- if (tmpc1->size!=1)
- ICAddSubEctImm(tmpi,MDF_DISP+RT_I64,r,0,MDF_DISP+RT_I64,r,0,
- tmpc1->size,op.u16[3],rip);
- else
- ICSlashOp(tmpi,MDF_DISP+RT_I64,r,0,op,rip);
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_DISP+t,REG_RDX,0,rip);
- }
-}
-
-U0 ICAssignPostIncDec(CIntermediateCode *tmpi,I64 op,I64 rip)
-{
- CHashClass *tmpc1=tmpi->ic_class2-1;
- I64 r;
- if (tmpi->ic_flags & ICF_BY_VAL) {
- if (tmpi->arg1.type&MDF_REG)
- r=tmpi->arg1.reg;
- else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
- tmpi->arg1.type&MDG_MASK+RT_I64,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- r=REG_RDX;
- }
- ICMov(tmpi,MDF_DISP+tmpi->arg1_type_pointed_to,r,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- if (tmpi->res.type.mode)
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- if (tmpc1->size!=1 || tmpi->arg1.type&MDF_STK)
- ICAddSubEctImm(tmpi,tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,
- MDF_REG+RT_I64,r,0,tmpc1->size,op.u16[3],rip);
- else
- ICSlashOp(tmpi,tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,op,rip);
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,MDF_DISP+RT_I64,REG_RDX,0,rip);
- ICMov(tmpi,MDF_DISP+tmpi->arg1_type_pointed_to,REG_RCX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- if (tmpi->res.type.mode)
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- if (tmpc1->size!=1)
- ICAddSubEctImm(tmpi,MDF_DISP+RT_I64,REG_RDX,0,
- MDF_REG+RT_I64,REG_RCX,0,tmpc1->size,op.u16[3],rip);
- else
- ICSlashOp(tmpi,MDF_DISP+RT_I64,REG_RDX,0,op,rip);
- }
-}
-
-U0 ICCmpAndBranch(CIntermediateCode *tmpi,Bool has_res,I64 rip,
- I64 us,I64 is,I64 not_us,I64 not_is,U8 *buf,I64 rip2)
-{
- I64 r1,r2,i=0x48,j,res_reg;
- CICType t1,t2;
- Bool short_jmp,swap,done;
- CCodeMisc *lb;
- CICArg *arg1=&tmpi->arg1,*arg2=&tmpi->arg2;
-
- j=arg1->disp;
- if (arg1->type&MDF_IMM && I32_MIN<=j<=I32_MAX) {
- SwapI64(&arg1,&arg2);
- swap=TRUE;
- us=not_us;
- is=not_is;
- } else
- swap=FALSE;
- if (tmpi->ic_class->raw_type&RTF_UNSIGNED ||
- tmpi->ic_flags & ICF_USE_UNSIGNED)
- is=us;
-
- j=arg2->disp;
- if (arg2->type&MDF_IMM && I32_MIN<=j<=I32_MAX) {
- if (!has_res && arg1->type&MDG_REG_DISP_SIB_RIP)
- ICAddSubEctImm(tmpi,arg1->type,arg1->reg,arg1->disp,
- arg1->type,arg1->reg,arg1->disp,j,0x073B,rip2);
- else {
- if (arg1->type&MDF_REG)
- r1=arg1->reg;
- else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,arg1->type,
- arg1->reg,arg1->disp,rip2);
- r1=REG_RDX;
- }
- if (!j) {
- if (is.u8[2]==0x7C) {
- ICTest(tmpi,r1);
- is=0x78880F;
- } else if (is.u8[2]==0x7D) {
- ICTest(tmpi,r1);
- is=0x79890F;
- } else if (is.u8[2]==0x74 || is.u8[2]==0x75)
- ICTest(tmpi,r1);
- else {
- if (r1>7)
- i++;
- ICU24(tmpi,0xF88300+i+(r1&7)<<16);
- ICU8(tmpi,j);
- }
- } else {
- if (r1>7)
- i++;
- if (I8_MIN<=j<=I8_MAX) {
- ICU24(tmpi,0xF88300+i+(r1&7)<<16);
- ICU8(tmpi,j);
- } else {
- ICU24(tmpi,0xF88100+i+(r1&7)<<16);
- ICU32(tmpi,j);
- }
- }
- }
- if (has_res) {
- if (!swap) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,MDF_IMM+RT_I64,0,j,rip2);
- res_reg=REG_RCX;
- } else
- res_reg=r1;
- }
- } else {
- done=FALSE;
- t1=arg1->type;
- r1=arg1->reg;
- r2=arg2->reg;
- t2=arg2->type;
- if (t2.raw_type>=RT_I64 && !has_res && t2&MDG_DISP_SIB_RIP) {
- if (!(t1&MDF_REG) || t1.raw_type<RT_I64) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,arg1->type,
- arg1->reg,arg1->disp,rip2);
- r1=REG_RAX;
- }
- i=ICModr1(r1,t2,r2,arg2->disp);
- ICRex(tmpi,i.u8[1]);
- ICU16(tmpi,i.u8[2]<<8+0x3B);
- ICModr2(tmpi,i,,arg2->disp,rip2);
- done=TRUE;
- } else if (t1.raw_type>=RT_I64 && t1&MDG_REG_DISP_SIB_RIP) {
- if (!(t2&MDF_REG) || t2.raw_type<RT_I64) {
- if (t1&MDF_REG && r1==REG_RAX) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,arg2->type,
- arg2->reg,arg2->disp,rip2);
- r2=REG_RCX;
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,arg2->type,
- arg2->reg,arg2->disp,rip2);
- r2=REG_RAX;
- }
- }
- i=ICModr1(r2,t1,r1,arg1->disp);
- ICRex(tmpi,i.u8[1]);
- ICU16(tmpi,i.u8[2]<<8+0x39);
- ICModr2(tmpi,i,,arg1->disp,rip2);
- if (has_res)
- res_reg=r2;
- done=TRUE;
- }
- if (!done) {
- if (arg2->type&MDF_REG)
- r2=arg2->reg;
- else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,arg2->type,
- arg2->reg,arg2->disp,rip2);
- r2=REG_RAX;
- }
- if (arg1->type&MDF_REG)
- r1=arg1->reg;
- else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,arg1->type,
- arg1->reg,arg1->disp,rip2);
- r1=REG_RCX;
- }
- if (r2>7)
- i++;
- if (r1>7)
- i+=4;
- ICU24(tmpi,0xC03B00+i+(r2&7)<<16+(r1&7)<<19);
- if (has_res)
- res_reg=r2;
- }
- }
-
- rip+=tmpi->ic_cnt;
- lb=OptLabelFwd(tmpi->ic_data);
- short_jmp=ToBool(tmpi->ic_flags&ICF_SHORT_JMP);
- if (!buf && lb->addr!=INVALID_PTR) {
- i=lb->addr-(rip+2);
- if (lb->flags&CMF_POP_CMP) {
- if(tmpi->ic_flags&ICF_PUSH_CMP)
- i+=4;
- else
- i+=8;
- }
- if (I8_MIN<=i<=I8_MAX)
- short_jmp=TRUE;
- }
-
- if (short_jmp) {
- tmpi->ic_flags|=ICF_SHORT_JMP;
- i=lb->addr-(rip+2);
- if (lb->flags&CMF_POP_CMP) {
- if(tmpi->ic_flags&ICF_PUSH_CMP)
- i+=4;
- else
- i+=8;
- }
- ICU16(tmpi,i<<8+is.u8[2]);
- } else {
- tmpi->ic_flags&=~ICF_SHORT_JMP;
- i=lb->addr-(rip+6);
- if (lb->flags&CMF_POP_CMP) {
- if(tmpi->ic_flags&ICF_PUSH_CMP)
- i+=4;
- else
- i+=8;
- }
- ICU16(tmpi,is.u16[0]);
- ICU32(tmpi,i);
- }
- if (has_res)
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,res_reg,0,rip2);
-}
-
-U0 ICTestAndBranch(CIntermediateCode *tmpi,I64 rip,I64 is,U8 *buf,I64 rip2)
-{
- I64 i;
- Bool short_jmp;
- CCodeMisc *lb;
-
- if (!(tmpi->arg1.type&MDF_REG)) {
- if (tmpi->arg1.type.raw_type<=RT_U8 && tmpi->arg1.type&MDG_DISP_SIB_RIP) {
- i=ICModr1(tmpi,tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp);
- ICRex(tmpi,i.u8[1]);
- ICU16(tmpi,i.u8[2]<<8+0xF6);
- ICModr2(tmpi,i,,tmpi->arg1.disp,rip2+1);
- ICU8(tmpi,0xFF);
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- ICTest(tmpi,REG_RAX);
- }
- } else
- ICTest(tmpi,tmpi->arg1.reg);
-
- rip+=tmpi->ic_cnt;
- lb=OptLabelFwd(tmpi->ic_data);
- short_jmp=ToBool(tmpi->ic_flags&ICF_SHORT_JMP);
- if (!buf && lb->addr!=INVALID_PTR) {
- i=lb->addr-(rip+2);
- if (lb->flags&CMF_POP_CMP)
- i+=8;
- if (I8_MIN<=i<=I8_MAX)
- short_jmp=TRUE;
- }
-
- if (short_jmp) {
- tmpi->ic_flags|=ICF_SHORT_JMP;
- i=lb->addr-(rip+2);
- if (lb->flags&CMF_POP_CMP)
- i+=8;
- ICU16(tmpi,i<<8+is.u8[2]);
- } else {
- tmpi->ic_flags&=~ICF_SHORT_JMP;
- i=lb->addr-(rip+6);
- if (lb->flags&CMF_POP_CMP)
- i+=8;
- ICU16(tmpi,is.u16[0]);
- ICU32(tmpi,i);
- }
-}
-
-U0 ICFlagBranch(CIntermediateCode *tmpi,I64 rip,I64 is,U8 *buf)
-{
- I64 i;
- Bool short_jmp;
- CCodeMisc *lb;
-
- rip+=tmpi->ic_cnt;
- lb=OptLabelFwd(tmpi->ic_data);
- short_jmp=ToBool(tmpi->ic_flags&ICF_SHORT_JMP);
- if (!buf && lb->addr!=INVALID_PTR) {
- i=lb->addr-(rip+2);
- if (lb->flags&CMF_POP_CMP)
- i+=8;
- if (I8_MIN<=i<=I8_MAX)
- short_jmp=TRUE;
- }
-
- if (short_jmp) {
- tmpi->ic_flags|=ICF_SHORT_JMP;
- i=lb->addr-(rip+2);
- if (lb->flags&CMF_POP_CMP)
- i+=8;
- ICU16(tmpi,i<<8+is.u8[2]);
- } else {
- tmpi->ic_flags&=~ICF_SHORT_JMP;
- i=lb->addr-(rip+6);
- if (lb->flags&CMF_POP_CMP)
- i+=8;
- ICU16(tmpi,is.u16[0]);
- ICU32(tmpi,i);
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/BackC.HC.HTML b/public/src/Compiler/BackC.HC.HTML deleted file mode 100644 index c50cc30..0000000 --- a/public/src/Compiler/BackC.HC.HTML +++ /dev/null @@ -1,783 +0,0 @@ - - - - - BackC.HC - - - - - U0 ICAndBranch(CIntermediateCode *tmpi,I64 rip,I64 is,U8 *buf,I64 rip2)
-{
- U64 i;
- I64 it,t1,r1,d1,r2;
- Bool short_jmp,swap,override;
- CCodeMisc *lb;
- CICArg *arg1,*arg2;
-
- if (tmpi->arg1.type&MDF_IMM) {
- swap=TRUE;
- arg1=&tmpi->arg2;
- arg2=&tmpi->arg1;
- } else {
- swap=FALSE;
- arg1=&tmpi->arg1;
- arg2=&tmpi->arg2;
- }
-
- if (arg2->type&MDF_IMM && arg2->disp>U32_MAX)
- override=TRUE;
- else
- override=FALSE;
-
- if (arg1->type.raw_type<arg2->type.raw_type)
- it=arg1->type.raw_type;
- else
- it=arg2->type.raw_type;
-
- i=arg2->disp;
- if (arg2->type&MDF_IMM && i<=U32_MAX) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,arg1->type,arg1->reg,arg1->disp,rip2);
- if (i<=U8_MAX)
- ICU16(tmpi,i<<8+0xA8);
- else if (i<=U16_MAX)
- ICU32(tmpi,i<<16+0xA900+OC_OP_SIZE_PREFIX);
- else {
- ICU8(tmpi,0xA9);
- ICU32(tmpi,i);
- }
- } else {
- t1=MDF_REG+it;
- d1=0;
- if (swap && !override) {
- if (arg1->type&MDF_REG) {
- r1=arg1->reg;
- swap=TRUE;
- } else {
- r1=REG_RCX;
- swap=FALSE;
- }
- if (arg2->type&MDF_REG) {
- r2=arg2->reg;
- swap=FALSE;
- } else
- r2=REG_RDX;
- if (swap) {
- if (!(arg1->type&MDF_REG) || r1!=arg1->reg)
- ICMov(tmpi,MDF_REG+RT_I64,r1,0,arg1->type,arg1->reg,arg1->disp,rip2);
- if (arg2->type&MDG_REG_DISP_SIB_RIP) {
- t1=arg2->type&MDG_MASK+it;
- r2=arg2->reg;
- d1=arg2->disp;
- } else
- ICMov(tmpi,MDF_REG+RT_I64,r2,0,arg2->type,arg2->reg,arg2->disp,rip2);
- i=ICModr1(r1,t1,r2,d1);
- } else {
- if (arg1->type&MDG_REG_DISP_SIB_RIP) {
- t1=arg1->type&MDG_MASK+it;
- r1=arg1->reg;
- d1=arg1->disp;
- } else
- ICMov(tmpi,MDF_REG+RT_I64,r1,0,arg1->type,arg1->reg,arg1->disp,rip2);
- if (!(arg2->type&MDF_REG) || r2!=arg2->reg)
- ICMov(tmpi,MDF_REG+RT_I64,r2,0,arg2->type,arg2->reg,arg2->disp,rip2);
- i=ICModr1(r2,t1,r1,d1);
- }
- } else {
- if (arg2->type&MDF_REG) {
- r2=arg2->reg;
- swap=FALSE;
- } else {
- r2=REG_RDX;
- swap=TRUE;
- }
- if (arg1->type&MDF_REG) {
- r1=arg1->reg;
- swap=TRUE;
- } else
- r1=REG_RCX;
- if (override)
- swap=FALSE;
- if (swap) {
- if (arg2->type&MDG_REG_DISP_SIB_RIP) {
- t1=arg2->type&MDG_MASK+it;
- r2=arg2->reg;
- d1=arg2->disp;
- } else
- ICMov(tmpi,MDF_REG+RT_I64,r2,0,arg2->type,arg2->reg,arg2->disp,rip2);
- if (!(arg1->type&MDF_REG) || r1!=arg1->reg)
- ICMov(tmpi,MDF_REG+RT_I64,r1,0,arg1->type,arg1->reg,arg1->disp,rip2);
- i=ICModr1(r1,t1,r2,d1);
- } else {
- if (!(arg2->type&MDF_REG) || r2!=arg2->reg)
- ICMov(tmpi,MDF_REG+RT_I64,r2,0,arg2->type,arg2->reg,arg2->disp,rip2);
- if (arg1->type&MDG_REG_DISP_SIB_RIP) {
- t1=arg1->type&MDG_MASK+it;
- r1=arg1->reg;
- d1=arg1->disp;
- } else
- ICMov(tmpi,MDF_REG+RT_I64,r1,0,arg1->type,arg1->reg,arg1->disp,rip2);
- i=ICModr1(r2,t1,r1,d1);
- }
- }
- switch (it) {
- case RT_I8:
- case RT_U8:
- ICRex(tmpi,i.u8[1]);
- ICU16(tmpi,i.u8[2]<<8+0x84);
- break;
- case RT_U16:
- case RT_I16:
- ICOpSizeRex(tmpi,i.u8[1]);
- ICU16(tmpi,i.u8[2]<<8+0x85);
- break;
- default:
- ICRex(tmpi,i.u8[1]);
- ICU16(tmpi,i.u8[2]<<8+0x85);
- }
- ICModr2(tmpi,i,,d1,rip2);
- }
-
- rip+=tmpi->ic_cnt;
- lb=OptLabelFwd(tmpi->ic_data);
- short_jmp=ToBool(tmpi->ic_flags&ICF_SHORT_JMP);
- if (!buf && lb->addr!=INVALID_PTR) {
- i=lb->addr-(rip+2);
- if (lb->flags&CMF_POP_CMP)
- i+=8;
- if (I8_MIN<=i<=I8_MAX)
- short_jmp=TRUE;
- }
-
- if (short_jmp) {
- tmpi->ic_flags|=ICF_SHORT_JMP;
- i=lb->addr-(rip+2);
- if (lb->flags&CMF_POP_CMP)
- i+=8;
- ICU16(tmpi,i<<8+is.u8[2]);
- } else {
- tmpi->ic_flags&=~ICF_SHORT_JMP;
- i=lb->addr-(rip+6);
- if (lb->flags&CMF_POP_CMP)
- i+=8;
- ICU16(tmpi,is.u16[0]);
- ICU32(tmpi,i);
- }
-}
-
-U0 ICAssign(CIntermediateCode *tmpi,I64 rip)
-{
- CIntermediateCode *tmpi1;
- if (tmpi->ic_flags & ICF_BY_VAL) {
- ICMov(tmpi,tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
- tmpi->arg1.reg,tmpi->arg1.disp,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- if (tmpi->res.type.mode)
- ICMov(tmpi,tmpi->res.type&MDG_MASK+tmpi->arg1_type_pointed_to,
- tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
- tmpi->arg1.reg,tmpi->arg1.disp,rip);
- } else {
- if (tmpi->arg1.type&MDF_REG) {
- if (!(tmpi1=OptLag1(tmpi)) || tmpi1->ic_code!=IC_ADD_CONST ||
- tmpi1->res.type!=MDF_REG+RT_I64 || tmpi1->res.reg!=tmpi->arg1.reg ||
- tmpi1->arg1.type!=MDF_REG+RT_I64 ||
- tmpi1->arg1.reg!=tmpi->arg1.reg ||
- (tmpi->arg2.type&MDF_REG || tmpi->arg2.type&MDF_DISP) &&
- tmpi->arg2.reg==tmpi->arg1.reg ||
- tmpi->res.type.mode || tmpi1->ic_flags&~ICG_NO_CVT_MASK) {
- ICMov(tmpi,
- MDF_DISP+tmpi->arg1_type_pointed_to,
- tmpi->arg1.reg,tmpi->arg1.disp,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- if (tmpi->res.type.mode)
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- } else {
- tmpi->ic_flags=(tmpi->ic_flags|tmpi1->ic_flags)&
- ~ICF_CODE_FINAL|ICF_DONT_RESTORE;
- tmpi->arg1.disp=tmpi1->ic_data;
- OptSetNOP1(tmpi1); //This better not be last pass!
- ICMov(tmpi,MDF_DISP+tmpi->arg1_type_pointed_to,
- tmpi->arg1.reg,tmpi->arg1.disp,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- }
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- ICMov(tmpi,MDF_DISP+tmpi->arg1_type_pointed_to,REG_RCX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- if (tmpi->res.type.mode)
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- }
- }
-}
-
-U0 ICBrBitOps(CIntermediateCode *tmpi,I64 rip,
- I64 op,I64 op_imm,I64 is,U8 *buf,I64 rip2)
-{
- I64 i,t,r1,r2,d1,d2,t1,t2;
- CICArg *arg1=&tmpi->arg1,*arg2=&tmpi->arg2;
- Bool short_jmp;
- CCodeMisc *lb;
-
- if (tmpi->ic_flags & ICF_BY_VAL) {
- if (tmpi->ic_flags&ICF_SWAP && !(arg2->type&MDF_REG) &&
- (!(arg2->type&MDF_IMM) ||arg2->disp>63)||
- !(tmpi->ic_flags&ICF_SWAP) && arg2->type&MDF_IMM &&
- arg2->disp<64 || arg2->type&MDF_STK) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,arg2->type,arg2->reg,arg2->disp,rip2);
- t2=MDF_REG+RT_I64;
- r2=REG_RCX;
- d2=0;
- } else {
- t2=arg2->type;
- if (t2&MDF_IMM && arg2->disp<64)
- r2=0;
- else
- r2=arg2->reg;
- d2=arg2->disp;
- }
- if (!(tmpi->ic_flags&ICF_SWAP) && !(arg1->type&MDF_REG) &&
- (!(arg1->type&MDF_IMM) || arg1->disp>63) ||
- tmpi->ic_flags&ICF_SWAP && arg1->type&MDF_IMM &&
- arg1->disp<64 || arg1->type&MDF_STK) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,arg1->type,arg1->reg,arg1->disp,rip2);
- t1=MDF_REG+RT_I64;
- r1=REG_RDX;
- d1=0;
- } else {
- t1=arg1->type;
- if (t1&MDF_IMM && arg1->disp<64)
- r1=0;
- else
- r1=arg1->reg;
- d1=arg1->disp;
- }
- } else {
- t1=MDF_DISP+RT_I64;
- t2=MDF_DISP+RT_I64;
- d1=0;
- d2=0;
- if (arg2->type&MDF_REG)
- r2=arg2->reg;
- else if (!(tmpi->ic_flags&ICF_SWAP) || !(arg2->type&MDF_IMM) ||
- arg2->disp>63) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,arg2->type,arg2->reg,arg2->disp,rip2);
- r2=REG_RCX;
- } else
- r2=0;
- if (arg1->type&MDF_REG)
- r1=arg1->reg;
- else if (tmpi->ic_flags&ICF_SWAP ||
- !(arg1->type&MDF_IMM) || arg1->disp>63) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,arg1->type,arg1->reg,arg1->disp,rip2);
- r1=REG_RDX;
- } else
- r1=0;
- }
- if (tmpi->ic_flags&ICF_LOCK && op!=0xA30F)
- ICU8(tmpi,OC_LOCK_PREFIX);
- if (tmpi->ic_flags&ICF_SWAP) {
- if (arg2->type&MDF_IMM && arg2->disp<32) {
- if (op==0xA30F && arg2->disp<8) {
- t=t1&MDG_MASK+RT_U8;
- op_imm=0xF6; //TEST
- } else
- t=t1&MDG_MASK+RT_U32;
- } else
- t=t1;
- i=ICModr1(r2,t,r1,d1);
- SwapI64(&arg1,&arg2);
- } else {
- if (arg1->type&MDF_IMM && arg1->disp<32) {
- if (op==0xA30F && arg1->disp<8) {
- t=t2&MDG_MASK+RT_U8;
- op_imm=0xF6; //TEST
- } else
- t=t2&MDG_MASK+RT_U32;
- } else
- t=t2;
- i=ICModr1(r1,t,r2,d2);
- }
- ICRex(tmpi,i.u8[1]);
- if (op_imm==0xF6) {//TEST
- ICU16(tmpi,i.u8[2]<<8+op_imm);
- ICModr2(tmpi,i,,arg2->disp,rip2+1);
- ICU8(tmpi,1<<arg1->disp);
- if (is==0x72820F)
- is=0x75850F;
- else
- is=0x74840F;
- } else if (arg1->type&MDF_IMM && arg1->disp<64) {
- ICU24(tmpi,i.u8[2]<<16+op_imm);
- ICModr2(tmpi,i,,arg2->disp,rip2+1);
- ICU8(tmpi,arg1->disp);
- } else {
- ICU24(tmpi,i.u8[2]<<16+op);
- ICModr2(tmpi,i,,arg2->disp,rip2);
- }
-
- rip+=tmpi->ic_cnt;
- lb=OptLabelFwd(tmpi->ic_data);
- short_jmp=ToBool(tmpi->ic_flags&ICF_SHORT_JMP);
- if (!buf && lb->addr!=INVALID_PTR) {
- i=lb->addr-(rip+2);
- if (lb->flags&CMF_POP_CMP)
- i+=8;
- if (I8_MIN<=i<=I8_MAX)
- short_jmp=TRUE;
- }
-
- if (short_jmp) {
- tmpi->ic_flags|=ICF_SHORT_JMP;
- i=lb->addr-(rip+2);
- if (lb->flags&CMF_POP_CMP)
- i+=8;
- ICU16(tmpi,i<<8+is.u8[2]);
- } else {
- tmpi->ic_flags&=~ICF_SHORT_JMP;
- i=lb->addr-(rip+6);
- if (lb->flags&CMF_POP_CMP)
- i+=8;
- ICU16(tmpi,is.u16[0]);
- ICU32(tmpi,i);
- }
-}
-
-U0 ICQueInit(CIntermediateCode *tmpi,I64 rip2)
-{
- I64 r1;
- if (tmpi->arg1.type==MDF_REG+RT_I64)
- r1=tmpi->arg1.reg;
- else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- r1=REG_RAX;
- }
- ICMov(tmpi,MDF_DISP+RT_I64,r1,0,MDF_REG+RT_I64,r1,0,rip2);
- ICMov(tmpi,MDF_DISP+RT_I64,r1,sizeof(U8 *),MDF_REG+RT_I64,r1,0,rip2);
-}
-
-U0 ICQueIns(CIntermediateCode *tmpi,I64 rip2)
-{
- I64 r1,r2;
- if (tmpi->arg2.type==MDF_REG+RT_I64 && tmpi->arg2.reg!=REG_RDX)
- r2=tmpi->arg2.reg;
- else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip2);
- r2=REG_RAX;
- }
- if (tmpi->arg1.type==MDF_REG+RT_I64)
- r1=tmpi->arg1.reg;
- else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- r1=REG_RDX;
- }
- ICMov(tmpi,MDF_REG+RT_I64,REG_RBX,0,MDF_DISP+RT_I64,r1,0,rip2);
- ICMov(tmpi,MDF_DISP+RT_I64,r1,0,MDF_REG+RT_I64,r2,0,rip2);
- ICMov(tmpi,MDF_DISP+RT_I64,r2,0,MDF_REG+RT_I64,REG_RBX,0,rip2);
- ICMov(tmpi,MDF_DISP+RT_I64,r2,sizeof(U8 *),MDF_REG+RT_I64,r1,0,rip2);
- ICMov(tmpi,MDF_DISP+RT_I64,REG_RBX,sizeof(U8 *),MDF_REG+RT_I64,r2,0,rip2);
-}
-
-U0 ICQueInsRev(CIntermediateCode *tmpi,I64 rip2)
-{
- I64 r1,r2;
- if (tmpi->arg2.type==MDF_REG+RT_I64 && tmpi->arg2.reg!=REG_RDX)
- r2=tmpi->arg2.reg;
- else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip2);
- r2=REG_RAX;
- }
- if (tmpi->arg1.type==MDF_REG+RT_I64)
- r1=tmpi->arg1.reg;
- else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- r1=REG_RDX;
- }
- ICMov(tmpi,MDF_REG+RT_I64,REG_RBX,0,MDF_DISP+RT_I64,r1,sizeof(U8 *),rip2);
- ICMov(tmpi,MDF_DISP+RT_I64,REG_RBX,0,MDF_REG+RT_I64,r2,0,rip2);
- ICMov(tmpi,MDF_DISP+RT_I64,r2,0,MDF_REG+RT_I64,r1,0,rip2);
- ICMov(tmpi,MDF_DISP+RT_I64,r2,sizeof(U8 *),MDF_REG+RT_I64,REG_RBX,0,rip2);
- ICMov(tmpi,MDF_DISP+RT_I64,r1,sizeof(U8 *),MDF_REG+RT_I64,r2,0,rip2);
-}
-
-U0 ICQueRem(CIntermediateCode *tmpi,I64 rip2)
-{
- I64 r1;
- if (tmpi->arg1.type==MDF_REG+RT_I64)
- r1=tmpi->arg1.reg;
- else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- r1=REG_RAX;
- }
- ICMov(tmpi,MDF_REG+RT_I64,REG_RBX,0,MDF_DISP+RT_I64,r1,0,rip2);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,MDF_DISP+RT_I64,r1,sizeof(U8 *),rip2);
- ICU24(tmpi,0x1A8948);
- ICU32(tmpi,sizeof(U8 *)<<24+0x538948);
-}
-
-U0 ICMinMax(CIntermediateCode *tmpi,I64 op,I64 rip2)
-{
- I64 r1,i1=0x48;
- if (tmpi->arg2.type==MDF_REG+RT_I64 && tmpi->arg2.reg!=REG_RAX) {
- r1=tmpi->arg2.reg;
- if (r1>7) {
- i1++;
- r1&=7;
- }
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- } else {
- if (tmpi->arg1.reg==REG_RAX && tmpi->arg1.type&MDG_REG_DISP_SIB) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip2);
- r1=REG_RDX;
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip2);
- if (tmpi->arg1.type==MDF_REG+RT_I64) {
- r1=tmpi->arg1.reg;
- if (r1>7) {
- i1++;
- r1&=7;
- }
- } else {
- r1=REG_RDX;
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- }
- }
- }
- ICU24(tmpi,0xC03B00+r1<<16+i1);
- ICU32(tmpi,0xC0000F00+op<<16+r1<<24+i1);
-}
-
-U0 ICSqr(CIntermediateCode *tmpi,I64 op,I64 rip2)
-{
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- ICSlashOp(tmpi,MDF_REG+RT_I64,REG_RAX,0,op,rip2);
-}
-
-U0 ICModU64(CIntermediateCode *tmpi,I64 rip2)
-{
- CICType t1;
- I64 r1,d1;
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip2);
- if (tmpi->arg1.reg!=REG_RAX && tmpi->arg1.reg!=REG_RDX &&
- tmpi->arg1.type&MDG_REG_DISP_SIB &&
- tmpi->arg1.type.raw_type>=RT_I64) {
- t1=tmpi->arg1.type;
- r1=tmpi->arg1.reg;
- d1=tmpi->arg1.disp;
- } else {
- t1=MDF_REG+RT_I64;
- r1=REG_RBX;
- d1=0;
- ICMov(tmpi,MDF_REG+RT_I64,REG_RBX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- }
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,MDF_DISP+RT_I64,REG_RCX,0,rip2);
- ICZero(tmpi,REG_RDX);
- ICSlashOp(tmpi,t1,r1,d1,SLASH_OP_DIV,rip2);
- ICMov(tmpi,MDF_DISP+RT_I64,REG_RCX,0,MDF_REG+RT_I64,REG_RAX,0,rip2);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- MDF_REG+RT_I64,REG_RDX,0,rip2);
-}
-
-U0 ICSwap(CIntermediateCode *tmpi,I64 rip2)
-{
- I64 r1,r2;
- if (tmpi->arg1.type&MDF_REG)
- r1=tmpi->arg1.reg;
- else
- r1=REG_RAX;
- if (tmpi->arg2.type&MDF_REG)
- r2=tmpi->arg2.reg;
- else
- r2=REG_RAX;
- if (r1==r2) {
- if (r1==REG_RAX)
- r1=REG_RBX;
- else
- r2=REG_RAX;
- }
- ICMov(tmpi,MDF_REG+RT_I64,r2,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip2);
- ICMov(tmpi,MDF_REG+RT_I64,r1,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- switch (tmpi->ic_code) {
- case IC_SWAP_U8:
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,MDF_DISP+RT_U8,r1,0,rip2);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,MDF_DISP+RT_U8,r2,0,rip2);
- ICMov(tmpi,MDF_DISP+RT_U8,r2,0,MDF_REG+RT_I64,REG_RCX,0,rip2);
- ICMov(tmpi,MDF_DISP+RT_U8,r1,0,MDF_REG+RT_I64,REG_RDX,0,rip2);
- break;
- case IC_SWAP_U16:
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,MDF_DISP+RT_U16,r1,0,rip2);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,MDF_DISP+RT_U16,r2,0,rip2);
- ICMov(tmpi,MDF_DISP+RT_U16,r2,0,MDF_REG+RT_I64,REG_RCX,0,rip2);
- ICMov(tmpi,MDF_DISP+RT_U16,r1,0,MDF_REG+RT_I64,REG_RDX,0,rip2);
- break;
- case IC_SWAP_U32:
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,MDF_DISP+RT_U32,r1,0,rip2);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,MDF_DISP+RT_U32,r2,0,rip2);
- ICMov(tmpi,MDF_DISP+RT_U32,r2,0,MDF_REG+RT_I64,REG_RCX,0,rip2);
- ICMov(tmpi,MDF_DISP+RT_U32,r1,0,MDF_REG+RT_I64,REG_RDX,0,rip2);
- break;
- case IC_SWAP_I64:
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,MDF_DISP+RT_U64,r1,0,rip2);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,MDF_DISP+RT_U64,r2,0,rip2);
- ICMov(tmpi,MDF_DISP+RT_U64,r2,0,MDF_REG+RT_I64,REG_RCX,0,rip2);
- ICMov(tmpi,MDF_DISP+RT_U64,r1,0,MDF_REG+RT_I64,REG_RDX,0,rip2);
- break;
- }
-}
-
-U0 ICAndEqu(CIntermediateCode *tmpi,I64 rip2)
-{
- I64 i,bit;
- if (tmpi->arg2.type&MDF_IMM && !(tmpi->arg1.type&MDF_STK) &&
- tmpi->ic_flags&ICF_RES_NOT_USED) {
- i=~tmpi->arg2.disp;
- bit=Bsf(i);
- if (0<=bit==Bsr(i)) {
- tmpi->arg2.disp=bit;
- tmpi->arg2.reg=0;
- tmpi->arg1.type=tmpi->arg1.type&MDG_MASK+RT_I64;
- ICBitOps(tmpi,&tmpi->arg2,&tmpi->arg1,tmpi,0xB30F,0x30BA0F,rip2);
- return;
- }
- }
- ICAddSubEctEqu(tmpi,tmpi->arg1_type_pointed_to,
- tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,0x210425240423,rip2);
-}
-
-U0 ICOrEqu(CIntermediateCode *tmpi,I64 rip2)
-{
- I64 i,bit;
- if (tmpi->arg2.type&MDF_IMM && !(tmpi->arg1.type&MDF_STK) &&
- tmpi->ic_flags&ICF_RES_NOT_USED) {
- i=tmpi->arg2.disp;
- bit=Bsf(i);
- if (0<=bit==Bsr(i) && i>I8_MAX) {
- tmpi->arg2.disp=bit;
- tmpi->arg2.reg=0;
- tmpi->arg1.type=tmpi->arg1.type&MDG_MASK+RT_I64;
- ICBitOps(tmpi,&tmpi->arg2,&tmpi->arg1,tmpi,0xAB0F,0x28BA0F,rip2);
- return;
- }
- }
- ICAddSubEctEqu(tmpi,tmpi->arg1_type_pointed_to,
- tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,0x09010D0C010B,rip2);
-}
-
-U0 ICXorEqu(CIntermediateCode *tmpi,I64 rip2)
-{
- I64 i,bit;
- if (tmpi->arg2.type&MDF_IMM && !(tmpi->arg1.type&MDF_STK) &&
- tmpi->ic_flags&ICF_RES_NOT_USED) {
- i=tmpi->arg2.disp;
- bit=Bsf(i);
- if (0<=bit==Bsr(i)) {
- tmpi->arg2.disp=bit;
- tmpi->arg2.reg=0;
- tmpi->arg1.type=tmpi->arg1.type&MDG_MASK+RT_I64;
- ICBitOps(tmpi,&tmpi->arg2,&tmpi->arg1,tmpi,0xBB0F,0x38BA0F,rip2);
- return;
- }
- }
- ICAddSubEctEqu(tmpi,tmpi->arg1_type_pointed_to,
- tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,0x310635340633,rip2);
-}
-
-U0 ICSwitch(CIntermediateCode *tmpi,I64 rip,
- Bool nobound,CCmpCtrl *cc,U8 *buf,I64 rip2)
-{
- I64 i,j,cnt,min,max,begin,r;
- CCodeMisc *lb;
- Bool short_jmp;
- CAOTAbsAddr *tmpa;
- if (!(tmpi->arg1.type&MDF_REG) || tmpi->arg1.reg&7==REG_RSP)
- r=REG_RDX;
- else
- r=tmpi->arg1.reg;
- if (nobound)
- ICMov(tmpi,MDF_REG+RT_I64,r,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- else {
- if (tmpi->arg2.type&MDF_IMM) {
- j=tmpi->arg2.disp;
- ICMov(tmpi,MDF_REG+RT_I64,r,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- if (I8_MIN<=j<=I8_MAX) {
- i=0xF88348+(r&7)<<16;
- if (r>7) i++;
- ICU24(tmpi,i);
- ICU8(tmpi,j);
- } else if (I32_MIN<=j<=I32_MAX) {
- i=0xF88148+(r&7)<<16;
- if (r>7) i++;
- ICU24(tmpi,i);
- ICU32(tmpi,j);
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip2);
- i=0xC13B48+(r&7)<<19;
- if (r>7) i+=4;
- ICU24(tmpi,i);
- }
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip2);
- ICMov(tmpi,MDF_REG+RT_I64,r,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- i=0xC13B48+(r&7)<<19;
- if (r>7) i+=4;
- ICU24(tmpi,i);
- }
-
- rip+=tmpi->ic_cnt;
- lb=tmpi->ic_data(CCodeMisc *)->dft;
- short_jmp=ToBool(tmpi->ic_flags&ICF_SHORT_JMP);
- if (!buf && lb->addr!=INVALID_PTR) {
- i=lb->addr-(rip+2);
- if (I8_MIN<=i<=I8_MAX)
- short_jmp=TRUE;
- }
- if (short_jmp) {
- tmpi->ic_flags|=ICF_SHORT_JMP;
- ICU16(tmpi,(lb->addr-(rip+2))<<8+0x73);
- } else {
- tmpi->ic_flags&=~ICF_SHORT_JMP;
- ICU16(tmpi,0x830F);
- ICU32(tmpi,lb->addr-(rip+6));
- }
- }
-
- lb=tmpi->ic_data;
- begin=lb->begin->addr;
- if (!buf && begin!=INVALID_PTR) {
- min=I64_MAX;
- max=I64_MIN;
- for (i=0;i<lb->range;i++) {
- if (lb->jmp_table[i]->addr==INVALID_PTR) {
- min=I64_MIN;
- max=I64_MAX;
- break;
- } else {
- j=lb->jmp_table[i]->addr-begin;
- min=MinI64(min,j);
- max=MaxI64(max,j);
- }
- }
- if (I8_MIN<=min<=max<=I8_MAX)
- lb->flags|=CMF_I8_JMP_TABLE;
- else if (U8_MIN<=min<=max<=U8_MAX)
- lb->flags|=CMF_U8_JMP_TABLE;
- else if (I16_MIN<=min<=max<=I16_MAX)
- lb->flags|=CMF_I16_JMP_TABLE;
- else if (U16_MIN<=min<=max<=U16_MAX)
- lb->flags|=CMF_U16_JMP_TABLE;
- }
-
- if (lb->flags&CMF_I8_JMP_TABLE) {
- if (r<8)
- ICU8(tmpi,0x48);
- else
- ICU8(tmpi,0x49);
- ICU24(tmpi,0x98BE0F+(r&7)<<16);
- cnt=1;
- } else if (lb->flags&CMF_U8_JMP_TABLE) {
- if (r<8)
- cnt=2;
- else {
- ICU8(tmpi,0x49);
- cnt=1;
- }
- ICU24(tmpi,0x98B60F+(r&7)<<16);
- } else if (lb->flags&CMF_I16_JMP_TABLE) {
- if (r<8)
- ICU8(tmpi,0x48);
- else
- ICU8(tmpi,0x4A);
- ICU32(tmpi,0x451CBF0F+(r&7)<<27);
- cnt=0;
- } else if (lb->flags&CMF_U16_JMP_TABLE) {
- if (r<8)
- cnt=1;
- else {
- ICU8(tmpi,0x4A);
- cnt=0;
- }
- ICU32(tmpi,0x451CB70F+(r&7)<<27);
- } else {
- if (r<8)
- cnt=2;
- else {
- ICU8(tmpi,0x42);
- cnt=1;
- }
- ICU24(tmpi,0x851C8B+(r&7)<<19);
- }
- if (buf && cc->flags&CCF_AOT_COMPILE) {
- tmpa=CAlloc(sizeof(CAOTAbsAddr));
- tmpa->next=cc->aotc->abss;
- tmpa->type=AAT_ADD_U32;
- cc->aotc->abss=tmpa;
- tmpa->rip=rip2+tmpi->ic_cnt;
- ICU32(tmpi,lb->addr+cc->aotc->rip);
- } else
- ICU32(tmpi,lb->addr+buf);
-
- if (lb->flags&(CMF_I8_JMP_TABLE|CMF_U8_JMP_TABLE|
- CMF_I16_JMP_TABLE|CMF_U16_JMP_TABLE)) {
- ICU16(tmpi,0xC381); //ADD EBX,0x12345678
- if (buf && cc->flags&CCF_AOT_COMPILE) {
- tmpa=CAlloc(sizeof(CAOTAbsAddr));
- tmpa->next=cc->aotc->abss;
- tmpa->type=AAT_ADD_U32;
- cc->aotc->abss=tmpa;
- tmpa->rip=rip2+tmpi->ic_cnt;
- ICU32(tmpi,begin+cc->aotc->rip);
- } else
- ICU32(tmpi,begin+buf);
- } else
- cnt+=6;
- ICU16(tmpi,0xE3FF); //JMP EBX
- for (i=0;i<cnt;i++) //Code must always shrink, not expand
- ICU8(tmpi,OC_NOP);
- tmpi->ic_flags&=~ICF_CODE_FINAL;
-}
-
-U0 ICLocalVarInit(CIntermediateCode *tmpi)
-{
- ICU24(tmpi,0xC48B48);
- ICU16(tmpi,0x5748);
- ICU24(tmpi,0xF88B48);
- ICU24(tmpi,0xC1C748);
- ICU32(tmpi,tmpi->ic_data);
- ICU16(tmpi,sys_var_init_val<<8+0xB0);
- ICU24(tmpi,0xAA48F3);
- ICU16(tmpi,0x5F48);
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/BackFA.HC.HTML b/public/src/Compiler/BackFA.HC.HTML deleted file mode 100644 index d5f1785..0000000 --- a/public/src/Compiler/BackFA.HC.HTML +++ /dev/null @@ -1,619 +0,0 @@ - - - - - BackFA.HC - - - - - #define CN_A2 0
-#define CN_A1 1
-#define CN_INST 2
-#define CN_RES 3
-
-U0 CmpNoteFloatOp(CCmpCtrl *cc,CIntermediateCode *tmpi,
- Bool dont_pushable,Bool dont_popable,I64 pos)
-{
- Bool link=FALSE;
- if (cc->pass==7 && cc->last_float_op_ic &&
- cc->last_dont_popable && dont_pushable) {
- switch [pos] {
- case CN_A2:
- if (cc->last_float_op_ic!=tmpi && cc->dont_push_float)
- link=TRUE;
- break;
- case CN_A1:
- if (cc->last_float_op_ic!=tmpi && cc->dont_push_float)
- link=TRUE;
- break;
- case CN_INST:
- if (cc->last_float_op_ic!=tmpi) {
- if (cc->dont_push_float) {
- if (intermediate_code_table[tmpi->ic_code].arg_cnt==IS_2_ARG &&
- cc->last_float_op_ic->res.reg!=REG_R8)
- tmpi->ic_flags|=ICF_ALT_TEMPLATE;
- else
- tmpi->ic_flags&=~ICF_ALT_TEMPLATE;
- link=TRUE;
- }
- } else {
- if (intermediate_code_table[tmpi->ic_code].arg_cnt==IS_2_ARG &&
- cc->last_float_op_pos!=CN_A1)
- tmpi->ic_flags|=ICF_ALT_TEMPLATE;
- else
- tmpi->ic_flags&=~ICF_ALT_TEMPLATE;
- link=TRUE;
- }
- break;
- case CN_RES:
- if (cc->last_float_op_ic==tmpi && cc->last_float_op_pos==CN_INST)
- link=TRUE;
- break;
- }
- if (link) {
- if (!Bts(&cc->last_float_op_ic->ic_flags,
- ICf_DONT_POP_FLOAT0+cc->last_ic_float_op_num))
- cc->last_float_op_ic->ic_flags&=~ICF_CODE_FINAL;
- if (!Bts(&tmpi->ic_flags,ICf_DONT_PUSH_FLOAT0+cc->cur_ic_float_op_num))
- tmpi->ic_flags&=~ICF_CODE_FINAL;
- }
- }
- cc->last_float_op_ic=tmpi;
- cc->last_dont_pushable=dont_pushable;
- cc->last_dont_popable=dont_popable;
- cc->last_ic_float_op_num=cc->cur_ic_float_op_num++;
- cc->last_float_op_pos=pos;
- if (cc->cur_ic_float_op_num>4)
- throw('Compiler');
-}
-
-U0 CmpSetFloatOpPushPop(CCmpCtrl *cc,CIntermediateCode *tmpi,
- Bool *dont_push_float,Bool *dont_pop_float)
-{
- if (cc->pass==7) {
- *dont_push_float=FALSE;
- *dont_pop_float =FALSE;
- tmpi->ic_flags&=~ICF_CODE_FINAL;
- } else {
- *dont_push_float=Bt(&tmpi->ic_flags,
- ICf_DONT_PUSH_FLOAT0+cc->cur_ic_float_op_num);
- *dont_pop_float=Bt(&tmpi->ic_flags,
- ICf_DONT_POP_FLOAT0+cc->cur_ic_float_op_num);
- }
-}
-
-U0 ICCopyTemplate(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,
- Bool off_the_record,Bool dont_pushable,Bool dont_popable,I64 pos)
-{
- Bool dont_push_float,dont_pop_float,alt;
- U8 *ptr;
- I64 i=0;
- if (!off_the_record) {
- if (tmpi->ic_flags&ICF_ALT_TEMPLATE)
- alt=TRUE;
- else
- alt=FALSE;
- CmpSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float);
- } else {
- dont_push_float=FALSE;
- dont_pop_float=FALSE;
- alt=FALSE;
- }
- if (alt && dont_push_float && !dont_pop_float) {
- ptr=cmp_templates_dont_push2[op];
- i=cmp_templates_dont_push2[op+1]-ptr;
- }
- if (!i) {
- if (dont_push_float) {
- if (dont_pop_float) {
- ptr=cmp_templates_dont_push_pop[op];
- i=cmp_templates_dont_push_pop[op+1]-ptr;
- } else {
- ptr=cmp_templates_dont_push[op];
- i=cmp_templates_dont_push[op+1]-ptr;
- }
- } else {
- if (dont_pop_float) {
- ptr=cmp_templates_dont_pop[op];
- i=cmp_templates_dont_pop[op+1]-ptr;
- } else {
- ptr=cmp_templates[op];
- i=cmp_templates[op+1]-ptr;
- }
- }
- }
- MemCpy(&tmpi->ic_body[tmpi->ic_cnt],ptr,i);
- if (!off_the_record)
- CmpNoteFloatOp(cc,tmpi,dont_pushable,dont_popable,pos);
- tmpi->ic_cnt+=i;
-}
-
-U0 ICFCvt(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 r1,
- CICType t2,I64 r2,I64 d2,Bool to_int,I64 pos,I64 rip)
-{
- I64 rsp_size=0,op1,op2;
- Bool dont_push_float,dont_pop_float;
-
- if (to_int) {
- op1=SLASH_OP_FLD;
- op2=SLASH_OP_FISTTP;
- } else {
- op1=SLASH_OP_FILD;
- op2=SLASH_OP_FSTP;
- }
-
- CmpSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float);
- if (!dont_push_float) {
- if (!(t2.raw_type>=RT_I64 && t2&MDG_DISP_SIB_RIP)) {
- ICPush(tmpi,t2,r2,d2,rip);
- t2=MDF_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
- rsp_size=8;
- } else {
- if (!dont_pop_float) {
- rsp_size=8;
- ICAddRSP(tmpi,-8);
- }
- }
- ICSlashOp(tmpi,t2,r2,d2,op1,rip);
- } else {
- if (!dont_pop_float) {
- rsp_size=8;
- ICAddRSP(tmpi,-8);
- }
- }
- if (to_int)
- CmpNoteFloatOp(cc,tmpi,TRUE,FALSE,pos);
- else
- CmpNoteFloatOp(cc,tmpi,FALSE,TRUE,pos);
- if (dont_pop_float) {
- if (rsp_size)
- ICAddRSP(tmpi,rsp_size);
- } else {
- ICSlashOp(tmpi,MDF_SIB+RT_I64,REG_RSP+REG_RSP<<8,0,op2,rip);
- ICPop(tmpi,MDF_REG+RT_I64,r1,0,rip);
- }
-}
-
-U0 ICFCvt2(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 r1,
- CICType t2,I64 r2,I64 d2,Bool to_int,I64 rip)
-{
- I64 rsp_size=0,op1,op2;
- if (to_int) {
- op1=SLASH_OP_FLD;
- op2=SLASH_OP_FISTTP;
- } else {
- op1=SLASH_OP_FILD;
- op2=SLASH_OP_FSTP;
- }
- if (!(t2.raw_type>=RT_I64 && t2&MDG_DISP_SIB_RIP)) {
- ICPush(tmpi,t2,r2,d2,rip);
- t2=MDF_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
- rsp_size=8;
- } else {
- rsp_size=8;
- ICAddRSP(tmpi,-8);
- }
- ICSlashOp(tmpi,t2,r2,d2,op1,rip);
- ICSlashOp(tmpi,MDF_SIB+RT_I64,REG_RSP+REG_RSP<<8,0,op2,rip);
- ICPop(tmpi,MDF_REG+RT_I64,r1,0,rip);
- cc->last_dont_pushable=cc->last_dont_popable=FALSE; //TODO: improve this
-}
-
-U0 ICFUnaryMinus(CCmpCtrl *cc,CIntermediateCode *tmpi,U8 *buf2,I64 rip)
-{
- CICArg *arg1=&tmpi->arg1;
- I64 rsp_size=0,builtin1=0,t1,r1,d1;
- Bool dont_push_float,dont_pop_float;
-
- if (cc->flags&CCF_AOT_COMPILE)
- buf2=cc->aotc->rip;
-
- CmpSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float);
- if (!dont_push_float) {
- if (arg1->type.raw_type>=RT_I64 && arg1->type&MDG_DISP_SIB_RIP) {
- t1=arg1->type;
- r1=arg1->reg;
- d1=arg1->disp;
- } else {
- if (arg1->type&MDF_IMM) {
- if (!(builtin1=ICBuiltInFloatConst(arg1->disp(F64)))) {
- t1=MDF_RIP_DISP32+RT_I64;
- r1=REG_RIP;
- d1=COCFloatConstFind(cc,arg1->disp(F64))+buf2;
- }
- } else {
- ICPush(tmpi,arg1->type,arg1->reg,arg1->disp,rip);
- t1=MDF_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=0;
- rsp_size+=8;
- }
- }
- if (builtin1)
- ICU16(tmpi,builtin1);
- else
- ICSlashOp(tmpi,t1,r1,d1,SLASH_OP_FLD,rip);
- }
- if (!dont_pop_float && !rsp_size) {
- rsp_size=8;
- ICAddRSP(tmpi,-8);
- }
- ICU16(tmpi,0xE0D9); //FCHS
- CmpNoteFloatOp(cc,tmpi,TRUE,TRUE,CN_INST);
- if (dont_pop_float) {
- if (rsp_size)
- ICAddRSP(tmpi,rsp_size);
- } else {
- ICSlashOp(tmpi,MDF_SIB+RT_I64,REG_RSP+REG_RSP<<8,0,SLASH_OP_FSTP,rip);
- ICPop(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,rip);
- }
-}
-
-U0 ICFMod(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 rip)
-{//for MOD
- Bool dont_push_float,dont_pop_float;
- CmpSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float);
- if (dont_push_float) {
- if (tmpi->ic_flags&ICF_ALT_TEMPLATE)
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- else
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- }
-//TODO: unpushable,unpop? Not sure
- ICCopyTemplate(cc,tmpi,CMP_TEMPLATE_MOD,FALSE,FALSE,FALSE,CN_INST);
- if (!dont_pop_float)
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip);
-}
-
-U0 ICFPow(CCmpCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip)
-{//for POW
- I64 i;
- CAOTImportExport *tmpie;
- CHashExport *tmpex=HashFind("SYS_POW",
- cc->htc.hash_table_lst,HTT_EXPORT_SYS_SYM);
-
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- if (cc->flags&CCF_AOT_COMPILE) {
- if (!tmpex) {
- tmpex=CAlloc(sizeof(CHashExport));
- tmpex->str=StrNew("SYS_POW");
- tmpex->type=HTT_EXPORT_SYS_SYM|HTF_UNRESOLVED|HTF_IMPORT;
- HashAdd(tmpex,cc->htc.glbl_hash_table);
- }
- if (tmpex->type&HTF_IMPORT) {
- if (GetOption(OPTf_USE_IMM64)) {
- ICU16(tmpi,0xBB48);
- ICU64(tmpi,0);
- if (buf) {
- tmpie=CAlloc(sizeof(CAOTImportExport));
- tmpie->type=IET_IMM_I64;
- tmpie->rip=rip+tmpi->ic_cnt-8;
- tmpie->next=tmpex->ie_lst;
- tmpex->ie_lst=tmpie;
- }
- ICU16(tmpi,0xD3FF);
- } else {
- ICU8(tmpi,0xE8);
- ICU32(tmpi,-(rip+tmpi->ic_cnt+4));
- if (buf) {
- tmpie=CAlloc(sizeof(CAOTImportExport));
- tmpie->type=IET_REL_I32;
- tmpie->rip=rip+tmpi->ic_cnt-4;
- tmpie->next=tmpex->ie_lst;
- tmpex->ie_lst=tmpie;
- }
- }
- } else {//Kernel
- if (tmpex->type&HTF_UNRESOLVED)
- throw('Compiler');
- else {
- i=tmpex->val-(rip+tmpi->ic_cnt+5);
- if (!(I32_MIN<=i<=I32_MAX)) {
- throw('Compiler');
-// ICU16(tmpi,0xBB48);
- // ICU64(tmpi,tmpex->val);
- // ICU16(tmpi,0xD3FF);
- } else {
- ICU8(tmpi,0xE8);
- ICU32(tmpi,i);
- }
- }
- }
- } else {
- i=tmpex->val-(rip+tmpi->ic_cnt+5);
- if (!(I32_MIN<=i<=I32_MAX)) {
- ICU16(tmpi,0xBB48);
- ICU64(tmpi,tmpex->val);
- ICU16(tmpi,0xD3FF);
- } else {
- ICU8(tmpi,0xE8);
- ICU32(tmpi,i);
- }
- }
- tmpi->ic_flags&=~ICF_CODE_FINAL;
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip);
-}
-
-U0 ICFOp(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,U8 *buf2,I64 rip)
-{//for ADD,SUB,DIV,MUL
- CICArg *arg1,*arg2;
- Bool dont_push_float,dont_pop_float,alt;
- I64 rsp_size=0,builtin1=0,builtin2=0,t1,r1,d1,t2,r2,d2;
-
- if (tmpi->ic_flags&ICF_ALT_TEMPLATE) {
- arg1=&tmpi->arg2;
- arg2=&tmpi->arg1;
- alt=TRUE;
- } else {
- arg1=&tmpi->arg1;
- arg2=&tmpi->arg2;
- alt=FALSE;
- }
-
- if (cc->flags&CCF_AOT_COMPILE)
- buf2=cc->aotc->rip;
-
- CmpSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float);
- if (dont_push_float) {
- if (arg2->type.raw_type>=RT_I64 && arg2->type&MDG_DISP_SIB_RIP) {
- t2=arg2->type;
- r2=arg2->reg;
- d2=arg2->disp;
- } else {
- if (arg2->type&MDF_IMM) {
- if (!(builtin2=ICBuiltInFloatConst(arg2->disp(F64)))) {
- t2=MDF_RIP_DISP32+RT_I64;
- r2=REG_RIP;
- d2=COCFloatConstFind(cc,arg2->disp(F64))+buf2;
- }
- } else {
- ICPush(tmpi,arg2->type,arg2->reg,arg2->disp,rip);
- t2=MDF_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
- rsp_size+=8;
- }
- }
- } else {
- if (alt) {
- if (!(arg2->type&MDF_STK)) {
- if (arg1->type.raw_type>=RT_I64 && arg1->type&MDG_DISP_SIB_RIP) {
- t1=arg1->type;
- r1=arg1->reg;
- d1=arg1->disp;
- } else {
- if (arg1->type&MDF_IMM) {
- if (!(builtin1=ICBuiltInFloatConst(arg1->disp(F64)))) {
- t1=MDF_RIP_DISP32+RT_I64;
- r1=REG_RIP;
- d1=COCFloatConstFind(cc,arg1->disp(F64))+buf2;
- }
- } else {
- ICPush(tmpi,arg1->type,arg1->reg,arg1->disp,rip);
- t1=MDF_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=0;
- rsp_size+=8;
- }
- }
- if (arg2->type.raw_type>=RT_I64 && arg2->type&MDG_DISP_SIB_RIP) {
- t2=arg2->type;
- r2=arg2->reg;
- d2=arg2->disp;
- } else {
- if (arg2->type&MDF_IMM) {
- if (!(builtin2=ICBuiltInFloatConst(arg2->disp(F64)))) {
- t2=MDF_RIP_DISP32+RT_I64;
- r2=REG_RIP;
- d2=COCFloatConstFind(cc,arg2->disp(F64))+buf2;
- }
- } else {
- ICPush(tmpi,arg2->type,arg2->reg,arg2->disp,rip);
- t2=MDF_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
- rsp_size+=8;
- if (r1==REG_RSP+REG_RSP<<8)
- d1+=8;
- }
- }
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,arg1->type,
- arg1->reg,arg1->disp,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,arg2->type,
- arg2->reg,arg2->disp,rip);
- ICU16(tmpi,0x5052); //PUSH EDX PUSH EAX
- rsp_size=16;
- t1=MDF_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=8;
- t2=MDF_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
- }
- } else {
- if (!(arg1->type&MDF_STK)) {
- if (arg2->type.raw_type>=RT_I64 && arg2->type&MDG_DISP_SIB_RIP) {
- t2=arg2->type;
- r2=arg2->reg;
- d2=arg2->disp;
- } else {
- if (arg2->type&MDF_IMM) {
- if (!(builtin2=ICBuiltInFloatConst(arg2->disp(F64)))) {
- t2=MDF_RIP_DISP32+RT_I64;
- r2=REG_RIP;
- d2=COCFloatConstFind(cc,arg2->disp(F64))+buf2;
- }
- } else {
- ICPush(tmpi,arg2->type,arg2->reg,arg2->disp,rip);
- t2=MDF_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
- rsp_size+=8;
- }
- }
- if (arg1->type.raw_type>=RT_I64 && arg1->type&MDG_DISP_SIB_RIP) {
- t1=arg1->type;
- r1=arg1->reg;
- d1=arg1->disp;
- } else {
- if (arg1->type&MDF_IMM) {
- if (!(builtin1=ICBuiltInFloatConst(arg1->disp(F64)))) {
- t1=MDF_RIP_DISP32+RT_I64;
- r1=REG_RIP;
- d1=COCFloatConstFind(cc,arg1->disp(F64))+buf2;
- }
- } else {
- ICPush(tmpi,arg1->type,arg1->reg,arg1->disp,rip);
- t1=MDF_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=0;
- rsp_size+=8;
- if (r2==REG_RSP+REG_RSP<<8)
- d2+=8;
- }
- }
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,arg2->type,
- arg2->reg,arg2->disp,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,arg1->type,
- arg1->reg,arg1->disp,rip);
- ICU16(tmpi,0x5052); //PUSH EDX PUSH EAX
- rsp_size=16;
- t1=MDF_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=8;
- t2=MDF_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
- }
- }
- }
- if (!dont_pop_float && !rsp_size) {
- rsp_size=8;
- ICAddRSP(tmpi,-8);
- }
- if (!dont_push_float) {
- if (builtin2 && !builtin1) {
- alt=!alt;
- SwapI64(&t1,&t2);
- SwapI64(&r1,&r2);
- SwapI64(&d1,&d2);
- SwapI64(&builtin1,&builtin2);
- }
- if (builtin1)
- ICU16(tmpi,builtin1);
- else
- ICSlashOp(tmpi,t1,r1,d1,SLASH_OP_FLD,rip);
- }
- if (alt)
- switch (op.u8[0]) {
- case 4: op=SLASH_OP_FSUBR; break;
- case 6: op=SLASH_OP_FDIVR; break;
- }
- if (builtin2) {
- ICU16(tmpi,builtin2);
- ICU16(tmpi,op.u16[2]);
- } else
- ICSlashOp(tmpi,t2,r2,d2,op,rip);
- CmpNoteFloatOp(cc,tmpi,TRUE,TRUE,CN_INST);
- if (dont_pop_float) {
- if (rsp_size)
- ICAddRSP(tmpi,rsp_size);
- } else {
- if (rsp_size==8)
- ICSlashOp(tmpi,MDF_SIB+RT_I64,REG_RSP+REG_RSP<<8,0,SLASH_OP_FSTP,rip);
- else if (rsp_size>8) {
- ICSlashOp(tmpi,MDF_SIB+RT_I64,REG_RSP+REG_RSP<<8,rsp_size-8,
- SLASH_OP_FSTP,rip);
- ICAddRSP(tmpi,rsp_size-8);
- }
- ICPop(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,rip);
- }
-}
-
-U0 ICFCmp(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,I64 rip)
-{
- Bool dont_push_float,dont_pop_float;
- CmpSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float);
- if (dont_push_float) {
- if (tmpi->ic_flags&ICF_ALT_TEMPLATE) {
- if (tmpi->ic_flags&ICF_POP_CMP)
- ICPopRegs(tmpi,1<<REG_RAX);
- else
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- } else
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- if (tmpi->ic_flags&ICF_POP_CMP)
- ICPopRegs(tmpi,1<<REG_RDX);
- else
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- }
- if (tmpi->ic_flags&ICF_PUSH_CMP)
- ICPushRegs(tmpi,1<<REG_RAX);
- ICCopyTemplate(cc,tmpi,op,FALSE,TRUE,FALSE,CN_INST);
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip);
-}
-
-U0 ICFModEqu(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 rip)
-{
- Bool dont_push_float,dont_pop_float;
- CmpSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float);
- if (tmpi->ic_flags & ICF_BY_VAL) {
- if (dont_push_float) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
- tmpi->arg1.reg,tmpi->arg1.disp,rip);
- if (tmpi->arg1_type_pointed_to!=RT_F64)
- ICFCvt2(cc,tmpi,REG_RAX,MDF_REG+RT_I64,REG_RAX,0,FALSE,rip);
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
- tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
- tmpi->arg1.reg,tmpi->arg1.disp,rip);
- if (tmpi->arg1_type_pointed_to!=RT_F64)
- ICFCvt2(cc,tmpi,REG_RDX,MDF_REG+RT_I64,REG_RDX,0,FALSE,rip);
- }
-//TODO: unpushable,unpop? Not sure
- ICCopyTemplate(cc,tmpi,CMP_TEMPLATE_MOD,FALSE,FALSE,FALSE,CN_INST);
- if (tmpi->arg1_type_pointed_to!=RT_F64)
- ICFCvt2(cc,tmpi,REG_RAX,MDF_REG+RT_I64,REG_RAX,0,TRUE,rip);
- ICMov(tmpi,tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
- tmpi->arg1.reg,tmpi->arg1.disp,MDF_REG+RT_I64,REG_RAX,0,rip);
- if (tmpi->res.type.mode)
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
- tmpi->arg1.reg,tmpi->arg1.disp,rip);
- } else {
- if (dont_push_float) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,tmpi->arg1.type,
- tmpi->arg1.reg,tmpi->arg1.disp,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- MDF_DISP+tmpi->arg1_type_pointed_to,REG_RCX,0,rip);
- if (tmpi->arg1_type_pointed_to!=RT_F64)
- ICFCvt2(cc,tmpi,REG_RAX,MDF_REG+RT_I64,REG_RAX,0,FALSE,rip);
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,tmpi->arg1.type,
- tmpi->arg1.reg,tmpi->arg1.disp,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
- MDF_DISP+tmpi->arg1_type_pointed_to,REG_RCX,0,rip);
- if (tmpi->arg1_type_pointed_to!=RT_F64)
- ICFCvt2(cc,tmpi,REG_RDX,MDF_REG+RT_I64,REG_RDX,0,FALSE,rip);
- }
-//TODO: unpushable,unpop? Not sure
- ICCopyTemplate(cc,tmpi,CMP_TEMPLATE_MOD,FALSE,FALSE,FALSE,CN_INST);
- if (tmpi->arg1_type_pointed_to!=RT_F64)
- ICFCvt2(cc,tmpi,REG_RAX,MDF_REG+RT_I64,REG_RAX,0,TRUE,rip);
- ICMov(tmpi,MDF_DISP+tmpi->arg1_type_pointed_to,REG_RCX,0,
- MDF_REG+RT_I64,REG_RAX,0,rip);
- if (tmpi->res.type.mode)
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip);
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/BackFB.HC.HTML b/public/src/Compiler/BackFB.HC.HTML deleted file mode 100644 index df8862c..0000000 --- a/public/src/Compiler/BackFB.HC.HTML +++ /dev/null @@ -1,643 +0,0 @@ - - - - - BackFB.HC - - - - - U0 ICFOpEqu(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,U8 *buf2,I64 rip)
-{//for ADD,SUB,DIV,MUL
- CICArg *arg1=&tmpi->arg1,
- *arg2=&tmpi->arg2;
- Bool dont_push_float,dont_pop_float,p1_mem;
- I64 rsp_size=0,builtin2=0,
- t1,r1,d1,t2,r2,d2;
-
- if (cc->flags&CCF_AOT_COMPILE)
- buf2=cc->aotc->rip;
-
- CmpSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float);
- if (dont_pop_float)
- throw('Compiler');
-
- if (tmpi->ic_flags & ICF_BY_VAL) {
- p1_mem=FALSE;
- if (dont_push_float) {
- if (tmpi->arg1_type_pointed_to!=RT_F64) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- arg1->type&MDG_MASK+tmpi->arg1_type_pointed_to,
- arg1->reg,arg1->disp,rip);
- ICFCvt2(cc,tmpi,REG_RAX,MDF_REG+RT_I64,REG_RAX,0,FALSE,rip);
- ICPush(tmpi,MDF_REG+RT_I64,REG_RAX,0,rip);
- t1=MDF_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=0;
- rsp_size+=8;
- } else {
- if (tmpi->arg1_type_pointed_to>=RT_I64 && arg1->type&MDG_DISP_SIB_RIP) {
- t1=arg1->type&MDG_MASK+tmpi->arg1_type_pointed_to;
- r1=arg1->reg;
- d1=arg1->disp;
- p1_mem=TRUE;
- } else {
- ICPush(tmpi,arg1->type&MDG_MASK+tmpi->arg1_type_pointed_to,
- arg1->reg,arg1->disp,rip);
- t1=MDF_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=0;
- rsp_size+=8;
- }
- }
- } else {
- if (tmpi->arg1_type_pointed_to!=RT_F64 || arg1->type&MDF_STK) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,arg2->type,
- arg2->reg,arg2->disp,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
- arg1->type&MDG_MASK+tmpi->arg1_type_pointed_to,
- arg1->reg,arg1->disp,rip);
- if (tmpi->arg1_type_pointed_to!=RT_F64)
- ICFCvt2(cc,tmpi,REG_RDX,MDF_REG+RT_I64,REG_RDX,0,FALSE,rip);
- ICU16(tmpi,0x5052); //PUSH EDX PUSH EAX
- rsp_size=16;
- t1=MDF_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=8;
- t2=MDF_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
- } else {
- if (arg2->type.raw_type>=RT_I64 && arg2->type&MDG_DISP_SIB_RIP) {
- t2=arg2->type;
- r2=arg2->reg;
- d2=arg2->disp;
- } else {
- if (arg2->type&MDF_IMM) {
- if (!(builtin2=ICBuiltInFloatConst(arg2->disp(F64)))) {
- t2=MDF_RIP_DISP32+RT_I64;
- r2=REG_RIP;
- d2=COCFloatConstFind(cc,arg2->disp(F64))+buf2;
- }
- } else {
- ICPush(tmpi,arg2->type,arg2->reg,arg2->disp,rip);
- t2=MDF_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
- rsp_size+=8;
- }
- }
- if (tmpi->arg1_type_pointed_to>=RT_I64 && arg1->type&MDG_DISP_SIB_RIP) {
- t1=arg1->type&MDG_MASK+tmpi->arg1_type_pointed_to;
- r1=arg1->reg;
- d1=arg1->disp;
- p1_mem=TRUE;
- } else {
- ICPush(tmpi,arg1->type&MDG_MASK+tmpi->arg1_type_pointed_to,
- arg1->reg,arg1->disp,rip);
- t1=MDF_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=0;
- rsp_size+=8;
- if (r2==REG_RSP+REG_RSP<<8)
- d2+=8;
- }
- }
- }
- if (!rsp_size && !(p1_mem && tmpi->arg1_type_pointed_to==RT_F64)) {
- rsp_size=8;
- ICAddRSP(tmpi,-8);
- }
- if (!dont_push_float) {
- if (builtin2)
- ICU16(tmpi,builtin2);
- else
- ICSlashOp(tmpi,t2,r2,d2,SLASH_OP_FLD,rip);
- }
- switch (op.u8[0]) {
- case 4: op=SLASH_OP_FSUBR; break;
- case 6: op=SLASH_OP_FDIVR; break;
- }
- ICSlashOp(tmpi,t1,r1,d1,op,rip);
- CmpNoteFloatOp(cc,tmpi,TRUE,FALSE,CN_INST);
- if (p1_mem && tmpi->arg1_type_pointed_to==RT_F64) {
- ICSlashOp(tmpi,t1,r1,d1,SLASH_OP_FSTP,rip);
- if (rsp_size)
- ICAddRSP(tmpi,rsp_size);
- } else {
- if (rsp_size==8)
- ICSlashOp(tmpi,MDF_SIB+RT_I64,REG_RSP+REG_RSP<<8,0,SLASH_OP_FSTP,rip);
- else if (rsp_size>8) {
- ICSlashOp(tmpi,MDF_SIB+RT_I64,REG_RSP+REG_RSP<<8,rsp_size-8,
- SLASH_OP_FSTP,rip);
- ICAddRSP(tmpi,rsp_size-8);
- }
- if (tmpi->arg1_type_pointed_to!=RT_F64) {
- ICPop(tmpi,MDF_REG+RT_I64,REG_RAX,0,rip);
- ICFCvt2(cc,tmpi,REG_RAX,MDF_REG+RT_I64,REG_RAX,0,TRUE,rip);
- ICMov(tmpi,arg1->type&MDG_MASK+tmpi->arg1_type_pointed_to,arg1->reg,
- arg1->disp,MDF_REG+RT_I64,REG_RAX,0,rip);
- } else
- ICPop(tmpi,arg1->type&MDG_MASK+tmpi->arg1_type_pointed_to,
- arg1->reg,arg1->disp,rip);
- }
- if (tmpi->res.type.mode)
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- arg1->type&MDG_MASK+tmpi->arg1_type_pointed_to,
- arg1->reg,arg1->disp,rip);
- } else {
- if (tmpi->arg1_type_pointed_to>=RT_I64)
- p1_mem=TRUE;
- else
- p1_mem=FALSE;
- if (dont_push_float) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,arg1->type,arg1->reg,arg1->disp,rip);
- if (tmpi->arg1_type_pointed_to!=RT_F64) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- MDF_DISP+tmpi->arg1_type_pointed_to,REG_RCX,0,rip);
- ICFCvt2(cc,tmpi,REG_RAX,MDF_REG+RT_I64,REG_RAX,0,FALSE,rip);
- ICPush(tmpi,MDF_REG+RT_I64,REG_RAX,0,rip);
- } else
- ICPush(tmpi,MDF_DISP+tmpi->arg1_type_pointed_to,REG_RCX,0,rip);
- t1=MDF_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=0;
- rsp_size+=8;
- } else {
- if (tmpi->arg1_type_pointed_to!=RT_F64 || arg1->type&MDF_STK) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,arg2->type,
- arg2->reg,arg2->disp,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,arg1->type,
- arg1->reg,arg1->disp,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
- MDF_DISP+tmpi->arg1_type_pointed_to,REG_RCX,0,rip);
- if (tmpi->arg1_type_pointed_to!=RT_F64)
- ICFCvt2(cc,tmpi,REG_RDX,MDF_REG+RT_I64,REG_RDX,0,FALSE,rip);
- ICU16(tmpi,0x5052); //PUSH EDX PUSH EAX
- rsp_size=16;
- t1=MDF_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=8;
- t2=MDF_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
- } else {
- if (arg2->type.raw_type>=RT_I64 && arg2->type&MDG_DISP_SIB_RIP) {
- t2=arg2->type;
- r2=arg2->reg;
- d2=arg2->disp;
- } else {
- if (arg2->type&MDF_IMM) {
- if (!(builtin2=ICBuiltInFloatConst(arg2->disp(F64)))) {
- t2=MDF_RIP_DISP32+RT_I64;
- r2=REG_RIP;
- d2=COCFloatConstFind(cc,arg2->disp(F64))+buf2;
- }
- } else {
- ICPush(tmpi,arg2->type,arg2->reg,arg2->disp,rip);
- t2=MDF_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
- rsp_size+=8;
- }
- }
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,arg1->type,
- arg1->reg,arg1->disp,rip);
- ICPush(tmpi,MDF_DISP+tmpi->arg1_type_pointed_to,REG_RCX,0,rip);
- t1=MDF_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=0;
- rsp_size+=8;
- if (r2==REG_RSP+REG_RSP<<8)
- d2+=8;
- }
- }
- if (!rsp_size && !(p1_mem && tmpi->arg1_type_pointed_to==RT_F64)) {
- rsp_size=8;
- ICAddRSP(tmpi,-8);
- }
- if (!dont_push_float) {
- if (builtin2)
- ICU16(tmpi,builtin2);
- else
- ICSlashOp(tmpi,t2,r2,d2,SLASH_OP_FLD,rip);
- }
-
- switch (op.u8[0]) {
- case 4: op=SLASH_OP_FSUBR; break;
- case 6: op=SLASH_OP_FDIVR; break;
- }
- ICSlashOp(tmpi,t1,r1,d1,op,rip);
- CmpNoteFloatOp(cc,tmpi,TRUE,FALSE,CN_INST);
- if (p1_mem && tmpi->arg1_type_pointed_to==RT_F64) {
- ICSlashOp(tmpi,MDF_DISP+tmpi->arg1_type_pointed_to,
- REG_RCX,0,SLASH_OP_FSTP,rip);
- if (rsp_size)
- ICAddRSP(tmpi,rsp_size);
- } else {
- if (rsp_size==8)
- ICSlashOp(tmpi,MDF_SIB+RT_I64,REG_RSP+REG_RSP<<8,0,SLASH_OP_FSTP,rip);
- else if (rsp_size>8) {
- ICSlashOp(tmpi,MDF_SIB+RT_I64,REG_RSP+REG_RSP<<8,rsp_size-8,
- SLASH_OP_FSTP,rip);
- ICAddRSP(tmpi,rsp_size-8);
- }
- ICPop(tmpi,MDF_REG+RT_I64,REG_RAX,0,rip);
- if (tmpi->arg1_type_pointed_to!=RT_F64)
- ICFCvt2(cc,tmpi,REG_RAX,MDF_REG+RT_I64,REG_RAX,0,TRUE,rip);
- ICMov(tmpi,MDF_DISP+tmpi->arg1_type_pointed_to,REG_RCX,0,
- MDF_REG+RT_I64,REG_RAX,0,rip);
- }
- if (tmpi->res.type.mode)
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip);
- }
-}
-
-U0 ICFCmpAndBranch(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 rip,
- I64 us,I64 not_us,U8 *buf,I64 rip2)
-{
- CICArg *arg1,*arg2;
- Bool dont_push_float,dont_pop_float,alt,short_jmp;
- I64 i,rsp_size=0,builtin1=0,builtin2=0,t1,r1,d1,t2,r2,d2;
- CCodeMisc *lb;
- U8 *buf2;
-
- if (tmpi->ic_flags&ICF_ALT_TEMPLATE) {
- arg1=&tmpi->arg2;
- arg2=&tmpi->arg1;
- alt=TRUE;
- } else {
- arg1=&tmpi->arg1;
- arg2=&tmpi->arg2;
- alt=FALSE;
- }
-
- if (cc->flags&CCF_AOT_COMPILE)
- buf2=cc->aotc->rip;
- else
- buf2=buf;
-
- CmpSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float);
- if (dont_push_float) {
- if (tmpi->ic_flags&ICF_POP_CMP && alt) {
- t2=MDF_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
- rsp_size+=8;
- } else {
- if (arg2->type.raw_type>=RT_I64 && arg2->type&MDG_DISP_SIB_RIP) {
- t2=arg2->type;
- r2=arg2->reg;
- d2=arg2->disp;
- } else {
- if (arg2->type&MDF_IMM) {
- if (!(builtin2=ICBuiltInFloatConst(arg2->disp(F64))) ||
- tmpi->ic_flags&ICF_PUSH_CMP) {
- t2=MDF_RIP_DISP32+RT_I64;
- r2=REG_RIP;
- d2=COCFloatConstFind(cc,arg2->disp(F64))+buf2;
- }
- } else {
- ICPush(tmpi,arg2->type,arg2->reg,arg2->disp,rip2);
- t2=MDF_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
- rsp_size+=8;
- }
- }
- }
- } else {
- if (alt) {
- if (!(arg2->type&MDF_STK)) {
- if (tmpi->ic_flags&ICF_POP_CMP) {
- t1=MDF_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=0;
- rsp_size+=8;
- } else {
- if (arg1->type.raw_type>=RT_I64 && arg1->type&MDG_DISP_SIB_RIP) {
- t1=arg1->type;
- r1=arg1->reg;
- d1=arg1->disp;
- } else {
- if (arg1->type&MDF_IMM) {
- if (!(builtin1=ICBuiltInFloatConst(arg1->disp(F64)))) {
- t1=MDF_RIP_DISP32+RT_I64;
- r1=REG_RIP;
- d1=COCFloatConstFind(cc,arg1->disp(F64))+buf2;
- }
- } else {
- ICPush(tmpi,arg1->type,arg1->reg,arg1->disp,rip2);
- t1=MDF_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=0;
- rsp_size+=8;
- }
- }
- }
- if (arg2->type.raw_type>=RT_I64 && arg2->type&MDG_DISP_SIB_RIP) {
- t2=arg2->type;
- r2=arg2->reg;
- d2=arg2->disp;
- } else {
- if (arg2->type&MDF_IMM) {
- if (!(builtin2=ICBuiltInFloatConst(arg2->disp(F64))) ||
- tmpi->ic_flags&ICF_PUSH_CMP) {
- t2=MDF_RIP_DISP32+RT_I64;
- r2=REG_RIP;
- d2=COCFloatConstFind(cc,arg2->disp(F64))+buf2;
- }
- } else {
- ICPush(tmpi,arg2->type,arg2->reg,arg2->disp,rip2);
- t2=MDF_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
- rsp_size+=8;
- if (r1==REG_RSP+REG_RSP<<8)
- d1+=8;
- }
- }
- } else {
- if (tmpi->ic_flags&ICF_POP_CMP)
- ICPopRegs(tmpi,1<<REG_RDX);
- else
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,arg1->type,
- arg1->reg,arg1->disp,rip2);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,arg2->type,
- arg2->reg,arg2->disp,rip2);
- ICU16(tmpi,0x5052); //PUSH EDX PUSH EAX
- rsp_size=16;
- t1=MDF_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=8;
- t2=MDF_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
- }
- } else {
- if (!(arg1->type&MDF_STK)) {
- if (arg2->type.raw_type>=RT_I64 && arg2->type&MDG_DISP_SIB_RIP) {
- t2=arg2->type;
- r2=arg2->reg;
- d2=arg2->disp;
- } else {
- if (arg2->type&MDF_IMM) {
- if (!(builtin2=ICBuiltInFloatConst(arg2->disp(F64))) ||
- tmpi->ic_flags&ICF_PUSH_CMP) {
- t2=MDF_RIP_DISP32+RT_I64;
- r2=REG_RIP;
- d2=COCFloatConstFind(cc,arg2->disp(F64))+buf2;
- }
- } else {
- ICPush(tmpi,arg2->type,arg2->reg,arg2->disp,rip2);
- t2=MDF_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
- rsp_size+=8;
- }
- }
- if (tmpi->ic_flags&ICF_POP_CMP) {
- t1=MDF_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=0;
- rsp_size+=8;
- if (r2==REG_RSP+REG_RSP<<8)
- d1+=8;
- } else {
- if (arg1->type.raw_type>=RT_I64 && arg1->type&MDG_DISP_SIB_RIP) {
- t1=arg1->type;
- r1=arg1->reg;
- d1=arg1->disp;
- } else {
- if (arg1->type&MDF_IMM) {
- if (!(builtin1=ICBuiltInFloatConst(arg1->disp(F64)))) {
- t1=MDF_RIP_DISP32+RT_I64;
- r1=REG_RIP;
- d1=COCFloatConstFind(cc,arg1->disp(F64))+buf2;
- }
- } else {
- ICPush(tmpi,arg1->type,arg1->reg,arg1->disp,rip2);
- t1=MDF_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=0;
- rsp_size+=8;
- if (r2==REG_RSP+REG_RSP<<8)
- d2+=8;
- }
- }
- }
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,arg2->type,
- arg2->reg,arg2->disp,rip2);
- if (tmpi->ic_flags&ICF_POP_CMP)
- ICPopRegs(tmpi,1<<REG_RDX);
- else
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,arg1->type,
- arg1->reg,arg1->disp,rip2);
- ICU16(tmpi,0x5052); //PUSH EDX PUSH EAX
- rsp_size=16;
- t1=MDF_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=8;
- t2=MDF_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
- }
- }
- }
- if (!dont_push_float) {
- if (builtin1)
- ICU16(tmpi,builtin1);
- else
- ICSlashOp(tmpi,t1,r1,d1,SLASH_OP_FLD,rip2);
- }
- if (!alt)
- us=not_us;
- if (builtin2)
- ICU16(tmpi,builtin2);
- else
- ICSlashOp(tmpi,t2,r2,d2,SLASH_OP_FLD,rip2);
- if (tmpi->ic_flags&ICF_PUSH_CMP) {
- t2=MDF_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
- if (!rsp_size) {
- rsp_size=8;
- ICAddRSP(tmpi,-8);
- } else if (rsp_size==16)
- d2=8;
-
- if (alt) {
- ICU16(tmpi,0xF1DF); //FCOMIP
- ICSlashOp(tmpi,t2,r2,d2,SLASH_OP_FSTP,rip2);
- } else {
- ICU16(tmpi,0xF1DB); //FCOMI
- ICSlashOp(tmpi,t2,r2,d2,SLASH_OP_FSTP,rip2);
- ICU32(tmpi,0xF7D9C0DD); //FFREE,FINCSTP
- }
- } else {
- ICU16(tmpi,0xF1DF); //FCOMIP
- ICU32(tmpi,0xF7D9C0DD); //FFREE,FINCSTP
- }
- CmpNoteFloatOp(cc,tmpi,TRUE,FALSE,CN_INST);
-
- if (tmpi->ic_flags&ICF_PUSH_CMP) {
- if (r2.u8[0]==REG_RSP) {
- while (d2 && rsp_size) {
- ICU8(tmpi,0x5B); //POP RBX (Dont change flags)
- rsp_size-=8;
- d2-=8;
- }
- } else {
- while (rsp_size) {
- ICU8(tmpi,0x5B); //POP RBX (Dont change flags)
- rsp_size-=8;
- }
- ICPush(tmpi,t2,r2,d2,rip2);
- }
- } else {
- while (rsp_size) {
- ICU8(tmpi,0x5B); //POP RBX (Dont change flags)
- rsp_size-=8;
- }
- }
-
- rip+=tmpi->ic_cnt;
- lb=OptLabelFwd(tmpi->ic_data);
- short_jmp=ToBool(tmpi->ic_flags&ICF_SHORT_JMP);
- if (!buf && lb->addr!=INVALID_PTR) {
- i=lb->addr-(rip+2);
- if (lb->flags&CMF_POP_CMP) {
- if(tmpi->ic_flags&ICF_PUSH_CMP)
- i+=4;
- else
- i+=8;
- }
- if (I8_MIN<=i<=I8_MAX)
- short_jmp=TRUE;
- }
-
- if (short_jmp) {
- tmpi->ic_flags|=ICF_SHORT_JMP;
- i=lb->addr-(rip+2);
- if (lb->flags&CMF_POP_CMP) {
- if(tmpi->ic_flags&ICF_PUSH_CMP)
- i+=4;
- else
- i+=8;
- }
- ICU16(tmpi,i<<8+us.u8[2]);
- } else {
- tmpi->ic_flags&=~ICF_SHORT_JMP;
- i=lb->addr-(rip+6);
- if (lb->flags&CMF_POP_CMP) {
- if(tmpi->ic_flags&ICF_PUSH_CMP)
- i+=4;
- else
- i+=8;
- }
- ICU16(tmpi,us.u16[0]);
- ICU32(tmpi,i);
- }
-}
-
-U0 ICFMul(CCmpCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip)
-{
- if (tmpi->arg1.type&MDF_IMM && tmpi->arg1.type&RTG_MASK==RT_F64 &&
- tmpi->arg1.disp(F64)==1.0) {
- CmpNoteFloatOp(cc,tmpi,FALSE,FALSE,CN_INST);
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- } else if (tmpi->arg2.type&MDF_IMM &&
- tmpi->arg2.type&RTG_MASK==RT_F64&& tmpi->arg2.disp(F64)==1.0) {
- CmpNoteFloatOp(cc,tmpi,FALSE,FALSE,CN_INST);
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- } else
- ICFOp(cc,tmpi,SLASH_OP_FMUL,buf,rip);
-}
-
-U0 ICFDiv(CCmpCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip)
-{
- if (tmpi->arg2.type&MDF_IMM && tmpi->arg2.type&RTG_MASK==RT_F64 &&
- tmpi->arg2.disp(F64)==1.0) {
- CmpNoteFloatOp(cc,tmpi,FALSE,FALSE,CN_INST);
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- } else
- ICFOp(cc,tmpi,SLASH_OP_FDIV,buf,rip);
-}
-
-U0 ICFAdd(CCmpCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip)
-{
- Bool dont_push_float,dont_pop_float;
- CmpSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float);
- if (tmpi->arg1.type&MDF_IMM && !tmpi->arg1.disp) {
- if (dont_push_float) {
- ICCopyTemplate(cc,tmpi,CMP_TEMPLATE_FSTP,FALSE,TRUE,TRUE,CN_INST);
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip);
- } else if (dont_pop_float) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- ICCopyTemplate(cc,tmpi,CMP_TEMPLATE_FLD,FALSE,TRUE,TRUE,CN_INST);
- } else {
- CmpNoteFloatOp(cc,tmpi,TRUE,TRUE,CN_INST);
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
- }
- } else if (tmpi->arg2.type&MDF_IMM && !tmpi->arg2.disp) {
- if (dont_push_float) {
- ICCopyTemplate(cc,tmpi,CMP_TEMPLATE_FSTP,FALSE,TRUE,TRUE,CN_INST);
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip);
- } else if (dont_pop_float) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- ICCopyTemplate(cc,tmpi,CMP_TEMPLATE_FLD,FALSE,TRUE,TRUE,CN_INST);
- } else {
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- CmpNoteFloatOp(cc,tmpi,TRUE,TRUE,CN_INST);
- }
- } else
- ICFOp(cc,tmpi,SLASH_OP_FADD,buf,rip);
-}
-
-U0 ICFSub(CCmpCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip)
-{
- Bool dont_push_float,dont_pop_float;
- if (tmpi->arg2.type&MDF_IMM && !tmpi->arg2.disp) {
- CmpSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float);
- if (dont_push_float) {
- ICCopyTemplate(cc,tmpi,CMP_TEMPLATE_FSTP,FALSE,TRUE,TRUE,CN_INST);
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip);
- } else if (dont_pop_float) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- ICCopyTemplate(cc,tmpi,CMP_TEMPLATE_FLD,FALSE,TRUE,TRUE,CN_INST);
- } else {
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- CmpNoteFloatOp(cc,tmpi,TRUE,TRUE,CN_INST);
- }
- } else
- ICFOp(cc,tmpi,SLASH_OP_FSUB,buf,rip);
-}
-
-U0 ICFPreIncDec(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,I64 rip)
-{
- if (tmpi->ic_flags & ICF_BY_VAL) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type&MDG_MASK+RT_I64,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- ICCopyTemplate(cc,tmpi,op,FALSE,TRUE,TRUE,CN_INST);
- ICMov(tmpi,tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip);
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,MDF_DISP+RT_I64,REG_RCX,0,rip);
- ICCopyTemplate(cc,tmpi,op,FALSE,TRUE,TRUE,CN_INST);
- ICMov(tmpi,MDF_DISP+RT_I64,REG_RCX,0,MDF_REG+RT_I64,REG_RAX,0,rip);
- }
- if (tmpi->res.type.mode)
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip);
-}
-
-U0 ICFPostIncDec(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,I64 rip)
-{
- if (tmpi->ic_flags & ICF_BY_VAL) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type&MDG_MASK+RT_I64,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- if (tmpi->res.type.mode)
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,MDF_REG+RT_I64,REG_RAX,0,rip);
- ICCopyTemplate(cc,tmpi,op,FALSE,TRUE,TRUE,CN_INST);
- ICMov(tmpi,tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip);
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,MDF_DISP+RT_I64,REG_RCX,0,rip);
- if (tmpi->res.type.mode)
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,MDF_REG+RT_I64,REG_RAX,0,rip);
- ICCopyTemplate(cc,tmpi,op,FALSE,TRUE,TRUE,CN_INST);
- ICMov(tmpi,MDF_DISP+RT_I64,REG_RCX,0,MDF_REG+RT_I64,REG_RAX,0,rip);
- }
- if (tmpi->res.type.mode)
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RDX,0,rip);
-}
-
-U0 ICFTemplateFun(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,I64 rip)
-{
- Bool dont_push_float,dont_pop_float;
-
- CmpSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float);
- if (!dont_push_float)
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
-
- ICCopyTemplate(cc,tmpi,op,FALSE,TRUE,TRUE,CN_INST);
- if (tmpi->res.type.mode && !(tmpi->ic_flags & ICF_RES_TO_F64) &&
- !(tmpi->ic_flags & ICF_RES_TO_INT))
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip);
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/BackLib.HC.HTML b/public/src/Compiler/BackLib.HC.HTML deleted file mode 100644 index 188fed5..0000000 --- a/public/src/Compiler/BackLib.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - BackLib.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Compiler/CExcept.HC.HTML b/public/src/Compiler/CExcept.HC.HTML deleted file mode 100644 index 58eeaf1..0000000 --- a/public/src/Compiler/CExcept.HC.HTML +++ /dev/null @@ -1,265 +0,0 @@ - - - - - CExcept.HC - - - - - U0 LexPutToken(CCmpCtrl *cc)
-{//Print cur token to StdOut. (Crude)
- '"';
- if (cc->token==TK_IDENT || cc->token==TK_STR)
- "%s",cc->cur_str;
- else if (cc->token==TK_I64)
- "INT:%X",cc->cur_i64;
- else if (cc->token==TK_CHAR_CONST)
- "U8:%X",cc->cur_i64;
- else if (cc->token==TK_F64)
- "FLOAT:%e",cc->cur_f64;
- else if (cc->token=='\n')
- "<NEW_LINE>";
- else if (Bt(char_bmp_displayable,cc->token))
- '' cc->token;
- else {
- "T:%X",cc->token;
- }
- "\" ";
-}
-
-U8 *LexPutLine(CCmpCtrl *cc,U8 *start)
-{//Print cur pos to end of line to StdOut.
- I64 ch;
- U8 *ptr;
- if (!start) return NULL;
- if (cc->lex_include_stk->flags&LFSF_DOC)
- return DocPutLine(cc->lex_include_stk->doc,start);
- else {
- ptr=start;
- while (ch=*ptr++) {
- if (ch=='\n') {
- if (*ptr=='\r')
- ptr++;
- break;
- } else if (ch=='\r') {
- if (*ptr=='\n')
- ptr++;
- break;
- }
- '' ch;
- }
- if (!ch) ptr--;
- '\n';
- return ptr;
- }
- return NULL;
-}
-
-U0 LexPutPos(CCmpCtrl *cc)
-{//Print token, line link and, then, LexPutLine().
- LexPutToken(cc);
- FixSet(cc->lex_include_stk->full_name,cc->lex_include_stk->line_num);
- if (IsRaw)
- "%s,%d ",cc->lex_include_stk->full_name,cc->lex_include_stk->line_num;
- else {
- PutFileLink(cc->lex_include_stk->full_name,,cc->lex_include_stk->line_num);
- AdamErr("%s,%d\n",
- cc->lex_include_stk->full_name,cc->lex_include_stk->line_num);
- '' CH_SPACE;
- }
- LexPutLine(cc,cc->lex_include_stk->line_start);
-}
-
-U0 LexWarn(CCmpCtrl *cc,U8 *str=NULL)
-{//Print warn msg, then, LexPutPos().
- if (str) PrintWarn(str);
- if (cc->htc.fun) {
- "in fun '%s'.\n",cc->htc.fun->str;
- if (IsRaw)
- "%s\n",cc->htc.fun->src_link;
- else {
- "$LK,\"%s\"$\n",cc->htc.fun->src_link;
- AdamErr("%s\n",cc->htc.fun->src_link);
- }
- } else
- LexPutPos(cc);
- cc->warning_cnt++;
-}
-
-U0 LexExcept(CCmpCtrl *cc,U8 *str=NULL)
-{//Print err msg, LexPutPos() and throw exception.
- if (!Bt(&sys_run_level,RLf_ADAM_SERVER)) {
- Raw(ON);
- "Note: Still in boot phase.\n";
- }
- if (str) PrintErr(str);
- if (!IsRaw)
- AdamErr("Task:%08X %s\n",Fs,str);
- LexPutPos(cc);
- cc->error_cnt++;
- FlushMsgs;
- if (!Bt(&sys_run_level,RLf_ADAM_SERVER))
- Dbg("Type \"Fix;\"");
- throw('Compiler');
-}
-
-U0 UndefinedExtern()
-{
- PrintErr("Undefined Extern\nat %P\n",Caller);
- throw('UndefExt');
-}
-
-U0 UnusedExternWarning(CCmpCtrl *cc,CHashClass *tmpc)
-{
- PrintWarn("Unused extern '%s'\n",tmpc->str);
- cc->warning_cnt++;
-}
-
-U0 ParenWarning(CCmpCtrl *cc)
-{
- if (Bt(&cc->opts,OPTf_WARN_PAREN) &&
- !(cc->lex_include_stk->flags&LFSF_DEFINE))
- LexWarn(cc,"Unnecessary parenthesis ");
-}
-
-U0 ICClassPut(CHashClass *c)
-{
- I64 i;
- if (!c) return;
- if (c->ptr_stars_cnt>4) {
- PrintErr("put_class ptrcnt=%d\n",c->ptr_stars_cnt);
- while (TRUE)
-//TODO:
- Yield;
- }
- for (i=0;i<c->ptr_stars_cnt;i++)
- '*';
- c-=c->ptr_stars_cnt;
- if (c->str)
- "%s",c->str;
- else {
- PrintErr("put_class str=NULL\n");
- while (TRUE)
-//TODO:
- Yield;
- }
- '' CH_SPACE;
-}
-
-U0 ICArgPut(CICArg *a,I64 type_pointed_to)
-{
- if (type_pointed_to)
- "[%Z](%Z) %Z ",a->type.raw_type,"ST_RAW_TYPES",
- type_pointed_to,"ST_RAW_TYPES",Bsr(a->type>>8)+1,"ST_TY_TYPES";
- else
- "%Z %Z ",a->type.raw_type,"ST_RAW_TYPES",
- Bsr(a->type>>8)+1,"ST_TY_TYPES";
- switch (Bsr(a->type)) {
- case MDf_STK:
- "STK";
- break;
- case MDf_IMM:
- "#%X",a->disp;
- break;
- case MDf_REG:
- "%Z",a->reg,"ST_U64_REGS";
- break;
- case MDf_DISP:
- "%X[%Z]",a->disp,a->reg,"ST_U64_REGS";
- break;
- case MDf_RIP_DISP32:
- "[%X]",a->disp;
- break;
- case MDf_SIB:
- if (a->disp)
- "%X",a->disp;
- if (a->reg==REG_RIP)
- '[';
- else
- "[%Z+",a->reg&15,"ST_U64_REGS";
- "%Z",a->reg>>8&15,"ST_U64_REGS";
- switch (a->reg>>14) {
- case 0: "]"; break;
- case 1: "*2]"; break;
- case 2: "*4]"; break;
- case 3: "*8]"; break;
- }
- break;
- }
- '' CH_SPACE;
-}
-
-U0 ICPut(CCmpCtrl *cc,CIntermediateCode *tmpi)
-{
- I64 opcode=tmpi->ic_code,i;
- if (opcode>=IC_END_EXP && opcode!=IC_NOP2) {
- "%15ts %016X ",intermediate_code_table[opcode].name,tmpi->ic_data;
- if (cc->pass) {
- if (tmpi->res.type.mode) {
- "$PURPLE$RES:$FG$";
- ICArgPut(&tmpi->res,0);
- }
- if (tmpi->arg1.type.mode) {
- "$PURPLE$ARG1:$FG$";
- if (intermediate_code_table[tmpi->ic_code].type==IST_DEREF ||
- intermediate_code_table[tmpi->ic_code].type==IST_ASSIGN)
- ICArgPut(&tmpi->arg1,tmpi->arg1_type_pointed_to);
- else
- ICArgPut(&tmpi->arg1,0);
- }
- if (tmpi->arg2.type.mode) {
- "$PURPLE$ARG2:$FG$";
- ICArgPut(&tmpi->arg2,0);
- }
- "$PURPLE$:$FG$";
- }
- ICClassPut(tmpi->ic_class);
- if (tmpi->ic_flags & ICF_LOCK)
- "$BROWN$lock$FG$ ";
- if (tmpi->ic_flags & ICF_ARG2_TO_F64)
- "$LTBLUE$a2d$FG$ ";
- if (tmpi->ic_flags & ICF_ARG2_TO_INT)
- "$GREEN$a2i$FG$ ";
- if (tmpi->ic_flags & ICF_ARG1_TO_F64)
- "$LTBLUE$a1d$FG$ ";
- if (tmpi->ic_flags & ICF_ARG1_TO_INT)
- "$GREEN$a1i$FG$ ";
- if (tmpi->ic_flags & ICF_RES_TO_F64)
- "$LTBLUE$rd$FG$ ";
- if (tmpi->ic_flags & ICF_RES_TO_INT)
- "$GREEN$ri$FG$ ";
- if (tmpi->ic_flags & ICF_USE_F64)
- "[F64] ";
- if (tmpi->ic_flags & ICF_USE_UNSIGNED)
- "[unsigned] ";
- if (tmpi->ic_flags & ICF_USE_INT)
- "[int] ";
- if (tmpi->ic_flags & ICF_RES_NOT_USED)
- "NO_RES ";
- if (tmpi->ic_flags & ICF_BY_VAL)
- "BY_VAL ";
- if (tmpi->ic_flags & ICF_PUSH_RES)
- "PUSH ";
- if (tmpi->ic_flags & ICF_PUSH_CMP)
- "PUSH_CMP ";
- if (tmpi->ic_flags & ICF_POP_CMP)
- "POP_CMP ";
- if (tmpi->ic_flags & ICF_DEL_PREV_INS)
- "DEL_PREV ";
- if (tmpi->ic_flags & ICF_PREV_DELETED)
- "PREV_DEL ";
- for (i=0;i<3;i++) {
- if (Bt(&tmpi->ic_flags,ICf_DONT_PUSH_FLOAT0+i))
- "DONT_PUSH#%d ",i;
- if (Bt(&tmpi->ic_flags,ICf_DONT_POP_FLOAT0+i))
- "DONT_POP#%d ",i;
- }
- if (tmpi->ic_flags & ICF_ALT_TEMPLATE)
- "ALT_TMP ";
- '\n';
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/CExts.HC.HTML b/public/src/Compiler/CExts.HC.HTML deleted file mode 100644 index eec626b..0000000 --- a/public/src/Compiler/CExts.HC.HTML +++ /dev/null @@ -1,58 +0,0 @@ - - - - - CExts.HC - - - - - import U8 *Doc2PlainText(CDoc *doc,CDocEntry *doc_e);
-import U0 DocBinsValidate(CDoc *doc);
-import U0 DocDel(CDoc *doc);
-import U0 DocLoad(CDoc *doc,U8 *src2,I64 size);
-import CDoc *DocNew(U8 *filename=NULL,CTask *task=NULL);
-import CDocEntry *DocPrint(CDoc *doc=NULL,U8 *fmt,...);
-import CDocEntry *DocPutLine(CDoc *doc,CDocEntry *doc_e);
-import I64 DocSize(CDoc *doc);
-import Bool DocWrite(CDoc *doc,Bool prompt=FALSE);
-extern U8 *CmdLinePmt();
-extern I64 HashEntrySize2(CHashSrcSym *tmph);
-extern Bool IsLexExpression2Bin(CCmpCtrl *cc,U8 **_machine_code);
-extern I64 Lex(CCmpCtrl *cc);
-extern I64 LexExpression(CCmpCtrl *cc);
-extern I64 LexGetChar(CCmpCtrl *cc);
-extern CCodeMisc *OptLabelFwd(CCodeMisc *lb);
-extern CIntermediateCode *OptPass012(CCmpCtrl *cc);
-extern U0 OptPass3(CCmpCtrl *cc,COptReg *reg_offsets);
-extern U0 OptPass4(CCmpCtrl *cc,COptReg *reg_offsets,I64 *_type);
-extern U0 OptPass5(CCmpCtrl *cc);
-extern U0 OptPass6(CCmpCtrl *cc);
-extern I64 OptPass789A(
- CCmpCtrl *cc,COptReg *reg_offsets,U8 *buf,CDbgInfo **_dbg);
-extern CHashClass *PrsClass(
- CCmpCtrl *cc,I64 keyword,I64 fsp_flags,Bool is_extern);
-extern CHashFun *PrsFunJoin(
- CCmpCtrl *cc,CHashClass *tmp_return,U8 *name,I64 fsp_flags);
-extern I64 PrsKeyWord(CCmpCtrl *cc);
-extern Bool PrsStmt(CCmpCtrl *cc,I64 try_cnt=0,
- CCodeMisc *lb_break=NULL,I64 cmp_flags=CMPF_PRS_SEMICOLON);
-extern U0 PrsStreamBlk(CCmpCtrl *cc);
-extern CHashClass *PrsType(CCmpCtrl *cc,CHashClass **_tmpc1,
- I64 *_mode,CMemberLst *tmpm,U8 **_ident,CHashFun **_fun_ptr,
- CHashExport **_tmpex,CArrayDim *tmpad,I64 fsp_flags);
-extern I64 PrsUnaryModifier(CCmpCtrl *cc,CPrsStk *ps,
- CMemberLst **_local_var,CArrayDim **_tmpad,I64 *unary_post_prec);
-extern I64 PrsUnaryTerm(
- CCmpCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,CArrayDim **_tmpad,
- I64 *max_prec,I64 *unary_pre_prec,I64 *paren_prec);
-extern U0 PrsVarInit2(CCmpCtrl *cc,U8 **_dst,CHashClass *tmpc,
- CArrayDim *tmpad,U8 *data_addr_rip,U8 **_base,Bool data_heap,I64 pass);
-_extern CMP_TEMPLATES U32 cmp_templates[1];
-_extern CMP_TEMPLATES_DONT_POP U32 cmp_templates_dont_pop[1];
-_extern CMP_TEMPLATES_DONT_PUSH2 U32 cmp_templates_dont_push2[1];
-_extern CMP_TEMPLATES_DONT_PUSH U32 cmp_templates_dont_push[1];
-_extern CMP_TEMPLATES_DONT_PUSH_POP U32 cmp_templates_dont_push_pop[1];
- - - \ No newline at end of file diff --git a/public/src/Compiler/CHash.HC.HTML b/public/src/Compiler/CHash.HC.HTML deleted file mode 100644 index b0bdec8..0000000 --- a/public/src/Compiler/CHash.HC.HTML +++ /dev/null @@ -1,153 +0,0 @@ - - - - - CHash.HC - - - - - I64 HashEntrySize(CHashSrcSym *tmph)
-{//Logical size of a std system hash entry.
- CDbgInfo *dbg_info;
- CBinFile *bfh;
- switch (HashTypeNum(tmph)) {
- case HTt_DEFINE_STR:
- return MSize(tmph(CHashDefineStr *)->data);
- case HTt_GLBL_VAR:
- case HTt_CLASS:
- case HTt_INTERNAL_TYPE:
- return tmph(CHashClass *)->size;
- case HTt_FUN:
- if (dbg_info=tmph->dbg_info)
- return dbg_info->body[dbg_info->max_line+1-dbg_info->min_line]
- -dbg_info->body[0];
- else
- return -1;
- case HTt_FILE:
- return MSize(tmph(CHashGeneric *)->user_data0);
- case HTt_MODULE:
- if (StrCmp(tmph->str,KERNEL_MODULE_NAME))
- return MSize(tmph(CHashGeneric *)->user_data0);
- else {
- bfh=mem_boot_base-sizeof(CBinFile);
- return bfh->file_size;
- }
- case HTt_WORD:
- return StrLen(tmph->str);
- }
- return -1;
-}
-
-I64 HashEntrySize2(CHashSrcSym *tmph)
-{//Memory size of a std system hash entry.
- CDbgInfo *dbg_info;
- I64 res=MSize2(tmph);
- if (!(tmph->type&HTT_DICT_WORD))
- res+=MSize2(tmph->str);
- if (tmph->type & HTG_SRC_SYM) {
- res+=MSize2(tmph->src_link);
- res+=MSize2(tmph->idx);
- res+=MSize2(tmph->import_name);
- res+=LinkedLstSize(tmph->ie_lst);
- if (tmph->type & (HTT_FUN | HTT_EXPORT_SYS_SYM))
- res+=MSize2(tmph->dbg_info);
- if (tmph->type & HTT_CLASS)
- res+=MemberLstSize(tmph);
- else if (tmph->type & HTT_FUN) {
- res+=MemberLstSize(tmph);
- if (dbg_info=tmph->dbg_info)
-//This should be MSize() but it would crash on AOT .BIN.Z file funs.
- res+=dbg_info->body[dbg_info->max_line+1-dbg_info->min_line]
- -dbg_info->body[0];
- } else if (tmph->type&HTT_DEFINE_STR)
- res+=MSize2(tmph(CHashDefineStr *)->data);
- else if (tmph->type & HTT_GLBL_VAR) {
- res+=LinkedLstSize(tmph(CHashGlblVar *)->dim.next);
- if (!(tmph(CHashGlblVar *)->flags&GVF_ALIAS))
- res+=MSize2(tmph(CHashGlblVar *)->data_addr);
- if (tmph(CHashGlblVar *)->fun_ptr)
- res+=HashEntrySize2(tmph(CHashGlblVar *)->fun_ptr
- -tmph(CHashGlblVar *)->fun_ptr->ptr_stars_cnt);
- }
- } else if (tmph->type & HTT_FILE)
- res+=MSize2(tmph(CHashGeneric *)->user_data0);
- else if (tmph->type & HTT_MODULE &&
- StrCmp(tmph->str,KERNEL_MODULE_NAME))
- res+=MSize2(tmph(CHashGeneric *)->user_data0);
- return res;
-}
-
-I64 HashTableSize2(CHashTable *table)
-{//Memory size of std system hash table and all entries.
- I64 i,res=0;
- CHashSrcSym *tmph;
- if (!table)
- return 0;
- for (i=0;i<=table->mask;i++) {
- tmph=table->body[i];
- while (tmph) {
- res+=HashEntrySize2(tmph);
- tmph=tmph->next;
- }
- }
- res+=MSize2(table->body);
- res+=MSize2(table);
- return res;
-}
-
-U0 MapFileWrite(CHashTable *h,U8 *map_name,U8 drv_let)
-{
- CHashSrcSym *tmph;
- I64 i,size;
- U8 *src_link;
- CDoc *doc;
- CDocBin *tmpb;
- CDbgInfo *dbg_info;
-
- doc=DocNew(map_name);
- doc->flags|=DOCF_NO_CURSOR;
- for (i=0;i<=h->mask;i++) {
- tmph=h->body[i];
- while (tmph) {
- if (tmph->src_link && !(tmph->type & (HTF_IMPORT | HTF_PRIVATE))) {
- src_link=StrNew(tmph->src_link);
- if (drv_let && StrLen(src_link)>=4)
- src_link[3]=drv_let;
- if (dbg_info=tmph->dbg_info) {
- size=offset(CDbgInfo.body)+
- sizeof(U32)*(dbg_info->max_line+2-dbg_info->min_line);
- if (size>MSize(dbg_info)) {
- "Corrupt Map Entry\n";
- dbg_info=NULL;
- } else {
- if (dbg_info->min_line<=dbg_info->max_line) {
- tmpb=CAlloc(sizeof(CDocBin));
- tmpb->size=size;
- tmpb->data=MAlloc(size);
- MemCpy(tmpb->data,dbg_info,size);
- tmpb->num=doc->cur_bin_num++;
- tmpb->use_cnt=1;
- QueIns(tmpb,doc->bin_head.last);
- } else
- dbg_info=NULL;
- }
- }
- if (dbg_info)
- DocPrint(doc,"$LK,\"%s\",A=\"%s\",BI=%d$\n",
- tmph->str,src_link,tmpb->num);
- else
- DocPrint(doc,"$LK,\"%s\",A=\"%s\"$\n",tmph->str,src_link);
-
- Free(src_link);
- }
- tmph=tmph->next;
- }
- }
- DocBinsValidate(doc);
- DocWrite(doc);
- DocDel(doc);
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/CInit.HC.HTML b/public/src/Compiler/CInit.HC.HTML deleted file mode 100644 index e2c99e3..0000000 --- a/public/src/Compiler/CInit.HC.HTML +++ /dev/null @@ -1,342 +0,0 @@ - - - - - CInit.HC - - - - - #define INTERNAL_TYPES_NUM 17
-
-class CInternalType
-{
- U8 type,size,name[8];
-} internal_types_table[INTERNAL_TYPES_NUM]={
- {RT_I0,0,"I0i"},{RT_I0,0,"I0"},{RT_U0,0,"U0i"},{RT_U0,0,"U0"},
- {RT_I8,1,"I8i"},{RT_I8,1,"I8"},{RT_I8,1,"Bool"},
- {RT_U8,1,"U8i"},{RT_U8,1,"U8"},
- {RT_I16,2,"I16i"},{RT_U16,2,"U16i"},
- {RT_I32,4,"I32i"},{RT_U32,4,"U32i"},
- {RT_I64,8,"I64i"},{RT_U64,8,"U64i"},
- {RT_F64,8,"F64i"},{RT_F64,8,"F64"},
-};
-
-CIntermediateStruct intermediate_code_table[IC_ICS_NUM]={
- {IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"END"},
- {IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"NOP1"},
- {IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"END_EXP"},
- {IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"NOP2"},
- {IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"LABEL"},
- {IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"CALL_START"},
- {IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"CALL_END"},
- {IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"CALL_END2"},
- {IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"RETURN_VAL"},
- {IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"RETURN_VAL2"},
- {IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"IMM_I64"},
- {IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"IMM_F64"},
- {IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"STR_CONST"},
- {IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"ABS_ADDR"},
- {IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"ADDR_IMPORT"},
- {IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"HEAP_GLBL"},
- {IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"SIZEOF"},
- {IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"TYPE"},
- {IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"GET_LABEL"},
- {IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"RBP"},
- {IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"REG"},
- {IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"FS"},
- {IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"MOV_FS"},
- {IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"GS"},
- {IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"MOV_GS"},
- {IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"LEA"},
- {IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"MOV"},
- {IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"TO_I64"},
- {IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"TO_F64"},
- {IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"TO_BOOL"},
- {IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"TOUPPER"},
- {IS_1_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"HOLYC_TYPECAST"},
- {IS_1_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"ADDR"},
- {IS_1_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"COM"},
- {IS_1_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"NOT"},
- {IS_1_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"UNARY_MINUS"},
- {IS_1_ARG,1,IST_DEREF,FALSE,TRUE,0,0,0,"DEREF"},
- {IS_1_ARG,1,IST_DEREF,FALSE,TRUE,0,0,0,"DEREF_PP"},
- {IS_1_ARG,1,IST_DEREF,FALSE,TRUE,0,0,0,"DEREF_MM"},
- {IS_1_ARG,1,IST_DEREF,TRUE,TRUE,0,0,0,"_PP"},
- {IS_1_ARG,1,IST_DEREF,TRUE,TRUE,0,0,0,"_MM"},
- {IS_1_ARG,1,IST_DEREF,TRUE,TRUE,0,0,0,"PP_"},
- {IS_1_ARG,1,IST_DEREF,TRUE,TRUE,0,0,0,"MM_"},
- {IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"SHL"},
- {IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"SHR"},
- {IS_1_ARG,1,IST_ASSIGN,FALSE,FALSE,0,0,0,"SHL_CONST"},
- {IS_1_ARG,1,IST_ASSIGN,FALSE,FALSE,0,0,0,"SHR_CONST"},
- {IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"POWER"},
- {IS_2_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"MUL"},
- {IS_2_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"DIV"},
- {IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"MOD"},
- {IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"AND"},
- {IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"OR"},
- {IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"XOR"},
- {IS_2_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"ADD"},
- {IS_2_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"SUB"},
- {IS_1_ARG,1,IST_ASSIGN,FALSE,FALSE,0,0,0,"ADD_CONST"},
- {IS_1_ARG,1,IST_ASSIGN,FALSE,FALSE,0,0,0,"SUB_CONST"},
- {IS_2_ARG,1,IST_CMP,FALSE,FALSE,0,0,0,"EQU_EQU"},
- {IS_2_ARG,1,IST_CMP,FALSE,FALSE,0,0,0,"NOT_EQU"},
- {IS_2_ARG,1,IST_CMP,FALSE,FALSE,0,0,0,"LESS"},
- {IS_2_ARG,1,IST_CMP,FALSE,FALSE,0,0,0,"GREATER_EQU"},
- {IS_2_ARG,1,IST_CMP,FALSE,FALSE,0,0,0,"GREATER"},
- {IS_2_ARG,1,IST_CMP,FALSE,FALSE,0,0,0,"LESS_EQU"},
- {IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"PUSH_CMP"},
- {IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"AND_AND"},
- {IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"OR_OR"},
- {IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"XOR_XOR"},
- {IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"ASSIGN"},
- {IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"ASSIGN_PP"},
- {IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"ASSIGN_MM"},
- {IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"SHL_EQU"},
- {IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"SHR_EQU"},
- {IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"MUL_EQU"},
- {IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"DIV_EQU"},
- {IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"MOD_EQU"},
- {IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"AND_EQU"},
- {IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"OR_EQU"},
- {IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"XOR_EQU"},
- {IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"ADD_EQU"},
- {IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"SUB_EQU"},
- {IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"JMP"},
- {IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"SUB_CALL"},
- {IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"SWITCH"},
- {IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"NOBOUND_SWITCH"},
- {IS_V_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"ADD_RSP"},
- {IS_V_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"ADD_RSP1"},
- {IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"ENTER"},
- {IS_0_ARG,0,IST_ASSIGN,FALSE,FALSE,0,0,0,"PUSH_REGS"},
- {IS_0_ARG,0,IST_ASSIGN,FALSE,FALSE,0,0,0,"POP_REGS"},
- {IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"LEAVE"},
- {IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"RET"},
- {IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CALL"},
- {IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CALL_INDIRECT"},
- {IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CALL_INDIRECT2"},
- {IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CALL_IMPORT"},
- {IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CALL_EXTERN"},
- {IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"ASM"},
- {IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"PUSH"},
- {IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"POP"},
- {IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CLFLUSH"},
- {IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"INVLPG"},
- {IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"IN_U8"},
- {IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"IN_U16"},
- {IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"IN_U32"},
- {IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"OUT_U8"},
- {IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"OUT_U16"},
- {IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"OUT_U32"},
- {IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"GET_RFLAGS"},
- {IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CARRY"},
- {IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SET_RFLAGS"},
- {IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"GET_RAX"},
- {IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SET_RAX"},
- {IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"GET_RBP"},
- {IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SET_RBP"},
- {IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"GET_RSP"},
- {IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SET_RSP"},
- {IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"RIP"},
- {IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"RDTSC"},
- {IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BT"},
- {IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BTS"},
- {IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BTR"},
- {IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BTC"},
- {IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"LBTS"},
- {IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"LBTR"},
- {IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"LBTC"},
- {IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BSF"},
- {IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BSR"},
- {IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"QUE_INIT"},
- {IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"QUE_INS"},
- {IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"QUE_INS_REV"},
- {IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"QUE_REM"},
- {IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"STRLEN"},
- {IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_ZERO"},
- {IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_NOT_ZERO"},
- {IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_CARRY"},
- {IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_NOT_CARRY"},
- {IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_EQU_EQU"},
- {IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_NOT_EQU"},
- {IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_LESS"},
- {IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_GREATER_EQU"},
- {IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_GREATER"},
- {IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_LESS_EQU"},
- {IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"BR_2EQU_EQU"},
- {IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"BR_2NOT_EQU"},
- {IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"BR_2LESS"},
- {IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"BR_2GREATER_EQU"},
- {IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"BR_2GREATER"},
- {IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"BR_2LESS_EQU"},
- {IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_AND_ZERO"},
- {IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_AND_NOT_ZERO"},
- {IS_1_ARG,0,IST_DEREF,FALSE,TRUE,0,0,0,"BR_MM_ZERO"},
- {IS_1_ARG,0,IST_DEREF,FALSE,TRUE,0,0,0,"BR_MM_NOT_ZERO"},
- {IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_AND_AND_ZERO"},
- {IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_AND_AND_NOT_ZERO"},
- {IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_OR_OR_ZERO"},
- {IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_OR_OR_NOT_ZERO"},
- {IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_BT"},
- {IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_BTS"},
- {IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_BTR"},
- {IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_BTC"},
- {IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_NOT_BT"},
- {IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_NOT_BTS"},
- {IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_NOT_BTR"},
- {IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_NOT_BTC"},
- {IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SWAP_U8"},
- {IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SWAP_U16"},
- {IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SWAP_U32"},
- {IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SWAP_U64"},
- {IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"ABS_I64"},
- {IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"SIGN_I64"},
- {IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"I64_MIN"},
- {IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"U64_MIN"},
- {IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"I64_MAX"},
- {IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"U64_MAX"},
- {IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"MOD_U64"},
- {IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"SQRI64"},
- {IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"SQRU64"},
- {IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"SQR"},
- {IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"ABS"},
- {IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"SQRT"},
- {IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"SIN"},
- {IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"COS"},
- {IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"TAN"},
- {IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"ATAN"},
-};
-
-U0 CmpLoadDefines()
-{
- DefineLstLoad("ST_RAW_TYPES",
- "\0\0I0\0U0\0I8\0U8\0I16\0U16\0I32\0U32\0I64\0U64\0"
- "F32\0UF32\0F64\0UF64\0");
- DefineLstLoad("ST_NATURAL_TYPES",
- "I8\0U8\0I16\0U16\0I32\0U32\0I64\0U64\0F64\0String\0");
- DefineLstLoad("ST_INT_SIZE_TYPES",
- "I8\0U8\0I16\0U16\0I32\0U32\0I64\0U64\0");
- DefineLstLoad("ST_TY_TYPES","NULL\0STK\0IMM\0REG\0DISP\0SIB\0RIP\0");
- DefineLstLoad("ST_U8_REGS","AL\0CL\0DL\0BL\0AH\0CH\0DH\0BH\0"
- "R8u8\0R9u8\0R10u8\0R11u8\0R12u8\0R13u8\0R14u8\0R15u8\0");
- DefineLstLoad("ST_U8_REX_REGS","AL\0CL\0DL\0BL\0RSPu8\0RBPu8\0RSIu8\0RDIu8\0"
- "R8u8\0R9u8\0R10u8\0R11u8\0R12u8\0R13u8\0R14u8\0R15u8\0");
- DefineLstLoad("ST_U16_REGS","AX\0CX\0DX\0BX\0SP\0BP\0SI\0DI\0"
- "R8u16\0R9u16\0R10u16\0R11u16\0R12u16\0R13u16\0R14u16\0R15u16\0");
- DefineLstLoad("ST_U32_REGS","EAX\0ECX\0EDX\0EBX\0ESP\0EBP\0ESI\0EDI\0"
- "R8u32\0R9u32\0R10u32\0R11u32\0R12u32\0R13u32\0R14u32\0R15u32\0");
- DefineLstLoad("ST_U64_REGS","RAX\0RCX\0RDX\0RBX\0RSP\0RBP\0RSI\0RDI\0"
- "R8\0R9\0R10\0R11\0R12\0R13\0R14\0R15\0");
- DefineLstLoad("ST_MM_REGS","MM0\0MM1\0MM2\0MM3\0MM4\0MM5\0MM6\0MM7\0");
- DefineLstLoad("ST_XMM_REGS",
- "XMM0\0XMM1\0XMM2\0XMM3\0XMM4\0XMM5\0XMM6\0XMM7\0");
- DefineLstLoad("ST_ARG_TYPES","NONE\0REL8\0REL16\0REL32\0"
- "IMM8\0IMM16\0IMM32\0IMM64\0UIMM8\0UIMM16\0UIMM32\0UIMM64\0"
- "R8\0R16\0R32\0R64\0RM8\0RM16\0RM32\0RM64\0"
- "M8\0M16\0M32\0M64\0M1632\0M16N32\0M16N16\0M32N32\0"
- "MOFFS8\0MOFFS16\0MOFFS32\0MOFFS64\0"
- "AL\0AX\0EAX\0RAX\0CL\0DX\0\0SREG\0"
- "SS\0DS\0ES\0FS\0GS\0CS\0ST0\0STI\0"
- "MM\0MM32\0MM64\0XMM\0XMM32\0XMM64\0XMM128\0XMM0\0");
- DefineLstLoad("ST_SEG_REGS","ES\0CS\0SS\0DS\0FS\0GS\0");
- DefineLstLoad("ST_FSTK_REGS","ST0\0ST1\0ST2\0ST3\0ST4\0ST5\0ST6\0ST7\0");
-}
-
-U0 CmpFillTables()
-{
- I64 i;
- U32 *d;
-
- cmp.to_reg_vars_map=CAlloc(REG_REGS_NUM*sizeof(U8));
- cmp.num_reg_vars=0;
- cmp.reg_vars_mask=REGG_LOCAL_VARS;
- for (i=0;i<REG_REGS_NUM;i++)
- if (Bt(&cmp.reg_vars_mask,i))
- cmp.to_reg_vars_map[cmp.num_reg_vars++]=i;
-
- cmp.non_ptr_vars_map=CAlloc(REG_REGS_NUM*sizeof(U8));
- cmp.num_non_ptr_vars=0;
- cmp.non_ptr_vars_mask=REGG_LOCAL_NON_PTR_VARS;
- for (i=0;i<REG_REGS_NUM;i++)
- if (Bt(&cmp.non_ptr_vars_mask,i))
- cmp.non_ptr_vars_map[cmp.num_non_ptr_vars++]=i;
-
- cmp.dual_U16_tokens1=d=CAlloc(sizeof(U32)*TK_TKS_NUM);
- d['!']=TK_NOT_EQU<<16+'=';
- d['&']=TK_AND_AND<<16+'&';
- d['*']=TK_MUL_EQU<<16+'=';
- d['+']=TK_PLUS_PLUS<<16+'+';
- d['-']=TK_DEREFERENCE<<16+'>';
- d['/']='*';
- d[':']=TK_DBL_COLON<<16+':';
- d['<']=TK_LESS_EQU<<16+'=';
- d['=']=TK_EQU_EQU<<16+'=';
- d['>']=TK_GREATER_EQU<<16+'=';
- d['^']=TK_XOR_EQU<<16+'=';
- d['|']=TK_OR_OR<<16+'|';
- d['%']=TK_MOD_EQU<<16+'=';
-
- cmp.dual_U16_tokens2=d=CAlloc(sizeof(U32)*TK_TKS_NUM);
- d['&']=TK_AND_EQU<<16+'=';
- d['+']=TK_ADD_EQU<<16+'=';
- d['-']=TK_MINUS_MINUS<<16+'-';
- d['/']='/';
- d['<']=TK_SHL<<16+'<';
- d['>']=TK_SHR<<16+'>';
- d['^']=TK_XOR_XOR<<16+'^';
- d['|']=TK_OR_EQU<<16+'=';
-
- cmp.dual_U16_tokens3=d=CAlloc(sizeof(U32)*TK_TKS_NUM);
- d['-']=TK_SUB_EQU<<16+'=';
- d['/']=TK_DIV_EQU<<16+'=';
-
- cmp.binary_ops=d=CAlloc(sizeof(U32)*TK_TKS_NUM);
- d['`'] =(PREC_EXP+ASSOCF_RIGHT)<<16+IC_POWER;
- d[TK_SHL]=(PREC_EXP+ASSOCF_LEFT)<<16+IC_SHL;
- d[TK_SHR]=(PREC_EXP+ASSOCF_LEFT)<<16+IC_SHR;
-
- d['*']=PREC_MUL<<16+IC_MUL;
- d['/']=(PREC_MUL+ASSOCF_LEFT)<<16+IC_DIV;
- d['%']=(PREC_MUL+ASSOCF_LEFT)<<16+IC_MOD;
-
- d['&']=PREC_AND<<16+IC_AND;
-
- d['^']=PREC_XOR<<16+IC_XOR;
-
- d['|']=PREC_OR<<16+IC_OR;
-
- d['+']=PREC_ADD<<16+IC_ADD;
- d['-']=(PREC_ADD+ASSOCF_LEFT)<<16+IC_SUB;
-
- d['<'] =PREC_CMP<<16+IC_LESS;
- d['>'] =PREC_CMP<<16+IC_GREATER;
- d[TK_LESS_EQU] =PREC_CMP<<16+IC_LESS_EQU;
- d[TK_GREATER_EQU] =PREC_CMP<<16+IC_GREATER_EQU;
-
- d[TK_EQU_EQU] =PREC_CMP2<<16+IC_EQU_EQU;
- d[TK_NOT_EQU] =PREC_CMP2<<16+IC_NOT_EQU;
-
- d[TK_AND_AND] =PREC_AND_AND<<16+IC_AND_AND;
-
- d[TK_XOR_XOR] =PREC_XOR_XOR<<16+IC_XOR_XOR;
-
- d[TK_OR_OR] =PREC_OR_OR<<16+IC_OR_OR;
-
- d['='] =(PREC_ASSIGN+ASSOCF_RIGHT)<<16+IC_ASSIGN;
- d[TK_SHL_EQU]=(PREC_ASSIGN+ASSOCF_RIGHT)<<16+IC_SHL_EQU;
- d[TK_SHR_EQU]=(PREC_ASSIGN+ASSOCF_RIGHT)<<16+IC_SHR_EQU;
- d[TK_MUL_EQU]=(PREC_ASSIGN+ASSOCF_RIGHT)<<16+IC_MUL_EQU;
- d[TK_DIV_EQU]=(PREC_ASSIGN+ASSOCF_RIGHT)<<16+IC_DIV_EQU;
- d[TK_MOD_EQU]=(PREC_ASSIGN+ASSOCF_RIGHT)<<16+IC_MOD_EQU;
- d[TK_AND_EQU]=(PREC_ASSIGN+ASSOCF_RIGHT)<<16+IC_AND_EQU;
- d[TK_OR_EQU] =(PREC_ASSIGN+ASSOCF_RIGHT)<<16+IC_OR_EQU;
- d[TK_XOR_EQU]=(PREC_ASSIGN+ASSOCF_RIGHT)<<16+IC_XOR_EQU;
- d[TK_ADD_EQU]=(PREC_ASSIGN+ASSOCF_RIGHT)<<16+IC_ADD_EQU;
- d[TK_SUB_EQU]=(PREC_ASSIGN+ASSOCF_RIGHT)<<16+IC_SUB_EQU;
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/CMain.HC.HTML b/public/src/Compiler/CMain.HC.HTML deleted file mode 100644 index e81f0d4..0000000 --- a/public/src/Compiler/CMain.HC.HTML +++ /dev/null @@ -1,714 +0,0 @@ - - - - - CMain.HC - - - - - U8 *LexStmt2Bin(CCmpCtrl *cc,I64 *_type,I64 cmp_flags=0)
-{//Compile one cc stmt to bin code.
- I64 size,i,j,k,*res=INVALID_PTR;
- CCodeCtrl *tmpcbh;
- if (_type) *_type=RT_I64;
- Btr(&cc->flags,CCf_PASS_TRACE_PRESENT);
- if (cc->aot_depth==2)
- COCPush(cc);
- COCInit(cc);
- if (!PrsStmt(cc,,,cmp_flags)) {
- if (cc->coc.coc_head.next!=&cc->coc.coc_head) {
- cc->coc.coc_head.last->ic_flags&=~ICF_RES_NOT_USED;
- ICAdd(cc,IC_RETURN_VAL2,0,0);
- ICAdd(cc,IC_RET,0,0);
- if (res=COCCompile(cc,&size,NULL,_type)) {
- if (cc->flags&CCF_AOT_COMPILE) {
- j=cc->aotc->rip;
- k=(size+7)>>3;
- for (i=0;i<k;i++)
- AOTStoreCodeU64(cc,res[i]);
- Free(res);
- res=j;
- }
- }
- } //TODO: else del misc?
- } else //TODO: too dangerous to del Misc?
- QueDel(&cc->coc.coc_head.next);
- if (cc->aot_depth==2) {
- tmpcbh=COCPopNoFree(cc);
- COCAppend(cc,tmpcbh);
- }
- return res;
-}
-
-CAOT *CmpJoin(CCmpCtrl *cc,I64 cmp_flags,U8 *map_name=NULL,U8 mapfile_drv_let=0)
-{
- CAOTCtrl *aotc,*old_aot=cc->aotc;
- I64 i,j,l;
- U8 *buf;
- CAOTBinBlk *tmpbin;
- CAOTImportExport *tmpie;
- Bool okay=TRUE;
- CLexHashTableContext *htc=MAlloc(sizeof(CLexHashTableContext));
- CAOT *res=CAlloc(sizeof(CAOT)),*parent;
- if (parent=cc->aot) {
- res->parent_aot=parent;
- QueIns(res,parent->last);
- } else
- QueInit(res);
- cc->aot=res;
-
- res->next_ie=res->last_ie=&res->next_ie;
- cc->aotc=aotc=CAlloc(sizeof(CAOTCtrl));
- cc->aot_depth++;
-
- aotc->bin=CAlloc(sizeof(CAOTBinBlk));
- aotc->max_align_bits=0;
- aotc->org=INVALID_PTR;
-
- MemCpy(htc,&cc->htc,sizeof(CLexHashTableContext));
- if (cc->htc.fun)
- cc->htc.glbl_hash_table=HashTableNew(128);
- else
- cc->htc.glbl_hash_table=HashTableNew(1024);
- if (cc->flags&CCF_AOT_COMPILE) {
- cc->htc.define_hash_table=cc->htc.glbl_hash_table;
- if (cc->aot_depth<=1)
- cc->htc.glbl_hash_table->next=cmp.asm_hash;
- else
- cc->htc.glbl_hash_table->next=htc->glbl_hash_table;
- } else
- cc->htc.glbl_hash_table->next=Fs->hash_table;
- cc->htc.hash_table_lst=cc->htc.local_hash_table=HashTableNew(16);
- cc->htc.local_hash_table->next=cc->htc.glbl_hash_table;
- cc->htc.local_var_lst=cc->htc.fun; //HolyC local vars
- cc->htc.fun=NULL;
- try {
- if (cmp_flags&CMPF_LEX_FIRST)
- Lex(cc);
- if (!(cmp_flags&CMPF_ONE_ASM_INS))
- cmp_flags|=CMPF_PRS_SEMICOLON;
- if (cc->flags&CCF_AOT_COMPILE) {
- while (cc->token!=TK_EOF) {
- buf=LexStmt2Bin(cc,NULL,cmp_flags);
- if (buf!=INVALID_PTR) {
- tmpie=CAlloc(sizeof(CAOTImportExport));
- tmpie->type=IET_MAIN;
- tmpie->rip=buf;
- QueIns(tmpie,res->last_ie);
- }
- if (cmp_flags&CMPF_ASM_BLK)
- break;
- }
- } else
- PrsStmt(cc,,,cmp_flags);
- AOTGlblsResolve(cc,res);
- } catch {
- if (Fs->except_ch=='Compiler' && !(cmp_flags&CMPF_ASM_BLK)) {
- LexPutPos(cc);
- Fs->catch_except=TRUE;
- }
- okay=FALSE;
- }
- if (!okay) {
- if (cc->error_cnt<1)
- cc->error_cnt=1;
- cc->aot=res->parent_aot;
- Free(res);
- LinkedLstDel(aotc->bin);
- res=NULL;
- } else {
- if (map_name)
- MapFileWrite(cc->htc.glbl_hash_table,map_name,mapfile_drv_let);
- HashTableDel(cc->htc.local_hash_table);
- HashTableDel(cc->htc.glbl_hash_table);
-
- if (!aotc->num_bin_U8s)
- res->buf=NULL;
- else {
- if (cc->flags&CCF_AOT_COMPILE)
- res->buf=MAlloc(aotc->num_bin_U8s);
- else {
- if (aotc->org==INVALID_PTR)
- res->buf=MAlloc(aotc->num_bin_U8s,Fs->code_heap);
- else
- res->buf=aotc->org;
- }
- res->aot_U8s=aotc->num_bin_U8s;
- tmpbin=aotc->bin;
- j=0;
- l=aotc->num_bin_U8s;
- while (tmpbin) {
- i=l;
- if (i>AOT_BIN_BLK_SIZE)
- i=AOT_BIN_BLK_SIZE;
- MemCpy(res->buf+j,tmpbin->body,i);
- j+=i;
- l-=i;
- tmpbin=tmpbin->next;
- }
- }
- LinkedLstDel(aotc->bin);
- res->abss=aotc->abss;
- res->heap_glbls=aotc->heap_glbls;
- res->max_align_bits=aotc->max_align_bits;
- res->org=aotc->org;
- }
- cc->aot=parent;
- MemCpy(&cc->htc,htc,sizeof(CLexHashTableContext));
- Free(htc);
- Free(aotc);
- cc->aotc=old_aot;
- cc->aot_depth--;
- return res;
-}
-
-CAOT *CmpBuf(U8 *buf,U8 *map_name=NULL,
- I64 *error_cnt=NULL, I64 *warning_cnt=NULL,U8 mapfile_drv_let=0)
-{
- CCmpCtrl *cc;
- CAOT *res=NULL;
- cc=CmpCtrlNew(buf,CCF_DONT_FREE_BUF);
- cc->flags|=CCF_AOT_COMPILE;
- QueIns(cc,Fs->last_cc);
- res=CmpJoin(cc,CMPF_LEX_FIRST,map_name,mapfile_drv_let);
- if (error_cnt) *error_cnt=cc->error_cnt;
- if (warning_cnt) *warning_cnt=cc->warning_cnt;
- QueRem(cc);
- if (res)
- CmpCtrlDel(cc);
- return res;
-}
-
-U0 CmpFixUpJITAsm(CCmpCtrl *cc,CAOT *tmpaot)
-{
- I64 i,rip2=tmpaot->buf+tmpaot->rip,*str=NULL;
- U8 *ptr;
- CCodeMisc *g_lb;
- CAOTAbsAddr *tmpa,*tmpa1;
- CAOTImportExport *tmpie,*tmpie1;
- CHashExport *tmpex;
-
- tmpa=tmpaot->abss;
- while (tmpa) {
- tmpa1=tmpa->next;
- ptr=rip2+tmpa->rip;
- switch [tmpa->type] {
- case AAT_ADD_U8: *ptr(U8 *) +=rip2; break;
- case AAT_SUB_U8: *ptr(U8 *) -=rip2; break;
- case AAT_ADD_U16: *ptr(U16 *)+=rip2; break;
- case AAT_SUB_U16: *ptr(U16 *)-=rip2; break;
- case AAT_ADD_U32: *ptr(U32 *)+=rip2; break;
- case AAT_SUB_U32: *ptr(U32 *)-=rip2; break;
- case AAT_ADD_U64: *ptr(I64 *)+=rip2; break;
- case AAT_SUB_U64: *ptr(I64 *)-=rip2; break;
- }
- Free(tmpa);
- tmpa=tmpa1;
- }
- tmpie=tmpaot->next_ie;
- while (tmpie!=&tmpaot->next_ie) {
- tmpie1=tmpie->next;
- if (tmpie->str) {
- Free(str);
- str=tmpie->str;
- }
- switch (tmpie->type) {
- case IET_REL32_EXPORT:
- case IET_IMM32_EXPORT:
- case IET_REL64_EXPORT:
- case IET_IMM64_EXPORT:
- tmpex=CAlloc(sizeof(CHashExport));
- tmpex->str=str;
- str=NULL;
- tmpex->type=HTT_EXPORT_SYS_SYM|HTF_IMM;
- if (tmpie->type==IET_IMM32_EXPORT||tmpie->type==IET_IMM64_EXPORT)
- tmpex->val=tmpie->rip;
- else
- tmpex->val=tmpie->rip+rip2;
- tmpex->src_link=tmpie->src_link;
- tmpie->src_link=NULL;
- HashAdd(tmpex,Fs->hash_table);
- SysSymImportsResolve(tmpex->str);
- break;
- case IET_REL_I0...IET_IMM_I64:
- if (tmpie->str) {
- if (tmpie->flags&IEF_GOTO_LABEL) {
- if(!(g_lb=COCGoToLabelFind(cc,str)))
- "Unresolved Reference:%s\n",str;
- else {
- g_lb->use_cnt++;
- g_lb=OptLabelFwd(g_lb);
- i=g_lb->addr+tmpaot->buf;
- }
- tmpex=NULL;
- } else {
- if (!(tmpex=HashFind(str,Fs->hash_table,
- HTG_ALL-HTT_IMPORT_SYS_SYM)))
- "Unresolved Reference:%s\n",str;
- else {
- if (tmpex->type & HTT_FUN)
- i=tmpex(CHashFun *)->exe_addr;
- else if (tmpex->type & HTT_GLBL_VAR)
- i=tmpex(CHashGlblVar *)->data_addr;
- else
- i=tmpex->val;
- }
- g_lb=NULL;
- }
- }
- if (tmpex || g_lb) {
- ptr=tmpie->rip+rip2;
- switch [tmpie->type] {
- case IET_REL_I0:
- case IET_IMM_U0:
- break;
- case IET_REL_I8:
- if (!(I8_MIN<=i-ptr-1<=I8_MAX))
- LexExcept(cc,"Branch out of range at ");
- *ptr(U8 *) =i-ptr-1;
- break;
- case IET_IMM_U8:
- *ptr(U8 *) =i;
- break;
- case IET_REL_I16:
- if (!(I16_MIN<=i-ptr-2<=I16_MAX))
- LexExcept(cc,"Branch out of range at ");
- *ptr(U16 *)=i-ptr-2;
- break;
- case IET_IMM_U16:
- *ptr(U16 *)=i;
- break;
- case IET_REL_I32:
- if (!(I32_MIN<=i-ptr-4<=I32_MAX))
- LexExcept(cc,"Branch out of range at ");
- *ptr(U32 *)=i-ptr-4;
- break;
- case IET_IMM_U32:
- *ptr(U32 *)=i;
- break;
- case IET_REL_I64:
- *ptr(I64 *)=i-ptr-8;
- break;
- case IET_IMM_I64:
- *ptr(I64 *)=i;
- break;
- }
- }
- break;
- }
- Free(tmpie->src_link);
- Free(tmpie);
- tmpie=tmpie1;
- }
- Free(str);
- if (!cc->aot_depth && Bt(&cc->opts,OPTf_TRACE))
- Un(rip2,tmpaot->aot_U8s,64);
- QueRem(tmpaot);
- Free(tmpaot);
-}
-
-U0 CmpFixUpAOTAsm(CCmpCtrl *cc,CAOT *tmpaot)
-{
- CAOTCtrl *aotc=cc->aotc;
- I64 i,rip2=tmpaot->rip+cc->aotc->rip;
- U8 *ptr;
- CCodeMisc *g_lb=NULL;
- CAOTAbsAddr *tmpa,*tmpa1;
- CAOTImportExport *tmpie,*tmpie1;
-
- tmpa=tmpaot->abss;
- while (tmpa) {
- tmpa1=tmpa->next;
- tmpa->next=aotc->abss;
- ptr=tmpaot->buf+tmpaot->rip+tmpa->rip;
- switch [tmpa->type] {
- case AAT_ADD_U8: *ptr(U8 *)+=rip2; break;
- case AAT_SUB_U8: *ptr(U8 *)-=rip2; break;
- case AAT_ADD_U16: *ptr(U16 *)+=rip2; break;
- case AAT_SUB_U16: *ptr(U16 *)-=rip2; break;
- case AAT_ADD_U32: *ptr(U32 *)+=rip2; break;
- case AAT_SUB_U32: *ptr(U32 *)-=rip2; break;
- case AAT_ADD_U64: *ptr(I64 *)+=rip2; break;
- case AAT_SUB_U64: *ptr(I64 *)-=rip2; break;
- }
- aotc->abss=tmpa;
- tmpa->rip+=rip2;
- tmpa=tmpa1;
- }
-
- tmpie=tmpaot->next_ie;
- while (tmpie!=&tmpaot->next_ie) {
- tmpie1=tmpie->next;
- QueRem(tmpie);
- if (IET_REL_I0<=tmpie->type<=IET_IMM_I64) {
- if (tmpie->str) {
- if (tmpie->flags&IEF_GOTO_LABEL) {
- if(!(g_lb=COCGoToLabelFind(cc,tmpie->str)))
- "Unresolved Reference:%s\n",tmpie->str;
- else {
- g_lb->use_cnt++;
- g_lb=OptLabelFwd(g_lb);
- }
- } else
- g_lb=NULL;
- }
- } else
- g_lb=NULL;
-
- ptr=tmpaot->buf+tmpaot->rip+tmpie->rip;
- if (g_lb) {
- i=g_lb->addr+tmpaot->buf;
- switch [tmpie->type] {
- case IET_REL_I0:
- case IET_IMM_U0:
- break;
- case IET_REL_I8:
- if (!(I8_MIN<=i-ptr-1<=I8_MAX))
- LexExcept(cc,"Branch out of range at ");
- *ptr(U8 *) =i-ptr-1;
- break;
- case IET_IMM_U8:
- *ptr(U8 *) =i;
- break;
- case IET_REL_I16:
- if (!(I16_MIN<=i-ptr-2<=I16_MAX))
- LexExcept(cc,"Branch out of range at ");
- *ptr(U16 *)=i-ptr-2;
- break;
- case IET_IMM_U16:
- *ptr(U16 *)=i;
- break;
- case IET_REL_I32:
- if (!(I32_MIN<=i-ptr-4<=I32_MAX))
- LexExcept(cc,"Branch out of range at ");
- *ptr(U32 *)=i-ptr-4;
- break;
- case IET_IMM_U32:
- *ptr(U32 *)=i;
- break;
- case IET_REL_I64:
- *ptr(I64 *)=i-ptr-8;
- break;
- case IET_IMM_I64:
- *ptr(I64 *)=i;
- break;
- }
- Free(tmpie->src_link);
- Free(tmpie);
- } else {
- switch (tmpie->type) {
- start:
- case IET_REL32_EXPORT:
- case IET_IMM32_EXPORT:
- case IET_REL64_EXPORT:
- case IET_IMM64_EXPORT:
- case IET_IMM_U0:
- case IET_IMM_U8:
- case IET_IMM_U16:
- case IET_IMM_U32:
- case IET_IMM_I64:
- case IET_REL_I0:
- break;
- case IET_REL_I8: *ptr(U8 *) -=rip2; break;
- case IET_REL_I16: *ptr(U16 *)-=rip2; break;
- case IET_REL_I32: *ptr(U32 *)-=rip2; break;
- case IET_REL_I64: *ptr(I64 *)-=rip2; break;
- end:
- tmpie->rip+=rip2;
- break;
- }
- tmpie->aot=NULL;
- QueIns(tmpie,tmpaot->parent_aot->last_ie);
- }
- tmpie=tmpie1;
- }
-}
-
-I64 Cmp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0)
-{//AOT Compile HC or PRJ file a and output BIN file. Returns err_cnt.
- U8 *ptr,*fbuf=NULL,*fbuf2=NULL,*fbuf3=NULL,
- *patch_table=MAlloc(0x20000);
- CAOT *tmpaot;
- I64 i,cnt,size=0,error_cnt=0,warning_cnt=0,aot_U8s=0;
- CBinFile *bfh;
- CAOTImportExport *tmpie,*tmpie1;
- CAOTAbsAddr *tmpa,*tmpa1;
- CAOTHeapGlblRef *tmphgr,*tmphgr1;
- CAOTHeapGlbl *tmphg,*tmphg1;
-
- fbuf=ExtDft(filename,"PRJ.Z");
- fbuf2=MStrPrint("#include \"%s\"",fbuf);
- if (map_name)
- fbuf3=ExtDft(map_name,"MAP.Z");
-
- if (tmpaot=CmpBuf(fbuf2,fbuf3,&error_cnt,&warning_cnt,mapfile_drv_let)) {
- aot_U8s=tmpaot->aot_U8s;
- ptr=patch_table;
-//See Load()
- cnt=0;
- tmpa=tmpaot->abss;
- while (tmpa) {
- if (!(tmpa->type&IEF_IMM_NOT_REL))
- cnt++;
- tmpa=tmpa->next;
- }
- if (cnt) {
- *ptr++=IET_ABS_ADDR;
- *ptr(U32 *)++=cnt;
- *ptr++=0;
- tmpa=tmpaot->abss;
- while (tmpa) {
- tmpa1=tmpa->next;
- if (!(tmpa->type&IEF_IMM_NOT_REL))
- *ptr(U32 *)++ =tmpa->rip;
- Free(tmpa);
- tmpa=tmpa1;
- }
- }
- tmphg=tmpaot->heap_glbls;
- while (tmphg) {
- tmphg1=tmphg->next;
- cnt=0;
- tmphgr=tmphg->references;
- while (tmphgr) {
- cnt++;
- tmphgr=tmphgr->next;
- }
- if (cnt) {
- *ptr++=IET_DATA_HEAP;
- *ptr(U32 *)++=cnt;
- if (tmphg->str) {
- i=StrLen(tmphg->str);
- MemCpy(ptr,tmphg->str,i+1);
- Free(tmphg->str);
- ptr+=i+1;
- } else
- *ptr++=0;
- *ptr(I64 *)++=tmphg->size;
- tmphgr=tmphg->references;
- while (tmphgr) {
- tmphgr1=tmphgr->next;
- *ptr(U32 *)++=tmphgr->rip;
- Free(tmphgr);
- tmphgr=tmphgr1;
- }
- }
- Free(tmphg);
- tmphg=tmphg1;
- }
-
- //Do exports first
- tmpie=tmpaot->next_ie;
- while (tmpie!=&tmpaot->next_ie) {
- tmpie1=tmpie->next;
- if (!tmpie->type || IET_REL32_EXPORT<=tmpie->type<=IET_IMM64_EXPORT) {
- QueRem(tmpie);
- *ptr++=tmpie->type;
- *ptr(U32 *)++=tmpie->rip;
- if (tmpie->str) {
- i=StrLen(tmpie->str);
- MemCpy(ptr,tmpie->str,i+1);
- Free(tmpie->str);
- ptr+=i+1;
- } else
- *ptr++=0;
- Free(tmpie->src_link);
- Free(tmpie);
- }
- tmpie=tmpie1;
- }
-
- //Do imports second
- tmpie=tmpaot->next_ie;
- while (tmpie!=&tmpaot->next_ie) {
- tmpie1=tmpie->next;
- QueRem(tmpie);
- *ptr++=tmpie->type;
- if (tmpie->aot)
- tmpie->rip+=tmpie->aot->rip2;
- *ptr(U32 *)++=tmpie->rip;
- if (tmpie->str) {
- i=StrLen(tmpie->str);
- MemCpy(ptr,tmpie->str,i+1);
- Free(tmpie->str);
- ptr+=i+1;
- } else
- *ptr++=0;
- Free(tmpie->src_link);
- Free(tmpie);
- tmpie=tmpie1;
- }
-
- *ptr++=IET_END;
- MemSet(ptr,0,16);
- i=ptr-patch_table;
-//Needs 16 ALIGN
- size=(sizeof(CBinFile)+aot_U8s+i+15)&-16;
- bfh=MAlloc(size);
- bfh->jmp=0xEB+256*(sizeof(CBinFile)-2);
-#assert sizeof(CBinFile)-2<=I8_MAX
- bfh->reserved=0;
- bfh->bin_signature=BIN_SIGNATURE_VAL;
- bfh->org=tmpaot->org;
- bfh->module_align_bits=tmpaot->max_align_bits;
- bfh->patch_table_offset=sizeof(CBinFile)+aot_U8s;
- bfh->file_size=size;
- MemCpy(bfh(U8 *)+sizeof(CBinFile),tmpaot->buf,aot_U8s);
- MemCpy(bfh(U8 *)+sizeof(CBinFile)+aot_U8s,patch_table,
- size-aot_U8s-sizeof(CBinFile));
- Free(fbuf2);
- if (out_name)
- fbuf2=ExtDft(out_name,"BIN.Z");
- else
- fbuf2=ExtChg(fbuf,"BIN.Z");
- FileWrite(fbuf2,bfh,size);
- Free(bfh);
- Free(tmpaot->buf);
- QueDel(tmpaot);
- Free(tmpaot);
- }
- Free(patch_table);
- Free(fbuf);
- Free(fbuf2);
- Free(fbuf3);
- Print("Errs:%d Warns:%d Code:%X Size:%X\n",
- error_cnt,warning_cnt,aot_U8s,size);
- return error_cnt;
-}
-
-I64 ExePutS(U8 *buf,U8 *filename=NULL,
- I64 ccf_flags=0,CLexHashTableContext *htc=NULL)
-{//JIT Compile and execute text from a puts("").
- I64 res;
- Bool okay=TRUE;
- CCmpCtrl *cc;
- if (!filename)
- filename=blkdev.tmp_filename;
- cc=CmpCtrlNew(buf,ccf_flags|CCF_DONT_FREE_BUF,filename);
- if (Fs->last_cc!=&Fs->next_cc) {
- cc->opts=Fs->last_cc->opts;
- if (htc) {
- cc->flags=cc->flags &~CCF_ASM_EXPRESSIONS |
- htc->old_flags&CCF_ASM_EXPRESSIONS;
- MemCpy(&cc->htc,htc,sizeof(CLexHashTableContext));
- }
- }
- QueIns(cc,Fs->last_cc);
- try {
- Lex(cc);
- res=ExeCmdLine(cc);
- } catch {
- if (Fs->except_ch=='Compiler' || Fs->except_ch=='Break') {
- Fs->catch_except=TRUE;
- okay=FALSE;
- res=0;
- }
- }
- QueRem(cc);
- if (okay)
- CmpCtrlDel(cc); //TODO: can crash
- return res;
-}
-
-I64 ExePrint(U8 *fmt,...)
-{//JIT Compile and execute text from a printf().
- I64 res;
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
- res=ExePutS(buf);
- Free(buf);
- return res;
-}
-
-I64 ExeFile(U8 *name,I64 ccf_flags=0)
-{//JIT Compile and execute a file.
- I64 res;
- U8 *name2=ExtDft(name,"HC.Z"),
- *st=MStrPrint("#include \"%s\";",name2);
- res=ExePutS(st,name,ccf_flags);
- Free(st);
- Free(name2);
- return res;
-}
-
-I64 RunFile(U8 *name,I64 ccf_flags=0,...)
-{//ExeFile() with args using LastFun().
- ExeFile(name,ccf_flags);
- return LastFun(argc,argv);
-}
-
-I64 ExePutS2(U8 *buf,U8 *filename=NULL,I64 ccf_flags=0)
-{//throws exceptions
- I64 res;
- CCmpCtrl *cc;
- if (!filename)
- filename=blkdev.tmp_filename;
- cc=CmpCtrlNew(buf,ccf_flags|CCF_DONT_FREE_BUF,filename);
- if (Fs->last_cc!=&Fs->next_cc)
- cc->opts=Fs->last_cc->opts;
- QueIns(cc,Fs->last_cc);
- Lex(cc);
- res=ExeCmdLine(cc);
- QueRem(cc);
- CmpCtrlDel(cc);
- return res;
-}
-
-I64 ExePrint2(U8 *fmt,...)
-{//throws exceptions
- I64 res;
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
- res=ExePutS2(buf);
- Free(buf);
- return res;
-}
-
-I64 ExeFile2(U8 *name,I64 ccf_flags=0)
-{//throws exceptions
- I64 res;
- U8 *name2=ExtDft(name,"HC.Z"),*st=MStrPrint("#include \"%s\";",name2);
- res=ExePutS2(st,name,ccf_flags);
- Free(st);
- Free(name2);
- return res;
-}
-
-I64 RunFile2(U8 *name,I64 ccf_flags=0,...)
-{//ExeFile2() with args using LastFun(). throws exceptions.
- ExeFile2(name,ccf_flags);
- return LastFun(argc,argv);
-}
-
-I64 StreamExePrint(U8 *fmt,...)
-{//Causes value from stream to be used in an #exe{} block.
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
- I64 res=0;
- CLexHashTableContext *htc;
- CCmpCtrl *cc=Fs->last_cc;
- if (cc==&Fs->next_cc)
- PrintErr("Not Compiling\n");
- else {
- if (!(cc->flags&CCF_EXE_BLK))
- LexExcept(cc,"StreamExePrint only allowed in AOT compiled #exe{} mode.");
- if (htc=cc->htc.next)
- res=ExePutS(buf,,,htc);
- }
- Free(buf);
- return res;
-}
-
-U0 CInit()
-{
- CmpLoadDefines;
- CmpFillTables;
- QueInit(&cmp.ic_nop);
- cmp.ic_nop.ic_class=cmp.internal_types[RT_I64];
- cmp.ic_nop.ic_code=IC_NOP1;
- AsmHashLoad;
- UAsmHashLoad;
-}
-
-CInit;
- - - \ No newline at end of file diff --git a/public/src/Compiler/CMisc.HC.HTML b/public/src/Compiler/CMisc.HC.HTML deleted file mode 100644 index 6a62778..0000000 --- a/public/src/Compiler/CMisc.HC.HTML +++ /dev/null @@ -1,181 +0,0 @@ - - - - - CMisc.HC - - - - - Bool Option(I64 num,Bool val)
-{//Set compiler Option to val.
- return BEqu(&Fs->last_cc->opts,num,val);
-}
-
-Bool GetOption(I64 num)
-{//Get state of compiler option.
- return Bt(&Fs->last_cc->opts,num);
-}
-
-asm {
-_LAST_FUN:: //See _CALL_IND
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
-
- XOR RAX,RAX
- MOV RAX,FS:CTask.last_fun[RAX]
- TEST RAX,RAX
- JZ @@10
- MOV RDX,U64 CHashFun.exe_addr[RAX]
-
- MOV RCX,U64 SF_ARG1[RBP] //argc
- MOV RSI,U64 SF_ARG2[RBP] //argv
- SHL RCX,3
- SUB RSP,RCX
- MOV RDI,RSP
- REP_MOVSB
- TEST RDX,RDX
- JZ @@05
-
- CALL RDX
- POP RDI
- POP RSI
- POP RBP
- RET1 16
-
-@@05: MOV RCX,U64 SF_ARG1[RBP] //argc
- SHL RCX,3
- ADD RSP,RCX
- XOR RAX,RAX
-@@10: POP RDI
- POP RSI
- POP RBP
- RET1 16
-}
-_extern _LAST_FUN I64 LastFun(I64 argc,I64 *argv); //Execute last fun with args.
-
-I64 PassTrace(I64 i=0b10001111101)
-{//Ctrls which optimizer passes are displayed.
- I64 old=Fs->last_cc->pass_trace;
- if (i) Fs->last_cc->saved_pass_trace=i;
- Fs->last_cc->pass_trace=i;
- return old;
-}
-
-Bool Trace(Bool val=ON)
-{//Displays assembly code output from compiler.
- return Option(OPTf_TRACE,val);
-}
-
-Bool Echo(Bool val)
-{//Displays text as it is being compiled.
- return Option(OPTf_ECHO,val);
-}
-
-U0 StreamPrint(U8 *fmt,...)
-{//Injects text into the compile stream. Used in #exe{} blocks.
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv),*st;
- CCmpCtrl *cc=Fs->last_cc;
- CStreamBlk *tmpe=cc->last_stream_blk;
- if (tmpe!=&cc->next_stream_blk) {
- st=MStrPrint("%s%s",tmpe->body,buf);
- Free(tmpe->body);
- tmpe->body=st;
- } else
- PrintErr("No exe{} blk\n");
- Free(buf);
-}
-
-U0 StreamDir()
-{
- U8 *dirname;
- if (dirname=DirFile(Fs->last_cc->lex_include_stk->full_name)) {
- StreamPrint("\"%s\"",dirname);
- Free(dirname);
- }
-}
-
-CD2I32 *LexD2I32(CCmpCtrl *cc,CD2I32 *p)
-{//Not HolyC. Sprite-like lex 2D point.
- if (cc->token!='(')
- LexExcept(cc,"Expecting '(' at ");
- Lex(cc); //Skip (
- p->x=LexExpressionI64(cc);
- if (cc->token!=',')
- LexExcept(cc,"Expecting ',' at ");
- Lex(cc); //Skip ,
- p->y=LexExpressionI64(cc);
- if (cc->token!=')')
- LexExcept(cc,"Expecting ')' at ");
- Lex(cc); //Skip )
- return p;
-}
-
-CD3I32 *LexD3I32(CCmpCtrl *cc,CD3I32 *p)
-{//Not HolyC. Sprite-like lex 3D point.
- if (cc->token!='(')
- LexExcept(cc,"Expecting '(' at ");
- Lex(cc); //Skip (
- p->x=LexExpressionI64(cc);
- if (cc->token!=',')
- LexExcept(cc,"Expecting ',' at ");
- Lex(cc); //Skip ,
- p->y=LexExpressionI64(cc);
- if (cc->token!=',')
- LexExcept(cc,"Expecting ',' at ");
- Lex(cc); //Skip ,
- p->z=LexExpressionI64(cc);
- if (cc->token!=')')
- LexExcept(cc,"Expecting ')' at ");
- Lex(cc); //Skip )
- return p;
-}
-
-U8 *CmdLinePmt()
-{
- I64 i;
- U8 *res,*st;
- if (Fs->new_answer) {
- if (Fs->answer_type&~1!=RT_I0) {
- if (Fs->answer_type==RT_F64)
- "%8.6fs ansf=%15.7g\n",Fs->answer_time,Fs->answer;
- else
- "%8.6fs ans=0x%08X=%d\n",Fs->answer_time,Fs->answer,Fs->answer;
- } else {
- "%8.6fs\n",Fs->answer_time;
- Fs->answer=0;
- }
- Fs->new_answer=FALSE;
- }
- if (st=DirCur) {
- "%s",st;
- Free(st);
- }
- '>';
- if (IsDbgMode&&IsRaw)
- RawDr;
-
- LBts(&Fs->task_flags,TASKf_CMD_LINE_PMT);
- st=GetStr(,,GSF_SHIFT_ESC_EXIT);
- LBtr(&Fs->task_flags,TASKf_CMD_LINE_PMT);
-
- i=StrLen(st);
- res=MAlloc(i+1+2);
- MemCpy(res,st,i+1);
- i--;
- while (i>=0 && Bt(char_bmp_white_space,res[i]))
- i--;
- i++;
- if (i>0 && res[i-1]==';')
- res[i++]=';'; //The Lex goes one beyond
- res[i++]='\n';//#define goes to '\n'
- res[i]=0;
-
- Free(st);
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/Lex.HC.HTML b/public/src/Compiler/Lex.HC.HTML deleted file mode 100644 index abbdb12..0000000 --- a/public/src/Compiler/Lex.HC.HTML +++ /dev/null @@ -1,1207 +0,0 @@ - - - - - Lex.HC - - - - - CLexFile *LexFilePush(CCmpCtrl *cc)
-{//#include file push.
- CLexFile *res=CAlloc(sizeof(CLexFile));
- if (res->next=cc->lex_include_stk)
- res->depth=res->next->depth+1;
- else
- res->depth=-1; //Include depth starts with -1.
- return cc->lex_include_stk=res;
-}
-
-CLexFile *LexFilePop(CCmpCtrl *cc)
-{//#include file pop.
- CLexFile *tmpf;
- if (tmpf=cc->lex_include_stk) {
- if ((cc->lex_include_stk=tmpf->next) || !(cc->flags & CCF_DONT_FREE_BUF)) {
- if (tmpf->flags & LFSF_DOC) {
- if (tmpf->doc)
- DocDel(tmpf->doc);
- } else
- Free(tmpf->buf);;
- }
- Free(tmpf->full_name);
- Free(tmpf);
- }
- return cc->lex_include_stk;
-}
-
-CCmpCtrl *CmpCtrlNew(U8 *buf=NULL,I64 flags=0,U8 *filename=NULL)
-{//MAlloc and Init CCmpCtrl.
-//Frees buf in CmpCtrlDel unless CCF_DONT_FREE_BUF flag is set.
- //FileName is for error reporting. If files are #included,
- //new names are used. See Psalmody CmpCtrlNew.
- CCmpCtrl *cc=CAlloc(sizeof(CCmpCtrl));
- CLexFile *tmpf;
- QueInit(cc);
- cc->flags=flags;
- cc->opts=1<<OPTf_WARN_UNUSED_VAR|1<<OPTf_WARN_HEADER_MISMATCH;
- cc->htc.hash_mask=HTG_TYPE_MASK-HTT_IMPORT_SYS_SYM;
- cc->htc.define_hash_table=cc->htc.hash_table_lst=
- cc->htc.glbl_hash_table=cc->htc.local_hash_table=Fs->hash_table;
- if (flags&CCF_KEEP_AT_SIGN)
- cc->char_bmp_alpha_numeric=char_bmp_alpha_numeric_no_at;
- else
- cc->char_bmp_alpha_numeric=char_bmp_alpha_numeric;
- tmpf=LexFilePush(cc);
- QueInit(&cc->next_stream_blk);
- if (filename)
- tmpf->full_name=FileNameAbs(filename);
- else
- tmpf->full_name=StrNew(blkdev.tmp_filename);
- if (flags & CCF_PMT)
- buf=CAlloc(8);
- tmpf->buf=tmpf->buf_ptr=tmpf->line_start=cc->cur_buf_ptr=buf;
- tmpf->line_num=1;
- return cc;
-}
-
-U0 CmpCtrlDel(CCmpCtrl *cc)
-{//Free CCmpCtrl.
- while (LexFilePop(cc));
- LinkedLstDel(cc->lex_prs_stk);
- LinkedLstDel(cc->htc.next);
- Free(cc->ps);
- Free(cc->cur_str);
- Free(cc->cur_help_idx);
- Free(cc->dollar_buf);
- Free(cc);
-}
-
-I64 CmpCtrlSize(CCmpCtrl *cc)
-{//Mem size of CCmpCtrl and its members.
- CLexFile *tmpf=cc->lex_include_stk;
- I64 res=0;
- while (tmpf) {
- if (tmpf->next || !(cc->flags & CCF_DONT_FREE_BUF)) {
- if (tmpf->flags & LFSF_DOC) {
- if (tmpf->doc)
- res+=DocSize(tmpf->doc);
- } else
- res+=MSize2(tmpf->buf);
- }
- res+=MSize2(tmpf->full_name);
- res+=MSize2(tmpf);
- tmpf=tmpf->next;
- }
- res+=MSize2(cc->cur_str);
- res+=MSize2(cc);
- return res;
-}
-
-U32 lex_zeros=0;
-
-Bool LexDollar(CCmpCtrl *cc,CDoc *doc,CDocEntry *doc_e)
-{
- U8 *st;
- if (cc->flags&CCF_IN_QUOTES) {
- Free(cc->dollar_buf);
- st=Doc2PlainText(doc,doc_e);
- cc->dollar_buf=MStrPrint("$%$Q$",st);
- cc->dollar_cnt=2;
- Free(st);
- return TRUE;
- } else
- return FALSE;
-}
-
-I64 LexGetChar(CCmpCtrl *cc)
-{//Get one char from stream. Allow put-back one.
- U8 *ptr,*src;
- CLexFile *tmpf;
- CDoc *doc;
- CDocEntry *doc_e;
- if (!Btr(&cc->flags,CCf_USE_LAST_U16)) {
-lgc_start1:
- if (!(src=cc->cur_buf_ptr++)) {
- cc->cur_buf_ptr=NULL;
- goto lgc_here;
- }
- switch [cc->last_U16=*src++] {
- case 0:
-lgc_here:
- tmpf=cc->lex_include_stk;
- if (tmpf->flags & LFSF_DOC) {
- doc=tmpf->doc;
- doc_e=tmpf->cur_entry;
- doc_e=doc_e->next;
-lgc_start2:
- if (doc_e!=doc) {
- tmpf->cur_entry=doc_e;
- switch [doc_e->type_u8] {
- case DOCT_TEXT:
- if (doc_e->de_flags & ~(DOCEF_TAG|DOCEF_DEFINE|DOCEF_TAG_CB|
- DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT|
- DOCEF_SKIP|DOCEF_FILTER_SKIP) &&
- LexDollar(cc,doc,doc_e) && *(src=cc->dollar_buf)) {
- tmpf->line_num=doc_e->y+1;
- tmpf->buf_ptr=cc->cur_buf_ptr=src;
- } else if (*(src=doc_e->tag))
- tmpf->buf_ptr=cc->cur_buf_ptr=src;
- else {
- doc_e=doc_e->next;
- goto lgc_start2;
- }
- break;
- case DOCT_NEW_LINE:
- tmpf->buf_ptr=cc->cur_buf_ptr=&lex_zeros;
- tmpf->line_start=doc_e->next;
- tmpf->line_num=doc_e->y+2;//+1 because NEW_LINE is on prev line
-//+1 because doc y starts at zero
- cmp.compiled_lines++;
- cc->last_U16='\n';
- goto lgc_done;
- case DOCT_TAB:
- tmpf->buf_ptr=cc->cur_buf_ptr=&lex_zeros;
- tmpf->line_num=doc_e->y+1;
- cc->last_U16='\t';
- goto lgc_done;
- case DOCT_INS_BIN:
- tmpf->buf_ptr=cc->cur_buf_ptr=&lex_zeros;
- tmpf->line_num=doc_e->y+1;
- Free(cc->cur_str);
- cc->cur_str=NULL;
- cc->cur_str_len=0;
- if (doc_e->bin_data) {
- ptr=MAlloc(doc_e->bin_data->size);
- if (doc_e->bin_data->data)
- MemCpy(ptr,doc_e->bin_data->data,doc_e->bin_data->size);
- cc->cur_str=ptr;
- cc->cur_str_len=doc_e->bin_data->size;
- }
- cc->last_U16=TK_INS_BIN;
- goto lgc_done;
- case DOCT_INS_BIN_SIZE:
- tmpf->buf_ptr=cc->cur_buf_ptr=&lex_zeros;
- if (doc_e->bin_data)
- cc->cur_i64=doc_e->bin_data->size;
- else
- cc->cur_i64=0;
- tmpf->line_num=doc_e->y+1;
- cc->last_U16=TK_INS_BIN_SIZE;
- goto lgc_done;
- case DOCT_SHIFTED_Y:
- if (LexDollar(cc,doc,doc_e) && *(src=cc->dollar_buf)) {
- tmpf->line_num=doc_e->y+1;
- tmpf->buf_ptr=cc->cur_buf_ptr=src;
- } else {
- tmpf->buf_ptr=cc->cur_buf_ptr=&lex_zeros;
- tmpf->line_num=doc_e->y+1;
- if (doc_e->attr<0)
- cc->last_U16=TK_SUPERSCRIPT;
- else if (doc_e->attr>0)
- cc->last_U16=TK_SUBSCRIPT;
- else
- cc->last_U16=TK_NORMALSCRIPT;
- goto lgc_done;
- }
- break;
- case DOCT_MARKER:
- case DOCT_CURSOR:
- doc_e=doc_e->next;
- goto lgc_start2;
- case 0xFF: //nobound switch
- default:
- if (LexDollar(cc,doc,doc_e) && *(src=cc->dollar_buf)) {
- tmpf->line_num=doc_e->y+1;
- tmpf->buf_ptr=cc->cur_buf_ptr=src;
- } else {
- doc_e=doc_e->next;
- goto lgc_start2;
- }
- }
- }
- if (doc_e!=doc)
- goto lgc_start1;
- tmpf->cur_entry=doc->head.last; //When take next, will still be end.
- }
- tmpf=cc->lex_include_stk;
- if (tmpf->next) {
- tmpf=LexFilePop(cc);
- cc->cur_buf_ptr=tmpf->buf_ptr;
- cc->flags&=~CCF_USE_LAST_U16;
- if (!(cc->last_U16=tmpf->last_U16))
- goto lgc_start1;
- } else {
- if (cc->flags & CCF_PMT) {
- Free(tmpf->buf);
- ptr=CmdLinePmt;
- if (StrCmp(ptr,"\n") && !cc->pmt_line++ && !StrCmp(ptr,"?\n") &&
- cc->flags & CCF_QUESTION_HELP) {
- Free(ptr);
- ptr=StrNew("Help;;\n");
- }
- tmpf->buf=tmpf->buf_ptr=tmpf->line_start=cc->cur_buf_ptr=ptr;
- goto lgc_start1;
- } else {
- if (src)
- cc->cur_buf_ptr=src-1;
- cc->last_U16=TK_EOF;
- }
- }
- break;
- case CH_CURSOR:
- goto lgc_start1;
- case '\n':
- tmpf=cc->lex_include_stk;
- if (!(tmpf->flags & LFSF_DOC)) {
- tmpf->line_num++;
- cmp.compiled_lines++;
- tmpf->line_start=src;
- }
- break;
- case 0xFF: //nobound switch
- }
-lgc_done:
- if (cc->last_U16==CH_SHIFT_SPACE)
- cc->last_U16=CH_SPACE;
- if (cc->opts & OPTF_ECHO &&
- cc->last_U16<256 && Bt(char_bmp_printable,cc->last_U16))
- '' cc->last_U16;
- }
- return cc->last_U16;
-}
-
-U0 LexSkipEol(CCmpCtrl *cc)
-{//LexGetChar to NULL until end-of-line.
- I64 ch;
- do ch=LexGetChar(cc);
- while (Bt(char_bmp_non_eol,ch));
-}
-
-U8 *LexFirstRem(CCmpCtrl *cc,U8 *marker,I64 _len=NULL)
-{//LexGetChar() chars making str until marker.
- U8 *res,*ptr;
- CQueVectU8 *tmpv=QueVectU8New;
- I64 i,len=0;
- while (TRUE) {
- i=LexGetChar(cc);
- if (!i||StrOcc(marker,i))
- break;
- QueVectU8Put(tmpv,len++,i);
- }
- if (i)
- Bts(&cc->flags,CCf_USE_LAST_U16);
- res=ptr=MAlloc(len+1);
- for (i=0;i<len;i++)
- *ptr++=QueVectU8Get(tmpv,i);
- *ptr=0;
- QueVectU8Del(tmpv);
- if (_len) *_len=len;
- return res;
-}
-
-U0 LexIncludeStr(CCmpCtrl *cc,U8 *abs_filename,U8 *src,Bool actual_file)
-{
- LexBackupLastChar(cc);
- CLexFile *tmpf=LexFilePush(cc);
- if (actual_file)
- tmpf->full_name=StrNew(abs_filename);
- else
- tmpf->full_name=StrNew(blkdev.tmp_filename);
- tmpf->line_num=1;
- tmpf->buf=tmpf->buf_ptr=tmpf->line_start=cc->cur_buf_ptr=src;
-}
-
-CDoc *LexDocRead(U8 *abs_filename,I64 flags)
-{
- CDoc *doc=DocNew(abs_filename);
- U8 *src;
- I64 size=0;
- doc->flags|=flags;
- src=FileRead(abs_filename,&size);
- if (!src || !size) {
- Free(src);
- src=CAlloc(1);
- size=0;
- }
- DocLoad(doc,src,size);
- Free(src);
- return doc;
-}
-
-I64 cmp_type_flags_src_code[(DOCT_TYPES_NUM+63)/64]={
- 1<<DOCT_TEXT|1<<DOCT_TAB|1<<DOCT_INS_BIN|1<<DOCT_INS_BIN_SIZE};
-
-U0 LexAttachDoc(CCmpCtrl *cc,CLexFile *tmpf=NULL,
- CDoc *doc=NULL,U8 *abs_filename=NULL,CDocEntry *doc_e=NULL,I64 col=0)
-{//Start lexing doc. Give either doc or abs_filename.
- if (!doc)
- doc=LexDocRead(abs_filename,DOCF_DBL_DOLLARS);
- if (!tmpf) {
- LexBackupLastChar(cc);
- tmpf=LexFilePush(cc);
- }
- if (!doc_e)
- doc_e=doc->head.next;
- tmpf->full_name=StrNew(doc->filename.name);
- tmpf->doc=doc;
- while (doc_e!=doc) {
- if (Bt(cmp_type_flags_src_code,doc_e->type_u8))
- break;
- doc_e=doc_e->next;
- col=doc_e->min_col;
- }
- if (doc_e!=doc) {
- col=ClampI64(col,doc_e->min_col,doc_e->max_col);
- tmpf->line_start=doc_e;
- tmpf->buf=NULL;
- tmpf->line_num=doc_e->y+1;
- if (doc_e->type_u8==DOCT_TEXT) {
- tmpf->cur_entry=doc_e;
- tmpf->buf_ptr=doc_e->tag;
- } else {
- tmpf->cur_entry=doc_e->last; //TODO: might be problem at begin of file
- tmpf->buf_ptr=&lex_zeros;
- }
- tmpf->flags=LFSF_DOC;
- } else {//TODO: DocDel(doc)?
- col=0;
- tmpf->buf=tmpf->buf_ptr=tmpf->line_start=CAlloc(1);
- tmpf->line_num=1;
- tmpf->flags=0;
- }
- cc->cur_buf_ptr=tmpf->buf_ptr+col;
- tmpf->last_U16=0;
-}
-
-I64 LexInStr(CCmpCtrl *cc,U8 *buf,I64 size,Bool *done)
-{
- I64 i=0,j,k,ch;
- *done=TRUE;
- while (i<size-1) {
- ch=LexGetChar(cc);
- if (!ch || ch=='"') {
- buf[i++]=0;
- return i;
- } else if (ch=='\\') {
- switch (ch=LexGetChar(cc)) {
- case '0':
- buf[i++]=0;
- break;
- case '\'':
- buf[i++]='\'';
- break;
- case '\`':
- buf[i++]='\`';
- break;
- case '\\':
- buf[i++]='\\';
- break;
- case '"':
- buf[i++]='"';
- break;
- case 'd':
- buf[i++]='$';
- break;
- case 'n':
- buf[i++]='\n';
- break;
- case 'r':
- buf[i++]='\r';
- break;
- case 't':
- buf[i++]='\t';
- break;
- case 'x':
- case 'X':
- j=0;
- for (k=0;k<2;k++) {
- ch=ToUpper(LexGetChar(cc));
- if (Bt(char_bmp_hex_numeric,ch)) {
- if (ch<='9')
- j=j<<4+ch-'0';
- else
- j=j<<4+ch-'A'+10;
- } else {
- cc->flags|=CCF_USE_LAST_U16;
- break;
- }
- }
- buf[i++]=j;
- break;
- default:
- cc->flags|=CCF_USE_LAST_U16;
- buf[i++]='\\';
- }
- } else if (ch=='$') {
- buf[i++]='$';
- if (cc->dollar_cnt)
- cc->dollar_cnt--;
- else if (LexGetChar(cc)!='$') {
- cc->dollar_cnt=1;
- cc->flags|=CCF_USE_LAST_U16;
- }
- } else
- buf[i++]=ch;
- }
- *done=FALSE;
- return i;
-}
-
-I64 Lex(CCmpCtrl *cc)
-{//Fetch next token.
- I64 i,j,k,l,ch;
- CHash *tmph;
- Bool str_done,in_str,neg_e;
- U8 *fbuf,*buf2,*buf3,buf[STR_LEN];
- cc->last_line_num=cc->lex_include_stk->line_num;
- while (TRUE) {
-lex_cont:
- switch [ch=LexGetChar(cc)] {
- case 0:
- return cc->token=TK_EOF;
- case TK_SUPERSCRIPT:
- ch='>';
- goto lex_ident;
- case TK_SUBSCRIPT:
- ch='<';
- goto lex_ident;
- case TK_NORMALSCRIPT:
- ch='=';
- goto lex_ident;
- case '@':
- if (cc->flags&CCF_KEEP_AT_SIGN) {
- cc->token=ch;
- goto lex_end;
- }
- case 'A'...'Z':
- case 'a'...'z':
- case '_':
- case 128...255:
-lex_ident:
- i=0;
- buf[i++]=ch;
- while (TRUE) {
- if (i>=STR_LEN)
- LexExcept(cc,"Ident limited to STR_LEN chars at ");
- else if (!(ch=LexGetChar(cc)))
- break;
- else if (Bt(cc->char_bmp_alpha_numeric,ch))
- buf[i++]=ch;
- else if (ch==TK_SUPERSCRIPT)
- buf[i++]='>';
- else if (ch==TK_SUBSCRIPT)
- buf[i++]='<';
- else if (ch==TK_NORMALSCRIPT)
- buf[i++]='=';
- else {
- cc->flags|=CCF_USE_LAST_U16;
- break;
- }
- }
- buf[i++]=0;
- tmph=NULL;
- if (cc->htc.local_var_lst)
- cc->local_var_entry=MemberFind(buf,cc->htc.local_var_lst);
- else
- cc->local_var_entry=NULL;
- if (!cc->local_var_entry && cc->htc.hash_table_lst)
- tmph=HashFind(buf,cc->htc.hash_table_lst,cc->htc.hash_mask);
- if (tmph)
- j=tmph->type;
- else
- j=0;
- if (j & HTT_DEFINE_STR && !(cc->flags & CCF_NO_DEFINES)) {
- LexIncludeStr(cc,
- tmph->str,StrNew(tmph(CHashDefineStr *)->data),FALSE);
- cc->lex_include_stk->flags|=LFSF_DEFINE;
- } else {
- cc->hash_entry=tmph;
- Free(cc->cur_str);
- cc->cur_str=StrNew(buf);
- cc->cur_str_len=i;
- cc->token=TK_IDENT;
- goto lex_end;
- }
- break;
- case '0'...'9':
- i=ch-'0';
- ch=ToUpper(LexGetChar(cc));
- if (ch=='X') {
- while (TRUE) {
- ch=ToUpper(LexGetChar(cc));
- if (Bt(char_bmp_hex_numeric,ch)) {
- if (ch<='9')
- i=i<<4+ch-'0';
- else
- i=i<<4+ch-'A'+10;
- } else {
- cc->cur_i64=i;
- cc->flags|=CCF_USE_LAST_U16;
- cc->token=TK_I64;
- goto lex_end;
- }
- }
- } else if (ch=='B') {
- while (TRUE) {
- ch=LexGetChar(cc);
- if (ch=='0')
- i=i<<1;
- else if (ch=='1')
- i=i<<1+1;
- else {
- cc->cur_i64=i;
- cc->flags|=CCF_USE_LAST_U16;
- cc->token=TK_I64;
- goto lex_end;
- }
- }
- }
- while (TRUE) {
- if (Bt(char_bmp_dec_numeric,ch))
- i=i*10+ch-'0';
- else {
- if (ch=='.' || ch=='e' || ch=='E') break;
-lex_is_int:
- cc->cur_i64=i;
- cc->flags|=CCF_USE_LAST_U16;
- cc->token=TK_I64;
- goto lex_end;
- }
- ch=LexGetChar(cc);
- }
- if (ch=='.') {
- ch=LexGetChar(cc);
- if (ch=='.') {
- cc->flags|=CCF_LAST_WAS_DOT;
- goto lex_is_int;
- }
- }
-lex_float_start:
- k=0;
- while (TRUE) {
- if (Bt(char_bmp_dec_numeric,ch)) {
- i=i*10+ch-'0';
- k++;
- } else {
- if (ch=='e' || ch=='E')
- break;
- cc->cur_f64=i*Pow10I64(-k);
- cc->flags|=CCF_USE_LAST_U16;
- cc->token=TK_F64;
- goto lex_end;
- }
- ch=LexGetChar(cc);
- }
- ch=LexGetChar(cc);
- neg_e=FALSE;
- if (ch=='-') {
- neg_e=TRUE;
- ch=LexGetChar(cc);
- }
- j=0;
- while (TRUE) {
- if (Bt(char_bmp_dec_numeric,ch))
- j=j*10+ch-'0';
- else {
- if (neg_e)
- cc->cur_f64=i*Pow10I64(-j-k);
- else
- cc->cur_f64=i*Pow10I64(j-k);
- cc->flags|=CCF_USE_LAST_U16;
- cc->token=TK_F64;
- goto lex_end;
- }
- ch=LexGetChar(cc);
- }
- break;
- case '"':
- cc->flags|=CCF_IN_QUOTES;
- buf2=NULL;
- i=0;
- do {
- j=LexInStr(cc,buf,STR_LEN,&str_done);
- buf3=MAlloc(i+j);
- if (buf2) {
- MemCpy(buf3,buf2,i);
- Free(buf2);
- buf2=buf3;
- MemCpy(buf2+i,buf,j);
- } else {
- buf2=buf3;
- MemCpy(buf2,buf,j);
- }
- i+=j;
- } while (!str_done);
- Free(cc->cur_str);
- cc->cur_str=MAlloc(i);
- MemCpy(cc->cur_str,buf2,i);
- Free(buf2);
- cc->cur_str_len=i;
- cc->flags&=~CCF_IN_QUOTES;
- cc->token=TK_STR;
- goto lex_end;
- case '\'':
- if (cc->flags&CCF_NO_CHAR_CONST)
- break;
- k=0;
- for (j=0;j<8;j++) {
- if (!(ch=LexGetChar(cc)) || ch=='\'')
- break;
- if (ch=='\\') {
- switch (ch=LexGetChar(cc)) {
- case '0': k.u8[j]=0; break;
- case '\'': k.u8[j]='\''; break;
- case '\`': k.u8[j]='\`'; break;
- case '"': k.u8[j]='"'; break;
- case '\\': k.u8[j]='\\'; break;
- case 'd': k.u8[j]='$'; break;
- case 'n': k.u8[j]='\n'; break;
- case 'r': k.u8[j]='\r'; break;
- case 't': k.u8[j]='\t'; break;
- case 'x':
- case 'X':
- i=0;
- for (l=0;l<2;l++) {
- ch=ToUpper(LexGetChar(cc));
- if (Bt(char_bmp_hex_numeric,ch)) {
- if (ch<='9')
- i=i<<4+ch-'0';
- else
- i=i<<4+ch-'A'+10;
- } else {
- cc->flags|=CCF_USE_LAST_U16;
- break;
- }
- }
- k.u8[j]=i;
- break;
- default:
- k.u8[j]='\\';
- cc->flags|=CCF_USE_LAST_U16;
- }
- } else if (ch=='$') {
- ch=LexGetChar(cc);
- k.u8[j]='$';
- if (ch!='$')
- cc->flags|=CCF_USE_LAST_U16;
- } else
- k.u8[j]=ch;
- }
- if (ch!='\'' && (ch=LexGetChar(cc)) && ch!='\'')
- LexExcept(cc,"Char const limited to 8 chars at ");
- cc->cur_i64=k;
- cc->token=TK_CHAR_CONST;
- goto lex_end;
- case '#':
- if (cc->flags&CCF_KEEP_SIGN_NUM) {
- cc->token=ch;
- goto lex_end;
- }
- if (Lex(cc)!=TK_IDENT) //skip '#'
- goto lex_end;
- if (!(tmph=cc->hash_entry))
- goto lex_end;
- if (!(tmph->type & HTT_KEYWORD))
- goto lex_end;
- switch (i=tmph(CHashGeneric *)->user_data0) {
- case KW_INCLUDE:
- if (Lex(cc)!=TK_STR)
- goto lex_end;
- fbuf=ExtDft(cc->cur_str,"HC.Z");
- buf2=FileNameAbs(fbuf);
- Free(fbuf);
- if (Bt(&sys_run_level,RLf_DOC))
- LexAttachDoc(cc,,,buf2);
- else
- LexIncludeStr(cc,buf2,FileRead(buf2),TRUE);
- Free(buf2);
- break;
- case KW_DEFINE:
- cc->flags|=CCF_NO_DEFINES;
- if (Lex(cc)==TK_IDENT) {
- tmph=CAlloc(sizeof(CHashDefineStr));
- tmph->str=cc->cur_str;
- cc->cur_str=0;
- tmph->type=HTT_DEFINE_STR;
- HashSrcFileSet(cc,tmph);
-
- do ch=LexGetChar(cc); //skip space between define name and start
- while (Bt(char_bmp_non_eol_white_space,ch));
-
- i=j=0;
- buf2=NULL;
- if (ch) {
- in_str=FALSE;
- do {
- if (ch=='\\') {
- if (ch=LexGetChar(cc)) {
- if (ch!='\r' && ch!='\n') {
- buf[j++]='\\';
- buf[j++]=ch;
- } else if (ch=='\r' && LexGetChar(cc)!='\n')
- cc->flags|=CCF_USE_LAST_U16;
- } else {
- buf[j++]='\\';
- break;
- }
- } else if (ch!='\n') {
- if (ch=='\"')
- in_str=!in_str;
- buf[j++]=ch;
- } else
- break;
- while (ch=LexGetChar(cc)) {
- if (ch=='/') {
- ch=LexGetChar(cc);
- if (ch=='/' && !in_str) {
- do ch=LexGetChar(cc);
- while (Bt(char_bmp_non_eol,ch));
- break;
- } else {
- buf[j++]='/';
- cc->flags|=CCF_USE_LAST_U16;
- }
- } else if (ch=='\\') {
- if (ch=LexGetChar(cc)) {
- if (ch=='\"') {
- buf[j++]='\\';
- buf[j++]=ch;
- } else {
- cc->flags|=CCF_USE_LAST_U16;
- ch='\\';
- break;
- }
- }
- } else if (Bt(char_bmp_non_eol,ch)) {
- if (ch=='\"')
- in_str=!in_str;
- buf[j++]=ch;
- } else
- break;
- if (j>=STR_LEN-4) {//Spot for ['\'][ch],[ch],[0]
- buf[j++]=0;
- buf3=MAlloc(i+j);
- if (buf2) {
- MemCpy(buf3,buf2,i);
- Free(buf2);
- buf2=buf3;
- MemCpy(buf2+i,buf,j);
- } else {
- buf2=buf3;
- MemCpy(buf2,buf,j);
- }
- i+=j-1;
- j=0;
- }
- }
- } while (ch=='\\');
- }
- buf[j++]=0;
- buf3=MAlloc(i+j);
- if (buf2) {
- MemCpy(buf3,buf2,i);
- Free(buf2);
- buf2=buf3;
- MemCpy(buf2+i,buf,j);
- } else {
- buf2=buf3;
- MemCpy(buf2,buf,j);
- }
- tmph(CHashDefineStr *)->data=buf2;
- tmph(CHashDefineStr *)->cnt=-1;
- HashAdd(tmph,cc->htc.define_hash_table);
- }
- cc->flags&=~CCF_NO_DEFINES;
- break;
- case KW_ELSE:
- if (cc->flags & CCF_IN_IF) {
- cc->token=TK_ELSE;
- goto lex_end;
- }
-lex_else:
- j=1;
- do {
- if (ch=LexGetChar(cc)) {
- if (ch=='#') {
- if (!Lex(cc))
- goto lex_end;
- i=PrsKeyWord(cc);
- if (i==KW_IF || i==KW_IFDEF || i==KW_IFNDEF ||
- i==KW_IFAOT || i==KW_IFJIT)
- j++;
- else if (i==KW_ENDIF)
- j--;
- }
- } else {
- cc->token=TK_EOF;
- goto lex_end;
- }
- } while (j);
- break;
-
- case KW_IF:
- if (cc->flags & CCF_IN_IF) {
- cc->token=TK_IF;
- goto lex_end;
- }
-lex_if:
- cc->flags|=CCF_IN_IF;
- if (!Lex(cc)) {
- cc->flags&=~CCF_IN_IF;
- goto lex_end;
- }
- if (LexExpression(cc)) {
- cc->flags&=~CCF_IN_IF;
- switch (cc->token) {
- case TK_IF: goto lex_if;
- case TK_IFDEF: goto lex_ifdef;
- case TK_IFNDEF: goto lex_ifndef;
- case TK_IFAOT: goto lex_ifaot;
- case TK_IFJIT: goto lex_ifjit;
- case TK_ELSE: goto lex_else;
- case TK_ENDIF: goto lex_cont;
- default: goto lex_end;
- }
- } else {
- cc->flags&=~CCF_IN_IF;
- if (cc->token!=TK_ENDIF && cc->token!=TK_ELSE) {
- if (cc->token==TK_IF || cc->token==TK_IFDEF ||
- cc->token==TK_IFNDEF || cc->token==TK_IFAOT ||
- cc->token==TK_IFJIT)
- j=2;
- else
- j=1;
- do {
- if (ch=LexGetChar(cc)) {
- if (ch=='#') {
- if (!Lex(cc))
- goto lex_end;
- i=PrsKeyWord(cc);
- if (i==KW_IF || i==KW_IFDEF || i==KW_IFNDEF ||
- i==KW_IFAOT || i==KW_IFJIT)
- j++;
- else if (i==KW_ENDIF)
- j--;
- else if (i==KW_ELSE && j==1)
- break;
- }
- } else {
- cc->token=TK_EOF;
- goto lex_end;
- }
- } while (j);
- }
- }
- break;
- case KW_IFDEF:
- if (cc->flags & CCF_IN_IF) {
- cc->token=TK_IFDEF;
- goto lex_end;
- }
-lex_ifdef:
- cc->flags|=CCF_NO_DEFINES;
- if (!Lex(cc)) {
- cc->flags&=~CCF_NO_DEFINES;
- goto lex_end;
- }
- cc->flags&=~CCF_NO_DEFINES;
- if (cc->token!=TK_IDENT)
- goto lex_end;
- if (cc->hash_entry)
- goto lex_cont;
- j=1;
- do {
- if (ch=LexGetChar(cc)) {
- if (ch=='#') {
- if (!Lex(cc))
- goto lex_end;
- i=PrsKeyWord(cc);
- if (i==KW_IF || i==KW_IFDEF || i==KW_IFNDEF ||
- i==KW_IFAOT || i==KW_IFJIT)
- j++;
- else if (i==KW_ENDIF)
- j--;
- else if (i==KW_ELSE && j==1)
- break;
- }
- } else {
- cc->token=TK_EOF;
- goto lex_end;
- }
- } while (j);
- break;
- case KW_IFNDEF:
- if (cc->flags & CCF_IN_IF) {
- cc->token=TK_IFNDEF;
- goto lex_end;
- }
-lex_ifndef:
- cc->flags|=CCF_NO_DEFINES;
- if (!Lex(cc)) {
- cc->flags&=~CCF_NO_DEFINES;
- goto lex_end;
- }
- cc->flags&=~CCF_NO_DEFINES;
- if (cc->token!=TK_IDENT)
- goto lex_end;
- if (!cc->hash_entry)
- goto lex_cont;
- j=1;
- do {
- if (ch=LexGetChar(cc)) {
- if (ch=='#') {
- if (!Lex(cc))
- goto lex_end;
- i=PrsKeyWord(cc);
- if (i==KW_IF || i==KW_IFDEF || i==KW_IFNDEF ||
- i==KW_IFAOT || i==KW_IFJIT)
- j++;
- else if (i==KW_ENDIF)
- j--;
- else if (i==KW_ELSE && j==1)
- break;
- }
- } else {
- cc->token=TK_EOF;
- goto lex_end;
- }
- } while (j);
- break;
- case KW_IFAOT:
- if (cc->flags & CCF_IN_IF) {
- cc->token=TK_IFAOT;
- goto lex_end;
- }
-lex_ifaot:
- if (cc->flags & CCF_AOT_COMPILE)
- goto lex_cont;
- j=1;
- do {
- if (ch=LexGetChar(cc)) {
- if (ch=='#') {
- if (!Lex(cc))
- goto lex_end;
- i=PrsKeyWord(cc);
- if (i==KW_IF || i==KW_IFDEF || i==KW_IFNDEF ||
- i==KW_IFAOT || i==KW_IFJIT)
- j++;
- else if (i==KW_ENDIF)
- j--;
- else if (i==KW_ELSE && j==1)
- break;
- }
- } else {
- cc->token=TK_EOF;
- goto lex_end;
- }
- } while (j);
- break;
- case KW_IFJIT:
- if (cc->flags & CCF_IN_IF) {
- cc->token=TK_IFAOT;
- goto lex_end;
- }
-lex_ifjit:
- if (!(cc->flags & CCF_AOT_COMPILE))
- goto lex_cont;
- j=1;
- do {
- if (ch=LexGetChar(cc)) {
- if (ch=='#') {
- if (!Lex(cc))
- goto lex_end;
- i=PrsKeyWord(cc);
- if (i==KW_IF || i==KW_IFDEF || i==KW_IFNDEF ||
- i==KW_IFAOT || i==KW_IFJIT)
- j++;
- else if (i==KW_ENDIF)
- j--;
- else if (i==KW_ELSE && j==1)
- break;
- }
- } else {
- cc->token=TK_EOF;
- goto lex_end;
- }
- } while (j);
- break;
- case KW_ENDIF:
- if (cc->flags & CCF_IN_IF) {
- cc->token=TK_ENDIF;
- goto lex_end;
- }
- break;
- case KW_ASSERT:
- if (!Lex(cc))
- goto lex_end;
- if (!LexExpression(cc))
- LexWarn(cc,"Assert Failed ");
- goto lex_end;
- case KW_EXE:
- if (!Lex(cc))
- goto lex_end;
- PrsStreamBlk(cc);
- goto lex_end;
- case KW_HELP_INDEX:
- if (Lex(cc)!=TK_STR)
- goto lex_end;
- Free(cc->cur_help_idx);
- cc->cur_help_idx=LexExtStr(cc,,FALSE);
- break;
- case KW_HELP_FILE:
- if (Lex(cc)!=TK_STR)
- goto lex_end;
- tmph=CAlloc(sizeof(CHashSrcSym));
- fbuf=ExtDft(cc->cur_str,"DD.Z");
- tmph->str=FileNameAbs(fbuf);
- Free(fbuf);
- tmph->type=HTT_HELP_FILE|HTF_PUBLIC;
- HashSrcFileSet(cc,tmph);
- HashAdd(tmph,cc->htc.glbl_hash_table);
- break;
- }
- break;
- case '\n':
- if (!(cc->flags&CCF_KEEP_NEW_LINES))
- break; //else fall through
- case TK_INS_BIN:
- case TK_INS_BIN_SIZE:
- cc->token=ch;
- goto lex_end;
- case '.':
- if (cc->flags&CCF_KEEP_DOT) {
- cc->token=ch;
- goto lex_end;
- }
- if (cc->flags&CCF_LAST_WAS_DOT) {
- cc->flags&=~CCF_LAST_WAS_DOT;
- goto lex_dot_dot;
- }
- ch=LexGetChar(cc);
- if ('0'<=ch<='9') {
- i=0;
- goto lex_float_start;
- } else if (ch=='.') {
-lex_dot_dot:
- cc->token=TK_DOT_DOT;
- if (LexGetChar(cc)=='.')
- cc->token=TK_ELLIPSIS;
- else
- cc->flags|=CCF_USE_LAST_U16;
- goto lex_end;
- }
- cc->flags|=CCF_USE_LAST_U16;
- cc->token='.';
- goto lex_end;
- case '!':
- case '$'...'&':
- case '('...'-':
- case '/':
- case ':'...'?':
- case '[':
- case ']'...'^':
- case '{'...'~':
- case '`':
- if (!(i=cmp.dual_U16_tokens1[ch])) {
- if (ch=='$') {
- ch=LexGetChar(cc);
- if (ch=='$') {
- cc->token='$';
- goto lex_end;
- } else if (ch) {
- do ch=LexGetChar(cc);
- while (ch && ch!='$');
- if (!ch) {
- cc->token=TK_EOF;
- goto lex_end;
- } else
- goto lex_cont;
- } else {
- cc->flags|=CCF_USE_LAST_U16;
- cc->token='$';
- goto lex_end;
- }
- } else {
- cc->token=ch;
- goto lex_end;
- }
- } else {
- j=LexGetChar(cc);
- if (i.u16[0]==j) {
- i>>=16;
- if (!i) {// "/*"
- j=1;
- do {
- if (!(ch=LexGetChar(cc)))
- return cc->token=TK_EOF;
-lex_check_comment:
- if (ch=='*') {
- if (!(ch=LexGetChar(cc)))
- return cc->token=TK_EOF;
- if (ch=='/')
- j--;
- else
- goto lex_check_comment;
- } else if (ch=='/') {
- if (!(ch=LexGetChar(cc)))
- return cc->token=TK_EOF;
- if (ch=='*')
- j++;
- else
- goto lex_check_comment;
- }
- } while (j);
- goto lex_cont;
- } else {
- cc->token=i;
- goto lex_end;
- }
- }
- if (i=cmp.dual_U16_tokens2[ch]) {
- if (i.u16[0]==j) {
- i>>=16;
- if (!i) {// "//"
- LexSkipEol(cc);
- if (cc->flags&CCF_KEEP_NEW_LINES) {
- cc->token='\n';
- goto lex_end;
- } else
- goto lex_cont;
- } else {
- if (i==TK_SHL || i==TK_SHR) {
- j=LexGetChar(cc);
- if (j=='=') {
- if (i==TK_SHL)
- i=TK_SHL_EQU;
- else
- i=TK_SHR_EQU;
- } else
- cc->flags|=CCF_USE_LAST_U16;
- }
- cc->token=i;
- goto lex_end;
- }
- }
- if (i=cmp.dual_U16_tokens3[ch]) {
- if (i.u16[0]==j) {
- cc->token=i.u16[1];
- goto lex_end;
- }
- }
- }
- cc->flags|=CCF_USE_LAST_U16;
- cc->token=ch;
- goto lex_end;
- }
- case TK_TKS_NUM:
- break;
- }
- }
-lex_end:
- LexGetChar(cc); //Do this so WAS_NEW_LINE is right
- cc->flags|=CCF_USE_LAST_U16;
- return cc->token;
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/LexLib.HC.HTML b/public/src/Compiler/LexLib.HC.HTML deleted file mode 100644 index c8aba37..0000000 --- a/public/src/Compiler/LexLib.HC.HTML +++ /dev/null @@ -1,287 +0,0 @@ - - - - - LexLib.HC - - - - - U0 LexBackupLastChar(CCmpCtrl *cc)
-{
- CLexFile *tmpf=cc->lex_include_stk;
- tmpf->buf_ptr=cc->cur_buf_ptr;
- if (cc->flags & CCF_USE_LAST_U16) {
- tmpf->last_U16=cc->last_U16;
- cc->flags&=~CCF_USE_LAST_U16;
- } else
- tmpf->last_U16=0;
-}
-
-U0 LexPush(CCmpCtrl *cc)
-{//Create token-stream save point.
- CLexFile *tmpf;
- LexBackupLastChar(cc);
- if (cc->lex_include_stk->last_U16)
- cc->flags|=CCF_USE_LAST_U16;
- tmpf=MAllocIdent(cc->lex_include_stk);
- tmpf->next=cc->lex_prs_stk;
- cc->lex_prs_stk=tmpf;
-}
-
-U0 LexPopRestore(CCmpCtrl *cc)
-{//Restore token-stream saved-point.
-//Bad things can happen if you cross an #include file boundary.
- CLexFile *tmpf=cc->lex_prs_stk;
- cc->cur_buf_ptr=tmpf->buf_ptr;
- if (cc->last_U16=tmpf->last_U16)
- cc->flags|=CCF_USE_LAST_U16;
- else
- cc->flags&=~CCF_USE_LAST_U16;
- MemCpy(cc->lex_include_stk(U8 *)+sizeof(U8 *),tmpf(U8 *)+sizeof(U8 *),
- sizeof(CLexFile)-sizeof(U8 *));
- cc->lex_prs_stk=tmpf->next;
- Free(tmpf);
-}
-
-U0 LexPopNoRestore(CCmpCtrl *cc)
-{//Don't restore token-stream saved-point.
- CLexFile *tmpf=cc->lex_prs_stk;
- cc->lex_prs_stk=tmpf->next;
- Free(tmpf);
-}
-
-I64 MemberMetaData(U8 *needle_str,CMemberLst *haystack_member_lst)
-{//Find meta data name, return meta data val. See /Demo/ClassMeta.HC.
- CMemberLstMeta *meta=haystack_member_lst->meta;
- while (meta) {
- if (!StrCmp(meta->str,needle_str))
- return meta->user_data;
- meta=meta->next;
- }
- return 0;
-}
-
-CMemberLstMeta *MemberMetaFind(U8 *needle_str,CMemberLst *haystack_member_lst)
-{//Find meta data name, return meta data struct. See /Demo/ClassMeta.HC.
- CMemberLstMeta *meta=haystack_member_lst->meta;
- while (meta) {
- if (!StrCmp(meta->str,needle_str))
- return meta;
- meta=meta->next;
- }
- return NULL;
-}
-
-CMemberLst *MemberFind(U8 *needle_str,CHashClass *haystack_class)
-{//Find class member. See ClassRep() and DocForm().
- I64 i;
- CMemberLst *tmpm;
- do {
- tmpm=haystack_class->member_lst_and_root;
- while (tmpm) {
- if (!(i=StrCmp(tmpm->str,needle_str))) {
- tmpm->use_cnt++;
- return tmpm;
- }
- if (i<=0)
- tmpm=tmpm->left;
- else
- tmpm=tmpm->right;
- }
- } while (haystack_class=haystack_class->base_class);
- return NULL;
-}
-
-CMemberLst *MemberClassBaseFind(CHashClass *needle_class,
- CHashClass *haystack_class)
-{//Find class member class base. For finding dup class local vars.
- CMemberLst *tmpm;
- tmpm=haystack_class->member_class_base_root;
- while (tmpm) {
- if (needle_class==tmpm->member_class_base)
- return tmpm;
- if (needle_class<tmpm->member_class_base)
- tmpm=tmpm->left_class_base;
- else
- tmpm=tmpm->right_class_base;
- }
- return NULL;
-}
-
-U0 MemberAdd(CCmpCtrl *cc,CMemberLst *tmpm,CHashClass *tmpc,I64 mode)
-{
- U8 *st=tmpm->str;
- CMemberLst **tmpm1,*tmpm2;
-
- if (MemberFind(st,tmpc) && StrCmp(st,"pad") &&
- StrCmp(st,"reserved") && StrCmp(st,"_anon_"))
- LexExcept(cc,"Duplicate member at ");
- tmpm1=&tmpc->member_lst_and_root;
- while (tmpm2=*tmpm1) {
- if (StrCmp(tmpm2->str,st)<=0)
- tmpm1=&tmpm2->left;
- else
- tmpm1=&tmpm2->right;
- }
- *tmpm1=tmpm;
-
- if (mode==PRS1B_LOCAL_VAR) {
- tmpm->member_class_base=
- tmpm->member_class-tmpm->member_class->ptr_stars_cnt;
- if (Bt(&cc->opts,OPTf_WARN_DUP_TYPES) &&
- MemberClassBaseFind(tmpm->member_class_base,tmpc))
- LexWarn(cc,"Duplicate type at ");
- tmpm1=&tmpc->member_class_base_root;
- while (tmpm2=*tmpm1) {
- if (tmpm->member_class_base<tmpm2->member_class_base)
- tmpm1=&tmpm2->left_class_base;
- else if (tmpm->member_class_base>tmpm2->member_class_base)
- tmpm1=&tmpm2->right_class_base;
- else {
- tmpm1=NULL;
- break;
- }
- }
- if (tmpm1)
- *tmpm1=tmpm;
- } else
- tmpm->member_class_base=NULL;
-
- tmpm->left=NULL;
- tmpm->right=NULL;
- tmpm->left_class_base=NULL;
- tmpm->right_class_base=NULL;
- tmpm2=tmpc->last_in_member_lst;
- tmpm2->next=tmpc->last_in_member_lst=tmpm;
-}
-
-CMemberLst *MemberLstNew(I64 _reg)
-{
- CMemberLst *res=CAlloc(sizeof(CMemberLst));
- res->reg=_reg;
- return res;
-}
-
-Bool MemberLstCmp(CMemberLst *tmpm1,CMemberLst *tmpm2,I64 cnt=I64_MAX)
-{
- while (tmpm1 && tmpm2 && cnt--) {
- if (StrCmp(tmpm1->str,tmpm2->str) ||
- tmpm1->member_class!=tmpm2->member_class ||
- tmpm1->member_class_base!=tmpm2->member_class_base)
- return FALSE;
- if (tmpm1->flags&MLF_DFT_AVAILABLE || tmpm2->flags&MLF_DFT_AVAILABLE) {
- if (tmpm1->flags&(MLF_DFT_AVAILABLE|MLF_STR_DFT_AVAILABLE)!=
- tmpm2->flags&(MLF_DFT_AVAILABLE|MLF_STR_DFT_AVAILABLE))
- return FALSE;
- if (tmpm1->flags&MLF_STR_DFT_AVAILABLE) {
- if (StrCmp(tmpm1->dft_val,tmpm2->dft_val))
- return FALSE;
- } else if (tmpm1->dft_val!=tmpm2->dft_val)
- return FALSE;
- }
- tmpm1=tmpm1->next;
- tmpm2=tmpm2->next;
- }
- if (cnt<0 || !tmpm1 && !tmpm2)
- return TRUE;
- else
- return FALSE;
-}
-
-U0 MemberLstDel(CMemberLst *tmpm)
-{
- CMemberLst *tmpm1;
- CMemberLstMeta *tmp_meta,*tmp_meta1;
- while (tmpm) {
- tmpm1=tmpm->next;
- Free(tmpm->str);
- LinkedLstDel(tmpm->dim.next);
- if (tmpm->flags & MLF_STR_DFT_AVAILABLE)
- Free(tmpm->dft_val);
- if (tmpm->flags & MLF_FUN)
- HashDel(tmpm->fun_ptr-tmpm->fun_ptr->ptr_stars_cnt);
- tmp_meta=tmpm->meta;
- while (tmp_meta) {
- tmp_meta1=tmp_meta->next;
- Free(tmp_meta->str);
- if (tmp_meta->flags&MLMF_IS_STR)
- Free(tmp_meta->user_data);
- Free(tmp_meta);
- tmp_meta=tmp_meta1;
- }
- Free(tmpm);
- tmpm=tmpm1;
- }
-}
-
-U0 ClassMemberLstDel(CHashClass *tmpc)
-{
- MemberLstDel(tmpc->member_lst_and_root);
- tmpc->size=0;
- tmpc->last_in_member_lst=&tmpc->member_lst_and_root;
- tmpc->member_lst_and_root=NULL;
- tmpc->member_class_base_root=NULL;
- tmpc->member_cnt=0;
- if (tmpc->type&HTT_FUN)
- tmpc(CHashFun *)->arg_cnt=0;
-}
-
-I64 MemberLstSize(CHashClass *tmpc)
-{
- CMemberLst *tmpm;
- CMemberLstMeta *tmp_meta;
- I64 res=0;
- tmpm=tmpc->member_lst_and_root;
- while (tmpm) {
- res+=MSize2(tmpm->str);
- res+=LinkedLstSize(tmpm->dim.next);
- if (tmpm->flags & MLF_STR_DFT_AVAILABLE)
- res+=MSize2(tmpm->dft_val);
- if (tmpm->flags & MLF_FUN)
- res+=HashEntrySize2(tmpm->fun_ptr-tmpm->fun_ptr->ptr_stars_cnt);
- tmp_meta=tmpm->meta;
- while (tmp_meta) {
- res+=MSize2(tmp_meta->str);
- if (tmp_meta->flags&MLMF_IS_STR)
- res+=MSize2(tmp_meta->user_data);
- res+=MSize2(tmp_meta);
- tmp_meta=tmp_meta->next;
- }
- res+=MSize2(tmpm);
- tmpm=tmpm->next;
- }
- return res;
-}
-
-U8 *LexExtStr(CCmpCtrl *cc,I64 *_size=NULL,Bool lex_next=TRUE)
-{//Lex TK_STR's to one combined str. _size includes terminator.
- I64 len=cc->cur_str_len,len1,len2;
- U8 *st=cc->cur_str,*st1,*st2;
- cc->cur_str=NULL;
- while (cc->token==TK_STR) {
- st1=st;
- len1=len;
- if (!lex_next && LexGetChar(cc)!='\\') {
- cc->flags|=CCF_USE_LAST_U16;
- break;
- }
- if (Lex(cc)==TK_STR) {
- len2=cc->cur_str_len;
- st2=cc->cur_str;
- cc->cur_str=NULL;
- len=len1+len2-1;
- st=MAlloc(len);
- if (len1>1)
- MemCpy(st,st1,len1-1);
- MemCpy(st+len1-1,st2,len2);
- Free(st1);
- Free(st2);
- }
- }
- if (_size) *_size=len;
- return st;
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/OptLib.HC.HTML b/public/src/Compiler/OptLib.HC.HTML deleted file mode 100644 index 55e76be..0000000 --- a/public/src/Compiler/OptLib.HC.HTML +++ /dev/null @@ -1,577 +0,0 @@ - - - - - OptLib.HC - - - - - CCodeMisc *OptLabelFwd(CCodeMisc *lb)
-{
- CCodeMisc *lb1;
- while (lb1=lb->fwd)
- lb=lb1;
- return lb;
-}
-
-CHashClass *OptClassFwd(CHashClass *tmpc)
-{//Class forwarding for unions and subclasses.
- CHashClass *tmpc1;
- while (tmpc1=tmpc->fwd_class)
- tmpc=tmpc1;
- return tmpc;
-}
-
-U0 OptSetNOP1(CIntermediateCode *tmpi)
-{
- tmpi->ic_code=IC_NOP1;
- tmpi->ic_flags=0;
- tmpi->arg1.type=MDF_NULL+tmpi->arg1.type.raw_type;
- tmpi->res.type =MDF_NULL+tmpi->res.type.raw_type;
-}
-
-U0 OptSetNOP2(CIntermediateCode *tmpi,I64 stk_delta=1)
-{
- tmpi->ic_code=IC_NOP2;
- tmpi->ic_data=stk_delta;
- tmpi->arg1.type=MDF_NULL+tmpi->arg1.type.raw_type;
- tmpi->res.type =MDF_NULL+tmpi->res.type.raw_type;
-}
-
-CIntermediateCode *OptFree(CIntermediateCode *tmpi)
-{//We might access freed entries in CICTreeLinks
- QueRem(tmpi);
- Free(tmpi);
- return NULL;
-}
-
-CIntermediateCode *OptLag(CIntermediateCode *tmpi)
-{
- do {
- if (!tmpi->ic_code)
- return NULL;
- else
- tmpi=tmpi->last;
- } while (tmpi->ic_code<=IC_END_EXP);
- return tmpi;
-}
-
-CIntermediateCode *OptLag1(CIntermediateCode *tmpi)
-{
- do {
- if (!tmpi->ic_code)
- return NULL;
- else
- tmpi=tmpi->last;
- } while (tmpi->ic_code==IC_NOP1||tmpi->ic_code==IC_NOP2);
- return tmpi;
-}
-
-CIntermediateCode *OptLag2(CIntermediateCode *tmpi)
-{
- do {
- if (!tmpi->ic_code)
- return NULL;
- else
- tmpi=tmpi->last;
- } while (tmpi->ic_code<IC_END_EXP);
- return tmpi;
-}
-
-CIntermediateCode *OptLead1(CIntermediateCode *tmpi)
-{
- do {
- tmpi=tmpi->next;
- if (!tmpi->ic_code)
- return NULL;
- } while (tmpi->ic_code==IC_NOP1||tmpi->ic_code==IC_NOP2);
- return tmpi;
-}
-
-I64 CmpOffset2Reg(I64 offset,COptReg *reg_offsets)
-{
- I64 i;
- for (i=0;i<REG_REGS_NUM;i++)
- if (offset==reg_offsets[i].offset)
- return i;
- return -1;
-}
-
-#define FBO1_NOT_CONST 0
-#define FBO1_INT 1
-#define FBO1_F64 2
-
-Bool OptFixupBinaryOp1(CIntermediateCode *tmpi,
- CIntermediateCode *tmpi1,CIntermediateCode *tmpi2,
- Bool *is_unsigned)
-{
- CIntermediateCode *tmpii;
- CHashClass *tmpc=tmpi->ic_class,*tmpc1,*tmpc2;
-
- if (tmpi1->ic_flags&ICF_RES_TO_INT)
- tmpc1=cmp.internal_types[RT_I64];
- else if (tmpi1->ic_flags&ICF_RES_TO_F64)
- tmpc1=cmp.internal_types[RT_F64];
- else {
- tmpc1=OptClassFwd(tmpi1->ic_class);
- }
-
- if (tmpi2->ic_flags&ICF_RES_TO_INT)
- tmpc2=cmp.internal_types[RT_I64];
- else if (tmpi2->ic_flags&ICF_RES_TO_F64)
- tmpc2=cmp.internal_types[RT_F64];
- else {
- tmpc2=OptClassFwd(tmpi2->ic_class);
- }
-
- if (tmpc1->raw_type>tmpc2->raw_type)
- tmpc=tmpi->ic_class=tmpc1;
- else
- tmpc=tmpi->ic_class=tmpc2;
-
- if (tmpc->raw_type==RT_F64) {
- if (tmpi1->ic_code==IC_IMM_I64) {
- tmpi1->ic_data(F64)=tmpi1->ic_data;
- tmpi1->ic_class=cmp.internal_types[RT_F64];
- tmpi1->ic_code=IC_IMM_F64;
- tmpi1->ic_flags&=~ICF_RES_TO_F64;
- } else
- if (tmpc1->raw_type!=RT_F64)
- tmpi1->ic_flags|=ICF_RES_TO_F64;
- if (tmpi2->ic_code==IC_IMM_I64) {
- tmpi2->ic_data(F64)=tmpi2->ic_data;
- tmpi2->ic_class=cmp.internal_types[RT_F64];
- tmpi2->ic_code=IC_IMM_F64;
- tmpi2->ic_flags&=~ICF_RES_TO_F64;
- } else
- if (tmpc2->raw_type!=RT_F64)
- tmpi2->ic_flags|=ICF_RES_TO_F64;
- if (IC_LESS<=tmpi->ic_code<=IC_GREATER_EQU && (tmpii=OptLead1(tmpi)) &&
- tmpii->ic_code!=IC_PUSH_CMP && tmpii->ic_code!=IC_AND_AND) {
-//We are looking for float comparisons to zero to convert to int.
- if (tmpi1->ic_code==IC_IMM_F64 && !tmpi1->ic_data &&
- tmpi2->ic_code==IC_DEREF && tmpc2==cmp.internal_types[RT_F64]) {
- tmpi1->ic_code==IC_IMM_I64;
- goto fb_here1;
- } else if (tmpi2->ic_code==IC_IMM_F64 && !tmpi2->ic_data &&
- tmpi1->ic_code==IC_DEREF && tmpc1==cmp.internal_types[RT_F64]) {
- tmpi2->ic_code==IC_IMM_I64;
-fb_here1:
- tmpi1->ic_flags&=~ICF_RES_TO_F64;
- tmpi->ic_class=tmpi1->ic_class=tmpi2->ic_class=
- cmp.internal_types[RT_I64];
- *is_unsigned=FALSE;
- return FBO1_NOT_CONST;
- }
- goto fb_here2;
- } else {
-fb_here2:
- if (tmpi1->ic_code==IC_IMM_F64 && tmpi2->ic_code==IC_IMM_F64 &&
- !(tmpi->ic_flags&(ICF_PUSH_CMP|ICF_POP_CMP))) {
- tmpi->ic_flags|=tmpi1->ic_flags|tmpi2->ic_flags;
- OptSetNOP1(tmpi1);
- OptSetNOP1(tmpi2);
- return FBO1_F64;
- } else
- return FBO1_NOT_CONST;
- }
- }
- *is_unsigned=tmpc1->raw_type&RTF_UNSIGNED || tmpc2->raw_type&RTF_UNSIGNED;
- if (tmpi1->ic_code==IC_IMM_I64 && tmpi2->ic_code==IC_IMM_I64 &&
- !(tmpi->ic_flags&(ICF_PUSH_CMP|ICF_POP_CMP))) {
- tmpi->ic_flags|=tmpi1->ic_flags|tmpi2->ic_flags;
- OptSetNOP1(tmpi1);
- OptSetNOP1(tmpi2);
- return FBO1_INT;
- } else
- return FBO1_NOT_CONST;
-}
-
-Bool OptFixupBinaryOp2(CIntermediateCode **tmpi1,CIntermediateCode **tmpi2)
-{
- CIntermediateCode *tmpii1=*tmpi1,
- *tmpii2=*tmpi2;
- if (tmpii1->ic_code==IC_IMM_I64 && !(tmpii1->ic_flags & ICF_RES_TO_F64))
- return TRUE;
- if (tmpii2->ic_code==IC_IMM_I64 && !(tmpii2->ic_flags & ICF_RES_TO_F64)) {
- *tmpi1=tmpii2;
- *tmpi2=tmpii1;
- return TRUE;
- }
- return FALSE;
-}
-
-Bool OptFixupUnaryOp(CIntermediateCode *tmpi, CIntermediateCode *tmpi1,
- Bool *is_unsigned)
-{
- CHashClass *tmpc,*tmpc1;
- tmpc1=OptClassFwd(tmpi1->ic_class);
- tmpi->ic_class=tmpc1;
- tmpc=tmpi->ic_class;
- if (tmpc->raw_type==RT_F64) {
- if (tmpi1->ic_code==IC_IMM_I64) {
- tmpi1->ic_data(F64)=tmpi1->ic_data;
- tmpi1->ic_class=cmp.internal_types[RT_F64];
- tmpi1->ic_code=IC_IMM_F64;
- tmpi1->ic_flags&=~ICF_RES_TO_F64;
- } else
- if (tmpc1->raw_type!=RT_F64)
- tmpi1->ic_flags|=ICF_RES_TO_F64;
- if (tmpi1->ic_code==IC_IMM_F64) {
- tmpi->ic_flags|=tmpi1->ic_flags;
- OptSetNOP1(tmpi1);
- return FBO1_F64;
- } else
- return FBO1_NOT_CONST;
- }
- *is_unsigned=tmpc1->raw_type&RTF_UNSIGNED;
- if (tmpi1->ic_code==IC_IMM_I64) {
- tmpi->ic_flags|=tmpi1->ic_flags;
- OptSetNOP1(tmpi1);
- return FBO1_INT;
- } else
- return FBO1_NOT_CONST;
-}
-
-extern CIntermediateCode *OptBrNotZero(CCmpCtrl *cc,CIntermediateCode *tmpi);
-
-CIntermediateCode *OptBrZero(CCmpCtrl *cc,CIntermediateCode *tmpi)
-{
- CCodeMisc *lb_true,*lb_false;
- CIntermediateCode *tmpii=OptLag(tmpi),*tmpii2;
- switch (tmpii->ic_code) {
- case IC_NOT:
- tmpi->ic_code=IC_BR_NOT_ZERO;
- tmpi->ic_class=tmpii->ic_class;
- tmpi->ic_flags|=tmpii->ic_flags;
- tmpi->t.arg1_class=tmpii->t.arg1_class;
- tmpi->t.arg1_tree=tmpii->t.arg1_tree;
- OptFree(tmpii);
- return OptBrNotZero(cc,tmpi);
- case IC_EQU_EQU...IC_LESS_EQU:
- tmpi->ic_code=(tmpii->ic_code-IC_EQU_EQU)^1+IC_BR_EQU_EQU;
- break;
- case IC_OR_OR:
- tmpi->ic_code=IC_BR_OR_OR_ZERO;
- break;
- case IC_AND_AND:
- tmpi->ic_code=IC_BR_AND_AND_ZERO;
- break;
- case IC_AND:
- tmpi->ic_code=IC_BR_AND_ZERO;
- break;
- case IC_MM_:
- if (cc->pass==2 && !(tmpii->ic_flags&ICF_RES_TO_F64) &&
- tmpii->ic_class->raw_type!=RT_F64)
- tmpi->ic_code=IC_BR_MM_ZERO;
- break;
- case IC_CALL_END:
- tmpii2=OptLag(tmpii);
- switch (tmpii2->ic_code) {
- start:
- case IC_CARRY:
- tmpii2->ic_code=IC_BR_NOT_CARRY;
- break;
- case IC_BT:
- tmpii2->ic_code=IC_BR_NOT_BT;
- break;
- case IC_LBTS:
- tmpii2->ic_flags|=ICF_LOCK;
- case IC_BTS:
- tmpii2->ic_code=IC_BR_NOT_BTS;
- break;
- case IC_LBTR:
- tmpii2->ic_flags|=ICF_LOCK;
- case IC_BTR:
- tmpii2->ic_code=IC_BR_NOT_BTR;
- break;
- case IC_LBTC:
- tmpii2->ic_flags|=ICF_LOCK;
- case IC_BTC:
- tmpii2->ic_code=IC_BR_NOT_BTC;
- break;
- end:
- tmpii2->ic_data=tmpi->ic_data;
- tmpii->ic_code=IC_CALL_END2;
- OptSetNOP1(tmpi);
- return tmpii;
- }
- break;
- }
- if (tmpi->ic_code!=IC_BR_ZERO) {
- tmpi->ic_class=tmpii->ic_class;
- tmpi->ic_flags|=tmpii->ic_flags;
- tmpi->t.arg1_class=tmpii->t.arg1_class;
- tmpi->t.arg2_class=tmpii->t.arg2_class;
- tmpi->t.arg1_tree=tmpii->t.arg1_tree;
- tmpi->t.arg2_tree=tmpii->t.arg2_tree;
- OptFree(tmpii);
-
- if (tmpi->ic_flags&ICF_PUSH_CMP &&
- IC_BR_NOT_EQU<=tmpi->ic_code<=IC_BR_LESS_EQU &&
- !(tmpi->ic_flags&ICF_USE_F64)) {
- tmpi->ic_code+=IC_BR_EQU_EQU2-IC_BR_EQU_EQU;
- tmpi->ic_flags&=~ICF_PUSH_CMP;
- tmpii=tmpi->next; //IC_PUSH_CMP inst
- while (tmpii->ic_code!=IC_PUSH_CMP)
- tmpii=tmpii->next;
- tmpii->t.arg1_tree=tmpi;
- OptSetNOP1(tmpii);
- }
-
- lb_true=tmpi->ic_data;
- if (tmpi->ic_code==IC_BR_AND_AND_ZERO) {
- tmpii=tmpi->t.arg1_tree->next;
- tmpii->ic_data=lb_true;
- tmpii->t.arg1_tree=tmpi->t.arg1_tree;
- tmpii->t.arg1_class=tmpi->t.arg1_class;
- tmpii->ic_code=IC_BR_ZERO;
- OptBrZero(cc,tmpii);
- tmpii=tmpi->t.arg2_tree->next;
- tmpii->t.arg1_tree=tmpi->t.arg2_tree;
- tmpii->t.arg1_class=tmpi->t.arg2_class;
- tmpii->ic_data=lb_true;
- tmpii->ic_code=IC_BR_ZERO;
- tmpii=OptBrZero(cc,tmpii);
- OptSetNOP1(tmpi);
- } else if (tmpi->ic_code==IC_BR_OR_OR_ZERO) {
- lb_false=COCMiscNew(cc,CMT_LABEL);
- tmpi->ic_code=IC_LABEL;
- tmpi->ic_flags=0;
- tmpi->ic_data=lb_false;
- tmpii=tmpi->t.arg1_tree->next;
- tmpii->t.arg1_tree=tmpi->t.arg1_tree;
- tmpii->t.arg1_class=tmpi->t.arg1_class;
- tmpii->ic_data=lb_false;
- tmpii->ic_code=IC_BR_NOT_ZERO;
- OptBrNotZero(cc,tmpii);
- tmpii=tmpi->t.arg2_tree->next;
- tmpii->t.arg1_tree=tmpi->t.arg2_tree;
- tmpii->t.arg1_class=tmpi->t.arg2_class;
- tmpii->ic_data=lb_true;
- tmpii->ic_code=IC_BR_ZERO;
- tmpii=OptBrZero(cc,tmpii);
- } else
- tmpii=tmpi;
- if (tmpi->ic_flags&ICF_POP_CMP && tmpi->t.arg1_tree->ic_code==IC_NOP1) {
- tmpi->t.arg1_tree=tmpi->t.arg1_tree->t.arg1_tree;
- tmpi->ic_flags&=~ICF_POP_CMP;
- }
- return tmpii;
- }
- return tmpi;
-}
-
-CIntermediateCode *OptBrNotZero(CCmpCtrl *cc,CIntermediateCode *tmpi)
-{
- CCodeMisc *lb_true,*lb_false;
- CIntermediateCode *tmpii=OptLag(tmpi),*tmpii2;
- switch (tmpii->ic_code) {
- case IC_NOT:
- tmpi->ic_code=IC_BR_ZERO;
- tmpi->ic_class=tmpii->ic_class;
- tmpi->ic_flags|=tmpii->ic_flags;
- tmpi->t.arg1_class=tmpii->t.arg1_class;
- tmpi->t.arg1_tree=tmpii->t.arg1_tree;
- OptFree(tmpii);
- return OptBrZero(cc,tmpi);
- case IC_EQU_EQU...IC_LESS_EQU:
- tmpi->ic_code=tmpii->ic_code+IC_BR_EQU_EQU-IC_EQU_EQU;
- break;
- case IC_OR_OR:
- tmpi->ic_code=IC_BR_OR_OR_NOT_ZERO;
- break;
- case IC_AND_AND:
- tmpi->ic_code=IC_BR_AND_AND_NOT_ZERO;
- break;
- case IC_AND:
- tmpi->ic_code=IC_BR_AND_NOT_ZERO;
- break;
- case IC_MM_:
- if (cc->pass==2 && !(tmpii->ic_flags&ICF_RES_TO_F64) &&
- tmpii->ic_class->raw_type!=RT_F64)
- tmpi->ic_code=IC_BR_MM_NOT_ZERO;
- break;
- case IC_CALL_END:
- tmpii2=OptLag(tmpii);
- switch (tmpii2->ic_code) {
- start:
- case IC_CARRY:
- tmpii2->ic_code=IC_BR_CARRY;
- break;
- case IC_BT:
- tmpii2->ic_code=IC_BR_BT;
- break;
- case IC_LBTS:
- tmpii2->ic_flags|=ICF_LOCK;
- case IC_BTS:
- tmpii2->ic_code=IC_BR_BTS;
- break;
- case IC_LBTR:
- tmpii2->ic_flags|=ICF_LOCK;
- case IC_BTR:
- tmpii2->ic_code=IC_BR_BTR;
- break;
- case IC_LBTC:
- tmpii2->ic_flags|=ICF_LOCK;
- case IC_BTC:
- tmpii2->ic_code=IC_BR_BTC;
- break;
- end:
- tmpii2->ic_data=tmpi->ic_data;
- tmpii->ic_code=IC_CALL_END2;
- OptSetNOP1(tmpi);
- return tmpii;
- }
- break;
- }
- if (tmpi->ic_code!=IC_BR_NOT_ZERO) {
- tmpi->ic_class=tmpii->ic_class;
- tmpi->ic_flags|=tmpii->ic_flags;
- tmpi->t.arg1_class=tmpii->t.arg1_class;
- tmpi->t.arg2_class=tmpii->t.arg2_class;
- tmpi->t.arg1_tree=tmpii->t.arg1_tree;
- tmpi->t.arg2_tree=tmpii->t.arg2_tree;
- OptFree(tmpii);
-
- if (tmpi->ic_flags&ICF_PUSH_CMP &&
- IC_BR_NOT_EQU<=tmpi->ic_code<=IC_BR_LESS_EQU &&
- !(tmpi->ic_flags&ICF_USE_F64)) {
- tmpi->ic_code+=IC_BR_EQU_EQU2-IC_BR_EQU_EQU;
- tmpi->ic_flags&=~ICF_PUSH_CMP;
- tmpii=tmpi->next; //IC_PUSH_CMP inst
- while (tmpii->ic_code!=IC_PUSH_CMP)
- tmpii=tmpii->next;
- tmpii->t.arg1_tree=tmpi;
- OptSetNOP1(tmpii);
- }
-
- lb_true=tmpi->ic_data;
- if (tmpi->ic_code==IC_BR_OR_OR_NOT_ZERO) {
- tmpii=tmpi->t.arg1_tree->next;
- tmpii->t.arg1_tree=tmpi->t.arg1_tree;
- tmpii->t.arg1_class=tmpi->t.arg1_class;
- tmpii->ic_data=lb_true;
- tmpii->ic_code=IC_BR_NOT_ZERO;
- OptBrNotZero(cc,tmpii);
- tmpii=tmpi->t.arg2_tree->next;
- tmpii->t.arg1_tree=tmpi->t.arg2_tree;
- tmpii->t.arg1_class=tmpi->t.arg2_class;
- tmpii->ic_data=lb_true;
- tmpii->ic_code=IC_BR_NOT_ZERO;
- tmpii=OptBrNotZero(cc,tmpii);
- OptSetNOP1(tmpi);
- } else if (tmpi->ic_code==IC_BR_AND_AND_NOT_ZERO) {
- lb_false=COCMiscNew(cc,CMT_LABEL);
- tmpi->ic_code=IC_LABEL;
- tmpi->ic_flags=0;
- tmpi->ic_data=lb_false;
- tmpii=tmpi->t.arg1_tree->next;
- tmpii->t.arg1_tree=tmpi->t.arg1_tree;
- tmpii->t.arg1_class=tmpi->t.arg1_class;
- tmpii->ic_data=lb_false;
- tmpii->ic_code=IC_BR_ZERO;
- OptBrZero(cc,tmpii);
- tmpii=tmpi->t.arg2_tree->next;
- tmpii->t.arg1_tree=tmpi->t.arg2_tree;
- tmpii->t.arg1_class=tmpi->t.arg2_class;
- tmpii->ic_data=lb_true;
- tmpii->ic_code=IC_BR_NOT_ZERO;
- tmpii=OptBrNotZero(cc,tmpii);
- } else
- tmpii=tmpi;
- if (tmpi->ic_flags&ICF_POP_CMP && tmpi->t.arg1_tree->ic_code==IC_NOP1) {
- tmpi->t.arg1_tree=tmpi->t.arg1_tree->t.arg1_tree;
- tmpi->ic_flags&=~ICF_POP_CMP;
- }
- return tmpii;
- }
- return tmpi;
-}
-
-U0 OptFixSizeOf(CIntermediateCode *tmpi1,
- CIntermediateCode *tmpi_push,CHashClass *tmpcc)
-{
- if (tmpi1->ic_code==IC_MUL && tmpi1->t.arg2_tree->ic_code==IC_SIZEOF) {
- tmpi1->t.arg2_tree->ic_code=IC_IMM_I64;
- tmpi1->t.arg2_tree->ic_class=tmpcc;
- tmpi_push->ic_class=tmpcc;
- if (tmpcc->ptr_stars_cnt) {
- tmpcc--;
- if (tmpcc->size==1)
- goto here;
- tmpi1->t.arg2_tree->ic_data=tmpcc->size;
- } else {
-here:
- if (tmpi_push==tmpi1)
- tmpi1->t.arg2_tree->ic_data=1;
- else {
- OptSetNOP1(tmpi1->t.arg2_tree);
- OptSetNOP1(tmpi1);
- }
- }
- }
-}
-
-I64 CmpRawType(CHashClass *tmpc)
-{
- if (tmpc) {
- tmpc=OptClassFwd(tmpc);
- return tmpc->raw_type;
- }
- return 0;
-}
-
-I64 CmpRawTypePointed(CHashClass *tmpc)
-{
- if (tmpc) {
- if (tmpc->ptr_stars_cnt)
- tmpc--;
- tmpc=OptClassFwd(tmpc);
- return tmpc->raw_type;
- }
- return 0;
-}
-
-U0 CmpMinTypePointed(CIntermediateCode *tmpi,I64 pt1)
-{
- I64 pt;
- if ((pt=tmpi->arg1_type_pointed_to) && pt!=RT_F64 && 0<pt1<pt)
- tmpi->arg1_type_pointed_to=pt;
-}
-
-U0 CmpF1PushPop(CIntermediateCode *tmpi,CIntermediateCode *tmpi2)
-{
- if (intermediate_code_table[tmpi2->ic_code].fpop||
- tmpi2->ic_flags&ICF_RES_TO_F64)
- Bts(&tmpi->ic_flags,ICf_DONT_PUSH_FLOAT0);
-}
-
-U0 CmpF2PushPop(CIntermediateCode *tmpi,
- CIntermediateCode *tmpi1,CIntermediateCode *tmpi2)
-{
- if ((tmpi2->ic_code==IC_MOV || tmpi2->ic_code==IC_IMM_F64) &&
- !(tmpi2->ic_flags&ICF_RES_TO_F64) &&
- (intermediate_code_table[tmpi1->ic_code].fpop ||
- tmpi1->ic_flags&ICF_RES_TO_F64))
- Bts(&tmpi->ic_flags,ICf_DONT_PUSH_FLOAT0);
- else if ((intermediate_code_table[tmpi2->ic_code].fpop ||
- tmpi2->ic_flags&ICF_RES_TO_F64)&&
- !(tmpi1->ic_flags&ICF_RES_TO_F64))
- Bts(&tmpi->ic_flags,ICf_DONT_PUSH_FLOAT0);
-}
-
-class COptMemberVar
-{
- I64 score,offset_start,offset_end,lea_balance;
- CMemberLst *m;
-};
-
-I64 OptMVCompare(COptMemberVar *mv1,COptMemberVar *mv2)
-{
- return mv2->score-mv1->score;
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/OptPass012.HC.HTML b/public/src/Compiler/OptPass012.HC.HTML deleted file mode 100644 index d3a09a0..0000000 --- a/public/src/Compiler/OptPass012.HC.HTML +++ /dev/null @@ -1,1300 +0,0 @@ - - - - - OptPass012.HC - - - - - /*OptPass012
-
-Pass#0
-When parsing the arg expressions to a function
-call, there is a call to OptPass012 to determine
-the type of the expression. OptPass012
-
-Pass#1&2
-Constant expressions are simplified.
-Eliminated opcodes are set to NOP.
-Types are determined by reconstructing an
-expression tree for operators
-CIntermediateCode.CICTreeLinks.
-
-Pointer arithmetic size is set, once
-the type is determined.
-
-Branches are expressed with short-circuit
-logic. 3-Arg comparisons are established.
-
-*/
-
-CIntermediateCode *OptPass012(CCmpCtrl *cc)
-{/*Simplify CONST arithmetic.
-Sets the class throughout Expression trees.
-Returns the type of an Expression for use
-in int<-->F64 conversions of fun
-args.
-*/
- I64 code,i;
- Bool is_unsigned;
- CHashClass *tmpc,*tmpc1,*tmpc2;
- CIntermediateCode *tmpi,*tmpi1,*tmpi2,*tmpi3,*tmpi_push,
- *last_with_class=NULL;
- CCodeMisc *lb,*lb1,*lb2;
- CPrsStk *ps;
- if (!(ps=cc->ps))
- ps=cc->ps=MAlloc(sizeof(CPrsStk));
- ps->ptr=0;
- ps->ptr2=0;
- tmpi=cc->coc.coc_head.next;
- while (code=tmpi->ic_code) {
- tmpc=tmpi->ic_class;
- tmpi->ic_class2=tmpc;
- tmpi_push=tmpi;
- MemSet(&tmpi->arg1,0,3*sizeof(CICArg));
- tmpi->arg1_type_pointed_to=0;
- switch [intermediate_code_table[code].arg_cnt] {
- case IS_V_ARG:
- ps->ptr-=tmpi->ic_data>>2;
- break;
- case IS_2_ARG:
- tmpi2=PrsPop(ps);
- tmpc2=tmpi2->ic_class;
- tmpi->t.arg2_tree=tmpi2;
- tmpi->t.arg2_class=PrsPop(ps);
- case IS_1_ARG:
- tmpi1=PrsPop(ps);
- tmpc1=tmpi1->ic_class;
- tmpi->t.arg1_tree=tmpi1;
- tmpi->t.arg1_class=PrsPop(ps);
- break;
- case IS_0_ARG: //nobound switch
- break;
- }
- if (intermediate_code_table[code].not_const)
- cc->flags|=CCF_NOT_CONST;
- switch [code] {
- case IC_IMM_F64:
- tmpi->ic_flags&=~ICF_RES_TO_F64;
- if (cc->pass==2 && tmpi->ic_flags&ICF_RES_TO_INT) {
- tmpi->ic_data=ToI64(tmpi->ic_data(F64));
- tmpi->ic_flags&=~ICF_RES_TO_INT;
- tmpi->ic_code=IC_IMM_I64;
- tmpi->ic_class=cmp.internal_types[RT_I64];
- }
- break;
- case IC_IMM_I64:
- tmpi->ic_flags&=~ICF_RES_TO_INT;
- if (cc->pass==2 && tmpi->ic_flags&ICF_RES_TO_F64) {
- tmpi->ic_data(F64)=ToF64(tmpi->ic_data);
- tmpi->ic_flags&=~ICF_RES_TO_F64;
- tmpi->ic_code=IC_IMM_F64;
- tmpi->ic_class=cmp.internal_types[RT_F64];
- }
- break;
- case IC_HOLYC_TYPECAST:
- if (tmpi1->ic_code==IC_IMM_I64 || tmpi1->ic_code==IC_IMM_F64) {
- if (tmpi->ic_class->raw_type==RT_F64)
- tmpi1->ic_code=IC_IMM_F64;
- else
- tmpi1->ic_code=IC_IMM_I64;
- tmpi1->ic_class=tmpi->ic_class;
- tmpi1->ic_flags|=tmpi->ic_flags;
- tmpi_push=tmpi1;
- OptSetNOP1(tmpi);
- } else {
- if (tmpi->ic_data) {//was paren
- if (!tmpi_push->ic_class->ptr_stars_cnt) {
- if (tmpi_push->ic_class->raw_type==RT_F64)
- tmpi_push->ic_class2=cmp.internal_types[RT_F64];
- else
- tmpi_push->ic_class2=cmp.internal_types[RT_I64];
- }
- } else {
- tmpi1->ic_class=tmpi->ic_class;
- tmpi1->ic_flags|=tmpi->ic_flags;
- tmpi_push=tmpi1;
- OptSetNOP1(tmpi);
- }
- }
- break;
- case IC_FS:
- case IC_GS:
-//CALL,FS/GS,CALL_END,IMM,ADD,DEREF-->MOV_FS/GS
- tmpi1=tmpi->next->next; //IMM
- tmpi2=tmpi1->next; //ADD
- tmpi3=tmpi2->next; //DEREF
- if (tmpi1->ic_code==IC_IMM_I64 && tmpi2->ic_code==IC_ADD &&
- tmpi3->ic_code==IC_DEREF &&
- !(tmpi3->ic_flags&~ICG_NO_CVT_MASK)) {
- tmpi->ic_flags|=tmpi1->ic_flags|tmpi2->ic_flags|tmpi3->ic_flags;
- if (tmpi->ic_code==IC_FS)
- tmpi->ic_code=IC_MOV_FS;
- else
- tmpi->ic_code=IC_MOV_GS;
- tmpi->ic_data=tmpi1->ic_data;
- tmpi->ic_class =tmpi3->ic_class;
- tmpi->ic_class2=tmpi3->ic_class2;
- OptSetNOP1(tmpi1);
- OptSetNOP1(tmpi2);
- OptSetNOP1(tmpi3);
-
- tmpi1=tmpi->last; //CALL
- tmpi2=tmpi->next; //CALL_END
- tmpi->ic_flags|=tmpi1->ic_flags|tmpi2->ic_flags;
- OptSetNOP1(tmpi1);
- OptSetNOP1(tmpi2);
- }
- break;
- case IC_PUSH_CMP:
- if (tmpi1=OptLag(tmpi)) {
- if (tmpi1->ic_code==IC_AND_AND)
- tmpi1=OptLag(tmpi1);
- if (tmpi1)
- tmpi->ic_class=tmpi1->ic_class;
- }
- tmpi->ic_class2=tmpi->ic_class;
- tmpi->ic_data=0;
- if (tmpi->ic_class->raw_type==RT_F64)
- tmpi->ic_flags|=ICF_USE_F64;
- break;
- case IC_COM:
- if (tmpi1->ic_code==IC_IMM_I64) {
- tmpi->ic_data=~tmpi1->ic_data;
- tmpi->ic_code=IC_IMM_I64;
- tmpi->ic_flags|=tmpi1->ic_flags;
- OptSetNOP1(tmpi1);
- }
- tmpi_push->ic_class2=cmp.internal_types[RT_I64];
- break;
- start:
- case IC_NOT:
- if (tmpc->raw_type==RT_F64) {
- if (tmpi1->ic_code==IC_IMM_F64) {
- tmpi->ic_data(F64)=!tmpi1->ic_data(F64);
- tmpi->ic_code=IC_IMM_F64;
- tmpi->ic_flags|=tmpi1->ic_flags;
- OptSetNOP1(tmpi1);
- }
- break;
- }
- if (tmpi1->ic_code==IC_IMM_I64) {
- tmpi->ic_data=!tmpi1->ic_data;
- tmpi->ic_code=IC_IMM_I64;
- tmpi->ic_flags|=tmpi1->ic_flags;
- OptSetNOP1(tmpi1);
- }
- break;
- case IC_UNARY_MINUS:
- if (i=OptFixupUnaryOp(tmpi,tmpi1,&is_unsigned)) {
- if (i==FBO1_INT) {
- tmpi->ic_data=-tmpi1->ic_data(I64);
- tmpi->ic_code=IC_IMM_I64;
- } else {
- tmpi->ic_data(F64)=-tmpi1->ic_data(F64);
- tmpi->ic_code=IC_IMM_F64;
- }
- }
- if (tmpc1->type&HTT_INTERNAL_TYPE && tmpc1->raw_type&RTF_UNSIGNED)
- tmpi->ic_class=cmp.internal_types[tmpc1->raw_type-1];
- break;
- case IC_SHL_CONST:
- if (i=OptFixupUnaryOp(tmpi,tmpi1,&is_unsigned)) {
- if (i==FBO1_INT) {
- if (is_unsigned)
- tmpi->ic_data=tmpi1->ic_data(U64)<<tmpi->ic_data(U64);
- else
- tmpi->ic_data=tmpi1->ic_data(I64)<<tmpi->ic_data(I64);
- tmpi->ic_code=IC_IMM_I64;
- } else {
- tmpi->ic_data(F64)=tmpi1->ic_data(F64)<<tmpi->ic_data;
- tmpi->ic_code=IC_IMM_F64;
- }
- } else if (tmpi1->ic_code==IC_SHL_CONST) {
- tmpi->ic_flags|=tmpi1->ic_flags;
- tmpi->ic_data+=tmpi1->ic_data;
- OptSetNOP1(tmpi1);
- }
- break;
- case IC_SHR_CONST:
- if (i=OptFixupUnaryOp(tmpi,tmpi1,&is_unsigned)) {
- if (i==FBO1_INT) {
- if (is_unsigned)
- tmpi->ic_data=tmpi1->ic_data(U64)>>tmpi->ic_data(U64);
- else
- tmpi->ic_data=tmpi1->ic_data(I64)>>tmpi->ic_data(I64);
- tmpi->ic_code=IC_IMM_I64;
- } else {
- tmpi->ic_data(F64)=tmpi1->ic_data(F64)>>tmpi->ic_data;
- tmpi->ic_code=IC_IMM_F64;
- }
- } else if (tmpi1->ic_code==IC_SHR_CONST) {
- tmpi->ic_flags|=tmpi1->ic_flags;
- tmpi->ic_data+=tmpi1->ic_data;
- OptSetNOP1(tmpi1);
- }
- break;
- case IC_SHL:
- if (i=OptFixupBinaryOp1(tmpi,tmpi1,tmpi2,&is_unsigned)) {
- if (i==FBO1_INT) {
- if (is_unsigned)
- tmpi->ic_data=tmpi1->ic_data(U64)<<tmpi2->ic_data(U64);
- else
- tmpi->ic_data=tmpi1->ic_data(I64)<<tmpi2->ic_data(I64);
- tmpi->ic_code=IC_IMM_I64;
- } else {
- tmpi->ic_data(F64)=tmpi1->ic_data(F64) << tmpi2->ic_data(F64);
- tmpi->ic_code=IC_IMM_F64;
- }
- } else if (tmpi2->ic_code==IC_IMM_I64) {
- tmpi->ic_flags|=tmpi2->ic_flags;
- tmpi->ic_data=tmpi2->ic_data;
- tmpi->ic_code=IC_SHL_CONST;
- OptSetNOP1(tmpi2);
- }
- break;
- case IC_SHR:
- if (i=OptFixupBinaryOp1(tmpi,tmpi1,tmpi2,&is_unsigned)) {
- if (i==FBO1_INT) {
- if (is_unsigned)
- tmpi->ic_data=tmpi1->ic_data(U64)>>tmpi2->ic_data(U64);
- else
- tmpi->ic_data=tmpi1->ic_data(I64)>>tmpi2->ic_data(I64);
- tmpi->ic_code=IC_IMM_I64;
- } else {
- tmpi->ic_data(F64)=tmpi1->ic_data(F64) >> tmpi2->ic_data(F64);
- tmpi->ic_code=IC_IMM_F64;
- }
- } else if (tmpi2->ic_code==IC_IMM_I64) {
- tmpi->ic_flags|=tmpi2->ic_flags;
- tmpi->ic_data=tmpi2->ic_data;
- tmpi->ic_code=IC_SHR_CONST;
- OptSetNOP1(tmpi2);
- }
- break;
- end:
- if (!tmpi_push->ic_class->ptr_stars_cnt) {
- if (tmpi_push->ic_class->raw_type==RT_F64)
- tmpi_push->ic_class2=cmp.internal_types[RT_F64];
- else
- tmpi_push->ic_class2=cmp.internal_types[RT_I64];
- }
- break;
- case IC_DEREF:
- if (cc->pass==2) {
- if (!tmpc->size)
- LexWarn(cc,"Dereference U0 ");
- if (tmpi1->ic_class->raw_type!=RT_F64) {
- if (tmpi1->ic_code==IC__PP) {
- tmpi->ic_code=IC_DEREF_PP;
- tmpi->ic_flags|=tmpi1->ic_flags;
- OptSetNOP1(tmpi1);
- } else if (tmpi1->ic_code==IC__MM) {
- tmpi->ic_code=IC_DEREF_MM;
- tmpi->ic_flags|=tmpi1->ic_flags;
- OptSetNOP1(tmpi1);
- }
- }
- }
- break;
- case IC__PP:
- case IC__MM:
- case IC_PP_:
- case IC_MM_:
- if (cc->pass==2 && !tmpc->size)
- LexWarn(cc,"Dereference U0 ");
- break;
- case IC_POWER:
- tmpc=tmpi->ic_class=cmp.internal_types[RT_F64];
- if (tmpc1->raw_type!=RT_F64)
- tmpi1->ic_flags|=ICF_RES_TO_F64;
- if (tmpc2->raw_type!=RT_F64)
- tmpi2->ic_flags|=ICF_RES_TO_F64;
- tmpi_push->ic_class2=cmp.internal_types[RT_F64];
- break;
- start:
- case IC_MUL:
- if (i=OptFixupBinaryOp1(tmpi,tmpi1,tmpi2,&is_unsigned)) {
- if (i==FBO1_INT) {
- if (is_unsigned)
- tmpi->ic_data=tmpi1->ic_data(U64)*tmpi2->ic_data(U64);
- else
- tmpi->ic_data=tmpi1->ic_data(I64)*tmpi2->ic_data(I64);
- tmpi->ic_code=IC_IMM_I64;
- } else {
- tmpi->ic_data(F64)=tmpi1->ic_data(F64)*tmpi2->ic_data(F64);
- tmpi->ic_code=IC_IMM_F64;
- }
- } else {
- if (tmpi1->ic_code==IC_IMM_I64 && cc->pass==2) {
- switch (i=tmpi1->ic_data) {
- case 0:
- break;
- case 1:
- tmpi2->ic_flags|=tmpi->ic_flags|tmpi1->ic_flags;
- tmpi2->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi2;
- OptSetNOP1(tmpi1);
- OptSetNOP1(tmpi);
- break;
- default:
- if (Bsf(i)==Bsr(i)) {
- tmpi->ic_flags|=tmpi1->ic_flags;
- tmpi->t.arg1_class=tmpi->t.arg2_class;
- tmpi->ic_data=Bsf(i);
- tmpi->ic_code=IC_SHL_CONST;
- OptSetNOP1(tmpi1);
- }
- }
- } else if (tmpi2->ic_code==IC_IMM_I64) {
- switch (i=tmpi2->ic_data) {
- case 0:
- break;
- case 1:
- tmpi1->ic_flags|=tmpi->ic_flags|tmpi2->ic_flags;
- tmpi1->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi1;
- OptSetNOP1(tmpi2);
- OptSetNOP1(tmpi);
- break;
- default:
- if (Bsf(i)==Bsr(i)) {
- tmpi->ic_flags|=tmpi2->ic_flags;
- tmpi->ic_data=Bsf(i);
- tmpi->ic_code=IC_SHL_CONST;
- OptSetNOP1(tmpi2);
- } else if (tmpi1->ic_code==IC_MUL && cc->pass==2) {
- if (tmpi1->t.arg1_tree->ic_code==IC_IMM_I64) {
- tmpi1->ic_flags|=tmpi->ic_flags;
- tmpi1->t.arg1_tree->ic_data*=tmpi2->ic_data;
- tmpi1->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi1;
- OptSetNOP1(tmpi2);
- OptSetNOP1(tmpi);
- } else if (tmpi1->t.arg2_tree->ic_code==IC_IMM_I64) {
- tmpi1->ic_flags|=tmpi->ic_flags;
- tmpi1->t.arg2_tree->ic_data*=tmpi2->ic_data;
- tmpi1->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi1;
- OptSetNOP1(tmpi2);
- OptSetNOP1(tmpi);
- }
- }
- }
- } else if (tmpi2->ic_code==IC_IMM_F64 && cc->pass==2) {
- if (tmpi2->ic_data(F64)==1.0) {
- tmpi1->ic_flags|=tmpi->ic_flags|tmpi2->ic_flags;
- tmpi1->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi1;
- OptSetNOP1(tmpi2);
- OptSetNOP1(tmpi);
- } else if (tmpi1->ic_code==IC_MUL) {
- if (tmpi1->t.arg1_tree->ic_code==IC_IMM_F64) {
- tmpi1->ic_flags|=tmpi->ic_flags|tmpi2->ic_flags;
- tmpi1->t.arg1_tree->ic_data(F64)*=tmpi2->ic_data(F64);
- tmpi1->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi1;
- OptSetNOP1(tmpi2);
- OptSetNOP1(tmpi);
- } else if (tmpi1->t.arg2_tree->ic_code==IC_IMM_F64) {
- tmpi1->ic_flags|=tmpi->ic_flags|tmpi2->ic_flags;
- tmpi1->t.arg2_tree->ic_data(F64)*=tmpi2->ic_data(F64);
- tmpi1->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi1;
- OptSetNOP1(tmpi2);
- OptSetNOP1(tmpi);
- }
- }
- }
- }
- break;
- case IC_DIV:
- if ((tmpi2->ic_data || tmpi2->ic_code!=IC_IMM_I64 &&
- tmpi2->ic_code!=IC_IMM_F64) &&
- (i=OptFixupBinaryOp1(tmpi,tmpi1,tmpi2,&is_unsigned))) {
- if (i==FBO1_INT) {
- if (is_unsigned)
- tmpi->ic_data=tmpi1->ic_data(U64)/tmpi2->ic_data(U64);
- else
- tmpi->ic_data=tmpi1->ic_data(I64)/tmpi2->ic_data(I64);
- tmpi->ic_code=IC_IMM_I64;
- } else {
- tmpi->ic_data(F64)=tmpi1->ic_data(F64)/
- tmpi2->ic_data(F64);
- tmpi->ic_code=IC_IMM_F64;
- }
- } else {
- if (tmpi2->ic_code==IC_IMM_I64 && (i=tmpi2->ic_data)) {
- if (i==1) {
- tmpi1->ic_flags|=tmpi2->ic_flags|tmpi->ic_flags;
- tmpi1->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi1;
- OptSetNOP1(tmpi2);
- OptSetNOP1(tmpi);
- } else if (Bsf(i)==Bsr(i)) {
- tmpi->ic_flags|=tmpi2->ic_flags;
- tmpi->ic_data=Bsf(i);
- tmpi->ic_code=IC_SHR_CONST;
- OptSetNOP1(tmpi2);
- }
- }
- }
- break;
- case IC_MOD:
- if ((tmpi2->ic_data || tmpi2->ic_code!=IC_IMM_I64 &&
- tmpi2->ic_code!=IC_IMM_F64) &&
- (i=OptFixupBinaryOp1(tmpi,tmpi1,tmpi2,&is_unsigned))) {
- if (i==FBO1_INT) {
- if (is_unsigned)
- tmpi->ic_data=tmpi1->ic_data(U64)%tmpi2->ic_data(U64);
- else
- tmpi->ic_data=tmpi1->ic_data(I64)%tmpi2->ic_data(I64);
- tmpi->ic_code=IC_IMM_I64;
- } else {
- tmpi->ic_data(F64)=tmpi1->ic_data(F64)%
- tmpi2->ic_data(F64);
- tmpi->ic_code=IC_IMM_F64;
- }
- } else if (cc->pass==2 && tmpi2->ic_code==IC_IMM_I64 &&
- (i=tmpi2->ic_data) && Bsf(i)==Bsr(i) &&
- tmpi_push->ic_class->raw_type!=RT_F64 &&
- tmpi_push->ic_class->raw_type&RTF_UNSIGNED) {//do only unsigned
- tmpi2->ic_data=i-1;
- tmpi->ic_code=IC_AND;
- }
- break;
- case IC_AND:
- if (i=OptFixupBinaryOp1(tmpi,tmpi1,tmpi2,&is_unsigned)) {
- tmpi->ic_data=tmpi1->ic_data&tmpi2->ic_data;
- if (i==FBO1_INT)
- tmpi->ic_code=IC_IMM_I64;
- else
- tmpi->ic_code=IC_IMM_F64;
- }
- break;
- case IC_OR:
- if (i=OptFixupBinaryOp1(tmpi,tmpi1,tmpi2,&is_unsigned)) {
- tmpi->ic_data=tmpi1->ic_data|tmpi2->ic_data;
- if (i==FBO1_INT)
- tmpi->ic_code=IC_IMM_I64;
- else
- tmpi->ic_code=IC_IMM_F64;
- }
- break;
- case IC_XOR:
- if (i=OptFixupBinaryOp1(tmpi,tmpi1,tmpi2,&is_unsigned)) {
- tmpi->ic_data=tmpi1->ic_data^tmpi2->ic_data;
- if (i==FBO1_INT)
- tmpi->ic_code=IC_IMM_I64;
- else
- tmpi->ic_code=IC_IMM_F64;
- }
- break;
- case IC_ADD:
- if (i=OptFixupBinaryOp1(tmpi,tmpi1,tmpi2,&is_unsigned)) {
- if (i==FBO1_INT) {
- tmpi->ic_data=tmpi1->ic_data+tmpi2->ic_data;
- tmpi->ic_code=IC_IMM_I64;
- } else {
- tmpi->ic_data(F64)=tmpi1->ic_data(F64)+
- tmpi2->ic_data(F64);
- tmpi->ic_code=IC_IMM_F64;
- }
- } else {
- if (tmpi1->ic_code==IC_ABS_ADDR&&tmpi2->ic_code==IC_IMM_I64) {
- tmpi->ic_flags|=tmpi1->ic_flags|tmpi2->ic_flags;
- tmpi->ic_data=tmpi1->ic_data+tmpi2->ic_data;
- tmpi->ic_code=IC_ABS_ADDR;
- OptSetNOP1(tmpi1);
- OptSetNOP1(tmpi2);
- } else if (cc->pass==2) {
- if (tmpi1->ic_code==IC_IMM_I64) {
- if (!tmpi1->ic_data) {
- tmpi2->ic_flags|=tmpi1->ic_flags|tmpi->ic_flags;
- tmpi2->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi2;
- OptSetNOP1(tmpi1);
- OptSetNOP1(tmpi);
- } else if (tmpi2->ic_code==IC_ADD||
- tmpi2->ic_code==IC_SUB) {
- if (tmpi2->t.arg1_tree->ic_code==IC_IMM_I64) {
- tmpi2->ic_flags|=tmpi->ic_flags;
- tmpi2->t.arg1_tree->ic_data+=tmpi1->ic_data;
- tmpi2->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi2;
- OptSetNOP1(tmpi1);
- OptSetNOP1(tmpi);
- } else if (tmpi2->t.arg2_tree->ic_code==IC_IMM_I64) {
- tmpi2->ic_flags|=tmpi->ic_flags;
- if (tmpi2->ic_code==IC_ADD)
- tmpi2->t.arg2_tree->ic_data+=tmpi1->ic_data;
- else
- tmpi2->t.arg2_tree->ic_data-=tmpi1->ic_data;
- tmpi2->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi2;
- OptSetNOP1(tmpi1);
- OptSetNOP1(tmpi);
- }
- }
- } else if (tmpi2->ic_code==IC_IMM_I64) {
- if (!tmpi2->ic_data) {
- tmpi1->ic_flags|=tmpi2->ic_flags|tmpi->ic_flags;
- tmpi1->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi1;
- OptSetNOP1(tmpi2);
- OptSetNOP1(tmpi);
- } else if (tmpi1->ic_code==IC_ADD ||
- tmpi1->ic_code==IC_SUB) {
- if (tmpi1->t.arg1_tree->ic_code==IC_IMM_I64) {
- tmpi1->ic_flags|=tmpi->ic_flags;
- tmpi1->t.arg1_tree->ic_data+=tmpi2->ic_data;
- tmpi1->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi1;
- OptSetNOP1(tmpi2);
- OptSetNOP1(tmpi);
- } else if (tmpi1->t.arg2_tree->ic_code==IC_IMM_I64) {
- tmpi1->ic_flags|=tmpi->ic_flags;
- if (tmpi1->ic_code==IC_ADD)
- tmpi1->t.arg2_tree->ic_data+=tmpi2->ic_data;
- else
- tmpi1->t.arg2_tree->ic_data-=tmpi2->ic_data;
- tmpi1->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi1;
- OptSetNOP1(tmpi2);
- OptSetNOP1(tmpi);
- }
- }
- } else if (tmpi1->ic_code==IC_IMM_F64) {
- if (!tmpi1->ic_data) {
- tmpi2->ic_flags|=tmpi1->ic_flags|tmpi->ic_flags;
- tmpi2->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi2;
- OptSetNOP1(tmpi1);
- OptSetNOP1(tmpi);
- } else if (tmpi2->ic_code==IC_ADD||
- tmpi2->ic_code==IC_SUB) {
- if (tmpi2->t.arg1_tree->ic_code==IC_IMM_F64) {
- tmpi2->ic_flags|=tmpi->ic_flags;
- tmpi2->t.arg1_tree->ic_data(F64)+=tmpi1->ic_data(F64);
- tmpi2->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi2;
- OptSetNOP1(tmpi1);
- OptSetNOP1(tmpi);
- } else if (tmpi2->t.arg2_tree->ic_code==IC_IMM_F64) {
- tmpi2->ic_flags|=tmpi->ic_flags;
- if (tmpi2->ic_code==IC_ADD)
- tmpi2->t.arg2_tree->ic_data(F64)+=tmpi1->ic_data(F64);
- else
- tmpi2->t.arg2_tree->ic_data(F64)-=tmpi1->ic_data(F64);
- tmpi2->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi2;
- OptSetNOP1(tmpi1);
- OptSetNOP1(tmpi);
- }
- }
- } else if (tmpi2->ic_code==IC_IMM_F64) {
- if (!tmpi2->ic_data) {
- tmpi1->ic_flags|=tmpi2->ic_flags|tmpi->ic_flags;
- tmpi1->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi1;
- OptSetNOP1(tmpi2);
- OptSetNOP1(tmpi);
- } else if (tmpi1->ic_code==IC_ADD ||
- tmpi1->ic_code==IC_SUB) {
- if (tmpi1->t.arg1_tree->ic_code==IC_IMM_F64) {
- tmpi1->ic_flags|=tmpi->ic_flags;
- tmpi1->t.arg1_tree->ic_data(F64)+=tmpi2->ic_data(F64);
- tmpi1->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi1;
- OptSetNOP1(tmpi2);
- OptSetNOP1(tmpi);
- } else if (tmpi1->t.arg2_tree->ic_code==IC_IMM_F64) {
- tmpi1->ic_flags|=tmpi->ic_flags;
- if (tmpi1->ic_code==IC_ADD)
- tmpi1->t.arg2_tree->ic_data(F64)+=tmpi2->ic_data(F64);
- else
- tmpi1->t.arg2_tree->ic_data(F64)-=tmpi2->ic_data(F64);
- tmpi1->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi1;
- OptSetNOP1(tmpi2);
- OptSetNOP1(tmpi);
- }
- }
- }
- }
- }
- break;
- case IC_SUB:
- if (i=OptFixupBinaryOp1(tmpi,tmpi1,tmpi2,&is_unsigned)) {
- if (i==FBO1_INT) {
- tmpi->ic_data=tmpi1->ic_data-tmpi2->ic_data;
- tmpi->ic_code=IC_IMM_I64;
- } else {
- tmpi->ic_data(F64)=tmpi1->ic_data(F64)-
- tmpi2->ic_data(F64);
- tmpi->ic_code=IC_IMM_F64;
- }
- } else {
- if (cc->pass==2) {
- if (tmpi2->ic_code==IC_IMM_I64) {
- if (!tmpi2->ic_data) {
- tmpi1->ic_flags|=tmpi2->ic_flags|tmpi->ic_flags;
- tmpi1->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi1;
- OptSetNOP1(tmpi2);
- OptSetNOP1(tmpi);
- } else
- if (tmpi1->ic_code==IC_ADD ||
- tmpi1->ic_code==IC_SUB) {
- if (tmpi1->t.arg1_tree->ic_code==IC_IMM_I64) {
- tmpi1->ic_flags|=tmpi->ic_flags;
- tmpi1->t.arg1_tree->ic_data-=tmpi2->ic_data;
- tmpi1->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi1;
- OptSetNOP1(tmpi2);
- OptSetNOP1(tmpi);
- } else if (tmpi1->t.arg2_tree->ic_code==IC_IMM_I64) {
- tmpi1->ic_flags|=tmpi->ic_flags;
- if (tmpi1->ic_code==IC_ADD)
- tmpi1->t.arg2_tree->ic_data-=tmpi2->ic_data;
- else
- tmpi1->t.arg2_tree->ic_data+=tmpi2->ic_data;
- tmpi1->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi1;
- OptSetNOP1(tmpi2);
- OptSetNOP1(tmpi);
- }
- }
- } else
- if (tmpi2->ic_code==IC_IMM_F64) {
- if (!tmpi2->ic_data) {
- tmpi1->ic_flags|=tmpi2->ic_flags|tmpi->ic_flags;
- tmpi1->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi1;
- OptSetNOP1(tmpi2);
- OptSetNOP1(tmpi);
- } else
- if (tmpi1->ic_code==IC_ADD || tmpi1->ic_code==IC_SUB) {
- if (tmpi1->t.arg1_tree->ic_code==IC_IMM_F64) {
- tmpi1->ic_flags|=tmpi->ic_flags|tmpi2->ic_flags;
- tmpi1->t.arg1_tree->ic_data(F64)-=tmpi2->ic_data(F64);
- tmpi1->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi1;
- OptSetNOP1(tmpi2);
- OptSetNOP1(tmpi);
- } else if (tmpi1->t.arg2_tree->ic_code==IC_IMM_F64) {
- tmpi1->ic_flags|=tmpi->ic_flags|tmpi2->ic_flags;
- if (tmpi1->ic_code==IC_ADD)
- tmpi1->t.arg2_tree->ic_data(F64)-=tmpi2->ic_data(F64);
- else
- tmpi1->t.arg2_tree->ic_data(F64)+=tmpi2->ic_data(F64);
- tmpi1->ic_class2=tmpi->ic_class2;
- tmpi_push=tmpi1;
- OptSetNOP1(tmpi2);
- OptSetNOP1(tmpi);
- }
- }
- }
- }
- }
- break;
- case IC_AND_AND:
- if (OptFixupBinaryOp1(tmpi,tmpi1,tmpi2,&is_unsigned)) {
- tmpi->ic_data=tmpi1->ic_data&&tmpi2->ic_data;
- tmpi->ic_code=IC_IMM_I64;
- }
- tmpi->ic_class=cmp.internal_types[RT_I64];
- break;
- case IC_OR_OR:
- if (OptFixupBinaryOp1(tmpi,tmpi1,tmpi2,&is_unsigned)) {
- tmpi->ic_data=tmpi1->ic_data||tmpi2->ic_data;
- tmpi->ic_code=IC_IMM_I64;
- }
- tmpi->ic_class=cmp.internal_types[RT_I64];
- break;
- case IC_XOR_XOR:
- if (OptFixupBinaryOp1(tmpi,tmpi1,tmpi2,&is_unsigned)) {
- tmpi->ic_data=tmpi1->ic_data^^tmpi2->ic_data;
- tmpi->ic_code=IC_IMM_I64;
- }
- tmpi->ic_class=cmp.internal_types[RT_I64];
- break;
- end:
- if (!tmpi_push->ic_class->ptr_stars_cnt) {
- if (tmpi_push->ic_class->raw_type==RT_F64)
- tmpi_push->ic_class2=cmp.internal_types[RT_F64];
- else if (is_unsigned)
- tmpi_push->ic_class2=cmp.internal_types[RT_U64];
- else
- tmpi_push->ic_class2=cmp.internal_types[RT_I64];
- }
- break;
- start:
- case IC_EQU_EQU:
- if (OptFixupBinaryOp1(tmpi,tmpi1,tmpi2,&is_unsigned)) {
- tmpi->ic_data=tmpi1->ic_data==tmpi2->ic_data;
- tmpi->ic_code=IC_IMM_I64;
- } else
- if (tmpi->ic_class->raw_type==RT_F64)
- tmpi->ic_flags|=ICF_USE_F64;
- break;
- case IC_NOT_EQU:
- if (OptFixupBinaryOp1(tmpi,tmpi1,tmpi2,&is_unsigned)) {
- tmpi->ic_data=tmpi1->ic_data!=tmpi2->ic_data;
- tmpi->ic_code=IC_IMM_I64;
- } else
- if (tmpi->ic_class->raw_type==RT_F64)
- tmpi->ic_flags|=ICF_USE_F64;
- break;
- case IC_LESS:
- if (i=OptFixupBinaryOp1(tmpi,tmpi1,tmpi2,&is_unsigned)) {
- if (i==FBO1_INT) {
- if (is_unsigned)
- tmpi->ic_data=tmpi1->ic_data(U64)<tmpi2->ic_data(U64);
- else
- tmpi->ic_data=tmpi1->ic_data(I64)<tmpi2->ic_data(I64);
- } else
- tmpi->ic_data=tmpi1->ic_data(F64)<tmpi2->ic_data(F64);
- tmpi->ic_code=IC_IMM_I64;
- } else {
- if (is_unsigned)
- tmpi->ic_flags|=ICF_USE_UNSIGNED;
- if (tmpi->ic_class->raw_type==RT_F64)
- tmpi->ic_flags|=ICF_USE_F64;
- }
- break;
- case IC_GREATER_EQU:
- if (i=OptFixupBinaryOp1(tmpi,tmpi1,tmpi2,&is_unsigned)) {
- if (i==FBO1_INT) {
- if (is_unsigned)
- tmpi->ic_data=tmpi1->ic_data(U64)>=tmpi2->ic_data(U64);
- else
- tmpi->ic_data=tmpi1->ic_data(I64)>=tmpi2->ic_data(I64);
- } else
- tmpi->ic_data=tmpi1->ic_data(F64)>=tmpi2->ic_data(F64);
- tmpi->ic_code=IC_IMM_I64;
- } else {
- if (is_unsigned)
- tmpi->ic_flags|=ICF_USE_UNSIGNED;
- if (tmpi->ic_class->raw_type==RT_F64)
- tmpi->ic_flags|=ICF_USE_F64;
- }
- break;
- case IC_GREATER:
- if (i=OptFixupBinaryOp1(tmpi,tmpi1,tmpi2,&is_unsigned)) {
- if (i==FBO1_INT) {
- if (is_unsigned)
- tmpi->ic_data=tmpi1->ic_data(U64)>tmpi2->ic_data(U64);
- else
- tmpi->ic_data=tmpi1->ic_data(I64)>tmpi2->ic_data(I64);
- } else
- tmpi->ic_data=tmpi1->ic_data(F64)>tmpi2->ic_data(F64);
- tmpi->ic_code=IC_IMM_I64;
- } else {
- if (is_unsigned)
- tmpi->ic_flags|=ICF_USE_UNSIGNED;
- if (tmpi->ic_class->raw_type==RT_F64)
- tmpi->ic_flags|=ICF_USE_F64;
- }
- break;
- case IC_LESS_EQU:
- if (i=OptFixupBinaryOp1(tmpi,tmpi1,tmpi2,&is_unsigned)) {
- if (i==FBO1_INT) {
- if (is_unsigned)
- tmpi->ic_data=tmpi1->ic_data(U64)<=tmpi2->ic_data(U64);
- else
- tmpi->ic_data=tmpi1->ic_data(I64)<=tmpi2->ic_data(I64);
- } else
- tmpi->ic_data=tmpi1->ic_data(F64)<=tmpi2->ic_data(F64);
- tmpi->ic_code=IC_IMM_I64;
- } else {
- if (is_unsigned)
- tmpi->ic_flags|=ICF_USE_UNSIGNED;
- if (tmpi->ic_class->raw_type==RT_F64)
- tmpi->ic_flags|=ICF_USE_F64;
- }
- break;
- end:
- tmpi->ic_flags&=~ICF_RES_TO_INT;
- if (!tmpi_push->ic_class->ptr_stars_cnt) {
- if (tmpi_push->ic_class->raw_type==RT_F64)
- tmpi_push->ic_class2=cmp.internal_types[RT_F64];
- else if (is_unsigned)
- tmpi_push->ic_class2=cmp.internal_types[RT_U64];
- else
- tmpi_push->ic_class2=cmp.internal_types[RT_I64];
- }
- if (tmpi_push->ic_flags & ICF_PUSH_CMP)
- tmpi->ic_class=tmpi->ic_class2;
- else
- tmpi->ic_class=cmp.internal_types[RT_I64];
- break;
- start:
- if (cc->pass==2 && (!tmpc->size||!tmpc2->size))
- LexWarn(cc,"Assign U0 ");
- start:
- case IC_MUL_EQU:
- if (tmpi2->ic_code==IC_IMM_I64 && tmpc->raw_type!=RT_F64 &&
- tmpc2->raw_type!=RT_F64) {
- if (i=tmpi2->ic_data) {
- if (Bsf(i)==Bsr(i)) {
- tmpi2->ic_data=Bsf(i);
- tmpi->ic_code=IC_SHL_EQU;
- }
- }
- }
- break;
- case IC_DIV_EQU:
- if (tmpi2->ic_code==IC_IMM_I64 && tmpc->raw_type!=RT_F64 &&
- tmpc2->raw_type!=RT_F64 &&
- (i=tmpi2->ic_data) && Bsf(i)==Bsr(i)) {
- tmpi2->ic_data=Bsf(i);
- tmpi->ic_code=IC_SHR_EQU;
- }
- break;
- case IC_MOD_EQU:
- if (tmpi2->ic_code==IC_IMM_I64 && tmpc->raw_type!=RT_F64 &&
- tmpc2->raw_type!=RT_F64 &&
- (i=tmpi2->ic_data) && Bsf(i)==Bsr(i)) {
- tmpi2->ic_data=i-1;
- tmpi->ic_code=IC_AND_EQU;
- }
- break;
- case IC_ADD_EQU:
- case IC_SUB_EQU:
- break;
- end:
- if (tmpi2->ic_class->raw_type==RT_F64)
- tmpi->ic_flags=tmpi->ic_flags|ICF_USE_F64;
- if (tmpc->raw_type==RT_F64) {
- if (tmpc2->raw_type!=RT_F64)
- tmpi2->ic_flags|=ICF_RES_TO_F64;
- }
- break;
- case IC_ASSIGN:
- if (tmpc->raw_type==RT_F64) {
- if (tmpc2->raw_type!=RT_F64)
- tmpi2->ic_flags|=ICF_RES_TO_F64;
- } else {
- if (tmpc2->raw_type==RT_F64)
- tmpi2->ic_flags|=ICF_RES_TO_INT;
- }
- if (cc->pass==2 && tmpi1->ic_class->raw_type!=RT_F64) {
- if (tmpi1->ic_code==IC__PP) {
- tmpi->ic_code=IC_ASSIGN_PP;
- tmpi->ic_flags|=tmpi1->ic_flags;
- tmpi->t.class2=tmpi1->ic_class;
- OptSetNOP1(tmpi1);
- } else if (tmpi1->ic_code==IC__MM) {
- tmpi->ic_code=IC_ASSIGN_MM;
- tmpi->ic_flags|=tmpi1->ic_flags;
- tmpi->t.class2=tmpi1->ic_class;
- OptSetNOP1(tmpi1);
- }
- }
- break;
- case IC_SHL_EQU:
- case IC_SHR_EQU:
- case IC_AND_EQU:
- case IC_OR_EQU:
- case IC_XOR_EQU:
- if (tmpc2->raw_type==RT_F64)
- tmpi2->ic_flags|=ICF_RES_TO_INT;
- break;
- end:
- break;
- case IC_ENTER:
- case IC_LEAVE:
- tmpi->ic_data=-cc->htc.fun->size;
- break;
- case IC_ADD_RSP:
- if (tmpi1=OptLag(tmpi)) {
- if (tmpi1->ic_code==IC_ADD_RSP) {
- tmpi->ic_data+=tmpi1->ic_data;
- tmpi->ic_flags|=tmpi1->ic_flags;
- OptSetNOP1(tmpi1);
- }
- }
- case IC_ADD_RSP1:
- break;
- case IC_BSF:
- if (tmpi1->ic_code==IC_IMM_I64) {
- tmpi1->ic_data=Bsf(tmpi1->ic_data);
- tmpi_push=tmpi1;
- OptSetNOP1(OptLag(tmpi1)); //CALL_START
- tmpi2=OptLead1(tmpi);
- tmpi1->ic_flags|=tmpi->ic_flags|tmpi2->ic_flags;
- OptSetNOP1(tmpi2); //CALL_END
- OptSetNOP1(tmpi); //BSF
- }
- break;
- case IC_BSR:
- if (tmpi1->ic_code==IC_IMM_I64) {
- tmpi1->ic_data=Bsr(tmpi1->ic_data);
- tmpi_push=tmpi1;
- OptSetNOP1(OptLag(tmpi1)); //CALL_START
- tmpi2=OptLead1(tmpi);
- tmpi1->ic_flags|=tmpi->ic_flags|tmpi2->ic_flags;
- OptSetNOP1(tmpi2); //CALL_END
- OptSetNOP1(tmpi); //BSR
- }
- break;
- case IC_LBTS:
- case IC_LBTR:
- case IC_LBTC:
- tmpi->ic_flags|=ICF_LOCK;
- break;
- case IC_TO_I64:
- if (tmpi1->ic_code==IC_IMM_F64) {
- tmpi2=tmpi1->last;
- while (tmpi2->ic_code!=IC_CALL_START)
- tmpi2=tmpi2->last;
- OptSetNOP1(tmpi2);
-
- tmpi2=tmpi->next;
- while (tmpi2->ic_code!=IC_CALL_END)
- tmpi2=tmpi2->next;
-
- tmpi->ic_flags|=tmpi1->ic_flags&~ICF_RES_TO_INT|tmpi2->ic_flags;
- OptSetNOP1(tmpi2);
-
- tmpi->ic_code=IC_IMM_I64;
- tmpi->ic_data=ToI64(tmpi1->ic_data(F64));
- tmpi->ic_class=cmp.internal_types[RT_I64];
- tmpi->ic_class2=cmp.internal_types[RT_I64];
- OptSetNOP1(tmpi1);
- } else if (tmpi1->ic_code==IC_IMM_I64) {
- tmpi2=tmpi1->last;
- while (tmpi2->ic_code!=IC_CALL_START)
- tmpi2=tmpi2->last;
- OptSetNOP1(tmpi2);
-
- tmpi2=tmpi->next;
- while (tmpi2->ic_code!=IC_CALL_END)
- tmpi2=tmpi2->next;
-
- tmpi->ic_flags|=tmpi1->ic_flags&~ICF_RES_TO_F64|tmpi2->ic_flags;
- OptSetNOP1(tmpi2);
-
- tmpi->ic_code=IC_IMM_I64;
- tmpi->ic_data=tmpi1->ic_data;
- tmpi->ic_class=cmp.internal_types[RT_I64];
- tmpi->ic_class2=cmp.internal_types[RT_I64];
- OptSetNOP1(tmpi1);
- }
- if (tmpi1->ic_flags&ICF_RES_TO_F64) {
- i=0;
- tmpi2=tmpi1->last;
- while (TRUE) {
- if (tmpi2->ic_code==IC_CALL_START) {
- if (!i) break;
- i--;
- } else if (tmpi2->ic_code==IC_CALL_END)
- i++;
- tmpi2=tmpi2->last;
- }
- OptSetNOP1(tmpi2);
-
- tmpi2=tmpi1->next;
- while (tmpi2->ic_code!=IC_CALL_END)
- tmpi2=tmpi2->next;
-
- tmpi1->ic_flags=tmpi->ic_flags|tmpi1->ic_flags&
- ~(ICF_RES_TO_F64|ICF_PUSH_RES)|tmpi2->ic_flags;
- OptSetNOP1(tmpi2);
-
- tmpi1->ic_class=cmp.internal_types[RT_I64];
- tmpi1->ic_class2=cmp.internal_types[RT_I64];
- tmpi_push=tmpi1;
- OptSetNOP1(tmpi);
- }
- break;
- case IC_TO_F64:
- if (tmpi1->ic_code==IC_IMM_I64) {
- tmpi2=tmpi1->last;
- while (tmpi2->ic_code!=IC_CALL_START)
- tmpi2=tmpi2->last;
- OptSetNOP1(tmpi2);
-
- tmpi2=tmpi->next;
- while (tmpi2->ic_code!=IC_CALL_END)
- tmpi2=tmpi2->next;
-
- tmpi->ic_flags|=tmpi1->ic_flags&~ICF_RES_TO_F64|tmpi2->ic_flags;
- OptSetNOP1(tmpi2);
-
- tmpi->ic_code=IC_IMM_F64;
- tmpi->ic_data(F64)=ToF64(tmpi1->ic_data);
- tmpi->ic_class=cmp.internal_types[RT_F64];
- tmpi->ic_class2=cmp.internal_types[RT_F64];
- OptSetNOP1(tmpi1);
- } else if (tmpi1->ic_code==IC_IMM_F64) {
- tmpi2=tmpi1->last;
- while (tmpi2->ic_code!=IC_CALL_START)
- tmpi2=tmpi2->last;
- OptSetNOP1(tmpi2);
-
- tmpi2=tmpi->next;
- while (tmpi2->ic_code!=IC_CALL_END)
- tmpi2=tmpi2->next;
-
- tmpi->ic_flags|=tmpi1->ic_flags&~ICF_RES_TO_INT|tmpi2->ic_flags;
- OptSetNOP1(tmpi2);
-
- tmpi->ic_code=IC_IMM_F64;
- tmpi->ic_data=tmpi1->ic_data;
- tmpi->ic_class=cmp.internal_types[RT_F64];
- tmpi->ic_class2=cmp.internal_types[RT_F64];
- OptSetNOP1(tmpi1);
- }
- if (tmpi1->ic_flags&ICF_RES_TO_INT) {
- i=0;
- tmpi2=tmpi1->last;
- while (TRUE) {
- if (tmpi2->ic_code==IC_CALL_START) {
- if (!i) break;
- i--;
- } else if (tmpi2->ic_code==IC_CALL_END)
- i++;
- tmpi2=tmpi2->last;
- }
- OptSetNOP1(tmpi2);
-
- tmpi2=tmpi1->next;
- while (tmpi2->ic_code!=IC_CALL_END)
- tmpi2=tmpi2->next;
-
- tmpi1->ic_flags=tmpi->ic_flags|tmpi1->ic_flags&
- ~(ICF_RES_TO_INT|ICF_PUSH_RES)|tmpi2->ic_flags;
- OptSetNOP1(tmpi2);
-
- tmpi1->ic_class=cmp.internal_types[RT_F64];
- tmpi1->ic_class2=cmp.internal_types[RT_F64];
- tmpi_push=tmpi1;
- OptSetNOP1(tmpi);
- }
- break;
- case IC_TO_BOOL:
- if (tmpi1->ic_code==IC_IMM_I64 || tmpi1->ic_code==IC_IMM_F64) {
- tmpi2=tmpi1->last;
- while (tmpi2->ic_code!=IC_CALL_START)
- tmpi2=tmpi2->last;
- OptSetNOP1(tmpi2);
-
- tmpi2=tmpi->next;
- while (tmpi2->ic_code!=IC_CALL_END)
- tmpi2=tmpi2->next;
-
- tmpi->ic_flags|=tmpi1->ic_flags&~ICF_RES_TO_F64|tmpi2->ic_flags;
- OptSetNOP1(tmpi2);
-
- tmpi->ic_code=IC_IMM_I64;
- tmpi->ic_data=ToBool(tmpi1->ic_data);
- tmpi->ic_class=cmp.internal_types[RT_I64];
- tmpi->ic_class2=cmp.internal_types[RT_I64];
- OptSetNOP1(tmpi1);
- }
- break;
- case IC_BR_ZERO:
- tmpi_push=OptBrZero(cc,tmpi);
- break;
- case IC_BR_NOT_ZERO:
- tmpi_push=OptBrNotZero(cc,tmpi);
- break;
- case IC_NOP1:
- if (tmpi->ic_flags&ICF_PUSH_RES) {
- tmpi1=tmpi;
- do tmpi1=tmpi1->last;
- while (tmpi1->ic_code==IC_NOP1);
- tmpi1->ic_flags|=ICF_PUSH_RES;
- tmpi->ic_flags&=~ICF_PUSH_RES;
- }
- break;
- case IC_NOP2:
- ps->ptr+=tmpi->ic_data<<1;
- break;
- case IC_LABEL:
- lb=OptLabelFwd(tmpi->ic_data);
- lb1=tmpi->ic_data;
- while (lb2=lb1->fwd) {
- lb1->fwd=lb;
- lb1=lb2;
- }
- if (tmpi1=OptLag(tmpi)) {
- if (tmpi1->ic_code==IC_JMP) {
- lb1=tmpi1->ic_data;
- while (lb1->fwd)
- lb1=lb1->fwd;
- if (lb1==lb) {
- tmpi->ic_flags|=tmpi1->ic_flags;
- OptSetNOP1(tmpi1);
- }
- } else if (tmpi1->ic_code==IC_LABEL) {
- lb1=tmpi1->ic_data;
- if (!lb1->fwd)
- lb1->fwd=lb;
- if (tmpi1=OptLag(tmpi1)) {
- if (tmpi1->ic_code==IC_JMP) {
- lb1=tmpi1->ic_data;
- while (lb1->fwd)
- lb1=lb1->fwd;
- if (lb1==lb) {
- tmpi->ic_flags|=tmpi1->ic_flags;
- OptSetNOP1(tmpi1);
- }
- }
- }
- }
- }
- break;
- case IC_JMP:
- if (tmpi1=OptLag(tmpi)) {
- if (tmpi1->ic_code==IC_LABEL) {
- lb=OptLabelFwd(tmpi->ic_data);
- lb1=OptLabelFwd(tmpi1->ic_data);
- if (lb!=lb1)
- lb1->fwd=lb;
- }
- }
- break;
- case IC_STR_CONST:
- case IC_RBP:
- case IC_MOV_FS:
- case IC_MOV_GS:
- case IC_RIP:
- case IC_SIZEOF:
- case IC_SQR:
- case IC_ABS:
- case IC_SQRT:
- case IC_SIN:
- case IC_COS:
- case IC_TAN:
- case IC_ATAN:
- case IC_BR_CARRY:
- case IC_BR_NOT_CARRY:
- case IC_BR_EQU_EQU ...IC_BR_LESS_EQU:
- case IC_BR_EQU_EQU2...IC_BR_LESS_EQU2:
- case IC_BR_OR_OR_NOT_ZERO:
- case IC_BR_OR_OR_ZERO:
- case IC_BR_AND_AND_NOT_ZERO:
- case IC_BR_AND_AND_ZERO:
- case IC_BR_AND_NOT_ZERO:
- case IC_BR_AND_ZERO:
- case IC_BR_MM_NOT_ZERO:
- case IC_BR_MM_ZERO:
- case IC_BR_BT:
- case IC_BR_BTS:
- case IC_BR_BTR:
- case IC_BR_BTC:
- case IC_BR_NOT_BT:
- case IC_BR_NOT_BTS:
- case IC_BR_NOT_BTR:
- case IC_BR_NOT_BTC:
- case IC_END:
- case IC_ADDR:
- case IC_RET:
- case IC_END_EXP:
- case IC_CALL_START:
- case IC_CALL_END:
- case IC_CALL_END2:
- case IC_PUSH_REGS:
- case IC_POP_REGS:
- case IC_SUB_CALL:
- case IC_CALL:
- case IC_CALL_INDIRECT:
- case IC_CALL_INDIRECT2:
- case IC_CALL_EXTERN:
- case IC_CALL_IMPORT:
- case IC_PUSH:
- case IC_POP:
- case IC_INVLPG:
- case IC_CLFLUSH:
- case IC_GET_RFLAGS:
- case IC_CARRY:
- case IC_GET_RBP:
- case IC_GET_RSP:
- case IC_GET_RAX:
- case IC_RETURN_VAL:
- case IC_RETURN_VAL2:
- case IC_ABS_ADDR:
- case IC_HEAP_GLBL:
- case IC_ADDR_IMPORT:
- case IC_GET_LABEL:
- case IC_TYPE:
- case IC_RDTSC:
- case IC_SET_RFLAGS:
- case IC_SET_RBP:
- case IC_SET_RSP:
- case IC_SET_RAX:
- case IC_SIGN_I64:
- case IC_TOUPPER:
- case IC_ABS_I64:
- case IC_MIN_I64:
- case IC_MAX_I64:
- case IC_MIN_U64:
- case IC_MAX_U64:
- case IC_MOD_U64:
- case IC_SQR_I64:
- case IC_SQR_U64:
- case IC_SWAP_U8:
- case IC_SWAP_U16:
- case IC_SWAP_U32:
- case IC_SWAP_I64:
- case IC_IN_U32:
- case IC_IN_U16:
- case IC_IN_U8:
- case IC_STRLEN:
- case IC_BT:
- case IC_BTS:
- case IC_BTR:
- case IC_BTC:
- case IC_QUE_INIT:
- case IC_QUE_REM:
- case IC_QUE_INS:
- case IC_QUE_INS_REV:
- case IC_OUT_U32:
- case IC_OUT_U16:
- case IC_OUT_U8:
- case IC_NOBOUND_SWITCH:
- case IC_SWITCH:
- case IC_ASM:
- break;
- default:
- "Pass:%d Missing IC hndlr\n",cc->pass;
- ICPut(cc,tmpi);
- LexExcept(cc,"Compiler Optimization Error at ");
- }
- if (intermediate_code_table[code].arg_cnt==IS_2_ARG) {
- if (tmpi_push->ic_precedence&~ASSOC_MASK==PREC_ASSIGN)
- OptFixSizeOf(tmpi2,tmpi_push,tmpi1->ic_class-1);
- else {
- OptFixSizeOf(tmpi1,tmpi_push,tmpi2->ic_class);
- OptFixSizeOf(tmpi2,tmpi_push,tmpi1->ic_class);
- }
- }
- if (intermediate_code_table[tmpi_push->ic_code].res_cnt) {
- PrsPush(ps,tmpi->ic_class2);
- PrsPush(ps,tmpi_push);
- }
- if (tmpi->ic_class) {
- if (tmpi->ic_class->raw_type==RT_F64)
- tmpi->ic_flags&=~ICF_RES_TO_F64;
- else
- tmpi->ic_flags&=~ICF_RES_TO_INT;
- if (code>IC_END_EXP)
- last_with_class=tmpi;
- }
- tmpi=tmpi->next;
- }
- if (ps->ptr>2) {
- "Pass:%d Stk:%08X\n",cc->pass,ps->ptr;
- LexExcept(cc,"Compiler Optimization Error at ");
- }
-//This is for determining type conversions for passing args to funs.
- return last_with_class;
-}
-
- - - \ No newline at end of file diff --git a/public/src/Compiler/OptPass3.HC.HTML b/public/src/Compiler/OptPass3.HC.HTML deleted file mode 100644 index 7f2c63f..0000000 --- a/public/src/Compiler/OptPass3.HC.HTML +++ /dev/null @@ -1,634 +0,0 @@ - - - - - OptPass3.HC - - - - - U0 OptPass3(CCmpCtrl *cc,COptReg *reg_offsets)
-{
- CHashClass *tmpc,*tmpc1,*tmpc2;
- CCodeMisc *lb;
- CIntermediateCode *tmpi,*tmpi1,*tmpi2,*tmpi_next,
- *tmpil1,*tmpil2;
- I64 code,i,j,l,member_cnt,used_reg_mask=0;
- CMemberLst *tmpm;
- COptMemberVar *mv=NULL;
- CAOT *tmpaot;
- CAOTImportExport *tmpie;
- CPrsStk *ps=cc->ps;
- ps->ptr=0;
- ps->ptr2=0;
-
- for (i=0;i<REG_REGS_NUM;i++) {
- reg_offsets[i].offset=I64_MAX;
- reg_offsets[i].m=NULL;
- }
- if (cc->htc.fun) {
- member_cnt=cc->htc.fun->member_cnt;
- if (Bt(&cc->htc.fun->flags,Ff_DOT_DOT_DOT))
- member_cnt+=2;
- mv=CAlloc(member_cnt*sizeof(COptMemberVar));
- member_cnt=0;
- tmpm=cc->htc.fun->member_lst_and_root;
- while (tmpm) {
- tmpc=OptClassFwd(tmpm->member_class);
- if (0<=tmpm->reg<REG_REGS_NUM) {
- if (Bts(&used_reg_mask,tmpm->reg))
- PrintWarn("Reg in use\n $LK,\"FL:%s,%d\"$'%s' in '%s'\n",
- cc->lex_include_stk->full_name,
- cc->lex_include_stk->line_num,tmpm->str,cc->htc.fun->str);
- reg_offsets[tmpm->reg].offset=tmpm->offset;
- reg_offsets[tmpm->reg].m=tmpm;
- } else if (tmpc->raw_type!=RT_F64 && tmpm->reg!=REG_NONE ||
- tmpm->reg==REG_ALLOC) {
- if (tmpm->reg==REG_ALLOC)
- mv[member_cnt].score=I64_MAX/2; //big but not too big
- mv[member_cnt].offset_start=tmpm->offset;
- mv[member_cnt].offset_end=tmpm->offset+MaxI64(1,tmpm->size);
- mv[member_cnt++].m=tmpm;
- } else if (tmpm->reg==REG_ALLOC)
- PrintWarn("Can't reg var\n $LK,\"FL:%s,%d\"$'%s' in '%s'\n",
- cc->lex_include_stk->full_name,
- cc->lex_include_stk->line_num,tmpm->str,cc->htc.fun->str);
- tmpm=tmpm->next;
- }
- } else
- member_cnt=0;
-
- tmpi=cc->coc.coc_head.next;
- while (code=tmpi->ic_code) {
- tmpi_next=tmpi->next;
- if (code==IC_NOP1)
- OptFree(tmpi);
- else {
- if (tmpil1=OptLag(tmpi)) {
- if (!(tmpil2=OptLag(tmpil1)))
- tmpil2=&cmp.ic_nop;
- } else
- tmpil1=tmpil2=&cmp.ic_nop;
- tmpc=tmpi->ic_class;
- switch [intermediate_code_table[code].arg_cnt] {
- case IS_V_ARG:
- ps->ptr-=tmpi->ic_data>>3;
- break;
- case IS_2_ARG:
- tmpi2=PrsPop(ps);
- if (tmpi2->ic_flags&ICF_RES_TO_F64)
- tmpc2=cmp.internal_types[RT_F64];
- else if (tmpi2->ic_flags & ICF_RES_TO_INT)
- tmpc2=cmp.internal_types[RT_I64];
- else
- tmpc2=tmpi->t.arg2_class;
- tmpi->arg2.type=MDF_STK+CmpRawType(tmpc2);
- tmpi->ic_flags|=ICF_ARG2_WAS_STK;
- case IS_1_ARG:
- tmpi1=PrsPop(ps);
- if (tmpi1->ic_flags&ICF_RES_TO_F64)
- tmpc1=cmp.internal_types[RT_F64];
- else if (tmpi1->ic_flags & ICF_RES_TO_INT)
- tmpc1=cmp.internal_types[RT_I64];
- else
- tmpc1=tmpi->t.arg1_class;
- tmpi->arg1.type=MDF_STK+CmpRawType(tmpc1);
- tmpi->arg1_type_pointed_to=CmpRawTypePointed(tmpc1);
- tmpi->ic_flags|=ICF_ARG1_WAS_STK;
- break;
- case IS_0_ARG: //nobound switch
- break;
- }
- if (intermediate_code_table[code].res_cnt) {
- tmpi->res.type=MDF_STK+CmpRawType(tmpc);
- tmpi->ic_flags|=ICF_RES_WAS_STK;
- PrsPush(ps,tmpi);
- }
- switch [code] {
- case IC_IMM_F64:
- tmpi->ic_flags&=~ICF_RES_TO_F64;
- if (tmpi->ic_flags&ICF_RES_TO_INT) {
- tmpi->ic_data=ToI64(tmpi->ic_data(F64));
- tmpi->ic_flags&=~ICF_RES_TO_INT;
- tmpi->ic_code=IC_IMM_I64;
- }
- break;
- case IC_IMM_I64:
- tmpi->ic_flags&=~ICF_RES_TO_INT;
- if (tmpi->ic_flags&ICF_RES_TO_F64) {
- tmpi->ic_data(F64)=ToF64(tmpi->ic_data);
- tmpi->ic_flags&=~ICF_RES_TO_F64;
- tmpi->ic_code=IC_IMM_F64;
- }
- break;
- case IC_RBP:
- tmpi->ic_code=IC_REG;
- tmpi->arg1.reg=REG_RBP;
- break;
- case IC_DEREF:
- tmpi->arg1_type_pointed_to=tmpi->res.type.raw_type;
- if (tmpi1->ic_code==IC_LEA) {
- tmpi->ic_flags|=tmpi1->ic_flags;
- tmpi->arg1.reg=tmpi1->arg1.reg;
- tmpi->arg1.disp=tmpi1->arg1.disp;
- tmpi->arg1.type=MDF_DISP+tmpi->res.type.raw_type;
- tmpi->arg1_type_pointed_to=CmpRawTypePointed(tmpc);
- tmpi->ic_code=IC_MOV;
- OptFree(tmpi1);
- if (tmpi->arg1.reg==REG_RBP)
- for (i=0;i<member_cnt;i++)
- if (mv[i].offset_start==tmpi->arg1.disp) {
- mv[i].lea_balance--;
- mv[i].score++;
- break;
- }
- } else if (tmpil1->ic_code==IC_ADD_CONST) {
- if (tmpil2->ic_code==IC_REG) {
- tmpi->ic_flags|=tmpil2->ic_flags|tmpil1->ic_flags;
- tmpi->arg1.reg=tmpil2->arg1.reg;
- tmpi->arg1.disp=tmpi->ic_data;
- tmpi->arg1.type=MDF_DISP+tmpi->res.type.raw_type;
- tmpi->arg1_type_pointed_to=CmpRawTypePointed(tmpc);
- tmpi->ic_code=IC_MOV;
- OptFree(tmpil2);
- OptFree(tmpil1);
- }
- }
- break;
- case IC__PP:
- case IC__MM:
- case IC_PP_:
- case IC_MM_:
- CmpMinTypePointed(tmpi,CmpRawTypePointed(tmpi->t.arg1_class));
- case IC_DEREF_PP:
- case IC_DEREF_MM:
- if (tmpi1->ic_code==IC_LEA && tmpi1->arg1.type&MDF_DISP &&
- tmpi1->arg1.reg==REG_RBP)
- for (i=0;i<member_cnt;i++)
- if (mv[i].offset_start==tmpi1->arg1.disp) {
- mv[i].lea_balance--;
- mv[i].score++;
- break;
- }
- tmpi->arg1_type_pointed_to=tmpi->res.type.raw_type;
- break;
- case IC_MUL:
- case IC_DIV:
- if (tmpc->raw_type==RT_F64) {
- CmpF2PushPop(tmpi,tmpi1,tmpi2);
- break;
- }
- break;
- case IC_ADD:
- if (tmpc->raw_type==RT_F64) {
- CmpF2PushPop(tmpi,tmpi1,tmpi2);
- break;
- }
- if (OptFixupBinaryOp2(&tmpi1,&tmpi2)) {
- tmpi->ic_flags|=tmpi1->ic_flags;
- if (tmpi->t.arg1_tree!=tmpi2)
- tmpi->t.arg1_class=tmpi->t.arg2_class;
- tmpi->ic_data=tmpi1->ic_data;
- tmpi->ic_code=IC_ADD_CONST;
- tmpi->arg1_type_pointed_to=tmpi->res.type.raw_type;
- tmpi->arg2.type=MDF_NULL;
- OptFree(tmpi1);
- if (tmpil2->ic_code==IC_REG && tmpil2->arg1.reg==REG_RBP) {
- tmpi->ic_flags|=tmpil2->ic_flags;
- tmpi->ic_code=IC_LEA;
- tmpi->arg1.reg=REG_RBP;
- tmpi->arg1.type=MDF_DISP+tmpi->arg1.type.raw_type;
- tmpi->arg1.disp=tmpi->ic_data;
- for (i=0;i<member_cnt;i++)
- if (mv[i].offset_start<=tmpi->ic_data<mv[i].offset_end) {
- mv[i].lea_balance++;
- mv[i].score++;
- break;
- }
- OptFree(tmpil2);
- }
- }
- break;
- case IC_SUB:
- if (tmpc->raw_type==RT_F64) {
- CmpF2PushPop(tmpi,tmpi1,tmpi2);
- break;
- }
- if (tmpi2->ic_code==IC_IMM_I64) {
- tmpi->ic_flags|=tmpi2->ic_flags;
- tmpi->ic_data=tmpi2->ic_data;
- tmpi->ic_code=IC_SUB_CONST;
- tmpi->arg2.type=MDF_NULL;
- OptFree(tmpi2);
- }
- break;
- case IC_LESS:
- case IC_GREATER_EQU:
- case IC_GREATER:
- case IC_LESS_EQU:
- if (tmpi->ic_flags&ICF_USE_F64)
- CmpF2PushPop(tmpi,tmpi1,tmpi2);
- break;
- case IC_MUL_EQU:
- case IC_DIV_EQU:
- case IC_ADD_EQU:
- case IC_SUB_EQU:
- if (tmpc->raw_type==RT_F64)
- CmpF1PushPop(tmpi,tmpi2);
- case IC_ASSIGN_PP:
- case IC_ASSIGN_MM:
- case IC_ASSIGN:
- case IC_SHL_EQU:
- case IC_SHR_EQU:
- case IC_MOD_EQU:
- case IC_AND_EQU:
- case IC_OR_EQU:
- case IC_XOR_EQU:
- if (tmpi1->ic_code==IC_LEA && tmpi1->arg1.type&MDF_DISP &&
- tmpi1->arg1.reg==REG_RBP)
- for (i=0;i<member_cnt;i++)
- if (mv[i].offset_start==tmpi1->arg1.disp) {
- mv[i].lea_balance--;
- mv[i].score++;
- break;
- }
- tmpi->arg1_type_pointed_to=tmpi->res.type.raw_type;
- CmpMinTypePointed(tmpi,CmpRawTypePointed(tmpi->t.arg1_class));
- break;
- case IC_RETURN_VAL:
- case IC_RETURN_VAL2:
- if (tmpc) {
- if (tmpc->raw_type==RT_F64 && tmpil1->ic_class->raw_type!=RT_F64)
- tmpil1->ic_flags|=ICF_RES_TO_F64;
- else if (tmpc->raw_type!=RT_F64 &&
- tmpil1->ic_class->raw_type==RT_F64)
- tmpil1->ic_flags|=ICF_RES_TO_INT;
- }
- break;
- case IC_SQR:
- case IC_ABS:
- case IC_SQRT:
- case IC_SIN:
- case IC_COS:
- case IC_TAN:
- case IC_ATAN:
- if (tmpc->raw_type==RT_F64)
- CmpF1PushPop(tmpi,tmpi1);
- break;
- case IC_NOBOUND_SWITCH:
- case IC_SWITCH:
- lb=OptLabelFwd(tmpi->ic_data(CCodeMisc *)->dft);
- lb->use_cnt++;
- break;
- case IC_ASM:
- tmpaot=tmpi->ic_data;
- tmpie=tmpaot->next_ie;
- while (tmpie!=&tmpaot->next_ie) {
- if (IET_REL_I0<=tmpie->type<=IET_IMM_I64 &&
- tmpie->str && tmpie->flags&IEF_GOTO_LABEL &&
- (lb=COCGoToLabelFind(cc,tmpie->str)))
- lb->use_cnt++; //Prevent deadcode elimination.
- tmpie=tmpie->next;
- }
- break;
- case IC_BR_NOT_EQU:
- case IC_BR_EQU_EQU:
- if ((tmpi1->ic_code==IC_IMM_I64 ||
- tmpi1->ic_code==IC_IMM_F64) && !tmpi1->ic_data) {
- OptFree(tmpi1);
- MemCpy(&tmpi->arg1,&tmpi->arg2,sizeof(CICArg));
- tmpi->arg2.type=MDF_NULL;
- if (code==IC_BR_EQU_EQU)
- code=tmpi->ic_code=IC_BR_ZERO;
- else
- code=tmpi->ic_code=IC_BR_NOT_ZERO;
- tmpi1=tmpi2;
- tmpc1=tmpc2;
- } else if ((tmpi2->ic_code==IC_IMM_I64 ||
- tmpi2->ic_code==IC_IMM_F64) && !tmpi2->ic_data) {
- OptFree(tmpi2);
- tmpi->arg2.type=MDF_NULL;
- if (code==IC_BR_EQU_EQU)
- code=tmpi->ic_code=IC_BR_ZERO;
- else
- code=tmpi->ic_code=IC_BR_NOT_ZERO;
- } else
- goto here1;
- case IC_BR_ZERO:
- case IC_BR_NOT_ZERO:
- if (tmpi1->ic_code==IC_IMM_I64 || tmpi1->ic_code==IC_IMM_F64) {
- if (code==IC_BR_ZERO ^^ tmpi1->ic_data) {
- OptFree(tmpi1);
- tmpi->arg1.type=MDF_NULL;
- tmpi->ic_code=IC_JMP;
- } else {
- OptFree(tmpi1);
- tmpi=OptFree(tmpi);
- break;
- }
- }
- goto here1;
- case IC_BR_AND_ZERO:
- if (tmpi1->ic_code==IC_IMM_I64) {
- i=Bsr(tmpi1->ic_data);
- if (0<=i==Bsf(tmpi1->ic_data)) {
- tmpi1->ic_data=i;
- tmpi->ic_flags|=ICF_BY_VAL;
- tmpi->ic_code=IC_BR_NOT_BT;
- goto here1;
- }
- }
- if (tmpi2->ic_code==IC_IMM_I64) {
- i=Bsr(tmpi2->ic_data);
- if (0<=i==Bsf(tmpi2->ic_data)) {
- tmpi2->ic_data=i;
- tmpi->ic_flags|=ICF_SWAP|ICF_BY_VAL;
- tmpi->ic_code=IC_BR_NOT_BT;
- }
- }
- goto here1;
- case IC_BR_AND_NOT_ZERO:
- if (tmpi1->ic_code==IC_IMM_I64) {
- i=Bsr(tmpi1->ic_data);
- if (0<=i==Bsf(tmpi1->ic_data)) {
- tmpi1->ic_data=i;
- tmpi->ic_flags|=ICF_BY_VAL;
- tmpi->ic_code=IC_BR_BT;
- goto here1;
- }
- }
- if (tmpi2->ic_code==IC_IMM_I64) {
- i=Bsr(tmpi2->ic_data);
- if (0<=i==Bsf(tmpi2->ic_data)) {
- tmpi2->ic_data=i;
- tmpi->ic_flags|=ICF_SWAP|ICF_BY_VAL;
- tmpi->ic_code=IC_BR_BT;
- }
- }
- goto here1;
- case IC_BR_MM_ZERO:
- case IC_BR_MM_NOT_ZERO:
- if (tmpi1->ic_code==IC_LEA && tmpi1->arg1.type&MDF_DISP &&
- tmpi1->arg1.reg==REG_RBP)
- for (i=0;i<member_cnt;i++)
- if (mv[i].offset_start==tmpi1->arg1.disp) {
- mv[i].lea_balance--;
- mv[i].score++;
- break;
- }
- tmpi->arg1_type_pointed_to=CmpRawType(tmpc);
- goto here1;
- case IC_BR_LESS:
- case IC_BR_GREATER_EQU:
- case IC_BR_GREATER:
- case IC_BR_LESS_EQU:
- if (tmpi->ic_flags&ICF_USE_F64)
- CmpF2PushPop(tmpi,tmpi1,tmpi2);
- case IC_BR_EQU_EQU2...IC_BR_LESS_EQU2:
- case IC_BR_CARRY:
- case IC_BR_NOT_CARRY:
- case IC_GET_LABEL:
- case IC_BR_BT:
- case IC_BR_BTS:
- case IC_BR_BTR:
- case IC_BR_BTC:
- case IC_BR_NOT_BT:
- case IC_BR_NOT_BTS:
- case IC_BR_NOT_BTR:
- case IC_BR_NOT_BTC:
- case IC_JMP:
- case IC_SUB_CALL:
-here1:
- if (tmpi->ic_flags&ICF_PUSH_CMP)
- lb=tmpi->ic_data;
- else
- lb=OptLabelFwd(tmpi->ic_data);
- lb->use_cnt++;
- break;
- case IC_NOP1:
- tmpi=OptFree(tmpi);
- break;
- case IC_NOP2:
- ps->ptr+=tmpi->ic_data;
- break;
- case IC_SHL_CONST:
- case IC_SHR_CONST:
- case IC_ENTER:
- case IC_ADD_RSP:
- case IC_ADD_RSP1:
- case IC_CALL:
- case IC_CALL_INDIRECT:
- case IC_CALL_INDIRECT2:
- case IC_CALL_EXTERN:
- case IC_CALL_IMPORT:
- case IC_PUSH:
- case IC_POP:
- case IC_INVLPG:
- case IC_CLFLUSH:
- case IC_GET_RFLAGS:
- case IC_CARRY:
- case IC_RDTSC:
- case IC_SET_RFLAGS:
- case IC_GET_RBP:
- case IC_SET_RBP:
- case IC_GET_RSP:
- case IC_GET_RAX:
- case IC_SET_RSP:
- case IC_SET_RAX:
- case IC_ABS_ADDR:
- case IC_HEAP_GLBL:
- case IC_ADDR_IMPORT:
- case IC_TYPE:
- case IC_BT:
- case IC_BTS:
- case IC_BTR:
- case IC_BTC:
- case IC_LBTS:
- case IC_LBTR:
- case IC_LBTC:
- case IC_BSF:
- case IC_BSR:
- case IC_SIGN_I64:
- case IC_TOUPPER:
- case IC_TO_I64:
- case IC_TO_F64:
- case IC_TO_BOOL:
- case IC_ABS_I64:
- case IC_MIN_I64:
- case IC_MAX_I64:
- case IC_MIN_U64:
- case IC_MAX_U64:
- case IC_MOD_U64:
- case IC_SQR_I64:
- case IC_SQR_U64:
- case IC_SWAP_U8:
- case IC_SWAP_U16:
- case IC_SWAP_U32:
- case IC_SWAP_I64:
- case IC_QUE_INIT:
- case IC_QUE_INS:
- case IC_QUE_INS_REV:
- case IC_QUE_REM:
- case IC_IN_U32:
- case IC_IN_U16:
- case IC_IN_U8:
- case IC_STRLEN:
- case IC_OUT_U32:
- case IC_OUT_U16:
- case IC_OUT_U8:
- case IC_STR_CONST:
- case IC_FS:
- case IC_GS:
- case IC_MOV_FS:
- case IC_MOV_GS:
- case IC_RIP:
- case IC_PUSH_CMP:
- case IC_REG:
- case IC_COM:
- case IC_HOLYC_TYPECAST:
- case IC_NOT:
- case IC_UNARY_MINUS:
- case IC_POWER:
- case IC_SHL:
- case IC_SHR:
- case IC_MOD:
- case IC_AND:
- case IC_OR:
- case IC_XOR:
- case IC_EQU_EQU:
- case IC_NOT_EQU:
- case IC_AND_AND:
- case IC_OR_OR:
- case IC_XOR_XOR:
- case IC_LEAVE:
- case IC_RET:
- case IC_ADDR:
- case IC_END:
- case IC_END_EXP:
- case IC_CALL_END:
- case IC_CALL_END2:
- case IC_CALL_START:
- case IC_PUSH_REGS:
- case IC_POP_REGS:
- case IC_LABEL:
- break;
- default:
- "Pass:%d Missing IC hndlr\n",cc->pass;
- ICPut(cc,tmpi);
- LexExcept(cc,"Compiler Optimization Error at ");
- }
- }
- tmpi=tmpi_next;
- }
-/* REGISTER VARIABLE ASSIGNMENT
-
-We just scored num occurrences of each [RBP] offset in the code to help decide
-which variables should be assigned to register variables.
-
-We counted the times each offset was added to RBP as a plus LEA and we subtract
-the times the offset is dereferenced. If the address was calculated more times
-than the offset was dereferenced, the variable's address was passed or assigned
-and we cannot use a register because you can't take address of a reg var.
-
-RAX,RBX,RCX,RDX, R8 are free to be clobbered by each intermediate code.
-RAX and R8 links intermediate codes together. R9 is used for stack machine
-temporaries. RBP is used as stack frame.
-
-RSI,RDI,R10,R11,R12,R13,R14,R15 are used for reg vars. R12 and R13, however,
-have a unusual ModR addressing mode in the x86_64 architecture, so I only use
-R12 and R13 as non-pointer register variables, such as index variables i,j,k.
-
-*/
- if (cc->htc.fun) {
- cc->htc.fun->used_reg_mask=cc->htc.fun->used_reg_mask&
- ~(REGG_LOCAL_VARS|REGG_LOCAL_NON_PTR_VARS)|used_reg_mask;
- if (!Bt(&cc->opts,OPTf_NO_REG_VAR) &&
- !(cc->flags & CCF_NO_REG_OPT)) {
- QSort(mv,member_cnt,sizeof(COptMemberVar),&OptMVCompare);
- while (member_cnt && !mv[member_cnt-1].score)
- member_cnt--;
- j=0;
- for (i=0;i<member_cnt;i++) {
- if (!mv[i].lea_balance && mv[i].offset_start) {//addr operator cancels
- mv[j].m=mv[i].m;
- mv[j].offset_start=mv[i].offset_start;
- mv[j++].offset_end=mv[i].offset_end;
- } else {
- if (mv[i].m->reg==REG_ALLOC)
- PrintWarn("Can't reg var\n $LK,\"FL:%s,%d\"$'%s' in '%s'\n",
- cc->lex_include_stk->full_name,
- cc->lex_include_stk->line_num,mv[i].m->str,cc->htc.fun->str);
- }
- }
- if (j>0) {
- if (Bt(&cc->flags,CCf_PASS_TRACE_PRESENT))
- "Fun:%s\n",cc->htc.fun->str;
- if (j>cmp.num_reg_vars) {
- l=0;
- for (i=0;i<j && l<cmp.num_non_ptr_vars;i++) {
- tmpm=mv[i].m;
- tmpc=OptClassFwd(tmpm->member_class);
- if (!tmpc->ptr_stars_cnt && !tmpm->dim.next) {
- while (l<cmp.num_non_ptr_vars &&
- Bts(&cc->htc.fun->used_reg_mask,cmp.non_ptr_vars_map[l]))
- l++;
- if (l<cmp.num_non_ptr_vars) {
- tmpm->reg=cmp.non_ptr_vars_map[l++];
- reg_offsets[tmpm->reg].offset=mv[i].offset_start;
- reg_offsets[tmpm->reg].m=tmpm;
- if (Bt(&cc->flags,CCf_PASS_TRACE_PRESENT))
- "Reg %Z Var \"%-15ts\" %016X[RBP]\n",tmpm->reg,"ST_U64_REGS",
- tmpm->str,reg_offsets[tmpm->reg].offset;
- mv[i].offset_start=0; //flag as reg var
- if (tmpm->size<8 &&
- !StrIMatch("Bool",tmpm->member_class->str) &&
- tmpm->member_class->type&HTT_INTERNAL_TYPE)
- PrintWarn("Using 64-bit reg var.\n "
- "$LK,\"FL:%s,%d\"$'%s' in '%s'\n",
- cc->lex_include_stk->full_name,
- cc->lex_include_stk->line_num,
- tmpm->str,cc->htc.fun->str);
- }
- }
- }
- }
- l=0;
- for (i=0;i<j && l<cmp.num_reg_vars;i++) {
- tmpm=mv[i].m;
-//if not just flagged as reg var
- if (mv[i].offset_start && (!mv[i].m->dim.next||
- tmpm->offset>0 && StrCmp(tmpm->str,"argv"))) {
- while (l<cmp.num_reg_vars &&
- Bts(&cc->htc.fun->used_reg_mask,cmp.to_reg_vars_map[l]))
- l++;
- if (l<cmp.num_reg_vars) {
- tmpm->reg=cmp.to_reg_vars_map[l++];
- reg_offsets[tmpm->reg].offset=mv[i].offset_start;
- reg_offsets[tmpm->reg].m=tmpm;
- if (Bt(&cc->flags,CCf_PASS_TRACE_PRESENT))
- "Reg %Z Var \"%-15ts\" %016X[RBP]\n",tmpm->reg,"ST_U64_REGS",
- tmpm->str,reg_offsets[tmpm->reg].offset;
- if (tmpm->size<8 &&
- !StrIMatch("Bool",tmpm->member_class->str) &&
- tmpm->member_class->type&HTT_INTERNAL_TYPE)
- PrintWarn("Using 64-bit reg var.\n "
- "$LK,\"FL:%s,%d\"$'%s' in '%s'\n",
- cc->lex_include_stk->full_name,
- cc->lex_include_stk->line_num,
- tmpm->str,cc->htc.fun->str);
- }
- }
- }
- }
- }
- Free(mv);
- }
- if (ps->ptr>2) {
- "Pass:%d Stk:%08X\n",cc->pass,ps->ptr;
- LexExcept(cc,"Compiler Optimization Error at ");
- }
-}
-
- - - \ No newline at end of file diff --git a/public/src/Compiler/OptPass4.HC.HTML b/public/src/Compiler/OptPass4.HC.HTML deleted file mode 100644 index 07ed325..0000000 --- a/public/src/Compiler/OptPass4.HC.HTML +++ /dev/null @@ -1,701 +0,0 @@ - - - - - OptPass4.HC - - - - - Bool OptIC4(CIntermediateCode *tmpi)
-{
- I64 i;
- CIntermediateCode *tmpil1,*tmpil2;
-
- if (tmpi->ic_code<IC_IMM_I64) return FALSE;
-
- tmpil1=tmpi;
- if (!(tmpil2=OptLag1(tmpil1)))
- return FALSE;
-
- if (tmpil2->res.type&MDF_STK && !(tmpil2->ic_flags&ICF_PUSH_RES)) {
- if (tmpil1->ic_code==IC_ADD_CONST && tmpil1->arg1.type&MDF_STK) {
- if ((tmpil2->ic_code==IC_REG || tmpil2->ic_code==IC_MOV) &&
- tmpil2->arg1.type&MDF_REG) {
- i=tmpil1->ic_data;
- if (I32_MIN<=i<=I32_MAX &&
- !Bt(&cmp.non_ptr_vars_mask,tmpil2->arg1.reg)) {
- tmpil1->ic_flags|=tmpil2->ic_flags&ICG_NO_CVT_MASK;
- tmpil1->ic_code=IC_LEA;
- tmpil1->arg1.type=MDF_DISP+tmpil1->arg1.type.raw_type;
- tmpil1->arg1.reg=tmpil2->arg1.reg;
- tmpil1->arg1.disp=i;
- OptFree(tmpil2);
- return TRUE;
- }
- } else if (tmpil2->ic_code==IC_SHL_CONST && tmpil2->arg1.type&MDF_REG) {
- i=tmpil1->ic_data;
- if (I32_MIN<=i<=I32_MAX && tmpil2->arg1.reg!=REG_RSP &&
- 1<=tmpil2->ic_data<=3) {
- tmpil1->ic_flags|=tmpil2->ic_flags&ICG_NO_CVT_MASK;
- tmpil1->ic_code=IC_LEA;
- tmpil1->arg1.type=MDF_SIB+tmpil1->arg1.type.raw_type;
- tmpil1->arg1.reg=tmpil2->arg1.reg<<8+REG_NONE;
- if (tmpil2->ic_data==1)
- tmpil1->arg1.reg|=0x4000;
- else if (tmpil2->ic_data==2)
- tmpil1->arg1.reg|=0x8000;
- else
- tmpil1->arg1.reg|=0xC000;
- tmpil1->arg1.disp=i;
- OptFree(tmpil2);
- return TRUE;
- }
- }
- }
- if (tmpil2->ic_code==IC_MOV || tmpil2->ic_code==IC_REG) {
- if (tmpil1->arg2.type&MDF_STK) {
- if (tmpil2->ic_flags & ICF_RES_TO_INT) {
- if (tmpil2->arg1.type&MDF_IMM)
- tmpil2->arg1.disp=tmpil2->arg1.disp(F64);
- else
- tmpil1->ic_flags|=ICF_ARG2_TO_INT;
- } else if (tmpil2->ic_flags&ICF_RES_TO_F64) {
- if (tmpil2->arg1.type&MDF_IMM)
- tmpil2->arg1.disp(F64)=tmpil2->arg1.disp;
- else
- tmpil1->ic_flags|=ICF_ARG2_TO_F64;
- }
- tmpil1->arg2.type=tmpil2->arg1.type&MDG_MASK+
- MinI64(tmpil1->arg2.type.raw_type,
- MinI64(tmpil2->res.type.raw_type,tmpil2->arg1.type.raw_type));
- tmpil1->arg2.reg=tmpil2->arg1.reg;
- tmpil1->arg2.disp=tmpil2->arg1.disp;
- tmpil1->ic_flags|=tmpil2->ic_flags&ICG_NO_CVT_MASK;
- OptSetNOP2(tmpil2);
- return TRUE;
- }
- if (tmpil1->arg1.type&MDF_STK) {
- if (tmpil2->ic_flags & ICF_RES_TO_INT) {
- if (tmpil2->arg1.type&MDF_IMM)
- tmpil2->arg1.disp=tmpil2->arg1.disp(F64);
- else
- tmpil1->ic_flags|=ICF_ARG1_TO_INT;
- } else if (tmpil2->ic_flags&ICF_RES_TO_F64) {
- if (tmpil2->arg1.type&MDF_IMM) {
- if (tmpil2->arg1.type&RTF_UNSIGNED)
- tmpil2->arg1.disp(F64)=tmpil2->arg1.disp(U64);
- else
- tmpil2->arg1.disp(F64)=tmpil2->arg1.disp(I64);
- } else
- tmpil1->ic_flags|=ICF_ARG1_TO_F64;
- }
- tmpil1->arg1.type=tmpil2->arg1.type&MDG_MASK+
- MinI64(tmpil1->arg1.type.raw_type,
- MinI64(tmpil2->res.type.raw_type,tmpil2->arg1.type.raw_type));
- CmpMinTypePointed(tmpil1,tmpil2->arg1_type_pointed_to);
- tmpil1->arg1.reg=tmpil2->arg1.reg;
- tmpil1->arg1.disp=tmpil2->arg1.disp;
- tmpil1->ic_flags|=tmpil2->ic_flags&ICG_NO_CVT_MASK;
- OptSetNOP2(tmpil2);
- return TRUE;
- }
- }
- if (tmpil1->ic_code==IC_DEREF) {
- if (tmpil2->ic_code==IC_ADD_CONST && tmpil2->arg1.type&MDF_REG &&
- tmpil1->arg1.type&MDF_STK) {
- i=tmpil2->ic_data;
- if (I32_MIN<=i<=I32_MAX &&
- !Bt(&cmp.non_ptr_vars_mask,tmpil2->arg1.reg)) {
- tmpil1->ic_flags|=tmpil2->ic_flags;
- tmpil1->ic_code=IC_MOV;
- tmpil1->arg1.type=MDF_DISP+tmpil1->arg1_type_pointed_to;
- tmpil1->arg1.reg=tmpil2->arg1.reg;
- tmpil1->arg1.disp=i;
- OptSetNOP2(tmpil2,-1);
- return TRUE;
- }
- }
- if (tmpil2->ic_code==IC_LEA && tmpil1->arg1.type&MDF_STK) {
- tmpil1->ic_flags|=tmpil2->ic_flags;
- tmpil1->ic_code=IC_MOV;
- tmpil1->arg1.type=tmpil2->arg1.type&MDG_MASK+
- tmpil1->arg1_type_pointed_to;
- tmpil1->arg1.reg=tmpil2->arg1.reg;
- tmpil1->arg1.disp=tmpil2->arg1.disp;
- OptFree(tmpil2);
- return TRUE;
- }
- }
- }
- if (tmpil1->ic_code==IC_DEREF) {
- if (tmpil1->arg1.type&MDF_REG) {
- tmpil1->arg1.type=MDF_DISP+tmpil1->arg1_type_pointed_to;
- tmpil1->arg1.disp=0;
- tmpil1->ic_code=IC_MOV;
- return TRUE;
- }
- }
- return FALSE;
-}
-
-U0 OptPass4(CCmpCtrl *cc,COptReg *reg_offsets,I64 *_type)
-{
- CHashClass *tmpc,*tmpc1,*tmpc2;
- CIntermediateCode *tmpi,*tmpi1,*tmpi2,*tmpil1,*tmpil2,*tmpil3,
- *tmpi_next;
- I64 code,i;
- Bool dead_code=FALSE;
- CCodeMisc *lb;
- CPrsStk *ps=cc->ps;
- ps->ptr=0;
- ps->ptr2=0;
-
- if (_type)
- *_type=RT_I64;
-
- tmpi=cc->coc.coc_head.next;
- while (code=tmpi->ic_code) {
- tmpi_next=tmpi->next;
- if (dead_code&&code!=IC_LABEL) {
- if (code==IC_JMP||code==IC_SUB_CALL) {
- lb=OptLabelFwd(tmpi->ic_data);
- if (lb->use_cnt>0)
- lb->use_cnt--;
- }
- tmpi=OptFree(tmpi);
- } else {
- tmpc=tmpi->ic_class;
- tmpi1=tmpi2=&cmp.ic_nop;
- if (tmpil1=OptLag2(tmpi)) {
- if (tmpil2=OptLag2(tmpil1)) {
- if (!(tmpil3=OptLag2(tmpil2)))
- tmpil3=&cmp.ic_nop;
- } else
- tmpil2=tmpil3=&cmp.ic_nop;
- } else
- tmpil1=tmpil2=tmpil3=&cmp.ic_nop;
- switch [intermediate_code_table[code].arg_cnt] {
- case IS_V_ARG:
- ps->ptr-=tmpi->ic_data>>3;
- break;
- case IS_2_ARG:
- tmpi2=PrsPop(ps);
- tmpc2=tmpi2->ic_class;
- case IS_1_ARG:
- tmpi1=PrsPop(ps);
- tmpc1=tmpi1->ic_class;
- break;
- case IS_0_ARG: //nobound switch
- break;
- }
- switch [code] {
- case IC_IMM_I64:
- case IC_TYPE:
- tmpi->arg1.type=MDF_IMM+RT_I64;
- tmpi->arg1.disp=tmpi->ic_data;
- tmpi->ic_code=IC_MOV;
- break;
- case IC_IMM_F64:
- tmpi->arg1.type=MDF_IMM+RT_I64;
- tmpi->arg1.disp=tmpi->ic_data;
- tmpi->arg1_type_pointed_to=RT_F64;
- tmpi->ic_code=IC_MOV;
- break;
- case IC_MOV:
- if (tmpi->arg1.type&MDF_DISP && tmpi->arg1.reg==REG_RBP) {
- i=CmpOffset2Reg(tmpi->arg1.disp,reg_offsets);
- if (i>=0) {
- tmpi->arg1.type=MDF_REG+tmpi->arg1.type.raw_type;
- tmpi->arg1.reg=i;
- tmpi->arg1.disp=0;
- }
- }
- break;
- case IC_DEREF:
- if (tmpi1->ic_code==IC_LEA) {
- if (tmpi1->arg1.type&MDF_DISP && tmpi1->arg1.reg==REG_RBP) {
- i=CmpOffset2Reg(tmpi1->arg1.disp,reg_offsets);
- if (i>=0) {
- tmpi->ic_flags|=tmpi1->ic_flags;
- tmpi->ic_code=IC_REG;
- tmpi->arg1.type=MDF_REG+tmpi->arg1.type.raw_type;
- tmpi->arg1.reg=i;
- tmpi->arg1.disp=0;
- OptFree(tmpi1);
- }
- }
- } else if ((tmpi1->ic_code==IC_ABS_ADDR ||
- tmpi1->ic_code==IC_MOV &&
- tmpi1->arg1.type==MDF_IMM+RT_I64 &&
- 0<=tmpi1->arg1.disp<=I32_MAX)&& !(tmpi1->ic_flags&ICF_NO_RIP)) {
- if (tmpi1->ic_code==IC_ABS_ADDR)
- tmpi->arg1.disp=tmpi1->ic_data;
- else
- tmpi->arg1.disp=tmpi1->arg1.disp;
- tmpi->ic_flags|=tmpi1->ic_flags;
- tmpi->ic_code=IC_MOV;
- tmpi->arg1.type=MDF_RIP_DISP32+tmpi->arg1_type_pointed_to;
- tmpi->arg1.reg=REG_RIP;
- OptFree(tmpi1);
- }
- break;
- case IC_BR_MM_ZERO:
- case IC_BR_MM_NOT_ZERO:
-//(branch ++ to zero is unlikely)
- case IC_DEREF_PP:
- case IC_DEREF_MM:
- case IC__PP:
- case IC__MM:
- case IC_PP_:
- case IC_MM_:
- if (tmpi1->ic_code==IC_LEA) {
- if (tmpi1->arg1.type&MDF_DISP && tmpi1->arg1.reg==REG_RBP) {
- i=CmpOffset2Reg(tmpi1->arg1.disp,reg_offsets);
- if (i>=0) {
- tmpi->ic_flags|=tmpi1->ic_flags;
- tmpi->arg1.type=MDF_REG+tmpi->arg1.type.raw_type;
- tmpi->arg1.reg=i;
- tmpi->arg1.disp=0;
- tmpi->ic_flags|=ICF_BY_VAL;
- OptSetNOP2(tmpi1);
- } else
- goto p4_lea_gone;
- } else {
-p4_lea_gone:
- tmpi->ic_flags|=tmpi1->ic_flags;
- tmpi->arg1.type=tmpi1->arg1.type;
- tmpi->arg1.reg=tmpi1->arg1.reg;
- tmpi->arg1.disp=tmpi1->arg1.disp;
- tmpi->ic_flags|=ICF_BY_VAL;
- OptSetNOP2(tmpi1);
- }
- } else if ((tmpi1->ic_code==IC_ABS_ADDR || tmpi1->ic_code==IC_MOV &&
- tmpi1->arg1.type==MDF_IMM+RT_I64 &&
- 0<=tmpi1->arg1.disp<=I32_MAX)&& !(tmpi1->ic_flags&ICF_NO_RIP)) {
- tmpi->ic_flags|=tmpi1->ic_flags;
- if (tmpi1->ic_code==IC_ABS_ADDR)
- tmpi->arg1.disp=tmpi1->ic_data;
- else
- tmpi->arg1.disp=tmpi1->arg1.disp;
- tmpi->arg1.type=MDF_RIP_DISP32+tmpi->arg1_type_pointed_to;
- tmpi->arg1.reg=REG_RIP;
- tmpi->ic_flags|=ICF_BY_VAL;
- OptFree(tmpi1);
- }
- break;
- case IC_ADD:
- if (tmpi1->ic_code==IC_MOV && tmpi1->arg1.type==MDF_REG+RT_I64 ||
- tmpi1->ic_code==IC_REG) {
- if (tmpi2->ic_code==IC_MOV && tmpi2->arg1.type==MDF_REG+RT_I64 ||
- tmpi2->ic_code==IC_REG) {
- if (tmpi2->arg1.reg!=REG_RSP) {
- tmpi->arg1.disp=0;
- tmpi->arg1.reg=tmpi1->arg1.reg+tmpi2->arg1.reg<<8;
- goto p4_sib;
- } else if (tmpi1->arg1.reg!=REG_RSP) {
- tmpi->arg1.disp=0;
- tmpi->arg1.reg=tmpi2->arg1.reg+tmpi1->arg1.reg<<8;
-p4_sib:
- tmpi->ic_flags|=(tmpi1->ic_flags|tmpi2->ic_flags)
- &ICG_NO_CVT_MASK;
- OptSetNOP2(tmpi1);
- OptFree(tmpi2);
-
- tmpi->ic_code=IC_LEA;
- tmpi->arg1.type=MDF_SIB+RT_I64;
- tmpi->arg1_type_pointed_to=RT_I64;
-
- tmpi->arg2.type=MDF_NULL+tmpi->arg2.type.raw_type;
- }
- } else if (tmpi2->ic_code==IC_SHL_CONST &&
- tmpi2->arg1.type==MDF_REG+RT_I64 && tmpi2->ic_data<=3) {
- if (tmpi2->arg1.reg!=REG_RSP) {
- tmpi->arg1.disp=0;
- tmpi->arg1.reg=tmpi1->arg1.reg+tmpi2->arg1.reg<<8;
- if (tmpi2->ic_data==1)
- tmpi->arg1.reg|=0x4000;
- else if (tmpi2->ic_data==2)
- tmpi->arg1.reg|=0x8000;
- else
- tmpi->arg1.reg|=0xC000;
- goto p4_sib;
- }
- }
- } else if (tmpi1->ic_code==IC_LEA &&
- tmpi1->arg1.type&MDF_DISP) {
- if (tmpi1->arg1.reg==REG_RBP &&
- CmpOffset2Reg(tmpi1->arg1.disp,reg_offsets)>=0)
- break;
- if (tmpi2->ic_code==IC_MOV && tmpi2->arg1.type==MDF_REG+RT_I64 ||
- tmpi2->ic_code==IC_REG) {
- if (tmpi2->arg1.reg!=REG_RSP) {
- tmpi->arg1.disp=tmpi1->arg1.disp;
- tmpi->arg1.reg=tmpi1->arg1.reg+tmpi2->arg1.reg<<8;
- goto p4_sib;
- } else if (tmpi1->arg1.reg!=REG_RSP) {
- tmpi->arg1.disp=tmpi1->arg1.disp;
- tmpi->arg1.reg=tmpi2->arg1.reg+tmpi1->arg1.reg<<8;
- goto p4_sib;
- }
- } else if (tmpi2->ic_code==IC_SHL_CONST &&
- tmpi2->arg1.type==MDF_REG+RT_I64 && tmpi2->ic_data<=3) {
- if (tmpi2->arg1.reg!=REG_RSP) {
- tmpi->arg1.disp=tmpi1->arg1.disp;
- tmpi->arg1.reg=tmpi1->arg1.reg+tmpi2->arg1.reg<<8;
- if (tmpi2->ic_data==1)
- tmpi->arg1.reg|=0x4000;
- else if (tmpi2->ic_data==2)
- tmpi->arg1.reg|=0x8000;
- else
- tmpi->arg1.reg|=0xC000;
- goto p4_sib;
- }
- }
- }
- break;
- case IC_ASSIGN_PP:
- case IC_ASSIGN_MM:
-//this val was stashed during pass012 for pointer arithmetic
- tmpi->ic_class2=tmpi->t.class2; //See ic_class2
- case IC_ASSIGN:
- case IC_SHL_EQU:
- case IC_SHR_EQU:
- case IC_MUL_EQU:
- case IC_DIV_EQU:
- case IC_MOD_EQU:
- case IC_AND_EQU:
- case IC_OR_EQU:
- case IC_XOR_EQU:
- case IC_ADD_EQU:
- case IC_SUB_EQU:
- if (tmpi1->ic_code==IC_LEA) {
- if (tmpi1->arg1.type&(MDF_DISP|MDF_SIB)) {
- tmpi2=tmpi->next;
- if (tmpi1->arg1.type&MDF_DISP && tmpi1->arg1.reg==REG_RBP) {
- i=CmpOffset2Reg(tmpi1->arg1.disp,reg_offsets);
- if (i>=0) {
- tmpi->ic_flags|=tmpi1->ic_flags;
- tmpi->arg1.type=MDF_REG+tmpi->arg1.type.raw_type;
- tmpi->arg1.reg=i;
- tmpi->arg1.disp=0;
- OptSetNOP2(tmpi1);
- } else {
- tmpi->ic_flags|=tmpi1->ic_flags;
- tmpi->arg1.type=MDF_DISP+tmpi->arg1.type.raw_type;
- tmpi->arg1.reg=REG_RBP;
- tmpi->arg1.disp=tmpi1->arg1.disp;
- OptSetNOP2(tmpi1);
- }
- } else {
- tmpi->ic_flags|=tmpi1->ic_flags;
- tmpi->arg1.type=tmpi1->arg1.type&MDG_MASK+
- tmpi->arg1.type.raw_type;
- tmpi->arg1.reg=tmpi1->arg1.reg;
- tmpi->arg1.disp=tmpi1->arg1.disp;
- OptSetNOP2(tmpi1);
- }
- if (tmpi->res.type&MDF_STK && tmpi2->arg2.type&MDF_STK &&
- code!=IC_ASSIGN_PP && code!=IC_ASSIGN_MM) {
- tmpi->res.type=tmpi->arg1.type;
- tmpi->res.reg=tmpi->arg1.reg;
- tmpi->res.disp=tmpi->arg1.disp;
- tmpi2->arg2.type=tmpi->arg1.type;
- tmpi2->arg2.reg=tmpi->arg1.reg;
- tmpi2->arg2.disp=tmpi->arg1.disp;
- CmpMinTypePointed(tmpi2,tmpi->arg1_type_pointed_to);
- }
- tmpi->ic_flags|=ICF_BY_VAL;
- }
- } else if ((tmpi1->ic_code==IC_ABS_ADDR ||
- tmpi1->ic_code==IC_MOV && tmpi1->arg1.type==MDF_IMM+RT_I64 &&
- 0<=tmpi1->arg1.disp<=I32_MAX)&& !(tmpi1->ic_flags&ICF_NO_RIP)) {
- tmpi->ic_flags|=tmpi1->ic_flags;
- if (tmpi1->ic_code==IC_ABS_ADDR)
- tmpi->arg1.disp=tmpi1->ic_data;
- else
- tmpi->arg1.disp=tmpi1->arg1.disp;
- tmpi->arg1.type=MDF_RIP_DISP32+tmpi->arg1.type.raw_type;
- tmpi->arg1.reg=REG_RIP;
- tmpi->ic_flags|=ICF_BY_VAL;
- OptSetNOP2(tmpi1);
- }
- break;
- case IC_RETURN_VAL:
- case IC_RETURN_VAL2:
- if (!tmpi->ic_class) {
- if (_type) {
- tmpil1=tmpi;
- while (tmpil1=OptLag1(tmpil1))
- if (tmpil1->ic_class) {
- if (tmpil1->ic_flags & ICF_RES_TO_F64)
- *_type=RT_F64;
- else if (tmpil1->ic_flags & ICF_RES_TO_INT)
- *_type=RT_I64;
- else
- *_type=tmpil1->ic_class->raw_type;
- break;
- }
- }
- tmpi->ic_class=cmp.internal_types[RT_I64];
- } else if (_type)
- *_type=tmpi->ic_class->raw_type;
- break;
- case IC_NOP1:
- tmpi=OptFree(tmpi);
- break;
- case IC_BR_BT:
- case IC_BR_BTS:
- case IC_BR_BTR:
- case IC_BR_BTC:
- case IC_BR_NOT_BT:
- case IC_BR_NOT_BTS:
- case IC_BR_NOT_BTR:
- case IC_BR_NOT_BTC:
- case IC_BT:
- case IC_BTS:
- case IC_BTR:
- case IC_BTC:
- case IC_LBTS:
- case IC_LBTR:
- case IC_LBTC:
- if (!(tmpi->ic_flags&ICF_BY_VAL)) {
- if (tmpi2->ic_code==IC_ADDR) {
- if (tmpi2->arg1.type&MDF_STK &&
- tmpi2->res.type&MDF_STK) {
- if (tmpil2=OptLag1(tmpi2)) {
- if (tmpil2->ic_code==IC_LEA) {
- if (tmpil2->arg1.type&(MDF_IMM|MDG_REG_DISP_SIB_RIP)) {
- if (tmpi2) {
- tmpi->ic_flags|=tmpi2->ic_flags;
- OptFree(tmpi2);
- }
- tmpi->ic_flags|=tmpil2->ic_flags|ICF_BY_VAL;
- tmpi->arg2.type=tmpil2->arg1.type;
- tmpi->arg2.reg =tmpil2->arg1.reg;
- tmpi->arg2.disp=tmpil2->arg1.disp;
- OptFree(tmpil2);
- }
- break;
- } else if (tmpil2->ic_code!=IC_ABS_ADDR &&
- !(tmpil2->ic_code==IC_MOV &&
- tmpil2->arg1.type==MDF_IMM+RT_I64 &&
- 0<=tmpil2->arg1.disp<=I32_MAX) ||
- tmpil2->ic_flags&ICF_NO_RIP)
- tmpil2=NULL;
- else {
- if (tmpil2->ic_code==IC_ABS_ADDR)
- tmpi->arg2.disp=tmpil2->ic_data;
- else
- tmpi->arg2.disp=tmpil2->arg1.disp;
- }
- }
- } else {
- if (tmpi2->arg1.type==MDF_IMM+RT_I64 &&
- 0<=tmpi2->arg1.disp<=I32_MAX &&
- !(tmpi2->ic_flags&ICF_NO_RIP)) {
- tmpil2=tmpi2;
- tmpi2=NULL;
- tmpi->arg2.disp=tmpil2->arg1.disp;
- } else
- tmpil2=NULL;
- }
- if (tmpil2) {
- if (tmpi2) {
- tmpi->ic_flags|=tmpi2->ic_flags;
- OptFree(tmpi2);
- }
- tmpi->ic_flags|=tmpil2->ic_flags|ICF_BY_VAL;
- tmpi->arg2.type=MDF_RIP_DISP32+tmpi->arg2.type.raw_type;
- tmpi->arg2.reg=REG_RIP;
- OptFree(tmpil2);
- }
- } else if (tmpi2->ic_code==IC_MOV && tmpi2->res.type&MDF_STK &&
- tmpi2->arg1.type==MDF_IMM+RT_I64 &&
- 0<=tmpi2->arg1.disp<=I32_MAX &&
- !(tmpi2->ic_flags&ICF_NO_RIP)) {
- tmpi->arg2.disp=tmpi2->arg1.disp;
- tmpi->ic_flags|=tmpi2->ic_flags|ICF_BY_VAL;
- tmpi->arg2.type=MDF_RIP_DISP32+tmpi->arg2.type.raw_type;
- tmpi->arg2.reg=REG_RIP;
- OptFree(tmpi2);
- }
- }
- break;
- case IC_BR_EQU_EQU ...IC_BR_LESS_EQU:
- case IC_BR_EQU_EQU2...IC_BR_LESS_EQU2:
- case IC_BR_CARRY:
- case IC_BR_NOT_CARRY:
- case IC_BR_ZERO:
- case IC_BR_NOT_ZERO:
- lb=tmpi->ic_data;
- if (tmpi->ic_flags&ICF_PUSH_CMP) {
- lb->flags|=CMF_POP_CMP;
- lb->fwd=NULL;
- }
- break;
- case IC_LABEL:
- lb=tmpi->ic_data;
- if (lb->use_cnt)
- dead_code=FALSE;
- break;
- case IC_JMP:
- case IC_RET:
- dead_code=TRUE;
- break;
- case IC_NOP2:
- ps->ptr+=tmpi->ic_data;
- break;
- case IC_CALL_END:
- case IC_END_EXP:
- if (!(tmpil1->ic_flags&ICF_PUSH_RES)) {
- if (tmpi->ic_flags&ICF_RES_NOT_USED) {
- tmpil1->ic_flags|=ICF_RES_NOT_USED;
- tmpil1->res.type=MDF_NULL+tmpil1->res.type.raw_type;
- } else if (tmpi->arg1.type&MDF_STK &&
- tmpil1->res.type&MDF_STK) {
- tmpi->arg1.type=MDF_REG+tmpi->arg1.type.raw_type;
- tmpi->arg1.disp=0;
- tmpil1->res.type=MDF_REG+tmpil1->res.type.raw_type;
- tmpil1->res.disp=0;
- if (intermediate_code_table[tmpi->ic_code].arg_cnt==IS_2_ARG) {
- tmpi->arg1.reg=REG_R8;
- tmpil1->res.reg=REG_R8;
- } else {
- tmpi->arg1.reg=REG_RAX;
- tmpil1->res.reg=REG_RAX;
- }
- }
- }
- break;
- case IC_STR_CONST:
- case IC_FS:
- case IC_GS:
- case IC_MOV_FS:
- case IC_MOV_GS:
- case IC_RIP:
- case IC_RBP:
- case IC_REG:
- case IC_COM:
- case IC_HOLYC_TYPECAST:
- case IC_NOT:
- case IC_UNARY_MINUS:
- case IC_PUSH_CMP:
- case IC_ADD_CONST:
- case IC_SUB_CONST:
- case IC_ENTER:
- case IC_ADD_RSP:
- case IC_ADD_RSP1:
- case IC_CALL:
- case IC_CALL_INDIRECT:
- case IC_CALL_INDIRECT2:
- case IC_CALL_EXTERN:
- case IC_CALL_IMPORT:
- case IC_PUSH:
- case IC_POP:
- case IC_INVLPG:
- case IC_CLFLUSH:
- case IC_GET_RFLAGS:
- case IC_CARRY:
- case IC_RDTSC:
- case IC_SET_RFLAGS:
- case IC_GET_RBP:
- case IC_SET_RBP:
- case IC_GET_RSP:
- case IC_GET_RAX:
- case IC_SET_RSP:
- case IC_SET_RAX:
- case IC_SHL_CONST:
- case IC_LEA:
- case IC_SHR_CONST:
- case IC_POWER:
- case IC_SHL:
- case IC_SHR:
- case IC_MUL:
- case IC_DIV:
- case IC_MOD:
- case IC_AND:
- case IC_OR:
- case IC_XOR:
- case IC_SUB:
- case IC_EQU_EQU...IC_LESS_EQU:
- case IC_AND_AND:
- case IC_OR_OR:
- case IC_XOR_XOR:
- case IC_GET_LABEL:
- case IC_ABS_ADDR:
- case IC_HEAP_GLBL:
- case IC_ADDR_IMPORT:
- case IC_BSF:
- case IC_BSR:
- case IC_SIGN_I64:
- case IC_TOUPPER:
- case IC_TO_I64:
- case IC_TO_F64:
- case IC_TO_BOOL:
- case IC_SQR:
- case IC_ABS:
- case IC_SQRT:
- case IC_SIN:
- case IC_COS:
- case IC_TAN:
- case IC_ATAN:
- case IC_ABS_I64:
- case IC_MIN_I64:
- case IC_MAX_I64:
- case IC_MIN_U64:
- case IC_MAX_U64:
- case IC_MOD_U64:
- case IC_SQR_I64:
- case IC_SQR_U64:
- case IC_SWAP_U8:
- case IC_SWAP_U16:
- case IC_SWAP_U32:
- case IC_SWAP_I64:
- case IC_QUE_INIT:
- case IC_QUE_INS:
- case IC_QUE_INS_REV:
- case IC_QUE_REM:
- case IC_IN_U32:
- case IC_IN_U16:
- case IC_IN_U8:
- case IC_STRLEN:
- case IC_OUT_U32:
- case IC_OUT_U16:
- case IC_OUT_U8:
- case IC_NOBOUND_SWITCH:
- case IC_SWITCH:
- case IC_END:
- case IC_ADDR:
- case IC_CALL_START:
- case IC_LEAVE:
- case IC_PUSH_REGS:
- case IC_POP_REGS:
- case IC_ASM:
- case IC_BR_AND_NOT_ZERO:
- case IC_BR_AND_ZERO:
- case IC_SUB_CALL:
- case IC_CALL_END2:
- break;
- default:
- "Pass:%d Missing IC hndlr\n",cc->pass;
- ICPut(cc,tmpi);
- LexExcept(cc,"Compiler Optimization Error at ");
- }
- if (tmpi) {
- while (OptIC4(tmpi));
- code=tmpi->ic_code;
- if (intermediate_code_table[code].res_cnt)
- PrsPush(ps,tmpi);
- }
- }
- tmpi=tmpi_next;
- }
- if (ps->ptr>2) {
- "Pass:%d Stk:%08X\n",cc->pass,ps->ptr;
- LexExcept(cc,"Compiler Optimization Error at ");
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/OptPass5.HC.HTML b/public/src/Compiler/OptPass5.HC.HTML deleted file mode 100644 index b8e6f86..0000000 --- a/public/src/Compiler/OptPass5.HC.HTML +++ /dev/null @@ -1,102 +0,0 @@ - - - - - OptPass5.HC - - - - - U0 OptPass5(CCmpCtrl *cc)
-{
- CIntermediateCode *tmpi,*tmpi1;
- I64 code,i;
- CPrsStk *ps=cc->ps;
- ps->ptr=0;
- ps->ptr2=0;
-
- tmpi=cc->coc.coc_head.next;
- while (code=tmpi->ic_code) {
- if (code>IC_NOP2) {
- if (tmpi->ic_flags&ICF_PASS_TRACE) {
- if (Bt(&cc->saved_pass_trace,5)) {
- "%2d:",ps->ptr;
- ICPut(cc,tmpi);
- }
- }
- if (intermediate_code_table[code].arg_cnt==IS_V_ARG)
- ps->ptr-=tmpi->ic_data>>3;
- if (code==IC_PUSH_REGS) {
- for (i=0;i<REG_REGS_NUM;i++)
- if (Bt(&tmpi->ic_data,i))
- ps->ptr++;
- } else if (code==IC_POP_REGS) {
- for (i=0;i<REG_REGS_NUM;i++)
- if (Bt(&tmpi->ic_data,i))
- ps->ptr--;
- }
- if (tmpi->arg2.type&MDF_STK) {
- tmpi1=PrsPop(ps);
- if (tmpi1->ic_code==IC_MOV || tmpi1->ic_code==IC_REG) {
- if (tmpi1->ic_flags & ICF_RES_TO_INT) {
- if (tmpi1->arg1.type&MDF_IMM)
- tmpi1->arg1.disp=tmpi1->arg1.disp(F64);
- else
- tmpi->ic_flags|=ICF_ARG2_TO_INT;
- } else if (tmpi1->ic_flags&ICF_RES_TO_F64) {
- if (tmpi1->arg1.type&MDF_IMM)
- tmpi1->arg1.disp(F64)=tmpi1->arg1.disp;
- else
- tmpi->ic_flags|=ICF_ARG2_TO_F64;
- }
- tmpi->arg2.type=tmpi1->arg1.type&MDG_MASK+
- MinI64(tmpi->arg2.type.raw_type,
- MinI64(tmpi1->res.type.raw_type,tmpi1->arg1.type.raw_type));
- tmpi->arg2.reg=tmpi1->arg1.reg;
- tmpi->arg2.disp=tmpi1->arg1.disp;
- tmpi->ic_flags|=tmpi1->ic_flags&ICG_NO_CVT_MASK;
- OptSetNOP2(tmpi1);
- }
- }
-
- if (tmpi->arg1.type&MDF_STK) {
- tmpi1=PrsPop(ps);
- if (tmpi1->ic_code==IC_MOV || tmpi1->ic_code==IC_REG) {
- if (tmpi1->ic_flags & ICF_RES_TO_INT) {
- if (tmpi1->arg1.type&MDF_IMM)
- tmpi1->arg1.disp=tmpi1->arg1.disp(F64);
- else
- tmpi->ic_flags|=ICF_ARG1_TO_INT;
- } else if (tmpi1->ic_flags&ICF_RES_TO_F64) {
- if (tmpi1->arg1.type&MDF_IMM) {
- if (tmpi1->arg1.type&RTF_UNSIGNED)
- tmpi1->arg1.disp(F64)=tmpi1->arg1.disp(U64);
- else
- tmpi1->arg1.disp(F64)=tmpi1->arg1.disp(I64);
- } else
- tmpi->ic_flags|=ICF_ARG1_TO_F64;
- }
- tmpi->arg1.type=tmpi1->arg1.type&MDG_MASK+
- MinI64(tmpi->arg1.type.raw_type,
- MinI64(tmpi1->res.type.raw_type,tmpi1->arg1.type.raw_type));
- CmpMinTypePointed(tmpi,tmpi1->arg1_type_pointed_to);
- tmpi->arg1.reg=tmpi1->arg1.reg;
- tmpi->arg1.disp=tmpi1->arg1.disp;
- tmpi->ic_flags|=tmpi1->ic_flags&ICG_NO_CVT_MASK;
- OptSetNOP2(tmpi1);
- }
- }
- if (tmpi->res.type&MDF_STK &&
- !(tmpi->ic_flags&ICF_RES_NOT_USED))
- PrsPush(ps,tmpi);
- }
- tmpi=tmpi->next;
- }
- if (ps->ptr>2) {
- "Pass:%d Stk:%08X\n",cc->pass,ps->ptr;
- LexExcept(cc,"Compiler Optimization Error at ");
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/OptPass6.HC.HTML b/public/src/Compiler/OptPass6.HC.HTML deleted file mode 100644 index da9f843..0000000 --- a/public/src/Compiler/OptPass6.HC.HTML +++ /dev/null @@ -1,197 +0,0 @@ - - - - - OptPass6.HC - - - - - Bool OptIC6(CIntermediateCode *tmpi)
-{
- CIntermediateCode *tmpil1;
- if (tmpi->ic_code<IC_IMM_I64 || !(tmpil1=OptLag1(tmpi)))
- return FALSE;
- if (tmpil1->ic_code==IC_ADD_CONST && tmpi->ic_code==IC_DEREF &&
- tmpi->ic_flags&ICF_ARG1_WAS_STK && tmpi->arg1.type&MDF_REG &&
- tmpil1->res.type&MDF_REG && I32_MIN<=tmpil1->ic_data<=I32_MAX &&
- !Bt(&cmp.non_ptr_vars_mask,tmpil1->arg1.reg)) {
- if (tmpil1->arg1.type&MDF_REG) {
- tmpi->ic_flags=tmpi->ic_flags&~ICF_ARG1_WAS_STK | tmpil1->ic_flags;
- tmpi->ic_code=IC_MOV;
- tmpi->arg1.type=MDF_DISP+tmpi->arg1_type_pointed_to;
- tmpi->arg1.reg=tmpil1->arg1.reg;
- tmpi->arg1.disp=tmpil1->ic_data;
- OptSetNOP2(tmpil1,-1);
- } else {
- tmpil1->ic_code=IC_MOV;
- tmpi->ic_code=IC_MOV;
- tmpi->arg1.type=MDF_DISP+tmpi->arg1_type_pointed_to;
- tmpi->arg1.disp=tmpil1->ic_data;
- }
- return TRUE;
- }
- return FALSE;
-}
-
-U0 OptPass6Lag(CCmpCtrl *cc,CPrsStk *ps,CIntermediateCode *tmpi,
- I64 *_stk_ptr,I64 reg_stk_size,I64 *_clobbered_reg_mask)
-{
- I64 stk_ptr=*_stk_ptr,code,
- clobbered_stk_tmp_mask,clobbered_reg_mask=*_clobbered_reg_mask;
- CHashFun *tmpf;
- code=tmpi->ic_code;
- if (tmpi->ic_flags&ICF_PASS_TRACE && Bt(&cc->saved_pass_trace,6)) {
- "%2d:",stk_ptr;
- ICPut(cc,tmpi);
- }
- if (code==IC_CALL_START) {
- if (reg_stk_size==1 && stk_ptr>0)
- clobbered_stk_tmp_mask=REGG_STK_TMP;
- else
- clobbered_stk_tmp_mask=0;
- if (tmpf=tmpi->ic_data) {
- if (Bt(&tmpf->flags,Ff_INTERNAL))
- clobbered_stk_tmp_mask=0;
- else {
- clobbered_stk_tmp_mask&=tmpf->clobbered_reg_mask;
- clobbered_reg_mask|=tmpf->clobbered_reg_mask;
- }
- }
- tmpi->ic_data=clobbered_stk_tmp_mask;
- PrsPush(ps,stk_ptr);
- PrsPush(ps,clobbered_stk_tmp_mask);
- } else if (code==IC_CALL_END) {
- tmpi->ic_data=PrsPop(ps);
- stk_ptr=PrsPop(ps);
- } else if (code==IC_CALL_END2) {
- ps->ptr--;
- stk_ptr=PrsPop(ps);
- }
- if (intermediate_code_table[code].arg_cnt==IS_V_ARG)
- stk_ptr-=tmpi->ic_data>>3;
- if (tmpi->arg2.type&MDF_STK) {
- stk_ptr--;
- if (stk_ptr<reg_stk_size) {
- tmpi->arg2.type=MDF_REG+tmpi->arg2.type.raw_type;
- tmpi->arg2.reg=Bsf(REGG_STK_TMP);
- tmpi->arg2.disp=0;
- }
- }
- if (tmpi->arg1.type&MDF_STK) {
- stk_ptr--;
- if (stk_ptr<reg_stk_size) {
- tmpi->arg1.type=MDF_REG+tmpi->arg1.type.raw_type;
- tmpi->arg1.reg=Bsf(REGG_STK_TMP);
- tmpi->arg1.disp=0;
- }
- }
- if (tmpi->res.type&MDF_STK && !(tmpi->ic_flags & ICF_PUSH_RES)) {
- stk_ptr++;
- if (stk_ptr<=reg_stk_size) {
- tmpi->res.type=MDF_REG+tmpi->res.type.raw_type;
- tmpi->res.reg=Bsf(REGG_STK_TMP);
- clobbered_reg_mask|=REGG_STK_TMP;
- tmpi->res.disp=0;
- }
- }
- while (OptIC6(tmpi));
- if (tmpi->res.type.raw_type!=RT_F64 && !(tmpi->ic_flags&ICF_USE_F64))
- tmpi->ic_flags|=ICF_USE_INT;
- *_stk_ptr=stk_ptr;
- *_clobbered_reg_mask=clobbered_reg_mask;
-}
-
-U0 OptPass6(CCmpCtrl *cc)
-{
- CIntermediateCode *tmpi,*tmpi_next,*tmpil1,*tmpil2,*old_tmpil2;
- I64 stk_ptr=0,reg_stk_size,clobbered_reg_mask=REGG_CLOBBERED;
- CPrsStk *ps=cc->ps;
- ps->ptr=0;
- ps->ptr2=0;
- if (Bt(&cc->opts,OPTf_NO_REG_VAR) || cc->flags&CCF_NO_REG_OPT)
- reg_stk_size=0;
- else
- reg_stk_size=1;
-#assert REGG_STK_TMP==1<<9
- tmpi=cc->coc.coc_head.next;
- old_tmpil2=NULL;
- tmpil1=tmpil2=&cmp.ic_nop;
- while (tmpi->ic_code) {
- if (tmpi->ic_code>IC_NOP2) {
- if (tmpil1->ic_code>IC_NOP2)
- tmpil2=tmpil1;
- tmpil1=tmpi;
- if (tmpi->arg2.type&MDF_STK) {
- if (tmpil2->res.type&MDF_STK &&
- !(tmpil2->ic_flags&ICF_PUSH_RES)) {
- if (tmpi->ic_code==IC_ASSIGN && tmpi->ic_flags&ICF_BY_VAL &&
- tmpi->ic_flags&ICF_RES_NOT_USED &&
- tmpil2->ic_code!=IC_CALL_END &&
- tmpil2->ic_code!=IC_CALL_END2 &&
- tmpil2->ic_code!=IC_SET_RAX &&
- !(tmpi->ic_flags&(ICF_ARG2_TO_F64|ICF_ARG2_TO_INT)) &&
- !(tmpil2->ic_flags&(ICF_RES_TO_F64|ICF_RES_TO_INT))) {
- tmpil2->res.type =tmpi->arg1.type&MDG_MASK+
- tmpi->arg1_type_pointed_to;
- tmpil2->res.reg =tmpi->arg1.reg;
- tmpil2->res.disp =tmpi->arg1.disp;
- tmpil2->ic_flags=tmpil2->ic_flags
- &~(ICF_RES_NOT_USED|ICF_RES_WAS_STK)
- |tmpi->ic_flags&~(ICF_BY_VAL|ICF_ARG1_WAS_STK|ICF_ARG2_WAS_STK);
- old_tmpil2=NULL;
- OptSetNOP1(tmpi);
- } else {
- tmpi->arg2.type=MDF_REG+tmpi->arg2.type.raw_type;
- tmpi->arg2.reg=REG_RAX;
- tmpi->arg2.disp=0;
- tmpil2->res.type=MDF_REG+tmpil2->res.type.raw_type;
- tmpil2->res.reg=REG_RAX;
- tmpil2->res.disp=0;
- }
- }
- } else if (tmpi->arg1.type&MDF_STK && tmpil2->res.type&MDF_STK &&
- !(tmpil2->ic_flags&ICF_PUSH_RES)) {
- tmpi->arg1.type=MDF_REG+tmpi->arg1.type.raw_type;
- tmpi->arg1.disp=0;
- tmpil2->res.type=MDF_REG+tmpil2->res.type.raw_type;
- tmpil2->res.disp=0;
- if (intermediate_code_table[tmpi->ic_code].arg_cnt==IS_2_ARG) {
- tmpi->arg1.reg=REG_R8;
- tmpil2->res.reg=REG_R8;
- } else {
- tmpi->arg1.reg=REG_RAX;
- tmpil2->res.reg=REG_RAX;
- }
- }
- if (tmpi->ic_flags & ICF_PUSH_RES)
- tmpi->res.type==MDF_STK+tmpi->res.type.raw_type;
- if (old_tmpil2!=tmpil2) {
- if (tmpil2->ic_code>IC_NOP2)
- OptPass6Lag(cc,ps,tmpil2,&stk_ptr,reg_stk_size,&clobbered_reg_mask);
- old_tmpil2=tmpil2;
- }
- }
- tmpi_next=tmpi->next;
- if (tmpi->ic_code<=IC_NOP2)
- OptFree(tmpi);
- tmpi=tmpi_next;
- }
- if (ps->ptr>2) {
- "Pass:%d Stk:%08X\n",cc->pass,ps->ptr;
- LexExcept(cc,"Compiler Optimization Error at ");
- }
- if (cc->htc.fun) {
- cc->htc.fun->used_reg_mask&=~REGG_STK_TMP;
- cc->htc.fun->used_reg_mask|=clobbered_reg_mask;
- cc->htc.fun->clobbered_reg_mask=clobbered_reg_mask;
- if (Bt(&cc->flags,CCf_PASS_TRACE_PRESENT) &&
- Bt(&cc->saved_pass_trace,6)) {
- "UsedReg Mask:%04X\n",cc->htc.fun->used_reg_mask;
- "Clobbered Reg Mask:%04X\n",clobbered_reg_mask;
- }
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/OptPass789A.HC.HTML b/public/src/Compiler/OptPass789A.HC.HTML deleted file mode 100644 index 523a7c8..0000000 --- a/public/src/Compiler/OptPass789A.HC.HTML +++ /dev/null @@ -1,1164 +0,0 @@ - - - - - OptPass789A.HC - - - - - I64 OptPass789A(CCmpCtrl *cc,COptReg *reg_offsets,U8 *buf,CDbgInfo **_dbg)
-{/*cc->pass==7 is first time
-cc->pass==8 is second time
-cc->pass==9 is third time
-cc->pass==9 is fourth time and repeated until size stops shrinking
-size is now known
-cc->pass==10 is final pass, code is placed into buf.
-*/
- CIntermediateCode *tmpi,*tmpi_next;
- I64 i,cnt,num_lines=cc->max_line+1-cc->min_line,rip=0,rip2;
- U8 *ptr,saved_arg1_arg2_r[3*sizeof(CICArg)];
- CCodeMisc *lb;
- CAOT *tmpaot;
- CAOTAbsAddr *tmpa;
- CAOTImportExport *tmpie;
- CAOTHeapGlbl *tmphg;
- CAOTHeapGlblRef *tmphgr;
- CDbgInfo *dbg_info;
- CAOTCtrl *aotc=cc->aotc;
- Bool short_jmp;
- CHashClass *tmpc;
- CHashFun *tmpf;
- CHashGlblVar *tmpg;
- CExternUsage *tmpeu;
-
- if (_dbg) {
- *_dbg=dbg_info=CAlloc(offset(CDbgInfo.body)+sizeof(U32)*(num_lines+1));
- dbg_info->min_line=cc->min_line;
- dbg_info->max_line=cc->max_line;
- if (cc->flags&CCF_AOT_COMPILE)
- dbg_info->body[0]=aotc->rip;
- else
- dbg_info->body[0]=buf;
- } else
- dbg_info=NULL;
-
- if (Bt(&cc->flags,CCf_PASS_TRACE_PRESENT) &&
- Bt(&cc->saved_pass_trace,cc->pass))
- "$BK,1$$LTRED$$IV,1$This code gets merged together and patched.\n"
- "$FG$$IV,0$$BK,0$";
-
- cc->last_float_op_ic=NULL;
- tmpi=&cc->coc.coc_head;
- tmpi->ic_last_start=-1;
- tmpi->ic_cnt=0;
- tmpi=tmpi->next;
- while (tmpi->ic_code) {
- tmpi_next=tmpi->next;
- if (tmpi->ic_flags&ICF_PASS_TRACE && Bt(&cc->saved_pass_trace,cc->pass))
- ICPut(cc,tmpi);
- rip2=rip;
- if (cc->flags&CCF_AOT_COMPILE)
- rip2+=aotc->rip;
- else
- rip2+=buf;
- cc->cur_ic_float_op_num=0;
- if (!(tmpi->ic_flags &ICF_CODE_FINAL)) {
- tmpi->ic_flags=tmpi->ic_flags&
- ~(ICF_PREV_DELETED|ICF_DONT_RESTORE)|ICF_CODE_FINAL;
- if (cc->pass==7)
- cc->dont_push_float=Btr(&tmpi->ic_flags,ICf_DONT_PUSH_FLOAT0);
- MemCpy(saved_arg1_arg2_r,&tmpi->arg1,3*sizeof(CICArg));
- tmpi->ic_cnt=0;
- tmpi->ic_last_start=-1;
- if (tmpi->arg2.type.mode) {
- if (tmpi->ic_flags & ICF_ARG2_TO_F64) {
- ICFCvt(cc,tmpi,REG_RAX,tmpi->arg2.type,
- tmpi->arg2.reg,tmpi->arg2.disp,FALSE,CN_A2,rip2);
- tmpi->arg2.type=MDF_REG+RT_I64;
- tmpi->arg2.reg=REG_RAX;
- tmpi->arg2.disp=0;
- } else if (tmpi->ic_flags & ICF_ARG2_TO_INT) {
- ICFCvt(cc,tmpi,REG_RAX,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,TRUE,CN_A2,rip2);
- tmpi->arg2.type=MDF_REG+RT_I64;
- tmpi->arg2.reg=REG_RAX;
- tmpi->arg2.disp=0;
- }
- }
- if (tmpi->arg1.type.mode) {
- if (tmpi->ic_flags & ICF_ARG1_TO_F64) {
- ICFCvt(cc,tmpi,REG_RDX,tmpi->arg1.type,
- tmpi->arg1.reg,tmpi->arg1.disp,FALSE,CN_A1,rip2);
- tmpi->arg1.type=MDF_REG+RT_I64;
- tmpi->arg1.reg=REG_RDX;
- tmpi->arg1.disp=0;
- } else if (tmpi->ic_flags & ICF_ARG1_TO_INT) {
- ICFCvt(cc,tmpi,REG_RDX,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,TRUE,CN_A1,rip2);
- tmpi->arg1.type=MDF_REG+RT_I64;
- tmpi->arg1.reg=REG_RDX;
- tmpi->arg1.disp=0;
- }
- }
-
- switch [tmpi->ic_code] {
- start:
- start:
- case IC_ABS_ADDR:
- ICU16(tmpi,0xB848);
- ICU64(tmpi,tmpi->ic_data);
- if (buf && cc->flags&CCF_AOT_COMPILE &&
- !(cc->flags&(CCF_NO_ABSS|CCF_ASM_EXPRESSIONS))) {
- tmpa=CAlloc(sizeof(CAOTAbsAddr));
- tmpa->next=aotc->abss;
- tmpa->type=AAT_ADD_U64;
- aotc->abss=tmpa;
- tmpa->rip=rip2+tmpi->ic_cnt-8;
- }
- break;
- case IC_HEAP_GLBL:
- ICU16(tmpi,0xB848);
- ICU64(tmpi,0);
- tmphg=tmpi->ic_data;
- if (buf && cc->flags&CCF_AOT_COMPILE &&
-//TODO:is this necessary--flags?
- !(cc->flags&(CCF_NO_ABSS|CCF_ASM_EXPRESSIONS))) {
- tmphgr=CAlloc(sizeof(CAOTHeapGlblRef));
- tmphgr->next=tmphg->references;
- tmphg->references=tmphgr;
- tmphgr->rip=rip2+tmpi->ic_cnt-8;
- }
- break;
- case IC_ADDR_IMPORT:
- ICU8(tmpi,0xB8);
- ICU32(tmpi,0);
- if (buf && !(cc->flags&CCF_NO_ABSS)) {
- tmpg=tmpi->ic_data;
- tmpie=CAlloc(sizeof(CAOTImportExport));
- tmpie->type=IET_IMM_U32;
- tmpie->rip=rip2+tmpi->ic_cnt-4;
- tmpie->next=tmpg->ie_lst;
- tmpg->ie_lst=tmpie;
- }
- ICU24(tmpi,0xC06348);
- break;
- case IC_RIP:
- ICU16(tmpi,0xB848);
- ICU64(tmpi,rip2+tmpi->ic_cnt-2);
- if (cc->flags&CCF_AOT_COMPILE && buf &&!(cc->flags&CCF_NO_ABSS)) {
- tmpa=CAlloc(sizeof(CAOTAbsAddr));
- tmpa->next=aotc->abss;
- tmpa->type=AAT_ADD_U64;
- aotc->abss=tmpa;
- tmpa->rip=rip2+tmpi->ic_cnt-8;
- }
- break;
- end:
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip2);
- break;
- case IC_BR_CARRY:
- ICFlagBranch(tmpi,rip,0x72820F,buf);
- break;
- case IC_BR_NOT_CARRY:
- ICFlagBranch(tmpi,rip,0x73830F,buf);
- break;
- case IC_BR_ZERO:
- ICTestAndBranch(tmpi,rip,0x74840F,buf,rip2);
- break;
- case IC_BR_NOT_ZERO:
- ICTestAndBranch(tmpi,rip,0x75850F,buf,rip2);
- break;
- case IC_BR_MM_ZERO:
- ICPreIncDec(tmpi,SLASH_OP_DEC,rip2);
- ICFlagBranch(tmpi,rip,0x74840F,buf);
- break;
- case IC_BR_MM_NOT_ZERO:
- ICPreIncDec(tmpi,SLASH_OP_DEC,rip2);
- ICFlagBranch(tmpi,rip,0x75850F,buf);
- break;
- case IC_BR_EQU_EQU:
- ICCmpAndBranch(tmpi,FALSE,rip,0x74840F,0x74840F,
- 0x74840F,0x74840F,buf,rip2);
- break;
- case IC_BR_EQU_EQU2:
- ICCmpAndBranch(tmpi,TRUE,rip,0x74840F,0x74840F,
- 0x74840F,0x74840F,buf,rip2);
- break;
- case IC_BR_NOT_EQU:
- ICCmpAndBranch(tmpi,FALSE,rip,0x75850F,0x75850F,
- 0x75850F,0x75850F,buf,rip2);
- break;
- case IC_BR_NOT_EQU2:
- ICCmpAndBranch(tmpi,TRUE,rip,0x75850F,0x75850F,
- 0x75850F,0x75850F,buf,rip2);
- break;
- case IC_BR_LESS:
- if (tmpi->ic_flags&ICF_USE_F64)
- ICFCmpAndBranch(cc,tmpi, rip,0x72820F,0x77870F,buf,rip2);
- else
- ICCmpAndBranch(tmpi,FALSE,rip,0x72820F,0x7C8C0F,
- 0x77870F,0x7F8F0F,buf,rip2);
- break;
- case IC_BR_LESS2:
- ICCmpAndBranch(tmpi,TRUE,rip,0x72820F,0x7C8C0F,
- 0x77870F,0x7F8F0F,buf,rip2);
- break;
- case IC_BR_GREATER_EQU:
- if (tmpi->ic_flags&ICF_USE_F64)
- ICFCmpAndBranch(cc,tmpi, rip,0x73830F,0x76860F,buf,rip2);
- else
- ICCmpAndBranch(tmpi,FALSE,rip,0x73830F,0x7D8D0F,
- 0x76860F,0x7E8E0F,buf,rip2);
- break;
- case IC_BR_GREATER_EQU2:
- ICCmpAndBranch(tmpi,TRUE,rip,0x73830F,0x7D8D0F,
- 0x76860F,0x7E8E0F,buf,rip2);
- break;
- case IC_BR_GREATER:
- if (tmpi->ic_flags&ICF_USE_F64)
- ICFCmpAndBranch(cc,tmpi, rip,0x77870F,0x72820F,buf,rip2);
- else
- ICCmpAndBranch(tmpi,FALSE,rip,0x77870F,0x7F8F0F,
- 0x72820F,0x7C8C0F,buf,rip2);
- break;
- case IC_BR_GREATER2:
- ICCmpAndBranch(tmpi,TRUE,rip,0x77870F,0x7F8F0F,
- 0x72820F,0x7C8C0F,buf,rip2);
- break;
- case IC_BR_LESS_EQU:
- if (tmpi->ic_flags&ICF_USE_F64)
- ICFCmpAndBranch(cc,tmpi, rip,0x76860F,0x73830F,buf,rip2);
- else
- ICCmpAndBranch(tmpi,FALSE,rip,0x76860F,0x7E8E0F,
- 0x73830F,0x7D8D0F,buf,rip2);
- break;
- case IC_BR_LESS_EQU2:
- ICCmpAndBranch(tmpi,TRUE,rip,0x76860F,0x7E8E0F,
- 0x73830F,0x7D8D0F,buf,rip2);
- break;
- case IC_BR_BT:
- ICBrBitOps(tmpi,rip,0xA30F,0x20BA0F,0x72820F,buf,rip2);
- break;
- case IC_BR_BTS:
- ICBrBitOps(tmpi,rip,0xAB0F,0x28BA0F,0x72820F,buf,rip2);
- break;
- case IC_BR_BTR:
- ICBrBitOps(tmpi,rip,0xB30F,0x30BA0F,0x72820F,buf,rip2);
- break;
- case IC_BR_BTC:
- ICBrBitOps(tmpi,rip,0xBB0F,0x38BA0F,0x72820F,buf,rip2);
- break;
- case IC_BR_NOT_BT:
- ICBrBitOps(tmpi,rip,0xA30F,0x20BA0F,0x73830F,buf,rip2);
- break;
- case IC_BR_NOT_BTS:
- ICBrBitOps(tmpi,rip,0xAB0F,0x28BA0F,0x73830F,buf,rip2);
- break;
- case IC_BR_NOT_BTR:
- ICBrBitOps(tmpi,rip,0xB30F,0x30BA0F,0x73830F,buf,rip2);
- break;
- case IC_BR_NOT_BTC:
- ICBrBitOps(tmpi,rip,0xBB0F,0x38BA0F,0x73830F,buf,rip2);
- break;
- case IC_BR_AND_ZERO:
- ICAndBranch(tmpi,rip,0x74840F,buf,rip2);
- break;
- case IC_BR_AND_NOT_ZERO:
- ICAndBranch(tmpi,rip,0x75850F,buf,rip2);
- break;
- case IC_SUB_CALL:
- lb=OptLabelFwd(tmpi->ic_data);
- ICU8(tmpi,0xE8);
- ICU32(tmpi,lb->addr-(rip+5));
- break;
- case IC_JMP:
- lb=OptLabelFwd(tmpi->ic_data);
- short_jmp=ToBool(tmpi->ic_flags&ICF_SHORT_JMP);
- if (!buf && lb->addr!=INVALID_PTR &&
- I8_MIN+5<lb->addr-rip<I8_MAX-5)
- short_jmp=TRUE;
- if (short_jmp) {
- tmpi->ic_flags|=ICF_SHORT_JMP;
- i=lb->addr-(rip+2);
- if (buf || i)
- ICU16(tmpi,i<<8+0xEB);
- else
- tmpi->ic_code=IC_NOP1;
- } else {
- i=lb->addr-(rip+5);
- ICU8(tmpi,0xE9);
- ICU32(tmpi,i);
- }
- break;
- case IC_LABEL:
- lb=tmpi->ic_data;
- lb->addr=rip;
- if (lb->flags&CMF_POP_CMP) {
- ICAddRSP(tmpi,-8,FALSE);
- ICAddRSP(tmpi,8,FALSE);
- }
- if (lb->type==CMT_ASM_LABEL)
- lb->addr+=lb->rip;
- break;
- case IC_STR_CONST:
- case IC_GET_LABEL:
- lb=tmpi->ic_data;
- if (cc->flags&CCF_AOT_COMPILE)
- i=lb->addr+aotc->rip;
- else
- i=lb->addr+buf;
- ICLea(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_RIP_DISP32+RT_PTR,0,i,cc,buf,rip2);
- break;
- case IC_ASM:
- tmpaot=tmpi->ic_data;
- tmpi->ic_cnt+=tmpaot->aot_U8s;
- if (buf) {
- MemCpy(buf+rip,tmpaot->buf,tmpaot->aot_U8s);
- Free(tmpaot->buf);
- tmpaot->buf=buf;
- tmpaot->rip=rip;
- tmpaot->rip2=rip2;
- if (cc->flags&CCF_AOT_COMPILE)
- CmpFixUpAOTAsm(cc,tmpaot);
- else
- CmpFixUpJITAsm(cc,tmpaot);
- cnt=tmpi->ic_cnt;
- goto op789A_skip_copy;
- }
- break;
- case IC_CALL:
- i=tmpi->ic_data-(rip2+5);
- if (!(I32_MIN<=i<=I32_MAX) && !(cc->flags&CCF_AOT_COMPILE)) {
- ICU16(tmpi,0xBB48);
- ICU64(tmpi,tmpi->ic_data);
- ICU16(tmpi,0xD3FF);
- } else {
- ICU8(tmpi,0xE8);
- ICU32(tmpi,i);
- }
- break;
- case IC_CALL_EXTERN: //Only for static modules
- ICU8(tmpi,0xE8);
- ICU32(tmpi,0);
- if (buf) {
- tmpf=tmpi->ic_data;
- tmpeu=CAlloc(sizeof(CExternUsage));
- tmpeu->next=tmpf->ext_lst;
- tmpf->ext_lst=tmpeu;
- tmpeu->rip=rip2+1;
- }
- break;
- case IC_CALL_INDIRECT2:
- ICU16(tmpi,0xBB48);
- if (cc->flags&CCF_AOT_COMPILE) i=rip2+tmpi->ic_cnt;
- ICU64(tmpi,tmpi->ic_data);
- ICU16(tmpi,0x13FF);
- if (buf && cc->flags&CCF_AOT_COMPILE&& !(cc->flags&CCF_NO_ABSS)) {
- tmpa=CAlloc(sizeof(CAOTAbsAddr));
- tmpa->next=aotc->abss;
- tmpa->type=AAT_ADD_U64;
- aotc->abss=tmpa;
- tmpa->rip=i;
- }
- break;
- case IC_CALL_IMPORT:
- if (GetOption(OPTf_USE_IMM64)) {
- ICU16(tmpi,0xBB48);
- ICU64(tmpi,0);
- if (buf) {
- tmpf=tmpi->ic_data;
- tmpie=CAlloc(sizeof(CAOTImportExport));
- tmpie->type=IET_IMM_I64;
- tmpie->rip=rip2+tmpi->ic_cnt-8;
- tmpie->next=tmpf->ie_lst;
- tmpf->ie_lst=tmpie;
- }
- ICU16(tmpi,0xD3FF);
- } else {
- ICU8(tmpi,0xE8);
- ICU32(tmpi,0);
- if (buf) {
- tmpf=tmpi->ic_data;
- tmpie=CAlloc(sizeof(CAOTImportExport));
- tmpie->type=IET_REL_I32;
- tmpie->rip=rip2+tmpi->ic_cnt-4;
- tmpie->next=tmpf->ie_lst;
- tmpf->ie_lst=tmpie;
- }
- }
- break;
- end:
- tmpi->ic_flags&=~ICF_CODE_FINAL;
- break;
- case IC_LEAVE:
- if (cc->htc.fun) {
- if (Bt(&cc->htc.fun->flags,Ff_INTERRUPT))
- ICPopRegs(tmpi,REGG_CLOBBERED|cc->htc.fun->used_reg_mask&
- (REGG_LOCAL_VARS|REGG_LOCAL_NON_PTR_VARS|REGG_STK_TMP));
- else
- ICPopRegs(tmpi,cc->htc.fun->used_reg_mask&
- (REGG_LOCAL_VARS|REGG_LOCAL_NON_PTR_VARS));
- }
- if (tmpi->ic_data<=I16_MAX) {
- if (tmpi->ic_data)
- ICU8(tmpi,0xC9); //LEAVE
- else
- ICU8(tmpi,0x5D); //POP RBP
- } else {
- ICAddRSP(tmpi,tmpi->ic_data);
- ICU8(tmpi,0x5D); //POP RBP
- }
- if (cc->htc.fun && Bt(&cc->htc.fun->flags,Ff_INTERRUPT)) {
- if (Bt(&cc->htc.fun->flags,Ff_HASERRCODE))
- ICAddRSP(tmpi,8);
- ICU16(tmpi,0xCF48);
- } else if (cc->htc.fun && cc->htc.fun->arg_cnt &&
- (Bt(&cc->htc.fun->flags,Ff_RET1) ||
- Bt(&cc->htc.fun->flags,Ff_ARGPOP)) &&
- !Bt(&cc->htc.fun->flags,Ff_NOARGPOP)) {
- ICU8(tmpi,0xC2);
- ICU16(tmpi,cc->htc.fun->arg_cnt<<3);
- } else
- ICU8(tmpi,0xC3);
- break;
- case IC_RET:
- ICU8(tmpi,0xC3);
- break;
- case IC_FS:
- ICZero(tmpi,REG_RAX);
- ICU32(tmpi,0x8B4864);
- break;
- case IC_GS:
- ICZero(tmpi,REG_RAX);
- ICU32(tmpi,0x8B4865);
- break;
- case IC_MOV_FS:
- ICZero(tmpi,REG_RAX);
- ICU8(tmpi,0x64);
-//It's ugly to use ic_class here
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_DISP+CmpRawType(tmpi->ic_class),REG_RAX,tmpi->ic_data,
- rip2);
- break;
- case IC_MOV_GS:
- ICZero(tmpi,REG_RAX);
- ICU8(tmpi,0x65);
-//It's ugly to use ic_class here
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_DISP+CmpRawType(tmpi->ic_class),REG_RAX,tmpi->ic_data,
- rip2);
- break;
- case IC_HOLYC_TYPECAST:
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- break;
- case IC_COM:
- ICUnaries(tmpi,SLASH_OP_NOT,rip2);
- break;
- case IC_NOT:
- ICNot(tmpi,rip2);
- break;
- case IC_UNARY_MINUS:
- if (tmpi->res.type.raw_type==RT_F64)
- ICFUnaryMinus(cc,tmpi,buf,rip2);
- else
- ICUnaries(tmpi,SLASH_OP_NEG,rip2);
- break;
- case IC_ADDR:
- case IC_MOV:
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- break;
- case IC_DEREF:
- ICDeref(tmpi,rip2);
- break;
- case IC_DEREF_PP:
- ICDerefPostIncDec(tmpi,SLASH_OP_INC,rip2);
- break;
- case IC_DEREF_MM:
- ICDerefPostIncDec(tmpi,SLASH_OP_DEC,rip2);
- break;
- case IC__PP:
- if (tmpi->ic_flags&ICF_USE_INT)
- ICPostIncDec(tmpi,SLASH_OP_INC,rip2);
- else
- ICFPostIncDec(cc,tmpi,CMP_TEMPLATE_INC,rip2);
- break;
- case IC__MM:
- if (tmpi->ic_flags&ICF_USE_INT)
- ICPostIncDec(tmpi,SLASH_OP_DEC,rip2);
- else
- ICFPostIncDec(cc,tmpi,CMP_TEMPLATE_DEC,rip2);
- break;
- case IC_PP_:
- if (tmpi->ic_flags&ICF_USE_INT)
- ICPreIncDec(tmpi,SLASH_OP_INC,rip2);
- else
- ICFPreIncDec(cc,tmpi,CMP_TEMPLATE_INC,rip2);
- break;
- case IC_MM_:
- if (tmpi->ic_flags&ICF_USE_INT)
- ICPreIncDec(tmpi,SLASH_OP_DEC,rip2);
- else
- ICFPreIncDec(cc,tmpi,CMP_TEMPLATE_DEC,rip2);
- break;
- case IC_LEA:
- ICLea(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,cc,buf,rip2);
- break;
- case IC_POWER:
- ICFPow(cc,tmpi,buf,rip2);
- break;
- case IC_SHL:
- ICShift(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,
- 0xE0D1E0D3E0C1,0xE0D1E0D3E0C1,rip2);
- break;
- case IC_SHR:
- ICShift(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,
- 0xE8D1E8D3E8C1,0xF8D1F8D3F8C1,rip2);
- break;
- case IC_MUL:
- if (tmpi->ic_flags&ICF_USE_INT)
- ICMul(tmpi,rip2);
- else
- ICFMul(cc,tmpi,buf,rip2);
- break;
- case IC_DIV:
- if (tmpi->ic_flags&ICF_USE_INT)
- ICDiv(tmpi,rip2);
- else
- ICFDiv(cc,tmpi,buf,rip2);
- break;
- case IC_MOD:
- if (tmpi->ic_flags&ICF_USE_INT)
- ICMod(tmpi,rip2);
- else
- ICFMod(cc,tmpi,rip2);
- break;
- case IC_AND:
- ICAddEct(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,0x23,rip2);
- break;
- case IC_OR:
- ICAddEct(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,0x0B,rip2);
- break;
- case IC_XOR:
- ICAddEct(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,0x33,rip2);
- break;
- case IC_ADD:
- if (tmpi->ic_flags&ICF_USE_INT)
- ICAddEct(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,0x03,rip2);
- else
- ICFAdd(cc,tmpi,buf,rip2);
- break;
- case IC_SUB:
- if (tmpi->ic_flags&ICF_USE_INT)
- ICSub(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip2);
- else
- ICFSub(cc,tmpi,buf,rip2);
- break;
- case IC_EQU_EQU:
- ICCmp(tmpi,0x75,0x75,rip2);
- break;
- case IC_NOT_EQU:
- ICCmp(tmpi,0x74,0x74,rip2);
- break;
- case IC_LESS:
- if (tmpi->ic_flags&ICF_USE_INT)
- ICCmp(tmpi,0x73,0x7D,rip2);
- else
- ICFCmp(cc,tmpi,CMP_TEMPLATE_LESS,rip2);
- break;
- case IC_GREATER_EQU:
- if (tmpi->ic_flags&ICF_USE_INT)
- ICCmp(tmpi,0x72,0x7C,rip2);
- else
- ICFCmp(cc,tmpi,CMP_TEMPLATE_GREATER_EQU,rip2);
- break;
- case IC_GREATER:
- if (tmpi->ic_flags&ICF_USE_INT)
- ICCmp(tmpi,0x76,0x7E,rip2);
- else
- ICFCmp(cc,tmpi,CMP_TEMPLATE_GREATER,rip2);
- break;
- case IC_LESS_EQU:
- if (tmpi->ic_flags&ICF_USE_INT)
- ICCmp(tmpi,0x77,0x7F,rip2);
- else
- ICFCmp(cc,tmpi,CMP_TEMPLATE_LESS_EQU,rip2);
- break;
- case IC_AND_AND:
- ICAndAnd(tmpi,rip2);
- break;
- case IC_OR_OR:
- ICOrOr(tmpi,rip2);
- break;
- case IC_XOR_XOR:
- ICXorXor(tmpi,rip2);
- break;
- case IC_ASSIGN:
- ICAssign(tmpi,rip2);
- break;
- case IC_ASSIGN_PP:
- ICAssignPostIncDec(tmpi,SLASH_OP_INC,rip2);
- break;
- case IC_ASSIGN_MM:
- ICAssignPostIncDec(tmpi,SLASH_OP_DEC,rip2);
- break;
- case IC_SHL_EQU:
- ICShiftEqu(tmpi,tmpi->arg1_type_pointed_to,
- tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,
- 0xE0D1E0D3E0C1,0xE0D1E0D3E0C1,rip2);
- break;
- case IC_SHR_EQU:
- ICShiftEqu(tmpi,tmpi->arg1_type_pointed_to,
- tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,
- 0xE8D1E8D3E8C1,0xF8D1F8D3F8C1,rip2);
- break;
- case IC_MUL_EQU:
- if (tmpi->ic_flags&ICF_USE_INT)
- ICMulEqu(tmpi,rip2);
- else
- ICFOpEqu(cc,tmpi,SLASH_OP_FMUL,buf,rip2);
- break;
- case IC_DIV_EQU:
- if (tmpi->ic_flags&ICF_USE_INT)
- ICDivEqu(tmpi,FALSE,rip2);
- else
- ICFOpEqu(cc,tmpi,SLASH_OP_FDIV,buf,rip2);
- break;
- case IC_MOD_EQU:
- if (tmpi->ic_flags&ICF_USE_INT)
- ICDivEqu(tmpi,TRUE,rip2);
- else
- ICFModEqu(cc,tmpi,rip2);
- break;
- case IC_AND_EQU:
- ICAndEqu(tmpi,rip2);
- break;
- case IC_OR_EQU:
- ICOrEqu(tmpi,rip2);
- break;
- case IC_XOR_EQU:
- ICXorEqu(tmpi,rip2);
- break;
- case IC_ADD_EQU:
- if (tmpi->ic_flags&ICF_USE_INT)
- ICAddSubEctEqu(tmpi,tmpi->arg1_type_pointed_to,
- tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,
- 0x010000000003,rip2);
- else
- ICFOpEqu(cc,tmpi,SLASH_OP_FADD,buf,rip2);
- break;
- case IC_SUB_EQU:
- if (tmpi->ic_flags&ICF_USE_INT)
- ICAddSubEctEqu(tmpi,tmpi->arg1_type_pointed_to,
- tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,
- 0x29000000052B,rip2);
- else
- ICFOpEqu(cc,tmpi,SLASH_OP_FSUB,buf,rip2);
- break;
- case IC_SHL_CONST:
- ICShift(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,
- MDF_IMM+RT_I64,0,tmpi->ic_data,
- 0xE0D1E0D3E0C1,0xE0D1E0D3E0C1,rip2);
- break;
- case IC_SHR_CONST:
- ICShift(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,
- MDF_IMM+RT_I64,0,tmpi->ic_data,
- 0xE8D1E8D3E8C1,0xF8D1F8D3F8C1,rip2);
- break;
- case IC_ADD_CONST:
- ICAddSubEctImm(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,tmpi->ic_data,
- 0x0003,rip2);
- break;
- case IC_SUB_CONST:
- ICAddSubEctImm(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,tmpi->ic_data,
- 0x052B,rip2);
- break;
- case IC_ENTER:
- ICU32(tmpi,0xEC8B4855);
- if (tmpi->ic_data)
- ICAddRSP(tmpi,-tmpi->ic_data,FALSE);
- if (cc->htc.fun) {
- if (Bt(&cc->htc.fun->flags,Ff_INTERRUPT))
- ICPushRegs(tmpi,REGG_CLOBBERED|cc->htc.fun->used_reg_mask&
- (REGG_LOCAL_VARS|REGG_LOCAL_NON_PTR_VARS|REGG_STK_TMP));
- else {
- if (sys_var_init_flag && i)
- ICLocalVarInit(tmpi);
- ICPushRegs(tmpi,cc->htc.fun->used_reg_mask
- &(REGG_LOCAL_VARS|REGG_LOCAL_NON_PTR_VARS));
- }
- for (i=0;i<REG_REGS_NUM;i++)
- if (reg_offsets[i]>0 && reg_offsets[i].offset!=I64_MAX) {
- tmpc=OptClassFwd(reg_offsets[i].m->member_class);
- ICMov(tmpi,MDF_REG+RT_I64,i,0,MDF_DISP+tmpc->raw_type,
- REG_RBP,reg_offsets[i].offset,rip2);
- }
- }
- break;
- case IC_ADD_RSP:
- ICAddRSP(tmpi,tmpi->ic_data);
- break;
- case IC_CALL_INDIRECT:
- if (I8_MIN<=tmpi->ic_data<=I8_MAX) {
- ICU24(tmpi,0x2454FF); //CALL disp[RSP]
- ICU8(tmpi,tmpi->ic_data);
- } else {
- ICU24(tmpi,0x2494FF); //CALL disp[RSP]
- ICU32(tmpi,tmpi->ic_data);
- }
- break;
- case IC_PUSH:
- ICPush(tmpi,tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- break;
- case IC_POP:
- ICU8(tmpi,0x58);
- break;
- case IC_INVLPG:
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- ICU24(tmpi,0x38010F);
- break;
- case IC_CLFLUSH:
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- ICU24(tmpi,0x38AE0F);
- break;
- case IC_GET_RFLAGS:
- ICU8(tmpi,0x9C);
- ICPop(tmpi,MDF_REG+RT_I64,REG_RAX,0,rip2);
- break;
- case IC_CARRY:
- ICU24(tmpi,0xC0920F); //SETC AL
- ICU24(tmpi,0x01E083); //AND EAX,1
- break;
- case IC_RDTSC:
- ICCopyTemplate(cc,tmpi,CMP_TEMPLATE_RDTSC,TRUE,FALSE,FALSE,CN_INST);
- break;
- case IC_SET_RFLAGS:
- ICPush(tmpi,tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- ICU8(tmpi,0x9D);
- break;
- case IC_GET_RBP:
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- MDF_REG+RT_I64,REG_RBP,0,rip2);
- break;
- case IC_SET_RBP:
- ICMov(tmpi,MDF_REG+RT_I64,REG_RBP,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- break;
- case IC_GET_RSP:
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- MDF_REG+RT_I64,REG_RSP,0,rip2);
- break;
- case IC_SET_RSP:
- ICMov(tmpi,MDF_REG+RT_I64,REG_RSP,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- break;
- case IC_RETURN_VAL:
- case IC_SET_RAX:
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- break;
- case IC_RETURN_VAL2:
- case IC_GET_RAX:
- break;
- case IC_BT:
- ICBitOps(tmpi,&tmpi->arg1,&tmpi->arg2,tmpi->next,
- 0xA30F,0x20BA0F,rip2);
- break;
- case IC_BTS:
- case IC_LBTS:
- ICBitOps(tmpi,&tmpi->arg1,&tmpi->arg2,tmpi->next,
- 0xAB0F,0x28BA0F,rip2);
- break;
- case IC_BTR:
- case IC_LBTR:
- ICBitOps(tmpi,&tmpi->arg1,&tmpi->arg2,tmpi->next,
- 0xB30F,0x30BA0F,rip2);
- break;
- case IC_BTC:
- case IC_LBTC:
- ICBitOps(tmpi,&tmpi->arg1,&tmpi->arg2,tmpi->next,
- 0xBB0F,0x38BA0F,rip2);
- break;
- case IC_BSF:
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- ICU32(tmpi,0xC0BC0F48);
- ICU16(tmpi,0x0375);
- ICU24(tmpi,0xD0F748);
- break;
- case IC_BSR:
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- ICU32(tmpi,0xC0BD0F48);
- ICU16(tmpi,0x0375);
- ICU24(tmpi,0xD0F748);
- break;
- case IC_SIGN_I64:
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- ICCopyTemplate(cc,tmpi,CMP_TEMPLATE_SIGN_I64,
- TRUE,FALSE,FALSE,CN_INST);
- break;
- case IC_TOUPPER:
- ICToUpper(tmpi,rip2);
- break;
- case IC_TO_I64:
- ICToI64(cc,tmpi,rip2);
- break;
- case IC_TO_F64:
- ICToF64(cc,tmpi,rip2);
- break;
- case IC_TO_BOOL:
- ICToBool(cc,tmpi,rip2);
- break;
- case IC_SQR:
- ICFTemplateFun(cc,tmpi,CMP_TEMPLATE_SQR,rip2);
- break;
- case IC_ABS:
- ICFTemplateFun(cc,tmpi,CMP_TEMPLATE_ABS,rip2);
- break;
- case IC_SQRT:
- ICFTemplateFun(cc,tmpi,CMP_TEMPLATE_SQRT,rip2);
- break;
- case IC_SIN:
- ICFTemplateFun(cc,tmpi,CMP_TEMPLATE_SIN,rip2);
- break;
- case IC_COS:
- ICFTemplateFun(cc,tmpi,CMP_TEMPLATE_COS,rip2);
- break;
- case IC_TAN:
- ICFTemplateFun(cc,tmpi,CMP_TEMPLATE_TAN,rip2);
- break;
- case IC_ATAN:
- ICFTemplateFun(cc,tmpi,CMP_TEMPLATE_ATAN,rip2);
- break;
- case IC_ABS_I64:
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- ICU24(tmpi,0xC08548);
- ICU16(tmpi,0x0379);
- ICU24(tmpi,0xD8F748);
- break;
- case IC_MIN_I64:
- ICMinMax(tmpi,0x4F,rip2);
- break;
- case IC_MAX_I64:
- ICMinMax(tmpi,0x4C,rip2);
- break;
- case IC_MIN_U64:
- ICMinMax(tmpi,0x47,rip2);
- break;
- case IC_MAX_U64:
- ICMinMax(tmpi,0x42,rip2);
- break;
- case IC_MOD_U64:
- ICModU64(tmpi,rip2);
- break;
- case IC_SQR_I64:
- ICSqr(tmpi,SLASH_OP_IMUL,rip2);
- break;
- case IC_SQR_U64:
- ICSqr(tmpi,SLASH_OP_MUL,rip2);
- break;
- case IC_SWAP_U8:
- case IC_SWAP_U16:
- case IC_SWAP_U32:
- case IC_SWAP_I64:
- ICSwap(tmpi,rip2);
- break;
- case IC_QUE_INIT:
- ICQueInit(tmpi,rip2);
- break;
- case IC_QUE_INS:
- ICQueIns(tmpi,rip2);
- break;
- case IC_QUE_INS_REV:
- ICQueInsRev(tmpi,rip2);
- break;
- case IC_QUE_REM:
- ICQueRem(tmpi,rip2);
- break;
- case IC_STRLEN:
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- ICCopyTemplate(cc,tmpi,CMP_TEMPLATE_STRLEN,TRUE,FALSE,FALSE,CN_INST);
- break;
- case IC_IN_U32:
- if (tmpi->arg1.type&MDF_IMM) {
- ICU16(tmpi,0xC033);
- if (tmpi->arg1.disp<=U8_MAX)
- ICU16(tmpi,0xE5+tmpi->arg1.disp<<8);
- else {
- ICU32(tmpi,0xBA00+OC_OP_SIZE_PREFIX+tmpi->arg1.disp<<16);
- ICU8(tmpi,0xED);
- }
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- ICU16(tmpi,0xC033);
- ICU8(tmpi,0xED);
- }
- break;
- case IC_IN_U16:
- if (tmpi->arg1.type&MDF_IMM) {
- ICU16(tmpi,0xC033);
- if (tmpi->arg1.disp<=U8_MAX)
- ICU24(tmpi,0xE500+OC_OP_SIZE_PREFIX+tmpi->arg1.disp<<16);
- else {
- ICU32(tmpi,0xBA00+OC_OP_SIZE_PREFIX+tmpi->arg1.disp<<16);
- ICU16(tmpi,0xED00+OC_OP_SIZE_PREFIX);
- }
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- ICU16(tmpi,0xC033);
- ICU16(tmpi,0xED00+OC_OP_SIZE_PREFIX);
- }
- break;
- case IC_IN_U8:
- if (tmpi->arg1.type&MDF_IMM) {
- ICU16(tmpi,0xC033);
- if (tmpi->arg1.disp<=U8_MAX)
- ICU16(tmpi,0xE4+tmpi->arg1.disp<<8);
- else {
- ICU32(tmpi,0xBA00+OC_OP_SIZE_PREFIX+tmpi->arg1.disp<<16);
- ICU8(tmpi,0xEC);
- }
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- ICU16(tmpi,0xC033);
- ICU8(tmpi,0xEC);
- }
- break;
- case IC_OUT_U32:
- if (tmpi->arg2.type&MDF_IMM) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- if (tmpi->arg2.disp<=U8_MAX)
- ICU16(tmpi,0xE7+tmpi->arg2.disp<<8);
- else {
- ICU32(tmpi,0xBA00+OC_OP_SIZE_PREFIX+tmpi->arg2.disp<<16);
- ICU8(tmpi,0xEF);
- }
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip2);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- ICU8(tmpi,0xEF);
- }
- break;
- case IC_OUT_U16:
- if (tmpi->arg2.type&MDF_IMM) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- if (tmpi->arg2.disp<=U8_MAX)
- ICU24(tmpi,0xE700+OC_OP_SIZE_PREFIX+tmpi->arg2.disp<<16);
- else {
- ICU32(tmpi,0xBA00+OC_OP_SIZE_PREFIX+tmpi->arg2.disp<<16);
- ICU16(tmpi,0xEF00+OC_OP_SIZE_PREFIX);
- }
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip2);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- ICU16(tmpi,0xEF00+OC_OP_SIZE_PREFIX);
- }
- break;
- case IC_OUT_U8:
- if (tmpi->arg2.type&MDF_IMM) {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- if (tmpi->arg2.disp<=U8_MAX)
- ICU16(tmpi,0xE6+tmpi->arg2.disp<<8);
- else {
- ICU32(tmpi,0xBA00+OC_OP_SIZE_PREFIX+tmpi->arg2.disp<<16);
- ICU8(tmpi,0xEE);
- }
- } else {
- ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
- tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip2);
- ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
- tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip2);
- ICU8(tmpi,0xEE);
- }
- break;
- case IC_NOBOUND_SWITCH:
- ICSwitch(tmpi,rip,TRUE,cc,buf,rip2);
- break;
- case IC_SWITCH:
- ICSwitch(tmpi,rip,FALSE,cc,buf,rip2);
- break;
- case IC_NOP1:
- case IC_NOP2:
- OptFree(tmpi);
- goto op789A_next;
- case IC_CALL_START:
- case IC_PUSH_REGS:
- ICPushRegs(tmpi,tmpi->ic_data);
- break;
- case IC_CALL_END:
- ICPopRegs(tmpi,tmpi->ic_data);
- if (tmpi->res.type.mode)
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip2);
- break;
- case IC_POP_REGS:
- ICPopRegs(tmpi,tmpi->ic_data);
- break;
- case IC_PUSH_CMP:
- case IC_CALL_END2:
- case IC_END:
- case IC_ADD_RSP1:
- break;
- default:
- "Pass:%d Missing IC hndlr\n",cc->pass;
- ICPut(cc,tmpi);
- LexExcept(cc,"Compiler Optimization Error at ");
- }
- if (tmpi->res.type.mode) {
- if (tmpi->ic_flags & ICF_RES_TO_F64) {
- if (tmpi->ic_code==IC_PUSH_CMP) {
- ICU24(tmpi,0x242CDF); //FILD U64 [RSP]
- ICU24(tmpi,0x241CDD); //FSTP U64 [RSP]
- } else {
- ICFCvt(cc,tmpi,REG_RAX,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- FALSE,CN_RES,rip2);
- if (!Bt(&tmpi->ic_flags,ICf_DONT_POP_FLOAT0+
- cc->cur_ic_float_op_num-1))
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip2);
- }
- } else if (tmpi->ic_flags & ICF_RES_TO_INT) {
- ICFCvt(cc,tmpi,REG_RAX,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- TRUE,CN_RES,rip2);
- ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
- MDF_REG+RT_I64,REG_RAX,0,rip2);
- }
- }
- }
- cnt=tmpi->ic_cnt;
- if (tmpi->ic_flags&ICF_DEL_PREV_INS) {
- if (cc->pass>8)
- cnt=tmpi->ic_last_start;
- tmpi->ic_flags&=~ICF_DEL_PREV_INS;
- }
- if (cnt && buf)
- MemCpy(buf+rip,tmpi->ic_body,cnt);
-op789A_skip_copy:
- if (dbg_info && cc->min_line<=tmpi->ic_line<=cc->max_line) {
- i=tmpi->ic_line-cc->min_line;
- if (!dbg_info->body[i])
- dbg_info->body[i]=rip2;
- }
- if (tmpi->ic_flags&ICF_PASS_TRACE &&
- Bt(&cc->saved_pass_trace,cc->pass) && cnt) {
- "$RED$";
- if (buf)
- Un(buf+rip,cnt,64);
- else
- Un(tmpi->ic_body,cnt,64);
- "$FG$";
- }
- if (!(tmpi->ic_flags&(ICF_CODE_FINAL|ICF_DONT_RESTORE)))
- MemCpy(&tmpi->arg1,saved_arg1_arg2_r,3*sizeof(CICArg));
- rip+=cnt;
- if (tmpi->ic_cnt>=IC_BODY_SIZE && tmpi->ic_code!=IC_ASM)
- throw('Compiler');
-op789A_next:
- tmpi=tmpi_next;
- }
-
- lb=cc->coc.coc_next_misc;
- while (lb!=&cc->coc.coc_next_misc) {
- switch (lb->type) {
- case CMT_STR_CONST:
- lb->addr=rip;
- if (buf)
- MemCpy(buf+rip,lb->str,lb->st_len);
- rip+=lb->st_len;
- break;
- case CMT_JMP_TABLE:
- lb->addr=rip;
- ptr=buf+lb->addr;
- if (lb->flags&(CMF_I8_JMP_TABLE|CMF_U8_JMP_TABLE)) {
- if (buf)
- for (i=0;i<lb->range;i++)
- *ptr++=lb->jmp_table[i]->addr-lb->begin->addr;
- rip+=lb->range;
- } else if (lb->flags&(CMF_I16_JMP_TABLE|CMF_U16_JMP_TABLE)) {
- if (buf)
- for (i=0;i<lb->range;i++)
- *ptr(U16 *)++=lb->jmp_table[i]->addr-lb->begin->addr;
- rip+=lb->range<<1;
- } else {
- if (buf)
- for (i=0;i<lb->range;i++) {
- if (cc->flags&CCF_AOT_COMPILE && !(cc->flags&CCF_NO_ABSS)) {
- tmpa=CAlloc(sizeof(CAOTAbsAddr));
- tmpa->next=aotc->abss;
- tmpa->type=AAT_ADD_U32;
- aotc->abss=tmpa;
- tmpa->rip=aotc->rip+lb->addr+i<<2;
- *ptr(U32 *)++=lb->jmp_table[i]->addr+aotc->rip;
- } else
- *ptr(U32 *)++=lb->jmp_table[i]->addr+buf;
- }
- rip+=lb->range<<2;
- }
- break;
- case CMT_FLOAT_CONSTS:
- lb->addr=rip;
- if (buf)
- MemCpy(buf+lb->addr,lb->float_consts,lb->num_consts*sizeof(F64));
- rip+=lb->num_consts*sizeof(F64);
- break;
- }
- lb=lb->next;
- }
- if (dbg_info) {
- if (cc->flags&CCF_AOT_COMPILE)
- dbg_info->body[num_lines]=rip+aotc->rip;
- else
- dbg_info->body[num_lines]=rip+buf;
- }
- return rip;
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/PrsExp.HC.HTML b/public/src/Compiler/PrsExp.HC.HTML deleted file mode 100644 index 065ec33..0000000 --- a/public/src/Compiler/PrsExp.HC.HTML +++ /dev/null @@ -1,1190 +0,0 @@ - - - - - PrsExp.HC - - - - - #define PE_UNARY_TERM1 0
-#define PE_UNARY_TERM2 1
-#define PE_MAYBE_MODIFIERS 2
-#define PE_UNARY_MODIFIERS 3
-#define PE_DEREFERENCE 4
-#define PE_CHECK_BINARY_OPS1 5
-#define PE_CHECK_BINARY_OPS2 6
-#define PE_DO_UNARY_OP 7
-#define PE_DO_BINARY_OP 8
-#define PE_POP_HIGHER 9
-#define PE_PUSH_LOWER 10
-#define PE_POP_ALL1 11
-#define PE_POP_ALL2 12
-
-CIntermediateCode *PrsAddOp(CCmpCtrl *cc,I64 stk_op,CHashClass *tmpc)
-{
- CIntermediateCode *tmpi=cc->coc.coc_head.last;
- Bool div_sizeof=FALSE;
- switch (stk_op.u16[0]) {
- case IC_ADD:
- if (tmpc->ptr_stars_cnt && !tmpi->ic_class->ptr_stars_cnt &&
- tmpi->ic_class->raw_type!=RT_F64) {
- ICAdd(cc,IC_SIZEOF,1,cmp.internal_types[RT_I64]);
- ICAdd(cc,IC_MUL,0,cmp.internal_types[RT_I64]);
- }
- break;
- case IC_SUB:
- if (tmpc->ptr_stars_cnt && tmpi->ic_class->raw_type!=RT_F64) {
- if (!tmpi->ic_class->ptr_stars_cnt) {
- ICAdd(cc,IC_SIZEOF,1,cmp.internal_types[RT_I64]);
- ICAdd(cc,IC_MUL,0,cmp.internal_types[RT_I64]);
- } else
- div_sizeof=TRUE;
- }
- break;
- case IC_AND_AND:
- case IC_OR_OR:
- ICAdd(cc,IC_NOP1,0,cmp.internal_types[RT_I64]);
- break;
- case IC_ADD_EQU:
- case IC_SUB_EQU:
- if (tmpc->ptr_stars_cnt) {
- ICAdd(cc,IC_SIZEOF,1,cmp.internal_types[RT_I64]);
- ICAdd(cc,IC_MUL,0,cmp.internal_types[RT_I64]);
- }
- break;
- }
- tmpi=ICAdd(cc,stk_op,0,tmpc);
- if (stk_op.u8[3]&ECF_HAS_PUSH_CMP) {
- tmpi->ic_flags|=ICF_POP_CMP;
- ICAdd(cc,IC_NOP1,0,cmp.internal_types[RT_I64]);
- ICAdd(cc,IC_AND_AND,0,cmp.internal_types[RT_I64],ICF_POP_CMP);
- }
- if (div_sizeof) {
- tmpc--;
- if (tmpc->size!=1) {
- ICAdd(cc,IC_IMM_I64,tmpc->size,cmp.internal_types[RT_I64]);
- ICAdd(cc,IC_DIV,0,cmp.internal_types[RT_I64]);
- tmpc=cmp.internal_types[RT_I64];
- }
- }
- return tmpi;
-}
-
-U0 PrsExpression2(CCmpCtrl *cc,I64 *_max_prec,CPrsStk *ps)
-{
- I64 i,cur_op,stk_op,state,max_prec=PREC_NULL,unary_pre_prec,paren_prec,
- unary_post_prec,left_prec=PREC_MAX;
- CIntermediateCode *tmpi;
- CHashClass *tmpc;
- CMemberLst *local_var;
- CArrayDim *tmpad=NULL;
-
- goto pe_unary_term1;
- while (TRUE) {
- switch [state] {
- case PE_UNARY_TERM1:
-pe_unary_term1:
- unary_pre_prec=PREC_NULL;
- unary_post_prec=PREC_NULL;
- cc->flags&=~(CCF_PAREN+CCF_PREINC+CCF_PREDEC+CCF_POSTINC+
- CCF_POSTDEC+CCF_FUN_EXP);
- case PE_UNARY_TERM2:
- state=PrsUnaryTerm(cc,ps,&local_var,&tmpad,
- &max_prec,&unary_pre_prec,&paren_prec);
- break;
- case PE_UNARY_MODIFIERS:
- state=PrsUnaryModifier(cc,ps,&local_var,&tmpad,&unary_post_prec);
- break;
- case PE_MAYBE_MODIFIERS:
- if (cc->token=='(') { //Typecast or fun_ptr
- cc->flags|=CCF_RAX;
- state=PrsUnaryModifier(cc,ps,&local_var,&tmpad,&unary_post_prec);
- } else
- goto pe_check_binary_ops1;
- break;
- case PE_DEREFERENCE:
- if (!(cc->flags&(CCF_PREINC|CCF_PREDEC|CCF_POSTINC|CCF_POSTDEC)))
- i=IC_DEREF+PREC_UNARY_PRE<<16;
- else {
- if (cc->flags & CCF_POSTINC)
- i=IC__PP+PREC_UNARY_POST<<16;
- else if (cc->flags & CCF_POSTDEC)
- i=IC__MM+PREC_UNARY_POST<<16;
- else if (cc->flags & CCF_PREDEC)
- i=IC_MM_+PREC_UNARY_PRE<<16;
- else
- i=IC_PP_+PREC_UNARY_PRE<<16;
- cc->flags&=~(CCF_PREINC|CCF_PREDEC|CCF_POSTINC|CCF_POSTDEC);
- }
- tmpi=cc->coc.coc_head.last;
- if (cc->flags & (CCF_RAX|CCF_ARRAY)) {
- if (tmpi->ic_code==IC_DEREF)
- tmpi->ic_code=i;
- } else {
- tmpc=OptClassFwd(tmpi->ic_class-1);
- ICAdd(cc,i,0,tmpc);
- }
- case PE_CHECK_BINARY_OPS1:
-pe_check_binary_ops1:
- if (paren_prec) {
- if (unary_pre_prec || unary_post_prec) {
- if (paren_prec<=unary_pre_prec && !unary_post_prec)
- ParenWarning(cc);
- paren_prec=PREC_NULL;
- } else if (paren_prec<=PREC_UNARY_PRE+ASSOC_MASK)
- ParenWarning(cc);
- }
- cur_op=cmp.binary_ops[cc->token];
-
- case PE_CHECK_BINARY_OPS2:
-pe_check_binary_ops2:
- stk_op=PrsPop(ps);
- tmpc=PrsPop(ps);
- if (!(0<stk_op.u8[2]<=PREC_UNARY_PRE+ASSOC_MASK))
- goto pe_do_binary_op;
-
- case PE_DO_UNARY_OP:
- if (cur_op.u16[0]==IC_POWER &&
- stk_op.u16[0]==IC_UNARY_MINUS) {
- Lex(cc); //skip ` op
- left_prec=cur_op.i8[2];
- PrsPush(ps,tmpc);
- PrsPush(ps,stk_op);
- PrsPush(ps,cc->coc.coc_head.last->ic_class);
- PrsPush(ps,cur_op);
- goto pe_unary_term1;
- } else {
- tmpi=cc->coc.coc_head.last;
- tmpc=tmpi->ic_class;
- if (stk_op.u16[0]==IC_DEREF && tmpc->ptr_stars_cnt)
- tmpc--;
- else if (stk_op.u16[0]==IC_ADDR) {
- cc->abs_cnts.c_addres++;
- if (intermediate_code_table[tmpi->ic_code].type==IST_DEREF)
- OptFree(tmpi);
- tmpc++;
- }
- tmpc=OptClassFwd(tmpc);
- if (stk_op)
- ICAdd(cc,stk_op,0,tmpc);
- goto pe_check_binary_ops2;
- }
-
- case PE_DO_BINARY_OP:
-pe_do_binary_op:
- PrsPush(ps,tmpc);
- PrsPush(ps,stk_op);
- if (!cur_op)
- goto pe_pop_all1;
-
- switch (cur_op.u16[0]) {
- case IC_ADD:
- case IC_SUB:
- tmpi=cc->coc.coc_head.last;
- if (!tmpi->ic_class->ptr_stars_cnt &&
- tmpi->ic_class->raw_type!=RT_F64) {
- ICAdd(cc,IC_SIZEOF,1,cmp.internal_types[RT_I64]);
- ICAdd(cc,IC_MUL,0,cmp.internal_types[RT_I64]);
- }
- break;
- case IC_AND_AND:
- case IC_OR_OR:
- ICAdd(cc,IC_NOP1,0,cmp.internal_types[RT_I64]);
- break;
- }
- if (cc->flags & CCF_FUN_EXP) {
- ps->ptr2--;
- cc->flags&=~CCF_FUN_EXP;
- }
- Lex(cc); //skip op
- if (paren_prec>PREC_UNARY_PRE+ASSOC_MASK &&
- paren_prec&~ASSOC_MASK<left_prec&~ASSOC_MASK+
- paren_prec&ASSOCF_RIGHT &&
- paren_prec&~ASSOC_MASK<cur_op.u8[2]&~ASSOC_MASK+
- !(paren_prec&ASSOCF_RIGHT))
- ParenWarning(cc);
- if (cur_op.u8[2]>max_prec)
- max_prec=cur_op.u8[2];
- left_prec=cur_op.u8[2];
- if (intermediate_code_table[cur_op.u16[0]].type==IST_ASSIGN) {
- tmpi=cc->coc.coc_head.last;
- tmpc=OptClassFwd(tmpi->ic_class);
- if (intermediate_code_table[tmpi->ic_code].type!=IST_DEREF ||
- !tmpc->ptr_stars_cnt && !Bt(&tmpc->flags,Cf_INTERNAL_TYPE))
- LexExcept(cc,"Invalid lval at ");
- tmpi->ic_code=IC_NOP1; //Important for setting class (pretty sure)
- cur_op.u8[2]=PREC_ASSIGN|ASSOCF_RIGHT;
- }
-
- case PE_POP_HIGHER:
-pe_pop_higher:
- stk_op=PrsPop(ps); //pop ops of higher prec
- tmpc=PrsPop(ps);
- if (!stk_op)
- goto pe_push_lower;
- else if (cur_op.u8[2]&~ASSOC_MASK==stk_op.u8[2]&~ASSOC_MASK) {
- if (cur_op.u8[2]&ASSOCF_RIGHT)
- goto pe_push_lower;
- } else if (cur_op.u8[2]&~ASSOC_MASK<=stk_op.u8[2]&~ASSOC_MASK)
- goto pe_push_lower;
-
- tmpi=PrsAddOp(cc,stk_op,tmpc);
-
- if (intermediate_code_table[cur_op.u16[0]].type==IST_CMP &&
- intermediate_code_table[stk_op.u16[0]].type==IST_CMP) {
- tmpi->ic_flags|=ICF_PUSH_CMP;
- ICAdd(cc,IC_NOP1,0,cmp.internal_types[RT_I64]);
- ICAdd(cc,IC_PUSH_CMP,0,tmpc);
- cur_op.u8[3]|=ECF_HAS_PUSH_CMP;
- } else if (cur_op.u16[0]==IC_AND_AND || cur_op.u16[0]==IC_OR_OR)
- ICAdd(cc,IC_NOP1,0,cmp.internal_types[RT_I64]);
- goto pe_pop_higher;
-
- case PE_PUSH_LOWER:
-pe_push_lower:
- PrsPush(ps,tmpc);
- PrsPush(ps,stk_op);
- PrsPush(ps,cc->coc.coc_head.last->ic_class);
- PrsPush(ps,cur_op);
- goto pe_unary_term1;
-
- case PE_POP_ALL1:
-pe_pop_all1:
- if (paren_prec>PREC_UNARY_PRE+ASSOC_MASK &&
- paren_prec&~ASSOC_MASK<=left_prec&~ASSOC_MASK-
- paren_prec&ASSOCF_LEFT-left_prec&ASSOCF_LEFT)
- ParenWarning(cc);
- case PE_POP_ALL2:
-pe_pop_all2:
- stk_op=PrsPop(ps);
- tmpc=PrsPop(ps);
- if (!stk_op.u16[0])
- goto pe_done;
- PrsAddOp(cc,stk_op,tmpc);
- goto pe_pop_all2;
- }
- }
-pe_done:
- if (_max_prec)
- *_max_prec=max_prec;
-}
-
-Bool PrsExpression(CCmpCtrl *cc,I64 *_max_prec,Bool end_exp,CPrsStk *_ps=NULL)
-{
- Bool res=TRUE;
- I64 old_flags=cc->flags;
- CPrsStk *ps;
- if (_ps)
- ps=_ps;
- else {
- ps=MAlloc(sizeof(CPrsStk));
- ps->ptr=0;
- ps->ptr2=0;
- }
- PrsPush(ps,0); //terminate
- PrsPush(ps,0); //terminate
- try
-//try catch causes noreg vars in function
- PrsExpression2(cc,_max_prec,ps);
- catch {
- if (Fs->except_ch=='Compiler') {
- res=FALSE;
- Fs->catch_except=TRUE;
- }
- }
- if (!_ps) {
- if (ps->ptr)
- LexExcept(cc,"Compiler Parse Error at ");
- Free(ps);
- }
- if (res) {
- if (end_exp)
- ICAdd(cc,IC_END_EXP,0,0,ICF_RES_NOT_USED);
- if (cc->coc.coc_head.last->ic_class==
- cmp.internal_types[RT_U0])
- LexWarn(cc,"U0 Expression ");
- }
- cc->flags|=old_flags&(CCF_PREINC|CCF_PREDEC);
- return res;
-}
-
-U0 PrsSizeOf(CCmpCtrl *cc)
-{
- CHashClass *tmpc;
- CMemberLst *tmpm;
- CDbgInfo *dbg_info;
- I64 i;
- if (cc->token!=TK_IDENT)
- LexExcept(cc,"Invalid class at ");
- if (tmpm=cc->local_var_entry) {
- tmpc=tmpm->member_class;
- i=tmpc->size*tmpm->dim.total_cnt;
- if (Lex(cc)=='.')
- goto pu_sizeof_member;
- } else {
- if (!(tmpc=cc->hash_entry) || !(tmpc->type &
- (HTT_CLASS|HTT_INTERNAL_TYPE|HTT_GLBL_VAR|
- HTT_FUN|HTT_EXPORT_SYS_SYM)))
- LexExcept(cc,"Invalid class at ");
- if (tmpc->type&(HTT_FUN|HTT_EXPORT_SYS_SYM)) {
- if (!(dbg_info=tmpc(CHashFun *)->dbg_info))
- LexExcept(cc,"Size not defined at ");
- i=dbg_info->body[dbg_info->max_line+1-dbg_info->min_line]
- -dbg_info->body[0];
- Lex(cc);
- } else {
- i=tmpc->size;
- while (Lex(cc)=='.') {
-pu_sizeof_member:
- if (!(tmpc->type & (HTT_CLASS|HTT_GLBL_VAR)))
- LexExcept(cc,"Invalid class at ");
- else if (tmpc->type & HTT_GLBL_VAR)
- tmpc=tmpc(CHashGlblVar *)->var_class;
- if (Lex(cc)!=TK_IDENT || !(tmpm=MemberFind(cc->cur_str,tmpc)))
- LexExcept(cc,"Invalid member at ");
- else if (cc->local_var_entry)
- cc->local_var_entry->use_cnt--;
- tmpc=tmpm->member_class;
-//Probably others like this:
- #assert offset(CHashClass.size)==offset(CHashGlblVar.size)
- i=tmpc->size*tmpm->dim.total_cnt;
- }
- }
- }
- if (cc->token=='*') {
- while (Lex(cc)=='*');
- i=sizeof(U8 *);
- }
- ICAdd(cc,IC_IMM_I64,i,cmp.internal_types[RT_I64]);
-}
-
-U0 PrsOffsetOf(CCmpCtrl *cc)
-{
- CHashClass *tmpc;
- CMemberLst *tmpm;
- I64 i;
- if (cc->token!=TK_IDENT)
- LexExcept(cc,"Invalid class at ");
- if (tmpm=cc->local_var_entry)
- tmpc=tmpm->member_class;
- else {
- tmpc=cc->hash_entry;
- if (!tmpc || !(tmpc->type & (HTT_CLASS|HTT_GLBL_VAR)))
- LexExcept(cc,"Invalid class at ");
- else if (tmpc->type & HTT_GLBL_VAR)
- tmpc=tmpc(CHashGlblVar *)->var_class;
- }
- if (Lex(cc)!='.')
- LexExcept(cc,"Expecting '.' at ");
- i=0;
- do {
- if (Lex(cc)!=TK_IDENT || !(tmpm=MemberFind(cc->cur_str,tmpc)))
- LexExcept(cc,"Invalid member at ");
- else if (cc->local_var_entry)
- cc->local_var_entry->use_cnt--;
- i+=tmpm->offset;
- tmpc=tmpm->member_class;
- } while (Lex(cc)=='.');
- ICAdd(cc,IC_IMM_I64,i,cmp.internal_types[RT_I64]);
-}
-
-I64 PrsFunCall(CCmpCtrl *cc,CPrsStk *ps,Bool indirect,CHashFun *tmpf)
-{
- I64 i,argc_cnt,dft_val;
- Bool is_first_arg=TRUE,needs_right_paren,is_print,is_putchars,
- is_template_fun;
- CHashClass *tmpc2,*last_class=NULL;
- CMemberLst *tmpm;
- CCodeCtrl *tmpcbh,*tmpcbh1;
- CCodeMisc *cm;
- CIntermediateCode *tmpi;
-
- if (!tmpf) {
- if (cc->token==TK_CHAR_CONST) {
- if (!(tmpf=HashFind("PutChars",cc->htc.hash_table_lst,HTT_FUN)))
- LexExcept(cc,"Missing header for Print() and PutChars() at ");
- if (!cc->cur_i64) //empty char signals PutChars with variable
- Lex(cc);
- is_print=FALSE;
- is_putchars=TRUE;
- } else {
- if (!(tmpf=HashFind("Print",cc->htc.hash_table_lst,HTT_FUN)))
- LexExcept(cc,"Missing header for Print() and PutChars() at ");
- if (!*cc->cur_str) //empty string signals Print with variable fmt_str
- Lex(cc);
- is_putchars=FALSE;
- is_print=TRUE;
- }
- } else {
- is_print=FALSE;
- is_putchars=FALSE;
- }
-
- if (Bt(&tmpf->flags,Ff_INTERNAL)&& IC_SQR<=tmpf->exe_addr<=IC_ATAN)
- is_template_fun=TRUE;
- else
- is_template_fun=FALSE;
-
- if (indirect) {
- if (!(cc->flags & (CCF_RAX | CCF_ARRAY)))
- ICAdd(cc,IC_DEREF,0,cmp.internal_types[RT_PTR]);
- cc->coc.coc_head.last->ic_class=cmp.internal_types[RT_PTR];
- ICAdd(cc,IC_SET_RAX,0,cmp.internal_types[RT_PTR]);
- ICAdd(cc,IC_NOP2,1,cmp.internal_types[RT_PTR]); //balance the books
- }
- COCPush(cc);
- tmpcbh=cc->coc.coc_next;
- cc->coc.coc_next=NULL;
- i=tmpf->arg_cnt;
- tmpm=tmpf->member_lst_and_root;
- argc_cnt=0;
- if (cc->token=='(') {
- Lex(cc);
- needs_right_paren=TRUE;
- } else
- needs_right_paren=FALSE;
- while (i--) {
- COCInit(cc);
- if (!is_first_arg) {
- if (is_print) {
- if (cc->token==',')
- Lex(cc);
- else if (cc->token!=';')
- LexExcept(cc,"Expecting ',' at ");
- } else {
- if (needs_right_paren) {
- if (cc->token==',')
- Lex(cc);
- else if (cc->token!=')')
- LexExcept(cc,"Expecting ',' at ");
- }
- }
- }
- if (tmpm->flags & MLF_DFT_AVAILABLE &&
- (cc->token==')' || cc->token==',' || !needs_right_paren)) {
- dft_val=tmpm->dft_val;
- if (tmpm->flags & MLF_LASTCLASS && last_class)
- dft_val=(last_class-last_class->ptr_stars_cnt)->str;
- if (tmpm->flags & (MLF_STR_DFT_AVAILABLE|MLF_LASTCLASS) &&
- cc->flags&CCF_AOT_COMPILE) {
- cm=COCMiscNew(cc,CMT_STR_CONST);
- ICAdd(cc,IC_STR_CONST,cm,cmp.internal_types[RT_U8]+1);
- cm->st_len=StrLen(dft_val)+1;
- cm->str=StrNew(dft_val);
- cc->flags|=CCF_HAS_MISC_DATA;
- } else
- ICAdd(cc,IC_IMM_I64,dft_val,tmpm->member_class);
- } else {
- if (!PrsExpression(cc,NULL,FALSE,ps))
- throw('Compiler');
- else {
- COCPush(cc);
- cc->pass=0; OptPass012(cc);
- cc->pass=1; tmpi=OptPass012(cc);
- COCPop(cc);
- last_class=OptClassFwd(tmpi->ic_class);
- tmpc2=OptClassFwd(tmpm->member_class);
- if (tmpc2->raw_type==RT_F64 && !tmpm->dim.next &&
- last_class->raw_type!=RT_F64)
- tmpi->ic_flags|=ICF_RES_TO_F64;
- else
- if (tmpc2->raw_type!=RT_F64 && last_class->raw_type==RT_F64)
- tmpi->ic_flags|=ICF_RES_TO_INT;
- }
- }
- COCPush(cc);
- is_first_arg=FALSE;
- tmpm=tmpm->next;
- }
- if (tmpm && tmpm->flags & MLF_DOT_DOT_DOT) {
- COCInit(cc);
- tmpi=ICAdd(cc,IC_IMM_I64,0,tmpm->member_class);
- COCPush(cc);
- if (is_print) {
- if (cc->token!=';') {
- do {
- if (!is_first_arg) {
- if (cc->token==',')
- Lex(cc);
- else
- LexExcept(cc,"Expecting ',' at ");
- }
- COCInit(cc);
- if (!PrsExpression(cc,NULL,FALSE,ps))
- throw('Compiler');
- COCPush(cc);
- is_first_arg=FALSE;
- argc_cnt++;
- } while (cc->token==',');
- }
- } else if (needs_right_paren) {
- if (cc->token!=')') {
- do {
- if (!is_first_arg) {
- if (cc->token==',')
- Lex(cc);
- else
- LexExcept(cc,"Expecting ',' at ");
- }
- COCInit(cc);
- if (!PrsExpression(cc,NULL,FALSE,ps))
- throw('Compiler');
- COCPush(cc);
- is_first_arg=FALSE;
- argc_cnt++;
- } while (cc->token==',');
- }
- }
- tmpi->ic_data=argc_cnt++; //++ so add_esp latter works
- }
- if (needs_right_paren) {
- if (cc->token==')')
- Lex(cc);
- else
- LexExcept(cc,"Missing ')' at ");
- }
- tmpcbh1=tmpcbh->coc_next;
- tmpcbh->coc_next=cc->coc.coc_next;
- cc->coc.coc_next=tmpcbh;
- COCPop(cc);
- tmpcbh=cc->coc.coc_next;
- cc->coc.coc_next=tmpcbh1;
- if (!is_template_fun)
- ICAdd(cc,IC_CALL_START,tmpf,0);
- if (indirect)
- ICAdd(cc,IC_PUSH_REGS,1<<REG_RAX,tmpf->return_class);
- while (tmpcbh) {
- tmpcbh1=tmpcbh->coc_next;
- COCAppend(cc,tmpcbh);
- if (!Bt(&tmpf->flags,Ff_INTERNAL))
- cc->coc.coc_head.last->ic_flags|=ICF_PUSH_RES;
- tmpcbh=tmpcbh1;
- }
- if (Bt(&tmpf->flags,Ff_INTERNAL))
- ICAdd(cc,tmpf->exe_addr,0,tmpf->return_class);
- else {
- if (indirect)
- ICAdd(cc,IC_CALL_INDIRECT,
- (argc_cnt+tmpf->arg_cnt)<<3,tmpf->return_class);
- else if (Bt(&tmpf->flags,Cf_EXTERN)) {
- cc->abs_cnts.externs++;
- if (cc->flags&CCF_AOT_COMPILE) {
- if (tmpf->type&HTF_IMPORT)
- ICAdd(cc,IC_CALL_IMPORT,tmpf,tmpf->return_class);
- else
- ICAdd(cc,IC_CALL_EXTERN,tmpf,tmpf->return_class);
- } else
- ICAdd(cc,IC_CALL_INDIRECT2,&tmpf->exe_addr,tmpf->return_class);
- } else
- ICAdd(cc,IC_CALL,tmpf->exe_addr,tmpf->return_class);
- if ((Bt(&tmpf->flags,Ff_RET1) || Bt(&tmpf->flags,Ff_ARGPOP)) &&
- !Bt(&tmpf->flags,Ff_NOARGPOP)) {
- if (indirect) {
- ICAdd(cc,IC_ADD_RSP1,(argc_cnt+tmpf->arg_cnt)<<3,tmpf->return_class);
- ICAdd(cc,IC_ADD_RSP,8,tmpf->return_class);
- } else
- ICAdd(cc,IC_ADD_RSP1,(argc_cnt+tmpf->arg_cnt)<<3,tmpf->return_class);
- } else {
- if (indirect)
- argc_cnt++;
- ICAdd(cc,IC_ADD_RSP,(argc_cnt+tmpf->arg_cnt)<<3,tmpf->return_class);
- }
- }
- if (!is_template_fun)
- ICAdd(cc,IC_CALL_END,tmpf,tmpf->return_class);
- if (is_print||is_putchars)
- ICAdd(cc,IC_END_EXP,0,0,ICF_RES_NOT_USED);
- cc->flags=(cc->flags|CCF_RAX) & ~(CCF_ARRAY|CCF_FUN_EXP);
- return PE_UNARY_MODIFIERS;
-}
-
-I64 PrsUnaryTerm(CCmpCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
- CArrayDim **_tmpad,I64 *max_prec,I64 *unary_pre_prec,I64 *paren_prec)
-{
- I64 i,j;
- CHashExport *tmpex;
- CHashClass *tmpc;
- CHashFun *tmpf;
- CHashGlblVar *tmpg;
- CMemberLst *tmpm;
- CAsmUndefHash *tmpauh;
- CCodeMisc *cm;
- Bool paren_warn;
-
- *_local_var=NULL;
- *paren_prec=PREC_NULL;
- switch (cc->token) {
- start:
- if (PREC_UNARY_PRE>*max_prec)
- *max_prec=PREC_UNARY_PRE;
- *unary_pre_prec=PREC_UNARY_PRE;
- start:
- case '~': i=IC_COM; break;
- case '!': i=IC_NOT; break;
- case '-': i=IC_UNARY_MINUS; break;
- case '*': i=IC_DEREF; break;
- end:
- Lex(cc); //Skip op
- break;
- case '&':
- if (Lex(cc)==TK_IDENT) {
- if (tmpc=cc->hash_entry) {
- if (tmpc->type & HTT_FUN) {
- tmpf=tmpc;
- if (!Bt(&tmpf->flags,Ff_INTERNAL)) {
- if (Bt(&tmpf->flags,Cf_EXTERN)) {
- if (cc->flags&CCF_AOT_COMPILE) {
- if (cc->flags&CCF_ASM_EXPRESSIONS) {
- if (tmpex=HashFind(tmpf->str,cc->htc.hash_table_lst,
- HTT_EXPORT_SYS_SYM))
- goto pu_export_sys_sym;
- else
- goto pu_new_sys_sym;
- }
- LexExcept(cc,"Can't take addr of extern fun");
- }
- cc->abs_cnts.externs++;
- ICAdd(cc,IC_IMM_I64,
- &tmpf->exe_addr,cmp.internal_types[RT_PTR]);
- ICAdd(cc,IC_DEREF,0,cmp.internal_types[RT_PTR]);
- } else {
- if (cc->flags&CCF_AOT_COMPILE) {
- ICAdd(cc,IC_ABS_ADDR,
- tmpf->exe_addr,cmp.internal_types[RT_PTR]);
- if (cc->flags&CCF_ASM_EXPRESSIONS)
- cc->abs_cnts.abs_addres++;
- } else
- ICAdd(cc,IC_IMM_I64,
- tmpf->exe_addr,cmp.internal_types[RT_PTR]);
- }
- cc->abs_cnts.c_addres++;
- Lex(cc);
- return PE_MAYBE_MODIFIERS;
- }
- } else if (tmpc->type & HTT_EXPORT_SYS_SYM) {
- tmpex=tmpc;
- if (cc->flags&CCF_ASM_EXPRESSIONS &&
- !(cc->flags&CCF_AOT_COMPILE) && tmpex->type&HTF_IMM) {
- cc->abs_cnts.c_addres++;
- ICAdd(cc,IC_IMM_I64,
- tmpex->val,cmp.internal_types[RT_PTR]);
- Lex(cc);
- return PE_MAYBE_MODIFIERS;
- } else
- goto pu_export_sys_sym;
- }
- } else if (cc->flags&CCF_ASM_EXPRESSIONS && !cc->local_var_entry)
- goto pu_ident_but_not_local_var;
- }
- i=IC_ADDR;
- break;
- end:
- PrsPush(ps,tmpc);
- PrsPush(ps,PREC_UNARY_PRE<<16+i);
- return PE_UNARY_TERM2;
-
- start:
- case TK_I64:
- case TK_CHAR_CONST:
- case TK_INS_BIN_SIZE:
- if (cc->cur_i64<0)
- ICAdd(cc,IC_IMM_I64,cc->cur_i64,cmp.internal_types[RT_U64]);
- else
- ICAdd(cc,IC_IMM_I64,cc->cur_i64,cmp.internal_types[RT_I64]);
- Lex(cc);
- break;
- case TK_F64:
- ICAdd(cc,IC_IMM_F64,cc->cur_f64(I64),cmp.internal_types[RT_F64]);
- Lex(cc);
- break;
- case TK_STR:
- cm=COCMiscNew(cc,CMT_STR_CONST);
- ICAdd(cc,IC_STR_CONST,cm,cmp.internal_types[RT_U8]+1);
- cm->str=LexExtStr(cc,&cm->st_len);
- cc->flags|=CCF_HAS_MISC_DATA;
- break;
- case TK_INS_BIN:
- cm=COCMiscNew(cc,CMT_STR_CONST);
- ICAdd(cc,IC_STR_CONST,cm,cmp.internal_types[RT_U8]+1);
- cm->str=cc->cur_str;
- cm->st_len=cc->cur_str_len;
- cc->cur_str=NULL;
- cc->flags|=CCF_HAS_MISC_DATA;
- Lex(cc);
- break;
- case '$':
- if (cc->flags & CCF_ASM_EXPRESSIONS) {
- cc->abs_cnts.abs_addres++;
- if (cc->flags&CCF_AOT_COMPILE)
- ICAdd(cc,IC_ABS_ADDR,cc->aotc->rip,cmp.internal_types[RT_PTR]);
- else
- ICAdd(cc,IC_IMM_I64,cc->aotc->rip,cmp.internal_types[RT_PTR]);
- } else {
- if (cc->flags&CCF_CLASS_DOL_OFFSET)
- ICAdd(cc,IC_IMM_I64,cc->class_dol_offset,
- cmp.internal_types[RT_I64]);
- else
- ICAdd(cc,IC_RIP,0,cmp.internal_types[RT_PTR]);
- }
- Lex(cc);
- break;
- end:
- if (PREC_TERM>*max_prec)
- *max_prec=PREC_TERM;
- return PE_MAYBE_MODIFIERS;
-
- case '(':
- if (Lex(cc)==TK_IDENT && cc->hash_entry &&
- cc->hash_entry->type & (HTT_CLASS|HTT_INTERNAL_TYPE))
- LexExcept(cc,"Use TempleOS postfix typecasting at ");
- else {
- if (PREC_TERM>*max_prec)
- *max_prec=PREC_TERM;
- if (cc->lex_include_stk->flags&LFSF_DEFINE)
- paren_warn=FALSE;
- else
- paren_warn=TRUE;
- if (!PrsExpression(cc,paren_prec,FALSE,ps))
- throw('Compiler');
- if (!paren_warn)
- *paren_prec=PREC_NULL;
- if (cc->token!=')')
- LexExcept(cc,"Missing ')' at ");
- Lex(cc); //skip )
- cc->flags= cc->flags & ~CCF_ARRAY | CCF_RAX | CCF_PAREN;
- return PE_UNARY_MODIFIERS;
- }
-
- start:
- case '+': break;
- case TK_PLUS_PLUS: cc->flags|=CCF_PREINC; break;
- case TK_MINUS_MINUS: cc->flags|=CCF_PREDEC; break;
- end:
- if (PREC_UNARY_PRE>*max_prec)
- *max_prec=PREC_UNARY_PRE;
- *unary_pre_prec=PREC_UNARY_PRE;
- Lex(cc);
- return PE_UNARY_TERM2;
-
- case TK_IDENT:
- if (tmpm=cc->local_var_entry) {
- if (PREC_TERM>*max_prec)
- *max_prec=PREC_TERM;
- cc->flags&=~(CCF_RAX|CCF_ARRAY|CCF_FUN_EXP);
- tmpc=tmpm->member_class+1;
- if (tmpm->flags & MLF_FUN && !(cc->flags&CCF_ASM_EXPRESSIONS)) {
- PrsPopDeref(ps);
- cc->flags|=CCF_FUN_EXP;
- PrsPush2(ps,tmpm->fun_ptr-tmpm->fun_ptr->ptr_stars_cnt);
- }
- if (tmpm->dim.next) {
- *_tmpad=tmpm->dim.next;
- cc->flags|=CCF_ARRAY;
- }
- if (tmpm->flags&MLF_STATIC) {
- if (cc->flags&CCF_AOT_COMPILE) {
-// if (tmpg->flags&GVF_DATA_HEAP) //TODO
- // ICAdd(cc,IC_HEAP_GLBL,tmpm->static_data,tmpc);
- // else
- ICAdd(cc,IC_ABS_ADDR,tmpm->static_data_rip,tmpc);
- } else
- ICAdd(cc,IC_IMM_I64,tmpm->static_data,tmpc);
- } else {
- if (cc->flags&CCF_ASM_EXPRESSIONS) {
- i=PrsPop(ps);
- ps->ptr--;
- if (i.u16[0]!=IC_ADDR)
- LexExcept(cc,"Expecting '&' at ");
- ICAdd(cc,IC_IMM_I64,tmpm->offset,cmp.internal_types[RT_PTR]);
- *_local_var=tmpm;
- Lex(cc);
- return PE_MAYBE_MODIFIERS;
- } else {
- if (tmpm->dim.next && tmpm->offset>0 &&
- StrCmp(tmpm->str,"argv")) {
- tmpc++;
- cc->flags&=~CCF_ARRAY;
- }
- ICAdd(cc,IC_RBP,0,tmpc);
- ICAdd(cc,IC_IMM_I64,tmpm->offset,tmpc);
- ICAdd(cc,IC_ADD,0,tmpc);
- }
- }
- Lex(cc); //skip var name
- *_local_var=tmpm;
- return PE_UNARY_MODIFIERS;
- }
-pu_ident_but_not_local_var:
- if (!(tmpex=cc->hash_entry)) {
- if (!(cc->flags & CCF_ASM_EXPRESSIONS))
- LexExcept(cc,"Invalid lval at ");
- tmpc=NULL;
-pu_new_sys_sym:
- tmpex=CAlloc(sizeof(CHashExport),Fs->code_heap);
- tmpex->str=cc->cur_str;
- cc->cur_str=NULL;
- if (!cc->htc.local_var_lst &&
- *tmpex->str=='@' && tmpex->str[1]=='@') {
- tmpex->type=HTT_EXPORT_SYS_SYM | HTF_UNRESOLVED | HTF_LOCAL;
- HashAdd(tmpex,cc->htc.local_hash_table);
- } else {
- tmpex->type=HTT_EXPORT_SYS_SYM | HTF_UNRESOLVED;
- if (tmpc)
- HashAddAfter(tmpex,tmpc,cc->htc.glbl_hash_table);
- else
- HashAdd(tmpex,cc->htc.glbl_hash_table);
- }
- }
- switch (Bsf(tmpex->type)) {
- case HTt_EXPORT_SYS_SYM:
-pu_export_sys_sym:
- if (PREC_TERM>*max_prec)
- *max_prec=PREC_TERM;
- if (!(tmpex->type & (HTF_IMM|HTF_IMPORT)))
- cc->abs_cnts.abs_addres++;
- if (tmpex->type & HTF_UNRESOLVED) {
- if (!(cc->flags&CCF_ASM_EXPRESSIONS))
- LexExcept(cc,"Illegal fwd ref at ");
- tmpauh=MAlloc(sizeof(CAsmUndefHash));
- tmpauh->hash=tmpex;
- tmpauh->next=cc->asm_undef_hash;
- cc->asm_undef_hash=tmpauh;
- if (tmpex->type & HTF_LOCAL)
- cc->flags|=CCF_UNRESOLVED|CCF_LOCAL;
- else
- cc->flags|=CCF_UNRESOLVED;
- ICAdd(cc,IC_IMM_I64,
- &tmpex->val,cmp.internal_types[RT_PTR],ICF_NO_RIP);
- ICAdd(cc,IC_DEREF,0,cmp.internal_types[RT_PTR]);
- } else {
- if (cc->flags&CCF_AOT_COMPILE && !(tmpex->type & HTF_IMM))
- ICAdd(cc,IC_ABS_ADDR,tmpex->val,cmp.internal_types[RT_PTR]);
- else {
- if (tmpex->type&HTF_IMM)
- cc->abs_cnts.c_addres++;
- ICAdd(cc,IC_IMM_I64,tmpex->val,cmp.internal_types[RT_PTR]);
- }
- }
- Lex(cc);
- return PE_MAYBE_MODIFIERS;
- case HTt_FUN:
- if (PREC_TERM>*max_prec)
- *max_prec=PREC_TERM;
- Lex(cc); //skip fun name
- return PrsFunCall(cc,ps,FALSE,tmpex);
- case HTt_GLBL_VAR:
- if (PREC_TERM>*max_prec)
- *max_prec=PREC_TERM;
- tmpg=tmpex;
- tmpc=tmpg->var_class+1;
- cc->flags&=~(CCF_RAX|CCF_ARRAY|CCF_FUN_EXP);
- if (tmpg->flags&GVF_ARRAY) {
- *_tmpad=tmpg->dim.next;
- cc->flags|=CCF_ARRAY;
- }
- if (cc->flags&CCF_AOT_COMPILE) {
- if (tmpg->flags & GVF_EXTERN) //TODO
- LexExcept(cc,"Feature not implemented ");
- else {
- if (tmpg->flags & GVF_IMPORT)
- ICAdd(cc,IC_ADDR_IMPORT,tmpg,tmpc);
- else {
- if (tmpg->flags&GVF_DATA_HEAP)
- ICAdd(cc,IC_HEAP_GLBL,tmpg->heap_glbl,tmpc);
- else
- ICAdd(cc,IC_ABS_ADDR,tmpg->data_addr_rip,tmpc);
- }
- }
- } else {
- if (tmpg->flags & GVF_EXTERN) {
- cc->abs_cnts.externs++;
- ICAdd(cc,IC_IMM_I64,&tmpg->data_addr,tmpc);
- ICAdd(cc,IC_DEREF,0,tmpc);
- } else
- ICAdd(cc,IC_IMM_I64,tmpg->data_addr,tmpc);
- }
- Lex(cc);
- if (tmpg->flags & GVF_FUN) {
- PrsPopDeref(ps);
- cc->flags|=CCF_FUN_EXP;
- PrsPush2(ps,tmpg->fun_ptr-tmpg->fun_ptr->ptr_stars_cnt);
- }
- return PE_UNARY_MODIFIERS;
- case HTt_CLASS:
- PrsOffsetOf(cc);
- return PE_MAYBE_MODIFIERS;
- case HTt_KEYWORD:
- switch (tmpex(CHashGeneric *)->user_data0) {
- case KW_SIZEOF:
- if (PREC_TERM>*max_prec)
- *max_prec=PREC_TERM;
- j=0;
- while (Lex(cc)=='(')
- j++;
- PrsSizeOf(cc);
- while (j--) {
- if (cc->token!=')')
- LexExcept(cc,"Missing ')' at ");
- Lex(cc);
- }
- return PE_MAYBE_MODIFIERS;
- case KW_OFFSET:
- if (PREC_TERM>*max_prec)
- *max_prec=PREC_TERM;
- j=0;
- while (Lex(cc)=='(')
- j++;
- PrsOffsetOf(cc);
- while (j--) {
- if (cc->token!=')')
- LexExcept(cc,"Missing ')' at ");
- Lex(cc);
- }
- return PE_MAYBE_MODIFIERS;
- case KW_DEFINED:
- if (PREC_TERM>*max_prec)
- *max_prec=PREC_TERM;
- j=0;
- while (Lex(cc)=='(')
- j++;
- if (cc->token==TK_IDENT &&
- (cc->hash_entry || cc->local_var_entry))
- ICAdd(cc,IC_IMM_I64,TRUE,cmp.internal_types[RT_I64]);
- else
- ICAdd(cc,IC_IMM_I64,FALSE,cmp.internal_types[RT_I64]);
- Lex(cc);
- while (j--) {
- if (cc->token!=')')
- LexExcept(cc,"Missing ')' at ");
- Lex(cc);
- }
- return PE_MAYBE_MODIFIERS;
- }
- }
- }
- LexExcept(cc,"Missing expression at ");
-}
-
-I64 PrsUnaryModifier(CCmpCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
- CArrayDim **_tmpad,I64 *unary_post_prec)
-{
- CHashClass *tmpc,*tmpc1;
- CHashFun *fun_ptr;
- CMemberLst *tmpm=*_local_var;
- CIntermediateCode *tmpi,*tmpi1;
- CArrayDim *tmpad1,tmpad2;
- CCodeMisc *cm;
- I64 mode,old_flags;
- Bool was_paren=Btr(&cc->flags,CCf_PAREN);
-
- *_local_var=NULL;
- switch (cc->token) {
- case '.':
- if (tmpm)
- tmpm->reg=REG_NONE;
- goto um_join;
-
- case TK_DEREFERENCE:
- tmpi=cc->coc.coc_head.last;
- if (!(cc->flags & (CCF_RAX | CCF_ARRAY)))
- ICAdd(cc,IC_DEREF+PREC_UNARY_PRE<<16,0,tmpi->ic_class-1);
- else
- tmpi->ic_class--;
-
- um_join:
- if (!*unary_post_prec)
- *unary_post_prec=PREC_TERM;
- tmpc=cc->coc.coc_head.last->ic_class;
- if ((!tmpc->ptr_stars_cnt || cc->flags & CCF_ARRAY) && cc->token=='.')
- LexExcept(cc,"Must be address, not value ");
- if (!(cc->flags & CCF_RAX))
- tmpc--;
- if (!(tmpc->type & HTT_CLASS))
- LexExcept(cc,"Invalid class at ");
- if (Lex(cc)!=TK_IDENT ||
- !(tmpm=MemberFind(cc->cur_str,tmpc)))
- LexExcept(cc,"Invalid member at ");
- else if (cc->local_var_entry)
- cc->local_var_entry->use_cnt--;
- Lex(cc); //skip member name
- tmpc1=tmpm->member_class+1;
- ICAdd(cc,IC_IMM_I64,tmpm->offset,tmpc1);
- cc->flags&=~(CCF_RAX|CCF_ARRAY|CCF_FUN_EXP);
- if (tmpm->dim.next) {
- *_tmpad=tmpm->dim.next;
- cc->flags|=CCF_ARRAY;
- }
- if(tmpm->flags & MLF_FUN) {
- PrsPopDeref(ps);
- PrsPush2(ps,tmpm->fun_ptr-tmpm->fun_ptr->ptr_stars_cnt);
- cc->flags|=CCF_FUN_EXP;
- }
- ICAdd(cc,IC_ADD,0,tmpc1);
- return PE_UNARY_MODIFIERS;
- case '(':
- if (cc->flags & CCF_FUN_EXP) {
- if (!*unary_post_prec)
- *unary_post_prec=PREC_TERM;
- return PrsFunCall(cc,ps,TRUE,PrsPop2(ps));
- }
- if (!*unary_post_prec)
- *unary_post_prec=PREC_TERM;
- if (Lex(cc)!=TK_IDENT)
- LexExcept(cc,"Invalid class at ");
- if (Btr(&cc->flags,CCf_FUN_EXP))
- ps->ptr2--;
- cc->flags&=~CCF_ARRAY;
- tmpc=cc->hash_entry;
- Lex(cc);
- mode=PRS0_TYPECAST|PRS1_NULL;
- tmpc=PrsType(cc,&tmpc,&mode,NULL,NULL,&fun_ptr,NULL,&tmpad2,0);
- if (fun_ptr) {
- PrsPopDeref(ps);
- Bts(&cc->flags,CCf_FUN_EXP);
- PrsPush2(ps,fun_ptr);
- cm=COCMiscNew(cc,CMT_HASH_ENTRY);
- cm->h=fun_ptr;
- }
- if (*_tmpad=tmpad2.next) {
- cc->flags|=CCF_ARRAY;
- tmpc++;
- cm=COCMiscNew(cc,CMT_ARRAY_DIM);
- cm->dim=*_tmpad;
- }
- if (!(cc->flags&(CCF_RAX|CCF_ARRAY)))
- tmpc++;
- tmpi=cc->coc.coc_head.last;
- tmpi->ic_class=tmpc;
- ICAdd(cc,IC_HOLYC_TYPECAST,was_paren,tmpc);
- if (cc->token!=')')
- LexExcept(cc,"Missing ')' at ");
- Lex(cc);
- return PE_UNARY_MODIFIERS;
- case '[':
- if (!*unary_post_prec)
- *unary_post_prec=PREC_TERM;
- Lex(cc);
- tmpc=OptClassFwd(cc->coc.coc_head.last->ic_class);
- if (!tmpc->ptr_stars_cnt)
- LexExcept(cc,"Not array or ptr ");
- if (!(cc->flags & (CCF_ARRAY | CCF_RAX))) {
- tmpc=OptClassFwd(tmpc-1);
- if (!tmpc->ptr_stars_cnt)
- LexExcept(cc,"Not array or ptr ");
- ICAdd(cc,IC_DEREF+PREC_UNARY_PRE<<16,0,tmpc);
- }
- tmpc1=tmpc-1;
- if (tmpad1=*_tmpad) {
- ICAdd(cc,IC_IMM_I64,tmpad1->total_cnt*tmpc1->size,tmpc);
- if (*_tmpad=tmpad1->next) {
- old_flags=cc->flags;
- if (!PrsExpression(cc,NULL,FALSE,ps))
- throw('Compiler');
- cc->flags=cc->flags&~CCF_FUN_EXP|old_flags&CCF_FUN_EXP;
- if (cc->token!=']')
- LexExcept(cc,"Missing ']' at ");
- Lex(cc); //skip ]
- tmpi1=cc->coc.coc_head.last;
- tmpi1->ic_flags|=ICF_RES_TO_INT;
- ICAdd(cc,IC_MUL,0,tmpc);
- ICAdd(cc,IC_ADD,0,tmpc);
- cc->flags|=CCF_RAX;
- return PE_UNARY_MODIFIERS;
- }
- } else
- ICAdd(cc,IC_IMM_I64,tmpc1->size,tmpc);
- old_flags=cc->flags;
- if (!PrsExpression(cc,NULL,FALSE,ps))
- throw('Compiler');
- cc->flags=cc->flags&~CCF_FUN_EXP|old_flags&CCF_FUN_EXP;
- if (cc->token!=']')
- LexExcept(cc,"Missing ']' at ");
- Lex(cc); //skip ]
- tmpi1=cc->coc.coc_head.last;
- tmpi1->ic_flags|=ICF_RES_TO_INT;
- ICAdd(cc,IC_MUL,0,tmpc);
- ICAdd(cc,IC_ADD,0,tmpc);
- cc->flags&=~(CCF_RAX|CCF_ARRAY);
- return PE_UNARY_MODIFIERS;
- start:
- case TK_PLUS_PLUS:
- cc->flags|=CCF_POSTINC;
- break;
- case TK_MINUS_MINUS:
- cc->flags|=CCF_POSTDEC;
- break;
- end:
- if (!*unary_post_prec)
- *unary_post_prec=PREC_UNARY_POST;
- Lex(cc);
- return PE_DEREFERENCE;
- }
- return PE_DEREFERENCE;
-}
-
-U8 *LexExpression2Bin(CCmpCtrl *cc,I64 *_type=NULL)
-{//Compile cc expression. You call the code.
- U8 *res;
- I64 size;
- Bool old_trace=Btr(&cc->flags,CCf_PASS_TRACE_PRESENT);
- COCPush(cc);
- COCInit(cc);
- if (PrsExpression(cc,NULL,FALSE)) {
- ICAdd(cc,IC_RETURN_VAL,0,0);
- ICAdd(cc,IC_RET,0,0);
- res=COCCompile(cc,&size,NULL,_type);
- } else
- res=NULL;
- COCPop(cc);
- BEqu(&cc->flags,CCf_PASS_TRACE_PRESENT,old_trace);
- return res;
-}
-
-Bool IsLexExpression2Bin(CCmpCtrl *cc,U8 **_machine_code)
-{//Compile cc expression to bin. Return err status.
- return ToBool(*_machine_code=LexExpression2Bin(cc));
-}
-
-I64 LexExpressionI64(CCmpCtrl *cc)
-{//Compile cc expression, forcing to I64 and eval.
- U8 *machine_code;
- I64 res,type;
- if (machine_code=LexExpression2Bin(cc,&type)) {
- res=Call(machine_code);
- Free(machine_code);
- if (type==RT_F64)
- res=ToI64(res(F64));
- } else
- res=0;
- return res;
-}
-
-F64 LexExpressionF64(CCmpCtrl *cc)
-{//Compile cc expression, forcing to F64 and eval.
- U8 *machine_code;
- I64 res,type;
- if (machine_code=LexExpression2Bin(cc,&type)) {
- res=Call(machine_code);
- Free(machine_code);
- if (type!=RT_F64)
- res(F64)=ToF64(res);
- } else
- res=0;
- return res(F64);
-}
-
-I64 LexExpression(CCmpCtrl *cc)
-{//Compile cc expression and eval. Might be I64 or F64.
- U8 *machine_code;
- I64 res;
- if (machine_code=LexExpression2Bin(cc)) {
- res=Call(machine_code);
- Free(machine_code);
- } else
- res=0;
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/PrsLib.HC.HTML b/public/src/Compiler/PrsLib.HC.HTML deleted file mode 100644 index 739db38..0000000 --- a/public/src/Compiler/PrsLib.HC.HTML +++ /dev/null @@ -1,335 +0,0 @@ - - - - - PrsLib.HC - - - - - U0 PrsPush(CPrsStk *ps,I64 val)
-{
- ps->stk[++ps->ptr]=val;
-}
-
-I64 PrsPop(CPrsStk *ps)
-{
- return ps->stk[ps->ptr--];
-}
-
-U0 PrsPush2(CPrsStk *ps,I64 val)
-{
- ps->stk2[++ps->ptr2]=val;
-}
-
-I64 PrsPop2(CPrsStk *ps)
-{
- return ps->stk2[ps->ptr2--];
-}
-
-U0 PrsPopDeref(CPrsStk *ps)
-{
- I64 i=PrsPop(ps);
- CHashClass *tmpc=PrsPop(ps);
- if (i.u16[0]!=IC_DEREF) {
- PrsPush(ps,tmpc);
- PrsPush(ps,i);
- }
-}
-
-I64 PrsKeyWord(CCmpCtrl *cc)
-{//Cvt cur token to KEYWORD or -1.
- CHashGeneric *tmph;
- if (cc->token==TK_IDENT &&(tmph=cc->hash_entry) && tmph->type&HTT_KEYWORD)
- return tmph->user_data0;
- else
- return -1;
-}
-
-CHashClass *PrsClassNew()
-{/*Ptrs to classes are handled by
-allocating 5 structures for each
-new class and representing a pointer
-to a class by advancing 1 struct fwd
-for one * and two fwd for two **.
-*/
- I64 i;
- CHashClass *res=CAlloc(sizeof(CHashClass)*(PTR_STARS_NUM+1),Fs->code_heap),
- *tmpc=res;
- for (i=0;i<=PTR_STARS_NUM;i++) {
- tmpc->type=HTT_CLASS;
- tmpc->raw_type=RT_PTR;
- tmpc->size=sizeof(U8 *);
- tmpc->ptr_stars_cnt=i;
- tmpc++;
- }
- res->last_in_member_lst=&res->member_lst_and_root;
- res->size=0;
- return res;
-}
-
-CHashFun *PrsFunNew()
-{
- I64 i;
- CHashFun *res=CAlloc(sizeof(CHashFun)*(PTR_STARS_NUM+1),Fs->code_heap),
- *tmpf=res;
- for (i=0;i<=PTR_STARS_NUM;i++) {
- tmpf->type=HTT_FUN;
- tmpf->raw_type=RT_PTR;
- tmpf->size=sizeof(U8 *);
- tmpf->ptr_stars_cnt=i;
- tmpf++;
- }
- res->last_in_member_lst=&res->member_lst_and_root;
- res->size=0;
- return res;
-}
-
-CIntermediateCode *ICAdd(CCmpCtrl *cc,
- I64 opcode_and_precedence,I64 arg, CHashClass *c,I64 flags=0)
-{
- CIntermediateCode *tmpi=MAlloc(sizeof(CIntermediateCode));
- tmpi->ic_code=opcode_and_precedence.u16[0];
- tmpi->ic_precedence=opcode_and_precedence.u16[1];
- tmpi->ic_data=arg;
- tmpi->ic_class=c;
- if (cc->pass_trace) {
- Bts(&cc->flags,CCf_PASS_TRACE_PRESENT);
- flags|=ICF_PASS_TRACE;
- }
- if (cc->lock_cnt)
- flags|=ICF_LOCK;
- tmpi->ic_flags=flags;
- tmpi->ic_line=cc->last_line_num;
- QueIns(tmpi,cc->coc.coc_head.last);
- return tmpi;
-}
-
-U0 COCInit(CCmpCtrl *cc)
-{
- CCodeCtrl *tmpcbh=&cc->coc;
- QueInit(&tmpcbh->coc_head.next);
- QueInit(&tmpcbh->coc_next_misc);
- tmpcbh->coc_head.ic_code=IC_END;
-}
-
-U0 COCPush(CCmpCtrl *cc)
-{
- CCodeCtrl *tmpcbh=MAlloc(sizeof(CCodeCtrl));
- MemCpy(tmpcbh,&cc->coc,sizeof(CCodeCtrl));
- cc->coc.coc_next=tmpcbh;
-}
-
-CCmpCtrl *COCPopNoFree(CCmpCtrl *cc)
-{
- CCodeCtrl *tmpcbh=cc->coc.coc_next;
- MemCpy(&cc->coc,tmpcbh,sizeof(CCodeCtrl));
- return tmpcbh;
-}
-
-U0 COCPop(CCmpCtrl *cc)
-{
- Free(COCPopNoFree(cc));
-}
-
-U0 COCAppend(CCmpCtrl *cc, CCodeCtrl *tmpcbh)
-{
- if (tmpcbh->coc_head.next!=&cc->coc.coc_head.next) {
- cc->coc.coc_head.last->next=tmpcbh->coc_head.next;
- tmpcbh->coc_head.next->last=cc->coc.coc_head.last;
- cc->coc.coc_head.last=tmpcbh->coc_head.last;
- tmpcbh->coc_head.last->next=&cc->coc.coc_head.next;
- }
- if (tmpcbh->coc_next_misc!=&cc->coc.coc_next_misc) {
- cc->coc.coc_last_misc->next=tmpcbh->coc_next_misc;
- tmpcbh->coc_next_misc->last=cc->coc.coc_last_misc;
- cc->coc.coc_last_misc=tmpcbh->coc_last_misc;
- tmpcbh->coc_last_misc->next=&cc->coc.coc_next_misc;
- }
- Free(tmpcbh);
-}
-
-CCodeMisc *COCMiscNew(CCmpCtrl *cc,I64 ty)
-{
- CCodeMisc *res=CAlloc(sizeof(CCodeMisc));
- res->addr=INVALID_PTR;
- res->type=ty;
- QueIns(res,cc->coc.coc_last_misc);
- return res;
-}
-
-CCodeMisc *COCGoToLabelFind(CCmpCtrl *cc,U8 *name)
-{
- CCodeMisc *cm=cc->coc.coc_next_misc;
- while (cm!=&cc->coc.coc_next_misc) {
- if ((cm->type==CMT_GOTO_LABEL||cm->type==CMT_ASM_LABEL) &&
- !StrCmp(cm->str,name))
- return cm;
- cm=cm->next;
- }
- return NULL;
-}
-
-I64 COCFloatConstFind(CCmpCtrl *cc,F64 d)
-{
- I64 i;
- CCodeMisc *cm=cc->coc.coc_next_misc;
- while (cm!=&cc->coc.coc_next_misc) {
- if (cm->type==CMT_FLOAT_CONSTS) {
- for (i=0;i<cm->num_consts;i++)
- if (cm->float_consts[i]==d)
- return cm->addr+i*sizeof(F64);
- if (cm->num_consts<CM_CONSTS_NUM) {
- cm->float_consts[cm->num_consts++]=d;
- return cm->addr+i*sizeof(F64);
- }
- }
- cm=cm->next;
- }
- cm=COCMiscNew(cc,CMT_FLOAT_CONSTS);
- cm->float_consts=MAlloc(CM_CONSTS_NUM*sizeof(F64));
- cm->float_consts[cm->num_consts++]=d;
- return cm->addr;
-}
-
-U0 COCDel(CCmpCtrl *cc,CCodeCtrl *coc)
-{
- CCodeMisc *cm,*cm1;
- U8 *undef=NULL;
- QueDel(&coc->coc_head.next);
- cm=coc->coc_next_misc;
- while (cm!=&coc->coc_next_misc) {
- cm1=cm->next;
- switch (cm->type) {
- case CMT_GOTO_LABEL:
- case CMT_ASM_LABEL:
- if (!(cm->flags&CMF_DEFINED)) {
- undef=cm->str;
- cm->str=NULL;
- } else if (!cm->use_cnt) {
- PrintWarn("Unused label %s\n",cm->str);
- LexWarn(cc,"Unused label at ");
- }
- break;
- case CMT_JMP_TABLE:
- Free(cm->jmp_table);
- break;
- case CMT_FLOAT_CONSTS:
- Free(cm->float_consts);
- break;
- case CMT_ARRAY_DIM:
- LinkedLstDel(cm->dim);
- break;
- case CMT_HASH_ENTRY:
- HashDel(cm->h);
- break;
- }
- Free(cm->str);
- Free(cm);
- cm=cm1;
- }
- if (undef) {
- PrintErr("Undefined goto label %s\n",undef);
- Free(undef);
- LexExcept(cc,"Undefined goto label at ");
- }
-}
-
-U0 COCHeaderPut(CCmpCtrl *cc,I64 pass,Bool put)
-{
- CIntermediateCode *tmpi;
- if (Bt(&cc->flags,CCf_PASS_TRACE_PRESENT)) {
- if (put) {
- if (Bt(&cc->saved_pass_trace,pass-1)) {
- "$IV,1$Pass %d:$IV,0$\n",pass-1;
- tmpi=cc->coc.coc_head.next;
- while (tmpi->ic_code) {
- if (tmpi->ic_flags&ICF_PASS_TRACE)
- ICPut(cc,tmpi);
- tmpi=tmpi->next;
- }
- }
- } else if (Bt(&cc->saved_pass_trace,pass))
- "$IV,1$Pass %d:$IV,0$\n",pass;
- }
- cc->pass=pass;
-}
-
-U8 *COCCompile(CCmpCtrl *cc,I64 *_code_size,CDbgInfo **_dbg,I64 *_type)
-{
- U8 *res;
- CCodeMisc *lb;
- I64 i,code_size,last_code_size;
-
- COptReg reg_offsets[REG_REGS_NUM];
- if (_dbg) *_dbg=NULL;
- cc->pass=0;
- COCHeaderPut(cc,1,TRUE);
- OptPass012(cc);
- COCHeaderPut(cc,2,TRUE);
- OptPass012(cc);
- COCHeaderPut(cc,3,TRUE);
- OptPass3(cc,reg_offsets);
- COCHeaderPut(cc,4,TRUE);
- OptPass4(cc,reg_offsets,_type);
- COCHeaderPut(cc,5,TRUE);
- OptPass5(cc);
- COCHeaderPut(cc,6,TRUE);
- OptPass6(cc);
- COCHeaderPut(cc,7,TRUE);
-
- lb=cc->coc.coc_next_misc;
- while (lb!=&cc->coc.coc_next_misc) {
- if (lb->type==CMT_JMP_TABLE) {
- for (i=0;i<lb->range;i++)
- lb->jmp_table[i]=OptLabelFwd(lb->jmp_table[i]);
- lb->dft=OptLabelFwd(lb->dft);
- }
- lb=lb->next;
- }
-
- COCHeaderPut(cc,7,FALSE);
- OptPass789A(cc,reg_offsets,NULL,NULL);
- COCHeaderPut(cc,8,FALSE);
- OptPass789A(cc,reg_offsets,NULL,NULL);
- COCHeaderPut(cc,9,FALSE);
- code_size=OptPass789A(cc,reg_offsets,NULL,NULL);
- do {
- last_code_size=code_size;
- COCHeaderPut(cc,9,FALSE);
- code_size=OptPass789A(cc,reg_offsets,NULL,NULL);
- if (code_size>last_code_size) {
- "Pass:9 Code Size\n";
- LexExcept(cc,"Compiler Optimization Error at ");
- }
- } while (code_size<last_code_size);
-
- if (cc->flags&CCF_AOT_COMPILE)
- res=MAlloc(code_size);
- else {
- res=MAlloc(code_size,Fs->code_heap);
- if (cc->htc.fun)
- Fs->last_fun=cc->htc.fun;
- }
- COCHeaderPut(cc,10,FALSE);
- code_size=OptPass789A(cc,reg_offsets,res,_dbg);
-
- COCDel(cc,&cc->coc);
- if (Bt(&cc->opts,OPTf_TRACE)) {
- if (cc->flags&CCF_AOT_COMPILE) {
- if (cc->aotc->seg_size==16)
- Un(res,code_size,16);
- else if (cc->aotc->seg_size==64)
- Un(res,code_size,64);
- else
- Un(res,code_size,32);
- } else
- Un(res,code_size,64);
- }
- if (_code_size) *_code_size=code_size;
- cc->saved_pass_trace=cc->pass_trace;
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/PrsStmt.HC.HTML b/public/src/Compiler/PrsStmt.HC.HTML deleted file mode 100644 index 0cd5981..0000000 --- a/public/src/Compiler/PrsStmt.HC.HTML +++ /dev/null @@ -1,1234 +0,0 @@ - - - - - PrsStmt.HC - - - - - CHashClass *PrsClass(CCmpCtrl *cc,I64 keyword,I64 fsp_flags,Bool is_extern)
-{
- CHashClass *tmpc,*base_class;
- if (cc->token!=TK_IDENT)
- LexExcept(cc,"Expecting identifier at ");
- if (is_extern) {
- tmpc=PrsClassNew;
- tmpc->str=cc->cur_str;
- cc->cur_str=NULL;
- HashAdd(tmpc,cc->htc.glbl_hash_table);
- LBts(&tmpc->flags,Cf_EXTERN);
- HashSrcFileSet(cc,tmpc);
- Lex(cc);
- } else {
- if (cc->flags&CCF_AOT_COMPILE)
- tmpc=HashFind(cc->cur_str,cc->htc.glbl_hash_table,HTT_CLASS);
- else
- tmpc=HashSingleTableFind(cc->cur_str,cc->htc.glbl_hash_table,HTT_CLASS);
- if (tmpc) {
- if (!Bt(&tmpc->flags,Cf_EXTERN))
- tmpc=NULL;
- else if (tmpc->use_cnt<3)
- UnusedExternWarning(cc,tmpc);
- }
- if (tmpc) {
- Free(tmpc->src_link);
- tmpc->src_link=NULL;
- Free(tmpc->idx);
- tmpc->idx=NULL;
- } else {
- tmpc=PrsClassNew;
- tmpc->str=cc->cur_str;
- cc->cur_str=NULL;
- HashAdd(tmpc,cc->htc.glbl_hash_table);
- }
- LBtr(&tmpc->flags,Cf_EXTERN);
- if (fsp_flags&FSF_PUBLIC)
- tmpc->type|=HTF_PUBLIC;
- tmpc->use_cnt=0;
- if (cc->last_U16=='\n')
- HashSrcFileSet(cc,tmpc,-1);
- else
- HashSrcFileSet(cc,tmpc,0);
- if (Lex(cc)==':') {
- if (Lex(cc)!=TK_IDENT || !(base_class=cc->hash_entry) ||
- !(base_class->type&HTT_CLASS))
- LexExcept(cc,"Invalid class at ");
- if (Lex(cc)==',')
- LexExcept(cc,"Only one base class allowed at this time at ");
- tmpc->base_class=base_class;
- tmpc->size+=base_class->size;
- }
- if (keyword==KW_UNION)
- PrsVarLst(cc,tmpc,PRS0_NULL|PRS1_CLASS|PRSF_UNION);
- else
- PrsVarLst(cc,tmpc,PRS0_NULL|PRS1_CLASS);
- tmpc->size+=tmpc->neg_offset;
- }
- return tmpc;
-}
-
-CHashFun *PrsFunJoin(CCmpCtrl *cc,CHashClass *tmp_return,
- U8 *name,I64 fsp_flags)
-{
- CMemberLst *tmpm,*header_lst;
- CAOTCtrl *aotc=cc->aotc;
- CHashClass *header_return;
- CHashFun *tmpf;
- I64 header_arg_cnt;
- if (name) {//if not fun_ptr
- if (cc->flags&CCF_AOT_COMPILE) {
- if ((tmpf=HashFind(name,cc->htc.glbl_hash_table,HTT_FUN)) &&
- tmpf->type & HTF_IMPORT)
- tmpf=NULL;
- } else
- if ((tmpf=HashSingleTableFind(name,cc->htc.glbl_hash_table,HTT_FUN)) &&
- !Bt(&tmpf->flags,Cf_EXTERN))
- tmpf=NULL;
- if (tmpf && tmpf->use_cnt<3)
- UnusedExternWarning(cc,tmpf);
- } else
- tmpf=NULL;
- if (tmpf) {
- tmpf->used_reg_mask=REGG_CLOBBERED+REGG_SAVED+REGG_STK_TMP;
- Free(tmpf->src_link);
- tmpf->src_link=NULL;
- Free(tmpf->idx);
- tmpf->idx=NULL;
- Free(name);
- header_arg_cnt=tmpf->arg_cnt;
- header_lst=tmpf->member_lst_and_root;
- header_return=tmpf->return_class;
- tmpf->member_lst_and_root=NULL;
- ClassMemberLstDel(tmpf);
- } else {
- tmpf=PrsFunNew;
- header_return=NULL;
- tmpf->used_reg_mask=REGG_CLOBBERED+REGG_SAVED+REGG_STK_TMP;
- tmpf->clobbered_reg_mask=REGG_CLOBBERED+REGG_STK_TMP;
- tmpf->str=name;
- if (cc->flags&CCF_AOT_COMPILE)
- tmpf->exe_addr=aotc->rip;
- else
- tmpf->exe_addr=&UndefinedExtern;
- LBts(&tmpf->flags,Cf_EXTERN);
- tmpf->flags|=fsp_flags&FSG_FUN_FLAGS1;
- if (name) //if not fun_ptr
- HashAdd(tmpf,cc->htc.glbl_hash_table);
- }
- BEqu(&tmpf->type,HTf_PUBLIC,fsp_flags&FSF_PUBLIC);
- tmpf->return_class=tmp_return;
- tmpf->use_cnt=0;
- HashSrcFileSet(cc,tmpf);
- PrsVarLst(cc,tmpf,PRS0_NULL|PRS1_FUN_ARG);
- tmpf->arg_cnt=tmpf->member_cnt;
- if (0<tmpf->arg_cnt<<3<=I16_MAX && !Bt(&tmpf->flags,Ff_DOT_DOT_DOT))
- LBts(&tmpf->flags,Ff_RET1);
- tmpm=tmpf->member_lst_and_root;
- while (tmpm) {
- tmpm->offset+=16; //RBP+RETURN
- tmpm=tmpm->next;
- }
- tmpf->size=0;
- if (header_return) {
- if (GetOption(OPTf_WARN_HEADER_MISMATCH)) {
- if (tmpf->return_class!=header_return) {
- PrintWarn("Fun Header return mismatch '%s'\n",tmpf->str);
- cc->warning_cnt++;
- }
- if (!MemberLstCmp(tmpf->member_lst_and_root,header_lst,header_arg_cnt)) {
- PrintWarn("Fun header args mismatch '%s'\n",tmpf->str);
- cc->warning_cnt++;
- }
- }
- MemberLstDel(header_lst);
- }
- return tmpf;
-}
-
-U0 PrsFun(CCmpCtrl *cc,CHashClass *tmp_return,U8 *name,I64 fsp_flags)
-{
- CMemberLst *tmpm;
- CCodeMisc *saved_leave_label;
- I64 i,j,size,*r;
- Bool old_trace;
-
- cc->fun_lex_file=cc->lex_include_stk;
- cc->min_line=cc->max_line=cc->lex_include_stk->line_num;
-
- cc->flags&=~CCF_NO_REG_OPT;
- cc->htc.local_var_lst=cc->htc.fun=PrsFunJoin(cc,tmp_return,name,fsp_flags);
-
- COCPush(cc);
- Btr(&cc->flags,CCf_PASS_TRACE_PRESENT);
- COCInit(cc);
- ICAdd(cc,IC_ENTER,0,0);
- saved_leave_label=cc->lb_leave;
- cc->lb_leave=COCMiscNew(cc,CMT_LABEL);
- cc->flags&=~CCF_HAS_RETURN;
- PrsStmt(cc,,,0);
-
- if (cc->max_line<cc->min_line)
- cc->max_line=cc->min_line;
-
- if (cc->htc.fun->return_class->size && !(cc->flags&CCF_HAS_RETURN))
- LexWarn(cc,"Function should return val ");
- ICAdd(cc,IC_LABEL,cc->lb_leave,0);
- cc->lb_leave=saved_leave_label;
- ICAdd(cc,IC_LEAVE,0,cc->htc.fun->return_class);
- cc->htc.fun->size&=~7;
- if (cc->flags&CCF_AOT_COMPILE) {
- cc->htc.fun->exe_addr=cc->aotc->rip;
- cc->htc.fun->type|=HTF_EXPORT|HTF_RESOLVE;
- r=COCCompile(cc,&size,&cc->htc.fun->dbg_info,NULL);
- if (r) {
- j=(size+7)>>3;
- for (i=0;i<j;i++)
- AOTStoreCodeU64(cc,r[i]);
- Free(r);
- }
- } else {
- old_trace=Btr(&cc->opts,OPTf_TRACE);
- cc->htc.fun->exe_addr=COCCompile(
- cc,&size,&cc->htc.fun->dbg_info,NULL);
- if (old_trace) {
- Bts(&cc->opts,OPTf_TRACE);
- Un(cc->htc.fun->exe_addr,size,64);
- }
- SysSymImportsResolve(cc->htc.fun->str);
- }
- LBtr(&cc->htc.fun->flags,Cf_EXTERN);
- COCPop(cc);
- tmpm=cc->htc.fun->member_lst_and_root;
- while (tmpm) {
- if (tmpm->flags & MLF_NO_UNUSED_WARN) {
- if (tmpm->use_cnt>1&&StrCmp(tmpm->str,"_anon_"))
- PrintWarn("Unneeded no_warn\n $LK,\"FL:%s,%d\"$'%s' in '%s'\n",
- cc->lex_include_stk->full_name,cc->lex_include_stk->line_num,
- tmpm->str,cc->htc.fun->str);
- } else if (!tmpm->use_cnt && GetOption(OPTf_WARN_UNUSED_VAR))
- PrintWarn("Unused var\n $LK,\"FL:%s,%d\"$'%s' in '%s'\n",
- cc->lex_include_stk->full_name,cc->lex_include_stk->line_num,
- tmpm->str,cc->htc.fun->str);
- tmpm=tmpm->next;
- }
- cc->htc.local_var_lst=cc->htc.fun=cc->fun_lex_file=NULL;
-}
-
-U0 PrsGlblVarLst(CCmpCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
- I64 saved_val,I64 fsp_flags)
-{
- I64 i,j,mode,k,val;
- U8 *st;
- CHashExport *tmpex;
- CHashGlblVar *tmpg;
- CAOTCtrl *aotc=cc->aotc;
- CAOTHeapGlbl *tmphg;
- CHashClass *tmpc;
- CHashFun *tmpf,*tmpf_fun_ptr;
- CArrayDim tmpad;
- Bool has_alias,undef_array_size,is_array;
- while (TRUE) {
- tmpc=PrsType(cc,&saved_tmpc,&saved_mode,NULL,&st,
- &tmpf_fun_ptr,&tmpex,&tmpad,fsp_flags);
-
- if (!st) return;
- if (tmpad.next)
- is_array=TRUE;
- else if (tmpad.total_cnt<0) {
- is_array=TRUE;
- tmpc--;
- } else
- is_array=FALSE;
-
- val=saved_val;
- mode=saved_mode;
- if (tmpex && mode&255==PRS0_EXTERN && !(cc->flags&CCF_AOT_COMPILE) &&
- tmpex->type&HTT_EXPORT_SYS_SYM) {
- val=tmpex->val;
- mode=PRS0__EXTERN|PRS1_NOT_REALLY__EXTERN;
- }
- if (cc->token=='(') {
- switch (mode&255) {
- case PRS0__INTERN:
- tmpf=PrsFunJoin(cc,tmpc,st,fsp_flags);
- tmpf->exe_addr=val;
- Bts(&tmpf->flags,Ff_INTERNAL);
- LBtr(&tmpf->flags,Cf_EXTERN);
- return;
- case PRS0__EXTERN:
- if (!(fsp_flags&FSF__) && !(mode&PRS1_NOT_REALLY__EXTERN))
- LexExcept(cc,"Expecting label with underscore at ");
- tmpf=PrsFunJoin(cc,tmpc,st,fsp_flags);
- tmpf->exe_addr=val;
- SysSymImportsResolve(tmpf->str);
- LBtr(&tmpf->flags,Cf_EXTERN);
- if (saved_mode&255==PRS0__EXTERN)
- LBts(&tmpf->flags,Ff__EXTERN);
- if (cc->flags&CCF_AOT_COMPILE)
- tmpf->type|=HTF_RESOLVE;
- return;
- case PRS0_EXTERN:
- PrsFunJoin(cc,tmpc,st,fsp_flags);
- return;
- case PRS0__IMPORT:
- if (!(fsp_flags&FSF__))
- LexExcept(cc,"Expecting label with underscore at ");
- case PRS0_IMPORT:
- if (!(cc->flags&CCF_AOT_COMPILE))
- LexExcept(cc,"import not needed at ");
- else {
- tmpf=PrsFunJoin(cc,tmpc,st,fsp_flags);
- tmpf->type|=HTF_IMPORT;
- if (mode&255==PRS0__IMPORT)
- tmpf->import_name=StrNew(val);
- else
- tmpf->import_name=StrNew(st);
- }
- return;
- default:
- PrsFun(cc,tmpc,st,fsp_flags);
- return;
- }
- } else {
- if (tmpad.total_cnt<0) {
- i=0;
- undef_array_size=TRUE;
- } else {
- i=tmpad.total_cnt;
- undef_array_size=FALSE;
- }
- if (tmpf_fun_ptr)
- j=sizeof(U8 *);
- else
- j=tmpc->size;
- j*=i;
- has_alias=FALSE;
- tmphg=NULL;
- switch (mode&255) {
- case PRS0__EXTERN:
- if (cc->flags&CCF_AOT_COMPILE) {
- tmpg=CAlloc(sizeof(CHashGlblVar));
- tmpg->data_addr_rip=val;
- tmpg->type=HTT_GLBL_VAR | HTF_EXPORT;
- } else {
- tmpg=CAlloc(sizeof(CHashGlblVar),Fs->code_heap);
- tmpg->data_addr=val;
- tmpg->type=HTT_GLBL_VAR;
- }
- tmpg->flags|=GVF_ALIAS;
- break;
- case PRS0__IMPORT:
- case PRS0_IMPORT:
- if (!(cc->flags&CCF_AOT_COMPILE))
- LexExcept(cc,"import not needed at ");
- else {
- tmpg=CAlloc(sizeof(CHashGlblVar));
- tmpg->type=HTT_GLBL_VAR | HTF_IMPORT;
- if (mode&255==PRS0__IMPORT)
- tmpg->import_name=StrNew(val);
- else
- tmpg->import_name=StrNew(st);
- }
- break;
- case PRS0_EXTERN:
- if (cc->flags&CCF_AOT_COMPILE) {
- tmpg=CAlloc(sizeof(CHashGlblVar));
- tmpg->type=HTT_GLBL_VAR;
- } else {
- tmpg=CAlloc(sizeof(CHashGlblVar),Fs->code_heap);
- tmpg->type=HTT_GLBL_VAR|HTF_UNRESOLVED;
- }
- break;
- default:
- if (cc->flags&CCF_AOT_COMPILE) {
- if (Bt(&cc->opts,OPTf_GLBLS_ON_DATA_HEAP)) {
- if (cc->token=='=')
- LexExcept(cc,"Can't init glbl var on data heap in AOT module ");
- tmpg=CAlloc(sizeof(CHashGlblVar));
- tmphg=tmpg->heap_glbl=CAlloc(sizeof(CAOTHeapGlbl));
- tmphg->size=j;
- tmphg->str=StrNew(st);
- tmphg->next=aotc->heap_glbls;
- aotc->heap_glbls=tmphg;
- tmpg->flags=GVF_DATA_HEAP;
- tmpg->type=HTT_GLBL_VAR; //TODO: HTF_EXPORT
- if (tmpex && tmpex->type & HTT_GLBL_VAR) //TODO!! extern
- LexExcept(cc,"Feature not implemented ");
- } else {
- tmpg=CAlloc(sizeof(CHashGlblVar));
- if (cc->token=='=')
- tmpg->data_addr=CAlloc(j);
- if (tmpc->size>=8) //align
- while (aotc->rip&7)
- AOTStoreCodeU8(cc,0);
- else if (tmpc->size==4)
- while (aotc->rip&3)
- AOTStoreCodeU8(cc,0);
- else if (tmpc->size==2)
- while (aotc->rip&1)
- AOTStoreCodeU8(cc,0);
- tmpg->data_addr_rip=aotc->rip;
- tmpg->type=HTT_GLBL_VAR | HTF_EXPORT;
- if (tmpex && tmpex->type & HTT_GLBL_VAR)
- has_alias=TRUE;
- for (k=0;k<j;k++)
- AOTStoreCodeU8(cc,0); //Init AOT glbl to zero.
- }
- } else {
- if (Bt(&cc->opts,OPTf_GLBLS_ON_DATA_HEAP)) {
- tmpg=CAlloc(sizeof(CHashGlblVar),Fs->code_heap);
- tmpg->data_addr=MAlloc(j);
- tmpg->flags=GVF_DATA_HEAP;
- } else {
- tmpg=CAlloc(sizeof(CHashGlblVar),Fs->code_heap);
- tmpg->data_addr=MAlloc(j,Fs->code_heap);
- }
- tmpg->type=HTT_GLBL_VAR;
- if (tmpex && tmpex->type&HTT_GLBL_VAR &&
- tmpex->type&HTF_UNRESOLVED &&
- MHeapCtrl(tmpex)==MHeapCtrl(tmpg))
- has_alias=TRUE;
- if (sys_var_init_flag)
- MemSet(tmpg->data_addr,sys_var_init_val,j);
- }
- }
- tmpg->dim.next=tmpad.next;
- if (fsp_flags&FSF_PUBLIC)
- tmpg->type|=HTF_PUBLIC;
- tmpg->var_class=tmpc;
- tmpg->str=st;
- tmpg->size=j;
- tmpg->dim.total_cnt=i;
- tmpg->use_cnt=0;
- if (cc->last_U16=='\n')
- HashSrcFileSet(cc,tmpg,-1);
- else
- HashSrcFileSet(cc,tmpg,0);
- if (mode&255==PRS0_IMPORT || mode&255==PRS0__IMPORT)
- tmpg->flags|=GVF_IMPORT;
- if (mode&255==PRS0_EXTERN)
- tmpg->flags|=GVF_EXTERN;
- if (tmpf_fun_ptr) {
- tmpg->fun_ptr=tmpf_fun_ptr;
- tmpg->flags|=GVF_FUN;
- }
- if (is_array)
- tmpg->flags|=GVF_ARRAY;
- HashAdd(tmpg,cc->htc.glbl_hash_table);
- if (!(cc->flags&CCF_AOT_COMPILE) && !(tmpg->flags&GVF_EXTERN))
- SysSymImportsResolve(tmpg->str);
- if (cc->token=='=') {
- if (undef_array_size) {
- LexPush(cc);
- LexPush(cc);
- Lex(cc);
- PrsGlblInit(cc,tmpg,1);
- LexPopNoRestore(cc);
- tmpg->size=tmpg->dim.total_cnt*tmpc->size;
- if (tmphg)
- tmphg->size=tmpg->size;
- if (cc->flags&CCF_AOT_COMPILE)
- for (k=0;k<tmpg->size;k++)
- AOTStoreCodeU8(cc,0);
- else
- if (sys_var_init_flag)
- MemSet(tmpg->data_addr,sys_var_init_val,k);
- LexPopRestore(cc);
- }
- LexPush(cc);
- Lex(cc);
- PrsGlblInit(cc,tmpg,2);
- if (cc->flags&CCF_AOT_COMPILE)
- for (k=0;k<tmpg->size;k++)
- AOTStoreCodeU8At(cc,tmpg->data_addr_rip+k,tmpg->data_addr[k]);
- LexPopNoRestore(cc);
- }
- if (has_alias) {
- if (tmpex(CHashGlblVar *)->use_cnt<2) {
- PrintWarn("Unused extern '%s'\n",tmpex(CHashGlblVar *)->str);
- cc->warning_cnt++;
- }
- tmpex(CHashGlblVar *)->flags|=GVF_ALIAS;
- tmpex(CHashGlblVar *)->data_addr=tmpg->data_addr;
- tmpex(CHashGlblVar *)->data_addr_rip=tmpg->data_addr_rip;
- }
- if (cc->token==',')
- Lex(cc);
- else {
- if (cc->token!=';')
- LexExcept(cc,"Missing ';' at");
- Lex(cc);
- return;
- }
- }
- }
-}
-
-U0 PrsIf(CCmpCtrl *cc,I64 try_cnt,CCodeMisc *lb_break)
-{
- CCodeMisc *lb,*lb1;
- I64 k;
- if (cc->token!='(')
- LexExcept(cc,"Expecting '(' at ");
- Lex(cc);
- if (!PrsExpression(cc,NULL,FALSE))
- throw('Compiler');
- if (cc->token!=')')
- LexExcept(cc,"Missing ')' at ");
- Lex(cc);
- lb=COCMiscNew(cc,CMT_LABEL);
- ICAdd(cc,IC_BR_ZERO,lb,0);
- PrsStmt(cc,try_cnt,lb_break);
- k=PrsKeyWord(cc);
- if (k==KW_ELSE) {
- Lex(cc);
- lb1=COCMiscNew(cc,CMT_LABEL);
- ICAdd(cc,IC_JMP,lb1,0);
- ICAdd(cc,IC_LABEL,lb,0);
- PrsStmt(cc,try_cnt,lb_break);
- ICAdd(cc,IC_LABEL,lb1,0);
- } else
- ICAdd(cc,IC_LABEL,lb,0);
-}
-
-U0 PrsWhile(CCmpCtrl *cc,I64 try_cnt)
-{
- CCodeMisc *lb,*lb_done;
- if (cc->token!='(')
- LexExcept(cc,"Expecting '(' at ");
- Lex(cc);
- lb=COCMiscNew(cc,CMT_LABEL);
- ICAdd(cc,IC_LABEL,lb,0);
- if (!PrsExpression(cc,NULL,FALSE))
- throw('Compiler');
- if (cc->token!=')')
- LexExcept(cc,"Missing ')' at ");
- Lex(cc);
- lb_done=COCMiscNew(cc,CMT_LABEL);
- ICAdd(cc,IC_BR_ZERO,lb_done,0);
- PrsStmt(cc,try_cnt,lb_done);
- ICAdd(cc,IC_JMP,lb,0);
- ICAdd(cc,IC_LABEL,lb_done,0);
-}
-
-U0 PrsDoWhile(CCmpCtrl *cc,I64 try_cnt)
-{
- CCodeMisc *lb,*lb_done;
- lb=COCMiscNew(cc,CMT_LABEL);
- lb_done=COCMiscNew(cc,CMT_LABEL);
- ICAdd(cc,IC_LABEL,lb,0);
- PrsStmt(cc,try_cnt,lb_done);
- if (PrsKeyWord(cc)!=KW_WHILE)
- LexExcept(cc,"Missing 'while' at");
- if (Lex(cc)!='(')
- LexExcept(cc,"Expecting '(' at ");
- Lex(cc);
- if (!PrsExpression(cc,NULL,FALSE))
- throw('Compiler');
- if (cc->token!=')')
- LexExcept(cc,"Missing ')' at ");
- ICAdd(cc,IC_BR_NOT_ZERO,lb,0);
- ICAdd(cc,IC_LABEL,lb_done,0);
- if (Lex(cc)!=';')
- LexExcept(cc,"Missing ';' at");
- Lex(cc);
-}
-
-U0 PrsFor(CCmpCtrl *cc,I64 try_cnt)
-{
- CCodeCtrl *tmpcbh;
- CCodeMisc *lb,*lb_done;
-
- if (cc->token!='(')
- LexExcept(cc,"Expecting '(' at ");
- Lex(cc);
- PrsStmt(cc,try_cnt);
-
- lb=COCMiscNew(cc,CMT_LABEL);
- ICAdd(cc,IC_LABEL,lb,0);
- if (!PrsExpression(cc,NULL,FALSE))
- throw('Compiler');
- lb_done=COCMiscNew(cc,CMT_LABEL);
- ICAdd(cc,IC_BR_ZERO,lb_done,0);
- if (cc->token!=';')
- LexExcept(cc,"Missing ';' at");
- Lex(cc);
-
- COCPush(cc);
- COCInit(cc);
- if (cc->token!=')')
- PrsStmt(cc,try_cnt,NULL,0);
- COCPush(cc);
- tmpcbh=COCPopNoFree(cc);
- COCPop(cc);
- if (cc->token!=')')
- LexExcept(cc,"Missing ')' at ");
- Lex(cc);
-
- PrsStmt(cc,try_cnt,lb_done);
- COCAppend(cc,tmpcbh);
- ICAdd(cc,IC_JMP,lb,0);
- ICAdd(cc,IC_LABEL,lb_done,0);
-}
-
-class CSubSwitch {
- CSubSwitch *next,*last;
- CCodeMisc *lb_start,*lb_break;
-};
-
-class CSwitchCase {
- CSwitchCase *next;
- CCodeMisc *label;
- I64 val;
- CSubSwitch *ss;
-};
-
-U0 PrsSwitch(CCmpCtrl *cc,I64 try_cnt)
-{
- CSwitchCase *header=NULL,*tmps,*tmps1; //Leaks on except
- CSubSwitch head,*tmpss; //Leaks on except
- CCodeMisc *lb_dft,*lb_fwd_case,*mc_jt,*lb_entry,**jmp_table;
- CIntermediateCode *tmpi_sub,*tmpi_cmp,*tmpi_jmp,*tmpi_start;
- Bool dft_found=FALSE,nobound;
- I64 i,k_start=I64_MIN,k_end,lo=I64_MAX,hi=I64_MIN,range;
-
- if (cc->token=='(')
- nobound=FALSE;
- else if (cc->token=='[')
- nobound=TRUE;
- else
- LexExcept(cc,"Expecting '(' or '[' at ");
- Lex(cc);
- QueInit(&head);
-
- head.last->lb_break=COCMiscNew(cc,CMT_LABEL);
- head.last->lb_break->use_cnt++;
- lb_dft=COCMiscNew(cc,CMT_LABEL);
- lb_dft->use_cnt++;
- mc_jt=COCMiscNew(cc,CMT_JMP_TABLE);
- mc_jt->begin=COCMiscNew(cc,CMT_LABEL);
- mc_jt->begin->use_cnt++;
- if (!PrsExpression(cc,NULL,FALSE))
- throw('Compiler');
- tmpi_sub=ICAdd(cc,IC_IMM_I64,0,cmp.internal_types[RT_I64]);
- ICAdd(cc,IC_SUB,0,cmp.internal_types[RT_I64]);
- tmpi_cmp=ICAdd(cc,IC_IMM_I64,0,cmp.internal_types[RT_I64]);
- if (nobound) {
- ICAdd(cc,IC_NOBOUND_SWITCH,mc_jt,0);
- if (cc->token!=']')
- LexExcept(cc,"Missing ']' at ");
- } else {
- ICAdd(cc,IC_SWITCH,mc_jt,0);
- if (cc->token!=')')
- LexExcept(cc,"Missing ')' at ");
- }
- if (Lex(cc)!='{')
- LexExcept(cc,"Expecting '{' at ");
- Lex(cc);
- ICAdd(cc,IC_LABEL,mc_jt->begin,0);
- while (TRUE) {
- while (cc->token && cc->token!='}') {
-sw_cont:
- switch (PrsKeyWord(cc)) {
- case KW_END:
- goto sw_sub_end;
- case KW_START:
- if (Lex(cc)==':')
- Lex(cc);
- else
- LexExcept(cc,"Expecting ':' at ");
- tmpss=MAlloc(sizeof(CSubSwitch));
- QueIns(tmpss,head.last);
- head.last->lb_break=COCMiscNew(cc,CMT_LABEL);
- head.last->lb_break->use_cnt++;
- lb_fwd_case=COCMiscNew(cc,CMT_LABEL);
- tmpi_jmp=ICAdd(cc,IC_JMP,lb_fwd_case,0);
-
- tmpss->lb_start=COCMiscNew(cc,CMT_LABEL);
- tmpi_start=ICAdd(cc,IC_LABEL,tmpss->lb_start,0);
- while (cc->token && cc->token!='}') {
- switch (PrsKeyWord(cc)) {
- case KW_END:
- OptFree(tmpi_jmp);
- goto sw_sub_end;
- case KW_START:
- case KW_CASE:
- case KW_DFT:
- if (cc->coc.coc_head.last==tmpi_start) {
- OptFree(tmpi_jmp);
- tmpss->lb_start=NULL;
- } else {
- ICAdd(cc,IC_RET,0,0);
- ICAdd(cc,IC_LABEL,lb_fwd_case,0);
- ICAdd(cc,IC_SUB_CALL,tmpss->lb_start,0);//In case fall-thru
- }
- goto sw_cont;
- default:
- PrsStmt(cc,try_cnt);
- }
- }
- break;
- case KW_CASE:
- if (head.next!=&head) {
- lb_fwd_case=COCMiscNew(cc,CMT_LABEL);
- tmpi_jmp=ICAdd(cc,IC_JMP,lb_fwd_case,0);//In case fall-thru
- }
- Lex(cc);
- lb_entry=COCMiscNew(cc,CMT_LABEL);
- ICAdd(cc,IC_LABEL,lb_entry,0);
- lb_entry->use_cnt++;
- if (head.next!=&head) {
- tmpss=head.next;
- while (tmpss!=&head) {
- if (tmpss->lb_start)
- ICAdd(cc,IC_SUB_CALL,tmpss->lb_start,0);
- tmpss=tmpss->next;
- }
- ICAdd(cc,IC_LABEL,lb_fwd_case,0);
- }
- if (cc->token==':') {
- if (k_start==I64_MIN)
- k_start=0;
- else
- k_start++;
- } else
- k_start=LexExpressionI64(cc);
- if (k_start<lo) lo=k_start;
- if (k_start>hi) hi=k_start;
- if (cc->token==':') {
- Lex(cc);
- tmps=MAlloc(sizeof(CSwitchCase));
- tmps->label=lb_entry;
- tmps->val=k_start;
- tmps->next=header;
- header=tmps;
- } else if (cc->token==TK_ELLIPSIS) {
- Lex(cc);
- k_end=LexExpressionI64(cc);
- if (cc->token==':') {
- Lex(cc);
- if (k_end<lo) lo=k_end;
- if (k_end>hi) hi=k_end;
- if (k_start>k_end)
- SwapI64(&k_start,&k_end);
- for (i=k_start;i<=k_end;i++) {
- tmps=MAlloc(sizeof(CSwitchCase));
- tmps->label=lb_entry;
- tmps->val=i;
- tmps->next=header;
- header=tmps;
- }
- k_start=k_end;
- } else
- LexExcept(cc,"Expecting ':' at ");
- } else
- LexExcept(cc,"Expecting ':' at ");
- break;
- case KW_DFT:
- if (head.next!=&head) {
- lb_fwd_case=COCMiscNew(cc,CMT_LABEL);
- tmpi_jmp=ICAdd(cc,IC_JMP,lb_fwd_case,0);//In case fall-thru
- }
- Lex(cc);
- ICAdd(cc,IC_LABEL,lb_dft,0);
- if (cc->token==':')
- Lex(cc);
- else
- LexExcept(cc,"Expecting ':' at ");
- if (head.next!=&head) {
- tmpss=head.next;
- while (tmpss!=&head) {
- if (tmpss->lb_start)
- ICAdd(cc,IC_SUB_CALL,tmpss->lb_start,0);
- tmpss=tmpss->next;
- }
- ICAdd(cc,IC_LABEL,lb_fwd_case,0);
- }
- dft_found=TRUE;
- break;
- default:
- PrsStmt(cc,try_cnt,head.last->lb_break);
- }
- }
-sw_sub_end:
- tmpss=head.last;
- ICAdd(cc,IC_LABEL,tmpss->lb_break,0);
- if (tmpss==&head) {
- if (cc->token!='}')
- LexExcept(cc,"Missing '}' at ");
- Lex(cc);
- break;
- } else {
- QueRem(tmpss);
- Free(tmpss);
- if (PrsKeyWord(cc)!=KW_END)
- LexExcept(cc,"Missing 'end' at ");
- if (Lex(cc)==':')
- Lex(cc);
- else
- LexExcept(cc,"Expecting ':' at ");
- }
- }
- if (!dft_found)
- ICAdd(cc,IC_LABEL,lb_dft,0);
-
- if (0<lo<=16)
- lo=0;
- range=hi-lo+1;
- if (lo>hi || !(0<range<=0xFFFF))
- LexExcept(cc,"switch range error at ");
- jmp_table=MAlloc((sizeof(CCodeMisc *)*range+0x1FF)&~0x1FF);
- MemSetI64(jmp_table,lb_dft,range);
- tmpi_sub->ic_data=lo;
- tmpi_cmp->ic_data=range;
- tmps=header;
- while (tmps) {
- tmps1=tmps->next;
- if (jmp_table[tmps->val-lo]!=lb_dft)
- LexExcept(cc,"Duplicate case at ");
- else
- jmp_table[tmps->val-lo]=tmps->label;
- Free(tmps);
- tmps=tmps1;
- }
- mc_jt->dft=lb_dft;
- mc_jt->jmp_table=jmp_table;
- mc_jt->range=range;
-}
-
-U0 PrsNoWarn(CCmpCtrl *cc)
-{
- CMemberLst *tmpm;
- while (cc->token==TK_IDENT) {
- if (!(tmpm=cc->local_var_entry))
- LexExcept(cc,"Expecting local var at ");
- tmpm->flags|=MLF_NO_UNUSED_WARN;
- if (Lex(cc)==',')
- Lex(cc);
- else if (cc->token!=';')
- LexExcept(cc,"Expecting ',' at ");
- }
-}
-
-U0 PrsStreamBlk(CCmpCtrl *cc)
-{
- CLexHashTableContext *htc=MAlloc(sizeof(CLexHashTableContext));
- CStreamBlk *tmpe=MAlloc(sizeof(CStreamBlk));
- tmpe->body=StrNew("");
- QueIns(tmpe,cc->last_stream_blk);
- COCPush(cc);
- QueInit(&cc->coc.coc_next_misc);
-
- MemCpy(htc,&cc->htc,sizeof(CLexHashTableContext));
- htc->old_flags=cc->flags;
- cc->htc.next=htc;
- cc->htc.fun=cc->htc.local_var_lst=NULL;
- cc->htc.define_hash_table=cc->htc.hash_table_lst=
- cc->htc.glbl_hash_table=cc->htc.local_hash_table=Fs->hash_table;
- cc->flags=cc->flags & ~(CCF_ASM_EXPRESSIONS|CCF_AOT_COMPILE) | CCF_EXE_BLK;
- if (cc->token=='{')
- Lex(cc);
- else
- LexExcept(cc,"Missing '}' at ");
- while (cc->token && cc->token!='}')
- ExeCmdLine(cc);
-
- MemCpy(&cc->htc,htc,sizeof(CLexHashTableContext));
- cc->flags=cc->flags&~CCF_EXE_BLK |
- htc->old_flags & (CCF_ASM_EXPRESSIONS|CCF_EXE_BLK|CCF_AOT_COMPILE);
- Free(htc);
- COCPop(cc);
- QueRem(tmpe);
- if (*tmpe->body)
- LexIncludeStr(cc,"StreamBlk",tmpe->body,FALSE);
- else
- Free(tmpe->body);
- Free(tmpe);
- Lex(cc); //Skip '}'
-}
-
-U0 PrsTryBlk(CCmpCtrl *cc,I64 try_cnt)
-{
- CCodeMisc *lb_catch,*lb_done,*lb_untry;
- CHashClass *tmpc=cmp.internal_types[RT_PTR];
- CHashFun *tmp_try=HashFind("SysTry",cc->htc.hash_table_lst,HTT_FUN),
- *tmp_untry=HashFind("SysUntry",cc->htc.hash_table_lst,HTT_FUN);
-
- if (!tmp_try || !tmp_untry)
- LexExcept(cc,"Missing header for SysTry() and SysUntry() at ");
-
- cc->flags|=CCF_NO_REG_OPT; //TODO:Currently no reg vars in funs with try/catch
-
- lb_catch=COCMiscNew(cc,CMT_LABEL);
- lb_done =COCMiscNew(cc,CMT_LABEL);
- lb_untry=COCMiscNew(cc,CMT_LABEL);
-
- ICAdd(cc,IC_CALL_START,0,0);
- ICAdd(cc,IC_GET_LABEL,lb_untry,tmpc,ICF_PUSH_RES);
- ICAdd(cc,IC_GET_LABEL,lb_catch,tmpc,ICF_PUSH_RES);
- if (Bt(&tmp_try->flags,Cf_EXTERN)) {
- cc->abs_cnts.externs++;
- if (cc->flags&CCF_AOT_COMPILE)
- ICAdd(cc,IC_CALL_IMPORT,tmp_try,tmpc);
- else
- ICAdd(cc,IC_CALL_INDIRECT2,&tmp_try->exe_addr,tmpc);
- } else
- ICAdd(cc,IC_CALL,tmp_try->exe_addr,tmpc);
- if ((Bt(&tmp_try->flags,Ff_RET1) ||
- Bt(&tmp_try->flags,Ff_ARGPOP)) && !Bt(&tmp_try->flags,Ff_NOARGPOP))
- ICAdd(cc,IC_ADD_RSP1,16,tmpc);
- else
- ICAdd(cc,IC_ADD_RSP,16,tmpc);
- ICAdd(cc,IC_CALL_END,0,tmpc);
- ICAdd(cc,IC_END_EXP,0,0,ICF_RES_NOT_USED);
-
- PrsStmt(cc,try_cnt+1);
-
- ICAdd(cc,IC_LABEL,lb_untry,0);
- ICAdd(cc,IC_CALL_START,0,0);
- if (Bt(&tmp_untry->flags,Cf_EXTERN)) {
- cc->abs_cnts.externs++;
- if (cc->flags&CCF_AOT_COMPILE)
- ICAdd(cc,IC_CALL_IMPORT,tmp_untry,tmpc);
- else
- ICAdd(cc,IC_CALL_INDIRECT2,&tmp_untry->exe_addr,tmpc);
- } else
- ICAdd(cc,IC_CALL,tmp_untry->exe_addr,tmpc);
- ICAdd(cc,IC_CALL_END,0,tmpc);
- ICAdd(cc,IC_END_EXP,0,0,ICF_RES_NOT_USED);
-
- ICAdd(cc,IC_JMP,lb_done,0);
-
- if (PrsKeyWord(cc)!=KW_CATCH)
- LexExcept(cc,"Missing 'catch' at");
-
- Lex(cc);
- ICAdd(cc,IC_LABEL,lb_catch,0);
- PrsStmt(cc,try_cnt+1);
- ICAdd(cc,IC_RET,0,tmpc);
- ICAdd(cc,IC_LABEL,lb_done,0);
-}
-
-Bool PrsStmt(CCmpCtrl *cc,I64 try_cnt=0,
- CCodeMisc *lb_break=NULL,I64 cmp_flags=CMPF_PRS_SEMICOLON)
-{
- I64 i,fsp_flags=0;
- CHashExport *tmpex;
- CCodeMisc *g_lb;
- U8 *import_name;
- CHashFun *tmp_untry;
- CAOT *tmpaot;
- if (cmp_flags&CMPF_ONE_ASM_INS) {
- if (cc->flags&CCF_AOT_COMPILE || cc->aot_depth)
- PrsAsmBlk(cc,CMPF_ONE_ASM_INS);
- else if (tmpaot=CmpJoin(cc,CMPF_ASM_BLK|CMPF_ONE_ASM_INS))
- CmpFixUpJITAsm(cc,tmpaot);
- fsp_flags=FSF_ASM;
- } else
- while (TRUE) {
- while (cc->token==',')
- Lex(cc);
- if (cc->token=='{') {
- Lex(cc);
- while (cc->token!='}' && cc->token!=TK_EOF)
- PrsStmt(cc,try_cnt,lb_break);
- if (cc->lex_include_stk==cc->fun_lex_file)
- cc->max_line=cc->lex_include_stk->line_num;
- if (Lex(cc)!=',') goto sm_done;
- } else if (cc->token==';') {
- if (cmp_flags&CMPF_PRS_SEMICOLON)
- Lex(cc);
- if (cc->token!=',') goto sm_done;
- } else {
- if (cc->token==TK_IDENT) {
- if (tmpex=cc->hash_entry) {
- if (tmpex->type & HTT_KEYWORD) {
- i=tmpex(CHashGeneric *)->user_data0;
- switch [i] {
- case KW_KWS_NUM-1: //nobound switch
- default: //A keyword that is not valid here is just a symbol.
- goto sm_not_keyword_afterall;
- start:
- case KW_ASM:
- if (cc->htc.fun) {
- if (tmpaot=CmpJoin(cc,CMPF_ASM_BLK))
- ICAdd(cc,IC_ASM,tmpaot,0);
- Lex(cc); //Skip '}' of asm{}
- } else {
- if (cc->flags&CCF_AOT_COMPILE || cc->aot_depth) {
- Lex(cc);
- PrsAsmBlk(cc,0);
- if (cc->flags&CCF_AOT_COMPILE && cc->aot_depth==1)
- Lex(cc); //Skip '}' of asm{}
- } else {
- if (tmpaot=CmpJoin(cc,CMPF_ASM_BLK))
- CmpFixUpJITAsm(cc,tmpaot);
- Lex(cc); //Skip '}' of asm{}
- }
- fsp_flags=FSF_ASM;
- }
- break;
- start:
- Lex(cc);
- case KW_LOCK:
- cc->lock_cnt++;
- PrsStmt(cc,try_cnt);
- cc->lock_cnt--;
- break;
- case KW_TRY:
- PrsTryBlk(cc,try_cnt);
- break;
- case KW_IF:
- PrsIf(cc,try_cnt,lb_break);
- break;
- case KW_FOR:
- PrsFor(cc,try_cnt);
- break;
- case KW_WHILE:
- PrsWhile(cc,try_cnt);
- break;
- case KW_DO:
- PrsDoWhile(cc,try_cnt);
- break;
- case KW_SWITCH:
- PrsSwitch(cc,try_cnt);
- break;
- end:
- end:
- if (cc->token!=',') goto sm_done;
- break;
- start:
- if (cc->htc.fun)
- LexExcept(cc,"Not allowed in fun");
- Lex(cc);
- case KW__EXTERN:
- if (Bt(&cc->opts,OPTf_EXTERNS_TO_IMPORTS))
- goto sm_underscore_import;
- if (cc->token!=TK_IDENT || !(tmpex=cc->hash_entry) ||
- !(tmpex->type & HTT_EXPORT_SYS_SYM))
- LexExcept(cc,"Expecting system sym at ");
- if (*cc->cur_str=='_')
- fsp_flags|=FSF__;
- i=tmpex->val;
- Lex(cc);
- if (cc->token!=TK_IDENT || !(tmpex=cc->hash_entry) ||
- !(tmpex->type & (HTT_CLASS|HTT_INTERNAL_TYPE)))
- LexExcept(cc,"Expecting type at ");
- Lex(cc);
- PrsGlblVarLst(cc,PRS0__EXTERN|PRS1_NULL,tmpex,i,fsp_flags);
- break;
- case KW__IMPORT:
-sm_underscore_import:
- if (cc->token!=TK_IDENT)
- LexExcept(cc,"Expecting system sym at ");
- if (*cc->cur_str=='_')
- fsp_flags|=FSF__;
- import_name=cc->cur_str;
- cc->cur_str=0;
- if (Lex(cc)!=TK_IDENT || !(tmpex=cc->hash_entry) ||
- !(tmpex->type & (HTT_CLASS|HTT_INTERNAL_TYPE)))
- LexExcept(cc,"Expecting type at ");
- Lex(cc);
- PrsGlblVarLst(cc,PRS0__IMPORT|PRS1_NULL,tmpex,
- import_name,fsp_flags);
- Free(import_name);
- break;
- case KW_EXTERN:
- if (cc->token!=TK_IDENT)
- LexExcept(cc,"Expecting type at ");
- tmpex=cc->hash_entry;
- i=PrsKeyWord(cc);
- if (i==KW_CLASS||i==KW_UNION) {
- Lex(cc);
- PrsClass(cc,i,fsp_flags,TRUE);
- fsp_flags&=FSF_ASM;
- goto sm_semicolon;
- }
- if (!tmpex ||
- !(tmpex->type & (HTT_CLASS|HTT_INTERNAL_TYPE)))
- LexExcept(cc,"Expecting type at ");
- if (Bt(&cc->opts,OPTf_EXTERNS_TO_IMPORTS))
- goto sm_import;
- Lex(cc);
- PrsGlblVarLst(cc,PRS0_EXTERN|PRS1_NULL,tmpex,0,fsp_flags);
- break;
- case KW_IMPORT:
- if (cc->token!=TK_IDENT || !(tmpex=cc->hash_entry) ||
- !(tmpex->type & (HTT_CLASS|HTT_INTERNAL_TYPE)))
- LexExcept(cc,"Expecting type at ");
-sm_import:
- Lex(cc);
- PrsGlblVarLst(cc,PRS0_IMPORT|PRS1_NULL,tmpex,0,fsp_flags);
- break;
- case KW__INTERN:
- i=LexExpressionI64(cc);
- if (cc->token!=TK_IDENT || !(tmpex=cc->hash_entry) ||
- !(tmpex->type & (HTT_CLASS|HTT_INTERNAL_TYPE)))
- LexExcept(cc,"Expecting type at ");
- Lex(cc);
- PrsGlblVarLst(cc,PRS0__INTERN|PRS1_NULL,tmpex,i,fsp_flags);
- break;
- end:
- fsp_flags&=FSF_ASM;
- break;
- start:
- case KW_STATIC:
- fsp_flags=FSF_STATIC|fsp_flags&FSF_ASM;
- break;
- case KW_INTERRUPT:
- fsp_flags=FSF_INTERRUPT|FSF_NOARGPOP|
- fsp_flags&(FSG_FUN_FLAGS2|FSF_ASM);
- break;
- case KW_HASERRCODE:
- fsp_flags=FSF_HASERRCODE|fsp_flags&(FSG_FUN_FLAGS2|FSF_ASM);
- break;
- case KW_ARGPOP:
- fsp_flags=FSF_ARGPOP|fsp_flags&(FSG_FUN_FLAGS2|FSF_ASM);
- break;
- case KW_NOARGPOP:
- fsp_flags=FSF_NOARGPOP|fsp_flags&(FSG_FUN_FLAGS2|FSF_ASM);
- break;
- case KW_PUBLIC:
- fsp_flags=FSF_PUBLIC|fsp_flags&(FSG_FUN_FLAGS2|FSF_ASM);
- break;
- end:
- Lex(cc);
- break;
- case KW_RETURN:
- if (!cc->htc.fun)
- LexExcept(cc,"Not in fun. Can't return a val ");
- if (try_cnt) {
- tmp_untry=HashFind("SysUntry",
- cc->htc.hash_table_lst,HTT_FUN);
- for (i=0;i<try_cnt;i++) {
- if (Bt(&tmp_untry->flags,Cf_EXTERN)) {
- cc->abs_cnts.externs++;
- if (cc->flags&CCF_AOT_COMPILE)
- ICAdd(cc,IC_CALL_IMPORT,
- tmp_untry,cmp.internal_types[RT_PTR]);
- else
- ICAdd(cc,IC_CALL_INDIRECT2,
- &tmp_untry->exe_addr,
- cmp.internal_types[RT_PTR]);
- } else
- ICAdd(cc,IC_CALL,tmp_untry->exe_addr,
- cmp.internal_types[RT_PTR]);
- }
- }
- if (Lex(cc)!=';') {
- if (!cc->htc.fun->return_class->size)
- LexWarn(cc,"Function should NOT return val ");
- if (!PrsExpression(cc,NULL,FALSE))
- throw('Compiler');
- ICAdd(cc,IC_RETURN_VAL,0,cc->htc.fun->return_class);
- cc->flags|=CCF_HAS_RETURN;
- } else if (cc->htc.fun->return_class->size)
- LexWarn(cc,"Function should return val ");
- ICAdd(cc,IC_JMP,cc->lb_leave,0);
- goto sm_semicolon;
- case KW_GOTO:
- if (Lex(cc)!=TK_IDENT)
- LexExcept(cc,"Expecting identifier at ");
- if (!(g_lb=COCGoToLabelFind(cc,cc->cur_str))) {
- g_lb=COCMiscNew(cc,CMT_GOTO_LABEL);
- g_lb->str=cc->cur_str;
- cc->cur_str=NULL;
- }
- g_lb->use_cnt++;
- ICAdd(cc,IC_JMP,g_lb,0);
- Lex(cc);
- goto sm_semicolon;
- case KW_BREAK:
- Lex(cc);
- if (!lb_break)
- LexExcept(cc,"'break' not allowed\n");
- ICAdd(cc,IC_JMP,lb_break,0);
- goto sm_semicolon;
- case KW_NO_WARN:
- Lex(cc);
- PrsNoWarn(cc);
- goto sm_semicolon;
- case KW_UNION:
- case KW_CLASS:
- Lex(cc);
- tmpex=PrsClass(cc,i,fsp_flags,FALSE);
- if (!cc->htc.fun && cc->token!=';') {
- PrsGlblVarLst(cc,PRS0_NULL|PRS1_NULL,tmpex,0,fsp_flags);
- fsp_flags&=FSF_ASM;
- break;
- } else {
- fsp_flags&=FSF_ASM;
- goto sm_semicolon;
- }
- }
- } else {//Ident, found in hash table, not keyword
-sm_not_keyword_afterall:
- if (tmpex->type & (HTT_CLASS|HTT_INTERNAL_TYPE)) {
- if (cc->htc.fun) {
- if (fsp_flags&FSF_STATIC)
- PrsVarLst(cc,cc->htc.fun,PRS0_NULL|PRS1_STATIC_LOCAL_VAR);
- else
- PrsVarLst(cc,cc->htc.fun,PRS0_NULL|PRS1_LOCAL_VAR);
- if (cc->token=='}') goto sm_done;
- } else {
- Lex(cc);
- PrsGlblVarLst(cc,PRS0_NULL|PRS1_NULL,tmpex,0,fsp_flags);
- }
- } else {
- if (tmpex->type & (HTT_OPCODE|HTT_ASM_KEYWORD)) {
- if (cc->htc.fun) {
- if (tmpaot=CmpJoin(cc,CMPF_ASM_BLK|CMPF_ONE_ASM_INS))
- ICAdd(cc,IC_ASM,tmpaot,0);
- } else
- LexExcept(cc,"Use Asm Blk at ");
- if (cc->token!=',') goto sm_done;
- } else
- goto sm_prs_exp;
- }
- fsp_flags&=FSF_ASM;
- }
- } else {//Ident, not in hash table
- if (cc->local_var_entry)
- goto sm_prs_exp;
- if (!(g_lb=COCGoToLabelFind(cc,cc->cur_str))) {
- g_lb=COCMiscNew(cc,CMT_GOTO_LABEL);
- g_lb->str=cc->cur_str;
- cc->cur_str=NULL;
- } else if (g_lb->flags&CMF_DEFINED)
- LexExcept(cc,"Duplicate goto label at ");
- g_lb->flags|=CMF_DEFINED;
- ICAdd(cc,IC_LABEL,g_lb,0);
- if (Lex(cc)==':') //skip cur_str
- Lex(cc); //skip colon
- else
- LexExcept(cc,"Undefined identifier at ");
- if (!cc->htc.fun)
- LexExcept(cc,"No global labels at ");
- if (cc->token!=',') goto sm_done;
- }
- } else if (cc->token==TK_STR||cc->token==TK_CHAR_CONST) {
- PrsFunCall(cc,NULL,FALSE,NULL);
- goto sm_semicolon;
- } else if (cc->token!=TK_EOF) {//Non-cur_str symbol, num or something
-sm_prs_exp:
- if (!PrsExpression(cc,NULL,TRUE))
- throw('Compiler');
-sm_semicolon:
- if (cmp_flags&CMPF_PRS_SEMICOLON) {
- if (cc->token==';')
- Lex(cc);
- else if (cc->token!=',')
- LexExcept(cc,"Missing ';' at");
- }
- if (cc->token!=',') goto sm_done;
- } else
- goto sm_done; //TK_EOF
- }
- }
-sm_done:
- return fsp_flags&FSF_ASM;
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/PrsVar.HC.HTML b/public/src/Compiler/PrsVar.HC.HTML deleted file mode 100644 index 2405f5b..0000000 --- a/public/src/Compiler/PrsVar.HC.HTML +++ /dev/null @@ -1,733 +0,0 @@ - - - - - PrsVar.HC - - - - - U0 PrsVarInit(CCmpCtrl *cc,U8 **_dst,CHashClass *tmpc,CArrayDim *tmpad,
- U8 *data_addr_rip,U8 **_base,Bool data_heap,I64 pass)
-{
- U8 *dst=*_dst,*machine_code;
- I64 i,j,r,old_flags,type,size;
- CMemberLst *tmpm;
- CIntermediateCode *tmpi;
- CAOTCtrl *aotc=cc->aotc;
- CAOTAbsAddr *tmpa;
- CAOTImportExport *tmpie;
- Bool is_str;
-
- tmpc=OptClassFwd(tmpc);
- if (tmpm=tmpc->member_lst_and_root) {
- if (cc->token!='{')
- LexExcept(cc,"Expecting '{' at ");
- LexPopNoRestore(cc);
- LexPush(cc);
- Lex(cc);
- while (tmpm) {
- PrsVarInit2(cc,&dst,tmpm->member_class,&tmpm->dim,
- data_addr_rip,_base,data_heap,pass);
- if (cc->token==',')
- Lex(cc);
- tmpm=tmpm->next;
- }
- LexPopNoRestore(cc);
- if (cc->token!='}')
- LexExcept(cc,"Missing '}' at ");
- Lex(cc);
- } else {
- if (tmpc->ptr_stars_cnt==1 &&
- ((tmpc-1)->raw_type==RT_I8 || (tmpc-1)->raw_type==RT_U8) &&
- !tmpad && cc->token==TK_STR)
- is_str=TRUE;
- else
- is_str=FALSE;
- if (cc->flags&CCF_AOT_COMPILE && is_str) {
- LexPopNoRestore(cc);
- machine_code=LexExtStr(cc,&i);
- if (pass==2) {
- tmpa=CAlloc(sizeof(CAOTAbsAddr));
- tmpa->next=aotc->abss;
- tmpa->type=AAT_ADD_U64;
- aotc->abss=tmpa;
- tmpa->rip=data_addr_rip+dst-*_base;
- *dst(I64 *)=aotc->rip;
- for (j=0;j<i;j++)
- AOTStoreCodeU8(cc,machine_code[j]);
- }
- Free(machine_code);
- } else {
- old_flags=cc->flags;
- cc->flags=CCF_NO_ABSS | cc->flags &
- ~(CCF_AOT_COMPILE|CCF_HAS_MISC_DATA|CCF_NOT_CONST);
- machine_code=LexExpression2Bin(cc,&type);
- if (old_flags&CCF_AOT_COMPILE &&
- cc->flags&CCF_NOT_CONST &&
- !Bt(&cc->opts,OPTf_GLBLS_ON_DATA_HEAP)) {
- cc->flags=cc->flags&~CCF_NO_ABSS|CCF_AOT_COMPILE;
- Free(machine_code);
- if (pass==2) {
- MemSet(dst,0,tmpc->size);
- LexPopRestore(cc);
- Lex(cc);
- COCPush(cc);
- COCInit(cc);
- ICAdd(cc,IC_ABS_ADDR,data_addr_rip,tmpc+1);
- ICAdd(cc,IC_IMM_I64,dst-*_base,tmpc+1);
- ICAdd(cc,IC_ADD,0,tmpc+1);
- if (!PrsExpression(cc,NULL,TRUE))
- throw('Compiler');
- tmpi=cc->coc.coc_head.last;
- if (tmpi->ic_code==IC_END_EXP) {
- tmpi->ic_code=IC_NOP1;
- tmpi->ic_flags=0;
- }
- ICAdd(cc,IC_ASSIGN,0,tmpc);
- ICAdd(cc,IC_END_EXP,0,tmpc,ICF_RES_NOT_USED);
- ICAdd(cc,IC_RET,0,0);
- if (machine_code=COCCompile(cc,&size,NULL,NULL)) {
- tmpie=CAlloc(sizeof(CAOTImportExport));
- tmpie->type=IET_MAIN;
- tmpie->rip=cc->aotc->rip;
- QueIns(tmpie,cc->aot->last_ie);
- for (i=0;i<size;i++)
- AOTStoreCodeU8(cc,machine_code[i]);
- Free(machine_code);
- }
- COCPop(cc);
- } else
- LexPopNoRestore(cc);
- } else {
- LexPopNoRestore(cc);
- if (!machine_code)
- throw('Compiler');
- r=Call(machine_code);
- if (!(cc->flags & CCF_HAS_MISC_DATA)||pass==1)
- Free(machine_code);
-
- if (type==RT_F64 &&
- tmpc->raw_type!=RT_F64)
- r=r(F64);
- else if (type!=RT_F64 &&
- tmpc->raw_type==RT_F64)
- r(F64)=r;
- MemCpy(dst,&r,tmpc->size);
- }
- }
- dst+=tmpc->size;
- cc->flags=cc->flags&
- ~CCF_NO_ABSS|old_flags&(CCF_HAS_MISC_DATA|CCF_AOT_COMPILE);
- }
- *_dst=dst;
-}
-
-class CVI2
-{
- CVI2 *next,*last;
- U0 base;
-};
-
-U0 PrsVarInit2(CCmpCtrl *cc,U8 **_dst,CHashClass *tmpc,
- CArrayDim *tmpad,U8 *data_addr_rip,U8 **_base,Bool data_heap,I64 pass)
-{
- I64 i,j,cnt;
- U8 *st,*_b;
- CVI2 head,*tmpvi,*tmpvi1;
- CArrayDim *tmpad1;
- tmpc=OptClassFwd(tmpc);
- if (tmpad1=tmpad->next) {
- if (!tmpc->ptr_stars_cnt &&
- (tmpc->raw_type==RT_I8 || tmpc->raw_type==RT_U8) &&
- cc->token==TK_STR) {
- LexPopNoRestore(cc);
- st=LexExtStr(cc,&i);
- if (tmpad1->cnt<0) {//[]
- tmpad1->cnt=i;
- tmpad->total_cnt=i*tmpad1->total_cnt;
- Free(*_base);
- if (data_heap)
- *_base=MAlloc(i);
- else
- *_base=MAlloc(i,Fs->code_heap);
- MemCpy(*_base,st,i);
- *_dst=*_base+i;
- } else {
- MemCpy(*_dst,st,tmpad1->cnt);
- *_dst+=tmpad1->cnt;
- }
- Free(st);
- LexPush(cc);
- } else {
- if (cc->token=='{') {
- LexPopNoRestore(cc);
- LexPush(cc);
- Lex(cc);
- }
- if (tmpad1->cnt<0) {//[]
- QueInit(&head);
- cnt=0;
- while (cc->token!='}') {
- tmpvi=MAlloc(offset(CVI2.base)+tmpad1->total_cnt*tmpc->size);
- _b=&tmpvi->base;
- PrsVarInit2(cc,&_b,tmpc,tmpad1,data_addr_rip,_base,data_heap,pass);
- QueIns(tmpvi,head.last);
- if (cc->token==',')
- Lex(cc);
- cnt++;
- }
- Lex(cc); //skip '}'
- tmpad1->cnt=cnt;
- tmpad->total_cnt=cnt*tmpad1->total_cnt;
- j=tmpad1->total_cnt*tmpc->size;
- i=cnt*j;
- Free(*_base);
- if (data_heap)
- *_base=_b=MAlloc(i);
- else
- *_base=_b=MAlloc(i,Fs->code_heap);
- tmpvi=head.next;
- while (tmpvi!=&head) {
- tmpvi1=tmpvi->next;
- MemCpy(_b,&tmpvi->base,j);
- _b+=j;
- Free(tmpvi);
- tmpvi=tmpvi1;
- }
- *_dst=_b;
- } else {
- for (i=0;i<tmpad1->cnt;i++) {
- PrsVarInit2(cc,_dst,tmpc,tmpad1,data_addr_rip,_base,data_heap,pass);
- if (tmpad1->cnt>1 && cc->token==',')
- Lex(cc);
- }
- if (cc->token=='}')
- Lex(cc);
- }
- }
- } else {
- PrsVarInit(cc,_dst,tmpc,tmpad1,data_addr_rip,_base,data_heap,pass);
- LexPush(cc);
- }
-}
-
-U0 PrsGlblInit(CCmpCtrl *cc,CHashGlblVar *tmpg,I64 pass)
-{
- U8 *dst=tmpg->data_addr;
- PrsVarInit2(cc,&dst,tmpg->var_class,&tmpg->dim,
- tmpg->data_addr_rip,&tmpg->data_addr,
- Bt(&cc->opts,OPTf_GLBLS_ON_DATA_HEAP)||
- Bt(&cc->flags,CCf_AOT_COMPILE),pass);
-}
-
-U0 PrsStaticInit(CCmpCtrl *cc,CMemberLst *tmpm,I64 pass)
-{
- U8 *machine_code,*dst=tmpm->static_data;
- CHashClass *tmpc=tmpm->member_class;
- I64 i,size;
- CAOTImportExport *tmpie;
-
- if (cc->flags&CCF_AOT_COMPILE && pass==2) {
- COCPush(cc);
- COCInit(cc);
- }
- PrsVarInit2(cc,&dst,tmpc,&tmpm->dim,tmpm->static_data_rip,
- &tmpm->static_data,Bt(&cc->flags,CCf_AOT_COMPILE),pass);
- if (cc->flags&CCF_AOT_COMPILE && pass==2) {
- if (cc->coc.coc_head.next!=&cc->coc.coc_head) {
- ICAdd(cc,IC_RET,0,0);
- if (machine_code=COCCompile(cc,&size,NULL,NULL)) {
- if (pass==2) {
- tmpie=CAlloc(sizeof(CAOTImportExport));
- tmpie->type=IET_MAIN;
- tmpie->rip=cc->aotc->rip;
- QueIns(tmpie,cc->aot->last_ie);
- for (i=0;i<size;i++)
- AOTStoreCodeU8(cc,machine_code[i]);
- }
- Free(machine_code);
- }
- } //TODO: else del misc?
- COCPop(cc);
- }
-}
-
-U0 PrsArrayDims(CCmpCtrl *cc,I64 mode,CArrayDim *dim)
-{//dim->next!=0 for array
- CArrayDim *tmpad,*tmpad1;
- I64 j;
- dim->next=NULL;
- dim->cnt=0;
- dim->total_cnt=1;
- tmpad1=&dim->next;
- if (cc->token=='[') {
- if (mode.u8[1]==PRS1B_FUN_ARG)
- LexExcept(cc,"No arrays in fun args at ");
- do {
- if (Lex(cc)==']' && !dim->next)
- j=0;
- else {
- if ((j=LexExpressionI64(cc))<0)
- LexExcept(cc,"Invalid array size at ");
- }
- tmpad=MAlloc(sizeof(CArrayDim));
- tmpad->next=NULL;
- tmpad1=&dim;
- do {
- tmpad1->total_cnt*=j;
- if (!tmpad1->next) {
- tmpad1->next=tmpad;
- break;
- }
- tmpad1=tmpad1->next;
- } while (tmpad1);
- tmpad1=tmpad;
- tmpad->cnt=j;
- tmpad->total_cnt=1;
- if (cc->token!=']')
- LexExcept(cc,"Missing ']' at ");
- } while (Lex(cc)=='[');
- }
-}
-
-CHashClass *PrsType(CCmpCtrl *cc,CHashClass **_tmpc1,
- I64 *_mode,CMemberLst *tmpm,U8 **_ident,CHashFun **_fun_ptr,
- CHashExport **_tmpex,CArrayDim *tmpad,I64 fsp_flags)
-{
- I64 k,ptr_stars_cnt,mode=*_mode;
- CHashClass *tmpc1=*_tmpc1,*tmpc2;
- CHashFun *fun_ptr=NULL;
- CHashExport *tmpex=NULL;
-
- pt_start:
- if (!tmpc1 || !(tmpc1->type & (HTT_CLASS|HTT_INTERNAL_TYPE)))
- LexExcept(cc,"Invalid class at ");
-
- ptr_stars_cnt=0;
- while (cc->token=='*') {
- if (mode.u8[1]) {
- LexPopNoRestore(cc);
- LexPush(cc);
- }
- Lex(cc);
- tmpc1++;
- if (++ptr_stars_cnt>PTR_STARS_NUM)
- LexExcept(cc,"Too many *'s at ");
- }
-
- k=PrsKeyWord(cc);
- if (k==KW_UNION || k==KW_CLASS) {
- Lex(cc);
- tmpc2=PrsClass(cc,k,fsp_flags,mode&255==PRS0_EXTERN);
- tmpc2->fwd_class=tmpc1;
- tmpc1=tmpc2;
- if (_tmpc1) *_tmpc1=tmpc1;
- mode=PRS0_NULL|PRS1_NULL;
- goto pt_start;
- }
-
- if (cc->token=='(') {
- if (Lex(cc)!='*')
- LexExcept(cc,"Expecting '*' at ");
- ptr_stars_cnt=1; //fun_ptr
- while (Lex(cc)=='*')
- ptr_stars_cnt++; //fun_ptr
- if (ptr_stars_cnt>PTR_STARS_NUM)
- LexExcept(cc,"Too many *'s at ");
- } else
- ptr_stars_cnt=-1; //fun_ptr
-
- if (_ident) {
- if (cc->token==TK_IDENT) {
- tmpex=cc->hash_entry;
- *_ident=cc->cur_str;
- cc->cur_str=NULL;
- Lex(cc);
- } else {
- if (!mode.u8[1])
- *_ident=NULL;
- else if (cc->token==',' || cc->token==';' || cc->token==')') {
- tmpex=NULL;
- *_ident=StrNew("_anon_");
- tmpm->flags|=MLF_NO_UNUSED_WARN;
- } else
- LexExcept(cc,"Expecting identifier at ");
- }
- }
-
- if (ptr_stars_cnt>=0) { //fun_ptr
- if (cc->token!=')')
- LexExcept(cc,"Missing ')' at ");
- if (Lex(cc)!='(')
- LexExcept(cc,"Expecting '(' at ");
- fun_ptr=PrsFunJoin(cc,tmpc1,NULL,fsp_flags)+ptr_stars_cnt;
- tmpc1=cmp.internal_types[RT_PTR]+ptr_stars_cnt;
- }
- PrsArrayDims(cc,mode,tmpad);
-
- tmpc2=OptClassFwd(tmpc1);
- if (tmpc2->ptr_stars_cnt) {
- tmpc2-=tmpc2->ptr_stars_cnt;
- if (tmpc2->type&HTT_INTERNAL_TYPE && !tmpc2->size)
- LexWarn(cc,"use \"U8 *\" instead of \"U0 *\" at ");
- }
-
- if (_mode) *_mode=mode;
- if (_fun_ptr) *_fun_ptr=fun_ptr;
- if (_tmpex) *_tmpex=tmpex;
- return tmpc1;
-}
-
-U0 PrsDotDotDot(CCmpCtrl *cc,CHashFun *tmpf,I64 _reg)
-{
- CMemberLst *tmpm;
- CArrayDim *tmpad;
-
- Bts(&tmpf->flags,Ff_DOT_DOT_DOT);
-
- Lex(cc);
- tmpm=MemberLstNew(_reg);
- tmpm->flags=MLF_DOT_DOT_DOT;
- tmpm->member_class=cmp.internal_types[RT_I64];
- tmpm->str=StrNew("argc");
- tmpm->offset=tmpf->size;
- tmpm->size=8;
- tmpf->size+=8;
- MemberAdd(cc,tmpm,tmpf,PRS1B_FUN_ARG);
-
- tmpm=MemberLstNew(_reg);
- tmpm->flags=MLF_DOT_DOT_DOT;
- tmpm->member_class=cmp.internal_types[RT_I64];
- tmpm->str=StrNew("argv");
- tmpm->dim.total_cnt=127; //arbitrary
- tmpm->dim.next=tmpad=MAlloc(sizeof(CArrayDim));
- tmpad->next=NULL;
- tmpad->cnt=127; //arbitrary
- tmpad->total_cnt=1;
- tmpm->offset=tmpf->size;
- tmpm->size=8; //Close enough
- tmpf->size+=8;//Close enough
- MemberAdd(cc,tmpm,tmpf,PRS1B_FUN_ARG);
-
- if (cc->token==')')
- Lex(cc);
-}
-
-U0 PrsVarLst(CCmpCtrl *cc,CHashClass *tmpc,I64 mode,I64 union_base=0)
-{
- I64 i,k,old_flags=cc->flags,old_flags2,type,_reg;
- CHashClass *tmpc1,*tmpc2;
- CHash *tmph;
- CMemberLst *tmpm;
- CMemberLstMeta *tmp_meta;
- U8 *machine_code;
- Bool undef_array_size,first;
- cc->flags|=CCF_DONT_MAKE_RES;
- if (mode.u8[1]==PRS1B_CLASS)
- cc->flags|=CCF_CLASS_DOL_OFFSET;
- if ((mode.u8[1]!=PRS1B_LOCAL_VAR && mode.u8[1]!=PRS1B_STATIC_LOCAL_VAR ||
- mode&PRSF_UNION) && (cc->token=='(' || cc->token=='{'))
- Lex(cc);
- while (TRUE) {
- if (mode&PRSF_UNION)
- cc->class_dol_offset=union_base;
- else
- cc->class_dol_offset=tmpc->size;
- while (cc->token==';')
- Lex(cc);
- while (cc->token=='$') {
- if (Lex(cc)!='=') //skip $
- LexExcept(cc,"Expecting '=' at ");
- Lex(cc); //skip =
- cc->class_dol_offset=LexExpression(cc);
- if (-cc->class_dol_offset>tmpc->neg_offset)
- tmpc->neg_offset=-cc->class_dol_offset;
- if (mode&PRSF_UNION)
- union_base=cc->class_dol_offset;
- else
- tmpc->size=cc->class_dol_offset;
- if (cc->token!=';')
- LexExcept(cc,"Missing ';' at");
- Lex(cc); //skip ;
- }
- if (cc->token==')' || cc->token=='}') {
- Lex(cc);
- goto pvl_done;
- }
- _reg=REG_UNDEF;
-pvl_restart1:
- switch (PrsKeyWord(cc)) {
- case KW_REG:
- _reg=REG_ALLOC;
- if (Lex(cc)==TK_IDENT) {
- k=DefineMatch(cc->cur_str,"ST_U64_REGS");
- if (k>=0) {
- _reg=k;
- Lex(cc);
- }
- }
- goto pvl_restart1;
- case KW_NOREG:
- _reg=REG_NONE;
- Lex(cc);
- goto pvl_restart1;
- }
-
- if (cc->token==TK_ELLIPSIS && mode.u8[1]==PRS1B_FUN_ARG) {
- PrsDotDotDot(cc,tmpc,_reg);
- goto pvl_done;
- }
- if (cc->token==TK_IDENT)
- tmph=cc->hash_entry;
- else
- tmph=NULL;
- if (!tmph)
- LexExcept(cc,"Expecting type at ");
- k=PrsKeyWord(cc);
- if (k==KW_UNION) {
- Lex(cc);
- PrsVarLst(cc,tmpc,mode|PRSF_UNION,tmpc->size);
- } else {
- if (!(tmph->type & (HTT_CLASS|HTT_INTERNAL_TYPE)))
- LexExcept(cc,"Expecting type at ");
- first=TRUE;
-pvl_restart2:
- tmpc1=tmph;
- LexPush(cc);
- Lex(cc); //skip type or ','
- tmpm=MemberLstNew(_reg);
- _reg=REG_UNDEF;
- if (mode.u8[1]==PRS1B_STATIC_LOCAL_VAR) {
- tmpm->flags|=MLF_STATIC;
- tmpm->reg=REG_NONE;
- }
- if (mode.u8[1]==PRS1B_FUN_ARG || mode.u8[1]==PRS1B_LOCAL_VAR) {
-pvl_restart3:
- switch (PrsKeyWord(cc)) {
- case KW_REG:
- tmpm->reg=REG_ALLOC;
- LexPopNoRestore(cc);
- LexPush(cc);
- if (Lex(cc)==TK_IDENT) {
- k=DefineMatch(cc->cur_str,"ST_U64_REGS");
- if (k>=0) {
- tmpm->reg=k;
- LexPopNoRestore(cc);
- LexPush(cc);
- Lex(cc);
- }
- }
- goto pvl_restart3;
- case KW_NOREG:
- tmpm->reg=REG_NONE;
- LexPopNoRestore(cc);
- LexPush(cc);
- Lex(cc);
- goto pvl_restart3;
- }
- }
- tmpm->member_class=PrsType(cc,&tmpc1,&mode,tmpm,&tmpm->str,
- &tmpm->fun_ptr,NULL,&tmpm->dim,0);
- if (tmpm->fun_ptr)
- tmpm->flags|=MLF_FUN;
- if (first)
- MemberAdd(cc,tmpm,tmpc,mode.u8[1]);
- else
- MemberAdd(cc,tmpm,tmpc,PRS1B_NULL);
- tmpc->member_cnt++;
-
- tmpc2=tmpm->member_class;
- i=tmpc2->size*tmpm->dim.total_cnt;
- switch (mode.u8[1]) {
- case PRS1B_STATIC_LOCAL_VAR:
- if (i<0) {
- i=0;
- undef_array_size=TRUE;
- } else
- undef_array_size=FALSE;
- if (mode&PRSF_UNION)
- LexExcept(cc,"Static unions are not implemented ");
- k=(i+7)&~7;
- if (cc->flags&CCF_AOT_COMPILE)
- tmpm->static_data=MAlloc(k);
- else
- tmpm->static_data=MAlloc(k,Fs->code_heap);
- if (cc->flags&CCF_AOT_COMPILE) {
- tmpm->static_data_rip=cc->aotc->rip;
- k>>=3;
- while (k--)
- AOTStoreCodeU64(cc,0);
- } else
- if (sys_var_init_flag)
- MemSet(tmpm->static_data,sys_var_init_val,k);
- LexPopNoRestore(cc);
- if (cc->token=='=') {
- cc->flags=cc->flags&
- ~CCF_DONT_MAKE_RES|old_flags&CCF_DONT_MAKE_RES;
- if (undef_array_size) {
- LexPush(cc);
- LexPush(cc);
- Lex(cc); //skip =
- PrsStaticInit(cc,tmpm,1);
- LexPopNoRestore(cc);
- i=tmpc2->size*tmpm->dim.total_cnt;
- k=(i+7)&~7;
- if (cc->flags&CCF_AOT_COMPILE) {
- k>>=3;
- while (k--)
- AOTStoreCodeU64(cc,0);
- } else
- if (sys_var_init_flag)
- MemSet(tmpm->static_data,sys_var_init_val,k);
- LexPopRestore(cc);
- }
- LexPush(cc);
- Lex(cc); //skip =
- PrsStaticInit(cc,tmpm,2);
- LexPopNoRestore(cc);
- if (cc->flags&CCF_AOT_COMPILE)
- for (k=0;k<i;k++)
- AOTStoreCodeU8At(cc,tmpm->static_data_rip+k,
- tmpm->static_data[k]);
- tmpm->use_cnt=0;
- cc->flags|=CCF_DONT_MAKE_RES;
- }
- if (cc->flags&CCF_AOT_COMPILE)
- Free(tmpm->static_data);
- break;
- case PRS1B_LOCAL_VAR:
- if (mode&PRSF_UNION) {
- if (union_base-tmpc->size<i)
- i=union_base-i-tmpc->size;
- else
- i=0;
- }
- if (i>=8)
- tmpc->size=(tmpc->size-i)&~7;
- else if (i>=4)
- tmpc->size=(tmpc->size-i)&~3;
- else if (i>=2)
- tmpc->size=(tmpc->size-i)&~1;
- else
- tmpc->size-=i;
- tmpm->offset=tmpc->size;
- tmpm->size=i;
- if (cc->token=='=') {
- cc->flags=cc->flags&~CCF_DONT_MAKE_RES|
- old_flags&CCF_DONT_MAKE_RES;
- LexPopRestore(cc);
- Lex(cc);
- if (!PrsExpression(cc,NULL,TRUE))
- throw('Compiler');
- tmpm->use_cnt=0;
- cc->flags|=CCF_DONT_MAKE_RES;
- } else
- LexPopNoRestore(cc);
- break;
- case PRS1B_FUN_ARG:
- if (mode&PRSF_UNION) {
- tmpm->offset=union_base;
- if (tmpc->size-union_base<8)
- tmpc->size=8+union_base;
- } else {
- tmpm->offset=tmpc->size;
- tmpc->size+=8;
- }
- tmpm->size=8;
- if (cc->token=='=') {
- Lex(cc);
- if (PrsKeyWord(cc)==KW_LASTCLASS) {
- tmpm->flags|=MLF_LASTCLASS;
- Lex(cc);
- } else {
- old_flags2=cc->flags;
- cc->flags&=~CCF_HAS_MISC_DATA;
- machine_code=LexExpression2Bin(cc,&type);
- if (!machine_code)
- throw('Compiler');
- tmpm->dft_val=Call(machine_code);
- tmpc2=OptClassFwd(tmpc2);
- if (tmpc2->raw_type==RT_F64) {
- if (type!=RT_F64)
- tmpm->dft_val(F64)=tmpm->dft_val;
- } else {
- if (type==RT_F64)
- tmpm->dft_val=tmpm->dft_val(F64);
- }
- if (cc->flags & CCF_HAS_MISC_DATA) {
- tmpm->dft_val=StrNew(tmpm->dft_val);
- tmpm->flags|=MLF_STR_DFT_AVAILABLE;
- }
- Free(machine_code);
- cc->flags|=old_flags2&CCF_HAS_MISC_DATA;
- }
- tmpm->flags|=MLF_DFT_AVAILABLE;
- }
- LexPopNoRestore(cc);
- break;
- case PRS1B_CLASS:
- if (mode&PRSF_UNION) {
- tmpm->offset=union_base;
- if (tmpc->size-union_base<i)
- tmpc->size=i+union_base;
- } else {
- tmpm->offset=tmpc->size;
- tmpc->size+=i;
- }
- tmpm->size=i;
- if (mode&PRSF_UNION)
- cc->class_dol_offset=union_base;
- else
- cc->class_dol_offset=tmpc->size;
-
- while (cc->token==TK_IDENT) {
- tmp_meta=MAlloc(sizeof(CMemberLstMeta));
- tmp_meta->next=tmpm->meta;
- tmpm->meta=tmp_meta;
- tmp_meta->str=cc->cur_str;
- tmp_meta->flags=0;
- cc->cur_str=NULL;
- if (Lex(cc)==TK_STR) {
- tmp_meta->user_data=LexExtStr(cc);
- tmp_meta->flags|=MLMF_IS_STR;
- } else
- tmp_meta->user_data=LexExpression(cc);
- }
- LexPopNoRestore(cc);
- break;
- }
- switch (cc->token) {
- case ',':
- if (mode.u8[1]==PRS1B_FUN_ARG && !(mode&PRSF_UNION))
- Lex(cc);
- else {
- first=FALSE;
- goto pvl_restart2;
- }
- break;
- case ')':
- case '}':
- Lex(cc);
- goto pvl_done;
- case ';':
- cc->flags=cc->flags&~CCF_DONT_MAKE_RES|
- old_flags&CCF_DONT_MAKE_RES;
- Lex(cc);
- cc->flags|=CCF_DONT_MAKE_RES;
- if ((mode.u8[1]==PRS1B_LOCAL_VAR||mode.u8[1]==
- PRS1B_STATIC_LOCAL_VAR) && !(mode&PRSF_UNION))
- goto pvl_done;
- break;
- default:
- LexExcept(cc,"Missing ';' at");
- }
- }
- }
-pvl_done:
- cc->flags=cc->flags&~(CCF_CLASS_DOL_OFFSET|CCF_DONT_MAKE_RES)|
- old_flags&(CCF_CLASS_DOL_OFFSET|CCF_DONT_MAKE_RES);
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/Templates.HC.HTML b/public/src/Compiler/Templates.HC.HTML deleted file mode 100644 index 493902b..0000000 --- a/public/src/Compiler/Templates.HC.HTML +++ /dev/null @@ -1,524 +0,0 @@ - - - - - Templates.HC - - - - - asm {
-//************************************
-CMP_TEMPLATES::
- DU32 @@05,@@10,@@15,@@25,@@30,
- @@35,@@40,@@45,@@55,@@60,
- @@75,@@80,@@85,@@90,@@95,
- @@100,@@105,@@110,@@120,@@130;
-
-@@05: //INC
- PUSH RAX
- FLD1
- FADD ST0,U64 [RSP]
- FSTP U64 [RSP]
- POP RAX
-
-@@10: //DEC
- PUSH RAX
- FLD1
- FSUBR ST0,U64 [RSP]
- FSTP U64 [RSP]
- POP RAX
-
-@@15: //MOD
- PUSH RDX
- PUSH RAX
- MOV RBX,RSP
- FLD U64 [RBX]
- FLD U64 8[RBX]
-@@20: FPREM
- FSTSW
- TEST AX,0x400
- JNZ @@20
- FSTP U64 [RBX]
- FFREE ST0
- FINCSTP
- POP RAX
- ADD RSP,8
-
-@@25: //LESS
- PUSH RDX
- PUSH RAX
- FLD U64 [RSP]
- FLD U64 8[RSP]
- FCOMIP ST0,ST1
- MOV RAX,0
- ADC RAX,0
- FFREE ST0
- FINCSTP
- ADD RSP,16
-
-@@30: //GREATER
- PUSH RDX
- PUSH RAX
- FLD U64 8[RSP]
- FLD U64 [RSP]
- FCOMIP ST0,ST1
- MOV RAX,0
- ADC RAX,0
- FFREE ST0
- FINCSTP
- ADD RSP,16
-
-@@35: //LESS_EQU
- PUSH RDX
- PUSH RAX
- FLD U64 8[RSP]
- FLD U64 [RSP]
- FCOMIP ST0,ST1
- MOV RAX,1
- SBB RAX,0
- FFREE ST0
- FINCSTP
- ADD RSP,16
-
-@@40: //GREATER_EQU
- PUSH RDX
- PUSH RAX
- FLD U64 [RSP]
- FLD U64 8[RSP]
- FCOMIP ST0,ST1
- MOV RAX,1
- SBB RAX,0
- FFREE ST0
- FINCSTP
- ADD RSP,16
-
-@@45: //StrLen
- MOV RDX,RAX
-@@50: MOV BL,U8 [RAX]
- INC RAX
- TEST BL,BL
- JNZ @@50
- SUB RAX,RDX
- DEC RAX
-
-@@55: //RDTSC
- RDTSC
- SHL RDX,32
- ADD RAX,RDX
-
-@@60: //SignI64
- TEST RAX,RAX
- JZ @@70
- JS @@65
- MOV RAX,1
- JMP @@70
-@@65: MOV RAX,-1
-@@70:
-@@75:
-@@80:
-@@85: //Sqr
- PUSH RAX
- FLD U64 [RSP]
- FMUL ST0,ST0
- FSTP U64 [RSP]
- POP RAX
-
-@@90: //Abs
- PUSH RAX
- FLD U64 [RSP]
- FABS
- FSTP U64 [RSP]
- POP RAX
-
-@@95: //Sqrt
- PUSH RAX
- FLD U64 [RSP]
- FSQRT
- FSTP U64 [RSP]
- POP RAX
-
-@@100: //Sin
- PUSH RAX
- FLD U64 [RSP]
- FSIN
- FSTP U64 [RSP]
- POP RAX
-
-@@105: //Cos
- PUSH RAX
- FLD U64 [RSP]
- FCOS
- FSTP U64 [RSP]
- POP RAX
-
-@@110: //Tan
- PUSH RAX
- FLD U64 [RSP]
-@@115: FPTAN
- FSTSW
- TEST AX,0x400
- JNZ @@115
- FFREE ST0
- FINCSTP
- FSTP U64 [RSP]
- POP RAX
-
-@@120: //Atan
- PUSH RAX
- FLD U64 [RSP]
- FLD1
-@@125: FPATAN
- FSTSW
- TEST AX,0x400
- JNZ @@125
- FSTP U64 [RSP]
- POP RAX
-
-@@130:
-
-//************************************
-CMP_TEMPLATES_DONT_POP::
- DU32 @@05,@@10,@@15,@@20,@@25,
- @@30,@@35,@@40,@@45,@@50,
- @@55,@@60,@@65,@@70,@@75,
- @@80,@@85,@@90,@@100,@@110;
-
-@@05: //INC
- PUSH RAX
- FLD1
- FADD ST0,U64 [RSP]
- FST U64 [RSP]
- POP RAX
-
-@@10: //DEC
- PUSH RAX
- FLD1
- FSUBR ST0,U64 [RSP]
- FST U64 [RSP]
- POP RAX
-
-@@15:
-@@20:
-@@25:
-@@30:
-@@35:
-@@40:
-@@45:
-@@50:
-@@55:
-@@60:
- PUSH RAX
- FLD U64 [RSP]
- ADD RSP,8
-
-@@65: //Sqr
- PUSH RAX
- FLD U64 [RSP]
- FMUL ST0,ST0
- ADD RSP,8
-
-@@70: //Abs
- PUSH RAX
- FLD U64 [RSP]
- FABS
- ADD RSP,8
-
-@@75: //Sqrt
- PUSH RAX
- FLD U64 [RSP]
- FSQRT
- ADD RSP,8
-
-@@80: //Sin
- PUSH RAX
- FLD U64 [RSP]
- FSIN
- ADD RSP,8
-
-@@85: //Cos
- PUSH RAX
- FLD U64 [RSP]
- FCOS
- ADD RSP,8
-
-@@90: //Tan
- PUSH RAX
- FLD U64 [RSP]
-@@95: FPTAN
- FSTSW
- TEST AX,0x400
- JNZ @@95
- FFREE ST0
- FINCSTP
- ADD RSP,8
-
-@@100: //Atan
- PUSH RAX
- FLD U64 [RSP]
- FLD1
-@@105: FPATAN
- FSTSW
- TEST AX,0x400
- JNZ @@105
- ADD RSP,8
-@@110:
-
-//************************************
-CMP_TEMPLATES_DONT_PUSH::
- DU32 @@05,@@10,@@15,@@20,@@30,
- @@35,@@40,@@50,@@55,@@60,
- @@65,@@70,@@75,@@80,@@85,
- @@90,@@95,@@100,@@110,@@120;
-
-@@05: //INC
- SUB RSP,8
- FLD1
- FADDP ST1,ST0
- FSTP U64 [RSP]
- POP RAX
-
-@@10: //DEC
- SUB RSP,8
- FLD1
- FSUBP ST1,ST0
- FSTP U64 [RSP]
- POP RAX
-
-@@15:
-@@20: //LESS
- PUSH RAX
- FLD U64 [RSP]
- FCOMIP ST0,ST1
- MOV RAX,0
- JZ @@25
- MOV RAX,1
- SBB RAX,0
-@@25: FFREE ST0
- FINCSTP
- ADD RSP,8
-
-@@30: //GREATER
- PUSH RAX
- FLD U64 [RSP]
- FCOMIP ST0,ST1
- MOV RAX,0
- ADC RAX,0
- FFREE ST0
- FINCSTP
- ADD RSP,8
-
-@@35: //LESS_EQU
- PUSH RAX
- FLD U64 [RSP]
- FCOMIP ST0,ST1
- MOV RAX,1
- SBB RAX,0
- FFREE ST0
- FINCSTP
- ADD RSP,8
-
-@@40: //GREATER_EQU
- PUSH RAX
- FLD U64 [RSP]
- FCOMIP ST0,ST1
- MOV RAX,1
- JZ @@45
- MOV RAX,0
- ADC RAX,0
-@@45: FFREE ST0
- FINCSTP
- ADD RSP,8
-@@50:
-@@55:
-@@60:
-@@65: //FSTP
- SUB RSP,8
- FSTP U64 [RSP]
- POP RAX
-@@70:
-@@75: //Sqr
- SUB RSP,8
- FMUL ST0,ST0
- FSTP U64 [RSP]
- POP RAX
-
-@@80: //Abs
- SUB RSP,8
- FABS
- FSTP U64 [RSP]
- POP RAX
-
-@@85: //Sqrt
- SUB RSP,8
- FSQRT
- FSTP U64 [RSP]
- POP RAX
-
-@@90: //Sin
- SUB RSP,8
- FSIN
- FSTP U64 [RSP]
- POP RAX
-
-@@95: //Cos
- SUB RSP,8
- FCOS
- FSTP U64 [RSP]
- POP RAX
-
-@@100: //Tan
- SUB RSP,8
-@@105: FPTAN
- FSTSW
- TEST AX,0x400
- JNZ @@105
- FFREE ST0
- FINCSTP
- FSTP U64 [RSP]
- POP RAX
-
-@@110: //Atan
- SUB RSP,8
- FLD1
-@@115: FPATAN
- FSTSW
- TEST AX,0x400
- JNZ @@115
- FSTP U64 [RSP]
- POP RAX
-@@120:
-
-//************************************
-CMP_TEMPLATES_DONT_PUSH_POP::
- DU32 @@05,@@10,@@15,@@20,@@25,
- @@30,@@35,@@40,@@45,@@50,
- @@55,@@60,@@65,@@70,@@75,
- @@80,@@85,@@90,@@95,@@105;
-
-@@05: //INC
- SUB RSP,8
- FLD1
- FADDP ST1,ST0
- FST U64 [RSP]
- POP RAX
-
-@@10: //DEC
- SUB RSP,8
- FLD1
- FSUBP ST1,ST0
- FST U64 [RSP]
- POP RAX
-
-@@15:
-@@20:
-@@25:
-@@30:
-@@35:
-@@40:
-@@45:
-@@50:
-@@55:
-@@60:
-@@65: //Sqr
- FMUL ST0,ST0
-
-@@70: //Abs
- FABS
-
-@@75: //Sqrt
- FSQRT
-
-@@80: //Sin
- FSIN
-
-@@85: //Cos
- FCOS
-
-@@90: //Tan
- FPTAN
- FSTSW
- TEST AX,0x400
- JNZ @@90
- FFREE ST0
- FINCSTP
-
-@@95: //Atan
- FLD1
-@@100: FPATAN
- FSTSW
- TEST AX,0x400
- JNZ @@100
-@@105:
-
-//************************************
-CMP_TEMPLATES_DONT_PUSH2::
- DU32 @@05,@@10,@@15,@@20,@@25,
- @@35,@@45,@@50,@@55,@@60,
- @@65,@@70,@@75,@@80,@@85,
- @@90,@@95,@@100,@@105,@@110;
-
-@@05:
-@@10:
-
-@@15:
-@@20: //LESS
- PUSH RAX
- FLD U64 [RSP]
- FCOMIP ST0,ST1
- MOV RAX,0
- ADC RAX,0
- FFREE ST0
- FINCSTP
- ADD RSP,8
-
-@@25: //GREATER
- PUSH RAX
- FLD U64 [RSP]
- FCOMIP ST0,ST1
- MOV RAX,0
- JZ @@30
- MOV RAX,1
- SBB RAX,0
-@@30: FFREE ST0
- FINCSTP
- ADD RSP,8
-
-@@35: //LESS_EQU
- PUSH RAX
- FLD U64 [RSP]
- FCOMIP ST0,ST1
- MOV RAX,1
- JZ @@40
- MOV RAX,0
- ADC RAX,0
-@@40: FFREE ST0
- FINCSTP
- ADD RSP,8
-
-@@45: //GREATER_EQU
- PUSH RAX
- FLD U64 [RSP]
- FCOMIP ST0,ST1
- MOV RAX,1
- SBB RAX,0
- FFREE ST0
- FINCSTP
- ADD RSP,8
-@@50:
-@@55:
-@@60:
-@@65:
-@@70:
-@@75:
-@@80:
-@@85:
-@@90:
-@@95:
-@@100:
-@@105:
-@@110:
-}
- - - \ No newline at end of file diff --git a/public/src/Compiler/UAsm.HC.HTML b/public/src/Compiler/UAsm.HC.HTML deleted file mode 100644 index 9a0f279..0000000 --- a/public/src/Compiler/UAsm.HC.HTML +++ /dev/null @@ -1,694 +0,0 @@ - - - - - UAsm.HC - - - - - I64 InstEntriesCompare(CInst *tmpins1,CInst *tmpins2)
-{
- I64 i1,i2,j=0,res=0,oc_cnt1=tmpins1->opcode_cnt,oc_cnt2=tmpins2->opcode_cnt;
- if (tmpins1->flags&IEF_STI_LIKE)
- oc_cnt1--;
- if (tmpins2->flags&IEF_STI_LIKE)
- oc_cnt2--;
- while (TRUE) {
- if (j<oc_cnt1 && j<oc_cnt2) {
- if (res=tmpins1->opcode[j]-tmpins2->opcode[j])
- return res;
- j++;
- } else {
- if (res=oc_cnt1-oc_cnt2)
- return res;
-
- if (tmpins1->flags&IEF_STI_LIKE && tmpins2->flags&IEF_STI_LIKE)
- return tmpins1->opcode[j]-tmpins2->opcode[j];
-
- if (res=tmpins1->flags&IEF_STI_LIKE - tmpins2->flags&IEF_STI_LIKE)
- return res;
-
- if (res=tmpins1->slash_val-tmpins2->slash_val)
- return res;
-
- if (res=tmpins1->flags&IEF_OP_SIZE32 - tmpins2->flags&IEF_OP_SIZE32)
- return res;
-
- i1=Bt(&uasm.ins64_arg_mask,tmpins1->arg1) ||
- Bt(&uasm.ins64_arg_mask,tmpins1->arg2);
- i2=Bt(&uasm.ins64_arg_mask,tmpins2->arg1) ||
- Bt(&uasm.ins64_arg_mask,tmpins2->arg2);
- if (res=i1-i2)
- return res;
-
- if (res=tmpins1->flags&IEF_48_REX - tmpins2->flags&IEF_48_REX)
- return res;
-
- i1=tmpins1->arg2==ARGT_IMM64 || tmpins1->arg2==ARGT_UIMM64;
- i2=tmpins2->arg2==ARGT_IMM64 || tmpins2->arg2==ARGT_UIMM64;
- return i1-i2;
- }
- }
-}
-
-/*
-U0 DumpUAsmIns(CInst *tmpins)
-{
- CHashOpcode *tmpo=tmpins(U8 *)-tmpins->ins_entry_num*sizeof(CInst)
- -offset(CHashOpcode.ins);
- "%10s:%02d,%02d SV:%02d\n",tmpo->str,
- tmpins->arg1,tmpins->arg2,tmpins->slash_val;
-}
-U0 DumpUAsmTables()
-{
- I64 k;
- "16/32 Bit Table\n";
- for (k=0;k<uasm.table_16_32_entries;k++)
- DumpUAsmIns(uasm.table_16_32[k]);
- "\n\n\n\n64 Bit Table\n";
- for (k=0;k<uasm.table_64_entries;k++)
- DumpUAsmIns(uasm.table_64[k]);
-}
-*/
-
-CInst *InstEntryFind(U8 *rip,I64 opsize,I64 seg_size)
-{//Binary Search
- I64 i,j,n,m,k,arg1,arg2,o1,o2,oc_cnt;
- CInst *tmpins,**table;
- i=0;
- if (seg_size==64) {
- table=uasm.table_64;
- j=uasm.table_64_entries-1;
- } else {
- table=uasm.table_16_32;
- j=uasm.table_16_32_entries-1;
- }
- while (TRUE) {
- k=(i+j)>>1; //binary search
- tmpins=table[k];
-//DumpUAsmIns(tmpins);
- m=0;
- n=0;
- while (TRUE) { //ief_compare_start
- arg1=tmpins->arg1;
- arg2=tmpins->arg2;
- oc_cnt=tmpins->opcode_cnt;
- if (tmpins->flags&IEF_STI_LIKE)
- oc_cnt--;
- if (n<oc_cnt) {
- o1=rip[n];
- if (n==tmpins->opcode_cnt-1 && tmpins->flags & IEF_PLUS_OPCODE)
- o1&=-8;
- o2=tmpins->opcode[n++];
- if (m=o1-o2)
- goto ief_compare_done;
- } else
- switch [tmpins->uasm_slash_val] {
- case 0...7:
- if (!(m=rip[n]>>3&7-tmpins->slash_val)) {
- if ((Bt(&uasm.mem_arg_mask,arg1) ||
- Bt(&uasm.mem_arg_mask,arg2)) &&
- rip[n]&0xC0==0xC0) {
- m=1;
- goto ief_compare_done;
- }
- if (opsize==16) {
- if (tmpins->flags & IEF_OP_SIZE32) {
- m=-1;
- goto ief_compare_done;
- }
- } else {
- if (tmpins->flags & IEF_OP_SIZE16) {
- m=1;
- goto ief_compare_done;
- }
- }
- if (opsize==64||arg1==ARGT_M64||arg2==ARGT_M64) {
- if (!Bt(&uasm.ins64_arg_mask,arg1)&&
- !Bt(&uasm.ins64_arg_mask,arg2)&&
- !(tmpins->flags&IEF_48_REX))
- m=1;
- } else {
- if (Bt(&uasm.ins64_arg_mask,arg1)||
- Bt(&uasm.ins64_arg_mask,arg2) ||
- tmpins->flags&IEF_48_REX)
- m=-1;
- }
- } else if ((Bt(&uasm.mem_arg_mask,arg1)||
- Bt(&uasm.mem_arg_mask,arg2)) &&
- rip[n]&0xC0==0xC0)
- m=1;
- goto ief_compare_done;
- case SV_I_REG:
- m=rip[n]>>3-tmpins->opcode[tmpins->opcode_cnt-1]>>3;
- goto ief_compare_done;
- case SV_STI_LIKE:
- if (!(m=rip[n]>>3-tmpins->opcode[tmpins->opcode_cnt-1]>>3))
- m=rip[n]-tmpins->opcode[tmpins->opcode_cnt-1];
- goto ief_compare_done;
- case SV_R_REG:
- case SV_NONE:
- m=0;
- if (opsize==16) {
- if (tmpins->flags & IEF_OP_SIZE32) {
- m=-1;
- goto ief_compare_done;
- }
- } else {
- if (tmpins->flags & IEF_OP_SIZE16) {
- m=1;
- goto ief_compare_done;
- }
- }
- if (opsize==64 || arg1==ARGT_M64 || arg2==ARGT_M64) {
- if (!Bt(&uasm.ins64_arg_mask,arg1) &&
- !Bt(&uasm.ins64_arg_mask,arg2) &&
- !(tmpins->flags&IEF_48_REX)&& !(arg2==ARGT_NONE &&
- (ARGT_UIMM8<=arg1<=ARGT_UIMM64 ||
- ARGT_IMM8<=arg1<=ARGT_IMM64)))
- m=1;
- else if (tmpins->arg2==ARGT_IMM64 || tmpins->arg2==ARGT_UIMM64) {
- if (arg2!=ARGT_IMM64&&arg2!=ARGT_UIMM64)
- m=1;
- } else if (arg2==ARGT_IMM64||arg2==ARGT_UIMM64)
- m=-1;
- } else {
- if (Bt(&uasm.ins64_arg_mask,arg1) ||
- Bt(&uasm.ins64_arg_mask,arg2) ||
- tmpins->flags&IEF_48_REX)
- m=-1;
- }
- goto ief_compare_done;
- }
- }
-ief_compare_done:
- if (m>0) {
- if (k==i) {
- k=j;
- break;
- } else
- i=k;
- } else if (m<0) {
- if (k-i<=1) {
- k=i;
- break;
- } else
- j=k;
- } else
- break;
- }
- return table[k];
-}
-
-U0 UAsmHashLoad()
-{
- CHashOpcode *tmph;
- CInst *tmpins;
- I64 i,j1,j2,k;
-
- uasm.ins64_arg_mask=0x0880888880+1<<ARGT_ST0+1<<ARGT_STI;
- uasm.signed_arg_mask=1<<ARGT_REL8+1<<ARGT_REL16+1<<ARGT_REL32+
- 1<<ARGT_IMM8+1<<ARGT_IMM16+1<<ARGT_IMM32+1<<ARGT_IMM64;
- uasm.mem_arg_mask=1<<ARGT_M8+1<<ARGT_M16+1<<ARGT_M32+1<<ARGT_M64;
-
- uasm.table_16_32_entries=uasm.table_64_entries=0;
- for (i=0;i<=cmp.asm_hash->mask;i++) {
- tmph=cmp.asm_hash->body[i];
- while (tmph) {
- if (tmph->type==HTT_OPCODE && !(tmph->oc_flags&OCF_ALIAS)) {
- tmpins=&tmph->ins;
- for (k=0;k<tmph->inst_entry_cnt;k++) {
- uasm.table_16_32_entries++;
- if (!(tmpins->flags&IEF_NOT_IN_64_BIT))
- uasm.table_64_entries++;
- tmpins++;
- }
- }
- tmph=tmph->next;
- }
- }
-
- j1=j2=0;
- uasm.table_16_32=MAlloc(uasm.table_16_32_entries*sizeof(U8 *));
- uasm.table_64 =MAlloc(uasm.table_64_entries *sizeof(U8 *));
- for (i=0;i<=cmp.asm_hash->mask;i++) {
- tmph=cmp.asm_hash->body[i];
- while (tmph) {
- if (tmph->type==HTT_OPCODE && !(tmph->oc_flags&OCF_ALIAS)) {
- tmpins=&tmph->ins;
- for (k=0;k<tmph->inst_entry_cnt;k++) {
- uasm.table_16_32[j1++]=tmpins;
- if (!(tmpins->flags&IEF_NOT_IN_64_BIT))
- uasm.table_64[j2++]=tmpins;
- tmpins++;
- }
- }
- tmph=tmph->next;
- }
- }
- QSortI64(uasm.table_16_32,uasm.table_16_32_entries,&InstEntriesCompare);
- QSortI64(uasm.table_64 ,uasm.table_64_entries ,&InstEntriesCompare);
-}
-
-U0 Ui(U8 *buf,U8 **_rip,I64 seg_size=64,I64 *_jmp_dst=NULL,Bool just_ins=FALSE)
-{//Unassembles one inst
- I64 i,disp,imm,opsize,opadd,
- arg1,arg2,reloced_arg1,reloced_arg2,
- arg1_size=0,arg2_size=0,reloced_arg1_size,reloced_arg2_size,
- ModrM=-1,SIB=-1,scale,r1,r2,
- Mod=-1,RM1=-1,RM2=-1,REX=-1,REX_r=0,REX_x=0,REX_b=0;
- Bool cont;
- CInst *tmpins,*tmpins2;
- CHashOpcode *tmpo;
- U8 *rip=*_rip,*ptr,*reloced_arg1_st,*reloced_arg2_st,
- *bin_data_area1,*bin_data_area2,
- line1[512],line2[512],buf2[512],arg1_st[512],
- arg2_st[512],seg_overrides[32];
-
- if (_jmp_dst) *_jmp_dst=-1;
- if (seg_size==16) {
- opsize=16;
- opadd=16;
- } else if (seg_size==32) {
- opsize=32;
- opadd=32;
- } else {
- opsize=32;
- opadd=64;
- }
- *arg1_st=0;
- *arg2_st=0;
- if (!IsRaw && PutSrcLink(rip,1,line1))
- CatPrint(line1,"\n");
- else
- *line1=0;
-
- StrPrint(line1+StrLen(line1),"%24tp ",rip);
- bin_data_area1=line1+StrLen(line1);
- for (i=0;i<6;i++)
- CatPrint(line1,"%02X",rip[i]);
- CatPrint(line1," ");
-
- StrPrint(line2,"%24tp ",rip+6);
- bin_data_area2=line2+StrLen(line2);
- for (i=6;i<12;i++)
- CatPrint(line2,"%02X",rip[i]);
-
- *seg_overrides=0;
- cont=TRUE;
- while (TRUE) {
- switch (*rip) {
- case 0x2E: if (StrLen(seg_overrides)<24)
- CatPrint(seg_overrides,"CS:"); break;
- case 0x36: if (StrLen(seg_overrides)<24)
- CatPrint(seg_overrides,"SS:"); break;
- case 0x3E: if (StrLen(seg_overrides)<24)
- CatPrint(seg_overrides,"DS:"); break;
- case 0x26: if (StrLen(seg_overrides)<24)
- CatPrint(seg_overrides,"ES:"); break;
- case 0x64: if (StrLen(seg_overrides)<24)
- CatPrint(seg_overrides,"FS:"); break;
- case 0x65: if (StrLen(seg_overrides)<24)
- CatPrint(seg_overrides,"GS:"); break;
- case OC_OP_SIZE_PREFIX:
- if (opsize==16)
- opsize=32;
- else
- opsize=16;
- break;
- case OC_ADDR_SIZE_PREFIX:
- if (opadd==16)
- opadd=32;
- else
- opadd=16;
- break;
- case 0x40...0x4F:
- if (seg_size==64) {
- REX=*rip;
- if (REX>=0x48)
- opsize=64;
- REX_b=Bt(&REX,0)<<3;
- REX_x=Bt(&REX,1)<<3;
- REX_r=Bt(&REX,2)<<3;
- break;
- } //Fall thru if !64
- default:
- cont=FALSE;
- }
- if (cont)
- rip++;
- else
- break;
- }
-
- tmpins=InstEntryFind(rip,opsize,seg_size);
- if (opsize==32 && seg_size==64) {
- tmpins2=InstEntryFind(rip,64,seg_size);
- if (tmpins2!=tmpins && tmpins2->flags&IEF_REX_ONLY_R8_R15 ||
- tmpins2->flags&IEF_REX_XOR_LIKE&& rip[1]>>3&7==rip[1]&7)
- tmpins=tmpins2;
- }
-
- rip+=tmpins->opcode_cnt;
- tmpo=tmpins(U8 *)-tmpins->ins_entry_num*sizeof(CInst)
- -offset(CHashOpcode.ins);
- if (just_ins)
- *line1=0;
- CatPrint(line1,tmpo->str);
-
- arg1=tmpins->arg1;
- arg2=tmpins->arg2;
-
- if (arg1_size=tmpins->size1) {
- if (Bt(&uasm.signed_arg_mask,arg1))
- CatPrint(arg1_st,"I%d ",arg1_size);
- else
- CatPrint(arg1_st,"U%d ",arg1_size);
- }
-
- if (arg2_size=tmpins->size2) {
- if (Bt(&uasm.signed_arg_mask,arg2))
- CatPrint(arg2_st,"I%d ",arg2_size);
- else
- CatPrint(arg2_st,"U%d ",arg2_size);
- }
-
- if (tmpins->flags & IEF_PLUS_OPCODE) {
- rip--;
- RM1=*rip++ - tmpins->opcode[tmpins->opcode_cnt-1]+REX_b;
- ptr=NULL;
- if (ARGT_R8<=arg1<=ARGT_R64) {
- if (arg1_size==8) {
- if (REX!=-1)
- ptr="ST_U8_REX_REGS";
- else
- ptr="ST_U8_REGS";
- } else if (arg1_size==16)
- ptr="ST_U16_REGS";
- else if (arg1_size==32)
- ptr="ST_U32_REGS";
- else if (arg1_size==64)
- ptr="ST_U64_REGS";
- if (ptr)
- CatPrint(arg1_st,"%Z",RM1,ptr);
- } else {
- if (arg2_size==8) {
- if (REX!=-1)
- ptr="ST_U8_REX_REGS";
- else
- ptr="ST_U8_REGS";
- } else if (arg2_size==16)
- ptr="ST_U16_REGS";
- else if (arg2_size==32)
- ptr="ST_U32_REGS";
- else if (arg2_size==64)
- ptr="ST_U64_REGS";
- if (ptr)
- CatPrint(arg2_st,"%Z",RM1,ptr);
- }
- }
-
- if (ARGT_RM8<=arg1<=ARGT_RM64 || ARGT_M8<=arg1<=ARGT_M64 ||
- ARGT_RM8<=arg2<=ARGT_RM64 || ARGT_M8<=arg2<=ARGT_M64) {
- if (ARGT_RM8<=arg2<=ARGT_RM64 || ARGT_M8<=arg2<=ARGT_M64) {
- reloced_arg1=arg2;
- reloced_arg2=arg1;
- reloced_arg1_size=arg2_size;
- reloced_arg2_size=arg1_size;
- reloced_arg1_st=arg2_st;
- reloced_arg2_st=arg1_st;
- } else {
- reloced_arg1=arg1;
- reloced_arg2=arg2;
- reloced_arg1_size=arg1_size;
- reloced_arg2_size=arg2_size;
- reloced_arg1_st=arg1_st;
- reloced_arg2_st=arg2_st;
- }
-
- CatPrint(reloced_arg1_st,seg_overrides);
- ModrM=*rip++;
- Mod=ModrM>>6 & 3;
- RM1=ModrM & 7+REX_b;
- RM2=ModrM>>3 & 7+REX_r;
- if (Mod<3 && RM1&7==4)
- SIB=*rip++;
- if (Mod==1) {
- disp=*rip(U8 *)++;
- CatPrint(reloced_arg1_st,"%02X",disp);
- } else if (Mod==2) {
- disp=*rip(U32 *)++;
- CatPrint(reloced_arg1_st,"%08X",disp);
- }
- if (tmpins->slash_val<8)
- RM2=-1;
- else {
- ptr=NULL;
- if (reloced_arg2==ARGT_SREG) {
- if (RM2<=5)
- ptr="ST_SEG_REGS";
- } else if (!(ARGT_IMM8<=reloced_arg2<=ARGT_IMM64) &&
- !(ARGT_UIMM8<=reloced_arg2<=ARGT_UIMM64)) {
- if (reloced_arg2_size==8) {
- if (REX!=-1)
- ptr="ST_U8_REX_REGS";
- else
- ptr="ST_U8_REGS";
- } else if (reloced_arg2_size==16)
- ptr="ST_U16_REGS";
- else if (reloced_arg2_size==32)
- ptr="ST_U32_REGS";
- else if (reloced_arg2_size==64)
- ptr="ST_U64_REGS";
- }
- if (ptr)
- CatPrint(reloced_arg2_st,"%Z",RM2,ptr);
- }
- if (RM1&7==5 && !Mod) {
- disp=*rip(I32 *)++;
- if (seg_size==64) {
- disp+=rip;
- if (reloced_arg2==ARGT_IMM8 || reloced_arg2==ARGT_UIMM8)
- disp++;
- else if (reloced_arg2==ARGT_IMM16 || reloced_arg2==ARGT_UIMM16)
- disp+=2;
- else if (reloced_arg2==ARGT_IMM32 || reloced_arg2==ARGT_UIMM32)
- disp+=4;
- else if (reloced_arg2==ARGT_IMM64 || reloced_arg2==ARGT_UIMM64)
- disp+=8;
- }
- CatPrint(reloced_arg1_st,"[%X]",disp);
- RM1=-1;
- } else {
- if (Mod<3) {
- if (RM1&7==4) {
- RM1=-1;
- r1=SIB & 7+REX_b;
- r2=SIB>>3 & 7+REX_x;
- scale=SIB>>6 &3;
- if (scale==3)
- scale=8;
- else if (scale==2)
- scale=4;
- else if (scale==1)
- scale=2;
- else
- scale=1;
- if (seg_size==64)
- ptr="ST_U64_REGS";
- else
- ptr="ST_U32_REGS";
- if (r1==REG_RBP && !Mod) {
- disp=*rip(U32 *)++;
- CatPrint(reloced_arg1_st,"%08X[%Z*%d]",disp,r2,ptr,scale);
- } else if (r2==4)
- CatPrint(reloced_arg1_st,"[%Z]",r1,ptr);
- else
- CatPrint(reloced_arg1_st,"[%Z+%Z*%d]",r1,ptr,r2,ptr,scale);
- } else {
- if (opadd==16)
- ptr="ST_U16_REGS";
- else if (opadd==32)
- ptr="ST_U32_REGS";
- else
- ptr="ST_U64_REGS";
- CatPrint(reloced_arg1_st,"[%Z]",RM1,ptr);
- }
- } else {
- ptr=NULL;
- if (reloced_arg1_size==8) {
- if (REX!=-1)
- ptr="ST_U8_REX_REGS";
- else
- ptr="ST_U8_REGS";
- } else if (reloced_arg1_size==16)
- ptr="ST_U16_REGS";
- else if (reloced_arg1_size==32)
- ptr="ST_U32_REGS";
- else if (reloced_arg1_size==64)
- ptr="ST_U64_REGS";
- if (ptr)
- CatPrint(reloced_arg1_st,DefineSub(RM1,ptr));
- }
- }
- }
-
- switch (arg1) {
- case ARGT_IMM8:
- case ARGT_UIMM8:
- imm=*rip(U8 *)++;
- CatPrint(arg1_st,"%02X",imm);
- if (tmpins->opcode[0]==0xCD && (ptr=DefineSub(imm,"ST_INT_NAMES")))
- CatPrint(arg1_st,"%s",ptr);
- break;
- case ARGT_IMM16:
- case ARGT_UIMM16:
- CatPrint(arg1_st,"%04X",*rip(U16 *)++);
- break;
- case ARGT_IMM32:
- case ARGT_UIMM32:
- CatPrint(arg1_st,"%08X",*rip(U32 *)++);
- break;
- case ARGT_IMM64:
- case ARGT_UIMM64:
- CatPrint(arg1_st,"%016X",*rip(I64 *)++);
- break;
- start:
- case ARGT_REL8:
- disp=*rip(I8 *)++;
- break;
- case ARGT_REL16:
- disp=*rip(I16 *)++;
- break;
- case ARGT_REL32:
- disp=*rip(I32 *)++;
- break;
- end:
- disp+=rip;
- if (IsDbgMode)
- CatPrint(arg1_st,"%p ",disp);
- else if (PutSrcLink(disp,512,buf2))
- CatPrint(arg1_st,"%s ",buf2);
- else
- CatPrint(arg1_st,"%P ",disp);
- if (_jmp_dst) *_jmp_dst=disp;
- break;
- case ARGT_MOFFS8...ARGT_MOFFS64:
- CatPrint(arg1_st,seg_overrides);
- if (arg1_size==8)
- disp=*rip(U8 *)++;
- else if (opadd==16)
- disp=*rip(U16 *)++;
- else
- disp=*rip(U32 *)++;
- CatPrint(arg1_st,"[%X]",disp);
- break;
- case ARGT_AL ... ARGT_DX:
- case ARGT_SS ... ARGT_ST0:
- CatPrint(arg1_st,"%z",arg1-ARGT_AL,
- "AL\0AX\0EAX\0RAX\0CL\0DX\0\0\0SS\0DS\0ES\0FS\0GS\0CS\0ST0\0");
- break;
- case ARGT_STI:
- rip--;
- CatPrint(arg1_st,"%Z",*rip++ - tmpins->opcode[tmpins->opcode_cnt-1],
- "ST_FSTK_REGS");
- break;
- }
-
- switch (arg2) {
- case ARGT_IMM8:
- case ARGT_UIMM8:
- CatPrint(arg2_st,"%02X",*rip(U8 *)++);
- break;
- case ARGT_IMM16:
- case ARGT_UIMM16:
- CatPrint(arg2_st,"%04X",*rip(U16 *)++);
- break;
- case ARGT_IMM32:
- case ARGT_UIMM32:
- CatPrint(arg2_st,"%08X",*rip(U32 *)++);
- break;
- case ARGT_IMM64:
- case ARGT_UIMM64:
- CatPrint(arg2_st,"%016X",*rip(I64 *)++);
- break;
- case ARGT_MOFFS8...ARGT_MOFFS64:
- CatPrint(arg2_st,seg_overrides);
- if (arg2_size==8)
- disp=*rip(U8 *)++;
- else if (opadd==16)
- disp=*rip(U16 *)++;
- else
- disp=*rip(U32 *)++;
- CatPrint(arg2_st,"[%X]",disp);
- break;
- case ARGT_AL ... ARGT_DX:
- case ARGT_SS ... ARGT_ST0:
- CatPrint(arg2_st,"%z",arg2-ARGT_AL,
- "AL\0AX\0EAX\0RAX\0CL\0DX\0\0\0SS\0DS\0ES\0FS\0GS\0CS\0ST0\0");
- break;
- case ARGT_STI:
- rip--;
- CatPrint(arg2_st,"%Z",*rip++ -tmpins->opcode[tmpins->opcode_cnt-1],
- "ST_FSTK_REGS");
- break;
- }
- if (tmpins->flags&IEF_ENDING_ZERO)
- rip++;
-
- if (*arg1_st)
- CatPrint(line1,"\t%s",arg1_st);
- if (*arg2_st)
- CatPrint(line1,",%s",arg2_st);
- CatPrint(line1,"\n");
- CatPrint(line2,"\n");
- if (!just_ins) {
- for (i=rip-(*_rip)(I64);i<6;i++) {
- bin_data_area1[i<<1]=CH_SPACE;
- bin_data_area1[i<<1+1]=CH_SPACE;
- }
- for (i=rip-(*_rip)(I64);i<12;i++) {
- bin_data_area2[(i-6)<<1]=CH_SPACE;
- bin_data_area2[(i-6)<<1+1]=CH_SPACE;
- }
- }
- StrCpy(buf,line1);
- if (!just_ins && rip-(*_rip)(I64)>6)
- CatPrint(buf,line2);
- *_rip=rip;
-}
-
-U8 *U(U8 *rip,I64 cnt=20,I64 seg_size=64)
-{//Unassembles a num of insts.
- I64 i;
- U8 buf[1024];
- if (seg_size==16)
- PrintWarn("16-bit unassembly is not well supported.\n");
- "$HL,1$";
- for (i=0;i<cnt;i++) {
- Ui(buf,&rip,seg_size);
- "%s",buf;
- }
- "$HL,0$";
- return rip;
-}
-
-I64 Un(U8 *rip,I64 cnt=0x80,I64 seg_size=64)
-{//Unassembles a num of bytes
- I64 i=0;
- U8 buf[1024],*end_rip=rip(I64)+cnt;
- if (seg_size==16)
- PrintWarn("16-bit unassembly is not well supported.\n");
- "$HL,1$";
- while (rip<end_rip) {
- Ui(buf,&rip,seg_size);
- "%s",buf;
- i++;
- }
- "$HL,0$";
- return i;
-}
- - - \ No newline at end of file diff --git a/public/src/Demo/AcctExample/HomeKeyPlugIns.HC.HTML b/public/src/Demo/AcctExample/HomeKeyPlugIns.HC.HTML deleted file mode 100644 index cfe3284..0000000 --- a/public/src/Demo/AcctExample/HomeKeyPlugIns.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - HomeKeyPlugIns.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/AcctExample/HomeLocalize.HC.HTML b/public/src/Demo/AcctExample/HomeLocalize.HC.HTML deleted file mode 100644 index eb804ab..0000000 --- a/public/src/Demo/AcctExample/HomeLocalize.HC.HTML +++ /dev/null @@ -1,33 +0,0 @@ - - - - - HomeLocalize.HC - - - - - //Place this file in /Home and change
-//anything you want.
-
-Option(OPTf_WARN_PAREN,ON);
-Option(OPTf_WARN_DUP_TYPES,ON);
-
-KbdTypeMatic(0);
-
-// Las Vegas is -7 during summer, -8 during winter
-local_time_offset=-7*60*60*CDATE_FREQ; //Pacific
-// Remember you can set the time in the BIOS.
-
-//$AN,"",A="mouse_move_scale"$adjust these to set mouse move scale
-ms_hard.scale.x=0.5;
-ms_hard.scale.y=0.5;
-ms_hard.scale.z=5.0; //wheel
-
-//don't change these
-ms_hard.prescale.x=ms_hard.pos.x/ms_hard.scale.x;
-ms_hard.prescale.y=ms_hard.pos.y/ms_hard.scale.y;
-ms_hard.prescale.z=ms_hard.pos.z/ms_hard.scale.z;
- - - \ No newline at end of file diff --git a/public/src/Demo/AcctExample/HomeSys.HC.HTML b/public/src/Demo/AcctExample/HomeSys.HC.HTML deleted file mode 100644 index 3a2e2e2..0000000 --- a/public/src/Demo/AcctExample/HomeSys.HC.HTML +++ /dev/null @@ -1,59 +0,0 @@ - - - - - HomeSys.HC - - - - - //Place this file in /Home and change
-//anything you want.
-
-U0 UserStartUp()
-{//Run each time a user a spawned
- DocTermNew;
- Type("::/Doc/Start.DD");
- LBts(&Fs->display_flags,DISPLAYf_SHOW);
- WinToTop;
- WinZBufUpdate;
- Dir;
- "$TX,"82,150",D="DD_TEMPLEOS_LOC"$LOC:";
- CPURep;
-}
-
-U0 SrvStartUp()
-{//Run each time a srv task is spawned.
- DocTermNew;
- LBts(&Fs->display_flags,DISPLAYf_SHOW);
- WinToTop;
- WinZBufUpdate;
-}
-
-CTask *user1,*user2;
-
-U0 StartUpTasks()
-{
- user1=User;
- user2=User;
- WinToTop(user1);
- WinTileVert;
- "BootTime:%7.3fs\n",tS;
- XTalk(user1,"Cd;#include \"Once\";\n");
- Silent;
- ACInit("/*;!*/Bible.TXT*;!*.TXT"); //No Bible, no uncompressed DD.
- Silent(OFF);
- "AutoComplete Time:%7.3fs\n",tS;
-}
-
-if (DrvIsWritable(':')) {
- DelTree("::/Tmp/ScrnShots");
- DirMk("::/Tmp/ScrnShots");
-}
-
-StartUpTasks;
-
-"\nTempleOS V%5.3f\t%D %T\n\n",sys_os_version,sys_compile_time,sys_compile_time;
- - - \ No newline at end of file diff --git a/public/src/Demo/AcctExample/HomeWrappers.HC.HTML b/public/src/Demo/AcctExample/HomeWrappers.HC.HTML deleted file mode 100644 index c1ef21d..0000000 --- a/public/src/Demo/AcctExample/HomeWrappers.HC.HTML +++ /dev/null @@ -1,47 +0,0 @@ - - - - - HomeWrappers.HC - - - - - #help_index "Cmd Line (Typically)"
-
-#define FILEMASK_OFF_LIMITS "!*/Misc/PCIDevices.DD*;!*/Misc/Bible.TXT*;"\
- "!*/Books?/*;!*/Sup1/Sup1Words/*;!*/Sup1/Sup1Bin/*;"\
- "!*/God/Vocab.DD*"
-
-public I64 F(U8 *needle_str,U8 *fu_flags=NULL)
-{//Find text in all text files.
- return Find(needle_str,"/*",fu_flags);
-}
-
-public I64 F2(U8 *needle_str,U8 *fu_flags=NULL)
-{//Find text in most text files.
- return Find(needle_str,"/*;" FILEMASK_OFF_LIMITS,fu_flags);
-}
-
-public I64 R(U8 *needle_str,U8 *replace_text=NULL,U8 *fu_flags="+l-i")
-{//Find text and replace in most text files.
- return Find(needle_str,"/*;" FILEMASK_OFF_LIMITS,fu_flags,replace_text);
-}
-
-public I64 FD(U8 *needle_str,U8 *fu_flags=NULL)
-{//Find text in cur dir text files.
- return Find(needle_str,"*",fu_flags);
-}
-
-public I64 FD2(U8 *needle_str,U8 *fu_flags=NULL)
-{//Find text in most cur dir text files.
- return Find(needle_str,"*;" FILEMASK_OFF_LIMITS,fu_flags);
-}
-
-public I64 RD(U8 *needle_str,U8 *replace_text=NULL,U8 *fu_flags="+l-i")
-{//Find text and replace in most cur dir text files.
- return Find(needle_str,"*;" FILEMASK_OFF_LIMITS,fu_flags,replace_text);
-}
- - - \ No newline at end of file diff --git a/public/src/Demo/AcctExample/MakeHome.HC.HTML b/public/src/Demo/AcctExample/MakeHome.HC.HTML deleted file mode 100644 index 7e0a132..0000000 --- a/public/src/Demo/AcctExample/MakeHome.HC.HTML +++ /dev/null @@ -1,28 +0,0 @@ - - - - - MakeHome.HC - - - - - Cd(__DIR__);;
-
-//If these are not present in /Home, it uses the version in the root dir. You
-//can make your own, modified, version of these files in your /Home directory.
-#include "~/HomeLocalize"
-#include "/Adam/Opt/Boot/MakeBoot"
-#include "/Adam/Opt/Utils/MakeUtils"
-#include "~/HomeWrappers"
-MapFileLoad("::/Kernel/Kernel");
-MapFileLoad("::/Compiler/Compiler");
-
-#include "::/Apps/Psalmody/Load"
-#include "~/TOS/MakeTOS"
-#include "~/HomeKeyPlugIns"
-#include "~/HomeSys"
-Cd("..");;
- - - \ No newline at end of file diff --git a/public/src/Demo/AcctExample/Once.HC.HTML b/public/src/Demo/AcctExample/Once.HC.HTML deleted file mode 100644 index f1b40d8..0000000 --- a/public/src/Demo/AcctExample/Once.HC.HTML +++ /dev/null @@ -1,51 +0,0 @@ - - - - - Once.HC - - - - - //Place this file in /Home and change
-//anything you want.
-
-//This file is executed by the
-//first terminal window upon start-up.
-//See $LK,"Once",A="FF:/Home/HomeSys.HC,Once"$ and Home Files.
-
-// Type("::/Doc/Customize.DD");
-
-U0 Tmp()
-{
- OnceExe;
- switch (sys_boot_src.u16[0]) {
- case BOOT_SRC_DVD:
- "\nIf you answer 'No' you can play with\n"
- "the live CD without installing.\n\n"
- "Install onto hard drive ";
- if (YorN) {
- DocBottom;
- if (RunFile("::/Misc/OSInstall",,FALSE)) {
- Del("C:/Home/DoDistro.HC.Z");
- Del("D:/Home/DoDistro.HC.Z");
- OnceDrv('C',"\"\n\nRun TOSStaffIns;\n\n\n\";");
- OnceDrv('D',""); //This command uses cached Registry file.
- if (PressAKey!=CH_SHIFT_ESC)
- Reboot; //Too dangerous for amateurs until reboot.
- }
- }
- break;
- }
- if (FileFind("D:/Tmp/Logs/access.log")) {
- In("\n\n%C",CH_ESC);
- RunFile("::/Demo/WebLogDemo/WebLogRep",,
- "D:/Tmp/Logs/*.log","D:/Home/WebLogRep.DD");
- Del("D:/Tmp/Logs/*.log");
- }
-}
-
-Tmp;
- - - \ No newline at end of file diff --git a/public/src/Demo/AcctExample/Registry.HC.HTML b/public/src/Demo/AcctExample/Registry.HC.HTML deleted file mode 100644 index 3ab9f30..0000000 --- a/public/src/Demo/AcctExample/Registry.HC.HTML +++ /dev/null @@ -1,93 +0,0 @@ - - - - - Registry.HC - - - - - $TR-UL,"Adam"$
-
$TR,"SysMsgFlags"$
-$ID,2$sys_msg_flags[0]=0xFF;
-
$TR,"SysRegVer"$
-
registry_version=5.030;
-
$TR,"InsReg"$
-
#help_index "Registry/Install Registration"
-MemSet(&ins_reg,0,sizeof(CInsReg));
-ins_reg.registered=1;
-ins_reg.host_os=2;
-ins_reg.host_vm=2;
-
-#define INS_REG_PERSONAL_INITIALS "TAD"
-StrCpy(ins_reg.initials,"TAD");
-HashPublic("INS_REG_PERSONAL_INITIALS",HTT_DEFINE_STR);
-
-#define INS_REG_MACHINE_NUM 0
-ins_reg.machine_num=0;
-HashPublic("INS_REG_MACHINE_NUM",HTT_DEFINE_STR);
-
-"InsReg:%s:%d\n",INS_REG_PERSONAL_INITIALS,INS_REG_MACHINE_NUM;
-
-#help_index ""
-
$ID,-2$TR-UL,"TempleOS"$
-
$TR,"EagleDive"$
-$ID,2$F64 best_score=147.6932;
-
$TR,"DiningStars"$
-
F64 best_score=9999.0000;
-
$TR,"CircleTrace"$
-
F64 best_score=4.9425;
-
$TR,"BlackDiamond"$
-
I64 best_score=2;
-
$TR,"DunGen"$
-
F64 best_score=20.5295;
-
$TR,"CastleFrankenstein"$
-
F64 best_score=33.8405;
-
$TR,"ZoneOut"$
-
F64 best_score=8.1373;
-
$TR,"Varoom"$
-
F64 best_score=46.2643;
-
$TR,"FlapBat"$
-
F64 best_score=16.3077;
-
$TR,"RawHide"$
-
F64 best_score=96.1279;
-
$TR,"KeepAway"$
-
I64 best_score0=68,best_score1=30;
-
$TR,"Wenceslas"$
-
F64 best_score=43.9944;
-
$TR,"OSTestSuite"$
-
progress1_tf=0.000;progress2_tf=0.000;
-progress3_tf=0.000;progress4_tf=226.523;
-
$TR,"XCaliber"$
-
I64 best_score=90;
-I64 msg_flags=2;
-
$TR,"Talons"$
-
F64 best_score=9999.0000;
-
$TR,"BomberGolf"$
-
I64 best_score=175;
-
$TR,"Titanium"$
-
I64 best_score=16469;
-
$TR,"TOSRegen"$
-
progress1_tf=0.000;progress2_tf=0.000;
-progress3_tf=0.000;progress4_tf=113.560;
-
$TR,"TempleTetris"$
-
I64 hiscore=0;
-
$ID,-2$TR,"Once"$
-
$TR,"Adam"$
-$ID,2$
$TR,"User"$
-
$ID,-2$
$TR,"DemoCompany"$
-
$TR,"Game1"$
-$ID,2$F64 best_score=189.85507;
-$TR,"SimpleVal"$
-$ID,2$1248;
-
$ID,-2$ID,-2$TR,"WalnutZone"$
-
$TR,"Cherub"$
-$ID,2$#define rom_path M:/SnailNet
-I64 sound_mode=2;
-I64 sound_enable=1;
-I64 use_keyboard=1;
-I64 use_gamepad=0;
-I64 lcd_scale=2;
-
$ID,-2$ - - \ No newline at end of file diff --git a/public/src/Demo/AcctExample/TOS/MakeTOS.HC.HTML b/public/src/Demo/AcctExample/TOS/MakeTOS.HC.HTML deleted file mode 100644 index 037a9cd..0000000 --- a/public/src/Demo/AcctExample/TOS/MakeTOS.HC.HTML +++ /dev/null @@ -1,20 +0,0 @@ - - - - - MakeTOS.HC - - - - - Cd(__DIR__);;
-
-#include "TOSExt"
-#include "TOSCfg"
-#include "TOSMisc"
-#include "TOSDistro"
-
-Cd("..");;
- - - \ No newline at end of file diff --git a/public/src/Demo/AcctExample/TOS/TOSCfg.HC.HTML b/public/src/Demo/AcctExample/TOS/TOSCfg.HC.HTML deleted file mode 100644 index f27da28..0000000 --- a/public/src/Demo/AcctExample/TOS/TOSCfg.HC.HTML +++ /dev/null @@ -1,73 +0,0 @@ - - - - - TOSCfg.HC - - - - - #help_index "Misc/TOS/Cfg"
-
-#define SLOP BLK_SIZE
-
-U0 TOSDbgDistro1()
-{
- CBinFile *bfh=mem_boot_base-sizeof(CBinFile);
- bfh(I64)+=bfh->file_size-1;
- DefinePrint("TOS_DBG_DISTRO","0x%X",
- CeilI64(SYS_KERNEL_END+SLOP,BLK_SIZE));
- DefinePrint("TOS_DBG_DISTRO_END", "0x%X",FloorI64(
- (BOOT_RAM_LIMIT-(BOOT_STK_SIZE+DVD_BOOT_LOADER_SIZE))>>4<<4-
- (bfh(I64)-SYS_KERNEL_END)-SLOP,BLK_SIZE));
- DefinePrint("CFG_DBG_DISTRO_FILE","\"/Tmp/DbgDistro.BIN.Z\"");
-} TOSDbgDistro1;
-
-U0 TOSDbgDistro2()
-{
- DefinePrint("CFG_DBG_DISTRO","\"a0x%X\n0x%X\n\"",TOS_DBG_DISTRO,
- (TOS_DBG_DISTRO_END-TOS_DBG_DISTRO)/BLK_SIZE);
- DefinePrint("CFG_DBG_DISTRO_START","\"0x%X\"",TOS_DBG_DISTRO);
-} TOSDbgDistro2;
-
-U0 TOSInit()
-{
- switch (INS_REG_MACHINE_NUM) {
- case 1: //TAD Native Machine
- DefinePrint("CFG_RAM_DRVS",
- "\"B\nScale2Mem(2048,0x100000,4*1024*1024*1024)\n\"");
- DefinePrint("CFG_HARD_DRVS","\"C\ns0xFE00\n0xFE10\n0\"");
- DefinePrint("CFG_DVD_DRVS","\"Ts0x1F0\n1\"");
- DefinePrint("CFG_DSK_CACHE","\"Scale2Mem(0x80000,0x8000000)\n\"");
- DefinePrint("TOS_HDS","\"CD\"");
- DefinePrint("TOS_MASTER_BOOT_DRVS","\"C\"");
- break;
- default:
- DefinePrint("CFG_RAM_DRVS",
- "\"B\nScale2Mem(2048,0x100000,4*1024*1024*1024)\n\"");
- DefinePrint("CFG_HARD_DRVS","\"\"");
- DefinePrint("CFG_DVD_DRVS","\"\"");
- DefinePrint("CFG_DSK_CACHE","\"Scale2Mem(0x80000,0x8000000)\n\"");
- DefinePrint("TOS_HDS","\"CD\"");
- DefinePrint("TOS_MASTER_BOOT_DRVS","\"C\"");
- }
-} TOSInit;
-
-#define TOS_ISO_NAME "B:/TOS_Distro.ISO.C"
-#define TOS_DISTRO_DIR "B:/Distro"
-#define CFG_OPTS "StaffMode\nMountIDEAuto\nCT\n"
-#define CFG_DBG_OPTS "StaffMode\nMountIDEAuto\nCT"\
- "HeapInit\n130\nMemInit\n131\nVarInit\n132\n\n"
-#define CFG_DBGZ_OPTS "StaffMode\nMountIDEAuto\nCT"\
- "HeapInit\n0\nMemInit\n0\nVarInit\n0\n\n"
-#define TOS_CFG "\n" CFG_RAM_DRVS CFG_DVD_DRVS CFG_HARD_DRVS "\n"\
- CFG_DSK_CACHE CFG_OPTS
-#define TOS_DVD_CFG "TB\n0x20000\nT\n\n\nStaffMode\nMountIDEAuto\nCT\n"
-#define TOS_DVD_DBG_CFG "A" CFG_DBG_DISTRO\
- "B\nScale2Mem(2048,0x40000)\n\n\n"\
- "NoMP\nTextMode\nDontProbe\nDbgDistro\n"\
- "C:" CFG_DBG_DISTRO_FILE "\n"\
- CFG_DBG_DISTRO_START "\n\n"
- - - \ No newline at end of file diff --git a/public/src/Demo/AcctExample/TOS/TOSDistro.HC.HTML b/public/src/Demo/AcctExample/TOS/TOSDistro.HC.HTML deleted file mode 100644 index 0aca01d..0000000 --- a/public/src/Demo/AcctExample/TOS/TOSDistro.HC.HTML +++ /dev/null @@ -1,399 +0,0 @@ - - - - - TOSDistro.HC - - - - - //The CFG defines are ~/TOS/TOSCfg.HC.
-
-#help_index "Misc/TOS/Distro"
-
-#define MAKE_LITE 1
-#define MAKE_DBG 0
-#define MAKE_STAFF 1
-
-public U8 TOSGetDrv()
-{//Pmt for drv let.
- I64 res;
- "Drive (%s):",TOS_HDS;
- res=Let2Let(GetChar);
- '\n';
- return res;
-}
-
-public U0 TOSBootHDIns(U8 drv_let=0)
-{//Make Compiler and Kernel. Reinstall Kernel.
- drv_let=Let2Let(drv_let);
- In(TOS_CFG);
- BootHDIns(drv_let);
- if (StrOcc(TOS_MASTER_BOOT_DRVS,drv_let))
- BootMHDIns(drv_let);
-}
-
-public U0 TOSCopyDrv(U8 src,U8 dst)
-{//Fmt dst and copy entire drv.
- U8 buf_s[STR_LEN],buf_d[STR_LEN];
- src=Let2Let(src);
- dst=Let2Let(dst);
-
- if (dst=='D')
- Fmt(dst,,FALSE,FSt_FAT32);
- else
- Fmt(dst,,FALSE,FSt_REDSEA);
-
- StrPrint(buf_s,"%c:/",src);
- StrPrint(buf_d,"%c:/",dst);
- CopyTree(buf_s,buf_d);
-
- DocClear;
- Drv(dst);
- TOSBootHDIns(dst);
-}
-
-public U0 TOSPmtAndCopyDrv()
-{//Pmt for drv lets. Then, Fmt dst and copy entire drv.
- I64 src,dst;
- "$RED$\nCopy Src Drive:\n$FG$";
- src=TOSGetDrv;
- "$RED$\nCopy Dst Drive:\n$FG$";
- dst=TOSGetDrv;
- TOSCopyDrv(src,dst);
-}
-
-U0 DistroPrep()
-{
- AOnceFlush; //Don't want in Registry
- OnceFlush;
-
- Del("/Home/Demo*");
- DelTree("/Home/*Tmp.DD.Z");
-
- DelTree("/Tmp");
- DirMk("/Tmp");
- DirMk("/Tmp/ScrnShots");
-
- Touch("/PersonalMenu.DD.Z","+T");
- Touch("/Home/PersonalMenu.DD.Z","+T");
-
- DelTree("/Demo/AcctExample");
- CopyTree("/Home","/Demo/AcctExample");
- DelTree("/Demo/AcctExample/TAD");
- DelTree("/Demo/AcctExample/Sup1");
- DelTree("/Demo/AcctExample/Sup2");
- DelTree("/Demo/AcctExample/Sup3");
- Del("/Demo/AcctExample/Test*");
- if (FileFind("~/Sup1/Sup1Utils/SortHeaders.HC.Z"))
- ExeFile("~/Sup1/Sup1Utils/SortHeaders.HC.Z");
-
- CursorRem("/*");
- DelTree("/Demo/*.BI*");
- S2T("/*","+r+S");
- DocOpt("/*","+R");
- Move(ACD_DEF_FILENAME,ACD_DEF_FILENAME_Z);
-}
-
-U0 DbgDistroFilePrep()
-{
- CBlkDev *bd;
- if (!Let2Drv('A',FALSE)) {
- In(CFG_DBG_DISTRO "\n");
- Mount;
- }
- bd=Let2BlkDev('A');
- Fmt('A',,FALSE,FSt_REDSEA);
-
- DirMk("A:/Compiler");
- Copy("C:/Compiler/Compiler.BIN.Z", "A:/Compiler");
- Copy("C:/Compiler/OpCodes.DD.Z", "A:/Compiler");
- Copy("C:/Compiler/CompilerA.HH.Z", "A:/Compiler");
- Copy("C:/Compiler/CompilerB.HH.Z", "A:/Compiler");
-
- DirMk("A:/Kernel");
- Copy("C:/Kernel/*.HH*", "A:/Kernel");
- CopyTree("C:/Kernel/BlkDev", "A:/Kernel/BlkDev");
-
- Copy("C:/Home/Sup1/Sup1Distro/DbgStartOS.HC.Z","A:/StartOS.HC.Z");
-
- DirMk("A:/Adam");
- Copy("C:/Home/Sup1/Sup1Distro/DbgMakeAdam.HC.Z","A:/Adam/MakeAdam.HC.Z");
- Copy("C:/Home/Sup1/Sup1Distro/DbgMount.HC.Z","A:/Adam");
- Copy("C:/Adam/AExts.HC.Z", "A:/Adam");
- Copy("C:/Adam/AMath.HC.Z", "A:/Adam");
- Copy("C:/Adam/Training.HC.Z","A:/Adam");
- Copy("C:/Adam/AMem.HC.Z", "A:/Adam");
- Copy("C:/Adam/TaskRep.HC.Z", "A:/Adam");
-
- FileWrite("C:" CFG_DBG_DISTRO_FILE,
- bd->RAM_dsk,(bd->max_blk+1)<<BLK_SIZE_BITS);
-}
-
-
-U0 StdDistroPrep()
-{
- Drv('C');
- DistroPrep;
- In(STD_DISTRO_DVD_CFG);
- BootDVDIns('C');
- Fmt('B',,FALSE,FSt_REDSEA);
- DelTree(TOS_DISTRO_DIR);
- CopyTree("C:/",TOS_DISTRO_DIR "/");
- DelTree(TOS_DISTRO_DIR "/Home");
- DirMk(TOS_DISTRO_DIR "/Home");
- Del(TOS_DISTRO_DIR "/" KERNEL_BIN_C);
- Del(TOS_DISTRO_DIR BOOT_DIR "/OldMBR.BIN.C");
- Del(TOS_DISTRO_DIR BOOT_DIR "/BootMHD2.BIN.C");
-}
-U0 MakeStdDistro()
-{
- StdDistroPrep;
- RedSeaISO(TOS_ISO_NAME,TOS_DISTRO_DIR,TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
- DefinePrint("DD_TEMPLEOSCD_SIZE",
- "Download $TX,"TempleOS V5.03",D="DD_OS_NAME_VERSION"$ - Standard Distro (%0.1fMB)",
- 0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
- Drv('C');
-}
-
-U0 LiteDistroPrep()
-{
- Drv('C');
- DistroPrep;
- In(STD_DISTRO_DVD_CFG);
- BootDVDIns('C');
- Fmt('B',,FALSE,FSt_REDSEA);
- DelTree(TOS_DISTRO_DIR);
- CopyTree("C:/",TOS_DISTRO_DIR "/");
- DelTree(TOS_DISTRO_DIR "/Home");
- DirMk(TOS_DISTRO_DIR "/Home");
- DelTree(TOS_DISTRO_DIR "/Apps");
- DelTree(TOS_DISTRO_DIR "/Demo");
- Copy(TOS_DISTRO_DIR "/Demo/Games/Talons.HC.Z",TOS_DISTRO_DIR "/Home");
- Del(TOS_DISTRO_DIR "/" KERNEL_BIN_C);
- Del(TOS_DISTRO_DIR BOOT_DIR "/OldMBR.BIN.C");
- Del(TOS_DISTRO_DIR BOOT_DIR "/BootMHD2.BIN.C");
- Del(TOS_DISTRO_DIR "/Adam/AutoComplete/ACDefs.DATA.Z");
- Del(TOS_DISTRO_DIR "/Adam/AutoComplete/ACWords.DATA.Z");
- Del(TOS_DISTRO_DIR "/Misc/Bible.TXT.Z");
-}
-U0 MakeLiteDistro()
-{
- LiteDistroPrep;
- RedSeaISO(TOS_ISO_NAME,TOS_DISTRO_DIR,TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
- DefinePrint("DD_TEMPLEOSCD_SIZE",
- "Download $TX,"TempleOS V5.03",D="DD_OS_NAME_VERSION"$ - Standard Distro (%0.1fMB)",
- 0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
- Drv('C');
-}
-
-U0 DbgDistroPrep()
-{
- Drv('C');
- DistroPrep;
- DbgDistroFilePrep;
- In(TOS_DVD_DBG_CFG);
- BootDVDIns('C');
- Fmt('B',,FALSE,FSt_REDSEA);
- DelTree(TOS_DISTRO_DIR);
- CopyTree("C:/",TOS_DISTRO_DIR "/");
- DelTree(TOS_DISTRO_DIR "/Home");
- DirMk(TOS_DISTRO_DIR "/Home");
- Del(TOS_DISTRO_DIR "/" KERNEL_BIN_C);
- Del(TOS_DISTRO_DIR BOOT_DIR "/OldMBR.BIN.C");
- Del(TOS_DISTRO_DIR BOOT_DIR "/BootMHD2.BIN.C");
-}
-U0 MakeDbgDistro()
-{
- DbgDistroPrep;
- RedSeaISO(TOS_ISO_NAME,TOS_DISTRO_DIR,TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
- DefinePrint("DD_TEMPLEOS_DBG_SIZE",
- "Download $TX,"TempleOS V5.03",D="DD_OS_NAME_VERSION"$ - Debug Distro (%0.1fMB)",
- 0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
- Drv('C');
-}
-
-U0 StaffDistroPrep()
-{
- Drv('C');
- DistroPrep;
- In(TOS_DVD_CFG);
- BootDVDIns('C');
- Fmt('B',,FALSE,FSt_REDSEA);
- DelTree(TOS_DISTRO_DIR);
- CopyTree("C:/",TOS_DISTRO_DIR "/");
- DelTree(TOS_DISTRO_DIR "/Home/Sup1");
- DelTree(TOS_DISTRO_DIR "/Home/Sup2");
- DelTree(TOS_DISTRO_DIR "/Home/Sup3");
- Del(TOS_DISTRO_DIR "/" KERNEL_BIN_C);
-}
-U0 MakeStaffDistro()
-{
- StaffDistroPrep;
- RedSeaISO(TOS_ISO_NAME,TOS_DISTRO_DIR,TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
- DefinePrint("DD_TEMPLEOS_STAFF_SIZE",
- "Download $TX,"TempleOS V5.03",D="DD_OS_NAME_VERSION"$ - T.S. Company Internal Distro (%0.1fMB)",
- 0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
- Drv('C');
-}
-
-I64 UpdateLineCnts()
-{
- I64 res;
-
- DocClear;
- Drv('C');
- DistroPrep;
-
- Cd("C:/");
- DelTree("B:/TOS/TOS");
- CopyTree("C:/Home","B:/TOS/TOS");
- DelTree("C:/Home");
-
- DocMax;
- DocClear;
- res=LineRep("C:/*","-r")+LineRep("C:/Adam/*")+
- LineRep("C:/Compiler/*","-S+$")+LineRep("C:/Kernel/*");
- CopyTree("B:/TOS/TOS","C:/Home");
- DelTree("B:/TOS/TOS");
-
- DocTreeFWrite("C:/Adam/ADefine.HC.Z","LineRep",
- "DefinePrint(\"DD_TEMPLEOS_LOC\",\"%,d\");\n",res);
- DefinePrint("DD_TEMPLEOS_LOC","%,d",res);
-
- "Total LOC:%12,d\n\n",res;
- return res;
-}
-
-U0 UpdateISODocDefines()
-{
- try {
- DefinePrint("DD_TEMPLEOSCD_SIZE",
- "Download $TX,"TempleOS V5.03",D="DD_OS_NAME_VERSION"$ - Standard Distro (%0.1fMB)",
- 0.1*(10*Size("D:/Downloads/TOS_Distro.ISO","+s")/1024/1024));
- DefinePrint("DD_TEMPLEOSCD_K_SIZE",
- "%dKB",Size("D:/Downloads/TOS_Distro.ISO","+s")/1024);
- } catch
- Fs->catch_except=TRUE;
-}
-UpdateISODocDefines;
-
-
-I64 tos_progress;
-F64 tos_progress_t0;
-
-U0 TOSProgress(U8 *st)
-{
- U8 buf[STR_LEN];
- progress4=tos_progress;
- progress3_max=1;
- *progress4_desc=0;
- progress4_max=9+MAKE_LITE+MAKE_DBG+MAKE_STAFF;
- progress4_t0=tos_progress_t0;
- StrPrint(buf,"%d. %s",++progress4,st);
- "$PURPLE$$TX+CX,\"%s\"$$FG$\n",buf;
- StrCpy(progress3_desc,buf);
- tos_progress=progress4;
-}
-
-U0 TOSRegen2()
-{
- I64 slash_home=0;
- SettingsPush; //See SettingsPush
- tos_progress=-1;
- tos_progress_t0=tS;
- RegExe("TempleOS/TOSRegen");
-
- TOSProgress("DskChk All");
- AutoComplete;
- WinBorder;
- WinMax;
- DskChkAll;
-
- TOSProgress("Update Line Cnts");
- UpdateLineCnts;
-
- TOSProgress("Copy C to D");
- TOSCopyDrv('C','D');
-
- TOSProgress("Make Standard Distro ISO");
- MakeStdDistro;
- DocClear;
- Move(TOS_ISO_NAME,"D:/Downloads/TOS_Distro.ISO");
-
- TOSProgress("Make Supplemental1 ISO");
- RedSeaISO("D:/Downloads/TOS_Supplemental1","C:/Home/Sup1");
-
- TOSProgress("Make Supplemental2 ISO");
- RedSeaISO("D:/Downloads/TOS_Supplemental2","C:/Home/Sup2");
-
- TOSProgress("Make Supplemental3 ISO");
- RedSeaISO("D:/Downloads/TOS_Supplemental3","C:/Home/Sup3");
-
-#if MAKE_LITE
- TOSProgress("Make Lite Distro ISO");
- MakeLiteDistro;
- DocClear;
- Move(TOS_ISO_NAME,"D:/Downloads/TOS_Lite.ISO");
-#endif
-#if MAKE_DBG
- TOSProgress("Make Dbg Distro ISO");
- MakeDbgDistro;
- DocClear;
- Move(TOS_ISO_NAME,"D:/Downloads/TOS_Dbg.ISO");
-#endif
-#if MAKE_STAFF
- TOSProgress("Make Staff Distro ISO");
- MakeStaffDistro;
- DocClear;
- Move(TOS_ISO_NAME,"D:/Downloads/TOS_Staff.ISO");
-#endif
-
- UpdateISODocDefines;
- Cd("C:/");
- DocClear;
-
- TOSProgress("Check for Long Lines");
- if (LongLines)
- throw;
-
- DocClear;
- TOSProgress("Check for Broken DolDoc Links");
- if (LinkChk)
- throw;
-
- TOSProgress("Find /Home");
- slash_home=F2("/Home","-i+la");
-
- TOSProgress("DskChk All");
- Drv('C');
- DskChkAll;
-
- TOSProgress("Done");
- SettingsPop;
- "F2(\"/Home\") Cnt\t:%d\n",slash_home;
- "Elapsed Time\t:%5.3fs\n",tS-progress4_t0;
- ProgressBarsRst("TempleOS/TOSRegen");
-}
-
-public U0 TOSPreRegen()
-{//Copy bins from D:/Home/Sup1 to C:/Home/Sup1
- Copy("D:/Home/" INS_REG_PERSONAL_INITIALS "/*",
- "C:/Home/" INS_REG_PERSONAL_INITIALS);
- DelTree("C:/Home/Sup1/Sup1Bin");
- CopyTree("D:/Home/Sup1/Sup1Bin","C:/Home/Sup1/Sup1Bin");
- Copy("D:/Home/Sup1/Sup1CodeScraps/Comm/TOSSocket*",
- "C:/Home/Sup1/Sup1CodeScraps/Comm");
- DelTree("C:/Downloads/Linux");
- CopyTree("D:/Downloads/Linux","C:/Downloads/Linux");
-}
-
-public U0 TOSRegen()
-{//Generate distro ISO's
- TOSBootHDIns('C');
- Once("TOSRegen2;");
- BootRAM("C:/Kernel/" KERNEL_BIN_C); //Boot to load $LK,"TOS_CFG",A="PF:::/Demo/AcctExample/TOS/TOSCfg.HC,TOS_CFG"$.
-}
- - - \ No newline at end of file diff --git a/public/src/Demo/AcctExample/TOS/TOSExt.HC.HTML b/public/src/Demo/AcctExample/TOS/TOSExt.HC.HTML deleted file mode 100644 index 8cf1e54..0000000 --- a/public/src/Demo/AcctExample/TOS/TOSExt.HC.HTML +++ /dev/null @@ -1,322 +0,0 @@ - - - - - TOSExt.HC - - - - - #help_index "Misc/TOS/God;God/TOS"
-
-#define NIST_TIME_OFFSET (tos_nist_offset-local_time_offset/CDATE_FREQ)
-#define NIST_TIME_TO_SWITCH 3
-
-#define GSRC_NIST_BEACON 0
-#define GSRC_HOTBITS 1
-#define GSRC_ANU_NIST 2
-#define GSRC_GOOGLE 3
-#define GSRC_RANDOM_ORG 4
-#define GSRC_RANDOM_NUMBERS_INFO 5
-#define GSRC_PASSWORD 6
-#define GSRC_GENERATE_DATA 7
-#define GSRC_VIRTUAL_NOTARY 8
-#define GSRC_TIMER 9
-
-#define GBP_SHORT 0
-#define GBP_MEDIUM 1
-#define GBP_LONG 2
-
-class CRandExtDec5Form
-{
- I64 timestamp;
- U8 rnd0[512] format "$DA-P,A=\"5 Decimal Digits from Hex:%s\"$\n";
- U8 rnd1[512];
- U8 rnd2[512];
- U8 rnd3[512];
- U8 rnd4[512];
- U8 rnd5[512];
- U8 rnd6[512];
- U8 rnd7[512];
- U8 rnd8[512];
- U8 rnd9[512];
- U8 rndA[512];
- U8 rndB[512];
- I64 cert;
-};
-
-class CHexWordForm
-{
- I64 timestamp;
- U8 rnd0[512] format "$DA-P,A=\"Hex Word Indices#0:%s\"$\n";
- U8 rnd1[512] format "$DA-P,A=\"Hex Word Indices#1:%s\"$\n";
- U8 rnd2[512] format "$DA-P,A=\"Hex Word Indices#2:%s\"$\n";
- U8 rnd3[512] format "$DA-P,A=\"Hex Word Indices#3:%s\"$\n";
- U8 rnd4[512] format "$DA-P,A=\"Hex Word Indices#4:%s\"$\n";
- U8 rnd5[512] format "$DA-P,A=\"Hex Word Indices#5:%s\"$\n";
- U8 rnd6[512] format "$DA-P,A=\"Hex Word Indices#6:%s\"$\n";
- U8 rnd7[512] format "$DA-P,A=\"Hex Word Indices#7:%s\"$\n";
- U8 rnd8[512] format "$DA-P,A=\"Hex Word Indices#8:%s\"$\n";
- U8 rnd9[512] format "$DA-P,A=\"Hex Word Indices#9:%s\"$\n";
- U8 rndA[512] format "$DA-P,A=\"Hex Word Indices#A:%s\"$\n";
- U8 rndB[512] format "$DA-P,A=\"Hex Word Indices#B:%s\"$\n";
- I64 cert;
-};
-
-class CNISTBeaconHexWordForm
-{
- I64 timestamp format "$DA,A=\"TimeStamp:%d\"$\n";
- U8 rnd0[512] format "$DA-P,A=\"Hex Word Indices#0:%s\"$\n";
- U8 rnd1[512] format "$DA-P,A=\"Hex Word Indices#1:%s\"$\n";
- U8 rnd2[512] format "$DA-P,A=\"Hex Word Indices#2:%s\"$\n";
- U8 rnd3[512] format "$DA-P,A=\"Hex Word Indices#3:%s\"$\n";
- U8 rnd4[512] format "$DA-P,A=\"Hex Word Indices#4:%s\"$\n";
- U8 rnd5[512] format "$DA-P,A=\"Hex Word Indices#5:%s\"$\n";
- U8 rnd6[512] format "$DA-P,A=\"Hex Word Indices#6:%s\"$\n";
- U8 rnd7[512] format "$DA-P,A=\"Hex Word Indices#7:%s\"$\n";
- U8 rnd8[512] format "$DA-P,A=\"Hex Word Indices#8:%s\"$\n";
- U8 rnd9[512] format "$DA-P,A=\"Hex Word Indices#9:%s\"$\n";
- U8 rndA[512] format "$DA-P,A=\"Hex Word Indices#A:%s\"$\n";
- U8 rndB[512] format "$DA-P,A=\"Hex Word Indices#B:%s\"$\n";
- I64 cert;
-};
-
-class CRandHex5Form
-{
- I64 timestamp;
- U8 rnd0[512] format "$DA-P-TRM,LEN=5,"
- "A=\"Line (5-Digit Hex):%5s\"$\n";
- U8 rnd1[512];
- U8 rnd2[512];
- U8 rnd3[512];
- U8 rnd4[512];
- U8 rnd5[512];
- U8 rnd6[512];
- U8 rnd7[512];
- U8 rnd8[512];
- U8 rnd9[512];
- U8 rndA[512];
- U8 rndB[512];
- I64 cert;
-};
-
-class CRandHex8Form
-{
- I64 timestamp;
- U8 rnd0[512] format "$DA-P-TRM,LEN=8,"
- "A=\"Line (8-Digit Hex):%8s\"$\n";
- U8 rnd1[512];
- U8 rnd2[512];
- U8 rnd3[512];
- U8 rnd4[512];
- U8 rnd5[512];
- U8 rnd6[512];
- U8 rnd7[512];
- U8 rnd8[512];
- U8 rnd9[512];
- U8 rndA[512];
- U8 rndB[512];
- I64 cert;
-};
-
-class CMoviesForm
-{
- I64 timestamp;
- U8 rnd0[512] format "$DA-P,"
- "A=\"Movie#1-100 (2 Decimal Digits from Hex):%s\"$\n";
- U8 rnd1[512];
- U8 rnd2[512];
- U8 rnd3[512];
- U8 rnd4[512];
- U8 rnd5[512];
- U8 rnd6[512];
- U8 rnd7[512];
- U8 rnd8[512];
- U8 rnd9[512];
- U8 rndA[512];
- U8 rndB[512];
- I64 cert;
-};
-
-class CPaintings100Form
-{
- I64 timestamp;
- U8 rnd0[512] format "$DA-P,"
- "A=\"Painting#00-99 (2 Decimal Digits from Hex):%s\"$\n";
- U8 rnd1[512];
- U8 rnd2[512];
- U8 rnd3[512];
- U8 rnd4[512];
- U8 rnd5[512];
- U8 rnd6[512];
- U8 rnd7[512];
- U8 rnd8[512];
- U8 rnd9[512];
- U8 rndA[512];
- U8 rndB[512];
- I64 cert;
-};
-
-class CPaintings1000Form
-{
- I64 timestamp;
- U8 rnd0[512] format "$DA-P,"
- "A=\"Painting#000-999 (3 Decimal Digits from Hex):%s\"$\n";
- U8 rnd1[512];
- U8 rnd2[512];
- U8 rnd3[512];
- U8 rnd4[512];
- U8 rnd5[512];
- U8 rnd6[512];
- U8 rnd7[512];
- U8 rnd8[512];
- U8 rnd9[512];
- U8 rndA[512];
- U8 rndB[512];
- I64 cert;
-};
-
-class CPoems100Form
-{
- I64 timestamp;
- U8 rnd0[512] format "$DA-P,"
- "A=\"Poems#00-99 (2 Decimal Digits from Hex):%s\"$\n";
- U8 rnd1[512];
- U8 rnd2[512];
- U8 rnd3[512];
- U8 rnd4[512];
- U8 rnd5[512];
- U8 rnd6[512];
- U8 rnd7[512];
- U8 rnd8[512];
- U8 rnd9[512];
- U8 rndA[512];
- U8 rndB[512];
- I64 cert;
-};
-
-class CMetallicaForm
-{
- I64 timestamp;
- U8 rnd0[512] format "$DA-P,"
- "A=\"Song#1-99 (2 Decimal Digits from Hex):%s\"$\n";
- U8 rnd1[512];
- U8 rnd2[512];
- U8 rnd3[512];
- U8 rnd4[512];
- U8 rnd5[512];
- U8 rnd6[512];
- U8 rnd7[512];
- U8 rnd8[512];
- U8 rnd9[512];
- U8 rndA[512];
- U8 rndB[512];
- I64 cert;
-};
-
-class CCertRandDec5Form
-{
- I64 timestamp;
- U8 rnd0[512] format "$DA-P,A=\"Line (Dec):%s\"$\n";
- U8 rnd1[512];
- U8 rnd2[512];
- U8 rnd3[512];
- U8 rnd4[512];
- U8 rnd5[512];
- U8 rnd6[512];
- U8 rnd7[512];
- U8 rnd8[512];
- U8 rnd9[512];
- U8 rndA[512];
- U8 rndB[512];
- I64 cert format "$DA,A=\"Certificate:%d\"$\n";
-};
-
-class CGodVideoForm
-{
- U8 title[STR_LEN] format "$DA-P,A=\"Title:%s\"$\n";
- U8 serial[STR_LEN] format "$DA-P-TRM,LEN=11,A=\"SerialNum:%11s\"$\n";
- I64 min format "$DA,A=\"Minutes:%d\"$\n";
- I64 sec format "$DA,A=\"Seconds:%d\"$\n";
-};
-
-class CWebBibleForm
-{
- U8 tag[STR_LEN] format "$DA-P,A=\"Tag Text:%s\"$\n";
- U8 special[STR_LEN] format "$DA-P,A=\"Bible Passage:%s\"$\n";
- I64 min;
- I64 sec;
-};
-
-class CYouTubeForm
-{
- U8 tag[STR_LEN] format "$DA-P,A=\"Title:%s\"$\n";
- U8 special[STR_LEN] format "$DA-P-TRM,LEN=11,A=\"SerialNum:%11s\"$\n";
- I64 min format "$DA,A=\"Minutes:%d\"$\n";
- I64 sec format "$DA,A=\"Seconds:%d\"$\n";
-};
-
-class CImgurForm
-{
- U8 tag[STR_LEN];
- U8 special[STR_LEN] format "$DA-P,A=\"SerialNum:%s\"$\n";
- I64 min format "$DA,A=\"Width:%d\"$\n";
- I64 sec format "$DA,A=\"Height:%d\"$\n";
-};
-
-class CWikipediaForm
-{
- U8 tag[STR_LEN] format "$DA-P,A=\"Tag Text:%s\"$\n";
- U8 special[STR_LEN] format "$DA-P,A=\"Index:%s\"$\n";
- I64 min;
- I64 sec;
-};
-
-class CWebBookMarkForm
-{
- U8 tag[STR_LEN] format "$DA-P,A=\"Tag Text:%s\"$\n";
- U8 special[STR_LEN];
- I64 min;
- I64 sec;
-};
-
-DefineLstLoad("ST_FAMLY_PHOTOS","Family1_58-78\0Family2_78-86\0"
- "Family3_86-99\0Family4_99\0");
-
-class CFamilyPhotoForm
-{
- I64 volume format "$LS,D=\"ST_FAMLY_PHOTOS\"$\n";
- I64 part format "$DA,A=\"Part:%d\"$\n";
- U8 picture[STR_LEN] format "$DA-P,A=\"Picture:%s\"$\n";
- I64 width format "$GREEN$640x427 or 640x960$FG$\n"
- "$DA,A=\"Width:%d\"$\n";
- I64 height format "$DA,A=\"Height:%d\"$\n";
-};
-
-class CBlogImgForm
-{
- U8 picture[STR_LEN] format "$DA-P,A=\"Picture:%s\"$\n";
- I64 width format "$DA,A=\"Width:%d\"$\n";
- I64 height format "$DA,A=\"Height:%d\"$\n";
-};
-
-class CBlogVideoForm
-{
- U8 video[STR_LEN] format "$DA-P,A=\"Video:%s\"$\n";
- Bool big format "$CB,\"Big\"$\n";
-};
-
-extern U0 FreshenBlog();
-extern U0 GodBooksPassageU32(U32 rand_u32,U8 *files_find_mask,
- U8 *file_mask="*",I64 len=512,I64 verbosity=GBP_MEDIUM);
-extern I64 GodHeaderIns(U8 *type=NULL);
-extern U0 GodVideoDigits(U8 *title,U8 *webpage,U8 *rnd,I64 digits,U8 *filename);
-extern U0 GodVideoU32(U32 rand_u32,U8 *filename);
-extern U0 GodWebIdx(U8 *title,U8 *webpage,U8 *rnd,I64 digits,U8 *filename)
-extern U0 GodWordBatch(CHexWordForm *gm,I64 radix,I64 digits);
-extern U0 TOSBookLines(U8 *book_filename,I64 book_lines,U8 *st,I64 num_lines,
- I64 radix,Bool modulo,Bool plus_one);
-extern U0 TOSGodDoodle(I64 god_src,CNISTBeaconHexWordForm *gm=NULL);
- - - \ No newline at end of file diff --git a/public/src/Demo/AcctExample/TOS/TOSMisc.HC.HTML b/public/src/Demo/AcctExample/TOS/TOSMisc.HC.HTML deleted file mode 100644 index 94da455..0000000 --- a/public/src/Demo/AcctExample/TOS/TOSMisc.HC.HTML +++ /dev/null @@ -1,175 +0,0 @@ - - - - - TOSMisc.HC - - - - - #help_index "Misc/TOS"
-
-Bool fg_on =FALSE;
-
-I64 CopyVideo()
-{
- I64 res=0;
- Bool old_silent=Silent;
- Del("D:/Tmp/*.AU");
- Del("D:/Tmp/*.MV");
- Silent(old_silent);
- SndShift(&scrncast.snd_head,0.185);
- AUWrite("D:/Tmp/AUDIO",&scrncast.snd_head,scrncast.t0_now,scrncast.t0_tS);
- QueDel(&scrncast.snd_head,TRUE);
- GR2MV("D:/Tmp/VID%03d.MV","B:/Tmp","+d");
- return res;
-}
-
-#help_index "ScrnCast/TOS"
-U0 DelScrnShots()
-{
- Bool old_silent=Silent;
- DelTree("B:/Tmp");
- DirMk("B:/Tmp");
- Del("D:/Tmp/*.AU");
- Del("D:/Tmp/*.MV");
- Del("C:/Tmp/*.AU");
- Del("C:/Tmp/*.MV");
- Silent(old_silent);
-}
-
-public U0 FrameGrabberToggle(Bool sync_tone,Bool tos_theme,
- Bool just_audio=FALSE)
-{//The frame grabber saves GR files to B:/Tmp.
- static F64 last_time=0;
- if (tS-last_time>3.0) {
- last_time=tS;
- if (fg_on) {
- fg_on=FALSE;
- ScrnCast(OFF);
- User("CopyVideo;Exit;\n");
- } else {
- DelScrnShots;
- fg_on=TRUE;
- ScrnCast(ON,just_audio);
- if (sync_tone) {Beep;}
- if (tos_theme) {User("ExeFile(\"~/TOS/TOSTheme\");Exit;\n");}
- }
- }
-}
-
-public U0 JukeSongTAD(I64 num,I64 passes=2)
-{//Make movie of one song.
- if (!fg_on)
- FrameGrabberToggle(FALSE,FALSE);
- Sleep(200);
- JukeSongsPuppet("~/TAD/Songs",passes,num,num+1);
- if (fg_on)
- FrameGrabberToggle(FALSE,FALSE);
-}
-
-public U0 JukeSongSup(I64 vol,I64 num,I64 passes=2)
-{//Make movie of one song.
- U8 *st=MStrPrint("~/Sup%d/Sup%dHymns",vol,vol);
- if (!fg_on)
- FrameGrabberToggle(FALSE,FALSE);
- JukeSongsPuppet(st,passes,num,num+1);
- if (fg_on)
- FrameGrabberToggle(FALSE,FALSE);
- Free(st);
-}
-
-public U0 JukeLines(I64 vol,I64 start_line,I64 end_line)
-{//Make movie of many lines of songs, starting at 0.
- U8 *st=MStrPrint("~/Sup%d/Sup%dHymns",vol,vol);
- if (!fg_on)
- FrameGrabberToggle(FALSE,FALSE);
- JukeSongsPuppet(st,,start_line*5,end_line*5);
- if (fg_on)
- FrameGrabberToggle(FALSE,FALSE);
- Free(st);
-}
-
-public U0 TADHymns(I64 vol,I64 let)
-{//Make 2-lines of songs movie
- I64 line=2*(ToUpper(let)-'A');
- JukeLines(vol,line,line+2);
-}
-
-#help_index "Misc/TOS"
-public U0 DskChkAll()
-{//DskChk on C & D.
- U8 *ptr=TOS_HDS;
- while (*ptr) {
- "DskChk('%c')\n",*ptr;
- DskChk(*ptr++,TRUE);
- }
-}
-
-public CDoc *DC2Doc(CDC *dc,I64 dx=0,I64 dy=0,I64 *_total_score=NULL)
-{//Use OCR to make a text DolDoc from CDC.
- U8 byte_bit_cnts[256];
- I64 i,j,*ptr,row,col,ch,best_ch,score,best_score,
- cur_char_image,diff_image,total_score=0;
- CDoc *doc=DocNew;
-
- MemSet(byte_bit_cnts,0,sizeof(byte_bit_cnts));
- for (i=0;i<256;i++)
- for (j=0;j<7;j++)
- if (Bt(&i,j))
- byte_bit_cnts[i]++;
-
- for (row=0;row<dc->height/FONT_HEIGHT;row++) {
- for (col=0;col<dc->width/FONT_WIDTH;col++) {
-
- cur_char_image=0;
- for (i=0;i<FONT_HEIGHT;i++)
- for (j=0;j<FONT_WIDTH;j++)
- if (GrPeek(dc,col*FONT_WIDTH+j+dx,row*FONT_HEIGHT+i+dy)!=WHITE)
- LBts(&cur_char_image,i*8+j);
-
- best_score=I64_MAX;
- best_ch=0;
- ptr=&text.font[32];
- for (ch=32;ch<127;ch++) {
- diff_image=*ptr++ ^ cur_char_image;
- score=0;
- for (i=0;i<8;i++)
- score+=byte_bit_cnts[diff_image.u8[i]];
- if (score<best_score) {
- best_score=score;
- best_ch=ch;
- }
- }
- if (best_ch=='$')
- DocPrint(doc,"$$");
- else
- DocPrint(doc,"%c",best_ch);
- total_score+=best_score;
- }
- DocPrint(doc,"\n");
- }
- if (_total_score) *_total_score=total_score;
- return doc;
-}
-
-#define MEM_TEST_SIZE 1024*1024
-U0 MemTest()
-{
- U8 *b;
- while (sys_data_bp->alloced_u8s-sys_data_bp->used_u8s>0x1000000) {
- b=MAlloc(MEM_TEST_SIZE,Fs->data_heap);
- MemSet(b,0x88,MSize(b));
- "Data:%X\n",sys_data_bp->alloced_u8s-sys_data_bp->used_u8s;
- Yield;
- }
- while (sys_code_bp->alloced_u8s-sys_code_bp->used_u8s>0x1000000) {
- b=MAlloc(MEM_TEST_SIZE,Fs->code_heap);
- MemSet(b,0x88,MSize(b));
- "Code:%X\n",sys_code_bp->alloced_u8s-sys_code_bp->used_u8s;
- Yield;
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Demo/AcctExample/TOS/TOSTheme.HC.HTML b/public/src/Demo/AcctExample/TOS/TOSTheme.HC.HTML deleted file mode 100644 index 09d9cb8..0000000 --- a/public/src/Demo/AcctExample/TOS/TOSTheme.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - TOSTheme.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Asm/AsmAndC1.HC.HTML b/public/src/Demo/Asm/AsmAndC1.HC.HTML deleted file mode 100644 index 0eb3981..0000000 --- a/public/src/Demo/Asm/AsmAndC1.HC.HTML +++ /dev/null @@ -1,87 +0,0 @@ - - - - - AsmAndC1.HC - - - - - /*Asm labels can only be defined once
-in a task.<F5> will spawn a new task
-each time, so you don't get redefine
-error, like when repeatedly #including
-it from the cmd line.
-*/
-
-asm {
-//Opcodes are slightly different to make writing my x86_64 assembler easier.
-//See /Compiler/OpCodes.DD.
-
- IMPORT Beep;
-
-_BEEPS::
-//You can always clobber RAX,RBX,RCX,RDX,R8,R9. The compiler expects that.
-//See REGG_CLOBBERED and REGG_STK_TMP.
- PUSH RBP
- MOV RBP,RSP
- MOV RCX,U64 SF_ARG1[RBP] //SF_ARG1
-
-@@05: PUSH RCX
-//U0 Beep(I8 ona=62,Bool busy=FALSE)
- PUSH FALSE //Do not busy (spin) wait
- PUSH 62 //500 Hz
- CALL Beep
- POP RCX
- LOOP @@05
-
- POP RBP
- RET1 8 //Use special return. Pop one arg off of stack.
-
-//HolyC return vals are in RAX. This function has no return value.
-}
-
-//_extern binds a asm sym to a function.
-//My convention is to put an underscore
-//on C callable asm routines.
-_extern _BEEPS U0 Beeps(I64 cnt);
-
-I64 AsmAndC1()
-{
- I64 noreg i; //Normally this would be stored in a reg
-//Check by unassembling with Uf("AsmAndC1").
-
- i=GetI64("Num of beeps 1-5 (%d):",3,1,5);
- Beeps(i);
-
- asm {
-//You can clobber RAX,RBX,RCX,RDX. The compiler expects that.
-
- IMPORT Snd; //Import an not use & or don't import and use &Snd.
- MOV RCX,&i[RBP] //You can clobber RAX,RBX,RCX,RDX.
- //You better preserve the rest.
-@@05: PUSH RCX
-
- //U0 Snd(I8 ona);
- MOV RAX,RCX //ona=loop*10+50
- IMUL2 RAX,10 //TempleOS uses nonstandard opcodes
- //to avoid multiple form of the same one.
- //See /Compiler/OpCodes.DD.
- ADD RAX,40
- PUSH RAX
- CALL Snd
-
- MOV RCX,cnts.time_stamp_freq>>3 //JIT Const. Simple delay loop
-@@10: LOOP @@10
-
- POP RCX
- LOOP @@05
- }
- Snd;
- return i;
-}
-
-"Beeps:%d\n",AsmAndC1;
- - - \ No newline at end of file diff --git a/public/src/Demo/Asm/AsmAndC2.HC.HTML b/public/src/Demo/Asm/AsmAndC2.HC.HTML deleted file mode 100644 index 59d28bd..0000000 --- a/public/src/Demo/Asm/AsmAndC2.HC.HTML +++ /dev/null @@ -1,97 +0,0 @@ - - - - - AsmAndC2.HC - - - - - /*Asm labels can only be defined once
-in a task.<F5> will spawn a new task
-each time, so you don't get redefine
-error, like when repeatedly #including
-it from the cmd line.
-*/
-
-//This is to demo glbl var access.
-//Glbs defined elsewhere can accessed too, like cnts.jiffies.
-I64 glbl_ona=Freq2Ona(400),glbl_ona_step=10,glbl_ona_base=Freq2Ona(100);
-
-asm {
-//Opcodes are slightly different to make writing my x86_64 assembler easier.
-//See /Compiler/OpCodes.DD.
-
-JIFFIES_MSG: DU8 "Jiffies:",0;
-
-//See /Kernel/StrA.HC",A="FL:::/Kernel/StrA.HC,1 and /Kernel/KUtils.HC.
-
-_BEEPS2::
-//You can clobber RAX,RBX,RCX,RDX,R8,R9. The compiler expects that.
-//See REGG_CLOBBERED and REGG_STK_TMP.
- PUSH RBP
- MOV RBP,RSP
- MOV RCX,U64 SF_ARG1[RBP] //SF_ARG1
-
- PUSH U64 [&cnts.jiffies]
-
-@@05: PUSH RCX
-//U0 Beep(I8 ona=62,Bool busy=FALSE)
- PUSH FALSE //Do not busy (spin) wait
- PUSH U64 [&glbl_ona] //evaluated at run time
- CALL &Beep
- POP RCX
- LOOP @@05
-
- PUSH RSI //See REGG_LOCAL_VARS & REGG_LOCAL_NON_PTR_VARS
- MOV RSI,JIFFIES_MSG
- CALL PUT_STR
- POP RSI
-
- POP RAX
- SUB RAX,U64 [&cnts.jiffies]
- NEG RAX
- CALL PUT_HEX_U64
- MOV RAX,'\n'
- CALL PUT_CHARS
-
- POP RBP
- RET1 8
-}
-
-//My convention is to put an underscore
-//on C callable asm routines.
-_extern _BEEPS2 U0 Beeps2(I64 cnt);
-
-U0 AsmAndC2()
-{
- I64 reg R15 i;
-
- i=GetI64("$PURPLE$\n\nNum of beeps 1-5 (%d):$FG$",3,1,5);
- Beeps2(i);
-
- asm {
- LIST
-//You can clobber RAX,RBX,RCX,RDX, but preserve the rest.
- MOV RCX,R15 //You can clobber RAX,RBX,RCX,RDX. Preserve the rest.
- @@05: PUSH RCX
-
-//U0 Snd(I8 ona);
- MOV RAX,RCX //ona=loop*10+100.0Hz
- IMUL2 RAX,glbl_ona_step //Intentionally evaluated at compile time
- ADD RAX,U64 [&glbl_ona_base] //Intentionally evaluated at run time
- PUSH RAX
- CALL &Snd //We can skip IMPORT with & if JIT compiling.
- MOV RCX,cnts.time_stamp_freq>>3 //JIT Const. Simple delay loop.
-@@10: LOOP @@10
-
- POP RCX
- LOOP @@05
- }
- Snd;
-}
-
-AsmAndC2;
- - - \ No newline at end of file diff --git a/public/src/Demo/Asm/AsmAndC3.HC.HTML b/public/src/Demo/Asm/AsmAndC3.HC.HTML deleted file mode 100644 index c8c4624..0000000 --- a/public/src/Demo/Asm/AsmAndC3.HC.HTML +++ /dev/null @@ -1,35 +0,0 @@ - - - - - AsmAndC3.HC - - - - - /*Asm labels can only be defined once
-in a task.<F5> will spawn a new task
-each time, so you don't get redefine
-error, like when repeatedly #including
-it from the cmd line.
-*/
-
-U0 AsmAndC3()
-{
- I64 i;
- for (i=0;i<3;i++) {
- "Meaning of life:";
- MOV AL,0x41
- STC
- ADC AL,0 //Round-about way to make the not-special constant, 0x42.
- CALL PUT_HEX_U8
- MOV RCX,cnts.time_stamp_freq>>5 //JIT Const. Simple delay loop.
-@@1: LOOP @@1
- '\n';
- }
-}
-
-AsmAndC3;
- - - \ No newline at end of file diff --git a/public/src/Demo/Asm/AsmHelloWorld.HC.HTML b/public/src/Demo/Asm/AsmHelloWorld.HC.HTML deleted file mode 100644 index 6790690..0000000 --- a/public/src/Demo/Asm/AsmHelloWorld.HC.HTML +++ /dev/null @@ -1,62 +0,0 @@ - - - - - AsmHelloWorld.HC - - - - - /*Asm labels can only be defined once
-in a task.<F5> will spawn a new task
-each time, so you don't get redefine
-error, like when repeatedly #including
-it from the cmd line.
-
-These are many useful kernel
-routines ::/Kernel/StrA.HC
-intended to be called from
-asm.Generally, they preserve
-regs.
-
-You can call any routine you
-like, C or asm, if you import it.
-Be aware that C routines do not
-preserve RAX,RBX,RCX,RDX,R8,R9.
-When calling from the shell or
-from C, preserve all other regs.
-
-*/
-
-asm {
-//Opcodes are slightly different to make writing my x86_64 assembler easier.
-//See /Compiler/OpCodes.DD.
-
-MY_WORLD_MSG:
-//Define U8 does not put terminating zeros
-//on strings.
- DU8 "World\n",0;
-
-//My convention is to put an underscore
-//on C callable asm routines.
-_HELLO_WORLD::
- PUSH RSI //See REGG_LOCAL_VARS & REGG_LOCAL_NON_PTR_VARS
- MOV RCX,10
-@@05: MOV RAX,RCX
- CALL PUT_HEX_U8
- MOV RAX,CH_SPACE
- CALL PUT_CHARS
- MOV RAX,'Hello ' //Supports multi-byte char consts
- CALL PUT_CHARS
-//We broke it in two pieces to show different ways.
- MOV RSI,MY_WORLD_MSG
- CALL PUT_STR
- LOOP @@05
- POP RSI
- RET
-};
-
-Call(_HELLO_WORLD);
- - - \ No newline at end of file diff --git a/public/src/Demo/Asm/BuzzFizz.HC.HTML b/public/src/Demo/Asm/BuzzFizz.HC.HTML deleted file mode 100644 index 71c5116..0000000 --- a/public/src/Demo/Asm/BuzzFizz.HC.HTML +++ /dev/null @@ -1,196 +0,0 @@ - - - - - BuzzFizz.HC - - - - - #define RANGE_START 1
-#define RANGE_END 100
-
-#define FIZZ_SPAN 6
-#define BUZZ_SPAN 7
-
-asm {
-_BUZZ_FIZZ::
- PUSH RBP
- MOV RBP,RSP //Always set-up stk frame. (Stack Gets Traced)
- PUSH RSI //See REGG_LOCAL_VARS & REGG_LOCAL_NON_PTR_VARS
- PUSH RDI
- MOV RSI,FIZZ_SPAN-RANGE_START%FIZZ_SPAN+1
- MOV RDI,BUZZ_SPAN-RANGE_START%BUZZ_SPAN+1
- MOV RAX,RANGE_START
-
-@@05: CALL PUT_HEX_U64
- PUSH RAX
- MOV RAX,CH_SPACE
- CALL PUT_CHARS
-
- DEC RSI
- JNZ @@10
- MOV RAX,'FIZZ '
- CALL PUT_CHARS
- MOV RSI,FIZZ_SPAN
-
-@@10: DEC RDI
- JNZ @@15
- MOV RAX,'BUZZ '
- CALL PUT_CHARS
- MOV RDI,BUZZ_SPAN
-
-@@15: MOV RAX,'\n'
- CALL PUT_CHARS
- POP RAX
- INC RAX
- CMP RAX,RANGE_END //Actually only a 32-bit inst.
- JBE @@05
-
- POP RDI
- POP RSI
- POP RBP
- RET
-}
-
-Call(_BUZZ_FIZZ);
-
-/*
- _BUZZ_FIZZ+0x0000 55 PUSH U64 RBP
- _BUZZ_FIZZ+0x0001 488BEC MOV U64 RBP,U64 RSP
- _BUZZ_FIZZ+0x0004 56 PUSH U64 RSI
- _BUZZ_FIZZ+0x0005 57 PUSH U64 RDI
- _BUZZ_FIZZ+0x0006 BE06000000 MOV U32 ESI,U32 00000006
- _BUZZ_FIZZ+0x000B BF07000000 MOV U32 EDI,U32 00000007
- _BUZZ_FIZZ+0x0010 B801000000 MOV U32 EAX,U32 00000001
- _BUZZ_FIZZ+0x0015 E8C51F2BC0 CALL I32 PUT_HEX_U64+0x0000
- _BUZZ_FIZZ+0x001A 50 PUSH U64 RAX
- _BUZZ_FIZZ+0x001B B820000000 MOV U32 EAX,U32 00000020
- _BUZZ_FIZZ+0x0020 E81E202BC0 CALL I32 PUT_CHARS+0x0000
- _BUZZ_FIZZ+0x0025 48FFCE DEC U64 RSI
- _BUZZ_FIZZ+0x0028 7514 JNZ I8 _BUZZ_FIZZ+0x003E
- _BUZZ_FIZZ+0x002A 48B846495A5A MOV U64 RAX,I64 000000205A5A4946
- _BUZZ_FIZZ+0x0030 20000000
- _BUZZ_FIZZ+0x0034 E80A202BC0 CALL I32 PUT_CHARS+0x0000
- _BUZZ_FIZZ+0x0039 BE06000000 MOV U32 ESI,U32 00000006
- _BUZZ_FIZZ+0x003E 48FFCF DEC U64 RDI
- _BUZZ_FIZZ+0x0041 7514 JNZ I8 _BUZZ_FIZZ+0x0057
- _BUZZ_FIZZ+0x0043 48B842555A5A MOV U64 RAX,I64 000000205A5A5542
- _BUZZ_FIZZ+0x0049 20000000
- _BUZZ_FIZZ+0x004D E8F11F2BC0 CALL I32 PUT_CHARS+0x0000
- _BUZZ_FIZZ+0x0052 BF07000000 MOV U32 EDI,U32 00000007
- _BUZZ_FIZZ+0x0057 B80A000000 MOV U32 EAX,U32 0000000A
- _BUZZ_FIZZ+0x005C E8E21F2BC0 CALL I32 PUT_CHARS+0x0000
- _BUZZ_FIZZ+0x0061 58 POP U64 RAX
- _BUZZ_FIZZ+0x0062 48FFC0 INC U64 RAX
- _BUZZ_FIZZ+0x0065 4883F864 CMP U64 RAX,I8 64
- _BUZZ_FIZZ+0x0069 76AA JNA I8 _BUZZ_FIZZ+0x0015
- _BUZZ_FIZZ+0x006B 5F POP U64 RDI
- _BUZZ_FIZZ+0x006C 5E POP U64 RSI
- _BUZZ_FIZZ+0x006D 5D POP U64 RBP
- _BUZZ_FIZZ+0x006E C3 RET
-
-0000000000000001
-0000000000000002
-0000000000000003
-0000000000000004
-0000000000000005
-0000000000000006 FIZZ
-0000000000000007 BUZZ
-0000000000000008
-0000000000000009
-000000000000000A
-000000000000000B
-000000000000000C FIZZ
-000000000000000D
-000000000000000E BUZZ
-000000000000000F
-0000000000000010
-0000000000000011
-0000000000000012 FIZZ
-0000000000000013
-0000000000000014
-0000000000000015 BUZZ
-0000000000000016
-0000000000000017
-0000000000000018 FIZZ
-0000000000000019
-000000000000001A
-000000000000001B
-000000000000001C BUZZ
-000000000000001D
-000000000000001E FIZZ
-000000000000001F
-0000000000000020
-0000000000000021
-0000000000000022
-0000000000000023 BUZZ
-0000000000000024 FIZZ
-0000000000000025
-0000000000000026
-0000000000000027
-0000000000000028
-0000000000000029
-000000000000002A FIZZ BUZZ
-000000000000002B
-000000000000002C
-000000000000002D
-000000000000002E
-000000000000002F
-0000000000000030 FIZZ
-0000000000000031 BUZZ
-0000000000000032
-0000000000000033
-0000000000000034
-0000000000000035
-0000000000000036 FIZZ
-0000000000000037
-0000000000000038 BUZZ
-0000000000000039
-000000000000003A
-000000000000003B
-000000000000003C FIZZ
-000000000000003D
-000000000000003E
-000000000000003F BUZZ
-0000000000000040
-0000000000000041
-0000000000000042 FIZZ
-0000000000000043
-0000000000000044
-0000000000000045
-0000000000000046 BUZZ
-0000000000000047
-0000000000000048 FIZZ
-0000000000000049
-000000000000004A
-000000000000004B
-000000000000004C
-000000000000004D BUZZ
-000000000000004E FIZZ
-000000000000004F
-0000000000000050
-0000000000000051
-0000000000000052
-0000000000000053
-0000000000000054 FIZZ BUZZ
-0000000000000055
-0000000000000056
-0000000000000057
-0000000000000058
-0000000000000059
-000000000000005A FIZZ
-000000000000005B BUZZ
-000000000000005C
-000000000000005D
-000000000000005E
-000000000000005F
-0000000000000060 FIZZ
-0000000000000061
-0000000000000062 BUZZ
-0000000000000063
-0000000000000064
-*/
- - - \ No newline at end of file diff --git a/public/src/Demo/Asm/DivByHand.HC.HTML b/public/src/Demo/Asm/DivByHand.HC.HTML deleted file mode 100644 index 7f80f9d..0000000 --- a/public/src/Demo/Asm/DivByHand.HC.HTML +++ /dev/null @@ -1,33 +0,0 @@ - - - - - DivByHand.HC - - - - - asm {
-_DIV_U64_BY_U64::
- PUSH RBP
- MOV RBP,RSP
- XOR RDX,RDX
- MOV RCX,64
- MOV RAX,SF_ARG1[RBP]
- MOV RBX,SF_ARG2[RBP]
-@@1: SHL1 RAX
- RCL1 RDX
- CMP RBX,RDX
- JA @@2
- INC RAX
- SUB RDX,RBX
-@@2: LOOP @@1
- POP RBP
- RET1 16
-}
-
-_extern _DIV_U64_BY_U64 I64 DivU64ByU64(I64 dividend,I64 divisor);
-
-"123456/10=%d\n",DivU64ByU64(123456,10); - - \ No newline at end of file diff --git a/public/src/Demo/Asm/MulByHand.HC.HTML b/public/src/Demo/Asm/MulByHand.HC.HTML deleted file mode 100644 index cc1f9b3..0000000 --- a/public/src/Demo/Asm/MulByHand.HC.HTML +++ /dev/null @@ -1,81 +0,0 @@ - - - - - MulByHand.HC - - - - - /*When I was a kid with a Commodore 64,
-the 6502 chip had no multiply inst
-and this is how we had to do it, except,
-I used more regs in this example.
-*/
-asm {
-//Opcodes are slightly different to make writing my x86_64 assembler easier.
-//See /Compiler/OpCodes.DD.
-
-//You can clobber RAX,RBX,RCX,RDX,R8,R9. The compiler expects that.
-
-MUL_BY_HAND_U8_U8_TO_U16: //This is only for fun.
-//8bit * 8bit-->16bit
-//AL*BL-->AX
- MOV CL,8
- SHL AX,8
-@@05: SHL1 AX
- JNC @@10
- ADD AL,BL
-@@10: DEC CL
- JNZ @@05
- RET
-
-_MUL_BY_HAND_U8_U8_TO_U16:: //C callable
- PUSH RBP
- MOV RBP,RSP
- MOV AL,U8 SF_ARG1[RBP] //SF_ARG1
- MOV BL,U8 SF_ARG2[RBP]
- CALL MUL_BY_HAND_U8_U8_TO_U16
- MOVZX RAX,AX
- POP RBP
- RET1 16
-
-_MUL_U64_U64_TO_U128::
-//64bit * 64bit-->128bit
- PUSH RBP
- MOV RBP,RSP
- MOV RBX,U64 SF_ARG3[RBP]
- MOV RAX,U64 SF_ARG1[RBP] //SF_ARG1
- MUL U64 SF_ARG2[RBP] //Res RDX:RAX 128bit
- MOV U64 [RBX],RAX
- MOV U64 8[RBX],RDX
- POP RBP
- RET1 24
-};
-
-//My convention is to put an underscore
-//on C callable asm routines.
-_extern _MUL_BY_HAND_U8_U8_TO_U16 U16 MulU8(U8 n1,U8 n2);
-
-class U128
-{
- U64 lo,hi;
-};
-
-_extern _MUL_U64_U64_TO_U128 U0 MulU64(I64 n1,I64 n2,U128 *_prod);
-
-U0 MulByHand()
-{
- U128 p;
- "2*7=0x%X\n",MulU8(2,7);
- "100*10=0x%X\n",MulU8(100,10);
-
- MulU64(0x0123456789ABCDEF,0x1000001,&p);
- "0x0123466789ABCDEF*0x1000001=0x%016X%016X\n",p.hi,p.lo;
-}
-
-MulByHand;
-
- - - \ No newline at end of file diff --git a/public/src/Demo/Asm/PutDec.HC.HTML b/public/src/Demo/Asm/PutDec.HC.HTML deleted file mode 100644 index 47a5078..0000000 --- a/public/src/Demo/Asm/PutDec.HC.HTML +++ /dev/null @@ -1,61 +0,0 @@ - - - - - PutDec.HC - - - - - asm {
-PUT_DEC_U64::
-//RAX is number to print in decimal.
-//Preserves all regs.
- PUSH RBP
- MOV RBP,RSP
- SUB RSP,24 //24 char buffer on stack
-
-//Save regs which C code is free to clobber. We don't have to for C callers,
-//but this function will be nice for ASM callers if it saves all regs.
- PUSH_C_REGS
-
- PUSH RSI //See REGG_LOCAL_VARS&REGG_LOCAL_NON_PTR_VARS
- LEA RSI,-1[RBP] //Load addr of end of buffer.
- //We picked RSI because of PUT_STR
- //We'll move bwd
- MOV U8 [RSI],0 //Terminator
-
- TEST RAX,RAX //Special case -- zero
- JNZ @@05
- DEC RSI
- MOV U8 [RSI],'0'
- JMP @@15
-
-@@05: MOV RBX,10 //Divides by 10
-
-@@10: XOR RDX,RDX
- DIV RBX //RAX=(RDX:RAX)/RBX with remainder in RDX
- ADD RDX,'0'
- DEC RSI
- MOV U8 [RSI],DL
- TEST RAX,RAX
- JNZ @@10
-
-@@15: CALL PUT_STR
- POP RSI
- POP_C_REGS
- LEAVE
- RET
-
-_DO_IT:: //The convention is C-callable routines have underscores.
- MOV RAX,122333221
- CALL PUT_DEC_U64
- MOV RAX,'\n'
- CALL PUT_CHARS
- RET
-}
-
-Call(_DO_IT);
- - - \ No newline at end of file diff --git a/public/src/Demo/Carry.HC.HTML b/public/src/Demo/Carry.HC.HTML deleted file mode 100644 index 5d59060..0000000 --- a/public/src/Demo/Carry.HC.HTML +++ /dev/null @@ -1,57 +0,0 @@ - - - - - Carry.HC - - - - - //Shows the Carry function. It holds the CPU carry flag.
-//U() Unassemble to make sure it is right.
-
-U0 BigCnt()
-{
- U64 lo=0,hi=0;
- "BigCnt\n";
- while (hi<0x10) {
- lo+=1<<58;
- hi+=Carry;
- "%016X%016X\n",hi,lo;
- }
-}
-
-BigCnt;
-
-U0 BigShift()
-{
- U64 lo=1,hi=0;
- "Big Shift\n";
- while (lo||hi) {
- hi<<=1;
- lo<<=1;
- hi+=Carry;
- "%016X%016X\n",hi,lo;
- }
-}
-
-BigShift;
-
-U0 Branch()
-{
- U64 i=0xFFCC3311,j;
- 'Branch\n';
- for (j=0;j<64;j++) {
- i<<=1;
- if (Carry)
- '1';
- else
- '0';
- }
- '\n';
-}
-
-Branch;
- - - \ No newline at end of file diff --git a/public/src/Demo/ClassMeta.HC.HTML b/public/src/Demo/ClassMeta.HC.HTML deleted file mode 100644 index 2e9c6be..0000000 --- a/public/src/Demo/ClassMeta.HC.HTML +++ /dev/null @@ -1,92 +0,0 @@ - - - - - ClassMeta.HC - - - - - /*Demonstrates class meta data.
-Basically, we make use of the compiler's
-data about a class.We can add to the
-compilers data arbitrary items, either string or
-or int or F64 (if you typecast).
-
-This stuff is not high performance.
-Don't get carried away -- it might be slow.
-*/
-
-U0 RankOut(I64 i)
-{
- " %z",i,"Cadet\0Ensign\0Captain\0Admiral\0President\0";
-}
-
-class Test1Struct
-{
- I64 age print_str "%2d" dft_val 38;
- I64 color dft_val RED; //Accepts expressions
- I64 rank print_str "%1d" dft_val 6/2 output_fun &RankOut;
-};
-
-class Test2Struct
-{
- I64 age print_str "%2d" dft_val 38 percentile 54.20;
- I64 rank print_str "%1d" dft_val 5;
- I64 serial_num print_str "%6d" dft_val 123456;
-};
-
-U0 DumpStruct(U8 *_d,U8 *class_name=lastclass)
-{//lastclass is keyword. See /Demo/LastClass.HC.
- CHashClass *tmpc=HashFind(class_name,Fs->hash_table,HTT_CLASS);
- U8 *print_str;
- I64 *q,dft_val;
- U0 (* fp_output_fun)(I64 i);
- F64 percentile;
- if (!tmpc) return;
- CMemberLst *ml;
- ml=tmpc->member_lst_and_root;
- while (ml) {
- "%s:",ml->str;
-
- //All our items are I64's. If you want, you can check
- //the data type of the member var.See ClassRep().
- q=_d+ml->offset;
-
- if (print_str=MemberMetaData("print_str",ml))
- "" print_str,*q;
-
- //This is slightly ambiguous -- if no meta is present it will return zero.
- if (dft_val=MemberMetaData("dft_val",ml))
- " default:%d",dft_val;
-
- //This corrects for the ambiguity, allowing zero percentile.
- if (MemberMetaFind("percentile",ml)) {//check if it exists
-//We could use the CMemberLstMeta structure returned by
- //MemberMetaFind() and save a search.
- percentile=MemberMetaData("percentile",ml)(F64);
- " percentile: %5.2f",percentile;
- }
-
- if (fp_output_fun=MemberMetaData("output_fun",ml))
- (*fp_output_fun)(*q);
- '\n';
- ml=ml->next;
- }
-}
-
-Test1Struct t1;
-t1.age=44;
-t1.rank=3;
-
-DumpStruct(&t1);
-
-Test2Struct t2;
-t2.age=22;
-t2.rank=2;
-t2.serial_num=55555;
-
-DumpStruct(&t2);
- - - \ No newline at end of file diff --git a/public/src/Demo/CompileDemo.HC.HTML b/public/src/Demo/CompileDemo.HC.HTML deleted file mode 100644 index beaedae..0000000 --- a/public/src/Demo/CompileDemo.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - CompileDemo.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/DateTime.HC.HTML b/public/src/Demo/DateTime.HC.HTML deleted file mode 100644 index 6428d35..0000000 --- a/public/src/Demo/DateTime.HC.HTML +++ /dev/null @@ -1,23 +0,0 @@ - - - - - DateTime.HC - - - - -
-"\n\n%D %T\n\n\n",Now,Now;
-
-CDateStruct ds;
-Date2Struct(&ds,Now+local_time_offset);
-
-"Hour:%02d Minute:%02d Second:%02d\n\n\n",ds.hour,ds.min,ds.sec;
-
-"Day Name:%03tZ\n\n\n",ds.day_of_week,"ST_DAYS_OF_WEEK";
-
-"Month Name:%03tZ\n\n\n",ds.mon-1,"ST_MONTHS";
- - - \ No newline at end of file diff --git a/public/src/Demo/DbgDemo.HC.HTML b/public/src/Demo/DbgDemo.HC.HTML deleted file mode 100644 index 2eb49d2..0000000 --- a/public/src/Demo/DbgDemo.HC.HTML +++ /dev/null @@ -1,38 +0,0 @@ - - - - - DbgDemo.HC - - - - - /*
-Press <CTRL-ALT-c> to break.
-
-Rerun Program
-
-Press <CTRL-ALT-d> to enter Dbg.
-> Dr; //Dump Regs
-> G2; //Cont program
-
-Press <CTRL-ALT-d> to enter Dbg.
-> Uf("DbgDemo");
-> U(_RIP);
-
-See Debugging
-*/
-
-U0 DbgDemo()
-{
- I64 i=0;
- while (TRUE)
- if (!(i++%2000000))
- ".";
-}
-
-DbgDemo;
-
- - - \ No newline at end of file diff --git a/public/src/Demo/Define.HC.HTML b/public/src/Demo/Define.HC.HTML deleted file mode 100644 index ef62e15..0000000 --- a/public/src/Demo/Define.HC.HTML +++ /dev/null @@ -1,48 +0,0 @@ - - - - - Define.HC - - - - - //See Define.
-
-//These might be in the Adam task.
-DefineLoad("ST_YES_NO","(Yes or No)");
-DefineLoad("ST_EXIT","Exit");
-DefineLstLoad("ST_NO_YES_LST","No\0Yes\0");
-
-//New strings might be loaded for each user
-//to override.
-
-"Spanish";
-if (YorN) {
- DefineLoad("ST_YES_NO","(Si or No)");
- DefineLoad("ST_EXIT","Salida");
- DefineLstLoad("ST_NO_YES_LST","No\0Si\0");
-}
-
-Bool Quit()
-{
- Bool res;
- U8 *st;
- I64 i;
- while (TRUE) {
- "%S %S?","ST_EXIT","ST_YES_NO";
- st=GetStr;
- i=DefineMatch(st,"ST_NO_YES_LST",LMF_IGNORE_CASE);
- if (i>=0) {
- res=i;
- break;
- }
- Free(st);
- }
- return res;
-}
-
-Quit;
- - - \ No newline at end of file diff --git a/public/src/Demo/Directives.HC.HTML b/public/src/Demo/Directives.HC.HTML deleted file mode 100644 index 31c891b..0000000 --- a/public/src/Demo/Directives.HC.HTML +++ /dev/null @@ -1,25 +0,0 @@ - - - - - Directives.HC - - - - - U0 Directives()
-{
- "Date\t:%s\n",__DATE__;
- "Time\t:%s\n",__TIME__;
- "File\t:%s\n",__FILE__;
- "Dir\t:%s\n",__DIR__;
- "Line\t:%d\n",__LINE__;
- "CmdLine\t:%d\n",__CMD_LINE__;
- "Inst1\t:%P:%08X\n",$,$;
- "Inst2\t:%P:%08X\n",$,$;
-}
-
-Directives;
- - - \ No newline at end of file diff --git a/public/src/Demo/DolDoc/CallBack.HC.HTML b/public/src/Demo/DolDoc/CallBack.HC.HTML deleted file mode 100644 index 95f58b4..0000000 --- a/public/src/Demo/DolDoc/CallBack.HC.HTML +++ /dev/null @@ -1,76 +0,0 @@ - - - - - CallBack.HC - - - - - U8 *tSCB(CDoc *,CDocEntry *,CTask *mem_task)
-{//This is called by the window mgr.
-//Things would get corrupted
- //if the window mgr used it's own
- //heap, so we use the owning task's heap.
- U8 *st=MAlloc(64,mem_task);
- CDate cdt=tS*CDATE_FREQ;
-//Doesn't have to be fixed width!!
- StrPrint(st,"%d=%T",cdt,cdt);
- return st;
-}
-
-U8 *CurTimeCB(CDoc *,CDocEntry *,CTask *mem_task)
-{
- U8 *st=MAlloc(64,mem_task);
- CDate cdt=Now;
- StrPrint(st,"%D %T",cdt,cdt);
- return st;
-}
-
-U0 DoIt()
-{
- CDoc *bdoc=DocBorder,*pdoc=DocPut;
- CDocEntry *doc_e;
-
- DocLock(bdoc);
- DocBottom(bdoc); //Ins at the bottom
- DocPrint(bdoc,"$RED$$CM+BY+LX,5,-3$");
-//The DocPrint() routine returns the addr of the last entry.
- doc_e=DocPrint(bdoc,"$TX+TC,\" \"$");
-//The TC flag is "has tag callback".
-
- //Flags are explained here:
- ///Doc/DolDocOverview.DD /Doc/Widget.DD
- //Dollar Flags ST_DOC_FLAGS
- doc_e->tag_cb=&tSCB;
- DocPrint(bdoc,"$FG$");
- DocUnlock(bdoc);
-
- //WARNING: If you use the put_doc you
- //run the risk of the user pressing
- //<CTRL-t> or using the clip, both
- //of which will crash. So, you might want
- //to use the border_doc.
-
- DocLock(pdoc);
- DocPrint(pdoc,"$LTRED$");
- doc_e=DocPrint(pdoc,"$TX+TC,\" \"$");
- doc_e->tag_cb=&CurTimeCB;
- DocPrint(pdoc,"$FG$");
- DocUnlock(pdoc);
-
- //Send carriage return, new line, so
- //that the timer string is not part
- //of the next cmd on the cmd line.
- '\n';
-}
-
-U0 UndoIt()
-{//Clear-out entries without a +H hold flag.
- DocClear(Fs->border_doc);
-}
-
-DoIt;
- - - \ No newline at end of file diff --git a/public/src/Demo/DolDoc/ClickCallBack.HC.HTML b/public/src/Demo/DolDoc/ClickCallBack.HC.HTML deleted file mode 100644 index 32cdfaa..0000000 --- a/public/src/Demo/DolDoc/ClickCallBack.HC.HTML +++ /dev/null @@ -1,59 +0,0 @@ - - - - - ClickCallBack.HC - - - - - I64 MyLeftCB1(CDoc *,CDocEntry *)
-{
- I64 i;
- for (i=500;i<1000;i+=25) {
- Snd(Freq2Ona(i));
- Sleep(10);
- }
- Snd;
- return 0;
-}
-
-U0 ClickCallBack()
-{
- CDocEntry *doc_e;
- DocLock(DocPut);
-//The DocPrint() routine returns the addr of the last entry.
- doc_e=DocPrint(DocPut,"\n$MA+LC,\"Click Me\"$ ");
-//The LC flag is "has left callback".
-
- //Flags are explained here:
- ///Doc/DolDocOverview.DD /Doc/Widget.DD
- //Dollar Flags ST_DOC_FLAGS
- "(Not preserved if you press <CTRL-t>.)\n\n";
- doc_e->left_cb=&MyLeftCB1;
- DocUnlock(DocPut);
-}
-
-ClickCallBack;
-
-I64 MyLeftCB2(CDoc *,CDocEntry *)
-{
- return cnts.jiffies;
-}
-
-U0 PopUpJiffiesCallBack(I64 i)
-{
- CDoc *doc=DocNew;
- CDocEntry *doc_e=DocPrint(doc,
- "Click %d more times\n\n\n$BT+LC,\"Jiffies\"$\n\n\n",i);
- doc_e->left_cb=&MyLeftCB2;
- "Current Jiffies:%d\n",PopUpMenu(doc);
- DocDel(doc);
-}
-
-PopUpJiffiesCallBack(3);
-PopUpJiffiesCallBack(2);
-PopUpJiffiesCallBack(1);
- - - \ No newline at end of file diff --git a/public/src/Demo/DolDoc/CursorMove.HC.HTML b/public/src/Demo/DolDoc/CursorMove.HC.HTML deleted file mode 100644 index d935da9..0000000 --- a/public/src/Demo/DolDoc/CursorMove.HC.HTML +++ /dev/null @@ -1,50 +0,0 @@ - - - - - CursorMove.HC - - - - - U0 CursorMovementDemo()
-{
- I64 i;
- for (i=0;i<100;i++) {
- "%03d ",i;
- "$CM,-4,1$";
- if (i%10==9)
- "$CM,4,-10$";
- }
-
- //+LX is relative to left side.
- //See <CTRL-l> with cursor-movement for all the flags.
- //Check "Quote" to set-up a cmd for in quotes.
- "$CM+LX,0,+10$\n";
-}
-
-CursorMovementDemo;
-
-/*The word-wrap Off and On cmds are
-$WW,0$ and $WW,1$.
-
-You might need DocMax() to adjust
-the cmd line window buf size.
-It counts cmds, not lines.
-
-The +H flag will hold-onto an entry
-so it doesn't get pushed-out of the document.
-This is useful for a $WW+H,1$ cmd.
-
-See /Doc/DolDocOverview.DD for documentation on
-all flags and cmds.
-
-Note: the default page length is 66 lines
-and branching back more than the page length
-will rst the column to 1.So, set page
-length to a large number if you want to
-branch back a long distance.
-*/
- - - \ No newline at end of file diff --git a/public/src/Demo/DolDoc/Data.HC.HTML b/public/src/Demo/DolDoc/Data.HC.HTML deleted file mode 100644 index 6fce847..0000000 --- a/public/src/Demo/DolDoc/Data.HC.HTML +++ /dev/null @@ -1,75 +0,0 @@ - - - - - Data.HC - - - - - /*$DA is the data widget.
- -TRM flag is for var
- width fields with a terminator
- character.
- +RD refreshes the data.
- +UD updates the val when you edit it.
-
- -P Means it is a string var, basically.
-
- ,32 sets the tag string width.
- See $LK,"Data Tag Width",A="FA:::/Adam/DolDoc/DocPlain.HC,DataTagWidth"$.
-
- ,RT=I16 means the val is 2 bytes.
- See DocDataFmt() and DocDataScan().
-*/
-
-I16 i=0;
-U8 buf[8];
-
-U0 UpdateGlblTask(I64)
-{
- while (TRUE) {
- i++;
- Sleep(1);
- }
-}
-
-U0 DataDemo()
-{
- CDocEntry *doc_e;
-
- //This is the command line document.
- CDoc *doc=DocPut;
-
- //We do this to prevent access to
- //doc_e->data before it is set.
- Bool unlock=DocLock(doc);
-
- //You might set the DOCF_FORM flag.
- // doc->flags|=DOCF_FORM
- //if you wish.
-
- Spawn(&UpdateGlblTask,NULL,"Update Glbl",,Fs);
-
- "Enter editor overstrike mode\n"
- "and you can modify the val.\n"
- "However, changes happen immediately,\n"
- "so it's tricky.\n\n";
-//Use <CTRL-l> for the $DA...$ format.
- doc_e=DocPrint(doc,"$DA-TRM+RD+UD,RT=I16,A=\"%%7d\"$\n");
- doc_e->data=&i;
-
- StrCpy(buf,"Terry");
- doc_e=DocPrint(doc,"$DA-P+RD+UD,LEN=7,A=\"Str:%%s\"$\n");
- doc_e->data=buf;
-
- if (unlock)
- DocUnlock(doc);
-}
-
-DataDemo;
-
-//See PopUpExtents().
- - - \ No newline at end of file diff --git a/public/src/Demo/DolDoc/DefineStr.HC.HTML b/public/src/Demo/DolDoc/DefineStr.HC.HTML deleted file mode 100644 index 936720c..0000000 --- a/public/src/Demo/DolDoc/DefineStr.HC.HTML +++ /dev/null @@ -1,34 +0,0 @@ - - - - - DefineStr.HC - - - - - /*The +D flag causes a define-string
-look-up and substitution.
-
-It is available in the <CTRL-l> text-widget
-menu under text entries for use in
-documentation.
-
-*/
-
-DefineLoad("COMPANY","Acme Inc");
-"Company: $TX,\"\",D=\"COMPANY\"$\n";
-
-DefinePrint("COMPANY_TIME","%T",Now);
-
-#exe {
- StreamPrint(
- "#define COMPANY_AGE %0.1f\n",
- (Now-Str2Date("8/1/2003"))/ToF64(1<<32)/CDATE_YEAR_DAYS);
-};
-
-"Age : $TX,\"\",D=\"COMPANY_AGE\"$ years\n";
-"Time: $TX,\"\",D=\"COMPANY_TIME\"$\n";
- - - \ No newline at end of file diff --git a/public/src/Demo/DolDoc/FileRead.HC.HTML b/public/src/Demo/DolDoc/FileRead.HC.HTML deleted file mode 100644 index 0a4e478..0000000 --- a/public/src/Demo/DolDoc/FileRead.HC.HTML +++ /dev/null @@ -1,92 +0,0 @@ - - - - - FileRead.HC - - - - - public U0 DocProfile(U8 *filename,I64 flags)
-{
- I64 i,*cmd_stats=CAlloc(sizeof(I64)*DOCT_TYPES_NUM),
- *flags_stats=CAlloc(sizeof(I64)*64),
- *type_flags_stats=CAlloc(sizeof(I64)*64);
-//Note: word wrap is determined by
- //doc->win_task when a CDoc is recalculated
- //use DocRecalc().
- CDoc *doc=DocRead(filename,flags);
-
- //doc->head which is equ to doc is the
- //header of the CQue and represents the end-of-file marker.
- CDocEntry *doc_e=doc->head.next;
- while (doc_e!=doc) {
- cmd_stats[doc_e->type_u8]++;
- for (i=0;i<64;i++)
- if (Bt(&doc_e->de_flags,i))
- flags_stats[i]++;
- for (i=16;i<32;i++)
- if (Bt(&doc_e->type,i))
- type_flags_stats[i]++;
- doc_e=doc_e->next;
- }
- DocDel(doc);
-
- "$PURPLE$-------%s-------\n",filename;
- "$GREEN$The lowest byte of the 32-bit 'doc_e->type', "
- "'$PURPLE$doc_e->type.u8[0]$GREEN$', "
- "is cmd and accessed with the union "
- "'$PURPLE$doc_e->type_u8$GREEN$'."
- "See $LK,\"CDocEntry\",A=\"MN:CDocEntry\"$, "
- "$LK,\"Doc Type Defines\",A=\"MN:DOCT_TEXT\"$ and "
- "$LK,\"Doc Type Codes\","
- "A=\"FF:::/Adam/DolDoc/DocInit.HC,ST_DOC_CMDS\"$.\n"
- "$FG$";
- for (i=0;i<DOCT_TYPES_NUM;i++)
- if (cmd_stats[i])
- "%4Z:%d\n",i,"ST_DOC_CMDS",cmd_stats[i];
-
- "\n$GREEN$'$PURPLE$doc_e->type.u8[1]$GREEN$' is "
- "the scrn color attr of the "
- "entry.'$PURPLE$doc_e->type.u16[1]"
- "$GREEN$' is some flags for blinking and "
- "stuff.See $LK,\"Doc Type Flag "
- "Defines\",A=\"MN:DOCET_BLINK\"$.\n$FG$";
-
- for (i=16;i<32;i++)
- if (type_flags_stats[i])
- "%4d:%d\n",i,type_flags_stats[i];
-
- "$GREEN$\n'$PURPLE$doc_e->de_flags$GREEN$' is 64-bit."
- "See $LK,\"Doc Flag Defines\",A=\"MN:DOCEf_TAG\"$ and "
- "$LK,\"Doc Flag Codes\","
- "A=\"FF:::/Adam/DolDoc/DocInit.HC,ST_DOC_FLAGS\"$.\n"
- "$FG$";
- for (i=0;i<64;i++)
- if (flags_stats[i])
- "%4Z:%d\n",i,"ST_DOC_FLAGS",flags_stats[i];
-
- Free(cmd_stats);
- Free(flags_stats);
- PressAKey;
- '\n';
-}
-
-/*See TipOfDay.
-
-Note: Not all CDocEntry's are full-sized nodes.
-Some are MAlloced with a smaller size to save
-mem. They all have at least the size CDocEntryBase.
-
-Note: CDocEntry's should be alloced from the
-heap of the owning task, doc->mem_task.
-
-The flag arrays doldoc.type_flags_form, etc
-are useful.
-*/
-
-DocProfile("::/Doc/Welcome.DD",0);
-DocProfile("::/Doc/Welcome.DD",DOCF_PLAIN_TEXT);
- - - \ No newline at end of file diff --git a/public/src/Demo/DolDoc/Form.HC.HTML b/public/src/Demo/DolDoc/Form.HC.HTML deleted file mode 100644 index b027e1f..0000000 --- a/public/src/Demo/DolDoc/Form.HC.HTML +++ /dev/null @@ -1,63 +0,0 @@ - - - - - Form.HC - - - - - class FDStruct
-{//Use <CTRL-l> and sel "Data", "List" or "Check Box"
-//to generate the formats.
- F64 num1 format "$DA-TRM,A=\"Float1:%12.8f\"$\n";
- F64 num2 format "$DA-TRM,A=\"Float2:%12e\"$\n";
- I64 num3 format "$DA-TRM,A=\"Int1:0x%016X\"$\n";
- I64 num4 format "$DA-TRM,A=\"Int2:%12d\"$\n";
- I64 type format "$LS,D=\"ST_PERSON_TYPE\"$\n";
- U8 name[32] format "$DA-P,A=\"Name:%s\"$\n";
- U8 *address1 format "$DA+M,A=\"Address:%s\"$\n"; //+M is unlimited len U8 *.
- U8 *address2 format "$DA+M,A=\"Address:%s\"$\n"; //+M is unlimited len U8 *.
- CDate datetime format "$DA-TRM,A=\"Date:%8D\"$\n";
- Bool check format "$CB,\"Check\"$\n";
-};
-
-U0 FormDemo()
-{
- FDStruct fds;
- DefineLstLoad("ST_PERSON_TYPE","Child\0Teen\0Adult\0");
- fds.num1=12.3e-4; //Set defaults
- fds.num2=4.5e3;
- fds.num3=0x1234;
- fds.num4=-567;
- fds.type=1;
- StrCpy(&fds.name,"John");
- fds.address1=StrNew("1234 Pine St.");
- fds.address2=NULL; //Init to NULL if empty.
- fds.datetime=Now;
- fds.check=TRUE;
- if (DocForm(&fds)) {
- "#1\t=%e\n",fds.num1;
- "#2\t=%e\n",fds.num2;
- "#3\t=%d\n",fds.num3;
- "#4\t=%d\n",fds.num4;
- "Type\t=%s\n",DefineSub(fds.type,"ST_PERSON_TYPE");
- "Name\t=%s\n",fds.name;
- "Address1=%s\n",fds.address1;
- "Address2=%s\n",fds.address2;
- "Date\t=%D\n",fds.datetime;
- "Check\t=%d\n",fds.check;
- } else
- "Cancel\n";
-
- "\n\nClassRep Example\n";
- ClassRep(&fds);
- Free(fds.address1);
- Free(fds.address2);
- //See also ClassRepD().
-}
-
-FormDemo;
- - - \ No newline at end of file diff --git a/public/src/Demo/DolDoc/MenuBttn.HC.HTML b/public/src/Demo/DolDoc/MenuBttn.HC.HTML deleted file mode 100644 index d3e92aa..0000000 --- a/public/src/Demo/DolDoc/MenuBttn.HC.HTML +++ /dev/null @@ -1,87 +0,0 @@ - - - - - MenuBttn.HC - - - - - //This example shows bttns.Bttns return a menu val
-//unless you rig them to send macros.Menu entries are
-//about the same as bttns, but don't have a border.
-
-I64 PopUpFreq()
-{//See also PopUpRangeI64()
- I64 i;
- CDoc *doc=DocNew;
- DocPrint(doc,"$TX+CX,\"Set Freq\"$\n" //Centered text
- "$CM+LX,2,4$$BT,\"100 Hz\",LE=100$"
- "$CM+LX,18,0$$BT,\"200 Hz\",LE=200$"
- "$CM+LX,2,4$$BT,\"400 Hz\",LE=400$"
- "$CM+LX,18,0$$BT,\"800 Hz\",LE=800$\n");
- i=PopUpMenu(doc);
- if (i<0) i=0; // <SHIFT-ESC>
- DocDel(doc);
- return i;
-}
-
-#define MU_NOTHING 0
-#define MU_SET_FREQ 1
-#define MU_SND_ON 2
-#define MU_SND_OFF 3
-
-U0 MenuBttn()
-{
- Bool done=FALSE;
- I64 i,j=0,freq=100;
- I64 old_flags=DocPut->flags;
-//This allows keyboard navigation to skip nonselible entries.
- DocPut->flags|=DOCF_FORM;
- do {
- DocClear;
-//Use <CTRL-l> to generate cursor movement expressions and check "Quote".
- "$CM+CX-RE,-4$Menu Demo\n\n";
- "$LM,8$"; //Set left margin
-//These are bttns that return a val from a menu selection.
- if (!j)
- "\n$BT,\"Snd On\",LE=MU_SND_ON$\n\n\n";
- else
- "\n$BT,\"Snd Off\",LE=MU_SND_OFF$\n\n\n";
- "\n$BT,\"Set Freq\",LE=MU_SET_FREQ$\n\n\n"
- "\n$BT,\"Nothing\",LE=MU_NOTHING$\n\n\n"
- "\n$BT,\"Done\",LE=DOCM_CANCEL$\n\n\n";
- i=DocMenu(DocPut);
- DocBottom;
- switch (i) {
- case MU_NOTHING:
- break;
- case MU_SND_ON:
- j=freq;
- Snd(Freq2Ona(j));
- break;
- case MU_SND_OFF:
- j=0;
- Snd;
- break;
- case MU_SET_FREQ:
- freq=PopUpFreq;
- if (j) {
- j=freq;
- Snd(Freq2Ona(j));
- }
- break;
- default:
- done=TRUE;
- }
- } while (!done);
- DocPut->flags=DocPut->flags&~DOCF_FORM |
- old_flags & DOCF_FORM;
- DocClear;
- Snd;
-}
-
-MenuBttn;
- - - \ No newline at end of file diff --git a/public/src/Demo/DolDoc/MenuSprite.HC.HTML b/public/src/Demo/DolDoc/MenuSprite.HC.HTML deleted file mode 100644 index a23a183..0000000 --- a/public/src/Demo/DolDoc/MenuSprite.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - MenuSprite.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/DolDoc/NumBible.HC.HTML b/public/src/Demo/DolDoc/NumBible.HC.HTML deleted file mode 100644 index 3aa8787..0000000 --- a/public/src/Demo/DolDoc/NumBible.HC.HTML +++ /dev/null @@ -1,40 +0,0 @@ - - - - - NumBible.HC - - - - - // This makes a new Bible file
-//with line numbers.
-
-U0 NumBible()
-{
- CDoc *doc_in=DocRead("::/Misc/Bible.TXT.Z",DOCF_PLAIN_TEXT_TABS),
- *doc_out=DocNew("~/DemoNumBible.DD.Z");
- CDocEntry *doc_e=doc_in->head.next;
- while (doc_e!=doc_in) {
- if (doc_e->type_u8==DOCT_TEXT) {
- DocPrint(doc_out,"%05d %s",doc_e->y+1,doc_e->tag);
- doc_e=doc_e->next;
- if (doc_e->type_u8==DOCT_NEW_LINE) {
- DocPrint(doc_out,"\n");
- doc_e=doc_e->next;
- }
- } else if (doc_e->type_u8==DOCT_NEW_LINE) {
- DocPrint(doc_out,"%05d\n",doc_e->y+1);
- doc_e=doc_e->next;
- } else
- doc_e=doc_e->next;
- }
- doc_out->flags|=DOCF_NO_CURSOR;
- DocWrite(doc_out);
- DocDel(doc_out);
- DocDel(doc_in);
-}
-
-NumBible; - - \ No newline at end of file diff --git a/public/src/Demo/DolDoc/TextDemo.HC.HTML b/public/src/Demo/DolDoc/TextDemo.HC.HTML deleted file mode 100644 index c34a7e5..0000000 --- a/public/src/Demo/DolDoc/TextDemo.HC.HTML +++ /dev/null @@ -1,34 +0,0 @@ - - - - - TextDemo.HC - - - - - "\nSuper: 3$SY,-3$2$SY,0$=9\n\n"
- "Sub: H$SY,3$2$SY,0$O\n\n"
- "Color: $RED$Test$FG$\n\n"
- "Blink: $BK,1$Test$BK,0$\n\n"
- "Invert: $IV,1$Test$IV,0$\n\n"
- "UnderLine: $UL,1$Test$UL,0$\n\n"
- "Link: $LK,\"Genesis,1:1\",\"BF:Genesis,1:1\"$\n\n\n"
-
- "Bttn:$BT-X,\"OKAY\",LE=1$\n\n\n\n";
-
-//You can do it this way if you like.
- "\nSuper: 32=9\n\n"
- "Sub: H2O\n\n"
-//Can't see color because of syntax highlighting. Press <CTRL-t>
- "Color: Test\n\n"
- "Blink: Test\n\n"
- "Invert: Test\n\n"
- "UnderLine: Test\n\n"
-//<CTRL-SHIFT-T> on this link to toggle individual commands.
- "Link: $LK,"Genesis,1:1",A="BF:Genesis,1:1"$\n\n\n"
-
- "Bttn:$BT,"OKAY",LE=1$\n\n\n\n";
- - - \ No newline at end of file diff --git a/public/src/Demo/DolDoc/TreeDemo.HC.HTML b/public/src/Demo/DolDoc/TreeDemo.HC.HTML deleted file mode 100644 index 692dfd4..0000000 --- a/public/src/Demo/DolDoc/TreeDemo.HC.HTML +++ /dev/null @@ -1,51 +0,0 @@ - - - - - TreeDemo.HC - - - - - U0 TreeSub(CDoc *doc,CDirEntry *tmpde)
-{
- CDirEntry *tmpde1;
- while (tmpde) {
- tmpde1=tmpde->next;
- if (tmpde->attr & RS_ATTR_DIR) {
- DocPrint(doc,"$TR,\"\"$");
- DocPrint(doc,"$MA,T=\"%s\",LM=\"Cd(\\\"%s\\\");Dir;\n\"$\n",
- tmpde->name,tmpde->full_name);
- if (tmpde->sub) {
- DocPrint(doc,"$ID,+2$");
- TreeSub(doc,tmpde->sub);
- DocPrint(doc,"$ID,-2$");
- }
- } else
- DocPrint(doc,"$LK,\"%s\",A=\"FI:%s\"$\n",
- tmpde->name,tmpde->full_name);
-//Note there is also a routine
- //to delete an entire CDirEntry tree.
- //See DirTreeDel().
- DirEntryDel(tmpde);
- tmpde=tmpde1;
- }
-}
-
-U0 TreeDemo()
-{
- I64 fuf_flags=0;
- CDoc *doc=DocNew;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
- DocPrint(doc,"$TR-C,\"\"$\n");
- DocPrint(doc,"$ID,+2$");
- TreeSub(doc,FilesFind("/*",fuf_flags));
- DocPrint(doc,"$ID,-2$");
- DocInsDoc(DocPut,doc);
- DocDel(doc);
-}
-
-TreeDemo;
- - - \ No newline at end of file diff --git a/public/src/Demo/DolDoc/UnusedDefine.HC.HTML b/public/src/Demo/DolDoc/UnusedDefine.HC.HTML deleted file mode 100644 index d65ebf2..0000000 --- a/public/src/Demo/DolDoc/UnusedDefine.HC.HTML +++ /dev/null @@ -1,94 +0,0 @@ - - - - - UnusedDefine.HC - - - - - /*Scans the sym table and checks
-each HTT_DEFINE_STR entry to see if
-it only occurs once in files.
-
-It's a brute force solution, but
-gets the job done... slowly.
-
-Find() returns a count of matches.
-
-FileOcc() is Find() with
-output Silent().
-*/
-
-U0 UnusedDefineScan()
-{
- CDoc *old_put_doc,*old_display_doc,*doc;
- I64 i,cnt=0;
- CHashTable *table;
- CHash *tmph;
- CDocEntry *doc_e,*doc_e2;
- Bool old_silent=IsSilent;
-
- try {
- table=Fs->hash_table;
- while (table) {
- for (i=0;i<=table->mask;i++) {
- tmph=table->body[i];
- while (tmph) {
- if (tmph->type&HTT_DEFINE_STR)
- cnt++;
- tmph=tmph->next;
- }
- }
- table=table->next;
- }
-
- progress1=0;
- progress1_max=cnt;
- StrCpy(progress1_desc,"Define Scan");
-
- table=Fs->hash_table;
- while (table) {
- for (i=0;i<=table->mask;i++) {
- tmph=table->body[i];
- while (tmph) {
- if (tmph->type&HTT_DEFINE_STR) {
- progress1++;
- if (FileOcc(tmph->str,"/*","+l-i+$")==1) {
- doc=DocNew;
- old_put_doc=DocPut;
- old_display_doc=DocDisplay;
- Fs->put_doc=Fs->display_doc=doc;
- Find(tmph->str,"/*","+l-i+$");
- Fs->put_doc=old_put_doc;
- Fs->display_doc=old_display_doc;
- doc_e=doc->head.next;
- while (doc_e!=doc) {
- if (doc_e->type_u8==DOCT_LINK) {
- "%s",tmph->str;
- doc_e2=DocEntryCopy(doc,doc_e);
- DocInsEntry(old_put_doc,doc_e2);
- '\n';
- }
- doc_e=doc_e->next;
- }
- DocDel(doc);
- }
- }
- tmph=tmph->next;
- }
- }
- table=table->next;
- }
- } catch
- PutExcept;
-
- Silent(old_silent);
- '\n';
- ProgressBarsRst;
-}
-
-UnusedDefineScan;
- - - \ No newline at end of file diff --git a/public/src/Demo/Dsk/BlkDevRep.HC.HTML b/public/src/Demo/Dsk/BlkDevRep.HC.HTML deleted file mode 100644 index 71a4923..0000000 --- a/public/src/Demo/Dsk/BlkDevRep.HC.HTML +++ /dev/null @@ -1,25 +0,0 @@ - - - - - BlkDevRep.HC - - - - - U0 BlkDevRep()
-{//Block Device Report.
- I64 i;
- for (i=0;i<BLKDEVS_NUM;i++)
- if (blkdev.blkdevs[i].bd_signature==BD_SIGNATURE_VAL)
- //ClassRep() dumps any structure, automatically.
- ClassRep(&blkdev.blkdevs[i]);
- //The lastclass arg tells ClassRep the datatype.
- //lastclass is a language feature of HolyC.
- //See /Demo/LastClass.HC.
-}
-
-BlkDevRep;
- - - \ No newline at end of file diff --git a/public/src/Demo/Dsk/DataBase.HC.HTML b/public/src/Demo/Dsk/DataBase.HC.HTML deleted file mode 100644 index 87c13ef..0000000 --- a/public/src/Demo/Dsk/DataBase.HC.HTML +++ /dev/null @@ -1,76 +0,0 @@ - - - - - DataBase.HC - - - - - #define DB_FILENAME "~/DataBaseDemo.BIN"
-#define DB_ACCT_MAX 100
-#define DB_ACCT_BLKS 1
-
-class Acct
-{//Use <CTRL-l> to help generate formats.
- U8 name[32] format "$DA-P,LEN=32,A=\"Name:%s\"$\n";
- U8 addr[64] format "$DA-P,LEN=64,A=\"Addr:%s\"$\n";
- U8 pad[DB_ACCT_BLKS*BLK_SIZE-64-32];
-};
-
-U0 InitDatabase()
-{ //Write new contiguous file
- CFile *f=FOpen(DB_FILENAME,"w",DB_ACCT_MAX*DB_ACCT_BLKS);
- FClose(f);
-}
-
-U0 WriteAcct()
-{
- CFile *f;
- Acct a;
- I64 acctnum;
-
- acctnum=GetI64("Acct #",-1);
- if (0<=acctnum<DB_ACCT_MAX) {
- MemSet(&a,0,BLK_SIZE);
- if (DocForm(&a)) {
- f=FOpen(DB_FILENAME,"w+");
- FBlkWrite(f,&a,acctnum*DB_ACCT_BLKS,DB_ACCT_BLKS);
- FClose(f);
- }
- }
-}
-
-U0 ReadAcct()
-{
- CFile *f;
- Acct a;
- I64 acctnum;
-
- acctnum=GetI64("Acct #",-1);
- if (0<=acctnum<DB_ACCT_MAX) {
- f=FOpen(DB_FILENAME,"r");
- FBlkRead(f,&a,acctnum*DB_ACCT_BLKS,DB_ACCT_BLKS);
- FClose(f);
- ClassRep(&a);
- }
-}
-
-U0 DatabaseDemo()
-{
- I64 ch;
- if (!FileFind(DB_FILENAME))
- InitDatabase;
- do {
- "$GREEN$R$FG$ead acct, $GREEN$W$FG$rite acct or $GREEN$<SHIFT-ESC>$FG$:";
- ch=ToUpper(GetChar);
- '\n';
- if (ch=='R') ReadAcct;
- if (ch=='W') WriteAcct;
- } while (ch!=CH_SHIFT_ESC && ch!=CH_ESC);
-}
-
-DatabaseDemo;
- - - \ No newline at end of file diff --git a/public/src/Demo/Dsk/DskRaw.HC.HTML b/public/src/Demo/Dsk/DskRaw.HC.HTML deleted file mode 100644 index 21c2198..0000000 --- a/public/src/Demo/Dsk/DskRaw.HC.HTML +++ /dev/null @@ -1,53 +0,0 @@ - - - - - DskRaw.HC - - - - - U0 RawAccess(I64 drv_let=0)
-{
- CDrv *dv=Let2Drv(drv_let);
- CBlkDev *bd=Let2BlkDev(drv_let);
- I64 blk,old_offset,old_size;
- U8 *buf=MAlloc(BLK_SIZE);
-
- DrvRep;
- PressAKey;
-
- ClassRep(dv);
- PressAKey;
-
- ClassRep(bd);
- PressAKey;
-
- //Temporarily change partition range to full device.
- //Normally, you are limited to just your partition.
- //This is obviously dangerous!
- old_offset=dv->drv_offset;
- old_size =dv->size;
- dv->drv_offset=0;
- dv->size=bd->max_blk+1;
-
- try {
- blk=GetI64("Blk to Read: ",old_offset,0,bd->max_blk);
- BlkRead(dv,buf,blk,1);
- D(buf,BLK_SIZE);
- } catch
- PutExcept;
-
- dv->drv_offset=old_offset;
- dv->size =old_size;
-
- Free(buf);
-}
-
-RawAccess;
-
-//See BlkRead(), BlkWrite(), DrvLock(), DrvUnlock()
-//DBlk(), DClus(), BlkDevLock() and BlkDevUnlock().
- - - \ No newline at end of file diff --git a/public/src/Demo/Dsk/FPrintF.HC.HTML b/public/src/Demo/Dsk/FPrintF.HC.HTML deleted file mode 100644 index 672e76d..0000000 --- a/public/src/Demo/Dsk/FPrintF.HC.HTML +++ /dev/null @@ -1,61 +0,0 @@ - - - - - FPrintF.HC - - - - - /*There is no FPrintF type function and no
-way to grow files. Therefore, use mem to
-hold the file until you are done. The CDoc
-framework is convenient for this.
-*/
-
-U0 TreeSub(CDoc *doc,CDirEntry *tmpde)
-{
- CDirEntry *tmpde1;
- while (tmpde) {
- tmpde1=tmpde->next;
- if (tmpde->attr & RS_ATTR_DIR) {
- DocPrint(doc,"$TR,\"\"$");
- DocPrint(doc,"$MA,T=\"%s\",LM=\"Cd(\\\"%s\\\");Dir;\n\"$\n",
- tmpde->name,tmpde->full_name);
- if (tmpde->sub) {
- DocPrint(doc,"$ID,+2$");
- TreeSub(doc,tmpde->sub);
- DocPrint(doc,"$ID,-2$");
- }
- } else
- DocPrint(doc,"$LK,\"%s\",A=\"FI:%s\"$\n",
- tmpde->name,tmpde->full_name);
-//Note there is also a routine
- //to delete an entire CDirEntry tree.
- //See DirTreeDel().
- DirEntryDel(tmpde);
- tmpde=tmpde1;
- }
-}
-
-U0 FPrintFDemo(U8 *output_filename=NULL)
-{
- I64 fuf_flags=0;
- CDoc *doc=DocNew(output_filename);
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
- DocPrint(doc,"$TR-C,\"\"$\n");
- DocPrint(doc,"$ID,+2$");
- TreeSub(doc,FilesFind("/*",fuf_flags));
- DocPrint(doc,"$ID,-2$");
- DocRecalc(doc);
- if (output_filename)
- DocWrite(doc,FALSE);
- else
- DocWrite(doc,TRUE);
- DocDel(doc);
-}
-
-FPrintFDemo;
- - - \ No newline at end of file diff --git a/public/src/Demo/Dsk/SerializeTree.HC.HTML b/public/src/Demo/Dsk/SerializeTree.HC.HTML deleted file mode 100644 index 86d5d99..0000000 --- a/public/src/Demo/Dsk/SerializeTree.HC.HTML +++ /dev/null @@ -1,47 +0,0 @@ - - - - - SerializeTree.HC - - - - - /*You probably don't need this. It makes a directory
-tree into a flat contiguous memory chunk, suitable for
-serial communication and rebuilds it into a tree on the
-other end.
-*/
-
-U0 SerializeTree()
-{
- CDirEntry *tmpde=FilesFind("/Demo/*.DD*",FUF_RECURSE);
- I64 size;
- U8 *ptr;
- CArcCompress *arc;
-
- LineRep1(tmpde); //We have CDirEntry.fullname
- LineRep2(DocPut,tmpde);
- "$GREEN$***************$FG$\n";
- ptr=DirTreeSerialize(tmpde,&size);
- DirTreeDel(tmpde);
- D(ptr,size);
- "$GREEN$***************:%7d$FG$\n",size;
- arc=CompressBuf(ptr,size);
- Free(ptr);
- D(arc,arc->compressed_size);
- "$GREEN$***************:%7d$FG$\n",size;
- ptr=ExpandBuf(arc);
- size=arc->expanded_size;
- Free(arc);
- D(ptr,size);
- "$GREEN$***************:%7d$FG$\n",size;
- tmpde=DirTreeUnserialize(ptr);
- LineRep2(DocPut,tmpde); //We don't have CDirEntry.fullname
- DirTreeDel(tmpde);
-}
-
-SerializeTree;
- - - \ No newline at end of file diff --git a/public/src/Demo/Dsk/UnusedSpaceRep.HC.HTML b/public/src/Demo/Dsk/UnusedSpaceRep.HC.HTML deleted file mode 100644 index 5b47013..0000000 --- a/public/src/Demo/Dsk/UnusedSpaceRep.HC.HTML +++ /dev/null @@ -1,24 +0,0 @@ - - - - - UnusedSpaceRep.HC - - - - - U0 UnusedSpaceRep()
-{
- I64 i;
- CDrv *dv;
- for (i=0;i<26;i++)
- if ((dv=Let2Drv(i+'A',FALSE)) &&
- (dv->fs_type==FSt_FAT32 || dv->fs_type==FSt_REDSEA))
- "%C: %7.3f%% Free\n",
- Drv2Let(dv),DrvUnused(Drv2Let(dv))*100.0/(dv->size*BLK_SIZE);
-}
-
-UnusedSpaceRep;
- - - \ No newline at end of file diff --git a/public/src/Demo/Exceptions.HC.HTML b/public/src/Demo/Exceptions.HC.HTML deleted file mode 100644 index 7e099b5..0000000 --- a/public/src/Demo/Exceptions.HC.HTML +++ /dev/null @@ -1,59 +0,0 @@ - - - - - Exceptions.HC - - - - - //WARNING: Don't return out of a catch{}.This
-//might get fixed.
-
-//You can use PutExcept() in a catch stmt
-//and it will report args.
-Bool Prompt(I64 i)
-{
- "%d ",i;
- return YorN;
-}
-
-U0 D1()
-{
- "D1\n";
- if (Prompt(1)) throw('Point1');
- if (Prompt(2)) throw('Point2');
-}
-
-U0 D2()
-{
- "D2\n";
- try {
- D1;
- if (Prompt(4)) throw('Point4');
- } catch {
- "D2 hndlr\n"
- "Ch:%c:%P\n",Fs->except_ch,Fs->except_callers[0];
- if (Fs->except_ch=='Point1') {
- "Caught in D2\n";
- Fs->catch_except=TRUE;
- }
- }
-}
-
-U0 Demo()
-{
- try {
- D2;
- if (Prompt(3)) throw('Point3');
- } catch {
- "Demo hndlr\n"
- "Ch:%c:%P\n",Fs->except_ch,Fs->except_callers[0];
- Fs->catch_except=TRUE;
- }
-}
-
-Demo;
- - - \ No newline at end of file diff --git a/public/src/Demo/ExtChars.HC.HTML b/public/src/Demo/ExtChars.HC.HTML deleted file mode 100644 index 333b6ff..0000000 --- a/public/src/Demo/ExtChars.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - ExtChars.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Games/BattleLines.HC.HTML b/public/src/Demo/Games/BattleLines.HC.HTML deleted file mode 100644 index 7d615cf..0000000 --- a/public/src/Demo/Games/BattleLines.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - BattleLines.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Games/BigGuns.HC.HTML b/public/src/Demo/Games/BigGuns.HC.HTML deleted file mode 100644 index 40f8d52..0000000 --- a/public/src/Demo/Games/BigGuns.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - BigGuns.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Games/BlackDiamond.HC.HTML b/public/src/Demo/Games/BlackDiamond.HC.HTML deleted file mode 100644 index fc9a6b6..0000000 --- a/public/src/Demo/Games/BlackDiamond.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - BlackDiamond.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Games/BomberGolf.HC.HTML b/public/src/Demo/Games/BomberGolf.HC.HTML deleted file mode 100644 index 0474b4f..0000000 --- a/public/src/Demo/Games/BomberGolf.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - BomberGolf.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Games/CastleFrankenstein.HC.HTML b/public/src/Demo/Games/CastleFrankenstein.HC.HTML deleted file mode 100644 index bb36fe8..0000000 --- a/public/src/Demo/Games/CastleFrankenstein.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - CastleFrankenstein.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Games/CharDemo.HC.HTML b/public/src/Demo/Games/CharDemo.HC.HTML deleted file mode 100644 index be076e2..0000000 --- a/public/src/Demo/Games/CharDemo.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - CharDemo.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Games/CircleTrace.HC.HTML b/public/src/Demo/Games/CircleTrace.HC.HTML deleted file mode 100644 index 022bb86..0000000 --- a/public/src/Demo/Games/CircleTrace.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - CircleTrace.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Games/Collision.HC.HTML b/public/src/Demo/Games/Collision.HC.HTML deleted file mode 100644 index d803a5e..0000000 --- a/public/src/Demo/Games/Collision.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Collision.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Games/Digits.HC.HTML b/public/src/Demo/Games/Digits.HC.HTML deleted file mode 100644 index df7fd1b..0000000 --- a/public/src/Demo/Games/Digits.HC.HTML +++ /dev/null @@ -1,92 +0,0 @@ - - - - - Digits.HC - - - - - //This loads a lst of zero terminated
-//strings into the sym table and
-//gives a name to it.Strings like
-//this are known as Define entries.
-
-//See ST_RAINBOW_10
-
-U0 PrintDigit(U8 ch)
-{
-//The %Z code displays a Define subentry
- if ('0'<=ch<='9')
- "$FG,%Z$%d$FG$",ch-'0',"ST_RAINBOW_10",ch-'0';
-}
-
-U0 PrintPattern(U8 *st)
-{
- I64 ch;
- while (ch=*st++)
- PrintDigit(ch);
- '\n';
-}
-
-U0 Digits()
-{
- I64 num,ch,i;
- U8 answer[1024];
-
- SettingsPush; //See SettingsPush
- Fs->text_attr=DKGRAY<<4+WHITE;
- DocClear;
-//Set default background and foreground
- "$WW,1$$BG,DKGRAY$$FD,WHITE$"
- "\nThis is a memory game."
- "Try to remember the digits and enter them."
- "They are colored based on electrical "
- "engineering color codes.\n";
- for (i=0;i<10;i++)
- "$FG,%Z$%d: %Z\n",i,"ST_RAINBOW_10",i,i,"ST_RAINBOW_10";
- "$FG$\n"; //set to default background
- ch=PressAKey;
- if (ch==CH_ESC||ch==CH_SHIFT_ESC) goto dg_done;
- while (TRUE) {
-restart:
- num=0;
-//Set to zeros so we have terminators
- MemSet(answer,0,sizeof(answer));
- while (TRUE) {
- DocClear;
- "$WW,1$$BG,DKGRAY$$FD,WHITE$\n";
- "Pattern\nLength:%d\n\n",num+1;
- answer[num++]=RandU32%10+'0';
- PrintPattern(answer);
- ch=PressAKey;
- if (ch==CH_ESC||ch==CH_SHIFT_ESC) goto dg_done;
- DocClear;
- "$WW,1$$BG,DKGRAY$$FD,WHITE$\n";
- "Guess\nLength:%d\n\n",num;
- for (i=0;i<num;i++) {
- ch=GetChar(,FALSE);
- if (ch==CH_ESC||ch==CH_SHIFT_ESC) goto dg_done;
- PrintDigit(ch);
- if (ch!=answer[i]) {
- "\nScore:%d\n",num;
- PrintPattern(answer);
- Beep; Beep;
- ch=PressAKey;
- if (ch==CH_ESC||ch==CH_SHIFT_ESC)
- goto dg_done;
- else
- goto restart;
- }
- }
- }
- }
-dg_done:
- DocClear;
- SettingsPop;
-}
-
-Digits;
- - - \ No newline at end of file diff --git a/public/src/Demo/Games/DunGen.HC.HTML b/public/src/Demo/Games/DunGen.HC.HTML deleted file mode 100644 index acf91d7..0000000 --- a/public/src/Demo/Games/DunGen.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - DunGen.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Games/ElephantWalk.HC.HTML b/public/src/Demo/Games/ElephantWalk.HC.HTML deleted file mode 100644 index 17f1806..0000000 --- a/public/src/Demo/Games/ElephantWalk.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - ElephantWalk.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Games/FlapBat.HC.HTML b/public/src/Demo/Games/FlapBat.HC.HTML deleted file mode 100644 index 35c2c2e..0000000 --- a/public/src/Demo/Games/FlapBat.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - FlapBat.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Games/FlatTops.HC.HTML b/public/src/Demo/Games/FlatTops.HC.HTML deleted file mode 100644 index 6bbe781..0000000 --- a/public/src/Demo/Games/FlatTops.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - FlatTops.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Games/Halogen.HC.HTML b/public/src/Demo/Games/Halogen.HC.HTML deleted file mode 100644 index 1b672b4..0000000 --- a/public/src/Demo/Games/Halogen.HC.HTML +++ /dev/null @@ -1,174 +0,0 @@ - - - - - Halogen.HC - - - - - #define ROAD_NUM 512
-#define ROAD_WIDTH_BY_2 200
-#define CAR_WIDTH_BY_2 100
-
-I64 road_x[ROAD_NUM],road_trend;
-F64 speed,distance;
-I64 road_ptr=0,car_x;
-F64 t_last;
-Bool crash;
-
-U0 DrawIt(CTask *task,CDC *dc)
-{
- I64 w=task->pix_width,h=task->pix_height;
- I64 i,x,y,xx;
- xx=w>>1-car_x+road_x[road_ptr&(ROAD_NUM-1)];
-
- dc->color=LTGRAY;
- for (i=0;i<ROAD_NUM;i++) {
- x=w>>1-car_x+road_x[(i+road_ptr)&(ROAD_NUM-1)];
- y=h-0.5*i;
- if (y<(h+FONT_HEIGHT)>>1) break;
- GrPlot(dc,x+ROAD_WIDTH_BY_2-0.4*i,y);
- GrPlot(dc,x-ROAD_WIDTH_BY_2+0.4*i,y);
- }
- dc->color=WHITE;
-
- x=w>>1-CAR_WIDTH_BY_2;
- if (x<xx-ROAD_WIDTH_BY_2)
- crash=TRUE;
- GrLine(dc,x-10,h,x-40,h-100);
- GrLine(dc,x+10,h,x+40,h-100);
-
- x=w>>1+CAR_WIDTH_BY_2;
- if (x>xx+ROAD_WIDTH_BY_2)
- crash=TRUE;
- GrLine(dc,x-10,h,x-40,h-100);
- GrLine(dc,x+10,h,x+40,h-100);
-
- dc->color=YELLOW;
- if (crash)
- GrPrint(dc,w>>1-FONT_WIDTH*4,(h-FONT_HEIGHT)>>1,"Game Over");
-}
-
-U0 UpdateRoad()
-{
- F64 t0=tS;
- distance+=speed*(t0-t_last);
- t_last=t0;
- while (distance>1.0) {
- road_trend=ClampI64(road_trend+SignI64(RandU16%3-1),-5,5);
- road_x[road_ptr&(ROAD_NUM-1)]=
- road_x[(road_ptr-1)&(ROAD_NUM-1)]+=road_trend/3;
- road_ptr++;
- distance-=1.0;
- }
-}
-
-U0 Init()
-{
- I64 i,x=0;
- DocClear;
- "$BG,DKGRAY$%h*c",(TEXT_ROWS-1)/2,'\n';
- speed=0;
- distance=0;
- road_trend=0;
- road_ptr=0;
- car_x=0;
- for (i=0;i<ROAD_NUM;i++) {
- road_x[i]=x;
- road_trend=ClampI64(road_trend+SignI64(RandU16%3-1),-5,5);
- x+=road_trend/3;
- }
- t_last=tS;
- crash=FALSE;
-}
-
-U0 Halogen()
-{
- I64 arg1,arg2,ch=0,sc=0;
- SettingsPush; //See SettingsPush
- Fs->text_attr=BLACK<<4+WHITE;
- MenuPush(
- "File {"
- " Abort(,CH_SHIFT_ESC);"
- " Exit(,CH_ESC);"
- "}"
- "Play {"
- " Restart(,'\n');"
- " Accelerate(,,SC_CURSOR_UP);"
- " Deccellerate(,,SC_CURSOR_DOWN);"
- " Left(,,SC_CURSOR_LEFT);"
- " Right(,,SC_CURSOR_RIGHT);"
- "}"
- );
- AutoComplete;
- WinBorder;
- WinMax;
- DocCursor;
- Init;
- Fs->draw_it=&DrawIt;
- try {
- while (TRUE) {
- switch (ScanMsg(&arg1,&arg2,1<<MSG_KEY_DOWN|1<<MSG_KEY_UP)) {
- case MSG_KEY_DOWN:
- ch=arg1;sc=arg2;
- switch (ch) {
- case '\n':
- Init;
- break;
- case CH_ESC:
- case CH_SHIFT_ESC:
- goto ha_done;
- }
- break;
- case MSG_KEY_UP:
- ch=arg1;sc=arg2;
- if (!ch)
- switch (sc.u8[0]) {
- case SC_CURSOR_RIGHT:
- case SC_CURSOR_LEFT:
- case SC_CURSOR_UP:
- case SC_CURSOR_DOWN:
- sc=0;
- break;
- }
- break;
- }
- switch (sc.u8[0]) {
- case SC_CURSOR_RIGHT:
- car_x++;
- break;
- case SC_CURSOR_LEFT:
- car_x--;
- break;
- case SC_CURSOR_UP:
- if (++speed>200) speed=200;
- break;
- case SC_CURSOR_DOWN:
- if (--speed<0) speed=0;
- break;
- }
- if (crash)
- Snd;
- else {
- if (speed)
- Snd(Freq2Ona(speed+10));
- else
- Snd;
- UpdateRoad;
- }
- Sleep(10);
- }
-ha_done:
- GetMsg(,,1<<MSG_KEY_UP);
- } catch
- PutExcept;
- MenuPop;
- DocClear;
- SettingsPop;
-}
-
-Halogen;
- - - \ No newline at end of file diff --git a/public/src/Demo/Games/MassSpring.HC.HTML b/public/src/Demo/Games/MassSpring.HC.HTML deleted file mode 100644 index 6090753..0000000 --- a/public/src/Demo/Games/MassSpring.HC.HTML +++ /dev/null @@ -1,181 +0,0 @@ - - - - - MassSpring.HC - - - - - class MyMass:CMass
-{
- F64 radius;
-};
-
-class MySpring:CSpring
-{
-};
-
-CMathODE *ode=NULL;
-
-U0 DrawIt(CTask *,CDC *dc)
-{
- MyMass *tmpm;
- MySpring *tmps;
-
- dc->color=RED;
- tmps=ode->next_spring;
- while (tmps!=&ode->next_spring) {
- GrLine(dc,tmps->end1->x,tmps->end1->y,tmps->end2->x,tmps->end2->y);
- tmps=tmps->next;
- }
-
- dc->color=BLACK;
- tmpm=ode->next_mass;
- while (tmpm!=&ode->next_mass) {
- GrCircle(dc,tmpm->x,tmpm->y,tmpm->radius);
- tmpm=tmpm->next;
- }
-}
-
-U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
-{//The forces due to springs and drag are
-//automatically handled by the ode code.
- //We can add new forces here.
- F64 d,dd;
- CD3 p;
- MyMass *tmpm1,*tmpm2;
-
- tmpm1=ode->next_mass;
- while (tmpm1!=&ode->next_mass) {
- tmpm2=tmpm1->next;
- while (tmpm2!=&ode->next_mass) {
- D3Sub(&p,&tmpm2->state->x,&tmpm1->state->x);
- dd=D3NormSqr(&p);
- if (dd<=Sqr(tmpm1->radius+tmpm2->radius)) {
- d=Sqrt(dd)+0.0001;
- dd=10.0*Sqr(Sqr(Sqr(tmpm1->radius+tmpm2->radius)-dd));
- D3MulEqu(&p,dd/d);
- D3AddEqu(&tmpm2->DstateDt->DxDt,&p);
- D3SubEqu(&tmpm1->DstateDt->DxDt,&p);
- }
- tmpm2=tmpm2->next;
- }
- tmpm1=tmpm1->next;
- }
-}
-
-U0 PlaceMass(I64 x, I64 y)
-{
- MyMass *tmpm=CAlloc(sizeof(MyMass));
- tmpm->mass=1.0;
- tmpm->drag_profile_factor=100.0;
- tmpm->x=x;
- tmpm->y=y;
- tmpm->radius=10*(Rand+0.25);
- QueIns(tmpm,ode->last_mass);
-}
-
-U0 PlaceSpring(MyMass *tmpm1,MyMass *tmpm2)
-{
- MySpring *tmps=CAlloc(sizeof(MySpring));
- tmps->end1=tmpm1;
- tmps->end2=tmpm2;
- tmps->const=10000;
- tmps->rest_len=100;
- QueIns(tmps,ode->last_spring);
-}
-
-U0 Init()
-{
- ode=ODENew(0,1e-4,ODEF_HAS_MASSES);
- ode->derive=&MyDerivative;
- ode->drag_v2=0.002;
- ode->drag_v3=0.00001;
- ode->acceleration_limit=5e3;
-
- QueIns(ode,Fs->last_ode);
-}
-
-U0 CleanUp()
-{
- QueRem(ode);
- QueDel(&ode->next_mass,TRUE);
- QueDel(&ode->next_spring,TRUE);
- ODEDel(ode);
-}
-
-U0 MassSpringDemo()
-{
- I64 msg_code,arg1,arg2;
- MyMass *tmpm1=NULL,*tmpm2=NULL;
-
- PopUpOk("Left-Click to place mas\n"
- "Right-Click and drag to\n"
- "connect with spring.\n\n"
- "Springs are 100 pixs long.\n");
- SettingsPush; //See SettingsPush
- AutoComplete;
- WinBorder;
- WinMax;
- DocCursor;
- DocClear;
-
- Fs->win_inhibit|=WIG_DBL_CLICK;
-
- MenuPush(
- "File {"
- " Abort(,CH_SHIFT_ESC);"
- " Exit(,CH_ESC);"
- "}"
- "Play {"
- " Restart(,'\n');"
- "}"
- );
-
- Init;
- Fs->draw_it=&DrawIt;
-
- try {
- while (TRUE) {
- msg_code=GetMsg(&arg1,&arg2,
- 1<<MSG_MS_L_DOWN|1<<MSG_MS_R_DOWN|1<<MSG_MS_R_UP|1<<MSG_KEY_DOWN);
- switch (msg_code) {
- case MSG_MS_L_DOWN:
- PlaceMass(arg1,arg2);
- break;
- case MSG_MS_R_DOWN:
- tmpm1=MassFind(ode,arg1,arg2);
- tmpm2=NULL;
- break;
- case MSG_MS_R_UP:
- if (tmpm1 && (tmpm2=MassFind(ode,arg1,arg2)) && tmpm1!=tmpm2)
- PlaceSpring(tmpm1,tmpm2);
- tmpm1=tmpm2=NULL;
- break;
- case MSG_KEY_DOWN:
- switch (arg1) {
- case '\n':
- CleanUp;
- Init;
- break;
- case CH_SHIFT_ESC:
- case CH_ESC:
- goto ms_done;
- }
- break;
- }
- }
-ms_done: //Don't goto out of try
- GetMsg(,,1<<MSG_KEY_UP);
- } catch
- PutExcept;
- SettingsPop;
- CleanUp;
- MenuPop;
-}
-
-MassSpringDemo;
- - - \ No newline at end of file diff --git a/public/src/Demo/Games/Maze.HC.HTML b/public/src/Demo/Games/Maze.HC.HTML deleted file mode 100644 index 67b2c98..0000000 --- a/public/src/Demo/Games/Maze.HC.HTML +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Maze.HC - - - - - //See TextBase Layer.
-
-#define ATTR (BLACK<<12+WHITE<<8)
-
-U32 text[TEXT_ROWS][TEXT_COLS];
-
-U0 DrawIt(CTask *task,CDC *)
-{ //gr.text_base gets clear 30fps, so we must use our own permanent text array.
- MemCpy(gr.text_base+TEXT_COLS,text,(TEXT_ROWS-1)*TEXT_COLS*sizeof(U32));
-
- // You can copy it this way, if you like:
- // I64 i,j;
- // for (j=0;j<TEXT_ROWS;j++)
- // for (i=0;i<TEXT_COLS;i++)
- // TextChar(task,,i,j,text[j][i]);
-
- TextPrint(task,0,0,ATTR>>8,"Draw a maze with left bttn.");
- TextPrint(task,0,1,ATTR>>8,"Solve maze starting at right click.");
-}
-
-#define STK_SIZE 2048
-//We would put these as local vars
-//in SolveMaze() but the system stk size
-//is limited, so it's a bad habit.The heap
-//is the normal TempleOS technique, but
-//it's a pain in this case.
-I64 stk_ptr,
- stk_x [STK_SIZE],
- stk_y [STK_SIZE],
- stk_dir[STK_SIZE];
-
-//Four directions:
-// 0=Up,1=right,2=down,3=left
-I64 dir_x[4]={ 0,+1, 0,-1}, // Could use gr_x_offsets2,gr_y_offsets2
- dir_y[4]={+1, 0,-1, 0};
-
-U0 SolveMaze(I64 x,I64 y)
-{
- I64 dir=0;
- stk_ptr=0;
- stk_x[stk_ptr]=x;
- stk_y[stk_ptr]=y;
- stk_dir[stk_ptr++]=dir;
- while (TRUE) {
- if (!(0<=x<MinI64(Fs->win_width,TEXT_COLS)) ||
- !(0<=y<MinI64(Fs->win_height,TEXT_ROWS)) ) {
- Beep;Beep;
- break;
- }
- if (!text[y][x].u8[0])
- text[y][x]='.'+ATTR;
- x+=dir_x[dir];
- y+=dir_y[dir];
-//u8.[0] is the ASCII
- if (text[y][x].u8[0]) {
- x-=dir_x[dir];
- y-=dir_y[dir];
- if (++dir==4) {
- if (--stk_ptr<0) return;
- x=stk_x[stk_ptr];
- y=stk_y[stk_ptr];
- dir=stk_dir[stk_ptr];
- }
- } else {
- dir=0;
- stk_x[stk_ptr]=x;
- stk_y[stk_ptr]=y;
- stk_dir[stk_ptr++]=dir;
- if (stk_ptr==STK_SIZE) return;
- Sleep(100);
- if (ScanChar)
- throw;
- }
- }
-}
-
-U0 Maze()
-{
- I64 ch,x,y;
-
- SettingsPush; //See SettingsPush
- AutoComplete;
- WinBorder;
- WinMax;
- DocCursor;
- DocClear;
- Fs->draw_it=&DrawIt;
- Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;
-
- try
- do {
- MemSet(text,0,sizeof(text));
- while (!(ch=ScanChar)) {
- x=ms.pos_text.x-Fs->win_left-Fs->scroll_x/FONT_WIDTH;
- y=ms.pos_text.y-Fs->win_top-Fs->scroll_y/FONT_HEIGHT;
- if (ms.lb&&!winmgr.grab_scroll)
- text[y][x]=CH_SPACE+ATTRF_INVERT+ATTR;
- if (ms.rb&&!winmgr.grab_scroll) {
- text[y][x]='*'+ATTR;
- SolveMaze(x,y);
- ch=GetChar;
- break;
- }
- Refresh;
- }
- } while (ch!=CH_SHIFT_ESC && ch!=CH_ESC);
- catch
- PutExcept;
- SettingsPop;
-}
-
-Maze;
- - - \ No newline at end of file diff --git a/public/src/Demo/Games/RainDrops.HC.HTML b/public/src/Demo/Games/RainDrops.HC.HTML deleted file mode 100644 index 1e2ddcc..0000000 --- a/public/src/Demo/Games/RainDrops.HC.HTML +++ /dev/null @@ -1,201 +0,0 @@ - - - - - RainDrops.HC - - - - - I64 sc_1,sc_2;
-
-#define DROPS_NUM 0x2000
-
-class Drop
-{
- I32 x,y;
-} drops[DROPS_NUM];
-
-CDC *cur_dc;
-
-U0 DrawFrame(CTask *task,CDC *dc)
-{
- I64 w=task->pix_width,h=task->pix_height,
- cx=w>>1,cy=h>>1;
-
- dc->color=LTRED;
- GrLine(dc,cx-20,cy-50,cx,cy-150);
- GrLine(dc,cx+20,cy-50,cx,cy-150);
-
- dc->color=LTRED;
- GrLine(dc,cx-100,cy-100,cx,cy);
- GrLine(dc,cx+100,cy-100,cx,cy);
- if (Bt(kbd.down_bitmap,sc_1)) {
- dc->color=WHITE;
- GrRect(dc,cx-2,cy-2,5,5);
- }
- dc->color=BLACK;
- GrPrint(dc,cx+10,cy,"Press '1'");
-
- dc->color=LTRED;
- GrRect(dc,cx-20,cy+60,41,21);
-
- dc->color=LTRED;
- GrLine(dc,cx-200,cy,cx,cy+100);
- GrLine(dc,cx+200,cy,cx,cy+100);
- if (Bt(kbd.down_bitmap,sc_2)) {
- dc->color=WHITE;
- GrRect(dc,cx-2,cy+100-2,5,5);
- }
- dc->color=BLACK;
- GrPrint(dc,cx+10,cy+100,"Press '2'");
-
- dc->color=LTRED;
- GrLine(dc,cx+400,cy+100,cx-250,cy+200);
-}
-
-U0 DrawDrops(CTask *,CDC *dc)
-{
- I64 i;
- dc->color=BLUE;
- for (i=0;i<DROPS_NUM;i++)
- if (drops[i].y>=0 && GrPeek(dc,drops[i].x,drops[i].y)==WHITE)
- GrPlot(dc,drops[i].x,drops[i].y);
-}
-
-U0 UpdateCurBase(CTask *task,CDC *dc)
-{
- cur_dc->color=ROP_EQU;
- dc->flags|=DCF_NO_TRANSPARENTS;
- GrBlot(cur_dc,-task->pix_left-task->scroll_x,
- -task->pix_top-task->scroll_y,dc);
- dc->flags&=~DCF_NO_TRANSPARENTS;
-}
-
-U0 DrawIt(CTask *task,CDC *dc)
-{
- DrawFrame(task,dc);
- DrawDrops(task,dc);
- UpdateCurBase(task,dc);
-}
-
-U0 AnimateTask(I64)
-{
- I64 i,j,cur_drop=0,c1,c2,x0,y0,x1,y1,w,h;
- while (TRUE) {
- w=Fs->parent_task->pix_width;
- h=Fs->parent_task->pix_height;
-
- for (i=0;i<2;i++) {
- j=0;
- do {
- if (++cur_drop>=DROPS_NUM)
- cur_drop=0;
- if (drops[cur_drop].y<0)
- break;
- j++;
- } while (j<=DROPS_NUM);
-
- drops[cur_drop].x=RandU32%w;
- drops[cur_drop].y=0;
- }
-
- for (i=0;i<DROPS_NUM;i++) {
- if (drops[i].y>=0) {
- if (drops[i].y>=h-1)
- drops[i].y=-I32_MAX;
- else {
- x0=x1=drops[i].x;
- y0=y1=drops[i].y;
- if (GrPeek(cur_dc,x0,y0+1)==WHITE)
- y1++;
- else {
- c1=GrPeek(cur_dc,x0+1,y0);
- c2=GrPeek(cur_dc,x0-1,y0);
- if (c1==WHITE && c2!=WHITE)
- x1++;
- else if (c2==WHITE && c1!=WHITE)
- x1--;
- else if (c1==WHITE && c2==WHITE) {
- c1=GrPeek(cur_dc,x0+1,y0+1);
- c2=GrPeek(cur_dc,x0-1,y0+1);
- if (c1==WHITE && c2!=WHITE)
- x1++;
- else if (c2==WHITE && c1!=WHITE)
- x1--;
- else if (RandI16>=0)
- x1++;
- else
- x1--;
- }
- if (GrPeek(cur_dc,x1,y1+1)==WHITE)
- y1++;
- }
- if (GrPeek(cur_dc,x0,y0)==BLUE) {
- cur_dc->color=WHITE;
- GrPlot(cur_dc,x0,y0);
- }
- cur_dc->color=BLUE;
- GrPlot(cur_dc,x1,y1);
- drops[i].x=x1;
- drops[i].y=y1;
- }
- }
- }
- Sleep(10);
- }
-}
-
-U0 Init()
-{
- I64 i;
- MemSet(drops,0,sizeof(drops));
- for (i=0;i<DROPS_NUM;i++)
- drops[i].y=-I32_MAX;
-}
-
-U0 RainDrops()
-{
- I64 ch,sc;
- MenuPush(
- "File {"
- " Abort(,CH_SHIFT_ESC);"
- " Exit(,CH_ESC);"
- "}"
- "Play {"
- " Restart(,'\n');"
- " OpenUpper(,'1');"
- " OpenLower(,'2');"
- "}"
- );
- SettingsPush; //See SettingsPush
- AutoComplete;
- WinBorder;
- WinMax;
- DocCursor;
- DocClear;
- cur_dc=DCNew(GR_WIDTH,GR_HEIGHT);
- sc_1=Char2ScanCode('1');
- sc_2=Char2ScanCode('2');
- Init;
- Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs);
- Fs->draw_it=&DrawIt;
- try {
- do
- switch (ch=GetKey(&sc)) {
- case '\n':
- Init;
- break;
- }
- while (ch!=CH_ESC && ch!=CH_SHIFT_ESC);
- } catch
- PutExcept;
- SettingsPop;
- MenuPop;
- DCDel(cur_dc);
-}
-
-RainDrops;
- - - \ No newline at end of file diff --git a/public/src/Demo/Games/RawHide.HC.HTML b/public/src/Demo/Games/RawHide.HC.HTML deleted file mode 100644 index 23ec46e..0000000 --- a/public/src/Demo/Games/RawHide.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - RawHide.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Games/Rocket.HC.HTML b/public/src/Demo/Games/Rocket.HC.HTML deleted file mode 100644 index 82e9a38..0000000 --- a/public/src/Demo/Games/Rocket.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Rocket.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Games/RocketScience.HC.HTML b/public/src/Demo/Games/RocketScience.HC.HTML deleted file mode 100644 index 092601b..0000000 --- a/public/src/Demo/Games/RocketScience.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - RocketScience.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Games/Squirt.HC.HTML b/public/src/Demo/Games/Squirt.HC.HTML deleted file mode 100644 index 968c145..0000000 --- a/public/src/Demo/Games/Squirt.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Squirt.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Games/Stadium/Stadium.HC.HTML b/public/src/Demo/Games/Stadium/Stadium.HC.HTML deleted file mode 100644 index a8591f7..0000000 --- a/public/src/Demo/Games/Stadium/Stadium.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Stadium.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Games/Stadium/StadiumGen.HC.HTML b/public/src/Demo/Games/Stadium/StadiumGen.HC.HTML deleted file mode 100644 index 0362014..0000000 --- a/public/src/Demo/Games/Stadium/StadiumGen.HC.HTML +++ /dev/null @@ -1,45 +0,0 @@ - - - - - StadiumGen.HC - - - - - //Generate "StadiumBG.GR.Z" from "StadiumBG.DD.Z"
-
-U0 StadiumGen()
-{
- U0 (*fp_old_update)(CDC *dc);
- CDC *dc,*dc2;
-
- Cd(__DIR__);
- AutoComplete;
- WinBorder;
- WinMax;
- DocCursor(OFF);
- DocClear;
- Type("StadiumBG.DD");
- "$CM,0,%d$",TEXT_ROWS-3;
- fp_old_update=gr.fp_final_scrn_update; //hide mouse cursor
- gr.fp_final_scrn_update=NULL;
-
- Refresh(2,TRUE);
- dc2=DCScrnCapture;
- dc=DCExt(dc2,0,FONT_HEIGHT,GR_WIDTH,GR_HEIGHT);
- DCDel(dc2);
-
- GRWrite("StadiumBG",dc,DCSF_COMPRESSED|DCSF_PALETTE_GET);
- DCDel(dc);
-
- DocCursor(ON);
- gr.fp_final_scrn_update=fp_old_update;
- DocClear;
-}
-
-StadiumGen;
-
- - - \ No newline at end of file diff --git a/public/src/Demo/Games/Talons.HC.HTML b/public/src/Demo/Games/Talons.HC.HTML deleted file mode 100644 index 709268a..0000000 --- a/public/src/Demo/Games/Talons.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Talons.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Games/TheDead.HC.HTML b/public/src/Demo/Games/TheDead.HC.HTML deleted file mode 100644 index 22399ce..0000000 --- a/public/src/Demo/Games/TheDead.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - TheDead.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Games/TicTacToe.HC.HTML b/public/src/Demo/Games/TicTacToe.HC.HTML deleted file mode 100644 index 7d663a5..0000000 --- a/public/src/Demo/Games/TicTacToe.HC.HTML +++ /dev/null @@ -1,137 +0,0 @@ - - - - - TicTacToe.HC - - - - - I8 board [9];
-I64 board_x[9]={150,250,350,150,250,350,150,250,350};
-I64 board_y[9]={150,150,150,250,250,250,350,350,350};
-
-U0 DrawX(CDC *dc,I64 x,I64 y)
-{
- dc->thick=5;
- GrLine3(dc,x-20,y-20,0,x+20,y+20,0);
- GrLine3(dc,x+20,y-20,0,x-20,y+20,0);
-}
-
-U0 DrawO(CDC *dc,I64 x,I64 y)
-{
- dc->thick=5;
- GrCircle3(dc,x,y,0,25);
-}
-
-U0 DrawBoard(I64 player)
-{
- I64 i;
- CDC *dc=DCAlias;
- DCFill;
- dc->thick=5;
- GrLine3(dc,200,100,0,200,400,0);
- GrLine3(dc,300,100,0,300,400,0);
- GrLine3(dc,100,200,0,400,200,0);
- GrLine3(dc,100,300,0,400,300,0);
- for (i=0;i<9;i++)
- switch (board[i]) {
- case 1:
- DrawX(dc,board_x[i],board_y[i]);
- break;
- case 2:
- DrawO(dc,board_x[i],board_y[i]);
- break;
-
- }
-//ms.pos.x,ms.pos.y are mouse x,y.
- //ms.lb is mouse left bttn
- if (player==1)
- DrawX(dc,ms.pos.x-Fs->pix_left,ms.pos.y-Fs->pix_top);
- else
- DrawO(dc,ms.pos.x-Fs->pix_left,ms.pos.y-Fs->pix_top);
- DCDel(dc);
-}
-
-U0 TakeTurn(I64 player)
-{
- I64 i,x=0,y=0;
- while (!(100<=x<400) || !(100<=y<400) || board[i]) {
- if (player==1)
- Beep;
- else
- Beep(74);
- while (!ms.lb) {
- DrawBoard(player);
- Refresh;
- }
- while (ms.lb) {
- DrawBoard(player);
- Refresh;
- }
- x=ms.pos.x-Fs->pix_left;
- y=ms.pos.y-Fs->pix_top;
- i=(x-100)/100+(y-100)/100*3;
- }
- board[i]=player;
-}
-
-Bool CheckWinner(I64 player)
-{
- if ( player==board[0]==board[1]==board[2] ||
- player==board[3]==board[4]==board[5] ||
- player==board[6]==board[7]==board[8] ||
-
- player==board[0]==board[3]==board[6] ||
- player==board[1]==board[4]==board[7] ||
- player==board[2]==board[5]==board[8] ||
-
- player==board[0]==board[4]==board[8] ||
- player==board[2]==board[4]==board[6] )
- return TRUE;
- else
- return FALSE;
-}
-
-U0 DoGame()
-{
- I64 moves=0;
- MemSet(board,0,sizeof(board));
- while (TRUE) {
- TakeTurn(1);
- if (CheckWinner(1)) {
- Beep;
- Beep;
- Beep;
- break;
- }
- if (++moves==9) break;
-
- TakeTurn(2);
- if (CheckWinner(2)) {
- Beep(74);
- Beep(74);
- Beep(74);
- break;
- }
- if (++moves==9) break;
- }
-}
-
-U0 TicTacToe()
-{
- WinMax; //Maximize window
- DocClear; //Clear window text.
- "$GREEN$CTRL-ALT-c$FG$ to exit.\n";
- try
- while (TRUE)
- DoGame;
- catch
- PutExcept;
- DCFill;
-}
-
-TicTacToe;
- - - \ No newline at end of file diff --git a/public/src/Demo/Games/TreeCheckers.HC.HTML b/public/src/Demo/Games/TreeCheckers.HC.HTML deleted file mode 100644 index 53213bc..0000000 --- a/public/src/Demo/Games/TreeCheckers.HC.HTML +++ /dev/null @@ -1,369 +0,0 @@ - - - - - TreeCheckers.HC - - - - - U0 InitDefines()
-{
- I64 w=GR_WIDTH,h=GR_HEIGHT-FONT_HEIGHT,cols,rows,
- size=PopUpRangeI64(1,9,,"Size\n"),rad=16-size;
- if (size<0) throw;
- DefinePrint("UNITS_NUM","%d",4096/SqrI64(rad)&~1);
- DefinePrint("CIRCLE_RAD","%d",rad);
- DefinePrint("MOVE_CIRCLES","%d",40/rad);
-
- cols=(w-8-rad)/(2*rad)&~1-1;
- DefinePrint("BORDER_X","%d",(w+rad-cols*2*rad)/2);
-
- rows=(h-8)/(2*rad)&~1;
- DefinePrint("BORDER_Y","%d",(h-rows*2*rad)/2);
-
-} InitDefines;
-
-class Unit
-{
- I64 num,x,y,player,link,color;
- Bool alive,king;
-} u[UNITS_NUM];
-
-CDC *map_dc;
-I64 cur_player,num_alive[2],start_x,start_y,end_x,end_y;
-Bool show_start;
-
-U0 S2Circle(I64 *_x,I64 *_y)
-{
- I64 i,j;
- j=(*_y-BORDER_Y)/(CIRCLE_RAD*2);
- if (j&1)
- i=(*_x-CIRCLE_RAD-BORDER_X)/(CIRCLE_RAD*2);
- else
- i=(*_x-BORDER_X)/(CIRCLE_RAD*2);
- *_y=j;
- *_x=i;
-}
-
-U0 Circle2S(I64 *_x,I64 *_y)
-{
- I64 j=*_y,i=*_x;
- *_y=j*CIRCLE_RAD*2+CIRCLE_RAD+BORDER_Y;
- *_x=i*CIRCLE_RAD*2+CIRCLE_RAD+BORDER_X;
- if (j&1) *_x+=CIRCLE_RAD;
-}
-
-U0 S2W(I64 *_x,I64 *_y)
-{
- S2Circle(_x,_y);
- Circle2S(_x,_y);
-}
-
-U0 DrawIt(CTask *task,CDC *dc)
-{
- I64 i;
- map_dc->flags|=DCF_NO_TRANSPARENTS;
- GrBlot(dc,0,0,map_dc);
-
- if (cur_player==0) {
- dc->color=LTCYAN;
- GrFloodFill(dc,0,0);
- dc->color=CYAN;
- } else {
- dc->color=LTPURPLE;
- GrFloodFill(dc,0,0);
- dc->color=PURPLE;
- }
- GrPrint(dc,2,2,"Player %d",cur_player+1);
-
- for (i=0;i<UNITS_NUM;i++)
- if (u[i].alive) {
- dc->color=u[i].color;
- GrFloodFill(dc,u[i].x,u[i].y);
- }
- for (i=0;i<UNITS_NUM;i++)
- if (u[i].alive && !u[i].king) {
- dc->color=BLACK;
- GrLine(dc,u[i].x,u[i].y,u[u[i].link].x,u[u[i].link].y);
- if (Blink) {
- dc->color=BLUE;
- dc->thick=6;
- GrPlot3(dc,(u[i].x+u[u[i].link].x)>>1,(u[i].y+u[u[i].link].y)>>1,0);
- }
- }
- if (show_start) {
- dc->color=LTRED;
- GrLine(dc,start_x-4,start_y-4,start_x+4,start_y+4);
- GrLine(dc,start_x-4,start_y+4,start_x+4,start_y-4);
- GrLine(dc,start_x,start_y,end_x,end_y);
- }
- if ((num_alive[0]==1 || num_alive[1]==1) && Blink(4)) {
- dc->color=BLACK;
- GrPrint(dc,(task->pix_width-FONT_WIDTH*9)>>1,
- (task->pix_height-FONT_HEIGHT)>>1,"Game Over");
- }
-}
-
-Unit *UnitFind(I64 x,I64 y,I64 player)
-{
- I64 i,dd,best_dd=I64_MAX;
- Unit *res=NULL;
- for (i=0;i<UNITS_NUM;i++) {
- if (u[i].player==player && u[i].alive) {
- dd=SqrI64(u[i].x-x)+SqrI64(u[i].y-y);
- if (dd<best_dd) {
- best_dd=dd;
- res=&u[i];
- }
- }
- }
- return res;
-}
-
-U0 KillsChk(I64 x1,I64 y1,I64 player)
-{
- I64 i,j,x2,y2,dd;
- Bool found;
- for (i=0;i<UNITS_NUM;i++) {
- if (u[i].player!=player && u[i].alive && !u[i].king) {
- x2=(u[i].x+u[u[i].link].x)>>1;
- y2=(u[i].y+u[u[i].link].y)>>1;
- dd=SqrI64(x2-x1)+SqrI64(y2-y1);
- if (dd<=(CIRCLE_RAD+2)*(CIRCLE_RAD+2)) {
- u[i].alive=FALSE;
- Snd(62);Sleep(100);Snd;Sleep(25);
- num_alive[u[i].player]--;
- do {
- found=FALSE;
- for (j=0;j<UNITS_NUM;j++)
- if (u[j].alive && u[j].player!=player && !u[j].king &&
- !u[u[j].link].alive) {
- found=TRUE;
- u[j].alive=FALSE;
- Snd(62);Sleep(100);Snd;Sleep(25);
- num_alive[u[j].player]--;
- }
- } while (found);
- }
- }
- }
-}
-
-Bool UnitMove(Unit *tmpu,I64 x2,I64 y2)
-{
- I64 i,r,c,r2,c2,x=start_x,y=start_y;
- S2W(&x2,&y2);
- c2=x2; r2=y2;
- S2Circle(&c2,&r2);
- for (i=0;i<MOVE_CIRCLES+1;i++) {
- c=x; r=y;
- S2Circle(&c,&r);
- if (c==c2 && r==r2) {
- end_x=tmpu->x=x2;
- end_y=tmpu->y=y2;
- return TRUE;
- }
- if (r2!=r) {
- if (r&1) {
- if (c<c2) c++;
- } else {
- if (c>c2) c--;
- }
- }
- if (r2>r) {
- x=c; y=++r;
- Circle2S(&x,&y);
- } else if (r2<r) {
- x=c; y=--r;
- Circle2S(&x,&y);
- } else if (c2>c) {
- x=++c; y=r;
- Circle2S(&x,&y);
- } else if (c2<c) {
- x=--c; y=r;
- Circle2S(&x,&y);
- }
- }
- return FALSE;
-}
-
-CDC *DrawHexMap(I64 *_w,I64 *_h)
-{
- CDC *dc=DCNew(*_w,*_h);
- I64 i,j,x,y;
- *_w=(dc->width-BORDER_X*2-CIRCLE_RAD)/(CIRCLE_RAD*2);
- *_h=(dc->height-BORDER_Y*2)/(CIRCLE_RAD*2);
- DCFill(dc,WHITE);
- dc->color=LTGRAY;
- for (j=0;j<*_h;j++) {
- for (i=0;i<*_w;i++) {
- x=i*CIRCLE_RAD*2+BORDER_X+CIRCLE_RAD;
- y=j*CIRCLE_RAD*2+BORDER_Y+CIRCLE_RAD;
- if (j&1) x+=CIRCLE_RAD;
- S2W(&x,&y);
- GrCircle(dc,x,y,CIRCLE_RAD);
- }
- }
- *_w*=CIRCLE_RAD*2;
- *_h*=CIRCLE_RAD*2;
- return dc;
-}
-
-U0 Init()
-{
- I64 i,j,j1,j2,dd,best_dd,best,w=Fs->pix_width,h=Fs->pix_height;
-
- map_dc=DrawHexMap(&w,&h);
- cur_player=0;
-
- for (i=0;i<UNITS_NUM/2;i++) {
- u[i].num=i;
- u[i+UNITS_NUM/2].num=i+UNITS_NUM/2;
-
-ti_restart:
- u[i].y=FloorI64(RandU32%h,CIRCLE_RAD*2)+CIRCLE_RAD;
- u[i+UNITS_NUM/2].y=h-1-u[i].y;
- j1=u[i].y/(CIRCLE_RAD*2);
- j2=u[i+UNITS_NUM/2].y/(CIRCLE_RAD*2);
- u[i].y+=BORDER_Y;
- u[i+UNITS_NUM/2].y+=BORDER_Y;
-
- if (!i) {
- u[i].x=CIRCLE_RAD;
- if (j1&1)
- goto ti_restart;
- } else
- u[i].x=FloorI64(RandU32%((w-CIRCLE_RAD*2*2)/2),CIRCLE_RAD*2)+CIRCLE_RAD;
- u[i+UNITS_NUM/2].x=w-1-u[i].x;
-
- if (j1&1)
- u[i].x+=CIRCLE_RAD;
- if (j2&1)
- u[i+UNITS_NUM/2].x+=CIRCLE_RAD;
- u[i].x+=BORDER_X;
- u[i+UNITS_NUM/2].x+=BORDER_X;
-
- S2W(&u[i].x,&u[i].y);
- S2W(&u[i+UNITS_NUM/2].x,&u[i+UNITS_NUM/2].y);
-
- u[i].player=0;
- u[i+UNITS_NUM/2].player=1;
-
- u[i].alive=TRUE;
- u[i+UNITS_NUM/2].alive=TRUE;
-
- if (!i) {
- u[i].color=LTCYAN;
- u[i+UNITS_NUM/2].color=LTPURPLE;
- u[i].king=TRUE;
- u[i+UNITS_NUM/2].king=TRUE;
- } else {
- u[i].color=CYAN;
- u[i+UNITS_NUM/2].color=PURPLE;
- u[i].king=FALSE;
- u[i+UNITS_NUM/2].king=FALSE;
- }
- }
- for (i=0;i<UNITS_NUM/2;i++) {
- if (!u[i].king) {
- best_dd=I64_MAX;
- for (j=0;j<UNITS_NUM/2;j++) {
- if (i!=j) {
- dd=SqrI64(u[i].x-u[j].x)+SqrI64(u[i].y-u[j].y);
- if ((u[j].x<u[i].x || u[j].king) && dd<best_dd ) {
- best_dd=dd;
- best=j;
- }
- }
- }
- u[i].link=best;
- u[i+UNITS_NUM/2].link=best+UNITS_NUM/2;
- }
- }
- num_alive[0]=UNITS_NUM/2;
- num_alive[1]=UNITS_NUM/2;
-}
-
-U0 CleanUp()
-{
- DCDel(map_dc);
-}
-
-U0 TreeCheckers()
-{
- I64 msg_code,arg1,arg2,ch,sc;
- Unit *tmpu;
-
- SettingsPush; //See SettingsPush
- MenuPush(
- "File {"
- " Abort(,CH_SHIFT_ESC);"
- " Exit(,CH_ESC);"
- "}"
- "Play {"
- " Restart(,'\n');"
- "}"
- );
- AutoComplete;
- WinBorder;
- WinMax;
- DocCursor;
- DocClear;
- PopUpOk("Step on the link mid points.\n");
- Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS
- -WIF_SELF_BORDER-WIF_FOCUS_TASK_MENU;
- try {
-cn_start:
- Init;
- tmpu=NULL;
- show_start=FALSE;
- Fs->draw_it=&DrawIt;
- while (TRUE) {
- msg_code=GetMsg(&arg1,&arg2,
- 1<<MSG_KEY_DOWN+1<<MSG_MS_L_DOWN+1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
- switch (msg_code) {
- case MSG_KEY_DOWN:
- switch (arg1) {
- case '\n':
- CleanUp;
- goto cn_start;
- case CH_ESC:
- case CH_SHIFT_ESC:
- goto cn_done;
- }
- break;
- case MSG_MS_L_DOWN:
- if (num_alive[0]>1 && num_alive[1]>1) {
- tmpu=UnitFind(arg1,arg2,cur_player);
- end_x=start_x=tmpu->x;
- end_y=start_y=tmpu->y;
- show_start=TRUE;
- }
- break;
- case MSG_MS_MOVE:
- if (tmpu)
- UnitMove(tmpu,arg1,arg2);
- break;
- case MSG_MS_L_UP:
- UnitMove(tmpu,arg1,arg2);
- KillsChk(tmpu->x,tmpu->y,cur_player);
- show_start=FALSE;
- tmpu=NULL;
- cur_player=1-cur_player;
- break;
- }
- }
-cn_done:
- GetMsg(,,1<<MSG_KEY_UP);
- } catch
- PutExcept;
- SettingsPop;
- CleanUp;
- MenuPop;
-}
-
-TreeCheckers;
- - - \ No newline at end of file diff --git a/public/src/Demo/Games/Varoom.HC.HTML b/public/src/Demo/Games/Varoom.HC.HTML deleted file mode 100644 index f84109d..0000000 --- a/public/src/Demo/Games/Varoom.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Varoom.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Games/Wenceslas.HC.HTML b/public/src/Demo/Games/Wenceslas.HC.HTML deleted file mode 100644 index 1ecbbfd..0000000 --- a/public/src/Demo/Games/Wenceslas.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Wenceslas.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Games/Whap.HC.HTML b/public/src/Demo/Games/Whap.HC.HTML deleted file mode 100644 index d532ea7..0000000 --- a/public/src/Demo/Games/Whap.HC.HTML +++ /dev/null @@ -1,185 +0,0 @@ - - - - - Whap.HC - - - - - #define BALLS_NUM 7
-#define SPRINGS_NUM 3
-
-#define STRETCH 500.0
-#define GRAVITY 50.0 //not really gravity
-#define BALL_RADIUS 5
-#define BASE_SIZE 10
-
-CMass balls[BALLS_NUM];
-CSpring springs[SPRINGS_NUM];
-F64 collision_t;
-
-U0 DrawIt(CTask *task,CDC *dc)
-{
- I64 i,
- cx=task->pix_width>>1,
- cy=task->pix_height>>1;
- Bool snd_on=FALSE;
- dc->color=BLACK;
- GrPrint(dc,0,0,"Protect your base.");
- GrRect(dc,cx-BASE_SIZE,cy-BASE_SIZE,BASE_SIZE*2,BASE_SIZE*2);
- dc->color=CYAN;
- GrRect(dc,cx-BASE_SIZE+2,cy-BASE_SIZE+2,BASE_SIZE*2-4,BASE_SIZE*2-4);
- dc->color=YELLOW;
- GrLine(dc,balls[0].x,balls[0].y,
- ms.pos.x-task->pix_left-task->scroll_x,
- ms.pos.y-task->pix_top-task->scroll_y);
- for (i=0;i<SPRINGS_NUM;i++)
- GrLine(dc,springs[i].end1->x,springs[i].end1->y,
- springs[i].end2->x,springs[i].end2->y);
-
- dc->color=LTCYAN;
- GrCircle(dc,balls[0].x,balls[0].y,BALL_RADIUS);
- GrFloodFill(dc,balls[0].x,balls[0].y,TRUE);
- dc->color=BLACK;
- GrCircle(dc,balls[0].x,balls[0].y,BALL_RADIUS);
-
- for (i=1;i<BALLS_NUM;i++) {
- dc->color=LTPURPLE;
- GrCircle(dc,balls[i].x,balls[i].y,BALL_RADIUS);
- GrFloodFill(dc,balls[i].x,balls[i].y,TRUE);
- if (cx-BASE_SIZE-BALL_RADIUS<=balls[i].x<=cx+BASE_SIZE+BALL_RADIUS &&
- cy-BASE_SIZE-BALL_RADIUS<=balls[i].y<=cy+BASE_SIZE+BALL_RADIUS)
- snd_on=TRUE;
- dc->color=BLACK;
- GrCircle(dc,balls[i].x,balls[i].y,BALL_RADIUS);
- }
- if (snd_on)
- Snd(74);
- else
- Snd;
-}
-
-U0 MyDerivative(CMathODE *ode,F64 t,COrder2D3 *,COrder2D3 *)
-{
- I64 i,j;
- F64 d,dd;
- CD3 p,p2;
- CTask *task=ode->win_task;
-
- D3SubEqu(D3Equ(&p2,
- ms.pos.x-task->pix_left-task->scroll_x,
- ms.pos.y-task->pix_top-task->scroll_y,0),
- &balls[0].state->x);
- D3AddEqu(&balls[0].DstateDt->DxDt,D3MulEqu(&p2,STRETCH));
-
- D3Equ(&p2,task->pix_width>>1,task->pix_height>>1,0);
- for (i=1;i<BALLS_NUM;i++) {
- D3Sub(&p,&p2,&balls[i].state->x);
- if (d=D3Norm(&p)) {
-//Gravity would be /(d*d*d), but that's too exponential.
- D3MulEqu(&p,GRAVITY/d);
- D3AddEqu(&balls[i].DstateDt->DxDt,&p);
- }
- }
-
- for (i=0;i<BALLS_NUM;i++)
- for (j=i+1;j<BALLS_NUM;j++) {
- D3Sub(&p,&balls[j].state->x,&balls[i].state->x);
- dd=D3NormSqr(&p);
- if (dd<=(2*BALL_RADIUS)*(2*BALL_RADIUS)) {
- if (t-collision_t>0.05) {
- Noise(50,102,105);
- collision_t=t;
- }
- d=Sqrt(dd)+0.0001;
- dd=10.0*Sqr(Sqr((2*BALL_RADIUS)*(2*BALL_RADIUS)-dd));
- D3MulEqu(&p,dd/d);
- D3AddEqu(&balls[j].DstateDt->DxDt,&p);
- D3SubEqu(&balls[i].DstateDt->DxDt,&p);
- }
- }
-
- d=balls[0].state->x;
- if (d-BALL_RADIUS<0)
- balls[0].DstateDt->DxDt+=Sqr(Sqr(Sqr(d-BALL_RADIUS)));
- if (d+BALL_RADIUS>task->pix_width)
- balls[0].DstateDt->DxDt-=Sqr(Sqr(Sqr((d+BALL_RADIUS)-task->pix_width)));
-
- d=balls[0].state->y;
- if (d-BALL_RADIUS<0)
- balls[0].DstateDt->DyDt+=Sqr(Sqr(Sqr(d-BALL_RADIUS)));
- if (d+BALL_RADIUS>task->pix_height)
- balls[0].DstateDt->DyDt-=Sqr(Sqr(Sqr((d+BALL_RADIUS)-task->pix_height)));
-}
-
-U0 Whap()
-{
- I64 i;
- CMathODE *ode=ODENew(0,1e-2,ODEF_HAS_MASSES);
-
- SettingsPush; //See SettingsPush
- AutoComplete;
- WinBorder;
- WinMax;
-
- MenuPush(
- "File {"
- " Abort(,CH_SHIFT_ESC);"
- " Exit(,CH_ESC);"
- "}"
- );
- ode->derive=&MyDerivative;
- ode->drag_v2=0.002;
- ode->drag_v3=0.00001;
- ode->acceleration_limit=5e3;
- MemSet(balls,0,BALLS_NUM*sizeof(CMass));
- D3Equ(&balls[0].x,100,100,0);
- for (i=1;i<BALLS_NUM;i++)
- D3Equ(&balls[i].x,
- RandI16%500+Fs->pix_width>>1,RandI16%500+Fs->pix_height>>1,0);
- balls[0].x=ms.pos.x-Fs->pix_left-Fs->scroll_x;
- balls[0].y=ms.pos.y-Fs->pix_top-Fs->scroll_y;
- for (i=0;i<BALLS_NUM;i++) {
- balls[i].mass=1.0;
- balls[i].drag_profile_factor=1.0;
- QueIns(&balls[i],ode->last_mass);
- }
- balls[2].x=balls[1].x+15;
- balls[2].y=balls[1].y;
- balls[3].x=balls[1].x;
- balls[3].y=balls[1].y+15;
- MemSet(springs,0,SPRINGS_NUM*sizeof(CSpring));
- springs[0].end1=&balls[1];
- springs[0].end2=&balls[2];
- springs[0].rest_len=15;
- springs[0].const=10000;
- QueIns(&springs[0],ode->last_spring);
- springs[1].end1=&balls[1];
- springs[1].end2=&balls[3];
- springs[1].rest_len=15;
- springs[1].const=10000;
- QueIns(&springs[1],ode->last_spring);
- springs[2].end1=&balls[2];
- springs[2].end2=&balls[3];
- springs[2].rest_len=sqrt2*15;
- springs[2].const=10000;
- QueIns(&springs[2],ode->last_spring);
-
- collision_t=0;
- QueIns(ode,Fs->last_ode);
-
- DocCursor;
- DocClear;
- Fs->draw_it=&DrawIt;
- GetChar;
- SettingsPop;
- QueRem(ode);
- ODEDel(ode);
- MenuPop;
-}
-
-Whap;
- - - \ No newline at end of file diff --git a/public/src/Demo/Games/Zing.HC.HTML b/public/src/Demo/Games/Zing.HC.HTML deleted file mode 100644 index a8495bc..0000000 --- a/public/src/Demo/Games/Zing.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Zing.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Games/ZoneOut.HC.HTML b/public/src/Demo/Games/ZoneOut.HC.HTML deleted file mode 100644 index fb2cb91..0000000 --- a/public/src/Demo/Games/ZoneOut.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - ZoneOut.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/GlblVars.HC.HTML b/public/src/Demo/GlblVars.HC.HTML deleted file mode 100644 index 821294c..0000000 --- a/public/src/Demo/GlblVars.HC.HTML +++ /dev/null @@ -1,88 +0,0 @@ - - - - - GlblVars.HC - - - - - //Demonstrates dynamic initialization of vars.
-//Static vars are, essentually, global vars.
-
-class Test
-{
- I32 time;
- U8 name[8];
-};
-
-Test g1[]={
- {10,"Name1"},
- {(tS%10.0)*100,"Name2"}, //Dynamic initialization
- {30,"Name3"}
-};
-
-D(g1,sizeof(g1));
-"Time 1:%d\n",g1[1].time;
-
-U0 Main1()
-{
- static Test s1[]={
- {10,"Static1"},
- {(tS%10.0)*100,"Static2"}, //Dynamic initialization
- {30,"Static3"}
- };
- D(s1,sizeof(s1));
- "Time 2:%d\n",s1[1].time;
-}
-
-Main1;
-
-/*Now, we'll use the data heap glbl option
-to force global vars onto the data heap.
-
-You can turn the data heap flag
-on and off within your programs, leaving
-ones which need initialization on the code heap.
-
-You can't dynamically initialize data heap
-glbls--they are consts.This might be a silly
-point, but might res in odd differences, perhaps
-from the order things are evaluated.
-
-Data heap glbls are good for AOT modules
-because they don't take-up room in the .BIN.Z file.
-*/
-
-#ifjit
-#exe {Option(OPTf_GLBLS_ON_DATA_HEAP,ON);};
-
-Test g2[]={
- {10,"name1"},
- {(tS%10.0)*100,"name2"}, //No dynamic initialization--cvted to const
- {30,"name3"}
-};
-
-D(g2,sizeof(g2));
-"Time 3:%d\n",g2[1].time;
-
-U0 Main2()
-{
- static Test s2[]={
- {10,"static1"},
- {(tS%10.0)*100,"static2"}, //No dynamic initialization--cvted to const
- {30,"static3"}
- };
- D(s2,sizeof(s2));
- "Time 4:%d\n",s2[1].time;
-}
-
-Main2;
-
-#exe {Option(OPTf_GLBLS_ON_DATA_HEAP,ON);};
-#endif
-
-'\n';
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/3DPoly.HC.HTML b/public/src/Demo/Graphics/3DPoly.HC.HTML deleted file mode 100644 index c826c43..0000000 --- a/public/src/Demo/Graphics/3DPoly.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - 3DPoly.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/BSpline.HC.HTML b/public/src/Demo/Graphics/BSpline.HC.HTML deleted file mode 100644 index e166c7e..0000000 --- a/public/src/Demo/Graphics/BSpline.HC.HTML +++ /dev/null @@ -1,47 +0,0 @@ - - - - - BSpline.HC - - - - - #define PTS_NUM 16
-
-U0 BSplineDemo()
-{
- CDC *dc=DCAlias;
- I64 arg1,arg2,i=0,msg_code;
- CD3I32 c[PTS_NUM];
-
- SettingsPush;
- Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;
-
- DocClear;
- "Sel ctrl points with left mouse.Right when finished.\n";
- DCFill;
- do {
- msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_R_UP);
- if (msg_code==MSG_MS_L_UP) {
- c[i].x=arg1; c[i].y=arg2; c[i].z=0;
- dc->color=GREEN;
- GrCircle(dc,arg1,arg2,10);
- i++;
- }
- } while (i<PTS_NUM && msg_code!=MSG_MS_R_UP);
- dc->color=RED;
- Gr2BSpline(dc,c,i,TRUE);
- dc->color=BLUE;
- Gr3BSpline(dc,c,i,TRUE);
- DCDel(dc);
- SettingsPop;
-
- PressAKey;
- DCFill;
-}
-
-BSplineDemo;
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/Balloon.HC.HTML b/public/src/Demo/Graphics/Balloon.HC.HTML deleted file mode 100644 index 2256d83..0000000 --- a/public/src/Demo/Graphics/Balloon.HC.HTML +++ /dev/null @@ -1,50 +0,0 @@ - - - - - Balloon.HC - - - - - // Classic Commodore 64 Sprite
-
-U8 a[60]={0,127,0,1,255,192,3,255,224,3,231,224,
- 7,217,240,7,223,240,7,217,240,3,231,224,
- 3,255,224,3,255,224,2,255,160,1,127,64,
- 1,62,64,0,156,128,0,156,128,0,73,0,0,73,0,
- 0,62,0,0,62,0,0,28,0};
-
-U0 Balloon()
-{
- I64 i,j,k;
-
- CLI
-
- OutU8(VGAP_IDX,VGAR_MAP_MASK);
- OutU8(VGAP_DATA,0xF);
- MemSetI64(text.vga_alias,0,640*480/64);
-
- OutU8(VGAP_IDX,VGAR_MAP_MASK);
- OutU8(VGAP_DATA,RED+GREEN+8);
- for (k=100;k<150;k++) {
-
- for (i=0;i<20;i++)
- for (j=0;j<3;j++)
- *(text.vga_alias(I64)+0x1000+(i+k)*640/8+j)(U8 *)=a[i*3+j];
-
- Busy(40000);
-
- for (i=0;i<20;i++)
- for (j=0;j<3;j++)
- *(text.vga_alias(I64)+0x1000+(i+k)*640/8+j)(U8 *)=0;
- }
-
- STI
- VGAFlush;
-}
-
-Balloon;
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/Blot.HC.HTML b/public/src/Demo/Graphics/Blot.HC.HTML deleted file mode 100644 index 0c6cfe6..0000000 --- a/public/src/Demo/Graphics/Blot.HC.HTML +++ /dev/null @@ -1,53 +0,0 @@ - - - - - Blot.HC - - - - - CDC *dc=DCAlias;
-CDC *img1=DCNew(64,64);
-CDC *img2=DCNew(512,512);
-
-img1->color=COLOR_MONO;
-img1->thick=3;
-GrCircle(img1,30,30,20);
-GrFloodFill3(img1,30,30,0,TRUE);
-GrLine3(img1,60,0,0,0,60,0);
-
-DCFill(img2);
-img2->color=RED;
-img2->brush=img1;
-GrCircle(img2,256-30,256-30,128,67);
-img2->color=BLUE;
-img2->thick=6;
-img2->brush=NULL;
-GrLine3(img2,128,128,0,256+128,256+128,0);
-GrLine3(img2,256+128,128,0,128,256+128,0);
-
-img2->color=YELLOW;
-GrRect(img2,256-20,256-20,40,40);
-
-I64 i;
-for (i=0;i<256;i+=4) {
- Refresh;
- DCFill;
- GrBlot(dc,i-256,i-256,img2);
- Sleep(10);
-}
-U8 *tmpg=DC2Sprite(img1);
-Sprite(tmpg);
-Free(tmpg);
-"%h9c",'\n';
-
-DCDel(img1);
-DCDel(img2);
-DCDel(dc);
-
-PressAKey;
-DCFill;
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/Bounce.HC.HTML b/public/src/Demo/Graphics/Bounce.HC.HTML deleted file mode 100644 index e964d8f..0000000 --- a/public/src/Demo/Graphics/Bounce.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Bounce.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/Box.HC.HTML b/public/src/Demo/Graphics/Box.HC.HTML deleted file mode 100644 index 8942a72..0000000 --- a/public/src/Demo/Graphics/Box.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Box.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/Cartesian.HC.HTML b/public/src/Demo/Graphics/Cartesian.HC.HTML deleted file mode 100644 index 82c60a7..0000000 --- a/public/src/Demo/Graphics/Cartesian.HC.HTML +++ /dev/null @@ -1,60 +0,0 @@ - - - - - Cartesian.HC - - - - - //x must be global.
-//Might as well make y global.
-
-F64 x,y,y_last;
-
-U0 Cartesian()
-{
- U8 *st;
- I64 ch=0,h,v;
- Bool first;
- CDC *dc=DCAlias;
- do {
- DocClear;
- "Enter algebraic equation to graph.\n"
- "Example: y=2*x\n"
- "y=";
- if (st=GetStr) {
- if (*st) {
- h=Fs->pix_width/2;
- v=Fs->pix_height/2;
- dc->color=RED;
- GrLine(dc,h,0,h,2*v+1);
- GrLine(dc,0,v,2*h+1,v);
- first=TRUE;
- dc->color=BLACK;
- for (x=-h;x<=h;x++) {
- y=-ExePrint("ToF64(%s);",st)(F64);
- if (!first)
- GrLine(dc,x-1+h,y_last+v,x+h,y+v);
- y_last=y;
- first=FALSE;
- }
- ch=GetChar;
- } else
- ch=CH_SHIFT_ESC;
- Free(st);
- } else
- ch=CH_SHIFT_ESC;
- DCFill;
- } while (ch!=CH_SHIFT_ESC && ch!=CH_ESC);
- DCDel(dc);
-}
-
-Cartesian;
-
-//For better performance, compile the expression entered by the
-//user one time with LexExpression2Bin() and use Call().
-//See /Demo/CompileDemo.HC.
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/CharAnimation.HC.HTML b/public/src/Demo/Graphics/CharAnimation.HC.HTML deleted file mode 100644 index 9bc1e37..0000000 --- a/public/src/Demo/Graphics/CharAnimation.HC.HTML +++ /dev/null @@ -1,42 +0,0 @@ - - - - - CharAnimation.HC - - - - - U8 *old_font=text.font;
-
-// See /Kernel/FontStd.HC, /Demo/ScrnCodes.HC,
-///Demo/ExtChars.HC, and /Demo/Graphics/FontEd.HC.
-
-U64 waves[4]={
-0x0011AA440011AA44,0x0022558800225588,
-0x0044AA110044AA11,0x0088552200885522};
-
-U0 AnimateEndCB()
-{
- text.font=old_font;
- Exit;
-}
-
-U0 AnimateTask(I64)
-{
- I64 i;
- U64 *font=MAlloc(256*8);
- Fs->task_end_cb=&AnimateEndCB;
- MemCpy(font,text.font,256*8);
- text.font=font;
- while (TRUE) {
- font[CH_SPACE]=waves[i++&0x3];
- Sleep(100);
- }
-}
-
-Spawn(&AnimateTask,NULL,"Animate",,Fs);
-TaskRep;
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/Collision.HC.HTML b/public/src/Demo/Graphics/Collision.HC.HTML deleted file mode 100644 index d803a5e..0000000 --- a/public/src/Demo/Graphics/Collision.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Collision.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/CommonAncestor.HC.HTML b/public/src/Demo/Graphics/CommonAncestor.HC.HTML deleted file mode 100644 index c8edba7..0000000 --- a/public/src/Demo/Graphics/CommonAncestor.HC.HTML +++ /dev/null @@ -1,132 +0,0 @@ - - - - - CommonAncestor.HC - - - - - #define N 32
-
-class Node
-{
- Node *left,*right;
- I64 n;
-};
-
-I64 n1,n2,common_ancestor;
-Node *root;
-
-#define X_SPACING 16
-#define Y_SPACING 45
-#define ARROW_SPACING 3
-
-U0 ShowTree(CDC *dc,Node *tmpn,I64 *_node_x,I64 *_tree_x,I64 y)
-{
- I64 node_x;
- if (tmpn) {
- if (tmpn->left) {
- ShowTree(dc,tmpn->left,&node_x,_tree_x,y+Y_SPACING);
- dc->color=BLUE;
- GrArrow3(dc,*_tree_x,y,0,
- node_x+ARROW_SPACING,y+Y_SPACING-ARROW_SPACING,0);
- }
- if (tmpn->n==n1 || tmpn->n==n2) {
- if (tmpn->n==common_ancestor)
- dc->color=YELLOW;
- else
- dc->color=RED;
- } else if (tmpn->n==common_ancestor)
- dc->color=GREEN;
- else
- dc->color=BLUE;
-
- *_node_x=*_tree_x;
- GrPrint(dc,*_node_x,y,"%d",tmpn->n);
- *_tree_x+=X_SPACING;
-
- if (tmpn->right) {
- ShowTree(dc,tmpn->right,&node_x,_tree_x,y+Y_SPACING);
- dc->color=BLUE;
- GrArrow3(dc,*_node_x,y,0,
- node_x-ARROW_SPACING,y+Y_SPACING-ARROW_SPACING,0);
- }
- }
-}
-
-U0 DrawIt(CTask *,CDC *dc)
-{
- I64 node_x=0,tree_x=0;
- ShowTree(dc,root,&node_x,&tree_x,20);
-}
-
-U0 TreeAdd(Node **_root,Node *tmpn)
-{
- Node *root=*_root;
- if (!root)
- *_root=tmpn;
- else if (tmpn->n==root->n)
- Free(tmpn);
- else if (tmpn->n<root->n)
- TreeAdd(&root->left,tmpn);
- else
- TreeAdd(&root->right,tmpn);
-}
-
-U0 TreeNew()
-{
- I64 i;
- Node *tmpn;
- for (i=0;i<N;i++) {
- tmpn=CAlloc(sizeof(Node));
- tmpn->n=RandU16%N;
-
- if (i==N-1)
- n1=tmpn->n;
- else if (i==N-2)
- n2=tmpn->n;
-
- TreeAdd(&root,tmpn);
- Sleep(50);
- }
-}
-
-U0 TreeCommonAncestorFind(Node *root)
-{
- if (root && root->n!=n1 && root->n!=n2) {
- common_ancestor=root->n;
- if (n1<root->n && n2<root->n)
- TreeCommonAncestorFind(root->left);
- else if (n1>root->n && n2>root->n)
- TreeCommonAncestorFind(root->right);
- }
-}
-
-U0 TreeCommonAncestor()
-{//Make tree and find common ancestor to n1 & n2.
- root=NULL;
- n1=n2=common_ancestor=0;
-
- SettingsPush; //See SettingsPush
- Fs->draw_it=&DrawIt;
- DocClear;
- "Scroll with {CTRL-Left Grab}.\n";
- try {
- TreeNew;
- TreeCommonAncestorFind(root);
- PressAKey;
- } catch
- PutExcept;
- SettingsPop;
-}
-
-TreeCommonAncestor;
-/*Be careful with recursive routines in TempleOS
-because the stack does not grow and will overflow.
-
-See /Demo/StkGrow.HC.
-*/
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/Doodle.HC.HTML b/public/src/Demo/Graphics/Doodle.HC.HTML deleted file mode 100644 index d1dc58c..0000000 --- a/public/src/Demo/Graphics/Doodle.HC.HTML +++ /dev/null @@ -1,59 +0,0 @@ - - - - - Doodle.HC - - - - - //This is a drawing program
-
-U0 Doodle()
-{
- I64 msg_code,i,x1,y1,x2,y2,arg1,arg2,color=BLACK;
- CDC *dc=DCAlias;
-
- SettingsPush; //See SettingsPush
- Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;
-
- AutoComplete;
- WinBorder;
- WinMax;
- DocClear;
- DCFill;
- do {
- msg_code=GetMsg(&arg1,&arg2,
- 1<<MSG_KEY_DOWN+1<<MSG_MS_L_DOWN+1<<MSG_MS_R_UP);
- switch (msg_code) {
- case MSG_MS_R_UP:
- i=PopUpColor;
- if (i>=0) color=i;
- break;
- case MSG_MS_L_DOWN:
- x1=arg1; y1=arg2;
- x2=arg1; y2=arg2;
- dc->color=ROP_XOR+color^TRANSPARENT;
- dc->thick=7;
- do {
- GrLine3(dc,x1,y1,0,x2,y2,0);
- msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
- GrLine3(dc,x1,y1,0,x2,y2,0);
- x2=arg1; y2=arg2;
- } while (msg_code!=MSG_MS_L_UP);
- GrLine3(dc,x1,y1,0,x2,y2,0);
- break;
- case MSG_KEY_DOWN:
- break;
- }
- } while (msg_code!=MSG_KEY_DOWN || !arg1);
- GetMsg(,,1<<MSG_KEY_UP);
- DCFill;
- DCDel(dc);
- SettingsPop;
-}
-
-Doodle; //Execute when #included
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/EdSprite.HC.HTML b/public/src/Demo/Graphics/EdSprite.HC.HTML deleted file mode 100644 index 4a61bf0..0000000 --- a/public/src/Demo/Graphics/EdSprite.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - EdSprite.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/Elephant.HC.HTML b/public/src/Demo/Graphics/Elephant.HC.HTML deleted file mode 100644 index e4754e6..0000000 --- a/public/src/Demo/Graphics/Elephant.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Elephant.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/Extents.HC.HTML b/public/src/Demo/Graphics/Extents.HC.HTML deleted file mode 100644 index 4971c2e..0000000 --- a/public/src/Demo/Graphics/Extents.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Extents.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/FontEd.HC.HTML b/public/src/Demo/Graphics/FontEd.HC.HTML deleted file mode 100644 index b355647..0000000 --- a/public/src/Demo/Graphics/FontEd.HC.HTML +++ /dev/null @@ -1,164 +0,0 @@ - - - - - FontEd.HC - - - - - /*After making a font...
-
-You can save it as a binary file with:
- FileWrite("filename.BIN.Z",text.font,256*FONT_HEIGHT);
-
-You can load it with:
- U64 *my_font=FileRead("filename.BIN.Z");
- text.aux_font=my_font;
-
-<CTRL-ALT-f> will toggle main font and aux_font.
-
-If you want to change the system font permanently,
-save to a file with this font editor program
-and cut and paste the code into /Kernel/FontStd.HC.
-You will need to recompile Kernel by calling BootHDIns().
-
-See /Demo/ExtChars.HC, /Demo/Games/CharDemo.HC,
-/Demo/Graphics/CharAnimation.HC and /Demo/ScrnCodes.HC.
-*/
-
-#define BLOW_UP_CHAR_X (18*FONT_WIDTH)
-#define BLOW_UP_CHAR_Y (4*FONT_HEIGHT)
-
-U8 cur_ch;
-
-U0 DrawIt(CTask *task,CDC *dc)
-{
- I64 i,j,k,c;
- TextPrint(task,0,0,BLUE<<4+YELLOW,"Press <CTRL-ALT-f> to Toggle Aux Font.");
- k=0;
- for (i=0;i<16;i++)
- for (j=0;j<16;j++) {
- if (k==cur_ch) {
- if (Blink)
- c=(BLUE<<4+YELLOW)<<8 + k++;
- else
- c=(YELLOW<<4+BLUE)<<8 + k++;
- } else
- c=(BLUE<<4+WHITE)<<8 + k++;
- TextChar(task,,j,i+2,c);
- }
-
- k=0;
- for (i=0;i<FONT_HEIGHT;i++)
- for (j=0;j<FONT_WIDTH;j++) {
- if (Bt(&text.font[cur_ch],k++))
- dc->color=YELLOW;
- else
- dc->color=BLUE;
- GrRect(dc,BLOW_UP_CHAR_X+j*FONT_WIDTH,
- BLOW_UP_CHAR_Y+i*FONT_HEIGHT,
- FONT_WIDTH,FONT_HEIGHT);
- }
-}
-
-U0 FESave(Bool pmt)
-{
- U8 old_draw_it=Fs->draw_it;
- CDoc *doc=DocNew;
- I64 i;
- for (i=0;i<256;i++) {
- DocPrint(doc,"0x%016X,",text.font[i]);
- if (Bt(char_bmp_safe_dollar,i))
- DocPrint(doc,"//%c",i);
- else if (i=='$')
- DocPrint(doc,"//$$",i);
- DocPrint(doc,"\n");
- }
- Fs->draw_it=NULL;
- DocWrite(doc,pmt);
- Fs->draw_it=old_draw_it;
- DocDel(doc);
-}
-
-U0 FontEd()
-{
- I64 msg_code,arg1,arg2,k;
- SettingsPush; //See SettingsPush
- MenuPush(
- "File {"
- " SaveAs(,CH_CTRLA);"
- " Abort(,CH_SHIFT_ESC);"
- " Exit(,CH_ESC);"
- "}");
- AutoComplete;
- DocCursor;
- DocClear;
- Fs->win_inhibit|=WIG_DBL_CLICK;
- cur_ch=0;
- try {
- Fs->draw_it=&DrawIt;
- while (TRUE) {
- switch (msg_code=GetMsg(&arg1,&arg2,
- 1<<MSG_KEY_DOWN|1<<MSG_MS_L_DOWN|1<<MSG_MS_R_DOWN|1<<MSG_MS_MOVE)) {
- case MSG_KEY_DOWN:
- switch (arg1) {
- case 0:
- switch (arg2.u8[0]) {
- case SC_CURSOR_LEFT:
- cur_ch--;
- break;
- case SC_CURSOR_RIGHT:
- cur_ch++;
- break;
- case SC_CURSOR_UP:
- cur_ch-=16;
- break;
- case SC_CURSOR_DOWN:
- cur_ch+=16;
- break;
-
- }
- break;
- goto fe_done;
- case CH_CTRLA:
- FESave(TRUE);
- break;
- case CH_ESC:
- FESave(FALSE);
- case CH_SHIFT_ESC:
- goto fe_done;
- default:
- cur_ch=arg1;
- }
- break;
- case MSG_MS_L_DOWN:
- case MSG_MS_R_DOWN:
- if (0<=arg1<FONT_WIDTH*16 && 0<=arg2-2*FONT_HEIGHT<FONT_HEIGHT*16) {
- cur_ch=(arg2/FONT_HEIGHT-2)*16+arg1/FONT_WIDTH;
- break;
- } //fall through
- case MSG_MS_MOVE:
- k=((arg2-BLOW_UP_CHAR_Y)/FONT_HEIGHT)*FONT_WIDTH+
- (arg1-BLOW_UP_CHAR_X)/FONT_WIDTH;
- if (0<=k<FONT_WIDTH*FONT_HEIGHT) {
- if (ms.lb||msg_code==MSG_MS_L_DOWN)
- Bts(&text.font[cur_ch],k);
- if (ms.rb||msg_code==MSG_MS_R_DOWN)
- Btr(&text.font[cur_ch],k);
- }
- break;
- }
- }
-fe_done:
- GetMsg(,,1<<MSG_KEY_UP);
- } catch
- PutExcept;
- MenuPop;
- SettingsPop;
-}
-
-FontEd;
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/Grid.HC.HTML b/public/src/Demo/Graphics/Grid.HC.HTML deleted file mode 100644 index 4b3b962..0000000 --- a/public/src/Demo/Graphics/Grid.HC.HTML +++ /dev/null @@ -1,42 +0,0 @@ - - - - - Grid.HC - - - - - #define GRID 5
-
-U0 DrawMyMs(CDC *dc,I64 x,I64 y)
-{
- dc->thick=1;
- dc->flags&=~(DCF_TRANSFORMATION|DCF_SYMMETRY);
- GrRect(dc,x,y,GRID,GRID);
-}
-
-U0 GridDemo()
-{
- CGridGlbls old_grid;
- U0 (*old_draw_ms)(CDC *dc,I64 x,I64 y); //Can't init this type of var.
- MemCpy(&old_grid,&ms_grid,sizeof(CGridGlbls));
- GridInit;
- ms_grid.snap=TRUE; //You can set other stuff.
- ms_grid.x=GRID;
- ms_grid.y=GRID;
- old_draw_ms=gr.fp_draw_ms;
- gr.fp_draw_ms=&DrawMyMs;
- while (!ms.lb) {//Left bttn to exit.
- GrPlot(,ms.pos.x,ms.pos.y);
- Yield;
- }
- DCFill;
- gr.fp_draw_ms=old_draw_ms;
- MemCpy(&ms_grid,&old_grid,sizeof(CGridGlbls));
-}
-
-GridDemo;
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/Hanoi.HC.HTML b/public/src/Demo/Graphics/Hanoi.HC.HTML deleted file mode 100644 index 3d5bf76..0000000 --- a/public/src/Demo/Graphics/Hanoi.HC.HTML +++ /dev/null @@ -1,166 +0,0 @@ - - - - - Hanoi.HC - - - - - #define DISKS_NUM 6
-#define PEDESTAL_HEIGHT 20
-#define DISK_HEIGHT 7
-#define DISK_UNIT_WIDTH 5
-
-I64 poles_x[3];
-I64 disks_x[DISKS_NUM],disks_y[DISKS_NUM],disks_pole[DISKS_NUM];
-
-I64 OtherPole(I64 pole1,I64 pole2)
-{
- return 3-pole1-pole2;
-}
-
-I64 TopDisk(I64 pole)
-{
- I64 i;
- for (i=0;i<DISKS_NUM;i++)
- if (disks_pole[i]==pole)
- return i;
- return -1;
-}
-
-I64 PosInStk(I64 pole,I64 disk)
-{
- I64 res=0,i;
- for (i=DISKS_NUM-1;i>disk;i--)
- if (disks_pole[i]==pole)
- res++;
- return res;
-}
-
-U0 SetDisksRestXY()
-{
- I64 i;
- for (i=0;i<DISKS_NUM;i++) {
- disks_x[i]=poles_x[disks_pole[i]];
- disks_y[i]=Fs->pix_height-PEDESTAL_HEIGHT
- -(DISK_HEIGHT+1)/2-1-(DISK_HEIGHT+1)*PosInStk(disks_pole[i],i);
- }
-}
-
-U0 DrawIt(CTask *task,CDC *dc)
-{
- I64 i;
-
- for (i=0;i<3;i++)
- poles_x[i]=(1+i)*task->pix_width/4;
-
- dc->color=BLACK;
- GrRect(dc,poles_x[0]-50,task->pix_height-PEDESTAL_HEIGHT,
- poles_x[2]-poles_x[0]+100,PEDESTAL_HEIGHT-FONT_HEIGHT);
- dc->color=DKGRAY;
- GrRect(dc,poles_x[0]-49,task->pix_height-PEDESTAL_HEIGHT+1,
- poles_x[2]-poles_x[0]+98,PEDESTAL_HEIGHT-FONT_HEIGHT-2);
-
- for (i=0;i<3;i++) {
- dc->color=BLACK;
- GrRect(dc,poles_x[i]-3,
- task->pix_height-PEDESTAL_HEIGHT-(DISKS_NUM+1)*(DISK_HEIGHT+1),
- 7,(DISKS_NUM+1)*(DISK_HEIGHT+1));
- dc->color=YELLOW;
- GrRect(dc,poles_x[i]-2,
- task->pix_height-PEDESTAL_HEIGHT+1-(DISKS_NUM+1)*(DISK_HEIGHT+1),
- 5,(DISKS_NUM+1)*(DISK_HEIGHT+1)-1);
- }
-
- for (i=0;i<DISKS_NUM;i++) {
- dc->color=BLACK;
- GrRect(dc,disks_x[i]-(i+1)*DISK_UNIT_WIDTH,
- disks_y[i]-DISK_HEIGHT/2,(i+1)*(DISK_UNIT_WIDTH*2)+1,DISK_HEIGHT);
- dc->color=gr_rainbow_10[i];
- GrRect(dc,disks_x[i]-(i+1)*DISK_UNIT_WIDTH+1,
- disks_y[i]-DISK_HEIGHT/2+1,(i+1)*(DISK_UNIT_WIDTH*2)-1,DISK_HEIGHT-2);
- }
-}
-
-U0 MySleep()
-{
- if (ScanChar)
- throw;
- Sleep(3);
-}
-
-U0 MoveDisks(I64 src_pole,I64 dst_pole,I64 num)
-{
- I64 top,x,y;
- if (num>1)
- MoveDisks(src_pole,OtherPole(src_pole,dst_pole),num-1);
- DocClear;
- "$CM+BY,0,0$Disk:%d from %d to %d\n",TopDisk(src_pole),src_pole,dst_pole;
-
- top=TopDisk(src_pole);
- for (y=disks_y[top];
- y>Fs->pix_height-PEDESTAL_HEIGHT-(DISK_HEIGHT+1)/2
- -(DISK_HEIGHT+1)*(DISKS_NUM+2);y--) {
- disks_y[top]=y;
- MySleep;
- }
- if (src_pole<dst_pole)
- for (x=poles_x[src_pole];x<=poles_x[dst_pole];x++) {
- disks_x[top]=x;
- MySleep;
- }
- else
- for (x=poles_x[src_pole];x>=poles_x[dst_pole];x--) {
- disks_x[top]=x;
- MySleep;
- }
-
- disks_pole[top]=dst_pole;
- for (y=disks_y[top];
- y<Fs->pix_height-PEDESTAL_HEIGHT-(DISK_HEIGHT+1)/2-1
- -(DISK_HEIGHT+1)*PosInStk(dst_pole,top);y++) {
- disks_y[top]=y;
- MySleep;
- }
- SetDisksRestXY;
- if (num>1)
- MoveDisks(OtherPole(src_pole,dst_pole),dst_pole,num-1);
-}
-
-U0 Init()
-{
- I64 i;
- for (i=0;i<3;i++)
- poles_x[i]=(1+i)*Fs->pix_width/4;
-
- for (i=0;i<DISKS_NUM;i++)
- disks_pole[i]=0;
-
- SetDisksRestXY;
-}
-
-U0 Hanoi()
-{
- SettingsPush; //See SettingsPush
- Init;
- DocClear;
- Fs->draw_it=&DrawIt;
-
- Sleep(1000);
- try {
- MoveDisks(0,2,DISKS_NUM);
- Beep; Beep;
- DocClear;
- DocBottom;
- PressAKey;
- } catch
- PutExcept;
- DocClear;
- SettingsPop;
-}
-
-Hanoi;
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/Lattice.HC.HTML b/public/src/Demo/Graphics/Lattice.HC.HTML deleted file mode 100644 index 50d1134..0000000 --- a/public/src/Demo/Graphics/Lattice.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Lattice.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/Life.HC.HTML b/public/src/Demo/Graphics/Life.HC.HTML deleted file mode 100644 index 182cc6e..0000000 --- a/public/src/Demo/Graphics/Life.HC.HTML +++ /dev/null @@ -1,110 +0,0 @@ - - - - - Life.HC - - - - - //Conway's Game of Life
-
-CDC *dc[2]; //dbl buf
-I64 cur_dc,;
-Bool restart;
-
-U0 DrawIt(CTask *,CDC *dc2)
-{
- dc[cur_dc]->flags|=DCF_NO_TRANSPARENTS;
- GrBlot(dc2,0,0,dc[cur_dc]);
-}
-
-U0 AnimateTask(I64)
-{
- I64 x,y,x1,y1,cnt,next_dc;
- while (TRUE) {
- next_dc=cur_dc^1;
-start_over:
- restart=FALSE;
- DCClear(dc[next_dc]);
- for (y=1;y<Fs->parent_task->pix_height-1;y++) {
- for (x=1;x<Fs->parent_task->pix_width-1;x++) {
- cnt=0;
- for (y1=y-1;y1<=y+1;y1++)
- for (x1=x-1;x1<=x+1;x1++)
- if (GrPeek(dc[cur_dc],x1,y1)==GREEN)
- cnt++;
- if (restart) goto start_over;
- if (GrPeek(dc[cur_dc],x,y)==GREEN) {
- if (cnt==3) {
- dc[next_dc]->color=GREEN;
- GrPlot(dc[next_dc],x,y);
- }
- } else {
-// if (cnt==3) {//Use this for the classic rules
- if (cnt==2) {
- dc[next_dc]->color=GREEN;
- GrPlot(dc[next_dc],x,y);
- }
- }
- }
- Yield;
- }
- Sleep(50);
- cur_dc=next_dc;
- }
-}
-
-public U0 Life()
-{
- I64 msg_code,cnt,x1,y1,x2,y2,arg1,arg2;
-
- dc[0]=DCNew(GR_WIDTH,GR_HEIGHT);
- dc[1]=DCNew(GR_WIDTH,GR_HEIGHT);
- cur_dc=0;
- restart=FALSE;
-
- SettingsPush; //See SettingsPush
- AutoComplete;
- WinBorder;
- WinMax;
- DocClear;
- DCFill;
-
- Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs);
- Fs->draw_it=&DrawIt;
- Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;
- do {
- msg_code=GetMsg(&arg1,&arg2,1<<MSG_KEY_DOWN+1<<MSG_MS_L_DOWN);
- switch (msg_code) {
- case MSG_MS_L_DOWN:
- x1=arg1; y1=arg2;
- x2=arg1; y2=arg2;
- cnt=0;
- while (msg_code!=MSG_MS_L_UP) {
- restart=TRUE;
- dc[cur_dc]->color=GREEN;
- dc[cur_dc]->thick=0.04*ms.speed;
- GrLine3(dc[cur_dc],x1,y1,0,x2,y2,0);
- restart=TRUE;
- msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
- x1=x2; y1=y2;
- x2=arg1; y2=arg2;
- }
- GrLine3(dc[cur_dc],x1,y1,0,x2,y2,0);
- break;
- case MSG_KEY_DOWN:
- break;
- }
- } while (msg_code!=MSG_KEY_DOWN || !arg1);
- GetMsg(,,1<<MSG_KEY_UP);
- SettingsPop;
- DCFill;
- DCDel(dc[0]);
- DCDel(dc[1]);
-}
-
-Life;
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/LightTable.HC.HTML b/public/src/Demo/Graphics/LightTable.HC.HTML deleted file mode 100644 index cbd0fc9..0000000 --- a/public/src/Demo/Graphics/LightTable.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - LightTable.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/Lines.HC.HTML b/public/src/Demo/Graphics/Lines.HC.HTML deleted file mode 100644 index 699d052..0000000 --- a/public/src/Demo/Graphics/Lines.HC.HTML +++ /dev/null @@ -1,38 +0,0 @@ - - - - - Lines.HC - - - - - U0 Main()
-{
- I64 x1=0,y1=0,x2=0,y2=0,i=1,c=0;
- I64 vx1=0,vy1=0,vx2=0,vy2=0;
- CDC *dc=DCAlias;
- while (!ScanChar) {
- if (!--i) {
- i=1000;
- dc->color=c++&15;
- }
- GrLine(dc,x1,y1,x2,y2);
- vx1=ClampI64(vx1+SignI64(RandI16),-5,5);
- vy1=ClampI64(vy1+SignI64(RandI16),-5,5);
- vx2=ClampI64(vx2+SignI64(RandI16),-5,5);
- vy2=ClampI64(vy2+SignI64(RandI16),-5,5);
- x1=ClampI64(x1+vx1,0,Fs->pix_width-1);
- y1=ClampI64(y1+vy1,0,Fs->pix_height-1);
- x2=ClampI64(x2+vx2,0,Fs->pix_width-1);
- y2=ClampI64(y2+vy2,0,Fs->pix_height-1);
- Sleep(1); //Replace this with Yield() ort Sleep(0) and see what happens!
- }
- DCFill(dc);
- DCDel(dc);
-}
-
-Main;
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/LowPassFilter.HC.HTML b/public/src/Demo/Graphics/LowPassFilter.HC.HTML deleted file mode 100644 index 11f14fc..0000000 --- a/public/src/Demo/Graphics/LowPassFilter.HC.HTML +++ /dev/null @@ -1,95 +0,0 @@ - - - - - LowPassFilter.HC - - - - - #define STEP_SIZE 400
-
-U0 LowPassFilterDemo()
-{
- F64 y,y1,t,dt;
- CDC *dc=DCAlias;
-
- WinBorder;
- WinMax;
- DocClear;
-
- dc->color=BLUE;
- GrLine(dc,0,0,0,STEP_SIZE);
- GrLine(dc,0,STEP_SIZE,GR_WIDTH/2,STEP_SIZE);
- GrLine(dc,GR_WIDTH/2,STEP_SIZE,GR_WIDTH/2,0);
- GrLine(dc,GR_WIDTH/2,0,GR_WIDTH,0);
- PressAKey;
-
- dc->color=CYAN;
- t=0;
- y=0.0;
- while (t<GR_WIDTH) {
- dt=1.0;
- if (t<GR_WIDTH/2)
- y1=STEP_SIZE-STEP_SIZE*Exp(-0.01*t);
- else
- y1=STEP_SIZE*Exp(-0.01*(t-GR_WIDTH/2));
- GrLine(dc,t,y,t+dt,y1);
- y=y1;
- t+=dt;
- }
- PressAKey;
-
- dc->color=BLACK;
- t=0;
- y=0.0;
- while (t<GR_WIDTH) {
- dt=1.0;
- if (t<GR_WIDTH/2)
- y1=0.99*y+.01*STEP_SIZE;
- else
- y1=0.99*y;
- GrLine(dc,t,y,t+dt,y1);
- y=y1;
- t+=dt;
- }
- PressAKey;
-
- dc->color=RED;
- t=0;
- y=0.0;
- while (t<GR_WIDTH) {
- dt=Rand/10;
- if (t<GR_WIDTH/2)
- y1=LowPass1(.01,y,STEP_SIZE,dt);
- else
- y1=LowPass1(.01,y,0,dt);
- GrLine(dc,t,y,t+dt,y1);
- y=y1;
- t+=dt;
- }
- PressAKey;
-
- dc->color=GREEN;
- t=0;
- y=0.0;
- while (t<GR_WIDTH) {
- dt=Rand/10;
- if (t<GR_WIDTH/2)
- y1=LowPass1(.1,y,STEP_SIZE,dt);
- else
- y1=LowPass1(.1,y,0,dt);
- GrLine(dc,t,y,t+dt,y1);
- y=y1;
- t+=dt;
- }
- PressAKey;
-
- DCDel(dc);
- DCFill;
-}
-
-LowPassFilterDemo;
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/MathAudioDemo.HC.HTML b/public/src/Demo/Graphics/MathAudioDemo.HC.HTML deleted file mode 100644 index a4b17fb..0000000 --- a/public/src/Demo/Graphics/MathAudioDemo.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - MathAudioDemo.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/MouseDemo.HC.HTML b/public/src/Demo/Graphics/MouseDemo.HC.HTML deleted file mode 100644 index f758cd7..0000000 --- a/public/src/Demo/Graphics/MouseDemo.HC.HTML +++ /dev/null @@ -1,23 +0,0 @@ - - - - - MouseDemo.HC - - - - - U0 Mouse()
-{
- "Press left mouse bttn to exit.\n";
- while (!ms.lb) { //Left bttn to exit.
- GrPlot(,ms.pos.x,ms.pos.y);
- Refresh;
- }
- DCFill;
-}
-
-Mouse;
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/NetOfDots.HC.HTML b/public/src/Demo/Graphics/NetOfDots.HC.HTML deleted file mode 100644 index b2e07f5..0000000 --- a/public/src/Demo/Graphics/NetOfDots.HC.HTML +++ /dev/null @@ -1,28 +0,0 @@ - - - - - NetOfDots.HC - - - - - //Press <F5> to compile and run.
-
-U0 NetOfDots()
-{
- I64 i;
- CDC *dc=DCAlias;
- DocClear;
- dc->color=RED;
- for (i=0;i<480;i+=20)
- GrLine(dc,i,0,0,480-i,3);
- DCDel(dc);
- PressAKey;
- DCFill;
-}
-
-NetOfDots; //Run when #included
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/Palette.HC.HTML b/public/src/Demo/Graphics/Palette.HC.HTML deleted file mode 100644 index 042d4f8..0000000 --- a/public/src/Demo/Graphics/Palette.HC.HTML +++ /dev/null @@ -1,39 +0,0 @@ - - - - - Palette.HC - - - - - U0 PaletteDemo()
-{
- I64 i,j;
- CBGR48 bgr;
- for (i=0;i<COLORS_NUM;i++)
- "$BLACK$$BG,%d$__%-8Z__$FG$$BG$\n",i,i,"ST_COLORS";
-
- SettingsPush; //See SettingsPush
-//Alternatively, use GrPaletteSet(gr_palette_gray);
- for (i=0;i<COLORS_NUM;i++) {
- j=0xFFFF*i/(COLORS_NUM-1);
- bgr.b=j;
- bgr.g=j;
- bgr.r=j;
- GrPaletteColorSet(i,bgr);
- }
- PressAKey;
-
- //You can do it this way, too.
- GrPaletteColorSet(WHITE,0xFFFFFFFF0000);
- PressAKey;
-
- //SettingsPop() restores original palette
- SettingsPop;
-}
-
-PaletteDemo;
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/PanText.HC.HTML b/public/src/Demo/Graphics/PanText.HC.HTML deleted file mode 100644 index 29c738c..0000000 --- a/public/src/Demo/Graphics/PanText.HC.HTML +++ /dev/null @@ -1,47 +0,0 @@ - - - - - PanText.HC - - - - - U0 PanText()
-{
- I64 i;
- for (i=0;i<=7;i++) {
- gr.pan_text_x=i;
- Sleep(30);
- }
- i--;
- for (;i>=-7;i--) {
- gr.pan_text_x=i;
- Sleep(30);
- }
- i++;
- for (;i<=0;i++) {
- gr.pan_text_x=i;
- Sleep(30);
- }
-
- for (i=0;i<=7;i++) {
- gr.pan_text_y=i;
- Sleep(30);
- }
- i--;
- for (;i>=-7;i--) {
- gr.pan_text_y=i;
- Sleep(30);
- }
- i++;
- for (;i<=0;i++) {
- gr.pan_text_y=i;
- Sleep(30);
- }
-}
-
-PanText;
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/Pick.HC.HTML b/public/src/Demo/Graphics/Pick.HC.HTML deleted file mode 100644 index da17205..0000000 --- a/public/src/Demo/Graphics/Pick.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Pick.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/Pick3D.HC.HTML b/public/src/Demo/Graphics/Pick3D.HC.HTML deleted file mode 100644 index ca21e17..0000000 --- a/public/src/Demo/Graphics/Pick3D.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Pick3D.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/PoleZeros.HC.HTML b/public/src/Demo/Graphics/PoleZeros.HC.HTML deleted file mode 100644 index b6b1d95..0000000 --- a/public/src/Demo/Graphics/PoleZeros.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - PoleZeros.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/PredatorPrey.HC.HTML b/public/src/Demo/Graphics/PredatorPrey.HC.HTML deleted file mode 100644 index c87f05f..0000000 --- a/public/src/Demo/Graphics/PredatorPrey.HC.HTML +++ /dev/null @@ -1,93 +0,0 @@ - - - - - PredatorPrey.HC - - - - - //Classic 2nd order nonlinear ordinary differential equation
-
-I64 mp_not_done_flags;
-
-#define OX 10
-#define OY GR_HEIGHT/2-FONT_HEIGHT
-
-#define MICRO_STEP 0.000001
-
-class State
-{
- F64 wabbits,hawks,
- d_wabbits,d_hawks; //Technically, these are not part of the state.
-};
-
-U0 Steps(State *s)
-{
- I64 i;
- for (i=0;i<10000;i++) {
- s->d_wabbits=s->wabbits*(1.0-0.10*s->hawks);
- s->d_hawks =-s->hawks *(1.0-0.01*s->wabbits);
- s->hawks +=s->d_hawks *MICRO_STEP;
- s->wabbits+=s->d_wabbits*MICRO_STEP;
- }
-}
-
-U0 PlotTrajectory(CTask *parent)
-{
- I64 i;
- CDC *dc=DCAlias(,parent);
- State s;
-
- MemSet(&s,0,sizeof(State));
- s.wabbits=RandU16%100 +10;
- s.hawks =RandU16%10 +1;
-
- for (i=0;i<1000;i++) {
- dc->color=LTGREEN;
- GrPlot(dc,s.wabbits+OX,OY-s.d_wabbits);
- dc->color=LTRED;
- GrPlot(dc,s.hawks +OX,OY-s.d_hawks);
- Steps(&s);
- }
- DCDel(dc);
- LBtr(&mp_not_done_flags,Gs->num);
-}
-
-U0 PredatorPrey()
-{
- I64 i;
- CDC *dc=DCAlias;
-
- PopUpOk("This will plot multiple predator-prey\n"
- "trajectories.It restarts many times\n"
- "with different, random, initial populations.\n");
- SettingsPush; //See SettingsPush
- try {
- AutoComplete;
- WinBorder;
- WinMax;
- DocClear;
- Refresh;
-
- dc->color=BLACK;
- GrLine(dc,OX,0,OX,GR_HEIGHT-FONT_HEIGHT-1);
- GrLine(dc,0,OY,GR_WIDTH-1,OY);
- while (!ScanChar) {
- mp_not_done_flags=1<<mp_cnt-1;
- for (i=0;i<mp_cnt;i++)
- JobQue(&PlotTrajectory,Fs,i);
- do Yield;
- while (mp_not_done_flags);
- }
- } catch
- PutExcept;
- SettingsPop;
- DCFill(dc);
- DCDel(dc);
-}
-
-PredatorPrey;
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/RotateTank.HC.HTML b/public/src/Demo/Graphics/RotateTank.HC.HTML deleted file mode 100644 index d9a9cec..0000000 --- a/public/src/Demo/Graphics/RotateTank.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - RotateTank.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/ScrnCapture.HC.HTML b/public/src/Demo/Graphics/ScrnCapture.HC.HTML deleted file mode 100644 index b77e549..0000000 --- a/public/src/Demo/Graphics/ScrnCapture.HC.HTML +++ /dev/null @@ -1,27 +0,0 @@ - - - - - ScrnCapture.HC - - - - - //See /Demo/Games/Stadium/StadiumGen.HC.
-
-U0 Main()
-{
- "Capture scrn...\n";
- PressAKey;
- GRScrnCaptureWrite("~/DemoScrnShot");
- "View captured scrn...\n";
- PressAKey;
- GRScrnCaptureRead("~/DemoScrnShot");
- PressAKey;
- DCFill;
-}
-
-Main;
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/ScrollBars.HC.HTML b/public/src/Demo/Graphics/ScrollBars.HC.HTML deleted file mode 100644 index 9ee9920..0000000 --- a/public/src/Demo/Graphics/ScrollBars.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - ScrollBars.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/Shading.HC.HTML b/public/src/Demo/Graphics/Shading.HC.HTML deleted file mode 100644 index 6efd0ef..0000000 --- a/public/src/Demo/Graphics/Shading.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Shading.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/Shadow.HC.HTML b/public/src/Demo/Graphics/Shadow.HC.HTML deleted file mode 100644 index 7aa4b76..0000000 --- a/public/src/Demo/Graphics/Shadow.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Shadow.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/Slider.HC.HTML b/public/src/Demo/Graphics/Slider.HC.HTML deleted file mode 100644 index c32f47b..0000000 --- a/public/src/Demo/Graphics/Slider.HC.HTML +++ /dev/null @@ -1,122 +0,0 @@ - - - - - Slider.HC - - - - - /*This was done with <CTRL-SHIFT-L> template code.
-It's conceptually easy to do a ctrl,
-but tedious.You have complete freedom.
-
-See CCtrl.
-*/
-
-//Start of autocreated Code
-#define SLIDER_RANGE 30
-#define SLIDER_SPACING 20
-#define SLIDER_BORDER 2
-
-class CSliderState
-{
- I64 left_pos;
- I64 right_pos;
-} sld;
-
-U0 DrawCtrlSlider(CDC *dc,CCtrl *c)
-{
- CSliderState *s=c->state;
-
- dc->color=LTRED;
- GrRect(dc, c->left,c->top,SLIDER_SPACING*3+2,SLIDER_SPACING*2+SLIDER_RANGE);
- dc->color=BLUE;
- GrRect(dc, c->left+SLIDER_BORDER,c->top+SLIDER_BORDER,
- SLIDER_SPACING*3+2-2*SLIDER_BORDER,
- SLIDER_SPACING*2+SLIDER_RANGE-2*SLIDER_BORDER);
- dc->color=BLACK;
- GrLine(dc,c->left+1*SLIDER_SPACING+0,c->top+SLIDER_SPACING,
- c->left+1*SLIDER_SPACING+0,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
- GrLine(dc,c->left+2*SLIDER_SPACING+1,c->top+SLIDER_SPACING,
- c->left+2*SLIDER_SPACING+1,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
- dc->color=LTRED;
- GrPrint(dc,c->left+1*SLIDER_SPACING+0-FONT_WIDTH/2,
- c->top+SLIDER_SPACING+SLIDER_RANGE+3,
- "%d",s->left_pos*10/SLIDER_RANGE);
- GrPrint(dc,c->left+2*SLIDER_SPACING+1-FONT_WIDTH/2,
- c->top+SLIDER_SPACING+SLIDER_RANGE+3,
- "%d",s->right_pos*10/SLIDER_RANGE);
- GrRect(dc,c->left+1*SLIDER_SPACING+0-3,
- c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-2,7,5);
- GrRect(dc,c->left+2*SLIDER_SPACING+1-3,
- c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-2,7,5);
- dc->color=YELLOW;
- GrRect(dc,c->left+1*SLIDER_SPACING+0-2,
- c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-1,5,3);
- GrRect(dc,c->left+2*SLIDER_SPACING+1-2,
- c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-1,5,3);
-}
-
-U0 UpdateDerivedCtrlSlider(CCtrl *c)
-{
- CSliderState *s=c->state;
- c->left=c->win_task->pix_width/2-(SLIDER_SPACING*3+2)/2;
- c->right=c->left+3*SLIDER_SPACING+2;
- c->top=c->win_task->pix_height/2-(SLIDER_SPACING*2+SLIDER_RANGE)/2;
- c->bottom=c->top+SLIDER_SPACING*2+SLIDER_RANGE;
- s->left_pos=ClampI64(s->left_pos,0,SLIDER_RANGE-1);
- s->right_pos=ClampI64(s->right_pos,0,SLIDER_RANGE-1);
-}
-
-U0 LeftClickSlider(CCtrl *c,I64 x,I64 y,Bool)
-{
- CSliderState *s=c->state;
- if (x<c->left+1*SLIDER_SPACING+0+SLIDER_SPACING/2)
- s->left_pos=SLIDER_RANGE-1-(y-(c->top+SLIDER_SPACING));
- else
- s->right_pos=SLIDER_RANGE-1-(y-(c->top+SLIDER_SPACING));
- if (c->update_derived_vals)
- (*c->update_derived_vals)(c);
-}
-
-CCtrl *SliderNew()
-{
- CCtrl *c=CAlloc(sizeof(CCtrl));
- c->win_task=Fs;
- c->flags=CTRLF_SHOW|CTRLF_CAPTURE_LEFT_MS;
- c->type=CTRLT_GENERIC;
- c->state=&sld;
- MemSet(&sld,0,sizeof(CSliderState));
- c->draw_it=&DrawCtrlSlider;
- c->left_click=&LeftClickSlider;
- c->update_derived_vals=&UpdateDerivedCtrlSlider;
- QueIns(c,Fs->last_ctrl);
- TaskDerivedValsUpdate;
- return c;
-}
-
-U0 SliderDel(CCtrl *c)
-{
- QueRem(c);
- Free(c);
-}
-
-//End of autocreated Code
-
-U0 Main()
-{
- "This is to demo ctrls.\n";
- CCtrl *c=SliderNew;
- PressAKey;
- "Left: %d Right: %d\n",
- sld.left_pos*10/SLIDER_RANGE,
- sld.right_pos*10/SLIDER_RANGE;
- SliderDel(c);
- DocBottom;
-}
-
-Main;
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/Speedline.HC.HTML b/public/src/Demo/Graphics/Speedline.HC.HTML deleted file mode 100644 index 5ce6a1d..0000000 --- a/public/src/Demo/Graphics/Speedline.HC.HTML +++ /dev/null @@ -1,62 +0,0 @@ - - - - - Speedline.HC - - - - - //This is a drawing program
-
-public U0 SpeedLineDemo()
-{
- I64 msg_code,cnt,x1,y1,x2,y2,arg1,arg2,color=BLACK;
- CDC *dc=DCAlias;
- dc->color=color;
-
- SettingsPush; //See SettingsPush
- Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;
-
- AutoComplete;
- WinBorder;
- WinMax;
- DocClear;
- DCFill;
- do {
- msg_code=GetMsg(&arg1,&arg2,
- 1<<MSG_KEY_DOWN+1<<MSG_MS_L_DOWN+1<<MSG_MS_R_UP);
- switch (msg_code) {
- case MSG_MS_R_UP:
- color=PopUpColor;
- if (color>=0)
- dc->color=color;
- break;
- case MSG_MS_L_DOWN:
- x1=arg1; y1=arg2;
- x2=arg1; y2=arg2;
- cnt=0;
- while (msg_code!=MSG_MS_L_UP) {
- dc->thick=0.04*ms.speed;
- GrLine3(dc,x1,y1,0,x2,y2,0);
- msg_code=GetMsg(&arg1,&arg2,
- 1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
- x1=x2; y1=y2;
- x2=arg1; y2=arg2;
- }
- GrLine3(dc,x1,y1,0,x2,y2,0);
- break;
- case MSG_KEY_DOWN:
- break;
- }
- } while (msg_code!=MSG_KEY_DOWN || !arg1);
- GetMsg(,,1<<MSG_KEY_UP);
- DCFill;
- DCDel(dc);
- SettingsPop;
-}
-
-SpeedLineDemo; //Execute when #included
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/SpritePlot.HC.HTML b/public/src/Demo/Graphics/SpritePlot.HC.HTML deleted file mode 100644 index 29ddc74..0000000 --- a/public/src/Demo/Graphics/SpritePlot.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SpritePlot.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/SpritePlot3D.HC.HTML b/public/src/Demo/Graphics/SpritePlot3D.HC.HTML deleted file mode 100644 index cb8ff81..0000000 --- a/public/src/Demo/Graphics/SpritePlot3D.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SpritePlot3D.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/SpritePut.HC.HTML b/public/src/Demo/Graphics/SpritePut.HC.HTML deleted file mode 100644 index 1c8eeb7..0000000 --- a/public/src/Demo/Graphics/SpritePut.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SpritePut.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/SpritePutExt.HC.HTML b/public/src/Demo/Graphics/SpritePutExt.HC.HTML deleted file mode 100644 index 85c04c5..0000000 --- a/public/src/Demo/Graphics/SpritePutExt.HC.HTML +++ /dev/null @@ -1,38 +0,0 @@ - - - - - SpritePutExt.HC - - - - - /*If you press <CTRL-t> you will see this:
-
-$IB,"<1>",BI=1,BP="::/Demo/Graphics/SpritePut.HC,2"$
-
-That imports an external sprite. It's
-called a DOCEF_BIN_PTR_LINK. See $LK,"BP=\"\"",A="FF:::/Doc/DolDocOverview.DD,BP=\"\""$.
-
-Press <CTRL-r> and "Ptr to Sprite".
-Then, enter a file and the number of
-the sprite in the file. Note: the
-number can get messed-up if you change
-the order of sprites in the source file.
-You can link to a tag string instead of a num.
-*/
-
-U0 SpritePutExt()
-{
- I64 i;
- for (i=0;i<3;i++) {
- "US Map:";
- Sprite($IB,"<1>",BI=1,BP="::/Demo/Graphics/SpritePut.HC,2"$);
- "%h12c",'\n'; //"h" is a secondary arg. Print 12 newline chars.
- }
-}
-
-SpritePutExt;
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/SpriteRaw.HC.HTML b/public/src/Demo/Graphics/SpriteRaw.HC.HTML deleted file mode 100644 index b298b17..0000000 --- a/public/src/Demo/Graphics/SpriteRaw.HC.HTML +++ /dev/null @@ -1,50 +0,0 @@ - - - - - SpriteRaw.HC - - - - - //Normally, you make sprites with <CTRL-r>.
-//This shows how to build a sprite by hand.
-//See $MA-X+PU,"::/Apps/GrModels",LM="Cd(\"::/Apps/GrModels\");Dir;View;\n"$.
-
-class MySprite
-{ // See Sprite Elem Types
- CSpriteColor color;
- CSpritePtPt line1;
- CSpritePtPt line2;
- CSpritePtPt line3;
- CSpritePt fill;
- CSpriteBase end;
-};
-
-
-U0 SpriteRawDemo()
-{
- MySprite s;
-
- MemSet(&s,0,sizeof(s));
- s.color.type=SPT_COLOR;
- s.color.color=GREEN;
- s.line1.type=SPT_LINE;
- s.line1.x2=100; s.line1.y2=50;
- s.line2.type=SPT_LINE;
- s.line2.x2=50; s.line2.y2=100;
- s.line3.type=SPT_LINE;
- s.line3.x1=100; s.line3.y1=50;
- s.line3.x2=50; s.line3.y2=100;
- s.fill.type=SPT_FLOOD_FILL;
- s.fill.x1=20; s.fill.y1=20;
- s.end.type=SPT_END;
-
- Sprite(&s);
- "%h13c",'\n';
-}
-
-SpriteRawDemo;
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/SpriteText.HC.HTML b/public/src/Demo/Graphics/SpriteText.HC.HTML deleted file mode 100644 index 42d8f8e..0000000 --- a/public/src/Demo/Graphics/SpriteText.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SpriteText.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/SunMoon.HC.HTML b/public/src/Demo/Graphics/SunMoon.HC.HTML deleted file mode 100644 index 840fdce..0000000 --- a/public/src/Demo/Graphics/SunMoon.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SunMoon.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/Symmetry.HC.HTML b/public/src/Demo/Graphics/Symmetry.HC.HTML deleted file mode 100644 index e81239a..0000000 --- a/public/src/Demo/Graphics/Symmetry.HC.HTML +++ /dev/null @@ -1,74 +0,0 @@ - - - - - Symmetry.HC - - - - - /*Demonstrates symmetry.
-Right-click and draw line of symmetry.
-If the line of symmetry is a point, symmetry is turned-off.
-*/
-
-U0 SymmetryDemo()
-{
- I64 msg_code,x1,y1,x2,y2,arg1,arg2;
- CDC *dc=DCAlias;
-
- SettingsPush; //See SettingsPush
- Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;
-
- WinBorder;
- WinMax;
- DocClear;
- DCFill;
- dc->flags|=DCF_SYMMETRY;
- DCSymmetrySet(dc,Fs->pix_width/2,0,Fs->pix_width/2,1);
- do {
- msg_code=GetMsg(&arg1,&arg2,
- 1<<MSG_KEY_DOWN+1<<MSG_MS_L_DOWN+
- 1<<MSG_MS_R_DOWN);
- switch (msg_code) {
- case MSG_MS_R_DOWN:
- dc->flags&=~DCF_SYMMETRY;
- dc->color=ROP_XOR+RED^TRANSPARENT;
- x1=arg1; y1=arg2;
- x2=arg1; y2=arg2;
- while (msg_code!=MSG_MS_R_UP) {
- GrLine3(dc,x1,y1,0,x2,y2,0);
- msg_code=GetMsg(&arg1,&arg2,
- 1<<MSG_MS_R_UP+1<<MSG_MS_MOVE);
- GrLine3(dc,x1,y1,0,x2,y2,0);
- x2=arg1; y2=arg2;
- }
- GrLine3(dc,x1,y1,0,x2,y2,0);
- if (DCSymmetry3Set(dc,x1,y1,0,x2,y2,0,x2,y2,1))
- dc->flags|=DCF_SYMMETRY;
- break;
- case MSG_MS_L_DOWN:
- dc->color=ROP_XOR+BLACK^TRANSPARENT;
- x1=arg1; y1=arg2;
- x2=arg1; y2=arg2;
- while (msg_code!=MSG_MS_L_UP) {
- GrLine3(dc,x1,y1,0,x2,y2,0);
- msg_code=GetMsg(&arg1,&arg2,
- 1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
- GrLine3(dc,x1,y1,0,x2,y2,0);
- x2=arg1; y2=arg2;
- }
- GrLine3(dc,x1,y1,0,x2,y2,0);
- break;
- }
- } while (msg_code!=MSG_KEY_DOWN || (arg1!=CH_ESC && arg1!=CH_SHIFT_ESC));
- GetMsg(,,1<<MSG_KEY_UP);
- DCFill;
- DCDel(dc);
- SettingsPop;
-}
-
-SymmetryDemo; //Execute when #included
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/Transform.HC.HTML b/public/src/Demo/Graphics/Transform.HC.HTML deleted file mode 100644 index 60cea9c..0000000 --- a/public/src/Demo/Graphics/Transform.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Transform.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/WallPaperCtrl.HC.HTML b/public/src/Demo/Graphics/WallPaperCtrl.HC.HTML deleted file mode 100644 index 79499bf..0000000 --- a/public/src/Demo/Graphics/WallPaperCtrl.HC.HTML +++ /dev/null @@ -1,120 +0,0 @@ - - - - - WallPaperCtrl.HC - - - - - /*Done with <CTRL-SHIFT-L> template code
-that was modified.
-
-This is an advanced demo that shows
-that you can place ctrls on the
-wall paper.
-
-See /Demo/Graphics/Slider.HC
-and /Demo/Graphics/WallPaperFish.HC
-before messing with this program.
-
-It must be "Adam Included".
-*/
-
-#define SLIDER_RANGE 30
-#define SLIDER_SPACING 20
-#define SLIDER_BORDER 2
-
-class CSliderState
-{
- I64 left_pos;
- I64 right_pos;
-};
-
-U0 DrawCtrlSlider(CDC *dc,CCtrl *c)
-{
- CSliderState *s=c->state;
-
- dc->color=LTRED;
- GrRect(dc, c->left,c->top,SLIDER_SPACING*3+2,SLIDER_SPACING*2+SLIDER_RANGE);
- dc->color=BLUE;
- GrRect(dc, c->left+SLIDER_BORDER,c->top+SLIDER_BORDER,
- SLIDER_SPACING*3+2-2*SLIDER_BORDER,
- SLIDER_SPACING*2+SLIDER_RANGE-2*SLIDER_BORDER);
- dc->color=BLACK;
- GrLine(dc,c->left+1*SLIDER_SPACING+0,c->top+SLIDER_SPACING,
- c->left+1*SLIDER_SPACING+0,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
- GrLine(dc,c->left+2*SLIDER_SPACING+1,c->top+SLIDER_SPACING,
- c->left+2*SLIDER_SPACING+1,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
- dc->color=LTRED;
- GrPrint(dc,c->left+1*SLIDER_SPACING+0-FONT_WIDTH/2,
- c->top+SLIDER_SPACING+SLIDER_RANGE+3,
- "%d",s->left_pos*10/SLIDER_RANGE);
- GrPrint(dc,c->left+2*SLIDER_SPACING+1-FONT_WIDTH/2,
- c->top+SLIDER_SPACING+SLIDER_RANGE+3,
- "%d",s->right_pos*10/SLIDER_RANGE);
- GrRect(dc,c->left+1*SLIDER_SPACING+0-3,
- c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-2,7,5);
- GrRect(dc,c->left+2*SLIDER_SPACING+1-3,
- c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-2,7,5);
- dc->color=YELLOW;
- GrRect(dc,c->left+1*SLIDER_SPACING+0-2,
- c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-1,5,3);
- GrRect(dc,c->left+2*SLIDER_SPACING+1-2,
- c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-1,5,3);
-}
-
-U0 UpdateDerivedCtrlSlider(CCtrl *c)
-{
- CSliderState *s=c->state;
- c->left=c->win_task->pix_width/2-(SLIDER_SPACING*3+2)/2;
- c->right=c->left+3*SLIDER_SPACING+2;
- c->top=c->win_task->pix_height/2-(SLIDER_SPACING*2+SLIDER_RANGE)/2;
- c->bottom=c->top+SLIDER_SPACING*2+SLIDER_RANGE;
- s->left_pos=ClampI64(s->left_pos,0,SLIDER_RANGE-1);
- s->right_pos=ClampI64(s->right_pos,0,SLIDER_RANGE-1);
-}
-
-U0 LeftClickSlider(CCtrl *c,I64 x,I64 y,Bool)
-{
- CSliderState *s=c->state;
- if (x<c->left+1*SLIDER_SPACING+0+SLIDER_SPACING/2)
- s->left_pos=SLIDER_RANGE-1-(y-(c->top+SLIDER_SPACING));
- else
- s->right_pos=SLIDER_RANGE-1-(y-(c->top+SLIDER_SPACING));
- if (c->update_derived_vals)
- (*c->update_derived_vals)(c);
-}
-
-CCtrl *SliderNew()
-{
- CCtrl *c;
- if (Fs!=adam_task) {
- "Must be Adam Included with SHIFT-F5.\n"
- "(Would crash when code mem was freed.)\n";
- return NULL;
- }
- c=ACAlloc(sizeof(CCtrl));
- c->win_task=sys_winmgr_task;
- c->flags=CTRLF_SHOW|CTRLF_CAPTURE_LEFT_MS;
- c->type=CTRLT_GENERIC;
- c->state=ACAlloc(sizeof(CSliderState));
- c->draw_it=&DrawCtrlSlider;
- c->left_click=&LeftClickSlider;
- c->update_derived_vals=&UpdateDerivedCtrlSlider;
- QueIns(c,sys_winmgr_task->last_ctrl);
- TaskDerivedValsUpdate;
- return c;
-}
-
-U0 SliderDel(CCtrl *c)
-{
- QueRem(c);
- Free(c->state);
- Free(c);
-}
-
-SliderNew;
- - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/WallPaperFish.HC.HTML b/public/src/Demo/Graphics/WallPaperFish.HC.HTML deleted file mode 100644 index 401d449..0000000 --- a/public/src/Demo/Graphics/WallPaperFish.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - WallPaperFish.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Graphics/WinZBuf.HC.HTML b/public/src/Demo/Graphics/WinZBuf.HC.HTML deleted file mode 100644 index eb98c76..0000000 --- a/public/src/Demo/Graphics/WinZBuf.HC.HTML +++ /dev/null @@ -1,35 +0,0 @@ - - - - - WinZBuf.HC - - - - - U0 DrawIt(CTask *,CDC *dc)
-{
- I64 i,j;
- U16 *ptr=gr.win_z_buf;
- dc->color=BLACK;
- GrPrint(dc,0,0,"Move the windows around and watch.");
- for (i=0;i<TEXT_ROWS;i++)
- for (j=0;j<TEXT_COLS;j++) {
- dc->color=*ptr++&15;
- GrPlot(dc,j,i+FONT_HEIGHT);
- }
-}
-
-U0 ScrollBars()
-{
- SettingsPush; //See SettingsPush
- DocClear;
- Fs->draw_it=&DrawIt;
- GetChar(,FALSE);
- SettingsPop;
-}
-
-ScrollBars;
- - - \ No newline at end of file diff --git a/public/src/Demo/InFile/InPopUp.HC.HTML b/public/src/Demo/InFile/InPopUp.HC.HTML deleted file mode 100644 index 6c13c83..0000000 --- a/public/src/Demo/InFile/InPopUp.HC.HTML +++ /dev/null @@ -1,24 +0,0 @@ - - - - - InPopUp.HC - - - - - /* This is not an InFile. It uses InStr
-to run text as though from an InFile.
-
-This example shows how you can drive pop-up
-windows.
-*/
-
-In("");
-"PopUp #1:%X\n",PopUpNoYes;
-
-InStr("Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT);'' CH_SPACE;");
-"PopUp #2:%X\n",PopUpNoYes;
- - - \ No newline at end of file diff --git a/public/src/Demo/InFile/InSetIP.HC.HTML b/public/src/Demo/InFile/InSetIP.HC.HTML deleted file mode 100644 index 2687637..0000000 --- a/public/src/Demo/InFile/InSetIP.HC.HTML +++ /dev/null @@ -1,25 +0,0 @@ - - - - - InSetIP.HC - - - - - U0 InSetMsDemo()
-{
- I64 t,l;
- WinBorder(ON);
- l=Fs->pix_left+Fs->scroll_x;
- t=Fs->pix_top+Fs->scroll_y;
- MsSet(,,,FALSE,FALSE); //Mouse unclicked
- InSetMs(,l-4,t-4);
- InSetMs(20,l+20,t+20,,TRUE);
- MsSet(,,,FALSE,FALSE);
-}
-
-InSetMsDemo;
- - - \ No newline at end of file diff --git a/public/src/Demo/KeyBitMap.HC.HTML b/public/src/Demo/KeyBitMap.HC.HTML deleted file mode 100644 index 1f45018..0000000 --- a/public/src/Demo/KeyBitMap.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - KeyBitMap.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/LastClass.HC.HTML b/public/src/Demo/LastClass.HC.HTML deleted file mode 100644 index 713e07e..0000000 --- a/public/src/Demo/LastClass.HC.HTML +++ /dev/null @@ -1,45 +0,0 @@ - - - - - LastClass.HC - - - - - U0 StructName(U8 *d,U8 *class_name=lastclass)
-{//lastclass is the prev fun arg's class as a string.
- "%X is a \"%s\".\n",d,class_name;
-}
-
-class Student
-{
- Student *next;
- I64 age;
- U8 name[32];
-} a;
-
-class School
-{
- U8 name[32];
- Student *students;
-} s;
-
-I64 i;
-
-StructName(Fs);
-StructName(&a);
-StructName(&s);
-StructName(&i);
-PressAKey;
-
-//lastclass is used in ClassRep() and ClassRepD().
-ClassRepD(Gs);
-PressAKey;
-
-ClassRep(Fs);
-
-//See also DocForm(), /Demo/Dsk/BlkDevRep.HC and /Demo/ClassMeta.HC.
- - - \ No newline at end of file diff --git a/public/src/Demo/Lectures/AndNotMod.HC.HTML b/public/src/Demo/Lectures/AndNotMod.HC.HTML deleted file mode 100644 index b53ef06..0000000 --- a/public/src/Demo/Lectures/AndNotMod.HC.HTML +++ /dev/null @@ -1,56 +0,0 @@ - - - - - AndNotMod.HC - - - - - //You may wonder why I use "&" instead of "%".
-
-#define SAMPLE_SIZE 100000000
-
-U0 TimeIns()
-{
- I64 start1,end1,start2,end2,overhead_time,test_time;
- I64 reg i,reg tmp;
-
- CPURep;
-
- //Measure Loop Overhead
- start1=GetTSC;
- for (i=0;i<SAMPLE_SIZE;i++) {
- }
- end1=GetTSC;
- overhead_time=end1-start1;
-
- //Measure remainder...
- start2=GetTSC;
- for (i=0;i<SAMPLE_SIZE;i++)
- tmp=i%0x400;
- end2=GetTSC;
- test_time=end2-start2;
- "Remainder Version #1 Cycles\t: %10.5f\n",
- ToF64(test_time-overhead_time)/SAMPLE_SIZE;
-
- //Measure remainder...
- start2=GetTSC;
- for (i=0;i<SAMPLE_SIZE;i++)
- tmp=i&0x3FF;
- end2=GetTSC;
- test_time=end2-start2;
- "Remainder Version #2 Cycles\t: %10.5f\n",
- ToF64(test_time-overhead_time)/SAMPLE_SIZE;
-}
-
-TimeIns;
-
-/* Program Output$HL,0$WW+H,1$FD,1$
-8 Cores 2.660GHz
-Remainder Version #1 Cycles : 26.85345
-Remainder Version #2 Cycles : -0.00800
-$HL,1$*/
- - - \ No newline at end of file diff --git a/public/src/Demo/Lectures/FixedPoint.HC.HTML b/public/src/Demo/Lectures/FixedPoint.HC.HTML deleted file mode 100644 index 90c476d..0000000 --- a/public/src/Demo/Lectures/FixedPoint.HC.HTML +++ /dev/null @@ -1,108 +0,0 @@ - - - - - FixedPoint.HC - - - - - /*"Fixed point" means you use ints
-that are scaled by a value.A common
-example would be using number of pennies
-instead of dollars with a float.
-
-Fixed-point used to be much $TX,"faster",HTML="http://en.wikipedia.org/wiki/X87"$,
-but modern processors do well with
-floats.It also depends on the compiler
-and my compiler is poor with floats.
-
-I often use 64-bit ints with upper 32-bits
-as int and lower 32-bits as fraction.
-
-See /Demo/SubIntAccess.HC for how
-to access upper or lower 32-bits.
-
-For a complete lst of nonstandard compiler
-features, see /Doc/HolyC.DD.
-*/
-
-U0 Main()
-{
- F64 t0,f_sum=0,f_val;
- I64 i ,i_sum=0,i_val;
-
- i_val= 2.0000002 *0x100000000;
- t0=tS;
- for (i=1000000000;i;i--)
- i_sum+=i_val;
- "IntSum\t\t:%.9f Time:%7.3fs\n",i_sum/ToF64(0x100000000),tS-t0;
-
- f_val= 2.0000002;
- t0=tS;
- for (i=1000000000;i;i--)
- f_sum+=f_val;
- "FloatSum\t:%.9f Time:%7.3fs\n",f_sum,tS-t0;
- '\n';
-}
-
-U0 DoIt2()
-{
- I64 i=0x123456789ABCDEF0;
- "i\t\t=%X\n",i;
-
- "i&0xFFFFFFFF\t=%X\n",i&0xFFFFFFFF;
- "i>>32\t\t=%X\n",i>>32;
-
- /* Standard int types are declared
-with a special compiler feature which
-allows a structure to be accessed as a
-whole.That's why the i variable can
-be accessed normally in addition to
-structure member access I64.The actual
-intrinsic compiler type is U64i.
-
-public U64i union I64
-{
- I8i i8[8];
- U8i u8[8];
- I16 i16[4];
- U16 u16[4];
- I32 i32[2];
- U32 u32[2];
-};
-
-It's not quite as great as it seems
-because the compiler decides it cannot
-place i into a reg, so there is a
-penalty.
-
-For a complete lst of nonstandard compiler
-features, see /Doc/HolyC.DD.
-*/
-
- "i.u32[0]\t=%X\n",i.u32[0];
- "i.u32[1]\t=%X\n",i.u32[1];
-}
-
-CPURep;
-Main;
-DoIt2;
-
-//See /Demo/Lectures/FixedPointAdvanced.HC
-
-/*Program Output$HL,0$WW+H,1$FD,1$
-
-$FG$BG$16 Cores 3.500GHz
-Int Sum :2000000199.768690240 Time: 0.803s
-Float Sum :2000000225.656127040 Time: 3.615s
-
-i =123456789ABCDEF0
-i&0xFFFFFFFF =9ABCDEF0
-i>>32 =12345678
-i.u32[0] =9ABCDEF0
-i.u32[1] =12345678
-$HL,1$*/
- - - \ No newline at end of file diff --git a/public/src/Demo/Lectures/FixedPointAdvanced.HC.HTML b/public/src/Demo/Lectures/FixedPointAdvanced.HC.HTML deleted file mode 100644 index 36a7fd0..0000000 --- a/public/src/Demo/Lectures/FixedPointAdvanced.HC.HTML +++ /dev/null @@ -1,185 +0,0 @@ - - - - - FixedPointAdvanced.HC - - - - - /*"Fixed point" means you use ints
-that are scaled by a value.A common
-example would be using number of pennies
-instead of dollars with a float.
-
-Fixed-point used to be much $TX,"faster",HTML="http://en.wikipedia.org/wiki/X87"$,
-but modern processors do well with
-floats.It also depends on the compiler
-and my compiler is poor with floats.
-
-I often use 64-bit ints with upper 32-bits
-as int and lower 32-bits as fraction.
-
-See /Demo/SubIntAccess.HC for how
-to access upper or lower 32-bits.
-*/
-
-#define SAMPLE_SIZE 10000000
-
-I32 coordinates[65536];
-
-asm {
-_ASM_FIXED_POINT::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
- MOV RSI,coordinates
- MOV RDI,ToI64(Sin(1.0)*0x100000000)
- XOR RBX,RBX //SUM
- MOV RCX,SAMPLE_SIZE-1
-@@05: XOR RDX,RDX
- MOV DX,CX
- MOVSXD RAX,U32 [RSI+RDX*4]
- IMUL RDI
- SAR RAX,32
- ADD RBX,RAX
- DEC RCX
- JGE @@05
- MOV RAX,RBX
- POP RDI
- POP RSI
- POP RBP
- RET
-
-SINE_VAL: DU64 Sin(1.0);
-RET_VAL: DU64 0;
-
-_ASM_FLOAT::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- MOV RSI,coordinates
- FLD U64 [SINE_VAL]
- FLDZ
- MOV RCX,SAMPLE_SIZE-1
-@@05: XOR RDX,RDX
- MOV DX,CX
- FILD U32 [RSI+RDX*4]
- FMUL ST0,ST2
- FADDP ST1,ST0
- DEC RCX
- JGE @@05
- FISTP U64 [RET_VAL]
- MOV RAX,U64 [RET_VAL]
- FFREE ST0
- FINCSTP
- POP RSI
- POP RBP
- RET
-}
-
-_extern _ASM_FIXED_POINT I64 AsmFixedPt();
-_extern _ASM_FLOAT I64 AsmFloat();
-
-U0 Main()
-{
- I64 start,end,overhead_time,test_time;
- F64 d1,fsum;
- I64 reg i,tmp,reg d2,reg sum;
-
- CPURep;
-
- //Set-up some sample coordinates
- for (i=0;i<65536;i++)
- coordinates[i]=RandU32;
-
- //Measure Loop Overhead
- start=GetTSC;
- for (i=SAMPLE_SIZE-1;i>=0;i--) {
- }
- end=GetTSC;
- overhead_time=end-start;
- "$RED$Overhead Cycles:%10.5f$FG$\n",
- ToF64(overhead_time)/SAMPLE_SIZE;
-
- //Measure F64 arithmetic
- // (Some of this is due to crappy
- // compiler code.)
- d1=Sin(1.0);
- fsum=0;
- start=GetTSC;
- for (i=SAMPLE_SIZE-1;i>=0;i--)
- fsum+=d1*coordinates[i&65535];
- end=GetTSC;
- test_time=end-start;
- "Float Sum:%X\n",ToI64(fsum);
- "$RED$Float Cycles:%10.5f$FG$\n",
- ToF64(test_time)/SAMPLE_SIZE;
-
- //Measure fixed point arithmetic
- d2=Sin(1.0)*0x100000000;
- sum=0;
- start=GetTSC;
- for (i=SAMPLE_SIZE-1;i>=0;i--) {
- tmp=d2*coordinates[i&65535];
- sum+=tmp.i32[1];
- }
- end=GetTSC;
- test_time=end-start;
- "Fixed-Point Sum:%X\n",sum;
- "$RED$Fixed-Point Cycles:%10.5f$FG$\n",
- ToF64(test_time)/SAMPLE_SIZE;
-
- //Measure fixed point arithmetic
- start=GetTSC;
- sum=AsmFixedPt;
- end=GetTSC;
- test_time=end-start;
- "Asm Fixed-Point Sum:%X\n",sum;
- "$RED$Asm Fixed-Point Cycles:%10.5f$FG$\n",
- ToF64(test_time)/SAMPLE_SIZE;
-
- //Measure float arithmetic
- start=GetTSC;
- sum=AsmFloat;
- end=GetTSC;
- test_time=end-start;
- "Asm Float Sum:%X\n",sum;
- "$RED$Asm Float Cycles:%10.5f$FG$\n",
- ToF64(test_time)/SAMPLE_SIZE;
-
-}
-
-Main;
-
-/* Program Output$HL,0$WW+H,1$FD,1$
-
-Machine 1:
-8 Cores 2.660GHz
-Overhead Cycles:2.00814
-Float Sum:FFFFE1D361BEED68
-Float Cycles:10.16076
-Fixed-Point Sum:FFFFE1D361729914
-Fixed-Point Cycles:5.29392
-Asm Fixed-Point Sum:FFFFE1D361729914
-Asm Fixed-Point Cycles:4.20464
-Asm Float Sum:FFFFE1D361BEED56
-Asm Float Cycles:3.04635
-
-Machine 2:
-8 Cores 3.395GHz
-Overhead Cycles:4.87040
-Float Sum:D20A01DB177
-Float Cycles:10.11558
-Fixed-Point Sum:D209FD18CC7
-Fixed-Point Cycles:4.50618
-Asm Fixed-Point Sum:D209FD18CC7
-Asm Fixed-Point Cycles:3.02426
-Asm Float Sum:D20A01DB17B
-Asm Float Cycles:3.21070
-
-$HL,1$*/
- - - \ No newline at end of file diff --git a/public/src/Demo/Lectures/GraphicsCPULoad.HC.HTML b/public/src/Demo/Lectures/GraphicsCPULoad.HC.HTML deleted file mode 100644 index 6175daa..0000000 --- a/public/src/Demo/Lectures/GraphicsCPULoad.HC.HTML +++ /dev/null @@ -1,46 +0,0 @@ - - - - - GraphicsCPULoad.HC - - - - - //This is the fastest you can update the whole scrn.
-//See /Demo/Lectures/MiniGrLib.HC if this interests you.
-
-F64 VGAPattern(I64 p)
-{//This returns the time to update in seconds.
- F64 start=tS;
- I64 plane;
- for (plane=1;plane<0x10;plane<<=1) {
- OutU8(VGAP_IDX,VGAR_MAP_MASK);
- OutU8(VGAP_DATA,plane);
- MemSetI64(text.vga_alias,p,640*480/64);
- }
- return tS-start;
-}
-
-
-U0 GrDemo()
-{
- I64 i;
- F64 t;
- CPURep;
- for (i=0;i<16;i++) {
- t=VGAPattern(0x5555555555555555);
- "$GREEN$Rate:$RED$%5.1f FPS$FG$"
- "$GREEN$Load@30Hz:$RED$%5.1f%%$FG$\n",1/t,100*t*30.0;
- t=VGAPattern(0x3333333333333333);
- "$GREEN$Rate:$RED$%5.1f FPS$FG$"
- "$GREEN$Load@30Hz:$RED$%5.1f%%$FG$\n",1/t,100*t*30.0;
- }
-//<CTRL-ALT-v> will flush scrn VGA cache.
- VGAFlush;
-}
-
-GrDemo;
- - - \ No newline at end of file diff --git a/public/src/Demo/Lectures/InterruptDemo.HC.HTML b/public/src/Demo/Lectures/InterruptDemo.HC.HTML deleted file mode 100644 index ca545d5..0000000 --- a/public/src/Demo/Lectures/InterruptDemo.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - InterruptDemo.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Lectures/MiniCompiler.HC.HTML b/public/src/Demo/Lectures/MiniCompiler.HC.HTML deleted file mode 100644 index 0bffffa..0000000 --- a/public/src/Demo/Lectures/MiniCompiler.HC.HTML +++ /dev/null @@ -1,248 +0,0 @@ - - - - - MiniCompiler.HC - - - - - /*
-$TR-C,"Main Compiler"$
-
The mini compiler is like the main compiler, except the main compiler's lexical analyser removes comments and does preprocessing.Lex(),Echo(ON).
-
-The main compiler generates Intermediate Code at the parser stage.See PrsExpression(), PrsStmt().
-
-The main compiler optimizes See Intermediate Code Attributes, Combining Consts, Choosing Reg Vars.Use PassTrace() to see the optimization stages.
-
-The main compiler makes machine code in the back end.See IC Struct, COCCompile and OptPass789A(),BackEnd.Set Trace(ON) to see the output of the backend.
-

-$TR-C,"Mini Compiler"$
-
For this mini compiler, some things you should know about 64-bit asm:
-
-* Putting a 0x48, known as the REX byte, in front of an inst makes it 64-bit size.
-
-* "PUSH EAX", "POP EAX" and "XOR EAX,EAX" will behave as 64-bit even without REX because the stk is always 64 bit and because the XOR clears the upper 32-bits.
-
-It is okay in TempleOS to change RAX, RBX, RCX, RDX, R8 and R9 without restoring them to their original values.
-
*/
-
-#define TK_EOF 0
-#define TK_NUM 1
-#define TK_OP 2
-#define TK_LEFT 3
-#define TK_RIGHT 4
-
-#define OP_MUL 1
-#define OP_DIV 2
-#define OP_ADD 3
-#define OP_SUB 4
-
-I64 Lex(U8 **_src,I64 *num)
-{//See Lex().
- U8 *src=*_src;
- I64 i;
- while (TRUE) {
- switch (*src) {
- case 0:
- case ';':
- *_src=src;
- return TK_EOF;
- case CH_SPACE:
- case '\r':
- case '\n':
- src++;
- break;
- case '0'...'9':
- i=0;
- do {
- i=i*10+*src-'0';
- src++;
- } while ('0'<=*src<='9');
- *num=i;
- *_src=src;
- return TK_NUM;
- case '*':
- *num=OP_MUL;
- *_src=src+1;
- return TK_OP;
- case '/':
- *num=OP_DIV;
- *_src=src+1;
- return TK_OP;
- case '+':
- *num=OP_ADD;
- *_src=src+1;
- return TK_OP;
- case '-':
- *num=OP_SUB;
- *_src=src+1;
- return TK_OP;
- case '(':
- *_src=src+1;
- return TK_LEFT;
- case ')':
- *_src=src+1;
- return TK_RIGHT;
- default:
- throw;
- }
- }
-}
-
-#define PREC_EOF 0
-#define PREC_TERM 1
-#define PREC_MUL 2
-#define PREC_ADD 3
-#define PREC_PAREN 4
-
-extern I64 Parse(U8 **_src,U8 **_dst);
-
-U0 PrsTerm(U8 **_src,U8 **_dst,I64 prec)
-{//See PrsExpression().
- I64 i;
- U8 *src2;
- U8 *dst2;
- if (Parse(_src,_dst)==PREC_TERM) {
- src2=*_src;
- dst2=*_dst;
- while (TRUE) {
-//This is inefficient.The main compiler doesn't back-up like this.
- i=Parse(&src2,&dst2);
- if (PREC_MUL<=i<prec) {
- *_src=src2;
- *_dst=dst2;
- } else
- break;
- }
- } else
- throw;
-}
-
-I64 Parse(U8 **_src,U8 **_dst)
-{//See PrsExpression().
-//See Opcode Fmts for details on asm insts.
- I64 i;
- U8 *dst=*_dst;
- switch (Lex(_src,&i)) {
- case TK_EOF:
- *dst++=0x58; //POP RAX
- *dst++=0xC3; //RET
- *_dst=dst;
- return PREC_EOF;
- case TK_NUM:
- *dst++=0x48; //REX
- *dst++=0xB8; //MOV RAX,immediate num
- *dst(I64 *)++=i;
-
- *dst++=0x50; //PUSH RAX
- *_dst=dst;
- return PREC_TERM;
- case TK_LEFT:
- PrsTerm(_src,_dst,PREC_PAREN);
- if (Parse(_src,_dst)!=PREC_PAREN)
- throw;
- return PREC_TERM;
- case TK_RIGHT:
- return PREC_PAREN;
- case TK_OP:
- switch (i) {
- case OP_MUL:
- PrsTerm(_src,&dst,PREC_MUL);
- *dst++=0x5A; //POP RDX
- *dst++=0x58; //POP RAX
-
- *dst++=0x48; //REX
- *dst++=0x0F;
- *dst++=0xAF; //IMUL RAX,RDX
- *dst++=0xC2;
-
- *dst++=0x50; //PUSH RAX
- *_dst=dst;
- return PREC_MUL;
- case OP_DIV:
- PrsTerm(_src,&dst,PREC_MUL);
- *dst++=0x5B; //POP RBX
- *dst++=0x58; //POP RAX
-
- *dst++=0x33; //XOR RDX,RDX
- *dst++=0xD2;
-
- *dst++=0x48; //REX
- *dst++=0xF7; //IDIV RBX
- *dst++=0xFB;
-
- *dst++=0x50; //PUSH RAX
- *_dst=dst;
- return PREC_MUL;
- case OP_ADD:
- PrsTerm(_src,&dst,PREC_ADD);
- *dst++=0x5A; //POP RDX
- *dst++=0x58; //POP RAX
-
- *dst++=0x48; //REX
- *dst++=0x03; //ADD RAX,RDX
- *dst++=0xC2;
-
- *dst++=0x50; //PUSH RAX
- *_dst=dst;
- return PREC_ADD;
- case OP_SUB:
- PrsTerm(_src,&dst,PREC_ADD);
- *dst++=0x5A; //POP RDX
- *dst++=0x58; //POP RAX
-
- *dst++=0x48; //REX
- *dst++=0x2B; //SUB RAX,RDX
- *dst++=0xC2;
-
- *dst++=0x50; //PUSH RAX
- *_dst=dst;
- return PREC_ADD;
- }
- }
-}
-
-U0 Main()
-{
- U8 *src,*src2,*code,*dst;
-
- //Fixed size, no buffer overrun check.
- //You can make it fancier if you like.
- code=MAlloc(512,Fs->code_heap);
-
- while (TRUE) {
- "This will compile an expression\n"
- "consisting of ints, parentheses\n"
- "and the operators +,-,* and /.\n";
- src=GetStr;
- if (*src) {
- src2=src;
- dst=code;
- try {
- PrsTerm(&src2,&dst,PREC_PAREN);
- if (Parse(&src2,&dst)!=PREC_EOF)
- throw;
- "$RED$This code is not efficient, but the compiler is simple.$FG$\n";
- Un(code,dst-code); //Unassemble the code we created.
-//Call() is a function.See _CALL::
- //See also CallInd().See _CALL_IND::
- "$LTBLUE$Answer:%d$FG$\n",Call(code);
- } catch {
- "$RED$Error$FG$\n";
- PutExcept;
- }
- Free(src);
- } else {
- Free(src);
- break;
- }
- }
- Free(code);
-}
-
-Main;
-
- - - \ No newline at end of file diff --git a/public/src/Demo/Lectures/MiniGrLib.HC.HTML b/public/src/Demo/Lectures/MiniGrLib.HC.HTML deleted file mode 100644 index 563997f..0000000 --- a/public/src/Demo/Lectures/MiniGrLib.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - MiniGrLib.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Lectures/NegDisp.HC.HTML b/public/src/Demo/Lectures/NegDisp.HC.HTML deleted file mode 100644 index 3113c33..0000000 --- a/public/src/Demo/Lectures/NegDisp.HC.HTML +++ /dev/null @@ -1,68 +0,0 @@ - - - - - NegDisp.HC - - - - - class Person
-{
- U8 first [32];
- U8 last [32];
- U8 address1 [64];
- U8 address2 [64];
- U8 city [32];
- U8 state_zip[32];
-};
-
-U0 OffsetDemo1()
-{
- Person *p=MAlloc(sizeof(Person));
- StrCpy(p->first, "Terry");
- StrCpy(p->last, "Davis");
- StrCpy(p->address1, "8144 Sickle Lane");
- StrCpy(p->address2, "");
- StrCpy(p->city, "Las Vegas");
- StrCpy(p->state_zip,"NV 89128");
-}
-
-U(&OffsetDemo1,34);
-PressAKey;
-
-/*
-
-x86 has signed 8-bit displacements
- and signed 32-bit displacements.
-
-This example uses 8-bit negative displacements.
-
-*/
-
-class Person
-{ $=-128;
-U8 first [32];
-U8 last [32];
-U8 address1 [64];
-U8 address2 [64];
-U8 city [32];
-U8 state_zip[32];
-};
-
-U0 OffsetDemo2()
-{
- Person *p=MAlloc(sizeof(Person))(I64)+128;
- StrCpy(p->first, "Terry");
- StrCpy(p->last, "Davis");
- StrCpy(p->address1, "8144 Sickle Lane");
- StrCpy(p->address2, "");
- StrCpy(p->city, "Las Vegas");
- StrCpy(p->state_zip,"NV 89128");
-}
-
-U(&OffsetDemo2,34);
-PressAKey;
- - - \ No newline at end of file diff --git a/public/src/Demo/Lectures/Optimization.HC.HTML b/public/src/Demo/Lectures/Optimization.HC.HTML deleted file mode 100644 index e85253c..0000000 --- a/public/src/Demo/Lectures/Optimization.HC.HTML +++ /dev/null @@ -1,120 +0,0 @@ - - - - - Optimization.HC - - - - - /*The moral of this story is simple
-inst level optimizations
-don't matter much on a modern Intel CPU
-because they convert complex insts
-to a stream of RISC insts.
-
-I learned this the hard way when I thought
-I was greatly improving my compiler by
-cutting code by a third. No significant
-speed-up. Depressing.
-*/
-
-#define SAMPLES (8*10000000+1)
-
-asm {
-
-LIMIT:: DU64 SAMPLES; //Memory reference should be bad, right?
-
-_BADLY_UNOPTIMIZED::
- MOV RAX,0
- MOV RCX,1
-@@05: MOV RDX,RCX
- INC RCX //if no dependencies, Free!
- ADD RAX,RDX
- MOV RDX,LIMIT-16 //added 16 displacement to make it worse
- CMP RCX,U64 16[RDX]
- JB @@05
- RET
-
-_WELL_OPTIMIZED1::
- XOR RAX,RAX
- MOV RCX,SAMPLES-1
-@@05: ADD RAX,RCX
- DEC RCX
- JNZ @@05
- RET
-
-_WELL_OPTIMIZED2:: //Unrolled
- XOR RAX,RAX
- MOV RCX,SAMPLES-1
-@@05: ADD RAX,RCX
- DEC RCX
- ADD RAX,RCX
- DEC RCX
- ADD RAX,RCX
- DEC RCX
- ADD RAX,RCX
- DEC RCX
- ADD RAX,RCX
- DEC RCX
- ADD RAX,RCX
- DEC RCX
- ADD RAX,RCX
- DEC RCX
- ADD RAX,RCX
- DEC RCX
- JNZ @@05
- RET
-
-_WELL_OPTIMIZED3::
- XOR RAX,RAX
- MOV RCX,SAMPLES-1
-@@05: ADD RAX,RCX
- LOOP @@05 //Inst has slow speed, but saves code size.
- RET
-}
-
-_extern _BADLY_UNOPTIMIZED I64 Loop1();
-_extern _WELL_OPTIMIZED1 I64 Loop2();
-_extern _WELL_OPTIMIZED2 I64 Loop3();
-_extern _WELL_OPTIMIZED3 I64 Loop4();
-
-I64 i;
-F64 t0;
-
-CPURep;
-
-"Bad Code\n";
-t0=tS;
-i=Loop1;
-"Res:%d Time:%9.6f\n",i,tS-t0;
-
-"Good Code #1\n";
-t0=tS;
-i=Loop2;
-"Res:%d Time:%9.6f\n",i,tS-t0;
-
-"Good Code #2\n";
-t0=tS;
-i=Loop3;
-"Res:%d Time:%9.6f\n",i,tS-t0;
-
-"Good Code #3\n";
-t0=tS;
-i=Loop4;
-"Res:%d Time:%9.6f\n",i,tS-t0;
-
-/* Program Output$HL,0$WW+H,1$FD,1$
-8 Cores 2.660GHz
-Bad Code
-Res:3200000040000000 Time: 0.069966
-Good Code #1
-Res:3200000040000000 Time: 0.062567
-Good Code #2
-Res:3200000040000000 Time: 0.062907
-Good Code #3
-Res:3200000040000000 Time: 0.156359
-$HL,1$*/
- - - \ No newline at end of file diff --git a/public/src/Demo/Lectures/PCIInterrupts.HC.HTML b/public/src/Demo/Lectures/PCIInterrupts.HC.HTML deleted file mode 100644 index 654f4c5..0000000 --- a/public/src/Demo/Lectures/PCIInterrupts.HC.HTML +++ /dev/null @@ -1,85 +0,0 @@ - - - - - PCIInterrupts.HC - - - - - //See PCI.
-
-#if mp_cnt>1
-#define DEST_CPU 1
-#else
-#define DEST_CPU 0
-#endif
-
-#assert I_USER==0x40
-
-interrupt U0 IntMy40()
-{
- lock {progress1++;}
-*(dev.uncached_alias+LAPIC_EOI)(U32 *)=0;
-}
-
-interrupt U0 IntMy41()
-{
- lock {progress2++;}
-*(dev.uncached_alias+LAPIC_EOI)(U32 *)=0;
-}
-
-interrupt U0 IntMy42()
-{
- lock {progress3++;}
-*(dev.uncached_alias+LAPIC_EOI)(U32 *)=0;
-}
-
-interrupt U0 IntMy43()
-{
- lock {progress4++;}
-*(dev.uncached_alias+LAPIC_EOI)(U32 *)=0;
-}
-
-I64 vect[4]={&IntMy40,&IntMy41,&IntMy42,&IntMy43};
-
-U0 Main()
-{
- I64 i;
- U8 *da=dev.uncached_alias+IOAPIC_REG;
- U32 *_d=dev.uncached_alias+IOAPIC_DATA;
-
- ProgressBarsRst;
- for (i=I_USER;i<I_USER+4;i++)
- IntEntrySet(i,vect[i&3],IDTET_IRQ);
-
- //There are like 4*6 vects. Bus zero
- //has the first four vects.
- for (i=IOREDTAB;i<IOREDTAB+4*2;i+=2) {
- *da=i+1;
- *_d=dev.mp_apic_ids[DEST_CPU]<<24;
- *da=i;
- *_d=0x4000+0x40+(i-IOREDTAB)/2;
- }
-
- Sleep(1000);
- "The keyboard and timer seem to be active.\n"
- "IntA:%d IntB:%d IntC:%d IntD:%d\n\n"
- "IntB is my keybaord and regs a single KEY-UP.\n"
- "Rerun and press a few keys.\n",
- progress1,progress2,progress3,progress4;
-
- //Disable vects
- for (i=IOREDTAB;i<IOREDTAB+4*2;i+=2) {
- *da=i+1;
- *_d=dev.mp_apic_ids[DEST_CPU]<<24;
- *da=i;
- *_d=0x14000+0x40+(i-IOREDTAB)/2;
- }
- ProgressBarsRst;
-}
-
-Main;
- - - \ No newline at end of file diff --git a/public/src/Demo/Lectures/Ring3.HC.HTML b/public/src/Demo/Lectures/Ring3.HC.HTML deleted file mode 100644 index 508c81f..0000000 --- a/public/src/Demo/Lectures/Ring3.HC.HTML +++ /dev/null @@ -1,87 +0,0 @@ - - - - - Ring3.HC - - - - - /*TempleOS runs exclusively in ring 0.
-Ring 0 is part of the Charter.
-This demo is for you to play around
-with ring 3. TempleOS is for
-recreational programming, after all.
-
-This redirects the general protection
-fault, switches to ring 3, and generates
-a fault to switch back.
-*/
-
-U8 *old_stk,*new_rip;
-
-asm {
-INT_TO_RING0:: //Set to handle general protection 0xD fault temporarily.
- INC U64 [SYS_PROGRESS1]
- PUSH U32 CGDT.ds //STKSEG
- MOV RAX,U64 [&old_stk]
- PUSH RAX
- PUSH U32 0 //FLAGS--interrupts off
- PUSH U32 CGDT.cs64
- MOV RAX,U64 [&new_rip]
- PUSH RAX
- IRET
-}
-
-U0 Ring3Demo()
-{
- U8 *old_vect;
- "Progress1 Before:%X\n",progress1;
- CLI
- old_vect=IntEntrySet(0x0D,INT_TO_RING0,IDTET_TRAP,0);
-
- TSSBusy(Gs->tss->tr_ring3,OFF);
- SetRAX(Gs->tss->tr_ring3+3);
- LTR AX
-
- asm {
- MOV U64 [&old_stk],RSP
-
- LEA RAX,[R3_CALLBACK]
- MOV U64 [&new_rip],RAX
-
- MOV AX,CGDT.ds_ring3+3
- MOV DS,AX
- MOV ES,AX
-
- PUSH U32 CGDT.ds_ring3+3 //STKSEG
- PUSH U64 [&old_stk]
- PUSH U32 0 //FLAGS--interrupts off
- PUSH U32 CGDT.cs64_ring3+3
- LEA RAX,[R3_START]
- PUSH RAX
- IRET
-
- R3_START:
- INC U64 [SYS_PROGRESS1]
- CLI //This causes general protection fault #13
-
- R3_CALLBACK:
- MOV AX,CGDT.ds
- MOV DS,AX
- MOV ES,AX
- }
-
- TSSBusy(Gs->tss->tr,OFF);
- SetRAX(Gs->tss->tr);
- LTR AX
-
- IntEntrySet(0x0D,old_vect,IDTET_IRQ,0);
- STI
- "Progress1 After :%X\n",progress1;
-}
-
-Ring3Demo;
- - - \ No newline at end of file diff --git a/public/src/Demo/Lectures/ScrnMemory.HC.HTML b/public/src/Demo/Lectures/ScrnMemory.HC.HTML deleted file mode 100644 index 8cb7762..0000000 --- a/public/src/Demo/Lectures/ScrnMemory.HC.HTML +++ /dev/null @@ -1,61 +0,0 @@ - - - - - ScrnMemory.HC - - - - - //This just shows how scrn memory works.
-//See /Demo/Lectures/MiniGrLib.HC
-
-U0 PlotXY(I64 x,I64 y)
-{
-//Scrn bits are revd
- LBts(text.vga_alias,y*GR_WIDTH+x^7);
-}
-
-U0 Main()
-{
- I64 i;
- //This makes all 4 color planes active.
- OutU8(VGAP_IDX,VGAR_MAP_MASK);
- OutU8(VGAP_DATA,WHITE);
- MemSet(text.vga_alias,0,GR_WIDTH*GR_HEIGHT/8);
-
- OutU8(VGAP_IDX,VGAR_MAP_MASK);
- OutU8(VGAP_DATA,RED);
- for (i=0;i<200;i++)
- PlotXY(i,i);
-
- OutU8(VGAP_IDX,VGAR_MAP_MASK);
- OutU8(VGAP_DATA,GREEN);
- for (i=0;i<200;i++)
- PlotXY(100,i);
-
- OutU8(VGAP_IDX,VGAR_MAP_MASK);
- OutU8(VGAP_DATA,BLUE);
- for (i=0;i<200;i++)
- PlotXY(200-i,i);
-/*If you want a mixed color sel multiple planes
-but you have to be sure the unseled planes
-are zero, so sel them and make them zero.
-You can't do reads on VGA memory, by the way.
-That means no read-modify-writes, too.
-*/
- Busy(4000000);
-
- //TempleOS has a 4 plane memory duplicate of the scrn, gr.scrn_image,
- //and only writes actual changes.See GrUpdateVGAGraphics().
- //<CTRL-ALT-v> will flush scrn VGA cache.
- VGAFlush;
-}
-
-Main;
-
-//See /Demo/Lectures/GraphicsCPULoad.HC.
-
- - - \ No newline at end of file diff --git a/public/src/Demo/MagicPairs.HC.HTML b/public/src/Demo/MagicPairs.HC.HTML deleted file mode 100644 index 1542730..0000000 --- a/public/src/Demo/MagicPairs.HC.HTML +++ /dev/null @@ -1,387 +0,0 @@ - - - - - MagicPairs.HC - - - - - /*The magic pairs problem:
-
-Let SumFact(n) be the sum of factors
-of n.
-
-Find all n1,n2 in a range such that
-
-SumFact(n1)-n1-1==n2 and
-SumFact(n2)-n2-1==n1
-
------------------------------------------------------
-To find SumFact(k), start with prime factorization:
-
-k=(p1^n1)(p2^n2) ... (pN^nN)
-
-THEN,
-
-SumFact(k)=(1+p1+p1^2...p1^n1)*(1+p2+p2^2...p2^n2)*
-(1+pN+pN^2...pN^nN)
-
-PROOF:
-
-Do a couple examples -- it's obvious:
-
-48=2^4*3
-
-SumFact(48)=(1+2+4+8+16)*(1+3)=1+2+4+8+16+3+6+12+24+48
-
-75=3*5^2
-
-SumFact(75)=(1+3)*(1+5+25) =1+5+25+3+15+75
-
-Corollary:
-
-SumFact(k)=SumFact(p1^n1)*SumFact(p2^n2)*...*SumFact(pN^nN)
-
-*/
-
-//Primes are needed to sqrt(N). Therefore, we can use U32.
-class PowPrime
-{
- I64 n;
- I64 sumfact; //Sumfacts for powers of primes are needed beyond sqrt(N)
-};
-
-class Prime
-{
- U32 prime,pow_cnt;
- PowPrime *pp;
-};
-
-I64 *PrimesNew(I64 N,I64 *_sqrt_primes,I64 *_cbrt_primes)
-{
- I64 i,j,sqrt=Ceil(Sqrt(N)),cbrt=Ceil(N`(1/3.0)),sqrt_sqrt=Ceil(Sqrt(sqrt)),
- sqrt_primes=0,cbrt_primes=0;
- U8 *s=CAlloc((sqrt+1+7)/8);
- Prime *primes,*p;
-
- for (i=2;i<=sqrt_sqrt;i++) {
- if (!Bt(s,i)) {
- j=i*2;
- while (j<=sqrt) {
- Bts(s,j);
- j+=i;
- }
- }
- }
- for (i=2;i<=sqrt;i++)
- if (!Bt(s,i)) {
- sqrt_primes++; //Count primes
- if (i<=cbrt)
- cbrt_primes++;
- }
-
- p=primes=CAlloc(sqrt_primes*sizeof(Prime));
- for (i=2;i<=sqrt;i++)
- if (!Bt(s,i)) {
- p->prime=i;
- p++;
- }
- Free(s);
-
- *_sqrt_primes=sqrt_primes;
- *_cbrt_primes=cbrt_primes;
- return primes;
-}
-
-PowPrime *PowPrimesNew(I64 N,I64 sqrt_primes,Prime *primes,I64 *_num_powprimes)
-{
- I64 i,j,k,sf,num_powprimes=0;
- Prime *p;
- PowPrime *powprimes,*pp;
-
- p=primes;
- for (i=0;i<sqrt_primes;i++) {
- num_powprimes+=Floor(Ln(N)/Ln(p->prime));
- p++;
- }
-
- p=primes;
- pp=powprimes=MAlloc(num_powprimes*sizeof(PowPrime));
- for (i=0;i<sqrt_primes;i++) {
- p->pp=pp;
- j=p->prime;
- k=1;
- sf=1;
- while (j<N) {
- sf+=j;
- pp->n=j;
- pp->sumfact=sf;
- j*=p->prime;
- pp++;
- p->pow_cnt++;
- }
- p++;
- }
- *_num_powprimes=num_powprimes;
- return powprimes;
-}
-
-I64 SumFact(I64 n,I64 sqrt_primes,Prime *p)
-{
- I64 i,k,sf=1;
- PowPrime *pp;
- if (n<2)
- return 1;
- for (i=0;i<sqrt_primes;i++) {
- k=0;
- while (!(n%p->prime)) {
- n/=p->prime;
- k++;
- }
- if (k) {
- pp=p->pp+(k-1);
- sf*=pp->sumfact;
- if (n==1)
- return sf;
- }
- p++;
- }
- return sf*(1+n); //Prime
-}
-
-Bool TestSumFact(I64 n,I64 target_sf,I64 sqrt_primes,I64 cbrt_primes,Prime *p)
-{
- I64 i=0,k,b,x1,x2;
- PowPrime *pp;
- F64 disc;
- if (n<2)
- return FALSE;
- while (i++<cbrt_primes) {
- k=0;
- while (!(n%p->prime)) {
- n/=p->prime;
- k++;
- }
- if (k) {
- pp=p->pp+(k-1);
- if (ModU64(&target_sf,pp->sumfact))
- return FALSE;
- if (n==1) {
- if (target_sf==1)
- return TRUE;
- else
- return FALSE;
- }
- }
- p++;
- }
-/* At this point we have three possible cases to test
-1)n==p1 ->sf==(1+p1) ?
-2)n==p1*p1 ->sf==(1+p1+p1^2) ?
-3)n==p1*p2 ->sf==(p1+1)*(p2+1) ?
-
-*/
- if (1+n==target_sf) {
- while (i++<sqrt_primes) {
- k=0;
- while (!(n%p->prime)) {
- n/=p->prime;
- k++;
- }
- if (k) {
- pp=p->pp+(k-1);
- if (ModU64(&target_sf,pp->sumfact))
- return FALSE;
- if (n==1) {
- if (target_sf==1)
- return TRUE;
- else
- return FALSE;
- }
- }
- p++;
- }
- if (1+n==target_sf)
- return TRUE;
- else
- return FALSE;
- }
-
- k=Sqrt(n);
- if (k*k==n) {
- if (1+k+n==target_sf)
- return TRUE;
- else
- return FALSE;
- } else {
-// n==p1*p2 -> sf==(p1+1)*(p2+1) ? where p1!=1 && p2!=1
- // if p1==1 || p2==1, it is FALSE because we checked a single prime above.
-
- // sf==(p1+1)*(n/p1+1)
- // sf==n+p1+n/p1+1
- // sf*p1==n*p1+p1^2+n+p1
- // p1^2+(n+1-sf)*p1+n=0
- // x=(-b+/-sqrt(b^2-4ac))/2a
- // a=1
- // x=(-b+/-sqrt(b^2-4c))/2
- // b=n+1-sf;c=n
- b=n+1-target_sf;
-// x=(-b+/-sqrt(b^2-4n))/2
- disc=b*b-4*n;
- if (disc<0)
- return FALSE;
- x1=(-b-Sqrt(disc))/2;
- if (x1<=1)
- return FALSE;
- x2=n/x1;
- if (x2>1 && x1*x2==n)
- return TRUE;
- else
- return FALSE;
- }
-}
-
-U0 PutFactors(I64 n) //For debugging
-{
- I64 i,k,sqrt=Ceil(Sqrt(n));
- for (i=2;i<=sqrt;i++) {
- k=0;
- while (!(n%i)) {
- k++;
- n/=i;
- }
- if (k) {
- "%d",i;
- if (k>1)
- "^%d",k;
- '' CH_SPACE;
- }
- }
- if (n!=1)
- "%d ",n;
-}
-
-class RangeJob
-{
- CDoc *doc;
- I64 num,lo,hi,N,sqrt_primes,cbrt_primes;
- Prime *primes;
- CJob *cmd;
-} rj[mp_cnt];
-
-I64 TestCoreSubRange(RangeJob *r)
-{
- I64 i,j,m,n,n2,sf,res=0,range=r->hi-r->lo,
- *sumfacts=MAlloc(range*sizeof(I64)),
- *residue =MAlloc(range*sizeof(I64));
- U16 *pow_cnt =MAlloc(range*sizeof(U16));
- Prime *p=r->primes;
- PowPrime *pp;
- MemSetI64(sumfacts,1,range);
- for (n=r->lo;n<r->hi;n++)
- residue[n-r->lo]=n;
- for (j=0;j<r->sqrt_primes;j++) {
- MemSet(pow_cnt,0,range*sizeof(U16));
- m=1;
- for (i=0;i<p->pow_cnt;i++) {
- m*=p->prime;
- n=m-r->lo%m;
- while (n<range) {
- pow_cnt[n]++;
- n+=m;
- }
- }
- for (n=0;n<range;n++)
- if (i=pow_cnt[n]) {
- pp=&p->pp[i-1];
- sumfacts[n]*=pp->sumfact;
- residue [n]/=pp->n;
- }
- p++;
- }
-
- for (n=0;n<range;n++)
- if (residue[n]!=1)
- sumfacts[n]*=1+residue[n];
-
- for (n=r->lo;n<r->hi;n++) {
- sf=sumfacts[n-r->lo];
- n2=sf-n-1;
- if (n<n2<r->N) {
- if (r->lo<=n2<r->hi && sumfacts[n2-r->lo]-n2-1==n ||
- TestSumFact(n2,sf,r->sqrt_primes,r->cbrt_primes,r->primes)) {
- DocPrint(r->doc,"%u:%u\n",n,sf-n-1);
- res++;
- }
- }
- }
- Free(pow_cnt);
- Free(residue);
- Free(sumfacts);
- return res;
-}
-
-#define CORE_SUB_RANGE 0x1000
-
-I64 TestCoreRange(RangeJob *r)
-{
- I64 i,n,res=0;
- RangeJob rj;
- MemCpy(&rj,r,sizeof(RangeJob));
- for (i=r->lo;i<r->hi;i+=CORE_SUB_RANGE) {
- rj.lo=i;
- rj.hi=i+CORE_SUB_RANGE;
- if (rj.hi>r->hi)
- rj.hi=r->hi;
- res+=TestCoreSubRange(&rj);
-
- n=rj.hi-rj.lo;
- lock {progress1+=n;}
-
- Yield;
- }
- return res;
-}
-
-I64 MagicPairs(I64 N)
-{
- F64 t0=tS;
- I64 res=0;
- I64 sqrt_primes,cbrt_primes,num_powprimes,
- i,k,n=(N-1)/mp_cnt+1;
- Prime *primes=PrimesNew(N,&sqrt_primes,&cbrt_primes);
- PowPrime *powprimes=PowPrimesNew(N,sqrt_primes,primes,&num_powprimes);
-
- "N:%u SqrtPrimes:%u CbrtPrimes:%u PowersOfPrimes:%u\n",
- N,sqrt_primes,cbrt_primes,num_powprimes;
- progress1=0;
- *progress1_desc=0;
- progress1_max=N;
- k=2;
- for (i=0;i<mp_cnt;i++) {
- rj[i].doc=DocPut;
- rj[i].num=i;
- rj[i].lo=k;
- k+=n;
- if (k>N) k=N;
- rj[i].hi=k;
- rj[i].N=N;
- rj[i].sqrt_primes=sqrt_primes;
- rj[i].cbrt_primes=cbrt_primes;
- rj[i].primes=primes;
- rj[i].cmd=JobQue(&TestCoreRange,&rj[i],mp_cnt-1-i,0);
- }
- for (i=0;i<mp_cnt;i++)
- res+=JobResGet(rj[i].cmd);
- Free(powprimes);
- Free(primes);
- "Found:%u Time:%9.4f\n",res,tS-t0;
- progress1=progress1_max=0;
- return res;
-}
-
-MagicPairs(1000000);
- - - \ No newline at end of file diff --git a/public/src/Demo/MemDemo.HC.HTML b/public/src/Demo/MemDemo.HC.HTML deleted file mode 100644 index f8ed936..0000000 --- a/public/src/Demo/MemDemo.HC.HTML +++ /dev/null @@ -1,76 +0,0 @@ - - - - - MemDemo.HC - - - - - U0 MemDemo()
-{
- I64 i;
-"$HL,1$$BLACK$
-#define MEM_PAG_BITS 9
-#define MEM_PAG_SIZE (1<<MEM_PAG_BITS)
-#define MEM_HEAP_HASH_SIZE 1024
-#define MEM_FREE_PAG_HASH_SIZE 0x100
-#define MEM_EXTRA_HASH2_PAGS 2
-
-public class CBlkPool
-{
- CMemBlk *free_pag_hash[MEM_FREE_PAG_HASH_SIZE],
- *free_pag_hash2[64-MEM_PAG_BITS];
-};
-
-public class CHeapCtrl
-{
- CBlkPool *bp;
- CMemUnused *heap_hash[MEM_HEAP_HASH_SIZE/sizeof(U8 *)];
-};
-
-public class CTask //The Fs segment reg points to current CTask.
-{
- CHeapCtrl *code_heap,*data_heap;
-};
-$HL,0$$FG$
-
-";
-
-
- "$PURPLE$Chunks in increments of 8 bytes, owned by the task.$FG$\n";
- for (i=sizeof(CMemUnused);i<MEM_HEAP_HASH_SIZE;i+=8)
- if (i==0x48)
- "...\n";
- else if (!(0x48<i<0x3C8))
- "Fs->data_heap->heap_hash[%X/8]"
- "$BLACK$ -->$FG$[X]$BLACK$ -->$FG$[X]$BLACK$ -->$FG$\n",i;
- "\n\n";
-
- "$PURPLE$Pages of 512 bytes, owned by the system.$FG$\n";
- for (i=MEM_HEAP_HASH_SIZE;i<MEM_FREE_PAG_HASH_SIZE*MEM_PAG_SIZE;
- i+=MEM_PAG_SIZE)
- if (i==0x1200)
- "...\n";
- else if (!(0x1200<i<0x1F200))
- "Fs->data_heap->bp->free_pag_hash[%X/512]"
- "$BLACK$ -->$FG$[X]$BLACK$ -->$FG$[X]$BLACK$ -->$FG$\n",i;
- "\n\n";
-
- "$PURPLE$Powers of two, owned by the system.$FG$\n";
- for (i=Bsf(MEM_FREE_PAG_HASH_SIZE*MEM_PAG_SIZE);i<64;i++)
- if (i==0x1A)
- "...\n";
- else if (!(0x1A<=i<=0x36))
- "Fs->data_heap->bp->free_pag_hash2[%X] %016X"
- "$BLACK$ -->$FG$[X]$BLACK$ -->$FG$[X]$BLACK$ -->$FG$\n",i,
- 1<<i+MEM_EXTRA_HASH2_PAGS*MEM_PAG_SIZE;
- "\n\n";
-}
-
-MemDemo;
-
-
- - - \ No newline at end of file diff --git a/public/src/Demo/MsgLoop.HC.HTML b/public/src/Demo/MsgLoop.HC.HTML deleted file mode 100644 index a941861..0000000 --- a/public/src/Demo/MsgLoop.HC.HTML +++ /dev/null @@ -1,35 +0,0 @@ - - - - - MsgLoop.HC - - - - - U0 MsgLoop()
-{
- I64 arg1,arg2,msg_code;
- "Use msg_code defines in your programs instead of hardcoded nums.\n"
- "<ESC> to Exit\n";
-
- //We don't want the mouse bttns to reposition the cursor,
- //so we inhibit the window mgr from processing them.
-
- Fs->win_inhibit=WIF_SELF_MS_L|WIF_SELF_MS_R;
-
- do {
- msg_code=GetMsg(&arg1,&arg2,~(1<<MSG_NULL));
- "CMD:%02X ARG1:%08X ARG2:%016X\n",msg_code,arg1,arg2;
- } while (msg_code!=MSG_KEY_DOWN || arg1!=CH_ESC && arg1!=CH_SHIFT_ESC);
- GetMsg(,,1<<MSG_KEY_UP);
-
- Fs->win_inhibit=WIG_USER_TASK_DFT;
-}
-
-MsgLoop;
-
-// Press <CTRL-SHIFT-L> and "Insert ASCII/ScanCode".
- - - \ No newline at end of file diff --git a/public/src/Demo/MultiCore/Interrupts.HC.HTML b/public/src/Demo/MultiCore/Interrupts.HC.HTML deleted file mode 100644 index 359da62..0000000 --- a/public/src/Demo/MultiCore/Interrupts.HC.HTML +++ /dev/null @@ -1,35 +0,0 @@ - - - - - Interrupts.HC - - - - - interrupt U0 IntBeepOn()
-{
- *(dev.uncached_alias+LAPIC_EOI)(U32 *)=0; //signal end of interrupt
- Snd(34);
-}
-
-interrupt U0 IntBeepOff()
-{
- *(dev.uncached_alias+LAPIC_EOI)(U32 *)=0;
- Snd;
-}
-
-U0 IntTest()
-{//Modify interrupt descriptor table use by all cores.
- IntEntrySet(I_USER,&IntBeepOn,IDTET_TRAP);
- IntEntrySet(I_USER+1,&IntBeepOff,IDTET_TRAP);
-//Issue interupt to core1
- MPInt(I_USER,1);
- Sleep(1000);
- MPInt(I_USER+1,1);
-}
-
-IntTest;
- - - \ No newline at end of file diff --git a/public/src/Demo/MultiCore/LoadTest.HC.HTML b/public/src/Demo/MultiCore/LoadTest.HC.HTML deleted file mode 100644 index eb1ec22..0000000 --- a/public/src/Demo/MultiCore/LoadTest.HC.HTML +++ /dev/null @@ -1,60 +0,0 @@ - - - - - LoadTest.HC - - - - - Bool app_done;
-I64 app_done_ack;
-
-U0 Job1(I64)
-{//Compile Compiler
- Silent;
- while (!app_done) {
- Cd("::/Compiler");
- Cmp("Compiler");
- }
- lock {app_done_ack--;}
-}
-
-U0 Job2(I64)
-{//Log a file
- while (!app_done) {
- AdamLog("%F","::/Demo/MultiCore/LoadTest.HC");
- Yield;
- }
- lock {app_done_ack--;}
-}
-
-U0 Job3(I64)
-{//Log a file
- while (!app_done) {
- Cd("::/Compiler");
- AdamLog("%F","Compiler.PRJ.Z");
- Yield;
- }
- lock {app_done_ack--;}
-}
-
-U0 Main()
-{
- app_done=FALSE;
- "Running MultiCore Test...\n";
- Spawn(&Job1,,,1); //core #1
- Spawn(&Job2,,,1);
- Spawn(&Job3,,,1);
- PressAKey;
-//We don't want to yank code from under MP cores.
- app_done_ack=3;
- app_done=TRUE;
- while (app_done_ack)
- Yield;
-}
-
-Main;
- - - \ No newline at end of file diff --git a/public/src/Demo/MultiCore/Lock.HC.HTML b/public/src/Demo/MultiCore/Lock.HC.HTML deleted file mode 100644 index 81d1cdd..0000000 --- a/public/src/Demo/MultiCore/Lock.HC.HTML +++ /dev/null @@ -1,64 +0,0 @@ - - - - - Lock.HC - - - - - /*lock{} is a compiler stmt
-which places asm LOCK inst
-prefixes on code.Only use it on
-read-modify-write stmts.
-It will generate invalid insts
-if you misuse it and it will crash.
-U() to see what code was generated.
-*/
-
-#define CNT 0x1000000
-
-I64 glbl;
-
-U0 MPUnlockedInc(I64)
-{
- I64 i;
- for (i=0;i<CNT;i++)
- glbl++;
-}
-
-U0 UnlockedInc()
-{
- CJob *tmpm0,*tmpm1;
- glbl=0;
- tmpm0=JobQue(&MPUnlockedInc,NULL,0,0);
- tmpm1=JobQue(&MPUnlockedInc,NULL,1,0);
- JobResGet(tmpm0);
- JobResGet(tmpm1);
- "Correct Cnt:%X Actual Cnt:%X\n",CNT*2,glbl;
-}
-
-U0 MPLockedInc(I64)
-{
- I64 i;
- for (i=0;i<CNT;i++)
- lock //Can be used without {}
- glbl++;
-}
-
-U0 LockedInc()
-{
- CJob *tmpm0,*tmpm1;
- glbl=0;
- tmpm0=JobQue(&MPLockedInc,NULL,0,0);
- tmpm1=JobQue(&MPLockedInc,NULL,1,0);
- JobResGet(tmpm0);
- JobResGet(tmpm1);
- "Correct Cnt:%X Actual Cnt:%X\n",CNT*2,glbl;
-}
-
-UnlockedInc;
-LockedInc;
- - - \ No newline at end of file diff --git a/public/src/Demo/MultiCore/MPAdd.HC.HTML b/public/src/Demo/MultiCore/MPAdd.HC.HTML deleted file mode 100644 index 4677bb5..0000000 --- a/public/src/Demo/MultiCore/MPAdd.HC.HTML +++ /dev/null @@ -1,97 +0,0 @@ - - - - - MPAdd.HC - - - - - I64 mp_n;
-
-I64 MPSum(I64 my_mp_cnt)
-{//We could use the formula n*(n+1)/2
- I64 lo=mp_n*Gs->num/my_mp_cnt,
- hi=mp_n*(Gs->num+1)/my_mp_cnt,
- res=0,i;
- for (i=lo;i<hi;i++)
- res+=i;
- return res;
-}
-
-I64 Sum(I64 n,I64 my_mp_cnt)
-{
- CJob *tmpm[MP_PROCESSORS_NUM];
- I64 res=0,i;
- mp_n=n+1;
- for (i=0;i<my_mp_cnt;i++)
- tmpm[i]=JobQue(&MPSum,my_mp_cnt,i,0);
- for (i=0;i<my_mp_cnt;i++)
- res+=JobResGet(tmpm[i]);
- return res;
-}
-
-#define SAMPLE_SIZE 100
-
-F64 Test(I64 n,I64 my_mp_cnt)
-{
- I64 i,val=0;
- F64 start,end;
- start=tS;
- for (i=0;i<SAMPLE_SIZE;i++)
- val+=Sum(n,my_mp_cnt);
- end=tS;
- "Val:%,d\n",val/SAMPLE_SIZE;
- "$RED$N:%12,d Time:%10.8f$FG$\n",n,(end-start)/SAMPLE_SIZE;
- return end-start;
-}
-
-#define VAL_MIN 1000
-#define TEST_MIN 3
-#define TEST_MAX 7
-#define TESTS_NUM (TEST_MAX-TEST_MIN+1)
-#define PERCENT_MAX 200
-
-U0 MPAdd()
-{
- I64 i,n,
- h=Fs->pix_width,
- v=Fs->pix_height;
- F64 t1,t2,ress[TESTS_NUM];
- CDC *dc=DCAlias;
-
- for (i=0,n=VAL_MIN;i<TESTS_NUM;i++,n*=10) {
- t1=Test(n,1);
- t2=Test(n,mp_cnt);
- ress[i]=t2*100.0/t1;
- "$GREEN$%8.4f%%$FG$\n\n",ress[i];
- }
- PressAKey;
-
- DocClear;
-
- dc->color=BLUE;
- for (i=PERCENT_MAX/10;i<PERCENT_MAX;i+=PERCENT_MAX/10) {
- GrPrint(dc,0,v-ToF64(i)/PERCENT_MAX*v-FONT_HEIGHT,"%3d%%",i);
- GrLine(dc,0,v-ToF64(i)/PERCENT_MAX*v,h,v-ToF64(i)/PERCENT_MAX*v);
- }
-
- for (i=0;i<TESTS_NUM-1;i++) {
- dc->color=RED;
- dc->thick=2;
- GrLine3(dc,i*h/(TESTS_NUM-1), v-ress[i ]/PERCENT_MAX*v,0,
- (i+1)*h/(TESTS_NUM-1),v-ress[i+1]/PERCENT_MAX*v,0);
- dc->color=GREEN;
- GrPrint(dc,i*h/(TESTS_NUM-1),v-FONT_HEIGHT,"10e%d",i+TEST_MIN);
- GrLine(dc,i*h/(TESTS_NUM-1),0,i*h/(TESTS_NUM-1),v);
- }
- PressAKey;
-
- DCFill;
- DCDel(dc);
-}
-
-MPAdd;
- - - \ No newline at end of file diff --git a/public/src/Demo/MultiCore/MPPrint.HC.HTML b/public/src/Demo/MultiCore/MPPrint.HC.HTML deleted file mode 100644 index 3d77f6c..0000000 --- a/public/src/Demo/MultiCore/MPPrint.HC.HTML +++ /dev/null @@ -1,29 +0,0 @@ - - - - - MPPrint.HC - - - - - U0 Job(CDoc *doc)
-{
- I64 i;
- for (i=0;i<2;i++)
- DocPrint(doc,"$FG,%d$CPU%d",Gs->num&15,Gs->num);
-}
-
-U0 MPPrintDemo()
-{
- I64 i;
- for (i=0;i<500;i++)
- JobQue(&Job,DocPut,i%mp_cnt);
- Sleep(500);
- "$FG$\n";
-}
-
-MPPrintDemo;
- - - \ No newline at end of file diff --git a/public/src/Demo/MultiCore/MPRadix.HC.HTML b/public/src/Demo/MultiCore/MPRadix.HC.HTML deleted file mode 100644 index 5d1d81b..0000000 --- a/public/src/Demo/MultiCore/MPRadix.HC.HTML +++ /dev/null @@ -1,154 +0,0 @@ - - - - - MPRadix.HC - - - - - /*
-On an 8-core machine, this takes the top 3-bits
-of random numbers and distributes them to the 8 cores
-for sorting. Then, it merge sorts them.
-*/
-
-#define NUM 1000000
-
-I64 my_mp_cnt=1<<Bsr(mp_cnt);//Power of 2
-
-I32 *arg1,*arg2;
-I32 *b[my_mp_cnt],bn[my_mp_cnt];
-I64 mp_not_done_flags;
-
-I64 Compare(I32 *e1,I32 *e2)
-{
- return *e1-*e2;
-}
-
-U0 QSortU32(I32 *base,I64 num)
-{//By customizing, we dramatically improve it!
-//Cut and paste from QSortI64().
- I64 i;
- I32 *less,*greater,pivot;
- if (num>1) {
- do {
- less=base;
- greater=base+num;
- pivot=base[num/2];
- while (less<greater) {
- if (*less<=pivot)
- less++;
- else {
- greater--;
- SwapU32(less,greater);
- }
- }
- i=less-base;
- if (i==num) {//All less or equ to pivot
-
- //Point greater to first less
- do greater--;
- while (--i && *greater==pivot);
-
- if (i) {
- less=base+num/2; //Pivot was not moved, point to it
- if (less<greater)
- SwapU32(less,greater);
- num=i;
- } else //All equ
- break;
- } else if (i<num/2) {
- QSortU32(base,i);
- num-=i;
- base=greater;
- } else {
- QSortU32(greater,num-i);
- num=i;
- }
- } while (num>1);
- }
-}
-
-U0 MPSort(I64 dummy=0)
-{
- no_warn dummy;
- QSortU32(b[Gs->num],bn[Gs->num]);
- LBtr(&mp_not_done_flags,Gs->num);
-}
-
-U0 MPRadixSortDemo(I64 dummy=0)
-{
- no_warn dummy;
- I64 i,j,k1,k2;
- F64 t0;
- arg1=MAlloc(NUM*sizeof(I32));
- for (i=0;i<NUM;i++)
- arg1[i]=RandI32;
-
- arg2=MAlloc(NUM*sizeof(I32));
-
- "$GREEN$QSort$FG$\n";
- t0=tS;
- MemCpy(arg2,arg1,sizeof(I32)*NUM);
- QSort(arg2,NUM,sizeof(I32),&Compare);
- "Time:%9.6f\n",tS-t0;
- D(arg2+NUM/4);
-
- "$GREEN$QSortU32$FG$\n";
- t0=tS;
- MemCpy(arg2,arg1,sizeof(I32)*NUM);
- QSortU32(arg2,NUM);
- "Time:%9.6f\n",tS-t0;
- D(arg2+NUM/4);
-
- for (i=0;i<my_mp_cnt;i++) {
-//We must do full size, just in case.
- //There will be uneven split between cores
- //depending on the distribution of rand numbers.
- b[i]=MAlloc(NUM*sizeof(I32));
- bn[i]=0;
- }
-
- if (my_mp_cnt<2) throw('MultCore');
-
- "$GREEN$MP Radix QSortU32$FG$\n";
- t0=tS;
- k1=32-Bsr(my_mp_cnt);
- k2=my_mp_cnt/2;
- for (i=0;i<NUM;i++) {
- j=arg1[i]>>k1+k2; //This is a preliminary radix sort.
- b[j][bn[j]++]=arg1[i];
- }
- mp_not_done_flags=1<<my_mp_cnt-1;
- for (i=0;i<my_mp_cnt;i++)
- Spawn(&MPSort,NULL,NULL,i);
- while (mp_not_done_flags)
- Yield;
- j=0;
- for (i=0;i<my_mp_cnt;i++) {
- MemCpy(&arg2[j],b[i],bn[i]*sizeof(I32));
- j+=bn[i];
- }
- "Time:%9.6f\n",tS-t0;
- D(arg2+NUM/4);
-
- Free(arg1);
- Free(arg2);
- for (i=0;i<my_mp_cnt;i++)
- Free(b[i]);
-}
-
-MPRadixSortDemo;
-
-/*$HL,0$ Results on 8 Cores 3.397GHz Core i7:
-QSort
-Time: 0.759998
-QSortU32
-Time: 0.093684
-MP Radix QSortU32
-Time: 0.045450
-$HL,1$*/
- - - \ No newline at end of file diff --git a/public/src/Demo/MultiCore/Palindrome.HC.HTML b/public/src/Demo/MultiCore/Palindrome.HC.HTML deleted file mode 100644 index da1f9b6..0000000 --- a/public/src/Demo/MultiCore/Palindrome.HC.HTML +++ /dev/null @@ -1,108 +0,0 @@ - - - - - Palindrome.HC - - - - - #define BORDER_CHARS 1
-
-U8 *buf;
-I64 size,mp_not_done_flags;
-CDoc *doc;
-
-U0 PDNormalize()
-{
- U8 *r=MAlloc(size+2*BORDER_CHARS),
- *src=buf,*dst=r;
- I64 ch;
- *dst++='['; //Border
- while (size--) {
- ch=*src++;
- if ('a'<=ch<='z') //lower is most common so do first
- *dst++=ch;
- else if ('A'<=ch<='Z')
- *dst++=ch+'a'-'A'; //Convert to lower
- }
- *dst++=']'; //Border
- Free(buf);
- buf=r;
- size=dst-r-2*BORDER_CHARS;
-}
-
-U0 PDAnswer(U8 *a,I64 len)
-{
- DocLock(doc);
- a-=(len-1)/2;
- DocPrint(doc,"CPU%02X Len:%2d ",Gs->num,len);
- while (len--)
- DocPrint(doc,"%C",*a++); //%C is toupper char
- DocPrint(doc,"\n");
- DocUnlock(doc);
-}
-
-U0 MPPalindrome(I64 dummy=0)
-{
- no_warn dummy;
- U8 *src=buf+BORDER_CHARS+size*Gs->num/mp_cnt,
- *f,*b;
- I64 len,best=0,
- my_size=(size+mp_cnt-1)/mp_cnt;
- while (my_size--) {
-
- //Odd
- f=src+1;
- b=src-1;
- while (*f==*b) {
- f++;
- b--;
- }
- len=f-b+1-2;
- if (len>best) {
- best=len;
- PDAnswer(src,len);
- }
-
- //Even
- f=src+1;
- b=src;
- while (*f==*b) {
- f++;
- b--;
- }
- len=f-b+1-2;
- if (len>best) {
- best=len;
- PDAnswer(src,len);
- }
-
- src++;
- }
- LBtr(&mp_not_done_flags,Gs->num);
-}
-
-U0 Palindrome(U8 *filename)
-{
- I64 i;
- F64 t0=tS;
-
- buf=FileRead(filename,&size);
- PDNormalize;
-
- doc=DocPut;
- mp_not_done_flags=1<<mp_cnt-1;
- for (i=0;i<mp_cnt;i++)
- JobQue(&MPPalindrome,NULL,i);
- while (mp_not_done_flags)
- Yield;
-
- Free(buf);
- "Time:%9.5f\n",tS-t0;
-}
-
-Palindrome(BIBLE_FILENAME);
- - - \ No newline at end of file diff --git a/public/src/Demo/MultiCore/Primes.HC.HTML b/public/src/Demo/MultiCore/Primes.HC.HTML deleted file mode 100644 index 7ab3832..0000000 --- a/public/src/Demo/MultiCore/Primes.HC.HTML +++ /dev/null @@ -1,87 +0,0 @@ - - - - - Primes.HC - - - - - U8 *master_bitmap;
-I64 prime_range,my_mp_cnt,pending;
-
-U0 PrimesJob(I64 i)
-{
- I64 j,k,l=Sqrt(prime_range),
- lo=i*prime_range/my_mp_cnt,
- hi=(i+1)*prime_range/my_mp_cnt,
- lo2=lo+sys_cache_line_width,
- hi2=hi-sys_cache_line_width;
- if (lo2>hi2) lo2=hi2;
- for (j=2;j<=l;j++) {
- if (!Bt(master_bitmap,j)) {
- if (j>=lo)
- k=j+j;
- else {
- k=lo-lo%j;
- if (k<lo)
- k+=j;
- }
- while (k<lo2) {
- LBts(master_bitmap,k);
- k+=j;
- }
- while (k<hi2) {
- Bts(master_bitmap,k);
- k+=j;
- }
- while (k<hi) {
- LBts(master_bitmap,k);
- k+=j;
- }
- }
- }
- lock pending--;
-}
-
-I64 Primes(I64 range,I64 _my_mp_cnt)
-{
- I64 i,prime_cnt=0;
- F64 t0=tS,tf;
- prime_range=range;
- if (_my_mp_cnt<=mp_cnt)
- my_mp_cnt=_my_mp_cnt;
- else
- my_mp_cnt=mp_cnt;
- master_bitmap=CAlloc((prime_range+7)/8+1);
- Bts(master_bitmap,0);
- Bts(master_bitmap,1);
- pending=my_mp_cnt;
- for (i=0;i<my_mp_cnt;i++)
- JobQue(&PrimesJob,i,i);
- while (pending)
- Yield;
- tf=tS;
-
- for (i=0;i<prime_range;i++)
- if (!Bt(master_bitmap,i))
- prime_cnt++;
-
- for (i=MaxI64(prime_range-100,0);i<prime_range;i++)
- if (!Bt(master_bitmap,i))
- "%d ",i;
-
- "\n$RED$CPUs:%d PrimeRange:%,d PrimeCnt:%,d Time:%9.7,f$FG$\n",
- my_mp_cnt,prime_range,prime_cnt,tf-t0;
-
- Free(master_bitmap);
- return prime_cnt;
-}
-
-Primes(100,1);
-Primes(100,mp_cnt);
-Primes(1000000,1);
-Primes(1000000,mp_cnt);
- - - \ No newline at end of file diff --git a/public/src/Demo/NullCase.HC.HTML b/public/src/Demo/NullCase.HC.HTML deleted file mode 100644 index c588938..0000000 --- a/public/src/Demo/NullCase.HC.HTML +++ /dev/null @@ -1,31 +0,0 @@ - - - - - NullCase.HC - - - - - //This shows a switch stmt with some null cases.
-//If no number for the case,
-//it uses one plus prev case number.
-
-U0 NullCase()
-{
- I64 i;
- for (i=0;i<20;i++)
- switch (i) {
- case: "Zero\n"; break; //Starts at zero
- case: "One\n"; break; //One plus prev case.
- case: "Two\n"; break;
- case: "Three\n"; break;
- case 10: "Ten\n"; break;
- case: "Eleven\n"; break; //One plus prev case.
- }
-}
-
-NullCase;
- - - \ No newline at end of file diff --git a/public/src/Demo/OnceDemo.HC.HTML b/public/src/Demo/OnceDemo.HC.HTML deleted file mode 100644 index a345cbd..0000000 --- a/public/src/Demo/OnceDemo.HC.HTML +++ /dev/null @@ -1,24 +0,0 @@ - - - - - OnceDemo.HC - - - - - U0 OnceDemo()
-{//Set code to execute next reboot.
- Once("Beep;");
- Once("Dir;"); //You can issue multiple and they get queued.
- "Reboot ";
- if (YorN)
- BootRAM;
-}
-
-OnceDemo;
-
-//There are variants for adam AOnce().
- - - \ No newline at end of file diff --git a/public/src/Demo/ParenWarn.HC.HTML b/public/src/Demo/ParenWarn.HC.HTML deleted file mode 100644 index 8c40893..0000000 --- a/public/src/Demo/ParenWarn.HC.HTML +++ /dev/null @@ -1,29 +0,0 @@ - - - - - ParenWarn.HC - - - - - Option(OPTf_WARN_PAREN,ON);
-
-F64 d,d1=1,d2=1;
-
-d1=(d2=3.0);
-
-d1=(d2+3.0);
-
-d=(d1+d2)+(d1+d2);
-
-d=(2`3)`2;
-
-d=2`(3`2);
-
-d=-d1`(d+d2);
-
-Option(OPTf_WARN_PAREN,OFF);
- - - \ No newline at end of file diff --git a/public/src/Demo/PhoneNumWords.HC.HTML b/public/src/Demo/PhoneNumWords.HC.HTML deleted file mode 100644 index c435649..0000000 --- a/public/src/Demo/PhoneNumWords.HC.HTML +++ /dev/null @@ -1,75 +0,0 @@ - - - - - PhoneNumWords.HC - - - - - U8 char_map[26]="22233344455566677778889999";
-
-/*
-Fmt of word lst entry:
- U8 ACD_WORD_CHAR
- U8 word[] with terminating zero
- I16 block; //definition offset in ::/Adam/AutoComplete/ACDefs.DATA
-*/
-U0 PhoneNumWords(U8 *num)
-{
- I64 ch;
- U8 *_num=StrNew(num),*dst=_num,
- *dict=acd.word_lst,*st,*src;
- while (*num) {
- if ('0'<=*num<='9')
- *dst++=*num;
- num++;
- }
- *dst=0;
-
- while (*dict++) {
- if (StrLen(dict)>2) {
- dst=st=StrNew(dict);
- while (ch=ToUpper(*dst)) {
- if ('A'<=ch<='Z')
- *dst=char_map[ch-'A'];
- else
- *dst=CH_SPACE;
- dst++;
- }
- *dst=0;
-
- src=_num;
- while (*src) {
- if (!StrNCmp(st,src,StrLen(st))) {
- ch=*src;
- *src=0;
- "%s",_num;
- *src=ch;
- "$GREEN$%s$FG$",dict;
- "%s\n",src+StrLen(st);
- }
- src++;
- }
- Free(st);
- }
- dict+=StrLen(dict)+3;
- }
- Free(_num);
- '\n';
-}
-
-U0 PNWDemo()
-{
- U8 *st;
- while ((st=GetStr("Phone Num:")) && *st) {
- PhoneNumWords(st);
- Free(st);
- }
- Free(st);
-}
-
-PNWDemo;
- - - \ No newline at end of file diff --git a/public/src/Demo/Print.HC.HTML b/public/src/Demo/Print.HC.HTML deleted file mode 100644 index eec3042..0000000 --- a/public/src/Demo/Print.HC.HTML +++ /dev/null @@ -1,45 +0,0 @@ - - - - - Print.HC - - - - - //TempleOS supports standard Print()
-//codes and extended ones.
-//See $LK,"Print(\"\") Fmt Strings",A="FI:::/Doc/Print.DD"$.
-
-//Demonstrates aux_fmt_num codes.
-
-"%10h?d\n",123456789;
-"%10h?d\n",12345;
-
-"%10h3d\n",123456789;
-"%10h3d\n",12345;
-
-"\nWith the ',' flag:\n";
-"%10,h3d\n",123456789;
-"%10,h3d\n",12345;
-
-"\nFloating Point:\n";
-"%16h?n\n",.00123456789;
-"%16h?n\n",12345.0;
-
-"%16.2h-6n\n",.00123456789;
-"%16.2h-6n\n",12345.0;
-
-'\n';
-
-"%h25c\n",'x'; //Print 25 x's
-
-"%h*c\n",25,'y'; //Print 25 y's
-
-'zzzz\n'; //PutChars() up to 8 characters.
-
-'\n';
-
- - - \ No newline at end of file diff --git a/public/src/Demo/Progress.HC.HTML b/public/src/Demo/Progress.HC.HTML deleted file mode 100644 index e09eae1..0000000 --- a/public/src/Demo/Progress.HC.HTML +++ /dev/null @@ -1,92 +0,0 @@ - - - - - Progress.HC - - - - - /*progress1-progress4 are just global vars
-shown on the wallpaper. I use them in debugging a lot.
-
-If you set progress1_max-progress4_max,
-then a progress bar will display.
-
-If you set progress1_t0-progress4_t0
-then the elapsed time will display.
-
-If you set progress1_tf-progress4_tf
-then the estimated time will display.
-*/
-
-U0 Main1()
-{
- "\nWith description.\n";
- PressAKey;
- progress1_max=200;
- StrCpy(progress1_desc,"Progress Demo"); //PROGRESS_DESC_LEN is max
- while (progress1++!=progress1_max)
- Sleep(20);
- ProgressBarsRst;
-}
-Main1;
-
-U0 Main2()
-{
- "\nWith description and elapsed time.\n";
- PressAKey;
- progress1_max=200;
- progress1_t0=tS;
- StrCpy(progress1_desc,"Progress Demo"); //PROGRESS_DESC_LEN is max
- while (progress1++!=progress1_max)
- Sleep(20);
- ProgressBarsRst;
-}
-Main2;
-
-U0 Main3()
-{
- "\nWith description, elapsed time and registry total time.\n";
- PressAKey;
- progress1_max=200;
- progress1_t0=tS;
- RegExe("DemoCompany/ProgressBars");
- StrCpy(progress1_desc,"Progress Demo"); //PROGRESS_DESC_LEN is max
- while (progress1++!=progress1_max)
- Sleep(20);
- ProgressBarsRst("DemoCompany/ProgressBars");
-}
-Main3;
-
-U0 Main4()
-{
- "\nNo description.\n";
- PressAKey;
- progress1_max=200;
- while (progress1++!=progress1_max)
- Sleep(20);
- ProgressBarsRst;
-}
-Main4;
-
-
-"\nNow, from asm... It's handy for debugging.\n"
-"Watch the progress on the wallpaper.\n";
-WinBorder(ON);
-PressAKey;
-
-asm {
-_PROGRESS_DEMO::
- MOV RCX,12000000
-@@05: MOV U64 [&progress1],RCX
- CALL &Yield
- LOOP @@05
- MOV U64 [&progress1],RCX
- RET
-}
-_extern _PROGRESS_DEMO U0 AsmProgressDemo();
-AsmProgressDemo;
- - - \ No newline at end of file diff --git a/public/src/Demo/Prompt.HC.HTML b/public/src/Demo/Prompt.HC.HTML deleted file mode 100644 index 29c3c97..0000000 --- a/public/src/Demo/Prompt.HC.HTML +++ /dev/null @@ -1,37 +0,0 @@ - - - - - Prompt.HC - - - - - U0 PromptDemo()
-{
- F64 d;
- I64 i;
- U8 *name;
- CDate cdt;
-
- "\n\nNow prompting from the cmd line.\n\n"
- "$GREEN$<ENTER>$FG$ keeps default.\n\n";
-
- i=GetI64("Enter int expression(%d):",123);
- "Int=%d\n",i;
-
- d=GetF64("Enter float expression(%12g):",1.2e3);
- "Float=%e\n",d;
-
- name=GetStr("Name (%s):","John");
- "Name:%s\n",name;
- Free(name);
-
- cdt=GetDate("Date (%D):",Now);
- "Date=%D\n",cdt;
-}
-
-PromptDemo;
- - - \ No newline at end of file diff --git a/public/src/Demo/PullDownMenu.HC.HTML b/public/src/Demo/PullDownMenu.HC.HTML deleted file mode 100644 index 2f511f9..0000000 --- a/public/src/Demo/PullDownMenu.HC.HTML +++ /dev/null @@ -1,101 +0,0 @@ - - - - - PullDownMenu.HC - - - - - //See Menus
-
-#define M_OPTION1 1
-#define M_OPTION2 2
-
-U0 PullDownMenuDemo()
-{
- I64 msg_code,arg1,arg2;
- CMenuEntry *tmpse;
-
- MenuPush(
- "File {"
- " Open(,'O');"
- " Save(,'S');"
- " Exit(,CH_SHIFT_ESC);"
- "}"
- "Edit {"
- " Cut(,,SC_DELETE|SCF_SHIFT);"
- " Paste(,,SC_INS|SCF_SHIFT);"
- "}"
- "Misc {"
- " Beep(,CH_SPACE);"
- " Opt1(MSG_CMD,M_OPTION1);"
- " Opt2(MSG_CMD,M_OPTION2);"
- "}"
- "Help {"
- " Help(,,0x3B0000003B);"
- " About(,,0x23B0000023B);"
- "}");
-
- "A pull-down menu will appear "
- "if you move the mouse to the top "
- "of the scrn.\n\n";
-
- do {
- msg_code=GetMsg(&arg1,&arg2,1<<MSG_KEY_DOWN+1<<MSG_CMD);
- "\nCmd:%d ARG1:%X ARG2:%X\n\n",msg_code,arg1,arg2;
-
- switch (msg_code) {
- case MSG_KEY_DOWN:
- switch (arg1) {//ASCII
- case CH_SPACE:
- Beep;
- break;
- case 0:
- switch (arg2.u8[0]) {//arg2=Scan code
- case SC_F1:
- if (arg2&SCF_SHIFT)
- "About PullDown Demo\n";
- else
- "Test the menu.\n";
- break;
- case SC_DELETE:
- if (arg2&SCF_SHIFT)
- "Cut\n";
- break;
- case SC_INS:
- if (arg2&SCF_SHIFT)
- "Paste\n";
- break;
- }
- break;
- }
- break;
-
- case MSG_CMD:
-//I Recommend making your menu
- //drive by key strokes, but you can
- //use the MSG_CMD val.
- switch (arg1) {
- case M_OPTION1:
- "Option # 1\n";
- if (tmpse=MenuEntryFind(Fs->cur_menu,"Misc/Opt1"))
- tmpse->checked=!tmpse->checked;
- break;
- case M_OPTION2:
- "Option # 2\n";
- if (tmpse=MenuEntryFind(Fs->cur_menu,"Misc/Opt2"))
- tmpse->checked=!tmpse->checked;
- break;
- }
- break;
- }
-
- } while (msg_code!=MSG_KEY_DOWN||(arg1!=CH_SHIFT_ESC && arg1!=CH_ESC));
- MenuPop;
-}
-
-PullDownMenuDemo;
- - - \ No newline at end of file diff --git a/public/src/Demo/RadixSort.HC.HTML b/public/src/Demo/RadixSort.HC.HTML deleted file mode 100644 index b3b5dfd..0000000 --- a/public/src/Demo/RadixSort.HC.HTML +++ /dev/null @@ -1,74 +0,0 @@ - - - - - RadixSort.HC - - - - - #define RADIX 256
-#define N 16
-
-U8 a[N];
-
-class Lst
-{
- Lst *next;
- U8 *a;
-} l[N],*r[RADIX];
-
-U0 DumpIn()
-{
- I64 i;
- "$RED$\n\nInput$FG$\n";
- for (i=0;i<N;i++)
- "%d:%d\n",i,a[i];
-}
-
-U0 DumpOut()
-{
- I64 i,j=0;
- Lst *tmpl;
- "$RED$\n\nOutput$FG$\n";
- for (i=0;i<RADIX;i++) {
- tmpl=r[i];
- while (tmpl) {
- "%d:%d\n",j++,*tmpl->a;
- tmpl=tmpl->next;
- }
- }
-}
-
-U0 Init()
-{
- I64 i;
- MemSet(r,0,sizeof(r));
- for (i=0;i<N;i++) {
- a[i]=RandU16&255;
- l[i].next=NULL;
- l[i].a=&a[i];
- }
-}
-
-U0 Sort()
-{
- I64 i;
- for (i=0;i<N;i++) {
- l[i].next=r[*l[i].a];
- r[*l[i].a]=&l[i];
- }
-}
-
-U0 RadixSort()
-{
- Init;
- DumpIn;
- Sort;
- DumpOut;
-}
-
-RadixSort;
- - - \ No newline at end of file diff --git a/public/src/Demo/RandDemo.HC.HTML b/public/src/Demo/RandDemo.HC.HTML deleted file mode 100644 index ba44bcb..0000000 --- a/public/src/Demo/RandDemo.HC.HTML +++ /dev/null @@ -1,76 +0,0 @@ - - - - - RandDemo.HC - - - - - U0 RandPts()
-{
- I64 i;
- F64 t0=tS;
- do {
- for (i=0;i<1024;i++) {
- gr.dc->color=RandU16&15;
- GrPlot(gr.dc,RandU32%GR_WIDTH,RandU32%GR_HEIGHT);
- }
- Yield;
- } while (tS-t0<1);
- DCFill;
-}
-
-U0 RandDemo()
-{
- I64 i;
-
- "Seed(0) will do timer XORed random numbers."
- "A task starts with Seed(0) by dft.\n";
- PressAKey;
- Seed;
- RandPts;
- DCFill;
-
- "\nSeed(num) will do deterministic, non-timer random numbers starting at "
- "a specific seed.You can run a specific video game over and over "
- "by typing Seed(num) at the cmd line before the game.\n";
- PressAKey;
- Seed(1);
- RandPts;
- DCFill;
-
- "\n\n\nWatch when we specify specific seeds:";
-
- "\n\nSeed(1);\n";
- Seed(1);
- for (i=0;i<5;i++)
- "%d: %d\n",i,RandI16;
-
- "\nSeed(2); Different, right?\n";
- Seed(2);
- for (i=0;i<5;i++)
- "%d: %d\n",i,RandI16;
-
- "\nSeed(1); Repeats earlier values.\n";
- Seed(1);
- for (i=0;i<5;i++)
- "%d: %d\n",i,RandI16;
-
- "\nSeed(0); Zero is special.\n";
- Seed(0);
- for (i=0;i<5;i++)
- "%d: %d\n",i,RandI16;
-
- "\nSeed(0); Non-repeating.\n";
- Seed(0);
- for (i=0;i<5;i++)
- "%d: %d\n",i,RandI16;
-
- Seed; //Dft should be kept to zero.
-}
-
-RandDemo;
- - - \ No newline at end of file diff --git a/public/src/Demo/RegistryDemo.HC.HTML b/public/src/Demo/RegistryDemo.HC.HTML deleted file mode 100644 index d4036c8..0000000 --- a/public/src/Demo/RegistryDemo.HC.HTML +++ /dev/null @@ -1,39 +0,0 @@ - - - - - RegistryDemo.HC - - - - - /*The ~/Registry.HC.Z file is HolyC code.
-You can execute a tree branch of it.The Adam
-branch is executed in the Adam task boot phase.
-Normally, you will place var declarations
-in the branch you make, but since an arthmetic expression
-is valid in HolyC you can place simple expressions
-without vars.
-*/
-
-RegDft("DemoCompany/Game1","F64 best_score=1.23;\n");
-RegDft("DemoCompany/Game1/SimpleVal","1234;\n");
-RegExe("DemoCompany/Game1");
-
-U0 Game()
-{
- I64 i=RegExe("DemoCompany/Game1/SimpleVal");
- "High Score:%6.5f\n",best_score;
- "Val:%d\n",i;
- i++;
- best_score=tS;
-//You could combine these into one write by making
- //the $TR...$ and $
$, $
$, cmds yourself.
- RegWrite("DemoCompany/Game1","F64 best_score=%9.5f;\n",best_score);
- RegWrite("DemoCompany/Game1/SimpleVal","%d;\n",i);
-}
-
-Game;
- - - \ No newline at end of file diff --git a/public/src/Demo/RevFileDemo/Rev.HC.HTML b/public/src/Demo/RevFileDemo/Rev.HC.HTML deleted file mode 100644 index cd6596e..0000000 --- a/public/src/Demo/RevFileDemo/Rev.HC.HTML +++ /dev/null @@ -1,34 +0,0 @@ - - - - - Rev.HC - - - - - /*We use the internal routines from the text editor
-to cut and paste lines to rev the order of
-lines in a text file.
-*/
-
-Cd(__DIR__);;
-
-U0 Rev(U8 *in_name,U8 *out_name)
-{
- CDoc *doc_in =DocRead(in_name),
- *doc_out=DocNew(out_name);
- DocTop(doc_in);
- while (doc_in->head.next!=doc_in) {
- EdLineDown(doc_in,SC_CURSOR_DOWN|SCF_SHIFT);
- ClipCut(doc_in);
- DocTop(doc_out);
- ClipPaste(doc_out);
- }
- DocWrite(doc_out);
-}
-
-Rev("DemoPoemBwd.DD.Z","~/DemoPoemFwd.DD.Z");
- - - \ No newline at end of file diff --git a/public/src/Demo/ScrnCodes.HC.HTML b/public/src/Demo/ScrnCodes.HC.HTML deleted file mode 100644 index 165014a..0000000 --- a/public/src/Demo/ScrnCodes.HC.HTML +++ /dev/null @@ -1,39 +0,0 @@ - - - - - ScrnCodes.HC - - - - - /*See TextBase Layer for the format
-of the U32 you pass to TextChar()
-
-See /Doc/CharOverview.DD, /Demo/ExtChars.HC,
-and /Demo/Graphics/FontEd.HC.
-
-Hold <ALT> and press a 3 digit decimal number
-or press <CTRL-ALT-a> to enter extended characters.
-*/
-
-U0 DrawIt(CTask *task,CDC *)
-{
- I64 i;
- for (i=0;i<256;i++)
- TextChar(task,,(i&15)*2,(i/16)*2,i+BLACK<<12+WHITE<<8);
-}
-
-U0 ScrnCodes()
-{
- SettingsPush; //See SettingsPush
- DocClear;
- Fs->draw_it=&DrawIt;
- GetChar(,FALSE);
- SettingsPop;
-}
-
-ScrnCodes;
- - - \ No newline at end of file diff --git a/public/src/Demo/Snd/ASCIIOrgan.HC.HTML b/public/src/Demo/Snd/ASCIIOrgan.HC.HTML deleted file mode 100644 index 0933cfd..0000000 --- a/public/src/Demo/Snd/ASCIIOrgan.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - ASCIIOrgan.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/Snd/MorseCode.HC.HTML b/public/src/Demo/Snd/MorseCode.HC.HTML deleted file mode 100644 index c2aeb2a..0000000 --- a/public/src/Demo/Snd/MorseCode.HC.HTML +++ /dev/null @@ -1,188 +0,0 @@ - - - - - MorseCode.HC - - - - - #define M_DASH_THRESHOLD 0.140
-#define M_SPACE_THRESHOLD 0.300
-
-U8 *morse_lst=
-
-"A.-\0"
-"B-...\0"
-"C-.-.\0"
-"D-..\0"
-"E.\0"
-"F..-.\0"
-"G--.\0"
-"H....\0"
-"I..\0"
-"J.---\0"
-"K-.-\0"
-"L.-..\0"
-"M--\0"
-"N-.\0"
-"O---\0"
-"P.--.\0"
-"Q--.-\0"
-"R.-.\0"
-"S...\0"
-"T-\0"
-"U..-\0"
-"V...-\0"
-"W.--\0"
-"X-..-\0"
-"Y-.--\0"
-"Z--..\0"
-
-"1.----\0"
-"2..---\0"
-"3...--\0"
-"4....-\0"
-"5.....\0"
-"6-....\0"
-"7--...\0"
-"8---..\0"
-"9----.\0"
-"0-----\0"
-
-"/-..-.\0"
-"+.-.-.\0"
-"..-.-.-\0"
-",--..--\0"
-"?..--..\0"
-"(-.--.\0"
-")-.--.-\0"
-"--....-\0"
-"\".-..-.\0"
-"_..--.-\0"
-"'.----.\0"
-":---...\0"
-";-.-.-.\0"
-"=-...-\0";
-
-U0 MorseTable()
-{
- U8 *st;
- I64 i=0;
- for (i=0;i<13;i++ ) {
- if (st=LstSub(i,morse_lst))
- "$RED$%C$FG$ %-7s ",*st,st+1;
- if (st=LstSub(i+13,morse_lst))
- "$RED$%C$FG$ %-7s ",*st,st+1;
- if (st=LstSub(i+26,morse_lst))
- "$RED$%C$FG$ %-7s ",*st,st+1;
- if (st=LstSub(i+39,morse_lst))
- "$RED$%C$FG$ %-7s ",*st,st+1;
- '\n';
- }
- '\n';
-}
-
-F64 m_start,m_end,dt_down,dt_up;
-Bool space_sent;
-
-U8 *MorseTimes(CDoc *,CDocEntry *,CTask *mem_task)
-{
- U8 *st=MAlloc(64,mem_task);
- StrPrint(st,"Down:%10.6f Up:%10.6f",dt_down,dt_up);
- return st;
-}
-
-I64 MorseWaitKey()
-{
- I64 ch;
- F64 dt;
- while (TRUE) {
- if (m_start) {
- GetMsg(NULL,NULL,1<<MSG_KEY_UP);
- m_end=tS;
- Snd;
- dt_down=m_end-m_start;
- m_start=0;
- space_sent=FALSE;
- if (dt_down<M_DASH_THRESHOLD)
- return '.';
- else
- return '-';
- } else {
- if (!space_sent) {
- while (!ScanMsg(&ch,NULL,1<<MSG_KEY_DOWN)) {
- dt=tS-m_end;
- if (dt>=M_SPACE_THRESHOLD) {
- space_sent=TRUE;
- return CH_SPACE;
- }
- Yield;
- }
- } else
- ch=GetChar(,FALSE);
- m_start=tS;
- Snd(74);
- if (ch==CH_SHIFT_ESC || ch==CH_ESC) {
- '\n';
- Snd;
- throw; //exit program
- }
- dt_up=m_start-m_end;
- if (!space_sent && dt_up>=M_SPACE_THRESHOLD) {
- space_sent=TRUE;
- return CH_SPACE;
- }
- }
- }
-}
-
-U0 Morse()
-{
- CDocEntry *doc_e;
- I64 ch;
- U8 buf[8],*dst,*src;
-
- MorseTable;
- m_start=0;
- m_end=tS;
- dt_down=0;
- dt_up=0;
- space_sent=TRUE;
-
- "$GREEN$";
-
- doc_e=DocPrint(DocPut,"$TX+TC,\"\"$");
- doc_e->tag_cb=&MorseTimes;
-
- "$FG$\n";
-
- dst=buf;
- while (TRUE) {
- ch=MorseWaitKey;
- if (ch==CH_SPACE) {
- *dst=0;
- src=morse_lst;
- while (*src) {
- if (!StrCmp(src+1,buf)) {
- "$GREEN$%C$FG$",*src;
- break;
- } else
- src+=StrLen(src)+1;
- }
- '' CH_SPACE;
- dst=buf;
- } else {
- if (dst-buf<sizeof(buf)-1) {
- '' ch;
- *dst++=ch;
- }
- }
- }
- Snd;
-}
-
-Morse;
- - - \ No newline at end of file diff --git a/public/src/Demo/Snd/OhGreat.HC.HTML b/public/src/Demo/Snd/OhGreat.HC.HTML deleted file mode 100644 index 87a0b2b..0000000 --- a/public/src/Demo/Snd/OhGreat.HC.HTML +++ /dev/null @@ -1,53 +0,0 @@ - - - - - OhGreat.HC - - - - - U0 Song()
-{//Song by Terry A. Davis
- Fs->task_end_cb=&SndTaskEndCB;
- MusicSettingsRst;
- try //Catch <CTRL-ALT-c> exit
- while (!ScanChar) {
- Play("6hEqDC5B6CDhE",
- "God\0is\0a\0g\0od\0of\0love.\n\0");
- Play("5GqFEFhG6E",
- "\0\0\0\0\0He\0");
- Play("6qDC5B6CDhE5G",
- "wat\0ches\0us\0from\0a\0bove.\n\0\0");
- Play("5qFEFhGB6qC",
- "\0\0\0\0Our\0world\0");
- Play("6DhCeDC5hBG",
- "is\0n't\0al\0ways\0nice.\n\0\0");
- Play("5qFEFhG6EqD",
- "\0\0\0\0Be\0fore\0");
- Play("6C5B6CDhE5G",
- "you\0gr\0ipe\0think\0twice.\n\0\0");
- Play("5qFEFhG6EqD",
- "\0\0\0\0He\0wat\0");
- Play("6C5B6CDhE5G",
- "ches\0us\0from\0a\0bove.\n\0\0");
- Play("5qFEFhG6EqD",
- "\0\0\0\0He'll\0smack\0");
- Play("6C5B6CDhE5G",
- "you\0with\0out\0a\0glove.\n\0\0");
- Play("5qFEFhGB6qC",
- "\0\0\0\0Our\0world\0");
- Play("6DhCeDC5hBG",
- "is\0n't\0al\0ways\0nice.\n\0\0");
- Play("5qFEFhG");
- }
- catch
- PutExcept;
- '\n';
- Snd;
-}
-
-Song;
- - - \ No newline at end of file diff --git a/public/src/Demo/Snd/WaterFowl.HC.HTML b/public/src/Demo/Snd/WaterFowl.HC.HTML deleted file mode 100644 index 9d184cb..0000000 --- a/public/src/Demo/Snd/WaterFowl.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - WaterFowl.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/SortFileDemo/F64FileGen.HC.HTML b/public/src/Demo/SortFileDemo/F64FileGen.HC.HTML deleted file mode 100644 index 3424452..0000000 --- a/public/src/Demo/SortFileDemo/F64FileGen.HC.HTML +++ /dev/null @@ -1,38 +0,0 @@ - - - - - F64FileGen.HC - - - - - //This makes a file of N random double values.
-
-Cd(__DIR__);;
-
-U0 F64FileGenTXT(U8 *filename,I64 n)
-{
- I64 i;
- CDoc *doc=DocNew(filename);
- DocPrint(doc,"//This is unsorted.\n");
- for (i=0;i<n;i++)
- DocPrint(doc,"%12.6f\n",Rand);
- DocWrite(doc);
- DocDel(doc);
-}
-F64FileGenTXT("~/DemoUnsortedF64.DD.Z",10);
-
-U0 F64FileGenDAT(U8 *filename,I64 n)
-{//File/CFile, /Demo/Dsk/DataBase.HC
- I64 i;
- F64 *a=MAlloc(n*sizeof(F64));
- for (i=0;i<n;i++)
- a[i]=Rand;
- FileWrite(filename,a,n*sizeof(F64));
- Free(a);
-}
-F64FileGenDAT("~/DemoUnsortedF64.DATA.Z",10);
- - - \ No newline at end of file diff --git a/public/src/Demo/SortFileDemo/F64FileSort.HC.HTML b/public/src/Demo/SortFileDemo/F64FileSort.HC.HTML deleted file mode 100644 index e8e576a..0000000 --- a/public/src/Demo/SortFileDemo/F64FileSort.HC.HTML +++ /dev/null @@ -1,84 +0,0 @@ - - - - - F64FileSort.HC - - - - - //This takes an input file of doubles and makes a sorted output file.
-
-Cd(__DIR__);;
-
-I64 Compare(F64 e1,F64 e2)
-{
- return Sign(e1-e2);
-}
-
-U0 F64FileSortTXT(U8 *in_name,U8 *out_name)
-{
- CCmpCtrl *cc;
- I64 i,n;
- F64 *a;
- CDoc *doc;
-
- //Pass1: Count the number of F64s.
- n=0;
- cc=CmpCtrlNew(MStrPrint("#include \"%s\"",in_name));
- while (Lex(cc))
- if (cc->token==TK_F64)
- n++;
- CmpCtrlDel(cc);
-
- a=MAlloc(n*sizeof(F64));
-
- //Pass2: Read F64s.
- i=0;
- cc=CmpCtrlNew(MStrPrint("#include \"%s\"",in_name));
- while (Lex(cc))
- if (cc->token==TK_F64)
- a[i++]=cc->cur_f64;
- CmpCtrlDel(cc);
-
- QSortI64(a,n,&Compare); //Sort 64-bit sized values
-
- //Save
- doc=DocNew(out_name);
- DocPrint(doc,"//This is sorted.\n");
- for (i=0;i<n;i++)
- DocPrint(doc,"%12.6f\n",a[i]);
- DocWrite(doc);
- DocDel(doc);
-
- Free(a);
-}
-F64FileSortTXT("~/DemoUnsortedF64.DD.Z","~/DemoSortedF64.DD.Z");
-Type("~/DemoUnsortedF64.DD.Z");
-Type("~/DemoSortedF64.DD.Z");
-
-U0 F64FileSortDAT(U8 *in_name,U8 *out_name)
-{//File/CFile, /Demo/Dsk/DataBase.HC
- I64 size;
- F64 *a=FileRead(in_name,&size);
- QSortI64(a,size/sizeof(F64),&Compare); //Sort 64-bit sized values
- FileWrite(out_name,a,size);
- Free(a);
-}
-F64FileSortDAT("~/DemoUnsortedF64.DATA.Z","~/DemoSortedF64.DATA.Z");
-
-U0 F64FileDumpDAT(U8 *in_name)
-{//File/CFile, /Demo/Dsk/DataBase.HC
- I64 i,n,size;
- F64 *a=FileRead(in_name,&size);
- n=size/sizeof(F64);
- "%s\n",in_name;
- for (i=0;i<n;i++)
- "%12.6f\n",a[i];
- Free(a);
-}
-F64FileDumpDAT("~/DemoUnsortedF64.DATA.Z");
-F64FileDumpDAT("~/DemoSortedF64.DATA.Z");
- - - \ No newline at end of file diff --git a/public/src/Demo/Spy.HC.HTML b/public/src/Demo/Spy.HC.HTML deleted file mode 100644 index 885f71c..0000000 --- a/public/src/Demo/Spy.HC.HTML +++ /dev/null @@ -1,74 +0,0 @@ - - - - - Spy.HC - - - - - //Pass the task structure you
-//wish to spy upon.
-
-U0 SpyStkRep(CTask *task)
-{
- CDoc *doc=DocDblBufStart;
- while (!ScanChar && TaskValidate(task)) {
- StkRep(task);
- '\n';
- "$BK,1$PRESS A KEY$BK,0$\n";
- DocDblBufSwap;
- Refresh;
- }
- if (DocPut==doc) DocDblBufSwap;
- DocDblBufEnd;
-}
-
-U0 SpyCallerRep(CTask *task)
-{
- CDoc *doc=DocDblBufStart;
- while (!ScanChar && TaskValidate(task)) {
- CallerRep(task->rbp,task);
- '\n';
- "$BK,1$PRESS A KEY$BK,0$\n";
- DocDblBufSwap;
- Refresh;
- }
- if (DocPut==doc) DocDblBufSwap;
- DocDblBufEnd;
-}
-
-U0 Spy()
-{
- I64 i;
- CTask *task;
-
- while (TRUE) {
- task=Fs->next_task;
- while (task!=Fs) {
- "$MA+X,T=\"Task:%08X:%16ts\",LM=\"0x%08X\n\"$\n",
- task,task->task_name,task;
- task=task->next_task;
- }
- '\n';
- task=GetI64("Task Addr: ",0);
- if (TaskValidate(task)) {
- "\n\n\t$BT,\"StkRep\",LM=\"1\n\"$\n\n\n"
- "\n\n\t$BT,\"CallerRep\",LM=\"2\n\"$\n\n\n";
- i=GetI64("",0);
- if (i==1)
- SpyStkRep(task);
- else if (i==2)
- SpyCallerRep(task);
- else
- break;
- } else
- break;
- }
- '\n';
-}
-
-Spy;
- - - \ No newline at end of file diff --git a/public/src/Demo/StkGrow.HC.HTML b/public/src/Demo/StkGrow.HC.HTML deleted file mode 100644 index 00b048b..0000000 --- a/public/src/Demo/StkGrow.HC.HTML +++ /dev/null @@ -1,65 +0,0 @@ - - - - - StkGrow.HC - - - - - I64 Recurse(I64 n)
-{
- if (n)
- return 1+CallStkGrow(0x800,0x1000000,&Recurse,n-1);
- else
- return 0;
-}
-
-I64 Recurse2(I64 n)
-{
- if (n)
- return 1+Recurse2(n-1);
- else
- return 0;
-}
-
-I64 Recurse3(I64 n,I64 lo,I64 hi)
-{
- if (lo<=n<hi)
- return 1+Recurse3(n-1,lo,hi);
- else if (n)
- return Recurse3(n-1,lo,hi);
- else
- return 0;
-}
-
-#define DEPTH (2*1024*1024)
-
-U0 StkGrowDemo()
-{
- F64 t0;
-
- t0=tS;
- "%X:%X\n",DEPTH,Recurse(DEPTH);
- "Time:%7.5fs\n",tS-t0;
-
- //If you know the max stack ahead of time...
- //Recurse2's stack is 16 because you have 1 arg,
- //a return addr and no local variables.
- t0=tS;
- "%X:%X\n",DEPTH,CallStkGrow(DEPTH*16+0x800,DEPTH*16+0x800,&Recurse2,DEPTH);
- "Time:%7.5fs\n",tS-t0;
-
- //CallStkGrow() works with multiple args.
- t0=tS;
- "%X:%X\n",DEPTH,CallStkGrow(DEPTH*32+0x800,DEPTH*32+0x800,
- &Recurse3,DEPTH,1000,2000);
- "Time:%7.5fs\n",tS-t0;
-}
-
-StkGrowDemo;
-
-//Be careful because you can fragment memory.
- - - \ No newline at end of file diff --git a/public/src/Demo/SubIntAccess.HC.HTML b/public/src/Demo/SubIntAccess.HC.HTML deleted file mode 100644 index 0a27f76..0000000 --- a/public/src/Demo/SubIntAccess.HC.HTML +++ /dev/null @@ -1,41 +0,0 @@ - - - - - SubIntAccess.HC - - - - - /*TempleOS has a feature that allows
-access to bytes and words of larger
-ints.
-
-See U64i union.
-
-The versions with "i" are internal data types.
-Use "I64" instead of "U64i" and you
-will have access to subbytes and
-subwords.
-
-Unfortunately, byte access causes the
-compiler to not use a reg for the
-variable.
-
-See /Demo/Lectures/FixedPoint.HC.
-*/
-
-I64 q=0xFEDCBA9876543210,q1;
-
-"q\t\t=%016X\n",q;
-q1=q.i16[2];
-"q.i16[2]\t=%016X\n",q1;
-q1=q.u8[5];
-"q.u8[5]\t\t=%016X\n",q1;
-q1=q.i32[1].u8[2];
-"q.i32[1].u8[2]\t=%016X\n",q1;
-q1=q.i32[0].i8[1];
-"q.i32[0].i8[1]\t=%016X\n",q1;
- - - \ No newline at end of file diff --git a/public/src/Demo/SubSwitch.HC.HTML b/public/src/Demo/SubSwitch.HC.HTML deleted file mode 100644 index 284ee49..0000000 --- a/public/src/Demo/SubSwitch.HC.HTML +++ /dev/null @@ -1,33 +0,0 @@ - - - - - SubSwitch.HC - - - - - U0 SubSwitch()
-{
- I64 i;
- for (i=0;i<10;i++)
- switch (i) {
- case 0: "Zero "; break;
- case 2: "Two "; break;
- case 4: "Four "; break;
- start:
- "[";
- case 1: "One"; break;
- case 3: "Three";break;
- case 5: "Five"; break;
- end:
- "] ";
- break;
- }
- '\n';
-}
-
-SubSwitch;
- - - \ No newline at end of file diff --git a/public/src/Demo/SuggestSpelling.HC.HTML b/public/src/Demo/SuggestSpelling.HC.HTML deleted file mode 100644 index a77f26f..0000000 --- a/public/src/Demo/SuggestSpelling.HC.HTML +++ /dev/null @@ -1,104 +0,0 @@ - - - - - SuggestSpelling.HC - - - - - /*This does a really crappy job of
-suggesting spellings.Write a better
-one for fun.
-*/
-
-U8 *SuggestMatchForm(U8 *src)
-{
- I64 ch,ch1=0;
- U8 *res=MStrUtil(src,SUF_TO_UPPER),*dst;
- dst=src=res;
- while (ch=*src++) {
- if (!StrOcc("AEIOU",ch)) {
- if (ch=='C') ch='K';
- if (ch=='Z') ch='S';
- if (ch!=ch1) //double chars to single
- *dst++=ch;
- }
- ch1=ch;
- }
- *dst=0;
- return res;
-}
-
-/*Fmt of word lst entry:
- U8 ACD_WORD_CHAR
- U8 word[] with terminating zero
- I16 block; //definition offset in ::/Adam/AutoComplete/ACDefs.DATA
-*/
-
-Bool SuggestSpelling(U8 *word)
-{
- U8 *dict=acd.word_lst,
- *pf=SuggestMatchForm(word),
- *wf;
- I64 len=StrLen(pf),
- num_cols=Fs->win_width/16,
- col=0;
- if (len)
- while (*dict) {
- wf=SuggestMatchForm(dict+1);
- if (!StrNCmp(pf,wf,len)) {
- "%16s",dict+1;
- if (++col>=num_cols) {
- col=0;
- '\n';
- }
- }
- Free(wf);
- dict+=StrLen(dict+1)+4;
- }
- Free(pf);
- '\n';
- return ToBool(len);
-}
-
-U0 SuggestSpellingDemo()
-{
- U8 *w;
- while (TRUE) {
- w=GetStr("Word:");
- if (*w) {
- SuggestSpelling(w);
- Free(w);
- } else
- break;
- }
-}
-
-//If you "Adam Include" this file, it will
-//install this command as a hot-key.
-
-U0 CtrlAltL(I64)
-{
-//ac.cur_word is only set if AutoComplete
- //is running.
- if (!TaskValidate(ac.task)) {
- AutoComplete(ON);
- Sleep(500);
- }
- PopUp("if (SuggestSpelling(ac.cur_word)) View;");
-}
-
-if (Fs!=adam_task)
- SuggestSpellingDemo;
-else {
- CtrlAltCBSet('L',&CtrlAltL,"Cmd/Suggest Spelling");
-//Appears in the Adam Task Window
- "<CTRL-ALT-l> installed\n";
-}
-
-//Note: It would be more appropriate
-//to define a key in MyPutKey().
- - - \ No newline at end of file diff --git a/public/src/Demo/Templates/Game1.HC.HTML b/public/src/Demo/Templates/Game1.HC.HTML deleted file mode 100644 index 47e67ed..0000000 --- a/public/src/Demo/Templates/Game1.HC.HTML +++ /dev/null @@ -1,102 +0,0 @@ - - - - - Game1.HC - - - - - U0 DrawIt(CTask *task,CDC *dc)
-{
-}
-
-U0 AnimateTask(I64)
-{
- while (TRUE) {
- Sleep(10);
- }
-}
-
-U0 Init()
-{
-}
-
-U0 CleanUp()
-{
-}
-
-U0 SongTask(I64)
-{
- Fs->task_end_cb=&SndTaskEndCB;
- MusicSettingsRst;
- while (TRUE) {
- Play("4AB5C");
- }
-}
-
-U0 MyGame()
-{
- I64 sc;
- SettingsPush; //See SettingsPush
- Fs->text_attr=YELLOW<<4+BLUE;
- Fs->song_task=Spawn(&SongTask,NULL,"Song",,Fs);
- AutoComplete;
- WinBorder;
- WinMax;
- DocCursor;
- DocClear;
-
- MenuPush(
- "File {"
- " Abort(,CH_SHIFT_ESC);"
- " Exit(,CH_ESC);"
- "}"
- "Play {"
- " Restart(,'\n');"
- " Up(,,SC_CURSOR_UP);"
- " Down(,,SC_CURSOR_DOWN);"
- " Left(,,SC_CURSOR_LEFT);"
- " Right(,,SC_CURSOR_RIGHT);"
- "}"
- );
-
- Init;
- Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs);
- Fs->draw_it=&DrawIt;
-
- try {
- while (TRUE)
- switch (GetKey(&sc)) {
- case 0:
- switch (sc.u8[0]) {
- case SC_CURSOR_LEFT:
- break;
- case SC_CURSOR_RIGHT:
- break;
- case SC_CURSOR_UP:
- break;
- case SC_CURSOR_DOWN:
- break;
- }
- break;
- case '\n':
- CleanUp;
- Init;
- break;
- case CH_SHIFT_ESC:
- case CH_ESC:
- goto mg_done;
- }
-mg_done: //Don't goto out of try
- } catch
- PutExcept;
- SettingsPop;
- CleanUp;
- MenuPop;
-}
-
-MyGame;
- - - \ No newline at end of file diff --git a/public/src/Demo/Templates/Lex1.HC.HTML b/public/src/Demo/Templates/Lex1.HC.HTML deleted file mode 100644 index 363471d..0000000 --- a/public/src/Demo/Templates/Lex1.HC.HTML +++ /dev/null @@ -1,28 +0,0 @@ - - - - - Lex1.HC - - - - - U0 MyRead(U8 *filename)
-{
- CCmpCtrl *cc=CmpCtrlNew(MStrPrint("#include \"%s\"",filename));
- while (Lex(cc)) {
- "%03d:",cc->token;
- switch (cc->token) {
- case TK_IDENT: "IDENT:%s",cc->cur_str; break;
- case TK_STR: "STR:%s",cc->cur_str; break;
- case TK_CHAR_CONST: "CHAR:%d",cc->cur_i64; break;
- case TK_I64: "I64:%d",cc->cur_i64; break;
- case TK_F64: "F64:%d",cc->cur_f64; break;
- }
- '\n';
- }
- CmpCtrlDel(cc);
-}
- - - \ No newline at end of file diff --git a/public/src/Demo/Templates/MultiCore1.HC.HTML b/public/src/Demo/Templates/MultiCore1.HC.HTML deleted file mode 100644 index 980454e..0000000 --- a/public/src/Demo/Templates/MultiCore1.HC.HTML +++ /dev/null @@ -1,41 +0,0 @@ - - - - - MultiCore1.HC - - - - - #define NUM 100
-
-I64 mp_not_done_flags,grand_total;
-
-U0 MPRoutine(CDoc *doc)
-{
- I64 i,sum=0,
- lo=NUM*Gs->num/mp_cnt, //This is how to divide a job
- hi=NUM*(Gs->num+1)/mp_cnt;
- for (i=lo;i<hi;i++)
- sum+=i;
- DocPrint(doc,"Core#%d:%d-%d:%d\n",Gs->num,lo,hi-1,sum);
- lock {grand_total+=sum;}
- LBtr(&mp_not_done_flags,Gs->num);
-}
-
-U0 Main()
-{
- I64 i;
- grand_total=0;
- mp_not_done_flags=1<<mp_cnt-1;
- for (i=0;i<mp_cnt;i++)
- Spawn(&MPRoutine,DocPut,NULL,i);
- while (mp_not_done_flags)
- Yield;
- "Grand total:%d\n",grand_total;
-}
-
-Main;
- - - \ No newline at end of file diff --git a/public/src/Demo/Templates/ODE1.HC.HTML b/public/src/Demo/Templates/ODE1.HC.HTML deleted file mode 100644 index d8395cc..0000000 --- a/public/src/Demo/Templates/ODE1.HC.HTML +++ /dev/null @@ -1,55 +0,0 @@ - - - - - ODE1.HC - - - - - class MyMass:CMass
-{
- F64 radius;
-};
-
-class MySpring:CSpring
-{
-};
-
-CMathODE *ode=NULL;
-
-U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
-{
- MyMass *tmpm1,*tmpm2;
-
- tmpm1=ode->next_mass;
- while (tmpm1!=&ode->next_mass) {
- tmpm2=tmpm1->next;
- while (tmpm2!=&ode->next_mass) {
- tmpm2=tmpm2->next;
- }
- tmpm1=tmpm1->next;
- }
-}
-
-U0 Init()
-{
- ode=ODENew(0,1e-4,ODEF_HAS_MASSES);
- ode->derive=&MyDerivative;
- ode->drag_v2=0.002;
- ode->drag_v3=0.00001;
- ode->acceleration_limit=5e3;
-
- QueIns(ode,Fs->last_ode);
-}
-
-U0 CleanUp()
-{
- QueRem(ode);
- QueDel(&ode->next_mass,TRUE);
- QueDel(&ode->next_spring,TRUE);
- ODEDel(ode);
-}
- - - \ No newline at end of file diff --git a/public/src/Demo/Templates/Registry1.HC.HTML b/public/src/Demo/Templates/Registry1.HC.HTML deleted file mode 100644 index f20ab38..0000000 --- a/public/src/Demo/Templates/Registry1.HC.HTML +++ /dev/null @@ -1,22 +0,0 @@ - - - - - Registry1.HC - - - - - RegDft("MyCompany/MyApp","F64 best_score=9999;\n");
-RegExe("MyCompany/MyApp");
-
-U0 Main()
-{
- GetChar;
- RegWrite("MyCompany/MyApp","F64 best_score=%5.4f;\n",best_score);
-}
-
-Main;
- - - \ No newline at end of file diff --git a/public/src/Demo/Templates/Util1.HC.HTML b/public/src/Demo/Templates/Util1.HC.HTML deleted file mode 100644 index 2283a8c..0000000 --- a/public/src/Demo/Templates/Util1.HC.HTML +++ /dev/null @@ -1,26 +0,0 @@ - - - - - Util1.HC - - - - - U0 MyUtil(U8 *files_find_mask,U8 *fu_flags=NULL)
-{
- I64 fuf_flags=0;
- CDirEntry *tmpde,*tmpde1;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F");
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
- tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
- while (tmpde) {
- PutFileLink(tmpde->full_name);
- '\n';
- tmpde=tmpde->next;
- }
- DirTreeDel(tmpde1);
-}
- - - \ No newline at end of file diff --git a/public/src/Demo/Templates/Util2.HC.HTML b/public/src/Demo/Templates/Util2.HC.HTML deleted file mode 100644 index df89882..0000000 --- a/public/src/Demo/Templates/Util2.HC.HTML +++ /dev/null @@ -1,66 +0,0 @@ - - - - - Util2.HC - - - - - I64 MyUtilDoc(CDoc *doc,I64 fuf_flags)
-{
- Bool unlock=DocLock(doc);
- I64 res=0;
- CDocEntry *doc_e;
- DocRecalc(doc);
- doc_e=doc->head.next;
- while (doc_e!=doc) {
- res++;
- doc_e=doc_e->next;
- }
- DocRecalc(doc);
- if (unlock)
- DocUnlock(doc);
- return res;
-}
-
-I64 MyUtilFile(U8 *filename,I64 fuf_flags)
-{
- I64 res;
- CDoc *doc=DocRead(filename);
- if (res=MyUtilDoc(doc,fuf_flags)) {
- "%8d:%s\n",res,doc->filename.name;
- DocWrite(doc);
- }
- DocDel(doc);
- return res;
-}
-I64 MyUtilLst(CDirEntry *tmpde,I64 fuf_flags)
-{
- I64 res=0;
- CDirEntry *tmpde1;
- while (tmpde) {
- tmpde1=tmpde->next;
- if (tmpde->attr & RS_ATTR_DIR) {
- if (tmpde->sub) {
- "Processing Directory: %s\n",tmpde->full_name;
- res+=MyUtilLst(tmpde->sub,fuf_flags);
- }
- } else
- res+=MyUtilFile(tmpde->full_name,fuf_flags);
- DirEntryDel(tmpde);
- tmpde=tmpde1;
- }
- return res;
-}
-I64 MyUtil(U8 *files_find_mask="*",U8 *fu_flags=NULL)
-{
- I64 fuf_flags=0;
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+$");
- ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
- return MyUtilLst(FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND),
- fuf_flags&~FUG_FILES_FIND);
-}
- - - \ No newline at end of file diff --git a/public/src/Demo/TimeIns.HC.HTML b/public/src/Demo/TimeIns.HC.HTML deleted file mode 100644 index 9944ef3..0000000 --- a/public/src/Demo/TimeIns.HC.HTML +++ /dev/null @@ -1,47 +0,0 @@ - - - - - TimeIns.HC - - - - - /*Allows you to time insts.
-Results vary because the CPU does
-parallel and out-of-order execution.
-*/
-
-#define SAMPLE_SIZE 10000000
-
-U0 TimeIns()
-{
- I64 i,start,end,overhead_time,test_time;
- F64 d=5.0;
-
- //Measure Loop Overhead
- start=GetTSC;
- for (i=0;i<SAMPLE_SIZE;i++);
- end=GetTSC;
- overhead_time=end-start;
- "\nOverhead Cycles:%12.6f\n",ToF64(overhead_time)/SAMPLE_SIZE;
-
- start=GetTSC;
- for (i=0;i<SAMPLE_SIZE;i++) {
- #exe {PassTrace(0b10000000000);};
-//Time these insts
- d*=1.00001;
- #exe {PassTrace(0);};
- }
- end=GetTSC;
- test_time=end-start;
-
- "Measured Cycles:%12.6f\n",ToF64(test_time-overhead_time)/SAMPLE_SIZE;
-}
-
-TimeIns;
-TimeIns;
-TimeIns;
- - - \ No newline at end of file diff --git a/public/src/Demo/ToHtmlToTXTDemo/HtmlGen.HC.HTML b/public/src/Demo/ToHtmlToTXTDemo/HtmlGen.HC.HTML deleted file mode 100644 index 82e9c14..0000000 --- a/public/src/Demo/ToHtmlToTXTDemo/HtmlGen.HC.HTML +++ /dev/null @@ -1,32 +0,0 @@ - - - - - HtmlGen.HC - - - - - /* This converts /Demo/ToHtmlToTXTDemo/DemoInPage.DD to
-an html document named "OutPage.html".
-
-Notice that an entry like $TX,"GOOGLE",HTML="http://www.google.com"$
-will be converted to text in the html with an html link.
-
-I cheated by hardcoding www.templeos.org as the website
-for TempleOS Links. Why don't you copy
-/Demo/ToHtmlToTXTDemo/ToHtml.HC to your /Home directory
-and modify it? You are welcome to link to
-http://www.templeos.org if you want file that come on the
-TempleOS distribution.
-
-You can pass html meta data as args to ToHtml().
-*/
-
-Cd(__DIR__);;
-#include "ToHtml"
-
-ToHtml("DemoInPage.DD.Z","~/DemoOutPage");
- - - \ No newline at end of file diff --git a/public/src/Demo/ToHtmlToTXTDemo/TXTGen.HC.HTML b/public/src/Demo/ToHtmlToTXTDemo/TXTGen.HC.HTML deleted file mode 100644 index 41d8b31..0000000 --- a/public/src/Demo/ToHtmlToTXTDemo/TXTGen.HC.HTML +++ /dev/null @@ -1,20 +0,0 @@ - - - - - TXTGen.HC - - - - - /* This converts /Demo/ToHtmlToTXTDemo/DemoInPage.DD to
-an plain ASCII text document named, "OutPage.DD".
-
-*/
-
-Cd(__DIR__);;
-
-ToTXT("DemoInPage.DD.Z","~/DemoOutPage");
- - - \ No newline at end of file diff --git a/public/src/Demo/ToHtmlToTXTDemo/ToHtml.HC.HTML b/public/src/Demo/ToHtmlToTXTDemo/ToHtml.HC.HTML deleted file mode 100644 index fcd6115..0000000 --- a/public/src/Demo/ToHtmlToTXTDemo/ToHtml.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - ToHtml.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Demo/WebLogDemo/WebLogRep.HC.HTML b/public/src/Demo/WebLogDemo/WebLogRep.HC.HTML deleted file mode 100644 index 7b72fc7..0000000 --- a/public/src/Demo/WebLogDemo/WebLogRep.HC.HTML +++ /dev/null @@ -1,540 +0,0 @@ - - - - - WebLogRep.HC - - - - - #define DOWNLOAD_FILE1 "TOS_Distro.ISO"
-#define DOWNLOAD_FILE1_SIZE 16000000
-
-#define HOURS_MAX (24*3)
-
-class LogStruct
-{
- LogStruct *next,*last;
- LogStruct *ip_num_left,*ip_num_right;
- U32 ip_num,code;
- I64 size;
- U8 *file,*link;
- CDate datetime;
-};
-
-class LinkStruct
-{
- LinkStruct *left,*right;
- U8 *link,*file;
- I64 cnt;
-};
-
-class BlockedStruct
-{
- BlockedStruct *next,*last;
- U32 ip_num;
-};
-
-U0 LogStructDel(LogStruct *tmplg)
-{
- Free(tmplg->file);
- Free(tmplg->link);
- Free(tmplg);
-}
-
-U0 PrsSingleLogFile(LogStruct *head,U8 *name,CDate *_dstart,CDate *_dend)
-{
- CDoc *doc=DocRead(name,
- DOCF_PLAIN_TEXT_TABS|DOCF_DBL_DOLLARS|DOCF_NO_CURSOR);
- CDocEntry *doc_e=doc->head.next;
- U8 *src,*src2,*mon_lst=Define("ST_MONTHS");
- LogStruct *tmplg;
- CDateStruct ds;
- I64 i;
- "%$Q\n",name;
- while (doc_e!=doc) {
- if (doc_e->type_u8==DOCT_TEXT) {
- tmplg=CAlloc(sizeof(LogStruct));
- try {
- src=doc_e->tag;
- tmplg->ip_num.u8[3]=Str2I64(src,10,&src);
- if (*src++!='.') throw;
- tmplg->ip_num.u8[2]=Str2I64(src,10,&src);
- if (*src++!='.') throw;
- tmplg->ip_num.u8[1]=Str2I64(src,10,&src);
- if (*src++!='.') throw;
- tmplg->ip_num.u8[0]=Str2I64(src,10,&src);
-
- do if (!*src) throw;
- while (*src++!='[');
- MemSet(&ds,0,sizeof(CDateStruct));
- ds.day_of_mon=Str2I64(src,10,&src);
- if (*src++!='/') throw;
- src2=src;
- do if (!*src2) throw;
- while (*src2++!='/');
- * --src2=0;
- ds.mon=1+LstMatch(src,mon_lst,LMF_IGNORE_CASE);
- src=++src2;
- ds.year=Str2I64(src,10,&src);
- if (*src++!=':') throw;
- ds.hour=Str2I64(src,10,&src);
- if (*src++!=':') throw;
- ds.min=Str2I64(src,10,&src);
- if (*src++!=':') throw;
- ds.sec=Str2I64(src,10,&src);
- tmplg->datetime=Struct2Date(&ds);
- if (*src++!=CH_SPACE) throw;
- i=Str2I64(src,10,&src);
- tmplg->datetime-=(i/100+i%100/60.0)*CDATE_FREQ*60*60;
- if (!(Str2Date("1/1/2017")<=tmplg->datetime<Str2Date("1/1/2050")))
- throw;
- if (tmplg->datetime<*_dstart) *_dstart=tmplg->datetime;
- if (tmplg->datetime>*_dend) *_dend =tmplg->datetime;
-
- do if (!*src) throw;
- while (*src++!=']');
-
- if (*src++!=CH_SPACE) throw;
- if (*src++!='\"') throw;
- if (!StrNCmp(src,"GET ",4)) {
- src2=src+=4;
- do if (!*src2) throw;
- while (*src2++!=CH_SPACE);
- * --src2=0;
- tmplg->file=StrNew(src);
- src=++src2;
-
- do if (!*src) throw;
- while (*src++!='\"');
-
- tmplg->code=Str2I64(src,10,&src);
- if (*src++!=CH_SPACE) throw;
- tmplg->size=Str2I64(src,10,&src);
- if (*src++!=CH_SPACE) throw;
-
- if (*src++!='\"') throw;
- src2=src;
- do if (!*src2) throw;
- while (*src2++!='\"');
- * --src2=0;
- tmplg->link=StrNew(src);
- src=++src2;
-
- QueIns(tmplg,head->last);
- } else if (!StrNCmp(src,"HEAD ",5)) {
- LogStructDel(tmplg);
- } else
- throw;
- } catch {
- Fs->catch_except=TRUE;
- "%$Q\n",doc_e->tag;
- LogStructDel(tmplg);
- }
- }
- doc_e=doc_e->next;
- }
- DocDel(doc);
-}
-
-LogStruct *PrsLogFiles(U8 *files_find_mask,CDate *_dstart,CDate *_dend)
-{
- LogStruct *head=CAlloc(sizeof(LogStruct));
- CDirEntry *tmpde=FilesFind(files_find_mask),*tmpde1=tmpde;
- QueInit(head);
- while (tmpde) {
- PrsSingleLogFile(head,tmpde->full_name,_dstart,_dend);
- tmpde=tmpde->next;
- }
- DirTreeDel(tmpde1);
- return head;
-}
-
-U0 LogLstDel(LogStruct *head)
-{
- LogStruct *tmplg=head->next,*tmplg1;
- while (tmplg!=head) {
- tmplg1=tmplg->next;
- LogStructDel(tmplg);
- tmplg=tmplg1;
- }
-}
-
-U0 BlockedStructAdd(BlockedStruct *head,U32 ip_num)
-{
- BlockedStruct *tmpb=CAlloc(sizeof(BlockedStruct));
- tmpb->ip_num=ip_num;
- QueIns(tmpb,head->last);
-}
-
-Bool IsBlocked(BlockedStruct *head,U32 ip_num)
-{
- BlockedStruct *tmpb=head->next;
- while (tmpb!=head) {
- if (tmpb->ip_num==ip_num)
- return TRUE;
- tmpb=tmpb->next;
- }
- return FALSE;
-}
-
-U0 BlockIPNuip(LogStruct *head)
-{
- BlockedStruct blocked_head;
- LogStruct *tmplg=head->next,*tmplg1;
-
- QueInit(&blocked_head);
-
- BlockedStructAdd(&blocked_head,68<<24+227<<16+61<<8+6);
-
- //pass 1: collect robot lst
- while (tmplg!=head) {
- if (StrIMatch("ROBOT",tmplg->file) &&
- !IsBlocked(&blocked_head,tmplg->ip_num))
- BlockedStructAdd(&blocked_head,tmplg->ip_num);
- tmplg=tmplg->next;
- }
-
- //pass 2: removed blocked ip_nuip
- tmplg=head->next;
- while (tmplg!=head) {
- tmplg1=tmplg->next;
- if (IsBlocked(&blocked_head,tmplg->ip_num)) {
- QueRem(tmplg);
- LogStructDel(tmplg);
- }
- tmplg=tmplg1;
- }
-
- QueDel(&blocked_head);
-}
-
-Bool IsDownLoad(LogStruct *tmplg)
-{
- if (StrMatch(DOWNLOAD_FILE1,tmplg->file)&&tmplg->size>=
- DOWNLOAD_FILE1_SIZE)
- return TRUE;
- else
- return FALSE;
-}
-
-Bool IsIndex(LogStruct *tmplg)
-{
- if (!StrCmp(tmplg->file,"/index.html") || !StrCmp(tmplg->file,"/"))
- return TRUE;
- else
- return FALSE;
-}
-
-Bool IsKeeper(LogStruct *tmplg,CDate dstart,CDate dend)
-{
- if (dstart<=tmplg->datetime<=dend && !StrOcc(tmplg->file,'?') &&
- StrLen(tmplg->file)>2 && 'A'<=tmplg->file[1]<='Z' &&
- tmplg->size && tmplg->file[StrLen(tmplg->file)-1]!='/' &&
- (StrLen(tmplg->file)<3 || MemCmp(&tmplg->file[1],"Wb",2)) &&
- (StrLen(tmplg->file)<7 || MemCmp(&tmplg->file[1],"Family",6))) {
- return TRUE;
-
-} else
- return FALSE;
-}
-
-Bool IPNumTreeAdd(LogStruct **_head,LogStruct *tmplg)
-{
- LogStruct *head;
- if (UnusedStk<0x200) {
- PrintErr("Stk Overflow");
- throw;
- }
- if (head=*_head) {
- if (tmplg->ip_num==head->ip_num)
- return TRUE;
- else if (tmplg->ip_num<head->ip_num)
- return IPNumTreeAdd(&head->ip_num_left,tmplg);
- else
- return IPNumTreeAdd(&head->ip_num_right,tmplg);
- } else {
- tmplg->ip_num_left=NULL;
- tmplg->ip_num_right=NULL;
- *_head=tmplg;
- return FALSE;
- }
-}
-
-U0 LinkTreeAdd(LinkStruct **_root,LogStruct *tmplg)
-{
- I64 i;
- LinkStruct *root,*tmplk;
- if (UnusedStk<0x200) {
- PrintErr("Stk Overflow");
- throw;
- }
- if (root=*_root) {
- if (!(i=StrCmp(tmplg->link,root->link)))
- root->cnt++;
- else if (i<0)
- LinkTreeAdd(&root->left,tmplg);
- else
- LinkTreeAdd(&root->right,tmplg);
- } else {
- tmplk=CAlloc(sizeof(LinkStruct));
- tmplk->link=tmplg->link;
- tmplk->cnt=1;
- *_root=tmplk;
- }
-}
-
-U0 FileTreeAdd(LinkStruct **_root,LogStruct *tmplg)
-{
- I64 i;
- LinkStruct *root,*tmplk;
- if (UnusedStk<0x200) {
- PrintErr("Stk Overflow");
- throw;
- }
- if (root=*_root) {
- if (!(i=StrCmp(tmplg->file,root->file)))
- root->cnt++;
- else if (i<0)
- FileTreeAdd(&root->left,tmplg);
- else
- FileTreeAdd(&root->right,tmplg);
- } else {
- tmplk=CAlloc(sizeof(LinkStruct));
- tmplk->file=tmplg->file;
- tmplk->cnt=1;
- *_root=tmplk;
- }
-}
-
-U0 LinkTreeDel(LinkStruct *root)
-{
- if (root) {
- LinkTreeDel(root->left);
- LinkTreeDel(root->right);
- Free(root);
- }
-}
-
-U0 LinkTreeTraverse(LinkStruct *root)
-{
- if (root) {
- LinkTreeTraverse(root->left);
- "%3d:%$Q\n",root->cnt,root->link;
- LinkTreeTraverse(root->right);
- }
-}
-
-U0 FileTreeDel(LinkStruct *root)
-{
- if (root) {
- FileTreeDel(root->left);
- FileTreeDel(root->right);
- Free(root);
- }
-}
-
-U0 FileTreeTraverse(LinkStruct *root)
-{
- if (root) {
- FileTreeTraverse(root->left);
- "%3d:%$Q\n",root->cnt,root->file;
- FileTreeTraverse(root->right);
- }
-}
-
-U0 DownLoadRep(LogStruct *head,CDate dstart,CDate dend)
-{
- I64 i,j,cnt,dups,
- hours_start,hours_end,*hour_cnts,*dup_cnts,
- days_start,days_end,*day_cnts,*day_dup_cnts;
- LogStruct *tmplg=head->next,*dup_head=NULL;
- LinkStruct *link_root=NULL;
- CDateStruct ds;
-
- i=dstart*24;hours_start=i.u32[1];
- i=dend *24;hours_end =i.u32[1];
-
- days_start=(dstart+local_time_offset)>>32;
- days_end =(dend+local_time_offset)>>32;
-
- hour_cnts=CAlloc((hours_end-hours_start+1)*sizeof(I64));
- dup_cnts =CAlloc((hours_end-hours_start+1)*sizeof(I64));
- day_cnts =CAlloc((days_end-days_start+1)*sizeof(I64));
- day_dup_cnts=CAlloc((days_end-days_start+1)*sizeof(I64));
- dups=cnt=0;
- while (tmplg!=head) {
- if (IsKeeper(tmplg,dstart,dend) && IsDownLoad(tmplg)) {
- i=tmplg->datetime*24;
- hour_cnts[i.u32[1]-hours_start]++;
- day_cnts[(tmplg->datetime+local_time_offset)>>32-days_start]++;
- cnt++;
- if (IPNumTreeAdd(&dup_head,tmplg)) {
- day_dup_cnts[(tmplg->datetime+local_time_offset)>>32-days_start]++;
- dup_cnts[i.u32[1]-hours_start]++;
- dups++;
- }
- LinkTreeAdd(&link_root,tmplg);
- }
- tmplg=tmplg->next;
- }
-
- "\n\nDownloads of /TOS_Distro.ISO\n";
- for (i=dstart;i<=dend;i+=1<<32)
- "%DDups:%5dTotal:%5dUniques:%5d\n",i,
- day_dup_cnts[(i+local_time_offset)>>32-days_start],
- day_cnts[(i+local_time_offset)>>32-days_start],
- day_cnts[(i+local_time_offset)>>32-days_start]-
- day_dup_cnts[(i+local_time_offset)>>32-days_start];
-
- "\n\nDownloads of /TOS_Distro.ISO\n"
- "'-' is a dup.'+' is not a dup.\n";
- if (hours_end-hours_start>=HOURS_MAX)
- i=hours_end-HOURS_MAX+1;
- else
- i=hours_start;
- for (;i<=hours_end;i++) {
- Date2Struct(&ds,i<<32/24+local_time_offset);
- "%D %02d: ",i<<32/24,ds.hour;
- for (j=0;j<dup_cnts[i-hours_start];j++)
- '-';
- for (;j<hour_cnts[i-hours_start];j++)
- '+';
- '\n';
- }
- "Total:%dDups:%dUniques:%d\n",cnt,dups,cnt-dups;
-
- "\n\nDownloads of /TOS_Distro.ISO\n";
- LinkTreeTraverse(link_root);
- '\n';
-
- LinkTreeDel(link_root);
- Free(hour_cnts);
- Free(dup_cnts);
- Free(day_cnts);
- Free(day_dup_cnts);
-}
-
-U0 FileRep(LogStruct *head,CDate dstart,CDate dend)
-{
- LogStruct *tmplg=head->next;
- LinkStruct *file_root=NULL;
- while (tmplg!=head) {
- if (IsKeeper(tmplg,dstart,dend))
- FileTreeAdd(&file_root,tmplg);
- tmplg=tmplg->next;
- }
- "\n\nFile Hits\n";
- FileTreeTraverse(file_root);
- '\n';
- FileTreeDel(file_root);
-}
-
-U0 IndexRep(LogStruct *head,CDate dstart,CDate dend)
-{
- I64 i,j,cnt,dups,
- hours_start,hours_end,*hour_cnts,*dup_cnts,
- days_start,days_end,*day_cnts,*day_dup_cnts;
- LogStruct *tmplg=head->next,*dup_head=NULL;
- LinkStruct *link_root=NULL;
- CDateStruct ds;
-
- i=dstart*24;hours_start=i.u32[1];
- i=dend *24;hours_end =i.u32[1];
-
- days_start=(dstart+local_time_offset)>>32;
- days_end =(dend+local_time_offset)>>32;
-
- hour_cnts=CAlloc((hours_end-hours_start+1)*sizeof(I64));
- dup_cnts =CAlloc((hours_end-hours_start+1)*sizeof(I64));
- day_cnts =CAlloc((days_end-days_start+1)*sizeof(I64));
- day_dup_cnts=CAlloc((days_end-days_start+1)*sizeof(I64));
- dups=cnt=0;
- while (tmplg!=head) {
- if (IsKeeper(tmplg,dstart,dend) && IsIndex(tmplg)) {
- i=tmplg->datetime*24;
- hour_cnts[i.u32[1]-hours_start]++;
- day_cnts[(tmplg->datetime+local_time_offset)>>32-days_start]++;
- cnt++;
- if (IPNumTreeAdd(&dup_head,tmplg)) {
- day_dup_cnts[(tmplg->datetime+local_time_offset)>>32-days_start]++;
- dup_cnts[i.u32[1]-hours_start]++;
- dups++;
- }
- LinkTreeAdd(&link_root,tmplg);
- }
- tmplg=tmplg->next;
- }
-
- "\n\nHits on /index.html\n"
- "'-' is a dup.'+' is not a dup.\n";
- for (i=dstart;i<=dend;i+=1<<32)
- "%DDups:%5dTotal:%5dUniques:%5d\n",i,
- day_dup_cnts[(i+local_time_offset)>>32-days_start],
- day_cnts[(i+local_time_offset)>>32-days_start],
- day_cnts[(i+local_time_offset)>>32-days_start]-
- day_dup_cnts[(i+local_time_offset)>>32-days_start];
-
- "\n\nHits on /index.html\n";
- if (hours_end-hours_start>=HOURS_MAX)
- i=hours_end-HOURS_MAX+1;
- else
- i=hours_start;
- for (;i<=hours_end;i++) {
- Date2Struct(&ds,i<<32/24+local_time_offset);
- "%D %02d: ",i<<32/24,ds.hour;
- for (j=0;j<dup_cnts[i-hours_start];j++)
- '-';
- for (;j<hour_cnts[i-hours_start];j++)
- '+';
- '\n';
- }
- "Total:%dDups:%dUniques:%d\n",cnt,dups,cnt-dups;
-
- "\n\nHits on /index.html\n";
- LinkTreeTraverse(link_root);
- '\n';
-
- LinkTreeDel(link_root);
- Free(hour_cnts);
- Free(dup_cnts);
- Free(day_cnts);
- Free(day_dup_cnts);
-}
-
-U0 WebLogRep(U8 *mask,U8 *output_filename)
-{
- LogStruct *head;
- CDate dstart=I64_MAX,dend=I64_MIN;
-
- DocMax;
-
- head=PrsLogFiles(mask,&dstart,&dend);
- if (dstart>dend)
- PrintErr("No Data.\n");
- else {
- dstart=GetDate("Start(%D):",dstart);
- dend =GetDate("End(%D):",dend);
- BlockIPNuip(head);
-
- DocClear;
- "$WW,0$";
- IndexRep(head,dstart,dend);
- FileRep(head,dstart,dend);
- DownLoadRep(head,dstart,dend);
-
- StrCpy(DocPut->filename.name,output_filename);
- DocWrite(DocPut,TRUE);
-
- "$WW,1$";
- }
- LogLstDel(head);
-}
-
-#if __CMD_LINE__
-Cd(__DIR__);;
-WebLogRep("*.log*","~/DemoWebLog.DD.Z");
-#endif
- - - \ No newline at end of file diff --git a/public/src/Demo/WebLogDemo/WebLogScramble.HC.HTML b/public/src/Demo/WebLogDemo/WebLogScramble.HC.HTML deleted file mode 100644 index b2ce9cc..0000000 --- a/public/src/Demo/WebLogDemo/WebLogScramble.HC.HTML +++ /dev/null @@ -1,81 +0,0 @@ - - - - - WebLogScramble.HC - - - - - U8 key[4][256];
-
-U0 InitKey()
-{
- I64 i,j;
- for (i=0;i<4;i++) {
- for (j=0;j<256;j++)
- key[i][j]=j;
- for (j=0;j<255;j++)
- SwapU8(&key[i][j],&key[i][j+RandU32%(256-j)]);
- }
-}
-
-U0 LogScrambleFile(U8 *name)
-{
- CDoc *doc=DocRead(name,DOCF_PLAIN_TEXT|DOCF_NO_CURSOR);
- CDocEntry *doc_e=doc->head.next;
- I64 i;
- U32 num;
- U8 *st,*st2;
- "Scrambling:%s\n",name;
- while (doc_e!=doc) {
- if (doc_e->type_u8==DOCT_TEXT) {
- st=MAlloc(StrLen(doc_e->tag)+1);
- st2=MAlloc(StrLen(doc_e->tag)+1);
- StrFirstRem(doc_e->tag," ",st);
-
- for (i=3;i>=0;i--) {
- StrFirstRem(st,".",st2);
- num.u8[i]=key[i][Str2I64(st2)&255];
- }
-
- Free(st);
- Free(st2);
-
- st=MStrPrint("%d.%d.%d.%d %s",num.u8[3],num.u8[2],
- num.u8[1],num.u8[0],doc_e->tag);
- Free(doc_e->tag);
- doc_e->tag=st;
- }
- doc_e=doc_e->next;
- }
- DocWrite(doc);
- DocDel(doc);
-}
-U0 WebLogScramble(U8 *files_find_mask)
-{
- CDirEntry *tmpde=FilesFind(files_find_mask,FUF_RECURSE|FUF_JUST_FILES),
- *tmpde1=tmpde;
- InitKey;
- while (tmpde) {
- LogScrambleFile(tmpde->full_name);
- tmpde=tmpde->next;
- }
- DirTreeDel(tmpde1);
-}
-
-U0 LogScrambleDemo()
-{
- U8 *dirname;
- Cd(__DIR__);
- dirname=DirCur;
- ST_WARN_ST "This will scramble all .log files in '%s'.\n\n",dirname;
- Free(dirname);
- if (AreYouSure)
- WebLogScramble("*.log*");
-}
-
-LogScrambleDemo;
- - - \ No newline at end of file diff --git a/public/src/Demo/WordSearch.HC.HTML b/public/src/Demo/WordSearch.HC.HTML deleted file mode 100644 index 27d2c46..0000000 --- a/public/src/Demo/WordSearch.HC.HTML +++ /dev/null @@ -1,165 +0,0 @@ - - - - - WordSearch.HC - - - - - //Simple and fancy way of searching
-
-//See ::/Apps/Vocabulary/VocabQuiz.HC.Z
-//for another example of dictionary usage.
-
-#define ROWS_NUM 20
-#define COLS_NUM 20
-#define DIM_MAX MaxI64(ROWS_NUM,COLS_NUM)
-
-U8 m[ROWS_NUM][COLS_NUM];
-
-U0 Init()
-{
- I64 x,y;
- for (y=0;y<ROWS_NUM;y++)
- for (x=0;x<COLS_NUM;x++)
- m[y][x]='A'+RandU16%26;
-}
-
-U0 Display()
-{
- I64 x,y;
- for (y=0;y<ROWS_NUM;y++) {
- for (x=0;x<COLS_NUM;x++)
- '' m[y][x];
- '\n';
- }
-}
-
-U0 GetWord(U8 *dst,I64 x,I64 y,I64 dx,I64 dy)
-{
- while (0<=x<COLS_NUM && 0<=y<ROWS_NUM) {
- *dst++=m[y][x];
- y+=dy;
- x+=dx;
- }
- *dst=0;
-}
-
-//************************************
-U0 Search(I64 dx,I64 dy)
-{
- I64 x,y,i,n;
- U8 buf[DIM_MAX+1],*ptr;
- for (y=0;y<ROWS_NUM;y++)
- for (x=0;x<COLS_NUM;x++) {
- GetWord(buf,x,y,dx,dy);
- n=StrLen(buf);
- for (i=n;i>2;i--) {
- buf[i]=0;
- if ((ptr=ACDWordPtAt(buf)) && *ptr++==ACD_WORD_CHAR &&
- !StrICmp(ptr,buf)) {
- "%s ",buf;
- }
- }
- }
-}
-
-U0 SimpleWordSearch()
-{
- Search(1,0);
- Search(0,1);
- Search(-1,0);
- Search(0,-1);
- Search(1,1);
- Search(-1,-1);
- Search(1,-1);
- Search(-1,1);
- '\n';
-}
-
-//************************************
-U8 words[ROWS_NUM*COLS_NUM*8][DIM_MAX+1];
-U8 *word_ptrs[ROWS_NUM*COLS_NUM*8];
-
-U0 CollectWords(I64 dx,I64 dy,I64 *_n)
-{
- I64 x,y,n=*_n;
- for (y=0;y<ROWS_NUM;y++)
- for (x=0;x<COLS_NUM;x++) {
- GetWord(&words[n],x,y,dx,dy);
- word_ptrs[n]=&words[n];
- n++;
- }
- *_n=n;
-}
-
-I64 WordsCompare(U8 *e1,U8 *e2)
-{
- return StrCmp(e1,e2);
-}
-
-/*Fmt of word lst entry:
- U8 ACD_WORD_CHAR
- U8 word[] with terminating zero
- I16 block; //definition offset in ::/Adam/AutoComplete/ACDefs.DATA
-*/
-
-U0 DisplayWords(I64 n)
-{
- I64 i=0,k;
- U8 *w1,*w2,*dict=acd.word_lst;
- for (i=0;i<n;i++)
- while (*dict) {
- w1=word_ptrs[i];
- w2=dict+1;
- while (*w2 && *w1==ToUpper(*w2)) {
- w1++;
- w2++;
- }
- if (ToUpper(*w2)>*w1)
- break;
- if (!*w2) {
- if (StrLen(dict+1)>2) {
- k=i;
- while (k<n && !StrNICmp(word_ptrs[k++],dict+1,StrLen(dict+1)))
- "%s ",dict+1;
- }
- w2=dict+1;
- while (!StrICmp(w2,dict+1))
- dict+=StrLen(dict+1)+4;
- } else
- dict+=StrLen(dict+1)+4;
- }
-}
-
-U0 FancyWordSearch()
-{
- I64 n=0;
- CollectWords(1,0,&n);
- CollectWords(0,1,&n);
- CollectWords(-1,0,&n);
- CollectWords(0,-1,&n);
- CollectWords(1,1,&n);
- CollectWords(-1,-1,&n);
- CollectWords(1,-1,&n);
- CollectWords(-1,1,&n);
- QSortI64(word_ptrs,n,&WordsCompare);
- DisplayWords(n);
- '\n';
-}
-
-//************************************
-U0 WordSearch()
-{
- Init;
- Display;
- '\n';
- SimpleWordSearch;
- FancyWordSearch;
-}
-
-WordSearch;
- - - \ No newline at end of file diff --git a/public/src/Doc/Comm.HC.HTML b/public/src/Doc/Comm.HC.HTML deleted file mode 100644 index 81b792f..0000000 --- a/public/src/Doc/Comm.HC.HTML +++ /dev/null @@ -1,144 +0,0 @@ - - - - - Comm.HC - - - - - /* RS232 serial ports no longer exist.
-Be sure to Adam Include this by placing
-it in your start-up scripts.
-*/
-
-#help_index "Comm"
-
-#define UART_THR 0
-#define UART_RDR 0
-#define UART_BRDL 0
-#define UART_IER 1
-#define UART_BRDH 1
-#define UART_IIR 2
-#define UART_LCR 3
-#define UART_MCR 4
-#define UART_LSR 5
-#define UART_MSR 6
-
-#define COMf_ENABLED 0
-class CComm
-{
- I64 base,
- flags;
- CFifoU8 *RX_fifo;
- CFifoU8 *TX_fifo;
-} comm_ports[5];
-
-U0 CommHndlr(I64 port)
-{
- CComm *c=&comm_ports[port];
- I64 b=0,stat;
- if (Bt(&c->flags,COMf_ENABLED)) {
- stat=InU8(c->base+UART_IIR);
- if (stat & 4) //RX
- FifoU8Ins(c->RX_fifo,InU8(c->base+UART_RDR));
- if (stat & 2) { //TX
- if (FifoU8Rem(c->TX_fifo,&b))
- OutU8(c->base+UART_THR,b);
- else
- OutU8(c->base+UART_IER,1); //RX but no THR empty
- }
- }
-}
-
-interrupt U0 IRQComm3()
-{
- CommHndlr(2);
- CommHndlr(4);
- OutU8(0x20,0x20);
-}
-
-interrupt U0 IRQComm4()
-{
- CommHndlr(1);
- CommHndlr(3);
- OutU8(0x20,0x20);
-}
-
-U0 CommInit()
-{
- MemSet(&comm_ports,0,sizeof(comm_ports));
- comm_ports[1].base=0x3F8;
- comm_ports[2].base=0x2F8;
- comm_ports[3].base=0x3E8;
- comm_ports[4].base=0x2E8;
- IntEntrySet(0x23,&IRQComm3);
- IntEntrySet(0x24,&IRQComm4);
-}
-CommInit;
-
-public CComm *CommInit8n1(I64 port,I64 baud)
-{
- CComm *c=&comm_ports[port];
-
- PUSHFD
- CLI
- if (LBts(&c->flags,COMf_ENABLED)) {
- FifoU8Del(c->RX_fifo);
- FifoU8Del(c->TX_fifo);
- }
- c->RX_fifo=FifoU8New(256);
- c->TX_fifo=FifoU8New(256);
- OutU8(c->base+UART_LCR,0); //Set for IER
- OutU8(c->base+UART_IER,0); //Disable all IRQ
- OutU8(c->base+UART_LCR,0x80); //Enable baud rate control
- OutU8(c->base+UART_BRDL,(0x180/(baud/300)) & 0xFF); //LSB
- OutU8(c->base+UART_BRDH,(0x180/(baud/300)) / 256); //MSB
- OutU8(c->base+UART_LCR,3); //8-none-1
-
- InU8(c->base+UART_RDR); //read garbage
- InU8(c->base+UART_LSR);
-
- OutU8(c->base+UART_MCR,4);
- OutU8(c->base+UART_IER,0); //Disable all IRQ
- OutU8(c->base+UART_MCR,0xA); //out2 and rts
- OutU8(0x21,InU8(0x21) & (0xFF-0x18)); //Enable 8259 IRQ 3 & 4
- OutU8(c->base+UART_IER,1); //RX but no THR empty
- POPFD
-
- return c;
-}
-
-public U0 CommPutChar(I64 port,U8 b)
-{
- CComm *c=&comm_ports[port];
- PUSHFD
- CLI
- FifoU8Ins(c->TX_fifo,b);
- OutU8(c->base+UART_IER,3); //RX and THR empty
- POPFD
- Sleep(10); //!!! Remove this line!!! Linux echo_socket is too slow.
-}
-
-U0 CommPutS(I64 port,U8 *st)
-{
- I64 b;
- while (b=*st++)
- CommPutChar(port,b);
-}
-
-public U0 CommPutBlk(I64 port,U8 *buf,I64 cnt)
-{
- while (cnt--)
- CommPutChar(port,*buf++);
-}
-
-public U0 CommPrint(I64 port,U8 *fmt,...)
-{
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
- CommPutS(port,buf);
- Free(buf);
-}
- - - \ No newline at end of file diff --git a/public/src/Doc/DbgOverview.DD.HTML b/public/src/Doc/DbgOverview.DD.HTML deleted file mode 100644 index d8b668a..0000000 --- a/public/src/Doc/DbgOverview.DD.HTML +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - -
-                               Debugging Overview
-
-* You can enter the debugger with Dbg() or <CTRL-ALT-d>.  You might enter the 
-debugger through a fault.  Enter G() or G2() to continue execution.  Place a 
-call to Dbg() in your code at fatal error points to enter the debugger.  If you 
-see a stk dump, record the label+offset and unassemble, U(). U(_RIP); 
-
-* U(&FunName+offset) to unassemble mem or Uf("FunName") to unassemble a 
-function. U(_RIP-16);
-
-* While debugging, you specify addresses of assembly routines with just the 
-label, as in _MALLOC+0x20.  You specify HolyC function names with & before 
-functions as in &Print+0x10.
-
-* I use progress1-progress4 for debugging because they show on the wallpaper.  
-They're just global int vars.
-
-* You can use AdamLog() to send text to the Adam Task window.  It works like 
-Print().  I never use that.  Instead, I use RawPrint().
-
-* D(), DocD(), RawD() to do 16 column hex dump mem with numbering from zero.  
-With DocD the values are updated continually and you can alter mem by editing.
-
-* Dm(), DocDm(), RawDm() to do 16 column hex dump mem with addresses showing.
-
-* Da() to do one column address dump (for stk, etc.) with symbolic addresses.
-
-* Dr() dumps regs.  You can display and modify regs in the debugger with 
-var-like labels, _RAX, _RBX, etc.
-
-* ClassRep() and the dynamic version ClassRepD() can be used to dump structures.
-
-* Prof() and ProfRep() provide code profiling.  See ::/Demo/InFile/InProfile.IN 
-(This is an InFile.)
-
-* Use RawPrint() to print debug info bypassing the window framework.  You pass 
-these routines a count in milliseconds for how long it should be displayed.  You 
-can use Raw(TRUE) to make all output bypass the window framework.  The WinMgr 
-runs on Core0 and will overwrite raw text from other cores when it updates the 
-scrn.
-
-* Use SysDbg() to set a flag which you can read with IsSysDbg() when you wish to 
-trigger some debug activity.  It's just a handy simple flag, nothing fancy.
-
-* There are flags for various trace options that can help debugging when there 
-are compiler bugs.  Often, you place them in #exe{} blocks.
-  
-  Echo() turns on or off raw data going into the lexical analyzer.
-  
-  Trace() unassembles code generated from the HolyC compiler.
-  
-  PassTrace() shows intermediate code coming-out after optimization.  The bits 
-  ctrl which passes are displayed.
-
-
-* There is a heap check utility which can find leaks.  Use HeapLog(), 
-HeapLogAddrRep() and HeapLogSizeRep().  It's a really simple program which 
-intercepts MAlloc() and Free().  You can customize the code to find other heap 
-issues.
-
-* You can define hndlr functions for <CTRL-ALT-letter> keys with CtrlAltCBSet(). 
- They operate either in a interrupt environment or in the window mgr when it 
-queues kbd msgs.  You can do Raw() output.  <CTRL-ALT-letter> hndlrs take a 
-scan_code as an arg.
-
-* If you recompile Kernel with BootHDIns(), you can set the MemInit, option to 
-initialize memory to a value at boot, the HeapInit option to cause mem alloced 
-off the heap to be initialized or VarInit option so both global and local vars 
-will be initialized to a value, but global AOT variables are always zero if not 
-initialized.  Pick a non-zero value to discover uninitialized var bugs.  You can 
-set sys_var_init_flag, and sys_heap_init_flag directly after booting.
-
- diff --git a/public/src/Doc/FileUtils.DD.HTML b/public/src/Doc/FileUtils.DD.HTML deleted file mode 100644 index 6d49398..0000000 --- a/public/src/Doc/FileUtils.DD.HTML +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - -
-                                   File Utils
-
-File util FilesFind() wildcard mask consists of a single base dir with multiple 
-file masks separated by ';'.  The '*' and '?' wildcard chars are accepted.  The 
-'~' is your home directory and '!' indicates an exclusion mask.
-
- 
-"/Kernel/*"             BaseDir: /Kernel        Mask: *
-"/Demo/*.BMP*;*.GR*"    BaseDir: /Demo          Mask: *.BMP* | *.GR*
-"/*.DD*;!*/Bible*"      BaseDir: Root           Mask: *.DD* but not */Bible*
-
-See FilesFindMatch().
-
-Flags are either text or int values.
-
-  FUF_RECURSE           +r Recurse
-  FUF_SINGLE            +s Single File (Optimization for one file in mask.)
-  FUF_FLATTEN_TREE      +f use with '+F'.  Just use +F, probably.
-  FUF_JUST_DIRS         +D just directories
-  FUF_JUST_FILES        +F just files (Flattens trees)
-  FUF_CLUS_ORDER        +O sort by clus (move head one direction)
-  FUF_JUST_TXT          +T just text files      : FILEMASK_TXT
-  FUF_JUST_DD           +$ just DolDoc files    : FILEMASK_DD
-  FUF_JUST_SRC          +S just src files       : FILEMASK_SRC
-  FUF_JUST_AOT          +A just aot files       : FILEMASK_AOT
-  FUF_JUST_JIT          +J just jit files       : FILEMASK_JIT
-  FUF_JUST_GR           +G just graphic files   : FILEMASK_GR
-
-See ST_FILE_UTIL_FLAGS when used in calling program taking text flags.
-
- diff --git a/public/src/Doc/GraphicsOverview.DD.HTML b/public/src/Doc/GraphicsOverview.DD.HTML deleted file mode 100644 index 5af2855..0000000 --- a/public/src/Doc/GraphicsOverview.DD.HTML +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - - -
-                               Graphics Overview
-
-Dive into Demo Index to learn.
-
-The order layers are drawn on top of each other is:
-
-
-
-
-
-
-
-
-
-
-
-/* Graphics Not Rendered in HTML */
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-* See GrUpdateScrn(), GrUpdateTasks() and GrUpdateTaskWin() called by the WinMgr 
-task 30fps.  Notice the task's draw_it() callback being called.  Only tasks on C
-ore0 are allowed to have windows.  There is one window per task, no child 
-windows.  You can have pop-up child tasks.
-
-* CDCs (device contexts) are a data type for controlling graphics on the scrn or 
-graphics in mem.  The device context structure has thick and color.  You use 
-DCAlias() to create your own structure, with its own color and thick.  Free it 
-with DCDel() when finished.
-
-* gr.dc is a device context for persistent data on the scrn, not needing to be 
-redrawn.  You create an alias for this by using DCAlias() and work with that.  
-See ::/Demo/Graphics/NetOfDots.HC.
-
-* There are various flavors of line and point plotting routines.  GrLine() and 
-GrPlot() are the simplest.  The others allow 3D graphics and rotations.
-
-* See ::/Doc/Transform.DD for adding a transformation.
-
-* You change the Fs->draw_it var to point to your DrawIt() function which gets 
-called each scrn refresh (30 fps).  You draw everything in the window over and 
-over again.  See ::/Demo/Graphics/Box.HC.
-
-* Use the graphic sprite resource editor, <CTRL-r>, to create a sprite that can 
-be plotted with Sprite3() or output to the cmd line with Sprite().  Use $IB,"",B
-I=1$ in a src program to insert the addr of sprite binary data item #1.  To 
-learn how the numbers work, after creating a sprite with <CTRL-r>, toggle to 
-plain text with <CTRL-t> and check its num.  Make an assignment to a ptr var or 
-pass to Sprite3() with $IB,"",BI=n$.  Use <CTRL-r>'s "Pointer to Sprite" to make 
-a $IB...$ entry.  See ::/Demo/Graphics/SpritePlot.HC and 
-::/Demo/Graphics/SpritePlot3D.HC.  The origin (zero point) for a sprite is 
-defined by the cursor location when you pressed <CTRL-r> to make it.  You can 
-edit a sprite by clicking the cursor on it and pressing <CTRL-r> again.
-
-* Set DCF_SYMMETRY in the CDC.flags and call DCSymmetrySet() or DCSymmetry3Set()
-.  This will plot a mirror image in addition to the primary image.  Set 
-DCF_JUST_MIRROR to plot just the image, but this required DCF_SYMMETRY to be set 
-at the same time.  Note: You can only have one symmetry active at a time 
-including in CSprites.
-
-* Use DCNew() to create a mem bitmap which can be used to work off-scrn and 
-which can be GrBloted onto the scrn.  If you set brush member of CDC to another 
-CDC, all the graphic routines will GrBlot() the brush instead of GrPlot().  See 
-::/Demo/Graphics/Blot.HC.
-
-* There are a few raster operations available.  They go in bits 8-11 of the dc->
-color member var which is a CColorROPU32.  ROP_COLLISION is special.  It counts 
-the num of pixs drawn on non-background locations.  Using ROP_COLLISION with 
-vector CSprite's is tricky because overlapping pixs from lines in the CSprite 
-reg as collisions.  You can either work with a nonzero count or convert your 
-CSprite to a bitmap if your subelements draw on top of each other.  Be sure to 
-set ->bkcolor before using ROP_COLLISION.  See ::/Demo/Graphics/Collision.HC and 
-Titanium.
- 
-* The ->dither_probability_u16 member of CDC is a U16 used to statistically sel 
-between two colors to get something resembling more shades of color.  See 
-::/Demo/Graphics/SunMoon.HC and ::/Demo/Graphics/Shading.HC.  It works with many 
-graphic routines, but not those with pens.
-
-* There is a mechanism built-in for generating motion based on differential 
-equations, which allows realistic physics.  You create an CMathODE struct with 
-ODENew(), passing it the num of vars in the state vect.  For realistic physics, 
-you usually have 2 state vars for each dimension (for each mass) because motion 
-is governed by F=mA which is a 2nd order equation.  The two states are pos and 
-velocity and to solve these you need to supply the derivative of pos and 
-velocity.  The derivative of pos is usually simply the current velocity and the 
-derivative of velocity is the acceleration (the sum of forces on a mass divided 
-by mass).  To help provide meaningful names for values in the state vect, you 
-can create an COrder2D3 ptr and point it to a mass in the state vect.  Six 
-elements in the state vect are required for each mass.
-
-See Math/CMathODE.
-See ::/Demo/Games/Rocket.HC.
-
- diff --git a/public/src/Doc/HelpIndex.DD.HTML b/public/src/Doc/HelpIndex.DD.HTML deleted file mode 100644 index e7af845..0000000 --- a/public/src/Doc/HelpIndex.DD.HTML +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - -
-                                      Help
-
-+] Keyboard Ctrls
-+] Mouse Ctrls
-+] Keyboard-Mouse Ctrls
-
-Welcome         About TempleOS
-Command Line    Take Tour
-Demo Index      Key Map
-Features        Requirements
-Charter         Strategic Decisions
-F.A.Q.          Glossary
-HolyC           Compiler Index
-Why Not More?   Demands
-The Std TempleOS PC
-        
-+] User Help
-+] Admin Help
-+] Programmer help
-+] System Programmer Help
-
-
-                                     Index
-AutoComplete
-Bit
-Boot
-Call
-Char Overview
-Char Routines
-Circular Queue
-Cmd Line Overview
-Cmd Line Routines
-Compiler Overview
-Compiler Routines
-Compression
-Ctrls
-Data Types
-Date
-Debugging Overview
-Debugging Routines
-Define
-Devices
-Disk
-Doc Overview
-Doc Routines
-Exceptions
-File
-File Utils
-Frames
-God
-Graphics Overview
-Graphics Routines
-Hash
-Help System
-HolyC
-InFile
-Info
-Install
-I/O
-Job
-Key Allocations
-Keyboard Devices
-Link Types
-Math
-Memory Overview
-Memory Routines
-Menus
-Messages
-Misc
-Mouse
-MultiCore
-OpCodes
-Operator Precedences
-PCI
-Print("") Fmt Strings
-Processor
-Profiler
-RedSea
-Registry
-Scan Codes
-ScrnCast
-Sound
-Sprites
-StdIn
-StdOut
-String
-Task
-TextBase Layer
-Time
-Training
-TOSZ
-Utils
-Windows
-
- diff --git a/public/src/Doc/Job.DD.HTML b/public/src/Doc/Job.DD.HTML deleted file mode 100644 index 73cfa4d..0000000 --- a/public/src/Doc/Job.DD.HTML +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - -
-/* Graphics Not Rendered in HTML */
-               PopUpPrint                         User          ExePrint
-
-
-
-                  PopUp                                          ExePutS
-
-
-
- Core0 AdamTask  SrvCmdLine   AP SethTask       UserCmdLine
-
-
-
-
-
-
-         SrvTaskCont                          UserTaskCont
-
-
-
-        JobsHndlr
-
-
-
-         JobRunOne           JobRunOne         ExeCmdLine      ExeCmdLine
-
-
-
-
-CJob nodes are one of five types.  User applications deal with text or msgs.  
-JobRunOne() will call a function, spawn a task or execute some text src code.
-
-#define JOBT_TEXT_INPUT         0 //TaskText()  Feed StdIn 
-#define JOBT_MSG                1 //TaskMsg()   Post msg 
-#define JOBT_EXE_STR            2 //TaskExe()   Compile & execute src code text
-#define JOBT_CALL               3 //JobQue()    Tell MP to call function
-#define JOBT_SPAWN_TASK         4 //Spawn()     Tell MP to spawn task
-
-Several other routines include a call to JobsHndlr() that gives them powerful 
-ability to execute servant cmds.
-
- diff --git a/public/src/Doc/Once.DD.HTML b/public/src/Doc/Once.DD.HTML deleted file mode 100644 index 11cc26e..0000000 --- a/public/src/Doc/Once.DD.HTML +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - -
-KMain()
-  includes ::/StartOS.HC
-    includes ~/MakeHome.HC
-      includes ~/HomeSys.HC
-        calls StartUpTasks()
-          includes ~/Once.HC
-            calls OnceExe().
-
-AOnce() appends src code to ~/Registry.HC Once/Adam tree, executed at next boot 
-by Adam.
-
-Once()  appends src code to ~/Registry.HC Once/User tree, executed at next boot 
-by first User term.
-
-At boot, OnceExe(), executes Once/Adam tree, AOnceFlush()s it,
-executes Once/User tree and OnceFlush()s.
-
- diff --git a/public/src/Doc/TextBase.DD.HTML b/public/src/Doc/TextBase.DD.HTML deleted file mode 100644 index 4187301..0000000 --- a/public/src/Doc/TextBase.DD.HTML +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - -
-gr.text_base must be updated 30fps in your Fs->draw_it() callback.  You probably 
-want GrPrint() or just Print().  The DolDoc code takes care of plotting text to 
-gr.text_base.
-
-Bits 0-7        8-Bit ASCII Scrn Code
-Bits 8-11       Foreground color
-Bits 12-15      Background color
-Bits 16-20      Signed X pos shift val
-Bits 21-25      Signed Y pos shift val
-Bit  28         Blink
-Bit  29         Inverted (Swap foreground and background)
-Bit  30         Sel (XOR colors with FF)
-Bit  31         Underline
-
-GrUpdateTaskWin() calls DocUpdateTaskDocs() which calls DocRecalc() where the 
-document text is plotted into gr.text_base.  Then, GrUpdateTextBG() and 
-GrUpdateTextFG() render the gr.text_base onto gr.dc2, a raw graphic bitmap.
-
-See ::/Demo/Games/Maze.HC.
-
- diff --git a/public/src/Doc/Transform.DD.HTML b/public/src/Doc/Transform.DD.HTML deleted file mode 100644 index a4f2efd..0000000 --- a/public/src/Doc/Transform.DD.HTML +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - -
-CDC's have a 4x4 matrix for rotating, scaling, skewing and shifting in 3 
-dimensions.  To make the graphics routines use the transform, you must set the 
-DCF_TRANSFORMATION flag.
-
-The matrix consists of ints that have been scaled 32 bits (GR_SCALE).  See 
-::/Demo/Lectures/FixedPoint.HC to learn why.
-
-See Mat4x4IdentEqu(), Mat4x4IdentNew(), Mat4x4Equ() and Mat4x4New().  See 
-Mat4x4RotX(), Mat4x4RotY(), Mat4x4RotZ() and Mat4x4Scale() to rotate about axes 
-and scale.  Combine them with Mat4x4MulMat4x4Equ()/Mat4x4MulMat4x4New() and 
-assign them to the CDC.dc with DCMat4x4Set().  See ::/Demo/Graphics/Box.HC.
-
-You can rotate single points using Mat4x4MulXYZ().
-
-The 4th dimension allows a neat trick where you can place pos shifts 
-(translations), into the matrix and Mat4x4MulMat4x4Equ/Mat4x4MulMat4x4New them 
-to combine rotation/shift operations.  Normally, you can't combine pos shift 
-operations.  See Mat4x4TranslationEqu() and ::/Demo/Graphics/Transform.HC.
-
-Finally, CDC's have an x, y and z which is an additional shift (translation).
-
-The transformation is implemented as a callback on the CDC's transform() member. 
- The default transform() callback is DCTransform().  See 
-::/Demo/Games/Talons.HC or ::/Demo/Games/CastleFrankenstein.HC to see how to 
-change the transform() callback for foreshortening.
-
- diff --git a/public/src/Home/DoDistro.HC.HTML b/public/src/Home/DoDistro.HC.HTML deleted file mode 100644 index 422179d..0000000 --- a/public/src/Home/DoDistro.HC.HTML +++ /dev/null @@ -1,61 +0,0 @@ - - - - - DoDistro.HC - - - - - //Make Your own Distro by #include-ing this file.
-
-#define STD_DISTRO_DVD_CFG "TB\nScale2Mem(2048,0x40000)\nT\n\n\n\n"
-
-U0 MakeMyISO(U8 *_out_iso_filename)
-{//Does everything with current drive.
-//If you have not recompiled Kernel and defined your CD/DVD drive, use Mount.
- U8 *out_iso_filename=FileNameAbs(_out_iso_filename);
- if (!DrvIsWritable) {
- "Drive must be writable. Install on Hard drive, first.\n";
- return;
- }
- DelTree("/Distro");
- Del(out_iso_filename);
-
- DirMk("/Distro");
- In(STD_DISTRO_DVD_CFG);
- BootDVDIns;
-
- Copy("/*","/Distro");
- Del("/Distro/" KERNEL_BIN_C);
-
- CopyTree(BOOT_DIR, "/Distro" BOOT_DIR);
- CopyTree("/Home", "/Distro/Home");
- CopyTree("/Adam", "/Distro/Adam");
- CopyTree("/Apps", "/Distro/Apps");
- CopyTree("/Compiler", "/Distro/Compiler");
- CopyTree("/Demo", "/Distro/Demo");
- CopyTree("/Doc", "/Distro/Doc");
- CopyTree("/Kernel", "/Distro/Kernel");
- CopyTree("/Misc", "/Distro/Misc");
-
- //To save space, optionally delete dictionary.
- //Del("/Distro/Adam/AutoComplete/ACDefs.DATA");
- CopyTree("/Downloads","/Distro/Downloads"); //You can leave this out.
- DirMk("/Distro/Tmp");
- DirMk("/Distro/Tmp/ScrnShots");
- RedSeaISO(out_iso_filename,"/Distro","/Distro" BOOT_DIR_KERNEL_BIN_C);
-
- //If CD-ROM use MT_CD instead of MT_DVD.
- //DVDImageWrite('T',out_iso_filename,MT_DVD); //Uncomment to burn.
-
- //DelTree("/Distro");
- Free(out_iso_filename);
-}
-
-MakeMyISO("/Tmp/MyDistro.ISO.C");
-
-// Study my account examples $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOS/TOSCfg.HC,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOS/TOSDistro.HC,1"$.
- - - \ No newline at end of file diff --git a/public/src/Home/Doc/DbgOverview.DD.HTML b/public/src/Home/Doc/DbgOverview.DD.HTML deleted file mode 100755 index d8b668a..0000000 --- a/public/src/Home/Doc/DbgOverview.DD.HTML +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - -
-                               Debugging Overview
-
-* You can enter the debugger with Dbg() or <CTRL-ALT-d>.  You might enter the 
-debugger through a fault.  Enter G() or G2() to continue execution.  Place a 
-call to Dbg() in your code at fatal error points to enter the debugger.  If you 
-see a stk dump, record the label+offset and unassemble, U(). U(_RIP); 
-
-* U(&FunName+offset) to unassemble mem or Uf("FunName") to unassemble a 
-function. U(_RIP-16);
-
-* While debugging, you specify addresses of assembly routines with just the 
-label, as in _MALLOC+0x20.  You specify HolyC function names with & before 
-functions as in &Print+0x10.
-
-* I use progress1-progress4 for debugging because they show on the wallpaper.  
-They're just global int vars.
-
-* You can use AdamLog() to send text to the Adam Task window.  It works like 
-Print().  I never use that.  Instead, I use RawPrint().
-
-* D(), DocD(), RawD() to do 16 column hex dump mem with numbering from zero.  
-With DocD the values are updated continually and you can alter mem by editing.
-
-* Dm(), DocDm(), RawDm() to do 16 column hex dump mem with addresses showing.
-
-* Da() to do one column address dump (for stk, etc.) with symbolic addresses.
-
-* Dr() dumps regs.  You can display and modify regs in the debugger with 
-var-like labels, _RAX, _RBX, etc.
-
-* ClassRep() and the dynamic version ClassRepD() can be used to dump structures.
-
-* Prof() and ProfRep() provide code profiling.  See ::/Demo/InFile/InProfile.IN 
-(This is an InFile.)
-
-* Use RawPrint() to print debug info bypassing the window framework.  You pass 
-these routines a count in milliseconds for how long it should be displayed.  You 
-can use Raw(TRUE) to make all output bypass the window framework.  The WinMgr 
-runs on Core0 and will overwrite raw text from other cores when it updates the 
-scrn.
-
-* Use SysDbg() to set a flag which you can read with IsSysDbg() when you wish to 
-trigger some debug activity.  It's just a handy simple flag, nothing fancy.
-
-* There are flags for various trace options that can help debugging when there 
-are compiler bugs.  Often, you place them in #exe{} blocks.
-  
-  Echo() turns on or off raw data going into the lexical analyzer.
-  
-  Trace() unassembles code generated from the HolyC compiler.
-  
-  PassTrace() shows intermediate code coming-out after optimization.  The bits 
-  ctrl which passes are displayed.
-
-
-* There is a heap check utility which can find leaks.  Use HeapLog(), 
-HeapLogAddrRep() and HeapLogSizeRep().  It's a really simple program which 
-intercepts MAlloc() and Free().  You can customize the code to find other heap 
-issues.
-
-* You can define hndlr functions for <CTRL-ALT-letter> keys with CtrlAltCBSet(). 
- They operate either in a interrupt environment or in the window mgr when it 
-queues kbd msgs.  You can do Raw() output.  <CTRL-ALT-letter> hndlrs take a 
-scan_code as an arg.
-
-* If you recompile Kernel with BootHDIns(), you can set the MemInit, option to 
-initialize memory to a value at boot, the HeapInit option to cause mem alloced 
-off the heap to be initialized or VarInit option so both global and local vars 
-will be initialized to a value, but global AOT variables are always zero if not 
-initialized.  Pick a non-zero value to discover uninitialized var bugs.  You can 
-set sys_var_init_flag, and sys_heap_init_flag directly after booting.
-
- diff --git a/public/src/Home/Doc/FileUtils.DD.HTML b/public/src/Home/Doc/FileUtils.DD.HTML deleted file mode 100755 index 6d49398..0000000 --- a/public/src/Home/Doc/FileUtils.DD.HTML +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - -
-                                   File Utils
-
-File util FilesFind() wildcard mask consists of a single base dir with multiple 
-file masks separated by ';'.  The '*' and '?' wildcard chars are accepted.  The 
-'~' is your home directory and '!' indicates an exclusion mask.
-
- 
-"/Kernel/*"             BaseDir: /Kernel        Mask: *
-"/Demo/*.BMP*;*.GR*"    BaseDir: /Demo          Mask: *.BMP* | *.GR*
-"/*.DD*;!*/Bible*"      BaseDir: Root           Mask: *.DD* but not */Bible*
-
-See FilesFindMatch().
-
-Flags are either text or int values.
-
-  FUF_RECURSE           +r Recurse
-  FUF_SINGLE            +s Single File (Optimization for one file in mask.)
-  FUF_FLATTEN_TREE      +f use with '+F'.  Just use +F, probably.
-  FUF_JUST_DIRS         +D just directories
-  FUF_JUST_FILES        +F just files (Flattens trees)
-  FUF_CLUS_ORDER        +O sort by clus (move head one direction)
-  FUF_JUST_TXT          +T just text files      : FILEMASK_TXT
-  FUF_JUST_DD           +$ just DolDoc files    : FILEMASK_DD
-  FUF_JUST_SRC          +S just src files       : FILEMASK_SRC
-  FUF_JUST_AOT          +A just aot files       : FILEMASK_AOT
-  FUF_JUST_JIT          +J just jit files       : FILEMASK_JIT
-  FUF_JUST_GR           +G just graphic files   : FILEMASK_GR
-
-See ST_FILE_UTIL_FLAGS when used in calling program taking text flags.
-
- diff --git a/public/src/Home/Doc/GraphicsOverview.DD.HTML b/public/src/Home/Doc/GraphicsOverview.DD.HTML deleted file mode 100755 index 5af2855..0000000 --- a/public/src/Home/Doc/GraphicsOverview.DD.HTML +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - - -
-                               Graphics Overview
-
-Dive into Demo Index to learn.
-
-The order layers are drawn on top of each other is:
-
-
-
-
-
-
-
-
-
-
-
-/* Graphics Not Rendered in HTML */
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-* See GrUpdateScrn(), GrUpdateTasks() and GrUpdateTaskWin() called by the WinMgr 
-task 30fps.  Notice the task's draw_it() callback being called.  Only tasks on C
-ore0 are allowed to have windows.  There is one window per task, no child 
-windows.  You can have pop-up child tasks.
-
-* CDCs (device contexts) are a data type for controlling graphics on the scrn or 
-graphics in mem.  The device context structure has thick and color.  You use 
-DCAlias() to create your own structure, with its own color and thick.  Free it 
-with DCDel() when finished.
-
-* gr.dc is a device context for persistent data on the scrn, not needing to be 
-redrawn.  You create an alias for this by using DCAlias() and work with that.  
-See ::/Demo/Graphics/NetOfDots.HC.
-
-* There are various flavors of line and point plotting routines.  GrLine() and 
-GrPlot() are the simplest.  The others allow 3D graphics and rotations.
-
-* See ::/Doc/Transform.DD for adding a transformation.
-
-* You change the Fs->draw_it var to point to your DrawIt() function which gets 
-called each scrn refresh (30 fps).  You draw everything in the window over and 
-over again.  See ::/Demo/Graphics/Box.HC.
-
-* Use the graphic sprite resource editor, <CTRL-r>, to create a sprite that can 
-be plotted with Sprite3() or output to the cmd line with Sprite().  Use $IB,"",B
-I=1$ in a src program to insert the addr of sprite binary data item #1.  To 
-learn how the numbers work, after creating a sprite with <CTRL-r>, toggle to 
-plain text with <CTRL-t> and check its num.  Make an assignment to a ptr var or 
-pass to Sprite3() with $IB,"",BI=n$.  Use <CTRL-r>'s "Pointer to Sprite" to make 
-a $IB...$ entry.  See ::/Demo/Graphics/SpritePlot.HC and 
-::/Demo/Graphics/SpritePlot3D.HC.  The origin (zero point) for a sprite is 
-defined by the cursor location when you pressed <CTRL-r> to make it.  You can 
-edit a sprite by clicking the cursor on it and pressing <CTRL-r> again.
-
-* Set DCF_SYMMETRY in the CDC.flags and call DCSymmetrySet() or DCSymmetry3Set()
-.  This will plot a mirror image in addition to the primary image.  Set 
-DCF_JUST_MIRROR to plot just the image, but this required DCF_SYMMETRY to be set 
-at the same time.  Note: You can only have one symmetry active at a time 
-including in CSprites.
-
-* Use DCNew() to create a mem bitmap which can be used to work off-scrn and 
-which can be GrBloted onto the scrn.  If you set brush member of CDC to another 
-CDC, all the graphic routines will GrBlot() the brush instead of GrPlot().  See 
-::/Demo/Graphics/Blot.HC.
-
-* There are a few raster operations available.  They go in bits 8-11 of the dc->
-color member var which is a CColorROPU32.  ROP_COLLISION is special.  It counts 
-the num of pixs drawn on non-background locations.  Using ROP_COLLISION with 
-vector CSprite's is tricky because overlapping pixs from lines in the CSprite 
-reg as collisions.  You can either work with a nonzero count or convert your 
-CSprite to a bitmap if your subelements draw on top of each other.  Be sure to 
-set ->bkcolor before using ROP_COLLISION.  See ::/Demo/Graphics/Collision.HC and 
-Titanium.
- 
-* The ->dither_probability_u16 member of CDC is a U16 used to statistically sel 
-between two colors to get something resembling more shades of color.  See 
-::/Demo/Graphics/SunMoon.HC and ::/Demo/Graphics/Shading.HC.  It works with many 
-graphic routines, but not those with pens.
-
-* There is a mechanism built-in for generating motion based on differential 
-equations, which allows realistic physics.  You create an CMathODE struct with 
-ODENew(), passing it the num of vars in the state vect.  For realistic physics, 
-you usually have 2 state vars for each dimension (for each mass) because motion 
-is governed by F=mA which is a 2nd order equation.  The two states are pos and 
-velocity and to solve these you need to supply the derivative of pos and 
-velocity.  The derivative of pos is usually simply the current velocity and the 
-derivative of velocity is the acceleration (the sum of forces on a mass divided 
-by mass).  To help provide meaningful names for values in the state vect, you 
-can create an COrder2D3 ptr and point it to a mass in the state vect.  Six 
-elements in the state vect are required for each mass.
-
-See Math/CMathODE.
-See ::/Demo/Games/Rocket.HC.
-
- diff --git a/public/src/Home/Doc/HelpIndex.DD.HTML b/public/src/Home/Doc/HelpIndex.DD.HTML deleted file mode 100755 index e7af845..0000000 --- a/public/src/Home/Doc/HelpIndex.DD.HTML +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - -
-                                      Help
-
-+] Keyboard Ctrls
-+] Mouse Ctrls
-+] Keyboard-Mouse Ctrls
-
-Welcome         About TempleOS
-Command Line    Take Tour
-Demo Index      Key Map
-Features        Requirements
-Charter         Strategic Decisions
-F.A.Q.          Glossary
-HolyC           Compiler Index
-Why Not More?   Demands
-The Std TempleOS PC
-        
-+] User Help
-+] Admin Help
-+] Programmer help
-+] System Programmer Help
-
-
-                                     Index
-AutoComplete
-Bit
-Boot
-Call
-Char Overview
-Char Routines
-Circular Queue
-Cmd Line Overview
-Cmd Line Routines
-Compiler Overview
-Compiler Routines
-Compression
-Ctrls
-Data Types
-Date
-Debugging Overview
-Debugging Routines
-Define
-Devices
-Disk
-Doc Overview
-Doc Routines
-Exceptions
-File
-File Utils
-Frames
-God
-Graphics Overview
-Graphics Routines
-Hash
-Help System
-HolyC
-InFile
-Info
-Install
-I/O
-Job
-Key Allocations
-Keyboard Devices
-Link Types
-Math
-Memory Overview
-Memory Routines
-Menus
-Messages
-Misc
-Mouse
-MultiCore
-OpCodes
-Operator Precedences
-PCI
-Print("") Fmt Strings
-Processor
-Profiler
-RedSea
-Registry
-Scan Codes
-ScrnCast
-Sound
-Sprites
-StdIn
-StdOut
-String
-Task
-TextBase Layer
-Time
-Training
-TOSZ
-Utils
-Windows
-
- diff --git a/public/src/Home/Doc/Job.DD.HTML b/public/src/Home/Doc/Job.DD.HTML deleted file mode 100755 index 73cfa4d..0000000 --- a/public/src/Home/Doc/Job.DD.HTML +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - -
-/* Graphics Not Rendered in HTML */
-               PopUpPrint                         User          ExePrint
-
-
-
-                  PopUp                                          ExePutS
-
-
-
- Core0 AdamTask  SrvCmdLine   AP SethTask       UserCmdLine
-
-
-
-
-
-
-         SrvTaskCont                          UserTaskCont
-
-
-
-        JobsHndlr
-
-
-
-         JobRunOne           JobRunOne         ExeCmdLine      ExeCmdLine
-
-
-
-
-CJob nodes are one of five types.  User applications deal with text or msgs.  
-JobRunOne() will call a function, spawn a task or execute some text src code.
-
-#define JOBT_TEXT_INPUT         0 //TaskText()  Feed StdIn 
-#define JOBT_MSG                1 //TaskMsg()   Post msg 
-#define JOBT_EXE_STR            2 //TaskExe()   Compile & execute src code text
-#define JOBT_CALL               3 //JobQue()    Tell MP to call function
-#define JOBT_SPAWN_TASK         4 //Spawn()     Tell MP to spawn task
-
-Several other routines include a call to JobsHndlr() that gives them powerful 
-ability to execute servant cmds.
-
- diff --git a/public/src/Home/Doc/Once.DD.HTML b/public/src/Home/Doc/Once.DD.HTML deleted file mode 100755 index 11cc26e..0000000 --- a/public/src/Home/Doc/Once.DD.HTML +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - -
-KMain()
-  includes ::/StartOS.HC
-    includes ~/MakeHome.HC
-      includes ~/HomeSys.HC
-        calls StartUpTasks()
-          includes ~/Once.HC
-            calls OnceExe().
-
-AOnce() appends src code to ~/Registry.HC Once/Adam tree, executed at next boot 
-by Adam.
-
-Once()  appends src code to ~/Registry.HC Once/User tree, executed at next boot 
-by first User term.
-
-At boot, OnceExe(), executes Once/Adam tree, AOnceFlush()s it,
-executes Once/User tree and OnceFlush()s.
-
- diff --git a/public/src/Home/Doc/TextBase.DD.HTML b/public/src/Home/Doc/TextBase.DD.HTML deleted file mode 100755 index 4187301..0000000 --- a/public/src/Home/Doc/TextBase.DD.HTML +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - -
-gr.text_base must be updated 30fps in your Fs->draw_it() callback.  You probably 
-want GrPrint() or just Print().  The DolDoc code takes care of plotting text to 
-gr.text_base.
-
-Bits 0-7        8-Bit ASCII Scrn Code
-Bits 8-11       Foreground color
-Bits 12-15      Background color
-Bits 16-20      Signed X pos shift val
-Bits 21-25      Signed Y pos shift val
-Bit  28         Blink
-Bit  29         Inverted (Swap foreground and background)
-Bit  30         Sel (XOR colors with FF)
-Bit  31         Underline
-
-GrUpdateTaskWin() calls DocUpdateTaskDocs() which calls DocRecalc() where the 
-document text is plotted into gr.text_base.  Then, GrUpdateTextBG() and 
-GrUpdateTextFG() render the gr.text_base onto gr.dc2, a raw graphic bitmap.
-
-See ::/Demo/Games/Maze.HC.
-
- diff --git a/public/src/Home/Doc/Transform.DD.HTML b/public/src/Home/Doc/Transform.DD.HTML deleted file mode 100755 index a4f2efd..0000000 --- a/public/src/Home/Doc/Transform.DD.HTML +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - -
-CDC's have a 4x4 matrix for rotating, scaling, skewing and shifting in 3 
-dimensions.  To make the graphics routines use the transform, you must set the 
-DCF_TRANSFORMATION flag.
-
-The matrix consists of ints that have been scaled 32 bits (GR_SCALE).  See 
-::/Demo/Lectures/FixedPoint.HC to learn why.
-
-See Mat4x4IdentEqu(), Mat4x4IdentNew(), Mat4x4Equ() and Mat4x4New().  See 
-Mat4x4RotX(), Mat4x4RotY(), Mat4x4RotZ() and Mat4x4Scale() to rotate about axes 
-and scale.  Combine them with Mat4x4MulMat4x4Equ()/Mat4x4MulMat4x4New() and 
-assign them to the CDC.dc with DCMat4x4Set().  See ::/Demo/Graphics/Box.HC.
-
-You can rotate single points using Mat4x4MulXYZ().
-
-The 4th dimension allows a neat trick where you can place pos shifts 
-(translations), into the matrix and Mat4x4MulMat4x4Equ/Mat4x4MulMat4x4New them 
-to combine rotation/shift operations.  Normally, you can't combine pos shift 
-operations.  See Mat4x4TranslationEqu() and ::/Demo/Graphics/Transform.HC.
-
-Finally, CDC's have an x, y and z which is an additional shift (translation).
-
-The transformation is implemented as a callback on the CDC's transform() member. 
- The default transform() callback is DCTransform().  See 
-::/Demo/Games/Talons.HC or ::/Demo/Games/CastleFrankenstein.HC to see how to 
-change the transform() callback for foreshortening.
-
- diff --git a/public/src/Home/MakeHome.HC.HTML b/public/src/Home/MakeHome.HC.HTML deleted file mode 100644 index 1b70ace..0000000 --- a/public/src/Home/MakeHome.HC.HTML +++ /dev/null @@ -1,25 +0,0 @@ - - - - - MakeHome.HC - - - - - Cd(__DIR__);;
-
-//If these are not present in /Home, it uses the version in the root dir. You
-//can make your own, modified, version of these files in your /Home directory.
-#include "~/HomeLocalize"
-#include "/Adam/Opt/Boot/MakeBoot"
-#include "/Adam/Opt/Utils/MakeUtils"
-#include "~/HomeWrappers"
-MapFileLoad("::/Kernel/Kernel");
-MapFileLoad("::/Compiler/Compiler");
-#include "~/HomeKeyPlugIns"
-#include "~/HomeSys"
-Cd("..");;
- - - \ No newline at end of file diff --git a/public/src/Home/Registry.HC.HTML b/public/src/Home/Registry.HC.HTML deleted file mode 100644 index bee05f1..0000000 --- a/public/src/Home/Registry.HC.HTML +++ /dev/null @@ -1,38 +0,0 @@ - - - - - Registry.HC - - - - - $TR,"Adam"$
-
$TR,"SysMsgFlags"$
-$ID,2$sys_msg_flags[0]=0;
-
$TR,"SysRegVer"$
-
registry_version=5.030;
-
$TR,"InsReg"$
-
#help_index "Registry/Install Registration"
-MemSet(&ins_reg,0,sizeof(CInsReg));
-ins_reg.registered=0;
-ins_reg.host_os=0;
-ins_reg.host_vm=0;
-
-#define INS_REG_PERSONAL_INITIALS ""
-StrCpy(ins_reg.initials,"");
-HashPublic("INS_REG_PERSONAL_INITIALS",HTT_DEFINE_STR);
-
-#define INS_REG_MACHINE_NUM 0
-ins_reg.machine_num=0;
-HashPublic("INS_REG_MACHINE_NUM",HTT_DEFINE_STR);
-
-"InsReg:%s:%d\n",INS_REG_PERSONAL_INITIALS,INS_REG_MACHINE_NUM;
-
-#help_index ""
-
$ID,-2$TR,"Once"$
-
$TR,"Adam"$
-$ID,2$
$TR,"User"$
-
$ID,-2$
- - \ No newline at end of file diff --git a/public/src/HomeKeyPlugIns.HC.HTML b/public/src/HomeKeyPlugIns.HC.HTML deleted file mode 100644 index cfe3284..0000000 --- a/public/src/HomeKeyPlugIns.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - HomeKeyPlugIns.HC - - - - - - - \ No newline at end of file diff --git a/public/src/HomeLocalize.HC.HTML b/public/src/HomeLocalize.HC.HTML deleted file mode 100644 index 60603c7..0000000 --- a/public/src/HomeLocalize.HC.HTML +++ /dev/null @@ -1,31 +0,0 @@ - - - - - HomeLocalize.HC - - - - - //Place this file in /Home and change
-//anything you want.
-
-//This makes your keyboard fast
-KbdTypeMatic(0);
-
-//Set Time Zone
-local_time_offset=0*60*60*CDATE_FREQ; //Do daylight savings by hand
-
-//$AN,"",A="mouse_move_scale"$adjust these to set mouse move scale
-ms_hard.scale.x=0.5;
-ms_hard.scale.y=0.5;
-ms_hard.scale.z=1.0; //wheel
-
-//don't change these
-ms_hard.prescale.x=ms_hard.pos.x/ms_hard.scale.x;
-ms_hard.prescale.y=ms_hard.pos.y/ms_hard.scale.y;
-ms_hard.prescale.z=ms_hard.pos.z/ms_hard.scale.z;
-
- - - \ No newline at end of file diff --git a/public/src/HomeSys.HC.HTML b/public/src/HomeSys.HC.HTML deleted file mode 100644 index 9abfdf2..0000000 --- a/public/src/HomeSys.HC.HTML +++ /dev/null @@ -1,50 +0,0 @@ - - - - - HomeSys.HC - - - - - //Place this file in /Home and change
-//anything you want.
-
-U0 UserStartUp()
-{//Run each time a user a spawned
- DocTermNew;
- Type("::/Doc/Start.DD");
- LBts(&Fs->display_flags,DISPLAYf_SHOW);
- WinToTop;
- WinZBufUpdate;
- Dir;
-}
-
-U0 SrvStartUp()
-{//Run each time a srv task is spawned.
- DocTermNew;
- LBts(&Fs->display_flags,DISPLAYf_SHOW);
- WinToTop;
- WinZBufUpdate;
-}
-
-U0 StartUpTasks()
-{
- CTask *user1,*user2;
- user1=User;
- user2=User;
- WinToTop(user1);
- WinTileVert;
- "Boot Time:%7.3fs\n",tS;
- XTalk(user1,"Cd;#include \"Once\";\n");
- Silent; //no output to scrn
- ACInit("/*;!*/Bible.TXT*");
- Silent(OFF); //no output to scrn
-}
-
-StartUpTasks;
-
-"\nTempleOS V%5.3f\t%D %T\n\n",sys_os_version,sys_compile_time,sys_compile_time;
- - - \ No newline at end of file diff --git a/public/src/HomeWrappers.HC.HTML b/public/src/HomeWrappers.HC.HTML deleted file mode 100644 index e77277b..0000000 --- a/public/src/HomeWrappers.HC.HTML +++ /dev/null @@ -1,38 +0,0 @@ - - - - - HomeWrappers.HC - - - - - //Place this file in /Home and change
-//anything you want.
-
-#help_index "Cmd Line (Typically)"
-
-//These are customized quick commands.
-//Feel free to add more or change.
-public I64 F(U8 *needle_str,U8 *fu_flags=NULL)
-{//Find text in all text files.
- return Find(needle_str,"/*",fu_flags);
-}
-
-public I64 R(U8 *needle_str,U8 *replace_text=NULL,U8 *fu_flags="+l-i")
-{//Find text and replace in all text files.
- return Find(needle_str,"/*",fu_flags,replace_text);
-}
-
-public I64 FD(U8 *needle_str,U8 *fu_flags=NULL)
-{//Find text in cur dir text files.
- return Find(needle_str,"*",fu_flags);
-}
-
-public I64 RD(U8 *needle_str,U8 *replace_text=NULL,U8 *fu_flags="+l-i")
-{//Find text and replace in cur dir text files.
- return Find(needle_str,"*",fu_flags,replace_text);
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/BlkDev/DskATA.HC.HTML b/public/src/Kernel/BlkDev/DskATA.HC.HTML deleted file mode 100644 index 392d33c..0000000 --- a/public/src/Kernel/BlkDev/DskATA.HC.HTML +++ /dev/null @@ -1,623 +0,0 @@ - - - - - DskATA.HC - - - - - U0 ATABlkSel(CBlkDev *bd,I64 blk,I64 cnt)
-{
- if (bd->type!=BDT_ATAPI && bd->base1)
- OutU8(bd->base1+ATAR1_CTRL,0x8);
- if (bd->flags & BDF_EXT_SIZE) { //48 Bit LBA?
- OutU8(bd->base0+ATAR0_NSECT,cnt.u8[1]);
- OutU8(bd->base0+ATAR0_SECT,blk.u8[3]);
- OutU8(bd->base0+ATAR0_LCYL,blk.u8[4]);
- OutU8(bd->base0+ATAR0_HCYL,blk.u8[5]);
- OutU8(bd->base0+ATAR0_NSECT,cnt);
- OutU8(bd->base0+ATAR0_SECT,blk);
- OutU8(bd->base0+ATAR0_LCYL,blk.u8[1]);
- OutU8(bd->base0+ATAR0_HCYL,blk.u8[2]);
- OutU8(bd->base0+ATAR0_SEL,0xEF|bd->unit<<4);
- } else { //28 Bit LBA
- OutU8(bd->base0+ATAR0_NSECT,cnt);
- OutU8(bd->base0+ATAR0_SECT,blk);
- OutU8(bd->base0+ATAR0_LCYL,blk.u8[1]);
- OutU8(bd->base0+ATAR0_HCYL,blk.u8[2]);
- OutU8(bd->base0+ATAR0_SEL,0xE0|bd->unit<<4|blk.u8[3]);
- }
-}
-
-Bool ATAWaitNotBUSY(CBlkDev *bd,F64 timeout)
-{
- I64 i;
- do {
- for (i=0;i<3;i++)
- if (!(InU8(bd->base0+ATAR0_STAT)&ATAS_BSY))
- return TRUE;
- Yield;
- } while (!(0<timeout<tS));
- return FALSE;
-}
-
-Bool ATAWaitDRQ(CBlkDev *bd,F64 timeout)
-{
- I64 i;
- do {
- for (i=0;i<3;i++)
- if (InU8(bd->base0+ATAR0_STAT)&ATAS_DRQ)
- return TRUE;
- Yield;
- } while (!(0<timeout<tS));
- return FALSE;
-}
-
-Bool ATANop(CBlkDev *bd,F64 timeout)
-{
- if (bd->flags & BDF_EXT_SIZE)
- OutU8(bd->base0+ATAR0_SEL,0xEF|bd->unit<<4);
- else
- OutU8(bd->base0+ATAR0_SEL,0xE0|bd->unit<<4);
- OutU8(bd->base0+ATAR0_FEAT,0);
- OutU8(bd->base0+ATAR0_CMD,ATA_NOP);
- return ATAWaitNotBUSY(bd,timeout);
-}
-
-U0 ATACmd(CBlkDev *bd,U8 cmd)
-{
- OutU8(bd->base0+ATAR0_FEAT,0);
- OutU8(bd->base0+ATAR0_CMD,cmd);
- bd->last_time=tS;
- PortNop;
-}
-
-Bool ATAGetRes(CBlkDev *bd,F64 timeout,U8 *buf,I64 cnt,
- I64 _avail,Bool one_read)
-{
- I64 avail,overflow;
- bd->flags&=~BDF_LAST_WAS_WRITE;
- MemSet(buf,0,cnt);
- while (cnt>0) {
- if (!ATAWaitDRQ(bd,timeout))
- return FALSE;
- if (_avail)
- avail=_avail;
- else
- avail=InU8(bd->base0+ATAR0_HCYL)<<8+InU8(bd->base0+ATAR0_LCYL);
- if (avail) {
- if (avail>cnt) {
- overflow=avail-cnt;
- avail=cnt;
- } else
- overflow=0;
- if (avail&2)
- RepInU16(buf,avail>>1,bd->base0+ATAR0_DATA);
- else
- RepInU32(buf,avail>>2,bd->base0+ATAR0_DATA);
- cnt-=avail;
- buf+=avail;
- while (overflow>0) {
- InU16(bd->base0+ATAR0_DATA);
- overflow-=2;
- if (0<timeout<tS)
- return FALSE;
- }
- if (one_read)
- break;
- } else
- Yield;
- }
- return ATAWaitNotBUSY(bd,timeout);
-}
-
-Bool ATAPIWritePktWord(CBlkDev *bd,F64 timeout,...)
-{
- I64 i;
- for (i=0;i<argc;i++) {
- if (!ATAWaitDRQ(bd,timeout))
- return FALSE;
- OutU16(bd->base0+ATAR0_DATA,EndianU16(argv[i]));
- bd->last_time=tS;
- }
- return TRUE;
-}
-
-Bool ATAPISetMaxSpeed(CBlkDev *bd)
-{
- if (bd->flags & BDF_EXT_SIZE)
- OutU8(bd->base0+ATAR0_SEL,0xEF|bd->unit<<4);
- else
- OutU8(bd->base0+ATAR0_SEL,0xE0|bd->unit<<4);
- OutU8(bd->base0+ATAR0_LCYL,0);
- OutU8(bd->base0+ATAR0_HCYL,0);
- ATACmd(bd,ATA_PACKET);
- ATAPIWritePktWord(bd,0,0xBB00,0xFFFF,0xFFFF,0,0,0);
- return ATAWaitNotBUSY(bd,0);
-}
-
-Bool ATAPISeek(CBlkDev *bd,I64 native_blk)
-{
- if (bd->flags & BDF_EXT_SIZE)
- OutU8(bd->base0+ATAR0_SEL,0xEF|bd->unit<<4);
- else
- OutU8(bd->base0+ATAR0_SEL,0xE0|bd->unit<<4);
- OutU8(bd->base0+ATAR0_LCYL,0);
- OutU8(bd->base0+ATAR0_HCYL,0);
- ATACmd(bd,ATA_PACKET);
- ATAPIWritePktWord(bd,0,0x2B00,native_blk>>16,native_blk,0,0,0);
- return ATAWaitNotBUSY(bd,0);
-}
-
-Bool ATAPIStartStop(CBlkDev *bd,F64 timeout,Bool start)
-{
- I64 i;
- if (start)
- i=0x100;
- else
- i=0;
- if (bd->flags & BDF_EXT_SIZE)
- OutU8(bd->base0+ATAR0_SEL,0xEF|bd->unit<<4);
- else
- OutU8(bd->base0+ATAR0_SEL,0xE0|bd->unit<<4);
- ATACmd(bd,ATA_PACKET);
-//Start/Stop
- if (ATAPIWritePktWord(bd,timeout,0x1B00,0,i,0,0,0))
- return ATAWaitNotBUSY(bd,timeout);
- else
- return FALSE;
-}
-
-I64 ATAGetDevId(CBlkDev *bd,F64 timeout,Bool keep_id_record)
-{
- I64 res=BDT_NULL;
- U16 *id_record=NULL;
- if (bd->type!=BDT_ATAPI && bd->base1)
- OutU8(bd->base1+ATAR1_CTRL,0x8);
- if (bd->flags & BDF_EXT_SIZE)
- OutU8(bd->base0+ATAR0_SEL,0xEF|bd->unit<<4);
- else
- OutU8(bd->base0+ATAR0_SEL,0xE0|bd->unit<<4);
- ATACmd(bd,ATA_ID_DEV);
- if (ATAWaitNotBUSY(bd,timeout)) {
- if (InU8(bd->base0+ATAR0_STAT)&ATAS_ERR)
- res=BDT_ATAPI;
- else {
- id_record=ACAlloc(512);
- if (ATAGetRes(bd,timeout,id_record,512,512,FALSE))
- res=BDT_ATA;
- else {
- Free(id_record);
- id_record=NULL;
- }
- }
- }
- if (keep_id_record) {
- Free(bd->dev_id_record);
- bd->dev_id_record=id_record;
- }
- return res;
-}
-
-I64 ATAReadNativeMax(CBlkDev *bd,F64 timeout)
-{//Returns zero on err
- I64 res=0;
- Bool okay=TRUE;
- if (bd->type==BDT_ATAPI) {
- if (bd->flags & BDF_EXT_SIZE)
- OutU8(bd->base0+ATAR0_SEL,0xEF|bd->unit<<4);
- else
- OutU8(bd->base0+ATAR0_SEL,0xE0|bd->unit<<4);
- ATACmd(bd,ATA_DEV_RST);
- if (!ATAWaitNotBUSY(bd,0))
- okay=FALSE;
- } else {
- while (InU8(bd->base0+ATAR0_STAT) & ATAS_BSY) {
- if (bd->flags&BDF_LAST_WAS_WRITE)
- OutU16(bd->base0+ATAR0_DATA,0);
- else
- InU16(bd->base0+ATAR0_DATA);
- Yield;
- if (0<timeout<tS)
- return FALSE;
- }
- if (ATAGetDevId(bd,timeout,TRUE)==BDT_NULL)
- okay=FALSE;
- else
- BEqu(&bd->flags,BDf_EXT_SIZE,Bt(&bd->dev_id_record[86],10));
- }
- if (okay) {
- if (bd->flags & BDF_EXT_SIZE && bd->base1) {
- OutU8(bd->base1+ATAR1_CTRL,0x8);
- OutU8(bd->base0+ATAR0_SEL,0xEF|bd->unit<<4);
- ATACmd(bd,ATA_READ_NATIVE_MAX_EXT);
- if (ATAWaitNotBUSY(bd,timeout)) {
- res.u8[0]=InU8(bd->base0+ATAR0_SECT);
- res.u8[1]=InU8(bd->base0+ATAR0_LCYL);
- res.u8[2]=InU8(bd->base0+ATAR0_HCYL);
-
- OutU8(bd->base1+ATAR1_CTRL,0x80);
- res.u8[3]=InU8(bd->base0+ATAR0_SECT);
- res.u8[4]=InU8(bd->base0+ATAR0_LCYL);
- res.u8[5]=InU8(bd->base0+ATAR0_HCYL);
-
- if (res>>24==res&0xFFFFFF) {//Kludge to make QEMU work
- bd->flags&=~BDF_EXT_SIZE;
- res&=0xFFFFFF;
- }
- }
- } else {
- if (bd->type!=BDT_ATAPI && bd->base1)
- OutU8(bd->base1+ATAR1_CTRL,0x8);
- OutU8(bd->base0+ATAR0_SEL,0xE0|bd->unit<<4);
- ATACmd(bd,ATA_READ_NATIVE_MAX);
- if (ATAWaitNotBUSY(bd,timeout)) {
- res.u8[0]=InU8(bd->base0+ATAR0_SECT);
- res.u8[1]=InU8(bd->base0+ATAR0_LCYL);
- res.u8[2]=InU8(bd->base0+ATAR0_HCYL);
- res.u8[3]=InU8(bd->base0+ATAR0_SEL) & 0xF;
- }
- }
- }
- return bd->max_blk=res;
-}
-
-I64 ATAPIReadCapacity(CBlkDev *bd,I64 *_blk_size=NULL)
-{//Supposedly this can return a res +/- 75 sects.
-//Error might just be for music.
- Bool unlock=BlkDevLock(bd);
- U32 buf[2];
- if (ATAWaitNotBUSY(bd,0)) {
- if (bd->flags & BDF_EXT_SIZE)
- OutU8(bd->base0+ATAR0_SEL,0xEF|bd->unit<<4);
- else
- OutU8(bd->base0+ATAR0_SEL,0xE0|bd->unit<<4);
- OutU8(bd->base0+ATAR0_LCYL,8);
- OutU8(bd->base0+ATAR0_HCYL,0);
- ATACmd(bd,ATA_PACKET);
- ATAPIWritePktWord(bd,0,0x2500,0,0,0,0,0);
- if (!ATAGetRes(bd,0,buf,8,0,TRUE))
- buf[0]=buf[1]=0;
- } else
- buf[0]=buf[1]=0;
-
- if (unlock) BlkDevUnlock(bd);
- if (_blk_size) *_blk_size=EndianU32(buf[1]);
- return EndianU32(buf[0]);
-}
-
-CATAPITrack *ATAPIReadTrackInfo(CBlkDev *bd,I64 blk)
-{
- CATAPITrack *res=CAlloc(sizeof(CATAPITrack));
- Bool unlock=BlkDevLock(bd);
- if (ATAWaitNotBUSY(bd,0)) {
- if (bd->flags & BDF_EXT_SIZE)
- OutU8(bd->base0+ATAR0_SEL,0xEF|bd->unit<<4);
- else
- OutU8(bd->base0+ATAR0_SEL,0xE0|bd->unit<<4);
- OutU8(bd->base0+ATAR0_LCYL,sizeof(CATAPITrack)&0xFF);
- OutU8(bd->base0+ATAR0_HCYL,sizeof(CATAPITrack)>>8);
- ATACmd(bd,ATA_PACKET);
- ATAPIWritePktWord(bd,0,0x5200,blk.u16[1],blk.u16[0],
- (sizeof(CATAPITrack)&0xFF00)>>8,(sizeof(CATAPITrack)&0x00FF)<<8,0);
- if (!ATAGetRes(bd,0,res,sizeof(CATAPITrack),0,TRUE)) {
- Free(res);
- res=NULL;
- }
- } else {
- Free(res);
- res=NULL;
- }
- if (unlock) BlkDevUnlock(bd);
- return res;
-}
-
-Bool ATAInit(CBlkDev *bd)
-{
- Bool unlock=BlkDevLock(bd),okay=FALSE;
-
- if (bd->type==BDT_ATAPI)
- bd->flags&=~BDF_EXT_SIZE;
- else
- bd->flags|=BDF_EXT_SIZE;
-
- if (ATAReadNativeMax(bd,tS+0.1)) {
- ATABlkSel(bd,bd->max_blk,0);
- if (bd->flags&BDF_EXT_SIZE)
- ATACmd(bd,ATA_SET_MAX_EXT);
- else
- ATACmd(bd,ATA_SET_MAX);
- if (ATAWaitNotBUSY(bd,0)) {
- okay=TRUE;
- if (bd->type==BDT_ATAPI) {
- if (ATAPIStartStop(bd,0,TRUE)) {
- if(!ATAPISetMaxSpeed(bd))
- okay=FALSE;
- } else
- okay=FALSE;
- }
- }
- }
- if (unlock) BlkDevUnlock(bd);
- return okay;
-}
-
-Bool ATAPIWaitReady(CBlkDev *bd,F64 timeout)
-{
- do {
- if (!ATAWaitNotBUSY(bd,timeout) ||
- !ATANop(bd,timeout) ||
- !ATAPIStartStop(bd,timeout,TRUE))
- return FALSE;
- if (InU8(bd->base0+ATAR0_STAT) & ATAS_DRDY &&
- !InU8(bd->base0+ATAR0_FEAT));
- return TRUE;
- ATAInit(bd);
- Yield;
- } while (!(0<timeout<tS));
- return FALSE;
-}
-
-U0 ATAReadBlks(CBlkDev *bd,U8 *buf, I64 blk, I64 cnt)
-{
- I64 retries=3;
- Bool unlock=BlkDevLock(bd);
-
- retry:
- ATABlkSel(bd,blk,cnt);
- if (bd->flags & BDF_EXT_SIZE)
- ATACmd(bd,ATA_READ_MULTI_EXT);
- else
- ATACmd(bd,ATA_READ_MULTI);
- if (!ATAGetRes(bd,tS+1.0,buf,cnt*bd->blk_size,BLK_SIZE,FALSE)) {
- if (retries--) {
- ATAWaitNotBUSY(bd,0);
- goto retry;
- } else
- throw('BlkDev');
- }
-
- blkdev.read_cnt+=(cnt*bd->blk_size)>>BLK_SIZE_BITS;
- if (unlock) BlkDevUnlock(bd);
-}
-
-I64 ATAProbe(I64 base0,I64 base1,I64 unit)
-{
- CBlkDev bd;
- MemSet(&bd,0,sizeof(CBlkDev));
- bd.type=BDT_ATAPI;
- bd.base0=base0;
- bd.base1=base1;
- bd.unit=unit;
- bd.blk_size=DVD_BLK_SIZE;
- return ATAGetDevId(&bd,tS+0.1,FALSE);
-}
-
-Bool ATAPIReadBlks2(CBlkDev *bd,F64 timeout,U8 *buf,
- I64 native_blk, I64 cnt,Bool lock)
-{
- Bool res=FALSE,unlock;
- if (cnt<=0)
- return FALSE;
- if (lock)
- unlock=BlkDevLock(bd);
- if (ATAPIWaitReady(bd,timeout)) {
- if (bd->flags & BDF_EXT_SIZE)
- OutU8(bd->base0+ATAR0_SEL,0xEF|bd->unit<<4);
- else
- OutU8(bd->base0+ATAR0_SEL,0xE0|bd->unit<<4);
- OutU8(bd->base0+ATAR0_LCYL,bd->blk_size);
- OutU8(bd->base0+ATAR0_HCYL,bd->blk_size.u8[1]);
- ATACmd(bd,ATA_PACKET);
- if (ATAPIWritePktWord(bd,timeout,0xA800,
- native_blk.u16[1],native_blk,cnt.u16[1],cnt,0) &&
- ATAGetRes(bd,timeout,buf,cnt*bd->blk_size,0,FALSE)) {
- blkdev.read_cnt+=(cnt*bd->blk_size)>>BLK_SIZE_BITS;
- res=TRUE;
- }
- }
-// ATAPIStartStop(bd,0,FALSE);
- if (lock && unlock) BlkDevUnlock(bd);
- return res;
-}
-
-U0 ATAPIReadBlks(CBlkDev *bd,U8 *buf, I64 blk, I64 cnt)
-{
- CDrv *dv=Let2Drv(bd->first_drv_let);
- I64 retry,spc=bd->blk_size>>BLK_SIZE_BITS,n,blk2,
- l2=bd->max_reads<<1+spc<<1;
- U8 *dvd_buf=MAlloc(l2<<BLK_SIZE_BITS);
- if (cnt>0) {
- if (blk<=bd->max_reads)
- blk2=0;
- else
- blk2=FloorU64(blk-bd->max_reads,spc);
- if (blk2+l2>dv->size+dv->drv_offset)
- l2=dv->size+dv->drv_offset-blk2;
- n=(l2+spc-1)/spc;
-
- retry=4;
- while (--retry)
- if (ATAPIReadBlks2(bd,tS+7.0+0.004*n,dvd_buf,blk2/spc,n,TRUE))
-//n is 0x800 if max_reads. Up to 8 additional seconds
- break;
- if (!retry)
- ATAPIReadBlks2(bd,0,dvd_buf,blk2/spc,n,TRUE);
- if (bd->flags & BDF_READ_CACHE)
- DskCacheAdd(dv,dvd_buf,blk2,n*spc);
- MemCpy(buf,dvd_buf+(blk-blk2)<<BLK_SIZE_BITS,cnt<<BLK_SIZE_BITS);
- }
- Free(dvd_buf);
-}
-
-Bool ATARBlks(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
-{
- I64 n;
- CBlkDev *bd=dv->bd;
- while (cnt>0) {
- n=cnt;
- if (n>bd->max_reads)
- n=bd->max_reads;
- if (bd->type==BDT_ATAPI)
- ATAPIReadBlks(bd,buf,blk,n);
- else
- ATAReadBlks(bd,buf,blk,n);
- buf+=n<<BLK_SIZE_BITS;
- blk+=n;
- cnt-=n;
- }
- return TRUE;
-}
-
-U0 ATAWriteBlks(CBlkDev *bd,U8 *buf, I64 blk, I64 cnt)
-{//For low level disk access.
-//Use BlkWrite() instead.
- I64 i,U32s_avail,sects_avail,retries=3;
- F64 timeout;
- Bool unlock=BlkDevLock(bd);
-retry:
- ATABlkSel(bd,blk,cnt);
- if (bd->flags&BDF_EXT_SIZE)
- ATACmd(bd,ATA_WRITE_MULTI_EXT);
- else
- ATACmd(bd,ATA_WRITE_MULTI);
- bd->flags|=BDF_LAST_WAS_WRITE;
- while (cnt>0) {
- timeout=tS+1.0;
- while (TRUE) {
- i=InU8(bd->base0+ATAR0_STAT);
- if (!(i & ATAS_DRDY)||!(i & ATAS_DRQ)) {
- Yield;
- } else
- break;
- if (/* i&ATAS_ERR||*/ tS>timeout) {
- if (retries--) {
- ATAWaitNotBUSY(bd,0);
- goto retry;
- } else
- throw('BlkDev');
- }
- }
- sects_avail=1;
- U32s_avail=sects_avail<<BLK_SIZE_BITS>>2;
- RepOutU32(buf,U32s_avail,bd->base0+ATAR0_DATA);
- buf+=U32s_avail<<2;
- cnt-=sects_avail;
- retries=3;
- }
- ATAWaitNotBUSY(bd,0);
- if (unlock) BlkDevUnlock(bd);
-}
-
-Bool ATAPISync(CBlkDev *bd)
-{
- Bool okay=TRUE;
- if (!ATAWaitNotBUSY(bd,0))
- okay=FALSE;
- else {
- if (bd->flags & BDF_EXT_SIZE)
- OutU8(bd->base0+ATAR0_SEL,0xEF|bd->unit<<4);
- else
- OutU8(bd->base0+ATAR0_SEL,0xE0|bd->unit<<4);
- OutU8(bd->base0+ATAR0_LCYL,0);
- OutU8(bd->base0+ATAR0_HCYL,0);
- ATACmd(bd,ATA_PACKET);
- ATAPIWritePktWord(bd,0,0x3500,0,0,0,0,0);
- if (!ATAWaitNotBUSY(bd,0))
- okay=FALSE;
- }
- return okay;
-}
-
-U0 ATAPIClose(CBlkDev *bd,I64 close_field=0x200,I64 track=0)
-{//0x200 CD/DVD part 1
-// 0x300 DVD part 2
- if (bd->flags & BDF_EXT_SIZE)
- OutU8(bd->base0+ATAR0_SEL,0xEF|bd->unit<<4);
- else
- OutU8(bd->base0+ATAR0_SEL,0xE0|bd->unit<<4);
- OutU8(bd->base0+ATAR0_LCYL,0);
- OutU8(bd->base0+ATAR0_HCYL,0);
- ATACmd(bd,ATA_PACKET);
- ATAPIWritePktWord(bd,0,0x5B00,close_field,track,0,0,0);
- ATAWaitNotBUSY(bd,0);
-}
-
-U0 ATAPIWriteBlks(CBlkDev *bd,U8 *buf, I64 native_blk, I64 cnt)
-{
- I64 U32s_avail;
- U8 *buf2;
- ATAWaitNotBUSY(bd,0);
- ATAPISeek(bd,native_blk);
-
- OutU8(bd->base0+ATAR0_FEAT,0);
- OutU8(bd->base0+ATAR0_LCYL,bd->blk_size);
- OutU8(bd->base0+ATAR0_HCYL,bd->blk_size.u8[1]);
- if (bd->flags & BDF_EXT_SIZE)
- OutU8(bd->base0+ATAR0_SEL,0xEF|bd->unit<<4);
- else
- OutU8(bd->base0+ATAR0_SEL,0xE0|bd->unit<<4);
- OutU8(bd->base0+ATAR0_CMD,ATA_PACKET);
- ATAPIWritePktWord(bd,0,0x0400,native_blk.u16[1],native_blk,cnt.u16[1],cnt,0);
- bd->flags|=BDF_LAST_WAS_WRITE;
- ATAWaitNotBUSY(bd,0);
-
- ATAPISeek(bd,native_blk);
-
- if (bd->flags & BDF_EXT_SIZE)
- OutU8(bd->base0+ATAR0_SEL,0xEF|bd->unit<<4);
- else
- OutU8(bd->base0+ATAR0_SEL,0xE0|bd->unit<<4);
- OutU8(bd->base0+ATAR0_LCYL,bd->blk_size);
- OutU8(bd->base0+ATAR0_HCYL,bd->blk_size.u8[1]);
- ATACmd(bd,ATA_PACKET);
- ATAPIWritePktWord(bd,0,0xAA00,native_blk.u16[1],native_blk,cnt.u16[1],cnt,0);
- buf2=buf+bd->blk_size*cnt;
- while (buf<buf2) {
- ATAWaitDRQ(bd,0);
- U32s_avail=(InU8(bd->base0+ATAR0_HCYL)<<8+InU8(bd->base0+ATAR0_LCYL))>>2;
- if (buf+U32s_avail<<2>buf2)
- U32s_avail=(buf2-buf)>>2;
- if (U32s_avail) {
- RepOutU32(buf,U32s_avail,bd->base0+ATAR0_DATA);
- buf+=U32s_avail<<2;
- blkdev.write_cnt+=U32s_avail>>(BLK_SIZE_BITS-2);
- }
- }
- ATAWaitNotBUSY(bd,0);
-}
-
-Bool ATAWBlks(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
-{
- I64 n,spc;
- CBlkDev *bd=dv->bd;
- Bool unlock;
- spc=bd->blk_size>>BLK_SIZE_BITS;
- if (bd->type==BDT_ATAPI) {
- unlock=BlkDevLock(bd);
- ATAPIWaitReady(bd,0);
- }
- while (cnt>0) {
- n=cnt;
- if (n>bd->max_writes)
- n=bd->max_writes;
- if (bd->type==BDT_ATAPI)
- ATAPIWriteBlks(bd,buf,blk/spc,(n+spc-1)/spc);
- else
- ATAWriteBlks(bd,buf,blk,n);
- buf+=n<<BLK_SIZE_BITS;
- blk+=n;
- cnt-=n;
- blkdev.write_cnt+=n;
- }
- if (bd->type==BDT_ATAPI) {
- ATAPISync(bd);
-// ATAPIStartStop(bd,0,FALSE);
- if (unlock) BlkDevUnlock(bd);
- }
- return TRUE;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/BlkDev/DskATAId.HC.HTML b/public/src/Kernel/BlkDev/DskATAId.HC.HTML deleted file mode 100644 index 698c2fb..0000000 --- a/public/src/Kernel/BlkDev/DskATAId.HC.HTML +++ /dev/null @@ -1,305 +0,0 @@ - - - - - DskATAId.HC - - - - - Bool BootDVDProbe(CBlkDev *bd)
-{
- U8 *img=CAlloc(DVD_BLK_SIZE);
- I64 i;
- Bool res=FALSE;
- "Port:%04X,%04XUnit:%02X",bd->base0,bd->base1,bd->unit;
- if (ATAProbe(bd->base0,bd->base1,bd->unit)==BDT_ATAPI) {
- "ATAPI";
- if (ATAPIStartStop(bd,tS+5.0,TRUE)) {
- "Started";
- for (i=0;i<2;i++) {//Retry
- if (ATAPIReadBlks2(bd,tS+7.0,img,sys_boot_blk,1,FALSE)) {
- if ((img+sys_boot_src.u16[1]<<BLK_SIZE_BITS)(CKernel *)
- ->compile_time==sys_compile_time) {
- "Found\n";
- return TRUE;
- } else
- "Read";
- } else
- "NoRead";
- }
- }
- }
- "Nope\n";
- Free(img);
- return res;
-}
-
-Bool BootDVDProbeAll(CBlkDev *bd)
-{
- I64 d1,d2,i,j,k;
-
- bd->base1=0;
- for (k=0;k<256;k++) {
- i=-1;
- while (TRUE) {
- j=PCIClassFind(0x010100+k,++i);
- if (j<0)
- break;
- "Subcode:0x%X Bus:0x%X Dev:0x%X Fun:0x%X\n",k,j.u8[2],j.u8[1],j.u8[0];
- d1=PCIReadU32(j.u8[2],j.u8[1],j.u8[0],0x10);
- d2=PCIReadU32(j.u8[2],j.u8[1],j.u8[0],0x14);
- if (d1&1 && d2&1) {
- if (bd->base0=d1&~7) {
- bd->unit=0;
- if (BootDVDProbe(bd))
- return TRUE;
- bd->unit=1;
- if (BootDVDProbe(bd))
- return TRUE;
- }
- }
- d1=PCIReadU32(j.u8[2],j.u8[1],j.u8[0],0x18);
- d2=PCIReadU32(j.u8[2],j.u8[1],j.u8[0],0x1C);
- if (d1&1 && d2&1) {
- if (bd->base0=d1&~7) {
- bd->unit=0;
- if (BootDVDProbe(bd))
- return TRUE;
- bd->unit=1;
- if (BootDVDProbe(bd))
- return TRUE;
- }
- }
- }
- }
-
- d1=0x1F0;
- d2=0x3F6;
- if (bd->base0=d1&~7) {
- bd->unit=0;
- if (BootDVDProbe(bd))
- return TRUE;
- bd->unit=1;
- if (BootDVDProbe(bd))
- return TRUE;
- }
-
- d1=0x170;
- d2=0x376;
- if (bd->base0=d1&~7) {
- bd->unit=0;
- if (BootDVDProbe(bd))
- return TRUE;
- bd->unit=1;
- if (BootDVDProbe(bd))
- return TRUE;
- }
-}
-
-U0 ATARepEntry(I64 base0,I64 base1,I64 unit,U8 *msg,
- CATARep **_head,I64 *num_hints)
-{
- I64 type;
- base0&=-8;
- base1&=-4;
- CATARep *tmpha;
- if (type=ATAProbe(base0,base1,unit)) {
- *num_hints+=1;
- "\n$PURPLE$$BT+X,\"%d\",LM=\"%d\\n\"$$FG$$LM,4$",*num_hints,*num_hints;
- if (type==BDT_ATA)
- "$RED$HardDrive$LTBLUE$ATA";
- else
- "$RED$CD/DVDDrive$LTBLUE$ATAPI";
- "%s$FG$\n",msg;
- if (base0==blkdev.ins_base0 && unit==blkdev.ins_unit)
- "$PURPLE$(Drive originally installed from.)$FG$\n";
- "Base0:0x%04XBase1:0x%04XUnit:%d$LM,0$\n",
- base0,base1,unit;
- if (_head) {
- tmpha=CAlloc(sizeof(CATARep));
- tmpha->next=*_head;
- *_head=tmpha;
- tmpha->num=*num_hints;
- tmpha->type=type;
- tmpha->base0=base0;
- tmpha->base1=base1;
- tmpha->unit=unit;
- }
- }
-}
-
-Bool ATARepExitAllApplications()
-{
- "\nWe're going to probe hardware.\n"
- "$RED$Exit all other applications.$FG$\n"
- "Press '$PURPLE$p$FG$' to probe or '$PURPLE$s$FG$' to skip.\n";
- if (ToUpper(GetChar(,FALSE))=='S')
- return TRUE;
- else
- return FALSE;
-}
-
-public I64 ATARep(Bool pmt=TRUE,Bool just_ide=FALSE,CATARep **_head=NULL)
-{//Report possible ATA devices by probing. Hard disks and CD/DVDs.
- I64 d1,d2,i,j,k,cnt=0,unlock_flags=0,num_hints=0;
-#assert BLKDEVS_NUM<=64
- if (_head) *_head=NULL;
-
- if (pmt && ATARepExitAllApplications)
- return 0;
-
- for (i=0;i<BLKDEVS_NUM;i++)
- if (blkdev.blkdevs[i].bd_signature==BD_SIGNATURE_VAL)
- BEqu(&unlock_flags,i,
- BlkDevLock(&blkdev.blkdevs[i]));
-
- if (!just_ide)
- for (k=0;k<256;k++) {
- i=-1;
- while (TRUE) {
- j=PCIClassFind(0x010100+k,++i);
- if (j<0)
- break;
-
- "\nSubcode:0x%X Bus:0x%X Dev:0x%X Fun:0x%X\n",k,j.u8[2],j.u8[1],j.u8[0];
- cnt++;
-
- d1=PCIReadU32(j.u8[2],j.u8[1],j.u8[0],0x10);
- d2=PCIReadU32(j.u8[2],j.u8[1],j.u8[0],0x14);
- if (d1&1 && d2&1) {
- ATARepEntry(d1,d2,0,"Primary IDE",_head,&num_hints);
- ATARepEntry(d1,d2,1,"Primary IDE",_head,&num_hints);
- } else {
- d1=0x1F0; d2=0x3F6;
- ATARepEntry(d1,d2,0,"Primary IDE",_head,&num_hints);
- ATARepEntry(d1,d2,1,"Primary IDE",_head,&num_hints);
- }
- d1=PCIReadU32(j.u8[2],j.u8[1],j.u8[0],0x18);
- d2=PCIReadU32(j.u8[2],j.u8[1],j.u8[0],0x1C);
- if (d1&1 && d2&1) {
- ATARepEntry(d1,d2,0,"Secondary IDE",_head,&num_hints);
- ATARepEntry(d1,d2,1,"Secondary IDE",_head,&num_hints);
- } else {
- d1=0x170; d2=0x376;
- ATARepEntry(d1,d2,0,"Secondary IDE",_head,&num_hints);
- ATARepEntry(d1,d2,1,"Secondary IDE",_head,&num_hints);
- }
- }
- }
- if (!cnt) {
- d1=0x1F0; d2=0x3F6;
- ATARepEntry(d1,d2,0,"Primary IDE",_head,&num_hints);
- ATARepEntry(d1,d2,1,"Primary IDE",_head,&num_hints);
-
- d1=0x170; d2=0x376;
- ATARepEntry(d1,d2,0,"Secondary IDE",_head,&num_hints);
- ATARepEntry(d1,d2,1,"Secondary IDE",_head,&num_hints);
- }
- '\n\n';
- for (i=0;i<BLKDEVS_NUM;i++)
- if (Bt(&unlock_flags,i))
- BlkDevUnlock(&blkdev.blkdevs[i]);
- return num_hints;
-}
-
-CATARep *ATARepFind(CATARep *haystack_head,I64 needle_num)
-{
- while (haystack_head) {
- if (haystack_head->num==needle_num)
- return haystack_head;
- haystack_head=haystack_head->next;
- }
- return NULL;
-}
-
-CATARep *ATAIDDrvs(CATARep *head,CATARep **_ata_drv,CATARep **_atapi_drv)
-{//This is for when trying to sort-out main hard drives and CD/DVD drives.
- CATARep *res=NULL,*tmpha=head,*ata_drv=NULL,*atapi_drv=NULL;
- CBlkDev *bd;
- Bool was_silent=Silent,ins_found=FALSE;
- bd=Let2BlkDev(':',FALSE);
- Silent(was_silent);
- while (tmpha) {
- if (!res && bd && bd->type==tmpha->type) {
- if (bd->type==BDT_ATAPI &&
- bd->base0==tmpha->base0 && bd->unit==tmpha->unit)
- res=atapi_drv=tmpha;
- else if (bd->type==BDT_ATA && bd->base0==tmpha->base0 &&
- bd->base1==tmpha->base1 && bd->unit==tmpha->unit)
- res=ata_drv=tmpha;
- }
- if (!res || res->type!=tmpha->type) {
- if (tmpha->type==BDT_ATA) {
- if (!ata_drv || tmpha->unit<ata_drv->unit ||
- tmpha->unit==ata_drv->unit && tmpha->num<ata_drv->num)
- ata_drv=tmpha;
- } else if (tmpha->type==BDT_ATAPI) {
- if (!atapi_drv || !ins_found && (tmpha->unit<atapi_drv->unit ||
- tmpha->unit==atapi_drv->unit && tmpha->num<atapi_drv->num))
- atapi_drv=tmpha;
- }
- }
- if (tmpha->type==BDT_ATAPI && bd && bd->type==BDT_ATA &&
- tmpha->base0==blkdev.ins_base0 && tmpha->unit==blkdev.ins_unit) {
- if (!ins_found) {
- atapi_drv=tmpha;
- ins_found=TRUE;
- }
- }
- tmpha=tmpha->next;
- }
- if (_ata_drv) *_ata_drv =ata_drv;
- if (_atapi_drv) *_atapi_drv=atapi_drv;
- return res;
-}
-
-CBlkDev *ATAMount(U8 first_drv_let,I64 type,I64 base0,I64 base1,I64 unit)
-{
- CBlkDev *res;
- if (0<=first_drv_let-'A'<DRVS_NUM && (type==BDT_ATA || type==BDT_ATAPI) &&
- 0<=unit<=1) {
- res=BlkDevNextFreeSlot(first_drv_let,type);
- res->unit=unit;
- res->base0=base0;
- res->base1=base1;
- if (BlkDevAdd(res,,FALSE,FALSE))
- return res;
- }
- return NULL;
-}
-
-I64 MountIDEAuto()
-{//Try to mount hard drive and CD/DVD, automatically. (Kernel.Cfg option).
-//It uses 'C' and 'T' as first drive letters or whatever you set
- //in config when compiling Kernel.BIN.
- I64 res=0;
- CATARep *head=NULL,*ata_drv=NULL,*atapi_drv=NULL,*tmpha;
- ATARep(FALSE,TRUE,&head);
- ATAIDDrvs(head,&ata_drv,&atapi_drv);
- if (ata_drv && ATAMount(blkdev.first_hd_drv_let,BDT_ATA,
- ata_drv->base0,ata_drv->base1,ata_drv->unit))
- res++;
- if (atapi_drv && ATAMount(blkdev.first_dvd_drv_let,BDT_ATAPI,
- atapi_drv->base0,atapi_drv->base1,atapi_drv->unit))
- res++;
- tmpha=head;
- while (tmpha) {
- if (tmpha!=ata_drv && tmpha!=atapi_drv) {
- if (tmpha->type==BDT_ATA && ATAMount(blkdev.first_hd_drv_let,BDT_ATA,
- tmpha->base0,tmpha->base1,tmpha->unit))
- res++;
- else if (tmpha->type==BDT_ATAPI &&
- ATAMount(blkdev.first_dvd_drv_let,BDT_ATAPI,
- tmpha->base0,tmpha->base1,tmpha->unit))
- res++;
- }
- tmpha=tmpha->next;
- }
- LinkedLstDel(head);
- blkdev.mount_ide_auto_cnt=res;
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/BlkDev/DskAddDev.HC.HTML b/public/src/Kernel/BlkDev/DskAddDev.HC.HTML deleted file mode 100644 index 6c91d24..0000000 --- a/public/src/Kernel/BlkDev/DskAddDev.HC.HTML +++ /dev/null @@ -1,252 +0,0 @@ - - - - - DskAddDev.HC - - - - - U0 BlkDevLockFwdingSet(CBlkDev *bd)
-{ //If two blkdevs on same controller, use just one lock
- CBlkDev *bd1;
- I64 i;
- switch (bd->type) {
- case BDT_RAM:
- break;
- case BDT_ISO_FILE_READ:
- case BDT_ISO_FILE_WRITE:
- bd->lock_fwding=Let2BlkDev(*bd->file_dsk_name);
- break;
- case BDT_ATA:
- case BDT_ATAPI:
- for (i=0;i<BLKDEVS_NUM;i++) {
- bd1=&blkdev.blkdevs[i];
- if (bd1->bd_signature==BD_SIGNATURE_VAL && bd!=bd1 &&
- (bd1->type==BDT_ATAPI || bd1->type==BDT_ATA) &&
- bd1->base0==bd->base0) {
- bd->lock_fwding=bd1;
- break;
- }
- }
- break;
- }
-}
-
-I64 BlkDevAdd(CBlkDev *bd,I64 prt_num=I64_MIN,
- Bool whole_drv,Bool make_free)
-{//It will mount just one partition of prt_num>=0.
-//When repartitioing whole drive, whole_drv=TRUE.
- I64 i,j,ext_base,offset,res=0,num=0;
- CDrv *dv;
- CRedSeaBoot br;
- CMasterBoot mbr;
-
- bd->bd_signature=BD_SIGNATURE_VAL;
- if (make_free)
- dv=DrvMakeFreeSlot(bd->first_drv_let);
- else
- dv=DrvMakeFreeSlot(DrvNextFreeLet(bd->first_drv_let));
- dv->bd=bd;
- dv->drv_offset=bd->drv_offset;
- dv->size=bd->max_blk+1-bd->drv_offset;
- switch (bd->type) {
- case BDT_RAM:
- case BDT_ISO_FILE_READ:
- case BDT_ISO_FILE_WRITE:
- dv->dv_signature=DRV_SIGNATURE_VAL;
- dv->prt_num=num;
- dv->fs_type=FSt_REDSEA;
-//This is to force creation of a RAM
- //drive during boot, so it is probably
- //MAlloced to the same addr and can
- //be assumed to be already formatted.
- //If this line is removed, RAM Drives
- //will be alloced on a just-in-time
- //basis.
- if (BlkDevInit(bd))
- res++;
- else
- dv->dv_signature=0;
- break;
- case BDT_ATA:
- dv->dv_signature=DRV_SIGNATURE_VAL; //Temporarily validate
- if (!BlkDevInit(bd))
- dv->dv_signature=0; //Revoke validation
- else {
- dv->dv_signature=0; //Revoke validation
- if (whole_drv) {
- dv->dv_signature=DRV_SIGNATURE_VAL;
- dv->prt_num=num;
- res++;
- dv->fs_type=FSt_REDSEA;
- dv->size=bd->max_blk+1-bd->drv_offset;
-//The following read is a test read.
- //if it hangs, the drive is not supported.
- ATAReadBlks(bd,&mbr,0,1);
- break;
- }
- offset=0;
- ext_base=INVALID_CLUS;
- while (prt_num<0 || num<=prt_num) {
- ATAReadBlks(bd,&mbr,offset,1);
- if (mbr.signature!=0xAA55)
- break;
- j=-1;
- for (i=0;i<4 && (prt_num<0 || num<=prt_num);i++) {
- if (mbr.p[i].type) {
- if (make_free)
- dv=DrvMakeFreeSlot(bd->first_drv_let+res);
- else
- dv=DrvMakeFreeSlot(DrvNextFreeLet(bd->first_drv_let+res));
- dv->bd=bd;
- dv->drv_offset=mbr.p[i].offset+offset;
- dv->size =mbr.p[i].size;
- switch (mbr.p[i].type) {
- case MBR_PT_REDSEA:
- dv->dv_signature=DRV_SIGNATURE_VAL;
- dv->prt_num=num;
- res++;
- dv->fs_type=FSt_REDSEA;
- RedSeaInit(dv);
- break;
- case MBR_PT_FAT32a:
- case MBR_PT_FAT32b:
- case MBR_PT_FAT32c:
- case MBR_PT_FAT32d:
- case MBR_PT_FAT32e:
- case MBR_PT_FAT32f:
- ATAReadBlks(bd,&br,dv->drv_offset,1);
- dv->dv_signature=DRV_SIGNATURE_VAL;
- dv->prt_num=num;
- res++;
- if (br.signature==MBR_PT_REDSEA) {
- dv->fs_type=FSt_REDSEA;
- RedSeaInit(dv);
- } else {
- dv->fs_type=FSt_FAT32;
- FAT32Init(dv);
- }
- break;
- case MBR_PT_NTFS:
- dv->dv_signature=DRV_SIGNATURE_VAL;
- dv->prt_num=num;
- res++;
- dv->fs_type=FSt_NTFS;
- break;
- case 5:
- case 15:
- j=i;
- break;
- default:
- dv->dv_signature=DRV_SIGNATURE_VAL;
- dv->prt_num=num;
- res++;
- dv->fs_type=FSt_UNKNOWN;
- }
- num++;
- }
- }
- if (Let2BlkDevType(bd->first_drv_let+res)!=bd->type)
- break;
- if (j<0)
- break;
- if (!mbr.p[j].offset)
- break;
- if (ext_base==INVALID_CLUS) {
- offset=mbr.p[j].offset;
- ext_base=offset;
- } else
- offset=mbr.p[j].offset+ext_base;
- }
- }
- break;
- case BDT_ATAPI:
- dv->dv_signature=DRV_SIGNATURE_VAL;
- dv->prt_num=num;
- res++;
- dv->fs_type=FSt_ISO9660; //Start with this
- dv->size=0;
- break;
- }
- if (res)
- BlkDevLockFwdingSet(bd);
- else
- BlkDevDel(bd);
- return res;
-}
-
-Bool DrvEnable(U8 drv_let,Bool val)
-{//Can unmount or remount, but not mount the first time.
- CDrv *dv;
- if (dv=Let2Drv(drv_let,FALSE))
- return !LBEqu(&dv->fs_type,FStf_DISABLE,!val);
- else
- return FALSE;
-}
-
-I64 SysGetI64()
-{
- U8 st[STR_LEN];
- GetS(st,STR_LEN,FALSE);
- return Str2I64(st,16);
-}
-
-Bool GetBaseUnit(CBlkDev *bd)
-{
- I64 ch;
- Bool probe;
- #exe {
- if (kernel_cfg->opts[CFG_DONT_PROBE])
- StreamPrint("probe=FALSE;");
- else
- StreamPrint("probe=TRUE;");
- };
- if (!probe || !BootDVDProbeAll(bd)) {
- "\nDon't worry. This is not a product\n"
- "registration. TempleOS just needs the\n"
- "I/O port numbers for the CD/DVD.\n"
- "\nRetry the ports above or check Windows\n"
- "system information under I/O ports for\n"
- "'IDE', 'ATA' or 'SATA'.\n"
- "In Linux, use 'lspci -v' for ports.\n"
- "\n\nEnter 4-digit hex I/O Port number.\n"
- "CD/DVD I/O Port Base0: 0x";
- bd->base0=SysGetI64;
- bd->base1=0;
- bd->unit =0;
- if (bd->base0) {
- "\nUnit (0 or 1): ";
- do ch=GetChar(,FALSE);
- while (!('0'<=ch<='1'));
- '' ch;
- bd->unit=ch-'0';
- blkdev.dvd_boot_is_good=BootDVDProbe(bd);
- return TRUE;
- } else {
- blkdev.dvd_boot_is_good=FALSE;
- return FALSE;
- }
- }
- return FALSE;
-}
-
-U0 BlkDevsInitAll()
-{
- CBlkDev *bd;
- I64 i;
- blkdev.blkdevs=CAlloc(sizeof(CBlkDev)*BLKDEVS_NUM);
- blkdev.drvs=CAlloc(sizeof(CDrv)*DRVS_NUM);
- for (i=0;i<DRVS_NUM;i++)
- blkdev.let_to_drv[i]=&blkdev.drvs[i];
- #exe {
- if (kernel_cfg->opts[CFG_MOUNT_IDE_AUTO])
- StreamPrint("MountIDEAuto;");
- StreamPrint("#exe {Option(OPTf_WARN_PAREN,OFF);}");
- StreamDoc(kernel_cfg->add_dev);
- StreamPrint("#exe {Option(OPTf_WARN_PAREN,ON);}");
- };
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/BlkDev/DskBlk.HC.HTML b/public/src/Kernel/BlkDev/DskBlk.HC.HTML deleted file mode 100644 index d6c2cb4..0000000 --- a/public/src/Kernel/BlkDev/DskBlk.HC.HTML +++ /dev/null @@ -1,121 +0,0 @@ - - - - - DskBlk.HC - - - - - #define ZERO_BUF_SIZE 2048
-U0 BlkWriteZero(CDrv *dv,I64 blk,I64 cnt)
-{//Fill blk cnt with zeros in Drv.
- I64 n;
- U8 *z=CAlloc(ZERO_BUF_SIZE<<BLK_SIZE_BITS);
- Bool show_progress;
- if (cnt>ZERO_BUF_SIZE && dv->bd->type!=BDT_RAM) {
- progress1=0; progress1_max=cnt;
- StrCpy(progress1_desc,"Zeroing");
- show_progress=TRUE;
- } else
- show_progress=FALSE;
- while (cnt>0) {
- n=cnt;
- if (n>ZERO_BUF_SIZE)
- n=ZERO_BUF_SIZE;
- BlkWrite(dv,z,blk,n);
- blk+=n;
- cnt-=n;
- if (show_progress)
- progress1+=n;
- Yield; //Prevent locking
- }
- Free(z);
- if (show_progress) {
- *progress1_desc=0;
- progress1=progress1_max=0;
- }
-}
-
-Bool BlkRead(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
-{//Read blk cnt from Drv to buf.
- Bool res=TRUE,unlock;
- CBlkDev *bd=dv->bd;
- if (cnt<=0) return TRUE;
- DrvChk(dv);
- try {
- unlock=DrvLock(dv);
- BlkDevInit(bd);
- if (dv->drv_offset && blk<dv->drv_offset ||
- blk+cnt>dv->drv_offset+dv->size)
- throw('Drv');
- if (bd->flags & BDF_READ_CACHE)
- RCache(dv,&buf,&blk,&cnt);
- if (cnt>0) {
- switch (bd->type) {
- case BDT_RAM:
- MemCpy(buf,bd->RAM_dsk+blk<<BLK_SIZE_BITS,cnt<<BLK_SIZE_BITS);
- break;
- case BDT_ISO_FILE_READ:
- case BDT_ISO_FILE_WRITE:
- FBlkRead(bd->file_dsk,buf,blk,cnt);
- break;
- case BDT_ATA:
- case BDT_ATAPI:
- res=ATARBlks(dv,buf,blk,cnt);
- break;
- }
- bd->last_time=tS;
- if (bd->flags & BDF_READ_CACHE)
- DskCacheAdd(dv,buf,blk,cnt);
- }
- if (unlock)
- DrvUnlock(dv);
- } catch
- if (unlock)
- DrvUnlock(dv);
- return res;
-}
-
-Bool BlkWrite(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
-{//Write blk cnt from buf to Drv.
- Bool res=TRUE,unlock;
- CBlkDev *bd=dv->bd;
- if (cnt<=0) return TRUE;
- DrvChk(dv);
- try {
- unlock=DrvLock(dv);
- BlkDevInit(bd);
- if (bd->flags&BDF_READ_ONLY && !(bd->flags & BDF_READ_ONLY_OVERRIDE))
- throw('BlkDev');
- if (dv->drv_offset && blk<dv->drv_offset ||
- blk+cnt>dv->drv_offset+dv->size)
- throw('Drv');
- if (cnt>0) {
- switch (bd->type) {
- case BDT_RAM:
- MemCpy(bd->RAM_dsk+blk<<BLK_SIZE_BITS,buf,cnt<<BLK_SIZE_BITS);
- break;
- case BDT_ISO_FILE_READ:
- case BDT_ISO_FILE_WRITE:
- FBlkWrite(bd->file_dsk,buf,blk,cnt);
- break;
- case BDT_ATA:
- case BDT_ATAPI:
- res=ATAWBlks(dv,buf,blk,cnt);
- break;
- }
- bd->last_time=tS;
- if (bd->flags & BDF_READ_CACHE)
- DskCacheAdd(dv,buf,blk,cnt);
- }
- if (unlock)
- DrvUnlock(dv);
- } catch
- if (unlock)
- DrvUnlock(dv);
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/BlkDev/DskBlkDev.HC.HTML b/public/src/Kernel/BlkDev/DskBlkDev.HC.HTML deleted file mode 100644 index 83919ab..0000000 --- a/public/src/Kernel/BlkDev/DskBlkDev.HC.HTML +++ /dev/null @@ -1,199 +0,0 @@ - - - - - DskBlkDev.HC - - - - - Bool BlkDevLock(CBlkDev *bd)
-{//Make this task have exclusive access to BlkDev.
- BlkDevChk(bd);
- while (bd->lock_fwding)
- bd=bd->lock_fwding; //If two blkdevs on same controller, use just one lock
- if (!Bt(&bd->locked_flags,BDlf_LOCKED) || bd->owning_task!=Fs) {
- while (LBts(&bd->locked_flags,BDlf_LOCKED))
- Yield;
- bd->owning_task=Fs;
- return TRUE;
- } else
- return FALSE;
-}
-
-Bool BlkDevUnlock(CBlkDev *bd,Bool rst=FALSE)
-{//Release exclusive lock on access to BlkDev.
- BlkDevChk(bd);
- while (bd->lock_fwding)
- bd=bd->lock_fwding; //If two blkdevs on same controller, use just one lock
- if (Bt(&bd->locked_flags,BDlf_LOCKED) && bd->owning_task==Fs) {
- if (rst)
- bd->flags&=~(BDF_INITIALIZED|BDF_INIT_IN_PROGRESS);
- bd->owning_task=NULL;
- LBtr(&bd->locked_flags,BDlf_LOCKED);
- Yield; //Prevent deadlock
- return TRUE;
- } else
- return FALSE;
-}
-
-Bool BlkDevInit(CBlkDev *bd)
-{
- CDirEntry de;
- U8 buf[STR_LEN];
- CDrv *dv=Let2Drv(bd->first_drv_let);
- Bool res=FALSE;
- if (!LBts(&bd->flags,BDf_INITIALIZED)) {
- bd->flags|=BDF_INIT_IN_PROGRESS;
- switch (bd->type) {
- case BDT_RAM:
- if (!bd->RAM_dsk) {
- bd->RAM_dsk=AMAlloc((bd->max_blk+1)<<BLK_SIZE_BITS);
- bd->max_blk=MSize(bd->RAM_dsk)>>BLK_SIZE_BITS-1;
- }
- dv->fs_type=FSt_REDSEA;
- dv->size=bd->max_blk+1-bd->drv_offset;
- if (RedSeaValidate(bd->first_drv_let))
- RedSeaInit(dv);
- else
- RedSeaFmt(bd->first_drv_let);
- res=TRUE;
- break;
- case BDT_ISO_FILE_READ:
- if (FileFind(bd->file_dsk_name,&de,FUF_JUST_FILES)) {
- bd->max_blk=de.size>>BLK_SIZE_BITS-1;
- try bd->file_dsk=FOpen(bd->file_dsk_name,"rc",bd->max_blk+1);
- catch {
- if (Fs->except_ch=='File')
- PrintErr("Not Contiguous.Move file to filename.ISO.C.\n");
- Fs->catch_except=TRUE;
- }
- if (bd->file_dsk) {
- dv->fs_type=FSt_REDSEA;
- dv->size=bd->max_blk+1-bd->drv_offset;
- if (RedSeaValidate(bd->first_drv_let)) {
- RedSeaInit(dv);
- res=TRUE;
- } else
- PrintErr("Not RedSea\n");
- }
- }
- break;
- case BDT_ISO_FILE_WRITE:
- if (!bd->file_dsk_name) {
- StrPrint(buf,"%C:/Drv%C.ISO.C",
- blkdev.boot_drv_let,bd->first_drv_let);
- bd->file_dsk_name=AStrNew(buf);
- }
- if (bd->max_blk<7)
- bd->max_blk=7;
- bd->file_dsk=FOpen(bd->file_dsk_name,"wc",bd->max_blk+1);
- dv->fs_type=FSt_REDSEA;
- dv->size=bd->max_blk+1-bd->drv_offset;
- RedSeaFmt(bd->first_drv_let);
- CallExtStr("RedSeaISO9660",bd->file_dsk_name,bd->first_drv_let);
- res=TRUE;
- break;
- case BDT_ATA:
- bd->max_reads=128;
- bd->max_writes=1;
- res=ATAInit(bd);
- break;
- case BDT_ATAPI:
-//0xFFFF*4 is too big for my taste
- bd->max_reads=0x800*4;
-//max of maybe a quarter of disk cache
- if (bd->max_reads>blkdev.cache_size/BLK_SIZE/4)
- bd->max_reads=blkdev.cache_size/BLK_SIZE/4 & ~3;
- if (bd->max_reads<128)
- bd->max_reads=128;
- bd->max_writes=0xFFFF*4;
- if (res=ATAInit(bd))
- dv->size=bd->max_blk+1;
- break;
- }
- if (res && bd->flags & BDF_READ_CACHE)
- DskCacheInvalidate(dv);
- bd->flags&=~BDF_INIT_IN_PROGRESS;
- } else
- res=TRUE;
- return res;
-}
-
-U0 BlkDevsRelease()
-{//When task dies, release all owned BlkDevs.
- I64 i;
- CBlkDev *bd;
- for (i=0;i<BLKDEVS_NUM;i++) {
- bd=&blkdev.blkdevs[i];
- if (bd->owning_task==Fs && bd->bd_signature==BD_SIGNATURE_VAL)
- BlkDevUnlock(bd,TRUE);
- }
-}
-
-CBlkDev *BlkDevNextFreeSlot(U8 first_drv_let,I64 type)
-{//Locate free slot for new BlkDev, like during Mount().
- I64 i=0;
- CBlkDev *res;
- if (Let2BlkDevType(first_drv_let)!=type)
- throw('BlkDev');
- do {
- res=&blkdev.blkdevs[i];
- if (res->bd_signature!=BD_SIGNATURE_VAL) {
- MemSet(res,0,sizeof(CBlkDev));
- res->first_drv_let=first_drv_let;
- res->type=type;
- res->flags=BDF_READ_CACHE;
- res->blk_size=BLK_SIZE;
- res->max_blk=0xEFFFFFFF;
- switch (type) {
- case BDT_RAM:
- res->flags&=~BDF_READ_CACHE;
- break;
- case BDT_ISO_FILE_READ:
- res->flags|=BDF_READ_ONLY;
- break;
- case BDT_ATAPI:
- res->flags|=BDF_REMOVABLE|BDF_READ_ONLY;
- res->blk_size=DVD_BLK_SIZE;
- break;
- }
- return res;
- }
- } while (++i<BLKDEVS_NUM);
- throw('BlkDev');
- return NULL; //never gets here
-}
-
-U0 BlkDevDel(CBlkDev *bd)
-{//Delete BlkDev
- DrvBlkDevDel(bd);
- FClose(bd->file_dsk);
- Free(bd->file_dsk_name);
- Free(bd->dev_id_record);
- MemSet(bd,0,sizeof(CBlkDev));
-}
-
-CBlkDev *BlkDevChk(CBlkDev *bd,Bool except=TRUE)
-{//Check for valid BlkDev. Throw exception.
- if (!bd || bd->bd_signature!=BD_SIGNATURE_VAL ||
- !(BDT_NULL<bd->type<BDT_TYPES_NUM)) {
- if (except)
- throw('BlkDev');
- else
- return NULL;
- } else
- return bd;
-}
-
-CBlkDev *Let2BlkDev(U8 drv_let=0,Bool except=TRUE)
-{//Drv letter to BlkDev ptr.
- CDrv *dv;
- if (dv=Let2Drv(drv_let,except))
- return BlkDevChk(dv->bd,except);
- else
- return NULL;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/BlkDev/DskCDDVD.HC.HTML b/public/src/Kernel/BlkDev/DskCDDVD.HC.HTML deleted file mode 100644 index fe58307..0000000 --- a/public/src/Kernel/BlkDev/DskCDDVD.HC.HTML +++ /dev/null @@ -1,255 +0,0 @@ - - - - - DskCDDVD.HC - - - - - Bool ISOInit(CDrv *dv,I64 blk)
-{
- CBlkDev *bd=dv->bd;
- I64 spc=bd->blk_size>>BLK_SIZE_BITS,i=blk/spc,drv_offset=0;
- CISOPriDesc *iso=MAlloc(bd->blk_size);
- CISODirEntry *de;
- Bool unlock,res=FALSE;
- U8 buf[8];
-
- try {
- unlock=DrvLock(dv);
- dv->fs_type=FSt_ISO9660;
- dv->spc=spc;
- dv->data_area=dv->root_clus=dv->drv_offset=bd->drv_offset=dv->size=0;
- while (TRUE) {
- dv->size=MaxI64(dv->size,(i+1)*spc);
- BlkRead(dv,iso,i*spc,spc);
- buf[0](U32)=iso->id[0](U32);
- buf[4](U16)=iso->id[4](U8);
- switch (LstMatch(buf,"CD001\0CDW02\0BEA01\0BOOT2\0NSR02\0NSR03\0TEA01\0",
- LMF_EXACT)) {
- case 0:
- switch (iso->type) {
- case ISOT_BOOT_RECORD:
- drv_offset+=(2*DVD_BLK_SIZE+DVD_BLK_SIZE)/BLK_SIZE;
- break;
- case ISOT_SUPPLEMENTARY_DESC:
- de=&iso->root_dir_record;
- dv->size=iso->vol_space_size.little*bd->blk_size>>BLK_SIZE_BITS;
- if (!StrCmp(iso->publisher_id,"TempleOS RedSea")) {
- dv->fs_type=FSt_REDSEA;
- bd->drv_offset=dv->drv_offset=19<<2+drv_offset;
- bd->max_blk=dv->size-1;
- dv->size-=bd->drv_offset;
- RedSeaInit(dv);
- } else
- dv->root_clus=de->loc.little;
- res=TRUE;
- goto di_done;
- case ISOT_TERMINATOR:
- throw('Drv');
- }
- break;
- default: //Its normal for ISO3346 to read NULL blk as terminator
- PrintErr("File System Not Supported\n");
- throw('Drv');
- }
- i++;
- }
-di_done:
- Free(iso);
- if (unlock)
- DrvUnlock(dv);
- } catch {
- dv->fs_type=FSt_ISO9660;
- dv->spc=spc;
- dv->drv_offset=bd->drv_offset=dv->data_area=dv->root_clus=0;
- Free(iso);
- if (unlock)
- DrvUnlock(dv);
- }
- return res;
-}
-
-U0 DVDImageRead(U8 dvd_drv_let,U8 *out_name)
-{//Read entire CD/DVD image into ISO file.
- CDrv *dv=Let2Drv(dvd_drv_let);
- CBlkDev *bd=dv->bd;
- U8 *buf=MAlloc(COPY_BUF_BLKS<<BLK_SIZE_BITS),
- *out_name2=ExtDft(out_name,"ISO");
- CFile *f=FOpen(out_name2,"w");
- I64 n,spc=bd->blk_size>>BLK_SIZE_BITS,blk=0,cnt,retry;
- BlkDevInit(bd);
- if (bd->type!=BDT_ATAPI)
- throw('BlkDev');
- if (!out_name)
- out_name=blkdev.dft_iso_filename;
- cnt=CeilU64(dv->size,spc);
- while (cnt>0) {
- if (cnt>COPY_BUF_BLKS)
- n=COPY_BUF_BLKS;
- else
- n=cnt;
- if (n>bd->max_reads)
- n=bd->max_reads;
-
- retry=4;
- while (--retry)
- if (ATAPIReadBlks2(bd,tS+7.0+0.004*n/spc,buf,blk/spc,n/spc,TRUE))
-//n is 0x800 if max_reads. Up to 8 additional seconds
- break;
-
- if (!retry)
- ATAPIReadBlks2(bd,0,buf,blk/spc,n/spc,TRUE);
-
- FBlkWrite(f,buf,blk,n);
- cnt-=n;
- blk+=n;
- }
- FClose(f);
- Free(buf);
- Free(out_name2);
-}
-
-class CDualBuf
-{
- U8 *buf0,*buf1;
- I64 in_buf,out_buf,cnt;
- U8 *filename;
- CBlkDev *dvd_bd;
-};
-
-U0 DVDImageWriteTask(CDualBuf *d)
-{
- U8 *buf;
- I64 n,blk=0,cnt=d->cnt;
- CFile *f;
- if (FileAttr(d->filename)&RS_ATTR_CONTIGUOUS)
- f=FOpen(d->filename,"rc");
- else
- f=FOpen(d->filename,"r");
- while (cnt>0) {
- if (cnt>COPY_BUF_BLKS)
- n=COPY_BUF_BLKS;
- else
- n=cnt;
- if (n>d->dvd_bd->max_writes)
- n=d->dvd_bd->max_writes;
- if (d->in_buf&1)
- buf=d->buf1;
- else
- buf=d->buf0;
- while (d->in_buf>d->out_buf+1)
- Yield;
- FBlkRead(f,buf,blk,n);
- d->in_buf++;
- cnt-=n;
- blk+=n;
- }
- FClose(f);
-}
-
-U0 DVDImageWrite(U8 dvd_drv_let,U8 *in_name=NULL,I64 media_type=MT_DVD)
-{//Write CD/DVD ISO file to disk.
- CDualBuf *d=CAlloc(sizeof(CDualBuf));
- U8 *buf,*in_name2,*in_name3;
- I64 i,n,spc,blk=0,cnt;
- CDrv *dv=Let2Drv(dvd_drv_let);
- CBlkDev *bd=dv->bd,*bd2;
- CTask *task;
- CFile *f;
-
- if (!in_name)
- in_name=blkdev.dft_iso_filename;
- in_name3=ExtDft(in_name,"ISO");
- in_name2=FileNameAbs(in_name3);
- f=FOpen(in_name2,"r");
- if (!f) {
- Free(d);
- return;
- }
- cnt=(FSize(f)+BLK_SIZE-1)>>BLK_SIZE_BITS;
- FClose(f);
- if (bd->type!=BDT_ATAPI)
- throw('BlkDev');
- bd2=Let2BlkDev(*in_name2);
- while (bd2->lock_fwding)
- bd2=bd2->lock_fwding; //If two blkdevs on same controller, use one lock
- if ((bd2->type==BDT_ATA || bd2->type==BDT_ATAPI) &&
- bd2->base0==bd->base0) {
- PrintErr("Can't burn CD/DVD on same ATA controller as file.\n\n");
- throw('BlkDev');
- }
-
- bd->flags|=BDF_READ_ONLY_OVERRIDE;
- BlkDevInit(bd);
- spc=bd->blk_size>>BLK_SIZE_BITS;
- if (dv->size<cnt)
- dv->size=cnt;
-
- d->filename=in_name2;
- d->dvd_bd=bd;
- d->buf0=MAlloc(COPY_BUF_BLKS<<BLK_SIZE_BITS);
- d->buf1=MAlloc(COPY_BUF_BLKS<<BLK_SIZE_BITS);
- d->cnt=cnt;
-
- task=Spawn(&DVDImageWriteTask,d,"Write CD/DVD");
- while (d->in_buf<=d->out_buf)
- Yield;
-
- BlkDevLock(bd);
- ATAPIWaitReady(bd,0);
-
- progress1=0; progress1_max=cnt;
- StrCpy(progress1_desc,"Writing");
- while (cnt>0) {
- if (cnt>COPY_BUF_BLKS)
- n=COPY_BUF_BLKS;
- else
- n=cnt;
- if (n>bd->max_writes)
- n=bd->max_writes;
- if (d->out_buf&1)
- buf=d->buf1;
- else
- buf=d->buf0;
- while (d->in_buf<=d->out_buf)
- Yield;
- ATAPIWriteBlks(bd,buf,blk/spc,(n+spc-1)/spc);
- d->out_buf++;
- cnt-=n;
- blk+=n;
- progress1+=n;
- }
- ATAPISync(bd);
-
- progress1=0; progress1_max=2;
- StrCpy(progress1_desc,"Closing");
- for (i=0;i<2;i++) {
- ATAPIClose(bd,0x100,i); //Close tracks
- progress1++;
- }
-
- ATAPISync(bd);
-
- ATAPIClose(bd,0x200); //close disk
- ATAPISync(bd);
- if (media_type==MT_DVD) {
- ATAPIClose(bd,0x300);
- ATAPISync(bd);
- }
-
- *progress1_desc=0;
- progress1=progress1_max=0;
-
- bd->flags&=~BDF_READ_ONLY_OVERRIDE;
- BlkDevUnlock(bd);
- Free(d->buf0);
- Free(d->buf1);
- Free(in_name2);
- Free(in_name3);
- Free(d);
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/BlkDev/DskCFile.HC.HTML b/public/src/Kernel/BlkDev/DskCFile.HC.HTML deleted file mode 100644 index 11718ee..0000000 --- a/public/src/Kernel/BlkDev/DskCFile.HC.HTML +++ /dev/null @@ -1,277 +0,0 @@ - - - - - DskCFile.HC - - - - - I64 FSize(CFile *f)
-{//Report size of opened file in bytes.
- if (f)
- return f->de.size;
- else
- return 0;
-}
-
-CFile *FOpen(U8 *filename,U8 *flags,I64 cnt=0)
-{//Allows flags "r","w","w+". "c" for contiguous.
-//(It uses StrOcc() for 'w', 'r', '+', 'c')
- CFile *f=CAlloc(sizeof(CFile));
- CDirContext *dirc;
- U8 *full_name;
- Bool contiguous=StrOcc(flags,'c');
-
- f->clus=INVALID_CLUS;
- f->fblk_num=0;
- if (cnt>0)
- f->max_blk=cnt-1;
- else
- f->max_blk=I64_MAX;
- f->file_clus_num=INVALID_CLUS;
- full_name=FileNameAbs(filename);
- f->dv=Let2Drv(*full_name);
- if (f->dv->fs_type==FSt_REDSEA)
- contiguous=TRUE;
- if (contiguous) {
- f->flags|=FF_CONTIGUOUS;
- if (f->dv->fs_type!=FSt_REDSEA &&
- !(FileAttr(filename) & RS_ATTR_CONTIGUOUS))
- throw('File');
- }
- f->clus_buf=CAlloc(f->dv->spc<<BLK_SIZE_BITS);
- if (StrOcc(flags,'w')) {
- f->flags=f->flags|FF_WRITE|FF_NEEDS_WRITE;
- if (StrOcc(flags,'+')) {
- if (FileFind(full_name,&f->de,FUF_JUST_FILES)) {
- Free(full_name);
- if (contiguous)
- f->max_blk=(FSize(f)+BLK_SIZE-1)>>BLK_SIZE_BITS-1;
- return f;
- }
- } else
- Del(full_name,,,FALSE);
- f->de.full_name=full_name;
- f->flags|=FF_NEW_FILE;
- if (dirc=DirContextNew(full_name)) {
- StrCpy(f->de.name,dirc->mask);
- if (cnt>0) {//We pre-alloc the whole thing.
- f->de.clus=ClusAlloc(f->dv,0,
- (cnt+f->dv->spc-1)/f->dv->spc,contiguous);
- f->de.size=cnt<<BLK_SIZE_BITS;
- DirNew(dirc->dv,Fs->cur_dir,&f->de,TRUE);
- f->flags&=~FF_NEW_FILE;
- }
- DirContextDel(dirc);
- return f;
- }
- } else {
- if (FileFind(full_name,&f->de,FUF_JUST_FILES)) {
- Free(full_name);
- f->max_blk=(FSize(f)+BLK_SIZE-1)>>BLK_SIZE_BITS-1;
- return f;
- }
- }
- Free(f->clus_buf);
- Free(full_name);
- Free(f);
- return NULL;
-}
-
-U0 FClose(CFile *f)
-{//Close CFile, updating directory.
- CDirContext *dirc;
- if (f) {
- if (f->flags & FF_BUF_DIRTY) {
- ClusWrite(f->dv,f->clus_buf,f->clus,1);
- f->flags&=~FF_BUF_DIRTY;
- }
- if (f->flags & FF_NEEDS_WRITE) {
- if (dirc=DirContextNew(f->de.full_name)) {
- if (!(f->flags & FF_USE_OLD_DATETIME))
- f->de.datetime=Now;
- if (f->flags & FF_NEW_FILE)
- DirNew(dirc->dv,Fs->cur_dir,&f->de,TRUE);
- else
- DirNew(dirc->dv,Fs->cur_dir,&f->de,FALSE);
- DirContextDel(dirc);
- } else
- throw('File');
- }
- Free(f->clus_buf);
- Free(f->de.full_name);
- Free(f);
- }
-}
-
-I64 FSetClus(CFile *f,I64 c,I64 blk,Bool read)
-{
- CDrv *dv=f->dv;
- I64 i;
- if (f->clus!=c) {
- if (f->flags & FF_BUF_DIRTY) {
- i=dv->spc;
- if (f->max_blk!=I64_MAX) {
- i=f->max_blk+1-f->file_clus_num*dv->spc;
- if (i>dv->spc)
- i=dv->spc;
- }
- ClusBlkWrite(dv,f->clus_buf,f->clus,i);
- f->flags=f->flags & ~FF_BUF_DIRTY;
- }
- f->clus=c;
- f->file_clus_num=blk/dv->spc;
- if (read) {
- i=dv->spc;
- if (f->max_blk!=I64_MAX) {
- i=f->max_blk+1-f->file_clus_num*dv->spc;
- if (i>dv->spc)
- i=dv->spc;
- }
- c=ClusBlkRead(dv,f->clus_buf,c,i);
- }
- }
- return c;
-}
-
-Bool FBlkRead(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
-{//Read [nth,n+cnt) blks of file.
- CDrv *dv=f->dv;
- I64 spc=dv->spc,i,j,c=f->de.clus;
- if (!f || !dv) return FALSE;
- if (blk==FFB_NEXT_BLK)
- blk=f->fblk_num;
- if (blk+cnt-1>f->max_blk)
- return FALSE;
- if (cnt<=0) return TRUE;
-
- if (f->flags & FF_CONTIGUOUS) {
- BlkRead(dv,buf,Clus2Blk(dv,c)+blk,cnt);
- blk+=cnt;
- } else {
- i=blk/spc;
- if (0<=f->file_clus_num<=i) {
- c=f->clus;
- i-=f->file_clus_num;
- }
- if (i>0)
- c=ClusNumNext(dv,c,i);
-
- if (i=blk%spc) {
- c=FSetClus(f,c,blk,TRUE);
- if (cnt<spc-i)
- j=cnt;
- else
- j=spc-i;
- MemCpy(buf,f->clus_buf+i<<BLK_SIZE_BITS,j<<BLK_SIZE_BITS);
- buf+=j<<BLK_SIZE_BITS;
- cnt-=j;
- blk+=j;
- }
- while (cnt>=spc) {
- c=FSetClus(f,c,blk,TRUE);
- MemCpy(buf,f->clus_buf,spc<<BLK_SIZE_BITS);
- buf+=spc<<BLK_SIZE_BITS;
- cnt-=spc;
- blk+=spc;
- }
- if (cnt>0) {
- c=FSetClus(f,c,blk,TRUE);
- MemCpy(buf,f->clus_buf,cnt<<BLK_SIZE_BITS);
- buf+=cnt<<BLK_SIZE_BITS;
- blk+=cnt;
- }
- }
- f->fblk_num=blk;
- return TRUE;
-}
-
-Bool FBlkWrite(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
-{//Write [nth,n+cnt) blks of file.
- CDrv *dv=f->dv;
- I64 spc=dv->spc,i,j,c=f->de.clus,c1;
- if (!f || !dv) return FALSE;
- if (blk==FFB_NEXT_BLK)
- blk=f->fblk_num;
- if (blk+cnt-1>f->max_blk)
- return FALSE;
- if (!(f->flags & FF_WRITE))
- return FALSE;
- if (cnt<=0) return TRUE;
- if (f->flags & FF_CONTIGUOUS) {
- BlkWrite(dv,buf,Clus2Blk(dv,c)+blk,cnt);
- blk+=cnt;
- } else {
- if (!c) {
- c=ClusAlloc(dv,0,1,FALSE);
- f->file_clus_num=0;
- f->clus=c;
- f->de.clus=c;
- f->flags|=FF_NEEDS_WRITE|FF_NEW_FILE;
- }
- i=blk/spc;
- if (0<=f->file_clus_num<=i) {
- c=f->clus;
- i-=f->file_clus_num;
- }
- while (i>0) {
- c1=c;
- c=ClusNumNext(dv,c1,1);
- if (c==INVALID_CLUS) {
- c=ClusAlloc(dv,c1,i,FALSE);
- if (i>1)
- c=ClusNumNext(dv,c,i-1);
- break;
- } else
- i--;
- }
-
- if (i=blk%spc) {
- FSetClus(f,c,blk,TRUE);
- if (cnt<spc-i)
- j=cnt;
- else
- j=spc-i;
- MemCpy(f->clus_buf+BLK_SIZE*i,buf,j<<BLK_SIZE_BITS);
- f->flags|=FF_BUF_DIRTY;
- buf+=j<<BLK_SIZE_BITS;
- cnt-=j;
- blk+=j;
- if (cnt>0) {
- c1=c;
- c=ClusNumNext(dv,c1,1);
- if (c==INVALID_CLUS)
- c=ClusAlloc(dv,c1,1,FALSE);
- }
- }
- while (cnt>=spc) {
- FSetClus(f,c,blk,FALSE);
- MemCpy(f->clus_buf,buf,spc<<BLK_SIZE_BITS);
- f->flags|=FF_BUF_DIRTY;
- buf+=spc<<BLK_SIZE_BITS;
- cnt-=spc;
- blk+=spc;
- if (cnt>0) {
- c1=c;
- c=ClusNumNext(dv,c1,1);
- if (c==INVALID_CLUS)
- c=ClusAlloc(dv,c1,1,FALSE);
- }
- }
- if (cnt>0) {
- FSetClus(f,c,blk,TRUE);
- MemCpy(f->clus_buf,buf,cnt<<BLK_SIZE_BITS);
- f->flags|=FF_BUF_DIRTY;
- buf+=cnt<<BLK_SIZE_BITS;
- blk+=cnt;
- }
- if (f->de.size<blk<<BLK_SIZE_BITS)
- f->de.size=blk<<BLK_SIZE_BITS;
- }
- f->fblk_num=blk;
- return TRUE;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/BlkDev/DskCache.HC.HTML b/public/src/Kernel/BlkDev/DskCache.HC.HTML deleted file mode 100644 index fd50ba0..0000000 --- a/public/src/Kernel/BlkDev/DskCache.HC.HTML +++ /dev/null @@ -1,157 +0,0 @@ - - - - - DskCache.HC - - - - - U0 DskCacheInit(I64 size_in_U8s)
-{
- CCacheBlk *tmpc;
- I64 i,cnt;
-
- while (LBts(&sys_semas[SEMA_DSK_CACHE],0))
- Yield;
- Free(blkdev.cache_ctrl);
- Free(blkdev.cache_base);
- Free(blkdev.cache_hash_table);
- if (size_in_U8s<0x2000) {
- blkdev.cache_ctrl=NULL;
- blkdev.cache_base=NULL;
- blkdev.cache_hash_table=NULL;
- } else {
- blkdev.cache_ctrl=ACAlloc(offset(CCacheBlk.body));
- blkdev.cache_base=AMAlloc(size_in_U8s);
- QueInit(blkdev.cache_ctrl);
-
- cnt=MSize(blkdev.cache_base)/sizeof(CCacheBlk);
- blkdev.cache_size=cnt*BLK_SIZE;
- for (i=0;i<cnt;i++) {
- tmpc=blkdev.cache_base+i;
- QueIns(tmpc,blkdev.cache_ctrl->last_lru);
- tmpc->next_hash=tmpc->last_hash=tmpc;
- tmpc->dv=NULL;
- tmpc->blk=0;
- }
-
- blkdev.cache_hash_table=AMAlloc(DSK_CACHE_HASH_SIZE*sizeof(U8 *)*2);
- for (i=0;i<DSK_CACHE_HASH_SIZE;i++) {
- tmpc=blkdev.cache_hash_table(U8 *)+i*sizeof(U8 *)*2
- -offset(CCacheBlk.next_hash);
- tmpc->next_hash=tmpc->last_hash=tmpc;
- }
- }
- LBtr(&sys_semas[SEMA_DSK_CACHE],0);
-}
-
-I64 DskCacheHash(I64 blk)
-{
- I64 i=blk & (DSK_CACHE_HASH_SIZE-1);
- return blkdev.cache_hash_table(U8 *)+i<<4-offset(CCacheBlk.next_hash);
-}
-
-U0 DskCacheQueRem(CCacheBlk *tmpc)
-{
- QueRem(tmpc);
- tmpc->next_hash->last_hash=tmpc->last_hash;
- tmpc->last_hash->next_hash=tmpc->next_hash;
-}
-
-U0 DskCacheQueIns(CCacheBlk *tmpc)
-{
- CCacheBlk *tmp_n,*tmp_l;
- QueIns(tmpc,blkdev.cache_ctrl->last_lru);
- tmp_l=DskCacheHash(tmpc->blk);
- tmp_n=tmp_l->next_hash;
- tmpc->last_hash=tmp_l;
- tmpc->next_hash=tmp_n;
- tmp_l->next_hash=tmp_n->last_hash=tmpc;
-}
-
-CCacheBlk *DskCacheFind(CDrv *dv,I64 blk)
-{
- CCacheBlk *tmpc,*tmpc1=DskCacheHash(blk);
- tmpc=tmpc1->next_hash;
- while (tmpc!=tmpc1) {
- if (tmpc->dv==dv && tmpc->blk==blk)
- return tmpc;
- tmpc=tmpc->next_hash;
- }
- return NULL;
-}
-
-U0 DskCacheAdd(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
-{
- CCacheBlk *tmpc;
- if (blkdev.cache_base) {
- while (LBts(&sys_semas[SEMA_DSK_CACHE],0))
- Yield;
- while (cnt-->0) {
- if (!(tmpc=DskCacheFind(dv,blk)))
- tmpc=blkdev.cache_ctrl->next_lru;
- DskCacheQueRem(tmpc);
- MemCpy(&tmpc->body,buf,BLK_SIZE);
- tmpc->dv=dv;
- tmpc->blk=blk;
- DskCacheQueIns(tmpc);
- blk++;
- buf+=BLK_SIZE;
- }
- LBtr(&sys_semas[SEMA_DSK_CACHE],0);
- }
-}
-
-U0 DskCacheInvalidate2(CDrv *dv)
-{
- CCacheBlk *tmpc,*tmpc1;
- if (blkdev.cache_base) {
- while (LBts(&sys_semas[SEMA_DSK_CACHE],0))
- Yield;
- tmpc=blkdev.cache_ctrl->last_lru;
- while (tmpc!=blkdev.cache_ctrl) {
- tmpc1=tmpc->last_lru;
- if (tmpc->dv==dv) {
- DskCacheQueRem(tmpc);
- tmpc->dv=NULL;
- tmpc->blk=0;
- tmpc->next_hash=tmpc->last_hash=tmpc;
- QueIns(tmpc,blkdev.cache_ctrl->last_lru);
- }
- tmpc=tmpc1;
- }
- LBtr(&sys_semas[SEMA_DSK_CACHE],0);
- }
-}
-
-U0 RCache(CDrv *dv,U8 **_buf, I64 *_blk, I64 *_cnt)
-{
- CCacheBlk *tmpc;
- if (blkdev.cache_base) {
- while (LBts(&sys_semas[SEMA_DSK_CACHE],0))
- Yield;
-//fetch leading blks from cache
- while (*_cnt>0) {
- if (tmpc=DskCacheFind(dv,*_blk)) {
- MemCpy(*_buf,&tmpc->body,BLK_SIZE);
- *_cnt-=1;
- *_buf+=BLK_SIZE;
- *_blk+=1;
- } else
- break;
- }
-//fetch trailing blks from cache
- while (*_cnt>0) {
- if (tmpc=DskCacheFind(dv,*_blk+*_cnt-1)) {
- MemCpy(*_buf+(*_cnt-1)<<BLK_SIZE_BITS,&tmpc->body,BLK_SIZE);
- *_cnt-=1;
- } else
- break;
- }
- LBtr(&sys_semas[SEMA_DSK_CACHE],0);
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/BlkDev/DskClus.HC.HTML b/public/src/Kernel/BlkDev/DskClus.HC.HTML deleted file mode 100644 index efd6f5f..0000000 --- a/public/src/Kernel/BlkDev/DskClus.HC.HTML +++ /dev/null @@ -1,157 +0,0 @@ - - - - - DskClus.HC - - - - - I64 ClusNumNext(CDrv *dv,I64 c,I64 cnt=1)
-{//Return next cnt'th clus in chain.
- Bool unlock;
- DrvChk(dv);
- if (cnt<=0) return c;
- try {
- unlock=DrvLock(dv);
- switch (dv->fs_type) {
- case FSt_REDSEA:
- c+=cnt;
- break;
- case FSt_FAT32:
- while (cnt-->0 && 0<c<0x0FFFFFF8) {
- DrvFATBlkSet(dv,c);
- c=dv->cur_fat_blk[c & (BLK_SIZE/4-1)];
- }
- if (!(0<c<0x0FFFFFF8))
- c=INVALID_CLUS;
- break;
- default:
- throw('Drv');
- }
- if (unlock)
- DrvUnlock(dv);
- } catch
- if (unlock)
- DrvUnlock(dv);
- return c;
-}
-
-I64 Clus2Blk(CDrv *dv,I64 c)
-{//Drv clus num to blk num.
- DrvChk(dv);
- switch (dv->fs_type) {
- case FSt_REDSEA:
- return c;
- case FSt_FAT32:
- return dv->data_area+c*dv->spc;
- default:
- throw('Drv');
- }
-}
-
-I64 ClusBlkRead(CDrv *dv,U8 *buf,I64 c,I64 blks)
-{//Accepts blk count, so padding on last clus is not read.
- I64 i;
- Bool unlock;
- DrvChk(dv);
- if (blks<=0) return c;
- try {
- unlock=DrvLock(dv);
- switch (dv->fs_type) {
- case FSt_REDSEA:
- BlkRead(dv,buf,c,blks);
- c+=blks;
- break;
- case FSt_FAT32:
- while (blks && 0<c<0x0FFFFFF8) {
- i=blks;
- if (i>dv->spc)
- i=dv->spc;
- BlkRead(dv,buf,dv->data_area+c*dv->spc,i);
- buf+=i<<BLK_SIZE_BITS;
- c=ClusNumNext(dv,c,1);
- blks-=i;
- }
- if (blks)
- throw('Drv');
- break;
- default:
- throw('Drv');
- }
- if (unlock)
- DrvUnlock(dv);
- } catch
- if (unlock)
- DrvUnlock(dv);
- return c;
-}
-
-I64 ClusRead(CDrv *dv,U8 *buf,I64 c,I64 cnt)
-{//Read clus cnt from drv to buf.
- return ClusBlkRead(dv,buf,c,cnt*dv->spc);
-}
-
-I64 ClusBlkWrite(CDrv *dv,U8 *buf,I64 c,I64 blks)
-{//Accepts blk count, so padding on last clus is not written.
- I64 i;
- Bool unlock;
- DrvChk(dv);
- if (blks<=0) return c;
- try {
- unlock=DrvLock(dv);
- switch (dv->fs_type) {
- case FSt_REDSEA:
- BlkWrite(dv,buf,c,blks);
- c=0;
- break;
- case FSt_FAT32:
- while (blks) {
- if (!(0<c<0x0FFFFFF8))
- throw('Drv');
- i=blks;
- if (i>dv->spc)
- i=dv->spc;
- BlkWrite(dv,buf,dv->data_area+c*dv->spc,i);
- buf+=i<<BLK_SIZE_BITS;
- c=ClusNumNext(dv,c);
- blks-=i;
- }
- break;
- default:
- throw('Drv');
- }
- if (unlock)
- DrvUnlock(dv);
- } catch
- if (unlock)
- DrvUnlock(dv);
- return c;
-}
-
-I64 ClusWrite(CDrv *dv,U8 *buf,I64 c,I64 cnt)
-{//Write clus cnt from buf to drv.
- return ClusBlkWrite(dv,buf,c,cnt*dv->spc);
-}
-
-I64 ClusAlloc(CDrv *dv,I64 c=0,I64 cnt=1,Bool contiguous=FALSE)
-{//Alloc clus cnt into chain.
-//c=0 means first clus in chain
- DrvChk(dv);
- if (cnt<=0) return c;
- switch (dv->fs_type) {
- case FSt_REDSEA:
- return RedSeaAllocClus(dv,cnt);
- case FSt_FAT32:
- if (contiguous) {
- if (c) throw('File');
- return FAT32AllocContiguousClus(dv,cnt);
- } else
- return FAT32AllocClus(dv,c,cnt);
- default:
- throw('Drv');
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/BlkDev/DskCopy.HC.HTML b/public/src/Kernel/BlkDev/DskCopy.HC.HTML deleted file mode 100644 index 9d27176..0000000 --- a/public/src/Kernel/BlkDev/DskCopy.HC.HTML +++ /dev/null @@ -1,115 +0,0 @@ - - - - - DskCopy.HC - - - - - Bool CopySingleZ(U8 *f1,U8 *f2) //Just one file
-{
- U8 *file_buf=NULL;
- I64 size,attr=0,c;
- CDirEntry de;
- if (FileFind(f1,&de,FUF_JUST_FILES)) {
- Free(de.full_name);
- file_buf=FileRead(f1,&size,&attr);
- attr=FileAttr(f2,attr);
- if (file_buf) {
- "Copying%s to %s\n",f1,f2;
- c=FileWrite(f2,file_buf,size,de.datetime,attr);
- Free(file_buf);
- return ToBool(c);
- } else
- PrintErr("File not found: \"%s\".\n",f1);
- } else
- PrintErr("File not found: \"%s\".\n",f1);
- return FALSE;
-}
-
-#define COPY_BUF_BLKS 0x80
-Bool CopySingle(U8 *f1,U8 *f2) //Just one file
-{
- U8 *absf1=FileNameAbs(f1),*absf2=FileNameAbs(f2),*buf;
- I64 cnt,n,size,attr1=FileAttr(f1),attr2=FileAttr(f2),i,j;
- CFile *in_file=NULL,*out_file=NULL;
- if (!StrCmp(absf1,absf2)) {//onto self?
- Free(absf1);
- Free(absf2);
- return FALSE;
- }
- Free(absf1);
- Free(absf2);
- if (attr1!=attr2)
- return CopySingleZ(f1,f2);
- buf=MAlloc(COPY_BUF_BLKS<<BLK_SIZE_BITS);
- if (attr1 & RS_ATTR_CONTIGUOUS)
- in_file=FOpen(f1,"rc");
- else
- in_file=FOpen(f1,"r");
- if (in_file) {
- size=FSize(in_file);
- cnt=(size+BLK_SIZE-1)>>BLK_SIZE_BITS;
- if (attr2 & RS_ATTR_CONTIGUOUS)
- out_file=FOpen(f2,"wc",cnt);
- else
- out_file=FOpen(f2,"w",cnt);
- if (out_file) {
- "Copying %s to %s\n",f1,f2;
- j=size;
- while (cnt>0) {
- if (cnt>COPY_BUF_BLKS) {
- n=COPY_BUF_BLKS;
- i=n<<BLK_SIZE_BITS;
- } else {
- n=cnt;
- i=j;
- }
- FBlkRead(in_file, buf,FFB_NEXT_BLK,n);
- FBlkWrite(out_file,buf,FFB_NEXT_BLK,n);
- cnt-=n;
- j-=n<<BLK_SIZE_BITS;
- }
- out_file->flags|=FF_USE_OLD_DATETIME;
- out_file->de.datetime=in_file->de.datetime;
- out_file->de.size=size;
- out_file->de.attr=FileAttr(f2,in_file->de.attr);
- FClose(out_file);
- FClose(in_file);
- Free(buf);
- return TRUE;
- } else
- PrintErr("File not found: \"%s\".\n",f2);
- FClose(in_file);
- } else
- PrintErr("File not found: \"%s\".\n",f1);
- Free(buf);
- return FALSE;
-}
-
-I64 Del(U8 *files_find_mask,Bool make_mask=FALSE,
- Bool del_dir=FALSE,Bool print_msg=TRUE)
-{//Delete files.
- I64 res=0;
- CDirContext *dirc;
- if (dirc=DirContextNew(files_find_mask,make_mask)) {
- switch (dirc->dv->fs_type) {
- case FSt_REDSEA:
- res=RedSeaFilesDel(dirc->dv,Fs->cur_dir,dirc->mask,
- 0,del_dir,print_msg);
- break;
- case FSt_FAT32:
- res=FAT32FilesDel(dirc->dv,Fs->cur_dir,dirc->mask,
- 0,del_dir,print_msg);
- break;
- default:
- PrintErr("File System Not Supported\n");
- }
- DirContextDel(dirc);
- }
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/BlkDev/DskDirA.HC.HTML b/public/src/Kernel/BlkDev/DskDirA.HC.HTML deleted file mode 100644 index 3c40f2e..0000000 --- a/public/src/Kernel/BlkDev/DskDirA.HC.HTML +++ /dev/null @@ -1,223 +0,0 @@ - - - - - DskDirA.HC - - - - - Bool DirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain=TRUE)
-{//Makes a directory entry in the directory from a CDirEntry node.
- switch (dv->fs_type) {
- case FSt_REDSEA:
- return RedSeaDirNew(dv,cur_dir,tmpde,free_old_chain);
- case FSt_FAT32:
- return FAT32DirNew(dv,cur_dir,tmpde,free_old_chain);
- default:
- PrintErr("File System Not Supported\n");
- return FALSE;
- }
-}
-
-U0 DirEntryDel(CDirEntry *tmpde)
-{//Free node returned from FilesFind(). Doesn't Free user_data.
-//Does not change the directory on disk.
- if (tmpde) {
- Free(tmpde->full_name);
- Free(tmpde);
- }
-}
-
-U0 DirEntryDel2(CDirEntry *tmpde)
-{//Free node returned from FilesFind(). Frees user_data
-//Does not change the directory on disk.
- if (tmpde) {
- Free(tmpde->full_name);
- Free(tmpde->user_data);
- Free(tmpde);
- }
-}
-
-U0 DirTreeDel(CDirEntry *tmpde)
-{//Free tree returned from FilesFind(). Doesn't Free user_data.
-//Does not change the directory on disk.
- CDirEntry *tmpde2;
- while (tmpde) {
- tmpde2=tmpde->next;
- if (tmpde->sub)
- DirTreeDel(tmpde->sub);
- DirEntryDel(tmpde);
- tmpde=tmpde2;
- }
-}
-
-U0 DirTreeDel2(CDirEntry *tmpde)
-{//Free tree returned from FilesFind(). Frees user_data
-//Does not change the directory on disk.
- CDirEntry *tmpde2;
- while (tmpde) {
- tmpde2=tmpde->next;
- if (tmpde->sub)
- DirTreeDel2(tmpde->sub);
- DirEntryDel2(tmpde);
- tmpde=tmpde2;
- }
-}
-
-I64 DirEntryCompareName(CDirEntry *e1,CDirEntry *e2)
-{
- U8 buf1[CDIR_FILENAME_LEN],buf2[CDIR_FILENAME_LEN],
- buf3[CDIR_FILENAME_LEN],buf4[CDIR_FILENAME_LEN];
- I64 d1=0,d2=0;
- if (e1->attr & RS_ATTR_DIR)
- d1=1;
- if (e2->attr & RS_ATTR_DIR)
- d2=1;
- if (d1!=d2)
- return d2-d1;
- else {
- StrCpy(buf1,e1->name);
- StrCpy(buf2,e2->name);
- FileExtRem(buf1,buf3);
- FileExtRem(buf2,buf4);
- if (d1=StrCmp(buf3,buf4))
- return d1;
- return StrCmp(buf1,buf2);
- }
-}
-
-I64 DirEntryCompareClus(CDirEntry *e1,CDirEntry *e2)
-{
- return e1->clus-e2->clus;
-}
-
-#define SK_NAME 0
-#define SK_CLUS 1
-
-U0 DirFilesSort(CDirEntry **_tmpde,I64 key)
-{
- I64 i,cnt;
- CDirEntry *tmpde=*_tmpde,*tmpde1,**sort_buf;
- if (tmpde) {
- cnt=LinkedLstCnt(tmpde);
- if (cnt>1) {
- sort_buf=MAlloc(cnt*sizeof(U8 *));
- i=0;
- tmpde1=tmpde;
- while (tmpde1) {
- sort_buf[i++]=tmpde1;
- tmpde1=tmpde1->next;
- }
- switch [key] {
- case SK_NAME:
- QSortI64(sort_buf,cnt,&DirEntryCompareName);
- break;
- case SK_CLUS:
- QSortI64(sort_buf,cnt,&DirEntryCompareClus);
- break;
- }
- tmpde=sort_buf[0];
- *_tmpde=tmpde;
- for (i=0;i<cnt-1;i++) {
- tmpde1=sort_buf[i];
- tmpde1->next=sort_buf[i+1];
- }
- tmpde1=sort_buf[i];
- tmpde1->next=NULL;
- Free(sort_buf);
-
- tmpde1=tmpde;
- while (tmpde1) {
- if (tmpde1->sub)
- DirFilesSort(&tmpde1->sub,key);
- tmpde1=tmpde1->next;
- }
- } else
- if (tmpde->sub)
- DirFilesSort(&tmpde->sub,key);
- }
-}
-
-CDirEntry *DirFilesFlatten(CDirEntry *tmpde,CDirEntry **_res,I64 fuf_flags)
-{//Returns last node
- CDirEntry *tmpde1;
- Bool del;
- if (tmpde)
- while (TRUE) {
- tmpde1=tmpde->next;
- if (!(tmpde->attr&RS_ATTR_DIR)||!(fuf_flags&FUF_JUST_FILES)) {
- _res=*_res=tmpde;
- del=FALSE;
- } else
- del=TRUE;
- if (tmpde->sub) {
- _res=DirFilesFlatten(tmpde->sub,_res,fuf_flags);
- tmpde->sub=NULL;
- }
- if (del)
- DirEntryDel(tmpde);
- if (tmpde1)
- tmpde=tmpde1;
- else
- break;
- }
- *_res=NULL;
- return _res;
-}
-
-U0 PutFileLink(U8 *filename,U8 *full_name=NULL,I64 line=0,Bool plain_text=FALSE)
-{//Put DolDoc file,line link to StdOut, DocPut.
- U8 *st;
- if (!filename) return;
- if (IsRaw) {
- if (line)
- "%s,%04d",filename,line;
- else
- "%s",filename;
- } else {
-//LK_DOC,LK_DOC_ANCHOR,LK_DOC_FIND,LK_DOC_LINE
- if (filename[0]=='A'&&filename[2]==':') {
- if (line) //See SpriteEdText()
- "$LK,\"%s,%04d\",A=\"AL:%s,%d\"$",filename+3,line,filename+3,line;
- else
- "$LK,\"%s\",A=\"AI:%s\"$",filename+3,filename+3;
- } else {
- if (!full_name)
- full_name=st=FileNameAbs(filename);
- else
- st=NULL;
- if (plain_text) {
- if (line)
- "$LK,\"%s,%04d\",A=\"PL:%s,%d\"$",filename,line,full_name,line;
- else
- "$LK,\"%s\",A=\"PI:%s\"$",filename,full_name;
- } else {
- if (line)
- "$LK,\"%s,%04d\",A=\"FL:%s,%d\"$",filename,line,full_name,line;
- else
- "$LK,\"%s\",A=\"FI:%s\"$",filename,full_name;
- }
- Free(st);
- }
- }
-}
-
-U0 PutDirLink(U8 *dirname,U8 *full_name=NULL)
-{//Put DolDoc dir macro to StdOut, DocPut.
- U8 *st;
- if (!dirname) return;
- if (IsRaw)
- "%s",dirname;
- else {
- if (!full_name)
- full_name=st=DirNameAbs(dirname);
- else
- st=NULL;
- "$MA,T=\"%s\",LM=\"Cd(\\\"%s\\\");Dir;\n\"$",dirname,full_name;
- Free(st);
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/BlkDev/DskDirB.HC.HTML b/public/src/Kernel/BlkDev/DskDirB.HC.HTML deleted file mode 100644 index eedae33..0000000 --- a/public/src/Kernel/BlkDev/DskDirB.HC.HTML +++ /dev/null @@ -1,206 +0,0 @@ - - - - - DskDirB.HC - - - - - U0 HomeSet(U8 *dirname)
-{//Change home directory.
- dirname=DirNameAbs(dirname);
- Free(blkdev.home_dir);
- blkdev.home_dir=AStrNew(dirname);
- Free(dirname);
-}
-
-Bool Cd(U8 *dirname=NULL,Bool make_dirs=FALSE)
-{//Change directory. Optionally, make directories, too.
- I64 maxlen,cur_dir_clus=0;
- U8 *chg_to_buf,*new_cur_dir,*buf;
- CDrv *dv;
- Bool res=TRUE;
- if (!dirname)
- dirname="~";
- else if (!*dirname)
- return TRUE;
- if (dirname[1]==':') {
- if (*dirname==':') {
- if (Fs->cur_dv!=Let2Drv(':') && !Drv(*dirname))
- return FALSE;
- } else if (Fs->cur_dv!=Let2Drv(*dirname) && !Drv(*dirname))
- return FALSE;
- dirname+=2;
- }
- if (*dirname=='/' || !*dirname || !Fs->cur_dir) {
- Free(Fs->cur_dir);
- Fs->cur_dir=StrNew("/");
- if (*dirname=='/')
- dirname++;
- }
- chg_to_buf=MStrUtil(dirname,
- SUF_REM_LEADING|SUF_REM_TRAILING|SUF_REM_CTRL_CHARS);
- maxlen=StrLen(Fs->cur_dir)+1+StrLen(chg_to_buf)+1;
- new_cur_dir=MAlloc(maxlen);
- buf=MAlloc(maxlen);
- StrCpy(new_cur_dir,Fs->cur_dir);
- while (*chg_to_buf && res) {
- StrFirstRem(chg_to_buf,"/",buf);
- if (!*buf)
- StrCpy(new_cur_dir,"/");
- else if (!StrCmp(buf,"..")) {
- StrLastRem(new_cur_dir,"/");
- if (!*new_cur_dir)
- StrCpy(new_cur_dir,"/");
- } else if (!StrCmp(buf,"~")) {
- Free(new_cur_dir);
- new_cur_dir=MAlloc(StrLen(blkdev.home_dir+2)+1+StrLen(chg_to_buf)+1);
- StrCpy(new_cur_dir,blkdev.home_dir+2);
- if (Fs->cur_dv!=Let2Drv('~') && !Drv('~'))
- return FALSE;
- } else if (StrCmp(buf,".") && *buf) {
- dv=Fs->cur_dv;
- cur_dir_clus=Name2DirClus(dv,new_cur_dir);
- switch (dv->fs_type) {
- case FSt_REDSEA:
- res=RedSeaCd(buf,cur_dir_clus);
- break;
- case FSt_FAT32:
- res=FAT32Cd(buf,cur_dir_clus);
- break;
- default:
- PrintErr("File System Not Supported\n");
- res=FALSE;
- }
- if (!res && make_dirs) {
- Free(Fs->cur_dir);
- Fs->cur_dir=StrNew(new_cur_dir);
- res=DirMk(buf);
- }
- if (res) {
- if (StrCmp(new_cur_dir,"/"))
- CatPrint(new_cur_dir,"/");
- CatPrint(new_cur_dir,buf);
- }
- }
- }
- Free(Fs->cur_dir);
- Fs->cur_dir=StrNew(new_cur_dir);
- Free(buf);
- Free(chg_to_buf);
- Free(new_cur_dir);
- return res;
-}
-
-Bool IsDir(U8 *dir_name)
-{//Is a str a valid, existing Dir?
- U8 *mask=MStrPrint("%s/*",dir_name);
- Bool res,old_silent=Silent;
- CDirContext *dirc;
- if (dirc=DirContextNew(mask)) {
- DirContextDel(dirc);
- res=TRUE;
- } else
- res=FALSE;
- Free(mask);
- Silent(old_silent);
- return res;
-}
-
-I64 Dir(U8 *files_find_mask,Bool full)
-{//List directory.
- CDirEntry *tmpde1=NULL,*tmpde2;
- U8 *st;
- CDateStruct ds;
- I64 csize=0xFFFF,c=0xFFFF,res=0;
- tmpde1=FilesFind(files_find_mask);
- if (!(st=DirCur))
- PrintErr("Invalid Drive\n");
- else {
- if (tmpde1) {
- Free(st);
- st=MAllocIdent(tmpde1->full_name);
- StrLastRem(st,"/");
- if (!st[2])
- StrCpy(st+2,"/");
-//Find max columns
- tmpde2=tmpde1;
- while (tmpde2) {
- if (tmpde2->size>csize)
- csize=tmpde2->size;
- if (tmpde2->clus>c)
- c=tmpde2->clus;
- tmpde2=tmpde2->next;
- }
- csize=Bsr(csize)/4+1;
- c=Bsr(c)/4+1;
-
- "$MA,T=\"Directory\",LM=\"PopUpCd;Dir;\n\"$of%s\n",st;
- if (full)
- "__DATE____TIME__%*ts%*ts\n",
- csize,"SIZE",c,"BLK";
- else
- "DATE_TIME_%*ts\n",csize,"SIZE";
- while (tmpde1) {
- tmpde2=tmpde1->next;
- res++;
- if (full)
- "%D%T%0*tX%0*tX ",tmpde1->datetime,tmpde1->datetime,
- csize,tmpde1->size,c,tmpde1->clus;
- else {
- Date2Struct(&ds,tmpde1->datetime+local_time_offset);
- "%02d/%02d%02d:%02d%0*tX ",ds.mon,ds.day_of_mon,ds.hour,ds.min,
- csize,tmpde1->size;
- }
- if (tmpde1->attr & RS_ATTR_DIR)
- PutDirLink(tmpde1->name,tmpde1->full_name);
- else
- PutFileLink(tmpde1->name,tmpde1->full_name);
- '\n';
- DirEntryDel(tmpde1);
- tmpde1=tmpde2;
- }
- } else
- "No matching entries\n";
- Free(st);
- }
- return res;
-}
-
-Bool DirMk(U8 *filename,I64 entry_cnt=0)
-{//Make directory. Cd() can also make directories.
-//entry_cnt is for preallocating dir blks, leave it zero if you like.
- U8 *name;
- CDirContext *dirc;
- Bool res=FALSE;
- if (FileFind(filename,,FUF_JUST_DIRS))
- return FALSE;
- if (dirc=DirContextNew(filename)) {
- if (*dirc->mask) {
- if (!FileNameChk(dirc->mask))
- PrintErr("Invalid FileName: \"%s\".\n",dirc->mask);
- else {
- "Make Directory:%s\n",filename;
- name=MStrUtil(dirc->mask,
- SUF_REM_LEADING|SUF_REM_TRAILING|SUF_REM_CTRL_CHARS);
- switch (dirc->dv->fs_type) {
- case FSt_REDSEA:
- res=RedSeaMkDir(dirc->dv,Fs->cur_dir,name,entry_cnt);
- break;
- case FSt_FAT32:
- res=FAT32MkDir(dirc->dv,Fs->cur_dir,name,entry_cnt);
- break;
- default:
- PrintErr("File System Not Supported\n");
- }
- Free(name);
- }
- }
- DirContextDel(dirc);
- }
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/BlkDev/DskDirContext.HC.HTML b/public/src/Kernel/BlkDev/DskDirContext.HC.HTML deleted file mode 100644 index 9135f23..0000000 --- a/public/src/Kernel/BlkDev/DskDirContext.HC.HTML +++ /dev/null @@ -1,99 +0,0 @@ - - - - - DskDirContext.HC - - - - - U0 DirContextDel(CDirContext *dirc,Bool restore=TRUE)
-{//Change back to old cur_dir and drv.
- CBlkDev *bd;
- if (!dirc) return;
- if (restore) {
- bd=dirc->old_dv->bd;
- if (!(bd->flags & BDF_INIT_IN_PROGRESS)) {
- if (dirc->old_dir) {
- Drv(Drv2Let(dirc->old_dv));
- Cd(dirc->old_dir);
- }
- } else {
- Fs->cur_dv=dirc->old_dv;
- Free(Fs->cur_dir);
- Fs->cur_dir=StrNew("/");
- }
- }
- Free(dirc->old_dir);
- Free(dirc->mask);
- Free(dirc);
-}
-
-CDirContext *DirContextNew(U8 *_mask,Bool make_mask=FALSE,
- Bool make_dirs=FALSE,Bool no_mask=FALSE)
-{//Save cur_dir and drv. Change to new dir.
- Bool valid=TRUE,old_silent;
- I64 mask_len=StrLen(_mask);
- U8 *buf,*mask,*tmp_mask,*semicolon_mask;
- CDirContext *dirc=CAlloc(sizeof(CDirContext));
- dirc->old_dir=StrNew(Fs->cur_dir);
- dirc->old_dv=Fs->cur_dv;
- mask=MStrUtil(_mask,SUF_REM_LEADING|SUF_REM_TRAILING|SUF_REM_CTRL_CHARS);
- tmp_mask=mask;
- if (*mask && mask[1]==':') {
- if (Fs->cur_dv!=Let2Drv(*mask) && !Drv(*mask))
- valid=FALSE;
- mask+=2;
- }
- if (*mask=='~' && Fs->cur_dv!=Let2Drv('~') && !Drv('~'))
- valid=FALSE;
- dirc->dv=Fs->cur_dv;
- DrvChk(dirc->dv);
- buf=MAlloc(mask_len+2);
- StrCpy(buf,mask);
-
- dirc->mask=MAlloc(mask_len+2);
- if (no_mask)
- *dirc->mask=0;
- else if (StrOcc(buf,';')) {
- semicolon_mask=MAlloc(mask_len+2);
- StrCpy(semicolon_mask,mask);
- StrFirstRem(semicolon_mask,";",buf);
- StrLastRem(buf,"/",dirc->mask);
- CatPrint(dirc->mask,";%s",semicolon_mask);
- Free(semicolon_mask);
- } else
- StrLastRem(buf,"/",dirc->mask);
-
- if (*mask=='/' && !*buf)
- StrCpy(buf,"/");
-//If began with Dir, change to Dir.
- if (*buf && !Cd(buf,make_dirs))
- valid=FALSE;
- if (valid && make_mask) {
- if (!*dirc->mask) {
- Free(dirc->mask);
- dirc->mask=StrNew("*");
- } else {
- if (!make_dirs || FileNameChk(dirc->mask)) {
- old_silent=Silent;
-//Try mask to see if Dir. If Dir, change to dir and set to "*".
- if (Cd(dirc->mask,make_dirs)) {
- Free(dirc->mask);
- dirc->mask=StrNew("*");
- }
- Silent(old_silent);
- }
- }
- }
- Free(buf);
- Free(tmp_mask);
- if (!valid) {
- DirContextDel(dirc);
- dirc=NULL;
- }
- return dirc;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/BlkDev/DskDrv.HC.HTML b/public/src/Kernel/BlkDev/DskDrv.HC.HTML deleted file mode 100644 index 03f7a7e..0000000 --- a/public/src/Kernel/BlkDev/DskDrv.HC.HTML +++ /dev/null @@ -1,378 +0,0 @@ - - - - - DskDrv.HC - - - - - Bool DrvLock(CDrv *dv)
-{//Make this task have exclusive access to drv & BlkDev.
- DrvChk(dv);
- BlkDevLock(dv->bd);
- if (!Bt(&dv->locked_flags,DVlf_LOCKED) || dv->owning_task!=Fs) {
- while (LBts(&dv->locked_flags,DVlf_LOCKED))
- Yield;
- dv->owning_task=Fs;
- return TRUE;
- } else
- return FALSE;
-}
-
-Bool DrvUnlock(CDrv *dv,Bool rst=FALSE)
-{//Release exclusive lock on access to drv & BlkDev.
- DrvChk(dv);
- if (Bt(&dv->locked_flags,DVlf_LOCKED) && dv->owning_task==Fs) {
- BlkDevUnlock(dv->bd,rst);
- dv->owning_task=NULL;
- LBtr(&dv->locked_flags,DVlf_LOCKED);
- Yield; //Prevent deadlock
- return TRUE;
- } else
- return FALSE;
-}
-
-U0 DrvsRelease()
-{//When task dies, release all owned drvs.
- I64 i;
- CDrv *dv;
- for (i=0;i<DRVS_NUM;i++) {
- dv=&blkdev.drvs[i];
- if (dv->owning_task==Fs && dv->dv_signature==DRV_SIGNATURE_VAL)
- DrvUnlock(dv,TRUE);
- }
-}
-
-CDrv *DrvMakeFreeSlot(U8 drv_let)
-{//Make a slot free for a new drv, like during Mount().
-//!!! drv_let is not a remapped drv.
- I64 i=Let2Let(drv_let)-'A';
- CDrv *res;
- if (!(0<=i<DRVS_NUM))
- throw('Drv');
- res=&blkdev.drvs[i];
- MemSet(res,0,sizeof(CDrv));
- res->drv_let='A'+i;
- return res;
-}
-
-U8 DrvNextFreeLet(U8 first_drv_let='C')
-{//Locate free slot for new drv, like during Mount().
-//!!! first_drv_let is not a remapped drv.
- I64 i=Let2Let(first_drv_let)-'A',type=Let2BlkDevType(first_drv_let);
- if (!(0<=i<DRVS_NUM))
- throw('Drv');
- do
- if (blkdev.drvs[i].dv_signature!=DRV_SIGNATURE_VAL) {
- if (Let2BlkDevType(i+'A')!=type)
- throw('Drv');
- else
- return i+'A';
- }
- while (++i<DRVS_NUM);
- throw('Drv');
- return 0; //Never gets here.
-}
-
-U0 DrvDel(CDrv *dv)
-{//Delete drv
- if (dv->fs_type==FSt_REDSEA && dv->next_free)
- RedSeaFreeFreeLst(dv);
- Free(dv->cur_fat_blk);
- Free(dv->fis);
- MemSet(dv,0,sizeof(CDrv));
-}
-
-U0 DrvBlkDevDel(CBlkDev *bd)
-{//Delete drv's of BlkDev
- I64 i;
- CDrv *dv;
- for (i=0;i<DRVS_NUM;i++) {
- dv=&blkdev.drvs[i];
- if (dv->bd==bd)
- DrvDel(dv);
- }
-}
-
-U0 DrvFATBlkAlloc(CDrv *dv)
-{
- DrvChk(dv);
- Free(dv->cur_fat_blk);
- dv->cur_fat_blk=AMAlloc(BLK_SIZE);
- dv->cur_fat_blk_num=0;
- dv->fat_blk_dirty=0;
- BlkRead(dv,dv->cur_fat_blk,dv->fat1,1);
-}
-
-U0 DrvFATBlkClean(CDrv *dv,I64 fat_sel=3)
-{
- if ((dv->fs_type==FSt_FAT32 || dv->fs_type==FSt_REDSEA) &&
- Bt(&dv->fat_blk_dirty,0)) {
- if (dv->fat1==dv->fat2) {
- BlkWrite(dv,dv->cur_fat_blk,dv->fat1+dv->cur_fat_blk_num,1);
- LBtr(&dv->fat_blk_dirty,0);
- } else {
- if (fat_sel==3 || !fat_sel)
- BlkWrite(dv,dv->cur_fat_blk,dv->fat1+dv->cur_fat_blk_num,1);
- if (fat_sel==3 || fat_sel==1) {
- BlkWrite(dv,dv->cur_fat_blk,dv->fat2+dv->cur_fat_blk_num,1);
- LBtr(&dv->fat_blk_dirty,0);
- }
- }
- }
-}
-
-U0 DrvFATBlkSet(CDrv *dv,I64 c,I64 fat_sel=3)
-{
- I64 fat_blk_num;
- if (c==INVALID_CLUS)
- throw('Drv');
- switch (dv->fs_type) {
- case FSt_FAT32:
- fat_blk_num=c>>(BLK_SIZE_BITS-2);
- break;
- case FSt_REDSEA:
- fat_blk_num=(c-dv->data_area)>>(BLK_SIZE_BITS+3);
- break;
- default:
- throw('Drv');
- }
- if (fat_blk_num!=dv->cur_fat_blk_num) {
- DrvFATBlkClean(dv,fat_sel);
- dv->cur_fat_blk_num=fat_blk_num;
- if (fat_sel==3 || !fat_sel)
- BlkRead(dv,dv->cur_fat_blk,dv->fat1+dv->cur_fat_blk_num,1);
- else
- BlkRead(dv,dv->cur_fat_blk,dv->fat2+dv->cur_fat_blk_num,1);
- }
-}
-
-CDrv *DrvChk(CDrv *dv,Bool except=TRUE)
-{//Check for valid drv. Throw exception.
- if (!dv || dv->dv_signature!=DRV_SIGNATURE_VAL) {
- if (except)
- throw('Drv');
- else
- return NULL;
- } else
- return dv;
-}
-
-U8 Drv2Let(CDrv *dv=NULL)
-{//Drv ptr to Drv letter.
- if (!dv)
- dv=Fs->cur_dv;
- DrvChk(dv);
- return dv->drv_let;
-}
-
-U8 Let2Let(U8 drv_let=0)
-{//Drv letter to Drv letter.
- if (!drv_let)
- drv_let=Drv2Let(Fs->cur_dv);
- else if (drv_let==':')
- drv_let=blkdev.boot_drv_let;
- else if (drv_let=='~')
- drv_let=*blkdev.home_dir;
- return ToUpper(drv_let);
-}
-
-I64 Let2BlkDevType(U8 drv_let)
-{//Drv letter to BlkDev Type. drv_let=0 not allowed. See BDT_NULL.
- drv_let=Let2Let(drv_let);
- if ('A'<=drv_let<='B')
- return BDT_RAM;
- if ('C'<=drv_let<='L')
- return BDT_ATA;
- if ('M'<=drv_let<='P')
- return BDT_ISO_FILE_READ;
- if ('Q'<=drv_let<='S')
- return BDT_ISO_FILE_WRITE;
- if ('T'<=drv_let<='Z')
- return BDT_ATAPI;
- return BDT_NULL;
-}
-
-CDrv *Let2Drv(U8 drv_let=0,Bool except=TRUE)
-{//Drv letter to Drv ptr.
- CDrv *dv;
- if (!drv_let)
- dv=Fs->cur_dv;
- else {
- drv_let=Let2Let(drv_let);
- if (!('A'<=drv_let<='Z')) {
- if (except)
- throw('Drv');
- else
- return NULL;
- }
- dv=blkdev.let_to_drv[drv_let-'A'];
- }
- return DrvChk(dv,except);
-}
-
-CBlkDev *DrvIsWritable(U8 drv_let=0,Bool except=FALSE)
-{//Is drive writable?
- CBlkDev *bd;
- if (!(bd=Let2BlkDev(drv_let,except)) || bd->flags & BDF_READ_ONLY) {
- if (except)
- throw('Drv');
- else
- return NULL;
- } else
- return bd;
-}
-
-U0 DskCacheInvalidate(CDrv *dv)
-{//Needed for removable media. Called by DskChg().
- Bool unlock;
- CBlkDev *bd=dv->bd;
- DrvChk(dv);
- try {
- unlock=DrvLock(dv);
- BlkDevInit(bd);
- if (bd->flags & BDF_READ_CACHE)
- DskCacheInvalidate2(dv);
- if (bd->type==BDT_ATAPI && !(bd->flags & BDF_READ_ONLY_OVERRIDE))
- ISOInit(dv,(32767/bd->blk_size+1)*bd->blk_size>>BLK_SIZE_BITS);
- if (unlock)
- DrvUnlock(dv);
- } catch
- if (unlock)
- DrvUnlock(dv);
-}
-
-U0 DskChg(U8 drv_let=0)
-{//Change disk. (Needed for removable media.)
- CDrv *dv=Let2Drv(drv_let);
- CBlkDev *bd=dv->bd;
- if (!(bd->flags&BDF_INITIALIZED))
- BlkDevInit(bd);
- else if (bd->flags&BDF_REMOVABLE) {
- if (bd->type==BDT_ATAPI)
- ATAInit(bd); //TODO: This is a kludge for QEMU?
- DskCacheInvalidate(dv);
- }
- Drv(drv_let);
- RedSeaFreeFreeLst(dv);
-}
-
-Bool DrvMap(U8 drv_let,CDrv *dv)
-{//Make drive letter map to another.
- drv_let=Let2Let(drv_let);
- if ('A'<=drv_let<='Z') {
- blkdev.let_to_drv[drv_let-'A']=dv;
- dv->drv_let=drv_let;
- return TRUE;
- } else
- return FALSE;
-}
-
-Bool Drv(U8 drv_let)
-{//Change drive. You can set drive with Cd() as well.
- CDrv *dv=Let2Drv(drv_let);
- CBlkDev *bd;
- bd=BlkDevChk(dv->bd);
- if (dv!=Fs->cur_dv) {
- if (bd->flags & BDF_REMOVABLE && !(bd->flags & BDF_INITIALIZED))
- DskChg(Drv2Let(dv));
- if (bd->type==BDT_RAM ||
- bd->type==BDT_ISO_FILE_READ || bd->type==BDT_ISO_FILE_WRITE)
- BlkDevInit(bd);
- }
- Fs->cur_dv=dv;
- Free(Fs->cur_dir);
- Fs->cur_dir=StrNew("/");
- switch (dv->fs_type) {
- case FSt_REDSEA:
- case FSt_FAT32:
- return TRUE;
- default:
- PrintErr("File System Not Supported\n");
- return FALSE;
- }
-}
-
-U8 *DrvSerialNum(U8 drv_let=0)
-{//20 bytes max.
- CBlkDev *bd=Let2BlkDev(drv_let);
- U16 *st,*res=NULL;
- I64 i;
- if (bd->dev_id_record) {
- st=CAlloc(20+1);
- for (i=0;i<10;i++)
- st[i]=EndianU16(bd->dev_id_record[10+i]);
- res=MStrUtil(st,SUF_REM_LEADING|SUF_REM_TRAILING);
- Free(st);
- }
- return res;
-}
-
-U8 *DrvModelNum(U8 drv_let=0)
-{//40 bytes max.
- CBlkDev *bd=Let2BlkDev(drv_let);
- U16 *st,*res=NULL;
- I64 i;
- if (bd->dev_id_record) {
- st=CAlloc(40+1);
- for (i=0;i<20;i++)
- st[i]=EndianU16(bd->dev_id_record[27+i]);
- res=MStrUtil(st,SUF_REM_LEADING|SUF_REM_TRAILING);
- Free(st);
- }
- return res;
-}
-
-U8 blkdev_text_attr[BDT_TYPES_NUM]={BLACK,LTCYAN,WHITE,LTGREEN,LTRED,LTBLUE};
-U8 drv_text_attr[3]={BLACK,BLUE,RED};
-
-U8 DrvTextAttrGet(U8 drv_let=0)
-{//Get color of drive.
- drv_let=Let2Let(drv_let);
- if ('A'<=drv_let<='Z')
- return blkdev_text_attr[Let2BlkDevType(drv_let)]<<4|
- drv_text_attr[drv_let%sizeof(drv_text_attr)];
- else
- return BLACK<<4|WHITE;
-}
-
-U0 DrvRep()
-{//Drive report.
- CDrv *dv;
- CBlkDev *bd;
- I64 ch,i,drv_let,attr;
- U8 *st;
- "\nDefined Drives:\n";
- for (i=0,dv=blkdev.drvs;i<DRVS_NUM;i++,dv++) {
- if (dv->dv_signature==DRV_SIGNATURE_VAL) {
- bd=dv->bd;
- drv_let=Drv2Let(dv);
- if (Bt(&dv->fs_type,FStf_DISABLE))
- ch='-';
- else if (drv_let==blkdev.boot_drv_let)
- ch=':';
- else
- ch='+';
- attr=DrvTextAttrGet(drv_let);
- "$FG,%d$$BG,%d$%C %-8Z %-10Z %04X %04X %02X\n",
- attr&15,attr>>4,drv_let,dv->fs_type&FSG_TYPE_MASK,"ST_DRV_TYPES",
- bd->type,"ST_BLKDEV_TYPES",bd->base0,bd->base1,bd->unit;
- if (st=DrvModelNum(drv_let)) {
- "Model#:%s\n",st;
- Free(st);
- }
- if (st=DrvSerialNum(drv_let)) {
- "Serial#:%s\n",st;
- Free(st);
- }
- if (bd->type==BDT_ISO_FILE_READ || bd->type==BDT_ISO_FILE_WRITE)
- "File=\"%s\"\n",bd->file_dsk_name;
- "%016X-%016X\n$FG$$BG$",dv->drv_offset,dv->drv_offset+dv->size-1;
- }
- }
- "Home Dir:\"%s\"\n",blkdev.home_dir;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/BlkDev/DskFile.HC.HTML b/public/src/Kernel/BlkDev/DskFile.HC.HTML deleted file mode 100644 index 3e5a7c8..0000000 --- a/public/src/Kernel/BlkDev/DskFile.HC.HTML +++ /dev/null @@ -1,130 +0,0 @@ - - - - - DskFile.HC - - - - - U8 *FileRead(U8 *filename,I64 *_size=NULL,I64 *_attr=NULL)
-{//Read whole file from disk.
- CHashGeneric *tmph;
- U8 *absname,*altname,*curname,*res=NULL;
- I64 i,size=0,attr=0;
- CDirContext *dirc;
- CArcCompress *arc;
- absname=FileNameAbs(filename);
- altname=ToggleZorNotZ(absname);
- if ((tmph=HashFind(absname,adam_task->hash_table,HTT_FILE))||
- (tmph=HashFind(altname,adam_task->hash_table,HTT_FILE))) {
- size=tmph->user_data1;
- res=MAlloc(size+1);
- MemCpy(res,tmph->user_data0,size);
- res[size]=0; //Terminate
- attr=FileAttr(tmph->str,attr);
- } else {
- for (i=0;i<2 && !res;i++) {//Try name, then altname
- if (!i)
- curname=absname;
- else
- curname=altname;
- if (dirc=DirContextNew(curname)) {
- switch (dirc->dv->fs_type) {
- case FSt_REDSEA:
- res=RedSeaFileRead(dirc->dv,Fs->cur_dir,dirc->mask,&size,&attr);
- break;
- case FSt_FAT32:
- res=FAT32FileRead(dirc->dv,Fs->cur_dir,dirc->mask,&size,&attr);
- break;
- default:
- PrintErr("File System Not Supported\n");
- }
- DirContextDel(dirc);
- }
- }
-
- //Search parent directories.
- for (i=0;i<2 && !res;i++) {//Try name, then altname
- if (!i)
- curname=absname;
- else
- curname=altname;
- if (dirc=DirContextNew(curname)) {
- while (!res && StrCmp(Fs->cur_dir,"/")) {
- Cd("..");
- switch (Fs->cur_dv->fs_type) {
- case FSt_REDSEA:
- res=RedSeaFileRead(dirc->dv,Fs->cur_dir,dirc->mask,&size,&attr);
- break;
- case FSt_FAT32:
- res=FAT32FileRead(dirc->dv,Fs->cur_dir,dirc->mask,&size,&attr);
- break;
- default:
- PrintErr("File System Not Supported\n");
- }
- }
- DirContextDel(dirc);
- }
- }
- if (!res)
- PrintErr("File not found: \"%s\".\n",filename);
- if (res && attr & RS_ATTR_RESIDENT)
- HashGenericAdd(curname,HTT_FILE,AMAllocIdent(res),size,0,adam_task);
- }
- if (res && attr & RS_ATTR_COMPRESSED) {
- arc=res;
- size=arc->expanded_size;
- res=ExpandBuf(arc);
- Free(arc);
- }
- if (_attr) *_attr=attr;
- if (_size) *_size=size;
- Free(absname);
- Free(altname);
- return res;
-}
-
-I64 FileWrite(U8 *filename,U8 *fbuf,I64 size,CDate cdt=0,I64 attr=0)
-{//Write whole file to disk.
- I64 c=0;
- CHashGeneric *tmph;
- CDirContext *dirc;
- U8 *fbuf2,*absname=FileNameAbs(filename);
- if (dirc=DirContextNew(filename,FALSE,TRUE)) {
- attr=FileAttr(dirc->mask,attr);
- if (attr&RS_ATTR_COMPRESSED) {
- fbuf=CompressBuf(fbuf,size);
- size=fbuf(CArcCompress *)->compressed_size;
- fbuf2=fbuf;
- } else
- fbuf2=NULL;
- if (!cdt) cdt=Now;
- switch (dirc->dv->fs_type) {
- case FSt_REDSEA:
- c=RedSeaFileWrite(dirc->dv,Fs->cur_dir,dirc->mask,fbuf,size,cdt,attr);
- break;
- case FSt_FAT32:
- c=FAT32FileWrite(dirc->dv,Fs->cur_dir,dirc->mask,fbuf,size,cdt,attr);
- break;
- default:
- PrintErr("File System Not Supported\n");
- }
- if (tmph=HashFind(absname,adam_task->hash_table,HTT_FILE)) {
- if (attr & RS_ATTR_RESIDENT) {
- Free(tmph->user_data0);
- tmph->user_data0=AMAllocIdent(fbuf);
- tmph->user_data1=size;
- } else
- HashRemDel(tmph,adam_task->hash_table);
- } else if (attr & RS_ATTR_RESIDENT)
- HashGenericAdd(absname,HTT_FILE,AMAllocIdent(fbuf),size,0,adam_task);
- Free(fbuf2);
- DirContextDel(dirc);
- }
- Free(absname);
- return c;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/BlkDev/DskFind.HC.HTML b/public/src/Kernel/BlkDev/DskFind.HC.HTML deleted file mode 100644 index f143a2a..0000000 --- a/public/src/Kernel/BlkDev/DskFind.HC.HTML +++ /dev/null @@ -1,163 +0,0 @@ - - - - - DskFind.HC - - - - - CDirEntry *FilesFind2(U8 *files_find_mask,I64 fuf_flags)
-{
- CDrv *dv=Fs->cur_dv;
- CDirEntry *res=NULL;
- DrvChk(dv);
- switch (dv->fs_type) {
- case FSt_REDSEA:
- res=RedSeaFilesFind(files_find_mask,fuf_flags);
- break;
- case FSt_FAT32:
- res=FAT32FilesFind(files_find_mask,fuf_flags);
- break;
- default:
- PrintErr("File System Not Supported\n");
- res=NULL;
- }
- if (res) {
- DirFilesSort(&res,SK_NAME);
- if (fuf_flags&(FUF_FLATTEN_TREE|FUF_JUST_FILES))
- DirFilesFlatten(res,&res,fuf_flags);
- if (fuf_flags&FUF_CLUS_ORDER)
- DirFilesSort(&res,SK_CLUS);
- }
- return res;
-}
-
-CDirEntry *FilesFind(U8 *files_find_mask,I64 fuf_flags=0)
-{/* See /Doc/FileUtils.DD.
-
-Find files and make a directory tree in memory.
-
-When done, you free with DirEntryDel(),DirEntryDel2(),
-DirTreeDel() or DirTreeDel2().
-
-*/
- CDirEntry *res;
- CDirContext *dirc;
- if (fuf_flags&~FUG_FILES_FIND)
- throw('FUF');
- if (fuf_flags&FUF_SINGLE) {
- res=MAlloc(sizeof(CDirEntry));
- if (!FileFind(files_find_mask,res)) {
- Free(res);
- return NULL;
- }
- } else if (dirc=DirContextNew(files_find_mask,TRUE)) {
- res=FilesFind2(dirc->mask,fuf_flags);
- DirContextDel(dirc);
- } else
- return NULL;
- return res;
-}
-
-Bool FileFind(U8 *filename,CDirEntry *_de=NULL,I64 fuf_flags=0)
-{//FUF_JUST_DIRS, FUF_JUST_FILES, FUF_Z_OR_NOT_Z, FUF_SCAN_PARENTS
-//If you pass _de, you must Free(_de->full_name);
- I64 i,j,cur_dir_clus;
- U8 *altname,*curname,*full_name=NULL;
- CDirEntry de;
- CDirContext *dirc;
- Bool res=FALSE,old_silent;
- if (fuf_flags&~FUG_FILE_FIND)
- throw('FUF');
- if (!filename || *filename && filename[1]==':' && !Let2Drv(*filename,FALSE))
- return FALSE;
- altname=ToggleZorNotZ(filename);
- if (fuf_flags&FUF_Z_OR_NOT_Z)
- j=2;
- else
- j=1;
- for (i=0;i<j && !res;i++) {
- if (!i)
- curname=filename;
- else
- curname=altname;
- old_silent=Silent;
- if (!(dirc=DirContextNew(curname)))
- Silent(old_silent);
- else {
- Silent(old_silent);
- cur_dir_clus=Name2DirClus(dirc->dv,Fs->cur_dir);
- switch (dirc->dv->fs_type) {
- case FSt_REDSEA:
- res=RedSeaFileFind(dirc->dv,cur_dir_clus,dirc->mask,
- &de,fuf_flags);
- break;
- case FSt_FAT32:
- res=FAT32FileFind(dirc->dv,cur_dir_clus,dirc->mask,
- &de,fuf_flags);
- break;
- default:
- PrintErr("File System Not Supported\n");
- }
- if (res && _de) {
- if (StrCmp(Fs->cur_dir,"/"))
- full_name=MStrPrint("%C:%s/%s",
- Drv2Let(Fs->cur_dv),Fs->cur_dir,de.name);
- else
- full_name=MStrPrint("%C:/%s",Drv2Let(Fs->cur_dv),de.name);
- }
- DirContextDel(dirc);
- }
- }
- for (i=0;i<j && !res && fuf_flags&FUF_SCAN_PARENTS;i++) {
- if (!i)
- curname=filename;
- else
- curname=altname;
- old_silent=Silent;
- if (!(dirc=DirContextNew(curname)))
- Silent(old_silent);
- else {
- Silent(old_silent);
- cur_dir_clus=Name2DirClus(dirc->dv,Fs->cur_dir);
- while (!res && StrCmp(Fs->cur_dir,"/")) {
- Cd("..");
- cur_dir_clus=Name2DirClus(dirc->dv,Fs->cur_dir);
- switch (dirc->dv->fs_type) {
- case FSt_REDSEA:
- res=RedSeaFileFind(dirc->dv,cur_dir_clus,
- dirc->mask,&de,fuf_flags);
- break;
- case FSt_FAT32:
- res=FAT32FileFind(dirc->dv,cur_dir_clus,
- dirc->mask,&de,fuf_flags);
- break;
- default:
- PrintErr("File System Not Supported\n");
- }
- }
- if (res && _de) {
- if (StrCmp(Fs->cur_dir,"/"))
- full_name=MStrPrint("%C:%s/%s",
- Drv2Let(Fs->cur_dv),Fs->cur_dir,de.name);
- else
- full_name=MStrPrint("%C:/%s",
- Drv2Let(Fs->cur_dv),de.name);
- }
- DirContextDel(dirc);
- }
- }
- if (_de) {
- if (res) {
- MemCpy(_de,&de,sizeof(CDirEntry));
- _de->full_name=full_name;
- } else
- MemSet(_de,0,sizeof(CDirEntry));
- }
- Free(altname);
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/BlkDev/DskFmt.HC.HTML b/public/src/Kernel/BlkDev/DskFmt.HC.HTML deleted file mode 100644 index 382d869..0000000 --- a/public/src/Kernel/BlkDev/DskFmt.HC.HTML +++ /dev/null @@ -1,104 +0,0 @@ - - - - - DskFmt.HC - - - - - Bool DrvTypeSet(U8 drv_let,I64 type=FSt_REDSEA)
-{//Very dangerous
- I64 i,j,ext_base,drv_num,offset,cur_type;
- CMasterBoot mbr;
- CBlkDev *bd;
- drv_let=Let2Let(drv_let);
- bd=Let2BlkDev(drv_let);
- drv_num=bd->first_drv_let-'A';
- switch (bd->type) {
- case BDT_ATA:
- offset=0;
- ext_base=INVALID_CLUS;
- while (TRUE) {
- ATAReadBlks(bd,&mbr,offset,1);
- j=-1;
- for (i=0;i<4;i++) {
- cur_type=mbr.p[i].type;
- if (cur_type) {
- if (cur_type==5 || cur_type==15)
- j=i;
- else {
- if (drv_num+'A'==drv_let) {
- switch (type) {
- case FSt_REDSEA:
- mbr.p[i].type=MBR_PT_REDSEA;
- break;
- case FSt_FAT32:
- mbr.p[i].type=MBR_PT_FAT32a;
- break;
- default:
- throw('Drv');
- }
- mbr.p[i].active=0x80;
- ATAWriteBlks(bd,&mbr,offset,1);
- return TRUE;
- }
- drv_num++;
- }
- }
- }
- if (j<0)
- break;
- if (!mbr.p[j].offset)
- break;
- if (ext_base==INVALID_CLUS) {
- offset=mbr.p[j].offset;
- ext_base=offset;
- } else
- offset=mbr.p[j].offset+ext_base;
- }
- break;
- }
-}
-
-U0 Fmt(I64 drv_let,Bool quick=TRUE,Bool confirm=TRUE,I64 type=FSt_FAT32)
-{//Format hard drive or RAM drive.
-//Warning: Destroys all prev info.
- //quick=FALSE means fill entire drive with zeros.
- //Choose FSt_FAT32 or FSt_REDSEA.
- //You don't format a CD/DVD with this.
- CDrv *dv=Let2Drv(drv_let);
- Bool old_silent=IsSilent;
- if (confirm && !AreYouSure)
- return;
- if (!dv) {
- PrintErr("Invalid Drive\n");
- return;
- }
- switch (type) {
- case FSt_FAT32:
- if (dv->bd->type==BDT_ATA) {
- Silent;
- Drv(drv_let);
- Silent(old_silent);
- FAT32Fmt(drv_let,quick);
- DskCacheInvalidate(Let2Drv(drv_let));
- Drv(drv_let);
- break;
- }
- "Using RedSea File System.\n";
- case FSt_REDSEA:
- Silent;
- Drv(drv_let);
- Silent(old_silent);
- RedSeaFmt(drv_let,quick);
- DskCacheInvalidate(Let2Drv(drv_let));
- Drv(drv_let);
- break;
- default:
- PrintErr("File System Not Supported\n");
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/BlkDev/DskStrA.HC.HTML b/public/src/Kernel/BlkDev/DskStrA.HC.HTML deleted file mode 100644 index b654b67..0000000 --- a/public/src/Kernel/BlkDev/DskStrA.HC.HTML +++ /dev/null @@ -1,355 +0,0 @@ - - - - - DskStrA.HC - - - - - U8 *FileExtDot(U8 *src)
-{//Find dot char in name.
- I64 ch;
- while (ch=*src++)
- if (ch=='.' && *src!='/' && *src!='.')
- return src-1;
- return NULL;
-}
-
-U8 *FileExtRem(U8 *src,U8 *dst=NULL)
-{//Remove filename extension from str.
- U8 *ptr;
- if (ptr=FileExtDot(src)) {
- if (dst)
- StrCpy(dst,ptr+1);
- *ptr=0;
- } else if (dst)
- *dst=0;
- return dst;
-}
-
-Bool IsDotZ(U8 *filename)
-{//Does name end in .Z?
- I64 i=StrLen(filename);
- if (StrOcc(filename,'.')>1 && filename[i-1]=='Z' && filename[i-2]=='.')
- return TRUE;
- else
- return FALSE;
-}
-
-Bool IsDotC(U8 *filename)
-{//Does name end in .C?
- I64 i=StrLen(filename);
- if (StrOcc(filename,'.')>1 && filename[i-1]=='C' && filename[i-2]=='.')
- return TRUE;
- else
- return FALSE;
-}
-
-Bool FilesFindMatch(U8 *_test_name,U8 *files_find_mask,I64 fuf_flags=0)
-{//Does filename meet Files Find mask?
- I64 tn_len=StrLen(_test_name),mask_len=StrLen(files_find_mask);
- U8 *mask1=MAlloc(mask_len+1),*mask2=MAlloc(mask_len+1),
- *ptr,*test_name1,*test_name2;
- Bool res=FALSE;
- StrCpy(mask1,files_find_mask);
- if (StrOcc(_test_name,'/')) {
- test_name1=MAlloc(tn_len+1);
- test_name2=MAlloc(tn_len+1);
- StrCpy(test_name1,_test_name);
- StrLastRem(test_name1,"/",test_name2);
- } else {
- test_name1=NULL;
- test_name2=NULL;
- }
- while (TRUE) {
- StrFirstRem(mask1,";",mask2);
- if (!test_name2 || StrOcc(mask2,'/'))
- ptr=_test_name;
- else
- ptr=test_name2;
- if (*mask2) {
- if (*mask2=='!') {
- if (WildMatch(ptr,mask2+1)) {
- res=FALSE;
- break;
- }
- } else {
- if (WildMatch(ptr,mask2)) {
- if (Bt(&fuf_flags,FUf_JUST_TXT) &&
- !FilesFindMatch(_test_name,FILEMASK_TXT)) {
- res=FALSE;
- break;
- } else if (Bt(&fuf_flags,FUf_JUST_DD) &&
- !FilesFindMatch(_test_name,FILEMASK_DD)) {
- res=FALSE;
- break;
- } else if (Bt(&fuf_flags,FUf_JUST_SRC) &&
- !FilesFindMatch(_test_name,FILEMASK_SRC)) {
- res=FALSE;
- break;
- } else if (Bt(&fuf_flags,FUf_JUST_AOT) &&
- !FilesFindMatch(_test_name,FILEMASK_AOT)) {
- res=FALSE;
- break;
- } else if (Bt(&fuf_flags,FUf_JUST_JIT) &&
- !FilesFindMatch(_test_name,FILEMASK_JIT)) {
- res=FALSE;
- break;
- } else if (Bt(&fuf_flags,FUf_JUST_GR) &&
- !FilesFindMatch(_test_name,FILEMASK_GR)) {
- res=FALSE;
- break;
- } else
- res=TRUE;
- }
- }
- } else
- break;
- }
- Free(test_name1);
- Free(test_name2);
- Free(mask1);
- Free(mask2);
- return res;
-}
-
-U8 *DirNameAbs(U8 *_dirname)
-{//MAlloc absolute dir string with drv letter.
- I64 maxlen;
- U8 drv[3],*res,*buf,*buf2,*buf3,*buf4,*dirname,*free_dirname;
- if (!Fs->cur_dir || !*Fs->cur_dir)
- return StrNew(_dirname);
- free_dirname=dirname=MStrUtil(_dirname,
- SUF_REM_LEADING|SUF_REM_TRAILING|SUF_REM_CTRL_CHARS);
- *drv=Drv2Let;
- drv[1]=':';
- drv[2]=0;
- if (*dirname && dirname[1]==':') {
- if (*dirname==':')
- *drv=blkdev.boot_drv_let;
- else if (*dirname=='~')
- *drv=*blkdev.home_dir;
- else
- *drv=*dirname;
- dirname=dirname+2;
- buf=StrNew("/");
- } else
- buf=StrNew(Fs->cur_dir);
- if (*dirname=='/') {
- Free(buf);
- buf=StrNew("/");
- dirname++;
- }
- buf2=StrNew(dirname);
- maxlen=StrLen(buf)+1+StrLen(buf2)+1;
- buf3=MAlloc(maxlen);
- buf4=MAlloc(maxlen);
- StrCpy(buf3,buf);
- while (*buf2) {
- StrFirstRem(buf2,"/",buf4);
- if (!*buf4)
- StrCpy(buf3,"/");
- else if (!StrCmp(buf4,"..")) {
- StrLastRem(buf3,"/");
- if (!*buf3)
- StrCpy(buf3,"/");
- } else if (!StrCmp(buf4,"~")) {
- Free(buf3);
- buf3=MAlloc(StrLen(blkdev.home_dir+2)+1+StrLen(buf2)+1);
- StrCpy(buf3,blkdev.home_dir+2);
- *drv=*blkdev.home_dir;
- } else if (!StrCmp(buf4,"."));
- else if (*buf4) {
- if (StrCmp(buf3,"/"))
- CatPrint(buf3,"/");
- CatPrint(buf3,buf4);
- }
- }
- Free(buf);
- res=MAlloc(StrLen(buf3)+3);
- StrCpy(res,drv);
- StrCpy(res+2,buf3);
- Free(buf2);
- Free(buf3);
- Free(buf4);
- Free(free_dirname);
- return res;
-}
-
-U8 *FileNameAbs(U8 *_filename,I64 fuf_flags=0)
-{//Absolute filename. Accepts FUF_Z_OR_NOT_Z, FUF_SCAN_PARENTS.
- U8 *res,*filename,*buf,*buf_file,*buf_dir,*free_filename,*free_buf;
- CDirEntry de;
- free_filename=filename=MStrUtil(_filename,
- SUF_REM_LEADING|SUF_REM_TRAILING|SUF_REM_CTRL_CHARS);
- free_buf=buf=StrNew(filename);
- if (*buf && buf[1]==':') {
- buf+=2;
- filename+=2;
- }
- buf_file=MAlloc(StrLen(free_filename)+1);
- StrLastRem(buf,"/",buf_file);
- if (*filename=='/' && !*buf)
- StrCpy(buf,"/");
- buf_dir=DirNameAbs(free_buf);
- Free(free_buf);
- res=MAlloc(StrLen(buf_dir)+1+StrLen(buf_file)+1);
- StrCpy(res,buf_dir);
- if (res[StrLen(res)-1]!='/')
- CatPrint(res,"/");
- CatPrint(res,buf_file);
- Free(buf_file);
- Free(buf_dir);
- Free(free_filename);
- if (fuf_flags && FileFind(res,&de,fuf_flags|FUF_JUST_FILES)) {
- Free(res);
- res=de.full_name;
- }
- return res;
-}
-
-U8 *ExtChg(U8 *filename,U8 *extension)
-{//Change filename extension.
- U8 *res=MAlloc(StrLen(filename)+1+StrLen(extension)+1);
- StrCpy(res,filename);
- if (FileExtDot(filename))
- FileExtRem(res);
- return CatPrint(res,".%s",extension);
-}
-
-U8 *ExtDft(U8 *filename,U8 *extension)
-{//Give extension if has none.
- U8 *res=MAlloc(StrLen(filename)+1+StrLen(extension)+1);
- StrCpy(res,filename);
- if (!FileExtDot(filename))
- CatPrint(res,".%s",extension);
- return res;
-}
-
-CDirEntry *Cd2DirEntry(CDirEntry *tmpde,U8 *abs_name)
-{
- I64 i;
- while (tmpde) {
- i=StrLen(tmpde->full_name);
- if (StrNCmp(tmpde->full_name,abs_name,i)||
- i && tmpde->full_name[i-1]!='/' && abs_name[i] && abs_name[i]!='/')
- tmpde=tmpde->next;
- else
- if (StrLen(abs_name)==i)
- return tmpde;
- else
- return Cd2DirEntry(tmpde->sub,abs_name);
- }
- return NULL;
-}
-
-I64 FileAttr(U8 *name,I64 attr=0)
-{
- if (IsDotZ(name))
- attr|=RS_ATTR_COMPRESSED;
- else
- attr&=~RS_ATTR_COMPRESSED;
- if (IsDotC(name))
- attr|=RS_ATTR_CONTIGUOUS;
- return attr;
-}
-
-Bool FileNameChk(U8 *filename)
-{//Return check for valid filename, not checking existence.
- U8 *ptr=filename;
- if (!filename) return FALSE;
- if (!*ptr) return FALSE;
- if (*ptr=='.') {
- if (!ptr[1]) return TRUE;
- if (ptr[1]=='.' && !ptr[2]) return TRUE;
- }
- if (StrLen(filename)>=CDIR_FILENAME_LEN) return FALSE;
- while (*ptr)
- if (!Bt(char_bmp_filename,*ptr++))
- return FALSE;
- return TRUE;
-}
-
-U8 *ToggleZorNotZ(U8 *name)
-{//MAlloc name with Z if not Z or vice versa.
- U8 *res;
- if (IsDotZ(name)) {
- res=StrNew(name);
- res[StrLen(name)-2]=0;
- } else
- res=MStrPrint("%s.Z",name);
- return res;
-}
-
-U8 *FileNameTmpTxt()
-{//Make pretty-safe tmp filename in home dir.
- return MStrPrint("~/SysTmp%X.DD.Z",GetTSC>>8&0xFFFFFFFF);
-}
-
-U8 *DirCur(CTask *task=NULL,CTask *mem_task=NULL)
-{//MAlloc copy of cur dir with drv letter.
- U8 *st;
- if (!task) task=Fs;
- if (!task->cur_dir)
- return NULL;
- st=MAlloc(StrLen(task->cur_dir)+3,mem_task);
- *st=Drv2Let(task->cur_dv);
- st[1]=':';
- StrCpy(st+2,task->cur_dir);
- return st;
-}
-
-U8 *DirFile(U8 *dirname,U8 *name=NULL,U8 *_extension=NULL)
-{/*Strips file from dirname, scans for file upward until found or
-returns default.
-
-("/Kernel/KHashA.HC.Z",NULL,NULL) returns "D:/Kernel"
-("/Kernel",NULL,"PRJ.Z") returns "D:/Kernel/Kernel.PRJ.Z"
-("/Kernel/BlkDev",NULL,"PRJ.Z") returns "D:/Kernel/Kernel.PRJ.Z"
-("/Apps/Psalmody","Load","HC.Z") returns "D:/Apps/Psalmody/Load.HC.Z"
-*/
- U8 *st=DirNameAbs(dirname),*st2,*st3,*res,*dft=NULL,*ext;
- if (_extension && *_extension) {
- if (*_extension=='.')
- ext=StrNew(_extension);
- else
- ext=MStrPrint(".%s",_extension);
- } else
- ext=StrNew("");
- while (StrOcc(st,'/')&&!IsDir(st))
- StrLastRem(st,"/");
- while (StrOcc(st,'/')) {
- st2=StrNew(st);
- st3=StrNew(st);
- StrLastRem(st2,"/",st3);
-
- if (name)
- res=MStrPrint("%s/%s%s",st,name,ext);
- else {
- if (*ext)
- res=MStrPrint("%s/%s%s",st,st3,ext);
- else
- res=StrNew(st);
- }
- if (!dft)
- dft=StrNew(res);
- if (!*ext && (!name||!*name) || FileFind(res)) {
- Free(st3);
- Free(st2);
- Free(st);
- Free(dft);
- Free(ext);
- return res;
- }
- Free(st);
- st=st2;
- Free(st3);
- }
- Free(st);
- Free(ext);
- return dft;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/BlkDev/DskStrB.HC.HTML b/public/src/Kernel/BlkDev/DskStrB.HC.HTML deleted file mode 100644 index 20c139e..0000000 --- a/public/src/Kernel/BlkDev/DskStrB.HC.HTML +++ /dev/null @@ -1,101 +0,0 @@ - - - - - DskStrB.HC - - - - - Bool CFileNameTo(U8 *dst,U8 *src)
-{
- MemSet(dst,0,CDIR_FILENAME_LEN);
- if (!FileNameChk(src))
- return FALSE;
- StrCpy(dst,src);
- return TRUE;
-}
-
-I64 Name2DirClus(CDrv *dv,U8 *dirname)
-{
- Bool cont=TRUE,unlock;
- I64 cur_dir_clus;
- CDirEntry de;
- U8 *buf=StrNew(dirname),*buf2=StrNew(dirname);
- DrvChk(dv);
- try {
- unlock=DrvLock(dv);
- cur_dir_clus=dv->root_clus;
- while (*buf && cont) {
- StrFirstRem(buf,"/",buf2);
- if (*buf2) {
- switch (dv->fs_type) {
- case FSt_REDSEA:
- cont=RedSeaFileFind(dv,cur_dir_clus,buf2,&de,FUF_JUST_DIRS);
- break;
- case FSt_FAT32:
- cont=FAT32FileFind(dv,cur_dir_clus,buf2,&de,FUF_JUST_DIRS);
- break;
- default:
- throw('Drv');
- }
- cur_dir_clus=de.clus;
- }
- }
- if (!cont) {
- PrintErr("File not found: \"%s\".\n",dirname);
- cur_dir_clus=0;
- }
- if (unlock)
- DrvUnlock(dv);
- } catch
- if (unlock)
- DrvUnlock(dv);
- Free(buf);
- Free(buf2);
- return cur_dir_clus;
-}
-
-I64 Name2ParentDirClus(CDrv *dv,U8 *dirname)
-{
- Bool cont=TRUE,unlock;
- I64 cur_dir_clus,cur_dir_clus2;
- CDirEntry de;
- U8 *buf=StrNew(dirname),*buf2=StrNew(dirname);
- DrvChk(dv);
- try {
- unlock=DrvLock(dv);
- cur_dir_clus=cur_dir_clus2=dv->root_clus;
- while (*buf && cont) {
- cur_dir_clus2=cur_dir_clus;
- StrFirstRem(buf,"/",buf2);
- if (*buf2) {
- switch (dv->fs_type) {
- case FSt_REDSEA:
- cont=RedSeaFileFind(dv,cur_dir_clus,buf2,&de,FUF_JUST_DIRS);
- break;
- case FSt_FAT32:
- cont=FAT32FileFind(dv,cur_dir_clus,buf2,&de,FUF_JUST_DIRS);
- break;
- default:
- throw('Drv');
- }
- cur_dir_clus=de.clus;
- }
- }
- if (!cont) {
- PrintErr("File not found: \"%s\".\n",dirname);
- cur_dir_clus2=0;
- }
- if (unlock)
- DrvUnlock(dv);
- } catch
- if (unlock)
- DrvUnlock(dv);
- Free(buf);
- Free(buf2);
- return cur_dir_clus2;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/BlkDev/FileSysFAT.HC.HTML b/public/src/Kernel/BlkDev/FileSysFAT.HC.HTML deleted file mode 100644 index 713634f..0000000 --- a/public/src/Kernel/BlkDev/FileSysFAT.HC.HTML +++ /dev/null @@ -1,971 +0,0 @@ - - - - - FileSysFAT.HC - - - - - U0 CDate2Dos(U16 *t,U16 *d,CDate cdt)
-{
- CDateStruct ds;
- Date2Struct(&ds,cdt);
- *d=ds.day_of_mon+(ds.mon+(ds.year-1980)<<4)<<5;
- *t=ds.sec>>1+(ds.min+ds.hour<<6)<<5;
-}
-
-CDate Dos2CDate(U16 t,U16 d)
-{
- CDateStruct ds;
- MemSet(&ds,0,sizeof(CDateStruct));
- ds.day_of_mon=d&0x1F; d=d>>5;
- ds.mon=d&0xF;
- ds.year=d>>4+1980;
- ds.sec=(t&0x1F)*2; t=t>>5;
- ds.min=t&0x3F;
- ds.hour=t>>6;
- return Struct2Date(&ds);
-}
-
-U0 FAT32Init(CDrv *dv)
-{
- CFAT32Boot br32;
- Bool unlock;
- try {
- unlock=DrvLock(dv);
- dv->fs_type=FSt_FAT32;
- BlkRead(dv,&br32,dv->drv_offset,1);
- dv->file_system_info_sect=dv->drv_offset+br32.file_system_info_sect;
- dv->fat1=dv->drv_offset+br32.reserved_sects;
- dv->fat2=dv->fat1+br32.sects_per_fat;
- dv->data_area=dv->fat2+br32.sects_per_fat
- -2*br32.sects_per_clus; //Starts at Clus 2
- dv->spc=br32.sects_per_clus;
- dv->root_clus=br32.root_clus;
- DrvFATBlkAlloc(dv);
- Free(dv->fis);
- dv->fis=AMAlloc(BLK_SIZE);
- BlkRead(dv,dv->fis,dv->file_system_info_sect,1);
- if (unlock)
- DrvUnlock(dv);
- } catch
- if (unlock)
- DrvUnlock(dv);
-}
-
-U0 FAT32Fmt(U8 drv_let,Bool quick=TRUE)
-{
- CFAT32Boot *br=CAlloc(BLK_SIZE);
- CFAT32FileInfoSect *fis=CAlloc(BLK_SIZE);
- CDrv *dv=Let2Drv(drv_let);
- I64 i,l;
- try {
- DrvLock(dv);
- DrvTypeSet(drv_let,FSt_FAT32);
- dv->fs_type=FSt_FAT32;
- br->jump_and_nop[0]=OC_JMP_REL8;
- br->jump_and_nop[1]=offset(CFAT32Boot.code)-2;
- br->jump_and_nop[2]=OC_NOP;
- br->oem_name[0](I64)='MSWIN4.1';
- br->bytes_per_sect=BLK_SIZE;
- if (dv->size<= 500000)
- br->sects_per_clus=1;
- else if (dv->size<=2000000)
- br->sects_per_clus=2;
- else if (dv->size<=6000000)
- br->sects_per_clus=4;
- else if (dv->size<=12000000)
- br->sects_per_clus=8;
- else if (dv->size<=33000000)
- br->sects_per_clus=16;
- else if (dv->size<=67000000)
- br->sects_per_clus=32;
- else
- br->sects_per_clus=64;
-
- br->reserved_sects=32;
- br->copies_of_fat=2;
- br->media_desc=0xF8;
- br->sects=dv->size;
- l=(br->sects/br->sects_per_clus)>>(BLK_SIZE_BITS-2)+1;
- br->sects_per_fat=l;
- br->root_clus=2;
- br->file_system_info_sect=1;
- br->log_drv_num=0x80;
- br->ext_signature=0x29;
- br->serial_num=RandU32;
- MemCpy(br->vol_name,"NONAME",11);
- br->fat_name[0](I64)='FAT32';
- br->signature=0xAA55;
- fis->signature1='RRaA';
- fis->signature2='rrAa';
- fis->free_clus=-1;
- fis->most_recently_alloced=0;
- fis->signature3=0xAA550000;
-
- if (quick)
- i=br->reserved_sects+2*l+4*br->sects_per_clus;
- else
- i=dv->size;
- BlkWriteZero(dv,dv->drv_offset,i);
-
- BlkWrite(dv,fis,dv->drv_offset+br->file_system_info_sect,1);
- BlkWrite(dv,br,dv->drv_offset,1);
- FAT32Init(dv);
- ClusAlloc(dv,0,1,FALSE); //Alloc #1
- br->root_clus=ClusAlloc(dv,0,1,FALSE);
- BlkWrite(dv,br,dv->drv_offset,1);
- FAT32Init(dv);
- DrvUnlock(dv);
- } catch
- DrvUnlock(dv);
- Free(br);
- Free(fis);
-}
-
-Bool FATNameTo(U8 *dst,U8 *src)
-{
- I64 i;
- MemSet(dst,CH_SPACE,11);
- if (!FileNameChk(src))
- return FALSE;
- if (!StrCmp(src,"..")) {
- *dst='.';
- dst[1]='.';
- return TRUE;
- } else if (!StrCmp(src,".")) {
- *dst='.';
- return TRUE;
- }
- i=0;
- while (i<8 && *src && *src!='.')
- dst[i++]=ToUpper(*src++);
- i=8;
- if (*src=='.') src++;
- while (*src)
- if (*src!='.')
- dst[i++]=ToUpper(*src++);
- else
- src++;
- return TRUE;
-}
-
-I64 FATNameXSum(U8 *src)
-{
- I64 i,res=0;
- for (i=0;i<11;i++)
- if (res&1)
- res.u8[0]=0x80+res>>1+*src++;
- else
- res.u8[0]=res>>1+*src++;
- return res;
-}
-
-Bool FATFromName(U8 *dst,U8 *src)
-{
- I64 i,j,k=0;
- for (j=7;j>=0 && src[j]==CH_SPACE;j--);
- for(i=0;i<=j;i++)
- dst[k++]=src[i];
- for (j=10;j>=8 && src[j]==CH_SPACE;j--);
- if (*src!='.' && j!=7)
- dst[k++]='.';
- for(i=8;i<=j;i++)
- dst[k++]=src[i];
- dst[k++]=0;
- return FileNameChk(dst);
-}
-
-U8 fat_long_name_map[13]={
- offset(CFAT32DirEntryLong.name1),
- offset(CFAT32DirEntryLong.name1)+2,
- offset(CFAT32DirEntryLong.name1)+4,
- offset(CFAT32DirEntryLong.name1)+6,
- offset(CFAT32DirEntryLong.name1)+8,
- offset(CFAT32DirEntryLong.name2),
- offset(CFAT32DirEntryLong.name2)+2,
- offset(CFAT32DirEntryLong.name2)+4,
- offset(CFAT32DirEntryLong.name2)+6,
- offset(CFAT32DirEntryLong.name2)+8,
- offset(CFAT32DirEntryLong.name2)+10,
- offset(CFAT32DirEntryLong.name3),
- offset(CFAT32DirEntryLong.name3)+2
-};
-
-Bool DirLongNameFill(CDirEntry *tmpde,CFAT32DirEntryLong *de,I64 *xsum)
-{
- I64 i;
- U8 *ptr=de;
- if (de->ord&0x40) {
- MemSet(tmpde,0,sizeof(CDirEntry));
- *xsum=de->xsum;
- } else if (de->type || de->zero || de->xsum!=*xsum) {
- MemSet(tmpde,0,sizeof(CDirEntry));
- *xsum=0;
- return FALSE;
- }
- switch (de->ord&0x3F) {
- case 1:
- for (i=0;i<13;i++)
- if (!(tmpde->name[i]=ptr[fat_long_name_map[i]]))
- return TRUE;
- break;
- case 2:
- for (i=0;i<12;i++)
- if (!(tmpde->name[i+13]=ptr[fat_long_name_map[i]]))
- return TRUE;
- break;
- }
- return TRUE;
-}
-
-Bool FAT32CDirFill(CDirEntry *tmpde,
- CFAT32DirEntry *de,CDate _local_time_offset)
-{
- Bool res;
- if (*tmpde->name)
- res=TRUE;
- else
- res=FATFromName(tmpde->name,de->name);
- tmpde->clus=de->clus_lo+de->clus_hi<<16;
- tmpde->size=de->size;
- tmpde->attr=de->attr;
- tmpde->datetime=Dos2CDate(de->WrtTime,de->WrtDate)-_local_time_offset;
- return res;
-}
-
-Bool FAT32DirFill(CFAT32DirEntry *de,
- CDirEntry *tmpde,I64 *_de_cnt,CDate _local_time_offset)
-{//Fill up to 3 entries and store cnt of entries.
- I64 de_cnt=0,i,l,xsum,ord;
- U8 *ptr,dname[16];
- CFAT32DirEntryLong *ld=de;
- Bool res;
-
- MemSet(de,0,sizeof(CFAT32DirEntry));
- res=FATNameTo(de->name,tmpde->name);
- FATFromName(dname,de->name);
- if (StrCmp(dname,tmpde->name)) {
- ord=0x41;
- xsum=FATNameXSum(de->name);
- if ((l=StrLen(tmpde->name))>13) {
- ptr=&ld[de_cnt];
- MemSet(ptr,0,sizeof(CFAT32DirEntryLong));
- ld[de_cnt].attr=RS_ATTR_LONG_NAME;
- ld[de_cnt].xsum=xsum;
- ld[de_cnt].ord=0x42;
- for (i=13;i<l;i++)
- ptr[fat_long_name_map[i-13]]=tmpde->name[i];
- i++;
- for (;i<26;i++)
- ptr[fat_long_name_map[i-13]](U16)=0xFFFF;
- ord=1;
- l=13;
- de_cnt++;
- }
- ptr=&de[de_cnt];
- MemSet(ptr,0,sizeof(CFAT32DirEntryLong));
- ld[de_cnt].attr=RS_ATTR_LONG_NAME;
- ld[de_cnt].xsum=xsum;
- ld[de_cnt].ord=ord;
- for (i=0;i<l;i++)
- ptr[fat_long_name_map[i]]=tmpde->name[i];
- i++;
- for (;i<13;i++)
- ptr[fat_long_name_map[i]](U16)=0xFFFF;
- de_cnt++;
- MemSet(&de[de_cnt],0,sizeof(CFAT32DirEntry));
- res=FATNameTo(de[de_cnt].name,tmpde->name);
- }
- de[de_cnt].clus_lo=tmpde->clus.u16[0];
- de[de_cnt].clus_hi=tmpde->clus.u16[1];
- if (!(tmpde->attr&RS_ATTR_DIR))
- de[de_cnt].size=tmpde->size;
- de[de_cnt].attr=tmpde->attr;
- if (!tmpde->datetime)
- tmpde->datetime=Now;
- CDate2Dos(&de[de_cnt].WrtTime,&de[de_cnt].WrtDate,
- tmpde->datetime+_local_time_offset);
- if (_de_cnt)
- *_de_cnt=de_cnt+1;
- return res;
-}
-
-Bool FAT32FileFind(CDrv *dv,I64 cur_dir_clus,
- U8 *name,CDirEntry *_res,I64 fuf_flags=0)
-{//FUF_JUST_DIRS, FUF_JUST_FILES
- Bool res=FALSE,unlock;
- CFAT32DirEntry *buf;
- I64 xsum=0,attr,cur_dir_entry,entries_per_clus;
- U8 dname[CDIR_FILENAME_LEN],ch;
- CDirEntry long_name;
- if (fuf_flags&~FUG_FILE_FIND)
- throw('FUF');
- MemSet(_res,0,sizeof(CDirEntry));
- MemSet(&long_name,0,sizeof(CDirEntry));
- DrvChk(dv);
- if (dv->fs_type!=FSt_FAT32)
- PrintErr("Not FAT32 Drv\n");
- else if (!CFileNameTo(dname,name))
- PrintErr("Invalid FileName: \"%s\".\n",name);
- else
- try {
- unlock=DrvLock(dv);
- buf=MAlloc(BLK_SIZE*dv->spc);
- entries_per_clus=dv->spc<<FAT32_ENTRIES_BITS;
- ClusRead(dv,buf,cur_dir_clus,1);
- cur_dir_entry=0;
- while (ch=*buf[cur_dir_entry].name) {
- attr=buf[cur_dir_entry].attr;
- if (ch!=0xE5) {
- if (attr&RS_ATTR_LONG_NAME_MASK==RS_ATTR_LONG_NAME)
- DirLongNameFill(&long_name,&buf[cur_dir_entry],&xsum);
- else {
- if (!(attr&RS_ATTR_VOL_ID)) {
- if (xsum==FATNameXSum(buf[cur_dir_entry].name))
- MemCpy(_res,&long_name,sizeof(CDirEntry));
- else
- MemSet(_res,0,sizeof(CDirEntry));
- if (!(fuf_flags&FUF_JUST_DIRS && !(attr & RS_ATTR_DIR)) &&
- !(fuf_flags&FUF_JUST_FILES && attr & RS_ATTR_DIR) &&
- FAT32CDirFill(_res,&buf[cur_dir_entry],
- dv->fat32_local_time_offset) &&
- !StrCmp(dname,_res->name)) {
- res=TRUE;
- goto fff_done;
- }
- }
- MemSet(&long_name,0,sizeof(CDirEntry));
- }
- } else
- MemSet(&long_name,0,sizeof(CDirEntry));
- if (++cur_dir_entry==entries_per_clus) {
- cur_dir_clus=ClusNumNext(dv,cur_dir_clus);
- if (!(0<cur_dir_clus<0x0FFFFFF8))
- break;
- else {
- ClusRead(dv,buf,cur_dir_clus,1);
- cur_dir_entry=0;
- }
- }
- }
- MemSet(_res,0,sizeof(CDirEntry));
-fff_done:
- Free(buf);
- if (unlock)
- DrvUnlock(dv);
- } catch
- if (unlock)
- DrvUnlock(dv);
- return res;
-}
-
-U8 *FAT32FileRead(CDrv *dv,U8 *cur_dir,U8 *filename,I64 *_size,I64 *_attr)
-{
- U8 *buf=NULL;
- CDirEntry de;
- I64 c,blk_cnt,cur_dir_clus;
- DrvChk(dv);
- *_size=0;
- *_attr=0;
- if (dv->fs_type!=FSt_FAT32)
- PrintErr("Not FAT32 Drv\n");
- else
- try {
- DrvLock(dv);
- cur_dir_clus=Name2DirClus(dv,cur_dir);
- if (FAT32FileFind(dv,cur_dir_clus,filename,&de,FUF_JUST_FILES)) {
- blk_cnt=(de.size+BLK_SIZE-1)>>BLK_SIZE_BITS;
- buf=MAlloc(blk_cnt<<BLK_SIZE_BITS+1);
- c=de.clus;
- if (!(0<c<0x0FFFFFF8))
- c=0x0FFFFFFF;
- else
- c=ClusBlkRead(dv,buf,c,blk_cnt);
- buf[de.size]=0; //Terminate
- *_size=de.size;
- *_attr=FileAttr(de.name,de.attr);
- }
- DrvUnlock(dv);
- } catch
- DrvUnlock(dv);
- return buf;
-}
-
-Bool FAT32Cd(U8 *name,I64 cur_dir_clus)
-{
- CDirEntry de;
- if (Fs->cur_dv->fs_type!=FSt_FAT32)
- PrintErr("Not FAT32 Drv\n");
- else if (FAT32FileFind(Fs->cur_dv,cur_dir_clus,name,&de,FUF_JUST_DIRS))
- return TRUE;
- else
- PrintErr("File not found: \"%s\".\n",name);
- return FALSE;
-}
-
-U0 FAT32FreeClus(CDrv *dv,I64 c)
-{
- I64 next,saved_c=c;
- Bool unlock,unlock_break;
- DrvChk(dv);
- if (!(0<c<0x0FFFFFF8)) return;
- if (dv->fs_type!=FSt_FAT32)
- PrintErr("Not FAT32 Drv\n");
- else
- try {
- unlock_break=BreakLock;
- unlock=DrvLock(dv);
- DrvFATBlkClean(dv);
- do {
- DrvFATBlkSet(dv,c,0);
- next=dv->cur_fat_blk[c&(BLK_SIZE/4-1)];
- dv->cur_fat_blk[c&(BLK_SIZE/4-1)]=0;
- LBts(&dv->fat_blk_dirty,0);
- c=next;
- } while (0<c<0x0FFFFFF8);
- DrvFATBlkClean(dv,0);
-
- c=saved_c;
- do {
- DrvFATBlkSet(dv,c,1);
- next=dv->cur_fat_blk[c&(BLK_SIZE/4-1)];
- dv->cur_fat_blk[c&(BLK_SIZE/4-1)]=0;
- LBts(&dv->fat_blk_dirty,0);
- c=next;
- } while (0<c<0x0FFFFFF8);
- DrvFATBlkClean(dv,1);
- if (unlock)
- DrvUnlock(dv);
- if (unlock_break)
- BreakUnlock;
- } catch {
- if (unlock)
- DrvUnlock(dv);
- if (unlock_break)
- BreakUnlock;
- }
-}
-
-I64 FAT32AllocClus(CDrv *dv,I64 c,I64 cnt)
-{
- Bool wrap_around=FALSE,unlock,unlock_break;
- I64 first=INVALID_CLUS,j,l;
-
- if (cnt<=0) return 0x0FFFFFFF;
- try {
- unlock_break=BreakLock;
- unlock=DrvLock(dv);
- l=(dv->size+dv->drv_offset-dv->data_area)/dv->spc-1;
- j=dv->fis->most_recently_alloced;
- while (cnt-->0) {
- while (TRUE) {
- j++;
- if (j<1) j=1;
- if (j>=l) {
- if (wrap_around)
- throw('Drv');
- j=1;
- wrap_around=TRUE;
- }
- DrvFATBlkSet(dv,j);
- if (!dv->cur_fat_blk[j&(BLK_SIZE/4-1)])
- break;
- }
- if (!(0<first<0x0FFFFFF8))
- first=j;
- if (0<c<l) {
- DrvFATBlkSet(dv,c);
- dv->cur_fat_blk[c&(BLK_SIZE/4-1)]=j;
- LBts(&dv->fat_blk_dirty,0);
- }
- c=j;
- }
-
- if (0<c<l) {
- DrvFATBlkSet(dv,c);
- dv->cur_fat_blk[c&(BLK_SIZE/4-1)]=0x0FFFFFFF;
- LBts(&dv->fat_blk_dirty,0);
- }
- DrvFATBlkClean(dv);
-
- dv->fis->most_recently_alloced=j;
- dv->fis->free_clus=-1;
- BlkWrite(dv,dv->fis,dv->file_system_info_sect,1);
- } catch {
- if (unlock)
- DrvUnlock(dv);
- if (unlock_break)
- BreakUnlock;
- }
- if (unlock)
- DrvUnlock(dv);
- if (unlock_break)
- BreakUnlock;
- return first;
-}
-
-I64 FAT32AllocContiguousClus(CDrv *dv,I64 cnt)
-{
- I64 i,first=1;
- Bool cont,unlock,unlock_break;
-
- if (cnt<=0) return 0x0FFFFFFF;
- try {
- unlock_break=BreakLock;
- unlock=DrvLock(dv);
- while (TRUE) {
- first++;
- i=0;
- cont=TRUE;
- while (cont && i<cnt) {
- if ((first+i+1)*dv->spc+dv->data_area>dv->size+dv->drv_offset)
- throw('Drv');
- DrvFATBlkSet(dv,first+i);
- if (dv->cur_fat_blk[(first+i)&(BLK_SIZE/4-1)])
- cont=FALSE;
- else
- i++;
- }
- if (!cont)
- first=first+i;
- else {
- DrvFATBlkClean(dv);
-
- for (i=0;i<cnt;i++) {
- DrvFATBlkSet(dv,first+i,0);
- if (i+1==cnt)
- dv->cur_fat_blk[(first+i)&(BLK_SIZE/4-1)]=0x0FFFFFFF;
- else
- dv->cur_fat_blk[(first+i)&(BLK_SIZE/4-1)]=first+i+1;
- LBts(&dv->fat_blk_dirty,0);
- }
- DrvFATBlkClean(dv,0);
-
- for (i=0;i<cnt;i++) {
- DrvFATBlkSet(dv,first+i,1);
- if (i+1==cnt)
- dv->cur_fat_blk[(first+i)&(BLK_SIZE/4-1)]=0x0FFFFFFF;
- else
- dv->cur_fat_blk[(first+i)&(BLK_SIZE/4-1)]=first+i+1;
- LBts(&dv->fat_blk_dirty,0);
- }
- DrvFATBlkClean(dv,1);
- break;
- }
- }
- } catch {
- if (unlock)
- DrvUnlock(dv);
- if (unlock_break)
- BreakUnlock;
- }
- if (unlock)
- DrvUnlock(dv);
- if (unlock_break)
- BreakUnlock;
- return first;
-}
-
-Bool FAT32DirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
-{
-//See /Doc/CutCorners.DD.
- CFAT32DirEntry *buf,*last_buf,*tmp_buf,de[3];
- I64 i,attr,avail_cnt,de_cnt,c,
- cur_dir_entry,entries_per_clus,
- cur_dir_clus,xsum=0,last_dir_clus=INVALID_CLUS;
- U8 ch;
- Bool written=FALSE,unlock,unlock_break;
- CDirEntry long_name;
- FAT32DirFill(&de,tmpde,&de_cnt,dv->fat32_local_time_offset);
- MemSet(&long_name,0,sizeof(CDirEntry));
- try {
- unlock_break=BreakLock;
- unlock=DrvLock(dv);
- cur_dir_clus=Name2DirClus(dv,cur_dir);
- buf =MAlloc(BLK_SIZE*dv->spc);
- last_buf=CAlloc(BLK_SIZE*dv->spc);
- entries_per_clus=dv->spc<<FAT32_ENTRIES_BITS;
- ClusRead(dv,buf,cur_dir_clus,1);
- cur_dir_entry=0;
- while (ch=*buf[cur_dir_entry].name) {
- attr=buf[cur_dir_entry].attr;
- if (ch!=0xE5 && attr&RS_ATTR_LONG_NAME_MASK==RS_ATTR_LONG_NAME)
- DirLongNameFill(&long_name,&buf[cur_dir_entry],&xsum);
- else {
- avail_cnt=FAT32_ENTRIES_PER_BLK-cur_dir_entry
- &(FAT32_ENTRIES_PER_BLK-1);
- for (i=0;i<avail_cnt;i++)
- if (*buf[cur_dir_entry+i].name!=0xE5) {
- if (*buf[cur_dir_entry+i].name)
- avail_cnt=i;
- break;
- }
- if (ch==0xE5 && !written && avail_cnt>=de_cnt) {
- MemCpy(&buf[cur_dir_entry],&de,de_cnt*sizeof(CFAT32DirEntry));
- BlkWrite(dv,&buf[cur_dir_entry & -FAT32_ENTRIES_PER_BLK],
- dv->data_area+cur_dir_clus*dv->spc
- +cur_dir_entry>>FAT32_ENTRIES_BITS,1);
- cur_dir_entry+=de_cnt-1; //gets inc'ed
- written=TRUE;
- } else if (ch!=0xE5 && !(attr&RS_ATTR_VOL_ID)) {
- if (xsum!=FATNameXSum(buf[cur_dir_entry].name))
- MemSet(&long_name,0,sizeof(CDirEntry));
- if (!*long_name.name)
- FATFromName(long_name.name,buf[cur_dir_entry].name);
-//Del old entry with same name
- if (!StrCmp(long_name.name,tmpde->name)) {
- if (free_old_chain)
- FAT32FreeClus(dv,buf[cur_dir_entry].clus_lo+
- buf[cur_dir_entry].clus_hi<<16);
- if (!written) {
- MemCpy(&buf[cur_dir_entry],&de[de_cnt-1],sizeof(CFAT32DirEntry));
- BlkWrite(dv,&buf[cur_dir_entry & -FAT32_ENTRIES_PER_BLK],
- dv->data_area+cur_dir_clus*dv->spc
- +cur_dir_entry>>FAT32_ENTRIES_BITS,1);
- written=TRUE;
- } else {
- *buf[cur_dir_entry].name=0xE5;
- i=1;
- while (i<=cur_dir_entry &&
- buf[cur_dir_entry-i].attr&RS_ATTR_LONG_NAME_MASK
- ==RS_ATTR_LONG_NAME)
- *buf[cur_dir_entry-i++].name=0xE5;
- i--;
- BlkWrite(dv,&buf[(cur_dir_entry-i)&-FAT32_ENTRIES_PER_BLK],
- dv->data_area+cur_dir_clus*dv->spc
- +(cur_dir_entry-i)>>FAT32_ENTRIES_BITS,
- (i+FAT32_ENTRIES_PER_BLK)>>FAT32_ENTRIES_BITS);
- if (i==cur_dir_entry && 0<last_dir_clus<0x0FFFFFF8) {
- i=1;
- while (i<=entries_per_clus &&
- last_buf[entries_per_clus-i].attr
- &RS_ATTR_LONG_NAME_MASK==RS_ATTR_LONG_NAME)
- *last_buf[entries_per_clus-i++].name=0xE5;
- if (--i>0)
- BlkWrite(dv,&buf[(entries_per_clus-i)&-FAT32_ENTRIES_PER_BLK],
- dv->data_area+last_dir_clus*dv->spc
- +(entries_per_clus-i)>>FAT32_ENTRIES_BITS,
- (i+FAT32_ENTRIES_PER_BLK-1)>>FAT32_ENTRIES_BITS);
- }
- }
- break;
- }
- }
- MemSet(&long_name,0,sizeof(CDirEntry));
- }
- if (++cur_dir_entry==entries_per_clus) {
- last_dir_clus=cur_dir_clus;
- tmp_buf=buf; buf=last_buf; last_buf=tmp_buf;
- c=ClusNumNext(dv,cur_dir_clus);
- if (!(0<c<0x0FFFFFF8)) {
- c=ClusAlloc(dv,cur_dir_clus,1,FALSE);
- MemSet(buf,0,BLK_SIZE*dv->spc);
- ClusWrite(dv,buf,c,1);
- } else
- ClusRead(dv,buf,c,1);
- cur_dir_clus=c;
- cur_dir_entry=0;
- }
- }
- if (!written) {
- avail_cnt=FAT32_ENTRIES_PER_BLK-cur_dir_entry & (FAT32_ENTRIES_PER_BLK-1);
- if (avail_cnt<de_cnt) {
- for (i=0;i<avail_cnt;i++)
- *buf[cur_dir_entry+i].name=0xE5;
- BlkWrite(dv,&buf[cur_dir_entry &-FAT32_ENTRIES_PER_BLK],
- dv->data_area+cur_dir_clus*dv->spc
- +cur_dir_entry>>FAT32_ENTRIES_BITS,1);
- cur_dir_entry+=avail_cnt;
- if (cur_dir_entry==entries_per_clus) {
- last_dir_clus=cur_dir_clus;
- tmp_buf=buf; buf=last_buf; last_buf=tmp_buf;
- cur_dir_clus=ClusAlloc(dv,cur_dir_clus,1);
- cur_dir_entry=0;
- MemSet(buf,0,BLK_SIZE*dv->spc);
- ClusWrite(dv,buf,cur_dir_clus,1);
- }
- }
- MemCpy(&buf[cur_dir_entry],&de,de_cnt*sizeof(CFAT32DirEntry));
- BlkWrite(dv,&buf[cur_dir_entry &-FAT32_ENTRIES_PER_BLK],
- dv->data_area+cur_dir_clus*dv->spc+
- cur_dir_entry>>FAT32_ENTRIES_BITS,1);
- cur_dir_entry+=de_cnt;
- if (cur_dir_entry==entries_per_clus) {
- cur_dir_clus=ClusAlloc(dv,cur_dir_clus,1);
- MemSet(buf,0,BLK_SIZE*dv->spc);
- ClusWrite(dv,buf,cur_dir_clus,1);
- } else {
- MemSet(&buf[cur_dir_entry],0,sizeof(CFAT32DirEntry));
- BlkWrite(dv,&buf[cur_dir_entry &-FAT32_ENTRIES_PER_BLK],
- dv->data_area+cur_dir_clus*dv->spc
- +cur_dir_entry>>FAT32_ENTRIES_BITS,1);
- }
- }
- Free(last_buf);
- Free(buf);
- if (unlock)
- DrvUnlock(dv);
- if (unlock_break)
- BreakUnlock;
- } catch {
- if (unlock)
- DrvUnlock(dv);
- if (unlock_break)
- BreakUnlock;
- }
- return FALSE;
-}
-
-I64 FAT32FilesDel(CDrv *dv,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
- Bool del_dir,Bool print_msg)
-{
- CFAT32DirEntry *buf,*last_buf,*tmp_buf;
- I64 i,res=0,attr,xsum=0,last_dir_clus=INVALID_CLUS,
- cur_dir_entry,entries_per_clus,cur_dir_clus;
- U8 ch;
- Bool unlock_break;
- CDirEntry long_name;
- MemSet(&long_name,0,sizeof(CDirEntry));
- try {
- unlock_break=BreakLock;
- DrvLock(dv);
- cur_dir_clus=Name2DirClus(dv,cur_dir);
- buf =MAlloc(BLK_SIZE*dv->spc);
- last_buf=CAlloc(BLK_SIZE*dv->spc);
- entries_per_clus=dv->spc<<FAT32_ENTRIES_BITS;
- ClusRead(dv,buf,cur_dir_clus,1);
- cur_dir_entry=0;
- while (ch=*buf[cur_dir_entry].name) {
- attr=buf[cur_dir_entry].attr;
- if (ch!=0xE5 && ch!='.') {
- if (attr&RS_ATTR_LONG_NAME_MASK==RS_ATTR_LONG_NAME)
- DirLongNameFill(&long_name,&buf[cur_dir_entry],&xsum);
- else {
- if (!(attr & RS_ATTR_VOL_ID) &&
- (del_dir || !(attr & RS_ATTR_DIR))) {
- if (xsum!=FATNameXSum(buf[cur_dir_entry].name))
- MemSet(&long_name,0,sizeof(CDirEntry));
- if (!*long_name.name)
- FATFromName(long_name.name,buf[cur_dir_entry].name);
- if (FilesFindMatch(long_name.name,files_find_mask,fuf_flags)) {
- if (!(attr & RS_ATTR_DIR)) res++;
- if (print_msg)
- "Del %s\n",long_name.name;
- *buf[cur_dir_entry].name=0xE5;
- i=1;
- while (i<=cur_dir_entry &&
- buf[cur_dir_entry-i].attr&RS_ATTR_LONG_NAME_MASK
- ==RS_ATTR_LONG_NAME)
- *buf[cur_dir_entry-i++].name=0xE5;
- i--;
- BlkWrite(dv,&buf[(cur_dir_entry-i)&-FAT32_ENTRIES_PER_BLK],
- dv->data_area+cur_dir_clus*dv->spc
- +(cur_dir_entry-i)>>FAT32_ENTRIES_BITS,
- (i+FAT32_ENTRIES_PER_BLK)>>FAT32_ENTRIES_BITS);
- if (i==cur_dir_entry && last_dir_clus!=INVALID_CLUS) {
- i=1;
- while (i<=entries_per_clus &&
- last_buf[entries_per_clus-i].attr
- &RS_ATTR_LONG_NAME_MASK==RS_ATTR_LONG_NAME)
- *last_buf[entries_per_clus-i++].name=0xE5;
- if (--i>0)
- BlkWrite(dv,&buf[(entries_per_clus-i)&-FAT32_ENTRIES_PER_BLK],
- dv->data_area+last_dir_clus*dv->spc
- +(entries_per_clus-i)>>FAT32_ENTRIES_BITS,
- (i+FAT32_ENTRIES_PER_BLK-1)>>FAT32_ENTRIES_BITS);
- }
- FAT32FreeClus(dv,buf[cur_dir_entry].clus_lo+
- buf[cur_dir_entry].clus_hi<<16);
- }
- }
- MemSet(&long_name,0,sizeof(CDirEntry));
- }
- } else
- MemSet(&long_name,0,sizeof(CDirEntry));
- if (++cur_dir_entry==entries_per_clus) {
- last_dir_clus=cur_dir_clus;
- cur_dir_clus=ClusNumNext(dv,cur_dir_clus,1);
- tmp_buf=buf; buf=last_buf; last_buf=tmp_buf;
- ClusRead(dv,buf,cur_dir_clus,1);
- cur_dir_entry=0;
- }
- }
- Free(buf);
- Free(last_buf);
- DrvUnlock(dv);
- if (unlock_break)
- BreakUnlock;
- } catch {
- DrvUnlock(dv);
- if (unlock_break)
- BreakUnlock;
- }
- return res;
-}
-
-I64 FAT32FileWrite(CDrv *dv,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
- CDate cdt,I64 attr)
-{
- CDirEntry de;
- I64 c=0,blk_cnt;
- Bool contiguous;
- MemSet(&de,0,sizeof(CDirEntry));
- if (size<0) size=0;
- if (dv->fs_type!=FSt_FAT32)
- PrintErr("Not FAT32 Drv\n");
- else if (!CFileNameTo(de.name,name))
- PrintErr("Invalid FileName: \"%s\".\n",name);
- else {
- FAT32FilesDel(dv,cur_dir,de.name,0,FALSE,FALSE);
- if (attr & RS_ATTR_CONTIGUOUS)
- contiguous=TRUE;
- else
- contiguous=FALSE;
- de.size=size;
- if (blk_cnt=(size+BLK_SIZE-1)>>BLK_SIZE_BITS)
- c=ClusAlloc(dv,0,(blk_cnt+dv->spc-1)/dv->spc,contiguous);
- else
- c=0x0FFFFFFF;
- de.clus=c;
- de.attr=attr;
- de.datetime=cdt;
- if (blk_cnt)
- ClusBlkWrite(dv,buf,c,blk_cnt);
- FAT32DirNew(dv,cur_dir,&de,TRUE);
- }
- return c;
-}
-
-CDirEntry *FAT32FilesFind(U8 *files_find_mask,
- I64 fuf_flags,CDirEntry *parent=NULL,I64 *_dir_size=NULL)
-{
- CDrv *dv=Fs->cur_dv;
- CFAT32DirEntry *buf;
- I64 attr,xsum=0,dir_size=0,sub_dir_size,
- cur_dir_clus,cur_dir_entry,entries_per_clus;
- U8 ch;
- CDirEntry *res=NULL,*tmpde,long_name;
- if (fuf_flags&~FUG_FILES_FIND)
- throw('FUF');
- try {
- MemSet(&long_name,0,sizeof(CDirEntry));
- DrvLock(dv);
- cur_dir_clus=Name2DirClus(dv,Fs->cur_dir);
- buf=MAlloc(BLK_SIZE*dv->spc);
- entries_per_clus=dv->spc<<FAT32_ENTRIES_BITS;
- ClusRead(dv,buf,cur_dir_clus,1);
- dir_size+=dv->spc*BLK_SIZE;
- cur_dir_entry=0;
- while (ch=*buf[cur_dir_entry].name) {
- attr=buf[cur_dir_entry].attr;
- if (ch!=0xE5) {
- if (attr&RS_ATTR_LONG_NAME_MASK==RS_ATTR_LONG_NAME)
- DirLongNameFill(&long_name,&buf[cur_dir_entry],&xsum);
- else {
- if (!(attr&RS_ATTR_VOL_ID)) {
- tmpde=MAlloc(sizeof(CDirEntry));
- if (xsum==FATNameXSum(buf[cur_dir_entry].name))
- MemCpy(tmpde,&long_name,sizeof(CDirEntry));
- else
- MemSet(tmpde,0,sizeof(CDirEntry));
- if (FAT32CDirFill(tmpde,&buf[cur_dir_entry],
- dv->fat32_local_time_offset)) {
- tmpde->parent=parent;
- if (Bt(&fuf_flags,FUf_RECURSE) && attr&RS_ATTR_DIR &&
- *tmpde->name!='.') {
- tmpde->next=res;
- res=tmpde;
- tmpde->full_name=DirNameAbs(tmpde->name);
- DrvUnlock(dv);
- if (Cd(tmpde->name)) {
- tmpde->sub=FAT32FilesFind(files_find_mask,fuf_flags,
- tmpde,&sub_dir_size);
- tmpde->size=sub_dir_size;
- Cd("..");
- }
- DrvLock(dv);
- } else {
- tmpde->full_name=FileNameAbs(tmpde->name);
- if ((attr&RS_ATTR_DIR || !Bt(&fuf_flags,FUf_JUST_DIRS)) &&
- !(Bt(&fuf_flags,FUf_RECURSE) &&
- *tmpde->name=='.' && attr&RS_ATTR_DIR) &&
- FilesFindMatch(tmpde->full_name,files_find_mask,
- fuf_flags)) {
- tmpde->next=res;
- res=tmpde;
- } else
- DirEntryDel(tmpde);
- }
- } else
- DirEntryDel(tmpde);
- }
- MemSet(&long_name,0,sizeof(CDirEntry));
- }
- } else
- MemSet(&long_name,0,sizeof(CDirEntry));
- if (++cur_dir_entry==entries_per_clus) {
- cur_dir_clus=ClusNumNext(dv,cur_dir_clus);
- if (cur_dir_clus==INVALID_CLUS)
- break;
- else {
- ClusRead(dv,buf,cur_dir_clus,1);
- dir_size+=dv->spc*BLK_SIZE;
- cur_dir_entry=0;
- }
- }
- }
- Free(buf);
- DrvUnlock(dv);
- } catch
- DrvUnlock(dv);
- if (_dir_size)
- *_dir_size=dir_size;
- return res;
-}
-
-Bool FAT32MkDir(CDrv *dv,U8 *cur_dir,U8 *name,I64 entry_cnt)
-{
- I64 c,cur_dir_clus=Name2DirClus(dv,cur_dir),
-//Rough estimate of size
- size=CeilU64((entry_cnt+2)<<FAT32_ENTRIES_BITS,dv->spc<<BLK_SIZE_BITS);
- U8 *buf=CAlloc(size);
- CDirEntry d_native;
- CFAT32DirEntry *dFAT=buf;
- Bool unlock_break;
-
- try {
- unlock_break=BreakLock;
- c=FileWrite(name,buf,size,0,RS_ATTR_DIR);
- MemSet(&d_native,0,sizeof(CDirEntry));
- d_native.attr=RS_ATTR_DIR;
- *d_native.name='.';
- d_native.name[1]=0;
- d_native.clus=c;
- d_native.size=0;
- d_native.datetime=Now;
- FAT32DirFill(dFAT,&d_native,NULL,dv->fat32_local_time_offset);
- dFAT++;
-
- MemSet(&d_native,0,sizeof(CDirEntry));
- d_native.attr=RS_ATTR_DIR;
- *d_native.name='.';
- d_native.name[1]='.';
- d_native.name[2]=0;
- d_native.clus=cur_dir_clus;
- d_native.size=0;
- d_native.datetime=Now;
- FAT32DirFill(dFAT,&d_native,NULL,dv->fat32_local_time_offset);
- ClusWrite(dv,buf,c,1);
- Free(buf);
- if (unlock_break)
- BreakUnlock;
- } catch
- if (unlock_break)
- BreakUnlock;
- return TRUE;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/BlkDev/FileSysRedSea.HC.HTML b/public/src/Kernel/BlkDev/FileSysRedSea.HC.HTML deleted file mode 100644 index f7c8182..0000000 --- a/public/src/Kernel/BlkDev/FileSysRedSea.HC.HTML +++ /dev/null @@ -1,647 +0,0 @@ - - - - - FileSysRedSea.HC - - - - - // See RedSea File System
-
-U0 RedSeaFreeFreeLst(CDrv *dv)
-{
- CFreeLst *tmpf,*tmpf1;
- Bool unlock;
- try {
- unlock=DrvLock(dv);
- if (tmpf=dv->next_free) {
- while (tmpf!=&dv->next_free) {
- tmpf1=tmpf->next;
- Free(tmpf);
- tmpf=tmpf1;
- }
- }
- dv->next_free=NULL;
- if (unlock)
- DrvUnlock(dv);
- } catch
- if (unlock)
- DrvUnlock(dv);
-}
-
-U0 RedSeaFreeLstBuild(CDrv *dv)
-{
- Bool unlock;
- CFreeLst *tmpf;
- I64 i,first=dv->data_area,max_blk=dv->size+dv->drv_offset;
- try {
- unlock=DrvLock(dv);
- if (dv->next_free)
- RedSeaFreeFreeLst(dv);
- QueInit(&dv->next_free);
- while (first<max_blk) {
- i=0; //count free clus
- while (first+i<max_blk) {
- DrvFATBlkSet(dv,first+i);
- if (Bt(dv->cur_fat_blk,(first+i-dv->data_area)&(BLK_SIZE<<3-1)))
- break;
- else
- i++;
- }
- if (i) {
- tmpf=AMAlloc(sizeof(CFreeLst));
- tmpf->size=i;
- tmpf->start=first;
- QueIns(tmpf,dv->last_free);
- }
- first+=i+1;
- }
- if (unlock)
- DrvUnlock(dv);
- } catch
- if (unlock)
- DrvUnlock(dv);
-}
-
-U0 RedSeaInit(CDrv *dv)
-{
- CRedSeaBoot br;
- Bool unlock;
- try {
- unlock=DrvLock(dv);
- BlkRead(dv,&br,dv->drv_offset,1);
- if (br.signature!=MBR_PT_REDSEA || br.signature2!=0xAA55)
- throw('Drv');
- dv->fs_type=FSt_REDSEA;
- RedSeaFreeFreeLst(dv);
- dv->spc=1;
- dv->size=br.sects;
- dv->data_area=dv->drv_offset+br.bitmap_sects;
- dv->root_clus=br.root_clus;
- dv->fat1=dv->fat2=dv->drv_offset+1;
- DrvFATBlkAlloc(dv);
- if (unlock)
- DrvUnlock(dv);
- } catch
- if (unlock)
- DrvUnlock(dv);
-}
-
-Bool RedSeaValidate(U8 drv_let)
-{
- CDrv *dv;
- CRedSeaBoot br;
- if ((dv=Let2Drv(drv_let,FALSE)) && dv->fs_type==FSt_REDSEA &&
- BlkRead(dv,&br,dv->drv_offset,1) && br.signature==MBR_PT_REDSEA &&
- br.signature2==0xAA55)
- return TRUE;
- else
- return FALSE;
-}
-
-U0 RedSeaFmt(U8 drv_let,Bool quick=TRUE)
-{
- U8 *root_dir;
- CDirEntry *d_native;
- CRedSeaBoot *br=CAlloc(BLK_SIZE);
- CDrv *dv=Let2Drv(drv_let);
- I64 i,n,root_dir_blks;
- try {
- DrvLock(dv);
-// DrvTypeSet(drv_let,FSt_REDSEA);
- DrvTypeSet(drv_let,FSt_FAT32);
- dv->fs_type=FSt_REDSEA;
- br->signature=MBR_PT_REDSEA;
- br->signature2=0xAA55;
- br->drv_offset=dv->drv_offset; //For CD/DVD image copy.
- br->sects=dv->size;
- n=(br->sects+BLK_SIZE<<3-1)/BLK_SIZE<<3;
- br->bitmap_sects=n;
- br->unique_id=GetTSC^Now()(U64);
- br->root_clus=0;
-
- if (quick)
- i=n+1;
- else
- i=dv->size;
- BlkWriteZero(dv,dv->drv_offset,i);
-
- BlkWrite(dv,br,dv->drv_offset,1);
- RedSeaInit(dv);
- ClusAlloc(dv,0,1,FALSE); //Alloc #1
-
- root_dir_blks=MaxI64(1,dv->bd->init_root_dir_blks);
- br->root_clus=ClusAlloc(dv,0,root_dir_blks,FALSE);
- BlkWrite(dv,br,dv->drv_offset,1);
- root_dir=CAlloc(BLK_SIZE*root_dir_blks);
-
- d_native=root_dir-offset(CDirEntry.start);
-
- d_native->attr=RS_ATTR_DIR|RS_ATTR_CONTIGUOUS;
- *d_native->name='.';
- d_native->clus=br->root_clus;
- d_native->size=BLK_SIZE*root_dir_blks;
- d_native->datetime=Now;
-
- d_native(U8 *)+=CDIR_SIZE;
-
- *d_native->name='.';
- d_native->name[1]='.';
- d_native->attr=RS_ATTR_DIR|RS_ATTR_CONTIGUOUS;
- d_native->clus=br->root_clus;
- d_native->datetime=Now;
-
- BlkWrite(dv,root_dir,br->root_clus,root_dir_blks);
- RedSeaInit(dv);
- DrvUnlock(dv);
- } catch
- DrvUnlock(dv);
- Free(br);
- Free(root_dir);
-}
-
-Bool RedSeaFileFind(CDrv *dv,I64 cur_dir_clus,U8 *name,
- CDirEntry *_res,I64 fuf_flags=0)
-{//FUF_JUST_DIRS, FUF_JUST_FILES
- CDirEntry *buf,*buf2,*ptr;
- U8 dname[CDIR_FILENAME_LEN];
- I64 ch;
- Bool res=FALSE,unlock;
- if (fuf_flags&~FUG_FILE_FIND)
- throw('FUF');
- MemSet(_res,0,sizeof(CDirEntry));
- DrvChk(dv);
- if (dv->fs_type!=FSt_REDSEA)
- PrintErr("Not RedSea Drv\n");
- else if (!CFileNameTo(dname,name))
- PrintErr("Invalid FileName: \"%s\".\n",name);
- else
- try {
- unlock=DrvLock(dv);
- buf2=MAlloc(BLK_SIZE);
- BlkRead(dv,buf2,cur_dir_clus,1);
-
- ptr=buf2(U8 *)-offset(CDirEntry.start);
- buf=MAlloc(ptr->size);
- BlkRead(dv,buf,cur_dir_clus,ptr->size>>BLK_SIZE_BITS);
- Free(buf2);
-
- ptr=buf(U8 *)-offset(CDirEntry.start);
- *ptr->name='.';
- ptr->name[1]=0;
- while (TRUE) {
- if (!(ch=*ptr->name))
- break;
- else if (!(ptr->attr & RS_ATTR_DELETED) &&
- !(fuf_flags&FUF_JUST_DIRS && !(ptr->attr & RS_ATTR_DIR)) &&
- !(fuf_flags&FUF_JUST_FILES && ptr->attr & RS_ATTR_DIR) &&
- !StrCmp(dname,ptr->name)) {
- MemCpy(&_res->attr,&ptr->attr,CDIR_SIZE);
- res=TRUE;
- goto rsff_done;
- }
- ptr(U8 *)+=CDIR_SIZE;
- }
-rsff_done:
- Free(buf);
- if (unlock)
- DrvUnlock(dv);
- } catch
- if (unlock)
- DrvUnlock(dv);
- return res;
-}
-
-U8 *RedSeaFileRead(CDrv *dv,U8 *cur_dir,U8 *filename,I64 *_size,I64 *_attr)
-{
- U8 *buf=NULL;
- CDirEntry de;
- I64 c,blk_cnt,cur_dir_clus;
- DrvChk(dv);
- *_size=0;
- *_attr=0;
- if (dv->fs_type!=FSt_REDSEA)
- PrintErr("Not RedSea Drv\n");
- else
- try {
- DrvLock(dv);
- cur_dir_clus=Name2DirClus(dv,cur_dir);
- if (RedSeaFileFind(dv,cur_dir_clus,filename,&de,FUF_JUST_FILES)) {
- blk_cnt=(de.size+BLK_SIZE-1)>>BLK_SIZE_BITS;
- buf=MAlloc(blk_cnt<<BLK_SIZE_BITS+1);
- c=de.clus;
- c=BlkRead(dv,buf,c,blk_cnt);
- buf[de.size]=0; //Terminate
- *_size=de.size;
- *_attr=FileAttr(de.name,de.attr);
- }
- DrvUnlock(dv);
- } catch
- DrvUnlock(dv);
- return buf;
-}
-
-Bool RedSeaCd(U8 *name,I64 cur_dir_clus)
-{
- CDirEntry de;
- if (Fs->cur_dv->fs_type!=FSt_REDSEA)
- PrintErr("Not RedSea Drv\n");
- else if (RedSeaFileFind(Fs->cur_dv,cur_dir_clus,name,&de,FUF_JUST_DIRS))
- return TRUE;
- else
- PrintErr("File not found: \"%s\".\n",name);
- return FALSE;
-}
-
-U0 RedSeaFreeClus(CDrv *dv,I64 c,I64 cnt)
-{
- CFreeLst *tmpf;
- Bool found=FALSE,unlock,unlock_break;
- DrvChk(dv);
- if (!c) return;
- if (dv->fs_type!=FSt_REDSEA)
- PrintErr("Not RedSea Drv\n");
- else
- try {
- unlock_break=BreakLock;
- unlock=DrvLock(dv);
- if (!dv->next_free)
- RedSeaFreeLstBuild(dv);
- tmpf=dv->next_free;
- while (!found && tmpf!=&dv->next_free) {
- if (tmpf->start+tmpf->size==c) {
- tmpf->size+=cnt;
- found=TRUE;
- } else if (c+cnt==tmpf->start) {
- tmpf->size+=cnt;
- tmpf->start=c;
- found=TRUE;
- }
- tmpf=tmpf->next;
- }
- if (!found) {
- tmpf=AMAlloc(sizeof(CFreeLst));
- tmpf->size=cnt;
- tmpf->start=c;
- QueIns(tmpf,dv->last_free);
- }
- while (cnt-->0) {
- DrvFATBlkSet(dv,c);
- LBtr(dv->cur_fat_blk,(c-dv->data_area)&(BLK_SIZE<<3-1));
- LBts(&dv->fat_blk_dirty,0);
- c++;
- }
- DrvFATBlkClean(dv);
-
- if (unlock)
- DrvUnlock(dv);
- if (unlock_break)
- BreakUnlock;
- } catch {
- if (unlock)
- DrvUnlock(dv);
- if (unlock_break)
- BreakUnlock;
- }
-}
-
-I64 RedSeaAllocClus(CDrv *dv,I64 cnt)
-{
- CFreeLst *tmpf,*best_free=NULL;
- I64 i,first,best_size=I64_MAX;
- Bool unlock,unlock_break;
- if (cnt<=0)
- throw('Drv');
- try {
- unlock_break=BreakLock;
- unlock=DrvLock(dv);
- if (!dv->next_free)
- RedSeaFreeLstBuild(dv);
- tmpf=dv->next_free;
- while (tmpf!=&dv->next_free) {
- if (tmpf->size>=cnt && tmpf->size<best_size) {
- best_free=tmpf;
- best_size=tmpf->size;
- if (tmpf->size==cnt)
- break;
- }
- tmpf=tmpf->next;
- }
- if (!best_free)
- throw('Drv');
- first=best_free->start;
- for (i=0;i<cnt;i++) {
- DrvFATBlkSet(dv,first+i);
- LBts(dv->cur_fat_blk,(first+i-dv->data_area)&(BLK_SIZE<<3-1));
- LBts(&dv->fat_blk_dirty,0);
- }
- DrvFATBlkClean(dv);
- if (best_free->size-=cnt)
- best_free->start+=cnt;
- else {
- QueRem(best_free);
- Free(best_free);
- }
- if (unlock)
- DrvUnlock(dv);
- if (unlock_break)
- BreakUnlock;
- } catch {
- if (unlock)
- DrvUnlock(dv);
- if (unlock_break)
- BreakUnlock;
- }
- return first;
-}
-
-Bool RedSeaDirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
-{
- CDirEntry *buf,*buf2,*ptr,de2;
- CRedSeaBoot *br;
- I64 c,ch,i=1,j=0,n=BLK_SIZE/CDIR_SIZE,dir_size,cur_dir_clus;
- Bool written=FALSE,unlock,unlock_break;
- U8 *tmp,*parent_dir;
- try {
- unlock_break=BreakLock;
- tmpde->attr|=RS_ATTR_CONTIGUOUS;
- unlock=DrvLock(dv);
- cur_dir_clus=Name2DirClus(dv,cur_dir);
- buf2=MAlloc(BLK_SIZE);
- BlkRead(dv,buf2,cur_dir_clus,1);
-
- ptr=buf2(U8 *)-offset(CDirEntry.start);
- buf=MAlloc(ptr->size);
- BlkRead(dv,buf,cur_dir_clus,ptr->size>>BLK_SIZE_BITS);
-
- dir_size=ptr->size;
- ptr=buf(U8 *)-offset(CDirEntry.start)+CDIR_SIZE;
- Free(buf2);
- while (TRUE) {
- if (!(ch=*ptr->name)) {
- if (!written)
- MemCpy(&ptr->start,&tmpde->start,CDIR_SIZE);
- if ((i+1)*CDIR_SIZE+j<<BLK_SIZE_BITS<dir_size)
- BlkWrite(dv,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_clus+j,1);
- else {
- buf2=CAlloc(dir_size+BLK_SIZE);
- MemCpy(buf2,buf,dir_size);
- RedSeaFreeClus(dv,cur_dir_clus,dir_size>>BLK_SIZE_BITS);
- dir_size+=BLK_SIZE;
- c=ClusAlloc(dv,0,dir_size>>BLK_SIZE_BITS,TRUE);
- Free(buf);
- buf=buf2;
- ptr=buf(U8 *)-offset(CDirEntry.start);
- ptr->size=dir_size;
- ptr->clus=c;
- BlkWrite(dv,buf,c,dir_size>>BLK_SIZE_BITS);
- if (cur_dir_clus==dv->root_clus) {
- br=CAlloc(BLK_SIZE);
- BlkRead(dv,br,dv->drv_offset,1);
- br->root_clus=c;
- BlkWrite(dv,br,dv->drv_offset,1);
- Free(br);
- dv->root_clus=c;
- } else {
- tmp=StrNew(cur_dir);
- parent_dir=StrNew(cur_dir);
- StrLastRem(parent_dir,"/",tmp);
- if (!*parent_dir) {
- Free(parent_dir);
- parent_dir=StrNew("/");
- }
- if (RedSeaFileFind(dv,Name2DirClus(dv,parent_dir),
- tmp,&de2,FUF_JUST_DIRS)) {
- de2.clus=c;
- de2.size=dir_size;
- RedSeaDirNew(dv,parent_dir,&de2,FALSE);
- } else
- throw('Drv');
- Free(tmp);
- Free(parent_dir);
- }
- }
- break;
- } else if (ptr->attr & RS_ATTR_DELETED) {
- if (!written) {
- MemCpy(&ptr->start,&tmpde->start,CDIR_SIZE);
- BlkWrite(dv,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_clus+j,1);
- written=TRUE;
- }
- } else {
- if (!StrCmp(tmpde->name,ptr->name)) {
- if (free_old_chain)
- RedSeaFreeClus(dv,ptr->clus,
- (ptr->size+BLK_SIZE-1)>>BLK_SIZE_BITS);
- if (!written)
- MemCpy(&ptr->start,&tmpde->start,CDIR_SIZE);
- else
- ptr->attr|=RS_ATTR_DELETED;
- BlkWrite(dv,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_clus+j,1);
- break;
- }
- }
- ptr(U8 *)+=CDIR_SIZE;
- if (++i>=n) {
- j++;
- i=0;
- }
- }
- Free(buf);
- if (unlock)
- DrvUnlock(dv);
- if (unlock_break)
- BreakUnlock;
- } catch {
- if (unlock)
- DrvUnlock(dv);
- if (unlock_break)
- BreakUnlock;
- }
- return FALSE;
-}
-
-I64 RedSeaFilesDel(CDrv *dv,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
- Bool del_dir,Bool print_msg)
-{
- CDirEntry *buf,*buf2,*ptr;
- I64 i=0,res=0,ch,j=0,n=BLK_SIZE/CDIR_SIZE,cur_dir_clus;
- Bool unlock_break;
- try {
- unlock_break=BreakLock;
- DrvLock(dv);
- cur_dir_clus=Name2DirClus(dv,cur_dir);
- buf2=MAlloc(BLK_SIZE);
- BlkRead(dv,buf2,cur_dir_clus,1);
-
- ptr=buf2(U8 *)-offset(CDirEntry.start);
- buf=MAlloc(ptr->size);
- BlkRead(dv,buf,cur_dir_clus,ptr->size>>BLK_SIZE_BITS);
- Free(buf2);
-
- ptr=buf(U8 *)-offset(CDirEntry.start);
- *ptr->name='.';
- ptr->name[1]=0;
- while (TRUE) {
- if (!(ch=*ptr->name))
- break;
- else if (!(ptr->attr & RS_ATTR_DELETED) && ch!='.' && (del_dir ||
- !(ptr->attr & RS_ATTR_DIR)) &&
- FilesFindMatch(ptr->name,files_find_mask,fuf_flags)) {
- if (!(ptr->attr & RS_ATTR_DIR)) res++;
- if (print_msg)
- "Del %s\n",ptr->name;
- ptr->attr|=RS_ATTR_DELETED;
- BlkWrite(dv,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_clus+j,1);
- RedSeaFreeClus(dv,ptr->clus,
- (ptr->size+BLK_SIZE-1)>>BLK_SIZE_BITS);
- }
- ptr(U8 *)+=CDIR_SIZE;
- if (++i>=n) {
- j++;
- i=0;
- }
- }
- Free(buf);
- DrvUnlock(dv);
- if (unlock_break)
- BreakUnlock;
- } catch {
- DrvUnlock(dv);
- if (unlock_break)
- BreakUnlock;
- }
- return res;
-}
-
-I64 RedSeaFileWrite(CDrv *dv,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
- CDate cdt,I64 attr)
-{
- CDirEntry de;
- I64 c=0,blk_cnt;
- MemSet(&de,0,sizeof(CDirEntry));
- if (size<0) size=0;
- if (dv->fs_type!=FSt_REDSEA)
- PrintErr("Not RedSea Drv\n");
- else if (!CFileNameTo(de.name,name))
- PrintErr("Invalid FileName: \"%s\".\n",name);
- else {
- RedSeaFilesDel(dv,cur_dir,de.name,0,FALSE,FALSE);
- de.size=size;
- if (blk_cnt=(size+BLK_SIZE-1)>>BLK_SIZE_BITS)
- c=ClusAlloc(dv,0,blk_cnt,TRUE); //Always contiguous
- else
- c=INVALID_CLUS;
- de.clus=c;
- de.attr=attr|RS_ATTR_CONTIGUOUS;
- de.datetime=cdt;
- if (blk_cnt)
- BlkWrite(dv,buf,c,blk_cnt);
- RedSeaDirNew(dv,cur_dir,&de,TRUE);
- }
- return c;
-}
-
-CDirEntry *RedSeaFilesFind(U8 *files_find_mask,I64 fuf_flags,
- CDirEntry *parent=NULL)
-{
- CDrv *dv=Fs->cur_dv;
- CDirEntry *buf,*buf2,*ptr,*res=NULL,*tmpde;
- I64 ch,cur_dir_clus;
- if (fuf_flags&~FUG_FILES_FIND)
- throw('FUF');
- try {
- DrvLock(dv);
- cur_dir_clus=Name2DirClus(dv,Fs->cur_dir);
- buf2=MAlloc(BLK_SIZE);
- BlkRead(dv,buf2,cur_dir_clus,1);
-
- ptr=buf2(U8 *)-offset(CDirEntry.start);
- buf=MAlloc(ptr->size);
- BlkRead(dv,buf,cur_dir_clus,ptr->size>>BLK_SIZE_BITS);
- Free(buf2);
-
- ptr=buf(U8 *)-offset(CDirEntry.start);
- *ptr->name='.';
- ptr->name[1]=0;
- ptr(U8 *)+=CDIR_SIZE;
- ptr->clus=Name2ParentDirClus(dv,Fs->cur_dir);
- ptr(U8 *)-=CDIR_SIZE;
- while (TRUE) {
- if (!(ch=*ptr->name))
- break;
- else if (!(ptr->attr & RS_ATTR_DELETED)) {
- tmpde=CAlloc(sizeof(CDirEntry));
- MemCpy(&tmpde->start,&ptr->start,CDIR_SIZE);
- tmpde->parent=parent;
- if (Bt(&fuf_flags,FUf_RECURSE) && tmpde->attr&RS_ATTR_DIR &&
- *tmpde->name!='.') {
- tmpde->next=res;
- res=tmpde;
- tmpde->full_name=DirNameAbs(tmpde->name);
- DrvUnlock(dv);
- if (Cd(tmpde->name)) {
- tmpde->sub=RedSeaFilesFind(files_find_mask,fuf_flags,tmpde);
- Cd("..");
- }
- DrvLock(dv);
- } else {
- tmpde->full_name=FileNameAbs(tmpde->name);
- if ((tmpde->attr&RS_ATTR_DIR ||
- !Bt(&fuf_flags,FUf_JUST_DIRS)) &&
- !(Bt(&fuf_flags,FUf_RECURSE) && *tmpde->name=='.' &&
- tmpde->attr&RS_ATTR_DIR) &&
- FilesFindMatch(tmpde->full_name,files_find_mask,fuf_flags)) {
- tmpde->next=res;
- res=tmpde;
- } else
- DirEntryDel(tmpde);
- }
- }
- ptr(U8 *)+=CDIR_SIZE;
- }
- Free(buf);
- DrvUnlock(dv);
- } catch
- DrvUnlock(dv);
- return res;
-}
-
-Bool RedSeaMkDir(CDrv *dv,U8 *cur_dir,U8 *name,I64 entry_cnt)
-{//entry_cnt is for preallocating dir blks.
- I64 c,cur_dir_clus=Name2DirClus(dv,cur_dir),
- size=CeilU64((entry_cnt+3)<<6,BLK_SIZE);
-#assert CDIR_SIZE==64
- U8 *buf=CAlloc(size);
- CDirEntry *d_native=buf-offset(CDirEntry.start);
- Bool unlock_break;
- try {
- unlock_break=BreakLock;
- c=FileWrite(name,buf,size,0,RS_ATTR_DIR);
- d_native->attr=RS_ATTR_DIR|RS_ATTR_CONTIGUOUS;
- StrCpy(d_native->name,name);
- d_native->clus=c;
- d_native->size=size;
- d_native->datetime=Now;
- d_native(U8 *)+=CDIR_SIZE;
-
- d_native->attr=RS_ATTR_DIR|RS_ATTR_CONTIGUOUS;
- *d_native->name='.';
- d_native->name[1]='.';
- d_native->name[2]=0;
- d_native->clus=cur_dir_clus;
- d_native->size=0;
- d_native->datetime=Now;
- BlkWrite(dv,buf,c,1);
- Free(buf);
- if (unlock_break)
- BreakUnlock;
- } catch
- if (unlock_break)
- BreakUnlock;
- return TRUE;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/BlkDev/MakeBlkDev.HC.HTML b/public/src/Kernel/BlkDev/MakeBlkDev.HC.HTML deleted file mode 100644 index 15fecf8..0000000 --- a/public/src/Kernel/BlkDev/MakeBlkDev.HC.HTML +++ /dev/null @@ -1,35 +0,0 @@ - - - - - MakeBlkDev.HC - - - - - #exe {Cd(__DIR__);};
-#include "DskStrA"
-#include "DskCache"
-#include "DskATA"
-#include "DskATAId"
-#include "DskBlkDev"
-#include "DskDrv"
-#include "DskBlk"
-#include "DskClus"
-#include "DskStrB"
-#include "DskAddDev"
-#include "DskDirA"
-#include "FileSysRedSea"
-#include "FileSysFAT"
-#include "DskDirContext"
-#include "DskFind"
-#include "DskDirB"
-#include "DskFile"
-#include "DskCFile"
-#include "DskCopy"
-#include "DskCDDVD"
-#include "DskFmt"
-#exe {Cd("..");};
- - - \ No newline at end of file diff --git a/public/src/Kernel/Compress.HC.HTML b/public/src/Kernel/Compress.HC.HTML deleted file mode 100644 index 455d96c..0000000 --- a/public/src/Kernel/Compress.HC.HTML +++ /dev/null @@ -1,320 +0,0 @@ - - - - - Compress.HC - - - - - //See /Doc/Credits.DD.
-//See CArcCompress, CArcEntry, and CArcCtrl
-
-asm {
-/****
-U0 ArcEntryGet(CArcCtrl *c)
-{
- I64 i;
- CArcEntry *tmp,*tmp1;
-
- if (c->entry_used) {
- i=c->free_idx;
-
- c->entry_used=FALSE;
- c->cur_entry=c->next_entry;
- c->cur_bits_in_use=c->next_bits_in_use;
- if (c->next_bits_in_use<ARC_BITS_MAX) {
- c->next_entry = &c->compress[i++];
- if (i==c->free_limit) {
- c->next_bits_in_use++;
- c->free_limit=1<<c->next_bits_in_use;
- }
- } else {
- do if (++i==c->free_limit)
- i=c->min_table_entry;
- while (c->hash[i]);
- tmp=&c->compress[i];
- c->next_entry=tmp;
- tmp1=&c->hash[tmp->basecode];
- while (tmp1) {
- if (tmp1->next==tmp) {
- tmp1->next=tmp->next;
- break;
- } else
- tmp1=tmp1->next;
- }
- }
- c->free_idx=i;
- }
-}
-****/
-_ARC_ENTRY_GET::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
- MOV RSI,U64 SF_ARG1[RBP]
- BTR U64 CArcCtrl.entry_used[RSI],0
- JNC I32 @@30
- MOV RDX,U64 CArcCtrl.free_idx[RSI]
- MOV RAX,U64 CArcCtrl.next_entry[RSI]
- MOV U64 CArcCtrl.cur_entry[RSI],RAX
- MOV RCX,U64 CArcCtrl.next_bits_in_use[RSI]
- MOV U64 CArcCtrl.cur_bits_in_use[RSI],RCX
- CMP RCX,ARC_BITS_MAX
- JAE @@05
- MOV RAX,RDX
- SHL RAX,4
- LEA RAX,U64 CArcCtrl.compress[RSI+RAX]
- MOV U64 CArcCtrl.next_entry[RSI],RAX
- INC RDX
- CMP U64 CArcCtrl.free_limit[RSI],RDX
- JNE @@25
- INC RCX
- MOV U64 CArcCtrl.next_bits_in_use[RSI],RCX
- MOV RAX,1
- SHL RAX,CL
- MOV U64 CArcCtrl.free_limit[RSI],RAX
- JMP @@25
-@@05: INC RDX
- CMP U64 CArcCtrl.free_limit[RSI],RDX
- JNE @@10
- MOV RDX,U64 CArcCtrl.min_table_entry[RSI]
-@@10: MOV RAX,U64 CArcCtrl.hash[RSI+RDX*8]
- TEST RAX,RAX
- JNZ @@05
- MOV RDI,RDX
- SHL RDI,4
- LEA RDI,U64 CArcCtrl.compress[RSI+RDI]
- MOV U32 CArcCtrl.next_entry[RSI],EDI
- MOVZX RBX,U16 CArcEntry.basecode[RDI]
- LEA RCX,U64 CArcCtrl.hash[RSI+RBX*8]
-@@15: TEST RCX,RCX
- JZ @@25
- MOV RAX,U64 CArcEntry.next[RCX]
- CMP RDI,RAX
- JNE @@20
- MOV RAX,U64 CArcEntry.next[RDI]
- MOV U64 CArcEntry.next[RCX],RAX
- JMP @@25
-@@20: MOV RCX,RAX
- JMP @@15
-@@25: MOV U64 CArcCtrl.free_idx[RSI],RDX
-@@30: POP RDI
- POP RSI
- POP RBP
- RET1 8
-}
-
-_extern _ARC_ENTRY_GET U0 ArcEntryGet(CArcCtrl *c);
-
-I64 ArcDetermineCompressionType(U8 *src,I64 size)
-{
- while (size--)
- if (*src++&0x80)
- return CT_8_BIT;
- return CT_7_BIT;
-}
-
-U0 ArcCompressBuf(CArcCtrl *c)
-{//Use CompressBuf() unless doing more than one buf.
- CArcEntry *tmp,*tmp1;
- I64 ch,basecode;
- U8 *src_ptr,*src_limit;
-
- src_ptr=c->src_buf+c->src_pos;
- src_limit=c->src_buf+c->src_size;
-
- if (c->saved_basecode==U32_MAX)
- basecode=*src_ptr++;
- else
- basecode=c->saved_basecode;
-
- while (src_ptr<src_limit && c->dst_pos+c->cur_bits_in_use<=c->dst_size) {
- ArcEntryGet(c);
-ac_start:
- if (src_ptr>=src_limit) goto ac_done;
- ch=*src_ptr++;
- if (tmp=c->hash[basecode])
- do {
- if (tmp->ch==ch) {
- basecode=tmp-&c->compress[0];
- goto ac_start;
- }
- } while (tmp=tmp->next);
-
- BFieldOrU32(c->dst_buf,c->dst_pos,basecode);
- c->dst_pos+=c->cur_bits_in_use;
-
- c->entry_used=TRUE;
- tmp=c->cur_entry;
- tmp->basecode=basecode;
- tmp->ch=ch;
- tmp1=&c->hash[basecode];
- tmp->next=tmp1->next;
- tmp1->next=tmp;
-
- basecode=ch;
- }
-ac_done:
- c->saved_basecode=basecode;
- c->src_pos=src_ptr-c->src_buf;
-}
-
-Bool ArcFinishCompression(CArcCtrl *c)
-{//Do closing touch on archivew ctrl struct.
- if (c->dst_pos+c->cur_bits_in_use<=c->dst_size) {
- BFieldOrU32(c->dst_buf,c->dst_pos,c->saved_basecode);
- c->dst_pos+=c->next_bits_in_use;
- return TRUE;
- } else
- return FALSE;
-}
-
-U0 ArcExpandBuf(CArcCtrl *c)
-{//Use ExpandBuf() unless you know what you're doing.
- U8 *dst_ptr,*dst_limit;
- I64 basecode,lastcode,code;
- CArcEntry *tmp,*tmp1;
-
- dst_ptr=c->dst_buf+c->dst_pos;
- dst_limit=c->dst_buf+c->dst_size;
-
- while (dst_ptr<dst_limit && c->stk_ptr!=c->stk_base)
- *dst_ptr++ = * -- c->stk_ptr;
-
- if (c->stk_ptr==c->stk_base && dst_ptr<dst_limit) {
- if (c->saved_basecode==U32_MAX) {
- lastcode=BFieldExtU32(c->src_buf,c->src_pos,
- c->next_bits_in_use);
- c->src_pos+=c->next_bits_in_use;
- *dst_ptr++=lastcode;
- ArcEntryGet(c);
- c->last_ch=lastcode;
- } else
- lastcode=c->saved_basecode;
- while (dst_ptr<dst_limit && c->src_pos+c->next_bits_in_use<=c->src_size) {
- basecode=BFieldExtU32(c->src_buf,c->src_pos,
- c->next_bits_in_use);
- c->src_pos+=c->next_bits_in_use;
- if (c->cur_entry==&c->compress[basecode]) {
- *c->stk_ptr++=c->last_ch;
- code=lastcode;
- } else
- code=basecode;
- while (code>=c->min_table_entry) {
- *c->stk_ptr++=c->compress[code].ch;
- code=c->compress[code].basecode;
- }
- *c->stk_ptr++=code;
- c->last_ch=code;
-
- c->entry_used=TRUE;
- tmp=c->cur_entry;
- tmp->basecode=lastcode;
- tmp->ch=c->last_ch;
- tmp1=&c->hash[lastcode];
- tmp->next=tmp1->next;
- tmp1->next=tmp;
-
- ArcEntryGet(c);
- while (dst_ptr<dst_limit && c->stk_ptr!=c->stk_base)
- *dst_ptr++ = * -- c->stk_ptr;
- lastcode=basecode;
- }
- c->saved_basecode=lastcode;
- }
- c->dst_pos=dst_ptr-c->dst_buf;
-}
-
-CArcCtrl *ArcCtrlNew(Bool expand,I64 compression_type=CT_8_BIT)
-{//MAlloc archive ctrl struct.
- CArcCtrl *c;
- c=CAlloc(sizeof(CArcCtrl));
- if (expand) {
- c->stk_base=MAlloc(1<<ARC_BITS_MAX);
- c->stk_ptr=c->stk_base;
- }
- if (compression_type==CT_7_BIT)
- c->min_bits=7;
- else
- c->min_bits=8;
- c->min_table_entry=1<<c->min_bits;
- c->free_idx=c->min_table_entry;
- c->next_bits_in_use=c->min_bits+1;
- c->free_limit=1<<c->next_bits_in_use;
- c->saved_basecode=U32_MAX;
- c->entry_used=TRUE;
- ArcEntryGet(c);
- c->entry_used=TRUE;
- return c;
-}
-
-U0 ArcCtrlDel(CArcCtrl *c)
-{//Free archive ctrl struct.
- Free(c->stk_base);
- Free(c);
-}
-
-U8 *ExpandBuf(CArcCompress *arc,CTask *mem_task=NULL)
-{//See /Demo/Dsk/SerializeTree.HC.
- CArcCtrl *c;
- U8 *res;
-
- if (!(CT_NONE<=arc->compression_type<=CT_8_BIT) ||
- arc->expanded_size>mem_mapped_space)
- throw('Compress');
-
- res=MAlloc(arc->expanded_size+1,mem_task);
- res[arc->expanded_size]=0; //terminate
- switch [arc->compression_type] {
- case CT_NONE:
- MemCpy(res,&arc->body,arc->expanded_size);
- break;
- case CT_7_BIT:
- case CT_8_BIT:
- c=ArcCtrlNew(TRUE,arc->compression_type);
- c->src_size=arc->compressed_size<<3;
- c->src_pos=sizeof(CArcCompress)<<3;
- c->src_buf=arc;
- c->dst_size=arc->expanded_size;
- c->dst_buf=res;
- c->dst_pos=0;
- ArcExpandBuf(c);
- ArcCtrlDel(c);
- break;
- }
- return res;
-}
-
-CArcCompress *CompressBuf(U8 *src,I64 size,CTask *mem_task=NULL)
-{//See /Demo/Dsk/SerializeTree.HC.
- CArcCompress *arc;
- I64 size_out,compression_type=ArcDetermineCompressionType(src,size);
- CArcCtrl *c=ArcCtrlNew(FALSE,compression_type);
- c->src_size=size;
- c->src_buf=src;
- c->dst_size=(size+sizeof(CArcCompress))<<3;
- c->dst_buf=CAlloc(c->dst_size>>3);
- c->dst_pos=sizeof(CArcCompress)<<3;
- ArcCompressBuf(c);
- if (ArcFinishCompression(c) && c->src_pos==c->src_size) {
- size_out=(c->dst_pos+7)>>3;
- arc=MAlloc(size_out,mem_task);
- MemCpy(arc,c->dst_buf,size_out);
- arc->compression_type=compression_type;
- arc->compressed_size=size_out;
- } else {
- arc=MAlloc(size+sizeof(CArcCompress),mem_task);
- MemCpy(&arc->body,src,size);
- arc->compression_type=CT_NONE;
- arc->compressed_size=size+sizeof(CArcCompress);
- }
- arc->expanded_size=size;
- Free(c->dst_buf);
- ArcCtrlDel(c);
- return arc;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/Display.HC.HTML b/public/src/Kernel/Display.HC.HTML deleted file mode 100644 index facbdfc..0000000 --- a/public/src/Kernel/Display.HC.HTML +++ /dev/null @@ -1,133 +0,0 @@ - - - - - Display.HC - - - - - U0 RawPutChar(I64 ch)
-{/*For RAW output during boot and in debugger.
-
-See GrUpdateTextFG for
-the normal scrn text output routine.
-
-See also GrUpdateScrn().
-*/
- I64 i,row,col;
- U8 *ptr,*ptr1,*ptr2;
-
- if (!(text.raw_flags&RWF_SHOW_DOLLAR)) {
- if (ch=='$') {
- if (text.raw_flags&RWF_IN_DOLLAR) {
- text.raw_flags&=~RWF_IN_DOLLAR;
- if (!(text.raw_flags & RWF_LAST_DOLLAR)) {
- text.raw_flags&=~RWF_LAST_DOLLAR;
- return;
- }
- } else {
- text.raw_flags|=RWF_IN_DOLLAR|RWF_LAST_DOLLAR;
- return;
- }
- }
- text.raw_flags&=~RWF_LAST_DOLLAR;
- if (text.raw_flags&RWF_IN_DOLLAR)
- return;
- }
- if (ch=='\t') {
- RawPutChar(CH_SPACE);
- while (text.raw_col & 7)
- RawPutChar(CH_SPACE);
- } else if (ch==CH_BACKSPACE) {
- text.raw_col--;
- RawPutChar(CH_SPACE);
- text.raw_col--;
- } else if (ch=='\n') {
- RawPutChar(CH_SPACE);
- while (text.raw_col % text.cols)
- RawPutChar(CH_SPACE);
-
- } else if (Bt(char_bmp_displayable,ch)) {
- row=text.raw_col/text.cols%text.rows;
- col=text.raw_col%text.cols;
- if (!Bt(&sys_run_level,RLf_VGA)) { //if text mode
- if (text.raw_flags&RWF_SCROLL && text.raw_col && !row && !col) {
- MemCpy(text.vga_text_alias,text.vga_text_alias+text.cols*2,
- text.cols*(text.rows-1)*2);
- MemSet(text.vga_text_alias+text.cols*(text.rows-1)*2,0,text.cols*2);
- text.raw_col-=text.cols;
- row=text.rows-1;
- }
- ptr=text.vga_text_alias+(row*text.cols+col)*2;
- ptr[0]=ch;
- ptr[1]=BLACK<<4+WHITE;
- } else {
- OutU8(VGAP_IDX,VGAR_MAP_MASK);
- OutU8(VGAP_DATA,0x0F); //All planes -- WHITE
- if (text.raw_flags&RWF_SCROLL && text.raw_col && !row && !col) {
-//Scroll cached image
- MemCpy(text.raw_scrn_image,
- text.raw_scrn_image+GR_WIDTH*FONT_HEIGHT>>3,
- GR_WIDTH*(GR_HEIGHT-FONT_HEIGHT)>>3);
- MemSet(text.raw_scrn_image+GR_WIDTH*(GR_HEIGHT-FONT_HEIGHT)>>3,0,
- GR_WIDTH*FONT_HEIGHT>>3);
-
- MemCpy(text.vga_alias,text.raw_scrn_image,GR_WIDTH*GR_HEIGHT>>3);
- text.raw_col-=text.cols;
- row=text.rows-1;
- }
- PUSHFD
- CLI
- ptr=ptr1=col+row*GR_WIDTH*FONT_HEIGHT>>3;
- ptr+=text.vga_alias;
- ptr1+=text.raw_scrn_image; //Write to cached image as well
- ptr2=&text.font[ch&255];
- for (i=0;i<FONT_HEIGHT;i++) {
- *ptr=*ptr1=rev_bits_table[*ptr2++];
- ptr+=GR_WIDTH>>3;
- ptr1+=GR_WIDTH>>3;
- }
- POPFD
- }
- text.raw_col++;
- }
-}
-
-U0 VGAFlush()
-{//Flush winmgr vga cache, so updates whole scrn.
- LBts(&sys_semas[SEMA_FLUSH_VGA_IMAGE],0);
-}
-
-U0 WinDerivedValsUpdate(CTask *task)
-{//Those things calculated from other variables.
- if (!task) task=Fs;
- //Assert: This is called with TASKf_TASK_LOCK set
- PUSHFD
- CLI
- task->win_width =task->win_right-task->win_left+1;
- task->win_height=task->win_bottom-task->win_top+1;
- task->pix_left =FONT_WIDTH*task->win_left;
- task->pix_right =FONT_WIDTH*(task->win_right+1)-1;
- task->pix_width =task->pix_right-task->pix_left+1;
- task->pix_top =FONT_HEIGHT*task->win_top;
- task->pix_bottom =FONT_HEIGHT*(task->win_bottom+1)-1;
- task->pix_height =task->pix_bottom-task->pix_top+1;
- POPFD
-}
-
-Bool WinInside(I64 x,I64 y,CTask *task=NULL,I64 border=0)
-{//Is pixel (x,y) inside task's win? Border to FONT_WIDTH.
- if (!task) task=Fs;
- if (TaskValidate(task) && Bt(&task->display_flags,DISPLAYf_SHOW)) {
- if (Bt(&task->display_flags,DISPLAYf_NO_BORDER))
- border=0;
- if (task->pix_left-border<=x<=task->pix_right+border &&
- task->pix_top-border<=y<=task->pix_bottom+border)
- return TRUE;
- }
- return FALSE;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/EdLite.HC.HTML b/public/src/Kernel/EdLite.HC.HTML deleted file mode 100644 index 379bfef..0000000 --- a/public/src/Kernel/EdLite.HC.HTML +++ /dev/null @@ -1,367 +0,0 @@ - - - - - EdLite.HC - - - - - class CLine
-{
- CLine *next,*last;
- U8 *line;
-};
-
-U0 EdLiteUpdate(CLine *head,CLine *cur_line,I64 cur_col,I64 line_start_col)
-{
- I64 ch,i,j,k,k2,cursor_col,cursor_row=-1;
- U8 *st;
- CLine *tmpl=cur_line;
- Bool done_eof=FALSE;
- text.raw_col=0;
- for (i=0;i<text.rows/2;i++)
- if (tmpl->last!=head)
- tmpl=tmpl->last;
- for (i=0;i<text.rows;i++) {
- if (cursor_row<0 && tmpl==cur_line) {
- k=0;
- for (j=0;j<cur_col;j++)
- if (tmpl->line[j]=='\t')
- k=(k+8)&~7;
- else
- k++;
- cursor_col=k;
- cursor_row=i;
- }
- if (tmpl!=head) {
- st=tmpl->line;
- k=0;
- j=0;
- while (ch=*st++) {
- if (ch=='\t')
- k2=(k+8)&~7;
- else
- k2=k+1;
- if (line_start_col<=k<line_start_col+text.cols) {
- '' ch;
- j=k2-line_start_col;
- }
- k=k2;
- }
- if (j<text.cols)
- '\n';
- tmpl=tmpl->next;
- } else {
- if (!done_eof) {
- '<EOF>';
- done_eof=TRUE;
- }
- '\n';
- }
- }
- text.raw_col=text.cols*cursor_row+cursor_col-line_start_col;
- RawPutChar(0x7F);
-}
-
-Bool EdLite(U8 *filename,I64 num=1,I64 edf_dof_flags=0)
-{//Light weight text editor for debugging.
- U8 *src,*src2,*src3,*dst,*buf,*bin_data=NULL;
- I64 i,cnt=0,ch,sc,size,bin_size=0,line_start_col=0,cur_col=0,
- old_raw_flags=text.raw_flags;
- CLine head,*tmpl,*tmpl1,*cur_line;
- Bool res=FALSE,
- old_raw=Raw(ON),
- old_debug=DbgMode(ON),
- old_single=SingleUser(ON);
-
- if (!filename) filename=blkdev.tmp_filename;
- buf=FileRead(filename,&size);
-
- PUSHFD
- CLI
- text.raw_flags=text.raw_flags&~RWF_SCROLL|RWF_SHOW_DOLLAR;
- kbd.scan_code=0;
- QueInit(&head);
- head.line=StrNew("");
-
- if (buf) {
- src=buf;
- while (*src) {
- src2=src;
- while ((ch=*src++) && ch!='\r' && ch!='\n');
- src--;
- *src++=0;
- if (!ch)
- src--;
- while (ch=='\r' && *src=='\n' || *src==CH_CURSOR)
- src++;
- dst=src3=src2;
- while (ch=*src3++)
- if (ch!='\n' && ch!=CH_CURSOR)
- *dst++=ch;
- *dst=0;
-
- tmpl=MAlloc(sizeof(CLine));
- tmpl->line=StrNew(src2);
- QueIns(tmpl,head.last);
- cnt++;
- }
-
- if (src+1-buf<size) {
- bin_data=MAlloc(bin_size=size-(src-buf));
- MemCpy(bin_data,src,bin_size);
- }
- Free(buf);
- res=TRUE;
- }
-
- cur_line=head.next;
- if (--num<0)
- res=FALSE;
- else {
- if (num<=cnt)
- while (num--)
- cur_line=cur_line->next;
- else {
- cur_line=&head;
- res=FALSE;
- }
- }
- do {
- if (cur_line==&head)
- cur_col=0;
- while (cur_col-line_start_col<0)
- line_start_col-=8;
- while (cur_col-line_start_col>=text.cols)
- line_start_col+=8;
- EdLiteUpdate(&head,cur_line,cur_col,line_start_col);
- switch (ch=GetKey(&sc,FALSE,TRUE)) {
- case 0:
- switch (sc.u8[0]) {
- case SC_CURSOR_UP:
- if (cur_line->last!=&head)
- cur_line=cur_line->last;
- if (cur_col>StrLen(cur_line->line))
- cur_col=StrLen(cur_line->line);
- break;
- case SC_CURSOR_DOWN:
- if (cur_line!=&head)
- cur_line=cur_line->next;
- if (cur_col>StrLen(cur_line->line))
- cur_col=StrLen(cur_line->line);
- break;
- case SC_CURSOR_RIGHT:
- cur_col++;
- if (cur_col>StrLen(cur_line->line)) {
- tmpl=cur_line->next;
- if (tmpl!=&head) {
- cur_col=0;
- cur_line=tmpl;
- } else
- cur_col=StrLen(cur_line->line);
- }
- break;
- case SC_CURSOR_LEFT:
- if (cur_col)
- cur_col--;
- else {
- tmpl=cur_line->last;
- if (tmpl!=&head) {
- cur_line=tmpl;
- cur_col=StrLen(tmpl->line);
- }
- }
- break;
- case SC_PAGE_UP:
- for (i=1;i<text.rows;i++) {
- if (cur_line->last!=&head)
- cur_line=cur_line->last;
- if (cur_col>StrLen(cur_line->line))
- cur_col=StrLen(cur_line->line);
- }
- break;
- case SC_PAGE_DOWN:
- for (i=1;i<text.rows;i++) {
- if (cur_line!=&head)
- cur_line=cur_line->next;
- if (cur_col>StrLen(cur_line->line))
- cur_col=StrLen(cur_line->line);
- }
- break;
- case SC_DELETE:
- if (cur_col==StrLen(cur_line->line)) {
- tmpl=cur_line->next;
- if (cur_line!=&head && tmpl!=&head) {
- src=MStrPrint("%s%s",cur_line->line,tmpl->line);
- Free(cur_line->line);
- Free(tmpl->line);
- cur_line->line=src;
- QueRem(tmpl);
- Free(tmpl);
- }
- } else
- StrCpy(cur_line->line+cur_col,cur_line->line+cur_col+1);
- break;
- }
- break;
- case '\n':
- case '\r':
- tmpl=MAlloc(sizeof(CLine));
- tmpl->line=StrNew(cur_line->line+cur_col);
- cur_line->line[cur_col]=0;
- QueIns(tmpl,cur_line);
- cur_line=tmpl;
- cur_col=0;
- break;
- case CH_BACKSPACE:
- if (cur_col) {
- StrCpy(cur_line->line+cur_col-1,cur_line->line+cur_col);
- cur_col--;
- } else if (cur_line!=&head && cur_line->last!=&head) {
- tmpl=cur_line->last;
- src=MStrPrint("%s%s",tmpl->line,cur_line->line);
- cur_col=StrLen(tmpl->line);
- Free(cur_line->line);
- Free(tmpl->line);
- tmpl->line=src;
- QueRem(cur_line);
- Free(cur_line);
- cur_line=tmpl;
- }
- break;
- case CH_CTRLY:
- if (cur_line!=&head) {
- tmpl=cur_line;
- cur_line=cur_line->next;
- QueRem(tmpl);
- Free(tmpl->line);
- Free(tmpl);
- cur_col=0;
- }
- break;
- default:
- if (Bt(char_bmp_printable,ch)) {
- if (cur_line==&head) {
- cur_line=MAlloc(sizeof(CLine));
- cur_line->line=StrNew("");
- QueIns(cur_line,head.last);
- }
- src=MAlloc(StrLen(cur_line->line)+2);
- MemCpy(src,cur_line->line,cur_col);
- src[cur_col]=ch;
- if (cur_col<StrLen(cur_line->line))
- StrCpy(src+cur_col+1,cur_line->line+cur_col);
- else
- src[cur_col+1]=0;
- Free(cur_line->line);
- cur_line->line=src;
- cur_col++;
- }
- }
- } while (ch!=CH_SHIFT_ESC && ch!=CH_ESC);
-
- if (ch!=CH_ESC) {
- if (edf_dof_flags&EDF_WAS_WRITE)
- res=FALSE;
- } else {
- size=bin_size;
-
- tmpl=head.next;
- while (tmpl!=&head) {
- size+=StrLen(tmpl->line)+1;
- tmpl=tmpl->next;
- }
-
- buf=dst=MAlloc(size);
- tmpl=head.next;
- while (tmpl!=&head) {
- i=StrLen(tmpl->line);
- MemCpy(dst,tmpl->line,i);
- dst+=i;
- *dst++='\n';
- tmpl=tmpl->next;
- }
- if (bin_data)
- MemCpy(dst,bin_data,bin_size);
- FileWrite(filename,buf,size);
- Free(buf);
-
- if (edf_dof_flags&EDF_WAS_WRITE)
- res=TRUE;
- }
-
- tmpl=head.next;
- while (tmpl!=&head) {
- tmpl1=tmpl->next;
- QueRem(tmpl);
- Free(tmpl->line);
- Free(tmpl);
- tmpl=tmpl1;
- }
- Free(head.line);
- Free(bin_data);
- Raw(old_raw);
- DbgMode(old_debug);
- SingleUser(old_single);
- text.raw_flags=text.raw_flags&~RWF_SHOW_DOLLAR|old_raw_flags&RWF_SHOW_DOLLAR;
- POPFD
- return res;
-}
-
-U0 ToFileLine(U8 *_fl_file_line,U8 **_filename,I64 *_linenum)
-{//"FI:D:/Dir/File.HC,123" to "D:/Dir/File.HC" and 123.
- U8 *st,*fl_file_line=StrNew(_fl_file_line);
- I64 linenum;
- StrFirstRem(fl_file_line,":");
- st=StrNew(fl_file_line);
- StrLastRem(fl_file_line,",",st);
- linenum=Str2I64(st);
- Free(st);
- *_filename=fl_file_line;
- *_linenum=linenum;
-}
-
-Bool EdLiteFileLine(U8 *fl_file_line,I64 edf_dof_flags=0)
-{
- Bool res;
- U8 *filename;
- I64 linenum;
- ToFileLine(fl_file_line,&filename,&linenum);
- res=EdLite(filename,linenum,edf_dof_flags);
- Free(filename);
- return res;
-}
-
-U0 FixSet(U8 *filename,I64 line)
-{//Compiler calls this to set file line for Fix
- U8 *st=MStrPrint("FL:%s,%d",filename,line);
- while (LBts(&sys_semas[SEMA_FIX],0))
- Yield;
- Free(dbg.fix_file_line);
- dbg.fix_file_line=AStrNew(st);
- LBtr(&sys_semas[SEMA_FIX],0);
-}
-
-Bool Fix(I64 edf_dof_flags=0)
-{//Jump to last err src code to fix it.
- U8 *st;
- Bool res=FALSE;
-
- while (LBts(&sys_semas[SEMA_FIX],0))
- Yield;
- st=StrNew(dbg.fix_file_line);
- LBtr(&sys_semas[SEMA_FIX],0);
-
- if (st) {
- if (IsRaw)
- res=EdLiteFileLine(st,edf_dof_flags);
- else
- res=Ed(st,edf_dof_flags);
- }
- Free(st);
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/FontCyrillic.HC.HTML b/public/src/Kernel/FontCyrillic.HC.HTML deleted file mode 100644 index 14b2483..0000000 --- a/public/src/Kernel/FontCyrillic.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - FontCyrillic.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Kernel/FontStd.HC.HTML b/public/src/Kernel/FontStd.HC.HTML deleted file mode 100644 index 0c7a239..0000000 --- a/public/src/Kernel/FontStd.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - FontStd.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Kernel/FunSeg.HC.HTML b/public/src/Kernel/FunSeg.HC.HTML deleted file mode 100644 index ca48fe5..0000000 --- a/public/src/Kernel/FunSeg.HC.HTML +++ /dev/null @@ -1,372 +0,0 @@ - - - - - FunSeg.HC - - - - - I64 HasLower(U8 *src)
-{
- I64 ch;
- while (ch=*src++)
- if ('a'<=ch<='z')
- return TRUE;
- return FALSE;
-}
-
-U0 HashFunSegFind(CHashTable *h,U8 *addr,
- Bool *_has_lower,U64 *_best,CHash **_res)
-{
- Bool *has_lower=*_has_lower;
- CHashExport *tmpex;
- U64 i,j,best=*_best;
- CHash *res=*_res;
- for (i=0;i<=h->mask;i++) {
- tmpex=h->body[i];
- while (tmpex) {
- j=0;
- if (tmpex->type&HTT_FUN) {
- if (!Bt(&tmpex(CHashFun *)->flags,Cf_EXTERN) &&
- !Bt(&tmpex(CHashFun *)->flags,Ff_INTERNAL))
- j=tmpex(CHashFun *)->exe_addr;
- } else if (tmpex->type&HTT_EXPORT_SYS_SYM)
- j=tmpex->val;
- if (j) {
- j=addr(I64)-j;
- if (0<=j<=best) {
- if (tmpex->type&HTT_EXPORT_SYS_SYM) {
- if (j<best || j==best && !has_lower) {
- has_lower=HasLower(tmpex->str);
- best=j;
- res=tmpex;
- }
- } else if (tmpex->type&HTT_FUN) {
- if (j<best || j==best &&
- (res && res->type&HTT_EXPORT_SYS_SYM||!has_lower)) {
- has_lower=HasLower(tmpex->str);
- best=j;
- res=tmpex;
- }
- }
- }
- }
- tmpex=tmpex->next;
- }
- }
- *_has_lower=has_lower;
- *_best=best;
- *_res =res;
-}
-
-CHash *FunSegFind(U8 *addr,I64 *_offset)
-{//See Hash.
- CHash *res=NULL;
- Bool has_lower=FALSE;
- CTask *task;
- CHashTable *h;
- CCPU *c;
- U64 i,best=0xFFFF;
- if (!ChkCodePtr(addr)) {
- *_offset=best;
- return NULL;
- }
- if (IsDbgMode)
- for (i=0;i<mp_cnt;i++) {
- c=&cpu_structs[i];
- task=c->seth_task;
- do {
- if (!TaskValidate(task)) goto fs_abort_task;
- h=task->hash_table;
- while (h) {
- HashFunSegFind(h,addr,&has_lower,&best,&res);
- h=h->next;
- }
- task=task->next_task;
- } while (task!=c->seth_task);
-fs_abort_task:
- }
- else {
- h=Fs->hash_table;
- while (h) {
- HashFunSegFind(h,addr,&has_lower,&best,&res);
- h=h->next;
- }
- }
- *_offset=best;
- return res;
-}
-
-U0 FunSegCacheAdd(CHash *tmps,U8 *addr)
-{
- I64 i;
- CDbgInfo *dbg_info;
- CFunSegCache *tmpfsc;
- if (tmps && tmps->type&HTT_FUN &&
- (dbg_info=tmps(CHashFun *)->dbg_info)) {
- lock i=dbg.fun_seg_cache_index++;
- tmpfsc=&dbg.fun_seg_cache[i&(FUN_SEG_CACHE_SIZE-1)];
- tmpfsc->base=dbg_info->body[0];
- if (addr<tmpfsc->base)
- tmpfsc->base=addr;
- tmpfsc->limit=dbg_info->body[dbg_info->max_line+1-dbg_info->min_line];
- if (addr>=tmpfsc->limit)
- tmpfsc->limit=addr+1;
- i=MinI64(StrLen(tmps->str),FUN_SEG_CACHE_STR_LEN-1);
- MemCpy(tmpfsc->str,tmps->str,i);
- tmpfsc->str[i]=0;
- tmpfsc->time_stamp=tS;
- }
-}
-
-U8 *FunSegCacheFind(U8 *addr,I64 *_offset)
-{
- I64 i;
- F64 timeout;
- CFunSegCache *tmpfsc=dbg.fun_seg_cache;
- if (addr==SYS_IDLE_PT) {
- *_offset=0;
- return "SYS_IDLE_PT";
- } else {
- timeout=tS+8.0;
- for (i=0;i<FUN_SEG_CACHE_SIZE;i++,tmpfsc++)
- if (tmpfsc->base<=addr<tmpfsc->limit &&
- tmpfsc->time_stamp>timeout) {
- *_offset=addr-tmpfsc->base;
- return tmpfsc->str;
- }
- return NULL;
- }
-}
-
-U0 StrPrintFunSeg(U8 *buf,I64 addr,I64 field_len,I64 flags)
-{
- I64 offset;
- CHashExport *tmpex;
- U8 *str,*str2;
- Bool is_fun=FALSE;
- if (!(flags&PRTF_TRUNCATE))
- field_len=0;
- if (addr) {
- if (str=FunSegCacheFind(addr,&offset)) {
- if (addr!=SYS_IDLE_PT)
- is_fun=TRUE;
- } else {
- if (tmpex=FunSegFind(addr,&offset)) {
- if (tmpex->type&HTT_FUN)
- is_fun=TRUE;
- FunSegCacheAdd(tmpex,addr);
- str=tmpex->str;
- }
- }
- if (str) {
- if (offset>0xFFFF) offset=0xFFFF;
- if (flags&PRTF_COMMA) {
- if (is_fun) {
- str2=MStrPrint("&%s",str);
- if (!field_len)
- StrCpy(buf,str2);
- else if (flags&PRTF_LEFT_JUSTIFY && StrLen(str2)<field_len)
- StrCpy(buf,str2);
- else
- StrPrint(buf,"%*ts",field_len,str2);
- Free(str2);
- } else {
- if (!field_len)
- StrCpy(buf,str);
- else if (flags&PRTF_LEFT_JUSTIFY && StrLen(str)<field_len)
- StrCpy(buf,str);
- else
- StrPrint(buf,"%*ts",field_len,str);
- }
- } else {
- if (is_fun) {
- str2=MStrPrint("&%s",str);
- if (field_len && field_len>7) {
- if (flags&PRTF_LEFT_JUSTIFY && StrLen(str2)<field_len-7)
- StrPrint(buf,"%s+0x%04X",str2,offset);
- else
- StrPrint(buf,"%*ts+0x%04X",field_len-7,str2,offset);
- } else
- StrPrint(buf,"%s+0x%04X",str2,offset);
- Free(str2);
- } else {
- if (field_len && field_len>7) {
- if (flags&PRTF_LEFT_JUSTIFY && StrLen(str)<field_len-7)
- StrPrint(buf,"%s+0x%04X",str,offset);
- else
- StrPrint(buf,"%*ts+0x%04X",field_len-7,str,offset);
- } else
- StrPrint(buf,"%s+0x%04X",str,offset);
- }
- }
- return;
- }
- }
- if (flags&PRTF_COMMA)
- StrCpy(buf,".");
- else if (flags&PRTF_TRUNCATE && field_len)
- StrPrint(buf,"%*tX",field_len,addr);
- else
- StrPrint(buf,"%X",addr);
-}
-
-I64 SrcLineNum(U8 *addr,I64 cnt=1)
-{//linenum for src of addr.
- CHashSrcSym *tmph;
- I64 cur_line,first_line,last_line,num_lines,offset;
- CDbgInfo *dbg_info;
- U32 *body;
- U8 *src,*src2;
- if (tmph=FunSegFind(addr,&offset)) {
- if (tmph->type&(HTT_FUN|HTT_EXPORT_SYS_SYM)) {
- if (dbg_info=tmph->dbg_info) {
- num_lines=dbg_info->max_line-dbg_info->min_line+1;
- body=dbg_info->body;
-
- //find first nonzero
- first_line=0;
- while (!body[first_line]) {
- first_line++;
- if (first_line>=num_lines)
- return -1;
- }
-
- //find last nonzero
- last_line=num_lines-1;
- while (!body[last_line] && last_line>first_line)
- last_line--;
-
- //interpolate to guess line num
- cur_line=ClampI64(ToF64(addr-body[first_line])*(last_line-first_line+1)/
- (body[last_line]-body[first_line]+1),first_line,last_line);
-
- //retreat while too high
- while ((!body[cur_line] || body[cur_line]>=addr) && cur_line>first_line)
- cur_line--;
-
- //advance while to low
- while ((!body[cur_line] || body[cur_line]<addr) && cur_line<last_line)
- cur_line++;
-
- if (addr<body[cur_line]+cnt)
- return cur_line+dbg_info->min_line;
-
- } else if (tmph->src_link) {
- src =StrNew(tmph->src_link);
- src2=StrNew(tmph->src_link);
- StrLastRem(src,",",src2);
- cur_line=Str2I64(src2);
- Free(src);
- Free(src2);
- return cur_line;
- }
- }
- }
- return -1;
-}
-
-U8 *SrcFileName(U8 *addr,I64 cnt=1,CTask *mem_task=NULL)
-{//MAlloc filename for src of addr.
- CHashSrcSym *tmph;
- I64 i,j,ii,offset,best=NULL,d,best_d;
- U32 *body;
- CDbgInfo *dbg_info;
- U8 *src;
- if ((tmph=FunSegFind(addr,&offset)) &&
- tmph->type&(HTT_FUN|HTT_EXPORT_SYS_SYM)) {
- if (dbg_info=tmph->dbg_info) {
- j=dbg_info->max_line-dbg_info->min_line+1;
- body=dbg_info->body;
- best_d=I64_MAX;
- for (i=0;i<j;i++) {
- if (0<body[i]<=addr<body[i]+cnt) {
- ii=i+1;
- while (!body[ii])
- ii++;
- if (addr<body[ii]) {
- d=addr(I64)-body[i];
- if (d<best_d) {
- best_d=d;
- best=tmph->src_link;
- }
- }
- }
- }
- } else
- best=tmph->src_link;
- }
- if (best) {
- src=StrNew(best,mem_task);
- StrFirstRem(src,":");
- StrLastRem(src,",");
- return src;
- } else
- return NULL;
-}
-
-U8 *SrcEdLink(U8 *addr,I64 cnt=1,CTask *mem_task=NULL)
-{//MAlloc file,line link to src of addr.
- U8 *filename,*st,*st2;
- I64 linenum;
- if (filename=SrcFileName(addr,cnt)) {
- linenum=SrcLineNum(addr,cnt);
- if (linenum<1)
- linenum=1;
- st2=MStrPrint("FL:%s,%d",filename,linenum);
- Free(filename);
- st=StrNew(st2,mem_task);
- Free(st2);
- return st;
- }
- return NULL;
-}
-
-Bool PutSrcLink(U8 *addr,I64 cnt=1,U8 *buf=NULL)
-{//Put to StdOut a DolDoc file,line link to src of addr.
- U8 *src;
- if (src=SrcEdLink(addr,cnt)) {
- if (buf)
- StrPrint(buf,"$LK,\"%p\",A=\"%s\"$",addr,src);
- else
- "$LK,\"%p\",A=\"%s\"$",addr,src;
- Free(src);
- return TRUE;
- } else if (buf)
- *buf=0;
- return FALSE;
-}
-
-Bool E(U8 *addr,I64 cnt=512,I64 edf_dof_flags=0)
-{//Edit src at addr.
- U8 *st;
- Bool res=FALSE;
- if (st=SrcEdLink(addr,cnt)) {
- if (IsRaw)
- res=EdLiteFileLine(st,edf_dof_flags);
- else
- res=Ed(st,edf_dof_flags);
- Free(st);
- }
- return res;
-}
-
-Bool Man(U8 *st,I64 edf_dof_flags=0)
-{//Owner's manual for symbol. Edit src code for symbol.
- Bool res=FALSE;
- U8 **st2;
- CHashSrcSym *tmph;
- if (IsRaw) {
- if ((tmph=HashFind(st,Fs->hash_table,HTG_SRC_SYM)) && tmph->src_link)
- res=EdLiteFileLine(tmph->src_link,edf_dof_flags);
- } else {
- st2=MStrPrint("MN:%s",st);
- res=Ed(st2,edf_dof_flags);
- Free(st2);
- }
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/Job.HC.HTML b/public/src/Kernel/Job.HC.HTML deleted file mode 100644 index e4a148f..0000000 --- a/public/src/Kernel/Job.HC.HTML +++ /dev/null @@ -1,514 +0,0 @@ - - - - - Job.HC - - - - - U0 JobDel(CJob *tmpc)
-{//Free one cmd node.
- Free(tmpc->aux_str);
- Free(tmpc);
-}
-
-U0 JobQueDel(CJob *head)
-{
- CJob *tmpc=head->next,*tmpc1;
- while (tmpc!=head) {
- tmpc1=tmpc->next;
- QueRem(tmpc);
- JobDel(tmpc);
- tmpc=tmpc1;
- }
-}
-
-U0 JobCtrlInit(CJobCtrl *ctrl)
-{
- QueInit(&ctrl->next_waiting);
- QueInit(&ctrl->next_done);
- ctrl->flags=0;
-}
-
-U0 TaskRstAwaitingMsg(CTask *task=NULL)
-{//Pop-ups get parent messages so wake-up our pop-ups if we got a msg.
- if (!task) task=Fs;
- PUSHFD
- CLI
- do {
- if (TaskValidate(task))
- LBtr(&task->task_flags,TASKf_AWAITING_MSG);
- else
- break;
- } while (task=task->popup_task);
- POPFD
-}
-
-CJob *TaskExe(CTask *srv,CTask *master,U8 *data,I64 flags)
-{//Queues a request to compile and execute src code text.
- CJob *res;
- if (!data || !TaskValidate(srv) || master && !TaskValidate(master) ||
- srv->popup_task && !Bt(&srv->task_flags,TASKf_FILTER_INPUT))
- return NULL;
- res=ACAlloc(sizeof(CJob));
- res->master_task=master;
- res->job_code=JOBT_EXE_STR;
- res->flags=flags;
- res->aux_str=AStrNew(data);
- res->ctrl=&srv->srv_ctrl;
-
- PUSHFD
- CLI
- while (LBts(&srv->srv_ctrl.flags,JOBCf_LOCKED))
- PAUSE
- if (!TaskValidate(srv)) {
- LBtr(&srv->srv_ctrl.flags,JOBCf_LOCKED);
- POPFD
- JobDel(res);
- return NULL;
- } else {
- LBtr(&srv->task_flags,TASKf_IDLE);
- TaskRstAwaitingMsg(srv);
- QueIns(res,srv->srv_ctrl.last_waiting);
- LBtr(&srv->srv_ctrl.flags,JOBCf_LOCKED);
- if (Bt(&flags,JOBf_WAKE_MASTER)) {
- Suspend(master);
- Yield;
- }
- }
- POPFD
- return res;
-}
-
-CJob *TaskText(CTask *srv,CTask *master,U8 *data,I64 flags)
-{//Post StdIn text to servant task. Tell who the master task is.
- CJob *res;
- CTask *task;
- if (!data || !TaskValidate(srv) || master && !TaskValidate(master) ||
- srv->popup_task && !Bt(&srv->task_flags,TASKf_FILTER_INPUT))
- return NULL;
- res=ACAlloc(sizeof(CJob));
- res->master_task=master; //in case somebody cares
- res->job_code=JOBT_TEXT_INPUT;
- res->flags=flags;
- res->aux_str=AStrNew(data);
-
- PUSHFD
- task=srv->last_input_filter_task;
- if (Bt(&flags,JOBf_HIGHEST_PRIORITY) || task==srv) {
- if (task!=srv)
- TaskWait(srv);
- task=Spawn(&InputFilterTask,NULL,"Input Filter",,srv);
- CLI
- task->next_input_filter_task=srv->next_input_filter_task;
- task->last_input_filter_task=srv;
- srv->next_input_filter_task=task;
- task->next_input_filter_task->last_input_filter_task=task;
- } else {
- CLI
- task=srv->next_input_filter_task;
- }
- res->ctrl=&task->srv_ctrl;
- while (LBts(&task->srv_ctrl.flags,JOBCf_LOCKED))
- PAUSE
- if (!TaskValidate(task)) {
- JobDel(res);
- res=NULL;
- } else {
- LBtr(&task->task_flags,TASKf_IDLE);
- TaskRstAwaitingMsg(task);
- QueIns(res,task->srv_ctrl.last_waiting);
- LBtr(&task->srv_ctrl.flags,JOBCf_LOCKED);
- }
- POPFD
- return res;
-}
-
-CJob *TaskMsg(CTask *_srv,CTask *master,
- I64 msg_code,I64 arg1,I64 arg2,I64 flags)
-{//Post message to servant task. Tell who the master task is.
-//See flags and msg_code.
- CJob *tmpc1,*tmpc;
- CTask *srv=_srv;
- if (!TaskValidate(srv) || master && !TaskValidate(master)||
- srv->popup_task && !Bt(&srv->task_flags,TASKf_FILTER_INPUT))
- return NULL;
- tmpc=ACAlloc(sizeof(CJob));
- tmpc->master_task=master;
- tmpc->job_code=JOBT_MSG;
- tmpc->msg_code=AbsI64(msg_code); //negative means do a down and up
- tmpc->aux1=arg1;
- tmpc->aux2=arg2;
- tmpc->flags=flags;
- PUSHFD
- if (Bt(&sys_semas[SEMA_RECORD_MACRO],0) &&
- srv!=sys_macro_task && msg_code==MSG_KEY_DOWN) {
- tmpc1=AMAllocIdent(tmpc);
- CLI
- QueIns(tmpc1,sys_macro_head.last);
- }
- CLI
- while (Bt(&srv->task_flags,TASKf_FILTER_INPUT) &&
- !Bt(&flags,JOBf_DONT_FILTER))
- srv=srv->next_input_filter_task;
- tmpc->ctrl=&srv->srv_ctrl;
- while (LBts(&srv->srv_ctrl.flags,JOBCf_LOCKED))
- PAUSE
- if (!TaskValidate(srv)) {
- JobDel(tmpc);
- tmpc=NULL;
- } else {
- LBtr(&srv->task_flags,TASKf_IDLE);
- TaskRstAwaitingMsg(srv);
- QueIns(tmpc,srv->srv_ctrl.last_waiting);
- LBtr(&srv->srv_ctrl.flags,JOBCf_LOCKED);
- }
- POPFD
- if (msg_code<0) //Down-Up
- TaskMsg(_srv,master,-msg_code+1,arg1,arg2,flags);
- return tmpc;
-}
-
-Bool JobResScan(CJob *rqst=NULL,I64 *_res=NULL)
-{//Check rqst complete, return with or without.
- CJobCtrl *ctrl;
- CJob *tmpc,*tmpc1;
- if (!rqst || Bt(&rqst->flags,JOBf_DONE)) {
- if (!rqst || rqst->master_task)
- ctrl=&Fs->srv_ctrl;
- else
- ctrl=rqst->ctrl;
- PUSHFD
- CLI
- while (LBts(&ctrl->flags,JOBCf_LOCKED))
- PAUSE
- tmpc1=&ctrl->next_done;
- tmpc=tmpc1->next;
- while (tmpc!=tmpc1) {
- if (!rqst || rqst==tmpc) {
- QueRem(tmpc);
- LBtr(&ctrl->flags,JOBCf_LOCKED);
- POPFD
- if (_res)
- *_res=tmpc->res;
- JobDel(tmpc);
- return TRUE;
- }
- tmpc=tmpc->next;
- }
- LBtr(&ctrl->flags,JOBCf_LOCKED);
- POPFD
- }
- if (_res)
- *_res=0;
- return FALSE;
-}
-
-I64 JobResGet(CJob *rqst=NULL)
-{//See /Demo/MultiCore/Lock.HC
- I64 res;
- CJob *tmpc1;
- if (!rqst) {
- tmpc1=&Fs->srv_ctrl.next_done;
- while (tmpc1==tmpc1->next) {
- LBts(&Fs->task_flags,TASKf_IDLE);
- Yield;
- }
- } else {
- while (!Bt(&rqst->flags,JOBf_DONE)) {
- LBts(&Fs->task_flags,TASKf_IDLE);
- Yield;
- }
- }
- LBtr(&Fs->task_flags,TASKf_IDLE);
-//Could get taken by someone else.
- JobResScan(rqst,&res);
- return res;
-}
-
-U0 TaskWait(CTask *task=NULL,Bool cmd_line_pmt=FALSE)
-{//Wait for idle.
- CTask *task1;
- CJob *tmpc1;
- if (!task) task=Fs;
- if (TaskValidate(task)) {
- PUSHFD
- CLI
- while (TRUE) {
- task1=task->last_input_filter_task;
- tmpc1=&task1->srv_ctrl.next_waiting;
- if (task1==Fs || !TaskValidate(task1) ||
- tmpc1==tmpc1->next && Bt(&task1->task_flags,TASKf_IDLE) &&
- (!cmd_line_pmt || Bt(&task1->task_flags,TASKf_CMD_LINE_PMT)))
- break;
- Yield;
- }
- POPFD
- }
-}
-
-U0 PostMsg(CTask *task,I64 msg_code,I64 arg1,I64 arg2,I64 flags=0)
-{//Post message to a task and return immediately. See msg_code.
- if (TaskValidate(task)) {
- if (Bt(&task->task_flags,TASKf_INPUT_FILTER_TASK))
- TaskMsg(task->last_input_filter_task,NULL,msg_code,arg1,arg2,
- flags|1<<JOBf_DONT_FILTER);
- else
- TaskMsg(task,NULL,msg_code,arg1,arg2,flags);
- }
-}
-
-U0 PostMsgWait(CTask *task,I64 msg_code,I64 arg1,I64 arg2,I64 flags=0)
-{//Post message to a task and wait until task is idle.See msg_code.
- PostMsg(task,msg_code,arg1,arg2,flags);
- TaskWait(task);
-}
-
-U0 Msg(I64 msg_code,I64 arg1,I64 arg2,I64 flags=0)
-{//Post message to current task and return immediately.
-//See msg_code.
- PostMsg(Fs,msg_code,arg1,arg2,flags);
-}
-
-#define JOB_DONE 0
-#define JOB_CONT 1
-#define JOB_EXIT 2
-
-I64 JobRunOne(I64 run_flags,CJobCtrl *ctrl)
-{//Called with ctrl->flags,JOBCf_LOCKED.
- CJob *tmpc=ctrl->next_waiting;
- CTask *master;
- I64 res,flags=tmpc->flags,old_flags=GetRFlags;
- if (Bt(&flags,JOBf_EXIT_ON_COMPLETE))
- res=JOB_EXIT;
- else
- res=JOB_CONT;
- switch (tmpc->job_code) {
- case JOBT_SPAWN_TASK:
- QueRem(tmpc);
- LBts(&tmpc->flags,JOBf_DISPATCHED);
- LBtr(&ctrl->flags,JOBCf_LOCKED);
- if (tmpc->aux_str)
- tmpc->spawned_task=Spawn(tmpc->addr,tmpc->fun_arg,
- tmpc->aux_str,,tmpc->aux1,tmpc->aux2,tmpc->flags);
- else
- tmpc->spawned_task=Spawn(tmpc->addr,tmpc->fun_arg,
- "Unnamed",,tmpc->aux1,tmpc->aux2,tmpc->flags);
- break;
- case JOBT_CALL:
- QueRem(tmpc);
- LBts(&tmpc->flags,JOBf_DISPATCHED);
- LBtr(&ctrl->flags,JOBCf_LOCKED);
- SetRFlags(run_flags);
- LBtr(&Fs->task_flags,TASKf_IDLE);
- try
- tmpc->res=(*tmpc->addr)(tmpc->fun_arg);
- catch
- Fs->catch_except=TRUE;
- SetRFlags(old_flags);
- break;
- case JOBT_EXE_STR:
- QueRem(tmpc);
- LBts(&tmpc->flags,JOBf_DISPATCHED);
- LBtr(&ctrl->flags,JOBCf_LOCKED);
- SetRFlags(run_flags);
- LBtr(&Fs->task_flags,TASKf_IDLE);
- try
- tmpc->res=ExePrint("%s",tmpc->aux_str);
- catch
- Fs->catch_except=TRUE;
- SetRFlags(old_flags);
- break;
- default:
- res=JOB_DONE;
- }
- if (res) {
- if (master=tmpc->master_task) {
- if (!Bt(&flags,JOBf_FREE_ON_COMPLETE)) {
- CLI
- while (LBts(&master->srv_ctrl.flags,JOBCf_LOCKED))
- PAUSE
- QueIns(tmpc,master->srv_ctrl.last_done);
- LBts(&tmpc->flags,JOBf_DONE);
- LBtr(&master->srv_ctrl.flags,JOBCf_LOCKED);
- SetRFlags(old_flags);
- }
- if (Bt(&flags,JOBf_FOCUS_MASTER) &&
- !Bt(&master->win_inhibit,WIf_SELF_FOCUS))
- sys_focus_task=master;
- if (Bt(&flags,JOBf_WAKE_MASTER))
- Suspend(master,FALSE);
- }
- if (Bt(&flags,JOBf_FREE_ON_COMPLETE))
- JobDel(tmpc);
- else if (!master) {
- CLI
- while (LBts(&ctrl->flags,JOBCf_LOCKED))
- Yield;
- QueIns(tmpc,ctrl->last_done);
- LBts(&tmpc->flags,JOBf_DONE);
- LBtr(&ctrl->flags,JOBCf_LOCKED);
- SetRFlags(old_flags);
- }
- }
- return res;
-}
-
-I64 JobsHndlr(I64 run_flags,CTask *task=NULL)
-{//Handle all waiting cmds and return.
- I64 cnt=0,old_flags=GetRFlags;
- if (!task) task=Fs;
- while (TRUE) {
- CLI
- while (LBts(&task->srv_ctrl.flags,JOBCf_LOCKED))
- PAUSE
- if (task->srv_ctrl.next_waiting!=&task->srv_ctrl)
- switch (JobRunOne(run_flags,&task->srv_ctrl)) {
- case JOB_CONT:
- cnt++;
- break;
- case JOB_EXIT:
- Exit;
- case JOB_DONE:
- goto jh_done;
- }
- else
- goto jh_done;
- }
-jh_done:
- LBtr(&task->srv_ctrl.flags,JOBCf_LOCKED);
- SetRFlags(old_flags);
- return cnt;
-}
-
-I64 PopUp(U8 *buf,CTask *parent=NULL,CTask **_pu_task=NULL)
-{//Execute code in PopUp task.
- I64 res;
- CJob *tmpc;
- CTask *task=Spawn(&SrvCmdLine,NULL,"Servant",,parent);
- if (!parent) {
- TaskExe(task,parent,buf,1<<JOBf_EXIT_ON_COMPLETE|1<<JOBf_FREE_ON_COMPLETE);
- if (_pu_task) *_pu_task=task;
- return 0;
- } else {
- Fs->popup_task=task;
- tmpc=TaskExe(task,parent,buf,1<<JOBf_WAKE_MASTER|1<<JOBf_FOCUS_MASTER);
- if (_pu_task) *_pu_task=task;
- JobResScan(tmpc,&res);
- Fs->popup_task=NULL;
- Kill(task);
- if (_pu_task) *_pu_task=NULL;
- return res;
- }
-}
-
-I64 PopUpPrint(U8 *fmt,...)
-{//Execute code in PopUp task.
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
- I64 res;
- res=PopUp(buf,Fs);
- Free(buf);
- return res;
-}
-
-I64 Adam(U8 *fmt,...)
-{//Make adam_task execute code.
- I64 res;
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
- CJob *tmpc;
- if (Fs==adam_task) {
- tmpc=TaskExe(adam_task,Fs,buf,0);
- JobsHndlr(GetRFlags);
- } else {
- TaskWait(adam_task);
- tmpc=TaskExe(adam_task,Fs,buf,1<<JOBf_WAKE_MASTER);
- }
- JobResScan(tmpc,&res);
- Free(buf);
- return res;
-}
-
-U0 AdamLog(U8 *fmt,...)
-{//Display text in adam_task.
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
- if (Fs==adam_task)
- "%s",buf;
- else if (!IsSingleUser)
- Adam("\"%%s\",%d;",buf);
- Free(buf);
-}
-
-U0 AdamErr(U8 *fmt,...)
-{//Display red blinking Err text in adam_task.
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv),
- *st=MStrPrint(ST_ERR_ST "%s",buf);
- if (Fs==adam_task)
- "%s",st;
- else if (!IsSingleUser)
- Adam("\"%%s\",%d;",st);
- Free(st);
- Free(buf);
-}
-
-U0 XTalk(CTask *task,U8 *fmt,...)
-{//Sends text to other task. See /Misc/OSTestSuite.HC.
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv),*st=AStrNew(buf),
- *st2=MStrPrint("\"%%s\",%d;Free(%d);",st,st);
- TaskText(task,NULL,st2,0);
- Free(st2);
- Free(buf);
-}
-
-U0 XTalkWait(CTask *task,U8 *fmt,...)
-{//Send text to other task and wait for it to idle.
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv),*st=AStrNew(buf),
- *st2=MStrPrint("\"%%s\",%d;Free(%d);",st,st);
- TaskText(task,NULL,st2,0);
- Free(st2);
- Free(buf);
- TaskWait(task);
-}
-
-U0 InStr(U8 *fmt,...)
-{//Send InFile code to self.
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
- if (Bt(&Fs->task_flags,TASKf_INPUT_FILTER_TASK))
- ExePrint("%s",buf);
- else
- TaskText(Fs,NULL,buf,1<<JOBf_HIGHEST_PRIORITY);
- Free(buf);
-}
-
-U0 InFile(U8 *filename)
-{//Send InFile code file to self.
- U8 *name=ExtDft(filename,"IN.Z");
- InStr("Cd(\"%C:%s\");;#include \"%s\"",
- Drv2Let(Fs->cur_dv),Fs->cur_dir,name);
- Free(name);
-}
-
-U0 In(U8 *fmt,...)
-{//Send text to own input buffer. See /Demo/AcctExample/TOS/TOSDistro.HC.
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv),*st=AStrNew(buf);
- InStr("\"%%s\",%d;Free(%d);",st,st);
- Free(buf);
-}
-
-U0 XTalkStr(CTask *task,U8 *fmt,...)
-{//Send InFile code to other task.
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
- TaskText(task,NULL,buf,0);
- Free(buf);
-}
-
-U0 XTalkStrWait(CTask *task,U8 *fmt,...)
-{//Send InFile code to other task and wait for it to idle.
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
- TaskText(task,NULL,buf,0);
- Free(buf);
- TaskWait(task);
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/KCfg.HC.HTML b/public/src/Kernel/KCfg.HC.HTML deleted file mode 100644 index 500c3ed..0000000 --- a/public/src/Kernel/KCfg.HC.HTML +++ /dev/null @@ -1,185 +0,0 @@ - - - - - KCfg.HC - - - - - //This is run in a #exe{}.
-
-U8 *kernel_cfg_options="MemInit\0HeapInit\0VarInit\0StaffMode\0"
-"HomeDir\0NoMP\0TextMode\0DontProbe\0MountIDEAuto\0DbgDistro\0Help\0";
-
-#define CFG_MEM_INIT 0
-#define CFG_HEAP_INIT 1
-#define CFG_VAR_INIT 2
-#define CFG_STAFF_MODE 3
-#define CFG_HOME_DIR 4
-#define CFG_NO_MP 5
-#define CFG_TEXT_MODE 6
-#define CFG_DONT_PROBE 7
-#define CFG_MOUNT_IDE_AUTO 8
-#define CFG_DBG_DISTRO 9
-#define CFG_OPTIONS_NUM 10
-
-#define CFG_HELP 10
-
-class CKCfg
-{
- U8 *dsk_cache_size_exp;
- CDoc *add_dev;
- U8 *dbg_distro_file,*dbg_distro_start;
- U8 *home_dir;
- Bool opts[CFG_OPTIONS_NUM];
- U8 mem_init_val,heap_init_val,var_init_val,
- boot_drv_let,mount_ide_auto_hd_let,mount_ide_auto_cd_let;
-};
-
-CDoc *KCfgAddDev(CKCfg *c)
-{
- I64 ch;
- CDoc *doc=DocNew;
- "\n\nIn anticipation of the drives you will\n"
- "define shortly, enter the drive letter\n"
- "of the drive with the account directory.\n"
- "\n($PURPLE$<ENTER>$FG$ for cur drv) Boot Drv:";
- ch=Let2Let(GetChar);
- if ('A'<=ch<='Z')
- c->boot_drv_let=ch;
- else
- c->boot_drv_let=Drv2Let(Fs->cur_dv);
- "\n\n$BK,1$$PURPLE$Mount drives so they will be present when "
- "you boot.$FG$$BK,0$\n";
- Mount2(c->boot_drv_let,doc,FALSE);
- return doc;
-}
-
-U0 KCfgOptions(CKCfg *c)
-{
- I64 i;
- U8 *st=NULL,*st2,*st3;
- Bool state;
- do {
- Free(st);
- for (i=0;i<CFG_OPTIONS_NUM;i++)
- if (i==CFG_HOME_DIR)
- "$PURPLE$%13tz$FG$:\"%s\"\n",i,kernel_cfg_options,c->home_dir;
- else
- "$PURPLE$%13tz$FG$:%Z\n",i,kernel_cfg_options,c->opts[i],"ST_OFF_ON";
- "\nType '$PURPLE$Help$FG$' for help.\n";
- st=GetStr("Option ($PURPLE$<ENTER>$FG$ when done):","");
- i=LstMatch(st,kernel_cfg_options,LMF_IGNORE_CASE);
- if (i==CFG_HELP)
- "\n"
- "$PURPLE$MemInit$FG$ Initializes memory above 0x100000 "
- "to a val at boot.\n"
- "$PURPLE$HeapInit$FG$ Initializes MAlloc() memory to a val.\n"
- "$PURPLE$VarInit$FG$ Initializes glbl var memory to a val.\n"
- "$PURPLE$HomeDir$FG$ Set home dir.\n"
- "$PURPLE$NoMP$FG$ No multicore.\n"
- "$PURPLE$TextMode$FG$ Text Mode (requires hard reboot).\n"
- "$PURPLE$DontProbe$FG$ Just prompt CD/DVD ports, don't probe.\n"
- "$PURPLE$MountIDEAuto$FG$ Auto Mount IDE drives to 'C' and 'T'.\n"
- "$PURPLE$DbgDistro$FG$ Include RAM Drv in Kernel.BIN.\n"
- "\n";
- else
- if (0<=i<CFG_OPTIONS_NUM) {
- state=c->opts[i]=!c->opts[i];
- switch (i) {
- case CFG_MEM_INIT:
- if (state)
- c->mem_init_val=GetI64("Val (0-255):",255,0,255);
- break;
- case CFG_HEAP_INIT:
- if (state)
- c->heap_init_val=GetI64("Val (0-255):",255,0,255);
- break;
- case CFG_VAR_INIT:
- if (state)
- c->var_init_val=GetI64("Val (0-255):",255,0,255);
- break;
- case CFG_HOME_DIR:
- st2=GetStr("Home Dir(\"%s\"):",c->home_dir);
- if (!*st2)
- st2=StrNew("::/Home");
- else if (st2[1]!=':') {
- st3=MStrPrint("::%s",st2);
- Free(st2);
- st2=st3;
- }
- Free(c->home_dir);
- c->home_dir=st2;
- if (StrCmp(c->home_dir,"::/Home"))
- c->opts[i]=TRUE;
- else
- c->opts[i]=FALSE;
- break;
- case CFG_MOUNT_IDE_AUTO:
- if (state) {
- "First HD Drive Let:";
- c->mount_ide_auto_hd_let=Let2Let(GetChar);
- if (!('A'<=c->mount_ide_auto_hd_let<='Z'))
- c->mount_ide_auto_hd_let=0;
- '\n';
- if (c->mount_ide_auto_hd_let)
- "First HD Drive:%C\n",c->mount_ide_auto_hd_let;
- else
- "First HD Drive:%C\n",'C';
-
- "First CD Drive Let:";
- c->mount_ide_auto_cd_let=Let2Let(GetChar);
- if (!('A'<=c->mount_ide_auto_cd_let<='Z'))
- c->mount_ide_auto_cd_let=0;
- '\n';
- if (c->mount_ide_auto_cd_let)
- "First CD Drive:%C\n",c->mount_ide_auto_cd_let;
- else
- "First CD Drive:%C\n",'T';
- } else {
- c->mount_ide_auto_hd_let=0;
- c->mount_ide_auto_cd_let=0;
- }
- break;
- case CFG_DBG_DISTRO:
- Free(c->dbg_distro_file);
- c->dbg_distro_file=0;
- c->dbg_distro_start=0;
- if (state) {
- c->dbg_distro_file=GetStr("Dbg Distro File:");
- c->dbg_distro_start=GetI64("Dbg Distro Start:");
- }
- break;
- }
- }
- } while (*st);
- Free(st);
-}
-
-CKCfg *KCfgNew()
-{
- CKCfg *c=CAlloc(sizeof(CKCfg));
-
- c->add_dev=KCfgAddDev(c);
- c->home_dir=StrNew("::/Home");
- c->dsk_cache_size_exp=GetStr(
- "Disk Cache Size in Bytes,\n"
- "gets rounded-up funny,\n"
- "($PURPLE$<ENTER>$FG$ will use default.):",
- "Scale2Mem(0x80000,0x8000000)");
- KCfgOptions(c);
- return c;
-}
-
-U0 KCfgDel(CKCfg *c)
-{
- DocDel(c->add_dev);
- Free(c->dbg_distro_file);
- Free(c->home_dir);
- Free(c->dsk_cache_size_exp);
- Free(c);
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/KDataTypes.HC.HTML b/public/src/Kernel/KDataTypes.HC.HTML deleted file mode 100644 index 311529d..0000000 --- a/public/src/Kernel/KDataTypes.HC.HTML +++ /dev/null @@ -1,335 +0,0 @@ - - - - - KDataTypes.HC - - - - - U0 LinkedLstDel(U8 **_lst)
-{//Free entire linked-list.
- U8 **tmpl;
- while (_lst) {
- tmpl=*_lst;
- Free(_lst);
- _lst=tmpl;
- }
-}
-
-U8 *LinkedLstCopy(U8 **_lst,CTask *mem_task=NULL)
-{//MAlloc ident copy of entire linked-list.
- U8 *res=NULL,**tmpl=&res;
- while (_lst) {
- tmpl=*tmpl=MAllocIdent(_lst,mem_task);
- _lst=*_lst;
- }
- return res;
-}
-
-I64 LinkedLstCnt(U8 **_lst)
-{//Count of nodes in linked-list.
- I64 res=0;
- while (_lst) {
- res++;
- _lst=*_lst;
- }
- return res;
-}
-
-I64 LinkedLstSize(U8 **_lst)
-{//Mem size of all nodes in linked-list.
- I64 res=0;
- while (_lst) {
- res+=MSize2(_lst);
- _lst=*_lst;
- }
- return res;
-}
-
-U0 QueDel(CQue *head,Bool querem=FALSE)
-{//Free entries in queue, not head.
- CQue *tmpq=head->next,*tmpq1;
- while (tmpq!=head) {
- tmpq1=tmpq->next;
- if (querem)
- QueRem(tmpq);
- Free(tmpq);
- tmpq=tmpq1;
- }
-}
-
-CQue *QueCopy(CQue *head,CTask *mem_task=NULL)
-{//MAlloc ident copy of entire queue and head.
- CQue *res=MAllocIdent(head,mem_task),*tmpq=head->next,*tmpq1;
- QueInit(res);
- while (tmpq!=head) {
- tmpq1=MAllocIdent(tmpq,mem_task);
- QueIns(tmpq1,res->last);
- tmpq=tmpq->next;
- }
- return res;
-}
-
-I64 QueCnt(CQue *head)
-{//Count of nodes in queue, not head.
- CQue *tmpq=head->next;
- I64 res=0;
- while (tmpq!=head) {
- res++;
- tmpq=tmpq->next;
- }
- return res;
-}
-
-I64 QueSize(CQue *head)
-{//Mem size of all nodes in queue, not head.
- CQue *tmpq=head->next;
- I64 res=0;
- while (tmpq!=head) {
- res+=MSize2(tmpq);
- tmpq=tmpq->next;
- }
- return res;
-}
-
-CQueVectU8 *QueVectU8New(I64 min_idx=0)
-{//Create new queue vecter.
- CQueVectU8 *res=MAlloc(sizeof(CQueVectU8));
- QueInit(res);
- res->total_cnt=res->node_cnt=0;
- res->min_idx=min_idx;
- return res;
-}
-
-U0 QueVectU8Put(CQueVectU8 *v,I64 idx,U8 ch)
-{//Put U8 at idx i.
- CQueVectU8 *tmpv;
- idx-=v->min_idx;
- if (idx<0) return;
- if (idx<v->total_cnt) {
- tmpv=v;
- do {
- idx-=tmpv->node_cnt;
- if (idx<0) {
- tmpv->body[idx+tmpv->node_cnt]=ch;
- return;
- }
- tmpv=tmpv->next;
- } while (tmpv!=v);
- } else
- idx-=v->total_cnt;
-
- while (TRUE) {
- tmpv=v->last;
- if (tmpv->node_cnt>=QUE_VECT_U8_CNT) {
- tmpv=MAlloc(sizeof(CQueVectU8));
- tmpv->node_cnt=0;
- QueIns(tmpv,v->last);
- }
- if (idx--) {
- tmpv->body[tmpv->node_cnt++]=0;
- v->total_cnt++;
- } else {
- tmpv->body[tmpv->node_cnt++]=ch;
- v->total_cnt++;
- break;
- }
- }
-}
-
-U0 QueVectU8Del(CQueVectU8 *v)
-{//Free entire queue vector.
- if (v) {
- QueDel(v);
- Free(v);
- }
-}
-
-I64 QueVectU8Get(CQueVectU8 *v,I64 idx)
-{//Get U8 at idx i.
- CQueVectU8 *tmpv;
- idx-=v->min_idx;
- if (!(0<=idx<v->total_cnt)) return 0;
- tmpv=v;
- do {
- idx-=tmpv->node_cnt;
- if (idx<0)
- return tmpv->body[idx+tmpv->node_cnt];
- tmpv=tmpv->next;
- } while (tmpv!=v);
- return 0;
-}
-
-CFifoU8 *FifoU8New(I64 size,CTask *mem_task=NULL)
-{//Create new fifo.
- CFifoU8 *f;
- if (!mem_task) mem_task=Fs;
- f=MAlloc(sizeof(CFifoU8),mem_task);
- f->buf=MAlloc(size,mem_task);
- f->mask=size-1;
- f->in_ptr=0;
- f->out_ptr=0;
- return f;
-}
-
-U0 FifoU8Del(CFifoU8 *f)
-{//Free fifo.
- Free(f->buf);
- Free(f);
-}
-
-Bool FifoU8Ins(CFifoU8 *f,U8 b)
-{//Insert U8 into fifo.
- I64 new_in_ptr;
- PUSHFD
- CLI
- new_in_ptr=(f->in_ptr+1)&f->mask;
- if (new_in_ptr==f->out_ptr) {
- POPFD
- return FALSE;
- } else {
- f->buf[f->in_ptr]=b;
- f->in_ptr=new_in_ptr;
- POPFD
- return TRUE;
- }
-}
-
-Bool FifoU8Rem(CFifoU8 *f,U8 *_b)
-{//Remove U8 from fifo.
- PUSHFD
- CLI
- if (f->in_ptr==f->out_ptr) {
- POPFD
- return FALSE;
- } else {
- *_b=f->buf[f->out_ptr];
- f->out_ptr=(f->out_ptr+1)&f->mask;
- POPFD
- return TRUE;
- }
-}
-
-Bool FifoU8Peek(CFifoU8 *f,U8 *_b)
-{//Peek at front of fifo and don't remove.
- PUSHFD
- CLI
- if (f->in_ptr==f->out_ptr) {
- POPFD
- return FALSE;
- } else {
- *_b=f->buf[f->out_ptr];
- POPFD
- return TRUE;
- }
-}
-
-U0 FifoU8Flush(CFifoU8 *f)
-{//Flush fifo getting rid of all U8's.
- PUSHFD
- CLI
- f->out_ptr=f->in_ptr;
- POPFD
-}
-
-I64 FifoU8Cnt(CFifoU8 *f)
-{//Count of U8's in fifo.
- I64 res;
- PUSHFD
- CLI
- if (f->out_ptr>f->in_ptr)
- res=f->mask+1-(f->out_ptr-f->in_ptr);
- else
- res=f->in_ptr-f->out_ptr;
- POPFD
- return res;
-}
-
-CFifoI64 *FifoI64New(I64 size,CTask *mem_task=NULL)
-{//Create new fifo.
- CFifoI64 *f;
- if (!mem_task) mem_task=Fs;
- f=MAlloc(sizeof(CFifoI64),mem_task);
- f->buf=MAlloc(size*sizeof(I64),mem_task);
- f->mask=size-1;
- f->in_ptr=0;
- f->out_ptr=0;
- return f;
-}
-
-U0 FifoI64Del(CFifoI64 *f)
-{//Free fifo.
- Free(f->buf);
- Free(f);
-}
-
-Bool FifoI64Ins(CFifoI64 *f,I64 q)
-{//Insert I64 into fifo.
- I64 new_in_ptr;
- PUSHFD
- CLI
- new_in_ptr=(f->in_ptr+1)&f->mask;
- if (new_in_ptr==f->out_ptr) {
- POPFD
- return FALSE;
- } else {
- f->buf[f->in_ptr]=q;
- f->in_ptr=new_in_ptr;
- POPFD
- return TRUE;
- }
-}
-
-Bool FifoI64Rem(CFifoI64 *f,I64 *_q)
-{//Remove I64 from fifo.
- PUSHFD
- CLI
- if (f->in_ptr==f->out_ptr) {
- POPFD
- return FALSE;
- } else {
- *_q=f->buf[f->out_ptr];
- f->out_ptr=(f->out_ptr+1)&f->mask;
- POPFD
- return TRUE;
- }
-}
-
-Bool FifoI64Peek(CFifoI64 *f,I64 *_q)
-{//Peek at front of fifo and don't remove.
- PUSHFD
- CLI
- if (f->in_ptr==f->out_ptr) {
- POPFD
- return FALSE;
- } else {
- *_q=f->buf[f->out_ptr];
- POPFD
- return TRUE;
- }
-}
-
-U0 FifoI64Flush(CFifoI64 *f)
-{//Flush fifo getting rid of all I64's.
- PUSHFD
- CLI
- f->out_ptr=f->in_ptr;
- POPFD
-}
-
-I64 FifoI64Cnt(CFifoI64 *f)
-{//Count of I64's in fifo.
- I64 res;
- PUSHFD
- CLI
- if (f->out_ptr>f->in_ptr)
- res=f->mask+1-(f->out_ptr-f->in_ptr);
- else
- res=f->in_ptr-f->out_ptr;
- POPFD
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/KDate.HC.HTML b/public/src/Kernel/KDate.HC.HTML deleted file mode 100644 index 25282c5..0000000 --- a/public/src/Kernel/KDate.HC.HTML +++ /dev/null @@ -1,208 +0,0 @@ - - - - - KDate.HC - - - - - //See /Doc/TimeDate.DD
-
-U16 mon_start_days1[12]={
-0,31,59,90,120,151,181,212,243,273,304,334};
-U16 mon_start_days2[12]={
-0,31,60,91,121,152,182,213,244,274,305,335};
-
-I64 YearStartDate(I64 year)
-{//32-bit day since AD 0, given year number.
- I64 y1=year-1,yd4000=y1/4000,yd400=y1/400,yd100=y1/100,yd4=y1/4;
- return year*365+yd4-yd100+yd400-yd4000;
-}
-
-CDate Struct2Date(CDateStruct *_ds)
-{//Cvt CDateStruct to CDate.
- CDate cdt;
- I64 i1,i2;
- i1=YearStartDate(_ds->year);
- i2=YearStartDate(_ds->year+1);
- if (i2-i1==365)
- i1+=mon_start_days1[_ds->mon-1];
- else
- i1+=mon_start_days2[_ds->mon-1];
- cdt.date=i1+_ds->day_of_mon-1;
- cdt.time=(_ds->sec10000+100*(_ds->sec100+100*(_ds->sec
- +60*(_ds->min+60*_ds->hour))))<<21/(15*15*3*625);
- return cdt;
-}
-
-I64 DayOfWeek(I64 i)
-{//Day of week, given 32-bit day since AD 0.
- i+=CDATE_BASE_DAY_OF_WEEK;
- if (i>=0)
- return i % 7;
- else
- return 6-(6-i)%7;
-}
-
-U0 Date2Struct(CDateStruct *_ds,CDate cdt)
-{//Cvt CDate to CDateStruct.
- I64 i,k,date=cdt.date;
- _ds->day_of_week=DayOfWeek(date);
- _ds->year=(date+1)*100000/CDATE_YEAR_DAYS_INT;
- i=YearStartDate(_ds->year);
- while (i>date) {
- _ds->year--;
- i=YearStartDate(_ds->year);
- }
- date-=i;
- if (YearStartDate(_ds->year+1)-i==365) {
- k=0;
- while (date>=mon_start_days1[k+1] && k<11)
- k++;
- date-=mon_start_days1[k];
- } else {
- k=0;
- while (date>=mon_start_days2[k+1] && k<11)
- k++;
- date-=mon_start_days2[k];
- }
- _ds->mon=k+1;
- _ds->day_of_mon=date+1;
- k=(625*15*15*3*cdt.time)>>21+1;
- _ds->sec10000=ModU64(&k,100);
- _ds->sec100=ModU64(&k,100);
- _ds->sec=ModU64(&k,60);
- _ds->min=ModU64(&k,60);
- _ds->hour =k;
-}
-
-I64 FirstDayOfMon(I64 i)
-{//First day of month, given 32-bit day since AD 0.
- CDateStruct ds;
- CDate cdt=0;
- cdt.date=i;
- Date2Struct(&ds,cdt);
- ds.day_of_mon=1;
- cdt=Struct2Date(&ds);
- return cdt.date;
-}
-
-I64 LastDayOfMon(I64 i)
-{//Last day of month, given 32-bit day since AD 0.
- CDateStruct ds;
- CDate cdt=0;
- cdt.date=i;
- Date2Struct(&ds,cdt);
- ds.mon++;
- if (ds.mon==13) {
- ds.mon=0;
- ds.year++;
- }
- ds.day_of_mon=1;
- cdt=Struct2Date(&ds);
- return cdt.date-1;
-}
-
-I64 FirstDayOfYear(I64 i)
-{//First day of year, given 32-bit day since AD 0.
- CDateStruct ds;
- CDate cdt=0;
- cdt.date=i;
- Date2Struct(&ds,cdt);
- ds.day_of_mon=1;
- ds.mon=1;
- cdt=Struct2Date(&ds);
- return cdt.date;
-}
-
-I64 LastDayOfYear(I64 i)
-{//Last day of year, given 32-bit day since AD 0.
- CDateStruct ds;
- CDate cdt=0;
- cdt.date=i;
- Date2Struct(&ds,cdt);
- ds.day_of_mon=1;
- ds.mon=1;
- ds.year++;
- cdt=Struct2Date(&ds);
- return cdt.date-1;
-}
-
-I64 Bcd2Bin(U64 b)
-{
- I64 i,res=0;
- for (i=0;i<16;i++) {
- res=res*10+b>>60;
- b<<=4;
- }
- return res;
-}
-
-U0 NowDateTimeStruct(CDateStruct *_ds)
-{
- I64 i;
- U8 *b=_ds;
- Bool is_bcd;
-
- MemSet(_ds,0,sizeof(CDateStruct));
- PUSHFD
- CLI
- while (LBts(&sys_semas[SEMA_SYS_DATE],0))
- PAUSE
-
- OutU8(0x70,0x0A);
- do {
- while (InU8(0x71) & 0x80)
- PAUSE
-
- OutU8(0x70,0);
- b[2]=InU8(0x71);
- OutU8(0x70,2);
- b[3]=InU8(0x71);
- OutU8(0x70,4);
- b[4]=InU8(0x71);
-
- OutU8(0x70,6);
- b[5]=InU8(0x71);
- OutU8(0x70,7);
- b[6]=InU8(0x71);
- OutU8(0x70,8);
- b[7]=InU8(0x71);
- OutU8(0x70,9);
- b[8]=InU8(0x71);
-
- OutU8(0x70,0x0A);
- } while (InU8(0x71) & 0x80);
-
- OutU8(0x70,0x0B);
- if (InU8(0x71) & 4)
- is_bcd=FALSE;
- else
- is_bcd=TRUE;
-
- LBtr(&sys_semas[SEMA_SYS_DATE],0);
- POPFD
- if (is_bcd)
- for (i=2;i<9;i++)
- b[i]=Bcd2Bin(b[i]);
-
- if (_ds->year>255) _ds->year=255;
- _ds->year+=2000;
- if (_ds->mon>12) _ds->mon=12;
- if (_ds->day_of_mon>31) _ds->day_of_mon=31;
- if (_ds->day_of_week>6) _ds->day_of_week=6;
- if (_ds->hour>23) _ds->hour=23;
- if (_ds->min>59) _ds->min=59;
- if (_ds->sec>59) _ds->sec=59;
-}
-
-CDate Now()
-{//Current datetime.
- CDateStruct ds;
- NowDateTimeStruct(&ds);
- return Struct2Date(&ds)-local_time_offset;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/KDbg.HC.HTML b/public/src/Kernel/KDbg.HC.HTML deleted file mode 100644 index 8ecb0ba..0000000 --- a/public/src/Kernel/KDbg.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - KDbg.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Kernel/KDefine.HC.HTML b/public/src/Kernel/KDefine.HC.HTML deleted file mode 100644 index 5fd6566..0000000 --- a/public/src/Kernel/KDefine.HC.HTML +++ /dev/null @@ -1,230 +0,0 @@ - - - - - KDefine.HC - - - - - CHashDefineStr *DefineLoad(U8 *dname,U8 *st)
-{//Create DEFINE hash entry with string.
- CHashDefineStr *tmph=CAlloc(sizeof(CHashDefineStr));
- tmph->type=HTT_DEFINE_STR;
- tmph->str=StrNew(dname);
- tmph->data=StrNew(st);
- tmph->cnt=-1;
- tmph->src_link=MStrPrint("AD:0x%X",Caller);
- HashAdd(tmph,Fs->hash_table);
- return tmph;
-}
-
-CHashDefineStr *DefineLstLoad(U8 *dname,U8 *lst)
-{//Create DEFINE list. Not efficient, but handy.
- I64 cnt=0;
- U8 *ptr,**idx;
- CHashDefineStr *tmph=CAlloc(sizeof(CHashDefineStr));
- tmph->type=HTT_DEFINE_STR;
- tmph->str=StrNew(dname);
- tmph->src_link=MStrPrint("AD:0x%X",Caller);
- ptr=lst;
- while (*ptr) {
- if (*ptr!='@')
- cnt++;
- while (*ptr++);
- }
- tmph->data=MAlloc(ptr+1-lst);
- MemCpy(tmph->data,lst,ptr+1-lst);
- tmph->cnt=cnt;
-
- idx=tmph->sub_idx=MAlloc(cnt*sizeof(U8 *));
- ptr=lst;
- while (*ptr) {
- if (*ptr!='@')
- *idx++=ptr;
- while (*ptr++);
- }
-
- HashAdd(tmph,Fs->hash_table);
- return tmph;
-}
-
-U0 UndefinedDefine(U8 *dname)
-{
- ST_ERR_ST "Undefined Define: '%s'.\n",dname;
- throw('UndefDef');
-}
-
-U8 *Define(U8 *dname)
-{//Look for DEFINE named in hash table, return ptr string.
- CHashDefineStr *tmph;
- if (tmph=HashFind(dname,Fs->hash_table,HTT_DEFINE_STR))
- return tmph->data;
- else if (dname)
- UndefinedDefine(dname);
- else
- return NULL;
-}
-
-U8 *DefineSub(I64 sub,U8 *dname)
-{//Return DEFINE list entry indexed by number.
- CHashDefineStr *tmph;
- if (tmph=HashFind(dname,Fs->hash_table,HTT_DEFINE_STR)) {
- if (0<=sub<tmph->cnt)
- return tmph->sub_idx[sub];
- else
- return NULL;
- } else if (dname)
- UndefinedDefine(dname);
- else
- return NULL;
-}
-
-I64 DefineCnt(U8 *dname)
-{//Return cnt of entries in define list.
- CHashDefineStr *tmph;
- if (tmph=HashFind(dname,Fs->hash_table,HTT_DEFINE_STR))
- return tmph->cnt;
- else if (dname)
- UndefinedDefine(dname);
- else
- return -1;
-}
-
-I64 DefineMatch(U8 *needle,U8 *haystack_lst_dname,I64 flags=0)
-{//Find match for string in define list.
- return LstMatch(needle,Define(haystack_lst_dname),flags);
-}
-
-U0 DefinePrint(U8 *dname,U8 *src,...)
-{//Create DEFINE entry with Print()ed string.
- U8 *buf=StrPrintJoin(NULL,src,argc,argv);
- DefineLoad(dname,buf);
- Free(buf);
-}
-
-U0 SysDefinesLoad()
-{
- DefineLstLoad("ST_OFF_ON","Off\0On\0");
- DefineLstLoad("ST_HTT_TYPES","ExportSysSym\0ImportSysSym\0DefineStr\0GlbVar\0"
- "Class\0IntType\0Funct\0Word\0DictWord\0KeyWord\0AsmKeyWord\0OpCode\0"
- "Reg\0File\0Module\0HelpFile\0FramePtr\0\0\0\0\0\0\0Private\0"
- "Public\0Export\0Import\0Imm\0Goto\0Res\0Unres\0Local\0");
- DefineLstLoad("ST_DAYS_OF_WEEK","Sunday\0Monday\0Tuesday\0Wednesday\0"
- "Thursday\0Friday\0Saturday\0");
- DefineLstLoad("ST_MONTHS","January\0February\0March\0April\0May\0"
- "June\0July\0August\0September\0October\0November\0December\0");
- DefineLstLoad("ST_FILE_ATTRS","R\0H\0S\0V\0D\0A\0\0\0X\0T\0Z\0C\0F\0");
- DefineLstLoad("ST_FILE_UTIL_FLAGS","r\0d\0i\0a\0c\0R\0p\0m\0x\0s\0"
- "D\0F\0T\0$\0S\0A\0J\0G\0Z\0O\0P\0f\0l\0lb\0la\0");
- DefineLstLoad("ST_BLKDEV_TYPES",
- "NULL\0RAM\0ATA\0FILE_READ\0FILE_WRITE\0ATAPI\0");
- DefineLstLoad("ST_DRV_TYPES",
- "NULL\0REDSEA\0FAT32\0ISO9660\0NTFS\0UNKNOWN\0");
- DefineLstLoad("ST_COLORS","BLACK\0BLUE\0GREEN\0CYAN\0"
- "RED\0PURPLE\0BROWN\0LTGRAY\0DKGRAY\0LTBLUE\0LTGREEN\0"
- "LTCYAN\0LTRED\0LTPURPLE\0YELLOW\0WHITE\0");
- DefineLstLoad("ST_INT_NAMES","Divide Error\0SingleStep\0NMI\0Breakpoint\0"
- "Overflow\0BOUND Range Exceeded\0Invalid Opcode\0No Math Coprocessor\0"
- "Double Fault\0Coprocessor Segment Fault\0Invalid TASK\0"
- "Segment Not Present\0Stk Segment Fault\0General Protection\0"
- "Page Fault\0\0Math Fault\0Alignment Check\0Machine Check\0"
- "SIMD Exception\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
- "\0\0\0\0\0\0\0\0\0\0\0MP Crash\0Wake\0Dbg\0");
-}
-
-U8 *Color2Str(U8 *buf,CColorROPU32 c)
-{//CColorROPU32 with flags to DCLighting str.
- *buf=0;
- if (c.c0.rop&ROPBF_TWO_SIDED)
- CatPrint(buf,"TWO|");
- if (c.c0.rop&ROPBF_HALF_RANGE_COLOR)
- CatPrint(buf,"HALF|");
- if (0<=c.c0.color<16)
- CatPrint(buf,DefineSub(c.c0.color,"ST_COLORS"));
- else if (c.c0.color==TRANSPARENT)
- CatPrint(buf,"TRANSPARENT");
- else
- CatPrint(buf,"INVALID");
- if (c&ROPF_DITHER) {
- CatPrint(buf,"/");
- if (c.c1.rop&ROPBF_TWO_SIDED)
- CatPrint(buf,"TWO|");
- if (c.c1.rop&ROPBF_HALF_RANGE_COLOR)
- CatPrint(buf,"HALF|");
- if (0<=c.c1.color<16)
- CatPrint(buf,DefineSub(c.c1.color,"ST_COLORS"));
- else if (c.c1.color==TRANSPARENT)
- CatPrint(buf,"TRANSPARENT");
- else
- CatPrint(buf,"INVALID");
- }
- return buf;
-}
-
-U8 *str2color_lst="/,)}>";
-
-CColorROPU16 Str2ColorU16(U8 *st)
-{//DCLighting color str with flags to CColorROPU16.
- CColorROPU16 res=COLOR_INVALID;
- I64 i;
- U8 *ptr,*ptr2,*st2;
- if (!st) return COLOR_INVALID;
- while (TRUE) {
- if (!*st||StrOcc(str2color_lst,*st))
- return res;
- if (Bt(char_bmp_alpha,*st)) {
- ptr=st;
- while (Bt(char_bmp_alpha_numeric,*ptr))
- ptr++;
- st2=ptr2=MAlloc(ptr-st+1);
- while (st<ptr)
- *ptr2++=*st++;
- *ptr2++=0;
- if (!StrICmp(st2,"TWO"))
- res.rop|=ROPBF_TWO_SIDED;
- else if (!StrICmp(st2,"HALF"))
- res.rop|=ROPBF_HALF_RANGE_COLOR;
- else if ((i=DefineMatch(st2,"ST_COLORS",LMF_IGNORE_CASE))>=0)
- res.color=i;
- else if (!StrICmp(st2,"TRANSPARENT"))
- res.color=TRANSPARENT;
- else {
- Free(st2);
- return COLOR_INVALID;
- }
- Free(st2);
- } else if (*st=='+'||*st=='|'||Bt(char_bmp_white_space,*st))
- st++;
- else if ('0'<=*st<='9') {
- i=Str2I64(st,10,&ptr);
- if (0<=i<=0xFF) {
- res.color=i;
- st=ptr;
- } else
- return COLOR_INVALID;
- } else
- return COLOR_INVALID;
- }
-}
-
-CColorROPU32 Str2ColorU32(U8 *st)
-{//DCLighting color str with flags to CColorROPU32.
- U8 *st2;
- CColorROPU32 res=0;
- if (!st) return COLOR_INVALID;
- st2=MAlloc(StrLen(st)+1);
- StrFirstRem(st,str2color_lst,st2);
- res.c0=Str2ColorU16(st2);
- if (*st) {
- res.c1=Str2ColorU16(st);
- res|=ROPF_DITHER;
- }
- if (res.c0.color==COLOR_INVALID||res.c1.color==COLOR_INVALID)
- return COLOR_INVALID;
- else
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/KExcept.HC.HTML b/public/src/Kernel/KExcept.HC.HTML deleted file mode 100644 index 31ca298..0000000 --- a/public/src/Kernel/KExcept.HC.HTML +++ /dev/null @@ -1,161 +0,0 @@ - - - - - KExcept.HC - - - - - asm {
-#assert !((REGG_LOCAL_NON_PTR_VARS|REGG_LOCAL_VARS)&~0xFCC0)
-_TEST_EXCEPT::
- XOR RAX,RAX
- MOV RAX,FS:U64 CTask.last_except[RAX]
- MOV RBP,U64 CExcept.rbp[RAX]
- MOV RSI,U64 CExcept.rsi[RAX]
- MOV RDI,U64 CExcept.rdi[RAX]
- MOV R10,U64 CExcept.r10[RAX]
- MOV R11,U64 CExcept.r11[RAX]
- MOV R12,U64 CExcept.r12[RAX]
- MOV R13,U64 CExcept.r13[RAX]
- MOV R14,U64 CExcept.r14[RAX]
- MOV R15,U64 CExcept.r15[RAX]
- PUSH U64 CExcept.rflags[RAX]
- POPFD
- JMP U64 CExcept.hndlr_catch[RAX]
-
-_TAKE_EXCEPT::
- XOR RAX,RAX
- MOV RAX,FS:U64 CTask.last_except[RAX]
- MOV RSP,U64 CExcept.rsp[RAX]
- JMP U64 CExcept.hndlr_untry[RAX]
-
-_SAVE_EXCEPT_REGS::
- PUSH RBP
- MOV RBP,RSP
- MOV RAX,U64 SF_ARG1[RBP]
- MOV U64 CExcept.rsi[RAX],RSI
- MOV U64 CExcept.rdi[RAX],RDI
- MOV U64 CExcept.r10[RAX],R10
- MOV U64 CExcept.r11[RAX],R11
- MOV U64 CExcept.r12[RAX],R12
- MOV U64 CExcept.r13[RAX],R13
- MOV U64 CExcept.r14[RAX],R14
- MOV U64 CExcept.r15[RAX],R15
- POP RBP
- RET1 8
-}
-
-_extern _TEST_EXCEPT U0 TestExcept();
-_extern _TAKE_EXCEPT U0 TakeExcept();
-_extern _SAVE_EXCEPT_REGS U0 SaveExceptRegs(CExcept *t);
-
-U0 PutExcept(Bool catch_it=TRUE)
-{//Print exception msg and catch exception.
- "Except:%c:",Fs->except_ch;
- "%P:%P:%P:%P:%P:%P\n",Fs->except_callers[0],Fs->except_callers[1],
- Fs->except_callers[2],Fs->except_callers[3],Fs->except_callers[4],
- Fs->except_callers[5],Fs->except_callers[6],Fs->except_callers[7];
- Fs->catch_except=catch_it;
-}
-
-#exe {Option(OPTf_NO_REG_VAR,ON);};
-
-class CTryStk
-{
- I64 rbp;
- I64 ret_rip;
- I64 arg1;
- I64 arg2;
-};
-
-U0 SysTry(U8 *catch_start,U8 *untry_start)
-{
- I64 *rbp=GetRBP;
- CExcept *tmpt=MAlloc(sizeof(CExcept));
- tmpt->hndlr_catch=catch_start;
- tmpt->hndlr_untry=untry_start;
- tmpt->rsp=rbp(U8 *)+sizeof(CTryStk);
- tmpt->rbp=*rbp;
- tmpt->rflags=GetRFlags;
- SaveExceptRegs(tmpt);
- QueIns(tmpt,Fs->last_except);
-}
-
-U0 SysUntry()
-{
- CExcept *tmpt=Fs->last_except;
- QueRem(tmpt);
- Free(tmpt);
-}
-
-U0 throw(I64 ch=0,Bool no_log=FALSE)
-{//ch can be up to 8 chars like PutChars().
-//In the catcher, fetch ch from Fs->except_ch.
- CExcept *tmpt=Fs->last_except;
- Bool was_raw;
- I64 i;
- Fs->except_ch=ch;
- for (i=0;i<TASK_EXCEPT_CALLERS;i++)
- Fs->except_callers[i]=Caller(i+1);
- Fs->except_rbp=GetRBP;
- Fs->catch_except=FALSE;
- if (!no_log)
- AdamLog("Except:%c:%p:%p:%p:%p:%p:%p\n",ch,Fs->except_callers[0],
- Fs->except_callers[1],Fs->except_callers[2],Fs->except_callers[3],
- Fs->except_callers[4],Fs->except_callers[5],Fs->except_callers[6],
- Fs->except_callers[7]);
- while (Fs->next_except!=&Fs->next_except) {
- TestExcept;
- if (Fs->catch_except)
- TakeExcept;
- SetRBP(Fs->except_rbp);
- tmpt=Fs->last_except;
- QueRem(tmpt);
- Free(tmpt);
- }
- was_raw=Raw(ON);
- PutExcept(FALSE);
- Panic("Unhandled Exception");
- Raw(was_raw);
-}
-
-#exe {Option(OPTf_NO_REG_VAR,OFF);};
-
-U0 Break()
-{//Send <CTRL-ALT-c>.
- if (Bt(&Fs->task_flags,TASKf_BREAK_TO_SHIFT_ESC))
- Msg(MSG_KEY_DOWN,CH_SHIFT_ESC,0x20100000201);
- else {
- Fs->wake_jiffy=0;
- TaskRstAwaitingMsg;
- DrvsRelease();
- BlkDevsRelease();
- FlushMsgs;
- throw('Break');
- }
-}
-
-Bool BreakLock(CTask *task=NULL)
-{//Disables <CTRL-ALT-c>.
- if (!task) task=Fs;
- return !LBts(&task->task_flags,TASKf_BREAK_LOCKED);
-}
-
-Bool BreakUnlock(CTask *task=NULL)
-{//Reenables <CTRL-ALT-c> and issues any pending breaks.
- Bool res;
- if (!task) task=Fs;
- res=LBtr(&task->task_flags,TASKf_BREAK_LOCKED);
- if (LBtr(&task->task_flags,TASKf_PENDING_BREAK)) {
- if (task==Fs)
- Break;
- else
- task->rip=&Break;
- }
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/KExts.HC.HTML b/public/src/Kernel/KExts.HC.HTML deleted file mode 100644 index 20fca8a..0000000 --- a/public/src/Kernel/KExts.HC.HTML +++ /dev/null @@ -1,121 +0,0 @@ - - - - - KExts.HC - - - - - /*
-If you are sure a fun won't be called
-before import is resolved, you can use
-"import". Otherwise, use a fun pointer
-var and check it before calling.
-*/
-import U0 ClassRep(U8 *_d,U8 *class_name=lastclass,
- I64 max_depth=2,Bool fun=FALSE,I64 offset=0);
-import U8 *DocSave(CDoc *doc,I64 *_size=NULL);
-import Bool DocUnlock(CDoc *doc);
-import Bool Ed(U8 *link_st,I64 edf_dof_flags=0);
-extern U0 AdamErr(U8 *fmt,...);
-extern U0 AdamLog(U8 *fmt,...);
-extern I64 BIOSTotalMem();
-extern I64 BlkDevAdd(CBlkDev *bd,I64 prt_num=I64_MIN,
- Bool whole_drv,Bool make_free);
-extern CBlkDev *BlkDevChk(CBlkDev *bd,Bool except=TRUE);
-extern Bool BlkDevLock(CBlkDev *bd);
-extern CBlkDev *BlkDevNextFreeSlot(U8 first_drv_let,I64 type);
-extern Bool BlkDevUnlock(CBlkDev *bd,Bool rst=FALSE);
-extern U0 BlkDevsRelease();
-extern Bool BlkRead(CDrv *dv,U8 *buf, I64 blk, I64 cnt);
-extern Bool BlkWrite(CDrv *dv,U8 *buf, I64 blk, I64 cnt);
-extern U8 *Caller(I64 num=1);
-extern U8 *CatPrint(U8 *_dst,U8 *fmt,...);
-extern Bool Cd(U8 *dirname=NULL,Bool make_dirs=FALSE);
-extern U0 DbgHelp();
-extern U8 *Define(U8 *dname);
-extern I64 DefineMatch(U8 *needle,U8 *haystack_lst_dname,I64 flags=0);
-extern U8 *DefineSub(I64 sub,U8 *dname);
-extern I64 Del(U8 *files_find_mask,Bool make_mask=FALSE,
- Bool del_dir=FALSE,Bool print_msg=TRUE);
-extern Bool DirMk(U8 *filename,I64 entry_cnt=0);
-extern Bool Drv(U8 drv_let);
-extern U8 Drv2Let(CDrv *dv=NULL);
-extern U0 DrvBlkDevDel(CBlkDev *bd);
-extern CDrv *DrvChk(CDrv *dv,Bool except=TRUE);
-extern U8 DrvTextAttrGet(U8 drv_let=0);
-extern Bool DrvTypeSet(U8 drv_let,I64 type=FSt_REDSEA);
-extern U0 DrvsRelease();
-extern U0 DskCacheInvalidate(CDrv *dv);
-extern U0 Exit();
-extern U8 *ExtDft(U8 *filename,U8 *extension);
-extern I64 FAT32AllocClus(CDrv *dv,I64 c,I64 cnt);
-extern I64 FAT32AllocContiguousClus(CDrv *dv,I64 cnt);
-extern Bool FAT32DirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,
- Bool free_old_chain);
-extern Bool FAT32FileFind(CDrv *dv,I64 cur_dir_clus,U8 *name,
- CDirEntry *_res,I64 fuf_flags=0);
-extern U0 FAT32Init(CDrv *dv);
-extern Bool FBlkRead(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1);
-extern Bool FBlkWrite(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1);
-extern U0 FClose(CFile *f);
-extern CFile *FOpen(U8 *filename,U8 *flags,I64 cnt=0);
-extern U8 *FileExtRem(U8 *src,U8 *dst=NULL);
-extern Bool FileFind(U8 *filename,CDirEntry *_de=NULL,I64 fuf_flags=0);
-extern U8 *FileNameAbs(U8 *_filename,I64 fuf_flags=0);
-extern U8 *FileRead(U8 *filename,I64 *_size=NULL,I64 *_attr=NULL);
-extern I64 FileWrite(U8 *filename,U8 *fbuf,I64 size,CDate cdt=0,I64 attr=0);
-extern I64 FlushMsgs(CTask *task=NULL);
-extern I64 GetChar(I64 *_scan_code=NULL,Bool echo=TRUE,Bool raw_cursor=FALSE);
-extern I64 GetS(U8 *buf,I64 size,Bool allow_ext=TRUE);
-extern CHeapCtrl *HeapCtrlInit(CHeapCtrl *hc=NULL,
- CTask *task=NULL,CBlkPool *bp);
-extern Bool ISOInit(CDrv *dv,I64 blk);
-extern Bool IsDbgMode();
-extern Bool IsDir(U8 *dir_name);
-extern Bool IsRaw();
-extern U0 JobCtrlInit(CJobCtrl *ctrl);
-extern U0 JobDel(CJob *tmpc);
-extern U0 JobQueDel(CJob *head);
-extern I64 JobsHndlr(I64 run_flags,CTask *task=NULL);
-extern CBlkDev *Let2BlkDev(U8 drv_let=0,Bool except=TRUE);
-extern I64 Let2BlkDevType(U8 drv_let);
-extern CDrv *Let2Drv(U8 drv_let=0,Bool except=TRUE);
-extern U8 Let2Let(U8 drv_let=0);
-extern U0 MPInt(U8 num,I64 cpu_num=1);
-extern U8 *MStrPrint(U8 *fmt,...);
-extern U0 MsHardSet(I64 x,I64 y,I64 z,I64 l,I64 r);
-extern U0 Msg(I64 msg_code,I64 arg1,I64 arg2,I64 flags=0);
-extern U0 Panic(U8 *msg=NULL,I64 msg_num=0,Bool panic=TRUE);
-extern I64 PopUp(U8 *buf,CTask *parent=NULL,CTask **_pu_task=NULL);
-extern U0 Print(U8 *fmt,...);
-extern U0 PutChars(U64 ch);
-extern U0 PutS(U8 *st); //Use Print()
-extern I64 RedSeaAllocClus(CDrv *dv,I64 cnt);
-extern Bool RedSeaDirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,
- Bool free_old_chain);
-extern Bool RedSeaFileFind(CDrv *dv,I64 cur_dir_clus,U8 *name,
- CDirEntry *_res,I64 fuf_flags=0);
-extern U0 RedSeaFmt(U8 drv_let,Bool quick=TRUE);
-extern U0 RedSeaFreeFreeLst(CDrv *dv);
-extern U0 RedSeaInit(CDrv *dv);
-extern Bool RedSeaValidate(U8 drv_let);
-extern CTask *SpawnQue(U0 (*fp_addr)(U8 *data),U8 *data=NULL,
- U8 *task_name=NULL,I64 target_cpu,CTask *parent=NULL, //NULL means adam
- I64 stk_size=0,I64 flags=1<<JOBf_ADD_TO_QUE);
-extern U8 *StrPrint(U8 *dst,U8 *fmt,...);
-extern U0 StrPrintFunSeg(U8 *buf,I64 addr,I64 field_len,I64 flags);
-extern Bool Suspend(CTask *task=NULL,Bool state=TRUE);
-extern CJob *TaskMsg(CTask *_srv,CTask *master,
- I64 msg_code,I64 arg1,I64 arg2,I64 flags);
-extern U0 TaskRstAwaitingMsg(CTask *task=NULL);
-extern Bool TaskValidate(CTask *task);
-extern U0 TaskWait(CTask *task=NULL,Bool cmd_line_pmt=FALSE);
-extern CTask *User(U8 *fmt=NULL,...);
-extern U0 UserTaskCont();
-extern U0 XTalk(CTask *task,U8 *fmt,...);
-extern U0 throw(I64 ch=0,Bool no_log=FALSE);
- - - \ No newline at end of file diff --git a/public/src/Kernel/KGlbls.HC.HTML b/public/src/Kernel/KGlbls.HC.HTML deleted file mode 100644 index 7711af2..0000000 --- a/public/src/Kernel/KGlbls.HC.HTML +++ /dev/null @@ -1,47 +0,0 @@ - - - - - KGlbls.HC - - - - - //Compiler initializes glbls in AOT bin modules to zero.
-//Globals Set to Zero Here.
-
-CJob sys_macro_head;
-CTask *sys_macro_task;
-CDoc *sys_clip_doc;
-
-CTask *adam_task;
-I64 sys_num_spawned_tasks;
-
-CTask *sys_winmgr_task,*sys_task_being_scrn_updated;
-U8 *rev_bits_table, //Table with U8 bits revd
- *set_bits_table; //Table with count of set bits in a U8
-CDate local_time_offset;
-F64 *pow10_I64,
- sys_os_version=5.030;
-
-CAutoCompleteDictGlbls acd;
-CAutoCompleteGlbls ac;
-CBlkDevGlbls blkdev;
-CCntsGlbls cnts={1,0,2676302000,2676302,2676302000,0,0,0,FALSE};
-CDbgGlbls dbg;
-CDevGlbls dev;
-CGridGlbls ms_grid; //See /Demo/Graphics/Grid.HC.
-CMsStateGlbls ms,ms_last;
-CKbdStateGlbls kbd;
-CKeyDevGlbls keydev;
-CMsHardStateGlbls ms_hard,ms_hard_last;
-CScrnCastGlbls scrncast;
-CTextGlbls text;
-
-U8 *(*fp_getstr2)(I64 flags=0);
-U0 (*fp_update_ctrls)(CTask *task);
-CDoc *(*fp_doc_put)(CTask *task=NULL);
-U0 (*fp_set_std_palette)();
- - - \ No newline at end of file diff --git a/public/src/Kernel/KHashA.HC.HTML b/public/src/Kernel/KHashA.HC.HTML deleted file mode 100644 index a3dade7..0000000 --- a/public/src/Kernel/KHashA.HC.HTML +++ /dev/null @@ -1,277 +0,0 @@ - - - - - KHashA.HC - - - - - asm {
-//************************************
-SYS_HASH_STR::
-// IN: RSI=Addr of string
-// OUT: RAX
- XOR RAX,RAX
- TEST RSI,RSI
- JZ @@15
-
- PUSH RSI
- PUSH RBX
- XOR RBX,RBX
- JMP @@10
-
-@@05: SHL1 RBX
- ADC RBX,RAX
-@@10: LODSB
- TEST AL,AL
- JNZ @@05
-
- MOV RAX,RBX
- SHR RBX,16
- ADC RAX,RBX
- POP RBX
- POP RSI
-
-@@15: RET
-//************************************
-SYS_HASH_SINGLE_TABLE_FIND1::
-// IN: RAX=HASHED STRING VAL
-// RSI=STR
-// RBX=TYPE MASK
-// RDI=TABLE
-// RCX=INSTANCE, NOT ZERO
-// OUT: RAX=ENTRY OR ZERO NOT FOUND
-// RDX=POINTER TO POINTER TO ENTRY
-// RCX IF NOT FOUND ENOUGH, DECREMENTED BY NUM MATCHES
-// ZERO FLAG SET NOT FOUND
- MOV RCX,1
-SYS_HASH_SINGLE_TABLE_FIND::
- TEST RCX,RCX
- JNZ @@05
- XOR RAX,RAX
- RET
-@@05: AND RAX,U64 CHashTable.mask[RDI]
- MOV RDX,U64 CHashTable.body[RDI]
- LEA RDX,U64 [RDX+RAX*8]
-@@10: MOV RAX,U64 [RDX]
- TEST RAX,RAX
- JNZ @@15
- RET
-
-@@15: TEST U32 CHash.type[RAX],EBX
- JZ @@30
- PUSH RAX
- PUSH RDI
- PUSH RSI
- MOV RDI,U64 CHash.str[RAX]
-@@20: LODSB
- CMP U8 [RDI],AL
- JNE @@25
- INC RDI
- TEST AL,AL
- JNZ @@20
- POP RSI
- POP RDI
- POP RAX
- LOOP @@30
- INC U32 CHash.use_cnt[RAX]
- TEST RAX,RAX
- RET
-
-@@25: POP RSI
- POP RDI
- POP RAX
-
-@@30: LEA RDX,U64 CHash.next[RAX]
- JMP @@10
-//************************************
-SYS_HASH_FIND1::
-// IN: RSI=STR
-// RBX=TYPE MASK
-// RDI=TABLE
-// RCX=INSTANCE NUM
-// OUT: RAX=ENTRY OR ZERO NOT FOUND
-// ZERO FLAG SET NOT FOUND
- MOV RCX,1
-SYS_HASH_FIND::
- PUSH RDI
- CALL SYS_HASH_STR
-
-@@05: PUSH RAX
- CALL SYS_HASH_SINGLE_TABLE_FIND
- JNZ @@15
- POP RAX
-@@10: MOV RDI,U64 CHashTable.next[RDI]
- TEST RDI,RDI
- JNZ @@05
- POP RDI
- XOR RAX,RAX
- RET
-
-@@15: ADD RSP,8
- POP RDI
- TEST RAX,RAX
- RET
-//************************************
-SYS_HASH_BUCKET_FIND::
-// IN: RSI=STR
-// RDI=TABLE
-// OUT: RAX=BUCKET
- PUSH RDX
- CALL SYS_HASH_STR
- AND RAX,U64 CHashTable.mask[RDI]
- MOV RDX,U64 CHashTable.body[RDI]
- LEA RAX,U64 [RDX+RAX*8]
- POP RDX
- RET
-_HASH_STR::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- MOV RSI,U64 SF_ARG1[RBP]
- CALL SYS_HASH_STR
- POP RSI
- POP RBP
- RET1 8
-_HASH_FIND::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
- MOV RSI,U64 SF_ARG1[RBP]
- MOV RDI,U64 SF_ARG2[RBP]
- MOV RBX,U64 SF_ARG3[RBP]
- MOV RCX,U64 SF_ARG4[RBP]
- CALL SYS_HASH_FIND
- POP RDI
- POP RSI
- POP RBP
- RET1 32
-_HASH_SINGLE_TABLE_FIND::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
- MOV RSI,U64 SF_ARG1[RBP]
- MOV RDI,U64 SF_ARG2[RBP]
- MOV RBX,U64 SF_ARG3[RBP]
- MOV RCX,U64 SF_ARG4[RBP]
- CALL SYS_HASH_STR
- CALL SYS_HASH_SINGLE_TABLE_FIND
- POP RDI
- POP RSI
- POP RBP
- RET1 32
-_HASH_BUCKET_FIND::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
- MOV RSI,U64 SF_ARG1[RBP]
- MOV RDI,U64 SF_ARG2[RBP]
- CALL SYS_HASH_BUCKET_FIND
- POP RDI
- POP RSI
- POP RBP
- RET1 16
-_HASH_ADD::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
- MOV RCX,U64 SF_ARG1[RBP]
- MOV RSI,U64 CHash.str[RCX]
- MOV RDI,U64 SF_ARG2[RBP]
- CALL SYS_HASH_BUCKET_FIND
- MOV RCX,U64 SF_ARG1[RBP]
- PUSHFD
- CLI
- MOV RBX,U64 [RAX]
- MOV U64 CHash.next[RCX],RBX
- MOV U64 [RAX],RCX
-
- POPFD
- POP RDI
- POP RSI
- POP RBP
- RET1 16
-_HASH_ADD_AFTER::
- PUSH RBP
- MOV RBP,RSP
- PUSH RDI
- MOV RCX,U64 SF_ARG1[RBP]
- MOV RDI,U64 SF_ARG3[RBP]
- PUSHFD
- CLI
- MOV RAX,SF_ARG2[RBP]
- MOV RBX,U64 [RAX]
- MOV U64 CHash.next[RCX],RBX
- MOV U64 [RAX],RCX
-
- POPFD
- POP RDI
- POP RBP
- RET1 24
-_HASH_REM_DEL::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
- MOV RCX,U64 SF_ARG1[RBP]
- TEST RCX,RCX
- JZ @@10
- MOV RSI,U64 CHash.str[RCX]
- XOR RBX,RBX
- MOV EBX,U32 CHash.type[RCX]
- AND EBX,~HTG_FLAGS_MASK&0xFFFFFFFF
- MOV RDI,U64 SF_ARG2[RBP]
- MOV RCX,U64 SF_ARG3[RBP]
- CALL SYS_HASH_STR
-
- PUSHFD
- CLI
- CALL SYS_HASH_SINGLE_TABLE_FIND
- JZ @@05
- CMP RAX,U64 SF_ARG1[RBP]
- JNE @@05
-
- MOV RBX,U64 CHash.next[RAX]
- MOV U64 [RDX],RBX
-
- POPFD
-
- PUSH_C_REGS
- PUSH RAX
- CALL &HashDel
- POP_C_REGS
-
- POP RDI
- POP RSI
- MOV RAX,1
- POP RBP
- RET1 24
-
-@@05: POPFD
-@@10: POP RDI
- POP RSI
- XOR RAX,RAX
- POP RBP
- RET1 24
-}
-
-_extern _HASH_STR I64 HashStr(U8 *st); //Hash a string.
-_extern _HASH_FIND CHash *HashFind(U8 *needle_str,CHashTable *haystack_table,
- I64 mask,I64 instance=1);//Find string in hash table.
-_extern _HASH_SINGLE_TABLE_FIND CHash *HashSingleTableFind(U8 *needle_str,
- CHashTable *haystack_table,
- I64 mask,I64 instance=1);//Find string in single hash table.
-_extern _HASH_BUCKET_FIND CHash **HashBucketFind(U8 *needle_str,
- CHashTable *haystack_table); //Find hash bucket.
-_extern _HASH_ADD U0 HashAdd(CHash *tmph,
- CHashTable *table); //Add entry to hash table.
-_extern _HASH_REM_DEL Bool HashRemDel(CHash *tmph,CHashTable *table,
- I64 instance=1);//Remove hash entry and del. Instance must match.
- - - \ No newline at end of file diff --git a/public/src/Kernel/KHashB.HC.HTML b/public/src/Kernel/KHashB.HC.HTML deleted file mode 100644 index d511a3e..0000000 --- a/public/src/Kernel/KHashB.HC.HTML +++ /dev/null @@ -1,262 +0,0 @@ - - - - - KHashB.HC - - - - - I64 HashTypeNum(CHash *tmph)
-{//Return bit num of hash type, limited to just types.
- if (tmph)
- return Bsf(tmph->type&HTG_TYPE_MASK);
- else
- return -1;
-}
-
-I64 HashVal(CHash *tmph)
-{//Returns most likely desired value.
- switch [HashTypeNum(tmph)] {
- case HTt_EXPORT_SYS_SYM:
- return tmph(CHashExport *)->val;
- case HTt_IMPORT_SYS_SYM:
- return tmph(CHashImport *)->module_base;
- case HTt_DEFINE_STR:
- case HTt_CLASS:
- case HTt_INTERNAL_TYPE:
- case HTt_WORD:
- case HTt_DICT_WORD:
- case HTt_OPCODE:
- case HTt_HELP_FILE:
- return tmph;
- case HTt_GLBL_VAR:
- if (tmph(CHashGlblVar *)->flags&GVF_EXTERN)
- return &tmph(CHashGlblVar *)->data_addr;
- else
- return tmph(CHashGlblVar *)->data_addr;
- case HTt_FUN:
- if (Bt(&tmph(CHashFun *)->flags,Cf_EXTERN))
- return tmph;
- else
- return tmph(CHashFun *)->exe_addr;
- case HTt_REG:
- return tmph(CHashReg *)->reg_num|tmph(CHashReg *)->reg_type<<8;
- case HTt_KEYWORD:
- case HTt_ASM_KEYWORD:
- case HTt_MODULE:
- case HTt_FILE:
- case HTt_FRAME_PTR:
- return tmph(CHashGeneric *)->user_data0;
-
- case -1: //nobound switch
- case HTt_TYPES_NUM: //nobound switch
- default:
- return 0;
- }
-}
-
-CHashTable *HashTableNew(I64 size,CTask *mem_task=NULL)
-{//New hash table, power-of-two in size.
- CHashTable *table;
- table=CAlloc(sizeof(CHashTable),mem_task);
- table->body=CAlloc(size<<3,mem_task);
- table->mask=size-1;
- return table;
-}
-
-U0 HashDel(CHashSrcSym *tmph)
-{//Free a std TempleOS system hash entry.
- if (!tmph) return;
- if (!(tmph->type&HTT_DICT_WORD))
- Free(tmph->str);
- if (tmph->type & HTG_SRC_SYM) {
- Free(tmph->src_link);
- Free(tmph->idx);
- Free(tmph->import_name);
- LinkedLstDel(tmph->ie_lst);
- if (tmph->type & (HTT_FUN | HTT_EXPORT_SYS_SYM))
- Free(tmph->dbg_info);
- if (tmph->type & (HTT_FUN | HTT_CLASS))
-//Assumes code not on heap, so doesn't Free.
- //ClassMemberLstDel() is an import to the Kernel module
- ClassMemberLstDel(tmph);
- else if (tmph->type&HTT_DEFINE_STR)
- Free(tmph(CHashDefineStr *)->data);
- else if (tmph->type & HTT_GLBL_VAR) {
- if (!(tmph(CHashGlblVar *)->flags&GVF_ALIAS))
- Free(tmph(CHashGlblVar *)->data_addr);
- LinkedLstDel(tmph(CHashGlblVar *)->dim.next);
- if (tmph(CHashGlblVar *)->fun_ptr)
- HashDel(tmph(CHashGlblVar *)->fun_ptr
- -tmph(CHashGlblVar *)->fun_ptr->ptr_stars_cnt);
- }
- } else if (tmph->type & HTT_FILE)
- Free(tmph(CHashGeneric *)->user_data0);
- Free(tmph);
-}
-
-U0 HashTableDel(CHashTable *table)
-{//Free std system hash table, calling HashDel() on entries.
- I64 i;
- CHashSrcSym *tmph,*tmph1;
- if (!table) return;
- for (i=0;i<=table->mask;i++) {
- tmph=table->body[i];
- while (tmph) {
- tmph1=tmph->next;
- HashDel(tmph);
- tmph=tmph1;
- }
- }
- Free(table->body);
- Free(table);
-}
-
-I64 HashTablePurge(CHashTable *table)
-{//Eliminate ExportSysSyms that have been usurped.
- I64 i,res=0;
- CHashSrcSym *tmph,*tmph1,*tmph2;
- if (!table) return 0;
- PUSHFD
- CLI //Precaution
- for (i=0;i<=table->mask;i++) {
- tmph=table->body[i];
- while (tmph) {
- tmph1=tmph->next; //We delete only older ones
- if (tmph->type&(HTT_FUN|HTT_GLBL_VAR)) {
- tmph2=tmph->next; //Older always later in chain
- while (tmph2) {
- if ((tmph2->type&HTT_EXPORT_SYS_SYM ||
- tmph2->type&HTG_TYPE_MASK==HTT_INVALID) &&
- !StrCmp(tmph2->str,tmph->str)) {
- if (tmph2->type&HTG_TYPE_MASK==HTT_INVALID)
- tmph2->type=HTT_KEYWORD;//Won't delete HTT_INVALID
- HashRemDel(tmph2,table);
- res++;
- break;
- }
- tmph2=tmph2->next;
- }
- }
- tmph=tmph1;
- }
- }
- POPFD
- return res;
-}
-
-CHashGeneric *HashGenericAdd(U8 *name,I64 type,
- I64 u0=0,I64 u1=0,I64 u2=0,CTask *task=NULL)
-{//Add any type to task hash_table, 3 user_data values.
- if (!task) task=Fs;
- CHashGeneric *res=CAlloc(sizeof(CHashGeneric),task);
- res->type=type;
- res->user_data0=u0;
- res->user_data1=u1;
- res->user_data2=u2;
- res->str=StrNew(name,task);
- HashAdd(res,task->hash_table);
- return res;
-}
-
-U0 HashSrcFileSet(CCmpCtrl *cc,CHashSrcSym *h,I64 line_num_offset=0)
-{//Set CHashSrcSym link and help_index by cur cc pos.
- CLexFile *tmpf=cc->lex_include_stk;
- I64 line_num=tmpf->line_num+line_num_offset;
- if (line_num<1) line_num=1;
- Free(h->src_link);
- h->src_link=MStrPrint("FL:%s,%d",tmpf->full_name,line_num);
- if (Bt(&cc->opts,OPTf_KEEP_PRIVATE))
- h->type|=HTF_PRIVATE;
- Free(h->idx);
- if (cc->cur_help_idx && *cc->cur_help_idx)
- h->idx=StrNew(cc->cur_help_idx);
- else
- h->idx=NULL;
-}
-
-CHashGeneric *HashPublic(U8 *st,I64 mask,Bool val=TRUE)
-{//Mark a hash entry as public and HashSrcFileSet().
- CHashGeneric *res;
- if (res=HashFind(st,Fs->hash_table,mask)) {
- if (val)
- res->type|=HTF_PUBLIC;
- else
- res->type&=~HTF_PUBLIC;
- if (res->type&HTG_SRC_SYM)
- HashSrcFileSet(Fs->last_cc,res);
- return res;
- } else
- return NULL;
-}
-
-I64 HashLstAdd(U8 *lst,I64 type,CHashTable *table)
-{//Add a list to a hash table.
- I64 i=0;
- CHashGeneric *tmph;
- if (lst) {
- while (*lst) {
- if (*lst=='@')
- lst++;
- else
- i++;
- tmph=CAlloc(sizeof(CHashGeneric));
- tmph->user_data0=i-1;
- tmph->str=StrNew(lst);
- tmph->type=type;
- HashAdd(tmph,table);
- while (*lst++);
- }
- }
- return i;
-}
-
-I64 HashDefineLstAdd(U8 *dname,I64 type,CHashTable *table)
-{//Add define list to a hash table. See ::/Adam/DolDoc/DocInit.HC.
- CHashDefineStr *tmph;
- if (tmph=HashFind(dname,Fs->hash_table,HTT_DEFINE_STR))
- return HashLstAdd(tmph->data,type,table);
- else
- return 0;
-}
-
-I64 FramePtr(U8 *name,CTask *task=NULL)
-{//Find entry in task->hash_table, Return user_data.
- CHashGeneric *tmph;
- if (!task) task=Fs;
- if (tmph=HashFind(name,task->hash_table,HTT_FRAME_PTR))
- return tmph->user_data0;
- else
- return 0;
-}
-
-CHashGeneric *FramePtrAdd(U8 *name,I64 val=0,CTask *task=NULL)
-{//Add named value to task->hash_table.
- return HashGenericAdd(name,HTT_FRAME_PTR,val,0,0,task);
-}
-
-I64 FramePtrSet(U8 *name,I64 val,CTask *task=NULL)
-{//Find hash entry in task->hash_table. Change user_data0.
- CHashGeneric *tmph;
- if (!task) task=Fs;
- if (tmph=HashFind(name,task->hash_table,HTT_FRAME_PTR))
- return LXchgI64(&tmph->user_data0,val);
- else
- return 0;
-}
-
-I64 FramePtrDel(U8 *name,CTask *task=NULL)
-{//Remove entry and delete.
- CHashGeneric *tmph;
- I64 res=0;
- if (!task) task=Fs;
- if (tmph=HashFind(name,task->hash_table,HTT_FRAME_PTR)) {
- res=tmph->user_data0;
- HashRemDel(tmph,task->hash_table);
- }
- return res;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/KInts.HC.HTML b/public/src/Kernel/KInts.HC.HTML deleted file mode 100644 index fddf575..0000000 --- a/public/src/Kernel/KInts.HC.HTML +++ /dev/null @@ -1,227 +0,0 @@ - - - - - KInts.HC - - - - - asm {
-INT_MP_CRASH_ADDR:: //Forward reference to work around compiler
- DU32 &IntMPCrash;
-
-INT_WAKE::
- PUSH RDX
- PUSH RAX
- MOV EAX,&dev
- MOV EDX,U32 LAPIC_EOI
- MOV RAX,U64 CDevGlbls.uncached_alias[RAX]
- MOV U32 [RAX+RDX],0
- POP RAX
- POP RDX
- IRET
-
-IRQ_TIMER:: //I_TIMER
- CALL TASK_CONTEXT_SAVE
- CLD
-
- MOV RAX,U64 [RSP]
- MOV U64 CTask.rip[RSI],RAX
- MOV RAX,U64 16[RSP]
- MOV U64 CTask.rflags[RSI],RAX
- MOV RAX,U64 24[RSP]
- MOV U64 CTask.rsp[RSI],RAX
-
- XOR RAX,RAX
- MOV RDI,U64 GS:CCPU.addr[RAX]
- LOCK
- INC U64 CCPU.total_jiffies[RDI]
-
- BT U64 CTask.task_flags[RSI],TASKf_IDLE
- JNC @@05
- LOCK
- INC U64 CCPU.idle_pt_hits[RDI]
-
-@@05: MOV RAX,U64 CCPU.profiler_timer_irq[RDI]
- TEST RAX,RAX
- JZ @@10
- PUSH RSI
- CALL RAX //See ProfTimerInt().
- JMP @@15
-@@10: ADD RSP,8
-@@15: CLI
- MOV RAX,U64 CCPU.num[RDI]
- TEST RAX,RAX
- JZ @@20
-
- MOV EAX,&dev
- MOV EDX,U32 LAPIC_EOI
- MOV RAX,U64 CDevGlbls.uncached_alias[RAX]
- MOV U32 [RAX+RDX],0
- JMP @@25
-
-@@20: CALL &IntCore0TimerHndlr //Only Core 0 calls this.
-@@25: XOR RAX,RAX
- CMP RSI,U64 GS:CCPU.idle_task[RAX]
- JE I32 RESTORE_SETH_TASK_IF_READY
- JMP I32 RESTORE_RSI_TASK
-//************************************
-INT_FAULT::
- PUSH RBX
- PUSH RAX
- MOV BL,U8 16[RSP] //We pushed fault_num IntFaultHndlrsNew().
- XOR RAX,RAX
- MOV FS:U8 CTask.fault_num[RAX],BL
- POP RAX
- POP RBX
- ADD RSP,8 //Pop fault_num
-
- CALL TASK_CONTEXT_SAVE
-
- XOR RDX,RDX
- MOV U64 CTask.fault_err_code[RSI],RDX
- MOV EDX,U32 CTask.fault_num[RSI]
- BT U64 [INT_FAULT_ERR_CODE_BITMAP],RDX
- JNC @@1
- POP U64 CTask.fault_err_code[RSI]
-
-@@1: MOV RAX,U64 [RSP]
- MOV U64 CTask.rip[RSI],RAX
- MOV RAX,U64 16[RSP]
- MOV U64 CTask.rflags[RSI],RAX
- MOV RSP,U64 24[RSP]
- MOV U64 CTask.rsp[RSI],RSP
- MOV RBP,CTask.rbp[RSI]
- PUSH U64 CTask.fault_err_code[RSI]
- PUSH U64 CTask.fault_num[RSI]
- MOV RSI,CTask.rsi[RSI]
- CALL &Fault2 //See Fault2
- JMP I32 RESTORE_FS_TASK
-
-INT_FAULT_ERR_CODE_BITMAP::
- DU32 0x00027D00,0,0,0,0,0,0,0;
-}
-
-U8 *IntEntryGet(I64 irq)
-{//Get interrupt vector.
- U8 *res;
- I64 *src;
- src=dev.idt(U8 *)+irq*16;
- res(I64).u16[0]=*src(U16 *);
- src(U8 *)+=6;
- res(I64).u16[1]=*src(U16 *)++;
- res(I64).u32[1]=*src(U32 *);
- return res;
-}
-
-U8 *IntEntrySet(I64 irq,U0 (*fp_new_hndlr)(),I64 type=IDTET_IRQ,I64 dpl=0)
-{//Set interrupt vector. See IDTET_IRQ.
-//See /Demo/Lectures/InterruptDemo.HC.
- //See /Demo/MultiCore/Interrupts.HC.
- I64 fp=fp_new_hndlr;
- U8 *res,*dst;
- PUSHFD
- CLI
- res=IntEntryGet(irq);
- dst=dev.idt(U8 *)+irq*16;
- *dst(U16 *)++=fp.u16[0];
- *dst(U16 *)++=offset(CGDT.cs64);
- *dst(U16 *)++=0x8000+type<<8+dpl<<13;
- *dst(U16 *)++=fp.u16[1];
- *dst(U32 *)++=fp.u32[1];
- *dst(U32 *)=0;
- POPFD
- return res;
-}
-
-U0 IntsInit()
-{//Init 8259
- OutU8(0x20,0x11); //IW1
- OutU8(0xA0,0x11); //IW1
- OutU8(0x21,0x20); //IW2
- OutU8(0xA1,0x28); //IW2
- OutU8(0x21,0x04); //IW3
- OutU8(0xA1,0x02); //IW3
- OutU8(0x21,0x0D); //IW4
- OutU8(0xA1,0x09); //IW4
- OutU8(0x21,0xFA); //Mask all but IRQ0 (timer) and IRQ2 Cascade.
- OutU8(0xA1,0xFF);
-}
-
-interrupt U0 IntNop()
-{//Make unplanned IRQs stop by all means!
- OutU8(0xA0,0x20);
- OutU8(0x20,0x20);
- *(dev.uncached_alias+LAPIC_EOI)(U32 *)=0;
-}
-
-interrupt U0 IntDivZero()
-{
- if (Gs->num) {
- mp_cnt=1;
- dbg.mp_crash->cpu_num=Gs->num;
- dbg.mp_crash->task=Fs;
- MOV RAX,U64 8[RBP] //Get RIP off of stk.
- dbg.mp_crash->rip=GetRAX;
- dbg.mp_crash->msg="Div Zero";
- dbg.mp_crash->msg_num=0;
- MPInt(I_MP_CRASH,0);
- SysHlt;
- }
- throw('DivZero');
-}
-
-U8 *IntFaultHndlrsNew()
-{
- I64 i;
- U8 *res=MAlloc(256*7,Fs->code_heap),*dst=res;
- for (i=0;i<256;i++) {
- *dst++=0x6A; //PUSH I8 xx
- *dst(I8 *)++=i;
- *dst++=0xE9; //JMP I32 xxxxxxxx
- *dst(I32 *)=INT_FAULT-dst-4;
- dst+=4;
- }
- return res;
-}
-
-U0 IntInit1()
-{//Interrupt descriptor table part1.
- I64 i;
- CSysLimitBase tmp_ptr;
- if (!Gs->num) {//Gs cur CCPU struct
- dev.idt=CAlloc(16*256);
- for (i=0;i<256;i++)
- IntEntrySet(i,&IntNop);
- }
- tmp_ptr.limit=256*16-1;
- tmp_ptr.base =dev.idt;
- SetRAX(&tmp_ptr);
- LIDT U64 [RAX]
-}
-
-U0 IntInit2()
-{//Interrupt descriptor table part2: Core 0 Only.
- I64 i;
- PUSHFD
- CLI
- IntEntrySet(I_DIV_ZERO,&IntDivZero);
- for (i=1;i<0x20;i++)
- IntEntrySet(i,&dbg.int_fault_code[7*i]);
-/*In theory, we use the PIC mask reg to insure we don't get
-anything but keyboard, mouse and timer IRQs. In practice, I've
-gotten IRQ 0x27, perhaps because I didn't initialize the APIC.
-I go ahead and ACK PIC in IntNop().
-I have no idea why I got a IRQ 0x27.
-*/
- IntEntrySet(I_NMI,_SYS_HLT);
- IntEntrySet(I_TIMER,IRQ_TIMER);
- IntEntrySet(I_MP_CRASH,*INT_MP_CRASH_ADDR(U32 *));
- IntEntrySet(I_WAKE,INT_WAKE);
- IntEntrySet(I_DBG,&dbg.int_fault_code[7*I_DBG]);
- POPFD
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/KLoad.HC.HTML b/public/src/Kernel/KLoad.HC.HTML deleted file mode 100644 index 51dc67f..0000000 --- a/public/src/Kernel/KLoad.HC.HTML +++ /dev/null @@ -1,262 +0,0 @@ - - - - - KLoad.HC - - - - - U0 LoadOneImport(U8 **_src,U8 *module_base,I64 ld_flags)
-{
- U8 *src=*_src,*ptr2,*st_ptr;
- I64 i,etype;
- CHashExport *tmpex=NULL;
- CHashImport *tmpiss;
- Bool first=TRUE;
-
- while (etype=*src++) {
- i=*src(U32 *)++;
- st_ptr=src;
- src+=StrLen(st_ptr)+1;
- if (*st_ptr) {
- if (!first) {
- *_src=st_ptr-5;
- return;
- } else {
- first=FALSE;
- if (!(tmpex=HashFind(st_ptr,
- Fs->hash_table,HTG_ALL-HTT_IMPORT_SYS_SYM))) {
- if (!(ld_flags & LDF_SILENT))
- "Unresolved Reference:%s\n",st_ptr;
- tmpiss=CAlloc(sizeof(CHashImport));
- tmpiss->str=StrNew(st_ptr);
- tmpiss->type=HTT_IMPORT_SYS_SYM;
- tmpiss->module_header_entry=st_ptr-5;
- tmpiss->module_base=module_base;
- HashAdd(tmpiss,Fs->hash_table);
- }
- }
- }
- if (tmpex) {
- ptr2=module_base+i;
- if (tmpex->type & HTT_FUN)
- i=tmpex(CHashFun *)->exe_addr;
- else if (tmpex->type & HTT_GLBL_VAR)
- i=tmpex(CHashGlblVar *)->data_addr;
- else
- i=tmpex->val;
- switch (etype) {
- case IET_REL_I8: *ptr2(U8 *) =i-ptr2-1; break;
- case IET_IMM_U8: *ptr2(U8 *) =i; break;
- case IET_REL_I16: *ptr2(U16 *)=i-ptr2-2; break;
- case IET_IMM_U16: *ptr2(U16 *)=i; break;
- case IET_REL_I32: *ptr2(U32 *)=i-ptr2-4; break;
- case IET_IMM_U32: *ptr2(U32 *)=i; break;
- case IET_REL_I64: *ptr2(I64 *)=i-ptr2-8; break;
- case IET_IMM_I64: *ptr2(I64 *)=i; break;
- }
- }
- }
- *_src=src-1;
-}
-
-U0 SysSymImportsResolve(U8 *st_ptr,I64 ld_flags)
-{
- CHashImport *tmpiss;
- U8 *ptr;
- while (tmpiss=HashSingleTableFind(st_ptr,
- Fs->hash_table,HTT_IMPORT_SYS_SYM)) {
- ptr=tmpiss->module_header_entry;
- LoadOneImport(&ptr,tmpiss->module_base,ld_flags);
- tmpiss->type=HTT_INVALID;
- }
-}
-
-U0 LoadPass1(U8 *src,U8 *module_base,I64 ld_flags)
-{
- U8 *ptr2,*ptr3,*st_ptr;
- I64 i,j,cnt,etype;
- CHashExport *tmpex=NULL;
- while (etype=*src++) {
- i=*src(U32 *)++;
- st_ptr=src;
- src+=StrLen(st_ptr)+1;
- switch (etype) {
- case IET_REL32_EXPORT:
- case IET_IMM32_EXPORT:
- case IET_REL64_EXPORT:
- case IET_IMM64_EXPORT:
- tmpex=CAlloc(sizeof(CHashExport));
- tmpex->str=StrNew(st_ptr);
- tmpex->type=HTT_EXPORT_SYS_SYM|HTF_IMM;
- if (etype==IET_IMM32_EXPORT||etype==IET_IMM64_EXPORT)
- tmpex->val=i;
- else
- tmpex->val=i+module_base;
- HashAdd(tmpex,Fs->hash_table);
- SysSymImportsResolve(st_ptr,ld_flags);
- break;
- case IET_REL_I0...IET_IMM_I64:
- src=st_ptr-5;
- LoadOneImport(&src,module_base,ld_flags);
- break;
- case IET_ABS_ADDR:
- if (ld_flags & LDF_NO_ABSS)
- src+=i*sizeof(U32);
- else {
- cnt=i;
- for (j=0;j<cnt;j++) {
- ptr2=module_base+*src(U32 *)++;
- *ptr2(U32 *)+=module_base;
- }
- }
- break;
-
- start:
- case IET_CODE_HEAP:
- ptr3=MAlloc(*src(I32 *)++,Fs->code_heap);
- break;
- case IET_ZEROED_CODE_HEAP:
- ptr3=CAlloc(*src(I32 *)++,Fs->code_heap);
- break;
- end:
- if (*st_ptr) {
- tmpex=CAlloc(sizeof(CHashExport));
- tmpex->str=StrNew(st_ptr);
- tmpex->type=HTT_EXPORT_SYS_SYM|HTF_IMM;
- tmpex->val=ptr3;
- HashAdd(tmpex,Fs->hash_table);
- }
- cnt=i;
- for (j=0;j<cnt;j++) {
- ptr2=module_base+*src(U32 *)++;
- *ptr2(I32 *)+=ptr3;
- }
- break;
-
- start:
- case IET_DATA_HEAP:
- ptr3=MAlloc(*src(I64 *)++);
- break;
- case IET_ZEROED_DATA_HEAP:
- ptr3=CAlloc(*src(I64 *)++);
- break;
- end:
- if (*st_ptr) {
- tmpex=CAlloc(sizeof(CHashExport));
- tmpex->str=StrNew(st_ptr);
- tmpex->type=HTT_EXPORT_SYS_SYM|HTF_IMM;
- tmpex->val=ptr3;
- HashAdd(tmpex,Fs->hash_table);
- }
- cnt=i;
- for (j=0;j<cnt;j++) {
- ptr2=module_base+*src(U32 *)++;
- *ptr2(I64 *)+=ptr3;
- }
- break;
- }
- }
-}
-
-U0 LoadPass2(U8 *src,U8 *module_base,I64)
-{
- U8 *st_ptr;
- I64 i,etype;
- while (etype=*src++) {
- i=*src(U32 *)++;
- st_ptr=src;
- src+=StrLen(st_ptr)+1;
- switch (etype) {
- case IET_MAIN:
- Call(i+module_base);
- break;
- case IET_ABS_ADDR:
- src+=sizeof(U32)*i;
- break;
- case IET_CODE_HEAP:
- case IET_ZEROED_CODE_HEAP:
- src+=4+sizeof(U32)*i;
- break;
- case IET_DATA_HEAP:
- case IET_ZEROED_DATA_HEAP:
- src+=8+sizeof(U32)*i;
- break;
- }
- }
-}
-
-CBinFile *Load(U8 *filename,I64 ld_flags=0,CBinFile *bfh_addr=INVALID_PTR)
-{//Load a .BIN file module into memory.
-//bfh_addr==INVALID_PTR means don't care what load addr.
- U8 *fbuf,*module_base,*absname;
- I64 size,module_align,misalignment;
- CBinFile *bfh;
-
- fbuf=ExtDft(filename,"BIN.Z");
- if (!(bfh=FileRead(fbuf,&size))) {
- Free(fbuf);
- return NULL;
- }
-
- //See Patch Table Generation
- module_align=1<<bfh->module_align_bits;
- if (!module_align || bfh->bin_signature!=BIN_SIGNATURE_VAL) {
- Free(bfh);
- Free(fbuf);
- throw('BinModul');
- }
-
- if (bfh_addr==INVALID_PTR) {
- if (bfh->org==INVALID_PTR) {
- misalignment=module_align-sizeof(CBinFile);
- if (misalignment<0)
- misalignment&=module_align-1;
- if (Fs->code_heap!=Fs->data_heap) {
- if (module_align<16)
- module_align=16;
- bfh_addr=MAllocAligned(size,module_align,Fs->code_heap,misalignment);
- } else if (module_align>8)
- bfh_addr=MAllocAligned(size,module_align,,misalignment);
- else {//Less than 2Gig system memory
- bfh_addr=bfh;
- goto lo_skip; //File is already in code heap area, don't copy.
- }
- } else
- bfh_addr=bfh->org;
- }
- MemCpy(bfh_addr,bfh,size);
- Free(bfh);
-
- lo_skip:
- module_base=bfh_addr(U8 *)+sizeof(CBinFile);
-
- absname=FileNameAbs(fbuf);
- Free(fbuf);
- fbuf=StrNew(absname);
- FileExtRem(fbuf);
- if (fbuf[1]==':' && StrLen(fbuf)>2)
- HashGenericAdd(fbuf+2,HTT_MODULE|HTF_PUBLIC,bfh_addr);
- LoadPass1(bfh_addr(U8 *)+bfh_addr->patch_table_offset,module_base,ld_flags);
- if (!(ld_flags&LDF_JUST_LOAD))
- LoadPass2(bfh_addr(U8 *)+bfh_addr->patch_table_offset,module_base,ld_flags);
- Free(absname);
- Free(fbuf);
- return bfh_addr;
-}
-
-U0 LoadKernel()
-{
- HashGenericAdd(KERNEL_MODULE_NAME,HTT_MODULE|HTF_PUBLIC,
- mem_boot_base-sizeof(CBinFile));
-
- //Abs patches done here $LK,"CPatchTableAbsAddr",A="FF:D:/Kernel/KStart32.HC,CPatchTableAbsAddr"$.
- LoadPass1(sys_boot_patch_table_base,mem_boot_base,LDF_NO_ABSS|LDF_SILENT);
-
- //No main routines
- // LoadPass2(sys_boot_patch_table_base,mem_boot_base,0);
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/KMain.HC.HTML b/public/src/Kernel/KMain.HC.HTML deleted file mode 100644 index 45946d0..0000000 --- a/public/src/Kernel/KMain.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - KMain.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Kernel/KMathA.HC.HTML b/public/src/Kernel/KMathA.HC.HTML deleted file mode 100644 index 8b20ef3..0000000 --- a/public/src/Kernel/KMathA.HC.HTML +++ /dev/null @@ -1,660 +0,0 @@ - - - - - KMathA.HC - - - - - asm {
-//************************************
-_D3_NORM::
- PUSH RBP
- MOV RBP,RSP
- MOV RDX,U64 SF_ARG1[RBP]
- FLD U64 [RDX]
- FMUL ST0,ST0
- FLD U64 8[RDX]
- FMUL ST0,ST0
- FADDP ST1,ST0
- FLD U64 16[RDX]
- FMUL ST0,ST0
- FADDP ST1,ST0
- FSQRT
- FSTP U64 SF_ARG1[RBP]
- MOV RAX,U64 SF_ARG1[RBP]
- POP RBP
- RET1 8
-//************************************
-_D3_NORM_SQR::
- PUSH RBP
- MOV RBP,RSP
- MOV RDX,U64 SF_ARG1[RBP]
- FLD U64 [RDX]
- FMUL ST0,ST0
- FLD U64 8[RDX]
- FMUL ST0,ST0
- FADDP ST1,ST0
- FLD U64 16[RDX]
- FMUL ST0,ST0
- FADDP ST1,ST0
- FSTP U64 SF_ARG1[RBP]
- MOV RAX,U64 SF_ARG1[RBP]
- POP RBP
- RET1 8
-//************************************
-_D3_DIST::
- PUSH RBP
- MOV RBP,RSP
- MOV RDX,U64 SF_ARG1[RBP]
- MOV RBX,U64 SF_ARG2[RBP]
- FLD U64 [RDX]
- FSUB ST0,U64 [RBX]
- FMUL ST0,ST0
- FLD U64 8[RDX]
- FSUB ST0,U64 8[RBX]
- FMUL ST0,ST0
- FADDP ST1,ST0
- FLD U64 16[RDX]
- FSUB ST0,U64 16[RBX]
- FMUL ST0,ST0
- FADDP ST1,ST0
- FSQRT
- FSTP U64 SF_ARG1[RBP]
- MOV RAX,U64 SF_ARG1[RBP]
- POP RBP
- RET1 16
-//************************************
-_D3_DIST_SQR::
- PUSH RBP
- MOV RBP,RSP
- MOV RDX,U64 SF_ARG1[RBP]
- MOV RBX,U64 SF_ARG2[RBP]
- FLD U64 [RDX]
- FSUB ST0,U64 [RBX]
- FMUL ST0,ST0
- FLD U64 8[RDX]
- FSUB ST0,U64 8[RBX]
- FMUL ST0,ST0
- FADDP ST1,ST0
- FLD U64 16[RDX]
- FSUB ST0,U64 16[RBX]
- FMUL ST0,ST0
- FADDP ST1,ST0
- FSTP U64 SF_ARG1[RBP]
- MOV RAX,U64 SF_ARG1[RBP]
- POP RBP
- RET1 16
-//************************************
-_D3_CROSS::
- PUSH RBP
- MOV RBP,RSP
- MOV RAX,U64 SF_ARG1[RBP]
- MOV RDX,U64 SF_ARG2[RBP]
- MOV RBX,U64 SF_ARG3[RBP]
-
- FLD U64 8[RDX]
- FMUL ST0,U64 16[RBX]
- FLD U64 16[RDX]
- FMUL ST0,U64 8[RBX]
- FSUBP ST1,ST0
- FSTP U64 [RAX]
-
- FLD U64 [RDX]
- FMUL ST0,U64 16[RBX]
- FLD U64 16[RDX]
- FMUL ST0,U64 [RBX]
- FSUBRP ST1,ST0
- FSTP U64 8[RAX]
-
- FLD U64 [RDX]
- FMUL ST0,U64 8[RBX]
- FLD U64 8[RDX]
- FMUL ST0,U64 [RBX]
- FSUBP ST1,ST0
- FSTP U64 16[RAX]
-
- POP RBP
- RET1 24
-//************************************
-_D3_DOT::
- PUSH RBP
- MOV RBP,RSP
- MOV RDX,U64 SF_ARG1[RBP]
- MOV RBX,U64 SF_ARG2[RBP]
- FLD U64 [RDX]
- FMUL ST0,U64 [RBX]
- FLD U64 8[RDX]
- FMUL ST0,U64 8[RBX]
- FADDP ST1,ST0
- FLD U64 16[RDX]
- FMUL ST0,U64 16[RBX]
- FADDP ST1,ST0
- FSTP U64 SF_ARG1[RBP]
- MOV RAX,U64 SF_ARG1[RBP]
- POP RBP
- RET1 16
-//************************************
-_D3_ADD::
- PUSH RBP
- MOV RBP,RSP
- MOV RAX,U64 SF_ARG1[RBP]
- MOV RDX,U64 SF_ARG2[RBP]
- MOV RBX,U64 SF_ARG3[RBP]
- FLD U64 [RDX]
- FADD ST0,U64 [RBX]
- FSTP U64 [RAX]
- FLD U64 8[RDX]
- FADD ST0,U64 8[RBX]
- FSTP U64 8[RAX]
- FLD U64 16[RDX]
- FADD ST0,U64 16[RBX]
- FSTP U64 16[RAX]
- POP RBP
- RET1 24
-//************************************
-_D3_SUB::
- PUSH RBP
- MOV RBP,RSP
- MOV RAX,U64 SF_ARG1[RBP]
- MOV RDX,U64 SF_ARG2[RBP]
- MOV RBX,U64 SF_ARG3[RBP]
- FLD U64 [RDX]
- FSUB ST0,U64 [RBX]
- FSTP U64 [RAX]
- FLD U64 8[RDX]
- FSUB ST0,U64 8[RBX]
- FSTP U64 8[RAX]
- FLD U64 16[RDX]
- FSUB ST0,U64 16[RBX]
- FSTP U64 16[RAX]
- POP RBP
- RET1 24
-//************************************
-_D3_MUL::
- PUSH RBP
- MOV RBP,RSP
- MOV RAX,U64 SF_ARG1[RBP]
- MOV RBX,U64 SF_ARG3[RBP]
- FLD U64 SF_ARG2[RBP]
- FLD ST0
- FMUL ST0,U64 [RBX]
- FSTP U64 [RAX]
- FLD ST0
- FMUL ST0,U64 8[RBX]
- FSTP U64 8[RAX]
- FMUL ST0,U64 16[RBX]
- FSTP U64 16[RAX]
- POP RBP
- RET1 24
-//************************************
-_D3_DIV::
- PUSH RBP
- MOV RBP,RSP
- MOV RAX,U64 SF_ARG1[RBP]
- MOV RBX,U64 SF_ARG2[RBP]
- FLD U64 SF_ARG3[RBP]
- FLD ST0
- FDIVR ST0,U64 [RBX]
- FSTP U64 [RAX]
- FLD ST0
- FDIVR ST0,U64 8[RBX]
- FSTP U64 8[RAX]
- FDIVR ST0,U64 16[RBX]
- FSTP U64 16[RAX]
- POP RBP
- RET1 24
-//************************************
-_D3_ZERO::
- PUSH RBP
- MOV RBP,RSP
- MOV RAX,U64 SF_ARG1[RBP]
- XOR RDX,RDX
- MOV U64 [RAX],RDX
- MOV U64 8[RAX],RDX
- MOV U64 16[RAX],RDX
- POP RBP
- RET1 8
-//************************************
-_D3_COPY::
- PUSH RBP
- MOV RBP,RSP
- MOV RAX,U64 SF_ARG1[RBP]
- MOV RBX,U64 SF_ARG2[RBP]
- MOV RDX,U64 [RBX]
- MOV U64 [RAX],RDX
- MOV RDX,U64 8[RBX]
- MOV U64 8[RAX],RDX
- MOV RDX,U64 16[RBX]
- MOV U64 16[RAX],RDX
- POP RBP
- RET1 16
-//************************************
-_D3_EQU::
- PUSH RBP
- MOV RBP,RSP
- MOV RAX,U64 SF_ARG1[RBP]
- MOV RDX,U64 SF_ARG2[RBP]
- MOV U64 [RAX],RDX
- MOV RDX,U64 SF_ARG3[RBP]
- MOV U64 8[RAX],RDX
- MOV RDX,U64 SF_ARG4[RBP]
- MOV U64 16[RAX],RDX
- POP RBP
- RET1 32
-//************************************
-_D3_ADD_EQU::
- PUSH RBP
- MOV RBP,RSP
- MOV RAX,U64 SF_ARG1[RBP]
- MOV RBX,U64 SF_ARG2[RBP]
- FLD U64 [RAX]
- FADD ST0,U64 [RBX]
- FSTP U64 [RAX]
- FLD U64 8[RAX]
- FADD ST0,U64 8[RBX]
- FSTP U64 8[RAX]
- FLD U64 16[RAX]
- FADD ST0,U64 16[RBX]
- FSTP U64 16[RAX]
- POP RBP
- RET1 16
-//************************************
-_D3_SUB_EQU::
- PUSH RBP
- MOV RBP,RSP
- MOV RAX,U64 SF_ARG1[RBP]
- MOV RBX,U64 SF_ARG2[RBP]
- FLD U64 [RAX]
- FSUB ST0,U64 [RBX]
- FSTP U64 [RAX]
- FLD U64 8[RAX]
- FSUB ST0,U64 8[RBX]
- FSTP U64 8[RAX]
- FLD U64 16[RAX]
- FSUB ST0,U64 16[RBX]
- FSTP U64 16[RAX]
- POP RBP
- RET1 16
-//************************************
-_D3_MUL_EQU::
- PUSH RBP
- MOV RBP,RSP
- MOV RAX,U64 SF_ARG1[RBP]
- FLD U64 SF_ARG2[RBP]
- FLD ST0
- FMUL ST0,U64 [RAX]
- FSTP U64 [RAX]
- FLD ST0
- FMUL ST0,U64 8[RAX]
- FSTP U64 8[RAX]
- FMUL ST0,U64 16[RAX]
- FSTP U64 16[RAX]
- POP RBP
- RET1 16
-//************************************
-_D3_DIV_EQU::
- PUSH RBP
- MOV RBP,RSP
- MOV RAX,U64 SF_ARG1[RBP]
- FLD U64 SF_ARG2[RBP]
- FLD ST0
- FDIVR ST0,U64 [RAX]
- FSTP U64 [RAX]
- FLD ST0
- FDIVR ST0,U64 8[RAX]
- FSTP U64 8[RAX]
- FDIVR ST0,U64 16[RAX]
- FSTP U64 16[RAX]
- POP RBP
- RET1 16
-//************************************
-_D3_UNIT::
- PUSH RBP
- MOV RBP,RSP
- MOV RAX,U64 SF_ARG1[RBP]
- FLD U64 [RAX]
- FMUL ST0,ST0
- FLD U64 8[RAX]
- FMUL ST0,ST0
- FADDP ST1,ST0
- FLD U64 16[RAX]
- FMUL ST0,ST0
- FADDP ST1,ST0
- FSQRT
- FST U64 SF_ARG1[RBP]
- MOV RBX,SF_ARG1[RBP]
- TEST RBX,RBX
- JZ @@05
- FLD ST0
- FDIVR ST0,U64 [RAX]
- FSTP U64 [RAX]
- FLD ST0
- FDIVR ST0,U64 8[RAX]
- FSTP U64 8[RAX]
- FDIVR ST0,U64 16[RAX]
- FSTP U64 16[RAX]
- POP RBP
- RET1 8
-@@05: FFREE ST0
- FINCSTP
- POP RBP
- RET1 8
-//************************************
-_SQR::
- PUSH RBP
- MOV RBP,RSP
- FLD U64 SF_ARG1[RBP]
- FMUL ST0,ST0
- FSTP U64 SF_ARG1[RBP]
- MOV RAX,U64 SF_ARG1[RBP]
- POP RBP
- RET1 8
-//************************************
-_SIGN::
- PUSH RBP
- MOV RBP,RSP
- FLD U64 SF_ARG1[RBP]
- FTST
- FSTSW
- FFREE ST0
- FINCSTP
- MOV RDX,RAX
- XOR RAX,RAX
- BT RDX,14
- JC @@05
- MOV RAX,1.0
- BT RDX,8
- JNC @@05
- MOV RAX,-1.0
-@@05: POP RBP
- RET1 8
-//************************************
-_ARG::
- PUSH RBP
- MOV RBP,RSP
- FLD U64 SF_ARG2[RBP]
- FLD U64 SF_ARG1[RBP]
-@@05: FPATAN
- FSTSW
- TEST AX,0x400
- JNZ @@05
- FSTP U64 SF_ARG1[RBP]
- MOV RAX,U64 SF_ARG1[RBP]
- POP RBP
- RET1 16
-//************************************
-_ROUND::
- PUSH RBP
- MOV RBP,RSP
- SUB RSP,8
- FSTCW U16 -8[RBP]
- MOV AX,U16 -8[RBP]
- MOV U16 -6[RBP],AX
- AND AX,~0x0C00
- MOV U16 -8[RBP],AX
- FLDCW U16 -8[RBP]
-
- FLD U64 SF_ARG1[RBP]
- FRNDINT
- FSTP U64 SF_ARG1[RBP]
- MOV RAX,U64 SF_ARG1[RBP]
-
- FLDCW U16 -6[RBP]
- LEAVE
- RET1 8
-//************************************
-_TRUNC::
- PUSH RBP
- MOV RBP,RSP
- SUB RSP,8
- FSTCW U16 -8[RBP]
- MOV AX,U16 -8[RBP]
- MOV U16 -6[RBP],AX
- OR AX,0x0C00
- MOV U16 -8[RBP],AX
- FLDCW U16 -8[RBP]
-
- FLD U64 SF_ARG1[RBP]
- FRNDINT
- FSTP U64 SF_ARG1[RBP]
- MOV RAX,U64 SF_ARG1[RBP]
-
- FLDCW U16 -6[RBP]
- LEAVE
- RET1 8
-//************************************
-_FLOOR::
- PUSH RBP
- MOV RBP,RSP
- SUB RSP,8
- FSTCW U16 -8[RBP]
- MOV AX,U16 -8[RBP]
- MOV U16 -6[RBP],AX
- AND AX,~0x0C00
- OR AX,0x0400
- MOV U16 -8[RBP],AX
- FLDCW U16 -8[RBP]
-
- FLD U64 SF_ARG1[RBP]
- FRNDINT
- FSTP U64 SF_ARG1[RBP]
- MOV RAX,U64 SF_ARG1[RBP]
-
- FLDCW U16 -6[RBP]
- LEAVE
- RET1 8
-//************************************
-_CEIL::
- PUSH RBP
- MOV RBP,RSP
- SUB RSP,8
- FSTCW U16 -8[RBP]
- MOV AX,U16 -8[RBP]
- MOV U16 -6[RBP],AX
- AND AX,~0x0C00
- OR AX,0x0800
- MOV U16 -8[RBP],AX
- FLDCW U16 -8[RBP]
-
- FLD U64 SF_ARG1[RBP]
- FRNDINT
- FSTP U64 SF_ARG1[RBP]
- MOV RAX,SF_ARG1[RBP]
-
- FLDCW U16 -6[RBP]
- LEAVE
- RET1 8
-//************************************
-SYS_POW::
-// RAX=RDX`RAX
- PUSH RBP
- MOV RBP,RSP
- SUB RSP,24
- TEST RAX,RAX //To power of zero?
- JNZ @@05
- MOV RAX,1.0
- JMP @@20
-@@05: TEST RDX,RDX //zero to a power?
- JNZ @@10
- XOR RAX,RAX
- JMP @@20
-@@10: MOV RCX,RAX //RCX=pow
- MOV U64 -8[RBP],RDX
- MOV U64 -16[RBP],RAX
- FSTCW U16 -24[RBP]
- MOV AX,U16 -24[RBP]
- MOV U16 -22[RBP],AX
- OR AX,0x0C00
- MOV U16 -24[RBP],AX
- FLDCW U16 -24[RBP]
- FLD U64 -16[RBP]
- FLD U64 -8[RBP]
- FABS //base should be pos
- FYL2X // y*log2(x)
- FST U64 -8[RBP]
- FRNDINT
- FLD U64 -8[RBP]
- FSUBRP ST1,ST0
- F2XM1
- FLD1
- FADDP ST1,ST0
- FSTP U64 -16[RBP]
- FLD U64 -8[RBP]
- FLD U64 -16[RBP]
- FSCALE // ST0<<ST1
- TEST RDX,RDX //was base neg?
- JGE @@15
- MOV U64 -16[RBP],RCX
- FLD U64 -16[RBP]
- FISTTP U64 -16[RBP]
- TEST U64 -16[RBP],1
- JZ @@15 //was pow odd?
- FCHS
-@@15: FSTP U64 -8[RBP]
- FFREE ST0
- FINCSTP
- FLDCW U16 -22[RBP]
- MOV RAX,U64 -8[RBP]
-@@20: LEAVE
- RET
-//************************************
-_POW::
- PUSH RBP
- MOV RBP,RSP
- MOV RAX,U64 SF_ARG2[RBP]
- MOV RDX,U64 SF_ARG1[RBP]
- CALL SYS_POW
- POP RBP
- RET1 16
-//************************************
-_POW10::
- PUSH RBP
- MOV RBP,RSP
- SUB RSP,16
- FSTCW U16 -8[RBP]
- MOV AX,U16 -8[RBP]
- MOV U16 -6[RBP],AX
- OR AX,0x0C00
- MOV U16 -8[RBP],AX
- FLDCW U16 -8[RBP]
-
- FLDL2T
- FLD U64 SF_ARG1[RBP]
- FMULP ST1,ST0
- FST U64 SF_ARG1[RBP]
- FRNDINT
- FLD U64 SF_ARG1[RBP]
- FSUBRP ST1,ST0
- F2XM1
- FLD1
- FADDP ST1,ST0
- FSTP U64 -16[RBP]
- FLD U64 SF_ARG1[RBP]
- FLD U64 -16[RBP]
- FSCALE // ST0<<ST1
- FSTP U64 -16[RBP]
- FFREE ST0
- FINCSTP
-
- FLDCW U16 -6[RBP]
- MOV RAX,U64 -16[RBP]
- LEAVE
- RET1 8
-//************************************
-_EXP::
- PUSH RBP
- MOV RBP,RSP
- SUB RSP,16
- FSTCW U16 -8[RBP]
- MOV AX,U16 -8[RBP]
- MOV U16 -6[RBP],AX
- OR AX,0x0C00
- MOV U16 -8[RBP],AX
- FLDCW U16 -8[RBP]
-
- FLDL2E
- FLD U64 SF_ARG1[RBP]
- FMULP ST1,ST0
- FST U64 SF_ARG1[RBP]
- FRNDINT
- FLD U64 SF_ARG1[RBP]
- FSUBRP ST1,ST0
- F2XM1
- FLD1
- FADDP ST1,ST0
- FSTP U64 -16[RBP]
- FLD U64 SF_ARG1[RBP]
- FLD U64 -16[RBP]
- FSCALE // ST0<<ST1
- FSTP U64 -16[RBP]
- FFREE ST0
- FINCSTP
-
- FLDCW U16 -6[RBP]
- MOV RAX,U64 -16[RBP]
- LEAVE
- RET1 8
-//************************************
-_LOG10::
- PUSH RBP
- MOV RBP,RSP
- FLDLG2
- FLD U64 SF_ARG1[RBP]
- FYL2X // y*log2(x)
- FSTP U64 SF_ARG1[RBP]
- MOV RAX,U64 SF_ARG1[RBP]
- POP RBP
- RET1 8
-//************************************
-_LOG2::
- PUSH RBP
- MOV RBP,RSP
- FLD1
- FLD U64 SF_ARG1[RBP]
- FYL2X // y*log2(x)
- FSTP U64 SF_ARG1[RBP]
- MOV RAX,U64 SF_ARG1[RBP]
- POP RBP
- RET1 8
-//************************************
-_LN::
- PUSH RBP
- MOV RBP,RSP
- FLDLN2
- FLD U64 SF_ARG1[RBP]
- FYL2X // y*log2(x)
- FSTP U64 SF_ARG1[RBP]
- MOV RAX,U64 SF_ARG1[RBP]
- POP RBP
- RET1 8
-//************************************
-_FLDCW::
- PUSH RBP
- MOV RBP,RSP
- FLDCW U16 SF_ARG1[RBP]
- POP RBP
- RET1 8
-//************************************
-_FSTCW::
- PUSH RBP
- MOV RBP,RSP
- SUB RSP,8
- FSTCW U16 -8[RBP]
- MOVZX RAX,U16 -8[RBP]
- LEAVE
- RET
-//************************************
-_FSTSW::
- XOR RAX,RAX
- FSTSW
- RET
-//************************************
-_FCLEX::
- FCLEX
- RET
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/KMathB.HC.HTML b/public/src/Kernel/KMathB.HC.HTML deleted file mode 100644 index 9e0feda..0000000 --- a/public/src/Kernel/KMathB.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - KMathB.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Kernel/KMisc.HC.HTML b/public/src/Kernel/KMisc.HC.HTML deleted file mode 100644 index 5fa386c..0000000 --- a/public/src/Kernel/KMisc.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - KMisc.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Kernel/KStart16.HC.HTML b/public/src/Kernel/KStart16.HC.HTML deleted file mode 100644 index 7b3cc93..0000000 --- a/public/src/Kernel/KStart16.HC.HTML +++ /dev/null @@ -1,218 +0,0 @@ - - - - - KStart16.HC - - - - - asm {/* See /Doc/Boot.DD.
-TempleOS starts in real, calls some BIOS
-routines, switches to 32 bit, and 64 bit mode
-and continues in HolyC at KMain().
-
-The boot loader jumps here in real-mode (16-bit).
-It actually jumps to the CBinFile header which is
-placed just before this by the compiler.
-The header begins with a short jmp to
-the start of this file's code which begins
-with the following small jump past some data.
-
-This file is first in the Kernel image
-because it is #included first.Kernel.PRJ
-*/
-USE16
-SYS_KERNEL:: //This must match CKernel.
- JMP I16 CORE0_16BIT_INIT
-
-//************************************
-// ASM Global vars required for 16-bit start-up
- ALIGN 4,OC_NOP
-SYS_BOOT_SRC:: DU32 BOOT_SRC_NULL;
-SYS_BOOT_BLK:: DU32 0;
-SYS_BOOT_PATCH_TABLE_BASE:: DU32 0;
-SYS_RUN_LEVEL:: DU32 0;
-#exe {StreamPrint("SYS_COMPILE_TIME:: DU64 0x%X;",Now);} //See BootDVDProbe
-#assert SYS_COMPILE_TIME+sizeof(CDate)+sizeof(CBinFile)<DVD_BLK_SIZE
-
-MEM_BOOT_BASE:: DU32 0; //Offset from start used by reboot
-MEM_E801:: DU16 0,0;
-MEM_E820:: DU8 MEM_E820_ENTRIES_NUM*sizeof(CMemE820) DUP (0);
-MEM_PHYSICAL_SPACE:: DU64 0;
-SYS_GDT_PTR:: DU16 sizeof(CGDT)-1;
- DU64 0;
-SYS_PCI_BUSES:: DU16 0;
-
- ALIGN 16,OC_NOP
-SYS_GDT:: //See CGDT
-GDT_NULL: DU64 0,0;
-GDT_BOOT_DS: DU64 0x00CF92000000FFFF,0; //Gets patched.
-GDT_BOOT_CS: DU64 0x00CF9A000000FFFF,0; //Gets patched.
-GDT_CS32: DU64 0x00CF9A000000FFFF,0;
-GDT_CS64: DU64 0x00209A0000000000,0; //The Charter says just ring0.
-GDT_CS64_RING3: DU64 0x0020FA0000000000,0; //Ring3, so you can play with.
-GDT_DS: DU64 0x00CF92000000FFFF,0;
-GDT_DS_RING3: DU64 0x00CFF2000000FFFF,0;
-GDT_TR: DU8 MP_PROCESSORS_NUM*16 DUP(0);
-GDT_TR_RING3: DU8 MP_PROCESSORS_NUM*16 DUP(0);
-#assert $-SYS_GDT==sizeof(CGDT)
-
-#assert $-SYS_KERNEL==sizeof(CKernel)-sizeof(CBinFile)
-
-//************************************
-CORE0_16BIT_INIT::
-//EAX is SYS_BOOT_SRC. (Val passed from boot blk, BootHD, BootDVD, & BootRAM.)
- MOV ECX,EAX
- MOV AX,(BOOT_RAM_LIMIT-BOOT_STK_SIZE)/16
- MOV SS,AX
- MOV SP,BOOT_STK_SIZE
- PUSH ECX //Will be SYS_BOOT_SRC. See BootHD, BootDVD & BootRAM.
- PUSH EBX
-
- CALL U16 GET_RIP
-GET_RIP: POP BX
- SUB BX,GET_RIP
- SHR BX,4
- MOV AX,CS
- ADD AX,BX
- PUSH AX
- PUSH U16 @@05
- RETF
-
-@@05: STI
- MOV AX,CS
- MOV DS,AX
-
- MOV U32 [SYS_RUN_LEVEL],RLF_16BIT
-
- MOV AX,0x4F02
- MOV BX,0x12 //640x480 16 color
-#exe {
- if (!kernel_cfg->opts[CFG_TEXT_MODE])
- StreamPrint("INT 0x10"); //Enable VGA
-};
- CMP AX,0x004F
- JNE @@10 //Jmp if fail
- BTS U32 [SYS_RUN_LEVEL],RLf_VGA
-@@10:
-
-//Get mem maps.
- MOV AX,0xE801
- INT 0x15
- MOV U16 [MEM_E801],CX
- MOV U16 [MEM_E801+2],DX
-
- MOV CX,MEM_E820_ENTRIES_NUM-1 //Leave one to terminate
- XOR EBX,EBX
- MOV AX,DS
- MOV ES,AX
- MOV DI,MEM_E820
-@@15: PUSH CX
- MOV EAX,0xE820
- MOV ECX,sizeof(CMemE820)
- MOV EDX,'PAMS'
- INT 0x15
- JC @@20
- CMP EAX,'PAMS'
- JNE @@20
- TEST EBX,EBX
- JZ @@20
- ADD DI,sizeof(CMemE820)
- POP CX
- LOOP @@15
- SUB SP,2
-@@20: ADD SP,2
-
-//Find how much space to map, start with E801 limit.
- XOR EAX,EAX
- MOV AX,[MEM_E801+2]
- SHL EAX,16
- ADD EAX,SYS_16MEG_AREA_LIMIT
- XOR EDX,EDX
-
-//Find max of E820 to set mapped space.
- MOV SI,MEM_E820
-@@25: MOV CL,CMemE820.type[SI]
- TEST CL,CL
- JZ @@35
- MOV EBX,CMemE820.base[SI]
- MOV ECX,CMemE820.base+4[SI]
- ADD EBX,CMemE820.len[SI]
- ADC ECX,CMemE820.len+4[SI]
- SUB EBX,EAX
- SBB ECX,EDX
- JC @@30
- MOV EAX,CMemE820.base[SI]
- MOV EDX,CMemE820.base+4[SI]
- ADD EAX,CMemE820.len[SI]
- ADC EDX,CMemE820.len+4[SI]
-@@30: ADD SI,sizeof(CMemE820)
- JMP @@25
-
-@@35: MOV [MEM_PHYSICAL_SPACE],EAX
- MOV [MEM_PHYSICAL_SPACE+4],EDX
-
-//Get PCI Bus Info
- MOV U16 [SYS_PCI_BUSES],256
- XOR DX,DX
- MOV AX,0xB101
- INT 0x1A
- CMP DX,'PC'
- JNE @@40
- MOV CH,0
- INC CX
- MOV U16 [SYS_PCI_BUSES],CX
-@@40:
- CLI
-//Enable A20
- IN AL,0x92
- OR AL,2
- OUT 0x92,AL
-
- POP U32 [SYS_BOOT_BLK]
- POP U32 [SYS_BOOT_SRC] //See BootHD, BootDVD, & BootRAM.
-
- CLD
- XOR EAX,EAX
- MOV AX,CS
- MOV DS,AX
- MOV ES,AX
- SHL EAX,4
-
- MOV U32 [MEM_BOOT_BASE],EAX
-
- MOV DX,CS
- SUB DX,sizeof(CBinFile)/16
-#assert !(sizeof(CBinFile)&15)
- MOV GS,DX
-
- MOV EDX,EAX
- ADD EDX,U32 GS:[CBinFile.patch_table_offset]
- SUB EDX,sizeof(CBinFile)
- MOV U32 [SYS_BOOT_PATCH_TABLE_BASE],EDX
-
- ADD U32 [GDT_BOOT_DS+2],EAX
- ADD U32 [GDT_BOOT_CS+2],EAX
- ADD EAX,I32 SYS_GDT
- MOV U32 [SYS_GDT_PTR+CSysLimitBase.base],EAX
- LGDT U32 [SYS_GDT_PTR]
-
- MOV EAX,SYS_START_CR0
- MOV_CR0_EAX
-
-/* The assembler doesn't support far jumps so
-we hand code it. 16-bit code is not important
-enough to fully implement in the assembler.
-
-To complete the switch to 32-bit mode, we have to load
-the code segment with a far jump.
-*/
- DU8 0x66,0xEA; //JMP CGDT.boot_cs:CORE0_32BIT_INIT
- DU32 CORE0_32BIT_INIT;
- DU16 CGDT.boot_cs;
-#assert $+16<=0xFFFF
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/KStart32.HC.HTML b/public/src/Kernel/KStart32.HC.HTML deleted file mode 100644 index 29ef83c..0000000 --- a/public/src/Kernel/KStart32.HC.HTML +++ /dev/null @@ -1,129 +0,0 @@ - - - - - KStart32.HC - - - - - asm {
-USE32
-//************************************
-// ASM Global vars not required for 16-bit start-up
- ALIGN 8,OC_NOP
-MEM_HEAP_BASE:: DU64 0;
-MEM_HEAP_LIMIT:: DU64 0;
-MEM_PAGE_SIZE:: DU64 0;
-MEM_MAPPED_SPACE:: DU64 0;
-MEM_2MEG_NUM:: DU64 0;
-MEM_1GIG_NUM:: DU64 0;
-MEM_512GIG_NUM:: DU64 0;
-MEM_PML2:: DU64 0;
-MEM_PML3:: DU64 0;
-MEM_PML4:: DU64 0;
-
-#exe {
- StreamPrint(
-"SYS_MEM_INIT_FLAG:: DU8 %d;"
-"SYS_MEM_INIT_VAL:: DU8 %d;"
-"SYS_HEAP_INIT_FLAG:: DU8 %d;"
-"SYS_HEAP_INIT_VAL:: DU8 %d;"
-"SYS_VAR_INIT_FLAG:: DU8 %d;"
-"SYS_VAR_INIT_VAL:: DU8 %d;"
-"SYS_STAFF_MODE_FLAG:: DU8 %d;",
-kernel_cfg->opts[CFG_MEM_INIT], kernel_cfg->mem_init_val,
-kernel_cfg->opts[CFG_HEAP_INIT],kernel_cfg->heap_init_val,
-kernel_cfg->opts[CFG_VAR_INIT], kernel_cfg->var_init_val,
-kernel_cfg->opts[CFG_STAFF_MODE]);
-};
-SYS_HEAP_DBG_FLAG:: DU8 _CFG_HEAP_DBG;
-
- ALIGN 8,0
-SYS_CTRL_ALT_FLAGS:: DU64 0;
-SYS_EXTERN_TABLE:: DU64 0;
-
-SYS_CODE_BP:: DU64 0;
-SYS_DATA_BP:: DU64 0;
-
-SYS_PROGRESSES::
-SYS_PROGRESS1:: DU64 0;
-SYS_PROGRESS1_MAX:: DU64 0;
-SYS_PROGRESS1_T0:: DU64 0;
-SYS_PROGRESS1_TF:: DU64 0;
-SYS_PROGRESS1_DESC:: DU8 PROGRESS_DESC_LEN DUP(0);
-SYS_PROGRESS2:: DU64 0;
-SYS_PROGRESS2_MAX:: DU64 0;
-SYS_PROGRESS2_T0:: DU64 0;
-SYS_PROGRESS2_TF:: DU64 0;
-SYS_PROGRESS2_DESC:: DU8 PROGRESS_DESC_LEN DUP(0);
-SYS_PROGRESS3:: DU64 0;
-SYS_PROGRESS3_MAX:: DU64 0;
-SYS_PROGRESS3_T0:: DU64 0;
-SYS_PROGRESS3_TF:: DU64 0;
-SYS_PROGRESS3_DESC:: DU8 PROGRESS_DESC_LEN DUP(0);
-SYS_PROGRESS4:: DU64 0;
-SYS_PROGRESS4_MAX:: DU64 0;
-SYS_PROGRESS4_T0:: DU64 0;
-SYS_PROGRESS4_TF:: DU64 0;
-SYS_PROGRESS4_DESC:: DU8 PROGRESS_DESC_LEN DUP(0);
-#assert $-SYS_PROGRESSES==sizeof(CProgress)*4
-
-SYS_FOCUS_TASK:: DU64 0;
-SYS_CPU_STRUCTS:: DU64 0;
-SYS_MP_CNT:: DU64 1;
-SYS_MP_CNT_INITIAL:: DU64 1;
-SYS_MP_CNT_LOCK:: DU64 1;
-
- ALIGN DFT_CACHE_LINE_WIDTH,OC_NOP
-SYS_CACHE_LINE_WIDTH:: DU64 DFT_CACHE_LINE_WIDTH;
- DU8 DFT_CACHE_LINE_WIDTH-sizeof(CBinFile)-8 DUP(0);
-SYS_SEMAS:: DU8 SEMA_SEMAS_NUM*DFT_CACHE_LINE_WIDTH DUP(0);
-//************************************
- ALIGN 16,OC_NOP
-CORE0_32BIT_INIT:: //Entry point for BootRAM.
- PUSH U32 RFLAGG_START
- POPFD
- MOV EAX,SYS_START_CR0
- MOV_CR0_EAX
-
- MOV AX,CGDT.boot_ds //LOAD DS SELECTOR
- MOV DS,AX
- BTS U32 [SYS_RUN_LEVEL],RLf_32BIT
- MOV ESI,U32 [SYS_BOOT_PATCH_TABLE_BASE]
- MOV EDI,U32 [MEM_BOOT_BASE]
-
- MOV AX,CGDT.ds
- MOV DS,AX
- MOV ES,AX
- MOV FS,AX
- MOV GS,AX
- MOV SS,AX
- MOV ESP,BOOT_RAM_LIMIT //Tmp Stk
-
-//Patch abs addresses
- MOV ECX,U32 CPatchTableAbsAddr.abs_addres_cnt[ESI]
- LEA ESI,U32 CPatchTableAbsAddr.abs_addres[ESI]
-@@05: LODSD
- ADD EAX,EDI
- ADD U32 [EAX],EDI
- LOOP @@05
-
- DU8 0xEA; //JMP CGDT.cs32:@@10
- DU32 @@10;
- DU16 CGDT.cs32;
-
-@@10: BTS U32 [SYS_RUN_LEVEL],RLf_PATCHED
-
- CALL SYS_FIND_PCIBIOS_SERVICE_DIR
- CALL SYS_FIND_PCI_SERVICES
- CALL SYS_INIT_PAGE_TABLES
- CALL SYS_INIT_16MEG_SYS_CODE_BP
- PUSH U32 0 //Return from next call will be 64-bit
- CALL SYS_ENTER_LONG_MODE
-
- //We fall-thou to $LK,"KStart64",A="FL:::/Kernel/KStart64.HC,1"$, next.
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/KStart64.HC.HTML b/public/src/Kernel/KStart64.HC.HTML deleted file mode 100644 index 3911f04..0000000 --- a/public/src/Kernel/KStart64.HC.HTML +++ /dev/null @@ -1,112 +0,0 @@ - - - - - KStart64.HC - - - - - asm {
-USE64
- BTS U32 [SYS_RUN_LEVEL],RLf_64BIT
-
- FNINIT
- MOV RAX,SYS_FIXED_AREA+CSysFixedArea.init_fpu_mmx
- FXSAVE U64 [RAX]
-
-//Init CPU0 Struct
- PUSH SYS_FIXED_AREA+CSysFixedArea.adam
- PUSH SYS_FIXED_AREA+CSysFixedArea.boot_cpu
- PUSH 0
- CALL &CPUStructInit
- CALL SET_GS_BASE
-
-//Init Adam HeapCtrl
- MOV EDI,U32 SYS_FIXED_AREA+CSysFixedArea.adam_hc
- MOV EAX,U32 SYS_FIXED_AREA+CSysFixedArea.sys_code_bp
- MOV U64 CHeapCtrl.bp[RDI],RAX
- MOV U32 CHeapCtrl.hc_signature[RDI],HEAP_CTRL_SIGNATURE_VAL
-
- LEA RAX,U64 CHeapCtrl.next_um-CMemUsed.next[RDI]
- MOV U64 CHeapCtrl.next_um[RDI],RAX
- MOV U64 CHeapCtrl.last_um[RDI],RAX
-
- MOV EAX,U32 SYS_FIXED_AREA+CSysFixedArea.adam
- MOV U64 CHeapCtrl.mem_task[RDI],RAX
- MOV U64 CTask.code_heap[RAX],RDI
- MOV U64 CTask.data_heap[RAX],RDI
- MOV U32 CTask.task_signature[RAX],TASK_SIGNATURE_VAL
-
- BTS U32 [SYS_RUN_LEVEL],RLf_16MEG_ADAM_HEAP_CTRL
-
- PUSH MEM_ADAM_STK
- PUSH U32 SYS_FIXED_AREA+CSysFixedArea.adam
- CALL &TaskInit
- CALL SET_FS_BASE
- MOV RSP,U64 CTask.rsp[RAX]
-
- JMP I32 &KMain
-
-//************************************
-USE32
-SYS_ENTER_LONG_MODE:: //Switch to long 64-bit mode
- MOV_EAX_CR4
- OR EAX,0xB0
- MOV_CR4_EAX
-
- MOV EAX,[MEM_PML4]
- MOV_CR3_EAX
-
- MOV ECX,IA32_EFER
- XOR EDX,EDX
- MOV EAX,IA32F_LME
- WRMSR
-
- MOV_EAX_CR0
- BTS EAX,31 //Enable paging (required for 64-bit mode)
- MOV_CR0_EAX
-
- DU8 0xEA; //JMP CGDT.cs64:@@05
- DU32 @@05;
- DU16 CGDT.cs64;
-USE64
-@@05: MOV AX,CGDT.ds
- MOV DS,AX
- MOV ES,AX
- MOV SS,AX
- MOV FS,AX
- MOV GS,AX
- RET
-
-//************************************
-SYS_RAM_REBOOT:: //This gets copied high. SYS_RAM_REBOOT
- PUSH U32 CGDT.ds //stk seg
- PUSH U32 BOOT_RAM_LIMIT //stk
- PUSH U32 0 //flags
- PUSH U32 CGDT.cs32
- LEA RAX,[@@10]
- PUSH RAX
- IRET
-USE32
-@@10: WBINVD
-
-//Disable paging
- MOV_EAX_CR0
- BTR EAX,31
- MOV_CR0_EAX
-
- MOV ECX,IA32_EFER
- XOR EDX,EDX
- XOR EAX,EAX
- WRMSR
-
- MOV EBX,BOOT_SRC_RAM
- MOV EAX,I32 CORE0_32BIT_INIT
- JMP EAX
-SYS_RAM_REBOOT_END::
-USE64
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/KTask.HC.HTML b/public/src/Kernel/KTask.HC.HTML deleted file mode 100644 index 55a887d..0000000 --- a/public/src/Kernel/KTask.HC.HTML +++ /dev/null @@ -1,557 +0,0 @@ - - - - - KTask.HC - - - - - U0 Exit()
-{//Terminate own task.
- if (Fs==sys_focus_task && IsDbgMode) {
- LBts(&Fs->task_flags,TASKf_KILL_AFTER_DBG);
- G;
- } else {
- if (sys_staff_mode_flag)
- AdamLog("%p:%p:%p:%p:%p:%p\n",Caller(0),Caller(1),Caller(2),Caller(3),
- Caller(4),Caller(5),Caller(6),Caller(7));
- if (!Gs->num && !IsDbgMode)
- SingleUser(OFF);
- Fs->rflags=GetRFlags;
- Fs->rsp=GetRSP;
- Fs->rbp=GetRBP;
- Fs->rip=$;
- CLI
- LBts(&Fs->task_flags,TASKf_KILL_TASK);
- TaskEndNow;
- }
-}
-
-Bool TaskValidate(CTask *task)
-{//return TRUE if task looks valid.
- if (!(0<task<=I32_MAX) || task->addr!=task ||
- task->task_signature!=TASK_SIGNATURE_VAL)
- return FALSE;
- else
- return TRUE;
-}
-
-I64 BirthWait(CTask **_task,I64 task_num=-1)
-{//Wait for task valid and not task_num.
- while (!TaskValidate(*_task)||(*_task)->task_num==task_num)
- Yield;
- return (*_task)->task_num;
-}
-
-U0 DeathWait(CTask **_task,Bool send_exit=FALSE)
-{//Wait for task death.
- if (send_exit && TaskValidate(*_task)) {
- TaskWait(*_task,TRUE);
- XTalk(*_task,"Exit;\n");
- }
- while (TaskValidate(*_task))
- Yield;
-}
-
-Bool Kill(CTask *task,Bool wait=TRUE,Bool just_break=FALSE)
-{//Terminate other task.
- I64 i;
- if (TaskValidate(task)) {
- if (just_break) {
- if (task!=Fs)
- Break;
- else {//TODO wait
- sys_focus_task=task;
- LBts(sys_ctrl_alt_flags,CTRL_ALT_C);
- return TRUE;
- }
- } else {
- if (task!=sys_winmgr_task) {
- for (i=0;i<mp_cnt;i++)
- if (task==cpu_structs[i].seth_task)
- return FALSE;
- LBts(&task->task_flags,TASKf_KILL_TASK);
- if (wait) {
- do Yield;
- while (TaskValidate(task) && Bt(&task->task_flags,TASKf_KILL_TASK));
- }
- return TRUE;
- }
- }
- }
- return FALSE;
-}
-
-Bool Suspend(CTask *task=NULL,Bool state=TRUE)
-{//Tell scheduler to skip task.
- Bool res;
- if (!task) task=Fs;
- PUSHFD
- CLI
- if (TaskValidate(task))
- res=LBEqu(&task->task_flags,TASKf_SUSPENDED,state);
- else
- res=FALSE;
- POPFD
- return res;
-}
-
-Bool IsSuspended(CTask *task=NULL)
-{//You might use this in a DrawIt() or Animatetask().
- if (!task) task=Fs;
- if (TaskValidate(task))
- return Bt(&task->task_flags,TASKf_SUSPENDED);
- else
- return FALSE;
-}
-
-CTaskStk *TaskStkNew(I64 stk_size,CTask *task)
-{
- CTaskStk *tmps=MAlloc(stk_size+offset(CTaskStk.stk_base),task);
- tmps->next_stk=NULL;
- tmps->stk_ptr=NULL;
- tmps->stk_size=MSize(tmps)-offset(CTaskStk.stk_base);
- return tmps;
-}
-
-#exe {Option(OPTf_NO_REG_VAR,ON);};
-argpop I64 CallStkGrow(I64 stk_size_threshold,I64 stk_size,
- /*argpop*/I64 (*fp_addr)(...),...)
-{//Grow stk in call with any fixed num of args.
-//See /Demo/StkGrow.HC.
- CTaskStk *tmps,*tmps2,**_stk;
- I64 res,*rsp,*rsp2,*old_stk;
-
- if (UnusedStk>=stk_size_threshold) {
-
- asm {
- LEAVE
- POP RAX //return addr
- ADD RSP,16 //pop threshold,stk_size
- POP RBX // *f
- ADD RSP,8 //pop ARGC
- PUSH RAX
- JMP RBX //CALL fp_addr()
- };
-
- } else {
-
- tmps2=TaskStkNew(stk_size,Fs);
- tmps2->next_stk=tmps=Fs->stk;
- rsp2=(&tmps2->stk_base)(U8 *)+tmps2->stk_size;
- old_stk=rsp=&argv[argc];
- while (argc-->0)
- *--rsp2=*--rsp;
- _stk=&Fs->stk;
- tmps->stk_ptr=rsp=GetRSP;
- asm {
- IMPORT _FREE; //We are in a function, not at glbl scope.
-//The compiler treats these in isolation.
-
- PUSHFD
- POP RDX //flags
- CLI
- MOV RBX,U64 &tmps2[RBP]
- MOV RAX,&_stk[RBP]
- MOV U64 [RAX],RBX //Fs->stk=tmps2
- MOV RSP,U64 &rsp2[RBP]
- PUSH RDX
- POPFD
-
- CALL U64 &fp_addr[RBP]
- MOV U64 &res[RBP],RAX
-
- PUSHFD
- POP RDX //flags
- CLI
- MOV RBX,U64 &tmps[RBP]
- MOV RAX,&_stk[RBP]
- MOV U64 [RAX],RBX //Fs->stk=tmps
- MOV RSP,U64 &rsp[RBP]
- PUSH RDX
- POPFD
-
- PUSH U64 &tmps2[RBP]
- CALL _FREE
-
- MOV RDX,U64 &old_stk[RBP]
- MOV RBX,U64 8[RBP]
- MOV RAX,U64 &res[RBP]
- MOV RBP,U64 [RBP]
- MOV RSP,RDX
- JMP RBX //return
- };
- }
- return 0; //dummy to get rid of warning
-}
-;
-#exe {Option(OPTf_NO_REG_VAR,OFF);};
-
-I64 TaskInit(CTask *task,I64 stk_size)
-{//Returns Fs of task
- CTaskStk *tmps;
-
- QueInit(&task->code_heap->next_mem_blk);
- task->code_heap->last_mergable=NULL;
- if (task->code_heap!=task->data_heap) {
- QueInit(&task->data_heap->next_mem_blk);
- task->data_heap->last_mergable=NULL;
- }
-
- task->addr=task->next_task=task->last_task=
- task->next_input_filter_task=task->last_input_filter_task=
- task;
-
- task->task_num=sys_num_spawned_tasks++;
-
- task->rflags=RFLAGG_NORMAL;
- task->win_inhibit=WIG_TASK_DFT;
-
- task->next_child_task=task->last_child_task=
- (&task->next_child_task)(U8 *)-offset(CTask.next_sibling_task);
-
- JobCtrlInit(&task->srv_ctrl);
- QueInit(&task->next_cc);
- QueInit(&task->next_except);
- QueInit(&task->next_ctrl);
- QueInit(&task->next_ode);
-
- task->fpu_mmx=MAllocAligned(sizeof(CFPU),0x10,task);
- MemCpy(task->fpu_mmx,
- SYS_FIXED_AREA+offset(CSysFixedArea.init_fpu_mmx),sizeof(CFPU));
-
- task->hash_table=HashTableNew(TASK_HASH_TABLE_SIZE,task);
-
- if (!stk_size)
- stk_size=MEM_DFT_STK;
- task->stk=tmps=TaskStkNew(stk_size,task);
- task->rsp=(&tmps->stk_base)(U8 *)+tmps->stk_size;
-
- task->text_attr =WHITE<<4+BLUE;
- task->border_src =BDS_CONST;
- task->border_attr =DrvTextAttrGet(':');
- task->title_src =TTS_CONST;
- task->win_left =1;
- task->win_right =text.cols-2;
- task->win_top =13;
- task->win_bottom =text.rows-2;
-
- if (blkdev.home_dir) {//Beware Adam TaskInit. I guess ok until DskChg().
- task->cur_dv=blkdev.let_to_drv[*blkdev.home_dir-'A'];
- task->cur_dir=StrNew(blkdev.home_dir+2,task);
- } else
- task->cur_dir=StrNew("/Home",task);
-
- Seed(,task);
-
- return task;
-}
-
-CTask *Spawn(U0 (*fp_start_addr)(U8 *data),U8 *data=NULL,U8 *task_name=NULL,
- I64 target_cpu=-1, //-1 for current CPU. See multi-core.
- CTask *parent=NULL, //NULL means adam
- I64 stk_size=0, //0=default
- I64 flags=1<<JOBf_ADD_TO_QUE)
-{//Create task on core running at address.
-//Alloc CTask structure from code heap so addr will be short.
- //Could be alloced off of data heap.
- CTask *task;
- if (target_cpu>=0)
- return SpawnQue(fp_start_addr,data,task_name,target_cpu,
- parent,stk_size,flags);
- task=CAlloc(sizeof(CTask),adam_task->code_heap);
- task->task_signature=TASK_SIGNATURE_VAL;
- if (!task_name) task_name="Unnamed Task";
- if (!parent) parent=Gs->seth_task;
- task->parent_task=parent;
- task->gs=parent->gs;
- if (sys_code_bp)
- task->code_heap=HeapCtrlInit(,task,sys_code_bp);
- if (sys_data_bp)
- task->data_heap=HeapCtrlInit(,task,sys_data_bp);
- else
- task->data_heap=task->code_heap;
- TaskInit(task,stk_size);
- task->rip=fp_start_addr;
- task->rsp(U8 *)-=8;
- *task->rsp=data;
- task->rsp(U8 *)-=8;
- *task->rsp=&Exit;
- task->hash_table->next=parent->hash_table;
- MemCpy(task->task_name,task_name,TASK_NAME_LEN);
- StrCpy(task->task_title,task->task_name);
- task->title_src=TTS_TASK_NAME;
- PUSHFD
- CLI
- if (Bt(&flags,JOBf_ADD_TO_QUE)) {
- TaskQueInsChild(task);
- TaskQueIns(task);
- }
- POPFD
- return task;
-}
-
-U0 TaskDerivedValsUpdate(CTask *task=NULL,Bool update_z_buf=TRUE)
-{//Those things calculated from other variables.
- if (!task) task=Fs;
- PUSHFD
- CLI
- while (LBts(&task->task_flags,TASKf_TASK_LOCK))
- PAUSE
- WinDerivedValsUpdate(task);
- if (fp_update_ctrls)
- (*fp_update_ctrls)(task);
- if (update_z_buf && Bt(&task->display_flags,DISPLAYf_SHOW))
- LBts(&sys_semas[SEMA_UPDATE_WIN_Z_BUF],0);
- LBtr(&task->task_flags,TASKf_TASK_LOCK);
- POPFD
-}
-
-I64 ExeCmdLine(CCmpCtrl *cc)
-{//Terminal JIT-compile-and-execute loop for CCmpCtrl.
- I64 res=0,type,old_title_src=Fs->title_src;
- U8 *ptr,*ptr2,*ptr3,*machine_code,*old_task_title=StrNew(Fs->task_title);
- F64 t0;
- CDocEntry *doc_e;
- CDoc *doc;
- if (Fs->title_src!=TTS_LOCKED_CONST)
- Fs->title_src=TTS_CUR_LEX;
- while (cc->token &&
- (cc->token!='}' || !(cc->flags & CCF_EXE_BLK)) ) {
- if (Fs->title_src==TTS_CUR_LEX) {
- ptr2=&Fs->task_title;
- ptr3=ptr2+STR_LEN-1;
- if (cc->lex_include_stk->flags & LFSF_DOC) {
- doc_e=cc->lex_include_stk->cur_entry;
- doc=cc->lex_include_stk->doc;
- while (doc_e!=doc && ptr2<ptr3) {
- switch (doc_e->type_u8) {
- case DOCT_TEXT:
- ptr=doc_e->tag;
- while (*ptr && ptr2<ptr3)
- *ptr2++=*ptr++;
- break;
- case DOCT_TAB:
- case DOCT_NEW_LINE:
- *ptr2++='.';
- break;
- }
- doc_e=doc_e->next;
- }
- if (ptr2<ptr3) *ptr2=0;
- } else
- if ((ptr=cc->lex_include_stk->line_start) && *ptr)
- MemCpy(ptr2,ptr,STR_LEN-1);
- }
- cc->flags&=~CCF_HAS_MISC_DATA;
- machine_code=LexStmt2Bin(cc,&type);
- if (machine_code!=INVALID_PTR) {
- if (!(cc->flags&CCF_JUST_LOAD)) {
- t0=tS;
- res=Call(machine_code);
- Fs->answer=res;
- Fs->answer_type=type;
- Fs->answer_time=tS-t0;
- Fs->new_answer=TRUE;
- cc->pmt_line=0;
- }
- if (!(cc->flags&CCF_HAS_MISC_DATA))
- Free(machine_code);
- }
- }
- if (Fs->title_src!=TTS_LOCKED_CONST) {
- Fs->title_src=old_title_src;
- StrCpy(Fs->task_title,old_task_title);
- }
- Free(old_task_title);
- if (cc->flags&CCF_JUST_LOAD) {
- if (cc->error_cnt)
- return FALSE;
- else
- return TRUE;
- } else
- return res;
-}
-
-U0 SrvTaskCont()
-{//Act as server task in a loop handling commands.
- I64 old_flags=GetRFlags;
- FlushMsgs;
- while (TRUE) {
- CLI
- if (JobsHndlr(old_flags) && Fs->title_src==TTS_TASK_NAME)
- MemCpy(Fs->task_title,Fs->task_name,TASK_NAME_LEN);
- FlushMsgs;
- LBts(&Fs->task_flags,TASKf_IDLE);
- LBts(&Fs->task_flags,TASKf_AWAITING_MSG);
- Yield;
- SetRFlags(old_flags);
- }
-}
-
-U0 UserTaskCont()
-{//Terminal key-input-execute loop.
- CCmpCtrl *cc;
- CDoc *doc;
- Bool cont=TRUE;
- do {
- cc=CmpCtrlNew(,CCF_CMD_LINE|CCF_PMT|CCF_QUESTION_HELP);
- QueIns(cc,Fs->last_cc);
- try {
- Lex(cc);
- ExeCmdLine(cc);
- cont=Bt(&cc->flags,CCf_PMT);
- QueRem(cc);
- CmpCtrlDel(cc);
- } catch {
- if ((doc=Fs->put_doc) && doc->doc_signature==DOC_SIGNATURE_VAL)
- DocUnlock(doc);
- PutExcept;
- }
- } while (cont);
-}
-
-U0 SrvCmdLine(I64 dummy=0)
-{
- no_warn dummy;
- Fs->win_inhibit=WIG_USER_TASK_DFT;
- CallExtStr("SrvStartUp");
- SrvTaskCont;
-}
-
-U0 UserCmdLine(I64 dummy=0)
-{//A user task ends-up calling this.
- no_warn dummy;
- Fs->win_inhibit=WIG_USER_TASK_DFT;
- CallExtStr("UserStartUp");
- if (!LBts(&Fs->display_flags,DISPLAYf_SHOW))
- Dbg;
- UserTaskCont;
-}
-
-CTask *User(U8 *fmt=NULL,...)
-{//Create user term task.
- U8 *st;
- CTask *task=Spawn(&UserCmdLine);
- TaskWait(task);
- if (fmt) {
- st=StrPrintJoin(NULL,fmt,argc,argv);
- XTalk(task,st);
- Free(st);
- }
- return task;
-}
-
-U0 TaskDel(CTask *task)
-{//We delay freeing in case lingering ptr to reincarnated.
- HeapCtrlDel(task->code_heap);
- if (task->data_heap!=task->code_heap)
- HeapCtrlDel(task->data_heap);
- Free(task);
-}
-
-I64 TaskEnd()
-{//Called with irq's off.
- CTask *task=Fs,*tmpt,*tmpt1;
- if (task==sys_task_being_scrn_updated) {
- LBts(&task->task_flags,TASKf_KILL_TASK);
- return task->next_task;
- }
- if (task->task_end_cb) {
- task->wake_jiffy=0;
- LBtr(&task->task_flags,TASKf_KILL_TASK);
- TaskRstAwaitingMsg(task);
- Suspend(task,FALSE);
- task->rip=task->task_end_cb;
- task->task_end_cb=NULL;
- return task;
- }
- if (task->parent_task && task->parent_task->popup_task==task) {
- task->parent_task->popup_task=NULL;
- Kill(task->parent_task,FALSE);
- return task->parent_task;
- }
-
- DrvsRelease;
- BlkDevsRelease;
- tmpt1=(&task->next_child_task)(U8 *)-offset(CTask.next_sibling_task);
- tmpt=tmpt1->next_sibling_task;
- if (tmpt!=tmpt1) {
- do {
- LBts(&tmpt->task_flags,TASKf_KILL_TASK);
- tmpt=tmpt->next_sibling_task;
- } while (tmpt!=tmpt1);
- return task->next_task;
- }
- if (LBtr(&task->display_flags,DISPLAYf_SHOW))
- LBts(&sys_semas[SEMA_UPDATE_WIN_Z_BUF],0);
-
- while (LBts(&task->task_flags,TASKf_TASK_LOCK))
- PAUSE
- while (LBts(&task->srv_ctrl.flags,JOBCf_LOCKED))
- PAUSE
-
- JobQueDel(&task->srv_ctrl.next_waiting);
- JobQueDel(&task->srv_ctrl.next_done);
-
- if (IsRaw)
- VGAFlush;
-
- if (sys_focus_task==task) {
- if (!Gs->num)
- SingleUser(OFF);
- sys_focus_task=NULL;
- if (fp_set_std_palette)
- (*fp_set_std_palette)();
- }
-
- //QueRem
- task->task_signature(I64)=0;
-
- tmpt =task->next_input_filter_task;
- tmpt1=task->last_input_filter_task;
- tmpt1->next_input_filter_task=tmpt;
- tmpt ->last_input_filter_task=tmpt1;
-
- tmpt =task->next_sibling_task;
- tmpt1=task->last_sibling_task;
- tmpt1->next_sibling_task=tmpt;
- tmpt ->last_sibling_task=tmpt1;
-
- tmpt =task->next_task; //save to return
- TaskQueRem(task);
-
- LBtr(&task->srv_ctrl.flags,JOBCf_LOCKED);
- LBtr(&task->task_flags,TASKf_TASK_LOCK);
-
- task->wake_jiffy=cnts.jiffies+DYING_JIFFIES;
- while (LBts(&Gs->cpu_flags,CPUf_DYING_TASK_QUE))
- PAUSE
- QueIns(task,Gs->last_dying);
- LBtr(&Gs->cpu_flags,CPUf_DYING_TASK_QUE);
-
- return tmpt;
-}
-
-U0 TaskKillDying()
-{//Delay freeing to prevent asking for trouble with quick reincarnations.
-//What if the user is doing this: DoTreeCheckers.
- CTaskDying *task,*task1;
- if (Gs->kill_jiffy<cnts.jiffies) {//Avoid doing as many lock operations.
- while (LBts(&Gs->cpu_flags,CPUf_DYING_TASK_QUE))
- PAUSE
- task=Gs->next_dying;
- while (task!=&Gs->next_dying && task->wake_jiffy<cnts.jiffies) {
- task1=task->next;
- QueRem(task);
- TaskDel(task);
- task=task1;
- }
- LBtr(&Gs->cpu_flags,CPUf_DYING_TASK_QUE);
- Gs->kill_jiffy=cnts.jiffies+DYING_JIFFIES;
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/KUtils.HC.HTML b/public/src/Kernel/KUtils.HC.HTML deleted file mode 100644 index d8268c2..0000000 --- a/public/src/Kernel/KUtils.HC.HTML +++ /dev/null @@ -1,483 +0,0 @@ - - - - - KUtils.HC - - - - - asm {
-_MEMSET::
- PUSH RBP
- MOV RBP,RSP
- PUSH RDI
- CLD
- MOV RDI,U64 SF_ARG1[RBP]
- MOV RAX,U64 SF_ARG2[RBP]
- MOV RCX,U64 SF_ARG3[RBP]
- REP_STOSB
- MOV RAX,RDI
- POP RDI
- POP RBP
- RET1 24
-_MEMSET_U16::
- PUSH RBP
- MOV RBP,RSP
- PUSH RDI
- CLD
- MOV RDI,U64 SF_ARG1[RBP]
- MOV RAX,U64 SF_ARG2[RBP]
- MOV RCX,U64 SF_ARG3[RBP]
- REP_STOSW
- MOV RAX,RDI
- POP RDI
- POP RBP
- RET1 24
-_MEMSET_U32::
- PUSH RBP
- MOV RBP,RSP
- PUSH RDI
- CLD
- MOV RDI,U64 SF_ARG1[RBP]
- MOV RAX,U64 SF_ARG2[RBP]
- MOV RCX,U64 SF_ARG3[RBP]
- REP_STOSD
- MOV RAX,RDI
- POP RDI
- POP RBP
- RET1 24
-_MEMSET_I64::
- PUSH RBP
- MOV RBP,RSP
- PUSH RDI
- CLD
- MOV RDI,U64 SF_ARG1[RBP]
- MOV RAX,U64 SF_ARG2[RBP]
- MOV RCX,U64 SF_ARG3[RBP]
- REP_STOSQ
- MOV RAX,RDI
- POP RDI
- POP RBP
- RET1 24
-_MEMCPY::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
- CLD
- MOV RDI,U64 SF_ARG1[RBP]
- MOV RSI,U64 SF_ARG2[RBP]
- MOV RCX,U64 SF_ARG3[RBP]
- REP_MOVSB
- MOV RAX,RDI
- POP RDI
- POP RSI
- POP RBP
- RET1 24
-_MEMCMP::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
- CLD
- MOV RSI,U64 SF_ARG1[RBP]
- MOV RDI,U64 SF_ARG2[RBP]
- MOV RCX,U64 SF_ARG3[RBP]
- XOR RAX,RAX
- REPE_CMPSB
- JZ @@05
- MOV AL,1
- JA @@05
- MOV RAX,-1
-@@05: POP RDI
- POP RSI
- POP RBP
- RET1 24
-_BEQU::
- PUSH RBP
- MOV RBP,RSP
- XOR RAX,RAX
- MOV RDX,U64 SF_ARG3[RBP]
- MOV RBX,U64 SF_ARG1[RBP]
- MOV RCX,U64 SF_ARG2[RBP]
- TEST RDX,RDX
- JZ @@5
- BTS U64 [RBX],RCX
- JMP @@10
-@@5: BTR U64 [RBX],RCX
-@@10: ADC AL,0
- POP RBP
- RET1 24
-_LBEQU::
- PUSH RBP
- MOV RBP,RSP
- XOR RAX,RAX
- MOV RDX,U64 SF_ARG3[RBP]
- MOV RBX,U64 SF_ARG1[RBP]
- MOV RCX,U64 SF_ARG2[RBP]
- TEST RDX,RDX
- JZ @@5
- LOCK
- BTS U64 [RBX],RCX
- JMP @@10
-@@5: LOCK
- BTR U64 [RBX],RCX
-@@10: ADC AL,0
- POP RBP
- RET1 24
-_CLAMP_I64::
- PUSH RBP
- MOV RBP,RSP
- MOV RAX,U64 SF_ARG1[RBP]
- MOV RCX,U64 SF_ARG2[RBP]
- MOV RDX,U64 SF_ARG3[RBP]
- CMP RAX,RCX
- CMOVL RAX,RCX
- CMP RAX,RDX
- CMOVG RAX,RDX
- POP RBP
- RET1 24
-_CLAMP_U64::
- PUSH RBP
- MOV RBP,RSP
- MOV RAX,U64 SF_ARG1[RBP]
- MOV RCX,U64 SF_ARG2[RBP]
- MOV RDX,U64 SF_ARG3[RBP]
- CMP RAX,RCX
- CMOVB RAX,RCX
- CMP RAX,RDX
- CMOVA RAX,RDX
- POP RBP
- RET1 24
-_CALL::
- PUSH RBP
- MOV RBP,RSP
- MOV RAX,U64 SF_ARG1[RBP]
- TEST RAX,RAX
- JZ @@05
- CALL RAX
-@@05: POP RBP
- RET1 8
-_BIT_FIELD_OR_U32::
- PUSH RBP
- MOV RBP,RSP
- MOV RBX,U64 SF_ARG2[RBP]
- SHR RBX,3
- ADD RBX,U64 SF_ARG1[RBP]
- MOV RAX,U64 SF_ARG3[RBP]
- MOV RCX,U64 SF_ARG2[RBP]
- AND CL,7
- SHL RAX,CL
- OR U64 [RBX],RAX
- POP RBP
- RET1 24
-_BIT_FIELD_EXT_U32::
- PUSH RBP
- MOV RBP,RSP
- MOV RBX,U64 SF_ARG2[RBP]
- MOV RCX,RBX
- SHR RBX,3
- ADD RBX,U64 SF_ARG1[RBP]
- MOV RDX,U64 [RBX]
- AND CL,7
- SHR RDX,CL
- MOV RCX,U64 SF_ARG3[RBP]
- MOV RAX,1
- SHL RAX,CL
- DEC RAX
- AND RAX,RDX
- POP RBP
- RET1 24
-_XCHG_I64::
- PUSH RBP
- MOV RBP,RSP
- MOV RDX,U64 SF_ARG1[RBP]
- MOV RAX,U64 SF_ARG2[RBP]
- XCHG U64 [RDX],RAX
- POP RBP
- RET1 16
-_XCHG_U32::
- PUSH RBP
- MOV RBP,RSP
- MOV RDX,U64 SF_ARG1[RBP]
- MOV EAX,U32 SF_ARG2[RBP]
- XCHG U32 [RDX],EAX
- POP RBP
- RET1 16
-_XCHG_U16::
- PUSH RBP
- MOV RBP,RSP
- MOV RDX,U64 SF_ARG1[RBP]
- MOVZX RAX,U16 SF_ARG2[RBP]
- XCHG U16 [RDX],AX
- POP RBP
- RET1 16
-_XCHG_U8::
- PUSH RBP
- MOV RBP,RSP
- MOV RDX,U64 SF_ARG1[RBP]
- MOVZX RAX,U8 SF_ARG2[RBP]
- XCHG U8 [RDX],AL
- POP RBP
- RET1 16
-
-_LXCHG_I64::
- PUSH RBP
- MOV RBP,RSP
- MOV RDX,U64 SF_ARG1[RBP]
- MOV RAX,U64 SF_ARG2[RBP]
- LOCK
- XCHG U64 [RDX],RAX
- POP RBP
- RET1 16
-_LXCHG_U32::
- PUSH RBP
- MOV RBP,RSP
- MOV RDX,U64 SF_ARG1[RBP]
- MOV EAX,U32 SF_ARG2[RBP]
- LOCK
- XCHG U32 [RDX],EAX
- POP RBP
- RET1 16
-_LXCHG_U16::
- PUSH RBP
- MOV RBP,RSP
- MOV RDX,U64 SF_ARG1[RBP]
- MOVZX RAX,U16 SF_ARG2[RBP]
- LOCK
- XCHG U16 [RDX],AX
- POP RBP
- RET1 16
-_LXCHG_U8::
- PUSH RBP
- MOV RBP,RSP
- MOV RDX,U64 SF_ARG1[RBP]
- MOVZX RAX,U8 SF_ARG2[RBP]
- LOCK
- XCHG U8 [RDX],AL
- POP RBP
- RET1 16
-_REP_IN_U32::
- PUSH RBP
- MOV RBP,RSP
- PUSH RDI
- MOV RDI,U64 SF_ARG1[RBP]
- MOV RDX,U64 SF_ARG3[RBP]
- MOV RCX,U64 SF_ARG2[RBP]
- REP_INSD
- POP RDI
- POP RBP
- RET1 24
-_REP_IN_U16::
- PUSH RBP
- MOV RBP,RSP
- PUSH RDI
- MOV RDI,U64 SF_ARG1[RBP]
- MOV RDX,U64 SF_ARG3[RBP]
- MOV RCX,U64 SF_ARG2[RBP]
- REP_INSW
- POP RDI
- POP RBP
- RET1 24
-_REP_IN_U8::
- PUSH RBP
- MOV RBP,RSP
- PUSH RDI
- MOV RDI,U64 SF_ARG1[RBP]
- MOV RDX,U64 SF_ARG3[RBP]
- MOV RCX,U64 SF_ARG2[RBP]
- REP_INSB
- POP RDI
- POP RBP
- RET1 24
-_REP_OUT_U32::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- MOV RSI,U64 SF_ARG1[RBP]
- MOV RDX,U64 SF_ARG3[RBP]
- MOV RCX,U64 SF_ARG2[RBP]
- REP_OUTSD
- POP RSI
- POP RBP
- RET1 24
-_REP_OUT_U16::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- MOV RSI,U64 SF_ARG1[RBP]
- MOV RDX,U64 SF_ARG3[RBP]
- MOV RCX,U64 SF_ARG2[RBP]
- REP_OUTSW
- POP RSI
- POP RBP
- RET1 24
-_REP_OUT_U8::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- MOV RSI,U64 SF_ARG1[RBP]
- MOV RDX,U64 SF_ARG3[RBP]
- MOV RCX,U64 SF_ARG2[RBP]
- REP_OUTSB
- POP RSI
- POP RBP
- RET1 24
-_CPUID::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- MOV RAX,U64 SF_ARG1[RBP]
- CPUID
- MOV RSI,U64 SF_ARG2[RBP]
- MOV U64 [RSI],RAX
- MOV U64 8[RSI],RBX
- MOV U64 16[RSI],RCX
- MOV U64 24[RSI],RDX
- POP RSI
- POP RBP
- RET1 16
-_CALL_IND:: //See _LAST_FUN
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
- MOV RDX,U64 SF_ARG1[RBP]
- MOV RCX,U64 SF_ARG2[RBP] //argc
- LEA RSI,U64 SF_ARG3[RBP] //argv
- SHL RCX,3
- SUB RSP,RCX
- MOV RDI,RSP
- REP_MOVSB
- TEST RDX,RDX
- JZ @@05
-
- CALL RDX
- POP RDI
- POP RSI
- POP RBP
- RET
-
-@@05: MOV RCX,U64 SF_ARG2[RBP] //argc
- SHL RCX,3
- ADD RSP,RCX
- XOR RAX,RAX
- POP RDI
- POP RSI
- POP RBP
- RET
-_CALLEXTNUM::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
- MOV RDX,U64 SF_ARG1[RBP]
- MOV RCX,U64 SF_ARG2[RBP] //argc
- LEA RSI,U64 SF_ARG3[RBP] //argv
- SHL RCX,3
- SUB RSP,RCX
- MOV RDI,RSP
- REP_MOVSB
- MOV RAX,U64 [SYS_EXTERN_TABLE]
- MOV RAX,U64 [RAX+RDX*8]
- TEST RAX,RAX
- JZ @@05
-
- CALL RAX
- POP RDI
- POP RSI
- POP RBP
- RET
-
-@@05: MOV RCX,U64 SF_ARG2[RBP] //argc
- SHL RCX,3
- ADD RSP,RCX
- POP RDI
- POP RSI
- POP RBP
- RET
-_CALLEXTSTR::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
- MOV RCX,U64 SF_ARG2[RBP] //argc
- LEA RSI,U64 SF_ARG3[RBP] //argv
- SHL RCX,3
- SUB RSP,RCX
- MOV RDI,RSP
- REP_MOVSB
- MOV RSI,U64 SF_ARG1[RBP]
-
- MOV RCX,1
- XOR RAX,RAX
- MOV RDI,U64 FS:CTask.hash_table[RAX]
- MOV RBX,HTT_FUN|HTT_EXPORT_SYS_SYM
- CALL SYS_HASH_FIND
- JZ @@15
-
- TEST U32 CHash.type[RAX],HTT_FUN
- JZ @@05
- MOV RAX,U64 CHashFun.exe_addr[RAX]
- JMP @@10
-@@05: MOV RAX,U64 CHashExport.val[RAX]
-@@10: TEST RAX,RAX
- JZ @@15
-
- CALL RAX
- POP RDI
- POP RSI
- POP RBP
- RET
-
-@@15: MOV RCX,U64 SF_ARG2[RBP] //argc
- SHL RCX,3
- ADD RSP,RCX
- POP RDI
- POP RSI
- POP RBP
- RET
-SET_GS_BASE::
- PUSH RAX
- PUSH RCX
- PUSH RDX
- MOV RDX,RAX
- SHR RDX,32
- MOV ECX,IA32_GS_BASE
- WRMSR
- POP RDX
- POP RCX
- POP RAX
- RET
-SET_FS_BASE::
- PUSH RAX
- PUSH RCX
- PUSH RDX
- MOV RDX,RAX
- SHR RDX,32
- MOV ECX,IA32_FS_BASE
- WRMSR
- POP RDX
- POP RCX
- POP RAX
-_RET::
- RET
-_SET_MSR::
- PUSH RBP
- MOV RBP,RSP
- MOV RAX,SF_ARG2[RBP]
- MOV RDX,RAX
- SHR RDX,32
- MOV RCX,SF_ARG1[RBP]
- WRMSR
- POP RBP
- RET1 16
-_SYS_HLT::
- CLI
-@@05: HLT
- JMP @@05
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/KeyDev.HC.HTML b/public/src/Kernel/KeyDev.HC.HTML deleted file mode 100644 index dd5da96..0000000 --- a/public/src/Kernel/KeyDev.HC.HTML +++ /dev/null @@ -1,231 +0,0 @@ - - - - - KeyDev.HC - - - - - U0 PutKey(I64 ch=0,I64 sc=0)
-{//See Keyboard Devices.
- CKeyDevEntry *tmpk;
- if (ch||sc) {
- tmpk=keydev.put_key_head.next;
- if (!Bt(&Fs->display_flags,DISPLAYf_SILENT)) {
- if (kbd.scan_code & SCF_SCROLL && sys_focus_task==Fs)
- while (kbd.scan_code & SCF_SCROLL)
- Yield; //Wait on SCROLL LOCK Key
- while (tmpk!=&keydev.put_key_head) {
- if ((!(sc&SCF_KEY_DESC) || tmpk->flags & KDF_HAS_DESCS) &&
- (*tmpk->put_key)(ch,sc))
- break;
- tmpk=tmpk->next;
- }
- }
- }
-}
-
-U0 PutChars(U64 ch)
-{//Output chars. Up to 8 chars in a single U64.
-//Don't use this. See Print() shortcut.
- while (ch) {
- PutKey(ch&255,0);
- ch>>=8;
- }
-}
-
-U0 PutS(U8 *st)
-{//Use Print(). See Keyboard Devices.
-//Don't use this. See Print() shortcut.
- I64 ch;
- U8 *ptr;
- Bool cont=TRUE;
- if (!st) return;
- CKeyDevEntry *tmpk=keydev.put_key_head.next;
- if (!Bt(&Fs->display_flags,DISPLAYf_SILENT)) {
- if (kbd.scan_code & SCF_SCROLL && sys_focus_task==Fs)
- while (kbd.scan_code & SCF_SCROLL)
- Yield;
- while (cont && tmpk!=&keydev.put_key_head) {
- if (tmpk->put_s) {
- if ((*tmpk->put_s)(st))
- break;
- } else {
- ptr=st;
- while (ch=*ptr++)
- if ((*tmpk->put_key)(ch,0))
- cont=FALSE;
- }
- tmpk=tmpk->next;
- }
- }
-}
-
-U0 KeyDescSet(U8 *fmt,...)
-{//Call this from key hndlr to report desc in KeyMap().
- U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
- StrCpy(keydev.desc,buf);
- keydev.hndlr=Caller;
- Free(buf);
-}
-
-U0 KeyDevRem(CKeyDevEntry *tmpk)
-{//Remove StdOut hook and free.
- QueRem(tmpk);
- Free(tmpk);
-}
-
-CKeyDevEntry *KeyDevAdd(Bool (*fp_put_key)(I64 ch,I64 sc),
- Bool (*fp_puts)(U8 *st),I64 priority,Bool key_descs=FALSE)
-{//Places hook in StdOut chain. See Keyboard Devices.
- CKeyDevEntry *tmpk=keydev.put_key_head.last,
- *tmpk1=ACAlloc(sizeof(CKeyDevEntry));
- tmpk1->put_key=fp_put_key;
- tmpk1->put_s=fp_puts;
- tmpk1->priority=priority;
- if (key_descs)
- tmpk1->flags|=KDF_HAS_DESCS;
- while (tmpk->priority>priority)
- tmpk=tmpk->last;
- QueIns(tmpk1,tmpk);
- if (tmpk->priority==priority)
- KeyDevRem(tmpk);
- return tmpk1;
-}
-
-Bool KDRawPutKey(I64 ch,I64)
-{
- if (IsRaw) {
- RawPutChar(ch);
- return TRUE;
- } else
- return FALSE;
-}
-
-Bool KDRawPutS(U8 *st)
-{
- I64 ch;
- if (IsRaw) {
- while (ch=*st++)
- RawPutChar(ch);
- return TRUE;
- } else
- return FALSE;
-}
-
-Bool KDInputFilterPutKey(I64 ch,I64 scan_code)
-{
- if (Bt(&Fs->task_flags,TASKf_INPUT_FILTER_TASK)) {
- Msg(MSG_KEY_DOWN,ch,scan_code);
- return TRUE;
- } else
- return FALSE;
-}
-
-Bool KDInputFilterPutS(U8 *st)
-{
- I64 ch;
- if (Bt(&Fs->task_flags,TASKf_INPUT_FILTER_TASK)) {
- while (ch=*st++)
- Msg(MSG_KEY_DOWN,ch,0);
- return TRUE;
- } else
- return FALSE;
-}
-
-U0 CtrlAltDel(I64)
-{
- LBts(sys_ctrl_alt_flags,CTRL_ALT_DEL);
-}
-
-U0 CtrlAltC(I64)
-{
- LBts(sys_ctrl_alt_flags,CTRL_ALT_C);
-}
-
-U0 CtrlAltD(I64)
-{
- if (!IsDbgMode) {
- if (Fs==Gs->idle_task)
- BptS(sys_winmgr_task->rip,sys_winmgr_task);
- else
- BptS(*keydev.ctrl_alt_ret_addr);
- }
-}
-
-U0 CtrlAltF(I64)
-{
- SwapI64(&text.font,&text.aux_font);
-}
-
-U0 CtrlAltM(I64)
-{
- Mute(!IsMute);
-}
-
-U0 CtrlAltN(I64)
-{
- LBts(sys_ctrl_alt_flags,CTRL_ALT_TAB);
-}
-
-U0 CtrlAltT(I64)
-{
- User;
-}
-
-U0 CtrlAltV(I64)
-{
- VGAFlush;
-}
-
-U0 CtrlAltX(I64)
-{
- LBts(sys_ctrl_alt_flags,CTRL_ALT_X);
-}
-
-U0 CtrlAltCBSet(U8 ch,U0 (*fp_hndlr)(I64 sc),
- U8 *no_shift_desc=NULL,U8 *shift_desc=NULL,Bool in_irq=FALSE)
-{//Set callback for <CTRL-ALT-letter>.
- ch=ToUpper(ch)-'A';
- if (ch<26) {
- keydev.fp_ctrl_alt_cbs[ch]=fp_hndlr;
-
- Free(keydev.ctrl_alt_no_shift_descs[ch]);
- if (no_shift_desc)
- keydev.ctrl_alt_no_shift_descs[ch]=AStrNew(no_shift_desc);
- else
- keydev.ctrl_alt_no_shift_descs[ch]=NULL;
-
- Free(keydev.ctrl_alt_shift_descs[ch]);
- if (shift_desc)
- keydev.ctrl_alt_shift_descs[ch]=AStrNew(shift_desc);
- else
- keydev.ctrl_alt_shift_descs[ch]=NULL;
-
- BEqu(&keydev.ctrl_alt_in_irq_flags,ch,in_irq);
- }
-}
-
-U0 KeyDevInit()
-{
- keydev.fp_ctrl_alt_cbs =CAlloc(26*sizeof(U8 *));
- keydev.ctrl_alt_no_shift_descs=CAlloc(26*sizeof(U8 *));
- keydev.ctrl_alt_shift_descs =CAlloc(26*sizeof(U8 *));
- keydev.ctrl_alt_in_irq_flags =0;
- MemSet(&keydev.put_key_head,0,sizeof(CKeyDevEntry));
- QueInit(&keydev.put_key_head);
- KeyDevAdd(&KDInputFilterPutKey,&KDInputFilterPutS,0x40000000,FALSE);
- KeyDevAdd(&KDRawPutKey,&KDRawPutS,0x60000000,FALSE);
- CtrlAltCBSet('C',&CtrlAltC,"Cmd/Break Execution",,TRUE);
- CtrlAltCBSet('D',&CtrlAltD,"Cmd/Enter Debugger",,TRUE);
- CtrlAltCBSet('F',&CtrlAltF,"Cmd/Toggle Aux Font");
- CtrlAltCBSet('M',&CtrlAltM,"Cmd/Toggle Mute");
- CtrlAltCBSet('N',&CtrlAltN,"Cmd/Next Focus Task",,TRUE);
- CtrlAltCBSet('T',&CtrlAltT,"Cmd/Terminal Window");
- CtrlAltCBSet('V',&CtrlAltV,"Cmd/VGA Flush",,TRUE);
- CtrlAltCBSet('X',&CtrlAltX,"Cmd/Kill Focused Task",,TRUE);
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/Mem/BlkPool.HC.HTML b/public/src/Kernel/Mem/BlkPool.HC.HTML deleted file mode 100644 index 7aa7780..0000000 --- a/public/src/Kernel/Mem/BlkPool.HC.HTML +++ /dev/null @@ -1,85 +0,0 @@ - - - - - BlkPool.HC - - - - - U0 BlkPoolAdd(CBlkPool *bp,CMemBlk *m,I64 pags)
-{//Add mem to BlkPool.
- if (sys_mem_init_flag)
- MemSet(m,sys_mem_init_val,pags*MEM_PAG_SIZE);
- PUSHFD
- CLI
- while (LBts(&bp->locked_flags,BPlf_LOCKED))
- PAUSE
- m->next=bp->mem_free_lst;
- m->pags=pags;
- m->mb_signature=MBS_UNUSED_SIGNATURE_VAL;
- bp->alloced_u8s+=pags<<MEM_PAG_BITS;
- bp->mem_free_lst=m;
- LBtr(&bp->locked_flags,BPlf_LOCKED);
- POPFD
-}
-
-U0 BlkPoolInit(CBlkPool *bp,I64 pags)
-{//Make mem chunk into a BlkPool.
- I64 num;
- CMemBlk *m;
- MemSet(bp,0,sizeof(CBlkPool));
- m=(bp(U8 *)+sizeof(CBlkPool)+MEM_PAG_SIZE-1)&~(MEM_PAG_SIZE-1);
- num=(bp(U8 *)+pags<<MEM_PAG_BITS-m(U8 *))>>MEM_PAG_BITS;
- bp->alloced_u8s=(pags-num)<<MEM_PAG_BITS; //Compensate before num added.
- BlkPoolAdd(bp,m,num);
-}
-
-U0 BlkPoolsInit()
-{
- I64 i,total,lo,hi,code_heap_limit;
- CMemE820 *m20=MEM_E820;
- Bool first=TRUE;
-
- total=BIOSTotalMem;
-
- if (total<=0x80000000)
- code_heap_limit=total;
- else if (total<=0x100000000)
- code_heap_limit=total/4;
- else
- code_heap_limit=0x80000000;
-
- i=code_heap_limit-SYS_16MEG_AREA_LIMIT; //See RLf_16MEG_SYS_CODE_BP
- BlkPoolAdd(sys_code_bp,SYS_16MEG_AREA_LIMIT,i>>MEM_PAG_BITS);
- mem_heap_limit=i+SYS_16MEG_AREA_LIMIT-1;
-
- if (code_heap_limit<total) {
- while (m20->type) {
- if (m20->type==1) {
- lo=m20->base;
- hi=m20->base+m20->len;
- if (lo<code_heap_limit) {
- if (hi>code_heap_limit)
- lo=code_heap_limit;
- else
- hi=lo; //cancel
- }
- if (code_heap_limit<=lo<hi) {
- if (first) {
- BlkPoolInit(lo,(hi-lo)>>MEM_PAG_BITS);
- sys_data_bp=lo;
- Fs->data_heap=HeapCtrlInit(,Fs,sys_data_bp);
- first=FALSE;
- } else
- BlkPoolAdd(sys_data_bp,lo,(hi-lo)>>MEM_PAG_BITS);
- }
- }
- m20++;
- }
- }
- LBts(&sys_run_level,RLf_FULL_HEAPS);
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/Mem/HeapCtrl.HC.HTML b/public/src/Kernel/Mem/HeapCtrl.HC.HTML deleted file mode 100644 index 550e443..0000000 --- a/public/src/Kernel/Mem/HeapCtrl.HC.HTML +++ /dev/null @@ -1,45 +0,0 @@ - - - - - HeapCtrl.HC - - - - - CHeapCtrl *HeapCtrlInit(CHeapCtrl *hc=NULL,CTask *task=NULL,CBlkPool *bp)
-{//See HeapLog() for an example.
-//Duplicated for Adam Task.
- if (!hc)
- hc=ACAlloc(sizeof(CHeapCtrl));
- hc->hc_signature=HEAP_CTRL_SIGNATURE_VAL;
- hc->mem_task=task;
- hc->bp=bp;
- QueInit(&hc->next_mem_blk);
- hc->last_mergable=NULL;
- hc->next_um=hc->last_um=(&hc->next_um)(U8 *)-offset(CMemUsed.next);
- return hc;
-}
-
-U0 HeapCtrlDel(CHeapCtrl *hc)
-{//Free all blks alloced to a HeapCtrl.
- CMemBlk *m,*m1;
- if (hc) {
- PUSHFD
- CLI
- while (LBts(&hc->locked_flags,HClf_LOCKED))
- PAUSE
- m=hc->next_mem_blk;
- while (m!=&hc->next_mem_blk) {
- m1=m->next;
- MemPagTaskFree(m,hc);
- m=m1;
- }
- LBtr(&hc->locked_flags,HClf_LOCKED);
- POPFD
- Free(hc);
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/Mem/MAllocFree.HC.HTML b/public/src/Kernel/Mem/MAllocFree.HC.HTML deleted file mode 100644 index f8ce6f8..0000000 --- a/public/src/Kernel/Mem/MAllocFree.HC.HTML +++ /dev/null @@ -1,476 +0,0 @@ - - - - - MAllocFree.HC - - - - - asm {
-//************************************
-//See /Doc/Credits.DD.
-_MALLOC::
-// Throws 'OutMem'
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
-
- XOR RBX,RBX
- MOV RDX,U64 SF_ARG2[RBP]
- TEST RDX,RDX
- JNZ @@05
- MOV RDX,U64 FS:CTask.addr[RBX]
-@@05: CMP U32 CTask.task_signature[RDX],TASK_SIGNATURE_VAL
-
-#assert CTask.task_signature==CHeapCtrl.hc_signature //location signature same
-
- JNE @@10
- MOV RDX,U64 CTask.data_heap[RDX]
-@@10: CMP U32 CHeapCtrl.hc_signature[RDX],HEAP_CTRL_SIGNATURE_VAL
- JE @@15
- PUSH RDX
- CALL &SysBadMAlloc
- JMP I32 _SYS_HLT
-
-@@15: MOV RAX,U64 SF_ARG1[RBP]
- PUSHFD
- ADD RAX,CMemUsed.start+7 //round-up to I64
- AND AL,0xF8
-#assert CMemUsed.start>=sizeof(CMemUnused)
- CMP RAX,CMemUsed.start
- JAE @@20
- MOV RAX,CMemUsed.start
-@@20:
-
- CLI
-@@25: LOCK
- BTS U32 CHeapCtrl.locked_flags[RDX],HClf_LOCKED
- PAUSE //don't know if this inst helps
- JC @@25
-
- CMP RAX,MEM_HEAP_HASH_SIZE
- JAE @@30
- MOV RSI,U64 CHeapCtrl.heap_hash[RAX+RDX]
- TEST RSI,RSI
- JZ @@35
- MOV RCX,U64 CMemUnused.next[RSI]
- MOV U64 CHeapCtrl.heap_hash[RAX+RDX],RCX
- JMP I32 MALLOC_ALMOST_DONE
-
-//Big allocation
-@@30: ADD RAX,sizeof(CMemBlk)+MEM_PAG_SIZE-1
- SHR RAX,MEM_PAG_BITS
-
- PUSH RDX //preserve HeapCtrl
- PUSH RDX
- PUSH RAX
- CALL &MemPagTaskAlloc
- POP RDX
- TEST RAX,RAX
- JZ @@45 //Out of memory
- MOV RSI,RAX
- MOV EAX,U32 CMemBlk.pags[RSI]
-
- SHL RAX,MEM_PAG_BITS
- SUB RAX,sizeof(CMemBlk)
- ADD RSI,sizeof(CMemBlk)
- JMP I32 MALLOC_ALMOST_DONE
-
-//Little allocation, chunk-off piece from free lst chunks
-@@35: LEA RSI,U64 CHeapCtrl.malloc_free_lst-CMemUnused.next[RDX]
-
-@@40: MOV RBX,RSI
- MOV RSI,U64 CMemUnused.next[RBX]
- TEST RSI,RSI
- JNZ I32 @@60
- PUSH RAX //-**** save byte size
- ADD RAX,16*MEM_PAG_SIZE-1
- SHR RAX,MEM_PAG_BITS
-
- PUSH RDX //preserve HeapCtrl
- PUSH RDX
- PUSH RAX
- CALL &MemPagTaskAlloc
- POP RDX
- TEST RAX,RAX
- JNZ @@50
-
-//Out of memory
-@@45: LOCK
- BTR U32 CHeapCtrl.locked_flags[RDX],HClf_LOCKED
- POPFD
- PUSH TRUE
- MOV RAX,'OutMem'
- PUSH RAX
- CALL I32 &throw
- JMP I32 MALLOC_FINAL_EXIT //Never gets here, hopefully.
-
-@@50: MOV RSI,RAX
- MOV EAX,U32 CMemBlk.pags[RSI]
- SHL RAX,MEM_PAG_BITS
-
-//Can it be combined with last chunk? (Never Free these chunks.)
- MOV RDI,U64 CHeapCtrl.last_mergable[RDX]
- LEA RBX,U64 [RSI+RAX]
- CMP RDI,RBX
- JNE @@55
-
- PUSH RAX
- MOV EAX,U32 CMemBlk.pags[RDI]
- ADD U32 CMemBlk.pags[RSI],EAX
-//QueRem
- MOV RAX,U64 CMemBlk.next[RDI]
- MOV RBX,U64 CMemBlk.last[RDI]
- MOV U64 CMemBlk.last[RAX],RBX
- MOV U64 CMemBlk.next[RBX],RAX
- POP RAX
-
-@@55: MOV U64 CHeapCtrl.last_mergable[RDX],RSI
- LEA RSI,U64 sizeof(CMemBlk)[RSI]
- SUB RAX,sizeof(CMemBlk)
- LEA RBX,U64 CHeapCtrl.malloc_free_lst-CMemUnused.next[RDX]
- MOV RDI,U64 CMemUnused.next[RBX]
- MOV U64 CMemUnused.next[RSI],RDI
- MOV U64 CMemUnused.size[RSI],RAX
- MOV U64 CMemUnused.next[RBX],RSI
- POP RAX //+****
- JMP @@70
-@@60: CMP U64 CMemUnused.size[RSI],RAX
- JB I32 @@40
- JNE @@70
-
-@@65: MOV RDI,U64 CMemUnused.next[RSI]
- MOV U64 CMemUnused.next[RBX],RDI
- JMP MALLOC_ALMOST_DONE
-
-@@70: SUB U64 CMemUnused.size[RSI],RAX //UPDATE FREE ENTRY
- CMP U64 CMemUnused.size[RSI],sizeof(CMemUnused)
- JAE @@75 //take from top of block
- ADD U64 CMemUnused.size[RSI],RAX //doesn't fit, undo
- JMP I32 @@40
-
-@@75: ADD RSI,U64 CMemUnused.size[RSI]
-
-MALLOC_ALMOST_DONE:
-//RSI=res-CMemUsed.size
-//RAX=size+CMemUsed.size
-//RDX=HeapCtrl
- ADD U64 CHeapCtrl.used_u8s[RDX],RAX
-
-#if _CFG_HEAP_DBG
-//QueIns
- MOV RDI,U64 CHeapCtrl.last_um[RDX]
- MOV U64 CMemUsed.next[RDI],RSI
- MOV U64 CHeapCtrl.last_um[RDX],RSI
- MOV U64 CMemUsed.last[RSI],RDI
- LEA RDI,U64 CHeapCtrl.next_um-CMemUsed.next[RDX]
- MOV U64 CMemUsed.next[RSI],RDI
-
-//Caller1/Caller2
- PUSH RDX
- MOV RDX,U64 [MEM_HEAP_LIMIT]
- MOV RDI,U64 SF_RIP[RBP]
- CMP RDI,RDX
- JB @@80
- XOR RDI,RDI
- MOV U64 CMemUsed.caller1[RSI],RDI
- JMP @@90
-@@80: MOV U64 CMemUsed.caller1[RSI],RDI
- MOV RDI,U64 SF_RBP[RBP]
- CMP RDI,RDX
- JB @@85
- XOR RDI,RDI
- JMP @@90
-@@85: MOV RDI,U64 SF_RIP[RDI]
- CMP RDI,RDX
- JB @@90
- XOR RDI,RDI
-@@90: MOV U64 CMemUsed.caller2[RSI],RDI
- POP RDX
-
-#endif
- LOCK
- BTR U32 CHeapCtrl.locked_flags[RDX],HClf_LOCKED
- POPFD
-
- MOV U64 CMemUsed.size[RSI],RAX
- MOV U64 CMemUsed.hc[RSI],RDX
- LEA RAX,U64 CMemUsed.start[RSI]
-
- TEST U8 [SYS_SEMAS+SEMA_HEAPLOG_ACTIVE*DFT_CACHE_LINE_WIDTH],1
- JZ @@105
- PUSH RAX
- PUSH RAX
- MOV RAX,U64 [SYS_EXTERN_TABLE]
- MOV RAX,U64 EXT_HEAPLOG_MALLOC*8[RAX]
- TEST RAX,RAX
- JZ @@95
- CALL RAX
- JMP @@100
-@@95: ADD RSP,8
-@@100: POP RAX
-
-@@105: TEST U8 [SYS_HEAP_INIT_FLAG],1
- JZ MALLOC_FINAL_EXIT
-
- PUSH RAX
- MOV RCX,U64 CMemUsed.size-CMemUsed.start[RAX]
- SUB RCX,CMemUsed.start
- MOV RDI,RAX
- MOV AL,U8 [SYS_HEAP_INIT_VAL]
- REP_STOSB
- POP RAX
-
-MALLOC_FINAL_EXIT:
- POP RDI
- POP RSI
- POP RBP
- RET1 16
-//************************************
-_FREE::
-//Be aware of heap_hash in MemPagTaskAlloc().
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
-
- TEST U8 [SYS_SEMAS+SEMA_HEAPLOG_ACTIVE*DFT_CACHE_LINE_WIDTH],1
- JZ @@15
- MOV RBX,U64 SF_ARG1[RBP]
- TEST RBX,RBX
- JZ @@05
- MOV RAX,U64 CMemUsed.size-CMemUsed.start[RBX]
- TEST RAX,RAX
- JGE @@05 //Aligned alloced chunks have neg size
- ADD RBX,RAX
-@@05: PUSH RBX
- MOV RAX,U64 [SYS_EXTERN_TABLE]
- MOV RAX,U64 EXT_HEAPLOG_FREE*8[RAX]
- TEST RAX,RAX
- JZ @@10
- CALL RAX
- JMP @@15
-@@10: ADD RSP,8
-
-@@15: MOV RSI,U64 SF_ARG1[RBP]
- TEST RSI,RSI
-
-#if _CFG_HEAP_DBG
- JZ I32 FREE_DONE
-#else
- JZ FREE_DONE
-#endif
-
- MOV RAX,U64 CMemUsed.size-CMemUsed.start[RSI]
- TEST RAX,RAX
- JGE @@20 //Aligned alloced chunks have neg size.
- //The neg size is offset to start of CMemUsed struct.
- ADD RSI,RAX
-
-@@20: PUSHFD
- SUB RSI,CMemUsed.start
- MOV RDX,U64 CMemUsed.hc[RSI]
- CMP U32 CHeapCtrl.hc_signature[RDX],HEAP_CTRL_SIGNATURE_VAL
- JE @@25
- ADD RSI,CMemUsed.start
- PUSH RSI
- CALL &SysBadFree
- JMP I32 _SYS_HLT
-
-@@25: MOV RAX,U64 CMemUsed.size[RSI]
- SUB U64 CHeapCtrl.used_u8s[RDX],RAX
- CLI
-@@30: LOCK
- BTS U32 CHeapCtrl.locked_flags[RDX],HClf_LOCKED
- PAUSE
- JC @@30
-#if _CFG_HEAP_DBG
-//QueRem
- MOV RDX,U64 CMemUsed.next[RSI]
- MOV RDI,U64 CMemUsed.last[RSI]
- MOV U64 CMemUsed.last[RDX],RDI
- MOV U64 CMemUsed.next[RDI],RDX
-
-//Caller1/Caller2
- MOV RDX,U64 [MEM_HEAP_LIMIT]
- MOV RDI,U64 SF_RIP[RBP]
- CMP RDI,RDX
- JB @@35
- XOR RDI,RDI
- MOV U64 CMemUnused.caller1[RSI],RDI
- JMP @@45
-@@35: MOV U64 CMemUnused.caller1[RSI],RDI
- MOV RDI,U64 SF_RBP[RBP]
- CMP RDI,RDX
- JB @@40
- XOR RDI,RDI
- JMP @@45
-@@40: MOV RDI,U64 SF_RIP[RDI]
- CMP RDI,RDX
- JB @@45
- XOR RDI,RDI
-@@45: MOV U64 CMemUnused.caller2[RSI],RDI
-
- MOV RDX,U64 CMemUsed.hc[RSI]
-#endif
- CMP RAX,MEM_HEAP_HASH_SIZE
- JAE @@50
-
-#assert CMemUnused.size==CMemUsed.size
-// MOV U64 CMemUnused.size[RSI],RAX
-
- MOV RBX,U64 CHeapCtrl.heap_hash[RAX+RDX]
- MOV U64 CMemUnused.next[RSI],RBX
- MOV U64 CHeapCtrl.heap_hash[RAX+RDX],RSI
- JMP @@55
-
-@@50: SUB RSI,sizeof(CMemBlk)
- PUSH RDX
- PUSH RDX
- PUSH RSI
- CALL &MemPagTaskFree
- POP RDX
-
-@@55: LOCK
- BTR U32 CHeapCtrl.locked_flags[RDX],HClf_LOCKED
- POPFD
-FREE_DONE:
- POP RDI
- POP RSI
- POP RBP
- RET1 8
-//************************************
-_MSIZE::
- PUSH RBP
- MOV RBP,RSP
- MOV RBX,U64 SF_ARG1[RBP]
- XOR RAX,RAX
- TEST RBX,RBX
- JZ @@10
- MOV RAX,U64 CMemUsed.size-CMemUsed.start[RBX]
- TEST RAX,RAX
- JGE @@05 //Aligned alloced chunks have neg size
- ADD RBX,RAX
- MOV RAX,U64 CMemUsed.size-CMemUsed.start[RBX]
-@@05: SUB RAX,CMemUsed.start
-@@10: POP RBP
- RET1 8
-//************************************
-_MSIZE2::
- PUSH RBP
- MOV RBP,RSP
- MOV RBX,U64 SF_ARG1[RBP]
- XOR RAX,RAX
- TEST RBX,RBX
- JZ @@10
- MOV RAX,U64 CMemUsed.size-CMemUsed.start[RBX]
- TEST RAX,RAX
- JGE @@05 //Aligned alloced chunks have neg size
- ADD RBX,RAX
-@@05: MOV RAX,U64 CMemUsed.size-CMemUsed.start[RBX]
-@@10: POP RBP
- RET1 8
-//************************************
-_MHEAP_CTRL::
- PUSH RBP
- MOV RBP,RSP
- MOV RBX,U64 SF_ARG1[RBP]
- XOR RAX,RAX
- TEST RBX,RBX
- JZ @@10
- MOV RAX,U64 CMemUsed.size-CMemUsed.start[RBX]
- TEST RAX,RAX
- JGE @@05 //Aligned alloced chunks have neg size
- ADD RBX,RAX
-@@05: MOV RAX,U64 CMemUsed.hc-CMemUsed.start[RBX]
-@@10: POP RBP
- RET1 8
-}
-
-_extern _FREE U0 Free(U8 *addr); //Free MAlloc()ed memory chunk.
-_extern _MSIZE I64 MSize(U8 *src); //Size of heap object.
-_extern _MSIZE2 I64 MSize2(U8 *src); //Internal size of heap object.
-_extern _MHEAP_CTRL CHeapCtrl *MHeapCtrl(U8 *src); //CHeapCtrl of object.
-_extern _MALLOC U8 *MAlloc(I64 size,CTask *mem_task=NULL); //Alloc memory chunk.
-//Accepts a CTask or CHeapCtrl. NULL allocs off current task's heap.
-
-U8 *AMAlloc(I64 size)
-{//Alloc memory in Adam's heap.
- return MAlloc(size,adam_task);
-}
-
-U8 *CAlloc(I64 size,CTask *mem_task=NULL)
-{//Accepts a CTask or CHeapCtrl.NULL allocs off current task's heap.
- U8 *res=MAlloc(size,mem_task);
- MemSet(res,0,size);
- return res;
-}
-
-U8 *ACAlloc(I64 size)
-{//Alloc and set to zero memory in Adam's heap.
- return CAlloc(size,adam_task);
-}
-
-U8 *MAllocIdent(U8 *src,CTask *mem_task=NULL)
-{//Accepts a CTask or CHeapCtrl.NULL allocs off current task's heap.
- U8 *res;
- I64 size;
- if (!src) return NULL;
- size=MSize(src);
- res=MAlloc(size,mem_task);
- MemCpy(res,src,size);
- return res;
-}
-
-U8 *AMAllocIdent(U8 *src)
-{//Alloc in Adam's heap, ident copy of heap node.
- return MAllocIdent(src,adam_task);
-}
-
-U8 *MAllocAligned(I64 size,I64 alignment,
- CTask *mem_task=NULL,I64 misalignment=0)
-{//Only powers of two alignment. This is awful.
- I64 mask=alignment-1;
- U8 *ptr=MAlloc(size+mask+sizeof(I64)+misalignment,mem_task),
- *res=(ptr+sizeof(I64)+mask)&~mask+misalignment;
- res(I64 *)[-1]=ptr-res;
-#assert offset(CMemUsed.size)==offset(CMemUsed.start)-sizeof(I64)
- return res;
-}
-
-U8 *CAllocAligned(I64 size,I64 alignment,
- CTask *mem_task=NULL,I64 misalignment=0)
-{//Only powers of two alignment. This is awful.
- I64 mask=alignment-1;
- U8 *ptr=MAlloc(size+mask+sizeof(I64)+misalignment,mem_task),
- *res=(ptr+sizeof(I64)+mask)&~mask+misalignment;
- res(I64 *)[-1]=ptr-res;
-#assert offset(CMemUsed.size)==offset(CMemUsed.start)-sizeof(I64)
- MemSet(res,0,size);
- return res;
-}
-
-U8 *StrNew(U8 *buf,CTask *mem_task=NULL)
-{//Accepts a CTask or CHeapCtrl.NULL allocs off current task's heap.
- U8 *res;
- I64 size;
- if (buf) {
- size=StrLen(buf)+1;
- res=MAlloc(size,mem_task);
- MemCpy(res,buf,size);
- } else {
- res=MAlloc(1,mem_task);
- *res=0;
- }
- return res;
-}
-
-U8 *AStrNew(U8 *buf)
-{//Alloc copy of string in Adam's heap.
- return StrNew(buf,adam_task);
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/Mem/MakeMem.HC.HTML b/public/src/Kernel/Mem/MakeMem.HC.HTML deleted file mode 100644 index ea16cc2..0000000 --- a/public/src/Kernel/Mem/MakeMem.HC.HTML +++ /dev/null @@ -1,20 +0,0 @@ - - - - - MakeMem.HC - - - - - #exe {Cd(__DIR__);};
-#include "PageTables"
-#include "MemPag"
-#include "BlkPool"
-#include "MAllocFree"
-#include "HeapCtrl"
-#include "MemPhysical"
-#exe {Cd("..");};
- - - \ No newline at end of file diff --git a/public/src/Kernel/Mem/MemPag.HC.HTML b/public/src/Kernel/Mem/MemPag.HC.HTML deleted file mode 100644 index 86816a7..0000000 --- a/public/src/Kernel/Mem/MemPag.HC.HTML +++ /dev/null @@ -1,179 +0,0 @@ - - - - - MemPag.HC - - - - - U0 SysBadFree(I64 *ptr)
-{
- Panic("Bad Free:",ptr);
-}
-
-U0 SysBadMAlloc(I64 *ptr)
-{
- Panic("Bad MAlloc:",ptr);
-}
-
-U8 *MemPagAlloc(I64 pags,CBlkPool *bp=NULL)
-{/*Alloc pags from BlkPool. Don't link to task.
-(Linking to a task means they will be freed when the task dies.)
-It might give you more than you asked for.
-
-Return: NULL if out of memory.
-*/
- CMemBlk *res=NULL,*m;
- I64 i;
- if (!bp) bp=sys_code_bp;
- PUSHFD
- CLI
- while (LBts(&bp->locked_flags,BPlf_LOCKED))
- PAUSE
- if (pags<MEM_FREE_PAG_HASH_SIZE) {
- if (res=bp->free_pag_hash[pags]) {
- bp->free_pag_hash[pags]=res->next;
- goto at_done;
- }
- i=Bsr(MEM_FREE_PAG_HASH_SIZE)+1;
- } else {
-//We'll now round-up to a power of two.
- //There is some overhead on allocations and
- //we wouldn't want to round to the next
- //power of two if a power of two was requested.
- //So we use a little more than a power of two.
- pags-=MEM_EXTRA_HASH2_PAGS;
- i=Bsr(pags)+1;
- pags=1<<i+MEM_EXTRA_HASH2_PAGS;
- if (res=bp->free_pag_hash2[i]) {
- bp->free_pag_hash2[i]=res->next;
- goto at_done;
- }
- }
- m=&bp->mem_free_lst;
- while (TRUE) {
- if (!(res=m->next)) {
-//We're probably out of luck, but lets search for a
- //freed larger size block... and, screw-it, return the whole thing.
- do {
- if (res=bp->free_pag_hash2[++i]) {
- pags=1<<i+MEM_EXTRA_HASH2_PAGS;
- bp->free_pag_hash2[i]=res->next;
- goto at_done;
- }
- } while (i<64-MEM_PAG_BITS-1);
- pags=0;
- res=NULL; //Out of memory
- goto at_done2;
- }
- if (res->pags<pags)
- m=res;
- else {
- if (res->pags==pags) {
- m->next=res->next;
- goto at_done;
- } else {
- res->pags-=pags;
- res(U8 *)+=res->pags<<MEM_PAG_BITS;
- res->pags=pags;
- goto at_done;
- }
- }
- }
-at_done:
- bp->used_u8s+=res->pags<<MEM_PAG_BITS;
-at_done2:
- LBtr(&bp->locked_flags,BPlf_LOCKED);
- POPFD
- return res;
-}
-
-U0 MemPagFree(CMemBlk *m,CBlkPool *bp=NULL)
-{//Return non-task pags to BlkPool.
- I64 i,pags;
- if (m) {
- if (!bp) bp=sys_code_bp;
- PUSHFD
- CLI
- while (LBts(&bp->locked_flags,BPlf_LOCKED))
- PAUSE
- pags=m->pags;
- m->mb_signature=MBS_UNUSED_SIGNATURE_VAL;
- bp->used_u8s-=pags<<MEM_PAG_BITS;
- if (pags<MEM_FREE_PAG_HASH_SIZE) {
- m->next=bp->free_pag_hash[pags];
- bp->free_pag_hash[pags]=m;
- } else {
-//We'll now round-up to a power of two.
- //There is some overhead on allocations and
- //we wouldn't want to round to the next
- //power of two if a power of two was requested.
- //So we use a little more than a power of two.
- pags-=MEM_EXTRA_HASH2_PAGS;
- i=Bsr(pags);
- m->next=bp->free_pag_hash2[i];
- bp->free_pag_hash2[i]=m;
- }
- LBtr(&bp->locked_flags,BPlf_LOCKED);
- POPFD
- }
-}
-
-CMemBlk *MemPagTaskAlloc(I64 pags,CHeapCtrl *hc)
-{/*hc must be locked. Don't preempt this routine.
-Currently, this is only called from MAlloc().
-Return: NULL if out of memory.
-*/
- CMemBlk *res;
- I64 threshold,cnt,size;
- CMemUnused *uum,**_uum,**_ptr;
- if (res=MemPagAlloc(pags,hc->bp)) {
- QueIns(res,hc->last_mem_blk);
- res->mb_signature=MBS_USED_SIGNATURE_VAL;
- hc->alloced_u8s+=res->pags<<MEM_PAG_BITS;
-
- //Tidy-up free lst (Move into heap hash)
- //because if free lst gets long, delay causes crash.
- threshold=MEM_HEAP_HASH_SIZE>>4;
-#assert MEM_HEAP_HASH_SIZE>>4>=sizeof(U8 *)
- do {
- cnt=0;
- _uum=&hc->malloc_free_lst;
- while (uum=*_uum) {
-#assert !offset(CMemUnused.next)
- size=uum->size;
- if (size<threshold) {
- *_uum=uum->next;
- _ptr=(&hc->heap_hash)(U8 *)+size;
- uum->next=*_ptr;
- *_ptr=uum;
- } else {
- cnt++;
- _uum=uum;
- }
- }
- threshold<<=1;
- } while (cnt>8 && threshold<=MEM_HEAP_HASH_SIZE);
- }
- return res;
-}
-
-U0 MemPagTaskFree(CMemBlk *m,CHeapCtrl *hc)
-{//hc must be locked
- if (m) {
- PUSHFD
- CLI
- if (m->mb_signature!=MBS_USED_SIGNATURE_VAL)
- SysBadFree(m);
- else {
- QueRem(m);
- hc->alloced_u8s-=m->pags<<MEM_PAG_BITS;
- MemPagFree(m,hc->bp);
- }
- POPFD
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/Mem/MemPhysical.HC.HTML b/public/src/Kernel/Mem/MemPhysical.HC.HTML deleted file mode 100644 index 9503e4e..0000000 --- a/public/src/Kernel/Mem/MemPhysical.HC.HTML +++ /dev/null @@ -1,193 +0,0 @@ - - - - - MemPhysical.HC - - - - - Bool Mem32DevIns(CMemRange *tmpmr)
-{
- CMemRange *tmpmr1=dev.mem32_head.next,*tmpmr2;
- while (tmpmr1!=&dev.mem32_head) {
- if (!tmpmr1->type && tmpmr->base>=tmpmr1->base &&
- tmpmr->base+tmpmr->size<=tmpmr1->base+tmpmr1->size) {
- if (tmpmr->base>tmpmr1->base) {
- tmpmr2=AMAlloc(sizeof(CMemRange));
- tmpmr2->type=MRT_UNUSED;
- tmpmr2->flags=0;
- tmpmr2->base=tmpmr1->base;
- tmpmr2->size=tmpmr->base-tmpmr1->base;
- QueInsRev(tmpmr2,tmpmr1);
- }
- QueInsRev(tmpmr,tmpmr1);
- tmpmr1->size=tmpmr1->base+tmpmr1->size-
- (tmpmr->base+tmpmr->size);
- tmpmr1->base=tmpmr->base+tmpmr->size;
- if (!tmpmr1->size) {
- QueRem(tmpmr1);
- Free(tmpmr1);
- }
- return TRUE;
- }
- tmpmr1=tmpmr1->next;
- }
- return FALSE;
-}
-
-U0 Mem32DevInit()
-{
- CMemRange *tmpmr;
- CMemE820 *m20=MEM_E820;
-
- QueInit(&dev.mem32_head);
- tmpmr=AMAlloc(sizeof(CMemRange));
- tmpmr->type=MRT_UNUSED;
- tmpmr->flags=0;
-//Maybe !!! Change this to 0xF0000000 !!!
- tmpmr->base=0xE0000000;
- tmpmr->size=0x10000000;
- QueIns(tmpmr,dev.mem32_head.last);
-
- if (m20->type) {
- while (m20->type) {
- tmpmr=AMAlloc(sizeof(CMemRange));
- tmpmr->type=m20->type;
- tmpmr->flags=0;
- tmpmr->base=m20->base;
- tmpmr->size=m20->len;
- if (!Mem32DevIns(tmpmr))
- Free(tmpmr);
- m20++;
- }
- }
-}
-
-U8 *Mem32DevAlloc(I64 size,I64 alignment)
-{//Alloc 32-bit addr space for device. (Doesn't work.) Not used.
-//For this to work the BIOS E820 map must be searched for gaps in
- //the 32-bit range and the pool initialized to the gaps.
- U8 *base,*limit;
- CMemRange *tmpmr,*tmpmr1;
- while (LBts(&sys_semas[SEMA_DEV_MEM],0))
- Yield;
- tmpmr1=dev.mem32_head.next;
- while (tmpmr1!=&dev.mem32_head) {
- base=(tmpmr1->base+alignment-1)&~(alignment-1);
- limit=base+size-1;
- if (!tmpmr1->type &&
- limit<tmpmr1->base+tmpmr1->size) {
- tmpmr=AMAlloc(sizeof(CMemRange));
- tmpmr->type=MRT_DEV;
- tmpmr->flags=0;
- tmpmr->base=base;
- tmpmr->size=size;
- if (!Mem32DevIns(tmpmr)) {
- Free(tmpmr);
- LBtr(&sys_semas[SEMA_DEV_MEM],0);
- return NULL;
- }
- LBtr(&sys_semas[SEMA_DEV_MEM],0);
- return tmpmr->base;
- }
- tmpmr1=tmpmr1->next;
- }
- LBtr(&sys_semas[SEMA_DEV_MEM],0);
- return NULL;
-}
-
-U0 Mem32DevFree(U8 *base)
-{//Free 32-bit device address space.
- CMemRange *tmpmr;
- if (!base) return;
- while (LBts(&sys_semas[SEMA_DEV_MEM],0))
- Yield;
- tmpmr=dev.mem32_head.next;
- while (tmpmr!=&dev.mem32_head) {
- if (tmpmr->base==base) {
- tmpmr->type=MRT_UNUSED;
- break;
- }
- tmpmr=tmpmr->next;
- }
- LBtr(&sys_semas[SEMA_DEV_MEM],0);
-}
-
-U8 *Mem64DevAlloc(I64 *_pages1Gig)
-{//Alloc 64-bit addr space for device.
- U8 *a;
- I64 i=*_pages1Gig,*pte;
- while (LBts(&sys_semas[SEMA_DEV_MEM],0))
- Yield;
- while (i--) {
- a=dev.mem64_ptr-=1<<30;
- do {
- pte=MemPageTable(a);
- *pte=*pte&~0x18 |0x11; //Uncached and present
- InvlPg(dev.mem64_ptr);
- a+=mem_page_size;
- } while (a-dev.mem64_ptr<1<<30);
- }
- LBtr(&sys_semas[SEMA_DEV_MEM],0);
- return dev.mem64_ptr;
-}
-
-U0 Mem64DevFree(U8 *base,I64 pages1Gig)
-{//Free 64-bit device address space.
- if (!base) return;
- while (LBts(&sys_semas[SEMA_DEV_MEM],0))
- Yield;
- if (base==dev.mem64_ptr)
- dev.mem64_ptr+=pages1Gig*1<<30;
-//else not freed
- LBtr(&sys_semas[SEMA_DEV_MEM],0);
-}
-
-U0 UncachedAliasAlloc() //Make uncached alias for 4 lowest Gig.
-{
- I64 i=4,*pte;
- U8 *a;
- a=dev.uncached_alias=Mem64DevAlloc(&i);
- do {
- pte=MemPageTable(a);
- *pte=0x197+a-dev.uncached_alias;
- InvlPg(a);
- a+=mem_page_size;
- } while (a-dev.uncached_alias<1<<32);
-}
-
-I64 BIOSTotalMem()
-{
- I64 r01,r20;
- U16 *m01=MEM_E801;
- CMemE820 *m20=MEM_E820;
-
- r01=0x100000+m01[0]<<10+m01[1]<<16;
- r20=0;
- if (m20->type) {
- while (m20->type) {
- if (m20->type==1)
- r20+=m20->len;
- m20++;
- }
- }
- return MaxI64(r01,r20);
-}
-
-I64 Scale2Mem(I64 min,I64 max,I64 limit=2*1024*1024*1024)
-{//Helps pick DiskCache and RAMDisk sizes.
-//Can be used in BootHDIns() config scripts.
- I64 i;
- if (sys_data_bp)
- i=sys_data_bp->alloced_u8s;
- else
- i=sys_code_bp->alloced_u8s;
- if (i>=limit)
- return max;
- else
- return min+(max-min)*i/limit;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/Mem/PageTables.HC.HTML b/public/src/Kernel/Mem/PageTables.HC.HTML deleted file mode 100644 index de8545f..0000000 --- a/public/src/Kernel/Mem/PageTables.HC.HTML +++ /dev/null @@ -1,217 +0,0 @@ - - - - - PageTables.HC - - - - - asm {
-// /Doc/MemOverview.DD
-
-USE32
-SYS_INIT_PAGE_TABLES::
-//Check 1Gig page capability and set page size.
- MOV EAX,0x80000001
- CPUID
- MOV EAX,1<<21
-// BT EDX,26
-// JNC @@05
-// MOV EAX,1<<30
-@@05: MOV U32 [MEM_PAGE_SIZE],EAX
-
-//Set mapped space limit
- MOV EAX,[MEM_PHYSICAL_SPACE]
- MOV EDX,[MEM_PHYSICAL_SPACE+4]
- BT U32 [MEM_PAGE_SIZE],30 //Round-up to 1Gig boundary?
- JNC @@10
- ADD EAX,0x3FFFFFFF
- ADC EDX,0
- AND EAX,~0x3FFFFFFF
-@@10: INC EDX //Need 4Gig extra for uncached alias up at top of space.
- MOV [MEM_MAPPED_SPACE],EAX
- MOV [MEM_MAPPED_SPACE+4],EDX
-
-//How many 2Meg pages?
- MOV CL,21
- ADD EAX,0x1FFFFF
- ADC EDX,0
- SHRD EAX,EDX
- SHR EDX,CL
- MOV [MEM_2MEG_NUM],EAX
- MOV [MEM_2MEG_NUM+4],EDX
-
-//How many 1Gig pages?
- MOV CL,9
- ADD EAX,0x1FF
- ADC EDX,0
- SHRD EAX,EDX
- SHR EDX,CL
- MOV [MEM_1GIG_NUM],EAX
- MOV [MEM_1GIG_NUM+4],EDX
-
-//How many 512Gig pages?
- MOV CL,9
- ADD EAX,0x1FF
- ADC EDX,0
- SHRD EAX,EDX
- SHR EDX,CL
- MOV [MEM_512GIG_NUM],EAX
- MOV [MEM_512GIG_NUM+4],EDX
-
-//Set CSysFixedArea to zero
- MOV EDI,SYS_FIXED_AREA
- XOR EAX,EAX
- MOV ECX,sizeof(CSysFixedArea)/4
- REP_STOSD
-
- MOV U32 [MEM_PML2],EDI
-//Check for 1Gig page capability.
- BT U32 [MEM_PAGE_SIZE],30
- JC @@15
-//Find PML2 Size
- MOV EAX,U32 [MEM_2MEG_NUM]
- ADD EAX,0x1FF
- AND EAX,~0x1FF
- SHL EAX,3
- ADD EDI,EAX
-
-//Find PML3 Size
-@@15: MOV U32 [MEM_PML3],EDI
- MOV EAX,U32 [MEM_1GIG_NUM]
- ADD EAX,0x1FF
- AND EAX,~0x1FF
- SHL EAX,3
- ADD EDI,EAX
-
-//Find PML4 Size
- MOV U32 [MEM_PML4],EDI
- MOV EAX,U32 [MEM_512GIG_NUM]
- ADD EAX,0x1FF
- AND EAX,~0x1FF
- SHL EAX,3
- ADD EAX,EDI
-
- MOV U32 [MEM_HEAP_BASE],EAX
-
-//Set page tables to zero
- MOV EDI,U32 [MEM_PML2]
- SUB EAX,EDI
- MOV ECX,EAX
- SHR ECX,2
- XOR EAX,EAX
- REP_STOSD
-
-//Check for 1Gig page capability.
- BT U32 [MEM_PAGE_SIZE],30
- JC @@30
-
-//PML2: Use 2Meg Pages
- MOV EAX,0x87 //bit 7 is page size (2Meg)
- XOR EDX,EDX
- MOV EDI,[MEM_PML2]
- MOV ECX,[MEM_2MEG_NUM]
-@@20: MOV U32 [EDI],EAX
- ADD EDI,4
- MOV U32 [EDI],EDX
- ADD EDI,4
- ADD EAX,0x200000
- ADC EDX,0
- LOOP @@20
-//PML3: Use 2Meg Pages
- MOV EAX,[MEM_PML2]
- OR EAX,7
- XOR EDX,EDX
- MOV EDI,[MEM_PML3]
- MOV ECX,[MEM_1GIG_NUM]
-@@25: MOV U32 [EDI],EAX
- ADD EDI,4
- MOV U32 [EDI],EDX
- ADD EDI,4
- ADD EAX,0x1000
- ADC EDX,0
- LOOP @@25
- JMP @@40
-
-//PML3: Use 1Gig Pages
-@@30: MOV EAX,0x87 //bit 7 is page size (1Gig)
- XOR EDX,EDX
- MOV EDI,[MEM_PML3]
- MOV ECX,[MEM_1GIG_NUM]
-@@35: MOV U32 [EDI],EAX
- ADD EDI,4
- MOV U32 [EDI],EDX
- ADD EDI,4
- ADD EAX,0x40000000
- ADC EDX,0
- LOOP @@35
-
-//PML4
-@@40: MOV EAX,[MEM_PML3]
- OR EAX,7
- XOR EDX,EDX
- MOV EDI,[MEM_PML4]
- MOV ECX,[MEM_512GIG_NUM]
-@@45: MOV U32 [EDI],EAX
- ADD EDI,4
- MOV U32 [EDI],EDX
- ADD EDI,4
- ADD EAX,0x1000
- ADC EDX,0
- LOOP @@45
- RET
-
-SYS_INIT_16MEG_SYS_CODE_BP::
-// Init sys_code_bp to BIOS E801 lowest 16Meg val.
-// BlkPoolsInit() adds the rest.
- MOV U32 [SYS_CODE_BP],SYS_FIXED_AREA+CSysFixedArea.sys_code_bp
- MOV U32 [SYS_CODE_BP+4],0
-
- MOV U32 [SYS_DATA_BP],0
- MOV U32 [SYS_DATA_BP+4],0
-
- XOR EAX,EAX
- MOV AX,U16 [MEM_E801] //1 Kb blks between 1M and 16M
- SHL EAX,10
- ADD EAX,0x100000
- MOV EDI,U32 [MEM_HEAP_BASE]
- SUB EAX,EDI
-
-//EDI=BASE EAX=SIZE
- TEST U8 [SYS_MEM_INIT_FLAG],1
- JZ @@05
- PUSH EAX
- PUSH EDI
- MOV ECX,EAX
- MOV AL,U8 [SYS_MEM_INIT_VAL]
- REP_STOSB
- POP EDI
- POP EAX
-
-@@05: SHR EAX,MEM_PAG_BITS
- MOV ESI,SYS_FIXED_AREA+CSysFixedArea.sys_code_bp
- MOV EBX,U32 CBlkPool.mem_free_lst[ESI]
- MOV U32 CMemBlk.next[EDI],EBX
- MOV U32 CMemBlk.next+4[EDI],0
- MOV U32 CBlkPool.mem_free_lst[ESI],EDI
- MOV U32 CBlkPool.mem_free_lst+4[ESI],0
- MOV U32 CMemBlk.mb_signature[EDI],MBS_UNUSED_SIGNATURE_VAL
- MOV U32 CMemBlk.pags[EDI],EAX
- SHL EAX,MEM_PAG_BITS
- ADD U32 CBlkPool.alloced_u8s[ESI],EAX
-
- BTS U32 [SYS_RUN_LEVEL],RLf_16MEG_SYS_CODE_BP
- RET
-}
-
-I64 *MemPageTable(U8 *a)
-{//Point to page table entry for addr.
- if (Bt(&mem_page_size,30))
- return *MEM_PML3(U64 *)+a>>30*8;
- else
- return *MEM_PML2(U64 *)+a>>21*8;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/MultiProc.HC.HTML b/public/src/Kernel/MultiProc.HC.HTML deleted file mode 100644 index 07ebb19..0000000 --- a/public/src/Kernel/MultiProc.HC.HTML +++ /dev/null @@ -1,401 +0,0 @@ - - - - - MultiProc.HC - - - - - asm {
- ALIGN 16,OC_NOP
-USE16
-//See TempleOS MultiCore.
-
-//This code gets copied to MP_VECT_ADDR.
-//See MemCpy(MP_VECT_ADDR.
-COREAP_16BIT_INIT::
- JMP @@05
-
- ALIGN 4,OC_NOP
-AP_GDT_PTR: DU16 sizeof(CGDT)-1;
- DU64 0;
-
-@@05: CLI
- WBINVD
- MOV AX,MP_VECT_ADDR/16
- MOV DS,AX
- LGDT U32 [CAP16BitInit.ap_gdt_ptr] //See mp->ap_gdt_ptr
-
- MOV EAX,SYS_START_CR0
- MOV_CR0_EAX
- DU8 0x66,0xEA; //JMP CGDT.cs32:AP_32BIT_INIT
- DU32 AP_32BIT_INIT;
- DU16 CGDT.cs32;
-COREAP_16BIT_INIT_END::
-
-USE32
-AP_32BIT_INIT:
- MOV AX,CGDT.ds
- MOV DS,AX
- MOV ES,AX
- MOV FS,AX
- MOV GS,AX
- MOV SS,AX
-
-@@05: LOCK
- BTS U32 [SYS_MP_CNT_LOCK],0
- JC @@05
-
- MOV ESI,U32 [SYS_MP_CNT_INITIAL]
- LOCK
- INC U32 [SYS_MP_CNT_INITIAL]
- LOCK
- BTR U32 [SYS_MP_CNT_LOCK],0
-
- CMP ESI,MP_PROCESSORS_NUM
- JAE I32 _SYS_HLT
-
- IMUL2 ESI,sizeof(CCPU)
- ADD ESI,U32 [SYS_CPU_STRUCTS]
-
- LEA ESP,U32 CCPU.start_stk+sizeof(CCPU.start_stk)[ESI]
- PUSH U32 RFLAGG_START
- POPFD
- PUSH U32 0 //Return from next call will be 64-bit
- CALL SYS_ENTER_LONG_MODE
-USE64
- FNINIT
- MOV RAX,RSI
- CALL SET_GS_BASE
-@@10: MOV RAX,U64 CCPU.seth_task[RSI]
- TEST RAX,RAX
- JZ @@10
- MOV U64 CTask.gs[RAX],RSI
- CALL SET_FS_BASE
-
- JMP I32 _TASK_CONTEXT_RESTORE
-}
-
-U0 TSSBusy(I64 tr,Bool val=OFF)
-{//See /Demo/Lectures/Ring3.HC.
- LBEqu((&sys_gdt)(U8 *)+tr+4,9,val);
-}
-
-CTSS *TSSNew(I64 cpu_num)
-{
- U32 *d,*d1;
- CTSS *tss=CAlloc(sizeof(CTSS));
- tss->io_map_offset=offset(CTSS.io_map);
- MemSet(tss->io_map,0xFF,0x10000/8);
-
- tss->st0=MAlloc(MEM_INTERRUPT_STK);
- tss->rsp0=tss->st0(U8 *)+MSize(tss->st0);
- tss->st1=MAlloc(MEM_INTERRUPT_STK);
- tss->rsp1=tss->st1(U8 *)+MSize(tss->st1);
- tss->st2=MAlloc(MEM_INTERRUPT_STK);
- tss->rsp2=tss->st2(U8 *)+MSize(tss->st2);
-
- tss->tr =offset(CGDT.tr)+cpu_num*16;
- tss->tr_ring3=offset(CGDT.tr_ring3)+cpu_num*16;
-
- d=(&sys_gdt)(U8 *)+tss->tr;
- d1=d(U8 *)+4;
- *d =0x0000FFFF;
- *d1=0x008F8900;
- d(U8 *)+=2;
- *d|=tss & 0x00FFFFFF;
- *d1++|=tss & 0xFF000000;
- *d1++=tss>>32;
- *d1=0;
-
- d=(&sys_gdt)(U8 *)+tss->tr_ring3;
- d1=d(U8 *)+4;
- *d =0x0000FFFF;
- *d1=0x008FE900;
- d(U8 *)+=2;
- *d|=tss & 0x00FFFFFF;
- *d1++|=tss & 0xFF000000;
- *d1++=tss>>32;
- *d1=0;
-
- return tss;
-}
-
-CCPU *CPUStructInit(I64 num,CCPU *c,CTask *seth_task)
-{//Seth is null when called by adam on CSysFixedArea.boot_cpu0
- MemSet(c,0,sizeof(CCPU));
- c->addr=c;
- c->num=num;
- c->idle_factor=0.01;
- QueInit(&c->next_dying);
- if (Bt(&sys_run_level,RLf_16MEG_ADAM_HEAP_CTRL)) {
- c->idle_task=Spawn(0,NULL,"Idle Task",,Fs,,0);
- LBts(&c->idle_task->task_flags,TASKf_IDLE);
- c->tss=TSSNew(num);
- }
- c->seth_task=seth_task;// It waits for this to be filled-in: seth_task
- return c;
-}
-
-U0 MPInt(U8 num,I64 cpu_num=1)
-{//Generate interrupt for specified core.
- if (cpu_num>=mp_cnt) {
- if (!Bt(&sys_run_level,RLf_MP))
- return;
- else
- throw('MultCore');
- }
- PUSHFD
- CLI //Multitasking safe because each core has a local apic and IRQ's are off
- while (*(dev.uncached_alias+LAPIC_ICR_LOW)(U32 *)&0x1000)
- PAUSE
- *(dev.uncached_alias+LAPIC_ICR_HIGH)(U32 *)=dev.mp_apic_ids[cpu_num]<<24;
- *(dev.uncached_alias+LAPIC_ICR_LOW)(U32 *)=0x4000+num;
- POPFD
-}
-
-U0 MPIntAll(U8 num)
-{//Generate interrupt for all but own core.
- PUSHFD
- CLI //Multitasking safe because each core has a local apic and IRQ's are off
- while (*(dev.uncached_alias+LAPIC_ICR_LOW)(U32 *)&0x1000)
- PAUSE
- *(dev.uncached_alias+LAPIC_ICR_LOW)(U32 *)=0xC4800+num;
- POPFD
-}
-
-U0 MPNMInt()
-{//Generate nonmaskable interrupt.
- *(dev.uncached_alias+LAPIC_ICR_LOW)(U32 *)=0xC4400;
-}
-
-U0 MPHalt()
-{//Halt all other cores.
- mp_cnt=1;
- MPNMInt;
- Busy(10000);
-}
-
-U0 MPAPICInit()
-{//Called by adam during start-up
-//and other cores during initialization
- //after Core0StartMP().
- *(dev.uncached_alias+LAPIC_SVR)(U32 *)|=LAPICF_APIC_ENABLED;
- dev.mp_apic_ids[Gs->num]=*(dev.uncached_alias+LAPIC_APIC_ID)(U32 *)>>24;
- *(dev.uncached_alias+LAPIC_LDR)(U32 *)=dev.mp_apic_ids[Gs->num]<<24;
- *(dev.uncached_alias+LAPIC_DFR)(U32 *)=0xF0000000;
-
- // MemSet(dev.uncached_alias+LAPIC_IRR,0,0x20);
- // MemSet(dev.uncached_alias+LAPIC_ISR,0,0x20);
- // MemSet(dev.uncached_alias+LAPIC_TMR,0,0x20);
-
- SetRAX(Gs->tss->tr);
- LTR AX
- if (Gs->num) {
- IntInit1;
- SetRFlags(RFLAGG_NORMAL);
- }
-}
-
-#assert !offset(CJobCtrl.next_waiting)
-
-U0 CoreAPSethTask()
-{
- CJobCtrl *ctrl=&Fs->srv_ctrl;
- while (TRUE) {
- STI
- do {
- TaskKillDying;
- do PAUSE
- while (LBts(&ctrl->flags,JOBCf_LOCKED));
- } while (ctrl->next_waiting!=ctrl && JobRunOne(GetRFlags,ctrl));
- CLI
- LBts(&Fs->task_flags,TASKf_AWAITING_MSG);
- LBtr(&ctrl->flags,JOBCf_LOCKED);
- LBts(&Fs->task_flags,TASKf_IDLE);
- Yield;
- LBtr(&Fs->task_flags,TASKf_IDLE);
- }
-}
-
-CJob *JobQue(I64 (*fp_addr)(U8 *data),U8 *data=NULL,
- I64 target_cpu=1,I64 flags=1<<JOBf_FREE_ON_COMPLETE,
- I64 job_code=JOBT_CALL,U8 *aux_str=NULL,I64 aux1=0,I64 aux2=0)
-{//Queue multicore jobs, handled by Seth tasks.
-//Set flags to zero if you wish to get the res.
- //See /Demo/MultiCore/Lock.HC
- CJobCtrl *ctrl;
- CJob *tmpc;
- CTask *seth;
- if (!(0<=target_cpu<mp_cnt))
- throw('MultCore');
- tmpc=ACAlloc(sizeof(CJob));
- if (aux_str)
- tmpc->aux_str=AStrNew(aux_str);
- tmpc->job_code=job_code;
- tmpc->addr=fp_addr;
- tmpc->fun_arg=data;
- tmpc->flags=flags;
- tmpc->aux1=aux1;
- tmpc->aux2=aux2;
- seth=cpu_structs[target_cpu].seth_task;
- tmpc->ctrl=ctrl=&seth->srv_ctrl;
- PUSHFD
- CLI
- while (LBts(&ctrl->flags,JOBCf_LOCKED))
- Yield;
- if (ctrl->next_waiting==ctrl && LBtr(&seth->task_flags,TASKf_AWAITING_MSG))
- MPInt(I_WAKE,target_cpu);
- QueIns(tmpc,ctrl->last_waiting);
- LBtr(&ctrl->flags,JOBCf_LOCKED);
- POPFD
- return tmpc;
-}
-
-CTask *SpawnQue(U0 (*fp_addr)(U8 *data),U8 *data=NULL,U8 *task_name=NULL,
- I64 target_cpu, CTask *parent=NULL, //NULL means adam
- I64 stk_size=0,I64 flags=1<<JOBf_ADD_TO_QUE)
-{
- CTask *res;
- CJob *tmpc=JobQue(fp_addr,data,target_cpu,
- flags,JOBT_SPAWN_TASK,task_name,parent,stk_size);
- CJobCtrl *ctrl;
-
- while (!Bt(&tmpc->flags,JOBf_DONE)) {
- LBts(&Fs->task_flags,TASKf_IDLE);
- Yield;
- }
- LBtr(&Fs->task_flags,TASKf_IDLE);
-
- res=tmpc->spawned_task;
- ctrl=tmpc->ctrl;
- PUSHFD
- CLI
- while (LBts(&ctrl->flags,JOBCf_LOCKED))
- Yield;
- QueRem(tmpc);
- LBtr(&ctrl->flags,JOBCf_LOCKED);
- POPFD
- JobDel(tmpc);
- return res;
-}
-
-U0 CoreAPSethInit()
-{//Called by multicore's seth task after Core0StartMP()
-//as the first thing a CPU does before waiting for jobs.
- MPAPICInit;
- Fs->rip=&CoreAPSethTask;
- TaskContextRestore;
-}
-
-U0 Core0StartMP()
-{//Called by adam during start-up.
- CTask *task;
- U8 buf[STR_LEN];
- CAP16BitInit *mp=MP_VECT_ADDR;
- CCPU *c;
- I64 i,my_mp_cnt;
- CRAXRBCRCXRDX ee;
-
- CPUId(0x1,&ee);
- if (!Bt(&ee.rdx,9))
- return;
-
- PUSHFD
- CLI
- if (mp_cnt>1) {
- my_mp_cnt=mp_cnt;
- MPHalt; //sets mp_cnt to 1
- for (i=1;i<my_mp_cnt;i++) {
- c=&cpu_structs[i];
- JobQueDel(&c->seth_task->srv_ctrl.next_waiting);
- JobQueDel(&c->seth_task->srv_ctrl.next_done);
- }
- }
- MemSet(&cpu_structs[1],0,sizeof(CCPU)*(MP_PROCESSORS_NUM-1));
-
- //When you start-up other cores, they jump to an addr
- //specified by a byte vect number, MPN_VECT which corresponds
- //to a location 4096*vect number, MP_VECT_ADDR.
- MemCpy(mp,COREAP_16BIT_INIT,COREAP_16BIT_INIT_END-COREAP_16BIT_INIT);
- MemCpy(&mp->ap_gdt_ptr,SYS_GDT_PTR,sizeof(CSysLimitBase));
- mp_cnt_initial=mp_cnt=1;
- mp_cnt_lock=0;
-
- *(dev.uncached_alias+LAPIC_LVT_ERR)(U32 *)=
- *(dev.uncached_alias+LAPIC_LVT_ERR)(U32 *)&0xFFFFFF00+MPN_VECT;
- WBINVD //Not sure why this is needed. Might just need delay. MemCpy above?
-
- *(dev.uncached_alias+LAPIC_ICR_LOW)(U32 *)=0xC4500; //assert init IPI
- Busy(10000);
-
- *(dev.uncached_alias+LAPIC_ICR_LOW)(U32 *)=0xC4600+MPN_VECT; //start-up
- Busy(200);
- *(dev.uncached_alias+LAPIC_ICR_LOW)(U32 *)=0xC4600+MPN_VECT;
-
- Busy(100000);
- for (i=0;i<10000;i++)
- LBts(&mp_cnt_lock,0); //Don't let more through
- my_mp_cnt=mp_cnt_initial;
-
- if (my_mp_cnt>MP_PROCESSORS_NUM)
- my_mp_cnt=MP_PROCESSORS_NUM;
-
- for (i=1;i<my_mp_cnt;i++) {
- StrPrint(buf,"Seth Task CPU%02X",i);
- task=Spawn(&CoreAPSethInit,NULL,buf,,,MEM_SETH_STK,0);
- task->rflags=RFLAGG_START;
-//CTask alloced off this core's seth_task's heap (Which is Adam)
- CPUStructInit(i,&cpu_structs[i],task);
- WBINVD //Not sure why this is needed. Might just need delay.
- }
-
- //Make sure they're all up-and-running
- for (i=1;i<my_mp_cnt;i++)
- while (!Bt(&cpu_structs[i].seth_task->task_flags,TASKf_AWAITING_MSG))
- PAUSE;
-
- POPFD
- mp_cnt=my_mp_cnt; //Finalize cnt
-}
-
-U0 Core0Init()
-{//Called by adam during start-up
- CRAXRBCRCXRDX ee;
- CPUId(0x1,&ee);
-
- mp_cnt_initial=mp_cnt=1;
- mp_cnt_lock=0;
-
- dbg.mp_crash=ACAlloc(sizeof(CMPCrash));
-
- //Must be in code heap because init code uses 32 bit addr of cpu_struct
- adam_task->gs=cpu_structs=
- CAlloc(sizeof(CCPU)*MP_PROCESSORS_NUM,Fs->code_heap);
- CPUStructInit(0,cpu_structs,adam_task);
- asm {//RAX has GS
- IMPORT SET_GS_BASE;
- CALL SET_GS_BASE
- }
- if (Bt(&ee.rdx,9)) {
-//Unnecessary?
- // SetMSR(IA32_LAPIC_BASE,dev.uncached_alias+LAPIC_BASE+0x900);
- MPAPICInit;
- }
-}
-
-interrupt U0 IntMPCrash()
-{//Entering the debugger from another core causes an interrupt on Core0
-//Which calls this routine.
- *(dev.uncached_alias+LAPIC_EOI)(U32 *)=0;
- mp_cnt=1;
- Raw(ON);
- text.raw_flags|=RWF_SHOW_DOLLAR;
- "MP Crash CPU%02X Task:%08X\n"
- "RIP:%P\n",dbg.mp_crash->cpu_num,dbg.mp_crash->task,dbg.mp_crash->rip;
- Panic(dbg.mp_crash->msg,dbg.mp_crash->msg_num);
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/PCIBIOS.HC.HTML b/public/src/Kernel/PCIBIOS.HC.HTML deleted file mode 100644 index d696bd4..0000000 --- a/public/src/Kernel/PCIBIOS.HC.HTML +++ /dev/null @@ -1,301 +0,0 @@ - - - - - PCIBIOS.HC - - - - - asm {
-USE32
-
-SYS_PCIBIOS_SERVICE_DIR:: DU32 0;
-SYS_PCI_SERVICES:: DU32 0;
-
-SYS_FIND_PCIBIOS_SERVICE_DIR::
- MOV ESI,0xE0000
- MOV ECX,(0x100000-0xE0000)/4
-@@05: CMP U32 [ESI],'_32_'
- JNE @@20
- PUSH ECX
- XOR ECX,ECX
- MOV CL,U8 9[ESI]
- SHL ECX,4
-@@10: MOV EDI,ESI
- XOR EAX,EAX
- XOR EDX,EDX
-@@15: MOV DL,U8 [EDI]
- ADD EAX,EDX
- INC EDI
- DEC ECX
- JNZ @@15
- POP ECX
- TEST AL,AL
- JNZ @@20
- MOV U32 [SYS_PCIBIOS_SERVICE_DIR],ESI
- MOV ESI,U32 4[ESI]
- MOV U32 [SYS_PCIBIOS_SERVICE_CALL],ESI
- RET
-
-@@20: ADD ESI,4
- LOOP @@05
- MOV U32 [SYS_PCIBIOS_SERVICE_DIR],0
- RET
-
-SYS_FIND_PCI_SERVICES::
- MOV ESI,U32 [SYS_PCIBIOS_SERVICE_DIR]
- TEST ESI,ESI
- JNZ @@05
- MOV U32 [SYS_PCI_SERVICES],0
- RET
-@@05: MOV EAX,'$PCI'
- XOR EBX,EBX
- DU8 0x9A; //CALL CGDT.cs32:PCIBIOS_SERVICE
-SYS_PCIBIOS_SERVICE_CALL:: DU32 0;
- DU16 CGDT.cs32;
- TEST AL,AL
- JNZ @@05
- LEA ESI,U32 [EBX+EDX]
- MOV U32 [SYS_PCI_SERVICES],ESI
- RET
-
-@@05: MOV U32 [SYS_PCI_SERVICES],0
- RET
-
-USE64
-C32_EAX:: DU32 0;
-C32_EBX:: DU32 0;
-C32_ECX:: DU32 0;
-C32_EDX:: DU32 0;
-C32_ESI:: DU32 0;
-C32_EDI:: DU32 0;
-C32_EFLAGS:: DU32 0;
-
-C32_RSP:: DU64 0;
-
-_FAR_CALL32::
-//This calls a 32-bit mode routine.
-//(We must switch from 64-bit mode to do it.)
-//
-//NON REENTRANT
-//
- PUSH RBP
- MOV RBP,RSP
- MOV RAX,U64 SF_ARG1[RBP]
- TEST RAX,RAX
- JNZ @@05
- POP RBP
- RET1 8 //return FALSE
-@@05: MOV U32 [C32_ADD],EAX
- PUSH_REGS
- PUSHFD
- XOR RAX,RAX
- PUSH U64 FS:CTask.addr[RAX]
- PUSH U64 GS:CCPU.addr[RAX]
- MOV U64 [C32_RSP],RSP
- PUSH U32 CGDT.ds //STKSEG
- PUSH U32 BOOT_RAM_LIMIT //STK
- PUSH U32 0 //FLAGS--interrupts off
- PUSH U32 CGDT.cs32
- LEA RAX,[@@15]
- PUSH RAX
- IRET
-USE32
-@@15:
- WBINVD
-//disable paging
- MOV_EAX_CR0
- BTR EAX,31
- MOV_CR0_EAX
-
- MOV ECX,IA32_EFER
- XOR EDX,EDX
- XOR EAX,EAX
- WRMSR
-
- MOV AX,CGDT.ds
- MOV FS,AX
- MOV GS,AX
-//SS already set
-
- MOV EAX,U32 [C32_EAX]
- MOV EBX,U32 [C32_EBX]
- MOV ECX,U32 [C32_ECX]
- MOV EDX,U32 [C32_EDX]
- MOV ESI,U32 [C32_ESI]
- MOV EDI,U32 [C32_EDI]
- MOV U32 [C32_EFLAGS],0
-
- DU8 0x9A; //CALL CGDT.cs32:[C32_ADD]
-C32_ADD:: DU32 0;
- DU16 CGDT.cs32;
-
- PUSHFD
- POP U32 [C32_EFLAGS]
-
- MOV U32 [C32_EAX],EAX
- MOV U32 [C32_EBX],EBX
- MOV U32 [C32_ECX],ECX
- MOV U32 [C32_EDX],EDX
- MOV U32 [C32_ESI],ESI
- MOV U32 [C32_EDI],EDI
-
- PUSH U32 0 //Return from next call will be 64-bit
- CALL SYS_ENTER_LONG_MODE
-
-USE64 MOV RSP,U64 [C32_RSP]
- POP RAX
- CALL SET_GS_BASE
- POP RAX
- CALL SET_FS_BASE
-
- POPFD
- POP_REGS
- XOR RAX,RAX
- MOV AL,TRUE
- POP RBP
- RET1 8
-}
-
-_extern C32_EAX U32 c32_eax;
-_extern C32_EBX U32 c32_ebx;
-_extern C32_ECX U32 c32_ecx;
-_extern C32_EDX U32 c32_edx;
-_extern C32_ESI U32 c32_esi;
-_extern C32_EDI U32 c32_edi;
-_extern C32_EFLAGS U32 c32_eflags;
-_extern SYS_PCI_SERVICES U32 sys_pci_services;
-
-_extern _FAR_CALL32 Bool FarCall32(U0 (*fp_addr)());//Not reentrant.For PCIBIOS.
-
-U8 PCIReadU8(I64 bus,I64 dev,I64 fun,I64 rg)
-{//Read U8 in PCI configspace at bus,dev,fun,reg.
- I64 res;
- PUSHFD
- CLI
- while (LBts(&sys_semas[SEMA_FAR_CALL32],0))
- Yield;
- c32_eax=0xB108;
- c32_ebx=bus<<8+dev<<3+fun;
- c32_edi=rg;
- if (FarCall32(sys_pci_services))
- res=c32_ecx.u8[0];
- else
- res=0xFF;
- LBtr(&sys_semas[SEMA_FAR_CALL32],0);
- POPFD
- return res;
-}
-
-U16 PCIReadU16(I64 bus,I64 dev,I64 fun,I64 rg)
-{//Read U16 in PCI configspace at bus,dev,fun,reg.
- I64 res;
- PUSHFD
- CLI
- while (LBts(&sys_semas[SEMA_FAR_CALL32],0))
- Yield;
- c32_eax=0xB109;
- c32_ebx=bus<<8+dev<<3+fun;
- c32_edi=rg;
- if (FarCall32(sys_pci_services))
- res=c32_ecx.u16[0];
- else
- res=0xFFFF;
- LBtr(&sys_semas[SEMA_FAR_CALL32],0);
- POPFD
- return res;
-}
-
-U32 PCIReadU32(I64 bus,I64 dev,I64 fun,I64 rg)
-{//Read U32 in PCI configspace at bus,dev,fun,reg.
- I64 res;
- PUSHFD
- CLI
- while (LBts(&sys_semas[SEMA_FAR_CALL32],0))
- Yield;
- c32_eax=0xB10A;
- c32_ebx=bus<<8+dev<<3+fun;
- c32_edi=rg;
- if (FarCall32(sys_pci_services))
- res=c32_ecx;
- else
- res=0xFFFFFFFF;
- LBtr(&sys_semas[SEMA_FAR_CALL32],0);
- POPFD
- return res;
-}
-
-U0 PCIWriteU8(I64 bus,I64 dev,I64 fun,I64 rg,I64 val)
-{//Write U8 in PCI configspace at bus,dev,fun,reg.
- PUSHFD
- CLI
- while (LBts(&sys_semas[SEMA_FAR_CALL32],0))
- Yield;
- c32_eax=0xB10B;
- c32_ebx=bus<<8+dev<<3+fun;
- c32_edi=rg;
- c32_ecx=val;
- FarCall32(sys_pci_services);
- LBtr(&sys_semas[SEMA_FAR_CALL32],0);
- POPFD
-}
-
-U0 PCIWriteU16(I64 bus,I64 dev,I64 fun,I64 rg,I64 val)
-{//Write U16 in PCI configspace at bus,dev,fun,reg.
- PUSHFD
- CLI
- while (LBts(&sys_semas[SEMA_FAR_CALL32],0))
- Yield;
- c32_eax=0xB10C;
- c32_ebx=bus<<8+dev<<3+fun;
- c32_edi=rg;
- c32_ecx=val;
- FarCall32(sys_pci_services);
- LBtr(&sys_semas[SEMA_FAR_CALL32],0);
- POPFD
-}
-
-U0 PCIWriteU32(I64 bus,I64 dev,I64 fun,I64 rg,I64 val)
-{//Write U32 in PCI configspace at bus,dev,fun,reg.
- PUSHFD
- CLI
- while (LBts(&sys_semas[SEMA_FAR_CALL32],0))
- Yield;
- c32_eax=0xB10D;
- c32_ebx=bus<<8+dev<<3+fun;
- c32_edi=rg;
- c32_ecx=val;
- FarCall32(sys_pci_services);
- LBtr(&sys_semas[SEMA_FAR_CALL32],0);
- POPFD
-}
-
-I64 PCIClassFind(I64 class_code,I64 n)
-{/*Find bus,dev,fun of Nth class_code dev.
-
-class_code is low three bytes
-n is index starting at zero
-Return: -1 not found
-else bus,dev,fun.
-*/
- I64 res;
- PUSHFD
- CLI
- while (LBts(&sys_semas[SEMA_FAR_CALL32],0))
- Yield;
- c32_eax=0xB103;
- c32_esi=n;
- c32_ecx=class_code;
- if (FarCall32(sys_pci_services) && !c32_eax.u8[1])
- res=c32_ebx.u8[1]<<16+(c32_ebx&0xF8)<<5+c32_ebx&7;
- else
- res=-1;
- LBtr(&sys_semas[SEMA_FAR_CALL32],0);
- POPFD
- return res;
-}
-
- - - \ No newline at end of file diff --git a/public/src/Kernel/QSort.HC.HTML b/public/src/Kernel/QSort.HC.HTML deleted file mode 100644 index f371a86..0000000 --- a/public/src/Kernel/QSort.HC.HTML +++ /dev/null @@ -1,116 +0,0 @@ - - - - - QSort.HC - - - - - U0 QSortI64(I64 *base,I64 num, I64 (*fp_compare)(I64 e1,I64 e2))
-{/*Quick Sort for width==8.
-fp_compare() passes by value instead of ref.
-
-For ascending strings: return StrCmp(e1,e2);
-For ascending ints : return e1-e2;
-
-Maybe, look at /Demo/MultiCore/MPRadix.HC.
-*/
- I64 i,*left,*right,pivot;
- if (num>1) {
- left =base;
- right=base+num-1;
- pivot=base[num/2];
- do {
- while ((*fp_compare)(*left,pivot)<0)
- left++;
- while ((*fp_compare)(*right,pivot)>0)
- right--;
- if (left<=right)
- SwapI64(left++,right--);
- } while (left<=right);
- i=right+1-base;
- if (1<i<num)
- QSortI64(base,i,fp_compare);
- i=base+num-left;
- if (1<i<num)
- QSortI64(left,i,fp_compare);
- }
-}
-
-U0 QSort2a(U8 **base,I64 num,I64 (*fp_compare)(U8 **_e1,U8 **_e2))
-{//Not public.For case of width==size(U8 *)==8.
-//fp_compare() passes by ref.
- I64 i;
- U8 **left,**right,*pivot;
- left =base;
- right=base+num-1;
- pivot=base[num/2];
- do {
- while ((*fp_compare)(left,&pivot)<0)
- left++;
- while ((*fp_compare)(right,&pivot)>0)
- right--;
- if (left<=right)
- SwapI64(left++,right--);
- } while (left<=right);
- i=right+1-base;
- if (1<i<num)
- QSort2a(base,i,fp_compare);
- i=base+num-left;
- if (1<i<num)
- QSort2a(left,i,fp_compare);
-}
-U0 QSort2b(U8 *base,I64 num, I64 width,
- I64 (*fp_compare)(U8 *e1,U8 *e2),U8 *tmp)
-{//Not public
- I64 i;
- U8 *left,*right,*pivot=tmp+width;
- left =base;
- right=base+(num-1)*width;
- MemCpy(pivot,base+num/2*width,width);
- do {
- while ((*fp_compare)(left,pivot)<0)
- left+=width;
- while ((*fp_compare)(right,pivot)>0)
- right-=width;
- if (left<=right) {
- if (left!=right) {
- MemCpy(tmp,right,width);
- MemCpy(right,left,width);
- MemCpy(left,tmp,width);
- }
- left+=width;
- right-=width;
- }
- } while (left<=right);
- i=1+(right-base)/width;
- if (1<i<num)
- QSort2b(base,i,width,fp_compare,tmp);
- i=num+(base-left)/width;
- if (1<i<num)
- QSort2b(left,i,width,fp_compare,tmp);
-}
-U0 QSort(U8 *base,I64 num, I64 width, I64 (*fp_compare)(U8 *e1,U8 *e2))
-{/*Quick Sort: fp_compare() passes by ref.
-
-For ascending strings: return StrCmp(*e1,*e2);
-For ascending ints : return *e1-*e2;
-Don't return e1-e2 if numbers can overflow, return -1,0 or 1.
-
-Maybe, look at /Demo/MultiCore/MPRadix.HC.
-*/
- U8 *tmp;
- if (width && num>1) {
- if (width==sizeof(U8 *)) //assign instead of MemCpy for width 8
- QSort2a(base,num,fp_compare);
- else {
- tmp=MAlloc(width*2);
- QSort2b(base,num,width,fp_compare,tmp);
- Free(tmp);
- }
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/Sched.HC.HTML b/public/src/Kernel/Sched.HC.HTML deleted file mode 100644 index 43a51d3..0000000 --- a/public/src/Kernel/Sched.HC.HTML +++ /dev/null @@ -1,337 +0,0 @@ - - - - - Sched.HC - - - - - /*On each core, tasks are linked in a
-circular doubly-linked list queue with
-the Seth task as the head.On Core0,
-the queue order represents the front-to-back
-window stack order with the window mgr
-as the wallpaper.
-
-The scheduler is round-robin. It checks
-if a task is ready and runs it or skips it.
-Swapping tasks just involves storing and
-restoring regs (no disk I/O for virtual
-memory and no addr map changes).It is
-always fully identity-mapped on all cores.
-Tasks can be switched in half a microsecond.
-
-The scheduler checks if a task is
-waiting for a certain time or waiting
-on a message and skips if not ready.
-A task runs until it voluntarily yields ctrl
-with a call to Yield().Tasks waiting on I/O
-often loop, checking for a status and
-Yielding.This does not really degrade
-performance, but pegs the CPU Load.
-
-The scheduler checks for a few keys:
-
-<CTRL-ALT-x> kill a task.
-<CTRL-ALT-DEL> reboots.
-<CTRL-ALT-n> Next task.
-<CTRL-ALT-c> breaks execution of a program.
-
-Each core has its own circular task queue.
-For AP processors, they have a "Seth" task
-which stays in a loop waiting for jobs or
-requests to spawn tasks.See CoreAPSethTask().
-$HL,1$*/
-
-U0 TaskFocusNext()
-{
- CTask *task,*_task=sys_focus_task;
- sys_focus_task=NULL;
- if (!_task) _task=adam_task;
- task=_task->next_task;
- do {
- if (!Bt(&task->win_inhibit,WIf_SELF_FOCUS)) {
- sys_focus_task=task;
- CallExtNum(EXT_WIN_TO_TOP,task,TRUE);
- return;
- }
- task=task->next_task;
- } while (task!=_task);
-}
-
-asm {
-TASK_CONTEXT_SAVE::
-//OUT: RSI=FS
- PUSH RSI
- PUSHFD
- XOR RSI,RSI
- MOV RSI,FS:CTask.addr[RSI]
- POP U64 CTask.rflags[RSI]
- POP U64 CTask.rsi[RSI]
- MOV U64 CTask.rax[RSI],RAX
-
-/*Divert the stk to the Task memory
-and push onto it and divert it back.
-It's a little faster.
-*/
- MOV RAX,RSP
- LEA RSP,U64 CTask.r15+8[RSI]
- PUSH R15
- PUSH R14
- PUSH R13
- PUSH R12
- PUSH R11
- PUSH R10
- PUSH R9
- PUSH R8
- PUSH RDI
- PUSH RBP
- PUSH RBX
- PUSH RDX
- PUSH RCX
- MOV RSP,RAX
-
- MOV RAX,U64 CTask.fpu_mmx[RSI]
- FXSAVE U64 [RAX]
-
- MOV RDX,U64 CTask.bpt_lst[RSI]
-@@05: TEST RDX,RDX
- JZ @@10
- MOV RDI,U64 CBpt.addr[RDX]
- MOV AL,U8 CBpt.val[RDX]
- MOV U8 [RDI],AL
- MOV RDX,U64 CBpt.next[RDX]
- JMP @@05
-@@10: RET
-//************************************
-_TASK_CONTEXT_RESTORE::
- XOR RAX,RAX
- INC U64 GS:CCPU.swap_cnter[RAX]
- MOV RSI,FS:CTask.addr[RAX]
- BT U32 CTask.rflags[RSI],RFLAGf_INT
- JNC @@05
- BTS U32 GS:CCPU.cpu_flags[RAX],CPUf_RAN_A_TASK
-@@05: BT U64 CTask.task_flags[RSI],TASKf_DISABLE_BPTS
- JC @@15
- MOV RDX,U64 CTask.bpt_lst[RSI]
-@@10: TEST RDX,RDX
- JZ @@15
- MOV RDI,U64 CBpt.addr[RDX]
- MOV U8 [RDI],OC_BPT
- MOV RDX,U64 CBpt.next[RDX]
- JMP @@10
-
-@@15: INC U64 CTask.swap_cnter[RSI]
-
- MOV RAX,U64 CTask.fpu_mmx[RSI]
- FXRSTOR U64 [RAX]
-
- MOV RAX,RSP
- LEA RSP,U64 CTask.rcx[RSI]
- POP RCX
- POP RDX
- POP RBX
- POP RBP
- POP RDI
- POP R8
- POP R9
- POP R10
- POP R11
- POP R12
- POP R13
- POP R14
- POP R15
- MOV RSP,RAX
-
- MOV RAX,U64 CTask.rax[RSI]
- PUSH CGDT.ds
- PUSH U64 CTask.rsp[RSI]
- PUSH U64 CTask.rflags[RSI]
- PUSH CGDT.cs64
- PUSH U64 CTask.rip[RSI]
- MOV RSI,U64 CTask.rsi[RSI]
- IRET
-//************************************
-END_RSI_TASK:
- MOV RAX,RSI
- CALL SET_FS_BASE
-_TASK_END_NOW::
- CALL &TaskEnd
- MOV RSI,RAX
- CALL SET_FS_BASE
- JMP I8 RESTORE_RSI_TASK
-
-_YIELD::
- PUSHFD
- TEST U8 [SYS_SEMAS+SEMA_SINGLE_USER*DFT_CACHE_LINE_WIDTH],1
- JZ @@05
- POPFD //If single user, don't change task.
- RET
-
-@@05: CLI
- CALL TASK_CONTEXT_SAVE
- MOV EBX,U32 _RET
- MOV U64 CTask.rip[RSI],RBX
- POP U64 CTask.rflags[RSI]
- MOV U64 CTask.rsp[RSI],RSP
- MOV RSI,U64 CTask.next_task[RSI]
-
-RESTORE_RSI_TASK:
- TEST U64 [SYS_CTRL_ALT_FLAGS],1<<CTRL_ALT_DEL|
-1<<CTRL_ALT_TAB|1<<CTRL_ALT_X|1<<CTRL_ALT_C
- JNZ HANDLE_SYSF_KEY_EVENT
-
-RESTORE_RSI_TASK2:
-@@20: BT U64 CTask.task_flags[RSI],TASKf_KILL_TASK
- JC END_RSI_TASK
- TEST U64 CTask.task_flags[RSI],
- 1<<TASKf_AWAITING_MSG|1<<TASKf_SUSPENDED
- JNZ @@25
-
- MOV RAX,U64 [&cnts.jiffies]
- CMP U64 CTask.wake_jiffy[RSI],RAX
- JG @@25 //Jmp if not ready, yet.
-
- MOV RAX,RSI
- CALL SET_FS_BASE
- JMP I32 _TASK_CONTEXT_RESTORE
-
-@@25: MOV RSI,U64 CTask.next_task[RSI]
- XOR RAX,RAX
- CMP U64 GS:CCPU.seth_task[RAX],RSI
- JNE @@20 //Jmp if not Seth
- BTR U32 GS:CCPU.cpu_flags[RAX],CPUf_RAN_A_TASK
- JC @@20 //Jmp if had chance for IRQ already
- MOV RAX,U64 GS:CCPU.idle_task[RAX]
- MOV RSP,U64 CTask.stk[RAX]
- ADD RSP,MEM_DFT_STK+CTaskStk.stk_base //Rst to top
- CALL SET_FS_BASE
- STI //Restore idle task so we can unmask IRQs.
- HLT
-SYS_IDLE_PT::
- CLI
-
-RESTORE_SETH_TASK_IF_READY:
- XOR RAX,RAX
- MOV RSI,GS:CCPU.seth_task[RAX]
- JMP RESTORE_RSI_TASK
-
-HANDLE_SYSF_KEY_EVENT:
- MOV RAX,RSI
- CALL SET_FS_BASE
- XOR RBX,RBX
- MOV RAX,GS:CCPU.num[RBX]
- TEST RAX,RAX
- JNZ I32 RESTORE_RSI_TASK2
-
- MOV EAX,U32 SYS_CTRL_ALT_FLAGS
- LOCK
- BTR U32 [RAX],CTRL_ALT_DEL
- JC I32 &Reboot
-
- CMP U64 GS:CCPU.idle_task[RBX],RSI
- JE RESTORE_SETH_TASK_IF_READY
-
- LOCK
- BTR U32 [RAX],CTRL_ALT_TAB
- JNC @@05
- CALL &TaskFocusNext
- JMP I32 RESTORE_FS_TASK
-
-@@05: LOCK
- BTR U32 [RAX],CTRL_ALT_X
- JC END_FOCUS_USER
- LOCK
- BTR U32 [RAX],CTRL_ALT_C
- JNC I32 RESTORE_RSI_TASK
-
-BREAK_FOCUS_USER:
- MOV RSI,U64 [SYS_FOCUS_TASK]
- TEST RSI,RSI
- JZ RESTORE_SETH_TASK_IF_READY
- BT U64 CTask.win_inhibit[RSI],WIf_SELF_FOCUS
- JC I32 RESTORE_RSI_TASK
- LOCK
- BTR U64 CTask.task_flags[RSI],TASKf_BREAK_LOCKED
- JNC @@10
- LOCK
- BTS U64 CTask.task_flags[RSI],TASKf_PENDING_BREAK
- JMP I32 RESTORE_RSI_TASK
-
-@@10: MOV RAX,&Break
- MOV U64 CTask.rip[RSI],RAX
- BT U64 CTask.task_flags[RSI],TASKf_BREAK_TO_SHIFT_ESC
- JC I32 RESTORE_RSI_TASK
-
-//Do these now, in case interrupt happens.
- MOV U64 CTask.wake_jiffy[RSI],0
- PUSH RSI
- CALL &TaskRstAwaitingMsg
- JMP I32 RESTORE_RSI_TASK
-
-END_FOCUS_USER:
- MOV RSI,U64 [SYS_FOCUS_TASK]
- CALL &TaskFocusNext
- TEST RSI,RSI
- JZ I32 RESTORE_SETH_TASK_IF_READY
- MOV RAX,RSI
- CALL SET_FS_BASE
- BT U64 CTask.win_inhibit[RSI],WIf_SELF_FOCUS
- JC I32 RESTORE_RSI_TASK
- LOCK
- BTS U64 CTask.task_flags[RSI],TASKf_KILL_TASK
- JMP I32 END_RSI_TASK
-
-RESTORE_FS_TASK:
- XOR RSI,RSI
- MOV RSI,FS:CTask.addr[RSI]
- JMP I32 RESTORE_RSI_TASK
-}
-
-_extern _TASK_CONTEXT_RESTORE U0 TaskContextRestore(); //Restore a task context.
-_extern _YIELD U0 Yield(); //Yield cpu to next task.
-_extern _TASK_END_NOW U0 TaskEndNow(); //Terminate current task.
-
-U0 TaskQueIns(CTask *task,CTask *pred=NULL)
-{//Insert a task in the scheduler running task queue.
-//You have no business with this, probably.
- CTask *last;
- PUSHFD
- CLI
- if (!pred) pred=Fs;
- last=pred->last_task;
- last->next_task=pred->last_task=task;
- task->last_task=last;
- task->next_task=pred;
- POPFD
-}
-
-U0 TaskQueRem(CTask *task)
-{//Remove a task from the scheduler running task queue.
-//Use Suspend().
- CTask *next,*last;
- PUSHFD
- CLI
- next=task->next_task;
- last=task->last_task;
- last->next_task=next;
- next->last_task=last;
- POPFD
-}
-
-U0 TaskQueInsChild(CTask *task)
-{
- CTask *last,*pred;
- PUSHFD
- CLI
- pred=task->parent_task->last_child_task;
- last=pred->last_sibling_task;
- last->next_sibling_task=pred->last_sibling_task=task;
- task->last_sibling_task=last;
- task->next_sibling_task=pred;
- POPFD
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/SerialDev/Keyboard.HC.HTML b/public/src/Kernel/SerialDev/Keyboard.HC.HTML deleted file mode 100644 index 7bcb425..0000000 --- a/public/src/Kernel/SerialDev/Keyboard.HC.HTML +++ /dev/null @@ -1,504 +0,0 @@ - - - - - Keyboard.HC - - - - - asm {
-NORMAL_KEY_SCAN_DECODE_TABLE::
- DU8 0,CH_ESC,"1234567890-=",CH_BACKSPACE,'\t';
- DU8 "qwertyuiop[]",'\n',0,"as";
- DU8 "dfghjkl;'\`",0,"\\zxcv";
- DU8 "bnm,./",0,'*',0,CH_SPACE,0,0,0,0,0,0;
- DU8 0,0,0,0,0,0,0,0,0,0,'-',0,0,0,'+',0;
-SHIFT_KEY_SCAN_DECODE_TABLE::
- DU8 0,CH_SHIFT_ESC,"!@#$%^&*()_+",CH_BACKSPACE,'\t';
- DU8 "QWERTYUIOP{}",'\n',0,"AS";
- DU8 "DFGHJKL:\"~",0,"|ZXCV";
- DU8 "BNM<>?",0,'*',0,CH_SHIFT_SPACE,0,0,0,0,0,0;
- DU8 0,0,0,0,0,0,0,0,0,0,'-',0,0,0,'+',0;
-CTRL_KEY_SCAN_DECODE_TABLE::
- DU8 0,CH_ESC,"1234567890-=",CH_BACKSPACE,'\t';
- DU8 CH_CTRLQ,CH_CTRLW,CH_CTRLE,CH_CTRLR,CH_CTRLT,CH_CTRLY,CH_CTRLU,
- CH_CTRLI,CH_CTRLO,CH_CTRLP,"[]",'\n',0,CH_CTRLA,CH_CTRLS;
- DU8 CH_CTRLD,CH_CTRLF,CH_CTRLG,CH_CTRLH,CH_CTRLJ,CH_CTRLK,CH_CTRLL,
- ";'\`",0,"\\",CH_CTRLZ,CH_CTRLX,CH_CTRLC,CH_CTRLV;
- DU8 CH_CTRLB,CH_CTRLN,CH_CTRLM,",./",0,'*',0,CH_SPACE,0,0,0,0,0,0;
- DU8 0,0,0,0,0,0,0,0,0,0,'-',0,0,0,'+',0;
-}
-
-U0 KbdCmdSend(I64 port, U8 val)
-{
- F64 timeout=tS+0.125;
- while (tS<timeout) {
- if (!(InU8(KBD_CTRL)&2)) {
- OutU8(port,val);
- return;
- }
- }
- throw;
-}
-
-I64 KbdCmdRead()
-{
- F64 timeout=tS+0.125;
- while (tS<timeout)
- if (InU8(KBD_CTRL)&1)
- return InU8(KBD_PORT);
- throw;
-}
-
-U0 KbdCmdFlush()
-{
- F64 timeout=tS+0.03;
- while (tS<timeout)
- InU8(KBD_PORT);
-}
-
-U0 KbdLEDsSet(I64 sc)
-{
- U8 v=0;
- BEqu(&v,0,Bt(&sc,SCf_SCROLL));
- BEqu(&v,1,Bt(&sc,SCf_NUM));
- BEqu(&v,2,Bt(&sc,SCf_CAPS));
- try {
- KbdCmdSend(KBD_PORT,0xED);
- KbdCmdSend(KBD_PORT,v);
- } catch
- Fs->catch_except=TRUE;
-}
-
-U0 KbdMsCmdAck(...)
-{
- I64 i,ack,timeout;
- for (i=0;i<argc;i++) {
- timeout=5;
- do {
- ack=0;
- try {
- KbdCmdSend(KBD_CTRL,0xD4);
- KbdCmdSend(KBD_PORT,argv[i]);
- ack=KbdCmdRead;
- } catch {
- KbdCmdFlush;
- Fs->catch_except=TRUE;
- }
- } while (ack!=0xFA && --timeout);
- if (!timeout)
- throw;
- }
-}
-
-U0 KbdTypeMatic(U8 delay)
-{//Set speed of repeated keys.
- try {
- KbdCmdSend(KBD_CTRL,0xA7); //Disable Mouse
- KbdCmdSend(KBD_CTRL,0xAE); //Enable Keyboard
- KbdCmdSend(KBD_PORT,0xF3);
- KbdCmdSend(KBD_PORT,delay); //Typematic rate
- KbdCmdSend(KBD_CTRL,0xA8); //Enable Mouse
- } catch {
- KbdCmdFlush;
- Fs->catch_except=TRUE;
- }
-}
-
-I64 Char2ScanCode(I64 ch,I64 sc_flags=0)
-{//ASCII val to scan code (Slow).
- I64 i;
- U8 *table;
- if (sc_flags) {
- table=NORMAL_KEY_SCAN_DECODE_TABLE;
- if (sc_flags & SCF_CTRL || ch<26)
- table=CTRL_KEY_SCAN_DECODE_TABLE;
- else if (sc_flags & SCF_SHIFT || 'A'<=ch<='Z') {
- if (!(sc_flags & SCF_CAPS))
- table=SHIFT_KEY_SCAN_DECODE_TABLE;
- } else {
- if (sc_flags & SCF_CAPS)
- table=SHIFT_KEY_SCAN_DECODE_TABLE;
- }
- for (i=0;i<0x50;i++)
- if (table[i]==ch)
- return i|sc_flags;
- return sc_flags;
- } else {
- table=NORMAL_KEY_SCAN_DECODE_TABLE;
- for (i=0;i<0x50;i++)
- if (table[i]==ch)
- return i;
- table=SHIFT_KEY_SCAN_DECODE_TABLE;
- for (i=0;i<0x50;i++)
- if (table[i]==ch)
- return i|SCF_SHIFT;
- table=CTRL_KEY_SCAN_DECODE_TABLE;
- for (i=0;i<0x50;i++)
- if (table[i]==ch)
- return i|SCF_CTRL;
- return 0;
- }
-}
-
-U8 ScanCode2Char(I64 sc)
-{//Scan code to ASCII val.
- U8 *table=NORMAL_KEY_SCAN_DECODE_TABLE;
- if (sc&SCF_E0_PREFIX)
- return 0;
- if (sc&SCF_CTRL)
- table=CTRL_KEY_SCAN_DECODE_TABLE;
- else if (sc&SCF_SHIFT) {
- if (!(sc&SCF_CAPS))
- table=SHIFT_KEY_SCAN_DECODE_TABLE;
- } else {
- if (sc&SCF_CAPS)
- table=SHIFT_KEY_SCAN_DECODE_TABLE;
- }
- sc&=0x7F;
- if (sc>=0x50)
- return 0;
- else
- return table[sc];
-}
-
-U8 scan_code_map[0x100]={
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,SC_SHIFT,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,SC_ENTER,SC_CTRL,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0x35,0,0,SC_ALT,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,SC_HOME,
- SC_CURSOR_UP,SC_PAGE_UP,0,SC_CURSOR_LEFT,0,SC_CURSOR_RIGHT,0,SC_END,
- SC_CURSOR_DOWN,SC_PAGE_DOWN,SC_INS,SC_DELETE,0,0,0,0,
- 0,0,0,0,SC_GUI,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-};
-
-U8 num_lock_map[0x100]={
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,8,9,10,0,5,6,7,0,2,
- 3,4,11,0x34,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,SC_ENTER,SC_CTRL,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0x35,0,0,SC_ALT,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,SC_HOME,
- SC_CURSOR_UP,SC_PAGE_UP,0,SC_CURSOR_LEFT,0,SC_CURSOR_RIGHT,0,SC_END,
- SC_CURSOR_DOWN,SC_PAGE_DOWN,SC_INS,SC_DELETE,0,0,0,0,
- 0,0,0,0,SC_GUI,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-};
-
-U8 *Char2KeyName(I64 ch,Bool include_ctrl=TRUE)
-{//ASCII val to key name.
- I64 i;
- U8 buf[STR_LEN];
- if (ch<=CH_SPACE) {
- switch [ch] {
- case '\n':
- StrCpy(buf,"ENTER");
- break;
- case CH_BACKSPACE:
- StrCpy(buf,"BACKSPACE");
- break;
- case '\t':
- StrCpy(buf,"TAB");
- break;
- case CH_ESC:
- StrCpy(buf,"ESC");
- break;
- case CH_SHIFT_ESC:
- StrCpy(buf,"SHIFT_ESC");
- break;
- case 0: //nobound switch
- case 29:
- case 30:
- *buf=0;
- break;
- case CH_SHIFT_SPACE:
- StrCpy(buf,"SHIFT_SPACE");
- break;
- case CH_SPACE:
- StrCpy(buf,"SPACE");
- break;
- default:
- if (include_ctrl)
- StrCpy(buf,"CTRL");
- buf[i=StrLen(buf)]=ch-1+'a';
- buf[i+1]=0;
- break;
- }
- } else if (Bt(char_bmp_printable,ch)) {
- *buf=ch;
- buf[1]=0;
- } else
- *buf=0;
- return StrNew(buf);
-}
-
-U8 *ScanCode2KeyName(I64 sc)
-{//Scan code to key name.
- I64 ch;
- U8 buf[STR_LEN],*st;
- *buf=0;
- if (sc&SCF_CTRL)
- CatPrint(buf,"CTRL");
- if (sc&SCF_ALT)
- CatPrint(buf,"ALT");
- if (sc&SCF_SHIFT)
- CatPrint(buf,"SHIFT");
- if (sc&SCF_NO_SHIFT)
- CatPrint(buf,"");
- if (ch=ScanCode2Char(sc&255)) {
- st=Char2KeyName(ch,FALSE);
- StrCpy(buf+StrLen(buf),st);
- Free(st);
- } else {
- switch (sc&255) {
- case SC_BACKSPACE:CatPrint(buf,"BACK"); break;
- case SC_CAPS: CatPrint(buf,"CAPS"); break;
- case SC_NUM: CatPrint(buf,"NUM"); break;
- case SC_SCROLL: CatPrint(buf,"SCROLL"); break;
- case SC_CURSOR_UP:CatPrint(buf,"UP"); break;
- case SC_CURSOR_DOWN:CatPrint(buf,"DOWN"); break;
- case SC_CURSOR_LEFT:CatPrint(buf,"LEFT"); break;
- case SC_CURSOR_RIGHT:CatPrint(buf,"RIGHT"); break;
- case SC_PAGE_UP: CatPrint(buf,"PAGE_UP"); break;
- case SC_PAGE_DOWN:CatPrint(buf,"PAGE_DOWN");break;
- case SC_HOME: CatPrint(buf,"HOME"); break;
- case SC_END: CatPrint(buf,"END"); break;
- case SC_INS: CatPrint(buf,"INS"); break;
- case SC_DELETE: CatPrint(buf,"DELETE"); break;
- case SC_F1: CatPrint(buf,"F1"); break;
- case SC_F2: CatPrint(buf,"F2"); break;
- case SC_F3: CatPrint(buf,"F3"); break;
- case SC_F4: CatPrint(buf,"F4"); break;
- case SC_F5: CatPrint(buf,"F5"); break;
- case SC_F6: CatPrint(buf,"F6"); break;
- case SC_F7: CatPrint(buf,"F7"); break;
- case SC_F8: CatPrint(buf,"F8"); break;
- case SC_F9: CatPrint(buf,"F9"); break;
- case SC_F10: CatPrint(buf,"F10"); break;
- case SC_F11: CatPrint(buf,"F11"); break;
- case SC_F12: CatPrint(buf,"F12"); break;
- case SC_GUI: CatPrint(buf,"WINDOWS"); break;
- case SC_PRTSCRN1: CatPrint(buf,"PRTSCRN1"); break;
- case SC_PRTSCRN2: CatPrint(buf,"PRTSCRN2"); break;
- }
- }
- return StrNew(buf);
-}
-
-U0 KbdBuildSC(U8 raw_byte,Bool in_irq,U8 *_last_raw_byte,I64 *_last_sc)
-{
- I64 ch,sc_flags,sc,sc2,sc_raw,new_key_f;
- Bool set_LEDs=FALSE;
- if (raw_byte==0xE0) {
- *_last_sc&=~0x1FF;
- *_last_raw_byte=raw_byte;
- return;
- }
- sc=raw_byte;
- BEqu(&sc,SCf_E0_PREFIX,*_last_raw_byte==0xE0);
- BEqu(&sc,SCf_KEY_UP,raw_byte & 0x80);
- *_last_raw_byte=raw_byte;
-
- sc_flags=_last_sc->u32[0]&~0x1FF;
- sc_raw=sc;
-
- if (sc_flags & SCF_NUM) {
- if (sc2=num_lock_map[sc.u8[0]])
- sc.u8[0]=sc2;
- } else {
- if (sc2=scan_code_map[sc.u8[0]])
- sc.u8[0]=sc2;
- }
-
- new_key_f=SCF_NEW_KEY;
- if (sc&SCF_KEY_UP)
- switch (sc&~SCF_KEY_UP) {
- case SC_SHIFT: sc_flags&=~SCF_SHIFT; break;
- case SC_CTRL: sc_flags&=~SCF_CTRL; break;
- case SC_ALT: sc_flags&=~SCF_ALT; break;
- case SC_DELETE: sc_flags&=~SCF_DELETE; break;
- case SC_INS: sc_flags&=~SCF_INS; break;
- case SC_CAPS: sc_flags^=SCF_CAPS; set_LEDs=TRUE; break;
- case SC_NUM: sc_flags^=SCF_NUM; set_LEDs=TRUE; break;
- case SC_SCROLL: sc_flags^=SCF_SCROLL; set_LEDs=TRUE; break;
- }
- else
- switch (sc) {
- case SC_SHIFT:
- if (Bts(&sc_flags,SCf_SHIFT)) new_key_f=0;
- break;
- case SC_CTRL:
- if (Bts(&sc_flags,SCf_CTRL)) new_key_f=0;
- break;
- case SC_ALT:
- if (Bts(&sc_flags,SCf_ALT)) new_key_f=0;
- break;
- case SC_DELETE:
- sc_flags|=SCF_DELETE;
- break;
- case SC_INS:
- sc_flags|=SCF_INS;
- break;
- }
-
- sc_flags|=new_key_f;
- sc=sc_flags|sc|(sc_flags|sc_raw)<<32;
- if (sc_flags & SCF_CTRL && sc_flags & SCF_ALT) {
- if (!(sc&SCF_KEY_UP)) {
- if (sc&255==SC_DELETE && !(sc_flags & SCF_SHIFT))
- CtrlAltDel(sc);
- else {
- if (sc&255==SC_ESC)
- ch='t';
- else if (sc&255==SC_TAB)
- ch='n';
- else
- ch=ScanCode2Char(sc&255);
- if ('a'<=ch<='z') {
- sc&=~(SCF_NEW_KEY|SCF_NEW_KEY<<32);
- ch-='a';
- kbd.last_down_scan_code=sc;
- if (keydev.fp_ctrl_alt_cbs[ch] &&
- Bt(&keydev.ctrl_alt_in_irq_flags,ch)==in_irq &&
- (!(sc_flags & SCF_SHIFT)&&keydev.ctrl_alt_no_shift_descs[ch]) ||
- sc_flags & SCF_SHIFT && keydev.ctrl_alt_shift_descs[ch])
- (*keydev.fp_ctrl_alt_cbs[ch])(sc);
- }
- }
- }
- }
- if (set_LEDs && !in_irq)
- KbdLEDsSet(sc);
- *_last_sc=sc;
-}
-
-U0 KbdPktRead()
-{
- static U8 last_raw_byte=0;
- static I64 last_sc=0;
- U8 raw_byte;
- if (GetTSC>kbd.timestamp+cnts.time_stamp_freq>>3)
- FifoU8Flush(kbd.fifo);
- kbd.timestamp=GetTSC;
- raw_byte=InU8(KBD_PORT);
- KbdBuildSC(raw_byte,TRUE,&last_raw_byte,&last_sc);
- if (!FifoU8Cnt(kbd.fifo)) {
- FifoU8Ins(kbd.fifo,raw_byte);
- if (raw_byte!=0xE0) {
- while (FifoU8Rem(kbd.fifo,&raw_byte))
- FifoU8Ins(kbd.fifo2,raw_byte);
- }
- } else {
- FifoU8Ins(kbd.fifo,raw_byte);
- while (FifoU8Rem(kbd.fifo,&raw_byte))
- FifoU8Ins(kbd.fifo2,raw_byte);
- }
-}
-
-interrupt U0 IRQKbd()
-{
- CLD
- OutU8(0x20,0x20);
- kbd.irqs_working=TRUE;
- if (ms_hard.install_in_progress) {
- kbd.rst=TRUE;
- return;
- }
- keydev.ctrl_alt_ret_addr=GetRBP()(I64)+8;
- KbdPktRead;
-}
-
-U0 KbdInit()
-{
- try {
- KbdCmdFlush;
- KbdCmdSend(KBD_CTRL,0xA7); //Disable Mouse
- KbdCmdSend(KBD_CTRL,0xAE); //Enable Keyboard
- KbdCmdSend(KBD_PORT,0xF0);
- KbdCmdSend(KBD_PORT,0x02);
- KbdLEDsSet(kbd.scan_code);
- } catch {
- KbdCmdFlush;
- Fs->catch_except=TRUE;
- }
- IntEntrySet(0x21,&IRQKbd);
- OutU8(0x21,InU8(0x21)&~2);
-}
-
-U0 KbdHndlr()
-{
- static U8 last_raw_byte=0;
- U8 raw_byte;
- FifoU8Rem(kbd.fifo2,&raw_byte);
- KbdBuildSC(raw_byte,FALSE,&last_raw_byte,&kbd.scan_code);
- if (raw_byte==0xE0) {
- FifoU8Rem(kbd.fifo2,&raw_byte);
- KbdBuildSC(raw_byte,FALSE,&last_raw_byte,&kbd.scan_code);
- }
- if (Btr(&kbd.scan_code,SCf_NEW_KEY)) {
- kbd.new_key_timestamp=kbd.timestamp;
- Btr(&kbd.scan_code,32+SCf_NEW_KEY);
- FifoI64Ins(kbd.scan_code_fifo,kbd.scan_code);
- kbd.cnt++;
- if (!(kbd.scan_code&SCF_KEY_UP)) {
- kbd.last_down_scan_code=kbd.scan_code;
- Bts(kbd.down_bitmap,kbd.scan_code.u8[0]);
- Bts(kbd.down_bitmap2,kbd.scan_code.u8[4]);
- } else {
- Btr(kbd.down_bitmap,kbd.scan_code.u8[0]);
- Btr(kbd.down_bitmap2,kbd.scan_code.u8[4]);
- }
- }
-}
-
-I64 KbdMsgsQue()
-{
- I64 arg1,arg2,msg_code=MSG_NULL;
- CTask *task_focus;
- if (task_focus=sys_focus_task) {
- while (FifoI64Rem(kbd.scan_code_fifo,&arg2)) {
- arg1=ScanCode2Char(arg2);
- if (arg2 & SCF_KEY_UP) {
- TaskMsg(task_focus,0,MSG_KEY_UP,arg1,arg2,0);
- msg_code=MSG_KEY_UP;
- } else {
- TaskMsg(task_focus,0,MSG_KEY_DOWN,arg1,arg2,0);
- msg_code=MSG_KEY_DOWN;
- }
- }
- }
- return msg_code;
-}
-
-I64 KbdMsEvtTime()
-{//Timestamp of last key or mouse event.
- if (ms_hard.timestamp>kbd.timestamp)
- return ms_hard.timestamp;
- else
- return kbd.new_key_timestamp;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/SerialDev/MakeSerialDev.HC.HTML b/public/src/Kernel/SerialDev/MakeSerialDev.HC.HTML deleted file mode 100644 index 6e94a23..0000000 --- a/public/src/Kernel/SerialDev/MakeSerialDev.HC.HTML +++ /dev/null @@ -1,17 +0,0 @@ - - - - - MakeSerialDev.HC - - - - - #exe {Cd(__DIR__);};
-#include "Keyboard"
-#include "Mouse"
-#include "Message"
-#exe {Cd("..");};
- - - \ No newline at end of file diff --git a/public/src/Kernel/SerialDev/Message.HC.HTML b/public/src/Kernel/SerialDev/Message.HC.HTML deleted file mode 100644 index 25a8031..0000000 --- a/public/src/Kernel/SerialDev/Message.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Message.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Kernel/SerialDev/Mouse.HC.HTML b/public/src/Kernel/SerialDev/Mouse.HC.HTML deleted file mode 100644 index 45caffd..0000000 --- a/public/src/Kernel/SerialDev/Mouse.HC.HTML +++ /dev/null @@ -1,379 +0,0 @@ - - - - - Mouse.HC - - - - - U0 GridInit()
-{//Init mouse grid struct. See /Demo/Graphics/Grid.HC.
- ms_grid.x=ms_grid.y=ms_grid.z=8;
- ms_grid.x_offset=ms_grid.y_offset=ms_grid.z_offset=0;
- ms_grid.x_speed =ms_grid.y_speed =ms_grid.z_speed =1;
- ms_grid.show=ms_grid.snap=ms_grid.coord=FALSE;
-}
-
-U0 MsUpdate(I64 x,I64 y,I64 z,Bool l,Bool r)
-{
- ms.presnap.x=ToI64(ms.scale.x*x)+ms.offset.x;
- ms.presnap.y=ToI64(ms.scale.y*y)+ms.offset.y;
- ms.presnap.z=ToI64(ms.scale.z*z)+ms.offset.z;
- if (ms_grid.snap) {
- ms.pos.x=Trunc(ms.presnap.x/ms_grid.x)*ms_grid.x+ms_grid.x_offset;
- ms.pos.y=Trunc(ms.presnap.y/ms_grid.y)*ms_grid.y+ms_grid.y_offset;
- ms.pos.z=Trunc(ms.presnap.z/ms_grid.z)*ms_grid.z+ms_grid.z_offset;
- } else {
- ms.pos.x=ms.presnap.x;
- ms.pos.y=ms.presnap.y;
- ms.pos.z=ms.presnap.z;
- }
-
- ms.pos.x=ClampI64(ms.pos.x,0,GR_WIDTH-1);
- ms.pos.y=ClampI64(ms.pos.y,0,GR_HEIGHT-1);
- ms.pos_text.x=ms.pos.x/FONT_WIDTH;
- if (ms.pos_text.x>=text.cols) {
- ms.pos_text.x=text.cols-1;
- ms.pos.x=text.cols*FONT_WIDTH-1;
- }
- ms.pos_text.y=ms.pos.y/FONT_HEIGHT;
- if (ms.pos_text.y>=text.rows) {
- ms.pos_text.y=text.rows-1;
- ms.pos.y=text.rows*FONT_HEIGHT-1;
- }
- ms.lb=l;
- ms.rb=r;
- LBEqu(&kbd.scan_code,SCf_MS_L_DOWN,ms.lb);
- LBEqu(&kbd.scan_code,SCf_MS_R_DOWN,ms.rb);
-}
-
-U0 MsSet(I64 x=I64_MAX,I64 y=I64_MAX,I64 z=I64_MAX,I64 l=I64_MAX,I64 r=I64_MAX)
-{//Note: Generates a message. See MsSet().
- if (!(0<=x<GR_WIDTH))
- x=ms.pos.x;
- if (!(0<=y<GR_HEIGHT))
- y=ms.pos.y;
- if (z==I64_MAX)
- z=ms.pos.z;
-
- if (!(FALSE<=l<=TRUE))
- l=ms.lb;
- if (!(FALSE<=r<=TRUE))
- r=ms.rb;
-
- x=(x-ms.offset.x)/ms.scale.x;
- y=(y-ms.offset.y)/ms.scale.y;
- z=(z-ms.offset.z)/ms.scale.z;
- MsUpdate(x,y,z,l,r);
- MsHardSet(x,y,z,l,r);
-}
-
-U0 MsInit()
-{
- MemSet(&ms,0,sizeof(CMsStateGlbls));
- MemSet(&ms_last,0,sizeof(CMsStateGlbls));
- ms.offset.x=ms.offset.y=ms.offset.z=0;
- ms.scale.x=ms.scale.y=ms.scale.z=1.0;
- ms.pos_text.x=ms.pos_text.y=ms.pos_text.z=0;
- ms.has_wheel=FALSE;
- ms.show=TRUE;
- ms.speed=0;
- ms.timestamp=GetTSC;
- ms.dbl_time=0.350;
- GridInit;
-}
-
-U0 MsHardPktRead()
-{
- U8 j;
- if (GetTSC>ms_hard.timestamp+cnts.time_stamp_freq>>3)
- FifoU8Flush(ms_hard.fifo);
- ms_hard.timestamp=GetTSC;
- FifoU8Ins(ms_hard.fifo,InU8(KBD_PORT));
- if (FifoU8Cnt(ms_hard.fifo)==ms_hard.pkt_size)
- while (FifoU8Rem(ms_hard.fifo,&j))
- FifoU8Ins(ms_hard.fifo2,j);
-}
-
-interrupt U0 IRQMsHard()
-{
- CLD
- OutU8(0xA0,0x20);
- OutU8(0x20,0x20);
- ms_hard.irqs_working=TRUE;
- if (ms_hard.install_in_progress || !ms_hard.installed) {
- kbd.rst=TRUE;
- return;
- }
- MsHardPktRead;
-}
-
-U0 MsHardGetType()
-{
- I64 b;
- KbdMsCmdAck(0xF2);
- b=KbdCmdRead;
- if (b==3)
- ms_hard.has_wheel=TRUE;
- else if (b==4)
- ms_hard.has_ext_bttns=TRUE;
-}
-
-Bool MsHardRst()
-{
- U8 b,*_b;
- F64 timeout;
- Bool res=FALSE;
-
- ms_hard.has_wheel=FALSE;
- ms_hard.has_ext_bttns=FALSE;
-
- if (*0x40E(U16 *)==0x9FC0) {
- _b=0x9FC00+0x30;
- *_b=1; //This enables my mouse. It might be for one machine.
-//USB DMA packets, set-up by BIOS to make legacy PS/2?
- }
-
- try {
- KbdCmdFlush;
- KbdCmdSend(KBD_CTRL,0xAD); //Disable Kbd
- KbdCmdSend(KBD_CTRL,0xA8); //Enable Mouse
-
- KbdMsCmdAck(0xFF); //Rst
-
- timeout=tS+10.0;
- do
- try {
- KbdCmdRead;
- timeout=0; //force exit
- } catch
- Fs->catch_except=TRUE;
- while (tS<timeout);
-
- try
- KbdCmdRead;
- catch
- Fs->catch_except=TRUE;
-
- KbdMsCmdAck(0xF3,200,0xF3,100,0xF3,80);
- MsHardGetType;
- KbdMsCmdAck(0xF3,10);
- MsHardGetType;
- KbdMsCmdAck(0xE8,0x03,0xE6,0xF3,100,0xF4);
- res=TRUE;
-
- //Enable IRQ 12
- KbdCmdSend(KBD_CTRL,0x20);
- b=KbdCmdRead;
- KbdCmdSend(KBD_CTRL,0x60);
- KbdCmdSend(KBD_PORT,(b|2)&~0x20);
-
- } catch
- Fs->catch_except=TRUE;
-
- //This is been added to override failure
- //because the mouse sometimes still works.
- res=TRUE;
-
- try
- KbdCmdSend(KBD_CTRL,0xAE); //Enable Keyboard
- catch
- Fs->catch_except=TRUE;
- if (ms_hard.has_wheel || ms_hard.has_ext_bttns)
- ms_hard.pkt_size=4;
- else
- ms_hard.pkt_size=3;
- if (!res)
- try
- KbdCmdSend(KBD_CTRL,0xA7); //Disable Mouse
- catch
- Fs->catch_except=TRUE;
- return res;
-}
-
-U0 MsHardSpeedSet()
-{
- I64 dd,tmp;
- if ((dd=SqrI64(ms_hard_last.pos.x-ms_hard.pos.x)
- +SqrI64(ms_hard_last.pos.y-ms_hard.pos.y)) &&
- (tmp=ms_hard.timestamp-ms_hard_last.timestamp))
- ms_hard.speed=Sqrt(dd)*cnts.time_stamp_freq/tmp;
- ms_hard_last.timestamp=ms_hard.timestamp;
-}
-
-U0 MsHardSetPre()
-{
- I64 old_timestamp=ms_hard_last.timestamp;
- MemCpy(&ms_hard_last,&ms_hard,sizeof(CMsHardStateGlbls));
- ms_hard_last.timestamp=old_timestamp;
-}
-
-U0 MsHardSetPost()
-{
- I64 i;
- ms_hard.pos.x=ms_hard.prescale.x*ms_hard.scale.x*ms_grid.x_speed;
- ms_hard.pos.y=ms_hard.prescale.y*ms_hard.scale.y*ms_grid.y_speed;
- ms_hard.pos.z=ms_hard.prescale.z*ms_hard.scale.z*ms_grid.z_speed;
-
- i=Trunc(ms.scale.x*ms_hard.pos.x/ms_grid.x)*ms_grid.x+ms.offset.x;
-//TODO ms_grid.x_offset?
- if (i<0)
- ms.offset.x-=i;
- else if (i>=GR_WIDTH)
- ms.offset.x+=GR_WIDTH-1-i;
-
- i=Trunc(ms.scale.y*ms_hard.pos.y/ms_grid.y)*ms_grid.y+ms.offset.y;
- if (i<0)
- ms.offset.y-=i;
- else if (i>=GR_HEIGHT)
- ms.offset.y+=GR_HEIGHT-1-i;
-
- if (ms_hard.pos.x!=ms_hard_last.pos.x || ms_hard.pos.y!=ms_hard_last.pos.y ||
- ms_hard.pos.z!=ms_hard_last.pos.z) {
- ms_hard.evt=TRUE;
- MsHardSpeedSet;
- } else
- for (i=0;i<5;i++)
- if (ms_hard.bttns[i]!=ms_hard_last.bttns[i]) {
- ms_hard.evt=TRUE;
- break;
- }
-}
-
-U0 MsHardHndlr()
-{
- I64 i,dx,dy,dz;
- U8 ms_buf[4];
-
- MsHardSetPre;
- for (i=0;i<4;i++)
- ms_buf[i]=0;
- for (i=0;i<ms_hard.pkt_size;i++)
- if (!FifoU8Rem(ms_hard.fifo2,&ms_buf[i]))
- ms_buf[i]=0;
-
- ms_hard.bttns[0] = ms_buf[0] & 1;
- ms_hard.bttns[1] = (ms_buf[0] & 2) >> 1;
- ms_hard.bttns[2] = (ms_buf[0] & 4) >> 2;
- ms_hard.bttns[3] = (ms_buf[3] & 0x10) >> 4;
- ms_hard.bttns[4] = (ms_buf[3] & 0x20) >> 5;
- if (ms_buf[0] & 0x10)
- dx=ms_buf[1]-256;
- else
- dx=ms_buf[1];
- if (ms_buf[0] & 0x20)
- dy=256-ms_buf[2];
- else
- dy=-ms_buf[2];
- if (ms_buf[3] & 0x08)
- dz=ms_buf[3]&7-8;
- else
- dz=ms_buf[3]&7;
-
- ms_hard.prescale.x+=dx;
- ms_hard.prescale.y+=dy;
- ms_hard.prescale.z+=dz;
-
- MsHardSetPost;
-}
-
-U0 MsHardSet(I64 x,I64 y,I64 z,I64 l,I64 r)
-{
- ms_hard.timestamp=GetTSC;
- MsHardSetPre;
- ms_hard.prescale.x=x/ms_hard.scale.x/ms_grid.x_speed;
- ms_hard.prescale.y=y/ms_hard.scale.y/ms_grid.y_speed;
- ms_hard.prescale.z=z/ms_hard.scale.z/ms_grid.z_speed;
- ms_hard.bttns[0]=l;
- ms_hard.bttns[1]=r;
- MsHardSetPost;
-}
-
-U0 KbdMsRst()
-{
- KbdCmdFlush;
- FifoU8Flush(kbd.fifo2);
- FifoU8Flush(ms_hard.fifo2);
- FifoI64Flush(kbd.scan_code_fifo);
- kbd.scan_code=0;
- kbd.rst=FALSE;
-}
-
-Bool MsHardDrvrInstall(I64 dummy=0) //can be spawned
-{
- no_warn dummy;
- I64 i;
- ms_hard.install_in_progress=TRUE;
- OutU8(0xA1,InU8(0xA1)|0x10);
- ms_hard.installed=ms_hard.irqs_working=FALSE;
- IntEntrySet(0x2C,&IRQMsHard);
- for(i=0;i<5;i++)
- ms_hard.bttns[i]=0;
- if (i=MsHardRst)
- OutU8(0xA1,InU8(0xA1)&~0x10);
- KbdMsRst;
- ms_hard.install_attempts++;
- ms_hard.installed=ms_hard.evt=i;
- ms_hard.install_in_progress=FALSE;
- return ms_hard.installed;
-}
-
-U0 KbdMsHndlr(Bool poll_kbd,Bool poll_ms)
-{
- if (ms_hard.install_in_progress) {
- Yield;
- return;
- }
- if (kbd.rst)
- KbdMsRst;
- else {
- if (poll_ms && ms_hard.installed && !ms_hard.irqs_working) {
- PUSHFD
- CLI
- while (InU8(KBD_CTRL)&1)
- MsHardPktRead;
- POPFD
- }
-
- if (poll_kbd)
- while (InU8(KBD_CTRL)&1)
- KbdPktRead;
-
- if (kbd.rst)
- KbdMsRst;
- else {
- while (FifoU8Cnt(kbd.fifo2))
- KbdHndlr;
- while (FifoU8Cnt(ms_hard.fifo2))
- if (ms_hard.installed)
- MsHardHndlr;
- else
- KbdMsRst;
- }
- }
-}
-
-U0 KbdMsInit()
-{
- MemSet(&kbd,0,sizeof(CKbdStateGlbls));
- kbd.fifo=FifoU8New(8);
- kbd.fifo2=FifoU8New(0x1000);
- kbd.scan_code_fifo=FifoI64New(0x1000);
- kbd.irqs_working=FALSE;
- MemSet(&ms_hard,0,sizeof(CMsHardStateGlbls));
- ms_hard.fifo=FifoU8New(8);
- ms_hard.fifo2=FifoU8New(0x1000);
- ms_hard.scale.x=0.5;
- ms_hard.scale.y=0.5;
- ms_hard.scale.z=1.0;
- ms_hard.prescale.x=GR_WIDTH/ms_hard.scale.x/2.0;
- ms_hard.prescale.y=GR_HEIGHT/ms_hard.scale.y/2.0;
- ms_hard.prescale.z=0/ms_hard.scale.z;
- ms_hard.pos.x=GR_WIDTH>>1;
- ms_hard.pos.y=GR_HEIGHT>>1;
- MemCpy(&ms_hard_last,&ms_hard,sizeof(CMsHardStateGlbls));
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/StrA.HC.HTML b/public/src/Kernel/StrA.HC.HTML deleted file mode 100644 index ddf553f..0000000 --- a/public/src/Kernel/StrA.HC.HTML +++ /dev/null @@ -1,698 +0,0 @@ - - - - - StrA.HC - - - - - U8 *StrPrintHex(U8 *dst,I64 num;I64 width)
-{
- U8 *res=dst+width;
- dst=res;
- while (width--) {
- *--dst="0123456789ABCDEF"(U8 *)[num&15];
- num>>=4;
- }
- return res;
-}
-
-U0 PutHex(I64 num,I64 width)
-{
- U8 buf[17];
- if (width>16) width=16;
- *StrPrintHex(buf,num,width)=0;
- "%s",buf;
-}
-
-asm {
-// IN: RAX=NUM TO PRINT
-PUT_HEX_U64::
- PUSH_C_REGS
- PUSH 16
- PUSH RAX
- CALL &PutHex
- POP_C_REGS
- RET
-PUT_HEX_U32::
- PUSH_C_REGS
- PUSH 8
- PUSH RAX
- CALL &PutHex
- POP_C_REGS
- RET
-PUT_HEX_U16::
- PUSH_C_REGS
- PUSH 4
- PUSH RAX
- CALL &PutHex
- POP_C_REGS
- RET
-PUT_HEX_U8::
- PUSH_C_REGS
- PUSH 2
- PUSH RAX
- CALL &PutHex
- POP_C_REGS
- RET
-PUT_CHARS::
-// IN: RAX=Char
- PUSH_C_REGS
- PUSH RAX
- CALL &PutChars
- POP_C_REGS
- RET
-PUT_STR::
-// IN: RSI=String
- PUSH_C_REGS
- PUSH RSI
- CALL &PutS
- POP_C_REGS
- RET
-_STRCPY::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
- MOV RDI,U64 SF_ARG1[RBP]
- TEST RDI,RDI
- JZ @@15
- MOV RSI,U64 SF_ARG2[RBP]
- TEST RSI,RSI
- JNZ @@05
- XOR RAX,RAX
- JMP @@10
-@@05: LODSB
-@@10: STOSB
- TEST AL,AL
- JNZ @@05
-@@15: POP RDI
- POP RSI
- POP RBP
- RET1 16
-_STRCMP::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
- MOV RSI,U64 SF_ARG2[RBP]
- MOV RDI,U64 SF_ARG1[RBP]
-@@05: LODSB
- TEST AL,AL
- JZ @@20
- SCASB
- JE @@05
- JA @@15
-@@10: MOV RAX,1
- JMP @@25
-@@15: MOV RAX,-1
- JMP @@25
-@@20: SCASB
- JNE @@10
- XOR RAX,RAX
-@@25: POP RDI
- POP RSI
- POP RBP
- RET1 16
-TO_UPPER::
- CMP AL,'a'
- JB @@05
- CMP AL,'z'
- JA @@05
- ADD AL,'A'-'a'
-@@05: RET
-_STRICMP::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
- MOV RSI,U64 SF_ARG2[RBP]
- MOV RDI,U64 SF_ARG1[RBP]
-@@05: LODSB
- TEST AL,AL
- JZ @@30
- CMP AL,'a'
- JB @@10
- CMP AL,'z'
- JA @@10
- ADD AL,'A'-'a'
-@@10: MOV BL,U8 [RDI]
- INC RDI
- CMP BL,'a'
- JB @@15
- CMP BL,'z'
- JA @@15
- ADD BL,'A'-'a'
-@@15: CMP AL,BL
- JE @@05
- JA @@25
-@@20: MOV RAX,1
- JMP @@35
-@@25: MOV RAX,-1
- JMP @@35
-@@30: MOV BL,U8 [RDI]
- TEST BL,BL
- JNE @@20
- XOR RAX,RAX
-@@35: POP RDI
- POP RSI
- POP RBP
- RET1 16
-_STRNCMP::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
- MOV RCX,U64 SF_ARG3[RBP]
- MOV RSI,U64 SF_ARG2[RBP]
- MOV RDI,U64 SF_ARG1[RBP]
-@@05: TEST RCX,RCX
- JZ @@25
- DEC RCX
- LODSB
- TEST AL,AL
- JZ @@20
- SCASB
- JE @@05
- JA @@15
-@@10: MOV RAX,1
- JMP @@30
-@@15: MOV RAX,-1
- JMP @@30
-@@20: MOV BL,U8 [RDI]
- TEST BL,BL
- JNE @@10
-@@25: XOR RAX,RAX
-@@30: POP RDI
- POP RSI
- POP RBP
- RET1 24
-_STRNICMP::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
- MOV RCX,U64 SF_ARG3[RBP]
- MOV RSI,U64 SF_ARG2[RBP]
- MOV RDI,U64 SF_ARG1[RBP]
-@@05: TEST RCX,RCX
- JZ @@35
- DEC RCX
- LODSB
- TEST AL,AL
- JZ @@30
- CMP AL,'a'
- JB @@10
- CMP AL,'z'
- JA @@10
- ADD AL,'A'-'a'
-@@10: MOV BL,U8 [RDI]
- INC RDI
- CMP BL,'a'
- JB @@15
- CMP BL,'z'
- JA @@15
- ADD BL,'A'-'a'
-@@15: CMP AL,BL
- JE @@05
- JA @@25
-@@20: MOV RAX,1
- JMP @@40
-@@25: MOV RAX,-1
- JMP @@40
-@@30: SCASB
- JNE @@20
-@@35: XOR RAX,RAX
-@@40: POP RDI
- POP RSI
- POP RBP
- RET1 24
-_STRMATCH::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
- MOV RSI,U64 SF_ARG2[RBP]
- TEST RSI,RSI
- JZ @@25
- MOV RDI,U64 SF_ARG1[RBP]
- TEST RDI,RDI
- JZ @@25
- MOV DL,U8 [RDI]
- TEST DL,DL
- JZ @@20
- JMP @@10
-@@05: INC RSI
-@@10: LODSB
- TEST AL,AL
- JZ @@25
- CMP AL,DL
- JNE @@10
- DEC RSI
- MOV RCX,1
-@@15: MOV AL,U8 [RDI+RCX]
- TEST AL,AL
- JZ @@20
- CMP AL,U8 [RSI+RCX]
- JNE @@05
- INC RCX
- JMP @@15
-
- DEC RSI
-@@20: MOV RAX,RSI
- JMP @@30
-@@25: XOR RAX,RAX
-@@30: POP RDI
- POP RSI
- POP RBP
- RET1 16
-_STRIMATCH::
- PUSH RBP
- MOV RBP,RSP
- PUSH RSI
- PUSH RDI
- MOV RSI,U64 SF_ARG2[RBP]
- TEST RSI,RSI
- JZ @@25
- MOV RDI,U64 SF_ARG1[RBP]
- TEST RDI,RDI
- JZ @@25
- MOV AL,U8 [RDI]
- CALL TO_UPPER
- MOV DL,AL
- TEST DL,DL
- JZ @@20
- JMP @@10
-@@05: INC RSI
-@@10: LODSB
- CALL TO_UPPER
- TEST AL,AL
- JZ @@25
- CMP AL,DL
- JNE @@10
- DEC RSI
- MOV RCX,1
-@@15: MOV AL,U8 [RDI+RCX]
- CALL TO_UPPER
- TEST AL,AL
- JZ @@20
- MOV BL,U8 [RSI+RCX]
- XCHG AL,BL
- CALL TO_UPPER
- CMP AL,BL
- JNE @@05
- INC RCX
- JMP @@15
-
- DEC RSI
-@@20: MOV RAX,RSI
- JMP @@30
-@@25: XOR RAX,RAX
-@@30: POP RDI
- POP RSI
- POP RBP
- RET1 16
-}
-_extern _STRCMP I64 StrCmp(
- U8 *st1,U8 *st2); //Compare two strings.
-_extern _STRICMP I64 StrICmp(
- U8 *st1,U8 *st2); //Compare two strings, ignoring case.
-_extern _STRNCMP I64 StrNCmp(
- U8 *st1,U8 *st2,I64 n); //Compare N bytes in two strings.
-_extern _STRNICMP I64 StrNICmp(
- U8 *st1,U8 *st2,I64 n); //Compare N bytes in two strings, ignoring case.
-_extern _STRMATCH U8 *StrMatch(
- U8 *needle,U8 *haystack_str); //Scan for string in string.
-_extern _STRIMATCH U8 *StrIMatch(
- U8 *needle,U8 *haystack_str);//Scan for string in string, ignoring case.
-_extern _STRCPY U0 StrCpy(
- U8 *dst,U8 *src); //Copy string.
-
-//These bitmaps go to 0-511 so that Lex() can use them with Token Codes.
-U32
- char_bmp_alpha[16]=
- {0x0000000,0x00000000,0x87FFFFFF,0x07FFFFFE,
- 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
- 0,0,0,0,0,0,0,0},
-
- char_bmp_alpha_numeric[16]=
- {0x0000000,0x03FF0000,0x87FFFFFF,0x07FFFFFE,
- 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
- 0,0,0,0,0,0,0,0},
-
- char_bmp_alpha_numeric_no_at[16]=
- {0x0000000,0x03FF0000,0x87FFFFFE,0x07FFFFFE,
- 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
- 0,0,0,0,0,0,0,0},
-
- char_bmp_word[16]=
- {0x0000000,0x03FF0080,0x87FFFFFE,0x07FFFFFE,
- 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
- 0,0,0,0,0,0,0,0},
-
- char_bmp_filename[16]=
- {0x0000000,0x03FF73FB,0xEFFFFFFF,0x6FFFFFFF,
- 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
- 0,0,0,0,0,0,0,0},
-
- char_bmp_dec_numeric[16]=
- {0x0000000,0x03FF0000,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
-
- char_bmp_hex_numeric[16]=
- {0x0000000,0x03FF0000,0x7E,0x7E,0,0,0,0,0,0,0,0,0,0,0,0},
-
- char_bmp_white_space[16]=
- {0x80002600,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
-
- char_bmp_non_eol_white_space[16]=
- {0x80000200,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
-
- char_bmp_zero_cr_nl_cursor[16]=
- {0x00002421,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
-
- char_bmp_zero_tab_cr_nl_cursor[16]=
- {0x00002621,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
-
- char_bmp_zero_tab_cr_nl_cursor_dollar[16]=
- {0x00002621,0x10,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
-
- char_bmp_macro[16]=
- {0x80002600,0xFFFFFFDF,0xFFFFFFFF,0x7FFFFFFF,
- 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
- 0,0,0,0,0,0,0,0},
-
- char_bmp_printable[16]=
- {0x80002600,0xFFFFFFFF,0xFFFFFFFF,0x7FFFFFFF,
- 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
- 0,0,0,0,0,0,0,0},
-
- char_bmp_displayable[16]=
- {0x80000000,0xFFFFFFFF,0xFFFFFFFF,0x7FFFFFFF,
- 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
- 0,0,0,0,0,0,0,0},
-
- char_bmp_safe_dollar[16]=
- {0x80000000,0xFFFFFFEF,0xFFFFFFFF,0x7FFFFFFF,
- 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
- 0,0,0,0,0,0,0,0},//same but no dollar sign
-
- char_bmp_non_eol[16]=
- {0xFFFFDBFE,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
- 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
- 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
- 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF};
-
-U8 *LstSub(I64 sub, U8 *lst)
-{//Point to lst entry.
-//Not efficient.Use an array of U8 ptrs for efficiency.
- if (!lst) return NULL;
- while (*lst && sub>0) {
- while (*lst) //Advance to end of cur entry.
- lst++;
- lst++; //Skip trailing zero.
- if (*lst=='@') //Check for '@' alias lst entry.
- lst++;
- else
- sub--;
- }
- if (sub||!*lst)
- return NULL;
- else
- return lst;
-}
-
-I64 LstMatch(U8 *needle, U8 *haystack_lst,I64 flags=0)
-{//-2 if Ambiguous
-// -1 if not found
- // Not efficient. Use hash tables for efficiency.
- I64 n,sub=0,res=-1;
- U8 *ptr;
- Bool exact_match=FALSE;
- if (!haystack_lst) return -1;
- n=StrLen(needle);
- while (*haystack_lst) {
- if (*haystack_lst=='@') { //Check for '@' alias haystack_lst entry
- sub--;
- haystack_lst++;
- }
- ptr=needle;
- if (flags & LMF_IGNORE_CASE)
- while (*ptr && ToUpper(*ptr)==ToUpper(*haystack_lst)) {
- ptr++;
- haystack_lst++;
- }
- else
- while (*ptr && *ptr==*haystack_lst) {
- ptr++;
- haystack_lst++;
- }
- if (!*ptr) { //Did we reach end of needle?
- if (!*haystack_lst) //Did we reach end of haystack_lst?
- return sub; //Found Exact match
- else {
- if (res!=-1) {
- if (!exact_match)
- res=-2; //Ambiguous unless later exact match.
- } else {
- if (!(flags & LMF_EXACT))
- res=sub;
- }
- }
- }
- while (*haystack_lst) //Advance to end of cur entry.
- haystack_lst++;
- haystack_lst++; //Skip trailing zero
- sub++;
- }
- return res;
-}
-
-I64 StrOcc(U8 *src, I64 ch)
-{//Count occurrences of a char.
- I64 i=0;
- if (!src) return 0;
- while (*src)
- if (*src++==ch)
- i++;
- return i;
-}
-
-I64 Spaces2Tabs(U8 *dst,U8 *src)
-{//Src buf with spaces to dst buf without.
- U8 *src2;
- I64 chged=0,space_cnt,space_cnt2,col=0;
- if (*src)
- while (TRUE) {
- src2=src;
- while (*src2==CH_SPACE)
- src2++;
- space_cnt=src2-src;
- while (col+space_cnt>=8) {
- space_cnt2=8-col;
- if (space_cnt2==1)
- *dst++=CH_SPACE;
- else {
- *dst++='\t';
- chged+=space_cnt2-1;
- }
- space_cnt-=space_cnt2;
- col=0;
- }
- if (*src2=='\t') {
- if (space_cnt==1 && col==7)
- *dst++=CH_SPACE;
- else
- chged+=space_cnt;
- *dst++='\t';
- col=0;
- } else {
- while (space_cnt--) {
- *dst++=CH_SPACE;
- if (++col==8)
- col=0;
- }
- if (*src2) {
- *dst++=*src2;
- if (++col==8)
- col=0;
- } else
- break;
- }
- src=++src2;
- }
- *dst=0;
- return chged;
-}
-
-U8 *StrUtil(U8 *_src,I64 flags)
-{//Modifies in place. See flags for all the options.
- U8 *src=_src,*dst=_src;
- I64 ch;
-
- if (flags & SUF_REM_LEADING)
- while (Bt(char_bmp_white_space,*src))
- src++;
- while (ch=*src++)
- if (Bt(char_bmp_white_space,ch)) {
- if (!(flags & SUF_REM_SPACES)) {
- if (flags & SUF_SINGLE_SPACE) {
- *dst++ = CH_SPACE;
- while ((ch=*src++) && Bt(char_bmp_white_space,ch));
- src--;
- } else
- *dst++ = ch;
- }
- } else if (!(flags & SUF_REM_CTRL_CHARS) || ch>=CH_SHIFT_SPACE)
- *dst++=ch;
- *dst=0;
-
- if (flags & SUF_REM_TRAILING)
- while (dst!=_src && (!*dst || Bt(char_bmp_white_space,*dst)))
- *dst-- =0;
- if (flags & SUF_TO_UPPER)
- for (dst=_src;*dst;dst++) {
- ch=*dst;
- if ('a'<=ch<='z')
- *dst=ch-0x20;
- }
- if (flags & SUF_TO_LOWER)
- for (dst=_src;*dst;dst++) {
- ch=*dst;
- if ('A'<=ch<='Z')
- *dst=ch+0x20;
- }
- if (flags & SUF_SAFE_DOLLAR)
- for (dst=_src;*dst;dst++) {
- ch=*dst;
- if (!Bt(char_bmp_safe_dollar,*dst))
- *dst='.';
- }
- if (flags & SUF_S2T)
- Spaces2Tabs(_src,_src);
- return _src;
-}
-
-U8 *StrFirstOcc(U8 *src,U8 *marker)
-{//Point to 1st occurrence of marker set in str.
- I64 ch;
- while ((ch=*src++) && !StrOcc(marker,ch));
- if (ch)
- return src-1;
- else
- return NULL;
-}
-
-U8 *StrFirstRem(U8 *src,U8 *marker,U8 *dst=NULL)
-{//Remove first str segment and place in dst buf or NULL.
- I64 ch;
- U8 *ptr=src,*res=dst;
- if (dst) {
- while ((ch=*ptr++) && !StrOcc(marker,ch))
- *dst++=ch;
- *dst=0;
- } else
- while ((ch=*ptr++) && !StrOcc(marker,ch));
- if (ch)
- StrCpy(src,ptr);
- else
- *src=0;
- return res;
-}
-
-U8 *StrLastOcc(U8 *src,U8 *marker)
-{//Point to last occurrence of market set in str.
- I64 ch;
- U8 *res=NULL;
- while (ch=*src++)
- if (StrOcc(marker,ch))
- res=src-1;
- return res;
-}
-
-U8 *StrLastRem(U8 *src,U8 *marker,U8 *dst=NULL)
-{//Remove last str segment and place in dst buf or NULL.
- U8 *ptr;
- if (ptr=StrLastOcc(src,marker)) {
- if (dst)
- StrCpy(dst,ptr+1);
- *ptr=0;
- } else {
- if (dst)
- StrCpy(dst,src);
- *src=0;
- }
- return dst;
-}
-
-U8 *StrFind(U8 *needle,U8 *haystack_str,I64 flags=0)
-{//Find needle_str in haystack_str with options.
- Bool cont;
- U8 *saved_haystack_str=haystack_str;
- I64 plen=StrLen(needle);
- do {
- cont=FALSE;
- if (flags & SFF_IGNORE_CASE)
- haystack_str=StrIMatch(needle,haystack_str);
- else
- haystack_str=StrMatch(needle,haystack_str);
- if (haystack_str && flags & SFF_WHOLE_LABELS_BEFORE &&
- haystack_str!=saved_haystack_str &&
- Bt(char_bmp_alpha_numeric,*(haystack_str-1))) {
- haystack_str++;
- if (*haystack_str)
- cont=TRUE;
- else
- haystack_str=NULL;
- }
- if (haystack_str && flags & SFF_WHOLE_LABELS_AFTER &&
- Bt(char_bmp_alpha_numeric,*(haystack_str+plen))) {
- haystack_str++;
- if (*haystack_str)
- cont=TRUE;
- else
- haystack_str=NULL;
- }
- } while (cont);
- return haystack_str;
-}
-
-Bool WildMatch(U8 *test_str,U8 *wild_str)
-{//Wildcard match with '*' and '?'.
- I64 ch1,ch2;
- U8 *fall_back_src=NULL,*fall_back_wild=NULL;
- while (TRUE) {
- if (!(ch1=*test_str++)) {
- if (*wild_str && *wild_str!='*')
- return FALSE;
- else
- return TRUE;
- } else {
- if (!(ch2=*wild_str++))
- return FALSE;
- else {
- if (ch2=='*') {
- fall_back_wild=wild_str-1;
- fall_back_src=test_str;
- if (!(ch2=*wild_str++))
- return TRUE;
- while (ch2!=ch1)
- if (!(ch1=*test_str++))
- return FALSE;
- } else
- if (ch2!='?' && ch1!=ch2) {
- if (fall_back_wild) {
- wild_str=fall_back_wild;
- test_str=fall_back_src;
- fall_back_wild=NULL;
- fall_back_src=NULL;
- } else
- return FALSE;
- }
- }
- }
- }
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/StrB.HC.HTML b/public/src/Kernel/StrB.HC.HTML deleted file mode 100644 index 52e7adf..0000000 --- a/public/src/Kernel/StrB.HC.HTML +++ /dev/null @@ -1,199 +0,0 @@ - - - - - StrB.HC - - - - - U8 *Tabs2Spaces(U8 *src)
-{//MAlloc str with tabs to spaces.
- I64 ch,i,j,l=StrLen(src)<<1+2,col=0;
- U8 *dst=MAlloc(l),*tmp;
- while (ch=*src++) {
- if (ch=='\t') {
- j=(col+8) & ~7;
- for (i=col;i<j;i++) {
- dst[i]=CH_SPACE;
- if (i>=l-2) {
- tmp=MAlloc(l<<1);
- MemCpy(tmp,dst,i+1);
- Free(dst);
- l<<=1;
- dst=tmp;
- }
- }
- col=j;
- } else {
- dst[col]=ch;
- if (col>=l-2) {
- tmp=MAlloc(l<<1);
- MemCpy(tmp,dst,col+1);
- Free(dst);
- l<<=1;
- dst=tmp;
- }
- col++;
- }
- }
- dst[col]=0;
- return dst;
-}
-
-U8 *ScaleIndent(U8 *src,F64 indent_scale_factor)
-{//MAlloced str. 8*0.25-->2 or 8*2.0-->16
- I64 ch,i,col=0;
- U8 *dst,*dst2;
- while (ch=*src++) {
- if (ch=='\t')
- col=(col+8) & -0x8;
- else if (ch==CH_SPACE)
- col++;
- else
- break;
- }
- src--;
- col=Round(indent_scale_factor*col);
- dst=dst2=MAlloc(StrLen(src)+col/8+col&7+1);
- for (i=col/8;i>0;i--)
- *dst2++='\t';
- for (i=col&7;i>0;i--)
- *dst2++=CH_SPACE;
- StrCpy(dst2,src);
- return dst;
-}
-
-U8 *MStrUtil(U8 *src,I64 flags,F64 indent_scale_factor=0)
-{//MAlloc StrUtil().
- U8 *dst=StrNew(src),*dst2,*tmp;
- StrUtil(dst,flags);
- if (flags & SUF_T2S) {
- tmp=Tabs2Spaces(dst);
- Free(dst);
- dst=tmp;
- }
- if (flags & SUF_SCALE_INDENT)
- dst2=ScaleIndent(dst,indent_scale_factor);
- else
- dst2=StrNew(dst); //Shorten to just right size.
- Free(dst);
- return dst2;
-}
-
-U0 GetOutOfDollar()
-{//If a $ has been printed, print another $ to exit mode.
- CDoc *doc;
- if (IsRaw) {
- if (text.raw_flags&RWF_IN_DOLLAR)
- '$';
- } else {
- if (fp_doc_put && (doc=(*fp_doc_put)(Fs)) && doc->flags&DOCF_IN_DOLLAR)
- '$';
- }
-}
-
-Bool YorN()
-{//Wait for user to answer Y or N.
- I64 ch;
- "(y or n)? ";
- while (TRUE) {
- ch=ToUpper(GetChar(,FALSE));
- if (ch=='Y') {
- "$PT$YES$FG$\n";
- return TRUE;
- } else if (ch=='N') {
- "$PT$NO$FG$\n";
- return FALSE;
- }
- }
-}
-
-I64 PressAKey()
-{//Print "Press a key" and wait for non-zero ASCII key.
- "$BK,1$PRESS A KEY$BK,0$\n";
- return GetChar(,FALSE);
-}
-
-Bool AreYouSure()
-{//Print "Are you sure" and waits for Y or N.
- "ARE YOU SURE ";
- return YorN;
-}
-
-U0 Help()
-{//Dbg help or master help index file.
- if (IsDbgMode)
- DbgHelp;
- else
- PopUp("Type(\"::/Doc/HelpIndex.DD\");DocTop;View;");
-}
-
-U0 ScanFlags(U8 *_dst_flags,U8 *lst,U8 *src)
-{/*More than 64 flags. Flags passed by ref.
-
-Examples:
-ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
-
-I64 flags=0;
-ScanFlags(&flags,"R\0L\0Dump\0Scan\0","+Dump-R"); //Sets Bit#2, Clears Bit#0.
-*/
- I64 i;
- U8 *buf,*ptr;
- if (src) {
- buf=MAlloc(StrLen(src)+1);
- while (*src) {
- while (*src && *src!='+' && *src!='-')
- src++;
- if (*src=='+') {
- src++;
- if (*src) {
- ptr=buf;
- while (*src && *src!='+' && *src!='-' &&
- *src!=CH_SPACE && *src!=CH_SHIFT_SPACE)
- *ptr++=*src++;
- *ptr=0;
- i=LstMatch(buf,lst);
- if (i>=0)
- LBts(_dst_flags,i);
- else {
- Free(buf);
- throw('ScanFlag');
- }
- }
- } else if (*src=='-') {
- src++;
- if (*src) {
- ptr=buf;
- while (*src && *src!='+' && *src!='-' &&
- *src!=CH_SPACE && *src!=CH_SHIFT_SPACE)
- *ptr++=*src++;
- *ptr=0;
- i=LstMatch(buf,lst);
- if (i>=0)
- LBtr(_dst_flags,i);
- else {
- Free(buf);
- throw('ScanFlag');
- }
- }
- }
- }
- Free(buf);
- }
-}
-
-U8 *StrPrintFlags(U8 *dst,U8 *lst,I64 flags)
-{//Only 64 flags. Flags passed by value.
- I64 i;
- *dst=0;
- while (flags) {
- i=Bsf(flags);
- Btr(&flags,i);
- CatPrint(dst,"+%z",i,lst);
- }
- return dst;
-}
- - - \ No newline at end of file diff --git a/public/src/Kernel/StrPrint.HC.HTML b/public/src/Kernel/StrPrint.HC.HTML deleted file mode 100644 index 0b34507..0000000 --- a/public/src/Kernel/StrPrint.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - StrPrint.HC - - - - - - - \ No newline at end of file diff --git a/public/src/Kernel/StrScan.HC.HTML b/public/src/Kernel/StrScan.HC.HTML deleted file mode 100644 index 306fe95..0000000 --- a/public/src/Kernel/StrScan.HC.HTML +++ /dev/null @@ -1,12 +0,0 @@ - - - - - StrScan.HC - - - - - - - \ No newline at end of file diff --git a/public/src/MakeHome.HC.HTML b/public/src/MakeHome.HC.HTML deleted file mode 100644 index 1b70ace..0000000 --- a/public/src/MakeHome.HC.HTML +++ /dev/null @@ -1,25 +0,0 @@ - - - - - MakeHome.HC - - - - - Cd(__DIR__);;
-
-//If these are not present in /Home, it uses the version in the root dir. You
-//can make your own, modified, version of these files in your /Home directory.
-#include "~/HomeLocalize"
-#include "/Adam/Opt/Boot/MakeBoot"
-#include "/Adam/Opt/Utils/MakeUtils"
-#include "~/HomeWrappers"
-MapFileLoad("::/Kernel/Kernel");
-MapFileLoad("::/Compiler/Compiler");
-#include "~/HomeKeyPlugIns"
-#include "~/HomeSys"
-Cd("..");;
- - - \ No newline at end of file diff --git a/public/src/Misc/DoDistro.HC.HTML b/public/src/Misc/DoDistro.HC.HTML deleted file mode 100644 index 422179d..0000000 --- a/public/src/Misc/DoDistro.HC.HTML +++ /dev/null @@ -1,61 +0,0 @@ - - - - - DoDistro.HC - - - - - //Make Your own Distro by #include-ing this file.
-
-#define STD_DISTRO_DVD_CFG "TB\nScale2Mem(2048,0x40000)\nT\n\n\n\n"
-
-U0 MakeMyISO(U8 *_out_iso_filename)
-{//Does everything with current drive.
-//If you have not recompiled Kernel and defined your CD/DVD drive, use Mount.
- U8 *out_iso_filename=FileNameAbs(_out_iso_filename);
- if (!DrvIsWritable) {
- "Drive must be writable. Install on Hard drive, first.\n";
- return;
- }
- DelTree("/Distro");
- Del(out_iso_filename);
-
- DirMk("/Distro");
- In(STD_DISTRO_DVD_CFG);
- BootDVDIns;
-
- Copy("/*","/Distro");
- Del("/Distro/" KERNEL_BIN_C);
-
- CopyTree(BOOT_DIR, "/Distro" BOOT_DIR);
- CopyTree("/Home", "/Distro/Home");
- CopyTree("/Adam", "/Distro/Adam");
- CopyTree("/Apps", "/Distro/Apps");
- CopyTree("/Compiler", "/Distro/Compiler");
- CopyTree("/Demo", "/Distro/Demo");
- CopyTree("/Doc", "/Distro/Doc");
- CopyTree("/Kernel", "/Distro/Kernel");
- CopyTree("/Misc", "/Distro/Misc");
-
- //To save space, optionally delete dictionary.
- //Del("/Distro/Adam/AutoComplete/ACDefs.DATA");
- CopyTree("/Downloads","/Distro/Downloads"); //You can leave this out.
- DirMk("/Distro/Tmp");
- DirMk("/Distro/Tmp/ScrnShots");
- RedSeaISO(out_iso_filename,"/Distro","/Distro" BOOT_DIR_KERNEL_BIN_C);
-
- //If CD-ROM use MT_CD instead of MT_DVD.
- //DVDImageWrite('T',out_iso_filename,MT_DVD); //Uncomment to burn.
-
- //DelTree("/Distro");
- Free(out_iso_filename);
-}
-
-MakeMyISO("/Tmp/MyDistro.ISO.C");
-
-// Study my account examples $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOS/TOSCfg.HC,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOS/TOSDistro.HC,1"$.
- - - \ No newline at end of file diff --git a/public/src/Misc/OSInstall.HC.HTML b/public/src/Misc/OSInstall.HC.HTML deleted file mode 100644 index f1d4a3a..0000000 --- a/public/src/Misc/OSInstall.HC.HTML +++ /dev/null @@ -1,231 +0,0 @@ - - - - - OSInstall.HC - - - - - U0 InstallDrv(U8 drv_let)
-{
- U8 *st;
- ExePrint("CopyTree(\"::/\",\"%C:/\");",drv_let);
- ExePrint("DirMk(\"%C:/Tmp\");",drv_let);
- ExePrint("DirMk(\"%C:/Tmp/ScrnShots\");",drv_let);
- ExePrint("DirMk(\"%C:/Home\");",drv_let);
-
- st=MStrPrint("%C:/Home/DoDistro.HC.Z",drv_let);
- if (!FileFind(st))
- Copy("::/Misc/DoDistro.HC.Z",st);
- Free(st);
-
- st=MStrPrint("%C:/Home/MakeHome.HC.Z",drv_let);
- if (!FileFind(st))
- Copy("::/MakeHome.HC.Z",st);
- Free(st);
-}
-
-Bool VMPrtDsk(CTask *task,CATARep *ata_drv)
-{
- if (ata_drv) {
- XTalkWait(task,"DskPrt(,0.5,0.5);\nC\np%d\nY",ata_drv->num);
- return TRUE;
- } else
- return FALSE;
-}
-
-U0 VMInstallDrv(CTask *task,U8 drv_let,
- CATARep *ata_drv,CATARep *atapi_drv)
-{
- InstallDrv(drv_let);
- XTalkWait(task,"BootHDIns('%C');\n\nB\n0x20000\n",drv_let);
- if (ata_drv)
- XTalkWait(task,"C\np%d\n",ata_drv->num);
- if (atapi_drv)
- XTalkWait(task,"Tp%d\n",atapi_drv->num);
- XTalkWait(task,"\n\n\n"); //Exit Drives,Dsk Cache,Options
-}
-
-U0 VMInstallWiz()
-{
- CATARep *head=NULL,*ata_drv=NULL,*atapi_drv=NULL;
- CTask *task;
- "\nIt's normal for this to freeze for a moment or two.\n";
- PressAKey;
-
- task=User;
- TaskWait(task);
- task->border_src=BDS_CONST;
- task->border_attr=LTGRAY<<4+DrvTextAttrGet(':')&15;
- task->text_attr =LTGRAY<<4+BLUE;
- task->win_inhibit=WIG_TASK_DFT-WIF_SELF_BORDER;
- WinHorz(Fs->win_left,Fs->win_right,task);
- WinVert(Fs->win_top,(Fs->win_top+Fs->win_bottom)>>2-1,task);
- WinVert(task->win_bottom+3,Fs->win_bottom);
- WinToTop(Fs);
-
- ATARep(FALSE,TRUE,&head);
- ATAIDDrvs(head,&ata_drv,&atapi_drv);
- if (VMPrtDsk(task,ata_drv)) {
- VMInstallDrv(task,'C',ata_drv,atapi_drv);
- VMInstallDrv(task,'D',ata_drv,atapi_drv);
- BootMHDIns('C');
- }
- LinkedLstDel(head);
- WinVert(task->win_top,Fs->win_bottom);
- Kill(task);
-}
-
-U0 RegularInstallWiz()
-{
- I64 unit,drv_let;
- U8 *st,*base0,*base1;
- CATARep *head=NULL,*tmpha;
- I64 ch,num_hints;
- CTask *task;
-
- "\nIt's normal for this to freeze for a moment or two.\n";
- PressAKey;
-
- task=User;
- TaskWait(task);
- task->border_src=BDS_CONST;
- task->border_attr=LTGRAY<<4+DrvTextAttrGet(':')&15;
- task->text_attr =LTGRAY<<4+BLUE;
- task->win_inhibit=WIG_TASK_DFT-WIF_SELF_BORDER;
- WinHorz(Fs->win_left,Fs->win_right,task);
- WinVert(Fs->win_top,(Fs->win_top+Fs->win_bottom)>>2-1,task);
- WinVert(task->win_bottom+3,Fs->win_bottom);
- WinToTop(Fs);
- XTalk(task,"Mount;\nC\np");
-
- num_hints=ATARep(FALSE,,&head);
- "\nInclude '$PURPLE$0x$FG$' for hexidecimal numbers.\n\n";
- while (TRUE) {
- base0=GetStr("Hard Drive I/O Port Base0: ");
- if (0<Str2I64(base0)<=0xFFFF)
- break;
- Free(base0);
- }
- if (1<=Str2I64(base0)<=num_hints) {
- tmpha=ATARepFind(&head,Str2I64(base0));
- Free(base0);
- base0=MStrPrint("0x%X",tmpha->base0);
- base1=MStrPrint("0x%X",tmpha->base1);
- st =MStrPrint("0x%X",tmpha->unit);
- unit=Str2I64(st);
- Free(st);
- } else {
- while (TRUE) {
- base1=GetStr("Hard Drive I/O Port Base1: ");
- if (0<Str2I64(base1)<=0xFFFF)
- break;
- Free(base1);
- }
- do {
- st =GetStr("Unit--$PURPLE$0$FG$=Master or $PURPLE$1$FG$=Slave: ","0");
- unit=Str2I64(st);
- Free(st);
- } while (!(0<=unit<=1));
- }
- LinkedLstDel(head);
- XTalkWait(task,"%s\n%s\n%C\n",base0,base1,'0'+unit);
- DrvRep;
- do {
- st=GetStr("\nDestination Partition Letter: ");
- if (*st)
- drv_let=Let2Let(*st);
- else
- drv_let=0;
- Free(st);
- } while (!('A'<=drv_let<='Z'));
- '\n';
-
- "$RED$Format %C Partition?$FG$\n",drv_let;
- if (YorN) {
- '\n';
- do {
- "$PURPLE$1$FG$) Use FAT32\n"
- "$PURPLE$2$FG$) Use RedSea\n"
- "\nFile System Type: ";
- ch=GetChar;
- '\n';
- } while (!('1'<=ch<='2'));
- if (ch=='1')
- Fmt(drv_let,,FALSE,FSt_FAT32);
- else
- Fmt(drv_let,,FALSE,FSt_REDSEA);
- }
- InstallDrv(drv_let);
- XTalkWait(task,"BootHDIns('%C');\n\nB\n0x20000\n"
- "C\ns%s\n%s\n%C\n\n\n", //Exit Drives,Dsk Cache,Options
- drv_let,base0,base1,'0'+unit);
- "$RED$Install Master Boot loader?$FG$";
- if (YorN) {
- '\n';
- BootMHDIns(drv_let);
- }
- Free(base0);
- Free(base1);
-
- WinVert(task->win_top,Fs->win_bottom);
- Kill(task);
-}
-
-U0 DoInstructions()
-{
- CTask *task;
- AutoComplete;
- task=Fs->next_task;
- while (task!=Fs) {
- if (task!=adam_task && task!=sys_winmgr_task && task!=ac.task) {
- XTalk(task,"Ed(\"::/Doc/Install.DD.Z\");\n");
- break;
- }
- task=task->next_task;
- }
-}
-
-Bool DoInstall(Bool pmt_reboot)
-{
- I64 res=FALSE,vm_install;
- "\n\n\n\n\nAre you installing inside VMware, QEMU, VirtualBox "
- "or a similar virtual machine? ";
- vm_install=YorN;
- DocBottom;
-
- if (vm_install) {
- VMInstallWiz();
- res=TRUE;
- } else {
- "\n\nThis wizard works if you have a partition ready."
- "You can partition the drive or BootHDIns() "
- "with more options if you do it by hand, not using this wizard.\n\n"
- "Continue Install Wizard ";
- if (YorN) {
- RegularInstallWiz();
- res=TRUE;
- } else
- pmt_reboot=FALSE;
- }
- if (pmt_reboot) {
- "Reboot Now ";
- if (YorN)
- Reboot;
- }
- return res;
-}
-
-Bool OSInstall(Bool pmt_reboot=TRUE)
-{
- DoInstructions;
- return DoInstall(pmt_reboot);
-}
-
-#if __CMD_LINE__
-OSInstall(TRUE);
-#endif
- - - \ No newline at end of file diff --git a/public/src/Misc/OSTestSuite.HC.HTML b/public/src/Misc/OSTestSuite.HC.HTML deleted file mode 100644 index 5acf507..0000000 --- a/public/src/Misc/OSTestSuite.HC.HTML +++ /dev/null @@ -1,1735 +0,0 @@ - - - - - OSTestSuite.HC - - - - - I64 ts_i;
-F64 ts_t0;
-
-U0 TS(U8 *desc)
-{//We must set these because an app can call ProgressBarsRst.
- U8 *st=MStrPrint("%d. %s",ts_i,desc);
- if (*desc)
- progress3_max=1;
- else
- progress3_max=0;
- StrPrint(progress3_desc,"%*hc%s",
- (PROGRESS_DESC_LEN-StrLen(st))>>1,CH_SPACE,st);
- Free(st);
- progress4=ts_i++;
- progress4_max=171;
- progress4_t0=ts_t0;
- *progress4_desc=0;
- RegExe("TempleOS/OSTestSuite");
-}
-
-U0 TSFile(U8 *name,I64 mS=750)
-{
- CTask *task=User("#include \"%s\";Sleep(%d);\n",name,mS);
- DeathWait(&task,TRUE);
-}
-
-U0 TSFileChar(U8 *name,I64 mS=750,I64 ch=CH_SPACE,Bool wait=TRUE)
-{
- CTask *task=User;
- if (wait)
- XTalkWait(task,"#include \"%s\";\n",name);
- else
- XTalk(task,"#include \"%s\";\n",name);
- Sleep(mS);
- if (ch)
- PostMsgWait(task,MSG_KEY_DOWN_UP,ch,0);
- DeathWait(&task,TRUE);
-}
-
-/*
-U0 DoMouseDemo()
-{
- XTalkWait(task,"#include \"::/Demo/Graphics/MouseDemo\";\n");
-}
-U0 DoPullDownMenu()
-{
- XTalkWait(task,"#include \"::/Demo/PullDownMenu\";\n");
-}
-U0 DoTicTacToe()
-{
- XTalkWait(task,"#include \"::/Demo/Games/TicTacToe\";\n");
-}
-U0 DoLife()
-{
- XTalkWait(task,"#include \"::/Demo/Graphics/Life\";\n");
-}
-U0 DoZing()
-{
- XTalkWait(task,"#include \"::/Demo/Games/Zing\";\n");
-}
-U0 DoSlider()
-{
- XTalkWait(task,"#include \"::/Demo/Graphics/Slider\";\n");
-}
-U0 DoScrollBars()
-{
- XTalkWait(task,"#include \"::/Demo/Graphics/ScrollBars\";\n");
-}
-U0 DoWhap()
-{
- XTalkWait(task,"#include \"::/Demo/Games/Whap\";\n");
-}
-U0 DoDataBase()
-{
- XTalkWait(task,"#include \"::/Demo/Dsk/DataBase\";\n");
-}
-U0 DoDskRaw()
-{
- XTalkWait(task,"#include \"::/Demo/Dsk/DskRaw\";\n");
-}
-U0 DoTimeClock()
-{
- XTalkWait(task,"#include \"::/Apps/TimeClock\";\n");
-}
-U0 DoLectures()
-{
- XTalkWait(task,"#include \"::/Demo/Lectures\";\n");
-}
-U0 DoInFile()
-{
- XTalkWait(task,"#include \"::/Demo/InFile\";\n");
-}
-U0 DoSpy()
-{
- XTalkWait(task,"#include \"::/Demo/Spy\";\n");
-}
-U0 DoUnusedDefine()
-{
- XTalkWait(task,"#include \"::/Demo/DolDoc/UnusedDefine\";\n");
-}
-U0 DoOnceDemo()
-{
- XTalkWait(task,"#include \"::/Demo/OnceDemo\";\n");
-}
-*/
-$PL,1000$
-U0 DoRandDemo()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/RandDemo\";\n");
- XTalkWait(task,"");
- XTalkWait(task,"");
- Sleep(750);
- DeathWait(&task,TRUE);
-}
-
-U0 DoLowPassFilter()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Graphics/LowPassFilter\";\n");
- Sleep(300);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(300);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(300);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(300);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(300);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoMathAudioDemo()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Graphics/MathAudioDemo\";\n");
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(500);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
-
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(500);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
-
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(500);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoMsgLoop()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/MsgLoop\";\n");
- Sleep(300);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(300);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoASCIIOrgan()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Snd/ASCIIOrgan\";\n");
- Sleep(100);
- PostMsgWait(task,MSG_KEY_DOWN_UP,'A',0);
- Sleep(200);
- PostMsgWait(task,MSG_KEY_DOWN_UP,'B',0);
- Sleep(200);
- PostMsgWait(task,MSG_KEY_DOWN_UP,'C',0);
- Sleep(200);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoDoodle()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Graphics/Doodle\";\n");
- PostMsgWait(task,MSG_MS_L_DOWN,10,10);
- PostMsgWait(task,MSG_MS_L_UP,100,200);
- Sleep(500);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoSpeedLine()
-{
- I64 i=PURPLE+1; //+1 because TRANSPARENT
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Graphics/Speedline\";\n");
- PostMsgWait(task,MSG_MS_L_DOWN,10,10);
- PostMsgWait(task,MSG_MS_L_UP,100,200);
- PostMsg(task,MSG_MS_R_DOWN_UP,0,0);
- BirthWait(&task->popup_task);
- while (i--)
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_ESC,0);
- TaskWait(task);
- PostMsgWait(task,MSG_MS_L_DOWN,50,10);
- PostMsgWait(task,MSG_MS_L_UP,150,200);
- Sleep(1000);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoKeyBitMap()
-{
- I64 i_sc=Char2ScanCode('i');
- CTask *task=User("#include \"::/Demo/KeyBitMap\";\n");
- Sleep(50);
- LBts(kbd.down_bitmap,i_sc);
- Sleep(500);
- LBtr(kbd.down_bitmap,i_sc);
- Sleep(50);
- DeathWait(&task,TRUE);
-}
-
-U0 DoDigits()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Games/Digits\";\n");
- Sleep(100);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(100);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(250);
- PostMsgWait(task,MSG_KEY_DOWN_UP,'1',0);
- Sleep(250);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoSymmetry()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Graphics/Symmetry\";\n");
- PostMsgWait(task,MSG_MS_R_DOWN,100,100);
- PostMsgWait(task,MSG_MS_R_UP,200,200);
- Sleep(100);
- PostMsgWait(task,MSG_MS_L_DOWN,10,10);
- PostMsgWait(task,MSG_MS_L_UP,100,200);
- Sleep(250);
- PostMsgWait(task,MSG_MS_L_DOWN,100,200);
- PostMsgWait(task,MSG_MS_L_UP,400,400);
- Sleep(250);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoBSpline()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Graphics/BSpline\";\n");
- PostMsgWait(task,MSG_MS_L_DOWN_UP,50,50);
- PostMsgWait(task,MSG_MS_L_DOWN_UP,300,100);
- PostMsgWait(task,MSG_MS_L_DOWN_UP,150,300);
- PostMsgWait(task,MSG_MS_R_DOWN_UP,0,0);
- Sleep(1500);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoScrnCapture()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Graphics/ScrnCapture\";\n");
- Sleep(500);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(500);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(750);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- DeathWait(&task,TRUE);
- Del("~/DemoScrnShot.GR*");
-}
-
-U0 DoStadium()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Games/Stadium/Stadium\";\n");
- Sleep(50);
- PostMsgWait(task,MSG_MS_L_DOWN_UP,100,10);
- Sleep(300);
- PostMsgWait(task,MSG_MS_L_DOWN_UP,320,20);
- Sleep(300);
- PostMsgWait(task,MSG_MS_L_DOWN_UP,520,10);
- Sleep(300);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoPalette()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Graphics/Palette\";\n");
- Sleep(400);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(400);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoElephantWalk()
-{
- I64 i;
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Games/ElephantWalk\";\n");
- for (i=0;i<15;i++) {
- PostMsgWait(task,MSG_KEY_DOWN,0,SC_CURSOR_RIGHT);
- Sleep(50);
- }
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoHalogen()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Games/Halogen\";\n");
- PostMsgWait(task,MSG_KEY_DOWN,0,SC_CURSOR_UP);
- Sleep(1000);
- PostMsgWait(task,MSG_KEY_UP,0,SC_CURSOR_UP);
- PostMsgWait(task,MSG_KEY_DOWN,0,SC_CURSOR_RIGHT);
- Sleep(333);
- PostMsgWait(task,MSG_KEY_UP,0,SC_CURSOR_RIGHT);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoTheDead()
-{
- I64 i;
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Games/TheDead\";\n");
- for (i=0;i<15;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(50);
- }
- for (i=0;i<15;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_UP);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(50);
- }
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoBomberGolf()
-{
- I64 i;
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Games/BomberGolf\";\n");
- for (i=0;i<7;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_UP);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_RIGHT);
- Sleep(100);
- }
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- for (i=0;i<7;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_UP);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_LEFT);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_LEFT);
- Sleep(200);
- }
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoZoneOut()
-{
- I64 i;
- CTask *task=User("#include \"::/Demo/Games/ZoneOut\";\n");
- BirthWait(&task->popup_task);
- TaskWait(task->popup_task);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- for (i=0;i<15;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_RIGHT);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(100);
- }
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoVaroom()
-{
- I64 i;
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Games/Varoom\";\n");
- for (i=0;i<10;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_UP);
- Sleep(50);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_UP);
- Sleep(50);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_UP);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_LEFT);
- Sleep(50);
- }
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoFlatTops()
-{
- CTask *task=User("#include \"::/Demo/Games/FlatTops\";\n");
- BirthWait(&task->popup_task);
- TaskWait(task->popup_task);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- DeathWait(&task->popup_task);
- PostMsgWait(task,MSG_MS_R_DOWN_UP,RandI16%400+200,RandI16%300+150);
- Sleep(1500);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoWenceslas()
-{
- I64 i;
- CTask *task=User("#include \"::/Demo/Games/Wenceslas\";\n");
- BirthWait(&task->popup_task);
- TaskWait(task->popup_task);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(100);
- BirthWait(&task->popup_task);
- TaskWait(task->popup_task);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(100);
- BirthWait(&task->popup_task);
- TaskWait(task->popup_task);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(100);
- for (i=0;i<25;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_RIGHT);
- Sleep(25);
- }
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoTreeCheckers()
-{
- I64 task_num;
- CTask *task=User("#include \"::/Demo/Games/TreeCheckers\";\n");
-
- task_num=BirthWait(&task->popup_task);
- TaskWait(task->popup_task);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
-
- BirthWait(&task->popup_task,task_num);
- TaskWait(task->popup_task);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
-
- Sleep(500);
-
- PostMsgWait(task,MSG_KEY_DOWN_UP,'\n',0);
- Sleep(500);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoMorseCode()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Snd/MorseCode\";\n");
- Sleep(50);
-
- PostMsg(task,MSG_KEY_DOWN,CH_SPACE,0);
- Sleep(200);
- PostMsg(task,MSG_KEY_UP,CH_SPACE,0);
- Sleep(350);
-
- PostMsg(task,MSG_KEY_DOWN,CH_SPACE,0);
- Sleep(50);
- PostMsg(task,MSG_KEY_UP,CH_SPACE,0);
- Sleep(350);
-
- PostMsg(task,MSG_KEY_DOWN,CH_SPACE,0);
- Sleep(50);
- PostMsg(task,MSG_KEY_UP,CH_SPACE,0);
- Sleep(25);
- PostMsg(task,MSG_KEY_DOWN,CH_SPACE,0);
- Sleep(200);
- PostMsg(task,MSG_KEY_UP,CH_SPACE,0);
- Sleep(25);
- PostMsg(task,MSG_KEY_DOWN,CH_SPACE,0);
- Sleep(50);
- PostMsg(task,MSG_KEY_UP,CH_SPACE,0);
- Sleep(500);
-
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoPixCollision()
-{
- I64 w,h;
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Graphics/Collision\";\n");
- w=task->pix_width>>1 +task->pix_left+task->scroll_x;
- h=task->pix_height>>1+task->pix_top +task->scroll_y;
- MsSet(w-35,h-35);
- InSetMs(10,w+35,w+35);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoBlackDiamond()
-{
- I64 i;
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Games/BlackDiamond\";\n");
- for (i=0;i<15;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_RIGHT);
- Sleep(75);
- }
- for (i=0;i<12;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- Sleep(75);
- }
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoCtrlR1()
-{
- I64 i,task_num;
- CTask *task=User;
- XTalkWait(task,"//");
- PostMsg(task,MSG_KEY_DOWN_UP,CH_CTRLR,0);
- task_num=BirthWait(&task->popup_task);
- TaskWait(task->popup_task);
- for (i=0;i<1;i++)
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- PostMsg(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- //Color
- task_num=BirthWait(&task->popup_task,task_num);
- TaskWait(task->popup_task);
- for (i=0;i<2;i++)
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- PostMsg(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- task_num=BirthWait(&task->popup_task,task_num);
- TaskWait(task->popup_task);
- for (i=0;i<2;i++)
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- PostMsg(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
-
- //Width
- task_num=BirthWait(&task->popup_task,task_num);
- TaskWait(task->popup_task);
- for (i=0;i<4;i++)
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- PostMsg(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- task_num=BirthWait(&task->popup_task,task_num);
- TaskWait(task->popup_task);
- for (i=0;i<4;i++)
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- PostMsg(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
-
- //Line
- task_num=BirthWait(&task->popup_task,task_num);
- TaskWait(task->popup_task);
- for (i=0;i<7;i++)
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- PostMsg(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- DeathWait(&task->popup_task);
- PostMsgWait(task,MSG_MS_L_DOWN,150,150);
- PostMsgWait(task,MSG_MS_L_UP,150,95);
- Sleep(250);
- PostMsgWait(task,MSG_MS_L_DOWN,150,150);
- PostMsgWait(task,MSG_MS_L_UP,190,190);
- Sleep(250);
- PostMsgWait(task,MSG_MS_L_DOWN,150,150);
- PostMsgWait(task,MSG_MS_L_UP,110,190);
- Sleep(250);
- PostMsg(task,MSG_MS_R_DOWN_UP,100,100);
-
- //Color
- task_num=BirthWait(&task->popup_task,task_num);
- TaskWait(task->popup_task);
- for (i=0;i<2;i++)
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- PostMsg(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- task_num=BirthWait(&task->popup_task,task_num);
- TaskWait(task->popup_task);
- for (i=0;i<3;i++)
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- PostMsg(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
-
- //Circle
- task_num=BirthWait(&task->popup_task,task_num);
- TaskWait(task->popup_task);
- for (i=0;i<10;i++)
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- PostMsg(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- DeathWait(&task->popup_task);
- PostMsgWait(task,MSG_MS_L_DOWN,150,150);
- PostMsgWait(task,MSG_MS_L_UP,190,190);
- Sleep(250);
- PostMsg(task,MSG_MS_R_DOWN_UP,100,100);
-
- //Exit
- BirthWait(&task->popup_task);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN+SCF_CTRL);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_UP);
- PostMsg(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- DeathWait(&task->popup_task);
- Sleep(1000);
- XTalk(task,"\n");
- DeathWait(&task,TRUE);
-}
-
-U0 DoF2Macro()
-{
- I64 i;
- U8 *ptr="\"Boo!\\n\";\n";
- CTask *task=User;
- DeathWait(&sys_macro_task);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_F2);
- BirthWait(&sys_macro_task);
- TaskWait(sys_macro_task);
-
- PostMsgWait(sys_macro_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_RIGHT|SCF_CTRL);
- PostMsgWait(sys_macro_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- PostMsgWait(sys_macro_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_RIGHT);
- PostMsgWait(sys_macro_task,MSG_KEY_DOWN_UP,CH_SPACE,0); //Press RECORD
- while (!Bt(&sys_semas[SEMA_RECORD_MACRO],0))
- Yield;
-
- while (*ptr)
- PostMsgWait(task,MSG_KEY_DOWN,*ptr++,0);
-
- PostMsgWait(sys_macro_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- PostMsgWait(sys_macro_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- PostMsgWait(sys_macro_task,MSG_KEY_DOWN_UP,CH_SPACE,0); //Press STOP
-
- for (i=0;i<10;i++)
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_F2|SCF_SHIFT);
-
- PostMsg(sys_macro_task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&sys_macro_task);
-
- Sleep(1000);
- XTalk(task,"\n");
- DeathWait(&task,TRUE);
-}
-
-U0 DoLightTable()
-{
- CTask *task=User("#include \"::/Demo/Graphics/LightTable\";\n\n");
- TaskWait(task);
- PostMsgWait(task,MSG_KEY_DOWN_UP,'2',0);
- PostMsgWait(task,MSG_MS_L_DOWN, 100 ,200);
- PostMsgWait(task,MSG_MS_L_UP, 640-100 ,200);
-
- PostMsgWait(task,MSG_KEY_DOWN_UP,'3',0);
- PostMsgWait(task,MSG_MS_L_DOWN_UP,100 ,200);
- PostMsgWait(task,MSG_MS_L_DOWN_UP,100 ,200);
- PostMsgWait(task,MSG_MS_L_DOWN_UP,100 ,200);
- PostMsgWait(task,MSG_MS_L_DOWN_UP,120 ,180);
- PostMsgWait(task,MSG_MS_L_DOWN_UP,160 ,120);
- PostMsgWait(task,MSG_MS_L_DOWN_UP,320 ,10);
- PostMsgWait(task,MSG_MS_L_DOWN_UP,640-160 ,120);
- PostMsgWait(task,MSG_MS_L_DOWN_UP,640-120 ,180);
- PostMsgWait(task,MSG_MS_L_DOWN_UP,640-100 ,200);
- PostMsgWait(task,MSG_MS_L_DOWN_UP,640-100 ,200);
- PostMsgWait(task,MSG_MS_L_DOWN_UP,640-100 ,200);
- PostMsgWait(task,MSG_MS_R_DOWN_UP,0,0);
-
- PostMsgWait(task,MSG_KEY_DOWN_UP,'4',0);
- PostMsgWait(task,MSG_MS_L_DOWN_UP,320,190);
-
- PostMsgWait(task,MSG_KEY_DOWN_UP,'5',0);
- PostMsgWait(task,MSG_MS_L_DOWN,460,280);
- PostMsgWait(task,MSG_MS_L_UP ,500,220);
-
- Sleep(1500);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoPredatorPrey()
-{
- CTask *task=User("#include \"::/Demo/Graphics/PredatorPrey\";\n");
- BirthWait(&task->popup_task);
- TaskWait(task->popup_task);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(1500);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoCharDemo()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Games/CharDemo\";\n");
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_UP);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_LEFT);
- Sleep(750);
- PostMsg(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoLattice()
-{
- I64 i;
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Graphics/Lattice\";\n");
- for (i=0;i<20;i++)
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_UP);
- for (i=0;i<6;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,'+',0);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_LEFT);
- }
- for (i=0;i<6;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_LEFT);
- }
- for (i=0;i<16;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_RIGHT);
- }
- Sleep(500);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoCartesian()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Graphics/Cartesian\";\n");
- XTalkWait(task,"0.2*x`1.5\n");
- Sleep(750);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoMPAdd()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/MultiCore/MPAdd\";\n");
- Sleep(750);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(750);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoFlapBat()
-{
- I64 i;
- CTask *task=User("#include \"::/Demo/Games/FlapBat\";\n");
- BirthWait(&task->popup_task);
- TaskWait(task->popup_task);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(500);
- for (i=0;i<4;i++) {
- PostMsgWait(task,MSG_KEY_DOWN,CH_SPACE,0);
- Sleep(100);
- PostMsgWait(task,MSG_KEY_UP,CH_SPACE,0);
- Sleep(100);
- }
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoBattleLines()
-{
- CTask *task=User("#include \"::/Demo/Games/BattleLines\";\n");
- BirthWait(&task->popup_task);
- TaskWait(task->popup_task);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- DeathWait(&task->popup_task);
- MsSet(430,300,,TRUE);
- InSetMs(10,530,400);
- MsSet(,,,FALSE);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoBigGuns()
-{
- I64 i,task_num;
- CTask *task=User("#include \"::/Demo/Games/BigGuns\";\n");
- task_num=BirthWait(&task->popup_task);
- TaskWait(task->popup_task);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- BirthWait(&task->popup_task,task_num);
- TaskWait(task->popup_task);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- for (i=0;i<5;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_LEFT);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_LEFT);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_LEFT);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_LEFT);
- Sleep(200);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- }
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoDunGen()
-{
- I64 i;
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Games/DunGen\";\n");
- for (i=0;i<10;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_RIGHT);
- Sleep(100);
- }
- for (i=0;i<12;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- Sleep(100);
- }
- for (i=0;i<6;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_RIGHT);
- Sleep(100);
- }
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoTitanium()
-{
- I64 i;
- CTask *task=User;
- XTalkWait(task,"#include \"::/Apps/Titanium/Run\";\n");
- Sleep(200);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- for (i=0;i<3;i++) {
- PostMsgWait(task,MSG_KEY_DOWN,CH_SPACE,0);
- LBts(kbd.down_bitmap,SC_CURSOR_RIGHT);
- Sleep(200);
- PostMsgWait(task,MSG_KEY_UP,CH_SPACE,0);
- LBtr(kbd.down_bitmap,SC_CURSOR_RIGHT);
- Sleep(200);
- PostMsgWait(task,MSG_KEY_DOWN,CH_SPACE,0);
- LBts(kbd.down_bitmap,SC_CURSOR_LEFT);
- Sleep(200);
- PostMsgWait(task,MSG_KEY_UP,CH_SPACE,0);
- LBtr(kbd.down_bitmap,SC_CURSOR_LEFT);
- Sleep(200);
- }
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoToTheFront()
-{
- I64 task_num;
- CTask *task=User("#include \"::/Apps/ToTheFront/Run\";\n");
- task_num=BirthWait(&task->popup_task);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,'\n',0);
- task_num=BirthWait(&task->popup_task,task_num);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_RIGHT);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- task_num=BirthWait(&task->popup_task,task_num);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_RIGHT);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- BirthWait(&task->popup_task,task_num);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN,CH_SPACE,0);
- DeathWait(&task->popup_task);
- Sleep(5000);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoPsalmody()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Apps/Psalmody/Run\";\n");
- PostMsgWait(task,MSG_KEY_DOWN_UP,'z',0);
- PostMsgWait(task,MSG_KEY_DOWN,'h',0);
- Sleep(200);
- PostMsgWait(task,MSG_KEY_UP,'h',0);
- PostMsgWait(task,MSG_KEY_DOWN,'g',0);
- Sleep(200);
- PostMsgWait(task,MSG_KEY_UP,'g',0);
- PostMsgWait(task,MSG_KEY_DOWN,'h',0);
- Sleep(200);
- PostMsgWait(task,MSG_KEY_UP,'h',0);
- PostMsgWait(task,MSG_KEY_DOWN,'j',0);
- Sleep(200);
- PostMsgWait(task,MSG_KEY_UP,'j',0);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_LEFT+SCF_CTRL);
- PostMsgWait(task,MSG_KEY_DOWN_UP,'x',0);
- Sleep(1250);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoJukeBox()
-{
- CTask *task=User("#include \"::/Apps/Psalmody/Load\";"
- "JukeBox(\"::/Apps/Psalmody/Examples\");\n");
- BirthWait(&task->popup_task);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_RIGHT);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(1500);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task->popup_task);
- DeathWait(&task,TRUE);
-}
-
-U0 DoSpan()
-{
- CTask *task=User("#include \"::/Apps/Span/Run\";\n");
- BirthWait(&task->popup_task);
- TaskWait(task->popup_task);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(1500);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoStrut()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Apps/Strut/Run\";\n");
-
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
-
- MsSet(200,200,,TRUE);
- PostMsgWait(task,MSG_MS_L_DOWN,0,0);
- Refresh(2);
-
- MsSet(GR_WIDTH-200,200,,TRUE);
- PostMsgWait(task,MSG_MS_L_DOWN,0,0);
-
- MsSet(GR_WIDTH/2,400,,TRUE);
- PostMsgWait(task,MSG_MS_L_DOWN,0,0);
-
- PostMsgWait(task,MSG_KEY_DOWN_UP,'s',0);
-
- MsSet(200,200,,TRUE);
- PostMsgWait(task,MSG_MS_L_DOWN,0,0);
- MsSet(GR_WIDTH-200,200,,TRUE);
- PostMsgWait(task,MSG_MS_L_UP,0,0);
-
- MsSet(200,200,,TRUE);
- PostMsgWait(task,MSG_MS_L_DOWN,0,0);
- MsSet(GR_WIDTH/2,400,,TRUE);
- PostMsgWait(task,MSG_MS_L_UP,0,0);
-
- MsSet(GR_WIDTH-200,200,,TRUE);
- PostMsgWait(task,MSG_MS_L_DOWN,0,0);
- MsSet(GR_WIDTH/2,400,,TRUE);
- PostMsgWait(task,MSG_MS_L_UP,0,0);
-
- MsSet(GR_WIDTH/2,GR_HEIGHT/2,,TRUE);
- PostMsgWait(task,MSG_MS_L_DOWN,0,0);
- MsSet(GR_WIDTH-200,200,,TRUE);
- PostMsgWait(task,MSG_MS_L_UP,0,0);
-
- MsSet(GR_WIDTH/2,GR_HEIGHT/2,,TRUE);
- PostMsgWait(task,MSG_MS_L_DOWN,0,0);
- MsSet(GR_WIDTH/2,400,,TRUE);
- PostMsgWait(task,MSG_MS_L_UP,0,0);
-
- MsSet(GR_WIDTH/2,GR_HEIGHT/2,,TRUE);
- PostMsgWait(task,MSG_MS_L_DOWN,0,0);
- MsSet(200,200,,TRUE);
- PostMsgWait(task,MSG_MS_L_UP,0,0);
-
- PostMsgWait(task,MSG_KEY_DOWN_UP,'t',0);
-
- MsSet(GR_WIDTH/2,400,,TRUE);
- PostMsgWait(task,MSG_MS_L_DOWN,0,0);
- MsSet(GR_WIDTH-200,200,,TRUE);
- PostMsgWait(task,MSG_MS_L_UP,0,0);
-
- MsSet(GR_WIDTH/2,400,,TRUE);
- PostMsgWait(task,MSG_MS_L_DOWN,0,0);
- MsSet(200,200,,TRUE);
- PostMsgWait(task,MSG_MS_L_UP,0,0);
-
- MsSet(,,,FALSE);
-
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- LBts(kbd.down_bitmap,Char2ScanCode('1'));
- Sleep(600);
- LBtr(kbd.down_bitmap,Char2ScanCode('1'));
- PostMsgWait(task,MSG_KEY_DOWN_UP,'Z',0);
- Sleep(200);
- PostMsgWait(task,MSG_KEY_DOWN_UP,'Z',0);
- Sleep(200);
- PostMsgWait(task,MSG_KEY_DOWN_UP,'Z',0);
- Sleep(200);
-
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoRawHide()
-{
- CTask *task=User("#include \"::/Demo/Games/RawHide\";\n");
- BirthWait(&task->popup_task);
- TaskWait(task->popup_task);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(2500);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoPoleZeros()
-{
- CTask *task=User("#include \"::/Demo/Graphics/PoleZeros\";\n");
- BirthWait(&task->popup_task);
- TaskWait(task->popup_task);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(750);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoWhap()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Games/Whap\";\n");
- MsSet(300,200);
- Sleep(500);
- InSetMs(3,350,300);
- Sleep(500);
- InSetMs(3,450,200);
- Sleep(500);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoGrid()
-{
- CTask *task=User("#include \"::/Demo/Graphics/Grid\";\n");
- MsSet(200,200);
- Sleep(150);
- InSetMs(2,400,400);
- InSetMs(2,200,400);
- InSetMs(2,200,200);
- MsSet(,,,TRUE);
- Sleep(50);
- MsSet(,,,FALSE);
- DocBottom(DocPut(task));
- DeathWait(&task,TRUE);
-}
-
-U0 DoPick()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Graphics/Pick\";\n");
- MsSet(200,200);
- Sleep(500);
- MsSet(,,,TRUE);
- InSetMs(4,400,400);
- MsSet(,,,FALSE);
- Sleep(500);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoPick3D()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Graphics/Pick3D\";\n");
- MsSet(200,200);
- Sleep(500);
- MsSet(,,,TRUE);
- InSetMs(4,400,400);
- MsSet(,,,FALSE);
- Sleep(500);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoGrModels()
-{
- CTask *task=User;
- I64 i,j,task_num=-1;
- XTalkWait(task,"#include \"::/Apps/GrModels/Run\";\n");
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- PostMsg(task,MSG_KEY_DOWN_UP,CH_ESC,0);
- for (i=0;i<4;i++) {
- task_num=BirthWait(&task->popup_task,task_num);
- TaskWait(task->popup_task);
- for (j=0;j<=i;j++)
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- }
- Sleep(1000);
- PostMsgWait(task,MSG_KEY_DOWN_UP,'n',0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoKeepAway()
-{
- CTask *task=User("#include \"::/Apps/KeepAway/Run\";\n");
- BirthWait(&task->popup_task);
- TaskWait(task->popup_task);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- MsSet(100,100);
- Sleep(1500);
- PostMsgWait(task,MSG_MS_R_DOWN_UP,ms.pos.x,ms.pos.y);
- Sleep(1000);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoRocket()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Games/Rocket\";\n");
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_UP);
- Bts(kbd.down_bitmap,SC_CURSOR_UP);
- Sleep(1000);
- Btr(kbd.down_bitmap,SC_CURSOR_UP);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_RIGHT);
- Bts(kbd.down_bitmap,SC_CURSOR_RIGHT);
- Sleep(1000);
- Btr(kbd.down_bitmap,SC_CURSOR_RIGHT);
- Sleep(1000);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoRocketScience()
-{
- CTask *task=User("#include \"::/Demo/Games/RocketScience\";\n");
- BirthWait(&task->popup_task);
- TaskWait(task->popup_task);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(750);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(2000);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoMassSpring()
-{
- CTask *task=User("#include \"::/Demo/Games/MassSpring\";\n");
- BirthWait(&task->popup_task);
- TaskWait(task->popup_task);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- DeathWait(&task->popup_task);
- PostMsgWait(task,MSG_MS_L_DOWN_UP,50,50); //#1
- PostMsgWait(task,MSG_MS_L_DOWN_UP,50,200); //#2
- PostMsgWait(task,MSG_MS_L_DOWN_UP,210,50); //#3
- PostMsgWait(task,MSG_MS_L_DOWN_UP,310,200);//#4
- Sleep(500);
- PostMsgWait(task,MSG_MS_R_DOWN,50,50); //1-2
- PostMsgWait(task,MSG_MS_R_UP,50,200);
- Sleep(500);
- PostMsgWait(task,MSG_MS_R_DOWN,210,50);//3-4
- PostMsgWait(task,MSG_MS_R_UP,310,200);
- Sleep(500);
- PostMsgWait(task,MSG_MS_R_DOWN,50,200);//2-4
- PostMsgWait(task,MSG_MS_R_UP,310,200);
- Sleep(500);
- PostMsgWait(task,MSG_MS_R_DOWN,50,50); //1-3
- PostMsgWait(task,MSG_MS_R_UP,210,50);
- Sleep(1500);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoSquirt()
-{
- I64 i;
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Games/Squirt\";\n");
- for (i=0;i<5;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_UP);
- Sleep(100);
- }
- for (i=0;i<5;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_LEFT);
- Sleep(100);
- }
- for (i=0;i<5;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- Sleep(100);
- }
- for (i=0;i<5;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_RIGHT);
- Sleep(100);
- }
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoXCaliber()
-{
- I64 i;
- CTask *task=User;
- XTalk(task,"#include \"::/Apps/X-Caliber/Run\";\n");
-
- Sleep(100);
- if(TaskValidate(task->popup_task)) {
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,0,SCF_CTRL|SC_CURSOR_DOWN);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- DeathWait(&task->popup_task);
- }
-
- for (i=0;i<5;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SCF_SHIFT|SC_CURSOR_UP);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SCF_SHIFT|SC_CURSOR_RIGHT);
- }
- for (i=0;i<10;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- PostMsgWait(task,MSG_KEY_DOWN,0,SC_CURSOR_RIGHT,0);
- Sleep(100);
- PostMsgWait(task,MSG_KEY_UP,0,SC_CURSOR_RIGHT,0);
- Sleep(50);
- }
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoFPS()
-{
- I64 i;
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Games/CastleFrankenstein\";\n");
- for (i=0;i<15;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_UP);
- Sleep(50);
- }
- for (i=0;i<8;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_RIGHT);
- Sleep(50);
- }
- for (i=0;i<9;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_UP);
- Sleep(50);
- }
- for (i=0;i<6;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_RIGHT);
- Sleep(50);
- }
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoTalons()
-{
- I64 i;
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Games/Talons\";\n");
- Sleep(500);
- for (i=0;i<10;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_UP);
- Sleep(50);
- }
- for (i=0;i<10;i++) {
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- Sleep(50);
- }
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoPhoneNumWords()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/PhoneNumWords\";\n");
- XTalkWait(task,"702-254-4223\n\n");
- Sleep(750);
- DeathWait(&task,TRUE);
-}
-
-U0 DoSuggestedSpelling()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/SuggestSpelling\";\n");
- XTalkWait(task,"effecient\n\n");
- Sleep(750);
- DeathWait(&task,TRUE);
-}
-
-U0 DoFPrintF()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Dsk/FPrintF\";\n");
- XTalkWait(task,"~/DemoFPrintF.DD.Z");
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_ESC,0);
- XTalkWait(task,"Type(\"~/DemoFPrintF.DD.Z\");\n");
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_CTRLO,0);
- XTalkWait(task,"Del(\"~/DemoFPrintF.DD*\");\n");
- Sleep(500);
- DeathWait(&task,TRUE);
-}
-
-U0 DoLastClass()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/LastClass\";\n");
- Sleep(500);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(500);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(500);
- DeathWait(&task,TRUE);
-}
-
-U0 DoMiniCompiler()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Lectures/MiniCompiler\";\n");
- XTalkWait(task,"1+2*(3+4)\n");
- Sleep(750);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoWebLog()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/WebLogDemo/WebLogRep\";\n");
- PostMsgWait(task,MSG_KEY_DOWN_UP,'\n',0);
- PostMsgWait(task,MSG_KEY_DOWN_UP,'\n',0);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_ESC,0);
- Sleep(750);
- DeathWait(&task,TRUE);
-}
-
-U0 DoRevFile()
-{
- CTask *task;
- Del("~/DemoPoemFwd.DD*");
- task=User("#include \"::/Demo/RevFileDemo/Rev\";"
- "Type(\"~/DemoPoemFwd.DD.Z\");Sleep(750);\n");
- DeathWait(&task,TRUE);
-}
-
-U0 DoSortFile()
-{
- CTask *task=User("#include \"::/Demo/SortFileDemo/F64FileGen\";"
- "#include \"::/Demo/SortFileDemo/F64FileSort\";Sleep(750);\n");
- DeathWait(&task,TRUE);
-}
-
-U0 DoToHtmlToTXT()
-{
- CTask *task=User("#include \"::/Demo/ToHtmlToTXTDemo/HtmlGen\";"
- "#include \"::/Demo/ToHtmlToTXTDemo/TXTGen\";"
- "Type(\"~/DemoOutPage.TXT\");Sleep(750);\n");
- DeathWait(&task,TRUE);
-}
-
-U0 DoLogic()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Apps/Logic/Run\";\n");
- XTalkWait(task,"NAND\nNOR\n\n0x100\n0xF0\n0xCC\n0xAA\n\n0x12\n\n");
- Sleep(750);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoPrompt()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Prompt\";\n");
- XTalkWait(task,"1+2*3<<4\n");
- XTalkWait(task,"1.0+2*3`2\n");
- XTalkWait(task,"Terry Davis\n");
- XTalkWait(task,"*-1\n");
- Sleep(750);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoNumBible()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/DolDoc/NumBible\";\n");
- Del("~/DemoNumBible.DD*");
- DeathWait(&task,TRUE);
-}
-
-U0 DoForm()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/DolDoc/Form\";\n");
- Sleep(250);
- XTalk(task,"54321");
- Sleep(250);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- Sleep(250);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SCF_CTRL|SC_CURSOR_LEFT);
- XTalk(task,"77777");
- Sleep(250);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
- Sleep(250);
- XTalk(task,"MyName");
- Sleep(750);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_ESC,0);
- Sleep(750);
- DeathWait(&task,TRUE);
-}
-
-U0 DoClickCallBack()
-{
- I64 i;
- CTask *task=User("#include \"::/Demo/DolDoc/ClickCallBack\";\n");
- for (i=0;i<3;i++) {
- BirthWait(&task->popup_task);
- TaskWait(task->popup_task);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(250);
- }
- Sleep(500);
- DeathWait(&task,TRUE);
-}
-
-U0 DoMenuBttn()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/DolDoc/MenuBttn\";\n");
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(500);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN,0);
- Sleep(500);
- PostMsg(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- BirthWait(&task->popup_task);
- TaskWait(task->popup_task);
- Sleep(500);
- PostMsgWait(sys_focus_task,MSG_KEY_DOWN_UP,0,SC_CURSOR_RIGHT);
- Sleep(500);
- PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- DeathWait(&task->popup_task);
- Sleep(750);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoMenuSprite()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/DolDoc/MenuSprite\";\n");
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN,0);
- Sleep(50);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(300);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN,0);
- Sleep(50);
- PostMsgWait(task,MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN,0);
- Sleep(50);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(300);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoExceptions()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Exceptions\";\n");
- XTalkWait(task,"yy");
- Sleep(750);
- DeathWait(&task,TRUE);
-}
-
-U0 DoDemoDoc()
-{
- CTask *task=User;
- XTalkWait(task,"Ed(\"::/Demo/DolDoc/DemoDoc.DD\");\n");
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_CTRLG,0);
- XTalkWait(task,"100");
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_ESC,0);
- Sleep(750);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoFileRead()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/DolDoc/FileRead\";\n");
- Sleep(750);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- Sleep(750);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- DeathWait(&task,TRUE);
-}
-
-U0 DoDefine()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Define\";\n");
- XTalkWait(task,"YS\n");
- Sleep(750);
- DeathWait(&task,TRUE);
-}
-
-U0 DoAsmAndC1()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Asm/AsmAndC1\";\n2\n");
- DeathWait(&task,TRUE);
-}
-
-U0 DoAsmAndC2()
-{
- CTask *task=User;
- XTalkWait(task,"#include \"::/Demo/Asm/AsmAndC2\";\n2\n");
- DeathWait(&task,TRUE);
-}
-
-U0 OSTestSuite()
-{
- CTask *task;
- ts_t0=tS;
- ts_i=0;
-
- TS("BlackDiamond"); DoBlackDiamond;
- TS("Talons"); DoTalons;
- TS("FlatTops"); DoFlatTops;
- TS("DunGen"); DoDunGen;
- TS("FPS"); DoFPS;
- TS("ZoneOut"); DoZoneOut;
- TS("Varoom"); DoVaroom;
- TS("Rocket"); DoRocket;
- TS("RocketScience"); DoRocketScience;
- TS("BattleLines"); DoBattleLines;
- TS("BigGuns"); DoBigGuns;
- TS("FlapBat"); DoFlapBat;
- TS("Titanium"); DoTitanium;
- TS("ToTheFront"); DoToTheFront;
- TS("Psalmody"); DoPsalmody;
- TS("JukeBox"); DoJukeBox;
- TS("Span"); if (!sys_heap_init_flag) DoSpan; //Has FloodFill
- TS("Strut"); DoStrut;
- TS("RawHide"); DoRawHide;
- TS("KeepAway"); DoKeepAway;
- TS("XCaliber"); DoXCaliber;
- TS("Wenceslas"); DoWenceslas;
- TS("BomberGolf"); DoBomberGolf;
- TS("TheDead"); DoTheDead;
- TS("TreeCheckers"); DoTreeCheckers;
- TS("RadixDort"); TSFile("::/Demo/RadixSort");
- TS("MPAdd"); DoMPAdd;
- TS("Primes"); TSFile("::/Demo/MultiCore/Primes");
- TS("Palindrome"); if (FileFind(BIBLE_FILENAME))
- TSFile("::/Demo/MultiCore/Palindrome");
- TS("MPRadix"); if (mp_cnt>1) TSFile("::/Demo/MultiCore/MPRadix");
- TS("LoadTest"); if (mp_cnt>1 && DrvIsWritable(':'))
- TSFileChar("::/Demo/MultiCore/LoadTest");
- TS("MPPrint"); if (mp_cnt>1) TSFile("::/Demo/MultiCore/MPPrint");
- TS("Lock"); if (mp_cnt>1) TSFile("::/Demo/MultiCore/Lock");
- TS("Interrupts"); if (mp_cnt>1) TSFile("::/Demo/MultiCore/Interrupts");
- TS("SpritePlot"); TSFileChar("::/Demo/Graphics/SpritePlot");
- TS("Elephants"); TSFileChar("::/Demo/Graphics/Elephant",,CH_SHIFT_ESC);
- TS("SpritePlot3D"); TSFileChar("::/Demo/Graphics/SpritePlot3D");
- TS("SpritePut"); TSFile("::/Demo/Graphics/SpritePut");
- TS("SpritePutExt"); TSFile("::/Demo/Graphics/SpritePutExt");
- TS("SpriteText"); TSFile("::/Demo/Graphics/SpriteText");
- TS("SpriteRaw"); TSFile("::/Demo/Graphics/SpriteRaw");
- TS("EdSprite"); TSFile("::/Demo/Graphics/EdSprite");
- TS("Balloon"); TSFile("::/Demo/Graphics/Balloon",0);
- TS("Carry"); TSFile("::/Demo/Carry");
- TS("Directives"); TSFile("::/Demo/Directives");
- TS("RandDemo"); DoRandDemo;
- TS("Extents"); TSFileChar("::/Demo/Graphics/Extents");
- TS("NetOfDots"); TSFileChar("::/Demo/Graphics/NetOfDots");
- TS("SunMoon"); TSFileChar("::/Demo/Graphics/SunMoon");
- TS("LowPassFilter"); DoLowPassFilter;
- TS("MathAudioDemo"); DoMathAudioDemo;
- TS("Lines"); TSFileChar("::/Demo/Graphics/Lines");
- TS("Bounce"); TSFileChar("::/Demo/Graphics/Bounce",,CH_SHIFT_ESC,FALSE);
- TS("MsgLoop"); DoMsgLoop;
- TS("ASCIIOrgan"); DoASCIIOrgan;
- TS("MorseCode"); DoMorseCode;
- TS("PixCollision"); DoPixCollision;
- TS("Doodle"); DoDoodle;
- TS("MassSpring"); DoMassSpring;
- TS("SpeedLine"); DoSpeedLine;
- TS("KeyBitMap"); DoKeyBitMap;
- TS("BSpline"); DoBSpline;
- TS("GrModels"); DoGrModels;
- TS("Blot"); TSFileChar("::/Demo/Graphics/Blot",1800);
- TS("ScrnCapture"); if (DrvIsWritable('~')) DoScrnCapture;
- TS("Grid"); DoGrid;
- TS("Pick"); DoPick;
- TS("Pick3D"); DoPick3D;
- TS("Whap"); DoWhap;
- TS("Palette"); DoPalette;
- TS("Print"); TSFile("::/Demo/Print");
- TS("Shading"); TSFileChar("::/Demo/Graphics/Shading",1500);
- TS("RotateTank"); TSFileChar("::/Demo/Graphics/RotateTank",1500);
- TS("3DPoly"); TSFileChar("::/Demo/Graphics/3DPoly",1500);
- TS("Box"); TSFileChar("::/Demo/Graphics/Box",1500);
- TS("Symmetry"); DoSymmetry;
- TS("Shadow"); TSFileChar("::/Demo/Graphics/Shadow",1500);
- TS("Transform"); TSFileChar("::/Demo/Graphics/Transform",,CH_SHIFT_ESC);
- TS("LightTable"); DoLightTable;
- TS("PredatorPrey"); DoPredatorPrey;
- TS("PoleZeros"); DoPoleZeros;
- TS("Digits"); DoDigits;
- TS("Stadium"); DoStadium;
- TS("ElephantWalk"); DoElephantWalk;
- TS("Halogen"); DoHalogen;
- TS("Maze"); TSFileChar("::/Demo/Games/Maze",,CH_SHIFT_ESC);
- TS("FontEd"); TSFileChar("::/Demo/Graphics/FontEd",,CH_SHIFT_ESC);
- TS("Lattice"); DoLattice;
- TS("CtrlR1"); DoCtrlR1;
- TS("F2Macro"); DoF2Macro;
- TS("SubIntAccess"); TSFile("::/Demo/SubIntAccess");
- TS("DemoDoc"); DoDemoDoc;
- TS("TreeDemo"); TSFile("::/Demo/DolDoc/TreeDemo");
- TS("TextDemo"); TSFile("::/Demo/DolDoc/TextDemo");
- TS("CursorMove"); TSFile("::/Demo/DolDoc/CursorMove");
- TS("MiniCompiler"); DoMiniCompiler;
- TS("MiniGrLib"); TSFile("::/Demo/Lectures/MiniGrLib",0);
- TS("TimeIns"); TSFileChar("::/Demo/TimeIns");
- TS("PhoneNumWords"); DoPhoneNumWords;
- TS("UnusedSpaceRep"); TSFile("::/Demo/Dsk/UnusedSpaceRep");
- TS("BlkDevRep"); TSFile("::/Demo/Dsk/BlkDevRep");
- TS("LastClass"); DoLastClass;
- TS("FPrintF"); if (DrvIsWritable('~')) DoFPrintF;
- TS("SerializeTree"); TSFile("::/Demo/Dsk/SerializeTree");
- TS("Exceptions"); DoExceptions;
- TS("ScrnDCodes"); TSFileChar("::/Demo/ScrnCodes");
- TS("ExtChars"); TSFile("::/Demo/ExtChars");
- TS("PanText"); TSFile("::/Demo/Graphics/PanText",0);
- TS("CharAnimation"); TSFile("::/Demo/Graphics/CharAnimation");
- TS("CharDemo"); DoCharDemo;
- TS("DateTime"); TSFile("::/Demo/DateTime");
- TS("SubSwitch"); TSFile("::/Demo/SubSwitch");
- TS("NullCase"); TSFile("::/Demo/NullCase");
- TS("Magicpairs"); TSFile("::/Demo/MagicPairs");
- TS("Hanoi"); TSFileChar("::/Demo/Graphics/Hanoi",3000);
- TS("Squirt"); DoSquirt;
- TS("CommonAncestor");
- TSFileChar("::/Demo/Graphics/CommonAncestor",1500,CH_SHIFT_ESC);
- TS("Cartesian"); DoCartesian;
- TS("RainDrops"); TSFileChar("::/Demo/Games/RainDrops",,CH_SHIFT_ESC);
- TS("Collision"); TSFileChar("::/Demo/Games/Collision",1500);
- TS("Logic"); DoLogic;
- TS("CompileDemo"); TSFile("::/Demo/CompileDemo");
- TS("Prompt"); DoPrompt;
- TS("WebLog"); if (DrvIsWritable('~')) DoWebLog;
- TS("RevFile"); if (DrvIsWritable('~')) DoRevFile;
- TS("SortFile"); if (DrvIsWritable('~')) DoSortFile;
- TS("ToHtmlToTXT"); if (DrvIsWritable('~')) DoToHtmlToTXT;
- TS("RegistryDemo"); if (DrvIsWritable('~'))
- TSFile("::/Demo/RegistryDemo");
- TS("Define"); DoDefine;
- TS("GlblVars"); TSFile("::/Demo/GlblVars");
- TS("FileRead"); DoFileRead;
- TS("ParenWarn"); TSFile("::/Demo/ParenWarn");
- TS("DefineStr"); TSFile("::/Demo/DolDoc/DefineStr");
- TS("Data"); TSFile("::/Demo/DolDoc/Data");
- TS("CallBack"); TSFile("::/Demo/DolDoc/CallBack");
- TS("ClassMeta"); TSFile("::/Demo/ClassMeta");
- TS("NumBible"); if (DrvIsWritable('~')) DoNumBible;
- TS("Form"); DoForm;
- TS("ClickCallBack"); DoClickCallBack;
- TS("MenuBttn"); DoMenuBttn;
- TS("MenuSprite");DoMenuSprite;
- TS("SuggestedSpelling"); DoSuggestedSpelling;
- TS("WordSearch"); TSFileChar("::/Demo/WordSearch");
- TS("StkGrow"); TSFile("::/Demo/StkGrow");
- TS("MemDemo"); TSFile("::/Demo/MemDemo");
- TS("WaterFowl"); TSFileChar("::/Demo/Snd/WaterFowl");
- TS("AsmHelloWorld"); TSFile("::/Demo/Asm/AsmHelloWorld");
- TS("AsmAndC1"); DoAsmAndC1;
- TS("AsmAndC2"); DoAsmAndC2;
- TS("AsmAndC3"); TSFile("::/Demo/Asm/AsmAndC3");
- TS("MulByHand"); TSFile("::/Demo/Asm/MulByHand");
- TS("DivByHand"); TSFile("::/Demo/Asm/DivByHand");
- TS("BuzzFizz"); TSFile("::/Demo/Asm/BuzzFizz");
- TS("PutDec"); TSFile("::/Demo/Asm/PutDec");
-
- task=User;
- TS("Prof"); XTalkWait(task,"DocMax;Prof;HeapLog(ON);\n");
- TS("PCIRep"); XTalkWait(task,"PCIRep;Sleep(750);\n");
- TS("MemBIOSRep"); XTalkWait(task,"MemBIOSRep;Sleep(750);\n");
- TS("MemPageRep"); XTalkWait(task,"MemPageRep;Sleep(750);\n");
- TS("MemRep"); XTalkWait(task,"MemRep;Sleep(750);\n");
- TS("ZipRep"); XTalkWait(task,"ZipRep;Sleep(750);\n");
- TS("ProfRep"); XTalkWait(task,"ProfRep;Sleep(750);\n");
- TS("HeapLogSizeRep"); XTalkWait(task,"HeapLogSizeRep;Sleep(750);\n");
- TS("CPURep"); if (mp_cnt>1)
- XTalkWait(task,"CPURep(TRUE);Sleep(750);\n");
- TS("DskChk"); if (DrvIsWritable(':'))
- XTalkWait(task,"DskChk;Sleep(750);\n");
- TS("DrvView"); if (DrvIsWritable(':')) {
- XTalkWait(task,"DrvView;\n");
- Sleep(750);
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- }
- TS("DskView"); if (DrvIsWritable(':')) {
- XTalkWait(task,"DskView;\n");
- Sleep(250); //Short because ATARep takes time.
- PostMsgWait(task,MSG_KEY_DOWN_UP,CH_SPACE,0);
- }
- TS("ATARep"); XTalkWait(task,"ATARep;\npSleep(750);\n");
- TS("HashDepthRep"); XTalkWait(task,
- "HashDepthRep(adam_task->hash_table);Sleep(750);\n");
- TS("Who"); XTalkWait(task,"Who;Sleep(750);\n");
- TS("DrvRep"); XTalkWait(task,"DrvRep;Sleep(750);\n");
- TS("TaskRep"); XTalkWait(task,"TaskRep;Sleep(750);\n");
- DeathWait(&task,TRUE);
-
- ProgressBarsRst("TempleOS/OSTestSuite");
- "Elapsed Time:%5.3f\n",tS-ts_t0;
-}
-
-OSTestSuite;
- - - \ No newline at end of file diff --git a/public/src/Once.HC.HTML b/public/src/Once.HC.HTML deleted file mode 100644 index b50e57f..0000000 --- a/public/src/Once.HC.HTML +++ /dev/null @@ -1,67 +0,0 @@ - - - - - Once.HC - - - - - //Place this file in /Home and change
-//anything you want.
-
-//This file is executed by the
-//first terminal window upon start-up.
-//See $LK,"Once",A="FF:~/HomeSys.HC,Once"$ and Home Files.
-
-//Delete the rest from this file.
-
-U0 Tmp()
-{
- OnceExe;
- switch (sys_boot_src.u16[0]) {
- case BOOT_SRC_ROM:
- "Continue booting hard drive ";
- if (YorN) {
- DocBottom;
- ExeFile("C:/Home/Once");
- }
- break;
- case BOOT_SRC_DVD:
- "\nIf you answer 'No' you can play with\n"
- "the live CD without installing.\n\n"
- "Install onto hard drive ";
- if (YorN) {
- DocBottom;
- RunFile("::/Misc/OSInstall",,TRUE);
- }
- if (FileFind("::/Misc/Tour")) {
- "\nTake Tour";
- if (YorN) {
- DocBottom;
- Cd("::/Misc/Tour");
- InFile("Tour");
- }
- }
- break;
- case BOOT_SRC_RAM:
- case BOOT_SRC_HARDDRV:
- "$PURPLE$$TX+CX,\"Tip of the Day\"$$FG$\n";
- TipOfDay;
- Type("::/Doc/Customize.DD");
- if (FileFind("::/Misc/Tour")) {
- "\nTake Tour";
- if (YorN) {
- DocBottom;
- Cd("::/Misc/Tour");
- InFile("Tour");
- }
- }
- break;
- }
-}
-
-Tmp;
- - - \ No newline at end of file diff --git a/public/src/StartOS.HC.HTML b/public/src/StartOS.HC.HTML deleted file mode 100644 index f500898..0000000 --- a/public/src/StartOS.HC.HTML +++ /dev/null @@ -1,58 +0,0 @@ - - - - - StartOS.HC - - - - - //This is executed by the Adam task at boot.
-//See Adam Start-up.
-
-#help_index "Compiler/Directive"
-public extern I8i Option(I64i num,I8i val);
-Option(0,0); //(0,0)=EchoOff (0,1)=EchoOn
-
-#include "/Kernel/KernelA.HH"
-#include "/Compiler/CompilerA.HH"
-#include "/Kernel/KernelB.HH"
-#include "/Kernel/KernelC.HH"
-#include "/Compiler/CompilerB.HH"
-
-Option(OPTf_WARN_PAREN,ON);
-Option(OPTf_WARN_DUP_TYPES,ON);
-HashTablePurge(adam_task->hash_table);
-
-#include "/Adam/MakeAdam"
-
-//Dbg("Type 'G;'");
-DocTermNew;
-WinVert(2,10);
-
-sys_winmgr_task=Spawn(&WinMgrTask,NULL,"Window Mgr");
-Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_BORDER
- -WIF_SELF_GRAB_SCROLL-WIF_SELF_CTRLS;
-LBts(&Fs->display_flags,DISPLAYf_CHILDREN_NOT_ON_TOP);
-LBts(&Fs->display_flags,DISPLAYf_SHOW);
-RegInit;
-LBts(&sys_run_level,RLf_REGISTRY);
-if (!ins_reg.registered)
- InsUnreg;
-
-WallPaperInit;
-
-if (DrvIsWritable)
- DirMk("/Tmp"); //Good to have a Tmp
-
-Option(OPTf_WARN_PAREN,OFF);
-Option(OPTf_WARN_DUP_TYPES,OFF);
-LBts(&sys_run_level,RLf_HOME);
-
-#help_index ""
-#include "~/MakeHome"
-
-//After this file, the Adam task enters server mode.
- - - \ No newline at end of file