diff --git a/TempleOSCD/0000Boot/0000Kernel.BIN.C b/TempleOSCD/0000Boot/0000Kernel.BIN.C index 2dd256a..056189d 100644 Binary files a/TempleOSCD/0000Boot/0000Kernel.BIN.C and b/TempleOSCD/0000Boot/0000Kernel.BIN.C differ diff --git a/TempleOSCD/Adam/ADefine.HC b/TempleOSCD/Adam/ADefine.HC index a861bb4..f50b571 100644 --- a/TempleOSCD/Adam/ADefine.HC +++ b/TempleOSCD/Adam/ADefine.HC @@ -18,8 +18,8 @@ U0 LoadDocDefines() //$LK,"DD_BOOT_HIGH_LOC_DVD",A="FF:::/Adam/Opt/Boot/BootDVD.HC,DD_BOOT_HIGH_LOC_DVD"$ $TR-C,"LineRep"$ -$ID,4$DefinePrint("DD_TEMPLEOS_LOC","120,563"); -DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","82,013"); +$ID,4$DefinePrint("DD_TEMPLEOS_LOC","120,690"); +DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","82,062"); $ID,-4$ DefinePrint("DD_MP_VECT","%08X",MP_VECT_ADDR); DefinePrint("DD_MP_VECT_END","%08X", diff --git a/TempleOSCD/Adam/AHash.HC b/TempleOSCD/Adam/AHash.HC index aca22ce..105c398 100644 --- a/TempleOSCD/Adam/AHash.HC +++ b/TempleOSCD/Adam/AHash.HC @@ -157,7 +157,7 @@ U8 *idx=NULL,CDoc *doc=NULL) CHashGeneric *ptr; CWho *lst; I64 cnt,i,j,k,f=0; - U8 buf[512],*st,*last_idx=StrNew(""),*cur_idx,*comment; + U8 buf[512],*last_idx=StrNew(""),*cur_idx,*comment; Bool recurse,publics,map; CTask *task; @@ -267,13 +267,11 @@ U8 *idx=NULL,CDoc *doc=NULL) if (!idx) { if (ptr->type & HTT_DEFINE_STR) { - st=MStrUtil(ptr(CHashDefineStr *)->data,SUF_SAFE_DOLLAR); j=ptr(CHashDefineStr *)->cnt; if (j==-1) - StrPrint(buf,"%-10tQ ",st); + StrPrint(buf,"%-10t$$Q ",ptr(CHashDefineStr *)->data); else - StrPrint(buf,"%-10tQ %02X",st,j); - Free(st); + StrPrint(buf,"%-10t$$Q %02X",ptr(CHashDefineStr *)->data,j); } else if (ptr->type & HTT_GLBL_VAR) StrPrint(buf,"%010X ",ptr(CHashGlblVar *)->data_addr); else diff --git a/TempleOSCD/Adam/DolDoc/DocGet.HC b/TempleOSCD/Adam/DolDoc/DocGet.HC index 85d9dd5..e0d7cb5 100644 --- a/TempleOSCD/Adam/DolDoc/DocGet.HC +++ b/TempleOSCD/Adam/DolDoc/DocGet.HC @@ -51,6 +51,12 @@ public U8 *DocScanLine(CDoc *doc,CDocEntry *doc_e, i+=StrLen(src); } else if (doc_e2->type_u8==DOCT_TAB) i++; + else if (doc_e2->type_u8==DOCT_SHIFTED_X || + doc_e2->type_u8==DOCT_SHIFTED_Y) { + if (doc_e2->attr<0) + i++; + i+=6; //$$SY,3$$ + } doc_e2=doc_e2->next; } res=MAlloc(i+1); @@ -63,6 +69,19 @@ public U8 *DocScanLine(CDoc *doc,CDocEntry *doc_e, *dst++=*src++; } else if (doc_e->type_u8==DOCT_TAB) *dst++='\t'; + else if (doc_e->type_u8==DOCT_SHIFTED_Y) { + *dst(U32 *)++='$$SY,'; + if (doc_e->attr<0) + *dst++='-'; + *dst++='0'+AbsI64(doc_e->attr); //Supposedly -7 to 7 (single digit) + *dst++='$$'; + } else if (doc_e->type_u8==DOCT_SHIFTED_X) { + *dst(U32 *)++='$$SX,'; + if (doc_e->attr<0) + *dst++='-'; + *dst++='0'+AbsI64(doc_e->attr); //Supposedly -7 to 7 (single digit) + *dst++='$$'; + } if (doc_e==doc->cur_entry && cur_col) *cur_col=start-res+doc->cur_col; doc_e=doc_e->next; diff --git a/TempleOSCD/Adam/Gr/GrBitMap.HC b/TempleOSCD/Adam/Gr/GrBitMap.HC index f85f7a6..8ac6528 100644 --- a/TempleOSCD/Adam/Gr/GrBitMap.HC +++ b/TempleOSCD/Adam/Gr/GrBitMap.HC @@ -858,19 +858,36 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch) I64 GrPutS(CDC *dc=gr.dc,I64 x,I64 y,U8 *_s) {//Use $LK,"GrPrint",A="MN:GrPrint"$() - I64 x0,ch,res; + I64 x0,sx=0,sy=0,res; if (!_s) return 0; x0=x; res=0; - while (ch=*_s++) { - if (ch=='\n') { + while (*_s) { + if (*_s=='\n') { x=x0; y+=FONT_HEIGHT; - } else if (ch=='\t') + _s++; + } else if (*_s=='\t') { x=x0+CeilU64(x-x0+FONT_WIDTH,8*FONT_WIDTH); - else { - res+=GrPutChar(dc,x,y,ch); + _s++; + } else if (*_s(U32 *)=='$$SY,') { + if (_s[4]=='-') { + _s++; + sy='0'-_s[4]; + } else + sy=_s[4]-'0'; + _s+=6; + } else if (*_s(U32 *)=='$$SX,') { + if (_s[4]=='-') { + _s++; + sx='0'-_s[4]; + } else + sx=_s[4]-'0'; + _s+=6; + } else { + res+=GrPutChar(dc,x+sx,y+sy,*_s); x+=FONT_WIDTH; + _s++; } } return res; @@ -878,20 +895,36 @@ I64 GrPutS(CDC *dc=gr.dc,I64 x,I64 y,U8 *_s) I64 GrVPutS(CDC *dc=gr.dc,I64 x,I64 y,U8 *_s) {//Vertical Text. Use $LK,"GrVPrint",A="MN:GrVPrint"$() - I64 y0,res; + I64 y0,sx=0,sy=0,res; U8 buf[2]; if (!_s) return 0; y0=y; res=0; - buf[1]=0; - while (*buf=*_s++) { - if (*buf=='\n') { + while (*_s) { + if (*_s=='\n') { y=y0; x+=FONT_WIDTH; - } else if (*buf=='\t') + _s++; + } else if (*_s=='\t') { y=y0+CeilU64(y-y0+FONT_HEIGHT,8*FONT_HEIGHT); - else { + _s++; + } else if (*_s(U32 *)=='$$SY,') { + if (_s[4]=='-') { + _s++; + sx='0'-_s[4]; + } else + sx=_s[4]-'0'; + _s+=6; + } else if (*_s(U32 *)=='$$SX,') { + if (_s[4]=='-') { + _s++; + sy='0'-_s[4]; + } else + sy=_s[4]-'0'; + _s+=6; + } else { + *buf=*_s++; res+=GrPutS(dc,x,y,buf); y+=FONT_HEIGHT; } diff --git a/TempleOSCD/Adam/Gr/GrExt.HC b/TempleOSCD/Adam/Gr/GrExt.HC index c478f2b..a2e254c 100644 --- a/TempleOSCD/Adam/Gr/GrExt.HC +++ b/TempleOSCD/Adam/Gr/GrExt.HC @@ -3,3 +3,6 @@ extern U8 *GrBitMap4ToBitMap8(U8 *dst,U8 *src,I64 src_size,I64 bkcolor); extern I64 GrBlot3(CDC *dc,I64 x1,I64 y1,I64 z1,CDC *img); extern I64 *Mat4x4New(I64 *src,CTask *mem_task=NULL); extern U8 *SpriteQue2Sprite(CSprite *head,I64 *_size=NULL); +extern CSprite *SpriteSetSettings(CDC *dc=NULL,CSprite *head,I64 elem_num, + I64 x=0,I64 y=0,CColorROPU32 *_color=NULL,I64 *_width=NULL, + I64 *_xx=NULL,I64 *_yy=NULL); diff --git a/TempleOSCD/Adam/Gr/MakeGr.HC b/TempleOSCD/Adam/Gr/MakeGr.HC index 2332a1d..f0008c9 100644 --- a/TempleOSCD/Adam/Gr/MakeGr.HC +++ b/TempleOSCD/Adam/Gr/MakeGr.HC @@ -23,6 +23,7 @@ Cd(__DIR__);; #include "SpriteMesh" #include "SpriteBitMap" #include "SpriteCode" +#include "SpriteSideBar" #include "SpriteEd" #include "SpriteMain" diff --git a/TempleOSCD/Adam/Gr/SpriteEd.HC b/TempleOSCD/Adam/Gr/SpriteEd.HC index 3cad058..59287d0 100644 --- a/TempleOSCD/Adam/Gr/SpriteEd.HC +++ b/TempleOSCD/Adam/Gr/SpriteEd.HC @@ -575,105 +575,6 @@ I64 SpriteQueSelAll(CSprite *head,Bool val=TRUE) return res; } -CSprite *SpriteSideBar2SpriteQue(CDoc *doc,CSprite *head,I64 *_cur_elem_num) -{//For the side-bar - CSprite *res=CAlloc(sizeof(CSprite)),*tmpg; - CDocEntry *doc_e=doc->head.next; - Bool found=FALSE; - I64 num=0; - QueInit(res); - while (doc_e!=doc) { - if (doc_e->type_u8==DOCT_MENU_VAL && doc_e->left_exp>=0) { - tmpg=SpriteSetSettings(,head,doc_e->left_exp); - if (tmpg!=head) { - tmpg=MAllocIdent(tmpg); - BEqu(&tmpg->type,SPf_SEL,Bt(&doc_e->type,DOCEt_SEL)); - if (*_cur_elem_num==doc_e->left_exp) { - *_cur_elem_num=num; - found=TRUE; - } - QueIns(tmpg,res->last); - num++; - } - } - doc_e=doc_e->next; - } - if (!found) - *_cur_elem_num=num; - QueDel(head); - Free(head); - return res; -} - -U0 SpriteSideBarPickNew(CDoc *doc,CSprite *head,I64 old_num) -{ - CSprite *tmpg; - CDocEntry *doc_cur_e=NULL,*doc_e; - I64 cur_elem_num=0; - U8 *st; - DocPrint(doc,"$$PURPLE$$$$TX+CX,\"Sprite SideBar\"$$\n" - "$$LK+PU+CX,\"Click for Help\"," - "A=\"FI:::/Doc/SpriteSideBar.DD.Z\"$$\n\n"); - tmpg=head->next; - while (tmpg!=head) { - st=SpriteElem2Summary(tmpg); - if (cur_elem_num==old_num) { - DocPrint(doc,"$$LTRED$$"); - doc_e=doc_cur_e=DocPrint(doc,"$$MU-UL,\"%Q\",LE=%d$$\n",st,cur_elem_num++); - } else { - DocPrint(doc,"$$LTBLUE$$"); - doc_e=DocPrint(doc,"$$MU-UL,\"%$$Q\",LE=%d$$\n",st,cur_elem_num++); - } - BEqu(&doc_e->de_flags,DOCEf_SEL,Bt(&tmpg->type,&SPf_SEL)); - BEqu(&doc_e->type,DOCEt_SEL,Bt(&tmpg->type,SPf_SEL)); - Free(st); - tmpg=tmpg->next; - } - if (cur_elem_num==old_num) { - DocPrint(doc,"$$LTRED$$"); - doc_cur_e=DocPrint(doc,"$$MU-UL,\"END\",LE=%d$$\n",cur_elem_num); - } else { - DocPrint(doc,"$$LTBLUE$$"); - DocPrint(doc,"$$MU-UL,\"END\",LE=%d$$\n",cur_elem_num); - } - if (doc_cur_e) - doc->cur_entry=doc_cur_e; -} - -U0 SpriteSideBarTask2(CTask *grand_parent) -{ - I64 w,h; - CTask *parent=Fs->parent_task,*pu_task; - while (TRUE) { - pu_task=grand_parent->popup_task; - if (TaskValidate(pu_task)) { - w=parent->win_right-parent->win_left; - WinHorz(pu_task->win_right+2,pu_task->win_right+2+w,parent); - h=parent->win_bottom-parent->win_top; - WinVert(pu_task->win_top,pu_task->win_top+h,parent); - } - Refresh; - } -} - -U0 SpriteSideBarTask(CTask *parent,CSprite **_head,I64 *_cur_elem_num) -{ - CDocEntry *doc_e; - CDoc *doc=DocPut; - Spawn(&SpriteSideBarTask2,parent,"CSpriteTask",,Fs); - doc->flags|=DOCF_SIZE_MIN|DOCF_FORM; - while (TRUE) { - SpriteSideBarPickNew(doc,*_head,*_cur_elem_num); - DocHighlightCursor(,doc); - View; - doc_e=doc->cur_entry; - if (doc_e->type_u8==DOCT_MENU_VAL) - *_cur_elem_num=doc_e->left_exp; - *_head=SpriteSideBar2SpriteQue(doc,*_head,_cur_elem_num); - DocClear(doc); - } -} - Bool SpriteEdText(CSprite **_head,I64 *_cur_elem_num) { Bool res; diff --git a/TempleOSCD/Adam/Gr/SpriteNew.HC b/TempleOSCD/Adam/Gr/SpriteNew.HC index d0336b2..ff3bf82 100644 --- a/TempleOSCD/Adam/Gr/SpriteNew.HC +++ b/TempleOSCD/Adam/Gr/SpriteNew.HC @@ -159,7 +159,7 @@ public U8 *SpriteElem2Summary(CSprite *tmpg) case SPT_TEXT: case SPT_TEXT_BOX: case SPT_TEXT_DIAMOND: - CatPrint(buf," %d,%d:%-16tQ",tmpg->ps.x1,tmpg->ps.y1,tmpg->ps.st); + CatPrint(buf," %d,%d:%-16t$$Q",tmpg->ps.x1,tmpg->ps.y1,tmpg->ps.st); break; case SPT_POLYLINE: case SPT_POLYPT: diff --git a/TempleOSCD/Adam/Gr/SpriteSideBar.HC b/TempleOSCD/Adam/Gr/SpriteSideBar.HC new file mode 100644 index 0000000..dc1af92 --- /dev/null +++ b/TempleOSCD/Adam/Gr/SpriteSideBar.HC @@ -0,0 +1,95 @@ +#help_index "Graphics/Sprite;Sprites" + +CSprite *SpriteSideBar2SpriteQue(CDoc *doc,CSprite *head,I64 *_cur_elem_num) +{//For the side-bar + CSprite *res=CAlloc(sizeof(CSprite)),*tmpg; + CDocEntry *doc_e=doc->head.next; + Bool found=FALSE; + I64 num=0; + QueInit(res); + while (doc_e!=doc) { + if (doc_e->type_u8==DOCT_MENU_VAL && doc_e->left_exp>=0) { + tmpg=SpriteSetSettings(,head,doc_e->left_exp); + if (tmpg!=head) { + tmpg=MAllocIdent(tmpg); + BEqu(&tmpg->type,SPf_SEL,Bt(&doc_e->type,DOCEt_SEL)); + if (*_cur_elem_num==doc_e->left_exp) { + *_cur_elem_num=num; + found=TRUE; + } + QueIns(tmpg,res->last); + num++; + } + } + doc_e=doc_e->next; + } + if (!found) + *_cur_elem_num=num; + QueDel(head); + Free(head); + return res; +} + +U0 SpriteSideBarPickNew(CDoc *doc,CSprite *head,I64 old_num) +{ + CSprite *tmpg; + CDocEntry *doc_cur_e=NULL,*doc_e; + I64 cur_elem_num=0; + U8 *st; + DocPrint(doc,"$$PURPLE$$$$TX+CX,\"Sprite SideBar\"$$\n" + "$$LK+PU+CX,\"Click for Help\"," + "A=\"FI:::/Doc/SpriteSideBar.DD.Z\"$$\n\n"); + tmpg=head->next; + while (tmpg!=head) { + st=SpriteElem2Summary(tmpg); + if (cur_elem_num==old_num) + doc_cur_e=doc_e= + DocPrint(doc,"$$LTRED$$$$MU-UL,\"%$$Q\",LE=%d$$\n",st,cur_elem_num++); + else + doc_e=DocPrint(doc,"$$LTBLUE$$$$MU-UL,\"%$$Q\",LE=%d$$\n",st,cur_elem_num++); + BEqu(&doc_e->de_flags,DOCEf_SEL,Bt(&tmpg->type,&SPf_SEL)); + BEqu(&doc_e->type,DOCEt_SEL,Bt(&tmpg->type,SPf_SEL)); + Free(st); + tmpg=tmpg->next; + } + if (cur_elem_num==old_num) + doc_cur_e=DocPrint(doc,"$$LTRED$$$$MU-UL,\"END\",LE=%d$$\n",cur_elem_num); + else + DocPrint(doc,"$$LTBLUE$$$$MU-UL,\"END\",LE=%d$$\n",cur_elem_num); + if (doc_cur_e) + doc->cur_entry=doc_cur_e; +} + +U0 SpriteSideBarTask2(CTask *grand_parent) +{ + I64 w,h; + CTask *parent=Fs->parent_task,*pu_task; + while (TRUE) { + pu_task=grand_parent->popup_task; + if (TaskValidate(pu_task)) { + w=parent->win_right-parent->win_left; + WinHorz(pu_task->win_right+2,pu_task->win_right+2+w,parent); + h=parent->win_bottom-parent->win_top; + WinVert(pu_task->win_top,pu_task->win_top+h,parent); + } + Refresh; + } +} + +U0 SpriteSideBarTask(CTask *parent,CSprite **_head,I64 *_cur_elem_num) +{ + CDocEntry *doc_e; + CDoc *doc=DocPut; + Spawn(&SpriteSideBarTask2,parent,"CSpriteTask",,Fs); + doc->flags|=DOCF_SIZE_MIN|DOCF_FORM; + while (TRUE) { + SpriteSideBarPickNew(doc,*_head,*_cur_elem_num); + DocHighlightCursor(,doc); + View; + doc_e=doc->cur_entry; + if (doc_e->type_u8==DOCT_MENU_VAL) + *_cur_elem_num=doc_e->left_exp; + *_head=SpriteSideBar2SpriteQue(doc,*_head,_cur_elem_num); + DocClear(doc); + } +} diff --git a/TempleOSCD/Adam/Opt/Utils/MemRep.HC b/TempleOSCD/Adam/Opt/Utils/MemRep.HC index 47f2beb..319d4aa 100644 --- a/TempleOSCD/Adam/Opt/Utils/MemRep.HC +++ b/TempleOSCD/Adam/Opt/Utils/MemRep.HC @@ -89,7 +89,6 @@ I64 DrvsSize() Bool MemRepTask(CTask *task,Bool override_validate=FALSE) { I64 i,j,k,m,n; - U8 *st; CDoc *pdoc,*ddoc,*bdoc; CCmpCtrl *cc; CMathODE *o; @@ -100,10 +99,8 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE) return FALSE; if (task==Fs) task->rsp=GetRSP; - st=MStrUtil(task->task_title,SUF_REM_CTRL_CHARS|SUF_SAFE_DOLLAR); - "$$BLACK$$%-27ts#%08X$$FG$$\n$$ID,2$$",st,task; - Free(st); - "Heap\t:%010X/%010X\n",TaskMemUsed(task,override_validate), + "$$BLACK$$%-27t$$Q#%08X$$FG$$\n",task->task_title,task; + "$$ID,2$$Heap\t:%010X/%010X\n",TaskMemUsed(task,override_validate), TaskMemAlloced(task,override_validate); i=UnusedStk(task); diff --git a/TempleOSCD/Compiler/Compiler.BIN b/TempleOSCD/Compiler/Compiler.BIN index 760d595..a12e872 100644 Binary files a/TempleOSCD/Compiler/Compiler.BIN and b/TempleOSCD/Compiler/Compiler.BIN differ diff --git a/TempleOSCD/Compiler/CompilerB.HH b/TempleOSCD/Compiler/CompilerB.HH index e581d65..76544c0 100644 --- a/TempleOSCD/Compiler/CompilerB.HH +++ b/TempleOSCD/Compiler/CompilerB.HH @@ -61,10 +61,10 @@ public extern I64 MemberMetaData(U8 *st,CMemberLst *ml); public extern CMemberLstMeta *MemberMetaFind(U8 *st,CMemberLst *ml); public extern CHashClass *OptClassFwd(CHashClass *tmpc); public extern I64 PrsKeyWord(CCmpCtrl *cc); + #help_index "Compiler;Cmd Line (Typically)" extern I64 Cmp(U8 *filename, U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0); - #help_index "Debugging/Unassemble" public extern U8 *U(U8 *rip,I64 cnt=20,I64 seg_size=64); public extern U0 Ui(U8 *buf,U8 **_rip,I64 seg_size=64, diff --git a/TempleOSCD/Demo/AcctExample/PersonalNotes.DD b/TempleOSCD/Demo/AcctExample/PersonalNotes.DD index 7dba954..cab673a 100644 --- a/TempleOSCD/Demo/AcctExample/PersonalNotes.DD +++ b/TempleOSCD/Demo/AcctExample/PersonalNotes.DD @@ -1,5 +1,7 @@ $WW,1$$FG,5$$TX+CX,"TODO"$$FG$ +* Does entire tool chain support super/sub script? + * $LK,"::/Apps/X-Caliber/X-Caliber.HC"$ * Add asteroid harbor defense. * Afterburner thruster. @@ -439,7 +441,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,"17388KB",D="DD_TEMPLEOSCD_K_SIZE"$ +Size:$TX,"17392KB",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"$ diff --git a/TempleOSCD/Demo/AcctExample/Registry.HC b/TempleOSCD/Demo/AcctExample/Registry.HC index 40992dd..a8d13cc 100644 --- a/TempleOSCD/Demo/AcctExample/Registry.HC +++ b/TempleOSCD/Demo/AcctExample/Registry.HC @@ -62,7 +62,7 @@ $ID,-2$$TR,"Titanium"$ $ID,2$I64 best_score=16469; $ID,-2$$TR,"TOSRegen"$ $ID,2$progress1_tf=0.000;progress2_tf=0.000; -progress3_tf=0.000;progress4_tf=204.328; +progress3_tf=0.000;progress4_tf=188.500; $ID,-2$$ID,-2$$TR,"Once"$ $ID,2$$TR,"Adam"$ $ID,2$$ID,-2$$TR,"User"$ diff --git a/TempleOSCD/Demo/Graphics/LightTable.HC b/TempleOSCD/Demo/Graphics/LightTable.HC index 05a8b21..03c2780 100644 --- a/TempleOSCD/Demo/Graphics/LightTable.HC +++ b/TempleOSCD/Demo/Graphics/LightTable.HC @@ -7,7 +7,7 @@ fine grained is only outlines. class Photon { Photon *next,*last; - CD3 p,v,n,p_snell_inhibit; + CD3 p,v,n,p_normal_inhibit; } p_root[mp_cnt]; I64 p_root_locks; @@ -15,24 +15,21 @@ I64 p_root_locks; I64 master_sleep_jiffy; CTask *animate_tasks[mp_cnt]; - +#define LENS_COLOR WHITE +#define MIRROR_COLOR DKGRAY CDC *map; -I64 photon_cnt,snell_cnt,snell_inhibit,zero_normal; + +I64 photon_cnt,mirror_cnt,snell_cnt,normal_inhibit,zero_normal; Bool full_speed,show_normals; -U8 *bmp; +U8 *bmp_refract,*bmp_reflect; F64 bmp_scale,find_normal_dist_sqr; I64 bmp_mem,bmp_width,bmp_height,bmp_norm_radius; -I64 BmpPeek(I64 x,I64 y) +#define BORDER 10 +I64 BmpPeek(U8 *bmp,I64 x,I64 y) { - if (0<=xcolor=WHITE; - GrLine(map,x1,y1,x2,y2); Line(bmp,x1*bmp_scale,y1*bmp_scale,0,x2*bmp_scale,y2*bmp_scale,0,&BmpPlot); } @@ -70,8 +65,8 @@ U0 DrawIt(CTask *,CDC *dc) bmp_mem,bmp_mem/1024/1024,bmp_scale, map->width,map->height,bmp_width,bmp_height); GrPrint(dc,0,FONT_HEIGHT, - "PhotonCnt:%d SnellCnt:%d SnellInhibit:%d ZeroNormal:%d", - photon_cnt,snell_cnt,snell_inhibit,zero_normal); + "PhotonCnt:%d MirrorCnt:%d SnellCnt:%d SnellInhibit:%d ZeroNormal:%d", + photon_cnt,mirror_cnt,snell_cnt,normal_inhibit,zero_normal); for (i=0;iwidth-BORDER-WING && + BORDER+WINGheight-BORDER-WING) { D3Equ(&p,x2,y2); D3Equ(&v,x2-x1,y2-y1); D3Unit(&v); @@ -106,7 +104,7 @@ U0 RayBurst(I64 x1,I64 y1,I64 x2,I64 y2) D3Copy(&tmpp->p,&p); D3Copy(&tmpp->v,&v); - for (i=2;i<=9;i+=3) { + for (i=2;i<=WING;i+=3) { D3Mul(&n2,i,&n); tmpp=PhotonNew; @@ -127,19 +125,20 @@ U0 RandomBurst() Photon *tmpp; for (i=0;i<256;i++) { tmpp=PhotonNew; - D3Equ(&tmpp->p,Fs->pix_width*Rand,Fs->pix_height*Rand); + D3Equ(&tmpp->p,(Fs->pix_width-BORDER*2)*Rand+BORDER, + (Fs->pix_height-BORDER*2)*Rand+BORDER); é=2*ã*Rand; D3Equ(&tmpp->v,Cos(é),Sin(é)); } } -U0 FindNormal(Photon *tmpp) +U0 FindNormal(U8 *bmp,Photon *tmpp) { CD3 p,p1,p2; F64 step,x,y,é=Arg(tmpp->v.x,tmpp->v.y),è; - I64 c; + I64 state; - D3Copy(&tmpp->p_snell_inhibit,&tmpp->p); + D3Copy(&tmpp->p_normal_inhibit,&tmpp->p); //Coarse grains has black and white filled-in BSplines. //Fine grained has only white outline without being filled-in. @@ -149,7 +148,8 @@ U0 FindNormal(Photon *tmpp) D3SubEqu(&tmpp->p,&tmpp->v); D3Mul(&p,bmp_scale,&tmpp->p); D3Copy(&p1,&p); - while (BmpPeek(p1.x,p1.y)==BLACK && D3DistSqr(&p,&p1)v); D3Copy(&p,&p1); D3Div(&tmpp->p,&p,bmp_scale); @@ -159,25 +159,22 @@ U0 FindNormal(Photon *tmpp) for (è=0;è<=ã/4;è+=step*ã/bmp_norm_radius) { x=p.x+bmp_norm_radius*Cos(é+ã-ã/4-è); y=p.y+bmp_norm_radius*Sin(é+ã-ã/4-è); - c=BmpPeek(x,y); - if (c!=BLACK) + if (state=BmpPeek(bmp,x,y)) goto fn_p1; x=p.x+bmp_norm_radius*Cos(é+ã-ã/4+è); y=p.y+bmp_norm_radius*Sin(é+ã-ã/4+è); - c=BmpPeek(x,y); - if (c!=BLACK) + if (state=BmpPeek(bmp,x,y)) goto fn_p1; } for (;è<=3*ã/4;è+=step*ã/bmp_norm_radius) { x=p.x+bmp_norm_radius*Cos(é+ã-ã/4-è); y=p.y+bmp_norm_radius*Sin(é+ã-ã/4-è); - c=BmpPeek(x,y); - if (c!=BLACK) + if (state=BmpPeek(bmp,x,y)) goto fn_p1; } } fn_p1: - if (c==WHITE) + if (state) D3Equ(&p1,x,y); else D3Copy(&p1,&tmpp->p); @@ -187,25 +184,22 @@ fn_p1: for (è=0;è<=ã/4;è+=step*ã/bmp_norm_radius) { x=p.x+bmp_norm_radius*Cos(é+ã+ã/4+è); y=p.y+bmp_norm_radius*Sin(é+ã+ã/4+è); - c=BmpPeek(x,y); - if (c!=BLACK) + if (state=BmpPeek(bmp,x,y)) goto fn_p2; x=p.x+bmp_norm_radius*Cos(é+ã+ã/4-è); y=p.y+bmp_norm_radius*Sin(é+ã+ã/4-è); - c=BmpPeek(x,y); - if (c!=BLACK) + if (state=BmpPeek(bmp,x,y)) goto fn_p2; } for (;è<=3*ã/4;è+=step*ã/bmp_norm_radius) { x=p.x+bmp_norm_radius*Cos(é+ã+ã/4+è); y=p.y+bmp_norm_radius*Sin(é+ã+ã/4+è); - c=BmpPeek(x,y); - if (c!=BLACK) + if (state=BmpPeek(bmp,x,y)) goto fn_p2; } } fn_p2: - if (c==WHITE) + if (state) D3Equ(&p2,x,y); else D3Copy(&p2,&tmpp->p); @@ -222,28 +216,53 @@ fn_p2: } } +U0 Mirror(Photon *tmpp) +{/*$SP,"<1>",BI=1$ + + + + + + + + + + +é$SY,3$out$SY,0$ = ã+é$SY,3$n$SY,0$ - (é$SY,3$in$SY,0$-é$SY,3$n$SY,0$) + +*/ + F64 é=Arg(tmpp->v.x,tmpp->v.y),é$SY,3$n$SY,0$; + FindNormal(bmp_reflect,tmpp); + é$SY,3$n$SY,0$=Arg(tmpp->n.x,tmpp->n.y); + + D3Equ(&tmpp->v,Cos(2*é$SY,3$n$SY,0$+ã-é),Sin(2*é$SY,3$n$SY,0$+ã-é)); + lock {mirror_cnt++;} +} + U0 SnellsLaw(Photon *tmpp,I64 last,I64 next) { //n1 and n2 are refraction index. //n1 Sin(é1) == n2 Sin(é2) - F64 é=Arg(tmpp->v.x,tmpp->v.y),én,n1,n2,é1,é2; - if (last==WHITE) + F64 é=Arg(tmpp->v.x,tmpp->v.y),é$SY,3$n$SY,0$,n1,n2,é1,é2; + if (last==LENS_COLOR) n1=1.5; else n1=1.0; - if (next==WHITE) + if (next==LENS_COLOR) n2=1.5; else n2=1.0; - FindNormal(tmpp); - én=Arg(tmpp->n.x,tmpp->n.y); + FindNormal(bmp_refract,tmpp); + é$SY,3$n$SY,0$=Arg(tmpp->n.x,tmpp->n.y); + //Dot=m1m2Cos(é); é1=ACos(D3Dot(&tmpp->n,&tmpp->v)); é2=ASin(n1*Sin(é1)/n2); - if (Wrap(é-én)>=0) - é=én+é2; + if (Wrap(é-é$SY,3$n$SY,0$)>=0) + é=é$SY,3$n$SY,0$+é2; else - é=én-é2; + é=é$SY,3$n$SY,0$-é2; + D3Equ(&tmpp->v,Cos(é),Sin(é)); lock {snell_cnt++;} } @@ -272,37 +291,45 @@ U0 MPAnimateTask(I64) while (tmpp!=root) { last=GrPeek(map,tmpp->p.x,tmpp->p.y); D3AddEqu(&tmpp->p,&tmpp->v); - if (tmpp->p.x<0) { - tmpp->p.x=-tmpp->p.x; + if (tmpp->p.xp.x=2*BORDER-tmpp->p.x; tmpp->v.x=-tmpp->v.x; } - if (tmpp->p.x>=map->width) { - tmpp->p.x-=tmpp->p.x-map->width; + if (tmpp->p.x>=map->width-BORDER) { + tmpp->p.x-=tmpp->p.x-map->width+BORDER; tmpp->v.x=-tmpp->v.x; } - if (tmpp->p.y<0) { - tmpp->p.y=-tmpp->p.y; + if (tmpp->p.yp.y=2*BORDER-tmpp->p.y; tmpp->v.y=-tmpp->v.y; } - if (tmpp->p.y>=map->height) { - tmpp->p.y-=tmpp->p.y-map->height; + if (tmpp->p.y>=map->height-BORDER) { + tmpp->p.y-=tmpp->p.y-map->height+BORDER; tmpp->v.y=-tmpp->v.y; } next=GrPeek(map,tmpp->p.x,tmpp->p.y); - if (D3DistSqr(&tmpp->p_snell_inhibit,&tmpp->p)<4.0) + if (D3DistSqr(&tmpp->p_normal_inhibit,&tmpp->p)<4.0) inhibit=TRUE; else inhibit=FALSE; - if (last!=next && (last==BLACK && next==WHITE) || - (last==WHITE && next==BLACK)) { - if (inhibit) - lock {snell_inhibit++;} - else - SnellsLaw(tmpp,last,next); + if (last!=next) { + if ((last==BLACK && next==LENS_COLOR) || + (last==LENS_COLOR && next==BLACK)) { + if (inhibit) + lock {normal_inhibit++;} + else + SnellsLaw(tmpp,last,next); + } else if (last==BLACK && next==MIRROR_COLOR) { + if (inhibit) + lock {normal_inhibit++;} + else + Mirror(tmpp); + } else if (!inhibit) + D3Zero(&tmpp->p_normal_inhibit); } else if (!inhibit) - D3Zero(&tmpp->p_snell_inhibit); + D3Zero(&tmpp->p_normal_inhibit); tmpp=tmpp->next; if (cnts.jiffies>=timeout_jiffy) @@ -328,7 +355,7 @@ U0 Init() I64 i; master_sleep_jiffy=cnts.jiffies; full_speed=show_normals=FALSE; - photon_cnt=snell_cnt=snell_inhibit=zero_normal=0; + photon_cnt=mirror_cnt=snell_cnt=normal_inhibit=zero_normal=0; map=DCNew(Fs->pix_width,Fs->pix_height); for (i=0;ipix_height/Fs->pix_width)/Fs->pix_height; + bmp_scale=Sqrt(bmp_mem/2*8*Fs->pix_height/Fs->pix_width)/Fs->pix_height; + find_normal_dist_sqr=2*Sqr(bmp_scale); +#assert Sqrt(2)<=BORDER + bmp_width =bmp_scale*Fs->pix_width; bmp_height=bmp_scale*Fs->pix_height; - bmp=CAlloc(bmp_width*bmp_height/8); + bmp_refract=CAlloc(bmp_width*bmp_height/8); + bmp_reflect=CAlloc(bmp_width*bmp_height/8); bmp_norm_radius=Min(10*bmp_scale,250); +#assert 10<=BORDER } U0 CleanUp() @@ -360,13 +392,16 @@ U0 CleanUp() LBtr(&p_root_locks,i); } DCDel(map); - Free(bmp); + Free(bmp_refract); + Free(bmp_reflect); } -#define LTM_LINE 0 -#define LTM_SPLINE 1 -#define LTM_FLOOD_FILL 2 -#define LTM_TEST_RAY 3 +#define LTM_REFLECT_LINE 0 +#define LTM_REFLECT_SPLINE 1 +#define LTM_REFRACT_LINE 2 +#define LTM_REFRACT_SPLINE 3 +#define LTM_REFRACT_FLOOD_FILL 4 +#define LTM_TEST_RAY 5 U0 LTMenuSet(I64 mode) { @@ -376,18 +411,28 @@ U0 LTMenuSet(I64 mode) else entry->checked=FALSE; - entry=MenuEntryFind(Fs->cur_menu,"Mode/LineMode"); - if (mode==LTM_LINE) + entry=MenuEntryFind(Fs->cur_menu,"Mode/ReflectLine"); + if (mode==LTM_REFLECT_LINE) entry->checked=TRUE; else entry->checked=FALSE; - entry=MenuEntryFind(Fs->cur_menu,"Mode/SplineMode"); - if (mode==LTM_SPLINE) + entry=MenuEntryFind(Fs->cur_menu,"Mode/ReflectSpline"); + if (mode==LTM_REFLECT_SPLINE) entry->checked=TRUE; else entry->checked=FALSE; - entry=MenuEntryFind(Fs->cur_menu,"Mode/FloodFill"); - if (mode==LTM_FLOOD_FILL) + entry=MenuEntryFind(Fs->cur_menu,"Mode/RefractLine"); + if (mode==LTM_REFRACT_LINE) + entry->checked=TRUE; + else + entry->checked=FALSE; + entry=MenuEntryFind(Fs->cur_menu,"Mode/RefractSpline"); + if (mode==LTM_REFRACT_SPLINE) + entry->checked=TRUE; + else + entry->checked=FALSE; + entry=MenuEntryFind(Fs->cur_menu,"Mode/RefractFloodFill"); + if (mode==LTM_REFRACT_FLOOD_FILL) entry->checked=TRUE; else entry->checked=FALSE; @@ -401,7 +446,7 @@ U0 LTMenuSet(I64 mode) #define PTS_NUM 1024 U0 LightTable() { - I64 msg_code,mode=LTM_LINE,i,cnt,arg1,arg2,x1,y1,x2,y2; + I64 msg_code,mode=LTM_REFLECT_LINE,i,cnt,arg1,arg2,x1,y1,x2,y2; CD3I32 *c=MAlloc(PTS_NUM*sizeof(CD3I32)); p_root_locks=0; @@ -412,10 +457,12 @@ U0 LightTable() " Exit(,CH_ESC);" "}" "Mode {" - " LineMode(,'0');" - " SplineMode(,'1');" - " FloodFill(,'2');" - " TestRay(,'3');" + " ReflectLine(,'0');" + " ReflectSpline(,'1');" + " RefractLine(,'2');" + " RefractSpline(,'3');" + " RefractFloodFill(,'4');" + " TestRay(,'5');" "}" "Play {" " RandomBurst(,'r');" @@ -459,9 +506,10 @@ lt_restart: Sweep(100,90,100); x2=arg1; y2=arg2; switch (mode) { - case LTM_FLOOD_FILL: + case LTM_REFRACT_FLOOD_FILL: + map->color=LENS_COLOR; GrFloodFill(map,x2,y2); - mode=LTM_LINE; + mode=LTM_REFLECT_LINE; LTMenuSet(mode); break; case LTM_TEST_RAY: @@ -472,8 +520,12 @@ lt_restart: case MSG_MS_L_DOWN: x1=arg1; y1=arg2; switch (mode) { - case LTM_LINE: - map->color=ROP_XOR+WHITE; + case LTM_REFLECT_LINE: + case LTM_REFRACT_LINE: + if (mode==LTM_REFLECT_LINE) + map->color=ROP_XOR+MIRROR_COLOR; + else + map->color=ROP_XOR+LENS_COLOR; while (TRUE) { x2=arg1; y2=arg2; GrLine(map,x1,y1,x2,y2); @@ -488,11 +540,23 @@ lt_restart: break; } } - DualLine(x1,y1,x2,y2); + if (mode==LTM_REFLECT_LINE) + map->color=MIRROR_COLOR; + else + map->color=LENS_COLOR; + GrLine(map,x1,y1,x2,y2); + if (mode==LTM_REFLECT_LINE) + BmpLine(bmp_reflect,x1,y1,x2,y2); + else + BmpLine(bmp_refract,x1,y1,x2,y2); break; - case LTM_SPLINE: + case LTM_REFLECT_SPLINE: + case LTM_REFRACT_SPLINE: cnt=0; - map->color=ROP_XOR+WHITE; + if (mode==LTM_REFLECT_SPLINE) + map->color=ROP_XOR+MIRROR_COLOR; + else + map->color=ROP_XOR+LENS_COLOR; do { c[cnt].x=arg1; c[cnt].y=arg2; c[cnt].z=0; Gr2BSpline(map,c,cnt+1); @@ -506,20 +570,27 @@ lt_restart: cnt++; } } while (cntcolor=WHITE; + if (mode==LTM_REFLECT_SPLINE) + map->color=MIRROR_COLOR; + else + map->color=LENS_COLOR; Gr2BSpline3(map,c,cnt); for (i=0;i=0) { mode=i; LTMenuSet(mode); @@ -530,7 +601,7 @@ lt_restart: case '\n': CleanUp; Init; - mode=LTM_LINE; + mode=LTM_REFLECT_LINE; LTMenuSet(mode); break; case 'r': @@ -546,7 +617,7 @@ lt_restart: show_normals=!show_normals; LTMenuSet(mode); break; - case '0'...'3': + case '0'...'5': mode=arg1-'0'; LTMenuSet(mode); break; @@ -570,3 +641,4 @@ lt_done: } LightTable; +ªF0*G1HG1 HPé$SY,3$n$SY,0$G2HNK<ã+é$SY,3$n$SY,0$1 é$SY,3$in$SY,0$%Fé$SY,3$out$SY,0$ \ No newline at end of file diff --git a/TempleOSCD/Demo/WebLogDemo/WebLogRep.HC b/TempleOSCD/Demo/WebLogDemo/WebLogRep.HC index 02aefe1..6cd394d 100644 --- a/TempleOSCD/Demo/WebLogDemo/WebLogRep.HC +++ b/TempleOSCD/Demo/WebLogDemo/WebLogRep.HC @@ -48,7 +48,7 @@ U0 PrsSingleLogFile(LogStruct *head,U8 *name,CDate *_start,CDate *_end) LogStruct *tmplg; CDateStruct ds; I64 i; - "%Q\n",name; + "%$$Q\n",name; while (doc_e!=doc) { if (doc_e->type_u8==DOCT_TEXT) { tmplg=CAlloc(sizeof(LogStruct)); @@ -124,7 +124,7 @@ U0 PrsSingleLogFile(LogStruct *head,U8 *name,CDate *_start,CDate *_end) throw; } catch { Fs->catch_except=TRUE; - "%Q\n",doc_e->tag; + "%$$Q\n",doc_e->tag; LogStructDel(tmplg); } } @@ -317,7 +317,7 @@ U0 LinkTreeTraverse(LinkStruct *root) { if (root) { LinkTreeTraverse(root->left); - "%3d:%Q\n",root->cnt,root->link; + "%3d:%$$Q\n",root->cnt,root->link; LinkTreeTraverse(root->right); } } @@ -335,7 +335,7 @@ U0 FileTreeTraverse(LinkStruct *root) { if (root) { FileTreeTraverse(root->left); - "%3d:%Q\n",root->cnt,root->file; + "%3d:%$$Q\n",root->cnt,root->file; FileTreeTraverse(root->right); } } @@ -378,8 +378,11 @@ U0 DownLoadRep(LogStruct *head,CDate start,CDate end) "\n\nDownloads of /TempleOSCD.ISO\n"; for (i=start;i<=end;i+=1<<32) - "%D:%5d%5d\n",i,day_dup_cnts[(i+local_time_offset)>>32-days_start], - day_cnts[(i+local_time_offset)>>32-days_start]; + "%D Dups:%5d Total:%5d Uniques:%5d\n",i, + day_dup_cnts[(i+local_time_offset)>>32-days_start], + day_cnts[(i+local_time_offset)>>32-days_start], + day_cnts[(i+local_time_offset)>>32-days_start]- + day_dup_cnts[(i+local_time_offset)>>32-days_start]; "\n\nDownloads of /TempleOSCD.ISO\n" "'-' is a dup. '+' is not a dup.\n"; @@ -396,7 +399,7 @@ U0 DownLoadRep(LogStruct *head,CDate start,CDate end) '+'; '\n'; } - "Total:%d Dups:%d\n",cnt,dups; + "Total:%d Dups:%d Uniques:%d\n",cnt,dups,cnt-dups; "\n\nDownloads of /TempleOSCD.ISO\n"; LinkTreeTraverse(link_root); @@ -463,8 +466,11 @@ U0 IndexRep(LogStruct *head,CDate start,CDate end) "\n\nHits on /index.html\n" "'-' is a dup. '+' is not a dup.\n"; for (i=start;i<=end;i+=1<<32) - "%D:%5d%5d\n",i,day_dup_cnts[(i+local_time_offset)>>32-days_start], - day_cnts[(i+local_time_offset)>>32-days_start]; + "%D Dups:%5d Total:%5d Uniques:%5d\n",i, + day_dup_cnts[(i+local_time_offset)>>32-days_start], + day_cnts[(i+local_time_offset)>>32-days_start], + day_cnts[(i+local_time_offset)>>32-days_start]- + day_dup_cnts[(i+local_time_offset)>>32-days_start]; "\n\nHits on /index.html\n"; if (hours_end-hours_start>=HOURS_MAX) @@ -480,7 +486,7 @@ U0 IndexRep(LogStruct *head,CDate start,CDate end) '+'; '\n'; } - "Total:%d Dups:%d\n",cnt,dups; + "Total:%d Dups:%d Uniques:%d\n",cnt,dups,cnt-dups; "\n\nHits on /index.html\n"; LinkTreeTraverse(link_root); diff --git a/TempleOSCD/Doc/ChgLog.DD b/TempleOSCD/Doc/ChgLog.DD index 7180c6e..cfe8670 100644 --- a/TempleOSCD/Doc/ChgLog.DD +++ b/TempleOSCD/Doc/ChgLog.DD @@ -2,6 +2,9 @@ $WW,1$$FG,5$$TX+CX,"Change Log"$$FG$ Use $LK,"R",A="MN:R"$() to rename if I change a label. +$IV,1$----02/01/17 20:59:31----$IV,0$ +* Improved support for sub and super scripts. + $IV,1$----01/31/17 10:22:10----$IV,0$ * Added $LK,"::/Demo/Graphics/LightTable.HC"$. * Added $LK,"TOS Linux Setup",A="FF:::/Demo/AcctExample/TOS/TOSPolicies.DD,TOS Linux Setup"$. diff --git a/TempleOSCD/Kernel/KernelC.HH b/TempleOSCD/Kernel/KernelC.HH index 2f48d39..ee609af 100644 --- a/TempleOSCD/Kernel/KernelC.HH +++ b/TempleOSCD/Kernel/KernelC.HH @@ -582,6 +582,7 @@ public _extern _MSIZE2 I64 MSize2(U8 *src); //Internal size public extern U0 HeapCtrlDel(CHeapCtrl *hc); public extern CHeapCtrl *HeapCtrlInit(CHeapCtrl *hc=NULL, CTask *task=NULL,CBlkPool *bp); + #help_index "Memory/Page Tables" public extern I64 *MemPageTable(U8 *a); @@ -721,7 +722,6 @@ public extern CTask *Spawn(U0 (*fp_addr)(U8 *data),U8 *data=NULL, U8 *task_name=NULL,I64 target_cpu=-1, //-1 means current CPU CTask *parent=NULL, //NULL means adam I64 stk_size=0,I64 flags=1<