TempleOSCDV4.03.ISO
This commit is contained in:
1 parent
1541d7328d
commit
0f1a4a5d65
115 files changed
+5618
-4863
No files matched your search
@@ -295,13 +295,13 @@ Bool MyPutKey(I64 ch,I64 sc)
|
||||
return TRUE;
|
||||
case '9':
|
||||
if (sc&SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /---->");
|
||||
KeyDescSet("Dol /Indent 5");
|
||||
else
|
||||
"$$ID,5$$";
|
||||
return TRUE;
|
||||
case '0':
|
||||
if (sc&SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /<----");
|
||||
KeyDescSet("Dol /Unindent 5");
|
||||
else
|
||||
"$$ID,-5$$";
|
||||
return TRUE;
|
||||
@@ -319,7 +319,7 @@ Bool MyPutKey(I64 ch,I64 sc)
|
||||
return TRUE;
|
||||
case 'p':
|
||||
if (sc&SCF_KEY_DESC)
|
||||
KeyDescSet("Cmd /JukeBox(TAD)");
|
||||
KeyDescSet("Cmd /JukeBox(Home/Downloads)");
|
||||
else
|
||||
JukeBox("::/Home/Downloads/Psalmody");
|
||||
return TRUE;
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
Cd("::/Home");;
|
||||
#include "::/Home/TOSCfg"
|
||||
#include "::/Home/TOSMisc"
|
||||
#include "::/Home/TOSToHtml"
|
||||
#include "::/Home/TOSDistro"
|
||||
#include "::/Home/TOSBlog"
|
||||
#include "::/Home/TOSHolySpirit"
|
||||
Cd("::/Home");;
|
||||
@@ -9,7 +9,7 @@ U0 UserStartUp()
|
||||
WinToTop;
|
||||
WinZBufUpdate;
|
||||
Dir;
|
||||
"$TX,"80,916",D="DD_TEMPLEOS_LOC_OFFICIAL"$LOC:";
|
||||
"$TX,"81,095",D="DD_TEMPLEOS_LOC_OFFICIAL"$LOC:";
|
||||
CPURep;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@@ -4,8 +4,6 @@ $WW,1$$FG,5$$TX+CX,"TODO"$$FG$
|
||||
|
||||
* 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.
|
||||
|
||||
* In <CTRL-r> menu, transform individual elements.
|
||||
|
||||
* $LK,"SpriteEd",A="FI:::/Adam/Gr/SpriteEd.CPP"$ shift pts, Ctrl pt for ellipse/polygon w,h is off when rotated.
|
||||
|
||||
* $LK,"SpriteMesh",A="FI:::/Adam/Gr/SpriteMesh.CPP"$: $LK,"R",A="MN:R"$("Mesh",...);?
|
||||
@@ -27,19 +25,19 @@ $WW,1$$FG,5$$TX+CX,"TODO"$$FG$
|
||||
|
||||
* Cannot include ':' in $LK,"Document Links",A="FF:::/Adam/DolDoc/DocLink.CPP,AD"$ search string.
|
||||
|
||||
* $LK,"DOCEF_REMALLOC_DATA",A="FF:::/Adam/DolDoc/DocChar.CPP,DOCEF_REMALLOC_DATA"$ HexEdit Remalloc.
|
||||
|
||||
* No way to clear $LK,"DOCEf_HOLD",A="MN:DOCEf_HOLD"$ entries.
|
||||
|
||||
* $LK,"DOCF_DBL_DOLLARS",A="MN:DOCF_DBL_DOLLARS"$ in $LK,"Reindention",A="MN:EdCodeTools2"$.
|
||||
|
||||
* Compiler: Warn unnecessary typecast.
|
||||
|
||||
* Compiler Optimization: Local array vars --> reg. Might exist.
|
||||
|
||||
* Compiler Optimization: heap_glbls with added offset. Might exist.
|
||||
|
||||
* AfterEgypt: $LK,"Numbers,13:33",A="BF:Numbers,13:33"$ scouts? $LK,"Numbers,21:8",A="BF:Numbers,21:8"$ snakes?
|
||||
|
||||
* Find-and-replace text on $$PT$$ line before it.
|
||||
* Bug: Find-and-replace text on $$PT$$ line before it.
|
||||
* 12/25/2015 Copy-Paste index.html glitch if source window 40 columns.
|
||||
* 01/10/2016 find-replace editor hung on $LK,"CounterRenaissance",A="FI:::/Home/Web/TAD/CounterRenaissance.TXT"$ "Rennaisance"
|
||||
* 01/06/2016 Editor filter "str" applied to output from LineRep looks broken.
|
||||
@@ -83,10 +81,10 @@ $FG,5$$TX+CX,"TODO? Meh"$$FG$
|
||||
|
||||
* Clean-up ASCII #127 delete char? (No. Maybe, we want a new usage for 127 in future centuries.)
|
||||
|
||||
* $LK,"DocSave",A="MN:DocSave"$() $LK,"*result==CH_CURSOR",A="FF:::/Adam/DolDoc/DocFile.CPP,*result==CH_CURSOR"$ is ugly.
|
||||
|
||||
* Compiler: Exceptions don't free $LK,"CCmpCtrl",A="MN:CCmpCtrl"$ stuff.
|
||||
|
||||
* $LK,"::/Adam/DolDoc/DocHighlight.CPP"$ for code comments at top of documents.
|
||||
|
||||
* Unhandled exception msgs from MP's get overwritten by WinMgr.
|
||||
|
||||
* $LK,"Diff",A="MN:Diff"$("C:/Misc/Bible.TXT","D:/Misc/Bible.TXT"); Takes too long.
|
||||
@@ -126,6 +124,8 @@ $ID,-5$$HL,0$
|
||||
|
||||
|
||||
$FG,5$$TX+CX,"Bugs"$$FG$
|
||||
* 1/28/16 $LK,"::/Demo/Graphics/Pick3D.CPP"$ crashed in TestSuite.
|
||||
|
||||
* 1/12/16 make RAM drive 2288 blks, $FG,2$CopyTree("C:/Home","B:/Home"); $FG$ Disk runs-out of space and hangs instead of reporting errors.
|
||||
|
||||
* Bug introduced around 11/1/15. Changed $LK,"::/Kernel/Sched.CPP"$ and now $LK,"WinToTop",A="MN:WinToTop"$ is called on Adam task at start-up, sometimes. Might be user's fault because of bad keys pressed during VMware power-on init. Might be fixed by $LK,"ACf_INIT_IN_PROGRESS",A="MN:ACf_INIT_IN_PROGRESS"$.
|
||||
@@ -273,6 +273,8 @@ $FG,5$$TX+CX,"Inspirational Ideas"$$FG$
|
||||
|
||||
* Use standard terminology from "the literature".
|
||||
|
||||
* Striped and other dither patterns. Brushes?
|
||||
|
||||
* Get rid of BYTE, WORD, DWORD in opcode and replace with U8, U16, U32.
|
||||
|
||||
* Get rid of "Char".
|
||||
@@ -314,7 +316,7 @@ $FG,5$$TX+CX,"Inspirational Ideas"$$FG$
|
||||
$ID,5$$$=-CTASK_NEG_OFFSET
|
||||
offset(CTask.addr)==0
|
||||
Spawn(): CAlloc()
|
||||
TaskFinishOff(): Free()
|
||||
TaskDel(): Free()
|
||||
CSysFixedArea.adam
|
||||
Looks like task_flags,locked_flags cause problems with neg offset.
|
||||
$ID,-5$
|
||||
@@ -395,15 +397,15 @@ Meek and humble of heart $TX,"Matthew 11:29",HTML="http://www.biblegateway.com/
|
||||
$FG,5$$TX+CX,"Misc Notes"$$FG$
|
||||
Intel CEO's name: Brian Krzanich
|
||||
>$FG,2$lspci -v$FG$
|
||||
Size:$TX,"17344 KB",D="DD_TEMPLEOSCD_K_SIZE"$
|
||||
Size:$TX,"17358 KB",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/Downloads/Blog/Bookmarks"$
|
||||
Machine $HC,"<img src=\"http://www.templeos.org/images/Machine.jpg\" width=\"600\" height=\"400\" alt=\"\">"$
|
||||
Frosting $HC,"<img src=\"http://www.templeos.org/images/Frosting.jpg\" width=\"600\" height=\"400\" alt=\"\">"$
|
||||
Soap Carvings $HC,"<img src=\"http://www.templeos.org/images/SoapCarvings.jpg\" width=\"640\" height=\"480\" alt=\"\">"$
|
||||
CottonTail $HC,"<img src=\"http://www.templeos.org/images/CttnTail.jpg\" width=\"644\" height=\"1113\" alt=\"\">"$
|
||||
TempleOS Logo $HC,"<img src=\"http://www.templeos.org/images/Logo128x152.jpg\" width=\"640\" height=\"760\" alt=\"\">"$
|
||||
Machine $HC,"<center><img src=\"http://www.templeos.org/images/Machine.jpg\" width=\"600\" height=\"400\" alt=\"\"></center>"$
|
||||
Frosting $HC,"<center><img src=\"http://www.templeos.org/images/Frosting.jpg\" width=\"600\" height=\"400\" alt=\"\"></center>"$
|
||||
Soap Carvings $HC,"<center><img src=\"http://www.templeos.org/images/SoapCarvings.jpg\" width=\"640\" height=\"480\" alt=\"\"></center>"$
|
||||
CottonTail $HC,"<center><img src=\"http://www.templeos.org/images/CttnTail.jpg\" width=\"644\" height=\"1113\" alt=\"\"></center>"$
|
||||
TempleOS Logo $HC,"<center><img src=\"http://www.templeos.org/images/Logo128x152.jpg\" width=\"640\" height=\"760\" alt=\"\"></center>"$
|
||||
$TX,"SimStructure",HTML="http://www.templeos.org/files/SimStrSetUp.zip"$
|
||||
$TX,"ASU_Transcripts",HTML="http://www.templeos.org/files/ASU_Transcripts.pdf"$ $TX,"ASU Course Catalog (See page 261)",HTML="https://catalog.asu.edu/files/shared/archives/1994-1996/general/UG1994-1996.pdf/1994-1996-UG-241-267.pdf"$
|
||||
$TX,"Dr. David Pheanis",HTML="https://webapp4.asu.edu/directory/person/77201"$ $TX,"Dr. Konstantinos S. Tsakalis",HTML="http://ecee.engineering.asu.edu/directory/tenured-and-tenure-track-faculty/kostantinos-s-tsakalis"$ $TX,"Dr. Walter Higgins",HTML="https://webapp4.asu.edu/directory/directorysearch?cn=Walter+Higgins"$
|
||||
@@ -412,7 +414,7 @@ $TX,"Tom Foley",HTML="http://web.gccaz.edu/~tfoley/perspage.html"$
|
||||
|
||||
|
||||
$FG,5$$TX+CX,"Web Bookmarks"$$FG$
|
||||
Cop tying shoe $HC,"<img src=\"https://goodtimestories.files.wordpress.com/2013/04/cop-tying-shoe-cambridge-county-pd.jpg\" width=\"480\" height=\"376\" alt=\"\">"$
|
||||
Cop tying shoe $HC,"<center><img src=\"https://goodtimestories.files.wordpress.com/2013/04/cop-tying-shoe-cambridge-county-pd.jpg\" width=\"480\" height=\"376\" alt=\"\"></center>"$
|
||||
$TX,"Good Time Bad Times Lyrics",HTML="https://www.google.com/#q=led+zep+good+times+bad+times+lyrics"$
|
||||
$TX,"Unikernels",HTML="https://ma.ttias.be/what-is-a-unikernel"$
|
||||
$TX,"Handford school",HTML="https:/pinterest.com/pin/255368241346360278"$
|
||||
|
||||
@@ -2,7 +2,7 @@ $TR-UL,"Adam"$
|
||||
$ID,2$$TR,"SysMsgFlags"$
|
||||
$ID,2$sys_msg_flags[0]=0xFF;
|
||||
$ID,-2$$TR,"SysRegVer"$
|
||||
$ID,2$registry_version=4.020;
|
||||
$ID,2$registry_version=4.030;
|
||||
$ID,-2$$ID,-2$$TR-UL,"TempleOS"$
|
||||
$ID,2$$TR,"TOS"$
|
||||
$ID,2$I64 tos_code_walk_thru=105,tos_after_egypt_in_action=46;
|
||||
@@ -39,7 +39,7 @@ $ID,-2$$TR,"BomberGolf"$
|
||||
$ID,2$I64 best_score=175;
|
||||
$ID,-2$$ID,-2$$TR,"DemoCompany"$
|
||||
$ID,2$$TR,"Game1"$
|
||||
$ID,2$F64 best_score=197.26500;
|
||||
$ID,2$F64 best_score=166.32939;
|
||||
$TR,"SimpleVal"$
|
||||
$ID,2$1279;
|
||||
$ID,2$1298;
|
||||
$ID,-2$$ID,-2$$ID,-2$
|
||||
@@ -0,0 +1,107 @@
|
||||
U8 *BlogLocalDir(CDate cdt=0)
|
||||
{
|
||||
static U8 dir[STR_LEN];
|
||||
CDateStruct ds;
|
||||
if (!cdt) cdt=Now+local_time_offset;
|
||||
Date2Struct(&ds,cdt);
|
||||
StrPrint(dir,"::/Home/Web/" PERSONAL_INITIALS "/Blog/%d%Z",
|
||||
ds.year,ds.mon-1,"ST_MONTHS");
|
||||
if (!FileFind(dir,,FUF_JUST_DIRS))
|
||||
MkDir(dir);
|
||||
return dir;
|
||||
}
|
||||
|
||||
U8 *BlogLocalFile(CDate cdt=0)
|
||||
{
|
||||
static U8 file[STR_LEN];
|
||||
CDateStruct ds;
|
||||
if (!cdt) cdt=Now+local_time_offset;
|
||||
Date2Struct(&ds,cdt);
|
||||
StrPrint(file,"%s/" PERSONAL_INITIALS "%02d%02d%02d.TXT.Z",
|
||||
BlogLocalDir(cdt),ds.year%100,ds.mon,ds.day_of_mon);
|
||||
return file;
|
||||
}
|
||||
|
||||
U8 *BlogWebDir(CDate cdt=0)
|
||||
{
|
||||
static U8 dir[STR_LEN];
|
||||
CDateStruct ds;
|
||||
if (!cdt) cdt=Now+local_time_offset;
|
||||
Date2Struct(&ds,cdt);
|
||||
StrPrint(dir,PERSONAL_WEB "/Home/Web/" PERSONAL_INITIALS "/Blog/%d%Z",
|
||||
ds.year,ds.mon-1,"ST_MONTHS");
|
||||
return dir;
|
||||
}
|
||||
|
||||
U8 *BlogWebFile(CDate cdt=0)
|
||||
{
|
||||
static U8 file[STR_LEN];
|
||||
CDateStruct ds;
|
||||
if (!cdt) cdt=Now+local_time_offset;
|
||||
Date2Struct(&ds,cdt);
|
||||
StrPrint(file,"%s/" PERSONAL_INITIALS "%02d%02d%02d.TXT.Z",
|
||||
BlogWebDir(cdt),ds.year%100,ds.mon,ds.day_of_mon);
|
||||
return file;
|
||||
}
|
||||
|
||||
public U8 *FileNameNumNext(U8 *files_find_mask,U8 *fmt)
|
||||
{
|
||||
CDirEntry *tempde=FilesFind(files_find_mask);
|
||||
U8 *result=MStrPrint(fmt,FileCnt(tempde));
|
||||
DirTreeDel(tempde);
|
||||
return result;
|
||||
}
|
||||
|
||||
U0 BlogDCImgWrite(CDC *dc,CDate cdt=0)
|
||||
{
|
||||
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));
|
||||
StrPrint(file_name,"%s/Img%%03d.BMP",BlogLocalDir(cdt));
|
||||
st1=FileNameNumNext(file_mask,file_name);
|
||||
st2=MStrPrint("http://www.templeos.org/Wb%s",st1+2);
|
||||
BMPWrite(st1,dc);
|
||||
Free(st1);
|
||||
"$$HC,\"<img src=\\\"%s\\\" width=\\\"%d\\\" "
|
||||
"height=\\\"%d\\\" alt=\\\"\\\">\"$$\n",st2,dc->width,dc->height;
|
||||
Free(st2);
|
||||
}
|
||||
|
||||
U0 BlogScreenShot()
|
||||
{
|
||||
Bool old_cursor=DocCursor;
|
||||
CDC *dc1,*dc2;
|
||||
U8 *old_fp_draw_input_ptr=gr.fp_draw_input_ptr;
|
||||
gr.fp_draw_input_ptr=NULL;
|
||||
WinMgrSync(2);
|
||||
dc1=DCScreenCapture;
|
||||
dc2=DCExtract(dc1,0,FONT_HEIGHT,GR_WIDTH-1,GR_HEIGHT-1);
|
||||
BlogDCImgWrite(dc2);
|
||||
gr.fp_draw_input_ptr=old_fp_draw_input_ptr;
|
||||
DCDel(dc1);
|
||||
DCDel(dc2);
|
||||
DocCursor(old_cursor);
|
||||
}
|
||||
|
||||
public U0 MakeWebSitePartial()
|
||||
{
|
||||
FreshenWebDir("/Home/Web");
|
||||
FreshenWebDir("/Home/Web/" PERSONAL_INITIALS);
|
||||
FreshenWebDir(BlogLocalDir+2);
|
||||
Drv('C');
|
||||
}
|
||||
|
||||
U0 Blog()
|
||||
{
|
||||
if (!FileFind(BlogLocalFile,,FUF_JUST_FILES))
|
||||
Copy("::/Home/Downloads/Blog/DailyBlogHeader.TXT.Z",BlogLocalFile);
|
||||
WinMax;
|
||||
AutoComplete;
|
||||
Msg(MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN|SCF_CTRL);
|
||||
Msg(MSG_KEY_DOWN_UP,0,SC_F6|SCF_ALT);
|
||||
Msg(MSG_KEY_DOWN_UP,'\n',0);
|
||||
if (Ed(BlogLocalFile,EDF_WAS_WRITE)) {
|
||||
Copy(BlogLocalFile,"::Home/Web/" PERSONAL_INITIALS "/DailyBlog.TXT.Z");
|
||||
MakeWebSitePartial;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,8 @@
|
||||
#help_index "TOS"
|
||||
|
||||
#define PERSONAL_WEB "http:/" "/www.templeos.org/Wb"
|
||||
#define PERSONAL_INITIALS "TAD"
|
||||
|
||||
#define SLOP BLK_SIZE
|
||||
U0 TOSBootRescueDrv1()
|
||||
{
|
||||
|
||||
+13
-129
@@ -1,5 +1,7 @@
|
||||
//The CFG defines are $LK,"::/Home/TOSCfg.CPP",A="FI:::/Demo/AcctExample/TOSCfg.CPP"$.
|
||||
|
||||
#help_index "TOS"
|
||||
|
||||
U8 TOSGetDrv()
|
||||
{
|
||||
I64 result;
|
||||
@@ -45,61 +47,20 @@ U0 TOSPromptAndCopyDrv()
|
||||
TOSCopyDrv(src,dst);
|
||||
}
|
||||
|
||||
public U0 CursorRemFile(U8 *filename)
|
||||
{
|
||||
CDoc *doc;
|
||||
doc=DocRead(filename,DOCF_PLAIN_TEXT|DOCF_NO_CURSOR);
|
||||
DocWrite(doc);
|
||||
DocDel(doc);
|
||||
}
|
||||
public U0 CursorRem(U8 *files_find_mask="*")
|
||||
{
|
||||
I64 fuf_flags=0;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+T+f+F+O");
|
||||
CDirEntry *tempde=FilesFind(files_find_mask,fuf_flags),*tempde1=tempde;
|
||||
while (tempde) {
|
||||
CursorRemFile(tempde->full_name);
|
||||
Touch(tempde->full_name,"",,tempde->datetime);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
}
|
||||
|
||||
U0 UncollapseFile(U8 *filename,I64 *)
|
||||
{
|
||||
CDoc *doc=DocRead(filename,DOCF_NO_CURSOR);
|
||||
DocCollapse(FALSE,doc);
|
||||
DocWrite(doc);
|
||||
DocDel(doc);
|
||||
}
|
||||
U0 Uncollapse(U8 *files_find_mask="*",U8 *fu_flags=NULL)
|
||||
{
|
||||
I64 fuf_flags=0;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F+T+O");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
CDirEntry *tempde=FilesFind(files_find_mask,fuf_flags),*tempde1=tempde;
|
||||
while (tempde && !Bt(&fuf_flags,FUf_CANCEL)) {
|
||||
UncollapseFile(tempde->full_name,&fuf_flags);
|
||||
Touch(tempde->full_name,"",,tempde->datetime);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
}
|
||||
|
||||
public U0 CopySongs(U8 threshold='7')
|
||||
{
|
||||
CDoc *s;
|
||||
CDoc *doc;
|
||||
CDocEntry *doc_e;
|
||||
CDirEntry *tempde=FilesFind("/Home/Downloads/Psalmody/*.CPP*",
|
||||
FUF_CLUSTER_ORDER),
|
||||
*tempde1=tempde;
|
||||
FUF_CLUSTER_ORDER),*tempde1=tempde;
|
||||
DelTree("/Apps/Psalmody/Examples");
|
||||
MkDir("/Apps/Psalmody/Examples");
|
||||
while (tempde) {
|
||||
s=DocRead(tempde->full_name);
|
||||
doc_e=s->root.next;
|
||||
doc=DocRead(tempde->full_name);
|
||||
doc_e=doc->root.next;
|
||||
if (doc_e->type_u8==DOCT_TEXT && doc_e->tag[2]>=threshold)
|
||||
Copy(tempde->full_name,"/Apps/Psalmody/Examples");
|
||||
DocDel(doc);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
@@ -288,7 +249,7 @@ U0 MakeTOSDistro()
|
||||
ISOFileCreate(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
|
||||
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
|
||||
DefinePrint("DD_TEMPLEOSTS_SIZE",
|
||||
"Download $TX,"TempleOS V4.01",D="DD_OS_NAME_VERSION"$ - T.S. Company Internal Distro (%0.1f MB)",
|
||||
"Download $TX,"TempleOS V4.03",D="DD_OS_NAME_VERSION"$ - T.S. Company Internal Distro (%0.1f MB)",
|
||||
0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
|
||||
Drv('C');
|
||||
}
|
||||
@@ -323,7 +284,7 @@ U0 MakeDbgDistro()
|
||||
ISOFileCreate(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
|
||||
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
|
||||
DefinePrint("DD_TEMPLEOSDBG_SIZE",
|
||||
"Download $TX,"TempleOS V4.01",D="DD_OS_NAME_VERSION"$ - Debug Distro (%0.1f MB)",
|
||||
"Download $TX,"TempleOS V4.03",D="DD_OS_NAME_VERSION"$ - Debug Distro (%0.1f MB)",
|
||||
0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
|
||||
Drv('C');
|
||||
}
|
||||
@@ -371,7 +332,7 @@ U0 MakeLiteDistro()
|
||||
ISOFileCreate(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
|
||||
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
|
||||
DefinePrint("DD_TEMPLEOSLITE_SIZE",
|
||||
"Download $TX,"TempleOS V4.01",D="DD_OS_NAME_VERSION"$ - Lite Distro (%0.1f MB)",
|
||||
"Download $TX,"TempleOS V4.03",D="DD_OS_NAME_VERSION"$ - Lite Distro (%0.1f MB)",
|
||||
0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
|
||||
Drv('C');
|
||||
}
|
||||
@@ -404,98 +365,21 @@ U0 MakeUltraDistro()
|
||||
ISOFileCreate(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
|
||||
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
|
||||
DefinePrint("DD_TEMPLEOSULTRA_SIZE",
|
||||
"Download $TX,"TempleOS V4.01",D="DD_OS_NAME_VERSION"$ - UltraLite Distro (%0.1f MB)",
|
||||
"Download $TX,"TempleOS V4.03",D="DD_OS_NAME_VERSION"$ - UltraLite Distro (%0.1f MB)",
|
||||
0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
|
||||
Drv('C');
|
||||
}
|
||||
|
||||
U0 TOSWebFile(U8 *name)
|
||||
{
|
||||
U8 *name2;
|
||||
CDirEntry de;
|
||||
if (FileFind(name,&de)) {
|
||||
Free(de.full_name);
|
||||
"File:%s\n",name;
|
||||
UncollapseFile(name,NULL);
|
||||
Touch(name,"",,de.datetime);
|
||||
name2=ChgExt(name,"html");
|
||||
ToHtml(name,name2,
|
||||
"<title>The Temple Operating System</title>\n"
|
||||
"<meta name=\"keywords\" "
|
||||
"content=\"Operating System,64-Bit,64 Bit,"
|
||||
"Temple,OS,TempleOS,Free,Open Source,Public Domain,x86_64\">\n");
|
||||
Touch(name2,"",,de.datetime);
|
||||
Free(name2);
|
||||
}
|
||||
}
|
||||
|
||||
U0 MakeWebSite()
|
||||
{
|
||||
CDirEntry *tempde,*tempde1;
|
||||
DocClear;
|
||||
Cd("D:/Wb");
|
||||
DelTree("D:/Wb/Home/Budget");
|
||||
DelTree("D:/Wb/Home/Private");
|
||||
Del("D:/Wb/Home/*");
|
||||
Touch("D:/Wb/Home/Web/index.TXT.Z","");
|
||||
Touch("D:/Wb/Home/Web/Downloads.TXT.Z","");
|
||||
Touch("D:/Wb/Home/Web/TempleOS.TXT.Z","");
|
||||
tempde=tempde1=FilesFind("*",
|
||||
FUF_RECURSE|FUF_JUST_FILES|FUF_JUST_TXT|FUF_CLUSTER_ORDER);
|
||||
while (tempde) {
|
||||
TOSWebFile(tempde->full_name);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
Copy( "D:/Wb/Home/Downloads/Bin/TempleBot",
|
||||
"D:/Wb/Home/Downloads/Bin/TempleBot.TXT");
|
||||
ToDolDoc("D:/Wb/Home/Downloads/Bin/TempleBot.TXT");
|
||||
ToHtml("D:/Wb/Home/Downloads/Bin/TempleBot.TXT");
|
||||
Del("D:/Wb/Home/Downloads/Bin/TempleBot.TXT");
|
||||
DirTreeDel(tempde1);
|
||||
Drv('C');
|
||||
}
|
||||
|
||||
U0 FreshenWebDir(U8 *dirname)
|
||||
{//No recurse
|
||||
CDirEntry *tempde,*tempde1;
|
||||
U8 *src,*dst;
|
||||
|
||||
src=MStrPrint("D:/Wb%s/*",dirname);
|
||||
Del(src);
|
||||
Free(src);
|
||||
src=MStrPrint("C:%s/*",dirname);
|
||||
dst=MStrPrint("D:/Wb%s",dirname);
|
||||
Copy(src,dst);
|
||||
Free(src);
|
||||
Free(dst);
|
||||
|
||||
src=MStrPrint("D:/Wb%s/*",dirname);
|
||||
tempde=tempde1=FilesFind(src,FUF_JUST_FILES|FUF_JUST_TXT|FUF_CLUSTER_ORDER);
|
||||
while (tempde) {
|
||||
TOSWebFile(tempde->full_name);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
}
|
||||
|
||||
U0 MakeWebSitePartial()
|
||||
{
|
||||
FreshenWebDir("/Home/Web");
|
||||
FreshenWebDir("/Home/Web/TAD");
|
||||
FreshenWebDir("/Home/Web/Imgs");
|
||||
Drv('C');
|
||||
}
|
||||
|
||||
U0 UpdateISODocDefines()
|
||||
{
|
||||
try {
|
||||
DefinePrint("DD_TEMPLEOSCD_SIZE",
|
||||
"Download $TX,"TempleOS V4.01",D="DD_OS_NAME_VERSION"$ - Standard Distro (%0.1f MB)",
|
||||
"Download $TX,"TempleOS V4.03",D="DD_OS_NAME_VERSION"$ - Standard Distro (%0.1f MB)",
|
||||
0.1*(10*Size("D:/Wb/TempleOSCD.ISO","+s")/1024/1024));
|
||||
DefinePrint("DD_TEMPLEOSCD_K_SIZE",
|
||||
"%d KB",Size("D:/Wb/TempleOSCD.ISO","+s")/1024);
|
||||
DefinePrint("DD_TEMPLEOSULTRA_SIZE",
|
||||
"Download $TX,"TempleOS V4.01",D="DD_OS_NAME_VERSION"$ - UltraSmall Distro (%0.1f MB)",
|
||||
"Download $TX,"TempleOS V4.03",D="DD_OS_NAME_VERSION"$ - UltraSmall Distro (%0.1f MB)",
|
||||
0.1*(10*Size("D:/Wb/TempleOSUltra.ISO","+s")/1024/1024));
|
||||
DefinePrint("DD_TEMPLEOSULTRA_K_SIZE",
|
||||
"%d KB",Size("D:/Wb/TempleOSUltra.ISO","+s")/1024);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#help_index "TOS"
|
||||
|
||||
U0 BadCodeJump()
|
||||
{//$LK,"::/Adam/God/HSNotes.TXT"$
|
||||
CDirEntry *tempde1=FilesFind("/*",
|
||||
@@ -28,42 +30,6 @@ U0 BadCodeJump()
|
||||
Free(st);
|
||||
}
|
||||
|
||||
public U8 *FileNameNumNext(U8 *files_find_mask,U8 *fmt)
|
||||
{
|
||||
CDirEntry *tempde=FilesFind(files_find_mask);
|
||||
U8 *result=MStrPrint(fmt,FileCnt(tempde));
|
||||
DirTreeDel(tempde);
|
||||
return result;
|
||||
}
|
||||
|
||||
U0 DCImgWrite(CDC *dc)
|
||||
{
|
||||
U8 *st1=FileNameNumNext("::/Home/Web/Imgs/Img*",
|
||||
"::/Home/Web/Imgs/Img%03d.BMP"),
|
||||
*st2=MStrPrint("http://www.templeos.org/Wb%s",st1+2);
|
||||
BMPWrite(st1,dc);
|
||||
Free(st1);
|
||||
"$$HC,\"<img src=\\\"%s\\\" width=\\\"%d\\\" "
|
||||
"height=\\\"%d\\\" alt=\\\"\\\">\"$$\n",st2,dc->width,dc->height;
|
||||
Free(st2);
|
||||
}
|
||||
|
||||
U0 BlogScreenShot()
|
||||
{
|
||||
Bool old_cursor=DocCursor;
|
||||
CDC *dc1,*dc2;
|
||||
U8 *old_fp_draw_input_ptr=gr.fp_draw_input_ptr;
|
||||
gr.fp_draw_input_ptr=NULL;
|
||||
WinMgrSync(2);
|
||||
dc1=DCScreenCapture;
|
||||
dc2=DCExtract(dc1,0,FONT_HEIGHT,GR_WIDTH-1,GR_HEIGHT-1);
|
||||
DCImgWrite(dc2);
|
||||
gr.fp_draw_input_ptr=old_fp_draw_input_ptr;
|
||||
DCDel(dc1);
|
||||
DCDel(dc2);
|
||||
DocCursor(old_cursor);
|
||||
}
|
||||
|
||||
U8 *WebBookMarks(U8 *filename="::/Home/Downloads/Blog/Bookmarks.html")
|
||||
{
|
||||
U8 *st;
|
||||
@@ -149,7 +115,7 @@ class CTopMoviesForm
|
||||
U8 tag[STR_LEN];
|
||||
U8 special[STR_LEN];
|
||||
I64 timestamp;
|
||||
I64 cert fmtstr "$$DA-TRM,2,A=\"Movie #1-100:%02d\"$$\n";
|
||||
I64 cert fmtstr "$$DA-TRM,LEN=2,A=\"Movie #1-100:%02d\"$$\n";
|
||||
I64 min;
|
||||
I64 sec;
|
||||
};
|
||||
@@ -159,14 +125,14 @@ class CMetallicaForm
|
||||
U8 tag[STR_LEN];
|
||||
U8 special[STR_LEN];
|
||||
I64 timestamp;
|
||||
I64 cert fmtstr "$$DA-TRM,2,A=\"Song #1-99:%02d\"$$\n";
|
||||
I64 cert fmtstr "$$DA-TRM,LEN=2,A=\"Song #1-99:%02d\"$$\n";
|
||||
I64 min;
|
||||
I64 sec;
|
||||
};
|
||||
|
||||
class CWebBookMarkForm
|
||||
{
|
||||
U8 tag[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"Tag Text:%s\"$$\n";
|
||||
U8 tag[STR_LEN] fmtstr "$$DA-P,LEN=STR_LEN-1,A=\"Tag Text:%s\"$$\n";
|
||||
U8 special[STR_LEN];
|
||||
I64 timestamp;
|
||||
I64 cert;
|
||||
@@ -176,8 +142,8 @@ class CWebBookMarkForm
|
||||
|
||||
class CWebBibleForm
|
||||
{
|
||||
U8 tag[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"Tag Text:%s\"$$\n";
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"Bible Passage:%s\"$$\n";
|
||||
U8 tag[STR_LEN] fmtstr "$$DA-P,LEN=STR_LEN-1,A=\"Tag Text:%s\"$$\n";
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P,LEN=STR_LEN-1,A=\"Bible Passage:%s\"$$\n";
|
||||
I64 timestamp;
|
||||
I64 cert;
|
||||
I64 min;
|
||||
@@ -186,28 +152,28 @@ class CWebBibleForm
|
||||
|
||||
class CYouTubeForm
|
||||
{
|
||||
U8 tag[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"Title:%s\"$$\n";
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P-TRM,11,A=\"SerialNum:%11s\"$$\n";
|
||||
U8 tag[STR_LEN] fmtstr "$$DA-P,LEN=STR_LEN-1,A=\"Title:%s\"$$\n";
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P-TRM,LEN=11,A=\"SerialNum:%11s\"$$\n";
|
||||
I64 timestamp;
|
||||
I64 cert;
|
||||
I64 min fmtstr "$$DA,32,A=\"Minutes :%d\"$$\n";
|
||||
I64 sec fmtstr "$$DA,32,A=\"Seconds :%d\"$$\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,STR_LEN-1,A=\"SerialNum:%s\"$$\n";
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P,LEN=STR_LEN-1,A=\"SerialNum:%s\"$$\n";
|
||||
I64 timestamp;
|
||||
I64 cert;
|
||||
I64 min fmtstr "$$DA,32,A=\"Width :%d\"$$\n";
|
||||
I64 sec fmtstr "$$DA,32,A=\"Height :%d\"$$\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,STR_LEN-1,A=\"Tag Text:%s\"$$\n";
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"Index :%s\"$$\n";
|
||||
U8 tag[STR_LEN] fmtstr "$$DA-P,LEN=STR_LEN-1,A=\"Tag Text:%s\"$$\n";
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P,LEN=STR_LEN-1,A=\"Index :%s\"$$\n";
|
||||
I64 timestamp;
|
||||
I64 cert;
|
||||
I64 min;
|
||||
@@ -217,7 +183,7 @@ class CWikipediaForm
|
||||
class CRandDecForm
|
||||
{
|
||||
U8 tag[STR_LEN];
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"Line (Dec):%s\"$$\n";
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P,LEN=STR_LEN-1,A=\"Line (Dec):%s\"$$\n";
|
||||
I64 timestamp;
|
||||
I64 cert;
|
||||
I64 min;
|
||||
@@ -227,7 +193,7 @@ class CRandDecForm
|
||||
class CRandHexForm
|
||||
{
|
||||
U8 tag[STR_LEN];
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"Line (Hex):%s\"$$\n";
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P,LEN=STR_LEN-1,A=\"Line (Hex):%s\"$$\n";
|
||||
I64 timestamp;
|
||||
I64 cert;
|
||||
I64 min;
|
||||
@@ -237,9 +203,9 @@ class CRandHexForm
|
||||
class CRandCertForm
|
||||
{
|
||||
U8 tag[STR_LEN];
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"Line (Dec) :%s\"$$\n";
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P,LEN=STR_LEN-1,A=\"Line (Dec) :%s\"$$\n";
|
||||
I64 timestamp;
|
||||
I64 cert fmtstr "$$DA,32,A=\"Certificate:%d\"$$\n";
|
||||
I64 cert fmtstr "$$DA,A=\"Certificate:%d\"$$\n";
|
||||
I64 min;
|
||||
I64 sec;
|
||||
};
|
||||
@@ -248,8 +214,9 @@ class CRandHexBeacon5Form
|
||||
{
|
||||
U8 tag[STR_LEN];
|
||||
U8 special[STR_LEN]
|
||||
fmtstr "$$DA-P-TRM,5,A=\"Line (5-Digit Hex):%5s\"$$\n";
|
||||
I64 timestamp fmtstr "$$DA,32,A=\"TimeStamp :%d\"$$\n";
|
||||
fmtstr "$$DA-P-TRM,LEN=5,"
|
||||
"A=\"Line (5-Digit Hex):%5s\"$$\n";
|
||||
I64 timestamp fmtstr "$$DA,A=\"TimeStamp :%d\"$$\n";
|
||||
I64 cert;
|
||||
I64 min;
|
||||
I64 sec;
|
||||
@@ -259,8 +226,9 @@ class CRandHexBeacon8Form
|
||||
{
|
||||
U8 tag[STR_LEN];
|
||||
U8 special[STR_LEN]
|
||||
fmtstr "$$DA-P-TRM,8,A=\"Line (8-Digit Hex):%8s\"$$\n";
|
||||
I64 timestamp fmtstr "$$DA,32,A=\"TimeStamp :%d\"$$\n";
|
||||
fmtstr "$$DA-P-TRM,LEN=8,"
|
||||
"A=\"Line (8-Digit Hex):%8s\"$$\n";
|
||||
I64 timestamp fmtstr "$$DA,A=\"TimeStamp :%d\"$$\n";
|
||||
I64 cert;
|
||||
I64 min;
|
||||
I64 sec;
|
||||
@@ -456,7 +424,7 @@ public U0 GodBooksPassage(U8 *files_find_mask,I64 len=512,
|
||||
DirTreeDel(tempde1);
|
||||
}
|
||||
|
||||
#define NIST_TIME_OFFSET (-7879-local_time_offset/CDATE_FREQ)
|
||||
#define NIST_TIME_OFFSET (-7884-local_time_offset/CDATE_FREQ)
|
||||
#define NIST_TIME_TO_SWITCH 3
|
||||
|
||||
public U0 NISTSync()
|
||||
@@ -569,8 +537,8 @@ U0 InsMyURL()
|
||||
break;
|
||||
case:
|
||||
if (DocForm(url(CImgurForm *))) {
|
||||
"$$HC,\"<img src=\\\"http://i.imgur.com/%s\\\" "
|
||||
"width=\\\"%d\\\" height=\\\"%d\\\" alt=\\\"\\\">\"$$\n",
|
||||
"$$HC,\"<center><img src=\\\"http://i.imgur.com/%s\\\" "
|
||||
"width=\\\"%d\\\" height=\\\"%d\\\" alt=\\\"\\\"></center>\"$$\n",
|
||||
url->special,url->min,url->sec;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1,3 +1,46 @@
|
||||
#help_index "TOS"
|
||||
|
||||
public U0 CursorRemFile(U8 *filename)
|
||||
{
|
||||
CDoc *doc;
|
||||
doc=DocRead(filename,DOCF_PLAIN_TEXT|DOCF_NO_CURSOR);
|
||||
DocWrite(doc);
|
||||
DocDel(doc);
|
||||
}
|
||||
public U0 CursorRem(U8 *files_find_mask="*")
|
||||
{
|
||||
I64 fuf_flags=0;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+T+f+F+O");
|
||||
CDirEntry *tempde=FilesFind(files_find_mask,fuf_flags),*tempde1=tempde;
|
||||
while (tempde) {
|
||||
CursorRemFile(tempde->full_name);
|
||||
Touch(tempde->full_name,"",,tempde->datetime);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
}
|
||||
|
||||
U0 UncollapseFile(U8 *filename,I64 *)
|
||||
{
|
||||
CDoc *doc=DocRead(filename,DOCF_NO_CURSOR);
|
||||
DocCollapse(FALSE,doc);
|
||||
DocWrite(doc);
|
||||
DocDel(doc);
|
||||
}
|
||||
public U0 Uncollapse(U8 *files_find_mask="*",U8 *fu_flags=NULL)
|
||||
{
|
||||
I64 fuf_flags=0;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F+T+O");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
CDirEntry *tempde=FilesFind(files_find_mask,fuf_flags),*tempde1=tempde;
|
||||
while (tempde && !Bt(&fuf_flags,FUf_CANCEL)) {
|
||||
UncollapseFile(tempde->full_name,&fuf_flags);
|
||||
Touch(tempde->full_name,"",,tempde->datetime);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
}
|
||||
|
||||
#define VIDEO_FRAME_RATE 8
|
||||
|
||||
#define FG_JUST_AUDIO 0
|
||||
@@ -198,7 +241,7 @@ U0 TOSRegWrite()
|
||||
|
||||
class CYouTubeForm2
|
||||
{
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"SerialNum:%s\"$$\n";
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P,LEN=STR_LEN-1,A=\"SerialNum:%s\"$$\n";
|
||||
};
|
||||
|
||||
U8 *TOSYouTube()
|
||||
|
||||
@@ -0,0 +1,441 @@
|
||||
//This is a customized version of $LK,"::/Demo/ToHtmlToTXTExample/ToHtml.CPP"$.
|
||||
|
||||
#help_index "DolDoc/Conversion"
|
||||
//See $LK,"::/Doc/Credits.TXT"$.
|
||||
|
||||
U0 HtmlPutS(CDoc *doc,I64 u32_attr,I64 *_old_u32_attr,
|
||||
U8 *st,I64 *_col,U8 *style_bitmap=NULL)
|
||||
{
|
||||
U8 *ch,*ptr;
|
||||
u32_attr&=0xFFFFFF00;
|
||||
if (u32_attr&DOCET_INVERT)
|
||||
u32_attr.u8[1]=(u32_attr.u8[1]&15)<<4|u32_attr.u8[1]>>4;
|
||||
if (u32_attr!=*_old_u32_attr) {
|
||||
if (!(u32_attr&DOCET_BLINK) &&
|
||||
*_old_u32_attr!=-1 && *_old_u32_attr&DOCET_BLINK)
|
||||
DocPrint(doc,"</blink>");
|
||||
if (*_old_u32_attr!=-1)
|
||||
DocPrint(doc,"</span>");
|
||||
DocPrint(doc,"<span class=c%02X>",u32_attr.u8[1]);
|
||||
if (u32_attr&DOCET_BLINK &&
|
||||
(*_old_u32_attr==-1 || !(*_old_u32_attr&DOCET_BLINK)))
|
||||
DocPrint(doc,"<blink>");
|
||||
*_old_u32_attr=u32_attr;
|
||||
if (style_bitmap)
|
||||
LBts(style_bitmap,u32_attr.u8[1]);
|
||||
}
|
||||
while (ch=*st++) {
|
||||
switch (ch) {
|
||||
case '\t':
|
||||
do {
|
||||
DocPutKey(doc,CH_SPACE,0);
|
||||
*_col=*_col+1;
|
||||
} while (*_col&7);
|
||||
break;
|
||||
|
||||
sub_switch_start:
|
||||
case 'ã': ptr="pi"; break;
|
||||
case 'é': ptr="theta"; break;
|
||||
case 'è': ptr="phi"; break;
|
||||
case 'ê': ptr="omega"; break;
|
||||
case 'ì': ptr="inf"; break;
|
||||
case 'æ': ptr="u"; break;
|
||||
sub_switch_end:
|
||||
DocPrint(doc,ptr);
|
||||
*_col=*_col+StrLen(ptr);
|
||||
break;
|
||||
|
||||
sub_switch_start:
|
||||
case CH_SHIFT_SPACE: ptr=" "; break;
|
||||
case '&': ptr="&"; break;
|
||||
case '<': ptr="<"; break;
|
||||
case '>': ptr=">"; break;
|
||||
case '"': ptr="""; break;
|
||||
sub_switch_end:
|
||||
DocPrint(doc,ptr);
|
||||
*_col=*_col+1;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (CH_SPACE<=ch<0x7F || ch=='\n')
|
||||
DocPutKey(doc,ch,0);
|
||||
else
|
||||
DocPrint(doc,".");
|
||||
*_col=*_col+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
U8 *TOSLinkCvt2(U8 *filename,I64 line_num)
|
||||
{// ::/ --> http://www.templeos.org/Wb/
|
||||
//Make your own LinkCvt routine
|
||||
U8 *result=NULL,*st;
|
||||
if (filename) {
|
||||
st=ChgExt(filename,"html");
|
||||
if (st && StrLen(st)>3 && !StrNCmp(st+1,":/",2))
|
||||
result=MStrPrint(PERSONAL_WEB "/%s#l%d",st+3,line_num);
|
||||
Free(st);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
U8 *TOSLinkCvt1(U8 *link_st)
|
||||
{
|
||||
static CDoc *bible=NULL;
|
||||
static I64 locks=0;
|
||||
U8 *result=NULL,*filename,*needle;
|
||||
I64 i,num;
|
||||
if (link_st) {
|
||||
switch (i=EdLinkCvt(link_st,&filename,&needle,&num)) {
|
||||
case LK_FILE_LINE:
|
||||
case LK_PLAIN_LINE:
|
||||
case LK_FILE:
|
||||
result=TOSLinkCvt2(filename,num);
|
||||
break;
|
||||
case -1:
|
||||
case LK_DEF:
|
||||
case LK_HELP_INDEX:
|
||||
case LK_DOC:
|
||||
case LK_DOC_ANCHOR:
|
||||
case LK_DOC_FIND:
|
||||
case LK_DOC_LINE:
|
||||
break;
|
||||
case LK_BIBLE_FIND:
|
||||
while (LBts(&locks,0))
|
||||
Yield;
|
||||
if (!bible)
|
||||
bible=Adam("DocRead(\"%s\");",filename);
|
||||
if (DocFind(bible,num,needle))
|
||||
result=TOSLinkCvt2(filename,bible->cur_entry->y+1);
|
||||
LBtr(&locks,0);
|
||||
break;
|
||||
default:
|
||||
if (DocFileEd(i,filename,needle,&num,EDF_UNCOLLAPSE|EDF_BAIL))
|
||||
result=TOSLinkCvt2(filename,num);
|
||||
}
|
||||
Free(filename);
|
||||
Free(needle);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public CDoc *Doc2Html(CDoc *doc_in,U8 *html_header=NULL,U8 *body_header=NULL,
|
||||
U8 *body_footer=NULL,U8 *html_footer=NULL,Bool line_anchors=TRUE,
|
||||
U8 (*link_cvt)(U8 *link_st)=&TOSLinkCvt1)
|
||||
{//Cvt $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.TXT"$doc to HTML file.
|
||||
CDocEntry *doc_e,*style,*doc_e2;
|
||||
I64 i,y,old_y=MIN_I64,col,old_u32_attr=-1,old_attr;
|
||||
U32 *hl,*src;
|
||||
U8 *st,st_2[2],*link_st,*style_bitmap=CAlloc(256/8);
|
||||
CBGR48 p[NUM_COLORS];
|
||||
GrPaletteGet(p);
|
||||
CDoc *doc_out=DocNew;
|
||||
Bool unlock_doc_in=DocLock(doc_in),no_bwd;
|
||||
|
||||
old_attr=doc_in->win_task->text_attr;
|
||||
doc_in->win_task->text_attr=DOC_ATTR_DFT_TEXT;
|
||||
|
||||
for (i=0xF0;i<=0xFF;i++)
|
||||
LBts(style_bitmap,i);
|
||||
|
||||
DocRecalc(doc_in,RECALCt_NORMAL|RECALCF_TO_HTML);
|
||||
|
||||
st_2[0]=0; st_2[1]=0;
|
||||
doc_out->flags|=DOCF_PLAIN_TEXT|DOCF_NO_CURSOR;
|
||||
|
||||
if (!html_header) html_header=
|
||||
"<!DOCTYPE HTML>\n"
|
||||
"<html>\n"
|
||||
"<head>\n"
|
||||
"<meta http-equiv=\"Content-Type\" "
|
||||
"content=\"text/html;charset=US-ASCII\">\n"
|
||||
"<meta name=\"generator\" content=\"$TX,"TempleOS V4.03",D="DD_OS_NAME_VERSION"$\">\n";
|
||||
if (!body_header) body_header=
|
||||
"<body>\n"
|
||||
"<pre style=\"font-family:courier;font-size:10pt\">\n";
|
||||
if (!body_footer) body_footer=
|
||||
"</pre></body>\n</html>\n";
|
||||
if (!html_footer) html_footer=
|
||||
"</html>\n";
|
||||
|
||||
DocPrint(doc_out,"%s",html_header);
|
||||
|
||||
DocPrint(doc_out,"<style type=\"text/css\">\n");
|
||||
style=doc_out->cur_entry->last;
|
||||
DocPrint(doc_out,
|
||||
"</style>\n"
|
||||
"</head>\n");
|
||||
DocPrint(doc_out,"%s",body_header);
|
||||
|
||||
doc_e=doc_in->root.next;
|
||||
col=doc_e->x;
|
||||
y=doc_e->y;
|
||||
while (doc_e!=doc_in) {
|
||||
if (!(doc_e->de_flags&DOCEF_SKIP)) {
|
||||
if (line_anchors && y!=old_y) {
|
||||
DocPrint(doc_out,"<a name=\"l%d\"></a>",y+1);
|
||||
old_y=y;
|
||||
}
|
||||
while (y<doc_e->y) {
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,"\n",&col,style_bitmap);
|
||||
if (line_anchors && ++y!=old_y) {
|
||||
DocPrint(doc_out,"<a name=\"l%d\"></a>",y+1);
|
||||
old_y=y;
|
||||
}
|
||||
col=0;
|
||||
}
|
||||
|
||||
no_bwd=TRUE;
|
||||
doc_e2=doc_e->next;
|
||||
while (doc_e2!=doc_in && doc_e2->y==doc_e->y) {
|
||||
if (doc_e2->x<doc_e->x) {
|
||||
no_bwd=FALSE;
|
||||
break;
|
||||
}
|
||||
doc_e2=doc_e2->next;
|
||||
}
|
||||
if (no_bwd)
|
||||
while (col<doc_e->x)
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr," ",&col,style_bitmap);
|
||||
|
||||
link_st=NULL;
|
||||
if (doc_e->de_flags&DOCEF_HTML_LINK)
|
||||
link_st=StrNew(doc_e->html_link);
|
||||
else if (st=DocEntryLink(doc_in,doc_e)) {
|
||||
link_st=link_cvt(st);
|
||||
Free(st);
|
||||
}
|
||||
|
||||
if (link_st) {
|
||||
if (old_u32_attr!=-1) {
|
||||
DocPrint(doc_out,"</span>");
|
||||
old_u32_attr=-1;
|
||||
}
|
||||
DocPrint(doc_out,"<a href=\"%s\">",link_st);
|
||||
}
|
||||
|
||||
switch (doc_e->type_u8) {
|
||||
case DOCT_TEXT:
|
||||
if (doc_e->de_flags&DOCEF_HIGHLIGHT) {
|
||||
if (doc_e->last==doc_in)
|
||||
MemCpy(&doc_e->settings,&doc_in->settings_root,
|
||||
sizeof(CDocSettings));
|
||||
else
|
||||
MemCpy(&doc_e->settings,&doc_e->last->settings,
|
||||
sizeof(CDocSettings));
|
||||
src=hl=DocHighlight(doc_e,doc_e->tag,StrLen(doc_e->tag),
|
||||
doc_e->type&0xFF00);
|
||||
while (*src) {
|
||||
st_2[0]=*src&0xFF;
|
||||
HtmlPutS(doc_out,*src++,&old_u32_attr,st_2,&col,style_bitmap);
|
||||
}
|
||||
Free(hl);
|
||||
} else {
|
||||
if (doc_e->de_flags&DOCEF_CENTER_X && //$BK,1$Nonstandard$BK,0$
|
||||
doc_e->settings.final_u32_attr&0xF00==PURPLE<<8)
|
||||
DocPrint(doc_out,"<h1><center>");
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,doc_e->tag,&col,style_bitmap);
|
||||
if (doc_e->de_flags&DOCEF_CENTER_X && //$BK,1$Nonstandard$BK,0$
|
||||
doc_e->settings.final_u32_attr&0xF00==PURPLE<<8)
|
||||
DocPrint(doc_out,"</center></h1>");
|
||||
}
|
||||
break;
|
||||
case DOCT_TAB:
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,"\t",&col,style_bitmap);
|
||||
break;
|
||||
case DOCT_HTML_CODE:
|
||||
if (old_u32_attr!=-1) {
|
||||
DocPrint(doc_out,"</span>");
|
||||
old_u32_attr=-1;
|
||||
}
|
||||
DocPrint(doc_out,"%s",doc_e->tag);
|
||||
break;
|
||||
case DOCT_SPRITE:
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,doc_e->tag,&col,style_bitmap);
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,"/* Graphics Not Rendered in HTML */",
|
||||
&col,style_bitmap);
|
||||
break;
|
||||
default:
|
||||
if (doc_e->de_flags&DOCEF_TAG)
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,doc_e->tag,&col,style_bitmap);
|
||||
}
|
||||
if (link_st) {
|
||||
if (old_u32_attr!=-1) {
|
||||
DocPrint(doc_out,"</span>");
|
||||
old_u32_attr=-1;
|
||||
}
|
||||
DocPrint(doc_out,"</a>");
|
||||
Free(link_st);
|
||||
}
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
while (y++<doc_e->y) {
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,"\n",&col,style_bitmap);
|
||||
col=0;
|
||||
}
|
||||
if (old_u32_attr!=-1) {
|
||||
if (old_u32_attr&DOCET_BLINK)
|
||||
DocPrint(doc_out,"</blink>");
|
||||
DocPrint(doc_out,"</span>");
|
||||
old_u32_attr=-1;
|
||||
}
|
||||
DocPrint(doc_out,"%s",body_footer);
|
||||
DocPrint(doc_out,"%s",html_footer);
|
||||
|
||||
doc_out->cur_entry=style->next;
|
||||
for (i=0;i<256;i++)
|
||||
if (Bt(style_bitmap,i))
|
||||
DocPrint(doc_out,
|
||||
".c%02X{color:#%02x%02x%02x;background-color:#%02x%02x%02x;}\n",
|
||||
i,p[i&15].r>>8,p[i&15].g>>8,p[i&15].b>>8,
|
||||
p[i/16].r>>8,p[i/16].g>>8,p[i/16].b>>8);
|
||||
doc_out->cur_entry=&doc_out->root;
|
||||
DocRecalc(doc_out);
|
||||
|
||||
doc_in->win_task->text_attr=old_attr;
|
||||
|
||||
if (unlock_doc_in)
|
||||
DocUnlock(doc_in);
|
||||
return doc_out;
|
||||
}
|
||||
|
||||
#help_index "Cmd Line (Typically);DolDoc/Conversion;DolDoc/Cmd Line (Typically)"
|
||||
public U0 TOSToHtml(U8 *_in_name,U8 *_out_name=NULL,U8 *html_header=NULL,
|
||||
U8 *body_header=NULL,U8 *body_footer=NULL,U8 *html_footer=NULL,
|
||||
I64 width=80,Bool line_anchors=TRUE,
|
||||
U8 (*link_cvt)(U8 *link_st)=&TOSLinkCvt1)
|
||||
{//Convert $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.TXT"$file to HTML.
|
||||
//Supply your own link_cvt routine.
|
||||
U8 *in_name,*out_name;
|
||||
CDoc *doc_in,*doc_out;
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
WinHorz(0,width-1); //Sets doc width for word wrap.
|
||||
|
||||
in_name=DftExt(_in_name,"CPP.Z");
|
||||
if (_out_name)
|
||||
out_name=DftExt(_out_name,"html");
|
||||
else
|
||||
out_name=ChgExt(_in_name,"html");
|
||||
|
||||
doc_in=DocRead(in_name);
|
||||
DocTop(doc_in);
|
||||
DocPrint(doc_in,"$$BD,LTCYAN$$"); //$BK,1$Nonstandard$BK,0$
|
||||
doc_out=Doc2Html(doc_in,html_header,body_header,body_footer,html_footer,
|
||||
line_anchors,link_cvt);
|
||||
StrCpy(&doc_out->filename.name,out_name);
|
||||
|
||||
SettingsPop;
|
||||
|
||||
DocWrite(doc_out);
|
||||
DocDel(doc_in);
|
||||
DocDel(doc_out);
|
||||
Free(in_name);
|
||||
Free(out_name);
|
||||
}
|
||||
|
||||
#help_index "TOS"
|
||||
U0 TOSWebFile(U8 *name)
|
||||
{
|
||||
U8 *name2;
|
||||
CDirEntry de;
|
||||
if (FileFind(name,&de)) {
|
||||
Free(de.full_name);
|
||||
"File:%s\n",name;
|
||||
UncollapseFile(name,NULL);
|
||||
Touch(name,"",,de.datetime);
|
||||
name2=ChgExt(name,"html");
|
||||
TOSToHtml(name,name2,
|
||||
"<!DOCTYPE HTML>\n"
|
||||
"<html style=\"background-color:#FFFFFF;\">\n"
|
||||
"<head>\n"
|
||||
"<meta http-equiv=\"Content-Type\" "
|
||||
"content=\"text/html;charset=US-ASCII\">\n"
|
||||
"<title>The Temple Operating System</title>\n"
|
||||
"<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 V4.03",D="DD_OS_NAME_VERSION"$\">\n",
|
||||
|
||||
"<body style=\"background-color:#55FFFF; border-style:solid;
|
||||
border-width:8px; border-color:#0000AA;
|
||||
margin-left:auto; margin-right:auto; width:800px; \">\n"
|
||||
"<pre style=\"font-family:courier;font-size:10pt\">\n"
|
||||
"<div style=\"margin-left:auto; margin-right:auto;"
|
||||
" width: 640px;\">\n",
|
||||
"</div></pre></body>\n",
|
||||
"</html>\n");
|
||||
Touch(name2,"",,de.datetime);
|
||||
Free(name2);
|
||||
}
|
||||
}
|
||||
|
||||
public U0 MakeWebSite()
|
||||
{
|
||||
CDirEntry *tempde,*tempde1;
|
||||
DocClear;
|
||||
Cd("D:/Wb");
|
||||
DelTree("D:/Wb/Home/Budget");
|
||||
DelTree("D:/Wb/Home/Private");
|
||||
Del("D:/Wb/Home/*");
|
||||
Touch("D:/Wb/Home/Web/index.TXT.Z","");
|
||||
Touch("D:/Wb/Home/Web/Downloads.TXT.Z","");
|
||||
Touch("D:/Wb/Home/Web/TempleOS.TXT.Z","");
|
||||
tempde=tempde1=FilesFind("*",
|
||||
FUF_RECURSE|FUF_JUST_FILES|FUF_JUST_TXT|FUF_CLUSTER_ORDER);
|
||||
while (tempde) {
|
||||
TOSWebFile(tempde->full_name);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
Copy( "D:/Wb/Home/Downloads/Bin/TempleBot",
|
||||
"D:/Wb/Home/Downloads/Bin/TempleBot.TXT");
|
||||
ToDolDoc("D:/Wb/Home/Downloads/Bin/TempleBot.TXT");
|
||||
TOSToHtml("D:/Wb/Home/Downloads/Bin/TempleBot.TXT");
|
||||
Del("D:/Wb/Home/Downloads/Bin/TempleBot.TXT");
|
||||
DirTreeDel(tempde1);
|
||||
Drv('C');
|
||||
}
|
||||
|
||||
U0 FreshenWebDir(U8 *dirname)
|
||||
{//No recurse
|
||||
CDirEntry *tempde,*tempde1;
|
||||
U8 *src,*dst;
|
||||
|
||||
MkDir("D:/Wb");
|
||||
MkDir("D:/Wb/Home");
|
||||
MkDir("D:/Wb/Home/Web");
|
||||
MkDir("D:/Wb/Home/Web/TAD");
|
||||
MkDir("D:/Wb/Home/Web/TAD/Blog");
|
||||
|
||||
src=MStrPrint("D:/Wb%s",dirname);
|
||||
MkDir(src);
|
||||
Free(src);
|
||||
|
||||
src=MStrPrint("D:/Wb%s/*",dirname);
|
||||
Del(src);
|
||||
Free(src);
|
||||
|
||||
src=MStrPrint("C:%s/*",dirname);
|
||||
dst=MStrPrint("D:/Wb%s",dirname);
|
||||
Copy(src,dst);
|
||||
Free(src);
|
||||
Free(dst);
|
||||
|
||||
src=MStrPrint("D:/Wb%s/*",dirname);
|
||||
tempde=tempde1=FilesFind(src,FUF_JUST_FILES|FUF_JUST_TXT|FUF_CLUSTER_ORDER);
|
||||
while (tempde) {
|
||||
TOSWebFile(tempde->full_name);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
}
|
||||
@@ -47,11 +47,11 @@ U0 DataDemo()
|
||||
"However, changes happen immediately,\n"
|
||||
"so it's tricky.\n\n";
|
||||
//Use <CTRL-l> for the $$DA...$$ format.
|
||||
doc_e=DocPrint(doc,"$$DA-TRM+RD+UD,32,RT=I16,A=\"%%7d\"$$\n");
|
||||
doc_e=DocPrint(doc,"$$DA-TRM+RD+UD,RT=I16,A=\"%%7d\"$$\n");
|
||||
doc_e->data=&i;
|
||||
|
||||
StrCpy(buf,"Terry");
|
||||
doc_e=DocPrint(doc,"$$DA-P+RD+UD,7,A=\"Str:%%s\"$$\n");
|
||||
doc_e=DocPrint(doc,"$$DA-P+RD+UD,LEN=7,A=\"Str:%%s\"$$\n");
|
||||
doc_e->data=buf;
|
||||
|
||||
if (unlock)
|
||||
|
||||
+15
-8
@@ -4,13 +4,15 @@ class FDStruct
|
||||
//The number is the field from after the ':' to the end.
|
||||
//See $LK,"Data Tag Width",A="FA:::/Adam/DolDoc/DocPlain.CPP,DataTagWidth"$.
|
||||
|
||||
F64 num1 fmtstr "$$DA-TRM,32,RT=F64,A=\"F64 1:%12.8f\"$$\n";
|
||||
F64 num2 fmtstr "$$DA-TRM,32,RT=F64,A=\"F64 2:%12e\"$$\n";
|
||||
I64 num3 fmtstr "$$DA-TRM,32,A=\"I64 1:0x%016X\"$$\n";
|
||||
I64 num4 fmtstr "$$DA-TRM,32,A=\"I64 2:%12d\"$$\n";
|
||||
F64 num1 fmtstr "$$DA-TRM,RT=F64,A=\"F64 1:%12.8f\"$$\n";
|
||||
F64 num2 fmtstr "$$DA-TRM,RT=F64,A=\"F64 2:%12e\"$$\n";
|
||||
I64 num3 fmtstr "$$DA-TRM,A=\"I64 1:0x%016X\"$$\n";
|
||||
I64 num4 fmtstr "$$DA-TRM,A=\"I64 2:%12d\"$$\n";
|
||||
I64 type fmtstr "$$LS,D=\"ST_PERSON_TYPE\"$$\n";
|
||||
U8 name[32] fmtstr "$$DA-P,31,A=\"Name :%s\"$$\n";
|
||||
CDate datetime fmtstr "$$DA-TRM,32,A=\"Date :%8D\"$$\n";
|
||||
U8 name[32] fmtstr "$$DA-P,LEN=31,A=\"Name :%s\"$$\n";
|
||||
U8 *address1 fmtstr "$$DA+M,A=\"Address:%s\"$$\n"; //+M is unlimited len U8 *.
|
||||
U8 *address2 fmtstr "$$DA+M,A=\"Address:%s\"$$\n"; //+M is unlimited len U8 *.
|
||||
CDate datetime fmtstr "$$DA-TRM,A=\"Date :%8D\"$$\n";
|
||||
Bool check fmtstr "$$CB,\"Check\"$$\n";
|
||||
};
|
||||
|
||||
@@ -18,12 +20,14 @@ U0 FormDemo()
|
||||
{
|
||||
FDStruct fds;
|
||||
DefineLstLoad("ST_PERSON_TYPE","Child\0Teen\0Adult\0");
|
||||
fds.num1=12.3e-4; //Set defaults
|
||||
fds.num1=12.3e-4; //Set defaults
|
||||
fds.num2=4.5e3;
|
||||
fds.num3=0x1234;
|
||||
fds.num4=-567;
|
||||
fds.type=1;
|
||||
StrCpy(&fds.name,"John");
|
||||
fds.address1=StrNew("1234 Pine St.");
|
||||
fds.address2=NULL; //Init to NULL if empty.
|
||||
fds.datetime=Now;
|
||||
fds.check=TRUE;
|
||||
if (DocForm(&fds)) {
|
||||
@@ -33,6 +37,8 @@ U0 FormDemo()
|
||||
"#4\t=%d\n",fds.num4;
|
||||
"Type\t=%s\n",DefineSub(fds.type,"ST_PERSON_TYPE");
|
||||
"Name\t=%s\n",fds.name;
|
||||
"Address1=%s\n",fds.address1;
|
||||
"Address2=%s\n",fds.address2;
|
||||
"Date\t=%D\n",fds.datetime;
|
||||
"Check\t=%d\n",fds.check;
|
||||
} else
|
||||
@@ -40,7 +46,8 @@ U0 FormDemo()
|
||||
|
||||
"\n\nClassRep Example\n";
|
||||
ClassRep(&fds);
|
||||
|
||||
Free(fds.address1);
|
||||
Free(fds.address2);
|
||||
//See also $LK,"ClassRepD",A="MN:ClassRepD"$().
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
class Acct
|
||||
{//Use <CTRL-l> to help generate fmtstrs.
|
||||
U8 name[32] fmtstr "$$DA-P,32,A=\"Name:%s\"$$\n";
|
||||
U8 addr[64] fmtstr "$$DA-P,64,A=\"Addr:%s\"$$\n";
|
||||
U8 name[32] fmtstr "$$DA-P,LEN=32,A=\"Name:%s\"$$\n";
|
||||
U8 addr[64] fmtstr "$$DA-P,LEN=64,A=\"Addr:%s\"$$\n";
|
||||
U8 pad[DB_ACCT_BLKS*BLK_SIZE-64-32];
|
||||
};
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ U0 Digits()
|
||||
Fs->text_attr=DKGRAY<<4+WHITE;
|
||||
DocClear;
|
||||
//Set default background and foreground
|
||||
"$$WW,1$$$$BD,DKGRAY$$$$FD,WHITE$$"
|
||||
"$$WW,1$$$$BG,DKGRAY$$$$FD,WHITE$$"
|
||||
"\nThis is a memory game. "
|
||||
"Try to remember the digits and enter them. "
|
||||
"They are colored based on electrical "
|
||||
@@ -46,14 +46,14 @@ restart:
|
||||
MemSet(answer,0,sizeof(answer));
|
||||
while (TRUE) {
|
||||
DocClear;
|
||||
"$$WW,1$$$$BD,DKGRAY$$$$FD,WHITE$$\n";
|
||||
"$$WW,1$$$$BG,DKGRAY$$$$FD,WHITE$$\n";
|
||||
"Pattern\nLength:%d\n\n",num+1;
|
||||
answer[num++]=RandU32%10+'0';
|
||||
PrintPattern(answer);
|
||||
ch=PressAKey;
|
||||
if (ch==CH_ESC||ch==CH_SHIFT_ESC) goto dg_done;
|
||||
DocClear;
|
||||
"$$WW,1$$$$BD,DKGRAY$$$$FD,WHITE$$\n";
|
||||
"$$WW,1$$$$BG,DKGRAY$$$$FD,WHITE$$\n";
|
||||
"Guess\nLength:%d\n\n",num;
|
||||
for (i=0;i<num;i++) {
|
||||
ch=GetChar(,FALSE);
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,202 @@
|
||||
//This file is required by $LK,"::/Demo/Lectures/Mem/Uncached.CPP"$.
|
||||
|
||||
U8 *Mem2MegAlloc(I64 *_pages2Meg,CBlkPool *bp=NULL)
|
||||
{/*Alloc 2Meg pages from BlkPool. Don't link to task.
|
||||
(Linking to a task means they will be freed when the task dies.)
|
||||
It might give you more than you asked for
|
||||
so a ptr to a page count is passed.
|
||||
|
||||
Return: NULL if out of memory.
|
||||
*/
|
||||
I64 i,j,*pte,num=*_pages2Meg;
|
||||
CMemBlk *result=NULL,*m,*m1;
|
||||
|
||||
if (!bp) bp=sys_code_bp;
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&bp->locked_flags,BPlf_LOCKED))
|
||||
PAUSE
|
||||
num<<=21-MEM_PAGE_BITS;
|
||||
|
||||
m=&bp->mem_free_2meg_lst;
|
||||
while (TRUE) {
|
||||
if (!(result=m->next))
|
||||
break;
|
||||
if (result->pages<num)
|
||||
m=result;
|
||||
else {
|
||||
if (result->pages==num) {
|
||||
m->next=result->next;
|
||||
goto am_done;
|
||||
} else {
|
||||
result->pages-=num;
|
||||
result(U8 *)+=result->pages<<MEM_PAGE_BITS;
|
||||
result->pages=num;
|
||||
goto am_done;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m=&bp->mem_free_lst;
|
||||
while (TRUE) {
|
||||
if (!(result=m->next)) {
|
||||
num=0;
|
||||
result=NULL; //Out of memory
|
||||
goto am_done;
|
||||
}
|
||||
if (result->pages<num)
|
||||
m=result;
|
||||
else {
|
||||
if (result->pages==num) {
|
||||
if (result(U8 *)&0x1FFFFF)
|
||||
m=result;
|
||||
else {
|
||||
m->next=result->next;
|
||||
goto am_done;
|
||||
}
|
||||
} else {
|
||||
if (i=(result(U8 *)&0x1FFFFF)>>MEM_PAGE_BITS) {
|
||||
j=1<<(21-MEM_PAGE_BITS)-i;
|
||||
if (result->pages<num+j)
|
||||
m=result;
|
||||
else if (result->pages==num+j) {
|
||||
result->pages-=num;
|
||||
result(U8 *)+=result->pages<<MEM_PAGE_BITS;
|
||||
result->pages=num;
|
||||
goto am_done;
|
||||
} else {
|
||||
m1=result;
|
||||
result(U8 *)+=j<<MEM_PAGE_BITS;
|
||||
result->pages=num;
|
||||
m=result(U8 *)+num<<MEM_PAGE_BITS;
|
||||
m->pages=m1->pages-num-j;
|
||||
m1->pages=j;
|
||||
m->next=m1->next;
|
||||
m1->next=m;
|
||||
m->mb_signature=MBS_UNUSED_SIGNATURE_VAL;
|
||||
goto am_done;
|
||||
}
|
||||
} else {
|
||||
m=m->next=result(U8 *)+num<<MEM_PAGE_BITS;
|
||||
m->next=result->next;
|
||||
m->pages=result->pages-num;
|
||||
m->mb_signature=MBS_UNUSED_SIGNATURE_VAL;
|
||||
result->pages=num;
|
||||
goto am_done;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
am_done:
|
||||
i=num<<MEM_PAGE_BITS;
|
||||
bp->used_u8s+=i;
|
||||
num>>=21-MEM_PAGE_BITS;
|
||||
*_pages2Meg=num;
|
||||
m=result;
|
||||
m1=m(U8 *)+i;
|
||||
while (m<m1) {
|
||||
pte=MemPageTable(m);
|
||||
*pte &= ~0x18;
|
||||
InvlPg(m);
|
||||
m(U8 *)+=MemPageSize(m);
|
||||
}
|
||||
LBtr(&bp->locked_flags,BPlf_LOCKED);
|
||||
POPFD
|
||||
return result;
|
||||
}
|
||||
|
||||
U8 *Mem2MegUncachedAlloc(I64 *_pages2Meg,CBlkPool *bp=NULL)
|
||||
{/*Alloc 2Meg pages from BlkPool. Don't link to task.
|
||||
(Linking to a task means they will be freed when the task dies.)
|
||||
It will be marked uncached. It might give you more than you asked for
|
||||
so a ptr to a page count is passed.
|
||||
|
||||
Return: NULL if out of memory.
|
||||
*/
|
||||
CMemBlk *result,*m,*m1;
|
||||
I64 num=*_pages2Meg,*pte;
|
||||
if (result=Mem2MegAlloc(_pages2Meg,bp)) {
|
||||
num=*_pages2Meg;
|
||||
m=result;
|
||||
m1=m(U8 *)+num<<21;
|
||||
while (m<m1) {
|
||||
pte=MemPageTable(m);
|
||||
*pte= *pte& ~0x18 |0x10;
|
||||
InvlPg(m);
|
||||
m(U8 *)+=MemPageSize(m);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
U8 *Mem2MegWriteThruAlloc(I64 *_pages2Meg,CBlkPool *bp=NULL)
|
||||
{/*Alloc 2Meg pages from BlkPool. Don't link to task.
|
||||
(Linking to a task means they will be freed when the task dies.)
|
||||
It will be marked write-through. It might give you more than you asked for
|
||||
so a ptr to a page count is passed.
|
||||
|
||||
Return: NULL if out of memory.
|
||||
*/
|
||||
CMemBlk *result,*m,*m1;
|
||||
I64 num=*_pages2Meg,*pte;
|
||||
if (result=Mem2MegAlloc(_pages2Meg,bp)) {
|
||||
num=*_pages2Meg;
|
||||
m=result;
|
||||
m1=m(U8 *)+num<<21;
|
||||
while (m<m1) {
|
||||
pte=MemPageTable(m);
|
||||
*pte= *pte& ~0x18 |8;
|
||||
InvlPg(m);
|
||||
m(U8 *)+=MemPageSize(m);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
U0 Mem2MegFree(CMemBlk *m,I64 pages2Meg,CBlkPool *bp=NULL)
|
||||
{//Return non-task 2Meg pages to BlkPool.
|
||||
I64 *pte;
|
||||
CMemBlk *m1,*m2;
|
||||
if (m) {
|
||||
if (!bp) bp=sys_code_bp;
|
||||
m2=m;
|
||||
m1=m(U8 *)+pages2Meg<<21;
|
||||
while (m2<m1) {
|
||||
pte=MemPageTable(m2);
|
||||
*pte=*pte & ~0x18;
|
||||
InvlPg(m2);
|
||||
m2(U8 *)+=MemPageSize(m2);
|
||||
}
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&bp->locked_flags,BPlf_LOCKED))
|
||||
PAUSE
|
||||
m->mb_signature=MBS_UNUSED_SIGNATURE_VAL;
|
||||
m->pages=pages2Meg<<(21-MEM_PAGE_BITS);
|
||||
bp->used_u8s-=pages2Meg<<21;
|
||||
m->next=bp->mem_free_2meg_lst;
|
||||
bp->mem_free_2meg_lst=m;
|
||||
LBtr(&bp->locked_flags,BPlf_LOCKED);
|
||||
POPFD
|
||||
}
|
||||
}
|
||||
|
||||
CHeapCtrl *HeapCtrlBPInit(CBlkPool *bp,I64 pages512)
|
||||
{//Make mem chunk into HeapCtrl and BlkPool.
|
||||
I64 num;
|
||||
CMemBlk *m;
|
||||
CHeapCtrl *hc;
|
||||
MemSet(bp,0,sizeof(CBlkPool)+sizeof(CHeapCtrl));
|
||||
hc=HeapCtrlInit(bp(U8 *)+sizeof(CBlkPool),,bp);
|
||||
m=(bp(U8 *)+sizeof(CBlkPool)+sizeof(CHeapCtrl)+MEM_PAGE_SIZE-1)&
|
||||
~(MEM_PAGE_SIZE-1);
|
||||
num=(bp(U8 *)+pages512<<MEM_PAGE_BITS-m(U8 *))>>MEM_PAGE_BITS;
|
||||
bp->alloced_u8s=(pages512-num)<<MEM_PAGE_BITS;
|
||||
BlkPoolAdd(bp,m,num);
|
||||
return hc;
|
||||
}
|
||||
|
||||
/* PCI hardware devices, when they require uncached memory buffers, need
|
||||
this code. TempleOS, however, has a law requiring only IN/OUT port hardware
|
||||
access except VGA, handled here: $LK,"::/Kernel/Mem/PageTables.CPP"$.
|
||||
*/
|
||||
@@ -43,6 +43,5 @@ U0 PageTableDemo1()
|
||||
|
||||
PageTableDemo1;
|
||||
|
||||
//See $LK,"Mem2MegAlloc",A="MN:Mem2MegAlloc"$(), $LK,"Mem2MegFree",A="MN:Mem2MegFree"$() for page aligned allocations.
|
||||
//See $LK,"CBlkPool",A="MN:CBlkPool"$, $LK,"CHeapCtrl",A="MN:CHeapCtrl"$, $LK,"sys_code_bp",A="MN:sys_code_bp"$ and $LK,"sys_data_bp",A="MN:sys_data_bp"$.
|
||||
//See $LK,"Memory Overview",A="FI:::/Doc/MemOverview.TXT"$ and $LK,"Memory Routines",A="HI:Memory"$.
|
||||
File renamed without changes.
@@ -1,5 +1,9 @@
|
||||
#define SAMPLE_SIZE 100000
|
||||
// Requires $LK,"::/Demo/Lectures/Mem/Mem2Meg.CPP"$.
|
||||
|
||||
Cd(__DIR__);;
|
||||
#include "Mem2Meg"
|
||||
|
||||
#define SAMPLE_SIZE 100000
|
||||
U0 TimeIns()
|
||||
{
|
||||
I64 i,start,end;
|
||||
@@ -40,12 +44,3 @@ U0 TimeIns()
|
||||
}
|
||||
|
||||
TimeIns;
|
||||
|
||||
/*Program Output$HL,0$$WW+H,1$$FD,1$
|
||||
8 Cores 2.660GHz
|
||||
Cached Cycles: 202,220
|
||||
Uncached Cycles: 14,357,016
|
||||
|
||||
$FG,2$The difference is even greater
|
||||
because the loop overhead was not subtracted.
|
||||
$HL,1$*/
|
||||
@@ -1 +1 @@
|
||||
╡▓H╝+5╫?кO╓╨█mц?Ч≥Qфк?ЧeХмЦ?═<н╪$╫Д?ph─┐h║Ф?┼┤3ЖЖ╦И?T3Д≈eЙ?рp1й М?'␍GХЖ"О?
|
||||
rZÅ¡Jþ‘?¨È³a©h·?£û(JéqÌ?»±wÌݧÖ?Œ@ðß?•¡âŽ@Pà?@55¼Ã;â?ÉSä[}Pä?vŽ’)é?¯B5´´Õï?
|
||||
@@ -1,11 +1,11 @@
|
||||
//This is sorted.
|
||||
0.095336
|
||||
0.105530
|
||||
0.318999
|
||||
0.412453
|
||||
0.621226
|
||||
0.711749
|
||||
0.960501
|
||||
0.965063
|
||||
0.981767
|
||||
0.988804
|
||||
0.167187
|
||||
0.196175
|
||||
0.280106
|
||||
0.366963
|
||||
0.403184
|
||||
0.591110
|
||||
0.726180
|
||||
0.749633
|
||||
0.795656
|
||||
0.926049
|
||||
@@ -1 +1 @@
|
||||
�‡3צצ¸י? <־¼$½ה?eטֽד?™Qֶֻ?ֻO₪÷�mֳ?'␍Gטצ"ן?ph€ƒh¡ז?²’H®+5½?T3ה—eך?ׂp1ֺ ם?
|
||||
¯B5´´Õï?¨È³a©h·?@55¼Ã;â?vŽ’)é?»±wÌݧÖ?£û(JéqÌ?•¡âŽ@Pà?Œ@ðß?ÉSä[}Pä?rZÅ¡Jþ‘?
|
||||
@@ -1,11 +1,11 @@
|
||||
//This is unsorted.
|
||||
0.711749
|
||||
0.988804
|
||||
0.095336
|
||||
0.318999
|
||||
0.965063
|
||||
0.105530
|
||||
0.621226
|
||||
0.960501
|
||||
0.412453
|
||||
0.981767
|
||||
0.926049
|
||||
0.591110
|
||||
0.196175
|
||||
0.749633
|
||||
0.403184
|
||||
0.280106
|
||||
0.366963
|
||||
0.726180
|
||||
0.167187
|
||||
0.795656
|
||||
@@ -4,21 +4,22 @@ an html document named "OutPage.html".
|
||||
Notice that an entry like $$TX,"GOOGLE",HTML="http://www.google.com"$$
|
||||
will be converted to text in the html with an html link.
|
||||
|
||||
I cheated by hardcoding $LK,"www.templeos.org",A="FF:::/Adam/Opt/Utils/ToHtml.CPP,www.templeos.org"$ as the website
|
||||
for $LK,"TempleOS Links",A="MN:LK_FILE"$. Why don't you copy $LK,"::/Adam/Opt/Utils/ToHtml.CPP"$
|
||||
to your /Home directory and modify it? You are welcome
|
||||
to link to http://www.templeos.org if you want file
|
||||
that come on the TempleOS distribution.
|
||||
I cheated by hardcoding $LK,"www.templeos.org",A="FF:::/Demo/ToHtmlToTXTExample/ToHtml.CPP,www.templeos.org"$ as the website
|
||||
for $LK,"TempleOS Links",A="MN:LK_FILE"$. Why don't you copy
|
||||
$LK,"::/Demo/ToHtmlToTXTExample/ToHtml.CPP"$ to your /Home directory
|
||||
and modify it? You are welcome to link to
|
||||
http://www.templeos.org if you want file that come on the
|
||||
TempleOS distribution.
|
||||
|
||||
You can pass html meta data as args to $LK,"ToHtml",A="MN:ToHtml"$().
|
||||
You can pass html meta data as args to $LK,"ToHtml",A="FF:::/Demo/ToHtmlToTXTExample/ToHtml.CPP,ToHtml"$().
|
||||
|
||||
If you want to blog like I do, see these files...
|
||||
$LK,"::/Demo/AcctExample/TOSToHtml.CPP"$
|
||||
$LK,"::/Demo/AcctExample/HomeKeyPlugIns.CPP"$
|
||||
$LK,"::/Demo/AcctExample/TOSHolySpirit.CPP"$
|
||||
$LK,"MakeWebSite",A="FF:::/Demo/AcctExample/TOSDistro.CPP,MakeWebSite"$()
|
||||
|
||||
*/
|
||||
|
||||
Cd(__DIR__);;
|
||||
#include "ToHtml"
|
||||
|
||||
ToHtml("InPage.TXT.Z","OutPage.html");
|
||||
@@ -0,0 +1,334 @@
|
||||
#help_index "DolDoc/Conversion"
|
||||
|
||||
//See $LK,"::/Doc/Credits.TXT"$.
|
||||
|
||||
U0 HtmlPutS(CDoc *doc,I64 u32_attr,I64 *_old_u32_attr,
|
||||
U8 *st,I64 *_col,U8 *style_bitmap=NULL)
|
||||
{
|
||||
U8 *ch,*ptr;
|
||||
u32_attr&=0xFFFFFF00;
|
||||
if (u32_attr&DOCET_INVERT)
|
||||
u32_attr.u8[1]=(u32_attr.u8[1]&15)<<4|u32_attr.u8[1]>>4;
|
||||
if (u32_attr!=*_old_u32_attr) {
|
||||
if (!(u32_attr&DOCET_BLINK) &&
|
||||
*_old_u32_attr!=-1 && *_old_u32_attr&DOCET_BLINK)
|
||||
DocPrint(doc,"</blink>");
|
||||
if (*_old_u32_attr!=-1)
|
||||
DocPrint(doc,"</span>");
|
||||
DocPrint(doc,"<span class=c%02X>",u32_attr.u8[1]);
|
||||
if (u32_attr&DOCET_BLINK &&
|
||||
(*_old_u32_attr==-1 || !(*_old_u32_attr&DOCET_BLINK)))
|
||||
DocPrint(doc,"<blink>");
|
||||
*_old_u32_attr=u32_attr;
|
||||
if (style_bitmap)
|
||||
LBts(style_bitmap,u32_attr.u8[1]);
|
||||
}
|
||||
while (ch=*st++) {
|
||||
switch (ch) {
|
||||
case '\t':
|
||||
do {
|
||||
DocPutKey(doc,CH_SPACE,0);
|
||||
*_col=*_col+1;
|
||||
} while (*_col&7);
|
||||
break;
|
||||
|
||||
sub_switch_start:
|
||||
case 'ã': ptr="pi"; break;
|
||||
case 'é': ptr="theta"; break;
|
||||
case 'è': ptr="phi"; break;
|
||||
case 'ê': ptr="omega"; break;
|
||||
case 'ì': ptr="inf"; break;
|
||||
case 'æ': ptr="u"; break;
|
||||
sub_switch_end:
|
||||
DocPrint(doc,ptr);
|
||||
*_col=*_col+StrLen(ptr);
|
||||
break;
|
||||
|
||||
sub_switch_start:
|
||||
case CH_SHIFT_SPACE: ptr=" "; break;
|
||||
case '&': ptr="&"; break;
|
||||
case '<': ptr="<"; break;
|
||||
case '>': ptr=">"; break;
|
||||
case '"': ptr="""; break;
|
||||
sub_switch_end:
|
||||
DocPrint(doc,ptr);
|
||||
*_col=*_col+1;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (CH_SPACE<=ch<0x7F || ch=='\n')
|
||||
DocPutKey(doc,ch,0);
|
||||
else
|
||||
DocPrint(doc,".");
|
||||
*_col=*_col+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
U8 *TOSLinkCvt2(U8 *filename,I64 line_num)
|
||||
{// ::/ --> http://www.templeos.org/Wb/
|
||||
//Make your own LinkCvt routine
|
||||
U8 *result=NULL,*st;
|
||||
if (filename) {
|
||||
st=ChgExt(filename,"html");
|
||||
if (st && StrLen(st)>3 && !StrNCmp(st+1,":/",2))
|
||||
result=MStrPrint("http://www.templeos.org/Wb/%s#l%d",st+3,line_num);
|
||||
Free(st);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
U8 *TOSLinkCvt1(U8 *link_st)
|
||||
{
|
||||
static CDoc *bible=NULL;
|
||||
static I64 locks=0;
|
||||
U8 *result=NULL,*filename,*needle;
|
||||
I64 i,num;
|
||||
if (link_st) {
|
||||
switch (i=EdLinkCvt(link_st,&filename,&needle,&num)) {
|
||||
case LK_FILE_LINE:
|
||||
case LK_PLAIN_LINE:
|
||||
case LK_FILE:
|
||||
result=TOSLinkCvt2(filename,num);
|
||||
break;
|
||||
case -1:
|
||||
case LK_DEF:
|
||||
case LK_HELP_INDEX:
|
||||
case LK_DOC:
|
||||
case LK_DOC_ANCHOR:
|
||||
case LK_DOC_FIND:
|
||||
case LK_DOC_LINE:
|
||||
break;
|
||||
case LK_BIBLE_FIND:
|
||||
while (LBts(&locks,0))
|
||||
Yield;
|
||||
if (!bible)
|
||||
bible=Adam("DocRead(\"%s\");",filename);
|
||||
if (DocFind(bible,num,needle))
|
||||
result=TOSLinkCvt2(filename,bible->cur_entry->y+1);
|
||||
LBtr(&locks,0);
|
||||
break;
|
||||
default:
|
||||
if (DocFileEd(i,filename,needle,&num,EDF_UNCOLLAPSE|EDF_BAIL))
|
||||
result=TOSLinkCvt2(filename,num);
|
||||
}
|
||||
Free(filename);
|
||||
Free(needle);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public CDoc *Doc2Html(CDoc *doc_in,U8 *html_header=NULL,U8 *body_header=NULL,
|
||||
U8 *body_footer=NULL,U8 *html_footer=NULL,Bool line_anchors=TRUE,
|
||||
U8 (*link_cvt)(U8 *link_st)=&TOSLinkCvt1)
|
||||
{//Cvt $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.TXT"$doc to HTML file.
|
||||
CDocEntry *doc_e,*style,*doc_e2;
|
||||
I64 i,y,old_y=MIN_I64,col,old_u32_attr=-1,old_attr;
|
||||
U32 *hl,*src;
|
||||
U8 *st,st_2[2],*link_st,*style_bitmap=CAlloc(256/8);
|
||||
CBGR48 p[NUM_COLORS];
|
||||
GrPaletteGet(p);
|
||||
CDoc *doc_out=DocNew;
|
||||
Bool unlock_doc_in=DocLock(doc_in),no_bwd;
|
||||
|
||||
old_attr=doc_in->win_task->text_attr;
|
||||
doc_in->win_task->text_attr=DOC_ATTR_DFT_TEXT;
|
||||
|
||||
for (i=0xF0;i<=0xFF;i++)
|
||||
LBts(style_bitmap,i);
|
||||
|
||||
DocRecalc(doc_in,RECALCt_NORMAL|RECALCF_TO_HTML);
|
||||
|
||||
st_2[0]=0; st_2[1]=0;
|
||||
doc_out->flags|=DOCF_PLAIN_TEXT|DOCF_NO_CURSOR;
|
||||
|
||||
if (!html_header) html_header=
|
||||
"<!DOCTYPE HTML>\n"
|
||||
"<html>\n"
|
||||
"<head>\n"
|
||||
"<meta http-equiv=\"Content-Type\" "
|
||||
"content=\"text/html;charset=US-ASCII\">\n"
|
||||
"<meta name=\"generator\" content=\"$TX,"TempleOS V4.03",D="DD_OS_NAME_VERSION"$\">\n";
|
||||
if (!body_header) body_header=
|
||||
"<body>\n"
|
||||
"<pre style=\"font-family:courier;font-size:10pt\">\n";
|
||||
if (!body_footer) body_footer=
|
||||
"</pre></body>\n</html>\n";
|
||||
if (!html_footer) html_footer=
|
||||
"</html>\n";
|
||||
|
||||
DocPrint(doc_out,"%s",html_header);
|
||||
|
||||
DocPrint(doc_out,"<style type=\"text/css\">\n");
|
||||
style=doc_out->cur_entry->last;
|
||||
DocPrint(doc_out,
|
||||
"</style>\n"
|
||||
"</head>\n");
|
||||
DocPrint(doc_out,"%s",body_header);
|
||||
|
||||
doc_e=doc_in->root.next;
|
||||
col=doc_e->x;
|
||||
y=doc_e->y;
|
||||
while (doc_e!=doc_in) {
|
||||
if (!(doc_e->de_flags&DOCEF_SKIP)) {
|
||||
if (line_anchors && y!=old_y) {
|
||||
DocPrint(doc_out,"<a name=\"l%d\"></a>",y+1);
|
||||
old_y=y;
|
||||
}
|
||||
while (y<doc_e->y) {
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,"\n",&col,style_bitmap);
|
||||
if (line_anchors && ++y!=old_y) {
|
||||
DocPrint(doc_out,"<a name=\"l%d\"></a>",y+1);
|
||||
old_y=y;
|
||||
}
|
||||
col=0;
|
||||
}
|
||||
|
||||
no_bwd=TRUE;
|
||||
doc_e2=doc_e->next;
|
||||
while (doc_e2!=doc_in && doc_e2->y==doc_e->y) {
|
||||
if (doc_e2->x<doc_e->x) {
|
||||
no_bwd=FALSE;
|
||||
break;
|
||||
}
|
||||
doc_e2=doc_e2->next;
|
||||
}
|
||||
if (no_bwd)
|
||||
while (col<doc_e->x)
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr," ",&col,style_bitmap);
|
||||
|
||||
link_st=NULL;
|
||||
if (doc_e->de_flags&DOCEF_HTML_LINK)
|
||||
link_st=StrNew(doc_e->html_link);
|
||||
else if (st=DocEntryLink(doc_in,doc_e)) {
|
||||
link_st=link_cvt(st);
|
||||
Free(st);
|
||||
}
|
||||
|
||||
if (link_st) {
|
||||
if (old_u32_attr!=-1) {
|
||||
DocPrint(doc_out,"</span>");
|
||||
old_u32_attr=-1;
|
||||
}
|
||||
DocPrint(doc_out,"<a href=\"%s\">",link_st);
|
||||
}
|
||||
|
||||
switch (doc_e->type_u8) {
|
||||
case DOCT_TEXT:
|
||||
if (doc_e->de_flags&DOCEF_HIGHLIGHT) {
|
||||
if (doc_e->last==doc_in)
|
||||
MemCpy(&doc_e->settings,&doc_in->settings_root,
|
||||
sizeof(CDocSettings));
|
||||
else
|
||||
MemCpy(&doc_e->settings,&doc_e->last->settings,
|
||||
sizeof(CDocSettings));
|
||||
src=hl=DocHighlight(doc_e,doc_e->tag,StrLen(doc_e->tag),
|
||||
doc_e->type&0xFF00);
|
||||
while (*src) {
|
||||
st_2[0]=*src&0xFF;
|
||||
HtmlPutS(doc_out,*src++,&old_u32_attr,st_2,&col,style_bitmap);
|
||||
}
|
||||
Free(hl);
|
||||
} else
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,doc_e->tag,&col,style_bitmap);
|
||||
break;
|
||||
case DOCT_TAB:
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,"\t",&col,style_bitmap);
|
||||
break;
|
||||
case DOCT_HTML_CODE:
|
||||
if (old_u32_attr!=-1) {
|
||||
DocPrint(doc_out,"</span>");
|
||||
old_u32_attr=-1;
|
||||
}
|
||||
DocPrint(doc_out,"%s",doc_e->tag);
|
||||
break;
|
||||
case DOCT_SPRITE:
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,doc_e->tag,&col,style_bitmap);
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,"/* Graphics Not Rendered in HTML */",
|
||||
&col,style_bitmap);
|
||||
break;
|
||||
default:
|
||||
if (doc_e->de_flags&DOCEF_TAG)
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,doc_e->tag,&col,style_bitmap);
|
||||
}
|
||||
if (link_st) {
|
||||
if (old_u32_attr!=-1) {
|
||||
DocPrint(doc_out,"</span>");
|
||||
old_u32_attr=-1;
|
||||
}
|
||||
DocPrint(doc_out,"</a>");
|
||||
Free(link_st);
|
||||
}
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
while (y++<doc_e->y) {
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,"\n",&col,style_bitmap);
|
||||
col=0;
|
||||
}
|
||||
if (old_u32_attr!=-1) {
|
||||
if (old_u32_attr&DOCET_BLINK)
|
||||
DocPrint(doc_out,"</blink>");
|
||||
DocPrint(doc_out,"</span>");
|
||||
old_u32_attr=-1;
|
||||
}
|
||||
DocPrint(doc_out,"%s",body_footer);
|
||||
DocPrint(doc_out,"%s",html_footer);
|
||||
|
||||
doc_out->cur_entry=style->next;
|
||||
for (i=0;i<256;i++)
|
||||
if (Bt(style_bitmap,i))
|
||||
DocPrint(doc_out,
|
||||
".c%02X{color:#%02x%02x%02x;background-color:#%02x%02x%02x;}\n",
|
||||
i,p[i&15].r>>8,p[i&15].g>>8,p[i&15].b>>8,
|
||||
p[i/16].r>>8,p[i/16].g>>8,p[i/16].b>>8);
|
||||
doc_out->cur_entry=&doc_out->root;
|
||||
DocRecalc(doc_out);
|
||||
|
||||
doc_in->win_task->text_attr=old_attr;
|
||||
|
||||
if (unlock_doc_in)
|
||||
DocUnlock(doc_in);
|
||||
return doc_out;
|
||||
}
|
||||
|
||||
#help_index "Cmd Line (Typically);DolDoc/Conversion;DolDoc/Cmd Line (Typically)"
|
||||
public U0 ToHtml(U8 *_in_name,U8 *_out_name=NULL,U8 *html_header=NULL,
|
||||
U8 *body_header=NULL,U8 *body_footer=NULL,U8 *html_footer=NULL,
|
||||
I64 width=80,Bool line_anchors=TRUE,
|
||||
U8 (*link_cvt)(U8 *link_st)=&TOSLinkCvt1)
|
||||
{//Convert $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.TXT"$file to HTML.
|
||||
//Supply your own link_cvt routine.
|
||||
U8 *in_name,*out_name;
|
||||
CDoc *doc_in,*doc_out;
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
WinHorz(0,width-1); //Sets doc width for word wrap.
|
||||
|
||||
in_name=DftExt(_in_name,"CPP.Z");
|
||||
if (_out_name)
|
||||
out_name=DftExt(_out_name,"html");
|
||||
else
|
||||
out_name=ChgExt(_in_name,"html");
|
||||
|
||||
doc_in=DocRead(in_name);
|
||||
doc_out=Doc2Html(doc_in,html_header,body_header,body_footer,html_footer,
|
||||
line_anchors,link_cvt);
|
||||
StrCpy(&doc_out->filename.name,out_name);
|
||||
|
||||
SettingsPop;
|
||||
|
||||
DocWrite(doc_out);
|
||||
DocDel(doc_in);
|
||||
DocDel(doc_out);
|
||||
Free(in_name);
|
||||
Free(out_name);
|
||||
}
|
||||
@@ -723,7 +723,7 @@
|
||||
34.222.78.124 - - [11/Feb/2015:15:14:30 -0800] "GET /TempleOSCD.ISO HTTP/1.1" 200 786432 "-" "Mozilla/5.0 Gecko/20100115 Firefox/3.6" "www.templeos.org"
|
||||
88.41.4.142 - - [11/Feb/2015:15:14:51 -0800] "GET /Wb/Demo/Graphics/LowPassFilter.html HTTP/1.1" 200 31098 "http://www.templeos.org/Wb/Home/Web/LineRep.html" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36" "www.templeos.org"
|
||||
229.137.198.53 - - [11/Feb/2015:15:16:43 -0800] "GET /TempleOSCD.ISO HTTP/1.1" 200 655360 "-" "Mozilla/5.0 Gecko/20100115 Firefox/3.6" "www.templeos.org"
|
||||
228.141.141.213 - - [11/Feb/2015:15:18:24 -0800] "GET /Wb/Demo/Lectures/Uncached.html HTTP/1.1" 200 25539 "-" "Mozilla/5.0 (compatible; DotBot/1.1; http://www.opensiteexplorer.org/dotbot, help@moz.com)" "www.templeos.org"
|
||||
228.141.141.213 - - [11/Feb/2015:15:18:24 -0800] "GET /Wb/Demo/Lectures/Mem/Uncached.html HTTP/1.1" 200 25539 "-" "Mozilla/5.0 (compatible; DotBot/1.1; http://www.opensiteexplorer.org/dotbot, help@moz.com)" "www.templeos.org"
|
||||
115.195.71.92 - - [11/Feb/2015:15:20:23 -0800] "GET / HTTP/1.1" 200 6329 "http://disqus.com/embed/comments/?base=default&version=59a235bdb0503729dbf2f256a99267ac&f=hausdorff&t_u=http%3A%2F%2Fblog.nullspace.io%2Fkernel-latency.html&t_d=84%25%20of%20a%20single-threaded%201KB%20write%20in%20Redis%20is%20spent%20in%20the%20kernel&t_t=84%25%20of%20a%20single-threaded%201KB%20write%20in%20Redis%20is%20spent%20in%20the%20kernel&s_o=default" "Mozilla/5.0 (Linux; Android 4.4.2; SM-G900F Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.109 Mobile Safari/537.36" "www.templeos.org"
|
||||
115.195.71.92 - - [11/Feb/2015:15:20:27 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 "-" "Mozilla/5.0 (Linux; Android 4.4.2; SM-G900F Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.109 Mobile Safari/537.36" "www.templeos.org"
|
||||
115.195.71.92 - - [11/Feb/2015:15:20:48 -0800] "GET /Wb/Doc/AboutTempleOS.html HTTP/1.1" 200 4925 "http://www.templeos.org/" "Mozilla/5.0 (Linux; Android 4.4.2; SM-G900F Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.109 Mobile Safari/537.36" "www.templeos.org"
|
||||
|
||||
Reference in new issue
Block a user