Files
TempleOS-Rijn/Demo/AcctExample/TOSDistro.HC
T
2018-09-08 21:48:03 +02:00

482 lines
12 KiB
HolyC

//The CFG defines are $LK,"~/TOSCfg.HC",A="FI:::/Demo/AcctExample/TOSCfg.HC"$.
#help_index "TOS"
U8 TOSGetDrv()
{
I64 res;
"Drive (%s):",TOS_HDS;
res=ToUpper(GetChar);
'\n';
return res;
}
U0 TOSBootHDIns(U8 drv_let)
{
drv_let=ToUpper(drv_let);
In(TOS_CFG);
BootHDIns(drv_let);
if (StrOcc(TOS_MASTER_BOOT_DRVS,drv_let))
BootMHDIns(drv_let);
}
U0 TOSCopyDrv(U8 src,U8 dst)
{
U8 buf_s[STR_LEN],buf_d[STR_LEN];
src=ToUpper(src);
dst=ToUpper(dst);
Fmt(dst,,FALSE,FSt_FAT32);
StrPrint(buf_s,"%c:/",src);
StrPrint(buf_d,"%c:/",dst);
CopyTree(buf_s,buf_d);
DocClear;
Drv(dst);
TOSBootHDIns(dst);
}
U0 TOSPromptAndCopyDrv()
{
I64 src,dst;
"$$RED$$\nCopy Src Drive:\n$$FG$$";
src=TOSGetDrv;
"$$RED$$\nCopy Dst Drive:\n$$FG$$";
dst=TOSGetDrv;
TOSCopyDrv(src,dst);
}
public U0 CopySongs(U8 threshold='7')
{
CDoc *doc;
CDocEntry *doc_e;
CDirEntry *tmpde=FilesFind("/Home/Sup1/Sup1Psalmody/*.HC*",
FUF_CLUSTER_ORDER),*tmpde1=tmpde;
DelTree("/Apps/Psalmody/Examples");
MkDir("/Apps/Psalmody/Examples");
while (tmpde) {
doc=DocRead(tmpde->full_name);
doc_e=doc->head.next;
if (doc_e->type_u8==DOCT_TEXT && doc_e->tag[2]>=threshold)
Copy(tmpde->full_name,"/Apps/Psalmody/Examples");
DocDel(doc);
tmpde=tmpde->next;
}
DirTreeDel(tmpde1);
}
U0 DistroPrep()
{
Del("/Home/Demo*");
DelTree("/Home/*Tmp.DD.Z");
if (FileFind("/Home/Sup1/Sup1Psalmody"))
CopySongs;
DelTree("/Tmp");
MkDir("/Tmp");
MkDir("/Tmp/ScrnShots");
Touch("/PersonalMenu.DD.Z","+T");
Touch("/Home/PersonalMenu.DD.Z","+T");
DelTree("/Demo/AcctExample");
CopyTree("/Home","/Demo/AcctExample");
DelTree("/Demo/AcctExample/Budget");
DelTree("/Demo/AcctExample/Private");
DelTree("/Demo/AcctExample/Sup1");
DelTree("/Demo/AcctExample/Web");
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("/Home/Sup1/Sup1Blog/YouTube.DD.Z"))
Sort("/Home/Sup1/Sup1Blog/YouTube.DD.Z",,2);
//Once in a while, do $LK,"~/Sup1/Sup1Utils/DblSpaceScan.HC"$.
CursorRem("/*");
DelTree("/Demo/*.BI*");
S2T("/*","+r+S");
DocOpt("/*","+R");
Move(ACD_DEF_FILENAME,ACD_DEF_FILENAME_Z);
}
U0 MakeBootRescueDrvFile()
{
CBlkDev *bd;
if (!Let2Drv('A',FALSE)) {
In(CFG_BOOT_RESCUE_DRV "\n");
Mount;
}
bd=Let2BlkDev('A');
Fmt('A',,FALSE,FSt_REDSEA);
MkDir("A:/Compiler");
Copy("C:/Compiler/Compiler.BIN.Z", "A:/Compiler");
Copy("C:/Compiler/OpCodes.DD.Z", "A:/Compiler");
Copy("C:/Compiler/CompilerA.HH.Z", "A:/Compiler");
Copy("C:/Compiler/CompilerB.HH.Z", "A:/Compiler");
MkDir("A:/Kernel");
Copy("C:/Kernel/*.HH*", "A:/Kernel");
CopyTree("C:/Kernel/BlkDev", "A:/Kernel/BlkDev");
Copy("C:/Home/Sup1/Sup1Distro/DbgStartOS.HC.Z","A:/StartOS.HC.Z");
MkDir("A:/Adam");
Copy("C:/Home/Sup1/Sup1Distro/DbgMakeAdam.HC.Z","A:/Adam/MakeAdam.HC.Z");
Copy("C:/Home/Sup1/Sup1Distro/DbgMount.HC.Z","A:/Adam");
Copy("C:/Adam/AExts.HC.Z", "A:/Adam");
Copy("C:/Adam/AMath.HC.Z", "A:/Adam");
Copy("C:/Adam/Training.HC.Z","A:/Adam");
Copy("C:/Adam/AMem.HC.Z", "A:/Adam");
Copy("C:/Adam/TaskRep.HC.Z", "A:/Adam");
Copy("C:/Adam/AMathODE.HC.Z","A:/Adam");
FileWrite("C:" CFG_BOOT_RESCUE_DRV_FILE,
bd->RAM_dsk,(bd->max_blk+1)<<BLK_SIZE_BITS);
}
U0 MakeSymFiles()
{
CDoc *doc;
U8 *st;
DocClear;
DocMax;
HashTablePurge(adam_task->hash_table);
Who;
if (doc=DocPut) {
st=StrNew(doc->filename.name);
StrCpy(doc->filename.name,"D:/Wb/Home/Web/SymsAlpha.DD.Z");
DocWrite(doc);
StrCpy(doc->filename.name,st);
Free(st);
}
DocClear;
DocMax;
Who("+m");
if (doc=DocPut) {
st=StrNew(doc->filename.name);
StrCpy(doc->filename.name,"D:/Wb/Home/Web/SymsAddress.DD.Z");
DocWrite(doc);
StrCpy(doc->filename.name,st);
Free(st);
}
DocClear;
}
I64 MakeLineRepFile()
{
U8 *st;
CDoc *doc;
I64 res,official;
CDocEntry *tree_branch,*start_indent,*end_indent;
DocClear;
Drv('C');
DistroPrep;
Cd("C:/");
DelTree("B:/TOS");
CopyTree("C:/Home","B:/TOS");
DelTree("C:/Home");
DocMax;
DocClear;
res=LineRep;
if (doc=DocPut) {
st=StrNew(doc->filename.name);
StrCpy(doc->filename.name,"B:/TOS/Web/LineRep.DD.Z");
DocWrite(doc);
StrCpy(doc->filename.name,st);
Free(st);
}
DocClear;
official=LineRep("C:/*","-r")+
LineRep("C:/Adam/*")+
LineRep("C:/Compiler/*","-S+$$")+
LineRep("C:/Kernel/*");
DocClear;
CopyTree("B:/TOS","C:/Home");
DelTree("B:/TOS");
doc=DocRead("C:/Adam/ADefine.HC.Z");
DocTreeFind(doc,"LineRep",&tree_branch,&start_indent,&end_indent);
DocCut(doc,start_indent->next,end_indent->last);
doc->cur_entry=start_indent->next;
doc->cur_col=0;
DocPrint(doc,"DefinePrint(\"DD_TEMPLEOS_LOC\",\"%,d\");\n",res);
DocPrint(doc,"DefinePrint(\"DD_TEMPLEOS_LOC_OFFICIAL\",\"%,d\");\n",official);
DocWrite(doc);
DocDel(doc);
DefinePrint("DD_TEMPLEOS_LOC","%,d",res);
DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","%,d",official);
"Total LOC:%12,d\n\n",res;
return res;
}
U0 StaffDistroPrep()
{
Drv('C');
DistroPrep;
In(TOS_DVD_CFG);
BootDVDIns('C');
Fmt('B',,FALSE,FSt_REDSEA);
DelTree(TOS_DISTRO_DIR);
CopyTree("C:/",TOS_DISTRO_DIR "/");
Del(TOS_DISTRO_DIR "/" KERNEL_BIN_C);
}
U0 MakeStaffDistro()
{
StaffDistroPrep;
ISO9660ISO(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOSSTAFF_SIZE",
"Download $TX,"TempleOS V4.13",D="DD_OS_NAME_VERSION"$ - T.S. Company Internal Distro (%0.1fMB)",
0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
Drv('C');
}
U0 DbgDistroPrep()
{
Drv('C');
DistroPrep;
MakeBootRescueDrvFile;
In(TOS_DVD_DBG_CFG);
BootDVDIns('C');
Fmt('B',,FALSE,FSt_REDSEA);
DelTree(TOS_DISTRO_DIR);
CopyTree("C:/",TOS_DISTRO_DIR "/");
DelTree(TOS_DISTRO_DIR "/Home");
MkDir(TOS_DISTRO_DIR "/Home");
CopyTree("C:/Home/Sup1",TOS_DISTRO_DIR "/Home/Sup1");
Del(TOS_DISTRO_DIR "/" KERNEL_BIN_C);
Del(TOS_DISTRO_DIR BOOT_DIR "/OldMBR.BIN.C");
Del(TOS_DISTRO_DIR BOOT_DIR "/BootMHD2.BIN.C");
}
U0 MakeDbgDistro()
{
DbgDistroPrep;
ISO9660ISO(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOSDBG_SIZE",
"Download $TX,"TempleOS V4.13",D="DD_OS_NAME_VERSION"$ - Debug Distro (%0.1fMB)",
0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
Drv('C');
}
U0 StdDistroPrep()
{
Drv('C');
DistroPrep;
In(STD_DISTRO_DVD_CFG);
BootDVDIns('C');
Fmt('B',,FALSE,FSt_REDSEA);
DelTree(TOS_DISTRO_DIR);
CopyTree("C:/",TOS_DISTRO_DIR "/");
DelTree(TOS_DISTRO_DIR "/Home");
MkDir(TOS_DISTRO_DIR "/Home");
Del(TOS_DISTRO_DIR "/" KERNEL_BIN_C);
Del(TOS_DISTRO_DIR BOOT_DIR "/OldMBR.BIN.C");
Del(TOS_DISTRO_DIR BOOT_DIR "/BootMHD2.BIN.C");
}
U0 MakeStdDistro()
{
StdDistroPrep;
ISO9660ISO(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOSCD_SIZE",
"Download $TX,"TempleOS V4.13",D="DD_OS_NAME_VERSION"$ - Standard Distro (%0.1fMB)",
0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
Drv('C');
}
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 V4.13",D="DD_OS_NAME_VERSION"$ - Standard RedSea Distro (%0.1fMB)",
0.1*(10*Size(TOS_ISO_C_NAME,"+s")/1024/1024));
Drv('C');
}
U0 UltraDistroPrep()
{
StdDistroPrep;
DelTree(TOS_DISTRO_DIR "/Linux");
Del(TOS_DISTRO_DIR "/" KERNEL_BIN_C);
Del(TOS_DISTRO_DIR "/Adam/AutoComplete/ACDefs.DATA*");
Del(TOS_DISTRO_DIR "/Misc/PCIDevices.DD.Z");
Del(TOS_DISTRO_DIR "/Misc/Bible.TXT.Z");
DelTree(TOS_DISTRO_DIR "/Apps");
MkDir(TOS_DISTRO_DIR "/Apps");
DelTree(TOS_DISTRO_DIR "/Demo");
DelTree(TOS_DISTRO_DIR "/Misc/Tour");
Del(TOS_DISTRO_DIR "/" KERNEL_BIN_C);
Del(TOS_DISTRO_DIR "/Adam/AutoComplete/ACWords.DATA*");
Del(TOS_DISTRO_DIR "/Adam/God/Vocab.DD.Z");
Del(TOS_DISTRO_DIR "/Misc/OSTestSuite.HC.Z");
Copy("C:/Home/Sup1/Sup1Distro/UltraMenu.DD.Z",
TOS_DISTRO_DIR "/PersonalMenu.DD.Z");
Copy("C:/Demo/Games/Talons.HC.Z",
TOS_DISTRO_DIR "/Misc");
}
U0 MakeUltraDistro()
{
UltraDistroPrep;
ISO9660ISO(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOSULTRA_SIZE",
"Download $TX,"TempleOS V4.13",D="DD_OS_NAME_VERSION"$ - UltraSmall Distro (%0.2fMB)",
0.01*(100*Size(TOS_ISO_NAME,"+s")/1024/1024));
Drv('C');
}
U0 MakeUltraRedSeaDistro()
{
UltraDistroPrep;
RedSeaISO(TOS_ISO_C_NAME,TOS_DISTRO_DIR,TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOSULTRA_RS_SIZE",
"Download $TX,"TempleOS V4.13",D="DD_OS_NAME_VERSION"$ - UltraSmall RedSea Distro (%0.2fMB)",
0.01*(100*Size(TOS_ISO_C_NAME,"+s")/1024/1024));
Drv('C');
}
U0 MakeSup1ISO()
{
RedSeaISO(TOS_ISO_C_NAME,"~/Sup1");
DefinePrint("DD_TEMPLEOS_SUP1_SIZE","Supplemental ISO #1 (%0.2fMB)",
0.01*(100*Size(TOS_ISO_C_NAME,"+s")/1024/1024));
Drv('C');
}
U0 UpdateISODocDefines()
{
try {
DefinePrint("DD_TEMPLEOSCD_SIZE",
"Download $TX,"TempleOS V4.13",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);
// DefinePrint("DD_TEMPLEOSCD_RS_SIZE",
// "Download $TX,"TempleOS V4.13",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);
DefinePrint("DD_TEMPLEOSULTRA_SIZE",
"Download $TX,"TempleOS V4.13",D="DD_OS_NAME_VERSION"$ - UltraSmall Distro (%0.2fMB)",
0.01*(100*Size("D:/Wb/TempleOSUltra.ISO","+s")/1024/1024));
DefinePrint("DD_TEMPLEOSULTRA_K_SIZE",
"%dKB",Size("D:/Wb/TempleOSUltra.ISO","+s")/1024);
// DefinePrint("DD_TEMPLEOSULTRA_RS_SIZE",
// "Download $TX,"TempleOS V4.13",D="DD_OS_NAME_VERSION"$ - UltraSmall RedSea Distro (%0.2fMB)",
// 0.01*(100*Size("D:/Wb/TempleOSUltraRS.ISO","+s")/1024/1024));
// DefinePrint("DD_TEMPLEOSULTRA_RS_K_SIZE",
// "%dKB",Size("D:/Wb/TempleOSUltraRS.ISO","+s")/1024);
// DefinePrint("DD_TEMPLEOSDBG_SIZE",
// "Download $TX,"TempleOS V4.13",D="DD_OS_NAME_VERSION"$ - Debug Distro (%0.2fMB)",
// 0.01*(100*Size("D:/Wb/TempleOSDbg.ISO","+s")/1024/1024));
// DefinePrint("DD_TEMPLEOSDBG_K_SIZE",
// "%dKB",Size("D:/Wb/TempleOSDbg.ISO","+s")/1024);
DefinePrint("DD_TEMPLEOS_SUP1_SIZE","Supplemental ISO #1 (%0.2fMB)",
0.01*(100*Size("D:/Wb/TempleOSSup1.ISO","+s")/1024/1024));
DefinePrint("DD_TEMPLEOS_SUP1_K_SIZE",
"%dKB",Size("D:/Wb/TempleOSSup1.ISO","+s")/1024);
} catch
Fs->catch_except=TRUE;
}
UpdateISODocDefines;
public U0 MakeDistrosAndBackUp()
{
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
progress4=*progress4_desc=0;
progress4_max=18;
progress4_t0=tS;
AutoComplete;
WinBorder;
WinMax;
ChkAll; progress4++;
MakeLineRepFile; progress4++;
TOSCopyDrv('C','D'); progress4++;
DelTree ("D:/Wb"); progress4++;
CopyTree("C:/","D:/Wb"); progress4++;
DocClear;
MakeStdDistro; progress4++;
DocClear;
Move(TOS_ISO_NAME,"D:/Wb/TempleOSCD.ISO"); progress4++;
// MakeStdRedSeaDistro; progress4++;
// DocClear;
// Move(TOS_ISO_C_NAME,"D:/Wb/TempleOSCDRS.ISO"); progress4++;
MakeUltraDistro; progress4++;
DocClear;
Move(TOS_ISO_NAME,"D:/Wb/TempleOSUltra.ISO"); progress4++;
// MakeUltraRedSeaDistro; progress4++;
// DocClear;
// Move(TOS_ISO_C_NAME,"D:/Wb/TempleOSUltraRS.ISO"); progress4++;
MakeSup1ISO; progress4++;
DocClear;
Move(TOS_ISO_C_NAME,"D:/Wb/TempleOSSup1.ISO"); progress4++;
// MakeDbgDistro; progress4++;
// DocClear;
// Move(TOS_ISO_NAME,"D:/Wb/TempleOSDbg.ISO"); progress4++;
MakeStaffDistro; progress4++;
DocClear;
Move(TOS_ISO_NAME,"D:/Wb/TempleOSStaff.ISO"); progress4++;
UpdateISODocDefines;
Cd("C:/");
DocClear;
"$$PURPLE$$Lines longer than 80 columns:$$FG$$\n";
if (LongLines)
throw;
progress4++;
DocClear;
"$$PURPLE$$Broken DolDoc Links:$$FG$$\n";
if (LinkChk)
throw;
progress4++;
DocClear;
MakeSymFiles; progress4++;
DocClear;
MakeWebSite; progress4++;
Drv('C');
ChkAll; progress4++;
SettingsPop;
"Elapsed Time:%5.3f\n",tS-progress4_t0;
ProgressBarsRst;
}
public U0 PreBackUp()
{
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");
}