TempleOSCDV5.01.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:48:15 +02:00
1 parent f6eacf7744
commit 320c7ee98a
219 files changed
+5211 -4853

No files matched your search

+27 -20
View File
@@ -1,14 +1,14 @@
//Place this file in /Home and change
//anything you want.
U0 InsTime()
U0 TimeIns()
{
CDate cdt;
cdt=Now;
"$$IV,1$$----%D %T----$$IV,0$$\n",cdt,cdt;
}
U0 InsFileLink()
U0 FileLinkIns()
{
U8 *st=PopUpPickFile;
st[0]=':'; //This is my personal code, not production. LOL
@@ -16,7 +16,7 @@ U0 InsFileLink()
Free(st);
}
U0 InsDirLinks()
U0 DirLinksIns()
{
CDirEntry *tmpde,*tmpde1;
U8 *st=PopUpPickDir,*st2;
@@ -128,40 +128,47 @@ Bool MyPutKey(I64 ch,I64 sc)
return TRUE;
case SC_F5:
if (sc&SCF_KEY_DESC)
KeyDescSet("Edit/God Offering");
KeyDescSet("Cmd /GodOffer");
else
GodOffer;
return TRUE;
case SC_F6:
if (sc&SCF_SHIFT) {
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /Ins Misc");
KeyDescSet("Cmd /TOSIns");
else
TOSInsMisc;
TOSIns;
} else {
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /Ins Datetime");
KeyDescSet("Cmd /TimeIns");
else
InsTime;
TimeIns;
}
return TRUE;
case SC_F7:
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /God Misc");
else
GodMisc;
if (sc&SCF_SHIFT) {
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /NISTGodIns2");
else
NISTGodIns2;
} else {
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /GodIns");
else
GodIns;
}
return TRUE;
case SC_F8:
if (sc&SCF_SHIFT) {
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /Ins Dir Links");
KeyDescSet("Cmd /DirLinksIns");
else
InsDirLinks;
DirLinksIns;
} else {
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /Ins File Link");
KeyDescSet("Cmd /FileLinkIns");
else
InsFileLink;
FileLinkIns;
}
return TRUE;
}
@@ -180,7 +187,7 @@ Bool MyPutKey(I64 ch,I64 sc)
return TRUE;
case 'h':
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /Tile Horizontally");
KeyDescSet("Cmd /WinTileHorz");
else
WinTileHorz;
return TRUE;
@@ -192,7 +199,7 @@ Bool MyPutKey(I64 ch,I64 sc)
return TRUE;
case 'm':
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /Maximize");
KeyDescSet("Cmd /WinMax");
else {
WinBorder;
WinMax;
@@ -200,13 +207,13 @@ Bool MyPutKey(I64 ch,I64 sc)
return TRUE;
case 'v':
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /Tile Vertically");
KeyDescSet("Cmd /WinTileVert");
else
WinTileVert;
return TRUE;
case 'V':
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /Frame Grabber Toggle");
KeyDescSet("Cmd /FrameGrabberToggle");
else
FrameGrabberToggle;
return TRUE;
+2 -9
View File
@@ -3,21 +3,14 @@ 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 "~/TOSCfg"
#include "~/TOSMisc"
#include "~/TOSToHtml"
#include "~/TOSDistro"
#include "~/TOSBlog"
#include "~/TOSHolySpirit"
#include "~/TOS/MakeTOS"
#include "~/HomeKeyPlugIns"
#include "~/HomeWrappers"
#include "~/HomeSys"
Cd("..");;
+1 -1
View File
@@ -21,7 +21,7 @@ U0 Tmp()
Del("C:/Home/DoDistro.HC.Z");
Del("D:/Home/DoDistro.HC.Z");
OnceDrv('C',"\"\n\nRun TOSStaffIns;\n\n\n\";");
OnceDrv('D',"\"\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.
}
+3 -3
View File
@@ -1,8 +1,8 @@
$MA,"Cd ",LM="Cd;Dir;\n"$$MA,"DrvC ",LM="Drv('C');\n"$$MA,"DrvD ",LM="Drv('D');\n"$$MA,"/ ",LM="Cd(\"/\");Dir;\n"$$MA,"Home ",LM="Cd(\"/Home\");Dir;\n"$$MA,"ChgDskT ",LM="ChgDsk('T');\n"$$MA,"MergeD ",LM="S2T(\"C:/*\",\"+r+S\");Merge(\"C:/*;!*/LineRep*\",\"D:/*;!*/LineRep*\",\"+r+d\");\n"$$MA,"MergeT ",LM="S2T(\"C:/*\",\"+r+S\");Merge(\"C:/*;!*/LineRep*\",\"T:/*;!*/LineRep*\",\"+r+d\");\n"$$MA,"D:/Wb ",LM="Cd(\"D:/Wb\");Dir;\n"$
$MA,"MakeC ",LM="TOSBootHDIns('C');\n"$$MA+PU,"BootC ",LM="BootRAM(\"C:/Kernel.BIN.C\");"$$MA,"Regen ",LM="TOSRegen;\n"$$MA,"PreBack ",LM="PreBackUp;\n"$$MA,"MakeD ",LM="TOSBootHDIns('D');\n"$$MA+PU,"BootD ",LM="BootRAM(\"D:/Kernel.BIN.C\");"$$MA,"CopyDrv ",LM="TOSPromptAndCopyDrv;\n"$$MA,"MakeWeb ",LM="MakeWebSitePartial;\n"$
$MA,"Cd ",LM="Cd;Dir;\n"$$MA,"DrvC ",LM="Drv('C');\n"$$MA,"DrvD ",LM="Drv('D');\n"$$MA,"/ ",LM="Cd(\"/\");Dir;\n"$$MA,"TOS ",LM="Cd(\"/Home/TOS\");Dir;\n"$$MA,"Home ",LM="Cd(\"/Home\");Dir;\n"$$MA,"ChgDskT ",LM="ChgDsk('T');\n"$$MA,"MergeD ",LM="S2T(\"C:/*\",\"+r+S\");Merge(\"C:/*;!*/LineRep*\",\"D:/*;!*/LineRep*\",\"+r+d\");\n"$$MA,"MergeT ",LM="S2T(\"C:/*\",\"+r+S\");Merge(\"C:/*;!*/LineRep*\",\"T:/*;!*/LineRep*\",\"+r+d\");\n"$$MA,"D:/Wb ",LM="Cd(\"D:/Wb\");Dir;\n"$
$MA,"MakeC ",LM="TOSBootHDIns('C');\n"$$MA+PU,"BootC ",LM="BootRAM(\"C:/Kernel.BIN.C\");"$$MA,"Regen ",LM="TOSRegen;\n"$$MA,"PreRegen",LM="TOSPreRegen;\n"$$MA,"MakeD ",LM="TOSBootHDIns('D');\n"$$MA+PU,"BootD ",LM="BootRAM(\"D:/Kernel.BIN.C\");"$$MA,"CopyDrv ",LM="TOSPmtAndCopyDrv;\n"$$MA,"MakeWeb ",LM="FreshenBlog;\n"$
$MA,"Kernel ",LM="Cd(\"/Kernel\");Dir;\n"$$MA,"Compiler",LM="Cd(\"/Compiler\");Dir;\n"$$MA,"BlkDev ",LM="Cd(\"/Kernel/BlkDev\");Dir;\n"$$MA,"Mem ",LM="Cd(\"/Kernel/Mem\");Dir;\n"$$MA,"Serial ",LM="Cd(\"/Kernel/SerialDev\");Dir;\n"$$MA,"Bin ",LM="Cd(\"/Home/Sup1/Sup1Bin\");Dir;\n"$$MA,"HDAudio ",LM="Cd(\"/Home/Sup1/Sup1HDAudio\");Dir;\n"$$MA,"Examples",LM="Cd(\"/Home/Sup1/Sup1HDAudio/Examples\");Dir;\n"$$MA,"Dist ",LM="Cd(\"/Home/Sup1/Sup1Distro\");Dir;\n"$
$MA,"Adam ",LM="Cd(\"/Adam\");Dir;\n"$$MA,"AutoComp",LM="Cd(\"/Adam/AutoComplete\");Dir;\n"$$MA,"Ctrls ",LM="Cd(\"/Adam/Ctrls\");Dir;\n"$$MA,"ABlkDev ",LM="Cd(\"/Adam/ABlkDev\");Dir;\n"$$MA,"DolDoc ",LM="Cd(\"/Adam/DolDoc\");Dir;\n"$$MA,"Gr ",LM="Cd(\"/Adam/Gr\");Dir;\n"$$MA,"God ",LM="Cd(\"/Adam/God\");Dir;\n"$$MA,"Snd ",LM="Cd(\"/Adam/Snd\");Dir;\n"$$MA,"Boot ",LM="Cd(\"/Adam/Opt/Boot\");Dir;\n"$$MA,"Utils ",LM="Cd(\"/Adam/Opt/Utils\");Dir;\n"$
$LK+X,"ChangeLg",A="FI:::/Doc/ChangeLog.DD"$$MA,"Blog ",LM="Blog;\n"$$MA,"EdGod ",LM="Ed(\"D:/Home/God.DD\");\n"$$MA,"BlogDir ",LM="Cd(\"/Home/Web/TAD/BlogDir\");Dir;\n"$$MA,"Partial ",LM="MakeWebSitePartial;\n"$$MA,"CodeWalk",LM="CodeWalkThru;\n"$$MA,"TOSTheme",LM="TempleOSTheme;\n"$$MA,"Videos ",LM="Cd(\"/Home/Sup1/Sup1Videos\");Dir;\n"$
$LK+X,"ChgLog ",A="FI:::/Doc/ChgLog.DD"$$MA,"Blog ",LM="Blog;\n"$$MA,"EdGod ",LM="Ed(\"D:/Home/God.DD\");\n"$$MA,"BlogDir ",LM="Cd(\"/Home/Web/TAD/BlogDir\");Dir;\n"$$MA,"Partial ",LM="FreshenBlog;\n"$$MA,"CodeWalk",LM="CodeWalkThru;\n"$$MA,"TOSTheme",LM="TOSTheme;\n"$$MA,"Videos ",LM="Cd(\"/Home/Sup1/Sup1Videos\");Dir;\n"$
$MA,"Web ",LM="Cd(\"/Home/Web\");Dir;\n"$$MA,"TAD ",LM="Cd(\"/Home/Web/TAD\");Dir;\n"$$MA,"DLC ",LM="Cd(\"/Home/Web/DLC\");Dir;\n"$$MA,"AppStore",LM="Cd(\"/Home/Web/AppStore\");Dir;\n"$$MA,"Sup1 ",LM="Cd(\"/Home/Sup1\");Dir;\n"$$MA,"Blog ",LM="Cd(\"/Home/Sup1/Sup1Blog\");Dir;\n"$$MA,"Code ",LM="Cd(\"/Home/Sup1/Sup1CodeScraps\");Dir;\n"$$MA,"Games ",LM="Cd(\"/Home/Sup1/Sup1Games\");Dir;\n"$$MA,"Graphics",LM="Cd(\"/Home/Sup1/Sup1Graphics\");Dir;\n"$$MA,"Utils ",LM="Cd(\"/Home/Sup1/Sup1Utils\");Dir;\n"$
$MA,"Apps ",LM="Cd(\"/Apps\");Dir;\n"$$MA,"Budget ",LM="Cd(\"/Apps/Budget\");Dir;\n"$$MA,"GrModels",LM="Cd(\"/Apps/GrModels\");Dir;\n"$$MA,"KeepAway",LM="Cd(\"/Apps/KeepAway\");Dir;\n"$$MA,"Logic ",LM="Cd(\"/Apps/Logic\");Dir;\n"$$MA,"Psalmody",LM="Cd(\"/Apps/Psalmody\");Dir;\n"$$MA,"Span ",LM="Cd(\"/Apps/Span\");Dir;\n"$$MA,"Strut ",LM="Cd(\"/Apps/Strut\");Dir;\n"$$MA,"TimeClk ",LM="Cd(\"/Apps/TimeClock\");Dir;\n"$
$MA,"Titan ",LM="Cd(\"/Apps/Titanium\");Dir;\n"$$MA,"ToTheFrt",LM="Cd(\"/Apps/ToTheFront\");Dir;\n"$$MA,"Vocab ",LM="Cd(\"/Apps/Vocabulary\");Dir;\n"$$MA,"XCaliber",LM="Cd(\"/Apps/X-Caliber\");Dir;\n"$$MA,"Books1 ",LM="Cd(\"/Home/Books1\");Dir;\n"$$MA,"Books2 ",LM="Cd(\"/Home/Books2\");Dir;\n"$$MA,"Hymns ",LM="Cd(\"/Home/Sup1/Sup1Hymns\");Dir;\n"$$MA,"Songs ",LM="Cd(\"/Home/Sup1/Sup1Songs\");Dir;\n"$
+5 -10
View File
@@ -1,4 +1,5 @@
$WW,1$$FG,5$$TX+CX,"TODO"$$FG$
* $LK,"::/Apps/X-Caliber/X-Caliber.HC"$
* Add asteroid harbor defense.
* Afterburner thruster.
@@ -10,27 +11,21 @@ $WW,1$$FG,5$$TX+CX,"TODO"$$FG$
* Helicopters.
* Anti-Aircraft.
* Make registry files more robust.
* $MA-X+PU,"64-Bit Device Memory",LM="F(\"mem64_ptr\");View;"$ is not implemented.
* $LK,"::/Demo/RandDemo.HC"$ is kinda crappy.
* Cursor in $LK,"~/TOSToHtml.HC"$.
* Cursor in $LK,"~/TOS/TOSToHtml.HC"$.
* Investigate why packet loss $LK,"Training Sleep(1)",A="FF:::/Adam/Training.HC,Sleep(1)"$.
* Naming standard with regard to "MAX_".
* 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.
* $LK,"SpriteEd",A="FI:::/Adam/Gr/SpriteEd.HC"$ shift pts, Ctrl pt for ellipse/polygon w,h is off when rotated.
* Get rid of $LK,"JobQue",A="MN:JobQue"$() and use just $LK,"Spawn",A="MN:Spawn"$()? Not sure about this, probably.
* God said this is bad. $LK,"FL:::/Adam/DolDoc/DocFind.HC,41"$
* Backward <SHIFT-F3> is broken?
* $LK,"Find",A="MN:Find"$() search sprite text?
* Cannot include ':' in $LK,"Document Links",A="FF:::/Adam/DolDoc/DocLink.HC,AD"$ search string.
* $$DA fixed width string: <Del> or <BACKSPACE> permanently shortens.
@@ -442,7 +437,7 @@ $FG,5$$TX+CX,"Misc Notes"$$FG$
Erik van der Karbargenbok: $LK,"TempleBot",A="PI:~/Sup1/Sup1Bin/TempleBot"$.
Intel CEO's name: Brian Krzanich
>$FG,2$lspci -v$FG$
Size:$TX,"17354KB",D="DD_TEMPLEOSCD_K_SIZE"$
Size:$TX,"17378KB",D="DD_TEMPLEOSCD_K_SIZE"$
$FG,5$$TX+CX,"My Web Bookmarks"$$FG$$WW,0$
$TX,"My FireFox Bookmarks",HTML="http://www.templeos.org/Wb/Home/Sup1/Sup1Blog/Bookmarks"$
+15 -12
View File
@@ -2,9 +2,9 @@ $TR-UL,"Adam"$
$ID,2$$TR,"SysMsgFlags"$
$ID,2$sys_msg_flags[0]=0xFF;
$ID,-2$$TR,"SysRegVer"$
$ID,2$registry_version=5.000;
$ID,2$registry_version=5.010;
$ID,-2$$TR,"InsReg"$
$ID,2$#help_index "Misc/Install Registration"
$ID,2$#help_index "Registry/Install Registration"
MemSet(&ins_reg,0,sizeof(CInsReg));
ins_reg.registered=1;
ins_reg.host_os=2;
@@ -24,12 +24,12 @@ HashPublic("INS_REG_MACHINE_NUM",HTT_DEFINE_STR);
$ID,-2$$ID,-2$$TR-UL,"TempleOS"$
$ID,2$$TR,"EagleDive"$
$ID,2$F64 best_score=147.6932;
$ID,-2$$TR,"TOSGodOffer"$
$ID,2$I64 tos_gus_gwen=22;
$ID,-2$$TR,"TOSVideos"$
$ID,2$I64 tos_code_walk_thru=105;
$ID,-2$$TR,"DiningStars"$
$ID,2$F64 best_score=9999.0000;
$ID,-2$$TR,"CircleTrace"$
$ID,2$F64 best_score=4.9425;
$ID,-2$$TR,"TOSNIST"$
$ID,2$I64 tos_nist_offset=-8049;
$ID,-2$$TR,"BlackDiamond"$
$ID,2$I64 best_score=1;
$ID,-2$$TR,"DunGen"$
@@ -52,20 +52,23 @@ $ID,-2$$TR,"BomberGolf"$
$ID,2$I64 best_score=175;
$ID,-2$$TR,"OSTestSuite"$
$ID,2$progress1_tf=0.000;progress2_tf=0.000;
progress3_tf=0.000;progress4_tf=220.470;
progress3_tf=0.000;progress4_tf=228.734;
$ID,-2$$TR,"Titanium"$
$ID,2$I64 best_score=16469;
$ID,-2$$TR,"XCaliber"$
$ID,2$I64 best_score=90;
I64 msg_flags=3;
I64 msg_flags=2;
$ID,-2$$TR,"Talons"$
$ID,2$F64 best_score=9999.0000;
$ID,-2$$TR,"CircleTrace"$
$ID,2$F64 best_score=4.9425;
$ID,-2$$TR,"TOSRegen"$
$ID,2$progress1_tf=0.000;progress2_tf=0.000;
progress3_tf=0.000;progress4_tf=174.320;
progress3_tf=0.000;progress4_tf=192.371;
$ID,-2$$ID,-2$$TR,"Once"$
$ID,2$$TR,"Adam"$
$ID,2$$ID,-2$$TR,"User"$
$ID,2$$ID,-2$$ID,-2$
$ID,2$$ID,-2$$ID,-2$$TR,"DemoCompany"$
$ID,2$$TR,"Game1"$
$ID,2$F64 best_score=1735.08564;
$TR,"SimpleVal"$
$ID,2$1236;
$ID,-2$$ID,-2$$ID,-2$
+13
View File
@@ -0,0 +1,13 @@
Cd(__DIR__);;
#include "TOSExt"
#include "TOSCfg"
#include "TOSMisc"
#include "TOSToHtml"
#include "TOSDistro"
#include "TOSBlog"
#include "TOSNIST"
#include "TOSHolySpirit"
#include "TOSIns"
Cd("..");;
@@ -1,18 +1,19 @@
U8 *BlogLocalDir(CDate cdt=0)
{
#help_index "Misc/Blog"
public U8 *BlogLocalDir(CDate cdt=0)
{//MAlloc dirname of blog for date.
static U8 dir[STR_LEN];
CDateStruct ds;
if (!cdt) cdt=Now+local_time_offset;
Date2Struct(&ds,cdt);
StrPrint(dir,BLOG_LOCAL_BASE "/%d%Z",
ds.year,ds.mon-1,"ST_MONTHS");
StrPrint(dir,BLOG_LOCAL_BASE "/%d%Z",ds.year,ds.mon-1,"ST_MONTHS");
if (!FileFind(dir,,FUF_JUST_DIRS))
MkDir(dir);
return dir;
}
U8 *BlogLocalFile(CDate cdt=0)
{
public U8 *BlogLocalFile(CDate cdt=0)
{//MAlloc filename of blog for date.
static U8 file[STR_LEN];
CDateStruct ds;
if (!cdt) cdt=Now+local_time_offset;
@@ -22,8 +23,8 @@ U8 *BlogLocalFile(CDate cdt=0)
return file;
}
U8 *BlogWebDir(CDate cdt=0)
{
public U8 *BlogWebDir(CDate cdt=0)
{//MAlloc D:/Wb/dirname of blog for date.
static U8 dir[STR_LEN];
CDateStruct ds;
if (!cdt) cdt=Now+local_time_offset;
@@ -33,8 +34,8 @@ U8 *BlogWebDir(CDate cdt=0)
return dir;
}
U8 *BlogWebFile(CDate cdt=0)
{
public U8 *BlogWebFile(CDate cdt=0)
{//MAlloc D:/Wb/filename of blog for date.
static U8 file[STR_LEN];
CDateStruct ds;
if (!cdt) cdt=Now+local_time_offset;
@@ -45,15 +46,15 @@ U8 *BlogWebFile(CDate cdt=0)
}
public U8 *FileNameNumNext(U8 *files_find_mask,U8 *fmt)
{
{//Cnt files in a mask. Create next filename.
CDirEntry *tmpde=FilesFind(files_find_mask);
U8 *res=MStrPrint(fmt,FileCnt(tmpde));
DirTreeDel(tmpde);
return res;
}
U0 BlogDCImgWrite(CDC *dc,CDate cdt=0)
{
public U0 BlogDCImgWrite(CDC *dc,CDate cdt=0)
{//Add dc to blog as BMP file.
U8 file_mask[STR_LEN],file_name[STR_LEN],*st1,*st2;
if (!cdt) cdt=Now+local_time_offset;
StrPrint(file_mask,"%s/Img*",BlogLocalDir(cdt));
@@ -67,9 +68,9 @@ U0 BlogDCImgWrite(CDC *dc,CDate cdt=0)
Free(st2);
}
U0 BlogScrnShot()
{
Bool old_cursor=DocCursor;
public U0 BlogScrnShot()
{//Add scrn shot to blog as BMP file.
Bool old_cursor=DocCursor,old_silent;
CDC *dc1,*dc2;
U8 *old_fp_draw_ms=gr.fp_draw_ms;
gr.fp_draw_ms=NULL;
@@ -81,15 +82,18 @@ U0 BlogScrnShot()
DCDel(dc1);
DCDel(dc2);
DocCursor(old_cursor);
old_silent=Silent;
FreshenBlog;
Silent(old_silent);
}
public U0 MakeWebSitePartial()
{
public U0 FreshenBlog()
{//Regen html files for D:/Home/Web.
MkDir("D:/Wb");
MkDir("D:/Wb/Home");
MkDir("D:/Wb/Home/Web");
MkDir("D:/Wb/Home/Web/TAD");
MkDir("D:/Wb/Home/Web/TAD/BlogDir");
MkDir("D:/Wb/Home/Web/" INS_REG_PERSONAL_INITIALS);
MkDir("D:/Wb/Home/Web/" INS_REG_PERSONAL_INITIALS "/BlogDir");
FreshenWebDir("/Home/Web");
FreshenWebDir("/Home/Web/" INS_REG_PERSONAL_INITIALS);
@@ -97,8 +101,8 @@ public U0 MakeWebSitePartial()
Drv('C');
}
public U0 Blog(Bool ALT_F6=TRUE)
{
public U0 Blog(Bool god_misc2=FALSE)
{//Make entry in blog.
if (!FileFind(BlogLocalFile,,FUF_JUST_FILES))
Copy("~/Web/" INS_REG_PERSONAL_INITIALS "/DailyBlogHeader.DD.Z",
BlogLocalFile);
@@ -106,7 +110,9 @@ public U0 Blog(Bool ALT_F6=TRUE)
WinBorder;
WinMax;
Msg(MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN|SCF_CTRL);
if (ALT_F6) {
if (god_misc2)
Msg(MSG_KEY_DOWN_UP,0,SC_F7|SCF_SHIFT|SCF_ALT);
else {
Msg(MSG_KEY_DOWN_UP,0,SC_F6|SCF_ALT);
Msg(MSG_KEY_DOWN_UP,'\n',0);
}
@@ -1,4 +1,4 @@
#help_index "TOS"
#help_index "Misc/TOS/Cfg"
#define PERSONAL_WEB "http:/" "/www.templeos.org/Wb"
#define BLOG_BASE "/Home/Web/"\
@@ -9,24 +9,24 @@
#define BLOG_WEB_BASE PERSONAL_WEB BLOG_BASE
#define SLOP BLK_SIZE
U0 TOSBootRescueDrv1()
U0 TOSDbgDistro1()
{
CBinFile *bfh=mem_boot_base-sizeof(CBinFile);
bfh(I64)+=bfh->file_size-1;
DefinePrint("TOS_BOOT_RESCUE_DRV","0x%X",
DefinePrint("TOS_DBG_DISTRO","0x%X",
CeilI64(SYS_KERNEL_END+SLOP,BLK_SIZE));
DefinePrint("TOS_BOOT_RESCUE_DRV_END", "0x%X",FloorI64(
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_BOOT_RESCUE_DRV_FILE","\"/Tmp/BootRescueDrv.BIN.Z\"");
} TOSBootRescueDrv1;
DefinePrint("CFG_DBG_DISTRO_FILE","\"/Tmp/DbgDistro.BIN.Z\"");
} TOSDbgDistro1;
U0 TOSBootRescueDrv2()
U0 TOSDbgDistro2()
{
DefinePrint("CFG_BOOT_RESCUE_DRV","\"a0x%X\n0x%X\n\"",TOS_BOOT_RESCUE_DRV,
(TOS_BOOT_RESCUE_DRV_END-TOS_BOOT_RESCUE_DRV)/BLK_SIZE);
DefinePrint("CFG_BOOT_RESCUE_DRV_START","\"0x%X\"",TOS_BOOT_RESCUE_DRV);
} TOSBootRescueDrv2;
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()
{
@@ -62,8 +62,8 @@ U0 TOSInit()
#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\nAutoMountIDE\nCT\n"
#define TOS_DVD_DBG_CFG "A" CFG_BOOT_RESCUE_DRV\
#define TOS_DVD_DBG_CFG "A" CFG_DBG_DISTRO\
"B\nScale2Mem(2048,0x40000)\n\n\n"\
"NoMP\nTextMode\nDontProbe\nBootRescueDrv\n"\
"C:" CFG_BOOT_RESCUE_DRV_FILE "\n"\
CFG_BOOT_RESCUE_DRV_START "\n\n"
"NoMP\nTextMode\nDontProbe\nDbgDistro\n"\
"C:" CFG_DBG_DISTRO_FILE "\n"\
CFG_DBG_DISTRO_START "\n\n"
@@ -1,6 +1,6 @@
//The CFG defines are $LK,"~/TOSCfg.HC",A="FI:::/Demo/AcctExample/TOSCfg.HC"$.
//The CFG defines are $LK,"~/TOS/TOSCfg.HC",A="FI:::/Demo/AcctExample/TOS/TOSCfg.HC"$.
#help_index "TOS"
#help_index "Misc/TOS/Distro"
#define MAKE_STD 1
#define MAKE_STD_RS 0
@@ -13,8 +13,8 @@
#define MAKE_DBG 0
#define MAKE_STAFF 1
U8 TOSGetDrv()
{
public U8 TOSGetDrv()
{//Pmt for drv let.
I64 res;
"Drive (%s):",TOS_HDS;
res=Let2Let(GetChar);
@@ -22,8 +22,8 @@ U8 TOSGetDrv()
return res;
}
U0 TOSBootHDIns(U8 drv_let=0)
{
public U0 TOSBootHDIns(U8 drv_let=0)
{//Make Compiler and Kernel. Reinstall Kernel.
drv_let=Let2Let(drv_let);
In(TOS_CFG);
BootHDIns(drv_let);
@@ -31,8 +31,8 @@ U0 TOSBootHDIns(U8 drv_let=0)
BootMHDIns(drv_let);
}
U0 TOSCopyDrv(U8 src,U8 dst)
{
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);
@@ -48,9 +48,9 @@ U0 TOSCopyDrv(U8 src,U8 dst)
TOSBootHDIns(dst);
}
U0 TOSPromptAndCopyDrv()
{
I64 src,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$$";
@@ -58,7 +58,7 @@ U0 TOSPromptAndCopyDrv()
TOSCopyDrv(src,dst);
}
public U0 CopySongs(U8 threshold='7')
U0 DistroSongsPrep(U8 threshold='7')
{
CDoc *doc;
CDocEntry *doc_e;
@@ -79,10 +79,13 @@ public U0 CopySongs(U8 threshold='7')
U0 DistroPrep()
{
AOnceFlush; //Don't want in Registry
OnceFlush;
Del("/Home/Demo*");
DelTree("/Home/*Tmp.DD.Z");
if (FileFind("/Home/Sup1/Sup1Hymns"))
CopySongs;
DistroSongsPrep;
DelTree("/Tmp");
MkDir("/Tmp");
@@ -102,13 +105,13 @@ U0 DistroPrep()
Del("/Demo/AcctExample/Test*");
Copy("/Home/Web/index.DD.Z",
"/Demo/ToHtmlToTXTDemo/DemoInPage.DD.Z");
if (FileFind("/Home/Sup1/Sup1Utils/SortHeaders.HC.Z"))
ExeFile("/Home/Sup1/Sup1Utils/SortHeaders.HC.Z");
if (FileFind("~/Sup1/Sup1Utils/SortHeaders.HC.Z"))
ExeFile("~/Sup1/Sup1Utils/SortHeaders.HC.Z");
if (FileFind("/Home/Sup1/Sup1Blog/YouTube.DD.Z"))
Sort("/Home/Sup1/Sup1Blog/YouTube.DD.Z",,2);
if (FileFind("~/Sup1/Sup1Blog/YouTube.DD.Z"))
Sort("~/Sup1/Sup1Blog/YouTube.DD.Z",,2);
//Once in a while, do $LK,"~/Sup1/Sup1Utils/DblSpaceScan.HC"$.
//Once in a while, do ~/Sup1/Sup1Utils/DblSpaceScan.HC.
CursorRem("/*");
DelTree("/Demo/*.BI*");
@@ -117,11 +120,11 @@ U0 DistroPrep()
Move(ACD_DEF_FILENAME,ACD_DEF_FILENAME_Z);
}
U0 MakeBootRescueDrvFile()
U0 DbgDistroFilePrep()
{
CBlkDev *bd;
if (!Let2Drv('A',FALSE)) {
In(CFG_BOOT_RESCUE_DRV "\n");
In(CFG_DBG_DISTRO "\n");
Mount;
}
bd=Let2BlkDev('A');
@@ -148,7 +151,7 @@ U0 MakeBootRescueDrvFile()
Copy("C:/Adam/AMem.HC.Z", "A:/Adam");
Copy("C:/Adam/TaskRep.HC.Z", "A:/Adam");
FileWrite("C:" CFG_BOOT_RESCUE_DRV_FILE,
FileWrite("C:" CFG_DBG_DISTRO_FILE,
bd->RAM_dsk,(bd->max_blk+1)<<BLK_SIZE_BITS);
}
@@ -193,8 +196,8 @@ I64 MakeLineRepFile()
DistroPrep;
Cd("C:/");
DelTree("B:/TOS");
CopyTree("C:/Home","B:/TOS");
DelTree("B:/TOS/TOS");
CopyTree("C:/Home","B:/TOS/TOS");
DelTree("C:/Home");
DocMax;
@@ -202,7 +205,7 @@ I64 MakeLineRepFile()
res=LineRep;
if (doc=DocPut) {
st=StrNew(doc->filename.name);
StrCpy(doc->filename.name,"B:/TOS/Web/LineRep.DD.Z");
StrCpy(doc->filename.name,"B:/TOS/TOS/Web/LineRep.DD.Z");
DocWrite(doc);
StrCpy(doc->filename.name,st);
Free(st);
@@ -213,8 +216,8 @@ I64 MakeLineRepFile()
LineRep("C:/Compiler/*","-S+$$")+
LineRep("C:/Kernel/*");
DocClear;
CopyTree("B:/TOS","C:/Home");
DelTree("B:/TOS");
CopyTree("B:/TOS/TOS","C:/Home");
DelTree("B:/TOS/TOS");
doc=DocRead("C:/Adam/ADefine.HC.Z");
DocTreeFind(doc,"LineRep",&tree_branch,&start_indent,&end_indent);
@@ -253,7 +256,7 @@ U0 MakeStaffDistro()
ISO9660ISO(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOS_STAFF_SIZE",
"Download $TX,"TempleOS V5.00",D="DD_OS_NAME_VERSION"$ - T.S. Company Internal Distro (%0.1fMB)",
"Download $TX,"TempleOS V5.01",D="DD_OS_NAME_VERSION"$ - T.S. Company Internal Distro (%0.1fMB)",
0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
Drv('C');
}
@@ -262,7 +265,7 @@ U0 DbgDistroPrep()
{
Drv('C');
DistroPrep;
MakeBootRescueDrvFile;
DbgDistroFilePrep;
In(TOS_DVD_DBG_CFG);
BootDVDIns('C');
Fmt('B',,FALSE,FSt_REDSEA);
@@ -280,7 +283,7 @@ U0 MakeDbgDistro()
ISO9660ISO(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOS_DBG_SIZE",
"Download $TX,"TempleOS V5.00",D="DD_OS_NAME_VERSION"$ - Debug Distro (%0.1fMB)",
"Download $TX,"TempleOS V5.01",D="DD_OS_NAME_VERSION"$ - Debug Distro (%0.1fMB)",
0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
Drv('C');
}
@@ -306,7 +309,7 @@ U0 MakeStdDistro()
ISO9660ISO(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOSCD_SIZE",
"Download $TX,"TempleOS V5.00",D="DD_OS_NAME_VERSION"$ - Standard Distro (%0.1fMB)",
"Download $TX,"TempleOS V5.01",D="DD_OS_NAME_VERSION"$ - Standard Distro (%0.1fMB)",
0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
Drv('C');
}
@@ -315,7 +318,7 @@ U0 MakeStdRedSeaDistro()
StdDistroPrep;
RedSeaISO(TOS_ISO_C_NAME,TOS_DISTRO_DIR,TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOSCD_RS_SIZE",
"Download $TX,"TempleOS V5.00",D="DD_OS_NAME_VERSION"$ - Standard RedSea Distro (%0.1fMB)",
"Download $TX,"TempleOS V5.01",D="DD_OS_NAME_VERSION"$ - Standard RedSea Distro (%0.1fMB)",
0.1*(10*Size(TOS_ISO_C_NAME,"+s")/1024/1024));
Drv('C');
}
@@ -348,7 +351,7 @@ U0 MakeUltraDistro()
ISO9660ISO(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOS_ULTRA_SIZE",
"Download $TX,"TempleOS V5.00",D="DD_OS_NAME_VERSION"$ - UltraSmall Distro (%0.2fMB)",
"Download $TX,"TempleOS V5.01",D="DD_OS_NAME_VERSION"$ - UltraSmall Distro (%0.2fMB)",
0.01*(100*Size(TOS_ISO_NAME,"+s")/1024/1024));
Drv('C');
}
@@ -357,7 +360,7 @@ U0 MakeUltraRedSeaDistro()
UltraDistroPrep;
RedSeaISO(TOS_ISO_C_NAME,TOS_DISTRO_DIR,TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOS_ULTRA_RS_SIZE",
"Download $TX,"TempleOS V5.00",D="DD_OS_NAME_VERSION"$ - UltraSmall RedSea Distro (%0.2fMB)",
"Download $TX,"TempleOS V5.01",D="DD_OS_NAME_VERSION"$ - UltraSmall RedSea Distro (%0.2fMB)",
0.01*(100*Size(TOS_ISO_C_NAME,"+s")/1024/1024));
Drv('C');
}
@@ -367,28 +370,28 @@ U0 UpdateISODocDefines()
try {
#if MAKE_STD
DefinePrint("DD_TEMPLEOSCD_SIZE",
"Download $TX,"TempleOS V5.00",D="DD_OS_NAME_VERSION"$ - Standard Distro (%0.1fMB)",
"Download $TX,"TempleOS V5.01",D="DD_OS_NAME_VERSION"$ - Standard Distro (%0.1fMB)",
0.1*(10*Size("D:/Wb/TempleOSCD.ISO","+s")/1024/1024));
DefinePrint("DD_TEMPLEOSCD_K_SIZE",
"%dKB",Size("D:/Wb/TempleOSCD.ISO","+s")/1024);
#endif
#if MAKE_STD_RS
DefinePrint("DD_TEMPLEOSCD_RS_SIZE",
"Download $TX,"TempleOS V5.00",D="DD_OS_NAME_VERSION"$ - Standard RedSea Distro (%0.1fMB)",
"Download $TX,"TempleOS V5.01",D="DD_OS_NAME_VERSION"$ - Standard RedSea Distro (%0.1fMB)",
0.1*(10*Size("D:/Wb/TempleOSCDRS.ISO","+s")/1024/1024));
DefinePrint("DD_TEMPLEOSCD_RS_K_SIZE",
"%dKB",Size("D:/Wb/TempleOSCDRS.ISO","+s")/1024);
#endif
#if MAKE_ULTRA
DefinePrint("DD_TEMPLEOS_ULTRA_SIZE",
"Download $TX,"TempleOS V5.00",D="DD_OS_NAME_VERSION"$ - UltraSmall Distro (%0.2fMB)",
"Download $TX,"TempleOS V5.01",D="DD_OS_NAME_VERSION"$ - UltraSmall Distro (%0.2fMB)",
0.01*(100*Size("D:/Wb/TempleOSUltra.ISO","+s")/1024/1024));
DefinePrint("DD_TEMPLEOS_ULTRA_K_SIZE",
"%dKB",Size("D:/Wb/TempleOSUltra.ISO","+s")/1024);
#endif
#if MAKE_ULTRA_RS
DefinePrint("DD_TEMPLEOS_ULTRA_RS_SIZE",
"Download $TX,"TempleOS V5.00",D="DD_OS_NAME_VERSION"$ - UltraSmall RedSea Distro (%0.2fMB)",
"Download $TX,"TempleOS V5.01",D="DD_OS_NAME_VERSION"$ - UltraSmall RedSea Distro (%0.2fMB)",
0.01*(100*Size("D:/Wb/TempleOSUltraRS.ISO","+s")/1024/1024));
DefinePrint("DD_TEMPLEOS_ULTRA_RS_K_SIZE",
"%dKB",Size("D:/Wb/TempleOSUltraRS.ISO","+s")/1024);
@@ -399,32 +402,54 @@ U0 UpdateISODocDefines()
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=13+MAKE_STD+MAKE_STD_RS+MAKE_ULTRA+MAKE_ULTRA_RS+MAKE_SUP1+
MAKE_WEB+MAKE_BOOKS1+MAKE_BOOKS2+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 TOSProfanity()
I64 TOSProfanity()
{
Profanity(,"D:/Wb/*;"
I64 res;
if (res=Profanity(,"D:/Wb/*;"
"!*/Misc/PCIDevices.DD*;!*/Misc/Bible.TXT*;"
"!*/Books?/*;!*/Sup1/Sup1Words/*;!*/Sup1/Sup1Blog/Profanity.DD*;"
"!*/Sup1/Sup1Blog/NumBible.TXT*;!*/God/Vocab.DD*"
);
"!*/Sup1/Sup1Blog/NumBible.TXT*;!*/God/Vocab.DD*")) {
while (PressAKey!=CH_SHIFT_ESC) {
ProgressBarsRst;
if (Profanity(,"C:/Home/*;"
"!*/Misc/PCIDevices.DD*;!*/Misc/Bible.TXT*;"
"!*/Books?/*;!*/Sup1/Sup1Words/*;!*/Sup1/Sup1Blog/Profanity.DD*;"
"!*/Sup1/Sup1Blog/NumBible.TXT*;!*/God/Vocab.DD*")) {
"\n\nEdit profanity and press $FG,2$ESC$FG$.\n";
if (!View)
break;
DocBottom;
} else
break;
}
}
return res;
}
public U0 TOSRegen()
U0 TOSRegen3()
{
I64 slash_home=0;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
progress3_max=1;
progress4=-1;
*progress4_desc=0;
progress4_max=12+MAKE_STD+MAKE_STD_RS+MAKE_ULTRA+MAKE_ULTRA_RS+MAKE_SUP1+
MAKE_WEB+MAKE_BOOKS1+MAKE_BOOKS2+MAKE_DBG+MAKE_STAFF;
progress4_t0=tS;
tos_progress=-1;
tos_progress_t0=tS;
RegExe("TempleOS/TOSRegen");
TOSProgress("ChkDsk All");
@@ -518,28 +543,47 @@ public U0 TOSRegen()
MakeSymFiles;
DocClear;
TOSProgress("Make WebSite");
MakeWebSite;
TOSProgress("Freshen WebSite");
FreshenSite;
DocClear;
TOSProgress("Check WebSite for Profanity");
if (TOSProfanity)
throw;
TOSProgress("Find /Home");
slash_home=F2("/Home","-i+la");
TOSProgress("ChkDsk All");
Drv('C');
ChkAll;
TOSProgress("Done");
SettingsPop;
"Elapsed Time:%5.3f\n",tS-progress4_t0;
"F2(\"/Home\") Cnt\t:%d\n",slash_home;
"Elapsed Time\t:%5.3fs\n",tS-progress4_t0;
ProgressBarsRst("TempleOS/TOSRegen");
}
public U0 PreBackUp()
{
public U0 TOSPreRegen()
{//Copy bookmarks and bins from D:/Home/Sup1 to C:/Home/Sup1
Copy("D:/Home/Sup1/Sup1Blog/Bookmarks.html","C:/Home/Sup1/Sup1Blog");
Del("C:/Home/Sup1/Sup1Bin/*");
Copy("D:/Home/Sup1/Sup1Bin/*","C:/Home/Sup1/Sup1Bin");
Copy("D:/Home/Sup1/Sup1Bin/God*","C:/Linux");
}
U0 TOSRegen2()
{
TOSChgLog; //$LK,"::/Doc/ChgLog.DD"$ datetime matches Kernel $LK,"sys_compile_time",A="MN:sys_compile_time"$.
TOSBootHDIns('C');
Once("TOSRegen3;");
BootRAM("C:/Kernel/" KERNEL_BIN_C); //Boot new Kernel and Compiler.
}
public U0 TOSRegen()
{//Generate distro ISO's and website image, D:/Wb.
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"$.
}
+263
View File
@@ -0,0 +1,263 @@
#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_RANDOM_ORG 3
#define GSRC_RANDOM_NUMBERS_INFO 4
#define GSRC_PASSWORD 5
#define GSRC_GENERATE_DATA 6
#define GSRC_VIRTUAL_NOTARY 7
#define GSRC_TIMER 8
#define GBP_SHORT 0
#define GBP_MEDIUM 1
#define GBP_LONG 2
class CRandExtDec5Form
{
I64 timestamp;
U8 rnd0[512] fmtstr "$$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] fmtstr "$$DA-P,A=\"Hex Word Indices#0:%s\"$$\n";
U8 rnd1[512] fmtstr "$$DA-P,A=\"Hex Word Indices#1:%s\"$$\n";
U8 rnd2[512] fmtstr "$$DA-P,A=\"Hex Word Indices#2:%s\"$$\n";
U8 rnd3[512] fmtstr "$$DA-P,A=\"Hex Word Indices#3:%s\"$$\n";
U8 rnd4[512] fmtstr "$$DA-P,A=\"Hex Word Indices#4:%s\"$$\n";
U8 rnd5[512] fmtstr "$$DA-P,A=\"Hex Word Indices#5:%s\"$$\n";
U8 rnd6[512] fmtstr "$$DA-P,A=\"Hex Word Indices#6:%s\"$$\n";
U8 rnd7[512] fmtstr "$$DA-P,A=\"Hex Word Indices#7:%s\"$$\n";
U8 rnd8[512] fmtstr "$$DA-P,A=\"Hex Word Indices#8:%s\"$$\n";
U8 rnd9[512] fmtstr "$$DA-P,A=\"Hex Word Indices#9:%s\"$$\n";
U8 rndA[512] fmtstr "$$DA-P,A=\"Hex Word Indices#A:%s\"$$\n";
U8 rndB[512] fmtstr "$$DA-P,A=\"Hex Word Indices#B:%s\"$$\n";
I64 cert;
};
class CNISTBeaconHexWordForm
{
I64 timestamp fmtstr "$$DA,A=\"TimeStamp:%d\"$$\n";
U8 rnd0[512] fmtstr "$$DA-P,A=\"Hex Word Indices#0:%s\"$$\n";
U8 rnd1[512] fmtstr "$$DA-P,A=\"Hex Word Indices#1:%s\"$$\n";
U8 rnd2[512] fmtstr "$$DA-P,A=\"Hex Word Indices#2:%s\"$$\n";
U8 rnd3[512] fmtstr "$$DA-P,A=\"Hex Word Indices#3:%s\"$$\n";
U8 rnd4[512] fmtstr "$$DA-P,A=\"Hex Word Indices#4:%s\"$$\n";
U8 rnd5[512] fmtstr "$$DA-P,A=\"Hex Word Indices#5:%s\"$$\n";
U8 rnd6[512] fmtstr "$$DA-P,A=\"Hex Word Indices#6:%s\"$$\n";
U8 rnd7[512] fmtstr "$$DA-P,A=\"Hex Word Indices#7:%s\"$$\n";
U8 rnd8[512] fmtstr "$$DA-P,A=\"Hex Word Indices#8:%s\"$$\n";
U8 rnd9[512] fmtstr "$$DA-P,A=\"Hex Word Indices#9:%s\"$$\n";
U8 rndA[512] fmtstr "$$DA-P,A=\"Hex Word Indices#A:%s\"$$\n";
U8 rndB[512] fmtstr "$$DA-P,A=\"Hex Word Indices#B:%s\"$$\n";
I64 cert;
};
class CRandHex5Form
{
I64 timestamp;
U8 rnd0[512] fmtstr "$$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] fmtstr "$$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] fmtstr "$$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] fmtstr "$$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] fmtstr "$$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 CMetallicaForm
{
I64 timestamp;
U8 rnd0[512] fmtstr "$$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] fmtstr "$$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 fmtstr "$$DA,A=\"Certificate:%d\"$$\n";
};
class CGodVideoForm
{
U8 title[STR_LEN] fmtstr "$$DA-P,A=\"Title:%s\"$$\n";
U8 serial[STR_LEN] fmtstr "$$DA-P-TRM,LEN=11,A=\"SerialNum:%11s\"$$\n";
I64 min fmtstr "$$DA,A=\"Minutes:%d\"$$\n";
I64 sec fmtstr "$$DA,A=\"Seconds:%d\"$$\n";
};
class CWebBibleForm
{
U8 tag[STR_LEN] fmtstr "$$DA-P,A=\"Tag Text:%s\"$$\n";
U8 special[STR_LEN] fmtstr "$$DA-P,A=\"Bible Passage:%s\"$$\n";
I64 min;
I64 sec;
};
class CYouTubeForm
{
U8 tag[STR_LEN] fmtstr "$$DA-P,A=\"Title:%s\"$$\n";
U8 special[STR_LEN] fmtstr "$$DA-P-TRM,LEN=11,A=\"SerialNum:%11s\"$$\n";
I64 min fmtstr "$$DA,A=\"Minutes:%d\"$$\n";
I64 sec fmtstr "$$DA,A=\"Seconds:%d\"$$\n";
};
class CImgurForm
{
U8 tag[STR_LEN];
U8 special[STR_LEN] fmtstr "$$DA-P,A=\"SerialNum:%s\"$$\n";
I64 min fmtstr "$$DA,A=\"Width :%d\"$$\n";
I64 sec fmtstr "$$DA,A=\"Height :%d\"$$\n";
};
class CWikipediaForm
{
U8 tag[STR_LEN] fmtstr "$$DA-P,A=\"Tag Text:%s\"$$\n";
U8 special[STR_LEN] fmtstr "$$DA-P,A=\"Index :%s\"$$\n";
I64 min;
I64 sec;
};
class CWebBookMarkForm
{
U8 tag[STR_LEN] fmtstr "$$DA-P,A=\"Tag Text:%s\"$$\n";
U8 special[STR_LEN];
I64 min;
I64 sec;
};
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 GodVideo(U8 *title,U8 *webpage,U8 *rnd,I64 digits,U8 *filename);
extern U0 GodWebIdx(U8 *title,U8 *webpage,U8 *rnd,I64 digits,U8 *filename)
extern U0 GodWordBatch(CHexWordForm *gm);
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);
+640
View File
@@ -0,0 +1,640 @@
#help_index "Misc/TOS/God;God/TOS"
U8 *URLPercentSpaces(U8 *src)
{
U8 buf[2048],*dst=buf;
while (*src) {
if (*src==CH_SPACE) {
*dst++='%';
*dst++='2';
*dst++='0';
src++;
} else
*dst++=*src++;
}
*dst=0;
return StrNew(buf);
}
U8 *URLPlusSpaces(U8 *src)
{
U8 buf[2048],*dst=buf;
while (*src) {
if (*src==CH_SPACE) {
*dst++='+';
src++;
} else
*dst++=*src++;
}
*dst=0;
return StrNew(buf);
}
I64 ExtDecFromHex(U8 *st,I64 digits)
{
I64 res=0,ch;
while (digits) {
if (!(ch=*st++))
break;
if ('0'<=ch<='9') {
res=10*res+ch-'0';
digits--;
}
}
return res;
}
U0 TOSBookLines(U8 *book_filename,I64 book_lines,U8 *st,I64 num_lines,
I64 radix,Bool modulo,Bool plus_one)
{//Radix<0 means extract N dec digits from hex.
CDoc *doc_out,*doc_in;
CDocEntry *doc_e;
I64 i,start;
U8 *verse;
if (*st && (doc_out=DocPut)) {
if (radix<0)
i=ExtDecFromHex(st,-radix);
else
i=Str2I64(st,radix);
if (radix<0)
DocPrint(doc_out,"'%s'-->(Taking first %d decimal digits)",st,-radix);
else if (radix==16)
DocPrint(doc_out,"0x%s-->",st);
if (modulo) {
DocPrint(doc_out,"(%d remainder when divided by %d)",
i,book_lines-(num_lines-1));
start=i%(book_lines-(num_lines-1));
} else {
if (radix>=0 || plus_one)
DocPrint(doc_out,"%d",i);
start=i;
}
if (plus_one) {
start++;
DocPrint(doc_out,"+1");
}
DocPrint(doc_out,"-->Line:%d\n",start);
if (StrMatch("NumBible",book_filename)) {
verse=BibleLine2Verse(start);
DocPrint(doc_out,"$TX,"KingJamesBible",HTML="http://www.templeos.org/Wb/Home/Sup1/Sup1Blog/NumBible.TXT"$ (%s)\n\nGod says...\n$$RED$$",verse);
Free(verse);
}
doc_in=DocNew;
BookLines(doc_in,start,num_lines,book_filename);
while (TRUE) {//Del leading blanks
doc_e=doc_in->head.next;
if (doc_e==doc_in)
break;
else {
if (doc_e->type_u8==DOCT_NEW_LINE)
DocEntryDel(doc_in,doc_e);
else
break;
}
}
while (TRUE) {//Del trailing blanks
doc_e=doc_in->cur_entry->last;
if (doc_e==doc_in)
break;
else {
if (doc_e->type_u8==DOCT_NEW_LINE)
DocEntryDel(doc_in,doc_e);
else
break;
}
}
DocPrint(doc_in,"$$FG$$\n");
DocInsDoc(doc_out,doc_in);
DocDel(doc_in);
}
}
public U0 GodBooksPassageU32(U32 rand_u32,U8 *files_find_mask,
U8 *file_mask="*",I64 len=512,I64 verbosity=GBP_MEDIUM)
{//Make God pick a book passage. $LK+PU,"Holy Spirit Instructions",A="FI:::/Adam/God/HSNotes.DD"$
CDirEntry *tmpde=FilesFind(files_find_mask,
FUF_RECURSE|FUF_JUST_FILES|FUF_JUST_TXT),
*tmpde1,*tmpde2,**tmpde3;
I64 i=0;
U8 *st,*st2=NULL;
tmpde3=&tmpde2;
tmpde2=NULL;
while (tmpde) {
tmpde1=tmpde->next;
if (WildMatch(tmpde->full_name,file_mask)) {
*tmpde3=tmpde;
tmpde3=&tmpde->next;
} else
DirEntryDel(tmpde);
tmpde=tmpde1;
}
*tmpde3=NULL;
if (tmpde=tmpde2) {
while (tmpde) {
st=FileRead(tmpde->full_name);
tmpde->user_data=StrLen(st);
if (verbosity==GBP_LONG)
"%08X-",i;
if (tmpde->user_data>=len)
i+=tmpde->user_data+1-len;
if (verbosity==GBP_LONG)
"%08X:$$LK,\"%s\",A=\"FI:%s\"$$\n",
i-1,tmpde->full_name+2,tmpde->full_name;
Free(st);
tmpde=tmpde->next;
}
if (verbosity==GBP_LONG)
'\n';
if (verbosity>=GBP_MEDIUM)
"%08X*%08X",rand_u32,i;
i*=rand_u32;
if (verbosity>=GBP_MEDIUM)
"=%08X.%08X\n",i.u32[1],i.u32[0];
i=i.u32[1];
tmpde=tmpde2;
while (tmpde) {
if (!st2 && tmpde->user_data>=len) {
i-=tmpde->user_data+1-len;
if (i<0) {
st=FileRead(tmpde->full_name);
st2=st+(tmpde->user_data+1-len)+i;
st2[len]=0;
"%s\nGod says...\n$$RED$$%s$$FG$$\n",tmpde->full_name,st2;
Free(st);
}
}
tmpde=tmpde->next;
}
DirTreeDel(tmpde2);
}
}
U8 *FileDblRead(U8 *filename,I64 line)
{//FileDbl's are DolDoc files with 2-line entries.
U8 *res=NULL;
CDoc *doc=DocRead(filename,DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR);
if (DocLineNumGoTo(doc,line-1) && doc->cur_entry->type_u8==DOCT_TEXT)
res=StrNew(doc->cur_entry->tag);
DocDel(doc);
return res;
}
U8 *FileDblWrite(U8 *filename,I64 line,U8 *st)
{//FileDbl's are DolDoc files with 2-line entries.
U8 *res=NULL;
CDoc *doc=DocRead(filename,DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR);
if (DocLineNumGoTo(doc,line-1)) {
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;
}
U0 GodVideo(U8 *title,U8 *webpage,U8 *rnd,I64 digits,U8 *filename)
{
U8 *st,*st2;
CGodVideoForm *gvf=CAlloc(sizeof(CGodVideoForm));
I64 i=ExtDecFromHex(rnd,digits);
if (!i) i=Round(10`digits);
if (st=FileDblRead(filename,i*2)) {
StrCpy(gvf->title,st);
Free(st);
if (!(st=FileDblRead(filename,i*2+1))||!*st) {
Free(st);
if (DocForm(gvf) && *gvf->serial) {
if (gvf->min || gvf->sec)
st=MStrPrint("%s&hl=enUS&start=%d",
gvf->serial,gvf->min*60+gvf->sec);
else
st=StrNew(gvf->serial);
FileDblWrite(filename,i*2+1,st);
} else
st=NULL;
}
"'%s'-->(Taking first %d decimal digits) #%02d\n",rnd,digits,i;
if (StrIMatch("Metallica",filename)) {
st2=URLPlusSpaces(gvf->title+3);
"God's response:\n"
"$$TX,\"%s\",HTML=\"%s\"$$\n"
"$$TX,\"%s (Lyrics)\","
"HTML=\"http://lmgtfy.com/?q=Metallica+lyrics+%s\"$$\n",
title,webpage,gvf->title,st2;
Free(st2);
} else
"God's response:\n"
"$$TX,\"%s\",HTML=\"%s\"$$\n"
"#%s\n",title,webpage,gvf->title;
if (st) {
"$$HC,\"<object width=\\\"640\\\" height=\\\"520\\\">"
"<param name=\\\"movie\\\" "
"value=\\\"http://www.youtube.com/v/%s\\\"></param><param "
"name=\\\"allowscriptaccess\\\" "
"value=\\\"always\\\"></param><embed "
"src=\\\"http://www.youtube.com/v/%s\\\" "
"type=\\\"application/x-shockwave-flash\\\" "
"allowscriptaccess=\\\"always\\\" "
"width=\\\"640\\\" height=\\\"520\\\">"
"</embed></object>\"$$\n",st,st;
Free(st);
}
}
Free(gvf);
}
U0 GodWebIdx(U8 *title,U8 *webpage,U8 *rnd,I64 digits,U8 *filename)
{
U8 *st1,*st2;
I64 i=ExtDecFromHex(rnd,digits);
if (!i) i=Round(10`digits);
"'%s'-->(Taking first %d decimal digits) #%02d\n",rnd,digits,i;
st1=FileDblRead(filename,i*2);
st2=FileDblRead(filename,i*2+1);
"God's response:\n";
"$$TX,\"%s\",HTML=\"%s\"$$\n",title,webpage;
PutFileLink(filename);
if (!st1)
"\n$$RED$$God does not want to comment.$$FG$$\n";
else
"\n$$RED$$$$TX,\"%s\",HTML=\"%s\"$$$$FG$$\n",st1,st2;
Free(st1);
Free(st2);
}
U0 GodWordBatch(CHexWordForm *gm)
{//Insert batch of words from rand hex.
I64 i=0;
CDirEntry *tmpde,*tmpde1;
FifoU8Flush(god.fifo);
GodHexIns(gm->rnd0);
GodHexIns(gm->rnd1);
GodHexIns(gm->rnd2);
GodHexIns(gm->rnd3);
GodHexIns(gm->rnd4);
GodHexIns(gm->rnd5);
GodHexIns(gm->rnd6);
GodHexIns(gm->rnd7);
GodHexIns(gm->rnd8);
GodHexIns(gm->rnd9);
GodHexIns(gm->rndA);
GodHexIns(gm->rndB);
tmpde=tmpde1=FilesFind(god.word_file_mask,god.word_fuf_flags);
while (tmpde) {
PutFileLink(tmpde->full_name);
'\n';
tmpde=tmpde->next;
}
DirTreeDel(tmpde1);
"\n$$RED$$";
if (*gm->rnd0)
"%s\n",gm->rnd0;
if (*gm->rnd1)
"%s\n",gm->rnd1;
if (*gm->rnd2)
"%s\n",gm->rnd2;
if (*gm->rnd3)
"%s\n",gm->rnd3;
if (*gm->rnd4)
"%s\n",gm->rnd4;
if (*gm->rnd5)
"%s\n",gm->rnd5;
if (*gm->rnd6)
"%s\n",gm->rnd6;
if (*gm->rnd7)
"%s\n",gm->rnd7;
if (*gm->rnd8)
"%s\n",gm->rnd8;
if (*gm->rnd9)
"%s\n",gm->rnd9;
if (*gm->rndA)
"%s\n",gm->rndA;
if (*gm->rndB)
"%s\n",gm->rndB;
'\n';
while (FifoU8Cnt(god.fifo)>20) {
"%02d: ",i++;
GodWord(20,TRUE);
}
FifoU8Flush(god.fifo);
"$$FG$$\n";
}
U0 TOSGodDoodle(I64 god_src,CNISTBeaconHexWordForm *gm=NULL)
{
CDC *dc;
Bool old_silent;
U8 *elems,*hex=CAlloc(sizeof(CNISTBeaconHexWordForm.rnd0)*12);
if (gm) {
StrPrint(hex,"%s%s",gm->rnd0,gm->rnd1);
if (god_src==GSRC_NIST_BEACON) {
gm->timestamp=FloorI64(CDate2Unix(Now),60);
if (DocForm(gm(CNISTBeaconHexWordForm *)))
NISTBeaconURL(gm->timestamp);
else
goto gd_done;
}
CatPrint(hex,"%s%s",gm->rnd2,gm->rnd3);
if (god_src==GSRC_NIST_BEACON) {
gm->timestamp=FloorI64(CDate2Unix(Now),60);
if (DocForm(gm(CNISTBeaconHexWordForm *)))
NISTBeaconURL(gm->timestamp);
else
goto gd_done;
}
CatPrint(hex,"%s%s",gm->rnd4,gm->rnd5);
if (god_src==GSRC_NIST_BEACON) {
gm->timestamp=FloorI64(CDate2Unix(Now),60);
if (DocForm(gm(CNISTBeaconHexWordForm *)))
NISTBeaconURL(gm->timestamp);
else
goto gd_done;
}
CatPrint(hex,"%s%s",gm->rnd6,gm->rnd7);
if (god_src==GSRC_NIST_BEACON) {
gm->timestamp=FloorI64(CDate2Unix(Now),60);
if (DocForm(gm(CNISTBeaconHexWordForm *)))
NISTBeaconURL(gm->timestamp);
else
goto gd_done;
}
CatPrint(hex,"%s%s",gm->rnd8,gm->rnd9);
if (god_src==GSRC_NIST_BEACON) {
gm->timestamp=FloorI64(CDate2Unix(Now),60);
if (DocForm(gm(CNISTBeaconHexWordForm *)))
NISTBeaconURL(gm->timestamp);
else
goto gd_done;
}
CatPrint(hex,"%s%s",gm->rndA,gm->rndB);
}
if (elems=GodDoodleSprite(hex)) {
dc=Sprite2DC(elems);
BlogDCImgWrite(dc);
DCDel(dc);
Free(elems);
old_silent=Silent;
FreshenBlog;
Silent(old_silent);
}
gd_done:
Free(hex);
}
I64 GodHeaderIns(U8 *type=NULL)
{
CDateStruct ds;
I64 res;
if (type) {//If NISTBeacon
res=FloorI64(CDate2Unix(Now+2*60*CDATE_FREQ),60);
Date2Struct(&ds,Unix2CDate(res)+local_time_offset+30*CDATE_FREQ);
"Response of %s at %02d:%02d Timestamp:%d.\n\n",type,ds.hour,ds.min,res;
In("%c//Response of %s at %02d:%02d Timestamp:%d.\n\n",
CH_ESC,type,ds.hour,ds.min,res);
}
"$$TX,\"Guidelines for Talking with God.\","
"HTML=\"http://www.templeos.org/Wb/Adam/God/HSNotes.html\"$$\n";
return res;
}
U0 TimerGodIns()
{
U8 buf[STR_LEN];
GodHeaderIns;
FifoU8Flush(god.fifo);
GodBitsIns(GOD_GOOD_BITS,KbdMsEvtTime>>GOD_BAD_BITS);
switch (PopUpPickLst("Hex5Bible\0Hex8Books\0Doodle\0Movie\0Painting100\0"
"Painting1000\0Metallica\0")) {
case:
StrPrint(buf,"%05X",GodBits(5*4));
"$$TX,\"How this random Bible passage was chosen.\","
"HTML=\"http://www.templeos.org/Wb"
"/Home/Web/TAD/Passage.html\"$$\n";
TOSBookLines("~/Sup1/Sup1Blog/NumBible.TXT",ST_BIBLE_LINES,
buf,20,16,TRUE,TRUE);
break;
case:
GodBooksPassageU32(GodBits(32),"~/*","C:/Home/Books?/*",,GBP_SHORT);
break;
case:
TOSGodDoodle(GSRC_TIMER);
break;
case:
StrPrint(buf,"%05X",GodBits(2*5*4)); //Little bit risky if no dec.
GodVideo("Top 100 Movies",
"http://www.afi.com/100years/movies10.aspx",
buf,2,"~/Sup1/Sup1Blog/Movies.DD.Z");
break;
case:
StrPrint(buf,"%05X",GodBits(2*5*4)); //Little bit risky if no dec.
GodWebIdx("Top 100 Paintings",
"http://www.brushwiz.com/most-famous-paintings",
buf,2,"~/Sup1/Sup1Blog/Paintings100.DD.Z");
break;
case:
StrPrint(buf,"%05X",GodBits(2*5*4)); //Little bit risky if no dec.
GodWebIdx("Top 1000 Paintings",
"http://en.most-famous-paintings.com/MostFamousPaintings."
"nsf/ListOfTop1000MostPopularPainting",
buf,3,"~/Sup1/Sup1Blog/Paintings1000.DD.Z");
break;
case:
StrPrint(buf,"%05X",GodBits(2*5*4)); //Little bit risky if no dec.
GodVideo("Metallica Song",
"http://home.hccnet.nl/a.r.adams/lyrics/"
"metallica/songindex.html",
buf,2,"~/Sup1/Sup1Blog/Metallica.DD.Z");
break;
}
}
public U0 GodIns()
{//<ALT-F7> Insert misc rand God item into blog.
U8 *st,*tag;
CRandExtDec5Form *gm=CAlloc(sizeof(CRandExtDec5Form));
I64 god_src=PopUpPickLst("NISTBeacon\0HotBits\0ANU_NIST\0Random.org\0"
"RandomNumbers.info\0Password\0GenerateData\0VirtualNotary\0Timer\0");
if (god_src>=GSRC_NIST_BEACON) {
switch (god_src) {
case GSRC_NIST_BEACON:
NISTGodIns1;
break;
start:
case GSRC_HOTBITS:
tag="https://www.fourmilab.ch/hotbits/secure_generate.html";
break;
case GSRC_ANU_NIST:
tag="http://qrng.anu.edu.au/NIST.php";
break;
end:
GodHeaderIns;
"$$TX,\"%$$Q\",HTML=\"%$$Q\"$$\n",tag,tag;
switch (PopUpPickLst("ExtDec5Bible\0LinuxWords\0"
"HappyWords\0Hex5Bible\0Hex8Books\0Doodle\0Movie\0Painting100\0"
"Painting1000\0Metallica\0")) {
case:
if (DocForm(gm(CRandExtDec5Form *)))
TOSBookLines("~/Sup1/Sup1Blog/NumBible.TXT",ST_BIBLE_LINES,
gm->rnd0,20,-5,FALSE,FALSE);
break;
case:
if (DocForm(gm(CHexWordForm *))) {
Adam("GodInit(\"~/Sup1/Sup1Words/LinuxDict.TXT*\");");
GodWordBatch(gm);
}
break;
case:
if (DocForm(gm(CHexWordForm *))) {
Adam("GodInit(\"~/Sup1/Sup1Words/HappyWords.TXT*\");");
GodWordBatch(gm);
}
break;
case:
if (DocForm(gm(CRandHex5Form *))) {
"$$TX,\"How this random Bible passage was chosen.\","
"HTML=\"http://www.templeos.org/Wb"
"/Home/Web/TAD/Passage.html\"$$\n";
TOSBookLines("~/Sup1/Sup1Blog/NumBible.TXT",ST_BIBLE_LINES,
gm->rnd0,20,16,TRUE,TRUE);
}
break;
case:
if (DocForm(gm(CRandHex8Form *))) {
"$$TX,\"How this random book pick was chosen.\","
"HTML=\"http://www.templeos.org/Wb"
"/Home/Web/TAD/NISTPick002.html\"$$\n";
GodBooksPassageU32(Str2I64(gm->rnd0,16),
"~/*","C:/Home/Books?/*");
}
break;
case:
if (DocForm(gm(CHexWordForm *)))
TOSGodDoodle(god_src,gm);
break;
case:
if (DocForm(gm(CMoviesForm *)))
GodVideo("Top 100 Movies",
"http://www.afi.com/100years/movies10.aspx",
gm->rnd0,2,"~/Sup1/Sup1Blog/Movies.DD.Z");
break;
case:
if (DocForm(gm(CPaintings100Form *))) {
GodWebIdx("Top 100 Paintings",
"http://www.brushwiz.com/most-famous-paintings",
gm->rnd0,2,"~/Sup1/Sup1Blog/Paintings100.DD.Z");
}
break;
case:
if (DocForm(gm(CPaintings1000Form *))) {
GodWebIdx("Top 1000 Paintings",
"http://en.most-famous-paintings.com/MostFamousPaintings."
"nsf/ListOfTop1000MostPopularPainting",
gm->rnd0,3,"~/Sup1/Sup1Blog/Paintings1000.DD.Z");
}
break;
case:
if (DocForm(gm(CMetallicaForm *)))
GodVideo("Metallica Song",
"http://home.hccnet.nl/a.r.adams/lyrics/"
"metallica/songindex.html",
gm->rnd0,2,"~/Sup1/Sup1Blog/Metallica.DD.Z");
break;
}
break;
start:
case GSRC_RANDOM_ORG:
tag="http://www.random.org";
break;
case GSRC_RANDOM_NUMBERS_INFO:
tag="http://www.randomnumbers.info";
break;
case GSRC_PASSWORD:
tag="https://passed.pw";
break;
case GSRC_GENERATE_DATA:
tag="http://www.generatedata.com";
break;
end:
GodHeaderIns;
"$$TX,\"%$$Q\",HTML=\"%$$Q\"$$\n",tag,tag;
switch (PopUpPickLst("ExtDec5Bible\0HexWordBatch\0"
"Hex5Bible\0Hex8Books\0Movie\0Metallica\0")) {
case:
if (DocForm(gm(CRandExtDec5Form *)))
TOSBookLines("~/Sup1/Sup1Blog/NumBible.TXT",ST_BIBLE_LINES,
gm->rnd0,20,-5,FALSE,FALSE);
break;
case:
if (DocForm(gm(CHexWordForm *)))
GodWordBatch(gm);
break;
case:
if (DocForm(gm(CRandHex5Form *))) {
"$$TX,\"How this random Bible passage was chosen.\","
"HTML=\"http://www.templeos.org/Wb"
"/Home/Web/TAD/Passage.html\"$$\n";
TOSBookLines("~/Sup1/Sup1Blog/NumBible.TXT",ST_BIBLE_LINES,
gm->rnd0,20,16,TRUE,TRUE);
}
break;
case:
if (DocForm(gm(CRandHex8Form *))) {
"$$TX,\"How this random book pick was chosen.\","
"HTML=\"http://www.templeos.org/Wb"
"/Home/Web/TAD/NISTPick002.html\"$$\n";
GodBooksPassageU32(Str2I64(gm->rnd0,16),
"~/*","C:/Home/Books?/*");
}
break;
case:
if (DocForm(gm(CMoviesForm *)))
GodVideo("Top 100 Movies",
"http://www.afi.com/100years/movies10.aspx",
gm->rnd0,2,"~/Sup1/Sup1Blog/Movies.DD.Z");
break;
case:
if (DocForm(gm(CMetallicaForm *)))
GodVideo("Metallica Song",
"http://home.hccnet.nl/a.r.adams/lyrics/"
"metallica/songindex.html",
gm->rnd0,2,"~/Sup1/Sup1Blog/Metallica.DD.Z");
break;
}
break;
case GSRC_VIRTUAL_NOTARY:
GodHeaderIns;
if (DocForm(gm(CCertRandDec5Form *))) {
tag="http://virtual-notary.org";
"$$TX,\"%$$Q\",HTML=\"%$$Q\"$$\n",tag,tag;
tag="Here is the certificate";
st=MStrPrint("http://www.templeos.org/Certs/virtual-notary-cert"
"-randomnum-%d.p12",gm->cert);
"\n$$TX,\"%$$Q: %d\",HTML=\"%$$Q\"$$.\n",tag,gm->cert,st;
Free(st);
TOSBookLines("~/Sup1/Sup1Blog/NumBible.TXT",ST_BIBLE_LINES,
gm->rnd0,20,-5,FALSE,FALSE);
}
break;
case GSRC_TIMER:
TimerGodIns;
break;
}
}
Free(gm);
}
if (FileFind("~/Sup1/Sup1Words/LinuxDict.TXT"))
GodInit("~/Sup1/Sup1Words/LinuxDict.TXT");
//if (FileFind("~/Sup1/Sup1Words/HappyWords.TXT"))
// GodInit("~/Sup1/Sup1Words/HappyWords.TXT");
+226
View File
@@ -0,0 +1,226 @@
#help_index "Misc/Blog"
U8 *YouTubeGet(U8 *filename="~/Sup1/Sup1Blog/YouTube.DD.Z",U8 *needle)
{
I64 i=0,line=I64_MIN;
CDoc *doc=DocRead(filename,DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR),
*doc2=DocNew;
U8 *title,*code,*res;
while (DocFind(doc,line,needle)) {
if (!(doc->cur_entry->y&1)) {
title=doc->cur_entry->tag;
DocLineNumGoTo(doc,doc->cur_entry->y+2);
if (doc->cur_entry->type_u8==DOCT_TEXT) {
code=doc->cur_entry->tag;
DocPrint(doc2,"$$MU-UL,\"%s\",LE=0x%X$$\n",title,code);
i++;
}
}
line=doc->cur_entry->y+2;
}
switch (i) {
case 0:
res=NULL;
break;
case 1:
res=StrNew(code);
break;
default:
res=PopUpMenu(doc2);
if (res==DOCM_CANCEL)
res=NULL;
else
res=StrNew(res);
}
DocDel(doc);
DocDel(doc2);
return res;
}
U0 YouTubeAdd(U8 *filename="~/Sup1/Sup1Blog/YouTube.DD.Z",
U8 *title,U8 *code)
{
CDoc *doc=DocRead(filename,DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR);
if (!DocFind(doc,,title)) {
DocBottom(doc);
DocPrint(doc,"%s\n%s\n",title,code);
DocTop(doc);
DocWrite(doc);
Sort(filename,,2);
}
DocDel(doc);
}
U8 *WebBookMarks(U8 *filename="~/Sup1/Sup1Blog/Bookmarks.html")
{
U8 *st;
CDocEntry *doc_e;
CDoc *doc=DocNew;
CCmpCtrl *cc=CmpCtrlNew(MStrPrint("#include \"%s\"",filename));
while (Lex(cc))
if (cc->token==TK_STR && *cc->cur_str(U32 *)=='http') {
DocPrint(doc,"$$MU-UL,\"%$$Q\",LE=0x%X$$\n",cc->cur_str,cc->cur_str);
cc->cur_str=NULL;
}
CmpCtrlDel(cc);
if ((st=PopUpMenu(doc))!=DOCM_CANCEL)
st=StrNew(st);
else
st=NULL;
doc_e=doc->head.next;
while (doc_e!=doc) {
if (doc_e->type_u8==DOCT_MENU_VAL)
Free(doc_e->left_exp);
doc_e=doc_e->next;
}
DocDel(doc);
return st;
}
U0 TOSIns()
{
CWebBibleForm *url=CAlloc(sizeof(CWebBibleForm));
U8 *tag,*st,*st2;
switch (PopUpPickLst("BiblePassage\0BibleVerse\0"
"YouTube\0Imgur\0Wikipedia\0WebBookMark\0")) {
case:
if (DocForm(url(CWebBibleForm *))) {
tag=url->special;
st2=URLPercentSpaces(url->special);
st=MStrPrint("http://www.biblegateway.com/passage/"
"?search=%s&version=NIV",st2);
Free(st2);
if (*url->tag)
tag=url->tag;
"$$TX,\"%$$Q\",HTML=\"%$$Q\"$$",tag,st;
Free(st);
}
break;
case:
if (DocForm(url(CWebBibleForm *))) {
tag=url->special;
st2=URLPercentSpaces(url->special);
st=MStrPrint(
"http://www.biblegateway.com/verse/en/%s",st2);
Free(st2);
if (*url->tag)
tag=url->tag;
"$$TX,\"%$$Q\",HTML=\"%$$Q\"$$",tag,st;
Free(st);
}
break;
case:
if (DocForm(url(CYouTubeForm *))) {
if (*url->special==CH_SPACE)
st2=YouTubeGet(,url->tag);
else
st2=StrNew(url->special);
if (st2 && *st2!=CH_SPACE) {
if (url->min || url->sec)
st=MStrPrint("%s&hl=enUS&start=%d",st2,url->min*60+url->sec);
else
st=StrNew(st2);
if (*url->special!=CH_SPACE && *url->tag)
YouTubeAdd(,url->tag,st);
"$$HC,\"<object width=\\\"640\\\" "
"height=\\\"520\\\"><param name=\\\"movie\\\" "
"value=\\\"http://www.youtube.com/v/%s\\\"></param><param "
"name=\\\"allowscriptaccess\\\" "
"value=\\\"always\\\"></param><embed "
"src=\\\"http://www.youtube.com/v/%s\\\" "
"type=\\\"application/x-shockwave-flash\\\" "
"allowscriptaccess=\\\"always\\\" "
"width=\\\"640\\\" height=\\\"520\\\">"
"</embed></object>\"$$\n",st,st;
Free(st);
Free(st2);
}
}
break;
case:
if (DocForm(url(CImgurForm *))) {
"$$HC,\"<center><img src=\\\"http://i.imgur.com/%s\\\" "
"width=\\\"%d\\\" height=\\\"%d\\\" "
"alt=\\\"\\\"></center>\"$$\n",
url->special,url->min,url->sec;
}
break;
case:
if (DocForm(url(CWikipediaForm *))) {
tag=url->special;
st=MStrPrint("http://en.wikipedia.org/wiki/%s",url->special);
if (*url->tag)
tag=url->tag;
"$$TX,\"%$$Q\",HTML=\"%$$Q\"$$",tag,st;
Free(st);
}
break;
case:
if (DocForm(url(CWebBookMarkForm *))) {
tag=st=WebBookMarks;
if (*url->tag)
tag=url->tag;
"$$TX,\"%$$Q\",HTML=\"%$$Q\"$$",tag,st;
Free(st);
}
break;
}
Free(url);
}
#help_index "Misc/TOS/God;God/TOS"
public U0 GodCodeJmp()
{//Jump to rand code in OS. See $LK,"::/Adam/God/HSNotes.DD"$.
CDirEntry *tmpde1=FilesFind("/*",
FUF_JUST_FILES|FUF_RECURSE|FUF_JUST_SRC|FUF_CLUSTER_ORDER),
*tmpde=tmpde1;
I64 cnt=0,num;
CDoc *doc;
U8 *st;
while (tmpde) {
doc=DocRead(tmpde->full_name);
tmpde->user_data=doc->head.y;
cnt+=doc->head.y;
DocDel(doc);
tmpde=tmpde->next;
}
FifoU8Flush(god.fifo);
GodBitsIns(GOD_GOOD_BITS,KbdMsEvtTime>>GOD_BAD_BITS);
num=GodBits(GOD_GOOD_BITS)%cnt;
tmpde=tmpde1;
while (tmpde) {
num-=tmpde->user_data;
if (num<0) {
st=MStrPrint("FL:%s,%d",tmpde->full_name,-num);
break;
}
tmpde=tmpde->next;
}
DirTreeDel(tmpde1);
Ed(st);
Free(st);
}
U0 GodOffer()
{
switch (PopUpPickLst("MosesComic\0Fiction\0")) {
case:
"---- Moses Comic ---- "
"(Set in the $TX,"Numbers 11",HTML="http://www.biblegateway.com/passage/?search=Numbers%%%%2011&version=NIV"$ "
"part of the story.)\n"
"Moses says, \"\"\n"
"God says, \"\"\n";
break;
case:
"---- $TX,"Collaborative Fiction",HTML="http://en.wikipedia.org/wiki/Collaborative_fiction"$ ----\n"
"Once upon a time ";
break;
}
}
@@ -1,4 +1,4 @@
#help_index "TOS"
#help_index "Misc/TOS"
#define VIDEO_FRAME_RATE 29.97
@@ -58,7 +58,7 @@ I64 CopyVideo()
}
public U0 FrameGrabberToggle()
{
{//The frame grabber saves BMP files to D:/Tmp/ScrnShots.
static F64 last_time=0;
if (tS-last_time>3.0) {
last_time=tS;
@@ -79,7 +79,7 @@ public U0 FrameGrabberToggle()
}
public U0 JukeSong(I64 num)
{
{//Make movie of one song.
AutoComplete;
if (!fg_on)
FrameGrabberToggle;
@@ -89,7 +89,7 @@ public U0 JukeSong(I64 num)
}
public U0 JukeLines(I64 start_line,I64 end_line)
{
{//Make movie of many lines of songs.
AutoComplete;
if (!fg_on)
FrameGrabberToggle;
@@ -99,14 +99,14 @@ public U0 JukeLines(I64 start_line,I64 end_line)
}
public U0 ChkAll()
{
{//ChkDsk on C & D.
U8 *ptr=TOS_HDS;
while (*ptr)
ChkDsk(*ptr++);
}
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;
@@ -127,7 +127,7 @@ public CDoc *DC2Doc(CDC *dc,I64 dx=0,I64 dy=0,I64 *_total_score=NULL)
if (GrPeek(dc,col*FONT_WIDTH+j+dx,row*FONT_HEIGHT+i+dy)!=WHITE)
LBts(&cur_char_image,i*8+j);
best_score=MAX_I64;
best_score=I64_MAX;
best_ch=0;
ptr=&text.font[32];
for (ch=32;ch<127;ch++) {
@@ -152,10 +152,10 @@ public CDoc *DC2Doc(CDC *dc,I64 dx=0,I64 dy=0,I64 *_total_score=NULL)
return doc;
}
public U0 BMP2TXT(U8 *_in_name,U8 *_out_name=NULL)
{
public U0 BMP2Doc(U8 *_in_name,U8 *_out_name=NULL)
{//Use OCR to make a text DolDoc from BMP file.
U8 *in_name,*out_name;
I64 dx,dy,score,best_score=MAX_I64;
I64 dx,dy,score,best_score=I64_MAX;
CDC *dc;
CDoc *doc;
in_name=DftExt(_in_name,"BMP");
@@ -179,66 +179,11 @@ public U0 BMP2TXT(U8 *_in_name,U8 *_out_name=NULL)
Free(out_name);
}
RegDft("TempleOS/TOSVideos","I64 tos_code_walk_thru=1;\n");
RegExe("TempleOS/TOSVideos");
U0 TOSRegInit()
{
DefinePrint("DD_CODE_WALK_THRU","Episode #%d",tos_code_walk_thru);
} TOSRegInit;
U0 TOSRegWrite()
{
RegWrite("TempleOS/TOSVideos",
"I64 tos_code_walk_thru=%d;\n",tos_code_walk_thru);
TOSRegInit;
}
class CYouTubeForm2
{
U8 special[STR_LEN] fmtstr "$$DA-P,A=\"SerialNum:%s\"$$\n";
};
U8 *TOSYouTube()
{
U8 *res;
CYouTubeForm2 *url=CAlloc(sizeof(CYouTubeForm2));
if (DocForm(url(CYouTubeForm2 *)) && *url->special)
res=MStrPrint("$$HC,\"<object width=\\\"640\\\" height=\\\"520\\\">"
"<param name=\\\"movie\\\" "
"value=\\\"http://www.youtube.com/v/%s\\\"></param><param "
"name=\\\"allowscriptaccess\\\" value=\\\"always\\\"></param><embed "
"src=\\\"http://www.youtube.com/v/%s\\\" "
"type=\\\"application/x-shockwave-flash\\\" "
"allowscriptaccess=\\\"always\\\" "
"width=\\\"640\\\" height=\\\"520\\\"></embed></object>\"$$",
url->special,url->special);
else
res=NULL;
Free(url);
return res;
}
U0 CodeWalkThru()
{
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
AutoComplete;
WinBorder;
WinMax;
if (!fg_on)
PopUp("Sleep(50);FrameGrabberToggle;");
Ed("~/Videos/RandomCode.DD.Z");
SettingsPop;
Msg(MSG_KEY_DOWN_UP,'b',0x83000000830); //<ALT-b>
tos_code_walk_thru++;
TOSRegWrite;
}
U0 TempleOSTheme()
U0 TOSTheme()
{
if (!fg_on)
PopUp("Sleep(50);FrameGrabberToggle;");
ExeFile("~/Sup1/Sup1Graphics/TempleOSTheme.HC");
ExeFile("~/Sup1/Sup1Graphics/TOS/TOSTheme.HC");
DocClear;
}
@@ -271,7 +216,7 @@ U0 MemTest()
}
public I64 Profanity(
U8 *needle_filename="C:/Home/Sup1/Sup1Blog/Profanity.DD.Z",
U8 *needle_filename="~/Sup1/Sup1Blog/Profanity.DD.Z",
U8 *files_find_mask="/*",U8 *fu_flags=NULL)
{//Scan for profanity.
CCmpCtrl *cc;
@@ -285,3 +230,22 @@ public I64 Profanity(
}
return res;
}
U0 TOSChgLog2()
{
InStr("\"Ed(\\\"::/Doc/ChgLog.DD.Z\\\");\n\";
Msg(MSG_KEY_DOWN_UP,0,SC_CURSOR_UP|SCF_CTRL);
Msg(MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
Msg(MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
Msg(MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
Msg(MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
Msg(MSG_KEY_DOWN_UP,CH_CTRLY,0);
Msg(MSG_KEY_DOWN_UP,0,SC_F6|SCF_ALT);
Msg(MSG_KEY_DOWN_UP,CH_ESC,0);"
"\"Exit;\n\";");
}
public U0 TOSChgLog()
{//Opdate ChgLog file.
User("TOSChgLog2;\n");
}
+158
View File
@@ -0,0 +1,158 @@
#help_index "Misc/TOS/God;God/TOS"
I64 tos_timestamp=0,tos_type=0;
RegDft("TempleOS/TOSNIST","I64 tos_nist_offset=-8049;\n");
RegExe("TempleOS/TOSNIST");
public I64 CDate2Unix(CDate dt)
{//TempleOS datetime to Unix timestamp.
return ToI64((dt-Str2Date("1/1/1970"))/CDATE_FREQ+NIST_TIME_OFFSET);
}
public CDate Unix2CDate(I64 timestamp)
{//Unix timestamp to TempleOS datetime.
return (timestamp-NIST_TIME_OFFSET)*CDATE_FREQ+Str2Date("1/1/1970");
}
public U0 NISTBeaconSync()
{//Help get local clk in sync with NIST clk.
I64 i,j;
CDate dt;
CDateStruct ds;
while (!ScanChar) {
dt=Now;
Date2Struct(&ds,dt);
i=CDate2Unix(dt);
j=FloorI64(i,60);
"%d %d %02d %02d\n",i,j,ds.sec,(60+ds.sec-(i-j))%60;
Sleep(100);
}
tos_nist_offset=GetI64("tos_nist_offset (%d):",tos_nist_offset);
RegWrite("TempleOS/TOSNIST","I64 tos_nist_offset=%d;\n",tos_nist_offset);
}
U0 NISTBeaconURL(I64 timestamp)
{//Insert NIST Beacon header into blog.
U8 *tag;
CDateStruct ds;
CDate dt=Unix2CDate(timestamp);
Date2Struct(&ds,dt+local_time_offset+30*CDATE_FREQ);
"$$TX,\"NIST Beacon Date:%D Time:%02d:%02d Unix TimeStamp:%u\","
"HTML=\"https://beacon.nist.gov/home\"$$\n",dt,ds.hour,ds.min,timestamp;
tag=MStrPrint("https://beacon.nist.gov/rest/record/%d",timestamp);
"$$TX,\"NIST Beacon Record:%$$Q\",HTML=\"%$$Q\"$$\n",tag,tag;
Free(tag);
}
U0 NISTGodIns1()
{
tos_type=PopUpPickLst("ExtDec5Bible\0LinuxWords\0HappyWords\0"
"Hex5Bible\0Hex8Books\0Doodle\0Movie\0Painting100\0Painting1000\0"
"Metallica\0");
switch (tos_type) {
case: tos_timestamp=GodHeaderIns("Bible"); break;
case: tos_timestamp=GodHeaderIns("LinuxWords"); break;
case: tos_timestamp=GodHeaderIns("HappyWords"); break;
case: tos_timestamp=GodHeaderIns("Bible"); break;
case: tos_timestamp=GodHeaderIns("BookPick"); break;
case: tos_timestamp=GodHeaderIns("Doodle"); break;
case: tos_timestamp=GodHeaderIns("Movie"); break;
case: tos_timestamp=GodHeaderIns("Painting100"); break;
case: tos_timestamp=GodHeaderIns("Painting1000"); break;
case: tos_timestamp=GodHeaderIns("Metallica"); break;
}
Once("tos_timestamp=%d;\ntos_type=%d;\n"
"In(\"Blog(TRUE);\n\");",tos_timestamp,tos_type);
}
U0 NISTGodIns2()
{
CRandExtDec5Form *gm=CAlloc(sizeof(CRandExtDec5Form));
gm->timestamp=tos_timestamp;
switch (tos_type) {
case:
if (DocForm(gm(CRandExtDec5Form *))) {
NISTBeaconURL(gm->timestamp);
TOSBookLines("~/Sup1/Sup1Blog/NumBible.TXT",ST_BIBLE_LINES,
gm->rnd0,20,-5,FALSE,FALSE);
}
break;
case:
if (DocForm(gm(CHexWordForm *))) {
NISTBeaconURL(gm->timestamp);
Adam("GodInit(\"~/Sup1/Sup1Words/LinuxDict.TXT*\");");
GodWordBatch(gm);
}
break;
case:
if (DocForm(gm(CHexWordForm *))) {
NISTBeaconURL(gm->timestamp);
Adam("GodInit(\"~/Sup1/Sup1Words/HappyWords.TXT*\");");
GodWordBatch(gm);
}
break;
case:
if (DocForm(gm(CRandHex5Form *))) {
"$$TX,\"How this random Bible passage was chosen.\","
"HTML=\"http://www.templeos.org/Wb"
"/Home/Web/TAD/NISTPassage.html\"$$\n";
NISTBeaconURL(gm->timestamp);
TOSBookLines("~/Sup1/Sup1Blog/NumBible.TXT",ST_BIBLE_LINES,
gm->rnd0,20,16,TRUE,TRUE);
}
break;
case:
if (DocForm(gm(CRandHex8Form *))) {
"$$TX,\"How this random book pick was chosen.\","
"HTML=\"http://www.templeos.org/Wb"
"/Home/Web/TAD/NISTPick002.html\"$$\n";
NISTBeaconURL(gm->timestamp);
GodBooksPassageU32(Str2I64(gm->rnd0,16),
"~/*","C:/Home/Books?/*");
}
break;
case:
if (DocForm(gm(CHexWordForm *))) {
NISTBeaconURL(gm->timestamp);
TOSGodDoodle(GSRC_NIST_BEACON,gm);
}
break;
case:
if (DocForm(gm(CMoviesForm *))) {
NISTBeaconURL(gm->timestamp);
GodVideo("Top 100 Movies",
"http://www.afi.com/100years/movies10.aspx",
gm->rnd0,2,"~/Sup1/Sup1Blog/Movies.DD.Z");
}
break;
case:
if (DocForm(gm(CPaintings100Form *))) {
NISTBeaconURL(gm->timestamp);
GodWebIdx("Top 100 Paintings",
"http://www.brushwiz.com/most-famous-paintings",
gm->rnd0,2,"~/Sup1/Sup1Blog/Paintings100.DD.Z");
}
break;
case:
if (DocForm(gm(CPaintings1000Form *))) {
NISTBeaconURL(gm->timestamp);
GodWebIdx("Top 1000 Paintings",
"http://en.most-famous-paintings.com/MostFamousPaintings."
"nsf/ListOfTop1000MostPopularPainting",
gm->rnd0,3,"~/Sup1/Sup1Blog/Paintings1000.DD.Z");
}
break;
case:
if (DocForm(gm(CMetallicaForm *))) {
NISTBeaconURL(gm->timestamp);
GodVideo("Metallica Song",
"http://home.hccnet.nl/a.r.adams/lyrics/"
"metallica/songindex.html",
gm->rnd0,2,"~/Sup1/Sup1Blog/Metallica.DD.Z");
}
break;
}
Free(gm);
}
+167
View File
@@ -0,0 +1,167 @@
$WW,1$$FG,5$$TX+CX,"TOS Staff Policies"$$FG$
* Motto: Run toward bugs, not away from bugs.
* Be Metallica. Use short, sharp, powerful words, as though a song.
* Be careful $FG,2$/Demo/AcctExample$FG$ doesn't get extra files. When you run TOSRegen(), it will copy home files to $FG,2$/Demo/AcctExample$FG$.
* Be careful $FG,2$remote/Wb$FG$ site doesn't get extra files. If you delete or rename a file, also delete the $FG,2$remote/Wb$FG$ file from the site.
$TR,"PreRegen()"$
$ID,2$
Linux: Export Bookmarks to ~/TAD/Home/Sup1/Sup1Blog/Bookmarks.html
Linux: >vm_in
Linux: VMware Machine: "TOS"
{
TempleOS: >TOSPreRegen;
TempleOS: Update Budget
}
$ID,-2$
$TR,"NewRelease(Bool full=FALSE)"$
$ID,2$
if ($FG,2$full$FG$)
]PreRegen()
Linux: VMware Machine:"TOS"
{
TempleOS: >TOSRegen($FG,2$full$FG$);
}
Linux: >vm_out
if ($FG,2$full$FG$) {
Linux: Burn ~/TAD to memory stick.
On other machine {
Linux: Copy ~/TAD from memory stick.
VMware: VMware NewMachine:"TOS", Install TempleOSStaff.ISO
{ //2048 Meg RAM or 57344 Meg RAM
TempleOS: $LK,"TOSStaffIns",A="MN:TOSStaffIns"$(); in VMware.
TempleOS: >TOSRegen;
TempleOS: >#include "::/Misc/OSTestSuite"
TempleOS: >Del("~/Demo*");
}
Linux: >emu_staff_new
Linux: >emu8core or >emu24core
{
TempleOS: $LK,"TOSStaffIns",A="MN:TOSStaffIns"$(); in QEMU.
TempleOS: >TOSRegen;
}
}
}
Linux: CrossFTP sync ~/TAD/Site1/Wb to remote/Wb
if ($FG,2$full$FG$) {
FileZilla
Upload ~/TAD/Site1/index.html to remote/index.html
Upload ~/TAD/Site1/TempleOS.html to remote/TempleOS.html
}
In WebHost FileMgr {
Del {
remote/TempleOSCD.ISO
remote/TempleOSSup1.ISO.C
remote/TempleOSWeb.ISO.C
remote/TempleOSUltra.ISO
}
Copy up one level to remote root {
remote/Wb/TempleOSCD.ISO
remote/Wb/TempleOSSup1.ISO.C
remote/Wb/TempleOSWeb.ISO.C
remote/Wb/TempleOSUltra.ISO
}
}
$ID,-2$
$TR,"NewVersion(Bool full=FALSE)"$
$ID,2$
Increment minor version number.
>$LK,"R",A="MN:R"$("3.12","3.13","-i-l"); //Approve by hand.
Add version release notice in $LK,"::/Doc/ChgLog.DD"$.
]NewRelease(TRUE);
Submit to www.betanews.com.
Send email to MajorGeeks.
if ($FG,2$full$FG$) {
Submit to www.upload.com.
Upload to SourceForge.
}
$ID,-2$
$TR,"NewYearlyVersion()"$
$ID,2$
Increment major version number.
>$LK,"R",A="MN:R"$("3.13","4.00","-i-l"); //Approve by hand.
Add version release notice in $LK,"::/Doc/ChgLog.DD"$.
$LK,"Update ::/Misc/PCIDevices.DD",A="FF:::/Adam/DevInfo.HC,PCIDevFileGen"$
Remove 6 months from bottom of $LK,"::/Doc/ChgLog.DD"$.
]NewVersion(TRUE);
$ID,-2$
* If you change the compiler language syntax, immediately make a ]NewRelease(TRUE).
$FG,5$$TX+CX,"TOS Staff Indoctrination"$$FG$
Make a list of all the ways you make a project scalable. With TempleOS, we scale down, not up, so do we do the opposite of all of them.
How would you improve this $LK,"LZW Compression",A="FI:::/Kernel/Compress.HC"$? We have a 100,000 line of code limit, so it's a trick, thought provoking, question introducing you to our way of thinking.
We hope to define objective metrics so we can simply ask the world to reduce the lines of code and be perfectly objective.
We hope for an objective metric for the compiler, such as how fast it compiles itself (having been compiled by itself). It's a little less elegant, but we actually compile kernel and compiler together all the time with $LK,"TOSBootHDIns",A="FF:::/Demo/AcctExample/TOS/TOSDistro.HC,TOSBootHDIns"$('C'). We have the freedom to change the $LK,"HolyC",A="FI:::/Doc/HolyC.DD"$ language, like how I made type-casting post-fix. We need some more limitations on the problem because we don't want a ridiculous language.
Consider these games as the basis of the vector space we wish to span:
$LK,"/Demo/Games/BattleLines.HC",A="FI:::/Demo/Games/BattleLines.HC"$
$LK,"/Demo/Games/BigGuns.HC",A="FI:::/Demo/Games/BigGuns.HC"$
$LK,"/Demo/Games/BlackDiamond.HC",A="FI:::/Demo/Games/BlackDiamond.HC"$
$LK,"/Demo/Games/BomberGolf.HC",A="FI:::/Demo/Games/BomberGolf.HC"$
$LK,"/Demo/Games/CastleFrankenstein.HC",A="FI:::/Demo/Games/CastleFrankenstein.HC"$
$LK,"/Demo/Games/CharDemo.HC",A="FI:::/Demo/Games/CharDemo.HC"$
$LK,"/Demo/Games/CircleTrace.HC",A="FI:::/Demo/Games/CircleTrace.HC"$
$LK,"/Demo/Games/Collision.HC",A="FI:::/Demo/Games/Collision.HC"$
$LK,"/Demo/Games/Digits.HC",A="FI:::/Demo/Games/Digits.HC"$
$LK,"/Demo/Games/DunGen.HC",A="FI:::/Demo/Games/DunGen.HC"$
$LK,"/Demo/Games/ElephantWalk.HC",A="FI:::/Demo/Games/ElephantWalk.HC"$
$LK,"/Demo/Games/FlapBat.HC",A="FI:::/Demo/Games/FlapBat.HC"$
$LK,"/Demo/Games/FlatTops.HC",A="FI:::/Demo/Games/FlatTops.HC"$
$LK,"/Demo/Games/Halogen.HC",A="FI:::/Demo/Games/Halogen.HC"$
$LK,"/Demo/Games/MassSpring.HC",A="FI:::/Demo/Games/MassSpring.HC"$
$LK,"/Demo/Games/Maze.HC",A="FI:::/Demo/Games/Maze.HC"$
$LK,"/Demo/Games/RainDrops.HC",A="FI:::/Demo/Games/RainDrops.HC"$
$LK,"/Demo/Games/RawHide.HC",A="FI:::/Demo/Games/RawHide.HC"$
$LK,"/Demo/Games/Rocket.HC",A="FI:::/Demo/Games/Rocket.HC"$
$LK,"/Demo/Games/RocketScience.HC",A="FI:::/Demo/Games/RocketScience.HC"$
$LK,"/Demo/Games/Squirt.HC",A="FI:::/Demo/Games/Squirt.HC"$
$LK,"/Demo/Games/Talons.HC",A="FI:::/Demo/Games/Talons.HC"$
$LK,"/Demo/Games/TheDead.HC",A="FI:::/Demo/Games/TheDead.HC"$
$LK,"/Demo/Games/TicTacToe.HC",A="FI:::/Demo/Games/TicTacToe.HC"$
$LK,"/Demo/Games/TreeCheckers.HC",A="FI:::/Demo/Games/TreeCheckers.HC"$
$LK,"/Demo/Games/Varoom.HC",A="FI:::/Demo/Games/Varoom.HC"$
$LK,"/Demo/Games/Wenceslas.HC",A="FI:::/Demo/Games/Wenceslas.HC"$
$LK,"/Demo/Games/Whap.HC",A="FI:::/Demo/Games/Whap.HC"$
$LK,"/Demo/Games/Zing.HC",A="FI:::/Demo/Games/Zing.HC"$
$LK,"/Demo/Games/ZoneOut.HC",A="FI:::/Demo/Games/ZoneOut.HC"$
Unlike Linux and Windows, we do not want to handle all usage models. On the contrary, we want to cherry-pick the hell out of our target usage so we maximize the elegance and simple beauty while delivering something good for $FG,4$$TX,"Hymns",HTML="http://www.templeos.org/Wb/Home/Web/TAD/HymnVideos.html"$$FG$.
If we can define the vector space we hope to span, precisely, then we can leave the operating system on autopilot for future generations. They simply make the best possible solution to the vector space.
Knuth other literate coding homos are wrong -- if you have a well define way of doing things, it usually doesn't matter as long as it is consistent and easy to remember, so you don't vasillate. Try to do things in the way the computer naturally wants to do them. Don't be an arrogant French buffoon. Top-down is ridiculous because you have to make headers for every function. Bottom-up is how a computer wants to do it. In the past, there was a big-endian/little-endian battle. Little endian is obviously the way the computer naturally wants to operate.
Do not bloat a compiler with theoretical optimizations that bad programmers might require. We would rather teach them. As a matter of fact, there is a very straight forward way to convert the C language to machine code.
When I solicit line-of-code reducing optimizations, I plan to make it 100% objective, if possible, and chuckle at the fun, hard-to-understand hacks.
If you have ideas on how to make TempleOS more like Linux, I'm not interested. However, if you have ideas to make it more like the 8-bit computer generation operating systems or like DOS, I am interested. We want the creative spirit of the 8-bit generation of computers.
$FG,8$
* "Linux" is a trademark owned by Linus Torvalds.
* "Windows" is a trademark owned by MicroSoft Corp.
@@ -1,5 +1,5 @@
//This is a customized version of $LK,"::/Demo/ToHtmlToTXTDemo/ToHtml.HC"$.
//$MA-X+PU,"Diff",LM="WinMax;WinBorder;S2T(\"/*\",\"+r+S\");Diff(\"/Demo/ToHtmlToTXTDemo/ToHtml.HC.Z\",\"/Home/TOSToHtml.HC.Z\");View;"$
//$MA-X+PU,"Diff",LM="WinMax;WinBorder;S2T(\"/*\",\"+r+S\");Diff(\"/Demo/ToHtmlToTXTDemo/ToHtml.HC.Z\",\"~/TOS/TOSToHtml.HC.Z\");View;"$
#help_index "DolDoc/Conversion"
//See $LK,"::/Doc/Credits.DD"$.
@@ -163,10 +163,10 @@ public CDoc *Doc2Html(CDoc *doc_in,U8 *html_header=NULL,U8 *body_header=NULL,
U8 (*link_cvt)(U8 *link_st)=&TOSLinkCvt1,Bool line_nums=FALSE)
{//Cvt $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.DD"$doc to HTML file.
CDocEntry *doc_e,*style,*doc_e2;
I64 i,y,old_y=MIN_I64,col,old_u32_attr=DOCET_UNDEF_COLOR,old_attr,digits;
I64 i,y,old_y=I64_MIN,col,old_u32_attr=DOCET_UNDEF_COLOR,old_attr,digits;
U32 *hl,*src;
U8 *st,st_2[2],*link_st,*style_bitmap=CAlloc(256/8);
CBGR48 p[NUM_COLORS];
CBGR48 p[COLORS_NUM];
GrPaletteGet(p);
CDoc *doc_out=DocNew;
Bool unlock_doc_in=DocLock(doc_in),no_bwd;
@@ -189,7 +189,7 @@ public CDoc *Doc2Html(CDoc *doc_in,U8 *html_header=NULL,U8 *body_header=NULL,
"<head>\n"
"<meta http-equiv=\"Content-Type\" "
"content=\"text/html;charset=US-ASCII\">\n"
"<meta name=\"generator\" content=\"$TX,"TempleOS V5.00",D="DD_OS_NAME_VERSION"$\">\n";
"<meta name=\"generator\" content=\"$TX,"TempleOS V5.01",D="DD_OS_NAME_VERSION"$\">\n";
if (!body_header) body_header=
"<body>\n"
"<pre style=\"font-family:courier;font-size:10pt\">\n";
@@ -402,7 +402,7 @@ public U0 TOSToHtml(U8 *_in_name,U8 *_out_name=NULL,U8 *html_header=NULL,
Free(out_name);
}
#help_index "TOS"
#help_index "Misc/TOS"
U0 TOSWebFile(U8 *name,Bool line_nums=FALSE)
{
U8 *name2;
@@ -430,7 +430,7 @@ U0 TOSWebFile(U8 *name,Bool line_nums=FALSE)
"<meta name=\"keywords\" "
"content=\"Operating System,64-Bit,64 Bit,"
"Temple,OS,TempleOS,Free,Open Source,Public Domain,x86_64\">\n"
"<meta name=\"generator\" content=\"$TX,"TempleOS V5.00",D="DD_OS_NAME_VERSION"$\">\n",
"<meta name=\"generator\" content=\"$TX,"TempleOS V5.01",D="DD_OS_NAME_VERSION"$\">\n",
"<body style=\"background-color:#55FFFF; border-style:solid;
border-width:8px; border-color:#0000AA;
@@ -473,8 +473,8 @@ U0 FreshenWebDir(U8 *dirname,Bool line_nums=FALSE)
DirTreeDel(tmpde1);
}
public U0 MakeWebSite()
{
public U0 FreshenSite()
{//Regen html files in D:/Wb
CDirEntry *tmpde,*tmpde1;
DocClear;
Cd("D:/Wb");
File diff suppressed because it is too large. Load diff
-118
View File
@@ -1,118 +0,0 @@
$WW,1$$FG,5$$TX+CX,"TOS Staff Policies"$$FG$
* Motto: Run toward bugs, not away from bugs.
* Be Metallica. Use short, sharp, powerful words, as though a song.
* Be careful $FG,2$/Demo/AcctExample$FG$ doesn't get extra files. When you run TOSRegen(), it will copy home files to $FG,2$/Demo/AcctExample$FG$.
* Be careful $FG,2$remote/Wb$FG$ site doesn't get extra files. If you delete or rename a file, also delete the $FG,2$remote/Wb$FG$ file from the site.
$TR,"PreBackUp()"$
$ID,2$
Linux: Export Bookmarks to ~/TAD/Home/Sup1/Sup1Blog/Bookmarks.html
Linux: >vm_in
{
TempleOS: >PreBackUp;
TempleOS: Update Budget
TempleOS: >#include "::/Misc/OSTestSuite"
TempleOS: >Del("/Home/Demo*");
}
$ID,-2$
$TR,"Regen()"$
$ID,2$
When you do these four steps, do them as quickly as possible so that the $LK,"::/Doc/ChangeLog.DD"$ datetime approximately matches Kernel $LK,"sys_compile_time",A="MN:sys_compile_time"$.
{
TempleOS: Add ordinary $LK,"::/Doc/ChangeLog.DD"$ entry.
TempleOS: >TOSBootHDIns('C');
TempleOS: >BootRAM;
TempleOS: >TOSRegen;
}
$ID,-2$
$TR,"NewRelease(Bool full=FALSE)"$
$ID,2$
if ($FG,2$full$FG$)
]PreBackUp()
]Regen()
Linux: >vm_out
if ($FG,2$full$FG$) {
Linux: Burn ~/TAD to memory stick.
On other machine {
Linux: Copy ~/TAD from memory stick.
VMware: Install new TempleOSStaff.ISO to machine named, "TOS".
{ //2048 Meg RAM
TempleOS: $LK,"TOSStaffIns",A="MN:TOSStaffIns"$(); in VMware.
]Regen()
TempleOS: >#include "::/Misc/OSTestSuite"
TempleOS: >Del("/Home/Demo*");
}
Linux: >emu_staff_new
Linux: >emu8core or >emu24core
{
TempleOS: $LK,"TOSStaffIns",A="MN:TOSStaffIns"$(); in QEMU.
]Regen()
}
}
}
Linux: CrossFTP sync ~/TAD/Site1/Wb to remote/Wb
if ($FG,2$full$FG$) {
FileZilla
Upload ~/TAD/Site1/index.html to remote/index.html
Upload ~/TAD/Site1/TempleOS.html to remote/TempleOS.html
}
In WebHost FileMgr {
Del {
remote/TempleOSCD.ISO
remote/TempleOSSup1.ISO.C
remote/TempleOSWeb.ISO.C
remote/TempleOSUltra.ISO
}
Copy up one level to remote root {
remote/Wb/TempleOSCD.ISO
remote/Wb/TempleOSSup1.ISO.C
remote/Wb/TempleOSWeb.ISO.C
remote/Wb/TempleOSUltra.ISO
}
}
$ID,-2$
$TR,"NewVersion(Bool full=FALSE)"$
$ID,2$
Increment minor version number.
>$LK,"R",A="MN:R"$("3.12","3.13","-i-l"); //Approve by hand.
Add version release notice in $LK,"::/Doc/ChangeLog.DD"$.
]NewRelease(TRUE);
Submit to www.betanews.com.
Send email to MajorGeeks.
if ($FG,2$full$FG$) {
Submit to www.upload.com.
Upload to SourceForge.
}
$ID,-2$
$TR,"NewYearlyVersion()"$
$ID,2$
Increment major version number.
>$LK,"R",A="MN:R"$("3.13","4.00","-i-l"); //Approve by hand.
Add version release notice in $LK,"::/Doc/ChangeLog.DD"$.
$LK,"Update ::/Misc/PCIDevices.DD",A="FF:::/Adam/DevInfo.HC,PCIDevFileGen"$
Remove 6 months from bottom of $LK,"::/Doc/ChangeLog.DD"$.
]NewVersion(TRUE);
$ID,-2$
* If you change the compiler language syntax, immediately make a ]NewRelease(TRUE).
+4 -4
View File
@@ -1,6 +1,6 @@
public U0 DocProfile(U8 *filename,I64 flags)
{
I64 i,*cmd_stats=CAlloc(sizeof(I64)*DOCT_NUM_TYPES),
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
@@ -33,7 +33,7 @@ public U0 DocProfile(U8 *filename,I64 flags)
"$$LK,\"Doc Type Codes\","
"A=\"FF:::/Adam/DolDoc/DocInit.HC,ST_DOC_CMDS\"$$.\n"
"$$FG$$";
for (i=0;i<DOCT_NUM_TYPES;i++)
for (i=0;i<DOCT_TYPES_NUM;i++)
if (cmd_stats[i])
"%4Z:%d\n",i,"ST_DOC_CMDS",cmd_stats[i];
@@ -76,5 +76,5 @@ The flag arrays $LK,"doldoc.type_flags_form",A="MN:CDolDocGlbls"$, etc
are useful.
*/
DocProfile("::/Doc/ChangeLog.DD",0);
DocProfile("::/Doc/ChangeLog.DD",DOCF_PLAIN_TEXT);
DocProfile("::/Doc/ChgLog.DD",0);
DocProfile("::/Doc/ChgLog.DD",DOCF_PLAIN_TEXT);
+1 -1
View File
@@ -1,7 +1,7 @@
U0 BlkDevRep()
{//Block Device Report.
I64 i;
for (i=0;i<NUM_BLKDEVS;i++)
for (i=0;i<BLKDEVS_NUM;i++)
if (blkdev.blkdevs[i].bd_signature==BD_SIGNATURE_VAL)
//$LK,"ClassRep",A="MN:ClassRep"$() dumps any structure, automatically.
ClassRep(&blkdev.blkdevs[i]);
+4 -4
View File
@@ -1,5 +1,5 @@
#define DB_FILENAME "~/DataBaseDemo.BIN"
#define DB_MAX_ACCT 100
#define DB_ACCT_MAX 100
#define DB_ACCT_BLKS 1
class Acct
@@ -11,7 +11,7 @@ class Acct
U0 InitDatabase()
{ //Write new contiguous file
CFile *f=FOpen(DB_FILENAME,"w",DB_MAX_ACCT*DB_ACCT_BLKS);
CFile *f=FOpen(DB_FILENAME,"w",DB_ACCT_MAX*DB_ACCT_BLKS);
FClose(f);
}
@@ -22,7 +22,7 @@ U0 WriteAcct()
I64 acctnum;
acctnum=GetI64("Acct #",-1);
if (0<=acctnum<DB_MAX_ACCT) {
if (0<=acctnum<DB_ACCT_MAX) {
MemSet(&a,0,BLK_SIZE);
if (DocForm(&a)) {
f=FOpen(DB_FILENAME,"w+");
@@ -39,7 +39,7 @@ U0 ReadAcct()
I64 acctnum;
acctnum=GetI64("Acct #",-1);
if (0<=acctnum<DB_MAX_ACCT) {
if (0<=acctnum<DB_ACCT_MAX) {
f=FOpen(DB_FILENAME,"r");
FRBlks(f,&a,acctnum*DB_ACCT_BLKS,DB_ACCT_BLKS);
FClose(f);
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+8 -8
View File
@@ -98,13 +98,13 @@ F64 man_
F64 t0,tf;
#define NUM_MONSTERS 10
#define MONSTERS_NUM 10
I64 monsters_left;
class Monster
{
I64 x,y;
Bool dead,pad[7];
} monsters[NUM_MONSTERS];
} monsters[MONSTERS_NUM];
U0 CFTransform(CDC *dc,I64 *x,I64 *y,I64 *z)
{
@@ -308,7 +308,7 @@ U0 DrawIt(CTask *task,CDC *dc)
}
//Draw Monsters
for (i=0,tmpm=monsters;i<NUM_MONSTERS;i++,tmpm++) {
for (i=0,tmpm=monsters;i<MONSTERS_NUM;i++,tmpm++) {
x=tmpm->x;
y=tmpm->y;
if (LOS(x,y,man_xx,man_yy)) {
@@ -350,7 +350,7 @@ U0 DrawIt(CTask *task,CDC *dc)
//Draw Things on heads-up Map
dc->color=LTPURPLE;
for (i=0,tmpm=monsters;i<NUM_MONSTERS;i++,tmpm++)
for (i=0,tmpm=monsters;i<MONSTERS_NUM;i++,tmpm++)
if (!tmpm->dead)
GrPlot3(dc,2*(tmpm->x/SCRN_SCALE),
2*(map_height-1-tmpm->y/SCRN_SCALE),0);
@@ -381,7 +381,7 @@ U0 Fire()
Monster *tmpm;
Noise(100,53,74);
for (i=0,tmpm=monsters;i<NUM_MONSTERS;i++,tmpm++) {
for (i=0,tmpm=monsters;i<MONSTERS_NUM;i++,tmpm++) {
x=tmpm->x;
y=tmpm->y;
if (!tmpm->dead &&
@@ -428,14 +428,14 @@ U0 Init()
man_yy=(map_height-1-MAN_START_Y)*SCRN_SCALE;
man_é=0;
for (i=0,tmpm=monsters;i<NUM_MONSTERS;i++,tmpm++) {
for (i=0,tmpm=monsters;i<MONSTERS_NUM;i++,tmpm++) {
tmpm->dead=FALSE;
do {
tmpm->x=RandU64%((map_width-2)*SCRN_SCALE)+SCRN_SCALE;
tmpm->y=RandU64%((map_height-2)*SCRN_SCALE)+SCRN_SCALE;
} while (!map[(tmpm->y/SCRN_SCALE)*map_width+tmpm->x/SCRN_SCALE]);
}
monsters_left=NUM_MONSTERS;
monsters_left=MONSTERS_NUM;
tf=0;
t0=tS;
}
@@ -447,7 +447,7 @@ U0 AnimateTask(I64)
while (TRUE) {
dd=0.25*SCRN_SCALE*Sin(tS/2);
for (i=0,tmpm=monsters;i<NUM_MONSTERS;i++,tmpm++)
for (i=0,tmpm=monsters;i<MONSTERS_NUM;i++,tmpm++)
if (!tmpm->dead) {
x=tmpm->x;
y=tmpm->y;
Binary file not shown.
+7 -7
View File
@@ -62,13 +62,13 @@ I64 man_x,man_y,man_dx,man_dy;
Bool man_attack;
F64 man_attack_t0;
#define NUM_MONSTERS 10
#define MONSTERS_NUM 10
I64 monsters_left;
class Monster
{
I64 x,y,dx,dy;
Bool dead,pad[7];
} monsters[NUM_MONSTERS];
} monsters[MONSTERS_NUM];
F64 t0,tf;
@@ -176,7 +176,7 @@ U0 DrawIt(CTask *task,CDC *dc)
}
}
for (i=0,tmpm=monsters;i<NUM_MONSTERS;i++,tmpm++)
for (i=0,tmpm=monsters;i<MONSTERS_NUM;i++,tmpm++)
if (!tmpm->dead && LOS(tmpm->x,tmpm->y,man_x,man_y)) {
x1=(tmpm->x-scrn_x)*SCRN_SCALE+SCRN_SCALE/2;
y1=(tmpm->y-scrn_y)*SCRN_SCALE+SCRN_SCALE/2;
@@ -233,7 +233,7 @@ U0 Attack()
man_attack_t0=tS;
Noise(100,53,74);
for (i=0,tmpm=monsters;i<NUM_MONSTERS;i++,tmpm++) {
for (i=0,tmpm=monsters;i<MONSTERS_NUM;i++,tmpm++) {
if (!tmpm->dead &&
man_x+man_dx==tmpm->x && man_y+man_dy==tmpm->y) {
tmpm->dead=TRUE;
@@ -270,7 +270,7 @@ U0 Init()
man_dy=0;
scrn_x=0;
scrn_y=0;
for (i=0,tmpm=monsters;i<NUM_MONSTERS;i++,tmpm++) {
for (i=0,tmpm=monsters;i<MONSTERS_NUM;i++,tmpm++) {
tmpm->dead=FALSE;
tmpm->dx=0;
tmpm->dy=0;
@@ -279,7 +279,7 @@ U0 Init()
tmpm->y=RandU64%(map_height-2)+1;
} while (!map[(tmpm->y)*map_width+tmpm->x]);
}
monsters_left=NUM_MONSTERS;
monsters_left=MONSTERS_NUM;
tf=0;
t0=tS;
}
@@ -296,7 +296,7 @@ U0 AnimateTask(I64)
Monster *tmpm;
while (TRUE) {
for (i=0,tmpm=monsters;i<NUM_MONSTERS;i++,tmpm++)
for (i=0,tmpm=monsters;i<MONSTERS_NUM;i++,tmpm++)
if (!tmpm->dead) {
dx=RandU16%3-1;
dy=RandU16%3-1;
Binary file not shown.
+17 -17
View File
@@ -10,7 +10,7 @@ CTask *main_task;
#define OT_CARRIER 0
#define OT_CRUISER 1
#define OT_FIGHTER 2
#define OT_NUM_TYPES 3
#define OT_TYPES_NUM 3
#define OF_SHIP 1
#define OF_ACTIVE 2
@@ -83,13 +83,13 @@ U0 SquadronRem(Obj *o)
succ->last_in_squadron=pred;
}
#define NUM_PLAYERS 2
#define PLAYERS_NUM 2
I64 num_carriers[NUM_PLAYERS]={2,3},
num_cruisers[NUM_PLAYERS]={2,3},
num_planes_per_squadron[NUM_PLAYERS]={6,5},
num_squadrons_per_carrier[NUM_PLAYERS]={2,3},
num_alive[NUM_PLAYERS],
I64 num_carriers[PLAYERS_NUM]={2,3},
num_cruisers[PLAYERS_NUM]={2,3},
num_planes_per_squadron[PLAYERS_NUM]={6,5},
num_squadrons_per_carrier[PLAYERS_NUM]={2,3},
num_alive[PLAYERS_NUM],
num_squadrons;
Obj *ObjFind(F64 x,F64 y,
@@ -97,7 +97,7 @@ Obj *ObjFind(F64 x,F64 y,
I64 type_mask=-1,I64 player_mask=-1,F64 *_d=NULL)
{
Obj *tmpo=obj_head.next,*best=NULL;
F64 dd,best_dd=MAX_F64;
F64 dd,best_dd=F64_MAX;
while (tmpo!=&obj_head) {
if (tmpo->flags&flag_mask==flag_val &&
Bt(&type_mask,tmpo->type)&&Bt(&player_mask,tmpo->player)) {
@@ -154,7 +154,7 @@ $SP,"<5>",BI=5$
$SP,"<6>",BI=6$
$BG$
U8 *imgs[NUM_PLAYERS][OT_NUM_TYPES]={{$IB,"<1>",BI=1$,$IB,"<2>",BI=2$,$IB,"<3>",BI=3$},{$IB,"<4>",BI=4$,$IB,"<5>",BI=5$,$IB,"<6>",BI=6$}};
U8 *imgs[PLAYERS_NUM][OT_TYPES_NUM]={{$IB,"<1>",BI=1$,$IB,"<2>",BI=2$,$IB,"<3>",BI=3$},{$IB,"<4>",BI=4$,$IB,"<5>",BI=5$,$IB,"<6>",BI=6$}};
U0 DrawIt(CTask *task,CDC *dc)
{
@@ -289,7 +289,7 @@ U0 Init()
launch_t=return_t=set_é_t=0;
main_task=Fs;
num_squadrons=0;
for (player=0;player<NUM_PLAYERS;player++) {
for (player=0;player<PLAYERS_NUM;player++) {
num_alive[player]=0;
for (ship=0;ship<num_cruisers[player];ship++) {
tmpo1=CAlloc(sizeof(Obj));
@@ -380,14 +380,14 @@ U0 CleanUp()
}
Obj *ObjLaunch(I64 player,I64 squadron=-1,
Obj *host=NULL,F64 x=MAX_F64,F64 y=MAX_F64,F64 é=MAX_F64)
Obj *host=NULL,F64 x=F64_MAX,F64 y=F64_MAX,F64 é=F64_MAX)
{
Obj *tmpo;
F64 cur_time=tS;
if (!host)
host=ObjFind(x,y,,,1<<OT_CARRIER,1<<player);
if (host && cur_time>host->next_action_time) {
if (é==MAX_F64)
if (é==F64_MAX)
é=Arg(x-host->x,y-host->y);
tmpo=obj_head.next;
while (tmpo!=&obj_head) {
@@ -401,7 +401,7 @@ Obj *ObjLaunch(I64 player,I64 squadron=-1,
else {
tmpo->flags=tmpo->flags&~OF_RETURNING|OF_ACTIVE;
tmpo->é=host->é;
if (x==MAX_F64 || y==MAX_F64 || Sqr(x-host->x)+Sqr(y-host->y)>3*3)
if (x==F64_MAX || y==F64_MAX || Sqr(x-host->x)+Sqr(y-host->y)>3*3)
tmpo->dé=Wrap(é-tmpo->é,-ã);
else
tmpo->dé=0;
@@ -417,7 +417,7 @@ Obj *ObjLaunch(I64 player,I64 squadron=-1,
return NULL;
}
Squadron *SquadronLaunch(I64 player,F64 x=MAX_F64,F64 y=MAX_F64)
Squadron *SquadronLaunch(I64 player,F64 x=F64_MAX,F64 y=F64_MAX)
{
Squadron *tmps;
Obj *tmpo;
@@ -473,12 +473,12 @@ Squadron *SquadronReturn(I64 player,F64 x,F64 y)
return NULL;
}
Obj *ObjSeté(I64 player,F64 x=MAX_F64,F64 y=MAX_F64,F64 é=MAX_F64)
Obj *ObjSeté(I64 player,F64 x=F64_MAX,F64 y=F64_MAX,F64 é=F64_MAX)
{
Obj *tmpo;
if ((tmpo=ObjFind(x,y,,,,1<<player)) && tmpo->flags&OF_ACTIVE &&
!(tmpo->flags&OF_RETURNING)) {
if (é==MAX_F64)
if (é==F64_MAX)
é=Arg(x-tmpo->x,y-tmpo->y);
tmpo->dé+=Wrap(é-(tmpo->é+tmpo->dé),-ã);
return tmpo;
@@ -486,7 +486,7 @@ Obj *ObjSet
return NULL;
}
Squadron *SquadronSeté(I64 player,F64 x=MAX_F64,F64 y=MAX_F64,F64 é=MAX_F64)
Squadron *SquadronSeté(I64 player,F64 x=F64_MAX,F64 y=F64_MAX,F64 é=F64_MAX)
{
Squadron *tmps;
Obj *tmpo;
+8 -8
View File
@@ -1,8 +1,8 @@
#define NUM_ROAD 512
#define ROAD_NUM 512
#define ROAD_WIDTH_BY_2 200
#define CAR_WIDTH_BY_2 100
I64 road_x[NUM_ROAD],road_trend;
I64 road_x[ROAD_NUM],road_trend;
F64 speed,distance;
I64 road_ptr=0,car_x;
F64 t_last;
@@ -12,11 +12,11 @@ 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&(NUM_ROAD-1)];
xx=w>>1-car_x+road_x[road_ptr&(ROAD_NUM-1)];
dc->color=LTGRAY;
for (i=0;i<NUM_ROAD;i++) {
x=w>>1-car_x+road_x[(i+road_ptr)&(NUM_ROAD-1)];
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);
@@ -48,8 +48,8 @@ U0 UpdateRoad()
t_last=t0;
while (distance>1.0) {
road_trend=ClampI64(road_trend+SignI64(RandU16%3-1),-5,5);
road_x[road_ptr&(NUM_ROAD-1)]=
road_x[(road_ptr-1)&(NUM_ROAD-1)]+=road_trend/3;
road_x[road_ptr&(ROAD_NUM-1)]=
road_x[(road_ptr-1)&(ROAD_NUM-1)]+=road_trend/3;
road_ptr++;
distance-=1.0;
}
@@ -65,7 +65,7 @@ U0 Init()
road_trend=0;
road_ptr=0;
car_x=0;
for (i=0;i<NUM_ROAD;i++) {
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;
+1 -2
View File
@@ -17,8 +17,7 @@ U0 DrawIt(CTask *,CDC *dc)
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);
GrLine(dc,tmps->end1->x,tmps->end1->y,tmps->end2->x,tmps->end2->y);
tmps=tmps->next;
}
+9 -9
View File
@@ -1,11 +1,11 @@
I64 sc_1,sc_2;
#define NUM_DROPS 0x2000
#define DROPS_NUM 0x2000
class Drop
{
I32 x,y;
} drops[NUM_DROPS];
} drops[DROPS_NUM];
CDC *cur_dc;
@@ -49,7 +49,7 @@ U0 DrawDrops(CTask *,CDC *dc)
{
I64 i;
dc->color=BLUE;
for (i=0;i<NUM_DROPS;i++)
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);
}
@@ -80,21 +80,21 @@ U0 AnimateTask(I64)
for (i=0;i<2;i++) {
j=0;
do {
if (++cur_drop>=NUM_DROPS)
if (++cur_drop>=DROPS_NUM)
cur_drop=0;
if (drops[cur_drop].y<0)
break;
j++;
} while (j<=NUM_DROPS);
} while (j<=DROPS_NUM);
drops[cur_drop].x=RandU32%w;
drops[cur_drop].y=0;
}
for (i=0;i<NUM_DROPS;i++) {
for (i=0;i<DROPS_NUM;i++) {
if (drops[i].y>=0) {
if (drops[i].y>=h-1)
drops[i].y=-MAX_I32;
drops[i].y=-I32_MAX;
else {
x0=x1=drops[i].x;
y0=y1=drops[i].y;
@@ -141,8 +141,8 @@ U0 Init()
{
I64 i;
MemSet(drops,0,sizeof(drops));
for (i=0;i<NUM_DROPS;i++)
drops[i].y=-MAX_I32;
for (i=0;i<DROPS_NUM;i++)
drops[i].y=-I32_MAX;
}
U0 RainDrops()
+21 -21
View File
@@ -17,7 +17,7 @@ CDC *map_dc;
#define GATE_HEIGHT 7
F64 gate_é,gate_t;
$BG,10$
$SP,"<1>",BI=1$ $SP,"<2>",BI=2$ $SP,"<3>",BI=3$
@@ -37,7 +37,7 @@ $SP,"<9>",BI=9$
$BG$
#define ANIMAL_WIDTH 20
#define ANIMAL_HEIGHT 16
@@ -45,7 +45,7 @@ U8 *cow_imgs[4] ={$IB,"<1>",BI=1$,$IB,"<2>",BI=2$,$IB,"<3>",BI=3$,$IB,"<2>",BI=
*bull_imgs[4] ={$IB,"<4>",BI=4$,$IB,"<5>",BI=5$,$IB,"<6>",BI=6$,$IB,"<5>",BI=5$},
*horse_imgs[4]={$IB,"<7>",BI=7$,$IB,"<8>",BI=8$,$IB,"<7>",BI=7$,$IB,"<8>",BI=8$};
#define NUM_ANIMALS 100
#define ANIMALS_NUM 100
class Animal
{
@@ -84,8 +84,8 @@ U0 RiverMake()
waterfall_width=r_width[y];
waterfall_x=r_x[y]-waterfall_width/2;
} else {
dx=ClampI64(dx+RandI32/64,-MAX_I32,MAX_I32)-MAX_I32/256;
w=ClampI64(w+RandI32*2,10*MAX_U32,150*MAX_U32);
dx=ClampI64(dx+RandI32/64,-I32_MAX,I32_MAX)-I32_MAX/256;
w=ClampI64(w+RandI32*2,10*U32_MAX,150*U32_MAX);
x+=dx;
}
}
@@ -105,7 +105,7 @@ U0 RiverMake()
map_dc->pen_width=r_width[y]+10;
GrPlot3(map_dc,r_x[y]+x.i32[1],y,0);
}
x=ClampI64(x+RandI32,-6*MAX_U32,6*MAX_U32);
x=ClampI64(x+RandI32,-6*U32_MAX,6*U32_MAX);
}
//Plot water
@@ -219,7 +219,7 @@ U0 DrawIt(CTask *task,CDC *dc)
RiverDropsDraw(dc,cx,cy);
for (i=0;i<NUM_ANIMALS;i++)
for (i=0;i<ANIMALS_NUM;i++)
if (!a[i].dead) {
if (a[i].dx<0) {
dc->flags|=DCF_JUST_MIRROR|DCF_SYMMETRY;
@@ -262,8 +262,8 @@ U0 DrawIt(CTask *task,CDC *dc)
U0 BuddySel(I64 i)
{
I64 b,best_b=i,score,best_score=MAX_I64;
for (b=0;b<NUM_ANIMALS;b++) {
I64 b,best_b=i,score,best_score=I64_MAX;
for (b=0;b<ANIMALS_NUM;b++) {
if (b!=i && !a[b].dead) {
score=RandU32%(512*512)+
SqrI64(a[b].x.i32[1]-a[i].x.i32[1])+
@@ -328,12 +328,12 @@ Bool CheckMap(I64 x,I64 y)
U0 AnimateTask(CTask *parent)
{
I64 i,cx,cy,cursor_x,cursor_y,dd,ddx,ddy,cnt,max_speed=MAX_I64,updates=0,
I64 i,cx,cy,cursor_x,cursor_y,dd,ddx,ddy,cnt,max_speed=I64_MAX,updates=0,
my_outside_cnt;
F64 f,d,dx,dy,s,stress;
Animal *tmpa,*tmpa1;
while (TRUE) {
max_speed=ClampU64(max_speed,MAX_U32/3,200*MAX_U32);
max_speed=ClampU64(max_speed,U32_MAX/3,200*U32_MAX);
cx=(MAP_WIDTH -parent->pix_width)/2,
cy=(MAP_HEIGHT-parent->pix_height)/2;
cursor_x=ms.pos.x+cx-parent->pix_left-parent->scroll_x;
@@ -343,7 +343,7 @@ U0 AnimateTask(CTask *parent)
if (cursor_x<FENCE_WIDTH && cursor_y<FENCE_HEIGHT)
gate_t=tS;
RedrawGate;
for (i=0;i<NUM_ANIMALS;i++) {
for (i=0;i<ANIMALS_NUM;i++) {
tmpa=&a[i];
if (!tmpa->dead) {
//Move away from horse
@@ -353,14 +353,14 @@ U0 AnimateTask(CTask *parent)
d=Sqrt(dd);
dx=ddx/d;
dy=ddy/d;
f=5.0e2*MAX_U32/dd;
f=5.0e2*U32_MAX/dd;
tmpa->dx+=f*dx;
tmpa->dy+=f*dy;
}
//Resel buddy about every NUM_ANIMALS*10ms=5.12 seconds
//Resel buddy about every ANIMALS_NUM*10ms=5.12 seconds
tmpa1=&a[tmpa->buddy];
if (tmpa1->dead || i==updates%NUM_ANIMALS) {
if (tmpa1->dead || i==updates%ANIMALS_NUM) {
BuddySel(i);
tmpa1=&a[tmpa->buddy];
}
@@ -374,7 +374,7 @@ U0 AnimateTask(CTask *parent)
stress+=Abs(s);
dx=ddx/d;
dy=ddy/d;
f=-0.001*s*MAX_U32;
f=-0.001*s*U32_MAX;
tmpa->dx+=f*dx;
tmpa->dy+=f*dy;
}
@@ -438,7 +438,7 @@ U0 AnimateTask(CTask *parent)
stress=0;
if (stress>100.0) {
Yield;
max_speed=stress/5.0*MAX_U32; //Converge faster at start-up
max_speed=stress/5.0*U32_MAX; //Converge faster at start-up
} else {
Sleep(10);
max_speed=0; //Will be set to normal max speed
@@ -487,8 +487,8 @@ U0 ReInit()
for (i=MAP_BORDER;i<=MAP_HEIGHT-MAP_BORDER;i++)
RiverDropsNext(Fs);
MemSet(a,0,NUM_ANIMALS*sizeof(Animal));
for (i=0;i<NUM_ANIMALS;i++) {
MemSet(a,0,ANIMALS_NUM*sizeof(Animal));
for (i=0;i<ANIMALS_NUM;i++) {
a[i].num=i;
do {
a[i].x=(64+RandU32%(MAP_WIDTH-128))<<32;
@@ -501,7 +501,7 @@ U0 ReInit()
a[i].frame0=RandU16&3;
BuddySel(i);
}
outside_cnt=NUM_ANIMALS;
outside_cnt=ANIMALS_NUM;
gate_t=0;
gate_é=0;
t0=tS;
@@ -514,7 +514,7 @@ U0 Init()
rd_lock=0;
QueInit(&rd_head);
map_dc=DCNew(MAP_WIDTH,MAP_HEIGHT);
a=MAlloc(NUM_ANIMALS*sizeof(Animal));
a=MAlloc(ANIMALS_NUM*sizeof(Animal));
ReInit;
}
Binary file not shown.
+10 -11
View File
@@ -23,7 +23,7 @@ RegExe("TempleOS/Talons");
#define SNOW_ELEVATION 55
//Too big makes off-scrn draws take place.
#define MAX_PANEL_SIZE 16
#define PANEL_SIZE_MAX 16
@@ -174,7 +174,7 @@ CD3 normals[MAP_HEIGHT][MAP_WIDTH];
class MPCtrl {
I64 init_not_done_flags,update_not_done_flags,app_not_done_flags;
I64 strip_width[MP_MAX_PROCESSORS];
I64 strip_width[MP_PROCESSORS_NUM];
Bool app_done;
} mp;
@@ -284,11 +284,11 @@ U0 MPDoPanels(CTask *task)
h=1;
do {
cont=FALSE;
if (w<MAX_PANEL_SIZE && TestSameSlope(i,j,w+1,h)) {
if (w<PANEL_SIZE_MAX && TestSameSlope(i,j,w+1,h)) {
w++;
cont=TRUE;
}
if (h<MAX_PANEL_SIZE && TestSameSlope(i,j,w,h+1)) {
if (h<PANEL_SIZE_MAX && TestSameSlope(i,j,w,h+1)) {
h++;
cont=TRUE;
}
@@ -407,7 +407,7 @@ U0 InitElevations()
j=1<<(RandU32%6);
l=0;
while (j--) {
if (!l && RandU16<MAX_U16/4)
if (!l && RandU16<U16_MAX/4)
l=RandU16%(j+1);
if (l) {
x1=ClampI64(x-j,0,MAP_WIDTH-1);
@@ -659,7 +659,7 @@ U0 MPDrawIt(CTask *task,CDC *dc)
xh>>=1; yh>>=1;
xh2>>=1; yh2>>=1;
w_on_map=FALSE;
dd_old=MAX_I64;
dd_old=I64_MAX;
for (strip_width=0;cnts.jiffies<update_jiffy_limit;strip_width++) {
x1h=x1wa;
y1h=y1wa;
@@ -689,7 +689,7 @@ U0 MPDrawIt(CTask *task,CDC *dc)
if (h_on_map)
w_on_map=TRUE;
else if (w_on_map) {
strip_width=MAX_I64;
strip_width=I64_MAX;
break;
}
x1wb-=yh2;
@@ -866,7 +866,7 @@ U0 Core0Talons()
if (0<=xx<MAP_WIDTH && 0<=yy<MAP_HEIGHT)
elev=elevations[yy][xx];
else
elev=MAX_I64;
elev=I64_MAX;
height=z/COORDINATE_SCALE-elev;
if (height<0 && elev>WATER_ELEVATION*MAP_SCALE && !game_tf) {
@@ -892,7 +892,7 @@ U0 Core0Talons()
while (mp.update_not_done_flags)
Sleep(1);
min_strip_width=MAX_F64;
min_strip_width=F64_MAX;
for (i=0;i<mp_cnt;i++)
min_strip_width=Min(min_strip_width,32.0*mp.strip_width[i]/(i+32.0));
strip_height=ClampI64(
@@ -936,7 +936,7 @@ U0 Core0Talons()
Obj *FishFind(I64 x1,I64 y1,I64 *_dd)
{
I64 dd,best_dd=MAX_I64;
I64 dd,best_dd=I64_MAX;
Obj *res=NULL,*tmpo;
Panel *tmpp=panel_head;
while (tmpp) {
@@ -1230,7 +1230,6 @@ U0 Talons()
MenuPop;
}
Seed(1);
Talons;
�
àÿÿÿýÿÿÿ
Binary file not shown.
+29 -29
View File
@@ -3,7 +3,7 @@ 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("NUM_UNITS","%d",4096/SqrI64(rad)&~1);
DefinePrint("UNITS_NUM","%d",4096/SqrI64(rad)&~1);
DefinePrint("CIRCLE_RAD","%d",rad);
DefinePrint("MOVE_CIRCLES","%d",40/rad);
@@ -19,7 +19,7 @@ class Unit
{
I64 num,x,y,player,link,color;
Bool alive,king;
} u[NUM_UNITS];
} u[UNITS_NUM];
CDC *map_dc;
I64 cur_player,num_alive[2],start_x,start_y,end_x,end_y;
@@ -68,12 +68,12 @@ U0 DrawIt(CTask *task,CDC *dc)
}
GrPrint(dc,2,2,"Player %d",cur_player+1);
for (i=0;i<NUM_UNITS;i++)
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<NUM_UNITS;i++)
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);
@@ -98,9 +98,9 @@ U0 DrawIt(CTask *task,CDC *dc)
Unit *UnitFind(I64 x,I64 y,I64 player)
{
I64 i,dd,best_dd=MAX_I64;
I64 i,dd,best_dd=I64_MAX;
Unit *res=NULL;
for (i=0;i<NUM_UNITS;i++) {
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) {
@@ -116,7 +116,7 @@ U0 KillsChk(I64 x1,I64 y1,I64 player)
{
I64 i,j,x2,y2,dd;
Bool found;
for (i=0;i<NUM_UNITS;i++) {
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;
@@ -127,7 +127,7 @@ U0 KillsChk(I64 x1,I64 y1,I64 player)
num_alive[u[i].player]--;
do {
found=FALSE;
for (j=0;j<NUM_UNITS;j++)
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;
@@ -208,17 +208,17 @@ U0 Init()
map_dc=DrawHexMap(&w,&h);
cur_player=0;
for (i=0;i<NUM_UNITS/2;i++) {
for (i=0;i<UNITS_NUM/2;i++) {
u[i].num=i;
u[i+NUM_UNITS/2].num=i+NUM_UNITS/2;
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+NUM_UNITS/2].y=h-1-u[i].y;
u[i+UNITS_NUM/2].y=h-1-u[i].y;
j1=u[i].y/(CIRCLE_RAD*2);
j2=u[i+NUM_UNITS/2].y/(CIRCLE_RAD*2);
j2=u[i+UNITS_NUM/2].y/(CIRCLE_RAD*2);
u[i].y+=BORDER_Y;
u[i+NUM_UNITS/2].y+=BORDER_Y;
u[i+UNITS_NUM/2].y+=BORDER_Y;
if (!i) {
u[i].x=CIRCLE_RAD;
@@ -226,40 +226,40 @@ ti_restart:
goto ti_restart;
} else
u[i].x=FloorI64(RandU32%((w-CIRCLE_RAD*2*2)/2),CIRCLE_RAD*2)+CIRCLE_RAD;
u[i+NUM_UNITS/2].x=w-1-u[i].x;
u[i+UNITS_NUM/2].x=w-1-u[i].x;
if (j1&1)
u[i].x+=CIRCLE_RAD;
if (j2&1)
u[i+NUM_UNITS/2].x+=CIRCLE_RAD;
u[i+UNITS_NUM/2].x+=CIRCLE_RAD;
u[i].x+=BORDER_X;
u[i+NUM_UNITS/2].x+=BORDER_X;
u[i+UNITS_NUM/2].x+=BORDER_X;
S2W(&u[i].x,&u[i].y);
S2W(&u[i+NUM_UNITS/2].x,&u[i+NUM_UNITS/2].y);
S2W(&u[i+UNITS_NUM/2].x,&u[i+UNITS_NUM/2].y);
u[i].player=0;
u[i+NUM_UNITS/2].player=1;
u[i+UNITS_NUM/2].player=1;
u[i].alive=TRUE;
u[i+NUM_UNITS/2].alive=TRUE;
u[i+UNITS_NUM/2].alive=TRUE;
if (!i) {
u[i].color=LTCYAN;
u[i+NUM_UNITS/2].color=LTPURPLE;
u[i+UNITS_NUM/2].color=LTPURPLE;
u[i].king=TRUE;
u[i+NUM_UNITS/2].king=TRUE;
u[i+UNITS_NUM/2].king=TRUE;
} else {
u[i].color=CYAN;
u[i+NUM_UNITS/2].color=PURPLE;
u[i+UNITS_NUM/2].color=PURPLE;
u[i].king=FALSE;
u[i+NUM_UNITS/2].king=FALSE;
u[i+UNITS_NUM/2].king=FALSE;
}
}
for (i=0;i<NUM_UNITS/2;i++) {
for (i=0;i<UNITS_NUM/2;i++) {
if (!u[i].king) {
best_dd=MAX_I64;
for (j=0;j<NUM_UNITS/2;j++) {
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 && dd<best_dd) {
@@ -269,11 +269,11 @@ ti_restart:
}
}
u[i].link=best;
u[i+NUM_UNITS/2].link=best+NUM_UNITS/2;
u[i+UNITS_NUM/2].link=best+UNITS_NUM/2;
}
}
num_alive[0]=NUM_UNITS/2;
num_alive[1]=NUM_UNITS/2;
num_alive[0]=UNITS_NUM/2;
num_alive[1]=UNITS_NUM/2;
}
U0 CleanUp()
+26 -26
View File
@@ -94,11 +94,11 @@ F64 distance,t0,tf;
Bool game_over;
#define BORDER 7500
#define R 10000
#define RADIUS 10000
#define WIDTH 2000
#define SHOULDER 200
#define D_é (2*ã/360) //Curve track slice is one degree.
#define D_S (2*ã*R/360) //Straight track slice is degree at 10000.
#define D_S (2*ã*RADIUS/360) //Straight track is degree at 10000.
#define DIPS 5
#define DIP_DEPTH 50
class Track
@@ -110,34 +110,34 @@ class Track
F64 é,d;
CD3I32 left[4],center[4],right[4];
} track_head,
*track_start[MP_MAX_PROCESSORS],*track_end[MP_MAX_PROCESSORS];
*track_start[MP_PROCESSORS_NUM],*track_end[MP_PROCESSORS_NUM];
CDC *track_map;
#define MAP_BITS 9
I64 t_minx,t_maxx,t_minz,t_maxz;
#define NUM_BUSHES 512
#define BUSHES_NUM 512
class Bush
{
CD3I32 p;
Bool sym,pad[3];
U8 *img;
} b[NUM_BUSHES];
} b[BUSHES_NUM];
#define NUM_CARS 8
#define CARS_NUM 8
class Car
{
CD3I32 p;
F64 é,dé,speed;
U8 *img;
Track *t;
} c[NUM_CARS];
} c[CARS_NUM];
I64 DipY(I64 x,I64 z)
{
F64 m,a;
R2P(&m,&a,x,z);
return DIP_DEPTH*m*Cos(DIPS*a)/R;
return DIP_DEPTH*m*Cos(DIPS*a)/RADIUS;
}
#define CAR_LENGTH 400
@@ -272,26 +272,26 @@ U0 InitTrack()
MemSet(&track_head,0,sizeof(Track));
QueInit(&track_head);
t_minx=t_minz=MAX_I64;
t_maxx=t_maxz=MIN_I64;
t_minx=t_minz=I64_MAX;
t_maxx=t_maxz=I64_MIN;
x=0; z=0; é=0;
for (d=0;d<6*R;d+=D_S)
for (d=0;d<6*RADIUS;d+=D_S)
TrackSlice(&x,&z,é,D_S);
for (i=0;i<180;i++,é+=D_é)
TrackSlice(&x,&z,é,D_é*R);
for (d=0;d<R;d+=D_S)
TrackSlice(&x,&z,é,D_é*RADIUS);
for (d=0;d<RADIUS;d+=D_S)
TrackSlice(&x,&z,é,D_S);
for (i=0;i<90;i++,é-=D_é)
TrackSlice(&x,&z,é,D_é*R);
TrackSlice(&x,&z,é,D_é*RADIUS);
for (i=0;i<180;i++,é+=D_é)
TrackSlice(&x,&z,é,D_é*R);
TrackSlice(&x,&z,é,D_é*RADIUS);
for (i=0;i<90;i++,é-=D_é)
TrackSlice(&x,&z,é,D_é*R);
for (d=0;d<R;d+=D_S)
TrackSlice(&x,&z,é,D_é*RADIUS);
for (d=0;d<RADIUS;d+=D_S)
TrackSlice(&x,&z,é,D_S);
for (i=0;i<180;i++,é+=D_é)
TrackSlice(&x,&z,é,D_é*R);
TrackSlice(&x,&z,é,D_é*RADIUS);
CoupleEnds;
@@ -378,7 +378,7 @@ U0 MPUpdateWin(CDC *dc2)
}
dc->flags|=DCF_TRANSFORMATION;
for (i=Gs->num;i<NUM_BUSHES;i+=mp_cnt) {
for (i=Gs->num;i<BUSHES_NUM;i+=mp_cnt) {
x=b[i].p.x-c[0].p.x; y=b[i].p.y-c[0].p.y; z=b[i].p.z-c[0].p.z;
Mat4x4MulXYZ(r,&x,&y,&z);
if (z>0) {
@@ -394,7 +394,7 @@ U0 MPUpdateWin(CDC *dc2)
dc->flags&=~(DCF_SYMMETRY|DCF_JUST_MIRROR);
}
}
for (i=Gs->num+1;i<NUM_CARS;i+=mp_cnt) {
for (i=Gs->num+1;i<CARS_NUM;i+=mp_cnt) {
tmpc=&c[i];
x=tmpc->p.x-c[0].p.x; y=tmpc->p.y-c[0].p.y; z=tmpc->p.z-c[0].p.z;
Mat4x4MulXYZ(r,&x,&y,&z);
@@ -474,7 +474,7 @@ U0 DrawIt(CTask *task,CDC *dc)
GrBlot(dc,w-track_map->width,h-track_map->height,track_map);
dc->pen_width=2;
for (i=0;i<NUM_CARS;i++) {
for (i=0;i<CARS_NUM;i++) {
if (i)
dc->color=LTPURPLE;
else
@@ -512,7 +512,7 @@ U0 AnimateTask(I64)
Snd(12.0*Log2(c[0].speed/500+0.7));
else
Snd;
for (i=0;i<NUM_CARS;i++) {
for (i=0;i<CARS_NUM;i++) {
tmpc=&c[i];
tmpc->p.x-=0.01*tmpc->speed*Cos(tmpc->é-ã/2);
tmpc->p.z+=0.01*tmpc->speed*Sin(tmpc->é-ã/2);
@@ -539,7 +539,7 @@ U0 AnimateTask(I64)
tmpc->p.y=DipY(tmpc->p.x,tmpc->p.z);
}
if (!game_over && on_track) {
for (i=1;i<NUM_CARS;i++)
for (i=1;i<CARS_NUM;i++)
if (D3I32DistSqr(&c[i].p,&c[0].p)<CAR_LENGTH>>1*CAR_LENGTH>>1) {
game_over=TRUE;
Noise(500,22,34);
@@ -572,7 +572,7 @@ U0 InitBushes()
I64 i,j,x,z;
track_map->color=LTGREEN;
track_map->pen_width=1;
for (i=0;i<NUM_BUSHES;i++) {
for (i=0;i<BUSHES_NUM;i++) {
tmpb=&b[i];
ib_restart:
@@ -602,7 +602,7 @@ U0 Init()
InitTrack;
InitBushes;
tmpt=track_head.next;
for (i=0;i<NUM_CARS;i++) {
for (i=0;i<CARS_NUM;i++) {
tmpc=&c[i];
tmpc->t=tmpt;
tmpc->p.x=tmpt->x;
@@ -617,7 +617,7 @@ U0 Init()
tmpc->img=$IB,"<6>",BI=6$;
tmpc->speed=2500.0;
}
d=(i+1)*track_head.last->d/NUM_CARS;
d=(i+1)*track_head.last->d/CARS_NUM;
while (tmpt->next!=&track_head && tmpt->d<d)
tmpt=tmpt->next;
}
+10 -10
View File
@@ -87,12 +87,12 @@ U8 *king_imgs[4]={$IB,"<2>",BI=2$,$IB,"<1>",BI=1$,$IB,"<2>",BI=2$,$IB,"<3>",BI=3
U8 *peasant_imgs[4]={$IB,"<5>",BI=5$,$IB,"<4>",BI=4$,$IB,"<5>",BI=5$,$IB,"<6>",BI=6$};
#define NUM_TREES 8
#define TREES_NUM 8
class Tree
{
U16 x,y;
I64 fire_frame_idx;
} trees[NUM_TREES];
} trees[TREES_NUM];
U64 snow_x,snow_y,new_snow_mS;
#define SNOW_TILE_SIZE 128
@@ -103,7 +103,7 @@ I64 king_x,king_y,king_mS,king_phase,
F64 king_timeout,king_é,t0,tf,door_open_t0;
I64 animate_mS,animate_phase;
#define NUM_PEASANTS 10
#define PEASANTS_NUM 10
class Peasant
{
Peasant *next,*last;
@@ -127,7 +127,7 @@ U0 DrawIt(CTask *task,CDC *dc)
F64 tt;
dc->pen_width=1;
for (i=0;i<NUM_TREES;i++) {
for (i=0;i<TREES_NUM;i++) {
if (trees[i].y<=h/2) {//Draw trees behind house
if (trees[i].fire_frame_idx) {
if (trees[i].fire_frame_idx++&1)
@@ -144,7 +144,7 @@ U0 DrawIt(CTask *task,CDC *dc)
if (tS<door_open_t0+1.0)
Sprite3(dc,w/2,h/2,0,$IB,"<11>",BI=11$);
for (i=0;i<NUM_TREES;i++) {
for (i=0;i<TREES_NUM;i++) {
if (trees[i].y>h/2) {//Draw trees in front of house
if (trees[i].fire_frame_idx) {
if (trees[i].fire_frame_idx++&1)
@@ -269,7 +269,7 @@ U0 Init()
snow_tile=DCNew(SNOW_TILE_SIZE,SNOW_TILE_SIZE);
SpriteExtents($IB,"<7>",BI=7$,&min_x,&max_x,&min_y,&max_y);
for (i=0;i<NUM_TREES;i++) {
for (i=0;i<TREES_NUM;i++) {
trees[i].x=RandU16%(w-2*BORDER-(max_x-min_x+1))+BORDER-min_x;
trees[i].y=RandU16%(h-2*BORDER-(max_y-min_y+1))+BORDER-min_y;
trees[i].fire_frame_idx=0;
@@ -280,7 +280,7 @@ U0 Init()
SpriteExtents($IB,"<12>",BI=12$,&min_x,&max_x,&min_y,&max_y);
QueInit(&peasant_head);
for (i=0;i<NUM_PEASANTS;i++) {
for (i=0;i<PEASANTS_NUM;i++) {
tmpp=MAlloc(sizeof(Peasant));
tmpp->x=RandU16%(w-2*BORDER-(max_x-min_x+1))+BORDER-min_x;
tmpp->y=RandU16%(h-2*BORDER-(max_y-min_y+1))+BORDER-min_y;
@@ -313,7 +313,7 @@ U0 CleanUp()
U0 Follow(CTask *,Peasant *tmpp)
{
Step *tmps=king_step_head.next;
F64 d,best_d=MAX_F64;
F64 d,best_d=F64_MAX;
while (tmps!=&king_step_head) {
if ((d=Sqr(tmps->x-tmpp->x)+Sqr(tmps->y-tmpp->y)) &&
d<15*15) {
@@ -369,7 +369,7 @@ U0 AnimateTask(I64)
tmpp->stopped=TRUE;
tmpp->door_opened_t0=door_open_t0=tS;
}
for (i=0;i<NUM_TREES;i++) //Hang-out by fire
for (i=0;i<TREES_NUM;i++) //Hang-out by fire
if (trees[i].fire_frame_idx &&
Sqr(tmpp->x-trees[i].x)+Sqr(tmpp->y-trees[i].y)<20*20) {
tmpp->stopped=TRUE;
@@ -429,7 +429,7 @@ U0 AnimateTask(I64)
U0 BurnTrees()
{
I64 i;
for (i=0;i<NUM_TREES;i++)
for (i=0;i<TREES_NUM;i++)
if (Sqr(king_x-trees[i].x)+Sqr(king_y-trees[i].y)<10*10)
trees[i].fire_frame_idx=1;
}
+13 -13
View File
@@ -1,13 +1,13 @@
#define NUM_BALLS 7
#define NUM_SPRINGS 3
#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[NUM_BALLS];
CSpring springs[NUM_SPRINGS];
CMass balls[BALLS_NUM];
CSpring springs[SPRINGS_NUM];
F64 collision_t;
U0 DrawIt(CTask *task,CDC *dc)
@@ -25,7 +25,7 @@ U0 DrawIt(CTask *task,CDC *dc)
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<NUM_SPRINGS;i++)
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);
@@ -35,7 +35,7 @@ U0 DrawIt(CTask *task,CDC *dc)
dc->color=BLACK;
GrCircle(dc,balls[0].x,balls[0].y,BALL_RADIUS);
for (i=1;i<NUM_BALLS;i++) {
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);
@@ -65,7 +65,7 @@ U0 MyDerivative(CMathODE *ode,F64 t,COrder2D3 *,COrder2D3 *)
D3AddEqu(&balls[0].DstateDt->DxDt,D3MulEqu(&p2,STRETCH));
D3Equ(&p2,task->pix_width>>1,task->pix_height>>1,0);
for (i=1;i<NUM_BALLS;i++) {
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.
@@ -74,8 +74,8 @@ U0 MyDerivative(CMathODE *ode,F64 t,COrder2D3 *,COrder2D3 *)
}
}
for (i=0;i<NUM_BALLS;i++)
for (j=i+1;j<NUM_BALLS;j++) {
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)) {
@@ -124,14 +124,14 @@ U0 Whap()
ode->drag_v2=0.002;
ode->drag_v3=0.00001;
ode->acceleration_limit=5e3;
MemSet(balls,0,NUM_BALLS*sizeof(CMass));
MemSet(balls,0,BALLS_NUM*sizeof(CMass));
D3Equ(&balls[0].x,100,100,0);
for (i=1;i<NUM_BALLS;i++)
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<NUM_BALLS;i++) {
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);
@@ -140,7 +140,7 @@ U0 Whap()
balls[2].y=balls[1].y;
balls[3].x=balls[1].x;
balls[3].y=balls[1].y+15;
MemSet(springs,0,NUM_SPRINGS*sizeof(CSpring));
MemSet(springs,0,SPRINGS_NUM*sizeof(CSpring));
springs[0].end1=&balls[1];
springs[0].end2=&balls[2];
springs[0].rest_len=15;
Binary file not shown.
+3 -3
View File
@@ -1,10 +1,10 @@
#define MAX_PTS 16
#define PTS_NUM 16
U0 BSplineDemo()
{
CDC *dc=DCAlias;
I64 arg1,arg2,i=0,msg_code;
CD3I32 c[MAX_PTS];
CD3I32 c[PTS_NUM];
SettingsPush;
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;
@@ -20,7 +20,7 @@ U0 BSplineDemo()
GrCircle(dc,arg1,arg2,10);
i++;
}
} while (i<MAX_PTS && msg_code!=MSG_MS_R_UP);
} while (i<PTS_NUM && msg_code!=MSG_MS_R_UP);
dc->color=RED;
Gr2BSpline(dc,c,i,TRUE);
dc->color=BLUE;
+2 -2
View File
@@ -10,8 +10,8 @@ U0 Init()
MemSet(y,0,sizeof(y));
for (i=0;i<16;i++) {
é=Rand*2*ã;
dx[i]=MAX_I32*Cos(é);
dy[i]=MAX_I32*Sin(é);
dx[i]=I32_MAX*Cos(é);
dy[i]=I32_MAX*Sin(é);
}
}
+13 -13
View File
@@ -1,10 +1,10 @@
#define NUM_DISKS 6
#define DISKS_NUM 6
#define PEDESTAL_HEIGHT 20
#define DISK_HEIGHT 7
#define DISK_UNIT_WIDTH 5
I64 poles_x[3];
I64 disks_x[NUM_DISKS],disks_y[NUM_DISKS],disks_pole[NUM_DISKS];
I64 disks_x[DISKS_NUM],disks_y[DISKS_NUM],disks_pole[DISKS_NUM];
I64 OtherPole(I64 pole1,I64 pole2)
{
@@ -14,7 +14,7 @@ I64 OtherPole(I64 pole1,I64 pole2)
I64 TopDisk(I64 pole)
{
I64 i;
for (i=0;i<NUM_DISKS;i++)
for (i=0;i<DISKS_NUM;i++)
if (disks_pole[i]==pole)
return i;
return -1;
@@ -23,7 +23,7 @@ I64 TopDisk(I64 pole)
I64 PosInStk(I64 pole,I64 disk)
{
I64 res=0,i;
for (i=NUM_DISKS-1;i>disk;i--)
for (i=DISKS_NUM-1;i>disk;i--)
if (disks_pole[i]==pole)
res++;
return res;
@@ -32,7 +32,7 @@ I64 PosInStk(I64 pole,I64 disk)
U0 SetDisksRestXY()
{
I64 i;
for (i=0;i<NUM_DISKS;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);
@@ -56,15 +56,15 @@ U0 DrawIt(CTask *task,CDC *dc)
for (i=0;i<3;i++) {
dc->color=BLACK;
GrRect(dc,poles_x[i]-3,
task->pix_height-PEDESTAL_HEIGHT-(NUM_DISKS+1)*(DISK_HEIGHT+1),
7,(NUM_DISKS+1)*(DISK_HEIGHT+1));
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-(NUM_DISKS+1)*(DISK_HEIGHT+1),
5,(NUM_DISKS+1)*(DISK_HEIGHT+1)-1);
task->pix_height-PEDESTAL_HEIGHT+1-(DISKS_NUM+1)*(DISK_HEIGHT+1),
5,(DISKS_NUM+1)*(DISK_HEIGHT+1)-1);
}
for (i=0;i<NUM_DISKS;i++) {
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);
@@ -92,7 +92,7 @@ U0 MoveDisks(I64 src_pole,I64 dst_pole,I64 num)
top=TopDisk(src_pole);
for (y=disks_y[top];
y>Fs->pix_height-PEDESTAL_HEIGHT-(DISK_HEIGHT+1)/2
-(DISK_HEIGHT+1)*(NUM_DISKS+2);y--) {
-(DISK_HEIGHT+1)*(DISKS_NUM+2);y--) {
disks_y[top]=y;
MySleep;
}
@@ -125,7 +125,7 @@ U0 Init()
for (i=0;i<3;i++)
poles_x[i]=(1+i)*Fs->pix_width/4;
for (i=0;i<NUM_DISKS;i++)
for (i=0;i<DISKS_NUM;i++)
disks_pole[i]=0;
SetDisksRestXY;
@@ -140,7 +140,7 @@ U0 Hanoi()
Sleep(1000);
try {
MoveDisks(0,2,NUM_DISKS);
MoveDisks(0,2,DISKS_NUM);
Beep; Beep;
DocClear;
DocBottom;
+3 -3
View File
@@ -2,13 +2,13 @@ U0 PaletteDemo()
{
I64 i,j;
CBGR48 bgr;
for (i=0;i<NUM_COLORS;i++)
for (i=0;i<COLORS_NUM;i++)
"$$BLACK$$$$BG,%d$$__%-8Z__$$FG$$$$BG$$\n",i,i,"ST_COLORS";
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
//Alternatively, use $LK,"GrPaletteSet",A="MN:GrPaletteSet"$(gr_palette_gray);
for (i=0;i<NUM_COLORS;i++) {
j=0xFFFF*i/(NUM_COLORS-1);
for (i=0;i<COLORS_NUM;i++) {
j=0xFFFF*i/(COLORS_NUM-1);
bgr.b=j;
bgr.g=j;
bgr.r=j;
Binary file not shown.
Binary file not shown.
+13 -13
View File
@@ -1,23 +1,23 @@
#define NUM_ZEROS 2
Complex zeros[NUM_ZEROS]={{10.0,0},{-30,0}};
#define NUM_POLES 2
Complex poles[NUM_POLES]={{-20.0,-15.0},{-20.0,15.0}};
#define ZEROS_NUM 2
Complex zeros[ZEROS_NUM]={{10.0,0},{-30,0}};
#define POLES_NUM 2
Complex poles[POLES_NUM]={{-20.0,-15.0},{-20.0,15.0}};
F64 scale;
Complex *PoleZeroFind(I64 x,I64 y)
{
I64 i;
F64 dd,best_dd=MAX_F64;
F64 dd,best_dd=F64_MAX;
Complex *res=NULL;
for (i=0;i<NUM_POLES;i++) {
for (i=0;i<POLES_NUM;i++) {
dd=Sqr(poles[i].x-x)+Sqr(poles[i].y-y);
if (dd<best_dd) {
best_dd=dd;
res=&poles[i];
}
}
for (i=0;i<NUM_ZEROS;i++) {
for (i=0;i<ZEROS_NUM;i++) {
dd=Sqr(zeros[i].x-x)+Sqr(zeros[i].y-y);
if (dd<best_dd) {
best_dd=dd;
@@ -32,8 +32,8 @@ F64 F(Complex *x)
F64 m,a;
Complex num,denom,n1;
CPoly(&num, NUM_ZEROS,zeros,x);
CPoly(&denom,NUM_POLES,poles,x);
CPoly(&num, ZEROS_NUM,zeros,x);
CPoly(&denom,POLES_NUM,poles,x);
CDiv(&n1,&num,&denom);
R2P(&m,&a,n1.x,n1.y);
@@ -65,8 +65,8 @@ F64 MPDraw(CTask *task)
U0 Draw()
{
CJob *tmpm[MP_MAX_PROCESSORS];
F64 y_total,old_y_total=MAX_F64;
CJob *tmpm[MP_PROCESSORS_NUM];
F64 y_total,old_y_total=F64_MAX;
I64 i,w=Fs->pix_width,h=Fs->pix_height,cx=w/2,cy=h/2;
CDC *dc=DCAlias;
while (TRUE) {
@@ -85,9 +85,9 @@ U0 Draw()
dc->color=15;
GrLine(dc,0,cy,w,cy);
GrLine(dc,cx,0,cx,h);
for (i=0;i<NUM_ZEROS;i++)
for (i=0;i<ZEROS_NUM;i++)
GrPrint(dc,cx+zeros[i].x-FONT_WIDTH/2,cy-zeros[i].y-FONT_HEIGHT/2,"o");
for (i=0;i<NUM_POLES;i++)
for (i=0;i<POLES_NUM;i++)
GrPrint(dc,cx+poles[i].x-FONT_WIDTH/2,cy-poles[i].y-FONT_HEIGHT/2,"x");
DCDel(dc);
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -225,4 +225,4 @@
#define IC_LIMIT_I64 0xBF
#define IC_LIMIT_U64 0xC0
#define IC_NUM_ENTRIES 0xC5
#define IC_ICS_NUM 0xC5
+16 -16
View File
@@ -12,7 +12,7 @@ I64 MPSum(I64 my_mp_cnt)
I64 Sum(I64 n,I64 my_mp_cnt)
{
CJob *tmpm[MP_MAX_PROCESSORS];
CJob *tmpm[MP_PROCESSORS_NUM];
I64 res=0,i;
mp_n=n+1;
for (i=0;i<my_mp_cnt;i++)
@@ -37,21 +37,21 @@ F64 Test(I64 n,I64 my_mp_cnt)
return end-start;
}
#define MIN_VAL 1000
#define MIN_TEST 3
#define MAX_TEST 7
#define NUM_TESTS (MAX_TEST-MIN_TEST+1)
#define MAX_PERCENT 200
#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[NUM_TESTS];
F64 t1,t2,ress[TESTS_NUM];
CDC *dc=DCAlias;
for (i=0,n=MIN_VAL;i<NUM_TESTS;i++,n*=10) {
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;
@@ -62,19 +62,19 @@ U0 MPAdd()
DocClear;
dc->color=BLUE;
for (i=MAX_PERCENT/10;i<MAX_PERCENT;i+=MAX_PERCENT/10) {
GrPrint(dc,0,v-ToF64(i)/MAX_PERCENT*v-FONT_HEIGHT,"%3d%%",i);
GrLine(dc,0,v-ToF64(i)/MAX_PERCENT*v,h,v-ToF64(i)/MAX_PERCENT*v);
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<NUM_TESTS-1;i++) {
for (i=0;i<TESTS_NUM-1;i++) {
dc->color=RED;
dc->pen_width=2;
GrLine3(dc,i*h/(NUM_TESTS-1), v-ress[i ]/MAX_PERCENT*v,0,
(i+1)*h/(NUM_TESTS-1),v-ress[i+1]/MAX_PERCENT*v,0);
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/(NUM_TESTS-1),v-FONT_HEIGHT,"10e%d",i+MIN_TEST);
GrLine(dc,i*h/(NUM_TESTS-1),0,i*h/(NUM_TESTS-1),v);
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;
+12
View File
@@ -0,0 +1,12 @@
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 $LK,"AOnce",A="MN:AOnce"$().
+5 -5
View File
@@ -16,16 +16,16 @@ U0 RandDemo()
{
I64 i;
"Seed(0) will do timer randomized random numbers. A task starts with "
"$LK,"Seed(0)",A="FF:::/Kernel/KTask.HC,Seed("$ by dft.\n";
"Seed(0) will do timer XORed random numbers. "
"A task starts with $LK,"Seed(0)",A="FF:::/Kernel/KTask.HC,Seed("$ by dft.\n";
PressAKey;
Seed;
RandPts;
DCFill;
"\nSeed(num) will do non-timer starting at specific seed. "
"Non-timer rand is awful. You can run a specific video game by "
"typing Seed(num) at the cmd line before the game.\n";
"\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;
+2 -2
View File
@@ -16,9 +16,9 @@ $TX,"Source Code By Sym",HTML="http://www.templeos.org/Wb/Home/Web/SymsAlpha.htm
$LK,"TempleOS Credits",A="FI:::/Doc/Credits.DD"$ $LK,"History of TempleOS",A="FI:~/Web/History.DD"$
$LK,"Why 640x480?",A="FI:::/Home/Web/640x480.DD"$ $LK,"Dianna Cowern",A="FI:~/Web/DLC/DLC.DD"$
$LK,"Why 640x480?",A="FI:~/Web/640x480.DD"$ $LK,"Dianna Cowern",A="FI:~/Web/DLC/DLC.DD"$
$FG$
$LK,"Change Log",A="FI:::/Doc/ChangeLog.DD"$ $LK,"Terry Davis",A="FI:~/Web/TAD/TAD.DD"$
$LK,"Change Log",A="FI:::/Doc/ChgLog.DD"$ $LK,"Terry Davis",A="FI:~/Web/TAD/TAD.DD"$
The Brits are moving to $TX,"ban \"hacking tools\"",HTML="http://www.theregister.co.uk/2008/01/02/hacker_toll_ban_guidance"$. Take my $LK,"unassembler",A="MN:Ui"$ from my cold dead hands. NRA is for guns; IRA is for computers.
+2 -2
View File
@@ -14,9 +14,9 @@ TempleOS distribution.
You can pass html meta data as args to $LK,"ToHtml",A="FF:::/Demo/ToHtmlToTXTDemo/ToHtml.HC,ToHtml"$().
If you want to blog like I do, see these files...
$LK,"::/Demo/AcctExample/TOSToHtml.HC"$
$LK,"::/Demo/AcctExample/TOS/TOSToHtml.HC"$
$LK,"::/Demo/AcctExample/HomeKeyPlugIns.HC"$
$LK,"::/Demo/AcctExample/TOSHolySpirit.HC"$
$LK,"::/Demo/AcctExample/TOS/TOSHolySpirit.HC"$
*/
Cd(__DIR__);;
+3 -3
View File
@@ -157,10 +157,10 @@ public CDoc *Doc2Html(CDoc *doc_in,U8 *html_header=NULL,U8 *body_header=NULL,
U8 (*link_cvt)(U8 *link_st)=&TOSLinkCvt1,Bool line_nums=FALSE)
{//Cvt $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.DD"$doc to HTML file.
CDocEntry *doc_e,*style,*doc_e2;
I64 i,y,old_y=MIN_I64,col,old_u32_attr=DOCET_UNDEF_COLOR,old_attr,digits;
I64 i,y,old_y=I64_MIN,col,old_u32_attr=DOCET_UNDEF_COLOR,old_attr,digits;
U32 *hl,*src;
U8 *st,st_2[2],*link_st,*style_bitmap=CAlloc(256/8);
CBGR48 p[NUM_COLORS];
CBGR48 p[COLORS_NUM];
GrPaletteGet(p);
CDoc *doc_out=DocNew;
Bool unlock_doc_in=DocLock(doc_in),no_bwd;
@@ -184,7 +184,7 @@ public CDoc *Doc2Html(CDoc *doc_in,U8 *html_header=NULL,U8 *body_header=NULL,
"<head>\n"
"<meta http-equiv=\"Content-Type\" "
"content=\"text/html;charset=US-ASCII\">\n"
"<meta name=\"generator\" content=\"$TX,"TempleOS V5.00",D="DD_OS_NAME_VERSION"$\">\n";
"<meta name=\"generator\" content=\"$TX,"TempleOS V5.01",D="DD_OS_NAME_VERSION"$\">\n";
if (!body_header) body_header=
"<body>\n"
"<pre style=\"font-family:courier;font-size:10pt\">\n";
+6 -6
View File
@@ -7,7 +7,7 @@
#define DOWNLOAD_FILE4 "TempleOSUltraRS.ISO"
#define DOWNLOAD_FILE4_SIZE 1600000
#define MAX_HOURS (24*3)
#define HOURS_MAX (24*3)
class LogStruct
{
@@ -383,8 +383,8 @@ U0 DownLoadRep(LogStruct *head,CDate start,CDate end)
"\n\nDownloads of /TempleOSCD.ISO\n"
"'-' is a dup. '+' is not a dup.\n";
if (hours_end-hours_start>=MAX_HOURS)
i=hours_end-MAX_HOURS+1;
if (hours_end-hours_start>=HOURS_MAX)
i=hours_end-HOURS_MAX+1;
else
i=hours_start;
for (;i<=hours_end;i++) {
@@ -467,8 +467,8 @@ U0 IndexRep(LogStruct *head,CDate start,CDate end)
day_cnts[(i+local_time_offset)>>32-days_start];
"\n\nHits on /index.html\n";
if (hours_end-hours_start>=MAX_HOURS)
i=hours_end-MAX_HOURS+1;
if (hours_end-hours_start>=HOURS_MAX)
i=hours_end-HOURS_MAX+1;
else
i=hours_start;
for (;i<=hours_end;i++) {
@@ -496,7 +496,7 @@ U0 IndexRep(LogStruct *head,CDate start,CDate end)
U0 WebLogRep(U8 *mask,U8 *output_filename)
{
LogStruct *head;
CDate start=MAX_I64,end=MIN_I64;
CDate start=I64_MAX,end=I64_MIN;
DocMax;
+16 -16
View File
@@ -3,25 +3,25 @@
//See ::/Apps/Vocabulary/VocabQuiz.HC.Z
//for another example of dictionary usage.
#define NUM_ROWS 20
#define NUM_COLS 20
#define MAX_DIMENSION MaxI64(NUM_ROWS,NUM_COLS)
#define ROWS_NUM 20
#define COLS_NUM 20
#define DIM_MAX MaxI64(ROWS_NUM,COLS_NUM)
U8 m[NUM_ROWS][NUM_COLS];
U8 m[ROWS_NUM][COLS_NUM];
U0 Init()
{
I64 x,y;
for (y=0;y<NUM_ROWS;y++)
for (x=0;x<NUM_COLS;x++)
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<NUM_ROWS;y++) {
for (x=0;x<NUM_COLS;x++)
for (y=0;y<ROWS_NUM;y++) {
for (x=0;x<COLS_NUM;x++)
'' m[y][x];
'\n';
}
@@ -29,7 +29,7 @@ U0 Display()
U0 GetWord(U8 *dst,I64 x,I64 y,I64 dx,I64 dy)
{
while (0<=x<NUM_COLS && 0<=y<NUM_ROWS) {
while (0<=x<COLS_NUM && 0<=y<ROWS_NUM) {
*dst++=m[y][x];
y+=dy;
x+=dx;
@@ -41,9 +41,9 @@ U0 GetWord(U8 *dst,I64 x,I64 y,I64 dx,I64 dy)
U0 Search(I64 dx,I64 dy)
{
I64 x,y,i,n;
U8 buf[MAX_DIMENSION+1],*ptr;
for (y=0;y<NUM_ROWS;y++)
for (x=0;x<NUM_COLS;x++) {
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--) {
@@ -70,14 +70,14 @@ U0 SimpleWordSearch()
}
//************************************
U8 words[NUM_ROWS*NUM_COLS*8][MAX_DIMENSION+1];
U8 *word_ptrs[NUM_ROWS*NUM_COLS*8];
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<NUM_ROWS;y++)
for (x=0;x<NUM_COLS;x++) {
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++;