Nightly update (ISO SHA-1 f3615ad)

This commit is contained in:
TempleOS-bot committed 2017-02-02 00:27:28 -05:00
1 parent b97fa7c00e
commit aa53888517
20 files changed
+363 -232

No files matched your search

Binary file not shown.
+2 -2
View File
@@ -18,8 +18,8 @@ U0 LoadDocDefines()
//$LK,"DD_BOOT_HIGH_LOC_DVD",A="FF:::/Adam/Opt/Boot/BootDVD.HC,DD_BOOT_HIGH_LOC_DVD"$ //$LK,"DD_BOOT_HIGH_LOC_DVD",A="FF:::/Adam/Opt/Boot/BootDVD.HC,DD_BOOT_HIGH_LOC_DVD"$
$TR-C,"LineRep"$ $TR-C,"LineRep"$
$ID,4$DefinePrint("DD_TEMPLEOS_LOC","120,563"); $ID,4$DefinePrint("DD_TEMPLEOS_LOC","120,690");
DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","82,013"); DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","82,062");
$ID,-4$ $ID,-4$
DefinePrint("DD_MP_VECT","%08X",MP_VECT_ADDR); DefinePrint("DD_MP_VECT","%08X",MP_VECT_ADDR);
DefinePrint("DD_MP_VECT_END","%08X", DefinePrint("DD_MP_VECT_END","%08X",
+3 -5
View File
@@ -157,7 +157,7 @@ U8 *idx=NULL,CDoc *doc=NULL)
CHashGeneric *ptr; CHashGeneric *ptr;
CWho *lst; CWho *lst;
I64 cnt,i,j,k,f=0; 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; Bool recurse,publics,map;
CTask *task; CTask *task;
@@ -267,13 +267,11 @@ U8 *idx=NULL,CDoc *doc=NULL)
if (!idx) { if (!idx) {
if (ptr->type & HTT_DEFINE_STR) { if (ptr->type & HTT_DEFINE_STR) {
st=MStrUtil(ptr(CHashDefineStr *)->data,SUF_SAFE_DOLLAR);
j=ptr(CHashDefineStr *)->cnt; j=ptr(CHashDefineStr *)->cnt;
if (j==-1) if (j==-1)
StrPrint(buf,"%-10tQ ",st); StrPrint(buf,"%-10t$$Q ",ptr(CHashDefineStr *)->data);
else else
StrPrint(buf,"%-10tQ %02X",st,j); StrPrint(buf,"%-10t$$Q %02X",ptr(CHashDefineStr *)->data,j);
Free(st);
} else if (ptr->type & HTT_GLBL_VAR) } else if (ptr->type & HTT_GLBL_VAR)
StrPrint(buf,"%010X ",ptr(CHashGlblVar *)->data_addr); StrPrint(buf,"%010X ",ptr(CHashGlblVar *)->data_addr);
else else
+19
View File
@@ -51,6 +51,12 @@ public U8 *DocScanLine(CDoc *doc,CDocEntry *doc_e,
i+=StrLen(src); i+=StrLen(src);
} else if (doc_e2->type_u8==DOCT_TAB) } else if (doc_e2->type_u8==DOCT_TAB)
i++; 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; doc_e2=doc_e2->next;
} }
res=MAlloc(i+1); res=MAlloc(i+1);
@@ -63,6 +69,19 @@ public U8 *DocScanLine(CDoc *doc,CDocEntry *doc_e,
*dst++=*src++; *dst++=*src++;
} else if (doc_e->type_u8==DOCT_TAB) } else if (doc_e->type_u8==DOCT_TAB)
*dst++='\t'; *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) if (doc_e==doc->cur_entry && cur_col)
*cur_col=start-res+doc->cur_col; *cur_col=start-res+doc->cur_col;
doc_e=doc_e->next; doc_e=doc_e->next;
+45 -12
View File
@@ -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) I64 GrPutS(CDC *dc=gr.dc,I64 x,I64 y,U8 *_s)
{//Use $LK,"GrPrint",A="MN:GrPrint"$() {//Use $LK,"GrPrint",A="MN:GrPrint"$()
I64 x0,ch,res; I64 x0,sx=0,sy=0,res;
if (!_s) return 0; if (!_s) return 0;
x0=x; x0=x;
res=0; res=0;
while (ch=*_s++) { while (*_s) {
if (ch=='\n') { if (*_s=='\n') {
x=x0; x=x0;
y+=FONT_HEIGHT; y+=FONT_HEIGHT;
} else if (ch=='\t') _s++;
} else if (*_s=='\t') {
x=x0+CeilU64(x-x0+FONT_WIDTH,8*FONT_WIDTH); x=x0+CeilU64(x-x0+FONT_WIDTH,8*FONT_WIDTH);
else { _s++;
res+=GrPutChar(dc,x,y,ch); } 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; x+=FONT_WIDTH;
_s++;
} }
} }
return res; 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) I64 GrVPutS(CDC *dc=gr.dc,I64 x,I64 y,U8 *_s)
{//Vertical Text. Use $LK,"GrVPrint",A="MN:GrVPrint"$() {//Vertical Text. Use $LK,"GrVPrint",A="MN:GrVPrint"$()
I64 y0,res; I64 y0,sx=0,sy=0,res;
U8 buf[2]; U8 buf[2];
if (!_s) return 0; if (!_s) return 0;
y0=y; y0=y;
res=0; res=0;
buf[1]=0; buf[1]=0;
while (*buf=*_s++) { while (*_s) {
if (*buf=='\n') { if (*_s=='\n') {
y=y0; y=y0;
x+=FONT_WIDTH; x+=FONT_WIDTH;
} else if (*buf=='\t') _s++;
} else if (*_s=='\t') {
y=y0+CeilU64(y-y0+FONT_HEIGHT,8*FONT_HEIGHT); 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); res+=GrPutS(dc,x,y,buf);
y+=FONT_HEIGHT; y+=FONT_HEIGHT;
} }
+3
View File
@@ -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 GrBlot3(CDC *dc,I64 x1,I64 y1,I64 z1,CDC *img);
extern I64 *Mat4x4New(I64 *src,CTask *mem_task=NULL); extern I64 *Mat4x4New(I64 *src,CTask *mem_task=NULL);
extern U8 *SpriteQue2Sprite(CSprite *head,I64 *_size=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);
+1
View File
@@ -23,6 +23,7 @@ Cd(__DIR__);;
#include "SpriteMesh" #include "SpriteMesh"
#include "SpriteBitMap" #include "SpriteBitMap"
#include "SpriteCode" #include "SpriteCode"
#include "SpriteSideBar"
#include "SpriteEd" #include "SpriteEd"
#include "SpriteMain" #include "SpriteMain"
-99
View File
@@ -575,105 +575,6 @@ I64 SpriteQueSelAll(CSprite *head,Bool val=TRUE)
return res; 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 SpriteEdText(CSprite **_head,I64 *_cur_elem_num)
{ {
Bool res; Bool res;
+1 -1
View File
@@ -159,7 +159,7 @@ public U8 *SpriteElem2Summary(CSprite *tmpg)
case SPT_TEXT: case SPT_TEXT:
case SPT_TEXT_BOX: case SPT_TEXT_BOX:
case SPT_TEXT_DIAMOND: 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; break;
case SPT_POLYLINE: case SPT_POLYLINE:
case SPT_POLYPT: case SPT_POLYPT:
+95
View File
@@ -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);
}
}
+2 -5
View File
@@ -89,7 +89,6 @@ I64 DrvsSize()
Bool MemRepTask(CTask *task,Bool override_validate=FALSE) Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
{ {
I64 i,j,k,m,n; I64 i,j,k,m,n;
U8 *st;
CDoc *pdoc,*ddoc,*bdoc; CDoc *pdoc,*ddoc,*bdoc;
CCmpCtrl *cc; CCmpCtrl *cc;
CMathODE *o; CMathODE *o;
@@ -100,10 +99,8 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
return FALSE; return FALSE;
if (task==Fs) if (task==Fs)
task->rsp=GetRSP; task->rsp=GetRSP;
st=MStrUtil(task->task_title,SUF_REM_CTRL_CHARS|SUF_SAFE_DOLLAR); "$$BLACK$$%-27t$$Q#%08X$$FG$$\n",task->task_title,task;
"$$BLACK$$%-27ts#%08X$$FG$$\n$$ID,2$$",st,task; "$$ID,2$$Heap\t:%010X/%010X\n",TaskMemUsed(task,override_validate),
Free(st);
"Heap\t:%010X/%010X\n",TaskMemUsed(task,override_validate),
TaskMemAlloced(task,override_validate); TaskMemAlloced(task,override_validate);
i=UnusedStk(task); i=UnusedStk(task);
Binary file not shown.
+1 -1
View File
@@ -61,10 +61,10 @@ public extern I64 MemberMetaData(U8 *st,CMemberLst *ml);
public extern CMemberLstMeta *MemberMetaFind(U8 *st,CMemberLst *ml); public extern CMemberLstMeta *MemberMetaFind(U8 *st,CMemberLst *ml);
public extern CHashClass *OptClassFwd(CHashClass *tmpc); public extern CHashClass *OptClassFwd(CHashClass *tmpc);
public extern I64 PrsKeyWord(CCmpCtrl *cc); public extern I64 PrsKeyWord(CCmpCtrl *cc);
#help_index "Compiler;Cmd Line (Typically)" #help_index "Compiler;Cmd Line (Typically)"
extern I64 Cmp(U8 *filename, extern I64 Cmp(U8 *filename,
U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0); U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0);
#help_index "Debugging/Unassemble" #help_index "Debugging/Unassemble"
public extern U8 *U(U8 *rip,I64 cnt=20,I64 seg_size=64); 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, public extern U0 Ui(U8 *buf,U8 **_rip,I64 seg_size=64,
+3 -1
View File
@@ -1,5 +1,7 @@
$WW,1$$FG,5$$TX+CX,"TODO"$$FG$ $WW,1$$FG,5$$TX+CX,"TODO"$$FG$
* Does entire tool chain support super/sub script?
* $LK,"::/Apps/X-Caliber/X-Caliber.HC"$ * $LK,"::/Apps/X-Caliber/X-Caliber.HC"$
* Add asteroid harbor defense. * Add asteroid harbor defense.
* Afterburner thruster. * Afterburner thruster.
@@ -439,7 +441,7 @@ $FG,5$$TX+CX,"Misc Notes"$$FG$
Erik van der Karbargenbok: $LK,"TempleBot",A="PI:~/Sup1/Sup1Bin/TempleBot"$. Erik van der Karbargenbok: $LK,"TempleBot",A="PI:~/Sup1/Sup1Bin/TempleBot"$.
Intel CEO's name: Brian Krzanich Intel CEO's name: Brian Krzanich
>$FG,2$lspci -v$FG$ >$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$ $FG,5$$TX+CX,"My Web Bookmarks"$$FG$$WW,0$
$TX,"My FireFox Bookmarks",HTML="http://www.templeos.org/Wb/Home/Sup1/Sup1Blog/Bookmarks"$ $TX,"My FireFox Bookmarks",HTML="http://www.templeos.org/Wb/Home/Sup1/Sup1Blog/Bookmarks"$
+1 -1
View File
@@ -62,7 +62,7 @@ $ID,-2$$TR,"Titanium"$
$ID,2$I64 best_score=16469; $ID,2$I64 best_score=16469;
$ID,-2$$TR,"TOSRegen"$ $ID,-2$$TR,"TOSRegen"$
$ID,2$progress1_tf=0.000;progress2_tf=0.000; $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$$ID,-2$$TR,"Once"$
$ID,2$$TR,"Adam"$ $ID,2$$TR,"Adam"$
$ID,2$$ID,-2$$TR,"User"$ $ID,2$$ID,-2$$TR,"User"$
+163 -91
View File
@@ -7,7 +7,7 @@ fine grained is only outlines.
class Photon class Photon
{ {
Photon *next,*last; Photon *next,*last;
CD3 p,v,n,p_snell_inhibit; CD3 p,v,n,p_normal_inhibit;
} p_root[mp_cnt]; } p_root[mp_cnt];
I64 p_root_locks; I64 p_root_locks;
@@ -15,24 +15,21 @@ I64 p_root_locks;
I64 master_sleep_jiffy; I64 master_sleep_jiffy;
CTask *animate_tasks[mp_cnt]; CTask *animate_tasks[mp_cnt];
#define LENS_COLOR WHITE
#define MIRROR_COLOR DKGRAY
CDC *map; 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; Bool full_speed,show_normals;
U8 *bmp; U8 *bmp_refract,*bmp_reflect;
F64 bmp_scale,find_normal_dist_sqr; F64 bmp_scale,find_normal_dist_sqr;
I64 bmp_mem,bmp_width,bmp_height,bmp_norm_radius; 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<=x<bmp_width && 0<=y<bmp_height) { return Bt(bmp,y*bmp_width+x);
if (Bt(bmp,y*bmp_width+x))
return WHITE;
else
return BLACK;
} else
return -1;
} }
U0 BmpPlot(U8 *bmp,I64 x,I64 y,I64) U0 BmpPlot(U8 *bmp,I64 x,I64 y,I64)
@@ -41,10 +38,8 @@ U0 BmpPlot(U8 *bmp,I64 x,I64 y,I64)
Bts(bmp,y*bmp_width+x); Bts(bmp,y*bmp_width+x);
} }
U0 DualLine(F64 x1,F64 y1,F64 x2,F64 y2) U0 BmpLine(U8 *bmp,F64 x1,F64 y1,F64 x2,F64 y2)
{ {
map->color=WHITE;
GrLine(map,x1,y1,x2,y2);
Line(bmp,x1*bmp_scale,y1*bmp_scale,0,x2*bmp_scale,y2*bmp_scale,0,&BmpPlot); 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, bmp_mem,bmp_mem/1024/1024,bmp_scale,
map->width,map->height,bmp_width,bmp_height); map->width,map->height,bmp_width,bmp_height);
GrPrint(dc,0,FONT_HEIGHT, GrPrint(dc,0,FONT_HEIGHT,
"PhotonCnt:%d SnellCnt:%d SnellInhibit:%d ZeroNormal:%d", "PhotonCnt:%d MirrorCnt:%d SnellCnt:%d SnellInhibit:%d ZeroNormal:%d",
photon_cnt,snell_cnt,snell_inhibit,zero_normal); photon_cnt,mirror_cnt,snell_cnt,normal_inhibit,zero_normal);
for (i=0;i<mp_cnt;i++) { for (i=0;i<mp_cnt;i++) {
while (LBts(&p_root_locks,i)) while (LBts(&p_root_locks,i))
Yield; Yield;
@@ -91,12 +86,15 @@ U0 DrawIt(CTask *,CDC *dc)
} }
} }
#define WING 9
U0 RayBurst(I64 x1,I64 y1,I64 x2,I64 y2) U0 RayBurst(I64 x1,I64 y1,I64 x2,I64 y2)
{ {
CD3 p,v,n,n2; CD3 p,v,n,n2;
I64 i; I64 i;
Photon *tmpp; Photon *tmpp;
if (x1!=x2 || y1!=y2) { if ((x1!=x2 || y1!=y2) && BORDER+WING<x2<map->width-BORDER-WING &&
BORDER+WING<y2<map->height-BORDER-WING) {
D3Equ(&p,x2,y2); D3Equ(&p,x2,y2);
D3Equ(&v,x2-x1,y2-y1); D3Equ(&v,x2-x1,y2-y1);
D3Unit(&v); D3Unit(&v);
@@ -106,7 +104,7 @@ U0 RayBurst(I64 x1,I64 y1,I64 x2,I64 y2)
D3Copy(&tmpp->p,&p); D3Copy(&tmpp->p,&p);
D3Copy(&tmpp->v,&v); D3Copy(&tmpp->v,&v);
for (i=2;i<=9;i+=3) { for (i=2;i<=WING;i+=3) {
D3Mul(&n2,i,&n); D3Mul(&n2,i,&n);
tmpp=PhotonNew; tmpp=PhotonNew;
@@ -127,19 +125,20 @@ U0 RandomBurst()
Photon *tmpp; Photon *tmpp;
for (i=0;i<256;i++) { for (i=0;i<256;i++) {
tmpp=PhotonNew; 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; é=2*ã*Rand;
D3Equ(&tmpp->v,Cos(é),Sin(é)); D3Equ(&tmpp->v,Cos(é),Sin(é));
} }
} }
U0 FindNormal(Photon *tmpp) U0 FindNormal(U8 *bmp,Photon *tmpp)
{ {
CD3 p,p1,p2; CD3 p,p1,p2;
F64 step,x,y,é=Arg(tmpp->v.x,tmpp->v.y),è; 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. //Coarse grains has black and white filled-in BSplines.
//Fine grained has only white outline without being filled-in. //Fine grained has only white outline without being filled-in.
@@ -149,7 +148,8 @@ U0 FindNormal(Photon *tmpp)
D3SubEqu(&tmpp->p,&tmpp->v); D3SubEqu(&tmpp->p,&tmpp->v);
D3Mul(&p,bmp_scale,&tmpp->p); D3Mul(&p,bmp_scale,&tmpp->p);
D3Copy(&p1,&p); D3Copy(&p1,&p);
while (BmpPeek(p1.x,p1.y)==BLACK && D3DistSqr(&p,&p1)<find_normal_dist_sqr) while (BmpPeek(bmp,p1.x,p1.y)==BLACK &&
D3DistSqr(&p,&p1)<find_normal_dist_sqr)
D3AddEqu(&p1,&tmpp->v); D3AddEqu(&p1,&tmpp->v);
D3Copy(&p,&p1); D3Copy(&p,&p1);
D3Div(&tmpp->p,&p,bmp_scale); D3Div(&tmpp->p,&p,bmp_scale);
@@ -159,25 +159,22 @@ U0 FindNormal(Photon *tmpp)
for (è=0;è<=ã/4;è+=step*ã/bmp_norm_radius) { for (è=0;è<=ã/4;è+=step*ã/bmp_norm_radius) {
x=p.x+bmp_norm_radius*Cos(é+ã-ã/4-è); x=p.x+bmp_norm_radius*Cos(é+ã-ã/4-è);
y=p.y+bmp_norm_radius*Sin(é+ã-ã/4-è); y=p.y+bmp_norm_radius*Sin(é+ã-ã/4-è);
c=BmpPeek(x,y); if (state=BmpPeek(bmp,x,y))
if (c!=BLACK)
goto fn_p1; goto fn_p1;
x=p.x+bmp_norm_radius*Cos(é+ã-ã/4+è); x=p.x+bmp_norm_radius*Cos(é+ã-ã/4+è);
y=p.y+bmp_norm_radius*Sin(é+ã-ã/4+è); y=p.y+bmp_norm_radius*Sin(é+ã-ã/4+è);
c=BmpPeek(x,y); if (state=BmpPeek(bmp,x,y))
if (c!=BLACK)
goto fn_p1; goto fn_p1;
} }
for (;è<=3*ã/4;è+=step*ã/bmp_norm_radius) { for (;è<=3*ã/4;è+=step*ã/bmp_norm_radius) {
x=p.x+bmp_norm_radius*Cos(é+ã-ã/4-è); x=p.x+bmp_norm_radius*Cos(é+ã-ã/4-è);
y=p.y+bmp_norm_radius*Sin(é+ã-ã/4-è); y=p.y+bmp_norm_radius*Sin(é+ã-ã/4-è);
c=BmpPeek(x,y); if (state=BmpPeek(bmp,x,y))
if (c!=BLACK)
goto fn_p1; goto fn_p1;
} }
} }
fn_p1: fn_p1:
if (c==WHITE) if (state)
D3Equ(&p1,x,y); D3Equ(&p1,x,y);
else else
D3Copy(&p1,&tmpp->p); D3Copy(&p1,&tmpp->p);
@@ -187,25 +184,22 @@ fn_p1:
for (è=0;è<=ã/4;è+=step*ã/bmp_norm_radius) { for (è=0;è<=ã/4;è+=step*ã/bmp_norm_radius) {
x=p.x+bmp_norm_radius*Cos(é+ã+ã/4+è); x=p.x+bmp_norm_radius*Cos(é+ã+ã/4+è);
y=p.y+bmp_norm_radius*Sin(é+ã+ã/4+è); y=p.y+bmp_norm_radius*Sin(é+ã+ã/4+è);
c=BmpPeek(x,y); if (state=BmpPeek(bmp,x,y))
if (c!=BLACK)
goto fn_p2; goto fn_p2;
x=p.x+bmp_norm_radius*Cos(é+ã+ã/4-è); x=p.x+bmp_norm_radius*Cos(é+ã+ã/4-è);
y=p.y+bmp_norm_radius*Sin(é+ã+ã/4-è); y=p.y+bmp_norm_radius*Sin(é+ã+ã/4-è);
c=BmpPeek(x,y); if (state=BmpPeek(bmp,x,y))
if (c!=BLACK)
goto fn_p2; goto fn_p2;
} }
for (;è<=3*ã/4;è+=step*ã/bmp_norm_radius) { for (;è<=3*ã/4;è+=step*ã/bmp_norm_radius) {
x=p.x+bmp_norm_radius*Cos(é+ã+ã/4+è); x=p.x+bmp_norm_radius*Cos(é+ã+ã/4+è);
y=p.y+bmp_norm_radius*Sin(é+ã+ã/4+è); y=p.y+bmp_norm_radius*Sin(é+ã+ã/4+è);
c=BmpPeek(x,y); if (state=BmpPeek(bmp,x,y))
if (c!=BLACK)
goto fn_p2; goto fn_p2;
} }
} }
fn_p2: fn_p2:
if (c==WHITE) if (state)
D3Equ(&p2,x,y); D3Equ(&p2,x,y);
else else
D3Copy(&p2,&tmpp->p); 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) U0 SnellsLaw(Photon *tmpp,I64 last,I64 next)
{ {
//n1 and n2 are refraction index. //n1 and n2 are refraction index.
//n1 Sin(é1) == n2 Sin(é2) //n1 Sin(é1) == n2 Sin(é2)
F64 é=Arg(tmpp->v.x,tmpp->v.y),én,n1,n2,é1,é2; F64 é=Arg(tmpp->v.x,tmpp->v.y),é$SY,3$n$SY,0$,n1,n2,é1,é2;
if (last==WHITE) if (last==LENS_COLOR)
n1=1.5; n1=1.5;
else else
n1=1.0; n1=1.0;
if (next==WHITE) if (next==LENS_COLOR)
n2=1.5; n2=1.5;
else else
n2=1.0; n2=1.0;
FindNormal(tmpp); FindNormal(bmp_refract,tmpp);
én=Arg(tmpp->n.x,tmpp->n.y); é$SY,3$n$SY,0$=Arg(tmpp->n.x,tmpp->n.y);
//Dot=m1m2Cos(é); //Dot=m1m2Cos(é);
é1=ACos(D3Dot(&tmpp->n,&tmpp->v)); é1=ACos(D3Dot(&tmpp->n,&tmpp->v));
é2=ASin(n1*Sin(é1)/n2); é2=ASin(n1*Sin(é1)/n2);
if (Wrap(é-én)>=0) if (Wrap(é-é$SY,3$n$SY,0$)>=0)
é=én+é2; é=é$SY,3$n$SY,0$+é2;
else else
é=én-é2; é=é$SY,3$n$SY,0$-é2;
D3Equ(&tmpp->v,Cos(é),Sin(é)); D3Equ(&tmpp->v,Cos(é),Sin(é));
lock {snell_cnt++;} lock {snell_cnt++;}
} }
@@ -272,37 +291,45 @@ U0 MPAnimateTask(I64)
while (tmpp!=root) { while (tmpp!=root) {
last=GrPeek(map,tmpp->p.x,tmpp->p.y); last=GrPeek(map,tmpp->p.x,tmpp->p.y);
D3AddEqu(&tmpp->p,&tmpp->v); D3AddEqu(&tmpp->p,&tmpp->v);
if (tmpp->p.x<0) { if (tmpp->p.x<BORDER) {
tmpp->p.x=-tmpp->p.x; tmpp->p.x=2*BORDER-tmpp->p.x;
tmpp->v.x=-tmpp->v.x; tmpp->v.x=-tmpp->v.x;
} }
if (tmpp->p.x>=map->width) { if (tmpp->p.x>=map->width-BORDER) {
tmpp->p.x-=tmpp->p.x-map->width; tmpp->p.x-=tmpp->p.x-map->width+BORDER;
tmpp->v.x=-tmpp->v.x; tmpp->v.x=-tmpp->v.x;
} }
if (tmpp->p.y<0) { if (tmpp->p.y<BORDER) {
tmpp->p.y=-tmpp->p.y; tmpp->p.y=2*BORDER-tmpp->p.y;
tmpp->v.y=-tmpp->v.y; tmpp->v.y=-tmpp->v.y;
} }
if (tmpp->p.y>=map->height) { if (tmpp->p.y>=map->height-BORDER) {
tmpp->p.y-=tmpp->p.y-map->height; tmpp->p.y-=tmpp->p.y-map->height+BORDER;
tmpp->v.y=-tmpp->v.y; tmpp->v.y=-tmpp->v.y;
} }
next=GrPeek(map,tmpp->p.x,tmpp->p.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; inhibit=TRUE;
else else
inhibit=FALSE; inhibit=FALSE;
if (last!=next && (last==BLACK && next==WHITE) || if (last!=next) {
(last==WHITE && next==BLACK)) { if ((last==BLACK && next==LENS_COLOR) ||
(last==LENS_COLOR && next==BLACK)) {
if (inhibit) if (inhibit)
lock {snell_inhibit++;} lock {normal_inhibit++;}
else else
SnellsLaw(tmpp,last,next); SnellsLaw(tmpp,last,next);
} else if (last==BLACK && next==MIRROR_COLOR) {
if (inhibit)
lock {normal_inhibit++;}
else
Mirror(tmpp);
} else if (!inhibit) } else if (!inhibit)
D3Zero(&tmpp->p_snell_inhibit); D3Zero(&tmpp->p_normal_inhibit);
} else if (!inhibit)
D3Zero(&tmpp->p_normal_inhibit);
tmpp=tmpp->next; tmpp=tmpp->next;
if (cnts.jiffies>=timeout_jiffy) if (cnts.jiffies>=timeout_jiffy)
@@ -328,7 +355,7 @@ U0 Init()
I64 i; I64 i;
master_sleep_jiffy=cnts.jiffies; master_sleep_jiffy=cnts.jiffies;
full_speed=show_normals=FALSE; 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); map=DCNew(Fs->pix_width,Fs->pix_height);
for (i=0;i<mp_cnt;i++) { for (i=0;i<mp_cnt;i++) {
while (LBts(&p_root_locks,i)) while (LBts(&p_root_locks,i))
@@ -342,12 +369,17 @@ U0 Init()
//640/480*y^2=bmp_mem*8 //640/480*y^2=bmp_mem*8
//y=Sqrt(bmp_mem*8*480/640) //y=Sqrt(bmp_mem*8*480/640)
//bmp_scale=Sqrt(bmp_mem*8*480/640)/480 //bmp_scale=Sqrt(bmp_mem*8*480/640)/480
bmp_scale=Sqrt(bmp_mem*8*Fs->pix_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); find_normal_dist_sqr=2*Sqr(bmp_scale);
#assert Sqrt(2)<=BORDER
bmp_width =bmp_scale*Fs->pix_width; bmp_width =bmp_scale*Fs->pix_width;
bmp_height=bmp_scale*Fs->pix_height; 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); bmp_norm_radius=Min(10*bmp_scale,250);
#assert 10<=BORDER
} }
U0 CleanUp() U0 CleanUp()
@@ -360,13 +392,16 @@ U0 CleanUp()
LBtr(&p_root_locks,i); LBtr(&p_root_locks,i);
} }
DCDel(map); DCDel(map);
Free(bmp); Free(bmp_refract);
Free(bmp_reflect);
} }
#define LTM_LINE 0 #define LTM_REFLECT_LINE 0
#define LTM_SPLINE 1 #define LTM_REFLECT_SPLINE 1
#define LTM_FLOOD_FILL 2 #define LTM_REFRACT_LINE 2
#define LTM_TEST_RAY 3 #define LTM_REFRACT_SPLINE 3
#define LTM_REFRACT_FLOOD_FILL 4
#define LTM_TEST_RAY 5
U0 LTMenuSet(I64 mode) U0 LTMenuSet(I64 mode)
{ {
@@ -376,18 +411,28 @@ U0 LTMenuSet(I64 mode)
else else
entry->checked=FALSE; entry->checked=FALSE;
entry=MenuEntryFind(Fs->cur_menu,"Mode/LineMode"); entry=MenuEntryFind(Fs->cur_menu,"Mode/ReflectLine");
if (mode==LTM_LINE) if (mode==LTM_REFLECT_LINE)
entry->checked=TRUE; entry->checked=TRUE;
else else
entry->checked=FALSE; entry->checked=FALSE;
entry=MenuEntryFind(Fs->cur_menu,"Mode/SplineMode"); entry=MenuEntryFind(Fs->cur_menu,"Mode/ReflectSpline");
if (mode==LTM_SPLINE) if (mode==LTM_REFLECT_SPLINE)
entry->checked=TRUE; entry->checked=TRUE;
else else
entry->checked=FALSE; entry->checked=FALSE;
entry=MenuEntryFind(Fs->cur_menu,"Mode/FloodFill"); entry=MenuEntryFind(Fs->cur_menu,"Mode/RefractLine");
if (mode==LTM_FLOOD_FILL) 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; entry->checked=TRUE;
else else
entry->checked=FALSE; entry->checked=FALSE;
@@ -401,7 +446,7 @@ U0 LTMenuSet(I64 mode)
#define PTS_NUM 1024 #define PTS_NUM 1024
U0 LightTable() 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)); CD3I32 *c=MAlloc(PTS_NUM*sizeof(CD3I32));
p_root_locks=0; p_root_locks=0;
@@ -412,10 +457,12 @@ U0 LightTable()
" Exit(,CH_ESC);" " Exit(,CH_ESC);"
"}" "}"
"Mode {" "Mode {"
" LineMode(,'0');" " ReflectLine(,'0');"
" SplineMode(,'1');" " ReflectSpline(,'1');"
" FloodFill(,'2');" " RefractLine(,'2');"
" TestRay(,'3');" " RefractSpline(,'3');"
" RefractFloodFill(,'4');"
" TestRay(,'5');"
"}" "}"
"Play {" "Play {"
" RandomBurst(,'r');" " RandomBurst(,'r');"
@@ -459,9 +506,10 @@ lt_restart:
Sweep(100,90,100); Sweep(100,90,100);
x2=arg1; y2=arg2; x2=arg1; y2=arg2;
switch (mode) { switch (mode) {
case LTM_FLOOD_FILL: case LTM_REFRACT_FLOOD_FILL:
map->color=LENS_COLOR;
GrFloodFill(map,x2,y2); GrFloodFill(map,x2,y2);
mode=LTM_LINE; mode=LTM_REFLECT_LINE;
LTMenuSet(mode); LTMenuSet(mode);
break; break;
case LTM_TEST_RAY: case LTM_TEST_RAY:
@@ -472,8 +520,12 @@ lt_restart:
case MSG_MS_L_DOWN: case MSG_MS_L_DOWN:
x1=arg1; y1=arg2; x1=arg1; y1=arg2;
switch (mode) { switch (mode) {
case LTM_LINE: case LTM_REFLECT_LINE:
map->color=ROP_XOR+WHITE; case LTM_REFRACT_LINE:
if (mode==LTM_REFLECT_LINE)
map->color=ROP_XOR+MIRROR_COLOR;
else
map->color=ROP_XOR+LENS_COLOR;
while (TRUE) { while (TRUE) {
x2=arg1; y2=arg2; x2=arg1; y2=arg2;
GrLine(map,x1,y1,x2,y2); GrLine(map,x1,y1,x2,y2);
@@ -488,11 +540,23 @@ lt_restart:
break; 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; break;
case LTM_SPLINE: case LTM_REFLECT_SPLINE:
case LTM_REFRACT_SPLINE:
cnt=0; 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 { do {
c[cnt].x=arg1; c[cnt].y=arg2; c[cnt].z=0; c[cnt].x=arg1; c[cnt].y=arg2; c[cnt].z=0;
Gr2BSpline(map,c,cnt+1); Gr2BSpline(map,c,cnt+1);
@@ -506,20 +570,27 @@ lt_restart:
cnt++; cnt++;
} }
} while (cnt<PTS_NUM-1 && msg_code!=MSG_MS_R_UP); } while (cnt<PTS_NUM-1 && msg_code!=MSG_MS_R_UP);
map->color=WHITE; if (mode==LTM_REFLECT_SPLINE)
map->color=MIRROR_COLOR;
else
map->color=LENS_COLOR;
Gr2BSpline3(map,c,cnt); Gr2BSpline3(map,c,cnt);
for (i=0;i<cnt;i++) { for (i=0;i<cnt;i++) {
c[i].x*=bmp_scale; c[i].x*=bmp_scale;
c[i].y*=bmp_scale; c[i].y*=bmp_scale;
} }
BSpline2(bmp,c,cnt,&BmpPlot); if (mode==LTM_REFLECT_SPLINE)
mode=LTM_LINE; BSpline2(bmp_refract,c,cnt,&BmpPlot);
else
BSpline2(bmp_refract,c,cnt,&BmpPlot);
mode=LTM_REFLECT_LINE;
LTMenuSet(mode); LTMenuSet(mode);
break; break;
} }
break; break;
case MSG_MS_R_UP: case MSG_MS_R_UP:
i=PopUpPickLst("Line\0Spline\0FloodFill\0TestRay\0"); i=PopUpPickLst("Reflect Line\0Reflect Spline\0Refract Line\0"
"Refract Spline\0Refract Flood Fill\0TestRay\0");
if (i>=0) { if (i>=0) {
mode=i; mode=i;
LTMenuSet(mode); LTMenuSet(mode);
@@ -530,7 +601,7 @@ lt_restart:
case '\n': case '\n':
CleanUp; CleanUp;
Init; Init;
mode=LTM_LINE; mode=LTM_REFLECT_LINE;
LTMenuSet(mode); LTMenuSet(mode);
break; break;
case 'r': case 'r':
@@ -546,7 +617,7 @@ lt_restart:
show_normals=!show_normals; show_normals=!show_normals;
LTMenuSet(mode); LTMenuSet(mode);
break; break;
case '0'...'3': case '0'...'5':
mode=arg1-'0'; mode=arg1-'0';
LTMenuSet(mode); LTMenuSet(mode);
break; break;
@@ -570,3 +641,4 @@ lt_done:
} }
LightTable; 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$
+16 -10
View File
@@ -48,7 +48,7 @@ U0 PrsSingleLogFile(LogStruct *head,U8 *name,CDate *_start,CDate *_end)
LogStruct *tmplg; LogStruct *tmplg;
CDateStruct ds; CDateStruct ds;
I64 i; I64 i;
"%Q\n",name; "%$$Q\n",name;
while (doc_e!=doc) { while (doc_e!=doc) {
if (doc_e->type_u8==DOCT_TEXT) { if (doc_e->type_u8==DOCT_TEXT) {
tmplg=CAlloc(sizeof(LogStruct)); tmplg=CAlloc(sizeof(LogStruct));
@@ -124,7 +124,7 @@ U0 PrsSingleLogFile(LogStruct *head,U8 *name,CDate *_start,CDate *_end)
throw; throw;
} catch { } catch {
Fs->catch_except=TRUE; Fs->catch_except=TRUE;
"%Q\n",doc_e->tag; "%$$Q\n",doc_e->tag;
LogStructDel(tmplg); LogStructDel(tmplg);
} }
} }
@@ -317,7 +317,7 @@ U0 LinkTreeTraverse(LinkStruct *root)
{ {
if (root) { if (root) {
LinkTreeTraverse(root->left); LinkTreeTraverse(root->left);
"%3d:%Q\n",root->cnt,root->link; "%3d:%$$Q\n",root->cnt,root->link;
LinkTreeTraverse(root->right); LinkTreeTraverse(root->right);
} }
} }
@@ -335,7 +335,7 @@ U0 FileTreeTraverse(LinkStruct *root)
{ {
if (root) { if (root) {
FileTreeTraverse(root->left); FileTreeTraverse(root->left);
"%3d:%Q\n",root->cnt,root->file; "%3d:%$$Q\n",root->cnt,root->file;
FileTreeTraverse(root->right); FileTreeTraverse(root->right);
} }
} }
@@ -378,8 +378,11 @@ U0 DownLoadRep(LogStruct *head,CDate start,CDate end)
"\n\nDownloads of /TempleOSCD.ISO\n"; "\n\nDownloads of /TempleOSCD.ISO\n";
for (i=start;i<=end;i+=1<<32) for (i=start;i<=end;i+=1<<32)
"%D:%5d%5d\n",i,day_dup_cnts[(i+local_time_offset)>>32-days_start], "%D Dups:%5d Total:%5d Uniques:%5d\n",i,
day_cnts[(i+local_time_offset)>>32-days_start]; 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" "\n\nDownloads of /TempleOSCD.ISO\n"
"'-' is a dup. '+' is not a dup.\n"; "'-' is a dup. '+' is not a dup.\n";
@@ -396,7 +399,7 @@ U0 DownLoadRep(LogStruct *head,CDate start,CDate end)
'+'; '+';
'\n'; '\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"; "\n\nDownloads of /TempleOSCD.ISO\n";
LinkTreeTraverse(link_root); LinkTreeTraverse(link_root);
@@ -463,8 +466,11 @@ U0 IndexRep(LogStruct *head,CDate start,CDate end)
"\n\nHits on /index.html\n" "\n\nHits on /index.html\n"
"'-' is a dup. '+' is not a dup.\n"; "'-' is a dup. '+' is not a dup.\n";
for (i=start;i<=end;i+=1<<32) for (i=start;i<=end;i+=1<<32)
"%D:%5d%5d\n",i,day_dup_cnts[(i+local_time_offset)>>32-days_start], "%D Dups:%5d Total:%5d Uniques:%5d\n",i,
day_cnts[(i+local_time_offset)>>32-days_start]; 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"; "\n\nHits on /index.html\n";
if (hours_end-hours_start>=HOURS_MAX) if (hours_end-hours_start>=HOURS_MAX)
@@ -480,7 +486,7 @@ U0 IndexRep(LogStruct *head,CDate start,CDate end)
'+'; '+';
'\n'; '\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"; "\n\nHits on /index.html\n";
LinkTreeTraverse(link_root); LinkTreeTraverse(link_root);
+3
View File
@@ -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. 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$ $IV,1$----01/31/17 10:22:10----$IV,0$
* Added $LK,"::/Demo/Graphics/LightTable.HC"$. * Added $LK,"::/Demo/Graphics/LightTable.HC"$.
* Added $LK,"TOS Linux Setup",A="FF:::/Demo/AcctExample/TOS/TOSPolicies.DD,TOS Linux Setup"$. * Added $LK,"TOS Linux Setup",A="FF:::/Demo/AcctExample/TOS/TOSPolicies.DD,TOS Linux Setup"$.
+1 -1
View File
@@ -582,6 +582,7 @@ public _extern _MSIZE2 I64 MSize2(U8 *src); //Internal size
public extern U0 HeapCtrlDel(CHeapCtrl *hc); public extern U0 HeapCtrlDel(CHeapCtrl *hc);
public extern CHeapCtrl *HeapCtrlInit(CHeapCtrl *hc=NULL, public extern CHeapCtrl *HeapCtrlInit(CHeapCtrl *hc=NULL,
CTask *task=NULL,CBlkPool *bp); CTask *task=NULL,CBlkPool *bp);
#help_index "Memory/Page Tables" #help_index "Memory/Page Tables"
public extern I64 *MemPageTable(U8 *a); 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 U8 *task_name=NULL,I64 target_cpu=-1, //-1 means current CPU
CTask *parent=NULL, //NULL means adam CTask *parent=NULL, //NULL means adam
I64 stk_size=0,I64 flags=1<<JOBf_ADD_TO_QUE); I64 stk_size=0,I64 flags=1<<JOBf_ADD_TO_QUE);
#help_index "Time/CPU Cycles;Time/HPET;Time/Jiffies" #help_index "Time/CPU Cycles;Time/HPET;Time/Jiffies"
public extern CCntsGlbls cnts; public extern CCntsGlbls cnts;
+4 -3
View File
@@ -659,10 +659,11 @@ U0 DoLightTable()
{ {
CTask *task=User("#include \"::/Demo/Graphics/LightTable\";\n\n"); CTask *task=User("#include \"::/Demo/Graphics/LightTable\";\n\n");
TaskWait(task); TaskWait(task);
PostMsgWait(task,MSG_KEY_DOWN_UP,'2',0);
PostMsgWait(task,MSG_MS_L_DOWN, 100 ,200); PostMsgWait(task,MSG_MS_L_DOWN, 100 ,200);
PostMsgWait(task,MSG_MS_L_UP, 640-100 ,200); PostMsgWait(task,MSG_MS_L_UP, 640-100 ,200);
PostMsgWait(task,MSG_KEY_DOWN_UP,'1',0); PostMsgWait(task,MSG_KEY_DOWN_UP,'3',0);
PostMsgWait(task,MSG_MS_L_DOWN_UP,100 ,200); PostMsgWait(task,MSG_MS_L_DOWN_UP,100 ,200);
PostMsgWait(task,MSG_MS_L_DOWN_UP,100 ,200); PostMsgWait(task,MSG_MS_L_DOWN_UP,100 ,200);
PostMsgWait(task,MSG_MS_L_DOWN_UP,100 ,200); PostMsgWait(task,MSG_MS_L_DOWN_UP,100 ,200);
@@ -676,10 +677,10 @@ U0 DoLightTable()
PostMsgWait(task,MSG_MS_L_DOWN_UP,640-100 ,200); PostMsgWait(task,MSG_MS_L_DOWN_UP,640-100 ,200);
PostMsgWait(task,MSG_MS_R_DOWN_UP,0,0); PostMsgWait(task,MSG_MS_R_DOWN_UP,0,0);
PostMsgWait(task,MSG_KEY_DOWN_UP,'2',0); PostMsgWait(task,MSG_KEY_DOWN_UP,'4',0);
PostMsgWait(task,MSG_MS_L_DOWN_UP,320,190); PostMsgWait(task,MSG_MS_L_DOWN_UP,320,190);
PostMsgWait(task,MSG_KEY_DOWN_UP,'3',0); PostMsgWait(task,MSG_KEY_DOWN_UP,'5',0);
PostMsgWait(task,MSG_MS_L_DOWN,460,280); PostMsgWait(task,MSG_MS_L_DOWN,460,280);
PostMsgWait(task,MSG_MS_L_UP ,500,220); PostMsgWait(task,MSG_MS_L_UP ,500,220);